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.")
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.")
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.")
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.")
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.")
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 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.")
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))
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))
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
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
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
def set_cvar_once(name, value, flags=0): if minqlx.get_cvar(name) == None: minqlx.set_cvar(name, value, flags) return True return False
def fraglimit(self, new_limit: int) -> None: minqlx.set_cvar("fraglimit", str(new_limit))
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.")
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 = []
def hostname(self, value): minqlx.set_cvar("sv_hostname", str(value))
def scorelimit(self, new_limit: int) -> None: minqlx.set_cvar("scorelimit", str(new_limit))
def capturelimit(self, new_limit: int) -> None: minqlx.set_cvar("capturelimit", str(new_limit))
def capturelimit(self, new_limit): minqlx.set_cvar("capturelimit", str(new_limit))
def roundtimelimit(self, new_limit): minqlx.set_cvar("roundtimelimit", str(new_limit))
def timelimit(self, new_limit): minqlx.set_cvar("timelimit", str(new_limit))
def teamsize(self, new_size: int) -> None: minqlx.set_cvar("teamsize", str(new_size))
def maxclients(self, new_limit: int) -> None: minqlx.set_cvar("sv_maxclients", str(new_limit))
def roundtimelimit(self, new_limit: int) -> None: minqlx.set_cvar("roundtimelimit", str(new_limit))
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
def maxclients(self, new_limit): minqlx.set_cvar("sv_maxclients", str(new_limit))
def fraglimit(self, new_limit): minqlx.set_cvar("fraglimit", str(new_limit))
def scorelimit(self, new_limit): minqlx.set_cvar("scorelimit", str(new_limit))
def teamsize(self, new_size): minqlx.set_cvar("teamsize", str(new_size))
def hostname(self, value: str) -> None: minqlx.set_cvar("sv_hostname", str(value))