-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathchanges.patch
90 lines (84 loc) · 9.2 KB
/
changes.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
diff --git a/Moodles/MyStatusManager.cs b/Moodles/MyStatusManager.cs
index 472c65e..90c214d 100644
--- a/Moodles/MyStatusManager.cs
+++ b/Moodles/MyStatusManager.cs
@@ -1,4 +1,5 @@
using Dalamud.Game.ClientState.Objects.SubKinds;
+using ECommons.Configuration;
using ECommons.GameHelpers;
using MemoryPack;
using Moodles.Data;
@@ -43,21 +44,30 @@ public class MyStatusManager
// use newStatus to check, in case we changed the setting between applications. Performs stack count updating.
if (newStatus.StackOnReapply)
{
- // Keep the current stack count set to the status.
- var newStackCount = Statuses[i].Stacks;
-
- // If valid, increase the stack count by 1 on reapplication is source is StatusTuple.
- if (source is UpdateSource.StatusTuple && P.CommonProcessor.IconStackCounts.TryGetValue((uint)newStatus.IconID, out var max) && max > 1)
+ if (source is UpdateSource.StatusTuple)
{
- if (Statuses[i].Stacks + 1 <= max)
+ // grab the current stack count.
+ var newStackCount = Statuses[i].Stacks;
+ // fetch what the max stack count for the icon is.
+ if (P.CommonProcessor.IconStackCounts.TryGetValue((uint)newStatus.IconID, out var max))
{
- newStackCount++;
- // remove status GUID from addTextShown so it can be shown again with the new stack on the next tick.
- AddTextShown.Remove(newStatus.GUID);
+ // if the stack count is less than the max, increase it by 1, and remove it from addTextShown to display the new stack.
+ if (Statuses[i].Stacks + 1 <= max)
+ {
+ newStackCount++;
+ newStatus.Stacks = newStackCount;
+ AddTextShown.Remove(newStatus.GUID);
+ }
}
}
- // update stack count.
- newStatus.Stacks = newStackCount;
+ // Handle sources that are from status manager sets.
+ else if (source is UpdateSource.DataString)
+ {
+ // if the source is the data string, we simply apply the data string.
+ // HOWEVER, if and only if the stack count is different, we need to remove it from addTextShown to display the new stack.
+ if (Statuses[i].Stacks != newStatus.Stacks)
+ AddTextShown.Remove(newStatus.GUID);
+ }
}
// then update the status with the new status.
Statuses[i] = newStatus;
@@ -134,7 +144,10 @@ public class MyStatusManager
public byte[] BinarySerialize()
{
- return MemoryPackSerializer.Serialize(Statuses, SerializerOptions);
+ var result = MemoryPackSerializer.Serialize(Statuses, SerializerOptions);
+ foreach(var x in Statuses)
+ PluginLog.Verbose($"Status Info: " + EzConfig.DefaultSerializationFactory.Serialize(x.JSONClone(), false));
+ return result;
}
public string SerializeToBase64()
diff --git a/Moodles/OtterGuiHandlers/MoodleFileSystem.cs b/Moodles/OtterGuiHandlers/MoodleFileSystem.cs
index e70203a..44e7864 100644
--- a/Moodles/OtterGuiHandlers/MoodleFileSystem.cs
+++ b/Moodles/OtterGuiHandlers/MoodleFileSystem.cs
@@ -94,7 +94,7 @@ public sealed class MoodleFileSystem : FileSystem<MyStatus>, IDisposable
private (string, bool) SaveConverter(MyStatus status, string arg2)
{
- PluginLog.Debug($"Saving {status.Title} {status.ID}");
+ PluginLog.LogVerbose($"Saving {status.Title} {status.ID}");
return (status.ID, true);
}
diff --git a/Moodles/OtterGuiHandlers/PresetFileSystem.cs b/Moodles/OtterGuiHandlers/PresetFileSystem.cs
index ae9b49b..b648f8d 100644
--- a/Moodles/OtterGuiHandlers/PresetFileSystem.cs
+++ b/Moodles/OtterGuiHandlers/PresetFileSystem.cs
@@ -93,7 +93,7 @@ public sealed class PresetFileSystem : FileSystem<Preset>, IDisposable
private (string, bool) SaveConverter(Preset item, string arg2)
{
- PluginLog.Debug($"Saving {item.ID}");
+ PluginLog.LogVerbose($"Saving {item.ID}");
return (item.ID, true);
}