mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-12 18:27:23 +01:00
PartyFinder namespaces, break out
This commit is contained in:
parent
9199adb261
commit
bab8eb4182
18 changed files with 570 additions and 571 deletions
28
Dalamud/Game/Gui/PartyFinder/Internal/PartyFinderPacket.cs
Normal file
28
Dalamud/Game/Gui/PartyFinder/Internal/PartyFinderPacket.cs
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Dalamud.Game.Gui.PartyFinder.Internal
|
||||
{
|
||||
/// <summary>
|
||||
/// The structure of the PartyFinder packet.
|
||||
/// </summary>
|
||||
[SuppressMessage("StyleCop.CSharp.OrderingRules", "SA1201:Elements should appear in the correct order", Justification = "Sequential struct marshaling.")]
|
||||
[SuppressMessage("StyleCop.CSharp.OrderingRules", "SA1202:Elements should be ordered by access", Justification = "Sequential struct marshaling.")]
|
||||
[SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1600:Elements should be documented", Justification = "Document the field usage.")]
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
internal readonly struct PartyFinderPacket
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the size of this packet.
|
||||
/// </summary>
|
||||
internal static int PacketSize { get; } = Marshal.SizeOf<PartyFinderPacket>();
|
||||
|
||||
internal readonly int BatchNumber;
|
||||
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)]
|
||||
private readonly byte[] padding1;
|
||||
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)]
|
||||
internal readonly PartyFinderPacketListing[] Listings;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,99 @@
|
|||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Dalamud.Game.Gui.PartyFinder.Internal
|
||||
{
|
||||
/// <summary>
|
||||
/// The structure of an individual listing within a packet.
|
||||
/// </summary>
|
||||
[SuppressMessage("StyleCop.CSharp.OrderingRules", "SA1202:Elements should be ordered by access", Justification = "Sequential struct marshaling.")]
|
||||
[SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1600:Elements should be documented", Justification = "Document the field usage.")]
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
internal readonly struct PartyFinderPacketListing
|
||||
{
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)]
|
||||
private readonly byte[] header1;
|
||||
internal readonly uint Id;
|
||||
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)]
|
||||
private readonly byte[] header2;
|
||||
|
||||
internal readonly uint ContentIdLower;
|
||||
private readonly ushort unknownShort1;
|
||||
private readonly ushort unknownShort2;
|
||||
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)]
|
||||
private readonly byte[] header3;
|
||||
|
||||
internal readonly byte Category;
|
||||
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)]
|
||||
private readonly byte[] header4;
|
||||
|
||||
internal readonly ushort Duty;
|
||||
internal readonly byte DutyType;
|
||||
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 11)]
|
||||
private readonly byte[] header5;
|
||||
|
||||
internal readonly ushort World;
|
||||
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)]
|
||||
private readonly byte[] header6;
|
||||
|
||||
internal readonly byte Objective;
|
||||
internal readonly byte BeginnersWelcome;
|
||||
internal readonly byte Conditions;
|
||||
internal readonly byte DutyFinderSettings;
|
||||
internal readonly byte LootRules;
|
||||
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
|
||||
private readonly byte[] header7; // all zero in every pf I've examined
|
||||
|
||||
private readonly uint lastPatchHotfixTimestamp; // last time the servers were restarted?
|
||||
internal readonly ushort SecondsRemaining;
|
||||
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)]
|
||||
private readonly byte[] header8; // 00 00 01 00 00 00 in every pf I've examined
|
||||
|
||||
internal readonly ushort MinimumItemLevel;
|
||||
internal readonly ushort HomeWorld;
|
||||
internal readonly ushort CurrentWorld;
|
||||
|
||||
private readonly byte header9;
|
||||
|
||||
internal readonly byte NumSlots;
|
||||
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)]
|
||||
private readonly byte[] header10;
|
||||
|
||||
internal readonly byte SearchArea;
|
||||
|
||||
private readonly byte header11;
|
||||
|
||||
internal readonly byte NumParties;
|
||||
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
|
||||
private readonly byte[] header12; // 00 00 00 always. maybe numParties is a u32?
|
||||
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)]
|
||||
internal readonly uint[] Slots;
|
||||
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)]
|
||||
internal readonly byte[] JobsPresent;
|
||||
|
||||
// Note that ByValTStr will not work here because the strings are UTF-8 and there's only a CharSet for UTF-16 in C#.
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)]
|
||||
internal readonly byte[] Name;
|
||||
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 192)]
|
||||
internal readonly byte[] Description;
|
||||
|
||||
internal bool IsNull()
|
||||
{
|
||||
// a valid party finder must have at least one slot set
|
||||
return this.Slots.All(slot => slot == 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
4
Dalamud/Game/Internal/Gui/PartyFinderAddressResolver.cs → Dalamud/Game/Gui/PartyFinder/PartyFinderAddressResolver.cs
Executable file → Normal file
4
Dalamud/Game/Internal/Gui/PartyFinderAddressResolver.cs → Dalamud/Game/Gui/PartyFinder/PartyFinderAddressResolver.cs
Executable file → Normal file
|
|
@ -1,11 +1,11 @@
|
|||
using System;
|
||||
|
||||
namespace Dalamud.Game.Internal.Gui
|
||||
namespace Dalamud.Game.Gui.PartyFinder
|
||||
{
|
||||
/// <summary>
|
||||
/// The address resolver for the <see cref="PartyFinderGui"/> class.
|
||||
/// </summary>
|
||||
internal class PartyFinderAddressResolver : BaseAddressResolver
|
||||
public class PartyFinderAddressResolver : BaseAddressResolver
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the address of the native ReceiveListing method.
|
||||
36
Dalamud/Game/Internal/Gui/PartyFinderGui.cs → Dalamud/Game/Gui/PartyFinder/PartyFinderGui.cs
Executable file → Normal file
36
Dalamud/Game/Internal/Gui/PartyFinderGui.cs → Dalamud/Game/Gui/PartyFinder/PartyFinderGui.cs
Executable file → Normal file
|
|
@ -1,11 +1,12 @@
|
|||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
using Dalamud.Game.Internal.Gui.Structs;
|
||||
using Dalamud.Game.Gui.PartyFinder.Internal;
|
||||
using Dalamud.Game.Gui.PartyFinder.Types;
|
||||
using Dalamud.Hooking;
|
||||
using Serilog;
|
||||
|
||||
namespace Dalamud.Game.Internal.Gui
|
||||
namespace Dalamud.Game.Gui.PartyFinder
|
||||
{
|
||||
/// <summary>
|
||||
/// This class handles interacting with the native PartyFinder window.
|
||||
|
|
@ -30,7 +31,7 @@ namespace Dalamud.Game.Internal.Gui
|
|||
this.address = new PartyFinderAddressResolver();
|
||||
this.address.Setup(scanner);
|
||||
|
||||
this.memory = Marshal.AllocHGlobal(PartyFinder.PacketInfo.PacketSize);
|
||||
this.memory = Marshal.AllocHGlobal(PartyFinderPacket.PacketSize);
|
||||
|
||||
this.receiveListingHook = new Hook<ReceiveListingDelegate>(this.address.ReceiveListing, new ReceiveListingDelegate(this.HandleReceiveListingDetour));
|
||||
}
|
||||
|
|
@ -87,7 +88,7 @@ namespace Dalamud.Game.Internal.Gui
|
|||
{
|
||||
var dataPtr = data + 0x10;
|
||||
|
||||
var packet = Marshal.PtrToStructure<PartyFinder.Packet>(dataPtr);
|
||||
var packet = Marshal.PtrToStructure<PartyFinderPacket>(dataPtr);
|
||||
|
||||
// rewriting is an expensive operation, so only do it if necessary
|
||||
var needToRewrite = false;
|
||||
|
|
@ -125,33 +126,8 @@ namespace Dalamud.Game.Internal.Gui
|
|||
// copy our new memory over the game's
|
||||
unsafe
|
||||
{
|
||||
Buffer.MemoryCopy((void*)this.memory, (void*)dataPtr, PartyFinder.PacketInfo.PacketSize, PartyFinder.PacketInfo.PacketSize);
|
||||
Buffer.MemoryCopy((void*)this.memory, (void*)dataPtr, PartyFinderPacket.PacketSize, PartyFinderPacket.PacketSize);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This class represents additional arguments passed by the game.
|
||||
/// </summary>
|
||||
public class PartyFinderListingEventArgs
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="PartyFinderListingEventArgs"/> class.
|
||||
/// </summary>
|
||||
/// <param name="batchNumber">The batch number.</param>
|
||||
internal PartyFinderListingEventArgs(int batchNumber)
|
||||
{
|
||||
this.BatchNumber = batchNumber;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the batch number.
|
||||
/// </summary>
|
||||
public int BatchNumber { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether the listing is visible.
|
||||
/// </summary>
|
||||
public bool Visible { get; set; } = true;
|
||||
}
|
||||
}
|
||||
48
Dalamud/Game/Gui/PartyFinder/Types/DutyFinderCategory.cs
Normal file
48
Dalamud/Game/Gui/PartyFinder/Types/DutyFinderCategory.cs
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
namespace Dalamud.Game.Gui.PartyFinder.Types
|
||||
{
|
||||
/// <summary>
|
||||
/// Category flags for the <see cref="PartyFinder"/> class.
|
||||
/// </summary>
|
||||
public enum DutyFinderCategory
|
||||
{
|
||||
/// <summary>
|
||||
/// The duty category.
|
||||
/// </summary>
|
||||
Duty = 0,
|
||||
|
||||
/// <summary>
|
||||
/// The quest battle category.
|
||||
/// </summary>
|
||||
QuestBattles = 1 << 0,
|
||||
|
||||
/// <summary>
|
||||
/// The fate category.
|
||||
/// </summary>
|
||||
Fates = 1 << 1,
|
||||
|
||||
/// <summary>
|
||||
/// The treasure hunt category.
|
||||
/// </summary>
|
||||
TreasureHunt = 1 << 2,
|
||||
|
||||
/// <summary>
|
||||
/// The hunt category.
|
||||
/// </summary>
|
||||
TheHunt = 1 << 3,
|
||||
|
||||
/// <summary>
|
||||
/// The gathering forays category.
|
||||
/// </summary>
|
||||
GatheringForays = 1 << 4,
|
||||
|
||||
/// <summary>
|
||||
/// The deep dungeons category.
|
||||
/// </summary>
|
||||
DeepDungeons = 1 << 5,
|
||||
|
||||
/// <summary>
|
||||
/// The adventuring forays category.
|
||||
/// </summary>
|
||||
AdventuringForays = 1 << 6,
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
using System;
|
||||
|
||||
namespace Dalamud.Game.Gui.PartyFinder.Types
|
||||
{
|
||||
/// <summary>
|
||||
/// Condition flags for the <see cref="PartyFinder"/> class.
|
||||
/// </summary>
|
||||
[Flags]
|
||||
public enum DutyFinderConditionFlags : uint
|
||||
{
|
||||
/// <summary>
|
||||
/// No duty condition.
|
||||
/// </summary>
|
||||
None = 1,
|
||||
|
||||
/// <summary>
|
||||
/// The duty complete condition.
|
||||
/// </summary>
|
||||
DutyComplete = 2,
|
||||
|
||||
/// <summary>
|
||||
/// The duty incomplete condition.
|
||||
/// </summary>
|
||||
DutyIncomplete = 4,
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
using System;
|
||||
|
||||
namespace Dalamud.Game.Gui.PartyFinder.Types
|
||||
{
|
||||
/// <summary>
|
||||
/// Loot rule flags for the <see cref="PartyFinder"/> class.
|
||||
/// </summary>
|
||||
[Flags]
|
||||
public enum DutyFinderLootRuleFlags : uint
|
||||
{
|
||||
/// <summary>
|
||||
/// No loot rules.
|
||||
/// </summary>
|
||||
None = 0,
|
||||
|
||||
/// <summary>
|
||||
/// The greed only rule.
|
||||
/// </summary>
|
||||
GreedOnly = 1,
|
||||
|
||||
/// <summary>
|
||||
/// The lootmaster rule.
|
||||
/// </summary>
|
||||
Lootmaster = 2,
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
using System;
|
||||
|
||||
namespace Dalamud.Game.Gui.PartyFinder.Types
|
||||
{
|
||||
/// <summary>
|
||||
/// Objective flags for the <see cref="PartyFinder"/> class.
|
||||
/// </summary>
|
||||
[Flags]
|
||||
public enum DutyFinderObjectiveFlags : uint
|
||||
{
|
||||
/// <summary>
|
||||
/// No objective.
|
||||
/// </summary>
|
||||
None = 0,
|
||||
|
||||
/// <summary>
|
||||
/// The duty completion objective.
|
||||
/// </summary>
|
||||
DutyCompletion = 1,
|
||||
|
||||
/// <summary>
|
||||
/// The practice objective.
|
||||
/// </summary>
|
||||
Practice = 2,
|
||||
|
||||
/// <summary>
|
||||
/// The loot objective.
|
||||
/// </summary>
|
||||
Loot = 4,
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
using System;
|
||||
|
||||
namespace Dalamud.Game.Gui.PartyFinder.Types
|
||||
{
|
||||
/// <summary>
|
||||
/// Search area flags for the <see cref="PartyFinder"/> class.
|
||||
/// </summary>
|
||||
[Flags]
|
||||
public enum DutyFinderSearchAreaFlags : uint
|
||||
{
|
||||
/// <summary>
|
||||
/// Datacenter.
|
||||
/// </summary>
|
||||
DataCentre = 1 << 0,
|
||||
|
||||
/// <summary>
|
||||
/// Private.
|
||||
/// </summary>
|
||||
Private = 1 << 1,
|
||||
|
||||
/// <summary>
|
||||
/// Alliance raid.
|
||||
/// </summary>
|
||||
AllianceRaid = 1 << 2,
|
||||
|
||||
/// <summary>
|
||||
/// World.
|
||||
/// </summary>
|
||||
World = 1 << 3,
|
||||
|
||||
/// <summary>
|
||||
/// One player per job.
|
||||
/// </summary>
|
||||
OnePlayerPerJob = 1 << 5,
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
using System;
|
||||
|
||||
namespace Dalamud.Game.Gui.PartyFinder.Types
|
||||
{
|
||||
/// <summary>
|
||||
/// Duty finder settings flags for the <see cref="PartyFinder"/> class.
|
||||
/// </summary>
|
||||
[Flags]
|
||||
public enum DutyFinderSettingsFlags : uint
|
||||
{
|
||||
/// <summary>
|
||||
/// No duty finder settings.
|
||||
/// </summary>
|
||||
None = 0,
|
||||
|
||||
/// <summary>
|
||||
/// The undersized party setting.
|
||||
/// </summary>
|
||||
UndersizedParty = 1 << 0,
|
||||
|
||||
/// <summary>
|
||||
/// The minimum item level setting.
|
||||
/// </summary>
|
||||
MinimumItemLevel = 1 << 1,
|
||||
|
||||
/// <summary>
|
||||
/// The silence echo setting.
|
||||
/// </summary>
|
||||
SilenceEcho = 1 << 2,
|
||||
}
|
||||
}
|
||||
23
Dalamud/Game/Gui/PartyFinder/Types/DutyType.cs
Normal file
23
Dalamud/Game/Gui/PartyFinder/Types/DutyType.cs
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
namespace Dalamud.Game.Gui.PartyFinder.Types
|
||||
{
|
||||
/// <summary>
|
||||
/// Duty type flags for the <see cref="PartyFinder"/> class.
|
||||
/// </summary>
|
||||
public enum DutyType
|
||||
{
|
||||
/// <summary>
|
||||
/// No duty type.
|
||||
/// </summary>
|
||||
Other = 0,
|
||||
|
||||
/// <summary>
|
||||
/// The roulette duty type.
|
||||
/// </summary>
|
||||
Roulette = 1 << 0,
|
||||
|
||||
/// <summary>
|
||||
/// The normal duty type.
|
||||
/// </summary>
|
||||
Normal = 1 << 1,
|
||||
}
|
||||
}
|
||||
146
Dalamud/Game/Gui/PartyFinder/Types/JobFlags.cs
Normal file
146
Dalamud/Game/Gui/PartyFinder/Types/JobFlags.cs
Normal file
|
|
@ -0,0 +1,146 @@
|
|||
using System;
|
||||
|
||||
namespace Dalamud.Game.Gui.PartyFinder.Types
|
||||
{
|
||||
/// <summary>
|
||||
/// Job flags for the <see cref="PartyFinder"/> class.
|
||||
/// </summary>
|
||||
[Flags]
|
||||
public enum JobFlags
|
||||
{
|
||||
/// <summary>
|
||||
/// Gladiator (GLD).
|
||||
/// </summary>
|
||||
Gladiator = 1 << 1,
|
||||
|
||||
/// <summary>
|
||||
/// Pugilist (PGL).
|
||||
/// </summary>
|
||||
Pugilist = 1 << 2,
|
||||
|
||||
/// <summary>
|
||||
/// Marauder (MRD).
|
||||
/// </summary>
|
||||
Marauder = 1 << 3,
|
||||
|
||||
/// <summary>
|
||||
/// Lancer (LNC).
|
||||
/// </summary>
|
||||
Lancer = 1 << 4,
|
||||
|
||||
/// <summary>
|
||||
/// Archer (ARC).
|
||||
/// </summary>
|
||||
Archer = 1 << 5,
|
||||
|
||||
/// <summary>
|
||||
/// Conjurer (CNJ).
|
||||
/// </summary>
|
||||
Conjurer = 1 << 6,
|
||||
|
||||
/// <summary>
|
||||
/// Thaumaturge (THM).
|
||||
/// </summary>
|
||||
Thaumaturge = 1 << 7,
|
||||
|
||||
/// <summary>
|
||||
/// Paladin (PLD).
|
||||
/// </summary>
|
||||
Paladin = 1 << 8,
|
||||
|
||||
/// <summary>
|
||||
/// Monk (MNK).
|
||||
/// </summary>
|
||||
Monk = 1 << 9,
|
||||
|
||||
/// <summary>
|
||||
/// Warrior (WAR).
|
||||
/// </summary>
|
||||
Warrior = 1 << 10,
|
||||
|
||||
/// <summary>
|
||||
/// Dragoon (DRG).
|
||||
/// </summary>
|
||||
Dragoon = 1 << 11,
|
||||
|
||||
/// <summary>
|
||||
/// Bard (BRD).
|
||||
/// </summary>
|
||||
Bard = 1 << 12,
|
||||
|
||||
/// <summary>
|
||||
/// White mage (WHM).
|
||||
/// </summary>
|
||||
WhiteMage = 1 << 13,
|
||||
|
||||
/// <summary>
|
||||
/// Black mage (BLM).
|
||||
/// </summary>
|
||||
BlackMage = 1 << 14,
|
||||
|
||||
/// <summary>
|
||||
/// Arcanist (ACN).
|
||||
/// </summary>
|
||||
Arcanist = 1 << 15,
|
||||
|
||||
/// <summary>
|
||||
/// Summoner (SMN).
|
||||
/// </summary>
|
||||
Summoner = 1 << 16,
|
||||
|
||||
/// <summary>
|
||||
/// Scholar (SCH).
|
||||
/// </summary>
|
||||
Scholar = 1 << 17,
|
||||
|
||||
/// <summary>
|
||||
/// Rogue (ROG).
|
||||
/// </summary>
|
||||
Rogue = 1 << 18,
|
||||
|
||||
/// <summary>
|
||||
/// Ninja (NIN).
|
||||
/// </summary>
|
||||
Ninja = 1 << 19,
|
||||
|
||||
/// <summary>
|
||||
/// Machinist (MCH).
|
||||
/// </summary>
|
||||
Machinist = 1 << 20,
|
||||
|
||||
/// <summary>
|
||||
/// Dark Knight (DRK).
|
||||
/// </summary>
|
||||
DarkKnight = 1 << 21,
|
||||
|
||||
/// <summary>
|
||||
/// Astrologian (AST).
|
||||
/// </summary>
|
||||
Astrologian = 1 << 22,
|
||||
|
||||
/// <summary>
|
||||
/// Samurai (SAM).
|
||||
/// </summary>
|
||||
Samurai = 1 << 23,
|
||||
|
||||
/// <summary>
|
||||
/// Red mage (RDM).
|
||||
/// </summary>
|
||||
RedMage = 1 << 24,
|
||||
|
||||
/// <summary>
|
||||
/// Blue mage (BLM).
|
||||
/// </summary>
|
||||
BlueMage = 1 << 25,
|
||||
|
||||
/// <summary>
|
||||
/// Gunbreaker (GNB).
|
||||
/// </summary>
|
||||
Gunbreaker = 1 << 26,
|
||||
|
||||
/// <summary>
|
||||
/// Dancer (DNC).
|
||||
/// </summary>
|
||||
Dancer = 1 << 27,
|
||||
}
|
||||
}
|
||||
27
Dalamud/Game/Gui/PartyFinder/Types/JobFlagsExtensions.cs
Normal file
27
Dalamud/Game/Gui/PartyFinder/Types/JobFlagsExtensions.cs
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
using System;
|
||||
|
||||
using Dalamud.Data;
|
||||
using Lumina.Excel.GeneratedSheets;
|
||||
|
||||
namespace Dalamud.Game.Gui.PartyFinder.Types
|
||||
{
|
||||
/// <summary>
|
||||
/// Extensions for the <see cref="JobFlags"/> enum.
|
||||
/// </summary>
|
||||
public static class JobFlagsExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Get the actual ClassJob from the in-game sheets for this JobFlags.
|
||||
/// </summary>
|
||||
/// <param name="job">A JobFlags enum member.</param>
|
||||
/// <param name="data">A DataManager to get the ClassJob from.</param>
|
||||
/// <returns>A ClassJob if found or null if not.</returns>
|
||||
public static ClassJob ClassJob(this JobFlags job, DataManager data)
|
||||
{
|
||||
var result = Math.Log2((double)job);
|
||||
return result % 1 == 0
|
||||
? data.GetExcelSheet<ClassJob>().GetRow((uint)result)
|
||||
: null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -3,10 +3,11 @@ using System.Collections.Generic;
|
|||
using System.Linq;
|
||||
|
||||
using Dalamud.Data;
|
||||
using Dalamud.Game.Gui.PartyFinder.Internal;
|
||||
using Dalamud.Game.Text.SeStringHandling;
|
||||
using Lumina.Excel.GeneratedSheets;
|
||||
|
||||
namespace Dalamud.Game.Internal.Gui.Structs
|
||||
namespace Dalamud.Game.Gui.PartyFinder.Types
|
||||
{
|
||||
/// <summary>
|
||||
/// A single listing in party finder.
|
||||
|
|
@ -31,7 +32,7 @@ namespace Dalamud.Game.Internal.Gui.Structs
|
|||
/// <param name="listing">The interop listing data.</param>
|
||||
/// <param name="dataManager">The DataManager instance.</param>
|
||||
/// <param name="seStringManager">The SeStringManager instance.</param>
|
||||
internal PartyFinderListing(PartyFinder.Listing listing, DataManager dataManager, SeStringManager seStringManager)
|
||||
internal PartyFinderListing(PartyFinderPacketListing listing, DataManager dataManager, SeStringManager seStringManager)
|
||||
{
|
||||
this.objective = listing.Objective;
|
||||
this.conditions = listing.Conditions;
|
||||
|
|
@ -48,7 +49,7 @@ namespace Dalamud.Game.Internal.Gui.Structs
|
|||
this.World = new Lazy<World>(() => dataManager.GetExcelSheet<World>().GetRow(listing.World));
|
||||
this.HomeWorld = new Lazy<World>(() => dataManager.GetExcelSheet<World>().GetRow(listing.HomeWorld));
|
||||
this.CurrentWorld = new Lazy<World>(() => dataManager.GetExcelSheet<World>().GetRow(listing.CurrentWorld));
|
||||
this.Category = (Category)listing.Category;
|
||||
this.Category = (DutyFinderCategory)listing.Category;
|
||||
this.RawDuty = listing.Duty;
|
||||
this.Duty = new Lazy<ContentFinderCondition>(() => dataManager.GetExcelSheet<ContentFinderCondition>().GetRow(listing.Duty));
|
||||
this.DutyType = (DutyType)listing.DutyType;
|
||||
|
|
@ -103,7 +104,7 @@ namespace Dalamud.Game.Internal.Gui.Structs
|
|||
/// <summary>
|
||||
/// Gets the Party Finder category this listing is listed under.
|
||||
/// </summary>
|
||||
public Category Category { get; }
|
||||
public DutyFinderCategory Category { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the row ID of the duty this listing is for. May be 0 for non-duty listings.
|
||||
|
|
@ -154,12 +155,12 @@ namespace Dalamud.Game.Internal.Gui.Structs
|
|||
/// <summary>
|
||||
/// Gets the objective of this listing.
|
||||
/// </summary>
|
||||
public ObjectiveFlags Objective => (ObjectiveFlags)this.objective;
|
||||
public DutyFinderObjectiveFlags Objective => (DutyFinderObjectiveFlags)this.objective;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the conditions of this listing.
|
||||
/// </summary>
|
||||
public ConditionFlags Conditions => (ConditionFlags)this.conditions;
|
||||
public DutyFinderConditionFlags Conditions => (DutyFinderConditionFlags)this.conditions;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Duty Finder settings that will be used for this listing.
|
||||
|
|
@ -169,13 +170,13 @@ namespace Dalamud.Game.Internal.Gui.Structs
|
|||
/// <summary>
|
||||
/// Gets the loot rules that will be used for this listing.
|
||||
/// </summary>
|
||||
public LootRuleFlags LootRules => (LootRuleFlags)this.lootRules;
|
||||
public DutyFinderLootRuleFlags LootRules => (DutyFinderLootRuleFlags)this.lootRules;
|
||||
|
||||
/// <summary>
|
||||
/// Gets where this listing is searching. Note that this is also used for denoting alliance raid listings and one
|
||||
/// player per job.
|
||||
/// </summary>
|
||||
public SearchAreaFlags SearchArea => (SearchAreaFlags)this.searchArea;
|
||||
public DutyFinderSearchAreaFlags SearchArea => (DutyFinderSearchAreaFlags)this.searchArea;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a list of the class/job IDs that are currently present in the party.
|
||||
|
|
@ -194,14 +195,14 @@ namespace Dalamud.Game.Internal.Gui.Structs
|
|||
/// </summary>
|
||||
/// <param name="flag">The flag to check for.</param>
|
||||
/// <returns>A value indicating whether the flag is present.</returns>
|
||||
public bool this[ObjectiveFlags flag] => this.objective == 0 || (this.objective & (uint)flag) > 0;
|
||||
public bool this[DutyFinderObjectiveFlags flag] => this.objective == 0 || (this.objective & (uint)flag) > 0;
|
||||
|
||||
/// <summary>
|
||||
/// Check if the given flag is present.
|
||||
/// </summary>
|
||||
/// <param name="flag">The flag to check for.</param>
|
||||
/// <returns>A value indicating whether the flag is present.</returns>
|
||||
public bool this[ConditionFlags flag] => this.conditions == 0 || (this.conditions & (uint)flag) > 0;
|
||||
public bool this[DutyFinderConditionFlags flag] => this.conditions == 0 || (this.conditions & (uint)flag) > 0;
|
||||
|
||||
/// <summary>
|
||||
/// Check if the given flag is present.
|
||||
|
|
@ -215,14 +216,14 @@ namespace Dalamud.Game.Internal.Gui.Structs
|
|||
/// </summary>
|
||||
/// <param name="flag">The flag to check for.</param>
|
||||
/// <returns>A value indicating whether the flag is present.</returns>
|
||||
public bool this[LootRuleFlags flag] => this.lootRules == 0 || (this.lootRules & (uint)flag) > 0;
|
||||
public bool this[DutyFinderLootRuleFlags flag] => this.lootRules == 0 || (this.lootRules & (uint)flag) > 0;
|
||||
|
||||
/// <summary>
|
||||
/// Check if the given flag is present.
|
||||
/// </summary>
|
||||
/// <param name="flag">The flag to check for.</param>
|
||||
/// <returns>A value indicating whether the flag is present.</returns>
|
||||
public bool this[SearchAreaFlags flag] => this.searchArea == 0 || (this.searchArea & (uint)flag) > 0;
|
||||
public bool this[DutyFinderSearchAreaFlags flag] => this.searchArea == 0 || (this.searchArea & (uint)flag) > 0;
|
||||
|
||||
#endregion
|
||||
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
namespace Dalamud.Game.Gui.PartyFinder.Types
|
||||
{
|
||||
/// <summary>
|
||||
/// This class represents additional arguments passed by the game.
|
||||
/// </summary>
|
||||
public class PartyFinderListingEventArgs
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="PartyFinderListingEventArgs"/> class.
|
||||
/// </summary>
|
||||
/// <param name="batchNumber">The batch number.</param>
|
||||
internal PartyFinderListingEventArgs(int batchNumber)
|
||||
{
|
||||
this.BatchNumber = batchNumber;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the batch number.
|
||||
/// </summary>
|
||||
public int BatchNumber { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether the listing is visible.
|
||||
/// </summary>
|
||||
public bool Visible { get; set; } = true;
|
||||
}
|
||||
}
|
||||
|
|
@ -2,7 +2,7 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace Dalamud.Game.Internal.Gui.Structs
|
||||
namespace Dalamud.Game.Gui.PartyFinder.Types
|
||||
{
|
||||
/// <summary>
|
||||
/// A player slot in a Party Finder listing.
|
||||
|
|
@ -1,129 +0,0 @@
|
|||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Dalamud.Game.Internal.Gui.Structs
|
||||
{
|
||||
/// <summary>
|
||||
/// PartyFinder related network structs and static constants.
|
||||
/// </summary>
|
||||
internal static class PartyFinder
|
||||
{
|
||||
/// <summary>
|
||||
/// The structure of the PartyFinder packet.
|
||||
/// </summary>
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
internal readonly struct Packet
|
||||
{
|
||||
internal readonly int BatchNumber;
|
||||
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)]
|
||||
private readonly byte[] padding1;
|
||||
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)]
|
||||
internal readonly Listing[] Listings;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The structure of an individual listing within a packet.
|
||||
/// </summary>
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
internal readonly struct Listing
|
||||
{
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)]
|
||||
private readonly byte[] header1;
|
||||
|
||||
internal readonly uint Id;
|
||||
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)]
|
||||
private readonly byte[] header2;
|
||||
|
||||
internal readonly uint ContentIdLower;
|
||||
private readonly ushort unknownShort1;
|
||||
private readonly ushort unknownShort2;
|
||||
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)]
|
||||
private readonly byte[] header3;
|
||||
|
||||
internal readonly byte Category;
|
||||
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)]
|
||||
private readonly byte[] header4;
|
||||
|
||||
internal readonly ushort Duty;
|
||||
internal readonly byte DutyType;
|
||||
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 11)]
|
||||
private readonly byte[] header5;
|
||||
|
||||
internal readonly ushort World;
|
||||
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)]
|
||||
private readonly byte[] header6;
|
||||
|
||||
internal readonly byte Objective;
|
||||
internal readonly byte BeginnersWelcome;
|
||||
internal readonly byte Conditions;
|
||||
internal readonly byte DutyFinderSettings;
|
||||
internal readonly byte LootRules;
|
||||
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
|
||||
private readonly byte[] header7; // all zero in every pf I've examined
|
||||
|
||||
private readonly uint lastPatchHotfixTimestamp; // last time the servers were restarted?
|
||||
internal readonly ushort SecondsRemaining;
|
||||
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)]
|
||||
private readonly byte[] header8; // 00 00 01 00 00 00 in every pf I've examined
|
||||
|
||||
internal readonly ushort MinimumItemLevel;
|
||||
internal readonly ushort HomeWorld;
|
||||
internal readonly ushort CurrentWorld;
|
||||
|
||||
private readonly byte header9;
|
||||
|
||||
internal readonly byte NumSlots;
|
||||
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)]
|
||||
private readonly byte[] header10;
|
||||
|
||||
internal readonly byte SearchArea;
|
||||
|
||||
private readonly byte header11;
|
||||
|
||||
internal readonly byte NumParties;
|
||||
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
|
||||
private readonly byte[] header12; // 00 00 00 always. maybe numParties is a u32?
|
||||
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)]
|
||||
internal readonly uint[] Slots;
|
||||
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)]
|
||||
internal readonly byte[] JobsPresent;
|
||||
|
||||
// Note that ByValTStr will not work here because the strings are UTF-8 and there's only a CharSet for UTF-16 in C#.
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)]
|
||||
internal readonly byte[] Name;
|
||||
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 192)]
|
||||
internal readonly byte[] Description;
|
||||
|
||||
internal bool IsNull()
|
||||
{
|
||||
// a valid party finder must have at least one slot set
|
||||
return this.Slots.All(slot => slot == 0);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// PartyFinder packet constants.
|
||||
/// </summary>
|
||||
public static class PacketInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// The size of the PartyFinder packet.
|
||||
/// </summary>
|
||||
public static readonly int PacketSize = Marshal.SizeOf<Packet>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,397 +0,0 @@
|
|||
using System;
|
||||
|
||||
using Dalamud.Data;
|
||||
using Lumina.Excel.GeneratedSheets;
|
||||
|
||||
namespace Dalamud.Game.Internal.Gui.Structs
|
||||
{
|
||||
/// <summary>
|
||||
/// Search area flags for the <see cref="PartyFinder"/> class.
|
||||
/// </summary>
|
||||
[Flags]
|
||||
public enum SearchAreaFlags : uint
|
||||
{
|
||||
/// <summary>
|
||||
/// Datacenter.
|
||||
/// </summary>
|
||||
DataCentre = 1 << 0,
|
||||
|
||||
/// <summary>
|
||||
/// Private.
|
||||
/// </summary>
|
||||
Private = 1 << 1,
|
||||
|
||||
/// <summary>
|
||||
/// Alliance raid.
|
||||
/// </summary>
|
||||
AllianceRaid = 1 << 2,
|
||||
|
||||
/// <summary>
|
||||
/// World.
|
||||
/// </summary>
|
||||
World = 1 << 3,
|
||||
|
||||
/// <summary>
|
||||
/// One player per job.
|
||||
/// </summary>
|
||||
OnePlayerPerJob = 1 << 5,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Job flags for the <see cref="PartyFinder"/> class.
|
||||
/// </summary>
|
||||
[Flags]
|
||||
public enum JobFlags
|
||||
{
|
||||
/// <summary>
|
||||
/// Gladiator (GLD).
|
||||
/// </summary>
|
||||
Gladiator = 1 << 1,
|
||||
|
||||
/// <summary>
|
||||
/// Pugilist (PGL).
|
||||
/// </summary>
|
||||
Pugilist = 1 << 2,
|
||||
|
||||
/// <summary>
|
||||
/// Marauder (MRD).
|
||||
/// </summary>
|
||||
Marauder = 1 << 3,
|
||||
|
||||
/// <summary>
|
||||
/// Lancer (LNC).
|
||||
/// </summary>
|
||||
Lancer = 1 << 4,
|
||||
|
||||
/// <summary>
|
||||
/// Archer (ARC).
|
||||
/// </summary>
|
||||
Archer = 1 << 5,
|
||||
|
||||
/// <summary>
|
||||
/// Conjurer (CNJ).
|
||||
/// </summary>
|
||||
Conjurer = 1 << 6,
|
||||
|
||||
/// <summary>
|
||||
/// Thaumaturge (THM).
|
||||
/// </summary>
|
||||
Thaumaturge = 1 << 7,
|
||||
|
||||
/// <summary>
|
||||
/// Paladin (PLD).
|
||||
/// </summary>
|
||||
Paladin = 1 << 8,
|
||||
|
||||
/// <summary>
|
||||
/// Monk (MNK).
|
||||
/// </summary>
|
||||
Monk = 1 << 9,
|
||||
|
||||
/// <summary>
|
||||
/// Warrior (WAR).
|
||||
/// </summary>
|
||||
Warrior = 1 << 10,
|
||||
|
||||
/// <summary>
|
||||
/// Dragoon (DRG).
|
||||
/// </summary>
|
||||
Dragoon = 1 << 11,
|
||||
|
||||
/// <summary>
|
||||
/// Bard (BRD).
|
||||
/// </summary>
|
||||
Bard = 1 << 12,
|
||||
|
||||
/// <summary>
|
||||
/// White mage (WHM).
|
||||
/// </summary>
|
||||
WhiteMage = 1 << 13,
|
||||
|
||||
/// <summary>
|
||||
/// Black mage (BLM).
|
||||
/// </summary>
|
||||
BlackMage = 1 << 14,
|
||||
|
||||
/// <summary>
|
||||
/// Arcanist (ACN).
|
||||
/// </summary>
|
||||
Arcanist = 1 << 15,
|
||||
|
||||
/// <summary>
|
||||
/// Summoner (SMN).
|
||||
/// </summary>
|
||||
Summoner = 1 << 16,
|
||||
|
||||
/// <summary>
|
||||
/// Scholar (SCH).
|
||||
/// </summary>
|
||||
Scholar = 1 << 17,
|
||||
|
||||
/// <summary>
|
||||
/// Rogue (ROG).
|
||||
/// </summary>
|
||||
Rogue = 1 << 18,
|
||||
|
||||
/// <summary>
|
||||
/// Ninja (NIN).
|
||||
/// </summary>
|
||||
Ninja = 1 << 19,
|
||||
|
||||
/// <summary>
|
||||
/// Machinist (MCH).
|
||||
/// </summary>
|
||||
Machinist = 1 << 20,
|
||||
|
||||
/// <summary>
|
||||
/// Dark Knight (DRK).
|
||||
/// </summary>
|
||||
DarkKnight = 1 << 21,
|
||||
|
||||
/// <summary>
|
||||
/// Astrologian (AST).
|
||||
/// </summary>
|
||||
Astrologian = 1 << 22,
|
||||
|
||||
/// <summary>
|
||||
/// Samurai (SAM).
|
||||
/// </summary>
|
||||
Samurai = 1 << 23,
|
||||
|
||||
/// <summary>
|
||||
/// Red mage (RDM).
|
||||
/// </summary>
|
||||
RedMage = 1 << 24,
|
||||
|
||||
/// <summary>
|
||||
/// Blue mage (BLM).
|
||||
/// </summary>
|
||||
BlueMage = 1 << 25,
|
||||
|
||||
/// <summary>
|
||||
/// Gunbreaker (GNB).
|
||||
/// </summary>
|
||||
Gunbreaker = 1 << 26,
|
||||
|
||||
/// <summary>
|
||||
/// Dancer (DNC).
|
||||
/// </summary>
|
||||
Dancer = 1 << 27,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Objective flags for the <see cref="PartyFinder"/> class.
|
||||
/// </summary>
|
||||
[Flags]
|
||||
public enum ObjectiveFlags : uint
|
||||
{
|
||||
/// <summary>
|
||||
/// No objective.
|
||||
/// </summary>
|
||||
None = 0,
|
||||
|
||||
/// <summary>
|
||||
/// The duty completion objective.
|
||||
/// </summary>
|
||||
DutyCompletion = 1,
|
||||
|
||||
/// <summary>
|
||||
/// The practice objective.
|
||||
/// </summary>
|
||||
Practice = 2,
|
||||
|
||||
/// <summary>
|
||||
/// The loot objective.
|
||||
/// </summary>
|
||||
Loot = 4,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Condition flags for the <see cref="PartyFinder"/> class.
|
||||
/// </summary>
|
||||
[Flags]
|
||||
public enum ConditionFlags : uint
|
||||
{
|
||||
/// <summary>
|
||||
/// No duty condition.
|
||||
/// </summary>
|
||||
None = 1,
|
||||
|
||||
/// <summary>
|
||||
/// The duty complete condition.
|
||||
/// </summary>
|
||||
DutyComplete = 2,
|
||||
|
||||
/// <summary>
|
||||
/// The duty incomplete condition.
|
||||
/// </summary>
|
||||
DutyIncomplete = 4,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Duty finder settings flags for the <see cref="PartyFinder"/> class.
|
||||
/// </summary>
|
||||
[Flags]
|
||||
public enum DutyFinderSettingsFlags : uint
|
||||
{
|
||||
/// <summary>
|
||||
/// No duty finder settings.
|
||||
/// </summary>
|
||||
None = 0,
|
||||
|
||||
/// <summary>
|
||||
/// The undersized party setting.
|
||||
/// </summary>
|
||||
UndersizedParty = 1 << 0,
|
||||
|
||||
/// <summary>
|
||||
/// The minimum item level setting.
|
||||
/// </summary>
|
||||
MinimumItemLevel = 1 << 1,
|
||||
|
||||
/// <summary>
|
||||
/// The silence echo setting.
|
||||
/// </summary>
|
||||
SilenceEcho = 1 << 2,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Loot rule flags for the <see cref="PartyFinder"/> class.
|
||||
/// </summary>
|
||||
[Flags]
|
||||
public enum LootRuleFlags : uint
|
||||
{
|
||||
/// <summary>
|
||||
/// No loot rules.
|
||||
/// </summary>
|
||||
None = 0,
|
||||
|
||||
/// <summary>
|
||||
/// The greed only rule.
|
||||
/// </summary>
|
||||
GreedOnly = 1,
|
||||
|
||||
/// <summary>
|
||||
/// The lootmaster rule.
|
||||
/// </summary>
|
||||
Lootmaster = 2,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Category flags for the <see cref="PartyFinder"/> class.
|
||||
/// </summary>
|
||||
public enum Category
|
||||
{
|
||||
/// <summary>
|
||||
/// The duty category.
|
||||
/// </summary>
|
||||
Duty = 0,
|
||||
|
||||
/// <summary>
|
||||
/// The quest battle category.
|
||||
/// </summary>
|
||||
QuestBattles = 1 << 0,
|
||||
|
||||
/// <summary>
|
||||
/// The fate category.
|
||||
/// </summary>
|
||||
Fates = 1 << 1,
|
||||
|
||||
/// <summary>
|
||||
/// The treasure hunt category.
|
||||
/// </summary>
|
||||
TreasureHunt = 1 << 2,
|
||||
|
||||
/// <summary>
|
||||
/// The hunt category.
|
||||
/// </summary>
|
||||
TheHunt = 1 << 3,
|
||||
|
||||
/// <summary>
|
||||
/// The gathering forays category.
|
||||
/// </summary>
|
||||
GatheringForays = 1 << 4,
|
||||
|
||||
/// <summary>
|
||||
/// The deep dungeons category.
|
||||
/// </summary>
|
||||
DeepDungeons = 1 << 5,
|
||||
|
||||
/// <summary>
|
||||
/// The adventuring forays category.
|
||||
/// </summary>
|
||||
AdventuringForays = 1 << 6,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Duty type flags for the <see cref="PartyFinder"/> class.
|
||||
/// </summary>
|
||||
public enum DutyType
|
||||
{
|
||||
/// <summary>
|
||||
/// No duty type.
|
||||
/// </summary>
|
||||
Other = 0,
|
||||
|
||||
/// <summary>
|
||||
/// The roulette duty type.
|
||||
/// </summary>
|
||||
Roulette = 1 << 0,
|
||||
|
||||
/// <summary>
|
||||
/// The normal duty type.
|
||||
/// </summary>
|
||||
Normal = 1 << 1,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Extensions for the <see cref="JobFlags"/> enum.
|
||||
/// </summary>
|
||||
public static class JobFlagsExt
|
||||
{
|
||||
/// <summary>
|
||||
/// Get the actual ClassJob from the in-game sheets for this JobFlags.
|
||||
/// </summary>
|
||||
/// <param name="job">A JobFlags enum member.</param>
|
||||
/// <param name="data">A DataManager to get the ClassJob from.</param>
|
||||
/// <returns>A ClassJob if found or null if not.</returns>
|
||||
public static ClassJob ClassJob(this JobFlags job, DataManager data)
|
||||
{
|
||||
var jobs = data.GetExcelSheet<ClassJob>();
|
||||
|
||||
uint? row = job switch
|
||||
{
|
||||
JobFlags.Gladiator => 1,
|
||||
JobFlags.Pugilist => 2,
|
||||
JobFlags.Marauder => 3,
|
||||
JobFlags.Lancer => 4,
|
||||
JobFlags.Archer => 5,
|
||||
JobFlags.Conjurer => 6,
|
||||
JobFlags.Thaumaturge => 7,
|
||||
JobFlags.Paladin => 19,
|
||||
JobFlags.Monk => 20,
|
||||
JobFlags.Warrior => 21,
|
||||
JobFlags.Dragoon => 22,
|
||||
JobFlags.Bard => 23,
|
||||
JobFlags.WhiteMage => 24,
|
||||
JobFlags.BlackMage => 25,
|
||||
JobFlags.Arcanist => 26,
|
||||
JobFlags.Summoner => 27,
|
||||
JobFlags.Scholar => 28,
|
||||
JobFlags.Rogue => 29,
|
||||
JobFlags.Ninja => 30,
|
||||
JobFlags.Machinist => 31,
|
||||
JobFlags.DarkKnight => 32,
|
||||
JobFlags.Astrologian => 33,
|
||||
JobFlags.Samurai => 34,
|
||||
JobFlags.RedMage => 35,
|
||||
JobFlags.BlueMage => 36,
|
||||
JobFlags.Gunbreaker => 37,
|
||||
JobFlags.Dancer => 38,
|
||||
_ => null,
|
||||
};
|
||||
|
||||
return row == null ? null : jobs.GetRow((uint)row);
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue