Added new type-safe cast functions.
This, when properly used, should get rid of most memory corruption issues, currently, casting types C-style with no checks leads to some abstract crashing. Functionality is same as with dynamic_cast<>, but with no RTTI check - so when casting into invalid type you will receive NULL, and most probably crash. At the same time, i took the liberty to convert most Player* casts to ToPlayer(). Still needs crapload of casts being moved to new facility. --HG-- branch : trunk
This commit is contained in:
@@ -265,9 +265,9 @@ bool AchievementCriteriaData::Meets(uint32 criteria_id, Player const* source, Un
|
||||
case ACHIEVEMENT_CRITERIA_DATA_TYPE_T_PLAYER_CLASS_RACE:
|
||||
if (!target || target->GetTypeId() != TYPEID_PLAYER)
|
||||
return false;
|
||||
if(classRace.class_id && classRace.class_id != ((Player*)target)->getClass())
|
||||
if(classRace.class_id && classRace.class_id != target->ToPlayer()->getClass())
|
||||
return false;
|
||||
if(classRace.race_id && classRace.race_id != ((Player*)target)->getRace())
|
||||
if(classRace.race_id && classRace.race_id != target->ToPlayer()->getRace())
|
||||
return false;
|
||||
return true;
|
||||
case ACHIEVEMENT_CRITERIA_DATA_TYPE_T_PLAYER_LESS_HEALTH:
|
||||
@@ -275,10 +275,10 @@ bool AchievementCriteriaData::Meets(uint32 criteria_id, Player const* source, Un
|
||||
return false;
|
||||
return target->GetHealth()*100 <= health.percent*target->GetMaxHealth();
|
||||
case ACHIEVEMENT_CRITERIA_DATA_TYPE_T_PLAYER_DEAD:
|
||||
if (!target || target->GetTypeId() != TYPEID_PLAYER || target->isAlive() || ((Player*)target)->GetDeathTimer() == 0)
|
||||
if (!target || target->GetTypeId() != TYPEID_PLAYER || target->isAlive() || target->ToPlayer()->GetDeathTimer() == 0)
|
||||
return false;
|
||||
// flag set == must be same team, not set == different team
|
||||
return (((Player*)target)->GetTeam() == source->GetTeam()) == (player_dead.own_team_flag != 0);
|
||||
return (target->ToPlayer()->GetTeam() == source->GetTeam()) == (player_dead.own_team_flag != 0);
|
||||
case ACHIEVEMENT_CRITERIA_DATA_TYPE_S_AURA:
|
||||
return source->HasAuraEffect(aura.spell_id,aura.effect_idx);
|
||||
case ACHIEVEMENT_CRITERIA_DATA_TYPE_S_AREA:
|
||||
@@ -308,7 +308,7 @@ bool AchievementCriteriaData::Meets(uint32 criteria_id, Player const* source, Un
|
||||
case ACHIEVEMENT_CRITERIA_DATA_TYPE_T_TEAM:
|
||||
if (!target || target->GetTypeId() != TYPEID_PLAYER)
|
||||
return false;
|
||||
return ((Player*)target)->GetTeam() == team.team;
|
||||
return target->ToPlayer()->GetTeam() == team.team;
|
||||
case ACHIEVEMENT_CRITERIA_DATA_TYPE_S_DRUNK:
|
||||
return Player::GetDrunkenstateByValue(source->GetDrunkValue()) >= drunk.state;
|
||||
case ACHIEVEMENT_CRITERIA_DATA_TYPE_HOLIDAY:
|
||||
|
||||
@@ -663,6 +663,7 @@ class Creature : public Unit, public GridObject<Creature>
|
||||
static float _GetDamageMod(int32 Rank);
|
||||
|
||||
float m_SightDistance, m_CombatDistance;
|
||||
|
||||
protected:
|
||||
bool CreateFromProto(uint32 guidlow, uint32 Entry, uint32 vehId, uint32 team, const CreatureData *data = NULL);
|
||||
bool InitEntry(uint32 entry, uint32 team=ALLIANCE, const CreatureData* data=NULL);
|
||||
|
||||
@@ -534,12 +534,12 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
|
||||
case ACTION_T_QUEST_EVENT:
|
||||
if (Unit* target = GetTargetByType(action.quest_event.target, pActionInvoker))
|
||||
if (target->GetTypeId() == TYPEID_PLAYER)
|
||||
((Player*)target)->AreaExploredOrEventHappens(action.quest_event.questId);
|
||||
target->ToPlayer()->AreaExploredOrEventHappens(action.quest_event.questId);
|
||||
break;
|
||||
case ACTION_T_CAST_EVENT:
|
||||
if (Unit* target = GetTargetByType(action.cast_event.target, pActionInvoker))
|
||||
if (target->GetTypeId() == TYPEID_PLAYER)
|
||||
((Player*)target)->CastedCreatureOrGO(action.cast_event.creatureId, m_creature->GetGUID(), action.cast_event.spellId);
|
||||
target->ToPlayer()->CastedCreatureOrGO(action.cast_event.creatureId, m_creature->GetGUID(), action.cast_event.spellId);
|
||||
break;
|
||||
case ACTION_T_SET_UNIT_FIELD:
|
||||
{
|
||||
@@ -622,7 +622,7 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
|
||||
{
|
||||
if (Unit* Temp = Unit::GetUnit(*m_creature,pActionInvoker->GetGUID()))
|
||||
if (Temp->GetTypeId() == TYPEID_PLAYER)
|
||||
((Player*)Temp)->GroupEventHappens(action.quest_event_all.questId,m_creature);
|
||||
Temp->ToPlayer()->GroupEventHappens(action.quest_event_all.questId,m_creature);
|
||||
}
|
||||
break;
|
||||
case ACTION_T_CAST_EVENT_ALL:
|
||||
@@ -631,7 +631,7 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
|
||||
for (std::list<HostilReference*>::iterator i = threatList.begin(); i != threatList.end(); ++i)
|
||||
if (Unit* Temp = Unit::GetUnit(*m_creature,(*i)->getUnitGuid()))
|
||||
if (Temp->GetTypeId() == TYPEID_PLAYER)
|
||||
((Player*)Temp)->CastedCreatureOrGO(action.cast_event_all.creatureId, m_creature->GetGUID(), action.cast_event_all.spellId);
|
||||
Temp->ToPlayer()->CastedCreatureOrGO(action.cast_event_all.creatureId, m_creature->GetGUID(), action.cast_event_all.spellId);
|
||||
break;
|
||||
}
|
||||
case ACTION_T_REMOVEAURASFROMSPELL:
|
||||
|
||||
@@ -61,7 +61,7 @@ void DynamicObject::RemoveFromWorld()
|
||||
if(Unit *caster = GetCaster())
|
||||
{
|
||||
if(caster->GetTypeId() == TYPEID_PLAYER)
|
||||
((Player*)caster)->SetViewpoint(this, false);
|
||||
caster->ToPlayer()->SetViewpoint(this, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -253,9 +253,9 @@ void GameObject::Update(uint32 /*p_time*/)
|
||||
|
||||
UpdateData udata;
|
||||
WorldPacket packet;
|
||||
BuildValuesUpdateBlockForPlayer(&udata,((Player*)caster));
|
||||
BuildValuesUpdateBlockForPlayer(&udata,caster->ToPlayer());
|
||||
udata.BuildPacket(&packet);
|
||||
((Player*)caster)->GetSession()->SendPacket(&packet);
|
||||
caster->ToPlayer()->GetSession()->SendPacket(&packet);
|
||||
|
||||
SendCustomAnim();
|
||||
}
|
||||
@@ -290,7 +290,7 @@ void GameObject::Update(uint32 /*p_time*/)
|
||||
caster->FinishSpell(CURRENT_CHANNELED_SPELL);
|
||||
|
||||
WorldPacket data(SMSG_FISH_ESCAPED,0);
|
||||
((Player*)caster)->GetSession()->SendPacket(&data);
|
||||
caster->ToPlayer()->GetSession()->SendPacket(&data);
|
||||
}
|
||||
// can be delete
|
||||
m_lootState = GO_JUST_DEACTIVATED;
|
||||
@@ -396,8 +396,8 @@ void GameObject::Update(uint32 /*p_time*/)
|
||||
if(IsBattleGroundTrap && ok->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
//BattleGround gameobjects case
|
||||
if(((Player*)ok)->InBattleGround())
|
||||
if(BattleGround *bg = ((Player*)ok)->GetBattleGround())
|
||||
if(ok->ToPlayer()->InBattleGround())
|
||||
if(BattleGround *bg = ok->ToPlayer()->GetBattleGround())
|
||||
bg->HandleTriggerBuff(GetGUID());
|
||||
}
|
||||
}
|
||||
@@ -1271,7 +1271,7 @@ void GameObject::Use(Unit* user)
|
||||
return;
|
||||
|
||||
// accept only use by player from same group for caster except caster itself
|
||||
if(((Player*)caster)==player || !((Player*)caster)->IsInSameRaidWith(player))
|
||||
if(caster->ToPlayer()==player || !caster->ToPlayer()->IsInSameRaidWith(player))
|
||||
return;
|
||||
|
||||
AddUniqueUse(player);
|
||||
@@ -1318,7 +1318,7 @@ void GameObject::Use(Unit* user)
|
||||
if( !caster || caster->GetTypeId() != TYPEID_PLAYER )
|
||||
return;
|
||||
|
||||
if(user->GetTypeId() != TYPEID_PLAYER || !((Player*)user)->IsInSameRaidWith((Player*)caster))
|
||||
if(user->GetTypeId() != TYPEID_PLAYER || !user->ToPlayer()->IsInSameRaidWith(caster->ToPlayer()))
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
+7
-7
@@ -1113,9 +1113,9 @@ bool ChatHandler::HandleModifyHPCommand(const char* args)
|
||||
if (chr->GetTypeId() == TYPEID_PLAYER && HasLowerSecurity((Player*)chr, 0))
|
||||
return false;
|
||||
|
||||
PSendSysMessage(LANG_YOU_CHANGE_HP, GetNameLink((Player*)chr).c_str(), hp, hpm);
|
||||
if (chr->GetTypeId() == TYPEID_PLAYER && needReportToTarget((Player*)chr))
|
||||
ChatHandler((Player*)chr).PSendSysMessage(LANG_YOURS_HP_CHANGED, GetNameLink().c_str(), hp, hpm);
|
||||
PSendSysMessage(LANG_YOU_CHANGE_HP, GetNameLink(chr->ToPlayer()).c_str(), hp, hpm);
|
||||
if (chr->GetTypeId() == TYPEID_PLAYER && needReportToTarget(chr->ToPlayer()))
|
||||
ChatHandler(chr->ToPlayer()).PSendSysMessage(LANG_YOURS_HP_CHANGED, GetNameLink().c_str(), hp, hpm);
|
||||
|
||||
chr->SetMaxHealth( hpm );
|
||||
chr->SetHealth( hp );
|
||||
@@ -1460,20 +1460,20 @@ bool ChatHandler::HandleModifyTalentCommand (const char* args)
|
||||
// check online security
|
||||
if (HasLowerSecurity((Player*)target, 0))
|
||||
return false;
|
||||
((Player*)target)->SetFreeTalentPoints(tp);
|
||||
((Player*)target)->SendTalentsInfoData(false);
|
||||
target->ToPlayer()->SetFreeTalentPoints(tp);
|
||||
target->ToPlayer()->SendTalentsInfoData(false);
|
||||
return true;
|
||||
}
|
||||
else if(((Creature*)target)->isPet())
|
||||
{
|
||||
Unit *owner = target->GetOwner();
|
||||
if(owner && owner->GetTypeId() == TYPEID_PLAYER && ((Pet *)target)->IsPermanentPetFor((Player*)owner))
|
||||
if(owner && owner->GetTypeId() == TYPEID_PLAYER && ((Pet *)target)->IsPermanentPetFor(owner->ToPlayer()))
|
||||
{
|
||||
// check online security
|
||||
if (HasLowerSecurity((Player*)owner, 0))
|
||||
return false;
|
||||
((Pet *)target)->SetFreeTalentPoints(tp);
|
||||
((Player*)owner)->SendTalentsInfoData(true);
|
||||
owner->ToPlayer()->SendTalentsInfoData(true);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
+5
-5
@@ -5284,14 +5284,14 @@ bool ChatHandler::HandleResetTalentsCommand(const char * args)
|
||||
if (!*args && creature && creature->isPet())
|
||||
{
|
||||
Unit *owner = creature->GetOwner();
|
||||
if(owner && owner->GetTypeId() == TYPEID_PLAYER && ((Pet *)creature)->IsPermanentPetFor((Player*)owner))
|
||||
if(owner && owner->GetTypeId() == TYPEID_PLAYER && ((Pet *)creature)->IsPermanentPetFor(owner->ToPlayer()))
|
||||
{
|
||||
((Pet *)creature)->resetTalents(true);
|
||||
((Player*)owner)->SendTalentsInfoData(true);
|
||||
owner->ToPlayer()->SendTalentsInfoData(true);
|
||||
|
||||
ChatHandler((Player*)owner).SendSysMessage(LANG_RESET_PET_TALENTS);
|
||||
if(!m_session || m_session->GetPlayer()!=((Player*)owner))
|
||||
PSendSysMessage(LANG_RESET_PET_TALENTS_ONLINE,GetNameLink((Player*)owner).c_str());
|
||||
ChatHandler(owner->ToPlayer()).SendSysMessage(LANG_RESET_PET_TALENTS);
|
||||
if(!m_session || m_session->GetPlayer()!=owner->ToPlayer())
|
||||
PSendSysMessage(LANG_RESET_PET_TALENTS_ONLINE,GetNameLink(owner->ToPlayer()).c_str());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
+8
-8
@@ -295,11 +295,11 @@ void Object::_BuildMovementUpdate(ByteBuffer * data, uint16 flags) const
|
||||
*data << ((Unit*)this)->GetSpeed( MOVE_PITCH_RATE );
|
||||
|
||||
// 0x08000000
|
||||
if(GetTypeId() == TYPEID_PLAYER && ((Player*)this)->isInFlight())
|
||||
if(GetTypeId() == TYPEID_PLAYER && this->ToPlayer()->isInFlight())
|
||||
{
|
||||
WPAssert(((Player*)this)->GetMotionMaster()->GetCurrentMovementGeneratorType() == FLIGHT_MOTION_TYPE);
|
||||
//WPAssert(this->ToPlayer()->GetMotionMaster()->GetCurrentMovementGeneratorType() == FLIGHT_MOTION_TYPE);
|
||||
|
||||
FlightPathMovementGenerator *fmg = (FlightPathMovementGenerator*)(((Player*)this)->GetMotionMaster()->top());
|
||||
FlightPathMovementGenerator *fmg = (FlightPathMovementGenerator*)(const_cast<Player*>(this->ToPlayer())->GetMotionMaster()->top());
|
||||
|
||||
uint32 flags3 = MOVEFLAG_GLIDE;
|
||||
|
||||
@@ -327,7 +327,7 @@ void Object::_BuildMovementUpdate(ByteBuffer * data, uint16 flags) const
|
||||
Path &path = fmg->GetPath();
|
||||
|
||||
float x, y, z;
|
||||
((Player*)this)->GetPosition(x, y, z);
|
||||
this->ToPlayer()->GetPosition(x, y, z);
|
||||
|
||||
uint32 inflighttime = uint32(path.GetPassedLength(fmg->GetCurrentNode(), x, y, z) * 32);
|
||||
uint32 traveltime = uint32(path.GetTotalLength() * 32);
|
||||
@@ -629,14 +629,14 @@ void Object::_BuildValuesUpdate(uint8 updatetype, ByteBuffer * data, UpdateMask
|
||||
if(index == UNIT_FIELD_BYTES_2)
|
||||
{
|
||||
// Allow targetting opposite faction in party when enabled in config
|
||||
DEBUG_LOG("-- VALUES_UPDATE: Sending '%s' the blue-group-fix from '%s' (flag)", target->GetName(), ((Player*)this)->GetName());
|
||||
DEBUG_LOG("-- VALUES_UPDATE: Sending '%s' the blue-group-fix from '%s' (flag)", target->GetName(), this->ToPlayer()->GetName());
|
||||
*data << ( m_uint32Values[ index ] & ((UNIT_BYTE2_FLAG_SANCTUARY /*| UNIT_BYTE2_FLAG_AURAS | UNIT_BYTE2_FLAG_UNK5*/) << 8) ); // this flag is at uint8 offset 1 !!
|
||||
}
|
||||
else
|
||||
{
|
||||
// pretend that all other HOSTILE players have own faction, to allow follow, heal, rezz (trade wont work)
|
||||
uint32 faction = target->getFaction();
|
||||
DEBUG_LOG("-- VALUES_UPDATE: Sending '%s' the blue-group-fix from '%s' (faction %u)", target->GetName(), ((Player*)this)->GetName(), faction);
|
||||
DEBUG_LOG("-- VALUES_UPDATE: Sending '%s' the blue-group-fix from '%s' (faction %u)", target->GetName(), this->ToPlayer()->GetName(), faction);
|
||||
*data << uint32(faction);
|
||||
}
|
||||
}
|
||||
@@ -1487,7 +1487,7 @@ void WorldObject::SendPlaySound(uint32 Sound, bool OnlySelf)
|
||||
WorldPacket data(SMSG_PLAY_SOUND, 4);
|
||||
data << Sound;
|
||||
if (OnlySelf && GetTypeId() == TYPEID_PLAYER)
|
||||
((Player*)this)->GetSession()->SendPacket( &data );
|
||||
this->ToPlayer()->GetSession()->SendPacket( &data );
|
||||
else
|
||||
SendMessageToSet( &data, true ); // ToSelf ignored in this case
|
||||
}
|
||||
@@ -1735,7 +1735,7 @@ TempSummon *Map::SummonCreature(uint32 entry, const Position &pos, SummonPropert
|
||||
{
|
||||
phase = summoner->GetPhaseMask();
|
||||
if(summoner->GetTypeId() == TYPEID_PLAYER)
|
||||
team = ((Player*)summoner)->GetTeam();
|
||||
team = summoner->ToPlayer()->GetTeam();
|
||||
}
|
||||
|
||||
TempSummon *summon = NULL;
|
||||
|
||||
@@ -318,6 +318,10 @@ class Object
|
||||
// FG: some hacky helpers
|
||||
void ForceValuesUpdateAtIndex(uint32);
|
||||
|
||||
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; }
|
||||
|
||||
protected:
|
||||
|
||||
Object ( );
|
||||
|
||||
@@ -325,8 +325,8 @@ void OutdoorPvPHP::HandleKillImpl(Player *plr, Unit * killed)
|
||||
if(killed->GetTypeId() != TYPEID_PLAYER)
|
||||
return;
|
||||
|
||||
if(plr->GetTeam() == ALLIANCE && ((Player*)killed)->GetTeam() != ALLIANCE)
|
||||
if(plr->GetTeam() == ALLIANCE && killed->ToPlayer()->GetTeam() != ALLIANCE)
|
||||
plr->CastSpell(plr,AlliancePlayerKillReward,true);
|
||||
else if(plr->GetTeam() == HORDE && ((Player*)killed)->GetTeam() != HORDE)
|
||||
else if(plr->GetTeam() == HORDE && killed->ToPlayer()->GetTeam() != HORDE)
|
||||
plr->CastSpell(plr,HordePlayerKillReward,true);
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ OutdoorPvPNA::OutdoorPvPNA()
|
||||
|
||||
void OutdoorPvPNA::HandleKillImpl(Player *plr, Unit * killed)
|
||||
{
|
||||
if(killed->GetTypeId() == TYPEID_PLAYER && plr->GetTeam() != ((Player*)killed)->GetTeam())
|
||||
if(killed->GetTypeId() == TYPEID_PLAYER && plr->GetTeam() != killed->ToPlayer()->GetTeam())
|
||||
{
|
||||
plr->KilledMonsterCredit(NA_CREDIT_MARKER,0); // 0 guid, btw it isn't even used in killedmonster function :S
|
||||
if(plr->GetTeam() == ALLIANCE)
|
||||
|
||||
@@ -195,9 +195,9 @@ void OutdoorPvPZM::HandleKillImpl(Player *plr, Unit * killed)
|
||||
if(killed->GetTypeId() != TYPEID_PLAYER)
|
||||
return;
|
||||
|
||||
if(plr->GetTeam() == ALLIANCE && ((Player*)killed)->GetTeam() != ALLIANCE)
|
||||
if(plr->GetTeam() == ALLIANCE && killed->ToPlayer()->GetTeam() != ALLIANCE)
|
||||
plr->CastSpell(plr,ZM_AlliancePlayerKillReward,true);
|
||||
else if(plr->GetTeam() == HORDE && ((Player*)killed)->GetTeam() != HORDE)
|
||||
else if(plr->GetTeam() == HORDE && killed->ToPlayer()->GetTeam() != HORDE)
|
||||
plr->CastSpell(plr,ZM_HordePlayerKillReward,true);
|
||||
}
|
||||
|
||||
|
||||
+8
-8
@@ -338,7 +338,7 @@ bool Pet::LoadPetFromDB( Player* owner, uint32 petentry, uint32 petnumber, bool
|
||||
|
||||
//set last used pet number (for use in BG's)
|
||||
if(owner->GetTypeId() == TYPEID_PLAYER && isControlled() && !isTemporarySummoned() && (getPetType() == SUMMON_PET || getPetType() == HUNTER_PET))
|
||||
((Player*)owner)->SetLastPetNumber(pet_number);
|
||||
owner->ToPlayer()->SetLastPetNumber(pet_number);
|
||||
|
||||
m_loading = false;
|
||||
|
||||
@@ -1523,7 +1523,7 @@ bool Pet::removeSpell(uint32 spell_id, bool learn_prev, bool clear_ab)
|
||||
// need update action bar for last removed rank
|
||||
if (Unit* owner = GetOwner())
|
||||
if (owner->GetTypeId() == TYPEID_PLAYER)
|
||||
((Player*)owner)->PetSpellInitialize();
|
||||
owner->ToPlayer()->PetSpellInitialize();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1561,8 +1561,8 @@ bool Pet::resetTalents(bool no_cost)
|
||||
return false;
|
||||
|
||||
// not need after this call
|
||||
if (((Player*)owner)->HasAtLoginFlag(AT_LOGIN_RESET_PET_TALENTS))
|
||||
((Player*)owner)->RemoveAtLoginFlag(AT_LOGIN_RESET_PET_TALENTS,true);
|
||||
if (owner->ToPlayer()->HasAtLoginFlag(AT_LOGIN_RESET_PET_TALENTS))
|
||||
owner->ToPlayer()->RemoveAtLoginFlag(AT_LOGIN_RESET_PET_TALENTS,true);
|
||||
|
||||
CreatureInfo const * ci = GetCreatureInfo();
|
||||
if (!ci)
|
||||
@@ -1654,8 +1654,8 @@ bool Pet::resetTalents(bool no_cost)
|
||||
void Pet::resetTalentsForAllPetsOf(Player* owner, Pet* online_pet /*= NULL*/)
|
||||
{
|
||||
// not need after this call
|
||||
if (((Player*)owner)->HasAtLoginFlag(AT_LOGIN_RESET_PET_TALENTS))
|
||||
((Player*)owner)->RemoveAtLoginFlag(AT_LOGIN_RESET_PET_TALENTS,true);
|
||||
if (owner->ToPlayer()->HasAtLoginFlag(AT_LOGIN_RESET_PET_TALENTS))
|
||||
owner->ToPlayer()->RemoveAtLoginFlag(AT_LOGIN_RESET_PET_TALENTS,true);
|
||||
|
||||
// reset for online
|
||||
if (online_pet)
|
||||
@@ -1743,7 +1743,7 @@ void Pet::InitTalentForLevel()
|
||||
return;
|
||||
|
||||
if (!m_loading)
|
||||
((Player*)owner)->SendTalentsInfoData(true);
|
||||
owner->ToPlayer()->SendTalentsInfoData(true);
|
||||
}
|
||||
|
||||
uint32 Pet::resetTalentsCost() const
|
||||
@@ -1894,7 +1894,7 @@ void Pet::CastPetAuras(bool current)
|
||||
if (!owner || owner->GetTypeId() != TYPEID_PLAYER)
|
||||
return;
|
||||
|
||||
if (!IsPermanentPetFor((Player*)owner))
|
||||
if (!IsPermanentPetFor(owner->ToPlayer()))
|
||||
return;
|
||||
|
||||
for (PetAuraSet::const_iterator itr = owner->m_petAuras.begin(); itr != owner->m_petAuras.end();)
|
||||
|
||||
+3
-3
@@ -209,10 +209,10 @@ void PetAI::UpdateAI(const uint32 diff)
|
||||
{
|
||||
m_creature->SetInFront(target);
|
||||
if(target && target->GetTypeId() == TYPEID_PLAYER)
|
||||
m_creature->SendUpdateToPlayer((Player*)target);
|
||||
m_creature->SendUpdateToPlayer(target->ToPlayer());
|
||||
|
||||
if(owner && owner->GetTypeId() == TYPEID_PLAYER)
|
||||
m_creature->SendUpdateToPlayer((Player*)owner);
|
||||
m_creature->SendUpdateToPlayer(owner->ToPlayer());
|
||||
}
|
||||
|
||||
m_creature->AddCreatureSpellCooldown(spell->m_spellInfo->Id);
|
||||
@@ -236,7 +236,7 @@ void PetAI::UpdateAllies()
|
||||
if(!owner)
|
||||
return;
|
||||
else if(owner->GetTypeId() == TYPEID_PLAYER)
|
||||
pGroup = ((Player*)owner)->GetGroup();
|
||||
pGroup = owner->ToPlayer()->GetGroup();
|
||||
|
||||
//only pet and owner/not in group->ok
|
||||
if(m_AllySet.size() == 2 && !pGroup)
|
||||
|
||||
@@ -284,7 +284,7 @@ void WorldSession::HandlePetActionHelper(Unit *pet, uint64 guid1, uint16 spellid
|
||||
}
|
||||
if (Unit* powner = pet->GetCharmerOrOwner())
|
||||
if(powner->GetTypeId() == TYPEID_PLAYER)
|
||||
pet->SendUpdateToPlayer((Player*)powner);
|
||||
pet->SendUpdateToPlayer(powner->ToPlayer());
|
||||
result = SPELL_CAST_OK;
|
||||
}
|
||||
|
||||
@@ -535,8 +535,8 @@ void WorldSession::HandlePetRename( WorldPacket & recv_data )
|
||||
pet->SetName(name);
|
||||
|
||||
Unit *owner = pet->GetOwner();
|
||||
if(owner && (owner->GetTypeId() == TYPEID_PLAYER) && ((Player*)owner)->GetGroup())
|
||||
((Player*)owner)->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_PET_NAME);
|
||||
if(owner && (owner->GetTypeId() == TYPEID_PLAYER) && owner->ToPlayer()->GetGroup())
|
||||
owner->ToPlayer()->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_PET_NAME);
|
||||
|
||||
pet->RemoveByteFlag(UNIT_FIELD_BYTES_2, 2, UNIT_CAN_BE_RENAMED);
|
||||
|
||||
@@ -753,7 +753,7 @@ void WorldSession::HandlePetCastSpellOpcode( WorldPacket& recvPacket )
|
||||
caster->SendPetCastFail(spellid, result);
|
||||
if(caster->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
if(!((Player*)caster)->HasSpellCooldown(spellid))
|
||||
if(!caster->ToPlayer()->HasSpellCooldown(spellid))
|
||||
GetPlayer()->SendClearCooldown(spellid, caster);
|
||||
}
|
||||
else
|
||||
|
||||
+49
-49
@@ -6378,7 +6378,7 @@ bool Player::RewardHonor(Unit *uVictim, uint32 groupsize, float honor, bool pvpt
|
||||
if(!uVictim || uVictim == this || uVictim->GetTypeId() != TYPEID_PLAYER)
|
||||
return false;
|
||||
|
||||
if( GetBGTeam() == ((Player*)uVictim)->GetBGTeam() )
|
||||
if( GetBGTeam() == uVictim->ToPlayer()->GetBGTeam() )
|
||||
return false;
|
||||
|
||||
return true;
|
||||
@@ -12624,15 +12624,15 @@ void Player::ApplyEnchantment(Item *item, EnchantmentSlot slot, bool apply, bool
|
||||
if (!pEnchant)
|
||||
return;
|
||||
|
||||
if (!ignore_condition && pEnchant->EnchantmentCondition && !((Player*)this)->EnchantmentFitsRequirements(pEnchant->EnchantmentCondition, -1))
|
||||
if (!ignore_condition && pEnchant->EnchantmentCondition && !this->ToPlayer()->EnchantmentFitsRequirements(pEnchant->EnchantmentCondition, -1))
|
||||
return;
|
||||
|
||||
if ((pEnchant->requiredLevel) > ((Player*)this)->getLevel())
|
||||
if ((pEnchant->requiredLevel) > this->ToPlayer()->getLevel())
|
||||
return;
|
||||
|
||||
if ((pEnchant->requiredSkill) > 0)
|
||||
{
|
||||
if ((pEnchant->requiredSkillValue) > (((Player*)this)->GetSkillValue(pEnchant->requiredSkill)))
|
||||
if ((pEnchant->requiredSkillValue) > (this->ToPlayer()->GetSkillValue(pEnchant->requiredSkill)))
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -12766,111 +12766,111 @@ void Player::ApplyEnchantment(Item *item, EnchantmentSlot slot, bool apply, bool
|
||||
ApplyStatBuffMod(STAT_STAMINA, enchant_amount, apply);
|
||||
break;
|
||||
case ITEM_MOD_DEFENSE_SKILL_RATING:
|
||||
((Player*)this)->ApplyRatingMod(CR_DEFENSE_SKILL, enchant_amount, apply);
|
||||
this->ToPlayer()->ApplyRatingMod(CR_DEFENSE_SKILL, enchant_amount, apply);
|
||||
sLog.outDebug("+ %u DEFENCE", enchant_amount);
|
||||
break;
|
||||
case ITEM_MOD_DODGE_RATING:
|
||||
((Player*)this)->ApplyRatingMod(CR_DODGE, enchant_amount, apply);
|
||||
this->ToPlayer()->ApplyRatingMod(CR_DODGE, enchant_amount, apply);
|
||||
sLog.outDebug("+ %u DODGE", enchant_amount);
|
||||
break;
|
||||
case ITEM_MOD_PARRY_RATING:
|
||||
((Player*)this)->ApplyRatingMod(CR_PARRY, enchant_amount, apply);
|
||||
this->ToPlayer()->ApplyRatingMod(CR_PARRY, enchant_amount, apply);
|
||||
sLog.outDebug("+ %u PARRY", enchant_amount);
|
||||
break;
|
||||
case ITEM_MOD_BLOCK_RATING:
|
||||
((Player*)this)->ApplyRatingMod(CR_BLOCK, enchant_amount, apply);
|
||||
this->ToPlayer()->ApplyRatingMod(CR_BLOCK, enchant_amount, apply);
|
||||
sLog.outDebug("+ %u SHIELD_BLOCK", enchant_amount);
|
||||
break;
|
||||
case ITEM_MOD_HIT_MELEE_RATING:
|
||||
((Player*)this)->ApplyRatingMod(CR_HIT_MELEE, enchant_amount, apply);
|
||||
this->ToPlayer()->ApplyRatingMod(CR_HIT_MELEE, enchant_amount, apply);
|
||||
sLog.outDebug("+ %u MELEE_HIT", enchant_amount);
|
||||
break;
|
||||
case ITEM_MOD_HIT_RANGED_RATING:
|
||||
((Player*)this)->ApplyRatingMod(CR_HIT_RANGED, enchant_amount, apply);
|
||||
this->ToPlayer()->ApplyRatingMod(CR_HIT_RANGED, enchant_amount, apply);
|
||||
sLog.outDebug("+ %u RANGED_HIT", enchant_amount);
|
||||
break;
|
||||
case ITEM_MOD_HIT_SPELL_RATING:
|
||||
((Player*)this)->ApplyRatingMod(CR_HIT_SPELL, enchant_amount, apply);
|
||||
this->ToPlayer()->ApplyRatingMod(CR_HIT_SPELL, enchant_amount, apply);
|
||||
sLog.outDebug("+ %u SPELL_HIT", enchant_amount);
|
||||
break;
|
||||
case ITEM_MOD_CRIT_MELEE_RATING:
|
||||
((Player*)this)->ApplyRatingMod(CR_CRIT_MELEE, enchant_amount, apply);
|
||||
this->ToPlayer()->ApplyRatingMod(CR_CRIT_MELEE, enchant_amount, apply);
|
||||
sLog.outDebug("+ %u MELEE_CRIT", enchant_amount);
|
||||
break;
|
||||
case ITEM_MOD_CRIT_RANGED_RATING:
|
||||
((Player*)this)->ApplyRatingMod(CR_CRIT_RANGED, enchant_amount, apply);
|
||||
this->ToPlayer()->ApplyRatingMod(CR_CRIT_RANGED, enchant_amount, apply);
|
||||
sLog.outDebug("+ %u RANGED_CRIT", enchant_amount);
|
||||
break;
|
||||
case ITEM_MOD_CRIT_SPELL_RATING:
|
||||
((Player*)this)->ApplyRatingMod(CR_CRIT_SPELL, enchant_amount, apply);
|
||||
this->ToPlayer()->ApplyRatingMod(CR_CRIT_SPELL, enchant_amount, apply);
|
||||
sLog.outDebug("+ %u SPELL_CRIT", enchant_amount);
|
||||
break;
|
||||
// Values from ITEM_STAT_MELEE_HA_RATING to ITEM_MOD_HASTE_RANGED_RATING are never used
|
||||
// in Enchantments
|
||||
// case ITEM_MOD_HIT_TAKEN_MELEE_RATING:
|
||||
// ((Player*)this)->ApplyRatingMod(CR_HIT_TAKEN_MELEE, enchant_amount, apply);
|
||||
// this->ToPlayer()->ApplyRatingMod(CR_HIT_TAKEN_MELEE, enchant_amount, apply);
|
||||
// break;
|
||||
// case ITEM_MOD_HIT_TAKEN_RANGED_RATING:
|
||||
// ((Player*)this)->ApplyRatingMod(CR_HIT_TAKEN_RANGED, enchant_amount, apply);
|
||||
// this->ToPlayer()->ApplyRatingMod(CR_HIT_TAKEN_RANGED, enchant_amount, apply);
|
||||
// break;
|
||||
// case ITEM_MOD_HIT_TAKEN_SPELL_RATING:
|
||||
// ((Player*)this)->ApplyRatingMod(CR_HIT_TAKEN_SPELL, enchant_amount, apply);
|
||||
// this->ToPlayer()->ApplyRatingMod(CR_HIT_TAKEN_SPELL, enchant_amount, apply);
|
||||
// break;
|
||||
// case ITEM_MOD_CRIT_TAKEN_MELEE_RATING:
|
||||
// ((Player*)this)->ApplyRatingMod(CR_CRIT_TAKEN_MELEE, enchant_amount, apply);
|
||||
// this->ToPlayer()->ApplyRatingMod(CR_CRIT_TAKEN_MELEE, enchant_amount, apply);
|
||||
// break;
|
||||
// case ITEM_MOD_CRIT_TAKEN_RANGED_RATING:
|
||||
// ((Player*)this)->ApplyRatingMod(CR_CRIT_TAKEN_RANGED, enchant_amount, apply);
|
||||
// this->ToPlayer()->ApplyRatingMod(CR_CRIT_TAKEN_RANGED, enchant_amount, apply);
|
||||
// break;
|
||||
// case ITEM_MOD_CRIT_TAKEN_SPELL_RATING:
|
||||
// ((Player*)this)->ApplyRatingMod(CR_CRIT_TAKEN_SPELL, enchant_amount, apply);
|
||||
// this->ToPlayer()->ApplyRatingMod(CR_CRIT_TAKEN_SPELL, enchant_amount, apply);
|
||||
// break;
|
||||
// case ITEM_MOD_HASTE_MELEE_RATING:
|
||||
// ((Player*)this)->ApplyRatingMod(CR_HASTE_MELEE, enchant_amount, apply);
|
||||
// this->ToPlayer()->ApplyRatingMod(CR_HASTE_MELEE, enchant_amount, apply);
|
||||
// break;
|
||||
// case ITEM_MOD_HASTE_RANGED_RATING:
|
||||
// ((Player*)this)->ApplyRatingMod(CR_HASTE_RANGED, enchant_amount, apply);
|
||||
// this->ToPlayer()->ApplyRatingMod(CR_HASTE_RANGED, enchant_amount, apply);
|
||||
// break;
|
||||
case ITEM_MOD_HASTE_SPELL_RATING:
|
||||
((Player*)this)->ApplyRatingMod(CR_HASTE_SPELL, enchant_amount, apply);
|
||||
this->ToPlayer()->ApplyRatingMod(CR_HASTE_SPELL, enchant_amount, apply);
|
||||
break;
|
||||
case ITEM_MOD_HIT_RATING:
|
||||
((Player*)this)->ApplyRatingMod(CR_HIT_MELEE, enchant_amount, apply);
|
||||
((Player*)this)->ApplyRatingMod(CR_HIT_RANGED, enchant_amount, apply);
|
||||
((Player*)this)->ApplyRatingMod(CR_HIT_SPELL, enchant_amount, apply);
|
||||
this->ToPlayer()->ApplyRatingMod(CR_HIT_MELEE, enchant_amount, apply);
|
||||
this->ToPlayer()->ApplyRatingMod(CR_HIT_RANGED, enchant_amount, apply);
|
||||
this->ToPlayer()->ApplyRatingMod(CR_HIT_SPELL, enchant_amount, apply);
|
||||
sLog.outDebug("+ %u HIT", enchant_amount);
|
||||
break;
|
||||
case ITEM_MOD_CRIT_RATING:
|
||||
((Player*)this)->ApplyRatingMod(CR_CRIT_MELEE, enchant_amount, apply);
|
||||
((Player*)this)->ApplyRatingMod(CR_CRIT_RANGED, enchant_amount, apply);
|
||||
((Player*)this)->ApplyRatingMod(CR_CRIT_SPELL, enchant_amount, apply);
|
||||
this->ToPlayer()->ApplyRatingMod(CR_CRIT_MELEE, enchant_amount, apply);
|
||||
this->ToPlayer()->ApplyRatingMod(CR_CRIT_RANGED, enchant_amount, apply);
|
||||
this->ToPlayer()->ApplyRatingMod(CR_CRIT_SPELL, enchant_amount, apply);
|
||||
sLog.outDebug("+ %u CRITICAL", enchant_amount);
|
||||
break;
|
||||
// Values ITEM_MOD_HIT_TAKEN_RATING and ITEM_MOD_CRIT_TAKEN_RATING are never used in Enchantment
|
||||
// case ITEM_MOD_HIT_TAKEN_RATING:
|
||||
// ((Player*)this)->ApplyRatingMod(CR_HIT_TAKEN_MELEE, enchant_amount, apply);
|
||||
// ((Player*)this)->ApplyRatingMod(CR_HIT_TAKEN_RANGED, enchant_amount, apply);
|
||||
// ((Player*)this)->ApplyRatingMod(CR_HIT_TAKEN_SPELL, enchant_amount, apply);
|
||||
// this->ToPlayer()->ApplyRatingMod(CR_HIT_TAKEN_MELEE, enchant_amount, apply);
|
||||
// this->ToPlayer()->ApplyRatingMod(CR_HIT_TAKEN_RANGED, enchant_amount, apply);
|
||||
// this->ToPlayer()->ApplyRatingMod(CR_HIT_TAKEN_SPELL, enchant_amount, apply);
|
||||
// break;
|
||||
// case ITEM_MOD_CRIT_TAKEN_RATING:
|
||||
// ((Player*)this)->ApplyRatingMod(CR_CRIT_TAKEN_MELEE, enchant_amount, apply);
|
||||
// ((Player*)this)->ApplyRatingMod(CR_CRIT_TAKEN_RANGED, enchant_amount, apply);
|
||||
// ((Player*)this)->ApplyRatingMod(CR_CRIT_TAKEN_SPELL, enchant_amount, apply);
|
||||
// this->ToPlayer()->ApplyRatingMod(CR_CRIT_TAKEN_MELEE, enchant_amount, apply);
|
||||
// this->ToPlayer()->ApplyRatingMod(CR_CRIT_TAKEN_RANGED, enchant_amount, apply);
|
||||
// this->ToPlayer()->ApplyRatingMod(CR_CRIT_TAKEN_SPELL, enchant_amount, apply);
|
||||
// break;
|
||||
case ITEM_MOD_RESILIENCE_RATING:
|
||||
((Player*)this)->ApplyRatingMod(CR_CRIT_TAKEN_MELEE, enchant_amount, apply);
|
||||
((Player*)this)->ApplyRatingMod(CR_CRIT_TAKEN_RANGED, enchant_amount, apply);
|
||||
((Player*)this)->ApplyRatingMod(CR_CRIT_TAKEN_SPELL, enchant_amount, apply);
|
||||
this->ToPlayer()->ApplyRatingMod(CR_CRIT_TAKEN_MELEE, enchant_amount, apply);
|
||||
this->ToPlayer()->ApplyRatingMod(CR_CRIT_TAKEN_RANGED, enchant_amount, apply);
|
||||
this->ToPlayer()->ApplyRatingMod(CR_CRIT_TAKEN_SPELL, enchant_amount, apply);
|
||||
sLog.outDebug("+ %u RESILIENCE", enchant_amount);
|
||||
break;
|
||||
case ITEM_MOD_HASTE_RATING:
|
||||
((Player*)this)->ApplyRatingMod(CR_HASTE_MELEE, enchant_amount, apply);
|
||||
((Player*)this)->ApplyRatingMod(CR_HASTE_RANGED, enchant_amount, apply);
|
||||
((Player*)this)->ApplyRatingMod(CR_HASTE_SPELL, enchant_amount, apply);
|
||||
this->ToPlayer()->ApplyRatingMod(CR_HASTE_MELEE, enchant_amount, apply);
|
||||
this->ToPlayer()->ApplyRatingMod(CR_HASTE_RANGED, enchant_amount, apply);
|
||||
this->ToPlayer()->ApplyRatingMod(CR_HASTE_SPELL, enchant_amount, apply);
|
||||
sLog.outDebug("+ %u HASTE", enchant_amount);
|
||||
break;
|
||||
case ITEM_MOD_EXPERTISE_RATING:
|
||||
((Player*)this)->ApplyRatingMod(CR_EXPERTISE, enchant_amount, apply);
|
||||
this->ToPlayer()->ApplyRatingMod(CR_EXPERTISE, enchant_amount, apply);
|
||||
sLog.outDebug("+ %u EXPERTISE", enchant_amount);
|
||||
break;
|
||||
case ITEM_MOD_ATTACK_POWER:
|
||||
@@ -13848,7 +13848,7 @@ void Player::AddQuest( Quest const *pQuest, Object *questGiver )
|
||||
|
||||
// shared timed quest
|
||||
if(questGiver && questGiver->GetTypeId() == TYPEID_PLAYER)
|
||||
limittime = ((Player*)questGiver)->getQuestStatusMap()[quest_id].m_timer / IN_MILISECONDS;
|
||||
limittime = questGiver->ToPlayer()->getQuestStatusMap()[quest_id].m_timer / IN_MILISECONDS;
|
||||
|
||||
AddTimedQuest( quest_id );
|
||||
questStatusData.m_timer = limittime * IN_MILISECONDS;
|
||||
@@ -19864,9 +19864,9 @@ bool Player::canSeeOrDetect(Unit const* u, bool detect, bool inVisibleList, bool
|
||||
// including case when player is out of world
|
||||
bool at_same_transport =
|
||||
GetTransport() && u->GetTypeId() == TYPEID_PLAYER
|
||||
&& !GetSession()->PlayerLogout() && !((Player*)u)->GetSession()->PlayerLogout()
|
||||
&& !GetSession()->PlayerLoading() && !((Player*)u)->GetSession()->PlayerLoading()
|
||||
&& GetTransport() == ((Player*)u)->GetTransport();
|
||||
&& !GetSession()->PlayerLogout() && !u->ToPlayer()->GetSession()->PlayerLogout()
|
||||
&& !GetSession()->PlayerLoading() && !u->ToPlayer()->GetSession()->PlayerLoading()
|
||||
&& GetTransport() == u->ToPlayer()->GetTransport();
|
||||
|
||||
// not in world
|
||||
if(!at_same_transport && (!IsInWorld() || !u->IsInWorld()))
|
||||
@@ -19943,14 +19943,14 @@ bool Player::canSeeOrDetect(Unit const* u, bool detect, bool inVisibleList, bool
|
||||
if(isGameMaster())
|
||||
{
|
||||
if(u->GetTypeId() == TYPEID_PLAYER)
|
||||
return ((Player*)u)->GetSession()->GetSecurity() <= GetSession()->GetSecurity();
|
||||
return u->ToPlayer()->GetSession()->GetSecurity() <= GetSession()->GetSecurity();
|
||||
else
|
||||
return true;
|
||||
}
|
||||
|
||||
// player see other player with stealth/invisibility only if he in same group or raid or same team (raid/team case dependent from conf setting)
|
||||
if(!m_mover->canDetectInvisibilityOf(u))
|
||||
if(!(u->GetTypeId() == TYPEID_PLAYER && !IsHostileTo(u) && IsGroupVisibleFor(((Player*)u))))
|
||||
if(!(u->GetTypeId() == TYPEID_PLAYER && !IsHostileTo(u) && IsGroupVisibleFor(const_cast<Player*>(u->ToPlayer() ))))
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -19963,7 +19963,7 @@ bool Player::canSeeOrDetect(Unit const* u, bool detect, bool inVisibleList, bool
|
||||
if(!isAlive())
|
||||
detect = false;
|
||||
if(m_DetectInvTimer < 300 || !HaveAtClient(u))
|
||||
if(!(u->GetTypeId() == TYPEID_PLAYER && !IsHostileTo(u) && IsGroupVisibleFor(((Player*)u))))
|
||||
if(!(u->GetTypeId() == TYPEID_PLAYER && !IsHostileTo(u) && IsGroupVisibleFor(const_cast<Player*>(u->ToPlayer()))))
|
||||
if(!detect || !m_mover->canDetectStealthOf(u, GetDistance(u)))
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -2309,6 +2309,7 @@ class Player : public Unit, public GridObject<Player>
|
||||
uint32 GetChampioningFaction() const { return m_ChampioningFaction; }
|
||||
void SetChampioningFaction(uint32 faction) { m_ChampioningFaction = faction; }
|
||||
Spell * m_spellModTakingSpell;
|
||||
|
||||
protected:
|
||||
uint32 m_AreaID;
|
||||
uint32 m_regenTimerCount;
|
||||
|
||||
@@ -125,7 +125,7 @@ void WorldSession::HandleQuestgiverAcceptQuestOpcode( WorldPacket & recv_data )
|
||||
// no or incorrect quest giver
|
||||
if(!pObject
|
||||
|| (pObject->GetTypeId() != TYPEID_PLAYER && !pObject->hasQuest(quest))
|
||||
|| (pObject->GetTypeId() == TYPEID_PLAYER && !((Player*)pObject)->CanShareQuest(quest))
|
||||
|| (pObject->GetTypeId() == TYPEID_PLAYER && !pObject->ToPlayer()->CanShareQuest(quest))
|
||||
)
|
||||
{
|
||||
_player->PlayerTalkClass->CloseGossip();
|
||||
|
||||
+84
-84
@@ -211,11 +211,11 @@ void SpellCastTargets::Update(Unit* caster)
|
||||
if(caster->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
if(m_targetMask & TARGET_FLAG_ITEM)
|
||||
m_itemTarget = ((Player*)caster)->GetItemByGuid(m_itemTargetGUID);
|
||||
m_itemTarget = caster->ToPlayer()->GetItemByGuid(m_itemTargetGUID);
|
||||
else if(m_targetMask & TARGET_FLAG_TRADE_ITEM)
|
||||
{
|
||||
// here it is not guid but slot
|
||||
Player* pTrader = ((Player*)caster)->GetTrader();
|
||||
Player* pTrader = caster->ToPlayer()->GetTrader();
|
||||
if(pTrader && m_itemTargetGUID < TRADE_SLOT_COUNT)
|
||||
m_itemTarget = pTrader->GetItemByGuid(m_itemTargetGUID);
|
||||
}
|
||||
@@ -415,7 +415,7 @@ Spell::Spell( Unit* Caster, SpellEntry const *info, bool triggered, uint64 origi
|
||||
// wand case
|
||||
if((m_caster->getClassMask() & CLASSMASK_WAND_USERS) != 0 && m_caster->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
if(Item* pItem = ((Player*)m_caster)->GetWeaponForAttack(RANGED_ATTACK))
|
||||
if(Item* pItem = m_caster->ToPlayer()->GetWeaponForAttack(RANGED_ATTACK))
|
||||
m_spellSchoolMask = SpellSchoolMask(1 << pItem->GetProto()->Damage[0].DamageType);
|
||||
}
|
||||
}
|
||||
@@ -493,7 +493,7 @@ Spell::Spell( Unit* Caster, SpellEntry const *info, bool triggered, uint64 origi
|
||||
Spell::~Spell()
|
||||
{
|
||||
if(m_caster && m_caster->GetTypeId() == TYPEID_PLAYER)
|
||||
assert(((Player*)m_caster)->m_spellModTakingSpell != this);
|
||||
assert(m_caster->ToPlayer()->m_spellModTakingSpell != this);
|
||||
delete m_spellValue;
|
||||
}
|
||||
|
||||
@@ -605,7 +605,7 @@ void Spell::SelectSpellTargets()
|
||||
{
|
||||
// clear cooldown at fail
|
||||
if(m_caster->GetTypeId() == TYPEID_PLAYER)
|
||||
((Player*)m_caster)->RemoveSpellCooldown(m_spellInfo->Id, true);
|
||||
m_caster->ToPlayer()->RemoveSpellCooldown(m_spellInfo->Id, true);
|
||||
SendCastResult(SPELL_FAILED_NO_EDIBLE_CORPSES);
|
||||
finish(false);
|
||||
}
|
||||
@@ -637,9 +637,9 @@ void Spell::SelectSpellTargets()
|
||||
AddUnitTarget(m_caster, i);
|
||||
break;
|
||||
case SPELL_EFFECT_SUMMON_PLAYER:
|
||||
if(m_caster->GetTypeId() == TYPEID_PLAYER && ((Player*)m_caster)->GetSelection())
|
||||
if(m_caster->GetTypeId() == TYPEID_PLAYER && m_caster->ToPlayer()->GetSelection())
|
||||
{
|
||||
Player* target = objmgr.GetPlayer(((Player*)m_caster)->GetSelection());
|
||||
Player* target = objmgr.GetPlayer(m_caster->ToPlayer()->GetSelection());
|
||||
if(target)
|
||||
AddUnitTarget(target, i);
|
||||
}
|
||||
@@ -1251,7 +1251,7 @@ void Spell::DoAllEffectOnTarget(TargetInfo *target)
|
||||
if(unit->IsPvP())
|
||||
{
|
||||
if (m_caster->GetTypeId() == TYPEID_PLAYER)
|
||||
((Player*)m_caster)->UpdatePvP(true);
|
||||
m_caster->ToPlayer()->UpdatePvP(true);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1268,13 +1268,13 @@ SpellMissInfo Spell::DoSpellHitOnUnit(Unit *unit, const uint32 effectMask, bool
|
||||
|
||||
if (unit->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
((Player*)unit)->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, m_spellInfo->Id);
|
||||
((Player*)unit)->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET2, m_spellInfo->Id);
|
||||
unit->ToPlayer()->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, m_spellInfo->Id);
|
||||
unit->ToPlayer()->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET2, m_spellInfo->Id);
|
||||
}
|
||||
|
||||
if(m_caster->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
((Player*)m_caster)->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL2, m_spellInfo->Id, 0, unit);
|
||||
m_caster->ToPlayer()->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL2, m_spellInfo->Id, 0, unit);
|
||||
}
|
||||
|
||||
if( m_caster != unit )
|
||||
@@ -1320,7 +1320,7 @@ SpellMissInfo Spell::DoSpellHitOnUnit(Unit *unit, const uint32 effectMask, bool
|
||||
{
|
||||
m_caster->SetContestedPvP();
|
||||
if(m_caster->GetTypeId() == TYPEID_PLAYER)
|
||||
((Player*)m_caster)->UpdatePvP(true);
|
||||
m_caster->ToPlayer()->UpdatePvP(true);
|
||||
}
|
||||
if( unit->isInCombat() && !(m_spellInfo->AttributesEx3 & SPELL_ATTR_EX3_NO_INITIAL_AGGRO) )
|
||||
{
|
||||
@@ -1576,7 +1576,7 @@ struct ChainHealingOrder : public std::binary_function<const Unit*, const Unit*,
|
||||
/*if (Target == MainTarget)
|
||||
return 0;
|
||||
else*/ if (Target->GetTypeId() == TYPEID_PLAYER && MainTarget->GetTypeId() == TYPEID_PLAYER &&
|
||||
((Player const*)Target)->IsInSameRaidWith((Player const*)MainTarget))
|
||||
Target->ToPlayer()->IsInSameRaidWith(MainTarget->ToPlayer()))
|
||||
{
|
||||
if (Target->GetHealth() == Target->GetMaxHealth())
|
||||
return 40000;
|
||||
@@ -2110,7 +2110,7 @@ void Spell::SelectEffectTargets(uint32 i, uint32 cur)
|
||||
break;
|
||||
case TARGET_DST_HOME:
|
||||
if(m_caster->GetTypeId() == TYPEID_PLAYER)
|
||||
m_targets.setDst(((Player*)m_caster)->m_homebindX,((Player*)m_caster)->m_homebindY,((Player*)m_caster)->m_homebindZ, ((Player*)m_caster)->GetOrientation(), ((Player*)m_caster)->m_homebindMapId);
|
||||
m_targets.setDst(m_caster->ToPlayer()->m_homebindX,m_caster->ToPlayer()->m_homebindY,m_caster->ToPlayer()->m_homebindZ, m_caster->ToPlayer()->GetOrientation(), m_caster->ToPlayer()->m_homebindMapId);
|
||||
break;
|
||||
case TARGET_DST_NEARBY_ENTRY:
|
||||
{
|
||||
@@ -2324,7 +2324,7 @@ void Spell::SelectEffectTargets(uint32 i, uint32 cur)
|
||||
else
|
||||
{
|
||||
if (m_caster->GetTypeId() == TYPEID_PLAYER)
|
||||
((Player*)m_caster)->RemoveSpellCooldown(m_spellInfo->Id,true);
|
||||
m_caster->ToPlayer()->RemoveSpellCooldown(m_spellInfo->Id,true);
|
||||
SendCastResult(SPELL_FAILED_CANT_DO_THAT_RIGHT_NOW);
|
||||
finish(false);
|
||||
}
|
||||
@@ -2576,7 +2576,7 @@ void Spell::prepare(SpellCastTargets const* targets, AuraEffect const * triggere
|
||||
if(m_caster->GetTypeId() == TYPEID_UNIT)
|
||||
target = m_caster->getVictim();
|
||||
else
|
||||
target = ObjectAccessor::GetUnit(*m_caster, ((Player*)m_caster)->GetSelection());
|
||||
target = ObjectAccessor::GetUnit(*m_caster, m_caster->ToPlayer()->GetSelection());
|
||||
|
||||
if (target && IsValidSingleTargetSpell(target))
|
||||
m_targets.setUnitTarget(target);
|
||||
@@ -2654,11 +2654,11 @@ void Spell::prepare(SpellCastTargets const* targets, AuraEffect const * triggere
|
||||
}
|
||||
|
||||
if (m_caster->GetTypeId() == TYPEID_PLAYER)
|
||||
((Player*)m_caster)->SetSpellModTakingSpell(this, true);
|
||||
m_caster->ToPlayer()->SetSpellModTakingSpell(this, true);
|
||||
// Fill cost data (not use power for item casts
|
||||
m_powerCost = m_CastItem ? 0 : CalculatePowerCost(m_spellInfo, m_caster, m_spellSchoolMask);
|
||||
if (m_caster->GetTypeId() == TYPEID_PLAYER)
|
||||
((Player*)m_caster)->SetSpellModTakingSpell(this, false);
|
||||
m_caster->ToPlayer()->SetSpellModTakingSpell(this, false);
|
||||
|
||||
SpellCastResult result = CheckCast(true);
|
||||
if(result != SPELL_CAST_OK && !IsAutoRepeat()) //always cast autorepeat dummy for triggering
|
||||
@@ -2761,7 +2761,7 @@ void Spell::cancel()
|
||||
|
||||
// spell is canceled-take mods and clear list
|
||||
if (m_caster->GetTypeId() == TYPEID_PLAYER)
|
||||
((Player*)m_caster)->RemoveSpellMods(this);
|
||||
m_caster->ToPlayer()->RemoveSpellMods(this);
|
||||
|
||||
m_appliedMods.clear();
|
||||
} break;
|
||||
@@ -2819,7 +2819,7 @@ void Spell::cast(bool skipCheck)
|
||||
{
|
||||
// Set spell which will drop charges for triggered cast spells
|
||||
// if not successfully casted, will be remove in finish(false)
|
||||
((Player*)m_caster)->SetSpellModTakingSpell(this, true);
|
||||
m_caster->ToPlayer()->SetSpellModTakingSpell(this, true);
|
||||
}
|
||||
|
||||
// triggered cast called from Spell::prepare where it was already checked
|
||||
@@ -2833,10 +2833,10 @@ void Spell::cast(bool skipCheck)
|
||||
//restore spell mods
|
||||
if (m_caster->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
((Player*)m_caster)->RestoreSpellMods(this);
|
||||
m_caster->ToPlayer()->RestoreSpellMods(this);
|
||||
// cleanup after mod system
|
||||
// triggered spell pointer can be not removed in some cases
|
||||
((Player*)m_caster)->SetSpellModTakingSpell(this, false);
|
||||
m_caster->ToPlayer()->SetSpellModTakingSpell(this, false);
|
||||
}
|
||||
finish(false);
|
||||
SetExecutedCurrently(false);
|
||||
@@ -2853,10 +2853,10 @@ void Spell::cast(bool skipCheck)
|
||||
//restore spell mods
|
||||
if (m_caster->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
((Player*)m_caster)->RestoreSpellMods(this);
|
||||
m_caster->ToPlayer()->RestoreSpellMods(this);
|
||||
// cleanup after mod system
|
||||
// triggered spell pointer can be not removed in some cases
|
||||
((Player*)m_caster)->SetSpellModTakingSpell(this, false);
|
||||
m_caster->ToPlayer()->SetSpellModTakingSpell(this, false);
|
||||
}
|
||||
finish(false);
|
||||
SetExecutedCurrently(false);
|
||||
@@ -2893,9 +2893,9 @@ void Spell::cast(bool skipCheck)
|
||||
if (m_caster->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
if (!m_IsTriggeredSpell && m_CastItem)
|
||||
((Player*)m_caster)->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_USE_ITEM, m_CastItem->GetEntry());
|
||||
m_caster->ToPlayer()->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_USE_ITEM, m_CastItem->GetEntry());
|
||||
|
||||
((Player*)m_caster)->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL, m_spellInfo->Id);
|
||||
m_caster->ToPlayer()->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL, m_spellInfo->Id);
|
||||
}
|
||||
|
||||
if(!m_IsTriggeredSpell)
|
||||
@@ -2978,7 +2978,7 @@ void Spell::cast(bool skipCheck)
|
||||
|
||||
}
|
||||
if (m_caster->GetTypeId() == TYPEID_PLAYER)
|
||||
((Player*)m_caster)->SetSpellModTakingSpell(this, false);
|
||||
m_caster->ToPlayer()->SetSpellModTakingSpell(this, false);
|
||||
|
||||
SetExecutedCurrently(false);
|
||||
}
|
||||
@@ -3026,7 +3026,7 @@ uint64 Spell::handle_delayed(uint64 t_offset)
|
||||
UpdatePointers();
|
||||
|
||||
if (m_caster->GetTypeId() == TYPEID_PLAYER)
|
||||
((Player*)m_caster)->SetSpellModTakingSpell(this, true);
|
||||
m_caster->ToPlayer()->SetSpellModTakingSpell(this, true);
|
||||
|
||||
uint64 next_time = 0;
|
||||
|
||||
@@ -3063,7 +3063,7 @@ uint64 Spell::handle_delayed(uint64 t_offset)
|
||||
}
|
||||
|
||||
if (m_caster->GetTypeId() == TYPEID_PLAYER)
|
||||
((Player*)m_caster)->SetSpellModTakingSpell(this, false);
|
||||
m_caster->ToPlayer()->SetSpellModTakingSpell(this, false);
|
||||
|
||||
// All targets passed - need finish phase
|
||||
if (next_time == 0)
|
||||
@@ -3384,11 +3384,11 @@ void Spell::finish(bool ok)
|
||||
if (m_caster->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
if (!m_triggeredByAuraSpell)
|
||||
((Player*)m_caster)->UpdatePotionCooldown(this);
|
||||
m_caster->ToPlayer()->UpdatePotionCooldown(this);
|
||||
|
||||
// triggered spell pointer can be not set in some cases
|
||||
// this is needed for proper apply of triggered spell mods
|
||||
((Player*)m_caster)->SetSpellModTakingSpell(this, true);
|
||||
m_caster->ToPlayer()->SetSpellModTakingSpell(this, true);
|
||||
}
|
||||
|
||||
// call triggered spell only at successful cast (after clear combo points -> for add some if need)
|
||||
@@ -3400,8 +3400,8 @@ void Spell::finish(bool ok)
|
||||
// mods are taken only on succesfull cast and independantly from targets of the spell
|
||||
if (m_caster->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
((Player*)m_caster)->RemoveSpellMods(this);
|
||||
((Player*)m_caster)->SetSpellModTakingSpell(this, false);
|
||||
m_caster->ToPlayer()->RemoveSpellMods(this);
|
||||
m_caster->ToPlayer()->SetSpellModTakingSpell(this, false);
|
||||
}
|
||||
|
||||
// Stop Attack for some spells
|
||||
@@ -3417,7 +3417,7 @@ void Spell::SendCastResult(SpellCastResult result)
|
||||
if (m_caster->GetTypeId() != TYPEID_PLAYER)
|
||||
return;
|
||||
|
||||
if(((Player*)m_caster)->GetSession()->PlayerLoading()) // don't send cast results at loading time
|
||||
if(m_caster->ToPlayer()->GetSession()->PlayerLoading()) // don't send cast results at loading time
|
||||
return;
|
||||
|
||||
SendCastResult((Player*)m_caster,m_spellInfo,m_cast_count,result);
|
||||
@@ -3598,7 +3598,7 @@ void Spell::SendSpellGo()
|
||||
if ( castFlags & CAST_FLAG_RUNE_LIST ) // rune cooldowns list
|
||||
{
|
||||
uint8 v1 = m_runesState;
|
||||
uint8 v2 = ((Player*)m_caster)->GetRunesState();
|
||||
uint8 v2 = m_caster->ToPlayer()->GetRunesState();
|
||||
data << uint8(v1); // runes state before
|
||||
data << uint8(v2); // runes state after
|
||||
for (uint8 i = 0; i < MAX_RUNES; ++i)
|
||||
@@ -3640,7 +3640,7 @@ void Spell::WriteAmmoToPacket( WorldPacket * data )
|
||||
|
||||
if (m_caster->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
Item *pItem = ((Player*)m_caster)->GetWeaponForAttack( RANGED_ATTACK );
|
||||
Item *pItem = m_caster->ToPlayer()->GetWeaponForAttack( RANGED_ATTACK );
|
||||
if(pItem)
|
||||
{
|
||||
ammoInventoryType = pItem->GetProto()->InventoryType;
|
||||
@@ -3648,7 +3648,7 @@ void Spell::WriteAmmoToPacket( WorldPacket * data )
|
||||
ammoDisplayID = pItem->GetProto()->DisplayInfoID;
|
||||
else
|
||||
{
|
||||
uint32 ammoID = ((Player*)m_caster)->GetUInt32Value(PLAYER_AMMO_ID);
|
||||
uint32 ammoID = m_caster->ToPlayer()->GetUInt32Value(PLAYER_AMMO_ID);
|
||||
if(ammoID)
|
||||
{
|
||||
ItemPrototype const *pProto = objmgr.GetItemPrototype( ammoID );
|
||||
@@ -3964,7 +3964,7 @@ void Spell::SendPlaySpellVisual(uint32 SpellID)
|
||||
WorldPacket data(SMSG_PLAY_SPELL_VISUAL, 8 + 4);
|
||||
data << uint64(m_caster->GetGUID());
|
||||
data << uint32(SpellID); // spell visual id?
|
||||
((Player*)m_caster)->GetSession()->SendPacket(&data);
|
||||
m_caster->ToPlayer()->GetSession()->SendPacket(&data);
|
||||
}
|
||||
|
||||
void Spell::TakeCastItem()
|
||||
@@ -4019,7 +4019,7 @@ void Spell::TakeCastItem()
|
||||
if (expendable && withoutCharges)
|
||||
{
|
||||
uint32 count = 1;
|
||||
((Player*)m_caster)->DestroyItemCount(m_CastItem, count, true);
|
||||
m_caster->ToPlayer()->DestroyItemCount(m_CastItem, count, true);
|
||||
|
||||
// prevent crash at access to deleted m_targets.getItemTarget
|
||||
if(m_CastItem==m_targets.getItemTarget())
|
||||
@@ -4047,7 +4047,7 @@ void Spell::TakePower()
|
||||
if (ihit->missCondition != SPELL_MISS_NONE)
|
||||
{
|
||||
//lower spell cost on fail (by talent aura)
|
||||
if(Player *modOwner = ((Player*)m_caster)->GetSpellModOwner())
|
||||
if(Player *modOwner = m_caster->ToPlayer()->GetSpellModOwner())
|
||||
modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_SPELL_COST_REFUND_ON_FAIL, m_powerCost);
|
||||
}
|
||||
break;
|
||||
@@ -4092,7 +4092,7 @@ void Spell::TakeAmmo()
|
||||
{
|
||||
if(m_attackType == RANGED_ATTACK && m_caster->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
Item *pItem = ((Player*)m_caster)->GetWeaponForAttack( RANGED_ATTACK );
|
||||
Item *pItem = m_caster->ToPlayer()->GetWeaponForAttack( RANGED_ATTACK );
|
||||
|
||||
// wands don't have ammo
|
||||
if(!pItem || pItem->IsBroken() || pItem->GetProto()->SubClass==ITEM_SUBCLASS_WEAPON_WAND)
|
||||
@@ -4103,17 +4103,17 @@ void Spell::TakeAmmo()
|
||||
if(pItem->GetMaxStackCount()==1)
|
||||
{
|
||||
// decrease durability for non-stackable throw weapon
|
||||
((Player*)m_caster)->DurabilityPointLossForEquipSlot(EQUIPMENT_SLOT_RANGED);
|
||||
m_caster->ToPlayer()->DurabilityPointLossForEquipSlot(EQUIPMENT_SLOT_RANGED);
|
||||
}
|
||||
else
|
||||
{
|
||||
// decrease items amount for stackable throw weapon
|
||||
uint32 count = 1;
|
||||
((Player*)m_caster)->DestroyItemCount( pItem, count, true);
|
||||
m_caster->ToPlayer()->DestroyItemCount( pItem, count, true);
|
||||
}
|
||||
}
|
||||
else if(uint32 ammo = ((Player*)m_caster)->GetUInt32Value(PLAYER_AMMO_ID))
|
||||
((Player*)m_caster)->DestroyItemCount(ammo, 1, true);
|
||||
else if(uint32 ammo = m_caster->ToPlayer()->GetUInt32Value(PLAYER_AMMO_ID))
|
||||
m_caster->ToPlayer()->DestroyItemCount(ammo, 1, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4346,10 +4346,10 @@ SpellCastResult Spell::CheckCast(bool strict)
|
||||
if(m_caster->GetTypeId() == TYPEID_PLAYER && !(m_spellInfo->Attributes & SPELL_ATTR_PASSIVE))
|
||||
{
|
||||
//can cast triggered (by aura only?) spells while have this flag
|
||||
if (!m_IsTriggeredSpell && ((Player*)m_caster)->HasFlag(PLAYER_FLAGS, PLAYER_ALLOW_ONLY_ABILITY))
|
||||
if (!m_IsTriggeredSpell && m_caster->ToPlayer()->HasFlag(PLAYER_FLAGS, PLAYER_ALLOW_ONLY_ABILITY))
|
||||
return SPELL_FAILED_SPELL_IN_PROGRESS;
|
||||
|
||||
if (((Player*)m_caster)->HasSpellCooldown(m_spellInfo->Id))
|
||||
if (m_caster->ToPlayer()->HasSpellCooldown(m_spellInfo->Id))
|
||||
{
|
||||
if(m_triggeredByAuraSpell)
|
||||
return SPELL_FAILED_DONT_REPORT;
|
||||
@@ -4360,7 +4360,7 @@ SpellCastResult Spell::CheckCast(bool strict)
|
||||
|
||||
// only allow triggered spells if at an ended battleground
|
||||
if( !m_IsTriggeredSpell && m_caster->GetTypeId() == TYPEID_PLAYER)
|
||||
if(BattleGround * bg = ((Player*)m_caster)->GetBattleGround())
|
||||
if(BattleGround * bg = m_caster->ToPlayer()->GetBattleGround())
|
||||
if(bg->GetStatus() == STATUS_WAIT_LEAVE)
|
||||
return SPELL_FAILED_DONT_REPORT;
|
||||
|
||||
@@ -4425,10 +4425,10 @@ SpellCastResult Spell::CheckCast(bool strict)
|
||||
|
||||
// cancel autorepeat spells if cast start when moving
|
||||
// (not wand currently autorepeat cast delayed to moving stop anyway in spell update code)
|
||||
if( m_caster->GetTypeId() == TYPEID_PLAYER && ((Player*)m_caster)->isMoving() )
|
||||
if( m_caster->GetTypeId() == TYPEID_PLAYER && m_caster->ToPlayer()->isMoving() )
|
||||
{
|
||||
// skip stuck spell to allow use it in falling case and apply spell limitations at movement
|
||||
if( (!((Player*)m_caster)->m_movementInfo.HasMovementFlag(MOVEMENTFLAG_FALLING) || m_spellInfo->Effect[0] != SPELL_EFFECT_STUCK) &&
|
||||
if( (!m_caster->ToPlayer()->m_movementInfo.HasMovementFlag(MOVEMENTFLAG_FALLING) || m_spellInfo->Effect[0] != SPELL_EFFECT_STUCK) &&
|
||||
(IsAutoRepeat() || (m_spellInfo->AuraInterruptFlags & AURA_INTERRUPT_FLAG_NOT_SEATED) != 0) )
|
||||
return SPELL_FAILED_MOVING;
|
||||
}
|
||||
@@ -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 &&
|
||||
!((Player*)m_caster)->isAllowedToLoot((Creature*)target))
|
||||
!m_caster->ToPlayer()->isAllowedToLoot((Creature*)target))
|
||||
return SPELL_FAILED_CANT_CAST_ON_TAPPED;
|
||||
|
||||
if (m_customAttr & SPELL_ATTR_CU_PICKPOCKET)
|
||||
@@ -4485,7 +4485,7 @@ SpellCastResult Spell::CheckCast(bool strict)
|
||||
{
|
||||
if (target->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
if(!((Player*)target)->GetWeaponForAttack(BASE_ATTACK) || !((Player*)target)->IsUseEquipedWeapon(true))
|
||||
if(!target->ToPlayer()->GetWeaponForAttack(BASE_ATTACK) || !target->ToPlayer()->IsUseEquipedWeapon(true))
|
||||
return SPELL_FAILED_TARGET_NO_WEAPONS;
|
||||
}
|
||||
else if (!target->GetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID))
|
||||
@@ -4600,7 +4600,7 @@ SpellCastResult Spell::CheckCast(bool strict)
|
||||
|
||||
// Spell casted only on battleground
|
||||
if ((m_spellInfo->AttributesEx3 & SPELL_ATTR_EX3_BATTLEGROUND) && m_caster->GetTypeId() == TYPEID_PLAYER)
|
||||
if(!((Player*)m_caster)->InBattleGround())
|
||||
if(!m_caster->ToPlayer()->InBattleGround())
|
||||
return SPELL_FAILED_ONLY_BATTLEGROUNDS;
|
||||
|
||||
// do not allow spells to be cast in arenas
|
||||
@@ -4613,13 +4613,13 @@ SpellCastResult Spell::CheckCast(bool strict)
|
||||
return SPELL_FAILED_NOT_IN_ARENA;
|
||||
|
||||
// zone check
|
||||
if(m_caster->GetTypeId() == TYPEID_UNIT || !((Player*)m_caster)->isGameMaster())
|
||||
if(m_caster->GetTypeId() == TYPEID_UNIT || !m_caster->ToPlayer()->isGameMaster())
|
||||
{
|
||||
uint32 zone, area;
|
||||
m_caster->GetZoneAndAreaId(zone,area);
|
||||
|
||||
SpellCastResult locRes= spellmgr.GetSpellAllowedInLocationError(m_spellInfo,m_caster->GetMapId(),zone,area,
|
||||
m_caster->GetTypeId() == TYPEID_PLAYER ? ((Player*)m_caster) : NULL);
|
||||
m_caster->GetTypeId() == TYPEID_PLAYER ? m_caster->ToPlayer() : NULL);
|
||||
if(locRes != SPELL_CAST_OK)
|
||||
return locRes;
|
||||
}
|
||||
@@ -4853,7 +4853,7 @@ SpellCastResult Spell::CheckCast(bool strict)
|
||||
if(m_spellInfo->EffectImplicitTargetA[i] != TARGET_UNIT_PET)
|
||||
break;
|
||||
|
||||
Pet* pet = ((Player*)m_caster)->GetPet();
|
||||
Pet* pet = m_caster->ToPlayer()->GetPet();
|
||||
|
||||
if(!pet)
|
||||
return SPELL_FAILED_NO_PET;
|
||||
@@ -4873,7 +4873,7 @@ SpellCastResult Spell::CheckCast(bool strict)
|
||||
if (m_caster->GetTypeId() != TYPEID_PLAYER)
|
||||
return SPELL_FAILED_BAD_TARGETS;
|
||||
|
||||
Pet* pet = ((Player*)m_caster)->GetPet();
|
||||
Pet* pet = m_caster->ToPlayer()->GetPet();
|
||||
if(!pet)
|
||||
return SPELL_FAILED_NO_PET;
|
||||
|
||||
@@ -4904,7 +4904,7 @@ SpellCastResult Spell::CheckCast(bool strict)
|
||||
if(!foodItem)
|
||||
return SPELL_FAILED_BAD_TARGETS;
|
||||
|
||||
Pet* pet = ((Player*)m_caster)->GetPet();
|
||||
Pet* pet = m_caster->ToPlayer()->GetPet();
|
||||
|
||||
if(!pet)
|
||||
return SPELL_FAILED_NO_PET;
|
||||
@@ -4958,7 +4958,7 @@ SpellCastResult Spell::CheckCast(bool strict)
|
||||
|
||||
uint32 skill = creature->GetCreatureInfo()->GetRequiredLootSkill();
|
||||
|
||||
int32 skillValue = ((Player*)m_caster)->GetSkillValue(skill);
|
||||
int32 skillValue = m_caster->ToPlayer()->GetSkillValue(skill);
|
||||
int32 TargetLevel = m_targets.getUnitTarget()->getLevel();
|
||||
int32 ReqValue = (skillValue < 100 ? (TargetLevel-10) * 10 : TargetLevel * 5);
|
||||
if (ReqValue > skillValue)
|
||||
@@ -4987,8 +4987,8 @@ SpellCastResult Spell::CheckCast(bool strict)
|
||||
return SPELL_FAILED_BAD_TARGETS;
|
||||
|
||||
// In BattleGround players can use only flags and banners
|
||||
if( ((Player*)m_caster)->InBattleGround() &&
|
||||
!((Player*)m_caster)->CanUseBattleGroundObject() )
|
||||
if( m_caster->ToPlayer()->InBattleGround() &&
|
||||
!m_caster->ToPlayer()->CanUseBattleGroundObject() )
|
||||
return SPELL_FAILED_TRY_AGAIN;
|
||||
|
||||
// get the lock entry
|
||||
@@ -5059,7 +5059,7 @@ SpellCastResult Spell::CheckCast(bool strict)
|
||||
if (m_caster->GetTypeId() == TYPEID_PLAYER && m_caster->getClass()==CLASS_WARLOCK)
|
||||
{
|
||||
if (strict) //starting cast, trigger pet stun (cast by pet so it doesn't attack player)
|
||||
if(Pet* pet = ((Player*)m_caster)->GetPet())
|
||||
if(Pet* pet = m_caster->ToPlayer()->GetPet())
|
||||
pet->CastSpell(pet, 32752, true, NULL, NULL, pet->GetGUID());
|
||||
}
|
||||
else
|
||||
@@ -5075,11 +5075,11 @@ SpellCastResult Spell::CheckCast(bool strict)
|
||||
{
|
||||
if(m_caster->GetTypeId() != TYPEID_PLAYER)
|
||||
return SPELL_FAILED_BAD_TARGETS;
|
||||
if(!((Player*)m_caster)->GetSelection())
|
||||
if(!m_caster->ToPlayer()->GetSelection())
|
||||
return SPELL_FAILED_BAD_TARGETS;
|
||||
|
||||
Player* target = objmgr.GetPlayer(((Player*)m_caster)->GetSelection());
|
||||
if( !target || ((Player*)m_caster) == target || !target->IsInSameRaidWith((Player*)m_caster) )
|
||||
Player* target = objmgr.GetPlayer(m_caster->ToPlayer()->GetSelection());
|
||||
if( !target || m_caster->ToPlayer() == target || !target->IsInSameRaidWith(m_caster->ToPlayer()) )
|
||||
return SPELL_FAILED_BAD_TARGETS;
|
||||
|
||||
// check if our map is dungeon
|
||||
@@ -5098,7 +5098,7 @@ SpellCastResult Spell::CheckCast(bool strict)
|
||||
{
|
||||
//Do not allow to cast it before BG starts.
|
||||
if(m_caster->GetTypeId() == TYPEID_PLAYER)
|
||||
if(BattleGround const *bg = ((Player*)m_caster)->GetBattleGround())
|
||||
if(BattleGround const *bg = m_caster->ToPlayer()->GetBattleGround())
|
||||
if(bg->GetStatus() != STATUS_IN_PROGRESS)
|
||||
return SPELL_FAILED_TRY_AGAIN;
|
||||
break;
|
||||
@@ -5131,7 +5131,7 @@ SpellCastResult Spell::CheckCast(bool strict)
|
||||
break;
|
||||
}
|
||||
case 61336:
|
||||
if(m_caster->GetTypeId() != TYPEID_PLAYER || !((Player*)m_caster)->IsInFeralForm())
|
||||
if(m_caster->GetTypeId() != TYPEID_PLAYER || !m_caster->ToPlayer()->IsInFeralForm())
|
||||
return SPELL_FAILED_ONLY_SHAPESHIFT;
|
||||
break;
|
||||
// Wild Growth
|
||||
@@ -5147,7 +5147,7 @@ SpellCastResult Spell::CheckCast(bool strict)
|
||||
if (!target || target->GetTypeId() != TYPEID_PLAYER)
|
||||
return SPELL_FAILED_BAD_TARGETS;
|
||||
|
||||
if (!((Player*)m_caster)->IsInSameRaidWith(((Player*)target)))
|
||||
if (!m_caster->ToPlayer()->IsInSameRaidWith(target->ToPlayer()))
|
||||
return SPELL_FAILED_TARGET_NOT_IN_RAID;
|
||||
|
||||
break;
|
||||
@@ -5166,7 +5166,7 @@ SpellCastResult Spell::CheckCast(bool strict)
|
||||
return SPELL_FAILED_HIGHLEVEL;
|
||||
|
||||
// use SMSG_PET_TAME_FAILURE?
|
||||
if (!target->GetCreatureInfo()->isTameable (((Player*)m_caster)->CanTameExoticPets()))
|
||||
if (!target->GetCreatureInfo()->isTameable (m_caster->ToPlayer()->CanTameExoticPets()))
|
||||
return SPELL_FAILED_BAD_TARGETS;
|
||||
|
||||
if(m_caster->GetPetGUID())
|
||||
@@ -5196,7 +5196,7 @@ SpellCastResult Spell::CheckCast(bool strict)
|
||||
if(m_caster->GetTypeId() != TYPEID_PLAYER)
|
||||
return SPELL_FAILED_NO_PET;
|
||||
|
||||
Pet *pet = ((Player*)m_caster)->GetPet();
|
||||
Pet *pet = m_caster->ToPlayer()->GetPet();
|
||||
if(!pet)
|
||||
return SPELL_FAILED_NO_PET;
|
||||
|
||||
@@ -5241,7 +5241,7 @@ SpellCastResult Spell::CheckCast(bool strict)
|
||||
if (m_caster->IsInWater())
|
||||
return SPELL_FAILED_ONLY_ABOVEWATER;
|
||||
|
||||
if (m_caster->GetTypeId() == TYPEID_PLAYER && ((Player*)m_caster)->GetTransport())
|
||||
if (m_caster->GetTypeId() == TYPEID_PLAYER && m_caster->ToPlayer()->GetTransport())
|
||||
return SPELL_FAILED_NO_MOUNTS_ALLOWED;
|
||||
|
||||
// Ignore map check if spell have AreaId. AreaId already checked and this prevent special mount spells
|
||||
@@ -5687,7 +5687,7 @@ SpellCastResult Spell::CheckItems()
|
||||
// if not item target then required item must be equipped
|
||||
else
|
||||
{
|
||||
if(m_caster->GetTypeId() == TYPEID_PLAYER && !((Player*)m_caster)->HasItemFitToSpellReqirements(m_spellInfo))
|
||||
if(m_caster->GetTypeId() == TYPEID_PLAYER && !m_caster->ToPlayer()->HasItemFitToSpellReqirements(m_spellInfo))
|
||||
return SPELL_FAILED_EQUIPPED_ITEM_CLASS;
|
||||
}
|
||||
|
||||
@@ -5955,7 +5955,7 @@ SpellCastResult Spell::CheckItems()
|
||||
if(m_caster->GetTypeId() != TYPEID_PLAYER) return SPELL_FAILED_TARGET_NOT_PLAYER;
|
||||
if( m_attackType != RANGED_ATTACK )
|
||||
break;
|
||||
Item *pItem = ((Player*)m_caster)->GetWeaponForAttack(m_attackType);
|
||||
Item *pItem = m_caster->ToPlayer()->GetWeaponForAttack(m_attackType);
|
||||
if(!pItem || pItem->IsBroken())
|
||||
return SPELL_FAILED_EQUIPPED_ITEM;
|
||||
|
||||
@@ -5964,14 +5964,14 @@ SpellCastResult Spell::CheckItems()
|
||||
case ITEM_SUBCLASS_WEAPON_THROWN:
|
||||
{
|
||||
uint32 ammo = pItem->GetEntry();
|
||||
if( !((Player*)m_caster)->HasItemCount( ammo, 1 ) )
|
||||
if( !m_caster->ToPlayer()->HasItemCount( ammo, 1 ) )
|
||||
return SPELL_FAILED_NO_AMMO;
|
||||
}; break;
|
||||
case ITEM_SUBCLASS_WEAPON_GUN:
|
||||
case ITEM_SUBCLASS_WEAPON_BOW:
|
||||
case ITEM_SUBCLASS_WEAPON_CROSSBOW:
|
||||
{
|
||||
uint32 ammo = ((Player*)m_caster)->GetUInt32Value(PLAYER_AMMO_ID);
|
||||
uint32 ammo = m_caster->ToPlayer()->GetUInt32Value(PLAYER_AMMO_ID);
|
||||
if(!ammo)
|
||||
{
|
||||
// Requires No Ammo
|
||||
@@ -6004,7 +6004,7 @@ SpellCastResult Spell::CheckItems()
|
||||
return SPELL_FAILED_NO_AMMO;
|
||||
}
|
||||
|
||||
if( !((Player*)m_caster)->HasItemCount( ammo, 1 ) )
|
||||
if( !m_caster->ToPlayer()->HasItemCount( ammo, 1 ) )
|
||||
return SPELL_FAILED_NO_AMMO;
|
||||
}; break;
|
||||
case ITEM_SUBCLASS_WEAPON_WAND:
|
||||
@@ -6041,7 +6041,7 @@ SpellCastResult Spell::CheckItems()
|
||||
// main hand weapon required
|
||||
if(m_spellInfo->AttributesEx3 & SPELL_ATTR_EX3_MAIN_HAND)
|
||||
{
|
||||
Item* item = ((Player*)m_caster)->GetWeaponForAttack(BASE_ATTACK);
|
||||
Item* item = m_caster->ToPlayer()->GetWeaponForAttack(BASE_ATTACK);
|
||||
|
||||
// skip spell if no weapon in slot or broken
|
||||
if(!item || item->IsBroken() )
|
||||
@@ -6055,7 +6055,7 @@ SpellCastResult Spell::CheckItems()
|
||||
// offhand hand weapon required
|
||||
if(m_spellInfo->AttributesEx3 & SPELL_ATTR_EX3_REQ_OFFHAND)
|
||||
{
|
||||
Item* item = ((Player*)m_caster)->GetWeaponForAttack(OFF_ATTACK);
|
||||
Item* item = m_caster->ToPlayer()->GetWeaponForAttack(OFF_ATTACK);
|
||||
|
||||
// skip spell if no weapon in slot or broken
|
||||
if(!item || item->IsBroken() )
|
||||
@@ -6088,7 +6088,7 @@ void Spell::Delayed() // only called in DealDamage()
|
||||
//check pushback reduce
|
||||
int32 delaytime = 500; // spellcasting delay is normally 500ms
|
||||
int32 delayReduce = 100; // must be initialized to 100 for percent modifiers
|
||||
((Player*)m_caster)->ApplySpellMod(m_spellInfo->Id, SPELLMOD_NOT_LOSE_CASTING_TIME, delayReduce, this);
|
||||
m_caster->ToPlayer()->ApplySpellMod(m_spellInfo->Id, SPELLMOD_NOT_LOSE_CASTING_TIME, delayReduce, this);
|
||||
delayReduce += m_caster->GetTotalAuraModifier(SPELL_AURA_REDUCE_PUSHBACK) - 100;
|
||||
if(delayReduce >= 100)
|
||||
return;
|
||||
@@ -6123,7 +6123,7 @@ void Spell::DelayedChannel()
|
||||
//check pushback reduce
|
||||
int32 delaytime = GetSpellDuration(m_spellInfo) * 25 / 100; // channeling delay is normally 25% of its time per hit
|
||||
int32 delayReduce = 100; // must be initialized to 100 for percent modifiers
|
||||
((Player*)m_caster)->ApplySpellMod(m_spellInfo->Id, SPELLMOD_NOT_LOSE_CASTING_TIME, delayReduce, this);
|
||||
m_caster->ToPlayer()->ApplySpellMod(m_spellInfo->Id, SPELLMOD_NOT_LOSE_CASTING_TIME, delayReduce, this);
|
||||
delayReduce += m_caster->GetTotalAuraModifier(SPELL_AURA_REDUCE_PUSHBACK) - 100;
|
||||
if(delayReduce >= 100)
|
||||
return;
|
||||
@@ -6164,7 +6164,7 @@ void Spell::UpdatePointers()
|
||||
}
|
||||
|
||||
if (m_castItemGUID && m_caster->GetTypeId() == TYPEID_PLAYER)
|
||||
m_CastItem = ((Player*)m_caster)->GetItemByGuid(m_castItemGUID);
|
||||
m_CastItem = m_caster->ToPlayer()->GetItemByGuid(m_castItemGUID);
|
||||
|
||||
m_targets.Update(m_caster);
|
||||
}
|
||||
@@ -6246,10 +6246,10 @@ bool Spell::CheckTarget(Unit* target, uint32 eff)
|
||||
//Check player targets and remove if in GM mode or GM invisibility (for not self casting case)
|
||||
if( target != m_caster && target->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
if(((Player*)target)->GetVisibility() == VISIBILITY_OFF)
|
||||
if(target->ToPlayer()->GetVisibility() == VISIBILITY_OFF)
|
||||
return false;
|
||||
|
||||
if(((Player*)target)->isGameMaster() && !IsPositiveSpell(m_spellInfo->Id))
|
||||
if(target->ToPlayer()->isGameMaster() && !IsPositiveSpell(m_spellInfo->Id))
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -6672,7 +6672,7 @@ SpellCastResult Spell::CanOpenLock(uint32 effIndex, uint32 lockId, SkillType& sk
|
||||
|
||||
// castitem check: rogue using skeleton keys. the skill values should not be added in this case.
|
||||
skillValue = m_CastItem || m_caster->GetTypeId()!= TYPEID_PLAYER ?
|
||||
0 : ((Player*)m_caster)->GetSkillValue(skillId);
|
||||
0 : m_caster->ToPlayer()->GetSkillValue(skillId);
|
||||
|
||||
skillValue += spellSkillBonus;
|
||||
|
||||
|
||||
@@ -559,7 +559,7 @@ int32 AuraEffect::CalculateAmount(Unit * caster)
|
||||
//4 points: ${($m1+$b1*4+0.03428571*$AP)*7} damage over 14 secs
|
||||
//5 points: ${($m1+$b1*5+0.0375*$AP)*8} damage over 16 secs
|
||||
float AP_per_combo[6] = {0.0f, 0.015f, 0.024f, 0.03f, 0.03428571f, 0.0375f};
|
||||
uint8 cp = ((Player*)caster)->GetComboPoints();
|
||||
uint8 cp = caster->ToPlayer()->GetComboPoints();
|
||||
if (cp > 5) cp = 5;
|
||||
amount += int32(caster->GetTotalAttackPowerValue(BASE_ATTACK) * AP_per_combo[cp]);
|
||||
}
|
||||
@@ -571,7 +571,7 @@ int32 AuraEffect::CalculateAmount(Unit * caster)
|
||||
if (caster->GetTypeId() != TYPEID_PLAYER)
|
||||
break;
|
||||
|
||||
uint8 cp = ((Player*)caster)->GetComboPoints();
|
||||
uint8 cp = caster->ToPlayer()->GetComboPoints();
|
||||
|
||||
// Idol of Feral Shadows. Cant be handled as SpellMod in SpellAura:Dummy due its dependency from CPs
|
||||
if (AuraEffect const * aurEff = caster->GetAuraEffect(34241,0))
|
||||
@@ -634,7 +634,7 @@ int32 AuraEffect::CalculateAmount(Unit * caster)
|
||||
if (caster->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
int32 value = int32((amount*-1)-10);
|
||||
uint32 defva = uint32(((Player*)caster)->GetSkillValue(SKILL_DEFENSE) + ((Player*)caster)->GetRatingBonusValue(CR_DEFENSE_SKILL));
|
||||
uint32 defva = uint32(caster->ToPlayer()->GetSkillValue(SKILL_DEFENSE) + caster->ToPlayer()->GetRatingBonusValue(CR_DEFENSE_SKILL));
|
||||
|
||||
if(defva > 400)
|
||||
value += int32((defva-400)*0.15);
|
||||
@@ -933,7 +933,7 @@ void AuraEffect::ApplySpellMod(Unit * target, bool apply)
|
||||
if(!m_spellmod || target->GetTypeId() != TYPEID_PLAYER)
|
||||
return;
|
||||
|
||||
((Player*)target)->AddSpellMod(m_spellmod, apply);
|
||||
target->ToPlayer()->AddSpellMod(m_spellmod, apply);
|
||||
|
||||
// Auras with charges do not mod amount of passive auras
|
||||
if (GetBase()->GetCharges())
|
||||
@@ -1050,7 +1050,7 @@ void AuraEffect::UpdatePeriodic(Unit * caster)
|
||||
if (target->GetTypeId() != TYPEID_PLAYER)
|
||||
break;
|
||||
|
||||
if (((Player*)target)->isMoving())
|
||||
if (target->ToPlayer()->isMoving())
|
||||
m_amount = target->CalculateSpellDamage(m_spellProto,m_effIndex,m_baseAmount,target);
|
||||
else
|
||||
--m_amount;
|
||||
@@ -1093,7 +1093,7 @@ void AuraEffect::UpdatePeriodic(Unit * caster)
|
||||
else
|
||||
{
|
||||
// default case - not in arena
|
||||
if (!((Player*)caster)->InArena())
|
||||
if (!caster->ToPlayer()->InArena())
|
||||
{
|
||||
aurEff->ChangeAmount(GetAmount());
|
||||
m_isPeriodic = false;
|
||||
@@ -1467,8 +1467,8 @@ void AuraEffect::PeriodicTick(Unit * target, Unit * caster) const
|
||||
|
||||
// add HoTs to amount healed in bgs
|
||||
if( caster->GetTypeId() == TYPEID_PLAYER )
|
||||
if( BattleGround *bg = ((Player*)caster)->GetBattleGround() )
|
||||
bg->UpdatePlayerScore(((Player*)caster), SCORE_HEALING_DONE, gain);
|
||||
if( BattleGround *bg = caster->ToPlayer()->GetBattleGround() )
|
||||
bg->UpdatePlayerScore(caster->ToPlayer(), SCORE_HEALING_DONE, gain);
|
||||
|
||||
target->getHostilRefManager().threatAssist(caster, float(gain) * 0.5f, GetSpellProto());
|
||||
|
||||
@@ -1959,11 +1959,11 @@ void AuraEffect::PeriodicDummyTick(Unit * target, Unit * caster) const
|
||||
{
|
||||
if (target->GetTypeId() != TYPEID_PLAYER)
|
||||
return;
|
||||
if(((Player*)target)->getClass() != CLASS_DEATH_KNIGHT)
|
||||
if(target->ToPlayer()->getClass() != CLASS_DEATH_KNIGHT)
|
||||
return;
|
||||
|
||||
// timer expired - remove death runes
|
||||
((Player*)target)->RemoveRunesByAuraEffect(this);
|
||||
target->ToPlayer()->RemoveRunesByAuraEffect(this);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -2409,14 +2409,14 @@ void AuraEffect::HandleShapeshiftBoosts(Unit * target, bool apply) const
|
||||
target->CastSpell(target, itr->first, true, NULL, this);
|
||||
}
|
||||
// Leader of the Pack
|
||||
if (((Player*)target)->HasSpell(17007))
|
||||
if (target->ToPlayer()->HasSpell(17007))
|
||||
{
|
||||
SpellEntry const *spellInfo = sSpellStore.LookupEntry(24932);
|
||||
if (spellInfo && spellInfo->Stances & (1<<(GetMiscValue()-1)))
|
||||
target->CastSpell(target, 24932, true, NULL, this);
|
||||
}
|
||||
// Improved Barkskin - apply/remove armor bonus due to shapeshift
|
||||
if (((Player*)target)->HasSpell(63410) || ((Player*)target)->HasSpell(63411))
|
||||
if (target->ToPlayer()->HasSpell(63410) || target->ToPlayer()->HasSpell(63411))
|
||||
{
|
||||
target->RemoveAurasDueToSpell(66530);
|
||||
if (GetMiscValue() == FORM_TRAVEL || GetMiscValue() == FORM_NONE) // "while in Travel Form or while not shapeshifted"
|
||||
@@ -2509,7 +2509,7 @@ void AuraEffect::HandleShapeshiftBoosts(Unit * target, bool apply) const
|
||||
target->RemoveAurasDueToSpell(spellId2);
|
||||
|
||||
// Improved Barkskin - apply/remove armor bonus due to shapeshift
|
||||
if (((Player*)target)->HasSpell(63410) || ((Player*)target)->HasSpell(63411))
|
||||
if (target->ToPlayer()->HasSpell(63410) || target->ToPlayer()->HasSpell(63411))
|
||||
{
|
||||
target->RemoveAurasDueToSpell(66530);
|
||||
target->CastSpell(target,66530,true);
|
||||
@@ -2647,7 +2647,7 @@ void AuraEffect::HandleSpiritOfRedemption(AuraApplication const * aurApp, uint8
|
||||
if(target->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
// disable breath/etc timers
|
||||
((Player*)target)->StopMirrorTimers();
|
||||
target->ToPlayer()->StopMirrorTimers();
|
||||
|
||||
// set stand state (expected in this form)
|
||||
if(!target->IsStandState())
|
||||
@@ -2694,15 +2694,15 @@ void AuraEffect::HandlePhase(AuraApplication const * aurApp, uint8 mode, bool ap
|
||||
if(target->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
// drop flag at invisible in bg
|
||||
if(((Player*)target)->InBattleGround())
|
||||
if(BattleGround *bg = ((Player*)target)->GetBattleGround())
|
||||
bg->EventPlayerDroppedFlag((Player*)target);
|
||||
if(target->ToPlayer()->InBattleGround())
|
||||
if(BattleGround *bg = target->ToPlayer()->GetBattleGround())
|
||||
bg->EventPlayerDroppedFlag(target->ToPlayer());
|
||||
|
||||
// GM-mode have mask 0xFFFFFFFF
|
||||
if(!((Player*)target)->isGameMaster())
|
||||
if(!target->ToPlayer()->isGameMaster())
|
||||
target->SetPhaseMask((apply) ? GetMiscValue() : PHASEMASK_NORMAL,false);
|
||||
|
||||
((Player*)target)->GetSession()->SendSetPhaseShift((apply) ? GetMiscValue() : PHASEMASK_NORMAL);
|
||||
target->ToPlayer()->GetSession()->SendSetPhaseShift((apply) ? GetMiscValue() : PHASEMASK_NORMAL);
|
||||
}
|
||||
else
|
||||
target->SetPhaseMask((apply) ? GetMiscValue() : PHASEMASK_NORMAL,false);
|
||||
@@ -2906,7 +2906,7 @@ void AuraEffect::HandleAuraModShapeshift(AuraApplication const * aurApp, uint8 m
|
||||
HandleShapeshiftBoosts(target, apply);
|
||||
|
||||
if(target->GetTypeId() == TYPEID_PLAYER)
|
||||
((Player*)target)->InitDataForForm();
|
||||
target->ToPlayer()->InitDataForForm();
|
||||
|
||||
if(target->getClass() == CLASS_DRUID)
|
||||
{
|
||||
@@ -2923,9 +2923,9 @@ void AuraEffect::HandleAuraModShapeshift(AuraApplication const * aurApp, uint8 m
|
||||
if (!shapeInfo->stanceSpell[i])
|
||||
continue;
|
||||
if (apply)
|
||||
((Player*)target)->AddTemporarySpell(shapeInfo->stanceSpell[i]);
|
||||
target->ToPlayer()->AddTemporarySpell(shapeInfo->stanceSpell[i]);
|
||||
else
|
||||
((Player*)target)->RemoveTemporarySpell(shapeInfo->stanceSpell[i]);
|
||||
target->ToPlayer()->RemoveTemporarySpell(shapeInfo->stanceSpell[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3042,7 +3042,7 @@ void AuraEffect::HandleAuraTransform(AuraApplication const * aurApp, uint8 mode,
|
||||
// for players, start regeneration after 1s (in polymorph fast regeneration case)
|
||||
// only if caster is Player (after patch 2.4.2)
|
||||
if (IS_PLAYER_GUID(GetCasterGUID()) )
|
||||
((Player*)target)->setRegenTimerCount(1*IN_MILISECONDS);
|
||||
target->ToPlayer()->setRegenTimerCount(1*IN_MILISECONDS);
|
||||
|
||||
//dismount polymorphed target (after patch 2.4.2)
|
||||
if (target->IsMounted())
|
||||
@@ -3083,7 +3083,7 @@ void AuraEffect::HandleAuraTransform(AuraApplication const * aurApp, uint8 mode,
|
||||
{
|
||||
uint32 team = 0;
|
||||
if (target->GetTypeId() == TYPEID_PLAYER)
|
||||
team = ((Player*)target)->GetTeam();
|
||||
team = target->ToPlayer()->GetTeam();
|
||||
|
||||
uint32 display_id = objmgr.ChooseDisplayId(team,ci);
|
||||
CreatureModelInfo const *minfo = objmgr.GetCreatureModelRandomGender(display_id);
|
||||
@@ -3276,8 +3276,8 @@ void AuraEffect::HandleAuraModDisarm(AuraApplication const * aurApp, uint8 mode,
|
||||
// This is between the two because there is a check in _ApplyItemMods
|
||||
// we must make sure that flag is always removed when call that function
|
||||
// refer to DurabilityPointsLoss
|
||||
if(Item *pItem = ((Player*)target)->GetItemByPos( INVENTORY_SLOT_BAG_0, slot ))
|
||||
((Player*)target)->_ApplyItemMods(pItem, slot, !apply);
|
||||
if(Item *pItem = target->ToPlayer()->GetItemByPos( INVENTORY_SLOT_BAG_0, slot ))
|
||||
target->ToPlayer()->_ApplyItemMods(pItem, slot, !apply);
|
||||
}
|
||||
|
||||
if(apply)
|
||||
@@ -3480,7 +3480,7 @@ void AuraEffect::HandleAuraModPetTalentsPoints(AuraApplication const * aurApp, u
|
||||
return;
|
||||
|
||||
// Recalculate pet talent points
|
||||
if (Pet *pet = ((Player*)target)->GetPet())
|
||||
if (Pet *pet = target->ToPlayer()->GetPet())
|
||||
pet->InitTalentForLevel();
|
||||
}
|
||||
|
||||
@@ -3494,9 +3494,9 @@ void AuraEffect::HandleAuraModSkill(AuraApplication const * aurApp, uint8 mode,
|
||||
uint32 prot = GetSpellProto()->EffectMiscValue[m_effIndex];
|
||||
int32 points = GetAmount();
|
||||
|
||||
((Player*)target)->ModifySkillBonus(prot,((apply) ? points: -points),GetAuraType() == SPELL_AURA_MOD_SKILL_TALENT);
|
||||
target->ToPlayer()->ModifySkillBonus(prot,((apply) ? points: -points),GetAuraType() == SPELL_AURA_MOD_SKILL_TALENT);
|
||||
if(prot == SKILL_DEFENSE)
|
||||
((Player*)target)->UpdateDefenseBonusesMod();
|
||||
target->ToPlayer()->UpdateDefenseBonusesMod();
|
||||
}
|
||||
|
||||
/****************************/
|
||||
@@ -3521,7 +3521,7 @@ void AuraEffect::HandleAuraMounted(AuraApplication const * aurApp, uint8 mode, b
|
||||
|
||||
uint32 team = 0;
|
||||
if (target->GetTypeId() == TYPEID_PLAYER)
|
||||
team = ((Player*)target)->GetTeam();
|
||||
team = target->ToPlayer()->GetTeam();
|
||||
|
||||
uint32 display_id = objmgr.ChooseDisplayId(team,ci);
|
||||
CreatureModelInfo const *minfo = objmgr.GetCreatureModelRandomGender(display_id);
|
||||
@@ -3626,7 +3626,7 @@ void AuraEffect::HandleAuraFeatherFall(AuraApplication const * aurApp, uint8 mod
|
||||
|
||||
// start fall from current height
|
||||
if(!apply && target->GetTypeId() == TYPEID_PLAYER)
|
||||
((Player*)target)->SetFallInformation(0, target->GetPositionZ());
|
||||
target->ToPlayer()->SetFallInformation(0, target->GetPositionZ());
|
||||
}
|
||||
|
||||
void AuraEffect::HandleAuraHover(AuraApplication const * aurApp, uint8 mode, bool apply) const
|
||||
@@ -3662,7 +3662,7 @@ void AuraEffect::HandleWaterBreathing(AuraApplication const * aurApp, uint8 mode
|
||||
|
||||
// update timers in client
|
||||
if(target->GetTypeId() == TYPEID_PLAYER)
|
||||
((Player*)target)->UpdateMirrorTimers();
|
||||
target->ToPlayer()->UpdateMirrorTimers();
|
||||
}
|
||||
|
||||
void AuraEffect::HandleForceMoveForward(AuraApplication const * aurApp, uint8 mode, bool apply) const
|
||||
@@ -3843,12 +3843,12 @@ void AuraEffect::HandleModPossessPet(AuraApplication const * aurApp, uint8 mode,
|
||||
return;
|
||||
|
||||
//seems it may happen that when removing it is no longer owner's pet
|
||||
//if(((Player*)caster)->GetPet() != target)
|
||||
//if(caster->ToPlayer()->GetPet() != target)
|
||||
// return;
|
||||
|
||||
if(apply)
|
||||
{
|
||||
if(((Player*)caster)->GetPet() != target)
|
||||
if(caster->ToPlayer()->GetPet() != target)
|
||||
return;
|
||||
|
||||
target->SetCharmedBy(caster, CHARM_TYPE_POSSESS);
|
||||
@@ -3858,7 +3858,7 @@ void AuraEffect::HandleModPossessPet(AuraApplication const * aurApp, uint8 mode,
|
||||
target->RemoveCharmedBy(caster);
|
||||
|
||||
// Reinitialize the pet bar and make the pet come back to the owner
|
||||
((Player*)caster)->PetSpellInitialize();
|
||||
caster->ToPlayer()->PetSpellInitialize();
|
||||
if(!target->getVictim())
|
||||
{
|
||||
target->GetMotionMaster()->MoveFollow(caster, PET_FOLLOW_DIST, target->GetFollowAngle());
|
||||
@@ -3920,7 +3920,7 @@ void AuraEffect::HandleAuraControlVehicle(AuraApplication const * aurApp, uint8
|
||||
if (apply)
|
||||
{
|
||||
//if(caster->GetTypeId() == TYPEID_PLAYER)
|
||||
// if(Pet *pet = ((Player*)caster)->GetPet())
|
||||
// if(Pet *pet = caster->ToPlayer()->GetPet())
|
||||
// pet->Remove(PET_SAVE_AS_CURRENT);
|
||||
caster->EnterVehicle(target->GetVehicleKit(), m_amount - 1);
|
||||
}
|
||||
@@ -4156,10 +4156,10 @@ void AuraEffect::HandleAuraModEffectImmunity(AuraApplication const * aurApp, uin
|
||||
{
|
||||
if(target->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
if(((Player*)target)->InBattleGround())
|
||||
if(target->ToPlayer()->InBattleGround())
|
||||
{
|
||||
if( BattleGround *bg = ((Player*)target)->GetBattleGround() )
|
||||
bg->EventPlayerDroppedFlag(((Player*)target));
|
||||
if( BattleGround *bg = target->ToPlayer()->GetBattleGround() )
|
||||
bg->EventPlayerDroppedFlag(target->ToPlayer());
|
||||
}
|
||||
else
|
||||
sOutdoorPvPMgr.HandleDropFlag((Player*)target,GetSpellProto()->Id);
|
||||
@@ -4458,7 +4458,7 @@ void AuraEffect::HandleModSpellDamagePercentFromStat(AuraApplication const * aur
|
||||
// Magic damage modifiers implemented in Unit::SpellDamageBonus
|
||||
// This information for client side use only
|
||||
// Recalculate bonus
|
||||
((Player*)target)->UpdateSpellDamageAndHealingBonus();
|
||||
target->ToPlayer()->UpdateSpellDamageAndHealingBonus();
|
||||
}
|
||||
|
||||
void AuraEffect::HandleModSpellHealingPercentFromStat(AuraApplication const * aurApp, uint8 mode, bool apply) const
|
||||
@@ -4472,7 +4472,7 @@ void AuraEffect::HandleModSpellHealingPercentFromStat(AuraApplication const * au
|
||||
return;
|
||||
|
||||
// Recalculate bonus
|
||||
((Player*)target)->UpdateSpellDamageAndHealingBonus();
|
||||
target->ToPlayer()->UpdateSpellDamageAndHealingBonus();
|
||||
}
|
||||
|
||||
void AuraEffect::HandleModSpellDamagePercentFromAttackPower(AuraApplication const * aurApp, uint8 mode, bool apply) const
|
||||
@@ -4488,7 +4488,7 @@ void AuraEffect::HandleModSpellDamagePercentFromAttackPower(AuraApplication cons
|
||||
// Magic damage modifiers implemented in Unit::SpellDamageBonus
|
||||
// This information for client side use only
|
||||
// Recalculate bonus
|
||||
((Player*)target)->UpdateSpellDamageAndHealingBonus();
|
||||
target->ToPlayer()->UpdateSpellDamageAndHealingBonus();
|
||||
}
|
||||
|
||||
void AuraEffect::HandleModSpellHealingPercentFromAttackPower(AuraApplication const * aurApp, uint8 mode, bool apply) const
|
||||
@@ -4502,7 +4502,7 @@ void AuraEffect::HandleModSpellHealingPercentFromAttackPower(AuraApplication con
|
||||
return;
|
||||
|
||||
// Recalculate bonus
|
||||
((Player*)target)->UpdateSpellDamageAndHealingBonus();
|
||||
target->ToPlayer()->UpdateSpellDamageAndHealingBonus();
|
||||
}
|
||||
|
||||
void AuraEffect::HandleModHealingDone(AuraApplication const * aurApp, uint8 mode, bool apply) const
|
||||
@@ -4516,7 +4516,7 @@ void AuraEffect::HandleModHealingDone(AuraApplication const * aurApp, uint8 mode
|
||||
return;
|
||||
// implemented in Unit::SpellHealingBonus
|
||||
// this information is for client side only
|
||||
((Player*)target)->UpdateSpellDamageAndHealingBonus();
|
||||
target->ToPlayer()->UpdateSpellDamageAndHealingBonus();
|
||||
}
|
||||
|
||||
void AuraEffect::HandleModTotalPercentStat(AuraApplication const * aurApp, uint8 mode, bool apply) const
|
||||
@@ -4587,8 +4587,8 @@ void AuraEffect::HandleAuraModExpertise(AuraApplication const * aurApp, uint8 mo
|
||||
if(target->GetTypeId() != TYPEID_PLAYER)
|
||||
return;
|
||||
|
||||
((Player*)target)->UpdateExpertise(BASE_ATTACK);
|
||||
((Player*)target)->UpdateExpertise(OFF_ATTACK);
|
||||
target->ToPlayer()->UpdateExpertise(BASE_ATTACK);
|
||||
target->ToPlayer()->UpdateExpertise(OFF_ATTACK);
|
||||
}
|
||||
|
||||
/********************************/
|
||||
@@ -4606,7 +4606,7 @@ void AuraEffect::HandleModPowerRegen(AuraApplication const * aurApp, uint8 mode,
|
||||
|
||||
// Update manaregen value
|
||||
if (GetMiscValue() == POWER_MANA)
|
||||
((Player*)target)->UpdateManaRegen();
|
||||
target->ToPlayer()->UpdateManaRegen();
|
||||
// other powers are not immediate effects - implemented in Player::Regenerate, Creature::Regenerate
|
||||
}
|
||||
|
||||
@@ -4622,7 +4622,7 @@ void AuraEffect::HandleModPowerRegenPCT(AuraApplication const * aurApp, uint8 mo
|
||||
|
||||
// Update manaregen value
|
||||
if (GetMiscValue() == POWER_MANA)
|
||||
((Player*)target)->UpdateManaRegen();
|
||||
target->ToPlayer()->UpdateManaRegen();
|
||||
// other powers are not immediate effects - implemented in Player::Regenerate, Creature::Regenerate
|
||||
}
|
||||
|
||||
@@ -4637,7 +4637,7 @@ void AuraEffect::HandleModManaRegen(AuraApplication const * aurApp, uint8 mode,
|
||||
return;
|
||||
|
||||
//Note: an increase in regen does NOT cause threat.
|
||||
((Player*)target)->UpdateManaRegen();
|
||||
target->ToPlayer()->UpdateManaRegen();
|
||||
}
|
||||
|
||||
void AuraEffect::HandleAuraModIncreaseHealth(AuraApplication const * aurApp, uint8 mode, bool apply) const
|
||||
@@ -4763,7 +4763,7 @@ void AuraEffect::HandleAuraModParryPercent(AuraApplication const * aurApp, uint8
|
||||
if(target->GetTypeId() != TYPEID_PLAYER)
|
||||
return;
|
||||
|
||||
((Player*)target)->UpdateParryPercentage();
|
||||
target->ToPlayer()->UpdateParryPercentage();
|
||||
}
|
||||
|
||||
void AuraEffect::HandleAuraModDodgePercent(AuraApplication const * aurApp, uint8 mode, bool apply) const
|
||||
@@ -4776,7 +4776,7 @@ void AuraEffect::HandleAuraModDodgePercent(AuraApplication const * aurApp, uint8
|
||||
if(target->GetTypeId() != TYPEID_PLAYER)
|
||||
return;
|
||||
|
||||
((Player*)target)->UpdateDodgePercentage();
|
||||
target->ToPlayer()->UpdateDodgePercentage();
|
||||
}
|
||||
|
||||
void AuraEffect::HandleAuraModBlockPercent(AuraApplication const * aurApp, uint8 mode, bool apply) const
|
||||
@@ -4789,7 +4789,7 @@ void AuraEffect::HandleAuraModBlockPercent(AuraApplication const * aurApp, uint8
|
||||
if(target->GetTypeId() != TYPEID_PLAYER)
|
||||
return;
|
||||
|
||||
((Player*)target)->UpdateBlockPercentage();
|
||||
target->ToPlayer()->UpdateBlockPercentage();
|
||||
}
|
||||
|
||||
void AuraEffect::HandleAuraModRegenInterrupt(AuraApplication const * aurApp, uint8 mode, bool apply) const
|
||||
@@ -4802,7 +4802,7 @@ void AuraEffect::HandleAuraModRegenInterrupt(AuraApplication const * aurApp, uin
|
||||
if(target->GetTypeId() != TYPEID_PLAYER)
|
||||
return;
|
||||
|
||||
((Player*)target)->UpdateManaRegen();
|
||||
target->ToPlayer()->UpdateManaRegen();
|
||||
}
|
||||
|
||||
void AuraEffect::HandleAuraModWeaponCritPercent(AuraApplication const * aurApp, uint8 mode, bool apply) const
|
||||
@@ -4816,8 +4816,8 @@ void AuraEffect::HandleAuraModWeaponCritPercent(AuraApplication const * aurApp,
|
||||
return;
|
||||
|
||||
for (int i = 0; i < MAX_ATTACK; ++i)
|
||||
if(Item* pItem = ((Player*)target)->GetWeaponForAttack(WeaponAttackType(i), true))
|
||||
((Player*)target)->_ApplyWeaponDependentAuraCritMod(pItem,WeaponAttackType(i),this,apply);
|
||||
if(Item* pItem = target->ToPlayer()->GetWeaponForAttack(WeaponAttackType(i), true))
|
||||
target->ToPlayer()->_ApplyWeaponDependentAuraCritMod(pItem,WeaponAttackType(i),this,apply);
|
||||
|
||||
// mods must be applied base at equipped weapon class and subclass comparison
|
||||
// with spell->EquippedItemClass and EquippedItemSubClassMask and EquippedItemInventoryTypeMask
|
||||
@@ -4825,9 +4825,9 @@ void AuraEffect::HandleAuraModWeaponCritPercent(AuraApplication const * aurApp,
|
||||
|
||||
if (GetSpellProto()->EquippedItemClass == -1)
|
||||
{
|
||||
((Player*)target)->HandleBaseModValue(CRIT_PERCENTAGE, FLAT_MOD, float (GetAmount()), apply);
|
||||
((Player*)target)->HandleBaseModValue(OFFHAND_CRIT_PERCENTAGE, FLAT_MOD, float (GetAmount()), apply);
|
||||
((Player*)target)->HandleBaseModValue(RANGED_CRIT_PERCENTAGE, FLAT_MOD, float (GetAmount()), apply);
|
||||
target->ToPlayer()->HandleBaseModValue(CRIT_PERCENTAGE, FLAT_MOD, float (GetAmount()), apply);
|
||||
target->ToPlayer()->HandleBaseModValue(OFFHAND_CRIT_PERCENTAGE, FLAT_MOD, float (GetAmount()), apply);
|
||||
target->ToPlayer()->HandleBaseModValue(RANGED_CRIT_PERCENTAGE, FLAT_MOD, float (GetAmount()), apply);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -4844,8 +4844,8 @@ void AuraEffect::HandleModHitChance(AuraApplication const * aurApp, uint8 mode,
|
||||
|
||||
if(target->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
((Player*)target)->UpdateMeleeHitChances();
|
||||
((Player*)target)->UpdateRangedHitChances();
|
||||
target->ToPlayer()->UpdateMeleeHitChances();
|
||||
target->ToPlayer()->UpdateRangedHitChances();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -4862,7 +4862,7 @@ void AuraEffect::HandleModSpellHitChance(AuraApplication const * aurApp, uint8 m
|
||||
Unit * target = aurApp->GetTarget();
|
||||
|
||||
if(target->GetTypeId() == TYPEID_PLAYER)
|
||||
((Player*)target)->UpdateSpellHitChances();
|
||||
target->ToPlayer()->UpdateSpellHitChances();
|
||||
else
|
||||
target->m_modSpellHitChance += (apply) ? GetAmount(): (-GetAmount());
|
||||
}
|
||||
@@ -4875,7 +4875,7 @@ void AuraEffect::HandleModSpellCritChance(AuraApplication const * aurApp, uint8
|
||||
Unit * target = aurApp->GetTarget();
|
||||
|
||||
if(target->GetTypeId() == TYPEID_PLAYER)
|
||||
((Player*)target)->UpdateAllSpellCritChances();
|
||||
target->ToPlayer()->UpdateAllSpellCritChances();
|
||||
else
|
||||
target->m_baseSpellCritChance += (apply) ? GetAmount():-GetAmount();
|
||||
}
|
||||
@@ -4892,7 +4892,7 @@ void AuraEffect::HandleModSpellCritChanceShool(AuraApplication const * aurApp, u
|
||||
|
||||
for (int school = SPELL_SCHOOL_NORMAL; school < MAX_SPELL_SCHOOL; ++school)
|
||||
if (GetMiscValue() & (1<<school))
|
||||
((Player*)target)->UpdateSpellCritChance(school);
|
||||
target->ToPlayer()->UpdateSpellCritChance(school);
|
||||
}
|
||||
|
||||
void AuraEffect::HandleAuraModCritPct(AuraApplication const * aurApp, uint8 mode, bool apply) const
|
||||
@@ -4908,12 +4908,12 @@ void AuraEffect::HandleAuraModCritPct(AuraApplication const * aurApp, uint8 mode
|
||||
return;
|
||||
}
|
||||
|
||||
((Player*)target)->HandleBaseModValue(CRIT_PERCENTAGE, FLAT_MOD, float (GetAmount()), apply);
|
||||
((Player*)target)->HandleBaseModValue(OFFHAND_CRIT_PERCENTAGE, FLAT_MOD, float (GetAmount()), apply);
|
||||
((Player*)target)->HandleBaseModValue(RANGED_CRIT_PERCENTAGE, FLAT_MOD, float (GetAmount()), apply);
|
||||
target->ToPlayer()->HandleBaseModValue(CRIT_PERCENTAGE, FLAT_MOD, float (GetAmount()), apply);
|
||||
target->ToPlayer()->HandleBaseModValue(OFFHAND_CRIT_PERCENTAGE, FLAT_MOD, float (GetAmount()), apply);
|
||||
target->ToPlayer()->HandleBaseModValue(RANGED_CRIT_PERCENTAGE, FLAT_MOD, float (GetAmount()), apply);
|
||||
|
||||
// included in Player::UpdateSpellCritChance calculation
|
||||
((Player*)target)->UpdateAllSpellCritChances();
|
||||
target->ToPlayer()->UpdateAllSpellCritChances();
|
||||
}
|
||||
|
||||
/********************************/
|
||||
@@ -5017,7 +5017,7 @@ void AuraEffect::HandleModRating(AuraApplication const * aurApp, uint8 mode, boo
|
||||
|
||||
for (uint32 rating = 0; rating < MAX_COMBAT_RATING; ++rating)
|
||||
if (GetMiscValue() & (1 << rating))
|
||||
((Player*)target)->ApplyRatingMod(CombatRating(rating), GetAmount(), apply);
|
||||
target->ToPlayer()->ApplyRatingMod(CombatRating(rating), GetAmount(), apply);
|
||||
}
|
||||
|
||||
void AuraEffect::HandleModRatingFromStat(AuraApplication const * aurApp, uint8 mode, bool apply) const
|
||||
@@ -5033,7 +5033,7 @@ void AuraEffect::HandleModRatingFromStat(AuraApplication const * aurApp, uint8 m
|
||||
// Just recalculate ratings
|
||||
for (uint32 rating = 0; rating < MAX_COMBAT_RATING; ++rating)
|
||||
if (GetMiscValue() & (1 << rating))
|
||||
((Player*)target)->ApplyRatingMod(CombatRating(rating), 0, apply);
|
||||
target->ToPlayer()->ApplyRatingMod(CombatRating(rating), 0, apply);
|
||||
}
|
||||
|
||||
/********************************/
|
||||
@@ -5097,7 +5097,7 @@ void AuraEffect::HandleAuraModRangedAttackPowerOfStatPercent(AuraApplication con
|
||||
|
||||
// Recalculate bonus
|
||||
if(target->GetTypeId() == TYPEID_PLAYER && !(target->getClassMask() & CLASSMASK_WAND_USERS))
|
||||
((Player*)target)->UpdateAttackPowerAndDamage(true);
|
||||
target->ToPlayer()->UpdateAttackPowerAndDamage(true);
|
||||
}
|
||||
|
||||
void AuraEffect::HandleAuraModAttackPowerOfStatPercent(AuraApplication const * aurApp, uint8 mode, bool apply) const
|
||||
@@ -5109,7 +5109,7 @@ void AuraEffect::HandleAuraModAttackPowerOfStatPercent(AuraApplication const * a
|
||||
|
||||
// Recalculate bonus
|
||||
if(target->GetTypeId() == TYPEID_PLAYER)
|
||||
((Player*)target)->UpdateAttackPowerAndDamage(false);
|
||||
target->ToPlayer()->UpdateAttackPowerAndDamage(false);
|
||||
}
|
||||
|
||||
void AuraEffect::HandleAuraModAttackPowerOfArmor(AuraApplication const * aurApp, uint8 mode, bool apply) const
|
||||
@@ -5121,7 +5121,7 @@ void AuraEffect::HandleAuraModAttackPowerOfArmor(AuraApplication const * aurApp,
|
||||
|
||||
// Recalculate bonus
|
||||
if(target->GetTypeId() == TYPEID_PLAYER)
|
||||
((Player*)target)->UpdateAttackPowerAndDamage(false);
|
||||
target->ToPlayer()->UpdateAttackPowerAndDamage(false);
|
||||
}
|
||||
/********************************/
|
||||
/*** DAMAGE BONUS ***/
|
||||
@@ -5137,8 +5137,8 @@ void AuraEffect::HandleModDamageDone(AuraApplication const * aurApp, uint8 mode,
|
||||
if(target->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
for (int i = 0; i < MAX_ATTACK; ++i)
|
||||
if(Item* pItem = ((Player*)target)->GetWeaponForAttack(WeaponAttackType(i), true))
|
||||
((Player*)target)->_ApplyWeaponDependentAuraDamageMod(pItem,WeaponAttackType(i),this,apply);
|
||||
if(Item* pItem = target->ToPlayer()->GetWeaponForAttack(WeaponAttackType(i), true))
|
||||
target->ToPlayer()->_ApplyWeaponDependentAuraDamageMod(pItem,WeaponAttackType(i),this,apply);
|
||||
}
|
||||
|
||||
// GetMiscValue() is bitmask of spell schools
|
||||
@@ -5206,7 +5206,7 @@ void AuraEffect::HandleModDamageDone(AuraApplication const * aurApp, uint8 mode,
|
||||
target->ApplyModUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG+i,GetAmount(),apply);
|
||||
}
|
||||
}
|
||||
if(Guardian* pet = ((Player*)target)->GetGuardianPet())
|
||||
if(Guardian* pet = target->ToPlayer()->GetGuardianPet())
|
||||
pet->UpdateAttackPowerAndDamage();
|
||||
}
|
||||
}
|
||||
@@ -5224,8 +5224,8 @@ void AuraEffect::HandleModDamagePercentDone(AuraApplication const * aurApp, uint
|
||||
if(target->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
for (int i = 0; i < MAX_ATTACK; ++i)
|
||||
if(Item* pItem = ((Player*)target)->GetWeaponForAttack(WeaponAttackType(i), true))
|
||||
((Player*)target)->_ApplyWeaponDependentAuraDamageMod(pItem,WeaponAttackType(i),this,apply);
|
||||
if(Item* pItem = target->ToPlayer()->GetWeaponForAttack(WeaponAttackType(i), true))
|
||||
target->ToPlayer()->_ApplyWeaponDependentAuraDamageMod(pItem,WeaponAttackType(i),this,apply);
|
||||
}
|
||||
|
||||
// GetMiscValue() is bitmask of spell schools
|
||||
@@ -5297,7 +5297,7 @@ void AuraEffect::HandleShieldBlockValue(AuraApplication const * aurApp, uint8 mo
|
||||
modType = PCT_MOD;
|
||||
|
||||
if(target->GetTypeId() == TYPEID_PLAYER)
|
||||
((Player*)target)->HandleBaseModValue(SHIELD_BLOCK_VALUE, modType, float(GetAmount()), apply);
|
||||
target->ToPlayer()->HandleBaseModValue(SHIELD_BLOCK_VALUE, modType, float(GetAmount()), apply);
|
||||
}
|
||||
|
||||
/********************************/
|
||||
@@ -5379,9 +5379,9 @@ void AuraEffect::HandleAuraRetainComboPoints(AuraApplication const * aurApp, uin
|
||||
|
||||
// combo points was added in SPELL_EFFECT_ADD_COMBO_POINTS handler
|
||||
// remove only if aura expire by time (in case combo points amount change aura removed without combo points lost)
|
||||
if( !(apply) && GetBase()->GetDuration()==0 && ((Player*)target)->GetComboTarget())
|
||||
if(Unit* unit = ObjectAccessor::GetUnit(*target,((Player*)target)->GetComboTarget()))
|
||||
((Player*)target)->AddComboPoints(unit, -GetAmount());
|
||||
if( !(apply) && GetBase()->GetDuration()==0 && target->ToPlayer()->GetComboTarget())
|
||||
if(Unit* unit = ObjectAccessor::GetUnit(*target,target->ToPlayer()->GetComboTarget()))
|
||||
target->ToPlayer()->AddComboPoints(unit, -GetAmount());
|
||||
}
|
||||
|
||||
/*********************************************************/
|
||||
@@ -5527,7 +5527,7 @@ void AuraEffect::HandleAuraDummy(AuraApplication const * aurApp, uint8 mode, boo
|
||||
break;
|
||||
case 46699: // Requires No Ammo
|
||||
if(target->GetTypeId() == TYPEID_PLAYER)
|
||||
((Player*)target)->RemoveAmmo(); // not use ammo and not allow use
|
||||
target->ToPlayer()->RemoveAmmo(); // not use ammo and not allow use
|
||||
break;
|
||||
case 49028:
|
||||
GetBase()->SetDuration(GetBase()->GetDuration() + (caster->GetPower(POWER_RUNIC_POWER) * 10));
|
||||
@@ -5539,7 +5539,7 @@ void AuraEffect::HandleAuraDummy(AuraApplication const * aurApp, uint8 mode, boo
|
||||
break;
|
||||
case 52916: // Honor Among Thieves
|
||||
if(target->GetTypeId() == TYPEID_PLAYER)
|
||||
if (Unit * spellTarget = ObjectAccessor::GetUnit(*target,((Player*)target)->GetComboTarget()))
|
||||
if (Unit * spellTarget = ObjectAccessor::GetUnit(*target,target->ToPlayer()->GetComboTarget()))
|
||||
target->CastSpell(spellTarget, 51699, true);
|
||||
break;
|
||||
case 28832: // Mark of Korth'azz
|
||||
@@ -5605,7 +5605,7 @@ void AuraEffect::HandleAuraDummy(AuraApplication const * aurApp, uint8 mode, boo
|
||||
case 2584: // Waiting to Resurrect
|
||||
// Waiting to resurrect spell cancel, we must remove player from resurrect queue
|
||||
if(target->GetTypeId() == TYPEID_PLAYER)
|
||||
if(BattleGround *bg = ((Player*)target)->GetBattleGround())
|
||||
if(BattleGround *bg = target->ToPlayer()->GetBattleGround())
|
||||
bg->RemovePlayerFromResurrectQueue(target->GetGUID());
|
||||
break;
|
||||
case 28169: // Mutating Injection
|
||||
@@ -5772,7 +5772,7 @@ void AuraEffect::HandleAuraDummy(AuraApplication const * aurApp, uint8 mode, boo
|
||||
if(apply)
|
||||
owner->CastSpell(owner,8985,true);
|
||||
else
|
||||
((Player*)owner)->RemovePet(NULL, PET_SAVE_NOT_IN_SLOT, true);
|
||||
owner->ToPlayer()->RemovePet(NULL, PET_SAVE_NOT_IN_SLOT, true);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -5788,7 +5788,7 @@ void AuraEffect::HandleAuraDummy(AuraApplication const * aurApp, uint8 mode, boo
|
||||
if(apply)
|
||||
owner->CastSpell(owner,19704,true);
|
||||
else
|
||||
((Player*)owner)->RemovePet(NULL, PET_SAVE_NOT_IN_SLOT, true);
|
||||
owner->ToPlayer()->RemovePet(NULL, PET_SAVE_NOT_IN_SLOT, true);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -5822,7 +5822,7 @@ void AuraEffect::HandleAuraDummy(AuraApplication const * aurApp, uint8 mode, boo
|
||||
case 57822: FactionID = 1091; break; // The Wyrmrest Accord
|
||||
}
|
||||
}
|
||||
((Player*)caster)->SetChampioningFaction(FactionID);
|
||||
caster->ToPlayer()->SetChampioningFaction(FactionID);
|
||||
break;
|
||||
}
|
||||
// LK Intro VO (1)
|
||||
@@ -5906,7 +5906,7 @@ void AuraEffect::HandleAuraDummy(AuraApplication const * aurApp, uint8 mode, boo
|
||||
// Predatory Strikes
|
||||
if (target->GetTypeId() == TYPEID_PLAYER && GetSpellProto()->SpellIconID == 1563)
|
||||
{
|
||||
((Player*)target)->UpdateAttackPowerAndDamage();
|
||||
target->ToPlayer()->UpdateAttackPowerAndDamage();
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -5924,11 +5924,11 @@ void AuraEffect::HandleAuraDummy(AuraApplication const * aurApp, uint8 mode, boo
|
||||
{
|
||||
Creature *totem = caster->GetMap()->GetCreature(guid);
|
||||
if (totem && totem->isTotem())
|
||||
((Player*)caster)->CastSpell(totem, 6277, true);
|
||||
caster->ToPlayer()->CastSpell(totem, 6277, true);
|
||||
}
|
||||
}
|
||||
else
|
||||
((Player*)caster)->StopCastingBindSight();
|
||||
caster->ToPlayer()->StopCastingBindSight();
|
||||
return;
|
||||
}
|
||||
break;
|
||||
@@ -6002,24 +6002,24 @@ 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 && !((Player*)caster)->isAllowedToLoot((Creature*)target)) )
|
||||
target->GetTypeId() == TYPEID_UNIT && !caster->ToPlayer()->isAllowedToLoot((Creature*)target)) )
|
||||
return;
|
||||
//Adding items
|
||||
uint32 noSpaceForCount = 0;
|
||||
uint32 count = m_amount;
|
||||
|
||||
ItemPosCountVec dest;
|
||||
uint8 msg = ((Player*)caster)->CanStoreNewItem( NULL_BAG, NULL_SLOT, dest, GetSpellProto()->EffectItemType[m_effIndex], count, &noSpaceForCount);
|
||||
uint8 msg = caster->ToPlayer()->CanStoreNewItem( NULL_BAG, NULL_SLOT, dest, GetSpellProto()->EffectItemType[m_effIndex], count, &noSpaceForCount);
|
||||
if( msg != EQUIP_ERR_OK )
|
||||
{
|
||||
count-=noSpaceForCount;
|
||||
((Player*)caster)->SendEquipError( msg, NULL, NULL );
|
||||
caster->ToPlayer()->SendEquipError( msg, NULL, NULL );
|
||||
if (count==0)
|
||||
return;
|
||||
}
|
||||
|
||||
Item* newitem = ((Player*)caster)->StoreNewItem(dest, GetSpellProto()->EffectItemType[m_effIndex], true);
|
||||
((Player*)caster)->SendNewItem(newitem, count, true, false);
|
||||
Item* newitem = caster->ToPlayer()->StoreNewItem(dest, GetSpellProto()->EffectItemType[m_effIndex], true);
|
||||
caster->ToPlayer()->SendNewItem(newitem, count, true, false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6035,7 +6035,7 @@ void AuraEffect::HandleBindSight(AuraApplication const * aurApp, uint8 mode, boo
|
||||
if(!caster || caster->GetTypeId() != TYPEID_PLAYER)
|
||||
return;
|
||||
|
||||
((Player*)caster)->SetViewpoint(target, (apply));
|
||||
caster->ToPlayer()->SetViewpoint(target, (apply));
|
||||
}
|
||||
|
||||
void AuraEffect::HandleForceReaction(AuraApplication const * aurApp, uint8 mode, bool apply) const
|
||||
|
||||
+13
-13
@@ -378,8 +378,8 @@ void Aura::_ApplyForTarget(Unit * target, Unit * caster, AuraApplication * auraA
|
||||
{
|
||||
if (m_spellProto->Attributes & SPELL_ATTR_DISABLED_WHILE_ACTIVE)
|
||||
{
|
||||
Item* castItem = m_castItemGuid ? ((Player*)caster)->GetItemByGuid(m_castItemGuid) : NULL;
|
||||
((Player*)caster)->AddSpellAndCategoryCooldowns(m_spellProto,castItem ? castItem->GetEntry() : 0, NULL,true);
|
||||
Item* castItem = m_castItemGuid ? caster->ToPlayer()->GetItemByGuid(m_castItemGuid) : NULL;
|
||||
caster->ToPlayer()->AddSpellAndCategoryCooldowns(m_spellProto,castItem ? castItem->GetEntry() : 0, NULL,true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -401,7 +401,7 @@ void Aura::_UnapplyForTarget(Unit * target, Unit * caster, AuraApplication * aur
|
||||
{
|
||||
if ( GetSpellProto()->Attributes & SPELL_ATTR_DISABLED_WHILE_ACTIVE )
|
||||
// note: item based cooldowns and cooldown spell mods with charges ignored (unknown existed cases)
|
||||
((Player*)caster)->SendCooldownEvent(GetSpellProto());
|
||||
caster->ToPlayer()->SendCooldownEvent(GetSpellProto());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -844,7 +844,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const * aurApp, Unit * caster,
|
||||
{
|
||||
case 32474: // Buffeting Winds of Susurrus
|
||||
if(target->GetTypeId() == TYPEID_PLAYER)
|
||||
((Player*)target)->ActivateTaxiPathTo(506, GetId());
|
||||
target->ToPlayer()->ActivateTaxiPathTo(506, GetId());
|
||||
break;
|
||||
case 33572: // Gronn Lord's Grasp, becomes stoned
|
||||
if(GetStackAmount() >= 5 && !target->HasAura(33652))
|
||||
@@ -852,7 +852,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const * aurApp, Unit * caster,
|
||||
break;
|
||||
case 60970: // Heroic Fury (remove Intercept cooldown)
|
||||
if(target->GetTypeId() == TYPEID_PLAYER)
|
||||
((Player*)target)->RemoveSpellCooldown(20252, true);
|
||||
target->ToPlayer()->RemoveSpellCooldown(20252, true);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
@@ -916,8 +916,8 @@ void Aura::HandleAuraSpecificMods(AuraApplication const * aurApp, Unit * caster,
|
||||
if(target->GetTypeId() == TYPEID_PLAYER)
|
||||
if(GameObject* obj = target->GetGameObject(48018))
|
||||
{
|
||||
((Player*)target)->TeleportTo(obj->GetMapId(),obj->GetPositionX(),obj->GetPositionY(),obj->GetPositionZ(),obj->GetOrientation());
|
||||
((Player*)target)->RemoveMovementImpairingAuras();
|
||||
target->ToPlayer()->TeleportTo(obj->GetMapId(),obj->GetPositionX(),obj->GetPositionY(),obj->GetPositionZ(),obj->GetOrientation());
|
||||
target->ToPlayer()->RemoveMovementImpairingAuras();
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -1093,7 +1093,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const * aurApp, Unit * caster,
|
||||
{
|
||||
if (removeMode == AURA_REMOVE_BY_DEATH)
|
||||
{
|
||||
if (caster->GetTypeId() == TYPEID_PLAYER && ((Player*)caster)->isHonorOrXPTarget(target))
|
||||
if (caster->GetTypeId() == TYPEID_PLAYER && caster->ToPlayer()->isHonorOrXPTarget(target))
|
||||
caster->CastSpell(target, 18662, true, NULL, GetEffect(0));
|
||||
}
|
||||
}
|
||||
@@ -1151,10 +1151,10 @@ void Aura::HandleAuraSpecificMods(AuraApplication const * aurApp, Unit * caster,
|
||||
// check cooldown
|
||||
if (caster->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
if (((Player*)caster)->HasSpellCooldown(aura->GetId()))
|
||||
if (caster->ToPlayer()->HasSpellCooldown(aura->GetId()))
|
||||
break;
|
||||
// and add if needed
|
||||
((Player*)caster)->AddSpellCooldown(aura->GetId(), 0, uint32(time(NULL) + 12));
|
||||
caster->ToPlayer()->AddSpellCooldown(aura->GetId(), 0, uint32(time(NULL) + 12));
|
||||
}
|
||||
// effect on caster
|
||||
if (AuraEffect const * aurEff = aura->GetEffect(0))
|
||||
@@ -1200,7 +1200,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const * aurApp, Unit * caster,
|
||||
if(caster->GetTypeId() != TYPEID_PLAYER)
|
||||
break;
|
||||
|
||||
Player *player = ((Player*)caster);
|
||||
Player *player = caster->ToPlayer();
|
||||
// Glyph of Guardian Spirit
|
||||
if(AuraEffect * aurEff = player->GetAuraEffect(63231, 0))
|
||||
{
|
||||
@@ -1230,11 +1230,11 @@ void Aura::HandleAuraSpecificMods(AuraApplication const * aurApp, Unit * caster,
|
||||
break;
|
||||
if (target->GetTypeId() != TYPEID_PLAYER)
|
||||
break;
|
||||
if(((Player*)target)->getClass() != CLASS_DEATH_KNIGHT)
|
||||
if(target->ToPlayer()->getClass() != CLASS_DEATH_KNIGHT)
|
||||
break;
|
||||
|
||||
// aura removed - remove death runes
|
||||
((Player*)target)->RemoveRunesByAuraEffect(GetEffect(0));
|
||||
target->ToPlayer()->RemoveRunesByAuraEffect(GetEffect(0));
|
||||
}
|
||||
switch(GetId())
|
||||
{
|
||||
|
||||
+112
-112
@@ -251,7 +251,7 @@ void Spell::EffectResurrectNew(uint32 i)
|
||||
if(!unitTarget->IsInWorld())
|
||||
return;
|
||||
|
||||
Player* pTarget = ((Player*)unitTarget);
|
||||
Player* pTarget = unitTarget->ToPlayer();
|
||||
|
||||
if(pTarget->isRessurectRequested()) // already have one active request
|
||||
return;
|
||||
@@ -307,7 +307,7 @@ void Spell::EffectEnvirinmentalDMG(uint32 i)
|
||||
|
||||
m_caster->SendSpellNonMeleeDamageLog(m_caster, m_spellInfo->Id, damage, GetSpellSchoolMask(m_spellInfo), absorb, resist, false, 0, false);
|
||||
if(m_caster->GetTypeId() == TYPEID_PLAYER)
|
||||
((Player*)m_caster)->EnvironmentalDamage(DAMAGE_FIRE, damage);
|
||||
m_caster->ToPlayer()->EnvironmentalDamage(DAMAGE_FIRE, damage);
|
||||
}
|
||||
|
||||
void Spell::EffectSchoolDMG(uint32 effect_idx)
|
||||
@@ -579,7 +579,7 @@ void Spell::SpellDamageSchoolDmg(uint32 effect_idx)
|
||||
float multiple = ap / 410 + m_spellInfo->DmgMultiplier[effect_idx];
|
||||
int32 energy = -(m_caster->ModifyPower(POWER_ENERGY, -30));
|
||||
damage += int32(energy * multiple);
|
||||
damage += int32(((Player*)m_caster)->GetComboPoints() * ap * 7 / 100);
|
||||
damage += int32(m_caster->ToPlayer()->GetComboPoints() * ap * 7 / 100);
|
||||
}
|
||||
// Wrath
|
||||
else if (m_spellInfo->SpellFamilyFlags[0] & 0x00000001)
|
||||
@@ -597,7 +597,7 @@ void Spell::SpellDamageSchoolDmg(uint32 effect_idx)
|
||||
if (m_caster->GetTypeId() == TYPEID_PLAYER && (m_spellInfo->SpellFamilyFlags[1] & 0x8))
|
||||
{
|
||||
// consume from stack dozes not more that have combo-points
|
||||
if (uint32 combo = ((Player*)m_caster)->GetComboPoints())
|
||||
if (uint32 combo = m_caster->ToPlayer()->GetComboPoints())
|
||||
{
|
||||
// Lookup for Deadly poison (only attacker applied)
|
||||
if (AuraEffect const * aurEff = unitTarget->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_ROGUE, 0x10000, 0, 0, m_caster->GetGUID()))
|
||||
@@ -609,7 +609,7 @@ void Spell::SpellDamageSchoolDmg(uint32 effect_idx)
|
||||
if (doses > combo)
|
||||
doses = combo;
|
||||
// Master Poisoner
|
||||
Unit::AuraEffectList const& auraList = ((Player*)m_caster)->GetAuraEffectsByType(SPELL_AURA_MOD_AURA_DURATION_BY_DISPEL_NOT_STACK);
|
||||
Unit::AuraEffectList const& auraList = m_caster->ToPlayer()->GetAuraEffectsByType(SPELL_AURA_MOD_AURA_DURATION_BY_DISPEL_NOT_STACK);
|
||||
for (Unit::AuraEffectList::const_iterator iter = auraList.begin(); iter != auraList.end(); ++iter)
|
||||
{
|
||||
if ((*iter)->GetSpellProto()->SpellFamilyName == SPELLFAMILY_ROGUE && (*iter)->GetSpellProto()->SpellIconID == 1960)
|
||||
@@ -679,7 +679,7 @@ void Spell::SpellDamageSchoolDmg(uint32 effect_idx)
|
||||
if (m_caster->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
// Add Ammo and Weapon damage plus RAP * 0.1
|
||||
Item *item = ((Player*)m_caster)->GetWeaponForAttack(RANGED_ATTACK);
|
||||
Item *item = m_caster->ToPlayer()->GetWeaponForAttack(RANGED_ATTACK);
|
||||
if (item)
|
||||
{
|
||||
float dmg_min = item->GetProto()->Damage->DamageMin;
|
||||
@@ -688,7 +688,7 @@ void Spell::SpellDamageSchoolDmg(uint32 effect_idx)
|
||||
damage += int32(dmg_min);
|
||||
else
|
||||
damage += irand(int32(dmg_min), int32(dmg_max));
|
||||
damage += ((Player*)m_caster)->GetAmmoDPS()*item->GetProto()->Delay*0.001f;
|
||||
damage += m_caster->ToPlayer()->GetAmmoDPS()*item->GetProto()->Delay*0.001f;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -960,7 +960,7 @@ void Spell::EffectDummy(uint32 i)
|
||||
{
|
||||
WorldPacket data(SMSG_SPIRIT_HEALER_CONFIRM, 8);
|
||||
data << uint64(unitTarget->GetGUID());
|
||||
((Player*)m_originalCaster)->GetSession()->SendPacket( &data );
|
||||
m_originalCaster->ToPlayer()->GetSession()->SendPacket( &data );
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -1232,7 +1232,7 @@ void Spell::EffectDummy(uint32 i)
|
||||
return;
|
||||
|
||||
((Creature*)unitTarget)->UpdateEntry(16992);
|
||||
((Player*)m_caster)->RewardPlayerAndGroupAtEvent(16992, unitTarget);
|
||||
m_caster->ToPlayer()->RewardPlayerAndGroupAtEvent(16992, unitTarget);
|
||||
|
||||
if (unitTarget->IsAIEnabled)
|
||||
((Creature*)unitTarget)->AI()->AttackStart(m_caster);
|
||||
@@ -1270,7 +1270,7 @@ void Spell::EffectDummy(uint32 i)
|
||||
return;
|
||||
m_caster->RemoveAurasByType(SPELL_AURA_MOUNTED);
|
||||
// Ram for Alliance, Kodo for Horde
|
||||
if (((Player*)m_caster)->GetTeam() == ALLIANCE)
|
||||
if (m_caster->ToPlayer()->GetTeam() == ALLIANCE)
|
||||
{
|
||||
if (m_caster->GetSpeedRate(MOVE_RUN) >= 2.0f)
|
||||
// 100% Ram
|
||||
@@ -1281,7 +1281,7 @@ void Spell::EffectDummy(uint32 i)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (((Player*)m_caster)->GetSpeedRate(MOVE_RUN) >= 2.0f)
|
||||
if (m_caster->ToPlayer()->GetSpeedRate(MOVE_RUN) >= 2.0f)
|
||||
// 100% Kodo
|
||||
m_caster->CastSpell(m_caster, 49379, true);
|
||||
else
|
||||
@@ -1296,7 +1296,7 @@ void Spell::EffectDummy(uint32 i)
|
||||
return;
|
||||
m_caster->RemoveAurasByType(SPELL_AURA_MOUNTED);
|
||||
// Ram for Horde, Kodo for Alliance
|
||||
if (((Player*)m_caster)->GetTeam() == HORDE)
|
||||
if (m_caster->ToPlayer()->GetTeam() == HORDE)
|
||||
{
|
||||
if (m_caster->GetSpeedRate(MOVE_RUN) >= 2.0f)
|
||||
// 100% Ram
|
||||
@@ -1307,7 +1307,7 @@ void Spell::EffectDummy(uint32 i)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (((Player*)m_caster)->GetSpeedRate(MOVE_RUN) >= 2.0f)
|
||||
if (m_caster->ToPlayer()->GetSpeedRate(MOVE_RUN) >= 2.0f)
|
||||
// 100% Kodo
|
||||
m_caster->CastSpell(m_caster, 49379, true);
|
||||
else
|
||||
@@ -1331,7 +1331,7 @@ void Spell::EffectDummy(uint32 i)
|
||||
// spell has a 1/3 chance to trigger one of the below
|
||||
if (roll_chance_i(66))
|
||||
return;
|
||||
if (((Player*)m_caster)->GetTeam() == ALLIANCE)
|
||||
if (m_caster->ToPlayer()->GetTeam() == ALLIANCE)
|
||||
{
|
||||
// 1000001 - gnomish binary
|
||||
m_caster->CastSpell(m_caster, 50242, true);
|
||||
@@ -1349,8 +1349,8 @@ void Spell::EffectDummy(uint32 i)
|
||||
if(m_caster->GetTypeId() != TYPEID_PLAYER)
|
||||
return;
|
||||
|
||||
if(BattleGround* bg = ((Player*)m_caster)->GetBattleGround())
|
||||
bg->EventPlayerDroppedFlag((Player*)m_caster);
|
||||
if(BattleGround* bg = m_caster->ToPlayer()->GetBattleGround())
|
||||
bg->EventPlayerDroppedFlag(m_caster->ToPlayer());
|
||||
|
||||
m_caster->CastSpell(m_caster, 30452, true, NULL);
|
||||
return;
|
||||
@@ -1482,7 +1482,7 @@ void Spell::EffectDummy(uint32 i)
|
||||
(GetSpellSchoolMask(spellInfo) & SPELL_SCHOOL_MASK_FROST) &&
|
||||
spellInfo->Id != 11958 && GetSpellRecoveryTime(spellInfo) > 0 )
|
||||
{
|
||||
((Player*)m_caster)->RemoveSpellCooldown((itr++)->first, true);
|
||||
m_caster->ToPlayer()->RemoveSpellCooldown((itr++)->first, true);
|
||||
}
|
||||
else
|
||||
++itr;
|
||||
@@ -1715,7 +1715,7 @@ void Spell::EffectDummy(uint32 i)
|
||||
if(m_caster->GetTypeId() != TYPEID_PLAYER)
|
||||
return;
|
||||
|
||||
Player *pCaster = ((Player*)m_caster);
|
||||
Player *pCaster = m_caster->ToPlayer();
|
||||
|
||||
Item *item = pCaster->GetWeaponForAttack(OFF_ATTACK);
|
||||
if(!item)
|
||||
@@ -1757,7 +1757,7 @@ void Spell::EffectDummy(uint32 i)
|
||||
SpellEntry const *spellInfo = sSpellStore.LookupEntry(itr->first);
|
||||
|
||||
if (spellInfo->SpellFamilyName == SPELLFAMILY_ROGUE && (spellInfo->SpellFamilyFlags[1] & SPELLFAMILYFLAG1_ROGUE_COLDB_SHADOWSTEP || spellInfo->SpellFamilyFlags[0] & SPELLFAMILYFLAG_ROGUE_VAN_EVAS_SPRINT))
|
||||
((Player*)m_caster)->RemoveSpellCooldown((itr++)->first,true);
|
||||
m_caster->ToPlayer()->RemoveSpellCooldown((itr++)->first,true);
|
||||
else
|
||||
++itr;
|
||||
}
|
||||
@@ -1785,7 +1785,7 @@ void Spell::EffectDummy(uint32 i)
|
||||
data << float(sinf(m_caster->GetOrientation()+M_PI));
|
||||
data << float(15);
|
||||
data << float(-7.0f);
|
||||
((Player*)m_caster)->GetSession()->SendPacket(&data);
|
||||
m_caster->ToPlayer()->GetSession()->SendPacket(&data);
|
||||
return;
|
||||
}
|
||||
case 23989: // Readiness talent
|
||||
@@ -1794,13 +1794,13 @@ void Spell::EffectDummy(uint32 i)
|
||||
return;
|
||||
|
||||
// immediately finishes the cooldown on your other Hunter abilities except Bestial Wrath
|
||||
const SpellCooldowns& cm = ((Player*)m_caster)->GetSpellCooldownMap();
|
||||
const SpellCooldowns& cm = m_caster->ToPlayer()->GetSpellCooldownMap();
|
||||
for (SpellCooldowns::const_iterator itr = cm.begin(); itr != cm.end();)
|
||||
{
|
||||
SpellEntry const *spellInfo = sSpellStore.LookupEntry(itr->first);
|
||||
|
||||
if (spellInfo->SpellFamilyName == SPELLFAMILY_HUNTER && spellInfo->Id != 23989 && spellInfo->Id != 19574 && GetSpellRecoveryTime(spellInfo) > 0 )
|
||||
((Player*)m_caster)->RemoveSpellCooldown((itr++)->first,true);
|
||||
m_caster->ToPlayer()->RemoveSpellCooldown((itr++)->first,true);
|
||||
else
|
||||
++itr;
|
||||
}
|
||||
@@ -1814,7 +1814,7 @@ void Spell::EffectDummy(uint32 i)
|
||||
// break Auto Shot and autohit
|
||||
m_caster->InterruptSpell(CURRENT_AUTOREPEAT_SPELL);
|
||||
m_caster->AttackStop();
|
||||
((Player*)m_caster)->SendAttackSwingCancelAttack();
|
||||
m_caster->ToPlayer()->SendAttackSwingCancelAttack();
|
||||
return;
|
||||
}
|
||||
// Last Stand (pet)
|
||||
@@ -1830,7 +1830,7 @@ void Spell::EffectDummy(uint32 i)
|
||||
if (m_caster->GetTypeId() != TYPEID_PLAYER || !unitTarget)
|
||||
return;
|
||||
|
||||
if (Pet *PlrPet = ((Player*)m_caster)->GetPet())
|
||||
if (Pet *PlrPet = m_caster->ToPlayer()->GetPet())
|
||||
PlrPet->CastSpell(unitTarget, m_spellInfo->CalculateSimpleValue(i), true);
|
||||
return;
|
||||
}
|
||||
@@ -2019,7 +2019,7 @@ void Spell::EffectDummy(uint32 i)
|
||||
if (m_caster->GetTypeId() != TYPEID_PLAYER)
|
||||
return;
|
||||
|
||||
if (Item *item = ((Player*)m_caster)->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND))
|
||||
if (Item *item = m_caster->ToPlayer()->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND))
|
||||
{
|
||||
// Damage is increased by 25% if your off-hand weapon is enchanted with Flametongue.
|
||||
if (m_caster->GetAuraEffect(SPELL_AURA_DUMMY, SPELLFAMILY_SHAMAN, 0x200000, 0, 0))
|
||||
@@ -2100,7 +2100,7 @@ void Spell::EffectDummy(uint32 i)
|
||||
triggered = false;
|
||||
}
|
||||
// Remove cooldown - summon spellls have category
|
||||
((Player*)m_caster)->RemoveSpellCooldown(m_spellInfo->Id,true);
|
||||
m_caster->ToPlayer()->RemoveSpellCooldown(m_spellInfo->Id,true);
|
||||
spell_id=48289;
|
||||
}
|
||||
// Raise dead - take reagents and trigger summon spells
|
||||
@@ -2291,7 +2291,7 @@ void Spell::EffectTriggerSpell(uint32 effIndex)
|
||||
// get highest rank of the Stealth spell
|
||||
uint32 spellId = 0;
|
||||
SpellEntry const *spellInfo;
|
||||
const PlayerSpellMap& sp_list = ((Player*)unitTarget)->GetSpellMap();
|
||||
const PlayerSpellMap& sp_list = unitTarget->ToPlayer()->GetSpellMap();
|
||||
for (PlayerSpellMap::const_iterator itr = sp_list.begin(); itr != sp_list.end(); ++itr)
|
||||
{
|
||||
// only highest rank is shown in spell book, so simply check if shown in spell book
|
||||
@@ -2314,8 +2314,8 @@ void Spell::EffectTriggerSpell(uint32 effIndex)
|
||||
return;
|
||||
|
||||
// reset cooldown on it if needed
|
||||
if (((Player*)unitTarget)->HasSpellCooldown(spellId))
|
||||
((Player*)unitTarget)->RemoveSpellCooldown(spellId);
|
||||
if (unitTarget->ToPlayer()->HasSpellCooldown(spellId))
|
||||
unitTarget->ToPlayer()->RemoveSpellCooldown(spellId);
|
||||
|
||||
// Push stealth to list because it must be handled after combat remove
|
||||
m_TriggerSpells.push_back(spellInfo);
|
||||
@@ -2411,7 +2411,7 @@ void Spell::EffectTriggerSpell(uint32 effIndex)
|
||||
// Needed by freezing arrow and few other spells
|
||||
if (m_caster->GetTypeId() == TYPEID_PLAYER && m_spellInfo->CategoryRecoveryTime && spellInfo->CategoryRecoveryTime
|
||||
&& m_spellInfo->Category == spellInfo->Category)
|
||||
((Player*)m_caster)->RemoveSpellCooldown(spellInfo->Id);
|
||||
m_caster->ToPlayer()->RemoveSpellCooldown(spellInfo->Id);
|
||||
|
||||
// Note: not exist spells with weapon req. and IsSpellHaveCasterSourceTargets == true
|
||||
// so this just for speedup places in else
|
||||
@@ -2441,7 +2441,7 @@ void Spell::EffectTriggerMissileSpell(uint32 effect_idx)
|
||||
// Needed by freezing arrow and few other spells
|
||||
if (m_caster->GetTypeId() == TYPEID_PLAYER && m_spellInfo->CategoryRecoveryTime && spellInfo->CategoryRecoveryTime
|
||||
&& m_spellInfo->Category == spellInfo->Category)
|
||||
((Player*)m_caster)->RemoveSpellCooldown(spellInfo->Id);
|
||||
m_caster->ToPlayer()->RemoveSpellCooldown(spellInfo->Id);
|
||||
|
||||
float x, y, z;
|
||||
m_targets.m_dstPos.GetPosition(x, y, z);
|
||||
@@ -2469,7 +2469,7 @@ void Spell::EffectJump(uint32 i)
|
||||
else if(m_caster->getVictim())
|
||||
pTarget = m_caster->getVictim();
|
||||
else if(m_caster->GetTypeId() == TYPEID_PLAYER)
|
||||
pTarget = ObjectAccessor::GetUnit(*m_caster, ((Player*)m_caster)->GetSelection());
|
||||
pTarget = ObjectAccessor::GetUnit(*m_caster, m_caster->ToPlayer()->GetSelection());
|
||||
|
||||
o = pTarget ? pTarget->GetOrientation() : m_caster->GetOrientation();
|
||||
}
|
||||
@@ -2529,7 +2529,7 @@ void Spell::EffectTeleportUnits(uint32 i)
|
||||
if (mapid == unitTarget->GetMapId())
|
||||
unitTarget->NearTeleportTo(x, y, z, orientation, unitTarget == m_caster);
|
||||
else if(unitTarget->GetTypeId() == TYPEID_PLAYER)
|
||||
((Player*)unitTarget)->TeleportTo(mapid, x, y, z, orientation, unitTarget == m_caster ? TELE_TO_SPELL : 0);
|
||||
unitTarget->ToPlayer()->TeleportTo(mapid, x, y, z, orientation, unitTarget == m_caster ? TELE_TO_SPELL : 0);
|
||||
|
||||
// post effects for TARGET_DST_DB
|
||||
switch (m_spellInfo->Id)
|
||||
@@ -2574,7 +2574,7 @@ void Spell::EffectTeleportUnits(uint32 i)
|
||||
case 5:
|
||||
// Transform
|
||||
{
|
||||
if (((Player*)m_caster)->GetTeam() == ALLIANCE )
|
||||
if (m_caster->ToPlayer()->GetTeam() == ALLIANCE )
|
||||
m_caster->CastSpell(m_caster, 36897, true);
|
||||
else
|
||||
m_caster->CastSpell(m_caster, 36899, true);
|
||||
@@ -2615,7 +2615,7 @@ void Spell::EffectTeleportUnits(uint32 i)
|
||||
case 4:
|
||||
// Transform
|
||||
{
|
||||
if (((Player*)m_caster)->GetTeam() == ALLIANCE )
|
||||
if (m_caster->ToPlayer()->GetTeam() == ALLIANCE )
|
||||
m_caster->CastSpell(m_caster, 36897, true);
|
||||
else
|
||||
m_caster->CastSpell(m_caster, 36899, true);
|
||||
@@ -3611,7 +3611,7 @@ void Spell::EffectSummonType(uint32 i)
|
||||
ItemPrototype const *proto = m_CastItem->GetProto();
|
||||
if (proto && proto->RequiredSkill == SKILL_ENGINERING)
|
||||
{
|
||||
uint16 skill202 = ((Player*)m_caster)->GetSkillValue(SKILL_ENGINERING);
|
||||
uint16 skill202 = m_caster->ToPlayer()->GetSkillValue(SKILL_ENGINERING);
|
||||
if (skill202)
|
||||
level = skill202/5;
|
||||
}
|
||||
@@ -3658,13 +3658,13 @@ void Spell::EffectSummonType(uint32 i)
|
||||
&& properties->Slot >= SUMMON_SLOT_TOTEM
|
||||
&& properties->Slot < MAX_TOTEM_SLOT)
|
||||
{
|
||||
//summon->SendUpdateToPlayer((Player*)m_originalCaster);
|
||||
//summon->SendUpdateToPlayerm_originalCaster->ToPlayer();
|
||||
WorldPacket data(SMSG_TOTEM_CREATED, 1+8+4+4);
|
||||
data << uint8(properties->Slot-1);
|
||||
data << uint64(m_originalCaster->GetGUID());
|
||||
data << uint32(duration);
|
||||
data << uint32(m_spellInfo->Id);
|
||||
((Player*)m_originalCaster)->SendDirectMessage(&data);
|
||||
m_originalCaster->ToPlayer()->SendDirectMessage(&data);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -3891,8 +3891,8 @@ void Spell::EffectDistract(uint32 /*i*/)
|
||||
if (unitTarget->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
// For players just turn them
|
||||
((Player*)unitTarget)->SetPosition(unitTarget->GetPositionX(), unitTarget->GetPositionY(), unitTarget->GetPositionZ(), angle, false);
|
||||
((Player*)unitTarget)->SendTeleportAckMsg();
|
||||
unitTarget->ToPlayer()->SetPosition(unitTarget->GetPositionX(), unitTarget->GetPositionY(), unitTarget->GetPositionZ(), angle, false);
|
||||
unitTarget->ToPlayer()->SendTeleportAckMsg();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -3914,7 +3914,7 @@ void Spell::EffectPickPocket(uint32 /*i*/)
|
||||
|
||||
// victim have to be alive and humanoid or undead
|
||||
if (unitTarget->isAlive() && (unitTarget->GetCreatureTypeMask() &CREATURE_TYPEMASK_HUMANOID_OR_UNDEAD) != 0)
|
||||
((Player*)m_caster)->SendLoot(unitTarget->GetGUID(),LOOT_PICKPOCKETING);
|
||||
m_caster->ToPlayer()->SendLoot(unitTarget->GetGUID(),LOOT_PICKPOCKETING);
|
||||
}
|
||||
|
||||
void Spell::EffectAddFarsight(uint32 i)
|
||||
@@ -3941,8 +3941,8 @@ void Spell::EffectAddFarsight(uint32 i)
|
||||
dynObj->GetMap()->Add(dynObj); //grid will also be loaded
|
||||
|
||||
// Need to update visibility of object for client to accept farsight guid
|
||||
((Player*)m_caster)->SetViewpoint(dynObj, true);
|
||||
//((Player*)m_caster)->UpdateVisibilityOf(dynObj);
|
||||
m_caster->ToPlayer()->SetViewpoint(dynObj, true);
|
||||
//m_caster->ToPlayer()->UpdateVisibilityOf(dynObj);
|
||||
}
|
||||
|
||||
void Spell::EffectTeleUnitsFaceCaster(uint32 i)
|
||||
@@ -3970,8 +3970,8 @@ void Spell::EffectLearnSkill(uint32 i)
|
||||
return;
|
||||
|
||||
uint32 skillid = m_spellInfo->EffectMiscValue[i];
|
||||
uint16 skillval = ((Player*)unitTarget)->GetPureSkillValue(skillid);
|
||||
((Player*)unitTarget)->SetSkill(skillid, skillval?skillval:1, damage*75);
|
||||
uint16 skillval = unitTarget->ToPlayer()->GetPureSkillValue(skillid);
|
||||
unitTarget->ToPlayer()->SetSkill(skillid, skillval?skillval:1, damage*75);
|
||||
}
|
||||
|
||||
void Spell::EffectAddHonor(uint32 /*i*/)
|
||||
@@ -3982,8 +3982,8 @@ void Spell::EffectAddHonor(uint32 /*i*/)
|
||||
// not scale value for item based reward (/10 value expected)
|
||||
if (m_CastItem)
|
||||
{
|
||||
((Player*)unitTarget)->RewardHonor(NULL, 1, damage/10);
|
||||
sLog.outError("SpellEffect::AddHonor (spell_id %u) rewards %d honor points (item %u) for player: %u", m_spellInfo->Id, damage/10, m_CastItem->GetEntry(),((Player*)unitTarget)->GetGUIDLow());
|
||||
unitTarget->ToPlayer()->RewardHonor(NULL, 1, damage/10);
|
||||
sLog.outError("SpellEffect::AddHonor (spell_id %u) rewards %d honor points (item %u) for player: %u", m_spellInfo->Id, damage/10, m_CastItem->GetEntry(),unitTarget->ToPlayer()->GetGUIDLow());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -3991,14 +3991,14 @@ void Spell::EffectAddHonor(uint32 /*i*/)
|
||||
if (damage <= 50)
|
||||
{
|
||||
uint32 honor_reward = Trinity::Honor::hk_honor_at_level(unitTarget->getLevel(), damage);
|
||||
((Player*)unitTarget)->RewardHonor(NULL, 1, honor_reward);
|
||||
sLog.outDebug("SpellEffect::AddHonor (spell_id %u) rewards %u honor points (scale) to player: %u", m_spellInfo->Id, honor_reward, ((Player*)unitTarget)->GetGUIDLow());
|
||||
unitTarget->ToPlayer()->RewardHonor(NULL, 1, honor_reward);
|
||||
sLog.outDebug("SpellEffect::AddHonor (spell_id %u) rewards %u honor points (scale) to player: %u", m_spellInfo->Id, honor_reward, unitTarget->ToPlayer()->GetGUIDLow());
|
||||
}
|
||||
else
|
||||
{
|
||||
//maybe we have correct honor_gain in damage already
|
||||
((Player*)unitTarget)->RewardHonor(NULL, 1, damage);
|
||||
sLog.outError("SpellEffect::AddHonor (spell_id %u) rewards %u honor points (non scale) for player: %u", m_spellInfo->Id, damage, ((Player*)unitTarget)->GetGUIDLow());
|
||||
unitTarget->ToPlayer()->RewardHonor(NULL, 1, damage);
|
||||
sLog.outError("SpellEffect::AddHonor (spell_id %u) rewards %u honor points (non scale) for player: %u", m_spellInfo->Id, damage, unitTarget->ToPlayer()->GetGUIDLow());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4007,8 +4007,8 @@ void Spell::EffectTradeSkill(uint32 /*i*/)
|
||||
if (unitTarget->GetTypeId() != TYPEID_PLAYER)
|
||||
return;
|
||||
// uint32 skillid = m_spellInfo->EffectMiscValue[i];
|
||||
// uint16 skillmax = ((Player*)unitTarget)->(skillid);
|
||||
// ((Player*)unitTarget)->SetSkill(skillid,skillval?skillval:1,skillmax+75);
|
||||
// uint16 skillmax = unitTarget->ToPlayer()->(skillid);
|
||||
// unitTarget->ToPlayer()->SetSkill(skillid,skillval?skillval:1,skillmax+75);
|
||||
}
|
||||
|
||||
void Spell::EffectEnchantItemPerm(uint32 effect_idx)
|
||||
@@ -4304,7 +4304,7 @@ void Spell::EffectTameCreature(uint32 /*i*/)
|
||||
if (m_caster->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
pet->SavePetToDB(PET_SAVE_AS_CURRENT);
|
||||
((Player*)m_caster)->PetSpellInitialize();
|
||||
m_caster->ToPlayer()->PetSpellInitialize();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4353,13 +4353,13 @@ void Spell::EffectSummonPet(uint32 i)
|
||||
//owner->GetMap()->Add((Creature*)OldSummon);
|
||||
|
||||
if (owner->GetTypeId() == TYPEID_PLAYER && OldSummon->isControlled() )
|
||||
((Player*)owner)->PetSpellInitialize();
|
||||
owner->ToPlayer()->PetSpellInitialize();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (owner->GetTypeId() == TYPEID_PLAYER)
|
||||
((Player*)owner)->RemovePet(OldSummon,(OldSummon->getPetType()==HUNTER_PET ? PET_SAVE_AS_DELETED : PET_SAVE_NOT_IN_SLOT),false);
|
||||
owner->ToPlayer()->RemovePet(OldSummon,(OldSummon->getPetType()==HUNTER_PET ? PET_SAVE_AS_DELETED : PET_SAVE_NOT_IN_SLOT),false);
|
||||
else
|
||||
return;
|
||||
}
|
||||
@@ -4508,14 +4508,14 @@ void Spell::SpellDamageWeaponDmg(uint32 i)
|
||||
if (m_spellInfo->SpellFamilyFlags[0] & 0x2000000)
|
||||
{
|
||||
if (m_caster->GetTypeId() == TYPEID_PLAYER)
|
||||
((Player*)m_caster)->AddComboPoints(unitTarget, 1, this);
|
||||
m_caster->ToPlayer()->AddComboPoints(unitTarget, 1, this);
|
||||
}
|
||||
// Fan of Knives
|
||||
else if (m_spellInfo->SpellFamilyFlags[1] & 0x40000)
|
||||
{
|
||||
// 50% more damage with daggers
|
||||
if (m_caster->GetTypeId() == TYPEID_PLAYER)
|
||||
if (Item* item = ((Player*)m_caster)->GetWeaponForAttack(m_attackType, true))
|
||||
if (Item* item = m_caster->ToPlayer()->GetWeaponForAttack(m_attackType, true))
|
||||
if (item->GetProto()->SubClass == ITEM_SUBCLASS_WEAPON_DAGGER)
|
||||
totalDamagePercentMod *= 1.5f;
|
||||
}
|
||||
@@ -4575,7 +4575,7 @@ void Spell::SpellDamageWeaponDmg(uint32 i)
|
||||
if(m_spellInfo->SpellFamilyFlags[1] & 0x400)
|
||||
{
|
||||
if(m_caster->GetTypeId() == TYPEID_PLAYER)
|
||||
((Player*)m_caster)->AddComboPoints(unitTarget,1, this);
|
||||
m_caster->ToPlayer()->AddComboPoints(unitTarget,1, this);
|
||||
}
|
||||
// Shred, Maul - Rend and Tear
|
||||
else if (m_spellInfo->SpellFamilyFlags[0] & 0x00008800 && unitTarget->HasAuraState(AURA_STATE_BLEEDING))
|
||||
@@ -4894,7 +4894,7 @@ void Spell::EffectScriptEffect(uint32 effIndex)
|
||||
if(m_caster->GetTypeId() != TYPEID_PLAYER)
|
||||
return;
|
||||
|
||||
Player* plr = ((Player*)m_caster);
|
||||
Player* plr = m_caster->ToPlayer();
|
||||
if(plr && plr->GetLastPetNumber())
|
||||
{
|
||||
PetType NewPetType = (plr->getClass()==CLASS_HUNTER) ? HUNTER_PET : SUMMON_PET;
|
||||
@@ -5204,16 +5204,16 @@ void Spell::EffectScriptEffect(uint32 effIndex)
|
||||
if(!unitTarget)
|
||||
return;
|
||||
|
||||
switch(((Player*)unitTarget)->GetBaseSkillValue(762))
|
||||
switch(unitTarget->ToPlayer()->GetBaseSkillValue(762))
|
||||
{
|
||||
case 75: unitTarget->CastSpell(unitTarget, 51621, true); break;;
|
||||
case 150: unitTarget->CastSpell(unitTarget, 48024, true); break;
|
||||
case 225:
|
||||
if(((Player*)unitTarget)->GetMapId()==571 || ((Player*)unitTarget)->GetMapId()==530)
|
||||
if(unitTarget->ToPlayer()->GetMapId()==571 || unitTarget->ToPlayer()->GetMapId()==530)
|
||||
unitTarget->CastSpell(unitTarget, 51617, true);
|
||||
break;
|
||||
case 300:
|
||||
if(((Player*)unitTarget)->GetMapId()==571 || ((Player*)unitTarget)->GetMapId()==530)
|
||||
if(unitTarget->ToPlayer()->GetMapId()==571 || unitTarget->ToPlayer()->GetMapId()==530)
|
||||
unitTarget->CastSpell(unitTarget, 48023, true);
|
||||
break;
|
||||
default: break;
|
||||
@@ -5227,7 +5227,7 @@ void Spell::EffectScriptEffect(uint32 effIndex)
|
||||
|
||||
if(unitTarget)
|
||||
{
|
||||
switch(((Player*)unitTarget)->GetBaseSkillValue(762))
|
||||
switch(unitTarget->ToPlayer()->GetBaseSkillValue(762))
|
||||
{
|
||||
case 75: unitTarget->CastSpell(unitTarget, 42680, true); break;;
|
||||
case 150: case 225: case 300: unitTarget->CastSpell(unitTarget, 42683, true); break;
|
||||
@@ -5248,7 +5248,7 @@ void Spell::EffectScriptEffect(uint32 effIndex)
|
||||
|
||||
while (bag < 256)
|
||||
{
|
||||
item = ((Player*)m_caster)->GetItemByPos(bag, slot);
|
||||
item = m_caster->ToPlayer()->GetItemByPos(bag, slot);
|
||||
if (item && item->GetEntry() == 38587) break;
|
||||
++slot;
|
||||
if (slot == 39)
|
||||
@@ -5259,8 +5259,8 @@ void Spell::EffectScriptEffect(uint32 effIndex)
|
||||
}
|
||||
if (bag < 256)
|
||||
{
|
||||
if (((Player*)m_caster)->GetItemByPos(bag,slot)->GetCount() == 1) ((Player*)m_caster)->RemoveItem(bag,slot,true);
|
||||
else ((Player*)m_caster)->GetItemByPos(bag,slot)->SetCount(((Player*)m_caster)->GetItemByPos(bag,slot)->GetCount()-1);
|
||||
if (m_caster->ToPlayer()->GetItemByPos(bag,slot)->GetCount() == 1) m_caster->ToPlayer()->RemoveItem(bag,slot,true);
|
||||
else m_caster->ToPlayer()->GetItemByPos(bag,slot)->SetCount(m_caster->ToPlayer()->GetItemByPos(bag,slot)->GetCount()-1);
|
||||
// Spell 42518 (Braufest - Gratisprobe des Braufest herstellen)
|
||||
m_caster->CastSpell(m_caster, 42518, true);
|
||||
return;
|
||||
@@ -5329,7 +5329,7 @@ void Spell::EffectScriptEffect(uint32 effIndex)
|
||||
if(!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER)
|
||||
return;
|
||||
|
||||
((Player*)unitTarget)->ModifyMoney(5000 * GOLD);
|
||||
unitTarget->ToPlayer()->ModifyMoney(5000 * GOLD);
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -5362,7 +5362,7 @@ void Spell::EffectScriptEffect(uint32 effIndex)
|
||||
return;
|
||||
|
||||
// Remove Taunt cooldown
|
||||
((Player*)unitTarget)->RemoveSpellCooldown(355, true);
|
||||
unitTarget->ToPlayer()->RemoveSpellCooldown(355, true);
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -5477,7 +5477,7 @@ void Spell::EffectScriptEffect(uint32 effIndex)
|
||||
unitTarget->RemoveAurasByType(SPELL_AURA_MOUNTED);
|
||||
|
||||
// Triggered spell id dependent of riding skill
|
||||
if(uint16 skillval = ((Player*)unitTarget)->GetSkillValue(SKILL_RIDING))
|
||||
if(uint16 skillval = unitTarget->ToPlayer()->GetSkillValue(SKILL_RIDING))
|
||||
{
|
||||
if (skillval >= 300)
|
||||
unitTarget->CastSpell(unitTarget, 54727, true);
|
||||
@@ -5495,7 +5495,7 @@ void Spell::EffectScriptEffect(uint32 effIndex)
|
||||
uint32 spellID = m_spellInfo->CalculateSimpleValue(0);
|
||||
uint32 questID = m_spellInfo->CalculateSimpleValue(1);
|
||||
|
||||
if (((Player*)unitTarget)->GetQuestStatus(questID) == QUEST_STATUS_COMPLETE && !((Player*)unitTarget)->GetQuestRewardStatus (questID))
|
||||
if (unitTarget->ToPlayer()->GetQuestStatus(questID) == QUEST_STATUS_COMPLETE && !unitTarget->ToPlayer()->GetQuestRewardStatus (questID))
|
||||
unitTarget->CastSpell(unitTarget, spellID, true);
|
||||
|
||||
return;
|
||||
@@ -5568,7 +5568,7 @@ void Spell::EffectScriptEffect(uint32 effIndex)
|
||||
unitTarget->RemoveAurasByType(SPELL_AURA_MOUNTED);
|
||||
|
||||
// Triggered spell id dependent of riding skill
|
||||
if(uint16 skillval = ((Player*)unitTarget)->GetSkillValue(SKILL_RIDING))
|
||||
if(uint16 skillval = unitTarget->ToPlayer()->GetSkillValue(SKILL_RIDING))
|
||||
{
|
||||
if (skillval >= 150)
|
||||
unitTarget->CastSpell(unitTarget, 58999, true);
|
||||
@@ -5582,7 +5582,7 @@ void Spell::EffectScriptEffect(uint32 effIndex)
|
||||
return;
|
||||
|
||||
// return from top
|
||||
if (((Player*)unitTarget)->GetAreaId() == 4637)
|
||||
if (unitTarget->ToPlayer()->GetAreaId() == 4637)
|
||||
unitTarget->CastSpell(unitTarget, 59316, true);
|
||||
// teleport atop
|
||||
else
|
||||
@@ -5601,7 +5601,7 @@ void Spell::EffectScriptEffect(uint32 effIndex)
|
||||
|
||||
// learn random explicit discovery recipe (if any)
|
||||
if(uint32 discoveredSpell = GetExplicitDiscoverySpell(m_spellInfo->Id, (Player*)m_caster))
|
||||
((Player*)m_caster)->learnSpell(discoveredSpell, false);
|
||||
m_caster->ToPlayer()->learnSpell(discoveredSpell, false);
|
||||
return;
|
||||
}
|
||||
case 62428: // Load into Catapult
|
||||
@@ -5950,7 +5950,7 @@ void Spell::EffectScriptEffect(uint32 effIndex)
|
||||
if (m_caster->GetTypeId() != TYPEID_PLAYER)
|
||||
return;
|
||||
|
||||
if (Pet *PlrPet = ((Player*)m_caster)->GetPet())
|
||||
if (Pet *PlrPet = m_caster->ToPlayer()->GetPet())
|
||||
m_caster->CastSpell(PlrPet, 62305, true);
|
||||
return;
|
||||
}
|
||||
@@ -6152,7 +6152,7 @@ void Spell::EffectSanctuary(uint32 /*i*/)
|
||||
{
|
||||
((Player *)m_caster)->RemoveAurasByType(SPELL_AURA_MOD_ROOT);
|
||||
// Overkill
|
||||
if(((Player*)m_caster)->HasSpell(58426))
|
||||
if(m_caster->ToPlayer()->HasSpell(58426))
|
||||
m_caster->CastSpell(m_caster, 58427, true);
|
||||
}
|
||||
}
|
||||
@@ -6299,13 +6299,13 @@ void Spell::EffectSummonPlayer(uint32 /*i*/)
|
||||
float x, y, z;
|
||||
m_caster->GetClosePoint(x, y, z, unitTarget->GetObjectSize());
|
||||
|
||||
((Player*)unitTarget)->SetSummonPoint(m_caster->GetMapId(),x,y,z);
|
||||
unitTarget->ToPlayer()->SetSummonPoint(m_caster->GetMapId(),x,y,z);
|
||||
|
||||
WorldPacket data(SMSG_SUMMON_REQUEST, 8+4+4);
|
||||
data << uint64(m_caster->GetGUID()); // summoner guid
|
||||
data << uint32(m_caster->GetZoneId()); // summoner zone
|
||||
data << uint32(MAX_PLAYER_SUMMON_DELAY*IN_MILISECONDS); // auto decline after msecs
|
||||
((Player*)unitTarget)->GetSession()->SendPacket(&data);
|
||||
unitTarget->ToPlayer()->GetSession()->SendPacket(&data);
|
||||
}
|
||||
|
||||
static ScriptInfo generateActivateCommand()
|
||||
@@ -6418,7 +6418,7 @@ void Spell::EffectDisEnchant(uint32 /*i*/)
|
||||
|
||||
p_caster->UpdateCraftSkill(m_spellInfo->Id);
|
||||
|
||||
((Player*)m_caster)->SendLoot(itemTarget->GetGUID(),LOOT_DISENCHANTING);
|
||||
m_caster->ToPlayer()->SendLoot(itemTarget->GetGUID(),LOOT_DISENCHANTING);
|
||||
|
||||
// item will be removed at disenchanting end
|
||||
}
|
||||
@@ -6472,13 +6472,13 @@ void Spell::EffectDismissPet(uint32 /*i*/)
|
||||
if(m_caster->GetTypeId() != TYPEID_PLAYER)
|
||||
return;
|
||||
|
||||
Pet* pet = ((Player*)m_caster)->GetPet();
|
||||
Pet* pet = m_caster->ToPlayer()->GetPet();
|
||||
|
||||
// not let dismiss dead pet
|
||||
if(!pet||!pet->isAlive())
|
||||
return;
|
||||
|
||||
((Player*)m_caster)->RemovePet(pet, PET_SAVE_NOT_IN_SLOT);
|
||||
m_caster->ToPlayer()->RemovePet(pet, PET_SAVE_NOT_IN_SLOT);
|
||||
}
|
||||
|
||||
void Spell::EffectSummonObject(uint32 i)
|
||||
@@ -6575,7 +6575,7 @@ void Spell::EffectResurrect(uint32 /*effIndex*/)
|
||||
break;
|
||||
}
|
||||
|
||||
Player* pTarget = ((Player*)unitTarget);
|
||||
Player* pTarget = unitTarget->ToPlayer();
|
||||
|
||||
if(pTarget->isRessurectRequested()) // already have one active request
|
||||
return;
|
||||
@@ -6614,13 +6614,13 @@ void Spell::EffectAddExtraAttacks(uint32 /*i*/)
|
||||
void Spell::EffectParry(uint32 /*i*/)
|
||||
{
|
||||
if (unitTarget && unitTarget->GetTypeId() == TYPEID_PLAYER)
|
||||
((Player*)unitTarget)->SetCanParry(true);
|
||||
unitTarget->ToPlayer()->SetCanParry(true);
|
||||
}
|
||||
|
||||
void Spell::EffectBlock(uint32 /*i*/)
|
||||
{
|
||||
if (unitTarget && unitTarget->GetTypeId() == TYPEID_PLAYER)
|
||||
((Player*)unitTarget)->SetCanBlock(true);
|
||||
unitTarget->ToPlayer()->SetCanBlock(true);
|
||||
}
|
||||
|
||||
void Spell::EffectLeapForward(uint32 i)
|
||||
@@ -6741,7 +6741,7 @@ void Spell::EffectSelfResurrect(uint32 i)
|
||||
mana = uint32(damage/100.0f*unitTarget->GetMaxPower(POWER_MANA));
|
||||
}
|
||||
|
||||
Player *plr = ((Player*)unitTarget);
|
||||
Player *plr = unitTarget->ToPlayer();
|
||||
plr->ResurrectPlayer(0.0f);
|
||||
|
||||
plr->SetHealth( health );
|
||||
@@ -6764,15 +6764,15 @@ void Spell::EffectSkinning(uint32 /*i*/)
|
||||
|
||||
uint32 skill = creature->GetCreatureInfo()->GetRequiredLootSkill();
|
||||
|
||||
((Player*)m_caster)->SendLoot(creature->GetGUID(),LOOT_SKINNING);
|
||||
m_caster->ToPlayer()->SendLoot(creature->GetGUID(),LOOT_SKINNING);
|
||||
creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE);
|
||||
|
||||
int32 reqValue = targetLevel < 10 ? 0 : targetLevel < 20 ? (targetLevel-10)*10 : targetLevel*5;
|
||||
|
||||
int32 skillValue = ((Player*)m_caster)->GetPureSkillValue(skill);
|
||||
int32 skillValue = m_caster->ToPlayer()->GetPureSkillValue(skill);
|
||||
|
||||
// Double chances for elites
|
||||
((Player*)m_caster)->UpdateGatherSkill(skill, skillValue, reqValue, creature->isElite() ? 2 : 1 );
|
||||
m_caster->ToPlayer()->UpdateGatherSkill(skill, skillValue, reqValue, creature->isElite() ? 2 : 1 );
|
||||
}
|
||||
|
||||
void Spell::EffectCharge(uint32 /*i*/)
|
||||
@@ -6872,7 +6872,7 @@ void Spell::EffectSendTaxi(uint32 i)
|
||||
if(!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER)
|
||||
return;
|
||||
|
||||
((Player*)unitTarget)->ActivateTaxiPathTo(m_spellInfo->EffectMiscValue[i],m_spellInfo->Id);
|
||||
unitTarget->ToPlayer()->ActivateTaxiPathTo(m_spellInfo->EffectMiscValue[i],m_spellInfo->Id);
|
||||
}
|
||||
|
||||
void Spell::EffectPlayerPull(uint32 i)
|
||||
@@ -6984,7 +6984,7 @@ void Spell::EffectDurabilityDamage(uint32 i)
|
||||
// Possibly its mean -1 all player equipped items and -2 all items
|
||||
if(slot < 0)
|
||||
{
|
||||
((Player*)unitTarget)->DurabilityPointsLossAll(damage, (slot < -1));
|
||||
unitTarget->ToPlayer()->DurabilityPointsLossAll(damage, (slot < -1));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -6992,8 +6992,8 @@ void Spell::EffectDurabilityDamage(uint32 i)
|
||||
if(slot >= INVENTORY_SLOT_BAG_END)
|
||||
return;
|
||||
|
||||
if(Item* item = ((Player*)unitTarget)->GetItemByPos(INVENTORY_SLOT_BAG_0, slot))
|
||||
((Player*)unitTarget)->DurabilityPointsLoss(item, damage);
|
||||
if(Item* item = unitTarget->ToPlayer()->GetItemByPos(INVENTORY_SLOT_BAG_0, slot))
|
||||
unitTarget->ToPlayer()->DurabilityPointsLoss(item, damage);
|
||||
}
|
||||
|
||||
void Spell::EffectDurabilityDamagePCT(uint32 i)
|
||||
@@ -7007,7 +7007,7 @@ void Spell::EffectDurabilityDamagePCT(uint32 i)
|
||||
// Possibly its mean -1 all player equipped items and -2 all items
|
||||
if(slot < 0)
|
||||
{
|
||||
((Player*)unitTarget)->DurabilityLossAll(double(damage)/100.0f, (slot < -1));
|
||||
unitTarget->ToPlayer()->DurabilityLossAll(double(damage)/100.0f, (slot < -1));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -7018,8 +7018,8 @@ void Spell::EffectDurabilityDamagePCT(uint32 i)
|
||||
if(damage <= 0)
|
||||
return;
|
||||
|
||||
if(Item* item = ((Player*)unitTarget)->GetItemByPos(INVENTORY_SLOT_BAG_0, slot))
|
||||
((Player*)unitTarget)->DurabilityLoss(item, double(damage)/100.0f);
|
||||
if(Item* item = unitTarget->ToPlayer()->GetItemByPos(INVENTORY_SLOT_BAG_0, slot))
|
||||
unitTarget->ToPlayer()->DurabilityLoss(item, double(damage)/100.0f);
|
||||
}
|
||||
|
||||
void Spell::EffectModifyThreatPercent(uint32 /*effIndex*/)
|
||||
@@ -7124,8 +7124,8 @@ void Spell::EffectTransmitted(uint32 effIndex)
|
||||
{
|
||||
if(m_caster->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
pGameObj->AddUniqueUse((Player*)m_caster);
|
||||
m_caster->AddGameObject(pGameObj); // will removed at spell cancel
|
||||
pGameObj->AddUniqueUse(m_caster->ToPlayer());
|
||||
m_caster->AddGameObject(pGameObj); // will removed at spell cancel
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -7192,7 +7192,7 @@ void Spell::EffectProspecting(uint32 /*i*/)
|
||||
p_caster->UpdateGatherSkill(SKILL_JEWELCRAFTING, SkillValue, reqSkillValue);
|
||||
}
|
||||
|
||||
((Player*)m_caster)->SendLoot(itemTarget->GetGUID(), LOOT_PROSPECTING);
|
||||
m_caster->ToPlayer()->SendLoot(itemTarget->GetGUID(), LOOT_PROSPECTING);
|
||||
}
|
||||
|
||||
void Spell::EffectMilling(uint32 /*i*/)
|
||||
@@ -7214,7 +7214,7 @@ void Spell::EffectMilling(uint32 /*i*/)
|
||||
p_caster->UpdateGatherSkill(SKILL_INSCRIPTION, SkillValue, reqSkillValue);
|
||||
}
|
||||
|
||||
((Player*)m_caster)->SendLoot(itemTarget->GetGUID(), LOOT_MILLING);
|
||||
m_caster->ToPlayer()->SendLoot(itemTarget->GetGUID(), LOOT_MILLING);
|
||||
}
|
||||
|
||||
void Spell::EffectSkill(uint32 /*i*/)
|
||||
@@ -7237,9 +7237,9 @@ void Spell::EffectSpiritHeal(uint32 /*i*/)
|
||||
return;
|
||||
|
||||
//m_spellInfo->EffectBasePoints[i]; == 99 (percent?)
|
||||
//((Player*)unitTarget)->setResurrect(m_caster->GetGUID(), unitTarget->GetPositionX(), unitTarget->GetPositionY(), unitTarget->GetPositionZ(), unitTarget->GetMaxHealth(), unitTarget->GetMaxPower(POWER_MANA));
|
||||
((Player*)unitTarget)->ResurrectPlayer(1.0f);
|
||||
((Player*)unitTarget)->SpawnCorpseBones();
|
||||
//unitTarget->ToPlayer()->setResurrect(m_caster->GetGUID(), unitTarget->GetPositionX(), unitTarget->GetPositionY(), unitTarget->GetPositionZ(), unitTarget->GetMaxHealth(), unitTarget->GetMaxPower(POWER_MANA));
|
||||
unitTarget->ToPlayer()->ResurrectPlayer(1.0f);
|
||||
unitTarget->ToPlayer()->SpawnCorpseBones();
|
||||
*/
|
||||
}
|
||||
|
||||
@@ -7250,7 +7250,7 @@ void Spell::EffectSkinPlayerCorpse(uint32 /*i*/)
|
||||
if ( (m_caster->GetTypeId() != TYPEID_PLAYER) || (unitTarget->GetTypeId() != TYPEID_PLAYER) || (unitTarget->isAlive()) )
|
||||
return;
|
||||
|
||||
((Player*)unitTarget)->RemovedInsignia( (Player*)m_caster );
|
||||
unitTarget->ToPlayer()->RemovedInsignia( (Player*)m_caster );
|
||||
}
|
||||
|
||||
void Spell::EffectStealBeneficialBuff(uint32 i)
|
||||
@@ -7321,7 +7321,7 @@ void Spell::EffectKillCreditPersonal(uint32 i)
|
||||
if(!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER)
|
||||
return;
|
||||
|
||||
((Player*)unitTarget)->KilledMonsterCredit(m_spellInfo->EffectMiscValue[i], 0);
|
||||
unitTarget->ToPlayer()->KilledMonsterCredit(m_spellInfo->EffectMiscValue[i], 0);
|
||||
}
|
||||
|
||||
void Spell::EffectKillCredit(uint32 i)
|
||||
@@ -7337,7 +7337,7 @@ void Spell::EffectKillCredit(uint32 i)
|
||||
}
|
||||
|
||||
if(creatureEntry)
|
||||
((Player*)unitTarget)->RewardPlayerAndGroupAtEvent(creatureEntry, unitTarget);
|
||||
unitTarget->ToPlayer()->RewardPlayerAndGroupAtEvent(creatureEntry, unitTarget);
|
||||
}
|
||||
|
||||
void Spell::EffectQuestFail(uint32 i)
|
||||
@@ -7345,7 +7345,7 @@ void Spell::EffectQuestFail(uint32 i)
|
||||
if(!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER)
|
||||
return;
|
||||
|
||||
((Player*)unitTarget)->FailQuest(m_spellInfo->EffectMiscValue[i]);
|
||||
unitTarget->ToPlayer()->FailQuest(m_spellInfo->EffectMiscValue[i]);
|
||||
}
|
||||
|
||||
void Spell::EffectActivateRune(uint32 eff_idx)
|
||||
@@ -7359,7 +7359,7 @@ void Spell::EffectActivateRune(uint32 eff_idx)
|
||||
return;
|
||||
|
||||
// needed later
|
||||
m_runesState = ((Player*)m_caster)->GetRunesState();
|
||||
m_runesState = m_caster->ToPlayer()->GetRunesState();
|
||||
|
||||
uint32 count = damage;
|
||||
if (count == 0) count = 1;
|
||||
@@ -7389,7 +7389,7 @@ void Spell::EffectActivateRune(uint32 eff_idx)
|
||||
void Spell::EffectTitanGrip(uint32 /*eff_idx*/)
|
||||
{
|
||||
if (unitTarget && unitTarget->GetTypeId() == TYPEID_PLAYER)
|
||||
((Player*)unitTarget)->SetCanTitanGrip(true);
|
||||
unitTarget->ToPlayer()->SetCanTitanGrip(true);
|
||||
}
|
||||
|
||||
void Spell::EffectRedirectThreat(uint32 /*i*/)
|
||||
@@ -7437,7 +7437,7 @@ void Spell::SummonGuardian(uint32 i, uint32 entry, SummonPropertiesEntry const *
|
||||
if (m_CastItem && caster->GetTypeId() == TYPEID_PLAYER)
|
||||
if (ItemPrototype const *proto = m_CastItem->GetProto())
|
||||
if (proto->RequiredSkill == SKILL_ENGINERING)
|
||||
if (uint16 skill202 = ((Player*)caster)->GetSkillValue(SKILL_ENGINERING))
|
||||
if (uint16 skill202 = caster->ToPlayer()->GetSkillValue(SKILL_ENGINERING))
|
||||
level = skill202/5;
|
||||
|
||||
//float radius = GetSpellRadiusForFriend(sSpellRadiusStore.LookupEntry(m_spellInfo->EffectRadiusIndex[i]));
|
||||
@@ -7550,7 +7550,7 @@ void Spell::EffectPlayMusic(uint32 i)
|
||||
|
||||
WorldPacket data(SMSG_PLAY_MUSIC, 4);
|
||||
data << uint32(soundid);
|
||||
((Player*)unitTarget)->GetSession()->SendPacket(&data);
|
||||
unitTarget->ToPlayer()->GetSession()->SendPacket(&data);
|
||||
}
|
||||
|
||||
void Spell::EffectSpecCount(uint32 /*eff_idx*/)
|
||||
@@ -7558,7 +7558,7 @@ void Spell::EffectSpecCount(uint32 /*eff_idx*/)
|
||||
if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER)
|
||||
return;
|
||||
|
||||
((Player*)unitTarget)->UpdateSpecCount(damage);
|
||||
unitTarget->ToPlayer()->UpdateSpecCount(damage);
|
||||
}
|
||||
|
||||
void Spell::EffectActivateSpec(uint32 /*eff_idx*/)
|
||||
@@ -7566,7 +7566,7 @@ void Spell::EffectActivateSpec(uint32 /*eff_idx*/)
|
||||
if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER)
|
||||
return;
|
||||
|
||||
((Player*)unitTarget)->ActivateSpec(damage-1); // damage is 1 or 2, spec is 0 or 1
|
||||
unitTarget->ToPlayer()->ActivateSpec(damage-1); // damage is 1 or 2, spec is 0 or 1
|
||||
}
|
||||
|
||||
void Spell::EffectPlayerNotification(uint32 /*eff_idx*/)
|
||||
|
||||
@@ -314,7 +314,7 @@ void WorldSession::HandleCastSpellOpcode(WorldPacket& recvPacket)
|
||||
if(mover->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
// not have spell in spellbook or spell passive and not casted by client
|
||||
if (!((Player*)mover)->HasActiveSpell (spellId) || IsPassiveSpell(spellId) )
|
||||
if (!mover->ToPlayer()->HasActiveSpell (spellId) || IsPassiveSpell(spellId) )
|
||||
{
|
||||
//cheater? kick? ban?
|
||||
recvPacket.rpos(recvPacket.wpos()); // prevent spam at ignore packet
|
||||
|
||||
@@ -334,7 +334,7 @@ void Guardian::InitSummon()
|
||||
if(m_owner->GetTypeId() == TYPEID_PLAYER
|
||||
&& m_owner->GetMinionGUID() == GetGUID()
|
||||
&& !m_owner->GetCharmGUID())
|
||||
((Player*)m_owner)->CharmSpellInitialize();
|
||||
m_owner->ToPlayer()->CharmSpellInitialize();
|
||||
}
|
||||
|
||||
Puppet::Puppet(SummonPropertiesEntry const *properties, Unit *owner) : Minion(properties, owner)
|
||||
|
||||
@@ -370,7 +370,7 @@ void ThreatManager::addThreat(Unit* pVictim, float fThreat, SpellSchoolMask scho
|
||||
return;
|
||||
|
||||
// not to GM
|
||||
if (!pVictim || (pVictim->GetTypeId() == TYPEID_PLAYER && ((Player*)pVictim)->isGameMaster()))
|
||||
if (!pVictim || (pVictim->GetTypeId() == TYPEID_PLAYER && pVictim->ToPlayer()->isGameMaster()))
|
||||
return;
|
||||
|
||||
// not to dead and not for dead
|
||||
@@ -406,7 +406,7 @@ void ThreatManager::_addThreat(Unit *pVictim, float fThreat)
|
||||
HostilReference* hostilReference = new HostilReference(pVictim, this, 0);
|
||||
iThreatContainer.addReference(hostilReference);
|
||||
hostilReference->addThreat(fThreat); // now we add the real threat
|
||||
if(pVictim->GetTypeId() == TYPEID_PLAYER && ((Player*)pVictim)->isGameMaster())
|
||||
if(pVictim->GetTypeId() == TYPEID_PLAYER && pVictim->ToPlayer()->isGameMaster())
|
||||
hostilReference->setOnlineOfflineState(false); // GM is always offline
|
||||
}
|
||||
}
|
||||
|
||||
+4
-4
@@ -59,11 +59,11 @@ void Totem::InitStats(uint32 duration)
|
||||
CreatureInfo const *cinfo = GetCreatureInfo();
|
||||
if(m_owner->GetTypeId() == TYPEID_PLAYER && cinfo)
|
||||
{
|
||||
uint32 display_id = objmgr.ChooseDisplayId(((Player*)m_owner)->GetTeam(), cinfo);
|
||||
uint32 display_id = objmgr.ChooseDisplayId(m_owner->ToPlayer()->GetTeam(), cinfo);
|
||||
CreatureModelInfo const *minfo = objmgr.GetCreatureModelRandomGender(display_id);
|
||||
if (minfo)
|
||||
display_id = minfo->modelid;
|
||||
switch (((Player*)m_owner)->GetTeam())
|
||||
switch (m_owner->ToPlayer()->GetTeam())
|
||||
{
|
||||
case ALLIANCE:
|
||||
display_id = cinfo->Modelid1;
|
||||
@@ -146,9 +146,9 @@ void Totem::UnSummon()
|
||||
Group *pGroup = NULL;
|
||||
if (m_owner->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
((Player*)m_owner)->SendAutoRepeatCancel(this);
|
||||
m_owner->ToPlayer()->SendAutoRepeatCancel(this);
|
||||
// Not only the player can summon the totem (scripted AI)
|
||||
pGroup = ((Player*)m_owner)->GetGroup();
|
||||
pGroup = m_owner->ToPlayer()->GetGroup();
|
||||
if (pGroup)
|
||||
{
|
||||
for (GroupReference *itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next())
|
||||
|
||||
+239
-239
File diff suppressed because it is too large
Load Diff
+7
-2
@@ -329,6 +329,7 @@ class PetAura;
|
||||
class Minion;
|
||||
class Guardian;
|
||||
class UnitAI;
|
||||
class Totem;
|
||||
class Transport;
|
||||
class Vehicle;
|
||||
|
||||
@@ -1849,8 +1850,8 @@ class Unit : public WorldObject
|
||||
static Player* GetPlayer(uint64 guid);
|
||||
static Creature* GetCreature(WorldObject& object, uint64 guid);
|
||||
|
||||
MotionMaster* GetMotionMaster() { return &i_motionMaster; }
|
||||
|
||||
MotionMaster* GetMotionMaster(){ return &i_motionMaster; }
|
||||
|
||||
bool IsStopped() const { return !(hasUnitState(UNIT_STAT_MOVING)); }
|
||||
void StopMoving();
|
||||
|
||||
@@ -1954,6 +1955,10 @@ class Unit : public WorldObject
|
||||
|
||||
void OutDebugInfo() const;
|
||||
virtual bool isBeingLoaded() const { return false;}
|
||||
|
||||
Pet* ToPet(){ if(isPet()) return reinterpret_cast<Pet*>(this); else return NULL; }
|
||||
Totem* ToTotem(){ if(isTotem()) return reinterpret_cast<Totem*>(this); else return NULL; }
|
||||
|
||||
protected:
|
||||
explicit Unit ();
|
||||
|
||||
|
||||
@@ -338,7 +338,7 @@ bool Vehicle::AddPassenger(Unit *unit, int8 seatId)
|
||||
}
|
||||
|
||||
//if(unit->GetTypeId() == TYPEID_PLAYER)
|
||||
// ((Player*)unit)->SendTeleportAckMsg();
|
||||
// unit->ToPlayer()->SendTeleportAckMsg();
|
||||
//unit->SendMovementFlagUpdate();
|
||||
|
||||
return true;
|
||||
|
||||
@@ -329,7 +329,7 @@ void WorldSession::LogoutPlayer(bool Save)
|
||||
if(owner)
|
||||
{
|
||||
if(owner->GetTypeId() == TYPEID_PLAYER)
|
||||
aset.insert((Player*)owner);
|
||||
aset.insert(owner->ToPlayer());
|
||||
}
|
||||
else
|
||||
if((*itr)->GetTypeId() == TYPEID_PLAYER)
|
||||
|
||||
Reference in New Issue
Block a user