Esempio n. 1
0
    def figure_mob_levels(self):
        mf = self.db.mob_factory
        self.db.rooms = search_object_tag('%s_room' % self.key)
        self.db.mobs = search_object_tag("%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
Esempio n. 2
0
 def at_repeat(self):
     self.ndb.subscribers = search_object_tag('zone_manager')
     self.ndb.corpses = search_object_tag('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]
Esempio n. 3
0
 def at_repeat(self):
     self.ndb.subscribers = search_object_tag("zone_manager")
     self.ndb.corpses = search_object_tag("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]
Esempio n. 4
0
    def create_quest_menu(self, caller):
        if len(self.db.quests) < 1:
            self.tell_character(caller, "I have no work for you at the moment adventurer.")
            return
        nodes = []
        quests = self.db.quests
        checked_quests = []
        character = caller
        character_quest_log = character.db.questlog
        active_quests = character_quest_log.db.active_quests
        completed_quests = character_quest_log.db.completed_quests
        for quest in quests:
            print quest
            quest_obj = ev.search_object_tag('%s' % quest.lower())
            try:
                quest_obj = quest_obj[0]
            except IndexError:
                continue
            print quest_obj
            if quest.lower() in [ q.lower() for q in active_quests.keys()]:
                continue
            if quest_obj.db.prereq is not None:
                if ';' in quest_obj.db.prereq:
                    split_list = quest_obj.db.prereq.split(';')
                    for item in split_list:
                        if item in completed_quests.keys():
                            continue
                else:
                    if quest_obj.db.prereq.title() not in [key.title() for key in completed_quests.keys()]:
                        continue 
            if quest_obj.db.repeatable:
                checked_quests.append(quest)
                continue
            if quest.lower() in [ q.lower() for q in completed_quests.keys()]:
                continue
                
            checked_quests.append(quest)
        if len(checked_quests) < 1:
            self.tell_character(caller, "I have no more work for you adventurer.")
            return
                 
        quests_string = '\n'.join(["{y!{n {g%s" % i for i in quests])
        welcome_text = """
Hello %s, my name is %s.  I am looking for some help with some things today, 
perhaps you could spare some time? 
        """ % (caller.name, self.db.real_name)
        root_node = MenuNode("START", links=[i for i in checked_quests], linktexts=["{y!{n %s" % i for i in checked_quests], text = welcome_text)
        for quest in checked_quests:
            #caller.msg("Looking for: %s" % quest)
            quest_obj = ev.search_object_tag('%s' % quest.lower())[0]
            #caller.msg("%s" % quest_obj.name)
            confirm_quest_node = MenuNode("confirm-%s" % quest, links=['END'], linktexts=['Exit dialogue'], code="self.caller.accept_quest('%s')" % quest)
            quest_node = MenuNode("%s" % quest, links=['confirm-%s' % quest, 'START'], linktexts=['Accept %s' % quest, "I want to talk about something else."], text=quest_obj.db.long_description)
            nodes.append(confirm_quest_node)
            nodes.append(quest_node)
        nodes.append(root_node)
        menu = MenuTree(caller=caller, nodes=nodes)
        menu.start()
Esempio n. 5
0
 def at_repeat(self):
     self.ndb.mobs = search_object_tag('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
     ]
Esempio n. 6
0
    def accept_quest(self, quest):
        print "In accept_quest"
        manager = self.db.questlog
        quest_object = search_object_tag(quest.lower())[0]
        print quest_object
        exclusions = quest_object.db.exclusions
        print exclusions
        attributes = self.db.attributes

        try:
            split_list = exclusions.split(":")
        except:
            split_list = []
        print len(split_list)
        if len(split_list) > 1:
            print "in deity logic"
            attribute = split_list[0]
            exclude = split_list[1]
            if 'deity' in attributes:
                if attributes['deity'] in exclude:
                    self.msg(
                        "{rYou are a devout follower of %s and therefore have moral and religious objections to what this person asks of you.{n"
                        % attributes['deity'])
                    return
        print "past deity checks"
        if quest_object.db.prereq is not None:
            if ';' in quest_object.db.prereq:
                found = 0
                split_list = quest_object.prereq.split(';')
                for item in split_list:
                    item = item.strip()
                    if item.title() in [
                            key.title()
                            for key in manager.db.completed_quests.keys()
                    ]:
                        found = 1
                if found != 1:
                    self.msg("{RPre req not met.{n")
                    return
            else:
                if quest_object.prereq.title() in [
                        key.title()
                        for key in manager.db.completed_quests.keys()
                ]:
                    pass
                else:
                    self.msg("{RPre requisite not met.{n")
                    return
        character_quest = quest_object.copy()
        character_quest.name = quest_object.name
        character_quest.add_help_entry()
        manager.add_quest(character_quest)
        character_quest.move_to(manager, quiet=True)
        self.db.quest_log = manager
        self.msg("{yYou have accepted: %s" % character_quest.name)
        return
Esempio n. 7
0
 def accept_quest(self, quest):
     print "In accept_quest"
     manager = self.db.questlog
     quest_object = search_object_tag(quest.lower())[0]
     print quest_object
     exclusions = quest_object.db.exclusions
     print exclusions
     attributes = self.db.attributes
     
     try:
         split_list = exclusions.split(":")
     except:
         split_list = []
     print len(split_list)
     if len(split_list) > 1:
         print "in deity logic"
         attribute = split_list[0]
         exclude = split_list[1]
         if 'deity' in attributes:
             if attributes['deity'] in exclude:
                 self.msg("{rYou are a devout follower of %s and therefore have moral and religious objections to what this person asks of you.{n" % attributes['deity'])
                 return 
     print "past deity checks"
     if quest_object.db.prereq is not None:
         if ';' in quest_object.db.prereq:
             found = 0
             split_list = quest_object.prereq.split(';')
             for item in split_list:
                 item = item.strip()
                 if item.title() in [key.title() for key in manager.db.completed_quests.keys()]:
                     found = 1
             if found != 1:
                 self.msg("{RPre req not met.{n")
                 return
         else:
             if quest_object.prereq.title() in [key.title() for key in manager.db.completed_quests.keys()]:
                 pass
             else:
                 self.msg("{RPre requisite not met.{n")
                 return 
     character_quest = quest_object.copy()
     character_quest.name = quest_object.name
     character_quest.add_help_entry()
     manager.add_quest(character_quest)
     character_quest.move_to(manager, quiet=True)
     self.db.quest_log = manager
     self.msg("{yYou have accepted: %s" % character_quest.name)
     return
Esempio n. 8
0
 def at_repeat(self):
     self.ndb.subscribers = search_object_tag('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]
Esempio n. 9
0
    def create_quest_menu(self, caller):
        if len(self.db.quests) < 1:
            self.tell_character(
                caller, "I have no work for you at the moment adventurer.")
            return
        nodes = []
        quests = self.db.quests
        checked_quests = []
        character = caller
        character_quest_log = character.db.questlog
        active_quests = character_quest_log.db.active_quests
        completed_quests = character_quest_log.db.completed_quests
        for quest in quests:
            print quest
            quest_obj = ev.search_object_tag('%s' % quest.lower())
            try:
                quest_obj = quest_obj[0]
            except IndexError:
                continue
            print quest_obj
            if quest.lower() in [q.lower() for q in active_quests.keys()]:
                continue
            if quest_obj.db.prereq is not None:
                if ';' in quest_obj.db.prereq:
                    split_list = quest_obj.db.prereq.split(';')
                    for item in split_list:
                        if item in completed_quests.keys():
                            continue
                else:
                    if quest_obj.db.prereq.title() not in [
                            key.title() for key in completed_quests.keys()
                    ]:
                        continue
            if quest_obj.db.repeatable:
                checked_quests.append(quest)
                continue
            if quest.lower() in [q.lower() for q in completed_quests.keys()]:
                continue

            checked_quests.append(quest)
        if len(checked_quests) < 1:
            self.tell_character(caller,
                                "I have no more work for you adventurer.")
            return

        quests_string = '\n'.join(["{y!{n {g%s" % i for i in quests])
        welcome_text = """
Hello %s, my name is %s.  I am looking for some help with some things today, 
perhaps you could spare some time? 
        """ % (caller.name, self.db.real_name)
        root_node = MenuNode(
            "START",
            links=[i for i in checked_quests],
            linktexts=["{y!{n %s" % i for i in checked_quests],
            text=welcome_text)
        for quest in checked_quests:
            #caller.msg("Looking for: %s" % quest)
            quest_obj = ev.search_object_tag('%s' % quest.lower())[0]
            #caller.msg("%s" % quest_obj.name)
            confirm_quest_node = MenuNode(
                "confirm-%s" % quest,
                links=['END'],
                linktexts=['Exit dialogue'],
                code="self.caller.accept_quest('%s')" % quest)
            quest_node = MenuNode("%s" % quest,
                                  links=['confirm-%s' % quest, 'START'],
                                  linktexts=[
                                      'Accept %s' % quest,
                                      "I want to talk about something else."
                                  ],
                                  text=quest_obj.db.long_description)
            nodes.append(confirm_quest_node)
            nodes.append(quest_node)
        nodes.append(root_node)
        menu = MenuTree(caller=caller, nodes=nodes)
        menu.start()
Esempio n. 10
0
 def at_repeat(self):
     self.ndb.subscribers = search_object_tag("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]
Esempio n. 11
0
 def at_repeat(self):
     self.ndb.mobs = search_object_tag("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]