本文整理汇总了Python中wolfpack.addtimer函数的典型用法代码示例。如果您正苦于以下问题:Python addtimer函数的具体用法?Python addtimer怎么用?Python addtimer使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了addtimer函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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()
示例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)
示例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)
示例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
示例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
示例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)
示例7: onLoad
def onLoad():
global magic
magic = random.random()
loadSettings()
global processthread
processthread = ProcessThread()
processthread.start()
wolfpack.addtimer(interval, generate, [magic])
示例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
示例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])
示例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)
示例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)
示例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)
示例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] )
示例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
示例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)