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 minimumRisk;
|
||||||
private int minimumValue;
|
private int minimumValue;
|
||||||
private int timeout;
|
private int timeout;
|
||||||
|
private boolean outputItems;
|
||||||
|
|
||||||
private static Map<WorldArea, String> getLocationMap()
|
private static Map<WorldArea, String> getLocationMap()
|
||||||
{
|
{
|
||||||
@@ -165,6 +166,7 @@ public class PlayerScouter extends Plugin
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
updateConfig();
|
updateConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -293,7 +295,7 @@ public class PlayerScouter extends Plugin
|
|||||||
|
|
||||||
if (player.getRisk() > this.minimumRisk)
|
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.overlayEnabled = config.overlayEnabled();
|
||||||
this.timeout = config.timeout();
|
this.timeout = config.timeout();
|
||||||
this.onlyWildy = config.onlyWildy();
|
this.onlyWildy = config.onlyWildy();
|
||||||
|
this.outputItems = config.outputItems();
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean checkWildy()
|
private boolean checkWildy()
|
||||||
|
|||||||
@@ -56,18 +56,29 @@ public interface PlayerScouterConfig extends Config
|
|||||||
keyName = "onlyWildy",
|
keyName = "onlyWildy",
|
||||||
name = "Only Scout in Wildy",
|
name = "Only Scout in Wildy",
|
||||||
description = "This will only scout players in the wilderness.",
|
description = "This will only scout players in the wilderness.",
|
||||||
position = 1
|
position = 2
|
||||||
)
|
)
|
||||||
default boolean onlyWildy()
|
default boolean onlyWildy()
|
||||||
{
|
{
|
||||||
return true;
|
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(
|
@ConfigItem(
|
||||||
keyName = "minimumRisk",
|
keyName = "minimumRisk",
|
||||||
name = "Minimum Risk",
|
name = "Minimum Risk",
|
||||||
description = "Minimum risk for the player to be scouted.",
|
description = "Minimum risk for the player to be scouted.",
|
||||||
position = 2
|
position = 4
|
||||||
)
|
)
|
||||||
default int minimumRisk()
|
default int minimumRisk()
|
||||||
{
|
{
|
||||||
@@ -78,7 +89,7 @@ public interface PlayerScouterConfig extends Config
|
|||||||
keyName = "minimumValue",
|
keyName = "minimumValue",
|
||||||
name = "Minimum Value",
|
name = "Minimum Value",
|
||||||
description = "Minimum value for the item to be posted on discord.",
|
description = "Minimum value for the item to be posted on discord.",
|
||||||
position = 3
|
position = 5
|
||||||
)
|
)
|
||||||
default int minimumValue()
|
default int minimumValue()
|
||||||
{
|
{
|
||||||
@@ -89,7 +100,7 @@ public interface PlayerScouterConfig extends Config
|
|||||||
keyName = "timeout",
|
keyName = "timeout",
|
||||||
name = "Timeout",
|
name = "Timeout",
|
||||||
description = "Minimum amount of ticks before the player can be scouted again. (1 tick = 600ms)",
|
description = "Minimum amount of ticks before the player can be scouted again. (1 tick = 600ms)",
|
||||||
position = 4
|
position = 6
|
||||||
)
|
)
|
||||||
default int timeout()
|
default int timeout()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -498,7 +498,7 @@ class Utils
|
|||||||
return "No Target Detected";
|
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())
|
if (player.isScouted())
|
||||||
{
|
{
|
||||||
@@ -571,43 +571,46 @@ class Utils
|
|||||||
.inline(true)
|
.inline(true)
|
||||||
.build());
|
.build());
|
||||||
|
|
||||||
fieldList.add(FieldEmbed.builder()
|
if (outputItems)
|
||||||
.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()
|
fieldList.add(FieldEmbed.builder()
|
||||||
.name("Items below value: " + minimumValue)
|
.name("Risked Items Sorted by Value")
|
||||||
.value(Integer.toString(items[0]))
|
.value("━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━")
|
||||||
.inline(true)
|
|
||||||
.build());
|
.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);
|
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;
|
return s;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user