From eab87e071f1d6177ded476bb52b1e73bdef21a11 Mon Sep 17 00:00:00 2001 From: AleaJactaEst Date: Fri, 10 Apr 2020 18:09:06 +0200 Subject: [PATCH] update network part --- README.md | 154 +++- assets/Scripts/Config/connexion.gd | 86 +-- assets/Scripts/Definition/msg.gd | 152 ++-- gdnative/test/bitset.gd | 8 +- modules/bitset/bitset.cpp | 10 +- modules/networkconnection/network_data.cpp | 13 + modules/networkconnection/network_data.h | 11 +- modules/networkconnection/state_connexion.cpp | 230 +++++- modules/networkconnection/state_connexion.h | 18 +- .../referentialmessagecore.cpp | 691 +++++++++++++++++- .../referentialmessagecore.h | 6 +- 11 files changed, 1202 insertions(+), 177 deletions(-) diff --git a/README.md b/README.md index c94d802..77e25ea 100644 --- a/README.md +++ b/README.md @@ -141,6 +141,80 @@ ReferentialMessageCore -> class singleton (uniq object) [Manage data provide by ### ViewMessage + + Message UDP : + +-------------------+------------+--- + | CurrentSendNumber | SystemMode | . . . + | 32 bits | 1 bit | + +-+-+-+-+-+-+-+-+-+-+------------+--- + 1 -> system mode + 0 -> normal mode + + + + +---------+ + | | +----------------+ + | | -> | System Message | + | Message | +----------------+ + | | + | UDP | +----------------+ +---------------+ +---------+ +---------+ +---------+ + | | -> | Normal Message | -> |LastReceivedAck|-| Level A +-+ Level B +-+ Level C + + | | +----------------+ +---------------+ +---------+ +---------+ +---------+ + +---------+ + + + System mode : + +---------+-- + | Message | see system message + | 8 bits | + +---------+-- + + System Message: + SYSTEM_LOGIN_CODE = 0 : [client] + ... + SYSTEM_SYNC_CODE = 1 : [server] + +---- + | Synchronize (32 bits - unsigned) + +------ + | stime (64 bits - signed) + +------ + | LatestSync ( 32 bits - unsigned ) + +------ + | MsgData ( 16 * 8bits : Array - md5sum of msg.xml) + +------ + | DatabaseData ( 16 * 8 bits : Array - md5sum database.xml) + +------ + + SYSTEM_ACK_SYNC_CODE = 2 : [client] + +---- + | frontack ( 32 bits - unsigned) + +---- + | backack ( 32 bits - unsigned) + +---- + | longackbitfield ( 1024 ) + +---- + | syncCode ( 32 bits unsigned) + +---- + SYSTEM_PROBE_CODE = 3 : [server] + +---- + | LatestProbe ( 32 bits - signed) + +---- + SYSTEM_ACK_PROBE_CODE = 4 : [client] + ... + SYSTEM_DISCONNECTION_CODE = 5 : [client] + ... + SYSTEM_STALLED_CODE = 6 : [server] + No more data + SYSTEM_SERVER_DOWN_CODE = 7 : [server] + No more data + SYSTEM_QUIT_CODE = 8 : [client] + ... + SYSTEM_ACK_QUIT_CODE = 9 : [server] + No more data + + + Normal mode: : + PacketServer +---------+ +---------+ +---------+ | Level A | | Level B | | Level C | @@ -159,35 +233,55 @@ PacketServer | (3) | +---------+ - -Message UDP : - +-------------+ - | Server Part | - +-------------+ - | Type Message (system / application) | + +---------------+ + |LastReceivedAck| + | 32 bits | + +---------------+ + +---------+ +-----+-+-----------+ +-------------+ + | Level X | -> | next | shortcode | -> 1 (true) | Action code | +----------- + +---------+ | 1 bit | 1 bit | | 2 bit | | Action + +-------+-----------+ +-------------+ -> | (X bits) + +-------------+ +----------- + -> 0 (false) | Action code | + | 8 bits | + +-------------+ - - +---------+ - | | +----------------+ - | | -> | System Message | - | Message | +----------------+ - | | - | UDP | +----------------+ +---------+ +---------+ +---------+ - | | -> | Normal Message | -> | Level A +-+ Level B +-+ Level C + - | | +----------------+ +---------+ +---------+ +---------+ - +---------+ - - Message UDP : - +-------------------+------------+--- - | CurrentSendNumber | SystemMode | . . . - | 32 bits | 1 bit | - +-+-+-+-+-+-+-+-+-+-+------------+--- - 1 -> system mode - 0 -> normal mode - - System Message : - +---------+-- - | Message | . . . - | 8 bits | - +---------+-- +Action code : + ACTION_POSITION_CODE = 0: khanat-opennel-code/code/ryzom/common/src/game_share/action_position.cpp:34 void CActionPosition::unpack (NLMISC::CBitMemStream &message) + px ( 16 bit unsigned ) + py ( 16 bit unsigned ) + pz ( 16 bit unsigned ) : low bit have other signification + 0x01 : IsRelative + 0x02 : Interior + ACTION_GENERIC_CODE = 1: khanat-opennel-code/code/ryzom/common/src/game_share/action_generic.cpp void CActionGeneric::unpack (NLMISC::CBitMemStream &message) + size ( 32 bits unsigned ) : if size > 512 we have an error (normally reject by server) + StreamByte ( Array : size * 8 bits unsigned ) + ACTION_GENERIC_MULTI_PART_CODE = 2 : khanat-opennel-code/code/ryzom/common/src/game_share/action_generic_multi_part.h:46 virtual void unpack (NLMISC::CBitMemStream &message) + Number ( 8 bits unsigned ) + Part ( 16 bits unsigned ) + NbBlock ( 16 bits unsigned ) + size ( 32 bits unsigned ) + PartCont ( Array : size * 8 bits unsigned ) + ACTION_SINT64 = 3 : khanat-opennel-code/code/ryzom/common/src/game_share/action_sint64.cpp:86 void CActionSint64::unpack (NLMISC::CBitMemStream &message) + value ( 64 bits unsigned ) + ACTION_SYNC_CODE = 10 : khanat-opennel-code/code/ryzom/common/src/game_share/action_sync.h:44 virtual void unpack (NLMISC::CBitMemStream &message) + Sync ( 32 bits unsigned ) + BKEntityId ( 64 bits unsigned ) [see definition : khanat-opennel-code/code/nel/include/nel/misc/entity_id.h:64] + ACTION_DISCONNECTION_CODE = 11 : khanat-opennel-code/code/ryzom/common/src/game_share/action_disconnection.h + No data + ACTION_ASSOCIATION_CODE = 12 : khanat-opennel-code/code/ryzom/common/src/game_share/action_association.h virtual void unpack (NLMISC::CBitMemStream &message) + IsNewAssociation ( bool / 1 bit ) + if IsNewAssociation is true: + SheetId ( 32 bits unsigned ) + Replace ( bool / 1 bit ) + ACTION_LOGIN_CODE = 13 : khanat-opennel-code/code/ryzom/common/src/game_share/action_login.h virtual void unpack (NLMISC::CBitMemStream &message) + ua ( 32 bits unsigned ) + uk ( 32 bits unsigned ) + ui ( 32 bits unsigned ) + ACTION_TARGET_SLOT_CODE = 40 : khanat-opennel-code/code/ryzom/common/src/game_share/action_target_slot.h virtual void unpack (NLMISC::CBitMemStream &message) + Slot ( 8 bits unsigned ) + TargetOrPickup (2 bits unsigned) + ACTION_DUMMY_CODE = 99 : khanat-opennel-code/code/ryzom/common/src/game_share/action_dummy.h virtual void unpack (NLMISC::CBitMemStream &message) + Dummy1 ( 32 bits unsigned ) + Dummy2 ( 32 bits unsigned ) \ No newline at end of file diff --git a/assets/Scripts/Config/connexion.gd b/assets/Scripts/Config/connexion.gd index 8e62d72..4a0ba10 100644 --- a/assets/Scripts/Config/connexion.gd +++ b/assets/Scripts/Config/connexion.gd @@ -16,59 +16,59 @@ # along with this program. If not, see . class connexion: - # var _url_login = "http://http://149.91.80.160/login/r2_login.php" - var _url_login = "https://lirria.khaganat.net/login/r2_login.php" - # var _url_register = "http://149.91.80.160/ams/index.php?page=register" - var _url_register = "http://lirria.khaganat.net/ams/index.php?page=register" + # var _url_login = "http://http://149.91.80.160/login/r2_login.php" + var _url_login = "https://lirria.khaganat.net/login/r2_login.php" + # var _url_register = "http://149.91.80.160/ams/index.php?page=register" + var _url_register = "http://lirria.khaganat.net/ams/index.php?page=register" - var _language = "fr" - var _valid_certificate = true + var _language = "fr" + var _valid_certificate = true - func save(): - print("[config connexion] Save connexion config") - var config_file = ConfigFile.new() - config_file.set_value("login", "url", _url_login) - config_file.set_value("register", "url", _url_register) - config_file.set_value("global", "valid_certificate", _valid_certificate) - config_file.set_value("global", "language", _language) - config_file.save("user://connexion.cfg") + func save(): + print("[config connexion] Save connexion config") + var config_file = ConfigFile.new() + config_file.set_value("login", "url", _url_login) + config_file.set_value("register", "url", _url_register) + config_file.set_value("global", "valid_certificate", _valid_certificate) + config_file.set_value("global", "language", _language) + config_file.save("user://connexion.cfg") - func _init(): - print("[config connexion] Load connexion config") - #var message = load("res://assets/Scripts/Models/nel_login_message.gd") - var config_file = ConfigFile.new() + func _init(): + print("[config connexion] Load connexion config") + #var message = load("res://assets/Scripts/Models/nel_login_message.gd") + var config_file = ConfigFile.new() - # /home//.local/share/godot/app_userdata/Khanat/connexion.cfg - var err = config_file.load("user://connexion.cfg") - if err: - print("Error code when loading player config file khanat.cfg: ", err) - save() + # /home//.local/share/godot/app_userdata/Khanat/connexion.cfg + var err = config_file.load("user://connexion.cfg") + if err: + print("Error code when loading player config file khanat.cfg: ", err) + save() - self._url_login = config_file.get_value("login", "url", self._url_login) - self._url_register = config_file.get_value("register", "url", self._url_register) - self._language = config_file.get_value("global", "language", self._language) - self._valid_certificate = config_file.get_value("global", "valid_certificate", self._valid_certificate) + self._url_login = config_file.get_value("login", "url", self._url_login) + self._url_register = config_file.get_value("register", "url", self._url_register) + self._language = config_file.get_value("global", "language", self._language) + self._valid_certificate = config_file.get_value("global", "valid_certificate", self._valid_certificate) - func get_url_login(): - return self._url_login + func get_url_login(): + return self._url_login - func get_url_register(): - return self._url_register + func get_url_register(): + return self._url_register - func get_valid_certificate(): - return self._valid_certificate + func get_valid_certificate(): + return self._valid_certificate - func get_language(): - return self._language + func get_language(): + return self._language - func set_url_login(url): - self._url_login = url + func set_url_login(url): + self._url_login = url - func set_url_register(url): - self._url_register = url + func set_url_register(url): + self._url_register = url - func set_valid_certificate(value): - self._valid_certificate = value + func set_valid_certificate(value): + self._valid_certificate = value - func set_language(value): - self._language = value + func set_language(value): + self._language = value diff --git a/assets/Scripts/Definition/msg.gd b/assets/Scripts/Definition/msg.gd index d94f849..cf3851e 100644 --- a/assets/Scripts/Definition/msg.gd +++ b/assets/Scripts/Definition/msg.gd @@ -9,89 +9,89 @@ var _msg_md5sum var _msg_data = {} func open_message_xml(): - var file = File.new() - # Calculate MD5SUM - file.open("res://assets/Definition/msg.xml", File.READ) - var content = file.get_as_text() - _msg_md5sum = content.md5_text() - file.close() - print("[res://assets/Scripts/Definition/msg.gd:open_message_xml] checksum for msg.xml:" + _msg_md5sum) - #var NetworkConnexion = preload("res://networkconnexion.gdns").new() - var networkconnection = NetworkConnection.new() - networkconnection.define_checksum_msg_xml(content.md5_buffer()) - # Load XML data - #_msg_xml.open("res://assets/Definition/msg.xml") + var file = File.new() + # Calculate MD5SUM + file.open("res://assets/Definition/msg.xml", File.READ) + var content = file.get_as_text() + _msg_md5sum = content.md5_text() + file.close() + print("[res://assets/Scripts/Definition/msg.gd:open_message_xml] checksum for msg.xml:" + _msg_md5sum) + #var NetworkConnexion = preload("res://networkconnexion.gdns").new() + var networkconnection = NetworkConnection.new() + networkconnection.define_checksum_msg_xml(content.md5_buffer()) + # Load XML data + #_msg_xml.open("res://assets/Definition/msg.xml") func is_correct_md5(value): - return (_msg_md5sum == value) + return (_msg_md5sum == value) func load_node(_msg_xml, level): - var ret = _msg_xml.read() - var i - var name - var index = 0 - var dico = {} - while ret == OK: - match _msg_xml.get_node_type(): - XMLParser.NODE_NONE: # 0 - # print("NODE_NONE") - pass - XMLParser.NODE_ELEMENT: # 1 - i = 0 - while i < _msg_xml.get_attribute_count() and _msg_xml.get_attribute_name(i) != "name": - i += 1 - if i < _msg_xml.get_attribute_count(): - name = _msg_xml.get_attribute_value(i) - #print("NODE_ELEMENT level:" + str(level) + " index:" + str(index) + " name:" + name) - if not _msg_xml.is_empty(): - dico[str(index)+":"+name] = load_node(_msg_xml, level+1) - else: - dico[str(index)+":"+name] = {} - index += 1 - XMLParser.NODE_ELEMENT_END: # 2 - # print("NODE_ELEMENT_END") - # level -= 1 - return dico - XMLParser.NODE_TEXT: # 3 - #i = 0 - #while i < _msg_xml.get_attribute_count() and _msg_xml.get_attribute_name(i) != "name": - # i += 1 - #if i < _msg_xml.get_attribute_count(): - # name = _msg_xml.get_attribute_value(i) - # print("NODE_TEXT level:" + str(level) + " name:" + name) - pass - XMLParser.NODE_COMMENT: # 4 - # print("NODE_COMMENT") - pass - XMLParser.NODE_CDATA: # 5 - # print("NODE_CDATA") - pass - XMLParser.NODE_UNKNOWN: # 6 - # print("NODE_UNKNOWN") - pass - _: - # print("NODE_XXXXXXX") - pass - ret = _msg_xml.read() - return dico + var ret = _msg_xml.read() + var i + var name + var index = 0 + var dico = {} + while ret == OK: + match _msg_xml.get_node_type(): + XMLParser.NODE_NONE: # 0 + # print("NODE_NONE") + pass + XMLParser.NODE_ELEMENT: # 1 + i = 0 + while i < _msg_xml.get_attribute_count() and _msg_xml.get_attribute_name(i) != "name": + i += 1 + if i < _msg_xml.get_attribute_count(): + name = _msg_xml.get_attribute_value(i) + #print("NODE_ELEMENT level:" + str(level) + " index:" + str(index) + " name:" + name) + if not _msg_xml.is_empty(): + dico[str(index)+":"+name] = load_node(_msg_xml, level+1) + else: + dico[str(index)+":"+name] = {} + index += 1 + XMLParser.NODE_ELEMENT_END: # 2 + # print("NODE_ELEMENT_END") + # level -= 1 + return dico + XMLParser.NODE_TEXT: # 3 + #i = 0 + #while i < _msg_xml.get_attribute_count() and _msg_xml.get_attribute_name(i) != "name": + # i += 1 + #if i < _msg_xml.get_attribute_count(): + # name = _msg_xml.get_attribute_value(i) + # print("NODE_TEXT level:" + str(level) + " name:" + name) + pass + XMLParser.NODE_COMMENT: # 4 + # print("NODE_COMMENT") + pass + XMLParser.NODE_CDATA: # 5 + # print("NODE_CDATA") + pass + XMLParser.NODE_UNKNOWN: # 6 + # print("NODE_UNKNOWN") + pass + _: + # print("NODE_XXXXXXX") + pass + ret = _msg_xml.read() + return dico func read_all_node(): - var _msg_xml = XMLParser.new() - _msg_xml.open("res://assets/Definition/msg.xml") - _msg_xml.seek(0) - var dico = load_node(_msg_xml, 0) - var ref = ReferentialMessage.new() - #print(dico) - ref.read_referential(dico) - ref.show() - #print("---") + var _msg_xml = XMLParser.new() + _msg_xml.open("res://assets/Definition/msg.xml") + _msg_xml.seek(0) + var dico = load_node(_msg_xml, 0) + var ref = ReferentialMessage.new() + #print(dico) + ref.read_referential(dico) + ref.show() + #print("---") # Called when the node enters the scene tree for the first time. func _ready(): - open_message_xml() - read_all_node() - print("[res://assets/Scripts/Definition/msg.gd] ready") + open_message_xml() + read_all_node() + print("[res://assets/Scripts/Definition/msg.gd] ready") # Called every frame. 'delta' is the elapsed time since the previous frame. @@ -100,11 +100,11 @@ func _ready(): func read_msg(msgin): - pass + pass func write_msg(value): - pass + pass func _exit_tree(): - pass + pass diff --git a/gdnative/test/bitset.gd b/gdnative/test/bitset.gd index 426f684..77fce40 100644 --- a/gdnative/test/bitset.gd +++ b/gdnative/test/bitset.gd @@ -23,16 +23,16 @@ func test_write(): var bitset = BitSet.new() print ("[bitset:test_put]") bitset.resize(1024) - print ("[bitset:test_put] " + bitset.show()) + #print ("[bitset:test_put] " + bitset.show()) assert( bitset.show() == "0000000000000000000000000000010000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000") bitset.write(1, 1) - print ("[bitset:test_put] " + bitset.show()) + #print ("[bitset:test_put] " + bitset.show()) assert( bitset.show() == "0000000000000000000000000000010000000000000000000000000000000000001000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000") bitset.write(2, 1) - print ("[bitset:test_put] " + bitset.show()) + #print ("[bitset:test_put] " + bitset.show()) assert( bitset.show() == "0000000000000000000000000000010000000000000000000000000000000000001000000000000000000000000000000000011000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000") bitset.write(1, 0) - print ("[bitset:test_put] " + bitset.show()) + #print ("[bitset:test_put] " + bitset.show()) assert( bitset.show() == "0000000000000000000000000000010000000000000000000000000000000000001000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000") func test_alloc(): diff --git a/modules/bitset/bitset.cpp b/modules/bitset/bitset.cpp index 4d0fc6e..c21f512 100644 --- a/modules/bitset/bitset.cpp +++ b/modules/bitset/bitset.cpp @@ -109,7 +109,7 @@ void BitSet::set_bit(uint32_t bit_number) OS::get_singleton()->print((String("INFO [") + String(__FILE__) + String(":") + String(uitos(__LINE__)) + String("] set_bit") + String("\n")).utf8()); if (bit_number >= this->_num_bits) { - ERR_PRINTS("[BitSet::set_bit] Out of range (size:" + itos(this->_size_byte) + ", pos:" + itos(bit_number) + ")" ); + ERR_PRINT("[BitSet::set_bit] Out of range (size:" + itos(this->_size_byte) + ", pos:" + itos(bit_number) + ")" ); throw "Out of range"; } uint32_t mask = bit_number & (BITSET_SIZE - 1); @@ -122,7 +122,7 @@ void BitSet::clear_bit(uint32_t bit_number) OS::get_singleton()->print((String("INFO [") + String(__FILE__) + String(":") + String(uitos(__LINE__)) + String("] clear_bit") + String("\n")).utf8()); if (bit_number >= this->_num_bits) { - ERR_PRINTS("[BitSet::clear_bit] Out of range (size:" + itos(this->_size_byte) + ", pos:" + itos(bit_number) + ")" ); + ERR_PRINT("[BitSet::clear_bit] Out of range (size:" + itos(this->_size_byte) + ", pos:" + itos(bit_number) + ")" ); throw "Out of range"; } uint32_t mask = bit_number & (BITSET_SIZE - 1); @@ -134,7 +134,7 @@ void BitSet::write(uint32_t bit_number, bool value) { if (bit_number >= this->_num_bits) { - ERR_PRINTS("[BitSet::put] Out of range (size:" + itos(this->_size_byte) + ", pos:" + itos(bit_number) + ")" ); + ERR_PRINT("[BitSet::put] Out of range (size:" + itos(this->_size_byte) + ", pos:" + itos(bit_number) + ")" ); throw "Out of range"; } if ( value == true ) @@ -147,7 +147,7 @@ bool BitSet::read(uint32_t bit_number) { if (bit_number >= this->_num_bits) { - ERR_PRINTS("[BitSet::pull] Out of range (size:" + itos(this->_size_byte) + ", pos:" + itos(bit_number) + ")" ); + ERR_PRINT("[BitSet::pull] Out of range (size:" + itos(this->_size_byte) + ", pos:" + itos(bit_number) + ")" ); throw "Out of range"; } uint32_t mask = bit_number & (BITSET_SIZE - 1); @@ -179,7 +179,7 @@ void BitSet::read_serial(Ref msgin) this->_data[i] = msgin->get_uint32(); break; default: - ERR_PRINTS("[BitSet::read_serial] Unknown version: " + itos(current_version)); + ERR_PRINT("[BitSet::read_serial] Unknown version: " + itos(current_version)); throw "Unknown version"; break; } diff --git a/modules/networkconnection/network_data.cpp b/modules/networkconnection/network_data.cpp index 405068e..2d0550a 100644 --- a/modules/networkconnection/network_data.cpp +++ b/modules/networkconnection/network_data.cpp @@ -47,6 +47,19 @@ void NetworkData::initialize() this->_server_sync = 0; this->_client_sync = 0; + + this->_current_send_number = 0; +} + +void NetworkData::reset_last_ack() +{ + int i; + for(i=0;i<1;++i) + this->_last_ack_0[i] = 0xffffffff; + for(i=0;i<2;++i) + this->_last_ack_1[i] = 0xffffffff; + for(i=0;i<4;++i) + this->_last_ack_2[i] = 0xffffffff; } void NetworkData::define_lang(String lang) diff --git a/modules/networkconnection/network_data.h b/modules/networkconnection/network_data.h index eb3205f..ead602d 100644 --- a/modules/networkconnection/network_data.h +++ b/modules/networkconnection/network_data.h @@ -27,7 +27,7 @@ #include "core/ustring.h" //define MAX_LOOP_READ_BY_STEP 10 -#define NUM_BITS_IN_LONG_ACK 512 +#define NUM_BITS_IN_LONG_ACK 1024 class NetworkData { @@ -42,6 +42,8 @@ public: uint32_t _current_received_number; uint32_t _last_received_number; + uint32_t _current_send_number; + uint32_t _ms_per_tick; uint32_t _current_client_time; uint32_t _update_time; @@ -49,6 +51,8 @@ public: int32_t _last_ack_bit; uint32_t _last_ack_in_long_ack; + uint32_t _last_received_ack; + int32_t _client_sync; int32_t _server_sync; @@ -61,10 +65,15 @@ public: Array _latest_probes; Array _checksum_msg_xml; + uint32_t _last_ack_0[1]; + uint32_t _last_ack_1[2]; + uint32_t _last_ack_2[4]; + NetworkData(); ~NetworkData(); void initialize(); + void reset_last_ack(); void define_lang(String lang); void define_user(String user_addr, String user_key, String user_id); void define_checksum_msg_xml(Array & checksum_msg_xml); diff --git a/modules/networkconnection/state_connexion.cpp b/modules/networkconnection/state_connexion.cpp index fd06e51..c4cd3fc 100644 --- a/modules/networkconnection/state_connexion.cpp +++ b/modules/networkconnection/state_connexion.cpp @@ -35,6 +35,8 @@ inline uint32_t diff_uint32_circulate(uint32_t a, uint32_t b) // Group 1 : < 0...1073741824 > + < 3221225472 ... 4294967295 > => number value : 2147483648 // Group 2 : < 1073741825 ... 3221225472 > => number value : 2147483648 // + // TODO - check how server manage cyclic uint32 (receivedPacket / receivedAck) + // if not managed, hum if ( a >= 1073741825 && a <= 3221225472 ) return a - b; @@ -45,6 +47,8 @@ inline uint32_t diff_uint32_circulate(uint32_t a, uint32_t b) inline void calculate_ack_bit(NetworkData * _data, bool ackBool) { + // khanat-opennel-code/code/ryzom/client/src/network_connection.cpp # bool CNetworkConnection::decodeHeader(CBitMemStream &msgin, bool checkMessageNumber) + // bool ackBool = (!_SystemMode && (_ConnectionState == Connected || _ConnectionState == Synchronize)); uint32_t i; uint32_t ackBit = (ackBool ? 1 : 0); @@ -62,7 +66,9 @@ inline void calculate_ack_bit(NetworkData * _data, bool ackBool) for(i=_data->_last_received_number+1;i<_data->_current_received_number;++i) _data->_long_ack_bit_field.clear_bit(i & 511); _data->_long_ack_bit_field.write(_data->_current_received_number & 0x1ff, ackBool); - if ( diff_uint32_circulate(_data->_last_ack_in_long_ack, _data->_current_received_number) > 512 ) + + //if ( diff_uint32_circulate(_data->_last_ack_in_long_ack, _data->_current_received_number) <= 512 ) + if ( _data->_last_ack_in_long_ack <= _data->_current_received_number - 512 ) { _data->_last_ack_in_long_ack = _data->_current_received_number - 511; } @@ -197,7 +203,7 @@ void StateConnectionSynchronize::receive_system_sync(Ref msgin) if ( msg_xml.size() != this->_data->_checksum_msg_xml.size() ) { valide = false; - ERR_PRINTS("MSG XML is incorrect (server:" + itos(msg_xml.size()) +", client:" + itos(this->_data->_checksum_msg_xml.size()) + ")"); + ERR_PRINT("MSG XML is incorrect (server:" + itos(msg_xml.size()) +", client:" + itos(this->_data->_checksum_msg_xml.size()) + ")"); } else { @@ -206,7 +212,7 @@ void StateConnectionSynchronize::receive_system_sync(Ref msgin) if ( (int) msg_xml[i] != (int) this->_data->_checksum_msg_xml[i] ) { valide = false; - ERR_PRINTS("MSG XML is incorrect (pos:" + itos(i) +")"); + ERR_PRINT("MSG XML is incorrect (pos:" + itos(i) +")"); } } } @@ -222,7 +228,7 @@ void StateConnectionSynchronize::receive_system_sync(Ref msgin) //this->_state = STATE::Synchronize; } else - ERR_PRINTS("MSG.XML is wrong"); + ERR_PRINT("MSG.XML is wrong"); } void StateConnectionSynchronize::receive_message(int index) @@ -261,7 +267,7 @@ void StateConnectionSynchronize::receive_message(int index) DBG_PRINT("SYSTEM_PROBE_CODE\n"); break; default: - ERR_PRINTS("Received unknown message [" + itos(message) + "]"); + ERR_PRINT("Received unknown message [" + itos(message) + "]"); break; } } @@ -377,7 +383,7 @@ void StateConnectionConnected::receive_system_sync(Ref msgin) if ( msg_xml.size() != this->_data->_checksum_msg_xml.size() ) { valide = false; - ERR_PRINTS("MSG XML is incorrect (server:" + itos(msg_xml.size()) +", client:" + itos(this->_data->_checksum_msg_xml.size()) + ")"); + ERR_PRINT("MSG XML is incorrect (server:" + itos(msg_xml.size()) +", client:" + itos(this->_data->_checksum_msg_xml.size()) + ")"); } else { @@ -386,7 +392,7 @@ void StateConnectionConnected::receive_system_sync(Ref msgin) if ( (int) msg_xml[i] != (int) this->_data->_checksum_msg_xml[i] ) { valide = false; - ERR_PRINTS("MSG XML is incorrect (pos:" + itos(i) +")"); + ERR_PRINT("MSG XML is incorrect (pos:" + itos(i) +")"); } } } @@ -402,7 +408,212 @@ void StateConnectionConnected::receive_system_sync(Ref msgin) //this->_state = STATE::Synchronize; } else - ERR_PRINTS("MSG.XML is wrong"); + ERR_PRINT("MSG.XML is wrong"); +} + +void StateConnectionConnected::unpack(Ref msgin) +{ + bool shortcode = msgin->get_bool(); + uint8_t code; + DBG_PRINT("shortcode:" + itos(shortcode)); + if ( shortcode == true ) + code = msgin->get_serial(2); + else + code = msgin->get_uint8(); + DBG_PRINT("code:" + itos(code)); + switch (code) + { + case ACTIONCODE::ACTION_POSITION_CODE: + { + // khanat-opennel-code/code/ryzom/common/src/game_share/action_position.cpp:34 void CActionPosition::unpack (NLMISC::CBitMemStream &message) + // px ( 16 bit unsigned ) + // py ( 16 bit unsigned ) + // pz ( 16 bit unsigned ) : low bit have other signification + // 0x01 : IsRelative + // 0x02 : Interior + DBG_PRINT("ACTION_GENERIC_CODE"); + uint16_t px = msgin->get_uint16(); + uint16_t py = msgin->get_uint16(); + uint16_t pz = msgin->get_uint16(); + bool IsRelative = (pz & 0x1) != 0; + bool Interior = (pz & 0x2) != 0; + DBG_PRINT("ACTION_GENERIC_CODE px:" + uitos(px) + " py:" + uitos(py) + " pz:" + uitos(pz) + " IsRelative:" + uitos(IsRelative) + " Interior:" + uitos(Interior)); + break; + } + case ACTIONCODE::ACTION_GENERIC_CODE: + { + DBG_PRINT("ACTION_GENERIC_CODE"); + // khanat-opennel-code/code/ryzom/common/src/game_share/action_generic.cpp void CActionGeneric::unpack (NLMISC::CBitMemStream &message) + // size ( 32 bits unsigned ) : if size > 512 we have an error (normally reject by server) + // StreamByte ( Array : size * 8 bits unsigned ) + uint32_t size = msgin->get_uint32(); + DBG_PRINT("ACTION_GENERIC_CODE size:" + uitos(size)); + PoolByteArray StreamByte = msgin->get_array_uint8(size); + DBG_PRINT("ACTION_GENERIC_CODE size:" + uitos(size)); + break; + } + case ACTIONCODE::ACTION_GENERIC_MULTI_PART_CODE: + { + DBG_PRINT("ACTION_GENERIC_MULTI_PART_CODE"); + // khanat-opennel-code/code/ryzom/common/src/game_share/action_generic_multi_part.h:46 virtual void unpack (NLMISC::CBitMemStream &message) + // Number ( 8 bits unsigned ) + // Part ( 16 bits unsigned ) + // NbBlock ( 16 bits unsigned ) + // size ( 32 bits unsigned ) + // PartCont ( Array : size * 8 bits unsigned ) + uint8_t Number = msgin->get_uint8(); + uint16_t Part = msgin->get_uint16(); + uint16_t NbBlock = msgin->get_uint16(); + uint32_t size = msgin->get_uint32(); + PoolByteArray StreamByte = msgin->get_array_uint8(size); + DBG_PRINT("ACTION_GENERIC_MULTI_PART_CODE Number:" + uitos(Number) + " Part:" + uitos(Part) + " NbBlock:" + uitos(NbBlock) + " size:" + uitos(size)); + break; + } + case ACTIONCODE::ACTION_SINT64: + { + DBG_PRINT("ACTION_SINT64"); + // khanat-opennel-code/code/ryzom/common/src/game_share/action_sint64.cpp:86 void CActionSint64::unpack (NLMISC::CBitMemStream &message) + // value ( 64 bits unsigned ) + uint64_t value = msgin->get_uint64(); + DBG_PRINT("ACTION_SINT64 value:" + uitos(value)); + break; + } + case ACTIONCODE::ACTION_SYNC_CODE: + { + DBG_PRINT("ACTION_SYNC_CODE"); + // khanat-opennel-code/code/ryzom/common/src/game_share/action_sync.h:44 virtual void unpack (NLMISC::CBitMemStream &message) + // Sync ( 32 bits unsigned ) + // BKEntityId ( 64 bits unsigned ) [see definition : khanat-opennel-code/code/nel/include/nel/misc/entity_id.h:64] + uint32_t Sync = msgin->get_uint32(); + uint64_t BKEntityId = msgin->get_uint64(); + DBG_PRINT("ACTION_SYNC_CODE Sync:" + uitos(Sync) + " BKEntityId:" + uitos(BKEntityId)); + break; + } + case ACTIONCODE::ACTION_DISCONNECTION_CODE: + { + // khanat-opennel-code/code/ryzom/common/src/game_share/action_disconnection.h + // No data + DBG_PRINT("ACTION_DISCONNECTION_CODE"); + break; + } + case ACTIONCODE::ACTION_ASSOCIATION_CODE: + { + DBG_PRINT("ACTION_ASSOCIATION_CODE"); + // khanat-opennel-code/code/ryzom/common/src/game_share/action_association.h virtual void unpack (NLMISC::CBitMemStream &message) + // IsNewAssociation ( bool / 1 bit ) + // if IsNewAssociation is true: + // SheetId ( 32 bits unsigned ) + // Replace ( bool / 1 bit ) + uint32_t SheetId = msgin->get_uint32(); + bool Replace = msgin->get_bool(); + DBG_PRINT("ACTION_ASSOCIATION_CODE SheetId:" + uitos(SheetId) + " Replace:" + uitos(Replace)); + break; + } + case ACTIONCODE::ACTION_LOGIN_CODE: + { + DBG_PRINT("ACTION_LOGIN_CODE"); + // khanat-opennel-code/code/ryzom/common/src/game_share/action_login.h virtual void unpack (NLMISC::CBitMemStream &message) + // ua ( 32 bits unsigned ) + // uk ( 32 bits unsigned ) + // ui ( 32 bits unsigned ) + uint32_t ua = msgin->get_uint32(); + uint32_t uk = msgin->get_uint32(); + uint32_t ui = msgin->get_uint32(); + DBG_PRINT("ACTION_LOGIN_CODE ua:" + uitos(ua) + " uk:" + uitos(uk)+ " ui:" + uitos(ui)); + break; + } + case ACTIONCODE::ACTION_TARGET_SLOT_CODE: + { + DBG_PRINT("ACTION_TARGET_SLOT_CODE"); + // khanat-opennel-code/code/ryzom/common/src/game_share/action_target_slot.h virtual void unpack (NLMISC::CBitMemStream &message) + // Slot ( 8 bits unsigned ) + // TargetOrPickup (2 bits unsigned) + uint8_t Slot = msgin->get_uint8(); + uint32_t TargetOrPickup = msgin->get_serial(2); + DBG_PRINT("ACTION_TARGET_SLOT_CODE Slot:" + uitos(Slot) + " TargetOrPickup:" + uitos(TargetOrPickup)); + break; + } + case ACTIONCODE::ACTION_DUMMY_CODE: + { + DBG_PRINT("ACTION_DUMMY_CODE"); + // khanat-opennel-code/code/ryzom/common/src/game_share/action_dummy.h virtual void unpack (NLMISC::CBitMemStream &message) + // Dummy1 ( 32 bits unsigned ) + // Dummy2 ( 32 bits unsigned ) + uint32_t Dummy1 = msgin->get_uint32(); + uint32_t Dummy2 = msgin->get_uint32(); + DBG_PRINT("ACTION_DUMMY_CODE Dummy1:" + uitos(Dummy1) + " Dummy2:" + uitos(Dummy2)); + break; + } + default: + { + ERR_PRINT("Impossible to decode message received from server (code:" + uitos(code) + ")"); + break; + } + } +} + +void StateConnectionConnected::decode(Ref msgin, uint32_t current_received_number, uint32_t received_ack, uint32_t next_sent_packet) +{ + // khanat-opennel-code/code/ryzom/client/src/impulse_decoder.cpp:38 void CImpulseDecoder::decode(CBitMemStream &inbox, TPacketNumber receivedPacket, TPacketNumber receivedAck, TPacketNumber nextSentPacket, vector &actions) + int keep; + bool check_once; + bool next; + uint32_t * last_ack; + int level; + int channel; + int num; + this->_data->_last_received_ack = msgin->get_uint32(); + for( level=0 ; level < 3 ; ++level ) + { + DBG_PRINT("level:" + itos(level)); + switch(level) + { + case 0: + last_ack = this->_data->_last_ack_0; + channel = 0; + break; + case 1: + last_ack = this->_data->_last_ack_1; + channel = current_received_number & 1; + break; + default: // 2 + last_ack = this->_data->_last_ack_2; + channel = current_received_number & 3; + break; + } + DBG_PRINT("channel:" + itos(channel)); + keep = -1; + check_once = false; + num = 0; + next = msgin->get_bool(); + DBG_PRINT("next:" + itos(next)); + while(next == true) + { + if( check_once == false ) + { + check_once = true; + //keep = diff_uint32_circulate(received_ack, last_ack[channel]) >= 0; + keep = received_ack >= last_ack[channel]; + if(keep) + last_ack[channel] = next_sent_packet; + } + num ++; + unpack(msgin); + /* + action = self._CActionFactory.unpack(msgin) + if keep: + logging.getLogger(LOGGER).debug("keep : %s" % str(action)) + actions.append(copy.copy(action)) + elif action: + logging.getLogger(LOGGER).debug("append : %s" % str(action)) + self.removeCAction(copy.copy(action)) + */ + + // read next packet + next = msgin->get_bool(); + DBG_PRINT("next:" + itos(next)); + } + } } void StateConnectionConnected::receive_message(int index) @@ -457,7 +668,8 @@ void StateConnectionConnected::receive_message(int index) } else { - DBG_PRINT("Receive application message (" + itos(current_received_number) + ") [" + uitos(this->_network->_queue.length()) + "]"); + DBG_PRINT("Receive application message (current_received_number:" + itos(current_received_number) + ") [queue length:" + uitos(this->_network->_queue.length()) + "]"); + decode(msgin, current_received_number, this->_data->_last_received_ack, this->_data->_current_send_number); } calculate_ack_bit(this->_data, system_mode); diff --git a/modules/networkconnection/state_connexion.h b/modules/networkconnection/state_connexion.h index 5b72cb6..471f136 100644 --- a/modules/networkconnection/state_connexion.h +++ b/modules/networkconnection/state_connexion.h @@ -28,7 +28,7 @@ #include "network_data.h" #define MAX_SIZE_BIT_STREAM_QUEUE 10 -#define NUM_BITS_IN_LONG_ACK 512 +//define NUM_BITS_IN_LONG_ACK 512 enum STATE { NotInitialised = 0, @@ -58,6 +58,20 @@ enum CLFECOMMON { NUMBITSINLONGACK = 512 }; +enum ACTIONCODE { + ACTION_POSITION_CODE = 0, + ACTION_GENERIC_CODE = 1, + ACTION_GENERIC_MULTI_PART_CODE = 2, + ACTION_SINT64 = 3, + ACTION_SYNC_CODE = 10, + ACTION_DISCONNECTION_CODE = 11, + ACTION_ASSOCIATION_CODE = 12, + ACTION_LOGIN_CODE = 13, + ACTION_TARGET_SLOT_CODE = 40, + ACTION_DUMMY_CODE = 99, + ACTION_NONE = 999 +}; + class NetworkConnectionCore; @@ -128,7 +142,9 @@ public: void send_system_disconnect(); void send_system_ack_sync(); void send_system_ack_probe(); + void unpack(Ref msgin); void receive_system_sync(Ref msgin); + void decode(Ref msgin, uint32_t current_received_number, uint32_t received_ack, uint32_t next_sent_packet); void receive_message(int index); void send_message(); }; diff --git a/modules/referentialmessage/referentialmessagecore.cpp b/modules/referentialmessage/referentialmessagecore.cpp index 9ea3e95..eb6ead1 100644 --- a/modules/referentialmessage/referentialmessagecore.cpp +++ b/modules/referentialmessage/referentialmessagecore.cpp @@ -30,6 +30,685 @@ ReferentialMessageCore *ReferentialMessageCore::singleton = nullptr; * ElementReferential */ +String get_command_name(uint32_t id) +{ + switch (id) + { + case ReferentialMessageCore::Command::TARGET_PARTY: + return "TARGET_PARTY"; + case ReferentialMessageCore::Command::TARGET_INVENTORY: + return "TARGET_INVENTORY"; + case ReferentialMessageCore::Command::TARGET_FOLLOW: + return "TARGET_FOLLOW"; + case ReferentialMessageCore::Command::TARGET_NO_FOLLOW: + return "TARGET_NO_FOLLOW"; + case ReferentialMessageCore::Command::CONNECTION_USER_CHAR: + return "CONNECTION_USER_CHAR"; + case ReferentialMessageCore::Command::CONNECTION_NO_USER_CHAR: + return "CONNECTION_NO_USER_CHAR"; + case ReferentialMessageCore::Command::CONNECTION_USER_CHARS: + return "CONNECTION_USER_CHARS"; + case ReferentialMessageCore::Command::CONNECTION_CREATE_CHAR: + return "CONNECTION_CREATE_CHAR"; + case ReferentialMessageCore::Command::CONNECTION_SELECT_CHAR: + return "CONNECTION_SELECT_CHAR"; + case ReferentialMessageCore::Command::CONNECTION_DELETE_CHAR: + return "CONNECTION_DELETE_CHAR"; + case ReferentialMessageCore::Command::CONNECTION_RENAME_CHAR: + return "CONNECTION_RENAME_CHAR"; + case ReferentialMessageCore::Command::CONNECTION_ENTER: + return "CONNECTION_ENTER"; + case ReferentialMessageCore::Command::CONNECTION_READY: + return "CONNECTION_READY"; + case ReferentialMessageCore::Command::CONNECTION_TIME_DATE_SYNCHRO: + return "CONNECTION_TIME_DATE_SYNCHRO"; + case ReferentialMessageCore::Command::CONNECTION_ASK_NAME: + return "CONNECTION_ASK_NAME"; + case ReferentialMessageCore::Command::CONNECTION_VALID_NAME: + return "CONNECTION_VALID_NAME"; + case ReferentialMessageCore::Command::CONNECTION_CREATE_CHAR_ERROR: + return "CONNECTION_CREATE_CHAR_ERROR"; + case ReferentialMessageCore::Command::CONNECTION_RECONNECT: + return "CONNECTION_RECONNECT"; + case ReferentialMessageCore::Command::CONNECTION_SERVER_RECONNECT_OK: + return "CONNECTION_SERVER_RECONNECT_OK"; + case ReferentialMessageCore::Command::CONNECTION_SHARD_ID: + return "CONNECTION_SHARD_ID"; + case ReferentialMessageCore::Command::CONNECTION_SERVER_QUIT_OK: + return "CONNECTION_SERVER_QUIT_OK"; + case ReferentialMessageCore::Command::CONNECTION_SERVER_QUIT_ABORT: + return "CONNECTION_SERVER_QUIT_ABORT"; + case ReferentialMessageCore::Command::CONNECTION_CLIENT_QUIT_REQUEST: + return "CONNECTION_CLIENT_QUIT_REQUEST"; + case ReferentialMessageCore::Command::CONNECTION_MAIL_AVAILABLE: + return "CONNECTION_MAIL_AVAILABLE"; + case ReferentialMessageCore::Command::CONNECTION_GUILD_MESSAGE_AVAILABLE: + return "CONNECTION_GUILD_MESSAGE_AVAILABLE"; + case ReferentialMessageCore::Command::CONNECTION_PERMANENT_BAN: + return "CONNECTION_PERMANENT_BAN"; + case ReferentialMessageCore::Command::CONNECTION_UNBAN: + return "CONNECTION_UNBAN"; + case ReferentialMessageCore::Command::CONNECTION_FAR_TP: + return "CONNECTION_FAR_TP"; + case ReferentialMessageCore::Command::CONNECTION_RET_MAINLAND: + return "CONNECTION_RET_MAINLAND"; + case ReferentialMessageCore::Command::DB_UPD_PLR: + return "DB_UPD_PLR"; + case ReferentialMessageCore::Command::DB_UPD_INV: + return "DB_UPD_INV"; + case ReferentialMessageCore::Command::DB_INIT_PLR: + return "DB_INIT_PLR"; + case ReferentialMessageCore::Command::DB_INIT_INV: + return "DB_INIT_INV"; + case ReferentialMessageCore::Command::DB_GROUP_UPDATE_BANK: + return "DB_GROUP_UPDATE_BANK"; + case ReferentialMessageCore::Command::DB_GROUP_INIT_BANK: + return "DB_GROUP_INIT_BANK"; + case ReferentialMessageCore::Command::DB_GROUP_RESET_BANK: + return "DB_GROUP_RESET_BANK"; + case ReferentialMessageCore::Command::POSITION: + return "POSITION"; + case ReferentialMessageCore::Command::HARVEST_DEPOSIT: + return "HARVEST_DEPOSIT"; + case ReferentialMessageCore::Command::HARVEST_CORPSE: + return "HARVEST_CORPSE"; + case ReferentialMessageCore::Command::HARVEST_INTERRUPT: + return "HARVEST_INTERRUPT"; + case ReferentialMessageCore::Command::HARVEST_CLOSE_TEMP_INVENTORY: + return "HARVEST_CLOSE_TEMP_INVENTORY"; + case ReferentialMessageCore::Command::TRAINING: + return "TRAINING"; + case ReferentialMessageCore::Command::JOB_SET_JOB_STATUS: + return "JOB_SET_JOB_STATUS"; + case ReferentialMessageCore::Command::JOB_SWAP_JOB_STATUS: + return "JOB_SWAP_JOB_STATUS"; + case ReferentialMessageCore::Command::CASTING_BEGIN: + return "CASTING_BEGIN"; + case ReferentialMessageCore::Command::CASTING_INTERRUPT: + return "CASTING_INTERRUPT"; + case ReferentialMessageCore::Command::FABER_OPEN: + return "FABER_OPEN"; + case ReferentialMessageCore::Command::FABER_CLOSE: + return "FABER_CLOSE"; + case ReferentialMessageCore::Command::FABER_EXECUTE: + return "FABER_EXECUTE"; + case ReferentialMessageCore::Command::FABER_SET_NUM_ITEM: + return "FABER_SET_NUM_ITEM"; + case ReferentialMessageCore::Command::FABER_START_CREATE: + return "FABER_START_CREATE"; + case ReferentialMessageCore::Command::FABER_START_REPAIR: + return "FABER_START_REPAIR"; + case ReferentialMessageCore::Command::FABER_START_REFINE: + return "FABER_START_REFINE"; + case ReferentialMessageCore::Command::FABER_SET_MP_QUALITY: + return "FABER_SET_MP_QUALITY"; + case ReferentialMessageCore::Command::FABER_SET_MP_REFINE: + return "FABER_SET_MP_REFINE"; + case ReferentialMessageCore::Command::FABER_SET_TOOL: + return "FABER_SET_TOOL"; + case ReferentialMessageCore::Command::FABER_RESET_TOOL: + return "FABER_RESET_TOOL"; + case ReferentialMessageCore::Command::FABER_INTERRUPT: + return "FABER_INTERRUPT"; + case ReferentialMessageCore::Command::COMBAT_ENGAGE: + return "COMBAT_ENGAGE"; + case ReferentialMessageCore::Command::COMBAT_DISENGAGE: + return "COMBAT_DISENGAGE"; + case ReferentialMessageCore::Command::COMBAT_DEFAULT_ATTACK: + return "COMBAT_DEFAULT_ATTACK"; + case ReferentialMessageCore::Command::COMBAT_ENGAGE_FAILED: + return "COMBAT_ENGAGE_FAILED"; + case ReferentialMessageCore::Command::COMBAT_VALIDATE_MELEE: + return "COMBAT_VALIDATE_MELEE"; + case ReferentialMessageCore::Command::COMBAT_PARRY: + return "COMBAT_PARRY"; + case ReferentialMessageCore::Command::COMBAT_DODGE: + return "COMBAT_DODGE"; + case ReferentialMessageCore::Command::COMBAT_PROTECTED_SLOT: + return "COMBAT_PROTECTED_SLOT"; + case ReferentialMessageCore::Command::COMBAT_FLYING_ChaScore1_DELTA: + return "COMBAT_FLYING_ChaScore1_DELTA"; + case ReferentialMessageCore::Command::COMBAT_FLYING_TEXT_ISE: + return "COMBAT_FLYING_TEXT_ISE"; + case ReferentialMessageCore::Command::COMBAT_FLYING_TEXT: + return "COMBAT_FLYING_TEXT"; + case ReferentialMessageCore::Command::STRING_TELL: + return "STRING_TELL"; + case ReferentialMessageCore::Command::STRING_FAR_TELL: + return "STRING_FAR_TELL"; + case ReferentialMessageCore::Command::STRING_CHAT: + return "STRING_CHAT"; + case ReferentialMessageCore::Command::STRING_CHAT_TEAM: + return "STRING_CHAT_TEAM"; + case ReferentialMessageCore::Command::STRING_ADD_DYN_STR: + return "STRING_ADD_DYN_STR"; + case ReferentialMessageCore::Command::STRING_FILTER: + return "STRING_FILTER"; + case ReferentialMessageCore::Command::STRING_CHAT_MODE: + return "STRING_CHAT_MODE"; + case ReferentialMessageCore::Command::STRING_CHAT2: + return "STRING_CHAT2"; + case ReferentialMessageCore::Command::STRING_TELL2: + return "STRING_TELL2"; + case ReferentialMessageCore::Command::STRING_DYN_STRING: + return "STRING_DYN_STRING"; + case ReferentialMessageCore::Command::STRING_DYN_STRING_GROUP: + return "STRING_DYN_STRING_GROUP"; + case ReferentialMessageCore::Command::STRING_AFK_TXT: + return "STRING_AFK_TXT"; + case ReferentialMessageCore::Command::STUN_STUN: + return "STUN_STUN"; + case ReferentialMessageCore::Command::STUN_WAKE_UP: + return "STUN_WAKE_UP"; + case ReferentialMessageCore::Command::SENTENCE_EXECUTE: + return "SENTENCE_EXECUTE"; + case ReferentialMessageCore::Command::SENTENCE_CANCEL: + return "SENTENCE_CANCEL"; + case ReferentialMessageCore::Command::SENTENCE_CANCEL_CURRENT: + return "SENTENCE_CANCEL_CURRENT"; + case ReferentialMessageCore::Command::SENTENCE_CANCEL_ALL: + return "SENTENCE_CANCEL_ALL"; + case ReferentialMessageCore::Command::SENTENCE_CLEAR: + return "SENTENCE_CLEAR"; + case ReferentialMessageCore::Command::SENTENCE_MEMORIZE: + return "SENTENCE_MEMORIZE"; + case ReferentialMessageCore::Command::SENTENCE_FORGET: + return "SENTENCE_FORGET"; + case ReferentialMessageCore::Command::SENTENCE_EVALUATE: + return "SENTENCE_EVALUATE"; + case ReferentialMessageCore::Command::SENTENCE_ADD_BRICK: + return "SENTENCE_ADD_BRICK"; + case ReferentialMessageCore::Command::SENTENCE_REMOVE_BRICK: + return "SENTENCE_REMOVE_BRICK"; + case ReferentialMessageCore::Command::SENTENCE_START: + return "SENTENCE_START"; + case ReferentialMessageCore::Command::SENTENCE_STOP: + return "SENTENCE_STOP"; + case ReferentialMessageCore::Command::TEAM_JOIN: + return "TEAM_JOIN"; + case ReferentialMessageCore::Command::TEAM_LEAVE: + return "TEAM_LEAVE"; + case ReferentialMessageCore::Command::TEAM_INVITATION: + return "TEAM_INVITATION"; + case ReferentialMessageCore::Command::TEAM_JOIN_PROPOSAL: + return "TEAM_JOIN_PROPOSAL"; + case ReferentialMessageCore::Command::TEAM_JOIN_PROPOSAL_DECLINE: + return "TEAM_JOIN_PROPOSAL_DECLINE"; + case ReferentialMessageCore::Command::TEAM_KICK: + return "TEAM_KICK"; + case ReferentialMessageCore::Command::TEAM_SET_SUCCESSOR: + return "TEAM_SET_SUCCESSOR"; + case ReferentialMessageCore::Command::TEAM_SHARE_OPEN: + return "TEAM_SHARE_OPEN"; + case ReferentialMessageCore::Command::TEAM_SHARE_VALID_ITEM: + return "TEAM_SHARE_VALID_ITEM"; + case ReferentialMessageCore::Command::TEAM_SHARE_INVALID_ITEM: + return "TEAM_SHARE_INVALID_ITEM"; + case ReferentialMessageCore::Command::TEAM_SHARE_VALID: + return "TEAM_SHARE_VALID"; + case ReferentialMessageCore::Command::TEAM_SHARE_INVALID: + return "TEAM_SHARE_INVALID"; + case ReferentialMessageCore::Command::TEAM_SHARE_CLOSE: + return "TEAM_SHARE_CLOSE"; + case ReferentialMessageCore::Command::TEAM_CONTACT_INIT: + return "TEAM_CONTACT_INIT"; + case ReferentialMessageCore::Command::TEAM_CONTACT_ADD: + return "TEAM_CONTACT_ADD"; + case ReferentialMessageCore::Command::TEAM_CONTACT_DEL: + return "TEAM_CONTACT_DEL"; + case ReferentialMessageCore::Command::TEAM_CONTACT_MOVE: + return "TEAM_CONTACT_MOVE"; + case ReferentialMessageCore::Command::TEAM_CONTACT_CREATE: + return "TEAM_CONTACT_CREATE"; + case ReferentialMessageCore::Command::TEAM_CONTACT_STATUS: + return "TEAM_CONTACT_STATUS"; + case ReferentialMessageCore::Command::TEAM_CONTACT_REMOVE: + return "TEAM_CONTACT_REMOVE"; + case ReferentialMessageCore::Command::ITEM_DROP: + return "ITEM_DROP"; + case ReferentialMessageCore::Command::ITEM_PICK_UP: + return "ITEM_PICK_UP"; + case ReferentialMessageCore::Command::ITEM_PICK_UP_CLOSE: + return "ITEM_PICK_UP_CLOSE"; + case ReferentialMessageCore::Command::ITEM_SWAP: + return "ITEM_SWAP"; + case ReferentialMessageCore::Command::ITEM_ACTIVATE_SHEATH: + return "ITEM_ACTIVATE_SHEATH"; + case ReferentialMessageCore::Command::ITEM_HARVEST: + return "ITEM_HARVEST"; + case ReferentialMessageCore::Command::ITEM_HARVEST_CLOSE: + return "ITEM_HARVEST_CLOSE"; + case ReferentialMessageCore::Command::ITEM_GIVE: + return "ITEM_GIVE"; + case ReferentialMessageCore::Command::ITEM_DESTROY: + return "ITEM_DESTROY"; + case ReferentialMessageCore::Command::ITEM_EQUIP: + return "ITEM_EQUIP"; + case ReferentialMessageCore::Command::ITEM_UNEQUIP: + return "ITEM_UNEQUIP"; + case ReferentialMessageCore::Command::ITEM_TEMP_TO_BAG: + return "ITEM_TEMP_TO_BAG"; + case ReferentialMessageCore::Command::ITEM_ALL_TEMP: + return "ITEM_ALL_TEMP"; + case ReferentialMessageCore::Command::ITEM_NO_TEMP: + return "ITEM_NO_TEMP"; + case ReferentialMessageCore::Command::ITEM_ENCHANT: + return "ITEM_ENCHANT"; + case ReferentialMessageCore::Command::ITEM_OPEN_ROOM_INVENTORY: + return "ITEM_OPEN_ROOM_INVENTORY"; + case ReferentialMessageCore::Command::ITEM_CLOSE_ROOM_INVENTORY: + return "ITEM_CLOSE_ROOM_INVENTORY"; + case ReferentialMessageCore::Command::ITEM_USE_ITEM: + return "ITEM_USE_ITEM"; + case ReferentialMessageCore::Command::ITEM_STOP_USE_XP_CAT: + return "ITEM_STOP_USE_XP_CAT"; + case ReferentialMessageCore::Command::TP_RESPAWN: + return "TP_RESPAWN"; + case ReferentialMessageCore::Command::TP_BOT: + return "TP_BOT"; + case ReferentialMessageCore::Command::TP_WANTED: + return "TP_WANTED"; + case ReferentialMessageCore::Command::TP_DEST: + return "TP_DEST"; + case ReferentialMessageCore::Command::TP_DEST_WITH_SEASON: + return "TP_DEST_WITH_SEASON"; + case ReferentialMessageCore::Command::TP_ACK: + return "TP_ACK"; + case ReferentialMessageCore::Command::TP_CORRECT: + return "TP_CORRECT"; + case ReferentialMessageCore::Command::DEATH_RESPAWN_POINT: + return "DEATH_RESPAWN_POINT"; + case ReferentialMessageCore::Command::DEATH_ASK_RESPAWN: + return "DEATH_ASK_RESPAWN"; + case ReferentialMessageCore::Command::DEATH_RESPAWN: + return "DEATH_RESPAWN"; + case ReferentialMessageCore::Command::ANIMALS_BEAST: + return "ANIMALS_BEAST"; + case ReferentialMessageCore::Command::ANIMALS_MOUNT_ABORT: + return "ANIMALS_MOUNT_ABORT"; + case ReferentialMessageCore::Command::EXCHANGE_INVITATION: + return "EXCHANGE_INVITATION"; + case ReferentialMessageCore::Command::EXCHANGE_CLOSE_INVITATION: + return "EXCHANGE_CLOSE_INVITATION"; + case ReferentialMessageCore::Command::EXCHANGE_PROPOSAL: + return "EXCHANGE_PROPOSAL"; + case ReferentialMessageCore::Command::EXCHANGE_ACCEPT_INVITATION: + return "EXCHANGE_ACCEPT_INVITATION"; + case ReferentialMessageCore::Command::EXCHANGE_DECLINE_INVITATION: + return "EXCHANGE_DECLINE_INVITATION"; + case ReferentialMessageCore::Command::EXCHANGE_VALIDATE: + return "EXCHANGE_VALIDATE"; + case ReferentialMessageCore::Command::EXCHANGE_INVALIDATE: + return "EXCHANGE_INVALIDATE"; + case ReferentialMessageCore::Command::EXCHANGE_END: + return "EXCHANGE_END"; + case ReferentialMessageCore::Command::EXCHANGE_SEEDS: + return "EXCHANGE_SEEDS"; + case ReferentialMessageCore::Command::EXCHANGE_ADD: + return "EXCHANGE_ADD"; + case ReferentialMessageCore::Command::EXCHANGE_REMOVE: + return "EXCHANGE_REMOVE"; + case ReferentialMessageCore::Command::DEBUG_WHERE: + return "DEBUG_WHERE"; + case ReferentialMessageCore::Command::DEBUG_WHO: + return "DEBUG_WHO"; + case ReferentialMessageCore::Command::DEBUG_REPLY_WHERE: + return "DEBUG_REPLY_WHERE"; + case ReferentialMessageCore::Command::DEBUG_SERVICES: + return "DEBUG_SERVICES"; + case ReferentialMessageCore::Command::DEBUG_CMD: + return "DEBUG_CMD"; + case ReferentialMessageCore::Command::DEBUG_PING: + return "DEBUG_PING"; + case ReferentialMessageCore::Command::DEBUG_COUNTER: + return "DEBUG_COUNTER"; + case ReferentialMessageCore::Command::COMMAND_EMOTE: + return "COMMAND_EMOTE"; + case ReferentialMessageCore::Command::COMMAND_CUSTOM_EMOTE: + return "COMMAND_CUSTOM_EMOTE"; + case ReferentialMessageCore::Command::COMMAND_WHERE: + return "COMMAND_WHERE"; + case ReferentialMessageCore::Command::COMMAND_ADMIN: + return "COMMAND_ADMIN"; + case ReferentialMessageCore::Command::COMMAND_ADMIN_OFFLINE: + return "COMMAND_ADMIN_OFFLINE"; + case ReferentialMessageCore::Command::COMMAND_REMOTE_ADMIN: + return "COMMAND_REMOTE_ADMIN"; + case ReferentialMessageCore::Command::COMMAND_REMOTE_ADMIN_ANSWER: + return "COMMAND_REMOTE_ADMIN_ANSWER"; + case ReferentialMessageCore::Command::COMMAND_SIT: + return "COMMAND_SIT"; + case ReferentialMessageCore::Command::COMMAND_AFK: + return "COMMAND_AFK"; + case ReferentialMessageCore::Command::COMMAND_RANDOM: + return "COMMAND_RANDOM"; + case ReferentialMessageCore::Command::COMMAND_GUILDMOTD: + return "COMMAND_GUILDMOTD"; + case ReferentialMessageCore::Command::MP_EVAL_SET_MP: + return "MP_EVAL_SET_MP"; + case ReferentialMessageCore::Command::MP_EVAL_SET_MP_LEVEL: + return "MP_EVAL_SET_MP_LEVEL"; + case ReferentialMessageCore::Command::MP_EVAL_SET_MARKET: + return "MP_EVAL_SET_MARKET"; + case ReferentialMessageCore::Command::MP_EVAL_EXECUTE: + return "MP_EVAL_EXECUTE"; + case ReferentialMessageCore::Command::BOTCHAT_NEXT_PAGE_ITEM: + return "BOTCHAT_NEXT_PAGE_ITEM"; + case ReferentialMessageCore::Command::BOTCHAT_NEXT_PAGE_MISSION: + return "BOTCHAT_NEXT_PAGE_MISSION"; + case ReferentialMessageCore::Command::BOTCHAT_START_TRADE_ITEM: + return "BOTCHAT_START_TRADE_ITEM"; + case ReferentialMessageCore::Command::BOTCHAT_START_TRADE_TELEPORT: + return "BOTCHAT_START_TRADE_TELEPORT"; + case ReferentialMessageCore::Command::BOTCHAT_START_TRADE_FACTION: + return "BOTCHAT_START_TRADE_FACTION"; + case ReferentialMessageCore::Command::BOTCHAT_START_TRADE_SKILL: + return "BOTCHAT_START_TRADE_SKILL"; + case ReferentialMessageCore::Command::BOTCHAT_START_TRADE_PACT: + return "BOTCHAT_START_TRADE_PACT"; + case ReferentialMessageCore::Command::BOTCHAT_START_TRADE_ACTION: + return "BOTCHAT_START_TRADE_ACTION"; + case ReferentialMessageCore::Command::BOTCHAT_BUY: + return "BOTCHAT_BUY"; + case ReferentialMessageCore::Command::BOTCHAT_SELL: + return "BOTCHAT_SELL"; + case ReferentialMessageCore::Command::BOTCHAT_DESTROY_ITEM: + return "BOTCHAT_DESTROY_ITEM"; + case ReferentialMessageCore::Command::BOTCHAT_REFRESH_TRADE_LIST: + return "BOTCHAT_REFRESH_TRADE_LIST"; + case ReferentialMessageCore::Command::BOTCHAT_SET_FILTERS: + return "BOTCHAT_SET_FILTERS"; + case ReferentialMessageCore::Command::BOTCHAT_START_CHOOSE_MISSION: + return "BOTCHAT_START_CHOOSE_MISSION"; + case ReferentialMessageCore::Command::BOTCHAT_START_DYNAMIC_MISSION: + return "BOTCHAT_START_DYNAMIC_MISSION"; + case ReferentialMessageCore::Command::BOTCHAT_CONTINUE_MISSION: + return "BOTCHAT_CONTINUE_MISSION"; + case ReferentialMessageCore::Command::BOTCHAT_VALIDATE_PLAYER_GIFT: + return "BOTCHAT_VALIDATE_PLAYER_GIFT"; + case ReferentialMessageCore::Command::BOTCHAT_PICK_MISSION: + return "BOTCHAT_PICK_MISSION"; + case ReferentialMessageCore::Command::BOTCHAT_DM_CHOICE: + return "BOTCHAT_DM_CHOICE"; + case ReferentialMessageCore::Command::BOTCHAT_DM_ACCEPT: + return "BOTCHAT_DM_ACCEPT"; + case ReferentialMessageCore::Command::BOTCHAT_START_NEWS: + return "BOTCHAT_START_NEWS"; + case ReferentialMessageCore::Command::BOTCHAT_START_CREATE_GUILD: + return "BOTCHAT_START_CREATE_GUILD"; + case ReferentialMessageCore::Command::BOTCHAT_END: + return "BOTCHAT_END"; + case ReferentialMessageCore::Command::BOTCHAT_FORCE_END: + return "BOTCHAT_FORCE_END"; + case ReferentialMessageCore::Command::BOTCHAT_START_CHOOSE_DUTY: + return "BOTCHAT_START_CHOOSE_DUTY"; + case ReferentialMessageCore::Command::BOTCHAT_NEXT_PAGE_DUTY: + return "BOTCHAT_NEXT_PAGE_DUTY"; + case ReferentialMessageCore::Command::BOTCHAT_DUTY_APPLY: + return "BOTCHAT_DUTY_APPLY"; + case ReferentialMessageCore::Command::BOTCHAT_DUTY_CANCEL_APPLY: + return "BOTCHAT_DUTY_CANCEL_APPLY"; + case ReferentialMessageCore::Command::BOTCHAT_START_TRADE_GUILD_OPTIONS: + return "BOTCHAT_START_TRADE_GUILD_OPTIONS"; + case ReferentialMessageCore::Command::BOTCHAT_BUY_GUILD_OPTION: + return "BOTCHAT_BUY_GUILD_OPTION"; + case ReferentialMessageCore::Command::BOTCHAT_START_GUILD_RESEARCH: + return "BOTCHAT_START_GUILD_RESEARCH"; + case ReferentialMessageCore::Command::BOTCHAT_DESTROY_BUILDING: + return "BOTCHAT_DESTROY_BUILDING"; + case ReferentialMessageCore::Command::BOTCHAT_DYNCHAT_OPEN: + return "BOTCHAT_DYNCHAT_OPEN"; + case ReferentialMessageCore::Command::BOTCHAT_DYNCHAT_CLOSE: + return "BOTCHAT_DYNCHAT_CLOSE"; + case ReferentialMessageCore::Command::BOTCHAT_DYNCHAT_SEND: + return "BOTCHAT_DYNCHAT_SEND"; + case ReferentialMessageCore::Command::JOURNAL_INIT_COMPLETED_MISSIONS: + return "JOURNAL_INIT_COMPLETED_MISSIONS"; + case ReferentialMessageCore::Command::JOURNAL_UPDATE_COMPLETED_MISSIONS: + return "JOURNAL_UPDATE_COMPLETED_MISSIONS"; + case ReferentialMessageCore::Command::JOURNAL_MISSION_ABANDON: + return "JOURNAL_MISSION_ABANDON"; + case ReferentialMessageCore::Command::JOURNAL_GROUP_MISSION_ABANDON: + return "JOURNAL_GROUP_MISSION_ABANDON"; + case ReferentialMessageCore::Command::JOURNAL_ADD_COMPASS: + return "JOURNAL_ADD_COMPASS"; + case ReferentialMessageCore::Command::JOURNAL_ADD_COMPASS_BOT: + return "JOURNAL_ADD_COMPASS_BOT"; + case ReferentialMessageCore::Command::JOURNAL_REMOVE_COMPASS: + return "JOURNAL_REMOVE_COMPASS"; + case ReferentialMessageCore::Command::JOURNAL_REMOVE_COMPASS_BOT: + return "JOURNAL_REMOVE_COMPASS_BOT"; + case ReferentialMessageCore::Command::STRING_MANAGER_SET_LANGUAGE: + return "STRING_MANAGER_SET_LANGUAGE"; + case ReferentialMessageCore::Command::STRING_MANAGER_PHRASE_SEND: + return "STRING_MANAGER_PHRASE_SEND"; + case ReferentialMessageCore::Command::STRING_MANAGER_STRING_RQ: + return "STRING_MANAGER_STRING_RQ"; + case ReferentialMessageCore::Command::STRING_MANAGER_STRING_RESP: + return "STRING_MANAGER_STRING_RESP"; + case ReferentialMessageCore::Command::STRING_MANAGER_RELOAD_CACHE: + return "STRING_MANAGER_RELOAD_CACHE"; + case ReferentialMessageCore::Command::GUILD_CREATE: + return "GUILD_CREATE"; + case ReferentialMessageCore::Command::GUILD_ABORT_CREATION: + return "GUILD_ABORT_CREATION"; + case ReferentialMessageCore::Command::GUILD_OPEN_GUILD_WINDOW: + return "GUILD_OPEN_GUILD_WINDOW"; + case ReferentialMessageCore::Command::GUILD_INVITATION: + return "GUILD_INVITATION"; + case ReferentialMessageCore::Command::GUILD_ACCEPT_INVITATION: + return "GUILD_ACCEPT_INVITATION"; + case ReferentialMessageCore::Command::GUILD_REFUSE_INVITATION: + return "GUILD_REFUSE_INVITATION"; + case ReferentialMessageCore::Command::GUILD_JOIN_PROPOSAL: + return "GUILD_JOIN_PROPOSAL"; + case ReferentialMessageCore::Command::GUILD_SET_GRADE: + return "GUILD_SET_GRADE"; + case ReferentialMessageCore::Command::GUILD_SET_LEADER: + return "GUILD_SET_LEADER"; + case ReferentialMessageCore::Command::GUILD_KICK_MEMBER: + return "GUILD_KICK_MEMBER"; + case ReferentialMessageCore::Command::GUILD_TELEPORT: + return "GUILD_TELEPORT"; + case ReferentialMessageCore::Command::GUILD_ASCENSOR: + return "GUILD_ASCENSOR"; + case ReferentialMessageCore::Command::GUILD_FIRST_ASCENSOR_PAGE: + return "GUILD_FIRST_ASCENSOR_PAGE"; + case ReferentialMessageCore::Command::GUILD_NEXT_ASCENSOR_PAGE: + return "GUILD_NEXT_ASCENSOR_PAGE"; + case ReferentialMessageCore::Command::GUILD_LEAVE_ASCENSOR: + return "GUILD_LEAVE_ASCENSOR"; + case ReferentialMessageCore::Command::GUILD_QUIT: + return "GUILD_QUIT"; + case ReferentialMessageCore::Command::GUILD_SET_PLAYER_TITLE: + return "GUILD_SET_PLAYER_TITLE"; + case ReferentialMessageCore::Command::GUILD_UPDATE_PLAYER_TITLE: + return "GUILD_UPDATE_PLAYER_TITLE"; + case ReferentialMessageCore::Command::GUILD_USE_FEMALE_TITLES: + return "GUILD_USE_FEMALE_TITLES"; + case ReferentialMessageCore::Command::GUILD_PUT_MONEY: + return "GUILD_PUT_MONEY"; + case ReferentialMessageCore::Command::GUILD_TAKE_MONEY: + return "GUILD_TAKE_MONEY"; + case ReferentialMessageCore::Command::GUILD_OPEN_INVENTORY: + return "GUILD_OPEN_INVENTORY"; + case ReferentialMessageCore::Command::GUILD_CLOSE_INVENTORY: + return "GUILD_CLOSE_INVENTORY"; + case ReferentialMessageCore::Command::OUTPOST_GIVEUP_OUTPOST: + return "OUTPOST_GIVEUP_OUTPOST"; + case ReferentialMessageCore::Command::OUTPOST_SELECT: + return "OUTPOST_SELECT"; + case ReferentialMessageCore::Command::OUTPOST_UNSELECT: + return "OUTPOST_UNSELECT"; + case ReferentialMessageCore::Command::OUTPOST_DECLARE_WAR_START: + return "OUTPOST_DECLARE_WAR_START"; + case ReferentialMessageCore::Command::OUTPOST_DECLARE_WAR_ACK: + return "OUTPOST_DECLARE_WAR_ACK"; + case ReferentialMessageCore::Command::OUTPOST_DECLARE_WAR_VALIDATE: + return "OUTPOST_DECLARE_WAR_VALIDATE"; + case ReferentialMessageCore::Command::OUTPOST_SET_DEF_PERIOD: + return "OUTPOST_SET_DEF_PERIOD"; + case ReferentialMessageCore::Command::OUTPOST_SET_SQUAD: + return "OUTPOST_SET_SQUAD"; + case ReferentialMessageCore::Command::OUTPOST_SET_SQUAD_SPAWN: + return "OUTPOST_SET_SQUAD_SPAWN"; + case ReferentialMessageCore::Command::OUTPOST_INSERT_SQUAD: + return "OUTPOST_INSERT_SQUAD"; + case ReferentialMessageCore::Command::OUTPOST_REMOVE_SQUAD: + return "OUTPOST_REMOVE_SQUAD"; + case ReferentialMessageCore::Command::OUTPOST_SET_SQUAD_CAPITAL: + return "OUTPOST_SET_SQUAD_CAPITAL"; + case ReferentialMessageCore::Command::OUTPOST_CHOOSE_SIDE: + return "OUTPOST_CHOOSE_SIDE"; + case ReferentialMessageCore::Command::OUTPOST_SIDE_CHOSEN: + return "OUTPOST_SIDE_CHOSEN"; + case ReferentialMessageCore::Command::OUTPOST_BANISH_PLAYER: + return "OUTPOST_BANISH_PLAYER"; + case ReferentialMessageCore::Command::OUTPOST_BANISH_GUILD: + return "OUTPOST_BANISH_GUILD"; + case ReferentialMessageCore::Command::OUTPOST_BUY_BUILDING: + return "OUTPOST_BUY_BUILDING"; + case ReferentialMessageCore::Command::OUTPOST_DESTROY_BUILDING: + return "OUTPOST_DESTROY_BUILDING"; + case ReferentialMessageCore::Command::PHRASE_DELETE: + return "PHRASE_DELETE"; + case ReferentialMessageCore::Command::PHRASE_LEARN: + return "PHRASE_LEARN"; + case ReferentialMessageCore::Command::PHRASE_MEMORIZE: + return "PHRASE_MEMORIZE"; + case ReferentialMessageCore::Command::PHRASE_FORGET: + return "PHRASE_FORGET"; + case ReferentialMessageCore::Command::PHRASE_EXECUTE: + return "PHRASE_EXECUTE"; + case ReferentialMessageCore::Command::PHRASE_EXECUTE_CYCLIC: + return "PHRASE_EXECUTE_CYCLIC"; + case ReferentialMessageCore::Command::PHRASE_EXECUTE_FABER: + return "PHRASE_EXECUTE_FABER"; + case ReferentialMessageCore::Command::PHRASE_DOWNLOAD: + return "PHRASE_DOWNLOAD"; + case ReferentialMessageCore::Command::PHRASE_BUY: + return "PHRASE_BUY"; + case ReferentialMessageCore::Command::PHRASE_CONFIRM_BUY: + return "PHRASE_CONFIRM_BUY"; + case ReferentialMessageCore::Command::PHRASE_BUY_SHEET: + return "PHRASE_BUY_SHEET"; + case ReferentialMessageCore::Command::PHRASE_CANCEL_LINK: + return "PHRASE_CANCEL_LINK"; + case ReferentialMessageCore::Command::PHRASE_CANCEL_TOP: + return "PHRASE_CANCEL_TOP"; + case ReferentialMessageCore::Command::PHRASE_CANCEL_ALL: + return "PHRASE_CANCEL_ALL"; + case ReferentialMessageCore::Command::PHRASE_CRISTALIZE: + return "PHRASE_CRISTALIZE"; + case ReferentialMessageCore::Command::PHRASE_EXEC_CYCLIC_ACK: + return "PHRASE_EXEC_CYCLIC_ACK"; + case ReferentialMessageCore::Command::PHRASE_EXEC_NEXT_ACK: + return "PHRASE_EXEC_NEXT_ACK"; + case ReferentialMessageCore::Command::ITEM_INFO_GET: + return "ITEM_INFO_GET"; + case ReferentialMessageCore::Command::ITEM_INFO_SET: + return "ITEM_INFO_SET"; + case ReferentialMessageCore::Command::ITEM_INFO_REFRESH_VERSION: + return "ITEM_INFO_REFRESH_VERSION"; + case ReferentialMessageCore::Command::MISSION_PREREQ_GET: + return "MISSION_PREREQ_GET"; + case ReferentialMessageCore::Command::MISSION_PREREQ_SET: + return "MISSION_PREREQ_SET"; + case ReferentialMessageCore::Command::MISSION_ENTER_CRITICAL: + return "MISSION_ENTER_CRITICAL"; + case ReferentialMessageCore::Command::MISSION_ASK_ENTER_CRITICAL: + return "MISSION_ASK_ENTER_CRITICAL"; + case ReferentialMessageCore::Command::MISSION_CLOSE_ENTER_CRITICAL: + return "MISSION_CLOSE_ENTER_CRITICAL"; + case ReferentialMessageCore::Command::MISSION_WAKE: + return "MISSION_WAKE"; + case ReferentialMessageCore::Command::MISSION_GROUP_WAKE: + return "MISSION_GROUP_WAKE"; + case ReferentialMessageCore::Command::DUEL_ASK: + return "DUEL_ASK"; + case ReferentialMessageCore::Command::DUEL_ACCEPT: + return "DUEL_ACCEPT"; + case ReferentialMessageCore::Command::DUEL_REFUSE: + return "DUEL_REFUSE"; + case ReferentialMessageCore::Command::DUEL_ABANDON: + return "DUEL_ABANDON"; + case ReferentialMessageCore::Command::DUEL_INVITATION: + return "DUEL_INVITATION"; + case ReferentialMessageCore::Command::DUEL_CANCEL_INVITATION: + return "DUEL_CANCEL_INVITATION"; + case ReferentialMessageCore::Command::PVP_CHALLENGE_ASK: + return "PVP_CHALLENGE_ASK"; + case ReferentialMessageCore::Command::PVP_CHALLENGE_ACCEPT: + return "PVP_CHALLENGE_ACCEPT"; + case ReferentialMessageCore::Command::PVP_CHALLENGE_REFUSE: + return "PVP_CHALLENGE_REFUSE"; + case ReferentialMessageCore::Command::PVP_CHALLENGE_ABANDON: + return "PVP_CHALLENGE_ABANDON"; + case ReferentialMessageCore::Command::PVP_CHALLENGE_INVITATION: + return "PVP_CHALLENGE_INVITATION"; + case ReferentialMessageCore::Command::PVP_CHALLENGE_CANCEL_INVITATION: + return "PVP_CHALLENGE_CANCEL_INVITATION"; + case ReferentialMessageCore::Command::PVP_PVP_TAG: + return "PVP_PVP_TAG"; + case ReferentialMessageCore::Command::PVP_SET_NEUTRAL_ALLEGIANCE: + return "PVP_SET_NEUTRAL_ALLEGIANCE"; + case ReferentialMessageCore::Command::PVP_SET_NEUTRAL_ALLEGIANCE_GUILD: + return "PVP_SET_NEUTRAL_ALLEGIANCE_GUILD"; + case ReferentialMessageCore::Command::PVP_FACTION_PUSH_FACTION_WAR: + return "PVP_FACTION_PUSH_FACTION_WAR"; + case ReferentialMessageCore::Command::PVP_FACTION_POP_FACTION_WAR: + return "PVP_FACTION_POP_FACTION_WAR"; + case ReferentialMessageCore::Command::PVP_FACTION_FACTION_WARS: + return "PVP_FACTION_FACTION_WARS"; + case ReferentialMessageCore::Command::ENCYCLOPEDIA_UPDATE: + return "ENCYCLOPEDIA_UPDATE"; + case ReferentialMessageCore::Command::ENCYCLOPEDIA_INIT: + return "ENCYCLOPEDIA_INIT"; + case ReferentialMessageCore::Command::USER_BARS: + return "USER_BARS"; + case ReferentialMessageCore::Command::USER_POPUP: + return "USER_POPUP"; + case ReferentialMessageCore::Command::EVENT_SET_ITEM_CUSTOM_TEXT: + return "EVENT_SET_ITEM_CUSTOM_TEXT"; + case ReferentialMessageCore::Command::EVENT_DUMMY: + return "EVENT_DUMMY"; + case ReferentialMessageCore::Command::TOTEM_BUILD: + return "TOTEM_BUILD"; + case ReferentialMessageCore::Command::TOTEM_DUMMY: + return "TOTEM_DUMMY"; + case ReferentialMessageCore::Command::MODULE_GATEWAY_FEOPEN: + return "MODULE_GATEWAY_FEOPEN"; + case ReferentialMessageCore::Command::MODULE_GATEWAY_GATEWAY_MSG: + return "MODULE_GATEWAY_GATEWAY_MSG"; + case ReferentialMessageCore::Command::MODULE_GATEWAY_FECLOSE: + return "MODULE_GATEWAY_FECLOSE"; + case ReferentialMessageCore::Command::SEASON_SET: + return "SEASON_SET"; + case ReferentialMessageCore::Command::SEASON_DUMMY: + return "SEASON_DUMMY"; + case ReferentialMessageCore::Command::DM_GIFT_BEGIN: + return "DM_GIFT_BEGIN"; + case ReferentialMessageCore::Command::DM_GIFT_VALIDATE: + return "DM_GIFT_VALIDATE"; + case ReferentialMessageCore::Command::RING_MISSION_MISSION_RING_SELECT: + return "RING_MISSION_MISSION_RING_SELECT"; + case ReferentialMessageCore::Command::RING_MISSION_DSS_DOWN: + return "RING_MISSION_DSS_DOWN"; + case ReferentialMessageCore::Command::NPC_ICON_GET_DESC: + return "NPC_ICON_GET_DESC"; + case ReferentialMessageCore::Command::NPC_ICON_SET_DESC: + return "NPC_ICON_SET_DESC"; + case ReferentialMessageCore::Command::NPC_ICON_SVR_EVENT_MIS_AVL: + return "NPC_ICON_SVR_EVENT_MIS_AVL"; + case ReferentialMessageCore::Command::NPC_ICON_SET_TIMER: + return "NPC_ICON_SET_TIMER"; + case ReferentialMessageCore::Command::__LAST_ELEMENT: + return "__LAST_ELEMENT"; + default: + return "?"; + } +} + void ElementReferential::show(int level, int pos) { String a; @@ -38,14 +717,14 @@ void ElementReferential::show(int level, int pos) if(_id == ReferentialMessageCore::Command::__LAST_ELEMENT) { //OS::get_singleton()->print("[%s:%d] level:%d %s pos:%3d ------ power:%d\n", __FILE__, __LINE__, level, a.ascii().get_data(), pos, _power2); - DBG_PRINT("level:" + itos(level) + " " + a + " pos:" + itos(pos) + " ------ power:" + itos(_power2)); + DBG_PRINT("level:" + itos(level) + " " + a + " id:" + get_command_name(_id) + " pos:" + itos(pos) + " ------ power:" + itos(_power2)); } else { - DBG_PRINT("level:" + itos(level) + " " + a + " pos:" + itos(pos) + " id:" + itos(_id)); + DBG_PRINT("level:" + itos(level) + " " + a + " pos:" + itos(pos) + " id:" + get_command_name(_id)); } level ++; - for(int i=0;i<_children.size() - 1;++i) + for(int i=0;i<_children.size();++i) { Ref child = _children[i]; child->show(level, i); @@ -1072,7 +1751,7 @@ int ReferentialMessageCore::get_command(String name) } else if( name == "NPC_ICON_SET_TIMER" ) { return Command::NPC_ICON_SET_TIMER; } else { - WARN_PRINTS("Ignore unknown keyword command '" + name + "'"); + WARN_PRINT("Ignore unknown keyword command '" + name + "'"); } return Command::__LAST_ELEMENT; } @@ -1141,15 +1820,17 @@ void ReferentialMessageCore::read_referential(Dictionary dictionary_message) void ReferentialMessageCore::show() { // For fun, list powerOf2 - TODO check is same with server side, and check size is same value for msg.xml + /* { for(int i=0;i<67;++i) DBG_PRINT(itos(i) + "=> powerOf2 = " + itos(getPowerOf2(i))); } + */ // show Element to push data { for(int i = 0; i < Command::__LAST_ELEMENT; ++i) { - DBG_PRINT(itos(i) + ") " + this->_encoder[i].show().ascii().get_data() + "."); + DBG_PRINT(itos(i) + ") " + get_command_name(i) + " " + this->_encoder[i].show().ascii().get_data() + "."); } } // show element to read data diff --git a/modules/referentialmessage/referentialmessagecore.h b/modules/referentialmessage/referentialmessagecore.h index 9daad88..ffa904a 100644 --- a/modules/referentialmessage/referentialmessagecore.h +++ b/modules/referentialmessage/referentialmessagecore.h @@ -24,6 +24,7 @@ #include "core/reference.h" #include "core/dictionary.h" #include "modules/bitstream/bitstream.h" +#include "modules/debug/debug.h" inline uint32_t getPowerOf2(uint32_t v) { @@ -31,7 +32,7 @@ inline uint32_t getPowerOf2(uint32_t v) uint32_t res = 1; uint32_t ret = 0; uint32_t limit = 8*sizeof(uint32_t); - while(res < v && res < limit) + while(res < v && ret < limit) { ret ++; res <<= 1; // res *= 2; @@ -51,7 +52,7 @@ public: ~ElementReferential() {_children.clear();} void set_id(uint32_t id) {_id=id;} - void set_size(uint32_t size) {_children.resize(size); _power2=getPowerOf2(size);} + void set_size(uint32_t size) {_children.resize(size); _power2=getPowerOf2(size);DBG_PRINT("[" + itos(size) + " /" + itos(_power2) + "]");} int get_size() { return _children.size();} Ref add_child(uint32_t id, uint32_t pos) { Ref tmp; tmp.instance(); tmp->_id = id; _children.set(pos, tmp); tmp.unref(); return _children[pos]; } void show(int level=0, int pos=0); @@ -413,7 +414,6 @@ public: void set_pos(uint32_t pos){_pos = pos;} void set_name(String name){_name = name;} void create(uint32_t pos, uint32_t size,String name) {set_pos(pos);set_size(size);set_name(name);} - uint32_t get_size() {return _size;} uint32_t get_pos() {return _pos;} String get_name() {return _name;}