mirror of
https://github.com/mangosfour/server.git
synced 2025-12-15 01:37:00 +00:00
[10080] Fixed ghost teleport and cleanup code.
This commit is contained in:
parent
6bfd0aa5b5
commit
e63dc32f4d
4 changed files with 28 additions and 27 deletions
|
|
@ -480,6 +480,7 @@ Player::Player (WorldSession *session): Unit(), m_achievementMgr(this), m_reputa
|
|||
m_DelayedOperations = 0;
|
||||
m_bCanDelayTeleport = false;
|
||||
m_bHasDelayedTeleport = false;
|
||||
m_bHasBeenAliveAtDelayedTeleport = true; // overwrite always at setup teleport data, so not used infact
|
||||
m_teleport_options = 0;
|
||||
|
||||
m_trade = NULL;
|
||||
|
|
@ -1474,9 +1475,7 @@ void Player::Update( uint32 p_time )
|
|||
RemovePet(pet, PET_SAVE_NOT_IN_SLOT, true);
|
||||
}
|
||||
|
||||
//we should execute delayed teleports only for alive(!) players
|
||||
//because we don't want player's ghost teleported from graveyard
|
||||
if(IsHasDelayedTeleport() && isAlive())
|
||||
if (IsHasDelayedTeleport())
|
||||
TeleportTo(m_teleport_dest, m_teleport_options);
|
||||
}
|
||||
|
||||
|
|
@ -1775,10 +1774,9 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati
|
|||
//lets reset far teleport flag if it wasn't reset during chained teleports
|
||||
SetSemaphoreTeleportFar(false);
|
||||
//setup delayed teleport flag
|
||||
SetDelayedTeleportFlag(IsCanDelayTeleport());
|
||||
//if teleport spell is casted in Unit::Update() func
|
||||
//then we need to delay it until update process will be finished
|
||||
if(IsHasDelayedTeleport())
|
||||
if (SetDelayedTeleportFlagIfCan())
|
||||
{
|
||||
SetSemaphoreTeleportNear(true);
|
||||
//lets save teleport destination for player
|
||||
|
|
@ -1794,7 +1792,7 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati
|
|||
UnsummonPetTemporaryIfAny();
|
||||
}
|
||||
|
||||
if(!(options & TELE_TO_NOT_LEAVE_COMBAT))
|
||||
if (!(options & TELE_TO_NOT_LEAVE_COMBAT))
|
||||
CombatStop();
|
||||
|
||||
// this will be used instead of the current location in SaveToDB
|
||||
|
|
@ -1831,10 +1829,9 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati
|
|||
//lets reset near teleport flag if it wasn't reset during chained teleports
|
||||
SetSemaphoreTeleportNear(false);
|
||||
//setup delayed teleport flag
|
||||
SetDelayedTeleportFlag(IsCanDelayTeleport());
|
||||
//if teleport spell is casted in Unit::Update() func
|
||||
//then we need to delay it until update process will be finished
|
||||
if(IsHasDelayedTeleport())
|
||||
if (SetDelayedTeleportFlagIfCan())
|
||||
{
|
||||
SetSemaphoreTeleportFar(true);
|
||||
//lets save teleport destination for player
|
||||
|
|
@ -1850,7 +1847,7 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati
|
|||
ResetContestedPvP();
|
||||
|
||||
// remove player from battleground on far teleport (when changing maps)
|
||||
if(BattleGround const* bg = GetBattleGround())
|
||||
if (BattleGround const* bg = GetBattleGround())
|
||||
{
|
||||
// Note: at battleground join battleground id set before teleport
|
||||
// and we already will found "current" battleground
|
||||
|
|
@ -1868,14 +1865,14 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati
|
|||
|
||||
// stop spellcasting
|
||||
// not attempt interrupt teleportation spell at caster teleport
|
||||
if(!(options & TELE_TO_SPELL))
|
||||
if(IsNonMeleeSpellCasted(true))
|
||||
if (!(options & TELE_TO_SPELL))
|
||||
if (IsNonMeleeSpellCasted(true))
|
||||
InterruptNonMeleeSpells(true);
|
||||
|
||||
//remove auras before removing from map...
|
||||
RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_CHANGE_MAP | AURA_INTERRUPT_FLAG_MOVE | AURA_INTERRUPT_FLAG_TURNING);
|
||||
|
||||
if(!GetSession()->PlayerLogout())
|
||||
if (!GetSession()->PlayerLogout())
|
||||
{
|
||||
// send transfer packets
|
||||
WorldPacket data(SMSG_TRANSFER_PENDING, (4+4+4));
|
||||
|
|
@ -1909,7 +1906,7 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati
|
|||
}
|
||||
|
||||
// remove from old map now
|
||||
if(oldmap)
|
||||
if (oldmap)
|
||||
oldmap->Remove(this, false);
|
||||
|
||||
// new final coordinates
|
||||
|
|
@ -1918,7 +1915,7 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati
|
|||
float final_z = z;
|
||||
float final_o = orientation;
|
||||
|
||||
if(m_transport)
|
||||
if (m_transport)
|
||||
{
|
||||
final_x += m_movementInfo.GetTransportPos()->x;
|
||||
final_y += m_movementInfo.GetTransportPos()->y;
|
||||
|
|
@ -13538,10 +13535,6 @@ void Player::IncompleteQuest( uint32 quest_id )
|
|||
|
||||
void Player::RewardQuest( Quest const *pQuest, uint32 reward, Object* questGiver, bool announce )
|
||||
{
|
||||
//this THING should be here to protect code from quest, which cast on player far teleport as a reward
|
||||
//should work fine, cause far teleport will be executed in Player::Update()
|
||||
SetCanDelayTeleport(true);
|
||||
|
||||
uint32 quest_id = pQuest->GetQuestId();
|
||||
|
||||
for (int i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; ++i )
|
||||
|
|
@ -13693,9 +13686,6 @@ void Player::RewardQuest( Quest const *pQuest, uint32 reward, Object* questGiver
|
|||
if (!HasAura(itr->second->spellId, EFFECT_INDEX_0))
|
||||
CastSpell(this,itr->second->spellId,true);
|
||||
}
|
||||
|
||||
//lets remove flag for delayed teleports
|
||||
SetCanDelayTeleport(false);
|
||||
}
|
||||
|
||||
void Player::FailQuest(uint32 questId)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue