Пример #1
0
 public static bool Orb_Command_Chat_Spam_Method(Server.NetObject NetObj, CommandReader Command)
 {
     #region Spam
     if (NetObj.UserObject.Muted)
     {
         NetObj.UserObject.MuteNotifier();
         return(false);
     }
     if (NetObj.UserObject.Can(Database.PermissionDB.Strings.Say))
     {
         Network.Packets.Type32_ChatMessage SpamThis = new Network.Packets.Type32_ChatMessage();
         SpamThis.Message = Command._CmdRawArguments;
         Network.Packet ThisPacket = SpamThis.Serialise();
         Logger.Console.WriteLine(NetObj.UserObject.DisplayedName + "&b(Spam)&f: " + Command._CmdRawArguments);
         for (int i = 0; i < 10; i++)
         {
             Server.AllClients.Except(Server.OrbConsole).Send(ThisPacket);
         }
         return(true);
     }
     else
     {
         NetObj.ClientObject.SendMessage("You do not have enough permission to \"Spam\".");
         return(false);
     }
     #endregion
 }
Пример #2
0
 public void Process_Type13_RemoveAircraft(Network.Packet Packet)
 {
     Network.Packets.Type13_RemoveAircraft ThisPacket = new Network.Packets.Type13_RemoveAircraft(Packet);
     //ThisPacket.PrintDebugInfo();
     //Parent.HostObject.Send(Packet);
     Parent.HostObject.Send(ThisPacket.Serialise());
 }
 public void Process_Type16_PrepareSimulation(Network.Packet Packet)
 {
     Network.Packets.Type16_PrepareSimulation ThisPacket = new Network.Packets.Type16_PrepareSimulation(Packet);
     //ThisPacket.PrintDebugInfo();
     //Parent.HostObject.Send(Packet);
     Parent.HostObject.Send(ThisPacket.Serialise());
 }
Пример #4
0
                public void Process_Type05_EntityJoined(Network.Packet Packet)
                {
                    Network.Packets.Process_Type05_EntityJoined ThisPacket = new Network.Packets.Process_Type05_EntityJoined(Packet);
                    if (ThisPacket.OwnerName != "" && Parent.Username.StartsWith(ThisPacket.OwnerName))
                    {
                        //Parent.VehicleID = ThisPacket.ID;
                        Parent.Vehicle.ID   = ThisPacket.ID;
                        Parent.Vehicle.Name = ThisPacket.ObjectName;
                        Parent.Vehicle.IFF  = ThisPacket.IFF;
                        Parent.Vehicle.Type = ThisPacket.ObjectType;

                        Parent.Vehicle.PosX = ThisPacket.InitialPosX; //East/West
                        Parent.Vehicle.PosY = ThisPacket.InitialPosY; //Altitude
                        Parent.Vehicle.PosZ = ThisPacket.InitialPosZ; //North/South
                        Parent.Vehicle.HdgX = ThisPacket.InitialRotX; //Heading
                        Parent.Vehicle.HdgY = ThisPacket.InitialRotY; //Pitch
                        Parent.Vehicle.HdgZ = ThisPacket.InitialRotZ; //Roll

                        //ThisPacket.InitialRotZ = (float)(ThisPacket.InitialRotZ + (-90).ToRadians());
                        //ThisPacket.InitialPosY = 3000;

                        Parent.UserObject.FlightsFlown++;
                        Server.Vehicles.Add(Parent.Vehicle);
                        Parent.UserObject.Save(Database.UserDB.Strings.FlightsFlown);
                        Server.AllClients.SendMessage(Parent.Username + " took off (" + ThisPacket.ObjectName + ")");
                    }
                    else
                    {
                        Server.NetObject Owner = null;
                    }
                    Parent.ClientObject.Send(ThisPacket.Serialise());
                }
Пример #5
0
                public Network.Packet Serialise()
                {
                    Network.Packet OutPack = new Network.Packet();
                    OutPack.Type  = Type;
                    OutPack.Data  = BitConverter.GetBytes(TimeStamp).ToDataString();
                    OutPack.Data += BitConverter.GetBytes(ID).ToDataString();
                    OutPack.Data += BitConverter.GetBytes(Version).ToDataString();
                    switch (Version)
                    {
                    case 3:
                        OutPack.Data = Data.ToDataString();
                        break;

                    case 4:
                        OutPack       = Serialise_Type5(OutPack);
                        OutPack.Data += ((byte)(((int)Anim_ThrustVector.ToTens()) + ((int)Anim_ThrustReverse))).ToByteArray().ToDataString();
                        OutPack.Data += Anim_BombBay.ToByteArray().ToDataString();
                        OutPack.Data += "\0";
                        break;

                    case 5:
                        OutPack       = Serialise_Type5(OutPack);
                        OutPack.Data += "\0";
                        break;
                    }
                    return(OutPack);
                }
Пример #6
0
 public void Process_Type39_AllowUnguided(Network.Packet Packet)
 {
     Network.Packets.Type39_AllowUnguided ThisPacket = new Network.Packets.Type39_AllowUnguided(Packet);
     ThisPacket.Allowed = true;
     //Parent.ClientObject.Send(ThisPacket.Serialise());
     Parent.ClientObject.Send(Packet);
 }
Пример #7
0
 public void Process_Type41_ShowUsername(Network.Packet Packet)
 {
     Network.Packets.Type41_ShowUsername ThisPacket = new Network.Packets.Type41_ShowUsername(Packet);
     ThisPacket.Distance = 1;
     Parent.ClientObject.Send(ThisPacket.Serialise());
     //Parent.ClientObject.Send(Packet);
 }
Пример #8
0
 public void Process_Type31_AllowMissiles(Network.Packet Packet)
 {
     Network.Packets.Type31_AllowMissiles ThisPacket = new Network.Packets.Type31_AllowMissiles(Packet);
     ThisPacket.Allowed = true;
     //Parent.ClientObject.Send(ThisPacket.Serialise());
     Parent.ClientObject.Send(Packet);
 }
Пример #9
0
 public void Process_Type22_Damage(Network.Packet Packet)
 {
     Network.Packets.Type22_Damage ThisPacket = new Network.Packets.Type22_Damage(Packet);
     //ThisPacket.Damage = 0;
     //ThisPacket.Weapon = 3;
     //ThisPacket.PrintDebugInfo();
     Parent.ClientObject.Send(ThisPacket.Serialise());
 }
Пример #10
0
                public Network.Packet Serialise()
                {
                    Network.Packet outpack = new Network.Packet();
                    string         outdata = "";

                    outdata     += BitConverter.GetBytes(Allowed.ToUint()).ToDataString();
                    outpack.Data = outdata;
                    return(outpack);
                }
Пример #11
0
 public void Process_Type01_Login(Network.Packet Packet)
 {
     Network.Packets.Type01_Login ThisPacket = new Network.Packets.Type01_Login(Packet);
     Server.Login.Handle(Parent, ThisPacket);
     Network.Packet OutPacket = new Network.Packet();
     OutPacket.Type = 100;
     OutPacket.RecalcSize();
     Parent.HostObject.Send(OutPacket);
 }
Пример #12
0
                internal Network.Packet Serialise()
                {
                    Network.Packet outpack = new Network.Packet();
                    string         outdata = "";

                    outdata     += BitConverter.GetBytes(Version).ToDataString();
                    outpack.Data = outdata;
                    outpack.Type = Type;
                    return(outpack);
                }
Пример #13
0
                public Network.Packet Serialise()
                {
                    Network.Packet outpack = new Network.Packet();
                    string         outdata = "";

                    outdata     += BitConverter.GetBytes(Distance).ToDataString();
                    outpack.Data = outdata;
                    outpack.Type = Type;
                    return(outpack);
                }
Пример #14
0
                internal Network.Packet Serialise()
                {
                    Network.Packet outpack = new Network.Packet();
                    string         outdata = "";

                    outdata     += MapName + new string('\0', 15 - MapName.Length);
                    outpack.Data = outdata;
                    outpack.Type = Type;
                    return(outpack);
                }
Пример #15
0
                internal Network.Packet Serialise()
                {
                    Network.Packet outpack = new Network.Packet();
                    string         outdata = "";

                    outdata      = new string('\0', 8);
                    outdata     += Message;
                    outdata     += '\0';
                    outpack.Data = outdata;
                    outpack.Type = Type;
                    return(outpack);
                }
Пример #16
0
                public void Process_Type32_ChatMessage(Network.Packet Packet)
                {
                    Network.Packets.Type32_ChatMessage ThisPacket = new Network.Packets.Type32_ChatMessage(Packet);
                    string EditMessage = ThisPacket.Message.Remove(0, 1);

                    EditMessage = EditMessage.Remove(0, Parent.Username.Length);
                    EditMessage = EditMessage.Remove(0, 1);
                    Thread CommandHandle = new Thread(() => CommandManager.Process(this.Parent, EditMessage));

                    CommandHandle.Start();
                    return;
                }
Пример #17
0
 public void Process_Type33_Weather(Network.Packet Packet)
 {
     if (Packet.Size != 4)
     { //This is not a weather request packet, we need to get its data.
         Network.Packets.Type33_Weather ThisPacket = new Network.Packets.Type33_Weather(Packet);
         Parent.HostObject.Send(VanillaWeather.Serialise());
     }
     else
     {
         Parent.HostObject.Send(Packet);
     }
 }
Пример #18
0
 public void Process_Type16_PrepareSimulation(Network.Packet Packet)
 {
     Network.Packets.Type16_PrepareSimulation ThisPacket = new Network.Packets.Type16_PrepareSimulation(Packet);
     if (Parent.Username.ToUpperInvariant() == "PHP BOT")
     {
         Parent.ClientObject.SendMessage("Now that your log on has been completed, You have been disconnected from the server.\nTo use the server, Join as a client other then \"PHP bot\".");
         Parent.Close();
         return;
     }
     Logger.Console.WriteLine("&a" + Parent.Username + " Log on process completed.");
     //ThisPacket.PrintDebugInfo();
     //Parent.HostObject.Send(Packet);
     Parent.ClientObject.Send(ThisPacket.Serialise());
 }
                internal Network.Packet Serialise()
                {
                    Network.Packet outpack = new Network.Packet();
                    string         outdata = "";

                    outdata += BitConverter.GetBytes(AircraftCount).ToDataString();
                    foreach (uint ID in AircraftIDs)
                    {
                        outdata += BitConverter.GetBytes(ID).ToDataString();
                    }
                    outpack.Data = outdata;
                    outpack.Type = Type;
                    return(outpack);
                }
Пример #20
0
 public void Process_Type13_RemoveAircraft(Network.Packet Packet)
 {
     Network.Packets.Type13_RemoveAircraft ThisPacket = new Network.Packets.Type13_RemoveAircraft(Packet);
     //ThisPacket.PrintDebugInfo();
     //Parent.HostObject.Send(Packet);
     if (ThisPacket.ID == Parent.Vehicle.ID)
     {
         Server.Vehicles.RemoveAll(x => x.ID == Parent.Vehicle.ID);
         Parent.Vehicle.ID         = 0;
         Parent.Vehicle.FormTarget = 0;
         Server.AllClients.SendMessage(Parent.Username + " left the aircraft.");
     }
     Parent.ClientObject.Send(ThisPacket.Serialise());
 }
Пример #21
0
 /// <summary>
 /// Receive a Chat Packet from the Client and set it as the TextInput for TextInputWaiters.
 /// </summary>
 public void _GetChatPacketBeforeLogin()
 {
     #region Receive a Chat Packet from the Client and set it as the TextInput for TextInputWaiters.
     //Console.WriteLine("NetObject.Client Ready");
     while (ClientSocket.Connected)
     {
         //Console.WriteLine("NetObject.Client is waiting for data from its Client side socket.");
         //Console.WriteLine("NetObject.Client Listening...");
         Logger.Console.WriteLine("Waiting");
         Network.Packet InPacket = Network.Sockets.GetPacket(ClientSocket);
         Logger.Console.WriteLine("Received");
         if (InPacket.Type == 32)
         {
             Network.Packets.Type32_ChatMessage ThisPacket = new Network.Packets.Type32_ChatMessage(InPacket);
             string EditMessage = ThisPacket.Message.Remove(0, 1);
             EditMessage = EditMessage.Remove(0, Parent.Username.Length);
             EditMessage = EditMessage.Remove(0, 1);
             //Console.WriteLine(EditMessage);
             Parent.TextInput = EditMessage;
             Logger.Console.WriteLine(Parent.TextInput);
             foreach (AutoResetEvent ThisEvent in Parent.TextWaiters.ToArray())
             {
                 ThisEvent.Set();
                 Parent.TextWaiters.Remove(ThisEvent);
             }
             return;
         }
         //Console.WriteLine("NetObject.Client Got Some Data.");
         if (InPacket.Type != 0)
         {
             PreviousPackets.Insert(0, InPacket);
             while (PreviousPackets.Count > 5)
             {
                 PreviousPackets.RemoveAt(PreviousPackets.Count - 1);
             }
             Logger.Console.WriteLine("!=32");
             //ProcessPacket(InPacket);
             //DONT DO THAT! WE DONT WANT A LOG IN TO HAPPEN ETC.
         }
         else
         {
             Logger.Console.WriteLine("CLOSE");
             //The only time Socket Receive returns 0 is when a remote host disconnects, otherwise, it waits.
             Parent.Close();
         }
     }
     Logger.Console.WriteLine("CLOSE2");
     #endregion
 }
Пример #22
0
                internal Network.Packet Serialise()
                {
                    Network.Packet outpack = new Network.Packet();
                    string         outdata = "";

                    outdata     += BitConverter.GetBytes(ID).ToDataString();
                    outdata     += (char)Alpha;
                    outdata     += (char)Red;
                    outdata     += (char)Green;
                    outdata     += (char)Blue;
                    outpack.Data = outdata;
                    outpack.Type = Type;
                    //PrintDebugInfo();
                    return(outpack);
                }
Пример #23
0
                internal Network.Packet Serialise()
                {
                    Network.Packet outpack = new Network.Packet();
                    string         outdata = "";

                    outdata     += BitConverter.GetBytes(Lighting).ToDataString();
                    outdata     += BitConverter.GetBytes(RawOptions).ToDataString();
                    outdata     += BitConverter.GetBytes(WindX).ToDataString();
                    outdata     += BitConverter.GetBytes(WindY).ToDataString();
                    outdata     += BitConverter.GetBytes(WindZ).ToDataString();
                    outdata     += BitConverter.GetBytes(Fog).ToDataString();
                    outpack.Data = outdata;
                    outpack.Type = Type;
                    return(outpack);
                }
Пример #24
0
                internal Network.Packet Serialise()
                {
                    Network.Packet outpack = new Network.Packet();
                    string         outdata = "";

                    outdata     += BitConverter.GetBytes(VictimType).ToDataString();
                    outdata     += BitConverter.GetBytes(VictimID).ToDataString();
                    outdata     += BitConverter.GetBytes(AttackerType).ToDataString();
                    outdata     += BitConverter.GetBytes(Damage).ToDataString();
                    outdata     += BitConverter.GetBytes(Weapon).ToDataString();
                    outdata     += BitConverter.GetBytes(Unknown).ToDataString();
                    outpack.Data = outdata;
                    outpack.Type = Type;
                    return(outpack);
                }
Пример #25
0
 public void Process_Type33_Weather(Network.Packet Packet)
 {
     if (Packet.Size != 4)
     { //This is not a weather request packet, we need to get its data.
         Network.Packets.Type33_Weather ThisPacket = new Network.Packets.Type33_Weather(Packet);
         VanillaWeather = ThisPacket;
         //VanillaWeather.PrintDebugInfo();
         //Weather.PrintDebugInfo();
         Parent.ClientObject.Send(Weather.Serialise());
     }
     else
     {
         Parent.ClientObject.Send(Packet);
     }
 }
Пример #26
0
                internal Network.Packet Serialise()
                {
                    Network.Packet outpack = new Network.Packet();
                    string         outdata = "";

                    outdata     += BitConverter.GetBytes(IFF).ToDataString();
                    outdata     += Aircraft + new string('\0', 32 - Aircraft.Length);
                    outdata     += StartPosition + new string('\0', 32 - StartPosition.Length);
                    outdata     += BitConverter.GetBytes(Unknown1).ToDataString();
                    outdata     += BitConverter.GetBytes(Unknown2).ToDataString();
                    outdata     += BitConverter.GetBytes(Unknown3).ToDataString();
                    outpack.Data = outdata;
                    outpack.Type = Type;
                    return(outpack);
                }
Пример #27
0
                internal Network.Packet Serialise()
                {
                    Network.Packet outpack = new Network.Packet();
                    string         outdata = "";

                    outdata += BitConverter.GetBytes(ID).ToDataString();
                    for (int i = 0; i < Weapons.Count; i++)
                    {
                        outdata += BitConverter.GetBytes(Weapons.Keys.ToList()[i]).ToDataString();
                        outdata += BitConverter.GetBytes(Weapons.Values.ToList()[i]).ToDataString();
                    }
                    outpack.Data = outdata;
                    outpack.Type = Type;
                    return(outpack);
                }
Пример #28
0
                /*public Network.Packet GetOnePacket()
                 * {
                 *  if (Parent.UserObject.IsUtilityUser())
                 *  {
                 *      return new Network.Packet();
                 *  }
                 #region Receive Packet from the Client, and return..
                 *  //Console.WriteLine("NetObject.Client Ready");
                 *  Network.Packet InPacket = new Network.Packet();
                 *  if (ClientSocket.Connected && Parent.HostObject.HostSocket.Connected)
                 *  {
                 *      //Console.WriteLine("NetObject.Client is waiting for data from its Client side socket.");
                 *      //Console.WriteLine("NetObject.Client Listening...");
                 *      InPacket = Network.Sockets.GetPacket(ClientSocket);
                 *      //Console.WriteLine("NetObject.Client Got Some Data.");
                 *      if (InPacket.Type != 0)
                 *      {
                 *          PreviousPackets.Insert(0, InPacket);
                 *          while (PreviousPackets.Count > 5)
                 *          {
                 *              PreviousPackets.RemoveAt(PreviousPackets.Count - 1);
                 *          }
                 *      }
                 *      else
                 *      {
                 *          if (!(ClientSocket.Connected || Parent.HostObject.HostSocket.Connected))
                 *          {
                 *              Parent.Close();
                 *          }
                 *      }
                 *  }
                 *  return InPacket;
                 #endregion
                 #region The Client Socket has disconnected!
                 *  List<Network.Packet> PacketsCache = PreviousPackets;
                 *  foreach (Network.Packet ThisPacket in PacketsCache)
                 *  {
                 *      Logger.Log.Packet(ThisPacket);
                 *  }
                 *  //Console.WriteLine("Client Socket Closed inside NetObject.Client");
                 *  Parent.Close(); //Let the parent handle the client closing action.
                 #endregion
                 * }*/
                #endregion

                public void Send(Network.Packet InPacket)
                {
                    if (!_UnSleep())
                    {
                        return;
                    }
                    if (Parent.UserObject.IsUtilityUser())
                    {
                        return;
                    }
                    #region Convert the packet to a byte array ready to send to the client socket.
                    byte[] Output = InPacket.Serialise();
                    #endregion
                    #region Discard dodgy packets.
                    if (InPacket.Size > 8192 || InPacket.Type < 0 || InPacket.Type > 60 || InPacket.Size - 4 != InPacket.Data.Length)
                    {
                        //DODGY PACKET DO *NOT* SEND!
                        return;
                    }
                    #endregion
                    #region Send the byte array to the client socket.
                    try
                    {
                        if (ClientSocket != null)
                        {
                            try
                            {
                                ClientSocket.Send(Output);
                            }
                            catch
                            {
                            }
                        }
                    }
                    #endregion
                    #region Socket closed as we tried to send data?
                    catch (Exception e)
                    {
                        //Socket Closed?
                        List <Network.Packet> PacketsCache = PreviousPackets;
                        foreach (Network.Packet ThisPacket in PacketsCache)
                        {
                            Logger.Log.Packet(ThisPacket);
                        }
                        Logger.Log.Bug(e, "Could Not Send A Packet... Socket Closed?");
                    }
                    #endregion
                }
Пример #29
0
                internal Network.Packet Serialise_Type5(Network.Packet OutPack)
                {
                    OutPack.Data += BitConverter.GetBytes((float)PosX).ToDataString();
                    OutPack.Data += BitConverter.GetBytes((float)PosY).ToDataString();
                    OutPack.Data += BitConverter.GetBytes((float)PosZ).ToDataString();
                    OutPack.Data += BitConverter.GetBytes((short)HdgX).ToDataString();
                    OutPack.Data += BitConverter.GetBytes((short)HdgY).ToDataString();
                    OutPack.Data += BitConverter.GetBytes((short)HdgZ).ToDataString();

                    OutPack.Data += BitConverter.GetBytes((short)V_PosX).ToDataString();
                    OutPack.Data += BitConverter.GetBytes((short)V_PosY).ToDataString();
                    OutPack.Data += BitConverter.GetBytes((short)V_PosZ).ToDataString();
                    OutPack.Data += BitConverter.GetBytes((short)V_HdgX).ToDataString();
                    OutPack.Data += BitConverter.GetBytes((short)V_HdgY).ToDataString();
                    OutPack.Data += BitConverter.GetBytes((short)V_HdgZ).ToDataString();

                    OutPack.Data += BitConverter.GetBytes((short)Ammo_SmokeOil).ToDataString();
                    OutPack.Data += BitConverter.GetBytes((int)Weight_Fuel).ToDataString();
                    OutPack.Data += BitConverter.GetBytes((short)Weight_Payload).ToDataString();

                    OutPack.Data += ((byte)FlightState).ToByteArray().ToDataString();
                    OutPack.Data += ((byte)Anim_VGW).ToByteArray().ToDataString();

                    OutPack.Data += ((byte)(((int)Anim_Boards.ToTens()) + ((int)Anim_Gear))).ToByteArray().ToDataString();
                    OutPack.Data += ((byte)(((int)Anim_Flaps.ToTens()) + ((int)Anim_Brake))).ToByteArray().ToDataString();

                    OutPack.Data += ((byte)Anim_Flags).ToByteArray().ToDataString();
                    OutPack.Data += ((byte)CPU_Flags).ToByteArray().ToDataString();

                    OutPack.Data += BitConverter.GetBytes((short)Ammo_Gun).ToDataString();
                    OutPack.Data += BitConverter.GetBytes((short)Ammo_Rocket).ToDataString();

                    OutPack.Data += ((byte)Ammo_AAM).ToByteArray().ToDataString();
                    OutPack.Data += ((byte)Ammo_AGM).ToByteArray().ToDataString();
                    OutPack.Data += ((byte)Ammo_B500).ToByteArray().ToDataString();

                    OutPack.Data += ((byte)Health).ToByteArray().ToDataString();
                    OutPack.Data += ((sbyte)gForce).ToByteArray().ToDataString();

                    OutPack.Data += ((byte)Anim_Throttle).ToByteArray().ToDataString();
                    OutPack.Data += ((sbyte)Anim_Elevator).ToByteArray().ToDataString();
                    OutPack.Data += ((sbyte)Anim_Aileron).ToByteArray().ToDataString();
                    OutPack.Data += ((sbyte)Anim_Rudder).ToByteArray().ToDataString();
                    OutPack.Data += ((sbyte)Anim_Trim).ToByteArray().ToDataString();

                    return(OutPack);
                }
Пример #30
0
                public void Process_Type11_FlightData(Network.Packet Packet)
                {
                    Network.Packets.Type11_FlightData ThisPacket = new Network.Packets.Type11_FlightData(Packet);
                    Parent.ClientObject.Send(Packet);

                    /*
                     * Logger.Console.WriteLine("&b" + ThisPacket.TimeStamp.ToString());
                     * if (ThisPacket.ID == Parent.Vehicle.ID)
                     * {
                     *  Logger.Console.WriteLine("&b####" + ThisPacket.Data.ToHexString());
                     * }
                     * else
                     * {
                     *  Logger.Console.WriteLine("&b$$$$" + ThisPacket.Data.ToHexString());
                     * }
                     */
                }