OmniBar

OmniBar

16M Downloads

Cooldown Reset functionality is broken (suggested solution)

bluedreamz1 opened this issue ยท 1 comments

commented

In game I noticed that anytime a player cold snaps or uses preparation while there are active cds on omnibar, the following error occurs on line 468 (Omnibar.lua OmniBar_OnEvent function): Attempt to index '?' (a number value). My realization was that the array of reset spells was being referenced as if it contained objects, but its actually just an array of spell Ids.

resets[spellID][j].spell resets[spellID][j].amount are examples of invalid references causing this functionality to break. I was unsure what the pieces of the code were doing to check durations by using .amount so I just removed them and kept the following lines in the case of a match:

			if resets[spellID] then
				for i = 1, #self.active do
					if self.active[i] and self.active[i].spellID and self.active[i].sourceGUID and self.active[i].sourceGUID == sourceGUID and self.active[i].cooldown:IsVisible() then
						-- cooldown belongs to this source
						for j = 1, #resets[spellID] do
							if resets[spellID][j] == self.active[i].spellID then
                self.active[i].cooldown:Hide()
                OmniBar_CooldownFinish(self.active[i].cooldown, true)
								return
							end
						end
					end
				end
			end

Since this is just an array of spell Ids and not a more rich object like for other spell references, the reset list will only reset rank 1 versions of all of the spells listed (e.g. ice barrier r4 will not reset without changing the spell id in the reset array). I debated making a pull request but since I didn't really understand the duration stuff you were doing I figured I would just log this as an issue and point out some of the changes that needed to be made.

commented

Should be fixed in v12.0