Icon dev (#4)

Icon dev
This commit is contained in:
goaaats 2019-11-01 23:12:38 +09:00 committed by GitHub
commit f889ef7650
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
35 changed files with 1104 additions and 437 deletions

View file

@ -0,0 +1,172 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace XIVLauncher.Dalamud
{
//CURRENT HIGHEST FLAG IS 44
[Flags]
public enum CustomComboPreset : long
{
None = 0,
// DRAGOON
[CustomComboInfo("Coerthan Torment Combo", "Replace Coerthan Torment with its combo chain", 22)]
DragoonCoerthanTormentCombo = 1L << 0,
[CustomComboInfo("Chaos Thrust Combo", "Replace Chaos Thrust with its combo chain", 22)]
DragoonChaosThrustCombo = 1L << 1,
[CustomComboInfo("Full Thrust Combo", "Replace Full Thrust with its combo chain", 22)]
DragoonFullThrustCombo = 1L << 2,
// DARK KNIGHT
[CustomComboInfo("Souleater Combo", "Replace Souleater with its combo chain", 32)]
DarkSouleaterCombo = 1L << 3,
[CustomComboInfo("Stalwart Soul Combo", "Replace Stalwart Soul with its combo chain", 32)]
DarkStalwartSoulCombo = 1L << 4,
// PALADIN
[CustomComboInfo("Goring Blade Combo", "Replace Goring Blade with its combo chain", 19)]
PaladinGoringBladeCombo = 1L << 5,
[CustomComboInfo("Royal Authority Combo", "Replace Royal Authority with its combo chain", 19)]
PaladinRoyalAuthorityCombo = 1L << 6,
[CustomComboInfo("Prominence Combo", "Replace Prominence with its combo chain", 19)]
PaladinProminenceCombo = 1L << 7,
// WARRIOR
[CustomComboInfo("Storms Path Combo", "Replace Storms Path with its combo chain", 21)]
WarriorStormsPathCombo = 1L << 8,
[CustomComboInfo("Storms Eye Combo", "Replace Storms Eye with its combo chain", 21)]
WarriorStormsEyeCombo = 1L << 9,
[CustomComboInfo("Mythril Tempest Combo", "Replace Mythril Tempest with its combo chain", 21)]
WarriorMythrilTempestCombo = 1L << 10,
// SAMURAI
[CustomComboInfo("Yukikaze Combo", "Replace Yukikaze with its combo chain", 34)]
SamuraiYukikazeCombo = 1L << 11,
[CustomComboInfo("Gekko Combo", "Replace Gekko with its combo chain", 34)]
SamuraiGekkoCombo = 1L << 12,
[CustomComboInfo("Kasha Combo", "Replace Kasha with its combo chain", 34)]
SamuraiKashaCombo = 1L << 13,
[CustomComboInfo("Mangetsu Combo", "Replace Mangetsu with its combo chain", 34)]
SamuraiMangetsuCombo = 1L << 14,
[CustomComboInfo("Oka Combo", "Replace Oka with its combo chain", 34)]
SamuraiOkaCombo = 1L << 15,
// NINJA
[CustomComboInfo("Armor Crush Combo", "Replace Armor Crush with its combo chain", 30)]
NinjaArmorCrushCombo = 1L << 17,
[CustomComboInfo("Aeolian Edge Combo", "Replace Aeolian Edge with its combo chain", 30)]
NinjaAeolianEdgeCombo = 1L << 18,
[CustomComboInfo("Hakke Mujinsatsu Combo", "Replace Hakke Mujinsatsu with its combo chain", 30)]
NinjaHakkeMujinsatsuCombo = 1L << 19,
// GUNBREAKER
[CustomComboInfo("Solid Barrel Combo", "Replace Solid Barrel with its combo chain", 37)]
GunbreakerSolidBarrelCombo = 1L << 20,
[CustomComboInfo("Gnashing Fang Combo", "Replace Gnashing Fang with its combo chain", 37)]
GunbreakerGnashingFangCombo = 1L << 21,
[CustomComboInfo("Demon Slaughter Combo", "Replace Demon Slaughter with its combo chain", 37)]
GunbreakerDemonSlaughterCombo = 1L << 22,
// MACHINIST
[CustomComboInfo("Heated Clan Shot Combo/Heat", "Replace Heated Clan Shot with its combo chain or with Heat Blast when overheated.", 31)]
MachinistHeatedClanShotFeature = 1L << 23,
[CustomComboInfo("Spread Shot Heat", "Replace Spread Shot with Auto Crossbow when overheated.", 31)]
MachinistSpreadShotFeature = 1L << 24,
// BLACK MAGE
[CustomComboInfo("Enochian Stance Switcher", "Change Enochian to Fire 4 or Blizzard 4 depending on stance.", 25)]
BlackEnochianFeature = 1L << 25,
[CustomComboInfo("Umbral Soul/Transpose Switcher", "Change between Umbral Soul and Transpose automatically.", 25)]
BlackManaFeature = 1L << 26,
// ASTROLOGIAN
[CustomComboInfo("Draw on Play", "Play turns into Draw when no card is drawn, as well as the usual Play behavior.", 33)]
AstrologianCardsOnDrawFeature = 1L << 27,
// SUMMONER
[CustomComboInfo("Demi-summon combiners", "Dreadwyrm Trance, Summon Bahamut, and Firebird Trance are now one button. Deathflare, Enkindle Bahamut, and Enkindle Phoenix are now one button.", 27)]
SummonerDemiCombo = 1L << 28,
[CustomComboInfo("Brand of Purgatory Combo", "Replaces Fountain of Fire with Brand of Purgatory when under the affect of Hellish Conduit.", 27)]
SummonerBoPCombo = 1L << 38,
[CustomComboInfo("ED Fester", "Change Energy Drain into Fester while you have Aetherflow stacks.", 27)]
SummonerEDFesterCombo = 1L << 39,
[CustomComboInfo("ES Painflare", "Change Energy Siphon into Painflare while you have Aetherflow stacks.", 27)]
SummonerESPainflareCombo = 1L << 40,
// SCHOLAR
[CustomComboInfo("Seraph Fey Blessing/Consolation", "Change Fey Blessing into Consolation when Seraph is out.", 28)]
ScholarSeraphConsolationFeature = 1L << 29,
[CustomComboInfo("ED Aetherflow", "Change Energy Drain into Aetherflow when you have no more Aetherflow stacks.", 28)]
ScholarEnergyDrainFeature = 1L << 37,
// DANCER
[CustomComboInfo("AoE GCD procs", "Replaces all AoE GCDs with their procced version when available.", 38)]
DancerAoeGcdFeature = 1L << 32,
[CustomComboInfo("Fan Dance Combos", "Change Fan Dance and Fan Dance 2 into Fan Dance 3 while flourishing.", 38)]
DancerFanDanceCombo = 1L << 33,
// WHITE MAGE
[CustomComboInfo("Solace into Misery", "Replaces Afflatus Solace with Afflatus Misery when Misery is ready to be used.", 24)]
WhiteMageSolaceMiseryFeature = 1L << 35,
[CustomComboInfo("Rapture into Misery", "Replaces Afflatus Rapture with Afflatus Misery when Misery is ready to be used.", 24)]
WhiteMageRaptureMiseryFeature = 1L << 36,
// BARD
[CustomComboInfo("Wanderer's into Pitch Perfect", "Replaces Wanderer's Minuet with Pitch Perfect while in WM.", 23)]
BardWandererPPFeature = 1L << 41,
[CustomComboInfo("Heavy Shot into Straight Shot", "Replaces Heavy Shot/Burst Shot with Straight Shot/Refulgent Arrow when procced.", 23)]
BardStraightShotUpgradeFeature = 1L << 42,
// MONK
// RED MAGE
[CustomComboInfo("Red Mage AoE Combo", "Replaces Veraero/thunder 2 with Impact when Dualcast or Swiftcast are active.", 35)]
RedMageAoECombo = 1L << 48,
[CustomComboInfo("Redoublement combo", "Replaces Redoublement with its combo chain, following enchantment rules.", 35)]
RedMageMeleeCombo = 1L << 49
}
public class CustomComboInfoAttribute : Attribute
{
internal CustomComboInfoAttribute(string fancyName, string description, byte classJob)
{
FancyName = fancyName;
Description = description;
ClassJob = classJob;
}
public string FancyName { get; }
public string Description { get; }
public byte ClassJob { get; }
}
}

View file

@ -0,0 +1,37 @@
using System;
using System.Collections.Generic;
using System.IO;
using Dalamud.DiscordBot;
using Newtonsoft.Json;
using XIVLauncher.Dalamud;
namespace Dalamud
{
[Serializable]
public class DalamudConfiguration
{
public DiscordFeatureConfiguration DiscordFeatureConfig { get; set; }
public bool OptOutMbCollection { get; set; } = false;
public CustomComboPreset ComboPresets { get; set; }
public List<string> BadWords { get; set; }
public class FateInfo {
public string Name { get; set; }
public int Id { get; set; }
}
public List<FateInfo> Fates;
public static DalamudConfiguration Load(string path) {
return JsonConvert.DeserializeObject<DalamudConfiguration>(File.ReadAllText(path));
}
public void Save(string path) {
File.WriteAllText(path, JsonConvert.SerializeObject(this));
}
}
}

View file

@ -14,8 +14,8 @@ using Dalamud.Game.Internal;
using Dalamud.Game.Internal.Gui;
using Dalamud.Game.Network;
using Dalamud.Plugin;
using Dalamud.Settings;
using Serilog;
using XIVLauncher.Dalamud;
namespace Dalamud {
public sealed class Dalamud : IDisposable {
@ -42,10 +42,11 @@ namespace Dalamud {
public readonly IconReplacer IconReplacer;
public readonly IconReplaceChecker IconReplaceChecker;
public readonly DalamudConfiguration Configuration;
public Dalamud(DalamudStartInfo info) {
this.StartInfo = info;
this.Configuration = DalamudConfiguration.Load(info.ConfigurationPath);
this.baseDirectory = info.WorkingDirectory;
@ -63,18 +64,16 @@ namespace Dalamud {
SetupCommands();
ChatHandlers = new ChatHandlers(this);
NetworkHandlers = new NetworkHandlers(this, info.OptOutMbCollection);
NetworkHandlers = new NetworkHandlers(this, this.Configuration.OptOutMbCollection);
this.ClientState = new ClientState(this, info, this.sigScanner, this.targetModule);
this.BotManager = new DiscordBotManager(this, info.DiscordFeatureConfig);
this.BotManager = new DiscordBotManager(this, this.Configuration.DiscordFeatureConfig);
this.PluginManager = new PluginManager(this, info.PluginDirectory, info.DefaultPluginDirectory);
this.IconReplaceChecker = new IconReplaceChecker(this.targetModule, this.sigScanner);
this.IconReplacer = new IconReplacer(this, this.targetModule, this.sigScanner);
this.IconReplacer = new IconReplacer(this, this.sigScanner);
try {
this.PluginManager.LoadPlugins();
} catch (Exception ex) {
@ -89,8 +88,6 @@ namespace Dalamud {
this.BotManager.Start();
this.IconReplaceChecker.Enable();
this.IconReplacer.Enable();
}
@ -109,8 +106,6 @@ namespace Dalamud {
this.unloadSignal.Dispose();
this.IconReplaceChecker.Dispose();
this.IconReplacer.Dispose();
}
@ -130,6 +125,11 @@ namespace Dalamud {
ShowInHelp = false
});
CommandManager.AddHandler("/xldcombo", new CommandInfo(OnCommandDebugCombo) {
HelpMessage = "COMBO debug",
ShowInHelp = false
});
CommandManager.AddHandler("/xlhelp", new CommandInfo(OnCommandHelp) {
HelpMessage = "Shows list of commands available."
});
@ -217,8 +217,8 @@ namespace Dalamud {
}
private void OnFateWatchAdd(string command, string arguments) {
if (PersistentSettings.Instance.Fates == null)
PersistentSettings.Instance.Fates = new List<PersistentSettings.FateInfo>();
if (this.Configuration.Fates == null)
this.Configuration.Fates = new List<DalamudConfiguration.FateInfo>();
dynamic candidates = XivApi.Search(arguments, "Fate").GetAwaiter().GetResult();
@ -227,32 +227,36 @@ namespace Dalamud {
return;
}
var fateInfo = new PersistentSettings.FateInfo {
var fateInfo = new DalamudConfiguration.FateInfo {
Id = candidates.Results[0].ID,
Name = candidates.Results[0].Name
};
PersistentSettings.Instance.Fates.Add(fateInfo);
this.Configuration.Fates.Add(fateInfo);
this.Configuration.Save(this.StartInfo.ConfigurationPath);
Framework.Gui.Chat.Print($"Added fate \"{fateInfo.Name}\".");
}
private void OnFateWatchList(string command, string arguments) {
if (PersistentSettings.Instance.Fates == null)
PersistentSettings.Instance.Fates = new List<PersistentSettings.FateInfo>();
if (this.Configuration.Fates == null)
this.Configuration.Fates = new List<DalamudConfiguration.FateInfo>();
if (PersistentSettings.Instance.Fates.Count == 0) {
if (this.Configuration.Fates.Count == 0) {
Framework.Gui.Chat.Print("No fates on your watchlist.");
return;
}
foreach (var fate in PersistentSettings.Instance.Fates)
this.Configuration.Save(this.StartInfo.ConfigurationPath);
foreach (var fate in this.Configuration.Fates)
Framework.Gui.Chat.Print($"Fate {fate.Id}: {fate.Name}");
}
private void OnFateWatchRemove(string command, string arguments) {
if (PersistentSettings.Instance.Fates == null)
PersistentSettings.Instance.Fates = new List<PersistentSettings.FateInfo>();
if (this.Configuration.Fates == null)
this.Configuration.Fates = new List<DalamudConfiguration.FateInfo>();
dynamic candidates = XivApi.Search(arguments, "Fate").GetAwaiter().GetResult();
@ -261,37 +265,45 @@ namespace Dalamud {
return;
}
PersistentSettings.Instance.Fates.RemoveAll(x => x.Id == candidates.Results[0].ID);
this.Configuration.Fates.RemoveAll(x => x.Id == candidates.Results[0].ID);
this.Configuration.Save(this.StartInfo.ConfigurationPath);
Framework.Gui.Chat.Print($"Removed fate \"{candidates.Results[0].Name}\".");
}
private void OnBadWordsAdd(string command, string arguments) {
if (PersistentSettings.Instance.BadWords == null)
PersistentSettings.Instance.BadWords = new List<string>();
if (this.Configuration.BadWords == null)
this.Configuration.BadWords = new List<string>();
PersistentSettings.Instance.BadWords.Add(arguments);
this.Configuration.BadWords.Add(arguments);
this.Configuration.Save(this.StartInfo.ConfigurationPath);
Framework.Gui.Chat.Print($"Muted \"{arguments}\".");
}
private void OnBadWordsList(string command, string arguments) {
if (PersistentSettings.Instance.BadWords == null)
PersistentSettings.Instance.BadWords = new List<string>();
if (this.Configuration.BadWords == null)
this.Configuration.BadWords = new List<string>();
if (PersistentSettings.Instance.BadWords.Count == 0) {
if (this.Configuration.BadWords.Count == 0) {
Framework.Gui.Chat.Print("No muted words or sentences.");
return;
}
foreach (var word in PersistentSettings.Instance.BadWords) Framework.Gui.Chat.Print($"\"{word}\"");
this.Configuration.Save(this.StartInfo.ConfigurationPath);
foreach (var word in this.Configuration.BadWords) Framework.Gui.Chat.Print($"\"{word}\"");
}
private void OnBadWordsRemove(string command, string arguments) {
if (PersistentSettings.Instance.BadWords == null)
PersistentSettings.Instance.BadWords = new List<string>();
if (this.Configuration.BadWords == null)
this.Configuration.BadWords = new List<string>();
PersistentSettings.Instance.BadWords.RemoveAll(x => x == arguments);
this.Configuration.BadWords.RemoveAll(x => x == arguments);
this.Configuration.Save(this.StartInfo.ConfigurationPath);
Framework.Gui.Chat.Print($"Unmuted \"{arguments}\".");
}
@ -328,6 +340,75 @@ namespace Dalamud {
}
}
private void OnCommandDebugCombo(string command, string arguments) {
var argumentsParts = arguments.Split();
switch (argumentsParts[0]) {
case "setall": {
foreach (var value in Enum.GetValues(typeof(CustomComboPreset)).Cast<CustomComboPreset>()) {
if (value == CustomComboPreset.None)
continue;
this.Configuration.ComboPresets |= value;
}
Framework.Gui.Chat.Print("all SET");
}
break;
case "unsetall": {
foreach (var value in Enum.GetValues(typeof(CustomComboPreset)).Cast<CustomComboPreset>()) {
this.Configuration.ComboPresets &= value;
}
Framework.Gui.Chat.Print("all UNSET");
}
break;
case "set": {
foreach (var value in Enum.GetValues(typeof(CustomComboPreset)).Cast<CustomComboPreset>()) {
if (value.ToString().ToLower() != argumentsParts[1].ToLower())
continue;
this.Configuration.ComboPresets |= value;
Framework.Gui.Chat.Print(argumentsParts[1] + " SET");
}
}
break;
case "toggle": {
foreach (var value in Enum.GetValues(typeof(CustomComboPreset)).Cast<CustomComboPreset>()) {
if (value.ToString().ToLower() != argumentsParts[1].ToLower())
continue;
this.Configuration.ComboPresets ^= value;
Framework.Gui.Chat.Print(argumentsParts[1] + " TOGGLE");
}
}
break;
case "unset": {
foreach (var value in Enum.GetValues(typeof(CustomComboPreset)).Cast<CustomComboPreset>()) {
if (value.ToString().ToLower() != argumentsParts[1].ToLower())
continue;
this.Configuration.ComboPresets &= ~value;
Framework.Gui.Chat.Print(argumentsParts[1] + " UNSET");
}
}
break;
case "list": {
foreach (var value in Enum.GetValues(typeof(CustomComboPreset)).Cast<CustomComboPreset>()) {
if (this.Configuration.ComboPresets.HasFlag(value))
Framework.Gui.Chat.Print(value.ToString());
}
}
break;
default: Framework.Gui.Chat.Print("Unknown");
break;
}
this.Configuration.Save(this.StartInfo.ConfigurationPath);
}
private void OnBotJoinCommand(string command, string arguments) {
if (this.BotManager != null && this.BotManager.IsConnected)
Process.Start(

View file

@ -64,4 +64,7 @@
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<Folder Include="Configuration\" />
</ItemGroup>
</Project>

View file

@ -3,15 +3,14 @@ using Dalamud.DiscordBot;
namespace Dalamud {
[Serializable]
public sealed class DalamudStartInfo {
public sealed class DalamudStartInfo
{
public string WorkingDirectory;
public string ConfigurationPath;
public string PluginDirectory;
public string DefaultPluginDirectory;
public ClientLanguage Language;
public DiscordFeatureConfiguration DiscordFeatureConfig { get; set; }
public bool OptOutMbCollection { get; set; } = false;
}
public enum ClientLanguage

View file

@ -5,7 +5,6 @@ using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using Dalamud.Game.Chat;
using Dalamud.Settings;
using Serilog;
namespace Dalamud.Game {
@ -81,8 +80,8 @@ namespace Dalamud.Game {
var originalMessage = string.Copy(message);
if (PersistentSettings.Instance.BadWords != null &&
PersistentSettings.Instance.BadWords.Any(x => originalMessage.Contains(x))) {
if (this.dalamud.Configuration.BadWords != null &&
this.dalamud.Configuration.BadWords.Any(x => originalMessage.Contains(x))) {
// This seems to be in the user block list - let's not show it
Log.Debug("Blocklist triggered");
isHandled = true;

View file

@ -37,8 +37,8 @@ namespace Dalamud.Game.ClientState.Actors {
var actorStruct = Marshal.PtrToStructure<Structs.Actor>(offset);
Log.Debug("ActorTable[{0}]: {1} - {2} - {3}", index, tblIndex.ToString("X"), offset.ToString("X"),
actorStruct.ObjectKind.ToString());
//Log.Debug("ActorTable[{0}]: {1} - {2} - {3}", index, tblIndex.ToString("X"), offset.ToString("X"),
// actorStruct.ObjectKind.ToString());
switch (actorStruct.ObjectKind) {
case ObjectKind.Player: return new PlayerCharacter(actorStruct);

View file

@ -10,6 +10,7 @@ using System.Threading.Tasks;
using Dalamud.Game.ClientState.Actors;
using Dalamud.Game.ClientState.Actors.Types;
using Dalamud.Game.Internal;
using Serilog;
namespace Dalamud.Game.ClientState
{
@ -54,6 +55,8 @@ namespace Dalamud.Game.ClientState
Address = new ClientStateAddressResolver();
Address.Setup(scanner);
Log.Verbose("===== C L I E N T S T A T E =====");
this.ClientLanguage = startInfo.Language;
this.Actors = new ActorTable(Address);

View file

@ -15,7 +15,7 @@ namespace Dalamud.Game.ClientState
protected override void Setup64Bit(SigScanner sig) {
ActorTable = sig.Module.BaseAddress + 0x1B29B40;
LocalContentId = sig.Module.BaseAddress + 0x1B58B60;
JobGaugeData = sig.Module.BaseAddress + 0x1B2D4B4;
JobGaugeData = sig.Module.BaseAddress + 0x1BFD110;
}
}
}

View file

@ -1,11 +1,5 @@
using Dalamud.Game.ClientState.Structs.JobGauge;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using Serilog;
namespace Dalamud.Game.ClientState {
public class JobGauges {
@ -13,12 +7,14 @@ namespace Dalamud.Game.ClientState {
public JobGauges(ClientStateAddressResolver addressResolver) {
Address = addressResolver;
Log.Verbose("JobGaugeData address {JobGaugeData}", Address.ActorTable);
}
// Should only be called with the gauge types in
// ClientState.Structs.JobGauge
public T Get<T>() {
return Marshal.PtrToStructure<T>(Address.ActorTable);
return Marshal.PtrToStructure<T>(Address.JobGaugeData);
}
}
}

View file

@ -9,5 +9,18 @@ namespace Dalamud.Game.ClientState.Structs.JobGauge {
[StructLayout(LayoutKind.Explicit)]
public struct ASTGauge {
[FieldOffset(4)] private CardType Card;
[FieldOffset(5)] private unsafe fixed byte Seals[3];
public CardType DrawnCard() {
return Card;
}
public unsafe bool ContainsSeal(SealType seal) {
if (Seals[0] == (byte)seal) return true;
if (Seals[1] == (byte)seal) return true;
if (Seals[2] == (byte)seal) return true;
return false;
}
}
}

View file

@ -9,12 +9,12 @@ namespace Dalamud.Game.ClientState.Structs.JobGauge {
[StructLayout(LayoutKind.Explicit)]
public struct BLMGauge {
[FieldOffset(0xc)] public short TimeUntilNextPolyglot; //eno timer (ms)
[FieldOffset(0xe)] public short ElementTimeRemaining; //ui/af timer
[FieldOffset(0x10)] private byte ElementStance; //ui/af
[FieldOffset(0x11)] public byte NumUmbralHearts; //number of umbral hearts
[FieldOffset(0x12)] public byte NumPolyglotStacks; //number of polyglot stacks
[FieldOffset(0x13)] public bool IsEnoActive; //eno active?
[FieldOffset(0)] public short TimeUntilNextPolyglot; //eno timer (ms)
[FieldOffset(2)] public short ElementTimeRemaining; //ui/af timer
[FieldOffset(4)] private byte ElementStance; //ui/af
[FieldOffset(5)] public byte NumUmbralHearts; //number of umbral hearts
[FieldOffset(6)] public byte NumPolyglotStacks; //number of polyglot stacks
[FieldOffset(7)] private byte EnoState; //eno active?
public bool InUmbralIce() {
return ElementStance > 4;
@ -24,6 +24,10 @@ namespace Dalamud.Game.ClientState.Structs.JobGauge {
return ElementStance > 0 && ElementStance < 4;
}
public bool IsEnoActive() {
return EnoState > 0;
}
}

View file

@ -9,5 +9,8 @@ namespace Dalamud.Game.ClientState.Structs.JobGauge {
[StructLayout(LayoutKind.Explicit)]
public struct BRDGauge {
[FieldOffset(0)] public short SongTimer;
[FieldOffset(2)] public byte NumSongStacks;
[FieldOffset(4)] public CurrentSong ActiveSong;
}
}

View file

@ -9,13 +9,17 @@ namespace Dalamud.Game.ClientState.Structs.JobGauge {
[StructLayout(LayoutKind.Explicit)]
public unsafe struct DNCGauge {
[FieldOffset(0xc)] public byte NumFeathers;
[FieldOffset(0xd)] public byte Esprit;
[FieldOffset(0xe)] public fixed byte StepOrder[4];
[FieldOffset(0x12)] public byte NumCompleteSteps;
[FieldOffset(0)] public byte NumFeathers;
[FieldOffset(1)] public byte Esprit;
[FieldOffset(2)] private fixed byte StepOrder[4];
[FieldOffset(6)] public byte NumCompleteSteps;
public bool IsDancing() {
return StepOrder[0] != 0;
}
public ulong NextStep() {
return (ulong)(15999 + StepOrder[NumCompleteSteps] - 1);
}
}
}

View file

@ -9,5 +9,8 @@ namespace Dalamud.Game.ClientState.Structs.JobGauge {
[StructLayout(LayoutKind.Explicit)]
public struct DRGGauge {
[FieldOffset(0)] public short BOTDTimer;
[FieldOffset(2)] public BOTDState BOTDState;
[FieldOffset(3)] public byte EyeCount;
}
}

View file

@ -8,9 +8,13 @@ using System.Threading.Tasks;
namespace Dalamud.Game.ClientState.Structs.JobGauge {
[StructLayout(LayoutKind.Explicit)]
public struct DRKGauge {
[FieldOffset(0xc)] public short Blood;
[FieldOffset(0xe)] public short DarksideTimeRemaining;
[FieldOffset(0x10)] public bool HasDarkArts;
[FieldOffset(0x12)] public short ShadowTimeRemaining;
[FieldOffset(0)] public byte Blood;
[FieldOffset(2)] public short DarksideTimeRemaining;
[FieldOffset(4)] private byte DarkArtsState;
[FieldOffset(6)] public short ShadowTimeRemaining;
public bool HasDarkArts() {
return DarkArtsState > 0;
}
}
}

View file

@ -9,5 +9,8 @@ namespace Dalamud.Game.ClientState.Structs.JobGauge {
[StructLayout(LayoutKind.Explicit)]
public struct GNBGauge {
[FieldOffset(0)] public byte NumAmmo;
[FieldOffset(2)] public short MaxTimerDuration;
[FieldOffset(4)] public byte AmmoComboStepNumber;
}
}

View file

@ -0,0 +1,67 @@
using System;
namespace Dalamud.Game.ClientState.Structs.JobGauge {
public enum SealType : byte {
NONE = 0,
SUN,
MOON,
CELESTIAL
}
public enum CardType : byte {
NONE = 0,
BALANCE,
BOLE,
ARROW,
SPEAR,
EWER,
SPIRE,
LORD = 0x70,
LADY = 0x80
}
public enum SummonPet : byte {
NONE = 0,
IFRIT = 3,
TITAN,
GARUDA
}
public enum PetGlam : byte {
NONE = 0,
EMERALD,
TOPAZ,
RUBY
}
[Flags]
public enum Sen : byte {
NONE = 0,
SETSU = 1 << 0,
GETSU = 1 << 1,
KA = 1 << 2
}
public enum BOTDState : byte {
NONE = 0,
BOTD,
LOTD
}
public enum CurrentSong : byte {
MAGE = 5,
ARMY = 0xA,
WANDERER = 0xF
}
public enum DismissedFairy : byte {
EOS = 6,
SELENE
}
public enum Mudras : byte {
TEN = 1,
CHI = 2,
JIN = 3
}
}

View file

@ -10,12 +10,12 @@ namespace Dalamud.Game.ClientState.Structs.JobGauge {
[StructLayout(LayoutKind.Explicit)]
public struct MCHGauge{
[FieldOffset(0xc)] public short OverheatTimeRemaining;
[FieldOffset(0xe)] public short RobotTimeRemaining;
[FieldOffset(0x10)] public byte Heat;
[FieldOffset(0x11)] public byte Battery;
[FieldOffset(0x12)] public byte LastRobotBatteryPower;
[FieldOffset(0x13)] private byte TimerActive;
[FieldOffset(0)] public short OverheatTimeRemaining;
[FieldOffset(2)] public short RobotTimeRemaining;
[FieldOffset(4)] public byte Heat;
[FieldOffset(5)] public byte Battery;
[FieldOffset(6)] public byte LastRobotBatteryPower;
[FieldOffset(7)] private byte TimerActive;
public bool IsOverheated() {
return (TimerActive & 1) != 0;

View file

@ -9,5 +9,13 @@ namespace Dalamud.Game.ClientState.Structs.JobGauge {
[StructLayout(LayoutKind.Explicit)]
public struct MNKGauge {
[FieldOffset(0)] public byte GLTimer;
[FieldOffset(2)] public byte NumGLStacks;
[FieldOffset(3)] public byte NumChakra;
[FieldOffset(4)] private byte GLTimerFreezeState;
public bool IsGLTimerFroze() {
return GLTimerFreezeState > 0;
}
}
}

View file

@ -9,5 +9,9 @@ namespace Dalamud.Game.ClientState.Structs.JobGauge {
[StructLayout(LayoutKind.Explicit)]
public struct NINGauge {
[FieldOffset(0)] public int HutonTimeLeft;
[FieldOffset(4)] public byte TCJMudrasUsed; //some sort of mask
[FieldOffset(5)] public byte Ninki;
[FieldOffset(6)] public byte NumHutonManualCasts; //wtf
}
}

View file

@ -9,5 +9,6 @@ namespace Dalamud.Game.ClientState.Structs.JobGauge {
[StructLayout(LayoutKind.Explicit)]
public struct PLDGauge {
[FieldOffset(0)] public byte GaugeAmount;
}
}

View file

@ -9,5 +9,7 @@ namespace Dalamud.Game.ClientState.Structs.JobGauge {
[StructLayout(LayoutKind.Explicit)]
public struct RDMGauge {
[FieldOffset(0)] public byte WhiteGauge;
[FieldOffset(1)] public byte BlackGauge;
}
}

View file

@ -10,7 +10,7 @@ namespace Dalamud.Game.ClientState.Structs.JobGauge {
[StructLayout(LayoutKind.Explicit)]
public struct SAMGauge {
[FieldOffset(0xf)] public byte Kenki;
[FieldOffset(0x10)] public byte Sen;
[FieldOffset(3)] public byte Kenki;
[FieldOffset(4)] public Sen Sen;
}
}

View file

@ -9,5 +9,9 @@ namespace Dalamud.Game.ClientState.Structs.JobGauge {
[StructLayout(LayoutKind.Explicit)]
public struct SCHGauge {
[FieldOffset(2)] public byte NumAetherflowStacks;
[FieldOffset(3)] public byte FairyGaugeAmount;
[FieldOffset(4)] public short SeraphTimer;
[FieldOffset(6)] public DismissedFairy DismissedFairy;
}
}

View file

@ -11,8 +11,21 @@ namespace Dalamud.Game.ClientState.Structs.JobGauge {
public struct SMNGauge {
//Unfinished
[FieldOffset(0xc)] public short TimerRemaining;
[FieldOffset(0xf)] public bool IsDemiActive;
[FieldOffset(0x10)] public byte NumStacks;
[FieldOffset(0)] public short TimerRemaining;
[FieldOffset(2)] public SummonPet ReturnSummon;
[FieldOffset(3)] public PetGlam ReturnSummonGlam;
[FieldOffset(4)] public byte NumStacks;
public bool IsPhoenixReady() {
return (NumStacks & 0x10) > 0;
}
public bool IsBahamutReady() {
return (NumStacks & 8) > 0;
}
public bool HasAetherflowStacks() {
return (NumStacks & 3) > 0;
}
}
}

View file

@ -9,5 +9,6 @@ namespace Dalamud.Game.ClientState.Structs.JobGauge {
[StructLayout(LayoutKind.Explicit)]
public struct WARGauge {
[FieldOffset(0)] public byte BeastGaugeAmount;
}
}

View file

@ -9,5 +9,8 @@ namespace Dalamud.Game.ClientState.Structs.JobGauge {
[StructLayout(LayoutKind.Explicit)]
public struct WHMGauge {
[FieldOffset(2)] public short LilyTimer; //Counts to 30k = 30s
[FieldOffset(4)] public byte NumLilies;
[FieldOffset(5)] public byte NumBloodLily;
}
}

View file

@ -1,6 +1,5 @@
using System;
using System.Runtime.InteropServices;
using Dalamud.Settings;
using Dalamud.Game.Internal.Gui;
using Dalamud.Game.Internal.Libc;
using Dalamud.Game.Internal.Network;
@ -56,7 +55,7 @@ namespace Dalamud.Game.Internal {
Network = new GameNetwork(dalamud, scanner);
Resource = new ResourceManager(dalamud, scanner);
//Resource = new ResourceManager(dalamud, scanner);
}
private void HookVTable() {
@ -100,7 +99,7 @@ namespace Dalamud.Game.Internal {
} catch (Exception ex) {
Log.Error(ex, "Exception while dispatching Framework::Update event.");
}
return this.updateHook.Original(framework);
}
}

View file

@ -1,38 +0,0 @@
using System;
using System.Diagnostics;
using Dalamud.Hooking;
namespace Dalamud.Game.Internal.Gui {
public class IconReplaceChecker {
private IconReplaceCheckerAddressResolver address;
private Hook<OnCheckDetour> checkerHook;
public IconReplaceChecker(ProcessModule module, SigScanner scanner) {
this.address = new IconReplaceCheckerAddressResolver();
this.address.Setup(scanner);
hookChecker();
}
private void hookChecker() {
this.checkerHook = new Hook<OnCheckDetour>(this.address.BaseAddress, (Delegate)new OnCheckDetour(this.HandleChecker), (object)this);
}
public void Enable() {
this.checkerHook.Enable();
}
public void Dispose() {
this.checkerHook.Dispose();
}
// I hate this function. This is the dumbest function to exist in the game. Just return 1.
// Determines which abilities are allowed to have their icons updated.
private ulong HandleChecker(int actionID) {
return 1;
}
private delegate ulong OnCheckDetour(int actionID);
public delegate ulong OnCheckDelegate(int actionID);
}
}

View file

@ -1,17 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Dalamud.Game.Internal.Gui {
class IconReplaceCheckerAddressResolver : BaseAddressResolver {
public IntPtr BaseAddress { get; private set; }
protected bool IsResolved { get; set; }
protected override void Setup64Bit(SigScanner sig)
{
this.BaseAddress = sig.ScanText("81 f9 d4 08 00 00 7f 33 0f 84 fa 01 00 00 83 c1 eb 81 f9 a3 00 00 00");
}
}
}

File diff suppressed because it is too large Load diff

View file

@ -6,11 +6,12 @@ using System.Threading.Tasks;
namespace Dalamud.Game.Internal.Gui {
class IconReplacerAddressResolver : BaseAddressResolver {
public IntPtr BaseAddress { get; private set; }
protected bool IsResolved { get; set; }
public IntPtr GetIcon { get; private set; }
public IntPtr IsIconReplaceable { get; private set; }
protected override void Setup64Bit(SigScanner sig) {
this.BaseAddress = sig.ScanText("81 fa d4 08 00 00 7f 4b 74 44 8d 42 eb 3d a3 00 00 00");
this.GetIcon = sig.ScanText("48 89 5c 24 08 48 89 6c 24 10 48 89 74 24 18 57 48 83 ec 30 8b da be dd 1c 00 00 bd d3 0d 00 00");
this.IsIconReplaceable = sig.ScanText("81 f9 2e 01 00 00 7f 39 81 f9 2d 01 00 00 0f 8d 11 02 00 00 83 c1 eb");
}
}
}

View file

@ -6,7 +6,6 @@ using System.Threading.Tasks;
using Dalamud.Game.Network.MarketBoardUploaders;
using Dalamud.Game.Network.Structures;
using Dalamud.Game.Network.Universalis.MarketBoardUploaders;
using Dalamud.Settings;
using Serilog;
namespace Dalamud.Game.Network {
@ -46,14 +45,14 @@ namespace Dalamud.Game.Network {
}
if (opCode == ZoneOpCode.FateSpawn) {
if (PersistentSettings.Instance.Fates == null)
if (this.dalamud.Configuration.Fates == null)
return;
var data = new byte[64];
Marshal.Copy(dataPtr, data, 0, 64);
var fateId = data[16];
if (PersistentSettings.Instance.Fates.Any(x => x.Id == fateId) &&
if (this.dalamud.Configuration.Fates.Any(x => x.Id == fateId) &&
this.dalamud.BotManager.IsConnected)
Task.Run(() => this.dalamud.BotManager.ProcessFate(fateId));

View file

@ -1,50 +0,0 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
namespace Dalamud.Settings
{
public class PersistentSettings {
private static PersistentSettings _instance = null;
private static readonly string ConfigPath = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "settings.json");
public static PersistentSettings Instance {
get {
if (_instance == null) {
if (!File.Exists(ConfigPath)) {
_instance = new PersistentSettings();
return _instance;
}
_instance = JsonConvert.DeserializeObject<PersistentSettings>(File.ReadAllText(ConfigPath));
}
return _instance;
}
}
public class FateInfo {
public string Name { get; set; }
public int Id { get; set; }
}
public List<FateInfo> Fates;
public List<string> BadWords;
public void Save() {
File.WriteAllText(ConfigPath, JsonConvert.SerializeObject(this));
}
public static void Reset() {
_instance = new PersistentSettings();
Instance.Save();
}
}
}