Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Code Reference #163

Merged
merged 4 commits into from
Sep 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/server/game/Entities/Player/Player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8003,7 +8003,7 @@ void Player::CastItemCombatSpell(DamageInfo const& damageInfo, Item* item, ItemT
if (!(damageInfo.GetHitMask() & (PROC_HIT_NORMAL | PROC_HIT_CRITICAL | PROC_HIT_ABSORB)))
return false;

if (damageInfo.GetSpellInfo() && damageInfo.GetSpellInfo()->HasAttribute(SPELL_ATTR3_CANT_TRIGGER_CASTER_PROCS))
if (damageInfo.GetSpellInfo() && damageInfo.GetSpellInfo()->HasAttribute(SPELL_ATTR3_SUPPRESS_CASTER_PROCS))
return false;

return true;
Expand Down Expand Up @@ -23429,7 +23429,7 @@ Unit* Player::GetSelectedUnit() const
Player* Player::GetSelectedPlayer() const
{
if (ObjectGuid selectionGUID = GetTarget())
return ObjectAccessor::GetPlayer(*this, selectionGUID);
return ObjectAccessor::FindConnectedPlayer(selectionGUID);
return nullptr;
}

Expand Down
14 changes: 14 additions & 0 deletions src/server/game/Maps/Map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3377,8 +3377,22 @@ bool Map::IsSpawnGroupActive(uint32 groupId) const
return (_toggledSpawnGroupIds.find(groupId) != _toggledSpawnGroupIds.end()) != !(data->flags & SPAWNGROUP_FLAG_MANUAL_SPAWN);
}

void Map::AddFarSpellCallback(FarSpellCallback&& callback)
{
_farSpellCallbacks.Enqueue(new FarSpellCallback(std::move(callback)));
}

void Map::DelayedUpdate(uint32 t_diff)
{
{
FarSpellCallback* callback;
while (_farSpellCallbacks.Dequeue(callback))
{
(*callback)(this);
delete callback;
}
}

RemoveAllObjectsInRemoveList();

// Don't unload grids if it's battleground, since we may have manually added GOs, creatures, those doesn't load from DB at grid re-load !
Expand Down
5 changes: 5 additions & 0 deletions src/server/game/Maps/Map.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include "Cell.h"
#include "DynamicTree.h"
#include "GridDefines.h"
#include "MPSCQueue.h"
#include "GridRefManager.h"
#include "MapRefManager.h"
#include "ObjectGuid.h"
Expand Down Expand Up @@ -885,6 +886,9 @@ class FC_GAME_API Map : public GridRefManager<NGridType>

// Disable the spawn group, which prevents any creatures in the group from respawning until re-enabled
// This will not affect any already-present creatures in the group
typedef std::function<void(Map*)> FarSpellCallback;
void AddFarSpellCallback(FarSpellCallback&& callback);

void SetSpawnGroupInactive(uint32 groupId) { SetSpawnGroupActive(groupId, false); }

// Sets and stores world state values that will be used by the AchievementMgr to check additional criterias that require world state values
Expand Down Expand Up @@ -979,6 +983,7 @@ class FC_GAME_API Map : public GridRefManager<NGridType>
std::unordered_set<Object*> _updateObjects;

std::unordered_map<uint32 /*worldStateId*/, int32 /*value*/> _worldStates;
MPSCQueue<FarSpellCallback> _farSpellCallbacks;
};

enum InstanceResetMethod
Expand Down
4 changes: 2 additions & 2 deletions src/server/game/Miscellaneous/SharedDefines.h
Original file line number Diff line number Diff line change
Expand Up @@ -475,8 +475,8 @@ enum SpellAttr3
SPELL_ATTR3_DONT_DISPLAY_CHANNEL_BAR = 0x00002000, // 13 Clientside attribute - will not display channeling bar
SPELL_ATTR3_IS_HONORLESS_TARGET = 0x00004000, // 14 "Honorless Target" only this spells have this flag
SPELL_ATTR3_UNK15 = 0x00008000, // 15 Auto Shoot, Shoot, Throw, - this is autoshot flag
SPELL_ATTR3_CANT_TRIGGER_CASTER_PROCS = 0x00010000, // 16 Suppress Caster Procs
SPELL_ATTR3_CANT_TRIGGER_TARGET_PROCS = 0x00020000, // 17 Suppress Target Procs
SPELL_ATTR3_SUPPRESS_CASTER_PROCS = 0x00010000, // 16 Suppress Caster Procs
SPELL_ATTR3_SUPPRESS_TARGET_PROCS = 0x00020000, // 17 Suppress Target Procs
SPELL_ATTR3_IGNORE_HIT_RESULT = 0x00040000, // 18 Spell should always hit its target
SPELL_ATTR3_DISABLE_PROC = 0x00080000, // 19 during aura proc no spells can trigger (20178, 20375)
SPELL_ATTR3_DEATH_PERSISTENT = 0x00100000, // 20 Death persistent spells
Expand Down
39 changes: 11 additions & 28 deletions src/server/game/Spells/Auras/SpellAuraEffects.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5892,18 +5892,14 @@ void AuraEffect::HandlePeriodicDamageAurasTick(Unit* target, Unit* caster) const
Unit::DealDamageMods(target, damage, &absorb);

// Set trigger flag
uint32 procAttacker = PROC_FLAG_NONE, procVictim = PROC_FLAG_NONE;
if (!m_spellInfo->HasAttribute(SPELL_ATTR3_CANT_TRIGGER_CASTER_PROCS))
procAttacker = PROC_FLAG_DEAL_PERIODIC;
if (!m_spellInfo->HasAttribute(SPELL_ATTR3_CANT_TRIGGER_TARGET_PROCS))
procVictim = PROC_FLAG_TAKE_PERIODIC;
uint32 procAttacker = PROC_FLAG_DEAL_PERIODIC;
uint32 procVictim = PROC_FLAG_TAKE_PERIODIC;

uint32 hitMask = damageInfo.GetHitMask();
if (damage)
{
hitMask |= crit ? PROC_HIT_CRITICAL : PROC_HIT_NORMAL;
if (!m_spellInfo->HasAttribute(SPELL_ATTR3_CANT_TRIGGER_TARGET_PROCS))
procVictim |= PROC_FLAG_TAKE_ANY_DAMAGE;
procVictim |= PROC_FLAG_TAKE_ANY_DAMAGE;
}

int32 overkill = damage - target->GetHealth();
Expand Down Expand Up @@ -5994,19 +5990,14 @@ void AuraEffect::HandlePeriodicHealthLeechAuraTick(Unit* target, Unit* caster) c
damage = damageInfo.GetDamage();

// Set trigger flag
uint32 procAttacker = PROC_FLAG_NONE, procVictim = PROC_FLAG_NONE;
if (!m_spellInfo->HasAttribute(SPELL_ATTR3_CANT_TRIGGER_CASTER_PROCS))
procAttacker = PROC_FLAG_DEAL_PERIODIC;
if (!m_spellInfo->HasAttribute(SPELL_ATTR3_CANT_TRIGGER_TARGET_PROCS))
procVictim = PROC_FLAG_TAKE_PERIODIC;
uint32 procAttacker = PROC_FLAG_DEAL_PERIODIC;
uint32 procVictim = PROC_FLAG_TAKE_PERIODIC;

uint32 hitMask = damageInfo.GetHitMask();
if (damage)
{
hitMask |= crit ? PROC_HIT_CRITICAL : PROC_HIT_NORMAL;

if (!m_spellInfo->HasAttribute(SPELL_ATTR3_CANT_TRIGGER_TARGET_PROCS))
procVictim |= PROC_FLAG_TAKE_ANY_DAMAGE;
procVictim |= PROC_FLAG_TAKE_ANY_DAMAGE;
}

int32 new_damage = Unit::DealDamage(caster, target, damage, &cleanDamage, DOT, GetSpellInfo()->GetSchoolMask(), GetSpellInfo(), false);
Expand Down Expand Up @@ -6143,11 +6134,8 @@ void AuraEffect::HandlePeriodicHealAurasTick(Unit* target, Unit* caster) const
if (GetAuraType() == SPELL_AURA_OBS_MOD_HEALTH)
return;

uint32 procAttacker = PROC_FLAG_NONE, procVictim = PROC_FLAG_NONE;
if (!m_spellInfo->HasAttribute(SPELL_ATTR3_CANT_TRIGGER_CASTER_PROCS))
procAttacker = PROC_FLAG_DEAL_PERIODIC;
if (!m_spellInfo->HasAttribute(SPELL_ATTR3_CANT_TRIGGER_TARGET_PROCS))
procVictim = PROC_FLAG_TAKE_PERIODIC;
uint32 procAttacker = PROC_FLAG_DEAL_PERIODIC;
uint32 procVictim = PROC_FLAG_TAKE_PERIODIC;

uint32 hitMask = crit ? PROC_HIT_CRITICAL : PROC_HIT_NORMAL;
// ignore item heals
Expand Down Expand Up @@ -6315,19 +6303,14 @@ void AuraEffect::HandlePeriodicPowerBurnAuraTick(Unit* target, Unit* caster) con
caster->SendSpellNonMeleeDamageLog(&damageInfo);

// Set trigger flag
uint32 procAttacker = PROC_FLAG_NONE, procVictim = PROC_FLAG_NONE;
if (!m_spellInfo->HasAttribute(SPELL_ATTR3_CANT_TRIGGER_CASTER_PROCS))
procAttacker = PROC_FLAG_DEAL_PERIODIC;
if (!m_spellInfo->HasAttribute(SPELL_ATTR3_CANT_TRIGGER_TARGET_PROCS))
procVictim = PROC_FLAG_TAKE_PERIODIC;
uint32 procAttacker = PROC_FLAG_DEAL_PERIODIC;
uint32 procVictim = PROC_FLAG_TAKE_PERIODIC;

uint32 hitMask = createProcHitMask(&damageInfo, SPELL_MISS_NONE);
uint32 spellTypeMask = PROC_SPELL_TYPE_NO_DMG_HEAL;
if (damageInfo.damage)
{
if (!m_spellInfo->HasAttribute(SPELL_ATTR3_CANT_TRIGGER_TARGET_PROCS))
procVictim |= PROC_FLAG_TAKE_ANY_DAMAGE;

procVictim |= PROC_FLAG_TAKE_ANY_DAMAGE;
spellTypeMask |= PROC_SPELL_TYPE_DAMAGE;
}

Expand Down
Loading
Loading