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.

Add Fight.StopFight(); to anti-drown

  • Product: WRobot General
  • Type: Suggestion
  • Status: Unconfirmed

The anti-drown mechanics are awesome, however you will still drown if you get in fight under water.
Perhaps adding

wManager.Wow.Helpers.Fight.StopFight();

To the delegation would fix this issue? ?

User Feedback

Recommended Comments

Matenia

Elite user
(edited)
//This is how I handle it in my very own fight mechanism:

_fightStartTs = DateTime.Now;
			// chase target if necessary, otherwise wait
			while (Conditions.InGameAndConnectedAndAliveAndProductStartedNotInPause && _target.IsAlive && _fightTrigger && !_target.IsTapDenied)
			{
				KeepTarget(_targetGuid);
				//MoveAwayFromEnemies(); // needs to know if enemy is caster
				KiteIfNecessary(_target);
				SwimUpForAir();
				PotionUser.UsePotions();
				ChaseTarget(_target, () => ClassRotation.Range);
				HandleEvade(_target);
				EscapeIfNecessary();
				Thread.Sleep(150);
			}

private static void SwimUpForAir()
		{
			if (AntiDrown.NeedsAirInCombat)
			{
				AntiDrown.GaspForAir();
			}
		}

using System;
using System.Collections.Generic;
using System.Threading;
using robotManager.FiniteStateMachine;
using SmartRobot.Bot.Helpers;
using wManager.Wow.Enums;
using wManager.Wow.Helpers;
using wManager.Wow.ObjectManager;

namespace SmartRobot.Bot.States
{
	public class AntiDrown : State
	{
		private static DateTime _breathExpires = DateTime.MaxValue;

		static AntiDrown()
		{
			EventsLuaWithArgs.OnEventsLuaStringWithArgs += AntiDrownEventHandler;
		}

		public override string DisplayName => "AntiDrown";

		private bool NeedsAir => DateTime.Now.AddSeconds(30) > _breathExpires;
		
		public static bool NeedsAirInCombat => DateTime.Now.AddSeconds(15) > _breathExpires;

		public static bool IsBreathing => _breathExpires != DateTime.MaxValue;

		public override bool NeedToRun => Conditions.InGameAndConnectedAndAliveAndProductStartedNotInPause
		                                  && ObjectManager.Me.IsSwimming
		                                  && NeedsAir;

		~AntiDrown()
		{
			EventsLuaWithArgs.OnEventsLuaStringWithArgs -= AntiDrownEventHandler;
		}

		private static void AntiDrownEventHandler(string id, List<string> args)
		{
			if ((id == "MIRROR_TIMER_START") & (args[0] == "BREATH"))
			{
				//sets BreathExpires to be in the future by x milliseconds
				var expiryDate = DateTime.Now.AddMilliseconds(double.Parse(args[1]));
				_breathExpires = expiryDate;

				if (!ObjectManager.Me.HaveBuff("Water Breathing"))
				{
					ItemsManager.UseItem(5996);
				}
			}

			if (id == "MIRROR_TIMER_STOP")
			{
				_breathExpires = DateTime.MaxValue;
			}
		}

		public override void Run()
		{
			GaspForAir();
		}

		public static void GaspForAir()
		{
			Logger.Info("Swimming up for air");
			MovementManager.StopMove();
			while (Conditions.InGameAndConnectedAndAliveAndProductStartedNotInPause && IsBreathing && ObjectManager.Me.IsSwimming)
			{
				Move.JumpOrAscend(Move.MoveAction.DownKey, 1000);
				Thread.Sleep(500);
			}

			// wait at surface
			while (Conditions.InGameAndConnectedAndAliveAndProductStartedNotInPause && IsBreathing && !Common.IsAttackedByNpc)
			{
				Thread.Sleep(500);
			}
		}
	}
}

Hope it helps for inspiration.

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.