MarechJ/hll_rcon_tool

[Squad Automod] Punishes players when squad has a lead which fails the playerinfo command

FlorianSW opened this issue · 1 comments

Consider the following use case:

  • A squad with 6 players (let's assume Showa, CroDanz, I-Galaxy-I, vRezxiiZ, GUNKING666 and Bob Jan)
  • for some reason, playerinfo Showa fails, hence we do not get any info for that player
  • the player with the name Showa is the SL of this squad (let's say it's how on axis)

Expected result:

  • even though we do not know for sure that Showa is a squad lead, the squad should not get punished, as it might have an SL, and they would wrongfully get punished. "Better to let one squad without an SL go away without punish, then punishing a legitimate squad wrongfully" :P

Current result:
The squad get's warnings and punishes according to the configured automod config.

Logs as they might help:
Discord Audit

[1. Fallschirmjäger][NoLeaderWatch] --> PUNISHING: APlayer(player='CroDanZ', squad='how', team='axis', role='assault', lvl=159)
[1. Fallschirmjäger][NoLeaderWatch] --> PUNISHING: APlayer(player='vRezxiiZ-', squad='how', team='axis', role='automaticrifleman', lvl=120)
[1. Fallschirmjäger][NoLeaderWatch] --> PUNISHING: APlayer(player='GUNKING666', squad='how', team='axis', role='heavymachinegunner', lvl=18)
[1. Fallschirmjäger][NoLeaderWatch] --> PUNISHING: APlayer(player='Bob Jan', squad='how', team='axis', role='antitank', lvl=57)

squad_automod_1.log

[2022-07-18 20:34:19,227][INFO] rcon.squad_automod.automod automod.py:should_warn_squad:76 | Warning squad axis - how. got 4/5 warning at time: [datetime.datetime(2022, 7, 18, 20, 29, 25, 757899), datetime.datetime(2022, 7, 18, 20, 30, 49, 32537), datetime.datetime(2022, 7, 18, 20, 31, 54, 557058), datetime.datetime(2022, 7, 18, 20, 32, 56, 310590)]
[2022-07-18 20:34:19,228][INFO] rcon.squad_automod.automod automod.py:punish_squads_without_leaders:339 | Squad Automod will apply the following punitions PunitionsToApply(warning={'allies': ['george', 'love', 'how'], 'axis': ['how']}, punish=[], kick=[], squads_state=[ASquad(name='george', players=[APlayer(player='Wolfsauge', squad='george', team='allies', role='rifleman', lvl=1), APlayer(player='Shmuckling', squad='george', team='allies', role='medic', lvl=20), APlayer(player='Das Reichhoernchen', squad='george', team='allies', role='antitank', lvl=84), APlayer(player='StonewallJackson1', squad='george', team='allies', role='heavymachinegunner', lvl=15), APlayer(player='TurboJosef', squad='george', team='allies', role='rifleman', lvl=54), APlayer(player='Communist_SxE', squad='george', team='allies', role='support', lvl=55)]), ASquad(name='love', players=[APlayer(player='Waxer', squad='love', team='allies', role='crewman', lvl=53)]), ASquad(name='how', players=[APlayer(player='- P E T R O V ™-', squad='how', team='allies', role='assault', lvl=4), APlayer(player='Аниме кунчик', squad='how', team='allies', role='heavymachinegunner', lvl=38)]), ASquad(name='how', players=[APlayer(player='I-GaLaXy-I', squad='how', team='axis', role='support', lvl=49), APlayer(player='CroDanZ', squad='how', team='axis', role='assault', lvl=159), APlayer(player='vRezxiiZ-', squad='how', team='axis', role='automaticrifleman', lvl=120), APlayer(player='GUNKING666', squad='how', team='axis', role='heavymachinegunner', lvl=18), APlayer(player='Bob Jan', squad='how', team='axis', role='medic', lvl=57)])])
[2022-07-18 20:34:19,230][INFO] rcon.discord discord.py:send_to_discord_audit:48 | Audit: [NoLeaderWatch] Warnings: allies: GEORGE 3/5 /!\, LOVE 1/5 /!\, HOW 3/5 /!\ axis: HOW 5/5 /!\
[2022-07-18 20:34:19,587][INFO] rcon.commands commands.py:_request:106 | broadcast "Achtung! Squad-Leader bestimmen, oder Squads werden bestraft.
allies: GEORGE 3/5 /!\\, LOVE 1/5 /!\\, HOW 3/5 /!\\
axis: HOW 5/5 /!\\

"
[2022-07-18 20:34:29,853][ERROR] rcon.commands commands.py:wrap:59 | Auto retrying _request ('playerinfo  Showa ',) {'can_fail': False}
Traceback (most recent call last):
  File "/code/rcon/commands.py", line 54, in wrap
    return method(self, *args, **kwargs)
  File "/code/rcon/commands.py", line 126, in _request
    raise HLLServerError(f"Got FAIL for {command}")
rcon.commands.HLLServerError: Got FAIL for playerinfo  Showa 
[2022-07-18 20:34:29,898][WARNING] rcon.commands commands.py:_reconnect:95 | reconnecting
[2022-07-18 20:34:32,301][ERROR] rcon.extended_commands extended_commands.py:get_team_view_fast:237 | Failed to get info for {'name': ' Showa ', 'steam_id_64': '765xxxxxxxxxxxxxx', 'steam_bans': {'CommunityBanned': False, 'VACBanned': False, 'NumberOfVACBans': 0, 'DaysSinceLastBan': 0, 'NumberOfGameBans': 0, 'EconomyBan': 'none', 'has_bans': False}, 'country': 'DE'}
Traceback (most recent call last):
  File "/code/rcon/commands.py", line 54, in wrap
    return method(self, *args, **kwargs)
  File "/code/rcon/commands.py", line 126, in _request
    raise HLLServerError(f"Got FAIL for {command}")
rcon.commands.HLLServerError: Got FAIL for playerinfo  Showa 

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/code/rcon/extended_commands.py", line 235, in get_team_view_fast
    player_data = future.result()
  File "/usr/local/lib/python3.8/concurrent/futures/_base.py", line 437, in result
    return self.__get_result()
  File "/usr/local/lib/python3.8/concurrent/futures/_base.py", line 389, in __get_result
    raise self._exception
  File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/code/rcon/cache_utils.py", line 146, in wrapper
    return cached_func(*args, **kwargs)
  File "/code/rcon/cache_utils.py", line 72, in __call__
    val = self.function(*args, **kwargs)
  File "/code/rcon/extended_commands.py", line 362, in get_detailed_player_info
    raw = super().get_player_info(player)
  File "/code/rcon/commands.py", line 236, in get_player_info
    data = self._request(f"playerinfo {player}", can_fail=can_fail)
  File "/code/rcon/commands.py", line 62, in wrap
    return method(self, *args, **kwargs)
  File "/code/rcon/commands.py", line 126, in _request
    raise HLLServerError(f"Got FAIL for {command}")
rcon.commands.HLLServerError: Got FAIL for playerinfo  Showa 
[2022-07-18 20:34:32,642][INFO] rcon.squad_automod.automod automod.py:get_punitions_to_apply:217 | Squad allies - george doesn't have leader
[2022-07-18 20:34:32,644][INFO] rcon.squad_automod.automod automod.py:get_punitions_to_apply:217 | Squad allies - how doesn't have leader
[2022-07-18 20:34:32,647][INFO] rcon.squad_automod.automod automod.py:get_punitions_to_apply:217 | Squad axis - how doesn't have leader
[2022-07-18 20:34:42,907][ERROR] rcon.commands commands.py:wrap:59 | Auto retrying _request ('playerinfo  Showa ',) {'can_fail': False}
Traceback (most recent call last):
  File "/code/rcon/commands.py", line 54, in wrap
    return method(self, *args, **kwargs)
  File "/code/rcon/commands.py", line 126, in _request
    raise HLLServerError(f"Got FAIL for {command}")
rcon.commands.HLLServerError: Got FAIL for playerinfo  Showa 
[2022-07-18 20:34:42,948][WARNING] rcon.commands commands.py:_reconnect:95 | reconnecting
[2022-07-18 20:34:45,099][ERROR] rcon.extended_commands extended_commands.py:get_team_view_fast:237 | Failed to get info for {'name': ' Showa ', 'steam_id_64': '765xxxxxxxxxxxxxx', 'steam_bans': {'CommunityBanned': False, 'VACBanned': False, 'NumberOfVACBans': 0, 'DaysSinceLastBan': 0, 'NumberOfGameBans': 0, 'EconomyBan': 'none', 'has_bans': False}, 'country': 'DE'}
Traceback (most recent call last):
  File "/code/rcon/commands.py", line 54, in wrap
    return method(self, *args, **kwargs)
  File "/code/rcon/commands.py", line 126, in _request
    raise HLLServerError(f"Got FAIL for {command}")
rcon.commands.HLLServerError: Got FAIL for playerinfo  Showa 

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/code/rcon/extended_commands.py", line 235, in get_team_view_fast
    player_data = future.result()
  File "/usr/local/lib/python3.8/concurrent/futures/_base.py", line 437, in result
    return self.__get_result()
  File "/usr/local/lib/python3.8/concurrent/futures/_base.py", line 389, in __get_result
    raise self._exception
  File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/code/rcon/cache_utils.py", line 146, in wrapper
    return cached_func(*args, **kwargs)
  File "/code/rcon/cache_utils.py", line 72, in __call__
    val = self.function(*args, **kwargs)
  File "/code/rcon/extended_commands.py", line 362, in get_detailed_player_info
    raw = super().get_player_info(player)
  File "/code/rcon/commands.py", line 236, in get_player_info
    data = self._request(f"playerinfo {player}", can_fail=can_fail)
  File "/code/rcon/commands.py", line 62, in wrap
    return method(self, *args, **kwargs)
  File "/code/rcon/commands.py", line 126, in _request
    raise HLLServerError(f"Got FAIL for {command}")
rcon.commands.HLLServerError: Got FAIL for playerinfo  Showa 
[2022-07-18 20:34:45,429][INFO] rcon.squad_automod.automod automod.py:get_punitions_to_apply:217 | Squad allies - george doesn't have leader
[2022-07-18 20:34:45,431][INFO] rcon.squad_automod.automod automod.py:get_punitions_to_apply:217 | Squad allies - how doesn't have leader
[2022-07-18 20:34:45,433][INFO] rcon.squad_automod.automod automod.py:get_punitions_to_apply:217 | Squad axis - how doesn't have leader

This issue is not really about the failing playerinfo thing (which I reported separately here: #116), it's more about the fact that this should not lead to wrongful punishments from my point of view :)

The problem is that this case is indistinguishable from a squad that really doesn't have a leader.
The only way to solve that is to solve the problem with the playerinfo call I'm afraid. Would be could if someone could confirm the bug with the spaces, also double check with the official client so we know if it's a game server issue or only a CRcon problem. If it's a game server issue we'd need to talk to the game dev so they can fix it.