本文整理汇总了Python中wolfpack.addtimer函数的典型用法代码示例。如果您正苦于以下问题:Python addtimer函数的具体用法?Python addtimer怎么用?Python addtimer使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了addtimer函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: swampCallback
def swampCallback(player, args):
(pos, stroke) = args
if stroke == 0:
pos.soundeffect(0x106)
pos.effect(0x3735, 1, 182)
player.addtimer(4000, swampCallback, [pos, 1])
elif stroke == 1:
pos.soundeffect(0x222)
player.addtimer(4000, swampCallback, [pos, 2])
elif stroke == 2:
pos.soundeffect(0x21f)
player.addtimer(1000, swampCallback, [pos, 3])
elif stroke == 3:
dummy = wolfpack.additem('1')
dummy.name = 'Swamp'
dummy.moveto(pos)
dummy.update()
dummy.say(tr("* Strange green tendrils rise from the ground, whipping wildly! *"))
wolfpack.addtimer(20000, deleteCallback, [dummy.serial], True)
pos.soundeffect(0x2b0)
# Spawn one giant ice worm and three ice snakes
npc = wolfpack.addnpc('whipping_vine', pos)
if not spawnNpc(pos, npc):
npc.delete()
else:
npc.update()
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:32,代码来源:greenthorns.py
示例2: furrowsCallback
def furrowsCallback(player, args):
(pos, stroke) = args
if stroke == 0:
pos.soundeffect(0x106)
pos.effect(0x3735, 1, 182)
player.addtimer(4000, furrowsCallback, [pos, 1])
elif stroke == 1:
pos.soundeffect(0x222)
player.addtimer(4000, furrowsCallback, [pos, 2])
elif stroke == 2:
pos.soundeffect(0x21f)
player.addtimer(4000, furrowsCallback, [pos, 3])
elif stroke == 3:
dummy = wolfpack.additem('1')
dummy.name = 'Swamp'
dummy.moveto(pos)
dummy.update()
dummy.say(tr("* A magical bunny leaps out of its hole, disturbed by the thorn's effect! *"))
wolfpack.addtimer(20000, deleteCallback, [dummy.serial], True)
# Spawn one giant ice worm and three ice snakes
npc = wolfpack.addnpc('vorpal_bunny', pos)
if not spawnNpc(pos, npc):
npc.delete()
else:
npc.update()
# Start timer to dig away
npc.addtimer(3 * 60 * 1000, vorpalbunny_dig, [], True)
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:33,代码来源:greenthorns.py
示例3: target
def target(self, char, mode, targettype, target, args, item):
char.turnto(target)
if not self.consumerequirements(char, mode, args, target, item):
return
xdiff = abs(target.x - char.pos.x)
ydiff = abs(target.y - char.pos.y)
if xdiff > ydiff:
positions = [ wolfpack.coord(target.x, target.y - 1, target.z, target.map), wolfpack.coord(target.x, target.y, target.z, target.map), wolfpack.coord(target.x, target.y + 1, target.z, target.map) ]
else:
positions = [ wolfpack.coord(target.x - 1, target.y, target.z, target.map), wolfpack.coord(target.x, target.y, target.z, target.map), wolfpack.coord(target.x + 1, target.y, target.z, target.map) ]
# At least one spell should look fancy
# Calculate the Angle here
serials = []
char.soundeffect(0x1f6)
for pos in positions:
newitem = wolfpack.newitem(1)
newitem.id = 0x80
newitem.moveto(pos)
newitem.decay = 0 # Dont decay. TempEffect will take care of them
newitem.update()
newitem.settag('dispellable_field', 1)
serials.append(newitem.serial)
wolfpack.effect(0x376a, pos, 9, 10)
wolfpack.addtimer(10000, field_expire, serials, 1)
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:31,代码来源:circle3.py
示例4: onDropOnItem
def onDropOnItem( target, item ):
if target.baseid == 'trashcan':
target.settag( 'trash_timer', int( wolfpack.time.currenttime() + delete_time ) )
wolfpack.addtimer( delete_time, "trashcan.timerPass", [ target ] )
return False
else:
return False
return False
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:8,代码来源:trashcan.py
示例5: onLoad
def onLoad():
if enabled and backup_path:
if accountsdriver == 'mysql' or worlddriver == 'mysql':
wolfpack.addtimer( time, timer, [ wolfpack.time.currenttime() ] )
wolfpack.registercommand( "backupdb", cmdbackupdb )
return True
else:
return False
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:8,代码来源:mysql_backup_db.py
示例6: target
def target(self, char, mode, targettype, target, args, item):
char.turnto(target)
if not self.consumerequirements(char, mode, args, target, item):
return
xdiff = abs(target.x - char.pos.x)
ydiff = abs(target.y - char.pos.y)
positions = []
# North/South
if xdiff > ydiff:
itemid = 0x3922
for i in range(-2, 3):
positions.append(wolfpack.coord(target.x, target.y + i, target.z, target.map))
# West/East
else:
itemid = 0x3915
for i in range(-2, 3):
positions.append(wolfpack.coord(target.x + i, target.y, target.z, target.map))
serials = []
char.soundeffect(0x20c)
total = (char.skill[MAGERY] + char.skill[POISONING]) / 2.0
if total >= 1000:
level = 3
elif total > 850:
level = 2
elif total > 650:
level = 1
else:
level = 0
for pos in positions:
newitem = wolfpack.newitem(1)
newitem.id = itemid
#newitem.direction = 29
newitem.moveto(pos)
newitem.decay = 0 # Dont decay. TempEffect will take care of them
newitem.settag('dispellable_field', 1)
newitem.settag('level', level)
newitem.addscript( 'magic.poisonfield' )
newitem.update()
serials.append(newitem.serial)
# Affect chars who are occupying the field cells
chars = wolfpack.chars( newitem.pos.x, newitem.pos.y, newitem.pos.map, 0 )
for affected in chars:
if affected.pos.z >= newitem.pos.z - 10 and affected.pos.z <= newitem.pos.z + 10:
newitem.callevent(EVENT_COLLIDE, (affected, newitem))
duration = int((3 + char.skill[MAGERY] / 25.0) * 1000)
wolfpack.addtimer(duration, field_expire, serials, 1)
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:56,代码来源:circle5.py
示例7: onLoad
def onLoad():
global magic
magic = random.random()
loadSettings()
global processthread
processthread = ProcessThread()
processthread.start()
wolfpack.addtimer(interval, generate, [magic])
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:10,代码来源:status.py
示例8: timer
def timer( timer, args ):
if enabled and backup_path and ( int( args[0] + time ) <= wolfpack.time.currenttime() ):
if accountsdriver == 'mysql' or worlddriver == 'mysql':
# Optimize and restart timer
optimize_db()
wolfpack.addtimer( time, timer, [] )
return True
else:
return False
else:
return False
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:11,代码来源:mysql_backup_db.py
示例9: boom
def boom(socket, command, arguments):
pos = socket.player.pos
# Go boom
for x in range(-12, 13):
for y in range(-12, 13):
dist = sqrt(x*x+y*y)
if dist <= 12:
delay = int(random.random() * 10000)
wolfpack.addtimer(delay, boom_timer, [pos.x + x, pos.y + y, pos.map])
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:11,代码来源:boom.py
示例10: target
def target(self, char, mode, targettype, target, args, item):
char.turnto(target)
if not char.canreach(target, 10):
char.message(500237)
return
if not self.consumerequirements(char, mode, args, target, item):
return
xdiff = abs(target.x - char.pos.x)
ydiff = abs(target.y - char.pos.y)
positions = []
# West / East
if xdiff > ydiff:
itemid = 0x3996
for i in range(-2, 3):
positions.append(wolfpack.coord(target.x, target.y + i, target.z, target.map))
# North South
else:
itemid = 0x398C
for i in range(-2, 3):
positions.append(wolfpack.coord(target.x + i, target.y, target.z, target.map))
serials = []
char.soundeffect(0x20C)
for pos in positions:
newitem = wolfpack.newitem(1)
newitem.id = itemid
# newitem.direction = 29
newitem.moveto(pos)
newitem.decay = 0 # Dont decay. TempEffect will take care of them
newitem.settag("dispellable_field", 1)
newitem.settag("source", char.serial)
newitem.addscript("magic.firefield")
newitem.update()
serials.append(newitem.serial)
# Affect chars who are occupying the field cells
chars = wolfpack.chars(newitem.pos.x, newitem.pos.y, newitem.pos.map, 0)
if len(chars) > 0:
for affected in chars:
if affected.pos.z >= newitem.pos.z - 10 and affected.pos.z <= newitem.pos.z + 10:
newitem.callevent(EVENT_COLLIDE, (affected, newitem))
duration = int((4 + char.skill[MAGERY] * 0.05) * 1000)
wolfpack.addtimer(duration, "magic.utilities.field_expire", serials, 1)
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:52,代码来源:circle4.py
示例11: dirtCallback
def dirtCallback(player, args):
(pos, stroke) = args
if stroke == 0:
pos.soundeffect(0x106)
pos.effect(0x3735, 1, 182)
player.addtimer(4000, dirtCallback, [pos, 1])
elif stroke == 1:
pos.soundeffect(0x222)
player.addtimer(4000, dirtCallback, [pos, 2])
elif stroke == 2:
pos.soundeffect(0x21f)
player.addtimer(5000, dirtCallback, [pos, 3])
elif stroke == 3:
dummy = wolfpack.additem('1')
dummy.name = 'Ground'
dummy.moveto(pos)
dummy.update()
dummy.say(tr("* The ground erupts with chaotic growth! *"))
wolfpack.addtimer(20000, deleteCallback, [dummy.serial], True)
pos.soundeffect(0x12d)
spawnReagents(pos)
spawnReagents(pos)
player.addtimer(2000, dirtCallback, [pos, 4])
elif stroke == 4:
pos.soundeffect(0x12d)
spawnReagents(pos)
spawnReagents(pos)
player.addtimer(2000, dirtCallback, [pos, 5])
elif stroke == 5:
pos.soundeffect(0x12d)
spawnReagents(pos)
spawnReagents(pos)
player.addtimer(3000, dirtCallback, [pos, 6])
elif stroke == 6:
pos.soundeffect(0x12d)
spawnReagents(pos)
spawnReagents(pos)
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:51,代码来源:greenthorns.py
示例12: target
def target(self, char, mode, targettype, target, args, item):
char.turnto(target)
if not self.consumerequirements(char, mode, args, target, item):
return
xdiff = abs(target.x - char.pos.x)
ydiff = abs(target.y - char.pos.y)
positions = []
# West / East
if xdiff > ydiff:
itemid = 0x3967
for i in range(-2, 3):
positions.append(wolfpack.coord(target.x, target.y + i, target.z, target.map))
# North South
else:
itemid = 0x3979
for i in range(-2, 3):
positions.append(wolfpack.coord(target.x + i, target.y, target.z, target.map))
serials = []
char.soundeffect(0x20b)
for pos in positions:
newitem = wolfpack.newitem(1)
newitem.id = itemid
newitem.moveto(pos)
newitem.decay = 0 # Dont decay. TempEffect will take care of them
newitem.settag('dispellable_field', 1)
newitem.settag('strength', char.skill[self.damageskill])
newitem.addscript( 'magic.paralyzefield' )
newitem.update()
serials.append(newitem.serial)
wolfpack.effect(0x376A, newitem.pos, 9, 10)
# Affect chars who are occupying the field cells
chars = wolfpack.chars( newitem.pos.x, newitem.pos.y, newitem.pos.map, 0 )
for affected in chars:
if affected.pos.z >= newitem.pos.z - 10 and affected.pos.z <= newitem.pos.z + 10:
newitem.callevent(EVENT_COLLIDE, (affected, newitem))
duration = int((3 + char.skill[MAGERY] / 30.0) * 1000)
wolfpack.addtimer(duration, field_expire, serials, 1)
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:47,代码来源:circle6.py
示例13: activate
def activate(char, item):
bounded = bound(item)
if not item or not bounded:
return False
if not item.getoutmostchar() == char:
char.socket.clilocmessage(1042664) # You must have the object in your backpack to use it.
elif item.hastag('timer'):
char.socket.clilocmessage(1054013) # The bracelet is already attempting contact. You decide to wait a moment.
else:
char.soundeffect(0xF9)
char.message("* You concentrate on the bracelet to summon its power *", 0x5D)
char.frozen = True
item.settag('timer', 0)
wolfpack.addtimer( TRANSPORT_TIMER, transport_timer, [char.serial, item.serial, bounded] )
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:17,代码来源:bracelet_of_binding.py
示例14: onUse
def onUse( char, item ):
# char does not have it and distance > 2
if( char.distanceto( item ) > 2 and item.getoutmostchar() != char ):
# "Target cannot be seen."
char.socket.clilocmessage( 502400 )
return 1
# check use delay
if item.hastag( "dclickdelay" ):
# "This book needs time to recharge."
char.socket.clilocmessage( 502403 )
return 1
sendGump( char, item )
# set use delay 2 sec
item.settag( "dclickdelay", 1 )
wolfpack.addtimer( 2000, "magic.runebook.rmdelay", [ item.serial ] )
return True
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:19,代码来源:runebook.py
示例15: vorpalbunny_dig
def vorpalbunny_dig(npc, args):
if npc.pos.map == 0xFF:
return
# Spawn a bunny hole
hole = wolfpack.additem('913')
hole.decay = True
hole.movable = 3
hole.color = 1
hole.name = tr('a mysterious rabbit hole')
hole.moveto(npc.pos)
hole.update()
wolfpack.addtimer(40000, deleteCallback, [hole.serial], True) # Delete after 40 seconds
npc.say(tr("* The bunny begins to dig a tunnel back to its underground lair *"))
npc.frozen = True
npc.soundeffect(0x247)
# Delete in 5 seconds
npc.addtimer(5000, deleteNpc, [], True)
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:20,代码来源:greenthorns.py
示例16: target
def target(self, char, mode, targettype, target, args, item):
char.turnto(target)
if not self.consumerequirements(char, mode, args, target, item):
return
xdiff = abs(target.x - char.pos.x)
ydiff = abs(target.y - char.pos.y)
positions = []
# West / East
if xdiff > ydiff:
itemid = 0x3956
for i in range(-2, 3):
positions.append(wolfpack.coord(target.x, target.y + i, target.z, target.map))
# North South
else:
itemid = 0x3946
for i in range(-2, 3):
positions.append(wolfpack.coord(target.x + i, target.y, target.z, target.map))
serials = []
char.soundeffect(0x20b)
for pos in positions:
newitem = wolfpack.newitem(1)
newitem.id = itemid
newitem.moveto(pos)
newitem.decay = 0
#newitem.direction = 29
newitem.settag('dispellable_field', 1)
newitem.update()
serials.append(newitem.serial)
duration = int((15 + (char.skill[MAGERY] / 5)) / 0.007)
wolfpack.addtimer(duration, field_expire, serials, 1)
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:39,代码来源:circle7.py
示例17: snowCallback
def snowCallback(player, args):
(pos, stroke) = args
if stroke == 0:
pos.soundeffect(0x106)
pos.effect(0x3735, 1, 182)
player.addtimer(4000, snowCallback, [pos, 1])
elif stroke == 1:
pos.soundeffect(0x222)
player.addtimer(4000, snowCallback, [pos, 2])
elif stroke == 2:
pos.soundeffect(0x21f)
player.addtimer(4000, snowCallback, [pos, 3])
elif stroke == 3:
dummy = wolfpack.additem('1')
dummy.name = 'Snow'
dummy.moveto(pos)
dummy.update()
dummy.say(tr("* Slithering ice serpents rise to the surface to investigate the disturbance! *"))
wolfpack.addtimer(20000, deleteCallback, [dummy.serial], True)
# Spawn one giant ice worm and three ice snakes
npc = wolfpack.addnpc('giant_ice_worm', pos)
if not spawnNpc(pos, npc):
npc.delete()
else:
npc.update()
for i in range(0, 3):
npc = wolfpack.addnpc('ice_snake', pos)
if not spawnNpc(pos, npc):
npc.delete()
else:
npc.update()
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:37,代码来源:greenthorns.py
示例18: onUse
def onUse( char, item ):
if item.type != 1 or item.baseid != 'trashcan':
return False
item.settag( 'trash_timer', int( wolfpack.time.currenttime() + delete_time ) )
wolfpack.addtimer( delete_time, "trashcan.timerPass", [ item ] )
return False
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:6,代码来源:trashcan.py
示例19: callback
def callback( char, args, target ):
# close the book
char.socket.closegump( 0x87654322 )
# error checkings - will be removed later
if( len( args ) < 1 ):
char.socket.sysmessage( "script error 1. contact GM." )
return False
item = args[0]
if not item:
char.socket.sysmessage( "script error 2. contact GM." )
return False
# distance check
if( char.distanceto( item ) > 2 and item.getoutmostchar() != char ):
char.socket.clilocmessage( 502400 )
return False
button = int( target.button )
# rename book
if( button == 1000 ):
# "Please enter a title for the runebook:"
char.socket.clilocmessage( 502414 )
# how do we request input and catch the response ?
char.socket.sysmessage( "not implemented yet - will be added." )
return True
runes = [ -1 ] * 16
for i in range( 0, 16 ):
# should not occur - will be removed later
if not item.hastag( "rune %i" % i ):
item.settag( "rune %i" % i, -1 )
else:
runes[ i ] = item.gettag( "rune %i" % i )
# selected rune number
runenum = ( button - 1 ) % 100
if( runenum < 0 or runenum > 15 ):
# "Request cancelled."
char.socket.clilocmessage( 502415 )
return True
# there's no rune
if( runes[ runenum ] < 0 ):
# "This place in the book is empty."
char.socket.clilocmessage( 502411 )
return True
# recall button - using charges : 1 - 16
if( button > 0 and button < 17 ):
charges = item.gettag( "charges" )
if( charges < 1 ):
# "There are no charges left on that item."
char.socket.clilocmessage( 502412 )
return False
else:
# recall to the rune
char.say( "Kal Ort Por", 5 )
wolfpack.addtimer( 2000, "magic.runebook.recall0", [ char.serial, runes[ runenum ], item.serial, charges ] )
return True
# set default button : 101 - 116
elif( button > 100 and button < 117 ):
item.settag( "default", int( runenum ) )
return True
# drop button : 201 - 216
elif( button > 200 and button < 217 ):
# will be added
droprune( char, item, runenum )
return True
# recall button - spell : 301 - 316
elif( button > 300 and button < 317 ):
# char action / power word
wolfpack.addtimer( 0, "magic.runebook.recall1", [ char.serial, runes[ runenum ] ] )
return True
# gate button : 401 - 416
elif( button > 400 and button < 417 ):
wolfpack.addtimer( 0, "magic.runebook.gate", [ char.serial, runes[ runenum ] ] )
return True
# button number error - should not occur
else:
char.socket.sysmessage( "script error 4. contact GM" )
return False
return True
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:84,代码来源:runebook.py
示例20: onLoad
def onLoad():
global magic_farming
magic_farming = random.random()
wolfpack.addtimer(CHECKINTERVAL, gainresObject, [magic_farming], False)
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:5,代码来源:farming.py
注:本文中的wolfpack.addtimer函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论