Skip to content
View in the app

A better way to browse. Learn more.

WRobot

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Stop quest turn in and inject my own code?

Featured Replies

Hey @Droidz,

currently, I'm trying to execute my own code instead of letting wRobot finish the quest (very last step - select item and complete quest).
I've been doing it like this:

EventsLua.AttachEventLua((LuaEventsId) Enum.Parse(typeof(LuaEventsId), "QUEST_COMPLETE"), QuestCompleteHandler);
private static void QuestCompleteHandler(object context)
{
  PluginLog.Log("About to complete quest - INTERCEPT!");
  SelectQuestItem();
}

private static  void SelectQuestItem()
{
  //my logic to turn in quest
  Lua.LuaDoString($@"
                  QuestRewardItem{index}:Click();
                  QuestFrameCompleteQuestButton:Click();
  ");
}

However, it seems wRobot will still be faster in turning in the quest and although I can correctly log which is the best item to choose, wRobot will select another item and finish the quest.
If I run this code in wRotation and manually open the quest dialog, it works 100%.

How can I stop the quester from turning it at that point? I've tried using Products.InPause = true and pausing the bot before selecting the quest item myself, but it doesn't seem to work.

Edited by Matenia

  • Author
16 minutes ago, Droidz said:

Hello, try to use ingame lua event like:


f  = CreateFrame('Frame')
f:RegisterAllEvents()
f:SetScript('OnEvent',
    function()
        if event and tostring(event) == 'QUEST_COMPLETE' then
            QuestRewardItem{index}:Click();
            QuestFrameCompleteQuestButton:Click();
        end
    end
)

(use random name for "f" and "'Frame'")

This does not work, because I rely in C# to parse item code from quest items.
I will try to hook QuestFrameCompleteQuestButton.Click and see if I can prevent the original click by wRobot (does wRobot use memory writing or Lua to achieve this?).

WRobot use lua to turnin quest.

You can try code like: 

        ulong lastTarget = 0;
        wManager.Events.InteractEvents.OnInteractPulse += (target, cancelable) =>
        {
            try
            {
                if (lastTarget == target)
                    return;

                var o = ObjectManager.GetObjectByGuid(target);
                if (o.IsValid && o.Type == WoWObjectType.Unit)
                {
                    var unit = new WoWUnit(o.GetBaseAddress);
                    if (unit.IsValid && unit.NpcMarker == NpcMarker.YellowQuestion)
                    {
                        lastTarget = target;
                        Interact.InteractGameObject(target);
                        // your turnin code here
                    }
                }
            }
            catch { }
        };
    }

or

        ulong lastTarget = 0;
        wManager.Events.InteractEvents.OnInteractPulse += (target, cancelable) =>
        {
            try
            {
                if (lastTarget == target)
                    return;

                if (!Logging.Status.StartsWith("Quester > TurnIn"))
                    return;

                var o = ObjectManager.GetObjectByGuid(target);
                if (o.IsValid && o.Type == WoWObjectType.Unit)
                {
                    var unit = new WoWUnit(o.GetBaseAddress);
                    if (unit.IsValid)
                    {
                        lastTarget = target;
                        cancelable.Cancel = true;
                        Interact.InteractGameObject(target);
                        // your turnin code here
                    }
                }
            }
            catch { }
        };

 

  • Author

How does wRobot turn in a quest using Lua? Can you give me an example, please?
I wrote a hook in Lua to prevent wRobot from turning in fast. 

The problem is, it works perfectly if I "click" on the button (by mouse) ingame or call QuestFrameCompleteButton:Click() but it doesn't work when Quest product.

Even calling QuestFrameCompleteQuestButton:Disable() - the bot will STILL turn the quest in.
Edit: I found out wRobot uses GetQuestReward, so it's possible to hook it using this:

_GetQuestReward = GetQuestReward;
                function GetQuestReward(index, force)
                    if(force) then
                        return _GetQuestReward(index);
                    else
                        C_Timer.After(1000, function()
                            DEFAULT_CHAT_FRAME:AddMessage('Delay quest turn in by 1000ms');
                            return _GetQuestReward(index);
                        end);
                    end
                end
Lua.LuaDoString(@"
            local C_Timer = CreateFrame(""Frame"", ""C_Timer"", UIParent);
            C_Timer:Show();
            C_Timer.schedule = {};
            C_Timer:SetScript(""OnUpdate"", function(self, elapsed)
                self = C_Timer;
                elapsed = 1/GetFramerate();

                for timestamp, callback in pairs(self.schedule) do
                    if tonumber(timestamp) <= GetTime() then
                        callback();
                        self.schedule[timestamp] = nil;
                    end
                end
            end);
            
            C_Timer.After = function(duration, callback)
                C_Timer.schedule[tonumber(GetTime() + (duration / 1000))] = callback;
            end

            _OriginalQuestCompleteOnClick = QuestFrameCompleteQuestButton:GetScript(""OnClick"");
            --_OriginalQuestCompleteClick = QuestFrameCompleteQuestButton.Click;
            function hook_QuestComplete(self, button, arg2, arg3)
                self = this;
                if (button == ""FORCE"") then
                    DEFAULT_CHAT_FRAME:AddMessage('Forcing quest acceptance!');
                    --_OriginalQuestCompleteClick(self, button);
                    _OriginalQuestCompleteOnClick(self, button);
                else       
                    C_Timer.After(1000, function()
                        DEFAULT_CHAT_FRAME:AddMessage('Delay quest turn in by 1000ms');
                        --_OriginalQuestCompleteClick(self, button);
                        _OriginalQuestCompleteOnClick(self, button);
                    end);    
                end
            end
            QuestFrameCompleteQuestButton:SetScript(""OnClick"", hook_QuestComplete);
            --QuestFrameCompleteQuestButton.Click = hookQuestComplete;
            DEFAULT_CHAT_FRAME:AddMessage('Quest hook initiated');
        ");

 

Edited by Matenia

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.