| import random as r | import random as r | ||||
| import argparse | import argparse | ||||
| import sys | |||||
| beg = ["a","e","i","o","u","ba","be","bi","bo","bu","by","y","da","de","di","do","du","dy","fa","fi","fo","fe","fu","ga","ge","gi","go","gu","ka","ke","ki","ko","ku","ky","ma","me","mi","mo","mu","na","ne","ni","no","nu","pa","pe","pi","po","pu","ra","re","ri","ro","ru","ry","sa","se","si","so","su","ta","te","ti","to","tu","ty","wa","we","wi","wo","wy","za","ze","zi","zo","zu","zy"] | beg = ["a","e","i","o","u","ba","be","bi","bo","bu","by","y","da","de","di","do","du","dy","fa","fi","fo","fe","fu","ga","ge","gi","go","gu","ka","ke","ki","ko","ku","ky","ma","me","mi","mo","mu","na","ne","ni","no","nu","pa","pe","pi","po","pu","ra","re","ri","ro","ru","ry","sa","se","si","so","su","ta","te","ti","to","tu","ty","wa","we","wi","wo","wy","za","ze","zi","zo","zu","zy"] | ||||
| mid = beg + ["l","x","n","r"] | mid = beg + ["l","x","n","r"] | ||||
| self.career = "" | self.career = "" | ||||
| elif isinstance(career, str): | elif isinstance(career, str): | ||||
| self.career = career | self.career = career | ||||
| elif isinstance(career, int) and career < len(Campaign.CAREERS): | |||||
| elif isinstance(career, int) and career < len(Character.CAREERS): | |||||
| self.career = [x for x in Character.CAREERS if x["id"] == career][0]["name"] | self.career = [x for x in Character.CAREERS if x["id"] == career][0]["name"] | ||||
| else: | else: | ||||
| self.career = "" | self.career = "" | ||||
| self.stats = stats if stats != None else [] | self.stats = stats if stats != None else [] | ||||
| if gadget == None: | if gadget == None: | ||||
| self.gadget = "" | self.gadget = "" | ||||
| elif isinstance(gadget, str) or isinstance(gadget, object): | |||||
| elif isinstance(gadget, str) or isinstance(gadget, dict): | |||||
| self.gadget = gadget | self.gadget = gadget | ||||
| elif isinstance(gadget, int) and gadget < len(Campaign.GADGETS): | |||||
| self.gadget = [x for x in Character.GADGETS if x["id"] == gadget][0] | |||||
| else: | else: | ||||
| self.gadget = "" | |||||
| self.gadget = next((x for x in Character.GADGETS if x["id"] == gadget), "") | |||||
| self.generate() | self.generate() | ||||
| def generate(self): | def generate(self): | ||||
| def decode_key(self, pw): | def decode_key(self, pw): | ||||
| densePwd = pw.replace(" ", "") | densePwd = pw.replace(" ", "") | ||||
| if densePwd == "PACKTACTICS!------------------------------------------------------------------------------------": | |||||
| if len(densePwd) != 84: | |||||
| print("This password is not valid. If this is a password that this generator created, please email noelle@noelle.codes and let me know.") | |||||
| sys.exit(0) | |||||
| if densePwd[:12] == "PACKTACTICS!": | |||||
| # Create a campaign featuring the Season 3 Pack Tactics crew. | # Create a campaign featuring the Season 3 Pack Tactics crew. | ||||
| self.ship = Ship("Red", "Star", "is maneuverable & unarmored", "has a politician who thinks they're in charge of it") | self.ship = Ship("Red", "Star", "is maneuverable & unarmored", "has a politician who thinks they're in charge of it") | ||||
| self.params = Plot() | self.params = Plot() | ||||
| # self.print_params() | # self.print_params() | ||||
| # self.print_chars() | # self.print_chars() | ||||
| return | return | ||||
| elif densePwd == "JUSTINBAILEY------------------------------------------------------------------------------------": | |||||
| elif densePwd[:12] == "JUSTINBAILEY": | |||||
| # Create a random campaign, but everyone's Gadget is a leotard that somehow is also an environment suit | # Create a random campaign, but everyone's Gadget is a leotard that somehow is also an environment suit | ||||
| self.create_campaign(n=6, makeChars=True) | self.create_campaign(n=6, makeChars=True) | ||||
| for c in self.characters: | for c in self.characters: | ||||
| # self.print_params() | # self.print_params() | ||||
| # self.print_chars() | # self.print_chars() | ||||
| return | return | ||||
| elif densePwd == "NARPASSWORD------------------------------------------------------------------------------------": | |||||
| elif densePwd[:12] == "NARPASSWORD": | |||||
| # Create a random campaign, but all the kobolds' stats are set to 6 | # Create a random campaign, but all the kobolds' stats are set to 6 | ||||
| self.create_campaign(n=6, makeChars=True) | self.create_campaign(n=6, makeChars=True) | ||||
| for c in self.characters: | for c in self.characters: | ||||
| # Character 6 gadget: 7 bits | # Character 6 gadget: 7 bits | ||||
| i,j = j,j+7 | i,j = j,j+7 | ||||
| outkey["char6gad"] = int(self.newBitfield[i:j], 2) | outkey["char6gad"] = int(self.newBitfield[i:j], 2) | ||||
| print(self.newBitfield) | |||||
| print(outkey) | |||||
| #print(self.newBitfield) | |||||
| #print(outkey) | |||||
| self.ship = Ship(Ship.NAME1[outkey["sname1"]], Ship.NAME2[outkey["sname2"]], Ship.GQUAL[outkey["gqual"]], Ship.BQUAL[outkey["bqual"]]) | self.ship = Ship(Ship.NAME1[outkey["sname1"]], Ship.NAME2[outkey["sname2"]], Ship.GQUAL[outkey["gqual"]], Ship.BQUAL[outkey["bqual"]]) | ||||
| self.params = Plot(loc_desc=Plot.loc1[outkey["loc1"]], locIndex=outkey["loc2"], battlefield=outkey["battlefield"], location=None, missIndex=outkey["miss"], oops=outkey["oops"], mission=None, probIndex=outkey["prob1"], problem=None, probName=self.decode_name(outkey["prob1name"]), secProblem=outkey["prob2"], thirdProblem=None) | self.params = Plot(loc_desc=Plot.loc1[outkey["loc1"]], locIndex=outkey["loc2"], battlefield=outkey["battlefield"], location=None, missIndex=outkey["miss"], oops=outkey["oops"], mission=None, probIndex=outkey["prob1"], problem=None, probName=self.decode_name(outkey["prob1name"]), secProblem=outkey["prob2"], thirdProblem=None) | ||||
| self.art = "an" if self.params.loc_desc[0] in ["a","e","i","o","u"] else "a" | self.art = "an" if self.params.loc_desc[0] in ["a","e","i","o","u"] else "a" |