Merge branch 'azerothcore:master' into Playerbot

This commit is contained in:
ZhengPeiRu21
2022-09-26 10:01:10 -06:00
committed by GitHub
82 changed files with 1459 additions and 245 deletions
@@ -0,0 +1,11 @@
-- DB update 2022_09_22_01 -> 2022_09_23_00
ALTER TABLE `skilllineability_dbc`
CHANGE `MinSkillLineRank` `ExcludeRace` INT NOT NULL DEFAULT 0,
CHANGE `SupercededBySpell` `ExcludeClass` INT NOT NULL DEFAULT 0,
CHANGE `AcquireMethod` `MinSkillLineRank` INT NOT NULL DEFAULT 0,
CHANGE `TrivialSkillLineRankHigh` `SupercededBySpell` INT NOT NULL DEFAULT 0,
CHANGE `TrivialSkillLineRankLow` `AcquireMethod` INT NOT NULL DEFAULT 0,
CHANGE `CharacterPoints_1` `TrivialSkillLineRankHigh` INT NOT NULL DEFAULT 0,
CHANGE `CharacterPoints_2` `TrivialSkillLineRankLow` INT NOT NULL DEFAULT 0,
CHANGE `TradeSkillCategoryID` `CharacterPoints_1` INT NOT NULL DEFAULT 0,
ADD COLUMN `CharacterPoints_2` INT NOT NULL DEFAULT 0 AFTER `CharacterPoints_1`;
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,3 @@
-- DB update 2022_09_24_00 -> 2022_09_24_01
--
UPDATE `creature_template` SET `gossip_menu_id` = 11383, `npcflag` = `npcflag` |1 WHERE `entry` = 40437;
@@ -0,0 +1,6 @@
-- DB update 2022_09_24_01 -> 2022_09_25_00
--
DELETE FROM `creature_questender` WHERE `id` = 15738 AND `quest` = 8832;
DELETE FROM `creature_questender` WHERE `id` = 15738 AND `quest` = 8815;
INSERT INTO `creature_questender` (`id`, `quest`) VALUES
(15738, 8815);
@@ -0,0 +1,5 @@
-- DB update 2022_09_25_00 -> 2022_09_25_01
--
DELETE FROM `spell_script_names` WHERE `ScriptName`='spell_q4735_collect_rookery_egg';
INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES
(15958, 'spell_q4735_collect_rookery_egg');
@@ -0,0 +1,5 @@
-- DB update 2022_09_25_01 -> 2022_09_25_02
--
DELETE FROM `spell_script_names` WHERE `spell_id`=818;
INSERT INTO `spell_script_names` VALUES
(818,'spell_gen_basic_campfire');
@@ -0,0 +1,8 @@
-- DB update 2022_09_25_02 -> 2022_09_25_03
-- Alter AzerothCore table to support Vanilla negative resistance values
ALTER TABLE item_template MODIFY fire_res SMALLINT;
ALTER TABLE item_template MODIFY holy_res SMALLINT;
ALTER TABLE item_template MODIFY nature_res SMALLINT;
ALTER TABLE item_template MODIFY frost_res SMALLINT;
ALTER TABLE item_template MODIFY shadow_res SMALLINT;
ALTER TABLE item_template MODIFY arcane_res SMALLINT;
@@ -0,0 +1,48 @@
-- DB update 2022_09_25_03 -> 2022_09_25_04
--
DELETE FROM `gossip_menu_option` WHERE `MenuId`=8934 AND `OptionId`=4 AND `ActionMenuId`=0;
UPDATE `gossip_menu_option` SET `OptionId`=4 WHERE `MenuId`=8934 AND `OptionId`=0 AND `ActionMenuId`=8953;
UPDATE `gossip_menu_option` SET `OptionText`='Do you still need some help moving kegs from the crash site near Razor Hill?', `OptionBroadcastTextID`=23546, `ActionMenuId`=8973 WHERE `MenuId`=8976 AND `OptionId`=4;
DELETE FROM `gossip_menu_option` WHERE `MenuID`=8973;
INSERT INTO `gossip_menu_option` (`MenuID`, `OptionID`, `OptionIcon`, `OptionText`, `OptionBroadcastTextID`, `OptionType`, `OptionNpcFlag`, `ActionMenuID`, `ActionPoiID`, `BoxCoded`, `BoxMoney`, `BoxText`, `BoxBroadcastTextID`, `VerifiedBuild`) VALUES
(8973,0,0,'I\m ready to work for you today! Give me that ram!',23545,1,1,0,0,0,0,NULL,0,0);
DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=15 AND `SourceGroup` IN (8934,8976);
INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `NegativeCondition`, `ErrorType`, `ErrorTextId`, `ScriptName`, `Comment`) VALUES
(15,8934,1,0,0,1,0,43883,0,0,1,0,0,'','Show Gossip option only if player does not have Aura \"Rental Racing Ram\"'),
(15,8934,1,0,0,47,0,11122,10,0,0,0,0,'','Show Gossip option only if player does not have \"There and Back Again\" taken'),
(15,8934,1,0,0,28,0,11122,0,0,1,0,0,'','Show Gossip option only if player has not quest \"There and Back Again\" rewarded'),
(15,8934,2,0,0,1,0,43883,0,0,1,0,0,'','Show Gossip option only if player does not have Aura \"Rental Racing Ram\"'),
(15,8934,2,0,0,47,0,11318,10,0,0,0,0,'','Show Gossip option only if player does not have \"Now This is Ram Racing... Almost.\" taken'),
(15,8934,2,0,0,28,0,11318,0,0,1,0,0,'','Show Gossip option only if player has not quest \"Now This is Ram Racing... Almost.\" rewarded'),
(15,8934,3,0,0,1,0,43883,0,0,1,0,0,'','Show Gossip option only if player does not have Aura \"Rental Racing Ram\"'),
(15,8934,3,0,0,47,0,11293,10,0,0,0,0,'','Show Gossip option only if player does not have \"Bark for the Barleybrews!\" taken'),
(15,8934,3,0,1,47,0,11294,10,0,0,0,0,'','Show Gossip option only if player does not have \"Bark for the Thunderbrews!\" taken'),
(15,8934,3,0,0,28,0,11293,0,0,1,0,0,'','Show Gossip option only if player has not quest \"Bark for the Barleybrews!\" rewarded'),
(15,8934,3,0,1,28,0,11294,0,0,1,0,0,'','Show Gossip option only if player has not quest \"Bark for the Thunderbrews!\" rewarded'),
(15,8934,4,0,0,8,0,11122,0,0,0,0,0,'','Brewfest Relay Race - Show gossip if player has turned in the quest \"There and Back Again\"'),
(15,8934,4,0,0,1,0,44689,0,0,1,0,0,'','Brewfest Relay Race - Show gossip if player does not have aura \"Relay Race Accept Hidden Debuff - DND\"'),
(15,8934,4,0,0,1,0,43883,0,0,1,0,0,'','Brewfest Relay Race - Show gossip if player does not have aura \"Rental Racing Ram\"'),
(15,8976,1,0,0,1,0,43883,0,0,1,0,0,'','Show Gossip option only if player does not have Aura \"Rental Racing Ram\"'),
(15,8976,1,0,0,47,0,11412,10,0,0,0,0,'','Show Gossip option only if player does not have \"There and Back Again\" taken'),
(15,8976,1,0,0,28,0,11412,0,0,1,0,0,'','Show Gossip option only if player has not quest \"There and Back Again\" rewarded'),
(15,8976,2,0,0,1,0,43883,0,0,1,0,0,'','Show Gossip option only if player does not have Aura \"Rental Racing Ram\"'),
(15,8976,2,0,0,47,0,11409,10,0,0,0,0,'','Show Gossip option only if player does not have \"Now This is Ram Racing... Almost.\" taken'),
(15,8976,2,0,0,28,0,11409,0,0,1,0,0,'','Show Gossip option only if player has not quest \"Now This is Ram Racing... Almost.\" rewarded'),
(15,8976,3,0,0,1,0,43883,0,0,1,0,0,'','Show Gossip option only if player does not have Aura \"Rental Racing Ram\"'),
(15,8976,3,0,0,47,0,11407,10,0,0,0,0,'','Show Gossip option only if player does not have \"Bark for Drohn\s Distillery!\" taken'),
(15,8976,3,0,1,47,0,11408,10,0,0,0,0,'','Show Gossip option only if player does not have \"Bark for T\chali\s Voodoo Brewery!\" taken'),
(15,8976,3,0,0,28,0,11407,0,0,1,0,0,'','Show Gossip option only if player has not quest \"Bark for Drohn\s Distillery!\" rewarded'),
(15,8976,3,0,1,28,0,11408,0,0,1,0,0,'','Show Gossip option only if player has not quest \"Bark for T\chali\s Voodoo Brewery!\" rewarded'),
(15,8976,4,0,0,8,0,11412,0,0,0,0,0,'','Brewfest Relay Race - Show gossip if player has turned in the quest \"There and Back Again\"'),
(15,8976,4,0,0,1,0,44689,0,0,1,0,0,'','Brewfest Relay Race - Show gossip if player does not have aura \"Relay Race Accept Hidden Debuff - DND\"'),
(15,8976,4,0,0,1,0,43883,0,0,1,0,0,'','Brewfest Relay Race - Show gossip if player does not have aura \"Rental Racing Ram\"');
@@ -0,0 +1,5 @@
-- DB update 2022_09_25_04 -> 2022_09_25_05
--
DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=13 AND `SourceEntry`=43450;
INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `NegativeCondition`, `ErrorType`, `ErrorTextId`, `ScriptName`, `Comment`) VALUES
(13,1,43450,0,0,1,0,43052,0,0,0,0,0,'','Brewfest - apple trap - friendly DND targets only players with aura Ram Fatigue');
@@ -0,0 +1,15 @@
-- DB update 2022_09_25_05 -> 2022_09_26_00
-- Sartura updated waypoints.
SET @PATH=876480;
DELETE FROM `waypoint_data` WHERE `id`=@PATH;
INSERT INTO `waypoint_data` (`id`,`point`,`position_x`,`position_y`,`position_z`,`orientation`,`delay`,`move_type`,`action`,`action_chance`,`wpguid`) VALUES
(@PATH,1,-8264.544,1744.8572,-15.0647335,0,0,1,0,100,0),
(@PATH,2,-8256.176,1706.1317,-25.63707,0,0,1,0,100,0),
(@PATH,3,-8260.745,1661.0099,-30.723732,0,0,1,0,100,0),
(@PATH,4,-8308.3955,1705.1285,-20.586851,0,0,1,0,100,0),
(@PATH,5,-8276.452,1706.4706,-21.835382,0,0,1,0,100,0),
(@PATH,6,-8251.389,1708.8358,-25.77644,0,0,1,0,100,0),
(@PATH,7,-8224.531,1711.2188,-27.293034,0,0,1,0,100,0),
(@PATH,8,-8261.439,1684.3287,-28.363323,0,0,1,0,100,0),
(@PATH,9,-8286.062,1662.6569,-29.59315,0,0,1,0,100,0),
(@PATH,10,-8321.049,1634.6908,-32.10147,0,0,1,0,100,0);
+2 -2
View File
@@ -136,7 +136,7 @@ SpellCastResult UnitAI::DoAddAuraToAllHostilePlayers(uint32 spellid)
{ {
if (me->IsInCombat()) if (me->IsInCombat())
{ {
ThreatContainer::StorageType threatlist = me->GetThreatMgr().getThreatList(); ThreatContainer::StorageType threatlist = me->GetThreatMgr().GetThreatList();
for (ThreatContainer::StorageType::const_iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr) for (ThreatContainer::StorageType::const_iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr)
{ {
if (Unit* unit = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid())) if (Unit* unit = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid()))
@@ -159,7 +159,7 @@ SpellCastResult UnitAI::DoCastToAllHostilePlayers(uint32 spellid, bool triggered
{ {
if (me->IsInCombat()) if (me->IsInCombat())
{ {
ThreatContainer::StorageType threatlist = me->GetThreatMgr().getThreatList(); ThreatContainer::StorageType threatlist = me->GetThreatMgr().GetThreatList();
for (ThreatContainer::StorageType::const_iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr) for (ThreatContainer::StorageType::const_iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr)
{ {
if (Unit* unit = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid())) if (Unit* unit = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid()))
+2 -2
View File
@@ -216,7 +216,7 @@ public:
template <class PREDICATE> template <class PREDICATE>
Unit* SelectTarget(SelectTargetMethod targetType, uint32 position, PREDICATE const& predicate) Unit* SelectTarget(SelectTargetMethod targetType, uint32 position, PREDICATE const& predicate)
{ {
ThreatContainer::StorageType const& threatlist = me->GetThreatMgr().getThreatList(); ThreatContainer::StorageType const& threatlist = me->GetThreatMgr().GetThreatList();
if (position >= threatlist.size()) if (position >= threatlist.size())
return nullptr; return nullptr;
@@ -278,7 +278,7 @@ public:
template <class PREDICATE> template <class PREDICATE>
void SelectTargetList(std::list<Unit*>& targetList, PREDICATE const& predicate, uint32 maxTargets, SelectTargetMethod targetType) void SelectTargetList(std::list<Unit*>& targetList, PREDICATE const& predicate, uint32 maxTargets, SelectTargetMethod targetType)
{ {
ThreatContainer::StorageType const& threatlist = me->GetThreatMgr().getThreatList(); ThreatContainer::StorageType const& threatlist = me->GetThreatMgr().GetThreatList();
if (threatlist.empty()) if (threatlist.empty())
return; return;
@@ -399,14 +399,14 @@ float ScriptedAI::DoGetThreat(Unit* unit)
{ {
if (!unit) if (!unit)
return 0.0f; return 0.0f;
return me->GetThreatMgr().getThreat(unit); return me->GetThreatMgr().GetThreat(unit);
} }
void ScriptedAI::DoModifyThreatPercent(Unit* unit, int32 pct) void ScriptedAI::DoModifyThreatPercent(Unit* unit, int32 pct)
{ {
if (!unit) if (!unit)
return; return;
me->GetThreatMgr().modifyThreatPercent(unit, pct); me->GetThreatMgr().ModifyThreatByPercent(unit, pct);
} }
void ScriptedAI::DoTeleportPlayer(Unit* unit, float x, float y, float z, float o) void ScriptedAI::DoTeleportPlayer(Unit* unit, float x, float y, float z, float o)
@@ -580,7 +580,7 @@ void BossAI::TeleportCheaters()
float x, y, z; float x, y, z;
me->GetPosition(x, y, z); me->GetPosition(x, y, z);
ThreatContainer::StorageType threatList = me->GetThreatMgr().getThreatList(); ThreatContainer::StorageType threatList = me->GetThreatMgr().GetThreatList();
for (ThreatContainer::StorageType::const_iterator itr = threatList.begin(); itr != threatList.end(); ++itr) for (ThreatContainer::StorageType::const_iterator itr = threatList.begin(); itr != threatList.end(); ++itr)
if (Unit* target = (*itr)->getTarget()) if (Unit* target = (*itr)->getTarget())
if (target->GetTypeId() == TYPEID_PLAYER && !IsInBoundary(target)) if (target->GetTypeId() == TYPEID_PLAYER && !IsInBoundary(target))
@@ -522,12 +522,12 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
if (!me) if (!me)
break; break;
ThreatContainer::StorageType threatList = me->GetThreatMgr().getThreatList(); ThreatContainer::StorageType threatList = me->GetThreatMgr().GetThreatList();
for (ThreatContainer::StorageType::const_iterator i = threatList.begin(); i != threatList.end(); ++i) for (ThreatContainer::StorageType::const_iterator i = threatList.begin(); i != threatList.end(); ++i)
{ {
if (Unit* target = ObjectAccessor::GetUnit(*me, (*i)->getUnitGuid())) if (Unit* target = ObjectAccessor::GetUnit(*me, (*i)->getUnitGuid()))
{ {
me->GetThreatMgr().modifyThreatPercent(target, e.action.threatPCT.threatINC ? (int32)e.action.threatPCT.threatINC : -(int32)e.action.threatPCT.threatDEC); me->GetThreatMgr().ModifyThreatByPercent(target, e.action.threatPCT.threatINC ? (int32)e.action.threatPCT.threatINC : -(int32)e.action.threatPCT.threatDEC);
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction:: SMART_ACTION_THREAT_ALL_PCT: Creature {} modify threat for unit {}, value {}", LOG_DEBUG("sql.sql", "SmartScript::ProcessAction:: SMART_ACTION_THREAT_ALL_PCT: Creature {} modify threat for unit {}, value {}",
me->GetGUID().ToString(), target->GetGUID().ToString(), e.action.threatPCT.threatINC ? (int32)e.action.threatPCT.threatINC : -(int32)e.action.threatPCT.threatDEC); me->GetGUID().ToString(), target->GetGUID().ToString(), e.action.threatPCT.threatINC ? (int32)e.action.threatPCT.threatINC : -(int32)e.action.threatPCT.threatDEC);
} }
@@ -543,7 +543,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
{ {
if (IsUnit(target)) if (IsUnit(target))
{ {
me->GetThreatMgr().modifyThreatPercent(target->ToUnit(), e.action.threatPCT.threatINC ? (int32)e.action.threatPCT.threatINC : -(int32)e.action.threatPCT.threatDEC); me->GetThreatMgr().ModifyThreatByPercent(target->ToUnit(), e.action.threatPCT.threatINC ? (int32)e.action.threatPCT.threatINC : -(int32)e.action.threatPCT.threatDEC);
LOG_DEBUG("scripts.ai", "SmartScript::ProcessAction:: SMART_ACTION_THREAT_SINGLE_PCT: Creature guidLow {} modify threat for unit {}, value %i", LOG_DEBUG("scripts.ai", "SmartScript::ProcessAction:: SMART_ACTION_THREAT_SINGLE_PCT: Creature guidLow {} modify threat for unit {}, value %i",
me->GetGUID().ToString(), target->GetGUID().ToString(), e.action.threatPCT.threatINC ? (int32)e.action.threatPCT.threatINC : -(int32)e.action.threatPCT.threatDEC); me->GetGUID().ToString(), target->GetGUID().ToString(), e.action.threatPCT.threatINC ? (int32)e.action.threatPCT.threatINC : -(int32)e.action.threatPCT.threatDEC);
} }
@@ -3219,7 +3219,7 @@ void SmartScript::GetTargets(ObjectVector& targets, SmartScriptHolder const& e,
{ {
if (me) if (me)
{ {
ThreatContainer::StorageType threatList = me->GetThreatMgr().getThreatList(); ThreatContainer::StorageType threatList = me->GetThreatMgr().GetThreatList();
for (ThreatContainer::StorageType::const_iterator i = threatList.begin(); i != threatList.end(); ++i) for (ThreatContainer::StorageType::const_iterator i = threatList.begin(); i != threatList.end(); ++i)
if (Unit* temp = ObjectAccessor::GetUnit(*me, (*i)->getUnitGuid())) if (Unit* temp = ObjectAccessor::GetUnit(*me, (*i)->getUnitGuid()))
// Xinef: added distance check // Xinef: added distance check
+2 -2
View File
@@ -53,7 +53,7 @@ void HostileRefMgr::threatAssist(Unit* victim, float baseThreat, SpellInfo const
} }
} }
ref->GetSource()->doAddThreat(victim, threat); ref->GetSource()->DoAddThreat(victim, threat);
} }
ref = ref->next(); ref = ref->next();
@@ -239,7 +239,7 @@ void HostileRefMgr::UpdateVisibility(bool checkThreat)
while (ref) while (ref)
{ {
HostileReference* nextRef = ref->next(); HostileReference* nextRef = ref->next();
if ((!checkThreat || ref->GetSource()->getThreatList().size() <= 1)) if ((!checkThreat || ref->GetSource()->GetThreatListSize() <= 1))
{ {
nextRef = ref->next(); nextRef = ref->next();
ref->removeReference(); ref->removeReference();
+33 -30
View File
@@ -131,14 +131,17 @@ void HostileReference::fireStatusChanged(ThreatRefStatusChangeEvent& threatRefSt
GetSource()->processThreatEvent(&threatRefStatusChangeEvent); GetSource()->processThreatEvent(&threatRefStatusChangeEvent);
} }
// -- compatibility layer for combat rewrite
Unit* HostileReference::GetOwner() const { return GetSource()->GetOwner(); }
//============================================================ //============================================================
void HostileReference::addThreat(float modThreat) void HostileReference::AddThreat(float modThreat)
{ {
iThreat += modThreat; iThreat += modThreat;
// the threat is changed. Source and target unit have to be available // the threat is changed. Source and target unit have to be available
// if the link was cut before relink it again // if the link was cut before relink it again
if (!isOnline()) if (!IsOnline())
updateOnlineStatus(); updateOnlineStatus();
if (modThreat != 0.0f) if (modThreat != 0.0f)
{ {
@@ -154,7 +157,7 @@ void HostileReference::addThreat(float modThreat)
Unit* victimOwner = target->GetCharmerOrOwner(); Unit* victimOwner = target->GetCharmerOrOwner();
if (victimOwner && victimOwner->IsAlive()) if (victimOwner && victimOwner->IsAlive())
{ {
GetSource()->addThreat(victimOwner, 0.0f); // create a threat to the owner of a pet, if the pet attacks GetSource()->AddThreat(victimOwner, 0.0f); // create a threat to the owner of a pet, if the pet attacks
} }
} }
} }
@@ -169,7 +172,7 @@ void HostileReference::addThreatPercent(int32 percent)
float tmpThreat = iThreat; float tmpThreat = iThreat;
AddPct(tmpThreat, percent); AddPct(tmpThreat, percent);
addThreat(tmpThreat - iThreat); AddThreat(tmpThreat - iThreat);
} }
//============================================================ //============================================================
@@ -256,7 +259,7 @@ void ThreatContainer::clearReferences()
//============================================================ //============================================================
// Return the HostileReference of nullptr, if not found // Return the HostileReference of nullptr, if not found
HostileReference* ThreatContainer::getReferenceByTarget(Unit* victim) const HostileReference* ThreatContainer::getReferenceByTarget(Unit const* victim) const
{ {
if (!victim) if (!victim)
return nullptr; return nullptr;
@@ -281,17 +284,17 @@ HostileReference* ThreatContainer::getReferenceByTarget(ObjectGuid const& guid)
//============================================================ //============================================================
// Add the threat, if we find the reference // Add the threat, if we find the reference
HostileReference* ThreatContainer::addThreat(Unit* victim, float threat) HostileReference* ThreatContainer::AddThreat(Unit* victim, float threat)
{ {
HostileReference* ref = getReferenceByTarget(victim); HostileReference* ref = getReferenceByTarget(victim);
if (ref) if (ref)
ref->addThreat(threat); ref->AddThreat(threat);
return ref; return ref;
} }
//============================================================ //============================================================
void ThreatContainer::modifyThreatPercent(Unit* victim, int32 percent) void ThreatContainer::ModifyThreatByPercent(Unit* victim, int32 percent)
{ {
if (HostileReference* ref = getReferenceByTarget(victim)) if (HostileReference* ref = getReferenceByTarget(victim))
ref->addThreatPercent(percent); ref->addThreatPercent(percent);
@@ -312,7 +315,7 @@ void ThreatContainer::update()
// return the next best victim // return the next best victim
// could be the current victim // could be the current victim
HostileReference* ThreatContainer::selectNextVictim(Creature* attacker, HostileReference* currentVictim) const HostileReference* ThreatContainer::SelectNextVictim(Creature* attacker, HostileReference* currentVictim) const
{ {
// pussywizard: pretty much remade this whole function // pussywizard: pretty much remade this whole function
@@ -370,12 +373,12 @@ HostileReference* ThreatContainer::selectNextVictim(Creature* attacker, HostileR
} }
// pussywizard: implement 110% threat rule for targets in melee range and 130% rule for targets in ranged distances // pussywizard: implement 110% threat rule for targets in melee range and 130% rule for targets in ranged distances
if (currentRef->getThreat() > 1.3f * currentVictim->getThreat()) // pussywizard: enough in all cases, end if (currentRef->GetThreat() > 1.3f * currentVictim->GetThreat()) // pussywizard: enough in all cases, end
{ {
found = true; found = true;
break; break;
} }
else if (currentRef->getThreat() > 1.1f * currentVictim->getThreat()) // pussywizard: enought only if target in melee range else if (currentRef->GetThreat() > 1.1f * currentVictim->GetThreat()) // pussywizard: enought only if target in melee range
{ {
if (attacker->IsWithinMeleeRange(target)) if (attacker->IsWithinMeleeRange(target))
{ {
@@ -431,7 +434,7 @@ void ThreatMgr::clearReferences()
//============================================================ //============================================================
void ThreatMgr::addThreat(Unit* victim, float threat, SpellSchoolMask schoolMask, SpellInfo const* threatSpell) void ThreatMgr::AddThreat(Unit* victim, float threat, SpellSchoolMask schoolMask, SpellInfo const* threatSpell)
{ {
if (!ThreatCalcHelper::isValidProcess(victim, iOwner, threatSpell)) if (!ThreatCalcHelper::isValidProcess(victim, iOwner, threatSpell))
return; return;
@@ -445,10 +448,10 @@ void ThreatMgr::addThreat(Unit* victim, float threat, SpellSchoolMask schoolMask
} }
} }
doAddThreat(victim, threat); DoAddThreat(victim, threat);
} }
void ThreatMgr::doAddThreat(Unit* victim, float threat) void ThreatMgr::DoAddThreat(Unit* victim, float threat)
{ {
uint32 redirectThreadPct = victim->GetRedirectThreatPercent(); uint32 redirectThreadPct = victim->GetRedirectThreatPercent();
@@ -469,17 +472,17 @@ void ThreatMgr::doAddThreat(Unit* victim, float threat)
void ThreatMgr::_addThreat(Unit* victim, float threat) void ThreatMgr::_addThreat(Unit* victim, float threat)
{ {
HostileReference* ref = iThreatContainer.addThreat(victim, threat); HostileReference* ref = iThreatContainer.AddThreat(victim, threat);
// Ref is not in the online refs, search the offline refs next // Ref is not in the online refs, search the offline refs next
if (!ref) if (!ref)
ref = iThreatOfflineContainer.addThreat(victim, threat); ref = iThreatOfflineContainer.AddThreat(victim, threat);
if (!ref) // there was no ref => create a new one if (!ref) // there was no ref => create a new one
{ {
// threat has to be 0 here // threat has to be 0 here
HostileReference* hostileRef = new HostileReference(victim, this, 0); HostileReference* hostileRef = new HostileReference(victim, this, 0);
iThreatContainer.addReference(hostileRef); iThreatContainer.addReference(hostileRef);
hostileRef->addThreat(threat); // now we add the real threat hostileRef->AddThreat(threat); // now we add the real threat
if (victim->GetTypeId() == TYPEID_PLAYER && victim->ToPlayer()->IsGameMaster()) if (victim->GetTypeId() == TYPEID_PLAYER && victim->ToPlayer()->IsGameMaster())
hostileRef->setOnlineOfflineState(false); // GM is always offline hostileRef->setOnlineOfflineState(false); // GM is always offline
} }
@@ -487,9 +490,9 @@ void ThreatMgr::_addThreat(Unit* victim, float threat)
//============================================================ //============================================================
void ThreatMgr::modifyThreatPercent(Unit* victim, int32 percent) void ThreatMgr::ModifyThreatByPercent(Unit* victim, int32 percent)
{ {
iThreatContainer.modifyThreatPercent(victim, percent); iThreatContainer.ModifyThreatByPercent(victim, percent);
} }
//============================================================ //============================================================
@@ -497,21 +500,21 @@ void ThreatMgr::modifyThreatPercent(Unit* victim, int32 percent)
Unit* ThreatMgr::getHostileTarget() Unit* ThreatMgr::getHostileTarget()
{ {
iThreatContainer.update(); iThreatContainer.update();
HostileReference* nextVictim = iThreatContainer.selectNextVictim(GetOwner()->ToCreature(), getCurrentVictim()); HostileReference* nextVictim = iThreatContainer.SelectNextVictim(GetOwner()->ToCreature(), getCurrentVictim());
setCurrentVictim(nextVictim); setCurrentVictim(nextVictim);
return getCurrentVictim() != nullptr ? getCurrentVictim()->getTarget() : nullptr; return getCurrentVictim() != nullptr ? getCurrentVictim()->getTarget() : nullptr;
} }
//============================================================ //============================================================
float ThreatMgr::getThreat(Unit* victim, bool alsoSearchOfflineList) float ThreatMgr::GetThreat(Unit* victim, bool alsoSearchOfflineList)
{ {
float threat = 0.0f; float threat = 0.0f;
HostileReference* ref = iThreatContainer.getReferenceByTarget(victim); HostileReference* ref = iThreatContainer.getReferenceByTarget(victim);
if (!ref && alsoSearchOfflineList) if (!ref && alsoSearchOfflineList)
ref = iThreatOfflineContainer.getReferenceByTarget(victim); ref = iThreatOfflineContainer.getReferenceByTarget(victim);
if (ref) if (ref)
threat = ref->getThreat(); threat = ref->GetThreat();
return threat; return threat;
} }
@@ -524,7 +527,7 @@ float ThreatMgr::getThreatWithoutTemp(Unit* victim, bool alsoSearchOfflineList)
if (!ref && alsoSearchOfflineList) if (!ref && alsoSearchOfflineList)
ref = iThreatOfflineContainer.getReferenceByTarget(victim); ref = iThreatOfflineContainer.getReferenceByTarget(victim);
if (ref) if (ref)
threat = ref->getThreat() - ref->getTempThreatModifier(); threat = ref->GetThreat() - ref->getTempThreatModifier();
return threat; return threat;
} }
@@ -533,10 +536,10 @@ float ThreatMgr::getThreatWithoutTemp(Unit* victim, bool alsoSearchOfflineList)
void ThreatMgr::tauntApply(Unit* taunter) void ThreatMgr::tauntApply(Unit* taunter)
{ {
HostileReference* ref = iThreatContainer.getReferenceByTarget(taunter); HostileReference* ref = iThreatContainer.getReferenceByTarget(taunter);
if (getCurrentVictim() && ref && (ref->getThreat() < getCurrentVictim()->getThreat())) if (getCurrentVictim() && ref && (ref->GetThreat() < getCurrentVictim()->GetThreat()))
{ {
if (ref->getTempThreatModifier() == 0.0f) // Ok, temp threat is unused if (ref->getTempThreatModifier() == 0.0f) // Ok, temp threat is unused
ref->setTempThreat(getCurrentVictim()->getThreat()); ref->setTempThreat(getCurrentVictim()->GetThreat());
} }
} }
@@ -578,7 +581,7 @@ void ThreatMgr::processThreatEvent(ThreatRefStatusChangeEvent* threatRefStatusCh
setDirty(true); // the order in the threat list might have changed setDirty(true); // the order in the threat list might have changed
break; break;
case UEV_THREAT_REF_ONLINE_STATUS: case UEV_THREAT_REF_ONLINE_STATUS:
if (!hostileRef->isOnline()) if (!hostileRef->IsOnline())
{ {
if (hostileRef == getCurrentVictim()) if (hostileRef == getCurrentVictim())
{ {
@@ -594,7 +597,7 @@ void ThreatMgr::processThreatEvent(ThreatRefStatusChangeEvent* threatRefStatusCh
} }
else else
{ {
if (getCurrentVictim() && hostileRef->getThreat() > (1.1f * getCurrentVictim()->getThreat())) if (getCurrentVictim() && hostileRef->GetThreat() > (1.1f * getCurrentVictim()->GetThreat()))
setDirty(true); setDirty(true);
iThreatContainer.addReference(hostileRef); iThreatContainer.addReference(hostileRef);
iThreatOfflineContainer.remove(hostileRef); iThreatOfflineContainer.remove(hostileRef);
@@ -607,7 +610,7 @@ void ThreatMgr::processThreatEvent(ThreatRefStatusChangeEvent* threatRefStatusCh
setDirty(true); setDirty(true);
} }
iOwner->SendRemoveFromThreatListOpcode(hostileRef); iOwner->SendRemoveFromThreatListOpcode(hostileRef);
if (hostileRef->isOnline()) if (hostileRef->IsOnline())
iThreatContainer.remove(hostileRef); iThreatContainer.remove(hostileRef);
else else
iThreatOfflineContainer.remove(hostileRef); iThreatOfflineContainer.remove(hostileRef);
@@ -630,14 +633,14 @@ bool ThreatMgr::isNeedUpdateToClient(uint32 time)
} }
// Reset all aggro without modifying the threatlist. // Reset all aggro without modifying the threatlist.
void ThreatMgr::resetAllAggro() void ThreatMgr::ResetAllThreat()
{ {
ThreatContainer::StorageType& threatList = iThreatContainer.iThreatList; ThreatContainer::StorageType& threatList = iThreatContainer.iThreatList;
if (threatList.empty()) if (threatList.empty())
return; return;
for (ThreatContainer::StorageType::iterator itr = threatList.begin(); itr != threatList.end(); ++itr) for (ThreatContainer::StorageType::iterator itr = threatList.begin(); itr != threatList.end(); ++itr)
(*itr)->setThreat(0); (*itr)->SetThreat(0);
setDirty(true); setDirty(true);
} }
+44 -31
View File
@@ -19,6 +19,7 @@
#define _THREATMANAGER #define _THREATMANAGER
#include "Common.h" #include "Common.h"
#include "IteratorPair.h"
#include "ObjectGuid.h" #include "ObjectGuid.h"
#include "Reference.h" #include "Reference.h"
#include "SharedDefines.h" #include "SharedDefines.h"
@@ -49,36 +50,43 @@ class HostileReference : public Reference<Unit, ThreatMgr>
public: public:
HostileReference(Unit* refUnit, ThreatMgr* threatMgr, float threat); HostileReference(Unit* refUnit, ThreatMgr* threatMgr, float threat);
//================================================= Unit* GetOwner() const;
void addThreat(float modThreat); Unit* GetVictim() const { return getTarget(); }
void setThreat(float threat) { addThreat(threat - getThreat()); } //=================================================
void AddThreat(float modThreat);
void SetThreat(float threat) { AddThreat(threat - GetThreat()); }
void addThreatPercent(int32 percent); void addThreatPercent(int32 percent);
[[nodiscard]] float getThreat() const { return iThreat; } [[nodiscard]] float GetThreat() const { return iThreat; }
[[nodiscard]] bool isOnline() const { return iOnline; } void ClearThreat() { removeReference(); }
[[nodiscard]] bool IsOnline() const { return iOnline; }
[[nodiscard]] bool IsAvailable() const { return iOnline; } // unused for now
[[nodiscard]] bool IsOffline() const { return !iOnline; } // unused for now
// used for temporary setting a threat and reducting it later again. // used for temporary setting a threat and reducting it later again.
// the threat modification is stored // the threat modification is stored
void setTempThreat(float threat) void setTempThreat(float threat)
{ {
addTempThreat(threat - getThreat()); addTempThreat(threat - GetThreat());
} }
void addTempThreat(float threat) void addTempThreat(float threat)
{ {
iTempThreatModifier = threat; iTempThreatModifier = threat;
if (iTempThreatModifier != 0.0f) if (iTempThreatModifier != 0.0f)
addThreat(iTempThreatModifier); AddThreat(iTempThreatModifier);
} }
void resetTempThreat() void resetTempThreat()
{ {
if (iTempThreatModifier != 0.0f) if (iTempThreatModifier != 0.0f)
{ {
addThreat(-iTempThreatModifier); AddThreat(-iTempThreatModifier);
iTempThreatModifier = 0.0f; iTempThreatModifier = 0.0f;
} }
} }
@@ -143,11 +151,11 @@ public:
~ThreatContainer() { clearReferences(); } ~ThreatContainer() { clearReferences(); }
HostileReference* addThreat(Unit* victim, float threat); HostileReference* AddThreat(Unit* victim, float threat);
void modifyThreatPercent(Unit* victim, int32 percent); void ModifyThreatByPercent(Unit* victim, int32 percent);
HostileReference* selectNextVictim(Creature* attacker, HostileReference* currentVictim) const; HostileReference* SelectNextVictim(Creature* attacker, HostileReference* currentVictim) const;
void setDirty(bool isDirty) { iDirty = isDirty; } void setDirty(bool isDirty) { iDirty = isDirty; }
@@ -163,10 +171,10 @@ public:
return iThreatList.empty() ? nullptr : iThreatList.front(); return iThreatList.empty() ? nullptr : iThreatList.front();
} }
HostileReference* getReferenceByTarget(Unit* victim) const; HostileReference* getReferenceByTarget(Unit const* victim) const;
HostileReference* getReferenceByTarget(ObjectGuid const& guid) const; HostileReference* getReferenceByTarget(ObjectGuid const& guid) const;
[[nodiscard]] StorageType const& getThreatList() const { return iThreatList; } [[nodiscard]] StorageType const& GetThreatList() const { return iThreatList; }
private: private:
void remove(HostileReference* hostileRef) void remove(HostileReference* hostileRef)
@@ -190,6 +198,8 @@ private:
//================================================= //=================================================
typedef HostileReference ThreatReference;
class ThreatMgr class ThreatMgr
{ {
public: public:
@@ -199,16 +209,17 @@ public:
~ThreatMgr() { clearReferences(); } ~ThreatMgr() { clearReferences(); }
Unit* SelectVictim() { return getHostileTarget(); }
Unit* GetCurrentVictim() const { if (ThreatReference* ref = getCurrentVictim()) return ref->GetVictim(); else return nullptr; }
Unit* GetAnyTarget() const { auto const& list = GetThreatList(); if (!list.empty()) return list.front()->getTarget(); return nullptr; }
void clearReferences(); void clearReferences();
void addThreat(Unit* victim, float threat, SpellSchoolMask schoolMask = SPELL_SCHOOL_MASK_NORMAL, SpellInfo const* threatSpell = nullptr); void AddThreat(Unit* victim, float threat, SpellSchoolMask schoolMask = SPELL_SCHOOL_MASK_NORMAL, SpellInfo const* threatSpell = nullptr);
void DoAddThreat(Unit* victim, float threat);
void doAddThreat(Unit* victim, float threat); void ModifyThreatByPercent(Unit* victim, int32 percent);
float GetThreat(Unit* victim, bool alsoSearchOfflineList = false);
void modifyThreatPercent(Unit* victim, int32 percent); float GetThreatListSize() const { return GetThreatList().size(); }
float getThreat(Unit* victim, bool alsoSearchOfflineList = false);
float getThreatWithoutTemp(Unit* victim, bool alsoSearchOfflineList = false); float getThreatWithoutTemp(Unit* victim, bool alsoSearchOfflineList = false);
[[nodiscard]] bool isThreatListEmpty() const { return iThreatContainer.empty(); } [[nodiscard]] bool isThreatListEmpty() const { return iThreatContainer.empty(); }
@@ -232,11 +243,10 @@ public:
void setDirty(bool isDirty) { iThreatContainer.setDirty(isDirty); } void setDirty(bool isDirty) { iThreatContainer.setDirty(isDirty); }
// Reset all aggro without modifying the threadlist. // Reset all aggro without modifying the threadlist.
void resetAllAggro(); void ResetThreat(Unit const* who) { if (auto* ref = FindReference(who, true)) ref->SetThreat(0.0f); }
void ResetAllThreat();
// -- compatibility layer for combat rewrite
void ResetAllThreat() { resetAllAggro(); }
void ClearThreat(Unit const* who) { if (auto* ref = FindReference(who, true)) ref->removeReference(); }
void ClearAllThreat(); void ClearAllThreat();
// Reset all aggro of unit in threadlist satisfying the predicate. // Reset all aggro of unit in threadlist satisfying the predicate.
@@ -250,7 +260,7 @@ public:
{ {
if (predicate(ref->getTarget())) if (predicate(ref->getTarget()))
{ {
ref->setThreat(0); ref->SetThreat(0);
setDirty(true); setDirty(true);
} }
} }
@@ -258,11 +268,14 @@ public:
// methods to access the lists from the outside to do some dirty manipulation (scriping and such) // methods to access the lists from the outside to do some dirty manipulation (scriping and such)
// I hope they are used as little as possible. // I hope they are used as little as possible.
[[nodiscard]] ThreatContainer::StorageType const& getThreatList() const { return iThreatContainer.getThreatList(); } [[nodiscard]] ThreatContainer::StorageType const& GetThreatList() const { return iThreatContainer.GetThreatList(); }
[[nodiscard]] ThreatContainer::StorageType const& getOfflineThreatList() const { return iThreatOfflineContainer.getThreatList(); } [[nodiscard]] ThreatContainer::StorageType const& GetOfflineThreatList() const { return iThreatOfflineContainer.GetThreatList(); }
ThreatContainer& getOnlineContainer() { return iThreatContainer; } ThreatContainer& GetOnlineContainer() { return iThreatContainer; }
ThreatContainer& getOfflineContainer() { return iThreatOfflineContainer; } ThreatContainer& GetOfflineContainer() { return iThreatOfflineContainer; }
private: private:
HostileReference* FindReference(Unit const* who, bool includeOffline) const { if (auto* ref = iThreatContainer.getReferenceByTarget(who)) return ref; if (includeOffline) if (auto* ref = iThreatOfflineContainer.getReferenceByTarget(who)) return ref; return nullptr; }
void _addThreat(Unit* victim, float threat); void _addThreat(Unit* victim, float threat);
HostileReference* iCurrentVictim; HostileReference* iCurrentVictim;
@@ -283,7 +296,7 @@ namespace Acore
ThreatOrderPred(bool ascending = false) : m_ascending(ascending) {} ThreatOrderPred(bool ascending = false) : m_ascending(ascending) {}
bool operator() (HostileReference const* a, HostileReference const* b) const bool operator() (HostileReference const* a, HostileReference const* b) const
{ {
return m_ascending ? a->getThreat() < b->getThreat() : a->getThreat() > b->getThreat(); return m_ascending ? a->GetThreat() < b->GetThreat() : a->GetThreat() > b->GetThreat();
} }
private: private:
const bool m_ascending; const bool m_ascending;
@@ -207,8 +207,8 @@ bool TemporaryThreatModifierEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/)
{ {
if (m_owner.IsInCombatWith(victim)) if (m_owner.IsInCombatWith(victim))
{ {
m_owner.GetThreatMgr().modifyThreatPercent(victim, -100); // Reset threat to zero. m_owner.GetThreatMgr().ModifyThreatByPercent(victim, -100); // Reset threat to zero.
m_owner.GetThreatMgr().addThreat(victim, m_threatValue); // Set to the previous value it had, first before modification. m_owner.GetThreatMgr().AddThreat(victim, m_threatValue); // Set to the previous value it had, first before modification.
} }
} }
@@ -839,13 +839,13 @@ void Creature::Update(uint32 diff)
} }
}; };
if (GetThreatMgr().getThreatList().size() <= 1) if (GetThreatMgr().GetThreatListSize() <= 1)
{ {
EnterEvade(); EnterEvade();
} }
else else
{ {
if (HostileReference* ref = GetThreatMgr().getOnlineContainer().getReferenceByTarget(m_cannotReachTarget)) if (HostileReference* ref = GetThreatMgr().GetOnlineContainer().getReferenceByTarget(m_cannotReachTarget))
{ {
ref->removeReference(); ref->removeReference();
SetCannotReachTarget(); SetCannotReachTarget();
@@ -3627,11 +3627,11 @@ void Creature::ModifyThreatPercentTemp(Unit* victim, int32 percent, Milliseconds
{ {
if (victim) if (victim)
{ {
float currentThreat = GetThreatMgr().getThreat(victim); float currentThreat = GetThreatMgr().GetThreat(victim);
if (percent != 0.0f) if (percent != 0.0f)
{ {
GetThreatMgr().modifyThreatPercent(victim, percent); GetThreatMgr().ModifyThreatByPercent(victim, percent);
} }
TemporaryThreatModifierEvent* pEvent = new TemporaryThreatModifierEvent(*this, victim->GetGUID(), currentThreat); TemporaryThreatModifierEvent* pEvent = new TemporaryThreatModifierEvent(*this, victim->GetGUID(), currentThreat);
@@ -2090,7 +2090,7 @@ void GameObject::CastSpell(Unit* target, uint32 spellId)
trigger->SetUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED); trigger->SetUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED);
if (owner->IsFFAPvP()) if (owner->IsFFAPvP())
{ {
if (!HasByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP)) if (!trigger->HasByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP))
{ {
sScriptMgr->OnFfaPvpStateUpdate(trigger, true); sScriptMgr->OnFfaPvpStateUpdate(trigger, true);
trigger->SetByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP); trigger->SetByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP);
+6 -6
View File
@@ -659,12 +659,12 @@ struct ItemTemplate
uint32 ScalingStatValue; // mask for selecting column in ScalingStatValues.dbc uint32 ScalingStatValue; // mask for selecting column in ScalingStatValues.dbc
_Damage Damage[MAX_ITEM_PROTO_DAMAGES]; _Damage Damage[MAX_ITEM_PROTO_DAMAGES];
uint32 Armor; uint32 Armor;
uint32 HolyRes; int32 HolyRes;
uint32 FireRes; int32 FireRes;
uint32 NatureRes; int32 NatureRes;
uint32 FrostRes; int32 FrostRes;
uint32 ShadowRes; int32 ShadowRes;
uint32 ArcaneRes; int32 ArcaneRes;
uint32 Delay; uint32 Delay;
uint32 AmmoType; uint32 AmmoType;
float RangedModRange; float RangedModRange;
+11 -11
View File
@@ -8977,7 +8977,7 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg
return false; return false;
if (victim && victim->IsAlive()) if (victim && victim->IsAlive())
victim->GetThreatMgr().modifyThreatPercent(this, -10); victim->GetThreatMgr().ModifyThreatByPercent(this, -10);
basepoints0 = int32(CountPctFromMaxHealth(triggerAmount)); basepoints0 = int32(CountPctFromMaxHealth(triggerAmount));
trigger_spell_id = 31616; trigger_spell_id = 31616;
@@ -14121,7 +14121,7 @@ void Unit::AddThreat(Unit* victim, float fThreat, SpellSchoolMask schoolMask, Sp
// Only mobs can manage threat lists // Only mobs can manage threat lists
if (CanHaveThreatList() && !HasUnitState(UNIT_STATE_EVADE)) if (CanHaveThreatList() && !HasUnitState(UNIT_STATE_EVADE))
{ {
m_ThreatMgr.addThreat(victim, fThreat, schoolMask, threatSpell); m_ThreatMgr.AddThreat(victim, fThreat, schoolMask, threatSpell);
} }
} }
@@ -18710,8 +18710,8 @@ void Unit::SetPhaseMask(uint32 newPhaseMask, bool update)
// modify threat lists for new phasemask // modify threat lists for new phasemask
if (GetTypeId() != TYPEID_PLAYER) if (GetTypeId() != TYPEID_PLAYER)
{ {
ThreatContainer::StorageType threatList = GetThreatMgr().getThreatList(); ThreatContainer::StorageType threatList = GetThreatMgr().GetThreatList();
ThreatContainer::StorageType offlineThreatList = GetThreatMgr().getOfflineThreatList(); ThreatContainer::StorageType offlineThreatList = GetThreatMgr().GetOfflineThreatList();
// merge expects sorted lists // merge expects sorted lists
threatList.sort(); threatList.sort();
@@ -19685,17 +19685,17 @@ void Unit::SendThreatListUpdate()
{ {
if (!GetThreatMgr().isThreatListEmpty()) if (!GetThreatMgr().isThreatListEmpty())
{ {
uint32 count = GetThreatMgr().getThreatList().size(); uint32 count = GetThreatMgr().GetThreatList().size();
//LOG_DEBUG("entities.unit", "WORLD: Send SMSG_THREAT_UPDATE Message"); //LOG_DEBUG("entities.unit", "WORLD: Send SMSG_THREAT_UPDATE Message");
WorldPacket data(SMSG_THREAT_UPDATE, 8 + count * 8); WorldPacket data(SMSG_THREAT_UPDATE, 8 + count * 8);
data << GetPackGUID(); data << GetPackGUID();
data << uint32(count); data << uint32(count);
ThreatContainer::StorageType const& tlist = GetThreatMgr().getThreatList(); ThreatContainer::StorageType const& tlist = GetThreatMgr().GetThreatList();
for (ThreatContainer::StorageType::const_iterator itr = tlist.begin(); itr != tlist.end(); ++itr) for (ThreatContainer::StorageType::const_iterator itr = tlist.begin(); itr != tlist.end(); ++itr)
{ {
data << (*itr)->getUnitGuid().WriteAsPacked(); data << (*itr)->getUnitGuid().WriteAsPacked();
data << uint32((*itr)->getThreat() * 100); data << uint32((*itr)->GetThreat() * 100);
} }
SendMessageToSet(&data, false); SendMessageToSet(&data, false);
} }
@@ -19705,18 +19705,18 @@ void Unit::SendChangeCurrentVictimOpcode(HostileReference* pHostileReference)
{ {
if (!GetThreatMgr().isThreatListEmpty()) if (!GetThreatMgr().isThreatListEmpty())
{ {
uint32 count = GetThreatMgr().getThreatList().size(); uint32 count = GetThreatMgr().GetThreatList().size();
LOG_DEBUG("entities.unit", "WORLD: Send SMSG_HIGHEST_THREAT_UPDATE Message"); LOG_DEBUG("entities.unit", "WORLD: Send SMSG_HIGHEST_THREAT_UPDATE Message");
WorldPacket data(SMSG_HIGHEST_THREAT_UPDATE, 8 + 8 + count * 8); WorldPacket data(SMSG_HIGHEST_THREAT_UPDATE, 8 + 8 + count * 8);
data << GetPackGUID(); data << GetPackGUID();
data << pHostileReference->getUnitGuid().WriteAsPacked(); data << pHostileReference->getUnitGuid().WriteAsPacked();
data << uint32(count); data << uint32(count);
ThreatContainer::StorageType const& tlist = GetThreatMgr().getThreatList(); ThreatContainer::StorageType const& tlist = GetThreatMgr().GetThreatList();
for (ThreatContainer::StorageType::const_iterator itr = tlist.begin(); itr != tlist.end(); ++itr) for (ThreatContainer::StorageType::const_iterator itr = tlist.begin(); itr != tlist.end(); ++itr)
{ {
data << (*itr)->getUnitGuid().WriteAsPacked(); data << (*itr)->getUnitGuid().WriteAsPacked();
data << uint32((*itr)->getThreat() * 100); data << uint32((*itr)->GetThreat() * 100);
} }
SendMessageToSet(&data, false); SendMessageToSet(&data, false);
} }
@@ -20646,7 +20646,7 @@ bool Unit::IsInCombatWith(Unit const* who) const
return false; return false;
// Search in threat list // Search in threat list
ObjectGuid guid = who->GetGUID(); ObjectGuid guid = who->GetGUID();
for (ThreatContainer::StorageType::const_iterator i = m_ThreatMgr.getThreatList().begin(); i != m_ThreatMgr.getThreatList().end(); ++i) for (ThreatContainer::StorageType::const_iterator i = m_ThreatMgr.GetThreatList().begin(); i != m_ThreatMgr.GetThreatList().end(); ++i)
{ {
HostileReference* ref = (*i); HostileReference* ref = (*i);
// Return true if the unit matches // Return true if the unit matches
+6 -6
View File
@@ -2692,12 +2692,12 @@ void ObjectMgr::LoadItemTemplates()
} }
itemTemplate.Armor = fields[56].Get<uint32>(); itemTemplate.Armor = fields[56].Get<uint32>();
itemTemplate.HolyRes = fields[57].Get<uint32>(); itemTemplate.HolyRes = fields[57].Get<int32>();
itemTemplate.FireRes = fields[58].Get<uint32>(); itemTemplate.FireRes = fields[58].Get<int32>();
itemTemplate.NatureRes = fields[59].Get<uint32>(); itemTemplate.NatureRes = fields[59].Get<int32>();
itemTemplate.FrostRes = fields[60].Get<uint32>(); itemTemplate.FrostRes = fields[60].Get<int32>();
itemTemplate.ShadowRes = fields[61].Get<uint32>(); itemTemplate.ShadowRes = fields[61].Get<int32>();
itemTemplate.ArcaneRes = fields[62].Get<uint32>(); itemTemplate.ArcaneRes = fields[62].Get<int32>();
itemTemplate.Delay = uint32(fields[63].Get<uint16>()); itemTemplate.Delay = uint32(fields[63].Get<uint16>());
itemTemplate.AmmoType = uint32(fields[64].Get<uint8>()); itemTemplate.AmmoType = uint32(fields[64].Get<uint8>());
itemTemplate.RangedModRange = fields[65].Get<float>(); itemTemplate.RangedModRange = fields[65].Get<float>();
+6 -6
View File
@@ -3299,16 +3299,16 @@ void Spell::EffectTaunt(SpellEffIndex /*effIndex*/)
return; return;
} }
if (!unitTarget->GetThreatMgr().getOnlineContainer().empty()) if (!unitTarget->GetThreatMgr().GetOnlineContainer().empty())
{ {
// Also use this effect to set the taunter's threat to the taunted creature's highest value // Also use this effect to set the taunter's threat to the taunted creature's highest value
float myThreat = unitTarget->GetThreatMgr().getThreat(m_caster); float myThreat = unitTarget->GetThreatMgr().GetThreat(m_caster);
float topThreat = unitTarget->GetThreatMgr().getOnlineContainer().getMostHated()->getThreat(); float topThreat = unitTarget->GetThreatMgr().GetOnlineContainer().getMostHated()->GetThreat();
if (topThreat > myThreat) if (topThreat > myThreat)
unitTarget->GetThreatMgr().doAddThreat(m_caster, topThreat - myThreat); unitTarget->GetThreatMgr().DoAddThreat(m_caster, topThreat - myThreat);
//Set aggro victim to caster //Set aggro victim to caster
if (HostileReference* forcedVictim = unitTarget->GetThreatMgr().getOnlineContainer().getReferenceByTarget(m_caster)) if (HostileReference* forcedVictim = unitTarget->GetThreatMgr().GetOnlineContainer().getReferenceByTarget(m_caster))
unitTarget->GetThreatMgr().setCurrentVictim(forcedVictim); unitTarget->GetThreatMgr().setCurrentVictim(forcedVictim);
} }
@@ -5386,7 +5386,7 @@ void Spell::EffectModifyThreatPercent(SpellEffIndex /*effIndex*/)
if (!unitTarget) if (!unitTarget)
return; return;
unitTarget->GetThreatMgr().modifyThreatPercent(m_caster, damage); unitTarget->GetThreatMgr().ModifyThreatByPercent(m_caster, damage);
} }
void Spell::EffectTransmitted(SpellEffIndex effIndex) void Spell::EffectTransmitted(SpellEffIndex effIndex)
@@ -4391,6 +4391,12 @@ void SpellMgr::LoadSpellInfoCorrections()
spellInfo->SpellFamilyName = SPELLFAMILY_POTION; spellInfo->SpellFamilyName = SPELLFAMILY_POTION;
}); });
// Collect Rookery Egg
ApplySpellFix({ 15958 }, [](SpellInfo* spellInfo)
{
spellInfo->Effects[EFFECT_1].Effect = 0;
});
for (uint32 i = 0; i < GetSpellInfoStoreSize(); ++i) for (uint32 i = 0; i < GetSpellInfoStoreSize(); ++i)
{ {
SpellInfo* spellInfo = mSpellInfoMap[i]; SpellInfo* spellInfo = mSpellInfoMap[i];
+9 -9
View File
@@ -806,7 +806,7 @@ public:
if (!target || target->IsTotem() || target->IsPet()) if (!target || target->IsTotem() || target->IsPet())
return false; return false;
auto const& threatList = target->GetThreatMgr().getThreatList(); auto const& threatList = target->GetThreatMgr().GetThreatList();
ThreatContainer::StorageType::const_iterator itr; ThreatContainer::StorageType::const_iterator itr;
uint32 count = 0; uint32 count = 0;
@@ -817,24 +817,24 @@ public:
Unit* unit = (*itr)->getTarget(); Unit* unit = (*itr)->getTarget();
if (!unit) if (!unit)
{ {
handler->PSendSysMessage(" %u. No Unit - threat %f", ++count, (*itr)->getThreat()); handler->PSendSysMessage(" %u. No Unit - threat %f", ++count, (*itr)->GetThreat());
continue; continue;
} }
handler->PSendSysMessage(" %u. %s (%s) - threat %f", ++count, unit->GetName().c_str(), unit->GetGUID().ToString().c_str(), (*itr)->getThreat()); handler->PSendSysMessage(" %u. %s (%s) - threat %f", ++count, unit->GetName().c_str(), unit->GetGUID().ToString().c_str(), (*itr)->GetThreat());
} }
auto const& threatList2 = target->GetThreatMgr().getOfflineThreatList(); auto const& threatList2 = target->GetThreatMgr().GetOfflineThreatList();
for (itr = threatList2.begin(); itr != threatList2.end(); ++itr) for (itr = threatList2.begin(); itr != threatList2.end(); ++itr)
{ {
Unit* unit = (*itr)->getTarget(); Unit* unit = (*itr)->getTarget();
if (!unit) if (!unit)
{ {
handler->PSendSysMessage(" %u. [offline] No Unit - threat %f", ++count, (*itr)->getThreat()); handler->PSendSysMessage(" %u. [offline] No Unit - threat %f", ++count, (*itr)->GetThreat());
continue; continue;
} }
handler->PSendSysMessage(" %u. [offline] %s (%s) - threat %f", ++count, unit->GetName().c_str(), unit->GetGUID().ToString().c_str(), (*itr)->getThreat()); handler->PSendSysMessage(" %u. [offline] %s (%s) - threat %f", ++count, unit->GetName().c_str(), unit->GetGUID().ToString().c_str(), (*itr)->GetThreat());
} }
handler->SendSysMessage("End of threat list."); handler->SendSysMessage("End of threat list.");
@@ -857,12 +857,12 @@ public:
{ {
if (Unit* unit = ref->GetSource()->GetOwner()) if (Unit* unit = ref->GetSource()->GetOwner())
{ {
handler->PSendSysMessage(" %u. %s %s (%s) - threat %f", ++count, (ref->isOnline() ? "" : "[offline]"), handler->PSendSysMessage(" %u. %s %s (%s) - threat %f", ++count, (ref->IsOnline() ? "" : "[offline]"),
unit->GetName().c_str(), unit->GetGUID().ToString().c_str(), ref->getThreat()); unit->GetName().c_str(), unit->GetGUID().ToString().c_str(), ref->GetThreat());
} }
else else
{ {
handler->PSendSysMessage(" %u. No Owner - threat %f", ++count, ref->getThreat()); handler->PSendSysMessage(" %u. No Owner - threat %f", ++count, ref->GetThreat());
} }
ref = ref->next(); ref = ref->next();
@@ -91,8 +91,8 @@ public:
if (Unit* target = me->GetVictim()) if (Unit* target = me->GetVictim())
{ {
_conflagrateTarget = me->GetVictim()->GetGUID(); _conflagrateTarget = me->GetVictim()->GetGUID();
_conflagrateThreat = me->GetThreatMgr().getThreat(me->GetVictim()); _conflagrateThreat = me->GetThreatMgr().GetThreat(me->GetVictim());
me->GetThreatMgr().modifyThreatPercent(target, -100); me->GetThreatMgr().ModifyThreatByPercent(target, -100);
} }
events.ScheduleEvent(EVENT_CONFLAGRATION, urand(10000, 13000)); events.ScheduleEvent(EVENT_CONFLAGRATION, urand(10000, 13000));
events.ScheduleEvent(EVENT_CHECK_CONFLAGRATION_TARGET, 10000); events.ScheduleEvent(EVENT_CHECK_CONFLAGRATION_TARGET, 10000);
@@ -112,7 +112,7 @@ public:
case EVENT_CHECK_CONFLAGRATION_TARGET: case EVENT_CHECK_CONFLAGRATION_TARGET:
if (Unit* target = ObjectAccessor::GetUnit(*me, _conflagrateTarget)) if (Unit* target = ObjectAccessor::GetUnit(*me, _conflagrateTarget))
{ {
me->GetThreatMgr().addThreat(target, _conflagrateThreat); me->GetThreatMgr().AddThreat(target, _conflagrateThreat);
} }
break; break;
} }
@@ -122,13 +122,13 @@ struct boss_mor_grayhoof : public BossAI
// Sleep can target tank, we need to drop threat temporarily on the target. // Sleep can target tank, we need to drop threat temporarily on the target.
_sleepTargetGUID = target->GetGUID(); _sleepTargetGUID = target->GetGUID();
_sleepTargetThreat = me->GetThreatMgr().getThreat(target); _sleepTargetThreat = me->GetThreatMgr().GetThreat(target);
me->GetThreatMgr().modifyThreatPercent(target, -100); me->GetThreatMgr().ModifyThreatByPercent(target, -100);
_scheduler.Schedule(10s, [this](TaskContext /*context*/) _scheduler.Schedule(10s, [this](TaskContext /*context*/)
{ {
if (Unit* sleepTarget = ObjectAccessor::GetUnit(*me, _sleepTargetGUID)) if (Unit* sleepTarget = ObjectAccessor::GetUnit(*me, _sleepTargetGUID))
{ {
me->GetThreatMgr().addThreat(sleepTarget, _sleepTargetThreat); me->GetThreatMgr().AddThreat(sleepTarget, _sleepTargetThreat);
} }
}); });
} }
@@ -679,7 +679,7 @@ struct boss_nefarian : public BossAI
case EVENT_CLASSCALL: case EVENT_CLASSCALL:
if (classesPresent.empty()) if (classesPresent.empty())
{ {
for (auto& ref : me->GetThreatMgr().getThreatList()) for (auto& ref : me->GetThreatMgr().GetThreatList())
{ {
if (ref->getTarget() && ref->getTarget()->GetTypeId() == TYPEID_PLAYER) if (ref->getTarget() && ref->getTarget()->GetTypeId() == TYPEID_PLAYER)
{ {
@@ -213,6 +213,8 @@ public:
majordomoSummonsData[spawn->GetGUID().GetCounter()] = MajordomoAddData(spawn->GetGUID(), spawn->GetEntry(), spawn->GetPosition()); majordomoSummonsData[spawn->GetGUID().GetCounter()] = MajordomoAddData(spawn->GetGUID(), spawn->GetEntry(), spawn->GetPosition());
} }
} }
me->RemoveNpcFlag(UNIT_NPC_FLAG_GOSSIP);
} }
else else
{ {
@@ -236,7 +236,7 @@ public:
void EnterEvadeMode(EvadeReason why) override void EnterEvadeMode(EvadeReason why) override
{ {
if (!me->GetThreatMgr().getThreatList().empty()) if (!me->GetThreatMgr().GetThreatList().empty())
{ {
if (!_processingMagmaBurst) if (!_processingMagmaBurst)
{ {
@@ -171,7 +171,7 @@ public:
if (Creature* creatureCaster = caster->ToCreature()) if (Creature* creatureCaster = caster->ToCreature())
{ {
creatureCaster->GetThreatMgr().ResetAllThreat(); creatureCaster->GetThreatMgr().ResetAllThreat();
creatureCaster->GetThreatMgr().addThreat(target, 1); creatureCaster->GetThreatMgr().AddThreat(target, 1);
creatureCaster->AI()->AttackStart(target); // Attack the target which caster will teleport to. creatureCaster->AI()->AttackStart(target); // Attack the target which caster will teleport to.
} }
} }
@@ -163,7 +163,7 @@ public:
if (GetBossState(linkedBossObjData[i].bossId) == DONE) if (GetBossState(linkedBossObjData[i].bossId) == DONE)
{ {
go->DespawnOrUnsummon(); go->DespawnOrUnsummon(0ms, Seconds(WEEK));
} }
else else
{ {
@@ -190,7 +190,7 @@ public:
if (GetBossState(linkedBossObjData[i].bossId) == DONE) if (GetBossState(linkedBossObjData[i].bossId) == DONE)
{ {
go->SetGoState(GO_STATE_ACTIVE); go->UseDoorOrButton(WEEK * IN_MILLISECONDS);
} }
else else
{ {
@@ -310,13 +310,13 @@ public:
{ {
if (GameObject* circle = instance->GetGameObject(_circlesGUIDs[bossId])) if (GameObject* circle = instance->GetGameObject(_circlesGUIDs[bossId]))
{ {
circle->DespawnOrUnsummon(); circle->DespawnOrUnsummon(0ms, Seconds(WEEK));
_circlesGUIDs[bossId].Clear(); _circlesGUIDs[bossId].Clear();
} }
if (GameObject* rune = instance->GetGameObject(_runesGUIDs[bossId])) if (GameObject* rune = instance->GetGameObject(_runesGUIDs[bossId]))
{ {
rune->SetGoState(GO_STATE_ACTIVE); rune->UseDoorOrButton(WEEK * IN_MILLISECONDS);
_runesGUIDs[bossId].Clear(); _runesGUIDs[bossId].Clear();
} }
@@ -212,7 +212,7 @@ public:
} }
// aggro target if Red Beam // aggro target if Red Beam
if (j == RED_PORTAL && me->GetVictim() != target && target->GetTypeId() == TYPEID_PLAYER) if (j == RED_PORTAL && me->GetVictim() != target && target->GetTypeId() == TYPEID_PLAYER)
me->GetThreatMgr().addThreat(target, 100000.0f + DoGetThreat(me->GetVictim())); me->GetThreatMgr().AddThreat(target, 100000.0f + DoGetThreat(me->GetVictim()));
} }
} }
@@ -251,7 +251,7 @@ public:
if (!info) if (!info)
return; return;
ThreatContainer::StorageType const& t_list = me->GetThreatMgr().getThreatList(); ThreatContainer::StorageType const& t_list = me->GetThreatMgr().GetThreatList();
std::vector<Unit*> targets; std::vector<Unit*> targets;
if (t_list.empty()) if (t_list.empty())
@@ -162,7 +162,7 @@ public:
void FlameWreathEffect() void FlameWreathEffect()
{ {
std::vector<Unit*> targets; std::vector<Unit*> targets;
ThreatContainer::StorageType const& t_list = me->GetThreatMgr().getThreatList(); ThreatContainer::StorageType const& t_list = me->GetThreatMgr().GetThreatList();
if (t_list.empty()) if (t_list.empty())
return; return;
@@ -299,16 +299,16 @@ struct boss_priestess_lackey_commonAI : public ScriptedAI
void RecalculateThreat() void RecalculateThreat()
{ {
ThreatContainer::StorageType const& tList = me->GetThreatMgr().getThreatList(); ThreatContainer::StorageType const& tList = me->GetThreatMgr().GetThreatList();
for( ThreatContainer::StorageType::const_iterator itr = tList.begin(); itr != tList.end(); ++itr ) for( ThreatContainer::StorageType::const_iterator itr = tList.begin(); itr != tList.end(); ++itr )
{ {
Unit* pUnit = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid()); Unit* pUnit = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid());
if( pUnit && pUnit->GetTypeId() == TYPEID_PLAYER && me->GetThreatMgr().getThreat(pUnit) ) if( pUnit && pUnit->GetTypeId() == TYPEID_PLAYER && me->GetThreatMgr().GetThreat(pUnit) )
{ {
float threatMod = GetThreatMod(me->GetDistance2d(pUnit), (float)pUnit->GetArmor(), pUnit->GetHealth(), pUnit->GetMaxHealth(), pUnit); float threatMod = GetThreatMod(me->GetDistance2d(pUnit), (float)pUnit->GetArmor(), pUnit->GetHealth(), pUnit->GetMaxHealth(), pUnit);
me->GetThreatMgr().modifyThreatPercent(pUnit, -100); me->GetThreatMgr().ModifyThreatByPercent(pUnit, -100);
if (HostileReference* ref = me->GetThreatMgr().getOnlineContainer().getReferenceByTarget(pUnit)) if (HostileReference* ref = me->GetThreatMgr().GetOnlineContainer().getReferenceByTarget(pUnit))
ref->addThreat(10000000.0f * threatMod); ref->AddThreat(10000000.0f * threatMod);
} }
} }
} }
@@ -741,7 +741,7 @@ public:
case EVENT_SPELL_BLINK: case EVENT_SPELL_BLINK:
{ {
bool InMeleeRange = false; bool InMeleeRange = false;
ThreatContainer::StorageType const& t_list = me->GetThreatMgr().getThreatList(); ThreatContainer::StorageType const& t_list = me->GetThreatMgr().GetThreatList();
for (ThreatContainer::StorageType::const_iterator itr = t_list.begin(); itr != t_list.end(); ++itr) for (ThreatContainer::StorageType::const_iterator itr = t_list.begin(); itr != t_list.end(); ++itr)
if (Unit* target = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid())) if (Unit* target = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid()))
if (target->IsWithinMeleeRange(me)) if (target->IsWithinMeleeRange(me))
@@ -371,7 +371,7 @@ public:
Unit* SelectUnitCasting() Unit* SelectUnitCasting()
{ {
ThreatContainer::StorageType threatlist = me->GetThreatMgr().getThreatList(); ThreatContainer::StorageType threatlist = me->GetThreatMgr().GetThreatList();
for (ThreatContainer::StorageType::const_iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr) for (ThreatContainer::StorageType::const_iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr)
{ {
if (Unit* unit = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid())) if (Unit* unit = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid()))
@@ -130,7 +130,7 @@ class spell_gahzranka_slam : public SpellScript
{ {
if (Unit* caster = GetCaster()) if (Unit* caster = GetCaster())
{ {
_wipeThreat = targets.size() < caster->GetThreatMgr().getThreatList().size(); _wipeThreat = targets.size() < caster->GetThreatMgr().GetThreatListSize();;
} }
} }
@@ -142,7 +142,7 @@ class spell_gahzranka_slam : public SpellScript
{ {
if (Unit* target = GetHitUnit()) if (Unit* target = GetHitUnit())
{ {
caster->GetThreatMgr().modifyThreatPercent(target, -100); caster->GetThreatMgr().ModifyThreatByPercent(target, -100);
} }
} }
} }
@@ -104,14 +104,14 @@ public:
me->SetReactState(REACT_AGGRESSIVE); me->SetReactState(REACT_AGGRESSIVE);
if (Unit* pursuitTarget = ObjectAccessor::GetUnit(*me, _pursuitTargetGUID)) if (Unit* pursuitTarget = ObjectAccessor::GetUnit(*me, _pursuitTargetGUID))
{ {
me->GetThreatMgr().addThreat(pursuitTarget, 1000000.f); me->GetThreatMgr().AddThreat(pursuitTarget, 1000000.f);
} }
break; break;
case EVENT_STOP_PURSUIT: case EVENT_STOP_PURSUIT:
if (Unit* pursuitTarget = ObjectAccessor::GetUnit(*me, _pursuitTargetGUID)) if (Unit* pursuitTarget = ObjectAccessor::GetUnit(*me, _pursuitTargetGUID))
{ {
_pursuitTargetGUID.Clear(); _pursuitTargetGUID.Clear();
me->GetThreatMgr().addThreat(pursuitTarget, -1000000.f); me->GetThreatMgr().AddThreat(pursuitTarget, -1000000.f);
} }
break; break;
case EVENT_ENTANGLING_ROOTS: case EVENT_ENTANGLING_ROOTS:
@@ -160,7 +160,7 @@ public:
events.ScheduleEvent(EVENT_CORRUPTED_BLOOD, urand(30000, 45000)); events.ScheduleEvent(EVENT_CORRUPTED_BLOOD, urand(30000, 45000));
break; break;
case EVENT_CAUSE_INSANITY: case EVENT_CAUSE_INSANITY:
if (me->GetThreatMgr().getThreatList().size() > 1) if (me->GetThreatMgr().GetThreatListSize() > 1)
{ {
if (Unit* victim = SelectTarget(SelectTargetMethod::MaxThreat, 0, 30.f, true)) if (Unit* victim = SelectTarget(SelectTargetMethod::MaxThreat, 0, 30.f, true))
{ {
@@ -186,7 +186,7 @@ public:
if (Unit* victim = SelectTarget(SelectTargetMethod::MaxThreat, 0, 5.f, true)) if (Unit* victim = SelectTarget(SelectTargetMethod::MaxThreat, 0, 5.f, true))
{ {
DoCast(victim, SPELL_ASPECT_OF_MARLI, true); DoCast(victim, SPELL_ASPECT_OF_MARLI, true);
me->GetThreatMgr().modifyThreatPercent(victim, -100.f); me->GetThreatMgr().ModifyThreatByPercent(victim, -100.f);
} }
events.ScheduleEvent(EVENT_ASPECT_OF_MARLI, 45000); events.ScheduleEvent(EVENT_ASPECT_OF_MARLI, 45000);
break; break;
@@ -198,7 +198,7 @@ public:
if (Unit* victim = SelectTarget(SelectTargetMethod::MaxThreat, 0, 5.f, true)) if (Unit* victim = SelectTarget(SelectTargetMethod::MaxThreat, 0, 5.f, true))
{ {
DoCast(victim, SPELL_ASPECT_OF_ARLOKK, true); DoCast(victim, SPELL_ASPECT_OF_ARLOKK, true);
me->GetThreatMgr().modifyThreatPercent(victim, -100.f); me->GetThreatMgr().ModifyThreatByPercent(victim, -100.f);
} }
events.ScheduleEvent(EVENT_ASPECT_OF_ARLOKK, urand(10000, 15000)); events.ScheduleEvent(EVENT_ASPECT_OF_ARLOKK, urand(10000, 15000));
break; break;
@@ -80,7 +80,7 @@ struct boss_hazzarah : public BossAI
bool CanAIAttack(Unit const* target) const override bool CanAIAttack(Unit const* target) const override
{ {
if (me->GetThreatMgr().getThreatList().size() > 1 && me->GetThreatMgr().getOnlineContainer().getMostHated()->getTarget() == target) if (me->GetThreatMgr().GetThreatListSize() > 1 && me->GetThreatMgr().GetOnlineContainer().getMostHated()->getTarget() == target)
return !target->HasAura(SPELL_SLEEP); return !target->HasAura(SPELL_SLEEP);
return true; return true;
@@ -81,7 +81,7 @@ struct boss_jindo : public BossAI
{ {
case NPC_BRAIN_WASH_TOTEM: case NPC_BRAIN_WASH_TOTEM:
summon->SetReactState(REACT_PASSIVE); summon->SetReactState(REACT_PASSIVE);
if (Unit* target = SelectTarget(SelectTargetMethod::Random, me->GetThreatMgr().getThreatList().size() > 1 ? 1 : 0)) if (Unit* target = SelectTarget(SelectTargetMethod::Random, me->GetThreatMgr().GetThreatListSize() > 1 ? 1 : 0))
{ {
summon->CastSpell(target, summon->m_spells[0], true); summon->CastSpell(target, summon->m_spells[0], true);
} }
@@ -132,7 +132,7 @@ struct boss_jindo : public BossAI
events.ScheduleEvent(EVENT_POWERFULL_HEALING_WARD, urand(14000, 20000)); events.ScheduleEvent(EVENT_POWERFULL_HEALING_WARD, urand(14000, 20000));
break; break;
case EVENT_HEX: case EVENT_HEX:
if (me->GetThreatMgr().getThreatList().size() > 1) if (me->GetThreatMgr().GetThreatListSize() > 1)
DoCastVictim(SPELL_HEX, true); DoCastVictim(SPELL_HEX, true);
events.ScheduleEvent(EVENT_HEX, urand(12000, 20000)); events.ScheduleEvent(EVENT_HEX, urand(12000, 20000));
break; break;
@@ -154,7 +154,7 @@ struct boss_jindo : public BossAI
bool CanAIAttack(Unit const* target) const override bool CanAIAttack(Unit const* target) const override
{ {
if (me->GetThreatMgr().getThreatList().size() > 1 && me->GetThreatMgr().getOnlineContainer().getMostHated()->getTarget() == target) if (me->GetThreatMgr().GetThreatListSize() > 1 && me->GetThreatMgr().GetOnlineContainer().getMostHated()->getTarget() == target)
return !target->HasAura(SPELL_HEX); return !target->HasAura(SPELL_HEX);
return true; return true;
@@ -457,7 +457,7 @@ public:
events.DelayEvents(1500); events.DelayEvents(1500);
if (Unit* mainTarget = SelectTarget(SelectTargetMethod::MaxThreat, 0, 100.0f)) if (Unit* mainTarget = SelectTarget(SelectTargetMethod::MaxThreat, 0, 100.0f))
{ {
me->GetThreatMgr().modifyThreatPercent(mainTarget, -100); me->GetThreatMgr().ModifyThreatByPercent(mainTarget, -100);
} }
} }
events.ScheduleEvent(EVENT_CHARGE_PLAYER, urand(30000, 40000)); events.ScheduleEvent(EVENT_CHARGE_PLAYER, urand(30000, 40000));
@@ -469,8 +469,8 @@ public:
case EVENT_CLEAVE: case EVENT_CLEAVE:
{ {
std::list<Unit*> meleeRangeTargets; std::list<Unit*> meleeRangeTargets;
auto i = me->GetThreatMgr().getThreatList().begin(); auto i = me->GetThreatMgr().GetThreatList().begin();
for (; i != me->GetThreatMgr().getThreatList().end(); ++i) for (; i != me->GetThreatMgr().GetThreatList().end(); ++i)
{ {
Unit* target = (*i)->getTarget(); Unit* target = (*i)->getTarget();
if (me->IsWithinMeleeRange(target)) if (me->IsWithinMeleeRange(target))
@@ -314,7 +314,7 @@ class spell_enveloping_webs : public SpellScript
Unit* hitUnit = GetHitUnit(); Unit* hitUnit = GetHitUnit();
if (caster && hitUnit && hitUnit->GetTypeId() == TYPEID_PLAYER) if (caster && hitUnit && hitUnit->GetTypeId() == TYPEID_PLAYER)
{ {
caster->GetThreatMgr().modifyThreatPercent(hitUnit, -100); caster->GetThreatMgr().ModifyThreatByPercent(hitUnit, -100);
} }
} }
@@ -85,7 +85,7 @@ public:
bool CanAIAttack(Unit const* target) const override bool CanAIAttack(Unit const* target) const override
{ {
if (me->GetThreatMgr().getThreatList().size() > 1 && me->GetThreatMgr().getOnlineContainer().getMostHated()->getTarget() == target) if (me->GetThreatMgr().GetThreatListSize() > 1 && me->GetThreatMgr().GetOnlineContainer().getMostHated()->getTarget() == target)
return !target->HasAura(SPELL_GOUGE); return !target->HasAura(SPELL_GOUGE);
return true; return true;
@@ -158,7 +158,7 @@ public:
if (_thousandBladesTargets.empty()) if (_thousandBladesTargets.empty())
{ {
std::vector<Unit*> targetList; std::vector<Unit*> targetList;
ThreatContainer::StorageType const& threatlist = me->GetThreatMgr().getThreatList(); ThreatContainer::StorageType const& threatlist = me->GetThreatMgr().GetThreatList();
for (ThreatContainer::StorageType::const_iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr) for (ThreatContainer::StorageType::const_iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr)
{ {
if (Unit* target = (*itr)->getTarget()) if (Unit* target = (*itr)->getTarget())
+17 -20
View File
@@ -49,10 +49,13 @@ enum kegThrowers
SPELL_THROW_KEG = 43660, SPELL_THROW_KEG = 43660,
SPELL_RAM_AURA = 43883, SPELL_RAM_AURA = 43883,
SPELL_ADD_TOKENS = 44501, SPELL_ADD_TOKENS = 44501,
SPELL_COOLDOWN_CHECKER = 43755, SPELL_RAM_RACING_CROP = 44262,
SPELL_COOLDOWN_CHECKER = 44689,
NPC_RAM_MASTER_RAY = 24497, NPC_RAM_MASTER_RAY = 24497,
NPC_NEILL_RAMSTEIN = 23558, NPC_NEILL_RAMSTEIN = 23558,
KEG_KILL_CREDIT = 24337, KEG_KILL_CREDIT = 24337,
GOSSIP_NEIL = 8953,
GOSSIP_RAY = 8973
}; };
struct npc_brewfest_keg_thrower : public ScriptedAI struct npc_brewfest_keg_thrower : public ScriptedAI
@@ -112,30 +115,21 @@ struct npc_brewfest_keg_reciver : public ScriptedAI
} }
} }
bool OnGossipSelect(Player* player, Creature* /*creature*/, uint32 /*uiSender*/, uint32 uiAction) void sGossipSelect(Player* player, uint32 uiSender, uint32 uiAction) override
{ {
switch (uiAction) if (uiSender == GOSSIP_NEIL || uiSender == GOSSIP_RAY)
{ {
case GOSSIP_ACTION_INFO_DEF+1: player->CastSpell(player, SPELL_COOLDOWN_CHECKER, true);
CloseGossipMenuFor(player); player->AddSpellCooldown(SPELL_COOLDOWN_CHECKER, 0, 18 * HOUR * IN_MILLISECONDS);
player->AddSpellCooldown(SPELL_COOLDOWN_CHECKER, 0, 18 * HOUR * IN_MILLISECONDS);
player->CastSpell(player, 43883, true);
player->CastSpell(player, 44262, true);
break;
} }
return true;
}
bool OnGossipHello(Player* player, Creature* creature) if (uiAction != 4)
{ {
if (creature->IsQuestGiver()) CloseGossipMenuFor(player);
player->PrepareQuestMenu(creature->GetGUID());
if (!player->HasSpellCooldown(SPELL_COOLDOWN_CHECKER) && player->GetQuestRewardStatus(player->GetTeamId() == TEAM_ALLIANCE ? QUEST_THERE_AND_BACK_AGAIN_A : QUEST_THERE_AND_BACK_AGAIN_H)) player->CastSpell(player, SPELL_RAM_AURA, true);
AddGossipItemFor(player, GOSSIP_ICON_CHAT, "Do you have additional work?", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); player->CastSpell(player, SPELL_RAM_RACING_CROP, true);
}
SendGossipMenuFor(player, (creature->GetEntry() == NPC_NEILL_RAMSTEIN ? 8934 : 8976), creature->GetGUID());
return true;
} }
}; };
@@ -294,6 +288,7 @@ enum darkIronAttack
SPELL_DRUNKEN_MASTER = 42696, SPELL_DRUNKEN_MASTER = 42696,
SPELL_SUMMON_PLANS_A = 48145, SPELL_SUMMON_PLANS_A = 48145,
SPELL_SUMMON_PLANS_H = 49318, SPELL_SUMMON_PLANS_H = 49318,
SPELL_WEAK_ALCOHOL = 42523,
// Dark Irons // Dark Irons
SPELL_ATTACK_KEG = 42393, SPELL_ATTACK_KEG = 42393,
@@ -1271,6 +1266,8 @@ class spell_brewfest_toss_mug : public SpellScript
creature->CastSpell(caster, SPELL_THROW_MUG_TO_PLAYER, true); creature->CastSpell(caster, SPELL_THROW_MUG_TO_PLAYER, true);
} }
} }
caster->CastSpell(caster, SPELL_WEAK_ALCOHOL, true);
} }
void Register() override void Register() override
@@ -325,7 +325,7 @@ public:
return; return;
// Now lets get archimode threat list // Now lets get archimode threat list
ThreatContainer::StorageType const& t_list = me->GetThreatMgr().getThreatList(); ThreatContainer::StorageType const& t_list = me->GetThreatMgr().GetThreatList();
if (t_list.empty()) if (t_list.empty())
return; return;
@@ -435,7 +435,7 @@ public:
if (victim && me->IsWithinMeleeRange(victim)) if (victim && me->IsWithinMeleeRange(victim))
return false; return false;
ThreatContainer::StorageType const& threatlist = me->GetThreatMgr().getThreatList(); ThreatContainer::StorageType const& threatlist = me->GetThreatMgr().GetThreatList();
if (threatlist.empty()) if (threatlist.empty())
return false; return false;
@@ -423,7 +423,7 @@ class spell_vem_knockback : public SpellScript
{ {
if (Creature* cCaster = GetCaster()->ToCreature()) if (Creature* cCaster = GetCaster()->ToCreature())
{ {
cCaster->GetThreatMgr().modifyThreatPercent(target, -80); cCaster->GetThreatMgr().ModifyThreatByPercent(target, -80);
} }
} }
} }
@@ -51,7 +51,10 @@ const std::array<uint32, 3> entangleSpells = { SPELL_ENTANGLE_RIGHT, SPELL_ENTAN
struct boss_fankriss : public BossAI struct boss_fankriss : public BossAI
{ {
boss_fankriss(Creature* creature) : BossAI(creature, DATA_FANKRISS) { } boss_fankriss(Creature* creature) : BossAI(creature, DATA_FANKRISS)
{
me->m_CombatDistance = 80.f;
}
void Reset() override void Reset() override
{ {
@@ -180,7 +180,7 @@ struct boss_ouro : public BossAI
void SpellHitTarget(Unit* target, SpellInfo const* spellInfo) override void SpellHitTarget(Unit* target, SpellInfo const* spellInfo) override
{ {
if (spellInfo->Id == SPELL_SAND_BLAST && target) if (spellInfo->Id == SPELL_SAND_BLAST && target)
me->GetThreatMgr().modifyThreatPercent(target, 100); me->GetThreatMgr().ModifyThreatByPercent(target, 100);
} }
void Emerge() void Emerge()
@@ -291,6 +291,7 @@ struct npc_dirt_mound : ScriptedAI
{ {
creature->SetInCombatWithZone(); creature->SetInCombatWithZone();
creature->SetHealth(_ouroHealth); creature->SetHealth(_ouroHealth);
creature->LowerPlayerDamageReq(creature->GetMaxHealth() - creature->GetHealth());
} }
} }
@@ -169,8 +169,8 @@ struct boss_sartura : public BossAI
if (Unit* originalTarget = SelectTarget(SelectTargetMethod::Random, 0)) if (Unit* originalTarget = SelectTarget(SelectTargetMethod::Random, 0))
{ {
_savedTargetGUID = originalTarget->GetGUID(); _savedTargetGUID = originalTarget->GetGUID();
_savedTargetThreat = me->GetThreatMgr().getThreat(originalTarget); _savedTargetThreat = me->GetThreatMgr().GetThreat(originalTarget);
me->GetThreatMgr().modifyThreatPercent(originalTarget, -100); me->GetThreatMgr().ModifyThreatByPercent(originalTarget, -100);
} }
aggroReset = true; aggroReset = true;
events.ScheduleEvent(EVENT_SARTURA_AGGRO_RESET_END, 5000); events.ScheduleEvent(EVENT_SARTURA_AGGRO_RESET_END, 5000);
@@ -190,7 +190,7 @@ struct boss_sartura : public BossAI
events.CancelEvent(EVENT_SARTURA_AGGRO_RESET); events.CancelEvent(EVENT_SARTURA_AGGRO_RESET);
if (Unit* originalTarget = ObjectAccessor::GetUnit(*me, _savedTargetGUID)) if (Unit* originalTarget = ObjectAccessor::GetUnit(*me, _savedTargetGUID))
{ {
me->GetThreatMgr().addThreat(originalTarget, _savedTargetThreat); me->GetThreatMgr().AddThreat(originalTarget, _savedTargetThreat);
_savedTargetGUID.Clear(); _savedTargetGUID.Clear();
} }
aggroReset = false; aggroReset = false;
@@ -286,8 +286,8 @@ struct npc_sartura_royal_guard : public ScriptedAI
if (Unit* originalTarget = SelectTarget(SelectTargetMethod::Random, 0)) if (Unit* originalTarget = SelectTarget(SelectTargetMethod::Random, 0))
{ {
_savedTargetGUID = originalTarget->GetGUID(); _savedTargetGUID = originalTarget->GetGUID();
_savedTargetThreat = me->GetThreatMgr().getThreat(originalTarget); _savedTargetThreat = me->GetThreatMgr().GetThreat(originalTarget);
me->GetThreatMgr().modifyThreatPercent(originalTarget, -100); me->GetThreatMgr().ModifyThreatByPercent(originalTarget, -100);
} }
aggroReset = true; aggroReset = true;
events.ScheduleEvent(EVENT_GUARD_AGGRO_RESET_END, 5000); events.ScheduleEvent(EVENT_GUARD_AGGRO_RESET_END, 5000);
@@ -307,7 +307,7 @@ struct npc_sartura_royal_guard : public ScriptedAI
events.CancelEvent(EVENT_GUARD_AGGRO_RESET); events.CancelEvent(EVENT_GUARD_AGGRO_RESET);
if (Unit* originalTarget = ObjectAccessor::GetUnit(*me, _savedTargetGUID)) if (Unit* originalTarget = ObjectAccessor::GetUnit(*me, _savedTargetGUID))
{ {
me->GetThreatMgr().addThreat(originalTarget, _savedTargetThreat); me->GetThreatMgr().AddThreat(originalTarget, _savedTargetThreat);
_savedTargetGUID.Clear(); _savedTargetGUID.Clear();
} }
aggroReset = false; aggroReset = false;
@@ -189,7 +189,7 @@ class spell_arcane_vacuum : public SpellScript
Unit* hitUnit = GetHitUnit(); Unit* hitUnit = GetHitUnit();
if (caster && hitUnit && hitUnit->ToPlayer()) if (caster && hitUnit && hitUnit->ToPlayer())
{ {
caster->GetThreatMgr().modifyThreatPercent(hitUnit, -100); caster->GetThreatMgr().ModifyThreatByPercent(hitUnit, -100);
caster->CastSpell(hitUnit, SPELL_ARCANE_VACUUM_TP, true); caster->CastSpell(hitUnit, SPELL_ARCANE_VACUUM_TP, true);
} }
} }
@@ -411,7 +411,7 @@ struct boss_taldaram : public BossAI
{ {
//Count alive players //Count alive players
uint8 count = 0; uint8 count = 0;
std::list<HostileReference*> const t_list = me->GetThreatMgr().getThreatList(); std::list<HostileReference*> const t_list = me->GetThreatMgr().GetThreatList();
if (!t_list.empty()) if (!t_list.empty())
{ {
for (HostileReference const* reference : t_list) for (HostileReference const* reference : t_list)
@@ -102,17 +102,17 @@ struct boss_faction_championsAI : public ScriptedAI
void RecalculateThreat() void RecalculateThreat()
{ {
ThreatContainer::StorageType const& tList = me->GetThreatMgr().getThreatList(); ThreatContainer::StorageType const& tList = me->GetThreatMgr().GetThreatList();
for( ThreatContainer::StorageType::const_iterator itr = tList.begin(); itr != tList.end(); ++itr ) for( ThreatContainer::StorageType::const_iterator itr = tList.begin(); itr != tList.end(); ++itr )
{ {
Unit* pUnit = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid()); Unit* pUnit = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid());
if( pUnit && pUnit->GetTypeId() == TYPEID_PLAYER && me->GetThreatMgr().getThreat(pUnit) ) if( pUnit && pUnit->GetTypeId() == TYPEID_PLAYER && me->GetThreatMgr().GetThreat(pUnit) )
{ {
float threatMod = GetThreatMod(me->GetDistance2d(pUnit), (float)pUnit->GetArmor(), pUnit->GetHealth(), pUnit->GetMaxHealth(), pUnit); float threatMod = GetThreatMod(me->GetDistance2d(pUnit), (float)pUnit->GetArmor(), pUnit->GetHealth(), pUnit->GetMaxHealth(), pUnit);
me->GetThreatMgr().modifyThreatPercent(pUnit, -100); me->GetThreatMgr().ModifyThreatByPercent(pUnit, -100);
//me->getThreatMgr().doAddThreat(pUnit, 10000000.0f * threatMod); //me->getThreatMgr().DoAddThreat(pUnit, 10000000.0f * threatMod);
if (HostileReference* ref = me->GetThreatMgr().getOnlineContainer().getReferenceByTarget(pUnit)) if (HostileReference* ref = me->GetThreatMgr().GetOnlineContainer().getReferenceByTarget(pUnit))
ref->addThreat(10000000.0f * threatMod); ref->AddThreat(10000000.0f * threatMod);
} }
} }
} }
@@ -177,7 +177,7 @@ struct boss_faction_championsAI : public ScriptedAI
uint32 EnemiesInRange(float distance) uint32 EnemiesInRange(float distance)
{ {
ThreatContainer::StorageType const& tList = me->GetThreatMgr().getThreatList(); ThreatContainer::StorageType const& tList = me->GetThreatMgr().GetThreatList();
uint32 count = 0; uint32 count = 0;
Unit* target; Unit* target;
for( ThreatContainer::StorageType::const_iterator iter = tList.begin(); iter != tList.end(); ++iter ) for( ThreatContainer::StorageType::const_iterator iter = tList.begin(); iter != tList.end(); ++iter )
@@ -191,7 +191,7 @@ struct boss_faction_championsAI : public ScriptedAI
Unit* SelectEnemyCaster(bool casting, float range) Unit* SelectEnemyCaster(bool casting, float range)
{ {
ThreatContainer::StorageType const& tList = me->GetThreatMgr().getThreatList(); ThreatContainer::StorageType const& tList = me->GetThreatMgr().GetThreatList();
Unit* target; Unit* target;
for( ThreatContainer::StorageType::const_iterator iter = tList.begin(); iter != tList.end(); ++iter ) for( ThreatContainer::StorageType::const_iterator iter = tList.begin(); iter != tList.end(); ++iter )
{ {
@@ -299,7 +299,7 @@ public:
if (events.GetPhaseMask() & PHASE_ONE_MASK && damage >= me->GetPower(POWER_MANA)) if (events.GetPhaseMask() & PHASE_ONE_MASK && damage >= me->GetPower(POWER_MANA))
{ {
// reset threat // reset threat
ThreatContainer::StorageType const& threatlist = me->GetThreatMgr().getThreatList(); ThreatContainer::StorageType const& threatlist = me->GetThreatMgr().GetThreatList();
for (ThreatContainer::StorageType::const_iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr) for (ThreatContainer::StorageType::const_iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr)
{ {
Unit* unit = ObjectAccessor::GetUnit((*me), (*itr)->getUnitGuid()); Unit* unit = ObjectAccessor::GetUnit((*me), (*itr)->getUnitGuid());
@@ -592,7 +592,7 @@ public:
{ {
checkTimer = 3000; checkTimer = 3000;
me->SetInCombatWithZone(); me->SetInCombatWithZone();
ThreatContainer::StorageType const& threatList = me->GetThreatMgr().getThreatList(); ThreatContainer::StorageType const& threatList = me->GetThreatMgr().GetThreatList();
if (!threatList.empty()) if (!threatList.empty())
for (ThreatContainer::StorageType::const_iterator itr = threatList.begin(); itr != threatList.end(); ++itr) for (ThreatContainer::StorageType::const_iterator itr = threatList.begin(); itr != threatList.end(); ++itr)
if (Unit* target = (*itr)->getTarget()) if (Unit* target = (*itr)->getTarget())
@@ -1775,15 +1775,15 @@ public:
Position myPos = me->GetPosition(); Position myPos = me->GetPosition();
me->NearTeleportTo(c->GetPositionX(), c->GetPositionY(), c->GetPositionZ(), c->GetOrientation()); me->NearTeleportTo(c->GetPositionX(), c->GetPositionY(), c->GetPositionZ(), c->GetOrientation());
c->NearTeleportTo(myPos.GetPositionX(), myPos.GetPositionY(), myPos.GetPositionZ(), myPos.GetOrientation()); c->NearTeleportTo(myPos.GetPositionX(), myPos.GetPositionY(), myPos.GetPositionZ(), myPos.GetOrientation());
const ThreatContainer::StorageType me_tl = me->GetThreatMgr().getThreatList(); const ThreatContainer::StorageType me_tl = me->GetThreatMgr().GetThreatList();
const ThreatContainer::StorageType target_tl = c->GetThreatMgr().getThreatList(); const ThreatContainer::StorageType target_tl = c->GetThreatMgr().GetThreatList();
DoResetThreat(); DoResetThreat();
for (ThreatContainer::StorageType::const_iterator iter = target_tl.begin(); iter != target_tl.end(); ++iter) for (ThreatContainer::StorageType::const_iterator iter = target_tl.begin(); iter != target_tl.end(); ++iter)
me->GetThreatMgr().addThreat((*iter)->getTarget(), (*iter)->getThreat()); me->GetThreatMgr().AddThreat((*iter)->getTarget(), (*iter)->GetThreat());
c->GetThreatMgr().ResetAllThreat(); c->GetThreatMgr().ResetAllThreat();
for (ThreatContainer::StorageType::const_iterator iter = me_tl.begin(); iter != me_tl.end(); ++iter) for (ThreatContainer::StorageType::const_iterator iter = me_tl.begin(); iter != me_tl.end(); ++iter)
c->GetThreatMgr().addThreat((*iter)->getTarget(), (*iter)->getThreat()); c->GetThreatMgr().AddThreat((*iter)->getTarget(), (*iter)->GetThreat());
} }
} }
@@ -456,7 +456,7 @@ public:
me->GetThreatMgr().resetAggro(NotOnSameSide(me)); me->GetThreatMgr().resetAggro(NotOnSameSide(me));
if (Unit* pTarget = SelectTarget(SelectTargetMethod::MaxDistance, 0)) if (Unit* pTarget = SelectTarget(SelectTargetMethod::MaxDistance, 0))
{ {
me->GetThreatMgr().addThreat(pTarget, 100.0f); me->GetThreatMgr().AddThreat(pTarget, 100.0f);
AttackStart(pTarget); AttackStart(pTarget);
} }
events.RepeatEvent(20000); events.RepeatEvent(20000);
@@ -438,7 +438,7 @@ public:
case EVENT_DETONATE_MANA: case EVENT_DETONATE_MANA:
{ {
std::vector<Unit*> unitList; std::vector<Unit*> unitList;
ThreatContainer::StorageType const& threatList = me->GetThreatMgr().getThreatList(); ThreatContainer::StorageType const& threatList = me->GetThreatMgr().GetThreatList();
for (auto itr : threatList) for (auto itr : threatList)
{ {
if (itr->getTarget()->GetTypeId() == TYPEID_PLAYER if (itr->getTarget()->GetTypeId() == TYPEID_PLAYER
@@ -128,8 +128,8 @@ public:
std::list<Unit*> meleeRangeTargets; std::list<Unit*> meleeRangeTargets;
Unit* finalTarget = nullptr; Unit* finalTarget = nullptr;
uint8 counter = 0; uint8 counter = 0;
auto i = me->GetThreatMgr().getThreatList().begin(); auto i = me->GetThreatMgr().GetThreatList().begin();
for (; i != me->GetThreatMgr().getThreatList().end(); ++i, ++counter) for (; i != me->GetThreatMgr().GetThreatList().end(); ++i, ++counter)
{ {
// Gather all units with melee range // Gather all units with melee range
Unit* target = (*i)->getTarget(); Unit* target = (*i)->getTarget();
@@ -321,8 +321,8 @@ public:
} }
std::vector<Unit*> targets; std::vector<Unit*> targets;
auto i = me->GetThreatMgr().getThreatList().begin(); auto i = me->GetThreatMgr().GetThreatList().begin();
for (; i != me->GetThreatMgr().getThreatList().end(); ++i) for (; i != me->GetThreatMgr().GetThreatList().end(); ++i)
{ {
if ((*i)->getTarget()->GetTypeId() == TYPEID_PLAYER) if ((*i)->getTarget()->GetTypeId() == TYPEID_PLAYER)
{ {
@@ -553,17 +553,17 @@ public:
if (!feugen->IsAlive() || !feugen->GetVictim() || !me->GetVictim()) if (!feugen->IsAlive() || !feugen->GetVictim() || !me->GetVictim())
return; return;
float threatFeugen = feugen->GetThreatMgr().getThreat(feugen->GetVictim()); float threatFeugen = feugen->GetThreatMgr().GetThreat(feugen->GetVictim());
float threatStalagg = me->GetThreatMgr().getThreat(me->GetVictim()); float threatStalagg = me->GetThreatMgr().GetThreat(me->GetVictim());
Unit* tankFeugen = feugen->GetVictim(); Unit* tankFeugen = feugen->GetVictim();
Unit* tankStalagg = me->GetVictim(); Unit* tankStalagg = me->GetVictim();
feugen->GetThreatMgr().modifyThreatPercent(tankFeugen, -100); feugen->GetThreatMgr().ModifyThreatByPercent(tankFeugen, -100);
feugen->AddThreat(tankStalagg, threatFeugen); feugen->AddThreat(tankStalagg, threatFeugen);
feugen->CastSpell(tankStalagg, SPELL_MAGNETIC_PULL, true); feugen->CastSpell(tankStalagg, SPELL_MAGNETIC_PULL, true);
feugen->AI()->DoAction(ACTION_MAGNETIC_PULL); feugen->AI()->DoAction(ACTION_MAGNETIC_PULL);
me->GetThreatMgr().modifyThreatPercent(tankStalagg, -100); me->GetThreatMgr().ModifyThreatByPercent(tankStalagg, -100);
me->AddThreat(tankFeugen, threatStalagg); me->AddThreat(tankFeugen, threatStalagg);
me->CastSpell(tankFeugen, SPELL_MAGNETIC_PULL, true); me->CastSpell(tankFeugen, SPELL_MAGNETIC_PULL, true);
DoAction(ACTION_MAGNETIC_PULL); DoAction(ACTION_MAGNETIC_PULL);
@@ -612,7 +612,7 @@ public:
InstanceScript* pInstance; InstanceScript* pInstance;
uint32 _phase; uint32 _phase;
bool _flyPhase; bool _flyPhase;
Unit* _flyTarget; ObjectGuid _flyTargetGUID;
uint32 _channelTimer; uint32 _channelTimer;
bool _stunnedAchievement; bool _stunnedAchievement;
@@ -625,7 +625,7 @@ public:
_channelTimer = 0; _channelTimer = 0;
_phase = 0; _phase = 0;
_flyPhase = false; _flyPhase = false;
_flyTarget = nullptr; _flyTargetGUID.Clear();
_stunnedAchievement = true; _stunnedAchievement = true;
events.Reset(); events.Reset();
@@ -756,11 +756,14 @@ public:
if (_flyPhase) if (_flyPhase)
{ {
if (_flyTarget && me->GetDistance2d(_flyTarget) >= 6 ) if (Unit* flyTarget = ObjectAccessor::GetUnit(*me, _flyTargetGUID))
{ {
//float speed = me->GetDistance(_flyTarget->GetPositionX(), _flyTarget->GetPositionY(), _flyTarget->GetPositionZ()+15) / (1500.0f * 0.001f); if (me->GetDistance2d(flyTarget) >= 6)
me->SendMonsterMove(_flyTarget->GetPositionX(), _flyTarget->GetPositionY(), _flyTarget->GetPositionZ() + 15, 1500, SPLINEFLAG_FLYING); {
me->SetPosition(_flyTarget->GetPositionX(), _flyTarget->GetPositionY(), _flyTarget->GetPositionZ(), _flyTarget->GetOrientation()); //float speed = me->GetDistance(_flyTarget->GetPositionX(), _flyTarget->GetPositionY(), _flyTarget->GetPositionZ()+15) / (1500.0f * 0.001f);
me->SendMonsterMove(flyTarget->GetPositionX(), flyTarget->GetPositionY(), flyTarget->GetPositionZ() + 15, 1500, SPLINEFLAG_FLYING);
me->SetPosition(flyTarget->GetPositionX(), flyTarget->GetPositionY(), flyTarget->GetPositionZ(), flyTarget->GetOrientation());
}
} }
} }
@@ -794,7 +797,8 @@ public:
Talk(SAY_BRUNDIR_FLIGHT); Talk(SAY_BRUNDIR_FLIGHT);
_flyPhase = true; _flyPhase = true;
_flyTarget = me->GetVictim(); Unit* oldVictim = me->GetVictim();
_flyTargetGUID = oldVictim->GetGUID();
me->SetRegeneratingHealth(false); me->SetRegeneratingHealth(false);
me->SetDisableGravity(true); me->SetDisableGravity(true);
@@ -803,7 +807,7 @@ public:
me->SetReactState(REACT_PASSIVE); me->SetReactState(REACT_PASSIVE);
me->SetGuidValue(UNIT_FIELD_TARGET, ObjectGuid::Empty); me->SetGuidValue(UNIT_FIELD_TARGET, ObjectGuid::Empty);
me->SetUnitFlag(UNIT_FLAG_STUNNED); me->SetUnitFlag(UNIT_FLAG_STUNNED);
me->SendMonsterMove(_flyTarget->GetPositionX(), _flyTarget->GetPositionY(), _flyTarget->GetPositionZ() + 15, 1500, SPLINEFLAG_FLYING); me->SendMonsterMove(oldVictim->GetPositionX(), oldVictim->GetPositionY(), oldVictim->GetPositionZ() + 15, 1500, SPLINEFLAG_FLYING);
me->CastSpell(me, SPELL_LIGHTNING_TENDRILS, true); me->CastSpell(me, SPELL_LIGHTNING_TENDRILS, true);
me->CastSpell(me, 61883, true); me->CastSpell(me, 61883, true);
@@ -822,11 +826,13 @@ public:
me->SetCanFly(false); me->SetCanFly(false);
me->SetReactState(REACT_AGGRESSIVE); me->SetReactState(REACT_AGGRESSIVE);
me->SetDisableGravity(false); me->SetDisableGravity(false);
if (_flyTarget) if (Unit* flyTarget = ObjectAccessor::GetUnit(*me, _flyTargetGUID))
me->Attack(_flyTarget, false); {
me->Attack(flyTarget, false);
}
me->SetRegeneratingHealth(true); me->SetRegeneratingHealth(true);
_flyTarget = nullptr; _flyTargetGUID.Clear();
me->RemoveAura(SPELL_LIGHTNING_TENDRILS); me->RemoveAura(SPELL_LIGHTNING_TENDRILS);
me->RemoveAura(61883); me->RemoveAura(61883);
DoResetThreat(); DoResetThreat();
@@ -670,7 +670,7 @@ public:
bool operator() (WorldObject* target) const bool operator() (WorldObject* target) const
{ {
if (target == _victim && _me->GetThreatMgr().getThreatList().size() > 1) if (target == _victim && _me->GetThreatMgr().GetThreatListSize() > 1)
return true; return true;
if (target->GetTypeId() != TYPEID_PLAYER) if (target->GetTypeId() != TYPEID_PLAYER)
@@ -116,7 +116,7 @@ public:
{ {
me->CastSpell(me, SPELL_INCITE_CHAOS, false); me->CastSpell(me, SPELL_INCITE_CHAOS, false);
std::list<HostileReference*> t_list = me->GetThreatMgr().getThreatList(); std::list<HostileReference*> t_list = me->GetThreatMgr().GetThreatList();
for (std::list<HostileReference*>::const_iterator itr = t_list.begin(); itr != t_list.end(); ++itr) for (std::list<HostileReference*>::const_iterator itr = t_list.begin(); itr != t_list.end(); ++itr)
{ {
Unit* target = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid()); Unit* target = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid());
@@ -150,7 +150,7 @@ public:
if (!me->IsWithinMeleeRange(me->GetVictim())) if (!me->IsWithinMeleeRange(me->GetVictim()))
{ {
ThreatContainer::StorageType threatlist = me->GetThreatMgr().getThreatList(); ThreatContainer::StorageType threatlist = me->GetThreatMgr().GetThreatList();
for (ThreatContainer::StorageType::const_iterator i = threatlist.begin(); i != threatlist.end(); ++i) for (ThreatContainer::StorageType::const_iterator i = threatlist.begin(); i != threatlist.end(); ++i)
if (Unit* target = ObjectAccessor::GetUnit(*me, (*i)->getUnitGuid())) if (Unit* target = ObjectAccessor::GetUnit(*me, (*i)->getUnitGuid()))
if (target->IsAlive() && me->IsWithinMeleeRange(target)) if (target->IsAlive() && me->IsWithinMeleeRange(target))
@@ -245,7 +245,7 @@ public:
{ {
PreventHitEffect(effIndex); PreventHitEffect(effIndex);
if (Unit* target = GetHitUnit()) if (Unit* target = GetHitUnit())
GetCaster()->GetThreatMgr().modifyThreatPercent(target, -20); GetCaster()->GetThreatMgr().ModifyThreatByPercent(target, -20);
} }
void Register() override void Register() override
@@ -126,7 +126,7 @@ public:
Unit* FindHatefulStrikeTarget() Unit* FindHatefulStrikeTarget()
{ {
Unit* target = nullptr; Unit* target = nullptr;
ThreatContainer::StorageType const& threatlist = me->GetThreatMgr().getThreatList(); ThreatContainer::StorageType const& threatlist = me->GetThreatMgr().GetThreatList();
for (ThreatContainer::StorageType::const_iterator i = threatlist.begin(); i != threatlist.end(); ++i) for (ThreatContainer::StorageType::const_iterator i = threatlist.begin(); i != threatlist.end(); ++i)
{ {
Unit* unit = ObjectAccessor::GetUnit(*me, (*i)->getUnitGuid()); Unit* unit = ObjectAccessor::GetUnit(*me, (*i)->getUnitGuid());
@@ -187,7 +187,7 @@ public:
target = me->GetVictim(); target = me->GetVictim();
else else
{ {
ThreatContainer::StorageType const& t_list = me->GetThreatMgr().getThreatList(); ThreatContainer::StorageType const& t_list = me->GetThreatMgr().GetThreatList();
for (ThreatContainer::StorageType::const_iterator itr = t_list.begin(); itr != t_list.end(); ++itr) for (ThreatContainer::StorageType::const_iterator itr = t_list.begin(); itr != t_list.end(); ++itr)
if (Unit* threatTarget = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid())) if (Unit* threatTarget = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid()))
if (me->IsWithinMeleeRange(threatTarget)) if (me->IsWithinMeleeRange(threatTarget))
@@ -221,7 +221,7 @@ public:
// Xinef: if we have target we currently follow, return // Xinef: if we have target we currently follow, return
if (Unit* target = GetCaster()->GetVictim()) if (Unit* target = GetCaster()->GetVictim())
if (GetCaster()->GetThreatMgr().getThreat(target) >= 100000.0f) if (GetCaster()->GetThreatMgr().GetThreat(target) >= 100000.0f)
return; return;
// Xinef: acquire new target // Xinef: acquire new target
@@ -323,7 +323,7 @@ public:
else else
{ {
me->resetAttackTimer(); me->resetAttackTimer();
ThreatContainer::StorageType const& threatList = me->GetThreatMgr().getThreatList(); ThreatContainer::StorageType const& threatList = me->GetThreatMgr().GetThreatList();
for (ThreatContainer::StorageType::const_iterator itr = threatList.begin(); itr != threatList.end(); ++itr) for (ThreatContainer::StorageType::const_iterator itr = threatList.begin(); itr != threatList.end(); ++itr)
if (Unit* unit = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid())) if (Unit* unit = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid()))
if (me->IsWithinMeleeRange(unit)) if (me->IsWithinMeleeRange(unit))
@@ -994,7 +994,7 @@ public:
{ {
PreventHitEffect(effIndex); PreventHitEffect(effIndex);
ThreatContainer::StorageType const& ThreatList = GetCaster()-> GetThreatMgr().getThreatList(); ThreatContainer::StorageType const& ThreatList = GetCaster()-> GetThreatMgr().GetThreatList();
std::list<Unit*> targetList; std::list<Unit*> targetList;
for (ThreatContainer::StorageType::const_iterator itr = ThreatList.begin(); itr != ThreatList.end(); ++itr) for (ThreatContainer::StorageType::const_iterator itr = ThreatList.begin(); itr != ThreatList.end(); ++itr)
{ {
@@ -1741,7 +1741,7 @@ public:
// some code to cast spell Mana Burn on random target which has mana // some code to cast spell Mana Burn on random target which has mana
if (ManaBurnTimer <= diff) if (ManaBurnTimer <= diff)
{ {
std::list<HostileReference*> AggroList = me->GetThreatMgr().getThreatList(); std::list<HostileReference*> AggroList = me->GetThreatMgr().GetThreatList();
std::list<Unit*> UnitsWithMana; std::list<Unit*> UnitsWithMana;
for (std::list<HostileReference*>::const_iterator itr = AggroList.begin(); itr != AggroList.end(); ++itr) for (std::list<HostileReference*>::const_iterator itr = AggroList.begin(); itr != AggroList.end(); ++itr)
@@ -489,7 +489,7 @@ public:
AttackStart(Dragonmaw); AttackStart(Dragonmaw);
} }
HostileReference* ref = me->GetThreatMgr().getOnlineContainer().getReferenceByTarget(caster); HostileReference* ref = me->GetThreatMgr().GetOnlineContainer().getReferenceByTarget(caster);
if (ref) if (ref)
ref->removeReference(); ref->removeReference();
} }
+1 -1
View File
@@ -101,7 +101,7 @@ struct npc_pet_mage_mirror_image : CasterAI
while (ref) while (ref)
{ {
if (Unit* unit = ref->GetSource()->GetOwner()) if (Unit* unit = ref->GetSource()->GetOwner())
unit->AddThreat(me, ref->getThreat() - ref->getTempThreatModifier()); unit->AddThreat(me, ref->GetThreat() - ref->getTempThreatModifier());
ref = ref->next(); ref = ref->next();
} }
+26 -2
View File
@@ -893,7 +893,7 @@ class spell_gen_knock_away : public SpellScript
PreventHitDefaultEffect(effIndex); PreventHitDefaultEffect(effIndex);
if (Unit* target = GetHitUnit()) if (Unit* target = GetHitUnit())
if (Creature* caster = GetCaster()->ToCreature()) if (Creature* caster = GetCaster()->ToCreature())
caster->GetThreatMgr().modifyThreatPercent(target, -25); // Xinef: amount confirmed by onyxia and void reaver notes caster->GetThreatMgr().ModifyThreatByPercent(target, -25); // Xinef: amount confirmed by onyxia and void reaver notes
} }
void Register() override void Register() override
@@ -999,7 +999,7 @@ class spell_gen_hate_to_zero : public SpellScript
PreventHitDefaultEffect(effIndex); PreventHitDefaultEffect(effIndex);
if (Unit* target = GetHitUnit()) if (Unit* target = GetHitUnit())
if (Creature* caster = GetCaster()->ToCreature()) if (Creature* caster = GetCaster()->ToCreature())
caster->GetThreatMgr().modifyThreatPercent(target, -100); caster->GetThreatMgr().ModifyThreatByPercent(target, -100);
} }
void Register() override void Register() override
@@ -4571,6 +4571,29 @@ private:
uint32 _aura; uint32 _aura;
}; };
// 818 Basic Campfire
class spell_gen_basic_campfire : public SpellScript
{
PrepareSpellScript(spell_gen_basic_campfire);
void ModDest(SpellDestination& dest)
{
if (Unit* caster = GetCaster())
{
if (caster->GetMap()->GetGameObjectFloor(caster->GetPhaseMask(), caster->GetPositionX(), caster->GetPositionY(), caster->GetPositionZ()) == -G3D::finf())
{
float ground = caster->GetMap()->GetHeight(dest._position.GetPositionX(), dest._position.GetPositionY(), dest._position.GetPositionZ() + caster->GetCollisionHeight() * 0.5f);
dest._position.m_positionZ = ground;
}
}
}
void Register() override
{
OnDestinationTargetSelect += SpellDestinationTargetSelectFn(spell_gen_basic_campfire::ModDest, EFFECT_0, TARGET_DEST_CASTER_SUMMON);
}
};
void AddSC_generic_spell_scripts() void AddSC_generic_spell_scripts()
{ {
RegisterSpellScript(spell_silithyst); RegisterSpellScript(spell_silithyst);
@@ -4708,4 +4731,5 @@ void AddSC_generic_spell_scripts()
RegisterSpellScriptWithArgs(spell_gen_consume, "spell_consume_aq20", SPELL_CONSUME_LEECH_AQ20, SPELL_CONSUME_LEECH_HEAL_AQ20); RegisterSpellScriptWithArgs(spell_gen_consume, "spell_consume_aq20", SPELL_CONSUME_LEECH_AQ20, SPELL_CONSUME_LEECH_HEAL_AQ20);
RegisterSpellScriptWithArgs(spell_gen_apply_aura_after_expiration, "spell_itch_aq20", SPELL_HIVEZARA_CATALYST, EFFECT_0, SPELL_AURA_DUMMY); RegisterSpellScriptWithArgs(spell_gen_apply_aura_after_expiration, "spell_itch_aq20", SPELL_HIVEZARA_CATALYST, EFFECT_0, SPELL_AURA_DUMMY);
RegisterSpellScriptWithArgs(spell_gen_apply_aura_after_expiration, "spell_itch_aq40", SPELL_VEKNISS_CATALYST, EFFECT_0, SPELL_AURA_DUMMY); RegisterSpellScriptWithArgs(spell_gen_apply_aura_after_expiration, "spell_itch_aq40", SPELL_VEKNISS_CATALYST, EFFECT_0, SPELL_AURA_DUMMY);
RegisterSpellScript(spell_gen_basic_campfire);
} }
+46
View File
@@ -2403,6 +2403,51 @@ class spell_q5056_summon_shy_rotam : public SpellScript
} }
}; };
enum RookeryEgg
{
ITEM_COLLECTED_DRAGON_EGG = 12241,
QUEST_EGG_COLLECTION = 4735,
GO_ROOKERY_EGG = 175124
};
class spell_q4735_collect_rookery_egg : public SpellScript
{
PrepareSpellScript(spell_q4735_collect_rookery_egg);
SpellCastResult CheckCast()
{
if (GameObject* rookery = GetCaster()->FindNearestGameObject(GO_ROOKERY_EGG, 5.0f, true))
{
if (rookery->GetGoState() != GO_STATE_ACTIVE_ALTERNATIVE)
return SPELL_FAILED_BAD_TARGETS;
}
return SPELL_CAST_OK;
}
SpellCastResult CheckQuest()
{
if (Player* playerCaster = GetCaster()->ToPlayer())
{
if (playerCaster->GetQuestStatus(QUEST_EGG_COLLECTION) == QUEST_STATUS_INCOMPLETE)
return SPELL_CAST_OK;
}
return SPELL_FAILED_DONT_REPORT;
}
void HandleActiveObject(SpellEffIndex /*effIndex*/)
{
if (Player* playerCaster = GetCaster()->ToPlayer())
playerCaster->AddItem(ITEM_COLLECTED_DRAGON_EGG, 1);
}
void Register() override
{
OnCheckCast += SpellCheckCastFn(spell_q4735_collect_rookery_egg::CheckQuest);
OnCheckCast += SpellCheckCastFn(spell_q4735_collect_rookery_egg::CheckCast);
OnEffectHit += SpellEffectFn(spell_q4735_collect_rookery_egg::HandleActiveObject, EFFECT_0, SPELL_EFFECT_ACTIVATE_OBJECT);
}
};
void AddSC_quest_spell_scripts() void AddSC_quest_spell_scripts()
{ {
RegisterSpellAndAuraScriptPair(spell_q11065_wrangle_some_aether_rays, spell_q11065_wrangle_some_aether_rays_aura); RegisterSpellAndAuraScriptPair(spell_q11065_wrangle_some_aether_rays, spell_q11065_wrangle_some_aether_rays_aura);
@@ -2473,4 +2518,5 @@ void AddSC_quest_spell_scripts()
RegisterSpellScript(spell_q12919_gymers_grab); RegisterSpellScript(spell_q12919_gymers_grab);
RegisterSpellScript(spell_q12919_gymers_throw); RegisterSpellScript(spell_q12919_gymers_throw);
RegisterSpellScript(spell_q5056_summon_shy_rotam); RegisterSpellScript(spell_q5056_summon_shy_rotam);
RegisterSpellScript(spell_q4735_collect_rookery_egg);
} }
@@ -104,6 +104,9 @@ class spell_rog_blade_flurry : public AuraScript
bool CheckProc(ProcEventInfo& eventInfo) bool CheckProc(ProcEventInfo& eventInfo)
{ {
if (!eventInfo.GetActor())
return false;
Unit* _procTarget = eventInfo.GetActor()->SelectNearbyNoTotemTarget(eventInfo.GetProcTarget()); Unit* _procTarget = eventInfo.GetActor()->SelectNearbyNoTotemTarget(eventInfo.GetProcTarget());
if (_procTarget) if (_procTarget)
_procTargetGUID = _procTarget->GetGUID(); _procTargetGUID = _procTarget->GetGUID();
+1 -1
View File
@@ -699,7 +699,7 @@ class spell_warl_soulshatter : public SpellScript
Unit* caster = GetCaster(); Unit* caster = GetCaster();
if (Unit* target = GetHitUnit()) if (Unit* target = GetHitUnit())
{ {
if (target->CanHaveThreatList() && target->GetThreatMgr().getThreat(caster) > 0.0f) if (target->CanHaveThreatList() && target->GetThreatMgr().GetThreat(caster) > 0.0f)
caster->CastSpell(target, SPELL_WARLOCK_SOULSHATTER, true); caster->CastSpell(target, SPELL_WARLOCK_SOULSHATTER, true);
} }
} }
@@ -320,7 +320,7 @@ public:
{ {
Talk(SAY_YSONDRE_SUMMON_DRUIDS); Talk(SAY_YSONDRE_SUMMON_DRUIDS);
auto const& attackers = me->GetThreatMgr().getThreatList(); auto const& attackers = me->GetThreatMgr().GetThreatList();
uint8 attackersCount = 0; uint8 attackersCount = 0;
for (const auto attacker : attackers) for (const auto attacker : attackers)
@@ -111,7 +111,7 @@ bool NPCStaveQuestAI::IsFairFight()
{ {
Unit* unit = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid()); Unit* unit = ObjectAccessor::GetUnit(*me, (*itr)->getUnitGuid());
if (!(*itr)->getThreat()) if (!(*itr)->GetThreat())
{ {
// if target threat is 0 its fair, this prevents despawn in the case when // if target threat is 0 its fair, this prevents despawn in the case when
// there is a bystander since UpdateVictim adds nearby enemies to the threatlist // there is a bystander since UpdateVictim adds nearby enemies to the threatlist
@@ -138,7 +138,7 @@ struct NPCStaveQuestAI : public ScriptedAI
ObjectGuid gossipPlayerGUID; ObjectGuid gossipPlayerGUID;
ObjectGuid playerGUID; ObjectGuid playerGUID;
bool encounterStarted; bool encounterStarted;
ThreatContainer::StorageType const& threatList = me->GetThreatMgr().getThreatList(); ThreatContainer::StorageType const& threatList = me->GetThreatMgr().GetThreatList();
std::map<int, int> entryKeys = { std::map<int, int> entryKeys = {
{ ARTORIUS_NORMAL_ENTRY, 1 }, { ARTORIUS_NORMAL_ENTRY, 1 },