Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions JobBars/Cursors/Manager/CursorManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using JobBars.UI;
using FFXIVClientStructs.FFXIV.Component.GUI;
using JobBars.Helper;
using Dalamud.Interface.Utility;

namespace JobBars.Cursors.Manager {
public unsafe partial class CursorManager : PerJobManager<Cursor> {
Expand Down
22 changes: 16 additions & 6 deletions JobBars/Data/ItemSelector.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
using ImGuiNET;
using Dalamud.Interface.Internal;
using ImGuiNET;
using JobBars.Helper;
using Lumina;
using Lumina.Data;
using Lumina.Data.Files;
using Lumina.Extensions;
using System;
using System.Collections.Generic;
using System.Linq;
Expand All @@ -9,7 +13,8 @@
namespace JobBars.Data {
public class ItemSelector {
private readonly List<ItemData> Data;
public ImGuiScene.TextureWrap Icon;
//public ImGuiScene.TextureWrap Icon;
public IDalamudTextureWrap Icon;

private ItemData Selected = new() {
Icon = 0,
Expand Down Expand Up @@ -89,15 +94,20 @@ public bool Draw() {
private void LoadIcon(uint iconId) {
Icon?.Dispose();
Icon = null;

if (iconId > 0) {
TexFile tex;
try {
tex = JobBars.DataManager.GetIcon(iconId);
//tex = JobBars.DataManager.GetIcon(iconId);
Icon = JobBars.TextureProvider.GetIcon(iconId);
}
catch (Exception) {
tex = JobBars.DataManager.GetIcon(0);
//tex = JobBars.DataManager.GetIcon(0);
Icon = JobBars.TextureProvider.GetIcon(0);
}
Icon = JobBars.PluginInterface.UiBuilder.LoadImageRaw(BGRA_to_RGBA(tex.ImageData), tex.Header.Width, tex.Header.Height, 4);

//Icon =
// JobBars.PluginInterface.UiBuilder.LoadImageRaw(BGRA_to_RGBA(tex.ImageData),tex.Header.Width, tex.Header.Height, 4);
}
}

Expand Down Expand Up @@ -130,4 +140,4 @@ public void Dispose() {
Icon = null;
}
}
}
}
1 change: 1 addition & 0 deletions JobBars/Helper/InfoBox.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Dalamud.Interface;
using Dalamud.Interface.Utility;
using ImGuiNET;
using System;
using System.Numerics;
Expand Down
33 changes: 23 additions & 10 deletions JobBars/Helper/UIHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,25 @@ public static unsafe Vector2 GetNodeScale(AtkResNode* node) {
}

public static void Hide(AtkResNode* node) {
node->Flags &= ~0x10;
node->Flags_2 |= 0x1;
//node->Flags &= ~0x10;
var nodeValue = ~0x10;
node->NodeFlags &= (NodeFlags) nodeValue;

//node->Flags_2 |= 0x1;
node->DrawFlags |= 0x1;
}

public static void Show(AtkResNode* node) {
node->Flags |= 0x10;
node->Flags_2 |= 0x1;
//node->Flags |= 0x10;
node->NodeFlags |= (NodeFlags) 0x10;

//node->Flags_2 |= 0x1;
node->DrawFlags |= 0x1;
}

public static void Update(AtkResNode* node) {
node->Flags_2 |= 0x1;
//node->Flags_2 |= 0x1;
node->DrawFlags |= 0x1;
}

public static void SetVisibility(AtkResNode* node, bool visiblity) {
Expand All @@ -46,25 +54,30 @@ public static void SetVisibility(AtkResNode* node, bool visiblity) {
public static void SetSize(AtkResNode* node, int? width, int? height) {
if (width != null && width >= ushort.MinValue && width <= ushort.MaxValue) node->Width = (ushort)width.Value;
if (height != null && height >= ushort.MinValue && height <= ushort.MaxValue) node->Height = (ushort)height.Value;
node->Flags_2 |= 0x1;
//node->Flags_2 |= 0x1;
node->DrawFlags |= 0x1;
}

public static void SetPosition(AtkResNode* node, float? x, float? y) {
if (x != null) node->X = x.Value;
if (y != null) node->Y = y.Value;
node->Flags_2 |= 0x1;
//node->Flags_2 |= 0x1;
node->DrawFlags |= 0x1;
}

public static void SetScale(AtkResNode* atkUnitBase, float? scaleX, float? scaleY) {
atkUnitBase->ScaleX = scaleX.Value;
atkUnitBase->ScaleY = scaleY.Value;
atkUnitBase->Flags_2 |= 0x1;
atkUnitBase->Flags_2 |= 0x4;
//atkUnitBase->Flags_2 |= 0x1;
//atkUnitBase->Flags_2 |= 0x4;
atkUnitBase->DrawFlags |= 0x1;
atkUnitBase->DrawFlags |= 0x4;
}

public static void SetRotation(AtkResNode* node, float rotation) {
node->Rotation = rotation;
node->Flags_2 |= 0x1;
//node->Flags_2 |= 0x1;
node->DrawFlags |= 0x1;
}

public static void Link(AtkResNode* next, AtkResNode* prev) {
Expand Down
4 changes: 2 additions & 2 deletions JobBars/Helper/UiHelper.GameFunctions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public static bool GetCurrentCast(out float currentTime, out float totalTime) {
return JobBars.ClientState.LocalPlayer.IsCasting;
}

public static bool GetRecastActive(uint actionId, out float timeElapsed, ActionType actionType = ActionType.Spell) {
public static bool GetRecastActive(uint actionId, out float timeElapsed, ActionType actionType = ActionType.Action) {
var actionManager = ActionManager.Instance();
var adjustedId = actionManager->GetAdjustedActionId(actionId);
timeElapsed = actionManager->GetRecastTimeElapsed(actionType, adjustedId);
Expand All @@ -84,7 +84,7 @@ public static uint GetAdjustedAction(uint actionId) {
return actionManager->GetAdjustedActionId(actionId);
}

public static bool GetRecastActiveAndTotal(uint actionId, out float timeElapsed, out float timeTotal, ActionType actionType = ActionType.Spell) {
public static bool GetRecastActiveAndTotal(uint actionId, out float timeElapsed, out float timeTotal, ActionType actionType = ActionType.Action) {
var actionManager = ActionManager.Instance();
var adjustedId = actionManager->GetAdjustedActionId(actionId);
timeElapsed = actionManager->GetRecastTimeElapsed(actionType, adjustedId);
Expand Down
2 changes: 1 addition & 1 deletion JobBars/JobBars.Hooks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ private IntPtr IconDimmedDetour(IntPtr iconUnk, byte dimmed) {
return icon;
}

private void ZoneChanged(object sender, ushort e) {
private void ZoneChanged(ushort e) {
if (!IsLoaded) return;

GaugeManager?.Reset();
Expand Down
1 change: 1 addition & 0 deletions JobBars/JobBars.Settings.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Dalamud.Interface;
using Dalamud.Interface.Utility;
using ImGuiNET;
using JobBars.Data;
using JobBars.Helper;
Expand Down
61 changes: 33 additions & 28 deletions JobBars/JobBars.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using Dalamud.Hooking;
using Dalamud.Logging;
using Dalamud.Plugin;
using Dalamud.Plugin.Services;
using JobBars.Buffs.Manager;
using JobBars.Cooldowns.Manager;
using JobBars.Cursors.Manager;
Expand All @@ -23,14 +24,15 @@
namespace JobBars {
public unsafe partial class JobBars : IDalamudPlugin {
public static DalamudPluginInterface PluginInterface { get; private set; }
public static ClientState ClientState { get; private set; }
public static JobGauges JobGauges { get; private set; }
public static Framework Framework { get; private set; }
public static Condition Condition { get; private set; }
public static CommandManager CommandManager { get; private set; }
public static ObjectTable Objects { get; private set; }
public static SigScanner SigScanner { get; private set; }
public static DataManager DataManager { get; private set; }
public static IClientState ClientState { get; private set; }
public static IJobGauges JobGauges { get; private set; }
public static IFramework Framework { get; private set; }
public static ICondition Condition { get; private set; }
public static ICommandManager CommandManager { get; private set; }
public static IObjectTable Objects { get; private set; }
public static ISigScanner SigScanner { get; private set; }
public static IDataManager DataManager { get; private set; }
public static ITextureProvider TextureProvider { get; private set; }

public static Configuration Config { get; private set; }
public static UIBuilder Builder { get; private set; }
Expand Down Expand Up @@ -67,24 +69,27 @@ public unsafe partial class JobBars : IDalamudPlugin {

public JobBars(
DalamudPluginInterface pluginInterface,
ClientState clientState,
CommandManager commandManager,
Condition condition,
Framework framework,
ObjectTable objects,
SigScanner sigScanner,
DataManager dataManager,
JobGauges jobGauges
IClientState clientState,
ICommandManager commandManager,
ICondition condition,
IFramework framework,
IObjectTable objects,
ISigScanner sigScanner,
IDataManager dataManager,
IJobGauges jobGauges,
IGameInteropProvider gameInteropProvider,
ITextureProvider textureProvider
) {
PluginInterface = pluginInterface;
ClientState = clientState;
Framework = framework;
Condition = condition;
CommandManager = commandManager;
Objects = objects;
SigScanner = sigScanner;
DataManager = dataManager;
JobGauges = jobGauges;
ClientState = clientState;
Framework = framework;
Condition = condition;
CommandManager = commandManager;
Objects = objects;
SigScanner = sigScanner;
DataManager = dataManager;
JobGauges = jobGauges;
TextureProvider = textureProvider;

UIHelper.Setup();
UIColor.SetupColors();
Expand Down Expand Up @@ -113,15 +118,15 @@ JobGauges jobGauges
InitializeUI();

IntPtr receiveActionEffectFuncPtr = SigScanner.ScanText(Constants.ReceiveActionEffectSig);
ReceiveActionEffectHook = Hook<ReceiveActionEffectDelegate>.FromAddress(receiveActionEffectFuncPtr, ReceiveActionEffect);
ReceiveActionEffectHook = gameInteropProvider.HookFromAddress<ReceiveActionEffectDelegate>(receiveActionEffectFuncPtr, ReceiveActionEffect);
ReceiveActionEffectHook.Enable();

IntPtr actorControlSelfPtr = SigScanner.ScanText(Constants.ActorControlSig);
ActorControlSelfHook = Hook<ActorControlSelfDelegate>.FromAddress(actorControlSelfPtr, ActorControlSelf);
ActorControlSelfHook = gameInteropProvider.HookFromAddress<ActorControlSelfDelegate>(actorControlSelfPtr, ActorControlSelf);
ActorControlSelfHook.Enable();

IntPtr iconDimmedPtr = SigScanner.ScanText(Constants.IconDimmedSig);
IconDimmedHook = Hook<IconDimmedDelegate>.FromAddress(iconDimmedPtr, IconDimmedDetour);
IconDimmedHook = gameInteropProvider.HookFromAddress<IconDimmedDelegate>(iconDimmedPtr, IconDimmedDetour);
IconDimmedHook.Enable();

PluginInterface.UiBuilder.Draw += BuildSettingsUI;
Expand Down Expand Up @@ -191,7 +196,7 @@ private void Animate() {
Animation.Tick();
}

private void FrameworkOnUpdate(Framework framework) {
private void FrameworkOnUpdate(IFramework framework) {
if (!IsLoaded) return;

var addon = UIHelper.BuffGaugeAttachAddon;
Expand Down
2 changes: 1 addition & 1 deletion JobBars/JobBars.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@
"Tags": [ "UI", "Bars" ],
"RepoUrl": "https://github.com/0ceal0t/JobBars",
"ApplicableVersion": "any",
"DalamudApiLevel": 8
"DalamudApiLevel": 9
}
5 changes: 3 additions & 2 deletions JobBars/UI/Buff/UIBuff.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Dalamud.Logging;
using FFXIVClientStructs.FFXIV.Client.Graphics;
using FFXIVClientStructs.FFXIV.Component.GUI;
using ImGuiNET;
using JobBars.Data;
using JobBars.Helper;

Expand Down Expand Up @@ -58,8 +59,8 @@ public UIBuff() : base() {
TextNode->AlignmentFontType = 52;
TextNode->AtkResNode.X = 0;
TextNode->AtkResNode.Y = 0;
TextNode->AtkResNode.Flags |= 0x10;
TextNode->AtkResNode.Flags_2 = 1;
TextNode->AtkResNode.NodeFlags = NodeFlags.Visible;
TextNode->AtkResNode.DrawFlags = 1;
TextNode->EdgeColor = new ByteColor { R = 0, G = 0, B = 0, A = 255 };

var layout = new LayoutNode(RootRes, new[] {
Expand Down
3 changes: 1 addition & 2 deletions JobBars/UI/Buff/UIBuffPartyList.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ public UIBuffPartyList() {
Highlight->LeftOffset = 20;
Highlight->PartsTypeRenderType = 220;
Highlight->AtkResNode.NodeID = 23;
Highlight->AtkResNode.Flags_2 = 0;
Highlight->AtkResNode.DrawFlags = 0;
Highlight->AtkResNode.NodeFlags = (NodeFlags)19;
Highlight->AtkResNode.MultiplyBlue = 50;
Expand All @@ -39,7 +38,7 @@ public UIBuffPartyList() {
TextNode->AtkResNode.X = 30;
TextNode->AtkResNode.Y = 20;
TextNode->AtkResNode.NodeFlags = (NodeFlags)19;
TextNode->AtkResNode.Flags_2 = 1;
TextNode->AtkResNode.DrawFlags = 1;
TextNode->AtkResNode.Priority = 0;
TextNode->AtkResNode.NodeID = 24;
TextNode->SetText("");
Expand Down
2 changes: 1 addition & 1 deletion JobBars/UI/Builder/UBuilder.Cursor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ private void InitCursor() {
CursorRoot = CreateResNode();
CursorRoot->Width = 44;
CursorRoot->Height = 46;
CursorRoot->Flags = 9395;
CursorRoot->NodeFlags = (NodeFlags) 9395;

CursorOuter = CreateImageNode();
CursorOuter->AtkResNode.Width = 44;
Expand Down
2 changes: 1 addition & 1 deletion JobBars/UI/Builder/UIBuilder.Buffs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ private void InitBuffs() {
BuffRoot = CreateResNode();
BuffRoot->Width = 256;
BuffRoot->Height = 100;
BuffRoot->Flags = 9395;
BuffRoot->DrawFlags = 9395;

UIBuff lastBuff = null;
for (var i = 0; i < MAX_BUFFS; i++) {
Expand Down
2 changes: 1 addition & 1 deletion JobBars/UI/Builder/UIBuilder.Cooldowns.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ private void InitCooldowns() {
CooldownRoot = CreateResNode();
CooldownRoot->Width = 100;
CooldownRoot->Height = 100;
CooldownRoot->Flags = 9395;
CooldownRoot->DrawFlags = 9395;
UIHelper.SetPosition(CooldownRoot, -40, 40);

UICooldown lastCooldown = null;
Expand Down
22 changes: 10 additions & 12 deletions JobBars/UI/Builder/UIBuilder.Create.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ public unsafe partial class UIBuilder {
node->ChildCount = 0;
node->PrevSiblingNode = null;
node->NextSiblingNode = null;
node->Flags = 8243;
node->Flags_2 = 1;
node->Flags_2 |= 4;
node->DrawFlags = 8243;
node->DrawFlags = 1;
node->DrawFlags |= 4;

return node;
}
Expand All @@ -47,9 +47,7 @@ public unsafe partial class UIBuilder {
node->AtkResNode.ChildCount = 0;
node->AtkResNode.PrevSiblingNode = null;
node->AtkResNode.NextSiblingNode = null;
node->AtkResNode.Flags = 8250;
node->AtkResNode.Flags_2 = 1;
node->AtkResNode.Flags_2 |= 4;
node->AtkResNode.NodeFlags = (NodeFlags) 8250;
node->AtkResNode.DrawFlags = 8;

node->TextId = 0;
Expand Down Expand Up @@ -93,9 +91,9 @@ public unsafe partial class UIBuilder {
node->AtkResNode.ChildCount = 0;
node->AtkResNode.PrevSiblingNode = null;
node->AtkResNode.NextSiblingNode = null;
node->AtkResNode.Flags = 8243;
node->AtkResNode.Flags_2 = 1;
node->AtkResNode.Flags_2 |= 4;
node->AtkResNode.NodeFlags = (NodeFlags) 8243;
node->AtkResNode.DrawFlags = 1;
node->AtkResNode.DrawFlags |= 4;

return node;
}
Expand All @@ -121,9 +119,9 @@ public unsafe partial class UIBuilder {
node->AtkResNode.ChildCount = 0;
node->AtkResNode.PrevSiblingNode = null;
node->AtkResNode.NextSiblingNode = null;
node->AtkResNode.Flags = 8243;
node->AtkResNode.Flags_2 = 1;
node->AtkResNode.Flags_2 |= 4;
node->AtkResNode.NodeFlags = (NodeFlags) 8243;
node->AtkResNode.DrawFlags = 1;
node->AtkResNode.DrawFlags |= 4;
node->AtkResNode.DrawFlags = 8;

return node;
Expand Down
Loading