Skip to content

Commit

Permalink
Don't Clear Chatbox
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisFeline committed Nov 12, 2024
1 parent 6f323bf commit 68378ce
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@
- OSC Damage event got an overhaul, you can use JavaScript to manipulate the value of this parameter so it can be used as a float in other "things".
- For example, if you set "Damage / 100" as the code and the damage value is '50', this will be evaluated to '0.5' before sending the value.
- Added new WebSocket API event: MASTER_CHANGE
- Chatbox no longer clears on teleport to map if you have the 'Send Chatbox' feature disabled.
- Date list now sorts using Universal Time. This prevents unwanted behaviour when 'Daylight Saving' event occurs.
16 changes: 9 additions & 7 deletions Utils/LilOSC.cs
Original file line number Diff line number Diff line change
Expand Up @@ -123,13 +123,15 @@ static string[] EncounterKeys {
static int ChatboxInterval;
static int ChatboxCountdown;

internal static void SetChatboxMessage(string message, int interval = 5000) {
ChatboxInterval = Math.Max(interval, 3000);
if (message.Length > 144) message = message.Substring(0, 144);
ChatboxMessage = message;

ChatboxCountdown = Math.Max(3000 - (ChatboxInterval - ChatboxCountdown), 0);
ChatboxClear = string.IsNullOrEmpty(message);
internal static void SetChatboxMessage(string message, int interval = 5000, bool force = false) {
if (ToNLogContext.CanSendChatbox || force) {
ChatboxInterval = Math.Max(interval, 3000);
if (message.Length > 144) message = message.Substring(0, 144);
ChatboxMessage = message;

ChatboxCountdown = Math.Max(3000 - (ChatboxInterval - ChatboxCountdown), 0);
ChatboxClear = string.IsNullOrEmpty(message);
}
}


Expand Down
2 changes: 1 addition & 1 deletion Windows/SettingsWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,7 @@ private void btnOpenData_Click(object sender, EventArgs e) {

private void checkSendChatbox_CheckedChanged(object? sender, EventArgs e) {
if (checkSendChatbox.Checked) StatsWindow.UpdateChatboxContent();
else LilOSC.SetChatboxMessage(string.Empty);
else LilOSC.SetChatboxMessage(string.Empty, force: true);
}

private void linkEditChatbox_Click(object sender, LinkLabelLinkClickedEventArgs e) {
Expand Down

0 comments on commit 68378ce

Please sign in to comment.