Ejemplo n.º 1
0
 public NetworkMessage(Objects.Client client, int size)
 {
     bufferSize = size;
     buffer = new byte[bufferSize];
     Client = client;
     position = GetPacketHeaderSize() + 2;
 }
Ejemplo n.º 2
0
 public NetworkMessage(Objects.Client client, byte[] data)
 {
     buffer = new byte[bufferSize];
     Client = client;
     Array.Copy(data, buffer, data.Length);
     length = data.Length;
     position = 0;
 }
Ejemplo n.º 3
0
 public NetworkMessage(Objects.Client client, byte[] data, int length)
 {
     buffer = new byte[bufferSize];
     Client = client;
     Array.Copy(data, buffer, length);
     this.length = length;
     position = 0;
 }
Ejemplo n.º 4
0
Archivo: Healer.cs Proyecto: KyLuaa/bot
        internal Healer(Objects.Client c)
        {
            this.Client = c;
            InitializeComponent();
            this.Icon = Properties.Resources.icon;
            comboboxAction.SelectedIndex = 1;
            if (this.Client.Player != null && this.Client.Player.Connected)
            {
                numericHealth.Value = (int)(Client.Player.HealthMax * 0.65);
                numericMana.Value = 80;// (int)(Client.Player.ManaMax * 0.5);
            }

            this.Client.Modules.Healer.CriteriaAdded += new Modules.Healer.CriteriaAddedHandler(Healer_CriteriaAdded);
            this.Client.Modules.Healer.CriteriaInserted += new Modules.Healer.CriteriaInsertedHandler(Healer_CriteriaInserted);
            this.Client.Modules.Healer.CriteriaRemoved += new Modules.Healer.CriteriaRemovedHandler(Healer_CriteriaRemoved);
        }
Ejemplo n.º 5
0
        internal MainHub(Objects.Client c)
        {
            if (!WinAPI.IsIconic(c.TibiaProcess.MainWindowHandle))
            {
                this.StartPosition = FormStartPosition.Manual;
                WinAPI.RECT rect = new WinAPI.RECT();
                WinAPI.GetWindowRect(c.TibiaProcess.MainWindowHandle, out rect);
                this.Location = new Point(rect.left + 10, rect.top + 30);
            }
            this.Client = c;
            InitializeComponent();
            this.Icon = Properties.Resources.icon;

            if (!this.Client.HasLoadedProperties)
            {
                ObjectPropertiesLoader loader = new ObjectPropertiesLoader(this.Client);
                loader.ShowDialog();
                if (!loader.Finished) Environment.Exit(Environment.ExitCode);
                loader.Dispose();
            }

            this.timerUpdate.Start();
        }
Ejemplo n.º 6
0
        public static bool Send(Objects.Client client)
        {
            RemoveAllIconsPacket p = new RemoveAllIconsPacket(client);

            return(p.Send());
        }
 /// <summary>
 /// Send a channel message.
 /// </summary>
 /// <param name="client"></param>
 /// <param name="senderName"></param>
 /// <param name="senderLevel"></param>
 /// <param name="speechType"></param>
 /// <param name="channelId"></param>
 /// <returns></returns>
 public static bool Send(Objects.Client client, string senderName, ushort senderLevel, string message, SpeechType speechType, ChatChannel channelId)
 {
     return(Send(client, senderName, senderLevel, message, speechType, channelId, Objects.Location.Invalid, 0));
 }
 public CreatureSpeechPacket(Objects.Client c)
     : base(c)
 {
     Type        = IncomingPacketType.CreatureSpeech;
     Destination = PacketDestination.Client;
 }
Ejemplo n.º 9
0
        static void Main(string[] args)
        {
            if (!File.Exists("CSScriptLibrary.dll"))
            {
                MessageBox.Show("CSScriptLibrary.dll is missing.\nCan not run application.",
                    "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            int pid = 0;
            var scriptPaths = new List<string>();
            if (args.Length > 0)
            {
                for (int i = 0; i < args.Length; i++)
                {
                    switch (args[i].ToLower())
                    {
                        case "-p":
                        case "--process":
                            if (args.Length == i + 1) break;
                            int.TryParse(args[i + 1], out pid);
                            break;
                        case "-s":
                        case "--script":
                            if (args.Length == i + 1) break;
                            string script = args[i + 1];
                            if (!script.ToLower().EndsWith(".cs") || !File.Exists(script)) break;
                            scriptPaths.Add(script);
                            break;
                        case "-c":
                        case "--cavebot":
                            break;
                    }
                }
            }

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            if (pid != 0)
            {
                Process p = null;
                try { p = Process.GetProcessById(pid); }
                catch { return; }
                if (p == null || p.HasExited) return;
                Objects.Client c = new Objects.Client(p, true);
                foreach (string s in scriptPaths)
                {
                    c.Modules.ScriptManager.AddScript(new Objects.Script(c, new FileInfo(s)));
                }
                c.Modules.ScriptManager.StartAllScripts();
                Application.Run(new Forms.MainHub(c));
                return;
            }

            List<Objects.Client> clients = Objects.Client.GetClients().ToList();
            if (clients.Count == 1 && clients[0].Addresses.IsValid)
            {
                Objects.Client c = new Objects.Client(clients[0].TibiaProcess);
                Application.Run(new Forms.MainHub(c));
            }
            else Application.Run(new Forms.ClientChooser());
        }
Ejemplo n.º 10
0
 public AttackPacket(Objects.Client c)
     : base(c)
 {
     Type        = OutgoingPacketType.Attack;
     Destination = PacketDestination.Server;
 }
        public static bool Send(Objects.Client client)
        {
            LogoutPacket p = new LogoutPacket(client);

            return(p.Send());
        }
Ejemplo n.º 12
0
 public Packet(Objects.Client c)
 {
     Client = c;
     Forward = true;
 }
 /// <summary>
 /// Send a private or normal message.
 /// </summary>
 /// <param name="client"></param>
 /// <param name="senderName"></param>
 /// <param name="senderLevel"></param>
 /// <param name="speechType"></param>
 /// <param name="position"></param>
 /// <returns></returns>
 public static bool Send(Objects.Client client, string senderName, ushort senderLevel, string message, SpeechType speechType, Objects.Location position)
 {
     return(Send(client, senderName, senderLevel, message, speechType, ChatChannel.None, position, 0));
 }
Ejemplo n.º 14
0
 public ContainerOpenPacket(Objects.Client c)
     : base(c)
 {
     Type        = IncomingPacketType.ContainerOpen;
     Destination = PacketDestination.Client;
 }
Ejemplo n.º 15
0
 public PacketCreature(Objects.Client client)
 {
     Client = client;
 }
Ejemplo n.º 16
0
 public ClientChooser()
 {
     InitializeComponent();
     client = null;
     //Pokemon.Version.Set(Pokemon.Version.CurrentVersionString);
 }
Ejemplo n.º 17
0
 public ChannelOpenPacket(Objects.Client c)
     : base(c)
 {
     Type        = OutgoingPacketType.ChannelOpen;
     Destination = PacketDestination.Server;
 }
Ejemplo n.º 18
0
 public Memory(Objects.Client c)
 {
     this.Client = c;
 }
Ejemplo n.º 19
0
        /// <summary>
        /// The workerthread that deals with accepting clients
        /// </summary>
        private void workerThread()
        {
            while (true)
            {
                System.Net.Sockets.TcpClient pTcpClient = null;

                try
                {
                    pTcpClient = m_pTcpListener.AcceptTcpClient();
                }
                catch
                {
                }

                if (pTcpClient != null)
                {
                    Objects.Client pClient = new Objects.Client(pTcpClient);
                    addClient(pClient);

                    if (ClientConnected != null)
                    {
                        using (System.IO.StreamWriter pStreamWriter = new System.IO.StreamWriter(pTcpClient.GetStream()))
                        {
                            pStreamWriter.WriteLine("XXXXXX");
                        }

                        ClientConnected(this, new ClientConnectedEventArgs()
                        {
                            Client = pClient
                        });

                        pClient.DataReceived += pClient_DataReceived;
                    }
                }
            }
        }
Ejemplo n.º 20
0
 public ContainerOpenParentPacket(Objects.Client c)
     : base(c)
 {
     Type        = OutgoingPacketType.ContainerOpenParent;
     Destination = PacketDestination.Server;
 }
Ejemplo n.º 21
0
 public RuleViolationCancelPacket(Objects.Client c)
     : base(c)
 {
     Type        = IncomingPacketType.RuleViolationCancel;
     Destination = PacketDestination.Client;
 }
Ejemplo n.º 22
0
        private void ChooseClient()
        {
            options.UseOT = uxUseOT.Checked;
            LoginServer ls = null;

            if (options.UseOT)
            {
                string[] split = uxLoginServer.Text.Split(new char[] { ':' }, StringSplitOptions.RemoveEmptyEntries);

                if (split.Length == 2)
                    ls = new LoginServer(split[0].Trim(), short.Parse(split[1]));
                else
                    ls = new LoginServer(uxLoginServer.Text.Trim(), 7171);
            }

            client = ClientChooserBase.ChooseClient(options, uxClients.SelectedItem, ls);
            newClientChooser.Dispose();
        }
Ejemplo n.º 23
0
 public RemoveAllIconsPacket(Objects.Client client)
     : base(client)
 {
     Type = PipePacketType.RemoveAllIcons;
 }
Ejemplo n.º 24
0
 public NetworkMessage(Objects.Client client)
 {
     buffer   = new byte[bufferSize];
     Client   = client;
     position = GetPacketHeaderSize() + 2;
 }
Ejemplo n.º 25
0
 public Player(Objects.Client client)
 {
     baseAddress = client.Process.MainModule.BaseAddress.ToInt32();
 }