now stuff

This commit is contained in:
bucket
2026-04-30 15:17:41 +02:00
parent 056f24340b
commit 672341b654
19 changed files with 701 additions and 21 deletions
-2
View File
@@ -80,8 +80,6 @@ func remove_iteration() -> bool:
# cancel if not same name
if punishment_keep == punishment_two:
continue
if punishment_keep.punishment.username != punishment_two.punishment.username:
continue
# cancel if not same uid
if punishment_keep.punishment.uid != punishment_two.punishment.uid:
continue
@@ -0,0 +1,6 @@
1= blu, 2 = red 0 = 👩‍🦼H#@&[[]/
Updating:
the server updates its data when starting and closing
otherwise It does at different times for different things, usually after death or after spawning
after 10 minutes its safe to assume a server dead
@@ -0,0 +1,71 @@
class_name ServerStatParser extends Node
@export var server_stat_getter: Node
var parsed:bool
var users_month:int
var all_time_kills:int
var gamemodes_month:Dictionary
var maps_month:Dictionary
var players_total:Array[PlayerInfo]
signal just_parsed
func _process(delta: float) -> void:
if !parsed:
if server_stat_getter.get("resulting_txt") != null:
var result:String = server_stat_getter.get("resulting_txt")
if result:
var json:Dictionary = JSON.parse_string(result)
if json is Dictionary:
parsed = true
for server:Dictionary in json.values():
#print(server)
var time:float = Time.get_unix_time_from_datetime_string(server["created"])
var current_time:float = Time.get_unix_time_from_system()
var diff:float = current_time - time
var this_month:bool = diff < 60*60*24*30
if this_month:
if server.has("gamemode"):
var previous:int = 0
if gamemodes_month.has(server["gamemode"]):
previous = gamemodes_month[server["gamemode"]]
gamemodes_month[server["gamemode"]] = previous + 1
if server.has("map"):
var previous:int = 0
if maps_month.has(server["map"]):
previous = maps_month[server["map"]]
maps_month[server["map"]] = previous + 1
for player in server["players"]:
var exists_yet:bool = false
for found_player in players_total:
if found_player.uid == player:
exists_yet = true
found_player.times_played += 1
found_player.total_kills += int(server["players"][player]["kills"])
var classes = server["players"][player]["classes"]
if classes is Dictionary:
print(classes)
for player_class:Dictionary in classes.values():
if player_class.has("stats"):
if player_class["stats"].has("deaths"):
found_player.total_deaths += int(player_class["stats"]["deaths"])
break
if !exists_yet:
if this_month:
users_month += 1
#print(player)
var new_player:PlayerInfo = PlayerInfo.new()
new_player.uid = player
new_player.username = str(server["players"][player]["username"])
new_player.times_played = 1
new_player.total_kills += int(server["players"][player]["kills"])
var classes = server["players"][player]["classes"]
if classes is Dictionary:
print(classes)
for player_class:Dictionary in classes.values():
if player_class.has("stats"):
if player_class["stats"].has("deaths"):
new_player.total_deaths += int(player_class["stats"]["deaths"])
players_total.append(new_player)
var dict:Dictionary = server["players"]
if dict.has("kills"):
all_time_kills += dict["kills"]
just_parsed.emit()
@@ -0,0 +1 @@
uid://b05psfj22ka2f