aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/game/Player.cpp48
-rw-r--r--src/game/Player.h1
-rw-r--r--src/game/Unit.cpp11
3 files changed, 36 insertions, 24 deletions
diff --git a/src/game/Player.cpp b/src/game/Player.cpp
index 61968fae0c4..d3af537026f 100644
--- a/src/game/Player.cpp
+++ b/src/game/Player.cpp
@@ -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)
diff --git a/src/game/Player.h b/src/game/Player.h
index fcf3b0b005e..c0d2483e1ef 100644
--- a/src/game/Player.h
+++ b/src/game/Player.h
@@ -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;
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index bf750be34f5..eb20ee91845 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -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);
}
}
}