Added new stat: hearthstones

This commit is contained in:
Leonetienne 2021-09-18 17:13:04 +02:00
parent 089f434ca6
commit 40b5ac6d56
3 changed files with 52 additions and 5 deletions

View File

@ -13,7 +13,7 @@
# 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, Trackster_timestampRunBegin
## 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, Trackster_HearthstonesOffset
# These are internal values. Just don't touch those.
## SavedVariablesPerCharacter: Trackster_showMainframe, Trackster_frameScale

View File

@ -94,6 +94,9 @@ Trackster_chatOffset = 0;
local fsItem = mainFrame:CreateFontString(nil, "OVERLAY", textFont);
Trackster_itemOffset = 0;
local fsHearthstones = mainFrame:CreateFontString(nil, "OVERLAY", textFont);
Trackster_HearthstonesOffset = 0;
local fsTime = mainFrame:CreateFontString(nil, "OVERLAY", textFont);
local fsAbsTime = mainFrame:CreateFontString(nil, "OVERLAY", textFont);
Trackster_timeOffset = 0;
@ -137,9 +140,10 @@ fsLogins:SetPoint("TOPLEFT", textMarginL, -(textMarginT + (12 * textMarginB)));
--fsItem:SetPoint("TOPLEFT", textMarginL, -(textMarginT + (12 * textMarginB)));
fsChat:SetPoint("TOPLEFT", textMarginL, -(textMarginT + (13 * textMarginB)));
fsJump:SetPoint("TOPLEFT", textMarginL, -(textMarginT + (14 * textMarginB)));
fsHearthstones:SetPoint("TOPLEFT", textMarginL, -(textMarginT + (15 * textMarginB)));
mainFrame:SetWidth(220 + textMarginL);
mainFrame:SetHeight((textMarginT * 2) + (textMarginB * 15));
mainFrame:SetHeight((textMarginT * 2) + (textMarginB * 21));
mainFrame:EnableMouse(true);
mainFrame:SetPoint("CENTER", 480, 0, UIParent);
mainFrame:SetMovable(true);
@ -175,6 +179,7 @@ mainFrame:RegisterEvent("CHAT_MSG_YELL");
mainFrame:RegisterEvent("CHAT_MSG_INSTANCE_CHAT");
mainFrame:RegisterEvent("CHAT_MSG_INSTANCE_CHAT_LEADER");
mainFrame:RegisterEvent("TIME_PLAYED_MSG");
mainFrame:RegisterEvent("LOADING_SCREEN_DISABLED");
mainFrame:RegisterEvent("CINEMATIC_START");
mainFrame:RegisterEvent("CINEMATIC_STOP");
@ -245,7 +250,7 @@ function UpdateDeaths()
local val = select(1, GetStatistic(60));
if (val == "--") then
fsDeaths:SetText("Death count: " .. (val));
fsDeaths:SetText("Death count: " .. (Trackster_deathOffset));
else
fsDeaths:SetText("Death count: " .. (val + Trackster_deathOffset));
end
@ -257,7 +262,7 @@ local function UpdateKills()
local val = select(1, GetStatistic(1197));
if (val == "--") then
fsKills:SetText("Kill count: " .. (val));
fsKills:SetText("Kill count: " .. (Trackster_killsOffset));
else
fsKills:SetText("Kill count: " .. (val + Trackster_killsOffset));
end
@ -269,12 +274,24 @@ local function UpdateQuests()
local val = select(1, GetStatistic(98));
if (val == "--") then
fsQuests:SetText("Quest count: " .. (val));
fsQuests:SetText("Quest count: " .. (Trackster_questsOffset));
else
fsQuests:SetText("Quest count: " .. (val + Trackster_questsOffset));
end
end
local function UpdateHearthstones()
Trackster_HearthstonesOffset = round(Trackster_HearthstonesOffset);
local val = select(1, GetStatistic(353));
if (val == "--") then
fsHearthstones:SetText("Hearthed: " .. (Trackster_HearthstonesOffset) .. " times");
else
fsHearthstones:SetText("Hearthed: " .. (val + Trackster_HearthstonesOffset) .. " times");
end
end
local function UpdateDmg()
--Trackster_dmgOffset = round(Trackster_dmgOffset);
--
@ -482,6 +499,13 @@ Trackster.OffsetTime = function(offset)
UpdateTime();
end
Trackster.OffsetHearthstones = function(offset)
if(offset == nil) then return Trackster_HearthstonesOffset; end;
Trackster_HearthstonesOffset = offset;
UpdateHearthstones();
end
local function UpdateAll()
UpdateDeaths();
UpdateKills();
@ -499,6 +523,7 @@ local function UpdateAll()
UpdateChat();
UpdateItem();
UpdateTime();
UpdateHearthstones();
end
mainFrame:SetScript("OnShow", UpdateAll);
@ -629,6 +654,9 @@ local function eventHandler(self, event, ...)
elseif (event == "TIME_PLAYED_MSG") then
local timePlayed = select(1, ...);
SyncTimePlayedWithBlizzardServer(timePlayed);
elseif (event == "LOADING_SCREEN_DISABLED") then
UpdateHearthstones();
elseif (event == "CHAT_MSG_SAY") then ProcessChatMsg(...);

View File

@ -99,7 +99,9 @@ local textFont = "GameFontWhite";
local textMarginB = 27.5;
local textMarginT = 25;
local textMarginL = 25;
local textMarginLC2 = textMarginL + 300;
local editboxMarginL = 150;
local editboxMarginLC2 = textMarginLC2 + 125; --> second column
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");
@ -119,6 +121,7 @@ local fsItem = optionsFrame:CreateFontString(nil, "OVERLAY", textFont);
local fsChat = optionsFrame:CreateFontString(nil, "OVERLAY", textFont);
local fsJump = optionsFrame:CreateFontString(nil, "OVERLAY", textFont);
local fsTime = optionsFrame:CreateFontString(nil, "OVERLAY", textFont);
local fsHearthstones = optionsFrame:CreateFontString(nil, "OVERLAY", textFont);
local fsTimeRunBegin = optionsFrame:CreateFontString(nil, "OVERLAY", textFont);
local fsScale = optionsFrame:CreateFontString(nil, "OVERLAY", textFont);
@ -139,6 +142,8 @@ fsChat:SetPoint("TOPLEFT", textMarginL, -(textMarginT + (12 * textMarginB)))
fsJump:SetPoint("TOPLEFT", textMarginL, -(textMarginT + (13 * textMarginB)))
fsScale:SetPoint("TOPLEFT", textMarginL, -(textMarginT + (14 * textMarginB)))
fsHearthstones:SetPoint("TOPLEFT", textMarginLC2, -(textMarginT + (0 * textMarginB)))
buttonReset:SetPoint("TOPLEFT", textMarginL - 5, -(textMarginT + ((15 + 0.2) * textMarginB)));
fsKills:SetText("Kills offset:");
@ -157,6 +162,7 @@ fsBoss:SetText("Bosskills offset:");
fsChat:SetText("Chat msg offset:");
fsItem:SetText("Items offset:");
fsScale:SetText("Frame scale:");
fsHearthstones:SetText("Hearthed offset:");
local maxCharacters = 12;
local ebWidth = 110;
@ -281,6 +287,13 @@ ebScale:SetMaxLetters(maxCharacters);
ebScale:SetAutoFocus(false);
ebScale:SetNumeric(false);
local ebHearthstones = CreateFrame("EditBox", "editboxConfirmScale", optionsFrame, "InputBoxTemplate");
ebHearthstones:SetFrameStrata("DIALOG");
ebHearthstones:SetSize(ebWidth,21);
ebHearthstones:SetMaxLetters(maxCharacters);
ebHearthstones:SetAutoFocus(false);
ebHearthstones:SetNumeric(false);
local fsResetInfo = optionsFrame:CreateFontString(nil, "OVERLAY", "GameFontWhite");
fsResetInfo:SetText("<- Enter \"" .. resetSafeword .. "\" to enable the reset function.");
@ -305,6 +318,8 @@ ebChat:SetPoint("TOPLEFT", editboxMarginL, -(textMarginT + (12 * textMarginB)));
ebJumps:SetPoint("TOPLEFT", editboxMarginL, -(textMarginT + (13 * textMarginB)));
ebScale:SetPoint("TOPLEFT", editboxMarginL, -(textMarginT + (14 * textMarginB)));
ebHearthstones:SetPoint("TOPLEFT", editboxMarginLC2, -(textMarginT + (0 * textMarginB)));
ebReset:SetPoint("TOPLEFT", editboxMarginL, -(textMarginT + ((15 + 0.2) * textMarginB)));
fsTimeUNIT:SetPoint("TOPLEFT", editboxMarginL * 1.75, -(textMarginT + ((2 + 0.2) * textMarginB) - 2));
fsResetInfo:SetPoint("TOPLEFT", editboxMarginL * 1.85, -(textMarginT + ((15 + 0.2) * textMarginB) + 5));
@ -362,6 +377,7 @@ local function LoadDefaultTexts(doAnways)
ebChat:SetText(Trackster.OffsetChat());
ebJumps:SetText(Trackster.OffsetJumps());
ebTime:SetText(Trackster.OffsetTime());
ebHearthstones:SetText(Trackster.OffsetHearthstones());
ebTimeRunStarted:SetText(Trackster_timestampRunBegin);
ebScale:SetText(Trackster_frameScale);
@ -401,6 +417,7 @@ local function UpdateOffsets()
ebChat:ClearFocus();
ebJumps:ClearFocus();
ebTime:ClearFocus();
ebHearthstones:ClearFocus();
ebTimeRunStarted:ClearFocus();
ebScale:ClearFocus();
@ -419,6 +436,7 @@ local function UpdateOffsets()
Trackster.OffsetChat(ebChat:GetNumber());
Trackster.OffsetJumps(ebJumps:GetNumber());
Trackster.OffsetTime(ebTime:GetNumber());
Trackster.OffsetHearthstones(ebHearthstones:GetNumber());
Trackster_timestampRunBegin = ebTimeRunStarted:GetNumber();
@ -441,4 +459,5 @@ ebItem:SetScript("OnEnterPressed", UpdateOffsets);
ebTimeRunStarted:SetScript("OnEnterPressed", UpdateOffsets);
ebChat:SetScript("OnEnterPressed", UpdateOffsets);
ebJumps:SetScript("OnEnterPressed", UpdateOffsets);
ebHearthstones:SetScript("OnEnterPressed", UpdateOffsets);
ebScale:SetScript("OnEnterPressed", UpdateOffsets);