24 lines
2.2 KiB
C++
24 lines
2.2 KiB
C++
#include "world_translation.hpp"
|
|
#include <cstdlib>
|
|
#include <iostream>
|
|
using namespace gateway;
|
|
int main(){try{
|
|
setenv("GW_GUILD_MANAGEMENT_PROTOTYPE","1",1);
|
|
NativeWorldTranslation w{};w.realm=70;w.selected.guid=4509;w.selected.name="Gatewaytest";w.self_created=true;
|
|
if(w.guild_control_prepare("guild1 state") || !w.requests.empty() || w.guild_control_notices.size()!=1 ||
|
|
w.guild_control_notices.front()!="GWTURTLE1 GUILD UNAVAILABLE")throw Error("unguilded state query produced a mutation error or Source request");
|
|
w.guild_control_notices.clear();
|
|
w.guild_id=21;w.guild_rank=0;
|
|
GuildInfo info{};info.id=21;info.name="HybridLocalTest";info.ranks={"Guild Master","Officer","Veteran","Member","Initiate"};w.guild_rank_info=info;
|
|
if(w.guild_control_prepare("guild1 state") || w.requests.size()!=2 || w.requests[0].opcode!=0x89 || w.requests[1].opcode!=0x54)throw Error("cold query did not retain genuine Source requests");
|
|
// Existing PE unconditionally drains local world presentation after a
|
|
// successful zero-byte self-addon result. Session rejects absent work.
|
|
if(!w.local_presentation_pending())throw Error("REPRO: zero-byte addon result has no local work; PE drain would close with24");
|
|
auto packet=w.local_presentation(0x46010046);Reader r(packet);if(r.le(4)!=1 || r.le(4)!=0x4c0001)throw Error("cold query lacks one real local chat presentation");const auto size=r.le(4);r.take(size);r.end();
|
|
const std::string wait="GWTURTLE1 GUILD WAIT";if(std::search(packet.begin(),packet.end(),wait.begin(),wait.end())==packet.end())throw Error("cold query falsely publishes ready guild state");
|
|
if(w.requests.size()!=2 || w.local_presentation_pending() || w.guild_management_roster || w.guild_management_pending)throw Error("local drain consumed Source requests or fabricated roster/pending mutation");
|
|
if(w.guild_control_prepare("guild1 17 21 4 flag 2 13 1") || w.guild_control_notices.size()!=1 ||
|
|
w.guild_control_notices.front()!="GWTURTLE1 GUILD ERROR 17 invalid-or-stale-request")throw Error("rank failure lost the requesting edit's serial");
|
|
std::cout<<"PASS cold guild query emits truthful WAIT for required local drain, retains Source queries, and fabricates no ready/confirmed state\n";
|
|
}catch(const std::exception& e){std::cerr<<e.what()<<'\n';return 1;}}
|