コード例 #1
0
    def at_object_creation(self):
        """
        Called once, when this object is first created. This is the
        normal hook to overload for most object types.
            
        """
        super(MudderyPlayerCharacter, self).at_object_creation()
        
        # honour
        if not HONOURS_MAPPER.has_info(self):
            if self.db.level >= settings.MIN_HONOUR_LEVEL:
                HONOURS_MAPPER.set_honour(self, 0)
            else:
                HONOURS_MAPPER.set_honour(self, -1)

        # Set default data.
        if not self.attributes.has("nickname"):
            self.db.nickname = ""
        if not self.attributes.has("unlocked_exits"):
            self.db.unlocked_exits = set()
        if not self.attributes.has("revealed_map"):
            self.db.revealed_map = set()

        # set custom attributes
        if not self.attributes.has("attributes"):
            self.db.attributes = {}

        """
コード例 #2
0
ファイル: player_characters.py プロジェクト: haishand/muddery
    def at_object_creation(self):
        """
        Called once, when this object is first created. This is the
        normal hook to overload for most object types.
            
        """
        super(MudderyPlayerCharacter, self).at_object_creation()

        # honour
        if not HONOURS_MAPPER.has_info(self):
            HONOURS_MAPPER.set_honour(self, -1)

        # Set default data.
        if not self.attributes.has("nickname"):
            self.db.nickname = ""
        if not self.attributes.has("unlocked_exits"):
            self.db.unlocked_exits = set()
        if not self.attributes.has("revealed_map"):
            self.db.revealed_map = set()

        # set custom attributes
        if not self.attributes.has("attributes"):
            self.db.attributes = {}

        # Choose a random career.
        if not self.attributes.has("career"):
            self.db.career = ""
            try:
                careers = DATA_SETS.character_careers.objects.all()
                if careers:
                    career = random.choice(careers)
                    self.db.career = career.key
            except Exception, e:
                pass
コード例 #3
0
    def level_up(self):
        """
        Upgrade level.

        Returns:
            None
        """
        super(MudderyPlayerCharacter, self).level_up()
        
        # set honour
        if self.db.level >= settings.MIN_HONOUR_LEVEL:
            if not HONOURS_MAPPER.has_info(self):
                HONOURS_MAPPER.set_honour(self, 0)
                self.msg({"msg": _("{rThe honour hall is now opened.{n")})

        # notify the player
        self.msg({"msg": _("{c%s upgraded to level %s.{n") % (self.get_name(), self.db.level)})