aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/bindings/scripts/include/sc_creature.cpp10
-rw-r--r--src/bindings/scripts/include/sc_creature.h1
-rw-r--r--src/bindings/scripts/scripts/creature/mob_event_ai.cpp10
-rw-r--r--src/bindings/scripts/scripts/zone/sunwell_plateau/boss_kalecgos.cpp11
-rw-r--r--src/game/Level3.cpp24
-rw-r--r--src/game/MiscHandler.cpp2
-rw-r--r--src/game/PetHandler.cpp14
-rw-r--r--src/game/Player.cpp115
-rw-r--r--src/game/Player.h15
-rw-r--r--src/game/Spell.cpp7
-rw-r--r--src/game/Spell.h2
-rw-r--r--src/game/SpellAuras.cpp4
-rw-r--r--src/game/SpellEffects.cpp4
-rw-r--r--src/game/TemporarySummon.cpp4
-rw-r--r--src/game/Unit.cpp36
-rw-r--r--src/game/Unit.h13
-rw-r--r--src/game/WorldSession.cpp8
17 files changed, 89 insertions, 191 deletions
diff --git a/src/bindings/scripts/include/sc_creature.cpp b/src/bindings/scripts/include/sc_creature.cpp
index 932038a8194..2d767815dad 100644
--- a/src/bindings/scripts/include/sc_creature.cpp
+++ b/src/bindings/scripts/include/sc_creature.cpp
@@ -203,13 +203,21 @@ void ScriptedAI::DoStopAttack()
void ScriptedAI::DoCast(Unit* victim, uint32 spellId, bool triggered)
{
- if (!victim || m_creature->hasUnitState(UNIT_STAT_CASTING))
+ if (!victim || m_creature->hasUnitState(UNIT_STAT_CASTING) && !triggered)
return;
//m_creature->StopMoving();
m_creature->CastSpell(victim, spellId, triggered);
}
+void ScriptedAI::DoCastAOE(uint32 spellId, bool triggered)
+{
+ if(!triggered && m_creature->hasUnitState(UNIT_STAT_CASTING))
+ return;
+
+ m_creature->CastSpell((Unit*)NULL, spellId, triggered);
+}
+
void ScriptedAI::DoCastSpell(Unit* who,SpellEntry const *spellInfo, bool triggered)
{
if (!who || m_creature->IsNonMeleeSpellCasted(false))
diff --git a/src/bindings/scripts/include/sc_creature.h b/src/bindings/scripts/include/sc_creature.h
index f72278595c8..30769927501 100644
--- a/src/bindings/scripts/include/sc_creature.h
+++ b/src/bindings/scripts/include/sc_creature.h
@@ -121,6 +121,7 @@ struct TRINITY_DLL_DECL ScriptedAI : public CreatureAI
//Cast spell by Id
void DoCast(Unit* victim, uint32 spellId, bool triggered = false);
+ void DoCastAOE(uint32 spellId, bool triggered = false);
//Cast spell by spell info
void DoCastSpell(Unit* who,SpellEntry const *spellInfo, bool triggered = false);
diff --git a/src/bindings/scripts/scripts/creature/mob_event_ai.cpp b/src/bindings/scripts/scripts/creature/mob_event_ai.cpp
index c7605f9adc4..93cb9aba376 100644
--- a/src/bindings/scripts/scripts/creature/mob_event_ai.cpp
+++ b/src/bindings/scripts/scripts/creature/mob_event_ai.cpp
@@ -1260,9 +1260,13 @@ struct TRINITY_DLL_DECL Mob_EventAI : public ScriptedAI
switch ((*i).Event.event_type)
{
case EVENT_T_RANGE:
- float dist = m_creature->GetDistance(m_creature->getVictim());
- if (dist > (*i).Event.event_param1 && dist < (*i).Event.event_param2)
- ProcessEvent(*i);
+ // in some cases this is called twice and victim may not exist in the second time
+ if(m_creature->getVictim())
+ {
+ float dist = m_creature->GetDistance(m_creature->getVictim());
+ if (dist > (*i).Event.event_param1 && dist < (*i).Event.event_param2)
+ ProcessEvent(*i);
+ }
break;
}
}
diff --git a/src/bindings/scripts/scripts/zone/sunwell_plateau/boss_kalecgos.cpp b/src/bindings/scripts/scripts/zone/sunwell_plateau/boss_kalecgos.cpp
index 6930602fc7a..0bf3ecfb4c9 100644
--- a/src/bindings/scripts/scripts/zone/sunwell_plateau/boss_kalecgos.cpp
+++ b/src/bindings/scripts/scripts/zone/sunwell_plateau/boss_kalecgos.cpp
@@ -586,32 +586,31 @@ void boss_kalecgosAI::UpdateAI(const uint32 diff)
if(ArcaneBuffetTimer < diff)
{
- DoCast(m_creature->getVictim(), SPELL_ARCANE_BUFFET);
+ DoCastAOE(SPELL_ARCANE_BUFFET);
ArcaneBuffetTimer = 8000;
}else ArcaneBuffetTimer -= diff;
if(FrostBreathTimer < diff)
{
- DoCast(m_creature->getVictim(), SPELL_FROST_BREATH);
+ DoCastAOE(SPELL_FROST_BREATH);
FrostBreathTimer = 15000;
}else FrostBreathTimer -= diff;
if(TailLashTimer < diff)
{
- DoCast(m_creature->getVictim(), SPELL_TAIL_LASH);
+ DoCastAOE(SPELL_TAIL_LASH);
TailLashTimer = 15000;
}else TailLashTimer -= diff;
if(WildMagicTimer < diff)
{
- Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0);
- if(target && target->isAlive())
- DoCast(target, WildMagic[rand()%6]);
+ DoCastAOE(WildMagic[rand()%6]);
WildMagicTimer = 20000;
}else WildMagicTimer -= diff;
if(SpectralBlastTimer < diff)
{
+ //this is a hack. we need to find a victim without aura in core
Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0);
if( ( target != m_creature->getVictim() ) && target->isAlive() && !(target->HasAura(AURA_SPECTRAL_EXHAUSTION, 0)) )
{
diff --git a/src/game/Level3.cpp b/src/game/Level3.cpp
index 03979dc63e9..775252bbe1a 100644
--- a/src/game/Level3.cpp
+++ b/src/game/Level3.cpp
@@ -7346,19 +7346,19 @@ bool ChatHandler::HandlePossessCommand(const char* args)
if(!pUnit)
return false;
- // Don't allow unlimited possession of players
- if (pUnit->GetTypeId() == TYPEID_PLAYER)
- return false;
-
- pUnit->SetCharmedOrPossessedBy(m_session->GetPlayer(), true);
-
+ m_session->GetPlayer()->CastSpell(pUnit, 530, true);
return true;
}
bool ChatHandler::HandleUnPossessCommand(const char* args)
{
- // Use this command to also unpossess ourselves
- m_session->GetPlayer()->RemoveCharmedOrPossessedBy(NULL);
+ Unit* pUnit = getSelectedUnit();
+ if(!pUnit) pUnit = m_session->GetPlayer();
+
+ pUnit->RemoveSpellsCausingAura(SPELL_AURA_MOD_CHARM);
+ pUnit->RemoveSpellsCausingAura(SPELL_AURA_MOD_POSSESS_PET);
+ pUnit->RemoveSpellsCausingAura(SPELL_AURA_MOD_POSSESS);
+
return true;
}
@@ -7368,11 +7368,7 @@ bool ChatHandler::HandleBindSightCommand(const char* args)
if (!pUnit)
return false;
- if (m_session->GetPlayer()->isPossessing())
- return false;
-
- pUnit->AddPlayerToVision(m_session->GetPlayer());
-
+ m_session->GetPlayer()->CastSpell(pUnit, 6277, true);
return true;
}
@@ -7381,6 +7377,6 @@ bool ChatHandler::HandleUnbindSightCommand(const char* args)
if (m_session->GetPlayer()->isPossessing())
return false;
- m_session->GetPlayer()->RemoveFarsightTarget();
+ m_session->GetPlayer()->StopCastingBindSight();
return true;
}
diff --git a/src/game/MiscHandler.cpp b/src/game/MiscHandler.cpp
index bae43ca26dc..fe3ff829ccd 100644
--- a/src/game/MiscHandler.cpp
+++ b/src/game/MiscHandler.cpp
@@ -1490,7 +1490,7 @@ void WorldSession::HandleFarSightOpcode( WorldPacket & recv_data )
pair = Trinity::ComputeCellPair(obj->GetPositionX(), obj->GetPositionY());
else
return;
- sLog.outDebug("Added FarSight " I64FMT " to player %u", _player->GetFarSight(), _player->GetGUIDLow());
+ sLog.outDebug("Added FarSight " I64FMT " to player %u", _player->GetFarSightGUID(), _player->GetGUIDLow());
break;
default:
sLog.outDebug("Unhandled mode in CMSG_FAR_SIGHT: %u", apply);
diff --git a/src/game/PetHandler.cpp b/src/game/PetHandler.cpp
index da8ce311462..17c2ba4275b 100644
--- a/src/game/PetHandler.cpp
+++ b/src/game/PetHandler.cpp
@@ -161,12 +161,7 @@ void WorldSession::HandlePetAction( WorldPacket & recv_data )
p->setDeathState(CORPSE);
}
else // charmed or possessed
- {
- if (_player->isPossessing())
- _player->RemovePossess(true);
- else
- _player->Uncharm();
- }
+ _player->Uncharm();
break;
default:
sLog.outError("WORLD: unknown PET flag Action %i and spellid %i.\n", flag, spellid);
@@ -501,12 +496,7 @@ void WorldSession::HandlePetAbandon( WorldPacket & recv_data )
_player->RemovePet((Pet*)pet,PET_SAVE_AS_DELETED);
}
else if(pet->GetGUID() == _player->GetCharmGUID())
- {
- if (_player->isPossessing())
- _player->RemovePossess(true);
- else
- _player->Uncharm();
- }
+ _player->Uncharm();
}
}
diff --git a/src/game/Player.cpp b/src/game/Player.cpp
index a208f47cf0b..b7afc19edb0 100644
--- a/src/game/Player.cpp
+++ b/src/game/Player.cpp
@@ -506,9 +506,6 @@ Player::~Player ()
for(BoundInstancesMap::iterator itr = m_boundInstances[i].begin(); itr != m_boundInstances[i].end(); ++itr)
itr->second.save->RemovePlayer(this);
- if (m_uint32Values && isPossessing())
- RemovePossess(false);
-
delete m_declinedname;
delete m_runes;
}
@@ -1378,12 +1375,6 @@ void Player::setDeathState(DeathState s)
RemoveMiniPet();
RemoveGuardians();
- // remove possession
- if(isPossessing())
- RemovePossess(false);
- else
- RemoveFarsightTarget();
-
// save value before aura remove in Unit::setDeathState
ressSpellId = GetUInt32Value(PLAYER_SELF_RES_SPELL);
@@ -1622,18 +1613,6 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati
SetSemaphoreTeleport(true);
- // Remove any possession on the player before teleporting
- if (isPossessedByPlayer())
- ((Player*)GetCharmer())->RemovePossess();
-
- // Remove player's possession before teleporting
- if (isPossessing())
- RemovePossess(false);
-
- // Empty vision list and clear farsight (if it hasn't already been cleared by RemovePossess) before teleporting
- RemoveAllFromVision();
- RemoveFarsightTarget();
-
// The player was ported to another map and looses the duel immediatly.
// We have to perform this check before the teleport, otherwise the
// ObjectAccessor won't find the flag.
@@ -1860,12 +1839,13 @@ void Player::RemoveFromWorld()
if(IsInWorld())
{
///- Release charmed creatures, unsummon totems and remove pets/guardians
- RemovePossess(false);
- Uncharm();
+ StopCastingCharm();
+ StopCastingBindSight();
+ RemoveCharmAuras();
+ RemoveBindSightAuras();
UnsummonAllTotems();
RemoveMiniPet();
RemoveGuardians();
- RemoveFarsightTarget();
}
for(int i = PLAYER_SLOT_START; i < PLAYER_SLOT_END; i++)
@@ -5520,17 +5500,17 @@ void Player::SaveRecallPosition()
void Player::SendMessageToSet(WorldPacket *data, bool self, bool to_possessor)
{
- MapManager::Instance().GetMap(GetMapId(), this)->MessageBroadcast(this, data, self, to_possessor);
+ GetMap()->MessageBroadcast(this, data, self, to_possessor);
}
void Player::SendMessageToSetInRange(WorldPacket *data, float dist, bool self, bool to_possessor)
{
- MapManager::Instance().GetMap(GetMapId(), this)->MessageDistBroadcast(this, data, dist, self, to_possessor);
+ GetMap()->MessageDistBroadcast(this, data, dist, self, to_possessor);
}
void Player::SendMessageToSetInRange(WorldPacket *data, float dist, bool self, bool to_possessor, bool own_team_only)
{
- MapManager::Instance().GetMap(GetMapId(), this)->MessageDistBroadcast(this, data, dist, self, to_possessor, own_team_only);
+ GetMap()->MessageDistBroadcast(this, data, dist, self, to_possessor, own_team_only);
}
void Player::SendDirectMessage(WorldPacket *data)
@@ -5972,7 +5952,7 @@ bool Player::ModifyOneFactionReputation(FactionEntry const* factionEntry, int32
SetFactionVisible(&itr->second);
- for( int i = 0; i < MAX_QUEST_LOG_SIZE; i++ )
+ for( int i = 0; i < MAX_QUEST_LOG_SIZE; ++i )
{
if(uint32 questid = GetQuestSlotQuestId(i))
{
@@ -12643,7 +12623,7 @@ void Player::SendPreparedQuest( uint64 guid )
if( pCreature )
{
uint32 textid = pCreature->GetNpcTextId();
- GossipText * gossiptext = objmgr.GetGossipText(textid);
+ GossipText const* gossiptext = objmgr.GetGossipText(textid);
if( !gossiptext )
{
qe._Delay = 0; //TEXTEMOTE_MESSAGE; //zyg: player emote
@@ -13773,7 +13753,7 @@ void Player::GroupEventHappens( uint32 questId, WorldObject const* pEventObject
void Player::ItemAddedQuestCheck( uint32 entry, uint32 count )
{
- for( int i = 0; i < MAX_QUEST_LOG_SIZE; i++ )
+ for( int i = 0; i < MAX_QUEST_LOG_SIZE; ++i )
{
uint32 questid = GetQuestSlotQuestId(i);
if ( questid == 0 )
@@ -13815,7 +13795,7 @@ void Player::ItemAddedQuestCheck( uint32 entry, uint32 count )
void Player::ItemRemovedQuestCheck( uint32 entry, uint32 count )
{
- for( int i = 0; i < MAX_QUEST_LOG_SIZE; i++ )
+ for( int i = 0; i < MAX_QUEST_LOG_SIZE; ++i )
{
uint32 questid = GetQuestSlotQuestId(i);
if(!questid)
@@ -13858,7 +13838,7 @@ void Player::KilledMonster( uint32 entry, uint64 guid )
{
uint32 addkillcount = 1;
GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_KILL_CREATURE, entry, addkillcount);
- for( int i = 0; i < MAX_QUEST_LOG_SIZE; i++ )
+ for( int i = 0; i < MAX_QUEST_LOG_SIZE; ++i )
{
uint32 questid = GetQuestSlotQuestId(i);
if(!questid)
@@ -13913,7 +13893,7 @@ void Player::CastedCreatureOrGO( uint32 entry, uint64 guid, uint32 spell_id )
bool isCreature = IS_CREATURE_GUID(guid);
uint32 addCastCount = 1;
- for( int i = 0; i < MAX_QUEST_LOG_SIZE; i++ )
+ for( int i = 0; i < MAX_QUEST_LOG_SIZE; ++i)
{
uint32 questid = GetQuestSlotQuestId(i);
if(!questid)
@@ -13980,7 +13960,7 @@ void Player::CastedCreatureOrGO( uint32 entry, uint64 guid, uint32 spell_id )
void Player::TalkedToCreature( uint32 entry, uint64 guid )
{
uint32 addTalkCount = 1;
- for( int i = 0; i < MAX_QUEST_LOG_SIZE; i++ )
+ for( int i = 0; i < MAX_QUEST_LOG_SIZE; ++i )
{
uint32 questid = GetQuestSlotQuestId(i);
if(!questid)
@@ -14035,7 +14015,7 @@ void Player::TalkedToCreature( uint32 entry, uint64 guid )
void Player::MoneyChanged( uint32 count )
{
- for( int i = 0; i < MAX_QUEST_LOG_SIZE; i++ )
+ for( int i = 0; i < MAX_QUEST_LOG_SIZE; ++i )
{
uint32 questid = GetQuestSlotQuestId(i);
if (!questid)
@@ -16149,23 +16129,6 @@ void Player::SaveToDB()
// save pet (hunter pet level and experience and all type pets health/mana).
if(Pet* pet = GetPet())
pet->SavePetToDB(PET_SAVE_AS_CURRENT);
-
- //to prevent access to DB we should cache some data, which is used very often
- /*CachePlayerInfoMap::iterator _iter = objmgr.m_mPlayerInfoMap.find(GetGUIDLow());
- if(_iter != objmgr.m_mPlayerInfoMap.end())//skip new players
- {
- _iter->second->unLevel = getLevel();
-
- _iter->second->unArenaInfoSlot0 = GetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + 0 * 6 + 5);
- _iter->second->unArenaInfoSlot1 = GetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + 1 * 6 + 5);
- _iter->second->unArenaInfoSlot2 = GetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + 2 * 6 + 5);
-
- _iter->second->unfield = GetUInt32Value(UNIT_FIELD_BYTES_0);
-
- _iter->second->unArenaInfoId0 = GetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (0 * 6));
- _iter->second->unArenaInfoId1 = GetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (1 * 6));
- _iter->second->unArenaInfoId2 = GetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (2 * 6));
- }*/
m_achievementMgr.SaveToDB();
}
@@ -16988,6 +16951,8 @@ void Player::Uncharm()
return;
charm->RemoveSpellsCausingAura(SPELL_AURA_MOD_CHARM);
+ charm->RemoveSpellsCausingAura(SPELL_AURA_MOD_POSSESS_PET);
+ charm->RemoveSpellsCausingAura(SPELL_AURA_MOD_POSSESS);
}
void Player::BuildPlayerChat(WorldPacket *data, uint8 msgtype, const std::string& text, uint32 language) const
@@ -19884,41 +19849,6 @@ void Player::HandleFallUnderMap()
}
}
-void Player::RemovePossess(bool attack)
-{
- if(Unit *u = GetCharm())
- u->RemoveCharmedOrPossessedBy(this);
-
- /*else if (target->isAlive())
- {
- // If we're still hostile to our target, continue attacking otherwise reset threat and go home
- if (Unit* victim = target->getVictim())
- {
- FactionTemplateEntry const* t_faction = target->getFactionTemplateEntry();
- FactionTemplateEntry const* v_faction = victim->getFactionTemplateEntry();
- // Unit::IsHostileTo will always return true since the unit is always hostile to its victim
- if (t_faction && v_faction && !t_faction->IsHostileTo(*v_faction))
- {
- // Stop combat and remove the target from the threat lists of all its victims
- target->CombatStop();
- target->getHostilRefManager().deleteReferences();
- target->DeleteThreatList();
- target->GetMotionMaster()->Clear();
- target->GetMotionMaster()->MoveTargetedHome();
- }
- }
- else
- {
- target->GetMotionMaster()->Clear();
- target->GetMotionMaster()->MoveTargetedHome();
- }
-
- // Add high amount of threat on the player
- if(attack)
- target->AddThreat(this, 1000000.0f);
- }*/
-}
-
/*void Player::SetViewport(uint64 guid, bool moveable)
{
WorldPacket data(SMSG_CLIENT_CONTROL_UPDATE, 8+1);
@@ -19939,24 +19869,23 @@ void Player::SetBindSight(Unit *target)
WorldObject* Player::GetFarsightTarget() const
{
// Players can have in farsight field another player's guid, a creature's guid, or a dynamic object's guid
- if(uint64 guid = GetFarSight())
+ if(uint64 guid = GetFarSightGUID())
return (WorldObject*)ObjectAccessor::GetObjectByTypeMask(*this, guid, TYPEMASK_FARSIGHTOBJ);
return NULL;
}
-void Player::RemoveFarsightTarget()
+void Player::StopCastingBindSight()
{
if (WorldObject* target = GetFarsightTarget())
{
if (target->isType(TYPEMASK_PLAYER | TYPEMASK_UNIT))
- ((Unit*)target)->RemovePlayerFromVision(this);
+ ((Unit*)target)->RemoveSpellsCausingAura(SPELL_AURA_BIND_SIGHT);
}
- ClearFarsight();
}
void Player::ClearFarsight()
{
- if(GetFarSight())
+ if(GetFarSightGUID())
{
SetFarSightGUID(0);
WorldPacket data(SMSG_CLEAR_FAR_SIGHT_IMMEDIATE, 0);
@@ -19970,7 +19899,7 @@ void Player::SetFarsightTarget(WorldObject* obj)
return;
// Remove the current target if there is one
- RemoveFarsightTarget();
+ StopCastingBindSight();
SetFarSightGUID(obj->GetGUID());
}
diff --git a/src/game/Player.h b/src/game/Player.h
index bfc99bb1cd1..4dffb2be94f 100644
--- a/src/game/Player.h
+++ b/src/game/Player.h
@@ -2022,23 +2022,14 @@ class TRINITY_DLL_SPEC Player : public Unit
void EnterVehicle(Vehicle *vehicle);
void ExitVehicle(Vehicle *vehicle);
- //void SetViewport(uint64 guid, bool movable);
void SetMover(Unit* target) { m_mover = target ? target : this; }
- void RemovePossess(bool attack = true);
- void StopCharmOrPossess()
- {
- if(isPossessing())
- RemovePossess(true);
- else if(GetCharm())
- Uncharm();
- }
-
- uint64 GetFarSight() const { return GetUInt64Value(PLAYER_FARSIGHT); }
+ void StopCastingCharm() { Uncharm(); }
+ void StopCastingBindSight();
+ uint64 GetFarSightGUID() const { return GetUInt64Value(PLAYER_FARSIGHT); }
void SetFarSightGUID(uint64 guid) { SetUInt64Value(PLAYER_FARSIGHT, guid); }
void SetBindSight(Unit *target);
WorldObject* GetFarsightTarget() const;
void ClearFarsight();
- void RemoveFarsightTarget();
void SetFarsightTarget(WorldObject* target);
// Controls if vision is currently on farsight object, updated in FAR_SIGHT opcode
void SetFarsightVision(bool apply) { m_farsightVision = apply; }
diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp
index 15a31d670bb..13af2ecaa05 100644
--- a/src/game/Spell.cpp
+++ b/src/game/Spell.cpp
@@ -2071,7 +2071,7 @@ void Spell::prepare(SpellCastTargets const* targets, Aura* triggeredByAura)
}
}
-void Spell::cancel(bool report)
+void Spell::cancel()
{
if(m_spellState == SPELL_STATE_FINISHED)
return;
@@ -2101,7 +2101,7 @@ void Spell::cancel(bool report)
m_caster->RemoveAurasByCasterSpell(m_spellInfo->Id, m_caster->GetGUID());
SendChannelUpdate(0);
SendInterrupted(0);
- SendCastResult(report ? SPELL_FAILED_INTERRUPTED : SPELL_FAILED_DONT_REPORT);
+ SendCastResult(SPELL_FAILED_INTERRUPTED);
} break;
default:
@@ -5580,6 +5580,9 @@ bool SpellEvent::Execute(uint64 e_time, uint32 p_time)
// another non-melee non-delayed spell is casted now, abort
m_Spell->cancel();
}
+ // Check if target of channeled spell still in range
+ else if (m_Spell->CheckRange(false))
+ m_Spell->cancel();
else
{
// do the action (pass spell to channeling state)
diff --git a/src/game/Spell.h b/src/game/Spell.h
index 9f29d3bf8d7..beae2f97e04 100644
--- a/src/game/Spell.h
+++ b/src/game/Spell.h
@@ -357,7 +357,7 @@ class Spell
~Spell();
void prepare(SpellCastTargets const* targets, Aura* triggeredByAura = NULL);
- void cancel(bool report = true);
+ void cancel();
void update(uint32 difftime);
void cast(bool skipCheck = false);
void finish(bool ok = true);
diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp
index 45be199d32f..49c309c9502 100644
--- a/src/game/SpellAuras.cpp
+++ b/src/game/SpellAuras.cpp
@@ -2240,11 +2240,11 @@ void Aura::HandleAuraDummy(bool apply, bool Real)
{
Creature *totem = ObjectAccessor::GetCreature(*caster, guid);
if (totem && totem->isTotem())
- totem->AddPlayerToVision((Player*)caster);
+ ((Player*)caster)->CastSpell(totem, 6277, true);
}
}
else
- ((Player*)caster)->RemoveFarsightTarget();
+ ((Player*)caster)->StopCastingBindSight();
return;
}
break;
diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp
index ccb580f381e..0e72e541fe4 100644
--- a/src/game/SpellEffects.cpp
+++ b/src/game/SpellEffects.cpp
@@ -6296,8 +6296,8 @@ void Spell::EffectKnockBack(uint32 i)
float dy = unitTarget->GetPositionY() - y;
float dist = sqrt((dx*dx) + (dy*dy));
- float vsin = dx / dist;
- float vcos = dy / dist;
+ float vcos = dx / dist;
+ float vsin = dy / dist;
float speedxy = float(m_spellInfo->EffectMiscValue[i])/10;
float speedz = float(damage/-10);
diff --git a/src/game/TemporarySummon.cpp b/src/game/TemporarySummon.cpp
index 788fe4d2b7d..1214ed1bd84 100644
--- a/src/game/TemporarySummon.cpp
+++ b/src/game/TemporarySummon.cpp
@@ -172,10 +172,6 @@ void TemporarySummon::Summon(TempSummonType type, uint32 lifetime)
void TemporarySummon::UnSummon()
{
- RemoveCharmedOrPossessedBy(NULL);
-
- CombatStop();
-
CleanupsBeforeDelete();
AddObjectToRemoveList();
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index 74d474bf79e..b695afe7804 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -4142,8 +4142,7 @@ void Unit::RemoveAura(AuraMap::iterator &i, AuraRemoveMode mode)
&& AurSpellInfo->EffectApplyAuraName[Aur->GetEffIndex()]!= SPELL_AURA_DUMMY)
//don't stop channeling of scripted spells (this is actually a hack)
{
- caster->m_currentSpells[CURRENT_CHANNELED_SPELL]->cancel(false);
- channeled = true;
+ caster->m_currentSpells[CURRENT_CHANNELED_SPELL]->cancel();
}
}
}
@@ -4180,14 +4179,6 @@ void Unit::RemoveAura(AuraMap::iterator &i, AuraRemoveMode mode)
delete Aur;
- if(channeled)
- {
- //if target is not caster remove auras also on caster
- if (caster!=this)
- caster->RemoveAurasAtChanneledTarget (AurSpellInfo, caster);
- RemoveAurasAtChanneledTarget (AurSpellInfo, caster);
- }
-
if(statue)
statue->UnSummon();
@@ -7677,22 +7668,25 @@ void Unit::RemovePlayerFromVision(Player* plr)
plr->ClearFarsight();
}
-void Unit::RemoveAllFromVision()
+void Unit::RemoveBindSightAuras()
{
- while (!m_sharedVision.empty())
+ /*while (!m_sharedVision.empty())
{
Player* plr = *m_sharedVision.begin();
m_sharedVision.erase(m_sharedVision.begin());
plr->ClearFarsight();
- }
+ }*/
+ RemoveSpellsCausingAura(SPELL_AURA_BIND_SIGHT);
}
-void Unit::UncharmSelf()
+void Unit::RemoveCharmAuras()
{
if (!GetCharmer())
return;
RemoveSpellsCausingAura(SPELL_AURA_MOD_CHARM);
+ RemoveSpellsCausingAura(SPELL_AURA_MOD_POSSESS_PET);
+ RemoveSpellsCausingAura(SPELL_AURA_MOD_POSSESS);
}
void Unit::UnsummonAllTotems()
@@ -9756,10 +9750,6 @@ void Unit::setDeathState(DeathState s)
RemoveAllAurasOnDeath();
UnsummonAllTotems();
- // Possessed unit died, restore control to possessor
- RemoveCharmedOrPossessedBy(NULL);
- RemoveAllFromVision();
-
ModifyAuraState(AURA_STATE_HEALTHLESS_20_PERCENT, false);
ModifyAuraState(AURA_STATE_HEALTHLESS_35_PERCENT, false);
// remove aurastates allowing special moves
@@ -10716,15 +10706,13 @@ void Unit::CleanupsBeforeDelete()
{
if(m_uint32Values) // only for fully created object
{
- RemoveCharmedOrPossessedBy(NULL);
- RemoveAllFromVision();
+ RemoveAllAuras();
InterruptNonMeleeSpells(true);
m_Events.KillAllEvents(false); // non-delatable (currently casted spells) will not deleted now but it will deleted at call in Map::RemoveAllObjectsInRemoveList
CombatStop();
ClearComboPointHolders();
DeleteThreatList();
getHostilRefManager().setOnlineOfflineState(false);
- RemoveAllAuras();
RemoveAllGameObjects();
RemoveAllDynObjects();
GetMotionMaster()->Clear(false); // remove different non-standard movement generators.
@@ -12384,14 +12372,14 @@ void Unit::SetCharmedOrPossessedBy(Unit* charmer, bool possess)
// Charmer stop charming
if(charmer->GetTypeId() == TYPEID_PLAYER)
- ((Player*)charmer)->StopCharmOrPossess();
+ ((Player*)charmer)->StopCastingCharm();
// Charmed stop charming
if(GetTypeId() == TYPEID_PLAYER)
- ((Player*)this)->StopCharmOrPossess();
+ ((Player*)this)->StopCastingCharm();
// Charmed stop being charmed
- RemoveCharmedOrPossessedBy(NULL);
+ RemoveCharmAuras();
// Set charmed
charmer->SetCharm(this);
diff --git a/src/game/Unit.h b/src/game/Unit.h
index 1f51558f3ec..f24a0705128 100644
--- a/src/game/Unit.h
+++ b/src/game/Unit.h
@@ -1192,10 +1192,10 @@ class TRINITY_DLL_SPEC Unit : public WorldObject
CharmInfo* GetCharmInfo() { return m_charmInfo; }
CharmInfo* InitCharmInfo(Unit* charm);
SharedVisionList const& GetSharedVisionList() { return m_sharedVision; }
+ void RemoveBindSightAuras();
+ void RemoveCharmAuras();
void AddPlayerToVision(Player* plr);
void RemovePlayerFromVision(Player* plr);
- void RemoveAllFromVision();
- void UncharmSelf();
Pet* CreateTamedPetFrom(Creature* creatureTarget,uint32 spell_id = 0);
@@ -1481,10 +1481,6 @@ class TRINITY_DLL_SPEC Unit : public WorldObject
void SetUnitMovementFlags(uint32 f) { m_unit_movement_flags = f; }
void SetControlled(bool apply, UnitState state);
- void SetFeared(bool apply/*, uint64 casterGUID = 0, uint32 spellID = 0*/);
- void SetConfused(bool apply/*, uint64 casterGUID = 0, uint32 spellID = 0*/);
- void SetStunned(bool apply);
- void SetRooted(bool apply);
void AddComboPointHolder(uint32 lowguid) { m_ComboPointHolders.insert(lowguid); }
void RemoveComboPointHolder(uint32 lowguid) { m_ComboPointHolders.erase(lowguid); }
@@ -1591,6 +1587,11 @@ class TRINITY_DLL_SPEC Unit : public WorldObject
bool HandleOverrideClassScriptAuraProc(Unit *pVictim, uint32 damage, Aura* triggredByAura, SpellEntry const *procSpell, uint32 cooldown);
bool HandleMeandingAuraProc(Aura* triggeredByAura);
+ void SetFeared(bool apply);
+ void SetConfused(bool apply);
+ void SetStunned(bool apply);
+ void SetRooted(bool apply);
+
uint32 m_state; // Even derived shouldn't modify
uint32 m_CombatTimer;
uint32 m_lastManaUse; // msecs
diff --git a/src/game/WorldSession.cpp b/src/game/WorldSession.cpp
index 77a62646818..bfe9946e7d3 100644
--- a/src/game/WorldSession.cpp
+++ b/src/game/WorldSession.cpp
@@ -249,14 +249,6 @@ void WorldSession::LogoutPlayer(bool Save)
if (_player)
{
- // Unpossess the current possessed unit of player
- _player->StopCharmOrPossess();
-
- // Remove any possession of this player on logout
- _player->RemoveCharmedOrPossessedBy(NULL);
-
- //_player->DestroyForNearbyPlayers();
-
if (uint64 lguid = GetPlayer()->GetLootGUID())
DoLootRelease(lguid);