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.
34 lines
2.3 KiB
Python
34 lines
2.3 KiB
Python
"""Run real bot Speak against native channel/zone adapters."""
|
|
from pathlib import Path
|
|
import subprocess,tempfile
|
|
root=Path(__file__).resolve().parents[2];s=(root/'src/server/game/World/AdventureGroupMgr.cpp').read_text()
|
|
a=s.index('void AdventureGroupMgr::Speak(');b=s.index('std::string AdventureGroupMgr::RecruitmentText(',a)
|
|
code=r'''
|
|
#include <vector>
|
|
#include <string>
|
|
#include <algorithm>
|
|
#include <cassert>
|
|
using uint32=unsigned;using time_t=long;
|
|
#define TC_LOG_INFO(...) ((void)0)
|
|
constexpr int ALLIANCE=0,LANG_COMMON=7,LANG_ORCISH=1;
|
|
namespace AdventureGroupPolicy{bool Capital(unsigned z){return z==1519;}}
|
|
namespace GameTime{time_t now=100;time_t GetGameTime(){return now;}}
|
|
struct Entry{unsigned ID=26;}entry;
|
|
struct Store{unsigned expected;Entry*LookupEntry(unsigned id){assert(id==expected);return &entry;}}sChatChannelsStore{26},sAreaTableStore{1519};
|
|
struct Channel;
|
|
struct Player{bool allowed=true;std::vector<Channel*> channels;unsigned GetZoneId(){return 1519;}unsigned GetTeam(){return 0;}unsigned GetGUID(){return 1;}bool CanJoinConstantChannelInZone(Entry*,Entry*){return allowed;}auto&GetJoinedChannels(){return channels;}};
|
|
struct Channel{int messages=0;bool deny=false;void JoinChannel(Player*p,char const*){if(!deny)p->channels.push_back(this);}void Say(unsigned,std::string const&,int){++messages;}}channel;
|
|
struct Manager{Channel*GetJoinChannel(unsigned id,char const* name,Entry*){assert(id==26 && std::string(name).empty());return &channel;}}manager;
|
|
namespace ChannelMgr{Manager*forTeam(unsigned){return &manager;}}
|
|
struct AdventureGroupMgr{time_t _nextChannelMessage=0;void Speak(Player*,std::string const&);};
|
|
'''+s[a:b]+r'''
|
|
int main(){AdventureGroupMgr m;Player p;m.Speak(&p,"test");assert(channel.messages==1&&p.channels.size()==1);m.Speak(&p,"test");assert(channel.messages==1);
|
|
GameTime::now+=16;p.allowed=false;m.Speak(&p,"test");assert(channel.messages==1);
|
|
GameTime::now+=16;p.allowed=true;p.channels.clear();channel.deny=true;m.Speak(&p,"test");assert(channel.messages==1);
|
|
}
|
|
'''
|
|
with tempfile.TemporaryDirectory() as d:
|
|
p=Path(d);(p/'test.cpp').write_text(code)
|
|
subprocess.run(['g++','-std=c++17',str(p/'test.cpp'),'-o',str(p/'test')],check=True);subprocess.run([str(p/'test')],check=True)
|
|
print('Native LFG: ID26, localized standard channel, zone eligibility, join verification and population throttle passed')
|