Implement 40250 classic client port

This commit is contained in:
shenlei
2026-09-01 18:49:28 +09:00
parent 2277b1dd60
commit 8f61990a83
481 changed files with 169826 additions and 293 deletions
+46
View File
@@ -31,6 +31,11 @@ class AuthClient;
class GameClient;
class MarkClient;
class MarkImageSet;
class EntityStore;
namespace classic {
class ClassicSession;
class ClassicMarkClient;
}
} // namespace mtnet
namespace mtgodot {
@@ -61,6 +66,9 @@ public:
bool change_name(int slot, const godot::String &name);
// GC_EMPIRE (0 = server still wants an empire pick before select).
int get_empire() const;
// CG_EMPIRE: choose one of the three empires when the account has no empire.
// Both network backends expose the same intent for the character-select UI.
bool select_empire(int empire);
// 3 or 4 depending on which GC_LOGIN_SUCCESS the server sent.
int get_slot_count() const;
@@ -120,6 +128,7 @@ public:
// --- P8 messenger / friends ---
bool add_friend(const godot::String &name);
bool remove_friend(const godot::String &name);
bool friend_answer(const godot::String &name, bool accept);
godot::Array get_friends() const; // [{name, online}]
godot::Dictionary get_lover() const; // {valid, name, love_point}
@@ -147,12 +156,14 @@ public:
int get_safebox_size() const;
int get_safebox_gold() const;
godot::Array get_safebox_items() const; // [{cell, vnum, count}]
bool safebox_password(const godot::String &password);
// --- item-mall (창고몰) ---
bool is_mall_open() const;
int get_mall_size() const;
godot::Array get_mall_items() const; // [{cell, vnum, count}]
bool mall_checkout(int mall_pos, int inv_window, int inv_cell);
bool mall_password(const godot::String &password);
// --- private (PC) shop ---
// items: Array of {vnum, count, inv_cell, price, display_pos}
@@ -164,6 +175,11 @@ public:
bool cube_make(int result_index);
bool cube_request_result_list(int npc_vnum);
bool cube_request_materials(int start_index, int count);
bool cube_open();
bool cube_close();
bool cube_list();
bool cube_add_item(int cube_index, int inventory_index);
bool cube_delete_item(int cube_index);
// --- guild ---
godot::Dictionary get_guild() const; // {in_guild, id, name, level, exp, gold, ...}
@@ -172,7 +188,17 @@ public:
bool guild_add_member(int vid);
bool guild_remove_member(int pid);
bool guild_offer(int amount);
bool guild_charge_gsp(int amount);
bool guild_change_grade_name(int grade, const godot::String &name);
bool guild_change_grade_authority(int grade, int authority);
bool guild_change_member_grade(int pid, int grade);
bool guild_change_member_general(int pid, bool enabled);
bool guild_post_comment(const godot::String &text);
bool guild_delete_comment(int comment_id);
bool guild_refresh_comments();
bool guild_answer_invite(int guild_id, bool accept);
bool guild_answer_make(const godot::String &name);
godot::Array get_guild_comments() const; // [{id, name, content}]
// --- guild war / guild skill ---
godot::Dictionary get_guild_skill() const; // {valid, skill_point, guild_point, max_guild_point, levels[12]}
@@ -223,6 +249,11 @@ public:
godot::Array get_land_areas() const; // [{id, guild_id, rect}] in server cm
godot::Array get_observers() const; // [{vid, pos}] in Godot metres
godot::Array get_world_markers() const; // [{id, name, vid, type, pos}]
bool is_observer_mode() const;
int get_observer_count() const;
bool has_mobile_flag() const;
bool combo_skill_enabled() const;
godot::Dictionary get_stamina_state() const; // {consuming, per_sec, current}
// items. window: 1=inventory, 2=equipment (mtnet::WINDOW_*).
bool move_item(int from_window, int from_cell, int to_window, int to_cell, int count);
@@ -239,11 +270,13 @@ public:
godot::Dictionary get_item(int window, int cell) const;
godot::Array get_ground_items() const; // {vid, vnum, pos}
godot::Array get_pvp_relations() const; // [{src_vid, dst_vid, mode}]
godot::Dictionary get_duel() const; // {active, cannot_attack, opponents}
// --- networked world snapshot (positions already Godot-space, metres) ---
godot::Dictionary get_entity(int vid) const;
godot::Array get_entities() const;
int get_main_vid() const;
int get_main_pid() const;
godot::Dictionary get_points() const; // local player stat block
godot::Dictionary get_target() const; // {vid, hp_percent} of selected target
godot::Array get_affects() const; // active buffs/debuffs on the local player
@@ -287,7 +320,17 @@ private:
std::unique_ptr<mtnet::AuthClient> auth;
std::unique_ptr<mtnet::GameClient> game;
// MT_PROTOCOL=classic (40250): replaces auth+game for the flows it supports
// (connect/login/select/enter-game/world/intents). Null otherwise.
std::unique_ptr<mtnet::classic::ClassicSession> classic_sess;
bool classic_list_emitted = false;
int classic_last_stage = -1;
int classic_last_empire = -1;
void pump_classic();
// the EntityStore of whichever backend is active (classic_sess or game).
const mtnet::EntityStore *active_world() const;
std::unique_ptr<mtnet::MarkClient> mark;
std::unique_ptr<mtnet::classic::ClassicMarkClient> classic_mark;
std::unique_ptr<mtnet::MarkImageSet> mark_store; // survives after `mark` is torn down
godot::String mark_host;
int mark_port = 0;
@@ -295,11 +338,14 @@ private:
uint32_t symbol_guild_id = 0;
std::vector<uint8_t> symbol_data;
void pump_mark();
void pump_classic_mark();
int last_auth_state = -1;
int last_game_state = -1;
int last_game_phase = -1;
int last_game_empire = -1;
bool char_list_emitted = false;
uint32_t selected_pid = 0;
godot::Array build_char_list() const;
// CG_ENTERGAME is sent ~1.5s into PHASE_LOADING (not immediately) — sending
// it before the server finishes the spawn burst makes it drop us ~10s later.