Fix 40250 classic login and world loading
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
// are driven by the Godot UI or the documented command surface.
|
||||
//
|
||||
// net_classic_e2e <host> <port> <id> <password> [slot] [timeout_seconds]
|
||||
// MT_CLASSIC_AUTH=1 selects the 40250 auth(11000) -> game(<port>) flow.
|
||||
//
|
||||
// Exit status 0 means the socket handshake, DH2/CTR negotiation, login,
|
||||
// character list, character selection and PHASE_GAME were all reached.
|
||||
@@ -70,9 +71,18 @@ int main(int argc, char **argv) {
|
||||
}
|
||||
|
||||
mtnet::classic::ClassicSession session;
|
||||
session.set_auto_entergame_delay(1500);
|
||||
const int enter_delay_ms = std::getenv("MT_CLASSIC_ENTER_DELAY") ?
|
||||
std::atoi(std::getenv("MT_CLASSIC_ENTER_DELAY")) : 8000;
|
||||
session.set_auto_entergame_delay(enter_delay_ms);
|
||||
session.set_wire_trace(std::getenv("MT_NET_TRACE") != nullptr);
|
||||
if (!session.connect(host, static_cast<uint16_t>(port), id, password)) {
|
||||
const bool use_auth = std::getenv("MT_CLASSIC_AUTH") != nullptr;
|
||||
const int auth_port = std::getenv("MT_CLASSIC_AUTH_PORT") ?
|
||||
std::atoi(std::getenv("MT_CLASSIC_AUTH_PORT")) : 11000;
|
||||
const bool connected = use_auth ?
|
||||
session.connect(host, static_cast<uint16_t>(auth_port), host, static_cast<uint16_t>(port),
|
||||
id, password) :
|
||||
session.connect(host, static_cast<uint16_t>(port), id, password);
|
||||
if (!connected) {
|
||||
std::fprintf(stderr, "FAIL connect: %s\n", session.last_error().c_str());
|
||||
return 2;
|
||||
}
|
||||
@@ -99,8 +109,9 @@ int main(int argc, char **argv) {
|
||||
std::printf("[e2e] character slots=%zu\n", slots.size());
|
||||
for (size_t i = 0; i < slots.size(); ++i) {
|
||||
const auto &slot = slots[i];
|
||||
std::printf(" [%zu] %s id=%u level=%u\n", i, slot.name.c_str(), slot.id,
|
||||
slot.level);
|
||||
std::printf(" [%zu] %s id=%u level=%u pos=(%d,%d) main_part=%u hair_part=%u change_name=%d\n",
|
||||
i, slot.name.c_str(), slot.id, slot.level, slot.x, slot.y, slot.main_part,
|
||||
slot.hair_part, (int)slot.change_name);
|
||||
}
|
||||
const int slot = choose_slot(slots, requested_slot);
|
||||
if (slot < 0) {
|
||||
@@ -130,6 +141,18 @@ int main(int argc, char **argv) {
|
||||
}
|
||||
std::printf("PASS PHASE_GAME main_vid=%u entities=%zu inventory_slots=%d points_level=%d\n",
|
||||
world.main_vid(), world.size(), inventory_count, world.points().level());
|
||||
if (const mtnet::Entity *me = world.get(world.main_vid())) {
|
||||
std::printf(" main race=%u pos_cm=(%.0f,%.0f,%.0f) parts=[%u,%u,%u,%u] name=%s\n",
|
||||
me->race, me->x, me->y, me->z, me->parts[0], me->parts[1], me->parts[2],
|
||||
me->parts[3], me->name.c_str());
|
||||
}
|
||||
for (int wear = 0; wear < mtnet::WEAR_MAX_NUM; ++wear) {
|
||||
const mtnet::Item &item = world.equip_slot(wear);
|
||||
if (!item.empty()) {
|
||||
std::printf(" equip wear=%d vnum=%u count=%u\n", wear, item.vnum,
|
||||
(unsigned)item.count);
|
||||
}
|
||||
}
|
||||
session.disconnect();
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user