From 0fd4d47c0e1226c6b870ae1ae4938e117c974ad4 Mon Sep 17 00:00:00 2001 From: Alar of Runetotem Date: Mon, 11 Nov 2024 22:02:14 +0100 Subject: [PATCH] Fix: code upgraded to last api version --- .gitignore | 6 +- PetCare.lua | 57 +++++++-------- PetCare.toc | 2 +- RelNotes.json | 194 ++++++++++++++++++++++++++++++++++++++++++++++++++ RelNotes.lua | 27 ++++--- pkgmeta.yaml | 7 +- 6 files changed, 250 insertions(+), 43 deletions(-) create mode 100644 RelNotes.json diff --git a/.gitignore b/.gitignore index ddf2766..07e3966 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,6 @@ - -/.settings/ + +/.settings/ .idea/ .vscode/ +RelNotes.bak.* +*.bak diff --git a/PetCare.lua b/PetCare.lua index 17dc02a..0734d2f 100644 --- a/PetCare.lua +++ b/PetCare.lua @@ -68,7 +68,7 @@ local function HasBuff(unit,id,filter) filter = filter or "CANCELABLE" local index,res=1,true while res do - res=select(10,C_UnitAuras.GetBuffDataByIndex(unit,index,filter)) + res=select(10,C_UnitAuras.GetBuffDataByIndex(unit,index)) if res and res == id then return index end index=index+1 end @@ -116,22 +116,22 @@ function addon:Apply() limit=self:GetVar("LIMIT") alertmessage=format(L["Pet health under "] .. "%d%%",limit) if (self:GetBoolean("HIDEOUTOFCOMBAT")) then - self.petcare.frame:SetAttribute("unit","none") + self.petcare.frame:SetAttribute("unit","none") else - self.petcare.frame:SetAttribute("unit","pet") - end + self.petcare.frame:SetAttribute("unit","pet") + end end function addon:Init() - MendPet=GetSpellInfo(MendPetId) - Misdirection=GetSpellInfo(MisdirectionId) - RevivePet=GetSpellInfo(RevivePetId) or '' - DismissPet=GetSpellInfo(DismissPetId) or '' - CallPet1=GetSpellInfo(CallPet1Id) or '' - CallPet2=GetSpellInfo(CallPet2Id) or '' - CallPet3=GetSpellInfo(CallPet3Id) or '' - CallPet4=GetSpellInfo(CallPet4Id) or '' - CallPet5=GetSpellInfo(CallPet5Id) or '' - Growl=GetSpellInfo(GrowlId) or '' + MendPet=C_Spell.GetSpellName(MendPetId) or '' + Misdirection=C_Spell.GetSpellName(MisdirectionId) or '' + RevivePet=C_Spell.GetSpellName(RevivePetId) or '' + DismissPet=C_Spell.GetSpellName(DismissPetId) or '' + CallPet1=C_Spell.GetSpellName(CallPet1Id) or '' + CallPet2=C_Spell.GetSpellName(CallPet2Id) or '' + CallPet3=C_Spell.GetSpellName(CallPet3Id) or '' + CallPet4=C_Spell.GetSpellName(CallPet4Id) or '' + CallPet5=C_Spell.GetSpellName(CallPet5Id) or '' + Growl=C_Spell.GetSpellName(GrowlId) or '' self:GenerateFrame() end @@ -171,6 +171,7 @@ function addon:GenerateFrame() status:SetHeight(h) status:SetWidth(l) status:SetMinMaxValues(0,100) +---@diagnostic disable-next-line: undefined-field status.TextString=_G.PetCareStatus.Text status.TextString:SetAllPoints() status.TextString:SetJustifyH("LEFT") @@ -209,7 +210,7 @@ function addon:GenerateFrame() iconrem=CreateFrame("Frame") iconrem.icon=iconrem:CreateTexture(nil,"ARTWORK") iconrem.icon:SetAllPoints() - iconrem.icon:SetTexture(GetSpellTexture(MendPetId)) + iconrem.icon:SetTexture(C_Spell.GetSpellTexture(MendPetId)) iconrem:Hide() iconrem:SetAlpha(0.4) iconrem:SetPoint("CENTER") @@ -219,12 +220,12 @@ end function addon:PLAYER_REGEN_ENABLED() self.petbar:SetBackdropColor(GetThreatStatusColor(0)) self.mebar:SetBackdropColor(GetThreatStatusColor(0)) - self.petcare.frame:SetAttribute("unit","none") + self.petcare.frame:SetAttribute("unit","none") self.petcare:Hide() end - + function addon:PLAYER_REGEN_DISABLED() - self.petcare.frame:SetAttribute("unit","pet") + self.petcare.frame:SetAttribute("unit","pet") self.petcare:Show() end function addon:PetAlert() @@ -232,7 +233,7 @@ function addon:PetAlert() if sound then local s=tonumber(sound) if s then - PlaySound(sound) + PlaySound(s) else if type(sound)=="string" then if sound ~= "none" then PlaySoundFile(sound) end @@ -368,7 +369,7 @@ end function addon:ZoneCheck() local inInstance, instanceType = IsInInstance(); if (inInstance and (instanceType == "party" or instanceType == "raid")) then - if (select(2,GetSpellAutocast(GrowlId))) then + if (select(2,C_Spell.GetSpellAutoCast(GrowlId))) then self:GrowlAlert() end end @@ -384,7 +385,7 @@ function addon:UNIT_SPELLCAST_SUCCEEDED(event, caster,spelldata,spellid) if (status) then status:Show() local bar=LibStub("LibCandyBar-3.0"):New("Interface\\TargetingFrame\\UI-StatusBar",100,15) - local name,_,icon=GetSpellInfo(MendPet) + local name,_,icon=C_Spell.GetSpellName(MendPet) bar:SetIcon(icon) bar:SetLabel(name) bar:SetTimeVisibility(false) @@ -404,7 +405,7 @@ function addon:UNIT_SPELLCAST_SUCCEEDED(event, caster,spelldata,spellid) end elseif (spellid==MisdirectionId) then local bar=LibStub("LibCandyBar-3.0"):New("Interface\\TargetingFrame\\UI-StatusBar",100,15) - local name,_,icon=GetSpellInfo(MisdirectionId) + local name,_,icon=C_Spell.GetSpellName(MisdirectionId) local status=self.petbar bar:SetIcon(icon) bar:SetLabel(name:sub(1,6)) @@ -417,7 +418,7 @@ function addon:UNIT_SPELLCAST_SUCCEEDED(event, caster,spelldata,spellid) bar:Start() elseif (spellid==MultiShotId) then local bar=LibStub("LibCandyBar-3.0"):New("Interface\\TargetingFrame\\UI-StatusBar",100,15) - local name,_,icon=GetSpellInfo(BeastCleaveId) + local name,_,icon=C_Spell.GetSpellName(BeastCleaveId) local status=self.petbar bar:SetIcon(icon) --bar:SetLabel(name:sub(1,6)) @@ -435,10 +436,10 @@ function addon:UNIT_SPELLCAST_SUCCEEDED(event, caster,spelldata,spellid) end end function AAA() - local index,res=1,true - while res do - print(UnitBuff("pet",index,"CANCELABLE")) - res=UnitBuff("pet",index,"CANCELABLE") + local index,res + repeat + print(C_UnitAuras.GetBuffDataByIndex("pet",index,"CANCELABLE")) + res=C_UnitAuras.GetBuffDataByIndex("pet",index,"CANCELABLE") index=index+1 - end + until res == nil end diff --git a/PetCare.toc b/PetCare.toc index ef2b634..af87e37 100644 --- a/PetCare.toc +++ b/PetCare.toc @@ -1,4 +1,4 @@ -## Interface: 110000, 110002 +## Interface: 110005 ## Title: PetCare ## Notes: Handles a hunter's pet needs in battle ## Notes-itIT: Gestisce in battaglia il famiglio di un cacciatore diff --git a/RelNotes.json b/RelNotes.json new file mode 100644 index 0000000..f29ae85 --- /dev/null +++ b/RelNotes.json @@ -0,0 +1,194 @@ +{ + "NOTES": { + "k061000": { + "major": "6", + "minor": "10", + "patch": "0", + "description": [ + { + "tag": "Feature", + "info": "Version 99.99.99" + } + ] + }, + "k060901": { + "major": "6", + "minor": "9", + "patch": "1", + "description": [ + { + "tag": "Fix", + "info": "Mend Pet\/ Revive pet selection restored" + } + ] + }, + "k060801": { + "major": "6", + "minor": "8", + "patch": "1", + "description": [ + { + "tag": "Fix", + "info": "Message" + }, + { + "tag": "Feature", + "info": "Widget can now be hidden when out of combat" + } + ] + }, + "k060800": { + "major": "6", + "minor": "8", + "patch": "0", + "description": [ + { + "tag": "Toc", + "info": "10.2.6" + } + ] + }, + "k060701": { + "major": "6", + "minor": "7", + "patch": "1", + "description": [ + { + "tag": "Fix", + "info": "Now correctly chooses between Revive pet and Mend pet" + } + ] + }, + "k060201": { + "major": "6", + "minor": "2", + "patch": "1", + "description": [ + { + "tag": "Toc", + "info": "8.3.0" + } + ] + }, + "k060200": { + "major": "6", + "minor": "2", + "patch": "0", + "description": [ + { + "tag": "Feature", + "info": "now tracks Beast Cleave" + } + ] + }, + "k060103": { + "major": "6", + "minor": "1", + "patch": "3", + "description": [ + { + "tag": "Feature", + "info": "8.2 update" + } + ] + }, + "k060100": { + "major": "6", + "minor": "1", + "patch": "0", + "description": [ + { + "tag": "Feature", + "info": "Dropped old AlarShared framework, now uses LibInit" + }, + { + "tag": "Fix", + "info": "Non longer interfere with bagnon" + } + ] + }, + "k060012": { + "major": "6", + "minor": "0", + "patch": "12", + "description": [ + { + "tag": "Fix", + "info": "Removed lua error spam" + } + ] + }, + "k060007": { + "major": "6", + "minor": "0", + "patch": "7", + "description": [ + { + "tag": "Fix", + "info": "Typo in release notes (ouch)" + } + ] + }, + "k060006": { + "major": "6", + "minor": "0", + "patch": "6", + "description": [ + { + "tag": "Fix", + "info": "Error when playing sounds" + } + ] + }, + "k010301": { + "major": "1", + "minor": "3", + "patch": "1", + "description": [ + { + "tag": "Toc", + "info": "bumped to 7.1.0" + } + ] + }, + "k010001": { + "major": "1", + "minor": "0", + "patch": "1", + "description": [ + { + "tag": "Feature", + "info": "Alerts Can be disabled in PVP" + } + ] + }, + "k010000": { + "major": "1", + "minor": "0", + "patch": "0", + "description": [ + { + "tag": "Feature", + "info": "First public release" + } + ] + } + }, + "PARAGRAPHS": [ + "Description", + "Release Notes" + ], + "TITLE": { + "addon": "Pet Care", + "title": "RELNOTES" + }, + "PRE": [ + "PetCare manages your fighting pet needs:", + "keeps track of mend pet in a specific petframe", + "allow to cast mend pet,revive pet and misdirection directly via petframe", + "shows your current aggro compared to yout pet's one", + "can play a sound and or show an alert when your pet falls under a customizable level of health", + "can play a sound if you enter a non PVP instance with Growl active", + "alerts can be disabled in PVP" + ] +} \ No newline at end of file diff --git a/RelNotes.lua b/RelNotes.lua index a2ebeab..3902178 100644 --- a/RelNotes.lua +++ b/RelNotes.lua @@ -1,9 +1,11 @@ +-- AUTOGENERATED 2024-11-09T07:56:10+00:00 +---@diagnostic disable: undefined-field, inject-field local me=... ---@class AceAddon local hlp=LibStub("AceAddon-3.0"):GetAddon(me) function hlp:loadHelp() -self:HF_Title("Pet Care",'RELNOTES') -self:HF_Paragraph("Description") +self:HF_Title([[Pet Care]],[[RELNOTES]]) +self:HF_Paragraph('Description') self:HF_Pre([[ PetCare manages your fighting pet needs: keeps track of mend pet in a specific petframe @@ -13,7 +15,10 @@ can play a sound and or show an alert when your pet falls under a customizable l can play a sound if you enter a non PVP instance with Growl active alerts can be disabled in PVP ]]) -self:HF_Paragraph("Release Notes") +self:HF_Paragraph('Release Notes') +self:RelNotes(6,11,0,[[ +Toc: 11.0.5 +]]) self:RelNotes(6,10,4,[[ Fix: was not loading Fix: UnitBuff error @@ -26,16 +31,17 @@ Toc: 11.0.0, 11.0.2 ]]) self:RelNotes(6,9,1,[[ Toc: 10.2.7 +Fix: Mend Pet/ Revive pet selection restored ]]) self:RelNotes(6,8,1,[[ -Fix: Message: Interface/AddOns/PetCare/PetCare.lua:240: Usage: local r, g, b = GetThreatStatusColor(gameErrorIndex) -Feature: Widget can now be hidden when out of combat: check options +Fix: Message +Feature: Widget can now be hidden when out of combat ]]) self:RelNotes(6,8,0,[[ Toc: 10.2.6 ]]) self:RelNotes(6,7,1,[[ - Fix: Now correctly chooses between Revive pet and Mend pet +Fix: Now correctly chooses between Revive pet and Mend pet ]]) self:RelNotes(6,2,1,[[ Toc: 8.3.0 @@ -63,8 +69,9 @@ self:RelNotes(1,3,1,[[ Toc: bumped to 7.1.0 ]]) self:RelNotes(1,0,1,[[ -Alerts Can be disabled in PVP -]])self:RelNotes(1,0,0,[[ -First public release +Feature: Alerts Can be disabled in PVP +]]) +self:RelNotes(1,0,0,[[ +Feature: First public release ]]) -end \ No newline at end of file +end diff --git a/pkgmeta.yaml b/pkgmeta.yaml index 7264887..1fad76f 100644 --- a/pkgmeta.yaml +++ b/pkgmeta.yaml @@ -9,8 +9,8 @@ externals: url: svn://svn.wowace.com/wow/libcandybar-3-0/mainline/trunk manual-changelog: - filename: CHANGELOG.txt - markup-type: creole + filename: CHANGELOG.txt + markup-type: creole ignore: - luac.out @@ -25,3 +25,6 @@ ignore: - libs/AlarShared-3.0 - .project - .settings +- RelNotes.bak +- RelNotes.bak.* +- RelNotes.json