Update of /cvsroot/wpdev/xmlscripts/scripts/skills
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29446/skills
Modified Files:
__init__.py provocation.py
Log Message:
More cleanups/tweaks.
Also, a fix from Kid_Sk8 that is supposed to fix provocation, though I didn't see what really changed.
Index: provocation.py
===================================================================
RCS file: /cvsroot/wpdev/xmlscripts/scripts/skills/provocation.py,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** provocation.py 26 May 2004 13:07:25 -0000 1.9
--- provocation.py 17 Jul 2004 03:49:21 -0000 1.10
***************
*** 7,75 ****
import wolfpack
! from wolfpack.consts import *
from math import floor
- from wolfpack.utilities import *
import skills
def provocation( char, skill ):
# Only handle provocation
if skill != PROVOCATION:
! return
! if not char.socket.hastag( 'instrument' ):
! char.socket.clilocmessage( 0x7A74E, '', 0x3b2, 3 ) # What instrument shall I play music on?
! char.socket.attachtarget( "skills.provocation.findinstrument" )
! return 1
! instserial = char.socket.gettag( 'instrument' )
instrument = wolfpack.finditem( instserial )
backpack = char.getbackpack()
if not instrument or not instrument.getoutmostitem() == backpack:
! char.socket.clilocmessage( 0x7A74E, "", 0x3b2, 3 ) # What instrument shall I play music on?
! char.socket.attachtarget( "skills.provocation.findinstrument" )
! return 1
!
! char.socket.clilocmessage( 0x7A74D, "", 0x3b2, 3 ) # What do you wish to incite?
! char.socket.attachtarget( "skills.provocation.response1", [instrument] )
! return 1
def response1( char, args, target ):
!
instrument = args[0]
if target.item:
! char.socket.clilocmessage( 0x7A755, "", 0x3b2, 3 ) # You can't incite that!
! return
if target.char:
if target.char.socket:
! char.socket.clilocmessage( 0x7A754, "", 0x3b2, 3 ) # Verbal taunts might be more effective!
! return
if target.char.tamed:
! char.socket.clilocmessage( 0x7A756, "", 0x3b2, 3 ) # They are too loyal to their master to be provoked.
! return
! if target.char.priv & 0x04 or target.char.dead:
! char.socket.clilocmessage( 0x7A755, "", 0x3b2, 3 ) # You can't incite that!
! return
if target.char.id == 0x191 or target.char.id == 0x190:
! char.socket.clilocmessage( 0x7A757, "", 0x3b2, 3, target.char )
! return
tobardtarget1 = tobard( target.char, "provocation" )
playinstrument( char, instrument, "success" )
! char.socket.clilocmessage( 0xF61D5, "", 0x3b2, 3 ) # You play your music and your target becomes angered. Whom do you wish them to attack?
! char.socket.attachtarget( "skills.provocation.response2", [target.char, tobardtarget1, instrument] )
! return 1
def response2( char, args, target ):
if not target.char:
! return
creature1 = args[0]
--- 7,79 ----
import wolfpack
! import wolfpack.utilities
! from wolfpack.consts import PROVOCATION, MUSICIANSHIP, ALLSKILLS, MAGERY
from math import floor
import skills
def provocation( char, skill ):
+ socket = char.socket
+
+ if not char.socket:
+ return False
# Only handle provocation
if skill != PROVOCATION:
! return False
! if not socket.hastag( 'instrument' ):
! socket.clilocmessage( 0x7A74E, '', 0x3b2, 3 ) # What instrument shall I play music on?
! socket.attachtarget( "skills.provocation.findinstrument" )
! return True
! instserial = socket.gettag( 'instrument' )
instrument = wolfpack.finditem( instserial )
backpack = char.getbackpack()
if not instrument or not instrument.getoutmostitem() == backpack:
! socket.clilocmessage( 0x7A74E, "", 0x3b2, 3 ) # What instrument shall I play music on?
! socket.attachtarget( "skills.provocation.findinstrument" )
! return True
! socket.clilocmessage( 0x7A74D, "", 0x3b2, 3 ) # What do you wish to incite?
! socket.attachtarget( "skills.provocation.response1", [instrument] )
! return True
def response1( char, args, target ):
! socket = char.socket
instrument = args[0]
if target.item:
! socket.clilocmessage( 0x7A755, "", 0x3b2, 3 ) # You can't incite that!
! return False
if target.char:
if target.char.socket:
! socket.clilocmessage( 0x7A754, "", 0x3b2, 3 ) # Verbal taunts might be more effective!
! return False
if target.char.tamed:
! socket.clilocmessage( 0x7A756, "", 0x3b2, 3 ) # They are too loyal to their master to be provoked.
! return False
! if target.char.priv or target.char.dead: #if target.char.priv & 0x04 or target.char.dead:
! socket.clilocmessage( 0x7A755, "", 0x3b2, 3 ) # You can't incite that!
! return False
if target.char.id == 0x191 or target.char.id == 0x190:
! socket.clilocmessage( 0x7A757, "", 0x3b2, 3, target.char )
! return False
tobardtarget1 = tobard( target.char, "provocation" )
playinstrument( char, instrument, "success" )
! socket.clilocmessage( 0xF61D5, "", 0x3b2, 3 ) # You play your music and your target becomes angered. Whom do you wish them to attack?
! socket.attachtarget( "skills.provocation.response2", [target.char, tobardtarget1, instrument] )
! return True
def response2( char, args, target ):
+ socket = char.socket
if not target.char:
! return False
creature1 = args[0]
***************
*** 81,113 ****
if target.char.socket or target.char.priv & 0x04:
! char.socket.clilocmessage( 0xF463A, "", 0x3b2, 3 ) # You cannot perform negative acts on your target.
! return
if target.char == creature1:
! char.socket.clilocmessage( 0x7A759, "", 0x3b2, 3 ) # You can't tell someone to attack themselves!
! return
if target.char.owner:
! char.socket.clilocmessage( 0x7A756, "", 0x3b2, 3 ) # They are too loyal to their master to be provoked.
! return
if not char.distanceto( target.char ) <= 12 or not char.distanceto( creature1 ) <= 12:
! char.socket.clilocmessage( 0x100369, "", 0x3b2, 3 ) # You are too far away from one or both of the creatures for your music to have an effect.
! return
if not target.char.distanceto( creature1 ) < 20:
! char.socket.clilocmessage( 0x10036A, "", 0x3b2, 3 ) # The creatures you are trying to provoke are too far away from each other for your music to have an effect.
! return
# TODO : bonus for slaying items
if not char.skill[ PROVOCATION ] >= minimum:
! char.socket.clilocmessage( 0x100366, "", 0x3b2, 3 ) # You have no chance of provoking those creatures.
! return
if not char.checkskill( MUSICIANSHIP, 0, 1000 ):
playinstrument( char, instrument, "fail" )
! char.socket.clilocmessage( 0x7A75C, "", 0x3b2, 3 ) # You play rather poorly, and to no effect.
! return
if not char.checkskill( PROVOCATION, minimum, maximum ):
--- 85,117 ----
if target.char.socket or target.char.priv & 0x04:
! socket.clilocmessage( 0xF463A, "", 0x3b2, 3 ) # You cannot perform negative acts on your target.
! return False
if target.char == creature1:
! socket.clilocmessage( 0x7A759, "", 0x3b2, 3 ) # You can't tell someone to attack themselves!
! return False
if target.char.owner:
! socket.clilocmessage( 0x7A756, "", 0x3b2, 3 ) # They are too loyal to their master to be provoked.
! return False
if not char.distanceto( target.char ) <= 12 or not char.distanceto( creature1 ) <= 12:
! socket.clilocmessage( 0x100369, "", 0x3b2, 3 ) # You are too far away from one or both of the creatures for your music to have an effect.
! return False
if not target.char.distanceto( creature1 ) < 20:
! socket.clilocmessage( 0x10036A, "", 0x3b2, 3 ) # The creatures you are trying to provoke are too far away from each other for your music to have an effect.
! return False
# TODO : bonus for slaying items
if not char.skill[ PROVOCATION ] >= minimum:
! socket.clilocmessage( 0x100366, "", 0x3b2, 3 ) # You have no chance of provoking those creatures.
! return False
if not char.checkskill( MUSICIANSHIP, 0, 1000 ):
playinstrument( char, instrument, "fail" )
! socket.clilocmessage( 0x7A75C, "", 0x3b2, 3 ) # You play rather poorly, and to no effect.
! return False
if not char.checkskill( PROVOCATION, minimum, maximum ):
***************
*** 116,121 ****
creature1.target = char
creature1.update()
! char.socket.clilocmessage( 0x7A75F, "", 0x3b2, 3 ) # Your music fails to incite enough anger.
! return
playinstrument( char, instrument, "success" )
--- 120,125 ----
creature1.target = char
creature1.update()
! socket.clilocmessage( 0x7A75F, "", 0x3b2, 3 ) # Your music fails to incite enough anger.
! return False
playinstrument( char, instrument, "success" )
***************
*** 126,137 ****
creature1.update()
target.char.update()
! char.socket.clilocmessage( 0x7A762, "", 0x3b2, 3 ) # Your music succeeds, as you start a fight.
! return 1
def findinstrument( char, args, target ):
if not target.item:
! char.socket.clilocmessage( 0x7A752, "", 0x3b2, 3 ) # That isn't a musical instrument.
! return
instruments = [ 0xE9C, 0xE9D, 0xE9E, 0xEB1, 0xEB2, 0xEB3, 0xEB4 ]
--- 130,145 ----
creature1.update()
target.char.update()
! socket.clilocmessage( 0x7A762, "", 0x3b2, 3 ) # Your music succeeds, as you start a fight.
! return True
def findinstrument( char, args, target ):
+ socket = char.socket
+
+ if not char.socket:
+ return False
if not target.item:
! socket.clilocmessage( 0x7A752, "", 0x3b2, 3 ) # That isn't a musical instrument.
! return False
instruments = [ 0xE9C, 0xE9D, 0xE9E, 0xEB1, 0xEB2, 0xEB3, 0xEB4 ]
***************
*** 141,184 ****
if not target.item.getoutmostitem() == backpack:
if not char.canreach( target.item, 8 ):
! char.socket.clilocmessage( 0x7A74F, "", 0x3b2, 3 ) # You cannot see that.
! return
if not char.distanceto( target.item ) <= 3:
! char.socket.clilocmessage( 0x7A750, "", 0x3b2, 3 ) # That is too far away.
! return
if not target.item.id in instruments:
! char.socket.clilocmessage( 0x7A752, "", 0x3b2, 3 ) # That isn't a musical instrument.
! return
! char.socket.settag( 'instrument', serial )
! char.socket.clilocmessage( 0x7A753, "", 0x3b2, 3, )
! char.socket.attachtarget( "skills.provocation.response1", [target.item] )
def playinstrument( char, item, how ):
!
# Instrument ID: [ Success Sound, Fail Sound ]
instruments = {
! 0xE9C:[ 0x38, 0x39 ],# Drum
! 0xE9D:[ 0x52, 0x53 ],# Tambourine
! 0xE9E:[ 0x52, 0x53 ],# Tambourine with tassle
! 0xEB1:[ 0x43, 0x44 ],# Standing Harp
! 0xEB2:[ 0x45, 0x46 ],# Harp
! 0xEB3:[ 0x4C, 0x4D ],# Lute (N/S)
! 0xEB4:[ 0x4C, 0x4D ] # Lute (E/S)
! }
if how == "success":
char.soundeffect( instruments[ item.id ][ 0 ] )
! return 1
else:
char.soundeffect( instruments[ item.id ][ 1 ] )
! return 1
!
def tobard( char, type ):
!
value = skilltotal( char )
! value += char.health + char.stamina + char.mana
if char.skill[ MAGERY ] > 0:
--- 149,192 ----
if not target.item.getoutmostitem() == backpack:
if not char.canreach( target.item, 8 ):
! socket.clilocmessage( 0x7A74F, "", 0x3b2, 3 ) # You cannot see that.
! return False
if not char.distanceto( target.item ) <= 3:
! socket.clilocmessage( 0x7A750, "", 0x3b2, 3 ) # That is too far away.
! return False
if not target.item.id in instruments:
! socket.clilocmessage( 0x7A752, "", 0x3b2, 3 ) # That isn't a musical instrument.
! return False
! socket.settag( 'instrument', serial )
! socket.clilocmessage( 0x7A753, "", 0x3b2, 3, )
! socket.attachtarget( "skills.provocation.response1", [target.item] )
! return True
def playinstrument( char, item, how ):
! socket = char.socket
# Instrument ID: [ Success Sound, Fail Sound ]
instruments = {
! 0xE9C:[ 0x38, 0x39 ],# Drum
! 0xE9D:[ 0x52, 0x53 ],# Tambourine
! 0xE9E:[ 0x52, 0x53 ],# Tambourine with tassle
! 0xEB1:[ 0x43, 0x44 ],# Standing Harp
! 0xEB2:[ 0x45, 0x46 ],# Harp
! 0xEB3:[ 0x4C, 0x4D ],# Lute (N/S)
! 0xEB4:[ 0x4C, 0x4D ] # Lute (E/S)
! }
if how == "success":
char.soundeffect( instruments[ item.id ][ 0 ] )
! return True
else:
char.soundeffect( instruments[ item.id ][ 1 ] )
! return True
def tobard( char, type ):
! socket = char.socket
value = skilltotal( char )
! value += ( char.hitpoints + char.stamina + char.mana )
if char.skill[ MAGERY ] > 0:
Index: __init__.py
===================================================================
RCS file: /cvsroot/wpdev/xmlscripts/scripts/skills/__init__.py,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -d -r1.16 -r1.17
*** __init__.py 16 Jul 2004 07:09:27 -0000 1.16
--- __init__.py 17 Jul 2004 03:49:21 -0000 1.17
***************
*** 108,112 ****
def antimacrocheck( char, skillid, object ):
#Get or set antimacro tag: "AM" + SERIAL = COUNT
! tagname = "AMC_" + str( char.serial ) + " " + str( skillid )
if object.hastag( tagname ):
count = object.gettag( tagname )
--- 108,112 ----
def antimacrocheck( char, skillid, object ):
#Get or set antimacro tag: "AM" + SERIAL = COUNT
! tagname = "AMC_%i_%i" % ( char.serial, skillid )
if object.hastag( tagname ):
count = object.gettag( tagname )
|