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
@@ -17,7 +17,7 @@ code=r'''
|
||||
using uint32=unsigned;using uint64=unsigned long long;
|
||||
using namespace AdventurePopulationPolicy;
|
||||
namespace GameTime{time_t now=100000;time_t GetGameTime(){return now;}}
|
||||
struct ObjectGuid{enum{Player};unsigned id;ObjectGuid(int,unsigned i):id(i){}};
|
||||
struct ObjectGuid{enum{Player};unsigned id;ObjectGuid(int,unsigned i):id(i){} unsigned GetCounter(){return id;}};
|
||||
namespace HighGuid{constexpr int Player=0;}
|
||||
namespace ObjectAccessor{std::unordered_set<unsigned>connected;bool FindConnectedPlayer(ObjectGuid g){return connected.count(g.id);}}
|
||||
enum class ClientlessPlayerState{Offline,Loading,Online,Removing};
|
||||
@@ -26,14 +26,18 @@ struct Core{bool succeed=true;std::vector<unsigned>started;bool StartPlayer(unsi
|
||||
int CreateClientlessAdventureLuaController(){return 0;}
|
||||
float sample=.5;float frand(int,int){return sample;}
|
||||
#define TC_LOG_INFO(...) ((void)0)
|
||||
struct Profile{unsigned ProfileVersion=0,Class=0,Level=0;std::string SourcePath;};
|
||||
struct Player{ObjectGuid GetGUID(){return ObjectGuid{ObjectGuid::Player,26};}};
|
||||
struct Lua{Profile* profile=nullptr;Profile* GetAdventureProfile(unsigned){return profile;}}lua;auto sClientlessLuaEngine=&lua;
|
||||
struct AdventurePopulationMgr{
|
||||
struct Bot{uint32 Guid,Account,Pool;uint64 Created;uint32 Failures=0;time_t Retry=0;};
|
||||
unsigned _cursor=0,_rotationAge=86400;double _rotationChance=.15;
|
||||
std::array<unsigned,4>_targets{};std::vector<Bot>_bots;std::unordered_set<unsigned>_considered;
|
||||
std::vector<std::pair<unsigned,unsigned>>generated;
|
||||
std::unordered_map<unsigned,unsigned> _checks;void Online(Player*);
|
||||
void Step();void Generate(unsigned pool,unsigned replace=0){generated.push_back({pool,replace});}
|
||||
};
|
||||
'''+function('void AdventurePopulationMgr::Step()')+r'''
|
||||
'''+function('void AdventurePopulationMgr::Step()')+function('void AdventurePopulationMgr::Online(')+r'''
|
||||
int main(){
|
||||
assert(Pool(1,true)==0 && Pool(1,false)==1 && Pool(2,true)==2 && Pool(2,false)==3);
|
||||
assert(!Replace(true,true,false,100,0,0,1));assert(!Replace(false,false,false,100,0,0,1));
|
||||
@@ -41,6 +45,13 @@ int main(){
|
||||
assert(Replace(false,true,false,100,100,.1,.2));assert(!Replace(false,true,false,100,0,.3,.2));
|
||||
assert(!Deficit(5,3,2) && Deficit(5,2,1)==2 && !Deficit(0,2,0));
|
||||
AdventurePopulationMgr mgr;
|
||||
Player named;Profile profile;lua.profile=&profile;
|
||||
mgr.Online(&named);assert(mgr._checks.empty());
|
||||
profile.ProfileVersion=2;profile.Class=1;profile.Level=60;profile.SourcePath="profiles/arthoran.lua";
|
||||
mgr.Online(&named);assert(mgr._checks.count(26));
|
||||
mgr._checks.clear();profile.Level=0;mgr.Online(&named);assert(mgr._checks.empty());
|
||||
profile.Level=60;profile.ProfileVersion=0;mgr.Online(&named);assert(mgr._checks.empty());
|
||||
lua.profile=nullptr;mgr.Online(&named);assert(mgr._checks.empty());
|
||||
mgr.Step();assert(mgr.generated.empty() && core.started.empty());
|
||||
mgr._targets={1,2,3,4};
|
||||
mgr.Step();assert(mgr.generated.back().first==0);mgr.Step();assert(mgr.generated.back().first==1);
|
||||
|
||||
Reference in new issue
Block a user