Trinitycore: Incorrect Weapon Damage Calculation

Created on 23 Jan 2018  路  4Comments  路  Source: TrinityCore/TrinityCore

Description:

Sometimes, somehow, player weapon damage is reduced too much and a relog will fix the issue. It happens very rarely.

Current behaviour:

As i said before. Here is an example ( his weapon damage should be around 1100 ):

rogue1
rogue2

Branch(es): 3.3.5

TC rev. hash/commit: aef5f8e

TDB version: TDB 335.63

Operating system: Ubuntu 17.10

Comp-Core Sub-Player Sub-StatSystem

Most helpful comment

Equip a weapon and an amor, then unequip the amor, now you can find your weapon damage disappeared.

All 4 comments

Do you know how to reproduce? (ie possible buffs/debuffs you may have had at the time, if you were disarmed, etc.)

Equip a weapon and an amor, then unequip the amor, now you can find your weapon damage disappeared.

I fixed it, the prolem is in Player::_ApplyWeaponDamage from ver. f1986c6aafdf2457902a7a4cc7acc903cbbdc7bb .
I moved 'if (!apply)' into 'for (uint8 i = 0; i < MAX_ITEM_PROTO_DAMAGES; ++i)', and changed 'SetBaseWeaponDamage(attType, MINDAMAGE, BASE_MINDAMAGE, 0);' to 'SetBaseWeaponDamage(attType, MINDAMAGE, BASE_MINDAMAGE, i);', changed 'SetBaseWeaponDamage(attType, MINDAMAGE, BASE_MAXDAMAGE, 0);' to 'SetBaseWeaponDamage(attType, MINDAMAGE, BASE_MAXDAMAGE, i);', deleted 'SetBaseWeaponDamage(attType, MINDAMAGE, 0.f, 1);' and 'SetBaseWeaponDamage(attType, MAXDAMAGE, 0.f, 1);'.

That's bad, secondary damage type must be 0 if no weapon present

The problem here is _ApplyWeaponDamage being called from non-weapon slots (like the case of armor, armor gets removed, proto->Damage is 0 in that case)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Rochet2 picture Rochet2  路  3Comments

Lopfest picture Lopfest  路  3Comments

daddycaddy picture daddycaddy  路  3Comments

DDuarte picture DDuarte  路  3Comments

cbcs picture cbcs  路  3Comments