Skip to content
This repository was archived by the owner on Jan 21, 2024. It is now read-only.

Commit 947a77a

Browse files
committed
Remove ToyCache, as it wasn't useful anymore
1 parent 50349ca commit 947a77a

3 files changed

Lines changed: 6 additions & 46 deletions

File tree

Neuron-DB-Defaults.lua

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,6 @@ NeuronDefaults = {
267267

268268
NeuronItemCache = {},
269269
NeuronSpellCache = {},
270-
NeuronToyCache = {},
271270

272271
NeuronIcon = {hide = false,},
273272

Neuron.lua

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ Neuron.registeredGUIData = {}
4343
--these are the database tables that are going to hold our data. They are global because every .lua file needs access to them
4444
NeuronItemCache = {} --Stores a cache of all items that have been seen by a Neuron button
4545
NeuronSpellCache = {} --Stores a cache of all spells that have been seen by a Neuron button
46-
NeuronToyCache = {} --Stores a cache of all toys that have been seen by a Neuron button
4746

4847

4948
Neuron.STRATAS = {"BACKGROUND", "LOW", "MEDIUM", "HIGH", "DIALOG", "TOOLTIP"}
@@ -152,7 +151,6 @@ function Neuron:OnInitialize()
152151
--load saved variables into working variable containers
153152
NeuronItemCache = DB.NeuronItemCache
154153
NeuronSpellCache = DB.NeuronSpellCache
155-
NeuronToyCache = DB.NeuronToyCache
156154

157155
--these are the working pointers to our global database tables. Each class has a local GDB and CDB table that is a pointer to the root of their associated database
158156
Neuron.MAS = Neuron.MANAGED_ACTION_STATES
@@ -194,10 +192,6 @@ function Neuron:OnEnable()
194192
Neuron:RegisterEvent("CHARACTER_POINTS_CHANGED")
195193
Neuron:RegisterEvent("LEARNED_SPELL_IN_TAB")
196194

197-
if not Neuron.isWoWClassic then
198-
Neuron:RegisterEvent("TOYS_UPDATED")
199-
end
200-
201195
Neuron:UpdateStanceStrings()
202196

203197
--this allows for the "Esc" key to disable the Edit Mode instead of bringing up the game menu, but only if an edit mode is activated.
@@ -276,10 +270,6 @@ function Neuron:PLAYER_ENTERING_WORLD()
276270
Neuron:UpdateSpellCache()
277271
Neuron:UpdateStanceStrings()
278272

279-
if not Neuron.isWoWClassic then
280-
Neuron:UpdateToyCache()
281-
end
282-
283273
--Fix for Titan causing the Main Bar to not be hidden
284274
if IsAddOnLoaded("Titan") then
285275
TitanUtils_AddonAdjust("MainMenuBar", true)
@@ -316,10 +306,6 @@ function Neuron:SPELLS_CHANGED()
316306
Neuron:UpdateStanceStrings()
317307
end
318308

319-
function Neuron:TOYS_UPDATED(...)
320-
Neuron:UpdateToyCache()
321-
end
322-
323309
-------------------------------------------------------------------------
324310
--------------------Profiles---------------------------------------------
325311
-------------------------------------------------------------------------
@@ -548,27 +534,6 @@ function Neuron:SetCompanionData(creatureType, index, creatureID, creatureName,
548534
return curComp
549535
end
550536

551-
552-
--- Compiles a list of toys a player has. This table is used to refrence macro spell info to generate tooltips and cooldowns.
553-
-- toy cache is backwards due to bugs with secure action buttons' inability to
554-
-- cast a toy by item:id (and inability to SetMacroItem from a name /sigh)
555-
-- cache is indexed by the toyName and equals the itemID
556-
-- the attribValue for toys will be the toyName, and unsecure stuff can pull
557-
-- the itemID from toyCache where needed
558-
function Neuron:UpdateToyCache()
559-
560-
-- fill cache with itemIDs = name
561-
for i=1,C_ToyBox.GetNumToys() do
562-
local itemID = C_ToyBox.GetToyFromIndex(i)
563-
local name = GetItemInfo(itemID) or "UNKNOWN"
564-
local known = PlayerHasToy(itemID)
565-
if known then
566-
NeuronToyCache[name:lower()] = itemID
567-
end
568-
end
569-
570-
end
571-
572537
function Neuron:UpdateStanceStrings()
573538
if Neuron.class == "DRUID" or Neuron.class == "ROGUE" then
574539

Objects/ACTIONBUTTON.lua

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -753,12 +753,6 @@ function ACTIONBUTTON:SetItemTooltip(item)
753753
else
754754
GameTooltip:SetText(NeuronItemCache[item:lower()], 1, 1, 1)
755755
end
756-
elseif NeuronToyCache[item:lower()] then
757-
if self.UberTooltips then
758-
GameTooltip:SetToyByItemID(NeuronToyCache[item:lower()])
759-
else
760-
GameTooltip:SetText(name, 1, 1, 1)
761-
end
762756
end
763757
end
764758

@@ -818,8 +812,6 @@ function ACTIONBUTTON:SetItemIcon(item)
818812
if not texture then
819813
if NeuronItemCache[item:lower()] then
820814
texture = GetItemIcon("item:"..NeuronItemCache[item:lower()]..":0:0:0:0:0:0:0")
821-
elseif NeuronToyCache[item:lower()] then
822-
texture = GetItemIcon("item:"..NeuronToyCache[item:lower()]..":0:0:0:0:0:0:0")
823815
end
824816
end
825817

@@ -982,8 +974,12 @@ function ACTIONBUTTON:SetUsableItem(item)
982974

983975
local isUsable, notEnoughMana = IsUsableItem(item)
984976

985-
if NeuronToyCache[item:lower()] then
986-
isUsable = true
977+
--for some reason toys don't show as usable items, so this is a workaround for that
978+
if not isUsable then
979+
local itemID = GetItemInfoInstant(item)
980+
if itemID and PlayerHasToy(itemID) then
981+
isUsable = true
982+
end
987983
end
988984

989985
if notEnoughMana and self.manacolor then

0 commit comments

Comments
 (0)