# Path: cuwo/constants.py
# CLIENT_VERSION = 3
# SERVER_PORT = 12345
# FULL_MASK = 0x0000FFFFFFFFFFFF
# MAX_TIME = 24 * 60 * 60 * 1000
# NORMAL_TIME_SPEED = 10.0
# SLEEP_TIME_SPEED = 100.0
# BLOCK_SCALE = 0x10000
# ZONE_SCALE = BLOCK_SCALE * 256
# REGION_SCALE = ZONE_SCALE * 64
# MISSION_SCALE = REGION_SCALE // 8
# MISSIONS_IN_REGION = 8
# MAX_POS = REGION_SCALE * 1024
# MAX_ZONE = MAX_POS // ZONE_SCALE
# CHUNK_SCALE = ZONE_SCALE
# MAX_CHUNK = MAX_ZONE
# SECTOR_SCALE = REGION_SCALE
# AIR_BLOCK = 0
# SOLID_BLOCK = 1
# WATER_BLOCK = 2
# FLAT_WATER_BLOCK = 3
# HOSTILE_FLAG = 1 << 5
# FRIENDLY_PLAYER_TYPE = 0
# HOSTILE_TYPE = 1
# FRIENDLY_TYPE = 2 # also 4, 5
# NAMED_FRIENDLY_TYPE = 3
# TARGET_TYPE = 6
# CLIMBING_FLAG = 1 << 0
# ATTACKING_FLAG = 1 << 2
# GLIDER_FLAG = 1 << 4
# LANTERN_FLAG = 1 << 9
# STEALTH_FLAG = 1 << 10
# IMMOVABLE_FLAG = 1 << 8
# SOLID_PARTICLE = 0
# BOMB_PARTICLE = 1
# NO_SPREAD_PARTICLE = 2
# NO_ACCELERATION_PARTICLE = 3
# NO_GRAVITY_PARTICLE = 4
# WARRIOR_CLASS = 1
# BERSERKER = 0
# GUARDIAN = 1
# RANGER_CLASS = 2
# SNIPER = 0
# SCOUT = 1
# MAGE_CLASS = 3
# FIRE_MAGE = 0
# WATER_MAGE = 1
# ROGUE_CLASS = 4
# ASSASSIN = 0
# NINJA = 1
# CLASS_NAMES = {
#     WARRIOR_CLASS: 'Warrior',
#     RANGER_CLASS: 'Ranger',
#     MAGE_CLASS: 'Mage',
#     ROGUE_CLASS: 'Rogue'
# }
# CLASS_SPECIALIZATIONS = {
#     WARRIOR_CLASS: {
#         BERSERKER: 'Berserker',
#         GUARDIAN: 'Guardian'
#     },
#     RANGER_CLASS: {
#         SNIPER: 'Sniper',
#         SCOUT: 'Scout'
#     },
#     MAGE_CLASS: {
#         FIRE_MAGE: 'Fire',
#         WATER_MAGE: 'Water'
#     },
#     ROGUE_CLASS: {
#         ASSASSIN: 'Assassin',
#         NINJA: 'Ninja'
#     }
# }
# MATERIAL_NAMES = {
#     1: 'Iron',
#     2: 'Wood',
#     5: 'Obsidian',
#     7: 'Bone',
#     11: 'Gold',
#     12: 'Silver',
#     13: 'Emerald',
#     14: 'Sapphire',
#     15: 'Ruby',
#     16: 'Diamond',
#     17: 'Sandstone',
#     18: 'Saurian',
#     19: 'Parrot',
#     20: 'Mammoth',
#     21: 'Plant',
#     22: 'Ice',
#     23: 'Licht',
#     24: 'Glass',
#     25: 'Silk',
#     26: 'Linen',
#     27: 'Cotton',
#     128: 'Fire',
#     129: 'Unholy',
#     130: 'Ice',
#     131: 'Wind'
# }
# 
# Path: cuwo/exceptions.py
# class InvalidData(Exception):
#     """
#     Raised when invalid data is received
#     """


import sys
import master
import asyncio
import pygeoip
import argparse
import json
import os
import socket
import signal
from cuwo import constants
from cuwo.exceptions import InvalidData
        from cuwo.win32 import WindowsEventLoop
        return info[0][4][0]

    @asyncio.coroutine
    def on_server(self, data, addr):
        host, port = addr
        if data.ip is None:
            data.ip = host
        else:
            use_ip = False
            try:
                ip = yield from self.resolve(data.ip)
                use_ip = ip == host
            except (socket.gaierror, IndexError):
                pass
            if not use_ip:
                data.ip = host
        self.add_server(data, host)

    def add_server(self, data, ip):
        try:
            location = self.ip_database.country_code_by_addr(ip)
        except TypeError:
            location = '?'
        data.location = location
        data.mode = data.mode or 'default'
        self.output[ip] = data.get()

    def on_packet(self, value, addr):
        try:
            value = master.ServerData(value)

# Path: cuwo/constants.py
# CLIENT_VERSION = 3
# SERVER_PORT = 12345
# FULL_MASK = 0x0000FFFFFFFFFFFF
# MAX_TIME = 24 * 60 * 60 * 1000
# NORMAL_TIME_SPEED = 10.0
# SLEEP_TIME_SPEED = 100.0
# BLOCK_SCALE = 0x10000
# ZONE_SCALE = BLOCK_SCALE * 256
# REGION_SCALE = ZONE_SCALE * 64
# MISSION_SCALE = REGION_SCALE // 8
# MISSIONS_IN_REGION = 8
# MAX_POS = REGION_SCALE * 1024
# MAX_ZONE = MAX_POS // ZONE_SCALE
# CHUNK_SCALE = ZONE_SCALE
# MAX_CHUNK = MAX_ZONE
# SECTOR_SCALE = REGION_SCALE
# AIR_BLOCK = 0
# SOLID_BLOCK = 1
# WATER_BLOCK = 2
# FLAT_WATER_BLOCK = 3
# HOSTILE_FLAG = 1 << 5
# FRIENDLY_PLAYER_TYPE = 0
# HOSTILE_TYPE = 1
# FRIENDLY_TYPE = 2 # also 4, 5
# NAMED_FRIENDLY_TYPE = 3
# TARGET_TYPE = 6
# CLIMBING_FLAG = 1 << 0
# ATTACKING_FLAG = 1 << 2
# GLIDER_FLAG = 1 << 4
# LANTERN_FLAG = 1 << 9
# STEALTH_FLAG = 1 << 10
# IMMOVABLE_FLAG = 1 << 8
# SOLID_PARTICLE = 0
# BOMB_PARTICLE = 1
# NO_SPREAD_PARTICLE = 2
# NO_ACCELERATION_PARTICLE = 3
# NO_GRAVITY_PARTICLE = 4
# WARRIOR_CLASS = 1
# BERSERKER = 0
# GUARDIAN = 1
# RANGER_CLASS = 2
# SNIPER = 0
# SCOUT = 1
# MAGE_CLASS = 3
# FIRE_MAGE = 0
# WATER_MAGE = 1
# ROGUE_CLASS = 4
# ASSASSIN = 0
# NINJA = 1
# CLASS_NAMES = {
#     WARRIOR_CLASS: 'Warrior',
#     RANGER_CLASS: 'Ranger',
#     MAGE_CLASS: 'Mage',
#     ROGUE_CLASS: 'Rogue'
# }
# CLASS_SPECIALIZATIONS = {
#     WARRIOR_CLASS: {
#         BERSERKER: 'Berserker',
#         GUARDIAN: 'Guardian'
#     },
#     RANGER_CLASS: {
#         SNIPER: 'Sniper',
#         SCOUT: 'Scout'
#     },
#     MAGE_CLASS: {
#         FIRE_MAGE: 'Fire',
#         WATER_MAGE: 'Water'
#     },
#     ROGUE_CLASS: {
#         ASSASSIN: 'Assassin',
#         NINJA: 'Ninja'
#     }
# }
# MATERIAL_NAMES = {
#     1: 'Iron',
#     2: 'Wood',
#     5: 'Obsidian',
#     7: 'Bone',
#     11: 'Gold',
#     12: 'Silver',
#     13: 'Emerald',
#     14: 'Sapphire',
#     15: 'Ruby',
#     16: 'Diamond',
#     17: 'Sandstone',
#     18: 'Saurian',
#     19: 'Parrot',
#     20: 'Mammoth',
#     21: 'Plant',
#     22: 'Ice',
#     23: 'Licht',
#     24: 'Glass',
#     25: 'Silk',
#     26: 'Linen',
#     27: 'Cotton',
#     128: 'Fire',
#     129: 'Unholy',
#     130: 'Ice',
#     131: 'Wind'
# }
# 
# Path: cuwo/exceptions.py
# class InvalidData(Exception):
#     """
#     Raised when invalid data is received
#     """


# Path: master/server.py
import sys
import master
import asyncio
import pygeoip
import argparse
import json
import os
import socket
import signal
from cuwo import constants
from cuwo.exceptions import InvalidData
        from cuwo.win32 import WindowsEventLoop

        return info[0][4][0]

    @asyncio.coroutine
    def on_server(self, data, addr):
        host, port = addr
        if data.ip is None:
            data.ip = host
        else:
            use_ip = False
            try:
                ip = yield from self.resolve(data.ip)
                use_ip = ip == host
            except (socket.gaierror, IndexError):
                pass
            if not use_ip:
                data.ip = host
        self.add_server(data, host)

    def add_server(self, data, ip):
        try:
            location = self.ip_database.country_code_by_addr(ip)
        except TypeError:
            location = '?'
        data.location = location
        data.mode = data.mode or 'default'
        self.output[ip] = data.get()

    def on_packet(self, value, addr):
        try:
            value = master.ServerData(value)

        except InvalidData: