Ejemplo n.º 1
0
        private void TradeGiveItem(int recipientId, string recipientName, int[] itemIds)
        {
            WorldObject player = Core.GetPlayerByIdOrName(recipientId, recipientName);

            if (player == null)
            {
                SendChatCommand($"/t {recipientName}, You are too far away to open a trade window. Please move closer and try the retrieve command again.");
                return;
            }
            if (recipientId == 0)
            {
                recipientId = player.Id;
            }
            double dist = Core.WorldFilter.Distance(recipientId, Core.CharacterFilter.Id, true);

            //double dist = GetMyDistanceTo(player.Coordinates());//broken
            if (dist > .005)
            {
                SendChatCommand($"/t {recipientName}, You are too far away to open a trade window. Please move closer and try the retrieve command again.");
                return;
            }
            Host.Actions.SelectItem(recipientId);
            GivingItems = itemIds;
            Core.Foreground();
            Mapper.KeyInfo ki = Mapper.GetScanCode("r");
            Input.SendKeyInput(ki.ScanCode, true, false);
            Input.SendKeyInput(ki.ScanCode, false, true);
        }
Ejemplo n.º 2
0
 private void SendKey(string key, bool press, bool release)
 {
     Mapper.KeyInfo ki = Mapper.GetScanCode(key);
     if (press)
     {
         Input.SendKeyInput(ki.ScanCode, true, false);
     }
     if (release)
     {
         Input.SendKeyInput(ki.ScanCode, false, true);
     }
 }
Ejemplo n.º 3
0
        internal static void SendStringInput(string p, IntPtr hWnd)
        {
            Mapper mapper        = new Mapper();
            ushort shiftScanCode = Mapper.GetScanCode("Left Shift").ScanCode;

            for (int i = 0; i < p.Length; i++)
            {
                Mapper.KeyInfo ki = Mapper.GetScanCode(p.Substring(i, 1));
                if (ki.ShiftKey)
                {
                    SendKeyInput(shiftScanCode, true, false);
                }

                SendKeyInput(ki.ScanCode, true, false);
                SendKeyInput(ki.ScanCode, false, true);
                if (ki.ShiftKey)
                {
                    SendKeyInput(shiftScanCode, false, true);
                }
            }
        }