Enchantment level support for multisells.
This commit is contained in:
parent
bf7b56f0ba
commit
1289171727
@ -37,7 +37,9 @@ TAGS:
|
||||
<list></list> : start and end the list
|
||||
<item></item> : start and end a single entry within the list
|
||||
<production id="itemID" count="amount"/> : add a product for the entry
|
||||
<ingredient id="ItemID" count="amount"/> : add an ingredient for the entry.
|
||||
<ingredient id="ItemID" count="amount"/> : add an ingredient for the entry
|
||||
enchantmentLevel : add item enchantment level
|
||||
|
||||
|
||||
Sample:
|
||||
<list applyTaxes="true">
|
||||
@ -48,7 +50,7 @@ Sample:
|
||||
<ingredient id="57" count="200">
|
||||
</item>
|
||||
<item>
|
||||
<production id="123" count="1">
|
||||
<production id="123" enchantmentLevel="16" count="1">
|
||||
<ingredient id="57" count="2030">
|
||||
</item>
|
||||
</list>
|
2
trunk/dist/game/data/xsd/multisell.xsd
vendored
2
trunk/dist/game/data/xsd/multisell.xsd
vendored
@ -23,6 +23,7 @@
|
||||
<xs:element name="ingredient" minOccurs="1" maxOccurs="unbounded">
|
||||
<xs:complexType>
|
||||
<xs:attribute name="id" type="xs:integer" use="required" />
|
||||
<xs:attribute name="enchantmentLevel" type="xs:integer" />
|
||||
<xs:attribute name="count" type="xs:positiveInteger" use="required" />
|
||||
<xs:attribute name="maintainIngredient" type="xs:boolean" />
|
||||
</xs:complexType>
|
||||
@ -30,6 +31,7 @@
|
||||
<xs:element name="production" minOccurs="1" maxOccurs="unbounded">
|
||||
<xs:complexType>
|
||||
<xs:attribute name="id" type="xs:integer" use="required" />
|
||||
<xs:attribute name="enchantmentLevel" type="xs:integer" />
|
||||
<xs:attribute name="count" type="xs:positiveInteger" use="required" />
|
||||
<xs:attribute name="chance" type="xs:integer" use="optional" />
|
||||
</xs:complexType>
|
||||
|
@ -32,6 +32,7 @@ public class Ingredient
|
||||
{
|
||||
private int _itemId;
|
||||
private long _itemCount;
|
||||
private final int _enchantmentLevel;
|
||||
private boolean _isTaxIngredient;
|
||||
private boolean _maintainIngredient;
|
||||
private L2Item _template = null;
|
||||
@ -40,13 +41,14 @@ public class Ingredient
|
||||
|
||||
public Ingredient(StatsSet set)
|
||||
{
|
||||
this(set.getInt("id"), set.getLong("count"), set.getInt("chance", 0), set.getBoolean("isTaxIngredient", false), set.getBoolean("maintainIngredient", false));
|
||||
this(set.getInt("id"), set.getLong("count"), set.getInt("enchantmentLevel", 0), set.getInt("chance", 0), set.getBoolean("isTaxIngredient", false), set.getBoolean("maintainIngredient", false));
|
||||
}
|
||||
|
||||
public Ingredient(int itemId, long itemCount, int chance, boolean isTaxIngredient, boolean maintainIngredient)
|
||||
public Ingredient(int itemId, long itemCount, int enchantmentLevel, int chance, boolean isTaxIngredient, boolean maintainIngredient)
|
||||
{
|
||||
_itemId = itemId;
|
||||
_itemCount = itemCount;
|
||||
_enchantmentLevel = enchantmentLevel;
|
||||
_chance = chance;
|
||||
_isTaxIngredient = isTaxIngredient;
|
||||
_maintainIngredient = maintainIngredient;
|
||||
@ -61,7 +63,7 @@ public class Ingredient
|
||||
*/
|
||||
public Ingredient getCopy()
|
||||
{
|
||||
return new Ingredient(_itemId, _itemCount, _chance, _isTaxIngredient, _maintainIngredient);
|
||||
return new Ingredient(_itemId, _itemCount, _enchantmentLevel, _chance, _isTaxIngredient, _maintainIngredient);
|
||||
}
|
||||
|
||||
public final L2Item getTemplate()
|
||||
@ -86,7 +88,7 @@ public class Ingredient
|
||||
|
||||
public final int getEnchantLevel()
|
||||
{
|
||||
return _itemInfo != null ? _itemInfo.getEnchantLevel() : 0;
|
||||
return _itemInfo == null ? _enchantmentLevel : _itemInfo.getEnchantLevel();
|
||||
}
|
||||
|
||||
public final void setItemId(int itemId)
|
||||
|
@ -81,7 +81,7 @@ public class PreparedEntry extends Entry
|
||||
adenaAmount += _taxAmount; // do not forget tax
|
||||
if (adenaAmount > 0)
|
||||
{
|
||||
_ingredients.add(new Ingredient(ADENA_ID, adenaAmount, 0, false, false));
|
||||
_ingredients.add(new Ingredient(ADENA_ID, adenaAmount, 0, 0, false, false));
|
||||
}
|
||||
|
||||
// now copy products
|
||||
|
@ -205,7 +205,7 @@ public class MultiSellChoose extends L2GameClientPacket
|
||||
// if this is not a list that maintains enchantment, check the count of all items that have the given id.
|
||||
// otherwise, check only the count of items with exactly the needed enchantment level
|
||||
final long required = ((Config.ALT_BLACKSMITH_USE_RECIPES || !e.getMaintainIngredient()) ? (e.getItemCount() * _amount) : e.getItemCount());
|
||||
if (inv.getInventoryItemCount(e.getItemId(), list.getMaintainEnchantment() ? e.getEnchantLevel() : -1, false) < required)
|
||||
if (inv.getInventoryItemCount(e.getItemId(), (list.getMaintainEnchantment() || (e.getEnchantLevel() > 0)) ? e.getEnchantLevel() : -1, false) < required)
|
||||
{
|
||||
SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.YOU_NEED_S2_S1_S);
|
||||
sm.addItemName(e.getTemplate());
|
||||
@ -267,7 +267,7 @@ public class MultiSellChoose extends L2GameClientPacket
|
||||
// b) list does not maintain enchantment: get the instances with the LOWEST enchantment level
|
||||
|
||||
// a) if enchantment is maintained, then get a list of items that exactly match this enchantment
|
||||
if (list.getMaintainEnchantment())
|
||||
if (list.getMaintainEnchantment() || (e.getEnchantLevel() > 0))
|
||||
{
|
||||
// loop through this list and remove (one by one) each item until the required amount is taken.
|
||||
L2ItemInstance[] inventoryContents = inv.getAllItemsByItemId(e.getItemId(), e.getEnchantLevel(), false);
|
||||
@ -400,7 +400,7 @@ public class MultiSellChoose extends L2GameClientPacket
|
||||
for (int i = 0; i < (e.getItemCount() * _amount); i++)
|
||||
{
|
||||
product = inv.addItem("Multisell", e.getItemId(), 1, player, player.getTarget());
|
||||
if ((product != null) && list.getMaintainEnchantment())
|
||||
if ((product != null) && (list.getMaintainEnchantment() || (e.getEnchantLevel() > 0)))
|
||||
{
|
||||
if (i < augmentation.size())
|
||||
{
|
||||
|
@ -110,7 +110,7 @@ public final class MultiSellList extends L2GameServerPacket
|
||||
}
|
||||
else
|
||||
{
|
||||
writeH(0x00); // enchant level
|
||||
writeH(ing.getEnchantLevel()); // enchant level
|
||||
writeD(ing.getChance()); // augment id
|
||||
writeD(0x00); // mana
|
||||
writeD(0x00); // time ?
|
||||
@ -146,7 +146,7 @@ public final class MultiSellList extends L2GameServerPacket
|
||||
}
|
||||
else
|
||||
{
|
||||
writeH(0x00); // enchant level
|
||||
writeH(ing.getEnchantLevel()); // enchant level
|
||||
writeD(ing.getChance()); // augment id
|
||||
writeD(0x00); // mana
|
||||
writeH(0x00); // attack element
|
||||
|
Loading…
Reference in New Issue
Block a user