|
@@ -50,6 +50,7 @@ import com.l2jserver.gameserver.model.conditions.Condition;
|
|
|
import com.l2jserver.gameserver.model.effects.EffectTemplate;
|
|
|
import com.l2jserver.gameserver.model.effects.L2Effect;
|
|
|
import com.l2jserver.gameserver.model.entity.TvTEvent;
|
|
|
+import com.l2jserver.gameserver.model.holders.ItemHolder;
|
|
|
import com.l2jserver.gameserver.model.items.L2Armor;
|
|
|
import com.l2jserver.gameserver.model.items.type.L2ArmorType;
|
|
|
import com.l2jserver.gameserver.model.skills.funcs.Func;
|
|
@@ -2001,51 +2002,48 @@ public abstract class L2Skill implements IChanceSkillTrigger
|
|
|
*/
|
|
|
private L2ExtractableSkill parseExtractableSkill(int skillId, int skillLvl, String values)
|
|
|
{
|
|
|
- String[] lineSplit = values.split(";");
|
|
|
-
|
|
|
- final FastList<L2ExtractableProductItem> product_temp = new FastList<L2ExtractableProductItem>();
|
|
|
-
|
|
|
- for (int i = 0; i <= (lineSplit.length-1); i++)
|
|
|
+ final String[] prodLists = values.split(";");
|
|
|
+ final FastList<L2ExtractableProductItem> products = new FastList<>();
|
|
|
+ String[] prodData;
|
|
|
+ for (String prodList : prodLists)
|
|
|
{
|
|
|
- final String[] lineSplit2 = lineSplit[i].split(",");
|
|
|
-
|
|
|
- if (lineSplit2.length < 3)
|
|
|
+ prodData = prodList.split(",");
|
|
|
+ if (prodData.length < 3)
|
|
|
+ {
|
|
|
_log.warning("Extractable skills data: Error in Skill Id: " + skillId + " Level: " + skillLvl + " -> wrong seperator!");
|
|
|
-
|
|
|
- int[] production = null;
|
|
|
- int[] amount = null;
|
|
|
+ }
|
|
|
+ List<ItemHolder> items = null;
|
|
|
double chance = 0;
|
|
|
int prodId = 0;
|
|
|
int quantity = 0;
|
|
|
+ final int lenght = prodData.length - 1;
|
|
|
try
|
|
|
{
|
|
|
- int k =0;
|
|
|
- production = new int[(lineSplit2.length-1)/2];
|
|
|
- amount = new int[(lineSplit2.length-1)/2];
|
|
|
- for (int j = 0; j < (lineSplit2.length-1); j++)
|
|
|
+ items = new ArrayList<>(lenght / 2);
|
|
|
+ for (int j = 0; j < lenght; j++)
|
|
|
{
|
|
|
- prodId = Integer.parseInt(lineSplit2[j]);
|
|
|
- quantity = Integer.parseInt(lineSplit2[j+=1]);
|
|
|
+ prodId = Integer.parseInt(prodData[j]);
|
|
|
+ quantity = Integer.parseInt(prodData[j += 1]);
|
|
|
if ((prodId <= 0) || (quantity <= 0))
|
|
|
+ {
|
|
|
_log.warning("Extractable skills data: Error in Skill Id: " + skillId + " Level: " + skillLvl + " wrong production Id: " + prodId + " or wrond quantity: " + quantity + "!");
|
|
|
- production[k] = prodId;
|
|
|
- amount[k] = quantity;
|
|
|
- k++;
|
|
|
+ }
|
|
|
+ items.add(new ItemHolder(prodId, quantity));
|
|
|
}
|
|
|
- chance = Double.parseDouble(lineSplit2[lineSplit2.length-1]);
|
|
|
+ chance = Double.parseDouble(prodData[lenght]);
|
|
|
}
|
|
|
catch (Exception e)
|
|
|
{
|
|
|
_log.warning("Extractable skills data: Error in Skill Id: " + skillId + " Level: " + skillLvl + " -> incomplete/invalid production data or wrong seperator!");
|
|
|
}
|
|
|
-
|
|
|
- product_temp.add(new L2ExtractableProductItem(production, amount, chance));
|
|
|
+ products.add(new L2ExtractableProductItem(items, chance));
|
|
|
}
|
|
|
|
|
|
- if (product_temp.size()== 0)
|
|
|
+ if (products.isEmpty())
|
|
|
+ {
|
|
|
_log.warning("Extractable skills data: Error in Skill Id: " + skillId + " Level: " + skillLvl + " -> There are no production items!");
|
|
|
-
|
|
|
- return new L2ExtractableSkill(SkillTable.getSkillHashCode(this), product_temp);
|
|
|
+ }
|
|
|
+ return new L2ExtractableSkill(SkillTable.getSkillHashCode(skillId, skillLvl), products);
|
|
|
}
|
|
|
|
|
|
public L2ExtractableSkill getExtractableSkill()
|