Update of /cvsroot/wpdev/xmlscripts/scripts
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16737
Modified Files:
food.py potionkeg.py potions.py
Log Message:
Updates!
I made potion kegs work now!
Index: potions.py
===================================================================
RCS file: /cvsroot/wpdev/xmlscripts/scripts/potions.py,v
retrieving revision 1.39
retrieving revision 1.40
diff -C2 -d -r1.39 -r1.40
*** potions.py 11 Jul 2004 02:47:25 -0000 1.39
--- potions.py 12 Jul 2004 21:06:29 -0000 1.40
***************
*** 13,40 ****
# potion [ return_bottle, aggressive, target, name ]
! potions = \
{
! 0: [ 1, 0, 0, '#1044542', '#1041620', 'potion_nightsight' ], # nightsight
! 1: [ 1, 0, 0, '#1044543', '#1041634', 'potion_lesserheal' ], # lesser heal
! 2: [ 1, 0, 0, '#1044544', '#1041635', 'potion_heal' ], # heal
! 3: [ 1, 0, 0, '#1044545', '#1041636', 'potion_greaterheal' ], # greater heal
! 4: [ 1, 0, 0, '#1044552', '#1041621', 'potion_lessercure' ], # lesser cure
! 5: [ 1, 0, 0, '#1044553', '#1041622', 'potion_cure' ], # cure
! 6: [ 1, 0, 0, '#1044554', '#1041623', 'potion_greatercure' ], # greater cure
! 7: [ 1, 0, 0, '#1044540', '#1041624', 'potion_agility' ], # agility
! 8: [ 1, 0, 0, '#1044541', '#1041625', 'potion_greateragility' ], # greater agility
! 9: [ 1, 0, 0, '#1044546', '#1041626', 'potion_strength' ], # strength
! 10: [ 1, 0, 0, '#1044547', '#1041627', 'potion_greaterstrength' ], # greater strength
! 11: [ 0, 1, 1, '#1044555', '#1041637', 'potion_lesserexplosion' ], # lesser explosion
! 12: [ 0, 1, 1, '#1044556', '#1041638', 'potion_explosion' ], # explosion
! 13: [ 0, 1, 1, '#1044557', '#1041639', 'potion_greaterexplosion' ], # greater explosion
! 14: [ 1, 0, 0, '#1044548', '#1041628', 'potion_lesserpoison' ], # lesser poison
! 15: [ 1, 0, 0, '#1044549', '#1041629', 'potion_poison' ], # poison
! 16: [ 1, 0, 0, '#1044550', '#1041630', 'potion_greaterpoison' ], # greater poison
! 17: [ 1, 0, 0, '#1044551', '#1041631', 'potion_deadlypoison' ], # deadly poison
! 18: [ 1, 0, 0, '#1044538', '#1041632', 'potion_refresh' ], # refresh
! 19: [ 1, 0, 0, '#1044539', '#1041633', 'potion_totalrefresh' ], # total refresh
! 20: [ 1, 0, 0, 'Intellegence', 'A keg of Intellegence potions', 'potion_intelligence' ], # intelligence
! 21: [ 1, 0, 0, 'Greater Intellegence', 'A keg of Greater Intellegence potions', 'potion_greaterintelligence' ], # greater intelligence
22: [ 1, 0, 0, 'Lesser Mana', 'A keg of Lesser Mana potions', 'potion_lessermana' ], # lesser mana
23: [ 1, 0, 0, 'Mana', 'A keg of Mana potions', 'potion_mana' ], # mana
--- 13,40 ----
# potion [ return_bottle, aggressive, target, name ]
! POTIONS = \
{
! 0: [ True, 0, 0, '#1044542', '#1041620', 'potion_nightsight' ], # nightsight
! 1: [ True, 0, 0, '#1044543', '#1041634', 'potion_lesserheal' ], # lesser heal
! 2: [ True, 0, 0, '#1044544', '#1041635', 'potion_heal' ], # heal
! 3: [ True, 0, 0, '#1044545', '#1041636', 'potion_greaterheal' ], # greater heal
! 4: [ True, 0, 0, '#1044552', '#1041621', 'potion_lessercure' ], # lesser cure
! 5: [ True, 0, 0, '#1044553', '#1041622', 'potion_cure' ], # cure
! 6: [ True, 0, 0, '#1044554', '#1041623', 'potion_greatercure' ], # greater cure
! 7: [ True, 0, 0, '#1044540', '#1041624', 'potion_agility' ], # agility
! 8: [ True, 0, 0, '#1044541', '#1041625', 'potion_greateragility' ], # greater agility
! 9: [ True, 0, 0, '#1044546', '#1041626', 'potion_strength' ], # strength
! 10: [ True, 0, 0, '#1044547', '#1041627', 'potion_greaterstrength' ], # greater strength
! 11: [ False, 1, 1, '#1044555', '#1041637', 'potion_lesserexplosion' ], # lesser explosion
! 12: [ False, 1, 1, '#1044556', '#1041638', 'potion_explosion' ], # explosion
! 13: [ False, 1, 1, '#1044557', '#1041639', 'potion_greaterexplosion' ], # greater explosion
! 14: [ True, 0, 0, '#1044548', '#1041628', 'potion_lesserpoison' ], # lesser poison
! 15: [ True, 0, 0, '#1044549', '#1041629', 'potion_poison' ], # poison
! 16: [ True, 0, 0, '#1044550', '#1041630', 'potion_greaterpoison' ], # greater poison
! 17: [ True, 0, 0, '#1044551', '#1041631', 'potion_deadlypoison' ], # deadly poison
! 18: [ True, 0, 0, '#1044538', '#1041632', 'potion_refresh' ], # refresh
! 19: [ True, 0, 0, '#1044539', '#1041633', 'potion_totalrefresh' ], # total refresh
! 20: [ True, 0, 0, 'Intellegence', 'A keg of Intellegence potions', 'potion_intelligence' ], # intelligence
! 21: [ True, 0, 0, 'Greater Intellegence', 'A keg of Greater Intellegence potions', 'potion_greaterintelligence' ], # greater intelligence
22: [ 1, 0, 0, 'Lesser Mana', 'A keg of Lesser Mana potions', 'potion_lessermana' ], # lesser mana
23: [ 1, 0, 0, 'Mana', 'A keg of Mana potions', 'potion_mana' ], # mana
***************
*** 70,74 ****
# 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 ]:
***************
*** 347,351 ****
# Consume the potion
! def consumePotion( char, potion, givebottle ):
if potion.amount == 1:
--- 347,351 ----
# Consume the potion
! def consumePotion( char, potion, givebottle=True ):
if potion.amount == 1:
***************
*** 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() ):
--- 355,359 ----
potion.update()
! if givebottle: # Lets add an empty bottle!
bottle = wolfpack.additem( 'f0e' ) # Empty Bottle Definition
if not wolfpack.utilities.tocontainer( bottle, char.getbackpack() ):
***************
*** 387,391 ****
char.soundeffect(0x1e3)
char.effect(0x376a, 9, 32)
! consumePotion( char, potion, potions[ potion.gettag('potiontype') ][ POT_RETURN_BOTTLE ] )
return True
--- 387,391 ----
char.soundeffect(0x1e3)
char.effect(0x376a, 9, 32)
! consumePotion( char, potion, POTIONS[ potion.gettag('potiontype') ][ POT_RETURN_BOTTLE ] )
return True
***************
*** 439,443 ****
char.action( ANIM_FIDGET3 )
char.soundeffect( SOUND_DRINK1 )
! consumePotion( char, potion, potions[ healtype ][ POT_RETURN_BOTTLE ] )
return True
--- 439,443 ----
char.action( ANIM_FIDGET3 )
char.soundeffect( SOUND_DRINK1 )
! consumePotion( char, potion, POTIONS[ healtype ][ POT_RETURN_BOTTLE ] )
return True
***************
*** 478,482 ****
char.action( ANIM_FIDGET3 )
char.soundeffect( SOUND_DRINK1 )
! consumePotion( char, potion, potions[ curetype ][ POT_RETURN_BOTTLE ] )
# If we succeeded, special effects
if char.poison == -1:
--- 478,482 ----
char.action( ANIM_FIDGET3 )
char.soundeffect( SOUND_DRINK1 )
! consumePotion( char, potion, POTIONS[ curetype ][ POT_RETURN_BOTTLE ] )
# If we succeeded, special effects
if char.poison == -1:
***************
*** 528,532 ****
char.effect( 0x375a, 10, 15 )
char.soundeffect( SOUND_AGILITY_UP )
! consumePotion( char, potion, potions[ agilitytype ][ POT_RETURN_BOTTLE ] )
return True
--- 528,532 ----
char.effect( 0x375a, 10, 15 )
char.soundeffect( SOUND_AGILITY_UP )
! consumePotion( char, potion, POTIONS[ agilitytype ][ POT_RETURN_BOTTLE ] )
return True
***************
*** 575,579 ****
char.effect( 0x375a, 10, 15 )
char.soundeffect( SOUND_STRENGTH_UP )
! consumePotion( char, potion, potions[ strengthtype ][ POT_RETURN_BOTTLE ] )
return True
--- 575,579 ----
char.effect( 0x375a, 10, 15 )
char.soundeffect( SOUND_STRENGTH_UP )
! consumePotion( char, potion, POTIONS[ strengthtype ][ POT_RETURN_BOTTLE ] )
return True
***************
*** 596,600 ****
char.action( ANIM_FIDGET3 )
char.soundeffect( SOUND_DRINK1 )
! consumePotion( char, potion, potions[ poisontype ][ POT_RETURN_BOTTLE ] )
return True
--- 596,600 ----
char.action( ANIM_FIDGET3 )
char.soundeffect( SOUND_DRINK1 )
! consumePotion( char, potion, POTIONS[ poisontype ][ POT_RETURN_BOTTLE ] )
return True
***************
*** 619,623 ****
char.action( ANIM_FIDGET3 )
char.soundeffect( SOUND_DRINK1 )
! consumePotion( char, potion, potions[ refreshtype ][ POT_RETURN_BOTTLE ] )
return True
--- 619,623 ----
char.action( ANIM_FIDGET3 )
char.soundeffect( SOUND_DRINK1 )
! consumePotion( char, potion, POTIONS[ refreshtype ][ POT_RETURN_BOTTLE ] )
return True
Index: food.py
===================================================================
RCS file: /cvsroot/wpdev/xmlscripts/scripts/food.py,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** food.py 12 Jul 2004 01:51:52 -0000 1.9
--- food.py 12 Jul 2004 21:06:29 -0000 1.10
***************
*** 23,27 ****
if not player.canreach(char, 2):
player.socket.clilocmessage(500312)
! if not tobackpack(item, player):
item.update()
return 1
--- 23,27 ----
if not player.canreach(char, 2):
player.socket.clilocmessage(500312)
! if not tobackpack( item, player ):
item.update()
return 1
***************
*** 29,33 ****
if char.hunger >= 6:
player.message('They don''t seem to be hungry.')
! if not tobackpack(item, player):
item.update()
return 1
--- 29,33 ----
if char.hunger >= 6:
player.message('They don''t seem to be hungry.')
! if not tobackpack( item, player ):
item.update()
return 1
***************
*** 44,52 ****
# Fidget animation and munch munch sound
! char.soundeffect(random.choice([0x03a, 0x03b, 0x03c]))
char.action(ANIM_FIDGET3)
return 1
! char.say('Dropped item on char')
return 0
--- 44,52 ----
# Fidget animation and munch munch sound
! char.soundeffect( random.choice([0x03a, 0x03b, 0x03c]), 1 )
char.action(ANIM_FIDGET3)
return 1
! #char.say('Dropped item on char')
return 0
Index: potionkeg.py
===================================================================
RCS file: /cvsroot/wpdev/xmlscripts/scripts/potionkeg.py,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** potionkeg.py 11 Jul 2004 02:47:25 -0000 1.8
--- potionkeg.py 12 Jul 2004 21:06:29 -0000 1.9
***************
*** 1,82 ****
- # http://uo.stratics.com/alchemy/potions/potionkegs.shtml
-
import wolfpack
import wolfpack.time
import wolfpack.utilities
! from potions import potions # Imports the potion table.
! #from wolfpack.consts import *
!
! POT_RETURN_BOTTLE = 0
! POT_AGGRESSIVE = 1
! POT_TARGET = 2
! POT_NAME = 3
! KEG_NAME = 4
! POT_DEF = 5
### Filling the keg ###
! def onDropOnItem(potionkeg, potion):
! if ('potionkeg' not in potionkeg.events) or ('potions' not in potion.events):
! return False
!
char = potion.container
socket = char.socket
! if not potion.hastag('potiontype') or not potionkeg.hastag('kegfill'):
! socket.sysmessage("Only potions may be added to a potion keg!")
return False
! char.say("Test")
! """
! char.say("Step 1")
! if potionkeg.id in [ hex2dec(0x1ad6), hex2dec(0x1ad7) ]:
! char.say("Step 2")
! if potionkeg.hastag('kegfill') and potionkeg.hastag('potiontype'):
! char.say("Step 3")
! if potion.gettag('potiontype') == potionkeg.gettag('potiontype'):
! kegfill = potionkeg.gettag('kegfill')
! if kegfill < 100:
kegfill += 1
! potionkeg.settag('kegfill', kegfill)
! potion.delete()
return True
else:
! # The keg will not hold any more!
! socket.clilocmessage(502233)
return True
else:
! # You decide that it would be a bad idea to mix different types of potions.
! socket.clilocmessage(502236)
return True
else:
! potionkeg.settag( 'potiontype', potion.gettag('potiontype') )
potionkeg.settag( 'kegfill', 1 )
! potionkeg.name = potions[ potion.gettag('potiontype') ][ KEG_NAME ]
! consumePotion( char, potion, 1 )
return True
else:
! return False
! """
! return True
- ### End Filling ###
! def onUse(char, potionkeg):
socket = char.socket
- kegfill = int(potionkeg.gettag('kegfill'))
backpack = char.getbackpack()
! if potionkeg.hastag('potiontype'):
! checkkegstatus( char, keg, potionkeg.gettag('potiontype') )
! if kegfill > 0:
! count = backpack.countitems(['f0e'])
if count >= 1:
! backpack.removeitems(['f0e'], 1)
! newpot = wolfpack.additem(potions[potionkeg.gettag('potiontype')][POT_DEF])
newpot.decay = 1
newpot.magic = 1
! if not tobackpack(newpot, char):
newpot.update()
kegfill -= 1
potionkeg.settag('kegfill', kegfill )
--- 1,105 ----
import wolfpack
import wolfpack.time
import wolfpack.utilities
! # Imports the potion table.
! from potions import POTIONS, POT_RETURN_BOTTLE, POT_AGGRESSIVE, \
! POT_TARGET, POT_NAME, KEG_NAME, POT_DEF, consumePotion
### Filling the keg ###
! def onDropOnItem( potionkeg, potion ):
char = potion.container
socket = char.socket
! if not char or not socket:
return False
! if ( not 'potionkeg' in potionkeg.events ) or ( not 'potions' in potion.events ):
! return False
!
! if not potionkeg.hastag( 'kegfill' ):
! kegfill = 0
! potionkeg.settag( 'kegfill', kegfill )
! else:
! kegfill = int( potionkeg.gettag( 'kegfill' ) )
! if kegfill < 0: # Safeguard against negative fills
! kegfill = 0
!
! if not potion.hastag( 'potiontype' ):
! socket.sysmessage("Only potions may be added to a potion keg!")
! return True
!
! if kegfill >= 100:
! socket.clilocmessage( 502247 )
! return True
!
! if potionkeg.id in [ int(0x1ad6), int(0x1ad7), int(0x1940) ]:
! if potionkeg.hastag( 'potiontype' ):
! if potion.gettag( 'potiontype' ) == potionkeg.gettag( 'potiontype' ):
! if kegfill < 100 and kegfill >= 0:
kegfill += 1
! potionkeg.settag( 'kegfill', kegfill )
! char.soundeffect( 0x240 )
! consumePotion( char, potion )
! potionkeg.update()
! kegfillmessage( char, kegfill )
! socket.clilocmessage( 502239 )
return True
else:
! socket.clilocmessage( 502233 ) # The keg will not hold any more!
return True
else:
! socket.clilocmessage( 502236 ) # You decide that it would be a bad idea to mix different types of potions.
return True
else:
! kegtype = potion.gettag( 'potiontype' )
! potionkeg.settag( 'potiontype', kegtype )
potionkeg.settag( 'kegfill', 1 )
! potionkeg.name = POTIONS[ potion.gettag('potiontype') ][ KEG_NAME ]
! char.soundeffect( 0x240 )
! consumePotion( char, potion )
! potionkeg.update()
return True
else:
! return True
! # Pouring a potion.
! def onUse( char, potionkeg ):
socket = char.socket
backpack = char.getbackpack()
! if not char or not backpack:
! return False
! if not 'potionkeg' in potionkeg.events:
! return False
!
! if not potionkeg.hastag( 'kegfill' ):
! kegfill = 0
! potionkeg.settag( 'kegfill', kegfill )
! else:
! kegfill = int( potionkeg.gettag( 'kegfill' ) )
! if kegfill < 0: # Safeguard against negative fills
! kegfill = 0
!
! if potionkeg.hastag( 'potiontype' ) and potionkeg.name != POTIONS[ potionkeg.gettag( 'potiontype' ) ][ KEG_NAME ]:
! potionkeg.name = POTIONS[ potionkeg.gettag( 'potiontype' ) ][ KEG_NAME ]
! potionkeg.update()
!
! if kegfill > 0 and kegfill <= 100:
! count = backpack.countitems( [ 'f0e' ] )
if count >= 1:
! backpack.removeitems( [ 'f0e' ], 1 )
! newpot = wolfpack.additem( POTIONS[ potionkeg.gettag( 'potiontype' ) ][ POT_DEF ] )
! if not newpot:
! return False
newpot.decay = 1
newpot.magic = 1
! socket.clilocmessage( 502242 ) # You pour some of the keg's contents into an empty bottle...
! socket.clilocmessage( 502243 ) # ...and place it into your backpack.
! if not wolfpack.utilities.tobackpack( newpot, char ):
newpot.update()
+ char.soundeffect(0x240)
kegfill -= 1
potionkeg.settag('kegfill', kegfill )
***************
*** 84,102 ****
if potionkeg.name != "#1041641":
potionkeg.name = '#1041641'
! potionkeg.deltag('potiontype')
else:
! socket.clilocmessage(500315)
else:
if potionkeg.name != "#1041641":
potionkeg.name = '#1041641'
! if potionkeg.hastag('potiontype'):
! potionkeg.deltag('potiontype')
!
! return True
!
! def checkkegstatus(char, potionkeg, potiontype):
! if potionkeg.name != potions[ potiontype ][ KEG_NAME ]:
! potionkeg.name = potions[ potiontype ][ KEG_NAME ]
! return True
--- 107,153 ----
if potionkeg.name != "#1041641":
potionkeg.name = '#1041641'
! potionkeg.deltag( 'potiontype' )
! potionkeg.update()
! socket.clilocmessage( 502245 ) # The keg is now empty
! return True
else:
! socket.clilocmessage( 500315 )
! return True
else:
if potionkeg.name != "#1041641":
potionkeg.name = '#1041641'
! if potionkeg.hastag( 'potiontype' ):
! potionkeg.deltag( 'potiontype' )
! socket.clilocmessag( 502222 )
! potionkeg.update()
! return True
+ # Potion Filling Messages
+ def kegfillmessage( char, kegfill ):
+ socket = char.socket
+ if kegfill == 100:
+ socket.clilocmessage( 502258 ) # The keg is completely full.
+ elif kegfill <= 99 and kegfill >= 96:
+ socket.clilocmessage( 502257 ) # The liquid is almost to the top of the keg.
+ elif kegfill <= 95 and kegfill >= 80:
+ socket.clilocmessage( 502256 ) # The keg is very full.
+ elif kegfill <= 79 and kegfill >= 70:
+ socket.clilocmessage( 502255 ) # The keg is about three quarters full.
+ elif kegfill <= 69 and kegfill >= 54:
+ socket.clilocmessage( 502253 ) # The keg is more than half full.
+ elif kegfill <= 53 and kegfill >= 47:
+ socket.clilocmessage( 502254 ) # The keg is approximately half full.
+ elif kegfill <= 46 and kegfill >= 40:
+ socket.clilocmessage( 502252 ) # The keg is almost half full.
+ elif kegfill <= 39 and kegfill >= 30:
+ socket.clilocmessage( 502251 ) # The keg is about one third full.
+ elif kegfill <= 29 and kegfill >= 20:
+ socket.clilocmessage( 502250 ) # The keg is about one quarter full.
+ elif kegfill <= 19 and kegfill >= 5:
+ socket.clilocmessage( 502249 ) # The keg is not very full.
+ elif kegfill <= 4 and kegfill >= 1:
+ socket.clilocmessage( 502248 ) # The keg is nearly empty.
+ else:
+ socket.clilocmessage( 502259 ) # The keg is damaged.
+ return
|