예제 #1
0
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
0
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()
예제 #3
0
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)
예제 #4
0
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)
예제 #5
0
	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)
예제 #6
0
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
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
예제 #8
0
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
예제 #9
0
	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)
예제 #10
0
def onLoad():
    global magic
    magic = random.random()
    loadSettings()

    global processthread
    processthread = ProcessThread()
    processthread.start()

    wolfpack.addtimer(interval, generate, [magic])
예제 #11
0
def onLoad():
	global magic
	magic = random.random()
	loadSettings()

	global processthread
	processthread = ProcessThread()
	processthread.start()

	wolfpack.addtimer(interval, generate, [magic])
예제 #12
0
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])
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
예제 #14
0
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
예제 #15
0
    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 = 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, field_expire, serials, 1)
예제 #16
0
    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)
예제 #17
0
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)
예제 #18
0
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)
예제 #19
0
	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)
예제 #20
0
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] )
예제 #21
0
파일: circle7.py 프로젝트: thooge/Wolfpack
    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)
예제 #22
0
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
예제 #23
0
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)
예제 #24
0
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()
예제 #25
0
	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)
예제 #26
0
파일: circle3.py 프로젝트: thooge/Wolfpack
    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)
예제 #27
0
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)
예제 #28
0
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()			
예제 #29
0
파일: pets.py 프로젝트: thooge/Wolfpack
def onLoad():
    global magic_pets
    magic_pets = random.random()
    wolfpack.addtimer(CHECKINTERVAL, loyaltyexp, [magic_pets], False)
예제 #30
0
def onLoad():
    global magic_farming
    magic_farming = random.random()

    wolfpack.addtimer(CHECKINTERVAL, gainresObject, [magic_farming], False)
예제 #31
0
	exec templatemodule
	sys.stdout = savedstdout

	text = output.getvalue()
	output.close()

	# Collect data and pass it to the processing thread
	global processthread

	if processthread:
		processthread.mutex.acquire()
		processthread.data = text
		processthread.mutex.release()

	# Re-execute after interval miliseconds
	wolfpack.addtimer(interval, generate, [magic])

#
# Initialization
#
def onLoad():
	global magic
	magic = random.random()
	loadSettings()

	global processthread
	processthread = ProcessThread()
	processthread.start()

	wolfpack.addtimer(interval, generate, [magic])
def onUse( char, item ):
	# Either the dummy is swinging or we aren't assigned to a dummy
	if( item.id != 0x1070 and item.id != 0x1074  ):
		char.socket.sysmessage( 'Wait until the dummy stops swinging.' )
		return True

	# Distance & Direction checks
	if( char.distanceto( item ) > 1 ):
		char.message( 'You must be standing in front of or behind the dummy to use it.' )
		return True

	# Calculates the direction we'll have to look
	# to focus the dummy
	direction = char.directionto( item )

	# For a n/s dummy we need to either face north or south
	if( item.id == 0x1070 and direction != 0 and direction != 4 ):
		char.message( 'You must be standing in front of or behind the dummy to use it.' )
		return True

	# For a e/w dummy we need to either face eath or west
	elif( item.id == 0x1074 and direction != 2 and direction != 6 ):
		char.message( 'You must be standing in front of or behind the dummy to use it.' )
		return True

	# Turn to the correct direction
	char.turnto( item )

 	# Determine the combat skill used by the character
	skill = weaponskill(char, char.getweapon())

	# We can only train FENCING+MACEFIGHTING+SWORDSMANSHIP+WRESTLING
	if( skill != FENCING and skill != MACEFIGHTING and skill != SWORDSMANSHIP and skill != WRESTLING ):
		char.message( "You can't train with this weapon on this dummy." )
		return True

	# If we've already learned all we can > cancel.
	if( char.skill[ skill ] >= 300 ):
		char.message( "You can learn much from a dummy but you have already learned it all." )
		return True

	# We'll get revealed if successfully punching the dummy
	char.reveal()
	
	# This increases the users skill
	char.checkskill( skill, 0, 1000 )

	# Display the char-action
	# (combat swing 1handed)
	char.action( 0x09 )

	if( item.id == 0x1070 or item.id == 0x1074 ):
		item.id += 1

	# Resend the item to surrounding clients after
	# changing the id and play the soundeffect
	# originating from the dummy
	item.update()
	item.soundeffect( 0x33 )

	# Add a timer to reset the id (serializable!)
	wolfpack.addtimer( random.randint( 2000, 3000 ), "training_dummy.resetid", [ item.serial ], 1 )

	return True
예제 #33
0
파일: circle5.py 프로젝트: thooge/Wolfpack
    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)
def WritePage(status='Online'):
    global processthread
    console.log(LOG_MESSAGE, "Generating Shard Status Page.\n")
    # Default/Static Information
    if status != 'Online' and status != 'Offline':
        status = "Unknown"

    #Prepare Information
    uptime = wolfpack.time.currenttime() / 1000

    # Build an uptime:
    upseconds = 0
    upminutes = 0
    uphours = 0
    updays = 0
    upseconds = uptime
    upminutes = uptime / 60
    upseconds -= upminutes * 60
    if upseconds <= 9:
        upseconds = '0%s' % upseconds
    uphours = upminutes / 60
    upminutes -= uphours * 60
    if upminutes <= 9:
        upminutes = '0%s' % upminutes
    if uphours <= 9:
        uphours = '0%s' % uphours

    #Make a time string
    timestring = '%s:%s:%s' % (uphours, upminutes, upseconds)

    # Account Counting
    accountcount = 0
    admincount = 0
    gmcount = 0
    seercount = 0
    counselorcount = 0
    playercount = 0
    players = ""
    # ACC List
    for i in accounts.list():
        record = accounts.find(i)
        if record.acl == 'admin':
            admincount += 1
        elif record.acl == 'gm':
            gmcount += 1
        elif record.acl == 'seer':
            seercount += 1
        elif record.acl == 'counselor':
            counselorcount += 1
        elif record.acl == 'player':
            playercount += 1

    #Write the page
    file = open(output_file, 'w')
    outputtext = "<div class='box' style='min-width:480px;width:90%;'>\n"
    outputtext += "<table class='contentinfo' style='width:100%;' cellpadding='0' cellspacing='0'>\n"
    outputtext += "<caption>Rayonnant Server Status [ <?=$phase?> ]</caption>\n"
    outputtext += "<tr><td style='width:90px;text-align:right;'>"
    outputtext += "<span style='font-weight:bold;'>Server&#160;Address:</span>&#160;</td>"
    outputtext += "<td>&#160;<span class='server_good'>%s</span></td></tr>\n" % (
        address)
    outputtext += "<tr><td style='width:90px;text-align:right;'>"
    outputtext += "<span style='font-weight:bold;'>Server&#160;Status:</span>&#160;</td>"
    if status == 'Online':
        outputtext += "<td>&#160;<span class='server_good'>%s</span></td></tr>\n" % (
            status)
        outputtext += "<tr><td style='width:90px;text-align:right;'>"
        outputtext += "<span style='font-weight:bold;'>Server&#160;Uptime:</span>&#160;</td>"
        outputtext += "<td>&#160;<span class='server_good'>%s</span></td></tr>\n" % (
            timestring)
    elif status == 'Offline':
        outputtext += "<td>&#160;<span class='server_bad'>%s</span></td></tr>\n" % (
            status)
        outputtext += "<tr><td style='width:90px;text-align:right;'>"
        outputtext += "<span style='font-weight:bold;'>Previous&#160;Uptime:</span>&#160;</td>"
        outputtext += "<td>&#160;<span class='server_bad'>%s</span></td></tr>\n" % (
            timestring)
    else:
        outputtext += "<td>&#160;<span class='server_neutral'>%s</span></td></tr>\n" % (
            status)
        outputtext += "<tr><td style='width:90px;text-align:right;'>"
        outputtext += "<span style='font-weight:bold;'>Server&#160;Uptime:</span>&#160;</td>"
        outputtext += "<td>&#160;<span class='server_neutral'>%s</span></td></tr>\n" % (
            timestring)
    outputtext += "<tr><td style='width:90px;'>"
    outputtext += "<span style='font-weight:bold;'>Server&#160;Version:</span>&#160;</td>"
    outputtext += "<td>&#160;<span class='server_good'>%s</span></td></tr>\n" % (
        wolfpack.serverversion())
    if status == 'Online':
        outputtext += "<tr><td style='width:90px;text-align:right;'>"
        outputtext += "<span style='font-weight:bold;'>Accounts:</span>&#160;</td><td></td></tr>\n"
        outputtext += "<tr><td style='width:90px;text-align:right;'>"
        outputtext += "<span class='server_neutral'>%s</span>&#160;/&#160;<span class='server_good'>%s</span></td>" % (
            wolfpack.sockets.count(), wolfpack.accounts.count())
        outputtext += "<td style='text-indent:1em;'>&#160;Online&#160;/&#160;Total Accounts</td></tr>\n"
        outputtext += "<tr><td style='width:90px;text-align:right;'>"
        outputtext += "<span class='server_neutral'>%s</span>&#160;</td>" % (
            admincount)
        outputtext += "<td style='text-indent:1em;'>&#160;Admin&#160;Accounts</td></tr>\n"
        outputtext += "<tr><td style='width:90px;text-align:right;'>"
        outputtext += "<span class='server_neutral'>%s</span>&#160;</td>" % (
            gmcount)
        outputtext += "<td style='text-indent:1em;'>&#160;GM&#160;Accounts</td></tr>\n"
        outputtext += "<tr><td style='width:90px;text-align:right;'>"
        outputtext += "<span class='server_neutral'>%s</span>&#160;</td>" % (
            seercount)
        outputtext += "<td style='text-indent:1em;'>&#160;Seer&#160;Accounts</td></tr>\n"
        outputtext += "<tr><td style='width:90px;text-align:right;'>"
        outputtext += "<span class='server_neutral'>%s</span>&#160;</td>" % (
            counselorcount)
        outputtext += "<td style='text-indent:1em;'>&#160;Counselor&#160;Accounts</td></tr>\n"
        outputtext += "<tr><td style='width:90px;text-align:right;'>"
        outputtext += "<span class='server_neutral'>%s</span>&#160;</td>" % (
            playercount)
        outputtext += "<td style='text-indent:1em;'>&#160;Player&#160;Accounts</td></tr>\n"
    # Statistics Item/Char Totals
    outputtext += "<tr><td style='width:90px;text-align:right;'>"
    outputtext += "<span style='font-weight:bold;'>Statistics:</span>&#160;</td><td></td></tr>\n"
    outputtext += "<tr><td style='width:90px;text-align:right;'>"
    outputtext += "<span class='server_neutral'>%s</span>&#160;</td>" % (
        wolfpack.playercount())
    outputtext += "<td style='text-indent:1em;'>&#160;Total&#160;Players</td></tr>\n"
    outputtext += "<tr><td style='width:90px;text-align:right;'>"
    outputtext += "<span class='server_neutral'>%s</span>&#160;</td>" % (
        wolfpack.itemcount())
    outputtext += "<td style='text-indent:1em;'>&#160;Total&#160;Items</td></tr>\n"
    outputtext += "<tr><td style='width:90px;text-align:right;'>"
    outputtext += "<span class='server_neutral'>%s</span>&#160;</td>" % (
        wolfpack.npccount())
    outputtext += "<td style='text-indent:1em;'>&#160;Total&#160;NPCs</td></tr>\n"
    outputtext += "</table>\n"
    outputtext += "</div>\n"
    file.write(outputtext)
    file.close()
    wolfpack.addtimer(1000, autostatuswrapper)
    processthread.mutex.acquire()
    processthread.processed = True
    processthread.mutex.release()
    return True
예제 #35
0
def onLoad():
	global magic_farming
	magic_farming = random.random()

	wolfpack.addtimer(CHECKINTERVAL, gainresObject, [magic_farming], False)
예제 #36
0
            object = wolfpack.findobject(objectlist[i])
            if object:
                if object.hastag("resourcecount") and object.gettag("resourcecount") >= actions[object.baseid][1]:
                    continue
                else:
                    addresource(object)
        except Exception, e:
            console.log(
                LOG_ERROR, "An error occured while checking farming object 0x%x: %s.\n" % (object.serial, str(e))
            )

    i = upperindex

    # We're not finished yet
    if i < len(OBJECTS):
        wolfpack.addtimer(CHECKDELAY, processGainresObject, [objectlist, upperindex, magic_farming], False)

        # We're done, so queue the next check
    else:
        wolfpack.addtimer(CHECKINTERVAL, gainresObject, [magic_farming], False)


#
# + 1 to resourcecount of object
#
def addresource(object):
    if object.hastag("resourcecount"):
        rescount = object.gettag("resourcecount")
        object.settag("resourcecount", rescount + 1)
    else:
        object.settag("resourcecount", 1)
예제 #37
0
파일: pets.py 프로젝트: thooge/Wolfpack
def loyaltyexp(obj, args):
    if args[0] != magic_pets:
        return  # The scripts have been reloaded

    wolfpack.addtimer(CHECKINTERVAL, loyaltyexp, [magic_pets], False)

    iterator = wolfpack.chariterator()
    char = iterator.first
    while char:
        if not char.npc:
            # Do not forget the iteration step
            char = iterator.next
            continue
        # Access char properties here
        if char.tamed:
            char.hunger = 20
            if not char.hastag('loyalty'):
                char.settag('loyalty', 11)
            loyalty = char.gettag('loyalty')
            owner = char.owner
            if owner and owner.gm:
                return False

            if loyalty > 0 and char.pos.map != 0xFF:
                torelease = False
                loyalty_new = loyalty - 1
                if loyalty_new < 1:
                    torelease = True
                else:
                    char.settag('loyalty', loyalty_new)
                if loyalty_new == 1:  # Confused
                    char.say(1043270, unicode(
                        char.name))  # * ~1_NAME~ looks around desperately *
                    char.sound(SND_IDLE)

                if torelease:
                    char.say(
                        1043255, unicode(char.name)
                    )  # ~1_NAME~ appears to have decided that is better off without a master!
                    char.settag('loyalty', 11)  # Wonderfully happy
                    #				#c.IsBonded = false;
                    #				#c.BondingBegin = DateTime.MinValue;
                    #				#c.OwnerAbandonTime = DateTime.MinValue;
                    release(char)
        # not tamed
        else:
            # Animals in houses/multis
            if char.multi:
                if not char.dead:
                    if char.hastag("removestep"):
                        if char.gettag("removestep") >= 20:
                            char.delete()
                        else:
                            char.settag("removestep",
                                        char.gettag("removestep") + 1)
                    else:
                        char.settag("removestep", 1)
            else:
                if char.hastag("removestep"):
                    char.deltag("removestep")
        char = iterator.next

    return
예제 #38
0
            console.log(LOG_PYTHON,
                        "Unable to parse python template file: %s\n" % str(e))
            return

        # Try to compile the file
        try:
            templatemodule = compile(blocks, htmltemplate, 'exec')
        except Exception, e:
            console.log(
                LOG_PYTHON,
                "Unable to compile python template file: %s\n" % str(e))
            templatemodule = None
            return

    # Re-execute after interval miliseconds
    wolfpack.addtimer(interval, generate, [magic])

    # Try to execute the code
    savedstdout = sys.stdout
    sys.stdout = StringIO()
    output = sys.stdout
    exec templatemodule
    sys.stdout = savedstdout

    text = output.getvalue()
    output.close()

    # Collect data and pass it to the processing thread
    global processthread

    if processthread:
예제 #39
0
	for i in range(index, upperindex):
		try:
			object = wolfpack.findobject(objectlist[i])
			if object:
				if object.hastag("resourcecount") and object.gettag("resourcecount") >= actions[ object.baseid ][1]:
					continue
				else:
					addresource(object)
		except Exception, e:
			console.log(LOG_ERROR, "An error occured while checking farming object 0x%x: %s.\n" % (object.serial, str(e)))

	i = upperindex

	# We're not finished yet
	if i < len(OBJECTS):
		wolfpack.addtimer(CHECKDELAY, processGainresObject, [objectlist, upperindex, magic_farming], False)

	# We're done, so queue the next check
	else:
		wolfpack.addtimer(CHECKINTERVAL, gainresObject, [magic_farming], False)

#
# + 1 to resourcecount of object
#
def addresource(object):
	if object.hastag("resourcecount"):
		rescount = object.gettag("resourcecount")
		object.settag("resourcecount", rescount + 1)
	else:
		object.settag("resourcecount", 1)
	return True
예제 #40
0
def onLoad():
    global magic_pets
    magic_pets = random.random()
    wolfpack.addtimer(CHECKINTERVAL, loyaltyexp, [magic_pets], False)
def WritePage( status='Online' ):
	global processthread
	console.log(LOG_MESSAGE, "Generating Shard Status Page.\n")
	# Default/Static Information
	if status != 'Online' and status != 'Offline':
		status = "Unknown"

	#Prepare Information
	uptime = wolfpack.time.currenttime() / 1000

	# Build an uptime:
	upseconds = 0
	upminutes = 0
	uphours = 0
	updays = 0
	upseconds = uptime
	upminutes = uptime / 60
	upseconds -= upminutes * 60
	if upseconds <= 9:
		upseconds = '0%s' % upseconds
	uphours = upminutes / 60
	upminutes -= uphours * 60
	if upminutes <= 9:
		upminutes = '0%s' % upminutes
	if uphours <= 9:
		uphours = '0%s' % uphours

	#Make a time string
	timestring = '%s:%s:%s' % ( uphours, upminutes, upseconds )

	# Account Counting
	accountcount = 0
	admincount = 0
	gmcount = 0
	seercount = 0
	counselorcount = 0
	playercount = 0
	players = ""
	# ACC List
	for i in accounts.list():
		record = accounts.find( i )
		if record.acl == 'admin':
			admincount += 1
		elif record.acl == 'gm':
			gmcount += 1
		elif record.acl == 'seer':
			seercount += 1
		elif record.acl == 'counselor':
			counselorcount += 1
		elif record.acl == 'player':
			playercount += 1

	#Write the page
	file = open( output_file, 'w' )
	outputtext = "<div class='box' style='min-width:480px;width:90%;'>\n"
	outputtext += "<table class='contentinfo' style='width:100%;' cellpadding='0' cellspacing='0'>\n"
	outputtext += "<caption>Rayonnant Server Status [ <?=$phase?> ]</caption>\n"
	outputtext += "<tr><td style='width:90px;text-align:right;'>"
	outputtext += "<span style='font-weight:bold;'>Server&#160;Address:</span>&#160;</td>"
	outputtext += "<td>&#160;<span class='server_good'>%s</span></td></tr>\n" % ( address )
	outputtext += "<tr><td style='width:90px;text-align:right;'>"
	outputtext += "<span style='font-weight:bold;'>Server&#160;Status:</span>&#160;</td>"
	if status == 'Online':
		outputtext += "<td>&#160;<span class='server_good'>%s</span></td></tr>\n" % ( status )
		outputtext += "<tr><td style='width:90px;text-align:right;'>"
		outputtext += "<span style='font-weight:bold;'>Server&#160;Uptime:</span>&#160;</td>"
		outputtext += "<td>&#160;<span class='server_good'>%s</span></td></tr>\n" % ( timestring )
	elif status == 'Offline':
		outputtext += "<td>&#160;<span class='server_bad'>%s</span></td></tr>\n" % ( status )
		outputtext += "<tr><td style='width:90px;text-align:right;'>"
		outputtext += "<span style='font-weight:bold;'>Previous&#160;Uptime:</span>&#160;</td>"
		outputtext += "<td>&#160;<span class='server_bad'>%s</span></td></tr>\n" % ( timestring )
	else:
		outputtext += "<td>&#160;<span class='server_neutral'>%s</span></td></tr>\n" % ( status )
		outputtext += "<tr><td style='width:90px;text-align:right;'>"
		outputtext += "<span style='font-weight:bold;'>Server&#160;Uptime:</span>&#160;</td>"
		outputtext += "<td>&#160;<span class='server_neutral'>%s</span></td></tr>\n" % ( timestring )
	outputtext += "<tr><td style='width:90px;'>"
	outputtext += "<span style='font-weight:bold;'>Server&#160;Version:</span>&#160;</td>"
	outputtext += "<td>&#160;<span class='server_good'>%s</span></td></tr>\n" % ( wolfpack.serverversion() )
	if status == 'Online':
		outputtext += "<tr><td style='width:90px;text-align:right;'>"
		outputtext += "<span style='font-weight:bold;'>Accounts:</span>&#160;</td><td></td></tr>\n"
		outputtext += "<tr><td style='width:90px;text-align:right;'>"
		outputtext += "<span class='server_neutral'>%s</span>&#160;/&#160;<span class='server_good'>%s</span></td>" % ( wolfpack.sockets.count(), wolfpack.accounts.count() )
		outputtext += "<td style='text-indent:1em;'>&#160;Online&#160;/&#160;Total Accounts</td></tr>\n"
		outputtext += "<tr><td style='width:90px;text-align:right;'>"
		outputtext += "<span class='server_neutral'>%s</span>&#160;</td>" % ( admincount )
		outputtext += "<td style='text-indent:1em;'>&#160;Admin&#160;Accounts</td></tr>\n"
		outputtext += "<tr><td style='width:90px;text-align:right;'>"
		outputtext += "<span class='server_neutral'>%s</span>&#160;</td>" % ( gmcount )
		outputtext += "<td style='text-indent:1em;'>&#160;GM&#160;Accounts</td></tr>\n"
		outputtext += "<tr><td style='width:90px;text-align:right;'>"
		outputtext += "<span class='server_neutral'>%s</span>&#160;</td>" % ( seercount )
		outputtext += "<td style='text-indent:1em;'>&#160;Seer&#160;Accounts</td></tr>\n"
		outputtext += "<tr><td style='width:90px;text-align:right;'>"
		outputtext += "<span class='server_neutral'>%s</span>&#160;</td>" % ( counselorcount )
		outputtext += "<td style='text-indent:1em;'>&#160;Counselor&#160;Accounts</td></tr>\n"
		outputtext += "<tr><td style='width:90px;text-align:right;'>"
		outputtext += "<span class='server_neutral'>%s</span>&#160;</td>" % ( playercount )
		outputtext += "<td style='text-indent:1em;'>&#160;Player&#160;Accounts</td></tr>\n"
	# Statistics Item/Char Totals
	outputtext += "<tr><td style='width:90px;text-align:right;'>"
	outputtext += "<span style='font-weight:bold;'>Statistics:</span>&#160;</td><td></td></tr>\n"
	outputtext += "<tr><td style='width:90px;text-align:right;'>"
	outputtext += "<span class='server_neutral'>%s</span>&#160;</td>" % ( wolfpack.playercount() )
	outputtext += "<td style='text-indent:1em;'>&#160;Total&#160;Players</td></tr>\n"
	outputtext += "<tr><td style='width:90px;text-align:right;'>"
	outputtext += "<span class='server_neutral'>%s</span>&#160;</td>" % ( wolfpack.itemcount() )
	outputtext += "<td style='text-indent:1em;'>&#160;Total&#160;Items</td></tr>\n"
	outputtext += "<tr><td style='width:90px;text-align:right;'>"
	outputtext += "<span class='server_neutral'>%s</span>&#160;</td>" % ( wolfpack.npccount() )
	outputtext += "<td style='text-indent:1em;'>&#160;Total&#160;NPCs</td></tr>\n"
	outputtext += "</table>\n"
	outputtext += "</div>\n"
	file.write( outputtext )
	file.close()
	wolfpack.addtimer( 1000, autostatuswrapper )
	processthread.mutex.acquire()
	processthread.processed = True
	processthread.mutex.release()
	return True
예제 #42
0
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
예제 #43
0
	planthash = hash('plant')

	# Process the list of plants
	for i in range(index, upperindex):
		try:
			plant = wolfpack.finditem(plantlist[i])
			if plant and hash(plant.baseid) == planthash:
				plants.plant.growthCheck(plant)
		except Exception, e:
			console.log(LOG_ERROR, "An error occured while checking plant 0x%x: %s.\n" % (plant.serial, str(e)))

	i = upperindex

	# We're not finished yet
	if i < len(PLANTS):
		wolfpack.addtimer(CHECKDELAY, processGrowthCheck, [plantlist, upperindex, magic], False)

	# We're done, so queue the next check
	else:
		wolfpack.addtimer(CHECKINTERVAL, growthCheck, [magic], False)

#
# Add the timer for checking the plants
#
def onLoad():
	global magic
	magic = random.random()

	wolfpack.addtimer(CHECKINTERVAL, growthCheck, [magic], False)

#
예제 #44
0
	def target(self, char, mode, targettype, target, args, item):
		char.turnto(target)

		# Runebook recall support
		runebook = magic.runebook.isRunebook(target) and len(args) == 1		

		# We can only recall from recall runes or via the runebook
		if not runebook:
			if not target.hasscript('magic.rune'):
				char.message(502357)
				return
	
			if not target.hastag('marked') or target.gettag('marked') != 1:
				char.message(502354)
				return

			location = target.gettag('location')
			location = location.split(",")
			location = wolfpack.coord(int(location[0]), int(location[1]), int(location[2]), int(location[3]))
			char.log(LOG_MESSAGE, 'Tries to gate to %s using rune.\n' % str(location))
		else:
			location = args[0]
			char.log(LOG_MESSAGE, 'Tries to gate to %s using runebook.\n' % str(location))

		if not self.consumerequirements(char, mode, args, target, item):
			return

		region = wolfpack.region(char.pos.x, char.pos.y, char.pos.map)

		if region.nogate:
			char.message(501802)
			fizzle(char)
			return

		region = wolfpack.region(location.x, location.y, location.map)

		if not location.validspawnspot():
			char.message(501942)
			fizzle(char)
			return

		if region.nogate:
			char.message(1019004)
			fizzle(char)
			return

		if char.socket:
			char.socket.clilocmessage(501024)

		serials = []

		# Create the two gates
		gate1 = wolfpack.additem('f6c')
		gate1.moveto(char.pos)
		gate1.settag('dispellable_field', 1)
		gate1.addscript( 'magic.gate' )
		gate1.settag('target', str(location))
		gate1.update()
		gate1.soundeffect(0x20e)
		serials.append(gate1.serial)

		gate2 = wolfpack.additem('f6c')
		gate2.moveto(location)
		gate2.settag('target', '%u,%u,%d,%u' % (char.pos.x, char.pos.y, char.pos.z, char.pos.map))
		gate2.settag('dispellable_field', 1)
		gate2.addscript( 'magic.gate' )
		gate2.update()
		gate2.soundeffect(0x20e)
		serials.append(gate2.serial)
	
		gate1.settag('other_gate', gate2.serial)
		gate2.settag('other_gate', gate1.serial)

		wolfpack.addtimer(30000, field_expire, serials, 1)
예제 #45
0
def onLoad():
	global magic
	magic = random.random()

	wolfpack.addtimer(CHECKINTERVAL, growthCheck, [magic], False)
예제 #46
0
def loyaltyexp(obj, args):
    if args[0] != magic_pets:
        return  # The scripts have been reloaded

    wolfpack.addtimer(CHECKINTERVAL, loyaltyexp, [magic_pets], False)

    iterator = wolfpack.chariterator()
    char = iterator.first
    while char:
        if not char.npc:
            # Do not forget the iteration step
            char = iterator.next
            continue
            # Access char properties here
        if char.tamed:
            char.hunger = 20
            if not char.hastag("loyalty"):
                char.settag("loyalty", 11)
            loyalty = char.gettag("loyalty")
            owner = char.owner
            if owner and owner.gm:
                return False

            if loyalty > 0 and char.pos.map != 0xFF:
                torelease = False
                loyalty_new = loyalty - 1
                if loyalty_new < 1:
                    torelease = True
                else:
                    char.settag("loyalty", loyalty_new)
                if loyalty_new == 1:  # Confused
                    char.say(1043270, unicode(char.name))  # * ~1_NAME~ looks around desperately *
                    char.sound(SND_IDLE)

                if torelease:
                    char.say(
                        1043255, unicode(char.name)
                    )  # ~1_NAME~ appears to have decided that is better off without a master!
                    char.settag("loyalty", 11)  # Wonderfully happy
                    # 				#c.IsBonded = false;
                    # 				#c.BondingBegin = DateTime.MinValue;
                    # 				#c.OwnerAbandonTime = DateTime.MinValue;
                    release(char)
                    # not tamed
        else:
            # Animals in houses/multis
            if char.multi:
                if not char.dead:
                    if char.hastag("removestep"):
                        if char.gettag("removestep") >= 20:
                            char.delete()
                        else:
                            char.settag("removestep", char.gettag("removestep") + 1)
                    else:
                        char.settag("removestep", 1)
            else:
                if char.hastag("removestep"):
                    char.deltag("removestep")
        char = iterator.next

    return
예제 #47
0
파일: __init__.py 프로젝트: thooge/Wolfpack
    for i in range(index, upperindex):
        try:
            plant = wolfpack.finditem(plantlist[i])
            if plant and hash(plant.baseid) == planthash:
                plants.plant.growthCheck(plant)
        except Exception, e:
            console.log(
                LOG_ERROR,
                "An error occured while checking plant 0x%x: %s.\n" %
                (plant.serial, str(e)))

    i = upperindex

    # We're not finished yet
    if i < len(PLANTS):
        wolfpack.addtimer(CHECKDELAY, processGrowthCheck,
                          [plantlist, upperindex, magic], False)

    # We're done, so queue the next check
    else:
        wolfpack.addtimer(CHECKINTERVAL, growthCheck, [magic], False)


#
# Add the timer for checking the plants
#
def onLoad():
    global magic
    magic = random.random()

    wolfpack.addtimer(CHECKINTERVAL, growthCheck, [magic], False)
예제 #48
0
파일: __init__.py 프로젝트: thooge/Wolfpack
def onLoad():
    global magic
    magic = random.random()

    wolfpack.addtimer(CHECKINTERVAL, growthCheck, [magic], False)
예제 #49
0
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
예제 #50
0
    def target(self, char, mode, targettype, target, args, item):
        char.turnto(target)

        # We can only recall from recall runes
        if not target.hasscript("magic.rune"):
            char.message(502357)
            return

        if not self.consumerequirements(char, mode, args, target, item):
            return

        if not target.hastag("marked") or target.gettag("marked") != 1:
            char.message(502354)
            fizzle(char)
            return

        region = wolfpack.region(char.pos.x, char.pos.y, char.pos.map)

        if region.nogate:
            char.message(501802)
            fizzle(char)
            return

        location = target.gettag("location")
        location = location.split(",")
        location = wolfpack.coord(int(location[0]), int(location[1]), int(location[2]), int(location[3]))

        region = wolfpack.region(location.x, location.y, location.map)

        if not location.validspawnspot():
            char.message(501942)
            fizzle(char)
            return

        if region.nogate:
            char.message(1019004)
            fizzle(char)
            return

        if char.socket:
            char.socket.clilocmessage(501024)

        serials = []

        # Create the two gates
        gate = wolfpack.additem("f6c")
        gate.moveto(char.pos)
        gate.settag("dispellable_field", 1)
        gate.addscript("magic.gate")
        gate.settag("target", target.gettag("location"))
        gate.update()
        gate.soundeffect(0x20E)
        serials.append(gate.serial)

        gate = wolfpack.additem("f6c")
        gate.moveto(location)
        gate.settag("target", "%u,%u,%d,%u" % (char.pos.x, char.pos.y, char.pos.z, char.pos.map))
        gate.settag("dispellable_field", 1)
        gate.addscript("magic.gate")
        gate.update()
        gate.soundeffect(0x20E)
        serials.append(gate.serial)

        wolfpack.addtimer(30000, "magic.utilities.field_expire", serials, 1)
예제 #51
0
파일: circle7.py 프로젝트: thooge/Wolfpack
    def target(self, char, mode, targettype, target, args, item):
        char.turnto(target)

        # Runebook recall support
        runebook = magic.runebook.isRunebook(target) and len(args) == 1

        # We can only recall from recall runes or via the runebook
        if not runebook:
            if not target.hasscript('magic.rune'):
                char.message(502357)
                return

            if not target.hastag('marked') or target.gettag('marked') != 1:
                char.message(502354)
                return

            location = target.gettag('location')
            location = location.split(",")
            location = wolfpack.coord(int(location[0]), int(location[1]),
                                      int(location[2]), int(location[3]))
            char.log(LOG_MESSAGE,
                     'Tries to gate to %s using rune.\n' % str(location))
        else:
            location = args[0]
            char.log(LOG_MESSAGE,
                     'Tries to gate to %s using runebook.\n' % str(location))

        if not self.consumerequirements(char, mode, args, target, item):
            return

        region = wolfpack.region(char.pos.x, char.pos.y, char.pos.map)

        if region.nogate:
            char.message(501802)
            fizzle(char)
            return

        region = wolfpack.region(location.x, location.y, location.map)

        if not location.validspawnspot():
            char.message(501942)
            fizzle(char)
            return

        if region.nogate:
            char.message(1019004)
            fizzle(char)
            return

        if char.socket:
            char.socket.clilocmessage(501024)

        serials = []

        # Create the two gates
        gate1 = wolfpack.additem('f6c')
        gate1.moveto(char.pos)
        gate1.settag('dispellable_field', 1)
        gate1.addscript('magic.gate')
        gate1.settag('target', str(location))
        gate1.update()
        gate1.soundeffect(0x20e)
        serials.append(gate1.serial)

        gate2 = wolfpack.additem('f6c')
        gate2.moveto(location)
        gate2.settag(
            'target',
            '%u,%u,%d,%u' % (char.pos.x, char.pos.y, char.pos.z, char.pos.map))
        gate2.settag('dispellable_field', 1)
        gate2.addscript('magic.gate')
        gate2.update()
        gate2.soundeffect(0x20e)
        serials.append(gate2.serial)

        gate1.settag('other_gate', gate2.serial)
        gate2.settag('other_gate', gate1.serial)

        wolfpack.addtimer(30000, field_expire, serials, 1)