[wpdev-commits] xmlscripts/scripts/skills __init__.py,1.7,1.8 mining.py,1.6,1.7
Brought to you by:
rip,
thiagocorrea
|
From: <dr...@us...> - 2004-01-16 21:14:23
|
Update of /cvsroot/wpdev/xmlscripts/scripts/skills
In directory sc8-pr-cvs1:/tmp/cvs-serv6444/scripts/skills
Modified Files:
__init__.py mining.py
Log Message:
Skills should now work, I disabled the anti macro stuff for now, because that is what was breaking it...
Mining now works too.
Index: __init__.py
===================================================================
RCS file: /cvsroot/wpdev/xmlscripts/scripts/skills/__init__.py,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** __init__.py 15 Nov 2003 20:55:13 -0000 1.7
--- __init__.py 16 Jan 2004 21:14:20 -0000 1.8
***************
*** 16,71 ****
{
! ALCHEMY: [0, 0.5, 0.5, 1, 1000, FALSE],
! ANATOMY: [0.15, 0.15, 0.7, 1, 1000, TRUE ],
! ANIMALLORE: [0, 0, 1, 1, 1000, TRUE ],
! ITEMID: [0, 0, 1, 1, 1000, TRUE ],
! ARMSLORE: [0.75, 0.15, 0.1, 1, 1000, TRUE ],
! PARRYING: [0.75, 0.25, 0, 1, 1000, FALSE],
! BEGGING: [0, 0, 0, 1, 1000, TRUE ],
! BLACKSMITHING: [1, 0, 0, 1, 1000, FALSE],
! BOWCRAFT: [0.6, 1.6, 0, 1, 1000, FALSE],
! PEACEMAKING: [0, 0, 0, 1, 1000, TRUE ],
! CAMPING: [2, 1.5, 1.5, 1, 1000, TRUE ],
! CARPENTRY: [2, 0.5, 0, 1, 1000, FALSE],
! CARTOGRAPHY: [0, 0.75, 0.75, 1, 1000, FALSE],
! COOKING: [0, 2, 3, 1, 1000, FALSE],
! DETECTINGHIDDEN: [0, 0.4, 0.6, 1, 1000, TRUE ],
! ENTICEMENT: [0, 0.25, 0.25, 1, 1000, TRUE ],
! EVALUATINGINTEL: [0, 0, 1, 1, 1000, TRUE ],
! HEALING: [0.6, 0.6, 0.8, 1, 1000, TRUE ],
! FISHING: [0.5, 0.5, 0, 1, 1000, TRUE ],
! FORENSICS: [0, 0.2, 0.8, 1, 1000, TRUE ],
! HERDING: [1.625,0.625, 0.25, 1, 1000, TRUE ],
! HIDING: [0, 0.8, 0.2, 1, 1000, TRUE ],
! PROVOCATION: [0, 0.45, 0.05, 1, 1000, TRUE ],
! INSCRIPTION: [0, 0.2, 0.8, 1, 1000, FALSE],
! LOCKPICKING: [0, 2, 0, 1, 1000, TRUE ],
! MAGERY: [0, 0, 1.5, 1, 1000, TRUE ],
! MAGICRESISTANCE: [0.25, 0.25, 0.5, 1, 1000, TRUE ],
! TACTICS: [0, 0, 0, 1, 1000, FALSE],
! SNOOPING: [0, 2.5, 0, 1, 1000, TRUE ],
! MUSICIANSHIP: [0, 0.8, 0.2, 1, 1000, TRUE ],
! POISONING: [0, 0.4, 1.6, 1, 1000, TRUE ],
! ARCHERY: [0.25, 0.75, 0, 1, 1000, FALSE],
! SPIRITSPEAK: [0, 0, 1, 1, 1000, TRUE ],
! STEALING: [0, 1, 0, 1, 1000, TRUE ],
! TAILORING: [0.38, 1.63, 0.5, 1, 1000, FALSE],
! TAMING: [1.4, 0.2, 0.4, 1, 1000, TRUE ],
! TASTEID: [0.2, 0, 0.8, 1, 1000, TRUE ],
! TINKERING: [0.5, 0.2, 0.3, 1, 1000, FALSE],
! TRACKING: [0, 1.25, 1.25, 1, 1000, TRUE ],
! VETERINARY: [0.8, 0.4, 0,8, 1, 1000, TRUE ],
! SWORDSMANSHIP: [0.75, 0.25, 0, 1, 1000, FALSE],
! MACEFIGHTING: [0.9, 0.1, 0, 1, 1000, FALSE],
! FENCING: [0.45, 0.55, 0, 1, 1000, FALSE],
! WRESTLING: [0.9, 0.1, 0, 1, 1000, FALSE],
! LUMBERJACKING: [2, 0, 0, 1, 1000, TRUE ],
! MINING: [2, 0, 0, 1, 1000, TRUE ],
! MEDITATION: [0, 0, 0, 1, 1000, TRUE ],
! STEALTH: [0, 0, 0, 1, 1000, TRUE ],
! REMOVETRAPS: [0, 0, 0, 1, 1000, TRUE ],
! NECROMANCY: [0, 0, 0, 1, 1000, TRUE ],
! FOCUS: [0, 0, 0, 1, 1000, FALSE],
! CHIVALRY: [0, 0, 0, 1, 1000, TRUE ]
}
--- 16,71 ----
{
! ALCHEMY: [0, 0.5, 0.5, 1, 1000, FALSE],
! ANATOMY: [0.15, 0.15, 0.7, 1, 1000, FALSE ],
! ANIMALLORE: [0, 0, 1, 1, 1000, FALSE ],
! ITEMID: [0, 0, 1, 1, 1000, FALSE ],
! ARMSLORE: [0.75, 0.15, 0.1, 1, 1000, FALSE ],
! PARRYING: [0.75, 0.25, 0, 1, 1000, FALSE],
! BEGGING: [0, 0, 0, 1, 1000, FALSE ],
! BLACKSMITHING: [1, 0, 0, 1, 1000, FALSE],
! BOWCRAFT: [0.6, 1.6, 0, 1, 1000, FALSE],
! PEACEMAKING: [0, 0, 0, 1, 1000, FALSE ],
! CAMPING: [2, 1.5, 1.5, 1, 1000, FALSE ],
! CARPENTRY: [2, 0.5, 0, 1, 1000, FALSE],
! CARTOGRAPHY: [0, 0.75, 0.75, 1, 1000, FALSE],
! COOKING: [0, 2, 3, 1, 1000, FALSE],
! DETECTINGHIDDEN: [0, 0.4, 0.6, 1, 1000, FALSE ],
! ENTICEMENT: [0, 0.25, 0.25, 1, 1000, FALSE ],
! EVALUATINGINTEL: [0, 0, 1, 1, 1000, FALSE ],
! HEALING: [0.6, 0.6, 0.8, 1, 1000, FALSE ],
! FISHING: [0.5, 0.5, 0, 1, 1000, FALSE ],
! FORENSICS: [0, 0.2, 0.8, 1, 1000, FALSE ],
! HERDING: [1.625, 0.625, 0.25, 1, 1000, FALSE ],
! HIDING: [0, 0.8, 0.2, 1, 1000, FALSE ],
! PROVOCATION: [0, 0.45, 0.05, 1, 1000, FALSE ],
! INSCRIPTION: [0, 0.2, 0.8, 1, 1000, FALSE],
! LOCKPICKING: [0, 2, 0, 1, 1000, FALSE ],
! MAGERY: [0, 0, 1.5, 1, 1000, FALSE ],
! MAGICRESISTANCE: [0.25, 0.25, 0.5, 1, 1000, FALSE ],
! TACTICS: [0, 0, 0, 1, 1000, FALSE],
! SNOOPING: [0, 2.5, 0, 1, 1000, FALSE ],
! MUSICIANSHIP: [0, 0.8, 0.2, 1, 1000, FALSE ],
! POISONING: [0, 0.4, 1.6, 1, 1000, FALSE ],
! ARCHERY: [0.25, 0.75, 0, 1, 1000, FALSE],
! SPIRITSPEAK: [0, 0, 1, 1, 1000, FALSE ],
! STEALING: [0, 1, 0, 1, 1000, FALSE ],
! TAILORING: [0.38, 1.63, 0.5, 1, 1000, FALSE],
! TAMING: [1.4, 0.2, 0.4, 1, 1000, FALSE ],
! TASTEID: [0.2, 0, 0.8, 1, 1000, FALSE ],
! TINKERING: [0.5, 0.2, 0.3, 1, 1000, FALSE],
! TRACKING: [0, 1.25, 1.25, 1, 1000, FALSE ],
! VETERINARY: [0.8, 0.4, 0,8, 1, 1000, FALSE ],
! SWORDSMANSHIP: [0.75, 0.25, 0, 1, 1000, FALSE],
! MACEFIGHTING: [0.9, 0.1, 0, 1, 1000, FALSE],
! FENCING: [0.45, 0.55, 0, 1, 1000, FALSE],
! WRESTLING: [0.9, 0.1, 0, 1, 1000, FALSE],
! LUMBERJACKING: [2, 0, 0, 1, 1000, FALSE ],
! MINING: [2, 0, 0, 1, 1000, FALSE ],
! MEDITATION: [0, 0, 0, 1, 1000, FALSE ],
! STEALTH: [0, 0, 0, 1, 1000, FALSE ],
! REMOVETRAPS: [0, 0, 0, 1, 1000, FALSE ],
! NECROMANCY: [0, 0, 0, 1, 1000, FALSE ],
! FOCUS: [0, 0, 0, 1, 1000, FALSE],
! CHIVALRY: [0, 0, 0, 1, 1000, FALSE ]
}
***************
*** 100,104 ****
resourceitem.id = table[ resname ][ RESOURCEID ]
resourceitem.amount = amount
! gem.settag( 'resourcecount', gem.gettag( 'resourcecount' ) - amount )
backpack.additem( resourceitem )
--- 100,104 ----
resourceitem.id = table[ resname ][ RESOURCEID ]
resourceitem.amount = amount
! gem.settag( 'resourcecount', str( int( gem.gettag( 'resourcecount' ) ) - amount ) )
backpack.additem( resourceitem )
***************
*** 129,133 ****
#If you lucky and antimacro is agree so let's gain this skill
! if ( gainchance >= whrandom.random() and antimacrocheck( char, skillid, targetobject ) ) or skillvalue < 100:
skillgain( char, skillid )
--- 129,133 ----
#If you lucky and antimacro is agree so let's gain this skill
! if ( gainchance >= whrandom.random() ) or skillvalue < 100:
skillgain( char, skillid )
***************
*** 174,181 ****
def statgain( char, stat ):
#STATGAINDELAY is not over ?
! if char.hastag( 'laststatgain' ) and ( time.time() - char.gettag( 'laststatgain' ) ) < STATGAINDELAY:
return OOPS
! char.settag( 'laststatgain', time.time() )
if float( totalstats( char ) ) / wolfpack.settings.getNumber( "General", "StatCap", 225 ) >= whrandom.random():
if stat == STRENGTH:
--- 174,181 ----
def statgain( char, stat ):
#STATGAINDELAY is not over ?
! if char.hastag( 'laststatgain' ) and ( time.time() - int(char.gettag( 'laststatgain' ) ) ) < STATGAINDELAY:
return OOPS
! char.settag( 'laststatgain', str( time.time() ) )
if float( totalstats( char ) ) / wolfpack.settings.getNumber( "General", "StatCap", 225 ) >= whrandom.random():
if stat == STRENGTH:
***************
*** 199,206 ****
def antimacrocheck( char, skillid, object ):
#Get or set antimacro tag: "AM" + SERIAL = COUNT
! tagname = "AMAC" + str( char.serial ) + " " + str( skillid )
! if object.hastag( tagname ):
count = object.gettag( tagname )
! object.settag( tagname, count + 1 )
if count <= ANTIMACROALLOWANCE:
return OK
--- 199,206 ----
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 )
! object.settag( tagname, str( int( count + 1 ) ) )
if count <= ANTIMACROALLOWANCE:
return OK
***************
*** 211,215 ****
return OOPS
else:
! object.settag( tagname, 1 )
return OK
--- 211,215 ----
return OOPS
else:
! object.settag( tagname, "1" )
return OK
Index: mining.py
===================================================================
RCS file: /cvsroot/wpdev/xmlscripts/scripts/skills/mining.py,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** mining.py 15 Nov 2003 20:55:13 -0000 1.6
--- mining.py 16 Jan 2004 21:14:20 -0000 1.7
***************
*** 22,162 ****
oretable = \
{
! 'iron': [ 0, 0, 1000, 1007072, 0x19b9, 0, 49.6, 0 ],
! 'dullcopper': [ 650, 250, 1050, 1007073, 0x19b9, 0x973, 11.2, 50 ],
! 'shadowiron': [ 700, 300, 1100, 1007074, 0x19b9, 0x966, 9.8, 50 ],
! 'copper': [ 750, 350, 1150, 1007075, 0x19b9, 0x960, 8.4, 50 ],
! 'bronze': [ 800, 400, 1200, 1007076, 0x19b9, 0x972, 7, 50 ],
! 'gold': [ 850, 450, 1250, 1007077, 0x19b9, 0x8a5, 5.6, 50 ],
! 'agapite': [ 900, 500, 1300, 1007078, 0x19b9, 0x979, 4.2, 50 ],
! 'verite': [ 950, 550, 1350, 1007079, 0x19b9, 0x89f, 2.8, 50 ],
! 'valorite': [ 990, 590, 1390, 1007080, 0x19b9, 0x8ab, 1.4, 50 ]
}
def mining( char, pos, tool ):
! char.addtimer( 1300, "skills.mining.domining", [oresound,tool,pos] )
! char.settag( 'is_mining', servertime() + miningdelay )
! char.turnto( pos )
! char.action( 11 )
!
! return OK
def getvein( socket, pos ):
! #Check if we have ore_gems near ( range = 4 )
! gems = wolfpack.items( pos.x, pos.y, pos.map, 4 )
! if len( gems ) < 1:
! gem = wolfpack.additem( 'ore_gem' )
! gem.settag( 'resourcecount', whrandom.randint( 10, 34 ) )
! gem.settag( 'resname', 'iron' )
! gem.moveto( pos )
! gem.visible = 0
! gem.update()
! return gem
! else:
! return gems[0]
#Response from mining tool
def response( char, args, target ):
! socket = char.socket
! if not socket:
! return OOPS
!
! pos = target.pos
!
! # Player can reach that ?
! if char.pos.map != pos.map or char.pos.distance( pos ) > MINING_MAX_DISTANCE:
! socket.clilocmessage( 500446, "", RED, NORMAL ) # That is too far away
! return OK
!
! tool = args[0]
!
! #Player also can't mine when riding, polymorphed and dead.
! #Mine char ?!
! if target.char:
! socket.clilocmessage( 501863, "", RED, NORMAL ) # You can't mine that.
! return OK
!
!
! #Check if item is ore gem
! elif target.item and isoregem( target.item ):
! #Mine if ore gem is validated
! socket.sysmessage( 'Ore gem founded' )
! mining( char, target.pos, tool )
! return OK
!
! #Find tile by it's position if we haven't model
! elif target.model == 0:
! map = wolfpack.map( target.pos.x, target.pos.y, target.pos.map )
! if ismountainorcave( map['id'] ):
! mining( char, target.pos, tool )
! else:
! socket.clilocmessage( 501862, "", RED, NORMAL ) # You can't mine there.
! return OK
!
! #Find tile by it's model
! elif target.model != 0:
! if ismountainorcave( target.model ):
! #add new ore gem here and mine
! mining( char, target.pos, tool )
! else:
! socket.clilocmessage( 501862, "", RED, NORMAL ) # You can't mine there.
! return OK
! else:
! return OOPS
!
! return OK
#Sound effect
def domining( char, args ):
! char.soundeffect( args[0] )
! tool = args[1]
! pos = args[2]
! socket = char.socket
!
! if char.hastag( 'mining_gem' ):
! veingem = wolfpack.finditem( char.gettag( 'mining_gem' ) )
! if not veingem:
! veingem = getvein( socket, pos )
! if not veingem:
! char.deltag( 'mining_gem' )
! return OOPS
! else:
! veingem = getvein( socket, pos )
! if not veingem:
! return OOPS
! else:
! char.settag( 'mining_gem', veingem.serial )
!
! if char.distanceto( veingem ) > MINING_MAX_DISTANCE:
! veingem = getvein( socket, pos )
!
! if not veingem:
! return OOPS
!
! if not veingem.hastag( 'resname' ) or not veingem.hastag( 'resourcecount' ):
! return OOPS
!
! resname = veingem.gettag( 'resname' ) # Sometimes mutated in colored ore and back
! resourcecount = veingem.gettag( 'resourcecount' )
! reqskill = oretable[ resname ][ REQSKILL ]
!
! success = 0
! char.update()
! char.updatestats()
!
! # Are you skilled enough ? And here is ore ?
! if resourcecount > 2 and ( char.skill[ MINING ] >= reqskill or char.skill[ MINING ] <= 100 ):
! skills.checkskill( char, veingem, MINING, 0 )
! if whrandom.random() > 0.7:
! skills.successharvest( char, veingem, oretable, resname, 1 ) # 1 - amount of ore
! success = 1
!
!
!
! if success == 0:
! socket.clilocmessage( 501869, "", GRAY, NORMAL ) # You loosen some rocks but fail to find any usable ore.
!
! char.deltag('nowmining')
! return OK
--- 22,160 ----
oretable = \
{
! 'iron': [ 0, 0, 1000, 1007072, 0x19b9, 0x0, 49.6, 0 ],
! 'dullcopper': [ 650, 250, 1050, 1007073, 0x19b9, 0x973, 11.2, 50 ],
! 'shadowiron': [ 700, 300, 1100, 1007074, 0x19b9, 0x966, 9.8, 50 ],
! 'copper': [ 750, 350, 1150, 1007075, 0x19b9, 0x960, 8.4, 50 ],
! 'bronze': [ 800, 400, 1200, 1007076, 0x19b9, 0x972, 7, 50 ],
! 'gold': [ 850, 450, 1250, 1007077, 0x19b9, 0x8a5, 5.6, 50 ],
! 'agapite': [ 900, 500, 1300, 1007078, 0x19b9, 0x979, 4.2, 50 ],
! 'verite': [ 950, 550, 1350, 1007079, 0x19b9, 0x89f, 2.8, 50 ],
! 'valorite': [ 990, 590, 1390, 1007080, 0x19b9, 0x8ab, 1.4, 50 ]
}
def mining( char, pos, tool ):
! char.addtimer( 1300, "skills.mining.domining", [ oresound, tool, pos ] )
! char.settag( 'is_mining', str( servertime() + miningdelay ) )
! char.turnto( pos )
! char.action( ANIM_ATTACK3 )
!
! return OK
def getvein( socket, pos ):
! #Check if we have ore_gems near ( range = 4 )
! gems = wolfpack.items( pos.x, pos.y, pos.map, 4 )
! if len( gems ) < 1:
! gem = wolfpack.additem( 'ore_gem' )
! gem.settag( 'resourcecount', str( whrandom.randint( 10, 34 ) ) )
! gem.settag( 'resname', 'iron' )
! gem.moveto( pos )
! gem.visible = 0
! gem.update()
! return gem
! else:
! return gems[0]
#Response from mining tool
def response( char, args, target ):
! socket = char.socket
! if not socket:
! return OOPS
!
! pos = target.pos
!
! # Player can reach that ?
! if char.pos.map != pos.map or char.pos.distance( pos ) > MINING_MAX_DISTANCE:
! socket.clilocmessage( 500446, "", RED, NORMAL ) # That is too far away
! return OK
!
! tool = args[0]
!
! #Player also can't mine when riding, polymorphed and dead.
! #Mine char ?!
! if target.char:
! socket.clilocmessage( 501863, "", RED, NORMAL ) # You can't mine that.
! return OK
!
!
! #Check if item is ore gem
! elif target.item and isoregem( target.item ):
! #Mine if ore gem is validated
! socket.sysmessage( 'Ore gem founded' )
! mining( char, target.pos, tool )
! return OK
!
! #Find tile by it's position if we haven't model
! elif target.model == 0:
! map = wolfpack.map( target.pos.x, target.pos.y, target.pos.map )
! if ismountainorcave( map['id'] ):
! mining( char, target.pos, tool )
! else:
! socket.clilocmessage( 501862, "", RED, NORMAL ) # You can't mine there.
! return OK
!
! #Find tile by it's model
! elif target.model != 0:
! if ismountainorcave( target.model ):
! #add new ore gem here and mine
! mining( char, target.pos, tool )
! else:
! socket.clilocmessage( 501862, "", RED, NORMAL ) # You can't mine there.
! return OK
! else:
! return OOPS
!
! return OK
#Sound effect
def domining( char, args ):
! char.soundeffect( args[0] )
! tool = args[1]
! pos = args[2]
! socket = char.socket
! if char.hastag( 'mining_gem' ):
! veingem = wolfpack.finditem( char.gettag( 'mining_gem' ) )
! if not veingem:
! veingem = getvein( socket, pos )
! if not veingem:
! char.deltag( 'mining_gem' )
! return OOPS
! else:
! veingem = getvein( socket, pos )
! if not veingem:
! return OOPS
! else:
! char.settag( 'mining_gem', str( veingem.serial ) )
!
! if char.distanceto( veingem ) > MINING_MAX_DISTANCE:
! veingem = getvein( socket, pos )
!
! if not veingem:
! return OOPS
!
! if not veingem.hastag( 'resname' ) or not veingem.hastag( 'resourcecount' ):
! return OOPS
!
! resname = veingem.gettag( 'resname' ) # Sometimes mutated in colored ore and back
! resourcecount = int( veingem.gettag( 'resourcecount' ) )
! reqskill = oretable[ resname ][ REQSKILL ]
!
! success = 0
! char.update()
! char.updatestats()
!
! # Are you skilled enough ? And here is ore ?
! if resourcecount > 2 and ( char.skill[ MINING ] >= reqskill or char.skill[ MINING ] <= 100 ):
! skills.checkskill( char, veingem, MINING, 0 )
! if whrandom.random() > 0.7:
! skills.successharvest( char, veingem, oretable, resname, 1 ) # 1 - amount of ore
! success = 1
!
! if success == 0:
! socket.clilocmessage( 501869, "", GRAY, NORMAL ) # You loosen some rocks but fail to find any usable ore.
!
! char.deltag('is_mining')
!
! return OK
|