Module:AchievementSystem: Difference between revisions
// via Wikitext Extension for VSCode |
// via Wikitext Extension for VSCode |
||
| Line 1: | Line 1: | ||
-- Module:AchievementSystem | -- Module:AchievementSystem | ||
-- | -- Loads data from MediaWiki:AchievementData.json | ||
-- | -- All achievement styling is defined in CSS/Templates.css, not in the JSON. This module only assigns CSS classes based on achievement IDs in the format: | ||
-- .person-template .template-title.achievement-{id}::after {} | |||
-- | |||
local Achievements = {} | local Achievements = {} | ||
| Line 47: | Line 44: | ||
end | end | ||
-- | -- Use MediaWiki's built-in JSON functions directly | ||
local function jsonDecode(jsonString) | local function jsonDecode(jsonString) | ||
if not jsonString then return nil end | if not jsonString then return nil end | ||
| Line 81: | Line 78: | ||
-- Configuration, Default Data, and Cache | -- Configuration, Default Data, and Cache | ||
-------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | ||
local ACHIEVEMENT_DATA_PAGE = 'MediaWiki:AchievementData.json' | local ACHIEVEMENT_DATA_PAGE = 'MediaWiki:AchievementData.json' | ||
local dataCache = nil | local dataCache = nil | ||
| Line 172: | Line 168: | ||
end | end | ||
end | end | ||
-- As an absolute last resort, use local default data | |||
-- As absolute last resort, use local default data | |||
return DEFAULT_DATA | return DEFAULT_DATA | ||
end) | end) | ||