function CzechQuestsAddon:GetData(key, id) if CzechQuestsAddon.data[key] then if key == "quest" then if CzechQuestsAddon.data[key][id] then local quest = CzechQuestsAddon.data[key][id]; local function ResolveFemaleVersion(maleVersion, femaleVersion) local gender = UnitSex("player") if gender == 2 then return maleVersion else return femaleVersion == "" and maleVersion or femaleVersion end end local standardQuest = { title = ResolveFemaleVersion(quest.titleMale, quest.titleFemale), objective = ResolveFemaleVersion(quest.objectiveMale, quest.objectiveFemale), description = ResolveFemaleVersion(quest.descriptionMale, quest.descriptionFemale), progress = ResolveFemaleVersion(quest.progressMale, quest.progressFemale), completion = ResolveFemaleVersion(quest.completionMale, quest.completionFemale), } return standardQuest end elseif CzechQuestsAddon.data[key][id] then return CzechQuestsAddon.data[key][id] end end return nil end function CzechQuestsAddon:replacePlaceholders(text) if text == nil then return text end local playerName = UnitName("player") local _, playerClass = UnitClass("player") local _, playerRace = UnitRace("player") local class = CzechQuestsAddon:GetData("class", playerClass); local race = CzechQuestsAddon:GetData("race", playerRace); local formatted = text; formatted = string.gsub(formatted, '', playerName); formatted = string.gsub(formatted, '', class.f0); formatted = string.gsub(formatted, '', class.f1); formatted = string.gsub(formatted, '', class.f2); formatted = string.gsub(formatted, '', class.f3); formatted = string.gsub(formatted, '', class.f4); formatted = string.gsub(formatted, '', class.f5); formatted = string.gsub(formatted, '', class.m0); formatted = string.gsub(formatted, '', class.m1); formatted = string.gsub(formatted, '', class.m2); formatted = string.gsub(formatted, '', class.m3); formatted = string.gsub(formatted, '', class.m4); formatted = string.gsub(formatted, '', class.p0); formatted = string.gsub(formatted, '', class.p1); formatted = string.gsub(formatted, '', class.m3); formatted = string.gsub(formatted, '', race.f0); formatted = string.gsub(formatted, '', race.f1); formatted = string.gsub(formatted, '', race.f2); formatted = string.gsub(formatted, '', race.f3); formatted = string.gsub(formatted, '', race.f4); formatted = string.gsub(formatted, '', race.f5); formatted = string.gsub(formatted, '', race.m0); formatted = string.gsub(formatted, '', race.m1); formatted = string.gsub(formatted, '', race.m2); formatted = string.gsub(formatted, '', race.m3); formatted = string.gsub(formatted, '', race.m4); formatted = string.gsub(formatted, '', race.p0); formatted = string.gsub(formatted, '', race.p1); formatted = string.gsub(formatted, '', race.p3); return formatted end function CzechQuestsAddon:dumpTable(tbl, indent) -- Initialize indent if not provided indent = indent or 0 -- Check if the input is actually a table if type(tbl) ~= "table" then print(string.rep(" ", indent) .. tostring(tbl)) return end -- Iterate through the table and print keys and values for k, v in pairs(tbl) do local formatting = string.rep(" ", indent) .. tostring(k) .. ": " if type(v) == "table" then print(formatting) CzechQuestsAddon:dumpTable(v, indent + 1) elseif type(v) == "boolean" then print(formatting .. (v and "true" or "false")) else print(formatting .. tostring(v)) end end end