фиксы обновления

This commit is contained in:
2026-08-02 20:25:03 +04:00
parent aa95d99b18
commit 4b88e1f171
11 changed files with 37 additions and 33 deletions
+2 -2
View File
@@ -635,7 +635,7 @@ public:
PLAYERHOOK_CAN_RESURRECT PLAYERHOOK_CAN_RESURRECT
}) { } }) { }
void OnPlayerResurrect(Player* player, float /*restore_percent*/, bool /*applySickness*/) override void OnPlayerResurrect(Player* player, float /*restore_percent*/, bool& /*applySickness*/) override
{ {
sEluna->OnResurrect(player); sEluna->OnResurrect(player);
} }
@@ -959,7 +959,7 @@ public:
SERVERHOOK_CAN_PACKET_RECEIVE SERVERHOOK_CAN_PACKET_RECEIVE
}) { } }) { }
bool CanPacketSend(WorldSession* session, WorldPacket& packet) override bool CanPacketSend(WorldSession* session, WorldPacket const& packet) override
{ {
if (!sEluna->OnPacketSend(session, packet)) if (!sEluna->OnPacketSend(session, packet))
return false; return false;
@@ -649,18 +649,18 @@ namespace LuaCreature
float dist = Eluna::CHECKVAL<float>(L, 5, 0.0f); float dist = Eluna::CHECKVAL<float>(L, 5, 0.0f);
int32 aura = Eluna::CHECKVAL<int32>(L, 6, 0); int32 aura = Eluna::CHECKVAL<int32>(L, 6, 0);
auto const& threatlist = creature->GetThreatMgr().GetThreatList(); ThreatManager const& threatMgr = creature->GetThreatMgr();
if (threatlist.empty()) if (threatMgr.IsThreatListEmpty())
return 1; return 1;
if (position >= threatlist.size()) if (position >= threatMgr.GetThreatListSize())
return 1; return 1;
std::list<Unit*> targetList; std::list<Unit*> targetList;
for (auto itr = threatlist.begin(); itr != threatlist.end(); ++itr) for (ThreatReference const* ref : threatMgr.GetSortedThreatList())
{ {
Unit* target = (*itr)->getTarget(); Unit* target = ref->GetVictim();
if (!target) if (!target)
continue; continue;
@@ -730,14 +730,14 @@ namespace LuaCreature
*/ */
int GetAITargets(lua_State* L, Creature* creature) int GetAITargets(lua_State* L, Creature* creature)
{ {
auto const& threatlist = creature->GetThreatMgr().GetThreatList(); ThreatManager const& threatMgr = creature->GetThreatMgr();
lua_createtable(L, threatlist.size(), 0); lua_createtable(L, threatMgr.GetThreatListSize(), 0);
int tbl = lua_gettop(L); int tbl = lua_gettop(L);
uint32 i = 0; uint32 i = 0;
for (auto itr = threatlist.begin(); itr != threatlist.end(); ++itr) for (ThreatReference const* ref : threatMgr.GetSortedThreatList())
{ {
Unit* target = (*itr)->getTarget(); Unit* target = ref->GetVictim();
if (!target) if (!target)
continue; continue;
@@ -1902,12 +1902,10 @@ namespace LuaUnit
return 1; return 1;
} }
ThreatContainer::StorageType const& list = unit->GetThreatMgr().GetThreatList();
lua_newtable(L); lua_newtable(L);
int table = lua_gettop(L); int table = lua_gettop(L);
uint32 i = 1; uint32 i = 1;
for (ThreatReference* item : list) for (ThreatReference const* item : unit->GetThreatMgr().GetSortedThreatList())
{ {
if (!item) if (!item)
{ {
@@ -87,7 +87,7 @@ public:
sIndividualProgression->CheckAdjustments(player); sIndividualProgression->CheckAdjustments(player);
} }
void OnPlayerResurrect(Player* player, float /*restore_percent*/, bool /*applySickness*/) override void OnPlayerResurrect(Player* player, float /*restore_percent*/, bool& /*applySickness*/) override
{ {
sIndividualProgression->CheckAdjustments(player); sIndividualProgression->CheckAdjustments(player);
} }
@@ -408,6 +408,7 @@ public:
events.Repeat(15s); events.Repeat(15s);
break; break;
case EVENT_TELEPORT: case EVENT_TELEPORT:
{
me->AttackStop(); me->AttackStop();
if (IN_LIVE_SIDE(me)) if (IN_LIVE_SIDE(me))
{ {
@@ -417,7 +418,10 @@ public:
{ {
me->CastSpell(me, SPELL_TELEPORT_LIVE, false); me->CastSpell(me, SPELL_TELEPORT_LIVE, false);
} }
me->GetThreatMgr().resetAggro(NotOnSameSide(me)); NotOnSameSide notOnSameSide(me);
for (ThreatReference* ref : me->GetThreatMgr().GetModifiableThreatList())
if (notOnSameSide(ref->GetVictim()))
me->GetThreatMgr().ResetThreat(ref->GetVictim());
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);
@@ -425,6 +429,7 @@ public:
} }
events.Repeat(20s); events.Repeat(20s);
break; break;
}
case EVENT_CHECK_HEALTH: case EVENT_CHECK_HEALTH:
if (me->HealthBelowPct(30)) if (me->HealthBelowPct(30))
{ {
@@ -403,14 +403,13 @@ public:
case EVENT_DETONATE_MANA: case EVENT_DETONATE_MANA:
{ {
std::vector<Unit*> unitList; std::vector<Unit*> unitList;
ThreatContainer::StorageType const& threatList = me->GetThreatMgr().GetThreatList(); for (ThreatReference const* ref : me->GetThreatMgr().GetSortedThreatList())
for (auto itr : threatList)
{ {
if (itr->getTarget()->IsPlayer() if (ref->GetVictim()->IsPlayer()
&& itr->getTarget()->getPowerType() == POWER_MANA && ref->GetVictim()->getPowerType() == POWER_MANA
&& itr->getTarget()->GetPower(POWER_MANA)) && ref->GetVictim()->GetPower(POWER_MANA))
{ {
unitList.push_back(itr->getTarget()); unitList.push_back(ref->GetVictim());
} }
} }
if (!unitList.empty()) if (!unitList.empty())
@@ -118,11 +118,10 @@ 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(); for (ThreatReference const* ref : me->GetThreatMgr().GetSortedThreatList())
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 = ref->GetVictim();
if (me->IsWithinMeleeRange(target)) if (me->IsWithinMeleeRange(target))
{ {
meleeRangeTargets.push_back(target); meleeRangeTargets.push_back(target);
@@ -132,6 +131,7 @@ public:
{ {
me->AddThreat(target, 500.0f); me->AddThreat(target, 500.0f);
} }
++counter;
} }
counter = 0; counter = 0;
std::list<Unit*, std::allocator<Unit*>>::iterator itr; std::list<Unit*, std::allocator<Unit*>>::iterator itr;
@@ -346,17 +346,16 @@ public:
} }
std::vector<Unit*> targets; std::vector<Unit*> targets;
auto i = me->GetThreatMgr().GetThreatList().begin(); for (ThreatReference const* ref : me->GetThreatMgr().GetSortedThreatList())
for (; i != me->GetThreatMgr().GetThreatList().end(); ++i)
{ {
if ((*i)->getTarget()->IsPlayer()) if (ref->GetVictim()->IsPlayer())
{ {
bool inList = false; bool inList = false;
if (!blockList.empty()) if (!blockList.empty())
{ {
for (GuidList::const_iterator itr = blockList.begin(); itr != blockList.end(); ++itr) for (GuidList::const_iterator itr = blockList.begin(); itr != blockList.end(); ++itr)
{ {
if ((*i)->getTarget()->GetGUID() == *itr) if (ref->GetVictim()->GetGUID() == *itr)
{ {
inList = true; inList = true;
break; break;
@@ -365,7 +364,7 @@ public:
} }
if (!inList) if (!inList)
{ {
targets.push_back((*i)->getTarget()); targets.push_back(ref->GetVictim());
} }
} }
} }
@@ -4,7 +4,7 @@
#include "ActionContext.h" #include "ActionContext.h"
#include "IndividualProgressionOnyxiaActions.h" #include "IndividualProgressionOnyxiaActions.h"
#include "RaidOnyxiaActionContext.h" #include "OnyActionContext.h"
class IPOnyxiaActionContext : public RaidOnyxiaActionContext class IPOnyxiaActionContext : public RaidOnyxiaActionContext
{ {
@@ -1,7 +1,7 @@
#ifdef MOD_PLAYERBOTS #ifdef MOD_PLAYERBOTS
#ifndef MOD_INDIVIDUAL_PROGRESSION_ONYXIAACTIONS_H #ifndef MOD_INDIVIDUAL_PROGRESSION_ONYXIAACTIONS_H
#define MOD_INDIVIDUAL_PROGRESSION_ONYXIAACTIONS_H #define MOD_INDIVIDUAL_PROGRESSION_ONYXIAACTIONS_H
#include "RaidOnyxiaActions.h" #include "OnyActions.h"
class IPOnyxiaKillWhelpsAction : public RaidOnyxiaKillWhelpsAction class IPOnyxiaKillWhelpsAction : public RaidOnyxiaKillWhelpsAction
{ {
@@ -27,6 +27,7 @@
#include "Player.h" #include "Player.h"
#include "PoolMgr.h" #include "PoolMgr.h"
#include "QuestPackets.h" #include "QuestPackets.h"
#include "RaceMgr.h"
#include "ReputationMgr.h" #include "ReputationMgr.h"
#include "ScriptMgr.h" #include "ScriptMgr.h"
#include "SpellAuraEffects.h" #include "SpellAuraEffects.h"
@@ -1137,7 +1138,9 @@ bool Player::SatisfyQuestRace(Quest const* qInfo, bool msg) const
// while still respecting truly race-specific quests on the opposite side. // while still respecting truly race-specific quests on the opposite side.
if (GetTeamId() != GetTeamId(true)) if (GetTeamId() != GetTeamId(true))
{ {
uint32 currentFactionRaceMask = (GetTeamId() == TEAM_ALLIANCE) ? RACEMASK_ALLIANCE : RACEMASK_HORDE; uint32 currentFactionRaceMask = (GetTeamId() == TEAM_ALLIANCE)
? sRaceMgr->GetAllianceRaceMask()
: sRaceMgr->GetHordeRaceMask();
if ((reqraces & currentFactionRaceMask) == reqraces) if ((reqraces & currentFactionRaceMask) == reqraces)
return true; return true;
} }