This commit is contained in:
Anna 2022-09-03 23:49:46 -04:00
parent 200dce5527
commit ca0b5de895
Signed by: anna
GPG Key ID: 0B391D8F06FCD9E0
5 changed files with 75 additions and 13 deletions

View File

@ -63,7 +63,10 @@ internal class Messages : IDisposable {
this.RemoveVfx(null, null); this.RemoveVfx(null, null);
Task.Run(async () => { Task.Run(async () => {
var resp = await new HttpClient().GetAsync($"https://tryfingerbuthole.anna.lgbt/messages/{territory}"); var req = new HttpRequestMessage(HttpMethod.Get, $"https://tryfingerbuthole.anna.lgbt/messages/{territory}");
req.Headers.Add("X-Api-Key", this.Plugin.Config.ApiKey);
var resp = await new HttpClient().SendAsync(req);
var json = await resp.Content.ReadAsStringAsync(); var json = await resp.Content.ReadAsStringAsync();
var messages = JsonConvert.DeserializeObject<Message[]>(json)!; var messages = JsonConvert.DeserializeObject<Message[]>(json)!;

View File

@ -38,7 +38,7 @@ public class Plugin : IDalamudPlugin {
}); });
} }
this.Vfx = new Vfx(); this.Vfx = new Vfx(this);
this.Ui = new PluginUi(this); this.Ui = new PluginUi(this);
this.Messages = new Messages(this); this.Messages = new Messages(this);
this.Commands = new Commands(this); this.Commands = new Commands(this);

View File

@ -372,7 +372,13 @@ public class PluginUi : IDisposable {
if (ImGui.TableSetColumnIndex(1) && this._viewerIdx > -1 && this._viewerIdx < nearby.Count) { if (ImGui.TableSetColumnIndex(1) && this._viewerIdx > -1 && this._viewerIdx < nearby.Count) {
var message = nearby[this._viewerIdx]; var message = nearby[this._viewerIdx];
var size = ImGui.CalcTextSize(message.Text, ImGui.GetContentRegionAvail().X);
var height = ImGui.GetContentRegionAvail().Y;
ImGui.Dummy(new Vector2(1, height / 2 - size.Y / 2 - ImGui.GetStyle().ItemSpacing.Y));
ImGui.PushTextWrapPos();
ImGui.TextUnformatted(message.Text); ImGui.TextUnformatted(message.Text);
ImGui.PopTextWrapPos();
} }
if (ImGui.TableSetColumnIndex(2)) { if (ImGui.TableSetColumnIndex(2)) {

View File

@ -1,6 +1,7 @@
using System.Numerics; using System.Numerics;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Text; using System.Text;
using Dalamud.Game;
using Dalamud.Utility.Signatures; using Dalamud.Utility.Signatures;
namespace OrangeGuidanceTomestone; namespace OrangeGuidanceTomestone;
@ -8,31 +9,49 @@ namespace OrangeGuidanceTomestone;
internal unsafe class Vfx : IDisposable { internal unsafe class Vfx : IDisposable {
private static readonly byte[] Pool = Encoding.UTF8.GetBytes("Client.System.Scheduler.Instance.VfxObject"); private static readonly byte[] Pool = Encoding.UTF8.GetBytes("Client.System.Scheduler.Instance.VfxObject");
private Plugin Plugin { get; }
[Signature("E8 ?? ?? ?? ?? F3 0F 10 35 ?? ?? ?? ?? 48 89 43 08")] [Signature("E8 ?? ?? ?? ?? F3 0F 10 35 ?? ?? ?? ?? 48 89 43 08")]
private delegate* unmanaged<byte*, byte*, VfxStruct*> _staticVfxCreate; private delegate* unmanaged<byte*, byte*, VfxStruct*> _staticVfxCreate;
[Signature("E8 ?? ?? ?? ?? 8B 4B 7C 85 C9")] [Signature("E8 ?? ?? ?? ?? 8B 4B 7C 85 C9")]
private delegate* unmanaged<VfxStruct*, float, uint, void> _staticVfxRun; private delegate* unmanaged<VfxStruct*, float, uint, ulong> _staticVfxRun;
[Signature("40 53 48 83 EC 20 48 8B D9 48 8B 89 ?? ?? ?? ?? 48 85 C9 74 28 33 D2 E8 ?? ?? ?? ?? 48 8B 8B ?? ?? ?? ?? 48 85 C9")] [Signature("40 53 48 83 EC 20 48 8B D9 48 8B 89 ?? ?? ?? ?? 48 85 C9 74 28 33 D2 E8 ?? ?? ?? ?? 48 8B 8B ?? ?? ?? ?? 48 85 C9")]
private delegate* unmanaged<VfxStruct*, void> _staticVfxRemove; private delegate* unmanaged<VfxStruct*, void> _staticVfxRemove;
private List<IntPtr> Spawned { get; } = new(); private List<IntPtr> Spawned { get; } = new();
private Queue<IntPtr> NeedToRun { get; } = new();
internal Vfx() { internal Vfx(Plugin plugin) {
this.Plugin = plugin;
SignatureHelper.Initialise(this); SignatureHelper.Initialise(this);
this.Plugin.Framework.Update += this.Run;
} }
public void Dispose() { public void Dispose() {
this.Plugin.Framework.Update -= this.Run;
this.RemoveAll(); this.RemoveAll();
} }
private void Run(Framework framework) {
if (!this.NeedToRun.TryDequeue(out var ptr)) {
return;
}
if (this._staticVfxRun((VfxStruct*) ptr, 0.0f, 0xFFFFFFFF) != 0) {
this.NeedToRun.Enqueue(ptr);
}
}
internal void RemoveAll() { internal void RemoveAll() {
foreach (var spawned in this.Spawned) { foreach (var spawned in this.Spawned) {
this.RemoveStatic((VfxStruct*) spawned); this.RemoveStatic((VfxStruct*) spawned);
} }
this.Spawned.Clear(); this.Spawned.Clear();
this.NeedToRun.Clear();
} }
internal VfxStruct* SpawnStatic(string path, Vector3 pos) { internal VfxStruct* SpawnStatic(string path, Vector3 pos) {
@ -47,7 +66,9 @@ internal unsafe class Vfx : IDisposable {
return null; return null;
} }
this._staticVfxRun(vfx, 0.0f, 0xFFFFFFFF); if (this._staticVfxRun(vfx, 0.0f, 0xFFFFFFFF) != 0) {
this.NeedToRun.Enqueue((IntPtr) vfx);
}
// update position // update position
vfx->Position = new Vector3(pos.X, pos.Y, pos.Z); vfx->Position = new Vector3(pos.X, pos.Y, pos.Z);

View File

@ -3,15 +3,47 @@ id: 7cd9e479-080a-4fec-9511-41a53034c2ad
templates: templates:
- '{0} ahead' - '{0} ahead'
- 'No {0} ahead'
- '{0} required ahead'
- 'Be wary of {0}' - 'Be wary of {0}'
- 'Try {0}' - 'Try {0}'
- 'Need {0}' - 'Likely {0}'
- 'Imminent {0}...' - 'First off, {0}'
- 'Weakness: {0}' - 'Seek {0}'
- 'Still no {0}...'
- 'Why is it always {0}?'
- 'If only I had a {0}...'
- 'Didn''t expect {0}...'
- 'Visions of {0}...'
- 'Could this be a {0}?'
- 'Time for {0}'
- '{0}, O {0}'
- 'Behold, {0}!'
- 'Offer {0}'
- 'Praise the {0}'
- 'Let there be {0}'
- 'Ahh, {0}...'
- '{0}' - '{0}'
- '{0}!'
- '{0}?' - '{0}?'
- 'Good Luck' - '{0}...'
- 'I did it!'
- 'Here!' conjunctions:
- 'I can''t take this...' - 'and then'
- 'Praise the Sun!' - 'or'
- 'but'
- 'therefore'
- 'in short'
- 'except'
- 'by the way'
- 'so to speak'
- 'all the more'
- ','
words:
- name: Wildlife
words:
- goobbue
- name: Concepts
words:
- devastation