Added check for missing life stone data.

This commit is contained in:
MobiusDev
2017-09-22 23:53:44 +00:00
parent be020f5d79
commit 923e3bce18
8 changed files with 82 additions and 2 deletions

View File

@@ -88,6 +88,7 @@ public class AugmentationData
private final List<AugmentationChance> _augmentationChances = new ArrayList<>(); private final List<AugmentationChance> _augmentationChances = new ArrayList<>();
private final List<augmentationChanceAcc> _augmentationChancesAcc = new ArrayList<>(); private final List<augmentationChanceAcc> _augmentationChancesAcc = new ArrayList<>();
private final List<Integer> _augmentationStones = new ArrayList<>();
private final Map<Integer, SkillHolder> _allSkills = new HashMap<>(); private final Map<Integer, SkillHolder> _allSkills = new HashMap<>();
@@ -392,6 +393,10 @@ public class AugmentationData
if (OptionData.getInstance().getOptions(aAugmentId) != null) if (OptionData.getInstance().getOptions(aAugmentId) != null)
{ {
if (!_augmentationStones.contains(aStoneId))
{
_augmentationStones.add(aStoneId);
}
_augmentationChances.add(new AugmentationChance(aWeaponType, aStoneId, aVariationId, aCategoryChance, aAugmentId, aAugmentChance)); _augmentationChances.add(new AugmentationChance(aWeaponType, aStoneId, aVariationId, aCategoryChance, aAugmentId, aAugmentChance));
} }
else else
@@ -490,6 +495,10 @@ public class AugmentationData
aAugmentId = Integer.parseInt(aNodeAttributes.getNamedItem("id").getNodeValue()); aAugmentId = Integer.parseInt(aNodeAttributes.getNamedItem("id").getNodeValue());
aAugmentChance = Float.parseFloat(aNodeAttributes.getNamedItem("chance").getNodeValue()); aAugmentChance = Float.parseFloat(aNodeAttributes.getNamedItem("chance").getNodeValue());
if (!_augmentationStones.contains(aStoneId))
{
_augmentationStones.add(aStoneId);
}
_augmentationChancesAcc.add(new augmentationChanceAcc(aWeaponType, aStoneId, aVariationId, aCategoryChance, aAugmentId, aAugmentChance)); _augmentationChancesAcc.add(new augmentationChanceAcc(aWeaponType, aStoneId, aVariationId, aCategoryChance, aAugmentId, aAugmentChance));
} }
} }
@@ -1042,6 +1051,11 @@ public class AugmentationData
return new L2Augmentation(((stat34 << 16) + stat12)); return new L2Augmentation(((stat34 << 16) + stat12));
} }
public boolean isAugmentaionStoneValid(int stoneId)
{
return _augmentationStones.contains(stoneId);
}
public static AugmentationData getInstance() public static AugmentationData getInstance()
{ {
return SingletonHolder._instance; return SingletonHolder._instance;

View File

@@ -17,6 +17,7 @@
package com.l2jmobius.gameserver.network.clientpackets; package com.l2jmobius.gameserver.network.clientpackets;
import com.l2jmobius.commons.network.PacketReader; import com.l2jmobius.commons.network.PacketReader;
import com.l2jmobius.gameserver.datatables.AugmentationData;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance; import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
import com.l2jmobius.gameserver.model.items.type.CrystalType; import com.l2jmobius.gameserver.model.items.type.CrystalType;
@@ -62,6 +63,12 @@ public class RequestConfirmRefinerItem extends AbstractRefinePacket
return; return;
} }
if (!AugmentationData.getInstance().isAugmentaionStoneValid(refinerItem.getId()))
{
activeChar.sendMessage("This is not a proper life stone."); // need to update retailchances.xml with this item
return;
}
if (!isValid(activeChar, targetItem, refinerItem)) if (!isValid(activeChar, targetItem, refinerItem))
{ {
activeChar.sendPacket(SystemMessageId.THIS_IS_NOT_A_SUITABLE_ITEM); activeChar.sendPacket(SystemMessageId.THIS_IS_NOT_A_SUITABLE_ITEM);

View File

@@ -88,6 +88,7 @@ public class AugmentationData
private final List<AugmentationChance> _augmentationChances = new ArrayList<>(); private final List<AugmentationChance> _augmentationChances = new ArrayList<>();
private final List<augmentationChanceAcc> _augmentationChancesAcc = new ArrayList<>(); private final List<augmentationChanceAcc> _augmentationChancesAcc = new ArrayList<>();
private final List<Integer> _augmentationStones = new ArrayList<>();
private final Map<Integer, SkillHolder> _allSkills = new HashMap<>(); private final Map<Integer, SkillHolder> _allSkills = new HashMap<>();
@@ -392,6 +393,10 @@ public class AugmentationData
if (OptionData.getInstance().getOptions(aAugmentId) != null) if (OptionData.getInstance().getOptions(aAugmentId) != null)
{ {
if (!_augmentationStones.contains(aStoneId))
{
_augmentationStones.add(aStoneId);
}
_augmentationChances.add(new AugmentationChance(aWeaponType, aStoneId, aVariationId, aCategoryChance, aAugmentId, aAugmentChance)); _augmentationChances.add(new AugmentationChance(aWeaponType, aStoneId, aVariationId, aCategoryChance, aAugmentId, aAugmentChance));
} }
else else
@@ -490,6 +495,10 @@ public class AugmentationData
aAugmentId = Integer.parseInt(aNodeAttributes.getNamedItem("id").getNodeValue()); aAugmentId = Integer.parseInt(aNodeAttributes.getNamedItem("id").getNodeValue());
aAugmentChance = Float.parseFloat(aNodeAttributes.getNamedItem("chance").getNodeValue()); aAugmentChance = Float.parseFloat(aNodeAttributes.getNamedItem("chance").getNodeValue());
if (!_augmentationStones.contains(aStoneId))
{
_augmentationStones.add(aStoneId);
}
_augmentationChancesAcc.add(new augmentationChanceAcc(aWeaponType, aStoneId, aVariationId, aCategoryChance, aAugmentId, aAugmentChance)); _augmentationChancesAcc.add(new augmentationChanceAcc(aWeaponType, aStoneId, aVariationId, aCategoryChance, aAugmentId, aAugmentChance));
} }
} }
@@ -1042,6 +1051,11 @@ public class AugmentationData
return new L2Augmentation(((stat34 << 16) + stat12)); return new L2Augmentation(((stat34 << 16) + stat12));
} }
public boolean isAugmentaionStoneValid(int stoneId)
{
return _augmentationStones.contains(stoneId);
}
public static AugmentationData getInstance() public static AugmentationData getInstance()
{ {
return SingletonHolder._instance; return SingletonHolder._instance;

View File

@@ -17,6 +17,7 @@
package com.l2jmobius.gameserver.network.clientpackets; package com.l2jmobius.gameserver.network.clientpackets;
import com.l2jmobius.commons.network.PacketReader; import com.l2jmobius.commons.network.PacketReader;
import com.l2jmobius.gameserver.datatables.AugmentationData;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance; import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
import com.l2jmobius.gameserver.model.items.type.CrystalType; import com.l2jmobius.gameserver.model.items.type.CrystalType;
@@ -62,6 +63,12 @@ public class RequestConfirmRefinerItem extends AbstractRefinePacket
return; return;
} }
if (!AugmentationData.getInstance().isAugmentaionStoneValid(refinerItem.getId()))
{
activeChar.sendMessage("This is not a proper life stone."); // need to update retailchances.xml with this item
return;
}
if (!isValid(activeChar, targetItem, refinerItem)) if (!isValid(activeChar, targetItem, refinerItem))
{ {
activeChar.sendPacket(SystemMessageId.THIS_IS_NOT_A_SUITABLE_ITEM); activeChar.sendPacket(SystemMessageId.THIS_IS_NOT_A_SUITABLE_ITEM);

View File

@@ -88,6 +88,7 @@ public class AugmentationData
private final List<AugmentationChance> _augmentationChances = new ArrayList<>(); private final List<AugmentationChance> _augmentationChances = new ArrayList<>();
private final List<augmentationChanceAcc> _augmentationChancesAcc = new ArrayList<>(); private final List<augmentationChanceAcc> _augmentationChancesAcc = new ArrayList<>();
private final List<Integer> _augmentationStones = new ArrayList<>();
private final Map<Integer, SkillHolder> _allSkills = new HashMap<>(); private final Map<Integer, SkillHolder> _allSkills = new HashMap<>();
@@ -392,6 +393,10 @@ public class AugmentationData
if (OptionData.getInstance().getOptions(aAugmentId) != null) if (OptionData.getInstance().getOptions(aAugmentId) != null)
{ {
if (!_augmentationStones.contains(aStoneId))
{
_augmentationStones.add(aStoneId);
}
_augmentationChances.add(new AugmentationChance(aWeaponType, aStoneId, aVariationId, aCategoryChance, aAugmentId, aAugmentChance)); _augmentationChances.add(new AugmentationChance(aWeaponType, aStoneId, aVariationId, aCategoryChance, aAugmentId, aAugmentChance));
} }
else else
@@ -490,6 +495,10 @@ public class AugmentationData
aAugmentId = Integer.parseInt(aNodeAttributes.getNamedItem("id").getNodeValue()); aAugmentId = Integer.parseInt(aNodeAttributes.getNamedItem("id").getNodeValue());
aAugmentChance = Float.parseFloat(aNodeAttributes.getNamedItem("chance").getNodeValue()); aAugmentChance = Float.parseFloat(aNodeAttributes.getNamedItem("chance").getNodeValue());
if (!_augmentationStones.contains(aStoneId))
{
_augmentationStones.add(aStoneId);
}
_augmentationChancesAcc.add(new augmentationChanceAcc(aWeaponType, aStoneId, aVariationId, aCategoryChance, aAugmentId, aAugmentChance)); _augmentationChancesAcc.add(new augmentationChanceAcc(aWeaponType, aStoneId, aVariationId, aCategoryChance, aAugmentId, aAugmentChance));
} }
} }
@@ -1042,6 +1051,11 @@ public class AugmentationData
return new L2Augmentation(((stat34 << 16) + stat12)); return new L2Augmentation(((stat34 << 16) + stat12));
} }
public boolean isAugmentaionStoneValid(int stoneId)
{
return _augmentationStones.contains(stoneId);
}
public static AugmentationData getInstance() public static AugmentationData getInstance()
{ {
return SingletonHolder._instance; return SingletonHolder._instance;

View File

@@ -17,6 +17,7 @@
package com.l2jmobius.gameserver.network.clientpackets; package com.l2jmobius.gameserver.network.clientpackets;
import com.l2jmobius.commons.network.PacketReader; import com.l2jmobius.commons.network.PacketReader;
import com.l2jmobius.gameserver.datatables.AugmentationData;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance; import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
import com.l2jmobius.gameserver.model.items.type.CrystalType; import com.l2jmobius.gameserver.model.items.type.CrystalType;
@@ -62,6 +63,12 @@ public class RequestConfirmRefinerItem extends AbstractRefinePacket
return; return;
} }
if (!AugmentationData.getInstance().isAugmentaionStoneValid(refinerItem.getId()))
{
activeChar.sendMessage("This is not a proper life stone."); // need to update retailchances.xml with this item
return;
}
if (!isValid(activeChar, targetItem, refinerItem)) if (!isValid(activeChar, targetItem, refinerItem))
{ {
activeChar.sendPacket(SystemMessageId.THIS_IS_NOT_A_SUITABLE_ITEM); activeChar.sendPacket(SystemMessageId.THIS_IS_NOT_A_SUITABLE_ITEM);

View File

@@ -88,6 +88,7 @@ public class AugmentationData
private final List<AugmentationChance> _augmentationChances = new ArrayList<>(); private final List<AugmentationChance> _augmentationChances = new ArrayList<>();
private final List<augmentationChanceAcc> _augmentationChancesAcc = new ArrayList<>(); private final List<augmentationChanceAcc> _augmentationChancesAcc = new ArrayList<>();
private final List<Integer> _augmentationStones = new ArrayList<>();
private final Map<Integer, SkillHolder> _allSkills = new HashMap<>(); private final Map<Integer, SkillHolder> _allSkills = new HashMap<>();
@@ -393,6 +394,10 @@ public class AugmentationData
if (OptionData.getInstance().getOptions(aAugmentId) != null) if (OptionData.getInstance().getOptions(aAugmentId) != null)
{ {
if (!_augmentationStones.contains(aStoneId))
{
_augmentationStones.add(aStoneId);
}
_augmentationChances.add(new AugmentationChance(aWeaponType, aStoneId, aVariationId, aCategoryChance, aAugmentId, aAugmentChance)); _augmentationChances.add(new AugmentationChance(aWeaponType, aStoneId, aVariationId, aCategoryChance, aAugmentId, aAugmentChance));
} }
else else
@@ -427,8 +432,8 @@ public class AugmentationData
* aStoneId = Integer.parseInt(aNodeAttributes.getNamedItem("id").getNodeValue()); for (Node v = c.getFirstChild(); v != null; v = v.getNextSibling()) { if (v.getNodeName().equals("variation")) { aNodeAttributes = v.getAttributes(); aVariationId = * aStoneId = Integer.parseInt(aNodeAttributes.getNamedItem("id").getNodeValue()); for (Node v = c.getFirstChild(); v != null; v = v.getNextSibling()) { if (v.getNodeName().equals("variation")) { aNodeAttributes = v.getAttributes(); aVariationId =
* Integer.parseInt(aNodeAttributes.getNamedItem("id").getNodeValue()); for (Node j = v.getFirstChild(); j != null; j = j.getNextSibling()) { if (j.getNodeName().equals("category")) { aNodeAttributes = j.getAttributes(); aCategoryChance = * Integer.parseInt(aNodeAttributes.getNamedItem("id").getNodeValue()); for (Node j = v.getFirstChild(); j != null; j = j.getNextSibling()) { if (j.getNodeName().equals("category")) { aNodeAttributes = j.getAttributes(); aCategoryChance =
* Integer.parseInt(aNodeAttributes.getNamedItem("probability").getNodeValue()); for (Node e = j.getFirstChild(); e != null; e = e.getNextSibling()) { if (e.getNodeName().equals("augment")) { aNodeAttributes = e.getAttributes(); aAugmentId = * Integer.parseInt(aNodeAttributes.getNamedItem("probability").getNodeValue()); for (Node e = j.getFirstChild(); e != null; e = e.getNextSibling()) { if (e.getNodeName().equals("augment")) { aNodeAttributes = e.getAttributes(); aAugmentId =
* Integer.parseInt(aNodeAttributes.getNamedItem("id").getNodeValue()); aAugmentChance = Float.parseFloat(aNodeAttributes.getNamedItem("chance").getNodeValue()); _augmentationChancesAcc.add(new augmentationChanceAcc(aWeaponType, aStoneId, aVariationId, aCategoryChance, aAugmentId, * Integer.parseInt(aNodeAttributes.getNamedItem("id").getNodeValue()); aAugmentChance = Float.parseFloat(aNodeAttributes.getNamedItem("chance").getNodeValue()); if (!_augmentationStones.contains(aStoneId)) { _augmentationStones.add(aStoneId); } _augmentationChancesAcc.add(new
* aAugmentChance)); } } } } } } } } } } } } } else { LOGGER.warning(getClass().getSimpleName() + ": ERROR The retailchances_accessory.xml data file is missing."); } } * augmentationChanceAcc(aWeaponType, aStoneId, aVariationId, aCategoryChance, aAugmentId, aAugmentChance)); } } } } } } } } } } } } } else { LOGGER.warning(getClass().getSimpleName() + ": ERROR The retailchances_accessory.xml data file is missing."); } }
*/ */
} }
@@ -963,6 +968,11 @@ public class AugmentationData
return new L2Augmentation(((stat34 << 16) + stat12)); return new L2Augmentation(((stat34 << 16) + stat12));
} }
public boolean isAugmentaionStoneValid(int stoneId)
{
return _augmentationStones.contains(stoneId);
}
public static AugmentationData getInstance() public static AugmentationData getInstance()
{ {
return SingletonHolder._instance; return SingletonHolder._instance;

View File

@@ -17,6 +17,7 @@
package com.l2jmobius.gameserver.network.clientpackets; package com.l2jmobius.gameserver.network.clientpackets;
import com.l2jmobius.commons.network.PacketReader; import com.l2jmobius.commons.network.PacketReader;
import com.l2jmobius.gameserver.datatables.AugmentationData;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance; import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
import com.l2jmobius.gameserver.model.items.type.CrystalType; import com.l2jmobius.gameserver.model.items.type.CrystalType;
@@ -62,6 +63,12 @@ public class RequestConfirmRefinerItem extends AbstractRefinePacket
return; return;
} }
if (!AugmentationData.getInstance().isAugmentaionStoneValid(refinerItem.getId()))
{
activeChar.sendMessage("This is not a proper life stone."); // need to update retailchances.xml with this item
return;
}
if (!isValid(activeChar, targetItem, refinerItem)) if (!isValid(activeChar, targetItem, refinerItem))
{ {
activeChar.sendPacket(SystemMessageId.THIS_IS_NOT_A_SUITABLE_ITEM); activeChar.sendPacket(SystemMessageId.THIS_IS_NOT_A_SUITABLE_ITEM);