Beispiel #1
0
    def _task_detail_title(titles,
                           indent=0,
                           button_show_desc=True,
                           button_edit_title=False):
        # type: (TitleList, int, bool, bool) -> st.STextList
        ind = st.SText.indent(indent)
        space = st.SText.space()
        newline = st.SText.newline()

        t = Task.task_by_title_list(titles)
        ts = titles

        icon = TaskView._task_detail_icon_done(ts.copy(), t.done)
        title = TaskView._task_detail_title_text(ts.copy(), t.done)

        show_desc = st.SText()
        if t.description != '' and button_show_desc:
            show_desc = TaskView._task_detail_button_show_description(
                ts.copy())

        edit_title = st.SText()
        if button_edit_title:
            edit_title = TaskView._task_detail_icon_edit_title(ts.copy())

        r = st.STextList(ind, icon, space, title, space, show_desc, edit_title,
                         newline)
        return r
Beispiel #2
0
def show_list():
    global global_server
    global global_info
    global data
    load_data()

    server = global_server
    info = global_info
    player = info.player

    flag = 1
    for i in range(0, len(data)):
        if data[i]["sender"] == player:
            time = data[i]["time"]
            target = data[i]["target"]
            message = data[i]["message"]
            if flag:
                flag = 0

            delete = st.SText("[x] §a" + time + " §6To " + target + "§r : " +
                              message,
                              color=st.SColor.red)
            delete.styles = [st.SStyle.bold]
            delete.hover_text = st.SText("点击删除§6" + data[i]["message"])
            command = "!!msg del " + data[i]["message"]
            delete.set_click_command(command)
            st.show_to_player(server, player, delete)

            # server.reply(info, "§a" + time + " §6To " +
            #             target + "§r : " + message)
    if flag:
        server.reply(info, "§c你没有任何留言!")
Beispiel #3
0
def show_list():
    global data
    load_data()

    global global_server
    global global_info
    server = global_server
    info = global_info

    player = info.player

    flag = 1

    for i in range(0, len(data)):
        if (data[i]["fixed"] == True):
            continue  # 已被修复
        output = st.SText(" - " + data[i]["name"] + "   §7" +
                          data[i]["comment"])
        output.hover_text = st.SText("点击查看任务详细")
        output.set_click_command("!!repair detail " + data[i]["name"])
        st.show_to_player(server, player, output)
        flag = 0

    if (flag):
        server.reply(info, "§c没有未完成的报修!§r")

    show_fixed_list = st.SText("显示已修复的报修", color=st.SColor.gray)
    show_fixed_list.styles = [st.SStyle.bold, st.SStyle.underlined]
    show_fixed_list.set_click_command("!!repair fixed")
    st.show_to_player(server, player, show_fixed_list)
Beispiel #4
0
 def task_deleted(titles):
     space = st.SText.space()
     m1 = st.SText("任务")
     task = st.SText(unicode(titles), color=st.SColor.yellow)
     m2 = st.SText("已删除")
     msg = st.STextList(m1, space, task, space, m2)
     return msg
Beispiel #5
0
    def _task_detail_icon_edit_desc(titles):
        # type: (TitleList) -> st.SText
        icon = st.SText("✎", color=st.SColor.white)

        hover = st.SText("修改任务描述")
        icon.hover_text = hover

        suggest = "!!task change {} ".format(unicode(titles))
        icon.set_click_suggest(suggest)

        return icon
Beispiel #6
0
    def _task_detail_button_show_description(titles):
        # type: (TitleList) -> st.SText
        show = st.SText("[…]", color=st.SColor.white)

        h1 = st.SText("点击以查看")
        h2 = st.SText("任务描述", color=st.SColor.yellow)
        add_hover = st.STextList(h1, h2)
        show.hover_text = add_hover

        command = "!!task detail {}".format(unicode(titles))
        show.set_click_command(command)

        return show
Beispiel #7
0
    def _task_detail_title_text(titles, done):
        # type: (TitleList, bool) -> st.SText
        title = titles.peek_tail()
        styles = [st.SStyle.strikethrough] if done else None
        color = st.SColor.darkGray if done else st.SColor.yellow
        r = st.SText(title, color=color, styles=styles)

        h1 = st.SText("点击以查看")
        h2 = st.SText("任务详情", st.SColor.yellow)
        hover = st.STextList(h1, h2)
        r.hover_text = hover

        command = "!!task detail {}".format(unicode(titles))
        r.set_click_command(command)
        return r
Beispiel #8
0
    def _task_list_show_undone():
        ind = st.SText.indent(4)
        newline = st.SText.newline()

        text = "[已完成任务...]"
        msg = st.SText(text, color=st.SColor.darkGray)

        hover_text = "点击以查看已完成任务"
        hover = st.SText(hover_text)
        msg.hover_text = hover

        command = "!!task list-done"
        msg.set_click_command(command)

        r = st.STextList()
        r.append(ind, msg, newline)
        return r
Beispiel #9
0
    def _task_detail_button_add(titles):
        # type: (TitleList) -> st.SText
        add = st.SText("[+]", color=st.SColor.red)

        h1 = st.SText("点击以快速")
        h2 = st.SText("添加子任务", color=st.SColor.yellow)
        add_hover = st.STextList(h1, h2)
        add.hover_text = add_hover

        ts = unicode(titles)
        if ts != '':
            suggest = "!!task add {}.".format(ts)
        else:
            suggest = "!!task add "
        add.set_click_suggest(suggest)

        return add
Beispiel #10
0
    def _task_detail_icon_done(titles, done):
        # type: (TitleList, bool) -> st.SText
        icon_done = st.SText("⬛", color=st.SColor.darkGray)
        icon_undone = st.SText("⬜", color=st.SColor.white)
        icon = icon_done if done else icon_undone

        done_text = "未完成" if done else "完成"
        hover_prefix = st.SText("将任务标记为")
        hover_done = st.SText(done_text, st.SColor.yellow)
        hover = st.STextList(hover_prefix, hover_done)
        icon.hover_text = hover

        option = 'undone' if done else 'done'
        command = "!!task {} {}".format(option, unicode(titles))
        icon.set_click_command(command)

        return icon
Beispiel #11
0
    def _task_detail_main_title(titles, title_text):
        # type: (TitleList, unicode) -> st.STextList
        main_title = st.SText(title_text,
                              color=st.SColor.green,
                              styles=[st.SStyle.bold])
        add = TaskView._task_detail_button_add(titles.copy())

        msg = st.STextList(main_title, add)
        msg.append(st.SText.newline())
        return msg
Beispiel #12
0
    def _task_detail_description(titles, indent=0):
        # type: (TitleList, int) -> st.STextList
        ind = st.SText.indent(indent)
        space = st.SText.space()
        newline = st.SText.newline()

        task = Task.task_by_title_list(titles.copy())

        r = st.STextList()
        if task.description != '':
            d = st.SText(task.description, color=st.SColor.gray)
            edit = TaskView._task_detail_icon_edit_desc(titles)
            r.append(ind, d, space, edit, newline)
        return r
Beispiel #13
0
def show_fixed_list():
    global global_server
    global global_info
    global data
    server = global_server
    info = global_info
    player = info.player

    load_data()

    flag = 1

    for i in range(0, len(data)):
        if (data[i]["fixed"] == False):
            continue  # 未被修复
        output = st.SText(" - " + data[i]["name"] + "   §7" +
                          data[i]["comment"])
        output.hover_text = st.SText("点击查看任务详细")
        output.set_click_command("!!repair detail " + data[i]["name"])
        st.show_to_player(server, player, output)
        flag = 0

    if (flag):
        server.reply(info, "§c没有已完成的报修!§r")
Beispiel #14
0
def show_detail(name):
    global global_server
    global global_info
    global data
    server = global_server
    info = global_info

    player = info.player

    load_data()

    arr_pos = -1

    for i in range(0, len(data)):
        if data[i]["name"] == name:
            arr_pos = i
            break
    if arr_pos == -1:
        server.reply(info, cant_find_error)  # can not find data
        return

    comment = data[arr_pos]["comment"]
    fixed = data[arr_pos]["fixed"]
    pos_x = data[arr_pos]["pos_x"]
    pos_y = data[arr_pos]["pos_y"]
    pos_z = data[arr_pos]["pos_z"]
    dim = data[arr_pos]["dim"]
    # server.say(data)

    server.reply(info, "名称 : " + name)
    server.reply(info, "注释 : " + comment)
    if dim == 0:
        server.reply(
            info,
            "坐标 : §2主世界§r [x:{} ,y:{} ,z:{}]".format(pos_x, pos_y, pos_z))
    elif dim == -1:
        server.reply(
            info, "坐标 : §4地狱§r [x:{} ,y:{} ,z:{}]".format(pos_x, pos_y, pos_z))
    elif dim == 1:
        server.reply(
            info, "坐标 : §5末地§r [x:{} ,y:{} ,z:{}]".format(pos_x, pos_y, pos_z))

    if fixed:
        server.reply(info, "是否修复 : §2True§r")
    else:
        server.reply(info, "是否修复 : §4False§r")

    delete_btn = st.SText("删除这项报修", color=st.SColor.red)
    delete_btn.styles = [st.SStyle.bold]
    delete_btn.hover_text = st.SText("点击删除")
    command = "!!repair del " + name
    delete_btn.set_click_command(command)
    st.show_to_player(server, player, delete_btn)

    if not fixed:
        fix_btn = st.SText("标记为已维修", color=st.SColor.green)
        fix_btn.styles = [st.SStyle.bold]
        fix_btn.hover_text = st.SText("点击以标记为已维修")
        command = "!!repair fix " + name
        fix_btn.set_click_command(command)
        st.show_to_player(server, player, fix_btn)
    else:
        unfix_btn = st.SText("标记为未维修", color=st.SColor.green)
        unfix_btn.styles = [st.SStyle.bold]
        unfix_btn.hover_text = st.SText("点击以标记为未维修")
        command = "!!repair unfix " + name
        unfix_btn.set_click_command(command)
        st.show_to_player(server, player, unfix_btn)
Beispiel #15
0
 def op_invalid(self):
     msg = st.SText("无效命令, 请用 !!task help 获取帮助")
     self.show(msg)
Beispiel #16
0
 def op_help(self):
     msg = st.SText(help_msg)
     self.show(msg)
Beispiel #17
0
 def task_not_found(title):
     # type: (unicode) -> st.STextList
     m1 = st.SText(text="未找到任务 ")
     m2 = st.SText(text="{t}".format(t=title), color=st.SColor.yellow)
     msg = st.STextList(m1, m2)
     return msg