mirror of
https://github.com/mod-playerbots/mod-playerbots.git
synced 2026-01-22 04:56:22 +00:00
As requested revert for threadfixes last few days (#1552)
* Revert "[Large server fix] #1537 Serialize playerBots/botLoading with a mutex and use snapshot-based loops to fix concurrency crashes (#1540)" This reverts commit3fff58df1a. * Revert "[Fix] teleport to invalid map or invalid coordinates (x , y , z 200000, o ) given when teleporting player (g UI d full type player low , name , map , x , y , z , o ) (#1538)" This reverts commitca2e2ef0db. * Revert "Fix: prevent MoveSplineInitArgs::Validate velocity asserts (velocity > 0.01f) for bots, pets, and charmed units (#1534)" This reverts commit4e3ac609bd. * Revert "[Fix issue #1527] : startup crash in tank target selection — add TOCTOU & null-safety guards (#1532)" This reverts commitc6b0424c29. * Revert "[Fix issue #1528] Close small window where the “in a BG/arena” state can change between the check (InBattleground() / InArena()) and grabbing the pointer (GetBattleground()), which leads to a null dereference. (#1530)" This reverts commit2e0a161623. * Revert "Harden playerbot logout & packet dispatch; add null-safety in chat hooks and RPG checks (#1529)" This reverts commite4ea8e2694. * Revert "Dont wait to travel when in combat. (#1524)" This reverts commitddfa919154. * Revert "nullptr fix (#1523)" This reverts commit380312ffd2. * Revert "Playerbots/LFG: fix false not eligible & dungeon 0/type 0, add clear diagnostics (#1521)" This reverts commit872e417613. * Revert "nullptr exception (#1520)" This reverts commit3d28a81508. * Revert "Removed bot freezing at startup and system message, not relevant anymore (#1519)" This reverts commitbcd6f5bc06.
This commit is contained in:
@@ -1227,7 +1227,7 @@ std::string const QuestObjectiveTravelDestination::getTitle()
|
||||
return out.str();
|
||||
}
|
||||
|
||||
/*bool RpgTravelDestination::isActive(Player* bot) // Old Code
|
||||
bool RpgTravelDestination::isActive(Player* bot)
|
||||
{
|
||||
PlayerbotAI* botAI = GET_PLAYERBOT_AI(bot);
|
||||
AiObjectContext* context = botAI->GetAiObjectContext();
|
||||
@@ -1264,62 +1264,6 @@ std::string const QuestObjectiveTravelDestination::getTitle()
|
||||
ReputationRank reaction = bot->GetReputationRank(factionEntry->faction);
|
||||
|
||||
return reaction > REP_NEUTRAL;
|
||||
}*/
|
||||
|
||||
bool RpgTravelDestination::isActive(Player* bot)
|
||||
{
|
||||
// [Crash fix] Never dereference the AI if the player is real (null AI).
|
||||
if (!bot)
|
||||
return false;
|
||||
|
||||
PlayerbotAI* botAI = GET_PLAYERBOT_AI(bot);
|
||||
if (!botAI)
|
||||
return false; // real player (no AI) => inactive destination
|
||||
|
||||
AiObjectContext* context = botAI->GetAiObjectContext();
|
||||
if (!context)
|
||||
return false;
|
||||
|
||||
CreatureTemplate const* cInfo = GetCreatureTemplate();
|
||||
if (!cInfo)
|
||||
return false;
|
||||
|
||||
bool isUsefull = false;
|
||||
|
||||
if (cInfo->npcflag & UNIT_NPC_FLAG_VENDOR)
|
||||
if (AI_VALUE2_LAZY(bool, "group or", "should sell,can sell,following party,near leader"))
|
||||
isUsefull = true;
|
||||
|
||||
if (cInfo->npcflag & UNIT_NPC_FLAG_REPAIR)
|
||||
if (AI_VALUE2_LAZY(bool, "group or", "should repair,can repair,following party,near leader"))
|
||||
isUsefull = true;
|
||||
|
||||
if (!isUsefull)
|
||||
return false;
|
||||
|
||||
// [Crash fix] Read the ignore list via 'context' and check that the Value exists
|
||||
GuidSet const* ignoreList = nullptr;
|
||||
if (auto* value = context->GetValue<GuidSet&>("ignore rpg target"))
|
||||
ignoreList = &value->Get();
|
||||
|
||||
if (ignoreList)
|
||||
{
|
||||
for (ObjectGuid const& guid : *ignoreList)
|
||||
{
|
||||
if (guid.GetEntry() == getEntry())
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Secure access to the faction template
|
||||
if (FactionTemplateEntry const* factionEntry = sFactionTemplateStore.LookupEntry(cInfo->faction))
|
||||
{
|
||||
ReputationRank reaction = bot->GetReputationRank(factionEntry->faction);
|
||||
return reaction > REP_NEUTRAL;
|
||||
}
|
||||
|
||||
// As a precaution, if the faction is not found, consider inactive
|
||||
return false;
|
||||
}
|
||||
|
||||
CreatureTemplate const* RpgTravelDestination::GetCreatureTemplate() { return sObjectMgr->GetCreatureTemplate(entry); }
|
||||
|
||||
Reference in New Issue
Block a user