示例#1
0
 def loadout(self, value):
     if isinstance(value, bool):
         minqlx.set_cvar("g_loadout", str(int(value)))
     elif value == 0 or value == 1:
         minqlx.set_cvar("g_loadout", str(value))
     else:
         raise ValueError("loadout needs to be 0, 1, or a bool.")
示例#2
0
 def tags(self, new_tags):
     if isinstance(new_tags, str):
         minqlx.set_cvar("sv_tags", new_tags)
     elif hasattr(new_tags, "__iter__"):
         minqlx.set_cvar("sv_tags", ",".join(new_tags))
     else:
         raise ValueError("tags need to be a string or an iterable returning strings.")
示例#3
0
 def loadout(self, value):
     if isinstance(value, bool):
         minqlx.set_cvar("g_loadout", str(int(value)))
     elif value == 0 or value == 1:
         minqlx.set_cvar("g_loadout", str(value))
     else:
         raise ValueError("loadout needs to be 0, 1, or a bool.")
示例#4
0
 def instagib(self, value: Union[bool, int]) -> None:
     if isinstance(value, bool):
         minqlx.set_cvar("g_instaGib", str(int(value)))
     elif value in [0, 1]:
         minqlx.set_cvar("g_instaGib", str(value))
     else:
         raise ValueError("instagib needs to be 0, 1, or a bool.")
示例#5
0
文件: _game.py 项目: zswin/minqlx
 def tags(self, new_tags):
     if isinstance(new_tags, str):
         minqlx.set_cvar("sv_tags", new_tags)
     elif hasattr(new_tags, "__iter__"):
         minqlx.set_cvar("sv_tags", ",".join(new_tags))
     else:
         raise ValueError("tags need to be a string or an iterable returning strings.")
示例#6
0
 def loadout(self, value: Union[bool, int]) -> None:
     if isinstance(value, bool):
         minqlx.set_cvar("g_loadout", str(int(value)))
     elif value in [0, 1]:
         minqlx.set_cvar("g_loadout", str(value))
     else:
         raise ValueError("loadout needs to be 0, 1, or a bool.")
示例#7
0
 def instagib(self, value):
     if isinstance(value, bool):
         minqlx.set_cvar("g_instaGib", str(int(value)))
     elif value == 0 or value == 1:
         minqlx.set_cvar("g_instaGib", str(value))
     else:
         raise ValueError("instagib needs to be 0, 1, or a bool.")
示例#8
0
 def instagib(self, value):
     if isinstance(value, bool):
         minqlx.set_cvar("g_instaGib", str(int(value)))
     elif value == 0 or value == 1:
         minqlx.set_cvar("g_instaGib", str(value))
     else:
         raise ValueError("instagib needs to be 0, 1, or a bool.")
示例#9
0
 def set_initial_fps(self, cvarval):
     if (cvarval != STD_SVFPS):
         if (self.check_value(cvarval, minqlx.CHAT_CHANNEL)):
             minqlx.set_cvar("sv_fps", str(cvarval), -1)
         else:
             self.msg("Will not set sv_fps to value of qlx_svfps as the latter contains an incompatible value.")
     else:
         pass 
示例#10
0
 def set_initial_fps(self, cvarval):
     if (cvarval != STD_SVFPS):
         if (self.check_value(cvarval, minqlx.CHAT_CHANNEL)):
             minqlx.set_cvar("sv_fps", str(cvarval), -1)
         else:
             self.msg(
                 "Will not set sv_fps to value of qlx_svfps as the latter contains an incompatible value."
             )
     else:
         pass
    def game_countdown(self):
        self.play_sound("sound/items/protect3.ogg")
        minqlx.set_cvar("g_infiniteAmmo", "0")
        if self.game.type_short != "duel":
            for p in self.players():
                p.noclip = True
                if self.purgersBirthday:
                    p.powerups(quad=10)
                else:
                    p.powerups(battlesuit=10)

        self.donation_message("Consider ^2!donating^7 to ^4The Purgery^7, it would really help a lot.")
示例#12
0
    def cmd_svfps(self, player, msg, channel):
        if len(msg) < 2:
            return minqlx.RET_USAGE

        try:
            sv_fps = int(msg[1])
        except ValueError:
            channel.reply("You must specify a positive integer greater than or equal to {}.".format(STD_SVFPS))
            return minqlx.RET_STOP

        if (self.check_value(sv_fps, channel)):
            minqlx.set_cvar("sv_fps", str(sv_fps), -1)
            channel.reply("sv_fps is now set to {}.".format(sv_fps))
示例#13
0
    def cmd_svfps(self, player, msg, channel):
        if len(msg) < 2:
            return minqlx.RET_USAGE

        try:
            sv_fps = int(msg[1])
        except ValueError:
            channel.reply(
                "You must specify a positive integer greater than or equal to {}."
                .format(STD_SVFPS))
            return minqlx.RET_STOP

        if (self.check_value(sv_fps, channel)):
            minqlx.set_cvar("sv_fps", str(sv_fps), -1)
            channel.reply("sv_fps is now set to {}.".format(sv_fps))
示例#14
0
    def set_cvar(cls, name, value, flags=0):
        """Sets a cvar. If the cvar exists, it will be set as if set from the console,
        otherwise create it.

        :param name: The name of the cvar.
        :type name: str
        :param value: The value of the cvar.
        :type value: Anything with an __str__ method.
        :param flags: The flags to set if, and only if, the cvar does not exist and has to be created.
        :type flags: int
        :returns: True if a new cvar was created, False if an existing cvar was set.
        :rtype: bool

        """
        if cls.get_cvar(name) is None:
            minqlx.set_cvar(name, value, flags)
            return True
        else:
            minqlx.console_command("{} \"{}\"".format(name, value))
            return False
示例#15
0
文件: _plugin.py 项目: zswin/minqlx
    def set_cvar(cls, name, value, flags=0):
        """Sets a cvar. If the cvar exists, it will be set as if set from the console,
        otherwise create it.

        :param name: The name of the cvar.
        :type name: str
        :param value: The value of the cvar.
        :type value: Anything with an __str__ method.
        :param flags: The flags to set if, and only if, the cvar does not exist and has to be created.
        :type flags: int
        :returns: True if a new cvar was created, False if an existing cvar was set.
        :rtype: bool

        """
        if cls.get_cvar(name) is None:
            minqlx.set_cvar(name, value, flags)
            return True
        else:
            minqlx.console_command("{} \"{}\"".format(name, value))
            return False
示例#16
0
    def set_cvar_limit(cls, name, value, minimum, maximum, flags=0):
        """Sets a cvar with upper and lower limits. If the cvar exists, it will be set
        as if set from the console, otherwise create it.

        :param name: The name of the cvar.
        :type name: str
        :param value: The value of the cvar.
        :type value: int, float
        :param minimum: The minimum value of the cvar.
        :type value: int, float
        :param maximum: The maximum value of the cvar.
        :type value: int, float
        :param flags: The flags to set if, and only if, the cvar does not exist and has to be created.
        :type flags: int
        :returns: True if a new cvar was created, False if an existing cvar was set.
        :rtype: bool

        """
        if cls.get_cvar(name) is None:
            minqlx.set_cvar(name, value, flags)
            return True
        else:
            minqlx.console_command("{} \"{}\"".format(name, value))
            return False
示例#17
0
文件: _plugin.py 项目: zswin/minqlx
    def set_cvar_limit(cls, name, value, minimum, maximum, flags=0):
        """Sets a cvar with upper and lower limits. If the cvar exists, it will be set
        as if set from the console, otherwise create it.

        :param name: The name of the cvar.
        :type name: str
        :param value: The value of the cvar.
        :type value: int, float
        :param minimum: The minimum value of the cvar.
        :type value: int, float
        :param maximum: The maximum value of the cvar.
        :type value: int, float
        :param flags: The flags to set if, and only if, the cvar does not exist and has to be created.
        :type flags: int
        :returns: True if a new cvar was created, False if an existing cvar was set.
        :rtype: bool

        """
        if cls.get_cvar(name) is None:
            minqlx.set_cvar(name, value, flags)
            return True
        else:
            minqlx.console_command("{} \"{}\"".format(name, value))
            return False
示例#18
0
def set_cvar_once(name: str, value: str, flags: int = 0) -> bool:
    if minqlx.get_cvar(name) is None:
        minqlx.set_cvar(name, value, flags)
        return True

    return False
示例#19
0
def set_cvar_once(name, value, flags=0):
    if minqlx.get_cvar(name) == None:
        minqlx.set_cvar(name, value, flags)
        return True

    return False
示例#20
0
 def fraglimit(self, new_limit: int) -> None:
     minqlx.set_cvar("fraglimit", str(new_limit))
示例#21
0
    def cmd_excessive_weaps(self, player, msg, channel):
        if len(msg) < 2:
            return minqlx.RET_USAGE

        if msg[1] == "on":
            minqlx.set_cvar("weapon_reload_sg", "200")
            minqlx.set_cvar("weapon_reload_rl", "200")
            minqlx.set_cvar("weapon_reload_rg", "50")
            minqlx.set_cvar("weapon_reload_prox", "200")
            minqlx.set_cvar("weapon_reload_pg", "40")
            minqlx.set_cvar("weapon_reload_ng", "800")
            minqlx.set_cvar("weapon_reload_mg", "40")
            minqlx.set_cvar("weapon_reload_hmg", "40")
            minqlx.set_cvar("weapon_reload_gl", "200")
            minqlx.set_cvar("weapon_reload_gauntlet", "100")
            minqlx.set_cvar("weapon_reload_cg", "30")
            minqlx.set_cvar("weapon_reload_bfg", "75")
            minqlx.set_cvar("qlx_excessive", "1")
            self.msg("Excessive weapons are enabled.")
        if msg[1] == "off":
            minqlx.console_command("reset weapon_reload_sg")
            minqlx.console_command("reset weapon_reload_rl")
            if (minqlx.get_cvar("pmove_airControl")) == "1":
                minqlx.set_cvar("weapon_reload_rg", "1200")
            else:
                minqlx.console_command("reset weapon_reload_rg")
            minqlx.console_command("reset weapon_reload_prox")
            minqlx.console_command("reset weapon_reload_pg")
            minqlx.console_command("reset weapon_reload_ng")
            minqlx.console_command("reset weapon_reload_mg")
            minqlx.console_command("reset weapon_reload_hmg")
            minqlx.console_command("reset weapon_reload_gl")
            minqlx.console_command("reset weapon_reload_gauntlet")
            minqlx.console_command("reset weapon_reload_cg")
            minqlx.console_command("reset weapon_reload_bfg")
            minqlx.set_cvar("qlx_excessive", "0")
            self.msg("Excessive weapons are disabled.")
示例#22
0
    def cmd_ruleset(self, player, msg, channel):
        if len(msg) < 2:
            return minqlx.RET_USAGE

        if msg[1].lower() == "pql":
            minqlx.set_cvar("pmove_airControl", "1")
            minqlx.set_cvar("pmove_rampJump", "1")
            minqlx.set_cvar("weapon_reload_rg", "1200")
            minqlx.set_cvar("pmove_weaponRaiseTime", "10")
            minqlx.set_cvar("pmove_weaponDropTime", "10")
            minqlx.set_cvar("g_damage_lg", "7")
            minqlx.set_cvar("dmflags", "60")
            if self.game.type_short == "ca":
                minqlx.set_cvar("g_startingHealth", "200")
                minqlx.set_cvar("g_startingArmor", "200")
            minqlx.console_command("map_restart")
            self.msg("PQL ruleset is now set.")

        if msg[1].lower() == "vql":
            minqlx.set_cvar("pmove_airControl", "0")
            minqlx.set_cvar("pmove_rampJump", "0")
            minqlx.set_cvar("weapon_reload_rg", "1500")
            minqlx.set_cvar("pmove_weaponRaiseTime", "200")
            minqlx.set_cvar("pmove_weaponDropTime", "200")
            minqlx.set_cvar("g_damage_lg", "6")
            if self.game.type_short == "ca":
                minqlx.set_cvar("dmflags", "28")
            else:
                minqlx.console_command("reset dmflags")
            minqlx.console_command("reset g_startingHealth")
            minqlx.console_command("reset g_startingArmor")
            minqlx.console_command("map_restart")
            self.msg("VQL ruleset is now set.")
 def map_load(self, mapname, factory):
     # turn on infinite ammo for warm-up
     minqlx.set_cvar("g_infiniteAmmo", "1")
     self.readyPlayers = []
示例#24
0
 def hostname(self, value):
     minqlx.set_cvar("sv_hostname", str(value))
示例#25
0
 def scorelimit(self, new_limit: int) -> None:
     minqlx.set_cvar("scorelimit", str(new_limit))
示例#26
0
    def cmd_ruleset(self, player, msg, channel):
        if len(msg) < 2:
            return minqlx.RET_USAGE
        
        if msg[1].lower() == "pql":
            minqlx.set_cvar("pmove_airControl", "1")
            minqlx.set_cvar("pmove_rampJump", "1")
            minqlx.set_cvar("weapon_reload_rg", "1200")
            minqlx.set_cvar("pmove_weaponRaiseTime", "10")
            minqlx.set_cvar("pmove_weaponDropTime", "10")
            minqlx.set_cvar("g_damage_lg", "7")
            minqlx.set_cvar("dmflags", "60")
            if self.game.type_short == "ca":
                minqlx.set_cvar("g_startingHealth", "200")
                minqlx.set_cvar("g_startingArmor", "200")
            minqlx.console_command("map_restart")
            self.msg("PQL ruleset is now set.")

        if msg[1].lower() == "vql":
            minqlx.set_cvar("pmove_airControl", "0")
            minqlx.set_cvar("pmove_rampJump", "0")
            minqlx.set_cvar("weapon_reload_rg", "1500")
            minqlx.set_cvar("pmove_weaponRaiseTime", "200")
            minqlx.set_cvar("pmove_weaponDropTime", "200")
            minqlx.set_cvar("g_damage_lg", "6")
            if self.game.type_short == "ca":
                minqlx.set_cvar("dmflags", "28")
            else:
                minqlx.console_command("reset dmflags")
            minqlx.console_command("reset g_startingHealth")
            minqlx.console_command("reset g_startingArmor")
            minqlx.console_command("map_restart")
            self.msg("VQL ruleset is now set.")
示例#27
0
 def capturelimit(self, new_limit: int) -> None:
     minqlx.set_cvar("capturelimit", str(new_limit))
示例#28
0
 def capturelimit(self, new_limit):
     minqlx.set_cvar("capturelimit", str(new_limit))
示例#29
0
 def roundtimelimit(self, new_limit):
     minqlx.set_cvar("roundtimelimit", str(new_limit))
示例#30
0
 def timelimit(self, new_limit):
     minqlx.set_cvar("timelimit", str(new_limit))
示例#31
0
 def teamsize(self, new_size: int) -> None:
     minqlx.set_cvar("teamsize", str(new_size))
示例#32
0
 def maxclients(self, new_limit: int) -> None:
     minqlx.set_cvar("sv_maxclients", str(new_limit))
示例#33
0
 def roundtimelimit(self, new_limit: int) -> None:
     minqlx.set_cvar("roundtimelimit", str(new_limit))
示例#34
0
文件: _core.py 项目: MinoMino/minqlx
def set_cvar_once(name, value, flags=0):
    if minqlx.get_cvar(name) is None:
        minqlx.set_cvar(name, value, flags)
        return True

    return False
示例#35
0
 def maxclients(self, new_limit):
     minqlx.set_cvar("sv_maxclients", str(new_limit))
示例#36
0
 def hostname(self, value):
     minqlx.set_cvar("sv_hostname", str(value))
示例#37
0
 def maxclients(self, new_limit):
     minqlx.set_cvar("sv_maxclients", str(new_limit))
示例#38
0
 def timelimit(self, new_limit):
     minqlx.set_cvar("timelimit", str(new_limit))
示例#39
0
 def fraglimit(self, new_limit):
     minqlx.set_cvar("fraglimit", str(new_limit))
示例#40
0
 def fraglimit(self, new_limit):
     minqlx.set_cvar("fraglimit", str(new_limit))
示例#41
0
 def scorelimit(self, new_limit):
     minqlx.set_cvar("scorelimit", str(new_limit))
示例#42
0
 def roundtimelimit(self, new_limit):
     minqlx.set_cvar("roundtimelimit", str(new_limit))
示例#43
0
 def teamsize(self, new_size):
     minqlx.set_cvar("teamsize", str(new_size))
示例#44
0
 def scorelimit(self, new_limit):
     minqlx.set_cvar("scorelimit", str(new_limit))
示例#45
0
 def capturelimit(self, new_limit):
     minqlx.set_cvar("capturelimit", str(new_limit))
示例#46
0
 def teamsize(self, new_size):
     minqlx.set_cvar("teamsize", str(new_size))
示例#47
0
 def cmd_excessive_weaps(self, player, msg, channel):
     if len(msg) < 2:
         return minqlx.RET_USAGE
     
     if msg[1] == "on":
         minqlx.set_cvar("weapon_reload_sg", "200")
         minqlx.set_cvar("weapon_reload_rl", "200")
         minqlx.set_cvar("weapon_reload_rg", "50")
         minqlx.set_cvar("weapon_reload_prox", "200")
         minqlx.set_cvar("weapon_reload_pg", "40")
         minqlx.set_cvar("weapon_reload_ng", "800")
         minqlx.set_cvar("weapon_reload_mg", "40")
         minqlx.set_cvar("weapon_reload_hmg", "40")
         minqlx.set_cvar("weapon_reload_gl", "200")
         minqlx.set_cvar("weapon_reload_gauntlet", "100")
         minqlx.set_cvar("weapon_reload_cg", "30")
         minqlx.set_cvar("weapon_reload_bfg", "75")
         minqlx.set_cvar("qlx_excessive", "1")
         self.msg("Excessive weapons are enabled.")
     if msg[1] == "off":
         minqlx.console_command("reset weapon_reload_sg")
         minqlx.console_command("reset weapon_reload_rl")
         if (minqlx.get_cvar("pmove_airControl")) == "1":
             minqlx.set_cvar("weapon_reload_rg", "1200")
         else:
             minqlx.console_command("reset weapon_reload_rg")
         minqlx.console_command("reset weapon_reload_prox")
         minqlx.console_command("reset weapon_reload_pg")
         minqlx.console_command("reset weapon_reload_ng")
         minqlx.console_command("reset weapon_reload_mg")
         minqlx.console_command("reset weapon_reload_hmg")
         minqlx.console_command("reset weapon_reload_gl")
         minqlx.console_command("reset weapon_reload_gauntlet")
         minqlx.console_command("reset weapon_reload_cg")
         minqlx.console_command("reset weapon_reload_bfg")
         minqlx.set_cvar("qlx_excessive", "0")
         self.msg("Excessive weapons are disabled.")
示例#48
0
 def hostname(self, value: str) -> None:
     minqlx.set_cvar("sv_hostname", str(value))