Beispiel #1
0
def potion( char, potion, potiontype ):
	socket = char.socket
	if not canUsePotion( char, potion ):
		return False

	# Remove an old bonus
	if char.hastag( 'nightsight' ):
		bonus = char.gettag( 'nightsight' )
		char.lightbonus = max( 0, char.lightbonus - bonus )

	# With 100% magery you gain a 18 light level bonus (min. 5)
	bonus = max( 8, min( 18, math.floor( 18 * ( char.skill[MAGERY] / 1000.0 ) ) ) )

	char.addscript( 'magic.nightsight' )
	char.settag( 'nightsight', bonus )
	char.settag( 'nightsight_start', wolfpack.time.minutes() )
	char.lightbonus += bonus

	if char.socket:
		socket.updatelightlevel()

	char.action( ANIM_FIDGET3 )
	char.soundeffect( 0x1e3 )
	char.effect( 0x376a, 9, 32 )
	consumePotion( char, potion, POTIONS[ potiontype ][ POT_RETURN_BOTTLE ] )
	return True
Beispiel #2
0
def potion( char, potion, refreshtype ):
	socket = char.socket

	if not canUsePotion( char, potion ):
		return False

	# refresh potion
	if refreshtype == 18:
		amount = char.maxstamina / 4
		
		# Apply Enhancepotions Bonus
		enhancepotions = properties.fromchar(char, ENHANCEPOTIONS)
		if enhancepotions > 0:
			amount += (enhancepotions * amount) / 100
							
		char.stamina = min(char.maxstamina, char.stamina + amount)
		char.updatestamina()
	# total refresh potion
	elif refreshtype == 19:
		char.stamina = char.maxstamina
		char.updatestamina()
	else:
		return False

	if char.stamina > char.maxstamina:
		char.stamina = char.maxstamina
		char.updatestamina()
		return False

	char.action( ANIM_FIDGET3 )
	char.soundeffect( SOUND_DRINK1 )
	consumePotion( char, potion, POTIONS[ refreshtype ][ POT_RETURN_BOTTLE ] )
	return True
Beispiel #3
0
def potion( char, potion, healtype ):
	socket = char.socket
	if not canUsePotion( char, potion ):
		return False

	if char.poison > -1 or ismortallywounded(char):
		# You can not heal yourself in your current state.
		socket.clilocmessage(1005000)
		return False

	if char.hitpoints >= char.maxhitpoints:
		socket.clilocmessage(1049547)
		if char.hitpoints > char.maxhitpoints:
			char.hitpoints = char.maxhitpoints
			char.updatehealth()
		return False

	# Compare
	if socket.hastag('heal_pot_timer'):
		elapsed = int( socket.gettag( "heal_pot_timer" ) )
		if elapsed > time.time():
			# Broken Timer
			if time.time() - elapsed > HEAL_POT_DELAY:
				socket.deltag('heal_pot_timer')
			else:
				socket.clilocmessage( 500235 ) # You must wait 10 seconds before using another healing potion.
				return False

	socket.settag( "heal_pot_timer", time.time() + HEAL_POT_DELAY)
	amount = 0

	# Lesser Heal
	if healtype == 1:
		amount = random.randint( POTION_LESSERHEAL_RANGE[0], POTION_LESSERHEAL_RANGE[1] )
	# Heal
	elif healtype == 2:
		amount = random.randint( POTION_HEAL_RANGE[0], POTION_HEAL_RANGE[1] )
	# Greater Heal
	elif healtype == 3:
		amount = random.randint( POTION_GREATERHEAL_RANGE[0], POTION_GREATERHEAL_RANGE[1] )

	# Apply Enhancepotions Bonus
	enhancepotions = properties.fromchar(char, ENHANCEPOTIONS)
	if enhancepotions > 0:
		amount += (enhancepotions * amount) / 100

	char.hitpoints = min( char.hitpoints + amount, char.maxhitpoints ) # We don't heal over our maximum health

	# Resend Health
	char.updatehealth()
	char.socket.clilocmessage( 1060203, unicode(amount) )

	char.action( ANIM_FIDGET3 )
	char.soundeffect( SOUND_DRINK1 )
	consumePotion( char, potion, POTIONS[ healtype ][ POT_RETURN_BOTTLE ] )

	return True
Beispiel #4
0
def potion(char, potion, manatype):
    socket = char.socket
    if not canUsePotion(char, potion):
        return False

    if char.mana >= char.maxmana:
        socket.sysmessage(tr('You are already at full mana.'))
        if char.mana > char.maxmana:
            char.mana = char.maxmana
            char.updatemana()
        return False

    # Compare
    if socket.hastag('mana_pot_timer'):
        elapsed = int(socket.gettag('mana_pot_timer'))
        if elapsed > time.time():
            # Broken Timer
            if time.time() - elapsed > MANA_POT_DELAY:
                socket.deltag('mana_pot_timer')
            else:
                socket.sysmessage(
                    tr('You must wait a few seconds before using another mana potion.'
                       ))
                return False

    socket.settag('mana_pot_timer', time.time() + MANA_POT_DELAY)
    amount = 0

    # Lesser Mana
    if manatype == 22:
        amount = randint(POTION_LESSERMANA_RANGE[0],
                         POTION_LESSERMANA_RANGE[1])
    # Mana
    elif manatype == 23:
        amount = randint(POTION_MANA_RANGE[0], POTION_MANA_RANGE[1])
    # Greater Mana
    elif manatype == 24:
        amount = randint(POTION_GREATERMANA_RANGE[0],
                         POTION_GREATERMANA_RANGE[1])

    # Apply Enhancepotions Bonus
    enhancepotions = properties.fromchar(char, ENHANCEPOTIONS)
    if enhancepotions > 0:
        amount += (enhancepotions * amount) / 100

    char.mana = min(char.mana + amount,
                    char.maxmana)  # We don't add mana over our maximum mana

    # Resend Mana
    char.updatemana()

    char.action(ANIM_FIDGET3)
    char.soundeffect(SOUND_DRINK1)
    consumePotion(char, potion, POTIONS[manatype][POT_RETURN_BOTTLE])

    return True
Beispiel #5
0
def potion(char, potion, agilitytype):
    socket = char.socket
    bonus = 0

    if not canUsePotion(char, potion):
        return False

    # Agility
    if agilitytype == 7:
        bonus = 10
    # Greater Agility
    elif agilitytype == 8:
        bonus = 20
    # Oops!
    else:
        return False

    # Apply Enhancepotions Bonus
    enhancepotions = properties.fromchar(char, ENHANCEPOTIONS)
    if enhancepotions > 0:
        bonus += (enhancepotions * bonus) / 100

    if char.hastag("dex_pot_timer"):
        # Compare
        elapsed = int(char.gettag("dex_pot_timer"))

        # Some bug occured
        if elapsed - time.time() > AGILITY_TIME:
            char.deltag('dex_pot_timer')
        elif elapsed > time.time():
            socket.clilocmessage(
                502173)  # You are already under a similar effect.
            return False

    char.settag('dex_pot_timer', time.time() + AGILITY_TIME)

    if char.dexterity + bonus < 1:
        bonus = -(char.strength - 1)

    char.dexterity2 += bonus
    char.dexterity += bonus
    char.stamina = min(char.stamina, char.maxstamina)
    char.updatestamina()
    char.updatestats()

    char.addtimer(int(AGILITY_TIME * 1000), statmodifier_expire, [1, bonus], 1,
                  1, "magic_statmodifier_1", statmodifier_dispel)

    char.action(ANIM_FIDGET3)
    char.soundeffect(SOUND_DRINK1)
    char.effect(0x375a, 10, 15)
    char.soundeffect(SOUND_AGILITY_UP)
    consumePotion(char, potion, POTIONS[agilitytype][POT_RETURN_BOTTLE])

    return True
Beispiel #6
0
def potion(char, potion, strengthtype):
    socket = char.socket
    if not canUsePotion(char, potion):
        return False

    bonus = 0

    # Agility
    if strengthtype == 9:
        bonus = 10
    # Greater Agility
    elif strengthtype == 10:
        bonus = 20
    # Oops!
    else:
        return False

    # Apply Enhancepotions Bonus
    enhancepotions = properties.fromchar(char, ENHANCEPOTIONS)
    if enhancepotions > 0:
        bonus += (enhancepotions * bonus) / 100

    if char.hastag("str_pot_timer"):
        # Compare
        elapsed = int(char.gettag("str_pot_timer"))

        if elapsed - time.time() > STRENGTH_TIME:
            char.deltag('str_pot_timer')
        elif elapsed > time.time():
            socket.clilocmessage(
                502173)  # You are already  under a similar effect
            return False

    char.settag("str_pot_timer", time.time() + STRENGTH_TIME)

    if char.strength + bonus < 1:
        bonus = -(char.strength - 1)
    char.strength2 += bonus
    char.strength += bonus
    char.hitpoints = min(char.hitpoints, char.maxhitpoints)
    char.updatehealth()
    char.updatestats()

    char.addtimer(int(STRENGTH_TIME * 1000.0), statmodifier_expire, [0, bonus],
                  1, 1, "magic_statmodifier_0", statmodifier_dispel)

    char.action(ANIM_FIDGET3)
    char.soundeffect(SOUND_DRINK1)
    char.effect(0x375a, 10, 15)
    char.soundeffect(SOUND_STRENGTH_UP)
    consumePotion(char, potion, POTIONS[strengthtype][POT_RETURN_BOTTLE])

    return True
def potion( char, potion, agilitytype ):
	socket = char.socket
	bonus = 0

	if not canUsePotion( char, potion ):
		return False

	# Agility
	if agilitytype == 7:
		bonus = 10
	# Greater Agility
	elif agilitytype == 8:
		bonus = 20
	# Oops!
	else:
		return False

	# Apply Enhancepotions Bonus
	enhancepotions = properties.fromchar(char, ENHANCEPOTIONS)
	if enhancepotions > 0:
		bonus += (enhancepotions * bonus) / 100

	if char.hastag( "dex_pot_timer" ):
		# Compare
		elapsed = int( char.gettag( "dex_pot_timer" ) )

		# Some bug occured
		if elapsed - time.time() > AGILITY_TIME:
			char.deltag('dex_pot_timer')
		elif elapsed > time.time():
				socket.clilocmessage(502173) # You are already under a similar effect.
				return False

	char.settag( 'dex_pot_timer', time.time() + AGILITY_TIME )

	if char.dexterity + bonus < 1:
		bonus = -(char.strength - 1)

	char.dexterity2 += bonus
	char.dexterity += bonus
	char.stamina = min( char.stamina, char.maxstamina )
	char.updatestamina()
	char.updatestats()

	char.addtimer( int( AGILITY_TIME * 1000 ), "magic.utilities.statmodifier_expire", [1, bonus], 1, 1, "magic_statmodifier_1", "magic.utilities.statmodifier_dispel" )

	char.action( ANIM_FIDGET3 )
	char.soundeffect( SOUND_DRINK1 )
	char.effect( 0x375a, 10, 15 )
	char.soundeffect( SOUND_AGILITY_UP )
	consumePotion( char, potion, POTIONS[ agilitytype ][ POT_RETURN_BOTTLE ] )

	return True
Beispiel #8
0
def potion( char, potion, curetype ):
	socket = char.socket
	if not canUsePotion( char, potion ):
		return False

	if char.poison == -1:
		# You are not poisoned.
		socket.clilocmessage( 1042000 )
		return False

	if char.hasscript('magic.vampiricembrace'):
		char.socket.clilocmessage(1061652 ) # The garlic in the potion would surely kill you.
		return False

	if curetype == 4:
		curelevel = 0
	elif curetype == 5:
		curelevel = 1
	elif curetype == 6:
		curelevel = 2
		
	if curelevel >= char.poison:
		poison.cure( char )
		char.effect( 0x373a, 10, 15 )
		char.soundeffect( 0x1e0 )
	# curelevel now must be lower than char.poison
	else:
		chance = 0.0
		if ( char.poison - curelevel ) == 1:
			chance = 0.5
		elif ( char.poison - curelevel ) == 2:
			chance = 0.25
		elif ( char.poison - curelevel ) == 3:
			chance = 0.1

		if chance > random():
			poison.cure(char)
			char.effect( 0x373a, 10, 15 )
			char.soundeffect( 0x1e0 )

	# Drinking and consume
	char.action( ANIM_FIDGET3 )
	char.soundeffect( SOUND_DRINK1 )
	consumePotion( char, potion, POTIONS[ curetype ][ POT_RETURN_BOTTLE ] )
	# If we succeeded, special effects
	if char.poison == -1:
		char.effect( 0x373a, 10, 15 )
		char.soundeffect( 0x1e0 )
		socket.clilocmessage( 500231 ) # You feel cured of poison!
	else:
		socket.clilocmessage( 500232 ) # That potion was not strong enough to cure your ailment!
	return True
def potion( char, potion, strengthtype ):
	socket = char.socket
	if not canUsePotion( char, potion ):
		return False

	bonus = 0

	# Agility
	if strengthtype == 9:
		bonus = 10
	# Greater Agility
	elif strengthtype == 10:
		bonus = 20
	# Oops!
	else:
		return False

	# Apply Enhancepotions Bonus
	enhancepotions = properties.fromchar(char, ENHANCEPOTIONS)
	if enhancepotions > 0:
		bonus += (enhancepotions * bonus) / 100

	if char.hastag( "str_pot_timer" ):
		# Compare
		elapsed = int( char.gettag( "str_pot_timer" ) )

		if elapsed - time.time() > STRENGTH_TIME:
			char.deltag('str_pot_timer')
		elif elapsed > time.time():
			socket.clilocmessage(502173) # You are already  under a similar effect
			return False

	char.settag( "str_pot_timer", time.time() + STRENGTH_TIME )

	if char.strength + bonus < 1:
		bonus = -(char.strength - 1)
	char.strength2 += bonus
	char.strength += bonus
	char.hitpoints = min(char.hitpoints, char.maxhitpoints)
	char.updatehealth()
	char.updatestats()

	char.addtimer( int(STRENGTH_TIME * 1000.0), statmodifier_expire, [0, bonus], 1, 1, "magic_statmodifier_0", statmodifier_dispel )

	char.action( ANIM_FIDGET3 )
	char.soundeffect( SOUND_DRINK1 )
	char.effect( 0x375a, 10, 15 )
	char.soundeffect( SOUND_STRENGTH_UP )
	consumePotion( char, potion, POTIONS[ strengthtype ][ POT_RETURN_BOTTLE ] )

	return True
Beispiel #10
0
def potion( char, potion, manatype ):
	socket = char.socket
	if not canUsePotion( char, potion ):
		return False

	if char.mana >= char.maxmana:
		socket.sysmessage( tr('You are already at full mana.') )
		if char.mana > char.maxmana:
			char.mana = char.maxmana
			char.updatemana()
		return False

	# Compare
	if socket.hastag('mana_pot_timer'):
		elapsed = int( socket.gettag( 'mana_pot_timer' ) )
		if elapsed > time.time():
			# Broken Timer
			if time.time() - elapsed > MANA_POT_DELAY:
				socket.deltag('mana_pot_timer')
			else:
				socket.sysmessage( tr('You must wait a few seconds before using another mana potion.') ) 
				return False

	socket.settag( 'mana_pot_timer', time.time() + MANA_POT_DELAY )
	amount = 0

	# Lesser Mana
	if manatype == 22:
		amount = randint( POTION_LESSERMANA_RANGE[0], POTION_LESSERMANA_RANGE[1] )
	# Mana
	elif manatype == 23:
		amount = randint( POTION_MANA_RANGE[0], POTION_MANA_RANGE[1] )
	# Greater Mana
	elif manatype == 24:
		amount = randint( POTION_GREATERMANA_RANGE[0], POTION_GREATERMANA_RANGE[1] )

	# Apply Enhancepotions Bonus
	enhancepotions = properties.fromchar(char, ENHANCEPOTIONS)
	if enhancepotions > 0:
		amount += (enhancepotions * amount) / 100

	char.mana = min( char.mana + amount, char.maxmana ) # We don't add mana over our maximum mana

	# Resend Mana
	char.updatemana()

	char.action( ANIM_FIDGET3 )
	char.soundeffect( SOUND_DRINK1 )
	consumePotion( char, potion, POTIONS[ manatype ][ POT_RETURN_BOTTLE ] )

	return True
Beispiel #11
0
def potion( char, potion, poisontype ):
	socket = char.socket
	if not canUsePotion( char, potion ):
		return False

	# Weakest to strongest
	levels = [14, 15, 16, 17, 34, 35]
	if poisontype == levels[0]:
		poison.poison( char, 0 )
	elif poisontype == levels[1]:
		poison.poison( char, 1 )
	elif poisontype == levels[2] or poisontype == levels[5]: # darkglow poison has the same effect as greater poison
		poison.poison( char, 2 )
	elif poisontype == levels[3] or poisontype == levels[4]: # parasitic poison has the same effect as deadly poison
		poison.poison( char, 3 )
	else:
		return False

	char.action( ANIM_FIDGET3 )
	char.soundeffect( SOUND_DRINK1 )
	consumePotion( char, potion, POTIONS[ poisontype ][ POT_RETURN_BOTTLE ] )
	return True
Beispiel #12
0
def potion( char, potion, poisontype ):
	socket = char.socket
	if not canUsePotion( char, potion ):
		return False

	# Weakest to strongest
	levels = [14, 15, 16, 17]
	if poisontype == levels[0]:
		poison.poison( char, 0 )
	elif poisontype == levels[1]:
		poison.poison( char, 1 )
	elif poisontype == levels[2]:
		poison.poison( char, 2 )
	elif poisontype == levels[3]:
		poison.poison( char, 3 )
	else:
		return False

	char.action( ANIM_FIDGET3 )
	char.soundeffect( SOUND_DRINK1 )
	consumePotion( char, potion, POTIONS[ poisontype ][ POT_RETURN_BOTTLE ] )
	return True
Beispiel #13
0
def potion(char, potion, poisontype):
    socket = char.socket
    if not canUsePotion(char, potion):
        return False

    # Weakest to strongest
    levels = [14, 15, 16, 17, 34, 35]
    if poisontype == levels[0]:
        poison.poison(char, 0)
    elif poisontype == levels[1]:
        poison.poison(char, 1)
    elif poisontype == levels[2] or poisontype == levels[
            5]:  # darkglow poison has the same effect as greater poison
        poison.poison(char, 2)
    elif poisontype == levels[3] or poisontype == levels[
            4]:  # parasitic poison has the same effect as deadly poison
        poison.poison(char, 3)
    else:
        return False

    char.action(ANIM_FIDGET3)
    char.soundeffect(SOUND_DRINK1)
    consumePotion(char, potion, POTIONS[poisontype][POT_RETURN_BOTTLE])
    return True