Update of /cvsroot/wpdev/xmlscripts/scripts
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16874
Modified Files:
pickpocket_dip.py potionkeg.py potions.py scissors.py
shrine.py signpost.py slotmachine.py spawngem.py spiderweb.py
training_dummy.py wall_clock.py wool.py xmlconfig.py yarn.py
Log Message:
I tried reducing more imports...
I also think this is starting to have a positive effect on memory usage...
I did some testing the other day and recorded a 5m leak per console reload.
# Before Cleanups From Initial Startup
# CONSOLE RELOAD
VRIT RES SHR SWAP DATA
95972 33m 19m 60m 91m
99.4m 38m 19m 90m 97m
104m 43m 19m 60m 102m
109m 48m 19m 60m 107m
114m 53m 19m 60m 112m
119m 58m 19m 60m 117m
124m 64m 19m 60m 122m
# After Cleanups From Initial Startup
# CONSOLE RELOAD
VRIT RES SHR SWAP DATA
94868 32m 19m 60m 90m
98.0m 37m 19m 60m 96m
102m 42m 19m 60m 100m
107m 46m 19m 60m 105m
112m 51m 19m 60m 110m
116m 56m 19m 60m 114m
121m 60m 19m 60m 119m
Overall it appears that the total memory used on startup
has decreased just a bit, and the amount of memory leaked
per reload seems to drop just slightly.
Index: slotmachine.py
===================================================================
RCS file: /cvsroot/wpdev/xmlscripts/scripts/slotmachine.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** slotmachine.py 26 May 2004 13:07:20 -0000 1.5
--- slotmachine.py 11 Jul 2004 02:47:25 -0000 1.6
***************
*** 7,11 ****
import wolfpack
! from random import randrange, choice
# Define prizes here
--- 7,11 ----
import wolfpack
! import random
# Define prizes here
***************
*** 41,50 ****
# 5% Win chance
! chance = randrange( 1, 100 )
# We won!
if( chance <= 5 ):
# Select a price randomly
! prize = choice( prizes )
char.message( prize[0] )
--- 41,50 ----
# 5% Win chance
! chance = random.randrange( 1, 100 )
# We won!
if( chance <= 5 ):
# Select a price randomly
! prize = random.choice( prizes )
char.message( prize[0] )
Index: spawngem.py
===================================================================
RCS file: /cvsroot/wpdev/xmlscripts/scripts/spawngem.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** spawngem.py 26 May 2004 13:07:20 -0000 1.3
--- spawngem.py 11 Jul 2004 02:47:25 -0000 1.4
***************
*** 1,8 ****
import wolfpack
! from wolfpack.consts import *
from wolfpack import console
from system import spawns
- import wolfpack.gumps
#
--- 1,7 ----
import wolfpack
! import wolfpack.gumps
from wolfpack import console
from system import spawns
#
***************
*** 59,63 ****
def onUse(player, item):
if not player.gm:
! return 1
dialog = wolfpack.gumps.cGump()
--- 58,62 ----
def onUse(player, item):
if not player.gm:
! return True
dialog = wolfpack.gumps.cGump()
***************
*** 139,141 ****
dialog.send(player)
! return 1
--- 138,140 ----
dialog.send(player)
! return True
Index: wall_clock.py
===================================================================
RCS file: /cvsroot/wpdev/xmlscripts/scripts/wall_clock.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** wall_clock.py 1 Jul 2004 21:43:28 -0000 1.5
--- wall_clock.py 11 Jul 2004 02:47:25 -0000 1.6
***************
*** 56,58 ****
char.message( time )
! return 1
--- 56,58 ----
char.message( time )
! return True
Index: wool.py
===================================================================
RCS file: /cvsroot/wpdev/xmlscripts/scripts/wool.py,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** wool.py 2 Jul 2004 13:40:45 -0000 1.8
--- wool.py 11 Jul 2004 02:47:25 -0000 1.9
***************
*** 8,13 ****
# wool
import wolfpack
! from wolfpack.utilities import *
! from wolfpack.consts import *
ids = [ 0x10a4, 0x1015, 0x101c, 0x1019 ]
--- 8,13 ----
# wool
import wolfpack
! import wolfpack.utilities
! from wolfpack.consts import GRAY
ids = [ 0x10a4, 0x1015, 0x101c, 0x1019 ]
Index: spiderweb.py
===================================================================
RCS file: /cvsroot/wpdev/xmlscripts/scripts/spiderweb.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** spiderweb.py 26 May 2004 13:07:20 -0000 1.2
--- spiderweb.py 11 Jul 2004 02:47:25 -0000 1.3
***************
*** 1,6 ****
import wolfpack
- from wolfpack.consts import *
from math import ceil
#
--- 1,6 ----
import wolfpack
from math import ceil
+ from wolfpack.consts import DAMAGE_MAGICAL, DAMAGE_PHYSICAL
#
***************
*** 49,53 ****
packet.send(char.socket)
char.socket.walksequence = 0
! return 1
events = char.events
--- 49,53 ----
packet.send(char.socket)
char.socket.walksequence = 0
! return True
events = char.events
***************
*** 57,61 ****
char.socket.sysmessage('You manage to break free of the spiderweb.')
! return 0
#
--- 57,61 ----
char.socket.sysmessage('You manage to break free of the spiderweb.')
! return False
#
Index: scissors.py
===================================================================
RCS file: /cvsroot/wpdev/xmlscripts/scripts/scissors.py,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** scissors.py 26 May 2004 13:07:20 -0000 1.10
--- scissors.py 11 Jul 2004 02:47:25 -0000 1.11
***************
*** 9,13 ****
import wolfpack
import wolfpack.utilities
! from wolfpack.consts import *
ids_rawleather = [ 0x1078, 0x1079 ]
--- 9,13 ----
import wolfpack
import wolfpack.utilities
! from wolfpack.consts import GRAY
ids_rawleather = [ 0x1078, 0x1079 ]
Index: potions.py
===================================================================
RCS file: /cvsroot/wpdev/xmlscripts/scripts/potions.py,v
retrieving revision 1.38
retrieving revision 1.39
diff -C2 -d -r1.38 -r1.39
*** potions.py 2 Jul 2004 13:40:45 -0000 1.38
--- potions.py 11 Jul 2004 02:47:25 -0000 1.39
***************
*** 2,9 ****
from random import randint, random
from wolfpack import time
- from wolfpack.consts import *
from wolfpack.utilities import hex2dec, throwobject, energydamage, checkLoS
import math
from system import poison
# potion [ return_bottle, aggressive, target, name ]
--- 2,14 ----
from random import randint, random
from wolfpack import time
from wolfpack.utilities import hex2dec, throwobject, energydamage, checkLoS
import math
from system import poison
+ from wolfpack.consts import RED, ALCHEMY, STRENGTH_TIME, ANIM_FIDGET3, \
+ SOUND_DRINK1, SOUND_AGILITY_UP, AGILITY_TIME, POTION_GREATERHEAL_RANGE, \
+ POTION_HEAL_RANGE, POTION_LESSERHEAL_RANGE, MAGERY, \
+ POTION_LESSEREXPLOSION_RANGE, POTION_GREATEREXPLOSION_RANGE, \
+ POTION_EXPLOSION_RANGE, SOUND_STRENGTH_UP
+
# potion [ return_bottle, aggressive, target, name ]
***************
*** 65,69 ****
# Do we throw this thing?
! if potions[ potiontype ][ POT_TARGET ] == TRUE:
# Explosion Potion
if potiontype in [ 11, 12, 13 ]:
--- 70,74 ----
# Do we throw this thing?
! if potions[ potiontype ][ POT_TARGET ] == True:
# Explosion Potion
if potiontype in [ 11, 12, 13 ]:
***************
*** 350,354 ****
potion.update()
! if givebottle == TRUE: # Lets add an empty bottle!
bottle = wolfpack.additem( 'f0e' ) # Empty Bottle Definition
if not wolfpack.utilities.tocontainer( bottle, char.getbackpack() ):
--- 355,359 ----
potion.update()
! if givebottle == True: # Lets add an empty bottle!
bottle = wolfpack.additem( 'f0e' ) # Empty Bottle Definition
if not wolfpack.utilities.tocontainer( bottle, char.getbackpack() ):
Index: training_dummy.py
===================================================================
RCS file: /cvsroot/wpdev/xmlscripts/scripts/training_dummy.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** training_dummy.py 26 May 2004 13:07:20 -0000 1.4
--- training_dummy.py 11 Jul 2004 02:47:25 -0000 1.5
***************
*** 7,13 ****
import wolfpack
- from wolfpack.consts import *
import random
from combat.utilities import weaponskill
# 0x1070 Facing South/North (Swinging: 0x1071)
--- 7,13 ----
import wolfpack
import random
from combat.utilities import weaponskill
+ from wolfpack.consts import FENCING, MACEFIGHTING, SWORDSMANSHIP, WRESTLING
# 0x1070 Facing South/North (Swinging: 0x1071)
***************
*** 18,27 ****
if( item.id != 0x1070 and item.id != 0x1074 ):
char.socket.sysmessage( 'Wait until the dummy stops swinging.' )
! return 1
# Distance & Direction checks
if( char.distanceto( item ) > 1 ):
char.message( 'You must be standing in front of or behind the dummy to use it.' )
! return 1
# Calculates the direction we'll have to look
--- 18,27 ----
if( item.id != 0x1070 and item.id != 0x1074 ):
char.socket.sysmessage( 'Wait until the dummy stops swinging.' )
! return True
# Distance & Direction checks
if( char.distanceto( item ) > 1 ):
char.message( 'You must be standing in front of or behind the dummy to use it.' )
! return True
# Calculates the direction we'll have to look
***************
*** 32,41 ****
if( item.id == 0x1070 and direction != 0 and direction != 4 ):
char.message( 'You must be standing in front of or behind the dummy to use it.' )
! return 1
# For a e/w dummy we need to either face eath or west
elif( item.id == 0x1074 and direction != 2 and direction != 6 ):
char.message( 'You must be standing in front of or behind the dummy to use it.' )
! return 1
# Turn to the correct direction
--- 32,41 ----
if( item.id == 0x1070 and direction != 0 and direction != 4 ):
char.message( 'You must be standing in front of or behind the dummy to use it.' )
! return True
# For a e/w dummy we need to either face eath or west
elif( item.id == 0x1074 and direction != 2 and direction != 6 ):
char.message( 'You must be standing in front of or behind the dummy to use it.' )
! return True
# Turn to the correct direction
***************
*** 48,57 ****
if( skill != FENCING and skill != MACEFIGHTING and skill != SWORDSMANSHIP and skill != WRESTLING ):
char.message( "You can't train with this weapon on this dummy." )
! return 1
# If we've already learned all we can > cancel.
if( char.skill[ skill ] >= 300 ):
char.message( "You can learn much from a dummy but you have already learned it all." )
! return 1
# This increases the users skill
--- 48,57 ----
if( skill != FENCING and skill != MACEFIGHTING and skill != SWORDSMANSHIP and skill != WRESTLING ):
char.message( "You can't train with this weapon on this dummy." )
! return True
# If we've already learned all we can > cancel.
if( char.skill[ skill ] >= 300 ):
char.message( "You can learn much from a dummy but you have already learned it all." )
! return True
# This increases the users skill
***************
*** 74,78 ****
wolfpack.addtimer( random.randint( 2000, 3000 ), "training_dummy.resetid", [ item.serial ], 1 )
! return 1
# Reset the id of a swinging dummy
--- 74,78 ----
wolfpack.addtimer( random.randint( 2000, 3000 ), "training_dummy.resetid", [ item.serial ], 1 )
! return True
# Reset the id of a swinging dummy
Index: potionkeg.py
===================================================================
RCS file: /cvsroot/wpdev/xmlscripts/scripts/potionkeg.py,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** potionkeg.py 9 Jul 2004 10:30:25 -0000 1.7
--- potionkeg.py 11 Jul 2004 02:47:25 -0000 1.8
***************
*** 3,11 ****
import wolfpack
! from random import randint
! from wolfpack.time import *
! from wolfpack.consts import *
! from wolfpack.utilities import hex2dec, tobackpack
from potions import potions # Imports the potion table.
POT_RETURN_BOTTLE = 0
--- 3,10 ----
import wolfpack
! import wolfpack.time
! import wolfpack.utilities
from potions import potions # Imports the potion table.
+ #from wolfpack.consts import *
POT_RETURN_BOTTLE = 0
Index: signpost.py
===================================================================
RCS file: /cvsroot/wpdev/xmlscripts/scripts/signpost.py,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** signpost.py 26 May 2004 13:07:20 -0000 1.8
--- signpost.py 11 Jul 2004 02:47:25 -0000 1.9
***************
*** 1,5 ****
import wolfpack
- from wolfpack.consts import *
from wolfpack.gumps import cGump
# Register as a global script
--- 1,6 ----
+
import wolfpack
from wolfpack.gumps import cGump
+ from wolfpack.consts import EVENT_CHLEVELCHANGE
# Register as a global script
Index: xmlconfig.py
===================================================================
RCS file: /cvsroot/wpdev/xmlscripts/scripts/xmlconfig.py,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** xmlconfig.py 26 May 2004 13:07:20 -0000 1.7
--- xmlconfig.py 11 Jul 2004 02:47:25 -0000 1.8
***************
*** 1,3 ****
! from xml.dom.minidom import *
import sys
--- 1,3 ----
!
import sys
***************
*** 5,8 ****
--- 5,9 ----
import Pmw
import Tkinter
+ from xml.dom.minidom import *
class Option:
Index: shrine.py
===================================================================
RCS file: /cvsroot/wpdev/xmlscripts/scripts/shrine.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** shrine.py 3 Apr 2004 02:46:04 -0000 1.1
--- shrine.py 11 Jul 2004 02:47:25 -0000 1.2
***************
*** 5,10 ****
def onCollide(player, item):
if not player.dead or not player.player or not player.socket:
! return
player.resurrect()
! return 1
--- 5,10 ----
def onCollide(player, item):
if not player.dead or not player.player or not player.socket:
! return False
player.resurrect()
! return True
Index: pickpocket_dip.py
===================================================================
RCS file: /cvsroot/wpdev/xmlscripts/scripts/pickpocket_dip.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** pickpocket_dip.py 9 Jul 2004 21:47:45 -0000 1.4
--- pickpocket_dip.py 11 Jul 2004 02:47:25 -0000 1.5
***************
*** 17,30 ****
if( char.skill[ STEALING ] >= 600 ):
char.message( "Go search for real people." )
! return 1
# Either the dummy is swinging or we aren't assigned to a dummy
if( item.id != 0x1EC0 and item.id != 0x1EC3 ):
! return 1
# Distance & Direction checks
if( char.distanceto( item ) > 1 ):
char.message( 'You must be standing in front of or behind the dummy to use it.' )
! return 1
# Calculates the direction we'll have to look
--- 17,30 ----
if( char.skill[ STEALING ] >= 600 ):
char.message( "Go search for real people." )
! return True
# Either the dummy is swinging or we aren't assigned to a dummy
if( item.id != 0x1EC0 and item.id != 0x1EC3 ):
! return True
# Distance & Direction checks
if( char.distanceto( item ) > 1 ):
char.message( 'You must be standing in front of or behind the dummy to use it.' )
! return True
# Calculates the direction we'll have to look
***************
*** 35,39 ****
if( direction != 2 and direction != 6 ):
char.message( 'You must be standing in front of or behind the dummy to use it.' )
! return 1
# Turn to the correct direction if not already
--- 35,39 ----
if( direction != 2 and direction != 6 ):
char.message( 'You must be standing in front of or behind the dummy to use it.' )
! return True
# Turn to the correct direction if not already
***************
*** 45,49 ****
if( char.checkskill( STEALING, 0, 1000 ) ):
char.message( "You succeed in your try to pickpocket the dip" )
! return 1
if( item.id == 0x1EC0 ):
--- 45,49 ----
if( char.checkskill( STEALING, 0, 1000 ) ):
char.message( "You succeed in your try to pickpocket the dip" )
! return True
if( item.id == 0x1EC0 ):
***************
*** 65,69 ****
addtimer( "pickpocket_dip.resetid", 3000, (item.serial,) )
! return 1
# Reset the id of a swinging dummy
--- 65,69 ----
addtimer( "pickpocket_dip.resetid", 3000, (item.serial,) )
! return True
# Reset the id of a swinging dummy
Index: yarn.py
===================================================================
RCS file: /cvsroot/wpdev/xmlscripts/scripts/yarn.py,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** yarn.py 5 Apr 2004 20:37:46 -0000 1.9
--- yarn.py 11 Jul 2004 02:47:25 -0000 1.10
***************
*** 9,13 ****
import wolfpack
import wolfpack.utilities
! from wolfpack.consts import *
ids = [ 0x1063, 0x1066, 0x105f, 0x1061 ]
--- 9,13 ----
import wolfpack
import wolfpack.utilities
! from wolfpack.consts import GRAY
ids = [ 0x1063, 0x1066, 0x105f, 0x1061 ]
***************
*** 17,25 ****
if item.getoutmostchar() != char:
char.socket.clilocmessage( 500312, '', GRAY ) # You cannot reach that.
! return 1
char.socket.clilocmessage( 500366, '', GRAY ) # Select a loom to use that on.
char.socket.attachtarget( "yarn.response", [ item.serial ] )
! return 1
--- 17,25 ----
if item.getoutmostchar() != char:
char.socket.clilocmessage( 500312, '', GRAY ) # You cannot reach that.
! return True
char.socket.clilocmessage( 500366, '', GRAY ) # Select a loom to use that on.
char.socket.attachtarget( "yarn.response", [ item.serial ] )
! return True
***************
*** 33,46 ****
if ( ( char.pos.x-target.pos.x )**2 + ( char.pos.y-target.pos.y )**2 > 4):
char.socket.clilocmessage( 502648, '', GRAY) # You are too far away to do that.
! return 1
if abs( char.pos.z - target.pos.z ) > 5:
char.socket.clilocmessage( 502648, '', GRAY) # You are too far away to do that.
! return 1
# Check target (only item targets valid)
if not target.item:
char.socket.clilocmessage( 500367, '', GRAY ) # Try using that on a loom.
! return 1
if target.item.id in ids:
--- 33,46 ----
if ( ( char.pos.x-target.pos.x )**2 + ( char.pos.y-target.pos.y )**2 > 4):
char.socket.clilocmessage( 502648, '', GRAY) # You are too far away to do that.
! return True
if abs( char.pos.z - target.pos.z ) > 5:
char.socket.clilocmessage( 502648, '', GRAY) # You are too far away to do that.
! return True
# Check target (only item targets valid)
if not target.item:
char.socket.clilocmessage( 500367, '', GRAY ) # Try using that on a loom.
! return True
if target.item.id in ids:
|