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)
def target(self, char, mode, targettype, target, args, item): char.turnto(target) if char.player and char.controlslots + 1 > char.maxcontrolslots: if char.socket: char.socket.clilocmessage(1049645) return if not target.validspawnspot(): if char.socket: char.socket.clilocmessage(501942) return if not self.consumerequirements(char, mode, args, target, item): return npcid = random.choice( ['polar_bear', 'grizzly_bear', 'black_bear', 'brown_bear', 'horse_1', 'walrus', 'great_hart', 'hind', 'dog', 'boar', 'chicken', 'rabbit'] ) creature = wolfpack.addnpc(npcid, target) # If the creature is out of our control, delete it. if creature.controlslots + char.controlslots > char.maxcontrolslots: creature.delete() char.socket.clilocmessage(1049645) else: creature.tamed = True creature.addscript('speech.pets') # This only adds if NPC doesnt have it anyway creature.owner = char creature.summontime = wolfpack.time.servertime() + int(char.skill[MAGERY] * 400) creature.summoned = True creature.ai = "Animal_Domestic" creature.soundeffect(0x215)
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()
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()
def addnpc(player, arguments, target): if target.item and target.item.container: player.socket.sysmessage("You can't add the npc there.") return npc = wolfpack.addnpc(str(arguments[0]), target.pos) npc.update()
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)
def onUse(char, item): if not item.hastag("npc_id"): item.delete() return 1 # Needs to be on ourself if item.getoutmostchar() != char: char.socket.clilocmessage(500312) # You can't reach... return 1 npcid = item.gettag("npc_id") npc = wolfpack.addnpc(npcid, char.pos) if npc: if item.hastag('npc_type') and char.gettag('npc_type') == 'mount': char.mount(npc) else: npc.owner = char npc.tamed = True npc.wandertype = 0 npc.direction = char.direction npc.update() npc.sound(SND_IDLE) npc.action(ANIM_CASTDIRECTED) item.delete() return True
def onUse( char, item ): if not item.hastag( "npc_id" ): char.socket.clilocmessage( 0, 500, 312 ) # You can't reach... item.delete() return 1 # Needs to be on ourself if item.getoutmostchar() != char: char.socket.clilocmessage( 0, 500, 312 ) # You can't reach... return 1 npcid = item.gettag( "npc_id" ) npctype = item.gettag( "npc_type" ) pos = char.pos npc = wolfpack.addnpc( npcid, pos ) if npctype == 'mount': char.mount(npc) item.delete() elif npctype == 'follow': npc.tamed = 1 npc.npcwander = 0 npc.follow(char) item.delete() else: item.delete() return 1
def onUse( char, item ): if not item.hastag( "npc_id" ): item.delete() return 1 # Needs to be on ourself if item.getoutmostchar() != char: char.socket.clilocmessage( 500312 ) # You can't reach... return 1 npcid = item.gettag("npc_id") npc = wolfpack.addnpc(npcid, char.pos) if npc: if item.hastag('npc_type') and char.gettag('npc_type') == 'mount': char.mount(npc) else: npc.owner = char npc.tamed = True npc.wandertype = 0 npc.direction = char.direction npc.update() npc.sound(SND_IDLE) npc.action(ANIM_CASTDIRECTED) item.delete() return True
def addnpc(player, arguments, target): if target.item and target.item.container: player.socket.sysmessage("You can't add the npc there.") return npc = wolfpack.addnpc(str(arguments[0]), target.pos) npc.update() player.log(LOG_MESSAGE, tr("Adds npc %s (0x%x) at %s.\n") % (str(arguments[0]), npc.serial, str(target.pos)))
def target(self, char, mode, targettype, target, args, item): char.turnto(target) if not self.consumerequirements(char, mode, args, target, item): return ev = wolfpack.addnpc('summoned_energy_vortex', target) ev.summontime = wolfpack.time.currenttime() + 120000 ev.summoned = 1 ev.soundeffect(0x212)
def target(self, char, mode, targettype, target, args, item): char.turnto(target) if not self.consumerequirements(char, mode, args, target, item): return ev = wolfpack.addnpc('summoned_energy_vortex', target) ev.addscript('speech.pets') # Not for the owner but for GMs ev.summontime = wolfpack.time.currenttime() + 120000 ev.summoned = 1 ev.owner = char ev.soundeffect(0x212)
def addnpc(player, arguments, target): if target.item and target.item.container: player.socket.sysmessage("You can't add the npc there.") return npc = wolfpack.addnpc(str(arguments[0]), target.pos) npc.update() player.log( LOG_MESSAGE, tr("Adds npc %s (0x%x) at %s.\n") % (str(arguments[0]), npc.serial, str(target.pos)))
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()
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()
def addvendor(player, arguments, target): if target.item and target.item.container: player.socket.sysmessage("You can't add the npc there.") return owner = wolfpack.findchar(arguments[1]) if not owner: player.socket.sysmessage(u'Ooops. Da ist was schief gelaufen. Oder der Owner wurde gerade gelöscht. So kann ich nicht Arbeiten!') return npc = wolfpack.addnpc(str(arguments[0]), target.pos) npc.owner = owner npc.invulnerable = True npc.update() player.log(LOG_MESSAGE, "Adds %s's Playervendor (0x%x) at %s.\n" % (owner.orgname, npc.serial, str(target.pos)))
def spawn(spawner, spawntype, spawndef, current, area): try: if spawntype == 1: npc = wolfpack.addnpc(spawndef, spawner.pos) npc.settag("spawner", spawner.serial) npc.wandertype = 3 npc.wanderradius = area npc.addscript("system.spawns") npc.update() elif spawntype == 0: pass except: return spawner.settag("current", current + 1)
def target(self, char, mode, targettype, target, args, item): char.turnto(target) if char.player and char.controlslots >= 5: char.socket.clilocmessage(1049645) return if not self.consumerequirements(char, mode, args, target, item): return spirits = wolfpack.addnpc('summoned_blade_spirit', target) spirits.owner = char spirits.summontime = wolfpack.time.servertime() + 120000 spirits.summoned = 1 spirits.soundeffect(0x212)
def target(self, char, mode, targettype, target, args, item): char.turnto(target) if char.player and char.controlslots >= 5: char.socket.clilocmessage(1049645) return if not self.consumerequirements(char, mode, args, target, item): return spirits = wolfpack.addnpc('summoned_blade_spirit', target) spirits.addscript('speech.pets') # Not for the owner but for GMs spirits.owner = char spirits.summontime = wolfpack.time.servertime() + 120000 spirits.summoned = 1 spirits.soundeffect(0x212)
def treaspickspawn(item): ############################################# # Lets check the Level and assign SpawnList ############################################# level = int(item.gettag('level')) spawnlist = TREASPAWNS[level] ############################################# # Lets check the Random Chances of Spawn ############################################# value = random.random() # 2% of coming 5 Monsters if value >= 0.98: amount = 5 # 3% of coming 4 Monsters elif value >= 0.95: amount = 4 # 5% of coming 3 Monsters elif value >= 0.90: amount = 3 # 15% of coming 2 Monsters elif value >= 0.75: amount = 2 # 25% of coming 1 Monster elif value >= 0.50: amount = 1 # 50% to came Nothing else: amount = 0 ############################################# # Now, Lets Adjust to level ############################################# if amount > level: amount = level ############################################# # Finally, Lets Spawn the Monsters ############################################# if amount: for i in range(0, amount): npc = wolfpack.addnpc(random.choice(spawnlist), item.pos) npc.update()
def treaspickspawn( item ): ############################################# # Lets check the Level and assign SpawnList ############################################# level = int(item.gettag('level')) spawnlist = TREASPAWNS[level] ############################################# # Lets check the Random Chances of Spawn ############################################# value = random.random() # 2% of coming 5 Monsters if value >= 0.98: amount = 5 # 3% of coming 4 Monsters elif value >= 0.95: amount = 4 # 5% of coming 3 Monsters elif value >= 0.90: amount = 3 # 15% of coming 2 Monsters elif value >= 0.75: amount = 2 # 25% of coming 1 Monster elif value >= 0.50: amount = 1 # 50% to came Nothing else: amount = 0 ############################################# # Now, Lets Adjust to level ############################################# if amount > level: amount = level ############################################# # Finally, Lets Spawn the Monsters ############################################# if amount: for i in range(0, amount): npc = wolfpack.addnpc(random.choice( spawnlist ), item.pos) npc.update()
def spawn(spawner, spawntype, spawndef, current, area): try: if spawntype == 1: npc = wolfpack.addnpc(spawndef, spawner.pos) npc.settag('spawner', spawner.serial) npc.wandertype = 3 npc.wanderx1 = spawner.pos.x npc.wandery1 = spawner.pos.y npc.wanderradius = area npc.addscript( 'system.spawns' ) npc.update() elif spawntype == 0: pass except: return spawner.settag('current', current + 1)
def treasinitialspawn(item): # Spawn list for that Level level = int(item.gettag('level')) spawnlist = TREASPAWNS[level] # Check Min Level for Initial Spawn if level < MINLEVELFORINITIALSPAWN: return # Lets check the amount of creatures. Always between 0 and 3: amountspawned = random.randint(MINSPAWN, MAXSPAWN) # Now... lets just Spawn creatures for i in range(0, amountspawned): npc = wolfpack.addnpc(random.choice(spawnlist), item.pos) npc.update()
def treasinitialspawn( item ): # Spawn list for that Level level = int(item.gettag('level')) spawnlist = TREASPAWNS[level] # Check Min Level for Initial Spawn if level < MINLEVELFORINITIALSPAWN: return # Lets check the amount of creatures. Always between 0 and 3: amountspawned = random.randint(MINSPAWN,MAXSPAWN) # Now... lets just Spawn creatures for i in range(0, amountspawned): npc = wolfpack.addnpc(random.choice( spawnlist ), item.pos) npc.update()
def spawn(spawner, spawntype, spawndef, current, area): try: if spawntype == 1: npc = wolfpack.addnpc(spawndef, spawner.pos) npc.settag('spawner', spawner.serial) npc.wandertype = 3 npc.wanderx1 = spawner.pos.x npc.wandery1 = spawner.pos.y npc.wanderradius = area npc.addscript( 'system.spawns' ) npc.update() elif spawntype == 0: pass except: if( spawner ): console.log(LOG_WARNING, "Invalid spawner: 0x%x.\n" % spawner.serial) return spawner.settag('current', current + 1)
def target(self, char, mode, targettype, target, args, item): char.turnto(target) # Lowest controlslots we see is 2, Earth Elemental if char.player and char.controlslots + 2 > 5: char.socket.clilocmessage(1049645) return if not self.consumerequirements(char, mode, args, target, item): return creature = wolfpack.addnpc(self.elementid, target) # If the creature is out of our control, delete it. if char.player and char.controlslots + creature.controlslots > 5: creature.delete() char.socket.clilocmessage(1049645) else: creature.addscript('speech.pets') creature.owner = char creature.summontime = wolfpack.time.currenttime() + 120000 creature.summoned = 1 creature.soundeffect(0x217)
def target(self, char, mode, targettype, target, args, item): char.turnto(target) if char.player and char.controlslots + 1 > char.maxcontrolslots: if char.socket: char.socket.clilocmessage(1049645) return if not target.validspawnspot(): if char.socket: char.socket.clilocmessage(501942) return if not self.consumerequirements(char, mode, args, target, item): return npcid = random.choice([ 'polar_bear', 'grizzly_bear', 'black_bear', 'brown_bear', 'horse_1', 'walrus', 'great_hart', 'hind', 'dog', 'boar', 'chicken', 'rabbit' ]) creature = wolfpack.addnpc(npcid, target) # If the creature is out of our control, delete it. if creature.controlslots + char.controlslots > char.maxcontrolslots: creature.delete() char.socket.clilocmessage(1049645) else: creature.tamed = True creature.addscript( 'speech.pets') # This only adds if NPC doesnt have it anyway creature.owner = char creature.summontime = wolfpack.time.servertime() + int( char.skill[MAGERY] * 400) creature.summoned = True creature.ai = "Animal_Domestic" creature.soundeffect(0x215)
def target(self, char, mode, targettype, target, args, item): char.turnto(target) # Lowest controlslots we see is 2, Earth Elemental if char.player and char.controlslots + 2 > char.maxcontrolslots: char.socket.clilocmessage(1049645) return if not self.consumerequirements(char, mode, args, target, item): return creature = wolfpack.addnpc(self.elementid, target) # If the creature is out of our control, delete it. if char.player and char.controlslots + creature.controlslots > char.maxcontrolslots: creature.delete() char.socket.clilocmessage(1049645) else: creature.addscript( 'speech.pets') # This only adds if it has the event anyway creature.owner = char creature.tamed = True creature.summontime = wolfpack.time.currenttime() + 120000 creature.summoned = True creature.soundeffect(0x217)
def onUse(char, item): backpack = char.getbackpack() if not backpack: return False if not item.getoutmostitem() == backpack: char.socket.clilocmessage( 1042001 ) # That must be in your pack for you to use it. return True TinkerSkill = char.skill[TINKERING] / 10.0 if TinkerSkill < 60.0: char.socket.sysmessage( tr("You must have at least 60.0 skill in tinkering to construct a golem.") ) return True elif char.controlslots + 4 > char.maxcontrolslots: char.socket.clilocmessage( 1049607 ) # You have too many followers to control that creature. return True scalar = 0 if TinkerSkill >= 100.0: scalar = 1.0 elif TinkerSkill >= 90.0: scalar = 0.9 elif TinkerSkill >= 80.0: scalar = 0.8 elif TinkerSkill >= 70.0: scalar = 0.7 else: scalar = 0.6 if wolfpack.utilities.checkresources(backpack, 'power_crystal', 1): # Power Crystal char.socket.sysmessage( "You must have a power crystal to construct the golem." ) return True elif wolfpack.utilities.checkresources(backpack, 'iron_ingot', 50): # Iron Ingot char.socket.sysmessage( "You must have 50 iron ingots to construct the golem." ) return True elif wolfpack.utilities.checkresources(backpack, 'bronze_ingot', 50): # Bronze Ingot char.socket.sysmessage( "You must have 50 bronze ingots to construct the golem." ) return True elif wolfpack.utilities.checkresources(backpack, '1053', 5): # Gears char.socket.sysmessage( "You must have 5 gears to construct the golem." ) return True wolfpack.utilities.consumeresources(backpack, 'power_crystal', 1) wolfpack.utilities.consumeresources(backpack, 'iron_ingot', 50) wolfpack.utilities.consumeresources(backpack, 'bronze_ingot', 50) wolfpack.utilities.consumeresources(backpack, '1053', 5) golem = wolfpack.addnpc('tinkered_golem', char.pos) golem.owner = char golem.tamed = True golem.follow(char) golem.update() # Stats golem.strength = random.randint(251, 350) * scalar golem.dexterity = random.randint(76, 100) * scalar golem.intelligence = random.randint(101, 150) * scalar golem.hitpoints = random.randint(151, 210) * scalar # Damage golem.settag('mindamage', 13 * scalar) golem.settag('maxdamage', 24 * scalar) # Resistances golem.settag('res_physical', random.randint(35, 55) * scalar) golem.settag('res_fire', 100 * scalar) golem.settag('res_cold', random.randint(10, 30) * scalar) golem.settag('res_poison', random.randint(10, 25) * scalar) golem.settag('res_energy', random.randint(30, 40) * scalar) # Skills magicres = int(random.randint(1501, 1900) * scalar) tactic = int(random.randint(601, 1000) * scalar) wrest = int(random.randint(601, 1000) * scalar) golem.skill[MAGICRESISTANCE] = magicres golem.skill[TACTICS] = tactic golem.skill[WRESTLING] = wrest char.soundeffect( 0x241 ) return True
def gump_callback( char, args, response ): vendor = wolfpack.findchar( args[0] ) if not vendor: return if vendor.distanceto( char ) > 5: vendor.say( tr("I can't sell this from over there!"), 5 ) char.socket.sysmessage( tr("You can't reach the vendor.") ) return if response.button == 0: vendor.say( tr("Bye!"), 5 ) return button = int( response.switches[0] ) id = response.button if id == 0: return if not id in prices: vendor.say( "I can't sell this!", 5 ) return id_npc = idnpc[ id ] id_shrink = idshrink[ id ] if ( button == 0x0000 ): # shrink if not id in shrinks: vendor.say( tr("That is not shrinkable..."), 5 ) return count = prices[ id ] + prices_shrinks if not checkpay(char, vendor, count): return item = wolfpack.additem( "%s" % id_shrink ) if not item: console.send( "Invalid defintion: %s\n Vendor error: %s)\n" % ( id_shrink, vendor) ) return item.settag( "npc_id", "%s" % id_npc ) if id in rideables: item.settag( "npc_type", "mount" ) else: item.settag( "npc_type", "follow" ) char.message( item.gettag( "npc_id" ) ) if not wolfpack.utilities.tocontainer( item, char.getbackpack() ): item.update() return elif ( button == 0x0001 ): # tamed if not id in tamed: vendor.say( tr("That is not tamed..."), 5 ) return count = prices[ id ] if not checkpay(char, vendor, count): return pos = char.pos npc = wolfpack.addnpc( id_npc, pos ) if not npc: console.send( "Invalid defintion: %s\n Vendor error: %s)\n" % ( id_npc, vendor) ) return npc.owner = char npc.tamed = 1 npc.npcwander = 0 npc.follow( char ) return elif ( button == 0x0002 ): # rideable if ( id in rideables != 1 ): vendor.say( tr("That is not rideable..."), 5 ) return count = prices[ id ] if not checkpay(char, vendor, count): return pos = char.pos npcmount = wolfpack.addnpc( id_npc, pos ) if not npcmount: console.send( "Invalid defintion: %s\n Vendor error: %s)\n" % ( id_npc, vendor) ) return char.mount(npcmount) return else: return
def onUse(char, item): backpack = char.getbackpack() if not backpack: return False if not item.getoutmostitem() == backpack: char.socket.clilocmessage( 1042001) # That must be in your pack for you to use it. return True TinkerSkill = char.skill[TINKERING] / 10.0 if TinkerSkill < 60.0: char.socket.sysmessage( tr("You must have at least 60.0 skill in tinkering to construct a golem." )) return True elif char.controlslots + 4 > char.maxcontrolslots: char.socket.clilocmessage( 1049607) # You have too many followers to control that creature. return True scalar = 0 if TinkerSkill >= 100.0: scalar = 1.0 elif TinkerSkill >= 90.0: scalar = 0.9 elif TinkerSkill >= 80.0: scalar = 0.8 elif TinkerSkill >= 70.0: scalar = 0.7 else: scalar = 0.6 if wolfpack.utilities.checkresources(backpack, 'power_crystal', 1): # Power Crystal char.socket.sysmessage( "You must have a power crystal to construct the golem.") return True elif wolfpack.utilities.checkresources(backpack, 'iron_ingot', 50): # Iron Ingot char.socket.sysmessage( "You must have 50 iron ingots to construct the golem.") return True elif wolfpack.utilities.checkresources(backpack, 'bronze_ingot', 50): # Bronze Ingot char.socket.sysmessage( "You must have 50 bronze ingots to construct the golem.") return True elif wolfpack.utilities.checkresources(backpack, '1053', 5): # Gears char.socket.sysmessage("You must have 5 gears to construct the golem.") return True wolfpack.utilities.consumeresources(backpack, 'power_crystal', 1) wolfpack.utilities.consumeresources(backpack, 'iron_ingot', 50) wolfpack.utilities.consumeresources(backpack, 'bronze_ingot', 50) wolfpack.utilities.consumeresources(backpack, '1053', 5) golem = wolfpack.addnpc('tinkered_golem', char.pos) golem.owner = char golem.tamed = True golem.follow(char) golem.update() # Stats golem.strength = random.randint(251, 350) * scalar golem.dexterity = random.randint(76, 100) * scalar golem.intelligence = random.randint(101, 150) * scalar golem.hitpoints = random.randint(151, 210) * scalar # Damage golem.settag('mindamage', 13 * scalar) golem.settag('maxdamage', 24 * scalar) # Resistances golem.settag('res_physical', random.randint(35, 55) * scalar) golem.settag('res_fire', 100 * scalar) golem.settag('res_cold', random.randint(10, 30) * scalar) golem.settag('res_poison', random.randint(10, 25) * scalar) golem.settag('res_energy', random.randint(30, 40) * scalar) # Skills magicres = int(random.randint(1501, 1900) * scalar) tactic = int(random.randint(601, 1000) * scalar) wrest = int(random.randint(601, 1000) * scalar) golem.skill[MAGICRESISTANCE] = magicres golem.skill[TACTICS] = tactic golem.skill[WRESTLING] = wrest char.soundeffect(0x241) return True
def spawn(spawner, spawntype, spawndef, current, area): try: if spawntype == 1: npc = wolfpack.addnpc(spawndef, spawner.pos) npc.settag('spawner', spawner.serial) # NPCs with Area 0 have to stay on Origin Point if not area == 0: npc.wandertype = 3 else: npc.wandertype = 0 npc.wanderx1 = spawner.pos.x npc.wandery1 = spawner.pos.y npc.wanderradius = area npc.addscript('system.spawns') # Now Adv. Settings if spawner.hastag('color'): npc.skin = int(spawner.gettag('color')) if spawner.hastag('modstr'): npc.strength = npc.strength * float(spawner.gettag('modstr')) if spawner.hastag('moddex'): npc.dexterity = npc.dexterity * float(spawner.gettag('moddex')) if spawner.hastag('modint'): npc.intelligence = npc.intelligence * float( spawner.gettag('modint')) if spawner.hastag('modmaxhits'): npc.maxhitpoints = npc.maxhitpoints * float( spawner.gettag('modmaxhits')) if spawner.hastag('modmaxstam'): npc.maxstamina = npc.maxstamina * float( spawner.gettag('modmaxstam')) if spawner.hastag('modmaxmana'): npc.maxmana = npc.maxmana * float(spawner.gettag('modmaxmana')) if spawner.hastag('name'): npc.name = spawner.gettag('name') if spawner.hastag('nameprefix'): npc.settag('name.prefix', spawner.gettag('nameprefix')) if spawner.hastag('namesuffix'): npc.settag('name.suffix', spawner.gettag('namesuffix')) npc.update() # Updating visual of Spawn if SHOWNPCICON: bodyinfo = wolfpack.bodyinfo(npc.id) spawner.id = bodyinfo['figurine'] spawner.update() elif spawntype == 0: newitem = wolfpack.additem(spawndef) newitem.pos = spawner.pos newitem.settag('spawner', spawner.serial) newitem.decay = 0 newitem.addscript('system.spawns') newitem.update() except: if (spawner): console.log(LOG_WARNING, "Invalid spawner: 0x%x.\n" % spawner.serial) return spawner.settag('current', current + 1) spawner.resendtooltip()
def spawn(spawner, spawntype, spawndef, current, area): try: if spawntype == 1: npc = wolfpack.addnpc(spawndef, spawner.pos) npc.settag('spawner', spawner.serial) # NPCs with Area 0 have to stay on Origin Point if not area == 0: npc.wandertype = 3 else: npc.wandertype = 0 npc.wanderx1 = spawner.pos.x npc.wandery1 = spawner.pos.y npc.wanderradius = area npc.addscript( 'system.spawns' ) # Now Adv. Settings if spawner.hastag('color'): npc.skin = int(spawner.gettag('color')) if spawner.hastag('modstr'): npc.strength = npc.strength * float(spawner.gettag('modstr')) if spawner.hastag('moddex'): npc.dexterity = npc.dexterity * float(spawner.gettag('moddex')) if spawner.hastag('modint'): npc.intelligence = npc.intelligence * float(spawner.gettag('modint')) if spawner.hastag('modmaxhits'): npc.maxhitpoints = npc.maxhitpoints * float(spawner.gettag('modmaxhits')) if spawner.hastag('modmaxstam'): npc.maxstamina = npc.maxstamina * float(spawner.gettag('modmaxstam')) if spawner.hastag('modmaxmana'): npc.maxmana = npc.maxmana * float(spawner.gettag('modmaxmana')) if spawner.hastag('name'): npc.name = spawner.gettag('name') if spawner.hastag('nameprefix'): npc.settag('name.prefix', spawner.gettag('nameprefix')) if spawner.hastag('namesuffix'): npc.settag('name.suffix', spawner.gettag('namesuffix')) npc.update() # Updating visual of Spawn if SHOWNPCICON: bodyinfo = wolfpack.bodyinfo(npc.id) spawner.id = bodyinfo['figurine'] spawner.update() elif spawntype == 0: newitem = wolfpack.additem(spawndef) newitem.pos = spawner.pos newitem.settag('spawner', spawner.serial) newitem.decay = 0 newitem.addscript('system.spawns') newitem.update() except: if( spawner ): console.log(LOG_WARNING, "Invalid spawner: 0x%x.\n" % spawner.serial) return spawner.settag('current', current + 1) spawner.resendtooltip()
def gump_callback( char, args, response ): vendor = wolfpack.findchar( args[0] ) if not vendor: return if vendor.distanceto( char ) > 5: vendor.say( "I can't sell this from over there!",5 ) char.socket.sysmessage( "You can't reach the vendor." ) return if response.button == 0: vendor.say( "Bey!",5 ) return button = int( response.switches[0] ) id = response.button if id == 0: return if not prices.has_key( id ): vendor.say( "I can't sell this!",5 ) return id_npc = idnpc[ id ] id_shrink = idshrink[ id ] if ( button == 0x0000 ): #shrink if not shrinks.has_key( id ): vendor.say( "They not SHRINKABLE...",5 ) return count = prices[ id ] + prices_shrinks if char.countresource( 0xeed, 0 ) < count: vendor.say( "You don't have enough gold!",5 ) return char.useresource( count, 0xeed, 0 ) char.soundeffect( 0x37, 0 ) vendor.say( "That is %i gold." % count,5 ) item = wolfpack.additem( "%s" % id_shrink ) if not item: console.send ( "Invalid defintion: %s\n Vendor error: %s)\n" % ( id_shrink, vendor) ) return item.settag( "npc_id", "%s" % id_npc ) if rideables.has_key( id ): item.settag( "npc_type", "mount" ) else: item.settag( "npc_type", "follow" ) char.message( item.gettag( "npc_id" ) ) if not wolfpack.utilities.tocontainer( item, char.getbackpack() ): item.update() return elif ( button == 0x0001 ): #tamed if not tamed.has_key( id ): vendor.say( "They not TAMEABLE...",5 ) return count = prices[ id ] if char.countresource( 0xeed, 0 ) < count: vendor.say( "You don't have enoug gold!",5 ) return char.useresource( count, 0xeed, 0 ) char.soundeffect( 0x37, 0 ) vendor.say( "That is %i gold." % count,5 ) pos = char.pos npc = wolfpack.addnpc( id_npc, pos ) if not npc: console.send ( "Invalid defintion: %s\n Vendor error: %s)\n" % ( id_npc, vendor) ) return npc.owner = char npc.tamed = 1 npc.npcwander = 0 npc.follow( char ) return elif ( button == 0x0002 ): #rideable if ( rideables.has_key( id ) != 1 ): vendor.say( "They not RIDEABLE...",5 ) return count = prices[ id ] if char.countresource( 0xeed, 0 ) < count: vendor.say( "You don't have enoug gold!",5 ) return char.useresource( count, 0xeed, 0 ) char.soundeffect( 0x37, 0 ) vendor.say( "That is %i gold." % count,5 ) pos = char.pos npcmount = wolfpack.addnpc( id_npc, pos ) if not npcmount: console.send ( "Invalid defintion: %s\n Vendor error: %s)\n" % ( id_npc, vendor) ) return char.mount(npcmount) return else: return