Skip to content

Commit 07a5845

Browse files
authored
Merge pull request #65 from Puresyn/development
Development
2 parents 52d23ca + 8d73560 commit 07a5845

18 files changed

+450
-491
lines changed
0 Bytes
Binary file not shown.

Core/CharacterData.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ function CharacterData:GetCharacterDataByGUID(playerGUID)
8787
return nil
8888
end
8989

90-
local encodedCharacterData = KeyMaster_C_DB[playerGUID].data
90+
local encodedCharacterData = KeyMaster_C_DB[playerGUID].data --saved variable
9191
if not encodedCharacterData then return nil end
9292

9393
local decoded = LibDeflate:DecodeForWoWAddonChannel(encodedCharacterData)

Core/CharacterInfo.lua

+24-73
Original file line numberDiff line numberDiff line change
@@ -79,55 +79,6 @@ local function fetchCharacterMythicPlusData(mapId, retryCount)
7979
end
8080
end
8181

82-
function CharacterInfo:GetMplusScoreForMap(mapid, weeklyAffix)
83-
if (weeklyAffix ~= KeyMasterLocals.TYRANNICAL and weeklyAffix ~= KeyMasterLocals.FORTIFIED) then
84-
KeyMaster:_ErrorMsg("GetMplusScoreForMap", "CharacterInfo", "Incorrect weeklyAffix value provided.")
85-
return nil
86-
end
87-
88-
local emptyData = {
89-
name = weeklyAffix, --WeeklyAffix Name (e.g.; Tyran/Fort)
90-
score = 0, -- io gained
91-
level = 0, -- keystone level
92-
durationSec = 0, -- how long took to complete map
93-
overTime = false -- was completion overtime
94-
}
95-
96-
local mapScore, bestOverallScore = C_MythicPlus.GetSeasonBestAffixScoreInfoForMap(mapid)
97-
-- this is true when a character has not ran a key for this map on either weekly affix.
98-
if (mapScore == nil) then
99-
return emptyData
100-
end
101-
-- No data means no keys ran on either weekly affix
102-
if mapScore[1] == nil and mapScore[2] == nil then
103-
KeyMaster:_ErrorMsg("GetMplusScoreForMap", "CharacterInfo.lua", "Failed to fetch score data for mapid "..mapid)
104-
return emptyData
105-
end
106-
107-
-- This is setup this way because blizzard returns the data in a table with the first index being the weekly affix
108-
-- So on a tyrannical week mapScore[1] is for Tyrannical information and mapScore[2] is for Fortified information
109-
-- on a fortified week mapScore[1] is for Fortified information and mapScore[2] is for Tyrannical information
110-
if mapScore[1].name == weeklyAffix then
111-
if mapScore[1].name == KeyMasterLocals.FORTIFIED then
112-
mapScore[1].name = "Fortified"
113-
else
114-
mapScore[1].name = "Tyrannical"
115-
end
116-
return mapScore[1]
117-
else
118-
if mapScore[2] == nil then
119-
return emptyData
120-
else
121-
if mapScore[2].name == KeyMasterLocals.FORTIFIED then
122-
mapScore[2].name = "Fortified"
123-
else
124-
mapScore[2].name = "Tyrannical"
125-
end
126-
return mapScore[2]
127-
end
128-
end
129-
end
130-
13182
function CharacterInfo:GetPlayerSpecialization(unitId)
13283
if (unitId == "player") then
13384
local specId = GetSpecialization()
@@ -177,32 +128,32 @@ function CharacterInfo:GetMyCharacterInfo()
177128
for mapid, v in pairs(seasonMaps) do
178129
local keyRun = {}
179130

180-
-- Overall Dungeon Score
181-
keyRun["bestOverall"] = CharacterInfo:GetDungeonOverallScore(mapid)
182-
183-
-- Tyrannical Key Score
184-
local tyrannicalScoreInfo = CharacterInfo:GetMplusScoreForMap(mapid, KeyMasterLocals.TYRANNICAL)
185-
local dungeonDetails = {
186-
["Rating"] = DungeonTools:CalculateRating(mapid, tyrannicalScoreInfo.level, tyrannicalScoreInfo.durationSec),
187-
["Level"] = tyrannicalScoreInfo.level,
188-
["DurationSec"] = tyrannicalScoreInfo.durationSec,
189-
["IsOverTime"] = tyrannicalScoreInfo.overTime
131+
-- empty data set
132+
local emptyData = {
133+
Rating = 0, -- rating
134+
Level = 0, -- keystone level
135+
DurationSec = 0, -- how long took to complete map
136+
overTime = false -- was completion overtime
190137
}
191-
keyRun["Tyrannical"] = dungeonDetails
192-
193-
-- Fortified Key Score
194-
local fortifiedScoreInfo = CharacterInfo:GetMplusScoreForMap(mapid, KeyMasterLocals.FORTIFIED)
195-
local dungeonDetails = {
196-
["Rating"] = DungeonTools:CalculateRating(mapid, fortifiedScoreInfo.level, fortifiedScoreInfo.durationSec),
197-
["Level"] = fortifiedScoreInfo.level,
198-
["DurationSec"] = fortifiedScoreInfo.durationSec,
199-
["IsOverTime"] = fortifiedScoreInfo.overTime
200-
}
201-
keyRun["Fortified"] = dungeonDetails
202-
203-
myCharacterInfo.DungeonRuns[mapid] = keyRun
138+
139+
local mapScore, bestOverallScore = C_MythicPlus.GetSeasonBestAffixScoreInfoForMap(mapid)
140+
if (mapScore == nil or mapScore[1] == nil) then
141+
keyRun["bestOverall"] = 0
142+
keyRun["DungeonData"] = emptyData
143+
else
144+
local dungeonDetails = {
145+
["Rating"] = DungeonTools:CalculateRating(mapid, mapScore[1].level, mapScore[1].durationSec),
146+
["Level"] = mapScore[1].level,
147+
["DurationSec"] = mapScore[1].durationSec,
148+
["overTime"] = mapScore[1].overTime
149+
}
150+
keyRun["bestOverall"] = bestOverallScore
151+
keyRun["DungeonData"] = dungeonDetails
152+
end
153+
154+
myCharacterInfo.DungeonRuns[mapid] = keyRun
204155
end
205156

206-
KeyMaster:_DebugMsg("GetMyCharacterInfo", "CharacterInfo", "Character data fetched.")
157+
KeyMaster:_DebugMsg("GetCharInfo", "CharacterInfo", "Character data fetched.")
207158
return myCharacterInfo
208159
end

Core/Coms.lua

+3
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,9 @@ local function processKM2Data(payload, sender)
228228
if (major1 == 0 and minor1 == 0 and patch1 < 94) then
229229
KeyMaster:_DebugMsg("processKM2Data", "Coms", sender.." has incompatible ("..buildVersion..") data. Aborting mapping.")
230230
return
231+
elseif (major1 == 1 and minor1 < 3) then -- TWW S1 Changed mythic score data significantly
232+
KeyMaster:_DebugMsg("processKM2Data", "Coms", sender.." has incompatible ("..buildVersion..") data. Aborting mapping.")
233+
return
231234
end
232235
checkVersion(data)
233236
end

Core/Localization/Localization.lua

+4
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,10 @@ local CHALLENGERSPERIL_ID = 152 -- not sure if this is needed?
7878
KeyMasterLocals.TYRANNICAL, _, _ = C_ChallengeMode.GetAffixInfo(TYRANNICAL_ID)
7979
KeyMasterLocals.FORTIFIED, _, _ = C_ChallengeMode.GetAffixInfo(FORTIFIED_ID)
8080
KeyMasterLocals.CHALLENGERSPERIL, _, _ = C_ChallengeMode.GetAffixInfo(CHALLENGERSPERIL_ID) -- not sure if this is needed?
81+
KeyMasterLocals.ASCENDANT = C_ChallengeMode.GetAffixInfo(KM_XBASCENDANT_ID)
82+
KeyMasterLocals.VOIDBOUND = C_ChallengeMode.GetAffixInfo(KM_XBVOIDBOUND_ID)
83+
KeyMasterLocals.OBLIVION = C_ChallengeMode.GetAffixInfo(KM_XBOBLIVION_ID)
84+
KeyMasterLocals.DEVOUR = C_ChallengeMode.GetAffixInfo(KM_XBDEVOUR_ID)
8185
KeyMasterLocals.BUILDRELEASE = "release" -- must remain in ENGLISH - DO NOT TRANSLATE
8286
KeyMasterLocals.BUILDBETA = "beta" -- must remain in ENGLISH - DO NOT TRANSLATE
8387
KeyMasterLocals.ADDONNAME = "Key Master" -- do not translate

Core/UI/HeaderFrame.lua

+10-59
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@ function HeaderFrame:CreateHeaderRegion(parentFrame)
3232
topBar.bgTexture:SetTexture("Interface/Addons/KeyMaster/Assets/Images/"..Theme.style)
3333
topBar.bgTexture:SetTexCoord(2/1024, 856/1024, 841/1024, 945/1024)
3434

35-
topBar.displayBG = topBar:CreateTexture(nil, "BACKGROUND", nil, 0)
35+
--[[ topBar.displayBG = topBar:CreateTexture(nil, "BACKGROUND", nil, 0)
3636
topBar.displayBG:SetPoint("BOTTOMRIGHT", topBar, "BOTTOMRIGHT", 0, -2)
3737
topBar.displayBG:SetSize(320, 77)
3838
topBar.displayBG:SetTexture("Interface/Addons/KeyMaster/Assets/Images/"..Theme.style)
39-
topBar.displayBG:SetTexCoord(662/1024, 1, 946/1024, 1)
39+
topBar.displayBG:SetTexCoord(662/1024, 1, 946/1024, 1) ]]
4040

4141
return headerRegion
4242
end
@@ -107,64 +107,15 @@ end
107107

108108
function HeaderFrame:CreatePlayerInfoBox(parentFrame)
109109
local headerPlayerInfoBox = CreateFrame("Frame", "KeyMaster_PlayerInfobox", parentFrame)
110-
headerPlayerInfoBox:SetSize(198, 80)
110+
headerPlayerInfoBox:SetSize(4, 80)
111111
headerPlayerInfoBox:SetPoint("BOTTOMRIGHT", parentFrame, "BOTTOMRIGHT", 0, 6)
112112

113-
return headerPlayerInfoBox
114-
115-
end
113+
--------------------------------
114+
-- todo: remove box - hide for now
115+
headerPlayerInfoBox:Hide()
116+
--------------------------------
116117

117-
--------------------------------
118-
-- Weekly Affix
119-
--------------------------------
120-
function HeaderFrame:CreateAffixFrames(parentFrame)
121-
if (parentFrame == nil) then
122-
KeyMaster:_ErrorMsg("createAffixFrames", "HeaderFrame", "Parameter Null - No parent frame passed to this function.")
123-
return
124-
end
125-
local seasonalAffixes = KeyMaster.DungeonTools:GetAffixes()
126-
if (seasonalAffixes == nil) then
127-
KeyMaster:_DebugMsg("createAffixFrames", "HeaderFrame", "No active weekly affix was found.")
128-
return
129-
end
130-
for i=1, #seasonalAffixes, 1 do
131-
local affixName = seasonalAffixes[i].name
132-
local temp_frame = CreateFrame("Frame", "KeyMaster_AffixFrame"..tostring(i), parentFrame)
133-
temp_frame:SetSize(50, 50)
134-
if (i == 1) then
135-
temp_frame:SetPoint("BOTTOMLEFT", parentFrame, "BOTTOMLEFT", 0, 0)
136-
else
137-
local a = i - 1
138-
temp_frame:SetPoint("TOPLEFT", "KeyMaster_AffixFrame"..tostring(a), "TOPRIGHT", 20, 0)
139-
end
140-
141-
-- Affix Icon
142-
local tex = temp_frame:CreateTexture()
143-
tex:SetAllPoints(temp_frame)
144-
tex:SetTexture(seasonalAffixes[i].filedataid)
145-
146-
-- Affix Name
147-
local affixNameFrame = CreateFrame("Frame", nil, temp_frame)
148-
affixNameFrame:SetSize(50, 15)
149-
affixNameFrame:SetPoint("BOTTOMLEFT", temp_frame, "BOTTOMLEFT")
150-
local myText = affixNameFrame:CreateFontString(nil, "OVERLAY", "KeyMasterFontSmall")
151-
local path, _, flags = myText:GetFont()
152-
myText:SetFont(path, 9, flags)
153-
myText:SetPoint("LEFT", -12, -9)
154-
myText:SetTextColor(1,1,1)
155-
myText:SetJustifyH("LEFT")
156-
myText:SetText(affixName)
157-
myText:SetRotation(math.pi/2)
158-
159-
-- Affix name background
160-
local affixBGFrame = CreateFrame("Frame", nil, temp_frame)
161-
affixBGFrame:SetFrameLevel(affixBGFrame:GetParent():GetFrameLevel()-1)
162-
affixBGFrame:SetSize(26, temp_frame:GetHeight())
163-
affixBGFrame:SetPoint("BOTTOMRIGHT", temp_frame, "BOTTOMLEFT", 10, 0)
164-
affixBGFrame.texture = affixBGFrame:CreateTexture(nil, "BACKGROUND",nil)
165-
affixBGFrame.texture:SetAllPoints(affixBGFrame)
166-
affixBGFrame.texture:SetColorTexture(0, 0, 0, 0.7)
167-
end
118+
return headerPlayerInfoBox
168119

169120
end
170121

@@ -174,7 +125,7 @@ end
174125
function HeaderFrame:CreateHeaderKeyFrame(parentFrame, anchorFrame)
175126
local key_frame = CreateFrame("Frame", "KeyMaster_MythicKeyHeader", parentFrame)
176127
key_frame:SetSize(anchorFrame:GetHeight(), anchorFrame:GetHeight())
177-
key_frame:SetPoint("RIGHT", anchorFrame, "LEFT", -20, 0)
128+
key_frame:SetPoint("RIGHT", anchorFrame, "LEFT", -20, 20)
178129

179130
key_frame.keyLevelText = key_frame:CreateFontString(nil, "OVERLAY", "KeyMasterFontBig")
180131
local path, _, flags = key_frame.keyLevelText:GetFont()
@@ -277,7 +228,7 @@ function HeaderFrame:Initialize(parentFrame)
277228
local addonVersionNotify = _G["KM_AddonOutdated"] or HeaderFrame:AddonVersionNotify(parentFrame)
278229
local headerContent = _G["KeyMaster_HeaderFrame"] or HeaderFrame:CreateHeaderContent(headerRegion)
279230
local headerInfoBox = _G["KeyMaster_PlayerInfobox"] or HeaderFrame:CreatePlayerInfoBox(headerContent)
280-
local headerAffixFrame = HeaderFrame:CreateAffixFrames(headerInfoBox)
231+
--local headerAffixFrame = HeaderFrame:CreateAffixFrames(headerInfoBox)
281232
local headerKey = _G["KeyMaster_MythicKeyHeader"] or HeaderFrame:CreateHeaderKeyFrame(headerContent, headerInfoBox)
282233

283234
-- System Message

Core/UI/HeaderFrameMapping.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,5 @@ end
2727

2828
function HeaderFrameMapping:NewVersionAlert()
2929
local versionAlertFrame = _G["KM_AddonOutdated"]
30-
versionAlertFrame:Show()
30+
if(versionAlertFrame) then versionAlertFrame:Show() end
3131
end

Core/UI/PartyFrame.lua

+17-5
Original file line numberDiff line numberDiff line change
@@ -398,14 +398,19 @@ function PartyFrame:CreatePartyDataFrame(parentFrame)
398398

399399
-- Tyrannical Scores
400400
local tempText1 = mapDataFrame:CreateFontString("KM_MapLevelT"..playerNumber..mapid, "OVERLAY", "KeyMasterFontNormal")
401-
tempText1:SetPoint("CENTER", mapDataFrame, "TOP", 0, -10)
401+
tempText1:SetPoint("CENTER", mapDataFrame, "TOP", 0, -14)
402402
prevAnchor = tempText1
403403

404404
-- Fortified Scores
405405
local tempText4 = mapDataFrame:CreateFontString("KM_MapLevelF"..playerNumber..mapid, "OVERLAY", "KeyMasterFontNormal")
406406
tempText4:SetPoint("CENTER", prevAnchor, "BOTTOM", 0, -8)
407407
prevAnchor = tempText4
408408

409+
--------------------------------
410+
-- todo: Remove this data - Hide Fortified Data for now
411+
tempText4:Hide()
412+
--------------------------------
413+
409414
-- Member Point Gain From Key
410415
local tempText5 = mapDataFrame:CreateFontString("KM_PointGain"..playerNumber..mapid, "OVERLAY", "KeyMasterFontSmall")
411416
tempText5:SetPoint("CENTER", prevAnchor, "BOTTOM", 0, -10)
@@ -416,7 +421,7 @@ function PartyFrame:CreatePartyDataFrame(parentFrame)
416421

417422
-- Map Total Score
418423
local tempText6 = mapDataFrame:CreateFontString("KM_MapTotalScore"..playerNumber..mapid, "OVERLAY", "KeyMasterFontBig")
419-
tempText6:SetPoint("CENTER", mapDataFrame, "BOTTOM", 0, 10)
424+
tempText6:SetPoint("CENTER", mapDataFrame, "BOTTOM", 0, 14)
420425
local MapScoreTotalColor = {}
421426
MapScoreTotalColor.r, MapScoreTotalColor.g, MapScoreTotalColor.b, _ = Theme:GetThemeColor("color_HEIRLOOM")
422427
tempText6:SetTextColor(MapScoreTotalColor.r, MapScoreTotalColor.g, MapScoreTotalColor.b, 1)
@@ -445,12 +450,18 @@ function PartyFrame:CreatePartyDataFrame(parentFrame)
445450

446451
local PartyTitleText = mapLegendFrame:CreateFontString("KM_TyranTitle"..playerNumber, "OVERLAY", "KeyMasterFontNormal")
447452
PartyTitleText:SetPoint("RIGHT", _G["KM_MapLevelT"..playerNumber..prevMapId], "CENTER", xOffset, 0)
448-
PartyTitleText:SetText(KeyMasterLocals.TYRANNICAL..":")
453+
--PartyTitleText:SetText(KeyMasterLocals.TYRANNICAL..":")
454+
PartyTitleText:SetText(KeyMasterLocals.PLAYERFRAME["KeyLevel"].name..":")
449455

450456
local FortTitleText = mapLegendFrame:CreateFontString("KM_FortTitle"..playerNumber, "OVERLAY", "KeyMasterFontNormal")
451457
FortTitleText:SetPoint("RIGHT", _G["KM_MapLevelF"..playerNumber..prevMapId], "CENTER", xOffset, 0)
452458
FortTitleText:SetText(KeyMasterLocals.FORTIFIED..":")
453459

460+
--------------------------------
461+
-- todo: Remove data - hide for now
462+
FortTitleText:Hide()
463+
--------------------------------
464+
454465
local PointGainTitleText = mapLegendFrame:CreateFontString("KM_PiontGainTitle"..playerNumber, "OVERLAY", "KeyMasterFontSmall")
455466
PointGainTitleText:SetPoint("RIGHT", _G["KM_PointGain"..playerNumber..prevMapId], "CENTER", xOffset, 0)
456467
local PointGainTitleColor = {}
@@ -460,7 +471,8 @@ function PartyFrame:CreatePartyDataFrame(parentFrame)
460471

461472
local OverallRatingTitleText = mapLegendFrame:CreateFontString(nil, "OVERLAY", "KeyMasterFontSmall")
462473
OverallRatingTitleText:SetPoint("RIGHT", _G["KM_MapTotalScore"..playerNumber..prevMapId], "CENTER", xOffset, 0)
463-
OverallRatingTitleText:SetText(KeyMasterLocals.PARTYFRAME["OverallRating"].name..":")
474+
--OverallRatingTitleText:SetText(KeyMasterLocals.PARTYFRAME["OverallRating"].name..":")
475+
OverallRatingTitleText:SetText(KeyMasterLocals.TOOLTIPS["MythicRating"].name..":")
464476

465477
end
466478

@@ -546,7 +558,7 @@ function PartyFrame:CreatePartyScoreTallyFooter()
546558

547559
local mapTallyFrame = CreateFrame("Frame", "KM_MapTally"..mapid, parentFrame)
548560
mapTallyFrame:ClearAllPoints()
549-
561+
550562
-- Dynamicly set map data frame anchors
551563
if (firstItem) then
552564
mapTallyFrame:SetPoint("TOPRIGHT", partyTallyFrame, "TOPRIGHT", 0, 0)

0 commit comments

Comments
 (0)