asmrobot
2019-11-21 589ed88a5924a7494e21b95b6bbff5e46ff49ddd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
using RichCreator.Utility.CV;
using RichCreator.Utility.Structs;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Emgu.CV;
using Emgu.CV.Structure;
using System.Threading;
using RichCreator.Utility.Captures;
using ZTImage.Configuration;
using RichCreator.Utility.Utilitys;
 
namespace RichCreator.Utility.CV
{
    /// <summary>
    /// 凛冬识别
    /// </summary>
    public class LindongCVHelper
    {
        /// <summary>
        /// 凛冬难度选择向右的箭头
        /// </summary>
        public static ColorArray LindongRightGreenArrow = ColorArray.FromHsvFloatString(0.002f, 0.002f, 0.002f, "574,612,0,160,245$577,612,0,213,255$574,596,29,77,189$574,604,15,114,217$574,605,0,101,208$574,611,0,154,241$577,611,0,212,255$577,604,37,185,253$578,604,37,187,253$589,604,37,170,249$590,604,37,163,247$591,604,33,151,242");
 
        /// <summary>
        /// 凛冬难度选择向左的箭头
        /// </summary>
        public static ColorArray LindongLeftGreenArrow = ColorArray.FromHsvFloatString(0.002f, 0.002f, 0.002f, "495,605,0,145,243$495,597,74,151,252$494,597,74,152,255$494,605,0,151,248$496,605,0,131,233$496,612,0,196,255$497,612,0,173,251$481,604,36,158,246$482,604,37,166,248");
        /// <summary>
        /// 是否打开选择了凛冬副本
        /// </summary>
        /// <param name="image"></param>
        /// <param name="gameRect"></param>
        /// <returns></returns>
        public static bool IsInChoiceLindong(Image<Rgb, byte> image, ZTRectangle gameRect, out bool choiceNanduDir)
        {
            choiceNanduDir = true;
            ZTRectangle limit = new ZTRectangle(gameRect.Start.X + 400, gameRect.End.Y - 200, gameRect.Start.X + 630, gameRect.End.Y - 90);
            ZTRectangle position = ZTRectangle.Empty;
 
            if (CVHelper.FindColorArray(out position, image, LindongRightGreenArrow, limit))
            {
                choiceNanduDir = true;
                return true;
            }
 
            if (CVHelper.FindColorArray(out position, image, LindongLeftGreenArrow, limit))
            {
                choiceNanduDir = false;
                return true;
            }
            return false;
        }
 
 
        /// <summary>
        /// 凛冬难度,1¬5级
        /// </summary>
        private static ColorArray[] LindongNandu = new ColorArray[] {
            ColorArray.FromHsvFloatString(0.002f, 0.002f, 0.002f, "1391,650,102,0,170$1368,650,255,255,255$1380,650,0,102,170$1402,650,160,0,136$1413,650,170,0,17"),
            ColorArray.FromHsvFloatString(0.002f, 0.002f, 0.002f, "1391,650,102,0,170$1369,650,102,170,0$1380,650,255,255,255$1402,650,160,0,136$1413,650,170,0,17"),
            ColorArray.FromHsvFloatString(0.002f,0.002f,0.002f,"1390,650,255,255,255$1369,650,102,170,0$1380,650,0,102,170$1402,650,160,0,136$1413,650,170,0,17"),
            ColorArray.FromHsvFloatString(0.002f, 0.002f, 0.002f, "1402,650,255,255,255$1369,650,102,170,0$1380,650,0,102,170$1391,650,102,0,170$1413,650,170,0,17"),
            ColorArray.FromHsvFloatString(0.002f, 0.002f, 0.002f, "1391,650,102,0,170$1369,650,102,170,0$1380,650,0,102,170$1401,650,160,0,136$1412,650,255,255,255")
        };
 
 
 
        /// <summary>
        /// 查找凛冬难度
        /// </summary>
        /// <param name="choiceNandu"></param>
        /// <param name="image"></param>
        /// <param name="gameRect"></param>
        /// <returns></returns>
        public static bool GetChoiceLingdongNandu(out Int32 choiceNandu,Image<Rgb, byte> image, ZTRectangle gameRect)
        {
            ZTRectangle limit = new ZTRectangle(gameRect.Start.X + 270, gameRect.Start.Y +505, gameRect.Start.X + 354, gameRect.Start.Y+519);
            ZTRectangle position = ZTRectangle.Empty;
            for (int i = 0; i < LindongNandu.Length; i++)
            {
                if (CVHelper.FindColorArray(out position, image, LindongNandu[i], limit))
                {
                    choiceNandu = i + 1;
                    return true;
                }
            }
            choiceNandu = 0;
            return false;
        }
 
 
        /// <summary>
        /// 小地图时空之门文字
        /// </summary>
        public static ColorArray ShikongzhimenText = ColorArray.FromHsvFloatString(0.002f, 0.002f, 0.002f, "1162,37,230,200,155$1150,35,230,200,155$1153,35,230,200,155$1153,39,230,200,155$1150,39,230,200,155$1150,43,230,200,155$1152,43,230,200,155$1153,44,230,200,155$1159,45,230,200,155$1159,37,230,200,155$1159,34,230,200,155$1155,37,230,200,155$1162,36,230,200,155$1172,36,230,200,155$1172,37,230,200,155$1171,41,230,200,155$1163,41,230,200,155$1162,45,230,200,155$1167,43,230,200,155$1172,45,230,200,155$1181,45,230,200,155$1185,45,230,200,155$1185,37,230,200,155$1189,34,230,200,155$1194,34,230,200,155$1194,45,230,200,155");
 
        /// <summary>
        /// 是否时空之门地图
        /// </summary>
        /// <param name="image"></param>
        /// <param name="gameRect"></param>
        /// <returns></returns>
        public static bool IsShikongzhimen(Image<Rgb, byte> image, ZTRectangle gameRect)
        {
            ZTRectangle limit = new ZTRectangle(gameRect.End.X-200, gameRect.Start.Y, gameRect.End.X, gameRect.Start.Y +80);
            ZTRectangle position = ZTRectangle.Empty;
            return CVHelper.FindColorArray(out position, image, ShikongzhimenText, limit);
        }
 
        public static ColorArray LingdongRoomText = ColorArray.FromHsvFloatString(0.002f, 0.002f, 0.3f, "1144,18,204,193,167$1140,19,204,193,167$1148,19,204,193,167$1153,18,204,193,167$1153,19,204,193,167$1158,19,204,193,167$1160,25,204,193,167$1158,29,204,193,167$1157,29,204,193,167$1148,29,204,193,167$1144,29,204,193,167$1143,29,204,193,167$1140,29,204,193,167$1138,27,204,193,167");
        /// <summary>
        /// 是否存在凛冬房间上的文字
        /// </summary>
        /// <param name="image"></param>
        /// <param name="gameRect"></param>
        /// <returns></returns>
        public static bool ExistLingdongText(Image<Rgb, byte> image, ZTRectangle gameRect)
        {
            ZTRectangle limit = new ZTRectangle(gameRect.End.X - 200, gameRect.Start.Y, gameRect.End.X, gameRect.Start.Y + 40);
            ZTRectangle position = ZTRectangle.Empty;
            return CVHelper.FindColorArray(out position, image, LingdongRoomText, limit);
        }
    }
}