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.
This commit is contained in:
Nay
2012-01-22 03:41:34 +00:00
parent 869961bd4e
commit bbdd2ee273
5 changed files with 16 additions and 12 deletions
+7 -5
View File
@@ -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;
+2 -2
View File
@@ -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);
+5 -3
View File
@@ -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
+1 -1
View File
@@ -762,7 +762,7 @@ void InitOpcodes()
//DEFINE_OPCODE_HANDLER(CMSG_SHOWING_CLOAK, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleShowingCloakOpcode );
DEFINE_OPCODE_HANDLER(SMSG_LFG_ROLE_CHOSEN, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
DEFINE_OPCODE_HANDLER(SMSG_PLAYER_SKINNED, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
//DEFINE_OPCODE_HANDLER(SMSG_DURABILITY_DAMAGE_DEATH, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
DEFINE_OPCODE_HANDLER(SMSG_DURABILITY_DAMAGE_DEATH, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
//DEFINE_OPCODE_HANDLER(CMSG_SET_EXPLORATION, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL );
DEFINE_OPCODE_HANDLER(CMSG_SET_ACTIONBAR_TOGGLES, STATUS_AUTHED, PROCESS_THREADUNSAFE, &WorldSession::HandleSetActionBarToggles );
//DEFINE_OPCODE_HANDLER(UMSG_DELETE_GUILD_CHARTER, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL );
+1 -1
View File
@@ -280,7 +280,7 @@ enum Opcodes
CMSG_MESSAGECHAT_PARTY_LEADER = 0x00,
CMSG_MESSAGECHAT_RAID = 0x60D1,
CMSG_MESSAGECHAT_RAID_LEADER = 0x00,
CMSG_MESSAGECHAT_RAID_WARNING = 0x00,
CMSG_MESSAGECHAT_RAID_WARNING = 0x2449,
CMSG_MESSAGECHAT_SAY = 0x2459,
CMSG_MESSAGECHAT_WHISPER = 0x70D9,
CMSG_MESSAGECHAT_YELL = 0x70C1,