Core/Spells: Fixed overwriting summon requests
This commit is contained in:
1 parent
a3ca833d0d
commit
cd9acb7d05
6 files changed
+39
-52
No files matched your search
@@ -471,20 +471,11 @@ Player::Player(WorldSession* session): Unit(true)
|
||||
|
||||
// Player summoning
|
||||
m_summon_expire = 0;
|
||||
m_summon_mapid = 0;
|
||||
m_summon_x = 0.0f;
|
||||
m_summon_y = 0.0f;
|
||||
m_summon_z = 0.0f;
|
||||
|
||||
m_mover = this;
|
||||
m_movedPlayer = this;
|
||||
m_seer = this;
|
||||
|
||||
m_recallMap = 0;
|
||||
m_recallX = 0;
|
||||
m_recallY = 0;
|
||||
m_recallZ = 0;
|
||||
m_recallO = 0;
|
||||
|
||||
m_homebindMapId = 0;
|
||||
m_homebindAreaId = 0;
|
||||
@@ -6316,15 +6307,6 @@ bool Player::UpdatePosition(float x, float y, float z, float orientation, bool t
|
||||
return true;
|
||||
}
|
||||
|
||||
void Player::SaveRecallPosition()
|
||||
{
|
||||
m_recallMap = GetMapId();
|
||||
m_recallX = GetPositionX();
|
||||
m_recallY = GetPositionY();
|
||||
m_recallZ = GetPositionZ();
|
||||
m_recallO = GetOrientation();
|
||||
}
|
||||
|
||||
void Player::SendMessageToSetInRange(WorldPacket* data, float dist, bool self)
|
||||
{
|
||||
if (self)
|
||||
@@ -23787,13 +23769,32 @@ void Player::UpdateForQuestWorldObjects()
|
||||
GetSession()->SendPacket(&packet);
|
||||
}
|
||||
|
||||
void Player::SetSummonPoint(uint32 mapid, float x, float y, float z)
|
||||
bool Player::HasSummonPending() const
|
||||
{
|
||||
return m_summon_expire >= time(nullptr);
|
||||
}
|
||||
|
||||
void Player::SendSummonRequestFrom(Unit* summoner)
|
||||
{
|
||||
if (!summoner)
|
||||
return;
|
||||
|
||||
// Player already has active summon request
|
||||
if (HasSummonPending())
|
||||
return;
|
||||
|
||||
// Evil Twin (ignore player summon, but hide this for summoner)
|
||||
if (HasAura(23445))
|
||||
return;
|
||||
|
||||
m_summon_expire = time(nullptr) + MAX_PLAYER_SUMMON_DELAY;
|
||||
m_summon_mapid = mapid;
|
||||
m_summon_x = x;
|
||||
m_summon_y = y;
|
||||
m_summon_z = z;
|
||||
m_summon_location.WorldRelocate(*summoner);
|
||||
|
||||
WorldPacket data(SMSG_SUMMON_REQUEST, 8 + 4 + 4);
|
||||
data << uint64(summoner->GetGUID()); // summoner guid
|
||||
data << uint32(summoner->GetZoneId()); // summoner zone
|
||||
data << uint32(MAX_PLAYER_SUMMON_DELAY*IN_MILLISECONDS); // auto decline after msecs
|
||||
GetSession()->SendPacket(&data);
|
||||
}
|
||||
|
||||
void Player::SummonIfPossible(bool agree)
|
||||
@@ -23824,7 +23825,7 @@ void Player::SummonIfPossible(bool agree)
|
||||
|
||||
UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_ACCEPTED_SUMMONINGS, 1);
|
||||
|
||||
TeleportTo(m_summon_mapid, m_summon_x, m_summon_y, m_summon_z, GetOrientation());
|
||||
TeleportTo(m_summon_location);
|
||||
}
|
||||
|
||||
void Player::RemoveItemDurations(Item* item)
|
||||
|
||||
@@ -1230,7 +1230,8 @@ class Player : public Unit, public GridObject<Player>
|
||||
bool TeleportTo(WorldLocation const &loc, uint32 options = 0);
|
||||
bool TeleportToBGEntryPoint();
|
||||
|
||||
void SetSummonPoint(uint32 mapid, float x, float y, float z);
|
||||
bool HasSummonPending() const;
|
||||
void SendSummonRequestFrom(Unit* summoner);
|
||||
void SummonIfPossible(bool agree);
|
||||
|
||||
bool Create(ObjectGuid::LowType guidlow, CharacterCreateInfo* createInfo);
|
||||
@@ -2304,13 +2305,8 @@ class Player : public Unit, public GridObject<Player>
|
||||
uint32 GetSaveTimer() const { return m_nextSave; }
|
||||
void SetSaveTimer(uint32 timer) { m_nextSave = timer; }
|
||||
|
||||
// Recall position
|
||||
uint32 m_recallMap;
|
||||
float m_recallX;
|
||||
float m_recallY;
|
||||
float m_recallZ;
|
||||
float m_recallO;
|
||||
void SaveRecallPosition();
|
||||
void SaveRecallPosition() { m_recall_location.WorldRelocate(*this); }
|
||||
void Recall() { TeleportTo(m_recall_location); }
|
||||
|
||||
void SetHomebind(WorldLocation const& loc, uint32 areaId);
|
||||
|
||||
@@ -2771,10 +2767,10 @@ class Player : public Unit, public GridObject<Player>
|
||||
|
||||
// Player summoning
|
||||
time_t m_summon_expire;
|
||||
uint32 m_summon_mapid;
|
||||
float m_summon_x;
|
||||
float m_summon_y;
|
||||
float m_summon_z;
|
||||
WorldLocation m_summon_location;
|
||||
|
||||
// Recall position
|
||||
WorldLocation m_recall_location;
|
||||
|
||||
DeclinedName *m_declinedname;
|
||||
Runes *m_runes;
|
||||
|
||||
@@ -1063,7 +1063,7 @@ enum TrinityStrings
|
||||
LANG_COMMAND_NO_FROZEN_PLAYERS = 5004,
|
||||
LANG_COMMAND_LIST_FREEZE = 5005,
|
||||
LANG_COMMAND_PERMA_FROZEN_PLAYER = 5006,
|
||||
LANG_INSTANCE_RAID_GROUP_ONLY = 5007,
|
||||
// = 5007, unused
|
||||
LANG_INSTANCE_CLOSED = 5008,
|
||||
LANG_COMMAND_PLAYED_TO_ALL = 5009,
|
||||
LANG_NPCINFO_LINKGUID = 5010,
|
||||
|
||||
@@ -5395,6 +5395,9 @@ SpellCastResult Spell::CheckCast(bool strict)
|
||||
if (!target || m_caster->ToPlayer() == target || (!target->IsInSameRaidWith(m_caster->ToPlayer()) && m_spellInfo->Id != 48955)) // refer-a-friend spell
|
||||
return SPELL_FAILED_BAD_TARGETS;
|
||||
|
||||
if (target->HasSummonPending())
|
||||
return SPELL_FAILED_SUMMON_PENDING;
|
||||
|
||||
// check if our map is dungeon
|
||||
MapEntry const* map = sMapStore.LookupEntry(m_caster->GetMapId());
|
||||
if (map->IsDungeon())
|
||||
|
||||
@@ -3925,20 +3925,7 @@ void Spell::EffectSummonPlayer(SpellEffIndex /*effIndex*/)
|
||||
if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER)
|
||||
return;
|
||||
|
||||
// Evil Twin (ignore player summon, but hide this for summoner)
|
||||
if (unitTarget->HasAura(23445))
|
||||
return;
|
||||
|
||||
float x, y, z;
|
||||
m_caster->GetPosition(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_MILLISECONDS); // auto decline after msecs
|
||||
unitTarget->ToPlayer()->GetSession()->SendPacket(&data);
|
||||
unitTarget->ToPlayer()->SendSummonRequestFrom(m_caster);
|
||||
}
|
||||
|
||||
void Spell::EffectActivateObject(SpellEffIndex /*effIndex*/)
|
||||
|
||||
@@ -811,7 +811,7 @@ public:
|
||||
target->CleanupAfterTaxiFlight();
|
||||
}
|
||||
|
||||
target->TeleportTo(target->m_recallMap, target->m_recallX, target->m_recallY, target->m_recallZ, target->m_recallO);
|
||||
target->Recall();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user