forked from Entrax643/ExBuddy
-
Notifications
You must be signed in to change notification settings - Fork 1
/
NoAetheryteUseAethernetReturnStrategy.cs
107 lines (77 loc) · 2.99 KB
/
NoAetheryteUseAethernetReturnStrategy.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
#pragma warning disable 1998
namespace ExBuddy
{
using Buddy.Coroutines;
using Clio.Utilities;
using ExBuddy.Helpers;
using ExBuddy.Interfaces;
using ExBuddy.Logging;
using ff14bot.Behavior;
using ff14bot.Managers;
using ff14bot.RemoteWindows;
using System.Linq;
using System.Threading.Tasks;
public class NoAetheryteUseAethernetReturnStrategy : IReturnStrategy, IInteractWithNpc
{
public NoAetheryteUseAethernetReturnStrategy()
{
InteractDistance = 8.0f;
AethernetText = Localization.Localization.NoAetheryteUseAethernetReturn_AethernetText;
}
public string AethernetText { get; set; }
public float InteractDistance { get; set; }
public uint Slot { get; set; }
#region IAetheryteId Members
public uint AetheryteId { get; set; }
#endregion IAetheryteId Members
#region IZoneId Members
public ushort ZoneId { get; set; }
#endregion IZoneId Members
#region IInteractWithNpc Members
public Vector3 Location { get; set; }
public uint NpcId { get; set; }
#endregion IInteractWithNpc Members
#region IReturnStrategy Members
public Vector3 InitialLocation { get; set; }
public async Task<bool> ReturnToLocation()
{
if (BotManager.Current.EnglishName != "Fate Bot")
{
return await InitialLocation.MoveTo();
}
await Coroutine.Sleep(1000);
return true;
}
public async Task<bool> ReturnToZone()
{
await this.TeleportTo();
await this.Interact();
await Coroutine.Wait(5000, () => SelectString.IsOpen);
if (!SelectString.IsOpen)
{
Logger.Instance.Error("Timeout, SelectString window did not open.");
return false;
}
if (SelectString.Lines().Any(line => line.Contains(AethernetText)))
{
Logger.Instance.Info("Selecting line " + AethernetText);
SelectString.ClickLineContains(AethernetText);
// SelectString.ClickSlot(0); going to try to make it more compatible with possible changes to game.
await Coroutine.Wait(5000, () => !SelectString.IsOpen);
await Coroutine.Wait(10000, () => SelectString.IsOpen);
if (!SelectString.IsOpen)
{
Logger.Instance.Error("Timeout, SelectString window did not open.");
return false;
}
}
Logger.Instance.Info("Selecting line " + Slot);
SelectString.ClickSlot(Slot);
await Coroutine.Wait(5000, () => CommonBehaviors.IsLoading);
await CommonTasks.HandleLoading();
await Coroutine.Sleep(2000); // Weird stuff happens without this.
return true;
}
#endregion IReturnStrategy Members
}
}