aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMachiavelli <machiavelli.trinity@gmail.com>2011-04-22 12:05:15 +0200
committerMachiavelli <machiavelli.trinity@gmail.com>2011-04-22 12:05:15 +0200
commitc9a917ad793bf2bfdde44f2ef3c498ba41d45c6a (patch)
tree7569d75d3fb7b6f36a149d7bf24a5f8f5274151d
parent5efda81319fcf1784f4a804f27741788564a8b71 (diff)
Core/Spells: Add a 'as-generic-as-possible' temporary fix for SummonProperties 2081 (Mechanical Dragonling, Arcanite Dragonling, Mithril Dragonling). For them, basepoints != amount of entities to spawn. Needs more research for the proper value
Small cleanup in affected function.
-rwxr-xr-xsrc/server/game/Spells/SpellEffects.cpp53
1 files changed, 18 insertions, 35 deletions
diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp
index a5fac405021..809abab18f8 100755
--- a/src/server/game/Spells/SpellEffects.cpp
+++ b/src/server/game/Spells/SpellEffects.cpp
@@ -3000,29 +3000,12 @@ void Spell::EffectSummonType(SpellEffIndex effIndex)
Position pos;
GetSummonPosition(effIndex, pos);
- /*//totem must be at same Z in case swimming caster and etc.
- if (fabs(z - m_caster->GetPositionZ()) > 5)
- z = m_caster->GetPositionZ();
-
- uint8 level = m_caster->getLevel();
-
- // level of creature summoned using engineering item based at engineering skill level
- if (m_caster->GetTypeId() == TYPEID_PLAYER && m_CastItem)
- {
- ItemPrototype const *proto = m_CastItem->GetProto();
- if (proto && proto->RequiredSkill == SKILL_ENGINERING)
- {
- uint16 skill202 = m_caster->ToPlayer()->GetSkillValue(SKILL_ENGINERING);
- if (skill202)
- level = skill202/5;
- }
- }*/
-
TempSummon *summon = NULL;
switch (properties->Category)
{
- default:
+ case SUMMON_CATEGORY_WILD:
+ case SUMMON_CATEGORY_ALLY:
if (properties->Flags & 512)
{
SummonGuardian(effIndex, entry, properties);
@@ -3036,6 +3019,7 @@ void Spell::EffectSummonType(SpellEffIndex effIndex)
case SUMMON_TYPE_MINION:
SummonGuardian(effIndex, entry, properties);
break;
+ // Summons a vehicle, but doesn't force anyone to enter it (see SUMMON_CATEGORY_VEHICLE)
case SUMMON_TYPE_VEHICLE:
case SUMMON_TYPE_VEHICLE2:
if (m_originalCaster)
@@ -3053,8 +3037,6 @@ void Spell::EffectSummonType(SpellEffIndex effIndex)
summon->SetHealth(damage);
}
- //summon->SetUInt32Value(UNIT_CREATED_BY_SPELL,m_spellInfo->Id);
-
if (m_originalCaster->GetTypeId() == TYPEID_PLAYER
&& properties->Slot >= SUMMON_SLOT_TOTEM
&& properties->Slot < MAX_TOTEM_SLOT)
@@ -3098,24 +3080,27 @@ void Spell::EffectSummonType(SpellEffIndex effIndex)
float radius = GetSpellRadiusForHostile(sSpellRadiusStore.LookupEntry(m_spellInfo->EffectRadiusIndex[effIndex]));
uint32 amount = damage > 0 ? damage : 1;
- if (m_spellInfo->Id == 18662) // Curse of Doom
+ if (m_spellInfo->Id == 18662 || // Curse of Doom
+ properties->Id == 2081) // Mechanical Dragonling, Arcanite Dragonling, Mithril Dragonling TODO: Research on meaning of basepoints
amount = 1;
+ TempSummonType summonType = (duration == 0) ? TEMPSUMMON_DEAD_DESPAWN : TEMPSUMMON_TIMED_DESPAWN;
+
for (uint32 count = 0; count < amount; ++count)
{
GetSummonPosition(effIndex, pos, radius, count);
- TempSummonType summonType = (duration == 0) ? TEMPSUMMON_DEAD_DESPAWN : TEMPSUMMON_TIMED_DESPAWN;
-
summon = m_originalCaster->SummonCreature(entry, pos, summonType, duration);
if (!summon)
continue;
+
if (properties->Category == SUMMON_CATEGORY_ALLY)
{
summon->SetUInt64Value(UNIT_FIELD_SUMMONEDBY, m_originalCaster->GetGUID());
summon->setFaction(m_originalCaster->getFaction());
summon->SetUInt32Value(UNIT_CREATED_BY_SPELL, m_spellInfo->Id);
}
+
ExecuteLogEffectSummonObject(effIndex, summon);
}
return;
@@ -3128,35 +3113,33 @@ void Spell::EffectSummonType(SpellEffIndex effIndex)
case SUMMON_CATEGORY_PUPPET:
summon = m_caster->GetMap()->SummonCreature(entry, pos, properties, duration, m_originalCaster);
break;
- case SUMMON_CATEGORY_VEHICLE:
- {
+ case SUMMON_CATEGORY_VEHICLE:
+ // Summoning spells (usually triggered by npc_spellclick) that spawn a vehicle and that cause the clicker
+ // to cast a ride vehicle spell on the summoned unit.
float x, y, z;
m_caster->GetClosePoint(x, y, z, DEFAULT_WORLD_OBJECT_SIZE);
summon = m_originalCaster->GetMap()->SummonCreature(entry, pos, properties, duration, m_caster);
if (!summon || !summon->IsVehicle())
return;
- if (m_spellInfo->EffectBasePoints[effIndex])
+ // The spell that this effect will trigger. It has SPELL_AURA_CONTROL_VEHICLE
+ uint32 spell = m_spellInfo->EffectBasePoints[effIndex];
+ if (spell)
{
SpellEntry const *spellProto = sSpellStore.LookupEntry(SpellMgr::CalculateSpellEffectAmount(m_spellInfo, effIndex));
- if (spellProto)
- {
- m_originalCaster->CastSpell(summon, spellProto, true);
- return;
- }
+ if (!spellProto)
+ spell = VEHICLE_SPELL_RIDE_HARDCODED;
}
// Hard coded enter vehicle spell
- m_originalCaster->CastSpell(summon, VEHICLE_SPELL_RIDE_HARDCODED, true);
+ m_originalCaster->CastSpell(summon, spell, true);
- summon->SetUInt32Value(UNIT_CREATED_BY_SPELL, m_spellInfo->Id);
uint32 faction = properties->Faction;
if (!faction)
faction = m_originalCaster->getFaction();
summon->setFaction(faction);
break;
- }
}
if (summon)