Ejemplo n.º 1
0
def createpack(char, killer, corpse, pack):
	# A pack is actually a list of lists
	for item in pack:
		packchance = item[ PACK_CHANCE ]
		packstackable = item[ PACK_STACKABLE ]
		packamount = item[ PACK_AMOUNT ]
		packitem = item[ PACK_ITEM ]


		if packchance >= random.random():
			if type( packamount ) == str:
				amount = utilities.rolldice( packamount )
			else:
				amount = int( packamount )

			if packstackable == True:
				if type( packitem ) == list:
					itemid = random.choice( packitem )
				elif type( packitem ) == str:
					itemid = str( packitem )

				item = wolfpack.additem( itemid )
				item.amount = amount
				dropitem(item, char, corpse)

			else:
				for i in range(0, amount):
					if type( packitem ) == list:
						itemid = random.choice( packitem )
					elif type( packitem ) == str:
						itemid = str( packitem )

					item = wolfpack.additem(itemid)
					dropitem(item, char, corpse)
Ejemplo n.º 2
0
def createpack(char, killer, corpse, pack):
	if killer:
		luckChance = properties.luckchance(killer)
	else:
		luckChance = 0

	# A pack is actually a list of lists
	for item in pack:
		packchance = item[ PACK_CHANCE ]
		packstackable = item[ PACK_STACKABLE ]
		packamount = item[ PACK_AMOUNT ]
		packitem = item[ PACK_ITEM ]

		spawn = False

		if packchance >= random.random():
			spawn = True
			
		# There is a chance that the item will spawn anyway if the luck check
		# succeeds
		if not spawn:
			spawn = luckChance > random.randint(0, 9999)
			
		if spawn:
			if type( packamount ) == str:
				amount = utilities.rolldice( packamount )
			elif type( packamount ) == list:
				amount = random.randint( packamount[0], packamount[1] )
			else:
				amount = int( packamount )

			if packstackable == True:
				if type( packitem ) == list:
					itemid = random.choice( packitem )
				elif type( packitem ) == str:
					itemid = str( packitem )

				item = wolfpack.additem( itemid )
				item.amount = amount
				dropitem(item, char, corpse)

			else:
				for i in range(0, amount):
					if type( packitem ) == list:
						itemid = random.choice( packitem )
					elif type( packitem ) == str:
						itemid = str( packitem )
					
					if itemid == 'RANDOM_MAGIC_ITEM':
						# Select the item-id
						value = random.random()
						
						# 10% Jewelry
						if value > 0.90:
							citem = wolfpack.additem(random.choice(DEF_JEWELERY))
						# 10% Shield
						elif value > 0.80:
							citem = wolfpack.additem(random.choice(DEF_SHIELDS))
						# 40% Armor
						elif value > 0.40:
							citem = wolfpack.additem(random.choice(DEF_ARMOR))
						# 40% Weapon
						else:
							citem = wolfpack.additem(random.choice(DEF_ALLWEAPONS))
						
						maxproperties = item[ PACK_MAXPROPERTIES ]
						minintensity = item[ PACK_MININTENSITY ]
						maxintensity = item[ PACK_MAXINTENSITY ]						
						properties.applyRandom(citem, maxproperties, minintensity, maxintensity, luckChance)
					else:
						citem = wolfpack.additem(itemid)
										
					dropitem(citem, char, corpse)
Ejemplo n.º 3
0
def createpack(char, killer, corpse, pack):
    if killer:
        luckChance = properties.luckchance(killer)
    else:
        luckChance = 0

    # A pack is actually a list of lists
    for item in pack:
        packchance = item[PACK_CHANCE]
        packstackable = item[PACK_STACKABLE]
        packamount = item[PACK_AMOUNT]
        packitem = item[PACK_ITEM]

        # Check if the given item should spawn.
        spawn = packchance >= random.random()

        # This check has been greatly reduced in its power.
        # Now there just is a *second* check if you succeed
        # with your luck check.
        if not spawn and luckChance > random.randint(0, 9999):
            spawn = packchance >= random.random()

        if spawn:
            if type(packamount) == str:
                amount = utilities.rolldice(packamount)
            elif type(packamount) == list:
                amount = random.randint(packamount[0], packamount[1])
            else:
                amount = int(packamount)

            if packstackable == True:
                if type(packitem) == list:
                    itemid = random.choice(packitem)
                elif type(packitem) == str:
                    itemid = str(packitem)

                item = wolfpack.additem(itemid)
                item.amount = amount
                dropitem(item, char, corpse)

            else:
                for i in range(0, amount):
                    if type(packitem) == list:
                        itemid = random.choice(packitem)
                    elif type(packitem) == str:
                        itemid = str(packitem)

                    if itemid == 'RANDOM_MAGIC_ITEM':
                        # Select the item-id
                        value = random.random()

                        # 10% Jewelry
                        if value > 0.90:
                            citem = wolfpack.additem(
                                random.choice(DEF_JEWELERY))
                        # 10% Shield
                        elif value > 0.80:
                            citem = wolfpack.additem(
                                random.choice(DEF_SHIELDS))
                        # 40% Armor
                        elif value > 0.40:
                            citem = wolfpack.additem(random.choice(DEF_ARMOR))
                        # 40% Weapon
                        else:
                            citem = wolfpack.additem(
                                random.choice(DEF_ALLWEAPONS))

                        maxproperties = item[PACK_MAXPROPERTIES]
                        minintensity = item[PACK_MININTENSITY]
                        maxintensity = item[PACK_MAXINTENSITY]
                        properties.applyRandom(citem, maxproperties,
                                               minintensity, maxintensity,
                                               luckChance)
                    else:
                        citem = wolfpack.additem(itemid)

                    dropitem(citem, char, corpse)