Skip to content
Browse files

Finish adding the CombatHelper bits...

this needs more testing, specifically the ammo that it is going to want to have in its cargo... as it cant get that info from the mission...
maybe we just need to remove the 'out of ammo' triggers and rely on the person at the kb to load it with ammo???
  • Loading branch information...
1 parent fc39844 commit be99fa3e787be6996c028e7200b2bcfd7415ccac @ISeeDEDPpl committed
View
1 Questor.Modules/Questor.Modules.csproj
@@ -79,6 +79,7 @@
</ItemGroup>
<ItemGroup>
<Compile Include="Caching\TargetingCache.cs" />
+ <Compile Include="States\CombatHelperBehaviorState.cs" />
<Compile Include="States\DedicatedBookmarkSalvagerBehaviorState.cs" />
<Compile Include="States\DropState.cs" />
<Compile Include="Alerts\Audio.cs">
View
106 Questor/Behaviors/CombatHelperBehavior.cs
@@ -39,7 +39,7 @@ public class CombatHelperBehavior
private readonly UnloadLoot _unloadLoot;
public DateTime LastAction;
private readonly Random _random;
- private int _randomDelay;
+ //private int _randomDelay;
public static long AgentID;
private readonly Stopwatch _watch;
@@ -313,31 +313,17 @@ public void ProcessState()
return;
}
- if (Cache.Instance.InSpace)
- {
- if (Settings.Instance.DebugIdle) Logging.Log("CombatHelperBehavior", "if (Cache.Instance.InSpace)", Logging.white);
- // Questor does not handle in space starts very well, head back to base to try again
- Logging.Log("CombatHelperBehavior", "Started questor while in space, heading back to base in 15 seconds", Logging.white);
- LastAction = DateTime.Now;
- if (_States.CurrentCombatHelperBehaviorState == CombatHelperBehaviorState.Idle) _States.CurrentCombatHelperBehaviorState = CombatHelperBehaviorState.DelayedGotoBase;
- break;
- }
- else
- {
- if (Settings.Instance.DebugIdle) Logging.Log("CombatHelperBehavior", "if (Cache.Instance.InSpace) else", Logging.white);
- _States.CurrentArmState = ArmState.Idle;
- _States.CurrentDroneState = DroneState.Idle;
- _States.CurrentSalvageState = SalvageState.Idle;
- _States.CurrentTravelerState = TravelerState.Idle;
- _States.CurrentUnloadLootState = UnloadLootState.Idle;
- _States.CurrentTravelerState = TravelerState.Idle;
- }
- //
- // do nothing until the user at the kb chooses to do something...
- // AND kick questorstate back into idle while the behavior is in idle
- // so that we checkto see if we should closequestor for any reason
- //
- _States.CurrentQuestorState = QuestorState.Idle;
+ if (Settings.Instance.DebugIdle) Logging.Log("CombatHelperBehavior", "if (Cache.Instance.InSpace) else", Logging.white);
+ _States.CurrentArmState = ArmState.Idle;
+ _States.CurrentDroneState = DroneState.Idle;
+ _States.CurrentSalvageState = SalvageState.Idle;
+ _States.CurrentTravelerState = TravelerState.Idle;
+ _States.CurrentUnloadLootState = UnloadLootState.Idle;
+ _States.CurrentTravelerState = TravelerState.Idle;
+
+ Logging.Log("CombatHelperBehavior", "Started questor in Combat Helper mode", Logging.white);
+ LastAction = DateTime.Now;
+ if (_States.CurrentCombatHelperBehaviorState == CombatHelperBehaviorState.Idle) _States.CurrentCombatHelperBehaviorState = CombatHelperBehaviorState.CombatHelper;
break;
case CombatHelperBehaviorState.DelayedGotoBase:
@@ -401,54 +387,38 @@ public void ProcessState()
break;
case CombatHelperBehaviorState.CombatHelper:
- DebugPerformanceClearandStartTimer();
- _combat.ProcessState();
- DebugPerformanceStopandDisplayTimer("Combat.ProcessState");
-
- if (Settings.Instance.DebugStates)
- Logging.Log("Combat.State is", _States.CurrentCombatState.ToString(), Logging.white);
-
- DebugPerformanceClearandStartTimer();
- _drones.ProcessState();
- DebugPerformanceStopandDisplayTimer("Drones.ProcessState");
-
- if (Settings.Instance.DebugStates)
- Logging.Log("Drones.State is", _States.CurrentDroneState.ToString(), Logging.white);
+ if (Cache.Instance.InSpace)
+ {
+ DebugPerformanceClearandStartTimer();
+ _combat.ProcessState();
+ DebugPerformanceStopandDisplayTimer("Combat.ProcessState");
- DebugPerformanceClearandStartTimer();
- _salvage.ProcessState();
- DebugPerformanceStopandDisplayTimer("Salvage.ProcessState");
+ if (Settings.Instance.DebugStates)
+ Logging.Log("Combat.State is", _States.CurrentCombatState.ToString(), Logging.white);
- if (Settings.Instance.DebugStates)
- Logging.Log("Salvage.State is", _States.CurrentSalvageState.ToString(), Logging.white);
+ DebugPerformanceClearandStartTimer();
+ _drones.ProcessState();
+ DebugPerformanceStopandDisplayTimer("Drones.ProcessState");
-
- // If we are out of ammo, return to base (do we want to do this with combat helper?!)
- if (_States.CurrentCombatState == CombatState.OutOfAmmo)
- {
- Logging.Log("Combat","Out of Ammo!",Logging.orange);
- if (_States.CurrentCombatHelperBehaviorState == CombatHelperBehaviorState.CombatHelper) _States.CurrentCombatHelperBehaviorState = CombatHelperBehaviorState.GotoBase;
- // Clear looted containers
- Cache.Instance.LootedContainers.Clear();
- }
+ if (Settings.Instance.DebugStates)
+ Logging.Log("Drones.State is", _States.CurrentDroneState.ToString(), Logging.white);
- if (_States.CurrentCombatMissionCtrlState == CombatMissionCtrlState.Done)
- {
- if (_States.CurrentCombatHelperBehaviorState == CombatHelperBehaviorState.CombatHelper) _States.CurrentCombatHelperBehaviorState = CombatHelperBehaviorState.GotoBase;
+ DebugPerformanceClearandStartTimer();
+ _salvage.ProcessState();
+ DebugPerformanceStopandDisplayTimer("Salvage.ProcessState");
- // Clear looted containers
- Cache.Instance.LootedContainers.Clear();
- }
+ if (Settings.Instance.DebugStates)
+ Logging.Log("Salvage.State is", _States.CurrentSalvageState.ToString(), Logging.white);
- // If in error state, just go home and stop the bot
- if (_States.CurrentCombatMissionCtrlState == CombatMissionCtrlState.Error)
- {
- Logging.Log("MissionController", "Error",Logging.red);
- if (_States.CurrentCombatHelperBehaviorState == CombatHelperBehaviorState.CombatHelper) _States.CurrentCombatHelperBehaviorState = CombatHelperBehaviorState.GotoBase;
-
- // Clear looted containers
- Cache.Instance.LootedContainers.Clear();
- //Cache.Instance.InvalidateBetweenMissionsCache();
+ // If we are out of ammo, return to base (do we want to do this with combat helper?!)
+ if (_States.CurrentCombatState == CombatState.OutOfAmmo)
+ {
+ Logging.Log("Combat","Out of Ammo!",Logging.orange);
+ if (_States.CurrentCombatHelperBehaviorState == CombatHelperBehaviorState.CombatHelper)
+ _States.CurrentCombatHelperBehaviorState = CombatHelperBehaviorState.GotoBase;
+ // Clear looted containers
+ Cache.Instance.LootedContainers.Clear();
+ }
}
break;
View
57 Questor/Questor.cs
@@ -33,6 +33,7 @@ public class Questor
private DateTime _lastPulse;
private DateTime _lastSalvageTrip = DateTime.MinValue;
private readonly CombatMissionsBehavior _combatMissionsBehavior;
+ private readonly CombatHelperBehavior _combatHelperBehavior;
private readonly DedicatedBookmarkSalvagerBehavior _dedicatedBookmarkSalvagerBehavior;
private readonly Cleanup _cleanup;
@@ -59,6 +60,7 @@ public Questor(QuestorfrmMain form1)
_defense = new Defense();
_localwatch = new LocalWatch();
_combatMissionsBehavior = new CombatMissionsBehavior();
+ _combatHelperBehavior = new CombatHelperBehavior();
_dedicatedBookmarkSalvagerBehavior = new DedicatedBookmarkSalvagerBehavior();
_cleanup = new Cleanup();
_watch = new Stopwatch();
@@ -419,6 +421,17 @@ private void OnFrame(object sender, EventArgs e)
_combatMissionsBehavior.ProcessState();
break;
+ case QuestorState.CombatHelperBehavior:
+ //
+ // QuestorState will stay here until changed externally by the behavior we just kicked into starting
+ //
+ if (_States.CurrentCombatHelperBehaviorState == CombatHelperBehaviorState.Idle)
+ {
+ _States.CurrentCombatHelperBehaviorState = CombatHelperBehaviorState.Idle;
+ }
+ _combatHelperBehavior.ProcessState();
+ break;
+
case QuestorState.DedicatedBookmarkSalvagerBehavior:
//
// QuestorState will stay here until changed externally by the behavior we just kicked into starting
@@ -431,23 +444,35 @@ private void OnFrame(object sender, EventArgs e)
break;
case QuestorState.Start:
- if (Settings.Instance.CharacterMode.ToLower() == "combat missions" || Settings.Instance.CharacterMode.ToLower() == "dps")
- {
- if (_States.CurrentQuestorState == QuestorState.Start)
- {
- Logging.Log("Questor", "Start Mission Behavior", Logging.white);
- _States.CurrentQuestorState = QuestorState.CombatMissionsBehavior;
- }
- break;
- }
- if (Settings.Instance.CharacterMode.ToLower() == "salvage")
+ switch (Settings.Instance.CharacterMode.ToLower())
{
- if (_States.CurrentQuestorState == QuestorState.Start)
- {
- Logging.Log("Questor", "Start Salvaging Behavior", Logging.white);
- _States.CurrentQuestorState = QuestorState.DedicatedBookmarkSalvagerBehavior;
- }
- break;
+ case "combat missions":
+ case "combat_missions":
+ case "dps":
+ if (_States.CurrentQuestorState == QuestorState.Start)
+ {
+ Logging.Log("Questor", "Start Mission Behavior", Logging.white);
+ _States.CurrentQuestorState = QuestorState.CombatMissionsBehavior;
+ }
+ break;
+
+ case "salvage":
+ if (_States.CurrentQuestorState == QuestorState.Start)
+ {
+ Logging.Log("Questor", "Start Salvaging Behavior", Logging.white);
+ _States.CurrentQuestorState = QuestorState.DedicatedBookmarkSalvagerBehavior;
+ }
+ break;
+
+ case "combat helper":
+ case "combat_helper":
+ case "combathelper":
+ if (_States.CurrentQuestorState == QuestorState.Start)
+ {
+ Logging.Log("Questor", "Start CombatHelper Behavior", Logging.white);
+ _States.CurrentQuestorState = QuestorState.CombatHelperBehavior;
+ }
+ break;
}
break;
View
1 Questor/Questor.csproj
@@ -100,6 +100,7 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
+ <Compile Include="Behaviors\CombatHelperBehavior.cs" />
<Compile Include="Behaviors\CombatMissionsBehavior.cs" />
<Compile Include="Behaviors\DedicatedBookmarkSalvagerBehavior.cs" />
<Compile Include="Options.cs" />
View
35 Questor/QuestorUI.cs
@@ -65,6 +65,13 @@ public QuestorfrmMain()
foreach (string text in Enum.GetNames(typeof(DedicatedBookmarkSalvagerBehaviorState)))
CombatMissionsBehaviorComboBox.Items.Add(text);
}
+ if (Settings.Instance.CharacterMode.ToLower() == "Combat Helper".ToLower() ||
+ Settings.Instance.CharacterMode.ToLower() == "Combat_Helper".ToLower() ||
+ Settings.Instance.CharacterMode.ToLower() == "CombatHelper".ToLower())
+ {
+ foreach (string text in Enum.GetNames(typeof(CombatHelperBehaviorState)))
+ CombatMissionsBehaviorComboBox.Items.Add(text);
+ }
}
//
@@ -406,8 +413,17 @@ private void UpdateUiTick(object sender, EventArgs e)
foreach (string text2 in Enum.GetNames(typeof(DedicatedBookmarkSalvagerBehaviorState)))
CombatMissionsBehaviorComboBox.Items.Add(text2);
}
+ if (Settings.Instance.CharacterMode.ToLower() == "Combat Helper".ToLower() ||
+ Settings.Instance.CharacterMode.ToLower() == "Combat_Helper".ToLower() ||
+ Settings.Instance.CharacterMode.ToLower() == "CombatHelper".ToLower())
+ {
+ _questorBehaviorStatesComboboxFinished = true;
+ foreach (string text2 in Enum.GetNames(typeof(CombatHelperBehaviorState)))
+ CombatMissionsBehaviorComboBox.Items.Add(text2);
+ }
}
+
//
// Left Group
//
@@ -436,6 +452,17 @@ private void UpdateUiTick(object sender, EventArgs e)
CombatMissionsBehaviorComboBox.SelectedItem = text;
text = string.Empty;
}
+
+ if (Settings.Instance.CharacterMode.ToLower() == "Combat Helper".ToLower() ||
+ Settings.Instance.CharacterMode.ToLower() == "Combat_Helper".ToLower() ||
+ Settings.Instance.CharacterMode.ToLower() == "CombatHelper".ToLower())
+ {
+ text = _States.CurrentCombatHelperBehaviorState.ToString();
+ if ((string)CombatMissionsBehaviorComboBox.SelectedItem != text &&
+ !CombatMissionsBehaviorComboBox.DroppedDown)
+ CombatMissionsBehaviorComboBox.SelectedItem = text;
+ text = string.Empty;
+ }
}
text = Cache.Instance.DamageType.ToString();
@@ -1045,6 +1072,14 @@ private void CombatMissionsBehaviorComboBoxSelectedIndexChanged(object sender, E
(DedicatedBookmarkSalvagerBehaviorState)
Enum.Parse(typeof(DedicatedBookmarkSalvagerBehaviorState), CombatMissionsBehaviorComboBox.Text);
}
+ if (Settings.Instance.CharacterMode.ToLower() == "Combat Helper".ToLower() ||
+ Settings.Instance.CharacterMode.ToLower() == "Combat_Helper".ToLower() ||
+ Settings.Instance.CharacterMode.ToLower() == "CombatHelper".ToLower())
+ {
+ _States.CurrentCombatHelperBehaviorState =
+ (CombatHelperBehaviorState)
+ Enum.Parse(typeof(CombatHelperBehaviorState), CombatMissionsBehaviorComboBox.Text);
+ }
}
}

0 comments on commit be99fa3

Please sign in to comment.
Something went wrong with that request. Please try again.