-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTrackPortalCreations.cs
73 lines (56 loc) · 2.04 KB
/
TrackPortalCreations.cs
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
using ElfKingdom;
using System.Collections.Generic;
namespace SkillZ
{
class TrackPortalCreations
{
private static Dictionary<int, int> LavaGiantCounts = new Dictionary<int, int>();
private static Dictionary<int, int> IceTrollCounts = new Dictionary<int, int>();
public static Portal IsPortalInLocation(MapObject mapObject)
{
foreach(Portal portal in Constants.GameCaching.GetEnemyPortals()/*InArea(new Circle(mapObject, Constants.Game.PortalSize))*/)
{
if (portal.GetLocation() == mapObject.GetLocation()) return portal;
}
return null;
}
public static void UpdateEnemyPortalCreations()
{
foreach(LavaGiant lavaGiant in Constants.GameCaching.GetEnemyLavaGiants())
{
Portal portal = IsPortalInLocation(lavaGiant);
if (portal != null)
{
int count = 0;
LavaGiantCounts.TryGetValue(portal.UniqueId, out count);
LavaGiantCounts[portal.UniqueId] = count + 1;
}
}
foreach (IceTroll iceTroll in Constants.GameCaching.GetEnemyIceTrolls())
{
Portal portal = IsPortalInLocation(iceTroll);
if (portal != null)
{
int count = 0;
if (IceTrollCounts.TryGetValue(portal.UniqueId, out count))
{
count++;
}
IceTrollCounts[portal.UniqueId] = count;
}
}
}
public static int GetPortalLavaGiantsCount(Portal portal)
{
int count = 0;
LavaGiantCounts.TryGetValue(portal.UniqueId, out count);
return count;
}
public static int GetPortalIceTrollCount(Portal portal)
{
int count = 0;
IceTrollCounts.TryGetValue(portal.UniqueId, out count);
return count;
}
}
}