Exemple #1
0
        /// <summary>
        /// Send WorldItem packet to client.
        /// </summary>
        /// <param name="client">Target client.</param>
        /// <param name="serial">Item serial.</param>
        /// <param name="itemid">Item ID.</param>
        /// <param name="x">X Location.</param>
        /// <param name="y">Y Location.</param>
        /// <param name="z">Z Location.</param>
        /// <param name="hue">Item hue.</param>
        public static void WorldItem(int client, int serial, int itemid, int x, int y, int z, int hue)
        {
            byte[] packet = new byte[26];
            packet[0] = 0xF3;
            packet[2] = 0x01;
            packet[4] = (byte)(serial >> 24);
            packet[5] = (byte)(serial >> 16);
            packet[6] = (byte)(serial >> 8);
            packet[7] = (byte)serial;
            itemid   &= 0xFFFF;
            packet[8] = (byte)(itemid >> 8);
            packet[9] = (byte)itemid;
            int amount = 1;

            packet[11] = (byte)(amount >> 8);
            packet[12] = (byte)amount;
            packet[13] = (byte)(amount >> 8);
            packet[14] = (byte)amount;
            packet[15] = (byte)(x >> 8);
            packet[16] = (byte)x;
            packet[17] = (byte)(y >> 8);
            packet[18] = (byte)y;
            packet[19] = (byte)z;
            //byte - light
            packet[21] = (byte)(hue >> 8);
            packet[22] = (byte)hue;
            MacroEx.SendPacketToClient(client, packet);
        }
Exemple #2
0
        public static void OnInit()
        {
            MacroEx    macro = new MacroEx();
            WaitForMsg wait  = new WaitForMsg(1042635, 1008124, 1008125, 1043297, 1055086, 1055087, 503172, 503171);

            macro.Insert(-1, new UseFishingPole(wait));
            macro.Insert(-1, new WaitForTargetAction(new[] { "", "2" }));
            macro.Insert(-1, new TargetRelLocAction(0, 0));
            macro.Insert(-1, new AttackClosestAction());
            macro.Insert(-1, new Clean());
            Track track = new Track();

            macro.Insert(-1, track);
            macro.Insert(-1, new WaitForTrack(track));
            macro.Insert(-1, new TrackResponse(track));
            macro.Insert(-1, wait);
            macro.Insert(-1, new SailAction(wait));
            Command.Register("fish", args => MacroManager.HotKeyPlay(macro));
            Core.AddHotkey("Fishing", () => MacroManager.HotKeyPlay(macro));

            MacroEx    sos     = new MacroEx();
            WaitForMsg waitSos = new WaitForMsg(1042635, 1008124, 1008125, 1043297, 1055086, 1055087, 503172, 503171, 501747);

            sos.Insert(-1, new UseFishingPole(waitSos));
            sos.Insert(-1, new WaitForTargetAction(new[] { "", "2" }));
            sos.Insert(-1, new TargetRelLocAction(0, 0));
            sos.Insert(-1, waitSos);
            sos.Insert(-1, new FoundSOSAction(waitSos));
            Command.Register("sos", args => MacroManager.HotKeyPlay(sos));
            Core.AddHotkey("SOS", () => MacroManager.HotKeyPlay(sos));
            Command.Register("sit", OnCommand);
        }
Exemple #3
0
        public static void OnInit()
        {
            MacroEx macro = new MacroEx();

            macro.Insert(-1, new GumpWait());
            macro.Insert(-1, new Clean());
            Command.Register("sud", args => MacroManager.HotKeyPlay(macro));
        }
Exemple #4
0
 /// <summary>
 /// Send RemoveObject packet to client.
 /// </summary>
 /// <param name="client">Target client.</param>
 /// <param name="serial">Serial of item/mobile/multi.</param>
 public static void RemoveObject(int client, int serial)
 {
     byte[] packet = new byte[5];
     packet[0] = 0x1D;
     packet[1] = (byte)(serial >> 24);
     packet[2] = (byte)(serial >> 16);
     packet[3] = (byte)(serial >> 8);
     packet[4] = (byte)(serial);
     MacroEx.SendPacketToClient(client, packet);
 }
        /// <summary>
        /// Sets cursor to normal and sends target cancel packet to server.
        /// Has the same effect as pressing Esc.
        /// </summary>
        /// <param name="client">Target client.</param>
        public static void CancelTargetCursor(int client)
        {
            ClientInfo ci;

            if (ClientInfoCollection.GetClient(client, out ci))
            {
                Memory.Write(ci.Handle, ci.CursorAddress, dwordZero, true);
                MacroEx.SendPacketToServer(client, myCancelTargetPacket);
            }
        }
Exemple #6
0
        /// <summary>
        /// Change client cursor to normal or target cursor.
        /// </summary>
        /// <param name="client">Target client.</param>
        /// <param name="target">True sets cursor to target cursor, false sets it to normal.</param>
        public static void SetTargetCursor(int client, bool target)
        {
            ClientInfo ci;

            if (ClientInfoCollection.GetClient(client, out ci))
            {
                if (target)
                {
                    MacroEx.SendPacketToClient(client, myTargetPacket);
                }
                else
                {
                    Memory.Write(ci.Handle, ci.CursorAddress, dwordZero, true);
                }
            }
        }
Exemple #7
0
 /// <summary>
 /// Send quest arrow packet to client.
 /// </summary>
 /// <param name="client">Target client.</param>
 /// <param name="active">Turn on or off.</param>
 /// <param name="x">X location</param>
 /// <param name="y">Y location</param>
 /// <param name="serial">Target serial or -1</param>
 public static void QuestArrow(int client, bool active, int x, int y, int serial)
 {
     byte[] packet = new byte[10];
     packet[0] = 0xBA;
     if (active)
     {
         packet[1] = 0x01;
         packet[2] = (byte)(x >> 8);
         packet[3] = (byte)x;
         packet[4] = (byte)(y >> 8);
         packet[5] = (byte)y;
     }
     packet[6] = (byte)(serial >> 24);
     packet[7] = (byte)(serial >> 16);
     packet[8] = (byte)(serial >> 8);
     packet[9] = (byte)serial;
     MacroEx.SendPacketToClient(client, packet);
 }
Exemple #8
0
        public void MapTest70450()
        {
            string path = @"D:\Clients\7.0.45.0";

            TileData.Initialize(path);
            Map.Initialize(path, 0);

            MapInfo mi;

            foreach (LandTileTest lt in m_LandTileTests)
            {
                MacroEx.GetMapInfo(lt.Facet, lt.X, lt.Y, out mi);
                Assert.IsNotNull(mi.landTile, "LandTile is null.");
                Assert.AreEqual(mi.landTile.ID, lt.LandTileID, "LandTile doesn't match expected.");
                Assert.AreEqual(mi.landTile.Name, lt.LandTileName, "LandTile Name doesn't match expected.");
            }

            TileData.Dispose();
            Map.Dispose();
        }
        /// <summary>
        /// Send item properties request for multiple serials.
        /// </summary>
        /// <param name="client">Target client.</param>
        /// <param name="serials">int array of target serials.</param>
        public static void RequestItemProperties(int client, int[] serials)
        {
            int size = (serials.Length * 4) + 3;

            byte[] packet = new byte[size];
            packet[0] = 0xD6;
            packet[1] = (byte)(size);
            packet[2] = (byte)(size >> 8);
            int i = 3;

            foreach (int serial in serials)
            {
                packet[i]     = (byte)(serial >> 24);
                packet[i + 1] = (byte)(serial >> 16);
                packet[i + 2] = (byte)(serial >> 8);
                packet[i + 3] = (byte)serial;
                i            += 4;
            }
            MacroEx.SendPacketToServer(client, packet);
        }
Exemple #10
0
        public void MapTest70022()
        {
            string path = @"D:\Clients\7.0.2.2";

            Version version = ExeInfo.GetFileVersion(Path.Combine(path, "client.exe"));

            TileData.Initialize(path);
            Map.Initialize(path, 0);

            MapInfo mi;

            foreach (LandTileTest lt in m_LandTileTests)
            {
                MacroEx.GetMapInfo(lt.Facet, lt.X, lt.Y, out mi);
                Assert.IsNotNull(mi.landTile, "LandTile is null.");
                Assert.AreEqual(mi.landTile.ID, lt.LandTileID, "LandTile doesn't match expected.");
                Assert.AreEqual(mi.landTile.Name, lt.LandTileName, "LandTile Name doesn't match expected.");
            }

            TileData.Dispose();
            Map.Dispose();
        }