Skip to content

Commit

Permalink
Undock when retreating is not required anymore.
Browse files Browse the repository at this point in the history
  • Loading branch information
Viir committed Jul 19, 2016
1 parent 0e681c8 commit ef16dfb
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/Sanderling.ABot/Bot/Bot.cs
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,8 @@ IEnumerable<IBotTask> SequenceRootTask()
if (!saveShipTask.AllowRoam)
yield break;

yield return new UndockTask { MemoryMeasurement = MemoryMeasurementAtTime?.Value };

var combatTask = new CombatTask { bot = this };

yield return combatTask;
Expand Down
29 changes: 29 additions & 0 deletions src/Sanderling.ABot/Bot/Task/Undock.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Sanderling.Motor;
using Sanderling.Parse;

namespace Sanderling.ABot.Bot.Task
{
public class UndockTask : IBotTask
{
public IMemoryMeasurement MemoryMeasurement;

public IEnumerable<IBotTask> Component => null;

public MotionParam Motion
{
get
{
if (MemoryMeasurement?.IsUnDocking ?? false)
return null;

if (!(MemoryMeasurement?.IsDocked ?? false))
return null;

return MemoryMeasurement?.WindowStation?.FirstOrDefault()?.UndockButton?.MouseClick(BotEngine.Motor.MouseButtonIdEnum.Left);
}
}
}
}
1 change: 1 addition & 0 deletions src/Sanderling.ABot/Sanderling.ABot.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
<Compile Include="Bot\Task\Module.cs" />
<Compile Include="Bot\Task\Retreat.cs" />
<Compile Include="Bot\Task\SaveShip.cs" />
<Compile Include="Bot\Task\Undock.cs" />
<Compile Include="Parse\ParseExtension.cs" />
<Compile Include="Parse\ParseStatic.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
Expand Down

0 comments on commit ef16dfb

Please sign in to comment.