*Fix some summon vehicle spells.

--HG--
branch : trunk
This commit is contained in:
megamage
2009-08-24 12:54:36 -05:00
parent 675cac9a6b
commit a029ae15e5
6 changed files with 28 additions and 38 deletions
+1 -1
View File
@@ -179,7 +179,7 @@ Creature *ScriptedAI::DoSummonFlyer(uint32 uiEntry, WorldObject *obj, float _fZ,
{ {
float fX, fY, fZ; float fX, fY, fZ;
obj->GetGroundPointAroundUnit(fX, fY, fZ, fRadius * rand_norm(), rand_norm()*2*M_PI); obj->GetGroundPointAroundUnit(fX, fY, fZ, fRadius * rand_norm(), rand_norm()*2*M_PI);
return me->SummonCreature(uiEntry, fX, fY, _fZ, me->GetOrientation(), uiType, uiDespawntime); return me->SummonCreature(uiEntry, fX, fY, fZ + _fZ, me->GetOrientation(), uiType, uiDespawntime);
} }
+4 -3
View File
@@ -1757,10 +1757,11 @@ TempSummon *Map::SummonCreature(uint32 entry, float x, float y, float z, float a
mask = UNIT_MASK_GUARDIAN; mask = UNIT_MASK_GUARDIAN;
else if(properties->Type == SUMMON_TYPE_TOTEM) else if(properties->Type == SUMMON_TYPE_TOTEM)
mask = UNIT_MASK_TOTEM; mask = UNIT_MASK_TOTEM;
else if(properties->Category == SUMMON_CATEGORY_VEHICLE else if(properties->Category == SUMMON_CATEGORY_VEHICLE)
|| properties->Type == SUMMON_TYPE_VEHICLE mask = UNIT_MASK_MINION;
else if(properties->Type == SUMMON_TYPE_VEHICLE
|| properties->Type == SUMMON_TYPE_VEHICLE2) || properties->Type == SUMMON_TYPE_VEHICLE2)
mask = UNIT_MASK_VEHICLE; mask = UNIT_MASK_SUMMON;
else if(properties->Category == SUMMON_CATEGORY_PUPPET) else if(properties->Category == SUMMON_CATEGORY_PUPPET)
mask = UNIT_MASK_PUPPET; mask = UNIT_MASK_PUPPET;
else if(properties->Type == SUMMON_TYPE_MINIPET) else if(properties->Type == SUMMON_TYPE_MINIPET)
+6 -22
View File
@@ -3411,21 +3411,9 @@ void Spell::EffectSummonType(uint32 i)
break; break;
case SUMMON_TYPE_VEHICLE: case SUMMON_TYPE_VEHICLE:
case SUMMON_TYPE_VEHICLE2: case SUMMON_TYPE_VEHICLE2:
{ if(m_originalCaster)
if(!m_originalCaster) summon = m_caster->GetMap()->SummonCreature(entry, x, y, z, m_caster->GetOrientation(), 0, properties, duration, m_originalCaster);
return;
Creature *vehicle = m_originalCaster->SummonCreature(entry, x, y, z, 0, 0);
if(!vehicle)
return;
// this is for wintergrasp, need to find a better way
// in the future, we can just use getsummoner
vehicle->SetUInt64Value(UNIT_FIELD_SUMMONEDBY, m_originalCasterGUID);
vehicle->setFaction(m_originalCaster->getFaction());
vehicle->SetUInt32Value(UNIT_CREATED_BY_SPELL, m_spellInfo->Id);
break; break;
}
case SUMMON_TYPE_TOTEM: case SUMMON_TYPE_TOTEM:
{ {
summon = m_caster->GetMap()->SummonCreature(entry, x, y, z, m_caster->GetOrientation(), 0, properties, duration, m_originalCaster); summon = m_caster->GetMap()->SummonCreature(entry, x, y, z, m_caster->GetOrientation(), 0, properties, duration, m_originalCaster);
@@ -3511,17 +3499,13 @@ void Spell::EffectSummonType(uint32 i)
{ {
float x, y, z; float x, y, z;
m_caster->GetClosePoint(x, y, z, DEFAULT_WORLD_OBJECT_SIZE); m_caster->GetClosePoint(x, y, z, DEFAULT_WORLD_OBJECT_SIZE);
Creature *vehicle = m_caster->SummonCreature(entry, x, y, z, m_caster->GetOrientation(), 0); summon = m_caster->GetMap()->SummonCreature(entry, x, y, z, m_caster->GetOrientation(), 0, properties, duration, m_caster);
if(!vehicle || !vehicle->IsVehicle()) if(!summon || !summon->IsVehicle())
return; return;
vehicle->SetUInt64Value(UNIT_FIELD_SUMMONEDBY, m_caster->GetGUID());
vehicle->setFaction(m_caster->getFaction());
vehicle->SetUInt32Value(UNIT_CREATED_BY_SPELL, m_spellInfo->Id);
if(damage) if(damage)
m_caster->CastSpell(vehicle, damage, true); m_caster->CastSpell(summon, damage, true);
m_caster->EnterVehicle(vehicle->GetVehicleKit()); m_caster->EnterVehicle(summon->GetVehicleKit());
break; break;
} }
} }
+12 -10
View File
@@ -205,6 +205,8 @@ void TempSummon::InitStats(uint32 duration)
if(m_Properties->Faction) if(m_Properties->Faction)
setFaction(m_Properties->Faction); setFaction(m_Properties->Faction);
else if(IsVehicle()) // properties should be vehicle
setFaction(owner->getFaction());
} }
void TempSummon::InitSummon() void TempSummon::InitSummon()
@@ -287,16 +289,6 @@ void Minion::InitStats(uint32 duration)
m_owner->SetMinion(this, true); m_owner->SetMinion(this, true);
} }
void Minion::InitSummon()
{
TempSummon::InitSummon();
if(m_owner->GetTypeId() == TYPEID_PLAYER
&& m_owner->GetMinionGUID() == GetGUID()
&& !m_owner->GetCharmGUID())
((Player*)m_owner)->CharmSpellInitialize();
}
void Minion::RemoveFromWorld() void Minion::RemoveFromWorld()
{ {
if(!IsInWorld()) if(!IsInWorld())
@@ -329,6 +321,16 @@ void Guardian::InitStats(uint32 duration)
SetReactState(REACT_AGGRESSIVE); SetReactState(REACT_AGGRESSIVE);
} }
void Guardian::InitSummon()
{
TempSummon::InitSummon();
if(m_owner->GetTypeId() == TYPEID_PLAYER
&& m_owner->GetMinionGUID() == GetGUID()
&& !m_owner->GetCharmGUID())
((Player*)m_owner)->CharmSpellInitialize();
}
Puppet::Puppet(SummonPropertiesEntry const *properties, Unit *owner) : Minion(properties, owner) Puppet::Puppet(SummonPropertiesEntry const *properties, Unit *owner) : Minion(properties, owner)
{ {
assert(owner->GetTypeId() == TYPEID_PLAYER); assert(owner->GetTypeId() == TYPEID_PLAYER);
+1 -1
View File
@@ -51,7 +51,6 @@ class Minion : public TempSummon
public: public:
Minion(SummonPropertiesEntry const *properties, Unit *owner); Minion(SummonPropertiesEntry const *properties, Unit *owner);
void InitStats(uint32 duration); void InitStats(uint32 duration);
void InitSummon();
void RemoveFromWorld(); void RemoveFromWorld();
Unit *GetOwner() { return m_owner; } Unit *GetOwner() { return m_owner; }
float GetFollowAngle() const { return m_followAngle; } float GetFollowAngle() const { return m_followAngle; }
@@ -68,6 +67,7 @@ class Guardian : public Minion
Guardian(SummonPropertiesEntry const *properties, Unit *owner); Guardian(SummonPropertiesEntry const *properties, Unit *owner);
void InitStats(uint32 duration); void InitStats(uint32 duration);
bool InitStatsForLevel(uint32 level); bool InitStatsForLevel(uint32 level);
void InitSummon();
bool UpdateStats(Stats stat); bool UpdateStats(Stats stat);
bool UpdateAllStats(); bool UpdateAllStats();
+4 -1
View File
@@ -353,6 +353,9 @@ void OPvPWintergrasp::OnCreatureCreate(Creature *creature, bool add)
{ {
case CREATURE_SIEGE_VEHICLE: case CREATURE_SIEGE_VEHICLE:
{ {
if(!creature->isSummon())
return;
TeamId team; TeamId team;
if(creature->getFaction() == WintergraspFaction[TEAM_ALLIANCE]) if(creature->getFaction() == WintergraspFaction[TEAM_ALLIANCE])
team = TEAM_ALLIANCE; team = TEAM_ALLIANCE;
@@ -361,7 +364,7 @@ void OPvPWintergrasp::OnCreatureCreate(Creature *creature, bool add)
else else
return; return;
if(uint32 engLowguid = GUID_LOPART(creature->GetOwnerGUID())) if(uint32 engLowguid = GUID_LOPART(((TempSummon*)creature)->GetSummonerGUID()))
{ {
if(SiegeWorkshop *workshop = GetWorkshopByEngGuid(engLowguid)) if(SiegeWorkshop *workshop = GetWorkshopByEngGuid(engLowguid))
{ {