def poisonit( char, args ): potion = wolfpack.finditem(args[ 0 ]) item = wolfpack.finditem(args[ 1 ]) if not potion or not item: return skill = char.skill[ POISONING ] # poison strength : lesser(0), normal, greater, deadly(3) strength = int( potion.getintproperty( 'potiontype' ) ) - 14 # consume the potion / add a blank bottle potions.consumePotion(char, potion, True) if not char.checkskill( POISONING, MINSKILLS[strength], MAXSKILLS[strength] ): char.socket.clilocmessage( 1010518 ) return 1 char.socket.clilocmessage(1010517) # decrease karma / fame # set poisoning infos as tags item.settag( 'poisoning_char', char.serial ) item.settag( 'poisoning_strength', strength ) item.settag( 'poisoning_skill', skill ) # weapon : poison chance when hit % = char.skill[ POISONING ] / 4 # number of uses before the poison wears off if item.hasscript( 'blades' ): item.settag( 'poisoning_uses', 18 - strength * 2 ) return 1
def onDropOnItem( potionkeg, potion ): char = potion.container socket = char.socket if not char or not socket: return False if not potionkeg.hasscript( 'potionkeg' ) or not potion.hasscript( 'potions' ): return False if not potionkeg.hastag( 'kegfill' ): kegfill = 0 potionkeg.settag( 'kegfill', kegfill ) else: kegfill = int( potionkeg.gettag( 'kegfill' ) ) if kegfill < 0: # Safeguard against negative fills kegfill = 0 if not potion.hastag( 'potiontype' ): socket.sysmessage("Only potions may be added to a potion keg!") return True if kegfill >= 100: socket.clilocmessage( 502247 ) return True if potionkeg.id in [ int(0x1ad6), int(0x1ad7), int(0x1940) ]: if potionkeg.hastag( 'potiontype' ): if potion.gettag( 'potiontype' ) == potionkeg.gettag( 'potiontype' ): if kegfill < 100 and kegfill >= 0: kegfill += 1 potionkeg.settag( 'kegfill', kegfill ) char.soundeffect( 0x240 ) consumePotion( char, potion ) potionkeg.update() kegfillmessage( char, kegfill ) socket.clilocmessage( 502239 ) return True else: socket.clilocmessage( 502233 ) # The keg will not hold any more! return True else: socket.clilocmessage( 502236 ) # You decide that it would be a bad idea to mix different types of potions. return True else: kegtype = potion.gettag( 'potiontype' ) potionkeg.settag( 'potiontype', kegtype ) potionkeg.settag( 'kegfill', 1 ) potionkeg.name = POTIONS[ potion.gettag('potiontype') ][ KEG_NAME ] char.soundeffect( 0x240 ) consumePotion( char, potion ) potionkeg.update() return True else: return True
def poisonit(char, args): potion = wolfpack.finditem(args[0]) item = wolfpack.finditem(args[1]) if not potion or not item: return skill = char.skill[POISONING] strength = getstrength(int(potion.getintproperty('potiontype'))) # consume the potion / add a blank bottle potions.consumePotion(char, potion, True) if not char.checkskill(POISONING, MINSKILLS[strength], MAXSKILLS[strength]): # 5% of chance of getting poisoned if failed if skill < 800 and random.randint(1, 20) == 0: if char.socket: char.socket.clilocmessage( 502148 ) # You make a grave mistake while applying the poison. poison(char, strength) else: if char.socket: char.socket.clilocmessage(1010518) return 1 char.socket.clilocmessage(1010517) # decrease karma char.awardkarma(-20) # set poisoning infos as tags item.settag('poisoning_char', char.serial) item.settag('poisoning_strength', strength) item.settag('poisoning_skill', skill) uses_remaining = 0 if item.hastag('remaining_uses'): uses_remaining = item.gettag('remaining_uses') # weapon : poison chance when hit % = char.skill[ POISONING ] / 4 # number of uses before the poison wears off if item.hasscript('blades'): item.settag('poisoning_uses', 18 - strength * 2) elif item.hasscript('shuriken'): item.settag('poisoning_uses', min(18 - strength * 2, uses_remaining)) item.resendtooltip() return 1
def poisonit( char, args ): potion = wolfpack.finditem(args[ 0 ]) item = wolfpack.finditem(args[ 1 ]) if not potion or not item: return skill = char.skill[ POISONING ] strength = getstrength( int( potion.getintproperty( 'potiontype' ) ) ) # consume the potion / add a blank bottle potions.consumePotion(char, potion, True) if not char.checkskill( POISONING, MINSKILLS[strength], MAXSKILLS[strength] ): # 5% of chance of getting poisoned if failed if skill < 800 and random.randint(1,20) == 0: if char.socket: char.socket.clilocmessage( 502148 ) # You make a grave mistake while applying the poison. poison(char, strength) else: if char.socket: char.socket.clilocmessage( 1010518 ) return 1 char.socket.clilocmessage(1010517) # decrease karma char.awardkarma( -20 ) # set poisoning infos as tags item.settag( 'poisoning_char', char.serial ) item.settag( 'poisoning_strength', strength ) item.settag( 'poisoning_skill', skill ) uses_remaining = 0 if item.hastag('remaining_uses'): uses_remaining = item.gettag('remaining_uses') # weapon : poison chance when hit % = char.skill[ POISONING ] / 4 # number of uses before the poison wears off if item.hasscript( 'blades' ): item.settag( 'poisoning_uses', 18 - strength * 2 ) elif item.hasscript( 'shuriken' ): item.settag( 'poisoning_uses', min( 18 - strength * 2, uses_remaining) ) item.resendtooltip() return 1