Merge pull request #1262 from DevDennis/fix-placeholder-bank-tags
Fix search for placeholder bank tags
This commit is contained in:
@@ -58,6 +58,23 @@ public interface ItemComposition
|
|||||||
*/
|
*/
|
||||||
int getLinkedNoteId();
|
int getLinkedNoteId();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the item ID of the normal/placeholder counterpart. For example, if
|
||||||
|
* you call this on a monkfish(ID 7946), this method will
|
||||||
|
* return the ID of a placeholder monkfish(ID 17065), and vice versa.
|
||||||
|
*
|
||||||
|
* @return the ID that is linked to this item in normal/placeholder form.
|
||||||
|
*/
|
||||||
|
int getPlaceholderId();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a result that depends on whether the item is in placeholder form or
|
||||||
|
* not.
|
||||||
|
*
|
||||||
|
* @return 14401 if placeholder, -1 if normal
|
||||||
|
*/
|
||||||
|
int getPlaceholderTemplateId();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the store price of the item. Even if the item cannot be found
|
* Returns the store price of the item. Even if the item cannot be found
|
||||||
* in a store, all items have a store price from which the High and Low
|
* in a store, all items have a store price from which the High and Low
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ import net.runelite.api.Client;
|
|||||||
import net.runelite.api.IntegerNode;
|
import net.runelite.api.IntegerNode;
|
||||||
import net.runelite.api.InventoryID;
|
import net.runelite.api.InventoryID;
|
||||||
import net.runelite.api.Item;
|
import net.runelite.api.Item;
|
||||||
|
import net.runelite.api.ItemComposition;
|
||||||
import net.runelite.api.ItemContainer;
|
import net.runelite.api.ItemContainer;
|
||||||
import net.runelite.api.MenuAction;
|
import net.runelite.api.MenuAction;
|
||||||
import net.runelite.api.events.MenuOptionClicked;
|
import net.runelite.api.events.MenuOptionClicked;
|
||||||
@@ -155,6 +156,13 @@ public class BankTagsPlugin extends Plugin
|
|||||||
String itemName = stringStack[stringStackSize - 2];
|
String itemName = stringStack[stringStackSize - 2];
|
||||||
String searchInput = stringStack[stringStackSize - 1];
|
String searchInput = stringStack[stringStackSize - 1];
|
||||||
|
|
||||||
|
ItemComposition itemComposition = itemManager.getItemComposition(itemId);
|
||||||
|
if (itemComposition.getPlaceholderTemplateId() != -1)
|
||||||
|
{
|
||||||
|
// if the item is a placeholder then get the item id for the normal item
|
||||||
|
itemId = itemComposition.getPlaceholderId();
|
||||||
|
}
|
||||||
|
|
||||||
String tagsConfig = configManager.getConfiguration(CONFIG_GROUP, ITEM_KEY_PREFIX + itemId);
|
String tagsConfig = configManager.getConfiguration(CONFIG_GROUP, ITEM_KEY_PREFIX + itemId);
|
||||||
if (tagsConfig == null || tagsConfig.length() == 0)
|
if (tagsConfig == null || tagsConfig.length() == 0)
|
||||||
{
|
{
|
||||||
@@ -211,8 +219,20 @@ public class BankTagsPlugin extends Plugin
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int itemId = item.getId();
|
ItemComposition itemComposition = itemManager.getItemComposition(item.getId());
|
||||||
String itemName = itemManager.getItemComposition(itemId).getName();
|
int itemId;
|
||||||
|
if (itemComposition.getPlaceholderTemplateId() != -1)
|
||||||
|
{
|
||||||
|
// if the item is a placeholder then get the item id for the normal item
|
||||||
|
itemId = itemComposition.getPlaceholderId();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
itemId = item.getId();
|
||||||
|
}
|
||||||
|
|
||||||
|
String itemName = itemComposition.getName();
|
||||||
|
|
||||||
String initialValue = getTags(itemId);
|
String initialValue = getTags(itemId);
|
||||||
|
|
||||||
chatboxInputManager.openInputWindow(itemName + " Tags", initialValue, (newTags) ->
|
chatboxInputManager.openInputWindow(itemName + " Tags", initialValue, (newTags) ->
|
||||||
@@ -234,7 +254,8 @@ public class BankTagsPlugin extends Plugin
|
|||||||
}
|
}
|
||||||
Widget bankItemWidget = bankItemWidgets[inventoryIndex];
|
Widget bankItemWidget = bankItemWidgets[inventoryIndex];
|
||||||
String[] actions = bankItemWidget.getActions();
|
String[] actions = bankItemWidget.getActions();
|
||||||
if (actions == null || EDIT_TAGS_MENU_INDEX - 1 >= actions.length)
|
if (actions == null || EDIT_TAGS_MENU_INDEX - 1 >= actions.length
|
||||||
|
|| itemId != bankItemWidget.getItemId())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,6 +50,14 @@ public interface RSItemComposition extends ItemComposition
|
|||||||
@Override
|
@Override
|
||||||
int getLinkedNoteId();
|
int getLinkedNoteId();
|
||||||
|
|
||||||
|
@Import("placeholderId")
|
||||||
|
@Override
|
||||||
|
int getPlaceholderId();
|
||||||
|
|
||||||
|
@Import("placeholderTemplateId")
|
||||||
|
@Override
|
||||||
|
int getPlaceholderTemplateId();
|
||||||
|
|
||||||
@Import("price")
|
@Import("price")
|
||||||
@Override
|
@Override
|
||||||
int getPrice();
|
int getPrice();
|
||||||
|
|||||||
Reference in New Issue
Block a user