예제 #1
0
from FFxivPythonTrigger import PluginBase, Logger
from aiohttp import web
import asyncio
import traceback

_logger = Logger.Logger("HttpApi")

default_host = "127.0.0.1"
default_port = 2019


class HttpApiPlugin(PluginBase):
    name = "HttpApi"

    def __init__(self):
        super(HttpApiPlugin, self).__init__()
        self.server_config = self.storage.data.setdefault('server', dict())
        self.app = web.Application()
        self.app.add_routes([web.post('/{uri:.*}', self.post_route)])
        self.loop = asyncio.new_event_loop()
        self.routes = dict()
        self.work = False
        self.runner = None

        class temp:
            register_post_route = self.register_post_route
            unregister_post_route = self.unregister_post_route

        self.register_api('HttpApi', temp)

    def register_post_route(self, path, controller):
예제 #2
0
import os
from functools import cache
from ctypes import *

from FFxivPythonTrigger import PluginBase, Logger, memory
from FFxivPythonTrigger.SaintCoinach import realm
from . import ActorTable, CombatData, PlayerInfo, Targets, AddressManager, Movement, Inventory, Party
from . import struct

_logger = Logger.Logger("XivMem")
territory_sheet = realm.game_data.get_sheet('TerritoryType')


@cache
def zone_name(zone_id):
    if not zone_id: return ""
    return territory_sheet[zone_id]['PlaceName']


class XivMemory(object):
    struct = struct
    actor_table = ActorTable.actor_table
    combat_data = CombatData.combat_data
    player_info = PlayerInfo.player_info
    targets = Targets.targets
    movement = Movement.movement
    inventory = Inventory.export
    party = Party.party
    world_id = 0

    @property
예제 #3
0
import socketserver
import os
from FFxivPythonTrigger import PluginBase
from FFxivPythonTrigger import Logger



connection_pool = []

_logger = Logger.Logger("SocketLogger")


def broadcast_msg(msg):
    data = str(msg).encode('utf-8')
    len_data = len(data).to_bytes(4, byteorder="little",signed=True)
    for connection in connection_pool.copy():
        if connection._closed:
            connection_pool.remove(connection)
        else:
            connection.send(len_data)
            connection.send(data)


def close():
    data = (-1).to_bytes(4, byteorder="little",signed=True)
    for connection in connection_pool.copy():
        if connection._closed:
            connection_pool.remove(connection)
        else:
            connection.send(data)