diff options
author | Machiavelli <machiavelli.trinity@gmail.com> | 2011-05-27 17:30:26 +0200 |
---|---|---|
committer | Machiavelli <machiavelli.trinity@gmail.com> | 2011-05-27 17:31:31 +0200 |
commit | 48b0570f53337380465bc8de1a3919dd1f45e7b0 (patch) | |
tree | e042b880c944d801c2fa00c7392045089a2ec1ef | |
parent | 65fc7f7a28b55aa668619d0985da6e8f6fd2499e (diff) |
Core/Vehicles:
- Temporarily unsummon pets when entering vehicle and resummon them when exiting. Also fixes missing pet cast bars on exit.
- Correct SMSG_PET_SPELLS packet for vehicle spell initialize
-rwxr-xr-x | src/server/game/Entities/Player/Player.cpp | 43 | ||||
-rwxr-xr-x | src/server/game/Entities/Unit/Unit.cpp | 10 |
2 files changed, 41 insertions, 12 deletions
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 49648235e37..45e2a36f348 100755 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -19384,11 +19384,17 @@ void Player::VehicleSpellInitialize() if (!veh) return; - WorldPacket data(SMSG_PET_SPELLS, 8 + 2 + 4 + 4 + 4 * 10 + 1 + 1 + 4 + 10); // last 10 is just 10 bytes with unknown meaning + + uint8 cooldownCount = veh->m_CreatureSpellCooldowns.size() + veh->m_CreatureCategoryCooldowns.size(); + + WorldPacket data(SMSG_PET_SPELLS, 8 + 2 + 4 + 4 + 4 * 10 + 1 + 1 + cooldownCount * (4 + 2 + 4 + 4)); data << uint64(veh->GetGUID()); data << uint16(veh->GetCreatureInfo()->family); data << uint32(0); - data << uint32(0x00000101); + // The following three segments are read as one uint32 + data << uint8(veh->GetReactState()); + data << uint8(0); // CommandState? + data << uint16(0); // unk for (uint32 i = 0; i < CREATURE_MAX_SPELLS; ++i) { @@ -19420,13 +19426,34 @@ void Player::VehicleSpellInitialize() data << uint16(0) << uint8(0) << uint8(i+8); data << uint8(0); - data << uint8(0); - data << uint32(0); // some spell id (unk meaning) + /*if (v23 > 0) + { + for (uint32 i = 0; i < v23; ++i) + data << uint32(v16); // Some spellid? + }*/ + + // Cooldowns + data << cooldownCount; - // there are 10 more bytes here so just append them here - // their meaning or true layout is unknown - for (uint32 i = 0; i < 10; ++i) - data << uint8(0); + time_t now = sWorld->GetGameTime(); + CreatureSpellCooldowns::const_iterator itr; + for (itr = veh->m_CreatureSpellCooldowns.begin(); itr != veh->m_CreatureSpellCooldowns.end(); ++itr) + { + time_t cooldown = (itr->second > now) ? (itr->second - now) * IN_MILLISECONDS : 0; + data << uint32(itr->first); // SpellId + data << uint16(0); // unk + data << uint32(cooldown); // spell cooldown + data << uint32(0); // category cooldown + } + + for (itr = veh->m_CreatureCategoryCooldowns.begin(); itr != veh->m_CreatureCategoryCooldowns.end(); ++itr) + { + time_t cooldown = (itr->second > now) ? (itr->second - now) * IN_MILLISECONDS : 0; + data << uint32(itr->first); // SpellId + data << uint16(0); // unk + data << uint32(0); // spell cooldown + data << uint32(cooldown); // category cooldown + } GetSession()->SendPacket(&data); } diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index ba229647131..301d7ddd7d8 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -16833,12 +16833,11 @@ void Unit::_EnterVehicle(Vehicle* vehicle, int8 seatId, AuraApplication const* a // drop flag at invisible in bg if (Battleground *bg = plr->GetBattleground()) bg->EventPlayerDroppedFlag(plr); - } - if (Player* thisPlr = this->ToPlayer()) - { WorldPacket data(SMSG_ON_CANCEL_EXPECTED_RIDE_VEHICLE_AURA, 0); - thisPlr->GetSession()->SendPacket(&data); + plr->GetSession()->SendPacket(&data); + + plr->UnsummonPetTemporaryIfAny(); } ASSERT(!m_vehicle); @@ -16912,6 +16911,9 @@ void Unit::_ExitVehicle(Position const* exitPosition) SendMonsterMoveExitVehicle(&pos); Relocate(&pos); + if (Player* plr = ToPlayer()) + plr->ResummonPetTemporaryUnSummonedIfAny(); + WorldPacket data2; BuildHeartBeatMsg(&data2); SendMessageToSet(&data2, false); |