From 492cff7bc7dba2921abaa761752402909b47f580 Mon Sep 17 00:00:00 2001 From: Morten Date: Tue, 2 Mar 2021 02:02:28 +0100 Subject: [PATCH] Exotic maps implemented --- cogs/pug.py | 41 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 39 insertions(+), 2 deletions(-) diff --git a/cogs/pug.py b/cogs/pug.py index 845a8af..edd944b 100644 --- a/cogs/pug.py +++ b/cogs/pug.py @@ -84,6 +84,34 @@ 'AS-TheDungeon]l[AL', ] +REGULAR_MAP_LIST = [ + 'AS-AsthenosphereSE', + 'AS-AutoRip', + 'AS-AutoRipSE_beta5', + 'AS-Ballistic', + 'AS-Bridge', + 'AS-BridgePV_beta6c', + 'AS-Desertstorm', + 'AS-Desolate][', + 'AS-Frigate', + 'AS-GolgothaAL', + 'AS-Golgotha][AL', + 'AS-Guardia', + 'AS-GuardiaAL', + 'AS-HiSpeed', + 'AS-Mazon', + 'AS-OceanFloor', + 'AS-OceanFloorAL', + 'AS-Overlord', + 'AS-RiverbedSE', + 'AS-Riverbed]l[AL', + 'AS-Riverbed]l[PE_beta3', + 'AS-Rook', + 'AS-Siege][', + 'AS-Submarinebase][', + 'AS-TheDungeon]l[AL', +] + # Server list: # List of Tuples, first element is the API reference, second element is the placeholder # Name / Description of the server, which is updated after a successful check. @@ -231,6 +259,8 @@ def __init__(self, maxMaps, pickMode, mapList): self.pickMode = pickMode self.availableMapsList = mapList self.maps = [] + # List of non regular maps in a maplist + self.exoticMaps = 0 def __contains__(self, map): return map in self.maps @@ -325,7 +355,14 @@ def addMap(self, index: int): return False map = self.getMapFromAvailableList(index) if map and map not in self: - self.maps.append(map) + # Check if 7 maps and if map chosen is non-regular. + if (map not in REGULAR_MAP_LIST) and (self.maxMaps == 7) and (self.exoticMaps != 2): + self.exoticMaps += 1 + self.maps.append(map) + elif (self.maxMaps == 7) and (self.exoticMaps == 2): + return False + else: + self.maps.append(map) return True return False @@ -1855,7 +1892,7 @@ async def map(self, ctx, idx: int): return if not self.pugInfo.pickMap(captain, mapIndex): - await ctx.send('Map already picked. Please, pick a different map.') + await ctx.send('Map already picked or maximum number of non-regular maps reached. Please, pick a different map.') msg = ['Maps chosen **({0} of {1})**:'.format(len(self.pugInfo.maps), self.pugInfo.maps.maxMaps)] msg.append(self.pugInfo.maps.format_current_maplist)