From 576b92fd82f568572bc4beb125fa0ba0191a602f Mon Sep 17 00:00:00 2001
From: asmrobot <asmrobot@hotmail.com>
Date: Wed, 13 Nov 2019 14:59:52 +0000
Subject: [PATCH] add map editor

---
 src/RichCreator/Maps/Lindong/LindongMap.cs |  392 +++++++++++++++++++++++++++----------------------------
 1 files changed, 195 insertions(+), 197 deletions(-)

diff --git a/src/RichCreator/Maps/Lindong/LindongMap.cs b/src/RichCreator/Maps/Lindong/LindongMap.cs
index e8d4e85..88b9a27 100644
--- a/src/RichCreator/Maps/Lindong/LindongMap.cs
+++ b/src/RichCreator/Maps/Lindong/LindongMap.cs
@@ -11,182 +11,72 @@
 using System;
 using System.Collections.Generic;
 using System.Threading;
+using RichCreator.Utility.Maps;
+using RichCreator.Utility.Skills;
+using RichCreator.Dnf;
 
-namespace RichCreator.Maps
+namespace RichCreator.Maps.Lindong
 {
     /// <summary>
     /// 凛冬地图
     /// </summary>
     public class LindongMap : MapInfo
     {
+        public LindongMap(ZTRectangle gameRect, CancellationToken cancelToken) :base(MapType.Lingdong,gameRect,cancelToken)
+        {
+            this.MiniMap = new LindongMiniMap(gameRect);
+            this.Role = new DnfRole(gameRect);
+        }
+
+
+        /// <summary>
+        /// 角色
+        /// </summary>
+        public DnfRole Role { get; set; }
+
+
         /// <summary>
         /// 地图的所有房间
         /// NextIndex=-1,完成
         /// NextIndex=-2,出错
         /// </summary>
-        internal static HouseInfo[] Houses = new HouseInfo[] {
-            new HouseInfo (){ Index=0 ,NextIndex=1 , OpenStatusDetectIndex=1 , HouseCenterMoveLine=-250,IsEnd=false,DoorDirection=new[]{Direction.Right } },
-            new HouseInfo (){ Index=1 ,NextIndex=5 , OpenStatusDetectIndex=5 , HouseCenterMoveLine=-250,IsEnd=false,DoorDirection=new[]{Direction.Bottom } },
-            new HouseInfo (){ Index=2 ,NextIndex=1 , OpenStatusDetectIndex=1 , HouseCenterMoveLine=-250,IsEnd=false,DoorDirection=new[]{Direction.Left } },
-            new HouseInfo (){ Index=3 ,NextIndex=2 , OpenStatusDetectIndex=2 , HouseCenterMoveLine=-250,IsEnd=false,DoorDirection=new[]{Direction.Left } },
-            new HouseInfo (){ Index=4 ,NextIndex=8 , OpenStatusDetectIndex=8 , HouseCenterMoveLine=-250,IsEnd=false,DoorDirection=new[]{Direction.Bottom } },
-            new HouseInfo (){ Index=5 ,NextIndex=4 , OpenStatusDetectIndex=4 , HouseCenterMoveLine=-250,IsEnd=false,DoorDirection=new[]{Direction.Left } },
-            new HouseInfo (){ Index=6 ,NextIndex=5 , OpenStatusDetectIndex=5 , HouseCenterMoveLine=-250,IsEnd=false,DoorDirection=new[]{Direction.Left } },
-            new HouseInfo (){ Index=7 ,NextIndex=6 , OpenStatusDetectIndex=6 , HouseCenterMoveLine=-250,IsEnd=false,DoorDirection=new[]{Direction.Left } },
-            new HouseInfo (){ Index=8 ,NextIndex=12 ,OpenStatusDetectIndex=12, HouseCenterMoveLine=-148,IsEnd=false,DoorDirection=new[]{Direction.Right,Direction.Bottom } },
-            new HouseInfo (){ Index=9 ,NextIndex=10, OpenStatusDetectIndex=10, HouseCenterMoveLine=-300,IsEnd=false,DoorDirection=new[]{Direction.Right,Direction.Bottom } },
-            new HouseInfo (){ Index=10,NextIndex=14, OpenStatusDetectIndex=14, HouseCenterMoveLine=-250,IsEnd=false,DoorDirection=new[]{Direction.Bottom } },
-            new HouseInfo (){ Index=11,NextIndex=10, OpenStatusDetectIndex=10, HouseCenterMoveLine=-250,IsEnd=false,DoorDirection=new[]{Direction.Left } },
-            new HouseInfo (){ Index=12,NextIndex=13, OpenStatusDetectIndex=12, HouseCenterMoveLine=-220,IsEnd=false,DoorDirection=new[]{Direction.Right } },
-            new HouseInfo (){ Index=13,NextIndex=14, OpenStatusDetectIndex=14, HouseCenterMoveLine=-320,IsEnd=false,DoorDirection=new[]{Direction.Right } },
-            new HouseInfo (){ Index=14,NextIndex=15, OpenStatusDetectIndex=-1, HouseCenterMoveLine=-320,IsEnd=false,DoorDirection=new[]{Direction.Right } },
-            new HouseInfo (){ Index=15,NextIndex=-1, OpenStatusDetectIndex=-1, HouseCenterMoveLine=-250,IsEnd=true, DoorDirection=new[]{Direction.Right } },
-            new HouseInfo (){ Index=16,NextIndex=12, OpenStatusDetectIndex=12, HouseCenterMoveLine=-250,IsEnd=false,DoorDirection=new[]{Direction.Up } },
-            new HouseInfo (){ Index=17,NextIndex=13, OpenStatusDetectIndex=13, HouseCenterMoveLine=-250,IsEnd=false,DoorDirection=new[]{Direction.Up } },
-            new HouseInfo (){ Index=18,NextIndex=14, OpenStatusDetectIndex=14, HouseCenterMoveLine=-250,IsEnd=false,DoorDirection=new[]{Direction.Up } },
-            new HouseInfo (){ Index=19,NextIndex=15, OpenStatusDetectIndex=15, HouseCenterMoveLine=-250,IsEnd=false,DoorDirection=new[]{Direction.Up } }
+        private static readonly HouseInfo[] Houses = new HouseInfo[] {
+            new HouseInfo (0 ,MapType.Lingdong,false,new HIDCode[] { HIDCode.A,HIDCode.D,HIDCode.X}){HouseCenterMoveLine=-250,DoorDirection=new[]{Direction.Right } },
+            new HouseInfo (1 ,MapType.Lingdong,false,new HIDCode[] { HIDCode.A,HIDCode.D,HIDCode.X}){HouseCenterMoveLine=-250,DoorDirection=new[]{Direction.Bottom } },
+            new HouseInfo (2 ,MapType.Lingdong,false,new HIDCode[] { HIDCode.A,HIDCode.D,HIDCode.X}){HouseCenterMoveLine=-250,DoorDirection=new[]{Direction.Left } },
+            new HouseInfo (3 ,MapType.Lingdong,false,new HIDCode[] { HIDCode.A,HIDCode.D,HIDCode.X}){HouseCenterMoveLine=-250,DoorDirection=new[]{Direction.Left } },
+            new HouseInfo (4 ,MapType.Lingdong,false,new HIDCode[] { HIDCode.A,HIDCode.D,HIDCode.X}){HouseCenterMoveLine=-250,DoorDirection=new[]{Direction.Bottom } },
+            new HouseInfo (5 ,MapType.Lingdong,false,new HIDCode[] { HIDCode.A,HIDCode.D,HIDCode.X}){HouseCenterMoveLine=-250,DoorDirection=new[]{Direction.Left } },
+            new HouseInfo (6 ,MapType.Lingdong,false,new HIDCode[] { HIDCode.A,HIDCode.D,HIDCode.X}){HouseCenterMoveLine=-250,DoorDirection=new[]{Direction.Left } },
+            new HouseInfo (7 ,MapType.Lingdong,false,new HIDCode[] { HIDCode.A,HIDCode.D,HIDCode.X}){HouseCenterMoveLine=-250,DoorDirection=new[]{Direction.Left } },
+            new HouseInfo (8 ,MapType.Lingdong,false,new HIDCode[] { HIDCode.A,HIDCode.D,HIDCode.X}){HouseCenterMoveLine=-148,DoorDirection=new[]{Direction.Right,Direction.Bottom } },
+            new HouseInfo (9 ,MapType.Lingdong,false,new HIDCode[] { HIDCode.A,HIDCode.D,HIDCode.X}){HouseCenterMoveLine=-300,DoorDirection=new[]{Direction.Right,Direction.Bottom } },
+            new HouseInfo (10,MapType.Lingdong,false,new HIDCode[] { HIDCode.A,HIDCode.D,HIDCode.X}){HouseCenterMoveLine=-250,DoorDirection=new[]{Direction.Bottom } },
+            new HouseInfo (11,MapType.Lingdong,false,new HIDCode[] { HIDCode.A,HIDCode.D,HIDCode.X}){HouseCenterMoveLine=-250,DoorDirection=new[]{Direction.Left } },
+            new HouseInfo (12,MapType.Lingdong,false,new HIDCode[] { HIDCode.A,HIDCode.D,HIDCode.X}){HouseCenterMoveLine=-220,DoorDirection=new[]{Direction.Right } },
+            new HouseInfo (13,MapType.Lingdong,false,new HIDCode[] { HIDCode.A,HIDCode.D,HIDCode.X}){HouseCenterMoveLine=-320,DoorDirection=new[]{Direction.Right } },
+            new HouseInfo (14,MapType.Lingdong,false,new HIDCode[] { HIDCode.A,HIDCode.D,HIDCode.X}){HouseCenterMoveLine=-320,DoorDirection=new[]{Direction.Right } },
+            new HouseInfo (15,MapType.Lingdong,true ,new HIDCode[] { HIDCode.A,HIDCode.D,HIDCode.X}){HouseCenterMoveLine=-250,DoorDirection=new[]{Direction.Right } },
+            new HouseInfo (16,MapType.Lingdong,false,new HIDCode[] { HIDCode.A,HIDCode.D,HIDCode.X}){HouseCenterMoveLine=-250,DoorDirection=new[]{Direction.Up } },
+            new HouseInfo (17,MapType.Lingdong,false,new HIDCode[] { HIDCode.A,HIDCode.D,HIDCode.X}){HouseCenterMoveLine=-250,DoorDirection=new[]{Direction.Up } },
+            new HouseInfo (18,MapType.Lingdong,false,new HIDCode[] { HIDCode.A,HIDCode.D,HIDCode.X}){HouseCenterMoveLine=-250,DoorDirection=new[]{Direction.Up } },
+            new HouseInfo (19,MapType.Lingdong,false,new HIDCode[] { HIDCode.A,HIDCode.D,HIDCode.X}){HouseCenterMoveLine=-250,DoorDirection=new[]{Direction.Up } }
         };
-
-        static LindongMap()
-        {
-            //1
-            SkillQueue queue = new SkillQueue();
-            //queue.EnQueue(false, HIDCode.G);
-            //queue.EnQueue(false, HIDCode.E);
-            queue.EnQueue(false, HIDCode.A);
-            queue.EnQueue(false, HIDCode.D);
-            queue.EnQueue(false, HIDCode.X);
-            Houses[2].Skills = queue;
-
-            //2
-            queue = new SkillQueue();
-            //queue.EnQueue(false, HIDCode.W);
-            //queue.EnQueue(false, HIDCode.E);
-            queue.EnQueue(false, HIDCode.A);
-            queue.EnQueue(false, HIDCode.D);
-            queue.EnQueue(false, HIDCode.X);
-            Houses[1].Skills = queue;
-
-            //3
-            queue = new SkillQueue();
-            //queue.EnQueue(false, HIDCode.Q);
-            //queue.EnQueue(false, HIDCode.T);
-            //queue.EnQueue(false, HIDCode.E);
-            queue.EnQueue(false, HIDCode.A);
-            queue.EnQueue(false, HIDCode.D);
-            queue.EnQueue(false, HIDCode.X);
-            Houses[5].Skills = queue;
-
-            //4
-            queue = new SkillQueue();
-            //queue.EnQueue(false, HIDCode.E);
-            queue.EnQueue(false, HIDCode.A);
-            queue.EnQueue(false, HIDCode.D);
-            queue.EnQueue(false, HIDCode.X);
-            Houses[4].Skills = queue;
-
-            //5
-            queue = new SkillQueue();
-            //queue.EnQueue(false, HIDCode.W);
-            //queue.EnQueue(false, HIDCode.E);
-            queue.EnQueue(false, HIDCode.A);
-            queue.EnQueue(false, HIDCode.D);
-            queue.EnQueue(false, HIDCode.X);
-            Houses[8].Skills = queue;
-
-            //6
-            queue = new SkillQueue();
-            //queue.EnQueue(false, HIDCode.R);
-            //queue.EnQueue(false, HIDCode.T);
-            //queue.EnQueue(false, HIDCode.E);
-            queue.EnQueue(false, HIDCode.A);
-            queue.EnQueue(false, HIDCode.D);
-            queue.EnQueue(false, HIDCode.X);
-            Houses[9].Skills = queue;
-
-            //7
-            queue = new SkillQueue();
-            //queue.EnQueue(false, HIDCode.Q);
-            //queue.EnQueue(false, HIDCode.E);
-            queue.EnQueue(false, HIDCode.A);
-            queue.EnQueue(false, HIDCode.D);
-            queue.EnQueue(false, HIDCode.X);
-            Houses[10].Skills = queue;
-
-
-            queue = new SkillQueue();
-            //queue.EnQueue(false, HIDCode.R);
-            //queue.EnQueue(false, HIDCode.T);
-            //queue.EnQueue(false, HIDCode.E);
-            queue.EnQueue(false, HIDCode.A);
-            queue.EnQueue(false, HIDCode.D);
-            queue.EnQueue(false, HIDCode.X);
-            Houses[12].Skills = queue;
-
-            queue = new SkillQueue();
-            //queue.EnQueue(false, HIDCode.Q);
-            //queue.EnQueue(false, HIDCode.E);
-            queue.EnQueue(false, HIDCode.A);
-            queue.EnQueue(false, HIDCode.D);
-            queue.EnQueue(false, HIDCode.X);
-            Houses[13].Skills = queue;
-
-            //8
-            queue = new SkillQueue();
-            //queue.EnQueue(false, HIDCode.W);
-            //queue.EnQueue(false, HIDCode.E);
-            queue.EnQueue(false, HIDCode.A);
-            queue.EnQueue(false, HIDCode.D);
-            queue.EnQueue(false, HIDCode.X);
-            Houses[14].Skills = queue;
-
-            //9
-            queue = new SkillQueue();
-            //queue.EnQueue(false, HIDCode.H);
-            //queue.EnQueue(false, HIDCode.Y);
-            //queue.EnQueue(false, HIDCode.T);
-            //queue.EnQueue(false, HIDCode.R);
-            //queue.EnQueue(false, HIDCode.F);
-            //queue.EnQueue(false, HIDCode.E);
-            queue.EnQueue(false, HIDCode.A);
-            queue.EnQueue(false, HIDCode.D);
-            queue.EnQueue(false, HIDCode.X);
-            Houses[15].Skills = queue;
-
-
-            //10
-            queue = new SkillQueue();
-            //queue.EnQueue(false, HIDCode.W);
-            //queue.EnQueue(false, HIDCode.E);
-            queue.EnQueue(false, HIDCode.A);
-            queue.EnQueue(false, HIDCode.D);
-            queue.EnQueue(false, HIDCode.X);
-            Houses[18].Skills = queue;
-        }
-
-        /// <summary>
-        /// 游戏区域
-        /// </summary>
-        public ZTRectangle GameRect { get; set; }
-
-        /// <summary>
-        /// 小地图区域
-        /// </summary>
-        public Utility.Structs.ZTPoint MinimapPoint = Utility.Structs.ZTPoint.Empty;
-
-        //小地图距游戏区域的偏移
-        private Utility.Structs.ZTPoint minimapPointOffset = new Utility.Structs.ZTPoint(1201, 47);
-
-        public CancellationToken cancellationToken { get; set; }
-
+        
         private Int32 runningStep = RunningStep.None;
         
-        public override ZTResult Start(ZTRectangle gameRect, CancellationToken cancelToken,Int32 runningStep)
+        
+        /// <summary>
+        /// 开始
+        /// </summary>
+        /// <param name="gameRect"></param>
+        /// <param name="cancelToken"></param>
+        /// <param name="runningStep"></param>
+        /// <returns></returns>
+        public override ZTResult Start(Int32 runningStep)
         {
             this.runningStep = runningStep;
-            this.GameRect = gameRect;
-            this.cancellationToken = cancelToken;
-            this.MinimapPoint = gameRect.Start.Add(minimapPointOffset);
+            
 
             WindowUtils.SetDnfToTop();
 
@@ -218,7 +108,7 @@
             while (true)
             {
                 //重复刷,直到疲劳值不够了
-                if (this.cancellationToken.IsCancellationRequested)
+                if (this.CancelToken.IsCancellationRequested)
                 {
                     return ZTResult.Cancel;
                 }
@@ -239,11 +129,12 @@
                     
 
                     //卖装备并关闭商店
-                    SaleEquipment( this.cancellationToken);
+                    SaleEquipment();
 
                     Int32 houseTotalSecond = (Int32)(DateTime.Now - startHouse).TotalSeconds;
-                    //查询疲劳值
                     G.Instance.InfoWriter("单次刷图成功,用时:"+(houseTotalSecond/60)+"分"+(houseTotalSecond%60)+"秒");
+
+                    //查询疲劳值
                     Int32 pilaozhi =DnfCVHelper.GetPiLaoZhi(this.GameRect);
 
                     G.Instance.InfoWriter("疲劳值:" + pilaozhi);
@@ -261,6 +152,32 @@
                     return killResult;
                 }
             }
+        }
+        
+        /// <summary>
+        /// 是否进入打怪地图
+        /// </summary>
+        /// <returns></returns>
+        public override bool IsEntryMap()
+        {
+            //查找顶端凛冬文字
+            bool findResult = FuncUtils.TimeoutCancelableWrap(2 * 60 * 1000, CancelToken, () => {
+                using (Image<Rgb, byte> image = ScreenCapture.Instance.CaptureScreenReturnImage())
+                {
+                    return LindongCVHelper.ExistLingdongText(image, this.GameRect);
+                }
+            }, 10);
+
+            //if (!findResult)
+            //{
+            //    G.Instance.InfoWriter("未找到进入凛冬的文字");
+            //}
+            //else
+            //{
+            //    G.Instance.InfoWriter("进入凛冬");
+            //}
+
+            return findResult;
         }
 
         /// <summary>
@@ -284,6 +201,7 @@
             G.Instance.InputControl.MoveToAndClick(point);
         }
 
+
         /// <summary>
         /// 刷房间
         /// </summary>
@@ -291,23 +209,13 @@
         private ZTResult KillMonster()
         {
             bool ret = false;
-
-
-            //查找顶端凛冬文字
-            bool findResult = FuncUtils.TimeoutCancelableWrap(2 * 60 * 1000, cancellationToken, () => {
-                using (Image<Rgb, byte> image = ScreenCapture.Instance.CaptureScreenReturnImage())
-                {
-                    return LindongCVHelper.ExistLingdongText(image, this.GameRect);
-                }
-            }, 10);
-            if (!findResult)
+            
+            if (!IsEntryMap())
             {
-                G.Instance.InfoWriter("未找到进入凛冬的文字");
+                G.Instance.InfoWriter("未找到进入凛冬");
                 return ZTResult.Failed;
             }
             G.Instance.InfoWriter("进入凛冬");
-
-
             
             Int32 preHouseIndex = -1;
             Int32 houseIndex = -1;
@@ -321,10 +229,7 @@
             {
                 preHouseIndex = houseIndex;
                 //看房间号
-                ret=FuncUtils.TimeoutCancelableWrap(3 * 1000, this.cancellationToken, () => {
-                    Image<Rgb, byte> image = ScreenCapture.Instance.CaptureScreenReturnImage();
-                    return LindongCVHelper.GetCurrentHouseIndex(out houseIndex, image, this.MinimapPoint);
-                }, 1);
+                ret = this.MiniMap.GetCurrentHouseIndexWaitTimeout(out houseIndex, null, this.CancelToken, 3 * 1000);
                 if (!ret)
                 {
                     G.Instance.InfoWriter("未找到人物所在房间");
@@ -332,17 +237,19 @@
                 }
 
                 G.Instance.InfoWriter("进入房间->" + houseIndex.ToString());
-                
 
-                DateTime roomStartTime = DateTime.Now;
-                KillMonsterStateMachine kmsm = new KillMonsterStateMachine(Houses[houseIndex], this.MinimapPoint, this.GameRect, preHouseIndex,this.runningStep, cancellationToken);
+                HouseInfo houseInfo = Houses[houseIndex];
+                this.Role.SetHouse(houseInfo);
+                DateTime startTime = DateTime.Now;
+                KillMonsterStateMachine kmsm = new KillMonsterStateMachine(this, houseInfo,this.Role, preHouseIndex,this.runningStep);
                 ZTResult smresult = kmsm.Work( 5 * 60 * 1000);
-                Int32 roomTotalSecond = (Int32)(DateTime.Now - roomStartTime).TotalSeconds;
+                Int32 roomTotalSecond = (Int32)(DateTime.Now - startTime).TotalSeconds;
                 G.Instance.InfoWriter("房间刷完,用时:" + (roomTotalSecond / 60) + "分" + (roomTotalSecond % 60) + "秒");
+
                 runningStep = RunningStep.None;
                 if (smresult == ZTResult.Success)
                 {
-                    if (houseIndex == 15)
+                    if (houseInfo.IsEnd)
                     {
                         //所有房间刷完
                         return ZTResult.Success;
@@ -368,14 +275,14 @@
                () =>
                {
                    WindowUtils.SetDnfToTop();
-                   CloseAllAlertWindow(this.cancellationToken, this.GameRect);
+                   CloseAllAlertWindow(this.CancelToken, this.GameRect);
                    //向下走出赛丽亚的房间  ,走向素喃
                    G.Instance.InputControl.PressKey(2000, HIDCode.DownArrow);
                },
                () =>
                {
                    G.Instance.InfoWriter("检测是否进入素喃");
-                   result = FuncUtils.TimeoutCancelableWrap(10000, this.cancellationToken, () => {
+                   result = FuncUtils.TimeoutCancelableWrap(10000, this.CancelToken, () => {
                        return LindongCVHelper.IsInSunan(this.GameRect);
                    });
                    if (!result)
@@ -412,22 +319,22 @@
                 G.Instance.InputControl.MoveToAndClick(mapPrePosition);
 
                 //关闭地图框
-                CloseAllAlertWindow(this.cancellationToken, this.GameRect);
+                CloseAllAlertWindow(this.CancelToken, this.GameRect);
             },
             () =>
             {
                 //检测是否进入时空之门
-                return FuncUtils.TimeoutCancelableWrap(15000, this.cancellationToken, () =>
+                return FuncUtils.TimeoutCancelableWrap(15000, this.CancelToken, () =>
                   {
-                      CloseAllAlertWindow(this.cancellationToken, this.GameRect);
+                      CloseAllAlertWindow(this.CancelToken, this.GameRect);
                       return LindongCVHelper.IsInShikongzhimen(this.GameRect);
                   });
             },
             () =>
             {
                 //检测是否还在素喃
-                return FuncUtils.TimeoutCancelableWrap(3000, this.cancellationToken, () => {
-                    CloseAllAlertWindow(this.cancellationToken, this.GameRect);
+                return FuncUtils.TimeoutCancelableWrap(3000, this.CancelToken, () => {
+                    CloseAllAlertWindow(this.CancelToken, this.GameRect);
                     return LindongCVHelper.IsInSunan(this.GameRect);
                 });
             });
@@ -448,7 +355,7 @@
 
 
             G.Instance.InfoWriter("检测是否打开选择副本界面");
-            result = FuncUtils.TimeoutCancelableWrap(10000, this.cancellationToken, () => {
+            result = FuncUtils.TimeoutCancelableWrap(10000, this.CancelToken, () => {
                 Image<Rgb, byte> image = ScreenCapture.Instance.CaptureScreenReturnImage();
                 return LindongCVHelper.IsInChoiceTaskPage(image, this.GameRect);
             });
@@ -549,8 +456,7 @@
 
             return false;
         }
-
-        
+                
         /// <summary>
         /// 选择难度
         /// </summary>
@@ -592,7 +498,7 @@
         /// 出售装备
         /// </summary>
         /// <param name="saleButtonRect"></param>
-        private bool SaleEquipment(CancellationToken cancelToken)
+        private bool SaleEquipment()
         {
             //卖装备并关闭商店
             ZTRectangle closeButtonRect = ZTRectangle.Empty;
@@ -608,7 +514,7 @@
 
             //得到装备文字位置
             ZTRectangle equipmentTextRect = ZTRectangle.Empty;
-            bool result = FuncUtils.TimeoutCancelableWrap(5000, cancelToken, () => {
+            bool result = FuncUtils.TimeoutCancelableWrap(5000, this.CancelToken, () => {
                 Int32 status = 0;
                 if (DnfCVHelper.GetEquipmentSelectStatus(out equipmentTextRect, out status, this.GameRect))
                 {
@@ -631,7 +537,7 @@
 
 
             //开始点,每格步进30
-            Utility.Structs.ZTPoint startPoint = new Utility.Structs.ZTPoint( equipmentTextRect.End.X-30, equipmentTextRect.End.Y+9);
+            ZTPoint startPoint = new Utility.Structs.ZTPoint( equipmentTextRect.End.X-30, equipmentTextRect.End.Y+9);
             List<Int32> points = DnfCVHelper.GetEquipmentIndexs(startPoint);
 
             for (int i = 0; i < points.Count; i++)
@@ -657,5 +563,97 @@
             G.Instance.InputControl.PressKey(RandomUtils.KeyPressDuration, HIDCode.Escape);
             return true;
         }
+
+
+        public override void EntryHousePrework(int houseIndex, int preHouseIndex)
+        {
+            //移动和发招
+            switch (houseIndex)
+            {
+                case 2:
+                    G.Instance.InputControl.PressKey(RandomUtils.KeyPressDuration, HIDCode.LeftArrow);
+                    this.Role.SyncMove(new ZTPoint(-110, 0));
+                    G.Instance.InputControl.PressKeys(HIDCode.LeftArrow, HIDCode.G);
+
+                    break;
+                case 1:
+                    this.Role.SyncMove(new ZTPoint(-480, 80));
+                    G.Instance.InputControl.PressKey(RandomUtils.KeyPressDuration, HIDCode.W);
+                    break;
+                case 5:
+                    //G.Instance.InputControl.PressKey(RandomUtils.KeyPressDuration, HIDCode.RightArrow);
+                    G.Instance.InputControl.PressKey(RandomUtils.KeyPressDuration, HIDCode.R);
+                    Thread.Sleep(1000);
+                    G.Instance.InputControl.PressKey(RandomUtils.KeyPressDuration, HIDCode.T);
+                    break;
+                case 4:
+                    this.Role.SyncMove(new ZTPoint(-1150, -50));
+                    G.Instance.InputControl.PressKey(RandomUtils.KeyPressDuration, HIDCode.RightArrow);
+                    G.Instance.InputControl.PressKey(RandomUtils.KeyPressDuration, HIDCode.E);
+                    //Thread.Sleep(1000);
+                    //G.Instance.InputControl.PressKey(RandomUtils.KeyPressDuration, HIDCode.E);
+                    break;
+                case 8:
+                    this.Role.SyncMove(new ZTPoint(-100, 110));
+                    G.Instance.InputControl.PressKey(RandomUtils.KeyPressDuration, HIDCode.RightArrow);
+                    G.Instance.InputControl.PressKey(RandomUtils.KeyPressDuration, HIDCode.G);
+                    //Thread.Sleep(300);
+                    //G.Instance.InputControl.PressKey(RandomUtils.KeyPressDuration, HIDCode.Z);
+                    break;
+                case 9:
+                    this.Role.SyncMove(new ZTPoint(325, 65));
+                    G.Instance.InputControl.PressKey(RandomUtils.KeyPressDuration, HIDCode.R);
+                    Thread.Sleep(1000);
+                    this.Role.SyncMove(new ZTPoint(300, 0));
+                    G.Instance.InputControl.PressKey(RandomUtils.KeyPressDuration, HIDCode.T);
+                    break;
+                case 10:
+                    G.Instance.InputControl.PressKey(RandomUtils.KeyPressDuration, HIDCode.Q);
+                    break;
+                case 12:
+                    G.Instance.InputControl.PressKey(RandomUtils.KeyPressDuration, HIDCode.RightArrow);
+                    G.Instance.InputControl.PressKey(RandomUtils.KeyPressDuration, HIDCode.R);
+                    Thread.Sleep(1000);
+                    this.Role.SyncMove(new ZTPoint(-110, 0));
+                    G.Instance.InputControl.PressKey(RandomUtils.KeyPressDuration, HIDCode.T);
+                    break;
+                case 13:
+                    if (preHouseIndex == 12)
+                    {
+                        this.Role.SyncMove(new ZTPoint(600, 150));
+                    }
+                    else
+                    {
+                        this.Role.SyncMove(new ZTPoint(-300, 200));
+                        G.Instance.InputControl.PressKey(RandomUtils.KeyPressDuration, HIDCode.RightArrow);
+                    }
+                    G.Instance.InputControl.PressKey(RandomUtils.KeyPressDuration, HIDCode.Q);
+                    Thread.Sleep(1000);
+                    G.Instance.InputControl.PressKey(RandomUtils.KeyPressDuration, HIDCode.E);
+                    break;
+                case 14:
+                    if (preHouseIndex == 13)
+                    {
+                        this.Role.SyncMove(new ZTPoint(400, 0));
+                    }
+                    else
+                    {
+                        this.Role.SyncMove(new ZTPoint(0, 100));
+                    }
+                    G.Instance.InputControl.PressKey(RandomUtils.KeyPressDuration, HIDCode.W);
+                    break;
+
+                case 15:
+                    this.Role.SyncMove(new ZTPoint(600, 0));
+                    G.Instance.InputControl.PressKey(RandomUtils.KeyPressDuration, HIDCode.H);
+                    Thread.Sleep(5000);
+                    G.Instance.InputControl.PressKey(RandomUtils.KeyPressDuration, HIDCode.Y);
+                    break;
+                case 18:
+                    G.Instance.InputControl.PressKey(RandomUtils.KeyPressDuration, HIDCode.W);
+                    break;
+
+            }
+        }
     }
 }

--
Gitblit v1.9.3