예제 #1
0
        private string Read(Process pProcess, string pAddress)
        {
            string lResult = "";

            int searchBytes  = 1;
            int numBytesRead = 0;

            byte[] byRead = new byte[searchBytes];
            long   num;

            if (Win32Lib.ReadProcessMemory(pProcess.Handle, (IntPtr)Convert.ToInt32(pAddress, 16), byRead, searchBytes, out numBytesRead))
            {
                if (numBytesRead == searchBytes)
                {
                    num = byRead[searchBytes - 1];
                    for (int j = searchBytes, k = 2; j > 1; j--, k++)
                    {
                        num = num << 8;
                        num = num | byRead[searchBytes - k];
                    }

                    lResult = num.ToString();
                }
            }

            if (_ShowHX)
            {
                lResult = int.Parse(lResult).ToString("x8");
                lResult = lResult.Substring(lResult.Length - 2, 2);
            }

            return(lResult);
        }
예제 #2
0
 public void FillData()
 {
     foreach (MemoryData item in Items)
     {
         item.Value = Win32Lib.ReadMemory(item.Address, item.ByteCount);
     }
 }
예제 #3
0
        private void IniItem(MemoryData pItem, int pByteCount)
        {
            if (_offSet != 0)
            {
                pItem.Address = Win32Lib.GetMoveAddress(_startAddress, _offSet);
            }
            else
            {
                pItem.Address = _startAddress;
            }

            pItem.ByteCount = pByteCount;

            _offSet += pByteCount;
        }
예제 #4
0
        private bool WriteOneProperty(TextBox pData, MemoryData pMemory)
        {
            bool WriteSuccess = false;

            if (pData.Text != pMemory.Value)
            {
                WriteSuccess = Win32Lib.WriteMemory(pMemory.Address, int.Parse(pData.Text), pMemory.ByteCount);
                if (WriteSuccess == false)
                {
                    MessageBox.Show("写入失败");
                    return(false);
                }
            }
            return(true);
        }
예제 #5
0
 private void frmRoleInfo_Activated(object sender, EventArgs e)
 {
     if (!Win32Lib.IsCorrectStartAddress(_RoleInfo.Address))
     {
         GlobalSpecs.NeedReSearch = true;
         this.Activated          -= frmRoleInfo_Activated;
         MessageBox.Show("内存地址已变动,请重新查找。", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         this.Close();
     }
     else
     {
         _RoleInfo.FillData();
         SetFormValue();
     }
 }
예제 #6
0
        private void FacePic_DoubleClick(object sender, EventArgs e)
        {
            Role currentRole = (Role)((PictureBox)sender).Tag;

            if (!Win32Lib.IsCorrectStartAddress(currentRole.Address))
            {
                GlobalSpecs.NeedReSearch = true;
                MessageBox.Show("内存地址已变动,请重新查找。", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            else
            {
                frmRoleInfo roleInfo = new frmRoleInfo(currentRole);
                roleInfo.ShowDialog();
            }
        }
예제 #7
0
        private bool WriteAction(CheckBox pData, MemoryData pMemory)
        {
            bool WriteSuccess = false;

            if (pData.Checked != (RoleLib.GetState(pMemory) == RoleState.has))
            {
                int lState = pData.Checked ? GlobalConst.Acion_Moved : GlobalConst.Acion_nonMoved;
                WriteSuccess = Win32Lib.WriteMemory(pMemory.Address, lState, 1);
                if (WriteSuccess == false)
                {
                    MessageBox.Show("写入失败");
                    return(false);
                }
            }
            return(true);
        }
예제 #8
0
        private bool WriteOneState(TextBox pData, MemoryData pMemory)
        {
            bool WriteSuccess = false;
            int  formVal      = 0;

            if (!int.TryParse(pData.Text, out formVal))
            {
                formVal = 0;
            }
            if (formVal != pMemory.IntVal)
            {
                WriteSuccess = Win32Lib.WriteMemory(pMemory.Address, formVal, 1);
                if (WriteSuccess == false)
                {
                    MessageBox.Show("写入失败");
                    return(false);
                }
            }
            return(true);
        }
예제 #9
0
 private void SaveOneItem(CheckBox pUsed, TextBox pItem, MemoryData pMemoryUsed, MemoryData pMemoryItem)
 {
     if (pItem.Text == "")
     {
         Win32Lib.WriteMemory(pMemoryUsed.Address, GlobalConst.Item_nonState, 1);
         Win32Lib.WriteMemory(pMemoryItem.Address, GlobalConst.Item_nonItem, 1);
     }
     else
     {
         ItemInfo item = RoleLib.GetItem(pItem.Text);
         Win32Lib.WriteMemory(pMemoryItem.Address, Convert.ToInt32(item.Code, 16), 1);
         if (pUsed.Checked)
         {
             Win32Lib.WriteMemory(pMemoryUsed.Address, GlobalConst.Item_Equiped, 1);
         }
         else
         {
             Win32Lib.WriteMemory(pMemoryUsed.Address, GlobalConst.Item_nonEquiped, 1);
         }
     }
 }
예제 #10
0
        public static bool WriteOneMagic(string[] magicCodeList, Role role)
        {
            bool WriteSuccess = false;

            MemoryData[] magicInfo = new MemoryData[] { role.M27_法术1, role.M28_法术2, role.M29_法术3, role.M30_法术4, role.M31_法术5 };

            for (int i = 0; i < magicInfo.Length; i++)
            {
                MemoryData magicitem = magicInfo[i];
                string     magicCode = magicCodeList[i];
                if (magicCode != magicitem.Value)
                {
                    WriteSuccess = Win32Lib.WriteMemory(magicitem.Address, int.Parse(magicCode), 1);
                    if (WriteSuccess == false)
                    {
                        return(false);
                    }
                }
            }

            return(true);
        }
예제 #11
0
        private void UPdateState()
        {
            if (GlobalSpecs.FDPSProcess != null && !GlobalSpecs.FDPSProcess.HasExited)
            {
                Win32Lib.UpdateSearchType();
                if (GlobalSpecs.MagicLocationAddress != "")
                {
                    if (GlobalSpecs.SearchType == MemorySearchType.battle)
                    {
                        toolStripStatusLabLocation.Text        = "战场";
                        toolStripStatusLabelLocationValue.Text = GlobalSpecs.MagicLocationAddress + " " + GlobalSpecs.RoundCount;
                    }
                    else
                    {
                        toolStripStatusLabLocation.Text        = "商店";
                        toolStripStatusLabelLocationValue.Text = GlobalSpecs.MagicLocationAddress + " " + GlobalSpecs.RoundCount;
                    }
                    return;
                }
            }

            toolStripStatusLabLocation.Text        = "";
            toolStripStatusLabelLocationValue.Text = "";
        }
예제 #12
0
        private bool AutoSearch()
        {
            try
            {
                GlobalSpecs.NeedReSearch = false;
                GlobalSpecs.RoleStartAddress.Clear();

                if (GlobalSpecs.FDPSProcess.HasExited)
                {
                    gBoxProcess.Text   = "进程   无";
                    gboxSearch.Enabled = false;
                    MessageBox.Show("游戏不存在!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return(false);
                }

                FrmAutoSerachQuestion fq = new FrmAutoSerachQuestion();
                if (fq.ShowDialog() == DialogResult.OK)
                {
                    GlobalSpecs.SearchType = fq.SearchType;
                }
                else
                {
                    return(false);
                }

                int[] magicData;
                magicData = Win32Lib.MagicDataLandis;

                Win32Lib.ProgramProcess = GlobalSpecs.FDPSProcess;
                int baseAddress = Win32Lib.SearchMemory(magicData, 1, -40);
                if (baseAddress == -1)
                {
                    magicData   = Win32Lib.MagicDataFalianNa;
                    baseAddress = Win32Lib.SearchMemory(magicData, 1, -40);
                }
                if (baseAddress == -1)
                {
                    MessageBox.Show("抱歉,没找到!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return(false);
                }

                string startAddress = Win32Lib.GetAddress(baseAddress);
                GlobalSpecs.SearchStartAddress = startAddress;
                GlobalSpecs.RoleStartAddress.AddRange(Win32Lib.GetAllRoleByStartAddress(startAddress));

                List <Role> friendsRoleList = new List <Role>();
                List <Role> enemyRoleList   = new List <Role>();
                List <Role> NpcRoleList     = new List <Role>();

                for (int i = 0; i < GlobalSpecs.RoleStartAddress.Count; i++)
                {
                    Role role = new Role(GlobalSpecs.RoleStartAddress[i]);
                    role.FillData();

                    if (role.M48_MaxHP.IntVal == 0 ||
                        role.M34_等级.IntVal == 0 ||
                        role.M44_移动.IntVal == 0 ||
                        role.M53_HIT.IntVal == 0 ||
                        role.M06_是否可动.IntVal == 1)
                    {
                        continue;
                    }

                    switch (role.M07_人物阵营.IntVal)
                    {
                    case 0:
                        enemyRoleList.Add(role);
                        break;

                    case 1:
                        NpcRoleList.Add(role);
                        break;

                    case 2:
                        friendsRoleList.Add(role);
                        break;

                    default:
                        break;
                    }
                }


                fLPanelFriend.Controls.Clear();
                fLPanelEnemy.Controls.Clear();
                fLPanelNPC.Controls.Clear();

                FillFlowLayoutPanel(fLPanelFriend, friendsRoleList);
                FillFlowLayoutPanel(fLPanelNPC, NpcRoleList);
                FillFlowLayoutPanel(fLPanelEnemy, enemyRoleList);

                MessageBox.Show("找到了!选角色开始改吧。", "好消息", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            catch (Exception ex)
            {
                MessageBox.Show("出错啦!" + Environment.NewLine + "去贴吧找我。记得保留存档,以及出错情况介绍 。", "坏了", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            return(true);
        }
예제 #13
0
        private bool SingleSearch()
        {
            GlobalSpecs.NeedReSearch = false;
            if (GlobalSpecs.FDPSProcess.HasExited)
            {
                gBoxProcess.Text   = "进程   无";
                gboxSearch.Enabled = false;
                MessageBox.Show("游戏不存在!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }

            if (txtSNowHP.Text == "" ||
                txtSMaxHP.Text == "" ||
                txtSNowMP.Text == "" ||
                txtSMaxMP.Text == "" ||
                txtSAP.Text == "" ||
                txtSDP.Text == "")
            {
                MessageBox.Show("所有条件必须都填!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }

            FrmAutoSerachQuestion fq = new FrmAutoSerachQuestion();

            if (fq.ShowDialog() == DialogResult.OK)
            {
                GlobalSpecs.SearchType = fq.SearchType;
            }
            else
            {
                return(false);
            }

            //GlobalSpecs.SearchType = MemorySearchType.self;

            int lNowHP;
            int lMaxHP;
            int lNowMP;
            int lMaxMP;
            int lAP;
            int lDP;

            int.TryParse(txtSNowHP.Text, out lNowHP);
            int.TryParse(txtSMaxHP.Text, out lMaxHP);
            int.TryParse(txtSNowMP.Text, out lNowMP);
            int.TryParse(txtSMaxMP.Text, out lMaxMP);
            int.TryParse(txtSAP.Text, out lAP);
            int.TryParse(txtSDP.Text, out lDP);

            Win32Lib.ProgramProcess = GlobalSpecs.FDPSProcess;
            int[] sampleData = new int[6];
            sampleData[0] = lNowHP;
            sampleData[1] = lMaxHP;
            sampleData[2] = lNowMP;
            sampleData[3] = lMaxMP;
            sampleData[4] = lAP;
            sampleData[5] = lDP;

            int baseAddress = Win32Lib.SearchMemory(sampleData, 2, -64);

            if (baseAddress == -1)
            {
                MessageBox.Show("抱歉,没找到!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }

            string startAddress = Win32Lib.GetAddress(baseAddress);

            if (!Win32Lib.IsCorrectStartAddress(startAddress))
            {
                MessageBox.Show("抱歉,没找到!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }

            GlobalSpecs.SearchStartAddress = startAddress;

            Role role = new Role(GlobalSpecs.SearchStartAddress);

            role.FillData();

            frmRoleInfo roleInfo = new frmRoleInfo(role);

            roleInfo.ShowDialog();

            return(true);
        }
예제 #14
0
 public static void Initialize()
 {
     SettingsLib.Initialize();
     Win32Lib.Initialize();
     MagicLib.Initialize();
 }