diff --git a/cache/src/main/java/net/runelite/cache/ItemManager.java b/cache/src/main/java/net/runelite/cache/ItemManager.java index bff27593d6..8e05bc80eb 100644 --- a/cache/src/main/java/net/runelite/cache/ItemManager.java +++ b/cache/src/main/java/net/runelite/cache/ItemManager.java @@ -70,6 +70,30 @@ public class ItemManager implements ItemProvider } } + public void link() + { + for (ItemDefinition oc : items.values()) + { + link(oc); + } + } + + private void link(ItemDefinition item) + { + if (item.notedTemplate != -1) + { + item.linkNote(getItem(item.notedTemplate), getItem(item.notedID)); + } + if (item.boughtTemplateId != -1) + { + item.linkBought(getItem(item.boughtTemplateId), getItem(item.boughtId)); + } + if (item.placeholderTemplateId != -1) + { + item.linkPlaceholder(getItem(item.placeholderTemplateId), getItem(item.placeholderId)); + } + } + public Collection getItems() { return Collections.unmodifiableCollection(items.values()); diff --git a/cache/src/main/java/net/runelite/cache/definitions/ItemDefinition.java b/cache/src/main/java/net/runelite/cache/definitions/ItemDefinition.java index f918da5a54..ebd97409a0 100644 --- a/cache/src/main/java/net/runelite/cache/definitions/ItemDefinition.java +++ b/cache/src/main/java/net/runelite/cache/definitions/ItemDefinition.java @@ -60,19 +60,13 @@ public class ItemDefinition public int ambient; public int contrast; - + public int[] countCo; public int[] countObj; - public String[] options = new String[] - { - null, null, "Take", null, null - }; - - public String[] interfaceOptions = new String[] - { - null, null, null, null, "Drop" - }; + public String[] options = new String[]{null, null, "Take", null, null}; + + public String[] interfaceOptions = new String[]{null, null, null, null, "Drop"}; public int maleModel0 = -1; public int maleModel1 = -1; @@ -87,7 +81,7 @@ public class ItemDefinition public int femaleOffset; public int femaleHeadModel = -1; public int femaleHeadModel2 = -1; - + public int category; public int notedID = -1; @@ -99,13 +93,13 @@ public class ItemDefinition public int boughtId = -1; public int boughtTemplateId = -1; - + public int placeholderId = -1; public int placeholderTemplateId = -1; public Map params = null; - public void updateNote(ItemDefinition notedItem, ItemDefinition unnotedItem) + public void linkNote(ItemDefinition notedItem, ItemDefinition unnotedItem) { this.inventoryModel = notedItem.inventoryModel; this.zoom2d = notedItem.zoom2d; @@ -123,4 +117,65 @@ public class ItemDefinition this.cost = unnotedItem.cost; this.stackable = 1; } + + public void linkBought(ItemDefinition var1, ItemDefinition var2) + { + this.inventoryModel = var1.inventoryModel; + this.zoom2d = var1.zoom2d; + this.xan2d = var1.xan2d; + this.yan2d = var1.yan2d; + this.zan2d = var1.zan2d; + this.xOffset2d = var1.xOffset2d; + this.yOffset2d = var1.yOffset2d; + this.colorFind = var2.colorFind; + this.colorReplace = var2.colorReplace; + this.textureFind = var2.textureFind; + this.textureReplace = var2.textureReplace; + this.name = var2.name; + this.members = var2.members; + this.stackable = var2.stackable; + this.maleModel0 = var2.maleModel0; + this.maleModel1 = var2.maleModel1; + this.maleModel2 = var2.maleModel2; + this.femaleModel0 = var2.femaleModel0; + this.femaleModel1 = var2.femaleModel1; + this.femaleModel2 = var2.femaleModel2; + this.maleHeadModel = var2.maleHeadModel; + this.maleHeadModel2 = var2.maleHeadModel2; + this.femaleHeadModel = var2.femaleHeadModel; + this.femaleHeadModel2 = var2.femaleHeadModel2; + this.team = var2.team; + this.options = var2.options; + this.interfaceOptions = new String[5]; + if (var2.interfaceOptions != null) + { + for (int var3 = 0; var3 < 4; ++var3) + { + this.interfaceOptions[var3] = var2.interfaceOptions[var3]; + } + } + + this.interfaceOptions[4] = "Discard"; + this.cost = 0; + } + + public void linkPlaceholder(ItemDefinition var1, ItemDefinition var2) + { + this.inventoryModel = var1.inventoryModel; + this.zoom2d = var1.zoom2d; + this.xan2d = var1.xan2d; + this.yan2d = var1.yan2d; + this.zan2d = var1.zan2d; + this.xOffset2d = var1.xOffset2d; + this.yOffset2d = var1.yOffset2d; + this.colorFind = var1.colorFind; + this.colorReplace = var1.colorReplace; + this.textureFind = var1.textureFind; + this.textureReplace = var1.textureReplace; + this.stackable = var1.stackable; + this.name = var2.name; + this.cost = 0; + this.members = false; + this.isTradeable = false; + } } diff --git a/cache/src/main/java/net/runelite/cache/item/ItemSpriteFactory.java b/cache/src/main/java/net/runelite/cache/item/ItemSpriteFactory.java index cd70e9b218..6768f69f70 100644 --- a/cache/src/main/java/net/runelite/cache/item/ItemSpriteFactory.java +++ b/cache/src/main/java/net/runelite/cache/item/ItemSpriteFactory.java @@ -72,11 +72,6 @@ public class ItemSpriteFactory } } - if (item.notedTemplate != -1) - { - item.updateNote(itemProvider.provide(item.notedTemplate), itemProvider.provide(item.notedID)); - } - Model itemModel = getModel(modelProvider, item); if (itemModel == null) { @@ -96,7 +91,7 @@ public class ItemSpriteFactory else if (item.boughtTemplateId != -1) { auxSpritePixels = createSpritePixels(itemProvider, modelProvider, spriteProvider, textureProvider, - item.boughtId, quantity, border, shadowColor, false); + item.boughtId, quantity, border, 0, false); if (auxSpritePixels == null) { return null; diff --git a/cache/src/test/java/net/runelite/cache/item/ItemSpriteFactoryTest.java b/cache/src/test/java/net/runelite/cache/item/ItemSpriteFactoryTest.java index 30fb140a1b..86140bf4e8 100644 --- a/cache/src/test/java/net/runelite/cache/item/ItemSpriteFactoryTest.java +++ b/cache/src/test/java/net/runelite/cache/item/ItemSpriteFactoryTest.java @@ -67,6 +67,7 @@ public class ItemSpriteFactoryTest ItemManager itemManager = new ItemManager(store); itemManager.load(); + itemManager.link(); ModelProvider modelProvider = new ModelProvider() {