Compare commits

..

4 Commits

Author SHA1 Message Date
bashermens
86904ed068 Create check_pr_source.yml 2026-02-01 22:21:01 +01:00
bashermens
8529654f8f Correction after singleton PR (#2095)
# Pull Request

Some logic was changed but differs from the original code, certain edge
cases so not result in same behavior. This returns the original code
with only the singleton chances.

@Wishmaster117 Reviewed the hotfix and noticed the different code paths.

ps: reverted an removed placeholder since its ongoing issue/research.
2026-02-01 10:18:59 +01:00
Crow
6ee1684e9b Fix WSG graveyard camping by flag carrier (#2086)
Quick fix for a very annoying error identified by SmashingQuasar. In
WSG, bots will camp the opposing graveyard if up 2-0. This is supposed
to exclude the flag carrier, but a logical error has resulted in the
flag carrier being excluded for Alliance camping only, meaning the Horde
flag carrier will camp the GY with the rest of the team if up 2-0 and
thus refuse to end the game.
2026-01-31 23:11:40 +01:00
Crow
9546363d41 Hotfix for OnBotLoginOperation() Crash (#2089)
Hotfix for an issue arising from
https://github.com/mod-playerbots/mod-playerbots/pull/2082

OnBotLoginOperation() is calling OnBotLogin() twice for altbots. I don't
know the full implication, but RandomPlayerbotMgr::OnBotLoginInternal()
is being called on altbots, and the server will crash if you attempt to
then log out the altbot.

This fix works for me right now. Discussed with @Celandriel , going to
push this hotfix for now until the rest of the maintainers can take a
look.
2026-01-31 10:54:19 +01:00
4 changed files with 76 additions and 21 deletions

19
check_pr_source.yml Normal file
View File

@@ -0,0 +1,19 @@
name: Enforce test-staging → main
on:
pull_request:
branches:
- main
jobs:
require-test-staging:
runs-on: ubuntu-22.04
steps:
- name: Ensure PR source is test-staging
run: |
echo "Base: ${{ github.event.pull_request.base.ref }}"
echo "Head: ${{ github.event.pull_request.head.ref }}"
if [ "${{ github.event.pull_request.head.ref }}" != "test-staging" ]; then
echo "✖ Pull request must come from test-staging"
exit 1
fi

View File

@@ -2227,8 +2227,8 @@ bool BGTactics::selectObjective(bool reset)
}
// Graveyard Camping if in lead
else if (!hasFlag && role < 8 &&
(team == TEAM_ALLIANCE && allianceScore == 2 && hordeScore == 0) ||
(team == TEAM_HORDE && hordeScore == 2 && allianceScore == 0))
((team == TEAM_ALLIANCE && allianceScore == 2 && hordeScore == 0) ||
(team == TEAM_HORDE && hordeScore == 2 && allianceScore == 0)))
{
if (team == TEAM_ALLIANCE)
SetSafePos(WS_GY_CAMPING_HORDE, 10.0f);

View File

@@ -124,6 +124,52 @@ public:
}
}
bool OnPlayerBeforeTeleport(Player* /*player*/, uint32 /*mapid*/, float /*x*/, float /*y*/, float /*z*/,
float /*orientation*/, uint32 /*options*/, Unit* /*target*/) override
{
/* for now commmented out until proven its actually required
* havent seen any proof CleanVisibilityReferences() is needed
// If the player is not safe to touch, do nothing
if (!player)
return true;
// If same map or not in world do nothing
if (!player->IsInWorld() || player->GetMapId() == mapid)
return true;
// If real player do nothing
PlayerbotAI* ai = GET_PLAYERBOT_AI(player);
if (!ai || ai->IsRealPlayer())
return true;
// Cross-map bot teleport: defer visibility reference cleanup.
// CleanVisibilityReferences() erases this bot's GUID from other objects' visibility containers.
// This is intentionally done via the event queue (instead of directly here) because erasing
// from other players' visibility maps inside the teleport call stack can hit unsafe re-entrancy
// or iterator invalidation while visibility updates are in progress
ObjectGuid guid = player->GetGUID();
player->m_Events.AddEventAtOffset(
[guid, mapid]()
{
// do nothing, if the player is not safe to touch
Player* p = ObjectAccessor::FindPlayer(guid);
if (!p || !p->IsInWorld() || p->IsDuringRemoveFromWorld())
return;
// do nothing if we are already on the target map
if (p->GetMapId() == mapid)
return;
p->GetObjectVisibilityContainer().CleanVisibilityReferences();
},
Milliseconds(0));
*/
return true;
}
void OnPlayerAfterUpdate(Player* player, uint32 diff) override
{
PlayerbotAI* const botAI = PlayerbotsMgr::instance().GetPlayerbotAI(player);

View File

@@ -479,33 +479,23 @@ public:
bool Execute() override
{
// find and verify bot still exists
Player* bot = ObjectAccessor::FindConnectedPlayer(this->m_botGuid);
Player* bot = ObjectAccessor::FindConnectedPlayer(m_botGuid);
if (!bot)
{
return false;
}
if (this->m_masterAccountId)
PlayerbotHolder* holder = &RandomPlayerbotMgr::instance();
if (m_masterAccountId)
{
WorldSession* masterSession = sWorldSessionMgr->FindSession(this->m_masterAccountId);
WorldSession* masterSession = sWorldSessionMgr->FindSession(m_masterAccountId);
Player* masterPlayer = masterSession ? masterSession->GetPlayer() : nullptr;
if (masterPlayer != nullptr)
{
PlayerbotMgr* manager = PlayerbotsMgr::instance().GetPlayerbotMgr(masterPlayer);
if (manager == nullptr)
{
return false;
}
manager->OnBotLogin(bot);
}
if (masterPlayer)
holder = PlayerbotsMgr::instance().GetPlayerbotMgr(masterPlayer);
}
sRandomPlayerbotMgr.OnBotLogin(bot);
if (!holder)
return false;
holder->OnBotLogin(bot);
return true;
}