private static void init() { if (_rSiteDB2 == null) { var mDefinitions = DBFilesClient.Load(Application.StartupPath + @"\Data\DBFilesClient\dblayout.xml"); var definitions = mDefinitions.Tables.Where(t => t.Name == "ResearchSite"); if (!definitions.Any()) { definitions = mDefinitions.Tables.Where(t => t.Name == Path.GetFileName("ResearchSite")); } if (definitions.Count() == 1) { var table = definitions.First(); if (Usefuls.GetClientLanguage().Length == 4) { _rSiteDB2 = DBReaderFactory.GetReader(Application.StartupPath + @"\Data\DBFilesClient\" + Usefuls.GetClientLanguage() + @"\ResearchSite.db2", table) as DB6Reader; } else { _rSiteDB2 = DBReaderFactory.GetReader(Application.StartupPath + @"\Data\DBFilesClient\AllWoW\ResearchSite.db2", table) as DB6Reader; } if (_cachedResearchSiteRows == null || _cachedRecords == null) { if (_rSiteDB2 != null) { _cachedResearchSiteRows = _rSiteDB2.Rows.ToArray(); _cachedRecords = new ResearchSiteDb2Record[_cachedResearchSiteRows.Length]; for (int i = 0; i < _cachedResearchSiteRows.Length - 1; i++) { _cachedRecords[i] = DB6Reader.ByteToType <ResearchSiteDb2Record>(_cachedResearchSiteRows[i]); } } } Logging.Write(_rSiteDB2.FileName + " loaded with " + _rSiteDB2.RecordsCount + " entries."); } else { Logging.Write("DB2 ResearchSite not read-able."); } } }
public static void TagMonstersArround(Spell spellToUses, float range, List <int> entry = null) { Usefuls.SleepGlobalCooldown(); foreach (WoWUnit u in ObjectManager.ObjectManager.GetObjectWoWUnit60Yards()) { if (!u.IsAlive || u.InCombat || (entry != null && !entry.Contains(u.Entry)) || UnitRelation.GetReaction(ObjectManager.ObjectManager.Me.Faction, u.Faction) <= Reaction.Hostile) { continue; } if (!u.IsInRange(range)) { continue; } if (ObjectManager.ObjectManager.Me.Target != u.Guid) { Interact.InteractWith(u.GetBaseAddress, true); Thread.Sleep(100); spellToUses.Cast(true); return; } } }
public static void CGPlayer_C__ClickToMove(Single x, Single y, Single z, UInt128 guid, Int32 action, Single precision, bool forceCTM = false) { try { if (!forceCTM && ObjectManager.ObjectManager.Me.TransportGuid <= 0) { CGPlayer_C__MoveTo(new Vector3(x, y, z)); return; } if (!Usefuls.InGame && !Usefuls.IsLoading) { return; } Helpful.Timer timer = new Helpful.Timer(2000); while (ObjectManager.ObjectManager.Me.GetBaseAddress == 0) { if (timer.IsReady) { return; } Thread.Sleep(200); } Usefuls.UpdateLastHardwareAction(); if (x == 0 && y == 0 && z == 0 && guid == 0) { return; } // Allocate Memory: uint posCodecave = Memory.WowMemory.Memory.AllocateMemory(0x4 * 3); uint guidCodecave = Memory.WowMemory.Memory.AllocateMemory(32); uint precisionCodecave = Memory.WowMemory.Memory.AllocateMemory(0x4); if (posCodecave <= 0 || guidCodecave <= 0 || precisionCodecave <= 0) { return; } // Write value: Memory.WowMemory.Memory.WriteInt128(guidCodecave, guid); Memory.WowMemory.Memory.WriteInt128(guidCodecave + (uint)Marshal.SizeOf(guid), ObjectManager.ObjectManager.Me.TransportGuid); Memory.WowMemory.Memory.WriteFloat(precisionCodecave, precision); Memory.WowMemory.Memory.WriteFloat(posCodecave, x); Memory.WowMemory.Memory.WriteFloat(posCodecave + 0x4, y); Memory.WowMemory.Memory.WriteFloat(posCodecave + 0x8, z); // BOOL __thiscall CGPlayer_C__ClickToMove(WoWActivePlayer *this, CLICKTOMOVETYPE clickType, WGUID *interactGuid, WOWPOS *clickPos, float precision) /*string[] asm = new[] * { * "mov edx, [" + precisionCodecave + "]", * "push edx", * "push " + posCodecave, * "push " + guidCodecave, * "mov esi, " + action, // move the last push into esi * "mov ecx, " + ObjectManager.ObjectManager.Me.GetBaseAddress, // get player pointer to ecx prior to call * "jmp " + (Memory.WowProcess.WowModule + (uint) Addresses.FunctionWow.PushESI), // jmp on a "push esi / call ctm" * "@out:", * "retn" * };*/ string[] asm = new[] { "mov edx, [" + precisionCodecave + "]", "push edx", "push " + posCodecave, "push " + guidCodecave, "push " + action, // move the last push into esi "mov ecx, " + ObjectManager.ObjectManager.Me.GetBaseAddress, // get player pointer to ecx prior to call "mov edx, " + (Memory.WowProcess.WowModule + (uint)Addresses.FunctionWow.CGPlayer_C__ClickToMove), // get player pointer to ecx prior to call "jmp " + (Memory.WowProcess.WowModule + (uint)Addresses.FunctionWow.WoWTextCaller), // jmp on a "push esi / call ctm" "@out:", "retn" }; Memory.WowMemory.InjectAndExecute(asm); Memory.WowMemory.Memory.FreeMemory(posCodecave); Memory.WowMemory.Memory.FreeMemory(guidCodecave); Memory.WowMemory.Memory.FreeMemory(precisionCodecave); if (cache != new Vector3(x, y, z)) { Logging.WriteNavigator("MoveTo(" + x + ", " + y + ", " + z + ", " + guid + ", " + action + ", " + precision + ")"); cache = new Vector3(x, y, z); } } catch (Exception exception) { Logging.WriteError( "CGPlayer_C__ClickToMove(Single x, Single y, Single z, UInt64 guid, Int32 action, Single precision): " + exception); } }
public static void InteractWith(uint baseAddress, bool stopMove = false) { try { if (!Usefuls.InGame || Usefuls.IsLoading) { return; } Helpful.Timer timer = new Helpful.Timer(2000); while (ObjectManager.ObjectManager.Me.GetBaseAddress == 0) { if (timer.IsReady) { return; } Thread.Sleep(200); } if (_firstRun) { if (ObjectManager.ObjectManager.Me.WowClass == WoWClass.Druid) { _stealth = new Spell("Prowl"); } if (ObjectManager.ObjectManager.Me.WowClass == WoWClass.Rogue) { _stealth = new Spell("Stealth"); } _firstRun = false; } if (_stealth != null && _stealth.KnownSpell) { foreach (var aura in ObjectManager.ObjectManager.Me.UnitAuras.Auras) { if (_stealth.Ids.Contains(aura.AuraSpellId)) { aura.TryCancel(); break; } } } Usefuls.UpdateLastHardwareAction(); if (baseAddress > 0) { WoWObject to = new WoWObject(baseAddress); if (!to.IsValid) { return; } if (to.Guid <= 0) { return; } uint codecaveGUID = Memory.WowMemory.Memory.AllocateMemory(0x10); Memory.WowMemory.Memory.WriteBytes(codecaveGUID, to.Guid.ToByteArray()); string[] asm = new[] { /*"call " + * (Memory.WowProcess.WowModule + * (uint) Addresses.FunctionWow.ClntObjMgrGetActivePlayer) * , * "test eax, eax", * "je @out",*/ /*"call " + * (Memory.WowProcess.WowModule + * (uint) Addresses.FunctionWow.ClntObjMgrGetActivePlayerObj), * "test eax, eax", * "je @out",*/ "push " + codecaveGUID, "mov ecx, " + ObjectManager.ObjectManager.Me.GetBaseAddress, "call " + (Memory.WowProcess.WowModule + (uint)Addresses.FunctionWow.CGUnit_C__Interact), "add esp, 4", "@out:", "retn" }; Memory.WowMemory.InjectAndExecute(asm); Memory.WowMemory.Memory.FreeMemory(codecaveGUID); if (stopMove) { MovementManager.StopMove(); } Thread.Sleep(Usefuls.Latency); } } catch (Exception exception) { Logging.WriteError("InteractGameObject(uint baseAddress): " + exception); } }