[wpdev-commits] xmlscripts/scripts/skills fishing.py,1.11,1.12
Brought to you by:
rip,
thiagocorrea
From: Incanus <inc...@us...> - 2004-10-20 16:27:55
|
Update of /cvsroot/wpdev/xmlscripts/scripts/skills In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10853/scripts/skills Modified Files: fishing.py Log Message: Fixed fishing pole not wearing out. Index: fishing.py =================================================================== RCS file: /cvsroot/wpdev/xmlscripts/scripts/skills/fishing.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** fishing.py 14 Sep 2004 01:22:50 -0000 1.11 --- fishing.py 20 Oct 2004 16:27:34 -0000 1.12 *************** *** 31,34 **** --- 31,64 ---- ] + def checktool(char, item, wearout = False): + if not item: + return False + + # Has to be in our posession + if item.getoutmostchar() != char: + #You can't use that, it belongs to someone else. + char.socket.clilocmessage( 500364 ) + return False + + # We do not allow "invulnerable" tools. + if not( item.hastag('remaining_uses') ): + #You broke your fishing pole. + char.socket.clilocmessage( 503174 ) + item.delete() + return False + + if( wearout ): + uses = int(item.gettag('remaining_uses')) + if( uses <= 1 ): + #You broke your fishing pole. + char.socket.clilocmessage( 503174 ) + item.delete() + return False + else: + item.settag('remaining_uses', uses - 1) + item.resendtooltip() + + return True + def onUse( char, item ): socket = char.socket *************** *** 56,60 **** else: socket.clilocmessage( 0x7A4EE, "", 0x3b2, 3 ) # What water do you want to fish in? ! socket.attachtarget( "skills.fishing.response" ) return True --- 86,90 ---- else: socket.clilocmessage( 0x7A4EE, "", 0x3b2, 3 ) # What water do you want to fish in? ! socket.attachtarget( "skills.fishing.response", [ iserial ] ) return True *************** *** 150,154 **** socket.settag( 'is_fishing', int( wolfpack.time.currenttime() + 5000 ) ) # Times out after 5000ms char.addtimer( 2500, "skills.fishing.effecttimer", [ pos, deepwater ] ) ! char.addtimer( 5000, "skills.fishing.itemtimer", [ pos, deepwater ] ) pass --- 180,184 ---- socket.settag( 'is_fishing', int( wolfpack.time.currenttime() + 5000 ) ) # Times out after 5000ms char.addtimer( 2500, "skills.fishing.effecttimer", [ pos, deepwater ] ) ! char.addtimer( 5000, "skills.fishing.itemtimer", [ pos, deepwater, args[0] ] ) pass *************** *** 216,227 **** # Do the real skill checks def itemtimer( char, args ): if len( fishingItems ) < 1: socket.sysmessage( 'This script has not been configured correctly.' ) ! return 0 - socket = char.socket socket.deltag( 'is_fishing' ) ! if len( args ) != 2: return --- 246,261 ---- # Do the real skill checks def itemtimer( char, args ): + if not( char.socket ): + return False + + socket = char.socket + if len( fishingItems ) < 1: socket.sysmessage( 'This script has not been configured correctly.' ) ! return False socket.deltag( 'is_fishing' ) ! if len( args ) != 3: return *************** *** 279,282 **** --- 313,323 ---- item.update() + #wear out the fishing pole + tool = wolfpack.finditem( args[2] ) + checktool( char, tool, True ) + + #resend weight + socket.resendstatus() + # Success! if not spawnmonster: |