Improve AdventureBot recruitment, world presence and performance
Manage Arthoran as a persistent level-60 tank profile, add Worgen forms and mounts, enable PvP and recruit through native LFG with preparation actions and player invitations. Reduce repeated route and flight-planning work, bound failed-travel retries and add runtime timing diagnostics. Include 86 passing tests and measurements with 110 online bots.
This commit is contained in:
1 parent
cac4142ec1
commit
0173a434f4
39 files changed
+1958
-74
No files matched your search
@@ -16,6 +16,8 @@ harness=r'''
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <sstream>
|
||||
#include <unordered_set>
|
||||
#include <unordered_map>
|
||||
#include <limits>
|
||||
using uint32=uint32_t;
|
||||
using namespace ClientlessFlightPath;
|
||||
@@ -39,7 +41,7 @@ struct Player{
|
||||
struct Mount{uint32 DisplayId=32235,Weight=100;};
|
||||
struct Profile{bool CanFreeFly=true;std::vector<Mount> FlightMounts{{}};} profile;
|
||||
struct Lua{auto GetAdventureProfile(uint32){return &profile;}} lua;
|
||||
struct Config{bool enabled=true;bool GetBoolDefault(const char*,bool){return enabled;}float GetFloatDefault(const char*,float v){return v;}std::string GetStringDefault(const char*,const char*v){return v;}} config;
|
||||
struct Config{int reads=0;bool enabled=true;bool GetBoolDefault(const char*,bool){++reads;return enabled;}float GetFloatDefault(const char*,float v){++reads;return v;}std::string GetStringDefault(const char*,const char*v){++reads;return v;}} config;
|
||||
auto sClientlessLuaEngine=&lua;auto sConfigMgr=&config;
|
||||
struct SpellMgr{void* GetSpellInfo(uint32){return this;}} spells;auto sSpellMgr=&spells;
|
||||
uint32 FlightType(void*){return 1;}
|
||||
@@ -54,6 +56,10 @@ struct Record{std::shared_ptr<ClientlessFlightPath::SharedTrail>Published=std::m
|
||||
bool Moving=true,Returning=false;std::vector<Position> Breadcrumbs{{}};std::string AbortReason;
|
||||
};
|
||||
class ClientlessFlightMgr{public:
|
||||
Player const* _planningPlayer=nullptr;bool _planningEnabled=false;float _planningMinDistance=600;
|
||||
std::unordered_set<uint32> _planningPreferredZones;
|
||||
std::unordered_map<int,int> _planningAreas,_planningTerrain;
|
||||
void BeginPlanning(Player const* = nullptr);
|
||||
uint32 areaCode=87,zoneCode=12;
|
||||
std::pair<uint32,uint32> AreaZone(Player const*,uint32,Position const&)const{return {areaCode,zoneCode};}
|
||||
bool Enabled(Player const*)const;bool Preferred(Player const*,uint32,Position const&)const;
|
||||
@@ -61,7 +67,7 @@ class ClientlessFlightMgr{public:
|
||||
void Fail(Player*,Record&,std::string const&);
|
||||
};
|
||||
'''
|
||||
for signature in ('bool ClientlessFlightMgr::Enabled(', 'bool ClientlessFlightMgr::Preferred(', 'float ClientlessFlightMgr::Estimate(', 'void ClientlessFlightMgr::Fail('):
|
||||
for signature in ('void ClientlessFlightMgr::BeginPlanning(', 'bool ClientlessFlightMgr::Enabled(', 'bool ClientlessFlightMgr::Preferred(', 'float ClientlessFlightMgr::Estimate(', 'void ClientlessFlightMgr::Fail('):
|
||||
harness+=function(signature)+'\n'
|
||||
harness+=r'''
|
||||
int main(){
|
||||
@@ -95,6 +101,17 @@ int main(){
|
||||
mgr.Fail(&p,r,"reverse blocked");assert(r.Status.State==ClientlessFlightState::Failed);
|
||||
Record mounting;mounting.Status.State=ClientlessFlightState::Mounting;mgr.Fail(&p,mounting,"cast rejected");
|
||||
assert(mounting.Status.State==ClientlessFlightState::Failed&&p.interrupts==1&&!mounting.Returning);
|
||||
// A planning scope snapshots repeated config/profile work, while actual
|
||||
// departure checks and per-map licenses remain live.
|
||||
profile.CanFreeFly=true;p.skill=225;p.learned=true;p.license=true;config.enabled=true;
|
||||
area.fly=true;areas.known=true;p.restrictions=false;mgr.zoneCode=12;b.x=1000;
|
||||
mgr.BeginPlanning(&p);int reads=config.reads;
|
||||
for(int i=0;i<1000;++i)assert(std::isfinite(mgr.Estimate(&p,0,a,b)));
|
||||
assert(config.reads==reads);
|
||||
p.license=false;assert(!std::isfinite(mgr.Estimate(&p,0,a,b)));p.license=true;
|
||||
profile.CanFreeFly=false;assert(!mgr.Enabled(&p));
|
||||
mgr.BeginPlanning();assert(!std::isfinite(mgr.Estimate(&p,0,a,b)));
|
||||
profile.CanFreeFly=true;
|
||||
Record revoked;p.canFly=false;mgr.Fail(&p,revoked,"permission lost");assert(revoked.Status.State==ClientlessFlightState::Failed&&!revoked.Returning);
|
||||
}
|
||||
'''
|
||||
|
||||
Reference in new issue
Block a user