コード例 #1
0
ファイル: data.py プロジェクト: btdevel/bt
def load_item_data(bt_path):
    ba = btfile.load_file_cached(memdump, bt_path)
    num = 128

    start = ba.find('\x00\xFF\xFF\x8E\x9E') + num
    def get_values(start_ind):
        return ba[start_ind + 1:start_ind + num]

    effects = get_values(start)
    print list(effects)

    equip = get_values(start-num)
    print list(equip)

    special = get_values(start-2*num)
    print list(special)

    acbonus = get_values(start-3*num)
    print list(acbonus)

    basdam = get_values(start-4*num)
    print list(basdam)


    names = load_item_names(bt_path)

    assert names[0] == "Torch"
    assert names[-1] == "Spectre Snare"

    class Item(object):
        def __init__(self, name, effects, equip, special, ac, bonus,):
            pass



    types = load_itemtype_names(bt_path)
    items = []
    for i in xrange(0*num - 1):
        type = special[i] & 0x0F
        spec_attack = (special[i] & 0xF0) >> 4
        effect = effects[i]
        num_dice = (basdam[i] & 0x0F) + 1
        dice_sides = [4, 6, 8, 12, 16][(basdam[i] & 0xF0) >> 4]
        print "(%02x) %s: %s, dam=%dd%d " % (i, names[i], types[type], num_dice, dice_sides)
コード例 #2
0
ファイル: data.py プロジェクト: btdevel/bt
def load_strings_by_identifier(bt_path, identifier, num):
    ba = btfile.load_file_cached(msdos_executable, bt_path)
    return btdata.get_string_data(ba, identifier, num)