Implemented new combination item data values.
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -14,8 +14,10 @@
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
<xs:attribute type="xs:int" name="one" use="required" />
|
||||
<xs:attribute type="xs:byte" name="enchant" use="optional" />
|
||||
<xs:attribute type="xs:int" name="two" use="required" />
|
||||
<xs:attribute type="xs:byte" name="chance" use="required" />
|
||||
<xs:attribute type="xs:long" name="commission" use="optional" />
|
||||
<xs:attribute type="xs:byte" name="chance" use="optional" />
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
|
@@ -83,11 +83,11 @@ public class CombinationItemsData implements IXmlReader
|
||||
return _items;
|
||||
}
|
||||
|
||||
public CombinationItem getItemsBySlots(int firstSlot, int secondSlot)
|
||||
public CombinationItem getItemsBySlots(int firstSlot, int enchant, int secondSlot)
|
||||
{
|
||||
for (CombinationItem item : _items)
|
||||
{
|
||||
if ((item.getItemOne() == firstSlot) && (item.getItemTwo() == secondSlot))
|
||||
if ((item.getItemOne() == firstSlot) && (item.getItemTwo() == secondSlot) && (item.getEnchant() == enchant))
|
||||
{
|
||||
return item;
|
||||
}
|
||||
@@ -95,25 +95,12 @@ public class CombinationItemsData implements IXmlReader
|
||||
return null;
|
||||
}
|
||||
|
||||
public List<CombinationItem> getItemsByFirstSlot(int id)
|
||||
public List<CombinationItem> getItemsByFirstSlot(int id, int enchant)
|
||||
{
|
||||
final List<CombinationItem> result = new ArrayList<>();
|
||||
for (CombinationItem item : _items)
|
||||
{
|
||||
if (item.getItemOne() == id)
|
||||
{
|
||||
result.add(item);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public List<CombinationItem> getItemsBySecondSlot(int id)
|
||||
{
|
||||
final List<CombinationItem> result = new ArrayList<>();
|
||||
for (CombinationItem item : _items)
|
||||
{
|
||||
if (item.getItemTwo() == id)
|
||||
if ((item.getItemOne() == id) && (item.getEnchant() == enchant))
|
||||
{
|
||||
result.add(item);
|
||||
}
|
||||
|
@@ -22,20 +22,24 @@ import java.util.Map;
|
||||
import org.l2jmobius.gameserver.model.StatSet;
|
||||
|
||||
/**
|
||||
* @author UnAfraid
|
||||
* @author UnAfraid, Mobius
|
||||
*/
|
||||
public class CombinationItem
|
||||
{
|
||||
private final int _itemOne;
|
||||
private final int _enchant;
|
||||
private final int _itemTwo;
|
||||
private final long _commission;
|
||||
private final int _chance;
|
||||
private final Map<CombinationItemType, CombinationItemReward> _rewards = new EnumMap<>(CombinationItemType.class);
|
||||
|
||||
public CombinationItem(StatSet set)
|
||||
{
|
||||
_itemOne = set.getInt("one");
|
||||
_enchant = set.getInt("enchant", 0);
|
||||
_itemTwo = set.getInt("two");
|
||||
_chance = set.getInt("chance");
|
||||
_commission = set.getLong("commission", 0);
|
||||
_chance = set.getInt("chance", 33);
|
||||
}
|
||||
|
||||
public int getItemOne()
|
||||
@@ -43,11 +47,21 @@ public class CombinationItem
|
||||
return _itemOne;
|
||||
}
|
||||
|
||||
public int getEnchant()
|
||||
{
|
||||
return _enchant;
|
||||
}
|
||||
|
||||
public int getItemTwo()
|
||||
{
|
||||
return _itemTwo;
|
||||
}
|
||||
|
||||
public long getCommission()
|
||||
{
|
||||
return _commission;
|
||||
}
|
||||
|
||||
public int getChance()
|
||||
{
|
||||
return _chance;
|
||||
|
@@ -82,7 +82,7 @@ public class RequestNewEnchantPushOne implements IClientIncomingPacket
|
||||
return;
|
||||
}
|
||||
|
||||
final List<CombinationItem> combinationItems = CombinationItemsData.getInstance().getItemsByFirstSlot(itemOne.getId());
|
||||
final List<CombinationItem> combinationItems = CombinationItemsData.getInstance().getItemsByFirstSlot(itemOne.getId(), itemOne.getEnchantLevel());
|
||||
|
||||
// Not implemented or not able to merge!
|
||||
if (combinationItems.isEmpty())
|
||||
|
@@ -88,7 +88,7 @@ public class RequestNewEnchantPushTwo implements IClientIncomingPacket
|
||||
return;
|
||||
}
|
||||
|
||||
final CombinationItem combinationItem = CombinationItemsData.getInstance().getItemsBySlots(itemOne.getId(), itemTwo.getId());
|
||||
final CombinationItem combinationItem = CombinationItemsData.getInstance().getItemsBySlots(itemOne.getId(), itemOne.getEnchantLevel(), itemTwo.getId());
|
||||
|
||||
// Not implemented or not able to merge!
|
||||
if (combinationItem == null)
|
||||
|
@@ -94,7 +94,7 @@ public class RequestNewEnchantRetryToPutItems implements IClientIncomingPacket
|
||||
return;
|
||||
}
|
||||
|
||||
final CombinationItem combinationItem = CombinationItemsData.getInstance().getItemsBySlots(itemOne.getId(), itemTwo.getId());
|
||||
final CombinationItem combinationItem = CombinationItemsData.getInstance().getItemsBySlots(itemOne.getId(), itemOne.getEnchantLevel(), itemTwo.getId());
|
||||
|
||||
// Not implemented or not able to merge!
|
||||
if (combinationItem == null)
|
||||
|
@@ -91,7 +91,7 @@ public class RequestNewEnchantTry implements IClientIncomingPacket
|
||||
return;
|
||||
}
|
||||
|
||||
final CombinationItem combinationItem = CombinationItemsData.getInstance().getItemsBySlots(itemOne.getId(), itemTwo.getId());
|
||||
final CombinationItem combinationItem = CombinationItemsData.getInstance().getItemsBySlots(itemOne.getId(), itemOne.getEnchantLevel(), itemTwo.getId());
|
||||
|
||||
// Not implemented or not able to merge!
|
||||
if (combinationItem == null)
|
||||
@@ -101,11 +101,19 @@ public class RequestNewEnchantTry implements IClientIncomingPacket
|
||||
return;
|
||||
}
|
||||
|
||||
if (combinationItem.getCommission() > player.getAdena())
|
||||
{
|
||||
client.sendPacket(new ExEnchantFail(itemOne.getId(), itemTwo.getId()));
|
||||
player.removeRequest(request.getClass());
|
||||
player.sendPacket(SystemMessageId.NOT_ENOUGH_ADENA);
|
||||
return;
|
||||
}
|
||||
|
||||
final InventoryUpdate iu = new InventoryUpdate();
|
||||
iu.addRemovedItem(itemOne);
|
||||
// iu.addRemovedItem(itemTwo);
|
||||
|
||||
if (player.destroyItem("Compound-Item-One", itemOne, 1, null, true) && player.destroyItem("Compound-Item-Two", itemTwo, 1, null, true))
|
||||
if (player.destroyItem("Compound-Item-One", itemOne, 1, null, true) && player.destroyItem("Compound-Item-Two", itemTwo, 1, null, true) && ((combinationItem.getCommission() <= 0) || player.reduceAdena("Compound-Commission", combinationItem.getCommission(), player, true)))
|
||||
{
|
||||
final double random = (Rnd.nextDouble() * 100);
|
||||
final boolean success = random <= combinationItem.getChance();
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -14,8 +14,10 @@
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
<xs:attribute type="xs:int" name="one" use="required" />
|
||||
<xs:attribute type="xs:byte" name="enchant" use="optional" />
|
||||
<xs:attribute type="xs:int" name="two" use="required" />
|
||||
<xs:attribute type="xs:byte" name="chance" use="required" />
|
||||
<xs:attribute type="xs:long" name="commission" use="optional" />
|
||||
<xs:attribute type="xs:byte" name="chance" use="optional" />
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
|
@@ -83,11 +83,11 @@ public class CombinationItemsData implements IXmlReader
|
||||
return _items;
|
||||
}
|
||||
|
||||
public CombinationItem getItemsBySlots(int firstSlot, int secondSlot)
|
||||
public CombinationItem getItemsBySlots(int firstSlot, int enchant, int secondSlot)
|
||||
{
|
||||
for (CombinationItem item : _items)
|
||||
{
|
||||
if ((item.getItemOne() == firstSlot) && (item.getItemTwo() == secondSlot))
|
||||
if ((item.getItemOne() == firstSlot) && (item.getItemTwo() == secondSlot) && (item.getEnchant() == enchant))
|
||||
{
|
||||
return item;
|
||||
}
|
||||
@@ -95,25 +95,12 @@ public class CombinationItemsData implements IXmlReader
|
||||
return null;
|
||||
}
|
||||
|
||||
public List<CombinationItem> getItemsByFirstSlot(int id)
|
||||
public List<CombinationItem> getItemsByFirstSlot(int id, int enchant)
|
||||
{
|
||||
final List<CombinationItem> result = new ArrayList<>();
|
||||
for (CombinationItem item : _items)
|
||||
{
|
||||
if (item.getItemOne() == id)
|
||||
{
|
||||
result.add(item);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public List<CombinationItem> getItemsBySecondSlot(int id)
|
||||
{
|
||||
final List<CombinationItem> result = new ArrayList<>();
|
||||
for (CombinationItem item : _items)
|
||||
{
|
||||
if (item.getItemTwo() == id)
|
||||
if ((item.getItemOne() == id) && (item.getEnchant() == enchant))
|
||||
{
|
||||
result.add(item);
|
||||
}
|
||||
|
@@ -22,20 +22,24 @@ import java.util.Map;
|
||||
import org.l2jmobius.gameserver.model.StatSet;
|
||||
|
||||
/**
|
||||
* @author UnAfraid
|
||||
* @author UnAfraid, Mobius
|
||||
*/
|
||||
public class CombinationItem
|
||||
{
|
||||
private final int _itemOne;
|
||||
private final int _enchant;
|
||||
private final int _itemTwo;
|
||||
private final long _commission;
|
||||
private final int _chance;
|
||||
private final Map<CombinationItemType, CombinationItemReward> _rewards = new EnumMap<>(CombinationItemType.class);
|
||||
|
||||
public CombinationItem(StatSet set)
|
||||
{
|
||||
_itemOne = set.getInt("one");
|
||||
_enchant = set.getInt("enchant", 0);
|
||||
_itemTwo = set.getInt("two");
|
||||
_chance = set.getInt("chance");
|
||||
_commission = set.getLong("commission", 0);
|
||||
_chance = set.getInt("chance", 33);
|
||||
}
|
||||
|
||||
public int getItemOne()
|
||||
@@ -43,11 +47,21 @@ public class CombinationItem
|
||||
return _itemOne;
|
||||
}
|
||||
|
||||
public int getEnchant()
|
||||
{
|
||||
return _enchant;
|
||||
}
|
||||
|
||||
public int getItemTwo()
|
||||
{
|
||||
return _itemTwo;
|
||||
}
|
||||
|
||||
public long getCommission()
|
||||
{
|
||||
return _commission;
|
||||
}
|
||||
|
||||
public int getChance()
|
||||
{
|
||||
return _chance;
|
||||
|
@@ -82,7 +82,7 @@ public class RequestNewEnchantPushOne implements IClientIncomingPacket
|
||||
return;
|
||||
}
|
||||
|
||||
final List<CombinationItem> combinationItems = CombinationItemsData.getInstance().getItemsByFirstSlot(itemOne.getId());
|
||||
final List<CombinationItem> combinationItems = CombinationItemsData.getInstance().getItemsByFirstSlot(itemOne.getId(), itemOne.getEnchantLevel());
|
||||
|
||||
// Not implemented or not able to merge!
|
||||
if (combinationItems.isEmpty())
|
||||
|
@@ -88,7 +88,7 @@ public class RequestNewEnchantPushTwo implements IClientIncomingPacket
|
||||
return;
|
||||
}
|
||||
|
||||
final CombinationItem combinationItem = CombinationItemsData.getInstance().getItemsBySlots(itemOne.getId(), itemTwo.getId());
|
||||
final CombinationItem combinationItem = CombinationItemsData.getInstance().getItemsBySlots(itemOne.getId(), itemOne.getEnchantLevel(), itemTwo.getId());
|
||||
|
||||
// Not implemented or not able to merge!
|
||||
if (combinationItem == null)
|
||||
|
@@ -94,7 +94,7 @@ public class RequestNewEnchantRetryToPutItems implements IClientIncomingPacket
|
||||
return;
|
||||
}
|
||||
|
||||
final CombinationItem combinationItem = CombinationItemsData.getInstance().getItemsBySlots(itemOne.getId(), itemTwo.getId());
|
||||
final CombinationItem combinationItem = CombinationItemsData.getInstance().getItemsBySlots(itemOne.getId(), itemOne.getEnchantLevel(), itemTwo.getId());
|
||||
|
||||
// Not implemented or not able to merge!
|
||||
if (combinationItem == null)
|
||||
|
@@ -91,7 +91,7 @@ public class RequestNewEnchantTry implements IClientIncomingPacket
|
||||
return;
|
||||
}
|
||||
|
||||
final CombinationItem combinationItem = CombinationItemsData.getInstance().getItemsBySlots(itemOne.getId(), itemTwo.getId());
|
||||
final CombinationItem combinationItem = CombinationItemsData.getInstance().getItemsBySlots(itemOne.getId(), itemOne.getEnchantLevel(), itemTwo.getId());
|
||||
|
||||
// Not implemented or not able to merge!
|
||||
if (combinationItem == null)
|
||||
@@ -101,11 +101,19 @@ public class RequestNewEnchantTry implements IClientIncomingPacket
|
||||
return;
|
||||
}
|
||||
|
||||
if (combinationItem.getCommission() > player.getAdena())
|
||||
{
|
||||
client.sendPacket(new ExEnchantFail(itemOne.getId(), itemTwo.getId()));
|
||||
player.removeRequest(request.getClass());
|
||||
player.sendPacket(SystemMessageId.NOT_ENOUGH_ADENA);
|
||||
return;
|
||||
}
|
||||
|
||||
final InventoryUpdate iu = new InventoryUpdate();
|
||||
iu.addRemovedItem(itemOne);
|
||||
// iu.addRemovedItem(itemTwo);
|
||||
|
||||
if (player.destroyItem("Compound-Item-One", itemOne, 1, null, true) && player.destroyItem("Compound-Item-Two", itemTwo, 1, null, true))
|
||||
if (player.destroyItem("Compound-Item-One", itemOne, 1, null, true) && player.destroyItem("Compound-Item-Two", itemTwo, 1, null, true) && ((combinationItem.getCommission() <= 0) || player.reduceAdena("Compound-Commission", combinationItem.getCommission(), player, true)))
|
||||
{
|
||||
final double random = (Rnd.nextDouble() * 100);
|
||||
final boolean success = random <= combinationItem.getChance();
|
||||
|
Reference in New Issue
Block a user