diff options
| -rw-r--r-- | pycrctrl.pyp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/pycrctrl.pyp b/pycrctrl.pyp index 6219e06..a37b643 100644 --- a/pycrctrl.pyp +++ b/pycrctrl.pyp @@ -46,7 +46,7 @@ except ModuleNotFoundError: from iostream import * -from random import randint +import random from time import sleep from enum import IntEnum @@ -144,16 +144,16 @@ class PyCRCtrl(object): def __ostream__(self, ostream): return "PyCRCtrl: commandline: {}, channel: {}, scenario: {}".format(self.commandline, self.channels["ingame"], (self.scenario if self.scenario != "" else "None")) + @property def getState(self): return self.__state + @self.getState.setter def setState(self, text): if text in ["Lobby", "Lädt", "Läuft"]: self.__state = text self.setTopic("Aktuelles Szenario: {} | {}".format(self.scenario, self.state)) - state = property(getState, setState) - def loadScenarioList(self) -> bool: if self.path == None: return False @@ -198,7 +198,7 @@ class PyCRCtrl(object): scenario = scenario.splitlines()[0] if scenario == "random": - scenario = self.scenlist[randint(0, len(self.scenlist)-1)] + scenario = random.choice(self.scenlist) elif scenario not in self.scenlist(): return (CmdResult.SyntaxFail,'Szenario "{}" wurde nicht gefunden!'.format(scenario)) @@ -222,7 +222,7 @@ class PyCRCtrl(object): if self.queue.empty() == False: self.scenario = self.queue.get() else: - self.scenario = self.scenlist[randint(0,len(self.scenlist))-1] + self.scenario = random.choice(self.scenlist) self.clonk = subprocess.Popen( './{} {} "{}"'.format(self.config.get("engine"), self.config.get("commandline") + (" --" if type(self).__name__ == "PyOCCtrl" else " /") + ("league" if self.scenario in self.league_scenlist() else "noleague"),self.scenario), 0, |
