cache: correctly link bought & placeholder items
this was causing bought items (bounds, league cabbages) to render incorrectly
This commit is contained in:
@@ -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<ItemDefinition> getItems()
|
public Collection<ItemDefinition> getItems()
|
||||||
{
|
{
|
||||||
return Collections.unmodifiableCollection(items.values());
|
return Collections.unmodifiableCollection(items.values());
|
||||||
|
|||||||
@@ -64,15 +64,9 @@ public class ItemDefinition
|
|||||||
public int[] countCo;
|
public int[] countCo;
|
||||||
public int[] countObj;
|
public int[] countObj;
|
||||||
|
|
||||||
public String[] options = new String[]
|
public String[] options = new String[]{null, null, "Take", null, null};
|
||||||
{
|
|
||||||
null, null, "Take", null, null
|
|
||||||
};
|
|
||||||
|
|
||||||
public String[] interfaceOptions = new String[]
|
public String[] interfaceOptions = new String[]{null, null, null, null, "Drop"};
|
||||||
{
|
|
||||||
null, null, null, null, "Drop"
|
|
||||||
};
|
|
||||||
|
|
||||||
public int maleModel0 = -1;
|
public int maleModel0 = -1;
|
||||||
public int maleModel1 = -1;
|
public int maleModel1 = -1;
|
||||||
@@ -105,7 +99,7 @@ public class ItemDefinition
|
|||||||
|
|
||||||
public Map<Integer, Object> params = null;
|
public Map<Integer, Object> params = null;
|
||||||
|
|
||||||
public void updateNote(ItemDefinition notedItem, ItemDefinition unnotedItem)
|
public void linkNote(ItemDefinition notedItem, ItemDefinition unnotedItem)
|
||||||
{
|
{
|
||||||
this.inventoryModel = notedItem.inventoryModel;
|
this.inventoryModel = notedItem.inventoryModel;
|
||||||
this.zoom2d = notedItem.zoom2d;
|
this.zoom2d = notedItem.zoom2d;
|
||||||
@@ -123,4 +117,65 @@ public class ItemDefinition
|
|||||||
this.cost = unnotedItem.cost;
|
this.cost = unnotedItem.cost;
|
||||||
this.stackable = 1;
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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);
|
Model itemModel = getModel(modelProvider, item);
|
||||||
if (itemModel == null)
|
if (itemModel == null)
|
||||||
{
|
{
|
||||||
@@ -96,7 +91,7 @@ public class ItemSpriteFactory
|
|||||||
else if (item.boughtTemplateId != -1)
|
else if (item.boughtTemplateId != -1)
|
||||||
{
|
{
|
||||||
auxSpritePixels = createSpritePixels(itemProvider, modelProvider, spriteProvider, textureProvider,
|
auxSpritePixels = createSpritePixels(itemProvider, modelProvider, spriteProvider, textureProvider,
|
||||||
item.boughtId, quantity, border, shadowColor, false);
|
item.boughtId, quantity, border, 0, false);
|
||||||
if (auxSpritePixels == null)
|
if (auxSpritePixels == null)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -67,6 +67,7 @@ public class ItemSpriteFactoryTest
|
|||||||
|
|
||||||
ItemManager itemManager = new ItemManager(store);
|
ItemManager itemManager = new ItemManager(store);
|
||||||
itemManager.load();
|
itemManager.load();
|
||||||
|
itemManager.link();
|
||||||
|
|
||||||
ModelProvider modelProvider = new ModelProvider()
|
ModelProvider modelProvider = new ModelProvider()
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user