[wpdev-commits] xmlscripts/scripts keyring.py,1.1,1.2
Brought to you by:
rip,
thiagocorrea
|
From: <dar...@pr...> - 2004-01-26 22:22:18
|
Update of /cvsroot/wpdev/xmlscripts/scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6810 Modified Files: keyring.py Log Message: Finished keyrings. Index: keyring.py =================================================================== RCS file: /cvsroot/wpdev/xmlscripts/scripts/keyring.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** keyring.py 26 Jan 2004 03:45:19 -0000 1.1 --- keyring.py 26 Jan 2004 22:21:19 -0000 1.2 *************** *** 1,3 **** --- 1,5 ---- + import wolfpack + def onDropOnItem(keyring, key): if 'keyring' not in keyring.events or 'key' not in key.events: *************** *** 38,41 **** return 1 ! def onUse(char, item): ! return 1 \ No newline at end of file --- 40,99 ---- return 1 ! def lock_response(char, args, target): ! if len(args) != 1: ! return ! ! keyring = wolfpack.finditem(args[0]) ! if not keyring or not char.canreach(keyring,5): ! char.socket.clilocmessage(500312) ! return ! ! # Check for an item target. ! if not target.item or not char.canreach(target.item, 5): ! char.socket.clilocmessage(501666) ! return ! ! # Targetted the keyring itself?? ! if target.item == keyring: ! # Put all rings into the backpack of the user ! backpack = char.getbackpack() ! ! for key in keyring.content: ! backpack.additem(key, 1, 1, 0) ! key.update() ! ! keyring.id = 0x1011 ! keyring.update() ! ! char.socket.clilocmessage(501685) ! return ! ! if not 'lock' in target.item.events or not target.item.hastag('lock'): ! char.socket.clilocmessage(501666) ! return ! ! target_lock = str(target.item.gettag('lock')) ! ! # Search for a valid key ! keys = keyring.content ! ! for key in keys: ! if key.hastag('lock') and 'key' in key.events: ! key_lock = str(key.gettag('lock')) ! ! if key_lock == target_lock: ! if target.item.hastag('locked') and int(target.item.gettag('locked')) == 1: ! target.item.deltag('locked') ! else: ! target.item.settag('locked',1) ! char.soundeffect(0x241) ! return ! ! char.socket.clilocmessage(501668) ! ! # The behaviour is similar to keys ! def onUse(char, keyring): ! # Does this key open a lock? ! char.socket.clilocmessage(501680) ! char.socket.attachtarget('keyring.lock_response',[keyring.serial]) ! return 1 |