Backupiseasy / ThreatPlates

Nameplate addon for World of Warcraft
https://wow.curseforge.com/projects/tidy-plates-threat-plates
37 stars 23 forks source link

Replacing `GetSpellTexture` with `C_Spell.GetSpellTexture` #547

Closed kyano closed 3 months ago

kyano commented 3 months ago

Like GetSpellInfo, the global API GetSpellTexture must also change to C_Spell.GetSpellTexture.

--- TidyPlatesInternal/TidyPlatesStatusbar.lua.orig     2024-08-16 02:14:27.192476400 +0900
+++ TidyPlatesInternal/TidyPlatesStatusbar.lua  2024-08-16 02:14:52.422972500 +0900
@@ -9,7 +9,7 @@ local ThreatPlates = Addon.ThreatPlates
 local ceil, string_format = ceil, string.format

 -- WoW APIs
-local GetSpellTexture = GetSpellTexture
+local GetSpellTexture = C_Spell.GetSpellTexture
 local GetNamePlateForUnit = C_NamePlate.GetNamePlateForUnit
 local InCombatLockdown = InCombatLockdown
 local UnitName, UnitIsUnit, UnitClass = UnitName, UnitIsUnit, UnitClass
--- Widgets/BossModsWidget.lua.orig     2024-08-16 02:15:25.288662000 +0900
+++ Widgets/BossModsWidget.lua  2024-08-16 02:15:38.943542700 +0900
@@ -14,7 +14,7 @@ local Widget = Addon.Widgets:NewWidget("
 local floor = math.floor

 -- WoW APIs
-local GetSpellTexture = GetSpellTexture
+local GetSpellTexture = C_Spell.GetSpellTexture
 local GetTime = GetTime
 local tremove = tremove

I found this by getting a Lua error when I enabled Castbar -> Configuration mode -> Toggle on target to adjust nameplate sizes.

from BugSack ``` 410x ...eatPlates/TidyPlatesInternal/TidyPlatesStatusbar.lua:436: attempt to call upvalue 'GetSpellTexture' (a nil value) [string "@TidyPlates_ThreatPlates/TidyPlatesInternal/TidyPlatesStatusbar.lua"]:436: in function <...eatPlates/TidyPlatesInternal/TidyPlatesStatusbar.lua:430> Locals: self = StatusBar { Border = Frame { } Value = 0.217000 Background = Texture { } InterruptBorder = Frame { } IsChanneling = false IsCasting = true MaxValue = 2 InterruptOverlay = Texture { } InterruptShield = Texture { } Spark = Texture { } FlashTime = 0 casttime = FontString { } CastTarget = FontString { } } elapsed = 0.017000 db = { customtext =
{ } highlight =
{ } eliteicon =
{ } spellicon =
{ } unique =
{ } elitehealthborder =
{ } spelltext =
{ } level =
{ } normal =
{ } customart =
{ } healthbar =
{ } castbar =
{ } threatborder =
{ } skullicon =
{ } totem =
{ } dps =
{ } tank =
{ } name =
{ } castborder =
{ } raidicon =
{ } frame =
{ } healthborder =
{ } castnostop =
{ } } (*temporary) = Texture { } (*temporary) = nil (*temporary) = 116 (*temporary) = "attempt to call upvalue 'GetSpellTexture' (a nil value)" plate = NamePlate3 { driverFrame = NamePlateDriverFrame { } template = "NamePlateUnitFrameTemplate" namePlateUnitToken = "nameplate2" UnitFrame = Button { } UpdateMe = false TPFrame = ThreatPlatesFrameNamePlate3 { } TimeSinceLastUpdate = 0.017000 } Addon =
{ IS_WRATH_CLASSIC = false Theme =
{ } UseUniqueWidget = true TotemCreatureType = "토템" AurasFilterMode =
{ } IS_CATA_CLASSIC = false ANCHOR_POINT_SETPOINT =
{ } CVars =
{ } THREAT_VALUE_TYPE =
{ } Font =
{ } WOW_USES_CLASSIC_NAMEPLATES = false IGNORED_STYLES =
{ } PlatesByUnit =
{ } Animations =
{ } ThreatPlates =
{ } ANCHOR_POINT_TEXT =
{ } IS_TBC_CLASSIC = false MODE_FOR_STYLE =
{ } TotemInformation =
{ } ON_UPDATE_PER_FRAME = 0.017833 CUSTOM_PLATES_GLOW_FRAMES =
{ } Debug =
{ } PlatesByGUID =
{ } EventHandler =
{ } LibUTF8 =
{ } Logging =
{ } PLATE_FADE_IN_TIME = 0.500000 ANCHOR_POINT =
{ } CASTBAR_INTERRUPT_HOLD_TIME = 1 PlayerName = "의빈언니" TOTEMS =
{ } ActiveWildcardTriggers = false SCRIPT_FUNCTIONS =
{ } IsInPvEInstance = false ActiveScriptTrigger = false ActiveCastTriggers = false IS_MAINLINE = true ON_UPDATE_INTERVAL = 0.250000 LibAceConfigRegistry =
{ } LibAceConfigDialog =
{ } IS_CLASSIC = false db =
{ } WIDGET_EVENTS =
{ } IGNORED_STYLES_WITH_NAMEMODE =
{ } IS_CLASSIC_SOD = false Widgets =
{ } CUSTOM_GLOW_WRAPPER_FUNCTIONS =
{ } CUSTOM_GLOW_FUNCTIONS =
{ } LEGACY_CUSTOM_NAMEPLATES =
{ } TARGET_TEXTURES =
{ } Cache =
{ } LibCustomGlow =
{ } DEFAULT_FONT = "기본 글꼴" UIScale = 1 ADDON_DIRECTORY = "Interface\AddOns\TidyPlates_ThreatPlates\" DEBUG = true BackdropTemplate = "BackdropTemplate" LibSharedMedia =
{ } PlatesCreated =
{ } Data =
{ } IsInPvPInstance = false DEFAULT_SMALL_FONT = "기본 글꼴" PlayerClass = "MAGE" ActiveAuraTriggers = false GLOW_TYPES =
{ } PlatesVisible =
{ } } visual =
{ absorbbar = Texture { } customtext = FontString { } healthbar = StatusBar { } healthborder = Frame { } Highlight = Frame { } threatborder = Frame { } skullicon = Texture { } eliteicon = Texture { } spellicon = Texture { } level = FontString { } name = FontString { } spelltext = FontString { } textframe = Frame { } eliteborder = Frame { } castbar = StatusBar { } raidicon = Texture { } } GetSpellTexture = nil ```
Backupiseasy commented 3 months ago

You are right. Hopefully, these were the last API changes missing. At least I checked that there are not any other GetSpell... functions used wrongly. Thanks for reporting this. It is fixed in the newly released version 12.0.7.