Update of /cvsroot/wpdev/xmlscripts/scripts
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26762
Modified Files:
key.py
Added Files:
keyring.py
Log Message:
Started Implementation of Keyrings
--- NEW FILE: keyring.py ---
def onDropOnItem(keyring, key):
if 'keyring' not in keyring.events or 'key' not in key.events:
return 0
char = key.container
# Only non-blank keys may be put on a keyring...
if not key.hastag('lock'):
char.socket.clilocmessage(501689)
return 0
# Keyring is full
keycount = len(keyring.content)
if keycount >= 20:
char.socket.clilocmessage(1008138)
return 0
# Add the key to the keyring
key.removefromview(0)
key.container = keyring
key.layer = 0
# Id?
if keycount >= 5:
newid = 0x176b
elif keycount >= 3:
newid = 0x176a
else:
newid = 0x1769
if keyring.id != newid:
keyring.id = newid
keyring.update()
char.socket.clilocmessage(501691)
return 1
def onUse(char, item):
return 1
Index: key.py
===================================================================
RCS file: /cvsroot/wpdev/xmlscripts/scripts/key.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** key.py 25 Jan 2004 20:26:54 -0000 1.4
--- key.py 26 Jan 2004 03:45:19 -0000 1.5
***************
*** 6,10 ****
def gump_response(char, args, response):
! if len(args) < 1:
return
--- 6,10 ----
def gump_response(char, args, response):
! if len(args) < 1 or response.button != 1:
return
***************
*** 18,22 ****
new_name = response.text[1][:30] # 30 Chars max.
key.name = new_name
!
# Rekey
if char.gm:
--- 18,23 ----
new_name = response.text[1][:30] # 30 Chars max.
key.name = new_name
! char.socket.sysmessage("You renamed the key to '%s'" % new_name)
!
# Rekey
if char.gm:
***************
*** 24,32 ****
if len(new_lock) != 0:
! key.settag(new_lock)
! char.socket.sysmessage('This key now unlocks:' + new_lock)
else:
key.deltag('lock')
! char.socket.sysmessage('You erase the lock information.')
def rename_key(char, key):
--- 25,35 ----
if len(new_lock) != 0:
! key.settag('lock', new_lock)
! char.socket.sysmessage('This key now unlocks: ' + new_lock)
else:
key.deltag('lock')
! char.socket.sysmessage('You erase the lock information from the key.')
!
! key.update()
def rename_key(char, key):
***************
*** 149,153 ****
# The user defined name
! if len(item.name) != 0:
tooltip.add(1050045, " \t" + item.name + "\t ")
--- 152,156 ----
# The user defined name
! if len(item.name) > 0:
tooltip.add(1050045, " \t" + item.name + "\t ")
|