Dagi
23-10-2006, 05:44 AM
Let me start by saying that this is my first time trying to modify addons.
I love the XP timer of the Titan panel, but I wanted a little more. I wanted to find out how long it would take me to get to level 60. I found an addon called "to60" that calculates experience needed until level 60, but I'm having problems trying to combine the two. I get a "string error." I think it has to do with the formula I'm trying to use to calculate time to gain all that XP, but I'm not sure. Can anyone help? This is the modified part where I'm trying to calculate/display the time.
I've edited more than that, I can post if you need more to go on.
function TitanPanelXPButton_GetTooltipText()
local totalTime = TitanUtils_GetTotalTime();
local sessionTime = TitanUtils_GetSessionTime() - this.startSessionTime;
local levelTime = TitanUtils_GetLevelTime();
local totalXP = UnitXPMax("player");
local currentXP = UnitXP("player");
local toLevelXP = totalXP - currentXP;
local toLevel60XP = XPTOLEVEL60;
local currentXPPercent = currentXP / totalXP * 100;
local toLevelXPPercent = toLevelXP / totalXP * 100;
local xpPerHourThisLevel = currentXP / levelTime * 3600;
local xpPerHourThisSession = this.sessionXP / sessionTime * 3600;
local estTimeToLevelThisLevel = TitanUtils_Ternary((currentXP == 0), -1, toLevelXP / currentXP * levelTime);
local estTimeToLevelThisSession = TitanUtils_Ternary((this.sessionXP == 0), -1, toLevelXP / this.sessionXP * sessionTime);
local estTimeToLevelSixtyThisLevel = TitanUtils_Ternary((currentXP == 0), -1, toLevel60XP / currentXP * levelTime);
local estTimeToLevelSixtyThisSession = TitanUtils_Ternary((this.sessionXP == 0), -1, toLevel60XP / this.sessionXP * sessionTime);
return ""..
TITAN_XP_TOOLTIP_TOTAL_TIME.."\t"..TitanUtils_GetHighlightText(TitanUtils_GetAbbrTimeText(totalTime)).."\n"..
TITAN_XP_TOOLTIP_LEVEL_TIME.."\t"..TitanUtils_GetHighlightText(TitanUtils_GetAbbrTimeText(levelTime)).."\n"..
TITAN_XP_TOOLTIP_SESSION_TIME.."\t"..TitanUtils_GetHighlightText(TitanUtils_GetAbbrTimeText(sessionTime)).."\n"..
"\n"..
TITAN_XP_TOOLTIP_TOTAL_XP.."\t"..TitanUtils_GetHighlightText(totalXP).."\n"..
TITAN_XP_TOOLTIP_LEVEL_XP.."\t"..TitanUtils_GetHighlightText(format(TITAN_XP_PERCENT_FORMAT, currentXP, currentXPPercent)).."\n"..
TITAN_XP_TOOLTIP_TOLEVEL_XP.."\t"..TitanUtils_GetHighlightText(format(TITAN_XP_PERCENT_FORMAT, toLevelXP, toLevelXPPercent)).."\n"..
TITAN_XP_TOOLTIP_SESSION_XP.."\t"..TitanUtils_GetHighlightText(this.sessionXP).."\n"..
"\n"..
TITAN_XP_TOOLTIP_XPHR_LEVEL.."\t"..TitanUtils_GetHighlightText(format(TITAN_XP_FORMAT, xpPerHourThisLevel)).."\n"..
TITAN_XP_TOOLTIP_XPHR_SESSION.."\t"..TitanUtils_GetHighlightText(format(TITAN_XP_FORMAT, xpPerHourThisSession)).."\n"..
TITAN_XP_TOOLTIP_TOLEVEL_LEVEL.."\t"..TitanUtils_GetHighlightText(TitanUtils_GetAbbrTimeText(estTimeToLevelThisLevel)).."\n"..
TITAN_XP_TOOLTIP_TOLEVEL_SESSION.."\t"..TitanUtils_GetHighlightText(TitanUtils_GetAbbrTimeText(estTimeToLevelThisSession))"\n"..
"\n"..
TITAN_XP_TOOLTIP_TOLEVEL60_LEVEL.."\t"..TitanUtils_GetHighlightText(format(TITAN_XP_FORMAT, estTimeToLevelSixtyThisLevel)).."\n"..
TITAN_XP_TOOLTIP_TOLEVEL60_SESSION.."\t"..TitanUtils_GetHighlightText(format(TITAN_XP_FORMAT, estTimeToLevelSixtyThisSession));
end
I love the XP timer of the Titan panel, but I wanted a little more. I wanted to find out how long it would take me to get to level 60. I found an addon called "to60" that calculates experience needed until level 60, but I'm having problems trying to combine the two. I get a "string error." I think it has to do with the formula I'm trying to use to calculate time to gain all that XP, but I'm not sure. Can anyone help? This is the modified part where I'm trying to calculate/display the time.
I've edited more than that, I can post if you need more to go on.
function TitanPanelXPButton_GetTooltipText()
local totalTime = TitanUtils_GetTotalTime();
local sessionTime = TitanUtils_GetSessionTime() - this.startSessionTime;
local levelTime = TitanUtils_GetLevelTime();
local totalXP = UnitXPMax("player");
local currentXP = UnitXP("player");
local toLevelXP = totalXP - currentXP;
local toLevel60XP = XPTOLEVEL60;
local currentXPPercent = currentXP / totalXP * 100;
local toLevelXPPercent = toLevelXP / totalXP * 100;
local xpPerHourThisLevel = currentXP / levelTime * 3600;
local xpPerHourThisSession = this.sessionXP / sessionTime * 3600;
local estTimeToLevelThisLevel = TitanUtils_Ternary((currentXP == 0), -1, toLevelXP / currentXP * levelTime);
local estTimeToLevelThisSession = TitanUtils_Ternary((this.sessionXP == 0), -1, toLevelXP / this.sessionXP * sessionTime);
local estTimeToLevelSixtyThisLevel = TitanUtils_Ternary((currentXP == 0), -1, toLevel60XP / currentXP * levelTime);
local estTimeToLevelSixtyThisSession = TitanUtils_Ternary((this.sessionXP == 0), -1, toLevel60XP / this.sessionXP * sessionTime);
return ""..
TITAN_XP_TOOLTIP_TOTAL_TIME.."\t"..TitanUtils_GetHighlightText(TitanUtils_GetAbbrTimeText(totalTime)).."\n"..
TITAN_XP_TOOLTIP_LEVEL_TIME.."\t"..TitanUtils_GetHighlightText(TitanUtils_GetAbbrTimeText(levelTime)).."\n"..
TITAN_XP_TOOLTIP_SESSION_TIME.."\t"..TitanUtils_GetHighlightText(TitanUtils_GetAbbrTimeText(sessionTime)).."\n"..
"\n"..
TITAN_XP_TOOLTIP_TOTAL_XP.."\t"..TitanUtils_GetHighlightText(totalXP).."\n"..
TITAN_XP_TOOLTIP_LEVEL_XP.."\t"..TitanUtils_GetHighlightText(format(TITAN_XP_PERCENT_FORMAT, currentXP, currentXPPercent)).."\n"..
TITAN_XP_TOOLTIP_TOLEVEL_XP.."\t"..TitanUtils_GetHighlightText(format(TITAN_XP_PERCENT_FORMAT, toLevelXP, toLevelXPPercent)).."\n"..
TITAN_XP_TOOLTIP_SESSION_XP.."\t"..TitanUtils_GetHighlightText(this.sessionXP).."\n"..
"\n"..
TITAN_XP_TOOLTIP_XPHR_LEVEL.."\t"..TitanUtils_GetHighlightText(format(TITAN_XP_FORMAT, xpPerHourThisLevel)).."\n"..
TITAN_XP_TOOLTIP_XPHR_SESSION.."\t"..TitanUtils_GetHighlightText(format(TITAN_XP_FORMAT, xpPerHourThisSession)).."\n"..
TITAN_XP_TOOLTIP_TOLEVEL_LEVEL.."\t"..TitanUtils_GetHighlightText(TitanUtils_GetAbbrTimeText(estTimeToLevelThisLevel)).."\n"..
TITAN_XP_TOOLTIP_TOLEVEL_SESSION.."\t"..TitanUtils_GetHighlightText(TitanUtils_GetAbbrTimeText(estTimeToLevelThisSession))"\n"..
"\n"..
TITAN_XP_TOOLTIP_TOLEVEL60_LEVEL.."\t"..TitanUtils_GetHighlightText(format(TITAN_XP_FORMAT, estTimeToLevelSixtyThisLevel)).."\n"..
TITAN_XP_TOOLTIP_TOLEVEL60_SESSION.."\t"..TitanUtils_GetHighlightText(format(TITAN_XP_FORMAT, estTimeToLevelSixtyThisSession));
end