Skip to content

Commit

Permalink
Updated GetChallengeCompletionInfo
Browse files Browse the repository at this point in the history
  • Loading branch information
Tercioo committed Nov 3, 2024
1 parent 69eda66 commit 061a313
Show file tree
Hide file tree
Showing 9 changed files with 71 additions and 53 deletions.
2 changes: 2 additions & 0 deletions Libs/DF/definitions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,7 @@
---@field CreateNewAddOn fun(self:table, addonName:string, globalSavedVariablesName:string, savedVarsTemplate:table) : table
---@field CreateBossScrollSelectorForInstance fun(self:table, instanceId:any, parent:uiobject, name:string?, options:df_bossscrollselector_options?, callback:function?, ...) : df_bossscrollselector
---@field CreateTimeLineFrame fun(self:table, parent:frame, name:string, timelineOptions:df_timeline_options, elapsedtimeOptions:df_elapsedtime_options) : df_timeline
---@field CreateTitleBar fun(self:table, parent:frame, titleText:string) : df_titlebar
---@field CreateElapsedTimeFrame fun(self:table, parent:frame, name:string?, options:df_elapsedtime_options?) : df_elapsedtime
---@field ConvertAnchorPointToInside fun(self:table, anchorPoint:anchorid) : anchorid
---@field ExpansionHasAugEvoker fun():boolean
Expand All @@ -277,6 +278,7 @@
---@field GetCurrentSpecId fun(self:table):number? return the specId of the current spec, retuns nil if the expansion the player is playing does not support specs
---@field GetClassSpecIds fun(self:table, engClass:string):number[]
---@field GetClassSpecIDs fun(self:table, engClass:string):number[]
---@field GetTextWidth fun(self:table, text:string, fontSize:number?) : number return the width of a text string
---@field IsValidSpecId fun(self:table, specId:number):boolean check if the passed specId is valid for the player class, also return false for tutorial specs
---@field GetDragonlightTalentString fun(self:table):string return the talent config string
---@field GetClassList fun(self:table):{ID:number, Name:string, FileString:string, Texture:string, TexCoord:number[]}[]
Expand Down
11 changes: 11 additions & 0 deletions Libs/DF/fw.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1289,6 +1289,17 @@ end
local dummyFontString = UIParent:CreateFontString(nil, "background", "GameFontNormal")
local defaultFontFile = dummyFontString:GetFont()

function DF:GetTextWidth(text, size)
if (size) then
DF:SetFontSize(dummyFontString, size)
else
DF:SetFontSize(dummyFontString, 12)
end

dummyFontString:SetText(text)
return dummyFontString:GetStringWidth()
end

---get the UIObject of type 'FontString' and set the default game font into it
---@param self table
---@param fontString fontstring
Expand Down
3 changes: 3 additions & 0 deletions Libs/DF/mixins.lua
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ local doublePoint = {

---@class df_setpoint : table
---@field SetPoint fun(self: table, anchorName1: anchor_name, anchorObject: table?, anchorName2: string?, xOffset: number?, yOffset: number?)
---@field SetPoints fun(self: table, anchorName1: anchor_name, anchorObject: table?, anchorName2: string?, xOffset: number?, yOffset: number?)

detailsFramework.SetPointMixin = {
SetPoint = function(object, anchorName1, anchorObject, anchorName2, xOffset, yOffset)
Expand Down Expand Up @@ -273,6 +274,8 @@ detailsFramework.SetPointMixin = {
end,
}

detailsFramework.SetPointMixin.SetPoints = detailsFramework.SetPointMixin.SetPoint

---mixin for options
---@class df_optionsmixin
---@field options table
Expand Down
3 changes: 2 additions & 1 deletion Libs/DF/picture.lua
Original file line number Diff line number Diff line change
Expand Up @@ -243,8 +243,9 @@ detailsFramework:Mixin(ImageMetaFunctions, detailsFramework.ScriptHookMixin)
------------------------------------------------------------------------------------------------------------
--object constructor

---@class df_image : texture, df_widgets, df_setpoint
---@class df_image : df_setpoint, texture, df_widgets
---@field SetGradient fun(gradientType: "vertical"|"horizontal", fromColor: table, toColor: table)
---@field SetPoint fun(self: table, anchorName1: anchor_name, anchorObject: table?, anchorName2: string?, xOffset: number?, yOffset: number?)
---@field image texture

---@class df_gradienttable : table
Expand Down
29 changes: 15 additions & 14 deletions core/parser.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6002,20 +6002,21 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
--wait until the keystone is updated and send it to the party
saveGroupMembersKeystoneAndRatingLevel()

---@type number mapID
---@type number level
---@type number time
---@type boolean onTime
---@type number keystoneUpgradeLevels
---@type boolean practiceRun
---@type number oldDungeonScore
---@type number newDungeonScore
---@type boolean isMapRecord
---@type boolean isAffixRecord
---@type number primaryAffix
---@type boolean isEligibleForScore
---@type table upgradeMembers
local mapID, level, time, onTime, keystoneUpgradeLevels, practiceRun, oldDungeonScore, newDungeonScore, isAffixRecord, isMapRecord, primaryAffix, isEligibleForScore, upgradeMembers = C_ChallengeMode.GetCompletionInfo()
local completionInfo = C_ChallengeMode.GetChallengeCompletionInfo()

local primaryAffix = 0
local mapID = C_ChallengeMode.GetActiveChallengeMapID()
local upgradeMembers = completionInfo.members
local level = completionInfo.level
local time = completionInfo.time
local onTime = completionInfo.onTime
local keystoneUpgradeLevels = completionInfo.keystoneUpgradeLevels
local practiceRun = completionInfo.practiceRun
local isAffixRecord = completionInfo.isAffixRecord
local isMapRecord = completionInfo.isMapRecord
local isEligibleForScore = completionInfo.isEligibleForScore
local oldDungeonScore = completionInfo.oldOverallDungeonScore
local newDungeonScore = completionInfo.newOverallDungeonScore

Details222.MythicPlus.MapID = mapID
Details222.MythicPlus.Level = level --level of the key just finished
Expand Down
21 changes: 0 additions & 21 deletions frames/window_mythicplus/window_end_of_run.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1528,24 +1528,3 @@ end
Details222.MythicPlus.IsMythicPlus = function()
return C_ChallengeMode and C_ChallengeMode.GetActiveKeystoneInfo() and true or false
end


--[=[
Details222.MythicPlus.MapID = mapID
Details222.MythicPlus.Level = level --level of the key just finished
Details222.MythicPlus.OnTime = onTime
Details222.MythicPlus.KeystoneUpgradeLevels = keystoneUpgradeLevels
Details222.MythicPlus.PracticeRun = practiceRun
Details222.MythicPlus.OldDungeonScore = oldDungeonScore
Details222.MythicPlus.NewDungeonScore = newDungeonScore
Details222.MythicPlus.IsAffixRecord = isAffixRecord
Details222.MythicPlus.IsMapRecord = isMapRecord
Details222.MythicPlus.PrimaryAffix = primaryAffix
Details222.MythicPlus.IsEligibleForScore = isEligibleForScore
Details222.MythicPlus.UpgradeMembers = upgradeMembers
Details222.MythicPlus.DungeonName = dungeonName
Details222.MythicPlus.DungeonID = id
Details222.MythicPlus.TimeLimit = timeLimit
Details222.MythicPlus.Texture = texture
Details222.MythicPlus.BackgroundTexture = backgroundTexture
--]=]
16 changes: 15 additions & 1 deletion functions/mythicdungeon/mythicdungeon.lua
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,21 @@ end)

---@param combatObject combat
function DetailsMythicPlusFrame.SaveMythicPlusStats(combatObject)
local mapChallengeModeID, mythicLevel, time, onTime, keystoneUpgradeLevels, practiceRun, oldOverallDungeonScore, newOverallDungeonScore, IsMapRecord, IsAffixRecord, PrimaryAffix, isEligibleForScore, members = C_ChallengeMode.GetChallengeCompletionInfo()
local completionInfo = C_ChallengeMode.GetChallengeCompletionInfo()
local mapChallengeModeID = C_ChallengeMode.GetActiveChallengeMapID()
local PrimaryAffix = 0
local upgradeMembers = completionInfo.members
local mythicLevel = completionInfo.level
local time = completionInfo.time
local onTime = completionInfo.onTime
local keystoneUpgradeLevels = completionInfo.keystoneUpgradeLevels
local practiceRun = completionInfo.practiceRun
local isAffixRecord = completionInfo.isAffixRecord
local isMapRecord = completionInfo.isMapRecord
local isEligibleForScore = completionInfo.isEligibleForScore
local oldDungeonScore = completionInfo.oldOverallDungeonScore
local newDungeonScore = completionInfo.newOverallDungeonScore

if (mapChallengeModeID) then
local statName = "mythicdungeoncompletedDF2"

Expand Down
3 changes: 2 additions & 1 deletion functions/storage.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1030,7 +1030,8 @@ function Details.Database.StoreEncounter(combat)

if (diffName == "mythicdungeon") then
local mythicLevel = C_ChallengeMode.GetActiveKeystoneInfo()
local mapChallengeModeID = C_ChallengeMode.GetChallengeCompletionInfo()
local mapChallengeModeID = C_ChallengeMode.GetActiveChallengeMapID()

if (not mythicLevel and not mapChallengeModeID) then
return
end
Expand Down
36 changes: 21 additions & 15 deletions luaserver.lua
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,25 @@ CLASS_ICON_TCOORDS = {}
---@field tilesHorizontally boolean?
---@field tilesVertically boolean?

---@class challengecompletioninfo : table
---@field mapChallengeModeID number
---@field level number
---@field time number
---@field onTime boolean
---@field keystoneUpgradeLevels number
---@field practiceRun boolean
---@field oldOverallDungeonScore number?
---@field newOverallDungeonScore number?
---@field isMapRecord boolean
---@field isAffixRecord boolean
---@field isEligibleForScore boolean
---@field members table

---@class challengemodecompletionmemberinfo : table
---@field memberGUID guid
---@field name string


---@alias spellid number integer each spell in the game has a unique spell id, this id can be used to identify a spell.
---@alias unitname string name of a unit
---@alias unitguid string unique id of a unit (GUID)
Expand Down Expand Up @@ -1427,21 +1446,8 @@ function C_ChallengeMode.GetActiveChallengeMapID() return 0 end
---@return boolean wasActive Whether the keystone was active.
function C_ChallengeMode.GetActiveKeystoneInfo() return 0, {}, true end

---return the completion information for the current challenge mode.
---@return number mapChallengeModeID The map id of the challenge mode.
---@return number level The keystone level of the challenge mode.
---@return number time The time taken to complete the challenge mode.
---@return boolean onTime Whether the challenge mode was completed within the time limit.
---@return number keystoneUpgradeLevels The number of keystone upgrade levels.
---@return boolean practiceRun Whether the challenge mode was a practice run.
---@return number oldOverallDungeonScore The old overall dungeon score.
---@return number newOverallDungeonScore The new overall dungeon score.
---@return boolean isMapRecord Whether the completion is a map record.
---@return boolean isAffixRecord Whether the completion is an affix record.
---@return number primaryAffix The primary affix id.
---@return boolean isEligibleForScore Whether the completion is eligible for a score.
---@return ChallengeModeCompletionMemberInfo[] members The members of the group.
function C_ChallengeMode.GetChallengeCompletionInfo() return 0, 0, 0, true, 0, true, 0, 0, true, true, 0, true, {} end
---@return challengecompletioninfo
function C_ChallengeMode.GetChallengeCompletionInfo() return {} end

---return the death count for the current challenge mode.
---@return number numDeaths The number of deaths.
Expand Down

0 comments on commit 061a313

Please sign in to comment.