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
using Emgu.CV;
using Emgu.CV.Structure;
using RichCreator.Dnf;
using RichCreator.Utility.Captures;
using RichCreator.Utility.CV;
using RichCreator.Utility.Maps;
using RichCreator.Utility.Structs;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
 
namespace RichCreator.Maps.Kalete
{
    public class KaleteMiniMap : IMiniMap
    {
        public KaleteMiniMap(ZTRectangle gameRect):base(gameRect, new ZTPoint(703, 47))
        {}
 
        
 
        protected override  bool GetCurrentHouse(out Int32 houseIndex, Image<Rgb, byte> image)
        {
            houseIndex = -1;
            Int32 overHouseDected = -1;
            for (int i = 0; i < 20; i++)
            {
                Int32 row = i / 5;
                Int32 col = i % 5;
 
                //目标块第一块坐标
                Int32 x = this.MinimapOffset.X + col * 18;
                Int32 y = this.MinimapOffset.Y + row * 18;
 
                if (DnfCVHelper.IsCurrentHouseColor(image,x,y))
                {
                    //当前房间
                    houseIndex = i;
                    return true;
                }
 
                if (i == 16)
                {
                    //17格是否青色并且16格是红色,则认为角色在16房间
                    if (DnfCVHelper.IsCrossedHouseColor(image, x+18, y))
                    {
                        if (DnfCVHelper.IsOverHouseColor(image,x,y))
                        {
                            overHouseDected = 16;
                        }
                    }
                }
            }
 
 
            if (overHouseDected > -1)
            {
                //其它房间没有,并且已经检测到了最后一个房间
                houseIndex = overHouseDected;
                return true;
            }
            return false;
        }
    }
}