Module:TalentCalculator

From August Wiki
Revision as of 12:57, 16 May 2025 by Steve (talk | contribs) (Replaced content with "-- Talent Calculator for MediaWiki local p = {} -- [Keep all your existing code for talentTrees, generateTalents(), etc.] -- Main rendering function function p.renderTalentCalculator(frame) -- [Keep the existing function content] -- Return just the JSON data and a div with ID return { html = '<div id="talent-calculator-container">Loading talent calculator...</div>', talentsData = mw.text.jsonEncode(talents), treeConfig = mw....")
Jump to navigation Jump to search

Documentation for this module may be created at Module:TalentCalculator/doc

-- Talent Calculator for MediaWiki
local p = {}

-- [Keep all your existing code for talentTrees, generateTalents(), etc.]

-- Main rendering function
function p.renderTalentCalculator(frame)
    -- [Keep the existing function content]
    
    -- Return just the JSON data and a div with ID
    return {
        html = '<div id="talent-calculator-container">Loading talent calculator...</div>',
        talentsData = mw.text.jsonEncode(talents),
        treeConfig = mw.text.jsonEncode(talentTrees)
    }
end

-- Modified main function
function p.main(frame)
    local data = p.renderTalentCalculator(frame)
    
    -- Create a template call to handle the HTML rendering
    return frame:expandTemplate{
        title = 'TalentCalculatorTemplate',
        args = {
            html = data.html,
            talentsData = data.talentsData,
            treeConfig = data.treeConfig
        }
    }
end

return p