# Path: omnitool/loadbar.py
# class Bar():
#     def __init__(self, size = (500,20), caption = "Loading:", bg = pygame.Color("black"), fg = pygame.Color("grey"),
#                  abortable = True):
# 
#         pygame.display.init()#
#         self.abortable = abortable
#         self.size = size
#         pygame.display.set_caption(caption)
#         self.basecaption = caption
#         self.surface = pygame.display.set_mode(size)
#         self.rect = pygame.Rect((0,0), (0, self.size[1]))
#         self.fg = fg
#         self.bg = bg
#         self.scale = self.size[0]/100
#         self.set_progress(0)
# 
#     def set_progress(self, percent, caption = ""):
#         for event in pygame.event.get():
#             if event.type == 12 and self.abortable:
#                 pygame.quit()
#                 import sys
#                 sys.exit()
#         if caption:
#             pygame.display.set_caption(caption)
#         self.progress = percent
#         self.surface.fill(self.bg)
#         self.rect.width = self.progress*self.scale
#         pygame.gfxdraw.box(self.surface, self.rect, self.fg)
#         pygame.display.update(self.rect)
# 
# Path: omnitool/database.py
# def get_custom_db(txt):
# def parse():
# 
# Path: plugins/planetoids_lib/terragui.py
# def run(main=None):


import sys
    import os
import pygame
            import os
                import time
from math import cos, sin, pi
from collections import defaultdict
from random import *
from omnitool.loadbar import Bar
from omnitool.database import itemlist, names, tiles, ntiles
from omnitool.tinterface import *
from .planetoids_lib import terragui
from .planetoids_lib.tree import make_tree
from .planetoids_lib.terradata import *
        self.header = header

        z = header["width"] * header["height"]  #tileamount
        total = z

        #list of tiles : walls
        walls = defaultdict(lambda: None, {0: 2,
                                           25: 3,
                                           9: 11,
                                           8: 10,
                                           7: 12,
                                           30: 4,
                                           58: 13,
                                           21: 2,
                                           31: 3,
                                           51: 62,#cobweb gets spider nest wall
                                           40: 6,
                                           })

        def count(checks):
            c = {}
            for t_id in checks:
                c[t_id] = 0
            for x in range(size[0]):
                for y in range(size[1]):
                    tid = surface.get_at((x, y))[0]
                    if tid in c:
                        c[tid] += 1
            for tid in c:
                amount = c[tid]

# Path: omnitool/loadbar.py
# class Bar():
#     def __init__(self, size = (500,20), caption = "Loading:", bg = pygame.Color("black"), fg = pygame.Color("grey"),
#                  abortable = True):
# 
#         pygame.display.init()#
#         self.abortable = abortable
#         self.size = size
#         pygame.display.set_caption(caption)
#         self.basecaption = caption
#         self.surface = pygame.display.set_mode(size)
#         self.rect = pygame.Rect((0,0), (0, self.size[1]))
#         self.fg = fg
#         self.bg = bg
#         self.scale = self.size[0]/100
#         self.set_progress(0)
# 
#     def set_progress(self, percent, caption = ""):
#         for event in pygame.event.get():
#             if event.type == 12 and self.abortable:
#                 pygame.quit()
#                 import sys
#                 sys.exit()
#         if caption:
#             pygame.display.set_caption(caption)
#         self.progress = percent
#         self.surface.fill(self.bg)
#         self.rect.width = self.progress*self.scale
#         pygame.gfxdraw.box(self.surface, self.rect, self.fg)
#         pygame.display.update(self.rect)
# 
# Path: omnitool/database.py
# def get_custom_db(txt):
# def parse():
# 
# Path: plugins/planetoids_lib/terragui.py
# def run(main=None):


# Path: plugins/planetoids.py
import sys
    import os
import pygame
            import os
                import time
from math import cos, sin, pi
from collections import defaultdict
from random import *
from omnitool.loadbar import Bar
from omnitool.database import itemlist, names, tiles, ntiles
from omnitool.tinterface import *
from .planetoids_lib import terragui
from .planetoids_lib.tree import make_tree
from .planetoids_lib.terradata import *

        self.header = header

        z = header["width"] * header["height"]  #tileamount
        total = z

        #list of tiles : walls
        walls = defaultdict(lambda: None, {0: 2,
                                           25: 3,
                                           9: 11,
                                           8: 10,
                                           7: 12,
                                           30: 4,
                                           58: 13,
                                           21: 2,
                                           31: 3,
                                           51: 62,#cobweb gets spider nest wall
                                           40: 6,
                                           })

        def count(checks):
            c = {}
            for t_id in checks:
                c[t_id] = 0
            for x in range(size[0]):
                for y in range(size[1]):
                    tid = surface.get_at((x, y))[0]
                    if tid in c:
                        c[tid] += 1
            for tid in c:
                amount = c[tid]

                print("%-10s : %d" % (tiles[tid], amount))