Update of /cvsroot/wpdev/xmlscripts/scripts/magic
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12217
Modified Files:
circle1.py circle2.py circle3.py circle4.py circle5.py
circle6.py circle7.py firefield.py nightsight.py
poisonfield.py scroll.py spell.py spellbook.py trap.py
utilities.py
Log Message:
Replaced direct access to .events with hasevent(), removeevent() and
addevent(), as appropriate.
Index: circle4.py
===================================================================
RCS file: /cvsroot/wpdev/xmlscripts/scripts/magic/circle4.py,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** circle4.py 25 Jul 2004 22:59:08 -0000 1.11
--- circle4.py 24 Aug 2004 17:18:26 -0000 1.12
***************
*** 127,131 ****
# We can only recall from recall runes
! if not 'magic.rune' in target.events:
char.message(502357)
return
--- 127,131 ----
# We can only recall from recall runes
! if not target.hasevent( 'magic.rune' ):
char.message(502357)
return
***************
*** 219,223 ****
newitem.settag('dispellable_field', 1)
newitem.settag('source', char.serial)
! newitem.events = ['magic.firefield']
newitem.update()
serials.append(newitem.serial)
--- 219,223 ----
newitem.settag('dispellable_field', 1)
newitem.settag('source', char.serial)
! newitem.addevent( 'magic.firefield' )
newitem.update()
serials.append(newitem.serial)
Index: nightsight.py
===================================================================
RCS file: /cvsroot/wpdev/xmlscripts/scripts/magic/nightsight.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** nightsight.py 19 Jul 2004 20:13:12 -0000 1.4
--- nightsight.py 24 Aug 2004 17:18:26 -0000 1.5
***************
*** 14,22 ****
player.lightbonus = max(0, player.lightbonus - bonus)
! events = player.events
! while 'magic.nightsight' in events:
! events.remove('magic.nightsight')
! player.events = events
!
player.deltag('nightsight')
player.deltag('nightsight_start')
--- 14,18 ----
player.lightbonus = max(0, player.lightbonus - bonus)
! player.removeevent('magic.nightsight')
player.deltag('nightsight')
player.deltag('nightsight_start')
Index: circle6.py
===================================================================
RCS file: /cvsroot/wpdev/xmlscripts/scripts/magic/circle6.py,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** circle6.py 2 Aug 2004 22:11:56 -0000 1.9
--- circle6.py 24 Aug 2004 17:18:26 -0000 1.10
***************
*** 116,120 ****
# We can only mark recall runes
! if not 'magic.rune' in target.events:
char.message(501797)
return
--- 116,120 ----
# We can only mark recall runes
! if not target.hasevent( 'magic.rune' ):
char.message(501797)
return
***************
*** 220,224 ****
newitem.settag('dispellable_field', 1)
newitem.settag('strength', char.skill[self.damageskill])
! newitem.events = ['magic.paralyzefield']
newitem.update()
serials.append(newitem.serial)
--- 220,224 ----
newitem.settag('dispellable_field', 1)
newitem.settag('strength', char.skill[self.damageskill])
! newitem.addevent( 'magic.paralyzefield' )
newitem.update()
serials.append(newitem.serial)
Index: spell.py
===================================================================
RCS file: /cvsroot/wpdev/xmlscripts/scripts/magic/spell.py,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** spell.py 12 Aug 2004 19:13:49 -0000 1.14
--- spell.py 24 Aug 2004 17:18:26 -0000 1.15
***************
*** 40,46 ****
def callback(char, args):
! eventlist = char.events
! eventlist.remove('magic')
! char.events = eventlist
# target
--- 40,44 ----
def callback(char, args):
! char.removeevent('magic')
# target
***************
*** 103,107 ****
#
def precast(self, char, mode=0, args=[], target = None, item = None):
- eventlist = char.events
socket = char.socket
--- 101,104 ----
***************
*** 120,124 ****
# We are already casting a spell
! if 'magic' in eventlist or (socket and socket.hastag('cast_target')):
char.socket.clilocmessage(502642)
return 0
--- 117,121 ----
# We are already casting a spell
! if char.hasevent('magic') or (socket and socket.hastag('cast_target')):
char.socket.clilocmessage(502642)
return 0
***************
*** 140,144 ****
# Precasting
! char.events = ['magic'] + eventlist
char.action(self.castaction)
--- 137,141 ----
# Precasting
! char.addevent('magic')
char.action(self.castaction)
Index: circle7.py
===================================================================
RCS file: /cvsroot/wpdev/xmlscripts/scripts/magic/circle7.py,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** circle7.py 2 Aug 2004 22:25:59 -0000 1.11
--- circle7.py 24 Aug 2004 17:18:26 -0000 1.12
***************
*** 140,144 ****
# We can only recall from recall runes
! if not 'magic.rune' in target.events:
char.message(502357)
return
--- 140,144 ----
# We can only recall from recall runes
! if not target.hasevent( 'magic.rune' ):
char.message(502357)
return
***************
*** 185,189 ****
gate.moveto(char.pos)
gate.settag('dispellable_field', 1)
! gate.events = ['magic.gate']
gate.settag('target', target.gettag('location'))
gate.direction = 9
--- 185,189 ----
gate.moveto(char.pos)
gate.settag('dispellable_field', 1)
! gate.addevent( 'magic.gate' )
gate.settag('target', target.gettag('location'))
gate.direction = 9
***************
*** 197,201 ****
gate.settag('target', '%u,%u,%d,%u' % (char.pos.x, char.pos.y, char.pos.z, char.pos.map))
gate.settag('dispellable_field', 1)
! gate.events = ['magic.gate']
gate.direction = 9
gate.update()
--- 197,201 ----
gate.settag('target', '%u,%u,%d,%u' % (char.pos.x, char.pos.y, char.pos.z, char.pos.map))
gate.settag('dispellable_field', 1)
! gate.addevent( 'magic.gate' )
gate.direction = 9
gate.update()
Index: circle1.py
===================================================================
RCS file: /cvsroot/wpdev/xmlscripts/scripts/magic/circle1.py,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** circle1.py 25 Jul 2004 22:59:08 -0000 1.10
--- circle1.py 24 Aug 2004 17:18:25 -0000 1.11
***************
*** 118,122 ****
return 0
! if 'magic.nightsight' in target.events:
if char.socket:
if char == target:
--- 118,122 ----
return 0
! if target.hasevent( 'magic.nightsight' ):
if char.socket:
if char == target:
***************
*** 136,140 ****
bonus = min(18, math.floor(18 * (char.skill[MAGERY] / 1000.0)))
! target.events = ['magic.nightsight'] + target.events
target.settag("nightsight", bonus)
target.settag("nightsight_start", time.minutes())
--- 136,140 ----
bonus = min(18, math.floor(18 * (char.skill[MAGERY] / 1000.0)))
! target.addevent( 'magic.nightsight' )
target.settag("nightsight", bonus)
target.settag("nightsight_start", time.minutes())
Index: scroll.py
===================================================================
RCS file: /cvsroot/wpdev/xmlscripts/scripts/magic/scroll.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** scroll.py 22 Jul 2004 17:22:06 -0000 1.5
--- scroll.py 24 Aug 2004 17:18:26 -0000 1.6
***************
*** 50,54 ****
return False
! if ( 'magic.spellbook' in cont.events ):
if spell >= 64:
char.socket.sysmessage( "Scroll with invalid spell-id: %d" % spell )
--- 50,54 ----
return False
! if cont.hasevent( 'magic.spellbook' ):
if spell >= 64:
char.socket.sysmessage( "Scroll with invalid spell-id: %d" % spell )
Index: poisonfield.py
===================================================================
RCS file: /cvsroot/wpdev/xmlscripts/scripts/magic/poisonfield.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** poisonfield.py 19 Jul 2004 21:07:36 -0000 1.4
--- poisonfield.py 24 Aug 2004 17:18:26 -0000 1.5
***************
*** 30,34 ****
for item in items:
! if 'magic.poisonfield' in item.events:
level = 0
if item.hastag('level'):
--- 30,34 ----
for item in items:
! if item.hasevent( 'magic.poisonfield' ):
level = 0
if item.hastag('level'):
Index: circle3.py
===================================================================
RCS file: /cvsroot/wpdev/xmlscripts/scripts/magic/circle3.py,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** circle3.py 22 Jul 2004 17:22:06 -0000 1.7
--- circle3.py 24 Aug 2004 17:18:26 -0000 1.8
***************
*** 123,127 ****
# We can only lock unlocked chests
! if target.type != 1 or 'lock' in target.events or target.container:
char.message(501762)
return
--- 123,127 ----
# We can only lock unlocked chests
! if target.type != 1 or target.hasevent( 'lock' ) or target.container:
char.message(501762)
return
***************
*** 135,142 ****
return
! events = target.events
! events.append('lock')
! target.events = events
!
target.settag('lock', 'magic')
--- 135,139 ----
return
! target.addevent( 'lock' )
target.settag('lock', 'magic')
***************
*** 156,160 ****
# We can only lock unlocked chests
! if not 'lock' in target.events:
char.message(503101)
return
--- 153,157 ----
# We can only lock unlocked chests
! if not target.hasevent( 'lock' ):
char.message(503101)
return
***************
*** 167,174 ****
return
! events = target.events
! events.remove('lock')
! target.events = events
!
target.deltag('lock', 'magic')
--- 164,168 ----
return
! target.removeevent( 'lock' )
target.deltag('lock', 'magic')
Index: firefield.py
===================================================================
RCS file: /cvsroot/wpdev/xmlscripts/scripts/magic/firefield.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** firefield.py 19 Jul 2004 21:07:36 -0000 1.5
--- firefield.py 24 Aug 2004 17:18:26 -0000 1.6
***************
*** 27,31 ****
for item in items:
! if 'magic.firefield' in item.events:
source = None
if item.hastag('source'):
--- 27,31 ----
for item in items:
! if item.hasevent( 'magic.firefield' ):
source = None
if item.hastag('source'):
Index: circle5.py
===================================================================
RCS file: /cvsroot/wpdev/xmlscripts/scripts/magic/circle5.py,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** circle5.py 9 Aug 2004 18:51:38 -0000 1.14
--- circle5.py 24 Aug 2004 17:18:26 -0000 1.15
***************
*** 301,305 ****
newitem.settag('dispellable_field', 1)
newitem.settag('level', level)
! newitem.events = ['magic.poisonfield']
newitem.update()
serials.append(newitem.serial)
--- 301,305 ----
newitem.settag('dispellable_field', 1)
newitem.settag('level', level)
! newitem.addevent( 'magic.poisonfield' )
newitem.update()
serials.append(newitem.serial)
Index: utilities.py
===================================================================
RCS file: /cvsroot/wpdev/xmlscripts/scripts/magic/utilities.py,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** utilities.py 7 Aug 2004 04:02:53 -0000 1.10
--- utilities.py 24 Aug 2004 17:18:26 -0000 1.11
***************
*** 52,59 ****
char.dispel(char, 1, "cast_delay")
! eventlist = char.events
! if 'magic' in eventlist:
! eventlist.remove('magic')
! char.events = eventlist
if char.socket:
--- 52,56 ----
char.dispel(char, 1, "cast_delay")
! char.removeevent('magic')
if char.socket:
Index: spellbook.py
===================================================================
RCS file: /cvsroot/wpdev/xmlscripts/scripts/magic/spellbook.py,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** spellbook.py 20 Jul 2004 20:55:13 -0000 1.8
--- spellbook.py 24 Aug 2004 17:18:26 -0000 1.9
***************
*** 79,83 ****
def hasspell( item, spell ):
if item and ( item.hasevent( 'magic.spellbook' ) or item.hasevent( 'magic.necrospellbook' ) ):
! if 'magic.necrospellbook' in item.events:
spell = spell - 100
--- 79,83 ----
def hasspell( item, spell ):
if item and ( item.hasevent( 'magic.spellbook' ) or item.hasevent( 'magic.necrospellbook' ) ):
! if item.hasevent( 'magic.necrospellbook' ):
spell = spell - 100
***************
*** 106,110 ****
# Adds the specified spell to the specified spellbook
def addspell( item, spell ):
! if not item or not 'magic.spellbook' in item.events:
return 0
--- 106,110 ----
# Adds the specified spell to the specified spellbook
def addspell( item, spell ):
! if not item or not item.hasevent( 'magic.spellbook' ):
return 0
***************
*** 127,131 ****
# Removes the specified spell from the specified spellbook
def removespell( item, spell ):
! if not item or not 'magic.spellbook' in item.events:
return 0
--- 127,131 ----
# Removes the specified spell from the specified spellbook
def removespell( item, spell ):
! if not item or not item.hasevent( 'magic.spellbook' ):
return 0
***************
*** 149,157 ****
spell = args[0]
! if not target.item or not 'magic.spellbook' in target.item.events:
char.socket.sysmessage( 'You need to target a spellbook.' )
return
- item = target.item
if spell == 'all':
--- 149,158 ----
spell = args[0]
! item = target.item
!
! if not item or not item.hasevent( 'magic.spellbook' ):
char.socket.sysmessage( 'You need to target a spellbook.' )
return
if spell == 'all':
***************
*** 174,183 ****
spell = args[0]
! if not target.item or not 'magic.spellbook' in target.item.events:
char.socket.sysmessage( 'You need to target a spellbook.' )
return
- item = target.item
-
if spell == 'all':
for i in range( 1, 9 ):
--- 175,184 ----
spell = args[0]
! item = target.item
!
! if not item or not item.hasevent( 'magic.spellbook' ):
char.socket.sysmessage( 'You need to target a spellbook.' )
return
if spell == 'all':
for i in range( 1, 9 ):
Index: trap.py
===================================================================
RCS file: /cvsroot/wpdev/xmlscripts/scripts/magic/trap.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** trap.py 19 Jul 2004 21:07:36 -0000 1.5
--- trap.py 24 Aug 2004 17:18:26 -0000 1.6
***************
*** 14,35 ****
owner = wolfpack.findchar(int(item.gettag('trap_owner')))
except:
item.deltag('trap_type')
item.deltag('trap_damage')
item.deltag('trap_owner')
- events = item.events
- while 'magic.trap' in events:
- events.remove('magic.trap')
- item.events = events
return 0
item.deltag('trap_type')
item.deltag('trap_damage')
item.deltag('trap_owner')
- events = item.events
- while 'magic.trap' in events:
- events.remove('magic.trap')
- item.events = events
-
char.message(502999)
--- 14,28 ----
owner = wolfpack.findchar(int(item.gettag('trap_owner')))
except:
+ item.removeevent( 'magic.trap' )
item.deltag('trap_type')
item.deltag('trap_damage')
item.deltag('trap_owner')
return 0
+ item.removeevent( 'magic.trap' )
item.deltag('trap_type')
item.deltag('trap_damage')
item.deltag('trap_owner')
char.message(502999)
Index: circle2.py
===================================================================
RCS file: /cvsroot/wpdev/xmlscripts/scripts/magic/circle2.py,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** circle2.py 25 Jul 2004 22:59:08 -0000 1.8
--- circle2.py 24 Aug 2004 17:18:26 -0000 1.9
***************
*** 93,97 ****
target.settag('trap_damage', random.randint(10, 50))
target.settag('trap_type', 'magic')
! target.events = target.events + ['magic.trap']
class RemoveTrap (Spell):
--- 93,98 ----
target.settag('trap_damage', random.randint(10, 50))
target.settag('trap_type', 'magic')
! target.addevent( 'magic.trap' )
!
class RemoveTrap (Spell):
***************
*** 109,113 ****
# Already Trapped?
! if not'magic.trap' in target.events:
fizzle(char)
return
--- 110,114 ----
# Already Trapped?
! if not target.hasevent( 'magic.trap' ):
fizzle(char)
return
***************
*** 116,126 ****
target.soundeffect(0x1f0)
! # Add the Trap Properties to the Item
target.deltag('trap_owner', char.serial)
target.deltag('trap_damage', random.randint(10, 50))
target.deltag('trap_type', 'magic')
- events = target.events
- events.remove('magic.trap')
- target.events = events
class Protection(Spell):
--- 117,125 ----
target.soundeffect(0x1f0)
! # Remove the Trap Properties from the Item
! target.removeevent( 'magic.trap' )
target.deltag('trap_owner', char.serial)
target.deltag('trap_damage', random.randint(10, 50))
target.deltag('trap_type', 'magic')
class Protection(Spell):
|