-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMain.cs
186 lines (151 loc) · 5.61 KB
/
Main.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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
using System;
using System.Diagnostics;
using System.Windows.Forms;
using CommonBehaviors.Actions;
using InnerRage.Core;
using InnerRage.Core.Managers;
using InnerRage.Core.Utilities;
using InnerRage.Interface;
using Styx;
using Styx.CommonBot;
using Styx.CommonBot.Routines;
using Styx.TreeSharp;
using Styx.WoWInternals.WoWObjects;
using R = InnerRage.Core.Routines;
namespace InnerRage
{
/// <summary>
/// Main entry point into the custom combat routine.
/// </summary>
public class Main : CombatRoutine
{
/// <summary>
/// used to log debug Messages, defaults to false.
/// </summary>
public static bool Debug = false;
private static readonly Version _version = new Version(1, 0, 0, 1);
public static Stopwatch DeathTimer = new Stopwatch();
public static Version Version
{
get { return _version; }
}
private static LocalPlayer Me
{
get { return StyxWoW.Me; }
}
private static WoWUnit MyCurrentTarget
{
get { return Me.CurrentTarget; }
}
public override WoWClass Class
{
get { return WoWClass.Warrior; }
}
public override string Name
{
get { return string.Format("InnerRage (Beta) (v{0})", Version); }
}
public override bool WantButton
{
get { return true; }
}
public override bool NeedDeath
{
get { return !BotManager.Current.IsRoutineBased() && Me.IsDead && !Me.IsGhost; }
}
public WoWSpec MyCurrentSpec { get; set; }
public override void ShutDown()
{
HotKeyManager.RemoveHotkeys();
}
#region Routines
public override Composite PreCombatBuffBehavior
{
get { return new ActionRunCoroutine(o => R.PreCombat.Rotation()); }
}
// public override Composite PullBehavior { get { return new ActionRunCoroutine(o => R.Pull.Rotation()); } }
public override Composite CombatBehavior
{
get { return new ActionRunCoroutine(o => R.Combat.Rotation()); }
}
public override Composite HealBehavior
{
get { return new ActionRunCoroutine(o => R.Heal.Rotation()); }
}
public override Composite CombatBuffBehavior
{
get { return new ActionRunCoroutine(o => R.CombatBuff.Rotation()); }
}
// public override Composite RestBehavior { get { return new ActionRunCoroutine(o => R.Rest.Rotation()); } }
#endregion
#region Implementation
public override void Initialize()
{
try
{
MyCurrentSpec = Me.Specialization;
GlobalSettings.Instance.Init();
SettingsManager.Init();
AbilityManager.ReloadAbilities();
Log.Combat("--------------------------------------------------");
Log.Combat(Name);
Log.Combat(string.Format("You are a Level {0} {1} {2}", Me.Level, Me.Race, Me.Class));
Log.Combat(string.Format("Current Specialization: {0}",
MyCurrentSpec.ToString().Replace("Warrior", string.Empty)));
Log.Combat(string.Format("Current Profile: {0}", GlobalSettings.Instance.LastUsedProfile));
Log.Combat(string.Format("{0} abilities loaded", AbilityManager.Instance.Abilities.Count));
Log.Combat("--------------------------------------------------");
HotKeyManager.RegisterHotKeys();
}
catch (Exception ex)
{
Log.Gui(string.Format("Error Initializing InnerRage Combat Routine: {0}", ex));
}
}
public override void OnButtonPress()
{
var settingsForm = new Settings();
if (settingsForm.ShowDialog() == DialogResult.OK)
{
// SettingsManager.Init(GlobalSettings.GetFullPathToProfile(GlobalSettings.Instance.LastUsedProfile));
AbilityManager.ReloadAbilities();
// ItemManager.LoadDataSet();
Log.Gui(string.Format("Profile saved and loaded."));
}
}
public override void Pulse()
{
if (MyCurrentSpec != Me.Specialization)
{
Log.Combat(string.Format("Specialization changed from {0} to {1}",
MyCurrentSpec.ToString().Replace("Warrior", string.Empty),
Me.Specialization.ToString().Replace("Warrior", string.Empty)));
MyCurrentSpec = Me.Specialization;
}
AbilityManager.Instance.Update();
UnitManager.Instance.Update();
// SnapshotManager.Instance.Update();
base.Pulse();
}
/*
public override void Death()
{
if (this.NeedDeath)
{
if (SettingsManager.Instance.ReleaseSpiritOnDeathEnabled)
{
if (!DeathTimer.IsRunning) DeathTimer.Start();
if (DeathTimer.ElapsedMilliseconds >= SettingsManager.Instance.ReleaseSpiritOnDeathIntervalInMs)
{
Log.GUI(string.Format("I have died. Corpse released after {0} ms", DeathTimer.ElapsedMilliseconds));
DeathTimer.Reset();
Lua.DoString("RunMacroText(\"/script RepopMe()\")");
}
}
}
base.Death();
}
*/
#endregion
}
}