Update of /cvsroot/wpdev/xmlscripts/scripts/system
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28093/system
Modified Files:
poison.py spawns.py trading.py
Log Message:
- Replaced access to .events with the calls hasevent/addevent/removeevent in all relevant places.
Notice that addevent() is expected to add the event to the head of the list.
I recognized no situation (of those changed) where it would make a difference adding the event to the end of the list, so in those cases used addevent aswell.
- Fixed a copy&paste error in trap.py on removing the tags (pointed out by Incannus).
note: .events can now be made read only, bearing in mind that in doing so there is no way to make a distinction between adding an event at the top or at the end of the event list.
Index: spawns.py
===================================================================
RCS file: /cvsroot/wpdev/xmlscripts/scripts/system/spawns.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** spawns.py 16 Jun 2004 20:18:43 -0000 1.4
--- spawns.py 24 Aug 2004 18:10:30 -0000 1.5
***************
*** 18,22 ****
npc.wandertype = 3
npc.wanderradius = area
! npc.events = ['system.spawns'] + npc.events
npc.update()
elif spawntype == 0:
--- 18,22 ----
npc.wandertype = 3
npc.wanderradius = area
! npc.addevent( 'system.spawns' )
npc.update()
elif spawntype == 0:
***************
*** 78,82 ****
# Check if the spawn is valid.
valid = item != None
! if valid and 'spawngem' not in item.events:
valid = 0
if valid and not item.hastag('spawntype') or not item.hastag('spawndef'):
--- 78,82 ----
# Check if the spawn is valid.
valid = item != None
! if valid and not item.hasevent( 'spawngem' ):
valid = 0
if valid and not item.hastag('spawntype') or not item.hastag('spawndef'):
Index: trading.py
===================================================================
RCS file: /cvsroot/wpdev/xmlscripts/scripts/system/trading.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** trading.py 2 Jul 2004 13:40:46 -0000 1.4
--- trading.py 24 Aug 2004 18:10:30 -0000 1.5
***************
*** 66,73 ****
#onLogout event should be executed for tradewindow disposing
! events1 = player1.events
! events1.append( 'system.trading' )
! events2 = player2.events
! events2.append( 'system.trading' )
#We want to know serial of partner in future
--- 66,71 ----
#onLogout event should be executed for tradewindow disposing
! player1.addevent( 'system.trading' )
! player2.addevent( 'system.trading' )
#We want to know serial of partner in future
Index: poison.py
===================================================================
RCS file: /cvsroot/wpdev/xmlscripts/scripts/system/poison.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** poison.py 26 May 2004 13:07:26 -0000 1.4
--- poison.py 24 Aug 2004 18:10:30 -0000 1.5
***************
*** 27,33 ****
# If he did, save the strokes and level and restore it later
if char.player and not char.socket and char.logouttime == 0:
! if not 'system.poison' in char.events:
! char.settag('poison_strokes', strokes)
! char.events = ['system.poison'] + char.events
return
--- 27,33 ----
# If he did, save the strokes and level and restore it later
if char.player and not char.socket and char.logouttime == 0:
! if not char.hasevent( 'system.poison' ):
! char.settag( 'poison_strokes', strokes )
! char.addevent( 'system.poison' )
return
***************
*** 103,110 ****
#
def onLogin(char):
! events = char.events
! while 'system.poison' in events:
! events.remove('system.poison')
! char.events = events
if not POISONS.has_key(char.poison):
--- 103,107 ----
#
def onLogin(char):
! char.removeevent( 'system.poison' )
if not POISONS.has_key(char.poison):
|