mirror of
https://github.com/mangosfour/server.git
synced 2025-12-21 10:37:06 +00:00
[10671] Convert some Unit owner/etc guids to ObjectGuid way.
This commit is contained in:
parent
92d98b9fb2
commit
a32d68febd
18 changed files with 154 additions and 149 deletions
|
|
@ -1152,7 +1152,7 @@ void Spell::DoSpellHitOnUnit(Unit *unit, const uint32 effectMask)
|
|||
// Recheck UNIT_FLAG_NON_ATTACKABLE for delayed spells
|
||||
if (m_spellInfo->speed > 0.0f &&
|
||||
unit->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE) &&
|
||||
unit->GetCharmerOrOwnerGUID() != m_caster->GetGUID())
|
||||
unit->GetCharmerOrOwnerGuid() != m_caster->GetObjectGuid())
|
||||
{
|
||||
realCaster->SendSpellMiss(unit, m_spellInfo->Id, SPELL_MISS_EVADE);
|
||||
ResetEffectDamageAndHeal();
|
||||
|
|
@ -2026,7 +2026,7 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList&
|
|||
{
|
||||
if( targetOwner->GetTypeId() == TYPEID_PLAYER &&
|
||||
target->GetTypeId() == TYPEID_UNIT && (((Creature*)target)->IsPet()) &&
|
||||
target->GetOwnerGUID() == targetOwner->GetGUID() &&
|
||||
target->GetOwnerGuid() == targetOwner->GetObjectGuid() &&
|
||||
pGroup->IsMember(((Player*)targetOwner)->GetObjectGuid()))
|
||||
{
|
||||
targetUnitMap.push_back(target);
|
||||
|
|
@ -4473,7 +4473,7 @@ SpellCastResult Spell::CheckCast(bool strict)
|
|||
}
|
||||
// TODO: this check can be applied and for player to prevent cheating when IsPositiveSpell will return always correct result.
|
||||
// check target for pet/charmed casts (not self targeted), self targeted cast used for area effects and etc
|
||||
if (!explicit_target_mode && m_caster->GetTypeId() == TYPEID_UNIT && m_caster->GetCharmerOrOwnerGUID())
|
||||
if (!explicit_target_mode && m_caster->GetTypeId() == TYPEID_UNIT && !m_caster->GetCharmerOrOwnerGuid().IsEmpty())
|
||||
{
|
||||
// check correctness positive/negative cast target (pet cast real check and cheating check)
|
||||
if(IsPositiveSpell(m_spellInfo->Id))
|
||||
|
|
@ -4768,7 +4768,7 @@ SpellCastResult Spell::CheckCast(bool strict)
|
|||
if (target->GetCreatureType() != CREATURE_TYPE_UNDEAD)
|
||||
return SPELL_FAILED_BAD_IMPLICIT_TARGETS;
|
||||
// owned
|
||||
if (target->GetOwnerGUID() != m_caster->GetGUID())
|
||||
if (target->GetOwnerGuid() != m_caster->GetObjectGuid())
|
||||
return SPELL_FAILED_BAD_IMPLICIT_TARGETS;
|
||||
|
||||
float dist = GetSpellRadius(sSpellRadiusStore.LookupEntry(m_spellInfo->EffectRadiusIndex[i]));
|
||||
|
|
@ -4862,7 +4862,7 @@ SpellCastResult Spell::CheckCast(bool strict)
|
|||
return SPELL_FAILED_DONT_REPORT;
|
||||
}
|
||||
|
||||
if(plrCaster->GetPetGUID() || plrCaster->GetCharmGUID())
|
||||
if (!plrCaster->GetPetGuid().IsEmpty() || !plrCaster->GetCharmGuid().IsEmpty())
|
||||
{
|
||||
plrCaster->SendPetTameFailure(PETTAME_ANOTHERSUMMONACTIVE);
|
||||
return SPELL_FAILED_DONT_REPORT;
|
||||
|
|
@ -5066,10 +5066,10 @@ SpellCastResult Spell::CheckCast(bool strict)
|
|||
{
|
||||
if(summon_prop->Group == SUMMON_PROP_GROUP_PETS)
|
||||
{
|
||||
if(m_caster->GetPetGUID())
|
||||
if (!m_caster->GetPetGuid().IsEmpty())
|
||||
return SPELL_FAILED_ALREADY_HAVE_SUMMON;
|
||||
|
||||
if(m_caster->GetCharmGUID())
|
||||
if (!m_caster->GetCharmGuid().IsEmpty())
|
||||
return SPELL_FAILED_ALREADY_HAVE_CHARM;
|
||||
}
|
||||
}
|
||||
|
|
@ -5078,7 +5078,7 @@ SpellCastResult Spell::CheckCast(bool strict)
|
|||
}
|
||||
case SPELL_EFFECT_SUMMON_PET:
|
||||
{
|
||||
if(m_caster->GetPetGUID()) //let warlock do a replacement summon
|
||||
if (!m_caster->GetPetGuid().IsEmpty()) //let warlock do a replacement summon
|
||||
{
|
||||
|
||||
Pet* pet = ((Player*)m_caster)->GetPet();
|
||||
|
|
@ -5092,7 +5092,7 @@ SpellCastResult Spell::CheckCast(bool strict)
|
|||
return SPELL_FAILED_ALREADY_HAVE_SUMMON;
|
||||
}
|
||||
|
||||
if(m_caster->GetCharmGUID())
|
||||
if (!m_caster->GetCharmGuid().IsEmpty())
|
||||
return SPELL_FAILED_ALREADY_HAVE_CHARM;
|
||||
|
||||
break;
|
||||
|
|
@ -5174,73 +5174,73 @@ SpellCastResult Spell::CheckCast(bool strict)
|
|||
}
|
||||
case SPELL_AURA_MOD_POSSESS:
|
||||
{
|
||||
if(m_caster->GetTypeId() != TYPEID_PLAYER)
|
||||
if (m_caster->GetTypeId() != TYPEID_PLAYER)
|
||||
return SPELL_FAILED_UNKNOWN;
|
||||
|
||||
if(m_targets.getUnitTarget() == m_caster)
|
||||
if (m_targets.getUnitTarget() == m_caster)
|
||||
return SPELL_FAILED_BAD_TARGETS;
|
||||
|
||||
if(m_caster->GetPetGUID())
|
||||
if (!m_caster->GetPetGuid().IsEmpty())
|
||||
return SPELL_FAILED_ALREADY_HAVE_SUMMON;
|
||||
|
||||
if(m_caster->GetCharmGUID())
|
||||
if (!m_caster->GetCharmGuid().IsEmpty())
|
||||
return SPELL_FAILED_ALREADY_HAVE_CHARM;
|
||||
|
||||
if(m_caster->GetCharmerGUID())
|
||||
if (!m_caster->GetCharmerGuid().IsEmpty())
|
||||
return SPELL_FAILED_CHARMED;
|
||||
|
||||
if(!m_targets.getUnitTarget())
|
||||
if (!m_targets.getUnitTarget())
|
||||
return SPELL_FAILED_BAD_IMPLICIT_TARGETS;
|
||||
|
||||
if(m_targets.getUnitTarget()->GetCharmerGUID())
|
||||
if (!m_targets.getUnitTarget()->GetCharmerGuid().IsEmpty())
|
||||
return SPELL_FAILED_CHARMED;
|
||||
|
||||
if(int32(m_targets.getUnitTarget()->getLevel()) > CalculateDamage(SpellEffectIndex(i),m_targets.getUnitTarget()))
|
||||
if (int32(m_targets.getUnitTarget()->getLevel()) > CalculateDamage(SpellEffectIndex(i),m_targets.getUnitTarget()))
|
||||
return SPELL_FAILED_HIGHLEVEL;
|
||||
|
||||
break;
|
||||
}
|
||||
case SPELL_AURA_MOD_CHARM:
|
||||
{
|
||||
if(m_targets.getUnitTarget() == m_caster)
|
||||
if (m_targets.getUnitTarget() == m_caster)
|
||||
return SPELL_FAILED_BAD_TARGETS;
|
||||
|
||||
if(m_caster->GetPetGUID())
|
||||
if (!m_caster->GetPetGuid().IsEmpty())
|
||||
return SPELL_FAILED_ALREADY_HAVE_SUMMON;
|
||||
|
||||
if(m_caster->GetCharmGUID())
|
||||
if (!m_caster->GetCharmGuid().IsEmpty())
|
||||
return SPELL_FAILED_ALREADY_HAVE_CHARM;
|
||||
|
||||
if(m_caster->GetCharmerGUID())
|
||||
if (!m_caster->GetCharmerGuid().IsEmpty())
|
||||
return SPELL_FAILED_CHARMED;
|
||||
|
||||
if(!m_targets.getUnitTarget())
|
||||
if (!m_targets.getUnitTarget())
|
||||
return SPELL_FAILED_BAD_IMPLICIT_TARGETS;
|
||||
|
||||
if(m_targets.getUnitTarget()->GetCharmerGUID())
|
||||
if (!m_targets.getUnitTarget()->GetCharmerGuid().IsEmpty())
|
||||
return SPELL_FAILED_CHARMED;
|
||||
|
||||
if(int32(m_targets.getUnitTarget()->getLevel()) > CalculateDamage(SpellEffectIndex(i),m_targets.getUnitTarget()))
|
||||
if (int32(m_targets.getUnitTarget()->getLevel()) > CalculateDamage(SpellEffectIndex(i),m_targets.getUnitTarget()))
|
||||
return SPELL_FAILED_HIGHLEVEL;
|
||||
|
||||
break;
|
||||
}
|
||||
case SPELL_AURA_MOD_POSSESS_PET:
|
||||
{
|
||||
if(m_caster->GetTypeId() != TYPEID_PLAYER)
|
||||
if (m_caster->GetTypeId() != TYPEID_PLAYER)
|
||||
return SPELL_FAILED_UNKNOWN;
|
||||
|
||||
if(m_caster->GetCharmGUID())
|
||||
if (!m_caster->GetCharmGuid().IsEmpty())
|
||||
return SPELL_FAILED_ALREADY_HAVE_CHARM;
|
||||
|
||||
if(m_caster->GetCharmerGUID())
|
||||
if (!m_caster->GetCharmerGuid().IsEmpty())
|
||||
return SPELL_FAILED_CHARMED;
|
||||
|
||||
Pet* pet = m_caster->GetPet();
|
||||
if(!pet)
|
||||
if (!pet)
|
||||
return SPELL_FAILED_NO_PET;
|
||||
|
||||
if(pet->GetCharmerGUID())
|
||||
if (!pet->GetCharmerGuid().IsEmpty())
|
||||
return SPELL_FAILED_CHARMED;
|
||||
|
||||
break;
|
||||
|
|
@ -6332,7 +6332,7 @@ bool Spell::CheckTarget( Unit* target, SpellEffectIndex eff )
|
|||
|
||||
// Check targets for not_selectable unit flag and remove
|
||||
// A player can cast spells on his pet (or other controlled unit) though in any state
|
||||
if (target != m_caster && target->GetCharmerOrOwnerGUID() != m_caster->GetGUID())
|
||||
if (target != m_caster && target->GetCharmerOrOwnerGuid() != m_caster->GetObjectGuid())
|
||||
{
|
||||
// any unattackable target skipped
|
||||
if (target->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue