Update of /cvsroot/wpdev/xmlscripts/scripts/wolfpack
In directory sc8-pr-cvs1:/tmp/cvs-serv17908/wolfpack
Modified Files:
gumps.py
Log Message:
Added NoticeGump
Index: gumps.py
===================================================================
RCS file: /cvsroot/wpdev/xmlscripts/scripts/wolfpack/gumps.py,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** gumps.py 28 Aug 2003 04:07:01 -0000 1.10
--- gumps.py 28 Aug 2003 04:22:16 -0000 1.11
***************
*** 243,248 ****
callback = args[0]
state = args[1]
! if choice.button == 0 or not callback or not socket:
callback( player, False, state )
if choice.button == 1:
callback( player, True, state )
--- 243,301 ----
callback = args[0]
state = args[1]
! if not callback:
! return
! if choice.button == 0 or not socket:
callback( player, False, state )
if choice.button == 1:
callback( player, True, state )
+
+
+ class NoticeGump:
+
+ def __init__(self, header, headerColor, content, contentColor, width, height, callback, state ):
+ self.callback = callback
+ self.state = state
+
+ self.gump = cGump( 1, 0, 0, (640 - width) / 2, (480 - height) / 2 )
+ self.gump.startPage( 0 )
+ self.gump.addBackground( 5054, width, height )
+ self.gump.addTiledGump( 10, 10, width - 20, 20, 2624 )
+ self.gump.addCheckerTrans( 10, 10, width - 20, 20 )
+ self.gump.addXmfHtmlGump( 10, 10, width - 20, 20, header, 0, 0, headerColor )
+ self.gump.addTiledGump( 10, 40, width - 20, height - 80, 2624 )
+ self.gump.addCheckerTrans( 10, 40, width - 20, height - 80 )
+ if type( content ) is IntType:
+ self.gump.addXmfHtmlGump( 10, 40, width - 20, height - 80, content, 0, 1, contentColor )
+ else:
+ self.gump.addHtmlGump( 10, 40, width - 20, height - 80, "<BASEFONT COLOR=#%x>%s</BASEFONT>" % ( contentColor, content ), 0, 1 )
+
+ self.gump.addTiledGump( 10, height - 30, width - 20, 20, 2624 )
+ self.gump.addCheckerTrans( 10, height - 30, width - 20, 20 )
+ self.gump.addButton( 10, height - 30, 4005, 4007, 0 )
+ self.gump.addXmfHtmlGump( 40, height - 30, 170, 20, 1011036, 0, 0, 32767 )
+
+ def send( self, char ) :
+ # There are two possibilities
+ socket = None
+
+ if type( char ).__name__ == "wpchar":
+ socket = char.socket
+ elif type( char ).__name__ == "wpsocket":
+ socket = char
+ else:
+ raise TypeError( "You passed an invalid socket." )
+
+ self.gump.setArgs([self.callback, self.state])
+ self.gump.setCallback("wolfpack.gumps.NoticeGump_onResponse")
+ self.gump.send( socket )
+
+
+ def NoticeGump_onResponse( player, args, choice ):
+ socket = player.socket
+ callback = args[0]
+ state = args[1]
+ if not callback:
+ return
+ if choice.button == 0 or not socket:
+ callback( player, state )
+
|