mirror of
https://github.com/mangosfour/server.git
synced 2025-12-21 10:37:06 +00:00
[10627] Use ObjectGuid for player's selection and unit's target
This commit is contained in:
parent
e74d56f9d2
commit
c955941b55
21 changed files with 66 additions and 73 deletions
|
|
@ -1955,7 +1955,7 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList&
|
|||
{
|
||||
// checked in Spell::CheckCast
|
||||
if (m_caster->GetTypeId()==TYPEID_PLAYER)
|
||||
if (Unit* target = m_caster->GetMap()->GetPet(((Player*)m_caster)->GetSelection()))
|
||||
if (Unit* target = m_caster->GetMap()->GetPet(((Player*)m_caster)->GetSelectionGuid()))
|
||||
targetUnitMap.push_back(target);
|
||||
}
|
||||
// Circle of Healing
|
||||
|
|
@ -2314,7 +2314,7 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList&
|
|||
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, ((Player*)m_caster)->GetSelectionGuid());
|
||||
|
||||
if(pTarget)
|
||||
{
|
||||
|
|
@ -2486,12 +2486,9 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList&
|
|||
targetUnitMap.push_back(m_caster);
|
||||
break;
|
||||
case SPELL_EFFECT_SUMMON_PLAYER:
|
||||
if (m_caster->GetTypeId()==TYPEID_PLAYER && ((Player*)m_caster)->GetSelection())
|
||||
{
|
||||
Player* target = sObjectMgr.GetPlayer(((Player*)m_caster)->GetSelection());
|
||||
if(target)
|
||||
if (m_caster->GetTypeId()==TYPEID_PLAYER && !((Player*)m_caster)->GetSelectionGuid().IsEmpty())
|
||||
if (Player* target = sObjectMgr.GetPlayer(((Player*)m_caster)->GetSelectionGuid()))
|
||||
targetUnitMap.push_back(target);
|
||||
}
|
||||
break;
|
||||
case SPELL_EFFECT_RESURRECT_NEW:
|
||||
if (m_targets.getUnitTarget())
|
||||
|
|
@ -4370,7 +4367,7 @@ SpellCastResult Spell::CheckCast(bool strict)
|
|||
if (m_targets.m_targetMask == TARGET_FLAG_SELF &&
|
||||
m_spellInfo->EffectImplicitTargetA[EFFECT_INDEX_1] == TARGET_CHAIN_DAMAGE)
|
||||
{
|
||||
if (target = m_caster->GetMap()->GetUnit(((Player *)m_caster)->GetSelection()))
|
||||
if (target = m_caster->GetMap()->GetUnit(((Player *)m_caster)->GetSelectionGuid()))
|
||||
m_targets.setUnitTarget(target);
|
||||
else
|
||||
return SPELL_FAILED_BAD_TARGETS;
|
||||
|
|
@ -4752,9 +4749,9 @@ SpellCastResult Spell::CheckCast(bool strict)
|
|||
if (m_caster->GetTypeId() != TYPEID_PLAYER)
|
||||
return SPELL_FAILED_ERROR;
|
||||
|
||||
if (!((Player*)m_caster)->GetSelection())
|
||||
if (((Player*)m_caster)->GetSelectionGuid().IsEmpty())
|
||||
return SPELL_FAILED_BAD_IMPLICIT_TARGETS;
|
||||
Pet* target = m_caster->GetMap()->GetPet(((Player*)m_caster)->GetSelection());
|
||||
Pet* target = m_caster->GetMap()->GetPet(((Player*)m_caster)->GetSelectionGuid());
|
||||
|
||||
// alive
|
||||
if (!target || target->isDead())
|
||||
|
|
@ -5086,10 +5083,10 @@ SpellCastResult Spell::CheckCast(bool strict)
|
|||
{
|
||||
if(m_caster->GetTypeId() != TYPEID_PLAYER)
|
||||
return SPELL_FAILED_BAD_TARGETS;
|
||||
if(!((Player*)m_caster)->GetSelection())
|
||||
if(((Player*)m_caster)->GetSelectionGuid().IsEmpty())
|
||||
return SPELL_FAILED_BAD_TARGETS;
|
||||
|
||||
Player* target = sObjectMgr.GetPlayer(((Player*)m_caster)->GetSelection());
|
||||
Player* target = sObjectMgr.GetPlayer(((Player*)m_caster)->GetSelectionGuid());
|
||||
if( !target || ((Player*)m_caster) == target || !target->IsInSameRaidWith((Player*)m_caster) )
|
||||
return SPELL_FAILED_BAD_TARGETS;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue