-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTabletItem.cs
More file actions
125 lines (114 loc) · 4.67 KB
/
TabletItem.cs
File metadata and controls
125 lines (114 loc) · 4.67 KB
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
using ExileCore2;
using ExileCore2.PoEMemory.Components;
using ExileCore2.PoEMemory.Elements.InventoryElements;
using ExileCore2.PoEMemory.MemoryObjects;
using ExileCore2.Shared;
using ExileCore2.Shared.Enums;
using System.Collections.Generic;
namespace TabletHighlight
{
internal enum ItemLocation {
Inventory = 0,
Stash = 1,
QuadStash = 2,
Merchant = 3
}
internal class TabletType {
internal static readonly string Irradiated = "Precursor Tablet";
internal static readonly string Breach = "Breach Precursor Tablet";
internal static readonly string Delirium = "Delirium Precursor Tablet";
internal static readonly string Ritual = "Ritual Precursor Tablet";
internal static readonly string Expedition = "Expedition Precursor Tablet";
internal static readonly string Boss = "Overseer Precursor Tablet";
internal static readonly List<string> All = new List<string> { Irradiated, Breach, Delirium, Ritual, Expedition, Boss };
}
internal class TabletItem {
internal ServerInventory.InventSlotItem inventoryItem;
internal NormalInventoryItem stashItem;
internal Mods mods;
internal int hash;
internal string tabletType;
internal RectangleF rect;
internal ItemLocation location;
internal int groupMatch = 0;
internal int iir;
internal int iiq;
internal int imq;
internal int effectiveness;
internal int rarePacksPct;
internal int explicitModCount;
internal ItemRarity rarity;
internal int usesLeft;
internal bool Processed { get; private set; }
internal bool Stale { get; set; }
internal TabletItem(ServerInventory.InventSlotItem item, ItemLocation location) {
this.inventoryItem = item;
this.hash = item.GetHashCode();
this.mods = item.Item.GetComponent<Mods>();
this.rect = item.GetClientRect();
this.location = location;
}
internal TabletItem(NormalInventoryItem item, ItemLocation location) {
this.stashItem = item;
this.hash = item.GetHashCode();
this.mods = item.Item.GetComponent<Mods>();
this.rect = item.GetClientRectCache;
this.location = location;
}
internal void Process() {
if (Processed) return;
explicitModCount = mods.ExplicitMods.Count;
rarity = mods.ItemRarity;
if (location == ItemLocation.Stash) {
if (!string.IsNullOrEmpty(stashItem.Item.GetComponent<Base>().PublicPrice)) location = ItemLocation.Merchant;
}
// Iterate through mods
foreach (var mod in mods.ItemMods) {
if (mod == null || mod.Values == null || mod.Values.Count <= 0) continue;
var value = mod.Values[0];
// Find mods
switch (mod.Name) {
case "TowerMonsterEffectiveness":
effectiveness += value;
break;
case "TowerDroppedItemRarityIncrease":
iir += value;
break;
case "TowerDroppedItemQuantityIncrease":
iiq += value;
break;
case "TowerMapDroppedMapsIncrease":
imq += value;
break;
case "TowerRarePackIncrease":
rarePacksPct += value;
break;
case "TowerAddIrradiatedToMapsImplicit":
usesLeft += value;
break;
case "TowerAddBreachToMapsImplicit":
usesLeft += value;
break;
case "TowerAddDeliriumToMapsImplicit":
usesLeft += value;
break;
case "TowerAddRitualToMapsImplicit":
usesLeft += value;
break;
case "TowerAddExpeditionToMapsImplicit":
usesLeft += value;
break;
case "TowerAddMapBossesToMapsImplicit":
usesLeft += value;
break;
}
}
foreach (var group in TabletHighlight.Instance.CustomModGroups) {
if (group.Match(this)) {
groupMatch = TabletHighlight.Instance.CustomModGroups.IndexOf(group) + 1;
}
}
Processed = true;
}
}
}