Skip to content

Commit

Permalink
Merge branch '3.3.5' into npcbots_3.3.5
Browse files Browse the repository at this point in the history
# Conflicts:
#	src/server/game/Entities/Unit/Unit.cpp
#	src/server/game/Entities/Unit/Unit.h
  • Loading branch information
trickerer committed Sep 14, 2024
2 parents 409d2f1 + 8030ef4 commit 18a4cd0
Show file tree
Hide file tree
Showing 39 changed files with 581 additions and 547 deletions.
3 changes: 3 additions & 0 deletions data/sql/updates/db_world/2024_09_09_00.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
-- DB update 2024_09_05_00 -> 2024_09_09_00
--
UPDATE `creature_template` SET `flags_extra` = `flags_extra` |2147483648 WHERE `entry` = 22841;
6 changes: 6 additions & 0 deletions data/sql/updates/db_world/2024_09_11_00.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
-- DB update 2024_09_09_00 -> 2024_09_11_00
UPDATE `smart_scripts`
SET `event_param4` = 6000
WHERE `entryorguid` = 22945
AND `source_type` = 0
AND `id` = 0;
15 changes: 15 additions & 0 deletions data/sql/updates/db_world/2024_09_11_01.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
-- DB update 2024_09_11_00 -> 2024_09_11_01
-- Missing spell (Cleave) for Bladespire Brute
DELETE FROM `smart_scripts` WHERE (`entryorguid` = 19995) AND (`source_type` = 0) AND (`id` IN (0));
INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `event_param5`, `event_param6`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_param4`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES
(19995, 0, 0, 0, 0, 0, 100, 0, 7000, 12000, 8000, 30000, 0, 0, 11, 15496, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 'Bladespire Brute - In Combat - Cast Cleave');

-- Missing spell (Knockdown) for Bloodmaul Mauler
DELETE FROM `smart_scripts` WHERE (`entryorguid` = 19993) AND (`source_type` = 0) AND (`id` IN (4));
INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `event_param5`, `event_param6`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_param4`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES
(19993, 0, 4, 0, 0, 0, 100, 0, 15000, 30000, 30000, 60000, 0, 0, 11, 37592, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 'Bloodmaul Mauler - In Combat - Cast Knockdown');

-- Missing spell (Knockdown) for Bloodmaul Taskmaster
DELETE FROM `smart_scripts` WHERE (`entryorguid` = 22160) AND (`source_type` = 0) AND (`id` IN (5));
INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `event_param5`, `event_param6`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_param4`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES
(22160, 0, 5, 0, 0, 0, 100, 0, 20000, 50000, 60000, 90000, 0, 0, 11, 37592, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 'Bloodmaul Taskmaster - In Combat - Cast Knockdown');
6 changes: 3 additions & 3 deletions src/server/apps/worldserver/worldserver.conf.dist
Original file line number Diff line number Diff line change
Expand Up @@ -1279,17 +1279,17 @@ Visibility.GroupMode = 1
# Visibility.Distance.Instances
# Visibility.Distance.BGArenas
# Description: Visibility distance to see other players or gameobjects.
# Visibility on continents on retail ~100 yards. In BG/Arenas ~533.
# Visibility on continents on retail ~100 yards. In BG/Arenas ~250.
# For instances default ~170.
# Max limited by active player zone: ~ 333
# Min limit is max aggro radius (45) * Rate.Creature.Aggro
# Default: 100 - (Visibility.Distance.Continents)
# 170 - (Visibility.Distance.Instances)
# 533 - (Visibility.Distance.BGArenas)
# 250 - (Visibility.Distance.BGArenas)

Visibility.Distance.Continents = 100
Visibility.Distance.Instances = 170
Visibility.Distance.BGArenas = 533
Visibility.Distance.BGArenas = 250

#
# Visibility.ObjectSparkles
Expand Down
5 changes: 4 additions & 1 deletion src/server/game/Battlegrounds/ArenaTeam.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1034,7 +1034,10 @@ void ArenaTeam::CreateTempArenaTeam(std::vector<Player*> playerList, uint8 type,
{
auto playerCountInTeam = static_cast<uint32>(playerList.size());

ASSERT(playerCountInTeam == GetReqPlayersForType(type));
const auto standardArenaType = { ARENA_TYPE_2v2, ARENA_TYPE_3v3, ARENA_TYPE_5v5 };
bool isStandardArenaType = std::find(std::begin(standardArenaType), std::end(standardArenaType), type) != std::end(standardArenaType);
if (isStandardArenaType)
ASSERT(playerCountInTeam == GetReqPlayersForType(type));

// Generate new arena team id
TeamId = sArenaTeamMgr->GenerateTempArenaTeamId();
Expand Down
2 changes: 2 additions & 0 deletions src/server/game/Battlegrounds/Battleground.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -667,6 +667,8 @@ inline void Battleground::_ProcessJoin(uint32 diff)
}
m_ToBeTeleported.clear();
}

sScriptMgr->OnArenaStart(this);
}
else
{
Expand Down
4 changes: 4 additions & 0 deletions src/server/game/Battlegrounds/BattlegroundQueue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -904,6 +904,10 @@ void BattlegroundQueue::BattlegroundQueueUpdate(uint32 diff, BattlegroundTypeId

sScriptMgr->OnQueueUpdate(this, diff, bgTypeId, bracket_id, arenaType, isRated, arenaRating);

if (!sScriptMgr->OnQueueUpdateValidity(this, diff, bgTypeId, bracket_id, arenaType, isRated, arenaRating)) {
return;
}

m_SelectionPools[TEAM_ALLIANCE].Init();
m_SelectionPools[TEAM_HORDE].Init();

Expand Down
3 changes: 3 additions & 0 deletions src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,9 @@ Creature* BattlegroundAV::AddAVCreature(uint16 cinfoid, uint16 type)
if (creature->GetEntry() == BG_AV_CreatureInfo[AV_NPC_A_CAPTAIN] || creature->GetEntry() == BG_AV_CreatureInfo[AV_NPC_H_CAPTAIN])
creature->SetRespawnDelay(RESPAWN_ONE_DAY); /// @todo: look if this can be done by database + also add this for the wingcommanders

if (creature->GetEntry() == BG_AV_CreatureInfo[AV_NPC_A_TOWERDEFENSE] || creature->GetEntry() == BG_AV_CreatureInfo[AV_NPC_H_TOWERDEFENSE])
creature->SetUnitFlag(UNIT_FLAG_DISABLE_MOVE);

if ((isStatic && cinfoid >= 10 && cinfoid <= 14) || (!isStatic && ((cinfoid >= AV_NPC_A_GRAVEDEFENSE0 && cinfoid <= AV_NPC_A_GRAVEDEFENSE3) ||
(cinfoid >= AV_NPC_H_GRAVEDEFENSE0 && cinfoid <= AV_NPC_H_GRAVEDEFENSE3))))
{
Expand Down
30 changes: 15 additions & 15 deletions src/server/game/Battlegrounds/Zones/BattlegroundAV.h
Original file line number Diff line number Diff line change
Expand Up @@ -1118,21 +1118,21 @@ const float BG_AV_CreaturePos[AV_CPLACE_MAX][4] =

enum BG_AV_CreatureIds
{
AV_NPC_A_TOWERDEFENSE = 0, // stormpike bowman
AV_NPC_A_GRAVEDEFENSE0 = 1, // stormpike Defender
AV_NPC_A_GRAVEDEFENSE1 = 2, // seasoned defender
AV_NPC_A_GRAVEDEFENSE2 = 3, // veteran defender
AV_NPC_A_GRAVEDEFENSE3 = 4, // champion defender
AV_NPC_A_CAPTAIN = 5, // balinda
AV_NPC_A_BOSS = 6, // vanndar

AV_NPC_H_TOWERDEFENSE = 7, // frostwolf bowman
AV_NPC_H_GRAVEDEFENSE0 = 8, // frostwolf guardian
AV_NPC_H_GRAVEDEFENSE1 = 9, // seasoned guardian
AV_NPC_H_GRAVEDEFENSE2 = 10, // veteran guardian
AV_NPC_H_GRAVEDEFENSE3 = 11, // champion guardian
AV_NPC_H_CAPTAIN = 12, // galvangar
AV_NPC_H_BOSS = 13, // drek thar
AV_NPC_A_GRAVEDEFENSE0 = 0, // Stormpike defender
AV_NPC_A_GRAVEDEFENSE1 = 1, // Seasoned defender
AV_NPC_A_GRAVEDEFENSE2 = 2, // Veteran defender
AV_NPC_A_GRAVEDEFENSE3 = 3, // Champion defender
AV_NPC_A_TOWERDEFENSE = 4, // Stormpike bowman
AV_NPC_A_CAPTAIN = 5, // Balinda
AV_NPC_A_BOSS = 6, // Vanndar

AV_NPC_H_GRAVEDEFENSE0 = 7, // Frostwolf guardian
AV_NPC_H_GRAVEDEFENSE1 = 8, // Seasoned guardian
AV_NPC_H_GRAVEDEFENSE2 = 9, // Veteran guardian
AV_NPC_H_GRAVEDEFENSE3 = 10, // Champion guardian
AV_NPC_H_TOWERDEFENSE = 11, // Frostwolf bowman
AV_NPC_H_CAPTAIN = 12, // Galvangar
AV_NPC_H_BOSS = 13, // Drek thar

AV_NPC_A_MARSHAL_SOUTH = 14,
AV_NPC_MARSHAL_NORTH = 15,
Expand Down
4 changes: 2 additions & 2 deletions src/server/game/Entities/Creature/Creature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3889,7 +3889,7 @@ bool Creature::IsNotReachableAndNeedRegen() const
std::shared_ptr<time_t> const& Creature::GetLastLeashExtensionTimePtr() const
{
if (m_lastLeashExtensionTime == nullptr)
m_lastLeashExtensionTime = std::make_shared<time_t>(time(nullptr));
m_lastLeashExtensionTime = std::make_shared<time_t>(GameTime::GetGameTime().count());
return m_lastLeashExtensionTime;
}

Expand All @@ -3910,7 +3910,7 @@ time_t Creature::GetLastLeashExtensionTime() const

void Creature::UpdateLeashExtensionTime()
{
(*GetLastLeashExtensionTimePtr()) = time(nullptr);
(*GetLastLeashExtensionTimePtr()) = GameTime::GetGameTime().count();
}

bool Creature::CanPeriodicallyCallForAssistance() const
Expand Down
2 changes: 1 addition & 1 deletion src/server/game/Entities/Creature/TemporarySummon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ std::string Minion::GetDebugInfo() const
Guardian::Guardian(SummonPropertiesEntry const* properties, ObjectGuid owner, bool isWorldObject) : Minion(properties, owner, isWorldObject)
{
m_unitTypeMask |= UNIT_MASK_GUARDIAN;
if (properties && properties->Type == SUMMON_TYPE_PET)
if (properties && (properties->Type == SUMMON_TYPE_PET || properties->Category == SUMMON_CATEGORY_PET))
{
m_unitTypeMask |= UNIT_MASK_CONTROLABLE_GUARDIAN;
InitCharmInfo();
Expand Down
2 changes: 1 addition & 1 deletion src/server/game/Entities/Object/ObjectDefines.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
#define DEFAULT_VISIBILITY_DISTANCE 100.0f // default visible distance, 100 yards on continents
#define DEFAULT_VISIBILITY_INSTANCE 170.0f // default visible distance in instances, 170 yards
#define VISIBILITY_DIST_WINTERGRASP 175.0f
#define DEFAULT_VISIBILITY_BGARENAS 533.0f // default visible distance in BG/Arenas, roughly 533 yards
#define DEFAULT_VISIBILITY_BGARENAS 250.0f // default visible distance in BG/Arenas, roughly 250 yards

#define DEFAULT_WORLD_OBJECT_SIZE 0.388999998569489f // player size, also currently used (correctly?) for any non Unit world objects
#define DEFAULT_COMBAT_REACH 1.5f
Expand Down
8 changes: 8 additions & 0 deletions src/server/game/Entities/Player/Player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12593,6 +12593,14 @@ void Player::AutoUnequipOffhandIfNeed(bool force /*= false*/)
if (!CanDualWield() && (offItem->GetTemplate()->InventoryType == INVTYPE_WEAPONOFFHAND || offItem->GetTemplate()->InventoryType == INVTYPE_WEAPON))
force = true;

// unequip offhand weapon if player main hand weapon is a polearm or staff or fishing pole
if (Item* mhWeapon = GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_MAINHAND))
if (ItemTemplate const* mhWeaponProto = mhWeapon->GetTemplate())
if (mhWeaponProto->SubClass == ITEM_SUBCLASS_WEAPON_POLEARM ||
mhWeaponProto->SubClass == ITEM_SUBCLASS_WEAPON_STAFF ||
mhWeaponProto->SubClass == ITEM_SUBCLASS_WEAPON_FISHING_POLE)
force = true;

// need unequip offhand for 2h-weapon without TitanGrip (in any from hands)
if (!force && (CanTitanGrip() || (offItem->GetTemplate()->InventoryType != INVTYPE_2HWEAPON && !IsTwoHandUsed())))
{
Expand Down
35 changes: 13 additions & 22 deletions src/server/game/Entities/Player/PlayerStorage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -205,28 +205,11 @@ uint8 Player::FindEquipSlot(ItemTemplate const* proto, uint32 slot, bool swap) c
break;
case INVTYPE_2HWEAPON:
slots[0] = EQUIPMENT_SLOT_MAINHAND;
if (Item* mhWeapon = GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_MAINHAND))
{
if (ItemTemplate const* mhWeaponProto = mhWeapon->GetTemplate())
{
if (mhWeaponProto->SubClass == ITEM_SUBCLASS_WEAPON_POLEARM || mhWeaponProto->SubClass == ITEM_SUBCLASS_WEAPON_STAFF)
{
const_cast<Player*>(this)->AutoUnequipOffhandIfNeed(true);
break;
}
}
}

if (GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND))
{
if (proto->SubClass == ITEM_SUBCLASS_WEAPON_POLEARM || proto->SubClass == ITEM_SUBCLASS_WEAPON_STAFF)
{
const_cast<Player*>(this)->AutoUnequipOffhandIfNeed(true);
break;
}
}
if (CanDualWield() && CanTitanGrip() && proto->SubClass != ITEM_SUBCLASS_WEAPON_POLEARM && proto->SubClass != ITEM_SUBCLASS_WEAPON_STAFF && proto->SubClass != ITEM_SUBCLASS_WEAPON_FISHING_POLE)
slots[1] = EQUIPMENT_SLOT_OFFHAND;
if (Item* mhWeapon = GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_MAINHAND))
if (ItemTemplate const* mhWeaponProto = mhWeapon->GetTemplate())
if (mhWeaponProto->SubClass != ITEM_SUBCLASS_WEAPON_POLEARM && mhWeaponProto->SubClass != ITEM_SUBCLASS_WEAPON_STAFF && mhWeaponProto->SubClass != ITEM_SUBCLASS_WEAPON_FISHING_POLE)
slots[1] = EQUIPMENT_SLOT_OFFHAND;
break;
case INVTYPE_TABARD:
slots[0] = EQUIPMENT_SLOT_TABARD;
Expand Down Expand Up @@ -1966,6 +1949,14 @@ InventoryResult Player::CanEquipItem(uint8 slot, uint16& dest, Item* pItem, bool
return EQUIP_ERR_CANT_DUAL_WIELD;
}

// Do not allow offhand with main hand polearm, staff or fishing pole
if (Item* mhWeapon = GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_MAINHAND))
if (ItemTemplate const* mhWeaponProto = mhWeapon->GetTemplate())
if (mhWeaponProto->SubClass == ITEM_SUBCLASS_WEAPON_POLEARM ||
mhWeaponProto->SubClass == ITEM_SUBCLASS_WEAPON_STAFF ||
mhWeaponProto->SubClass == ITEM_SUBCLASS_WEAPON_FISHING_POLE)
return EQUIP_ERR_CANT_EQUIP_WITH_TWOHANDED;

if (IsTwoHandUsed())
return EQUIP_ERR_CANT_EQUIP_WITH_TWOHANDED;
}
Expand All @@ -1981,7 +1972,7 @@ InventoryResult Player::CanEquipItem(uint8 slot, uint16& dest, Item* pItem, bool
else if (eslot != EQUIPMENT_SLOT_MAINHAND)
return EQUIP_ERR_ITEM_CANT_BE_EQUIPPED;

if (!CanTitanGrip())
if (!CanTitanGrip() || (pProto->SubClass == ITEM_SUBCLASS_WEAPON_POLEARM || pProto->SubClass == ITEM_SUBCLASS_WEAPON_STAFF || pProto->SubClass == ITEM_SUBCLASS_WEAPON_FISHING_POLE))
{
// offhand item must can be stored in inventory for offhand item and it also must be unequipped
Item* offItem = GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND);
Expand Down
2 changes: 1 addition & 1 deletion src/server/game/Entities/Player/PlayerUpdates.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ void Player::Update(uint32 p_time)

if (!IsPositionValid()) // pussywizard: will crash below at eg. GetZoneAndAreaId
{
LOG_INFO("misc", "Player::Update - invalid position ({0:.1f}, {0:.1f}, {0:.1f})! Map: {}, MapId: {}, {}",
LOG_INFO("misc", "Player::Update - invalid position ({:0.1f}, {:0.1f}, {:0.1f})! Map: {}, MapId: {}, {}",
GetPositionX(), GetPositionY(), GetPositionZ(), (FindMap() ? FindMap()->GetId() : 0), GetMapId(), GetGUID().ToString());
GetSession()->KickPlayer("Invalid position");
return;
Expand Down
48 changes: 39 additions & 9 deletions src/server/game/Entities/Unit/Unit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -791,6 +791,20 @@ bool Unit::GetRandomContactPoint(Unit const* obj, float& x, float& y, float& z,
return true;
}

Unit* Unit::getAttackerForHelper() const
{
if (GetVictim() != nullptr)
return GetVictim();

if (!IsEngaged())
return nullptr;

if (!m_attackers.empty())
return *(m_attackers.begin());

return nullptr;
}

void Unit::UpdateInterruptMask()
{
m_interruptMask = 0;
Expand Down Expand Up @@ -1971,10 +1985,10 @@ void Unit::DealMeleeDamage(CalcDamageInfo* damageInfo, bool durabilityLoss)
if (damageInfo->blocked_amount && damageInfo->TargetState != VICTIMSTATE_BLOCKS)
victim->HandleEmoteCommand(EMOTE_ONESHOT_PARRY_SHIELD);

if (damageInfo->TargetState == VICTIMSTATE_PARRY)
//npcbot - implement CREATURE_FLAG_EXTRA_NO_PARRY_HASTEN (AC sup)
if (!(GetTypeId() == TYPEID_UNIT && ToCreature()->GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_NO_PARRY_HASTEN))
//end npcbot
// Parry haste is enabled if it's not a creature or if the creature doesn't have the NO_PARRY_HASTEN flag.
bool isParryHasteEnabled = !victim->IsCreature() ||
!victim->ToCreature()->GetCreatureTemplate()->HasFlagsExtra(CREATURE_FLAG_EXTRA_NO_PARRY_HASTEN);
if (damageInfo->TargetState == VICTIMSTATE_PARRY && isParryHasteEnabled)
{
// Get attack timers
float offtime = float(victim->getAttackTimer(OFF_ATTACK));
Expand Down Expand Up @@ -14252,6 +14266,7 @@ void Unit::SetInCombatWith(Unit* enemy, uint32 duration)
return;
}
}

if (Creature* pCreature = ToCreature())
pCreature->UpdateLeashExtensionTime();

Expand Down Expand Up @@ -14478,6 +14493,8 @@ void Unit::SetInCombatState(bool PvP, Unit* enemy, uint32 duration)

if (enemy)
{
creature->UpdateLeashExtensionTime();

if (IsAIEnabled)
creature->AI()->JustEngagedWith(enemy);

Expand Down Expand Up @@ -18332,6 +18349,17 @@ void Unit::SetContestedPvP(Player* attackedPlayer, bool lookForNearContestedGuar
}
}

void Unit::SetCantProc(bool apply)
{
if (apply)
++m_procDeep;
else
{
ASSERT(m_procDeep);
--m_procDeep;
}
}

void Unit::AddPetAura(PetAura const* petSpell)
{
if (!IsPlayer())
Expand Down Expand Up @@ -21634,13 +21662,13 @@ void Unit::OutDebugInfo() const
class AuraMunchingQueue : public BasicEvent
{
public:
AuraMunchingQueue(Unit& owner, ObjectGuid targetGUID, int32 basePoints, uint32 spellId) : _owner(owner), _targetGUID(targetGUID), _basePoints(basePoints), _spellId(spellId) { }
AuraMunchingQueue(Unit& owner, ObjectGuid targetGUID, int32 basePoints, uint32 spellId, AuraEffect* aurEff) : _owner(owner), _targetGUID(targetGUID), _basePoints(basePoints), _spellId(spellId), _aurEff(aurEff) { }

bool Execute(uint64 /*eventTime*/, uint32 /*updateTime*/) override
{
if (_owner.IsInWorld() && _owner.FindMap())
if (Unit* target = ObjectAccessor::GetUnit(_owner, _targetGUID))
_owner.CastCustomSpell(_spellId, SPELLVALUE_BASE_POINT0, _basePoints, target, TriggerCastFlags(TRIGGERED_FULL_MASK & ~TRIGGERED_NO_PERIODIC_RESET), nullptr, nullptr, _owner.GetGUID());
_owner.CastCustomSpell(_spellId, SPELLVALUE_BASE_POINT0, _basePoints, target, TriggerCastFlags(TRIGGERED_FULL_MASK & ~TRIGGERED_NO_PERIODIC_RESET), nullptr, _aurEff, _owner.GetGUID());

return true;
}
Expand All @@ -21650,13 +21678,15 @@ class AuraMunchingQueue : public BasicEvent
ObjectGuid _targetGUID;
int32 _basePoints;
uint32 _spellId;
AuraEffect* _aurEff;
};

void Unit::CastDelayedSpellWithPeriodicAmount(Unit* caster, uint32 spellId, AuraType auraType, int32 addAmount, uint8 effectIndex)
{
AuraEffect* aurEff = nullptr;
for (AuraEffectList::iterator i = m_modAuras[auraType].begin(); i != m_modAuras[auraType].end(); ++i)
{
AuraEffect* aurEff = *i;
aurEff = *i;
if (aurEff->GetCasterGUID() != caster->GetGUID() || aurEff->GetId() != spellId || aurEff->GetEffIndex() != effectIndex || !aurEff->GetTotalTicks())
continue;

Expand All @@ -21666,9 +21696,9 @@ void Unit::CastDelayedSpellWithPeriodicAmount(Unit* caster, uint32 spellId, Aura

// xinef: delay only for casting on different unit
if (this == caster || !sWorld->getBoolConfig(CONFIG_MUNCHING_BLIZZLIKE))
caster->CastCustomSpell(spellId, SPELLVALUE_BASE_POINT0, addAmount, this, TriggerCastFlags(TRIGGERED_FULL_MASK & ~TRIGGERED_NO_PERIODIC_RESET), nullptr, nullptr, caster->GetGUID());
caster->CastCustomSpell(spellId, SPELLVALUE_BASE_POINT0, addAmount, this, TriggerCastFlags(TRIGGERED_FULL_MASK & ~TRIGGERED_NO_PERIODIC_RESET), nullptr, aurEff, caster->GetGUID());
else
caster->m_Events.AddEvent(new AuraMunchingQueue(*caster, GetGUID(), addAmount, spellId), caster->m_Events.CalculateQueueTime(400));
caster->m_Events.AddEvent(new AuraMunchingQueue(*caster, GetGUID(), addAmount, spellId, aurEff), caster->m_Events.CalculateQueueTime(400));
}

void Unit::SendClearTarget()
Expand Down
Loading

0 comments on commit 18a4cd0

Please sign in to comment.