Merge pull request #1036 from runelite-extended/scouter-change
playerscouter: Add option to turn off item output to webhook.
This commit is contained in:
@@ -105,6 +105,7 @@ public class PlayerScouter extends Plugin
|
||||
private int minimumRisk;
|
||||
private int minimumValue;
|
||||
private int timeout;
|
||||
private boolean outputItems;
|
||||
|
||||
private static Map<WorldArea, String> getLocationMap()
|
||||
{
|
||||
@@ -165,6 +166,7 @@ public class PlayerScouter extends Plugin
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
updateConfig();
|
||||
}
|
||||
|
||||
@@ -293,7 +295,7 @@ public class PlayerScouter extends Plugin
|
||||
|
||||
if (player.getRisk() > this.minimumRisk)
|
||||
{
|
||||
Utils.scoutPlayer(player, url, DISCORD_CLIENT, itemManager, client, this.minimumValue);
|
||||
Utils.scoutPlayer(player, url, DISCORD_CLIENT, itemManager, client, this.minimumValue, this.outputItems);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -322,6 +324,7 @@ public class PlayerScouter extends Plugin
|
||||
this.overlayEnabled = config.overlayEnabled();
|
||||
this.timeout = config.timeout();
|
||||
this.onlyWildy = config.onlyWildy();
|
||||
this.outputItems = config.outputItems();
|
||||
}
|
||||
|
||||
private boolean checkWildy()
|
||||
|
||||
@@ -56,18 +56,29 @@ public interface PlayerScouterConfig extends Config
|
||||
keyName = "onlyWildy",
|
||||
name = "Only Scout in Wildy",
|
||||
description = "This will only scout players in the wilderness.",
|
||||
position = 1
|
||||
position = 2
|
||||
)
|
||||
default boolean onlyWildy()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "outputItems",
|
||||
name = "Output Items",
|
||||
description = "This will output all of their risked gear to the webhook.",
|
||||
position = 3
|
||||
)
|
||||
default boolean outputItems()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "minimumRisk",
|
||||
name = "Minimum Risk",
|
||||
description = "Minimum risk for the player to be scouted.",
|
||||
position = 2
|
||||
position = 4
|
||||
)
|
||||
default int minimumRisk()
|
||||
{
|
||||
@@ -78,7 +89,7 @@ public interface PlayerScouterConfig extends Config
|
||||
keyName = "minimumValue",
|
||||
name = "Minimum Value",
|
||||
description = "Minimum value for the item to be posted on discord.",
|
||||
position = 3
|
||||
position = 5
|
||||
)
|
||||
default int minimumValue()
|
||||
{
|
||||
@@ -89,7 +100,7 @@ public interface PlayerScouterConfig extends Config
|
||||
keyName = "timeout",
|
||||
name = "Timeout",
|
||||
description = "Minimum amount of ticks before the player can be scouted again. (1 tick = 600ms)",
|
||||
position = 4
|
||||
position = 6
|
||||
)
|
||||
default int timeout()
|
||||
{
|
||||
|
||||
@@ -498,7 +498,7 @@ class Utils
|
||||
return "No Target Detected";
|
||||
}
|
||||
|
||||
static void scoutPlayer(PlayerContainer player, HttpUrl url, DiscordClient discordClient, ItemManager itemManager, Client client, int minimumValue)
|
||||
static void scoutPlayer(PlayerContainer player, HttpUrl url, DiscordClient discordClient, ItemManager itemManager, Client client, int minimumValue, boolean outputItems)
|
||||
{
|
||||
if (player.isScouted())
|
||||
{
|
||||
@@ -571,43 +571,46 @@ class Utils
|
||||
.inline(true)
|
||||
.build());
|
||||
|
||||
fieldList.add(FieldEmbed.builder()
|
||||
.name("Risked Items Sorted by Value")
|
||||
.value("━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━")
|
||||
.build());
|
||||
|
||||
final int[] items = {0};
|
||||
|
||||
player.getRiskedGear().forEach((gear, value) ->
|
||||
{
|
||||
if (value <= 0 || value <= minimumValue)
|
||||
{
|
||||
items[0]++;
|
||||
return;
|
||||
}
|
||||
|
||||
ItemStats item = itemManager.getItemStats(gear, false);
|
||||
|
||||
if (item == null)
|
||||
{
|
||||
log.error("Item is Null: {}", gear);
|
||||
return;
|
||||
}
|
||||
|
||||
fieldList.add(FieldEmbed.builder()
|
||||
.name(item.getName())
|
||||
.value("Value: " + StackFormatter.quantityToRSDecimalStack(value))
|
||||
.inline(true)
|
||||
.build());
|
||||
});
|
||||
|
||||
if (items[0] > 0)
|
||||
if (outputItems)
|
||||
{
|
||||
fieldList.add(FieldEmbed.builder()
|
||||
.name("Items below value: " + minimumValue)
|
||||
.value(Integer.toString(items[0]))
|
||||
.inline(true)
|
||||
.name("Risked Items Sorted by Value")
|
||||
.value("━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━")
|
||||
.build());
|
||||
|
||||
final int[] items = {0};
|
||||
|
||||
player.getRiskedGear().forEach((gear, value) ->
|
||||
{
|
||||
if (value <= 0 || value <= minimumValue)
|
||||
{
|
||||
items[0]++;
|
||||
return;
|
||||
}
|
||||
|
||||
ItemStats item = itemManager.getItemStats(gear, false);
|
||||
|
||||
if (item == null)
|
||||
{
|
||||
log.error("Item is Null: {}", gear);
|
||||
return;
|
||||
}
|
||||
|
||||
fieldList.add(FieldEmbed.builder()
|
||||
.name(item.getName())
|
||||
.value("Value: " + StackFormatter.quantityToRSDecimalStack(value))
|
||||
.inline(true)
|
||||
.build());
|
||||
});
|
||||
|
||||
if (items[0] > 0)
|
||||
{
|
||||
fieldList.add(FieldEmbed.builder()
|
||||
.name("Items below value: " + minimumValue)
|
||||
.value(Integer.toString(items[0]))
|
||||
.inline(true)
|
||||
.build());
|
||||
}
|
||||
}
|
||||
|
||||
message(player.getPlayer().getName(), " ", ICONBASEURL + Objects.requireNonNull(getEntry(player.getGear())).getKey() + ".png", image, fieldList, url, discordClient, color);
|
||||
@@ -695,4 +698,4 @@ class Utils
|
||||
}
|
||||
return s;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user