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 System.Numerics;
|
||||||
using Dalamud.Data;
|
using Dalamud.Data;
|
||||||
using Dalamud.Game;
|
using Dalamud.Game;
|
||||||
|
@ -83,23 +84,40 @@ internal class Messages : IDisposable {
|
||||||
this.SpawnVfx();
|
this.SpawnVfx();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.Plugin.Framework.Update += this.DetermineIfSpawn;
|
||||||
this.Plugin.Framework.Update += this.RemoveConditionally;
|
this.Plugin.Framework.Update += this.RemoveConditionally;
|
||||||
this.Plugin.Framework.Update += this.HandleSpawnQueue;
|
this.Plugin.Framework.Update += this.HandleSpawnQueue;
|
||||||
this.Plugin.ClientState.Login += this.SpawnVfx;
|
this.Plugin.ClientState.Login += this.SpawnVfx;
|
||||||
this.Plugin.ClientState.Logout += this.RemoveVfx;
|
this.Plugin.ClientState.Logout += this.RemoveVfx;
|
||||||
this.Plugin.ClientState.TerritoryChanged += this.SpawnVfx;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Dispose() {
|
public void Dispose() {
|
||||||
this.Plugin.ClientState.TerritoryChanged -= this.SpawnVfx;
|
|
||||||
this.Plugin.ClientState.Logout -= this.RemoveVfx;
|
this.Plugin.ClientState.Logout -= this.RemoveVfx;
|
||||||
this.Plugin.ClientState.Login -= this.SpawnVfx;
|
this.Plugin.ClientState.Login -= this.SpawnVfx;
|
||||||
this.Plugin.Framework.Update -= this.HandleSpawnQueue;
|
this.Plugin.Framework.Update -= this.HandleSpawnQueue;
|
||||||
this.Plugin.Framework.Update -= this.RemoveConditionally;
|
this.Plugin.Framework.Update -= this.RemoveConditionally;
|
||||||
|
this.Plugin.Framework.Update -= this.DetermineIfSpawn;
|
||||||
|
|
||||||
this.RemoveVfx();
|
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) {
|
private void RemoveConditionally(Framework framework) {
|
||||||
var nowCutscene = this.CutsceneActive;
|
var nowCutscene = this.CutsceneActive;
|
||||||
var cutsceneChanged = this._inCutscene != nowCutscene;
|
var cutsceneChanged = this._inCutscene != nowCutscene;
|
||||||
|
|
|
@ -79,7 +79,15 @@ internal class MessageList : ITab {
|
||||||
loc += $" (Ward {message.Ward.Value}";
|
loc += $" (Ward {message.Ward.Value}";
|
||||||
|
|
||||||
if (message.Plot != null) {
|
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 += ")";
|
loc += ")";
|
||||||
|
|
|
@ -67,11 +67,12 @@ async fn logic(state: Arc<State>, id: i64, extra: i64, message: Message) -> Resu
|
||||||
|
|
||||||
sqlx::query!(
|
sqlx::query!(
|
||||||
// language=sqlite
|
// 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,
|
message_id,
|
||||||
id,
|
id,
|
||||||
territory,
|
territory,
|
||||||
message.ward,
|
message.ward,
|
||||||
|
message.plot,
|
||||||
message.x,
|
message.x,
|
||||||
message.y,
|
message.y,
|
||||||
message.z,
|
message.z,
|
||||||
|
|
Loading…
Reference in New Issue