Alchemy transmutation support.
Need to implement transmute skills. I have added skill 17928 as example.
This commit is contained in:
@ -0,0 +1,49 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2015 L2J Server
|
||||
*
|
||||
* This file is part of L2J Server.
|
||||
*
|
||||
* L2J Server is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* L2J Server is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.gameserver.model;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.l2jserver.gameserver.model.holders.ItemHolder;
|
||||
|
||||
/**
|
||||
* Alchemy transmute skill DTO.
|
||||
* @author Mobius
|
||||
*/
|
||||
public class L2AlchemySkill
|
||||
{
|
||||
private final List<ItemHolder> _ingredients;
|
||||
private final ItemHolder _product;
|
||||
|
||||
public L2AlchemySkill(List<ItemHolder> ingredients, ItemHolder product)
|
||||
{
|
||||
_ingredients = ingredients;
|
||||
_product = product;
|
||||
}
|
||||
|
||||
public List<ItemHolder> getIngridientItems()
|
||||
{
|
||||
return _ingredients;
|
||||
}
|
||||
|
||||
public ItemHolder getTransmutedItem()
|
||||
{
|
||||
return _product;
|
||||
}
|
||||
}
|
@ -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.
|
||||
|
Reference in New Issue
Block a user