public RunAsmHookModule(Action <IntPtr> onUpdate, Action <IHookModule> tick, WowMemoryApi memory, uint allocSize)
 {
     Memory       = memory;
     AllocSize    = allocSize;
     OnDataUpdate = onUpdate;
     Tick         = tick;
 }
Beispiel #2
0
        public virtual void Init(WowMemoryApi memory, IntPtr baseAddress, IntPtr descriptorAddress)
        {
            Memory            = memory;
            BaseAddress       = baseAddress;
            DescriptorAddress = descriptorAddress;

            Update();
        }
Beispiel #3
0
        public DefaultCharacterManager(IWowInterface wowInterface, WowMemoryApi memory, AmeisenBotConfig config)
        {
            Wow       = wowInterface;
            MemoryApi = memory;

            Inventory        = new(Wow, config);
            Equipment        = new(Wow);
            SpellBook        = new(Wow);
            TalentManager    = new(Wow);
            LastLevelTrained = 0;
            ItemComparator   = new ItemLevelComparator();
            Skills           = new();
            ItemSlotsToSkip  = new();
        }
Beispiel #4
0
 public TracelineJumpHookModule(Action <IntPtr> onUpdate, Action <IHookModule> tick, WowMemoryApi memory) : base(onUpdate, tick, memory, 256)
 {
 }
Beispiel #5
0
 public ObjectManager548(WowMemoryApi memory)
     : base(memory)
 {
 }
 public RunLuaHookModule(Action <IntPtr> onUpdate, Action <IHookModule> tick, WowMemoryApi memory, string lua, string varName, uint allocSize = 128) : base(onUpdate, tick, memory, allocSize)
 {
     Lua     = lua;
     VarName = varName;
 }
 public EndSceneHook548(WowMemoryApi memory)
     : base(memory)
 {
     OriginalFunctionBytes = new();
 }
        public WowInterface548(WowMemoryApi memory)
        {
            Memory      = memory;
            HookModules = new();

            // lua variable names for the event hook
            string handlerName     = BotUtils.FastRandomStringOnlyLetters();
            string tableName       = BotUtils.FastRandomStringOnlyLetters();
            string eventHookOutput = BotUtils.FastRandomStringOnlyLetters();

            // name of the frame used to capture wows events
            string eventHookFrameName = BotUtils.FastRandomStringOnlyLetters();

            EventManager = new(LuaDoString, eventHookFrameName);

            // module to process wows events.
            HookModules.Add(new RunLuaHookModule
                            (
                                (x) =>
            {
                if (x != IntPtr.Zero &&
                    memory.ReadString(x, Encoding.UTF8, out string s) &&
                    !string.IsNullOrWhiteSpace(s))
                {
                    EventManager.OnEventPush(s);
                }
            },
                                null,
                                memory,
                                LuaEventHook.Get(eventHookFrameName, tableName, handlerName, eventHookOutput),
                                eventHookOutput
                            ));

            string staticPopupsVarName = BotUtils.FastRandomStringOnlyLetters();
            string oldPoupString       = string.Empty;

            // module that monitors the STATIC_POPUP windows.
            HookModules.Add(new RunLuaHookModule
                            (
                                (x) =>
            {
                if (x != IntPtr.Zero &&
                    memory.ReadString(x, Encoding.UTF8, out string s) &&
                    !string.IsNullOrWhiteSpace(s))
                {
                    if (!oldPoupString.Equals(s, StringComparison.Ordinal))
                    {
                        OnStaticPopup?.Invoke(s);
                        oldPoupString = s;
                    }
                }
                else
                {
                    oldPoupString = string.Empty;
                }
            },
                                null,
                                memory,
                                $"{staticPopupsVarName}=\"\"for b=1,STATICPOPUP_NUMDIALOGS do local c=_G[\"StaticPopup\"..b]if c:IsShown()then {staticPopupsVarName}={staticPopupsVarName}..b..\":\"..c.which..\"; \"end end",
                                staticPopupsVarName
                            ));

            string battlegroundStatusVarName = BotUtils.FastRandomStringOnlyLetters();
            string oldBattlegroundStatus     = string.Empty;

            // module to monitor the battleground (and queue) status.
            HookModules.Add(new RunLuaHookModule
                            (
                                (x) =>
            {
                if (x != IntPtr.Zero &&
                    memory.ReadString(x, Encoding.UTF8, out string s) &&
                    !string.IsNullOrWhiteSpace(s))
                {
                    if (!oldBattlegroundStatus.Equals(s, StringComparison.Ordinal))
                    {
                        OnBattlegroundStatus?.Invoke(s);
                        oldBattlegroundStatus = s;
                    }
                }
                else
                {
                    oldBattlegroundStatus = string.Empty;
                }
            },
                                null,
                                memory,
                                $"{battlegroundStatusVarName}=\"\"for b=1,2 do local c,d,e,f,g,h=GetBattlefieldStatus(b)local i=GetBattlefieldTimeWaited(b)/1000;{battlegroundStatusVarName}={battlegroundStatusVarName}..b..\":\"..tostring(c or\"unknown\")..\":\"..tostring(d or\"unknown\")..\":\"..tostring(e or\"unknown\")..\":\"..tostring(f or\"unknown\")..\":\"..tostring(g or\"unknown\")..\":\"..tostring(h or\"unknown\")..\":\"..tostring(i or\"unknown\")..\";\"end",
                                battlegroundStatusVarName
                            ));

            // module to detect small obstacles that we can jump over
            HookModules.Add(new TracelineJumpHookModule
                            (
                                null,
                                (x) =>
            {
                IntPtr dataPtr = x.GetDataPointer();

                if (dataPtr != IntPtr.Zero && Player != null)
                {
                    Vector3 playerPosition = Player.Position;
                    playerPosition.Z      += 1.3f;

                    Vector3 pos = BotUtils.MoveAhead(playerPosition, Player.Rotation, 0.25f);
                    memory.Write(dataPtr, (1.0f, playerPosition, pos));
                }
            },
                                memory
                            ));

            ObjectManager = new(memory);

            Hook = new(memory);
            Hook.OnGameInfoPush += ObjectManager.HookManagerOnGameInfoPush;
        }
 public ObjectManager335a(WowMemoryApi memory)
     : base(memory)
 {
 }
 public EndSceneHook335a(WowMemoryApi memory)
     : base(memory)
 {
     Memory = memory;
     OriginalFunctionBytes = new();
 }