Go to Page... |
Thread Tools | Display Modes |
08-22-08, 04:57 AM | #1 |
Going mad.... [Strange AceDB-2.0 data updates]
As I said in the title...I'm going mad. You may know I've written SkillsPlusFu, and have been happy with it, but recently (or rather for the past couple months) it's been behaving strangely. The behaviour concerns the Alchemy skill cooldowns.
I've got the following setup: -- declare the database on account level Code:
SkillsPlusFu:RegisterDefaults("account", { -- lists cooldownSave = {}, -- cooldown info per character (middle part of list) ... } ) Code:
function SkillsPlusFu:OnEnable() ... -- cooldown management self:RegisterEvent('TRADE_SKILL_CLOSE') ... -- variables toonSaveKey = GetCVar('realmName')..'|'..UnitName('player') end -- loops spells and if it finds a transmute, write it and consider things done Code:
function SkillsPlusFu:TRADE_SKILL_CLOSE() local cooldownItem = nil local cooldown = nil local numSkills = GetNumTradeSkills() local alchemyCooldown = false for i=1, numSkills do local itemName = GetTradeSkillInfo(i) -- check alchemy cooldowns by spellID if alchemyCooldown == false then if( itemName == GetSpellInfo(11479) or -- Transmute: Iron to Gold ... [all other transmutes listed by spell ID] itemName == GetSpellInfo(53784) -- Transmute: Eternal Water to Fire ) then cooldownItem = L["COOLDOWN_TRANSMUTES"] cooldown = GetTradeSkillCooldown(i) if (cooldown == nil) then cooldown = 0 end -- safety catch; should cooldown be removed (or wrong spell ID used -- self:Print('Found: '..itemName..format(cooldown)) -- write alchemy cooldown information to the database self:WriteCooldownInfo(cooldownItem,cooldown) alchemyCooldown = true end end -- check for tailoring and jewelcrafting cooldowns each with a specific cooldown if ( -- itemName == GetSpellInfo(18560) or -- Mooncloth (cooldown removed in 2.4.3) itemName == GetSpellInfo(26751) or -- Primal Mooncloth itemName == GetSpellInfo(31373) or -- Spellcloth itemName == GetSpellInfo(36686) or -- Shadowcloth itemName == GetSpellInfo(47280)) then -- Brilliant Glass -- write the actual cooldown information to the database self:WriteCooldownInfo(itemName,GetTradeSkillCooldown(i)) end end self:Update() end Code:
function SkillsPlusFu:WriteCooldownInfo(itemName,cooldown) -- general cooldown function if (cooldown == nil) then cooldown = 0 end if (self.db.account.cooldownSave[toonSaveKey] == nil) then self.db.account.cooldownSave[toonSaveKey] = {} end if (self.db.account.cooldownSave[toonSaveKey][itemName] == nil) then self.db.account.cooldownSave[toonSaveKey][itemName] = {} end self.db.account.cooldownSave[toonSaveKey][itemName].Cooldown = format(cooldown) self.db.account.cooldownSave[toonSaveKey][itemName].LastCheck = time() self.db.account.cooldownSave[toonSaveKey][itemName].IsReady = 0 if self.db.account.cooldownSave[toonSaveKey][itemName].Hide == nil then self.db.account.cooldownSave[toonSaveKey][itemName].Hide = false end self:Print('Logged: '..toonSaveKey..' '..itemName..' '..format(self.db.account.cooldownSave[toonSaveKey][itemName].Cooldown)) end I have a transmuter and every time I do a transmute, the timer gets reset. I get the Printed debugger. I can see the timer is reset in the FuBar tooltip and from the menu (showing something like Alchemy (0/1)). Now the strange thing happens. When I logoff and swap toons. The cooldown says it's ready in the FuBar tooltip and from the menu (showing something like Alchemy (1/1)). Swaping again, I run a chance (doesn't always seem to happen which drives me even crazier) to see the previous character to have acquired a ready Transmute cooldown (even with Alchemy not part of their skills) This shows both in the FuBar tooltip and from the menu (showing something like Alchemy (2/2)). If I go back to the Alchemist and open and close the Tradeskill-window the timer gets reset again. With a proper debugger messages. Shutting down after a clean start, will show the SavedVariables file to have saved the cooldown as ready (but I still see no messages of the counter being reset to zero). The tailor stuff in the second bit of code seems to work fine and each piece of cloth-cooldown is properly saved (although my tailor just acquired a Transmute cooldown). Frankly, I can't see what's going on and it's driving me round the bend. Help would be much appreciated. |
|
08-31-08, 02:15 AM | #2 |
Strangely it seems to work the first time the data is saved, but not after it's used a second time. I've also streamlined stuff a little and moved all the GetSpellInfo's to a table (thanks to Elkano for the hint), so all cooldown tradeskill spells now use the same function.
The really strange thing is that it seems to do a final update of the cooldown data after I close the the character by logging out. Debugger statements (on the save function) don't show up. When I log on to the next toon, I see that the Alchemy cooldown is reset. Again, without any debuggers showing up, and even without opening a trade window. Last edited by Jayhawk : 08-31-08 at 02:18 AM. |
|
12-12-08, 02:24 AM | #3 |
The problem hasn't gone away yet. Is there anyone with a suggestion why data erratically doesn't get saved to the SavedVariables file?
|
|
WoWInterface » Developer Discussions » Lua/XML Help » Going mad.... [Strange AceDB-2.0 data updates] |
«
Previous Thread
|
Next Thread
»
|
Display Modes |
Linear Mode |
Switch to Hybrid Mode |
Switch to Threaded Mode |
|
|