-
Notifications
You must be signed in to change notification settings - Fork 60
/
Items.cs
158 lines (138 loc) · 4.97 KB
/
Items.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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using FFACETools;
namespace CurePlease
{
public partial class Form1
{
public class Items
{
private List<int> TempItemListIDs;
#region Item Enums
public enum TempUsableItems : int
{
LucidEtherI = 5827,
LucidEtherII = 5828,
LucidEtherIII = 5829,
/*ManaMist = 5833,
ManaPowder = 4255,
DustyEther = 5432,
DustyElixir = 5433,
LucidElixirI = 5830,
LucidElixirII = 5831,*/
Megalixir = 4254
}
public enum UsableMPItems : int
{
Mulsum = 4156,
Ether = 4128,
Ether1 = 4129,
Ether2 = 4130,
Ehter3 = 4131,
HiEther = 4132,
HiEther1 = 4133,
HiEther2 = 4134,
HiEther3 = 4135,
/*Elixir = ,
ElixirVitae = ,
VileElixir = ,
HiElixir = ,
VileElixir1 = */
}
public enum UsableMPMedicatedItems : int
{
//
}
#endregion
public Items()
{
TempItemListIDs = new List<int>();
GetTempItems();
// Usage:
}
private List<int> GetTempItems ()
{
for (byte i = 1; i <= _FFACEPL.Item.TemporaryCount; i++)
{
foreach (var tempUsableItem in Enum.GetValues(typeof(TempUsableItems)))
{
if (_FFACEPL.Item.GetTempItemIDByIndex(i) == (int)tempUsableItem)
{
TempItemListIDs.Add(_FFACEPL.Item.GetTempItemIDByIndex(i));
}
}
}
return TempItemListIDs;
}
private bool HasTempItem (TempUsableItems tempitemname)
{
if (_FFACEPL.Item.GetTempItemCount((ushort)Enum.Parse(typeof(TempUsableItems), tempitemname.ToString())) > 0)
{
return true;
}
return false;
}
public void TempItemUsageDetermination ()
{
// Only continue if we have the option to use low MP items selected
if (!Properties.Settings.Default.lowMPuseitem)
return;
// Don't use items if your weakened
if (_FFACEPL.Player.StatusEffects.Any(status => status == StatusEffect.Weakness))
{
return;
}
int mpcurrent = _FFACEPL.Player.MPCurrent;
int mpmax = _FFACEPL.Player.MPMax;
int mppcurrent = _FFACEPL.Player.MPPCurrent;
if (mpcurrent + 1000 < mpmax)
{
if (HasTempItem(TempUsableItems.LucidEtherIII))
{
UseItem(TempUsableItems.LucidEtherIII);
Thread.Sleep(1500);
}
}
else if (( mpcurrent + 500 ) < mpmax)
{
if (HasTempItem(TempUsableItems.LucidEtherII))
{
UseItem(TempUsableItems.LucidEtherII);
Thread.Sleep(1500);
}
}
else if (mppcurrent + 250 < mpmax)
{
if (HasTempItem(TempUsableItems.LucidEtherI))
{
UseItem(TempUsableItems.LucidEtherI);
Thread.Sleep(1500);
}
}
// If we are out of MP then we need to use the megaelixir
else if (mpcurrent <= Properties.Settings.Default.mpMinCastValue)
{
if (HasTempItem(TempUsableItems.Megalixir))
{
UseItem(TempUsableItems.Megalixir);
Thread.Sleep(3500);
}
}
}
private void UseItem(TempUsableItems item)
{
if (_FFACEPL.Player.Status == Status.Standing && HasTempItem(item))
{
_FFACEPL.Windower.SendString(string.Format("/item {0} <me>", FFACE.ParseResources.GetItemName((int)Enum.Parse(typeof(TempUsableItems), item.ToString()))));
}
}
private int GetMPPfromInt()
{
return ((_FFACEPL.Player.MPCurrent/_FFACEPL.Player.MPMax)*100);
}
}
}
}