Compare commits
3 Commits
3770a35113
...
0e93d11fea
Author | SHA1 | Date |
---|---|---|
Anna | 0e93d11fea | |
Anna | 94a1a6fc2a | |
Anna | 7231833442 |
|
@ -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;
|
||||
|
|
|
@ -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 += ")";
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue