Jump to content

Snippets codes for quest profiles


Droidz
 Share

Recommended Posts

Quest log cleaner

 

Abandon all quests

Add step type "RunLuaCode" with code:

for i=1,GetNumQuestLogEntries() do
	SelectQuestLogEntry(i);
	SetAbandonQuest();
	AbandonQuest();
end

 

Abandon quest by quest id

Add step type "RunLuaCode with code (replace 12345 by the quest id at abandon):

local questId = 12345;
for i=1,GetNumQuestLogEntries() do
	local _, _, _, _, _, _, _, id = GetQuestLogTitle(i);
	if id == questId then
		SelectQuestLogEntry(i);
		SetAbandonQuest();
		AbandonQuest();
	end
end

 

Link to comment
Share on other sites

Use item on hostile weakened mob

  1. Add step type "PickUp" (put quest name in parameter)
  2. Add step type "RunCode", in parameter put this code:
    Thread t = new Thread(() =>
    {
    	uint itemId = 62899;
    	int questId = 28000;
    	while (robotManager.Products.Products.IsStarted)
    	{
    		if (Conditions.InGameAndConnectedAndAliveAndProductStartedNotInPause)
    		{
    			if (!Quest.HasQuest(questId))
    				break;
    			if (ObjectManager.Target.IsValid && ObjectManager.Target.IsAlive && ObjectManager.Target.HealthPercent <= 25)
    			{
    				ItemsManager.UseItem(itemId);
    			}
    		}
    		Thread.Sleep(500);
    	}
    });
    t.Start();

     (you need to have quest in your questlog, you can replace "62899" but the item id, "28000" by the quest id and "25" by the max target health)

  3. Add step type "Pulse" (put quest name in parameter) (use quest type kill or interact)

  4. Add step type "TurnIn" (put quest name in parameter)

(sample if based on this quest: http://www.wowhead.com/quest=28000/do-the-imp-possible )

Link to comment
Share on other sites

Change WRobot settings

You can change WRobot settings with step type "RunCode" like this:

Disable "Stop bot if player teleported" (to avoid problem with you use Hearthstone or portals):

wManager.wManagerSetting.CurrentSetting.CloseIfPlayerTeleported = false;

To disable "attack before being attacked":

wManager.wManagerSetting.CurrentSetting.AttackBeforeBeingAttacked = false;

...

(to get names of settings, you can edit file with nodepad "WRobot\Settings\General-..........xml")

Link to comment
Share on other sites

  • 1 month later...

Ignore fighting back

To disable detection when character is attacked, use this c# code:

wManager.Wow.Helpers.Conditions.ForceIgnoreIsAttacked = true;

To reactivate attack detection:

wManager.Wow.Helpers.Conditions.ForceIgnoreIsAttacked = false;

(don't forget to reactivate it, or restart WRobot if you want use other profile/product)

 

You can also ignore fighting back with specific mob:

WoWUnit unit = new WoWUnit(0);
if (unit.IsValid && !wManager.Wow.ObjectManager.ObjectManager.BlackListObjectManagerGuid.Contains(unit.Guid))
    wManager.Wow.ObjectManager.ObjectManager.BlackListGetUnitAttackPlayerGuidTime.Add(unit.Guid, System.DateTime.Now + System.TimeSpan.FromMinutes(2));

 

Link to comment
Share on other sites

  • 1 month later...

Train spells

This sample is for WoD, in this sample the profile train the spell http://www.wowhead.com/spell=2018/blacksmithing at http://www.wowhead.com/npc=514/smith-argus : TrainSpell.xml

To adapt this profile at you, in "Is complete condition" quest option replace "2018" by your spell id, in "hotspots" put your trainer position and in "target entry" put your trainer entry id.

Link to comment
Share on other sites

  • 2 months later...
  • 2 weeks later...

Use item on dead mob ( after looting)

Use like the use item on weakened mob- you need to modify the item ID and Quest ID for your quest.

 

 

Thread t = new Thread(() =>
{
    uint itemId = 9618;
    int questId = 25336;
    while (robotManager.Products.Products.IsStarted)
    {
        if (Conditions.InGameAndConnectedAndAliveAndProductStartedNotInPause)
        {
            if (!Quest.HasQuest(questId))
                break;
            if (ObjectManager.Target.IsValid && ObjectManager.Target.IsDead)
            {
                ItemsManager.UseItem(itemId);
            }
        }
        Thread.Sleep(500);
    }
});
t.Start();

 

Link to comment
Share on other sites

  • 1 month later...
  • 2 weeks later...

Dump all quests in "Quests log" with lua

ret = '';

local numEntries, numQuests = GetNumQuestLogEntries();
for questLog = 1, numEntries do      
	local questTitle, _, _, _, _, _, _, id = GetQuestLogTitle(questLog);
	if id > 0 and questTitle then
		local q = '\n=================';
		q = q .. '\n' .. tostring(questTitle) .. ' (' .. id .. ')';
		local numObjectives = GetNumQuestLeaderBoards(questLog);
		for i=1,numObjectives do
			local description, objectiveType, isCompleted = GetQuestLogLeaderBoard(i,questLog);
			if description then
				q = q .. '\nObjective count: ' .. i .. ', Description: ' .. tostring(description) .. ', ObjectiveType: ' .. tostring(objectiveType) .. ', IsCompleted: ' .. tostring(isCompleted);
			end
		end
		q = q .. '\n=================';
		print(q);
		ret = ret .. q;
	end
end

Go to WRobot tab "Tools" > "Development Tools" > paste this lua code in textbox and click on button "Lua (return value in 'ret')"

Link to comment
Share on other sites

  • 5 months later...

Catch Zeppelin/Ship

Quest profile: Catch Zeppelin and Ship Sample.xml

// Sample of how to use Zeppelin/Ship
// In this sample, WRobot catch Zeppelin from Kalimdor (Ogrimmard) to Northrend (Borean Tundra (Warsong Hold))

/* Quest settings:
    * Can condition: "return Usefuls.ContinentId == (int) ContinentId.Kalimdor;"
    * Is complete condition: "return Usefuls.ContinentId == (int) ContinentId.Northrend && !ObjectManager.Me.InTransport;"
    * Not required in quest log: "True"
    * Quest type: "OverridePulseCSharpCode"
*/

// You can get zeppelin/ship/player positions and entry ID in tab "Tools" > "Development Tools" > "Dump all informations" (or "Memory information").

// Settings:
var zeppelinEntryId = 186238; // Zeppelin/Ship EntryId
// From
var fromZeppelinWaitPosition = new Vector3(1775.066, -4299.745, 151.0326); // Position where Zeppelin/Ship waits players (from)
var fromPlayerWaitPosition = new Vector3(1762.322, -4282.175, 133.1072); // Position where the player waits Zeppelin/Ship (from)
var fromPlayerInZeppelinPosition = new Vector3(1768.199, -4289.856, 133.1912); // Position where the player waits in the Zeppelin/Ship (from)
// To
var toZeppelinWaitPosition = new Vector3(2837.908, 6187.443, 140.1648); // Position where Zeppelin/Ship waits players (to)
var toPlayerLeavePosition = new Vector3(2836.5, 6184.367, 121.9332); // Position to go out the Zeppelin/Ship (to)

// Change WRobot settings:
wManager.wManagerSetting.CurrentSetting.CloseIfPlayerTeleported = false;

// Code:
if (!Conditions.InGameAndConnectedAndProductStartedNotInPause)
    return true;

if (Usefuls.ContinentId == (int)ContinentId.Kalimdor)
{
    if (!ObjectManager.Me.InTransport)
    {
        if (GoToTask.ToPosition(fromPlayerWaitPosition))
        {
            var zeppelin = ObjectManager.GetWoWGameObjectByEntry(zeppelinEntryId).OrderBy(o => o.GetDistance).FirstOrDefault();
            if (zeppelin != null && zeppelin.Position.DistanceTo(fromZeppelinWaitPosition) < 1)
            {
                GoToTask.ToPosition(fromPlayerInZeppelinPosition);
            }
        }
    }
}
else if (Usefuls.ContinentId == (int)ContinentId.Northrend)
{
    if (ObjectManager.Me.InTransport)
    {
        var zeppelin = ObjectManager.GetWoWGameObjectByEntry(zeppelinEntryId).OrderBy(o => o.GetDistance).FirstOrDefault();
        if (zeppelin != null && zeppelin.Position.DistanceTo(toZeppelinWaitPosition) < 1)
        {
            GoToTask.ToPosition(toPlayerLeavePosition);
        }
    }
}
return true;

 

Link to comment
Share on other sites

  • 2 months later...

Change position of path generated by WRobot

(this can help you to resolve  stuck on specific doors and doorways)

With this code, you can replace specific point of path by another.

        // Continent (item1), DefaultPosition (item2), DefaultPositionSearchRange (item3), NewPosition (item4)
        var positionChange = new List<Tuple<ContinentId, Vector3, float, Vector3>>
        {
            new Tuple<ContinentId, Vector3, float, Vector3>(ContinentId.Kalimdor, new Vector3(1422.318, -4662.921, 35.46182), 0.5f, new Vector3(1422.063, -4665.421, 35.46295)),
            /// new Tuple<ContinentId...
        };

        wManager.Events.MovementEvents.OnMovementPulse += delegate(List<Vector3> points, CancelEventArgs cancelable)
        {
            var continent = (ContinentId) Usefuls.ContinentId;
            foreach (var p in points)
            {
                foreach (var pchange in positionChange)
                {
                    if (p != null &&
                        pchange.Item1 == continent &&
                        p.DistanceTo(pchange.Item2) <= pchange.Item3)
                    {
                        Logging.WriteDebug("Change path position of " + p + " to " + pchange.Item4);
                        p.X = pchange.Item4.X;
                        p.Y = pchange.Item4.Y;
                        p.Z = pchange.Item4.Z;
                        p.Type = pchange.Item4.Type;
                        p.Action = pchange.Item4.Action;
                    }

                }
            }
        };

Wow_2017-05-12_13-20-08.png

(you need to run this code one time by WRobot session, you can run this code in step type "RunCode")

Link to comment
Share on other sites

  • 3 months later...

Use Hearthstone sample

        if (wManager.Wow.Helpers.Usefuls.ContinentId != (int) wManager.Wow.Enums.ContinentId.Azeroth ||
            wManager.Wow.ObjectManager.ObjectManager.Me.Position.DistanceTo2D(new robotManager.Helpful.Vector3(1, 2, 3)) > 1000)
        {
            wManager.wManagerSetting.CurrentSetting.CloseIfPlayerTeleported = false;
            wManager.Wow.Helpers.ItemsManager.UseItem(6948); // http://www.wowhead.com/item=6948/hearthstone
            System.Threading.Thread.Sleep(1000 * 20); // 20 secondes
            wManager.wManagerSetting.CurrentSetting.CloseIfPlayerTeleported = true;
        }

Line 1 replace "Azeroth" by your destination continent.

Line 2 replace "1, 2, 3" by your destination position (you can also replace "1000" by  your minimum distance to destination to use Hearthstone).

Link to comment
Share on other sites

  • 4 months later...

Blacklist object/unit in ObjectManager 

WRobot will 100% ignore blacklisted objects

WoWUnit unit = new WoWUnit(0);
if (unit.IsValid && !wManager.Wow.ObjectManager.ObjectManager.BlackListObjectManagerGuid.Contains(unit.Guid))
    wManager.Wow.ObjectManager.ObjectManager.BlackListObjectManagerGuid.Add(unit.Guid);

(this code can disrupt WRobot, use it only if you know what you're doing)

Link to comment
Share on other sites

  • 2 weeks later...

Force Taxi (Vanilla) & automatically get TaxiButton by name

var position = new Vector3(-8835.76f, 490.084f, 109.6157f);
int npcEntryId = 352;

if (!ObjectManager.Me.IsOnTaxi)
{
    if (wManager.Wow.Bot.Tasks.GoToTask.ToPositionAndIntecractWithNpc(position, npcEntryId))
    {
	int node;
        Usefuls.SelectGossipOption(GossipOptionsType.taxi);

	node = wManager.Wow.Helpers.Lua.LuaDoString<int>("for i=0,30 do if string.find(TaxiNodeName(i),'Ironforge') then return i end end");
          
        wManager.Wow.Helpers.Lua.LuaDoString("TakeTaxiNode(" + node + ")");
    }
}

Step "RunCode" and wrap it into a while loop (as shown in Droidz example).
For 'position' you have to add the position of the flight master the bot is going to use.
For 'npcEntryID' you have to add the ID of the corresponding flight master.
For 'Ironforge' you have to change it to the name of the taxi node you wanna travel to. Has not to be the full name, an explizit part of the destination is enough (f.e. 'Stormwind' instead of 'Stormwind City').

The code above makes the bot travelling from Stormwind to Ironforge.

Edited by FNV316
Link to comment
Share on other sites

  • 2 years later...

Click on Item and KILL mob (Overridepulse)

	var pos = new Vector3(x, y, z); // Vector3 postion
        int npc = 1; // hostile unit
        int clickitem = 1; // item you need to click on
        var target = ObjectManager.GetObjectWoWUnit().FirstOrDefault(o => o.Entry == npc && o.Position.DistanceTo(ObjectManager.Me.Position) < 50 && o.IsAlive);

        GoToTask.ToPosition(pos);
        while (MovementManager.InMovement)
        {
            Thread.Sleep(250);
        }
        if (ObjectManager.Me.Position.DistanceTo2D(new Vector3(pos)) < 3)
        {
            Interact.InteractGameObject(ObjectManager.GetWoWGameObjectByEntry(clickitem).FirstOrDefault().GetBaseAddress);
            Thread.Sleep(1500);
        }
        
        if (target != null && target.IsAlive)
        {
            ObjectManager.Me.Target = target.Guid;
            if (ObjectManager.Me.Position.DistanceTo(target.Position) >= 30)
                MovementManager.MoveTo(target.Position);

            if (ObjectManager.Target.Name == "unit") //name of the unit
            {
                Fight.StartFight();
            }
        }
        return true;

1 - edit to your needs, change the info.

2 - use overridepulse

3- in quest order editer, do Pulseallinone

Link to comment
Share on other sites

Go to Vector3 And Use Item (Overridepulse)

	var pos = new Vector3(x, y, z); // position to where you need to be to use the item
        string item = "Name"; // item Sring - change name to what item you are using.

        GoToTask.ToPosition(pos); // move to position
        while (MovementManager.InMovement)
        {
            Thread.Sleep(250); 
        }
        if (ObjectManager.Me.Position.DistanceTo2D(pos) < 3)
        {
            ItemsManager.UseItem(item);
            Thread.Sleep(500);   
        }
        return true;

 

Link to comment
Share on other sites

Go to Vector3 And click on object (Overridepulse)

	var pos = new Vector3(x, y, z); // position to where you need to interact with object
        int clickonobject = 0; // the object ID

        GoToTask.ToPosition(pos);
        while (MovementManager.InMovement)
        {
            Thread.Sleep(250);
        }
        if (ObjectManager.Me.Position.DistanceTo2D(pos) < 3)
        {
            Interact.InteractGameObject(ObjectManager.GetWoWGameObjectByEntry(clickonobject).FirstOrDefault().GetBaseAddress);
            Thread.Sleep(500);
            
        }
        return true;

 

Link to comment
Share on other sites

  • 4 months later...

Many Useful Functions (Vanilla - WOTLK)

RunCode (Action): 
- Tool.LearningSpells("Name Of spell"); // Put in name of the spell you wish to buy.
- Tool.Craft("profession", "RecipeName", 1); // This code will only work for Wrath of the lich king
- Tool.RemoveItem(55); // Removes item by ID
- Tool.UseItem(55); // Uses item by ID
- Tool.AbandonQuest("Quest Name"); //Abandon Quest by Name
- Tool.Sellitem("Item Name"); // sell item by name
- Tool.Fish(new Vector3(1, 1, 1), new Vector3(1, 1, 1), 0, 75, 6562, 111); 
- Tool.CheckUpdate(); // updates quester profiles from github.raw
- Tool.SendItems("name", "note", new List<string> { "Super Healing Potion", });  // mail itemlist to another player 

If statements : 
- Tool.RecipeIsKnown("profession", "RecipeName") == true // check if you have this Recipe! If statement!
- Tool.HasItem("itemname") <= 0
- Tool.Faction("Name of the faction", 5) == true // add name of faction, and amount of rep you want to check aganst.  42999 is max rep.  
- Tool.haveKey(KeyID) // checks if you have a key 

Travel Functions added(Vanilla - WOTLK)

Flight : 
- Travel.Flight.ThunderBluffToOrgrimmar();
- Travel.Flight.OrgrimmarToThunderBluff();

Full code here: https://wrobot.eu/forums/topic/12034-toolboxvanilla-wotlk-many-useful-functions-custom-script/

Edited by TheSmokie
Link to comment
Share on other sites

  • 1 month later...

Try resolve navigation problem 

In some zone (mainly if you are on a moving gameobject like boat) use this option can help to resolve navigation problem (you need to enable this option also when you record path or get npc/gameobject positions)

wManager.Wow.ObjectManager.WoWUnit.ForceRelativePosition = true;

(don't forget to disable this option after, wrobot only turns it off itself after a restart)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...