Esempio n. 1
0
    def handle_vote(self, player, yes):
        if not self.is_vote_active():
            return
        
        if player in self.has_voted:
            ident = player.steam_id
            if (player.privileges != None or self.db.has_permission(ident, 3)):
                minqlx.force_vote(yes)
                if yes:
                    word = "passed"
                else:
                    word = "vetoed"
                    
                self.msg("{}^7 {} the vote.".format(player.name, word))
                return minqlx.RET_STOP_ALL

        self.has_voted.append(player)
        
        if (player.privileges != None):
            # at least give the impression that the QLDS admin/mod voted normally.
            if yes:
                yes_votes = int(minqlx.get_configstring(10))
                yes_votes += 1
                minqlx.set_configstring(10, str(yes_votes))
            else:
                no_votes = int(minqlx.get_configstring(11))
                no_votes += 1
                minqlx.set_configstring(11, str(no_votes))
            return minqlx.RET_STOP_ALL
Esempio n. 2
0
    def handle_vote(self, player, yes):
        if not self.is_vote_active():
            return

        if player in self.has_voted:
            ident = player.steam_id
            if (player.privileges != None or self.db.has_permission(ident, 3)):
                minqlx.force_vote(yes)
                if yes:
                    word = "passed"
                else:
                    word = "vetoed"

                self.msg("{}^7 {} the vote.".format(player.name, word))
                return minqlx.RET_STOP_ALL

        self.has_voted.append(player)

        if (player.privileges != None):
            # at least give the impression that the QLDS admin/mod voted normally.
            if yes:
                yes_votes = int(minqlx.get_configstring(10))
                yes_votes += 1
                minqlx.set_configstring(10, str(yes_votes))
            else:
                no_votes = int(minqlx.get_configstring(11))
                no_votes += 1
                minqlx.set_configstring(11, str(no_votes))
            return minqlx.RET_STOP_ALL
Esempio n. 3
0
    def handle_vote(self, player, yes):
        if self.stop(): return
        if not self.is_vote_active(): return
        if not self._id_to_pass_vote: return

        if not player.steam_id in self._id_to_pass_vote: return

        minqlx.force_vote(yes)
        m = "^2accepted" if yes else "^1denied"
        self.msg("^7{} {} ^7the ^4set ^7vote.".format(player.name, m))
Esempio n. 4
0
    def handle_vote(self, player, yes):
        if self.stop(): return
        if not self.is_vote_active(): return
        if not self._id_to_pass_vote: return

        if not player.steam_id in self._id_to_pass_vote: return

        minqlx.force_vote(yes)
        m = "^2accepted" if yes else "^1denied"
        self.msg("^7{} {} ^7the ^4set ^7vote.".format(player.name, m))
    def force(self, require, vote_id):
        if self.last_vote != vote_id:
            # This is not the vote we should be resolving.
            return

        votes = self.current_vote_count()
        if self.is_vote_active() and votes and votes[0] > votes[1]:
            if require:
                teams = self.teams()
                players = teams["red"] + teams["blue"] + teams["free"]
                if sum(votes)/len(players) < require:
                    return
            minqlx.force_vote(True)
Esempio n. 6
0
    def force(self, require, vote_id):
        if self.last_vote != vote_id:
            # This is not the vote we should be resolving.
            return

        votes = self.current_vote_count()
        if self.is_vote_active() and votes and votes[0] > votes[1]:
            if require:
                teams = self.teams()
                players = teams["red"] + teams["blue"] + teams["free"]
                if sum(votes) / len(players) < require:
                    return
            minqlx.force_vote(True)
    def handle_client_command(self, player, command):
        command = command.lower()
        command = command.split()
        if command[0] == "pass" or command[0] == "veto":
            if self.is_vote_active():
                if self.db.has_permission(player.steam_id, 3):
                    if command[0] == "pass":
                        minqlx.force_vote(True)
                        action = "^2passed"
                    if command[0] == "veto":
                        minqlx.force_vote(False)
                        action = "^1vetoed"
                    self.msg("{}^7 {}^7 the vote.".format(player.name, action))
                else:
                    player.tell("You don't have permission to ^4/{}^7 a vote.".format(command[0]))
            else:
                player.tell("There is no current vote to ^4/{}^7.".format(command[0]))

            return minqlx.RET_STOP_ALL
Esempio n. 8
0
    def force_vote(cls, pass_it):
        if pass_it is True or pass_it is False:
            return minqlx.force_vote(pass_it)

        raise ValueError("pass_it must be either True or False.")
Esempio n. 9
0
    def force_vote(cls, pass_it):
        if pass_it is True or pass_it is False:
            return minqlx.force_vote(pass_it)

        raise ValueError("pass_it must be either True or False.")