Пример #1
0
    def die(self, killers):
        """
        The monster is killed. Reborn in settings.NPC_REBORN_CD seconds.
        """
        try:
            super(MudderyMonster, self).die(killers)

            # delete itself and notify its location
            location = self.location

            if self.reborn_cd <= 0:
                # Can not reborn.
                delete_object(self.dbref)
            else:
                # Remove from its location.
                self.move_to(None, quiet=True, to_none=True)
                # Set reborn timer.
                TICKER_HANDLER.add(self.reborn_cd, self.reborn)

            if location:
                for content in location.contents:
                    if content.has_player:
                        content.show_location()
        except Exception, e:
            logger.log_tracemsg("die error: %s" % e)
Пример #2
0
    def at_leave_combat_mode(self):
        """
        Called when the character leaves a combat.

        Returns:
            None
        """
        # remove the combat handler
        del self.ndb.combat_handler

        # remove combat commands
        self.cmdset.delete(settings.CMDSET_COMBAT)

        if self.is_temp:
            # notify its location
            location = self.location
            delete_object(self.dbref)
            if location:
                for content in location.contents:
                    if content.has_player:
                        content.show_location()
        else:
            if self.is_alive():
                # Recover all hp.
                self.db.hp = self.max_hp
Пример #3
0
    def die(self, killers):
        """
        The monster is killed. Reborn in settings.NPC_REBORN_CD seconds.
        """
        try:
            super(MudderyMonster, self).die(killers)
            
            # delete itself and notify its location
            location = self.location

            if settings.NPC_REBORN_CD <= 0:
                # Can not reborn.
                delete_object(self.dbref)
            else:
                # Remove from its location.
                self.move_to(None, quiet=True, to_none=True)
                # Set reborn timer.
                TICKER_HANDLER.add(self, settings.NPC_REBORN_CD, hook_key="reborn")

            if location:
                for content in location.contents:
                    if content.has_player:
                        content.show_location()
        except Exception, e:
            logger.log_tracemsg("die error: %s" % e)
Пример #4
0
    def die(self):
        """
        """
        super(MudderyMonster, self).die()

        # delete itself and notify its location
        location = self.location
        delete_object(self.dbref)

        if location:
            for content in location.contents:
                if content.has_player:
                    content.show_location()
Пример #5
0
 def die(self):
     """
     """
     super(MudderyMonster, self).die()
     
     # delete itself and notify its location
     location = self.location
     delete_object(self.dbref)
     
     if location:
         for content in location.contents:
             if content.has_player:
                 content.show_location();
Пример #6
0
    def _cleanup_character(self, character):
        """
        Remove character from handler and clean
        it of the back-reference and cmdset
        """
        super(NormalCombatHandler, self)._cleanup_character(character)

        if not character.is_typeclass(settings.BASE_PLAYER_CHARACTER_TYPECLASS):
            if character.is_temp:
                # notify its location
                location = character.location
                delete_object(character.dbref)
                if location:
                    for content in location.contents:
                        if content.has_account:
                            content.show_location()
            else:
                if character.is_alive():
                    # Recover all hp.
                    character.db.hp = character.max_hp
Пример #7
0
    def leave_combat(self):
        """
        Leave the current combat.
        """
        # remove combat commands
        self.cmdset.delete(settings.CMDSET_COMBAT)

        if self.ndb.combat_handler:
            self.ndb.combat_handler.leave_combat(self)
            del self.ndb.combat_handler

        if self.is_temp:
            # delete template character and notify its location
            location = self.location

            delete_object(self.dbref)
            if location:
                for content in location.contents:
                    if content.has_account:
                        content.show_location()
Пример #8
0
    def _cleanup_character(self, character):
        """
        Remove character from handler and clean
        it of the back-reference and cmdset
        """
        super(NormalCombatHandler, self)._cleanup_character(character)

        if not character.is_typeclass(settings.BASE_PLAYER_CHARACTER_TYPECLASS):
            if character.is_temp:
                # notify its location
                location = character.location
                delete_object(character.dbref)
                if location:
                    for content in location.contents:
                        if content.has_account:
                            content.show_location()
            else:
                if character.is_alive():
                    # Recover all hp.
                    character.db.hp = character.max_hp
Пример #9
0
    def die(self, killers):
        """
        This npc is killed. Reborn in settings.NPC_REBORN_CD seconds.
        """
        super(MudderyNPC, self).die(killers)

        location = self.location

        if self.reborn_cd <= 0:
            # Can not reborn.
            delete_object(self.dbref)
        else:
            # Remove from its location.
            self.move_to(None, quiet=True, to_none=True)
            # Set reborn timer.
            TICKER_HANDLER.add(self.reborn_cd, self.reborn)

        if location:
            for content in location.contents:
                if content.has_player:
                    content.show_location()
Пример #10
0
    def at_leave_combat_mode(self):
        """
        Called when the character leaves a combat.

        Returns:
            None
        """
        # remove the combat handler
        del self.ndb.combat_handler

        # remove combat commands
        self.cmdset.delete(settings.CMDSET_COMBAT)
        
        if self.is_clone:
            # notify its location
            location = self.location
            delete_object(self.dbref)
            if location:
                for content in location.contents:
                    if content.has_player:
                        content.show_location()