-
Notifications
You must be signed in to change notification settings - Fork 16
/
Constants.cs
340 lines (260 loc) · 9.54 KB
/
Constants.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
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
/*
DeepDungeon is licensed under a
Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
You should have received a copy of the license along with this
work. If not, see <http://creativecommons.org/licenses/by-nc-sa/4.0/>.
Orginal work done by zzi, contibutions by Omninewb, Freiheit, and mastahg
*/
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.InteropServices;
using Clio.Utilities;
using Deep.Helpers;
using Deep.Logging;
using Deep.Memory;
using ff14bot;
using ff14bot.Enums;
using ff14bot.Managers;
using Newtonsoft.Json;
using Deep.Properties;
using ff14bot.RemoteAgents;
namespace Deep
{
public static class PoiTypes
{
public const int ExplorePOI = 9;
public const int UseCarnOfReturn = 10;
}
/// <summary>
/// Notable mobs in Deep Dungeon
/// </summary>
internal static class Mobs
{
internal static uint PalaceHornet = 4981;
internal static uint PalaceSlime = 4990;
}
/// <summary>
/// Various entity Ids present in Deep Dungeon
/// </summary>
internal static class EntityNames
{
internal static uint TrapCoffer = 2005808;
internal static uint GoldCoffer = 2007358;
internal static uint SilverCoffer = 2007357;
internal static uint[] MimicCoffer = {2006020, 2006022};
internal static uint Hidden = 2007542;
internal static uint BandedCoffer = 2007543;
internal static uint FloorExit = 2007188;
internal static uint BossExit = 2005809;
internal static uint LobbyExit = 2006016;
internal static uint LobbyEntrance = 2006012;
internal static uint CairnofReturn = 2007187;
#region Pets
internal static uint RubyCarby = 5478;
internal static uint Garuda = 1404;
internal static uint TopazCarby = 1400;
internal static uint EmeraldCarby = 1401;
internal static uint Titan = 1403;
internal static uint Ifrit = 1402;
internal static uint Eos = 1398;
internal static uint Selene = 1399;
internal static uint Rook = 3666;
internal static uint Bishop = 3667;
#endregion
}
internal static class Items
{
internal static int Antidote = 4564;
internal static int EchoDrops = 4566;
internal static int SustainingPotion = 20309;
}
internal static class Auras
{
internal static uint Frog = 1101;
internal static uint Toad = 439;
internal static uint Toad2 = 441;
internal static uint Chicken = 1102;
internal static uint Imp = 1103;
internal static uint Lust = 565;
internal static uint Rage = 565;
internal static uint Steel = 1100;
internal static uint Strength = 687;
internal static uint Sustain = 184;
#region Floor Debuffs
internal static uint Pox = 1087;
internal static uint Blind = 1088;
internal static uint HpDown = 1089;
internal static uint DamageDown = 1090;
internal static uint Amnesia = 1092;
internal static uint ItemPenalty = 1094;
internal static uint SprintPenalty = 1095;
internal static uint KnockbackPenalty = 1096;
internal static uint NoAutoHeal = 1097;
#endregion
public static uint Enervation = 546;
public static uint Pacification = 620;
public static uint Silence = 7;
public static uint[] Poisons = {
18, 275, 559, 560, 686, 801
};
}
internal static class Spells
{
internal static uint LustSpell = 6274;
internal static uint RageSpell = 6273;
internal static uint ResolutionSpell = 6871;
}
internal static class WindowNames
{
internal static string DDmenu = "DeepDungeonMenu";
internal static string DDsave = "DeepDungeonSaveData";
internal static string DDmap = "DeepDungeonMap";
internal static string DDStatus = "DeepDungeonStatus";
}
internal class Potion
{
[JsonProperty("Id")]
public uint Id;
[JsonProperty("Level")]
public uint Level;
[JsonProperty("Rate")]
public float[] Rate;
[JsonProperty("Max")]
public uint[] Max;
public float RecoverMax => Core.Me.MaxHealth * Rate[1];
public uint Recovery => (uint)Math.Min(RecoverMax, Max[1]);
public float LevelScore => Max[1] / RecoverMax;
public float EffectiveMax(float playerMaxHealth, bool hq)
{
var index = hq ? 1 : 0;
return Math.Min(playerMaxHealth * Rate[index], Max[index]);
}
public float EffectiveHPS(float playerMaxHealth, bool hq)
{
var effectiveMax = EffectiveMax(playerMaxHealth, hq);
float cooldown = ItemData[hq ? 1 : 0].Cooldown;
if (hq)
cooldown = cooldown * .89f;
//Logger.Info($"{ItemData[hq ? 1 : 0]} has a effective HPS of {effectiveMax / cooldown}");
return effectiveMax / cooldown;
}
private Item[] ItemData;
private float[] HPs;
internal void Setup()
{
ItemData = new Item[2]
{
DataManager.GetItem(Id, false),
DataManager.GetItem(Id, true)
};
HPs = new[]
{
Max[0] / (float)ItemData[0].Cooldown,
Max[1] / (float)ItemData[1].Cooldown,
};
}
}
internal static class Constants
{
static Constants()
{
Maps = new Dictionary<uint, uint>
{
//mapid - wall file
{561, 1 },
{562, 2},
{563, 3},
{564, 4},
{565, 4},
{593, 5},
{594, 5},
{595, 5},
{596, 6},
{597, 6},
{598, 6},
{599, 8},
{600, 8},
{601, 9},
{602, 9},
{603, 7},
{604, 7},
{605, 7},
{606, 7},
{607, 7}
};
DeepDungeonRawIds = Maps.Keys.ToArray();
Pots = loadResource<Potion[]>(Resources.pots).ToDictionary(r => r.Id, r => r);
foreach (var pot in Pots)
{
PotionIds.Add(pot.Key);
pot.Value.Setup();
}
}
/// <summary>
/// returns true if we are in any of the Deep Dungeon areas.
/// </summary>
internal static bool InDeepDungeon => DeepDungeonRawIds.Contains(WorldManager.ZoneId);
/// <summary>
/// Pull range (minimum of 8)
/// </summary>
internal static float ModifiedCombatReach
{
get
{
if (!PartyManager.IsInParty)
return 17;
return Math.Max(8, RoutineManager.Current.PullRange + Settings.Instance.PullRange);
}
}
internal static Vector3 CaptainNpcPosition = new Vector3(187.5486f, 7.238432f, -39.26154f);
internal static uint CaptainNpcId = 1017323;
internal static uint SouthShroudZoneId = 153;
//570 is staging.
//561 - 565 are 1-50
//593 - 607 are 51-200
internal static uint[] DeepDungeonRawIds;
#region DataAsResource
internal static Dictionary<uint, uint> Maps;
internal static uint[] TrapIds = new uint[] {
2007182,
2007183,
2007184,
2007185,
2007186
};
internal static HashSet<uint> PotionIds = new HashSet<uint>();
internal static Dictionary<uint,Potion> Pots { get; private set; }
public static bool InExitLevel => WorldManager.ZoneId == 570;
/// <summary>
/// loads a json resource file
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="text"></param>
/// <returns></returns>
private static T loadResource<T>(string text)
{
return JsonConvert.DeserializeObject<T>(text);
}
#endregion
internal static uint[] Exits = { EntityNames.FloorExit, EntityNames.BossExit, EntityNames.LobbyExit};
//2002872 = some random thing that the bot tries to target in boss rooms. actual purpose unknown
internal static uint[] IgnoreEntity = {5402, EntityNames.FloorExit, EntityNames.CairnofReturn, EntityNames.LobbyEntrance, 2002872, EntityNames.RubyCarby, EntityNames.EmeraldCarby, EntityNames.TopazCarby, EntityNames.Garuda, EntityNames.Titan, EntityNames.Ifrit, EntityNames.Eos, EntityNames.Selene, EntityNames.Rook, EntityNames.Bishop };
internal static uint MapVersion = 4;
internal static Language Lang;
//cn = 3
//64 = 2
//32 = 1
internal static AgentDeepDungeonSaveData GetSaveInterface()
{
return AgentModule.GetAgentInterfaceByType<AgentDeepDungeonSaveData>();
}
public static void INIT()
{
var field = (Language)(typeof(DataManager).GetFields(BindingFlags.Static | BindingFlags.NonPublic).First(i => i.FieldType == typeof(Language)).GetValue(null));
Lang = field;
}
}
}