*Init spells for vehicles.
--HG-- branch : trunk
This commit is contained in:
+33
-15
@@ -17367,6 +17367,38 @@ void Player::PossessSpellInitialize()
|
||||
GetSession()->SendPacket(&data);
|
||||
}
|
||||
|
||||
void Player::VehicleSpellInitialize()
|
||||
{
|
||||
Unit* charm = GetCharm();
|
||||
if(!charm || charm->GetTypeId() != TYPEID_UNIT)
|
||||
return;
|
||||
|
||||
WorldPacket data(SMSG_PET_SPELLS, 8+4+4+4+4*10+1+1);
|
||||
data << uint64(charm->GetGUID());
|
||||
data << uint32(0x00000000);
|
||||
data << uint32(0x00000000);
|
||||
data << uint32(0x00000101);
|
||||
|
||||
for(uint32 i = 0; i < CREATURE_MAX_SPELLS; ++i)
|
||||
{
|
||||
uint32 spellId = ((Creature*)charm)->m_spells[i];
|
||||
if(IsPassiveSpell(spellId))
|
||||
{
|
||||
charm->CastSpell(charm, spellId, true);
|
||||
data << uint16(0) << uint8(0) << uint8(i+8);
|
||||
}
|
||||
else
|
||||
data << uint16(spellId) << uint8(0) << uint8(i+8);
|
||||
}
|
||||
|
||||
for(uint32 i = CREATURE_MAX_SPELLS; i < 10; ++i)
|
||||
data << uint16(0) << uint8(0) << uint8(i+8);
|
||||
|
||||
data << uint8(0);
|
||||
data << uint8(0);
|
||||
GetSession()->SendPacket(&data);
|
||||
}
|
||||
|
||||
void Player::CharmSpellInitialize()
|
||||
{
|
||||
Unit* charm = GetCharm();
|
||||
@@ -20302,21 +20334,7 @@ void Player::EnterVehicle(Vehicle *vehicle)
|
||||
data << uint32(0); // fall time
|
||||
GetSession()->SendPacket(&data);
|
||||
|
||||
data.Initialize(SMSG_PET_SPELLS, 8+4+4+4+4*10+1+1);
|
||||
data << uint64(vehicle->GetGUID());
|
||||
data << uint32(0x00000000);
|
||||
data << uint32(0x00000000);
|
||||
data << uint32(0x00000101);
|
||||
|
||||
for(uint32 i = 0; i < CREATURE_MAX_SPELLS; ++i)
|
||||
data << uint16(vehicle->m_spells[i]) << uint8(0) << uint8(i+8);
|
||||
|
||||
for(uint32 i = CREATURE_MAX_SPELLS; i < 10; ++i)
|
||||
data << uint16(0) << uint8(0) << uint8(i+8);
|
||||
|
||||
data << uint8(0);
|
||||
data << uint8(0);
|
||||
GetSession()->SendPacket(&data);
|
||||
VehicleSpellInitialize();
|
||||
}
|
||||
|
||||
void Player::ExitVehicle(Vehicle *vehicle)
|
||||
|
||||
@@ -1454,6 +1454,7 @@ class TRINITY_DLL_SPEC Player : public Unit
|
||||
void PetSpellInitialize();
|
||||
void CharmSpellInitialize();
|
||||
void PossessSpellInitialize();
|
||||
void VehicleSpellInitialize();
|
||||
bool HasSpell(uint32 spell) const;
|
||||
bool HasActiveSpell(uint32 spell) const; // show in spellbook
|
||||
TrainerSpellState GetTrainerSpellState(TrainerSpell const* trainer_spell) const;
|
||||
|
||||
+2
-9
@@ -11435,20 +11435,13 @@ void CharmInfo::InitPossessCreateSpells()
|
||||
InitEmptyActionBar();
|
||||
if(m_unit->GetTypeId() == TYPEID_UNIT)
|
||||
{
|
||||
/*for(uint32 i = 0; i < CREATURE_MAX_SPELLS; ++i)
|
||||
for(uint32 i = 0; i < CREATURE_MAX_SPELLS; ++i)
|
||||
{
|
||||
uint32 spellid = ((Creature*)m_unit)->m_spells[i];
|
||||
if(IsPassiveSpell(spellid))
|
||||
m_unit->CastSpell(m_unit, spellid, true);
|
||||
else
|
||||
AddSpellToAB(0, spellid, ACT_CAST);
|
||||
}*/
|
||||
for(uint32 x = 0; x < CREATURE_MAX_SPELLS; ++x)
|
||||
{
|
||||
if (IsPassiveSpell(((Creature*)m_unit)->m_spells[x]))
|
||||
m_unit->CastSpell(m_unit, ((Creature*)m_unit)->m_spells[x], true);
|
||||
else
|
||||
AddSpellToAB(0, ((Creature*)m_unit)->m_spells[x], ACT_PASSIVE);
|
||||
AddSpellToAB(0, spellid, ACT_DISABLED);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user