mirror of
https://github.com/liyunfan1223/mod-playerbots.git
synced 2026-02-21 18:40:01 +01:00
Fix for issue #1768 where the bot master was not getting reset. I also cleaned up leave group action to focus up function scope. I moved the resets from #612 to the actual leaving function. Disclosure: LLMs were NOT used in authoring this PR. Test cases to consider for testers. 1. Master disbands group with random bots. Bots should go about their business. 2. If you can dual box, create a raid where two real player both invite random bots. One player leaves group, their bots should also leave. (edge case, if a random bot that is supposed to leave the group becomes leader they may disband the whole group.
50 lines
1.2 KiB
C++
50 lines
1.2 KiB
C++
/*
|
|
* Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU AGPL v3 license, you may redistribute it
|
|
* and/or modify it under version 3 of the License, or (at your option), any later version.
|
|
*/
|
|
|
|
#ifndef _PLAYERBOT_LEAVEGROUPACTION_H
|
|
#define _PLAYERBOT_LEAVEGROUPACTION_H
|
|
|
|
#include "Action.h"
|
|
|
|
class Player;
|
|
class PlayerbotAI;
|
|
|
|
class LeaveGroupAction : public Action
|
|
{
|
|
public:
|
|
LeaveGroupAction(PlayerbotAI* botAI, std::string const name = "leave") : Action(botAI, name) {}
|
|
|
|
bool Execute(Event event) override;
|
|
|
|
virtual bool Leave();
|
|
};
|
|
|
|
class PartyCommandAction : public LeaveGroupAction
|
|
{
|
|
public:
|
|
PartyCommandAction(PlayerbotAI* botAI) : LeaveGroupAction(botAI, "party command") {}
|
|
|
|
bool Execute(Event event) override;
|
|
};
|
|
|
|
class UninviteAction : public LeaveGroupAction
|
|
{
|
|
public:
|
|
UninviteAction(PlayerbotAI* botAI) : LeaveGroupAction(botAI, "uninvite") {}
|
|
|
|
bool Execute(Event event) override;
|
|
};
|
|
|
|
class LeaveFarAwayAction : public LeaveGroupAction
|
|
{
|
|
public:
|
|
LeaveFarAwayAction(PlayerbotAI* botAI) : LeaveGroupAction(botAI, "leave far away") {}
|
|
|
|
bool Execute(Event event) override;
|
|
bool isUseful() override;
|
|
};
|
|
|
|
#endif
|