mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-20 09:17:36 +01:00
Core/Items: use the correct item-sparse column to determine stat bonus amounts
This commit is contained in:
@@ -1573,7 +1573,7 @@ bool Item::HasStats() const
|
||||
bool Item::HasStats(WorldPackets::Item::ItemInstance const& /*itemInstance*/, BonusData const* bonus)
|
||||
{
|
||||
for (uint8 i = 0; i < MAX_ITEM_PROTO_STATS; ++i)
|
||||
if (bonus->StatPercentEditor[i] != 0)
|
||||
if (bonus->ItemStatBonusAmount[i] != 0)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
@@ -1932,26 +1932,7 @@ uint32 Item::GetItemLevel(ItemTemplate const* itemTemplate, BonusData const& bon
|
||||
float Item::GetItemStatValue(uint32 index, Player const* owner) const
|
||||
{
|
||||
ASSERT(index < MAX_ITEM_PROTO_STATS);
|
||||
switch (GetItemStatType(index))
|
||||
{
|
||||
case ITEM_MOD_CORRUPTION:
|
||||
case ITEM_MOD_CORRUPTION_RESISTANCE:
|
||||
return _bonusData.StatPercentEditor[index];
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
uint32 itemLevel = GetItemLevel(owner);
|
||||
if (float randomPropPoints = GetRandomPropertyPoints(itemLevel, GetQuality(), GetTemplate()->GetInventoryType(), GetTemplate()->GetSubClass()))
|
||||
{
|
||||
float statValue = float(_bonusData.StatPercentEditor[index] * randomPropPoints) * 0.0001f;
|
||||
if (GtItemSocketCostPerLevelEntry const* gtCost = sItemSocketCostPerLevelGameTable.GetRow(itemLevel))
|
||||
statValue -= float(int32(_bonusData.ItemStatSocketCostMultiplier[index] * gtCost->SocketCost));
|
||||
|
||||
return statValue;
|
||||
}
|
||||
|
||||
return 0.0f;
|
||||
return static_cast<float>(_bonusData.ItemStatBonusAmount[index]);
|
||||
}
|
||||
|
||||
ItemDisenchantLootEntry const* Item::GetDisenchantLoot(Player const* owner) const
|
||||
@@ -2173,7 +2154,7 @@ void BonusData::Initialize(ItemTemplate const* proto)
|
||||
ItemStatType[i] = proto->GetStatModifierBonusStat(i);
|
||||
|
||||
for (uint32 i = 0; i < MAX_ITEM_PROTO_STATS; ++i)
|
||||
StatPercentEditor[i] = proto->GetStatPercentEditor(i);
|
||||
ItemStatBonusAmount[i] = proto->GetStatModifierBonusAmount(i);
|
||||
|
||||
for (uint32 i = 0; i < MAX_ITEM_PROTO_STATS; ++i)
|
||||
ItemStatSocketCostMultiplier[i] = proto->GetStatPercentageOfSocket(i);
|
||||
|
||||
@@ -71,7 +71,7 @@ struct BonusData
|
||||
int32 ItemLevelBonus;
|
||||
int32 RequiredLevel;
|
||||
int32 ItemStatType[MAX_ITEM_PROTO_STATS];
|
||||
int32 StatPercentEditor[MAX_ITEM_PROTO_STATS];
|
||||
int32 ItemStatBonusAmount[MAX_ITEM_PROTO_STATS];
|
||||
float ItemStatSocketCostMultiplier[MAX_ITEM_PROTO_STATS];
|
||||
uint32 SocketColor[MAX_ITEM_PROTO_SOCKETS];
|
||||
ItemBondingType Bonding;
|
||||
|
||||
@@ -796,6 +796,7 @@ struct TC_GAME_API ItemTemplate
|
||||
uint32 GetMaxCount() const { return ExtendedData->MaxCount; }
|
||||
uint32 GetContainerSlots() const { return ExtendedData->ContainerSlots; }
|
||||
int32 GetStatModifierBonusStat(uint32 index) const { ASSERT(index < MAX_ITEM_PROTO_STATS); return ExtendedData->StatModifierBonusStat[index]; }
|
||||
int32 GetStatModifierBonusAmount(uint32 index) const { ASSERT(index < MAX_ITEM_PROTO_STATS); return ExtendedData->StatModifierBonusAmount[index]; }
|
||||
int32 GetStatPercentEditor(uint32 index) const { ASSERT(index < MAX_ITEM_PROTO_STATS); return ExtendedData->StatPercentEditor[index]; }
|
||||
float GetStatPercentageOfSocket(uint32 index) const { ASSERT(index < MAX_ITEM_PROTO_STATS); return ExtendedData->StatPercentageOfSocket[index]; }
|
||||
uint32 GetScalingStatContentTuning() const { return ExtendedData->ContentTuningID; }
|
||||
|
||||
Reference in New Issue
Block a user