Skip to content

Commit

Permalink
Merge branch 'experimental' of github.com:ISeeDEDPpl/Questor into exp…
Browse files Browse the repository at this point in the history
…erimental
  • Loading branch information
ISeeDEDPpl committed Aug 31, 2013
2 parents bdac70a + 02ddf9b commit e8cf334
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 66 deletions.
8 changes: 6 additions & 2 deletions Questor.Modules/Activities/CombatMissionCtrl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1128,12 +1128,16 @@ private void KillAction(Actions.Action action)
return;
}

if (breakOnAttackers && Cache.Instance.TargetedBy.Count(t => !t.IsSentry && t.Distance < Cache.Instance.MaxRange) > 1)
IEnumerable<EntityCache> killTargets = Cache.Instance.Entities.Where(e => targetNames.Contains(e.Name)).OrderBy(t => t.Distance);

//if (breakOnAttackers && Cache.Instance.TargetedBy.Count(t => !t.IsSentry && t.Distance < Cache.Instance.MaxRange) > 1)
if (breakOnAttackers && Cache.Instance.TargetedBy.Count(t => (!t.IsSentry || Settings.Instance.KillSentries) && !Cache.Instance.IgnoreTargets.Contains(t.Name)) > killTargets.Count(e => e.IsTargetedBy))
{
// We are being attacked, break the kill order
if (Cache.Instance.RemovePrimaryWeaponPriorityTargets(targets)) Logging.Log("CombatMissionCtrl." + _pocketActions[_currentAction], "Breaking off kill order, new spawn has arrived!", Logging.Teal);

foreach (EntityCache entity in Cache.Instance.Targets.Where(e => e.IsTarget || e.IsTargeting))
//foreach (EntityCache entity in Cache.Instance.Targets.Where(e => e.IsTarget || e.IsTargeting))
foreach (EntityCache entity in Cache.Instance.Targets.Where(e => targetNames.Contains(e.Name) && (e.IsTarget || e.IsTargeting)))
{
Logging.Log("CombatMissionCtrl." + _pocketActions[_currentAction], "Unlocking [" + entity.Name + "][ID: " + Cache.Instance.MaskedID(entity.Id) + "][" + Math.Round(entity.Distance / 1000, 0) + "k away] due to kill order being put on hold", Logging.Teal);
entity.UnlockTarget("CombatMissionCtrl");
Expand Down
12 changes: 6 additions & 6 deletions Questor.Modules/Caching/Cache.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2854,14 +2854,14 @@ public EntityCache GetBestTarget(EntityCache currentTarget, double distance, boo
}

// Get the closest high value target
EntityCache highValueTarget = potentialCombatTargets.Where(t => t.TargetValue.HasValue
&& t.Distance < distance
&& t.IsTarget).OrderBy(t => !t.IsNPCFrigate).ThenBy(t => t.IsInOptimalRange).ThenByDescending(t => t.TargetValue != null ? t.TargetValue.Value : 0).ThenBy(OrderByLowestHealth()).ThenBy(t => t.Distance).FirstOrDefault();
EntityCache highValueTarget = potentialCombatTargets.Where(t => //t.TargetValue.HasValue This will always have a value so whats the point in checking it
t.Distance < distance
&& t.IsTarget).OrderByDescending(t => t.IsInOptimalRange).ThenByDescending(t => t.TargetValue != null ? t.TargetValue.Value : 0).ThenBy(OrderByLowestHealth()).ThenBy(t => t.Distance).FirstOrDefault();

// Get the closest low value target
EntityCache lowValueTarget = potentialCombatTargets.Where(t => !t.TargetValue.HasValue
&& t.Distance < distance
&& t.IsTarget).OrderBy(t => t.IsNPCFrigate).ThenBy(OrderByLowestHealth()).ThenBy(t => t.Distance).FirstOrDefault();
EntityCache lowValueTarget = potentialCombatTargets.Where(t =>
t.Distance < distance
&& t.IsTarget).OrderBy(t => t.TargetValue != null ? t.TargetValue.Value : 0).ThenBy(OrderByLowestHealth()).ThenBy(t => t.Distance).FirstOrDefault();

if (lowValueFirst && lowValueTarget != null)
{
Expand Down
2 changes: 1 addition & 1 deletion Questor/Behaviors/CombatMissionsBehavior.cs
Original file line number Diff line number Diff line change
Expand Up @@ -813,7 +813,7 @@ public void ProcessState()
{
if (!Cache.Instance.OpenDroneBay("Statistics: WriteDroneStatsLog")) return;
InvType drone = Cache.Instance.InvTypesById[Settings.Instance.DroneTypeId];
Statistics.Instance.LostDrones = (int)Math.Floor((Cache.Instance.DroneBay.Capacity - Cache.Instance.DroneBay.UsedCapacity) / drone.Volume);
// This was causing a lockup Statistics.Instance.LostDrones = (int)Math.Floor((Cache.Instance.DroneBay.Capacity - Cache.Instance.DroneBay.UsedCapacity) / drone.Volume);
//Logging.Log("CombatMissionsBehavior: Starting: Statistics.WriteDroneStatsLog");
if (!Statistics.WriteDroneStatsLog()) break;
}
Expand Down
57 changes: 0 additions & 57 deletions Questor/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -144,63 +144,6 @@ private static void Main(string[] args)
}


#region Load ISXStealth
//
// IsxStealth
//
try
{
//
// load IsxStealth Here
//
bool SafetyScriptRan = false;
if (File.Exists(Path.Combine(InnerSpaceAPI.InnerSpace.Path, "scripts/StartingQuestorSafetyScript.iss")))
{
//
// note that "StartingQuestorSafetyScript.iss" is hard coded because we cant (dont?) load the settings xml this early in the process.
//
LavishScript.ExecuteCommand("Echo [${Time}] Loading [" + "StartingQuestorSafetyScript.iss" + "]");
LavishScript.ExecuteCommand("runscript " + "StartingQuestorSafetyScript.iss");
LavishScript.ExecuteCommand("Echo [${Time}] Done Loading [" + "StartingQuestorSafetyScript.iss" + "] Did it work?");

SafetyScriptRan = true;
// continue while script runs. note: (we do NOT check to verify that it loaded!)
while (Cache.Instance.DirectEve == null && DateTime.UtcNow < AppStarted.AddSeconds(2)) //wait a few seconds
{
System.Threading.Thread.Sleep(50); //this runs while we wait for ISXStealth to run (we do NOT check to verify that it loaded!) Is this pause even necessary?
}
}
else
{
Logging.Log("Startup", "StartingQuestorSafetyScript - unable to find [" + "StartingQuestorSafetyScript.iss" + "]", Logging.White);
}

Logging.Log("Startup", "StartingQuestorSafetyScript - 3", Logging.White);

if (!SafetyScriptRan)
{
Logging.Log("Startup", "SafetyScriptRan is [" + SafetyScriptRan.ToString() + "], halting", Logging.Debug);
while (Cache.Instance.DirectEve == null)
{
System.Threading.Thread.Sleep(50); //this pauses forever...
}
}
}
catch (Exception ex)
{
Logging.Log("Startup", "Error on Loading IsxStealth", Logging.Orange);
Logging.Log("Startup", string.Format("IsxStealth: Exception {0}...", ex), Logging.White);
Cache.Instance.CloseQuestorCMDLogoff = false;
Cache.Instance.CloseQuestorCMDExitGame = true;
Cache.Instance.CloseQuestorEndProcess = true;
Settings.Instance.AutoStart = true;
Cache.Instance.ReasonToStopQuestor = "Error on Loading IsxStealth";
Cache.Instance.SessionState = "Quitting";
Cleanup.CloseQuestor();
}

#endregion Load IsxStealth

#region Load DirectEVE
//
// Load DirectEVE
Expand Down

0 comments on commit e8cf334

Please sign in to comment.