From ddf7245aa8fd0c6d932f647a4d24cf0603295359 Mon Sep 17 00:00:00 2001 From: JessicaTegner Date: Fri, 31 Mar 2023 02:47:00 +0200 Subject: [PATCH 1/5] Added more information in the finger command --- ygo/parsers/lobby_parser.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ygo/parsers/lobby_parser.py b/ygo/parsers/lobby_parser.py index 8426118..557815c 100644 --- a/ygo/parsers/lobby_parser.py +++ b/ygo/parsers/lobby_parser.py @@ -714,6 +714,14 @@ def finger(caller): pl.notify(pl._("%.2f%% Success.")%(average)) + # admin information + if account.is_admin: + # tell the player that this is an admin + pl.notify(pl._("This player is an admin.")) + if pl.is_admin: + # show language and encoding + pl.notify(pl._("Language: %s, Encoding: %s")%(account.language, account.encoding)) + @LobbyParser.command(names=["reloadlanguages"], allowed = lambda c: c.connection.player.is_admin) def reloadlanguages(caller): caller.connection.notify(caller.connection._("Reloading languages...")) From c4d8fc041a3913fe3ffaee35bdbc0b5de0f9c67f Mon Sep 17 00:00:00 2001 From: JessicaTegner Date: Fri, 31 Mar 2023 02:51:14 +0200 Subject: [PATCH 2/5] Fixed indent --- ygo/parsers/lobby_parser.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/ygo/parsers/lobby_parser.py b/ygo/parsers/lobby_parser.py index 557815c..378ae7f 100644 --- a/ygo/parsers/lobby_parser.py +++ b/ygo/parsers/lobby_parser.py @@ -714,13 +714,13 @@ def finger(caller): pl.notify(pl._("%.2f%% Success.")%(average)) - # admin information - if account.is_admin: - # tell the player that this is an admin - pl.notify(pl._("This player is an admin.")) - if pl.is_admin: - # show language and encoding - pl.notify(pl._("Language: %s, Encoding: %s")%(account.language, account.encoding)) + # admin information + if account.is_admin: + # tell the player that this is an admin + pl.notify(pl._("This player is an admin.")) + if pl.is_admin: + # show language and encoding + pl.notify(pl._("Language: %s, Encoding: %s")%(account.language, account.encoding)) @LobbyParser.command(names=["reloadlanguages"], allowed = lambda c: c.connection.player.is_admin) def reloadlanguages(caller): From 0b31182ec61a68c961ad53ac9538b362e0f37c6f Mon Sep 17 00:00:00 2001 From: JessicaTegner Date: Fri, 31 Mar 2023 02:58:07 +0200 Subject: [PATCH 3/5] Changed how the finger command does stats --- ygo/parsers/lobby_parser.py | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/ygo/parsers/lobby_parser.py b/ygo/parsers/lobby_parser.py index 378ae7f..895d76a 100644 --- a/ygo/parsers/lobby_parser.py +++ b/ygo/parsers/lobby_parser.py @@ -694,25 +694,23 @@ def finger(caller): stats = natsort.natsorted(stats, key=lambda s: s.opponent.name) - if len(stats) == 0: - return - - pl.notify(pl._("Duel statistics:")) + if len(stats) != 0: + pl.notify(pl._("Duel statistics:")) - for stat in stats: + for stat in stats: - pl.notify(pl._("%s - Won: %d, Lost: %d, Drawn: %d")%(stat.opponent.name, stat.win, stat.lose, stat.draw)) + pl.notify(pl._("%s - Won: %d, Lost: %d, Drawn: %d")%(stat.opponent.name, stat.win, stat.lose, stat.draw)) - won = sum([s.win for s in stats]) - lost = sum([s.lose for s in stats]) - drawn = sum([s.draw for s in stats]) + won = sum([s.win for s in stats]) + lost = sum([s.lose for s in stats]) + drawn = sum([s.draw for s in stats]) - pl.notify(pl._("Conclusion - Won: %d, Lost: %d, Drawn: %d")%(won, lost, drawn)) + pl.notify(pl._("Conclusion - Won: %d, Lost: %d, Drawn: %d")%(won, lost, drawn)) - if won+lost > 0: - average = float(won)*100/(float(won)+float(lost)) + if won+lost > 0: + average = float(won)*100/(float(won)+float(lost)) - pl.notify(pl._("%.2f%% Success.")%(average)) + pl.notify(pl._("%.2f%% Success.")%(average)) # admin information if account.is_admin: From db9b8ea2c7f62e13bb88e45edd580d9acd095b10 Mon Sep 17 00:00:00 2001 From: JessicaTegner Date: Fri, 31 Mar 2023 03:01:13 +0200 Subject: [PATCH 4/5] Added more information to the finger command --- ygo/parsers/lobby_parser.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ygo/parsers/lobby_parser.py b/ygo/parsers/lobby_parser.py index 895d76a..c25ceaa 100644 --- a/ygo/parsers/lobby_parser.py +++ b/ygo/parsers/lobby_parser.py @@ -718,7 +718,12 @@ def finger(caller): pl.notify(pl._("This player is an admin.")) if pl.is_admin: # show language and encoding - pl.notify(pl._("Language: %s, Encoding: %s")%(account.language, account.encoding)) + pl.notify(pl._("Admin information:")) + pl.notify(pl._("Language: %s.")%(account.language)) + pl.notify(pl._("Encoding: %s.")%(account.encoding)) + if account.banned: + pl.notify(pl._("This account is banned.")) + pl.notify(pl._("IP address: %s.")%(account.ip_address)) @LobbyParser.command(names=["reloadlanguages"], allowed = lambda c: c.connection.player.is_admin) def reloadlanguages(caller): From 85aa40b1eb78bc4dda6351b65d98a074218fd706 Mon Sep 17 00:00:00 2001 From: JessicaTegner Date: Fri, 31 Mar 2023 03:02:57 +0200 Subject: [PATCH 5/5] Removed ip from finger command --- ygo/parsers/lobby_parser.py | 1 - 1 file changed, 1 deletion(-) diff --git a/ygo/parsers/lobby_parser.py b/ygo/parsers/lobby_parser.py index c25ceaa..2625b6c 100644 --- a/ygo/parsers/lobby_parser.py +++ b/ygo/parsers/lobby_parser.py @@ -723,7 +723,6 @@ def finger(caller): pl.notify(pl._("Encoding: %s.")%(account.encoding)) if account.banned: pl.notify(pl._("This account is banned.")) - pl.notify(pl._("IP address: %s.")%(account.ip_address)) @LobbyParser.command(names=["reloadlanguages"], allowed = lambda c: c.connection.player.is_admin) def reloadlanguages(caller):