Compare commits

...

3 Commits

Author SHA1 Message Date
Anna 0e93d11fea
fix: add delay to spawning 2023-02-19 22:34:32 -05:00
Anna 94a1a6fc2a
fix(server): insert plot 2023-02-19 22:17:48 -05:00
Anna 7231833442
fix: handle apartments 2023-02-19 22:17:41 -05:00
3 changed files with 31 additions and 4 deletions

View File

@ -1,3 +1,4 @@
using System.Diagnostics;
using System.Numerics;
using Dalamud.Data;
using Dalamud.Game;
@ -83,23 +84,40 @@ internal class Messages : IDisposable {
this.SpawnVfx();
}
this.Plugin.Framework.Update += this.DetermineIfSpawn;
this.Plugin.Framework.Update += this.RemoveConditionally;
this.Plugin.Framework.Update += this.HandleSpawnQueue;
this.Plugin.ClientState.Login += this.SpawnVfx;
this.Plugin.ClientState.Logout += this.RemoveVfx;
this.Plugin.ClientState.TerritoryChanged += this.SpawnVfx;
}
public void Dispose() {
this.Plugin.ClientState.TerritoryChanged -= this.SpawnVfx;
this.Plugin.ClientState.Logout -= this.RemoveVfx;
this.Plugin.ClientState.Login -= this.SpawnVfx;
this.Plugin.Framework.Update -= this.HandleSpawnQueue;
this.Plugin.Framework.Update -= this.RemoveConditionally;
this.Plugin.Framework.Update -= this.DetermineIfSpawn;
this.RemoveVfx();
}
private readonly Stopwatch _timer = new();
private ushort _lastTerritory;
private void DetermineIfSpawn(Framework framework) {
var current = this.Plugin.ClientState.TerritoryType;
if (current != this._lastTerritory && this.Plugin.ClientState.LocalPlayer != null) {
this._timer.Start();
}
if (this._timer.Elapsed >= TimeSpan.FromSeconds(1)) {
this._timer.Reset();
this.SpawnVfx();
}
this._lastTerritory = current;
}
private void RemoveConditionally(Framework framework) {
var nowCutscene = this.CutsceneActive;
var cutsceneChanged = this._inCutscene != nowCutscene;

View File

@ -79,7 +79,15 @@ internal class MessageList : ITab {
loc += $" (Ward {message.Ward.Value}";
if (message.Plot != null) {
loc += $", Plot {message.Plot.Value}";
if (message.Plot.Value >= 10_000) {
var apartment = message.Plot.Value - 10_000;
var wing = apartment < 5_000 ? 1 : 2;
var apt = wing == 2 ? apartment - 5_000 : apartment;
loc += $", Apt. {apt}, Wing {wing}";
} else {
loc += $", Plot {message.Plot.Value}";
}
}
loc += ")";

View File

@ -67,11 +67,12 @@ async fn logic(state: Arc<State>, id: i64, extra: i64, message: Message) -> Resu
sqlx::query!(
// language=sqlite
"insert into messages (id, user, territory, ward, x, y, z, yaw, message, glyph) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)",
"insert into messages (id, user, territory, ward, plot, x, y, z, yaw, message, glyph) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)",
message_id,
id,
territory,
message.ward,
message.plot,
message.x,
message.y,
message.z,