This repository has been archived by the owner on Mar 20, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
GluttonySettings.cs
57 lines (45 loc) · 1.75 KB
/
GluttonySettings.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
using ff14bot.Managers;
using System;
using System.Collections.Generic;
using System.Windows.Forms;
namespace Gluttony
{
public partial class GluttonySettings : Form
{
private Dictionary<uint, string> foodDict;
public static bool loading = false;
public GluttonySettings()
{
foodDict = new Dictionary<uint, string>();
InitializeComponent();
loading = true;
UpdateFood();
if (InventoryManager.FilledSlots.ContainsFooditem(Settings.Instance.Id)) { foodDropBox.SelectedValue = Settings.Instance.Id; }
spiritBindCheckBox1.Checked = Settings.Instance.SpiritPotionsEnabled;
loading = false;
}
private void FoodDropBox_SelectedIndexChanged(object sender, EventArgs e)
{
Settings.Instance.Id = (uint)foodDropBox.SelectedValue;
Settings.Instance.Save();
}
private void FoodDropBox_Click(object sender, EventArgs e) { UpdateFood(); }
private void UpdateFood()
{
foodDict.Clear();
foreach (var item in InventoryManager.FilledSlots.GetFoodItems())
{
foodDict[item.TrueItemId] = "(" + item.Count + ")" + item.Name + (item.IsHighQuality ? " HQ" : "");
}
foodDropBox.DataSource = new BindingSource(foodDict, null);
foodDropBox.DisplayMember = "Value";
foodDropBox.ValueMember = "Key";
}
private void spiritBindCheckBox1_CheckedChanged(object sender, EventArgs e)
{
if (loading) return;
Settings.Instance.SpiritPotionsEnabled = spiritBindCheckBox1.Checked;
Settings.Instance.Save();
}
}
}