def target(self, char, mode, targettype, target, args, item): if not self.consumerequirements(char, mode, args, target, item): return char.turnto(target) if char.player: party = char.party guild = char.guild else: party = None guild = None # Enumerate chars chars = wolfpack.chars(target.x, target.y, char.pos.map, 8) items = wolfpack.items(target.x, target.y, char.pos.map, 8) for target in chars: if char == target or not target.npc or target.summontimer == 0: continue if self.checkresist(char, target): target.effect(0x3779, 10, 20) else: wolfpack.effect(0x3728, target.pos, 8, 20) target.soundeffect(0x201) target.delete() # Field spells for item in items: if item.hastag("dispellable_field"): wolfpack.effect(0x376A, item.pos, 9, 20) item.soundeffect(0x201) item.delete()
def target(self, char, mode, targettype, target, args, item): char.turnto(target) # Gates need special handling if target.hasscript('magic.gate'): other_gate = target.gettag('other_gate') if other_gate != None: item = wolfpack.finditem(other_gate) # Dispellable? if not target.hastag('dispellable_field'): if char.socket: char.socket.clilocmessage(1005049) return if not self.consumerequirements(char, mode, args, target, item): return wolfpack.effect(0x376a, target.pos, 9, 20) # remove other gate if item and item.hastag('dispellable_field'): wolfpack.effect(0x376a, item.pos, 9, 20) target.soundeffect(0x201) item.delete() target.soundeffect(0x201) target.delete()
def effect(self, char, target, mode, args, item): # Clean previous removal timers target.dispel(None, 1, "invisibility_reveal") # Remove the targets attacktarget if target.war: target.war = False if target.socket: target.socket.resendplayer() target.attacktarget = None # Hide the attack target target.removefromview() target.hidden = 1 target.update() # target is able to use stealth skill now # even if he has not 80.0 Hiding target.addscript('skills.stealth') # Duration = Magery * 1.2 seconds duration = int(char.skill[self.skill] * 120) # Add a removal timer target.addtimer(duration, reveal_expire, [], 1, 0, "invisibility_reveal") wolfpack.effect(0x376a, target.pos, 10, 15) target.soundeffect(0x3c4)
def target(self, char, mode, targettype, target, args, item): char.turnto(target) # We can only unlock locked chests if not target.hasscript('lock'): char.message(503101) return if target.gettag('lock') != 'magic': char.message(503099) return if target.hastag('magicunlock_difficult'): if target.gettag('magicunlock_difficult') < char.skill(MAGERY): char.socket.sysmessage( tr('Your magic skills are not enough to Unlock this...')) return if not self.consumerequirements(char, mode, args, target, item): return target.removescript('lock') target.deltag('lock', 'magic') wolfpack.effect(0x376a, target.pos, 9, 32) target.soundeffect(0x1ff)
def target(self, char, mode, targettype, target, args, item): if not self.consumerequirements(char, mode, args, target, item): return char.turnto(target) # Enumerate chars chars = wolfpack.chars(target.x, target.y, char.pos.map, 8) items = wolfpack.items(target.x, target.y, char.pos.map, 8) for target in chars: if char == target or not target.npc or target.summontimer == 0: continue if not mayAreaHarm(char, target): continue dispelChance = 50.0 + (100 * ((char.magery / 10.0 - (target.getintproperty('dispeldifficulty', 1) / 10)) / ((target.getintproperty('dispelfocus', 1) / 10) * 2))) / 100.0 if dispelChance > random.random(): target.effect(0x3779, 10, 20) target.fight(char) else: wolfpack.effect(0x3728, target.pos, 8, 20) target.soundeffect(0x201) target.delete() # Field spells for item in items: if item.hastag('dispellable_field'): wolfpack.effect(0x376a, item.pos, 9, 20) item.soundeffect(0x201) item.delete()
def effect(self, char, target, mode, args, item): # Clean previous removal timers target.dispel(None, 1, "invisibility_reveal") # Remove the targets attacktarget if target.war: target.war = False if target.socket: target.socket.resendplayer() target.attacktarget = None # Hide the attack target target.removefromview() target.hidden = 1 target.update() # target is able to use stealth skill now # even if he has not 80.0 Hiding target.addscript( 'skills.stealth' ) # Duration = Magery * 1.2 seconds duration = int( char.skill[self.skill] * 120) # Add a removal timer target.addtimer(duration, reveal_expire, [], 1, 0, "invisibility_reveal") wolfpack.effect(0x376a, target.pos, 10, 15) target.soundeffect(0x3c4)
def target(self, char, mode, targettype, target, args, item): char.turnto(target) # We can only unlock locked chests if not target.hasscript( 'lock' ): char.message(503101) return if target.gettag('lock') != 'magic': char.message(503099) return if target.hastag('magicunlock_difficult'): if target.gettag('magicunlock_difficult') < char.skill(MAGERY): char.socket.sysmessage( tr('Your magic skills are not enough to Unlock this...') ) return if not self.consumerequirements(char, mode, args, target, item): return target.removescript( 'lock' ) target.deltag('lock', 'magic') wolfpack.effect(0x376a, target.pos, 9, 32) target.soundeffect(0x1ff)
def target(self, char, mode, targettype, target, args, item): if not self.consumerequirements(char, mode, args, target, item): return char.turnto(target) # Enumerate chars chars = wolfpack.chars(target.x, target.y, char.pos.map, 8) items = wolfpack.items(target.x, target.y, char.pos.map, 8) for target in chars: if char == target or not target.npc or target.summontimer == 0: continue if not mayAreaHarm(char, target): continue dispelChance = 50.0 + (100 * ( (char.magery / 10.0 - (target.getintproperty('dispeldifficulty', 1) / 10)) / ((target.getintproperty('dispelfocus', 1) / 10) * 2))) / 100.0 if dispelChance > random.random(): target.effect(0x3779, 10, 20) target.fight(char) else: wolfpack.effect(0x3728, target.pos, 8, 20) target.soundeffect(0x201) target.delete() # Field spells for item in items: if item.hastag('dispellable_field'): wolfpack.effect(0x376a, item.pos, 9, 20) item.soundeffect(0x201) item.delete()
def target(self, char, mode, targettype, target, args, item): char.turnto(target) # Check if the target tile is blocked or in a multi # target.validspawnspot() will automatically set the z # of the coord to the nearest top if (not target.validspawnspot() or wolfpack.findmulti(target)) and not char.gm: if char.socket: char.socketclilocmessage(501942) return # Line of Sight (touch!! or else we can teleport trough windows) if not char.canreach(target, 12): if char.socket: char.socket.clilocmessage(500237) return if not self.consumerequirements(char, mode, args, target, item): return source = char.pos char.removefromview() char.moveto(target) char.update() if char.socket: char.socket.resendworld() wolfpack.effect(0x3728, source, 10, 15) wolfpack.effect(0x3728, target, 10, 15) char.soundeffect(0x1fe)
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)
def smokepuff(char, position): if char.invisible: return wolfpack.effect(0x3728, position, 10, 15) # Only do it once if position == char.pos: char.soundeffect(0x1fe)
def effect(self, char, target, mode, args, item): # Show an effect at the position if self.checkresist(char, target): target.effect(0x3779, 10, 20) else: wolfpack.effect(0x3728, target.pos, 8, 20) target.soundeffect(0x201) target.delete()
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)
def effect(self, char, target, mode, args, item): # Clean previous removal timers target.dispel(None, 1, "invisibility_reveal") # Hide the target target.removefromview() target.hidden = 1 target.update() # Add a removal timer target.addtimer(5000, "magic.circle6.reveal_expire", [], 1, 0, "invisibility_reveal") wolfpack.effect(0x376a, target.pos, 10, 15) target.soundeffect(0x3c4)
def target(self, char, mode, targettype, target, args, item): char.turnto(target) # Only containers are trappable if target.type != 1: char.message('You can' 't trap that.') return if not self.consumerequirements(char, mode, args, target, item): return pos = target.pos wolfpack.effect(0x376a, wolfpack.coord(pos.x + 1, pos.y, pos.z, pos.map), 9, 10) wolfpack.effect(0x376a, wolfpack.coord(pos.x, pos.y - 1, pos.z, pos.map), 9, 10) wolfpack.effect(0x376a, wolfpack.coord(pos.x - 1, pos.y, pos.z, pos.map), 9, 10) wolfpack.effect(0x376a, wolfpack.coord(pos.x, pos.y + 1, pos.z, pos.map), 9, 10) target.soundeffect(0x1ef) # Add the Trap Properties to the Item target.settag('trap_owner', char.serial) target.settag('trap_damage', random.randint(10, 50)) target.settag('trap_type', 'magic') target.addscript('magic.trap')
def target(self, char, mode, targettype, target, args, item): char.turnto(target) # Dispellable? if not target.hastag('dispellable_field'): if char.socket: char.socket.clilocmessage(1005049) return if not self.consumerequirements(char, mode, args, target, item): return wolfpack.effect(0x376a, target.pos, 9, 20) target.soundeffect(0x201) target.delete()
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)
def target(self, char, mode, targettype, target, args, item): char.turnto(target) hasevent = 0 # Check if there is an event handling onUse but not onTelekinesis scripts = list(target.scripts) + target.basescripts.split(',') for event in scripts: if len(event) == 0: continue if wolfpack.hasevent(event, EVENT_TELEKINESIS): hasevent = 1 # The object has at least one telekinesis handler continue if wolfpack.hasevent(event, EVENT_USE): if char.socket: char.socket.clilocmessage(501857) return # If the object has no handlers # And it's not a container, exit if not hasevent and target.type != 1: return if not self.consumerequirements(char, mode, args, target, item): return wolfpack.effect(0x376a, target.pos, 9, 32) target.soundeffect(0x1f5) result = 0 for event in scripts: # If the event can handle onTelekinesis, call it if wolfpack.hasevent(event, EVENT_TELEKINESIS): if wolfpack.callevent(event, EVENT_TELEKINESIS, (char, target)): return if target.type == 1: if char.socket: char.socket.sendcontainer(target) return char.socket.clilocmessage(501857) fizzle(char)
def target(self, char, mode, targettype, target, args, item): char.turnto(target) if not self.consumerequirements(char, mode, args, target, item): return # Already Trapped? if not target.hasscript('magic.trap'): fizzle(char) return wolfpack.effect(0x376a, target.pos, 9, 32) target.soundeffect(0x1f0) # Remove the Trap Properties from the Item target.removescript('magic.trap') target.deltag('trap_owner') target.deltag('trap_damage') target.deltag('trap_type')
def target(self, char, mode, targettype, target, args, item): char.turnto(target) if not self.consumerequirements(char, mode, args, target, item): return # Already Trapped? if not target.hasscript( 'magic.trap' ): fizzle(char) return wolfpack.effect(0x376a, target.pos, 9, 32) target.soundeffect(0x1f0) # Remove the Trap Properties from the Item target.removescript( 'magic.trap' ) target.deltag('trap_owner') target.deltag('trap_damage') target.deltag('trap_type')
def target(self, char, mode, targettype, target, args, item): char.turnto(target) # We can only lock unlocked chests if not target.hasscript( 'lock' ): char.message(503101) return if target.gettag('lock') != 'magic': char.message(503099) return if not self.consumerequirements(char, mode, args, target, item): return target.removescript( 'lock' ) target.deltag('lock', 'magic') wolfpack.effect(0x376a, target.pos, 9, 32) target.soundeffect(0x1ff)
def onCollide(player, item): if item.hastag('playersonly') and player.npc: return 0 if not item.hastag('target'): if player.socket: player.socket.sysmessage('This gate leads nowhere...') else: console.log(LOG_ERROR, "NPC [%x] using gate [%x] without target.\n" % (player.serial, item.serial)) return 0 target = item.gettag('target').split(',') # Convert the target of the gate. try: target = map(int, target) except: player.socket.sysmessage('This gate leads nowhere...') return 0 # Move the player pos = player.pos pos.x = target[0] pos.y = target[1] pos.z = target[2] player.removefromview() player.moveto(pos) player.update(0) if player.socket: player.socket.resendworld() # show some nice effects if not item.hastag('silent'): player.soundeffect(0x1fe) item.soundeffect(0x1fe) wolfpack.effect(0x3728, player.pos, 10, 30) pos = item.pos wolfpack.effect(0x3728, pos, 10, 30) return 1
def playeffect(char, arguments, target): # Default values id = 0 speed = 20 duration = 10 hue = 0 rendermode = 0 socket = char.socket if len(arguments) == 1 and arguments[0] != '': (id) = arguments[0] elif len(arguments) == 2: (id, speed) = arguments elif len(arguments) == 3: (id, speed, duration) = arguments elif len(arguments) == 4: (id, speed, duration, hue) = arguments elif len(arguments) == 5: (id, speed, duration, hue, rendermode) = arguments else: socket.sysmessage('Usage: effect <effect-id>[, speed, duration, hue, rendermode]') return False try: effect = hex2dec(id) speed = int(speed) duration = int(duration) hue = int(hue) rendermode = int(rendermode) if not target: socket.player.effect(effect, speed, duration, hue, rendermode) else: if target.char: target.char.effect(effect, speed, duration, hue, rendermode) elif target.item: target.item.effect(effect, speed, duration, hue, rendermode) else: wolfpack.effect(effect, target.pos, duration, speed) except: socket.sysmessage('Usage: effect <effect-id>[, speed, duration, hue, rendermode]')
def target(self, char, mode, targettype, target, args, item): char.turnto(target) # We can only lock unlocked chests if target.type != 1 or target.hasscript( 'lock' ) or target.container: char.message(501762) return # We cannot use this on locked down chests if target.secured: char.message(501761) return if not self.consumerequirements(char, mode, args, target, item): return target.addscript( 'lock' ) target.settag('lock', 'magic') char.message(501763) wolfpack.effect(0x376a, target.pos, 9, 32) target.soundeffect(0x1fa)
def target(self, char, mode, targettype, target, args, item): char.turnto(target) # We can only lock unlocked chests if target.type != 1 or target.hasscript('lock') or target.container: char.message(501762) return # We cannot use this on locked down chests if target.secured: char.message(501761) return if not self.consumerequirements(char, mode, args, target, item): return target.addscript('lock') target.settag('lock', 'magic') char.message(501763) wolfpack.effect(0x376a, target.pos, 9, 32) target.soundeffect(0x1fa)
def onCollide(player, item): if not item.hastag('target'): target = [item.pos.x, item.pos.y, item.pos.z, item.pos.map] else: target = str(item.gettag('target')).split(',') try: target = map(int, target) except: target = [item.pos.x, item.pos.y, item.pos.z, item.pos.map] # Den Spieler bewegen pos = player.pos pos.x = target[0] pos.y = target[1] pos.z = target[2] pos.map = target[3] if not pos.validspawnspot(): if player.socket: player.socket.clilocmessage(501942) return player.removefromview() player.moveto(pos) player.update() if player.socket: player.socket.resendworld() # An der alten und neuen position soundeffekt und effekt spielen player.soundeffect(0x1fe) item.soundeffect(0x1fe) wolfpack.effect(0x3728, player.pos, 10, 30) pos = item.pos wolfpack.effect(0x3728, pos, 10, 30) return 1
def onUse(char, item): try: type = item.gettag('trap_type') damage = item.gettag('trap_damage') owner = wolfpack.findchar(int(item.gettag('trap_owner'))) except: item.removescript('magic.trap') item.deltag('trap_type') item.deltag('trap_damage') item.deltag('trap_owner') return 0 item.removescript('magic.trap') item.deltag('trap_type') item.deltag('trap_damage') item.deltag('trap_owner') char.message(502999) if not item.container: pos = item.pos else: item = item.getoutmostitem() if item.container: item = item.container pos = item.pos wolfpack.effect(0x36bd, wolfpack.coord(pos.x + 1, pos.y, pos.z, pos.map), 15, 15) wolfpack.effect(0x36bd, wolfpack.coord(pos.x, pos.y - 1, pos.z, pos.map), 15, 15) wolfpack.effect(0x36bd, wolfpack.coord(pos.x - 1, pos.y, pos.z, pos.map), 15, 15) wolfpack.effect(0x36bd, wolfpack.coord(pos.x, pos.y + 1, pos.z, pos.map), 15, 15) char.soundeffect(0x307) # Now Damage the Character if char.distanceto(item) <= 2: energydamage(char, owner, damage, fire=100) return 1
def target(self, char, mode, targettype, target, args, item): char.turnto(target) # Only containers are trappable if target.type != 1: char.message('You can''t trap that.') return if not self.consumerequirements(char, mode, args, target, item): return pos = target.pos wolfpack.effect(0x376a, wolfpack.coord(pos.x + 1, pos.y, pos.z, pos.map), 9, 10) wolfpack.effect(0x376a, wolfpack.coord(pos.x, pos.y - 1, pos.z, pos.map), 9, 10) wolfpack.effect(0x376a, wolfpack.coord(pos.x - 1, pos.y, pos.z, pos.map), 9, 10) wolfpack.effect(0x376a, wolfpack.coord(pos.x, pos.y + 1, pos.z, pos.map), 9, 10) target.soundeffect(0x1ef) # Add the Trap Properties to the Item target.settag('trap_owner', char.serial) target.settag('trap_damage', random.randint(10, 50)) target.settag('trap_type', 'magic') target.addscript( 'magic.trap' )
def effecttimer( char, args ): if len( args ) != 2: return char.soundeffect( 0x364 ) wolfpack.effect( 0x352d, args[0], 4, 16 )