aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rwxr-xr-xsrc/server/game/Groups/Group.cpp6
-rwxr-xr-xsrc/server/game/Scripting/MapScripts.cpp22
-rwxr-xr-xsrc/server/game/Spells/SpellEffects.cpp26
3 files changed, 27 insertions, 27 deletions
diff --git a/src/server/game/Groups/Group.cpp b/src/server/game/Groups/Group.cpp
index bb7b37c1eaf..0e47034fbf0 100755
--- a/src/server/game/Groups/Group.cpp
+++ b/src/server/game/Groups/Group.cpp
@@ -812,12 +812,12 @@ void Group::GroupLoot(Loot *loot, WorldObject* pLootedObject)
RollId.push_back(r);
- if (Creature* creature = dynamic_cast<Creature *>(pLootedObject))
+ if (Creature* creature = pLootedObject->ToCreature())
{
creature->m_groupLootTimer = 60000;
creature->lootingGroupLowGUID = GetLowGUID();
}
- else if (GameObject* go = dynamic_cast<GameObject *>(pLootedObject))
+ else if (GameObject* go = pLootedObject->ToGameObject())
{
go->m_groupLootTimer = 60000;
go->lootingGroupLowGUID = GetLowGUID();
@@ -903,7 +903,7 @@ void Group::NeedBeforeGreed(Loot *loot, WorldObject* pLootedObject)
RollId.push_back(r);
- if (Creature* creature = dynamic_cast<Creature *>(pLootedObject))
+ if (Creature* creature = pLootedObject->ToCreature())
{
creature->m_groupLootTimer = 60000;
creature->lootingGroupLowGUID = GetLowGUID();
diff --git a/src/server/game/Scripting/MapScripts.cpp b/src/server/game/Scripting/MapScripts.cpp
index 6ee95125fce..088e5eb1e75 100755
--- a/src/server/game/Scripting/MapScripts.cpp
+++ b/src/server/game/Scripting/MapScripts.cpp
@@ -163,7 +163,7 @@ inline Unit* Map::_GetScriptUnit(Object* obj, bool isSource, const ScriptInfo* s
scriptInfo->GetDebugInfo().c_str(), isSource ? "source" : "target", obj->GetTypeId(), obj->GetEntry(), obj->GetGUIDLow());
else
{
- pUnit = dynamic_cast<Unit*>(obj);
+ pUnit = obj->ToUnit();
if (!pUnit)
sLog->outError("%s %s object could not be casted to unit.",
scriptInfo->GetDebugInfo().c_str(), isSource ? "source" : "target");
@@ -257,7 +257,7 @@ inline void Map::_ScriptProcessDoor(Object* source, Object* target, const Script
if (target && target->isType(TYPEMASK_GAMEOBJECT))
{
- GameObject* goTarget = dynamic_cast<GameObject*>(target);
+ GameObject* goTarget = target->ToGameObject();
if (goTarget && goTarget->GetGoType() == GAMEOBJECT_TYPE_BUTTON)
goTarget->UseDoorOrButton(nTimeToToggle);
}
@@ -678,7 +678,7 @@ void Map::ScriptsProcess()
break;
}
- if (GameObject *pGO = dynamic_cast<GameObject*>(target))
+ if (GameObject *pGO = target->ToGameObject())
pGO->Use(pSource);
}
break;
@@ -707,24 +707,24 @@ void Map::ScriptsProcess()
switch (step.script->CastSpell.Flags)
{
case SF_CASTSPELL_SOURCE_TO_TARGET: // source -> target
- uSource = dynamic_cast<Unit*>(source);
- uTarget = dynamic_cast<Unit*>(target);
+ uSource = source ? source->ToUnit() : NULL;
+ uTarget = target ? target->ToUnit() : NULL;
break;
case SF_CASTSPELL_SOURCE_TO_SOURCE: // source -> source
- uSource = dynamic_cast<Unit*>(source);
+ uSource = source ? source->ToUnit() : NULL;
uTarget = uSource;
break;
case SF_CASTSPELL_TARGET_TO_TARGET: // target -> target
- uSource = dynamic_cast<Unit*>(target);
+ uSource = target ? target->ToUnit() : NULL;
uTarget = uSource;
break;
case SF_CASTSPELL_TARGET_TO_SOURCE: // target -> source
- uSource = dynamic_cast<Unit*>(target);
- uTarget = dynamic_cast<Unit*>(source);
+ uSource = target ? target->ToUnit() : NULL;
+ uTarget = source ? source->ToUnit() : NULL;
break;
case SF_CASTSPELL_SEARCH_CREATURE: // source -> creature with entry
- uSource = dynamic_cast<Unit*>(source);
- uTarget = GetClosestCreatureWithEntry(uSource, abs(step.script->CastSpell.CreatureEntry), step.script->CastSpell.SearchRadius);
+ uSource = source ? source->ToUnit() : NULL;
+ uTarget = uSource ? GetClosestCreatureWithEntry(uSource, abs(step.script->CastSpell.CreatureEntry), step.script->CastSpell.SearchRadius) : NULL;
break;
}
diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp
index 59dac535bae..52fe71f6c8a 100755
--- a/src/server/game/Spells/SpellEffects.cpp
+++ b/src/server/game/Spells/SpellEffects.cpp
@@ -4480,18 +4480,16 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex)
}
// Plant Warmaul Ogre Banner
case 32307:
- {
- Player* p_caster = dynamic_cast<Player*>(m_caster);
- if (!p_caster)
- break;
- p_caster->RewardPlayerAndGroupAtEvent(18388, unitTarget);
- Creature* cTarget = dynamic_cast<Creature*>(unitTarget);
- if (!cTarget)
- break;
- cTarget->setDeathState(CORPSE);
- cTarget->RemoveCorpse();
+ if (Player* caster = m_caster->ToPlayer()))
+ {
+ caster->RewardPlayerAndGroupAtEvent(18388, unitTarget);
+ if (Creature* target = unitTarget->ToCreature())
+ {
+ target->setDeathState(CORPSE);
+ target->RemoveCorpse();
+ }
+ }
break;
- }
case 48025: // Headless Horseman's Mount
{
if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER)
@@ -5076,8 +5074,10 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex)
{
if (Vehicle* seat = m_caster->GetVehicleKit())
{
- if (Creature* oldContainer = dynamic_cast<Creature*>(seat->GetPassenger(1)))
- oldContainer->DisappearAndDie();
+ if (Unit* passenger = seat->GetPassenger(1))
+ if (Creature* oldContainer = passenger->ToCreature())
+ oldContainer->DisappearAndDie();
+
// TODO: a hack, range = 11, should after some time cast, otherwise too far
m_caster->CastSpell(seat->GetBase(), 62496, true);
unitTarget->EnterVehicle(m_caster, 1);