aboutsummaryrefslogtreecommitdiff
path: root/src/game/Object.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/game/Object.cpp')
-rw-r--r--src/game/Object.cpp69
1 files changed, 17 insertions, 52 deletions
diff --git a/src/game/Object.cpp b/src/game/Object.cpp
index 71d922298dd..8b8bfec0c96 100644
--- a/src/game/Object.cpp
+++ b/src/game/Object.cpp
@@ -462,7 +462,7 @@ void Object::_BuildMovementUpdate(ByteBuffer * data, uint16 flags) const
// 0x80
if(flags & UPDATEFLAG_VEHICLE) // unused for now
{
- *data << uint32(((Vehicle*)this)->GetVehicleInfo()->m_ID); // vehicle id
+ *data << uint32(((Unit*)this)->GetVehicleKit()->GetVehicleInfo()->m_ID); // vehicle id
*data << float(0); // facing adjustment
}
@@ -1746,27 +1746,27 @@ void WorldObject::AddObjectToRemoveList()
map->AddObjectToRemoveList(this);
}
-TempSummon *Map::SummonCreature(uint32 entry, float x, float y, float z, float angle, SummonPropertiesEntry const *properties, uint32 duration, Unit *summoner)
+TempSummon *Map::SummonCreature(uint32 entry, float x, float y, float z, float angle, uint32 vehId, SummonPropertiesEntry const *properties, uint32 duration, Unit *summoner)
{
- uint32 mask = SUMMON_MASK_SUMMON;
+ uint32 mask = UNIT_MASK_SUMMON;
if(properties)
{
if(properties->Category == SUMMON_CATEGORY_PET
|| properties->Type == SUMMON_TYPE_GUARDIAN
|| properties->Type == SUMMON_TYPE_MINION)
- mask = SUMMON_MASK_GUARDIAN;
+ mask = UNIT_MASK_GUARDIAN;
else if(properties->Type == SUMMON_TYPE_TOTEM)
- mask = SUMMON_MASK_TOTEM;
+ mask = UNIT_MASK_TOTEM;
else if(properties->Category == SUMMON_CATEGORY_VEHICLE
|| properties->Type == SUMMON_TYPE_VEHICLE
|| properties->Type == SUMMON_TYPE_VEHICLE2)
- mask = SUMMON_MASK_VEHICLE;
+ mask = UNIT_MASK_VEHICLE;
else if(properties->Category == SUMMON_CATEGORY_PUPPET)
- mask = SUMMON_MASK_PUPPET;
+ mask = UNIT_MASK_PUPPET;
else if(properties->Type == SUMMON_TYPE_MINIPET)
- mask = SUMMON_MASK_MINION;
+ mask = UNIT_MASK_MINION;
else if (properties->Flags & 512) // Mirror Image, Summon Gargoyle
- mask = SUMMON_MASK_GUARDIAN;
+ mask = UNIT_MASK_GUARDIAN;
}
uint32 phase = PHASEMASK_NORMAL, team = 0;
@@ -1780,15 +1780,15 @@ TempSummon *Map::SummonCreature(uint32 entry, float x, float y, float z, float a
TempSummon *summon = NULL;
switch(mask)
{
- case SUMMON_MASK_SUMMON: summon = new TempSummon (properties, summoner); break;
- case SUMMON_MASK_GUARDIAN: summon = new Guardian (properties, summoner); break;
- case SUMMON_MASK_PUPPET: summon = new Puppet (properties, summoner); break;
- case SUMMON_MASK_TOTEM: summon = new Totem (properties, summoner); break;
- case SUMMON_MASK_MINION: summon = new Minion (properties, summoner); break;
+ case UNIT_MASK_SUMMON: summon = new TempSummon (properties, summoner); break;
+ case UNIT_MASK_GUARDIAN: summon = new Guardian (properties, summoner); break;
+ case UNIT_MASK_PUPPET: summon = new Puppet (properties, summoner); break;
+ case UNIT_MASK_TOTEM: summon = new Totem (properties, summoner); break;
+ case UNIT_MASK_MINION: summon = new Minion (properties, summoner); break;
default: return NULL;
}
- if(!summon->Create(objmgr.GenerateLowGuid(HIGHGUID_UNIT), this, phase, entry, team, x, y, z, angle))
+ if(!summon->Create(objmgr.GenerateLowGuid(HIGHGUID_UNIT), this, phase, entry, vehId, team, x, y, z, angle))
{
delete summon;
return NULL;
@@ -1816,7 +1816,7 @@ void WorldObject::SetZoneScript()
}
}
-TempSummon* WorldObject::SummonCreature(uint32 entry, float x, float y, float z, float ang, TempSummonType spwtype, uint32 duration)
+TempSummon* WorldObject::SummonCreature(uint32 entry, float x, float y, float z, float ang, uint32 vehId, TempSummonType spwtype, uint32 duration)
{
Map *map = FindMap();
if(!map)
@@ -1825,7 +1825,7 @@ TempSummon* WorldObject::SummonCreature(uint32 entry, float x, float y, float z,
if (x == 0.0f && y == 0.0f && z == 0.0f)
GetClosePoint(x, y, z, GetObjectSize());
- TempSummon *pCreature = map->SummonCreature(entry, x, y, z, ang, NULL, duration, isType(TYPEMASK_UNIT) ? (Unit*)this : NULL);
+ TempSummon *pCreature = map->SummonCreature(entry, x, y, z, ang, vehId, NULL, duration, isType(TYPEMASK_UNIT) ? (Unit*)this : NULL);
if(!pCreature)
return NULL;
@@ -1834,41 +1834,6 @@ TempSummon* WorldObject::SummonCreature(uint32 entry, float x, float y, float z,
return pCreature;
}
-Vehicle* WorldObject::SummonVehicle(uint32 entry, float x, float y, float z, float ang)
-{
- CreatureInfo const *ci = objmgr.GetCreatureTemplate(entry);
- if(!ci)
- return NULL;
-
- uint32 id = ci->VehicleId; //temp store id here
- if(!id) id = 156;
- VehicleEntry const *ve = sVehicleStore.LookupEntry(id);
- if(!ve)
- return NULL;
-
- Vehicle *v = new Vehicle;
- Map *map = GetMap();
- uint32 team = 0;
- if (GetTypeId()==TYPEID_PLAYER)
- team = ((Player*)this)->GetTeam();
- if(!v->Create(objmgr.GenerateLowGuid(HIGHGUID_VEHICLE), map, GetPhaseMask(), entry, id, team, x, y, z, ang))
- {
- delete v;
- return NULL;
- }
-
- if(isType(TYPEMASK_UNIT))
- {
- v->SetUInt64Value(UNIT_FIELD_SUMMONEDBY, GetGUID());
- //v->setFaction(((Unit*)this)->getFaction());
- }
- map->Add((Creature*)v);
-
- //ObjectAccessor::UpdateObjectVisibility(v);
-
- return v;
-}
-
Pet* Player::SummonPet(uint32 entry, float x, float y, float z, float ang, PetType petType, uint32 duration)
{
Pet* pet = new Pet(this, petType);