read msg.xml

This commit is contained in:
AleaJactaEst 2019-12-12 17:32:49 +01:00
parent 6619fd3f0f
commit c8d9178937
6 changed files with 1344 additions and 0 deletions

1165
assets/Definition/msg.xml Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,59 @@
extends Node
# Declare member variables here. Examples:
# var a = 2
# var b = "text"
var _msg_xml = XMLParser.new()
var _msg_md5sum
func open_message_xml():
var file = File.new()
file.open("res://assets/Definition/msg.xml", File.READ)
var content = file.get_as_text()
_msg_md5sum = content.md5_text()
file.close()
_msg_xml.open("res://assets/Definition/msg.xml")
print("[msg:open_message_xml] " + _msg_md5sum)
func is_correct_md5(value):
return (_msg_md5sum == value)
func read_all_node():
var i
_msg_xml.seek(0)
var ret = _msg_xml.read()
var branch = ""
var leaf = ""
while ret == OK:
#print("Node: Name:" + _msg_xml.get_node_name() + ", Type:" + str(_msg_xml.get_node_type()) + ", Data:" + str(_msg_xml.get_node_data()) + ", attribut count:" + str(_msg_xml.get_attribute_count()) )
#i = 0
#while i < _msg_xml.get_attribute_count():
# print(" -- Attribut Name:" + _msg_xml.get_attribute_name(i) + " Value:" + _msg_xml.get_attribute_value(i))
# i += 1
match _msg_xml.get_node_name():
"branch":
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():
print(_msg_xml.get_attribute_value(i))
branch = _msg_xml.get_attribute_value(i)
"leaf":
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():
print(branch + ":" + _msg_xml.get_attribute_value(i))
ret = _msg_xml.read()
# Called when the node enters the scene tree for the first time.
func _ready():
open_message_xml()
read_all_node()
# Called every frame. 'delta' is the elapsed time since the previous frame.
#func _process(delta):
# pass

View file

@ -136,6 +136,7 @@ func send_system_ack_probe():
return return
func send_system_quit(): func send_system_quit():
# TODO - check why we send quit_id
var msgout = preload("res://bitstream.gdns").new() var msgout = preload("res://bitstream.gdns").new()
_quit_id += 1 _quit_id += 1
msgout.put_sint32(_current_received_number) msgout.put_sint32(_current_received_number)
@ -183,6 +184,7 @@ func decode_system_message(msgin):
CLFECOMMON.SYSTEM_LOGIN_CODE: CLFECOMMON.SYSTEM_LOGIN_CODE:
pass pass
CLFECOMMON.SYSTEM_SYNC_CODE: CLFECOMMON.SYSTEM_SYNC_CODE:
var hexa = load("res://assets/Scripts/Tools/hexa.gd").new()
var synchronize = msgin.get_uint32() var synchronize = msgin.get_uint32()
var stime = msgin.get_sint64() var stime = msgin.get_sint64()
_latest_sync = msgin.get_uint32() _latest_sync = msgin.get_uint32()
@ -193,10 +195,16 @@ func decode_system_message(msgin):
for item in msg_xml: for item in msg_xml:
num += str(item) + "." num += str(item) + "."
print(num) print(num)
print(hexa.ArrayIntToStringHexa(msg_xml))
num = "" num = ""
for item in database_xml: for item in database_xml:
num += str(item) + "." num += str(item) + "."
print(num) print(num)
print(hexa.ArrayIntToStringHexa(database_xml))
if not msg.is_correct_md5(hexa.ArrayIntToStringHexa(msg_xml)):
print("[net_low_level:analyze_message_received] Wrong MD5 for msg.xml")
# TODO - we need quit with message error and go to login
return
send_system_sync() send_system_sync()
CLFECOMMON.SYSTEM_STALLED_CODE: CLFECOMMON.SYSTEM_STALLED_CODE:
pass pass

View file

@ -0,0 +1,62 @@
extends Node
# Declare member variables here. Examples:
# var a = 2
# var b = "text"
# Called when the node enters the scene tree for the first time.
func _ready():
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
#func _process(delta):
# pass
func HexaArray(value):
match value:
0:
return "0"
1:
return "1"
2:
return "2"
3:
return "3"
4:
return "4"
5:
return "5"
6:
return "6"
7:
return "7"
8:
return "8"
9:
return "9"
10:
return "a"
11:
return "b"
12:
return "c"
13:
return "d"
14:
return "e"
15:
return "f"
_:
return "?"
func IntToStringHexa(value):
var ret = ""
ret += HexaArray(value >> 4)
ret += HexaArray(value & 15)
return ret
func ArrayIntToStringHexa(array_int):
var ret = ""
for data in array_int:
ret += IntToStringHexa(data)
return ret

49
export_presets.cfg Normal file
View file

@ -0,0 +1,49 @@
[preset.0]
name="khaganat.linux.64"
platform="Linux/X11"
runnable=true
custom_features=""
export_filter="all_resources"
include_filter=""
exclude_filter=""
export_path=""
patch_list=PoolStringArray( )
script_export_mode=1
script_encryption_key=""
[preset.0.options]
texture_format/bptc=false
texture_format/s3tc=true
texture_format/etc=false
texture_format/etc2=false
texture_format/no_bptc_fallbacks=true
binary_format/64_bits=true
custom_template/release=""
custom_template/debug=""
[preset.1]
name="khaganat.linux.32"
platform="Linux/X11"
runnable=true
custom_features=""
export_filter="all_resources"
include_filter=""
exclude_filter=""
export_path=""
patch_list=PoolStringArray( )
script_export_mode=1
script_encryption_key=""
[preset.1.options]
texture_format/bptc=false
texture_format/s3tc=true
texture_format/etc=false
texture_format/etc2=false
texture_format/no_bptc_fallbacks=true
binary_format/64_bits=false
custom_template/release=""
custom_template/debug=""

View file

@ -25,6 +25,7 @@ config/icon="res://icon.png"
global="*res://global.tscn" global="*res://global.tscn"
character="*res://game_scene/Game/Character/Character.tscn" character="*res://game_scene/Game/Character/Character.tscn"
net_low_level="*res://assets/Scripts/Network/net_low_level.gd" net_low_level="*res://assets/Scripts/Network/net_low_level.gd"
msg="*res://assets/Scripts/Definition/msg.gd"
[display] [display]