feat: add CH5 cube renewal presentation, trade level UI, audit manifests, and test fixtures

This commit is contained in:
shen
2026-10-23 20:17:26 -07:00
parent c1de05dc98
commit d6617e01f7
96 changed files with 6059 additions and 106 deletions
+24 -3
View File
@@ -481,7 +481,7 @@ bool FakeLoginServer::ServeGame(Connection& c, int index)
auto main = zeroed<GCMainCharacter>();
main.header = HDR_GC_MAIN_CHARACTER;
main.vid = kMainVID;
main.race = 0;
main.race = std::getenv("MT_TEST_QUIVER_MOTION") ? 1 : 0;
std::strncpy(main.name, kCharacterName, sizeof(main.name) - 1);
main.x = kX;
main.y = kY;
@@ -525,7 +525,7 @@ bool FakeLoginServer::ServeGame(Connection& c, int index)
actor.x = kX;
actor.y = kY;
actor.type = 6; // CHAR_TYPE_PC (common/length.h ECharType)
actor.race = 0; // warrior male
actor.race = std::getenv("MT_TEST_QUIVER_MOTION") ? 1 : 0; // opt-in female archer
actor.moving_speed = 100;
actor.attack_speed = 100;
GCCharAddInfo info = zeroed<GCCharAddInfo>();
@@ -534,11 +534,13 @@ bool FakeLoginServer::ServeGame(Connection& c, int index)
std::strncpy(info.name, kCharacterName, sizeof(info.name) - 1);
info.empire = 1;
info.level = 10;
if (std::getenv("MT_TEST_QUIVER_MOTION")) info.parts[1]=2000;
GCCharacterUpdate update = zeroed<GCCharacterUpdate>();
update.header = HDR_GC_CHARACTER_UPDATE;
update.vid = kMainVID;
update.moving_speed = 100;
update.attack_speed = 100;
if (std::getenv("MT_TEST_QUIVER_MOTION")) update.parts[1]=2000;
if (!c.Send(actor) || !c.Send(info) || !c.Send(update))
return Fail(name + ": send main actor");
@@ -747,6 +749,7 @@ bool FakeLoginServer::ServeGame(Connection& c, int index)
if (mobile_fixture && !item_set(2, 19)) return Fail(name + ": mobile weapon fixture");
int quest_page = 0; // the quest dialogue's last page sent (1 question, 2 next, 3 done)
bool safebox_open = false;
unsigned trade_starts=0;
std::uint32_t safebox0 = kSafeboxItemVnum;
std::int32_t safebox_gold = kSafeboxMoney;
// CQuestManager::SendScript: packet_script {header, size, skin, src_size} and the script text.
@@ -875,6 +878,10 @@ bool FakeLoginServer::ServeGame(Connection& c, int index)
{
out.subheader = EXCHANGE_GC_START;
out.arg1 = ex.arg1;
if(std::getenv("MT_TEST_TRADE_LEVEL")) {
const std::uint32_t levels[]={87,0,999,31};
out.arg3=levels[(trade_starts++)%4];
}
ok = c.Send(out);
out.subheader = EXCHANGE_GC_ITEM_ADD;
out.arg1 = kExchangeItemVnum;
@@ -942,7 +949,21 @@ bool FakeLoginServer::ServeGame(Connection& c, int index)
return c.Send(chat)&&c.Send(cmd.c_str(),cmd.size()+1);
};
const std::string r=std::to_string(request);
if(kind=="cap") {if(!reply("MTF1 cap "+r+" 1 "+(std::getenv("MT_TEST_QUIVER")?"2111":"63")+" 1700000000"))return Fail(name+": feature cap");}
if(kind=="cap") {if(!reply("MTF1 cap "+r+" 1 "+(std::getenv("MT_TEST_CUBE")?"4159":std::getenv("MT_TEST_QUIVER")?"2111":"63")+" 1700000000"))return Fail(name+": feature cap");}
else if(kind=="cube" && std::getenv("MT_TEST_CUBE")) {
if(!reply("MTF1 begin "+r+" cube 20383 0 1 0 1700000000")||
!reply("MTF1 recipe "+r+" 0 1 1111111111111111 2222222222222222 19 1 0 100 50 0 574f524c44415244 1 30006 1")||
!reply("MTF1 end "+r+" 1"))return Fail(name+": cube catalogue");
}
else if(kind=="cubecheck" && std::getenv("MT_TEST_CUBE")) {
std::vector<std::pair<std::string,int64_t>> rows={{"revision_hi",0x22222222},{"revision_lo",0x22222222},
{"attempts",offset},{"gold_required",int64_t(offset)*100},{"gold_available",1000},{"materials_ok",1},
{"gold_ok",1},{"mutation_enabled",0},{"reward_maximum",offset},{"capacity_reserved",0},{"copy_required",0},
{"material1",30006},{"needed1",offset},{"available1",offset}};
if(!reply("MTF1 begin "+r+" cubecheck "+std::to_string(subject)+" "+std::to_string(offset)+" "+std::to_string(rows.size())+" 0 1700000000"))return Fail(name+": cube preflight begin");
for(unsigned i=0;i<rows.size();++i)if(!reply("MTF1 stat "+r+" "+std::to_string(i)+" "+rows[i].first+" "+std::to_string(rows[i].second)))return Fail(name+": cube preflight row");
if(!reply("MTF1 end "+r+" "+std::to_string(rows.size())))return Fail(name+": cube preflight end");
}
else if(kind=="quiver" && std::getenv("MT_TEST_QUIVER")) {
if(!reply("MTF1 begin "+r+" quiver 0 0 0 0 1700000000") || !reply("MTF1 end "+r+" 0"))return Fail(name+": quiver ack");
std::uint8_t state[6]={219,0,0,0,0,9};std::uint32_t vid=kMainVID;