This repository has been archived by the owner on Jan 17, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathExtras.cs
94 lines (79 loc) · 3.04 KB
/
Extras.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
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using ff14bot.Enums;
using ff14bot.Managers;
using ff14bot.Objects;
using LlamaLibrary.Helpers;
namespace LlamaLibrary.ScriptConditions
{
public static class Extras
{
public static int NumAttackableEnemies(float dist = 0, params uint[] ids)
{
if (ids.Length == 0)
{
if (dist > 0) return GameObjectManager.GetObjectsOfType<BattleCharacter>().Count(i => i.CanAttack && i.IsTargetable && i.Distance() < dist);
else return GameObjectManager.GetObjectsOfType<BattleCharacter>().Count(i => i.CanAttack && i.IsTargetable);
}
else
{
if (dist > 0) return GameObjectManager.GetObjectsByNPCIds<BattleCharacter>(ids).Count(i => i.CanAttack && i.IsTargetable && i.Distance() < dist);
else return GameObjectManager.GetObjectsByNPCIds<BattleCharacter>(ids).Count(i => i.CanAttack && i.IsTargetable);
}
}
public static int SphereCompletion(int itemID)
{
return (int) (InventoryManager.FilledInventoryAndArmory.FirstOrDefault(i => i.RawItemId == (uint)itemID).SpiritBond);
}
public static int HighestILvl(ClassJobType job)
{
IEnumerable<GearSet> sets = GearsetManager.GearSets.Where(g => g.InUse && g.Class == job && g.Gear.Any());
return sets.Any() ? sets.Max(GeneralFunctions.GetGearSetiLvl) : 0;
}
public static bool IsFateActive(int fateID)
{
return FateManager.ActiveFates.Any(i => i.Id == (uint)fateID);
}
public static bool HasLearnedMount(int mountID)
{
return ActionManager.AvailableMounts.Any(i=> i.Id == ((uint)mountID));
}
public static int BeastTribeRank(int tribeID)
{
return BeastTribeHelper.GetBeastTribeRank(tribeID);
}
public static int DailyQuestAllowance()
{
return (int) BeastTribeHelper.DailyQuestAllowance();
}
public static bool LisbethPresent()
{
var loader = BotManager.Bots
.FirstOrDefault(c => c.Name == "Lisbeth");
if (loader == null) return false;
return true;
}
public static bool IsTargetableNPC(int npcID)
{
return GameObjectManager.GameObjects.Any(i => i.NpcId == (uint) npcID && i.IsVisible && i.IsTargetable);
}
public static bool IsDutyEnded()
{
if (DirectorManager.ActiveDirector != null)
{
var instanceDirector = (ff14bot.Directors.InstanceContentDirector) DirectorManager.ActiveDirector;
return instanceDirector.InstanceEnded;
}
return true;
}
public static int SharedFateRank(int zoneID)
{
return SharedFateHelper.CachedProgress.FirstOrDefault(i => i.Zone == (uint) zoneID).Rank;
}
public static async Task UpdateSharedFates()
{
await SharedFateHelper.CachedRead();
}
}
}