Compare commits

...

3 Commits

Author SHA1 Message Date
florian.berthold f305f0a226 coa.15: guard GetRestedXP + GetMoneyString/GetTimeString against no-value getters
release / release (push) Successful in 4s
GetRestedXP did 'rate * coeff' on a nil DS:GetRestXPRate result (crashed Account
Summary). Guarded it, plus defensive nil->0 on the two common string helpers.
2026-05-29 19:34:25 +02:00
florian.berthold f64d2c9250 coa.14: wrap character-view professions at 4 per row
release / release (push) Successful in 5s
_Prof5 starts a 2nd row under _Prof1 (Prof6-8 follow) so chars with many professions
don't run the icon row off the right edge of the screen.
2026-05-29 18:34:21 +02:00
florian.berthold 1faf213f17 coa.13: fix character-view crash on chars with >2 professions
release / release (push) Successful in 5s
SetItemButtonTexture now guards a nil IconTexture (was crashing whenever a button
didn't exist). UpdateViewIcons profession loop stops at the last existing _ProfN
button instead of indexing a nil frame; added _Prof3..8 so CoA chars (which can know
many professions) show more than 2. This was blocking the character detail view from
rendering when you clicked a char in the Account Summary.
2026-05-29 18:17:53 +02:00
4 changed files with 64 additions and 7 deletions
+6 -3
View File
@@ -495,11 +495,12 @@ function addon:SetItemButtonTexture(button, texture, width, height)
height = height or 36 height = height or 36
local itemTexture = _G[button.."IconTexture"] local itemTexture = _G[button.."IconTexture"]
if not itemTexture then return end -- CoA: guard buttons that don't exist / lack an IconTexture region (e.g. iterating more professions than there are _ProfN buttons)
itemTexture:SetWidth(width); itemTexture:SetWidth(width);
itemTexture:SetHeight(height); itemTexture:SetHeight(height);
itemTexture:SetAllPoints(_G[button]); itemTexture:SetAllPoints(_G[button]);
SetItemButtonTexture(_G[button], texture) SetItemButtonTexture(_G[button], texture)
end end
@@ -551,6 +552,7 @@ function addon:GetSpellIDFromRecipeLink(link)
end end
function addon:GetMoneyString(copper, color, noTexture) function addon:GetMoneyString(copper, color, noTexture)
copper = copper or 0 -- CoA: callers may pass a no-value DS getter result
color = color or "|cFFFFD700" color = color or "|cFFFFD700"
local gold = floor( copper / 10000 ); local gold = floor( copper / 10000 );
@@ -571,6 +573,7 @@ function addon:GetMoneyString(copper, color, noTexture)
end end
function addon:GetTimeString(seconds) function addon:GetTimeString(seconds)
seconds = seconds or 0 -- CoA: callers may pass a no-value DS getter result
local days = floor(seconds / 86400); -- TotalTime is expressed in seconds local days = floor(seconds / 86400); -- TotalTime is expressed in seconds
seconds = mod(seconds, 86400) seconds = mod(seconds, 86400)
local hours = floor(seconds / 3600); local hours = floor(seconds / 3600);
@@ -647,7 +650,7 @@ function Altoholic:FormatDelay(timeStamp)
end end
function addon:GetRestedXP(character) function addon:GetRestedXP(character)
local rate = DS:GetRestXPRate(character) local rate = DS:GetRestXPRate(character) or 0 -- CoA: getter returns no value for unscanned/partial chars
local coeff = 1 local coeff = 1
if addon.Options:Get("RestXPMode") == 1 then if addon.Options:Get("RestXPMode") == 1 then
+1 -1
View File
@@ -13,7 +13,7 @@
## Author: Thaoky, Telkar-RG ## Author: Thaoky, Telkar-RG
## X-Edited-By: Exiles (Sub-Net) — florian.berthold@sub-net.at ## X-Edited-By: Exiles (Sub-Net) — florian.berthold@sub-net.at
## Version: 3.3.002b-coa.12 ## Version: 3.3.002b-coa.15
## X-Category: Inventory, Tradeskill, Mail ## X-Category: Inventory, Tradeskill, Mail
## X-Localizations: enUS, frFR, zhCN, zhTW, deDE, koKR, esES, esMX, ruRU ## X-Localizations: enUS, frFR, zhCN, zhTW, deDE, koKR, esES, esMX, ruRU
## X-Website: http://wow.curse.com/downloads/wow-addons/details/altoholic.aspx ## X-Website: http://wow.curse.com/downloads/wow-addons/details/altoholic.aspx
+13 -3
View File
@@ -227,22 +227,32 @@ function ns:UpdateViewIcons()
AltoholicTabCharacters_FirstAid.text = professionName AltoholicTabCharacters_FirstAid.text = professionName
AltoholicTabCharacters_FirstAid:Show() AltoholicTabCharacters_FirstAid:Show()
-- CoA: characters can know far more than the retail 2 primary professions, so the
-- _ProfN button row may run out before the profession list does. Stop at the last
-- existing button instead of indexing a nil frame (which crashed the character view).
local i = 1 local i = 1
for skillName, skill in pairs(DS:GetPrimaryProfessions(character) or {}) do -- CoA: getter returns no value for chars DataStore_Crafts hasn't scanned for skillName, skill in pairs(DS:GetPrimaryProfessions(character) or {}) do
local itemName = "AltoholicTabCharacters_Prof" .. i local itemName = "AltoholicTabCharacters_Prof" .. i
local item = _G[itemName] local item = _G[itemName]
if not item then break end -- no more profession buttons available
local spellID = DataStore:GetProfessionSpellID(skillName) local spellID = DataStore:GetProfessionSpellID(skillName)
if spellID then if spellID then
addon:SetItemButtonTexture(itemName, addon:GetSpellIcon(spellID), size, size) addon:SetItemButtonTexture(itemName, addon:GetSpellIcon(spellID), size, size)
item.text = skillName item.text = skillName
item:Show() item:Show()
else else
item.text = nil item.text = nil
item:Hide() item:Hide()
end end
i = i + 1 i = i + 1
end end
-- Hide any leftover profession buttons this character doesn't fill.
while _G["AltoholicTabCharacters_Prof" .. i] do
_G["AltoholicTabCharacters_Prof" .. i].text = nil
_G["AltoholicTabCharacters_Prof" .. i]:Hide()
i = i + 1
end
end end
function ns:MenuItem_OnClick(frame, button) function ns:MenuItem_OnClick(frame, button)
+44
View File
@@ -257,6 +257,50 @@
</Anchor> </Anchor>
</Anchors> </Anchors>
</Button> </Button>
<!-- CoA: characters can know many more than 2 primary professions. Extra slots;
UpdateViewIcons fills/hides them dynamically and stops at the last one. -->
<Button name="$parent_Prof3" inherits="AltoViewIconTemplate" hidden="true">
<Anchors>
<Anchor point="BOTTOMLEFT" relativeTo="$parent_Prof2" relativePoint="BOTTOMRIGHT" >
<Offset x="5" y="0" />
</Anchor>
</Anchors>
</Button>
<Button name="$parent_Prof4" inherits="AltoViewIconTemplate" hidden="true">
<Anchors>
<Anchor point="BOTTOMLEFT" relativeTo="$parent_Prof3" relativePoint="BOTTOMRIGHT" >
<Offset x="5" y="0" />
</Anchor>
</Anchors>
</Button>
<Button name="$parent_Prof5" inherits="AltoViewIconTemplate" hidden="true">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parent_Prof1" relativePoint="BOTTOMLEFT" >
<Offset x="5" y="0" />
</Anchor>
</Anchors>
</Button>
<Button name="$parent_Prof6" inherits="AltoViewIconTemplate" hidden="true">
<Anchors>
<Anchor point="BOTTOMLEFT" relativeTo="$parent_Prof5" relativePoint="BOTTOMRIGHT" >
<Offset x="5" y="0" />
</Anchor>
</Anchors>
</Button>
<Button name="$parent_Prof7" inherits="AltoViewIconTemplate" hidden="true">
<Anchors>
<Anchor point="BOTTOMLEFT" relativeTo="$parent_Prof6" relativePoint="BOTTOMRIGHT" >
<Offset x="5" y="0" />
</Anchor>
</Anchors>
</Button>
<Button name="$parent_Prof8" inherits="AltoViewIconTemplate" hidden="true">
<Anchors>
<Anchor point="BOTTOMLEFT" relativeTo="$parent_Prof7" relativePoint="BOTTOMRIGHT" >
<Offset x="5" y="0" />
</Anchor>
</Anchors>
</Button>
<Button name="$parent_Sort1" inherits="AltoSortButtonTemplate" id="1"> <Button name="$parent_Sort1" inherits="AltoSortButtonTemplate" id="1">
<Size> <Size>