コード例 #1
0
 def __init__(self):
     self.inventory = inventory()
     self.stats = Stats()
     self.name = ""
     self.gender = ""
     self.ledger = ledger()
     self.stats.money = 0.0
コード例 #2
0
def main():
    clear()
    pack = inventory()
    print pack.display_inventory()
    potion = item(potion_dict)
    water_stone = item(water_stone_dict)
    print potion
    print pack.add_items(potion, 1)
    print pack.display_inventory()
    print "\n"
    print pack.add_items(potion, 1)
    print pack.add_items(item(poke_ball_dict), 5)
    print pack.add_items(item(superpotion_dict), 1)
    print pack.add_items(item(full_heal_dict), 1)
    print pack.add_items(item(full_restore_dict), 1)
    print pack.display_inventory('medicine')
    print pack.add_items(water_stone, 1)
    print pack.display_inventory()
    print "Get item {}\n".format(str(pack.get_item("Potion")))
    print "Get item {}\n".format(str(pack.get_item("Water Stone")))
    print "Get item {}\n".format(str(pack.get_item("Poke Ball")))
    print "Use item {}\n".format(str(pack.use_items("Poke Ball", 1)))
    print "Use item {}\n".format(str(pack.use_items("Super Potion", 1)))
    print "Use item {}\n".format(str(pack.use_items("Water Stone", 1)))
    print pack.display_inventory()
    print pack.display_inventory()
    #
    #
    input = "full "
    test_item = pack.get_item(input)
    if test_item is not None:
        print test_item.name
    else:
        print "RETURNED NONE\n"
コード例 #3
0
ファイル: item_test.py プロジェクト: reindels/Python-Pokemon
def main():
    clear()
    pack = inventory()
    print pack.display_inventory()
    potion = item(potion_dict)
    water_stone = item(water_stone_dict)
    print potion
    print pack.add_items(potion, 1)
    print pack.display_inventory()
    print "\n"
    print pack.add_items(potion, 1)
    print pack.add_items(item(poke_ball_dict), 5)
    print pack.add_items(item(superpotion_dict), 1)
    print pack.add_items(item(full_heal_dict), 1)
    print pack.add_items(item(full_restore_dict), 1)
    print pack.display_inventory("medicine")
    print pack.add_items(water_stone, 1)
    print pack.display_inventory()
    print "Get item {}\n".format(str(pack.get_item("Potion")))
    print "Get item {}\n".format(str(pack.get_item("Water Stone")))
    print "Get item {}\n".format(str(pack.get_item("Poke Ball")))
    print "Use item {}\n".format(str(pack.use_items("Poke Ball", 1)))
    print "Use item {}\n".format(str(pack.use_items("Super Potion", 1)))
    print "Use item {}\n".format(str(pack.use_items("Water Stone", 1)))
    print pack.display_inventory()
    print pack.display_inventory()
    #
    #
    input = "full "
    test_item = pack.get_item(input)
    if test_item is not None:
        print test_item.name
    else:
        print "RETURNED NONE\n"
コード例 #4
0
ファイル: player.py プロジェクト: dylanreed/anubus
def player():
	print "What would you like to do?"
	player_choice = raw_input("> ").lower()

	if player_choice in ['i','inventory']:
		print"inventory?"
		inventory()
		player()
	elif player_choice in ['m','move']:
		print "move"
		player()
	elif player_choice in ['e','exit']:
		print "good bye"
		exit(1)
	else:
		print "what?"
		player()
コード例 #5
0
ファイル: pybombs_ops.py プロジェクト: r00tb0x/pybombs
def remove(pkglist=None):
    nk = []
    inv = inventory()
    if (type(pkglist) == str):
        pkglist = [pkglist]

    if (pkglist == None):
        cats = get_catpkgs()
        catss = cats.keys()
        catss.sort()
        for cat in catss:
            #print "Category: %s"%(cat)
            cats[cat].sort()
            for pkg in cats[cat]:
                nk.append(pkg)

    else:
        for pkg in pkglist:
            nk.append(pkg)

    # determine all dependent packages to remove
    rblist = []
    for p in nk:  # find all packages that depend on the list
        pkg = global_recipes[p]
        rblist.append(p)
        rblist.extend(pkg.get_dependents())
    rblist = list(set(rblist))
    # uniquefy the list
    #print rblist;

    rmlist = []
    # remove currently uninstalled packages from list of pkgs
    for p in rblist:
        if (not global_recipes[p].satisfy()):
            rmlist.append(p)
        elif not inv.has(p):
            rmlist.append(p)
    for p in rmlist:
        rblist.remove(p)
    #print rblist;

    # remove effected packages
    print "\nRemoving the following packages: " + str(rblist)
    if rblist == []:
        print "\nNothing to do!"
        return
    confirm = raw_input("\nContinue (y or n) ")
    if (confirm == "y" or confirm == 'Y'):
        for p in rblist:  #
            try:
                pkg = global_recipes[p]
            except:
                die("package not found: %s" % (p))
            pkg.uninstall()
            print "uninstalled " + p
            clean(p)
    else:
        print "Operation cancelled!"
コード例 #6
0
ファイル: pybombs_ops.py プロジェクト: alick/pybombs
def remove(pkglist=None):
    nk = [];
    inv = inventory()
    if(type(pkglist) == str):
        pkglist = [pkglist];

    if(pkglist == None):
        cats = get_catpkgs();
        catss = cats.keys();
        catss.sort();
        for cat in catss:
            #print "Category: %s"%(cat)
            cats[cat].sort();
            for pkg in cats[cat]:
                nk.append(pkg);
                
    else:
        for pkg in pkglist:
            nk.append(pkg);
          
    # determine all dependent packages to remove        
    rblist = [];                
    for p in nk:  # find all packages that depend on the list
        pkg = global_recipes[p];
        rblist.append(p);
        rblist.extend(pkg.get_dependents());
    rblist = list(set(rblist)); # uniquefy the list
    #print rblist;
    
    rmlist = [];
    # remove currently uninstalled packages from list of pkgs
    for p in rblist:
        if(not global_recipes[p].satisfy()):
            rmlist.append(p);
        elif not inv.has(p):
            rmlist.append(p)
    for p in rmlist:
            rblist.remove(p);
    #print rblist;               

    # remove effected packages            
    print "\nRemoving the following packages: " + str(rblist)
    if rblist == []:
        print "\nNothing to do!"
        return
    confirm = raw_input("\nContinue (y or n) ")
    if(confirm=="y" or confirm=='Y'):
        for p in rblist: # 
            try:
                pkg = global_recipes[p];
            except:
                die("package not found: %s"%(p));
            pkg.uninstall();
            print "uninstalled "+p;
            clean(p);
    else:
        print "Operation cancelled!"
コード例 #7
0
 def __init__(self):
     
     self.basic = initialiseBasic()
     self.attributes = initialiseAttributes()
     self.vitality = initialiseVitality() 
     self.proficient_skills = initialiseProficientSkills()
     self.feats = initialiseFeats()
     self.skills = calculateSkills(self.attributes,self.proficient_skills,self.basic)
     self.inventory = inventory()
     self.equipped = equipped(self.inventory) 
     self.combat = calculateCombat(self.attributes,self.basic,self.equipped)
     self.spells = initialiseSpells()
コード例 #8
0
def set_inventory(trainer=None):
    pack = inventory()
    pack.trainer = trainer
    print pack.add_items(item(custom_ball_dict), 50)
    print pack.add_items(item(poke_ball_dict), 50)
    print pack.add_items(item(great_ball_dict), 50)
    print pack.add_items(item(ultra_ball_dict), 50)
    print pack.add_items(item(master_ball_dict), 1)
    print pack.add_items(item(superpotion_dict), 1)
    print pack.add_items(item(potion_dict), 5)
    print pack.add_items(item(superpotion_dict), 5)
    print pack.add_items(item(full_heal_dict), 5)
    print pack.add_items(item(revive_dict), 5)
    return pack
コード例 #9
0
def set_inventory(trainer=None):
    pack = inventory()
    pack.trainer = trainer
    print pack.add_items(item(custom_ball_dict), 50)
    print pack.add_items(item(poke_ball_dict), 50)
    print pack.add_items(item(great_ball_dict), 50)
    print pack.add_items(item(ultra_ball_dict), 50)
    print pack.add_items(item(master_ball_dict), 1)
    print pack.add_items(item(superpotion_dict), 1)
    print pack.add_items(item(potion_dict), 5)
    print pack.add_items(item(superpotion_dict), 5)
    print pack.add_items(item(full_heal_dict), 5)
    print pack.add_items(item(revive_dict), 5)
    return pack
コード例 #10
0
def main():
    inv = inventory("inventory.tsv")
    expireditems = []
    with open("expiredscan") as f:
        scannedbarcodes = f.readlines()

    for each in scannedbarcodes:
        each = each.rstrip()#get rid of newlines
        item = inv.findrecord(each)
        row = {}
        row["PARTNUMBER"] = item["PARTNUMBER"]
        row["ALTPARTNUMBER"] = item["ALTPARTNUMBER"]
        row["DESCRIPTION1"] = item["DESCRIPTION1"]
        row["STOCKONHAND"] = str(float(item["STOCKONHAND"])+1)
        print(row)
        expireditems.append(row)
    writeupdate(expireditems)
コード例 #11
0
ファイル: hot_bar.py プロジェクト: GrishdaFish/Ascension
 def use(self, game):
     if self.obj:
         if self.obj.item.spell:
             if self.obj.item.qty <= 1:
                 for slot in self.owner.slots:  # make sure any of the other slots that use this item are also removed
                     if slot.obj == self.obj and slot != self:
                         slot.remove_object()
                 self.obj.item.use(game.player.fighter.inventory, game.player, game)
                 self.remove_object()
             else:
                 self.obj.item.use(game.player.fighter.inventory, game.player, game)
         elif self.obj.equipment:
             pass
         return 'turn-used'
     else:
         chosen_item = inventory(self.con, game.player, game)
         if chosen_item:
             self.attach_object(chosen_item)
コード例 #12
0
ファイル: hot_bar.py プロジェクト: GrishdaFish/Ascension
 def use(self, game):
     if self.obj:
         if self.obj.item.spell:
             if self.obj.item.qty <= 1:
                 for slot in self.owner.slots:  # make sure any of the other slots that use this item are also removed
                     if slot.obj == self.obj and slot != self:
                         slot.remove_object()
                 self.obj.item.use(game.player.fighter.inventory,
                                   game.player, game)
                 self.remove_object()
             else:
                 self.obj.item.use(game.player.fighter.inventory,
                                   game.player, game)
         elif self.obj.equipment:
             pass
         return 'turn-used'
     else:
         chosen_item = inventory(self.con, game.player, game)
         if chosen_item:
             self.attach_object(chosen_item)
コード例 #13
0
    def __init__(self, vie=500, PO=1000, posX=2, posY=1, attaque=25, lvl=10):
        self.ranges = 2
        self.img = Global.guarde_de_la_porte
        self.kick = Kick.Kick()

        # definition du perso
        nom = "Guarde de la porte"
        desc = "Il ne compte quand même que pour un !"
        inv = inventory()

        super().__init__(self.img,
                         nom,
                         desc,
                         inv,
                         vie,
                         PO,
                         posX,
                         posY,
                         attaque,
                         lvl,
                         ranges=self.ranges)
コード例 #14
0
def create_trainer_2():
    tc = trainer_class(pokemon_trainer_dict)
    pokedex_dict = {
        'creator': "The Professor",
        'version': "1.0",
        'mode': "Local",
        'max entries': 150,
        'seen': 0,
        'obtained': 0,
        'local entries': dict(),
        'national entries': dict()
    }

    player_dict = {
        'name': 'Karl',
        'gender': 'Male',
        'age': 21,
        'region': 'Orre',
        'hometown': 'Gateon Port',
        'height': "{}\'{}\"".format(6, 1),
        'weight': "{} lbs.".format(175),
        'trainer class': trainer_class(pokemon_trainer_dict),
        'trainer id': generate_id(),
        'pokedex': None,
        'party': [],
        'badges': {},
        'money': 3000,
        'is player': True,
        'wins': 0,
        'losses': 0,
        'draws': 0
    }
    player = trainer(trainer_dict=player_dict)
    player.pokedex = pokedex(dex_dict=pokedex_dict, trainer=player)
    inv = inventory(inv_dict=test_inv_dict)
    inv.set_owner(player)
    player.inventory = set_inventory(trainer=player)
    #player.capture_pokemon(pokemon(gd=squirtle_d)._randomize_vital_statistics(set_level=5))
    return player
コード例 #15
0
def create_trainer_1():
        tc = trainer_class(pokemon_trainer_dict)
        pokedex_dict = {'creator': "The Professor", 'version': "1.0", 'mode': "Local", 'max entries': 150, 'seen': 0, 'obtained': 0, 
        'local entries': dict(), 'national entries': dict()}
        
        player_dict = {'name': 'Stefan', 'gender': 'Male', 'age': 23, 'region': 'Orre', 'hometown': 'Gateon Port',
                       'height': "{}\'{}\"".format(5,11),'weight': "{} lbs.".format(185),
                       'trainer class': trainer_class(pokemon_trainer_dict),
                       'trainer id': generate_id(),
                       'pokedex': None,
                       'party': [],
                       'badges': {},
                       'money': 3000,
                       'is player': True,
                       'wins': 0, 'losses': 0, 'draws': 0
                       }
        player = trainer(trainer_dict=player_dict)
        player.pokedex = pokedex(dex_dict=pokedex_dict, trainer=player)
        inv = inventory(inv_dict=test_inv_dict)
        inv.set_owner(player)
        player.inventory = set_inventory(trainer=player)
        #player.capture_pokemon(pokemon(gd=charmander_d)._randomize_vital_statistics(set_level=5))
        return player
コード例 #16
0
ファイル: globals.py プロジェクト: mbr0wn/pybombs
    prefix + "/lib/python2.6/site-packages", prefix + "/lib64/python2.6/",
    prefix + "/lib64/python2.6/site-packages",
    prefix + "/lib/python2.7/site-packages", prefix + "/share/",
    prefix + "/share/sip/"
]

try:
    for path in pathcheck:
        if (not os.path.exists(path)):
            os.mkdir(path)
except OSError, error:
    if error.errno == errno.EACCES:
        print "\n" + str(error)
        print(
            "Error! Configured install prefix requires root privileges. Please re-run as sudo!"
        )
        exit(error.errno)

vars = vars_init(config)
vars = vars_defaults(vars)

env = env_init(vars)

global_recipes = {}
inv = inventory()


def die(s):
    print s
    sys.exit(-1)
コード例 #17
0
ファイル: globals.py プロジェクト: SPLURGE831/pybombs
                prefix + "/lib/python2.6/", prefix + "/lib/python2.6/site-packages",
                prefix + "/lib64/python2.6/", prefix + "/lib64/python2.6/site-packages",
                prefix + "/lib/python2.7/site-packages", prefix + "/share/", 
                prefix + "/share/sip/"]

try:
    for path in pathcheck:
        if(not os.path.exists(path)):
            os.mkdir(path);
except OSError, error:
    if error.errno == errno.EACCES:
        print "\n" + str(error)
        print("Error! Configured install prefix requires root privileges. Please re-run as sudo!")
        exit(error.errno)


vars = vars_init(config);
vars = vars_defaults(vars);

env = env_init(vars);

global_recipes = {};
inv = inventory();

def die(s):
    print s;
    sys.exit(-1);



コード例 #18
0
ファイル: globals.py プロジェクト: refkywijaya/pybombs_legacy
        path = os.path.expanduser(path)
        if (not os.path.exists(path)):
            os.mkdir(path)
except OSError, error:
    if error.errno == errno.EACCES:
        print "\n" + str(error)
        print(
            "Error! Configured install prefix requires root privileges. Please re-run as sudo!"
        )
        exit(error.errno)

vars = vars_init(config)
vars = vars_defaults(vars)

env = env_init(vars)

global_recipes = {}
if str(os.environ.get('PYBOMBS_SDK')) == 'True':
    inv = inventory(str(config.get('config', 'inv')))
    written_env = env_init(vars, 'device_prefix')
    destination_key = 'sandbox'
else:
    inv = inventory()
    written_env = env
    destination_key = 'prefix'


def die(s):
    print s
    sys.exit(-1)
コード例 #19
0
def main():
    input("게임을 시작하려면 엔터")

    print("\n" * 38)

    try:
        import save
    except:

        player_name = input("\n플레이어 이름을 입력하십시오. = ")
        while player_name == "":
            print("\n유효한 이름을 입력하십시오")
            player_name = input("플레이어 이름을 입력하십시오. = ")

        player_1 = Player(player_name, 1, 0, [], [], [], 0, 0, 0)
        plag = 0

    time.sleep(1.3)
    print('\n' * 2)
    print("정상적으로 로그인 되었습니다.")
    time.sleep(0.7)
    print("정보 불러오는 중...")
    time.sleep(0.7)
    print(f"환영합니다. {player_name}님")
    time.sleep(1)

    while True:

        print("\n" * 38)

        turn_chack(player_1)  # 아레나, 스텟(레벨)

        player_1.showinfo()

        print(f"나의스텟 (힘,민첩,모험) : {po_count}/{ag_count}/{ad_count}")

        if plag == 0:
            print("\n도움을 원한다면 'z' 입력")

        ans = input("\n무엇을 하시겠습니까? : ")

        if ans == "q" or ans == "w" or ans == "e" or ans == "r" or ans == "t" or ans == "y":
            match(player_1)
        elif ans == "a":
            martial_arts_inventory(player_1)
        elif ans == "s":
            inventory(player_1, 'item')
            continue
        elif ans == "d":
            showshop(player_1)
            continue
        elif ans == "z":
            print(
                "\n게임설명\n전투시작 : q,w,e,r,t,y\n무술 장착 및 해제 : a\n인벤토리 : s\n상점 : d\n도움말 : z\n게임종료 : p\
                    \n한국어를 웬만하면 누르지 마세요.(버그의 원인이 됩니다.)\n다 읽으셨다면 enter.")
            input()
        elif ans == "p":
            game_over()
        else:
            print("다시 입력해 주십시오")

        plag += 1
コード例 #20
0
ファイル: globals.py プロジェクト: newman/pybombs
        if(not os.path.exists(path)):
            os.mkdir(path);
except OSError, error:
    if error.errno == errno.EACCES:
        print "\n" + str(error)
        print("Error! Configured install prefix requires root privileges. Please re-run as sudo!")
        exit(error.errno)


vars = vars_init(config);
vars = vars_defaults(vars);

env = env_init(vars);

global_recipes = {};
if str(os.environ.get('PYBOMBS_SDK')) == 'True':
    inv = inventory(str(config.get('config', 'inv')));
    written_env = env_init(vars, 'device_prefix');
    destination_key = 'sandbox'
else:
    inv = inventory();
    written_env = env;
    destination_key = 'prefix'

def die(s):
    print s;
    sys.exit(-1);