Fixing some values by making a temporary mess

This commit is contained in:
Emily 2018-09-26 15:25:01 +02:00
parent 4b3fbf2be3
commit dd315d31d0
2 changed files with 8 additions and 8 deletions

View File

@ -1,3 +1,3 @@
{
"python.pythonPath": "/usr/bin/python3"
"python.pythonPath": "C:\\Users\\Emily\\AppData\\Local\\Programs\\Python\\Python36\\python.exe"
}

View File

@ -45,8 +45,8 @@ def query_r():
flat_packet_data = dataHelper.flatten(packet_data)
packet = struct.pack(b"<H" + b"c%dsc%ds" * flat_packet_data[0] # using len_rules
% [len(y) for x in rules.items() for y in x], # array of only rules entries
packet = struct.pack(b"<H" + b"B%dsB%ds" * flat_packet_data[0] # using len_rules
% tuple(len(y) for x in rules.items() for y in x), # tuple of only rules entries
*flat_packet_data)
return packet
@ -65,8 +65,8 @@ def query_c():
flat_packet_data = dataHelper.flatten(packet_data)
packet = struct.pack(b"<H" + b"c%dscI" * flat_packet_data[0]
% [len(x) for x in players_scores.keys()],
packet = struct.pack(b"<H" + b"B%dsI" * flat_packet_data[0]
% tuple(len(x) for x in players_scores.keys()),
*flat_packet_data)
return packet
@ -95,14 +95,14 @@ def query_d():
def get_online_players(): #TODO: Get data from server's client objects
return [
{"nick": "Sunpy", "score": 64, "ping": 8} + {"id": 1} # replace id with function to get player's id
{"nick": b"Sunpy", "score": 64, "ping": 8, "id": 1} # replace id with function to get player's id
]
def get_rules(): #TODO
return {"Rule name sample": "Rule value"}
return {b"Rule name sample": b"Rule value"}
def get_players_scores(): #TODO
return {"Sunpy": 64, "username": 123}
return {b"Sunpy": 64, b"username": 123}
RESPONSE = { #TODO: c, d & p (https://wiki.sa-mp.com/wiki/Query_Mechanism)
b"i": query_i,