public BonfireStates GetBonfireState(BonfireFlags bonfire) { IntPtr pointer = (IntPtr)0x137E204; pointer = (IntPtr)MemoryTools.ReadInt(handle, pointer); pointer = (IntPtr)MemoryTools.ReadInt(handle, IntPtr.Add(pointer, 0xB48)); pointer = (IntPtr)MemoryTools.ReadInt(handle, IntPtr.Add(pointer, 0x24)); pointer = (IntPtr)MemoryTools.ReadInt(handle, pointer); IntPtr bonfirePointer = (IntPtr)MemoryTools.ReadInt(handle, IntPtr.Add(pointer, 0x8)); while (bonfirePointer != IntPtr.Zero) { int bonfireId = MemoryTools.ReadInt(handle, IntPtr.Add(bonfirePointer, 0x4)); if (bonfireId == (int)bonfire) { int bonfireState = MemoryTools.ReadInt(handle, IntPtr.Add(bonfirePointer, 0x8)); return((BonfireStates)bonfireState); } pointer = (IntPtr)MemoryTools.ReadInt(handle, pointer); bonfirePointer = (IntPtr)MemoryTools.ReadInt(handle, IntPtr.Add(pointer, 0x8)); } return(BonfireStates.Undiscovered); }
public static IntPtr Scan(Process process, byte?[] bytes, int offset) { var regions = GetRegions(process); var results = new List <IntPtr>(); foreach (IntPtr baseAddress in regions.Keys) { byte[] bytesRead = regions[baseAddress]; for (int i = 0; i < bytesRead.Length - bytes.Length; i++) { bool found = true; for (int j = 0; j < bytes.Length; j++) { if (bytes[j] != null && bytes[j] != bytesRead[i + j]) { found = false; break; } } if (found) { results.Add(baseAddress + i); } } } return((IntPtr)MemoryTools.ReadInt(process.Handle, results[0] + offset)); }
public void ResetEquipmentIndexes() { int[] slots = { 0x0, // Slot 7 0x4, // Slot 0 0x8, // Slot 8 0xC, // Slot 1 0x10, // Slot 9 0x10 + 0x8, // Slot 10 0x14, // Slot 11 0x14 + 0x8, // Slot 12 0x20, // Slot 14 0x20 + 0x4, // Slot 15 0x20 + 0x8, // Slot 16 0x20 + 0xC, // Slot 17 0x34, // Slot 18 0x34 + 0x4, // Slot 19 0x3C, // Slot 2 0x3C + 0x4, // Slot 3 0x3C + 0x8, // Slot 4 0x3C + 0xC, // Slot 5 0x3C + 0x10, // Slot 6 }; foreach (int slot in slots) { MemoryTools.Write(handle, pointers.Equipment + slot, uint.MaxValue); } }
private static byte[] ReadBytes(IntPtr handle, IntPtr address, int size) { int bytesRead = 0; byte[] result = new byte[size]; MemoryTools.ReadProcessMemory(handle, address, result, size, ref bytesRead); return(result); }
public int GetClearCount() { IntPtr pointer = (IntPtr)MemoryTools.ReadInt(handle, (IntPtr)0x1378700); if (pointer == IntPtr.Zero) { return(-1); } return(MemoryTools.ReadInt(handle, pointer + 0x3C)); }
private bool GetEventFlagState(int id) { if (GetEventFlagAddress(id, out int address, out uint mask)) { uint flags = (uint)MemoryTools.ReadInt(handle, (IntPtr)address); return((flags & mask) != 0); } return(false); }
public void Refresh(Process process) { IntPtr character = (IntPtr)MemoryTools.ReadInt(handle, (IntPtr)0x137DC70); character = (IntPtr)MemoryTools.ReadInt(handle, character + 0x4); character = (IntPtr)MemoryTools.ReadInt(handle, character); Character = character; IntPtr characterStats = (IntPtr)MemoryTools.ReadInt(handle, (IntPtr)0x1378700); characterStats = (IntPtr)MemoryTools.ReadInt(handle, characterStats + 0x8); CharacterStats = characterStats; CharacterMap = (IntPtr)MemoryTools.ReadInt(handle, character + 0x28); CharacterPosition = (IntPtr)MemoryTools.ReadInt(handle, CharacterMap + 0x1C); IntPtr inventory = (IntPtr)MemoryTools.ReadInt(handle, (IntPtr)0x1378700); inventory = (IntPtr)MemoryTools.ReadInt(handle, inventory + 0x8); Inventory = inventory + 0x1B8; WorldState = (IntPtr)MemoryTools.ReadInt(handle, (IntPtr)0x13784A0); Zone = (IntPtr)MemoryTools.ReadInt(handle, (IntPtr)0x137E204); }
public bool IsPlayerLoaded() { return(MemoryTools.ReadInt(handle, (IntPtr)0x137DC70) != 0); }
private bool GetEventFlagAddress(int id, out int address, out uint mask) { var eventFlagGroups = new Dictionary <string, int> { { "0", 0x00000 }, { "1", 0x00500 }, { "5", 0x05F00 }, { "6", 0x0B900 }, { "7", 0x11300 }, }; var eventFlagAreas = new Dictionary <string, int> { { "000", 00 }, { "100", 01 }, { "101", 02 }, { "102", 03 }, { "110", 04 }, { "120", 05 }, { "121", 06 }, { "130", 07 }, { "131", 08 }, { "132", 09 }, { "140", 10 }, { "141", 11 }, { "150", 12 }, { "151", 13 }, { "160", 14 }, { "170", 15 }, { "180", 16 }, { "181", 17 }, }; string idString = id.ToString("D8"); if (idString.Length == 8) { string group = idString.Substring(0, 1); string area = idString.Substring(1, 3); int section = int.Parse(idString.Substring(4, 1)); int number = int.Parse(idString.Substring(5, 3)); if (eventFlagGroups.ContainsKey(group) && eventFlagAreas.ContainsKey(area)) { int offset = eventFlagGroups[group]; offset += eventFlagAreas[area] * 0x500; offset += section * 128; offset += (number - (number % 32)) / 8; address = MemoryTools.ReadInt(handle, (IntPtr)0x137D7D4); address = MemoryTools.ReadInt(handle, (IntPtr)address); address += offset; mask = 0x80000000 >> (number % 32); return(true); } } address = 0; mask = 0; return(false); }
public int GetGameTimeInMilliseconds() { IntPtr pointer = (IntPtr)MemoryTools.ReadInt(handle, (IntPtr)0x1378700); return(MemoryTools.ReadInt(handle, IntPtr.Add(pointer, 0x68))); }
public int GetForcedAnimation() { return(MemoryTools.ReadInt(handle, pointers.Character + 0xFC)); }
public byte GetActiveAnimation() { return(MemoryTools.ReadByte(handle, pointers.Character + 0xC5C)); }
public CovenantFlags GetCovenant() { return((CovenantFlags)MemoryTools.ReadByte(handle, pointers.CharacterStats + 0x10B)); }
// Note that the last bonfire value doesn't always correspond to a valid bonfire ID. public int GetLastBonfire() { // For whatever reason, bonfire IDs retrieved in this way need to be corrected by a thousand to match the // bonfire flags array. return(MemoryTools.ReadInt(handle, pointers.WorldState + 0xB04) - 1000); }
public int GetPlayerHP() { return(MemoryTools.ReadInt(handle, pointers.CharacterStats + 0xC)); }
public float GetPlayerZ() { return(MemoryTools.ReadFloat(handle, pointers.CharacterPosition + 0x18)); }
// Every time the player uses an item that requires a yes/no confirmation box, the ID of the item can be // retreived. That ID remains in place until the item's animation is complete. public int GetPromptedItem() { return(MemoryTools.ReadInt(handle, pointers.Character + 0x62C)); }
// "Prompted menu" here refers to the small menu near the bottom of the screen (such as yes/no confirmation // boxes). Each box has a unique ID (based on the text displayed). public byte GetPromptedMenu() { // The prompted menu ID is stored using a static address. return(MemoryTools.ReadByte(handle, (IntPtr)0x12E33E0)); }
public bool IsLoadScreenVisible() { return(MemoryTools.ReadBoolean(handle, pointers.WorldState - 0x37EF4)); }
public byte GetArea() { return(MemoryTools.ReadByte(handle, pointers.Zone + 0xA12)); }
// In this context, "World" (and "Area" below) refer to large geographic locations within the world. The two // values together can be used to roughly determine where you are (although not with the precision of // individual named zones). public byte GetWorld() { return(MemoryTools.ReadByte(handle, pointers.Zone + 0xA13)); }