forked from vtcifer/g3-standalone-xp
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathfrmExpTracker.cs
320 lines (276 loc) · 12 KB
/
frmExpTracker.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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace EXPTracker
{
public partial class frmEXPTracker : Form
{
private GeniePlugin.Interfaces.IHost _host;
public frmEXPTracker(ref GeniePlugin.Interfaces.IHost host)
{
InitializeComponent();
_host = host;
}
private void btnOk_Click(object sender, EventArgs e)
{
if (cbEnable.Checked == true)
_host.SendText("#var ExpTracker.Window 1");
else
_host.SendText("#var ExpTracker.Window 0");
if (cbRankGain.Checked == true)
_host.SendText("#var ExpTracker.ShowRankGain 1");
else
_host.SendText("#var ExpTracker.ShowRankGain 0");
if (cbLearningRate.Checked == true)
_host.SendText("#var ExpTracker.LearningRate 1");
else
_host.SendText("#var ExpTracker.LearningRate 0");
if (cbLearningRateNumber.Checked == true)
_host.SendText("#var ExpTracker.LearningRateNumber 1");
else
_host.SendText("#var ExpTracker.LearningRateNumber 0");
if (cbTrackSleep.Checked == true)
_host.SendText("#var ExpTracker.TrackSleep 1");
else
_host.SendText("#var ExpTracker.TrackSleep 0");
if (cbEchoSleep.Checked == true)
_host.SendText("#var ExpTracker.EchoSleep 1");
else
_host.SendText("#var ExpTracker.EchoSleep 0");
if (cbGagExp.Checked == true)
_host.SendText("#var ExpTracker.GagExp 1");
else
_host.SendText("#var ExpTracker.GagExp 0");
if (cbShort.Checked == true)
_host.SendText("#var ExpTracker.ShortNames 1");
else
_host.SendText("#var ExpTracker.ShortNames 0");
if (cbPersistent.Checked == true)
_host.SendText("#var ExpTracker.Persistent 1");
else
_host.SendText("#var ExpTracker.Persistent 0");
if (cbCountSkills.Checked == true)
_host.SendText("#var ExpTracker.CountSkills 1");
else
_host.SendText("#var ExpTracker.CountSkills 0");
_host.SendText("#var ExpTracker.CountMinMindstate " + updownMinMindstate.Value.ToString());
if (comboExpSort.Text == "A to Z")
_host.SendText("#var ExpTracker.SortType 0");
else if (comboExpSort.Text == "Left to Right")
_host.SendText("#var ExpTracker.SortType 1");
else if (comboExpSort.Text == "Learning Rate")
_host.SendText("#var ExpTracker.SortType 2");
else
_host.SendText("#var ExpTracker.SortType 3");
if (comboReportSort.Text == "A to Z")
_host.SendText("#var ExpTracker.ReportType 0");
else if (comboReportSort.Text == "Left to Right")
_host.SendText("#var ExpTracker.ReportType 1");
else if (comboReportSort.Text == "Learning Rate")
_host.SendText("#var ExpTracker.ReportType 2");
else
_host.SendText("#var ExpTracker.ReportType 3");
_host.SendText("#var {ExpTracker.Color.RankGained} {" + txtRankGained.Text + "}");
_host.SendText("#var {ExpTracker.Color.Learned} {" + txtLearned.Text + "}");
_host.SendText("#var {ExpTracker.Color.Normal} {" + txtNormal.Text + "}");
if (cbEchoExp.Checked == true)
_host.SendText("#var {ExpTracker.EchoExp} {1}");
else
_host.SendText("#var {ExpTracker.EchoExp} {0}");
_host.SendText("#var {ExpTracker.Color.EchoGained} {" + txtEchoGain.Text + "}");
_host.SendText("#var {ExpTracker.Color.EchoPulsed} {" + txtEchoPulse.Text + "}");
_host.SendText("#var save");
this.Close();
}
public string ColorToHex(Color oColor)
{
return "#" + Hex2Digits(oColor.R) + Hex2Digits(oColor.G) + Hex2Digits(oColor.B);
}
public string ColorToString(Color oColor)
{
if (oColor.IsNamedColor)
{
return oColor.Name;
}
return ColorToHex(oColor);
}
private static string Hex2Digits(byte color)
{
string sColor = color.ToString("X");
if (sColor.Length == 1)
{
sColor = "0" + sColor;
}
return sColor;
}
private void btnLearned_Click(object sender, EventArgs e)
{
ColorDialog colorDialog = new ColorDialog();
colorDialog.FullOpen = true;
if (colorDialog.ShowDialog() != DialogResult.Cancel)
{
txtLearned.Text = ColorToString(colorDialog.Color);
lblLearned.ForeColor = colorDialog.Color;
}
}
private void btnRankGained_Click(object sender, EventArgs e)
{
ColorDialog colorDialog = new ColorDialog();
colorDialog.FullOpen = true;
if (colorDialog.ShowDialog() != DialogResult.Cancel)
{
txtRankGained.Text = ColorToString(colorDialog.Color);
lblRankGained.ForeColor = colorDialog.Color;
}
}
private void btnNormal_Click(object sender, EventArgs e)
{
ColorDialog colorDialog = new ColorDialog();
colorDialog.FullOpen = true;
if (colorDialog.ShowDialog() != DialogResult.Cancel)
{
txtNormal.Text = ColorToString(colorDialog.Color);
lblNormal.ForeColor = colorDialog.Color;
}
}
private void Form1_Load(object sender, EventArgs e)
{
Color color;
color = Color.FromName(txtNormal.Text);
if (color.ToArgb() != 0)
lblNormal.ForeColor = color;
else if (txtNormal.Text.StartsWith("#") && txtNormal.Text.Length == 7)
lblNormal.ForeColor = System.Drawing.ColorTranslator.FromHtml(txtNormal.Text);
color = Color.FromName(txtRankGained.Text);
if (color.ToArgb() != 0)
lblRankGained.ForeColor = color;
else if (txtRankGained.Text.StartsWith("#") && txtRankGained.Text.Length == 7)
lblRankGained.ForeColor = System.Drawing.ColorTranslator.FromHtml(txtRankGained.Text);
color = Color.FromName(txtLearned.Text);
if (color.ToArgb() != 0)
lblLearned.ForeColor = color;
else if (txtLearned.Text.StartsWith("#") && txtLearned.Text.Length == 7)
lblLearned.ForeColor = System.Drawing.ColorTranslator.FromHtml(txtLearned.Text);
cbEnable_CheckedChanged(sender,e);
color = Color.FromName(txtEchoGain.Text);
if (color.ToArgb() != 0)
lblColorExpEchoGain.ForeColor = color;
else if (txtEchoGain.Text.StartsWith("#") && txtEchoGain.Text.Length == 7)
lblColorExpEchoGain.ForeColor = System.Drawing.ColorTranslator.FromHtml(txtEchoGain.Text);
color = Color.FromName(txtEchoPulse.Text);
if (color.ToArgb() != 0)
lblColorExpEchoPulse.ForeColor = color;
else if (txtEchoPulse.Text.StartsWith("#") && txtEchoPulse.Text.Length == 7)
lblColorExpEchoPulse.ForeColor = System.Drawing.ColorTranslator.FromHtml(txtEchoPulse.Text);
cbEchoExp_CheckedChanged(sender, e);
}
private void btnCancel_Click(object sender, EventArgs e)
{
this.Close();
}
private void cbEnable_CheckedChanged(object sender, EventArgs e)
{
if (cbEnable.Checked == true)
{
cbRankGain.Enabled = true;
cbLearningRate.Enabled = true;
cbLearningRateNumber.Enabled = true;
cbTrackSleep.Enabled = true;
if (cbTrackSleep.Checked == true)
cbEchoSleep.Enabled = true;
else
cbEchoSleep.Enabled = false;
cbGagExp.Enabled = true;
cbShort.Enabled = true;
cbPersistent.Enabled = true;
comboExpSort.Enabled = true;
comboReportSort.Enabled = true;
txtNormal.Enabled = true;
btnNormal.Enabled = true;
txtRankGained.Enabled = true;
btnRankGained.Enabled = true;
txtLearned.Enabled = true;
btnLearned.Enabled = true;
}
else
{
cbRankGain.Enabled = false;
cbLearningRate.Enabled = false;
cbLearningRateNumber.Enabled = false;
cbTrackSleep.Enabled = false;
cbEchoSleep.Enabled = false;
cbGagExp.Enabled = false;
cbShort.Enabled = false;
cbPersistent.Enabled = false;
comboExpSort.Enabled = false;
comboReportSort.Enabled = false;
txtNormal.Enabled = false;
btnNormal.Enabled = false;
txtRankGained.Enabled = false;
btnRankGained.Enabled = false;
txtLearned.Enabled = false;
btnLearned.Enabled = false;
}
}
private void cbTrackSleep_CheckedChanged(object sender, EventArgs e)
{
if (cbTrackSleep.Checked == true)
cbEchoSleep.Enabled = true;
else
cbEchoSleep.Enabled = false;
}
private void CbCountSkills_CheckedChanged(object sender, EventArgs e)
{
if (cbCountSkills.Checked == true)
updownMinMindstate.Enabled = true;
else
updownMinMindstate.Enabled = false;
}
private void btnColorExpEchoGain_Click(object sender, EventArgs e)
{
ColorDialog colorDialog = new ColorDialog();
colorDialog.FullOpen = true;
if (colorDialog.ShowDialog() != DialogResult.Cancel)
{
txtEchoGain.Text = ColorToString(colorDialog.Color);
lblColorExpEchoGain.ForeColor = colorDialog.Color;
}
}
private void btnColorExpEchoPulse_Click(object sender, EventArgs e)
{
ColorDialog colorDialog = new ColorDialog();
colorDialog.FullOpen = true;
if (colorDialog.ShowDialog() != DialogResult.Cancel)
{
txtEchoPulse.Text = ColorToString(colorDialog.Color);
lblColorExpEchoPulse.ForeColor = colorDialog.Color;
}
}
private void cbEchoExp_CheckedChanged(object sender, EventArgs e)
{
if (cbEchoExp.Checked == true)
{
txtEchoGain.Enabled = true;
lblColorExpEchoGain.Enabled = true;
btnColorExpEchoGain.Enabled = true;
txtEchoPulse.Enabled = true;
lblColorExpEchoPulse.Enabled = true;
btnColorExpEchoPulse.Enabled = true;
}
else
{
txtEchoGain.Enabled = false;
lblColorExpEchoGain.Enabled = false;
btnColorExpEchoGain.Enabled = false;
txtEchoPulse.Enabled = false;
lblColorExpEchoPulse.Enabled = false;
btnColorExpEchoPulse.Enabled = false;
}
}
}
}