Update of /cvsroot/wpdev/xmlscripts/scripts
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1547
Modified Files:
book.py
Log Message:
Fixes for player vendors
Index: book.py
===================================================================
RCS file: /cvsroot/wpdev/xmlscripts/scripts/book.py,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** book.py 9 Jul 2004 21:47:45 -0000 1.11
--- book.py 30 Oct 2004 16:08:49 -0000 1.12
***************
*** 29,32 ****
--- 29,43 ----
def onUse(char, item):
char.objectdelay = 0
+ protected = False
+
+ # If it's within another characters pack. This is true for player vendors for
+ # instance.
+ outmost = item.getoutmostchar()
+
+ if outmost and outmost != char:
+ protected = True
+
+ if item.hastag('protected'):
+ protected = True
# Send BookOpen packet
***************
*** 48,55 ****
packet.setint(3, item.serial) # Book Serial
! if not item.hastag('protected'):
packet.setbyte(7, 1) # Flag Writeable
packet.setbyte(8, 1) # dito
- pass
pages = 64
--- 59,65 ----
packet.setint(3, item.serial) # Book Serial
! if not protected:
packet.setbyte(7, 1) # Flag Writeable
packet.setbyte(8, 1) # dito
pages = 64
***************
*** 59,63 ****
packet.setshort(9, pages)
-
packet.setshort(11, len(title) + 1)
packet.setascii(13, title)
--- 69,72 ----
***************
*** 68,74 ****
packet.send(char.socket)
! if item.hastag('protected'):
return 1
!
# Send a packet for each page !!
# We could easily create packets bigger than 65k otherwise...
--- 77,83 ----
packet.send(char.socket)
! if protected:
return 1
!
# Send a packet for each page !!
# We could easily create packets bigger than 65k otherwise...
***************
*** 107,111 ****
content = []
! sendPage(socket, item.serial, page)
# The client wants to update the page.
--- 116,120 ----
content = []
! sendPage(socket, item.serial, page, content)
# The client wants to update the page.
***************
*** 114,117 ****
--- 123,132 ----
socket.sysmessage('This book is read only.')
return 1
+
+ outmost = item.getoutmostchar()
+
+ if outmost and outmost != socket.player:
+ socket.sysmessage('This book is read only.')
+ return 1 # Not writeable
if item.hastag('pages'):
***************
*** 173,176 ****
--- 188,197 ----
char.message('This book is read only.')
return 1
+
+ outmost = item.getoutmostchar()
+
+ if outmost and outmost != socket.player:
+ socket.sysmessage('This book is read only.')
+ return 1 # Not writeable
if len(author) == 0:
|