50 lines
3.8 KiB
C++
50 lines
3.8 KiB
C++
// Offline synthetic targets: opcode/flags are pinned SDK contracts; this does
|
|
// not claim the privacy-omitted live Mining request had this exact body.
|
|
#include "world_translation.hpp"
|
|
#include "gateway/object_updates.hpp"
|
|
#include <iostream>
|
|
using namespace gateway;
|
|
static void check(bool ok){if(!ok)throw Error("gameobject cast assertion");}
|
|
template<class F>void rejects(F f){try{f();}catch(const Error&){return;}throw Error("expected gameobject cast rejection");}
|
|
static Bytes cast(uint32_t flags,const Guid128& target){
|
|
Bytes b;Guid128 id{};id[0]=1;append(b,pack_guid(id));le(b,0,1);for(int i=0;i<3;++i)le(b,0,4);
|
|
le(b,2575,4);le(b,0,4);le(b,0,4);le(b,flags,4);append(b,pack_guid(target));
|
|
Guid128 zero{};append(b,pack_guid(zero));append(b,pack_guid(zero));le(b,0,2);
|
|
le(b,0,4);le(b,0,4);append(b,pack_guid(zero));for(int i=0;i<3;++i)le(b,0,4);
|
|
le(b,0,1);le(b,0,1);return b;
|
|
}
|
|
static NativeWorldTranslation world(uint64_t id){
|
|
NativeWorldTranslation w{};w.selected.guid=4509;w.realm=70;w.self_created=true;w.location=WorldLocation{0,{0,0,0,0}};w.spells.insert(2575);
|
|
auto& a=w.entities.actors[id];a.kind=5;a.sent=true;a.eligible=true;a.entry=1731;a.generation=8;a.presentation_realm=70;a.presentation_map=0;a.modern=forever_game_object_guid(id,1731,70,0);return w;
|
|
}
|
|
int main(){try{
|
|
const uint64_t go=0xf1100006c36ae028ULL;auto w=world(go);auto body=cast(0x800,w.entities.actors.at(go).modern);
|
|
auto parsed=forever_spell_request(body);check(parsed.target_flags==0x800 && parsed.unit==w.entities.actors.at(go).modern);
|
|
auto result=w.gameplay(0x3e0176,body);Bytes expected;le(expected,2575,4);le(expected,0x800,2);Bytes raw;le(raw,go,8);append(expected,pack_guid(raw));check(result.opcode==0x12e && result.body==expected);
|
|
for(size_t n=0;n<body.size();++n)rejects([&]{forever_spell_request(std::span(body).first(n));});
|
|
auto extra=body;extra.push_back(0);rejects([&]{forever_spell_request(extra);});
|
|
rejects([&]{forever_spell_request(cast(0x802,w.entities.actors.at(go).modern));});
|
|
auto unknown=cast(0x800,forever_player_guid(4510,70));rejects([&]{w.gameplay(0x3e0176,unknown);});
|
|
{NativeInventoryTranslation inventory;Guid128 item{};Bytes use{255,35};append(use,pack_guid(item));append(use,body);
|
|
bool held=false;try{(void)inventory.use_item(use,{});}catch(const Error& e){held=std::string(e.what())=="item use gameobject target not qualified";}check(held);}
|
|
{// Live 2026-11-22 (MC rune + Aqual Quintessence): the world qualifies the object binding, then inventory owns the source.
|
|
Guid128 item{};Bytes use{255,35};append(use,pack_guid(item));append(use,body);
|
|
auto message=[&](NativeWorldTranslation& x){try{(void)x.gameplay(0x3e0171,use);}catch(const Error& e){return std::string(e.what());}return std::string();};
|
|
check(message(w)=="item use source is empty");
|
|
auto stale=w;stale.entities.actors.at(go).sent=false;auto held=message(stale);check(!held.empty() && held!="item use source is empty");}
|
|
|
|
for(int mode=0;mode<8;++mode){auto x=w;auto& a=x.entities.actors.at(go);
|
|
if(mode==0)a.sent=false;
|
|
if(mode==1)a.eligible=false;
|
|
if(mode==2)a.generation=0;
|
|
if(mode==3)a.kind=3;
|
|
if(mode==4)a.presentation_map=1;
|
|
if(mode==5)a.presentation_realm=71;
|
|
if(mode==6)x.self_created=false;
|
|
if(mode==7)x.spells.clear();
|
|
rejects([&]{x.gameplay(0x3e0176,body);});}
|
|
{auto x=w;x.source_stand=1;x.source_stand_pending=true;auto packet=x.gameplay(0x3e0176,body);check(x.defer_standing_cast(0x3e0176,body,packet));
|
|
x.stand_state_received(0);x.entities.actors.at(go).generation++;check(!x.standing_cast_request() && !x.standing_cast);}
|
|
std::cout<<"PASS Source object-target flag, exact GUID, bounds, current binding and stand generation; live capture attribution pending\n";return 0;
|
|
}catch(const std::exception& e){std::cerr<<e.what()<<'\n';return 1;}}
|