minor fixes for wordrun

Help returns correct title of the game;
Alternative command .add is being ignored when counting valid words;
Typos
This commit is contained in:
ThomasWeis
2022-04-21 05:37:22 +02:00
committed by BaerbelBox
parent 9eef5966e9
commit 53f2208ff7

View File

@@ -12,7 +12,7 @@ class WordRunObserver(PrivMsgObserverPrototype):
@staticmethod @staticmethod
def help(): def help():
return 'hangman game' return 'wordrun game'
def __init__(self): def __init__(self):
super().__init__() super().__init__()
@@ -35,7 +35,7 @@ class WordRunObserver(PrivMsgObserverPrototype):
def add(self, data, connection): def add(self, data, connection):
if self.gamestatus == 0: if self.gamestatus == 0:
connection.send_channel("Es läuft derzeit kein Wordrun, bitte einen neuen mit .begin <Silbe> oder .end <silbe> erstellen!") connection.send_channel("Es läuft derzeit kein Wordrun, bitte einen neuen mit .begin <Silbe> oder .end <Silbe> erstellen!")
return return
if self.gamestatus == 1 or self.gamestatus == 2: if self.gamestatus == 1 or self.gamestatus == 2:
self.check_word(data["nick"], data['message'], connection) self.check_word(data["nick"], data['message'], connection)
@@ -56,7 +56,7 @@ class WordRunObserver(PrivMsgObserverPrototype):
def check_word(self,player , message, connection): def check_word(self,player , message, connection):
for word in message.split(): for word in message.split():
if word == '.a': if word == '.a' or word == '.add':
continue continue
if self.gamestatus == 1: if self.gamestatus == 1:
if word.upper().startswith(self.syllable.upper()): if word.upper().startswith(self.syllable.upper()):
@@ -91,7 +91,7 @@ class WordRunObserver(PrivMsgObserverPrototype):
print(p+" "+w) print(p+" "+w)
player_score[p] += 1 player_score[p] += 1
for p in self.player.keys(): for p in self.player.keys():
s = s + p + " : "+str(player_score[p])+ "; " s = s + p + ": "+str(player_score[p])+ "; "
connection.send_channel(s) connection.send_channel(s)
self.gamestatus = 0 self.gamestatus = 0
self.player = {} self.player = {}