diff options
| author | Nay <dnpd.dd@gmail.com> | 2012-01-22 03:41:34 +0000 |
|---|---|---|
| committer | Nay <dnpd.dd@gmail.com> | 2012-01-22 03:41:34 +0000 |
| commit | bbdd2ee2737b3abf8e4eef795f53c4be90b71d9b (patch) | |
| tree | 8b338dd6133ec37826227542286d386e38312fac /src/server/game/Entities | |
| parent | 869961bd4e3818ccbab0d80f80ee3e5107750bab (diff) | |
Update SMSG_DURABILITY_DAMAGE_DEATH to 4.x.
Auras can change durability damage (Reinforce guild perk) and need to send the updated value to the client.
Diffstat (limited to 'src/server/game/Entities')
| -rwxr-xr-x | src/server/game/Entities/Player/Player.cpp | 12 | ||||
| -rwxr-xr-x | src/server/game/Entities/Player/Player.h | 4 | ||||
| -rwxr-xr-x | src/server/game/Entities/Unit/Unit.cpp | 8 |
3 files changed, 14 insertions, 10 deletions
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index cdb9ddbcd9b..404557a4d96 100755 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -1279,10 +1279,12 @@ uint32 Player::EnvironmentalDamage(EnviromentalDamage type, uint32 damage) { if (type == DAMAGE_FALL) // DealDamage not apply item durability loss at self damage { - sLog->outStaticDebug("We are fall to death, loosing 10 percents durability"); - DurabilityLossAll(0.10f, false); + float percent = 0.10f; + DurabilityLossAll(percent, false); + sLog->outStaticDebug("We are fall to death, loosing %f percents durability", percent); // durability lost message - WorldPacket data2(SMSG_DURABILITY_DAMAGE_DEATH, 0); + WorldPacket data2(SMSG_DURABILITY_DAMAGE_DEATH, 4); + data2 << uint32(percent*100); GetSession()->SendPacket(&data2); } @@ -5391,7 +5393,7 @@ Corpse* Player::GetCorpse() const return sObjectAccessor->GetCorpseForPlayerGUID(GetGUID()); } -void Player::DurabilityLossAll(double percent, bool inventory) +void Player::DurabilityLossAll(double &percent, bool inventory) { for (uint8 i = EQUIPMENT_SLOT_START; i < EQUIPMENT_SLOT_END; i++) if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i)) @@ -5417,7 +5419,7 @@ void Player::DurabilityLossAll(double percent, bool inventory) } } -void Player::DurabilityLoss(Item* item, double percent) +void Player::DurabilityLoss(Item* item, double &percent) { if (!item) return; diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h index a594f2c02ef..a9ad919cd04 100755 --- a/src/server/game/Entities/Player/Player.h +++ b/src/server/game/Entities/Player/Player.h @@ -1994,8 +1994,8 @@ class Player : public Unit, public GridObject<Player> void BuildPlayerRepop(); void RepopAtGraveyard(); - void DurabilityLossAll(double percent, bool inventory); - void DurabilityLoss(Item* item, double percent); + void DurabilityLossAll(double &percent, bool inventory); + void DurabilityLoss(Item* item, double &percent); void DurabilityPointsLossAll(int32 points, bool inventory); void DurabilityPointsLoss(Item* item, int32 points); void DurabilityPointLossForEquipSlot(EquipmentSlots slot); diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index c25e4bf455b..6c310f594b9 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -15635,10 +15635,12 @@ void Unit::Kill(Unit* victim, bool durabilityLoss) // only if not player and not controlled by player pet. And not at BG if ((durabilityLoss && !player && !victim->ToPlayer()->InBattleground()) || (player && sWorld->getBoolConfig(CONFIG_DURABILITY_LOSS_IN_PVP))) { - sLog->outStaticDebug("We are dead, losing %f percent durability", sWorld->getRate(RATE_DURABILITY_LOSS_ON_DEATH)); - plrVictim->DurabilityLossAll(sWorld->getRate(RATE_DURABILITY_LOSS_ON_DEATH), false); + float percent = sWorld->getRate(RATE_DURABILITY_LOSS_ON_DEATH); + plrVictim->DurabilityLossAll(percent, false); + sLog->outStaticDebug("We are dead, losing %f percent durability", percent); // durability lost message - WorldPacket data(SMSG_DURABILITY_DAMAGE_DEATH, 0); + WorldPacket data(SMSG_DURABILITY_DAMAGE_DEATH, 4); + data << uint32(percent*100); plrVictim->GetSession()->SendPacket(&data); } // Call KilledUnit for creatures |
