feat(Core/Misc): implement ObjectGuid class (port from TC) (#4885)

This commit is contained in:
UltraNix
2021-04-25 22:18:03 +02:00
committed by GitHub
parent 91081f4ad8
commit f4c226423d
568 changed files with 10655 additions and 11019 deletions

View File

@@ -387,7 +387,7 @@ AuraEffect::AuraEffect(Aura* base, uint8 effIndex, int32* baseAmount, Unit* cast
// Xinef: channel data structure
if (caster)
if (Spell* spell = caster->GetCurrentSpell(CURRENT_CHANNELED_SPELL))
m_channelData = new ChannelTargetData(caster->GetUInt64Value(UNIT_FIELD_CHANNEL_OBJECT), spell->m_targets.HasDst() ? spell->m_targets.GetDst() : nullptr);
m_channelData = new ChannelTargetData(caster->GetGuidValue(UNIT_FIELD_CHANNEL_OBJECT), spell->m_targets.HasDst() ? spell->m_targets.GetDst() : nullptr);
}
AuraEffect::~AuraEffect()
@@ -445,7 +445,7 @@ int32 AuraEffect::CalculateAmount(Unit* caster)
// check item enchant aura cast
if (!amount && caster)
if (uint64 itemGUID = GetBase()->GetCastItemGUID())
if (ObjectGuid itemGUID = GetBase()->GetCastItemGUID())
if (Player* playerCaster = caster->ToPlayer())
if (Item* castItem = playerCaster->GetItemByGuid(itemGUID))
if (castItem->GetItemSuffixFactor())
@@ -807,7 +807,7 @@ void AuraEffect::ApplySpellMod(Unit* target, bool apply)
case SPELLMOD_EFFECT2:
case SPELLMOD_EFFECT3:
{
uint64 guid = target->GetGUID();
ObjectGuid guid = target->GetGUID();
Unit::AuraApplicationMap& auras = target->GetAppliedAuras();
for (Unit::AuraApplicationMap::iterator iter = auras.begin(); iter != auras.end(); ++iter)
{
@@ -846,7 +846,7 @@ void AuraEffect::ApplySpellMod(Unit* target, bool apply)
if (!pet)
break;
uint64 petguid = pet->GetGUID();
ObjectGuid petguid = pet->GetGUID();
Unit::AuraApplicationMap& petauras = pet->GetAppliedAuras();
for (Unit::AuraApplicationMap::iterator iter = petauras.begin(); iter != petauras.end(); ++iter)
{
@@ -1509,7 +1509,7 @@ void AuraEffect::HandleModInvisibilityDetect(AuraApplication const* aurApp, uint
}
// call functions which may have additional effects after chainging state of unit
target->UpdateObjectVisibility(target->GetTypeId() == TYPEID_PLAYER || IS_PLAYER_GUID(target->GetOwnerGUID()));
target->UpdateObjectVisibility(target->GetTypeId() == TYPEID_PLAYER || target->GetOwnerGUID().IsPlayer());
}
void AuraEffect::HandleModInvisibility(AuraApplication const* aurApp, uint8 mode, bool apply) const
@@ -1568,11 +1568,11 @@ void AuraEffect::HandleModInvisibility(AuraApplication const* aurApp, uint8 mode
if (!apply && aurApp->GetRemoveMode() == AURA_REMOVE_BY_DEFAULT)
{
target->UpdateObjectVisibility(target->GetTypeId() == TYPEID_PLAYER || IS_PLAYER_GUID(target->GetOwnerGUID() || target->GetMap()->Instanceable()), true);
target->UpdateObjectVisibility(target->GetTypeId() == TYPEID_PLAYER || target->GetOwnerGUID().IsPlayer() || target->GetMap()->Instanceable(), true);
target->bRequestForcedVisibilityUpdate = false;
}
else
target->UpdateObjectVisibility(target->GetTypeId() == TYPEID_PLAYER || IS_PLAYER_GUID(target->GetOwnerGUID()) || target->GetMap()->Instanceable());
target->UpdateObjectVisibility(target->GetTypeId() == TYPEID_PLAYER || target->GetOwnerGUID().IsPlayer() || target->GetMap()->Instanceable());
}
void AuraEffect::HandleModStealthDetect(AuraApplication const* aurApp, uint8 mode, bool apply) const
@@ -1597,7 +1597,7 @@ void AuraEffect::HandleModStealthDetect(AuraApplication const* aurApp, uint8 mod
}
// call functions which may have additional effects after chainging state of unit
target->UpdateObjectVisibility(target->GetTypeId() == TYPEID_PLAYER || IS_PLAYER_GUID(target->GetOwnerGUID()));
target->UpdateObjectVisibility(target->GetTypeId() == TYPEID_PLAYER || target->GetOwnerGUID().IsPlayer());
}
void AuraEffect::HandleModStealth(AuraApplication const* aurApp, uint8 mode, bool apply) const
@@ -1647,11 +1647,11 @@ void AuraEffect::HandleModStealth(AuraApplication const* aurApp, uint8 mode, boo
if (!apply && aurApp->GetRemoveMode() == AURA_REMOVE_BY_DEFAULT)
{
target->UpdateObjectVisibility(target->GetTypeId() == TYPEID_PLAYER || IS_PLAYER_GUID(target->GetOwnerGUID() || target->GetMap()->Instanceable()), true);
target->UpdateObjectVisibility((target->GetTypeId() == TYPEID_PLAYER || target->GetOwnerGUID().IsPlayer() || target->GetMap()->Instanceable()), true);
target->bRequestForcedVisibilityUpdate = false;
}
else
target->UpdateObjectVisibility(target->GetTypeId() == TYPEID_PLAYER || IS_PLAYER_GUID(target->GetOwnerGUID() || target->GetMap()->Instanceable()));
target->UpdateObjectVisibility(target->GetTypeId() == TYPEID_PLAYER || target->GetOwnerGUID().IsPlayer() || target->GetMap()->Instanceable());
}
void AuraEffect::HandleModStealthLevel(AuraApplication const* aurApp, uint8 mode, bool apply) const
@@ -1668,7 +1668,7 @@ void AuraEffect::HandleModStealthLevel(AuraApplication const* aurApp, uint8 mode
target->m_stealth.AddValue(type, -GetAmount());
// call functions which may have additional effects after chainging state of unit
target->UpdateObjectVisibility(target->GetTypeId() == TYPEID_PLAYER || IS_PLAYER_GUID(target->GetOwnerGUID()));
target->UpdateObjectVisibility(target->GetTypeId() == TYPEID_PLAYER || target->GetOwnerGUID().IsPlayer());
}
void AuraEffect::HandleDetectAmore(AuraApplication const* aurApp, uint8 mode, bool apply) const
@@ -1794,7 +1794,7 @@ void AuraEffect::HandlePhase(AuraApplication const* aurApp, uint8 mode, bool app
{
newPhase = PHASEMASK_NORMAL;
if (Creature* creature = target->ToCreature())
if (CreatureData const* data = sObjectMgr->GetCreatureData(creature->GetDBTableGUIDLow()))
if (CreatureData const* data = sObjectMgr->GetCreatureData(creature->GetSpawnId()))
newPhase = data->phaseMask;
}
@@ -1915,7 +1915,7 @@ void AuraEffect::HandleAuraModShapeshift(AuraApplication const* aurApp, uint8 mo
// remove other shapeshift before applying a new one
// xinef: rogue shouldnt be wrapped by this check (shadow dance vs stealth)
if (GetSpellInfo()->SpellFamilyName != SPELLFAMILY_ROGUE)
target->RemoveAurasByType(SPELL_AURA_MOD_SHAPESHIFT, 0, GetBase());
target->RemoveAurasByType(SPELL_AURA_MOD_SHAPESHIFT, ObjectGuid::Empty, GetBase());
// stop handling the effect if it was removed by linked event
if (aurApp->GetRemoveMode())
@@ -2298,7 +2298,7 @@ void AuraEffect::HandleAuraTransform(AuraApplication const* aurApp, uint8 mode,
{
// for players, start regeneration after 1s (in polymorph fast regeneration case)
// only if caster is Player (after patch 2.4.2)
if (IS_PLAYER_GUID(GetCasterGUID()))
if (GetCasterGUID().IsPlayer())
target->ToPlayer()->setRegenTimerCount(1 * IN_MILLISECONDS);
//dismount polymorphed target (after patch 2.4.2)
@@ -3731,7 +3731,7 @@ void AuraEffect::HandleAuraModStateImmunity(AuraApplication const* aurApp, uint8
target->ApplySpellImmune(GetId(), IMMUNITY_STATE, GetMiscValue(), apply);
if (apply && GetSpellInfo()->HasAttribute(SPELL_ATTR1_DISPEL_AURAS_ON_IMMUNITY))
target->RemoveAurasByType(AuraType(GetMiscValue()), 0, GetBase());
target->RemoveAurasByType(AuraType(GetMiscValue()), ObjectGuid::Empty, GetBase());
}
void AuraEffect::HandleAuraModSchoolImmunity(AuraApplication const* aurApp, uint8 mode, bool apply) const
@@ -5180,7 +5180,7 @@ void AuraEffect::HandleAuraDummy(AuraApplication const* aurApp, uint8 mode, bool
{
Unit* caster = GetBase()->GetCaster();
if (caster && caster->GetTypeId() == TYPEID_PLAYER)
caster->ToPlayer()->KilledMonsterCredit(25987, 0);
caster->ToPlayer()->KilledMonsterCredit(25987);
}
return;
}
@@ -5569,13 +5569,13 @@ void AuraEffect::HandleAuraLinked(AuraApplication const* aurApp, uint8 mode, boo
}
else
{
uint64 casterGUID = triggeredSpellInfo->NeedsToBeTriggeredByCaster(m_spellInfo, GetEffIndex()) ? GetCasterGUID() : target->GetGUID();
ObjectGuid casterGUID = triggeredSpellInfo->NeedsToBeTriggeredByCaster(m_spellInfo, GetEffIndex()) ? GetCasterGUID() : target->GetGUID();
target->RemoveAura(triggeredSpellId, casterGUID, 0, aurApp->GetRemoveMode());
}
}
else if (mode & AURA_EFFECT_HANDLE_REAPPLY && apply)
{
uint64 casterGUID = triggeredSpellInfo->NeedsToBeTriggeredByCaster(m_spellInfo, GetEffIndex()) ? GetCasterGUID() : target->GetGUID();
ObjectGuid casterGUID = triggeredSpellInfo->NeedsToBeTriggeredByCaster(m_spellInfo, GetEffIndex()) ? GetCasterGUID() : target->GetGUID();
// change the stack amount to be equal to stack amount of our aura
if (Aura* triggeredAura = target->GetAura(triggeredSpellId, casterGUID))
triggeredAura->ModStackAmount(GetBase()->GetStackAmount() - triggeredAura->GetStackAmount());
@@ -5690,7 +5690,7 @@ void AuraEffect::HandleAuraSetVehicle(AuraApplication const* aurApp, uint8 mode,
target->RemoveVehicleKit();
WorldPacket data(SMSG_PLAYER_VEHICLE_DATA, target->GetPackGUID().size() + 4);
data.appendPackGUID(target->GetGUID());
data << target->GetPackGUID();
data << uint32(apply ? vehicleId : 0);
target->SendMessageToSet(&data, true);
@@ -5972,7 +5972,7 @@ void AuraEffect::HandlePeriodicTriggerSpellAuraTick(Unit* target, Unit* caster)
case 28820:
{
// Need remove self if Lightning Shield not active
if (!target->GetAuraEffect(SPELL_AURA_PROC_TRIGGER_SPELL, SPELLFAMILY_SHAMAN, 0x400))
if (!target->GetAuraEffect(SPELL_AURA_PROC_TRIGGER_SPELL, SPELLFAMILY_SHAMAN, 0x400, 0, 0))
target->RemoveAurasDueToSpell(28820);
return;
}
@@ -6255,8 +6255,8 @@ void AuraEffect::HandlePeriodicDamageAurasTick(Unit* target, Unit* caster) const
Unit::CalcAbsorbResist(caster, target, GetSpellInfo()->GetSchoolMask(), DOT, damage, &absorb, &resist, GetSpellInfo());
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
LOG_DEBUG("server", "PeriodicTick: %u (TypeId: %u) attacked %u (TypeId: %u) for %u dmg inflicted by %u abs is %u",
GUID_LOPART(GetCasterGUID()), GuidHigh2TypeId(GUID_HIPART(GetCasterGUID())), target->GetGUIDLow(), target->GetTypeId(), damage, GetId(), absorb);
LOG_DEBUG("server", "PeriodicTick: %s attacked %s for %u dmg inflicted by %u abs is %u",
GetCasterGUID().ToString().c_str(), target->GetGUID().ToString().c_str(), damage, GetId(), absorb);
#endif
Unit::DealDamageMods(target, damage, &absorb);
@@ -6351,8 +6351,8 @@ void AuraEffect::HandlePeriodicHealthLeechAuraTick(Unit* target, Unit* caster) c
damage = target->GetHealth();
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
LOG_DEBUG("server", "PeriodicTick: %u (TypeId: %u) health leech of %u (TypeId: %u) for %u dmg inflicted by %u abs is %u",
GUID_LOPART(GetCasterGUID()), GuidHigh2TypeId(GUID_HIPART(GetCasterGUID())), target->GetGUIDLow(), target->GetTypeId(), damage, GetId(), absorb);
LOG_DEBUG("server", "PeriodicTick: %s health leech of %s for %u dmg inflicted by %u abs is %u",
GetCasterGUID().ToString().c_str(), target->GetGUID().ToString().c_str(), damage, GetId(), absorb);
#endif
if (caster)
caster->SendSpellNonMeleeDamageLog(target, GetId(), damage + absorb + resist, GetSpellInfo()->GetSchoolMask(), absorb, resist, false, 0, crit);
@@ -6498,8 +6498,8 @@ void AuraEffect::HandlePeriodicHealAurasTick(Unit* target, Unit* caster) const
damage = Unit::SpellCriticalHealingBonus(caster, GetSpellInfo(), damage, target);
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
LOG_DEBUG("server", "PeriodicTick: %u (TypeId: %u) heal of %u (TypeId: %u) for %u health inflicted by %u",
GUID_LOPART(GetCasterGUID()), GuidHigh2TypeId(GUID_HIPART(GetCasterGUID())), target->GetGUIDLow(), target->GetTypeId(), damage, GetId());
LOG_DEBUG("server", "PeriodicTick: %s heal of %s for %u health inflicted by %u",
GetCasterGUID().ToString().c_str(), target->GetGUID().ToString().c_str(), damage, GetId());
#endif
uint32 absorb = 0;
uint32 heal = uint32(damage);
@@ -6516,7 +6516,7 @@ void AuraEffect::HandlePeriodicHealAurasTick(Unit* target, Unit* caster) const
if (caster)
target->getHostileRefManager().threatAssist(caster, float(gain) * 0.5f, GetSpellInfo());
bool haveCastItem = GetBase()->GetCastItemGUID() != 0;
bool haveCastItem = GetBase()->GetCastItemGUID();
// Health Funnel
// damage caster for heal amount
@@ -6578,8 +6578,8 @@ void AuraEffect::HandlePeriodicManaLeechAuraTick(Unit* target, Unit* caster) con
}
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
LOG_DEBUG("server", "PeriodicTick: %u (TypeId: %u) power leech of %u (TypeId: %u) for %u dmg inflicted by %u",
GUID_LOPART(GetCasterGUID()), GuidHigh2TypeId(GUID_HIPART(GetCasterGUID())), target->GetGUIDLow(), target->GetTypeId(), drainAmount, GetId());
LOG_DEBUG("server", "PeriodicTick: %s power leech of %s for %u dmg inflicted by %u",
GetCasterGUID().ToString().c_str(), target->GetGUID().ToString().c_str(), drainAmount, GetId());
#endif
// resilience reduce mana draining effect at spell crit damage reduction (added in 2.4)
if (PowerType == POWER_MANA)
@@ -6645,8 +6645,8 @@ void AuraEffect::HandleObsModPowerAuraTick(Unit* target, Unit* caster) const
// ignore negative values (can be result apply spellmods to aura damage
uint32 amount = std::max(m_amount, 0) * target->GetMaxPower(PowerType) / 100;
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
LOG_DEBUG("server", "PeriodicTick: %u (TypeId: %u) energize %u (TypeId: %u) for %u dmg inflicted by %u",
GUID_LOPART(GetCasterGUID()), GuidHigh2TypeId(GUID_HIPART(GetCasterGUID())), target->GetGUIDLow(), target->GetTypeId(), amount, GetId());
LOG_DEBUG("server", "PeriodicTick: %s energize %s for %u dmg inflicted by %u",
GetCasterGUID().ToString().c_str(), target->GetGUID().ToString().c_str(), amount, GetId());
#endif
SpellPeriodicAuraLogInfo pInfo(this, amount, 0, 0, 0, 0.0f, false);
target->SendPeriodicAuraLog(&pInfo);
@@ -6684,8 +6684,8 @@ void AuraEffect::HandlePeriodicEnergizeAuraTick(Unit* target, Unit* caster) cons
target->SendPeriodicAuraLog(&pInfo);
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
LOG_DEBUG("server", "PeriodicTick: %u (TypeId: %u) energize %u (TypeId: %u) for %u dmg inflicted by %u",
GUID_LOPART(GetCasterGUID()), GuidHigh2TypeId(GUID_HIPART(GetCasterGUID())), target->GetGUIDLow(), target->GetTypeId(), amount, GetId());
LOG_DEBUG("server", "PeriodicTick: %s energize %s for %u dmg inflicted by %u",
GetCasterGUID().ToString().c_str(), target->GetGUID().ToString().c_str(), amount, GetId());
#endif
int32 gain = target->ModifyPower(PowerType, amount);

View File

@@ -20,14 +20,14 @@ typedef void(AuraEffect::*pAuraEffectHandler)(AuraApplication const* aurApp, uin
class AuraEffect
{
friend void Aura::_InitEffects(uint8 effMask, Unit* caster, int32* baseAmount);
friend Aura* Unit::_TryStackingOrRefreshingExistingAura(SpellInfo const* newAura, uint8 effMask, Unit* caster, int32* baseAmount, Item* castItem, uint64 casterGUID, bool noPeriodicReset);
friend Aura* Unit::_TryStackingOrRefreshingExistingAura(SpellInfo const* newAura, uint8 effMask, Unit* caster, int32* baseAmount, Item* castItem, ObjectGuid casterGUID, bool noPeriodicReset);
friend Aura::~Aura();
private:
~AuraEffect();
explicit AuraEffect(Aura* base, uint8 effIndex, int32* baseAmount, Unit* caster);
public:
Unit* GetCaster() const { return GetBase()->GetCaster(); }
uint64 GetCasterGUID() const { return GetBase()->GetCasterGUID(); }
ObjectGuid GetCasterGUID() const { return GetBase()->GetCasterGUID(); }
Aura* GetBase() const { return m_base; }
void GetTargetList(std::list<Unit*>& targetList) const;
void GetApplicationList(std::list<AuraApplication*>& applicationList) const;

View File

@@ -259,7 +259,7 @@ void AuraApplication::BuildUpdatePacket(ByteBuffer& data, bool remove) const
data << uint8(aura->GetSpellInfo()->StackAmount ? aura->GetStackAmount() : aura->GetCharges());
if (!(flags & AFLAG_CASTER))
data.appendPackGUID(aura->GetCasterGUID());
data << aura->GetCasterGUID().WriteAsPacked();
if (flags & AFLAG_DURATION)
{
@@ -273,7 +273,7 @@ void AuraApplication::ClientUpdate(bool remove)
_needClientUpdate = false;
WorldPacket data(SMSG_AURA_UPDATE);
data.append(GetTarget()->GetPackGUID());
data << GetTarget()->GetPackGUID();
BuildUpdatePacket(data, remove);
if (GetSlot() < MAX_AURAS)
@@ -313,7 +313,7 @@ uint8 Aura::BuildEffectMaskForOwner(SpellInfo const* spellProto, uint8 avalibleE
return effMask & avalibleEffectMask;
}
Aura* Aura::TryRefreshStackOrCreate(SpellInfo const* spellproto, uint8 tryEffMask, WorldObject* owner, Unit* caster, int32* baseAmount /*= nullptr*/, Item* castItem /*= nullptr*/, uint64 casterGUID /*= 0*/, bool* refresh /*= nullptr*/, bool periodicReset /*= false*/)
Aura* Aura::TryRefreshStackOrCreate(SpellInfo const* spellproto, uint8 tryEffMask, WorldObject* owner, Unit* caster, int32* baseAmount /*= nullptr*/, Item* castItem /*= nullptr*/, ObjectGuid casterGUID /*= ObjectGuid::Empty*/, bool* refresh /*= nullptr*/, bool periodicReset /*= false*/)
{
ASSERT(spellproto);
ASSERT(owner);
@@ -339,7 +339,7 @@ Aura* Aura::TryRefreshStackOrCreate(SpellInfo const* spellproto, uint8 tryEffMas
return Create(spellproto, effMask, owner, caster, baseAmount, castItem, casterGUID);
}
Aura* Aura::TryCreate(SpellInfo const* spellproto, uint8 tryEffMask, WorldObject* owner, Unit* caster, int32* baseAmount /*= nullptr*/, Item* castItem /*= nullptr*/, uint64 casterGUID /*= 0*/)
Aura* Aura::TryCreate(SpellInfo const* spellproto, uint8 tryEffMask, WorldObject* owner, Unit* caster, int32* baseAmount /*= nullptr*/, Item* castItem /*= nullptr*/, ObjectGuid casterGUID /*= ObjectGuid::Empty*/)
{
ASSERT(spellproto);
ASSERT(owner);
@@ -351,7 +351,7 @@ Aura* Aura::TryCreate(SpellInfo const* spellproto, uint8 tryEffMask, WorldObject
return Create(spellproto, effMask, owner, caster, baseAmount, castItem, casterGUID);
}
Aura* Aura::Create(SpellInfo const* spellproto, uint8 effMask, WorldObject* owner, Unit* caster, int32* baseAmount, Item* castItem, uint64 casterGUID)
Aura* Aura::Create(SpellInfo const* spellproto, uint8 effMask, WorldObject* owner, Unit* caster, int32* baseAmount, Item* castItem, ObjectGuid casterGUID)
{
ASSERT(effMask);
ASSERT(spellproto);
@@ -396,9 +396,9 @@ Aura* Aura::Create(SpellInfo const* spellproto, uint8 effMask, WorldObject* owne
return aura;
}
Aura::Aura(SpellInfo const* spellproto, WorldObject* owner, Unit* caster, Item* castItem, uint64 casterGUID) :
Aura::Aura(SpellInfo const* spellproto, WorldObject* owner, Unit* caster, Item* castItem, ObjectGuid casterGUID) :
m_spellInfo(spellproto), m_casterGuid(casterGUID ? casterGUID : caster->GetGUID()),
m_castItemGuid(castItem ? castItem->GetGUID() : 0), m_castItemEntry(castItem ? castItem->GetEntry() : 0), m_applyTime(time(nullptr)),
m_castItemGuid(castItem ? castItem->GetGUID() : ObjectGuid::Empty), m_castItemEntry(castItem ? castItem->GetEntry() : 0), m_applyTime(time(nullptr)),
m_owner(owner), m_timeCla(0), m_updateTargetMapInterval(0),
m_casterLevel(caster ? caster->getLevel() : m_spellInfo->SpellLevel), m_procCharges(0), m_stackAmount(1),
m_isRemoved(false), m_isSingleTarget(false), m_isUsingCharges(false)
@@ -504,8 +504,8 @@ void Aura::_UnapplyForTarget(Unit* target, Unit* caster, AuraApplication* auraAp
// TODO: Figure out why this happens
if (itr == m_applications.end())
{
LOG_ERROR("server", "Aura::_UnapplyForTarget, target:%u, caster:%u, spell:%u was not found in owners application map!",
target->GetGUIDLow(), caster ? caster->GetGUIDLow() : 0, auraApp->GetBase()->GetSpellInfo()->Id);
LOG_ERROR("server", "Aura::_UnapplyForTarget, target:%s, caster:%s, spell:%u was not found in owners application map!",
target->GetGUID().ToString().c_str(), caster ? caster->GetGUID().ToString().c_str() : "", auraApp->GetBase()->GetSpellInfo()->Id);
ABORT();
}
@@ -1107,9 +1107,6 @@ void Aura::UnregisterSingleTarget()
{
ASSERT(m_isSingleTarget);
Unit* caster = GetCaster();
// TODO: find a better way to do this.
if (!caster)
caster = ObjectAccessor::GetObjectInOrOutOfWorld(GetCasterGUID(), (Unit*)nullptr);
if (!caster)
{
LOG_INFO("misc", "Aura::UnregisterSingleTarget (A1) - %u, %u, %u, %s", GetId(), GetOwner()->GetTypeId(), GetOwner()->GetEntry(), GetOwner()->GetName().c_str());
@@ -1699,7 +1696,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
WorldPacket data(SMSG_MODIFY_COOLDOWN, 4 + 8 + 4);
data << uint32(GetId()); // Spell ID
data << uint64(player->GetGUID()); // Player GUID
data << player->GetGUID(); // Player GUID
data << int32(-110000); // Cooldown mod in milliseconds
player->SendDirectMessage(&data);
}
@@ -1719,7 +1716,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
}
// Remove Vanish on stealth remove
if (GetId() == 1784)
target->RemoveAurasWithFamily(SPELLFAMILY_ROGUE, 0x800, 0, 0, 0);
target->RemoveAurasWithFamily(SPELLFAMILY_ROGUE, 0x800, 0, 0, ObjectGuid::Empty);
break;
}
@@ -2595,7 +2592,7 @@ void Aura::CallScriptAfterEffectProcHandlers(AuraEffect const* aurEff, AuraAppli
}
}
UnitAura::UnitAura(SpellInfo const* spellproto, uint8 effMask, WorldObject* owner, Unit* caster, int32* baseAmount, Item* castItem, uint64 casterGUID)
UnitAura::UnitAura(SpellInfo const* spellproto, uint8 effMask, WorldObject* owner, Unit* caster, int32* baseAmount, Item* castItem, ObjectGuid casterGUID)
: Aura(spellproto, owner, caster, castItem, casterGUID)
{
m_AuraDRGroup = DIMINISHING_NONE;
@@ -2698,7 +2695,7 @@ void UnitAura::FillTargetMap(std::map<Unit*, uint8>& targets, Unit* caster)
}
}
DynObjAura::DynObjAura(SpellInfo const* spellproto, uint8 effMask, WorldObject* owner, Unit* caster, int32* baseAmount, Item* castItem, uint64 casterGUID)
DynObjAura::DynObjAura(SpellInfo const* spellproto, uint8 effMask, WorldObject* owner, Unit* caster, int32* baseAmount, Item* castItem, ObjectGuid casterGUID)
: Aura(spellproto, owner, caster, castItem, casterGUID)
{
LoadScripts();

View File

@@ -75,24 +75,24 @@ public:
class Aura
{
friend Aura* Unit::_TryStackingOrRefreshingExistingAura(SpellInfo const* newAura, uint8 effMask, Unit* caster, int32* baseAmount, Item* castItem, uint64 casterGUID, bool noPeriodicReset);
friend Aura* Unit::_TryStackingOrRefreshingExistingAura(SpellInfo const* newAura, uint8 effMask, Unit* caster, int32* baseAmount, Item* castItem, ObjectGuid casterGUID, bool noPeriodicReset);
public:
typedef std::map<uint64, AuraApplication*> ApplicationMap;
typedef std::map<ObjectGuid, AuraApplication*> ApplicationMap;
static uint8 BuildEffectMaskForOwner(SpellInfo const* spellProto, uint8 avalibleEffectMask, WorldObject* owner);
static Aura* TryRefreshStackOrCreate(SpellInfo const* spellproto, uint8 tryEffMask, WorldObject* owner, Unit* caster, int32* baseAmount = nullptr, Item* castItem = nullptr, uint64 casterGUID = 0, bool* refresh = nullptr, bool periodicReset = false);
static Aura* TryCreate(SpellInfo const* spellproto, uint8 effMask, WorldObject* owner, Unit* caster, int32* baseAmount = nullptr, Item* castItem = nullptr, uint64 casterGUID = 0);
static Aura* Create(SpellInfo const* spellproto, uint8 effMask, WorldObject* owner, Unit* caster, int32* baseAmount, Item* castItem, uint64 casterGUID);
explicit Aura(SpellInfo const* spellproto, WorldObject* owner, Unit* caster, Item* castItem, uint64 casterGUID);
static Aura* TryRefreshStackOrCreate(SpellInfo const* spellproto, uint8 tryEffMask, WorldObject* owner, Unit* caster, int32* baseAmount = nullptr, Item* castItem = nullptr, ObjectGuid casterGUID = ObjectGuid::Empty, bool* refresh = nullptr, bool periodicReset = false);
static Aura* TryCreate(SpellInfo const* spellproto, uint8 effMask, WorldObject* owner, Unit* caster, int32* baseAmount = nullptr, Item* castItem = nullptr, ObjectGuid casterGUID = ObjectGuid::Empty);
static Aura* Create(SpellInfo const* spellproto, uint8 effMask, WorldObject* owner, Unit* caster, int32* baseAmount, Item* castItem, ObjectGuid casterGUID);
explicit Aura(SpellInfo const* spellproto, WorldObject* owner, Unit* caster, Item* castItem, ObjectGuid casterGUID);
void _InitEffects(uint8 effMask, Unit* caster, int32* baseAmount);
virtual ~Aura();
SpellInfo const* GetSpellInfo() const { return m_spellInfo; }
uint32 GetId() const;
uint64 GetCastItemGUID() const { return m_castItemGuid; }
ObjectGuid GetCastItemGUID() const { return m_castItemGuid; }
uint32 GetCastItemEntry() const { return m_castItemEntry; }
uint64 GetCasterGUID() const { return m_casterGuid; }
ObjectGuid GetCasterGUID() const { return m_casterGuid; }
Unit* GetCaster() const;
WorldObject* GetOwner() const { return m_owner; }
Unit* GetUnitOwner() const { ASSERT(GetType() == UNIT_AURA_TYPE); return (Unit*)m_owner; }
@@ -170,9 +170,9 @@ public:
// Helpers for targets
ApplicationMap const& GetApplicationMap() {return m_applications;}
void GetApplicationList(std::list<AuraApplication*>& applicationList) const;
const AuraApplication* GetApplicationOfTarget (uint64 guid) const { ApplicationMap::const_iterator itr = m_applications.find(guid); if (itr != m_applications.end()) return itr->second; return nullptr; }
AuraApplication* GetApplicationOfTarget (uint64 guid) { ApplicationMap::iterator itr = m_applications.find(guid); if (itr != m_applications.end()) return itr->second; return nullptr; }
bool IsAppliedOnTarget(uint64 guid) const { return m_applications.find(guid) != m_applications.end(); }
const AuraApplication* GetApplicationOfTarget (ObjectGuid guid) const { ApplicationMap::const_iterator itr = m_applications.find(guid); if (itr != m_applications.end()) return itr->second; return nullptr; }
AuraApplication* GetApplicationOfTarget (ObjectGuid guid) { ApplicationMap::iterator itr = m_applications.find(guid); if (itr != m_applications.end()) return itr->second; return nullptr; }
bool IsAppliedOnTarget(ObjectGuid guid) const { return m_applications.find(guid) != m_applications.end(); }
void SetNeedClientUpdateForTargets() const;
void HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, bool apply, bool onReapply);
@@ -229,11 +229,11 @@ private:
void _DeleteRemovedApplications();
protected:
SpellInfo const* const m_spellInfo;
uint64 const m_casterGuid;
uint64 const m_castItemGuid; // it is NOT safe to keep a pointer to the item because it may get deleted
ObjectGuid const m_casterGuid;
ObjectGuid const m_castItemGuid; // it is NOT safe to keep a pointer to the item because it may get deleted
uint32 const m_castItemEntry; // when deleted, we could retrieve some information from template instead
time_t const m_applyTime;
WorldObject* const m_owner; //
WorldObject* const m_owner;
int32 m_maxDuration; // Max aura duration
int32 m_duration; // Current time
@@ -257,9 +257,9 @@ private:
class UnitAura : public Aura
{
friend Aura* Aura::Create(SpellInfo const* spellproto, uint8 effMask, WorldObject* owner, Unit* caster, int32* baseAmount, Item* castItem, uint64 casterGUID);
friend Aura* Aura::Create(SpellInfo const* spellproto, uint8 effMask, WorldObject* owner, Unit* caster, int32* baseAmount, Item* castItem, ObjectGuid casterGUID);
protected:
explicit UnitAura(SpellInfo const* spellproto, uint8 effMask, WorldObject* owner, Unit* caster, int32* baseAmount, Item* castItem, uint64 casterGUID);
explicit UnitAura(SpellInfo const* spellproto, uint8 effMask, WorldObject* owner, Unit* caster, int32* baseAmount, Item* castItem, ObjectGuid casterGUID);
public:
void _ApplyForTarget(Unit* target, Unit* caster, AuraApplication* aurApp) override;
void _UnapplyForTarget(Unit* target, Unit* caster, AuraApplication* aurApp) override;
@@ -278,9 +278,9 @@ private:
class DynObjAura : public Aura
{
friend Aura* Aura::Create(SpellInfo const* spellproto, uint8 effMask, WorldObject* owner, Unit* caster, int32* baseAmount, Item* castItem, uint64 casterGUID);
friend Aura* Aura::Create(SpellInfo const* spellproto, uint8 effMask, WorldObject* owner, Unit* caster, int32* baseAmount, Item* castItem, ObjectGuid casterGUID);
protected:
explicit DynObjAura(SpellInfo const* spellproto, uint8 effMask, WorldObject* owner, Unit* caster, int32* baseAmount, Item* castItem, uint64 casterGUID);
explicit DynObjAura(SpellInfo const* spellproto, uint8 effMask, WorldObject* owner, Unit* caster, int32* baseAmount, Item* castItem, ObjectGuid casterGUID);
public:
void Remove(AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT) override;

View File

@@ -58,14 +58,12 @@ extern pEffect SpellEffects[TOTAL_SPELL_EFFECTS];
SpellDestination::SpellDestination()
{
_position.Relocate(0, 0, 0, 0);
_transportGUID = 0;
_transportOffset.Relocate(0, 0, 0, 0);
}
SpellDestination::SpellDestination(float x, float y, float z, float orientation, uint32 mapId)
{
_position.Relocate(x, y, z, orientation);
_transportGUID = 0;
_position.m_mapId = mapId;
_transportOffset.Relocate(0, 0, 0, 0);
}
@@ -73,7 +71,6 @@ SpellDestination::SpellDestination(float x, float y, float z, float orientation,
SpellDestination::SpellDestination(Position const& pos)
{
_position.Relocate(pos);
_transportGUID = 0;
_transportOffset.Relocate(0, 0, 0, 0);
}
@@ -108,14 +105,9 @@ SpellCastTargets::SpellCastTargets() : m_elevation(0), m_speed(0), m_strTarget()
m_objectTarget = nullptr;
m_itemTarget = nullptr;
m_objectTargetGUID = 0;
m_itemTargetGUID = 0;
m_itemTargetEntry = 0;
m_targetMask = 0;
// Xinef: Channel data
m_objectTargetGUIDChannel = 0;
}
SpellCastTargets::~SpellCastTargets()
@@ -130,14 +122,14 @@ void SpellCastTargets::Read(ByteBuffer& data, Unit* caster)
return;
if (m_targetMask & (TARGET_FLAG_UNIT | TARGET_FLAG_UNIT_MINIPET | TARGET_FLAG_GAMEOBJECT | TARGET_FLAG_CORPSE_ENEMY | TARGET_FLAG_CORPSE_ALLY))
data.readPackGUID(m_objectTargetGUID);
data >> m_objectTargetGUID.ReadAsPacked();
if (m_targetMask & (TARGET_FLAG_ITEM | TARGET_FLAG_TRADE_ITEM))
data.readPackGUID(m_itemTargetGUID);
data >> m_itemTargetGUID.ReadAsPacked();
if (m_targetMask & TARGET_FLAG_SOURCE_LOCATION)
{
data.readPackGUID(m_src._transportGUID);
data >> m_src._transportGUID.ReadAsPacked();
if (m_src._transportGUID)
data >> m_src._transportOffset.PositionXYZStream();
else
@@ -154,7 +146,7 @@ void SpellCastTargets::Read(ByteBuffer& data, Unit* caster)
if (m_targetMask & TARGET_FLAG_DEST_LOCATION)
{
data.readPackGUID(m_dst._transportGUID);
data >> m_dst._transportGUID.ReadAsPacked();
if (m_dst._transportGUID)
data >> m_dst._transportOffset.PositionXYZStream();
else
@@ -180,19 +172,19 @@ void SpellCastTargets::Write(ByteBuffer& data)
data << uint32(m_targetMask);
if (m_targetMask & (TARGET_FLAG_UNIT | TARGET_FLAG_CORPSE_ALLY | TARGET_FLAG_GAMEOBJECT | TARGET_FLAG_CORPSE_ENEMY | TARGET_FLAG_UNIT_MINIPET))
data.appendPackGUID(m_objectTargetGUID);
data << m_objectTargetGUID.WriteAsPacked();
if (m_targetMask & (TARGET_FLAG_ITEM | TARGET_FLAG_TRADE_ITEM))
{
if (m_itemTarget)
data.append(m_itemTarget->GetPackGUID());
data << m_itemTarget->GetPackGUID();
else
data << uint8(0);
}
if (m_targetMask & TARGET_FLAG_SOURCE_LOCATION)
{
data.appendPackGUID(m_src._transportGUID); // relative position guid here - transport for example
data << m_src._transportGUID.WriteAsPacked(); // relative position guid here - transport for example
if (m_src._transportGUID)
data << m_src._transportOffset.PositionXYZStream();
else
@@ -201,7 +193,7 @@ void SpellCastTargets::Write(ByteBuffer& data)
if (m_targetMask & TARGET_FLAG_DEST_LOCATION)
{
data.appendPackGUID(m_dst._transportGUID); // relative position guid here - transport for example
data << m_dst._transportGUID.WriteAsPacked(); // relative position guid here - transport for example
if (m_dst._transportGUID)
data << m_dst._transportOffset.PositionXYZStream();
else
@@ -212,18 +204,20 @@ void SpellCastTargets::Write(ByteBuffer& data)
data << m_strTarget;
}
uint64 SpellCastTargets::GetUnitTargetGUID() const
ObjectGuid SpellCastTargets::GetUnitTargetGUID() const
{
switch (GUID_HIPART(m_objectTargetGUID))
switch (m_objectTargetGUID.GetHigh())
{
case HIGHGUID_PLAYER:
case HIGHGUID_VEHICLE:
case HIGHGUID_UNIT:
case HIGHGUID_PET:
case HighGuid::Player:
case HighGuid::Vehicle:
case HighGuid::Unit:
case HighGuid::Pet:
return m_objectTargetGUID;
default:
return 0LL;
break;
}
return ObjectGuid::Empty;
}
Unit* SpellCastTargets::GetUnitTarget() const
@@ -243,17 +237,19 @@ void SpellCastTargets::SetUnitTarget(Unit* target)
m_targetMask |= TARGET_FLAG_UNIT;
}
uint64 SpellCastTargets::GetGOTargetGUID() const
ObjectGuid SpellCastTargets::GetGOTargetGUID() const
{
switch (GUID_HIPART(m_objectTargetGUID))
switch (m_objectTargetGUID.GetHigh())
{
case HIGHGUID_TRANSPORT:
case HIGHGUID_MO_TRANSPORT:
case HIGHGUID_GAMEOBJECT:
case HighGuid::Transport:
case HighGuid::Mo_Transport:
case HighGuid::GameObject:
return m_objectTargetGUID;
default:
return 0LL;
break;
}
return ObjectGuid::Empty;
}
GameObject* SpellCastTargets::GetGOTarget() const
@@ -273,15 +269,17 @@ void SpellCastTargets::SetGOTarget(GameObject* target)
m_targetMask |= TARGET_FLAG_GAMEOBJECT;
}
uint64 SpellCastTargets::GetCorpseTargetGUID() const
ObjectGuid SpellCastTargets::GetCorpseTargetGUID() const
{
switch (GUID_HIPART(m_objectTargetGUID))
switch (m_objectTargetGUID.GetHigh())
{
case HIGHGUID_CORPSE:
case HighGuid::Corpse:
return m_objectTargetGUID;
default:
return 0LL;
break;
}
return ObjectGuid::Empty;
}
Corpse* SpellCastTargets::GetCorpseTarget() const
@@ -306,7 +304,7 @@ WorldObject* SpellCastTargets::GetObjectTarget() const
return m_objectTarget;
}
uint64 SpellCastTargets::GetObjectTargetGUID() const
ObjectGuid SpellCastTargets::GetObjectTargetGUID() const
{
return m_objectTargetGUID;
}
@@ -314,7 +312,7 @@ uint64 SpellCastTargets::GetObjectTargetGUID() const
void SpellCastTargets::RemoveObjectTarget()
{
m_objectTarget = nullptr;
m_objectTargetGUID = 0LL;
m_objectTargetGUID.Clear();
m_targetMask &= ~(TARGET_FLAG_UNIT_MASK | TARGET_FLAG_CORPSE_MASK | TARGET_FLAG_GAMEOBJECT_MASK);
}
@@ -331,7 +329,7 @@ void SpellCastTargets::SetItemTarget(Item* item)
void SpellCastTargets::SetTradeItemTarget(Player* caster)
{
m_itemTargetGUID = uint64(TRADE_SLOT_NONTRADED);
m_itemTargetGUID.Set(uint64(TRADE_SLOT_NONTRADED));
m_itemTargetEntry = 0;
m_targetMask |= TARGET_FLAG_TRADE_ITEM;
@@ -444,7 +442,7 @@ void SpellCastTargets::RemoveDst()
}
// Xinef: Channel Data
void SpellCastTargets::SetObjectTargetChannel(uint64 targetGUID)
void SpellCastTargets::SetObjectTargetChannel(ObjectGuid targetGUID)
{
m_objectTargetGUIDChannel = targetGUID;
}
@@ -480,7 +478,7 @@ void SpellCastTargets::Update(Unit* caster)
if (m_targetMask & TARGET_FLAG_ITEM)
m_itemTarget = player->GetItemByGuid(m_itemTargetGUID);
else if (m_targetMask & TARGET_FLAG_TRADE_ITEM)
if (m_itemTargetGUID == TRADE_SLOT_NONTRADED) // here it is not guid but slot. Also prevents hacking slots
if (m_itemTargetGUID.GetRawValue() == TRADE_SLOT_NONTRADED) // here it is not guid but slot. Also prevents hacking slots
if (TradeData* pTrade = player->GetTradeData())
m_itemTarget = pTrade->GetTraderData()->GetItem(TRADE_SLOT_NONTRADED);
@@ -515,15 +513,17 @@ void SpellCastTargets::OutDebug() const
LOG_INFO("server", "target mask: %u", m_targetMask);
if (m_targetMask & (TARGET_FLAG_UNIT_MASK | TARGET_FLAG_CORPSE_MASK | TARGET_FLAG_GAMEOBJECT_MASK))
LOG_INFO("server", "Object target: " UI64FMTD, m_objectTargetGUID);
LOG_INFO("server", "Object target: %s", m_objectTargetGUID.ToString().c_str());
if (m_targetMask & TARGET_FLAG_ITEM)
LOG_INFO("server", "Item target: " UI64FMTD, m_itemTargetGUID);
LOG_INFO("server", "Item target: %s", m_itemTargetGUID.ToString().c_str());
if (m_targetMask & TARGET_FLAG_TRADE_ITEM)
LOG_INFO("server", "Trade item target: " UI64FMTD, m_itemTargetGUID);
LOG_INFO("server", "Trade item target: %s", m_itemTargetGUID.ToString().c_str());
if (m_targetMask & TARGET_FLAG_SOURCE_LOCATION)
LOG_INFO("server", "Source location: transport guid:" UI64FMTD " trans offset: %s position: %s", m_src._transportGUID, m_src._transportOffset.ToString().c_str(), m_src._position.ToString().c_str());
LOG_INFO("server", "Source location: transport guid: %s trans offset: %s position: %s",
m_src._transportGUID.ToString().c_str(), m_src._transportOffset.ToString().c_str(), m_src._position.ToString().c_str());
if (m_targetMask & TARGET_FLAG_DEST_LOCATION)
LOG_INFO("server", "Destination location: transport guid:" UI64FMTD " trans offset: %s position: %s", m_dst._transportGUID, m_dst._transportOffset.ToString().c_str(), m_dst._position.ToString().c_str());
LOG_INFO("server", "Destination location: transport guid: %s trans offset: %s position: %s",
m_dst._transportGUID.ToString().c_str(), m_dst._transportOffset.ToString().c_str(), m_dst._position.ToString().c_str());
if (m_targetMask & TARGET_FLAG_STRING)
LOG_INFO("server", "String: %s", m_strTarget.c_str());
LOG_INFO("server", "speed: %f", m_speed);
@@ -540,7 +540,7 @@ SpellValue::SpellValue(SpellInfo const* proto)
ForcedCritResult = false;
}
Spell::Spell(Unit* caster, SpellInfo const* info, TriggerCastFlags triggerFlags, uint64 originalCasterGUID, bool skipCheck) :
Spell::Spell(Unit* caster, SpellInfo const* info, TriggerCastFlags triggerFlags, ObjectGuid originalCasterGUID, bool skipCheck) :
m_spellInfo(sSpellMgr->GetSpellForDifficultyFromSpell(info, caster)),
m_caster((info->HasAttribute(SPELL_ATTR6_CAST_BY_CHARMER) && caster->GetCharmerOrOwner()) ? caster->GetCharmerOrOwner() : caster)
, m_spellValue(new SpellValue(m_spellInfo))
@@ -607,7 +607,6 @@ Spell::Spell(Unit* caster, SpellInfo const* info, TriggerCastFlags triggerFlags,
_triggeredCastFlags = TriggerCastFlags(uint32(_triggeredCastFlags) | TRIGGERED_IGNORE_CAST_IN_PROGRESS | TRIGGERED_CAST_DIRECTLY);
m_CastItem = nullptr;
m_castItemGUID = 0;
unitTarget = nullptr;
itemTarget = nullptr;
@@ -1141,7 +1140,7 @@ void Spell::SelectImplicitNearbyTargets(SpellEffIndex effIndex, SpellImplicitTar
}
else
{
//TC_LOG_DEBUG("spells", "Spell::SelectImplicitNearbyTargets: OnObjectTargetSelect script hook for spell Id %u set object of wrong type, expected unit, got %s, effect %u", m_spellInfo->Id, GetLogNameForGuid(target->GetGUID()), effMask);
//TC_LOG_DEBUG("spells", "Spell::SelectImplicitNearbyTargets: OnObjectTargetSelect script hook for spell Id %u set object of wrong type, expected unit, got %s, effect %u", m_spellInfo->Id, target->GetGUID().GetTypeName(), effMask);
return;
}
break;
@@ -1151,7 +1150,7 @@ void Spell::SelectImplicitNearbyTargets(SpellEffIndex effIndex, SpellImplicitTar
AddGOTarget(gobjTarget, effMask);
else
{
//TC_LOG_DEBUG("spells", "Spell::SelectImplicitNearbyTargets: OnObjectTargetSelect script hook for spell Id %u set object of wrong type, expected gameobject, got %s, effect %u", m_spellInfo->Id, GetLogNameForGuid(target->GetGUID()), effMask);
//TC_LOG_DEBUG("spells", "Spell::SelectImplicitNearbyTargets: OnObjectTargetSelect script hook for spell Id %u set object of wrong type, expected gameobject, got %s, effect %u", m_spellInfo->Id, target->GetGUID().GetTypeName(), effMask);
return;
}
break;
@@ -2141,7 +2140,7 @@ void Spell::AddUnitTarget(Unit* target, uint32 effectMask, bool checkIfValid /*=
if (target->IsImmunedToSpellEffect(m_spellInfo, effIndex))
effectMask &= ~(1 << effIndex);
uint64 targetGUID = target->GetGUID();
ObjectGuid targetGUID = target->GetGUID();
// Lookup target in already in list
for (std::list<TargetInfo>::iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit)
@@ -2221,7 +2220,7 @@ void Spell::AddUnitTarget(Unit* target, uint32 effectMask, bool checkIfValid /*=
targetInfo.reflectResult = SPELL_MISS_PARRY;
// Increase time interval for reflected spells by 1.5
m_caster->m_Events.AddEvent(new ReflectEvent(m_caster->GetGUID(), targetInfo.targetGUID, m_spellInfo), m_caster->m_Events.CalculateTime(targetInfo.timeDelay));
m_caster->m_Events.AddEvent(new ReflectEvent(m_caster, targetInfo.targetGUID, m_spellInfo), m_caster->m_Events.CalculateTime(targetInfo.timeDelay));
targetInfo.timeDelay += targetInfo.timeDelay >> 1;
m_spellFlags |= SPELL_FLAG_REFLECTED;
@@ -2275,7 +2274,7 @@ void Spell::AddGOTarget(GameObject* go, uint32 effectMask)
if (!effectMask)
return;
uint64 targetGUID = go->GetGUID();
ObjectGuid targetGUID = go->GetGUID();
// Lookup target in already in list
for (std::list<GOTargetInfo>::iterator ihit = m_UniqueGOTargetInfo.begin(); ihit != m_UniqueGOTargetInfo.end(); ++ihit)
@@ -2357,6 +2356,9 @@ 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 && !target->targetGUID.IsPlayer()) // only players may be targeted across maps
return;
if (!effectUnit || m_spellInfo->Id == 45927)
{
uint8 farMask = 0;
@@ -2370,7 +2372,7 @@ void Spell::DoAllEffectOnTarget(TargetInfo* target)
return;
// find unit in world
// Xinef: FindUnit Access without Map check!!! Intended
effectUnit = ObjectAccessor::FindUnit(target->targetGUID);
effectUnit = ObjectAccessor::FindPlayer(target->targetGUID);
if (!effectUnit)
return;
@@ -2852,7 +2854,7 @@ SpellMissInfo Spell::DoSpellHitOnUnit(Unit* unit, uint32 effectMask, bool scaleA
{
bool refresh = false;
m_spellAura = Aura::TryRefreshStackOrCreate(aurSpellInfo, effectMask, unit, m_originalCaster,
(aurSpellInfo == m_spellInfo) ? &m_spellValue->EffectBasePoints[0] : &basePoints[0], m_CastItem, 0, &refresh, !(_triggeredCastFlags & TRIGGERED_NO_PERIODIC_RESET));
(aurSpellInfo == m_spellInfo) ? &m_spellValue->EffectBasePoints[0] : &basePoints[0], m_CastItem, ObjectGuid::Empty, &refresh, !(_triggeredCastFlags & TRIGGERED_NO_PERIODIC_RESET));
// xinef: if aura was not refreshed, add proc ex
if (!refresh)
@@ -3164,7 +3166,7 @@ SpellCastResult Spell::prepare(SpellCastTargets const* targets, AuraEffect const
}
else
{
m_castItemGUID = 0;
m_castItemGUID = ObjectGuid::Empty;
}
InitExplicitTargets(*targets);
@@ -3898,7 +3900,7 @@ void Spell::SendSpellCooldown()
if (Player* player = m_caster->GetCharmerOrOwnerPlayerOrPlayerItself())
{
WorldPacket data(SMSG_SPELL_COOLDOWN, 8 + 1 + 4 + 4);
data << uint64(m_caster->GetGUID());
data << m_caster->GetGUID();
data << uint8(SPELL_COOLDOWN_FLAG_INCLUDE_GCD);
data << uint32(m_spellInfo->Id);
data << uint32(m_spellInfo->RecoveryTime);
@@ -4064,7 +4066,7 @@ void Spell::finish(bool ok)
if (spellInfo && spellInfo->SpellIconID == 2056)
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
LOG_DEBUG("spells.aura", "Statue %d is unsummoned in spell %d finish", m_caster->GetGUIDLow(), m_spellInfo->Id);
LOG_DEBUG("spells.aura", "Statue %s is unsummoned in spell %d finish", m_caster->GetGUID().ToString().c_str(), m_spellInfo->Id);
#endif
m_caster->setDeathState(JUST_DIED);
return;
@@ -4294,11 +4296,11 @@ void Spell::SendSpellStart()
WorldPacket data(SMSG_SPELL_START, (8 + 8 + 4 + 4 + 2));
if (m_CastItem)
data.append(m_CastItem->GetPackGUID());
data << m_CastItem->GetPackGUID();
else
data.append(m_caster->GetPackGUID());
data << m_caster->GetPackGUID();
data.append(m_caster->GetPackGUID());
data << m_caster->GetPackGUID();
data << uint8(m_cast_count); // pending spell cast?
data << uint32(m_spellInfo->Id); // spellId
data << uint32(castFlags); // cast flags
@@ -4367,11 +4369,11 @@ void Spell::SendSpellGo()
WorldPacket data(SMSG_SPELL_GO, 150); // guess size
if (m_CastItem)
data.append(m_CastItem->GetPackGUID());
data << m_CastItem->GetPackGUID();
else
data.append(m_caster->GetPackGUID());
data << m_caster->GetPackGUID();
data.append(m_caster->GetPackGUID());
data << m_caster->GetPackGUID();
data << uint8(m_cast_count); // pending spell cast?
data << uint32(m_spellInfo->Id); // spellId
data << uint32(castFlags); // cast flags
@@ -4526,7 +4528,7 @@ void Spell::WriteSpellGoTargets(WorldPacket* data)
{
if ((*ihit).missCondition == SPELL_MISS_NONE) // Add only hits
{
*data << uint64(ihit->targetGUID);
*data << ihit->targetGUID;
// Xinef: WTF is this? No channeled spell checked, no anything
//m_channelTargetEffectMask |=ihit->effectMask;
++hit;
@@ -4535,7 +4537,7 @@ void Spell::WriteSpellGoTargets(WorldPacket* data)
for (std::list<GOTargetInfo>::const_iterator ighit = m_UniqueGOTargetInfo.begin(); ighit != m_UniqueGOTargetInfo.end() && hit < 255; ++ighit)
{
*data << uint64(ighit->targetGUID); // Always hits
*data << ighit->targetGUID; // Always hits
++hit;
}
@@ -4546,7 +4548,7 @@ void Spell::WriteSpellGoTargets(WorldPacket* data)
{
if (ihit->missCondition != SPELL_MISS_NONE) // Add only miss
{
*data << uint64(ihit->targetGUID);
*data << ihit->targetGUID;
*data << uint8(ihit->missCondition);
if (ihit->missCondition == SPELL_MISS_REFLECT)
*data << uint8(ihit->reflectResult);
@@ -4566,7 +4568,7 @@ void Spell::SendLogExecute()
{
WorldPacket data(SMSG_SPELLLOGEXECUTE, (8 + 4 + 4 + 4 + 4 + 8));
data.append(m_caster->GetPackGUID());
data << m_caster->GetPackGUID();
data << uint32(m_spellInfo->Id);
@@ -4599,7 +4601,7 @@ void Spell::SendLogExecute()
void Spell::ExecuteLogEffectTakeTargetPower(uint8 effIndex, Unit* target, uint32 PowerType, uint32 powerTaken, float gainMultiplier)
{
InitEffectExecuteData(effIndex);
m_effectExecuteData[effIndex]->append(target->GetPackGUID());
*m_effectExecuteData[effIndex] << target->GetPackGUID();
*m_effectExecuteData[effIndex] << uint32(powerTaken);
*m_effectExecuteData[effIndex] << uint32(PowerType);
*m_effectExecuteData[effIndex] << float(gainMultiplier);
@@ -4608,21 +4610,21 @@ void Spell::ExecuteLogEffectTakeTargetPower(uint8 effIndex, Unit* target, uint32
void Spell::ExecuteLogEffectExtraAttacks(uint8 effIndex, Unit* victim, uint32 attCount)
{
InitEffectExecuteData(effIndex);
m_effectExecuteData[effIndex]->append(victim->GetPackGUID());
*m_effectExecuteData[effIndex] << victim->GetPackGUID();
*m_effectExecuteData[effIndex] << uint32(attCount);
}
void Spell::ExecuteLogEffectInterruptCast(uint8 effIndex, Unit* victim, uint32 spellId)
{
InitEffectExecuteData(effIndex);
m_effectExecuteData[effIndex]->append(victim->GetPackGUID());
*m_effectExecuteData[effIndex] << victim->GetPackGUID();
*m_effectExecuteData[effIndex] << uint32(spellId);
}
void Spell::ExecuteLogEffectDurabilityDamage(uint8 effIndex, Unit* victim, int32 itemId, int32 slot)
{
InitEffectExecuteData(effIndex);
m_effectExecuteData[effIndex]->append(victim->GetPackGUID());
*m_effectExecuteData[effIndex] << victim->GetPackGUID();
*m_effectExecuteData[effIndex] << int32(itemId);
*m_effectExecuteData[effIndex] << int32(slot);
}
@@ -4630,7 +4632,7 @@ void Spell::ExecuteLogEffectDurabilityDamage(uint8 effIndex, Unit* victim, int32
void Spell::ExecuteLogEffectOpenLock(uint8 effIndex, Object* obj)
{
InitEffectExecuteData(effIndex);
m_effectExecuteData[effIndex]->append(obj->GetPackGUID());
*m_effectExecuteData[effIndex] << obj->GetPackGUID();
}
void Spell::ExecuteLogEffectCreateItem(uint8 effIndex, uint32 entry)
@@ -4648,32 +4650,32 @@ void Spell::ExecuteLogEffectDestroyItem(uint8 effIndex, uint32 entry)
void Spell::ExecuteLogEffectSummonObject(uint8 effIndex, WorldObject* obj)
{
InitEffectExecuteData(effIndex);
m_effectExecuteData[effIndex]->append(obj->GetPackGUID());
*m_effectExecuteData[effIndex] << obj->GetPackGUID();
}
void Spell::ExecuteLogEffectUnsummonObject(uint8 effIndex, WorldObject* obj)
{
InitEffectExecuteData(effIndex);
m_effectExecuteData[effIndex]->append(obj->GetPackGUID());
*m_effectExecuteData[effIndex] << obj->GetPackGUID();
}
void Spell::ExecuteLogEffectResurrect(uint8 effIndex, Unit* target)
{
InitEffectExecuteData(effIndex);
m_effectExecuteData[effIndex]->append(target->GetPackGUID());
*m_effectExecuteData[effIndex] << target->GetPackGUID();
}
void Spell::SendInterrupted(uint8 result)
{
WorldPacket data(SMSG_SPELL_FAILURE, (8 + 1 + 4 + 1));
data.append(m_caster->GetPackGUID());
data << m_caster->GetPackGUID();
data << uint8(m_cast_count);
data << uint32(m_spellInfo->Id);
data << uint8(result);
m_caster->SendMessageToSet(&data, true);
data.Initialize(SMSG_SPELL_FAILED_OTHER, (8 + 1 + 4 + 1));
data.append(m_caster->GetPackGUID());
data << m_caster->GetPackGUID();
data << uint8(m_cast_count);
data << uint32(m_spellInfo->Id);
data << uint8(result);
@@ -4684,12 +4686,12 @@ void Spell::SendChannelUpdate(uint32 time)
{
if (time == 0)
{
m_caster->SetUInt64Value(UNIT_FIELD_CHANNEL_OBJECT, 0);
m_caster->SetGuidValue(UNIT_FIELD_CHANNEL_OBJECT, ObjectGuid::Empty);
m_caster->SetUInt32Value(UNIT_CHANNEL_SPELL, 0);
}
WorldPacket data(MSG_CHANNEL_UPDATE, 8 + 4);
data.append(m_caster->GetPackGUID());
data << m_caster->GetPackGUID();
data << uint32(time);
m_caster->SendMessageToSet(&data, true);
@@ -4697,13 +4699,13 @@ void Spell::SendChannelUpdate(uint32 time)
void Spell::SendChannelStart(uint32 duration)
{
uint64 channelTarget = m_targets.GetObjectTargetGUID();
ObjectGuid channelTarget = m_targets.GetObjectTargetGUID();
if (!channelTarget && !m_spellInfo->NeedsExplicitUnitTarget())
if (m_UniqueTargetInfo.size() + m_UniqueGOTargetInfo.size() == 1) // this is for TARGET_SELECT_CATEGORY_NEARBY
channelTarget = !m_UniqueTargetInfo.empty() ? m_UniqueTargetInfo.front().targetGUID : m_UniqueGOTargetInfo.front().targetGUID;
WorldPacket data(MSG_CHANNEL_START, (8 + 4 + 4));
data.append(m_caster->GetPackGUID());
data << m_caster->GetPackGUID();
data << uint32(m_spellInfo->Id);
data << uint32(duration);
@@ -4714,7 +4716,7 @@ void Spell::SendChannelStart(uint32 duration)
m_timer = duration;
if (channelTarget)
m_caster->SetUInt64Value(UNIT_FIELD_CHANNEL_OBJECT, channelTarget);
m_caster->SetGuidValue(UNIT_FIELD_CHANNEL_OBJECT, channelTarget);
m_caster->SetUInt32Value(UNIT_CHANNEL_SPELL, m_spellInfo->Id);
}
@@ -4728,7 +4730,7 @@ void Spell::SendResurrectRequest(Player* target)
: m_caster->GetNameForLocaleIdx(target->GetSession()->GetSessionDbLocaleIndex()));
WorldPacket data(SMSG_RESURRECT_REQUEST, (8 + 4 + sentName.size() + 1 + 1 + 1 + 4));
data << uint64(m_caster->GetGUID());
data << m_caster->GetGUID();
data << uint32(sentName.size() + 1);
data << sentName;
@@ -4756,7 +4758,7 @@ void Spell::TakeCastItem()
{
// This code is to avoid a crash
// I'm not sure, if this is really an error, but I guess every item needs a prototype
LOG_ERROR("server", "Cast item has no item prototype highId=%d, lowId=%d", m_CastItem->GetGUIDHigh(), m_CastItem->GetGUIDLow());
LOG_ERROR("server", "Cast item has no item prototype %s", m_CastItem->GetGUID().ToString().c_str());
return;
}
@@ -4800,7 +4802,7 @@ void Spell::TakeCastItem()
m_targets.SetItemTarget(nullptr);
m_CastItem = nullptr;
m_castItemGUID = 0;
m_castItemGUID.Clear();
}
}
@@ -4819,7 +4821,7 @@ void Spell::TakePower()
if (m_caster->GetTypeId() == TYPEID_PLAYER)
{
if (PowerType == POWER_RAGE || PowerType == POWER_ENERGY || PowerType == POWER_RUNE || PowerType == POWER_RUNIC_POWER)
if (uint64 targetGUID = m_targets.GetUnitTargetGUID())
if (ObjectGuid targetGUID = m_targets.GetUnitTargetGUID())
for (std::list<TargetInfo>::iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit)
if (ihit->targetGUID == targetGUID)
{
@@ -5056,7 +5058,7 @@ void Spell::TakeReagents()
}
m_CastItem = nullptr;
m_castItemGUID = 0;
m_castItemGUID.Clear();
}
// if GetItemTarget is also spell reagent
@@ -5767,7 +5769,7 @@ SpellCastResult Spell::CheckCast(bool strict)
if (m_targets.GetTargetMask() & TARGET_FLAG_TRADE_ITEM)
{
if (TradeData* pTrade = m_caster->ToPlayer()->GetTradeData())
pTempItem = pTrade->GetTraderData()->GetItem(TradeSlots(m_targets.GetItemTargetGUID()));
pTempItem = pTrade->GetTraderData()->GetItem(TradeSlots(m_targets.GetItemTargetGUID().GetRawValue()));
}
else if (m_targets.GetTargetMask() & TARGET_FLAG_ITEM)
pTempItem = m_caster->ToPlayer()->GetItemByGuid(m_targets.GetItemTargetGUID());
@@ -6053,7 +6055,7 @@ SpellCastResult Spell::CheckCast(bool strict)
if (target->GetCharmerGUID())
return SPELL_FAILED_CHARMED;
if (target->GetOwnerGUID() && IS_PLAYER_GUID(target->GetOwnerGUID()))
if (target->GetOwnerGUID() && target->GetOwnerGUID().IsPlayer())
return SPELL_FAILED_TARGET_IS_PLAYER_CONTROLLED;
if (target->IsPet() && (!target->GetOwner() || target->GetOwner()->ToPlayer()))
@@ -6156,7 +6158,7 @@ SpellCastResult Spell::CheckCast(bool strict)
if (!my_trade)
return SPELL_FAILED_NOT_TRADING;
TradeSlots slot = TradeSlots(m_targets.GetItemTargetGUID());
TradeSlots slot = TradeSlots(m_targets.GetItemTargetGUID().GetRawValue());
if (slot != TRADE_SLOT_NONTRADED)
return SPELL_FAILED_BAD_TARGETS;
@@ -6375,7 +6377,7 @@ SpellCastResult Spell::CheckCasterAuras(bool preventionOnly) const
bool Spell::CanAutoCast(Unit* target)
{
uint64 targetguid = target->GetGUID();
ObjectGuid targetguid = target->GetGUID();
for (uint32 j = 0; j < MAX_SPELL_EFFECTS; ++j)
{
@@ -6436,7 +6438,7 @@ SpellCastResult Spell::CheckRange(bool strict)
float min_range = m_caster->GetSpellMinRangeForTarget(target, m_spellInfo);
// xinef: hack for npc shooters
if (min_range && GetCaster()->GetTypeId() == TYPEID_UNIT && !IS_PLAYER_GUID(GetCaster()->GetOwnerGUID()) && min_range <= 6.0f)
if (min_range && GetCaster()->GetTypeId() == TYPEID_UNIT && !GetCaster()->GetOwnerGUID().IsPlayer() && min_range <= 6.0f)
range_type = SPELL_RANGE_RANGED;
if (Player* modOwner = m_caster->GetSpellModOwner())
@@ -7158,7 +7160,7 @@ void Spell::Delayed() // only called in DealDamage()
#endif
WorldPacket data(SMSG_SPELL_DELAYED, 8 + 4);
data.append(m_caster->GetPackGUID());
data << m_caster->GetPackGUID();
data << uint32(delaytime);
m_caster->SendMessageToSet(&data, true);
@@ -7368,7 +7370,7 @@ bool Spell::CheckEffectTarget(Unit const* target, uint32 eff) const
default: // normal case
// Get GO cast coordinates if original caster -> GO
WorldObject* caster = nullptr;
if (IS_GAMEOBJECT_GUID(m_originalCasterGUID))
if (m_originalCasterGUID.IsGameObject())
caster = m_caster->GetMap()->GetGameObject(m_originalCasterGUID);
if (!caster)
caster = m_caster;
@@ -7452,8 +7454,8 @@ SpellEvent::~SpellEvent()
}
else
{
LOG_ERROR("server", "~SpellEvent: %s %u tried to delete non-deletable spell %u. Was not deleted, causes memory leak.",
(m_Spell->GetCaster()->GetTypeId() == TYPEID_PLAYER ? "Player" : "Creature"), m_Spell->GetCaster()->GetGUIDLow(), m_Spell->m_spellInfo->Id);
LOG_ERROR("server", "~SpellEvent: %s %s tried to delete non-deletable spell %u. Was not deleted, causes memory leak.",
(m_Spell->GetCaster()->GetTypeId() == TYPEID_PLAYER ? "Player" : "Creature"), m_Spell->GetCaster()->GetGUID().ToString().c_str(), m_Spell->m_spellInfo->Id);
ABORT();
}
}
@@ -7535,10 +7537,9 @@ bool SpellEvent::IsDeletable() const
bool ReflectEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/)
{
Unit* caster = ObjectAccessor::FindUnit(_casterGUID);
Unit* target = ObjectAccessor::FindUnit(_targetGUID);
if (caster && target && caster->IsInMap(target))
caster->ProcDamageAndSpell(target, PROC_FLAG_NONE, PROC_FLAG_TAKEN_SPELL_MAGIC_DMG_CLASS_NEG, PROC_EX_REFLECT, 1, BASE_ATTACK, _spellInfo);
Unit* target = ObjectAccessor::GetUnit(*_caster, _targetGUID);
if (target && _caster->IsInMap(target))
_caster->ProcDamageAndSpell(target, PROC_FLAG_NONE, PROC_FLAG_TAKEN_SPELL_MAGIC_DMG_CLASS_NEG, PROC_EX_REFLECT, 1, BASE_ATTACK, _spellInfo);
return true;
}

View File

@@ -87,7 +87,7 @@ struct SpellDestination
void RelocateOffset(Position const& offset);
WorldLocation _position;
uint64 _transportGUID;
ObjectGuid _transportGUID;
Position _transportOffset;
};
@@ -105,23 +105,23 @@ public:
void SetTargetFlag(SpellCastTargetFlags flag) { m_targetMask |= flag; }
uint64 GetUnitTargetGUID() const;
ObjectGuid GetUnitTargetGUID() const;
Unit* GetUnitTarget() const;
void SetUnitTarget(Unit* target);
uint64 GetGOTargetGUID() const;
ObjectGuid GetGOTargetGUID() const;
GameObject* GetGOTarget() const;
void SetGOTarget(GameObject* target);
uint64 GetCorpseTargetGUID() const;
ObjectGuid GetCorpseTargetGUID() const;
Corpse* GetCorpseTarget() const;
void SetCorpseTarget(Corpse* target);
WorldObject* GetObjectTarget() const;
uint64 GetObjectTargetGUID() const;
ObjectGuid GetObjectTargetGUID() const;
void RemoveObjectTarget();
uint64 GetItemTargetGUID() const { return m_itemTargetGUID; }
ObjectGuid GetItemTargetGUID() const { return m_itemTargetGUID; }
Item* GetItemTarget() const { return m_itemTarget; }
uint32 GetItemTargetEntry() const { return m_itemTargetEntry; }
void SetItemTarget(Item* item);
@@ -164,7 +164,7 @@ public:
void OutDebug() const;
// Xinef: Channel data
void SetObjectTargetChannel(uint64 targetGUID);
void SetObjectTargetChannel(ObjectGuid targetGUID);
void SetDstChannel(SpellDestination const& spellDest);
WorldObject* GetObjectTargetChannel(Unit* caster) const;
bool HasDstChannel() const;
@@ -178,8 +178,8 @@ private:
Item* m_itemTarget;
// object GUID/etc, can be used always
uint64 m_objectTargetGUID;
uint64 m_itemTargetGUID;
ObjectGuid m_objectTargetGUID;
ObjectGuid m_itemTargetGUID;
uint32 m_itemTargetEntry;
SpellDestination m_src;
@@ -190,7 +190,7 @@ private:
// Xinef: Save channel data
SpellDestination m_dstChannel;
uint64 m_objectTargetGUIDChannel;
ObjectGuid m_objectTargetGUIDChannel;
};
struct SpellValue
@@ -224,20 +224,20 @@ enum SpellEffectHandleMode
// Xinef: special structure containing data for channel target spells
struct ChannelTargetData
{
ChannelTargetData(uint64 cguid, const SpellDestination* dst) : channelGUID(cguid)
ChannelTargetData(ObjectGuid cguid, const SpellDestination* dst) : channelGUID(cguid)
{
if (dst)
spellDst = *dst;
}
uint64 channelGUID;
ObjectGuid channelGUID;
SpellDestination spellDst;
};
// Targets store structures and data
struct TargetInfo
{
uint64 targetGUID;
ObjectGuid targetGUID;
uint64 timeDelay;
SpellMissInfo missCondition:8;
SpellMissInfo reflectResult:8;
@@ -256,7 +256,7 @@ class Spell
friend void Unit::SetCurrentCastedSpell(Spell* pSpell);
friend class SpellScript;
public:
Spell(Unit* caster, SpellInfo const* info, TriggerCastFlags triggerFlags, uint64 originalCasterGUID = 0, bool skipCheck = false);
Spell(Unit* caster, SpellInfo const* info, TriggerCastFlags triggerFlags, ObjectGuid originalCasterGUID = ObjectGuid::Empty, bool skipCheck = false);
~Spell();
void EffectNULL(SpellEffIndex effIndex);
@@ -490,7 +490,7 @@ public:
SpellInfo const* m_spellInfo;
Item* m_CastItem;
uint64 m_castItemGUID;
ObjectGuid m_castItemGUID;
uint8 m_cast_count;
uint32 m_glyphIndex;
uint32 m_preCastSpell;
@@ -544,13 +544,13 @@ protected:
void TriggerGlobalCooldown();
void CancelGlobalCooldown();
void SendLoot(uint64 guid, LootType loottype);
void SendLoot(ObjectGuid guid, LootType loottype);
Unit* const m_caster;
SpellValue* const m_spellValue;
uint64 m_originalCasterGUID; // real source of cast (aura caster/etc), used for spell targets selection
ObjectGuid m_originalCasterGUID; // real source of cast (aura caster/etc), used for spell targets selection
// e.g. damage around area spell trigered by victim aura and damage enemies of aura caster
Unit* m_originalCaster; // cached pointer for m_originalCaster, updated at Spell::UpdatePointers()
@@ -629,7 +629,7 @@ protected:
struct GOTargetInfo
{
uint64 targetGUID;
ObjectGuid targetGUID;
uint64 timeDelay;
uint8 effectMask: 8;
bool processed: 1;
@@ -801,12 +801,12 @@ protected:
class ReflectEvent : public BasicEvent
{
public:
ReflectEvent(uint64 casterGUID, uint64 targetGUID, const SpellInfo* spellInfo) : _casterGUID(casterGUID), _targetGUID(targetGUID), _spellInfo(spellInfo) { }
ReflectEvent(Unit* caster, ObjectGuid targetGUID, const SpellInfo* spellInfo) : _caster(caster), _targetGUID(targetGUID), _spellInfo(spellInfo) { }
bool Execute(uint64 e_time, uint32 p_time) override;
protected:
uint64 _casterGUID;
uint64 _targetGUID;
Unit* _caster;
ObjectGuid _targetGUID;
const SpellInfo* _spellInfo;
};

View File

@@ -285,8 +285,8 @@ void Spell::EffectInstaKill(SpellEffIndex /*effIndex*/)
finish();
WorldPacket data(SMSG_SPELLINSTAKILLLOG, 8 + 8 + 4);
data << uint64(m_caster->GetGUID());
data << uint64(unitTarget->GetGUID());
data << m_caster->GetGUID();
data << unitTarget->GetGUID();
data << uint32(m_spellInfo->Id);
m_caster->SendMessageToSet(&data, true);
@@ -1141,7 +1141,7 @@ void Spell::EffectJumpDest(SpellEffIndex effIndex)
if (m_spellInfo->Id == 49376) // feral charge
{
speedXY = pow(speedZ * 10, 8);
m_caster->GetMotionMaster()->MoveJump(x, y, z, speedXY, speedZ, 0, ObjectAccessor::GetUnit(*m_caster, m_caster->GetUInt64Value(UNIT_FIELD_TARGET)));
m_caster->GetMotionMaster()->MoveJump(x, y, z, speedXY, speedZ, 0, ObjectAccessor::GetUnit(*m_caster, m_caster->GetGuidValue(UNIT_FIELD_TARGET)));
return;
}
@@ -1362,7 +1362,8 @@ void Spell::EffectUnlearnSpecialization(SpellEffIndex effIndex)
player->removeSpell(spellToUnlearn, SPEC_MASK_ALL, false);
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
LOG_DEBUG("spells.aura", "Spell: Player %u has unlearned spell %u from NpcGUID: %u", player->GetGUIDLow(), spellToUnlearn, m_caster->GetGUIDLow());
LOG_DEBUG("spells.aura", "Spell: Player %s has unlearned spell %u from Npc: %s",
player->GetGUID().ToString().c_str(), spellToUnlearn, m_caster->GetGUID().ToString().c_str());
#endif
}
@@ -1552,7 +1553,7 @@ void Spell::EffectHeal(SpellEffIndex /*effIndex*/)
if (!targetAura)
{
LOG_ERROR("server", "Target(GUID:" UI64FMTD ") has aurastate AURA_STATE_SWIFTMEND but no matching aura.", unitTarget->GetGUID());
LOG_ERROR("server", "Target(%s) has aurastate AURA_STATE_SWIFTMEND but no matching aura.", unitTarget->GetGUID().ToString().c_str());
return;
}
@@ -1773,7 +1774,7 @@ void Spell::DoCreateItem(uint8 /*effIndex*/, uint32 itemId)
// set the "Crafted by ..." property of the item
if (pItem->GetTemplate()->HasSignature())
pItem->SetUInt32Value(ITEM_FIELD_CREATOR, player->GetGUIDLow());
pItem->SetGuidValue(ITEM_FIELD_CREATOR, player->GetGUID());
// send info to the client
player->SendNewItem(pItem, addNumber, true, SelfCast);
@@ -1859,7 +1860,7 @@ void Spell::EffectPersistentAA(SpellEffIndex effIndex)
if (!caster->IsInWorld() || !caster->FindMap() || !ObjectAccessor::GetUnit(*caster, caster->GetGUID())) // pussywizard: temporary crash fix (FindMap and GetUnit are mine)
return;
DynamicObject* dynObj = new DynamicObject(false);
if (!dynObj->CreateDynamicObject(sObjectMgr->GenerateLowGuid(HIGHGUID_DYNAMICOBJECT), caster, m_spellInfo->Id, *destTarget, radius, DYNAMIC_OBJECT_AREA_SPELL))
if (!dynObj->CreateDynamicObject(caster->GetMap()->GenerateLowGuid<HighGuid::DynamicObject>(), caster, m_spellInfo->Id, *destTarget, radius, DYNAMIC_OBJECT_AREA_SPELL))
{
delete dynObj;
return;
@@ -2016,7 +2017,7 @@ void Spell::EffectEnergizePct(SpellEffIndex effIndex)
m_caster->EnergizeBySpell(unitTarget, m_spellInfo->Id, gain, power);
}
void Spell::SendLoot(uint64 guid, LootType loottype)
void Spell::SendLoot(ObjectGuid guid, LootType loottype)
{
Player* player = m_caster->ToPlayer();
if (!player)
@@ -2028,7 +2029,8 @@ void Spell::SendLoot(uint64 guid, LootType loottype)
if (!gameObjTarget->isSpawned() && !player->IsGameMaster())
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
LOG_ERROR("server", "Possible hacking attempt: Player %s [guid: %u] tried to loot a gameobject [entry: %u id: %u] which is on respawn time without being in GM mode!", player->GetName().c_str(), player->GetGUIDLow(), gameObjTarget->GetEntry(), gameObjTarget->GetGUIDLow());
LOG_ERROR("server", "Possible hacking attempt: Player %s [%s] tried to loot a gameobject [%s] which is on respawn time without being in GM mode!",
player->GetName().c_str(), player->GetGUID().ToString().c_str(), gameObjTarget->GetGUID().ToString().c_str());
#endif
return;
}
@@ -2099,7 +2101,7 @@ void Spell::EffectOpenLock(SpellEffIndex effIndex)
Player* player = m_caster->ToPlayer();
uint32 lockId = 0;
uint64 guid = 0;
ObjectGuid guid;
// Get lockId
if (gameObjTarget)
@@ -2138,7 +2140,7 @@ void Spell::EffectOpenLock(SpellEffIndex effIndex)
// TODO: Add script for spell 41920 - Filling, becouse server it freze when use this spell
// handle outdoor pvp object opening, return true if go was registered for handling
// these objects must have been spawned by outdoorpvp!
else if (gameObjTarget->GetGOInfo()->type == GAMEOBJECT_TYPE_GOOBER && sOutdoorPvPMgr->HandleOpenGo(player, gameObjTarget->GetGUID()))
else if (gameObjTarget->GetGOInfo()->type == GAMEOBJECT_TYPE_GOOBER && sOutdoorPvPMgr->HandleOpenGo(player, gameObjTarget))
return;
lockId = goInfo->GetLockId();
guid = gameObjTarget->GetGUID();
@@ -2185,9 +2187,8 @@ void Spell::EffectOpenLock(SpellEffIndex effIndex)
if (gameObjTarget)
{
// Allow one skill-up until respawned
if (!gameObjTarget->IsInSkillupList(player->GetGUIDLow()) &&
player->UpdateGatherSkill(skillId, pureSkillValue, reqSkillValue))
gameObjTarget->AddToSkillupList(player->GetGUIDLow());
if (!gameObjTarget->IsInSkillupList(player->GetGUID()) && player->UpdateGatherSkill(skillId, pureSkillValue, reqSkillValue))
gameObjTarget->AddToSkillupList(player->GetGUID());
}
else if (itemTarget)
{
@@ -2250,7 +2251,7 @@ void Spell::EffectSummonChangeItem(SpellEffIndex effIndex)
m_targets.SetItemTarget(nullptr);
m_CastItem = nullptr;
m_castItemGUID = 0;
m_castItemGUID.Clear();
player->StoreItem(dest, pNewItem, true);
player->ItemAddedQuestCheck(pNewItem->GetEntry(), 1);
@@ -2270,7 +2271,7 @@ void Spell::EffectSummonChangeItem(SpellEffIndex effIndex)
m_targets.SetItemTarget(nullptr);
m_CastItem = nullptr;
m_castItemGUID = 0;
m_castItemGUID.Clear();
player->BankItem(dest, pNewItem, true);
return;
@@ -2293,7 +2294,7 @@ void Spell::EffectSummonChangeItem(SpellEffIndex effIndex)
m_targets.SetItemTarget(nullptr);
m_CastItem = nullptr;
m_castItemGUID = 0;
m_castItemGUID.Clear();
player->EquipItem(dest, pNewItem, true);
player->AutoUnequipOffhandIfNeed();
@@ -2555,11 +2556,12 @@ void Spell::EffectLearnSpell(SpellEffIndex effIndex)
player->learnSpell(spellToLearn);
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
LOG_DEBUG("spells.aura", "Spell: Player %u has learned spell %u from NpcGUID=%u", player->GetGUIDLow(), spellToLearn, m_caster->GetGUIDLow());
LOG_DEBUG("spells.aura", "Spell: Player %s has learned spell %u from Npc %s",
player->GetGUID().ToString().c_str(), spellToLearn, m_caster->GetGUID().ToString().c_str());
#endif
}
typedef std::list< std::pair<uint32, uint64> > DispelList;
typedef std::list<std::pair<uint32, ObjectGuid>> DispelList;
void Spell::EffectDispel(SpellEffIndex effIndex)
{
if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET)
@@ -2619,12 +2621,12 @@ void Spell::EffectDispel(SpellEffIndex effIndex)
if (!failCount)
{
// Failed to dispell
dataFail << uint64(m_caster->GetGUID()); // Caster GUID
dataFail << uint64(unitTarget->GetGUID()); // Victim GUID
dataFail << m_caster->GetGUID(); // Caster GUID
dataFail << unitTarget->GetGUID(); // Victim GUID
dataFail << uint32(m_spellInfo->Id); // dispel spell id
}
++failCount;
dataFail << uint32(itr->first->GetId()); // Spell Id
dataFail << uint32(itr->first->GetId()); // Spell Id
}
++count;
}
@@ -2642,8 +2644,8 @@ void Spell::EffectDispel(SpellEffIndex effIndex)
WorldPacket dataSuccess(SMSG_SPELLDISPELLOG, 8 + 8 + 4 + 1 + 4 + success_list.size() * 5);
// Send packet header
dataSuccess.append(unitTarget->GetPackGUID()); // Victim GUID
dataSuccess.append(m_caster->GetPackGUID()); // Caster GUID
dataSuccess << unitTarget->GetPackGUID(); // Victim GUID
dataSuccess << m_caster->GetPackGUID(); // Caster GUID
dataSuccess << uint32(m_spellInfo->Id); // dispel spell id
dataSuccess << uint8(0); // not used
dataSuccess << uint32(success_list.size()); // count
@@ -2735,7 +2737,7 @@ void Spell::EffectAddFarsight(SpellEffIndex effIndex)
return;
DynamicObject* dynObj = new DynamicObject(true);
if (!dynObj->CreateDynamicObject(sObjectMgr->GenerateLowGuid(HIGHGUID_DYNAMICOBJECT), m_caster, m_spellInfo->Id, *destTarget, radius, DYNAMIC_OBJECT_FARSIGHT_FOCUS))
if (!dynObj->CreateDynamicObject(m_caster->GetMap()->GenerateLowGuid<HighGuid::DynamicObject>(), m_caster, m_spellInfo->Id, *destTarget, radius, DYNAMIC_OBJECT_FARSIGHT_FOCUS))
{
delete dynObj;
return;
@@ -2753,7 +2755,7 @@ void Spell::EffectUntrainTalents(SpellEffIndex /*effIndex*/)
if (!unitTarget || m_caster->GetTypeId() == TYPEID_PLAYER)
return;
if (uint64 guid = m_caster->GetGUID()) // the trainer is the caster
if (ObjectGuid guid = m_caster->GetGUID()) // the trainer is the caster
unitTarget->ToPlayer()->SendTalentWipeConfirm(guid);
}
@@ -2800,7 +2802,8 @@ void Spell::EffectAddHonor(SpellEffIndex /*effIndex*/)
{
unitTarget->ToPlayer()->RewardHonor(nullptr, 1, damage / 10, false);
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
LOG_DEBUG("spells.aura", "SpellEffect::AddHonor (spell_id %u) rewards %d honor points (item %u) for player: %u", m_spellInfo->Id, damage / 10, m_CastItem->GetEntry(), unitTarget->ToPlayer()->GetGUIDLow());
LOG_DEBUG("spells.aura", "SpellEffect::AddHonor (spell_id %u) rewards %d honor points (item %u) for player: %s",
m_spellInfo->Id, damage / 10, m_CastItem->GetEntry(), unitTarget->ToPlayer()->GetGUID().ToString().c_str());
#endif
return;
}
@@ -2811,7 +2814,8 @@ void Spell::EffectAddHonor(SpellEffIndex /*effIndex*/)
uint32 honor_reward = acore::Honor::hk_honor_at_level(unitTarget->getLevel(), float(damage));
unitTarget->ToPlayer()->RewardHonor(nullptr, 1, honor_reward, false);
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
LOG_DEBUG("spells.aura", "SpellEffect::AddHonor (spell_id %u) rewards %u honor points (scale) to player: %u", m_spellInfo->Id, honor_reward, unitTarget->ToPlayer()->GetGUIDLow());
LOG_DEBUG("spells.aura", "SpellEffect::AddHonor (spell_id %u) rewards %u honor points (scale) to player: %s",
m_spellInfo->Id, honor_reward, unitTarget->ToPlayer()->GetGUID().ToString().c_str());
#endif
}
else
@@ -2819,7 +2823,8 @@ void Spell::EffectAddHonor(SpellEffIndex /*effIndex*/)
//maybe we have correct honor_gain in damage already
unitTarget->ToPlayer()->RewardHonor(nullptr, 1, damage, false);
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
LOG_DEBUG("spells.aura", "SpellEffect::AddHonor (spell_id %u) rewards %u honor points (non scale) for player: %u", m_spellInfo->Id, damage, unitTarget->ToPlayer()->GetGUIDLow());
LOG_DEBUG("spells.aura", "SpellEffect::AddHonor (spell_id %u) rewards %u honor points (non scale) for player: %s",
m_spellInfo->Id, damage, unitTarget->ToPlayer()->GetGUID().ToString().c_str());
#endif
}
}
@@ -3739,7 +3744,7 @@ void Spell::EffectSummonObjectWild(SpellEffIndex effIndex)
Map* map = target->GetMap();
if (!pGameObj->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_GAMEOBJECT), gameobject_id, map, m_caster->GetPhaseMask(), x, y, z, target->GetOrientation(), G3D::Quat(), 100, GO_STATE_READY))
if (!pGameObj->Create(map->GenerateLowGuid<HighGuid::GameObject>(), gameobject_id, map, m_caster->GetPhaseMask(), x, y, z, target->GetOrientation(), G3D::Quat(), 100, GO_STATE_READY))
{
delete pGameObj;
return;
@@ -3763,7 +3768,7 @@ void Spell::EffectSummonObjectWild(SpellEffIndex effIndex)
if (uint32 linkedEntry = pGameObj->GetGOInfo()->GetLinkedGameObjectEntry())
{
GameObject* linkedGO = sObjectMgr->IsGameObjectStaticTransport(linkedEntry) ? new StaticTransport() : new GameObject();
if (linkedGO->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_GAMEOBJECT), linkedEntry, map, m_caster->GetPhaseMask(), x, y, z, target->GetOrientation(), G3D::Quat(), 100, GO_STATE_READY))
if (linkedGO->Create(map->GenerateLowGuid<HighGuid::GameObject>(), linkedEntry, map, m_caster->GetPhaseMask(), x, y, z, target->GetOrientation(), G3D::Quat(), 100, GO_STATE_READY))
{
linkedGO->SetRespawnTime(duration > 0 ? duration / IN_MILLISECONDS : 0);
linkedGO->SetSpellId(m_spellInfo->Id);
@@ -4348,7 +4353,7 @@ void Spell::EffectDuel(SpellEffIndex effIndex)
Player* target = unitTarget->ToPlayer();
// caster or target already have requested duel
if (caster->duel || target->duel || !target->GetSocial() || target->GetSocial()->HasIgnore(caster->GetGUIDLow()))
if (caster->duel || target->duel || !target->GetSocial() || target->GetSocial()->HasIgnore(caster->GetGUID()))
return;
// Players can only fight a duel in zones with this flag
@@ -4371,7 +4376,7 @@ void Spell::EffectDuel(SpellEffIndex effIndex)
GameObject* pGameObj = sObjectMgr->IsGameObjectStaticTransport(gameobject_id) ? new StaticTransport() : new GameObject();
Map* map = m_caster->GetMap();
if (!pGameObj->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_GAMEOBJECT), gameobject_id,
if (!pGameObj->Create(map->GenerateLowGuid<HighGuid::GameObject>(), gameobject_id,
map, m_caster->GetPhaseMask(),
m_caster->GetPositionX() + (unitTarget->GetPositionX() - m_caster->GetPositionX()) / 2,
m_caster->GetPositionY() + (unitTarget->GetPositionY() - m_caster->GetPositionY()) / 2,
@@ -4396,8 +4401,8 @@ void Spell::EffectDuel(SpellEffIndex effIndex)
// Send request
WorldPacket data(SMSG_DUEL_REQUESTED, 8 + 8);
data << uint64(pGameObj->GetGUID());
data << uint64(caster->GetGUID());
data << pGameObj->GetGUID();
data << caster->GetGUID();
caster->GetSession()->SendPacket(&data);
target->GetSession()->SendPacket(&data);
@@ -4418,8 +4423,8 @@ void Spell::EffectDuel(SpellEffIndex effIndex)
duel2->isMounted = (GetSpellInfo()->Id == 62875); // Mounted Duel
target->duel = duel2;
caster->SetUInt64Value(PLAYER_DUEL_ARBITER, pGameObj->GetGUID());
target->SetUInt64Value(PLAYER_DUEL_ARBITER, pGameObj->GetGUID());
caster->SetGuidValue(PLAYER_DUEL_ARBITER, pGameObj->GetGUID());
target->SetGuidValue(PLAYER_DUEL_ARBITER, pGameObj->GetGUID());
sScriptMgr->OnPlayerDuelRequest(target, caster);
}
@@ -4484,9 +4489,9 @@ void Spell::EffectSummonPlayer(SpellEffIndex /*effIndex*/)
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
data << 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);
}
@@ -4738,8 +4743,8 @@ void Spell::EffectSummonObject(SpellEffIndex effIndex)
if (m_caster)
{
uint64 guid = m_caster->m_ObjectSlot[slot];
if (guid != 0)
ObjectGuid guid = m_caster->m_ObjectSlot[slot];
if (guid)
{
if (GameObject* gameObject = m_caster->GetMap()->GetGameObject(guid))
{
@@ -4748,7 +4753,7 @@ void Spell::EffectSummonObject(SpellEffIndex effIndex)
gameObject->SetSpellId(0);
m_caster->RemoveGameObject(gameObject, true);
}
m_caster->m_ObjectSlot[slot] = 0;
m_caster->m_ObjectSlot[slot].Clear();
}
}
@@ -4763,7 +4768,7 @@ void Spell::EffectSummonObject(SpellEffIndex effIndex)
m_caster->GetClosePoint(x, y, z, DEFAULT_WORLD_OBJECT_SIZE);
Map* map = m_caster->GetMap();
if (!pGameObj->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_GAMEOBJECT), gameobjectId, map, m_caster->GetPhaseMask(), x, y, z, m_caster->GetOrientation(), G3D::Quat(), 0, GO_STATE_READY))
if (!pGameObj->Create(map->GenerateLowGuid<HighGuid::GameObject>(), gameobjectId, map, m_caster->GetPhaseMask(), x, y, z, m_caster->GetOrientation(), G3D::Quat(), 0, GO_STATE_READY))
{
delete pGameObj;
return;
@@ -4913,7 +4918,7 @@ void Spell::EffectForceDeselect(SpellEffIndex /*effIndex*/)
m_caster->SendClearTarget();
WorldPacket data(SMSG_CLEAR_TARGET, 8);
data << uint64(m_caster->GetGUID());
data << m_caster->GetGUID();
float dist = m_caster->GetVisibilityRange() + VISIBILITY_COMPENSATION;
acore::MessageDistDelivererToHostile notifier(m_caster, &data, dist);
@@ -5269,7 +5274,7 @@ void Spell::EffectDispelMechanic(SpellEffIndex effIndex)
uint32 mechanic = m_spellInfo->Effects[effIndex].MiscValue;
std::queue < std::pair < uint32, uint64 > > dispel_list;
std::queue<std::pair<uint32, ObjectGuid>> dispel_list;
Unit::AuraMap const& auras = unitTarget->GetOwnedAuras();
for (Unit::AuraMap::const_iterator itr = auras.begin(); itr != auras.end(); ++itr)
@@ -5312,7 +5317,7 @@ void Spell::EffectResurrectPet(SpellEffIndex /*effIndex*/)
player->GetPosition(x, y, z);
if (!pet)
{
player->SummonPet(0, x, y, z, player->GetOrientation(), SUMMON_PET, 0, 0, (uint64)damage, PET_LOAD_SUMMON_DEAD_PET);
player->SummonPet(0, x, y, z, player->GetOrientation(), SUMMON_PET, 0, 0, ObjectGuid((uint64)damage), PET_LOAD_SUMMON_DEAD_PET);
return;
}
@@ -5482,7 +5487,7 @@ void Spell::EffectTransmitted(SpellEffIndex effIndex)
GameObject* pGameObj = sObjectMgr->IsGameObjectStaticTransport(name_id) ? new StaticTransport() : new GameObject();
if (!pGameObj->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_GAMEOBJECT), name_id, cMap, m_caster->GetPhaseMask(), fx, fy, fz, m_caster->GetOrientation(), G3D::Quat(), 100, GO_STATE_READY))
if (!pGameObj->Create(cMap->GenerateLowGuid<HighGuid::GameObject>(), name_id, cMap, m_caster->GetPhaseMask(), fx, fy, fz, m_caster->GetOrientation(), G3D::Quat(), 100, GO_STATE_READY))
{
delete pGameObj;
return;
@@ -5494,7 +5499,7 @@ void Spell::EffectTransmitted(SpellEffIndex effIndex)
{
case GAMEOBJECT_TYPE_FISHINGNODE:
{
m_caster->SetUInt64Value(UNIT_FIELD_CHANNEL_OBJECT, pGameObj->GetGUID());
m_caster->SetGuidValue(UNIT_FIELD_CHANNEL_OBJECT, pGameObj->GetGUID());
m_caster->AddGameObject(pGameObj); // will removed at spell cancel
// end time of range when possible catch fish (FISHING_BOBBER_READY_TIME..GetDuration(m_spellInfo))
@@ -5556,7 +5561,7 @@ void Spell::EffectTransmitted(SpellEffIndex effIndex)
if (uint32 linkedEntry = pGameObj->GetGOInfo()->GetLinkedGameObjectEntry())
{
GameObject* linkedGO = sObjectMgr->IsGameObjectStaticTransport(linkedEntry) ? new StaticTransport() : new GameObject();
if (linkedGO->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_GAMEOBJECT), linkedEntry, cMap, m_caster->GetPhaseMask(), fx, fy, fz, m_caster->GetOrientation(), G3D::Quat(), 100, GO_STATE_READY))
if (linkedGO->Create(cMap->GenerateLowGuid<HighGuid::GameObject>(), linkedEntry, cMap, m_caster->GetPhaseMask(), fx, fy, fz, m_caster->GetOrientation(), G3D::Quat(), 100, GO_STATE_READY))
{
linkedGO->SetRespawnTime(duration > 0 ? duration / IN_MILLISECONDS : 0);
linkedGO->SetSpellId(m_spellInfo->Id);
@@ -5748,12 +5753,12 @@ void Spell::EffectStealBeneficialBuff(SpellEffIndex effIndex)
if (!failCount)
{
// Failed to dispell
dataFail << uint64(m_caster->GetGUID()); // Caster GUID
dataFail << uint64(unitTarget->GetGUID()); // Victim GUID
dataFail << m_caster->GetGUID(); // Caster GUID
dataFail << unitTarget->GetGUID(); // Victim GUID
dataFail << uint32(m_spellInfo->Id); // dispel spell id
}
++failCount;
dataFail << uint32(itr->first->GetId()); // Spell Id
dataFail << uint32(itr->first->GetId()); // Spell Id
}
++count;
}
@@ -5766,8 +5771,8 @@ void Spell::EffectStealBeneficialBuff(SpellEffIndex effIndex)
return;
WorldPacket dataSuccess(SMSG_SPELLSTEALLOG, 8 + 8 + 4 + 1 + 4 + damage * 5);
dataSuccess.append(unitTarget->GetPackGUID()); // Victim GUID
dataSuccess.append(m_caster->GetPackGUID()); // Caster GUID
dataSuccess << unitTarget->GetPackGUID(); // Victim GUID
dataSuccess << m_caster->GetPackGUID(); // Caster GUID
dataSuccess << uint32(m_spellInfo->Id); // dispel spell id
dataSuccess << uint8(0); // not used
dataSuccess << uint32(success_list.size()); // count
@@ -5788,7 +5793,7 @@ void Spell::EffectKillCreditPersonal(SpellEffIndex effIndex)
if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER)
return;
unitTarget->ToPlayer()->KilledMonsterCredit(m_spellInfo->Effects[effIndex].MiscValue, 0);
unitTarget->ToPlayer()->KilledMonsterCredit(m_spellInfo->Effects[effIndex].MiscValue);
}
void Spell::EffectKillCredit(SpellEffIndex effIndex)
@@ -6344,7 +6349,7 @@ void Spell::EffectBind(SpellEffIndex effIndex)
#endif
// zone update
data.Initialize(SMSG_PLAYERBOUND, 8 + 4);
data << uint64(m_caster->GetGUID());
data << m_caster->GetGUID();
data << uint32(areaId);
player->SendDirectMessage(&data);
}
@@ -6361,7 +6366,7 @@ void Spell::EffectSummonRaFFriend(SpellEffIndex /*effIndex*/)
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 << 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);

View File

@@ -982,7 +982,7 @@ uint32 AuraScript::GetId() const
return m_aura->GetId();
}
uint64 AuraScript::GetCasterGUID() const
ObjectGuid AuraScript::GetCasterGUID() const
{
return m_aura->GetCasterGUID();
}

View File

@@ -801,7 +801,7 @@ public:
uint32 GetId() const;
// returns guid of object which casted the aura (m_originalCaster of the Spell class)
uint64 GetCasterGUID() const;
ObjectGuid GetCasterGUID() const;
// returns unit which casted the aura or nullptr if not avalible (caster logged out for example)
Unit* GetCaster() const;
// returns object on which aura was casted, target for non-area auras, area aura source for area auras