diff --git a/Altoholic/Altoholic.toc b/Altoholic/Altoholic.toc index 00ad0fd..0279010 100644 --- a/Altoholic/Altoholic.toc +++ b/Altoholic/Altoholic.toc @@ -13,7 +13,7 @@ ## Author: Thaoky, Telkar-RG ## X-Edited-By: Exiles (Sub-Net) — florian.berthold@sub-net.at -## Version: 3.3.002b-coa.2 +## Version: 3.3.002b-coa.3 ## X-Category: Inventory, Tradeskill, Mail ## X-Localizations: enUS, frFR, zhCN, zhTW, deDE, koKR, esES, esMX, ruRU ## X-Website: http://wow.curse.com/downloads/wow-addons/details/altoholic.aspx diff --git a/DataStore_Characters/DataStore_Characters.lua b/DataStore_Characters/DataStore_Characters.lua index 20e8983..af8ef98 100644 --- a/DataStore_Characters/DataStore_Characters.lua +++ b/DataStore_Characters/DataStore_Characters.lua @@ -206,7 +206,9 @@ local function _GetXP(character) end local function _GetXPRate(character) - return floor((character.XP / character.XPMax) * 100) + local xpMax = character.XPMax or 0 -- CoA: comm-seeded / max-level / unscanned char has no XP data (also avoids /0) + if xpMax == 0 then return 0 end + return floor(((character.XP or 0) / xpMax) * 100) end local function _GetXPMax(character) @@ -234,7 +236,7 @@ local function _GetRestXPRate(character) -- divide rest xp by this value 20400 / 204 = 100 ==> rest xp rate local rate = 0 - if character.RestXP then + if character.RestXP and character.XPMax and character.XPMax > 0 then -- CoA: guard nil/zero XPMax rate = (character.RestXP / ((character.XPMax / 100) * 1.5)) end @@ -242,7 +244,7 @@ local function _GetRestXPRate(character) -- (elapsed time / 3600) * 0.625 * (2/3) simplifies to elapsed time / 8640 -- 0.625 comes from 8 hours rested = 5% of a level, *2/3 because 100% rested = 150% of xp (1.5 level) - if character.lastLogoutTimestamp ~= 0 then -- time since last logout, 0 for current char, <> for all others + if character.lastLogoutTimestamp and character.lastLogoutTimestamp ~= 0 then -- time since last logout, 0 for current char, <> for all others (CoA: nil for comm-seeded chars => "nil ~= 0" is true and crashed) if character.isResting then rate = rate + ((time() - character.lastLogoutTimestamp) / 8640) else diff --git a/DataStore_Characters/DataStore_Characters.toc b/DataStore_Characters/DataStore_Characters.toc index 9e180ae..f455afa 100644 --- a/DataStore_Characters/DataStore_Characters.toc +++ b/DataStore_Characters/DataStore_Characters.toc @@ -3,7 +3,7 @@ ## Notes: Stores information about characters (race, level, etc..) ## Author: Thaoky (EU-Marécages de Zangar) ## X-Edited-By: Exiles (Sub-Net) -## Version: 3.3.001-coa.2 +## Version: 3.3.001-coa.3 ## Dependencies: DataStore ## OptionalDeps: Ace3 ## SavedVariables: DataStore_CharactersDB diff --git a/README.md b/README.md index dada96a..3952951 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,9 @@ Altoholic: modified development for WotLK Ported for the Ascension CoA (Vol'jin) 3.3.5a client by the Exiles guild. Released as `*-coa.N` tags via Gitea Actions; see `Exiles/coa-altoholic`. +- **3.3.002b-coa.3** — More partial-record guards in `DataStore_Characters` (own alts seen via guild comm but never fully scanned): + - `GetXPRate` — guard nil/zero `XPMax` (crashed AccountSummary; also fixes div-by-zero at max level). + - `GetRestXPRate` — guard nil/zero `XPMax` and nil `lastLogoutTimestamp` (`nil ~= 0` was true and crashed). - **3.3.002b-coa.2** — Defensive guards for CoA data shapes (custom classes, records seeded from guild comm before a full scan, ungeared chars). Fixes login/UI crashes: - `DataStore_Inventory` — `GetAverageItemLevel` returns `0` instead of `nil` (crashed the Altoholic char sort and AccountSummary iLvl format); guarded the login AIL broadcast and the `0/0` average for ungeared chars. - `DataStore_Pets` — `GetNumPets` returns `0` for an unscanned companion table instead of `assert`-crashing TabCharacters.