timers: Remove color matching for teleblock messages
When playing using the resizable viewport and the transparent chatbox, teleblock messages are sent using a different color than when using the standard chatbox. This commit removes that color matching entirely from messages indicating that a teleblock timer has been applied or removed.
This commit is contained in:
@@ -104,12 +104,12 @@ public class TimersPlugin extends Plugin
|
|||||||
private static final String STAMINA_EXPIRED_MESSAGE = "<col=8f4808>Your stamina potion has expired.</col>";
|
private static final String STAMINA_EXPIRED_MESSAGE = "<col=8f4808>Your stamina potion has expired.</col>";
|
||||||
private static final String SUPER_ANTIFIRE_DRINK_MESSAGE = "You drink some of your super antifire potion";
|
private static final String SUPER_ANTIFIRE_DRINK_MESSAGE = "You drink some of your super antifire potion";
|
||||||
private static final String SUPER_ANTIFIRE_EXPIRED_MESSAGE = "<col=7f007f>Your super antifire potion has expired.</col>";
|
private static final String SUPER_ANTIFIRE_EXPIRED_MESSAGE = "<col=7f007f>Your super antifire potion has expired.</col>";
|
||||||
private static final String KILLED_TELEBLOCK_OPPONENT_TEXT = "<col=4f006f>Your Tele Block has been removed because you killed ";
|
private static final String KILLED_TELEBLOCK_OPPONENT_TEXT = "Your Tele Block has been removed because you killed ";
|
||||||
private static final String PRAYER_ENHANCE_EXPIRED = "<col=ff0000>Your prayer enhance effect has worn off.</col>";
|
private static final String PRAYER_ENHANCE_EXPIRED = "<col=ff0000>Your prayer enhance effect has worn off.</col>";
|
||||||
|
|
||||||
private static final Pattern DEADMAN_HALF_TELEBLOCK_PATTERN = Pattern.compile("<col=4f006f>A Tele Block spell has been cast on you by (.+)\\. It will expire in 1 minute, 15 seconds\\.</col>");
|
private static final Pattern DEADMAN_HALF_TELEBLOCK_PATTERN = Pattern.compile("A Tele Block spell has been cast on you by (.+)\\. It will expire in 1 minute, 15 seconds\\.</col>");
|
||||||
private static final Pattern FULL_TELEBLOCK_PATTERN = Pattern.compile("<col=4f006f>A Tele Block spell has been cast on you by (.+)\\. It will expire in 5 minutes\\.</col>");
|
private static final Pattern FULL_TELEBLOCK_PATTERN = Pattern.compile("A Tele Block spell has been cast on you by (.+)\\. It will expire in 5 minutes\\.</col>");
|
||||||
private static final Pattern HALF_TELEBLOCK_PATTERN = Pattern.compile("<col=4f006f>A Tele Block spell has been cast on you by (.+)\\. It will expire in 2 minutes, 30 seconds\\.</col>");
|
private static final Pattern HALF_TELEBLOCK_PATTERN = Pattern.compile("A Tele Block spell has been cast on you by (.+)\\. It will expire in 2 minutes, 30 seconds\\.</col>");
|
||||||
private static final Pattern DIVINE_POTION_PATTERN = Pattern.compile("You drink some of your divine (.+) potion\\.");
|
private static final Pattern DIVINE_POTION_PATTERN = Pattern.compile("You drink some of your divine (.+) potion\\.");
|
||||||
private static final int VENOM_VALUE_CUTOFF = -40; // Antivenom < -40 <= Antipoison < 0
|
private static final int VENOM_VALUE_CUTOFF = -40; // Antivenom < -40 <= Antipoison < 0
|
||||||
private static final int POISON_TICK_LENGTH = 30;
|
private static final int POISON_TICK_LENGTH = 30;
|
||||||
@@ -528,7 +528,7 @@ public class TimersPlugin extends Plugin
|
|||||||
{
|
{
|
||||||
createGameTimer(DMM_HALFTB);
|
createGameTimer(DMM_HALFTB);
|
||||||
}
|
}
|
||||||
else if (event.getMessage().startsWith(KILLED_TELEBLOCK_OPPONENT_TEXT))
|
else if (event.getMessage().contains(KILLED_TELEBLOCK_OPPONENT_TEXT))
|
||||||
{
|
{
|
||||||
removeTbTimers();
|
removeTbTimers();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,7 +42,9 @@ import org.junit.Before;
|
|||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
import org.mockito.ArgumentCaptor;
|
import org.mockito.ArgumentCaptor;
|
||||||
|
import static org.mockito.ArgumentMatchers.any;
|
||||||
import org.mockito.Mock;
|
import org.mockito.Mock;
|
||||||
|
import static org.mockito.Mockito.atLeastOnce;
|
||||||
import static org.mockito.Mockito.verify;
|
import static org.mockito.Mockito.verify;
|
||||||
import static org.mockito.Mockito.when;
|
import static org.mockito.Mockito.when;
|
||||||
import org.mockito.junit.MockitoJUnitRunner;
|
import org.mockito.junit.MockitoJUnitRunner;
|
||||||
@@ -53,6 +55,8 @@ public class TimersPluginTest
|
|||||||
private static final String DMM_HALF_TELEBLOCK_MESSAGE = "<col=4f006f>A Tele Block spell has been cast on you by Runelite. It will expire in 1 minute, 15 seconds.</col>";
|
private static final String DMM_HALF_TELEBLOCK_MESSAGE = "<col=4f006f>A Tele Block spell has been cast on you by Runelite. It will expire in 1 minute, 15 seconds.</col>";
|
||||||
private static final String FULL_TELEBLOCK_MESSAGE = "<col=4f006f>A Tele Block spell has been cast on you by Runelite. It will expire in 5 minutes.</col>";
|
private static final String FULL_TELEBLOCK_MESSAGE = "<col=4f006f>A Tele Block spell has been cast on you by Runelite. It will expire in 5 minutes.</col>";
|
||||||
private static final String HALF_TELEBLOCK_MESSAGE = "<col=4f006f>A Tele Block spell has been cast on you by Runelite. It will expire in 2 minutes, 30 seconds.</col>";
|
private static final String HALF_TELEBLOCK_MESSAGE = "<col=4f006f>A Tele Block spell has been cast on you by Runelite. It will expire in 2 minutes, 30 seconds.</col>";
|
||||||
|
private static final String TRANSPARENT_CHATBOX_FULL_TELEBLOCK_MESSAGE = "<col=c356ef>A Tele Block spell has been cast on you by Alexsuperfly. It will expire in 5 minutes.</col>";
|
||||||
|
private static final String TRANSPARENT_CHATBOX_TELEBLOCK_REMOVED_MESSAGE = "<col=c356ef>Your Tele Block has been removed because you killed Alexsuperfly.</col>";
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private TimersPlugin timersPlugin;
|
private TimersPlugin timersPlugin;
|
||||||
@@ -162,4 +166,27 @@ public class TimersPluginTest
|
|||||||
TimerTimer infoBox = (TimerTimer) captor.getValue();
|
TimerTimer infoBox = (TimerTimer) captor.getValue();
|
||||||
assertEquals(GameTimer.DIVINE_BATTLEMAGE, infoBox.getTimer());
|
assertEquals(GameTimer.DIVINE_BATTLEMAGE, infoBox.getTimer());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testTransparentChatboxTb()
|
||||||
|
{
|
||||||
|
when(timersConfig.showTeleblock()).thenReturn(true);
|
||||||
|
ChatMessage chatMessage = new ChatMessage(null, ChatMessageType.SPAM, "", TRANSPARENT_CHATBOX_FULL_TELEBLOCK_MESSAGE, "", 0);
|
||||||
|
timersPlugin.onChatMessage(chatMessage);
|
||||||
|
|
||||||
|
ArgumentCaptor<InfoBox> captor = ArgumentCaptor.forClass(InfoBox.class);
|
||||||
|
verify(infoBoxManager).addInfoBox(captor.capture());
|
||||||
|
TimerTimer infoBox = (TimerTimer) captor.getValue();
|
||||||
|
assertEquals(GameTimer.FULLTB, infoBox.getTimer());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testTransparentChatboxTbRemoved()
|
||||||
|
{
|
||||||
|
when(timersConfig.showTeleblock()).thenReturn(true);
|
||||||
|
ChatMessage chatMessage = new ChatMessage(null, ChatMessageType.SPAM, "", TRANSPARENT_CHATBOX_TELEBLOCK_REMOVED_MESSAGE, "", 0);
|
||||||
|
timersPlugin.onChatMessage(chatMessage);
|
||||||
|
|
||||||
|
verify(infoBoxManager, atLeastOnce()).removeIf(any());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user