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
This commit is contained in:
Machiavelli
2011-05-27 17:31:31 +02:00
parent 65fc7f7a28
commit 48b0570f53
2 changed files with 41 additions and 12 deletions
+35 -8
View File
@@ -19384,11 +19384,17 @@ void Player::VehicleSpellInitialize()
if (!veh) if (!veh)
return; 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 << uint64(veh->GetGUID());
data << uint16(veh->GetCreatureInfo()->family); data << uint16(veh->GetCreatureInfo()->family);
data << uint32(0); 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) 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 << uint16(0) << uint8(0) << uint8(i+8);
data << uint8(0); data << uint8(0);
data << uint8(0); /*if (v23 > 0)
data << uint32(0); // some spell id (unk meaning) {
for (uint32 i = 0; i < v23; ++i)
data << uint32(v16); // Some spellid?
}*/
// there are 10 more bytes here so just append them here // Cooldowns
// their meaning or true layout is unknown data << cooldownCount;
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); GetSession()->SendPacket(&data);
} }
+6 -4
View File
@@ -16833,12 +16833,11 @@ void Unit::_EnterVehicle(Vehicle* vehicle, int8 seatId, AuraApplication const* a
// drop flag at invisible in bg // drop flag at invisible in bg
if (Battleground *bg = plr->GetBattleground()) if (Battleground *bg = plr->GetBattleground())
bg->EventPlayerDroppedFlag(plr); bg->EventPlayerDroppedFlag(plr);
}
if (Player* thisPlr = this->ToPlayer())
{
WorldPacket data(SMSG_ON_CANCEL_EXPECTED_RIDE_VEHICLE_AURA, 0); WorldPacket data(SMSG_ON_CANCEL_EXPECTED_RIDE_VEHICLE_AURA, 0);
thisPlr->GetSession()->SendPacket(&data); plr->GetSession()->SendPacket(&data);
plr->UnsummonPetTemporaryIfAny();
} }
ASSERT(!m_vehicle); ASSERT(!m_vehicle);
@@ -16912,6 +16911,9 @@ void Unit::_ExitVehicle(Position const* exitPosition)
SendMonsterMoveExitVehicle(&pos); SendMonsterMoveExitVehicle(&pos);
Relocate(&pos); Relocate(&pos);
if (Player* plr = ToPlayer())
plr->ResummonPetTemporaryUnSummonedIfAny();
WorldPacket data2; WorldPacket data2;
BuildHeartBeatMsg(&data2); BuildHeartBeatMsg(&data2);
SendMessageToSet(&data2, false); SendMessageToSet(&data2, false);