def change_rotation(connection, *pre_maps): """ Change the current map rotation and informs everyone on the server of it /rotation <map1> ... <mapN> """ name = connection.name protocol = connection.protocol maps, map_list = parse_maps(pre_maps) if len(maps) == 0: return 'Usage: /rotation <map1> <map2> <map3> ...' try: protocol.set_map_rotation(maps) except MapNotFound as e: return 'Invalid map in map rotation (%s)' % e.map protocol.send_chat("%s changed map rotation to %s." % (name, map_list), irc=True)
def change_planned_map(connection, *pre_maps): """ Set the next map to be loaded after current game ends and inform everyone of it /map <mapname> """ name = connection.name protocol = connection.protocol # parse seed numbering maps, _map_list = parse_maps(pre_maps) if not maps: return 'Invalid map name' planned_map = maps[0] try: protocol.planned_map = check_rotation([planned_map])[0] protocol.send_chat('%s changed next map to %s' % (name, planned_map), irc=True) except MapNotFound: return 'Map %s not found' % (maps[0])
def rotation_add(connection, *pre_maps): """ Append a given map to the current map rotation and informs everyone on the server of it /rotationadd <map> """ name = connection.name protocol = connection.protocol new_maps, map_list = parse_maps(pre_maps) maps = connection.protocol.get_map_rotation() map_list = ", ".join(maps) + map_list maps.extend(new_maps) try: protocol.set_map_rotation(maps, False) except MapNotFound as e: return 'Invalid map in map rotation (%s)' % e.map protocol.send_chat("%s added %s to map rotation." % (name, " ".join(pre_maps)), irc=True)