mirror of
https://github.com/mangosfour/server.git
synced 2025-12-14 07:37:01 +00:00
[7819] Correct use item ScalingStatValues data (ScalingStatValues.dbc):
- ScalingStatDistribution stats multiplier - Armor bonus from ssv - Damage from ssv - Feral AP from ssv - Feral AP from ssv dps bonus Use item->StatsCount in apply mods Not allow equip item if level > ScalingStatDistribution->maxlevel field TODO find more info about ScalingStatValuesEntry->spellBonus Signed-off-by: DiSlord <dislord@nomail.com>
This commit is contained in:
parent
fd71c2bd6f
commit
bfe2e187a6
4 changed files with 106 additions and 70 deletions
|
|
@ -6338,30 +6338,25 @@ void Player::_ApplyItemBonuses(ItemPrototype const *proto, uint8 slot, bool appl
|
|||
if(slot >= INVENTORY_SLOT_BAG_END || !proto)
|
||||
return;
|
||||
|
||||
ScalingStatDistributionEntry const *ssd = proto->ScalingStatDistribution ? sScalingStatDistributionStore.LookupEntry(proto->ScalingStatDistribution) : 0;
|
||||
ScalingStatValuesEntry const *ssv = proto->ScalingStatValue ? sScalingStatValuesStore.LookupEntry(getLevel()) : 0;
|
||||
|
||||
for (int i = 0; i < MAX_ITEM_PROTO_STATS; ++i)
|
||||
{
|
||||
uint32 statType = 0;
|
||||
int32 val = 0;
|
||||
|
||||
if(proto->ScalingStatDistribution)
|
||||
int32 val = 0;
|
||||
// If set ScalingStatDistribution need get stats and values from it
|
||||
if (ssd && ssv)
|
||||
{
|
||||
if(ScalingStatDistributionEntry const *ssd = sScalingStatDistributionStore.LookupEntry(proto->ScalingStatDistribution))
|
||||
{
|
||||
statType = ssd->StatMod[i];
|
||||
|
||||
if(uint32 modifier = ssd->Modifier[i])
|
||||
{
|
||||
uint32 level = ((getLevel() > ssd->MaxLevel) ? ssd->MaxLevel : getLevel());
|
||||
if(ScalingStatValuesEntry const *ssv = sScalingStatValuesStore.LookupEntry(level))
|
||||
{
|
||||
uint32 multiplier = ssv->Multiplier[proto->GetScalingStatValuesColumn()];
|
||||
val = (multiplier * modifier) / 10000;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (ssd->StatMod[i] < 0)
|
||||
continue;
|
||||
statType = ssd->StatMod[i];
|
||||
val = (ssv->getssdMultiplier(proto->ScalingStatValue) * ssd->Modifier[i]) / 10000;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (proto->StatsCount >= i)
|
||||
continue;
|
||||
statType = proto->ItemStat[i].ItemStatType;
|
||||
val = proto->ItemStat[i].ItemStatValue;
|
||||
}
|
||||
|
|
@ -6516,8 +6511,15 @@ void Player::_ApplyItemBonuses(ItemPrototype const *proto, uint8 slot, bool appl
|
|||
}
|
||||
}
|
||||
|
||||
if (proto->Armor)
|
||||
HandleStatModifier(UNIT_MOD_ARMOR, BASE_VALUE, float(proto->Armor), apply);
|
||||
// If set ScalingStatValue armor get it or use item armor
|
||||
uint32 armor = proto->Armor;
|
||||
if (ssv)
|
||||
{
|
||||
if (uint32 ssvarmor = ssv->getArmorMod(proto->ScalingStatValue))
|
||||
armor = ssvarmor;
|
||||
}
|
||||
if (armor)
|
||||
HandleStatModifier(UNIT_MOD_ARMOR, BASE_VALUE, float(armor), apply);
|
||||
|
||||
if (proto->Block)
|
||||
HandleBaseModValue(SHIELD_BLOCK_VALUE, FLAT_MOD, float(proto->Block), apply);
|
||||
|
|
@ -6554,23 +6556,42 @@ void Player::_ApplyItemBonuses(ItemPrototype const *proto, uint8 slot, bool appl
|
|||
attType = OFF_ATTACK;
|
||||
}
|
||||
|
||||
if (proto->Damage[0].DamageMin > 0 )
|
||||
float minDamage = proto->Damage[0].DamageMin;
|
||||
float maxDamage = proto->Damage[0].DamageMax;
|
||||
int32 extraDPS = 0;
|
||||
// If set dpsMod in ScalingStatValue use it for min (70% from avernge), max (130% from averange) damage
|
||||
if (ssv)
|
||||
{
|
||||
damage = apply ? proto->Damage[0].DamageMin : BASE_MINDAMAGE;
|
||||
if (extraDPS = ssv->getDPSMod(proto->ScalingStatValue))
|
||||
{
|
||||
float averange = extraDPS * proto->Delay / 1000.0f;
|
||||
minDamage = 0.7f * averange;
|
||||
maxDamage = 1.3f * averange;
|
||||
}
|
||||
}
|
||||
if (minDamage > 0 )
|
||||
{
|
||||
damage = apply ? minDamage : BASE_MINDAMAGE;
|
||||
SetBaseWeaponDamage(attType, MINDAMAGE, damage);
|
||||
//sLog.outError("applying mindam: assigning %f to weapon mindamage, now is: %f", damage, GetWeaponDamageRange(attType, MINDAMAGE));
|
||||
}
|
||||
|
||||
if (proto->Damage[0].DamageMax > 0 )
|
||||
if (maxDamage > 0 )
|
||||
{
|
||||
damage = apply ? proto->Damage[0].DamageMax : BASE_MAXDAMAGE;
|
||||
damage = apply ? maxDamage : BASE_MAXDAMAGE;
|
||||
SetBaseWeaponDamage(attType, MAXDAMAGE, damage);
|
||||
}
|
||||
|
||||
// Druids get feral AP bonus from weapon dps
|
||||
// Apply feral bonus from ScalingStatValue if set
|
||||
if (ssv)
|
||||
{
|
||||
if (int32 feral_bonus = ssv->getFeralBonus(proto->ScalingStatValue))
|
||||
ApplyFeralAPBonus(feral_bonus, apply);
|
||||
}
|
||||
// Druids get feral AP bonus from weapon dps (lso use DPS from ScalingStatValue)
|
||||
if(getClass() == CLASS_DRUID)
|
||||
{
|
||||
int32 feral_bonus = proto->getFeralBonus();
|
||||
int32 feral_bonus = proto->getFeralBonus(extraDPS);
|
||||
if (feral_bonus > 0)
|
||||
ApplyFeralAPBonus(feral_bonus, apply);
|
||||
}
|
||||
|
|
@ -9566,6 +9587,10 @@ uint8 Player::CanEquipItem( uint8 slot, uint16 &dest, Item *pItem, bool swap, bo
|
|||
return EQUIP_ERR_CANT_DO_RIGHT_NOW;
|
||||
}
|
||||
|
||||
ScalingStatDistributionEntry const *ssd = pProto->ScalingStatDistribution ? sScalingStatDistributionStore.LookupEntry(pProto->ScalingStatDistribution) : 0;
|
||||
if (ssd && ssd->MaxLevel < getLevel())
|
||||
return EQUIP_ERR_ITEM_CANT_BE_EQUIPPED;
|
||||
|
||||
uint8 eslot = FindEquipSlot( pProto, slot, swap );
|
||||
if( eslot == NULL_SLOT )
|
||||
return EQUIP_ERR_ITEM_CANT_BE_EQUIPPED;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue