using Emgu.CV;
|
using Emgu.CV.Structure;
|
using RichCreator.Dnf;
|
using RichCreator.Utility;
|
using RichCreator.Utility.Captures;
|
using RichCreator.Utility.CV;
|
using RichCreator.Utility.InputControl;
|
using RichCreator.Utility.Maps;
|
using RichCreator.Utility.Structs;
|
using RichCreator.Utility.Utilitys;
|
using System;
|
using System.Collections.Generic;
|
using System.Linq;
|
using System.Text;
|
using System.Threading;
|
using System.Threading.Tasks;
|
|
namespace RichCreator.Maps
|
{
|
public abstract class ShikongzhimenMapBase:MapInfo
|
{
|
public ShikongzhimenMapBase(MapType mapType, ZTRectangle gameRect, CancellationToken cancellationToken):base(mapType,gameRect,cancellationToken)
|
{ }
|
/// <summary>
|
/// 步行到素喃
|
/// </summary>
|
/// <returns></returns>
|
protected bool MoveToSunan()
|
{
|
bool result = FuncUtils.NoChangeRetryCallWrap(
|
() =>
|
{
|
WindowUtils.SetDnfToTop();
|
CloseAllAlertWindowByX(this.CancelToken, this.GameRect);
|
//向下走出赛丽亚的房间 ,走向素喃
|
G.Instance.InputControl.PressKey(2000, HIDCode.DownArrow);
|
return true;
|
},
|
() =>
|
{
|
G.Instance.InfoWriter("检测是否进入素喃");
|
result = FuncUtils.TimeoutCancelableWrap(10000, this.CancelToken, () => {
|
return ShikongzhimenCVHelper.IsInSunan(this.GameRect);
|
});
|
if (!result)
|
{
|
G.Instance.InfoWriter("进入素喃失败");
|
return false;
|
}
|
|
G.Instance.InfoWriter("进入素喃成功");
|
return true;
|
},
|
() =>
|
{
|
return DnfCVHelper.IsInSaiLiYaHouse(this.GameRect);
|
});
|
return result;
|
}
|
|
/// <summary>
|
/// 步行至时空之门
|
/// </summary>
|
/// <returns></returns>
|
protected bool MoveToShikongzhimen()
|
{
|
bool result = FuncUtils.NoChangeRetryCallWrap(() =>
|
{
|
//打开地图
|
Utility.Structs.ZTPoint mapButtonPosition = new Utility.Structs.ZTPoint(this.GameRect.Start.X + 782, this.GameRect.Start.Y + 16);
|
G.Instance.InputControl.MoveToAndClick(mapButtonPosition);
|
Thread.Sleep(1000);
|
|
//点到副本之前的地图
|
Utility.Structs.ZTPoint mapPrePosition = new Utility.Structs.ZTPoint(this.GameRect.Start.X + 143, this.GameRect.Start.Y + 197);
|
G.Instance.InputControl.MoveToAndClick(mapPrePosition);
|
Thread.Sleep(1000);
|
|
//关闭地图框
|
CloseAllAlertWindowByEsc(this.CancelToken, this.GameRect);
|
return true;
|
},
|
() =>
|
{
|
//检测是否进入时空之门
|
return FuncUtils.TimeoutCancelableWrap(15000, this.CancelToken, () =>
|
{
|
CloseAllAlertWindowByX(this.CancelToken, this.GameRect);
|
return ShikongzhimenCVHelper.IsInShikongzhimen(this.GameRect);
|
});
|
},
|
() =>
|
{
|
//检测是否还在素喃
|
return FuncUtils.TimeoutCancelableWrap(3000, this.CancelToken, () => {
|
CloseAllAlertWindowByX(this.CancelToken, this.GameRect);
|
return ShikongzhimenCVHelper.IsInSunan(this.GameRect);
|
});
|
});
|
|
Thread.Sleep(5000);
|
return result;
|
}
|
|
/// <summary>
|
/// 步行到任务选择和正式开打页面
|
/// </summary>
|
/// <returns></returns>
|
protected bool MoveToChoiceTaskPage()
|
{
|
bool result = false;
|
//右走进选择副本界面
|
G.Instance.InputControl.PressKey(1500, HIDCode.LeftArrow);
|
|
|
G.Instance.InfoWriter("检测是否打开选择副本界面");
|
result = FuncUtils.TimeoutCancelableWrap(10000, this.CancelToken, () => {
|
Image<Rgb, byte> image = ScreenCapture.Instance.CaptureScreenReturnImage();
|
return ShikongzhimenCVHelper.IsInChoiceTaskPage(image, this.GameRect);
|
});
|
if (!result)
|
{
|
G.Instance.InfoWriter("进入打开选择副本界面失败");
|
return false;
|
}
|
G.Instance.InfoWriter("打开选择副本界面成功");
|
return true;
|
}
|
}
|
}
|