What's new
  • Visit Rebornbuddy
  • Visit Resources
  • Visit API Documentation
  • Visit Downloads
  • Visit Portal
  • Visit Panda Profiles
  • Visit LLamamMagic

[MyCodeSnippets] PathingHelper

manre

New Member
Joined
Mar 27, 2014
Messages
69
Reaction score
1
Hi there!
Ive just open this thread to leave a code snippet im using to help me when pathing new maps.
Its just a new profile tag what simply logs the coords and prints <MoveToPosition x="{0:0}" y="{1:0}" z="{2:0}" /> where {0:0}, {1:0} and {2:0} are the coords.

Instructions:
1-Open ..\Plugins\Adventurer\Tags\TestTag.cs
2-Delete all in the file, copy&paste the next:
[HIDE]
Code:
using System.Diagnostics;
using System.Threading.Tasks;
using Adventurer.Coroutines;
using Adventurer.UI;
using Adventurer.Util;
using Buddy.Coroutines;
using Zeta.Bot;
using Zeta.Bot.Profile;
using Zeta.Game;
using Zeta.Game.Internals;
using Zeta.TreeSharp;
using Zeta.XmlEngine;

namespace Adventurer.Tags
{
    [XmlElement("Test")]
    public class TestTag : ProfileBehavior
    {

		[XmlAttribute("waypoints")]
        public bool Waypoints { get; set; }
	
        private bool _isDone;
        public override bool IsDone
        {
            get
            {
                return _isDone;
            }
        }

        protected override Composite CreateBehavior()
        {
            Debug.Print("Tag.CreateBehavior");
            return new ActionRunCoroutine(ctx => Routine());
        }

        public override void OnStart()
        {
            Debug.Print("Tag.OnStart");

        }

        //private WaitCoroutine _waitCoroutine = new WaitCoroutine(50000);

        public async Task<bool> Routine()
        {
            return await Task2();
        }

        //public async Task<bool> Task1()
        //{
        //    Logger.Info("Task1");
        //    await Coroutine.Sleep(100000);
        //    return true;
        //}

        public async Task<bool> Task2()
        {
            //Logger.Info("Task2");
			if (Waypoints)
			{
				DeveloperUI.DumpNearbyWaypoint();

			}
			//<MoveTo questId=\"{0}\" stepId=\"{1}\" x=\"{2:0}\" y=\"{3:0}\" z=\"{4:0}\" />
			//<SafeMoveTo questId=\"{0}\" stepId=\"{1}\" x=\"{2:0}\" y=\"{3:0}\" z=\"{4:0}\" />
			Logger.Raw("<MoveToPosition questId=\"{0}\" stepId=\"{1}\" x=\"{2:0}\" y=\"{3:0}\" z=\"{4:0}\" />",
                        ZetaDia.CurrentQuest.QuestSnoId, ZetaDia.CurrentQuest.StepId,
                        AdvDia.MyPosition.X, AdvDia.MyPosition.Y, AdvDia.MyPosition.Z);
            _isDone = true;
            return true;
        }

        public override void ResetCachedDone(bool force = false)
        {
            _isDone = false;
        }

    }
}
[/HIDE]
3-Do a .xml profile with whis into:
[HIDE]
Code:
<Profile>
  <Name>abc</Name>
  <KillMonsters>False</KillMonsters>
  <PickupLoot>True</PickupLoot>
  <GameParams step="1" act="OpenWorld" resumeFromSave="False" isPrivate="True" numGames="-1"  />
  <Order>
	<While condition="True">
		<Test waypoints="True"/>
		<WaitTimer questId="1" waitTime="5000" />
	</While>	
  </Order>
</Profile>
[/HIDE]
4-Usage:
  • <Test /> to just log the coords.
  • <Test waypoints="True"/> to log the coords + nearby waypoints.

If someone wants to change the movement it prints out change line 66 to one of these:
Code:
<MoveTo questId=\"{0}\" stepId=\"{1}\" x=\"{2:0}\" y=\"{3:0}\" z=\"{4:0}\" />
Code:
<SafeMoveTo questId=\"{0}\" stepId=\"{1}\" x=\"{2:0}\" y=\"{3:0}\" z=\"{4:0}\" />

I wish this helps someone on doing better profiles, thx all for viewing.
 
Last edited:
Back
Top