diff options
author | Daniel Weipert <git@mail.dweipert.de> | 2024-11-28 18:38:42 +0100 |
---|---|---|
committer | Daniel Weipert <git@mail.dweipert.de> | 2024-11-28 18:38:42 +0100 |
commit | e8aa9f50886b66d525307a58d71036e6fd3d4aa1 (patch) | |
tree | ce6f59eecf1eb3e1ba2794166c09623d8a2d7d83 /character_server_information.gd | |
parent | c89f25f59aa493d95bcac8e75ca5cdd57a0403e7 (diff) |
next commit
Diffstat (limited to 'character_server_information.gd')
-rw-r--r-- | character_server_information.gd | 52 |
1 files changed, 0 insertions, 52 deletions
diff --git a/character_server_information.gd b/character_server_information.gd deleted file mode 100644 index 9ede3b6..0000000 --- a/character_server_information.gd +++ /dev/null @@ -1,52 +0,0 @@ -class_name CharacterServerInformation - - -## Byte Length: 4 -var server_ip: PackedByteArray - -## Byte Length: 2 -var server_port: int - -## Byte Length: 20 -var server_name: String - -## Byte Length: 2 -var user_count: int - -## Byte Length: 2 -var server_type: int - -## Byte Length: 2 -var display_new: int - -## Byte Length: 128 -var unknown: PackedByteArray - - -func get_server_ip(): - return "%s.%s.%s.%s" % [server_ip.decode_u8(0), server_ip.decode_u8(1), server_ip.decode_u8(2), server_ip.decode_u8(3)] - - -static func from_bytes(bytes: PackedByteArray): - var info = CharacterServerInformation.new() - - info.server_ip = bytes.slice(0, 4) - info.server_port = bytes.decode_u16(4) - info.server_name = bytes.slice(6, 6 + 20 - 1).get_string_from_utf8() - info.user_count = bytes.decode_u16(26) - info.server_type = bytes.decode_u16(28) - info.display_new = bytes.decode_u16(30) - info.unknown = bytes.slice(32) - - return info - - -static func array_from_bytes(bytes: PackedByteArray) -> Array: - var array = [] - - var offset = 0 - while offset < bytes.size(): - array.append(from_bytes(bytes.slice(offset))) - offset += 160 - - return array |