Пример #1
0
 private void Game_OnGameProcessPacket(GamePacketEventArgs args)
 {
     if (!IsActive())
     {
         return;
     }
     try
     {
         var  reader   = new BinaryReader(new MemoryStream(args.PacketData));
         byte packetId = reader.ReadByte(); //PacketId
         if (packetId != Packet.S2C.PlayerDisconnect.Header)
         {
             return;
         }
         Packet.S2C.PlayerDisconnect.Struct disconnect = Packet.S2C.PlayerDisconnect.Decoded(args.PacketData);
         if (disconnect.Player == null)
         {
             return;
         }
         if (_disconnects.ContainsKey(disconnect.Player))
         {
             _disconnects[disconnect.Player] = true;
         }
         else
         {
             _disconnects.Add(disconnect.Player, true);
         }
         if (
             Menu.DisconnectDetector.GetMenuItem("SAwarenessDisconnectDetectorChatChoice")
             .GetValue <StringList>()
             .SelectedIndex == 1)
         {
             Game.PrintChat("Champion " + disconnect.Player.ChampionName + " has disconnected!");
         }
         else if (
             Menu.DisconnectDetector.GetMenuItem("SAwarenessDisconnectDetectorChatChoice")
             .GetValue <StringList>()
             .SelectedIndex == 2 &&
             Menu.GlobalSettings.GetMenuItem("SAwarenessGlobalSettingsServerChatPingActive").GetValue <bool>())
         {
             Game.Say("Champion " + disconnect.Player.ChampionName + " has disconnected!");
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine("DisconnectProcess: " + ex);
     }
 }
Пример #2
0
 private void Game_OnGameProcessPacket(GamePacketEventArgs args)
 {
     if (!IsActive())
     {
         return;
     }
     try
     {
         var  reader   = new BinaryReader(new MemoryStream(args.PacketData));
         byte packetId = reader.ReadByte(); //PacketId
         if (packetId != Packet.S2C.PlayerDisconnect.Header)
         {
             return;
         }
         Packet.S2C.PlayerDisconnect.Struct disconnect = Packet.S2C.PlayerDisconnect.Decoded(args.PacketData);
         if (disconnect.Player == null)
         {
             return;
         }
         if (_disconnects.ContainsKey(disconnect.Player))
         {
             _disconnects[disconnect.Player] = true;
         }
         else
         {
             _disconnects.Add(disconnect.Player, true);
         }
         if (
             DisReconnectDetector.GetMenuItem("SAssembliesDetectorsDisReconnectChatChoice")
             .GetValue <StringList>()
             .SelectedIndex == 1)
         {
             Game.PrintChat("Champion " + disconnect.Player.ChampionName + " has disconnected!");
         }
         else if (
             DisReconnectDetector.GetMenuItem("SAssembliesDetectorsDisReconnectChatChoice")
             .GetValue <StringList>()
             .SelectedIndex == 2 &&
             Menu.GlobalSettings.GetMenuItem("SAssembliesGlobalSettingsServerChatPingActive").GetValue <bool>())
         {
             Game.Say("Champion " + disconnect.Player.ChampionName + " has disconnected!");
         }
         if (DisReconnectDetector.GetMenuItem("SAssembliesDetectorsDisReconnectSpeech").GetValue <bool>())
         {
             Speech.Speak("Champion " + disconnect.Player.ChampionName + " has disconnected!");
         }
         if (DisReconnectDetector.GetMenuItem("SAssembliesDetectorsDisReconnectNotification").GetValue <bool>())
         {
             Common.ShowNotification("Champion " + disconnect.Player.ChampionName + " has disconnected!", Color.LawnGreen, 3);
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine("DisconnectProcess: " + ex);
     }
     try
     {
         var  reader   = new BinaryReader(new MemoryStream(args.PacketData));
         byte packetId = reader.ReadByte(); //PacketId
         if (packetId != Packet.S2C.PlayerReconnected.Header)
         {
             return;
         }
         Packet.S2C.PlayerReconnected.Struct reconnect = Packet.S2C.PlayerReconnected.Decoded(args.PacketData);
         if (reconnect.Player == null)
         {
             return;
         }
         if (_reconnects.ContainsKey(reconnect.Player))
         {
             _reconnects[reconnect.Player] = true;
         }
         else
         {
             _reconnects.Add(reconnect.Player, true);
         }
         if (
             DisReconnectDetector.GetMenuItem("SAssembliesDetectorsDisReconnectChatChoice")
             .GetValue <StringList>()
             .SelectedIndex == 1)
         {
             Game.PrintChat("Champion " + reconnect.Player.ChampionName + " has reconnected!");
         }
         else if (
             DisReconnectDetector.GetMenuItem("SAssembliesDetectorsDisReconnectChatChoice")
             .GetValue <StringList>()
             .SelectedIndex == 2 &&
             Menu.GlobalSettings.GetMenuItem("SAssembliesGlobalSettingsServerChatPingActive").GetValue <bool>())
         {
             Game.Say("Champion " + reconnect.Player.ChampionName + " has reconnected!");
         }
         if (DisReconnectDetector.GetMenuItem("SAssembliesDetectorsDisReconnectSpeech").GetValue <bool>())
         {
             Speech.Speak("Champion " + reconnect.Player.ChampionName + " has reconnected!");
         }
         if (DisReconnectDetector.GetMenuItem("SAssembliesDetectorsDisReconnectNotification").GetValue <bool>())
         {
             Common.ShowNotification("Champion " + reconnect.Player.ChampionName + " has reconnected!", Color.Yellow, 3);
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine("ReconnectProcess: " + ex);
     }
 }