Exemplo n.º 1
0
        public InjectionResult Write()
        {
            if (!ReadValidate(out var data))
            {
                return(InjectionResult.FailValidate);
            }

            var orig = (byte[])data.Clone();

            PlayerItemSet.WritePlayerInventory(data, Items);

            if (data.SequenceEqual(orig))
            {
                return(InjectionResult.Same);
            }

            PlayerItemSet.GetOffsetLength(WriteOffset, out var offset, out var size);
            if (size != data.Length)
            {
                return(InjectionResult.FailBadSize);
            }

            Bot.WriteBytes(data, offset);

            LastData = data;

            return(InjectionResult.Success);
        }
Exemplo n.º 2
0
        public static void VerifyItemBinary()
        {
            var  data   = Properties.Resources.itempacket;
            bool result = PlayerItemSet.ValidateItemBinary(data);

            result.Should().BeTrue();
        }
Exemplo n.º 3
0
        public bool Validate(byte[] data)
        {
            if (!ValidateEnabled)
            {
                return(true);
            }

            return(PlayerItemSet.ValidateItemBinary(data));
        }
Exemplo n.º 4
0
        public InjectionResult Read()
        {
            if (!ReadValidate(out var data))
            {
                return(InjectionResult.FailValidate);
            }

            if (LastData?.SequenceEqual(data) == true)
            {
                return(InjectionResult.Same);
            }

            PlayerItemSet.ReadPlayerInventory(data, Items);

            LastData = data;

            return(InjectionResult.Success);
        }
Exemplo n.º 5
0
        //Загружаем все, что касается информации персонажа через XML

        //Загружаем все, что касается информации об вещах через XML
        private void Launcher_OnPlayerImage(object sender, LoadTextEventArgs e)
        {
            switch (e.State)
            {
            case LoadingState.Canceled:
                break;

            case LoadingState.Started:
                StartWaitAnimation();
                break;

            case LoadingState.Completed:
                StopWaitAnimation();

                try
                {
                    if (e.Result.Success)
                    {
                        PlayerItemSet imageInfo = PlayerItemSet.FromXml(e.Result.Data);     // item image


                        // получаем имг сорц как урл
                        var player = imageInfo.Stat[0];
                        Slot0  = player.HeadChar;
                        Slot1  = player.Neck;
                        Slot2  = player.Shoulders;
                        Slot3  = player.BodyChar;
                        Slot4  = player.ChestChar;
                        Slot5  = player.Waist;
                        Slot6  = player.Legs;
                        Slot7  = player.Feet;
                        Slot8  = player.Wrists;
                        Slot9  = player.Hands;
                        Slot10 = player.Finger1;
                        Slot11 = player.Finger2;
                        Slot12 = player.Trinket1;
                        Slot13 = player.Trinket2;
                        Slot14 = player.Back;
                        Slot15 = player.MainHand;
                        Slot16 = player.OffHand;
                        Slot17 = player.Ranget;
                        Slot18 = player.Tabard;

                        BitmapImage img0 = new BitmapImage();
                        img0.BeginInit();
                        img0.UriSource = new Uri(Slot0, UriKind.Absolute);
                        img0.EndInit();
                        s0.Source = img0;

                        BitmapImage img1 = new BitmapImage();
                        img1.BeginInit();
                        img1.UriSource = new Uri(Slot1, UriKind.Absolute);
                        img1.EndInit();
                        s1.Source = img1;

                        BitmapImage img2 = new BitmapImage();
                        img2.BeginInit();
                        img2.UriSource = new Uri(Slot2, UriKind.Absolute);
                        img2.EndInit();
                        s2.Source = img2;

                        BitmapImage img3 = new BitmapImage();
                        img3.BeginInit();
                        img3.UriSource = new Uri(Slot3, UriKind.Absolute);
                        img3.EndInit();
                        s3.Source = img3;

                        BitmapImage img4 = new BitmapImage();
                        img4.BeginInit();
                        img4.UriSource = new Uri(Slot4, UriKind.Absolute);
                        img4.EndInit();
                        s4.Source = img4;

                        BitmapImage img5 = new BitmapImage();
                        img5.BeginInit();
                        img5.UriSource = new Uri(Slot5, UriKind.Absolute);
                        img5.EndInit();
                        s5.Source = img5;

                        BitmapImage img6 = new BitmapImage();
                        img6.BeginInit();
                        img6.UriSource = new Uri(Slot6, UriKind.Absolute);
                        img6.EndInit();
                        s6.Source = img6;

                        BitmapImage img7 = new BitmapImage();
                        img7.BeginInit();
                        img7.UriSource = new Uri(Slot7, UriKind.Absolute);
                        img7.EndInit();
                        s7.Source = img7;

                        BitmapImage img8 = new BitmapImage();
                        img8.BeginInit();
                        img8.UriSource = new Uri(Slot8, UriKind.Absolute);
                        img8.EndInit();
                        s8.Source = img8;

                        BitmapImage img9 = new BitmapImage();
                        img9.BeginInit();
                        img9.UriSource = new Uri(Slot9, UriKind.Absolute);
                        img9.EndInit();
                        s9.Source = img9;

                        BitmapImage img10 = new BitmapImage();
                        img10.BeginInit();
                        img10.UriSource = new Uri(Slot10, UriKind.Absolute);
                        img10.EndInit();
                        s10.Source = img10;

                        BitmapImage img11 = new BitmapImage();
                        img11.BeginInit();
                        img11.UriSource = new Uri(Slot11, UriKind.Absolute);
                        img11.EndInit();
                        s11.Source = img11;

                        BitmapImage img12 = new BitmapImage();
                        img12.BeginInit();
                        img12.UriSource = new Uri(Slot12, UriKind.Absolute);
                        img12.EndInit();
                        s12.Source = img12;

                        BitmapImage img13 = new BitmapImage();
                        img13.BeginInit();
                        img13.UriSource = new Uri(Slot13, UriKind.Absolute);
                        img13.EndInit();
                        s13.Source = img13;

                        BitmapImage img14 = new BitmapImage();
                        img14.BeginInit();
                        img14.UriSource = new Uri(Slot14, UriKind.Absolute);
                        img14.EndInit();
                        s14.Source = img14;

                        BitmapImage img15 = new BitmapImage();
                        img15.BeginInit();
                        img15.UriSource = new Uri(Slot15, UriKind.Absolute);
                        img15.EndInit();
                        s15.Source = img15;

                        BitmapImage img16 = new BitmapImage();
                        img16.BeginInit();
                        img16.UriSource = new Uri(Slot16, UriKind.Absolute);
                        img16.EndInit();
                        s16.Source = img16;

                        BitmapImage img17 = new BitmapImage();
                        img17.BeginInit();
                        img17.UriSource = new Uri(Slot17, UriKind.Absolute);
                        img17.EndInit();
                        s17.Source = img17;

                        BitmapImage img18 = new BitmapImage();
                        img18.BeginInit();
                        img18.UriSource = new Uri(Slot18, UriKind.Absolute);
                        img18.EndInit();
                        s18.Source = img18;
                    }
                }
                catch (Exception err)
                {
                    MessageBox.Show(
                        "It is not possible to connect to the news server. Please restart the program. If the error persists, again, please contact technical support project");
                }

                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
Exemplo n.º 6
0
 public bool ReadValidate(out byte[] data)
 {
     PlayerItemSet.GetOffsetLength(WriteOffset, out var offset, out var size);
     data = Bot.ReadBytes(offset, size);
     return(Validate(data));
 }