gamemode stats
This commit is contained in:
@@ -3,9 +3,13 @@ class_name ServerStatParser extends Node
|
|||||||
|
|
||||||
var parsed:bool
|
var parsed:bool
|
||||||
var users_month:int
|
var users_month:int
|
||||||
|
var users_all_time:int
|
||||||
var all_time_kills:int
|
var all_time_kills:int
|
||||||
|
var month_kills:int
|
||||||
var gamemodes_month:Dictionary
|
var gamemodes_month:Dictionary
|
||||||
|
var gamemodes:Dictionary
|
||||||
var maps_month:Dictionary
|
var maps_month:Dictionary
|
||||||
|
var maps:Dictionary
|
||||||
var players_total:Array[PlayerInfo]
|
var players_total:Array[PlayerInfo]
|
||||||
signal just_parsed
|
signal just_parsed
|
||||||
func _process(delta: float) -> void:
|
func _process(delta: float) -> void:
|
||||||
@@ -22,6 +26,16 @@ func _process(delta: float) -> void:
|
|||||||
var current_time:float = Time.get_unix_time_from_system()
|
var current_time:float = Time.get_unix_time_from_system()
|
||||||
var diff:float = current_time - time
|
var diff:float = current_time - time
|
||||||
var this_month:bool = diff < 60*60*24*30
|
var this_month:bool = diff < 60*60*24*30
|
||||||
|
if server.has("gamemode"):
|
||||||
|
var previous:int = 0
|
||||||
|
if gamemodes.has(server["gamemode"]):
|
||||||
|
previous = gamemodes[server["gamemode"]]
|
||||||
|
gamemodes[server["gamemode"]] = previous + 1
|
||||||
|
if server.has("map"):
|
||||||
|
var previous:int = 0
|
||||||
|
if maps.has(server["map"]):
|
||||||
|
previous = maps[server["map"]]
|
||||||
|
maps[server["map"]] = previous + 1
|
||||||
if this_month:
|
if this_month:
|
||||||
if server.has("gamemode"):
|
if server.has("gamemode"):
|
||||||
var previous:int = 0
|
var previous:int = 0
|
||||||
|
|||||||
+57
-4
@@ -226,7 +226,6 @@ func _ready() -> void:
|
|||||||
text_changed.connect(hoho)
|
text_changed.connect(hoho)
|
||||||
|
|
||||||
func hoho(_txt:String):
|
func hoho(_txt:String):
|
||||||
print(\"hho \")
|
|
||||||
if text == \"\":
|
if text == \"\":
|
||||||
for child:Control in player_c_ontainer.get_children():
|
for child:Control in player_c_ontainer.get_children():
|
||||||
child.show()
|
child.show()
|
||||||
@@ -269,6 +268,52 @@ func sort_ascending(a:PlayerInfo, b:PlayerInfo):
|
|||||||
return false
|
return false
|
||||||
"
|
"
|
||||||
|
|
||||||
|
[sub_resource type="GDScript" id="GDScript_36rkl"]
|
||||||
|
script/source = "extends VBoxContainer
|
||||||
|
|
||||||
|
@export var name_display: PackedScene
|
||||||
|
@export var server_stat_parser: ServerStatParser
|
||||||
|
|
||||||
|
# Called when the node enters the scene tree for the first time.
|
||||||
|
func _ready() -> void:
|
||||||
|
server_stat_parser.just_parsed.connect(reparse)
|
||||||
|
|
||||||
|
func reparse():
|
||||||
|
for child in get_children():
|
||||||
|
child.queue_free()
|
||||||
|
var root_display:NameDisplaye = name_display.instantiate()
|
||||||
|
root_display.label.text = \"Gamemode\"
|
||||||
|
root_display.label_2.text = \"Times Played\"
|
||||||
|
add_child(root_display)
|
||||||
|
var maps:Dictionary = {}
|
||||||
|
for key in server_stat_parser.gamemodes_month.keys():
|
||||||
|
if maps.has(server_stat_parser.gamemodes_month[key]):
|
||||||
|
if maps[server_stat_parser.gamemodes_month[key]] is Array:
|
||||||
|
#var new_arr
|
||||||
|
maps[server_stat_parser.gamemodes_month[key]].append(key)
|
||||||
|
else:
|
||||||
|
maps[server_stat_parser.gamemodes_month[key]] = [maps[server_stat_parser.gamemodes_month[key]],key]
|
||||||
|
else:
|
||||||
|
maps[server_stat_parser.gamemodes_month[key]] = key
|
||||||
|
maps.sort()
|
||||||
|
print(maps,\" gi\")
|
||||||
|
var keys = maps.keys()
|
||||||
|
keys.reverse()
|
||||||
|
for amount in keys:
|
||||||
|
var display:NameDisplaye = name_display.instantiate()
|
||||||
|
display.label_2.text = str(amount)
|
||||||
|
var gotten = maps[amount]
|
||||||
|
var new_string:String = \"\"
|
||||||
|
if gotten is Array:
|
||||||
|
for piece in gotten.size():
|
||||||
|
if gotten[piece]:
|
||||||
|
new_string += gotten[piece] + (\", \" if piece != gotten.size()-1 else \"\")
|
||||||
|
else:
|
||||||
|
new_string = gotten
|
||||||
|
display.label.text = str(new_string)
|
||||||
|
add_child(display)
|
||||||
|
"
|
||||||
|
|
||||||
[node name="Control" type="Control" unique_id=2276929 node_paths=PackedStringArray("edit_window", "punish_list_parser", "PunishContainer", "new_punish_btn", "new_btn", "exporter", "save_file_parser", "quit_confirmation", "ban_counter", "plus", "minus", "more_btn", "options_window", "git", "commit", "save_label")]
|
[node name="Control" type="Control" unique_id=2276929 node_paths=PackedStringArray("edit_window", "punish_list_parser", "PunishContainer", "new_punish_btn", "new_btn", "exporter", "save_file_parser", "quit_confirmation", "ban_counter", "plus", "minus", "more_btn", "options_window", "git", "commit", "save_label")]
|
||||||
layout_mode = 3
|
layout_mode = 3
|
||||||
anchors_preset = 15
|
anchors_preset = 15
|
||||||
@@ -730,7 +775,7 @@ layout_mode = 2
|
|||||||
size_flags_vertical = 3
|
size_flags_vertical = 3
|
||||||
theme_override_styles/panel = SubResource("StyleBoxFlat_1iba3")
|
theme_override_styles/panel = SubResource("StyleBoxFlat_1iba3")
|
||||||
theme_override_styles/tabbar_background = SubResource("StyleBoxFlat_yxlcp")
|
theme_override_styles/tabbar_background = SubResource("StyleBoxFlat_yxlcp")
|
||||||
current_tab = 1
|
current_tab = 3
|
||||||
|
|
||||||
[node name="Weapons" type="VBoxContainer" parent="Tabs/Server Statistics/VBoxContainer/TabContainer" unique_id=1628442051]
|
[node name="Weapons" type="VBoxContainer" parent="Tabs/Server Statistics/VBoxContainer/TabContainer" unique_id=1628442051]
|
||||||
visible = false
|
visible = false
|
||||||
@@ -767,6 +812,7 @@ clip_text = true
|
|||||||
text_overrun_behavior = 1
|
text_overrun_behavior = 1
|
||||||
|
|
||||||
[node name="Players" type="ScrollContainer" parent="Tabs/Server Statistics/VBoxContainer/TabContainer" unique_id=1039046594]
|
[node name="Players" type="ScrollContainer" parent="Tabs/Server Statistics/VBoxContainer/TabContainer" unique_id=1039046594]
|
||||||
|
visible = false
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
metadata/_tab_index = 1
|
metadata/_tab_index = 1
|
||||||
|
|
||||||
@@ -802,11 +848,18 @@ script = ExtResource("17_yxlcp")
|
|||||||
name_display = ExtResource("18_ebg2g")
|
name_display = ExtResource("18_ebg2g")
|
||||||
server_stat_parser = NodePath("../../../../ServerStatParser")
|
server_stat_parser = NodePath("../../../../ServerStatParser")
|
||||||
|
|
||||||
[node name="Gamemodes" type="VBoxContainer" parent="Tabs/Server Statistics/VBoxContainer/TabContainer" unique_id=97195990]
|
[node name="Gamemodes" type="ScrollContainer" parent="Tabs/Server Statistics/VBoxContainer/TabContainer" unique_id=1012624817]
|
||||||
visible = false
|
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
metadata/_tab_index = 3
|
metadata/_tab_index = 3
|
||||||
|
|
||||||
|
[node name="Gamemodes" type="VBoxContainer" parent="Tabs/Server Statistics/VBoxContainer/TabContainer/Gamemodes" unique_id=97195990 node_paths=PackedStringArray("server_stat_parser")]
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
size_flags_vertical = 3
|
||||||
|
script = SubResource("GDScript_36rkl")
|
||||||
|
name_display = ExtResource("18_ebg2g")
|
||||||
|
server_stat_parser = NodePath("../../../../ServerStatParser")
|
||||||
|
|
||||||
[node name="ServerStatParser" type="Node" parent="Tabs/Server Statistics" unique_id=1363475987 node_paths=PackedStringArray("server_stat_getter")]
|
[node name="ServerStatParser" type="Node" parent="Tabs/Server Statistics" unique_id=1363475987 node_paths=PackedStringArray("server_stat_getter")]
|
||||||
script = ExtResource("17_1nqs0")
|
script = ExtResource("17_1nqs0")
|
||||||
server_stat_getter = NodePath("../ServerStatGetter")
|
server_stat_getter = NodePath("../ServerStatGetter")
|
||||||
|
|||||||
Reference in New Issue
Block a user