def affectchar(self, char, mode, target, args=[]): if target.poison != -1 or ismortallywounded(target): if target == char: char.message(1005000) else: char.message(1010398) return 0 return 1
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
def affectchar(self, char, mode, target, args=[]): if target.poison != -1 or ismortallywounded(target): if target == char: char.message(1005000) else: char.message(1010398) return False if not char.canreach(target, 2): char.socket.clilocmessage( 1060178 ) # You are too far away to perform that action! return False elif target.dead: char.socket.clilocmessage( 1061654 ) # You cannot heal that which is not alive. return False elif target.hitpoints >= target.maxhitpoints: char.socket.clilocmessage( 500955 ) # That being is not damaged! return False return True
def affectchar(self, char, mode, target, args=[]): if target.poison != -1 or ismortallywounded(target): if target == char: char.message(1005000) else: char.message(1010398) return False if not char.canreach(target, 2): char.socket.clilocmessage( 1060178) # You are too far away to perform that action! return False elif target.dead: char.socket.clilocmessage( 1061654) # You cannot heal that which is not alive. return False elif target.hitpoints >= target.maxhitpoints: char.socket.clilocmessage(500955) # That being is not damaged! return False return True
def startheal(char, target): socket = char.socket if target.baseid == 'golem': socket.clilocmessage(500970) # Golems cannot be healed return False elif target.getstrproperty('slayer_group', '') == 'undeads': socket.clilocmessage(500951) # Undeads cannot be healed return False elif ismortallywounded(target): if char == target: socket.clilocmessage(1005000) else: socket.clilocmessage(1010398) return False elif target.poison == -1 and target.hitpoints >= target.maxhitpoints and not system.bleeding.isbleeding( target): socket.clilocmessage(500955) # Already at full health return False elif target.dead and not target.pos.validspawnspot(): socket.clilocmessage( 501042) # Not a valid spawnspot for living players return False (primary, secondary) = getskills(target) # Get the skills used to heal the target # For resurrecting someone there is a 5 second delay if target.dead: resurrection = 5000 else: resurrection = 0 # We are bandaging ourself if target == char: delay = int(5000 + (500 * ((120 - char.dexterity) / 10.0))) # We are bandaging someone else else: # We are targetting an animal if primary == VETERINARY: if char.dexterity >= 40: delay = 2000 else: delay = 3000 # We are bandaging another player or a human else: if char.dexterity >= 100: delay = 3000 + resurrection elif char.dexterity >= 40: delay = 4000 + resurrection else: delay = 5000 + resurrection # what's the use of this dispel?? #char.dispel(None, 1, 'bandage_timer') # Display pending bandage timers socket.settag('bandage_slipped', 0) # Clear the "slipping" property socket.clilocmessage(500956) # Begin applying bandages char.addtimer(delay, endheal, [primary, secondary, target.serial]) # Add a bandage timer # Show an emote that he is using bandages ? return True
def startheal(char, target): socket = char.socket if target.baseid == 'golem': socket.clilocmessage(500970) # Golems cannot be healed return False elif target.getstrproperty('slayer_group', '') == 'undeads': socket.clilocmessage(500951) # Undeads cannot be healed return False elif ismortallywounded(target): if char == target: socket.clilocmessage(1005000) else: socket.clilocmessage(1010398) return False elif target.poison == -1 and target.hitpoints >= target.maxhitpoints and not system.bleeding.isbleeding(target): socket.clilocmessage(500955) # Already at full health return False elif target.dead and not target.pos.validspawnspot(): socket.clilocmessage(501042) # Not a valid spawnspot for living players return False (primary, secondary) = getskills(target) # Get the skills used to heal the target # For resurrecting someone there is a 5 second delay if target.dead: resurrection = 5000 else: resurrection = 0 # We are bandaging ourself if target == char: delay = int(5000 + (500 * ((120 - char.dexterity) / 10.0))) # We are bandaging someone else else: # We are targetting an animal if primary == VETERINARY: if char.dexterity >= 40: delay = 2000 else: delay = 3000 # We are bandaging another player or a human else: if char.dexterity >= 100: delay = 3000 + resurrection elif char.dexterity >= 40: delay = 4000 + resurrection else: delay = 5000 + resurrection # what's the use of this dispel?? #char.dispel(None, 1, 'bandage_timer') # Display pending bandage timers socket.settag('bandage_slipped', 0) # Clear the "slipping" property socket.clilocmessage(500956) # Begin applying bandages char.addtimer(delay, endheal, [primary, secondary, target.serial]) # Add a bandage timer # Show an emote that he is using bandages ? return True