aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormegamage <none@none>2009-08-24 12:54:36 -0500
committermegamage <none@none>2009-08-24 12:54:36 -0500
commita029ae15e597bc3a1b07aa5b8802a86201cb10fd (patch)
tree2bc409c69bb870354c71bb35f18d2d0e31431605
parent675cac9a6bfb2f64eca38152e6f4fb5ec79701e8 (diff)
*Fix some summon vehicle spells.
--HG-- branch : trunk
-rw-r--r--src/bindings/scripts/include/sc_creature.cpp2
-rw-r--r--src/game/Object.cpp7
-rw-r--r--src/game/SpellEffects.cpp28
-rw-r--r--src/game/TemporarySummon.cpp22
-rw-r--r--src/game/TemporarySummon.h2
-rw-r--r--src/game/Wintergrasp.cpp5
6 files changed, 28 insertions, 38 deletions
diff --git a/src/bindings/scripts/include/sc_creature.cpp b/src/bindings/scripts/include/sc_creature.cpp
index 89c996c6589..fe644b85a60 100644
--- a/src/bindings/scripts/include/sc_creature.cpp
+++ b/src/bindings/scripts/include/sc_creature.cpp
@@ -179,7 +179,7 @@ Creature *ScriptedAI::DoSummonFlyer(uint32 uiEntry, WorldObject *obj, float _fZ,
{
float fX, fY, fZ;
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);
}
diff --git a/src/game/Object.cpp b/src/game/Object.cpp
index 8b8bfec0c96..e6027f6d5a4 100644
--- a/src/game/Object.cpp
+++ b/src/game/Object.cpp
@@ -1757,10 +1757,11 @@ TempSummon *Map::SummonCreature(uint32 entry, float x, float y, float z, float a
mask = UNIT_MASK_GUARDIAN;
else if(properties->Type == SUMMON_TYPE_TOTEM)
mask = UNIT_MASK_TOTEM;
- else if(properties->Category == SUMMON_CATEGORY_VEHICLE
- || properties->Type == SUMMON_TYPE_VEHICLE
+ else if(properties->Category == SUMMON_CATEGORY_VEHICLE)
+ mask = UNIT_MASK_MINION;
+ else if(properties->Type == SUMMON_TYPE_VEHICLE
|| properties->Type == SUMMON_TYPE_VEHICLE2)
- mask = UNIT_MASK_VEHICLE;
+ mask = UNIT_MASK_SUMMON;
else if(properties->Category == SUMMON_CATEGORY_PUPPET)
mask = UNIT_MASK_PUPPET;
else if(properties->Type == SUMMON_TYPE_MINIPET)
diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp
index d3a49bcba2e..a34ec67d9c9 100644
--- a/src/game/SpellEffects.cpp
+++ b/src/game/SpellEffects.cpp
@@ -3411,21 +3411,9 @@ void Spell::EffectSummonType(uint32 i)
break;
case SUMMON_TYPE_VEHICLE:
case SUMMON_TYPE_VEHICLE2:
- {
- if(!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);
+ if(m_originalCaster)
+ summon = m_caster->GetMap()->SummonCreature(entry, x, y, z, m_caster->GetOrientation(), 0, properties, duration, m_originalCaster);
break;
- }
case SUMMON_TYPE_TOTEM:
{
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;
m_caster->GetClosePoint(x, y, z, DEFAULT_WORLD_OBJECT_SIZE);
- Creature *vehicle = m_caster->SummonCreature(entry, x, y, z, m_caster->GetOrientation(), 0);
- if(!vehicle || !vehicle->IsVehicle())
+ summon = m_caster->GetMap()->SummonCreature(entry, x, y, z, m_caster->GetOrientation(), 0, properties, duration, m_caster);
+ if(!summon || !summon->IsVehicle())
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)
- m_caster->CastSpell(vehicle, damage, true);
- m_caster->EnterVehicle(vehicle->GetVehicleKit());
+ m_caster->CastSpell(summon, damage, true);
+ m_caster->EnterVehicle(summon->GetVehicleKit());
break;
}
}
diff --git a/src/game/TemporarySummon.cpp b/src/game/TemporarySummon.cpp
index ab7ebbcca3e..75d34ed2f3b 100644
--- a/src/game/TemporarySummon.cpp
+++ b/src/game/TemporarySummon.cpp
@@ -205,6 +205,8 @@ void TempSummon::InitStats(uint32 duration)
if(m_Properties->Faction)
setFaction(m_Properties->Faction);
+ else if(IsVehicle()) // properties should be vehicle
+ setFaction(owner->getFaction());
}
void TempSummon::InitSummon()
@@ -287,16 +289,6 @@ void Minion::InitStats(uint32 duration)
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()
{
if(!IsInWorld())
@@ -329,6 +321,16 @@ void Guardian::InitStats(uint32 duration)
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)
{
assert(owner->GetTypeId() == TYPEID_PLAYER);
diff --git a/src/game/TemporarySummon.h b/src/game/TemporarySummon.h
index aa4650a02c9..3fd960fc4e3 100644
--- a/src/game/TemporarySummon.h
+++ b/src/game/TemporarySummon.h
@@ -51,7 +51,6 @@ class Minion : public TempSummon
public:
Minion(SummonPropertiesEntry const *properties, Unit *owner);
void InitStats(uint32 duration);
- void InitSummon();
void RemoveFromWorld();
Unit *GetOwner() { return m_owner; }
float GetFollowAngle() const { return m_followAngle; }
@@ -68,6 +67,7 @@ class Guardian : public Minion
Guardian(SummonPropertiesEntry const *properties, Unit *owner);
void InitStats(uint32 duration);
bool InitStatsForLevel(uint32 level);
+ void InitSummon();
bool UpdateStats(Stats stat);
bool UpdateAllStats();
diff --git a/src/game/Wintergrasp.cpp b/src/game/Wintergrasp.cpp
index 70f3c23acc2..dd9d5eb99da 100644
--- a/src/game/Wintergrasp.cpp
+++ b/src/game/Wintergrasp.cpp
@@ -353,6 +353,9 @@ void OPvPWintergrasp::OnCreatureCreate(Creature *creature, bool add)
{
case CREATURE_SIEGE_VEHICLE:
{
+ if(!creature->isSummon())
+ return;
+
TeamId team;
if(creature->getFaction() == WintergraspFaction[TEAM_ALLIANCE])
team = TEAM_ALLIANCE;
@@ -361,7 +364,7 @@ void OPvPWintergrasp::OnCreatureCreate(Creature *creature, bool add)
else
return;
- if(uint32 engLowguid = GUID_LOPART(creature->GetOwnerGUID()))
+ if(uint32 engLowguid = GUID_LOPART(((TempSummon*)creature)->GetSummonerGUID()))
{
if(SiegeWorkshop *workshop = GetWorkshopByEngGuid(engLowguid))
{