diff --git a/.luacheckrc b/.luacheckrc index 296aa14..9430296 100644 --- a/.luacheckrc +++ b/.luacheckrc @@ -60,6 +60,7 @@ stds.wow = { "Settings", "SOUNDKIT", "StaticPopup_Show", + "strsplit", "time", "TooltipDataProcessor", "UIParent", diff --git a/.vscode/settings.json b/.vscode/settings.json index 96d8547..3f99844 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -55,6 +55,7 @@ "math", "Settings", "SOUNDKIT", + "strsplit", "IsInRaid", "IsInGroup", "UnitXPMax", diff --git a/Command.lua b/Command.lua index 5ff4f38..da29f5a 100644 --- a/Command.lua +++ b/Command.lua @@ -89,7 +89,7 @@ end) C:Register({"target", "t", "tar"}, function() if not UnitExists("target") or UnitIsPlayer("target") then return end - local id = KTT:GUIDToID(UnitGUID("target")) + local id = KTT.GUIDToID(UnitGUID("target")) KT:PrintKills(id) end) diff --git a/KillTrack.lua b/KillTrack.lua index 0ea4a21..88a0ded 100644 --- a/KillTrack.lua +++ b/KillTrack.lua @@ -62,6 +62,9 @@ local ET local KTT = KT.Tools +-- Upvalue as it's used in CLEU +local GUIDToID = KTT.GUIDToID + local FirstDamage = {} -- Tracks first damage to a mob registered by CLEU local LastDamage = {} -- Tracks whoever did the most recent damage to a mob local DamageValid = {} -- Determines if mob is tapped by player/group @@ -222,7 +225,7 @@ function KT.Events.COMBAT_LOG_EVENT_UNFILTERED(self) if event ~= "UNIT_DIED" then return end -- Perform solo/group checks - local d_id = KTT:GUIDToID(d_guid) + local d_id = GUIDToID(d_guid) local firstDamage = FirstDamage[d_guid] local lastDamage = LastDamage[d_guid] local firstByPlayer = firstDamage == self.PlayerGUID or firstDamage == UnitGUID("pet") @@ -282,7 +285,7 @@ local function tooltip_enhancer(self) local _, unit = self:GetUnit() if not unit then return end if UnitIsPlayer(unit) then return end - local id = KTT:GUIDToID(UnitGUID(unit)) + local id = KTT.GUIDToID(UnitGUID(unit)) if not id then return end if UnitCanAttack("player", unit) then local mob, charMob = KT:InitMob(id, UnitName(unit)) diff --git a/Options.lua b/Options.lua index df1f2a8..7f6fee4 100644 --- a/Options.lua +++ b/Options.lua @@ -140,7 +140,7 @@ function Opt:Show() local showTarget = button("Target", "Show information about the currently selected target", function() if not UnitExists("target") or UnitIsPlayer("target") then return end - local id = KTT:GUIDToID(UnitGUID("target")) + local id = KTT.GUIDToID(UnitGUID("target")) KT:PrintKills(id) end) showTarget:SetWidth(150) diff --git a/Tools.lua b/Tools.lua index e09b9f0..59f4f98 100644 --- a/Tools.lua +++ b/Tools.lua @@ -115,8 +115,10 @@ end -- OTHER TOOLS -- ----------------- -function KTT:GUIDToID(guid) +local ssplit = strsplit +function KTT.GUIDToID(guid) if not guid then return nil end - local id = guid:match("^%w+%-0%-%d+%-%d+%-%d+%-(%d+)%-[A-Z%d]+$") + -- local id = guid:match("^%w+%-0%-%d+%-%d+%-%d+%-(%d+)%-[A-Z%d]+$") + local _, _, _, _, _, id = ssplit("-", guid) return tonumber(id) end