[wpdev-commits] xmlscripts/scripts/tools pickaxe.py,1.3,1.4
Brought to you by:
rip,
thiagocorrea
|
From: <co...@us...> - 2003-09-30 16:41:33
|
Update of /cvsroot/wpdev/xmlscripts/scripts/tools
In directory sc8-pr-cvs1:/tmp/cvs-serv3746
Modified Files:
pickaxe.py
Log Message:
pickaxe
Index: pickaxe.py
===================================================================
RCS file: /cvsroot/wpdev/xmlscripts/scripts/tools/pickaxe.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** pickaxe.py 29 Sep 2003 17:14:54 -0000 1.3
--- pickaxe.py 30 Sep 2003 16:41:30 -0000 1.4
***************
*** 10,94 ****
import wolfpack
import skills
from wolfpack.time import *
from wolfpack.utilities import *
- orebank = [] # 8x8 ore and stone bank
- sandbank = [] # 8x8 sand bank
! def onUse( char, item ):
! if item.getoutmostchar() != char:
char.socket.clilocmessage( 500364, "", YELLOW, NORMAL ) # You can't use that, it belongs to someone else
! return OOPS
! if isminingtool(item):
char.socket.clilocmessage( 503033, "", YELLOW, NORMAL ) # Where do you wish to dig?
! char.socket.attachtarget( "tools.pickaxe.response" )
!
else:
char.socket.clilocmessage( 500735, "", YELLOW, NORMAL ) # Don't play with things you don't know about. :)
- return OOPS
-
- return OK
-
- def response( char, args, target ):
- socket = char.socket
-
- if not socket:
- return OOPS
-
- #Player also can't mine when riding, polymorphed and dead.
- #Mine char ?!
- if target.char:
- socket.clilocmessage( 501863, "", YELLOW, 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.item )
- 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'] ):
- veingem = getvein( socket, target.pos )
- mining( char, veingem )
- else:
- socket.clilocmessage( 501862, "", YELLOW, 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
- veingem = getvein( socket, target.pos )
- mining( char, veingem )
- else:
- socket.clilocmessage( 501862, "", YELLOW, NORMAL ) # You can't mine there.
- return OK
- else:
- return OOPS
-
return OK
- def mining( char, veingem ):
- socket = char.socket
- resourcecount = veingem.gettag( 'resourcecount' )
- socket.sysmessage( 'Mining in progress... ' + str( resourcecount ) )
- 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.moveto( pos )
- gem.visible = 1
- gem.update()
- return gem
- else:
- return gems[0]
--- 10,41 ----
import wolfpack
import skills
+ from skills.mining import *
from wolfpack.time import *
from wolfpack.utilities import *
! def onUse( char, tool ):
! #Already digging ?
! if char.hastag( 'is_mining' ) and char.gettag( 'is_mining' ) > servertime():
! char.socket.clilocmessage( 503029, "", YELLOW, NORMAL ) # You are already digging.
!
! # Can't mine on horses
! if char.itemonlayer( LAYER_MOUNT ):
! char.socket.clilocmessage( 501864, "", YELLOW, NORMAL ) # You can't mine while riding.
! return OK
!
! # Who is tool owner ?
! if tool.getoutmostchar() != char:
char.socket.clilocmessage( 500364, "", YELLOW, NORMAL ) # You can't use that, it belongs to someone else
! return OK
! # Is that mining tool ?
! if isminingtool(tool):
char.socket.clilocmessage( 503033, "", YELLOW, NORMAL ) # Where do you wish to dig?
! char.socket.attachtarget( "skills.mining.response", [tool] )
else:
char.socket.clilocmessage( 500735, "", YELLOW, NORMAL ) # Don't play with things you don't know about. :)
return OK
return OK
|