Added new stat 'real time since begin'

This commit is contained in:
Leonetienne 2021-08-06 02:25:16 +02:00
parent 8bf4ebfbd5
commit 85c7569f2c
3 changed files with 66 additions and 40 deletions

View File

@ -13,7 +13,7 @@
# These are the settings values. # These are the settings values.
## SavedVariablesPerCharacter: Trackster_deathOffset, Trackster_killsOffset, Trackster_questsOffset, Trackster_dmgOffset, Trackster_jumpOffset, Trackster_IlvlOffset, Trackster_castOffset, Trackster_critOffset, Trackster_loginOffset, Trackster_bossOffset, Trackster_chatOffset, Trackster_itemOffset, Trackster_timeOffset, Trackster_goldOffset, Trackster_distanceTravelledOffset ## SavedVariablesPerCharacter: Trackster_deathOffset, Trackster_killsOffset, Trackster_questsOffset, Trackster_dmgOffset, Trackster_jumpOffset, Trackster_IlvlOffset, Trackster_castOffset, Trackster_critOffset, Trackster_loginOffset, Trackster_bossOffset, Trackster_chatOffset, Trackster_itemOffset, Trackster_timeOffset, Trackster_goldOffset, Trackster_distanceTravelledOffset, Trackster_timestampRunBegin
# These are internal values. Just don't touch those. # These are internal values. Just don't touch those.
## SavedVariablesPerCharacter: Trackster_showMainframe, Trackster_frameScale ## SavedVariablesPerCharacter: Trackster_showMainframe, Trackster_frameScale

View File

@ -95,7 +95,9 @@ local fsItem = mainFrame:CreateFontString(nil, "OVERLAY", textFont);
Trackster_itemOffset = 0; Trackster_itemOffset = 0;
local fsTime = mainFrame:CreateFontString(nil, "OVERLAY", textFont); local fsTime = mainFrame:CreateFontString(nil, "OVERLAY", textFont);
local fsAbsTime = mainFrame:CreateFontString(nil, "OVERLAY", textFont);
Trackster_timeOffset = 0; Trackster_timeOffset = 0;
Trackster_timestampRunBegin = 0;
local lastConfirmedTime = 0; local lastConfirmedTime = 0;
local internalTimeOffset = 0; local internalTimeOffset = 0;
@ -121,22 +123,23 @@ mainFrame:SetBackdrop({
fsKills:SetPoint("TOPLEFT", textMarginL, -(textMarginT + (0 * textMarginB))); fsKills:SetPoint("TOPLEFT", textMarginL, -(textMarginT + (0 * textMarginB)));
fsDeaths:SetPoint("TOPLEFT", textMarginL, -(textMarginT + (1 * textMarginB))); fsDeaths:SetPoint("TOPLEFT", textMarginL, -(textMarginT + (1 * textMarginB)));
fsTime:SetPoint("TOPLEFT", textMarginL, -(textMarginT + (2 * textMarginB))); fsTime:SetPoint("TOPLEFT", textMarginL, -(textMarginT + (2 * textMarginB)));
fsDist:SetPoint("TOPLEFT", textMarginL, -(textMarginT + (3 * textMarginB))); fsAbsTime:SetPoint("TOPLEFT", textMarginL, -(textMarginT + (3 * textMarginB)));
fsQuests:SetPoint("TOPLEFT", textMarginL, -(textMarginT + (4 * textMarginB))); fsDist:SetPoint("TOPLEFT", textMarginL, -(textMarginT + (4 * textMarginB)));
fsPlvl:SetPoint("TOPLEFT", textMarginL, -(textMarginT + (5 * textMarginB))); fsQuests:SetPoint("TOPLEFT", textMarginL, -(textMarginT + (5 * textMarginB)));
fsIlvl:SetPoint("TOPLEFT", textMarginL, -(textMarginT + (6 * textMarginB))); fsPlvl:SetPoint("TOPLEFT", textMarginL, -(textMarginT + (6 * textMarginB)));
fsIlvl:SetPoint("TOPLEFT", textMarginL, -(textMarginT + (7 * textMarginB)));
--fsDmg:SetPoint("TOPLEFT", textMarginL, -(textMarginT + (5 * textMarginB))); --fsDmg:SetPoint("TOPLEFT", textMarginL, -(textMarginT + (5 * textMarginB)));
fsGold:SetPoint("TOPLEFT", textMarginL, -(textMarginT + (7 * textMarginB))); fsGold:SetPoint("TOPLEFT", textMarginL, -(textMarginT + (8 * textMarginB)));
fsBoss:SetPoint("TOPLEFT", textMarginL, -(textMarginT + (8 * textMarginB))); fsBoss:SetPoint("TOPLEFT", textMarginL, -(textMarginT + (9 * textMarginB)));
fsCasts:SetPoint("TOPLEFT", textMarginL, -(textMarginT + (9 * textMarginB))); fsCasts:SetPoint("TOPLEFT", textMarginL, -(textMarginT + (10 * textMarginB)));
fsCrits:SetPoint("TOPLEFT", textMarginL, -(textMarginT + (10 * textMarginB))); fsCrits:SetPoint("TOPLEFT", textMarginL, -(textMarginT + (11 * textMarginB)));
fsLogins:SetPoint("TOPLEFT", textMarginL, -(textMarginT + (11 * textMarginB))); fsLogins:SetPoint("TOPLEFT", textMarginL, -(textMarginT + (12 * textMarginB)));
--fsItem:SetPoint("TOPLEFT", textMarginL, -(textMarginT + (12 * textMarginB))); --fsItem:SetPoint("TOPLEFT", textMarginL, -(textMarginT + (12 * textMarginB)));
fsChat:SetPoint("TOPLEFT", textMarginL, -(textMarginT + (12 * textMarginB))); fsChat:SetPoint("TOPLEFT", textMarginL, -(textMarginT + (13 * textMarginB)));
fsJump:SetPoint("TOPLEFT", textMarginL, -(textMarginT + (13 * textMarginB))); fsJump:SetPoint("TOPLEFT", textMarginL, -(textMarginT + (14 * textMarginB)));
mainFrame:SetWidth(220 + textMarginL); mainFrame:SetWidth(220 + textMarginL);
mainFrame:SetHeight((textMarginT * 2) + (textMarginB * 14)); mainFrame:SetHeight((textMarginT * 2) + (textMarginB * 15));
mainFrame:EnableMouse(true); mainFrame:EnableMouse(true);
mainFrame:SetPoint("CENTER", 480, 0, UIParent); mainFrame:SetPoint("CENTER", 480, 0, UIParent);
mainFrame:SetMovable(true); mainFrame:SetMovable(true);
@ -364,7 +367,10 @@ local function UpdateTime()
local d, h, m, s = select(1, FormatTime(lastConfirmedTime + internalTimeOffset + Trackster_timeOffset)); local d, h, m, s = select(1, FormatTime(lastConfirmedTime + internalTimeOffset + Trackster_timeOffset));
fsTime:SetText("Time played: " .. d .. ":" .. h .. ":" .. m .. ":" .. s); fsTime:SetText("Time played: " .. d .. " days, " .. h .. ":" .. m .. ":" .. s);
local d, h, m, s = select(1, FormatTime(time() - Trackster_timestampRunBegin));
fsAbsTime:SetText("Time (real): " .. d .. " days, " .. h .. ":" .. m .. ":" .. s);
end end
@ -648,6 +654,10 @@ local function eventHandler(self, event, ...)
local addonName = select(1, ...); local addonName = select(1, ...);
if(addonName == "Trackster") then if(addonName == "Trackster") then
if (Trackster_timestampRunBegin == 0) then
Trackster_timestampRunBegin = time();
end
mainFrame:SetUserPlaced(true); mainFrame:SetUserPlaced(true);
Trackster.SetFrameScale(Trackster_frameScale); Trackster.SetFrameScale(Trackster_frameScale);
Trackster.SetRenderMainFrame(Trackster_showMainframe); Trackster.SetRenderMainFrame(Trackster_showMainframe);
@ -668,6 +678,7 @@ Trackster.ResetAllStats = function()
Trackster_bossCounter = 0; Trackster_bossCounter = 0;
Trackster_chatCounter = 0; Trackster_chatCounter = 0;
Trackster_itemCounter = 0; Trackster_itemCounter = 0;
Trackster_timestampRunBegin = time();
UpdateAll(); UpdateAll();
end end

View File

@ -103,7 +103,7 @@ local editboxMarginL = 150;
local fsInfo = optionsFrame:CreateFontString(nil, "OVERLAY", "GameFontNormal"); local fsInfo = optionsFrame:CreateFontString(nil, "OVERLAY", "GameFontNormal");
fsInfo:SetText("Thanks for using Trackster!\nPlease note, that some stats are only tracked by this AddOn, hence only count\n upwards from the point of installation. If you want some stats to be tracked\naccount wide, just change them in the .toc file in the AddOn folder!\nHave fun! -Allpi"); fsInfo:SetText("Thanks for using Trackster!\nPlease note, that some stats are only tracked by this AddOn, hence only count\n upwards from the point of installation. If you want some stats to be tracked\naccount wide, just change them in the .toc file in the AddOn folder!\nHave fun! -Allpi");
fsInfo:SetPoint("CENTER", 0, -200); fsInfo:SetPoint("CENTER", 0, -230);
local fsKills = optionsFrame:CreateFontString(nil, "OVERLAY", textFont); local fsKills = optionsFrame:CreateFontString(nil, "OVERLAY", textFont);
local fsDeaths = optionsFrame:CreateFontString(nil, "OVERLAY", textFont); local fsDeaths = optionsFrame:CreateFontString(nil, "OVERLAY", textFont);
@ -119,29 +119,32 @@ local fsItem = optionsFrame:CreateFontString(nil, "OVERLAY", textFont);
local fsChat = optionsFrame:CreateFontString(nil, "OVERLAY", textFont); local fsChat = optionsFrame:CreateFontString(nil, "OVERLAY", textFont);
local fsJump = optionsFrame:CreateFontString(nil, "OVERLAY", textFont); local fsJump = optionsFrame:CreateFontString(nil, "OVERLAY", textFont);
local fsTime = optionsFrame:CreateFontString(nil, "OVERLAY", textFont); local fsTime = optionsFrame:CreateFontString(nil, "OVERLAY", textFont);
local fsTimeRunBegin = optionsFrame:CreateFontString(nil, "OVERLAY", textFont);
local fsScale = optionsFrame:CreateFontString(nil, "OVERLAY", textFont); local fsScale = optionsFrame:CreateFontString(nil, "OVERLAY", textFont);
fsKills:SetPoint("TOPLEFT", textMarginL, -(textMarginT + (0 * textMarginB))) fsKills:SetPoint("TOPLEFT", textMarginL, -(textMarginT + (0 * textMarginB)))
fsDeaths:SetPoint("TOPLEFT", textMarginL, -(textMarginT + (1 * textMarginB))) fsDeaths:SetPoint("TOPLEFT", textMarginL, -(textMarginT + (1 * textMarginB)))
fsTime:SetPoint("TOPLEFT", textMarginL, -(textMarginT + (2 * textMarginB))) fsTime:SetPoint("TOPLEFT", textMarginL, -(textMarginT + (2 * textMarginB)))
fsDist:SetPoint("TOPLEFT", textMarginL, -(textMarginT + (3 * textMarginB))) fsTimeRunBegin:SetPoint("TOPLEFT", textMarginL, -(textMarginT + (3 * textMarginB)))
fsQuests:SetPoint("TOPLEFT", textMarginL, -(textMarginT + (4 * textMarginB))) fsDist:SetPoint("TOPLEFT", textMarginL, -(textMarginT + (4 * textMarginB)))
fsQuests:SetPoint("TOPLEFT", textMarginL, -(textMarginT + (5 * textMarginB)))
--fsDmg:SetPoint("TOPLEFT", textMarginL, -(textMarginT + (4 * textMarginB))) --fsDmg:SetPoint("TOPLEFT", textMarginL, -(textMarginT + (4 * textMarginB)))
fsBoss:SetPoint("TOPLEFT", textMarginL, -(textMarginT + (5 * textMarginB))) fsBoss:SetPoint("TOPLEFT", textMarginL, -(textMarginT + (6 * textMarginB)))
fsCasts:SetPoint("TOPLEFT", textMarginL, -(textMarginT + (6 * textMarginB))) fsCasts:SetPoint("TOPLEFT", textMarginL, -(textMarginT + (7 * textMarginB)))
fsGold:SetPoint("TOPLEFT", textMarginL, -(textMarginT + (7 * textMarginB))) fsGold:SetPoint("TOPLEFT", textMarginL, -(textMarginT + (8 * textMarginB)))
fsCrits:SetPoint("TOPLEFT", textMarginL, -(textMarginT + (8 * textMarginB))) fsCrits:SetPoint("TOPLEFT", textMarginL, -(textMarginT + (9 * textMarginB)))
fsLogins:SetPoint("TOPLEFT", textMarginL, -(textMarginT + (9 * textMarginB))) fsLogins:SetPoint("TOPLEFT", textMarginL, -(textMarginT + (10 * textMarginB)))
fsItem:SetPoint("TOPLEFT", textMarginL, -(textMarginT + (10 * textMarginB))) fsItem:SetPoint("TOPLEFT", textMarginL, -(textMarginT + (11 * textMarginB)))
fsChat:SetPoint("TOPLEFT", textMarginL, -(textMarginT + (11 * textMarginB))) fsChat:SetPoint("TOPLEFT", textMarginL, -(textMarginT + (12 * textMarginB)))
fsJump:SetPoint("TOPLEFT", textMarginL, -(textMarginT + (12 * textMarginB))) fsJump:SetPoint("TOPLEFT", textMarginL, -(textMarginT + (13 * textMarginB)))
fsScale:SetPoint("TOPLEFT", textMarginL, -(textMarginT + (13 * textMarginB))) fsScale:SetPoint("TOPLEFT", textMarginL, -(textMarginT + (14 * textMarginB)))
buttonReset:SetPoint("TOPLEFT", textMarginL - 5, -(textMarginT + ((14 + 0.2) * textMarginB))); buttonReset:SetPoint("TOPLEFT", textMarginL - 5, -(textMarginT + ((15 + 0.2) * textMarginB)));
fsKills:SetText("Kills offset:"); fsKills:SetText("Kills offset:");
fsDeaths:SetText("Deaths offset:"); fsDeaths:SetText("Deaths offset:");
fsTime:SetText("Time played offset:"); fsTime:SetText("Time played offset:");
fsTimeRunBegin:SetText("Started run at:");
fsDist:SetText("Distance(m) offset:"); fsDist:SetText("Distance(m) offset:");
fsQuests:SetText("Quests offset:"); fsQuests:SetText("Quests offset:");
--fsDmg:SetText("Damage offset:"); --fsDmg:SetText("Damage offset:");
@ -257,6 +260,13 @@ ebTime:SetMaxLetters(maxCharacters);
ebTime:SetAutoFocus(false); ebTime:SetAutoFocus(false);
ebTime:SetNumeric(false); ebTime:SetNumeric(false);
local ebTimeRunStarted = CreateFrame("EditBox", "editboxOffsetTime", optionsFrame, "InputBoxTemplate");
ebTimeRunStarted:SetFrameStrata("DIALOG");
ebTimeRunStarted:SetSize(ebWidth,21);
ebTimeRunStarted:SetMaxLetters(maxCharacters);
ebTimeRunStarted:SetAutoFocus(false);
ebTimeRunStarted:SetNumeric(false);
local ebReset = CreateFrame("EditBox", "editboxConfirmReset", optionsFrame, "InputBoxTemplate"); local ebReset = CreateFrame("EditBox", "editboxConfirmReset", optionsFrame, "InputBoxTemplate");
ebReset:SetFrameStrata("DIALOG"); ebReset:SetFrameStrata("DIALOG");
ebReset:SetSize(ebWidth,21); ebReset:SetSize(ebWidth,21);
@ -281,22 +291,23 @@ fsTimeUNIT:SetText("seconds");
ebKills:SetPoint("TOPLEFT", editboxMarginL, -(textMarginT + (0 * textMarginB))); ebKills:SetPoint("TOPLEFT", editboxMarginL, -(textMarginT + (0 * textMarginB)));
ebDeaths:SetPoint("TOPLEFT", editboxMarginL, -(textMarginT + (1 * textMarginB))); ebDeaths:SetPoint("TOPLEFT", editboxMarginL, -(textMarginT + (1 * textMarginB)));
ebTime:SetPoint("TOPLEFT", editboxMarginL, -(textMarginT + (2 * textMarginB))); ebTime:SetPoint("TOPLEFT", editboxMarginL, -(textMarginT + (2 * textMarginB)));
ebDist:SetPoint("TOPLEFT", editboxMarginL, -(textMarginT + (3 * textMarginB))); ebTimeRunStarted:SetPoint("TOPLEFT", editboxMarginL, -(textMarginT + (3 * textMarginB)));
ebQuests:SetPoint("TOPLEFT", editboxMarginL, -(textMarginT + (4 * textMarginB))); ebDist:SetPoint("TOPLEFT", editboxMarginL, -(textMarginT + (4 * textMarginB)));
ebQuests:SetPoint("TOPLEFT", editboxMarginL, -(textMarginT + (5 * textMarginB)));
--ebDmg:SetPoint("TOPLEFT", editboxMarginL, -(textMarginT + (4 * textMarginB))); --ebDmg:SetPoint("TOPLEFT", editboxMarginL, -(textMarginT + (4 * textMarginB)));
ebBoss:SetPoint("TOPLEFT", editboxMarginL, -(textMarginT + (5 * textMarginB))); ebBoss:SetPoint("TOPLEFT", editboxMarginL, -(textMarginT + (6 * textMarginB)));
ebCast:SetPoint("TOPLEFT", editboxMarginL, -(textMarginT + (6 * textMarginB))); ebCast:SetPoint("TOPLEFT", editboxMarginL, -(textMarginT + (7 * textMarginB)));
ebGold:SetPoint("TOPLEFT", editboxMarginL, -(textMarginT + (7 * textMarginB))); ebGold:SetPoint("TOPLEFT", editboxMarginL, -(textMarginT + (8 * textMarginB)));
ebCrit:SetPoint("TOPLEFT", editboxMarginL, -(textMarginT + (8 * textMarginB))); ebCrit:SetPoint("TOPLEFT", editboxMarginL, -(textMarginT + (9 * textMarginB)));
ebLogin:SetPoint("TOPLEFT", editboxMarginL, -(textMarginT + (9 * textMarginB))); ebLogin:SetPoint("TOPLEFT", editboxMarginL, -(textMarginT + (10 * textMarginB)));
ebItem:SetPoint("TOPLEFT", editboxMarginL, -(textMarginT + (10 * textMarginB))); ebItem:SetPoint("TOPLEFT", editboxMarginL, -(textMarginT + (11 * textMarginB)));
ebChat:SetPoint("TOPLEFT", editboxMarginL, -(textMarginT + (11 * textMarginB))); ebChat:SetPoint("TOPLEFT", editboxMarginL, -(textMarginT + (12 * textMarginB)));
ebJumps:SetPoint("TOPLEFT", editboxMarginL, -(textMarginT + (12 * textMarginB))); ebJumps:SetPoint("TOPLEFT", editboxMarginL, -(textMarginT + (13 * textMarginB)));
ebScale:SetPoint("TOPLEFT", editboxMarginL, -(textMarginT + (13 * textMarginB))); ebScale:SetPoint("TOPLEFT", editboxMarginL, -(textMarginT + (14 * textMarginB)));
ebReset:SetPoint("TOPLEFT", editboxMarginL, -(textMarginT + ((14 + 0.2) * textMarginB))); ebReset:SetPoint("TOPLEFT", editboxMarginL, -(textMarginT + ((15 + 0.2) * textMarginB)));
fsTimeUNIT:SetPoint("TOPLEFT", editboxMarginL * 1.75, -(textMarginT + ((2 + 0.2) * textMarginB) - 2)); fsTimeUNIT:SetPoint("TOPLEFT", editboxMarginL * 1.75, -(textMarginT + ((2 + 0.2) * textMarginB) - 2));
fsResetInfo:SetPoint("TOPLEFT", editboxMarginL * 1.85, -(textMarginT + ((14 + 0.2) * textMarginB) + 5)); fsResetInfo:SetPoint("TOPLEFT", editboxMarginL * 1.85, -(textMarginT + ((15 + 0.2) * textMarginB) + 5));
local function CheckIfICanPrimeReset() local function CheckIfICanPrimeReset()
@ -351,6 +362,7 @@ local function LoadDefaultTexts(doAnways)
ebChat:SetText(Trackster.OffsetChat()); ebChat:SetText(Trackster.OffsetChat());
ebJumps:SetText(Trackster.OffsetJumps()); ebJumps:SetText(Trackster.OffsetJumps());
ebTime:SetText(Trackster.OffsetTime()); ebTime:SetText(Trackster.OffsetTime());
ebTimeRunStarted:SetText(Trackster_timestampRunBegin);
ebScale:SetText(Trackster_frameScale); ebScale:SetText(Trackster_frameScale);
areDefValsLoaded = true; areDefValsLoaded = true;
@ -389,6 +401,7 @@ local function UpdateOffsets()
ebChat:ClearFocus(); ebChat:ClearFocus();
ebJumps:ClearFocus(); ebJumps:ClearFocus();
ebTime:ClearFocus(); ebTime:ClearFocus();
ebTimeRunStarted:ClearFocus();
ebScale:ClearFocus(); ebScale:ClearFocus();
Trackster.SetFrameScale(ebScale:GetNumber()); Trackster.SetFrameScale(ebScale:GetNumber());
@ -406,6 +419,7 @@ local function UpdateOffsets()
Trackster.OffsetChat(ebChat:GetNumber()); Trackster.OffsetChat(ebChat:GetNumber());
Trackster.OffsetJumps(ebJumps:GetNumber()); Trackster.OffsetJumps(ebJumps:GetNumber());
Trackster.OffsetTime(ebTime:GetNumber()); Trackster.OffsetTime(ebTime:GetNumber());
Trackster_timestampRunBegin = ebTimeRunStarted:GetNumber();
LoadDefaultTexts(true); LoadDefaultTexts(true);
@ -424,6 +438,7 @@ ebGold:SetScript("OnEnterPressed", UpdateOffsets);
ebCrit:SetScript("OnEnterPressed", UpdateOffsets); ebCrit:SetScript("OnEnterPressed", UpdateOffsets);
ebLogin:SetScript("OnEnterPressed", UpdateOffsets); ebLogin:SetScript("OnEnterPressed", UpdateOffsets);
ebItem:SetScript("OnEnterPressed", UpdateOffsets); ebItem:SetScript("OnEnterPressed", UpdateOffsets);
ebTimeRunStarted:SetScript("OnEnterPressed", UpdateOffsets);
ebChat:SetScript("OnEnterPressed", UpdateOffsets); ebChat:SetScript("OnEnterPressed", UpdateOffsets);
ebJumps:SetScript("OnEnterPressed", UpdateOffsets); ebJumps:SetScript("OnEnterPressed", UpdateOffsets);
ebScale:SetScript("OnEnterPressed", UpdateOffsets); ebScale:SetScript("OnEnterPressed", UpdateOffsets);