Update of /cvsroot/wpdev/xmlscripts/scripts/wolfpack/commands
In directory sc8-pr-cvs1:/tmp/cvs-serv4351
Added Files:
skill.py stat.py
Log Message:
'stat and 'skill commands added
--- NEW FILE: skill.py ---
#===============================================================#
# ) (\_ | WOLFPACK 13.0.0 Scripts #
# (( _/{ "-; | Created by: codex #
# )).-' {{ ;'` | Revised by: #
# ( ( ;._ \\ ctr | Last Modification: Created #
#===============================================================#
# skill Command #
#===============================================================#
import wolfpack
import string
from wolfpack.consts import *
usage = 'Usage: skill <skill-name> <value*10>'
example = 'Example: skill mining 1000'
def skill( socket, command, args ):
args = args.strip() # Remove trailing and leading whitespaces
if len( args ) > 0:
try:
( skill, value ) = args.split( ' ' )
skill = str( skill )
value = int( value )
except:
socket.sysmessage( usage )
socket.sysmessage( example )
return OK
else:
socket.sysmessage( usage )
socket.sysmessage( example )
return OK
# Uknown skill name ?
if not skill in skillnamesids:
socket.clilocmessage( 500156, "", YELLOW, NORMAL ) # Invalid skill
# Accept 0 >= value <= 1000 skill value only. 1200 maximum - with power scrolls only
elif value < 0 or value > 1000:
socket.clilocmessage( 1005632, "", YELLOW, NORMAL ) # Skill values range from 0 - 1000.
return OK
socket.clilocmessage( 503403, "", YELLOW, NORMAL ) # Select the body.
socket.attachtarget( "wolfpack.commands.skill.callback", [ skill, value ] )
return OK
def callback( char, args, target ):
socket = char.socket
# What are you targeted ?
if not target.char:
socket.clilocmessage( 500931, "", YELLOW, NORMAL ) # Invalid mobile
return OK
# Is target not your own char ?
if not char == target.char:
socket.clilocmessage( 1005213, "", YELLOW, NORMAL ) # You can't do that
return OK
( skill, value ) = args
char.skill[ skillnamesids[ skill ] ] = value
return OK
def onLoad():
wolfpack.registercommand( "skill", skill )
--- NEW FILE: stat.py ---
#===============================================================#
# ) (\_ | WOLFPACK 13.0.0 Scripts #
# (( _/{ "-; | Created by: codex #
# )).-' {{ ;'` | Revised by: #
# ( ( ;._ \\ ctr | Last Modification: Created #
#===============================================================#
# stat Command #
#===============================================================#
import wolfpack
import string
from wolfpack.consts import *
usage = 'Usage: stat <short-stat-name> <value>'
example = 'Example: stat str 100'
def stat( socket, command, args ):
args = args.strip() # Remove trailing and leading whitespaces
if len( args ) > 0:
try:
( stat, value ) = args.split( ' ' )
stat = str( stat )
value = int( value )
except:
socket.sysmessage( usage )
socket.sysmessage( example )
return OK
else:
socket.sysmessage( usage )
socket.sysmessage( example )
return OK
# Uknown stat name ?
if not stat in statnames:
socket.clilocmessage( 3000380, "", YELLOW, NORMAL ) # I Accept
socket.sysmessage( str( statnames ) )
return OK
# Accept 10 >= value <= 125 only.
elif value < 0 or value > 125:
socket.clilocmessage( 1005628, "", YELLOW, NORMAL ) # Stats range between 10 and 125
return OK
socket.clilocmessage( 503403, "", YELLOW, NORMAL ) # Select the body.
socket.attachtarget( "wolfpack.commands.stat.callback", [ stat, value ] )
return OK
def callback( char, args, target ):
socket = char.socket
# What are you targeted ?
if not target.char:
socket.clilocmessage( 500931, "", YELLOW, NORMAL ) # Invalid mobile
return OK
# Is target not your own char ?
if not char == target.char:
socket.clilocmessage( 1005213, "", YELLOW, NORMAL ) # You can't do that
return OK
( stat, value ) = args
if stat == 'str':
char.strength = value
elif stat == 'int':
char.intelligence = value
elif stat == 'dex':
char.dexterity = value
else:
socket.clilocmessage( 3000380, "", YELLOW, NORMAL ) # I Accept
socket.sysmessage( str( statnames ) )
return OK
socket.clilocmessage( 1005630, "", YELLOW, NORMAL ) # Your stats have been adjusted.
char.updatestats()
return OK
def onLoad():
wolfpack.registercommand( "stat", stat )
|