Removal of ensoul system.
This commit is contained in:
@@ -60,7 +60,6 @@ import org.l2jmobius.gameserver.data.xml.impl.EnchantItemGroupsData;
|
||||
import org.l2jmobius.gameserver.data.xml.impl.EnchantItemHPBonusData;
|
||||
import org.l2jmobius.gameserver.data.xml.impl.EnchantItemOptionsData;
|
||||
import org.l2jmobius.gameserver.data.xml.impl.EnchantSkillGroupsData;
|
||||
import org.l2jmobius.gameserver.data.xml.impl.EnsoulData;
|
||||
import org.l2jmobius.gameserver.data.xml.impl.EventEngineData;
|
||||
import org.l2jmobius.gameserver.data.xml.impl.ExperienceData;
|
||||
import org.l2jmobius.gameserver.data.xml.impl.FakePlayerData;
|
||||
@@ -259,7 +258,6 @@ public class GameServer
|
||||
ItemCrystallizationData.getInstance();
|
||||
OptionData.getInstance();
|
||||
VariationData.getInstance();
|
||||
EnsoulData.getInstance();
|
||||
EnchantItemHPBonusData.getInstance();
|
||||
BuyListData.getInstance();
|
||||
MultisellData.getInstance();
|
||||
|
@@ -1,240 +0,0 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 org.l2jmobius.gameserver.data.xml.impl;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.NamedNodeMap;
|
||||
import org.w3c.dom.Node;
|
||||
|
||||
import org.l2jmobius.commons.util.IXmlReader;
|
||||
import org.l2jmobius.gameserver.model.ensoul.EnsoulFee;
|
||||
import org.l2jmobius.gameserver.model.ensoul.EnsoulOption;
|
||||
import org.l2jmobius.gameserver.model.ensoul.EnsoulStone;
|
||||
import org.l2jmobius.gameserver.model.holders.ItemHolder;
|
||||
import org.l2jmobius.gameserver.model.items.type.CrystalType;
|
||||
|
||||
/**
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public class EnsoulData implements IXmlReader
|
||||
{
|
||||
private static final Logger LOGGER = Logger.getLogger(EnsoulData.class.getName());
|
||||
private final Map<CrystalType, EnsoulFee> _ensoulFees = new ConcurrentHashMap<>();
|
||||
private final Map<Integer, EnsoulOption> _ensoulOptions = new ConcurrentHashMap<>();
|
||||
private final Map<Integer, EnsoulStone> _ensoulStones = new ConcurrentHashMap<>();
|
||||
|
||||
protected EnsoulData()
|
||||
{
|
||||
load();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load()
|
||||
{
|
||||
parseDatapackDirectory("data/stats/ensoul", true);
|
||||
LOGGER.info(getClass().getSimpleName() + ": Loaded " + _ensoulFees.size() + " fees.");
|
||||
LOGGER.info(getClass().getSimpleName() + ": Loaded " + _ensoulOptions.size() + " options.");
|
||||
LOGGER.info(getClass().getSimpleName() + ": Loaded " + _ensoulStones.size() + " stones.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void parseDocument(Document doc, File f)
|
||||
{
|
||||
forEach(doc, "list", listNode -> forEach(listNode, IXmlReader::isNode, ensoulNode ->
|
||||
{
|
||||
switch (ensoulNode.getNodeName())
|
||||
{
|
||||
case "fee":
|
||||
{
|
||||
parseFees(ensoulNode);
|
||||
break;
|
||||
}
|
||||
case "option":
|
||||
{
|
||||
parseOptions(ensoulNode);
|
||||
break;
|
||||
}
|
||||
case "stone":
|
||||
{
|
||||
parseStones(ensoulNode);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
private void parseFees(Node ensoulNode)
|
||||
{
|
||||
final CrystalType type = parseEnum(ensoulNode.getAttributes(), CrystalType.class, "crystalType");
|
||||
final EnsoulFee fee = new EnsoulFee(type);
|
||||
forEach(ensoulNode, IXmlReader::isNode, feeNode ->
|
||||
{
|
||||
switch (feeNode.getNodeName())
|
||||
{
|
||||
case "first":
|
||||
{
|
||||
parseFee(feeNode, fee, 0);
|
||||
break;
|
||||
}
|
||||
case "secondary":
|
||||
{
|
||||
parseFee(feeNode, fee, 1);
|
||||
break;
|
||||
}
|
||||
case "third":
|
||||
{
|
||||
parseFee(feeNode, fee, 2);
|
||||
break;
|
||||
}
|
||||
case "reNormal":
|
||||
{
|
||||
parseReFee(feeNode, fee, 0);
|
||||
break;
|
||||
}
|
||||
case "reSecondary":
|
||||
{
|
||||
parseReFee(feeNode, fee, 1);
|
||||
break;
|
||||
}
|
||||
case "reThird":
|
||||
{
|
||||
parseReFee(feeNode, fee, 2);
|
||||
break;
|
||||
}
|
||||
case "remove":
|
||||
{
|
||||
parseRemove(feeNode, fee);
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void parseFee(Node ensoulNode, EnsoulFee fee, int index)
|
||||
{
|
||||
final NamedNodeMap attrs = ensoulNode.getAttributes();
|
||||
final int id = parseInteger(attrs, "itemId");
|
||||
final int count = parseInteger(attrs, "count");
|
||||
fee.setEnsoul(index, new ItemHolder(id, count));
|
||||
_ensoulFees.put(fee.getCrystalType(), fee);
|
||||
}
|
||||
|
||||
private void parseReFee(Node ensoulNode, EnsoulFee fee, int index)
|
||||
{
|
||||
final NamedNodeMap attrs = ensoulNode.getAttributes();
|
||||
final int id = parseInteger(attrs, "itemId");
|
||||
final int count = parseInteger(attrs, "count");
|
||||
fee.setResoul(index, new ItemHolder(id, count));
|
||||
}
|
||||
|
||||
private void parseRemove(Node ensoulNode, EnsoulFee fee)
|
||||
{
|
||||
final NamedNodeMap attrs = ensoulNode.getAttributes();
|
||||
final int id = parseInteger(attrs, "itemId");
|
||||
final int count = parseInteger(attrs, "count");
|
||||
fee.addRemovalFee(new ItemHolder(id, count));
|
||||
}
|
||||
|
||||
private void parseOptions(Node ensoulNode)
|
||||
{
|
||||
final NamedNodeMap attrs = ensoulNode.getAttributes();
|
||||
final int id = parseInteger(attrs, "id");
|
||||
final String name = parseString(attrs, "name");
|
||||
final String desc = parseString(attrs, "desc");
|
||||
final int skillId = parseInteger(attrs, "skillId");
|
||||
final int skillLevel = parseInteger(attrs, "skillLevel");
|
||||
final EnsoulOption option = new EnsoulOption(id, name, desc, skillId, skillLevel);
|
||||
_ensoulOptions.put(option.getId(), option);
|
||||
}
|
||||
|
||||
private void parseStones(Node ensoulNode)
|
||||
{
|
||||
final NamedNodeMap attrs = ensoulNode.getAttributes();
|
||||
final int id = parseInteger(attrs, "id");
|
||||
final int slotType = parseInteger(attrs, "slotType");
|
||||
final EnsoulStone stone = new EnsoulStone(id, slotType);
|
||||
forEach(ensoulNode, "option", optionNode -> stone.addOption(parseInteger(optionNode.getAttributes(), "id")));
|
||||
_ensoulStones.put(stone.getId(), stone);
|
||||
}
|
||||
|
||||
public ItemHolder getEnsoulFee(CrystalType type, int index)
|
||||
{
|
||||
final EnsoulFee fee = _ensoulFees.get(type);
|
||||
return fee != null ? fee.getEnsoul(index) : null;
|
||||
}
|
||||
|
||||
public ItemHolder getResoulFee(CrystalType type, int index)
|
||||
{
|
||||
final EnsoulFee fee = _ensoulFees.get(type);
|
||||
return fee != null ? fee.getResoul(index) : null;
|
||||
}
|
||||
|
||||
public Collection<ItemHolder> getRemovalFee(CrystalType type)
|
||||
{
|
||||
final EnsoulFee fee = _ensoulFees.get(type);
|
||||
return fee != null ? fee.getRemovalFee() : Collections.emptyList();
|
||||
}
|
||||
|
||||
public EnsoulOption getOption(int id)
|
||||
{
|
||||
return _ensoulOptions.get(id);
|
||||
}
|
||||
|
||||
public EnsoulStone getStone(int id)
|
||||
{
|
||||
return _ensoulStones.get(id);
|
||||
}
|
||||
|
||||
public int getStone(int type, int optionId)
|
||||
{
|
||||
for (EnsoulStone stone : _ensoulStones.values())
|
||||
{
|
||||
if (stone.getSlotType() == type)
|
||||
{
|
||||
for (int id : stone.getOptions())
|
||||
{
|
||||
if (id == optionId)
|
||||
{
|
||||
return stone.getId();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the single instance of EnsoulData.
|
||||
* @return single instance of EnsoulData
|
||||
*/
|
||||
public static EnsoulData getInstance()
|
||||
{
|
||||
return SingletonHolder.INSTANCE;
|
||||
}
|
||||
|
||||
private static class SingletonHolder
|
||||
{
|
||||
protected static final EnsoulData INSTANCE = new EnsoulData();
|
||||
}
|
||||
}
|
@@ -26,8 +26,7 @@ public enum ItemListType implements IUpdateTypeComponent
|
||||
AUGMENT_BONUS(0x01),
|
||||
ELEMENTAL_ATTRIBUTE(0x02),
|
||||
ENCHANT_EFFECT(0x04),
|
||||
VISUAL_ID(0x08),
|
||||
SOUL_CRYSTAL(0x10);
|
||||
VISUAL_ID(0x08);
|
||||
|
||||
private final int _mask;
|
||||
|
||||
|
@@ -16,13 +16,10 @@
|
||||
*/
|
||||
package org.l2jmobius.gameserver.model;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Objects;
|
||||
|
||||
import org.l2jmobius.gameserver.enums.AttributeType;
|
||||
import org.l2jmobius.gameserver.model.buylist.Product;
|
||||
import org.l2jmobius.gameserver.model.ensoul.EnsoulOption;
|
||||
import org.l2jmobius.gameserver.model.items.Item;
|
||||
import org.l2jmobius.gameserver.model.items.WarehouseItem;
|
||||
import org.l2jmobius.gameserver.model.items.instance.ItemInstance;
|
||||
@@ -81,8 +78,6 @@ public class ItemInfo
|
||||
};
|
||||
|
||||
private int[] _option;
|
||||
private Collection<EnsoulOption> _soulCrystalOptions;
|
||||
private Collection<EnsoulOption> _soulCrystalSpecialOptions;
|
||||
private int _visualId;
|
||||
private long _visualExpiration;
|
||||
|
||||
@@ -148,8 +143,6 @@ public class ItemInfo
|
||||
_attributeDefence[type.getClientId()] = item.getDefenceAttribute(type);
|
||||
}
|
||||
_option = item.getEnchantOptions();
|
||||
_soulCrystalOptions = item.getSpecialAbilities();
|
||||
_soulCrystalSpecialOptions = item.getAdditionalSpecialAbilities();
|
||||
_visualId = item.getVisualId();
|
||||
_visualExpiration = item.getVisualLifeTime() > 0 ? (item.getVisualLifeTime() - System.currentTimeMillis()) / 1000 : 0;
|
||||
}
|
||||
@@ -208,8 +201,6 @@ public class ItemInfo
|
||||
}
|
||||
|
||||
_option = item.getEnchantOptions();
|
||||
_soulCrystalOptions = item.getSoulCrystalOptions();
|
||||
_soulCrystalSpecialOptions = item.getSoulCrystalSpecialOptions();
|
||||
_visualId = item.getVisualId();
|
||||
}
|
||||
|
||||
@@ -249,8 +240,6 @@ public class ItemInfo
|
||||
_mana = -1;
|
||||
_time = -9999;
|
||||
_location = 0;
|
||||
_soulCrystalOptions = Collections.emptyList();
|
||||
_soulCrystalSpecialOptions = Collections.emptyList();
|
||||
}
|
||||
|
||||
public ItemInfo(WarehouseItem item)
|
||||
@@ -293,8 +282,6 @@ public class ItemInfo
|
||||
_attributeDefence[i] = item.getElementDefAttr(i);
|
||||
}
|
||||
_option = item.getEnchantOptions();
|
||||
_soulCrystalOptions = item.getSoulCrystalOptions();
|
||||
_soulCrystalSpecialOptions = item.getSoulCrystalSpecialOptions();
|
||||
}
|
||||
|
||||
public int getObjectId()
|
||||
@@ -392,16 +379,6 @@ public class ItemInfo
|
||||
return _visualId;
|
||||
}
|
||||
|
||||
public Collection<EnsoulOption> getSoulCrystalOptions()
|
||||
{
|
||||
return _soulCrystalOptions != null ? _soulCrystalOptions : Collections.emptyList();
|
||||
}
|
||||
|
||||
public Collection<EnsoulOption> getSoulCrystalSpecialOptions()
|
||||
{
|
||||
return _soulCrystalSpecialOptions != null ? _soulCrystalSpecialOptions : Collections.emptyList();
|
||||
}
|
||||
|
||||
public long getVisualExpiration()
|
||||
{
|
||||
return _visualExpiration;
|
||||
|
@@ -16,12 +16,9 @@
|
||||
*/
|
||||
package org.l2jmobius.gameserver.model;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Objects;
|
||||
|
||||
import org.l2jmobius.gameserver.enums.AttributeType;
|
||||
import org.l2jmobius.gameserver.model.ensoul.EnsoulOption;
|
||||
import org.l2jmobius.gameserver.model.items.Item;
|
||||
import org.l2jmobius.gameserver.model.items.instance.ItemInstance;
|
||||
|
||||
@@ -48,8 +45,6 @@ public class TradeItem
|
||||
0
|
||||
};
|
||||
private final int[] _enchantOptions;
|
||||
private Collection<EnsoulOption> _soulCrystalOptions;
|
||||
private Collection<EnsoulOption> _soulCrystalSpecialOptions;
|
||||
private int _visualId;
|
||||
private int _augmentationOption1 = -1;
|
||||
private int _augmentationOption2 = -1;
|
||||
@@ -72,8 +67,6 @@ public class TradeItem
|
||||
_elemDefAttr[type.getClientId()] = item.getDefenceAttribute(type);
|
||||
}
|
||||
_enchantOptions = item.getEnchantOptions();
|
||||
_soulCrystalOptions = item.getSpecialAbilities();
|
||||
_soulCrystalSpecialOptions = item.getAdditionalSpecialAbilities();
|
||||
_visualId = item.getVisualId();
|
||||
if (item.getAugmentation() != null)
|
||||
{
|
||||
@@ -97,8 +90,6 @@ public class TradeItem
|
||||
_elemAtkType = AttributeType.NONE.getClientId();
|
||||
_elemAtkPower = 0;
|
||||
_enchantOptions = ItemInstance.DEFAULT_ENCHANT_OPTIONS;
|
||||
_soulCrystalOptions = Collections.emptyList();
|
||||
_soulCrystalSpecialOptions = Collections.emptyList();
|
||||
}
|
||||
|
||||
public TradeItem(TradeItem item, long count, long price)
|
||||
@@ -120,8 +111,6 @@ public class TradeItem
|
||||
_elemDefAttr[i] = item.getElementDefAttr(i);
|
||||
}
|
||||
_enchantOptions = item.getEnchantOptions();
|
||||
_soulCrystalOptions = item.getSoulCrystalOptions();
|
||||
_soulCrystalSpecialOptions = item.getSoulCrystalSpecialOptions();
|
||||
_visualId = item.getVisualId();
|
||||
}
|
||||
|
||||
@@ -225,26 +214,6 @@ public class TradeItem
|
||||
return _enchantOptions;
|
||||
}
|
||||
|
||||
public void setSoulCrystalOptions(Collection<EnsoulOption> soulCrystalOptions)
|
||||
{
|
||||
_soulCrystalOptions = soulCrystalOptions;
|
||||
}
|
||||
|
||||
public Collection<EnsoulOption> getSoulCrystalOptions()
|
||||
{
|
||||
return _soulCrystalOptions == null ? Collections.emptyList() : _soulCrystalOptions;
|
||||
}
|
||||
|
||||
public void setSoulCrystalSpecialOptions(Collection<EnsoulOption> soulCrystalSpecialOptions)
|
||||
{
|
||||
_soulCrystalSpecialOptions = soulCrystalSpecialOptions;
|
||||
}
|
||||
|
||||
public Collection<EnsoulOption> getSoulCrystalSpecialOptions()
|
||||
{
|
||||
return _soulCrystalSpecialOptions == null ? Collections.emptyList() : _soulCrystalSpecialOptions;
|
||||
}
|
||||
|
||||
public void setAugmentation(int option1, int option2)
|
||||
{
|
||||
_augmentationOption1 = option1;
|
||||
|
@@ -1,75 +0,0 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 org.l2jmobius.gameserver.model.ensoul;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.l2jmobius.gameserver.model.holders.ItemHolder;
|
||||
import org.l2jmobius.gameserver.model.items.type.CrystalType;
|
||||
|
||||
/**
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public class EnsoulFee
|
||||
{
|
||||
private final CrystalType _type;
|
||||
|
||||
private final ItemHolder[] _ensoulFee = new ItemHolder[3];
|
||||
private final ItemHolder[] _resoulFees = new ItemHolder[3];
|
||||
private final List<ItemHolder> _removalFee = new ArrayList<>();
|
||||
|
||||
public EnsoulFee(CrystalType type)
|
||||
{
|
||||
_type = type;
|
||||
}
|
||||
|
||||
public CrystalType getCrystalType()
|
||||
{
|
||||
return _type;
|
||||
}
|
||||
|
||||
public void setEnsoul(int index, ItemHolder item)
|
||||
{
|
||||
_ensoulFee[index] = item;
|
||||
}
|
||||
|
||||
public void setResoul(int index, ItemHolder item)
|
||||
{
|
||||
_resoulFees[index] = item;
|
||||
}
|
||||
|
||||
public void addRemovalFee(ItemHolder itemHolder)
|
||||
{
|
||||
_removalFee.add(itemHolder);
|
||||
}
|
||||
|
||||
public ItemHolder getEnsoul(int index)
|
||||
{
|
||||
return _ensoulFee[index];
|
||||
}
|
||||
|
||||
public ItemHolder getResoul(int index)
|
||||
{
|
||||
return _resoulFees[index];
|
||||
}
|
||||
|
||||
public List<ItemHolder> getRemovalFee()
|
||||
{
|
||||
return _removalFee;
|
||||
}
|
||||
}
|
@@ -1,58 +0,0 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 org.l2jmobius.gameserver.model.ensoul;
|
||||
|
||||
import org.l2jmobius.gameserver.model.holders.SkillHolder;
|
||||
|
||||
/**
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public class EnsoulOption extends SkillHolder
|
||||
{
|
||||
private final int _id;
|
||||
private final String _name;
|
||||
private final String _desc;
|
||||
|
||||
public EnsoulOption(int id, String name, String desc, int skillId, int skillLevel)
|
||||
{
|
||||
super(skillId, skillLevel);
|
||||
_id = id;
|
||||
_name = name;
|
||||
_desc = desc;
|
||||
}
|
||||
|
||||
public int getId()
|
||||
{
|
||||
return _id;
|
||||
}
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return _name;
|
||||
}
|
||||
|
||||
public String getDesc()
|
||||
{
|
||||
return _desc;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return "Ensoul Id: " + _id + " Name: " + _name + " Desc: " + _desc;
|
||||
}
|
||||
}
|
@@ -1,56 +0,0 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 org.l2jmobius.gameserver.model.ensoul;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public class EnsoulStone
|
||||
{
|
||||
private final int _id;
|
||||
private final int _slotType;
|
||||
private final List<Integer> _options = new ArrayList<>();
|
||||
|
||||
public EnsoulStone(int id, int slotType)
|
||||
{
|
||||
_id = id;
|
||||
_slotType = slotType;
|
||||
}
|
||||
|
||||
public int getId()
|
||||
{
|
||||
return _id;
|
||||
}
|
||||
|
||||
public int getSlotType()
|
||||
{
|
||||
return _slotType;
|
||||
}
|
||||
|
||||
public List<Integer> getOptions()
|
||||
{
|
||||
return _options;
|
||||
}
|
||||
|
||||
public void addOption(int option)
|
||||
{
|
||||
_options.add(option);
|
||||
}
|
||||
}
|
@@ -324,9 +324,6 @@ public abstract class Inventory extends ItemContainer
|
||||
// Clear enchant bonus
|
||||
item.clearEnchantStats();
|
||||
|
||||
// Clear SA Bonus
|
||||
item.clearSpecialAbilities();
|
||||
|
||||
final List<ItemSkillHolder> normalSkills = it.getSkills(ItemSkillType.NORMAL);
|
||||
if (normalSkills != null)
|
||||
{
|
||||
@@ -496,9 +493,6 @@ public abstract class Inventory extends ItemContainer
|
||||
// Apply enchant stats
|
||||
item.applyEnchantStats();
|
||||
|
||||
// Apply SA skill
|
||||
item.applySpecialAbilities();
|
||||
|
||||
final List<ItemSkillHolder> normalSkills = item.getItem().getSkills(ItemSkillType.NORMAL);
|
||||
if (normalSkills != null)
|
||||
{
|
||||
|
@@ -943,10 +943,6 @@ public class PlayerInventory extends Inventory
|
||||
{
|
||||
item.giveSkillsToOwner();
|
||||
item.applyEnchantStats();
|
||||
if (item.isEquipped())
|
||||
{
|
||||
item.applySpecialAbilities();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -16,12 +16,10 @@
|
||||
*/
|
||||
package org.l2jmobius.gameserver.model.items;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Objects;
|
||||
|
||||
import org.l2jmobius.gameserver.enums.AttributeType;
|
||||
import org.l2jmobius.gameserver.model.VariationInstance;
|
||||
import org.l2jmobius.gameserver.model.ensoul.EnsoulOption;
|
||||
import org.l2jmobius.gameserver.model.items.instance.ItemInstance;
|
||||
import org.l2jmobius.gameserver.model.items.type.CrystalType;
|
||||
import org.l2jmobius.gameserver.model.items.type.ItemType;
|
||||
@@ -64,8 +62,6 @@ public class WarehouseItem
|
||||
};
|
||||
|
||||
private final int[] _enchantOptions;
|
||||
private final Collection<EnsoulOption> _soulCrystalOptions;
|
||||
private final Collection<EnsoulOption> _soulCrystalSpecialOptions;
|
||||
|
||||
private final int _time;
|
||||
|
||||
@@ -91,8 +87,6 @@ public class WarehouseItem
|
||||
_elemDefAttr[type.getClientId()] = item.getDefenceAttribute(type);
|
||||
}
|
||||
_enchantOptions = item.getEnchantOptions();
|
||||
_soulCrystalOptions = item.getSpecialAbilities();
|
||||
_soulCrystalSpecialOptions = item.getAdditionalSpecialAbilities();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -274,16 +268,6 @@ public class WarehouseItem
|
||||
return _enchantOptions;
|
||||
}
|
||||
|
||||
public Collection<EnsoulOption> getSoulCrystalOptions()
|
||||
{
|
||||
return _soulCrystalOptions;
|
||||
}
|
||||
|
||||
public Collection<EnsoulOption> getSoulCrystalSpecialOptions()
|
||||
{
|
||||
return _soulCrystalSpecialOptions;
|
||||
}
|
||||
|
||||
public int getTime()
|
||||
{
|
||||
return _time;
|
||||
|
@@ -38,7 +38,6 @@ import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.gameserver.data.xml.impl.AppearanceItemData;
|
||||
import org.l2jmobius.gameserver.data.xml.impl.EnchantItemOptionsData;
|
||||
import org.l2jmobius.gameserver.data.xml.impl.EnsoulData;
|
||||
import org.l2jmobius.gameserver.data.xml.impl.OptionData;
|
||||
import org.l2jmobius.gameserver.datatables.ItemTable;
|
||||
import org.l2jmobius.gameserver.enums.AttributeType;
|
||||
@@ -61,7 +60,6 @@ import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.actor.Summon;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.conditions.Condition;
|
||||
import org.l2jmobius.gameserver.model.ensoul.EnsoulOption;
|
||||
import org.l2jmobius.gameserver.model.entity.Castle;
|
||||
import org.l2jmobius.gameserver.model.events.EventDispatcher;
|
||||
import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerAugment;
|
||||
@@ -174,8 +172,6 @@ public class ItemInstance extends WorldObject
|
||||
private final DropProtection _dropProtection = new DropProtection();
|
||||
|
||||
private final List<Options> _enchantOptions = new ArrayList<>();
|
||||
private final EnsoulOption[] _ensoulOptions = new EnsoulOption[2];
|
||||
private final EnsoulOption[] _ensoulSpecialOptions = new EnsoulOption[1];
|
||||
|
||||
/**
|
||||
* Constructor of the ItemInstance from the objectId and the itemId.
|
||||
@@ -248,7 +244,6 @@ public class ItemInstance extends WorldObject
|
||||
if (isEquipable())
|
||||
{
|
||||
restoreAttributes();
|
||||
restoreSpecialAbilities();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1618,8 +1613,6 @@ public class ItemInstance extends WorldObject
|
||||
{
|
||||
updateItemElements(con);
|
||||
}
|
||||
|
||||
updateSpecialAbilities(con);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@@ -1665,8 +1658,6 @@ public class ItemInstance extends WorldObject
|
||||
{
|
||||
updateItemElements(con);
|
||||
}
|
||||
|
||||
updateSpecialAbilities(con);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@@ -2119,286 +2110,6 @@ public class ItemInstance extends WorldObject
|
||||
return DEFAULT_ENCHANT_OPTIONS;
|
||||
}
|
||||
|
||||
public Collection<EnsoulOption> getSpecialAbilities()
|
||||
{
|
||||
final List<EnsoulOption> result = new ArrayList<>();
|
||||
for (EnsoulOption ensoulOption : _ensoulOptions)
|
||||
{
|
||||
if (ensoulOption != null)
|
||||
{
|
||||
result.add(ensoulOption);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public EnsoulOption getSpecialAbility(int index)
|
||||
{
|
||||
return _ensoulOptions[index];
|
||||
}
|
||||
|
||||
public Collection<EnsoulOption> getAdditionalSpecialAbilities()
|
||||
{
|
||||
final List<EnsoulOption> result = new ArrayList<>();
|
||||
for (EnsoulOption ensoulSpecialOption : _ensoulSpecialOptions)
|
||||
{
|
||||
if (ensoulSpecialOption != null)
|
||||
{
|
||||
result.add(ensoulSpecialOption);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public EnsoulOption getAdditionalSpecialAbility(int index)
|
||||
{
|
||||
return _ensoulSpecialOptions[index];
|
||||
}
|
||||
|
||||
public void addSpecialAbility(EnsoulOption option, int position, int type, boolean updateInDB)
|
||||
{
|
||||
if ((type == 1) && ((position < 0) || (position > 1))) // two first slots
|
||||
{
|
||||
return;
|
||||
}
|
||||
if ((type == 2) && (position != 0)) // third slot
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (type == 1) // Adding regular ability
|
||||
{
|
||||
final EnsoulOption oldOption = _ensoulOptions[position];
|
||||
if (oldOption != null)
|
||||
{
|
||||
removeSpecialAbility(oldOption);
|
||||
}
|
||||
_ensoulOptions[position] = option;
|
||||
}
|
||||
else if (type == 2) // Adding special ability
|
||||
{
|
||||
final EnsoulOption oldOption = _ensoulSpecialOptions[position];
|
||||
if (oldOption != null)
|
||||
{
|
||||
removeSpecialAbility(oldOption);
|
||||
}
|
||||
_ensoulSpecialOptions[position] = option;
|
||||
}
|
||||
|
||||
if (updateInDB)
|
||||
{
|
||||
updateSpecialAbilities();
|
||||
}
|
||||
}
|
||||
|
||||
public void removeSpecialAbility(int position, int type)
|
||||
{
|
||||
if (type == 1)
|
||||
{
|
||||
final EnsoulOption option = _ensoulOptions[position];
|
||||
if (option != null)
|
||||
{
|
||||
removeSpecialAbility(option);
|
||||
_ensoulOptions[position] = null;
|
||||
|
||||
// Rearrange.
|
||||
if (position == 0)
|
||||
{
|
||||
final EnsoulOption secondEnsoul = _ensoulOptions[1];
|
||||
if (secondEnsoul != null)
|
||||
{
|
||||
removeSpecialAbility(secondEnsoul);
|
||||
_ensoulOptions[1] = null;
|
||||
addSpecialAbility(secondEnsoul, 0, type, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (type == 2)
|
||||
{
|
||||
final EnsoulOption option = _ensoulSpecialOptions[position];
|
||||
if (option != null)
|
||||
{
|
||||
removeSpecialAbility(option);
|
||||
_ensoulSpecialOptions[position] = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void clearSpecialAbilities()
|
||||
{
|
||||
for (EnsoulOption ensoulOption : _ensoulOptions)
|
||||
{
|
||||
clearSpecialAbility(ensoulOption);
|
||||
}
|
||||
for (EnsoulOption ensoulSpecialOption : _ensoulSpecialOptions)
|
||||
{
|
||||
clearSpecialAbility(ensoulSpecialOption);
|
||||
}
|
||||
}
|
||||
|
||||
public void applySpecialAbilities()
|
||||
{
|
||||
if (!isEquipped())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (EnsoulOption ensoulOption : _ensoulOptions)
|
||||
{
|
||||
applySpecialAbility(ensoulOption);
|
||||
}
|
||||
for (EnsoulOption ensoulSpecialOption : _ensoulSpecialOptions)
|
||||
{
|
||||
applySpecialAbility(ensoulSpecialOption);
|
||||
}
|
||||
}
|
||||
|
||||
private void removeSpecialAbility(EnsoulOption option)
|
||||
{
|
||||
try (Connection con = DatabaseFactory.getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("DELETE FROM item_special_abilities WHERE objectId = ? AND optionId = ?"))
|
||||
{
|
||||
ps.setInt(1, getObjectId());
|
||||
ps.setInt(2, option.getId());
|
||||
ps.execute();
|
||||
|
||||
final Skill skill = option.getSkill();
|
||||
if (skill != null)
|
||||
{
|
||||
final PlayerInstance player = getActingPlayer();
|
||||
if (player != null)
|
||||
{
|
||||
player.removeSkill(skill.getId());
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LOGGER.log(Level.WARNING, "Couldn't remove special ability for item: " + this, e);
|
||||
}
|
||||
}
|
||||
|
||||
private void applySpecialAbility(EnsoulOption option)
|
||||
{
|
||||
if (option == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final Skill skill = option.getSkill();
|
||||
if (skill != null)
|
||||
{
|
||||
final PlayerInstance player = getActingPlayer();
|
||||
if ((player != null) && (player.getSkillLevel(skill.getId()) != skill.getLevel()))
|
||||
{
|
||||
player.addSkill(skill, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void clearSpecialAbility(EnsoulOption option)
|
||||
{
|
||||
if (option == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final Skill skill = option.getSkill();
|
||||
if (skill != null)
|
||||
{
|
||||
final PlayerInstance player = getActingPlayer();
|
||||
if (player != null)
|
||||
{
|
||||
player.removeSkill(skill, false, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void restoreSpecialAbilities()
|
||||
{
|
||||
try (Connection con = DatabaseFactory.getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("SELECT * FROM item_special_abilities WHERE objectId = ? ORDER BY position"))
|
||||
{
|
||||
ps.setInt(1, getObjectId());
|
||||
try (ResultSet rs = ps.executeQuery())
|
||||
{
|
||||
while (rs.next())
|
||||
{
|
||||
final int optionId = rs.getInt("optionId");
|
||||
final int type = rs.getInt("type");
|
||||
final int position = rs.getInt("position");
|
||||
final EnsoulOption option = EnsoulData.getInstance().getOption(optionId);
|
||||
if (option != null)
|
||||
{
|
||||
addSpecialAbility(option, position, type, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LOGGER.log(Level.WARNING, "Couldn't restore special abilities for item: " + this, e);
|
||||
}
|
||||
}
|
||||
|
||||
public void updateSpecialAbilities()
|
||||
{
|
||||
try (Connection con = DatabaseFactory.getConnection())
|
||||
{
|
||||
updateSpecialAbilities(con);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LOGGER.log(Level.WARNING, "Couldn't update item special abilities", e);
|
||||
}
|
||||
}
|
||||
|
||||
private void updateSpecialAbilities(Connection con)
|
||||
{
|
||||
try (PreparedStatement ps = con.prepareStatement("INSERT INTO item_special_abilities (`objectId`, `type`, `optionId`, `position`) VALUES (?, ?, ?, ?) ON DUPLICATE KEY UPDATE type = ?, optionId = ?, position = ?"))
|
||||
{
|
||||
ps.setInt(1, getObjectId());
|
||||
for (int i = 0; i < _ensoulOptions.length; i++)
|
||||
{
|
||||
if (_ensoulOptions[i] == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
ps.setInt(2, 1); // regular options
|
||||
ps.setInt(3, _ensoulOptions[i].getId());
|
||||
ps.setInt(4, i);
|
||||
|
||||
ps.setInt(5, 1); // regular options
|
||||
ps.setInt(6, _ensoulOptions[i].getId());
|
||||
ps.setInt(7, i);
|
||||
ps.execute();
|
||||
}
|
||||
|
||||
for (int i = 0; i < _ensoulSpecialOptions.length; i++)
|
||||
{
|
||||
if (_ensoulSpecialOptions[i] == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
ps.setInt(2, 2); // special options
|
||||
ps.setInt(3, _ensoulSpecialOptions[i].getId());
|
||||
ps.setInt(4, i);
|
||||
|
||||
ps.setInt(5, 2); // special options
|
||||
ps.setInt(6, _ensoulSpecialOptions[i].getId());
|
||||
ps.setInt(7, i);
|
||||
ps.execute();
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LOGGER.log(Level.WARNING, "Couldn't update item special abilities", e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears all the enchant bonuses if item is enchanted and containing bonuses for enchant value.
|
||||
*/
|
||||
|
@@ -60,8 +60,6 @@ import org.l2jmobius.gameserver.network.clientpackets.crystalization.RequestCrys
|
||||
import org.l2jmobius.gameserver.network.clientpackets.crystalization.RequestCrystallizeItemCancel;
|
||||
import org.l2jmobius.gameserver.network.clientpackets.dailymission.RequestOneDayRewardReceive;
|
||||
import org.l2jmobius.gameserver.network.clientpackets.dailymission.RequestTodoList;
|
||||
import org.l2jmobius.gameserver.network.clientpackets.ensoul.RequestItemEnsoul;
|
||||
import org.l2jmobius.gameserver.network.clientpackets.ensoul.RequestTryEnSoulExtraction;
|
||||
import org.l2jmobius.gameserver.network.clientpackets.friend.RequestFriendDetailInfo;
|
||||
import org.l2jmobius.gameserver.network.clientpackets.luckygame.RequestLuckyGamePlay;
|
||||
import org.l2jmobius.gameserver.network.clientpackets.luckygame.RequestLuckyGameStartInfo;
|
||||
@@ -346,7 +344,7 @@ public enum ExIncomingPackets implements IIncomingPackets<GameClient>
|
||||
REQUEST_EX_AUTO_FISH(0x105, ExRequestAutoFish::new, ConnectionState.IN_GAME),
|
||||
REQUEST_VIP_ATTENDANCE_ITEM_LIST(0x106, RequestVipAttendanceItemList::new, ConnectionState.IN_GAME),
|
||||
REQUEST_VIP_ATTENDANCE_CHECK(0x107, RequestVipAttendanceCheck::new, ConnectionState.IN_GAME),
|
||||
REQUEST_ITEM_ENSOUL(0x108, RequestItemEnsoul::new, ConnectionState.IN_GAME),
|
||||
REQUEST_ITEM_ENSOUL(0x108, null, ConnectionState.IN_GAME),
|
||||
REQUEST_CASTLE_WAR_SEASON_REWARD(0x109, null, ConnectionState.IN_GAME),
|
||||
REQUEST_VIP_PRODUCT_LIST(0x10A, null, ConnectionState.IN_GAME),
|
||||
REQUEST_VIP_LUCKY_GAME_INFO(0x10B, null, ConnectionState.IN_GAME),
|
||||
@@ -378,7 +376,7 @@ public enum ExIncomingPackets implements IIncomingPackets<GameClient>
|
||||
REQUEST_SSO_AUTHN_TOKEN(0x125, null, ConnectionState.IN_GAME),
|
||||
REQUEST_QUEUE_TICKET_LOGIN(0x126, null, ConnectionState.IN_GAME),
|
||||
REQUEST_BLOCK_MEMO_INFO(0x127, null, ConnectionState.IN_GAME),
|
||||
REQUEST_TRY_EN_SOUL_EXTRACTION(0x128, RequestTryEnSoulExtraction::new, ConnectionState.IN_GAME),
|
||||
REQUEST_TRY_EN_SOUL_EXTRACTION(0x128, null, ConnectionState.IN_GAME),
|
||||
REQUEST_RAIDBOSS_SPAWN_INFO(0x129, null, ConnectionState.IN_GAME),
|
||||
REQUEST_RAID_SERVER_INFO(0x12A, null, ConnectionState.IN_GAME),
|
||||
REQUEST_SHOW_AGIT_SIEGE_INFO(0x12B, null, ConnectionState.IN_GAME),
|
||||
|
@@ -21,8 +21,6 @@ import java.util.List;
|
||||
import java.util.OptionalLong;
|
||||
|
||||
import org.l2jmobius.commons.network.PacketReader;
|
||||
import org.l2jmobius.commons.util.CommonUtil;
|
||||
import org.l2jmobius.gameserver.data.xml.impl.EnsoulData;
|
||||
import org.l2jmobius.gameserver.data.xml.impl.MultisellData;
|
||||
import org.l2jmobius.gameserver.datatables.ItemTable;
|
||||
import org.l2jmobius.gameserver.enums.AttributeType;
|
||||
@@ -31,7 +29,6 @@ import org.l2jmobius.gameserver.model.ItemInfo;
|
||||
import org.l2jmobius.gameserver.model.actor.Npc;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.clan.Clan;
|
||||
import org.l2jmobius.gameserver.model.ensoul.EnsoulOption;
|
||||
import org.l2jmobius.gameserver.model.holders.ItemChanceHolder;
|
||||
import org.l2jmobius.gameserver.model.holders.MultisellEntryHolder;
|
||||
import org.l2jmobius.gameserver.model.holders.PreparedMultisellListHolder;
|
||||
@@ -66,8 +63,6 @@ public class MultiSellChoose implements IClientIncomingPacket
|
||||
private short _earthDefence;
|
||||
private short _holyDefence;
|
||||
private short _darkDefence;
|
||||
private EnsoulOption[] _soulCrystalOptions;
|
||||
private EnsoulOption[] _soulCrystalSpecialOptions;
|
||||
|
||||
@Override
|
||||
public boolean read(GameClient client, PacketReader packet)
|
||||
@@ -86,18 +81,6 @@ public class MultiSellChoose implements IClientIncomingPacket
|
||||
_earthDefence = (short) packet.readH();
|
||||
_holyDefence = (short) packet.readH();
|
||||
_darkDefence = (short) packet.readH();
|
||||
_soulCrystalOptions = new EnsoulOption[packet.readC()]; // Ensoul size
|
||||
for (int i = 0; i < _soulCrystalOptions.length; i++)
|
||||
{
|
||||
final int ensoulId = packet.readD(); // Ensoul option id
|
||||
_soulCrystalOptions[i] = EnsoulData.getInstance().getOption(ensoulId);
|
||||
}
|
||||
_soulCrystalSpecialOptions = new EnsoulOption[packet.readC()]; // Special ensoul size
|
||||
for (int i = 0; i < _soulCrystalSpecialOptions.length; i++)
|
||||
{
|
||||
final int ensoulId = packet.readD(); // Special ensoul option id.
|
||||
_soulCrystalSpecialOptions[i] = EnsoulData.getInstance().getOption(ensoulId);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -143,13 +126,6 @@ public class MultiSellChoose implements IClientIncomingPacket
|
||||
}
|
||||
}
|
||||
|
||||
if (((_soulCrystalOptions != null) && CommonUtil.contains(_soulCrystalOptions, null)) || ((_soulCrystalSpecialOptions != null) && CommonUtil.contains(_soulCrystalSpecialOptions, null)))
|
||||
{
|
||||
LOGGER.severe("Character: " + player.getName() + " requested multisell entry with invalid soul crystal options. Multisell: " + _listId + " entry: " + _entryId);
|
||||
player.setMultiSell(null);
|
||||
return;
|
||||
}
|
||||
|
||||
final MultisellEntryHolder entry = list.getEntries().get(_entryId - 1); // Entry Id begins from 1. We currently use entry IDs as index pointer.
|
||||
if (entry == null)
|
||||
{
|
||||
@@ -181,10 +157,6 @@ public class MultiSellChoose implements IClientIncomingPacket
|
||||
|| (itemEnchantment.getAttributeDefence(AttributeType.DARK) != _darkDefence)
|
||||
|| ((itemEnchantment.getAugmentation() == null) && ((_augmentOption1 != 0) || (_augmentOption2 != 0)))
|
||||
|| ((itemEnchantment.getAugmentation() != null) && ((itemEnchantment.getAugmentation().getOption1Id() != _augmentOption1) || (itemEnchantment.getAugmentation().getOption2Id() != _augmentOption2)))
|
||||
|| ((_soulCrystalOptions != null) && itemEnchantment.getSoulCrystalOptions().stream().anyMatch(e -> !CommonUtil.contains(_soulCrystalOptions, e)))
|
||||
|| ((_soulCrystalOptions == null) && !itemEnchantment.getSoulCrystalOptions().isEmpty())
|
||||
|| ((_soulCrystalSpecialOptions != null) && itemEnchantment.getSoulCrystalSpecialOptions().stream().anyMatch(e -> !CommonUtil.contains(_soulCrystalSpecialOptions, e)))
|
||||
|| ((_soulCrystalSpecialOptions == null) && !itemEnchantment.getSoulCrystalSpecialOptions().isEmpty())
|
||||
))
|
||||
//@formatter:on
|
||||
{
|
||||
@@ -489,22 +461,6 @@ public class MultiSellChoose implements IClientIncomingPacket
|
||||
addedItem.setAttribute(new AttributeHolder(AttributeType.DARK, itemEnchantment.getAttributeDefence(AttributeType.DARK)), false);
|
||||
}
|
||||
}
|
||||
if (_soulCrystalOptions != null)
|
||||
{
|
||||
int pos = -1;
|
||||
for (EnsoulOption ensoul : _soulCrystalOptions)
|
||||
{
|
||||
pos++;
|
||||
addedItem.addSpecialAbility(ensoul, pos, 1, false);
|
||||
}
|
||||
}
|
||||
if (_soulCrystalSpecialOptions != null)
|
||||
{
|
||||
for (EnsoulOption ensoul : _soulCrystalSpecialOptions)
|
||||
{
|
||||
addedItem.addSpecialAbility(ensoul, 0, 2, false);
|
||||
}
|
||||
}
|
||||
addedItem.updateDatabase(true);
|
||||
// Mark that we have already upgraded the item.
|
||||
itemEnchantmentProcessed = false;
|
||||
|
@@ -18,18 +18,14 @@ package org.l2jmobius.gameserver.network.clientpackets;
|
||||
|
||||
import static org.l2jmobius.gameserver.model.itemcontainer.Inventory.MAX_ADENA;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.network.PacketReader;
|
||||
import org.l2jmobius.gameserver.data.xml.impl.EnsoulData;
|
||||
import org.l2jmobius.gameserver.datatables.ItemTable;
|
||||
import org.l2jmobius.gameserver.enums.AttributeType;
|
||||
import org.l2jmobius.gameserver.enums.PrivateStoreType;
|
||||
import org.l2jmobius.gameserver.model.TradeItem;
|
||||
import org.l2jmobius.gameserver.model.TradeList;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.ensoul.EnsoulOption;
|
||||
import org.l2jmobius.gameserver.model.items.Item;
|
||||
import org.l2jmobius.gameserver.model.zone.ZoneId;
|
||||
import org.l2jmobius.gameserver.network.GameClient;
|
||||
@@ -86,16 +82,6 @@ public class SetPrivateStoreListBuy implements IClientIncomingPacket
|
||||
final int defenceHoly = packet.readH();
|
||||
final int defenceDark = packet.readH();
|
||||
final int visualId = packet.readD();
|
||||
final EnsoulOption[] soulCrystalOptions = new EnsoulOption[packet.readC()];
|
||||
for (int k = 0; k < soulCrystalOptions.length; k++)
|
||||
{
|
||||
soulCrystalOptions[k] = EnsoulData.getInstance().getOption(packet.readD());
|
||||
}
|
||||
final EnsoulOption[] soulCrystalSpecialOptions = new EnsoulOption[packet.readC()];
|
||||
for (int k = 0; k < soulCrystalSpecialOptions.length; k++)
|
||||
{
|
||||
soulCrystalSpecialOptions[k] = EnsoulData.getInstance().getOption(packet.readD());
|
||||
}
|
||||
|
||||
final TradeItem item = new TradeItem(template, cnt, price);
|
||||
item.setEnchant(enchantLevel);
|
||||
@@ -109,8 +95,6 @@ public class SetPrivateStoreListBuy implements IClientIncomingPacket
|
||||
item.setElementDefAttr(AttributeType.HOLY, defenceHoly);
|
||||
item.setElementDefAttr(AttributeType.DARK, defenceDark);
|
||||
item.setVisualId(visualId);
|
||||
item.setSoulCrystalOptions(Arrays.asList(soulCrystalOptions));
|
||||
item.setSoulCrystalSpecialOptions(Arrays.asList(soulCrystalSpecialOptions));
|
||||
_items[i] = item;
|
||||
}
|
||||
return true;
|
||||
|
@@ -1,278 +0,0 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 org.l2jmobius.gameserver.network.clientpackets.ensoul;
|
||||
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.l2jmobius.commons.network.PacketReader;
|
||||
import org.l2jmobius.gameserver.data.xml.impl.EnsoulData;
|
||||
import org.l2jmobius.gameserver.enums.PrivateStoreType;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.ensoul.EnsoulOption;
|
||||
import org.l2jmobius.gameserver.model.ensoul.EnsoulStone;
|
||||
import org.l2jmobius.gameserver.model.holders.ItemHolder;
|
||||
import org.l2jmobius.gameserver.model.items.instance.ItemInstance;
|
||||
import org.l2jmobius.gameserver.model.skills.AbnormalType;
|
||||
import org.l2jmobius.gameserver.network.GameClient;
|
||||
import org.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.InventoryUpdate;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.ensoul.ExEnsoulResult;
|
||||
import org.l2jmobius.gameserver.taskmanager.AttackStanceTaskManager;
|
||||
|
||||
/**
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public class RequestItemEnsoul implements IClientIncomingPacket
|
||||
{
|
||||
private static final Logger LOGGER = Logger.getLogger(RequestItemEnsoul.class.getName());
|
||||
private int _itemObjectId;
|
||||
private EnsoulItemOption[] _options;
|
||||
|
||||
@Override
|
||||
public boolean read(GameClient client, PacketReader packet)
|
||||
{
|
||||
_itemObjectId = packet.readD();
|
||||
final int options = packet.readC();
|
||||
if ((options > 0) && (options <= 3))
|
||||
{
|
||||
_options = new EnsoulItemOption[options];
|
||||
for (int i = 0; i < options; i++)
|
||||
{
|
||||
final int type = packet.readC(); // 1 = normal ; 2 = mystic
|
||||
final int position = packet.readC();
|
||||
final int soulCrystalObjectId = packet.readD();
|
||||
final int soulCrystalOption = packet.readD();
|
||||
if ((position > 0) && (position < 3) && ((type == 1) || (type == 2)))
|
||||
{
|
||||
_options[i] = new EnsoulItemOption(type, position, soulCrystalObjectId, soulCrystalOption);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(GameClient client)
|
||||
{
|
||||
final PlayerInstance player = client.getPlayer();
|
||||
if (player == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (player.getPrivateStoreType() != PrivateStoreType.NONE)
|
||||
{
|
||||
player.sendPacket(SystemMessageId.RUNE_INSERTION_IS_IMPOSSIBLE_WHEN_PRIVATE_STORE_AND_WORKSHOP_ARE_OPENED);
|
||||
return;
|
||||
}
|
||||
if (player.hasAbnormalType(AbnormalType.FREEZING))
|
||||
{
|
||||
player.sendPacket(SystemMessageId.RUNE_INSERTION_IS_IMPOSSIBLE_WHILE_IN_FROZEN_STATE);
|
||||
}
|
||||
if (player.isDead())
|
||||
{
|
||||
player.sendPacket(SystemMessageId.RUNE_INSERTION_IS_IMPOSSIBLE_IF_THE_CHARACTER_IS_DEAD);
|
||||
return;
|
||||
}
|
||||
if ((player.getActiveTradeList() != null) || player.hasItemRequest())
|
||||
{
|
||||
player.sendPacket(SystemMessageId.RUNE_INSERTION_IS_IMPOSSIBLE_DURING_EXCHANGE);
|
||||
return;
|
||||
}
|
||||
if (player.hasAbnormalType(AbnormalType.PARALYZE))
|
||||
{
|
||||
player.sendPacket(SystemMessageId.RUNE_INSERTION_IS_IMPOSSIBLE_WHILE_PETRIFIED);
|
||||
return;
|
||||
}
|
||||
if (player.isFishing())
|
||||
{
|
||||
player.sendPacket(SystemMessageId.RUNE_INSERTION_IS_IMPOSSIBLE_DURING_FISHING);
|
||||
return;
|
||||
}
|
||||
if (player.isSitting())
|
||||
{
|
||||
player.sendPacket(SystemMessageId.RUNE_INSERTION_IS_IMPOSSIBLE_WHILE_SITTING);
|
||||
return;
|
||||
}
|
||||
if (AttackStanceTaskManager.getInstance().hasAttackStanceTask(player))
|
||||
{
|
||||
player.sendPacket(SystemMessageId.RUNE_INSERTION_IS_IMPOSSIBLE_WHILE_IN_COMBAT);
|
||||
return;
|
||||
}
|
||||
|
||||
final ItemInstance item = player.getInventory().getItemByObjectId(_itemObjectId);
|
||||
if (item == null)
|
||||
{
|
||||
LOGGER.warning("Player: " + player + " attempting to ensoul item without having it!");
|
||||
return;
|
||||
}
|
||||
if (!item.isEquipable())
|
||||
{
|
||||
LOGGER.warning("Player: " + player + " attempting to ensoul non equippable item: " + item + "!");
|
||||
return;
|
||||
}
|
||||
if (!item.isWeapon())
|
||||
{
|
||||
LOGGER.warning("Player: " + player + " attempting to ensoul item that's not a weapon: " + item + "!");
|
||||
return;
|
||||
}
|
||||
if (item.isCommonItem())
|
||||
{
|
||||
LOGGER.warning("Player: " + player + " attempting to ensoul common item: " + item + "!");
|
||||
return;
|
||||
}
|
||||
if (item.isShadowItem())
|
||||
{
|
||||
LOGGER.warning("Player: " + player + " attempting to ensoul shadow item: " + item + "!");
|
||||
return;
|
||||
}
|
||||
if (item.isHeroItem())
|
||||
{
|
||||
LOGGER.warning("Player: " + player + " attempting to ensoul hero item: " + item + "!");
|
||||
return;
|
||||
}
|
||||
if ((_options == null) || (_options.length == 0))
|
||||
{
|
||||
LOGGER.warning("Player: " + player + " attempting to ensoul item without any special ability declared!");
|
||||
return;
|
||||
}
|
||||
|
||||
int success = 0;
|
||||
final InventoryUpdate iu = new InventoryUpdate();
|
||||
for (EnsoulItemOption itemOption : _options)
|
||||
{
|
||||
final int position = itemOption.getPosition() - 1;
|
||||
final ItemInstance soulCrystal = player.getInventory().getItemByObjectId(itemOption.getSoulCrystalObjectId());
|
||||
if (soulCrystal == null)
|
||||
{
|
||||
player.sendPacket(SystemMessageId.THE_RUNE_DOES_NOT_FIT);
|
||||
continue;
|
||||
}
|
||||
|
||||
final EnsoulStone stone = EnsoulData.getInstance().getStone(soulCrystal.getId());
|
||||
if (stone == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!stone.getOptions().contains(itemOption.getSoulCrystalOption()))
|
||||
{
|
||||
LOGGER.warning("Player: " + player + " attempting to ensoul item option that stone doesn't contains!");
|
||||
continue;
|
||||
}
|
||||
|
||||
final EnsoulOption option = EnsoulData.getInstance().getOption(itemOption.getSoulCrystalOption());
|
||||
if (option == null)
|
||||
{
|
||||
LOGGER.warning("Player: " + player + " attempting to ensoul item option that doesn't exists!");
|
||||
continue;
|
||||
}
|
||||
|
||||
ItemHolder fee;
|
||||
if (itemOption.getType() == 1)
|
||||
{
|
||||
// Normal Soul Crystal
|
||||
fee = EnsoulData.getInstance().getEnsoulFee(item.getItem().getCrystalType(), position);
|
||||
if (((itemOption.getPosition() == 1) || (itemOption.getPosition() == 2)) && (item.getSpecialAbility(position) != null))
|
||||
{
|
||||
fee = EnsoulData.getInstance().getResoulFee(item.getItem().getCrystalType(), position);
|
||||
}
|
||||
}
|
||||
else if (itemOption.getType() == 2)
|
||||
{
|
||||
// Mystic Soul Crystal
|
||||
fee = EnsoulData.getInstance().getEnsoulFee(item.getItem().getCrystalType(), position + 2); // Client Special type position = 0
|
||||
if ((itemOption.getPosition() == 1) && (item.getAdditionalSpecialAbility(position) != null))
|
||||
{
|
||||
fee = EnsoulData.getInstance().getResoulFee(item.getItem().getCrystalType(), position + 2); // Client Special type position = 0
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
LOGGER.warning("Player: " + player + " attempting to ensoul item option with unhandled type: " + itemOption.getType() + "!");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (fee == null)
|
||||
{
|
||||
LOGGER.warning("Player: " + player + " attempting to ensoul item option that doesn't exists! (unknown fee)");
|
||||
continue;
|
||||
}
|
||||
|
||||
final ItemInstance gemStones = player.getInventory().getItemByItemId(fee.getId());
|
||||
if ((gemStones == null) || (gemStones.getCount() < fee.getCount()))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (player.destroyItem("EnsoulOption", soulCrystal, 1, player, true) && player.destroyItem("EnsoulOption", gemStones, fee.getCount(), player, true))
|
||||
{
|
||||
item.addSpecialAbility(option, position, stone.getSlotType(), true);
|
||||
success = 1;
|
||||
}
|
||||
|
||||
iu.addModifiedItem(soulCrystal);
|
||||
iu.addModifiedItem(gemStones);
|
||||
iu.addModifiedItem(item);
|
||||
}
|
||||
player.sendInventoryUpdate(iu);
|
||||
if (item.isEquipped())
|
||||
{
|
||||
item.applySpecialAbilities();
|
||||
}
|
||||
player.sendPacket(new ExEnsoulResult(success, item));
|
||||
item.updateDatabase(true);
|
||||
}
|
||||
|
||||
static class EnsoulItemOption
|
||||
{
|
||||
private final int _type;
|
||||
private final int _position;
|
||||
private final int _soulCrystalObjectId;
|
||||
private final int _soulCrystalOption;
|
||||
|
||||
EnsoulItemOption(int type, int position, int soulCrystalObjectId, int soulCrystalOption)
|
||||
{
|
||||
_type = type;
|
||||
_position = position;
|
||||
_soulCrystalObjectId = soulCrystalObjectId;
|
||||
_soulCrystalOption = soulCrystalOption;
|
||||
}
|
||||
|
||||
public int getType()
|
||||
{
|
||||
return _type;
|
||||
}
|
||||
|
||||
public int getPosition()
|
||||
{
|
||||
return _position;
|
||||
}
|
||||
|
||||
public int getSoulCrystalObjectId()
|
||||
{
|
||||
return _soulCrystalObjectId;
|
||||
}
|
||||
|
||||
public int getSoulCrystalOption()
|
||||
{
|
||||
return _soulCrystalOption;
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,127 +0,0 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 org.l2jmobius.gameserver.network.clientpackets.ensoul;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import org.l2jmobius.commons.network.PacketReader;
|
||||
import org.l2jmobius.gameserver.data.xml.impl.EnsoulData;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.ensoul.EnsoulOption;
|
||||
import org.l2jmobius.gameserver.model.holders.ItemHolder;
|
||||
import org.l2jmobius.gameserver.model.items.instance.ItemInstance;
|
||||
import org.l2jmobius.gameserver.network.GameClient;
|
||||
import org.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.InventoryUpdate;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.ensoul.ExEnSoulExtractionResult;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
*/
|
||||
public class RequestTryEnSoulExtraction implements IClientIncomingPacket
|
||||
{
|
||||
private int _itemObjectId;
|
||||
private int _type;
|
||||
private int _position;
|
||||
|
||||
@Override
|
||||
public boolean read(GameClient client, PacketReader packet)
|
||||
{
|
||||
_itemObjectId = packet.readD();
|
||||
_type = packet.readC();
|
||||
_position = packet.readC() - 1;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(GameClient client)
|
||||
{
|
||||
final PlayerInstance player = client.getPlayer();
|
||||
if (player == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final ItemInstance item = player.getInventory().getItemByObjectId(_itemObjectId);
|
||||
if (item == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
EnsoulOption option = null;
|
||||
if (_type == 1)
|
||||
{
|
||||
option = item.getSpecialAbility(_position);
|
||||
// If position is invalid, check the other one.
|
||||
if ((option == null) && (_position == 0))
|
||||
{
|
||||
option = item.getSpecialAbility(1);
|
||||
if (option != null)
|
||||
{
|
||||
_position = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (_type == 2)
|
||||
{
|
||||
option = item.getAdditionalSpecialAbility(_position);
|
||||
}
|
||||
if (option == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final Collection<ItemHolder> removalFee = EnsoulData.getInstance().getRemovalFee(item.getItem().getCrystalType());
|
||||
if (removalFee.isEmpty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if player has required items.
|
||||
for (ItemHolder itemHolder : removalFee)
|
||||
{
|
||||
if (player.getInventory().getInventoryItemCount(itemHolder.getId(), -1) < itemHolder.getCount())
|
||||
{
|
||||
player.sendPacket(SystemMessageId.INCORRECT_ITEM_COUNT);
|
||||
player.sendPacket(new ExEnSoulExtractionResult(false, item));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Take required items.
|
||||
for (ItemHolder itemHolder : removalFee)
|
||||
{
|
||||
player.destroyItemByItemId("Rune Extract", itemHolder.getId(), itemHolder.getCount(), player, true);
|
||||
}
|
||||
|
||||
// Remove equipped rune.
|
||||
item.removeSpecialAbility(_position, _type);
|
||||
final InventoryUpdate iu = new InventoryUpdate();
|
||||
iu.addModifiedItem(item);
|
||||
|
||||
// Add rune in player inventory.
|
||||
final int runeId = EnsoulData.getInstance().getStone(_type, option.getId());
|
||||
if (runeId > 0)
|
||||
{
|
||||
iu.addItem(player.addItem("Rune Extract", runeId, 1, player, true));
|
||||
}
|
||||
|
||||
player.sendInventoryUpdate(iu);
|
||||
player.sendPacket(new ExEnSoulExtractionResult(true, item));
|
||||
}
|
||||
}
|
@@ -22,7 +22,6 @@ import org.l2jmobius.gameserver.enums.ItemListType;
|
||||
import org.l2jmobius.gameserver.model.ItemInfo;
|
||||
import org.l2jmobius.gameserver.model.TradeItem;
|
||||
import org.l2jmobius.gameserver.model.buylist.Product;
|
||||
import org.l2jmobius.gameserver.model.ensoul.EnsoulOption;
|
||||
import org.l2jmobius.gameserver.model.itemcontainer.PlayerInventory;
|
||||
import org.l2jmobius.gameserver.model.items.WarehouseItem;
|
||||
import org.l2jmobius.gameserver.model.items.instance.ItemInstance;
|
||||
@@ -97,10 +96,6 @@ public abstract class AbstractItemPacket extends AbstractMaskPacket<ItemListType
|
||||
{
|
||||
packet.writeD(item.getVisualId()); // Item remodel visual ID
|
||||
}
|
||||
if (containsMask(mask, ItemListType.SOUL_CRYSTAL))
|
||||
{
|
||||
writeItemEnsoulOptions(packet, item);
|
||||
}
|
||||
}
|
||||
|
||||
protected static int calculateMask(ItemInfo item)
|
||||
@@ -133,11 +128,6 @@ public abstract class AbstractItemPacket extends AbstractMaskPacket<ItemListType
|
||||
mask |= ItemListType.VISUAL_ID.getMask();
|
||||
}
|
||||
|
||||
if (((item.getSoulCrystalOptions() != null) && !item.getSoulCrystalOptions().isEmpty()) || ((item.getSoulCrystalSpecialOptions() != null) && !item.getSoulCrystalSpecialOptions().isEmpty()))
|
||||
{
|
||||
mask |= ItemListType.SOUL_CRYSTAL.getMask();
|
||||
}
|
||||
|
||||
return mask;
|
||||
}
|
||||
|
||||
@@ -196,29 +186,6 @@ public abstract class AbstractItemPacket extends AbstractMaskPacket<ItemListType
|
||||
}
|
||||
}
|
||||
|
||||
protected void writeItemEnsoulOptions(PacketWriter packet, ItemInfo item)
|
||||
{
|
||||
if (item != null)
|
||||
{
|
||||
packet.writeC(item.getSoulCrystalOptions().size()); // Size of regular soul crystal options.
|
||||
for (EnsoulOption option : item.getSoulCrystalOptions())
|
||||
{
|
||||
packet.writeD(option.getId()); // Regular Soul Crystal Ability ID.
|
||||
}
|
||||
|
||||
packet.writeC(item.getSoulCrystalSpecialOptions().size()); // Size of special soul crystal options.
|
||||
for (EnsoulOption option : item.getSoulCrystalSpecialOptions())
|
||||
{
|
||||
packet.writeD(option.getId()); // Special Soul Crystal Ability ID.
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
packet.writeC(0); // Size of regular soul crystal options.
|
||||
packet.writeC(0); // Size of special soul crystal options.
|
||||
}
|
||||
}
|
||||
|
||||
protected void writeInventoryBlock(PacketWriter packet, PlayerInventory inventory)
|
||||
{
|
||||
if (inventory.hasInventoryBlock())
|
||||
|
@@ -56,7 +56,7 @@ public class DropItem implements IClientOutgoingPacket
|
||||
// packet.writeD(0x01); if above C == true (1) then packet.readD()
|
||||
packet.writeC(_item.getEnchantLevel()); // Grand Crusade
|
||||
packet.writeC(_item.getAugmentation() != null ? 1 : 0); // Grand Crusade
|
||||
packet.writeC(_item.getSpecialAbilities().size()); // Grand Crusade
|
||||
packet.writeC(0x00); // Grand Crusade
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@@ -77,7 +77,8 @@ public class MultiSellList extends AbstractItemPacket
|
||||
packet.writeH(itemEnchantment != null ? itemEnchantment.getEnchantLevel() : 0); // enchant level
|
||||
writeItemAugment(packet, itemEnchantment);
|
||||
writeItemElemental(packet, itemEnchantment);
|
||||
writeItemEnsoulOptions(packet, itemEnchantment);
|
||||
packet.writeC(0x00);
|
||||
packet.writeC(0x00);
|
||||
|
||||
packet.writeH(entry.getProducts().size());
|
||||
packet.writeH(entry.getIngredients().size());
|
||||
@@ -102,7 +103,8 @@ public class MultiSellList extends AbstractItemPacket
|
||||
packet.writeD((int) Math.ceil(product.getChance())); // chance
|
||||
writeItemAugment(packet, displayItemEnchantment);
|
||||
writeItemElemental(packet, displayItemEnchantment);
|
||||
writeItemEnsoulOptions(packet, displayItemEnchantment);
|
||||
packet.writeC(0x00);
|
||||
packet.writeC(0x00);
|
||||
}
|
||||
|
||||
for (ItemChanceHolder ingredient : entry.getIngredients())
|
||||
@@ -115,7 +117,8 @@ public class MultiSellList extends AbstractItemPacket
|
||||
packet.writeH(ingredient.getEnchantmentLevel() > 0 ? ingredient.getEnchantmentLevel() : displayItemEnchantment != null ? displayItemEnchantment.getEnchantLevel() : 0); // enchant level
|
||||
writeItemAugment(packet, displayItemEnchantment);
|
||||
writeItemElemental(packet, displayItemEnchantment);
|
||||
writeItemEnsoulOptions(packet, displayItemEnchantment);
|
||||
packet.writeC(0x00);
|
||||
packet.writeC(0x00);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
@@ -45,7 +45,7 @@ public class SpawnItem implements IClientOutgoingPacket
|
||||
packet.writeD(0x00); // c2
|
||||
packet.writeC(_item.getEnchantLevel()); // Grand Crusade
|
||||
packet.writeC(_item.getAugmentation() != null ? 1 : 0); // Grand Crusade
|
||||
packet.writeC(_item.getSpecialAbilities().size()); // Grand Crusade
|
||||
packet.writeC(0x00); // Grand Crusade
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@@ -1,59 +0,0 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 org.l2jmobius.gameserver.network.serverpackets.ensoul;
|
||||
|
||||
import org.l2jmobius.commons.network.PacketWriter;
|
||||
import org.l2jmobius.gameserver.model.ensoul.EnsoulOption;
|
||||
import org.l2jmobius.gameserver.model.items.instance.ItemInstance;
|
||||
import org.l2jmobius.gameserver.network.OutgoingPackets;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
*/
|
||||
public class ExEnSoulExtractionResult implements IClientOutgoingPacket
|
||||
{
|
||||
private final boolean _success;
|
||||
private final ItemInstance _item;
|
||||
|
||||
public ExEnSoulExtractionResult(boolean success, ItemInstance item)
|
||||
{
|
||||
_success = success;
|
||||
_item = item;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean write(PacketWriter packet)
|
||||
{
|
||||
OutgoingPackets.EX_ENSOUL_EXTRACTION_RESULT.writeId(packet);
|
||||
packet.writeC(_success ? 1 : 0);
|
||||
if (_success)
|
||||
{
|
||||
packet.writeC(_item.getSpecialAbilities().size());
|
||||
for (EnsoulOption option : _item.getSpecialAbilities())
|
||||
{
|
||||
packet.writeD(option.getId());
|
||||
}
|
||||
packet.writeC(_item.getAdditionalSpecialAbilities().size());
|
||||
for (EnsoulOption option : _item.getAdditionalSpecialAbilities())
|
||||
{
|
||||
packet.writeD(option.getId());
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
@@ -1,56 +0,0 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 org.l2jmobius.gameserver.network.serverpackets.ensoul;
|
||||
|
||||
import org.l2jmobius.commons.network.PacketWriter;
|
||||
import org.l2jmobius.gameserver.model.ensoul.EnsoulOption;
|
||||
import org.l2jmobius.gameserver.model.items.instance.ItemInstance;
|
||||
import org.l2jmobius.gameserver.network.OutgoingPackets;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
|
||||
|
||||
/**
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public class ExEnsoulResult implements IClientOutgoingPacket
|
||||
{
|
||||
private final int _success;
|
||||
private final ItemInstance _item;
|
||||
|
||||
public ExEnsoulResult(int success, ItemInstance item)
|
||||
{
|
||||
_success = success;
|
||||
_item = item;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean write(PacketWriter packet)
|
||||
{
|
||||
OutgoingPackets.EX_ENSOUL_RESULT.writeId(packet);
|
||||
packet.writeC(_success); // success / failure
|
||||
packet.writeC(_item.getSpecialAbilities().size());
|
||||
for (EnsoulOption option : _item.getSpecialAbilities())
|
||||
{
|
||||
packet.writeD(option.getId());
|
||||
}
|
||||
packet.writeC(_item.getAdditionalSpecialAbilities().size());
|
||||
for (EnsoulOption option : _item.getAdditionalSpecialAbilities())
|
||||
{
|
||||
packet.writeD(option.getId());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
@@ -1,40 +0,0 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 org.l2jmobius.gameserver.network.serverpackets.ensoul;
|
||||
|
||||
import org.l2jmobius.commons.network.PacketWriter;
|
||||
import org.l2jmobius.gameserver.network.OutgoingPackets;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
*/
|
||||
public class ExShowEnsoulExtractionWindow implements IClientOutgoingPacket
|
||||
{
|
||||
public static final ExShowEnsoulExtractionWindow STATIC_PACKET = new ExShowEnsoulExtractionWindow();
|
||||
|
||||
private ExShowEnsoulExtractionWindow()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean write(PacketWriter packet)
|
||||
{
|
||||
OutgoingPackets.EX_ENSOUL_EXTRACTION_SHOW.writeId(packet);
|
||||
return true;
|
||||
}
|
||||
}
|
@@ -1,40 +0,0 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 org.l2jmobius.gameserver.network.serverpackets.ensoul;
|
||||
|
||||
import org.l2jmobius.commons.network.PacketWriter;
|
||||
import org.l2jmobius.gameserver.network.OutgoingPackets;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
|
||||
|
||||
/**
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public class ExShowEnsoulWindow implements IClientOutgoingPacket
|
||||
{
|
||||
public static final ExShowEnsoulWindow STATIC_PACKET = new ExShowEnsoulWindow();
|
||||
|
||||
private ExShowEnsoulWindow()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean write(PacketWriter packet)
|
||||
{
|
||||
OutgoingPackets.EX_SHOW_ENSOUL_WINDOW.writeId(packet);
|
||||
return true;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user