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
def brand_map(self): if self.get_cvar("qlx_brandingPrependMapName", bool): minqlx.set_configstring(3, self.game.map_title + " " + (self.get_cvar("qlx_serverBrandName"))) else: minqlx.set_configstring(3, (self.get_cvar("qlx_serverBrandName"))) cs = self.game.map_subtitle1 if cs: cs += " - " minqlx.set_configstring(678, cs + (self.get_cvar("qlx_serverBrandTopField"))) cs = self.game.map_subtitle2 if cs: cs += " - " minqlx.set_configstring(679, cs + (self.get_cvar("qlx_serverBrandBottomField"))) if self.get_cvar("qlx_rainbowBrandName", bool): # Thanks Mino for this bit! def rotating_colors(): i = 0 while True: res = (i % 7) + 1 i += 1 yield res map_name = minqlx.get_configstring(3) r = rotating_colors() res = "" for i in range(len(map_name)): res += "^{}{}".format(next(r), map_name[i]) minqlx.set_configstring(3, res)
def cmd_clan(self, player, msg, channel): index = 529 + player.id tag_key = _tag_key.format(player.steam_id) if len(msg) < 2: if tag_key in self.db: del self.db[tag_key] cs = minqlx.parse_variables(minqlx.get_configstring(index), ordered=True) del cs["cn"] del cs["xcn"] new_cs = "".join(["\\{}\\{}".format(key, cs[key]) for key in cs]).lstrip("\\") minqlx.set_configstring(index, new_cs) player.tell("The clan tag has been cleared.") else: player.tell("Usage to set a clan tag: ^4{} <clan_tag>".format(msg[0])) return minqlx.RET_STOP_EVENT if len(self.clean_text(msg[1])) > 5: player.tell("The clan tag can only be at most 5 characters long, excluding colors.") return minqlx.RET_STOP_EVENT # If the player already has a clan, we need to edit the current # configstring. We can't just append cn and xcn. tag = self.clean_tag(msg[1]) cs = minqlx.parse_variables(minqlx.get_configstring(index), ordered=True) cs["xcn"] = tag cs["cn"] = tag new_cs = "".join(["\\{}\\{}".format(key, cs[key]) for key in cs]) minqlx.set_configstring(index, new_cs) self.db[tag_key] = tag self.msg("{} changed clan tag to {}".format(player, tag)) return minqlx.RET_STOP_EVENT
def cmd_clan(self, player, msg, channel): index = 529 + player.id tag_key = _tag_key.format(player.steam_id) if len(msg) < 2: if tag_key in self.db: del self.db[tag_key] cs = minqlx.parse_variables(minqlx.get_configstring(index), ordered=True) del cs["cn"] del cs["xcn"] new_cs = "".join(["\\{}\\{}".format(key, cs[key]) for key in cs]).lstrip("\\") minqlx.set_configstring(index, new_cs) player.tell("The clan tag has been cleared.") else: player.tell("Usage to set a clan tag: ^6{} <clan_tag>".format(msg[0])) return minqlx.RET_STOP_EVENT if len(self.clean_text(msg[1])) > 5: player.tell("The clan tag can only be at most 5 characters long, excluding colors.") return minqlx.RET_STOP_EVENT # If the player already has a clan, we need to edit the current # configstring. We can't just append cn and xcn. tag = self.clean_tag(msg[1]) cs = minqlx.parse_variables(minqlx.get_configstring(index), ordered=True) cs["xcn"] = tag cs["cn"] = tag new_cs = "".join(["\\{}\\{}".format(key, cs[key]) for key in cs]) minqlx.set_configstring(index, new_cs) self.db[tag_key] = tag self.msg("{} changed clan tag to {}".format(player, tag)) return minqlx.RET_STOP_EVENT
def clan(self, tag): index = self.id + 529 cs = minqlx.parse_variables(minqlx.get_configstring(index), ordered=True) cs["xcn"] = tag cs["cn"] = tag new_cs = "".join(["\\{}\\{}".format(key, cs[key]) for key in cs]) minqlx.set_configstring(index, new_cs)
def set_map_subtitles(): cs = minqlx.get_configstring(678) if cs: cs += " - " minqlx.set_configstring(678, cs + "Running minqlx ^6{}^7 with plugins ^6{}^7." .format(minqlx.__version__, minqlx.__plugins_version__)) cs = minqlx.get_configstring(679) if cs: cs += " - " minqlx.set_configstring(679, cs + "Check ^6http://github.com/MinoMino/minqlx^7 for more details.")
def set_map_subtitles(): cs = minqlx.get_configstring(678) if cs: cs += " - " minqlx.set_configstring( 678, cs + "Running minqlx ^6{}^7 with plugins ^6{}^7.".format( minqlx.__version__, minqlx.__plugins_version__)) cs = minqlx.get_configstring(679) if cs: cs += " - " minqlx.set_configstring( 679, cs + "Check ^6http://github.com/MinoMino/minqlx^7 for more details.")
def __init__(self): self.add_hook("round_end", self.handle_round_end) self.add_hook("round_start", self.handle_round_start) self.add_hook("set_configstring", self.handle_set_configstring) self.add_hook("kamikaze_use", self.handle_kamikaze_use) self.add_hook("kamikaze_explode", self.handle_kamikaze_explode) # self.add_command("drop", self.cmd_drop_holdable) self.add_command("spawn_test", self.spawn_kamikaze, 2) # reload config string # it runs handle_set_configstring minqlx.set_configstring(CS_ITEMS, minqlx.get_configstring(CS_ITEMS)) self.enabled = False
def set_map_subtitles(): # We save the actual values before setting them so that we can retrieve them in Game. setattr(minqlx, "_map_title", minqlx.get_configstring(3)) setattr(minqlx, "_map_subtitle1", minqlx.get_configstring(678)) setattr(minqlx, "_map_subtitle2", minqlx.get_configstring(679)) cs = minqlx.get_configstring(678) if cs: cs += " - " minqlx.set_configstring(678, cs + "Running minqlx ^6{}^7 with plugins ^6{}^7." .format(minqlx.__version__, minqlx.__plugins_version__)) cs = minqlx.get_configstring(679) if cs: cs += " - " minqlx.set_configstring(679, cs + "Check ^6http://github.com/MinoMino/minqlx^7 for more details.")
def brand_map(self): if self.get_cvar("qlx_serverBrandName") == None: self.set_cvar("qlx_serverBrandName", self.game.map_title) if self.get_cvar("qlx_brandingPrependMapName", bool): topBranding = self.game.map_title + " " + self.get_cvar( "qlx_serverBrandName") else: topBranding = self.get_cvar("qlx_serverBrandName") if self.get_cvar("qlx_brandingAppendGameType", bool): minqlx.set_configstring(3, topBranding + " " + self.game.type) else: minqlx.set_configstring(3, topBranding) if self.get_cvar("qlx_serverBrandTopField") != None: cs = self.game.map_subtitle1 if cs: cs += " - " minqlx.set_configstring( 678, cs + (self.get_cvar("qlx_serverBrandTopField"))) if self.get_cvar("qlx_serverBrandBottomField") != None: cs = self.game.map_subtitle2 if cs: cs += " - " minqlx.set_configstring( 679, cs + (self.get_cvar("qlx_serverBrandBottomField"))) if self.get_cvar("qlx_rainbowBrandName", bool): # Thanks Mino for this bit! def rotating_colors(): i = 0 while True: res = (i % 7) + 1 i += 1 yield res map_name = self.clean_text(minqlx.get_configstring(3)) r = rotating_colors() res = "" for i in range(len(map_name)): res += "^{}{}".format(next(r), map_name[i]) minqlx.set_configstring(3, res)
def workshop_items(self, new_items): if hasattr(new_items, "__iter__"): minqlx.set_configstring( 715, " ".join([str(i) for i in new_items]) + " ") else: raise ValueError("The value needs to be an iterable.")
def brand_map(self): minqlx.set_configstring(3, (self.get_cvar("qlx_serverBrandName"))) minqlx.set_configstring(678, (self.get_cvar("qlx_serverBrandTopField"))) minqlx.set_configstring(679, (self.get_cvar("qlx_serverBrandBottomField")))
def cmd_clan(self, player, msg, channel): index = 529 + player.id tag_key = _tag_key.format(player.steam_id) if len(msg) < 2: if tag_key in self.db: del self.db[tag_key] cs = minqlx.parse_variables(minqlx.get_configstring(index), ordered=True) del cs["cn"] del cs["xcn"] new_cs = "".join([ "\\{}\\{}".format(key, cs[key]) for key in cs ]).lstrip("\\") minqlx.set_configstring(index, new_cs) player.tell("^3The clan tag has been cleared.") else: player.tell( "^3Usage to set a clan tag: ^6{} <clan_tag>".format( msg[0])) return minqlx.RET_STOP_EVENT cleanTag = self.clean_text(msg[1]) if len(cleanTag) > 5: player.tell( "^3The clan tag can only be at most 5 characters long, excluding colors." ) return minqlx.RET_STOP_EVENT tag = self.clean_tag(msg[1]) #The clan tag being added is checked if the player is not in the clan members list. if player.steam_id not in self.clanTagMembers: colors = self.get_cvar("qlx_clanmembersTagColors", bool) case = self.get_cvar("qlx_clanmembersLetterCase", bool) #Checks the tag if tag enforcement is not color or case specific. if not colors and not case: tempList = [] for tags in self.clanTag: tempList.append(self.clean_text(tags).lower()) if cleanTag.lower() in tempList: player.tell( "^3You must be added to the clan members list to put that tag on in this server." ) return minqlx.RET_STOP_EVENT #Checks the tag if tag enforcement is not color specific but is case specific. elif not colors: tempList = [] for tags in self.clanTag: tempList.append(self.clean_text(tags)) if cleanTag in tempList: player.tell( "^3You must be added to the clan members list to put that tag on in this server." ) return minqlx.RET_STOP_EVENT #Checks the tag if tag enforcement is not case specific but is color specific. elif not case: tempList = [] for tags in self.clanTag: tempList.append(tags.lower()) if tag.lower() in tempList: player.tell( "^3You must be added to the clan members list to put that tag on in this server." ) return minqlx.RET_STOP_EVENT #Checks the tag if tag enforcement is case and color specific. elif cleanTag in self.clanTag or tag in self.clanTag: player.tell( "^3You must be added to the clan members list to put that tag on in this server." ) return minqlx.RET_STOP_EVENT # If the player already has a clan, we need to edit the current # configstring. We can't just append cn and xcn. cs = minqlx.parse_variables(minqlx.get_configstring(index), ordered=True) cs["xcn"] = tag cs["cn"] = tag new_cs = "".join(["\\{}\\{}".format(key, cs[key]) for key in cs]) minqlx.set_configstring(index, new_cs) self.db[tag_key] = tag self.msg("{} changed clan tag to {}".format(player, tag)) return minqlx.RET_STOP_EVENT
def reference_steamworks(item_id): new_ref = minqlx.get_configstring(715) + "{} ".format(item_id) minqlx.set_configstring(715, new_ref)
def brand_map(self, map_name): """Brands map title with "<qlx_raceBrand> - map name". :param map_name: Current map """ brand_map = "{} - {}".format(self.get_cvar("qlx_raceBrand"), map_name) minqlx.set_configstring(3, brand_map)
def workshop_items(self, new_items): if hasattr(new_items, "__iter__"): minqlx.set_configstring(715, " ".join([str(i) for i in new_items]) + " ") else: raise ValueError("The value needs to be an iterable.")