Some Creature* casts moved to new ToCreature.
Added const Creature* ToCreature() --HG-- branch : trunk
This commit is contained in:
@@ -47,7 +47,7 @@ void CreatureAI::DoZoneInCombat(Creature* creature)
|
||||
Map *map = creature->GetMap();
|
||||
if (!map->IsDungeon()) //use IsDungeon instead of Instanceable, in case battlegrounds will be instantiated
|
||||
{
|
||||
sLog.outError("DoZoneInCombat call for map that isn't an instance (creature entry = %d)", creature->GetTypeId() == TYPEID_UNIT ? ((Creature*)creature)->GetEntry() : 0);
|
||||
sLog.outError("DoZoneInCombat call for map that isn't an instance (creature entry = %d)", creature->GetTypeId() == TYPEID_UNIT ? creature->ToCreature()->GetEntry() : 0);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -267,7 +267,7 @@ bool CreatureEventAI::ProcessEvent(CreatureEventAIHolder& pHolder, Unit* pAction
|
||||
return false;
|
||||
|
||||
//Creature id doesn't match up
|
||||
if (((Creature*)pActionInvoker)->GetEntry() != event.summon_unit.creatureId)
|
||||
if (pActionInvoker->ToCreature()->GetEntry() != event.summon_unit.creatureId)
|
||||
return false;
|
||||
|
||||
//Repeat Timers
|
||||
|
||||
@@ -797,7 +797,7 @@ bool ChatHandler::HandleDebugSpawnVehicle(const char* args)
|
||||
return false;
|
||||
}
|
||||
|
||||
map->Add((Creature*)v);
|
||||
map->Add(v->ToCreature());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -420,7 +420,7 @@ void TimedFleeingMovementGenerator::Finalize(Unit &owner)
|
||||
if (owner.isAlive())
|
||||
{
|
||||
owner.AttackStop();
|
||||
((Creature*)&owner)->AI()->AttackStart(victim);
|
||||
owner.ToCreature()->AI()->AttackStart(victim);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -1557,7 +1557,7 @@ bool Group::InCombatToInstance(uint32 instanceId)
|
||||
Player *pPlayer = itr->getSource();
|
||||
if(pPlayer && pPlayer->getAttackers().size() && pPlayer->GetInstanceId() == instanceId && (pPlayer->GetMap()->IsRaidOrHeroicDungeon()))
|
||||
for (std::set<Unit*>::const_iterator i = pPlayer->getAttackers().begin(); i!=pPlayer->getAttackers().end(); ++i)
|
||||
if((*i) && (*i)->GetTypeId() == TYPEID_UNIT && ((Creature*)(*i))->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_INSTANCE_BIND)
|
||||
if((*i) && (*i)->GetTypeId() == TYPEID_UNIT && (*i)->ToCreature()->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_INSTANCE_BIND)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -80,7 +80,7 @@ void RotateMovementGenerator::Finalize(Unit &unit)
|
||||
{
|
||||
unit.clearUnitState(UNIT_STAT_ROTATING);
|
||||
if(unit.GetTypeId() == TYPEID_UNIT)
|
||||
((Creature*)&unit)->AI()->MovementInform(ROTATE_MOTION_TYPE, 0);
|
||||
unit.ToCreature()->AI()->MovementInform(ROTATE_MOTION_TYPE, 0);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -109,5 +109,5 @@ void
|
||||
AssistanceDistractMovementGenerator::Finalize(Unit &unit)
|
||||
{
|
||||
unit.clearUnitState(UNIT_STAT_DISTRACTED);
|
||||
((Creature*)&unit)->SetReactState(REACT_AGGRESSIVE);
|
||||
unit.ToCreature()->SetReactState(REACT_AGGRESSIVE);
|
||||
}
|
||||
|
||||
+1
-1
@@ -1464,7 +1464,7 @@ bool ChatHandler::HandleModifyTalentCommand (const char* args)
|
||||
target->ToPlayer()->SendTalentsInfoData(false);
|
||||
return true;
|
||||
}
|
||||
else if(((Creature*)target)->isPet())
|
||||
else if(target->ToCreature()->isPet())
|
||||
{
|
||||
Unit *owner = target->GetOwner();
|
||||
if(owner && owner->GetTypeId() == TYPEID_PLAYER && ((Pet *)target)->IsPermanentPetFor(owner->ToPlayer()))
|
||||
|
||||
+2
-2
@@ -1746,7 +1746,7 @@ bool ChatHandler::HandleNpcTameCommand(const char* /*args*/)
|
||||
pet->SetUInt32Value(UNIT_FIELD_LEVEL, level - 1);
|
||||
|
||||
// add to world
|
||||
pet->GetMap()->Add((Creature*)pet);
|
||||
pet->GetMap()->Add(pet->ToCreature());
|
||||
|
||||
// visual effect for levelup
|
||||
pet->SetUInt32Value(UNIT_FIELD_LEVEL, level);
|
||||
@@ -3957,7 +3957,7 @@ bool ChatHandler::HandleCreatePetCommand(const char* args)
|
||||
pet->InitPetCreateSpells();
|
||||
pet->SetHealth(pet->GetMaxHealth());
|
||||
|
||||
pet->GetMap()->Add((Creature*)pet);
|
||||
pet->GetMap()->Add(pet->ToCreature());
|
||||
|
||||
// visual effect for levelup
|
||||
pet->SetUInt32Value(UNIT_FIELD_LEVEL,creatureTarget->getLevel());
|
||||
|
||||
+2
-2
@@ -4544,7 +4544,7 @@ bool ChatHandler::HandleNpcChangeEntryCommand(const char *args)
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
Creature* creature = (Creature*)unit;
|
||||
Creature* creature = unit->ToCreature();
|
||||
if(creature->UpdateEntry(newEntryNum))
|
||||
SendSysMessage(LANG_DONE);
|
||||
else
|
||||
@@ -6182,7 +6182,7 @@ bool ChatHandler::HandleRespawnCommand(const char* /*args*/)
|
||||
}
|
||||
|
||||
if(target->isDead())
|
||||
((Creature*)target)->Respawn();
|
||||
target->ToCreature()->Respawn();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
+10
-10
@@ -2250,8 +2250,8 @@ void Map::RemoveAllObjectsInRemoveList()
|
||||
switch(obj->GetTypeId())
|
||||
{
|
||||
case TYPEID_UNIT:
|
||||
if(!((Creature*)obj)->isPet())
|
||||
SwitchGridContainers((Creature*)obj, on);
|
||||
if(!obj->ToCreature()->isPet())
|
||||
SwitchGridContainers(obj->ToCreature(), on);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -2282,8 +2282,8 @@ void Map::RemoveAllObjectsInRemoveList()
|
||||
case TYPEID_UNIT:
|
||||
// in case triggered sequence some spell can continue casting after prev CleanupsBeforeDelete call
|
||||
// make sure that like sources auras/etc removed before destructor start
|
||||
((Creature*)obj)->CleanupsBeforeDelete();
|
||||
Remove((Creature*)obj,true);
|
||||
obj->ToCreature()->CleanupsBeforeDelete();
|
||||
Remove(obj->ToCreature(),true);
|
||||
break;
|
||||
default:
|
||||
sLog.outError("Non-grid object (TypeId: %u) in grid object removing list, ignored.",obj->GetTypeId());
|
||||
@@ -3093,8 +3093,8 @@ void Map::ScriptsProcess()
|
||||
sLog.outError("SCRIPT_COMMAND_MOVE_TO call for non-creature (TypeId: %u, Entry: %u, GUID: %u), skipping.",source->GetTypeId(),source->GetEntry(),source->GetGUIDLow());
|
||||
break;
|
||||
}
|
||||
((Creature*)source)->SendMonsterMoveWithSpeed(step.script->x, step.script->y, step.script->z, step.script->datalong2 );
|
||||
((Creature*)source)->GetMap()->CreatureRelocation(((Creature*)source), step.script->x, step.script->y, step.script->z, 0);
|
||||
source->ToCreature()->SendMonsterMoveWithSpeed(step.script->x, step.script->y, step.script->z, step.script->datalong2 );
|
||||
source->ToCreature()->GetMap()->CreatureRelocation((source->ToCreature()), step.script->x, step.script->y, step.script->z, 0);
|
||||
break;
|
||||
case SCRIPT_COMMAND_FLAG_SET:
|
||||
if(!source)
|
||||
@@ -3631,15 +3631,15 @@ void Map::ScriptsProcess()
|
||||
|
||||
case SCRIPT_COMMAND_KILL:
|
||||
{
|
||||
if(!source || ((Creature*)source)->isDead())
|
||||
if(!source || source->ToCreature()->isDead())
|
||||
break;
|
||||
|
||||
((Creature*)source)->DealDamage(((Creature*)source), ((Creature*)source)->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
|
||||
source->ToCreature()->DealDamage((source->ToCreature()), source->ToCreature()->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
|
||||
|
||||
switch(step.script->dataint)
|
||||
{
|
||||
case 0: break; //return false not remove corpse
|
||||
case 1: ((Creature*)source)->RemoveCorpse(); break;
|
||||
case 1: source->ToCreature()->RemoveCorpse(); break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -3716,7 +3716,7 @@ Map::GetCreature(uint64 guid)
|
||||
{
|
||||
Creature * ret = NULL;
|
||||
if(IS_CRE_OR_VEH_GUID(guid))
|
||||
ret = ObjectAccessor::GetObjectInWorld(guid, (Creature*)NULL);
|
||||
ret = ObjectAccessor::GetObjectInWorld(guid, (Creature*)NULL);
|
||||
|
||||
if(!ret)
|
||||
return NULL;
|
||||
|
||||
@@ -58,7 +58,7 @@ void MotionMaster::InitDefault()
|
||||
{
|
||||
if(i_owner->GetTypeId() == TYPEID_UNIT)
|
||||
{
|
||||
MovementGenerator* movement = FactorySelector::selectMovementGenerator((Creature*)i_owner);
|
||||
MovementGenerator* movement = FactorySelector::selectMovementGenerator(i_owner->ToCreature());
|
||||
Mutate(movement == NULL ? &si_idleMovement : movement, MOTION_SLOT_IDLE);
|
||||
}
|
||||
else
|
||||
@@ -244,7 +244,7 @@ MotionMaster::MoveChase(Unit* target, float dist, float angle)
|
||||
DEBUG_LOG("Player (GUID: %u) chase to %s (GUID: %u)",
|
||||
i_owner->GetGUIDLow(),
|
||||
target->GetTypeId() == TYPEID_PLAYER ? "player" : "creature",
|
||||
target->GetTypeId() == TYPEID_PLAYER ? i_owner->GetGUIDLow() : ((Creature*)i_owner)->GetDBTableGUIDLow());
|
||||
target->GetTypeId() == TYPEID_PLAYER ? i_owner->GetGUIDLow() : i_owner->ToCreature()->GetDBTableGUIDLow());
|
||||
Mutate(new TargetedMovementGenerator<Player>(*target,dist,angle), MOTION_SLOT_ACTIVE);
|
||||
}
|
||||
else
|
||||
@@ -252,7 +252,7 @@ MotionMaster::MoveChase(Unit* target, float dist, float angle)
|
||||
DEBUG_LOG("Creature (Entry: %u GUID: %u) chase to %s (GUID: %u)",
|
||||
i_owner->GetEntry(), i_owner->GetGUIDLow(),
|
||||
target->GetTypeId() == TYPEID_PLAYER ? "player" : "creature",
|
||||
target->GetTypeId() == TYPEID_PLAYER ? target->GetGUIDLow() : ((Creature*)target)->GetDBTableGUIDLow());
|
||||
target->GetTypeId() == TYPEID_PLAYER ? target->GetGUIDLow() : target->ToCreature()->GetDBTableGUIDLow());
|
||||
Mutate(new TargetedMovementGenerator<Creature>(*target,dist,angle), MOTION_SLOT_ACTIVE);
|
||||
}
|
||||
}
|
||||
@@ -269,7 +269,7 @@ MotionMaster::MoveFollow(Unit* target, float dist, float angle, MovementSlot slo
|
||||
{
|
||||
DEBUG_LOG("Player (GUID: %u) follow to %s (GUID: %u)", i_owner->GetGUIDLow(),
|
||||
target->GetTypeId() == TYPEID_PLAYER ? "player" : "creature",
|
||||
target->GetTypeId() == TYPEID_PLAYER ? i_owner->GetGUIDLow() : ((Creature*)i_owner)->GetDBTableGUIDLow());
|
||||
target->GetTypeId() == TYPEID_PLAYER ? i_owner->GetGUIDLow() : i_owner->ToCreature()->GetDBTableGUIDLow());
|
||||
Mutate(new TargetedMovementGenerator<Player>(*target,dist,angle), slot);
|
||||
}
|
||||
else
|
||||
@@ -277,7 +277,7 @@ MotionMaster::MoveFollow(Unit* target, float dist, float angle, MovementSlot slo
|
||||
DEBUG_LOG("Creature (Entry: %u GUID: %u) follow to %s (GUID: %u)",
|
||||
i_owner->GetEntry(), i_owner->GetGUIDLow(),
|
||||
target->GetTypeId() == TYPEID_PLAYER ? "player" : "creature",
|
||||
target->GetTypeId() == TYPEID_PLAYER ? target->GetGUIDLow() : ((Creature*)target)->GetDBTableGUIDLow());
|
||||
target->GetTypeId() == TYPEID_PLAYER ? target->GetGUIDLow() : target->ToCreature()->GetDBTableGUIDLow());
|
||||
Mutate(new TargetedMovementGenerator<Creature>(*target,dist,angle), slot);
|
||||
}
|
||||
}
|
||||
@@ -385,7 +385,7 @@ MotionMaster::MoveSeekAssistance(float x, float y, float z)
|
||||
DEBUG_LOG("Creature (Entry: %u GUID: %u) seek assistance (X: %f Y: %f Z: %f)",
|
||||
i_owner->GetEntry(), i_owner->GetGUIDLow(), x, y, z );
|
||||
i_owner->AttackStop();
|
||||
((Creature*)i_owner)->SetReactState(REACT_PASSIVE);
|
||||
i_owner->ToCreature()->SetReactState(REACT_PASSIVE);
|
||||
Mutate(new AssistanceMovementGenerator(x,y,z), MOTION_SLOT_ACTIVE);
|
||||
}
|
||||
}
|
||||
@@ -418,7 +418,7 @@ MotionMaster::MoveFleeing(Unit* enemy, uint32 time)
|
||||
{
|
||||
DEBUG_LOG("Player (GUID: %u) flee from %s (GUID: %u)", i_owner->GetGUIDLow(),
|
||||
enemy->GetTypeId() == TYPEID_PLAYER ? "player" : "creature",
|
||||
enemy->GetTypeId() == TYPEID_PLAYER ? enemy->GetGUIDLow() : ((Creature*)enemy)->GetDBTableGUIDLow() );
|
||||
enemy->GetTypeId() == TYPEID_PLAYER ? enemy->GetGUIDLow() : enemy->ToCreature()->GetDBTableGUIDLow() );
|
||||
Mutate(new FleeingMovementGenerator<Player>(enemy->GetGUID()), MOTION_SLOT_CONTROLLED);
|
||||
}
|
||||
else
|
||||
@@ -426,7 +426,7 @@ MotionMaster::MoveFleeing(Unit* enemy, uint32 time)
|
||||
DEBUG_LOG("Creature (Entry: %u GUID: %u) flee from %s (GUID: %u)%s",
|
||||
i_owner->GetEntry(), i_owner->GetGUIDLow(),
|
||||
enemy->GetTypeId() == TYPEID_PLAYER ? "player" : "creature",
|
||||
enemy->GetTypeId() == TYPEID_PLAYER ? enemy->GetGUIDLow() : ((Creature*)enemy)->GetDBTableGUIDLow(),
|
||||
enemy->GetTypeId() == TYPEID_PLAYER ? enemy->GetGUIDLow() : enemy->ToCreature()->GetDBTableGUIDLow(),
|
||||
time ? " for a limited time" : "");
|
||||
if (time)
|
||||
Mutate(new TimedFleeingMovementGenerator(enemy->GetGUID(), time), MOTION_SLOT_CONTROLLED);
|
||||
|
||||
+9
-9
@@ -416,7 +416,7 @@ void Object::_BuildMovementUpdate(ByteBuffer * data, uint16 flags) const
|
||||
break;
|
||||
case TYPEID_UNIT:
|
||||
{
|
||||
if(((Creature*)this)->canFly())
|
||||
if(this->ToCreature()->canFly())
|
||||
flags |= MOVEMENTFLAG_LEVITATING;
|
||||
|
||||
*data << uint32(0x0000000B); // unk, can be 0xB or 0xC
|
||||
@@ -535,12 +535,12 @@ void Object::_BuildValuesUpdate(uint8 updatetype, ByteBuffer * data, UpdateMask
|
||||
|
||||
if (GetTypeId() == TYPEID_UNIT)
|
||||
{
|
||||
if (!target->canSeeSpellClickOn((Creature*)this))
|
||||
if (!target->canSeeSpellClickOn(this->ToCreature()))
|
||||
appendValue &= ~UNIT_NPC_FLAG_SPELLCLICK;
|
||||
|
||||
if (appendValue & UNIT_NPC_FLAG_TRAINER)
|
||||
{
|
||||
if (!((Creature*)this)->isCanTrainingOf(target, false))
|
||||
if (!this->ToCreature()->isCanTrainingOf(target, false))
|
||||
appendValue &= ~(UNIT_NPC_FLAG_TRAINER | UNIT_NPC_FLAG_TRAINER_CLASS | UNIT_NPC_FLAG_TRAINER_PROFESSION);
|
||||
}
|
||||
}
|
||||
@@ -579,7 +579,7 @@ void Object::_BuildValuesUpdate(uint8 updatetype, ByteBuffer * data, UpdateMask
|
||||
{
|
||||
if(GetTypeId() == TYPEID_UNIT)
|
||||
{
|
||||
const CreatureInfo* cinfo = ((Creature*)this)->GetCreatureInfo();
|
||||
const CreatureInfo* cinfo = this->ToCreature()->GetCreatureInfo();
|
||||
if(cinfo->flags_extra & CREATURE_FLAG_EXTRA_TRIGGER)
|
||||
{
|
||||
if(target->isGameMaster())
|
||||
@@ -608,7 +608,7 @@ void Object::_BuildValuesUpdate(uint8 updatetype, ByteBuffer * data, UpdateMask
|
||||
{
|
||||
if(GetTypeId() == TYPEID_UNIT)
|
||||
{
|
||||
if(!target->isAllowedToLoot((Creature*)this))
|
||||
if(!target->isAllowedToLoot(const_cast<Creature*>(this->ToCreature())))
|
||||
*data << (m_uint32Values[ index ] & ~UNIT_DYNFLAG_LOOTABLE);
|
||||
else
|
||||
*data << (m_uint32Values[ index ] & ~UNIT_DYNFLAG_TAPPED);
|
||||
@@ -1147,14 +1147,14 @@ void WorldObject::setActive( bool on )
|
||||
if(on)
|
||||
{
|
||||
if(GetTypeId() == TYPEID_UNIT)
|
||||
map->AddToActive((Creature*)this);
|
||||
map->AddToActive(this->ToCreature());
|
||||
else if(GetTypeId() == TYPEID_DYNAMICOBJECT)
|
||||
map->AddToActive((DynamicObject*)this);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(GetTypeId() == TYPEID_UNIT)
|
||||
map->RemoveFromActive((Creature*)this);
|
||||
map->RemoveFromActive(this->ToCreature());
|
||||
else if(GetTypeId() == TYPEID_DYNAMICOBJECT)
|
||||
map->RemoveFromActive((DynamicObject*)this);
|
||||
}
|
||||
@@ -1758,7 +1758,7 @@ TempSummon *Map::SummonCreature(uint32 entry, const Position &pos, SummonPropert
|
||||
summon->SetHomePosition(pos);
|
||||
|
||||
summon->InitStats(duration);
|
||||
Add((Creature*)summon);
|
||||
Add(summon->ToCreature());
|
||||
summon->InitSummon();
|
||||
|
||||
//ObjectAccessor::UpdateObjectVisibility(summon);
|
||||
@@ -1864,7 +1864,7 @@ Pet* Player::SummonPet(uint32 entry, float x, float y, float z, float ang, PetTy
|
||||
break;
|
||||
}
|
||||
|
||||
map->Add((Creature*)pet);
|
||||
map->Add(pet->ToCreature());
|
||||
|
||||
switch(petType)
|
||||
{
|
||||
|
||||
@@ -321,6 +321,7 @@ class Object
|
||||
Player* ToPlayer(){ if(GetTypeId() == TYPEID_PLAYER) return reinterpret_cast<Player*>(this); else return NULL; }
|
||||
const Player* ToPlayer() const { if(GetTypeId() == TYPEID_PLAYER) return (const Player*)((Player*)this); else return NULL; }
|
||||
Creature* ToCreature(){ if(GetTypeId() == TYPEID_UNIT) return reinterpret_cast<Creature*>(this); else return NULL; }
|
||||
const Creature* ToCreature() const {if(GetTypeId() == TYPEID_UNIT) return (const Creature*)((Creature*)this); else return NULL; }
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
+2
-2
@@ -191,7 +191,7 @@ bool Pet::LoadPetFromDB( Player* owner, uint32 petentry, uint32 petnumber, bool
|
||||
CreatureInfo const *cinfo = GetCreatureInfo();
|
||||
if (cinfo->type == CREATURE_TYPE_CRITTER)
|
||||
{
|
||||
map->Add((Creature*)this);
|
||||
map->Add(this->ToCreature());
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -286,7 +286,7 @@ bool Pet::LoadPetFromDB( Player* owner, uint32 petentry, uint32 petnumber, bool
|
||||
}
|
||||
|
||||
owner->SetMinion(this, true);
|
||||
map->Add((Creature*)this);
|
||||
map->Add(this->ToCreature());
|
||||
|
||||
m_resetTalentsCost = fields[15].GetUInt32();
|
||||
m_resetTalentsTime = fields[16].GetUInt64();
|
||||
|
||||
+15
-15
@@ -151,17 +151,17 @@ void WorldSession::HandlePetActionHelper(Unit *pet, uint64 guid1, uint16 spellid
|
||||
if (pet->getVictim())
|
||||
pet->AttackStop();
|
||||
|
||||
if(pet->GetTypeId() != TYPEID_PLAYER && ((Creature*)pet)->IsAIEnabled)
|
||||
if(pet->GetTypeId() != TYPEID_PLAYER && pet->ToCreature()->IsAIEnabled)
|
||||
{
|
||||
charmInfo->SetIsCommandAttack(true);
|
||||
charmInfo->SetIsAtStay(false);
|
||||
charmInfo->SetIsFollowing(false);
|
||||
charmInfo->SetIsReturning(false);
|
||||
|
||||
((Creature*)pet)->AI()->AttackStart(TargetUnit);
|
||||
pet->ToCreature()->AI()->AttackStart(TargetUnit);
|
||||
|
||||
//10% chance to play special pet attack talk, else growl
|
||||
if(((Creature*)pet)->isPet() && ((Pet*)pet)->getPetType() == SUMMON_PET && pet != TargetUnit && urand(0, 100) < 10)
|
||||
if(pet->ToCreature()->isPet() && ((Pet*)pet)->getPetType() == SUMMON_PET && pet != TargetUnit && urand(0, 100) < 10)
|
||||
pet->SendPetTalk((uint32)PET_TALK_ATTACK);
|
||||
else
|
||||
{
|
||||
@@ -218,7 +218,7 @@ void WorldSession::HandlePetActionHelper(Unit *pet, uint64 guid1, uint16 spellid
|
||||
case REACT_DEFENSIVE: //recovery
|
||||
case REACT_AGGRESSIVE: //activete
|
||||
if(pet->GetTypeId() == TYPEID_UNIT)
|
||||
((Creature*)pet)->SetReactState( ReactStates(spellid) );
|
||||
pet->ToCreature()->SetReactState( ReactStates(spellid) );
|
||||
break;
|
||||
}
|
||||
break;
|
||||
@@ -240,7 +240,7 @@ void WorldSession::HandlePetActionHelper(Unit *pet, uint64 guid1, uint16 spellid
|
||||
}
|
||||
|
||||
if (spellInfo->StartRecoveryCategory > 0)
|
||||
if (((Creature*)pet)->GetGlobalCooldown() > 0)
|
||||
if (pet->ToCreature()->GetGlobalCooldown() > 0)
|
||||
return;
|
||||
|
||||
for (uint32 i = 0; i < 3; ++i)
|
||||
@@ -290,13 +290,13 @@ void WorldSession::HandlePetActionHelper(Unit *pet, uint64 guid1, uint16 spellid
|
||||
|
||||
if(result == SPELL_CAST_OK)
|
||||
{
|
||||
((Creature*)pet)->AddCreatureSpellCooldown(spellid);
|
||||
pet->ToCreature()->AddCreatureSpellCooldown(spellid);
|
||||
|
||||
unit_target = spell->m_targets.getUnitTarget();
|
||||
|
||||
//10% chance to play special pet attack talk, else growl
|
||||
//actually this only seems to happen on special spells, fire shield for imp, torment for voidwalker, but it's stupid to check every spell
|
||||
if(((Creature*)pet)->isPet() && (((Pet*)pet)->getPetType() == SUMMON_PET) && (pet != unit_target) && (urand(0, 100) < 10))
|
||||
if(pet->ToCreature()->isPet() && (((Pet*)pet)->getPetType() == SUMMON_PET) && (pet != unit_target) && (urand(0, 100) < 10))
|
||||
pet->SendPetTalk((uint32)PET_TALK_SPECIAL_SPELL);
|
||||
else
|
||||
{
|
||||
@@ -311,8 +311,8 @@ void WorldSession::HandlePetActionHelper(Unit *pet, uint64 guid1, uint16 spellid
|
||||
if (pet->getVictim())
|
||||
pet->AttackStop();
|
||||
pet->GetMotionMaster()->Clear();
|
||||
if (((Creature*)pet)->IsAIEnabled)
|
||||
((Creature*)pet)->AI()->AttackStart(unit_target);
|
||||
if (pet->ToCreature()->IsAIEnabled)
|
||||
pet->ToCreature()->AI()->AttackStart(unit_target);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -325,7 +325,7 @@ void WorldSession::HandlePetActionHelper(Unit *pet, uint64 guid1, uint16 spellid
|
||||
else
|
||||
pet->SendPetCastFail(spellid, result);
|
||||
|
||||
if(!((Creature*)pet)->HasSpellCooldown(spellid))
|
||||
if(!pet->ToCreature()->HasSpellCooldown(spellid))
|
||||
GetPlayer()->SendClearCooldown(spellid, pet);
|
||||
|
||||
spell->finish(false);
|
||||
@@ -478,7 +478,7 @@ void WorldSession::HandlePetSetAction( WorldPacket & recv_data )
|
||||
//sign for autocast
|
||||
if(act_state == ACT_ENABLED && spell_id)
|
||||
{
|
||||
if(pet->GetTypeId() == TYPEID_UNIT && ((Creature*)pet)->isPet())
|
||||
if(pet->GetTypeId() == TYPEID_UNIT && pet->ToCreature()->isPet())
|
||||
((Pet*)pet)->ToggleAutocast(spell_id, true);
|
||||
else
|
||||
charmInfo->ToggleCreatureAutocast(spell_id, true);
|
||||
@@ -486,7 +486,7 @@ void WorldSession::HandlePetSetAction( WorldPacket & recv_data )
|
||||
//sign for no/turn off autocast
|
||||
else if(act_state == ACT_DISABLED && spell_id)
|
||||
{
|
||||
if(pet->GetTypeId() == TYPEID_UNIT && ((Creature*)pet)->isPet())
|
||||
if(pet->GetTypeId() == TYPEID_UNIT && pet->ToCreature()->isPet())
|
||||
((Pet*)pet)->ToggleAutocast(spell_id, false);
|
||||
else
|
||||
charmInfo->ToggleCreatureAutocast(spell_id, false);
|
||||
@@ -702,7 +702,7 @@ void WorldSession::HandlePetCastSpellOpcode( WorldPacket& recvPacket )
|
||||
}
|
||||
|
||||
if (spellInfo->StartRecoveryCategory > 0) //Check if spell is affected by GCD
|
||||
if (caster->GetTypeId() == TYPEID_UNIT && ((Creature*)caster)->GetGlobalCooldown() > 0)
|
||||
if (caster->GetTypeId() == TYPEID_UNIT && caster->ToCreature()->GetGlobalCooldown() > 0)
|
||||
{
|
||||
caster->SendPetCastFail(spellid, SPELL_FAILED_NOT_READY);
|
||||
return;
|
||||
@@ -732,7 +732,7 @@ void WorldSession::HandlePetCastSpellOpcode( WorldPacket& recvPacket )
|
||||
{
|
||||
if(caster->GetTypeId() == TYPEID_UNIT)
|
||||
{
|
||||
Creature* pet = (Creature*)caster;
|
||||
Creature* pet = caster->ToCreature();
|
||||
pet->AddCreatureSpellCooldown(spellid);
|
||||
if(pet->isPet())
|
||||
{
|
||||
@@ -758,7 +758,7 @@ void WorldSession::HandlePetCastSpellOpcode( WorldPacket& recvPacket )
|
||||
}
|
||||
else
|
||||
{
|
||||
if(!((Creature*)caster)->HasSpellCooldown(spellid))
|
||||
if(!caster->ToCreature()->HasSpellCooldown(spellid))
|
||||
GetPlayer()->SendClearCooldown(spellid, caster);
|
||||
}
|
||||
|
||||
|
||||
+24
-24
@@ -5530,7 +5530,7 @@ void Player::UpdateWeaponSkill (WeaponAttackType attType)
|
||||
if(m_form == FORM_TREE)
|
||||
return; // use weapon but not skill up
|
||||
|
||||
if(pVictim && pVictim->GetTypeId() == TYPEID_UNIT && (((Creature*)pVictim)->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_NO_SKILLGAIN))
|
||||
if(pVictim && pVictim->GetTypeId() == TYPEID_UNIT && (pVictim->ToCreature()->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_NO_SKILLGAIN))
|
||||
return;
|
||||
|
||||
uint32 weapon_skill_gain = sWorld.getConfig(CONFIG_SKILL_GAIN_WEAPON);
|
||||
@@ -6207,10 +6207,10 @@ void Player::RewardReputation(Unit *pVictim, float rate)
|
||||
if(!pVictim || pVictim->GetTypeId() == TYPEID_PLAYER)
|
||||
return;
|
||||
|
||||
if(((Creature*)pVictim)->IsReputationGainDisabled())
|
||||
if(pVictim->ToCreature()->IsReputationGainDisabled())
|
||||
return;
|
||||
|
||||
ReputationOnKillEntry const* Rep = objmgr.GetReputationOnKilEntry(((Creature*)pVictim)->GetCreatureInfo()->Entry);
|
||||
ReputationOnKillEntry const* Rep = objmgr.GetReputationOnKilEntry(pVictim->ToCreature()->GetCreatureInfo()->Entry);
|
||||
|
||||
if(!Rep)
|
||||
return;
|
||||
@@ -13033,7 +13033,7 @@ void Player::PrepareGossipMenu(WorldObject *pSource, uint32 menuId)
|
||||
|
||||
if (pSource->GetTypeId() == TYPEID_UNIT)
|
||||
{
|
||||
Creature *pCreature = (Creature*)pSource;
|
||||
Creature *pCreature = pSource->ToCreature();
|
||||
|
||||
uint32 npcflags = pCreature->GetUInt32Value(UNIT_NPC_FLAGS);
|
||||
|
||||
@@ -13181,7 +13181,7 @@ void Player::SendPreparedGossip(WorldObject *pSource)
|
||||
if (pSource->GetTypeId() == TYPEID_UNIT)
|
||||
{
|
||||
// in case no gossip flag and quest menu not empty, open quest menu (client expect gossip menu with this flag)
|
||||
if (!((Creature*)pSource)->HasFlag(UNIT_NPC_FLAGS,UNIT_NPC_FLAG_GOSSIP) && !PlayerTalkClass->GetQuestMenu().Empty())
|
||||
if (!pSource->ToCreature()->HasFlag(UNIT_NPC_FLAGS,UNIT_NPC_FLAG_GOSSIP) && !PlayerTalkClass->GetQuestMenu().Empty())
|
||||
{
|
||||
SendPreparedQuest(pSource->GetGUID());
|
||||
return;
|
||||
@@ -13260,7 +13260,7 @@ void Player::OnGossipSelect(WorldObject* pSource, uint32 gossipListId, uint32 me
|
||||
break;
|
||||
case GOSSIP_OPTION_SPIRITHEALER:
|
||||
if (isDead())
|
||||
((Creature*)pSource)->CastSpell(((Creature*)pSource),17251,true,NULL,NULL,GetGUID());
|
||||
pSource->ToCreature()->CastSpell((pSource->ToCreature()),17251,true,NULL,NULL,GetGUID());
|
||||
break;
|
||||
case GOSSIP_OPTION_QUESTGIVER:
|
||||
PrepareQuestMenu(guid);
|
||||
@@ -13308,7 +13308,7 @@ void Player::OnGossipSelect(WorldObject* pSource, uint32 gossipListId, uint32 me
|
||||
SendPetSkillWipeConfirm();
|
||||
break;
|
||||
case GOSSIP_OPTION_TAXIVENDOR:
|
||||
GetSession()->SendTaxiMenu(((Creature*)pSource));
|
||||
GetSession()->SendTaxiMenu((pSource->ToCreature()));
|
||||
break;
|
||||
case GOSSIP_OPTION_INNKEEPER:
|
||||
PlayerTalkClass->CloseGossip();
|
||||
@@ -13326,7 +13326,7 @@ void Player::OnGossipSelect(WorldObject* pSource, uint32 gossipListId, uint32 me
|
||||
GetSession()->SendTabardVendorActivate(guid);
|
||||
break;
|
||||
case GOSSIP_OPTION_AUCTIONEER:
|
||||
GetSession()->SendAuctionHello(guid, ((Creature*)pSource));
|
||||
GetSession()->SendAuctionHello(guid, (pSource->ToCreature()));
|
||||
break;
|
||||
case GOSSIP_OPTION_SPIRITGUIDE:
|
||||
PrepareGossipMenu(pSource);
|
||||
@@ -13350,10 +13350,10 @@ void Player::OnGossipSelect(WorldObject* pSource, uint32 gossipListId, uint32 me
|
||||
|
||||
uint32 Player::GetGossipTextId(WorldObject *pSource)
|
||||
{
|
||||
if (!pSource || pSource->GetTypeId() != TYPEID_UNIT || !((Creature*)pSource)->GetDBTableGUIDLow())
|
||||
if (!pSource || pSource->GetTypeId() != TYPEID_UNIT || !pSource->ToCreature()->GetDBTableGUIDLow())
|
||||
return DEFAULT_GOSSIP_MESSAGE;
|
||||
|
||||
if (uint32 pos = objmgr.GetNpcGossip(((Creature*)pSource)->GetDBTableGUIDLow()))
|
||||
if (uint32 pos = objmgr.GetNpcGossip(pSource->ToCreature()->GetDBTableGUIDLow()))
|
||||
return pos;
|
||||
|
||||
return DEFAULT_GOSSIP_MESSAGE;
|
||||
@@ -13380,7 +13380,7 @@ uint32 Player::GetGossipTextId(uint32 menuId)
|
||||
uint32 Player::GetDefaultGossipMenuForSource(WorldObject *pSource)
|
||||
{
|
||||
if (pSource->GetTypeId() == TYPEID_UNIT)
|
||||
return ((Creature*)pSource)->GetCreatureInfo()->GossipMenuId;
|
||||
return pSource->ToCreature()->GetCreatureInfo()->GossipMenuId;
|
||||
else if (pSource->GetTypeId() == TYPEID_GAMEOBJECT)
|
||||
return((GameObject*)pSource)->GetGOInfo()->GetGossipMenuId();
|
||||
|
||||
@@ -18048,7 +18048,7 @@ void Player::StopCastingCharm()
|
||||
|
||||
if(charm->GetTypeId() == TYPEID_UNIT)
|
||||
{
|
||||
if(((Creature*)charm)->HasUnitTypeMask(UNIT_MASK_PUPPET))
|
||||
if(charm->ToCreature()->HasUnitTypeMask(UNIT_MASK_PUPPET))
|
||||
((Puppet*)charm)->UnSummon();
|
||||
else if(charm->IsVehicle())
|
||||
ExitVehicle();
|
||||
@@ -18278,7 +18278,7 @@ void Player::VehicleSpellInitialize()
|
||||
|
||||
for (uint32 i = 0; i < CREATURE_MAX_SPELLS; ++i)
|
||||
{
|
||||
uint32 spellId = ((Creature*)veh)->m_spells[i];
|
||||
uint32 spellId = veh->ToCreature()->m_spells[i];
|
||||
if(!spellId)
|
||||
continue;
|
||||
|
||||
@@ -18319,7 +18319,7 @@ void Player::CharmSpellInitialize()
|
||||
uint8 addlist = 0;
|
||||
if(charm->GetTypeId() != TYPEID_PLAYER)
|
||||
{
|
||||
CreatureInfo const *cinfo = ((Creature*)charm)->GetCreatureInfo();
|
||||
CreatureInfo const *cinfo = charm->ToCreature()->GetCreatureInfo();
|
||||
//if(cinfo && cinfo->type == CREATURE_TYPE_DEMON && getClass() == CLASS_WARLOCK)
|
||||
{
|
||||
for (uint32 i = 0; i < MAX_SPELL_CHARM; ++i)
|
||||
@@ -18336,7 +18336,7 @@ void Player::CharmSpellInitialize()
|
||||
data << uint32(0);
|
||||
|
||||
if(charm->GetTypeId() != TYPEID_PLAYER)
|
||||
data << uint8(((Creature*)charm)->GetReactState()) << uint8(charmInfo->GetCommandState()) << uint16(0);
|
||||
data << uint8(charm->ToCreature()->GetReactState()) << uint8(charmInfo->GetCommandState()) << uint16(0);
|
||||
else
|
||||
data << uint8(0) << uint8(0) << uint16(0);
|
||||
|
||||
@@ -20069,7 +20069,7 @@ inline void BeforeVisibilityDestroy(T* /*t*/, Player* /*p*/)
|
||||
template<>
|
||||
inline void BeforeVisibilityDestroy<Creature>(Creature* t, Player* p)
|
||||
{
|
||||
if (p->GetPetGUID()==t->GetGUID() && ((Creature*)t)->isPet())
|
||||
if (p->GetPetGUID()==t->GetGUID() && t->ToCreature()->isPet())
|
||||
((Pet*)t)->Remove(PET_SAVE_NOT_IN_SLOT, true);
|
||||
}
|
||||
|
||||
@@ -20080,7 +20080,7 @@ void Player::UpdateVisibilityOf(WorldObject* target)
|
||||
if(!target->isVisibleForInState(this, true))
|
||||
{
|
||||
if (target->GetTypeId()==TYPEID_UNIT)
|
||||
BeforeVisibilityDestroy<Creature>((Creature*)target,this);
|
||||
BeforeVisibilityDestroy<Creature>(target->ToCreature(),this);
|
||||
|
||||
target->DestroyForPlayer(this);
|
||||
m_clientGUIDs.erase(target->GetGUID());
|
||||
@@ -20144,7 +20144,7 @@ void Player::UpdateVisibilityOf(T* target, UpdateData& data, std::set<Unit*>& vi
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else //if(visibleNow.size() < 30 || target->GetTypeId() == TYPEID_UNIT && ((Creature*)target)->IsVehicle())
|
||||
else //if(visibleNow.size() < 30 || target->GetTypeId() == TYPEID_UNIT && target->ToCreature()->IsVehicle())
|
||||
{
|
||||
if(target->isVisibleForInState(this,false))
|
||||
{
|
||||
@@ -21124,9 +21124,9 @@ bool Player::isHonorOrXPTarget(Unit* pVictim)
|
||||
|
||||
if(pVictim->GetTypeId() == TYPEID_UNIT)
|
||||
{
|
||||
if (((Creature*)pVictim)->isTotem() ||
|
||||
((Creature*)pVictim)->isPet() ||
|
||||
((Creature*)pVictim)->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_NO_XP_AT_KILL)
|
||||
if (pVictim->ToCreature()->isTotem() ||
|
||||
pVictim->ToCreature()->isPet() ||
|
||||
pVictim->ToCreature()->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_NO_XP_AT_KILL)
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -21203,7 +21203,7 @@ bool Player::RewardPlayerAndGroupAtKill(Unit* pVictim)
|
||||
{
|
||||
// normal creature (not pet/etc) can be only in !PvP case
|
||||
if(pVictim->GetTypeId() == TYPEID_UNIT)
|
||||
pGroupGuy->KilledMonster(((Creature*)pVictim)->GetCreatureInfo(), pVictim->GetGUID());
|
||||
pGroupGuy->KilledMonster(pVictim->ToCreature()->GetCreatureInfo(), pVictim->GetGUID());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -21234,7 +21234,7 @@ bool Player::RewardPlayerAndGroupAtKill(Unit* pVictim)
|
||||
|
||||
// normal creature (not pet/etc) can be only in !PvP case
|
||||
if(pVictim->GetTypeId() == TYPEID_UNIT)
|
||||
KilledMonster(((Creature*)pVictim)->GetCreatureInfo(), pVictim->GetGUID());
|
||||
KilledMonster(pVictim->ToCreature()->GetCreatureInfo(), pVictim->GetGUID());
|
||||
}
|
||||
}
|
||||
return xp || honored_kill;
|
||||
@@ -21843,7 +21843,7 @@ bool Player::isTotalImmunity()
|
||||
void Player::UpdateCharmedAI()
|
||||
{
|
||||
//This should only called in Player::Update
|
||||
Creature *charmer = (Creature*)GetCharmer();
|
||||
Creature *charmer = GetCharmer()->ToCreature();
|
||||
|
||||
//kill self if charm aura has infinite duration
|
||||
if(charmer->IsInEvadeMode())
|
||||
|
||||
@@ -98,8 +98,8 @@ template void PointMovementGenerator<Creature>::Finalize(Creature&);
|
||||
|
||||
void AssistanceMovementGenerator::Finalize(Unit &unit)
|
||||
{
|
||||
((Creature*)&unit)->SetNoCallAssistance(false);
|
||||
((Creature*)&unit)->CallAssistance();
|
||||
unit.ToCreature()->SetNoCallAssistance(false);
|
||||
unit.ToCreature()->CallAssistance();
|
||||
if (unit.isAlive())
|
||||
unit.GetMotionMaster()->MoveSeekAssistanceDistract(sWorld.getConfig(CONFIG_CREATURE_FAMILY_ASSISTANCE_DELAY));
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ void WorldSession::HandleQuestgiverStatusQueryOpcode( WorldPacket & recv_data )
|
||||
case TYPEID_UNIT:
|
||||
{
|
||||
sLog.outDebug( "WORLD: Received CMSG_QUESTGIVER_STATUS_QUERY for npc, guid = %u",uint32(GUID_LOPART(guid)) );
|
||||
Creature* cr_questgiver=(Creature*)questgiver;
|
||||
Creature* cr_questgiver=questgiver->ToCreature();
|
||||
if( !cr_questgiver->IsHostileTo(_player)) // not show quest status to enemies
|
||||
{
|
||||
questStatus = sScriptMgr.NPCDialogStatus(_player, cr_questgiver);
|
||||
@@ -188,7 +188,7 @@ void WorldSession::HandleQuestgiverAcceptQuestOpcode( WorldPacket & recv_data )
|
||||
switch(pObject->GetTypeId())
|
||||
{
|
||||
case TYPEID_UNIT:
|
||||
sScriptMgr.QuestAccept(_player, ((Creature*)pObject), qInfo );
|
||||
sScriptMgr.QuestAccept(_player, (pObject->ToCreature()), qInfo );
|
||||
break;
|
||||
case TYPEID_ITEM:
|
||||
case TYPEID_CONTAINER:
|
||||
@@ -297,7 +297,7 @@ void WorldSession::HandleQuestgiverChooseRewardOpcode( WorldPacket & recv_data )
|
||||
switch(pObject->GetTypeId())
|
||||
{
|
||||
case TYPEID_UNIT:
|
||||
if( !(sScriptMgr.ChooseReward( _player, ((Creature*)pObject), pQuest, reward )) )
|
||||
if( !(sScriptMgr.ChooseReward( _player, (pObject->ToCreature()), pQuest, reward )) )
|
||||
{
|
||||
// Send next quest
|
||||
if(Quest const* nextquest = _player->GetNextQuest( guid ,pQuest ) )
|
||||
|
||||
+23
-23
@@ -836,7 +836,7 @@ void Spell::prepareDataForTriggerSystem(AuraEffect const * triggeredByAura)
|
||||
m_procEx |= PROC_EX_INTERNAL_TRIGGERED;
|
||||
}
|
||||
// Totem casts require spellfamilymask defined in spell_proc_event to proc
|
||||
if (m_originalCaster && m_caster != m_originalCaster && m_caster->GetTypeId() == TYPEID_UNIT && ((Creature*)m_caster)->isTotem() && m_caster->IsControlledByPlayer())
|
||||
if (m_originalCaster && m_caster != m_originalCaster && m_caster->GetTypeId() == TYPEID_UNIT && m_caster->ToCreature()->isTotem() && m_caster->IsControlledByPlayer())
|
||||
{
|
||||
m_procEx |= PROC_EX_INTERNAL_REQ_FAMILY;
|
||||
}
|
||||
@@ -1076,7 +1076,7 @@ void Spell::DoAllEffectOnTarget(TargetInfo *target)
|
||||
{
|
||||
spellHitTarget = m_caster;
|
||||
if(m_caster->GetTypeId() == TYPEID_UNIT)
|
||||
((Creature*)m_caster)->LowerPlayerDamageReq(target->damage);
|
||||
m_caster->ToCreature()->LowerPlayerDamageReq(target->damage);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1212,8 +1212,8 @@ void Spell::DoAllEffectOnTarget(TargetInfo *target)
|
||||
&& unitTarget->GetTypeId() == TYPEID_UNIT)
|
||||
{
|
||||
m_caster->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_TALK);
|
||||
if (((Creature*)unitTarget)->IsAIEnabled)
|
||||
((Creature*)unitTarget)->AI()->AttackStart(m_caster);
|
||||
if (unitTarget->ToCreature()->IsAIEnabled)
|
||||
unitTarget->ToCreature()->AI()->AttackStart(m_caster);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1231,18 +1231,18 @@ void Spell::DoAllEffectOnTarget(TargetInfo *target)
|
||||
//AI functions
|
||||
if(spellHitTarget->GetTypeId() == TYPEID_UNIT)
|
||||
{
|
||||
if(((Creature*)spellHitTarget)->IsAIEnabled)
|
||||
((Creature*)spellHitTarget)->AI()->SpellHit(m_caster, m_spellInfo);
|
||||
if(spellHitTarget->ToCreature()->IsAIEnabled)
|
||||
spellHitTarget->ToCreature()->AI()->SpellHit(m_caster, m_spellInfo);
|
||||
|
||||
// cast at creature (or GO) quest objectives update at successful cast finished (+channel finished)
|
||||
// ignore pets or autorepeat/melee casts for speed (not exist quest for spells (hm... )
|
||||
if(m_originalCaster && m_originalCaster->IsControlledByPlayer() && !((Creature*)spellHitTarget)->isPet() && !IsAutoRepeat() && !IsNextMeleeSwingSpell() && !IsChannelActive())
|
||||
if(m_originalCaster && m_originalCaster->IsControlledByPlayer() && !spellHitTarget->ToCreature()->isPet() && !IsAutoRepeat() && !IsNextMeleeSwingSpell() && !IsChannelActive())
|
||||
if(Player* p = m_originalCaster->GetCharmerOrOwnerPlayerOrPlayerItself())
|
||||
p->CastedCreatureOrGO(spellHitTarget->GetEntry(),spellHitTarget->GetGUID(),m_spellInfo->Id);
|
||||
}
|
||||
|
||||
if(m_caster && m_caster->GetTypeId() == TYPEID_UNIT && ((Creature*)m_caster)->IsAIEnabled)
|
||||
((Creature*)m_caster)->AI()->SpellHitTarget(spellHitTarget, m_spellInfo);
|
||||
if(m_caster && m_caster->GetTypeId() == TYPEID_UNIT && m_caster->ToCreature()->IsAIEnabled)
|
||||
m_caster->ToCreature()->AI()->SpellHitTarget(spellHitTarget, m_spellInfo);
|
||||
|
||||
// Needs to be called after dealing damage/healing to not remove breaking on damage auras
|
||||
DoTriggersOnSpellHit(spellHitTarget);
|
||||
@@ -1336,7 +1336,7 @@ SpellMissInfo Spell::DoSpellHitOnUnit(Unit *unit, const uint32 effectMask, bool
|
||||
m_diminishLevel = unit->GetDiminishing(m_diminishGroup);
|
||||
DiminishingReturnsType type = GetDiminishingReturnsGroupType(m_diminishGroup);
|
||||
// Increase Diminishing on unit, current informations for actually casts will use values above
|
||||
if((type == DRTYPE_PLAYER && (unit->GetTypeId() == TYPEID_PLAYER || ((Creature*)unit)->isPet() || ((Creature*)unit)->isPossessedByPlayer())) || type == DRTYPE_ALL)
|
||||
if((type == DRTYPE_PLAYER && (unit->GetTypeId() == TYPEID_PLAYER || unit->ToCreature()->isPet() || unit->ToCreature()->isPossessedByPlayer())) || type == DRTYPE_ALL)
|
||||
unit->IncrDiminishing(m_diminishGroup);
|
||||
}
|
||||
|
||||
@@ -1849,7 +1849,7 @@ void Spell::SelectEffectTargets(uint32 i, uint32 cur)
|
||||
case TARGET_UNIT_PASSENGER_5:
|
||||
case TARGET_UNIT_PASSENGER_6:
|
||||
case TARGET_UNIT_PASSENGER_7:
|
||||
if(m_caster->GetTypeId() == TYPEID_UNIT && ((Creature*)m_caster)->IsVehicle())
|
||||
if(m_caster->GetTypeId() == TYPEID_UNIT && m_caster->ToCreature()->IsVehicle())
|
||||
if(Unit *unit = m_caster->GetVehicleKit()->GetPassenger(cur - TARGET_UNIT_PASSENGER_0))
|
||||
AddUnitTarget(unit, i);
|
||||
break;
|
||||
@@ -2303,7 +2303,7 @@ void Spell::SelectEffectTargets(uint32 i, uint32 cur)
|
||||
|| (m_targets.getUnitTarget()->getDeathState() == CORPSE
|
||||
&& m_targets.getUnitTarget()->GetDisplayId() == m_targets.getUnitTarget()->GetNativeDisplayId()
|
||||
&& m_targets.getUnitTarget()->GetTypeId() == TYPEID_UNIT
|
||||
&& !((Creature*)m_targets.getUnitTarget())->isDeadByDefault()
|
||||
&& !m_targets.getUnitTarget()->ToCreature()->isDeadByDefault()
|
||||
&& !(m_targets.getUnitTarget()->GetCreatureTypeMask() & CREATURE_TYPEMASK_MECHANICAL_OR_ELEMENTAL))
|
||||
&& m_targets.getUnitTarget()->GetDisplayId() == m_targets.getUnitTarget()->GetNativeDisplayId())))
|
||||
{
|
||||
@@ -2534,7 +2534,7 @@ void Spell::SelectEffectTargets(uint32 i, uint32 cur)
|
||||
{
|
||||
if ((*itr)->GetTypeId() == TYPEID_UNIT
|
||||
&& (*itr)->GetOwnerGUID() == m_caster->GetGUID()
|
||||
&& ((Creature*)(*itr))->GetCreatureInfo()->type == CREATURE_TYPE_UNDEAD)
|
||||
&& (*itr)->ToCreature()->GetCreatureInfo()->type == CREATURE_TYPE_UNDEAD)
|
||||
{
|
||||
unit_to_add = (*itr);
|
||||
break;
|
||||
@@ -2635,7 +2635,7 @@ void Spell::prepare(SpellCastTargets const* targets, AuraEffect const * triggere
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (m_caster->GetTypeId() == TYPEID_UNIT && ((Creature*)m_caster)->isPet())
|
||||
else if (m_caster->GetTypeId() == TYPEID_UNIT && m_caster->ToCreature()->isPet())
|
||||
{
|
||||
if(objmgr.IsPetSpellDisabled(m_spellInfo->Id))
|
||||
{
|
||||
@@ -3329,7 +3329,7 @@ void Spell::finish(bool ok)
|
||||
{
|
||||
if(Unit *charm = m_caster->GetCharm())
|
||||
if(charm->GetTypeId() == TYPEID_UNIT
|
||||
&& ((Creature*)charm)->HasUnitTypeMask(UNIT_MASK_PUPPET)
|
||||
&& charm->ToCreature()->HasUnitTypeMask(UNIT_MASK_PUPPET)
|
||||
&& charm->GetUInt32Value(UNIT_CREATED_BY_SPELL) == m_spellInfo->Id)
|
||||
((Puppet*)charm)->UnSummon();
|
||||
}
|
||||
@@ -3337,7 +3337,7 @@ void Spell::finish(bool ok)
|
||||
if(!ok)
|
||||
return;
|
||||
|
||||
if (m_caster->GetTypeId() == TYPEID_UNIT && ((Creature*)m_caster)->isSummon())
|
||||
if (m_caster->GetTypeId() == TYPEID_UNIT && m_caster->ToCreature()->isSummon())
|
||||
{
|
||||
// Unsummon statue
|
||||
uint32 spell = m_caster->GetUInt32Value(UNIT_CREATED_BY_SPELL);
|
||||
@@ -3502,7 +3502,7 @@ void Spell::SendSpellStart()
|
||||
if(m_spellInfo->Attributes & SPELL_ATTR_REQ_AMMO)
|
||||
castFlags |= CAST_FLAG_AMMO;
|
||||
if ((m_caster->GetTypeId() == TYPEID_PLAYER ||
|
||||
(m_caster->GetTypeId() == TYPEID_UNIT && ((Creature*)m_caster)->isPet()))
|
||||
(m_caster->GetTypeId() == TYPEID_UNIT && m_caster->ToCreature()->isPet()))
|
||||
&& m_spellInfo->powerType != POWER_HEALTH )
|
||||
castFlags |= CAST_FLAG_POWER_LEFT_SELF;
|
||||
|
||||
@@ -3555,7 +3555,7 @@ void Spell::SendSpellGo()
|
||||
if(m_spellInfo->Attributes & SPELL_ATTR_REQ_AMMO)
|
||||
castFlags |= CAST_FLAG_AMMO; // arrows/bullets visual
|
||||
if ((m_caster->GetTypeId() == TYPEID_PLAYER ||
|
||||
(m_caster->GetTypeId() == TYPEID_UNIT && ((Creature*)m_caster)->isPet()))
|
||||
(m_caster->GetTypeId() == TYPEID_UNIT && m_caster->ToCreature()->isPet()))
|
||||
&& m_spellInfo->powerType != POWER_HEALTH )
|
||||
castFlags |= CAST_FLAG_POWER_LEFT_SELF; // should only be sent to self, but the current messaging doesn't make that possible
|
||||
|
||||
@@ -4469,7 +4469,7 @@ SpellCastResult Spell::CheckCast(bool strict)
|
||||
// Not allow banish not self target
|
||||
if (m_spellInfo->Mechanic == MECHANIC_BANISH)
|
||||
if (target->GetTypeId() == TYPEID_UNIT &&
|
||||
!m_caster->ToPlayer()->isAllowedToLoot((Creature*)target))
|
||||
!m_caster->ToPlayer()->isAllowedToLoot(target->ToCreature()))
|
||||
return SPELL_FAILED_CANT_CAST_ON_TAPPED;
|
||||
|
||||
if (m_customAttr & SPELL_ATTR_CU_PICKPOCKET)
|
||||
@@ -4950,7 +4950,7 @@ SpellCastResult Spell::CheckCast(bool strict)
|
||||
if( !(m_targets.getUnitTarget()->GetUInt32Value(UNIT_FIELD_FLAGS) & UNIT_FLAG_SKINNABLE) )
|
||||
return SPELL_FAILED_TARGET_UNSKINNABLE;
|
||||
|
||||
Creature* creature = (Creature*)m_targets.getUnitTarget();
|
||||
Creature* creature = m_targets.getUnitTarget()->ToCreature();
|
||||
if ( creature->GetCreatureType() != CREATURE_TYPE_CRITTER && ( !creature->lootForBody || !creature->loot.empty() ) )
|
||||
{
|
||||
return SPELL_FAILED_TARGET_NOT_LOOTED;
|
||||
@@ -5160,7 +5160,7 @@ SpellCastResult Spell::CheckCast(bool strict)
|
||||
if (!m_targets.getUnitTarget() || m_targets.getUnitTarget()->GetTypeId() == TYPEID_PLAYER)
|
||||
return SPELL_FAILED_BAD_IMPLICIT_TARGETS;
|
||||
|
||||
Creature* target = (Creature*)m_targets.getUnitTarget();
|
||||
Creature* target = m_targets.getUnitTarget()->ToCreature();
|
||||
|
||||
if (target->getLevel() > m_caster->getLevel())
|
||||
return SPELL_FAILED_HIGHLEVEL;
|
||||
@@ -5223,7 +5223,7 @@ SpellCastResult Spell::CheckCast(bool strict)
|
||||
|
||||
if(Unit *target = m_targets.getUnitTarget())
|
||||
{
|
||||
if(target->GetTypeId() == TYPEID_UNIT && ((Creature*)target)->IsVehicle())
|
||||
if(target->GetTypeId() == TYPEID_UNIT && target->ToCreature()->IsVehicle())
|
||||
return SPELL_FAILED_BAD_IMPLICIT_TARGETS;
|
||||
|
||||
if(target->GetCharmerGUID())
|
||||
@@ -5355,7 +5355,7 @@ SpellCastResult Spell::CheckPetCast(Unit* target)
|
||||
return SPELL_FAILED_BAD_TARGETS;
|
||||
}
|
||||
//cooldown
|
||||
if(((Creature*)m_caster)->HasSpellCooldown(m_spellInfo->Id))
|
||||
if(m_caster->ToCreature()->HasSpellCooldown(m_spellInfo->Id))
|
||||
return SPELL_FAILED_NOT_READY;
|
||||
|
||||
return CheckCast(true);
|
||||
|
||||
@@ -1973,7 +1973,7 @@ Unit* AuraEffect::GetTriggerTarget(Unit * target) const
|
||||
{
|
||||
if (target->GetTypeId() == TYPEID_UNIT)
|
||||
{
|
||||
if (Unit * trigger = ((Creature*)target)->AI()->GetAuraEffectTriggerTarget(GetId(), GetEffIndex()))
|
||||
if (Unit * trigger = target->ToCreature()->AI()->GetAuraEffectTriggerTarget(GetId(), GetEffIndex()))
|
||||
return trigger;
|
||||
}
|
||||
return target;
|
||||
@@ -2062,10 +2062,10 @@ void AuraEffect::TriggerSpell(Unit * target, Unit * caster) const
|
||||
// move loot to player inventory and despawn target
|
||||
if(caster->GetTypeId() ==TYPEID_PLAYER &&
|
||||
triggerTarget->GetTypeId() == TYPEID_UNIT &&
|
||||
((Creature*)triggerTarget)->GetCreatureInfo()->type == CREATURE_TYPE_GAS_CLOUD)
|
||||
triggerTarget->ToCreature()->GetCreatureInfo()->type == CREATURE_TYPE_GAS_CLOUD)
|
||||
{
|
||||
Player* player = (Player*)caster;
|
||||
Creature* creature = (Creature*)triggerTarget;
|
||||
Creature* creature = triggerTarget->ToCreature();
|
||||
// missing lootid has been reported on startup - just return
|
||||
if (!creature->GetCreatureInfo()->SkinLootId)
|
||||
return;
|
||||
@@ -2120,7 +2120,7 @@ void AuraEffect::TriggerSpell(Unit * target, Unit * caster) const
|
||||
|
||||
caster->CastSpell(caster, 38495, true, NULL, this);
|
||||
|
||||
Creature* creatureTarget = (Creature*)target;
|
||||
Creature* creatureTarget = target->ToCreature();
|
||||
|
||||
creatureTarget->ForcedDespawn();
|
||||
return;
|
||||
@@ -2243,7 +2243,7 @@ void AuraEffect::TriggerSpell(Unit * target, Unit * caster) const
|
||||
triggerCaster->CastSpell(triggerTarget, triggeredSpellInfo, true, 0, this);
|
||||
sLog.outDebug("AuraEffect::TriggerSpell: Spell %u Trigger %u",GetId(), triggeredSpellInfo->Id);
|
||||
}
|
||||
else if(target->GetTypeId()!=TYPEID_UNIT || !sScriptMgr.EffectDummyCreature(caster, GetId(), GetEffIndex(), (Creature*)triggerTarget))
|
||||
else if(target->GetTypeId()!=TYPEID_UNIT || !sScriptMgr.EffectDummyCreature(caster, GetId(), GetEffIndex(), triggerTarget->ToCreature()))
|
||||
sLog.outError("AuraEffect::TriggerSpell: Spell %u have 0 in EffectTriggered[%d], not handled custom case?",GetId(),GetEffIndex());
|
||||
}
|
||||
|
||||
@@ -3283,7 +3283,7 @@ void AuraEffect::HandleAuraModDisarm(AuraApplication const * aurApp, uint8 mode,
|
||||
if(apply)
|
||||
target->SetFlag(field, flag);
|
||||
|
||||
if (target->GetTypeId() == TYPEID_UNIT && ((Creature*)target)->GetCurrentEquipmentId())
|
||||
if (target->GetTypeId() == TYPEID_UNIT && target->ToCreature()->GetCurrentEquipmentId())
|
||||
target->UpdateDamagePhysical(attType);
|
||||
}
|
||||
|
||||
@@ -3930,7 +3930,7 @@ void AuraEffect::HandleAuraControlVehicle(AuraApplication const * aurApp, uint8
|
||||
{
|
||||
target->Kill(caster);
|
||||
if(caster->GetTypeId() == TYPEID_UNIT)
|
||||
((Creature*)caster)->RemoveCorpse();
|
||||
caster->ToCreature()->RemoveCorpse();
|
||||
}
|
||||
|
||||
// some SPELL_AURA_CONTROL_VEHICLE auras have a dummy effect on the player - remove them
|
||||
@@ -4300,7 +4300,7 @@ void AuraEffect::HandleAuraModResistance(AuraApplication const * aurApp, uint8 m
|
||||
if(GetMiscValue() & int32(1<<x))
|
||||
{
|
||||
target->HandleStatModifier(UnitMods(UNIT_MOD_RESISTANCE_START + x), TOTAL_VALUE, float(GetAmount()), apply);
|
||||
if(target->GetTypeId() == TYPEID_PLAYER || ((Creature*)target)->isPet())
|
||||
if(target->GetTypeId() == TYPEID_PLAYER || target->ToCreature()->isPet())
|
||||
target->ApplyResistanceBuffModsMod(SpellSchools(x),GetAmount() > 0,GetAmount(), apply);
|
||||
}
|
||||
}
|
||||
@@ -4317,7 +4317,7 @@ void AuraEffect::HandleAuraModBaseResistancePCT(AuraApplication const * aurApp,
|
||||
if(target->GetTypeId() != TYPEID_PLAYER)
|
||||
{
|
||||
//pets only have base armor
|
||||
if(((Creature*)target)->isPet() && (GetMiscValue() & SPELL_SCHOOL_MASK_NORMAL))
|
||||
if(target->ToCreature()->isPet() && (GetMiscValue() & SPELL_SCHOOL_MASK_NORMAL))
|
||||
target->HandleStatModifier(UNIT_MOD_ARMOR, BASE_PCT, float(GetAmount()), apply);
|
||||
}
|
||||
else
|
||||
@@ -4342,7 +4342,7 @@ void AuraEffect::HandleModResistancePercent(AuraApplication const * aurApp, uint
|
||||
if(GetMiscValue() & int32(1<<i))
|
||||
{
|
||||
target->HandleStatModifier(UnitMods(UNIT_MOD_RESISTANCE_START + i), TOTAL_PCT, float(GetAmount()), apply);
|
||||
if(target->GetTypeId() == TYPEID_PLAYER || ((Creature*)target)->isPet())
|
||||
if(target->GetTypeId() == TYPEID_PLAYER || target->ToCreature()->isPet())
|
||||
{
|
||||
target->ApplyResistanceBuffModsPercentMod(SpellSchools(i),true,GetAmount(), apply);
|
||||
target->ApplyResistanceBuffModsPercentMod(SpellSchools(i),false,GetAmount(), apply);
|
||||
@@ -4362,7 +4362,7 @@ void AuraEffect::HandleModBaseResistance(AuraApplication const * aurApp, uint8 m
|
||||
if(target->GetTypeId() != TYPEID_PLAYER)
|
||||
{
|
||||
//only pets have base stats
|
||||
if(((Creature*)target)->isPet() && (GetMiscValue() & SPELL_SCHOOL_MASK_NORMAL))
|
||||
if(target->ToCreature()->isPet() && (GetMiscValue() & SPELL_SCHOOL_MASK_NORMAL))
|
||||
target->HandleStatModifier(UNIT_MOD_ARMOR, TOTAL_VALUE, float(GetAmount()), apply);
|
||||
}
|
||||
else
|
||||
@@ -4415,7 +4415,7 @@ void AuraEffect::HandleAuraModStat(AuraApplication const * aurApp, uint8 mode, b
|
||||
{
|
||||
//target->ApplyStatMod(Stats(i), m_amount,apply);
|
||||
target->HandleStatModifier(UnitMods(UNIT_MOD_STAT_START + i), TOTAL_VALUE, float(GetAmount()), apply);
|
||||
if(target->GetTypeId() == TYPEID_PLAYER || ((Creature*)target)->isPet())
|
||||
if(target->GetTypeId() == TYPEID_PLAYER || target->ToCreature()->isPet())
|
||||
target->ApplyStatBuffMod(Stats(i),GetAmount(),apply);
|
||||
}
|
||||
}
|
||||
@@ -4541,7 +4541,7 @@ void AuraEffect::HandleModTotalPercentStat(AuraApplication const * aurApp, uint8
|
||||
if(GetMiscValue() == i || GetMiscValue() == -1)
|
||||
{
|
||||
target->HandleStatModifier(UnitMods(UNIT_MOD_STAT_START + i), TOTAL_PCT, float(GetAmount()), apply);
|
||||
if(target->GetTypeId() == TYPEID_PLAYER || ((Creature*)target)->isPet())
|
||||
if(target->GetTypeId() == TYPEID_PLAYER || target->ToCreature()->isPet())
|
||||
target->ApplyStatPercentBuffMod(Stats(i), GetAmount(), apply );
|
||||
}
|
||||
}
|
||||
@@ -6002,7 +6002,7 @@ void AuraEffect::HandleChannelDeathItem(AuraApplication const * aurApp, uint8 mo
|
||||
// Soul Shard only from non-grey units
|
||||
if( GetSpellProto()->EffectItemType[m_effIndex] == 6265 &&
|
||||
(target->getLevel() <= Trinity::XP::GetGrayLevel(caster->getLevel()) ||
|
||||
target->GetTypeId() == TYPEID_UNIT && !caster->ToPlayer()->isAllowedToLoot((Creature*)target)) )
|
||||
target->GetTypeId() == TYPEID_UNIT && !caster->ToPlayer()->isAllowedToLoot(target->ToCreature())) )
|
||||
return;
|
||||
//Adding items
|
||||
uint32 noSpaceForCount = 0;
|
||||
|
||||
@@ -766,7 +766,7 @@ void Aura::HandleAllEffects(AuraApplication const * aurApp, uint8 mode, bool app
|
||||
bool Aura::IsVisible() const
|
||||
{
|
||||
// Is this blizzlike? show totem passive auras
|
||||
if (GetOwner()->GetTypeId() == TYPEID_UNIT && ((Creature*)m_owner)->isTotem() && IsPassive())
|
||||
if (GetOwner()->GetTypeId() == TYPEID_UNIT && m_owner->ToCreature()->isTotem() && IsPassive())
|
||||
return true;
|
||||
return !IsPassive() || HasEffectType(SPELL_AURA_ABILITY_IGNORE_AURASTATE);
|
||||
}
|
||||
|
||||
+27
-27
@@ -821,7 +821,7 @@ void Spell::EffectDummy(uint32 i)
|
||||
{
|
||||
if (!unitTarget || unitTarget->GetTypeId() != TYPEID_UNIT)
|
||||
return;
|
||||
((Creature*)unitTarget)->setDeathState(JUST_ALIVED);
|
||||
unitTarget->ToCreature()->setDeathState(JUST_ALIVED);
|
||||
return;
|
||||
}
|
||||
case 12162: // Deep wounds
|
||||
@@ -932,7 +932,7 @@ void Spell::EffectDummy(uint32 i)
|
||||
if (!unitTarget || unitTarget->GetTypeId() != TYPEID_UNIT)
|
||||
return;
|
||||
|
||||
((Creature*)unitTarget)->ForcedDespawn();
|
||||
unitTarget->ToCreature()->ForcedDespawn();
|
||||
return;
|
||||
}
|
||||
case 16589: // Noggenfogger Elixir
|
||||
@@ -982,10 +982,10 @@ void Spell::EffectDummy(uint32 i)
|
||||
return;
|
||||
case 23019: // Crystal Prison Dummy DND
|
||||
{
|
||||
if(!unitTarget || !unitTarget->isAlive() || unitTarget->GetTypeId() != TYPEID_UNIT || ((Creature*)unitTarget)->isPet())
|
||||
if(!unitTarget || !unitTarget->isAlive() || unitTarget->GetTypeId() != TYPEID_UNIT || unitTarget->ToCreature()->isPet())
|
||||
return;
|
||||
|
||||
Creature* creatureTarget = (Creature*)unitTarget;
|
||||
Creature* creatureTarget = unitTarget->ToCreature();
|
||||
|
||||
GameObject* Crystal_Prison = m_caster->SummonGameObject(179644, creatureTarget->GetPositionX(), creatureTarget->GetPositionY(), creatureTarget->GetPositionZ(), creatureTarget->GetOrientation(), 0, 0, 0, 0, creatureTarget->GetRespawnTime()-time(NULL));
|
||||
sLog.outDebug("SummonGameObject at SpellEfects.cpp EffectDummy for Spell 23019");
|
||||
@@ -1219,7 +1219,7 @@ void Spell::EffectDummy(uint32 i)
|
||||
if(!unitTarget || unitTarget->GetTypeId() != TYPEID_UNIT)
|
||||
return;
|
||||
|
||||
((Creature*)unitTarget)->ForcedDespawn();
|
||||
unitTarget->ToCreature()->ForcedDespawn();
|
||||
|
||||
//cast spell Raptor Capture Credit
|
||||
m_caster->CastSpell(m_caster, 42337, true, NULL);
|
||||
@@ -1228,14 +1228,14 @@ void Spell::EffectDummy(uint32 i)
|
||||
case 34665: //Administer Antidote
|
||||
{
|
||||
if(!unitTarget || unitTarget->GetTypeId() != TYPEID_UNIT
|
||||
|| unitTarget->GetEntry() != 16880 || ((Creature*)unitTarget)->isPet())
|
||||
|| unitTarget->GetEntry() != 16880 || unitTarget->ToCreature()->isPet())
|
||||
return;
|
||||
|
||||
((Creature*)unitTarget)->UpdateEntry(16992);
|
||||
unitTarget->ToCreature()->UpdateEntry(16992);
|
||||
m_caster->ToPlayer()->RewardPlayerAndGroupAtEvent(16992, unitTarget);
|
||||
|
||||
if (unitTarget->IsAIEnabled)
|
||||
((Creature*)unitTarget)->AI()->AttackStart(m_caster);
|
||||
unitTarget->ToCreature()->AI()->AttackStart(m_caster);
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -1360,7 +1360,7 @@ void Spell::EffectDummy(uint32 i)
|
||||
if(!unitTarget || unitTarget->GetTypeId() != TYPEID_UNIT)
|
||||
return;
|
||||
|
||||
((Creature*)unitTarget)->ForcedDespawn();
|
||||
unitTarget->ToCreature()->ForcedDespawn();
|
||||
return;
|
||||
|
||||
}
|
||||
@@ -2177,7 +2177,7 @@ void Spell::EffectDummy(uint32 i)
|
||||
if(gameObjTarget)
|
||||
sScriptMgr.EffectDummyGameObj(m_caster, m_spellInfo->Id, i, gameObjTarget);
|
||||
else if(unitTarget && unitTarget->GetTypeId() == TYPEID_UNIT)
|
||||
sScriptMgr.EffectDummyCreature(m_caster, m_spellInfo->Id, i, (Creature*)unitTarget);
|
||||
sScriptMgr.EffectDummyCreature(m_caster, m_spellInfo->Id, i, unitTarget->ToCreature());
|
||||
else if(itemTarget)
|
||||
sScriptMgr.EffectDummyItem(m_caster, m_spellInfo->Id, i, itemTarget);
|
||||
}
|
||||
@@ -3867,7 +3867,7 @@ void Spell::EffectDualWield(uint32 /*i*/)
|
||||
{
|
||||
unitTarget->SetCanDualWield(true);
|
||||
if (unitTarget->GetTypeId() == TYPEID_UNIT)
|
||||
((Creature*)unitTarget)->UpdateDamagePhysical(OFF_ATTACK);
|
||||
unitTarget->ToCreature()->UpdateDamagePhysical(OFF_ATTACK);
|
||||
}
|
||||
|
||||
void Spell::EffectPull(uint32 /*i*/)
|
||||
@@ -4266,7 +4266,7 @@ void Spell::EffectTameCreature(uint32 /*i*/)
|
||||
if (unitTarget->GetTypeId() != TYPEID_UNIT)
|
||||
return;
|
||||
|
||||
Creature* creatureTarget = (Creature*)unitTarget;
|
||||
Creature* creatureTarget = unitTarget->ToCreature();
|
||||
|
||||
if (creatureTarget->isPet())
|
||||
return;
|
||||
@@ -4291,7 +4291,7 @@ void Spell::EffectTameCreature(uint32 /*i*/)
|
||||
pet->SetUInt32Value(UNIT_FIELD_LEVEL, level - 1);
|
||||
|
||||
// add to world
|
||||
pet->GetMap()->Add((Creature*)pet);
|
||||
pet->GetMap()->Add(pet->ToCreature());
|
||||
|
||||
// visual effect for levelup
|
||||
pet->SetUInt32Value(UNIT_FIELD_LEVEL, level);
|
||||
@@ -4315,7 +4315,7 @@ void Spell::EffectSummonPet(uint32 i)
|
||||
{
|
||||
if(m_originalCaster->GetTypeId() == TYPEID_PLAYER)
|
||||
owner = (Player*)m_originalCaster;
|
||||
else if(((Creature*)m_originalCaster)->isTotem())
|
||||
else if(m_originalCaster->ToCreature()->isTotem())
|
||||
owner = m_originalCaster->GetCharmerOrOwnerPlayerOrPlayerItself();
|
||||
}
|
||||
|
||||
@@ -4342,7 +4342,7 @@ void Spell::EffectSummonPet(uint32 i)
|
||||
|
||||
assert(OldSummon->GetMap() == owner->GetMap());
|
||||
|
||||
//OldSummon->GetMap()->Remove((Creature*)OldSummon,false);
|
||||
//OldSummon->GetMap()->Remove(OldSummon->ToCreature(),false);
|
||||
|
||||
float px, py, pz;
|
||||
owner->GetClosePoint(px, py, pz, OldSummon->GetObjectSize());
|
||||
@@ -4350,7 +4350,7 @@ void Spell::EffectSummonPet(uint32 i)
|
||||
OldSummon->NearTeleportTo(px, py, pz, OldSummon->GetOrientation());
|
||||
//OldSummon->Relocate(px, py, pz, OldSummon->GetOrientation());
|
||||
//OldSummon->SetMap(owner->GetMap());
|
||||
//owner->GetMap()->Add((Creature*)OldSummon);
|
||||
//owner->GetMap()->Add(OldSummon->ToCreature());
|
||||
|
||||
if (owner->GetTypeId() == TYPEID_PLAYER && OldSummon->isControlled() )
|
||||
owner->ToPlayer()->PetSpellInitialize();
|
||||
@@ -4372,7 +4372,7 @@ void Spell::EffectSummonPet(uint32 i)
|
||||
|
||||
if (m_caster->GetTypeId() == TYPEID_UNIT)
|
||||
{
|
||||
if (((Creature*)m_caster)->isTotem())
|
||||
if (m_caster->ToCreature()->isTotem())
|
||||
pet->SetReactState(REACT_AGGRESSIVE);
|
||||
else
|
||||
pet->SetReactState(REACT_DEFENSIVE);
|
||||
@@ -4444,8 +4444,8 @@ void Spell::EffectTaunt(uint32 /*i*/)
|
||||
if (HostilReference* forcedVictim = unitTarget->getThreatManager().getOnlineContainer().getReferenceByTarget(m_caster))
|
||||
unitTarget->getThreatManager().setCurrentVictim(forcedVictim);
|
||||
|
||||
if (((Creature*)unitTarget)->IsAIEnabled && !((Creature*)unitTarget)->HasReactState(REACT_PASSIVE))
|
||||
((Creature*)unitTarget)->AI()->AttackStart(m_caster);
|
||||
if (unitTarget->ToCreature()->IsAIEnabled && !unitTarget->ToCreature()->HasReactState(REACT_PASSIVE))
|
||||
unitTarget->ToCreature()->AI()->AttackStart(m_caster);
|
||||
}
|
||||
|
||||
void Spell::EffectWeaponDmg(uint32 i)
|
||||
@@ -4996,7 +4996,7 @@ void Spell::EffectScriptEffect(uint32 effIndex)
|
||||
{
|
||||
if(!unitTarget || unitTarget->GetTypeId() != TYPEID_UNIT)
|
||||
return;
|
||||
((Creature*)unitTarget)->ForcedDespawn();
|
||||
unitTarget->ToCreature()->ForcedDespawn();
|
||||
return;
|
||||
}
|
||||
case 55693: // Remove Collapsing Cave Aura
|
||||
@@ -5399,7 +5399,7 @@ void Spell::EffectScriptEffect(uint32 effIndex)
|
||||
}
|
||||
|
||||
unitTarget->CastSpell(unitTarget, iTmpSpellId, true);
|
||||
Creature* npc = (Creature*)unitTarget;
|
||||
Creature* npc = unitTarget->ToCreature();
|
||||
npc->LoadEquipment(npc->GetEquipmentId());
|
||||
return;
|
||||
}
|
||||
@@ -5442,7 +5442,7 @@ void Spell::EffectScriptEffect(uint32 effIndex)
|
||||
}
|
||||
case 52173: // Coyote Spirit Despawn
|
||||
case 60243: // Blood Parrot Despawn
|
||||
if (unitTarget->GetTypeId() == TYPEID_UNIT && ((Creature*)unitTarget)->isSummon())
|
||||
if (unitTarget->GetTypeId() == TYPEID_UNIT && unitTarget->ToCreature()->isSummon())
|
||||
((TempSummon*)unitTarget)->UnSummon();
|
||||
return;
|
||||
// Sky Darkener Assault
|
||||
@@ -5629,7 +5629,7 @@ void Spell::EffectScriptEffect(uint32 effIndex)
|
||||
}
|
||||
case 60123: // Lightwell
|
||||
{
|
||||
if (m_caster->GetTypeId() != TYPEID_UNIT || !((Creature*)m_caster)->isSummon())
|
||||
if (m_caster->GetTypeId() != TYPEID_UNIT || !m_caster->ToCreature()->isSummon())
|
||||
return;
|
||||
|
||||
uint32 spell_heal;
|
||||
@@ -5883,8 +5883,8 @@ void Spell::EffectScriptEffect(uint32 effIndex)
|
||||
case 55709:
|
||||
{
|
||||
int pct = 100;
|
||||
if (unitTarget->GetTypeId() == TYPEID_UNIT && ((Creature*)unitTarget)->isPet())
|
||||
if (Unit* owner = ((Creature*)unitTarget)->GetOwner())
|
||||
if (unitTarget->GetTypeId() == TYPEID_UNIT && unitTarget->ToCreature()->isPet())
|
||||
if (Unit* owner = unitTarget->ToCreature()->GetOwner())
|
||||
owner->CastCustomSpell(unitTarget, 54114, &pct, NULL, NULL, true);
|
||||
break;
|
||||
}
|
||||
@@ -6759,7 +6759,7 @@ void Spell::EffectSkinning(uint32 /*i*/)
|
||||
if(!m_caster || m_caster->GetTypeId() != TYPEID_PLAYER)
|
||||
return;
|
||||
|
||||
Creature* creature = (Creature*) unitTarget;
|
||||
Creature* creature = unitTarget->ToCreature();
|
||||
int32 targetLevel = creature->getLevel();
|
||||
|
||||
uint32 skill = creature->GetCreatureInfo()->GetRequiredLootSkill();
|
||||
@@ -7529,7 +7529,7 @@ void Spell::GetSummonPosition(uint32 i, Position &pos, float radius, uint32 coun
|
||||
void Spell::EffectRenamePet(uint32 /*eff_idx*/)
|
||||
{
|
||||
if (!unitTarget || unitTarget->GetTypeId() != TYPEID_UNIT ||
|
||||
!((Creature*)unitTarget)->isPet() || ((Pet*)unitTarget)->getPetType() != HUNTER_PET)
|
||||
!unitTarget->ToCreature()->isPet() || ((Pet*)unitTarget)->getPetType() != HUNTER_PET)
|
||||
return;
|
||||
|
||||
unitTarget->RemoveByteFlag(UNIT_FIELD_BYTES_2, 2, UNIT_CAN_BE_RENAMED);
|
||||
|
||||
@@ -324,7 +324,7 @@ void WorldSession::HandleCastSpellOpcode(WorldPacket& recvPacket)
|
||||
else
|
||||
{
|
||||
// not have spell in spellbook or spell passive and not casted by client
|
||||
if ((mover->GetTypeId() == TYPEID_UNIT && !((Creature*)mover)->HasSpell(spellId)) || IsPassiveSpell(spellId))
|
||||
if ((mover->GetTypeId() == TYPEID_UNIT && !mover->ToCreature()->HasSpell(spellId)) || IsPassiveSpell(spellId))
|
||||
{
|
||||
//cheater? kick? ban?
|
||||
recvPacket.rpos(recvPacket.wpos()); // prevent spam at ignore packet
|
||||
|
||||
@@ -954,7 +954,7 @@ bool Guardian::UpdateStats(Stats stat)
|
||||
else
|
||||
{
|
||||
mod = 0.3f;
|
||||
if (((Creature*)this)->isPet())
|
||||
if (this->ToCreature()->isPet())
|
||||
{
|
||||
PetSpellMap::const_iterator itr = (((Pet*)this)->m_spells.find(62758)); // Wild Hunt rank 1
|
||||
if (itr == ((Pet*)this)->m_spells.end())
|
||||
@@ -1120,7 +1120,7 @@ void Guardian::UpdateAttackPowerAndDamage(bool ranged)
|
||||
if(isHunterPet()) //hunter pets benefit from owner's attack power
|
||||
{
|
||||
float mod = 1.0f; //Hunter contribution modifier
|
||||
if (((Creature*)this)->isPet())
|
||||
if (this->ToCreature()->isPet())
|
||||
{
|
||||
PetSpellMap::const_iterator itr = ((Pet*)this)->m_spells.find(62758); //Wild Hunt rank 1
|
||||
if (itr == ((Pet*)this)->m_spells.end())
|
||||
|
||||
@@ -214,8 +214,8 @@ void TempSummon::InitSummon()
|
||||
Unit* owner = GetSummoner();
|
||||
if(owner)
|
||||
{
|
||||
if(owner->GetTypeId() == TYPEID_UNIT && ((Creature*)owner)->IsAIEnabled)
|
||||
((Creature*)owner)->AI()->JustSummoned(this);
|
||||
if(owner->GetTypeId() == TYPEID_UNIT && owner->ToCreature()->IsAIEnabled)
|
||||
owner->ToCreature()->AI()->JustSummoned(this);
|
||||
if(IsAIEnabled)
|
||||
AI()->IsSummonedBy(owner);
|
||||
}
|
||||
@@ -237,8 +237,8 @@ void TempSummon::UnSummon()
|
||||
}
|
||||
|
||||
Unit* owner = GetSummoner();
|
||||
if(owner && owner->GetTypeId() == TYPEID_UNIT && ((Creature*)owner)->IsAIEnabled)
|
||||
((Creature*)owner)->AI()->SummonedCreatureDespawn(this);
|
||||
if(owner && owner->GetTypeId() == TYPEID_UNIT && owner->ToCreature()->IsAIEnabled)
|
||||
owner->ToCreature()->AI()->SummonedCreatureDespawn(this);
|
||||
|
||||
AddObjectToRemoveList();
|
||||
}
|
||||
|
||||
@@ -129,7 +129,7 @@ void HostilReference::updateOnlineStatus()
|
||||
((getTarget()->GetTypeId() != TYPEID_PLAYER || !((Player*)getTarget())->isGameMaster()) ||
|
||||
!getTarget()->hasUnitState(UNIT_STAT_IN_FLIGHT)))
|
||||
{
|
||||
Creature* creature = (Creature*)getSourceUnit();
|
||||
Creature* creature = getSourceUnit()->ToCreature();
|
||||
online = getTarget()->isInAccessiblePlaceFor(creature);
|
||||
if (!online)
|
||||
{
|
||||
@@ -423,7 +423,7 @@ void ThreatManager::modifyThreatPercent(Unit *pVictim, int32 iPercent)
|
||||
Unit* ThreatManager::getHostilTarget()
|
||||
{
|
||||
iThreatContainer.update();
|
||||
HostilReference* nextVictim = iThreatContainer.selectNextVictim((Creature*) getOwner(), getCurrentVictim());
|
||||
HostilReference* nextVictim = iThreatContainer.selectNextVictim( getOwner()->ToCreature(), getCurrentVictim());
|
||||
setCurrentVictim(nextVictim);
|
||||
return getCurrentVictim() != NULL ? getCurrentVictim()->getTarget() : NULL;
|
||||
}
|
||||
|
||||
+113
-113
@@ -303,7 +303,7 @@ void Unit::SendMonsterMoveWithSpeed(float x, float y, float z, uint32 transitTim
|
||||
}
|
||||
else
|
||||
{
|
||||
Traveller<Creature> traveller(*(Creature*)this);
|
||||
Traveller<Creature> traveller(*this->ToCreature());
|
||||
transitTime = traveller.GetTotalTrevelTimeTo(x,y,z);
|
||||
}
|
||||
}
|
||||
@@ -520,7 +520,7 @@ void Unit::GetRandomContactPoint(const Unit* obj, float &x, float &y, float &z,
|
||||
{
|
||||
//sLog.outError("Unit %u (Type: %u) has invalid combat_reach %f",GetGUIDLow(),GetTypeId(),combat_reach);
|
||||
//if (GetTypeId() == TYPEID_UNIT)
|
||||
// sLog.outError("Creature entry %u has invalid combat_reach", ((Creature*)this)->GetEntry());
|
||||
// sLog.outError("Creature entry %u has invalid combat_reach", this->ToCreature()->GetEntry());
|
||||
combat_reach = DEFAULT_COMBAT_REACH;
|
||||
}
|
||||
uint32 attacker_number = getAttackers().size();
|
||||
@@ -555,7 +555,7 @@ bool Unit::HasAuraTypeWithFamilyFlags(AuraType auraType, uint32 familyName, uint
|
||||
|
||||
void Unit::DealDamageMods(Unit *pVictim, uint32 &damage, uint32* absorb)
|
||||
{
|
||||
if (!pVictim->isAlive() || pVictim->hasUnitState(UNIT_STAT_UNATTACKABLE) || pVictim->GetTypeId() == TYPEID_UNIT && ((Creature*)pVictim)->IsInEvadeMode())
|
||||
if (!pVictim->isAlive() || pVictim->hasUnitState(UNIT_STAT_UNATTACKABLE) || pVictim->GetTypeId() == TYPEID_UNIT && pVictim->ToCreature()->IsInEvadeMode())
|
||||
{
|
||||
if (absorb)
|
||||
absorb += damage;
|
||||
@@ -608,8 +608,8 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa
|
||||
}
|
||||
}
|
||||
|
||||
if (pVictim->GetTypeId() == TYPEID_UNIT && ((Creature*)pVictim)->IsAIEnabled)
|
||||
((Creature*)pVictim)->AI()->DamageTaken(this, damage);
|
||||
if (pVictim->GetTypeId() == TYPEID_UNIT && pVictim->ToCreature()->IsAIEnabled)
|
||||
pVictim->ToCreature()->AI()->DamageTaken(this, damage);
|
||||
|
||||
if (damagetype != NODAMAGE)
|
||||
{
|
||||
@@ -670,7 +670,7 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa
|
||||
{
|
||||
pVictim->setDeathState(JUST_DIED);
|
||||
|
||||
CreatureInfo const* cInfo = ((Creature*)pVictim)->GetCreatureInfo();
|
||||
CreatureInfo const* cInfo = pVictim->ToCreature()->GetCreatureInfo();
|
||||
if (cInfo && cInfo->lootid)
|
||||
pVictim->SetFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE);
|
||||
|
||||
@@ -724,11 +724,11 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa
|
||||
else if (!pVictim->IsControlledByPlayer())
|
||||
{
|
||||
//!pVictim->HasFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_OTHER_TAGGER)
|
||||
if (!((Creature*)pVictim)->hasLootRecipient())
|
||||
((Creature*)pVictim)->SetLootRecipient(this);
|
||||
if (!pVictim->ToCreature()->hasLootRecipient())
|
||||
pVictim->ToCreature()->SetLootRecipient(this);
|
||||
|
||||
if (IsControlledByPlayer())
|
||||
((Creature*)pVictim)->LowerPlayerDamageReq(health < damage ? health : damage);
|
||||
pVictim->ToCreature()->LowerPlayerDamageReq(health < damage ? health : damage);
|
||||
}
|
||||
|
||||
if (health <= damage)
|
||||
@@ -750,7 +750,7 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa
|
||||
if (pVictim->GetTypeId() == TYPEID_UNIT && this->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
Player *killer = this->ToPlayer();
|
||||
Creature *pCreature = ((Creature*)pVictim);
|
||||
Creature *pCreature = (pVictim->ToCreature());
|
||||
killer->GetSession()->HandleOnCreatureKill(pCreature);
|
||||
}
|
||||
}
|
||||
@@ -886,7 +886,7 @@ void Unit::CastSpell(Unit* Victim,SpellEntry const *spellInfo, bool triggered, I
|
||||
return;
|
||||
}
|
||||
|
||||
if (!originalCaster && GetTypeId() == TYPEID_UNIT && ((Creature*)this)->isTotem() && IsControlledByPlayer())
|
||||
if (!originalCaster && GetTypeId() == TYPEID_UNIT && this->ToCreature()->isTotem() && IsControlledByPlayer())
|
||||
if (Unit * owner = GetOwner())
|
||||
originalCaster=owner->GetGUID();
|
||||
|
||||
@@ -1215,7 +1215,7 @@ void Unit::DealSpellDamage(SpellNonMeleeDamage *damageInfo, bool durabilityLoss)
|
||||
if (!pVictim)
|
||||
return;
|
||||
|
||||
if (!pVictim->isAlive() || pVictim->hasUnitState(UNIT_STAT_UNATTACKABLE) || pVictim->GetTypeId() == TYPEID_UNIT && ((Creature*)pVictim)->IsInEvadeMode())
|
||||
if (!pVictim->isAlive() || pVictim->hasUnitState(UNIT_STAT_UNATTACKABLE) || pVictim->GetTypeId() == TYPEID_UNIT && pVictim->ToCreature()->IsInEvadeMode())
|
||||
return;
|
||||
|
||||
SpellEntry const *spellProto = sSpellStore.LookupEntry(damageInfo->SpellID);
|
||||
@@ -1473,7 +1473,7 @@ void Unit::DealMeleeDamage(CalcDamageInfo *damageInfo, bool durabilityLoss)
|
||||
if (!pVictim)
|
||||
return;
|
||||
|
||||
if (!pVictim->isAlive() || pVictim->hasUnitState(UNIT_STAT_UNATTACKABLE) || pVictim->GetTypeId() == TYPEID_UNIT && ((Creature*)pVictim)->IsInEvadeMode())
|
||||
if (!pVictim->isAlive() || pVictim->hasUnitState(UNIT_STAT_UNATTACKABLE) || pVictim->GetTypeId() == TYPEID_UNIT && pVictim->ToCreature()->IsInEvadeMode())
|
||||
return;
|
||||
|
||||
//You don't lose health from damage taken from another player while in a sanctuary
|
||||
@@ -1529,8 +1529,8 @@ void Unit::DealMeleeDamage(CalcDamageInfo *damageInfo, bool durabilityLoss)
|
||||
|
||||
// If this is a creature and it attacks from behind it has a probability to daze it's victim
|
||||
if ((damageInfo->hitOutCome==MELEE_HIT_CRIT || damageInfo->hitOutCome==MELEE_HIT_CRUSHING || damageInfo->hitOutCome==MELEE_HIT_NORMAL || damageInfo->hitOutCome==MELEE_HIT_GLANCING) &&
|
||||
GetTypeId() != TYPEID_PLAYER && !((Creature*)this)->IsControlledByPlayer() && !pVictim->HasInArc(M_PI, this)
|
||||
&& (pVictim->GetTypeId() == TYPEID_PLAYER || !((Creature*)pVictim)->isWorldBoss()))
|
||||
GetTypeId() != TYPEID_PLAYER && !this->ToCreature()->IsControlledByPlayer() && !pVictim->HasInArc(M_PI, this)
|
||||
&& (pVictim->GetTypeId() == TYPEID_PLAYER || !pVictim->ToCreature()->isWorldBoss()))
|
||||
{
|
||||
// -probability is between 0% and 40%
|
||||
// 20% base chance
|
||||
@@ -2288,8 +2288,8 @@ void Unit::AttackerStateUpdate (Unit *pVictim, WeaponAttackType attType, bool ex
|
||||
GetGUIDLow(), pVictim->GetGUIDLow(), pVictim->GetTypeId(), damageInfo.damage, damageInfo.absorb, damageInfo.blocked_amount, damageInfo.resist);
|
||||
|
||||
// if damage pVictim call AI reaction
|
||||
//if (pVictim->GetTypeId() == TYPEID_UNIT && ((Creature*)pVictim)->AI())
|
||||
// ((Creature*)pVictim)->AI()->AttackedBy(this);
|
||||
//if (pVictim->GetTypeId() == TYPEID_UNIT && pVictim->ToCreature()->AI())
|
||||
// pVictim->ToCreature()->AI()->AttackedBy(this);
|
||||
|
||||
}
|
||||
|
||||
@@ -2317,7 +2317,7 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst(const Unit *pVictim, WeaponAttackT
|
||||
|
||||
MeleeHitOutcome Unit::RollMeleeOutcomeAgainst (const Unit *pVictim, WeaponAttackType attType, int32 crit_chance, int32 miss_chance, int32 dodge_chance, int32 parry_chance, int32 block_chance) const
|
||||
{
|
||||
if (pVictim->GetTypeId() == TYPEID_UNIT && ((Creature*)pVictim)->IsInEvadeMode())
|
||||
if (pVictim->GetTypeId() == TYPEID_UNIT && pVictim->ToCreature()->IsInEvadeMode())
|
||||
return MELEE_HIT_EVADE;
|
||||
|
||||
int32 attackerMaxSkillValueForLevel = GetMaxSkillValueForLevel(pVictim);
|
||||
@@ -2394,7 +2394,7 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst (const Unit *pVictim, WeaponAttack
|
||||
else
|
||||
parry_chance -= GetTotalAuraModifier(SPELL_AURA_MOD_EXPERTISE)*25;
|
||||
|
||||
if (pVictim->GetTypeId() == TYPEID_PLAYER || !(((Creature*)pVictim)->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_NO_PARRY) )
|
||||
if (pVictim->GetTypeId() == TYPEID_PLAYER || !(pVictim->ToCreature()->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_NO_PARRY) )
|
||||
{
|
||||
int32 tmp2 = int32(parry_chance);
|
||||
if (tmp2 > 0 // check if unit _can_ parry
|
||||
@@ -2406,7 +2406,7 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst (const Unit *pVictim, WeaponAttack
|
||||
}
|
||||
}
|
||||
|
||||
if (pVictim->GetTypeId() == TYPEID_PLAYER || !(((Creature*)pVictim)->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_NO_BLOCK) )
|
||||
if (pVictim->GetTypeId() == TYPEID_PLAYER || !(pVictim->ToCreature()->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_NO_BLOCK) )
|
||||
{
|
||||
tmp = block_chance;
|
||||
if (tmp > 0 // check if unit _can_ block
|
||||
@@ -2425,7 +2425,7 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst (const Unit *pVictim, WeaponAttack
|
||||
if (tmp > 0 && roll < (sum += tmp))
|
||||
{
|
||||
DEBUG_LOG ("RollMeleeOutcomeAgainst: CRIT <%d, %d)", sum-tmp, sum);
|
||||
if (GetTypeId() == TYPEID_UNIT && (((Creature*)this)->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_NO_CRIT))
|
||||
if (GetTypeId() == TYPEID_UNIT && (this->ToCreature()->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_NO_CRIT))
|
||||
DEBUG_LOG ("RollMeleeOutcomeAgainst: CRIT DISABLED)");
|
||||
else
|
||||
return MELEE_HIT_CRIT;
|
||||
@@ -2433,8 +2433,8 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst (const Unit *pVictim, WeaponAttack
|
||||
|
||||
// Max 40% chance to score a glancing blow against mobs that are higher level (can do only players and pets and not with ranged weapon)
|
||||
if (attType != RANGED_ATTACK &&
|
||||
(GetTypeId() == TYPEID_PLAYER || ((Creature*)this)->isPet()) &&
|
||||
pVictim->GetTypeId() != TYPEID_PLAYER && !((Creature*)pVictim)->isPet() &&
|
||||
(GetTypeId() == TYPEID_PLAYER || this->ToCreature()->isPet()) &&
|
||||
pVictim->GetTypeId() != TYPEID_PLAYER && !pVictim->ToCreature()->isPet() &&
|
||||
getLevel() < pVictim->getLevelForTarget(this))
|
||||
{
|
||||
// cap possible value (with bonuses > max skill)
|
||||
@@ -2455,7 +2455,7 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst (const Unit *pVictim, WeaponAttack
|
||||
if (getLevelForTarget(pVictim) >= pVictim->getLevelForTarget(this) + 4 &&
|
||||
// can be from by creature (if can) or from controlled player that considered as creature
|
||||
!IsControlledByPlayer() &&
|
||||
!(GetTypeId() == TYPEID_UNIT && ((Creature*)this)->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_NO_CRUSH))
|
||||
!(GetTypeId() == TYPEID_UNIT && this->ToCreature()->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_NO_CRUSH))
|
||||
{
|
||||
// when their weapon skill is 15 or more above victim's defense skill
|
||||
tmp = victimDefenseSkill;
|
||||
@@ -2560,7 +2560,7 @@ void Unit::SendMeleeAttackStop(Unit* victim)
|
||||
sLog.outDetail("%s %u stopped attacking %s %u", (GetTypeId() == TYPEID_PLAYER ? "player" : "creature"), GetGUIDLow(), (victim->GetTypeId() == TYPEID_PLAYER ? "player" : "creature"),victim->GetGUIDLow());
|
||||
|
||||
/*if (victim->GetTypeId() == TYPEID_UNIT)
|
||||
((Creature*)victim)->AI().EnterEvadeMode(this);*/
|
||||
victim->ToCreature()->AI().EnterEvadeMode(this);*/
|
||||
}
|
||||
|
||||
bool Unit::isSpellBlocked(Unit *pVictim, SpellEntry const * /*spellProto*/, WeaponAttackType attackType)
|
||||
@@ -2581,7 +2581,7 @@ bool Unit::isSpellBlocked(Unit *pVictim, SpellEntry const * /*spellProto*/, Weap
|
||||
|
||||
// Check creatures flags_extra for disable block
|
||||
if (pVictim->GetTypeId() == TYPEID_UNIT &&
|
||||
((Creature*)pVictim)->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_NO_BLOCK )
|
||||
pVictim->ToCreature()->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_NO_BLOCK )
|
||||
return false;
|
||||
|
||||
float blockChance = pVictim->GetUnitBlockChance();
|
||||
@@ -2752,7 +2752,7 @@ SpellMissInfo Unit::MeleeSpellHitResult(Unit *pVictim, SpellEntry const *spell)
|
||||
// Check creatures flags_extra for disable parry
|
||||
if (pVictim->GetTypeId() == TYPEID_UNIT)
|
||||
{
|
||||
uint32 flagEx = ((Creature*)pVictim)->GetCreatureInfo()->flags_extra;
|
||||
uint32 flagEx = pVictim->ToCreature()->GetCreatureInfo()->flags_extra;
|
||||
if (flagEx & CREATURE_FLAG_EXTRA_NO_PARRY)
|
||||
canParry = false;
|
||||
// Check creatures flags_extra for disable block
|
||||
@@ -2913,7 +2913,7 @@ SpellMissInfo Unit::MagicSpellHitResult(Unit *pVictim, SpellEntry const *spell)
|
||||
SpellMissInfo Unit::SpellHitResult(Unit *pVictim, SpellEntry const *spell, bool CanReflect)
|
||||
{
|
||||
// Return evade for units in evade mode
|
||||
if (pVictim->GetTypeId() == TYPEID_UNIT && ((Creature*)pVictim)->IsInEvadeMode() && this != pVictim)
|
||||
if (pVictim->GetTypeId() == TYPEID_UNIT && pVictim->ToCreature()->IsInEvadeMode() && this != pVictim)
|
||||
return SPELL_MISS_EVADE;
|
||||
|
||||
// Check for immune
|
||||
@@ -3734,7 +3734,7 @@ void Unit::_UnapplyAura(AuraApplicationMap::iterator &i, AuraRemoveMode removeMo
|
||||
assert(!aurApp->GetEffectMask());
|
||||
|
||||
// Remove totem at next update if totem looses its aura
|
||||
if (aurApp->GetRemoveMode() == AURA_REMOVE_BY_EXPIRE && GetTypeId() == TYPEID_UNIT && ((Creature*)this)->isTotem()&& ((TempSummon*)this)->GetSummonerGUID() == aura->GetCasterGUID())
|
||||
if (aurApp->GetRemoveMode() == AURA_REMOVE_BY_EXPIRE && GetTypeId() == TYPEID_UNIT && this->ToCreature()->isTotem()&& ((TempSummon*)this)->GetSummonerGUID() == aura->GetCasterGUID())
|
||||
{
|
||||
if (((Totem*)this)->GetSpell() == aura->GetId() && ((Totem*)this)->GetTotemType() == TOTEM_PASSIVE)
|
||||
((Totem*)this)->setDeathState(JUST_DIED);
|
||||
@@ -8603,7 +8603,7 @@ void Unit::setPowerType(Powers new_powertype)
|
||||
if(this->ToPlayer()->GetGroup())
|
||||
this->ToPlayer()->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_POWER_TYPE);
|
||||
}
|
||||
else if(((Creature*)this)->isPet())
|
||||
else if(this->ToCreature()->isPet())
|
||||
{
|
||||
Pet *pet = ((Pet*)this);
|
||||
if(pet->isControlled())
|
||||
@@ -8649,7 +8649,7 @@ FactionTemplateEntry const* Unit::getFactionTemplateEntry() const
|
||||
if(GetTypeId() == TYPEID_PLAYER)
|
||||
sLog.outError("Player %s have invalid faction (faction template id) #%u", this->ToPlayer()->GetName(), getFaction());
|
||||
else
|
||||
sLog.outError("Creature (template id: %u) have invalid faction (faction template id) #%u", ((Creature*)this)->GetCreatureInfo()->Entry, getFaction());
|
||||
sLog.outError("Creature (template id: %u) have invalid faction (faction template id) #%u", this->ToCreature()->GetCreatureInfo()->Entry, getFaction());
|
||||
guid = GetGUID();
|
||||
}
|
||||
}
|
||||
@@ -8935,7 +8935,7 @@ bool Unit::Attack(Unit *victim, bool meleeAttack)
|
||||
}
|
||||
else
|
||||
{
|
||||
if(((Creature*)victim)->IsInEvadeMode())
|
||||
if(victim->ToCreature()->IsInEvadeMode())
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -8986,7 +8986,7 @@ bool Unit::Attack(Unit *victim, bool meleeAttack)
|
||||
|
||||
// set position before any AI calls/assistance
|
||||
//if(GetTypeId() == TYPEID_UNIT)
|
||||
// ((Creature*)this)->SetCombatStartPosition(GetPositionX(), GetPositionY(), GetPositionZ());
|
||||
// this->ToCreature()->SetCombatStartPosition(GetPositionX(), GetPositionY(), GetPositionZ());
|
||||
|
||||
if (GetTypeId() == TYPEID_UNIT)
|
||||
{
|
||||
@@ -8996,8 +8996,8 @@ bool Unit::Attack(Unit *victim, bool meleeAttack)
|
||||
victim->SetInCombatWith(this);
|
||||
AddThreat(victim, 0.0f);
|
||||
|
||||
((Creature*)this)->SendAIReaction(AI_REACTION_AGGRO);
|
||||
((Creature*)this)->CallAssistance();
|
||||
this->ToCreature()->SendAIReaction(AI_REACTION_AGGRO);
|
||||
this->ToCreature()->CallAssistance();
|
||||
}
|
||||
|
||||
// delay offhand weapon attack to next attack time
|
||||
@@ -9030,11 +9030,11 @@ bool Unit::AttackStop()
|
||||
// reset only at real combat stop
|
||||
if (GetTypeId() == TYPEID_UNIT)
|
||||
{
|
||||
((Creature*)this)->SetNoCallAssistance(false);
|
||||
this->ToCreature()->SetNoCallAssistance(false);
|
||||
|
||||
if (((Creature*)this)->HasSearchedAssistance())
|
||||
if (this->ToCreature()->HasSearchedAssistance())
|
||||
{
|
||||
((Creature*)this)->SetNoSearchAssistance(false);
|
||||
this->ToCreature()->SetNoSearchAssistance(false);
|
||||
UpdateSpeed(MOVE_RUN, false);
|
||||
}
|
||||
}
|
||||
@@ -9114,7 +9114,7 @@ void Unit::ModifyAuraState(AuraState flag, bool apply)
|
||||
CastSpell(this, itr->first, true, NULL);
|
||||
}
|
||||
}
|
||||
else if (((Creature*)this)->isPet())
|
||||
else if (this->ToCreature()->isPet())
|
||||
{
|
||||
Pet *pet = ((Pet*)this);
|
||||
for (PetSpellMap::const_iterator itr = pet->m_spells.begin(); itr != pet->m_spells.end(); ++itr)
|
||||
@@ -9416,8 +9416,8 @@ void Unit::GetAllMinionsByEntry(std::list<Creature*>& Minions, uint32 entry)
|
||||
Unit *unit = *itr;
|
||||
++itr;
|
||||
if (unit->GetEntry() == entry && unit->GetTypeId() == TYPEID_UNIT
|
||||
&& ((Creature*)unit)->isSummon()) // minion, actually
|
||||
Minions.push_back((Creature*)unit);
|
||||
&& unit->ToCreature()->isSummon()) // minion, actually
|
||||
Minions.push_back(unit->ToCreature());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9428,7 +9428,7 @@ void Unit::RemoveAllMinionsByEntry(uint32 entry)
|
||||
Unit *unit = *itr;
|
||||
++itr;
|
||||
if (unit->GetEntry() == entry && unit->GetTypeId() == TYPEID_UNIT
|
||||
&& ((Creature*)unit)->isSummon()) // minion, actually
|
||||
&& unit->ToCreature()->isSummon()) // minion, actually
|
||||
((TempSummon*)unit)->UnSummon();
|
||||
// i think this is safe because i have never heard that a despawned minion will trigger a same minion
|
||||
}
|
||||
@@ -9495,7 +9495,7 @@ void Unit::SetCharm(Unit* charm, bool apply)
|
||||
}
|
||||
|
||||
if (charm->GetTypeId() == TYPEID_PLAYER
|
||||
|| !((Creature*)charm)->HasUnitTypeMask(UNIT_MASK_MINION)
|
||||
|| !charm->ToCreature()->HasUnitTypeMask(UNIT_MASK_MINION)
|
||||
|| charm->GetOwnerGUID() != GetGUID())
|
||||
m_Controlled.erase(charm);
|
||||
}
|
||||
@@ -9507,7 +9507,7 @@ int32 Unit::DealHeal(Unit *pVictim, uint32 addhealth, SpellEntry const *spellPro
|
||||
|
||||
Unit* unit = this;
|
||||
|
||||
if (GetTypeId() == TYPEID_UNIT && ((Creature*)this)->isTotem())
|
||||
if (GetTypeId() == TYPEID_UNIT && this->ToCreature()->isTotem())
|
||||
unit = GetOwner();
|
||||
|
||||
if (unit->GetTypeId() == TYPEID_PLAYER)
|
||||
@@ -9614,7 +9614,7 @@ Unit* Unit::GetNextRandomRaidMemberOrPet(float radius)
|
||||
if (GetTypeId() == TYPEID_PLAYER)
|
||||
player = (Player*)this;
|
||||
// Should we enable this also for charmed units?
|
||||
else if (GetTypeId() == TYPEID_UNIT && ((Creature*)this)->isPet())
|
||||
else if (GetTypeId() == TYPEID_UNIT && this->ToCreature()->isPet())
|
||||
player = (Player*)GetOwner();
|
||||
|
||||
if (!player)
|
||||
@@ -9756,7 +9756,7 @@ uint32 Unit::SpellDamageBonus(Unit *pVictim, SpellEntry const *spellProto, uint3
|
||||
return pdamage;
|
||||
|
||||
// For totems get damage bonus from owner
|
||||
if (GetTypeId() == TYPEID_UNIT && ((Creature*)this)->isTotem())
|
||||
if (GetTypeId() == TYPEID_UNIT && this->ToCreature()->isTotem())
|
||||
if (Unit *owner = GetOwner())
|
||||
return owner->SpellDamageBonus(pVictim, spellProto, pdamage, damagetype);
|
||||
|
||||
@@ -9768,8 +9768,8 @@ uint32 Unit::SpellDamageBonus(Unit *pVictim, SpellEntry const *spellProto, uint3
|
||||
|
||||
// ..done
|
||||
// Pet damage
|
||||
if (GetTypeId() == TYPEID_UNIT && !((Creature*)this)->isPet())
|
||||
DoneTotalMod *= ((Creature*)this)->GetSpellDamageMod(((Creature*)this)->GetCreatureInfo()->rank);
|
||||
if (GetTypeId() == TYPEID_UNIT && !this->ToCreature()->isPet())
|
||||
DoneTotalMod *= this->ToCreature()->GetSpellDamageMod(this->ToCreature()->GetCreatureInfo()->rank);
|
||||
|
||||
AuraEffectList const &mModDamagePercentDone = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_PERCENT_DONE);
|
||||
for (AuraEffectList::const_iterator i = mModDamagePercentDone.begin(); i != mModDamagePercentDone.end(); ++i)
|
||||
@@ -10479,7 +10479,7 @@ uint32 Unit::SpellCriticalHealingBonus(SpellEntry const *spellProto, uint32 dama
|
||||
uint32 Unit::SpellHealingBonus(Unit *pVictim, SpellEntry const *spellProto, uint32 healamount, DamageEffectType damagetype, uint32 stack)
|
||||
{
|
||||
// For totems get healing bonus from owner (statue isn't totem in fact)
|
||||
if (GetTypeId() == TYPEID_UNIT && ((Creature*)this)->isTotem())
|
||||
if (GetTypeId() == TYPEID_UNIT && this->ToCreature()->isTotem())
|
||||
if (Unit* owner = GetOwner())
|
||||
return owner->SpellHealingBonus(pVictim, spellProto, healamount, damagetype, stack);
|
||||
|
||||
@@ -11404,9 +11404,9 @@ void Unit::CombatStart(Unit* target, bool initialAggro)
|
||||
target->SetStandState(UNIT_STAND_STATE_STAND);
|
||||
|
||||
if (!target->isInCombat() && target->GetTypeId() != TYPEID_PLAYER
|
||||
&& !((Creature*)target)->HasReactState(REACT_PASSIVE) && ((Creature*)target)->IsAIEnabled)
|
||||
&& !target->ToCreature()->HasReactState(REACT_PASSIVE) && target->ToCreature()->IsAIEnabled)
|
||||
{
|
||||
((Creature*)target)->AI()->AttackStart(this);
|
||||
target->ToCreature()->AI()->AttackStart(this);
|
||||
}
|
||||
|
||||
SetInCombatWith(target);
|
||||
@@ -11443,17 +11443,17 @@ void Unit::SetInCombatState(bool PvP, Unit* enemy)
|
||||
if (GetTypeId() != TYPEID_PLAYER)
|
||||
{
|
||||
// Set home position at place of engaging combat for escorted creatures
|
||||
if (( IsAIEnabled && ((Creature*)this)->AI()->IsEscorted() ) ||
|
||||
if (( IsAIEnabled && this->ToCreature()->AI()->IsEscorted() ) ||
|
||||
GetMotionMaster()->GetCurrentMovementGeneratorType() == WAYPOINT_MOTION_TYPE ||
|
||||
GetMotionMaster()->GetCurrentMovementGeneratorType() == POINT_MOTION_TYPE)
|
||||
((Creature*)this)->SetHomePosition(GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation());
|
||||
this->ToCreature()->SetHomePosition(GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation());
|
||||
|
||||
if (enemy)
|
||||
{
|
||||
if (IsAIEnabled)
|
||||
((Creature*)this)->AI()->EnterCombat(enemy);
|
||||
if (((Creature*)this)->GetFormation())
|
||||
((Creature*)this)->GetFormation()->MemberAttackStart((Creature*)this, enemy);
|
||||
this->ToCreature()->AI()->EnterCombat(enemy);
|
||||
if (this->ToCreature()->GetFormation())
|
||||
this->ToCreature()->GetFormation()->MemberAttackStart(this->ToCreature(), enemy);
|
||||
}
|
||||
|
||||
if (isPet())
|
||||
@@ -11818,7 +11818,7 @@ void Unit::UpdateSpeed(UnitMoveType mtype, bool forced)
|
||||
{
|
||||
// Set creature speed rate from CreatureInfo
|
||||
if (GetTypeId() == TYPEID_UNIT)
|
||||
speed *= ((Creature*)this)->GetCreatureInfo()->speed;
|
||||
speed *= this->ToCreature()->GetCreatureInfo()->speed;
|
||||
|
||||
// Normalize speed by 191 aura SPELL_AURA_USE_NORMAL_MOVEMENT_SPEED if need
|
||||
// TODO: possible affect only on MOVE_RUN
|
||||
@@ -11838,7 +11838,7 @@ void Unit::UpdateSpeed(UnitMoveType mtype, bool forced)
|
||||
// for creature case, we check explicit if mob searched for assistance
|
||||
if (GetTypeId() == TYPEID_UNIT)
|
||||
{
|
||||
if (((Creature*)this)->HasSearchedAssistance())
|
||||
if (this->ToCreature()->HasSearchedAssistance())
|
||||
speed *= 0.66f; // best guessed value, so this will be 33% reduction. Based off initial speed, mob can then "run", "walk fast" or "walk".
|
||||
}
|
||||
|
||||
@@ -12047,11 +12047,11 @@ bool Unit::CanHaveThreatList() const
|
||||
return false;
|
||||
|
||||
// totems can not have threat list
|
||||
if (((Creature*)this)->isTotem())
|
||||
if (this->ToCreature()->isTotem())
|
||||
return false;
|
||||
|
||||
// vehicles can not have threat list
|
||||
//if (((Creature*)this)->IsVehicle())
|
||||
//if (this->ToCreature()->IsVehicle())
|
||||
// return false;
|
||||
|
||||
// summons can not have a threat list, unless they are controlled by a creature
|
||||
@@ -12103,7 +12103,7 @@ void Unit::TauntApply(Unit* taunter)
|
||||
if (!CanHaveThreatList())
|
||||
return;
|
||||
|
||||
if (((Creature*)this)->HasReactState(REACT_PASSIVE))
|
||||
if (this->ToCreature()->HasReactState(REACT_PASSIVE))
|
||||
return;
|
||||
|
||||
Unit *target = getVictim();
|
||||
@@ -12111,8 +12111,8 @@ void Unit::TauntApply(Unit* taunter)
|
||||
return;
|
||||
|
||||
SetInFront(taunter);
|
||||
if (((Creature*)this)->IsAIEnabled)
|
||||
((Creature*)this)->AI()->AttackStart(taunter);
|
||||
if (this->ToCreature()->IsAIEnabled)
|
||||
this->ToCreature()->AI()->AttackStart(taunter);
|
||||
|
||||
//m_ThreatManager.tauntApply(taunter);
|
||||
}
|
||||
@@ -12129,7 +12129,7 @@ void Unit::TauntFadeOut(Unit *taunter)
|
||||
if (!CanHaveThreatList())
|
||||
return;
|
||||
|
||||
if (((Creature*)this)->HasReactState(REACT_PASSIVE))
|
||||
if (this->ToCreature()->HasReactState(REACT_PASSIVE))
|
||||
return;
|
||||
|
||||
Unit *target = getVictim();
|
||||
@@ -12138,8 +12138,8 @@ void Unit::TauntFadeOut(Unit *taunter)
|
||||
|
||||
if (m_ThreatManager.isThreatListEmpty())
|
||||
{
|
||||
if (((Creature*)this)->IsAIEnabled)
|
||||
((Creature*)this)->AI()->EnterEvadeMode();
|
||||
if (this->ToCreature()->IsAIEnabled)
|
||||
this->ToCreature()->AI()->EnterEvadeMode();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -12149,8 +12149,8 @@ void Unit::TauntFadeOut(Unit *taunter)
|
||||
if (target && target != taunter)
|
||||
{
|
||||
SetInFront(target);
|
||||
if (((Creature*)this)->IsAIEnabled)
|
||||
((Creature*)this)->AI()->AttackStart(target);
|
||||
if (this->ToCreature()->IsAIEnabled)
|
||||
this->ToCreature()->AI()->AttackStart(target);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12183,7 +12183,7 @@ Unit* Creature::SelectVictim()
|
||||
{
|
||||
--aura;
|
||||
if ((caster = (*aura)->GetCaster()) &&
|
||||
caster->IsInMap(this) && canAttack(caster) && caster->isInAccessiblePlaceFor((Creature*)this))
|
||||
caster->IsInMap(this) && canAttack(caster) && caster->isInAccessiblePlaceFor(this->ToCreature()))
|
||||
{
|
||||
target = caster;
|
||||
break;
|
||||
@@ -12240,7 +12240,7 @@ Unit* Creature::SelectVictim()
|
||||
for (AttackerSet::const_iterator itr = m_attackers.begin(); itr != m_attackers.end(); ++itr)
|
||||
{
|
||||
if ((*itr) && !canCreatureAttack(*itr) && (*itr)->GetTypeId() != TYPEID_PLAYER
|
||||
&& !((Creature*)(*itr))->HasUnitTypeMask(UNIT_MASK_CONTROLABLE_GUARDIAN))
|
||||
&& !(*itr)->ToCreature()->HasUnitTypeMask(UNIT_MASK_CONTROLABLE_GUARDIAN))
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -12637,7 +12637,7 @@ uint32 Unit::GetCreatureType() const
|
||||
return CREATURE_TYPE_HUMANOID;
|
||||
}
|
||||
else
|
||||
return ((Creature*)this)->GetCreatureInfo()->type;
|
||||
return this->ToCreature()->GetCreatureInfo()->type;
|
||||
}
|
||||
|
||||
/*#######################################
|
||||
@@ -12877,7 +12877,7 @@ void Unit::SetHealth(uint32 val)
|
||||
if (this->ToPlayer()->GetGroup())
|
||||
this->ToPlayer()->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_CUR_HP);
|
||||
}
|
||||
else if (((Creature*)this)->isPet())
|
||||
else if (this->ToCreature()->isPet())
|
||||
{
|
||||
Pet *pet = ((Pet*)this);
|
||||
if (pet->isControlled())
|
||||
@@ -12903,7 +12903,7 @@ void Unit::SetMaxHealth(uint32 val)
|
||||
if (this->ToPlayer()->GetGroup())
|
||||
this->ToPlayer()->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_MAX_HP);
|
||||
}
|
||||
else if (((Creature*)this)->isPet())
|
||||
else if (this->ToCreature()->isPet())
|
||||
{
|
||||
Pet *pet = ((Pet*)this);
|
||||
if (pet->isControlled())
|
||||
@@ -12941,7 +12941,7 @@ void Unit::SetPower(Powers power, uint32 val)
|
||||
if (this->ToPlayer()->GetGroup())
|
||||
this->ToPlayer()->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_CUR_POWER);
|
||||
}
|
||||
else if (((Creature*)this)->isPet())
|
||||
else if (this->ToCreature()->isPet())
|
||||
{
|
||||
Pet *pet = ((Pet*)this);
|
||||
if (pet->isControlled())
|
||||
@@ -12968,7 +12968,7 @@ void Unit::SetMaxPower(Powers power, uint32 val)
|
||||
if (this->ToPlayer()->GetGroup())
|
||||
this->ToPlayer()->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_MAX_POWER);
|
||||
}
|
||||
else if (((Creature*)this)->isPet())
|
||||
else if (this->ToCreature()->isPet())
|
||||
{
|
||||
Pet *pet = ((Pet*)this);
|
||||
if (pet->isControlled())
|
||||
@@ -12993,7 +12993,7 @@ void Unit::ApplyPowerMod(Powers power, uint32 val, bool apply)
|
||||
if (this->ToPlayer()->GetGroup())
|
||||
this->ToPlayer()->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_CUR_POWER);
|
||||
}
|
||||
else if (((Creature*)this)->isPet())
|
||||
else if (this->ToCreature()->isPet())
|
||||
{
|
||||
Pet *pet = ((Pet*)this);
|
||||
if (pet->isControlled())
|
||||
@@ -13015,7 +13015,7 @@ void Unit::ApplyMaxPowerMod(Powers power, uint32 val, bool apply)
|
||||
if (this->ToPlayer()->GetGroup())
|
||||
this->ToPlayer()->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_MAX_POWER);
|
||||
}
|
||||
else if (((Creature*)this)->isPet())
|
||||
else if (this->ToCreature()->isPet())
|
||||
{
|
||||
Pet *pet = ((Pet*)this);
|
||||
if (pet->isControlled())
|
||||
@@ -13139,9 +13139,9 @@ void Unit::UpdateCharmAI()
|
||||
{
|
||||
i_disabledAI = i_AI;
|
||||
if (isPossessed() || IsVehicle())
|
||||
i_AI = new PossessedAI((Creature*)this);
|
||||
i_AI = new PossessedAI(this->ToCreature());
|
||||
else
|
||||
i_AI = new PetAI((Creature*)this);
|
||||
i_AI = new PetAI(this->ToCreature());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -13171,8 +13171,8 @@ CharmInfo::CharmInfo(Unit* unit)
|
||||
|
||||
if (m_unit->GetTypeId() == TYPEID_UNIT)
|
||||
{
|
||||
m_oldReactState = ((Creature*)m_unit)->GetReactState();
|
||||
((Creature*)m_unit)->SetReactState(REACT_PASSIVE);
|
||||
m_oldReactState = m_unit->ToCreature()->GetReactState();
|
||||
m_unit->ToCreature()->SetReactState(REACT_PASSIVE);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -13181,7 +13181,7 @@ CharmInfo::~CharmInfo()
|
||||
{
|
||||
if (m_unit->GetTypeId() == TYPEID_UNIT)
|
||||
{
|
||||
((Creature*)m_unit)->SetReactState(m_oldReactState);
|
||||
m_unit->ToCreature()->SetReactState(m_oldReactState);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13217,14 +13217,14 @@ void CharmInfo::InitPossessCreateSpells()
|
||||
{
|
||||
for (uint32 i = 0; i < CREATURE_MAX_SPELLS; ++i)
|
||||
{
|
||||
uint32 spellId = ((Creature*)m_unit)->m_spells[i];
|
||||
uint32 spellId = m_unit->ToCreature()->m_spells[i];
|
||||
SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellId);
|
||||
if (spellInfo && spellInfo->Attributes & SPELL_ATTR_CASTABLE_WHILE_DEAD)
|
||||
spellId = 0;
|
||||
if (IsPassiveSpell(spellId))
|
||||
m_unit->CastSpell(m_unit, spellId, true);
|
||||
else
|
||||
AddSpellToActionBar(((Creature*)m_unit)->m_spells[i], ACT_PASSIVE);
|
||||
AddSpellToActionBar(m_unit->ToCreature()->m_spells[i], ACT_PASSIVE);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -13241,7 +13241,7 @@ void CharmInfo::InitCharmCreateSpells()
|
||||
|
||||
for (uint32 x = 0; x < MAX_SPELL_CHARM; ++x)
|
||||
{
|
||||
uint32 spellId = ((Creature*)m_unit)->m_spells[x];
|
||||
uint32 spellId = m_unit->ToCreature()->m_spells[x];
|
||||
SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellId);
|
||||
if (spellInfo && spellInfo->Attributes & SPELL_ATTR_CASTABLE_WHILE_DEAD)
|
||||
spellId = 0;
|
||||
@@ -13842,7 +13842,7 @@ Player* Unit::GetSpellModOwner() const
|
||||
{
|
||||
if (GetTypeId() == TYPEID_PLAYER)
|
||||
return (Player*)this;
|
||||
if (((Creature*)this)->isPet() || ((Creature*)this)->isTotem())
|
||||
if (this->ToCreature()->isPet() || this->ToCreature()->isTotem())
|
||||
{
|
||||
Unit* owner = GetOwner();
|
||||
if (owner && owner->GetTypeId() == TYPEID_PLAYER)
|
||||
@@ -13980,7 +13980,7 @@ void Unit::SetDisplayId(uint32 modelId)
|
||||
{
|
||||
SetUInt32Value(UNIT_FIELD_DISPLAYID, modelId);
|
||||
|
||||
if (GetTypeId() == TYPEID_UNIT && ((Creature*)this)->isPet())
|
||||
if (GetTypeId() == TYPEID_UNIT && this->ToCreature()->isPet())
|
||||
{
|
||||
Pet *pet = ((Pet*)this);
|
||||
if (!pet->isControlled())
|
||||
@@ -14120,7 +14120,7 @@ void Unit::ApplyCastTimePercentMod(float val, bool apply )
|
||||
uint32 Unit::GetCastingTimeForBonus( SpellEntry const *spellProto, DamageEffectType damagetype, uint32 CastingTime )
|
||||
{
|
||||
// Not apply this to creature casted spells with casttime==0
|
||||
if (CastingTime==0 && GetTypeId() == TYPEID_UNIT && !((Creature*)this)->isPet())
|
||||
if (CastingTime==0 && GetTypeId() == TYPEID_UNIT && !this->ToCreature()->isPet())
|
||||
return 3500;
|
||||
|
||||
if (CastingTime > 7000) CastingTime = 7000;
|
||||
@@ -14220,7 +14220,7 @@ void Unit::UpdateAuraForGroup(uint8 slot)
|
||||
player->SetAuraUpdateMaskForRaid(slot);
|
||||
}
|
||||
}
|
||||
else if (GetTypeId() == TYPEID_UNIT && ((Creature*)this)->isPet())
|
||||
else if (GetTypeId() == TYPEID_UNIT && this->ToCreature()->isPet())
|
||||
{
|
||||
Pet *pet = ((Pet*)this);
|
||||
if (pet->isControlled())
|
||||
@@ -14577,13 +14577,13 @@ void Unit::Kill(Unit *pVictim, bool durabilityLoss)
|
||||
bool bRewardIsAllowed = true;
|
||||
if (pVictim->GetTypeId() == TYPEID_UNIT)
|
||||
{
|
||||
bRewardIsAllowed = ((Creature*)pVictim)->IsDamageEnoughForLootingAndReward();
|
||||
bRewardIsAllowed = pVictim->ToCreature()->IsDamageEnoughForLootingAndReward();
|
||||
if (!bRewardIsAllowed)
|
||||
((Creature*)pVictim)->SetLootRecipient(NULL);
|
||||
pVictim->ToCreature()->SetLootRecipient(NULL);
|
||||
}
|
||||
|
||||
if (bRewardIsAllowed && pVictim->GetTypeId() == TYPEID_UNIT && ((Creature*)pVictim)->GetLootRecipient())
|
||||
player = ((Creature*)pVictim)->GetLootRecipient();
|
||||
if (bRewardIsAllowed && pVictim->GetTypeId() == TYPEID_UNIT && pVictim->ToCreature()->GetLootRecipient())
|
||||
player = pVictim->ToCreature()->GetLootRecipient();
|
||||
// Reward player, his pets, and group/raid members
|
||||
// call kill spell proc event (before real die and combat stop to triggering auras removed at death/combat stop)
|
||||
if (bRewardIsAllowed && player && player!=pVictim)
|
||||
@@ -14655,8 +14655,8 @@ void Unit::Kill(Unit *pVictim, bool durabilityLoss)
|
||||
pVictim->ToPlayer()->GetSession()->SendPacket(&data);
|
||||
}
|
||||
// Call KilledUnit for creatures
|
||||
if (GetTypeId() == TYPEID_UNIT && ((Creature*)this)->IsAIEnabled)
|
||||
((Creature*)this)->AI()->KilledUnit(pVictim);
|
||||
if (GetTypeId() == TYPEID_UNIT && this->ToCreature()->IsAIEnabled)
|
||||
this->ToCreature()->AI()->KilledUnit(pVictim);
|
||||
|
||||
// last damage from non duel opponent or opponent controlled creature
|
||||
if (pVictim->ToPlayer()->duel)
|
||||
@@ -14669,7 +14669,7 @@ void Unit::Kill(Unit *pVictim, bool durabilityLoss)
|
||||
else // creature died
|
||||
{
|
||||
DEBUG_LOG("DealDamageNotPlayer");
|
||||
Creature *cVictim = (Creature*)pVictim;
|
||||
Creature *cVictim = pVictim->ToCreature();
|
||||
|
||||
if (!cVictim->isPet())
|
||||
{
|
||||
@@ -14680,8 +14680,8 @@ void Unit::Kill(Unit *pVictim, bool durabilityLoss)
|
||||
}
|
||||
|
||||
// Call KilledUnit for creatures, this needs to be called after the lootable flag is set
|
||||
if (GetTypeId() == TYPEID_UNIT && ((Creature*)this)->IsAIEnabled)
|
||||
((Creature*)this)->AI()->KilledUnit(pVictim);
|
||||
if (GetTypeId() == TYPEID_UNIT && this->ToCreature()->IsAIEnabled)
|
||||
this->ToCreature()->AI()->KilledUnit(pVictim);
|
||||
|
||||
// Call creature just died function
|
||||
if (cVictim->IsAIEnabled)
|
||||
@@ -14731,7 +14731,7 @@ void Unit::Kill(Unit *pVictim, bool durabilityLoss)
|
||||
if (pVictim->GetTypeId() == TYPEID_PLAYER)
|
||||
bg->HandleKillPlayer((Player*)pVictim, player);
|
||||
else
|
||||
bg->HandleKillUnit((Creature*)pVictim, player);
|
||||
bg->HandleKillUnit(pVictim->ToCreature(), player);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14818,7 +14818,7 @@ void Unit::SetStunned(bool apply)
|
||||
|
||||
// Creature specific
|
||||
if (GetTypeId() != TYPEID_PLAYER)
|
||||
((Creature*)this)->StopMoving();
|
||||
this->ToCreature()->StopMoving();
|
||||
else
|
||||
SetStandState(UNIT_STAND_STATE_STAND);
|
||||
|
||||
@@ -14991,7 +14991,7 @@ bool Unit::SetCharmedBy(Unit* charmer, CharmType type)
|
||||
|
||||
if (GetTypeId() == TYPEID_UNIT)
|
||||
{
|
||||
((Creature*)this)->AI()->OnCharmed(true);
|
||||
this->ToCreature()->AI()->OnCharmed(true);
|
||||
GetMotionMaster()->MoveIdle();
|
||||
}
|
||||
else
|
||||
@@ -15032,7 +15032,7 @@ bool Unit::SetCharmedBy(Unit* charmer, CharmType type)
|
||||
case CHARM_TYPE_CHARM:
|
||||
if (GetTypeId() == TYPEID_UNIT && charmer->getClass() == CLASS_WARLOCK)
|
||||
{
|
||||
CreatureInfo const *cinfo = ((Creature*)this)->GetCreatureInfo();
|
||||
CreatureInfo const *cinfo = this->ToCreature()->GetCreatureInfo();
|
||||
if (cinfo && cinfo->type == CREATURE_TYPE_DEMON)
|
||||
{
|
||||
//to prevent client crash
|
||||
@@ -15094,17 +15094,17 @@ void Unit::RemoveCharmedBy(Unit *charmer)
|
||||
|
||||
if (GetTypeId() == TYPEID_UNIT)
|
||||
{
|
||||
((Creature*)this)->AI()->OnCharmed(false);
|
||||
((Creature*)this)->AIM_Initialize();
|
||||
this->ToCreature()->AI()->OnCharmed(false);
|
||||
this->ToCreature()->AIM_Initialize();
|
||||
|
||||
if (((Creature*)this)->AI() && charmer && charmer->isAlive())
|
||||
((Creature*)this)->AI()->AttackStart(charmer);
|
||||
/*if (isAlive() && ((Creature*)this)->IsAIEnabled)
|
||||
if (this->ToCreature()->AI() && charmer && charmer->isAlive())
|
||||
this->ToCreature()->AI()->AttackStart(charmer);
|
||||
/*if (isAlive() && this->ToCreature()->IsAIEnabled)
|
||||
{
|
||||
if (charmer && !IsFriendlyTo(charmer))
|
||||
((Creature*)this)->AI()->AttackStart(charmer);
|
||||
this->ToCreature()->AI()->AttackStart(charmer);
|
||||
else
|
||||
((Creature*)this)->AI()->EnterEvadeMode();
|
||||
this->ToCreature()->AI()->EnterEvadeMode();
|
||||
}*/
|
||||
}
|
||||
else
|
||||
@@ -15135,7 +15135,7 @@ void Unit::RemoveCharmedBy(Unit *charmer)
|
||||
case CHARM_TYPE_CHARM:
|
||||
if (GetTypeId() == TYPEID_UNIT && charmer->getClass() == CLASS_WARLOCK)
|
||||
{
|
||||
CreatureInfo const *cinfo = ((Creature*)this)->GetCreatureInfo();
|
||||
CreatureInfo const *cinfo = this->ToCreature()->GetCreatureInfo();
|
||||
if (cinfo && cinfo->type == CREATURE_TYPE_DEMON)
|
||||
{
|
||||
SetByteValue(UNIT_FIELD_BYTES_0, 1, uint8(cinfo->unit_class));
|
||||
@@ -15155,7 +15155,7 @@ void Unit::RemoveCharmedBy(Unit *charmer)
|
||||
//a guardian should always have charminfo
|
||||
if (charmer->GetTypeId() == TYPEID_PLAYER && this != charmer->GetFirstControlled())
|
||||
charmer->ToPlayer()->SendRemoveControlBar();
|
||||
else if (GetTypeId() == TYPEID_PLAYER || GetTypeId() == TYPEID_UNIT && !((Creature*)this)->isGuardian())
|
||||
else if (GetTypeId() == TYPEID_PLAYER || GetTypeId() == TYPEID_UNIT && !this->ToCreature()->isGuardian())
|
||||
DeleteCharmInfo();
|
||||
}
|
||||
|
||||
@@ -15174,7 +15174,7 @@ void Unit::RestoreFaction()
|
||||
}
|
||||
}
|
||||
|
||||
if (CreatureInfo const *cinfo = ((Creature*)this)->GetCreatureInfo()) // normal creature
|
||||
if (CreatureInfo const *cinfo = this->ToCreature()->GetCreatureInfo()) // normal creature
|
||||
{
|
||||
FactionTemplateEntry const *faction = getFactionTemplateEntry();
|
||||
setFaction((faction && faction->friendlyMask & 0x004) ? cinfo->faction_H : cinfo->faction_A);
|
||||
@@ -16090,7 +16090,7 @@ bool Unit::SetPosition(float x, float y, float z, float orientation, bool telepo
|
||||
if(GetTypeId() == TYPEID_PLAYER)
|
||||
GetMap()->PlayerRelocation((Player*)this, x, y, z, orientation);
|
||||
else
|
||||
GetMap()->CreatureRelocation((Creature*)this, x, y, z, orientation);
|
||||
GetMap()->CreatureRelocation(this->ToCreature(), x, y, z, orientation);
|
||||
}
|
||||
else if(turn)
|
||||
SetOrientation(orientation);
|
||||
|
||||
+1
-1
@@ -293,7 +293,7 @@ void PlayerAI::OnCharmed(bool apply) { me->IsAIEnabled = apply; }
|
||||
|
||||
void SimpleCharmedAI::UpdateAI(const uint32 /*diff*/)
|
||||
{
|
||||
Creature *charmer = (Creature*)me->GetCharmer();
|
||||
Creature *charmer = me->GetCharmer()->ToCreature();
|
||||
|
||||
//kill self if charm aura has infinite duration
|
||||
if(charmer->IsInEvadeMode())
|
||||
|
||||
@@ -242,8 +242,8 @@ void Vehicle::InstallAccessory(uint32 entry, int8 seatId, bool minion)
|
||||
if(passenger->GetEntry() == entry)
|
||||
{
|
||||
assert(passenger->GetTypeId() == TYPEID_UNIT);
|
||||
if(me->GetTypeId() == TYPEID_UNIT && ((Creature*)me)->IsInEvadeMode() && ((Creature*)passenger)->IsAIEnabled)
|
||||
((Creature*)passenger)->AI()->EnterEvadeMode();
|
||||
if(me->GetTypeId() == TYPEID_UNIT && me->ToCreature()->IsInEvadeMode() && passenger->ToCreature()->IsAIEnabled)
|
||||
passenger->ToCreature()->AI()->EnterEvadeMode();
|
||||
return;
|
||||
}
|
||||
passenger->ExitVehicle(); // this should not happen
|
||||
@@ -329,8 +329,8 @@ bool Vehicle::AddPassenger(Unit *unit, int8 seatId)
|
||||
|
||||
if(me->GetTypeId() == TYPEID_UNIT)
|
||||
{
|
||||
if(((Creature*)me)->IsAIEnabled)
|
||||
((Creature*)me)->AI()->PassengerBoarded(unit, seat->first, true);
|
||||
if(me->ToCreature()->IsAIEnabled)
|
||||
me->ToCreature()->AI()->PassengerBoarded(unit, seat->first, true);
|
||||
|
||||
// update all passenger's positions
|
||||
RelocatePassengers(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation());
|
||||
@@ -380,8 +380,8 @@ void Vehicle::RemovePassenger(Unit *unit)
|
||||
&& seat->first == 0 && seat->second.seatInfo->m_flags & 0x800)
|
||||
me->RemoveCharmedBy(unit);
|
||||
|
||||
if(me->GetTypeId() == TYPEID_UNIT && ((Creature*)me)->IsAIEnabled)
|
||||
((Creature*)me)->AI()->PassengerBoarded(unit, seat->first, false);
|
||||
if(me->GetTypeId() == TYPEID_UNIT && me->ToCreature()->IsAIEnabled)
|
||||
me->ToCreature()->AI()->PassengerBoarded(unit, seat->first, false);
|
||||
|
||||
// only for flyable vehicles?
|
||||
//CastSpell(this, 45472, true); // Parachute
|
||||
|
||||
Reference in New Issue
Block a user