コード例 #1
0
ファイル: EQ_Notice.py プロジェクト: tessar9070/PSO2Proxy
 def call_from_client(self, client):
     ship = clients.get_ship_from_port(client.transport.getHost().port) - 1
     if data_eq[ship] and not check_if_EQ_old(ship):
         SMPacket = packetFactory.SystemMessagePacket("[Proxy] Incoming EQ Report from PSO2es: %s" % (msg_eq[ship]), 0x0).build()
     else:
         SMPacket = packetFactory.SystemMessagePacket("[Proxy] No new EQ Report from PSO2es", 0x0).build()
     client.send_crypto_packet(SMPacket)
コード例 #2
0
ファイル: EQ_Notice.py プロジェクト: tessar9070/PSO2Proxy
def notify_and_config(client):
    """
    :type client: ShipProxy.ShipProxy
    """
    client_preferences = clients.connectedClients[client.playerId].preferences
    if not client_preferences.has_preference("eqnotice"):
        client_preferences.set_preference("eqnotice", True)
    ship = clients.get_ship_from_port(client.transport.getHost().port) - 1
    if client_preferences.get_preference('eqnotice') and data_eq[ship] and not check_if_EQ_old(ship):
        SMPacket = packetFactory.SystemMessagePacket("[Proxy] Incoming EQ Report from PSO2es: %s" % (msg_eq[ship]), 0x0).build()
        client.send_crypto_packet(SMPacket)
コード例 #3
0
ファイル: EQ_Alert.py プロジェクト: alama/PSO2Proxy
def notify_and_config(client):
    """
    :type client: ShipProxy.ShipProxy
    """
    client_preferences = clients.connectedClients[client.playerId].preferences
    if not client_preferences.has_preference("eqalert"):
        client_preferences.set_preference("eqalert", True)
    ship = clients.get_ship_from_port(client.transport.getHost().port) - 1
    if not client_preferences.has_preference("eqalert_ship"):
        client_preferences.set_preference("eqalert_ship", 2)  # good default
    if ship == 10:
        ship = client_preferences.get_preference('eqalert_ship') - 1
    else:
        client_preferences.set_preference("eqalert_ship", (ship + 1))  # record the real ship
    if client_preferences.get_preference('eqalert') and not data_eq[ship] == "":
        SMPacket = packetFactory.SystemMessagePacket("[EQ Alert] Incoming EQ Report: %s" % (data_eq[ship]), 0x0).build()
        client.send_crypto_packet(SMPacket)
コード例 #4
0
ファイル: EQ_Alert.py プロジェクト: kennywfl/PSO2Proxy
def notify_and_config(client):
    """
    :type client: ShipProxy.ShipProxy
    """
    client_preferences = clients.connectedClients[client.playerId].preferences
    if not client_preferences.has_preference("eqalert"):
        client_preferences.set_preference("eqalert", True)
    ship = clients.get_ship_from_port(client.transport.getHost().port) - 1
    if not client_preferences.has_preference("eqalert_ship"):
        client_preferences.set_preference("eqalert_ship", 2)  # good default
    if ship == 10:
        ship = client_preferences.get_preference('eqalert_ship') - 1
    else:
        client_preferences.set_preference("eqalert_ship",
                                          (ship + 1))  # record the real ship
    if client_preferences.get_preference(
            'eqalert') and not data_eq[ship] == "":
        SMPacket = packetFactory.SystemMessagePacket(
            "[EQ Alert] Incoming EQ Report: %s" % (data_eq[ship]),
            0x0).build()
        client.send_crypto_packet(SMPacket)
コード例 #5
0
ファイル: EQ_Notice.py プロジェクト: tessar9070/PSO2Proxy
def EQBody(body, ship):  # 0 is ship1
    if not body.strip():
        logdebug("Ship %d: no data" % (ship + 1))
        return
    logdebug("Ship %d's Body: %s" % (ship + 1, body))
    if HTTP_Data[ship] == body:
        logdebug("Ship %d: Still have the same data" % (ship + 1))
        return  # same data, do not react on it
    logdebug("Ship %d: have the new data" % (ship + 1))
    HTTP_Data[ship] = body

    data_eq[ship] = cleanup_EQ(unicode(body, 'utf-8-sig', 'replace'), ship)

    logdebug("Ship %d: %s@%s:%s JST" % (ship + 1, data_eq[ship], hour_eq[ship], mins_eq[ship]))

    logdebug("Time  : %s" % (datetime.utcnow().strftime('%a, %d %b %Y %H:%M:%S GMT')))
    logdebug("Ship %d: %s" % (ship + 1, Modified_Headers[ship]))

    old_eq = check_if_EQ_old(ship)
    if old_eq:
        logdebug("Ship %d EQ is old" % (ship + 1))
        return
    logdebug("Ship %d: EQ is new" % (ship + 1))

    load_eqJP_names()  # Reload file

    print("[EQ Notice] Sending players MSG on Ship %02d : %s" % (ship + 1, msg_eq[ship]))
    SMPacket = packetFactory.SystemMessagePacket("[Proxy] Incoming EQ Report from PSO2es: %s" % (msg_eq[ship]), 0x0).build()
    if useGlobalChat:
        if GlobalChat.ircMode and GlobalChat.ircBot is not None:
            msg = "[EQ Notice Ship %02d] Incoming EQ Report from PSO2es: %s" % (ship + 1, msg_eq[ship])
            GlobalChat.ircBot.send_channel_message(msg.encode('utf-8'))
    for client in clients.connectedClients.values():
        try:
            chandle = client.get_handle()
            if chandle is not None and client.preferences.get_preference('eqnotice') and ((ship + 1) == clients.get_ship_from_port(chandle.transport.getHost().port)):
                chandle.send_crypto_packet(SMPacket)
        except AttributeError:
            logdebug("Ship %d: Got a dead client, skipping" % (ship + 1))