def figure_mob_levels(self): mf = self.db.mob_factory self.db.rooms = search.objects('%s_room' % self.key) self.db.mobs = search.objects("%s_mobs" % mf.id) for room in self.db.rooms: mob_set = [] print "checking %s" % room.name mobs = room.db.mobs print mobs for mob in room.db.mobs: if mob.db.corpse: continue self.db.mob_map['%s' % mob.dbref ] = room if len(room.db.mobs) < 2: #create mobs rn = random.randrange(0,10) mob_set = mf.create_mob_set(rn) for mob in mob_set: mob.move_to(room, quiet=True) mobs.append(mob) else: pass room.db.mobs += mob_set
def at_repeat(self): self.ndb.subscribers = search.objects("zone_manager") self.ndb.corpses = search.objects("corpse") # print "ZoneRunner => tick() [ %s zones in run ]" % len(self.db.subscribers) print "mob_level()" [z.figure_mob_levels() for z in self.ndb.subscribers] print "corpse delete" [c.delete() for c in self.ndb.corpses if c.db.destroy_me is True]
def at_repeat(self): print "ZoneRunner ==> reanimate()" self.ndb.reanimators = search.objects("reanimator") [reanimator.reanimate() for reanimator in self.ndb.reanimators if reanimator.db.corpse] print "ZoneRunner ==> update()" self.ndb.subscribers = search.objects("zone_runner") [zone.update() for zone in self.ndb.subscribers if not zone.db.mobs_spawned] print "ZoneRunner ==> corpse.delete()" self.ndb.corpses = search.objects("corpse") [corpse.delete() for corpse in self.ndb.corpses if not corpse.db.reanimate]
def at_object_creation(self): self.db.rooms = search.objects("%s_room" % self.key) self.db.mob_map = {} self.db.player_map = {} self.db.quest_items = [] self.db.zone_map = {} self.db.mob_factory = create_object("game.gamesrc.objects.world.factories.MobFactory", key='%s MobFactory' % self.key) self.aliases = [ 'zone_manager']
def at_object_creation(self): self.db.rooms = search.objects("%s_room" % self.key) self.db.mob_map = {} self.db.player_map = {} self.db.quest_items = [] self.db.zone_map = {} self.db.mob_factory = create_object("game.gamesrc.objects.world.factories.MobFactory", key='%s MobFactory' % self.key) self.tags.add('zone_manager')
def func(self): """ Simple puppet method """ caller = self.caller old_character = self.character new_character = None if not self.args: new_character = caller.db.last_puppet if not new_character: caller.msg("Usage: @ic <character>") return if not new_character: # search for a matching character new_character = search.objects(self.args, caller) if new_character: new_character = new_character[0] else: # the search method handles error messages etc. return if new_character.player: if new_character.player == caller: caller.msg("{RYou already are {c%s{n." % new_character.name) else: caller.msg("{c%s{r is already acted by another player.{n" % new_character.name) return if not new_character.access(caller, "puppet"): caller.msg("{rYou may not become %s.{n" % new_character.name) return if caller.swap_character(new_character): new_character.msg("\n{gYou become {c%s{n.\n" % new_character.name) caller.db.last_puppet = old_character if not new_character.location: # this might be due to being hidden away at logout; check loc = new_character.db.prelogout_location if not loc: # still no location; use home loc = new_character.home new_character.location = loc if new_character.location: new_character.location.msg_contents( "%s has entered the game." % new_character.key, exclude=[new_character] ) new_character.location.at_object_receive(new_character, new_character.location) new_character.execute_cmd("look") else: caller.msg("{rYou cannot become {C%s{n." % new_character.name)
def at_script_start(self): self.ndb.subscribers = [search.objects(dbref) for dbref in self.db.subscribers] self.ndb.corpses = [search.objects(dbref) for dbref in self.db.corpses]
def at_repeat(self): self.ndb.subscribers = search.objects("character_runner") # print "CharRunner => tick() [%s chars in run]" % len(self.ndb.subscribers) [c.tick() for c in self.ndb.subscribers if c.has_player]
def at_repeat(self): self.ndb.mobs = search.objects("mob_runner") # print "MobRunner => update() [%s mobs in run]" % len(self.ndb.mobs) [mob.tick() for mob in self.ndb.mobs if mob.db.should_update and mob is not None]
#HEADER from src.utils import create, search from game.gamesrc.objects.world.quests import Quest #CODE (Generating quests) storage = search.objects('storage')[0] copy_dir = '/var/mud/evennia/game/gamesrc/copy/' tutorial_quest = create.create_object(Quest, key="Tutorial Slaughter", location=storage) tutorial_quest.set_description('%squests/tutorial1.txt' % copy_dir) tutorial_quest.db.gold_reward = 50 tutorial_quest.db.exp_reward = 200 objective = { 'objective_name': 'Kill something Evil.', 'counter': 0, 'threshold': 1, 'completed': False, 'type': 'kill' } tutorial_quest.add_objective(objective) tutorial_quest = create.create_object(Quest, key="Tutorial Gather", location=storage) tutorial_quest.set_description('%squests/tutorial_gather.txt' % copy_dir) tutorial_quest.db.gold_reward = 25 tutorial_quest.db.exp_reward = 300 objective = { 'objective_name': 'Gather an Item.', 'counter': 0, 'threshold': 1, 'completed': False, 'type': 'gather_weapon' } tutorial_quest.add_objective(objective) #CODE (Marshlands Quests) storage = search.objects('storage')[0] copy_dir = '/var/mud/evennia/game/gamesrc/copy/' slythain_nuisance = create.create_object(Quest, key="Have You Met The Slythain?", location=storage) slythain_nuisance.set_description("%s/quests/slythain_nuisance.txt" % copy_dir) slythain_nuisance.short_description = "Kill Slythain Soldiers" slythain_nuisance.db.level = 3 slythain_nuisance.db.gold_reward = 45
def at_repeat(self): self.ndb.subscribers = search.objects("npc_runner") [npc.update() for npc in self.ndb.subscribers]
def at_repeat(self): self.ndb.mobs = search.objects("irregular_runner") [mob.irregular_action() for mob in self.ndb.mobs if mob.db.should_update]
def at_repeat(self): self.ndb.mobs = search.objects("mob_runner") print "MobRunner ==> update()" [mob.update() for mob in self.ndb.mobs if mob.db.should_update and mob is not None] print "MobRunner ==> kos_tick()" [mob.kos_tick() for mob in self.ndb.mobs if mob.db.is_kos and mob.db.should_update and mob is not None]
def at_repeat(self): self.ndb.subscribers = search.objects("lair_runner") [lair.update() for lair in self.ndb.subscribers]
#HEADER from src.utils import create, search #CODE (Potions) location = search.objects("storage")[0] small_hp_potion = create.create_object("game.gamesrc.objects.world.items.Potion", location=location, aliases=['storage_potions']) small_hp_potion.db.level = 1 small_hp_potion.db.effect = "healing" small_hp_potion.db.attribute_affected = "hp" small_hp_potion.db.value = 10 small_hp_potion.generate_item_stats() medium_hp_potion = create.create_object("game.gamesrc.objects.world.items.Potion", location=location, aliases=['storage_potions']) medium_hp_potion.db.level = 10 medium_hp_potion.db.effect = "healing" medium_hp_potion.db.attribute_affected = "hp" medium_hp_potion.db.value = 35 medium_hp_potion.generate_item_stats() large_hp_potion = create.create_object("game.gamesrc.objects.world.items.Potion", location=location, aliases=['storage_potions']) large_hp_potion.db.level = 20 large_hp_potion.db.effect = "healing" large_hp_potion.db.attribute_affected = "hp" large_hp_potion.db.value = 60 large_hp_potion.generate_item_stats() strike = create.create_object("game.gamesrc.objects.world.skills.TrainingBook", location=location, aliases=['storage_skills'], key="Training Manual: Strike") strike.db.desc = "A thick training manual which details the use and learning of a certain skill, granting the reader the ability to use said skill." strike.db.skill = 'strike' strike.db.value = 100 rend = create.create_object("game.gamesrc.objects.world.skills.TrainingBook", location=location, aliases=['storage_skills'], key="Training Manual: Rend") rend.db.skill = 'rend' rend.db.desc = "A thick training manual which details the use and learning of a certain skill, granting the reader the ability to use said skill." rend.db.value = 150
def at_script_start(self): self.ndb.mobs = [search.objects(dbref) for dbref in self.db.mobs]
def at_script_start(self): self.ndb.subscribers = [ search.objects(dbref) for dbref in self.db.subscribers ] self.ndb.corpses = [search.objects(dbref) for dbref in self.db.corpses]