コード例 #1
0
    def func(self):
        ch = self.caller
        cur_room = ch.location
        exit = cur_room.db.exits[self.key]
        if exit < 0:
            ch.msg(_ERR_MOVEMENT)
            return

        # double check to make sure destination room actually exists
        room = search_object(str(exit), typeclass=Room)
        if not room:
            logger.log_errmsg(
                "Attempting to move to a valid exit vnum, but room doesn't exist"
            )
            ch.msg(_ERR_MOVEMENT)
            return
        room = room[0]

        # special condition if ch is in redit
        if ch.ndb._redit:
            ch.ndb._redit.__init__(ch, exit)

        # announce to the contents in rooms
        act(f"$n leaves {self.key}", True, True, ch, None, None,
            Announce.ToRoom)
        # valid, lets move
        ch.move_to(room)
        act(f"$n arrives", True, True, ch, None, None, Announce.ToRoom)
コード例 #2
0
ファイル: wiz.py プロジェクト: ChrisLR/scrolls
    def func(self):
        ch = self.caller

        delete_contents(ch.location)
        act("With an ear splitting bang, $n clears the room", False, False, ch,
            None, None, Announce.ToRoom)
        act("You clear the room", False, False, ch, None, None,
            Announce.ToChar)
コード例 #3
0
ファイル: characters.py プロジェクト: ChrisLR/scrolls
    def unwield(self, obj):
        obj.db.is_wielded = False
        self.location['wield'] = None
        act("$n unwields $p", True, True, self.caller, obj, None,
            Announce.ToRoom)
        act("You unwield $p", True, True, self.caller, obj, None,
            Announce.ToChar)
        remove_obj_effects(self.caller, obj)

        return True
コード例 #4
0
ファイル: characters.py プロジェクト: ChrisLR/scrolls
    def wield(self, obj):
        if self.location['wield'] is not None:
            self.caller.msg("You are already wielding something.")
            return
        obj.db.is_wielded = True
        self.location['wield'] = obj

        act("$n wields $p", True, True, self.caller, obj, None,
            Announce.ToRoom)
        act("You wield $p", True, True, self.caller, obj, None,
            Announce.ToChar)
        apply_obj_effects(self.caller, obj)
コード例 #5
0
ファイル: characters.py プロジェクト: ChrisLR/scrolls
    def remove(self, obj):
        """ 
        remove piece of equipment from inventory
        remove any stat changes and affects to player here
        """
        obj.db.is_worn = False
        self.location[obj.db.wear_loc] = None

        act("$n removes $p", True, True, self.caller, obj, None,
            Announce.ToRoom)
        act("You remove $p", True, True, self.caller, obj, None,
            Announce.ToChar)
        remove_obj_effects(self.caller, obj)

        return True
コード例 #6
0
ファイル: characters.py プロジェクト: ChrisLR/scrolls
    def add(self, obj):
        """ 
        add piece of equipment from inventory to and make worn
        include any stat changes and affects to player here
        """
        if self.location[obj.db.wear_loc] is not None:
            self.caller.msg(
                f"You are already wearing something on your {obj.db.wear_loc}")
            return

        obj.db.is_worn = True
        self.location[obj.db.wear_loc] = obj
        act("$n wears $p", True, True, self.caller, obj, None, Announce.ToRoom)
        act("You wear $p", True, True, self.caller, obj, None, Announce.ToChar)
        apply_obj_effects(self.caller, obj)
コード例 #7
0
ファイル: wiz.py プロジェクト: ChrisLR/scrolls
    def func(self):
        ch = self.caller
        if not self.args:
            act("You are restored", False, False, ch, None, None,
                Announce.ToRoom)
            act("You restore the room", False, False, ch, None, None,
                Announce.ToChar)
            ch.full_restore()
            return

        self.args = self.args.strip().split(' ')
        vict_obj = ch.location.search(self.args[0])
        if not vict_obj:
            ch.msg("You don't see anyone here by that name")
            return

        if vict_obj.is_pc or vict_obj.is_npc:
            vict_obj.full_restore()
            return
コード例 #8
0
        def success_get(obj, con=None):
            # add obj weight to characters carry rating
            ch.attrs.change_vital('carry', by=obj.db.weight)

            if not con:
                act(f"$n picks up a $p.", True, True, ch, obj, None,
                    Announce.ToRoom)
                act(f"You pick up a $p", False, False, ch, obj, None,
                    Announce.ToChar)
            else:
                act(f"$n gets $p from $P", True, True, ch, obj, con,
                    Announce.ToRoom)
                act(f"You get $p from $P", False, False, ch, obj, con,
                    Announce.ToChar)
コード例 #9
0
ファイル: wiz.py プロジェクト: ChrisLR/scrolls
    def func(self):
        ch = self.caller

        invis = get_condition('invisible')
        if not is_invis(ch):
            ch.conditions.add(invis)
            act("You slowly vanish into thin air.", False, False, ch, None,
                None, Announce.ToChar)
            act("$n slowly vanishes into thin air.", False, False, ch, None,
                None, Announce.ToRoom)
        else:
            ch.conditions.remove(invis)
            act("You fade back to normal.", False, False, ch, None, None,
                Announce.ToChar)
            act("$n slowly fades back into normal", False, False, ch, False,
                None, Announce.ToRoom)
コード例 #10
0
ファイル: wiz.py プロジェクト: ChrisLR/scrolls
    def func(self):
        ch = self.caller
        args = self.args.strip().split()

        if not args:
            ch.msg(f"{self.__doc__}")
            return
        if len(args) == 1:
            ch.msg("must supply valid vnum number")
            return
        # <obj/mob> <vnum>
        obj_type, vnum = args
        if obj_type.lower() not in ('obj', 'mob'):
            ch.msg("must supply either `obj` or `mob`")
            return

        try:
            vnum = int(vnum)
        except ValueError:
            ch.msg("invalid vnum number")
            return

        # check to see if vnum exists
        if vnum not in GLOBAL_SCRIPTS.objdb.vnum.keys():
            ch.msg(f"that {obj_type}:{vnum} does not exist")
            return
        obj_bp = GLOBAL_SCRIPTS.objdb.vnum[vnum]
        # create instance of object and either put in room
        obj_type = CUSTOM_OBJS[obj_bp['type']]
        obj = create_object(obj_type, key=vnum)
        obj.move_to(ch.location)
        act_msg = "$n motions $s hands around and $e creates"\
            f" |G{obj.db.sdesc}|n"
        act(act_msg, False, False, ch, None, None, Announce.ToRoom)
        act(f"You create |G{obj.db.sdesc}|n", False, False, ch, None, None,
            Announce.ToChar)
コード例 #11
0
 def success_drop(obj):
     # remove obj weight to characters carry rating
     ch.attrs.change_vital('carry', by=-obj.db.weight)
     act("$n drops $p", True, True, ch, obj, None, Announce.ToRoom)
     act("You drop $p", True, True, ch, obj, None, Announce.ToChar)
コード例 #12
0
    def func(self):
        """Implement command"""

        ch = self.caller
        args = self.args.strip()

        if not self.args:
            ch.msg("Drop what?")
            return

        def success_drop(obj):
            # remove obj weight to characters carry rating
            ch.attrs.change_vital('carry', by=-obj.db.weight)
            act("$n drops $p", True, True, ch, obj, None, Announce.ToRoom)
            act("You drop $p", True, True, ch, obj, None, Announce.ToChar)

        if "." in args:
            pos, obj_name = args.split('.')
            do_all = False
            if pos == 'all':
                do_all = True
            else:
                try:
                    pos = int(pos)
                except:
                    ch.msg("pos must be a valid integer")
                    return

            # handles dot notation
            cntr = 1
            for obj in ch.contents:
                if is_equipped(obj):
                    continue
                if match_name(obj_name, obj):
                    if do_all:
                        # match
                        if can_drop(ch, obj):
                            obj.move_to(ch.location, quiet=True)
                            success_drop(obj)
                        else:
                            ch.msg("You can't drop that.")
                        continue

                    if cntr == pos:
                        # match
                        if can_drop(ch, obj):
                            obj.move_to(ch.location, quiet=True)
                            success_drop(obj)
                        else:
                            ch.msg("You can't drop that.")

                    cntr += 1

        else:
            for obj in ch.contents:
                if is_equipped(obj):
                    continue

                if args == 'all':
                    if can_drop(ch, obj):
                        obj.move_to(ch.location, quiet=True)
                        success_drop(obj)

                    else:
                        act("You can't drop $p", False, False, ch, obj, None,
                            Announce.ToChar)
                    continue

                elif match_name(args, obj):
                    if can_drop(ch, obj):
                        obj.move_to(ch.location, quiet=True)
                        success_drop(obj)
                        return
                    else:
                        act("You can't drop $p", False, False, ch, obj, None,
                            Announce.ToChar)
                        return
コード例 #13
0
 def success_put(obj, con_obj):
     act("$n puts $p in $P", True, True, ch, obj, con_obj,
         Announce.ToRoom)
     act("You put $p in $P", True, True, ch, obj, con_obj,
         Announce.ToChar)