Skip to content
This repository has been archived by the owner on Aug 28, 2024. It is now read-only.

Commit

Permalink
fix: vfx fixed.
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchiDog1998 committed Mar 4, 2024
1 parent 5032cd5 commit 0ebc6b0
Show file tree
Hide file tree
Showing 17 changed files with 323 additions and 152 deletions.
2 changes: 1 addition & 1 deletion Resources/RotationSolverRecord.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"ClickingCount": 98903,
"SayingHelloCount": 162,
"SayingHelloCount": 165,
"SaidUsers": []
}
8 changes: 4 additions & 4 deletions RotationSolver.Basic/Configuration/Configs.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Dalamud.Configuration;
using ECommons.DalamudServices;
using ECommons.ExcelServices;
using RotationSolver.Basic.Configuration.Omens;
using RotationSolver.Basic.Configuration.Timeline;

namespace RotationSolver.Basic.Configuration;
Expand Down Expand Up @@ -625,9 +626,6 @@ public const string
[UI("Prompt box color of teaching mode", Parent =nameof(TeachingMode))]
public Vector4 TeachingModeColor { get; set; } = new(0f, 1f, 0.8f, 1f);

[UI("Prompt box color of moving target", Parent =nameof(ShowMoveTarget))]
public Vector4 MovingTargetColor { get; set; } = new(0f, 1f, 0.8f, 0.6f);

[UI("Target color", Parent =nameof(TargetColor))]
public Vector4 TargetColor { get; set; } = new(1f, 0.2f, 0f, 0.8f);

Expand Down Expand Up @@ -745,6 +743,8 @@ public const string
[JobConfig]
private readonly Dictionary<uint, Dictionary<float, List<ITimelineItem>>> _timeline = [];

public Dictionary<uint, CastingOmenConfig> OmenCastingConfig { get; set; } = [];

public void Save()
{
#if DEBUG
Expand All @@ -753,4 +753,4 @@ public void Save()
File.WriteAllText(Svc.PluginInterface.ConfigFile.FullName,
JsonConvert.SerializeObject(this, Formatting.Indented));
}
}
}
9 changes: 9 additions & 0 deletions RotationSolver.Basic/Configuration/Omens/CastingOmenConfig.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
namespace RotationSolver.Basic.Configuration.Omens;
public struct CastingOmenConfig
{
public string? OmenPath { get; set; }
public float? X { get; set; }
public float? Y { get; set; }

public float? Rotation { get; set; }
}
15 changes: 4 additions & 11 deletions RotationSolver.Basic/Data/VfxNewData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,14 @@

namespace RotationSolver.Basic.Data;

internal readonly struct VfxNewData
internal readonly struct VfxNewData(uint objectId, string path)
{
public readonly uint ObjectId;
public readonly string Path;
public readonly uint ObjectId = objectId;
public readonly string Path = path;

public readonly DateTime Time;
public readonly DateTime Time = DateTime.Now;

public readonly TimeSpan TimeDuration => DateTime.Now - Time;

public VfxNewData(uint objectId, string path)
{
Time = DateTime.Now;
ObjectId = objectId;
Path = path;
}

public override string ToString() => $"Object Effect: {Svc.Objects.SearchById(ObjectId)?.Name ?? "Object"}: {Path}";
}
3 changes: 2 additions & 1 deletion RotationSolver/Localization/Localization.json
Original file line number Diff line number Diff line change
Expand Up @@ -360,5 +360,6 @@
"RotationSolver.Data.UiString.ConfigWindow_Actions_TTU": "Time to untargetable that this action needs the timeline be.",
"TargetDelayName": "The range of random delay for finding a target.",
"ShowOmenName": "Show The Omen things.",
"AutoCloseChestWindowName": "Auto close the loot window when auto opened the chest."
"AutoCloseChestWindowName": "Auto close the loot window when auto opened the chest.",
"RotationSolver.Data.UiString.ConfigWindow_About_OpenConfigFolder": "Open Config Folder"
}
46 changes: 38 additions & 8 deletions RotationSolver/RotationSolverPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
using ECommons.DalamudServices;
using ECommons.GameHelpers;
using ECommons.ImGuiMethods;
using Lumina.Excel.GeneratedSheets;
using Lumina.Excel.GeneratedSheets2;
using RotationSolver.Basic.Configuration;
using RotationSolver.Basic.Configuration.Timeline;
using RotationSolver.Commands;
Expand All @@ -15,7 +17,6 @@
using RotationSolver.Localization;
using RotationSolver.UI;
using RotationSolver.Updaters;
using System.Runtime.InteropServices;
using XIVPainter.Enum;
using XIVPainter.Vfx;

Expand Down Expand Up @@ -99,14 +100,43 @@ public RotationSolverPlugin(DalamudPluginInterface pluginInterface)
#if DEBUG
if (Player.Available)
{
//_ = new ActorVfx(Player.Object, Player.Object,
// "vfx/ws/2rp_ws_s06/eff/2rp_ws06c0h.avfx")
//{
//};
//_ = new StaticVfx("vfx/lockon/eff/com_share0c.avfx", Player.Object, Vector3.One)
//_ = new StaticVfx(GroundOmenFriendly.Circle1, Player.Object, new Vector3(1, 1, 3));

_ = new ActorVfx(Player.Object, Player.Object, "vfx/lockon/eff/m0618trg_a0k1.avfx");

//Task.Run(async () =>
//{
// //DeadTime = DateTime.Now.AddSeconds(5),
//};
// var allLockOn = Svc.Data.GetExcelSheet<Lockon>()!.ToArray();
// allLockOn = allLockOn[460..];
// Svc.Log.Error(DateTime.Now.AddSeconds(allLockOn.Length * 5).ToLongTimeString());

// foreach (var item in allLockOn)
// {
// if (item == null) continue;

// var name = item.Unknown0.RawString;

// if (string.IsNullOrEmpty(name)) continue;

// var path = $"vfx/lockon/eff/{name}.avfx";
// var vfx2 = new ActorVfx(Player.Object, Player.Object,
// path);

// Svc.Toasts.ShowError(name);

// await Task.Delay(4500);

// vfx2.Dispose();

// await Task.Delay(500);
// }

// Svc.Toasts.ShowQuest("That's All Lock On", new Dalamud.Game.Gui.Toast.QuestToastOptions()
// {
// DisplayCheckmark = true,
// PlaySound = true,
// });
//});
}
#endif
}
Expand Down
3 changes: 2 additions & 1 deletion RotationSolver/UI/CollapsingHeaderGroup.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Dalamud.Interface.Utility.Raii;
using ECommons.DalamudServices;
using XIVPainter;

namespace RotationSolver.UI;

Expand Down Expand Up @@ -49,7 +50,7 @@ public void Draw()
ImGui.Separator();
var selected = index == _openedIndex;
var changed = false;
using (var font = ImRaii.PushFont(ImGuiHelper.GetFont(HeaderSize)))
using (var font = ImRaii.PushFont(DrawingExtensions.GetFont(HeaderSize)))
{
changed = ImGui.Selectable(name, selected, ImGuiSelectableFlags.DontClosePopups);
}
Expand Down
3 changes: 2 additions & 1 deletion RotationSolver/UI/CooldownWindow.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Dalamud.Interface.Utility.Raii;
using RotationSolver.Updaters;
using XIVPainter;

namespace RotationSolver.UI;

Expand Down Expand Up @@ -79,7 +80,7 @@ private static void DrawActionCooldown(IAction act, float width)
ImGui.GetWindowDrawList().AddLine(startPos, startPos + new Vector2(0, size.Y), black);
}

using var font = ImRaii.PushFont(ImGuiHelper.GetFont(Service.Config.CooldownFontSize));
using var font = ImRaii.PushFont(DrawingExtensions.GetFont(Service.Config.CooldownFontSize));
string time = recast == 0 ? "0" : ((int)(recast - elapsed % recast) + 1).ToString();
var strSize = ImGui.CalcTextSize(time);
var fontPos = new Vector2(pos.X + size.X / 2 - strSize.X / 2, pos.Y + size.Y / 2 - strSize.Y / 2) + winPos;
Expand Down
23 changes: 0 additions & 23 deletions RotationSolver/UI/ImGuiHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,29 +88,6 @@ public static void DisplayEvent(this ActionEventInfo info)
info.DisplayMacro();
}

public unsafe static ImFontPtr GetFont(float size)
{
var style = new Dalamud.Interface.GameFonts.GameFontStyle(Dalamud.Interface.GameFonts.GameFontStyle.GetRecommendedFamilyAndSize(Dalamud.Interface.GameFonts.GameFontFamily.Axis, size));

var handle = Svc.PluginInterface.UiBuilder.FontAtlas.NewGameFontHandle(style);

try
{
var font = handle.Lock().ImFont;

if ((IntPtr)font.NativePtr == IntPtr.Zero)
{
return ImGui.GetFont();
}
font.Scale = size / style.BaseSizePt;
return font;
}
catch
{
return ImGui.GetFont();
}
}

public static void SearchCombo<T>(string popId, string name, ref string searchTxt, T[] items, Func<T, string> getSearchName, Action<T> selectAction, string searchingHint, ImFontPtr? font = null, Vector4? color = null)
{
if (SelectableButton(name + "##" + popId, font, color))
Expand Down
Loading

0 comments on commit 0ebc6b0

Please sign in to comment.