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

Commit

Permalink
Get rid of CollectionCache it's unnecessary
Browse files Browse the repository at this point in the history
  • Loading branch information
brittyazel committed Apr 9, 2020
1 parent eef6c11 commit 50349ca
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 62 deletions.
1 change: 0 additions & 1 deletion Neuron-DB-Defaults.lua
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,6 @@ NeuronDefaults = {

NeuronItemCache = {},
NeuronSpellCache = {},
NeuronCollectionCache = {},
NeuronToyCache = {},

NeuronIcon = {hide = false,},
Expand Down
2 changes: 0 additions & 2 deletions Neuron-GUI.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2535,8 +2535,6 @@ function NeuronGUI:specUpdateIcon(button,state)
if (NeuronSpellCache[spell]) then
local spell_id = NeuronSpellCache[spell].spellID
texture = GetSpellTexture(spell_id)
elseif (NeuronCollectionCache[spell]) then
texture = NeuronCollectionCache[spell].icon
elseif (spell) then
texture = GetSpellTexture(spell)
end
Expand Down
51 changes: 0 additions & 51 deletions Neuron.lua
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ Neuron.registeredGUIData = {}
--these are the database tables that are going to hold our data. They are global because every .lua file needs access to them
NeuronItemCache = {} --Stores a cache of all items that have been seen by a Neuron button
NeuronSpellCache = {} --Stores a cache of all spells that have been seen by a Neuron button
NeuronCollectionCache = {} --Stores a cache of all Mounts and Battle Pets that have been seen by a Neuron button
NeuronToyCache = {} --Stores a cache of all toys that have been seen by a Neuron button


Expand Down Expand Up @@ -153,7 +152,6 @@ function Neuron:OnInitialize()
--load saved variables into working variable containers
NeuronItemCache = DB.NeuronItemCache
NeuronSpellCache = DB.NeuronSpellCache
NeuronCollectionCache = DB.NeuronCollectionCache
NeuronToyCache = DB.NeuronToyCache

--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
Expand Down Expand Up @@ -197,9 +195,7 @@ function Neuron:OnEnable()
Neuron:RegisterEvent("LEARNED_SPELL_IN_TAB")

if not Neuron.isWoWClassic then
Neuron:RegisterEvent("COMPANION_LEARNED")
Neuron:RegisterEvent("TOYS_UPDATED")
Neuron:RegisterEvent("PET_JOURNAL_LIST_UPDATE")
end

Neuron:UpdateStanceStrings()
Expand Down Expand Up @@ -281,7 +277,6 @@ function Neuron:PLAYER_ENTERING_WORLD()
Neuron:UpdateStanceStrings()

if not Neuron.isWoWClassic then
Neuron:UpdateCollectionCache()
Neuron:UpdateToyCache()
end

Expand Down Expand Up @@ -321,14 +316,6 @@ function Neuron:SPELLS_CHANGED()
Neuron:UpdateStanceStrings()
end

function Neuron:COMPANION_LEARNED()
Neuron:UpdateCollectionCache()
end

function Neuron:PET_JOURNAL_LIST_UPDATE()
Neuron:UpdateCollectionCache()
end

function Neuron:TOYS_UPDATED(...)
Neuron:UpdateToyCache()
end
Expand Down Expand Up @@ -582,44 +569,6 @@ function Neuron:UpdateToyCache()

end


--- Compiles a list of battle pets & mounts a player has. This table is used to refrence macro spell info to generate tooltips and cooldowns.
--- If a companion is not displaying its tooltip or cooldown, then the item in the macro probably is not in the database
function Neuron:UpdateCollectionCache()

local _, numpet = C_PetJournal.GetNumPets()

for i=1,numpet do

local petID, speciesID, owned, _, _, _, _, speciesName, icon = C_PetJournal.GetPetInfoByIndex(i)

if petID and owned then
local spell = speciesName
if spell then
local companionData = Neuron:SetCompanionData("CRITTER", i, speciesID, speciesName, petID, icon)
NeuronCollectionCache[spell:lower()] = companionData
NeuronCollectionCache[spell:lower().."()"] = companionData
end
end
end

local mountIDs = C_MountJournal.GetMountIDs()
for i,id in pairs(mountIDs) do
local creatureName , spellID, _, _, _, _, _, _, _, _, collected = C_MountJournal.GetMountInfoByID(id)

if spellID and collected then
local spell, _, icon = GetSpellInfo(spellID)
if spell then
local companionData = Neuron:SetCompanionData("MOUNT", i, spellID, creatureName, spellID, icon)
NeuronCollectionCache[spell:lower()] = companionData
NeuronCollectionCache[spell:lower().."()"] = companionData
end
end
end
end



function Neuron:UpdateStanceStrings()
if Neuron.class == "DRUID" or Neuron.class == "ROGUE" then

Expand Down
8 changes: 0 additions & 8 deletions Objects/ACTIONBUTTON.lua
Original file line number Diff line number Diff line change
Expand Up @@ -733,12 +733,6 @@ function ACTIONBUTTON:SetSpellTooltip(spell)
else
GameTooltip:SetText(NeuronSpellCache[spell:lower()].spellName, 1, 1, 1)
end
elseif NeuronCollectionCache[spell:lower()] then
if self.UberTooltips and NeuronCollectionCache[spell:lower()].creatureType =="MOUNT" then
GameTooltip:SetHyperlink("spell:"..NeuronCollectionCache[spell:lower()].spellID)
else
GameTooltip:SetText(NeuronCollectionCache[spell:lower()].creatureName, 1, 1, 1)
end
else
GameTooltip:SetText(UNKNOWN, 1, 1, 1)
end
Expand Down Expand Up @@ -806,8 +800,6 @@ function ACTIONBUTTON:SetSpellIcon(spell)
if not texture then
if NeuronSpellCache[spell:lower()] then
texture = NeuronSpellCache[spell:lower()].icon
elseif NeuronCollectionCache[spell:lower()] then
texture = NeuronCollectionCache[spell:lower()].icon
end
end

Expand Down

0 comments on commit 50349ca

Please sign in to comment.