예제 #1
0
파일: info.py 프로젝트: NovelLab/stobu
def _record_as_item_info_from(record: InfoRecord) -> str:
    assert isinstance(record, InfoRecord)

    info = assertion.is_instance(record.note, ItemInfo)

    head = info.index
    subject = info.subject
    outline = info.outline
    out_subject = ''

    if ItemInfoType.HAVE is info.type:
        subject = f"({subject})[{outline}]"
    elif ItemInfoType.DISCARD is info.type:
        out_subject = f"({subject})[{outline}]"
        subject = ''
    elif ItemInfoType.NONE is info.type:
        head = subject = outline = out_subject = '----'
    else:
        return None

    _head = just_string_of(str(head), 4)
    _subject = just_string_of(subject, 32)
    _out_subject = just_string_of(out_subject, 32)

    return f"| {_head} | {_subject} | {_out_subject} |"
예제 #2
0
파일: info.py 프로젝트: NovelLab/stobu
def _record_as_stage_info_from(record: InfoRecord) -> str:
    assert isinstance(record, InfoRecord)

    info = assertion.is_instance(record.note, StageInfo)

    head = info.index
    stage = info.stage
    subject = info.subject
    outline = info.outline
    out_subject = ''

    if StageInfoType.DRAW is info.type:
        subject = f"({subject})" if subject else ''
    elif StageInfoType.PUT is info.type:
        subject = f"[{subject}]"
    elif StageInfoType.RID is info.type:
        out_subject = f"[{subject}]"
        subject = ''
    elif StageInfoType.NONE is info.type:
        head = stage = subject = outline = '----'
    else:
        return None

    _head = just_string_of(str(head), 4)
    _stage = just_string_of(stage, 16)
    _subject = just_string_of(subject, 16)
    _outline = just_string_of(outline, 48)
    _out_subject = just_string_of(out_subject, 16)

    return f"| {_head} | {_stage} | {_subject} | {_outline} | {_out_subject} |"
예제 #3
0
파일: info.py 프로젝트: NovelLab/stobu
def _record_as_knowledge_info_from(record: InfoRecord) -> str:
    assert isinstance(record, InfoRecord)

    info = assertion.is_instance(record.note, KnowledgeInfo)

    head = info.index
    subject = info.subject
    outline = info.outline
    old_know = ''

    if KnowledgeInfoType.EXPLAIN is info.type:
        subject = f"{subject}"
        outline = f"※{outline}"
    elif KnowledgeInfoType.KNOW is info.type:
        subject = f"{subject}"
    elif KnowledgeInfoType.KNOWN is info.type:
        subject = f"{subject}"
        old_know = f"({outline})"
        outline = ''
    elif KnowledgeInfoType.REMEMBER is info.type:
        subject = f"{subject}"
        old_know = f"〜{outline}"
        outline = ''
    elif KnowledgeInfoType.NONE is info.type:
        head = subject = outline = old_know = '----'
    else:
        return None

    _head = just_string_of(str(head), 4)
    _subject = just_string_of(subject, 16)
    _outline = just_string_of(outline, 32)
    _old_know = just_string_of(old_know, 32)

    return f"| {_head} | {_subject} | {_outline} | {_old_know} |"
예제 #4
0
파일: info.py 프로젝트: NovelLab/stobu
def _record_as_flag_info_from(record: InfoRecord) -> str:
    assert isinstance(record, InfoRecord)

    info = assertion.is_instance(record.note, FlagInfo)

    head = ''
    subject_a = ''
    flag = ''
    subject_b = ''
    deflag = ''

    if FlagType.FLAG is info.type:
        head = info.index
        subject_a = info.subject
        flag = info.flag
    elif FlagType.DEFLAG is info.type:
        head = info.index
        subject_b = info.subject
        deflag = info.flag
    else:
        head = subject_a = flag = subject_b = deflag = '----'

    _head = just_string_of(str(head), 4)
    _subject_a = just_string_of(subject_a, 16)
    _flag = just_string_of(flag, 32)
    _subject_b = just_string_of(subject_b, 16)
    _deflag = just_string_of(deflag, 32)

    return f"| {_head} | {_subject_a} | {_flag} | {_subject_b} | {_deflag} |"
예제 #5
0
def _record_as_person_state_info_from(record: InfoRecord) -> str:
    assert isinstance(record, InfoRecord)

    info = assertion.is_instance(record.note, PersonStateInfo)

    head = info.index
    subject = info.subject
    outline = info.outline
    skin = state = pinfo = ''

    if PersonStateType.INFO is info.type:
        pinfo = outline
    elif PersonStateType.SKIN is info.type:
        skin = outline
    elif PersonStateType.STATE is info.type:
        state = outline
    elif PersonStateType.NONE is info.type:
        head = skin = state = pinfo = '----'
    else:
        return None

    _head = just_string_of(str(head), 4)
    _subject = just_string_of(subject, 16)
    _skin = just_string_of(skin, 16)
    _state = just_string_of(state, 16)
    _pinfo = just_string_of(pinfo, 32)

    return f"| {_head} | {_subject} | {_skin} | {_state} | {_pinfo} |"
예제 #6
0
def _record_as_stage_state_info_from(record: InfoRecord) -> str:
    assert isinstance(record, InfoRecord)

    info = assertion.is_instance(record.note, StageStateInfo)

    head = info.index
    stage = info.stage
    item = info.outline
    view = ''

    if StageStateType.ITEM is info.type:
        item = info.outline
        view = ''
    elif StageStateType.VIEW is info.type:
        item = ''
        view = info.outline
    elif StageStateType.NONE is info.type:
        head = stage = item = view = '----'
    else:
        return None

    _head = just_string_of(str(head), 4)
    _stage = just_string_of(stage, 16)
    _item = just_string_of(item, 16)
    _view = just_string_of(view, 32)

    return f"| {_head} | {_stage} | {_item} | {_view} |"
예제 #7
0
파일: info.py 프로젝트: NovelLab/stobu
def _record_as_transition_from(record: InfoRecord) -> str:
    assert isinstance(record, InfoRecord)

    info = assertion.is_instance(record.note, SceneInfo)

    camera = just_string_of(info.camera, 16)
    stage = just_string_of(info.stage, 16)
    year = just_string_of(info.year, 8)
    date = just_string_of(info.date, 8)
    time = just_string_of(info.time, 8)

    return f"| {stage} | {time} | {date} | {year} | {camera} |"
예제 #8
0
파일: info.py 프로젝트: NovelLab/stobu
def _record_as_fashion_info_from(record: InfoRecord) -> str:
    assert isinstance(record, InfoRecord)

    info = assertion.is_instance(record.note, FashionInfo)

    head = info.index
    subject = info.subject
    outline = info.outline

    if head < 0:
        head = subject = outline = '----'
    else:
        outline = f"[{outline}]"

    _head = just_string_of(str(head), 4)
    _subject = just_string_of(subject, 16)
    _outline = just_string_of(outline, 32)

    return f"| {_head} | {_subject} | {_outline} |"
예제 #9
0
파일: info.py 프로젝트: NovelLab/stobu
def _record_as_person_info_from(record: InfoRecord) -> str:
    assert isinstance(record, InfoRecord)

    info = assertion.is_instance(record.note, PersonInfo)

    head = info.index
    info_sub = ''
    subject = info.subject
    outline = info.outline

    if PersonInfoType.BE is info.type:
        info_sub = f"[{subject}]"
    elif PersonInfoType.COME is info.type:
        info_sub = f"in {subject}"
    elif PersonInfoType.GO is info.type:
        info_sub = f"out {subject}"
    else:
        head = info_sub = outline = '----'

    _head = just_string_of(str(head), 4)
    _subject = just_string_of(info_sub, 16)
    _outline = just_string_of(outline, 48)

    return f"| {_head} | {_subject} | {_outline} |"
예제 #10
0
파일: struct.py 프로젝트: NovelLab/stobu
def _record_as_action_from(record: StructRecord) -> str:
    assert isinstance(record, StructRecord)

    act = record.act
    subject = record.subject
    outline = record.outline
    indent = get_format_record_as_indent(4)
    indent1 = get_format_record_as_indent(2)

    # persons
    if ActType.BE is act:
        text = f"[{subject}]が{outline}" if outline else f"[{subject}]がいる"
        return f"{indent}{text}"
    elif ActType.COME is act:
        text = f"[{subject}]が{outline}" if outline else f"[{subject}]が来る"
        head = just_string_of('IN', 8)
        return f"{head}{text}"
    elif ActType.GO is act:
        text = f"[{subject}]が{outline}" if outline else f"[{subject}]が出ていく"
        head = just_string_of('OUT', 8)
        return f"{head}{text}"
    # skin
    elif ActType.WEAR is act:
        text = f"{subject}は[{outline}]を着ている"
        return f"{indent}{text}"
    # stage
    elif ActType.PUT is act:
        text = f"<({subject}){outline}>" if subject else f"<{outline}>"
        return f"{indent}{text}"
    elif ActType.RID is act:
        text = f"<〜({subject}){outline}>" if subject else f"<〜{outline}>"
        return f"{indent}{text}"
    # view
    elif ActType.DRAW is act:
        text = f"({subject}について){outline}" if subject else f"{outline}"
        return f"{indent}{text}"
    # info
    elif ActType.EXPLAIN is act:
        text = f"{subject}は{outline}について説明する" if subject else f"{outline}についての説明"
        return f"{indent1}※{text}"
    elif ActType.KNOW is act:
        text = f"{subject}は【{outline}】を知る" if outline else f"【{subject}】を知る"
        return f"{indent1}※{text}"
    elif ActType.KNOWN is act:
        text = f"{subject}は【{outline}】を知っていた" if outline else f"【{subject}】を知っていた"
        return f"{indent1}※{text}"
    elif ActType.REMEMBER is act:
        text = f"{subject}が{outline}を思い出す" if outline else f"{subject}を思い出す"
        return f"{indent1}※{text}"
    # items
    elif ActType.HAVE is act:
        text = f"{subject}は[{outline}]を持っている"
        return f"{indent}{text}"
    elif ActType.DISCARD is act:
        text = f"{subject}が[{outline}]を捨てる"
        return f"{indent}〜{text}"
    # event
    elif ActType.OCCUR is act:
        text = f"【({subject}){outline}】" if subject else f"【{outline}】"
        return f"{indent}{text}"
    # dialogue
    elif ActType.TALK is act:
        return f"{subject}「{outline}」"
    elif ActType.THINK is act:
        text = f"({subject}は{outline}を考える)" if outline else f"({subject}は考え込む)"
        return f"{indent}{text}"
    elif ActType.VOICE is act:
        return f"{subject}『{outline}』"
    # general
    elif ActType.DO is act:
        text = f"{subject}が{outline}" if outline else f"{subject}が行動する"
        return f"{indent}{text}"
    else:
        return ""