예제 #1
0
파일: common.py 프로젝트: sujubaima/gmproj
def item_menu(ctrl):
    smenu = []
    for itm, person, valid in ctrl.items:
        suffix_list = []
        if len(ctrl.persons) > 1:
            suffix_list.append("持有人:%s" %
                               ui.colored(person.name, attrs=["bold"]))
        if "Equip" in itm.tags:
            suffix_list.append("数量:1,耐久度:%s/%s" %
                               (itm.durability_current, itm.durability))
        else:
            suffix_list.append("数量:%s" % person.quantities[itm.tpl_id])
        if ctrl.showmoney and itm.tpl_id != "ITEM_MONEY":
            if ctrl.moneystyle == 0:
                money_num = itm.money
            else:
                money_num = int(itm.money * 0.4)
            suffix_list.append("价值:%s" % ui.byellow(money_num))
        if itm in person.equipment:
            suffix_list.append(ui.colored("装备中", color="green"))
        suffix = "(%s)" % ",".join(suffix_list)
        if not valid:
            mitem = ui.menuitem(itm.name + ui.bgrey(suffix),
                                value=(itm, person),
                                validator=lambda x: False)
        else:
            comments = ui.item(itm)
            mitem = ui.menuitem(ui.rank(itm) + suffix,
                                comments=comments,
                                value=(itm, person),
                                goto=ctrl.select)
        smenu.append(mitem)
    return smenu
예제 #2
0
파일: team.py 프로젝트: sujubaima/gmproj
def handler_team_control(ctrl):
    title = ui.byellow("当前队伍:%s队" % ctrl.team.leader.name)
    ui.menu(team_menu(ctrl),
            title=title,
            columns=2,
            width=15,
            goback=True,
            backmethod=ctrl.close)
예제 #3
0
파일: scene.py 프로젝트: sujubaima/gmproj
def handler_explore_tool_select_control(ctrl):
    i_menu = item_menu(ctrl)
    i_menu.insert(
        0, ui.menuitem("徒手", value=(None, ctrl.team.leader), goto=ctrl.select))
    ui.menu(i_menu,
            title=ui.byellow(ctrl.title),
            goback=True,
            backmethod=ctrl.close)
예제 #4
0
def handler_equip_control(ctrl):
    panel = ["", ui.byellow("装备一览:%s" % ctrl.person.name), ""]
    panel.extend(equipment(ctrl.person))
    ui.menu(equip_menu(ctrl),
            title="请选择你要进行的操作:",
            uppanel=panel,
            columns=2,
            width=19,
            goback=True,
            backmethod=ctrl.close)
예제 #5
0
파일: common.py 프로젝트: sujubaima/gmproj
def handler_person_select_control(ctrl):
    person_menu = []
    for c in ctrl.candidates:
        person_menu.append(ui.menuitem(c.name, value=c, goto=ctrl.select))
    if len(person_menu) == 1 and ctrl.canskip:
        ctrl.select(person_menu[0].value)
    else:
        ret = ui.menu(person_menu,
                      title=ui.byellow(ctrl.title),
                      goback=True,
                      backmethod=ctrl.close)
예제 #6
0
def handler_skill_control(ctrl):
    panel = ["", ui.byellow("技能一览:%s" % ctrl.person.name), ""]
    panel.extend(skill_equipped(ctrl))
    ui.menu(skill_equip_menu(ctrl),
            title="请选择你要进行的操作:",
            uppanel=panel,
            keylist=[chr(i) for i in range(ord('a'),
                                           ord('a') + 26)],
            pagesize=26,
            columns=2,
            width=23,
            goback=True,
            backmethod=ctrl.close)
예제 #7
0
파일: common.py 프로젝트: sujubaima/gmproj
def handler_person_select_multiple_control(ctrl):
    person_menu = []
    for c in ctrl.candidates:
        person_menu.append(ui.menuitem(c.name, value=c, goto=ctrl.select))
    if len(person_menu) == 1:
        ret = [person_menu[0].value]
    else:
        ret = ui.menu(person_menu,
                      title=ui.byellow(ctrl.title),
                      goback=True,
                      backmethod=ctrl.close,
                      multiple=True,
                      multiple_range=[1, ctrl.max_number])
    ctrl.select(ret)
예제 #8
0
파일: scene.py 프로젝트: sujubaima/gmproj
def world_menu(ctrl):
    title = ui.byellow("队员一览:%s队" % ctrl.team.leader.name)
    ret = [
        ui.menuitem("移动", goto=ctrl.move),
        ui.menuitem("交谈", goto=ctrl.talk),
        #ui.menuitem("赠与"),
        ui.menuitem("探索", goto=ctrl.explore),
        #ui.menuitem("建设"),
        ui.menuitem("攻击", goto=ctrl.attack),
        ui.menuitem("休息", goto=ctrl.rest),
        ui.menuitem("地图", goto=ctrl.thumbnail),
        ui.menuitem("队伍", goto=ctrl.teaminfo),
        ui.menuitem("系统", goto=ctrl.system)
    ]
    return ret
예제 #9
0
파일: common.py 프로젝트: sujubaima/gmproj
def recipe_menu(ctrl):
    str_list = [
        "一",
        "二",
        "三",
        "四",
        "五",
        "六",
        "七",
        "八",
        "九",
    ]
    rmenu = []
    for idx, ownerrecipe in enumerate(ctrl.recipes):
        owner, recipe = ownerrecipe
        enabled = recipe.check(ctrl.persons)
        if len(recipe.materials) == 0:
            comments = ["无"]
        else:
            comments = [",".join(["任意%s" % ui.tag(k) if isinstance(k, str) else ui.rank(k, grey=not enabled) +
                                   ui.colored("×%s" % v, color=None if enabled else "grey", attrs=None if enabled else ["bold"]) \
                                   for k, v in recipe.materials])]
        showword = ("方案%s" % str_list[idx]) if ctrl.sub else recipe.name
        suffix = []
        if enabled:
            if not ctrl.sub:
                suffix.append("持有人:%s" % owner.name)
            if owner not in ctrl.persons:
                suffix.append(
                    "费用:%s" %
                    ui.byellow(str(25 + recipe.tmpdict.get("money", 0))))
            if len(suffix) > 0:
                showword += "(%s)" % ",".join(suffix)
            mitem = ui.menuitem(showword,
                                value=(owner, recipe),
                                comments=comments,
                                goto=ctrl.select)
        else:
            mitem = ui.menuitem(showword + "(材料不足)",
                                comments=comments,
                                validator=lambda x: False)
        rmenu.append(mitem)
    return rmenu
예제 #10
0
파일: common.py 프로젝트: sujubaima/gmproj
def handler_recipe_select_control(ctrl):
    ui.menu(recipe_menu(ctrl),
            title=ui.byellow(ctrl.title),
            goback=True,
            backmethod=ctrl.close)
예제 #11
0
파일: common.py 프로젝트: sujubaima/gmproj
def handler_item_select_control(ctrl):
    ui.menu(item_menu(ctrl),
            title=ui.byellow(ctrl.title),
            macros=ctrl.macs,
            goback=True,
            backmethod=ctrl.close)
예제 #12
0
파일: common.py 프로젝트: sujubaima/gmproj
def handler_ensure_control(ctrl):
    ret = ui.sure(ui.byellow(ctrl.text))
    ctrl.input(ret)
예제 #13
0
파일: common.py 프로젝트: sujubaima/gmproj
def person_status(ctrl):
    p = ctrl.person
    pf = []
    pf.append("【基本情况】")
    pf.append("")
    pf.append("  " + ui.fixed(18, n="气血:%s/%s" % (p.hp, p.hp_limit)))
    pf.append("  " + ui.fixed(18, n="内力:%s/%s" % (p.mp, p.mp_limit)))
    pf.append("")
    pf.append("  " + ui.fixed(18, n="外伤:" + ui.colored(str(p.injury), color=None if p.injury == 0 else "red")) + \
                     ui.fixed(18, n="内伤:" + ui.colored(str(p.wound), color=None if p.wound == 0 else "red")))
    pf.append("  " + ui.fixed(18, n="风毒:%s" % p.poison_hp) + \
                     ui.fixed(18, n="瘀毒:%s" % p.poison_mp))
    pf.append("  " + ui.fixed(18, n="饥饿:%s" % p.hunger) + \
                     ui.fixed(18, n="疲劳:%s" % p.fatigue))
    pf.append("")
    pf.append("")
    pf.append("【人物特质】")
    pf.append("")
    pf.append("  " + ui.fixed(18, n="灵动:" + ui.colored("%s%%" % (50 + p.dongjing), color=digitcolor(p.dongjing))) + \
                     ui.fixed(18, n="沉静:" + ui.colored("%s%%" % (50 - p.dongjing), color=digitcolor(-1 * p.dongjing))))
    pf.append("  " + ui.fixed(18, n="刚猛:" + ui.colored("%s%%" % (50 + p.gangrou), color=digitcolor(p.gangrou))) + \
                     ui.fixed(18, n="柔易:" + ui.colored("%s%%" % (50 - p.gangrou), color=digitcolor(-1 * p.gangrou))))
    pf.append("  " + ui.fixed(18, n="颖悟:" + ui.colored("%s%%" % (50 + p.zhipu), color=digitcolor(p.zhipu))) + \
                     ui.fixed(18, n="朴拙:" + ui.colored("%s%%" % (50 - p.zhipu), color=digitcolor(-1 * p.zhipu))))
    pf.append("")
    pf.append("  " + ui.fixed(18, n="内功阴性:" + ui.colored("%s%%" % (50 - p.yinyang), color="cyan")) + \
                     ui.fixed(18, n="内功阳性:" + ui.colored("%s%%" % (50 + p.yinyang), color="yellow")))
    pf.append("")
    pf.append("【武学能力】")
    pf.append("")
    pf.append("  " + ui.fixed(18, n="内功:%s" % p.neigong))
    pf.append("")
    pf.append("  " + ui.fixed(18, n="内功:%s" % p.neigong))
    pf.append("  " + ui.fixed(18, n="搏击:%s" % p.boji) +
              ui.fixed(15, n="剑法:%s" % p.jianfa))
    pf.append("  " + ui.fixed(18, n="刀法:%s" % p.daofa) +
              ui.fixed(15, n="长兵:%s" % p.changbing))
    pf.append("  " + ui.fixed(18, n="暗器:%s" % p.anqi) +
              ui.fixed(15, n="奇门:%s" % p.qimen))
    pf.append("")
    pf.append("【战斗数据】")
    pf.append("")
    pf.append("  " + ui.fixed(18, n="攻击力:%s" % p.attack) +
              ui.fixed(15, n="防御力:%s" % p.defense))
    pf.append("  " + ui.fixed(18, n="移动力:%s" % p.motion) +
              ui.fixed(15, n="速度:%s" % p.speed))
    pf.append("  " + ui.fixed(18, n="时序值:%s" % p.process))
    pf.append("")
    pf.append("  " + ui.fixed(18, n="命中率:" + ui.colored("%s%%" % int(p.hit_rate * 100), color=attrcolor(p, "hit_rate"))) + \
                     ui.fixed(18, n="闪避率:" + ui.colored("%s%%" % int(p.dodge_rate * 100), color=attrcolor(p, "dodge_rate"))))
    pf.append("  " + ui.fixed(18, n="暴击率:" + ui.colored("%s%%" % int(p.critical_rate * 100), color=attrcolor(p, "critical_rate"))) + \
                     ui.fixed(18, n="暴伤率:" + ui.colored("%s%%" % int(p.critical_damage * 100), color=attrcolor(p, "critical_damage"))))
    pf.append("  " + ui.fixed(18, n="拆招率:" + ui.colored("%s%%" % int(p.anti_damage_rate * 100), color=attrcolor(p, "anti_damage_rate"))) + \
                     ui.fixed(18, n="减伤率:" + ui.colored("%s%%" % int((1 - p.anti_damage) * 100), color=attrcolor(p, "anti_damage"))))
    pf.append("  " + ui.fixed(18,
                              n="反击率:" +
                              ui.colored("%s%%" % int(p.counter_rate * 100),
                                         color=attrcolor(p, "counter_rate"))))
    pf.append("")

    af = []
    af.append("【当前装备】")
    af.append("")
    af.extend(equipment(p))
    af.append("")
    af.append("【当前状态】")
    af.append("")
    sts_count = 0
    for sts in p.status:
        if sts.name is not None:
            af.append("  " + ui.status(sts))
            sts_count += 1
    if sts_count == 0:
        af.append("  无")
    af.append("")
    af.extend(skills(p))
    af.append("")
    ui.pages([pf, af],
             title=ui.byellow("%s %s%s" % (p.title, p.firstname, p.lastname)),
             goback=True,
             backmethod=ctrl.close)