Sarjuuk / aowow

Database viewer for TrinityCore based on aowow by @LordJZ, based on the JS-Engine of Wowhead
204 stars 217 forks source link

StatType mana = 0 #389

Closed Helias closed 5 months ago

Helias commented 8 months ago

Describe the bug and how to reproduce it in item.class.php we are considering as statType 0 value the MANA but it's wrong, 0 should be a null/blank value and mana should be 2 (1 is Health, which is correct but Mana should not be 0 but 2).

In includes/types/item.class.php line 746 there is a funny comment // i think i fucked up somewhere mapping item_mods: offsets may be required somewhere I think that this comment refers probably to this error.

Same error is present in locale_enus.php line 1803 where statType 0 is mana and statType 2 is null.

In AzerothCore I can't find in item_template an item with stat_type* = 2, so I can't double-check with wowhead or other sources (it seems unused), but it should not be 0 I guess.

Helias commented 8 months ago

I was wrong

Helias commented 8 months ago

but still, there is something wrong here, mana sometimes is considered as "2" like in g_statToJson or like "1" for ITEM_MOD_MANA in defines.php.

In item.class.php where there is the comment // i think i fucked up somewhere mapping item_mods: offsets may be required somewhere, there is this weird association between mod mana and health (1, 2) with locale_enus.php where Mana is 0 and Health is 1

Sarjuuk commented 8 months ago

So, i'm primarrily going off of enum ItemModType. This is very siminilar to g_statToJson but not quite identical. My old comment was probably me wracking my brain how to reconcile these two. And since g_statToJson interacts weirdly with the item scaling system i don't know if i can simply move mana to idx 0 where it belongs.

i suppose it is correct to change https://github.com/Sarjuuk/aowow/blob/70a93d99055c80b91e7a361add4480eca455771d/includes/types/item.class.php#L754-L770

to

$jsonType = $type;
 // base stat 
 switch ($type) 
 { 
     case ITEM_MOD_MANA: 
         $jsonType = 2;                          // g_statToJson expects mana on idx 2
     case ITEM_MOD_HEALTH: 
     case ITEM_MOD_AGILITY: 
     case ITEM_MOD_STRENGTH: 
     case ITEM_MOD_INTELLECT: 
     case ITEM_MOD_SPIRIT: 
     case ITEM_MOD_STAMINA: 
         $x .= '<span><!--stat'.$jsonType .'-->'.($qty > 0 ? '+' : '-').abs($qty).' '.Lang::item('statType', $type).'</span><br />'; 
         break; 
     default:                                    // rating with % for reqLevel 
         $green[] = $this->parseRating($type, $qty, $interactive, $causesScaling); 

 } 

are there even heirlooms that grant a flat increase of mana/health..?

Helias commented 8 months ago

I made a quick check and I did not find items with stat type 0, about health you can find some items

Sarjuuk commented 8 months ago

https://wowgaming.altervista.org/aowow/?item=6673&xml

in any case, there is a discrepancy between tooltip and json stats

Sarjuuk commented 8 months ago

oh god it's worse.... https://github.com/Sarjuuk/aowow/blob/de2fa3770b7426ae785b1c905d8fc3ed21062626/includes/defines.php#L777-L790

Helias commented 8 months ago

there is something weird indeed

Sarjuuk commented 5 months ago

aaaaand it's gone

d16b08bb297dd1522040a01d1ba8958fba52d155