private WowUnit ReadWowUnit(IntPtr activeObject, WowObjectType wowObjectType) { if (WowInterface.XMemory.Read(IntPtr.Add(activeObject, WowInterface.OffsetList.WowObjectDescriptor.ToInt32()), out IntPtr descriptorAddress) && WowInterface.XMemory.ReadStruct(IntPtr.Add(activeObject, WowInterface.OffsetList.WowUnitPosition.ToInt32()), out Vector3 position) && WowInterface.XMemory.Read(IntPtr.Add(activeObject, WowInterface.OffsetList.WowUnitRotation.ToInt32()), out float rotation) && WowInterface.XMemory.Read(IntPtr.Add(activeObject, WowInterface.OffsetList.WowUnitIsAutoAttacking.ToInt32()), out int isAutoAttacking)) { WowUnit unit = new WowUnit(activeObject, wowObjectType) { DescriptorAddress = descriptorAddress, Position = position, Rotation = rotation, IsAutoAttacking = isAutoAttacking == 1 }; // First read the descriptor, then lookup the Name by GUID unit.UpdateRawWowUnit(WowInterface.XMemory); unit.Name = ReadUnitName(activeObject, unit.Guid); if (unit.Guid == TargetGuid) { unit.Auras = WowInterface.HookManager.GetUnitAuras(activeObject); } return(unit); } return(null); }
private WowPlayer ReadWowPlayer(IntPtr activeObject, WowObjectType wowObjectType) { if (WowInterface.XMemory.Read(IntPtr.Add(activeObject, WowInterface.OffsetList.WowObjectDescriptor.ToInt32()), out IntPtr descriptorAddress) && WowInterface.XMemory.ReadStruct(IntPtr.Add(activeObject, WowInterface.OffsetList.WowUnitPosition.ToInt32()), out Vector3 position)) { WowPlayer player = new WowPlayer(activeObject, wowObjectType) { DescriptorAddress = descriptorAddress, Position = position }; // First read the descriptor, then lookup the Name by GUID player.UpdateRawWowPlayer(WowInterface.XMemory); player.Name = ReadPlayerName(player.Guid); player.Auras = WowInterface.HookManager.GetUnitAuras(activeObject); if (PlayerGuid != 0 && player.Guid == PlayerGuid) { if (WowInterface.XMemory.Read(WowInterface.OffsetList.ComboPoints, out byte comboPoints)) { player.ComboPoints = comboPoints; } Player = player; } return(player); } return(null); }
public WowObject ReadWowObject(uint activeObject, WowObjectType wowObjectType = WowObjectType.None) => new WowObject() { BaseAddress = activeObject, DescriptorAddress = ReadUInt(activeObject + OffsetList.OffsetWowObjectDescriptor), Guid = ReadUInt64(activeObject + OffsetList.OffsetWowObjectGuid), Type = WowObjectType.Gameobject };
private WowGameobject ReadWowGameobject(IntPtr activeObject, WowObjectType wowObjectType) { WowObject wowObject = ReadWowObject(activeObject, wowObjectType); if (wowObject != null && XMemory.Read(IntPtr.Add(wowObject.DescriptorAddress, OffsetList.WowGameobjectType.ToInt32()), out WowGameobjectType gameobjectType) && XMemory.Read(IntPtr.Add(wowObject.DescriptorAddress, OffsetList.WowGameobjectLevel.ToInt32()), out int level) && XMemory.Read(IntPtr.Add(wowObject.DescriptorAddress, OffsetList.WowGameobjectDisplayId.ToInt32()), out int displayId) && XMemory.ReadStruct(IntPtr.Add(activeObject, OffsetList.WowGameobjectPosition.ToInt32()), out Vector3 wowPosition)) { return(new WowGameobject() { BaseAddress = activeObject, DescriptorAddress = wowObject.DescriptorAddress, Guid = wowObject.Guid, Position = wowPosition, Type = wowObjectType, DisplayId = displayId, Level = level, GameobjectType = gameobjectType, }); } return(null); }
public WowUnit ReadWowUnit(uint activeObject, WowObjectType wowObjectType = WowObjectType.Unit) { WowObject wowObject = ReadWowObject(activeObject, wowObjectType); return(new WowUnit() { BaseAddress = activeObject, DescriptorAddress = wowObject.DescriptorAddress, Guid = wowObject.Guid, Type = wowObjectType, Name = ReadUnitName(activeObject, wowObject.Guid), TargetGuid = ReadUInt64(wowObject.DescriptorAddress + OffsetList.DescriptorOffsetTargetGuid), Position = ReadObject <WowPosition>(activeObject + OffsetList.OffsetWowUnitPosition), FactionTemplate = ReadInt(wowObject.DescriptorAddress + OffsetList.DescriptorOffsetFactionTemplate), UnitFlags = ReadObject <BitVector32>(wowObject.DescriptorAddress + OffsetList.DescriptorOffsetUnitFlags), UnitFlagsDynamic = ReadObject <BitVector32>(wowObject.DescriptorAddress + OffsetList.DescriptorOffsetUnitFlagsDynamic), Health = ReadInt(wowObject.DescriptorAddress + OffsetList.DescriptorOffsetHealth), MaxHealth = ReadInt(wowObject.DescriptorAddress + OffsetList.DescriptorOffsetMaxHealth), Energy = ReadInt(wowObject.DescriptorAddress + OffsetList.DescriptorOffsetEnergy), MaxEnergy = ReadInt(wowObject.DescriptorAddress + OffsetList.DescriptorOffsetMaxEnergy), Level = ReadInt(wowObject.DescriptorAddress + OffsetList.DescriptorOffsetLevel), CurrentlyCastingSpellId = ReadInt(activeObject + OffsetList.OffsetCurrentlyCastingSpellId), CurrentlyChannelingSpellId = ReadInt(activeObject + OffsetList.OffsetCurrentlyChannelingSpellId) }); }
private WowDynobject ReadWowDynobject(IntPtr activeObject, WowObjectType wowObjectType) { WowObject wowObject = ReadWowObject(activeObject, wowObjectType); if (wowObject != null && XMemory.Read(IntPtr.Add(wowObject.DescriptorAddress, OffsetList.WowDynobjectCasterGuid.ToInt32()), out ulong casterGuid) && XMemory.Read(IntPtr.Add(wowObject.DescriptorAddress, OffsetList.WowDynobjectSpellId.ToInt32()), out int spellId) && XMemory.Read(IntPtr.Add(wowObject.DescriptorAddress, OffsetList.WowDynobjectRadius.ToInt32()), out float radius) && XMemory.Read(IntPtr.Add(wowObject.DescriptorAddress, OffsetList.WowDynobjectFacing.ToInt32()), out float facing)) { return(new WowDynobject() { BaseAddress = activeObject, DescriptorAddress = wowObject.DescriptorAddress, Guid = wowObject.Guid, Position = wowObject.Position, Type = wowObjectType, CasterGuid = casterGuid, SpellId = spellId, Radius = radius, Facing = facing }); } return(null); }
public WowPlayer ReadWowPlayer(uint activeObject, WowObjectType wowObjectType = WowObjectType.Player) { WowUnit wowUnit = ReadWowUnit(activeObject, wowObjectType); WowPlayer player = new WowPlayer() { BaseAddress = activeObject, DescriptorAddress = wowUnit.DescriptorAddress, Guid = wowUnit.Guid, Type = wowObjectType, Name = ReadPlayerName(wowUnit.Guid), TargetGuid = wowUnit.TargetGuid, Position = wowUnit.Position, FactionTemplate = wowUnit.FactionTemplate, UnitFlags = wowUnit.UnitFlags, UnitFlagsDynamic = wowUnit.UnitFlagsDynamic, Health = wowUnit.Health, MaxHealth = wowUnit.MaxHealth, Energy = wowUnit.Energy, MaxEnergy = wowUnit.MaxEnergy, Level = wowUnit.Level, CurrentlyCastingSpellId = wowUnit.CurrentlyCastingSpellId, CurrentlyChannelingSpellId = wowUnit.CurrentlyChannelingSpellId }; if (wowUnit.Guid == PlayerGuid) { player.Exp = ReadInt(wowUnit.DescriptorAddress + OffsetList.DescriptorOffsetExp); player.MaxExp = ReadInt(wowUnit.DescriptorAddress + OffsetList.DescriptorOffsetMaxExp); player.Race = (WowRace)ReadByte(OffsetList.StaticRace); player.Class = (WowClass)ReadByte(OffsetList.StaticClass); PlayerBase = activeObject; } return(player); }
public void UpdateObject(WowObjectType wowObjectType, IntPtr baseAddress) { WowObjects.RemoveAll(e => e.BaseAddress == baseAddress); switch (wowObjectType) { case WowObjectType.Gameobject: WowObjects.Add(ReadWowGameobject(baseAddress, wowObjectType)); break; case WowObjectType.Dynobject: WowObjects.Add(ReadWowDynobject(baseAddress, wowObjectType)); break; case WowObjectType.Unit: WowObjects.Add(ReadWowUnit(baseAddress, wowObjectType)); break; case WowObjectType.Player: WowObjects.Add(ReadWowPlayer(baseAddress, wowObjectType)); break; default: WowObjects.Add(ReadWowObject(baseAddress, wowObjectType)); break; } }
public void ReadAllWoWObjects() { if (!IsWorldLoaded) { return; } WowObjectList = new List <WowObject>(); uint clientConnection = ReadUInt(OffsetList.StaticClientConnection); uint currentObjectManager = ReadUInt(clientConnection + OffsetList.OffsetCurrentObjectManager); uint activeObject = ReadUInt(currentObjectManager + OffsetList.OffsetFirstObject); uint objectType = ReadUInt(activeObject + OffsetList.OffsetWowObjectType); while (IsWorldLoaded && (objectType <= 7 && objectType > 0)) { WowObjectType wowObjectType = (WowObjectType)objectType; switch (wowObjectType) { case WowObjectType.Unit: WowObjectList.Add(ReadWowUnit(activeObject, wowObjectType)); break; case WowObjectType.Player: WowObjectList.Add(ReadWowPlayer(activeObject, wowObjectType)); break; default: WowObjectList.Add(ReadWowObject(activeObject, wowObjectType)); break; } activeObject = ReadUInt(activeObject + OffsetList.OffsetNextObject); objectType = ReadUInt(activeObject + OffsetList.OffsetWowObjectType); } }
public WowPlayer ReadWowPlayer(IntPtr activeObject, WowObjectType wowObjectType = WowObjectType.Player) { WowUnit wowUnit = ReadWowUnit(activeObject, wowObjectType); if (wowUnit != null) { WowPlayer player = new WowPlayer() { BaseAddress = activeObject, CombatReach = wowUnit.CombatReach, DescriptorAddress = wowUnit.DescriptorAddress, Guid = wowUnit.Guid, Type = wowObjectType, Name = ReadPlayerName(wowUnit.Guid), TargetGuid = wowUnit.TargetGuid, Position = wowUnit.Position, Rotation = wowUnit.Rotation, FactionTemplate = wowUnit.FactionTemplate, UnitFlags = wowUnit.UnitFlags, UnitFlagsDynamic = wowUnit.UnitFlagsDynamic, Health = wowUnit.Health, MaxHealth = wowUnit.MaxHealth, Mana = wowUnit.Mana, MaxMana = wowUnit.MaxMana, Energy = wowUnit.Energy, MaxEnergy = wowUnit.MaxEnergy, Rage = wowUnit.Rage, MaxRage = wowUnit.MaxRage, Runeenergy = wowUnit.Runeenergy, MaxRuneenergy = wowUnit.MaxRuneenergy, Level = wowUnit.Level, Race = wowUnit.Race, Class = wowUnit.Class, Gender = wowUnit.Gender, PowerType = wowUnit.PowerType, IsAutoAttacking = wowUnit.IsAutoAttacking, CurrentlyCastingSpellId = wowUnit.CurrentlyCastingSpellId, CurrentlyChannelingSpellId = wowUnit.CurrentlyChannelingSpellId }; if (PlayerGuid != 0 && wowUnit.Guid == PlayerGuid) { if (XMemory.Read(IntPtr.Add(wowUnit.DescriptorAddress, OffsetList.DescriptorExp.ToInt32()), out int exp) && XMemory.Read(IntPtr.Add(wowUnit.DescriptorAddress, OffsetList.DescriptorMaxExp.ToInt32()), out int maxExp) && XMemory.Read(OffsetList.ComboPoints, out byte comboPoints)) { player.Exp = exp; player.MaxExp = maxExp; player.ComboPoints = comboPoints; } Player = player; } return(player); } return(null); }
private WowObject ReadWowObject(IntPtr activeObject, WowObjectType wowObjectType) { if (WowInterface.XMemory.Read(IntPtr.Add(activeObject, WowInterface.OffsetList.WowObjectDescriptor.ToInt32()), out IntPtr descriptorAddress) && WowInterface.XMemory.ReadStruct(IntPtr.Add(activeObject, WowInterface.OffsetList.WowObjectPosition.ToInt32()), out Vector3 position)) { WowObject obj = new WowObject(activeObject, wowObjectType) { DescriptorAddress = descriptorAddress, Position = position }; return(obj.UpdateRawWowObject(WowInterface.XMemory)); } return(null); }
public IEnumerator <WowObject> GetEnumerator() { IntPtr first = FirstObject(); // Must keep struct up to date in order for this to work int typeOffset = Marshal.OffsetOf(typeof(WowObjStruct), "ObjectType").ToInt32(); while (((first.ToInt64() & 1) == 0) && first != IntPtr.Zero) { WowObjectType type = (WowObjectType)Memory.Read <int>(first + typeOffset); switch (type) { case WowObjectType.Item: yield return(new WowItem(first)); break; case WowObjectType.Container: yield return(new WowContainer(first)); break; case WowObjectType.Unit: yield return(new WowUnit(first)); break; case WowObjectType.Player: yield return(new WowPlayer(first)); break; case WowObjectType.GameObject: yield return(new WowGameObject(first)); break; default: yield return(new WowObject(first)); break; } first = NextObject(first); } }
/// <summary> /// Read WoWObject from WoW's memory by its BaseAddress /// </summary> /// <param name="baseAddress">baseAddress of the object</param> /// <param name="woWObjectType">objectType of the object</param> /// <returns>the WoWObject</returns> public static WowObject ReadWoWObjectFromWoW(uint baseAddress, WowObjectType woWObjectType) { //AmeisenLogger.Instance.Log(LogLevel.VERBOSE, $"Reading: baseAddress [{baseAddress}]", "AmeisenCore"); if (baseAddress == 0) { return(null); } switch (woWObjectType) { case WowObjectType.CONTAINER: return(new Container(baseAddress, BlackMagic)); case WowObjectType.ITEM: return(new Item(baseAddress, BlackMagic)); case WowObjectType.GAMEOBJECT: return(new GameObject(baseAddress, BlackMagic)); case WowObjectType.DYNOBJECT: return(new DynObject(baseAddress, BlackMagic)); case WowObjectType.CORPSE: return(new Corpse(baseAddress, BlackMagic)); case WowObjectType.PLAYER: Player obj = new Player(baseAddress, BlackMagic); if (obj.Guid == ReadPlayerGUID()) { // thats me return(new Me(baseAddress, BlackMagic)); } return(obj); case WowObjectType.UNIT: return(new Unit(baseAddress, BlackMagic)); default: break; } return(null); }
public WowObject ReadWowObject(IntPtr activeObject, WowObjectType wowObjectType = WowObjectType.None) { if (XMemory.Read(IntPtr.Add(activeObject, OffsetList.WowObjectDescriptor.ToInt32()), out IntPtr descriptorAddress) && XMemory.Read(IntPtr.Add(activeObject, OffsetList.WowObjectGuid.ToInt32()), out ulong guid) && XMemory.ReadStruct(IntPtr.Add(activeObject, OffsetList.WowObjectPosition.ToInt32()), out Vector3 wowPosition)) { return(new WowObject() { BaseAddress = activeObject, DescriptorAddress = descriptorAddress, Guid = guid, Type = wowObjectType, Position = wowPosition }); } return(null); }
private WowPlayer ReadWowPlayer(IntPtr activeObject, WowObjectType wowObjectType) { if (WowInterface.XMemory.Read(IntPtr.Add(activeObject, WowInterface.OffsetList.WowObjectDescriptor.ToInt32()), out IntPtr descriptorAddress) && WowInterface.XMemory.ReadStruct(IntPtr.Add(activeObject, WowInterface.OffsetList.WowUnitPosition.ToInt32()), out Vector3 position) && WowInterface.XMemory.Read(IntPtr.Add(activeObject, WowInterface.OffsetList.WowUnitRotation.ToInt32()), out float rotation) && WowInterface.XMemory.Read(IntPtr.Add(activeObject, WowInterface.OffsetList.WowUnitIsAutoAttacking.ToInt32()), out int isAutoAttacking)) { WowPlayer player = new WowPlayer(activeObject, wowObjectType) { DescriptorAddress = descriptorAddress, Position = position, Rotation = rotation, IsAutoAttacking = isAutoAttacking == 1 }; // first read the descriptor, then lookup the Name by GUID player.UpdateRawWowPlayer(WowInterface.XMemory); player.Name = ReadPlayerName(player.Guid); if (player.Guid == PlayerGuid) { if (WowInterface.XMemory.Read(WowInterface.OffsetList.ComboPoints, out byte comboPoints)) { player.ComboPoints = comboPoints; } Player = player; } if (player.Guid == TargetGuid || player.Guid == PlayerGuid || PartymemberGuids.Contains(player.Guid)) { player.Auras = WowInterface.HookManager.GetUnitAuras(activeObject); } return(player); } return(null); }
public void UpdateObject(WowObjectType wowObjectType, IntPtr baseAddress) { lock (queryLock) { if (wowObjects.Count > 0) { wowObjects.RemoveAll(e => e.BaseAddress == baseAddress); WowObject obj = wowObjectType switch { WowObjectType.Dynobject => ReadWowDynobject(baseAddress, wowObjectType), WowObjectType.Gameobject => ReadWowGameobject(baseAddress, wowObjectType), WowObjectType.Player => ReadWowPlayer(baseAddress, wowObjectType), WowObjectType.Unit => ReadWowUnit(baseAddress, wowObjectType), WowObjectType.Corpse => ReadWowCorpse(baseAddress, wowObjectType), WowObjectType.Container => ReadWowContainer(baseAddress, wowObjectType), WowObjectType.Item => ReadWowItem(baseAddress, wowObjectType), _ => ReadWowObject(baseAddress, wowObjectType), }; wowObjects.Add(obj); } } }
public WowContainer(IntPtr baseAddress, WowObjectType type) : base(baseAddress, type) { }
public void UpdateWowObjects() { lock (queryLock) { IsWorldLoaded = UpdateGlobalVar <int>(WowInterface.OffsetList.IsWorldLoaded) == 1; if (!IsWorldLoaded) { return; } PlayerGuid = UpdateGlobalVar <ulong>(WowInterface.OffsetList.PlayerGuid); TargetGuid = UpdateGlobalVar <ulong>(WowInterface.OffsetList.TargetGuid); LastTargetGuid = UpdateGlobalVar <ulong>(WowInterface.OffsetList.LastTargetGuid); PetGuid = UpdateGlobalVar <ulong>(WowInterface.OffsetList.PetGuid); PlayerBase = UpdateGlobalVar <IntPtr>(WowInterface.OffsetList.PlayerBase); MapId = UpdateGlobalVar <MapId>(WowInterface.OffsetList.MapId); ZoneId = UpdateGlobalVar <int>(WowInterface.OffsetList.ZoneId); if (WowInterface.XMemory.Read(WowInterface.OffsetList.CameraPointer, out IntPtr cameraPointer) && WowInterface.XMemory.Read(IntPtr.Add(cameraPointer, WowInterface.OffsetList.CameraOffset.ToInt32()), out cameraPointer)) { Camera = UpdateGlobalVar <CameraInfo>(cameraPointer); } if (WowInterface.XMemory.Read(WowInterface.OffsetList.ZoneText, out IntPtr zoneNamePointer)) { ZoneName = UpdateGlobalVarString(zoneNamePointer); } if (WowInterface.XMemory.Read(WowInterface.OffsetList.ZoneSubText, out IntPtr zoneSubNamePointer)) { ZoneSubName = UpdateGlobalVarString(zoneSubNamePointer); } GameState = UpdateGlobalVarString(WowInterface.OffsetList.GameState); wowObjects.Clear(); // get the current objectmanager // better not cache it until we switched map WowInterface.XMemory.Read(WowInterface.OffsetList.ClientConnection, out IntPtr clientConnection); WowInterface.XMemory.Read(IntPtr.Add(clientConnection, WowInterface.OffsetList.CurrentObjectManager.ToInt32()), out IntPtr currentObjectManager); CurrentObjectManager = currentObjectManager; // read the first object WowInterface.XMemory.Read(IntPtr.Add(CurrentObjectManager, WowInterface.OffsetList.FirstObject.ToInt32()), out IntPtr activeObjectBaseAddress); WowInterface.XMemory.Read(IntPtr.Add(activeObjectBaseAddress, WowInterface.OffsetList.WowObjectType.ToInt32()), out int activeObjectType); while (IsWorldLoaded && activeObjectType <= 7 && activeObjectType > 0) { WowObjectType wowObjectType = (WowObjectType)activeObjectType; WowObject obj = wowObjectType switch { WowObjectType.Container => ReadWowContainer(activeObjectBaseAddress, wowObjectType), WowObjectType.Corpse => ReadWowCorpse(activeObjectBaseAddress, wowObjectType), WowObjectType.Item => ReadWowItem(activeObjectBaseAddress, wowObjectType), WowObjectType.Dynobject => ReadWowDynobject(activeObjectBaseAddress, wowObjectType), WowObjectType.Gameobject => ReadWowGameobject(activeObjectBaseAddress, wowObjectType), WowObjectType.Player => ReadWowPlayer(activeObjectBaseAddress, wowObjectType), WowObjectType.Unit => ReadWowUnit(activeObjectBaseAddress, wowObjectType), _ => ReadWowObject(activeObjectBaseAddress, wowObjectType), }; if (obj != null) { wowObjects.Add(obj); // set the global unit properties if a guid matches it if (obj.Guid == TargetGuid) { Target = (WowUnit)obj; } if (obj.Guid == PetGuid) { Pet = (WowUnit)obj; } if (obj.Guid == LastTargetGuid) { LastTarget = (WowUnit)obj; } } WowInterface.XMemory.Read(IntPtr.Add(activeObjectBaseAddress, WowInterface.OffsetList.NextObject.ToInt32()), out activeObjectBaseAddress); WowInterface.XMemory.Read(IntPtr.Add(activeObjectBaseAddress, WowInterface.OffsetList.WowObjectType.ToInt32()), out activeObjectType); } // read the party/raid leaders guid and if there is one, the group too PartyleaderGuid = ReadPartyLeaderGuid(); if (PartyleaderGuid > 0) { PartymemberGuids = ReadPartymemberGuids(); } } OnObjectUpdateComplete?.Invoke(WowObjects); }
public WowPlayer(IntPtr baseAddress, WowObjectType type) : base(baseAddress, type) { }
public WowCorpse(IntPtr baseAddress, WowObjectType type, IntPtr descriptorAddress) : base(baseAddress, type, descriptorAddress) { }
// W.I.P // This is going to reduce the ReadProcessMemory calls a lot public WowObject(IntPtr baseAddress, WowObjectType type) { BaseAddress = baseAddress; Type = type; }
public WowUnit(IntPtr baseAddress, WowObjectType type) : base(baseAddress, type) { }
public WowObject(IntPtr baseAddress, WowObjectType type, IntPtr descriptorAddress) { BaseAddress = baseAddress; Type = type; DescriptorAddress = descriptorAddress; }
public WowCorpse(IntPtr baseAddress, WowObjectType type) : base(baseAddress, type) { }
public WowGameobject(IntPtr baseAddress, WowObjectType type) : base(baseAddress, type) { }
public WowPlayer ReadWowPlayer(uint activeObject, WowObjectType wowObjectType = WowObjectType.Player) { return(null); }
public WowUnit ReadWowUnit(IntPtr activeObject, WowObjectType wowObjectType = WowObjectType.Unit) { WowObject wowObject = ReadWowObject(activeObject, wowObjectType); if (wowObject != null && XMemory.Read(IntPtr.Add(wowObject.DescriptorAddress, OffsetList.DescriptorTargetGuid.ToInt32()), out ulong targetGuid) && XMemory.ReadStruct(IntPtr.Add(activeObject, OffsetList.WowUnitPosition.ToInt32()), out Vector3 wowPosition) && XMemory.Read(IntPtr.Add(activeObject, OffsetList.PlayerRotation.ToInt32()), out float rotation) && XMemory.Read(IntPtr.Add(activeObject, OffsetList.IsAutoAttacking.ToInt32()), out int isAutoAttacking) && XMemory.Read(IntPtr.Add(wowObject.DescriptorAddress, OffsetList.DescriptorCombatReach.ToInt32()), out int combatReach) && XMemory.Read(IntPtr.Add(wowObject.DescriptorAddress, OffsetList.DescriptorFactionTemplate.ToInt32()), out int factionTemplate) && XMemory.Read(IntPtr.Add(wowObject.DescriptorAddress, OffsetList.DescriptorUnitFlags.ToInt32()), out BitVector32 unitFlags) && XMemory.Read(IntPtr.Add(wowObject.DescriptorAddress, OffsetList.DescriptorUnitFlagsDynamic.ToInt32()), out BitVector32 dynamicUnitFlags) && XMemory.Read(IntPtr.Add(wowObject.DescriptorAddress, OffsetList.DescriptorNpcFlags.ToInt32()), out BitVector32 npcFlags) && XMemory.Read(IntPtr.Add(wowObject.DescriptorAddress, OffsetList.DescriptorHealth.ToInt32()), out int health) && XMemory.Read(IntPtr.Add(wowObject.DescriptorAddress, OffsetList.DescriptorMaxHealth.ToInt32()), out int maxHealth) && XMemory.Read(IntPtr.Add(wowObject.DescriptorAddress, OffsetList.DescriptorMana.ToInt32()), out int mana) && XMemory.Read(IntPtr.Add(wowObject.DescriptorAddress, OffsetList.DescriptorMaxMana.ToInt32()), out int maxMana) && XMemory.Read(IntPtr.Add(wowObject.DescriptorAddress, OffsetList.DescriptorRage.ToInt32()), out int rage) && XMemory.Read(IntPtr.Add(wowObject.DescriptorAddress, OffsetList.DescriptorMaxRage.ToInt32()), out int maxRage) && XMemory.Read(IntPtr.Add(wowObject.DescriptorAddress, OffsetList.DescriptorEnergy.ToInt32()), out int energy) && XMemory.Read(IntPtr.Add(wowObject.DescriptorAddress, OffsetList.DescriptorMaxEnergy.ToInt32()), out int maxEnergy) && XMemory.Read(IntPtr.Add(wowObject.DescriptorAddress, OffsetList.DescriptorRuneenergy.ToInt32()), out int runeenergy) && XMemory.Read(IntPtr.Add(wowObject.DescriptorAddress, OffsetList.DescriptorMaxRuneenergy.ToInt32()), out int maxRuneenergy) && XMemory.Read(IntPtr.Add(wowObject.DescriptorAddress, OffsetList.DescriptorLevel.ToInt32()), out int level) && XMemory.Read(IntPtr.Add(wowObject.DescriptorAddress, OffsetList.DescriptorInfoFlags.ToInt32()), out int infoFlags) && XMemory.Read(IntPtr.Add(activeObject, OffsetList.CurrentlyCastingSpellId.ToInt32()), out int currentlyCastingSpellId) && XMemory.Read(IntPtr.Add(activeObject, OffsetList.CurrentlyChannelingSpellId.ToInt32()), out int currentlyChannelingSpellId)) { return(new WowUnit() { BaseAddress = activeObject, CombatReach = combatReach, DescriptorAddress = wowObject.DescriptorAddress, Guid = wowObject.Guid, Type = wowObjectType, Name = ReadUnitName(activeObject, wowObject.Guid), TargetGuid = targetGuid, Position = wowPosition, Rotation = rotation, FactionTemplate = factionTemplate, UnitFlags = unitFlags, UnitFlagsDynamic = dynamicUnitFlags, Health = health, MaxHealth = maxHealth, Mana = mana, MaxMana = maxMana, NpcFlags = npcFlags, Energy = energy, MaxEnergy = maxEnergy, Rage = rage / 10, MaxRage = maxRage / 10, Runeenergy = runeenergy / 10, MaxRuneenergy = maxRuneenergy / 10, Level = level, Race = Enum.IsDefined(typeof(WowRace), (WowRace)((infoFlags >> 0) & 0xFF)) ? (WowRace)((infoFlags >> 0) & 0xFF) : WowRace.Unknown, Class = Enum.IsDefined(typeof(WowClass), (WowClass)((infoFlags >> 8) & 0xFF)) ? (WowClass)((infoFlags >> 8) & 0xFF) : WowClass.Unknown, Gender = Enum.IsDefined(typeof(WowGender), (WowGender)((infoFlags >> 16) & 0xFF)) ? (WowGender)((infoFlags >> 16) & 0xFF) : WowGender.Unknown, PowerType = Enum.IsDefined(typeof(WowPowertype), (WowPowertype)((infoFlags >> 24) & 0xFF)) ? (WowPowertype)((infoFlags >> 24) & 0xFF) : WowPowertype.Unknown, IsAutoAttacking = isAutoAttacking == 1, CurrentlyCastingSpellId = currentlyCastingSpellId, CurrentlyChannelingSpellId = currentlyChannelingSpellId }); } return(null); }
public void UpdateWowObjects() { if (!XMemory.Read(OffsetList.IsWorldLoaded, out int isWorldLoaded)) { IsWorldLoaded = isWorldLoaded == 1; return; } if (XMemory.Read(OffsetList.PlayerGuid, out ulong playerGuid)) { PlayerGuid = playerGuid; } if (XMemory.Read(OffsetList.TargetGuid, out ulong targetGuid)) { TargetGuid = targetGuid; } if (XMemory.Read(OffsetList.TargetGuid, out ulong lastTargetGuid)) { LastTargetGuid = lastTargetGuid; } if (XMemory.Read(OffsetList.PetGuid, out ulong petGuid)) { PetGuid = petGuid; } if (XMemory.Read(OffsetList.TargetGuid, out IntPtr playerbase)) { PlayerBase = playerbase; } WowObjects = new List <WowObject>(); XMemory.Read(OffsetList.ClientConnection, out IntPtr clientConnection); XMemory.Read(IntPtr.Add(clientConnection, OffsetList.CurrentObjectManager.ToInt32()), out IntPtr currentObjectManager); XMemory.Read(IntPtr.Add(currentObjectManager, OffsetList.FirstObject.ToInt32()), out IntPtr activeObject); XMemory.Read(IntPtr.Add(activeObject, OffsetList.WowObjectType.ToInt32()), out int objectType); while (isWorldLoaded == 1 && (objectType <= 7 && objectType > 0)) { WowObjectType wowObjectType = (WowObjectType)objectType; WowObject obj = wowObjectType switch { WowObjectType.Gameobject => ReadWowGameobject(activeObject, wowObjectType), WowObjectType.Dynobject => ReadWowDynobject(activeObject, wowObjectType), WowObjectType.Unit => ReadWowUnit(activeObject, wowObjectType), WowObjectType.Player => ReadWowPlayer(activeObject, wowObjectType), _ => ReadWowObject(activeObject, wowObjectType), }; WowObjects.Add(obj); if (obj.Guid == TargetGuid) { Target = (WowUnit)obj; } if (obj.Guid == PetGuid) { Pet = (WowUnit)obj; } if (obj.Guid == LastTargetGuid) { LastTarget = (WowUnit)obj; } XMemory.Read(IntPtr.Add(activeObject, OffsetList.NextObject.ToInt32()), out activeObject); XMemory.Read(IntPtr.Add(activeObject, OffsetList.WowObjectType.ToInt32()), out objectType); } PartyleaderGuid = ReadPartyLeaderGuid(); PartymemberGuids = ReadPartymemberGuids(); if (XMemory.Read(OffsetList.MapId, out int mapId)) { MapId = mapId; } if (XMemory.Read(OffsetList.ZoneId, out int zoneId)) { ZoneId = zoneId; } OnObjectUpdateComplete?.Invoke(WowObjects); }
public WowObject ReadWowObject(uint activeObject, WowObjectType wowObjectType = WowObjectType.None) { return(null); }
public WowUnit ReadWowUnit(uint activeObject, WowObjectType wowObjectType = WowObjectType.Unit) { return(null); }