This commit is contained in:
Anna 2022-09-03 23:49:46 -04:00
parent e9fe33e7b8
commit 63489d6581
5 changed files with 75 additions and 13 deletions

View File

@ -63,7 +63,10 @@ internal class Messages : IDisposable {
this.RemoveVfx(null, null);
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 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.Messages = new Messages(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) {
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.PopTextWrapPos();
}
if (ImGui.TableSetColumnIndex(2)) {

View File

@ -1,6 +1,7 @@
using System.Numerics;
using System.Runtime.InteropServices;
using System.Text;
using Dalamud.Game;
using Dalamud.Utility.Signatures;
namespace OrangeGuidanceTomestone;
@ -8,31 +9,49 @@ namespace OrangeGuidanceTomestone;
internal unsafe class Vfx : IDisposable {
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")]
private delegate* unmanaged<byte*, byte*, VfxStruct*> _staticVfxCreate;
[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")]
private delegate* unmanaged<VfxStruct*, void> _staticVfxRemove;
private List<IntPtr> Spawned { get; } = new();
private Queue<IntPtr> NeedToRun { get; } = new();
internal Vfx() {
internal Vfx(Plugin plugin) {
this.Plugin = plugin;
SignatureHelper.Initialise(this);
this.Plugin.Framework.Update += this.Run;
}
public void Dispose() {
this.Plugin.Framework.Update -= this.Run;
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() {
foreach (var spawned in this.Spawned) {
this.RemoveStatic((VfxStruct*) spawned);
}
this.Spawned.Clear();
this.NeedToRun.Clear();
}
internal VfxStruct* SpawnStatic(string path, Vector3 pos) {
@ -47,7 +66,9 @@ internal unsafe class Vfx : IDisposable {
return null;
}
this._staticVfxRun(vfx, 0.0f, 0xFFFFFFFF);
if (this._staticVfxRun(vfx, 0.0f, 0xFFFFFFFF) != 0) {
this.NeedToRun.Enqueue((IntPtr) vfx);
}
// update position
vfx->Position = new Vector3(pos.X, pos.Y, pos.Z);

View File

@ -3,15 +3,47 @@ id: 7cd9e479-080a-4fec-9511-41a53034c2ad
templates:
- '{0} ahead'
- 'No {0} ahead'
- '{0} required ahead'
- 'Be wary of {0}'
- 'Try {0}'
- 'Need {0}'
- 'Imminent {0}...'
- 'Weakness: {0}'
- 'Likely {0}'
- 'First off, {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}?'
- 'Good Luck'
- 'I did it!'
- 'Here!'
- 'I can''t take this...'
- 'Praise the Sun!'
- '{0}...'
conjunctions:
- 'and then'
- 'or'
- 'but'
- 'therefore'
- 'in short'
- 'except'
- 'by the way'
- 'so to speak'
- 'all the more'
- ','
words:
- name: Wildlife
words:
- goobbue
- name: Concepts
words:
- devastation