Use loot received event for pvp kill screenshots (#6920)
This commit is contained in:
@@ -59,6 +59,7 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
import net.runelite.api.ChatMessageType;
|
import net.runelite.api.ChatMessageType;
|
||||||
import net.runelite.api.Client;
|
import net.runelite.api.Client;
|
||||||
import net.runelite.api.GameState;
|
import net.runelite.api.GameState;
|
||||||
|
import net.runelite.api.Player;
|
||||||
import net.runelite.api.Point;
|
import net.runelite.api.Point;
|
||||||
import net.runelite.api.SpriteID;
|
import net.runelite.api.SpriteID;
|
||||||
import net.runelite.api.WorldType;
|
import net.runelite.api.WorldType;
|
||||||
@@ -81,6 +82,7 @@ import net.runelite.client.Notifier;
|
|||||||
import static net.runelite.client.RuneLite.SCREENSHOT_DIR;
|
import static net.runelite.client.RuneLite.SCREENSHOT_DIR;
|
||||||
import net.runelite.client.config.ConfigManager;
|
import net.runelite.client.config.ConfigManager;
|
||||||
import net.runelite.client.eventbus.Subscribe;
|
import net.runelite.client.eventbus.Subscribe;
|
||||||
|
import net.runelite.client.events.PlayerLootReceived;
|
||||||
import net.runelite.client.game.SpriteManager;
|
import net.runelite.client.game.SpriteManager;
|
||||||
import net.runelite.client.input.KeyManager;
|
import net.runelite.client.input.KeyManager;
|
||||||
import net.runelite.client.plugins.Plugin;
|
import net.runelite.client.plugins.Plugin;
|
||||||
@@ -128,11 +130,6 @@ public class ScreenshotPlugin extends Plugin
|
|||||||
"You feel something weird sneaking into your backpack",
|
"You feel something weird sneaking into your backpack",
|
||||||
"You have a funny feeling like you would have been followed");
|
"You have a funny feeling like you would have been followed");
|
||||||
|
|
||||||
private static final ImmutableList<String> KILL_MESSAGES = ImmutableList.of("into tiny pieces and sat on them", "you have obliterated",
|
|
||||||
"falls before your might", "A humiliating defeat for", "With a crushing blow you", "thinking challenging you",
|
|
||||||
"Can anyone defeat you? Certainly", "was no match for you", "You were clearly a better fighter than", "RIP",
|
|
||||||
"You have defeated", "What an embarrassing performance by", "was no match for your awesomeness");
|
|
||||||
|
|
||||||
static String format(Date date)
|
static String format(Date date)
|
||||||
{
|
{
|
||||||
synchronized (TIME_FORMAT)
|
synchronized (TIME_FORMAT)
|
||||||
@@ -297,6 +294,18 @@ public class ScreenshotPlugin extends Plugin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Subscribe
|
||||||
|
public void onPlayerLootReceived(final PlayerLootReceived playerLootReceived)
|
||||||
|
{
|
||||||
|
if (config.screenshotKills())
|
||||||
|
{
|
||||||
|
final Player player = playerLootReceived.getPlayer();
|
||||||
|
final String name = player.getName();
|
||||||
|
String fileName = "Kill " + name + " " + format(new Date());
|
||||||
|
takeScreenshot(fileName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void onChatMessage(ChatMessage event)
|
public void onChatMessage(ChatMessage event)
|
||||||
{
|
{
|
||||||
@@ -354,12 +363,6 @@ public class ScreenshotPlugin extends Plugin
|
|||||||
takeScreenshot(fileName);
|
takeScreenshot(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config.screenshotKills() && KILL_MESSAGES.stream().anyMatch(chatMessage::contains))
|
|
||||||
{
|
|
||||||
String fileName = "Kill " + format(new Date());
|
|
||||||
takeScreenshot(fileName);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (config.screenshotBossKills() )
|
if (config.screenshotBossKills() )
|
||||||
{
|
{
|
||||||
Matcher m = BOSSKILL_MESSAGE_PATTERN.matcher(chatMessage);
|
Matcher m = BOSSKILL_MESSAGE_PATTERN.matcher(chatMessage);
|
||||||
|
|||||||
Reference in New Issue
Block a user