示例#1
0
        public long ScanHotbar()
        {
            int  skillID;
            long cdptr   = 0;
            long unitPtr = pModuleHotbar + 0x3C;

            //byte[] buffer;
            for (int row = 0; row < 10; row++)
            {
                for (int unit = 0; unit < 12; unit++)
                {
                    //buffer = mReader.ReadByteArray((IntPtr)(unitPtr), 0x40);
                    //hotbar.AddUnit(buffer, row, unit);

                    if (mReader.ReadInt32((IntPtr)(unitPtr)) == 0x2c)
                    {
                        skillID = mReader.ReadInt32((IntPtr)(unitPtr + 0xC));
                        if (skillID == BLID)
                        {
                            cdptr = unitPtr + 0x28;
                        }
                    }
                    unitPtr += 0x40;
                }
                unitPtr += 0x100;
            }
            return(cdptr);
        }
示例#2
0
#pragma warning restore CS0649

            public IntPtr LocateBaseObject(IntPtr completeObjectAddr, ProcessMemoryReader reader)
            {
                completeObjectAddr += mdisp;
                if (pdisp != -1)
                {
                    IntPtr vtbl = completeObjectAddr + pdisp;
                    completeObjectAddr += reader.ReadInt32(vtbl + vdisp);
                }
                return(completeObjectAddr);
            }
示例#3
0
        // StatCostClassId => looks like statcost is in high bits and class is in low bits
        // example:
        // 00AC0000
        // 00AC => statcost idx
        // 0000 => class id
        public static int GetArrayIndexByStatCostClassId(ProcessMemoryReader r, IntPtr addr, int StatCostClassId)
        {
            D2StatArray statArray    = r.Read <D2StatArray>(addr);
            ushort      statArrayLen = statArray.Length;

            if (statArrayLen < 1)
            {
                return(-1);
            }

            for (int i = statArrayLen - 1; i >= 0; i--)
            {
                // read the itemstatcost
                //
                int value = r.ReadInt32(statArray.Address.Address + i * 8);
                if (value == StatCostClassId)
                {
                    return(i);
                }
            }


            return(-1);
        }
 public void ReadMapID()
 {
     MapIDLabel.Text = "区域ID:" + mReader.ReadInt32((IntPtr)((long)mReader.process.Modules[0].BaseAddress + ZoneIDPtr));
 }
示例#5
0
        public Combatant GetCombatantByPtr(IntPtr CombatantPtr)
        {
            byte b = mReader.ReadByte(IntPtr.Add(CombatantPtr, 140));

            if (b != 1 && b != 2)
            {
                return(null);
            }
            Combatant combatant = new Combatant();

            combatant.Pointer = CombatantPtr;
            combatant.type    = b;
            combatant.ID      = (uint)mReader.ReadInt32(IntPtr.Add(CombatantPtr, 116));
            if (combatant.ID == 0 || combatant.ID == 3758096384u)
            {
                return(null);
            }
            byte[] array = mReader.ReadByteArray(IntPtr.Add(CombatantPtr, 48), 64);
            if (array == null || array.Length == 0)
            {
                return(null);
            }
            combatant.Name = (Encoding.UTF8.GetString(array) ?? "");
            if (combatant.Name.IndexOf('\0') > 0)
            {
                combatant.Name = combatant.Name.Substring(0, combatant.Name.IndexOf('\0'));
            }
            if (combatant.Name.IndexOf('\0') == 0)
            {
                return(null);
            }
            if (combatant.Name.Length == 0)
            {
                return(null);
            }
            combatant.OwnerID = (uint)mReader.ReadInt32(IntPtr.Add(CombatantPtr, 132));
            if (combatant.OwnerID == 3758096384u)
            {
                combatant.OwnerID = 0u;
            }
            combatant.BNpcID = (uint)mReader.ReadInt32(IntPtr.Add(CombatantPtr, 128));
            byte[] value = mReader.ReadByteArray(IntPtr.Add(CombatantPtr, 160), 20);
            combatant.PosX = BitConverter.ToSingle(value, 0);
            combatant.PosZ = BitConverter.ToSingle(value, 4);
            combatant.PosY = BitConverter.ToSingle(value, 8);
            int WorldOffset = 5966;

            combatant.WorldID = BitConverter.ToUInt16(mReader.ReadByteArray(IntPtr.Add(CombatantPtr, WorldOffset), 2), 0);
            if (combatant.WorldID == 65535)
            {
                combatant.WorldID   = 0;
                combatant.WorldName = "";
            }
            else
            {
                //combatant.WorldName = WorldList.Instance.GetWorldNameById(combatant.WorldID);
            }
            int offset2 = 5936;

            combatant.BNpcNameID = (uint)mReader.ReadInt32(IntPtr.Add(CombatantPtr, offset2));
            int offset3 = 5976;

            byte[] array2 = mReader.ReadByteArray(IntPtr.Add(CombatantPtr, offset3), 60);
            if (array2 != null && array2.Length == 60)
            {
                combatant.CurrentHP = BitConverter.ToInt32(array2, 0);
                combatant.MaxHP     = BitConverter.ToInt32(array2, 4);
                combatant.CurrentMP = BitConverter.ToInt32(array2, 8);
                combatant.MaxMP     = BitConverter.ToInt32(array2, 12);
                combatant.CurrentTP = BitConverter.ToInt16(array2, 16);
                combatant.MaxTP     = 1000;
                if (combatant.CurrentTP < 0)
                {
                    combatant.CurrentTP = 0;
                }
                else if (combatant.CurrentTP > combatant.MaxTP)
                {
                    combatant.CurrentTP = combatant.MaxTP;
                }
                combatant.CurrentGP = BitConverter.ToInt16(array2, 18);
                combatant.MaxGP     = BitConverter.ToInt16(array2, 20);
                if (combatant.MaxGP == 0)
                {
                    combatant.CurrentGP = 0;
                }
                combatant.CurrentCP = BitConverter.ToInt16(array2, 22);
                combatant.MaxCP     = BitConverter.ToInt16(array2, 24);
                combatant.Job       = array2[56];
                combatant.Level     = array2[58];
            }
            int offset4 = 6912;

            byte[] array3 = mReader.ReadByteArray(IntPtr.Add(CombatantPtr, offset4), 64);
            if (array3 != null && array3.Length == 64)
            {
                combatant.IsCasting           = (array3[0] == 1 && array3[1] == 1);
                combatant.CastBuffID          = BitConverter.ToUInt32(array3, 4);
                combatant.CastTargetID        = BitConverter.ToUInt32(array3, 16);
                combatant.CastDurationCurrent = BitConverter.ToSingle(array3, 52);
                combatant.CastDurationMax     = BitConverter.ToSingle(array3, 56);
            }
            return(combatant);
        }