def newGame(): v.playerHealth = v.Attributes["Max Health"] v.p_class.prevHealth = v.playerHealth v.playerMana = v.Attributes["Max Mana"] #entityClasses.Enemy(0, -60, 1, "Resources/Images/EnemySkins/Generic Goblin.png", {"Name": "Groblin Lvl. 1", "Health":5, "Attack":5, "Speed":1.5}) #entityClasses.NPC((0, 30, "Down", 1), "Resources/Images/NpcSkins/Spritesheets/Male_Basic.png", {"Name":"Fred", "Conversation":cn}) v.inventory.add(itemClasses.item("Thing", py.image.load("Resources/Images/XPOrb.png").convert_alpha())) v.inventory.add(itemClasses.weapon("Magic Orb", entityClasses.SpriteSheet("Resources/Images/WeaponIcons.png", 8, 12).images[56], "manaOrb", "Resources/Images/castOrbPurple.png", {"Damage":2, "Knockback": 10, "Cooldown": 60})) v.inventory.add(itemClasses.weapon("Broken Sword", entityClasses.SpriteSheet("Resources/Images/WeaponIcons.png", 8, 12).images[0], "swing", "Resources/Images/Sword_1.png", {"Damage":2, "Knockback": 10, "Cooldown": 30, "AttSpeed": 16})) v.inventory.add(itemClasses.weapon("Short Bow", entityClasses.SpriteSheet("Resources/Images/WeaponIcons.png", 8, 12).images[72], "shoot", "Resources/Images/Arrow.png", {"Damage":2, "Knockback": 10, "Cooldown": 20, "Range": 20})) entityClasses.droppedItem(itemClasses.item("Thing", py.image.load("Resources/Images/XPOrb.png").convert_alpha()), (0, 0)) fb = itemClasses.spell("Fire Beam", "beam", "Resources/Images/fireBeam.png", "Resources/Images/redCastCircle.png", "Resources/Images/Spell Icons/fireBeam.png", {"Damage": 0.2, "Knockback": "S", "Cooldown": 5, "Mana": 10, "InvulnMod": 0}) ls = itemClasses.spell("Lightning Storm", "lightning", "Resources/Images/lightningStorm.png", "Resources/Images/blueCastCircle.png", "Resources/Images/Spell Icons/chainLightning.png", {"Damage": 0.4, "Knockback": 1, "Cooldown": 5, "Mana": 10, "InvulnMod": 0.5}) v.abilities["1"] = fb v.abilities["2"] = ls
def Load(): savefile = open("Saves/Variables.save", "rb") save = pickle.load(savefile) print("LOADED:", save) v.Attributes = save["Attributes"] v.playerPosX = save["playerPosX"] v.playerPosY = save["playerPosY"] v.playerDirection = save["playerDirection"] v.playerHealth = save["playerHealth"] v.playerMana = save["playerMana"] v.experience = save["experience"] v.xpMod = save["xpMod"] v.skillPoints = save["skillPoints"] v.appearance = save["appearance"] v.playerName = save["playerName"] v.mapNum = save["mapNum"] savefile = open("Saves/Entities.save", "rb") save = pickle.load(savefile) for thing in save: if thing["ID"] == "enemy": ne = entityClasses.Enemy(blank=True) ne.load(thing) if thing["ID"] == "npc": ne = entityClasses.NPC(blank=True) ne.load(thing) savefile = open("Saves/Inventory.save", "rb") save = pickle.load(savefile) for k, va in save["eSave"].items(): if k == "Weapon": v.equipped[k] = itemClasses.weapon(va["name"], va["icon"], va["attType"], va["image"], va["attributes"]) for item in save["iSave"]: if item["equipType"] == "Item": v.inventory.contents.append(itemClasses.item(item["name"], item["icon"])) if item["equipType"] == "Weapon": v.inventory.contents.append(itemClasses.weapon(item["name"], item["icon"], item["attType"], item["image"], item["attributes"])) print(save["aSave"]) for k, item in save["aSave"].items(): v.abilities[k] = itemClasses.spell(item["name"], item["spellType"], item["spellImage"], item["castImage"], item["icon"], item["attributes"]) for item in save["qSave"]: npcScripts.quest(item["Name"], item["Type"], item["Data"])
def createItemsFromItemTypeList(browser, itemTypeList, productCategory, color, navigateBackTo, gender=None): navigationFunctionsObject = navigationFunctions.NavigationFunctions() productMethodsObject = generateProductMethods.generateProductMethods() for itemType in itemTypeList: navigationFunctionsObject.goToChooseProduct(browser) waitForPageLoad() if navigateBackTo == 'Mens all-over shirts': navigationFunctionsObject.navigateToMensAllOverShirts(browser) elif navigateBackTo == 'Womens all-over shirts': navigationFunctionsObject.navigateToWomensAllOverShirts(browser) elif navigateBackTo == 'Sweatshirts': navigationFunctionsObject.navigateToSweatshirts(browser) elif navigateBackTo == 'Mens shorts': navigationFunctionsObject.navigateToMensShorts(browser) elif navigateBackTo == 'Mens leggings': navigationFunctionsObject.navigateToMensLeggings(browser) elif navigateBackTo == 'Womens leggings': navigationFunctionsObject.navigateToWomensLeggings(browser) elif navigateBackTo == 'Womens swimwear': navigationFunctionsObject.navigateToWomensSwimwear(browser) elif navigateBackTo == 'Kids all-over shirts': navigationFunctionsObject.navigateToKidsAllOverShirts(browser) elif navigateBackTo == 'Kids leggings': navigationFunctionsObject.navigateToKidsLeggings(browser) elif navigateBackTo == 'Kids swimwear': navigationFunctionsObject.navigateToKidsSwimwear(browser) elif navigateBackTo == 'Bags': navigationFunctionsObject.navigateToBags(browser) elif navigateBackTo == 'Flip-Flops': navigationFunctionsObject.navigateToFlipFlops(browser) waitForPageLoad() newItem = itemClasses.item(itemType, productCategory, color, gender) productMethodsObject.createNewProduct(browser, newItem)
import itemClasses from pprint import pprint newItem = itemClasses.item("prodStyle", "prodType", "color", gender='Mens') # newShirt = itemClasses.Shirt("prodStyle", "prodType", "color", True, gender='Mens') pprint(newItem.__dict__, indent=2) print(newItem)