-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCustomColumns.cs
149 lines (133 loc) · 4.42 KB
/
CustomColumns.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
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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
using System.Windows.Forms;
using Advanced_Combat_Tracker;
using System.Reflection;
using System.Collections.Generic;
[assembly: AssemblyTitle("Custom columns")]
[assembly: AssemblyDescription("Adds custom columns for FFXIV")]
[assembly: AssemblyCompany("valarnin")]
[assembly: AssemblyVersion("1.0.0.1")]
namespace ACT_Plugin
{
public class CustomColumnDef
{
public List<string> IncomingAbilities = new List<string>();
public List<string> OutgoingAbilities = new List<string>();
public List<string> EitherAbilities = new List<string>();
public string ExportName;
public string Name;
public string Description;
private List<string> calculatedIncomingAbilities = new List<string>();
private List<string> calculatedOutgoingAbilities = new List<string>();
public void Initialize()
{
foreach (var ability in this.IncomingAbilities)
if (!this.calculatedIncomingAbilities.Contains(ability))
this.calculatedIncomingAbilities.Add(ability);
foreach (var ability in this.OutgoingAbilities)
if (!this.calculatedOutgoingAbilities.Contains(ability))
this.calculatedOutgoingAbilities.Add(ability);
foreach (var ability in this.EitherAbilities) {
if (!this.calculatedIncomingAbilities.Contains(ability))
this.calculatedIncomingAbilities.Add(ability);
if (!this.calculatedOutgoingAbilities.Contains(ability))
this.calculatedOutgoingAbilities.Add(ability);
}
CombatantData.ColumnDefs.Add(Name,
new CombatantData.ColumnDef(Name, true, "INT", Name,
(Data) => {
return GetCount(Data).ToString();
},
(Data) => {
return GetCount(Data).ToString();
},
(Left, Right) => {
return GetCount(Left).CompareTo(GetCount(Right));
}
)
);
// Make sure the new column is in the Options tab
ActGlobals.oFormActMain.ValidateTableSetup();
CombatantData.ExportVariables.Add(ExportName,
new CombatantData.TextExportFormatter(ExportName, Name, Description,
(Data, Extra) => {
return GetCount(Data).ToString();
}
)
);
}
public int GetCount(CombatantData Data) {
int count = 0;
AttackType atk = null;
foreach (var ability in this.calculatedIncomingAbilities)
{
if (Data.AllInc.TryGetValue(ability, out atk))
count += atk.Swings;
}
foreach (var ability in this.calculatedOutgoingAbilities)
{
if (Data.AllOut.TryGetValue(ability, out atk))
count += atk.Swings;
}
return count;
}
}
public class CustomColumns : IActPluginV1
{
Label lblStatus; // The status label that appears in ACT's Plugin tab
List<CustomColumnDef> Columns;
public void DeInitPlugin()
{
lblStatus.Text = "Plugin Exited";
}
public void InitPlugin(TabPage pluginScreenSpace, Label pluginStatusText)
{
lblStatus = pluginStatusText; // Hand the status label's reference to our local var
this.Columns = new List<CustomColumnDef>();
Columns.Add(new CustomColumnDef()
{
ExportName = "rezes",
Name = "Rezes",
Description = "Number of resurrections cast by the combatant.",
OutgoingAbilities = new List<string>(){
"Resurrection",
"Raise",
"Ascend",
"Angel Whisper",
"Verraise",
"Lost Sacrifice",
"Lost Arise",
"Resistance Phoenix",
"Egeiro"
},
});
Columns.Add(new CustomColumnDef()
{
ExportName = "dmgdown",
Name = "Dmg Down",
Description = "Number of Damage Downs received by the combatant.",
IncomingAbilities = new List<string>(){
"Damage Down"
},
});
Columns.Add(new CustomColumnDef()
{
ExportName = "vulns",
Name = "Vulns",
Description = "Number of Vulnerability Ups received by the combatant.",
IncomingAbilities = new List<string>(){
"Vulnerability Up"
},
});
InitColumns();
ActGlobals.oFormActMain.ValidateLists(); // Make sure the new variable appears in the preset creator
lblStatus.Text = "Plugin Started";
}
private void InitColumns()
{
foreach (var column in this.Columns)
{
column.Initialize();
}
}
}
}