# Path: omnitool/database.py
# def get_custom_db(txt):
# def parse():
# 
# Path: omnitool/binarysplit.py
# def join(name, delete=False, path=None):
#     with open(name, "wb") as f:
#         for x in range(6):
#             if path:
#                 n = os.path.join(path, str(x) + ".part")
#             else:
#                 n = str(x) + ".part"
#             with open(n, "rb") as d:
#                 f.write(d.read())
#             if delete:
#                 try:
#                     os.remove(n)
#                 except:
#                     pass
# 
# def cleanup():
#     for x in range(6):
#         try:
#             os.remove(str(x) + ".part")
#         except:
#             pass
# 
# Path: plugins/arena_lib/arenaitems.py



import sys
    import os
import pygame
            import os
            import time
            import time
from collections import defaultdict
from pgu import gui
from math import sqrt, cos, sin, pi
from random import *
from os.path import join as osjoin
from omnitool.database import version, tiles, names
from omnitool.tlib import *
from omnitool.tinterface import *
from omnitool.binarysplit import join, cleanup
from .arena_lib.arenaitems import items as arenaitems
        from omnitool.shared import lang, theme, exit_prog, __version__
        from omnitool.pgu_override import Quitbutton

            time.sleep(10)

        for x in range(len(torch_selection)):
            torch_selection[x] = (torch_selection[x][0], torch_selection[x][1] / float(t_weight))
        for x in range(len(selection)):
            selection[x] = (selection[x][0], selection[x][1] / float(weight))
        name = nameinput.value
        chest_mode = itemcount.value
        s = roomsize.value
        chestchance = chestcount.value
        roomwidth = s
        roomheight = s
        rooms = rooms.value
        border = 250
        corridor = corridor.value
        torches = torchcount.value
        size = (rooms * roomwidth + (rooms - 1) * corridor + border * 2,
                rooms * roomheight + (rooms - 1) * corridor + border * 2)
        dtile = choice([41, 43, 44])
        dwall = choice([7, 8, 9])
        if not rooms % 2:
            spawn = (roomwidth // 2 + size[0] // 2, roomheight // 2 + size[1] // 2)
        else:
            spawn = (size[0] // 2, size[1] // 2)
        print("Starting Generation")
        header = {'spawn': spawn, 'groundlevel': -10.0, 'is_bloodmoon': 0,
                  'dungeon_xy': spawn, 'worldrect': (0, size[0] * 16, 0, size[1] * 16),
                  'is_meteor_spawned': 0, 'gob_inv_time': 0, 'rocklevel': size[1] // 2 + 0.4,
                  'gob_inv_x': 0.0, 'is_day': 1, 'shadow_orbs_broken': 0,

# Path: omnitool/database.py
# def get_custom_db(txt):
# def parse():
# 
# Path: omnitool/binarysplit.py
# def join(name, delete=False, path=None):
#     with open(name, "wb") as f:
#         for x in range(6):
#             if path:
#                 n = os.path.join(path, str(x) + ".part")
#             else:
#                 n = str(x) + ".part"
#             with open(n, "rb") as d:
#                 f.write(d.read())
#             if delete:
#                 try:
#                     os.remove(n)
#                 except:
#                     pass
# 
# def cleanup():
#     for x in range(6):
#         try:
#             os.remove(str(x) + ".part")
#         except:
#             pass
# 
# Path: plugins/arena_lib/arenaitems.py



# Path: plugins/arena.py
import sys
    import os
import pygame
            import os
            import time
            import time
from collections import defaultdict
from pgu import gui
from math import sqrt, cos, sin, pi
from random import *
from os.path import join as osjoin
from omnitool.database import version, tiles, names
from omnitool.tlib import *
from omnitool.tinterface import *
from omnitool.binarysplit import join, cleanup
from .arena_lib.arenaitems import items as arenaitems
        from omnitool.shared import lang, theme, exit_prog, __version__
        from omnitool.pgu_override import Quitbutton


            time.sleep(10)

        for x in range(len(torch_selection)):
            torch_selection[x] = (torch_selection[x][0], torch_selection[x][1] / float(t_weight))
        for x in range(len(selection)):
            selection[x] = (selection[x][0], selection[x][1] / float(weight))
        name = nameinput.value
        chest_mode = itemcount.value
        s = roomsize.value
        chestchance = chestcount.value
        roomwidth = s
        roomheight = s
        rooms = rooms.value
        border = 250
        corridor = corridor.value
        torches = torchcount.value
        size = (rooms * roomwidth + (rooms - 1) * corridor + border * 2,
                rooms * roomheight + (rooms - 1) * corridor + border * 2)
        dtile = choice([41, 43, 44])
        dwall = choice([7, 8, 9])
        if not rooms % 2:
            spawn = (roomwidth // 2 + size[0] // 2, roomheight // 2 + size[1] // 2)
        else:
            spawn = (size[0] // 2, size[1] // 2)
        print("Starting Generation")
        header = {'spawn': spawn, 'groundlevel': -10.0, 'is_bloodmoon': 0,
                  'dungeon_xy': spawn, 'worldrect': (0, size[0] * 16, 0, size[1] * 16),
                  'is_meteor_spawned': 0, 'gob_inv_time': 0, 'rocklevel': size[1] // 2 + 0.4,
                  'gob_inv_x': 0.0, 'is_day': 1, 'shadow_orbs_broken': 0,

                  'width': size[0], 'version': version, 'gob_inv_type': 0,