What's new
  • Visit Rebornbuddy
  • Visit Panda Profiles
  • Visit LLamamMagic
  • Visit Resources
  • Visit Downloads
  • Visit Portal
RebornBuddy Forums

Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

Use hearthstone if stuck

dron1k

Member
Joined
Dec 22, 2014
Messages
37
Hi, does anyone know how to code this? I mean something like:
Code:
If
standing_at_one_place_for_5_minutes
then
"RunMacro" Macro="/use Hearthstone"
I think I should use CustomBehavior, but not sure how. I want to implement this in profile, w\o any extra plugins.
 
Last edited:
Sadly I can't find anything there, searching for 'hearthstone' or '8690' (spell id)
 
Since you said CustomBehavior, I'm assuming this would be for the Questing botbase?
Here's a very simple method of how custom anti-stuck might look in a questing profile:

PHP:
<CustomBehavior File="RunCode" Type="Definition"><![CDATA[
    public static class StuckDetection
    {
        public static Vector3 LastPoint = new Vector3(0f,0f,0f);

        public static bool IsStuck()
        {
            if (!StyxWoW.Me.IsValid) return false;
            if (StyxWoW.Me.IsDead) return false;
            if (StyxWoW.Me.IsActuallyInCombat) return false;
            if (StyxWoW.Me.HasAura("Resurrection Sickness")) return false;

            var currentPoint = StyxWoW.Me.Location;
            var isStuck = currentPoint.DistanceSqr(LastPoint) < 10f * 10f;
            LastPoint = currentPoint;
            return isStuck;
        }
    }
]]>
</CustomBehavior>
<CustomBehavior File="RunCode" Code="StuckDetection.LastPoint = new Vector3(0f,0f,0f);" /> <!-- Clean out stale data in case the user stop/starts the bot. -->
<CustomBehavior File="Hooks\DoWhen" ActivityName="DoWhen_StuckDetector" AllowUseWhileMounted="true" LogExecution="false" UseAtInterval="210000" >
    <If Condition="StuckDetection.IsStuck() &amp;&amp; HasItem(6948)" >
        <CustomBehavior File="RunCode"><![CDATA[
            Logging.Write(System.Windows.Media.Colors.DeepSkyBlue, "[ProfileBase]: Stuck detection activated!");
            await CommonCoroutines.StopMoving();
            await CommonCoroutines.LandAndDismount();
            WoWItem hearthstoneItem = StyxWoW.Me.BagItems.FirstOrDefault(x => x.Entry == 6948);
            if (hearthstoneItem.CooldownTimeLeft != TimeSpan.Zero) {
                Logging.Write(System.Windows.Media.Colors.DeepSkyBlue, "[ProfileBase]: Awaiting Hearthstone cooldown before attempting hearth!");
                await Coroutine.Wait(1800000, () => hearthstoneItem.CooldownTimeLeft == TimeSpan.Zero);
            }
            hearthstoneItem.Interact();
            await Coroutine.Sleep(11500);
            Logging.Write(System.Windows.Media.Colors.DeepSkyBlue, "[ProfileBase]: Reloading profile.");
            ProfileManager.LoadNew(ProfileManager.XmlLocation);
        ]]>
        </CustomBehavior>
    </If>
</CustomBehavior>

This approach favors using DoWhen instead of hooking directly in using TreeHook.InsertHook.
Mainly because with DoWhen we can use UseAtInterval. This way we won't have to code in our own timer.

Another approach would be to actually use TreeHooks.InsertHook - which from there you'd hook in at Questbot_Profile.
DoWhen hooks in at Questbot_Main which is why there's so many checks on the IsStuck();

Questbot_Profile runs at a profile level while Questbot_Main runs above all other hooks such as combat/loot/etc.
 
Back
Top