Exemple #1
0
    def process(self, message):
        title = ""
        body = ""

        name = message[len(self.command):]
        target_item = util.name_to_entity(
            self.session,
            name,
            loose_match=["saved_items"],
            substr_match=["room_items", "inventory"])

        if target_item is not None and name in [
                self.room_special_name, self.world_special_name
        ]:
            if name == self.room_special_name:
                self.session.send_to_client(
                    _('🚧 🚧 🚧 🚧 🚧 🚧\nNote: An item with that name was found. If you want to see the the room verbs instead, you can use "seeverbs *room*"'
                      ))
            if name == self.world_special_name:
                self.session.send_to_client(
                    _('🚧 🚧 🚧 🚧 🚧 🚧\nNote: An item with that name was found. If you want to see the the world verbs instead, you can use "seeverbs *world*"'
                      ))

        if target_item == "many":
            self.session.send_to_client(strings.many_found)
            self.finish_interaction()
            return
        elif target_item is not None:
            self.inspectable_custom_verbs = target_item.custom_verbs
            if target_item.is_saved():
                title = _('Verbs of saved item "{item_id}"').format(
                    item_id=target_item.item_id)
            else:
                title = _('Verbs of item "{item_name}"').format(
                    item_name=target_item.name)
        elif name == self.room_special_name or name == self.room_alt_name:
            title = _("Verbs of room: {room_name}").format(
                room_name=self.session.user.room.name)
            self.inspectable_custom_verbs = self.session.user.room.custom_verbs
        elif name == self.world_special_name or name == self.world_alt_name:
            title = _("World-level verbs")
            self.inspectable_custom_verbs = self.session.user.room.world_state.custom_verbs

        if not self.inspectable_custom_verbs:
            body = _("There are no verbs to show.")
            self.session.send_to_client(strings.format(title, body))
            self.finish_interaction()
        else:
            body = self.get_custom_verb_list()
            body += _("\n ᐅ Enter the number of a verb to show its commands")
            self.session.send_to_client(
                strings.format(title, body, cancel=True))
            self.process = self.process_menu_option
Exemple #2
0
    def process(self, message):
        item_name = message[len(self.command):]
        selected_item = util.name_to_entity(
            self.session,
            item_name,
            loose_match=["saved_items"],
            substr_match=["room_items", "inventory"])

        if selected_item is not None and item_name in [
                self.room_special_name, self.world_special_name
        ]:
            if item_name == self.room_special_name:
                self.session.send_to_client(
                    _('🚧 🚧 🚧 🚧 🚧 🚧\nNote: An item with that name was found. If you want to delete the the room verbs instead, you can use "deleteverb *room*"'
                      ))
            if item_name == self.world_special_name:
                self.session.send_to_client(
                    _('🚧 🚧 🚧 🚧 🚧 🚧\nNote: An item with that name was found. If you want to delete the the world verbs instead, you can use "deleteverb *world*"'
                      ))

        if selected_item == "many":
            self.session.send_to_client(strings.many_found)
            self.finish_interaction()
            return
        elif selected_item is not None:
            target_name = (_('"{item_id}" (saved item)').format(
                item_id=selected_item.item_id) if selected_item.is_saved() else
                           _('"{item_name}" (item)').format(
                               item_name=selected_item.name))
            self.deletable_custom_verbs = selected_item.custom_verbs
        elif item_name == self.room_special_name or item_name == self.room_alt_name:
            self.deletable_custom_verbs = self.session.user.room.custom_verbs
            target_name = _('"{room_name}" (room)').format(
                room_name=self.session.user.room.name)
        elif item_name == self.world_special_name or item_name == self.world_alt_name:
            self.deletable_custom_verbs = self.session.user.room.world_state.custom_verbs
            target_name = _('this world')
        else:
            self.session.send_to_client(strings.not_found)
            self.finish_interaction()
            return

        if not self.deletable_custom_verbs:
            self.session.send_to_client(
                _("{target_name} has no verbs to delete.").format(
                    target_name=target_name))
            self.finish_interaction()
            return

        title = _("Deleting verb of {target_name}").format(
            target_name=target_name)
        body = _(
            "{verb_list}\n ᐅ Enter the number of the verb to delete:").format(
                target_name=target_name, verb_list=self.get_custom_verb_list())
        out_message = strings.format(title, body, cancel=True)
        self.session.send_to_client(out_message)
        self.process = self.process_menu_option
Exemple #3
0
 def process_first_message(self, message):
     title = _('Reforming room "{room_name}"').format(
         room_name=self.session.user.room.name)
     body = _('Enter the number of the field to modify\n'
              '    0 - Name\n'
              '    1 - Description')
     out_message = strings.format(title, body, cancel=True)
     self.session.send_to_client(out_message)
     self.current_process_function = self.process_reform_option
Exemple #4
0
    def process_room_verb_creation(self):
        self.room = self.session.user.room
        title = _('Adding verb to this room')
        body = textwrap.dedent(
            _("""\
            You are creating a verb that any player in this room will be able to use.

            Now enter the verb's name. If you write "sing" the verb will be executed simply by "sing".
            You can give the verb multiple names. Just enter all of them separated by a whitespace.

            Verb name/s:"""))
        self.session.send_to_client(strings.format(title, body, cancel=True))
        self.current_process_function = self.process_verb_names
Exemple #5
0
    def process_item_verb_creation(self, target_item):
        self.item = target_item

        body = textwrap.dedent(
            _("""\
            You are creating a verb that any player will be able to use over this item.

            Now enter the verb's name. If you write "use" the verb will be executed by "use {item_name}".
            You can give the verb multiple names. Just enter all of them separated by a whitespace.

            Verb name/s:""").format(item_name=self.item.name))

        if target_item.is_saved():
            title = _('Adding verb to saved item "{item_id}"').format(
                item_id=self.item.item_id)
        else:
            title = _('Adding verb to item "{item_id}"').format(
                item_id=self.item.name)

        self.session.send_to_client(strings.format(title, body, cancel=True))
        self.current_process_function = self.process_verb_names