From 3bea9ce328ba97a1b32ae87567f9cc19a62f2471 Mon Sep 17 00:00:00 2001 From: Eugene Molotov Date: Wed, 24 Apr 2024 17:41:29 +0500 Subject: [PATCH 1/3] gametypes: add instagib ctf and instagib freezetag --- qllr/gametypes.py | 30 ++++++++++++++++++++++++++++++ sql/init.sql | 5 +++-- 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/qllr/gametypes.py b/qllr/gametypes.py index 6542609..3b5e889 100644 --- a/qllr/gametypes.py +++ b/qllr/gametypes.py @@ -1,5 +1,9 @@ +import re + GAMETYPE_RULES = {} +ACC_CNT_FIRED_REGEX = re.compile("acc-([a-z]+)-cnt-fired") + def detect_by_match_report(data): for short, gt in GAMETYPE_RULES.items(): @@ -9,6 +13,20 @@ def detect_by_match_report(data): return data["game_meta"]["G"] +def detect_instagib(data): + for player in data["players"]: + for k, v in player: + matches = ACC_CNT_FIRED_REGEX.match(k) + if not matches: + continue + if matches.group(1) in ("rg", "gt"): + continue + if int(v) != 0: + return False + + return True + + class AbstractGametype: def calculate_player_perf(self, player_data, time_factor): raise NotImplementedError() # pragma: nocover @@ -110,9 +128,21 @@ def override_min_player_count(self): return 4 +class GametypeInstaCTF(GametypeCTF): + def force_by_match_report(self, data): + return data["game_meta"]["G"] == "ctf" and detect_instagib(data) + + +class GametypeInstaFreeze(GametypeFT): + def force_by_match_report(self, data): + return data["game_meta"]["G"] == "ft" and detect_instagib(data) + + GAMETYPE_RULES["ad"] = GametypeAD() GAMETYPE_RULES["ca"] = GametypeCA() GAMETYPE_RULES["ctf"] = GametypeCTF() GAMETYPE_RULES["ft"] = GametypeFT() GAMETYPE_RULES["tdm"] = GametypeTDM() GAMETYPE_RULES["tdm2v2"] = GametypeTDM2V2() +GAMETYPE_RULES["ictf"] = GametypeInstaCTF() +GAMETYPE_RULES["ift"] = GametypeInstaFreeze() diff --git a/sql/init.sql b/sql/init.sql index 314bf75..8ddcec9 100644 --- a/sql/init.sql +++ b/sql/init.sql @@ -19,7 +19,9 @@ INSERT INTO gametypes (gametype_id, gametype_name, gametype_short) VALUES (3, 'Team Deathmatch', 'tdm'), (4, 'Team Deathmatch (2v2)', 'tdm2v2'), (5, 'Freeze Tag', 'ft'), - (6, 'Clan Arena', 'ca'); + (6, 'Clan Arena', 'ca'), + (7, 'InstaCTF', 'ictf'), + (8, 'InstaFreeze', 'ift'); @@ -178,4 +180,3 @@ CREATE TABLE scoreboards_medals ( FOREIGN KEY (medal_id) REFERENCES medals(medal_id), PRIMARY KEY (match_id, steam_id, team, medal_id) ); - From 9c401628b6c087e2b49f2648907cd7b6a506a670 Mon Sep 17 00:00:00 2001 From: Eugene Molotov Date: Wed, 24 Apr 2024 17:46:11 +0500 Subject: [PATCH 2/3] wake up --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 9c6271f..62f33d9 100644 --- a/README.md +++ b/README.md @@ -55,3 +55,4 @@ Reasons: ### Note to European A&D and #qlpickup.ru communities Backups of database and feeder config are [here](https://disk.yandex.ru/d/hJfHip6ue7UCNg) +a From 5dc7fcf872d68eaf818a8065e68f44bfe253d057 Mon Sep 17 00:00:00 2001 From: Eugene Molotov Date: Thu, 25 Apr 2024 23:24:58 +0500 Subject: [PATCH 3/3] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 62f33d9..17e4746 100644 --- a/README.md +++ b/README.md @@ -55,4 +55,4 @@ Reasons: ### Note to European A&D and #qlpickup.ru communities Backups of database and feeder config are [here](https://disk.yandex.ru/d/hJfHip6ue7UCNg) -a +