-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.gd
55 lines (44 loc) · 1.77 KB
/
test.gd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
extends HTTPRequest
var new_format = []
func _ready():
search()
func search():
var query_order = "order=chronicle,player,character_name"
request(
GameInfo.character_sheets_table_url + "?" + query_order,
PackedStringArray(["accept: application/json", "Range-Unit: items"]),
HTTPClient.METHOD_GET
)
func _on_Node_request_completed(result, response_code, headers, body):
var test_json_conv = JSON.new()
test_json_conv.parse(body.get_string_from_utf8())
var chars = test_json_conv.get_data()
for char2 in chars:
var chronicle = char2["chronicle"]
var player = char2["player"]
var char_name = char2["character_name"]
var data = char2["character_stats"]
var n_data = {
"bio": data["description"].duplicate(true),
"status": data["status"].duplicate(true),
"atributes": data["atributes"].duplicate(true),
"skills": data["abilities"].duplicate(true),
"plane_manipulation": data["plane_manipulation"].duplicate(true)
}
n_data["bio"]["age"] = data["data"]["age"]
n_data["bio"]["job"] = data["data"]["job"]
n_data["bio"]["species"] = data["data"]["species"]
if not data["plane_manipulation"].is_empty():
n_data["plane_manipulation"].erase("iter")
n_data["plane_manipulation"]["journey"] = data["plane_manipulation"]["iter"]
n_data["plane_manipulation"].erase("aspecti")
n_data["plane_manipulation"]["aspects"] = data["plane_manipulation"]["aspecti"]
var vacants = 2 - n_data["plane_manipulation"]["aspects"].size()
for i in range(vacants):
n_data["plane_manipulation"]["aspects"].append("")
var post_data = { "character_stats": n_data }
CharactersGetter.update_character(chronicle, player, char_name, post_data)
await get_tree().create_timer(0.5).timeout
new_format.append(n_data)
print(new_format.size())
get_tree().quit()