mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-22 05:06:24 +00:00
Fix refer a friend Summon
This commit is contained in:
@@ -1136,6 +1136,26 @@ void WorldSession::HandlePlayerLoginFromDB(LoginQueryHolder* holder)
|
||||
// Load pet if any (if player not alive and in taxi flight or another then pet will remember as temporary unsummoned)
|
||||
pCurrChar->LoadPet();
|
||||
|
||||
if (pCurrChar->GetSession()->GetRecruiterId() != 0 || pCurrChar->GetSession()->IsARecruiter())
|
||||
{
|
||||
bool isReferrer = pCurrChar->GetSession()->IsARecruiter();
|
||||
|
||||
for (SessionMap::const_iterator itr = sWorld->GetAllSessions().begin(); itr != sWorld->GetAllSessions().end(); ++itr)
|
||||
{
|
||||
if (!itr->second->GetRecruiterId() && !itr->second->IsARecruiter())
|
||||
continue;
|
||||
if (isReferrer && pCurrChar->GetSession()->GetAccountId() == itr->second->GetRecruiterId() || !isReferrer && pCurrChar->GetSession()->GetRecruiterId() == itr->second->GetAccountId())
|
||||
{
|
||||
Player * rf = itr->second->GetPlayer();
|
||||
if (rf != NULL)
|
||||
{
|
||||
pCurrChar->SendUpdateToPlayer(rf);
|
||||
rf->SendUpdateToPlayer(pCurrChar);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sScriptMgr->OnPlayerLogin(pCurrChar);
|
||||
delete holder;
|
||||
}
|
||||
|
||||
@@ -2286,7 +2286,7 @@ void Spell::DoAllEffectOnTarget(TargetInfo* target)
|
||||
uint8 mask = target->effectMask;
|
||||
|
||||
Unit* effectUnit = m_caster->GetGUID() == target->targetGUID ? m_caster : ObjectAccessor::GetUnit(*m_caster, target->targetGUID);
|
||||
if (!effectUnit)
|
||||
if (!effectUnit || m_spellInfo->Id == 45927)
|
||||
{
|
||||
uint8 farMask = 0;
|
||||
// create far target mask
|
||||
@@ -5745,7 +5745,7 @@ SpellCastResult Spell::CheckCast(bool strict)
|
||||
if (!(playerCaster->GetTarget()))
|
||||
return SPELL_FAILED_BAD_TARGETS;
|
||||
|
||||
Player* target = playerCaster->GetSelectedPlayer();
|
||||
Player* target = ObjectAccessor::FindPlayer(m_caster->ToPlayer()->GetTarget());
|
||||
|
||||
if (!target ||
|
||||
!(target->GetSession()->GetRecruiterId() == playerCaster->GetSession()->GetAccountId() || target->GetSession()->GetAccountId() == playerCaster->GetSession()->GetRecruiterId()))
|
||||
@@ -7160,6 +7160,18 @@ bool Spell::CheckEffectTarget(Unit const* target, uint32 eff) const
|
||||
if (MMAP::MMapFactory::IsPathfindingEnabled(m_caster->FindMap()))
|
||||
break;*/
|
||||
// else no break intended
|
||||
|
||||
case SPELL_EFFECT_SUMMON_RAF_FRIEND:
|
||||
if (m_caster->GetTypeId() != TYPEID_PLAYER || target->GetTypeId() != TYPEID_PLAYER)
|
||||
return false;
|
||||
if (m_caster->ToPlayer()->GetSession()->IsARecruiter() && target->ToPlayer()->GetSession()->GetRecruiterId() != m_caster->ToPlayer()->GetSession()->GetAccountId())
|
||||
return false;
|
||||
if (m_caster->ToPlayer()->GetSession()->GetRecruiterId() != target->ToPlayer()->GetSession()->GetAccountId() && target->ToPlayer()->GetSession()->IsARecruiter())
|
||||
return false;
|
||||
if (target->ToPlayer()->getLevel() >= sWorld->getIntConfig(CONFIG_MAX_RECRUIT_A_FRIEND_BONUS_PLAYER_LEVEL))
|
||||
return false;
|
||||
break;
|
||||
|
||||
default: // normal case
|
||||
// Get GO cast coordinates if original caster -> GO
|
||||
WorldObject* caster = NULL;
|
||||
|
||||
@@ -6175,6 +6175,12 @@ void Spell::EffectSummonRaFFriend(SpellEffIndex effIndex)
|
||||
if (m_caster->GetTypeId() != TYPEID_PLAYER || !unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER)
|
||||
return;
|
||||
|
||||
// Xinef: Unit Target can be on other map, thank god we dont use RaF...
|
||||
m_caster->CastSpell(unitTarget, m_spellInfo->Effects[effIndex].TriggerSpell, true);
|
||||
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());
|
||||
data << uint32(m_caster->GetZoneId());
|
||||
data << uint32(MAX_PLAYER_SUMMON_DELAY*IN_MILLISECONDS); // auto decline after msecs
|
||||
unitTarget->ToPlayer()->GetSession()->SendPacket(&data);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user