I'm trying to modify an outdated addon (El Chivato) for myself and there's a bug I can't fix with my limited coding knowledge.
When I complete a quest the XP appear twice.
The code I use is:
Lua Code:
local function PrintXP(color, text)
-- convert text to string to prevent passing nil arguments to d
d(color .. tostring(text))
end
-- Finish a Quest
local function OnQuestCompleteXP(event, questName, level, prevXP, newXP, rank, prevVP, newVP)
PrintXP(colors.Quest, "Completed Quest: " .. questName ..". +" .. newXP - prevXP .. " XP")
end
-- Finish a Quest
EVENT_MANAGER:RegisterForEvent(Chivato.name, EVENT_QUEST_COMPLETE, OnQuestCompleteXP)
In the Wiki I read "- For some quests, can triggers twice " for EVENT_QUEST_COMPLETE so it seems to be an API problem.
Is there a way to prevent a double output?
And when I'm here already, how do I get rid of the suffixes in German names? I've seen that other addons managed to do this.
Thanks in advance!