# Path: omnitool/database.py
# def get_custom_db(txt):
# def parse():


from struct import unpack, pack, Struct
from .database import items, rev_items, multitiles
import sys
        #return pack("<B", len(data))+pack("<"+len(data)*"s",*data)


def set_double(data):
    return pack("<d", data)


def set_float(data):
    return pack("<f", data)


for name, form, l in formats:
    s = Struct(form)

    def make_local(s, l):
        def generic(f):
            return s.unpack(f.read(l))[0]

        return generic

    globals()["get_g%s" % name] = make_local(s, l)

### Parser end ###


### content parser for .wld structures ###

def get_item(f):
    amount = get_gbyte(f)
    if amount:

# Path: omnitool/database.py
# def get_custom_db(txt):
# def parse():


# Path: omnitool/tlib.py
from struct import unpack, pack, Struct
from .database import items, rev_items, multitiles
import sys

        #return pack("<B", len(data))+pack("<"+len(data)*"s",*data)


def set_double(data):
    return pack("<d", data)


def set_float(data):
    return pack("<f", data)


for name, form, l in formats:
    s = Struct(form)

    def make_local(s, l):
        def generic(f):
            return s.unpack(f.read(l))[0]

        return generic

    globals()["get_g%s" % name] = make_local(s, l)

### Parser end ###


### content parser for .wld structures ###

def get_item(f):
    amount = get_gbyte(f)
    if amount:

        return amount, items[get_int(f)], get_gbyte(f)