HighFive multisell enchanted items support.
This commit is contained in:
parent
1db5262d58
commit
cae3f4984f
@ -24,6 +24,7 @@
|
|||||||
<xs:complexType>
|
<xs:complexType>
|
||||||
<xs:attribute name="count" type="xs:positiveInteger" use="required" />
|
<xs:attribute name="count" type="xs:positiveInteger" use="required" />
|
||||||
<xs:attribute name="id" type="xs:integer" use="required" />
|
<xs:attribute name="id" type="xs:integer" use="required" />
|
||||||
|
<xs:attribute name="enchantmentLevel" type="xs:integer" />
|
||||||
<xs:attribute name="maintainIngredient" type="xs:boolean" />
|
<xs:attribute name="maintainIngredient" type="xs:boolean" />
|
||||||
</xs:complexType>
|
</xs:complexType>
|
||||||
</xs:element>
|
</xs:element>
|
||||||
@ -31,6 +32,7 @@
|
|||||||
<xs:complexType>
|
<xs:complexType>
|
||||||
<xs:attribute name="count" type="xs:positiveInteger" use="required" />
|
<xs:attribute name="count" type="xs:positiveInteger" use="required" />
|
||||||
<xs:attribute name="id" type="xs:integer" use="required" />
|
<xs:attribute name="id" type="xs:integer" use="required" />
|
||||||
|
<xs:attribute name="enchantmentLevel" type="xs:integer" />
|
||||||
</xs:complexType>
|
</xs:complexType>
|
||||||
</xs:element>
|
</xs:element>
|
||||||
</xs:sequence>
|
</xs:sequence>
|
||||||
|
@ -30,6 +30,7 @@ public class Ingredient
|
|||||||
{
|
{
|
||||||
private int _itemId;
|
private int _itemId;
|
||||||
private long _itemCount;
|
private long _itemCount;
|
||||||
|
private final int _enchantmentLevel;
|
||||||
private boolean _isTaxIngredient;
|
private boolean _isTaxIngredient;
|
||||||
private boolean _maintainIngredient;
|
private boolean _maintainIngredient;
|
||||||
private L2Item _template = null;
|
private L2Item _template = null;
|
||||||
@ -37,13 +38,14 @@ public class Ingredient
|
|||||||
|
|
||||||
public Ingredient(StatsSet set)
|
public Ingredient(StatsSet set)
|
||||||
{
|
{
|
||||||
this(set.getInt("id"), set.getLong("count"), set.getBoolean("isTaxIngredient", false), set.getBoolean("maintainIngredient", false));
|
this(set.getInt("id"), set.getLong("count"), set.getInt("enchantmentLevel", 0), set.getBoolean("isTaxIngredient", false), set.getBoolean("maintainIngredient", false));
|
||||||
}
|
}
|
||||||
|
|
||||||
public Ingredient(int itemId, long itemCount, boolean isTaxIngredient, boolean maintainIngredient)
|
public Ingredient(int itemId, long itemCount, int enchantmentLevel, boolean isTaxIngredient, boolean maintainIngredient)
|
||||||
{
|
{
|
||||||
_itemId = itemId;
|
_itemId = itemId;
|
||||||
_itemCount = itemCount;
|
_itemCount = itemCount;
|
||||||
|
_enchantmentLevel = enchantmentLevel;
|
||||||
_isTaxIngredient = isTaxIngredient;
|
_isTaxIngredient = isTaxIngredient;
|
||||||
_maintainIngredient = maintainIngredient;
|
_maintainIngredient = maintainIngredient;
|
||||||
if (_itemId > 0)
|
if (_itemId > 0)
|
||||||
@ -57,7 +59,7 @@ public class Ingredient
|
|||||||
*/
|
*/
|
||||||
public Ingredient getCopy()
|
public Ingredient getCopy()
|
||||||
{
|
{
|
||||||
return new Ingredient(_itemId, _itemCount, _isTaxIngredient, _maintainIngredient);
|
return new Ingredient(_itemId, _itemCount, _enchantmentLevel, _isTaxIngredient, _maintainIngredient);
|
||||||
}
|
}
|
||||||
|
|
||||||
public final L2Item getTemplate()
|
public final L2Item getTemplate()
|
||||||
@ -82,7 +84,7 @@ public class Ingredient
|
|||||||
|
|
||||||
public final int getEnchantLevel()
|
public final int getEnchantLevel()
|
||||||
{
|
{
|
||||||
return _itemInfo != null ? _itemInfo.getEnchantLevel() : 0;
|
return _itemInfo == null ? _enchantmentLevel : _itemInfo.getEnchantLevel();
|
||||||
}
|
}
|
||||||
|
|
||||||
public final void setItemId(int itemId)
|
public final void setItemId(int itemId)
|
||||||
|
@ -78,7 +78,7 @@ public class PreparedEntry extends Entry
|
|||||||
adenaAmount += _taxAmount; // do not forget tax
|
adenaAmount += _taxAmount; // do not forget tax
|
||||||
if (adenaAmount > 0)
|
if (adenaAmount > 0)
|
||||||
{
|
{
|
||||||
_ingredients.add(new Ingredient(ADENA_ID, adenaAmount, false, false));
|
_ingredients.add(new Ingredient(ADENA_ID, adenaAmount, 0, false, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
// now copy products
|
// now copy products
|
||||||
|
@ -232,7 +232,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.
|
// 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
|
// 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());
|
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)
|
||||||
{
|
{
|
||||||
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.S2_UNIT_S_OF_THE_ITEM_S1_IS_ARE_REQUIRED);
|
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.S2_UNIT_S_OF_THE_ITEM_S1_IS_ARE_REQUIRED);
|
||||||
sm.addItemName(e.getTemplate());
|
sm.addItemName(e.getTemplate());
|
||||||
@ -291,7 +291,7 @@ public class MultiSellChoose extends L2GameClientPacket
|
|||||||
// b) list does not maintain enchantment: get the instances with the LOWEST enchantment level
|
// 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
|
// 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.
|
// loop through this list and remove (one by one) each item until the required amount is taken.
|
||||||
final L2ItemInstance[] inventoryContents = inv.getAllItemsByItemId(e.getItemId(), e.getEnchantLevel(), false);
|
final L2ItemInstance[] inventoryContents = inv.getAllItemsByItemId(e.getItemId(), e.getEnchantLevel(), false);
|
||||||
@ -404,7 +404,7 @@ public class MultiSellChoose extends L2GameClientPacket
|
|||||||
for (int i = 0; i < (e.getItemCount() * _amount); i++)
|
for (int i = 0; i < (e.getItemCount() * _amount); i++)
|
||||||
{
|
{
|
||||||
product = inv.addItem("Multisell", e.getItemId(), 1, player, player.getTarget());
|
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())
|
if (i < augmentation.size())
|
||||||
{
|
{
|
||||||
|
@ -105,7 +105,7 @@ public final class MultiSellList extends L2GameServerPacket
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
writeH(0x00); // enchant level
|
writeH(ing.getEnchantLevel()); // enchant level
|
||||||
writeD(0x00); // augment id
|
writeD(0x00); // augment id
|
||||||
writeD(0x00); // mana
|
writeD(0x00); // mana
|
||||||
writeH(0x00); // attack element
|
writeH(0x00); // attack element
|
||||||
@ -140,7 +140,7 @@ public final class MultiSellList extends L2GameServerPacket
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
writeH(0x00); // enchant level
|
writeH(ing.getEnchantLevel()); // enchant level
|
||||||
writeD(0x00); // augment id
|
writeD(0x00); // augment id
|
||||||
writeD(0x00); // mana
|
writeD(0x00); // mana
|
||||||
writeH(0x00); // attack element
|
writeH(0x00); // attack element
|
||||||
|
Loading…
Reference in New Issue
Block a user