Skip to content

Commit

Permalink
Fix GetSpellInfo calls (most change to GetSpellName)
Browse files Browse the repository at this point in the history
  • Loading branch information
b-morgan committed Aug 14, 2024
1 parent 5084878 commit 3bd5b90
Show file tree
Hide file tree
Showing 9 changed files with 51 additions and 58 deletions.
2 changes: 1 addition & 1 deletion Plugins/AckisRecipeList.lua
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ function plugin.GetExtraText(skill, recipe)
local recipeData = AckisRecipeList:GetRecipeData(skill.id)
if recipeData == nil and not ARLProfessionInitialized[recipe.tradeID] then
ARLProfessionInitialized[recipe.tradeID] = true
local profession = GetSpellInfo(recipe.tradeID)
local profession = C_Spell.GetSpellName(recipe.tradeID)
AckisRecipeList:AddRecipeData(profession)
recipeData = AckisRecipeList:GetRecipeData(skill.id)
end
Expand Down
12 changes: 6 additions & 6 deletions SkillLevelData.lua
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ local function getRacialBonus()
local player = Skillet.currentPlayer
local trade = Skillet.currentTrade
local race = Skillet.db.realm.race[player]
--DA.DEBUG(0,"getRacialBonus: trade = "..tostring(trade).." ("..tostring(GetSpellInfo(trade)).."), race= "..tostring(race))
--DA.DEBUG(0,"getRacialBonus: trade = "..tostring(trade).." ("..tostring(C_Spell.GetSpellName(trade)).."), race= "..tostring(race))
if racialList[trade] then
for r, bonus in pairs(racialList[trade]) do
--DA.DEBUG(1,"getRacialBonus: r = "..tostring(r)..", bonus= "..tostring(bonus))
Expand Down Expand Up @@ -145,7 +145,7 @@ function Skillet:GetTradeSkillLevels(itemID, spellID)
levels = skillLevels[itemID][spellID]
else
for spell, strng in pairs(levels) do
name = GetSpellInfo(spell)
name = C_Spell.GetSpellName(spell)
DA.DEBUG(1,"GetTradeSkillLevels: name= "..tostring(name))
if name == spellID then
levels = strng
Expand Down Expand Up @@ -7093,7 +7093,7 @@ Skillet.db.global.SkillLevels = {

}
Skillet.db.global.SkillLineAbility_era = {
--@version-classic@
--[====[@version-classic@
[2149] = '1/40/55/70',
[2153] = '30/45/60/75',
[2152] = '1/30/45/60',
Expand Down Expand Up @@ -8467,10 +8467,10 @@ Skillet.db.global.SkillLineAbility_era = {
[448085] = '1/250/255/260',
[448624] = '1/120/125/130',
[451706] = '1/250/255/260',
--@end-version-classic@
--@end-version-classic@]====]
}
Skillet.db.global.SkillLineAbility_cata = {
--@version-cata@
--[====[@version-cata@
[2149] = '1/40/55/70',
[2153] = '30/45/60/75',
[2152] = '1/30/45/60',
Expand Down Expand Up @@ -12767,7 +12767,7 @@ Skillet.db.global.SkillLineAbility_cata = {
[405005] = '1/390/397/405',
[413897] = '1/390/397/405',
[414814] = '1/390/397/405',
--@end-version-cata@
--@end-version-cata@]====]
}
Skillet.db.global.SkillLineAbility_retail = {
--@version-retail@
Expand Down
22 changes: 0 additions & 22 deletions Skillet.lua
Original file line number Diff line number Diff line change
Expand Up @@ -307,9 +307,6 @@ function Skillet:OnInitialize()
if not self.db.global.AdjustNumMade then
self.db.global.AdjustNumMade = {}
end
if not self.db.global.spellIDtoName then
self.db.global.spellIDtoName = {}
end
if not self.db.global.MissingSkillLevels then
self.db.global.MissingSkillLevels = {}
end
Expand Down Expand Up @@ -531,7 +528,6 @@ function Skillet:FlushRecipeData()
Skillet.db.global.itemRecipeUsedIn = {}
Skillet.db.global.itemRecipeSource = {}
Skillet.db.global.Categories = {}
Skillet.db.global.spellIDtoName = {}
if Skillet.data and Skillet.data.recipeInfo then
Skillet.data.recipeInfo = {}
Skillet:InitializeSkillLevels()
Expand Down Expand Up @@ -783,7 +779,6 @@ function Skillet:OnEnable()
self:RegisterEvent("SKILL_LINES_CHANGED") -- replacement for CHAT_MSG_SKILL?
self:RegisterEvent("LEARNED_SPELL_IN_TAB") -- arg1 = professionID
self:RegisterEvent("NEW_RECIPE_LEARNED") -- arg1 = recipeID
-- self:RegisterEvent("SPELL_NAME_UPDATE") -- arg1 = spellID, arg2 = spellName
-- self:RegisterEvent("ADDON_ACTION_BLOCKED")

--
Expand Down Expand Up @@ -977,23 +972,6 @@ function Skillet:NEW_RECIPE_LEARNED(event, recipeID)
end
end

function Skillet:SPELL_NAME_UPDATE(event, spellID, spellName)
DA.TRACE("SPELL_NAME_UPDATE")
DA.TRACE("spellID= "..tostring(spellID)..", spellName= "..tostring(spellName))
Skillet.db.global.spellIDtoName[spellID] = spellName
end

function Skillet:GetSpellName(spellID)
DA.DEBUG(0,"GetSpellName")
DA.DEBUG(0,"spellID= "..tostring(spellID)..", spellName= "..tostring(spellName))
if Skillet.db.global.spellIDtoName[spellID] then
return Skillet.db.global.spellIDtoName[spellID]
else
GetSpellInfo(spellID) -- Name will be returned asynchronously
return "Unknown"
end
end

function Skillet:TRADE_SKILL_SHOW()
DA.TRACE("TRADE_SKILL_SHOW")
Skillet.dataSourceChanged = false
Expand Down
15 changes: 7 additions & 8 deletions SkilletData.lua
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,9 @@ function Skillet:GetAutoTargetMacro(addSpellID, toy, pet, petGUID)
else
local itemID = Skillet:GetAutoTargetItem(addSpellID)
if itemID then
return "/cast "..(GetSpellInfo(addSpellID) or "").."\n/use "..(C_Item.GetItemInfo(itemID) or "")
return "/cast "..(C_Spell.GetSpellName(addSpellID) or "").."\n/use "..(C_Item.GetItemInfo(itemID) or "")
else
return "/cast "..(GetSpellInfo(addSpellID) or "")
return "/cast "..(C_Spell.GetSpellName(addSpellID) or "")
end
end
end
Expand Down Expand Up @@ -318,7 +318,7 @@ end

function Skillet:GetRecipeName(id)
if not id then return "unknown" end
local name = GetSpellInfo(id)
local name = C_Spell.GetSpellName(id)
--DA.DEBUG(0,"name "..(id or "nil").." "..(name or "nil"))
if name then
return name, id
Expand Down Expand Up @@ -358,7 +358,7 @@ function Skillet:GetRecipe(id)
end
Skillet.data.recipeList[id] = {}
Skillet.data.recipeList[id].spellID = tonumber(id)
Skillet.data.recipeList[id].name = GetSpellInfo(tonumber(id))
Skillet.data.recipeList[id].name = C_Spell.GetSpellName(tonumber(id))
Skillet.data.recipeList[id].tradeID = tonumber(tradeID)
Skillet.data.recipeList[id].itemID = tonumber(itemID)
if Skillet.db.global.AdjustNumMade and Skillet.db.global.AdjustNumMade[id] then
Expand Down Expand Up @@ -464,7 +464,7 @@ function Skillet:CollectTradeSkillData()
self.tradeSkillNamesByID = {}
for i=1,#TradeSkillList,1 do
local id = TradeSkillList[i]
local name, _, icon = GetSpellInfo(id)
local name = C_Spell.GetSpellName(id)
self.tradeSkillIDsByName[name] = id
self.tradeSkillNamesByID[id] = name
end
Expand Down Expand Up @@ -509,8 +509,8 @@ function Skillet:ScanPlayerTradeSkills(player)
for i=1,#TradeSkillList,1 do
local id = TradeSkillList[i]
--DA.DEBUG(3,"ScanPlayerTradeSkills: id= "..tostring(id))
local name = GetSpellInfo(id) -- always returns data
local name = GetSpellInfo(name) -- only returns data if you have this spell in your spellbook
local name = C_Spell.GetSpellName(id)
local name = C_Spell.GetSpellName(name) -- only returns data if you have this spell in your spellbook
--DA.DEBUG(3,"ScanPlayerTradeSkills: name= "..tostring(name))
if name then
if id == 2656 then id = 2575 end -- Ye old Smelting vs. Mining issue
Expand All @@ -521,7 +521,6 @@ function Skillet:ScanPlayerTradeSkills(player)
skillRanksData[id].maxRank = 0
skillRanksData[id].name = name
end
skillRanksData[id].spellOffset = self.spellOffset[name]
end
end
end
Expand Down
9 changes: 9 additions & 0 deletions SkilletNewsData.lua
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,15 @@ local isCata = WOW_PROJECT_ID == WOW_PROJECT_CATACLYSM_CLASSIC

Skillet.NewsName = "Skillet News"
Skillet.NewsData = {
{ version = "5.32",
data = {
{ name = "Fixes",
data = {
{ header = "All", body = "Fix GetSpellInfo calls" },
},
},
},
},
{ version = "5.31",
data = {
{ name = "Changes",
Expand Down
6 changes: 3 additions & 3 deletions SkilletQueue.lua
Original file line number Diff line number Diff line change
Expand Up @@ -957,7 +957,7 @@ end
--
function Skillet:ContinueCast(spellID)
if self.enabledState then
name = GetSpellInfo(spellID)
name = C_Spell.GetSpellName(spellID)
DA.DEBUG(0,"ContinueCast("..tostring(spellID).."), "..tostring(name))
if spellID == self.processingSpellID then
DA.DEBUG(1,"ContinueCast: processingCount= "..tostring(Skillet.processingCount))
Expand Down Expand Up @@ -999,7 +999,7 @@ end
--
function Skillet:StopCast(spellID)
if self.enabledState then
name = GetSpellInfo(spellID)
name = C_Spell.GetSpellName(spellID)
DA.DEBUG(0,"StopCast("..tostring(spellID).."), "..tostring(name))
self.queuecasting = false
self.processingSpell = nil
Expand All @@ -1018,7 +1018,7 @@ end
--
function Skillet:IgnoreCast(spellID)
if self.enabledState then
name = GetSpellInfo(spellID)
name = C_Spell.GetSpellName(spellID)
DA.DEBUG(4,"IgnoreCast("..tostring(spellID).."), "..tostring(name))
end
end
Expand Down
4 changes: 2 additions & 2 deletions TradeskillInfo.lua
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ end

-- Returns the name of the current trade skill
function Skillet:GetTradeName(tradeID)
local tradeName = GetSpellInfo(tonumber(tradeID))
local tradeName = C_Spell.GetSpellName(tonumber(tradeID))
return tradeName
end

Expand Down Expand Up @@ -124,7 +124,7 @@ end
-- Gets the trade skill line, and knows how to do the right
-- thing depending on whether or not this is a craft.
function Skillet:GetTradeSkillLine()
local tradeName = GetSpellInfo(self.currentTrade)
local tradeName = C_Spell.GetSpellName(self.currentTrade)
local ranks = self:GetSkillRanks(self.currentPlayer, self.currentTrade)
local rank, maxRank
if ranks then
Expand Down
35 changes: 21 additions & 14 deletions UI/MainFrame.lua
Original file line number Diff line number Diff line change
Expand Up @@ -550,9 +550,9 @@ function Skillet:TradeButton_OnEnter(button)
GameTooltip:ClearLines()
local bName = button:GetName()
local _, player, tradeID = string.split("-", bName)
local sInfo = GetSpellInfo(tradeID)
--DA.DEBUG(3,"TradeButton_OnEnter("..tostring(bName).."), player= "..tostring(player)..", tradeID= "..tostring(tradeID)..", sInfo= "..tostring(sInfo))
GameTooltip:AddLine(sInfo)
local sName = C_Spell.GetSpellName(tradeID)
--DA.DEBUG(3,"TradeButton_OnEnter("..tostring(bName).."), player= "..tostring(player)..", tradeID= "..tostring(tradeID)..", sName= "..tostring(sName))
GameTooltip:AddLine(sName)
tradeID = tonumber(tradeID)
local data
data = self:GetSkillRanks(player, tradeID)
Expand All @@ -570,7 +570,7 @@ function Skillet:TradeButton_OnEnter(button)
GameTooltip:AddLine("scan incomplete...",1,0,0)
end
if nonLinkingTrade[tradeID] and player ~= UnitName("player") then
GameTooltip:AddLine((GetSpellInfo(tradeID)).." not available for alts")
GameTooltip:AddLine(sName.." not available for alts")
end
end
GameTooltip:Show()
Expand All @@ -582,12 +582,12 @@ function Skillet:TradeButtonAdditional_OnEnter(button)
GameTooltip:SetOwner(button, "ANCHOR_TOPLEFT")
GameTooltip:ClearLines()
local spellID = button:GetID()
local spellInfo, _ = GetSpellInfo(spellID)
local spellName = C_Spell.GetSpellName(spellID)
if button.Toy then
_, spellInfo = C_ToyBox.GetToyInfo(spellID)
_, spellName = C_ToyBox.GetToyInfo(spellID)
end
--DA.DEBUG(1,"TradeButtonAdditional_OnEnter: spellInfo= "..tostring(spellInfo))
GameTooltip:AddLine(spellInfo)
--DA.DEBUG(1,"TradeButtonAdditional_OnEnter: spellName= "..tostring(spellName))
GameTooltip:AddLine(spellName)
if not button.Toy then
local itemID = Skillet:GetAutoTargetItem(self.currentTrade, spellID)
if itemID and IsAltKeyDown() then
Expand Down Expand Up @@ -717,8 +717,8 @@ function Skillet:CreateAdditionalButtonsList()
local spellID = additionalSpellTab[j][1]
if not seenButtons[spellID] then
if additionalSpellTab[j][5] then
local name = GetSpellInfo(spellID) -- always returns data
local name = GetSpellInfo(name) -- only returns data if you have this spell in your spellbook
local name = C_Spell.GetSpellName(spellID) -- always returns data
local name = C_Spell.GetSpellName(name) -- only returns data if you have this spell in your spellbook
--DA.DEBUG(1,"CreateAdditionalButtonsList: name= "..tostring(name))
if name then
table.insert(Skillet.AdditionalButtonsList, additionalSpellTab[j])
Expand Down Expand Up @@ -768,7 +768,11 @@ function Skillet:UpdateTradeButtons(player)
end
end
if ranks then
local spellName, _, spellIcon = GetSpellInfo(tradeID)
local spellName, spellIcon
local spellInfo = C_Spell.GetSpellInfo(tradeID)
--DA.DEBUG(1,"UpdateTradeButtons: spellInfo= "..DA.DUMP1(spellInfo))
spellName = spellInfo.name
spellIcon = spellInfo.iconID
local buttonName = "SkilletFrameTradeButton-"..player.."-"..tradeID
local button = _G[buttonName]
if not button then
Expand Down Expand Up @@ -824,15 +828,18 @@ function Skillet:UpdateTradeButtons(player)
local additionalSpellName = additionalSpellTab[2]
local additionalToy = additionalSpellTab[3]
local additionalPet = additionalSpellTab[4]
local spellName, _, spellIcon, petGUID
local spellInfo, spellName, spellIcon, petGUID
if additionalToy then
if (PlayerHasToy(additionalSpellId) and C_ToyBox.IsToyUsable(additionalSpellId)) then
_, spellName, spellIcon = C_ToyBox.GetToyInfo(additionalSpellId)
else
spellName = nil
end
else
spellName, _, spellIcon = GetSpellInfo(additionalSpellId)
local spellInfo = C_Spell.GetSpellInfo(additionalSpellId)
--DA.DEBUG(1,"UpdateTradeButtons: spellInfo= "..DA.DUMP1(spellInfo))
spellName = spellInfo.name
spellIcon = spellInfo.iconID
end
if additionalPet then
_, petGUID = C_PetJournal.FindPetIDByName(additionalSpellName)
Expand Down Expand Up @@ -865,7 +872,7 @@ function Skillet:UpdateTradeButtons(player)
--
-- pure spell on left-click
--
local spellName, _, texture = GetSpellInfo(additionalSpellId)
local spellName, _, texture = C_Spell.GetSpellName(additionalSpellId)
DA.DEBUG(1,"UpdateTradeButtons: additionalSpellId= "..tostring(additionalSpellId)..", spellName= "..tostring(spellName))
button:SetAttribute("type1", "spell")
button:SetAttribute("spell1", spellName)
Expand Down
4 changes: 2 additions & 2 deletions UI/RecipeNotes.lua
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ function Skillet:UpdateNotesWindow()
if index == 1 then
local texture
-- notes for the recipe itself
text:SetText((GetSpellInfo(recipeID)))
text:SetText((C_Spell.GetSpellName(recipeID)))
if recipe.numMade > 0 then
local a
a,a,a,a,a,a,a,a,a,texture = C_Item.GetItemInfo(recipe.itemID) -- get the item texture
Expand Down Expand Up @@ -183,7 +183,7 @@ function Skillet:UpdateNotesWindow()
end

--
-- Hide the Skillet notes window, it it was open
-- Hide the Skillet notes window, if it was open
--
function Skillet:HideNotesWindow()
--DA.DEBUG(0,"HideNotesWindow()")
Expand Down

0 comments on commit 3bd5b90

Please sign in to comment.