Esempio n. 1
0
 def __init__(self, area, data=None, vnum=None):
     super().__init__()
     self.json_version = Room.FILE_VERSION
     self.json_class_name = Room.CLASS_NAME
     self.capability = ['room']
     self.area = area
     self.builder = None
     if vnum is not None:
         self.vnum = vnum
     else:
         self.vnum = 0
     self.name = "Blank Room"
     self.description = ""
     self.propertyvalue = ""
     self.flags = []
     self.sectortype = []
     self.extradescriptions = {}
     self.exits = {}
     self.contents = []
     self.events = event.Queue(self, "room")
     event.init_events_room(self)
     self.commands = {
         "builder": ("string", None),
         "vnum": ("integer", None),
         "name": ("string", None),
         "description": ("description", None),
         "propertyvalue": ("string", property_values),
         "flags": ("list", room_flags),
         "sectortype": ("list", sector_types),
         "extradescriptions": ("dict", (None, None))
     }
     if data is not None:
         self.load(data)
Esempio n. 2
0
    def __init__(self):
        super().__init__()
        log.info("Instantiating Akrios on port: 5678")
        self.events = event.Queue(self, "server")
        self.create_socket(AF_INET6, SOCK_STREAM)
        self.set_reuse_addr()
        self.bind(("", 5678))
        self.listen(5)

        helpsys.init()
        races.init()
        area.init()

        event.init_events_server(self)

        if grapevine.LIVE:
            log.info("grapevine.LIVE : Creating Grapevine Socket.")
            grapevine.gsocket = grapevine.GrapevineSocket()

            grapevine_connected = grapevine.gsocket.gsocket_connect()
            if not grapevine_connected:
                log.warning("Could not connect to grapevine on startup.")

        log.info("Creating Front End Socket")
        frontend.fesocket = frontend.FESocket()
        frontend_connected = frontend.fesocket.fesocket_connect()
        if not frontend_connected:
            log.warning("Could not connect to front end on startup.")

        log.info(
            f"Akrios is up and running in {time.time() - startup:,.6f} seconds."
        )
Esempio n. 3
0
 def __init__(self, path=None):
     super().__init__()
     self.filename = path
     self.json_version = Player.FILE_VERSION
     self.json_class_name = Player.CLASS_NAME
     self.capability = ['player']
     self.password = ''
     self.lasthost = ''
     self.lasttime = ''
     self.oocflags = {
         'afk': False,
         'viewOLCdetails': False,
         'coding': False,
         'grapevine_channels': ['gossip']
     }
     self.oocflags_stored = {
         'newbie': 'true',
         'grapevine': 'true',
         'ooc': 'true',
         'quote': 'true'
     }
     self.events = event.Queue(self, "player")
     self.sock = None
     self.uuid = ''
     if self.filename is not None:
         self.load()
Esempio n. 4
0
    def __init__(self):
        super().__init__(sockopt=((socket.IPPROTO_TCP, socket.TCP_NODELAY,
                                   1), ))

        self.inbound_frame_buffer = []
        self.outbound_frame_buffer = []

        self.events = event.Queue(self, 'grapevine')

        self.client_id = CLIENT_ID
        self.client_secret = SECRET_KEY
        self.supports = ['channels', 'games', 'players', 'tells']

        # Populate the channels attribute if you want to subscribe to a specific
        # channel or channels during authentication.
        self.channels = ['gossip']
        self.version = '2.3.0'
        self.user_agent = 'AkriosMUD v0.4.5'

        self.state = {'connected': False, 'authenticated': False}

        self.subscribed = {'gossip': True}

        event.init_events_grapevine(self)

        self.sent_refs = {}

        # The below is a cache of players we know about from other games.
        # Right now I just use this to populate additional fields in our in-game 'who' command
        # to also show players logged into other Grapevine connected games.
        self.other_games_players = {}

        # The below is to track the last time we received a heartbeat from Grapevine.
        self.last_heartbeat = 0
Esempio n. 5
0
 def __init__(self, connection, address):
     super().__init__(connection)
     self.owner = None
     self.host = address[0]
     self.inbuf = ""
     self.outbuf = ""
     self.ansi = True
     self.promptable = False
     self.suppressgoahead = False
     self.events = event.Queue(self, "socket")
     event.init_events_socket(self)
Esempio n. 6
0
 def __init__(self, area, data=None, index=True):
     super().__init__()
     self.json_version = Mobile.FILE_VERSION
     self.json_class_name = Mobile.CLASS_NAME
     self.capability = ['mobile']
     self.vnum = 0
     self.keywords = []
     self.area = area
     self.index = index
     self.events = event.Queue(self, "mobile")
     self.commands = {"vnum": ("integer", None), "name": ("string", None)}
     if data is not None:
         self.load(data)
Esempio n. 7
0
    def __init__(self):
        super().__init__(sockopt=((socket.IPPROTO_TCP, socket.TCP_NODELAY, 1),))

        self.inbound_frame_buffer = []
        self.outbound_frame_buffer = []

        self.events = event.Queue(self, 'frontend')

        self.state = {'connected': False,
                      'disconnected': False,
                      'coldboot': False,
                      'unknown': False}

        event.init_events_frontend(self)

        self.last_heartbeat = 0
Esempio n. 8
0
 def __init__(self, area=None, data=None):
     super().__init__()
     self.json_version = Reset.FILE_VERSION
     self.json_class_name = Reset.CLASS_NAME
     self.area = area
     self.aid = str(uuid.uuid4())
     self.mobile_list = {}
     self.object_list = {}
     self.shop_list = {}
     self.events = event.Queue(self, "reset")
     event.init_events_reset(self)
     self.commands = {"target_type": ("string", reset_type),
                      "mobile": ("string", None),
                      "object": ("string", None),
                      "shop": ("string", None)}
     if data is not None:
         self.load(data)
Esempio n. 9
0
    def __init__(self, fpath, path):
        super().__init__()

        self.json_version = Area.FILE_VERSION
        self.json_class_name = Area.CLASS_NAME
        self.folder_path = fpath
        self.area_path = path
        self.name = ''
        self.author = ''
        self.plane = ''
        self.hometown = ''
        self.difficulty = ''
        self.alignment = ''
        self.locationx = 0
        self.locationy = 0
        self.vnumlow = -1
        self.vnumhigh = -1
        self.roomlist = {}
        self.mobilelist = []
        self.mobilelist_index = []
        self.mobilelist_by_vnum = {}
        self.mobilelist_by_vnum_index = {}
        self.objectlist = []
        self.objectlist_index = []
        self.objectlist_by_vnum_index = {}
        self.resetlist = None
        self.playerlist = []
        self.events = event.Queue(self, "area")
        event.init_events_area(self)
        self.commands = {
            'name': ('string', None),
            'author': ('string', None),
            'plane': ('string', planes),
            'hometown': ('string', None),
            'difficulty': ('string', difficulty),
            'alignment': ('string', None),
            'locationx': ('integer', None),
            'locationy': ('integer', None),
            'vnumlow': ('integer', None),
            'vnumhigh': ('integer', None)
        }
        if os.path.exists(self.area_path):
            self.load()
Esempio n. 10
0
 def __init__(self, room, direction_fn=None, data=None):
     super().__init__()
     self.json_version = Exit.FILE_VERSION
     self.json_class_name = Exit.CLASS_NAME
     self.capability = ['exit']
     self.room = room
     if direction_fn is None:
         self.direction = ''
     else:
         self.direction = direction_fn
     self.destination = 0
     self.locked = 'false'
     self.lockdifficulty = 0
     self.keyvnum = 0
     self.magiclocked = 'false'
     self.physicaldifficulty = 0
     self.magiclockdifficulty = 0
     self.casterid = 0
     self.magiclocktype = 'none'
     self.size = 'vast'
     self.hasdoor = 'false'
     self.dooropen = 'true'
     self.keywords = []
     self.events = event.Queue(self, "exit")
     event.init_events_exit(self)
     self.commands = {'direction': ('string', directions),
                      'destination': ('integer', None),
                      'locked': ('string', ['true', 'false']),
                      'lockdifficulty': ('integer', None),
                      'keyvnum': ('integer', None),
                      'magiclocked': ('string', ['true', 'false']),
                      'physicaldifficulty': ('integer', None),
                      'magiclockdifficulty': ('integer', None),
                      'casterid': ('integer', None),
                      'magiclocktype': ('string', None),
                      'size': ('string', exit_sizes),
                      'hasdoor': ('string', ['true', 'false']),
                      'dooropen': ('string', ['true', 'false']),
                      'keywords': ('list', None)}
     if data is not None:
         self.load(data)
Esempio n. 11
0
    def __init__(self, area, data=None, load_type=None):
        super().__init__()
        self.json_version = Object.FILE_VERSION
        self.json_class_name = Object.CLASS_NAME
        self.aid = ''
        self.capability = ['object']
        self.vnum = 0
        self.location = None
        self.name = ''
        self.short_description = ''
        self.long_description = ''
        self.weight = 0
        self.hitpoints = 0
        self.damage = 0
        self.generic_size = ''
        self.primary_type = ''
        self.weapon_type = ''
        self.armor_type = ''
        self.food_type = ''
        self.liquid_type = ''
        self.container_type = ''
        self.material_type = ''
        self.keywords = []
        self.contents = {}
        self.default_wear_loc = "left hand"
        self.allowable_wear_loc = []

        self.wand_data = {}
        self.spellbook_data = {}
        self.key_data = {}
        self.rune_data = {}
        self.scroll_data = {}
        self.craft_tool_data = {}

        self.area = area
        self.events = event.Queue(self, "object")
        self.commands = {
            "vnum": ("integer", None),
            "short_description": ("string", None),
            "long_description": ("string", None),
            "name": ("string", None),
            "weight": ("integer", None),
            "hitpoints": ("integer", None),
            "damage": ("integer", None),
            "generic_size": ("string", generic_size_types),
            "keywords": ("list", None),
            "default_wear_loc": ("string", races.wearlocationslist),
            "allowable_wear_loc": ("list", races.wearlocationslist),
            "primary_type": ("string", primary_types),
            "weapon_type": ("string", weapon_types),
            "armor_type": ("string", armor_types),
            "food_type": ("string", food_types),
            "liquid_type": ("string", liquid_types),
            "container_type": ("string", container_types),
            "material_type": ("string", material_types),
            "wand_data": ("dict", (None, None)),
            "spellbook_data": ("dict", (None, None)),
            "key_data": ("dict", (None, None)),
            "rune_data": ("dict", (None, None)),
            "scroll_data": ("dict", (None, None)),
            "craft_tool_data": ("dict", (None, None))
        }

        if data is not None and load_type is not None:
            self.load(data, load_type)
Esempio n. 12
0
import argparse
import gzip
import logging
import os
import time
import traceback
import urllib.request

import watchdog.events
import watchdog.observers

import config
import event as E

Q = E.Queue()


def should_sync(fpath):
    for ignored in config.ignored_path_patterns:
        if ignored in fpath:
            return False

    return os.path.splitext(fpath.lower())[1] in config.file_types


def send_event(url, event):
    data_json = E.jencode(event).encode("utf8")
    try:
        headers = {
            "Content-Type": "application/json",