mirror of
https://github.com/liyunfan1223/mod-playerbots.git
synced 2026-06-20 15:39:25 +02:00
## Pull Request Description Bots will now engage with outdoor pvp targets when in an area with them. I carved this out of the guildrpg system Im working on since it should work just fine as a standalone. Note this requires a core update https://github.com/azerothcore/azerothcore-wotlk/pull/25103 ## Feature Evaluation Its not expensive. the status checks are fairly light and simple. Should be on par with current rpg system actions ## How to Test the Changes You can try to use selfbot to enable this while in EPL, or set the probability of all other rpg actions to 0. ## Impact Assessment <!-- As a generic test, before and after measure of pmon (playerbot pmon tick) can help you here. --> - Does this change increase per-bot/per-tick processing or risk scaling poorly with thousands of bots? - [ ] No, not at all - [x] Minimal impact (**explain below**) - [ ] Moderate impact (**explain below**) There is some impact, but should be minimal overall. - Does this change modify default bot behavior? - [ ] No - [x] Yes (**explain why**) It will activate automatically based on default config. - Does this change add new decision branches or increase maintenance complexity? - [ ] No - [x] Yes (**explain below**) ## AI Assistance Was AI assistance used while working on this change? - [ ] No - [x] Yes (**explain below**) <!-- If yes, please specify: - Purpose of usage (e.g. brainstorming, refactoring, documentation, code generation). - Which parts of the change were influenced or generated, and whether it was thoroughly reviewed. --> Nothing beyond search functionality and autocomplete. ## Final Checklist - [x] Stability is not compromised. - [x] Performance impact is understood, tested, and acceptable. - [x] Added logic complexity is justified and explained. - [x] Documentation updated if needed (Conf comments, WiKi commands). ## Notes for Reviewers <!-- Anything else that's helpful to review or test your pull request. --> --------- Co-authored-by: bash <hermensb@gmail.com> Co-authored-by: Revision <tkn963@gmail.com> Co-authored-by: kadeshar <kadeshar@gmail.com>
138 lines
3.4 KiB
C++
138 lines
3.4 KiB
C++
#ifndef _PLAYERBOT_NEWRPGINFO_H
|
|
#define _PLAYERBOT_NEWRPGINFO_H
|
|
|
|
#include "Define.h"
|
|
#include "ObjectGuid.h"
|
|
#include "ObjectMgr.h"
|
|
#include "QuestDef.h"
|
|
#include "Strategy.h"
|
|
#include "Timer.h"
|
|
#include "TravelMgr.h"
|
|
|
|
using NewRpgStatusTransitionProb = std::vector<std::vector<int>>;
|
|
|
|
struct NewRpgInfo
|
|
{
|
|
NewRpgInfo() : data(Idle{}) {}
|
|
~NewRpgInfo() = default;
|
|
|
|
// RPG_GO_GRIND
|
|
struct GoGrind
|
|
{
|
|
WorldPosition pos{};
|
|
};
|
|
// RPG_GO_CAMP
|
|
struct GoCamp
|
|
{
|
|
WorldPosition pos{};
|
|
};
|
|
// RPG_WANDER_NPC
|
|
struct WanderNpc
|
|
{
|
|
ObjectGuid npcOrGo{};
|
|
uint32 lastReach{0};
|
|
};
|
|
// RPG_WANDER_RANDOM
|
|
struct WanderRandom
|
|
{
|
|
WanderRandom() = default;
|
|
};
|
|
// RPG_DO_QUEST
|
|
struct DoQuest
|
|
{
|
|
const Quest* quest{nullptr};
|
|
uint32 questId{0};
|
|
int32 objectiveIdx{0};
|
|
WorldPosition pos{};
|
|
uint32 lastReachPOI{0};
|
|
};
|
|
// RPG_TRAVEL_FLIGHT
|
|
struct TravelFlight
|
|
{
|
|
ObjectGuid fromFlightMaster{};
|
|
std::vector<uint32> path;
|
|
bool inFlight{false};
|
|
};
|
|
// RPG_REST
|
|
struct Rest
|
|
{
|
|
Rest() = default;
|
|
};
|
|
// RPG_OUTDOOR_PVP
|
|
struct OutdoorPvP
|
|
{
|
|
ObjectGuid::LowType capturePointSpawnId{0};
|
|
};
|
|
struct Idle
|
|
{
|
|
};
|
|
|
|
uint32 startT{0}; // start timestamp of the current status
|
|
|
|
// MOVE_FAR
|
|
float nearestMoveFarDis{FLT_MAX};
|
|
uint32 stuckTs{0};
|
|
uint32 stuckAttempts{0};
|
|
WorldPosition moveFarPos;
|
|
// END MOVE_FAR
|
|
|
|
using RpgData = std::variant<
|
|
Idle,
|
|
GoGrind,
|
|
GoCamp,
|
|
WanderNpc,
|
|
WanderRandom,
|
|
DoQuest,
|
|
Rest,
|
|
TravelFlight,
|
|
OutdoorPvP
|
|
>;
|
|
RpgData data;
|
|
|
|
NewRpgStatus GetStatus();
|
|
bool HasStatusPersisted(uint32 maxDuration) { return GetMSTimeDiffToNow(startT) > maxDuration; }
|
|
void ChangeToGoGrind(WorldPosition pos);
|
|
void ChangeToGoCamp(WorldPosition pos);
|
|
void ChangeToWanderNpc();
|
|
void ChangeToWanderRandom();
|
|
void ChangeToDoQuest(uint32 questId, const Quest* quest);
|
|
void ChangeToTravelFlight(ObjectGuid fromFlightMaster, std::vector<uint32> path);
|
|
void ChangeToOutdoorPvp(ObjectGuid::LowType capturePointSpawnId = 0);
|
|
void ChangeToRest();
|
|
void ChangeToIdle();
|
|
bool CanChangeTo(NewRpgStatus status);
|
|
void Reset();
|
|
void SetMoveFarTo(WorldPosition pos);
|
|
std::string ToString();
|
|
};
|
|
|
|
struct NewRpgStatistic
|
|
{
|
|
uint32 questAccepted{0};
|
|
uint32 questCompleted{0};
|
|
uint32 questAbandoned{0};
|
|
uint32 questRewarded{0};
|
|
uint32 questDropped{0};
|
|
NewRpgStatistic operator+(const NewRpgStatistic& other) const
|
|
{
|
|
NewRpgStatistic result;
|
|
result.questAccepted = this->questAccepted + other.questAccepted;
|
|
result.questCompleted = this->questCompleted + other.questCompleted;
|
|
result.questAbandoned = this->questAbandoned + other.questAbandoned;
|
|
result.questRewarded = this->questRewarded + other.questRewarded;
|
|
result.questDropped = this->questDropped + other.questDropped;
|
|
return result;
|
|
}
|
|
NewRpgStatistic& operator+=(const NewRpgStatistic& other)
|
|
{
|
|
this->questAccepted += other.questAccepted;
|
|
this->questCompleted += other.questCompleted;
|
|
this->questAbandoned += other.questAbandoned;
|
|
this->questRewarded += other.questRewarded;
|
|
this->questDropped += other.questDropped;
|
|
return *this;
|
|
}
|
|
};
|
|
|
|
#endif
|