Inheritance: ObservableObject
        public ClientVersionEventArgs(ClientVersion version)
        {
            if (version == null)
            throw new ArgumentNullException("version");

              this.version = version;
        }
Example #2
0
        public void AddNewClient(ClientProcess process, ClientVersion version = null)
        {
            var player = new Player(process) { Version = version };
              player.PropertyChanged += Player_PropertyChanged;

              if (player.Version == null)
              {
            player.Version = ClientVersionManager.Instance.Versions.First(v => v.Key != "Auto-Detect");
              }

              AddPlayer(player);
              player.Update();
        }
        public void AddVersion(ClientVersion version)
        {
            if (version == null)
            throw new ArgumentNullException("version");

              if (string.IsNullOrWhiteSpace(version.Key))
            throw new ArgumentException("Key cannot be null or whitespace.", "version");

              bool alreadyExists = clientVersions.ContainsKey(version.Key);

              clientVersions[version.Key] = version;

              if (alreadyExists)
            OnVersionChanged(version);
              else
            OnVersionAdded(version);
        }
Example #4
0
        void PatchClient(ProcessInformation process, ClientVersion version, out ClientLoadResult result)
        {
            var patchMultipleInstances = UserSettingsManager.Instance.Settings.AllowMultipleInstances;
              var patchIntroVideo = UserSettingsManager.Instance.Settings.SkipIntroVideo;
              var patchNoWalls = UserSettingsManager.Instance.Settings.NoWalls;

              // Patch Process
              ProcessMemoryAccessor accessor = null;
              Stream patchStream = null;
              BinaryReader reader = null;
              BinaryWriter writer = null;
              try
              {
            accessor = new ProcessMemoryAccessor(process.ProcessId, ProcessAccess.ReadWrite);
            patchStream = accessor.GetStream();
            reader = new BinaryReader(patchStream);
            writer = new BinaryWriter(patchStream);

            if (patchMultipleInstances && version.MultipleInstanceAddress > 0)
            {
              patchStream.Position = version.MultipleInstanceAddress;
              writer.Write((byte)0x31);        // XOR
              writer.Write((byte)0xC0);        // EAX, EAX
              writer.Write((byte)0x90);        // NOP
              writer.Write((byte)0x90);        // NOP
              writer.Write((byte)0x90);        // NOP
              writer.Write((byte)0x90);        // NOP
            }

            if (patchIntroVideo && version.IntroVideoAddress > 0)
            {
              patchStream.Position = version.IntroVideoAddress;
              writer.Write((byte)0x83);        // CMP
              writer.Write((byte)0xFA);        // EDX
              writer.Write((byte)0x00);        // 0
              writer.Write((byte)0x90);        // NOP
              writer.Write((byte)0x90);        // NOP
              writer.Write((byte)0x90);        // NOP
            }

            if (patchNoWalls && version.NoWallAddress > 0)
            {
              patchStream.Position = version.NoWallAddress;
              writer.Write((byte)0xEB);        // JMP SHORT
              writer.Write((byte)0x17);        // +0x17
              writer.Write((byte)0x90);        // NOP
            }

            result = ClientLoadResult.Success;
              }
              catch
              {
            result = ClientLoadResult.PatchingFailed;
              }
              finally
              {
            reader?.Dispose();
            writer?.Dispose();
            accessor?.Dispose();
            patchStream?.Dispose();

            // Resume and close handles.
            NativeMethods.ResumeThread(process.ThreadHandle);
            NativeMethods.CloseHandle(process.ThreadHandle);
            NativeMethods.CloseHandle(process.ProcessHandle);
              }
        }
        void OnVersionRemoved(ClientVersion version)
        {
            if (version == null)
            throw new ArgumentNullException("version");

              var handler = this.VersionRemoved;

              if (handler != null)
            handler(this, new ClientVersionEventArgs(version));
        }
        public void LoadDefaultVersions()
        {
            if (!clientVersions.ContainsKey("Auto-Detect"))
            AddVersion(ClientVersion.AutoDetect);

              var version = new ClientVersion("7.41");
              version.Hash = @"3244DC0E68CD26F4FB1626DA3673FDA8";
              version.VersionNumber = 741;
              version.MultipleInstanceAddress = 0x57A7CE;
              version.IntroVideoAddress = 0x42E61F;
              version.NoWallAddress = 0x5FD874;
              version.Variables.Add(new MemoryVariable("CharacterName", 0x73D910, maxLength: 13));
              version.Variables.Add(new DynamicMemoryVariable("CurrentHealth", 0x755AA4, maxLength: 10, offsets: 0x4C6));
              version.Variables.Add(new DynamicMemoryVariable("MaximumHealth", 0x755AA4, maxLength: 10, offsets: 0x546));
              version.Variables.Add(new DynamicMemoryVariable("CurrentMana", 0x755AA4, maxLength: 10, offsets: 0x5C6));
              version.Variables.Add(new DynamicMemoryVariable("MaximumMana", 0x755AA4, maxLength: 10, offsets: 0x646));

              version.Variables.Add(new DynamicMemoryVariable("Level", 0x755AA4, maxLength: 3, offsets: 0x8C6));
              version.Variables.Add(new DynamicMemoryVariable("AbilityLevel", 0x755AA4, maxLength: 3, offsets: 0x9C6));

              version.Variables.Add(new DynamicMemoryVariable("MapName", 0x82B76C, maxLength: 32, offsets: 0x4E3C));
              version.Variables.Add(new DynamicMemoryVariable("MapNumber", 0x882E68, offsets: 0x26C));
              version.Variables.Add(new DynamicMemoryVariable("MapX", 0x882E68, offsets: 0x23C));
              version.Variables.Add(new DynamicMemoryVariable("MapY", 0x882E68, offsets: 0x238));

              version.Variables.Add(new DynamicMemoryVariable("Inventory", 0x882E68, maxLength: 256, size: 261, count: 60, offsets: new long[] { 0x2CC, 0x1092 }));
              version.Variables.Add(new DynamicMemoryVariable("Equipment", 0x6FC914, maxLength: 128, size: 261, count: 18, offsets: 0x1152));
              version.Variables.Add(new DynamicMemoryVariable("Skillbook", 0x882E68, maxLength: 256, size: 260, count: 90, offsets: new long[] { 0x2CC, 0x10210 }));
              version.Variables.Add(new DynamicMemoryVariable("Spellbook", 0x882E68, maxLength: 256, size: 518, count: 90, offsets: new long[] { 0x2CC, 0x4DFA }));

              version.Variables.Add(new SearchMemoryVariable("SkillCooldowns", 0x67639C, 0x194, size: 4, offsets: 0x322));

              version.Variables.Add(new DynamicMemoryVariable("ActivePanel", 0x82B76C, offsets: 0x4FA8));
              version.Variables.Add(new DynamicMemoryVariable("InventoryExpanded", 0x82B76C, offsets: 0x4FB0));
              version.Variables.Add(new DynamicMemoryVariable("MinimizedMode", 0x82B76C, offsets: 0x4DF0));
              version.Variables.Add(new DynamicMemoryVariable("DialogOpen", 0x85118C, offsets: new long[] { 0x59C, 0x594, 0x18, 0x24, 0xA20 }));
              version.Variables.Add(new DynamicMemoryVariable("SenseOpen", 0x6FB194, offsets: new long[] { 0x4C, 0x44, 0x18, 0xE }));
              version.Variables.Add(new DynamicMemoryVariable("UserChatting", 0x6EB118, offsets: 0x438));

              AddVersion(version);
        }