Skip to content

Commit

Permalink
Merge pull request #1 from EmerycP/feature/v1.1.1
Browse files Browse the repository at this point in the history
v1.1.1
  • Loading branch information
emerycp authored Mar 9, 2023
2 parents 28ad4ac + 55cf6e9 commit 6e63214
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 20 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# ![icon](https://user-images.githubusercontent.com/38258431/223797326-aa318a83-6882-48ee-9c40-ea0e012ce98f.png) Loot Console Logger
A simple plugin that logs your loot drops in your OSRS's message box.
# ![icon](https://user-images.githubusercontent.com/38258431/223797326-aa318a83-6882-48ee-9c40-ea0e012ce98f.png) Loot Console Logger ![image](https://img.shields.io/github/v/release/emerycp/loot-console-logger?include_prereleases&logo=github)
A simple plugin that logs your loot drop in your OSRS's message box.

Useful when you have limited screen space from playing with multiple accounts
or when you just want to see the loot logged in your message box.

## Features
- Log drops in the message box
- Ability to ignore items from drop
- Ability to ignore monsters drop
- Ability to ignore items from drops
- Ability to ignore monsters drops
- Highlight set items
- Customizable loot highlight message

Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ dependencies {
}

group = 'org.emerycp.lootconsolelogger'
version = '1.1'
version = '1.1.1'
sourceCompatibility = '1.8'

tasks.withType(JavaCompile) {
Expand Down
2 changes: 1 addition & 1 deletion runelite-plugin.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
displayName=Loot Console Logger
author=EmerycP
support=
description=Let you log loot drops in your message box.
description=Let you log loot drop in your message box.
tags=tracker, notification, text, console, loot, message box, log, logger
plugins=org.emerycp.LootLogger
19 changes: 12 additions & 7 deletions src/main/java/org/emerycp/LootLogger.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,15 @@ public void onLootReceived(LootReceived event)
highlightStack = "";
mobKilled = event.getName();

String[] ignoreList = config.getIgnoreList().toLowerCase().replaceAll("\\s", "").split(",");
String[] ignoreMonsterList = config.getIgnoreMonster().toLowerCase().replaceAll("\\s", "").split(",");
String[] highlightList = config.getHighlightList().toLowerCase().replaceAll("\\s", "").split(",");
// Configs
String[] ignoreList = format(config.getIgnoreList()).split(",");
String[] ignoreMonsterList = format(config.getIgnoreMonster()).split(",");
String[] highlightList = format(config.getHighlightList()).split(",");

Collection<ItemStack> iS = event.getItems();
for (ItemStack i: iS) {
final String currentName = client.getItemDefinition(i.getId()).getName();
final String cleanCurrentName = currentName.toLowerCase().replaceAll("\\s", "");
final String cleanCurrentName = format(currentName);

// Drop
if(config.dropEnabled() && !find(ignoreList, cleanCurrentName))
Expand All @@ -70,9 +72,7 @@ public void onLootReceived(LootReceived event)
}
}

if(config.dropEnabled() &&
!find(ignoreMonsterList, mobKilled.toLowerCase().replaceAll("\\s", "")) &&
!itemStack.isEmpty())
if(config.dropEnabled() && !find(ignoreMonsterList, format(mobKilled)) && !itemStack.isEmpty())
{
itemStack += ".";
sendMessage();
Expand Down Expand Up @@ -115,6 +115,11 @@ public boolean find(String[] st, String s) {
return false;
}

public String format(String toFormat)
{
return toFormat.toLowerCase().replaceAll("\\s", "");
}

@Provides
LootLoggerConfig provideConfig(ConfigManager configManager)
{
Expand Down
38 changes: 31 additions & 7 deletions src/main/java/org/emerycp/LootLoggerConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,34 @@
import net.runelite.client.config.Config;
import net.runelite.client.config.ConfigGroup;
import net.runelite.client.config.ConfigItem;
import net.runelite.client.config.ConfigSection;

import java.awt.*;

@ConfigGroup("LootConsoleLogger")
public interface LootLoggerConfig extends Config
{
@ConfigSection(
name = "Loot Drop Log",
description = "All options that log loot drop in your message box.",
position = 0,
closedByDefault = false
)
String dropSection = "drop";

@ConfigSection(
name = "Highlight Drop Console Log",
description = "All options that highlight loot drop in your message box.",
position = 1,
closedByDefault = false
)
String highlightSection = "highlight";

@ConfigItem(
keyName = "drop-console-log",
name = "Loot Drop Console Log",
description = "Enables loot message on a monster's death.",
name = "Enabled",
description = "Enables loot messages on a monster's death.",
section = dropSection,
position = 0
)
default boolean dropEnabled()
Expand All @@ -25,6 +43,7 @@ default boolean dropEnabled()
keyName = "drop-console-list",
name = "Ignored Items",
description = "Enter the item name separated by a comma. i.e.: Bones, Coins",
section = dropSection,
position = 1
)
default String getIgnoreList()
Expand All @@ -35,6 +54,7 @@ default String getIgnoreList()
keyName = "drop-console-monster-list",
name = "Ignored Monsters",
description = "Enter the monster name separated by a comma. i.e.: Goblin, TzTok-Jad",
section = dropSection,
position = 2
)
default String getIgnoreMonster()
Expand All @@ -44,9 +64,10 @@ default String getIgnoreMonster()

@ConfigItem(
keyName = "highlight-console-log",
name = "Highlight Drop Console Log",
name = "Enabled",
description = "Enables highlighted loot messages on a monster's death.",
position = 3
section = highlightSection,
position = 0
)
default boolean highlightEnabled()
{
Expand All @@ -57,7 +78,8 @@ default boolean highlightEnabled()
keyName = "highlight-console-list",
name = "Highlighted Items",
description = "Enter the item name separated by a comma. i.e.: Dragon spear, Rune arrow",
position = 4
section = highlightSection,
position = 1
)
default String getHighlightList()
{
Expand All @@ -68,7 +90,8 @@ default String getHighlightList()
keyName = "highlight-console-message",
name = "Highlighted Message",
description = "Set the text in front of a highlighted loot message.",
position = 5
section = highlightSection,
position = 2
)
default String getHighlightMessage()
{
Expand All @@ -79,7 +102,8 @@ default String getHighlightMessage()
keyName = "highlight-console-color",
name = "Highlight Color",
description = "Set the color of a highlighted loot message.",
position = 6
section = highlightSection,
position = 3
)
default Color getHighlightColor()
{
Expand Down

0 comments on commit 6e63214

Please sign in to comment.