Alchemy transmutation support.

Need to implement transmute skills.
I have added skill 17928 as example.
This commit is contained in:
MobiusDev
2015-05-18 01:56:28 +00:00
parent ddc3ef9037
commit 6a2082a86f
10 changed files with 505 additions and 3 deletions

View File

@@ -39,6 +39,7 @@ import com.l2jserver.gameserver.handler.ITargetTypeHandler;
import com.l2jserver.gameserver.handler.TargetHandler;
import com.l2jserver.gameserver.instancemanager.HandysBlockCheckerManager;
import com.l2jserver.gameserver.model.ArenaParticipantsHolder;
import com.l2jserver.gameserver.model.L2AlchemySkill;
import com.l2jserver.gameserver.model.L2ExtractableProductItem;
import com.l2jserver.gameserver.model.L2ExtractableSkill;
import com.l2jserver.gameserver.model.L2Object;
@@ -208,6 +209,7 @@ public final class Skill implements IIdentifiable
private final boolean _simultaneousCast;
private L2ExtractableSkill _extractableItems = null;
private L2AlchemySkill _transmutedItems = null;
private final String _icon;
@@ -385,6 +387,13 @@ public final class Skill implements IIdentifiable
_extractableItems = parseExtractableSkill(_id, _level, capsuled_items);
}
String alchemyTransmuteIngredients = set.getString("alchemyTransmuteIngredients", null);
String alchemyTransmuteProducts = set.getString("alchemyTransmuteProduction", null);
if ((alchemyTransmuteIngredients != null) && (alchemyTransmuteProducts != null))
{
_transmutedItems = parseAlchemySkill(_id, _level, alchemyTransmuteIngredients, alchemyTransmuteProducts);
}
_icon = set.getString("icon", "icon.skill0000");
_channelingSkillId = set.getInt("channelingSkillId", 0);
@@ -1706,6 +1715,46 @@ public final class Skill implements IIdentifiable
return new L2ExtractableSkill(SkillData.getSkillHashCode(skillId, skillLvl), products);
}
/**
* Parse an Alchemy transmute skill.
* @param skillId the skill Id
* @param skillLvl the skill level
* @param alchemyTransmuteIngredients the values to parse
* @param alchemyTransmuteProducts the values to parse
* @return the parsed transmute skill
*/
private L2AlchemySkill parseAlchemySkill(int skillId, int skillLvl, String alchemyTransmuteIngredients, String alchemyTransmuteProducts)
{
final String[] ingrLists = alchemyTransmuteIngredients.split(";");
final String[] prodLists = alchemyTransmuteProducts.split(";");
List<ItemHolder> ingridients = new ArrayList<>();
ItemHolder product = null;
String[] ingrData;
for (String ingrList : ingrLists)
{
ingrData = ingrList.split(",");
if (ingrData.length < 2)
{
_log.warning("Alchemy skills data: Error in Skill Id: " + skillId + " Level: " + skillLvl + " -> wrong seperator!");
}
ingridients.add(new ItemHolder(Integer.parseInt(ingrData[0]), Integer.parseInt(ingrData[1])));
}
String[] prodData;
for (String prodList : prodLists)
{
prodData = prodList.split(",");
if (prodData.length < 2)
{
_log.warning("Alchemy skills data: Error in Skill Id: " + skillId + " Level: " + skillLvl + " -> wrong seperator!");
}
product = new ItemHolder(Integer.parseInt(prodData[0]), Integer.parseInt(prodData[1]));
}
return new L2AlchemySkill(ingridients, product);
}
/**
* Parses all the abnormal visual effects.
* @param abnormalVisualEffects the abnormal visual effects list
@@ -1741,6 +1790,11 @@ public final class Skill implements IIdentifiable
return _extractableItems;
}
public L2AlchemySkill getAlchemySkill()
{
return _transmutedItems;
}
/**
* @param effectType Effect type to check if its present on this skill effects.
* @param effectTypes Effect types to check if are present on this skill effects.