Replaced Augmentation with Variation data.
Adapted from: L2jUnity free files.
This commit is contained in:
@@ -1,6 +0,0 @@
|
||||
DROP TABLE IF EXISTS `item_attributes`;
|
||||
CREATE TABLE IF NOT EXISTS `item_attributes` (
|
||||
`itemId` int(11) NOT NULL DEFAULT 0,
|
||||
`augAttributes` int(11) NOT NULL DEFAULT -1,
|
||||
PRIMARY KEY (`itemId`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
7
L2J_Mobius_Classic_2.0_Saviors/dist/db_installer/sql/game/item_variations.sql
vendored
Normal file
7
L2J_Mobius_Classic_2.0_Saviors/dist/db_installer/sql/game/item_variations.sql
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
CREATE TABLE IF NOT EXISTS `item_variations` (
|
||||
`itemId` INT(11) NOT NULL,
|
||||
`mineralId` INT(11) NOT NULL DEFAULT 0,
|
||||
`option1` INT(11) NOT NULL,
|
||||
`option2` INT(11) NOT NULL,
|
||||
PRIMARY KEY (`itemId`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
@@ -3,7 +3,7 @@
|
||||
<!-- Documentation: -->
|
||||
<!-- <instance id="NPC ID of the auctioneer" day_of_week="1 - Monday, 7 - Sunday" hour_of_day="0-23" minute_of_hour="0-59"> -->
|
||||
<!-- <item auctionItemId="1" itemId="9901" itemCount="1" auctionInitBid="100000" auctionLenght="300 (in minutes)"> -->
|
||||
<!-- <extra enchant_level="15" augmentation_id="you can take it from item_attributes table" augmentation_skill_id="3241" augmentation_skill_lvl="10" /> -->
|
||||
<!-- <extra enchant_level="15" /> -->
|
||||
<!-- </item> -->
|
||||
<!-- </instance> -->
|
||||
<!-- instead of day_of_week you can use interval between auction in days -->
|
||||
|
||||
17053
L2J_Mobius_Classic_2.0_Saviors/dist/game/data/stats/augmentation/Variations.xml
vendored
Normal file
17053
L2J_Mobius_Classic_2.0_Saviors/dist/game/data/stats/augmentation/Variations.xml
vendored
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
94
L2J_Mobius_Classic_2.0_Saviors/dist/game/data/xsd/Variations.xsd
vendored
Normal file
94
L2J_Mobius_Classic_2.0_Saviors/dist/game/data/xsd/Variations.xsd
vendored
Normal file
@@ -0,0 +1,94 @@
|
||||
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
|
||||
<xs:element name="list">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="variations">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="variation" maxOccurs="unbounded" minOccurs="0">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="optionGroup" maxOccurs="unbounded" minOccurs="0">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="optionCategory" maxOccurs="unbounded" minOccurs="0">
|
||||
<xs:complexType>
|
||||
<xs:choice maxOccurs="unbounded" minOccurs="0">
|
||||
<xs:element name="option">
|
||||
<xs:complexType>
|
||||
<xs:attribute type="xs:int" name="id" use="optional"/>
|
||||
<xs:attribute type="xs:double" name="chance" use="optional"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="optionRange">
|
||||
<xs:complexType>
|
||||
<xs:attribute type="xs:int" name="from" use="optional"/>
|
||||
<xs:attribute type="xs:int" name="to" use="optional"/>
|
||||
<xs:attribute type="xs:double" name="chance" use="optional"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:choice>
|
||||
<xs:attribute type="xs:float" name="chance" use="optional"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
<xs:attribute type="xs:string" name="weaponType" use="optional"/>
|
||||
<xs:attribute type="xs:byte" name="order" use="optional"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
<xs:attribute type="xs:int" name="mineralId" use="optional"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="itemGroups">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="itemGroup" maxOccurs="unbounded" minOccurs="0">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="item" maxOccurs="unbounded" minOccurs="0">
|
||||
<xs:complexType>
|
||||
<xs:attribute type="xs:int" name="id" use="optional"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
<xs:attribute type="xs:byte" name="id" use="optional"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="fees">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="fee" maxOccurs="unbounded" minOccurs="0">
|
||||
<xs:complexType>
|
||||
<xs:choice maxOccurs="unbounded" minOccurs="0">
|
||||
<xs:element name="mineral">
|
||||
<xs:complexType>
|
||||
<xs:attribute type="xs:int" name="id" use="optional"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="mineralRange">
|
||||
<xs:complexType>
|
||||
<xs:attribute type="xs:int" name="from" use="optional"/>
|
||||
<xs:attribute type="xs:int" name="to" use="optional"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:choice>
|
||||
<xs:attribute type="xs:int" name="itemGroup" use="optional"/>
|
||||
<xs:attribute type="xs:int" name="itemId" use="optional"/>
|
||||
<xs:attribute type="xs:long" name="itemCount" use="optional"/>
|
||||
<xs:attribute type="xs:long" name="cancelFee" use="optional"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:schema>
|
||||
@@ -91,7 +91,7 @@ import com.l2jmobius.gameserver.data.xml.impl.SpawnsData;
|
||||
import com.l2jmobius.gameserver.data.xml.impl.StaticObjectData;
|
||||
import com.l2jmobius.gameserver.data.xml.impl.TeleportersData;
|
||||
import com.l2jmobius.gameserver.data.xml.impl.TransformData;
|
||||
import com.l2jmobius.gameserver.datatables.AugmentationData;
|
||||
import com.l2jmobius.gameserver.data.xml.impl.VariationData;
|
||||
import com.l2jmobius.gameserver.datatables.BotReportTable;
|
||||
import com.l2jmobius.gameserver.datatables.EventDroplist;
|
||||
import com.l2jmobius.gameserver.datatables.ItemTable;
|
||||
@@ -225,7 +225,7 @@ public class GameServer
|
||||
EnchantItemOptionsData.getInstance();
|
||||
ItemCrystallizationData.getInstance();
|
||||
OptionData.getInstance();
|
||||
AugmentationData.getInstance();
|
||||
VariationData.getInstance();
|
||||
EnsoulData.getInstance();
|
||||
EnchantItemHPBonusData.getInstance();
|
||||
BuyListData.getInstance();
|
||||
|
||||
@@ -0,0 +1,270 @@
|
||||
/*
|
||||
* 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 com.l2jmobius.gameserver.data.xml.impl;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.w3c.dom.Document;
|
||||
|
||||
import com.l2jmobius.commons.util.IGameXmlReader;
|
||||
import com.l2jmobius.gameserver.datatables.ItemTable;
|
||||
import com.l2jmobius.gameserver.model.VariationInstance;
|
||||
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
|
||||
import com.l2jmobius.gameserver.model.options.OptionDataCategory;
|
||||
import com.l2jmobius.gameserver.model.options.OptionDataGroup;
|
||||
import com.l2jmobius.gameserver.model.options.Options;
|
||||
import com.l2jmobius.gameserver.model.options.Variation;
|
||||
import com.l2jmobius.gameserver.model.options.VariationFee;
|
||||
import com.l2jmobius.gameserver.model.options.VariationWeaponType;
|
||||
|
||||
/**
|
||||
* @author Pere
|
||||
*/
|
||||
public class VariationData implements IGameXmlReader
|
||||
{
|
||||
private static final Logger LOGGER = Logger.getLogger(VariationData.class.getSimpleName());
|
||||
|
||||
private final Map<Integer, Variation> _variations = new HashMap<>();
|
||||
private final Map<Integer, Map<Integer, VariationFee>> _fees = new HashMap<>();
|
||||
|
||||
protected VariationData()
|
||||
{
|
||||
load();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load()
|
||||
{
|
||||
_variations.clear();
|
||||
_fees.clear();
|
||||
parseDatapackFile("data/stats/augmentation/Variations.xml");
|
||||
LOGGER.info(getClass().getSimpleName() + ": Loaded " + _variations.size() + " Variations.");
|
||||
LOGGER.info(getClass().getSimpleName() + ": Loaded " + _fees.size() + " Fees.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void parseDocument(Document doc, File f)
|
||||
{
|
||||
forEach(doc, "list", listNode ->
|
||||
{
|
||||
forEach(listNode, "variations", variationsNode ->
|
||||
{
|
||||
forEach(variationsNode, "variation", variationNode ->
|
||||
{
|
||||
final int mineralId = parseInteger(variationNode.getAttributes(), "mineralId");
|
||||
if (ItemTable.getInstance().getTemplate(mineralId) == null)
|
||||
{
|
||||
LOGGER.warning(getClass().getSimpleName() + ": Mineral with item id " + mineralId + " was not found.");
|
||||
}
|
||||
final Variation variation = new Variation(mineralId);
|
||||
|
||||
forEach(variationNode, "optionGroup", groupNode ->
|
||||
{
|
||||
final String weaponTypeString = parseString(groupNode.getAttributes(), "weaponType").toUpperCase();
|
||||
final VariationWeaponType weaponType = VariationWeaponType.valueOf(weaponTypeString);
|
||||
final int order = parseInteger(groupNode.getAttributes(), "order");
|
||||
|
||||
final List<OptionDataCategory> sets = new ArrayList<>();
|
||||
forEach(groupNode, "optionCategory", categoryNode ->
|
||||
{
|
||||
final double chance = parseDouble(categoryNode.getAttributes(), "chance");
|
||||
final Map<Options, Double> options = new HashMap<>();
|
||||
forEach(categoryNode, "option", optionNode ->
|
||||
{
|
||||
final double optionChance = parseDouble(optionNode.getAttributes(), "chance");
|
||||
final int optionId = parseInteger(optionNode.getAttributes(), "id");
|
||||
final Options opt = OptionData.getInstance().getOptions(optionId);
|
||||
if (opt == null)
|
||||
{
|
||||
LOGGER.warning(getClass().getSimpleName() + ": Null option for id " + optionId);
|
||||
return;
|
||||
}
|
||||
options.put(opt, optionChance);
|
||||
});
|
||||
forEach(categoryNode, "optionRange", optionNode ->
|
||||
{
|
||||
final double optionChance = parseDouble(optionNode.getAttributes(), "chance");
|
||||
final int fromId = parseInteger(optionNode.getAttributes(), "from");
|
||||
final int toId = parseInteger(optionNode.getAttributes(), "to");
|
||||
for (int id = fromId; id <= toId; id++)
|
||||
{
|
||||
final Options op = OptionData.getInstance().getOptions(id);
|
||||
if (op == null)
|
||||
{
|
||||
LOGGER.warning(getClass().getSimpleName() + ": Null option for id " + id);
|
||||
return;
|
||||
}
|
||||
options.put(op, optionChance);
|
||||
}
|
||||
});
|
||||
|
||||
sets.add(new OptionDataCategory(options, chance));
|
||||
});
|
||||
|
||||
variation.setEffectGroup(weaponType, order, new OptionDataGroup(sets));
|
||||
});
|
||||
|
||||
_variations.put(mineralId, variation);
|
||||
});
|
||||
});
|
||||
|
||||
final Map<Integer, List<Integer>> itemGroups = new HashMap<>();
|
||||
forEach(listNode, "itemGroups", variationsNode ->
|
||||
{
|
||||
forEach(variationsNode, "itemGroup", variationNode ->
|
||||
{
|
||||
final int id = parseInteger(variationNode.getAttributes(), "id");
|
||||
final List<Integer> items = new ArrayList<>();
|
||||
forEach(variationNode, "item", itemNode ->
|
||||
{
|
||||
final int itemId = parseInteger(itemNode.getAttributes(), "id");
|
||||
if (ItemTable.getInstance().getTemplate(itemId) == null)
|
||||
{
|
||||
LOGGER.warning(getClass().getSimpleName() + ": Item with id " + itemId + " was not found.");
|
||||
}
|
||||
items.add(itemId);
|
||||
});
|
||||
|
||||
itemGroups.put(id, items);
|
||||
});
|
||||
});
|
||||
|
||||
forEach(listNode, "fees", variationNode ->
|
||||
{
|
||||
forEach(variationNode, "fee", feeNode ->
|
||||
{
|
||||
final int itemGroupId = parseInteger(feeNode.getAttributes(), "itemGroup");
|
||||
final List<Integer> itemGroup = itemGroups.get(itemGroupId);
|
||||
final int itemId = parseInteger(feeNode.getAttributes(), "itemId");
|
||||
final int itemCount = parseInteger(feeNode.getAttributes(), "itemCount");
|
||||
final int cancelFee = parseInteger(feeNode.getAttributes(), "cancelFee");
|
||||
if (ItemTable.getInstance().getTemplate(itemId) == null)
|
||||
{
|
||||
LOGGER.warning(getClass().getSimpleName() + ": Item with id " + itemId + " was not found.");
|
||||
}
|
||||
|
||||
final VariationFee fee = new VariationFee(itemId, itemCount, cancelFee);
|
||||
final Map<Integer, VariationFee> feeByMinerals = new HashMap<>();
|
||||
forEach(feeNode, "mineral", mineralNode ->
|
||||
{
|
||||
final int mId = parseInteger(mineralNode.getAttributes(), "id");
|
||||
feeByMinerals.put(mId, fee);
|
||||
});
|
||||
forEach(feeNode, "mineralRange", mineralNode ->
|
||||
{
|
||||
final int fromId = parseInteger(mineralNode.getAttributes(), "from");
|
||||
final int toId = parseInteger(mineralNode.getAttributes(), "to");
|
||||
for (int id = fromId; id <= toId; id++)
|
||||
{
|
||||
feeByMinerals.put(id, fee);
|
||||
}
|
||||
});
|
||||
|
||||
for (int item : itemGroup)
|
||||
{
|
||||
Map<Integer, VariationFee> fees = _fees.computeIfAbsent(item, k -> new HashMap<>());
|
||||
fees.putAll(feeByMinerals);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
public int getVariationCount()
|
||||
{
|
||||
return _variations.size();
|
||||
}
|
||||
|
||||
public int getFeeCount()
|
||||
{
|
||||
return _fees.size();
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate a new random variation instance
|
||||
* @param variation The variation template to generate the variation instance from
|
||||
* @param targetItem The item on which the variation will be applied
|
||||
* @return VariationInstance
|
||||
*/
|
||||
public VariationInstance generateRandomVariation(Variation variation, L2ItemInstance targetItem)
|
||||
{
|
||||
final VariationWeaponType weaponType = ((targetItem.getWeaponItem() != null) && targetItem.getWeaponItem().isMagicWeapon()) ? VariationWeaponType.MAGE : VariationWeaponType.WARRIOR;
|
||||
return generateRandomVariation(variation, weaponType);
|
||||
}
|
||||
|
||||
private VariationInstance generateRandomVariation(Variation variation, VariationWeaponType weaponType)
|
||||
{
|
||||
Options option1 = variation.getRandomEffect(weaponType, 0);
|
||||
Options option2 = variation.getRandomEffect(weaponType, 1);
|
||||
return ((option1 != null) && (option2 != null)) ? new VariationInstance(variation.getMineralId(), option1, option2) : null;
|
||||
}
|
||||
|
||||
public final Variation getVariation(int mineralId)
|
||||
{
|
||||
return _variations.get(mineralId);
|
||||
}
|
||||
|
||||
public final VariationFee getFee(int itemId, int mineralId)
|
||||
{
|
||||
return _fees.getOrDefault(itemId, Collections.emptyMap()).get(mineralId);
|
||||
}
|
||||
|
||||
public final long getCancelFee(int itemId, int mineralId)
|
||||
{
|
||||
final Map<Integer, VariationFee> fees = _fees.get(itemId);
|
||||
if (fees == null)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
VariationFee fee = fees.get(mineralId);
|
||||
if (fee == null)
|
||||
{
|
||||
// FIXME This will happen when the data is pre-rework or when augments were manually given, but still that's a cheap solution
|
||||
LOGGER.warning(getClass().getSimpleName() + ": Cancellation fee not found for item [" + itemId + "] and mineral [" + mineralId + "]");
|
||||
fee = fees.values().iterator().next();
|
||||
if (fee == null)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
return fee.getCancelFee();
|
||||
}
|
||||
|
||||
public final boolean hasFeeData(int itemId)
|
||||
{
|
||||
Map<Integer, VariationFee> itemFees = _fees.get(itemId);
|
||||
return (itemFees != null) && !itemFees.isEmpty();
|
||||
}
|
||||
|
||||
public static VariationData getInstance()
|
||||
{
|
||||
return SingletonHolder._instance;
|
||||
}
|
||||
|
||||
private static class SingletonHolder
|
||||
{
|
||||
protected static final VariationData _instance = new VariationData();
|
||||
}
|
||||
}
|
||||
@@ -1,981 +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 com.l2jmobius.gameserver.datatables;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.NamedNodeMap;
|
||||
import org.w3c.dom.Node;
|
||||
|
||||
import com.l2jmobius.Config;
|
||||
import com.l2jmobius.commons.util.Rnd;
|
||||
import com.l2jmobius.gameserver.data.xml.impl.OptionData;
|
||||
import com.l2jmobius.gameserver.model.Augmentation;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
|
||||
import com.l2jmobius.gameserver.model.options.Options;
|
||||
import com.l2jmobius.gameserver.network.clientpackets.AbstractRefinePacket;
|
||||
|
||||
/**
|
||||
* Loads augmentation bonuses and skills.
|
||||
* @author durgus, Gigiikun, Sandro, UnAfraid
|
||||
*/
|
||||
public class AugmentationData
|
||||
{
|
||||
// Zoey76: TODO: Implement using IGameXmlReader.
|
||||
private static final Logger LOGGER = Logger.getLogger(AugmentationData.class.getName());
|
||||
|
||||
// stats
|
||||
private static final int STAT_BLOCKSIZE = 3640;
|
||||
private static final int STAT_SUBBLOCKSIZE = 91;
|
||||
public static final int MIN_SKILL_ID = STAT_BLOCKSIZE * 4;
|
||||
|
||||
// skills
|
||||
private static final int BLUE_START = 14561;
|
||||
private static final int SKILLS_BLOCKSIZE = 178;
|
||||
|
||||
// basestats
|
||||
private static final int BASESTAT_STR = 16341;
|
||||
private static final int BASESTAT_MEN = 16344;
|
||||
|
||||
// accessory
|
||||
private static final int ACC_START = 16669;
|
||||
private static final int ACC_BLOCKS_NUM = 10;
|
||||
private static final int ACC_STAT_SUBBLOCKSIZE = 21;
|
||||
|
||||
private static final int ACC_RING_START = ACC_START;
|
||||
private static final int ACC_RING_SKILLS = 18;
|
||||
private static final int ACC_RING_BLOCKSIZE = ACC_RING_SKILLS + (4 * ACC_STAT_SUBBLOCKSIZE);
|
||||
private static final int ACC_RING_END = (ACC_RING_START + (ACC_BLOCKS_NUM * ACC_RING_BLOCKSIZE)) - 1;
|
||||
|
||||
private static final int ACC_EAR_START = ACC_RING_END + 1;
|
||||
private static final int ACC_EAR_SKILLS = 18;
|
||||
private static final int ACC_EAR_BLOCKSIZE = ACC_EAR_SKILLS + (4 * ACC_STAT_SUBBLOCKSIZE);
|
||||
private static final int ACC_EAR_END = (ACC_EAR_START + (ACC_BLOCKS_NUM * ACC_EAR_BLOCKSIZE)) - 1;
|
||||
|
||||
private static final int ACC_NECK_START = ACC_EAR_END + 1;
|
||||
private static final int ACC_NECK_SKILLS = 24;
|
||||
private static final int ACC_NECK_BLOCKSIZE = ACC_NECK_SKILLS + (4 * ACC_STAT_SUBBLOCKSIZE);
|
||||
|
||||
private final List<List<Integer>> _blueSkills = new ArrayList<>();
|
||||
private final List<List<Integer>> _purpleSkills = new ArrayList<>();
|
||||
private final List<List<Integer>> _redSkills = new ArrayList<>();
|
||||
private final List<List<Integer>> _yellowSkills = new ArrayList<>();
|
||||
|
||||
private final Map<Integer, Augmentation> _augmentations = new HashMap<>();
|
||||
private final List<AugmentationChance> _augmentationChances = new ArrayList<>();
|
||||
private final List<augmentationChanceAcc> _augmentationChancesAcc = new ArrayList<>();
|
||||
private final List<Integer> _augmentationStones = new ArrayList<>();
|
||||
|
||||
protected AugmentationData()
|
||||
{
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
_blueSkills.add(new ArrayList<>());
|
||||
_purpleSkills.add(new ArrayList<>());
|
||||
_redSkills.add(new ArrayList<>());
|
||||
_yellowSkills.add(new ArrayList<>());
|
||||
}
|
||||
|
||||
load();
|
||||
if (!Config.RETAIL_LIKE_AUGMENTATION)
|
||||
{
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
LOGGER.info(getClass().getSimpleName() + ": Loaded: " + _blueSkills.get(i).size() + " blue, " + _purpleSkills.get(i).size() + " purple and " + _redSkills.get(i).size() + " red skills for lifeStoneLevel " + i);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
LOGGER.info(getClass().getSimpleName() + ": Loaded: " + _augmentationChances.size() + " augmentations.");
|
||||
// Accessories disabled for Classic.
|
||||
// LOGGER.info(getClass().getSimpleName() + ": Loaded: " + _augmentationChancesAcc.size() + " accessory augmentations.");
|
||||
}
|
||||
}
|
||||
|
||||
public class AugmentationChance
|
||||
{
|
||||
private final String _WeaponType;
|
||||
private final int _StoneId;
|
||||
private final int _VariationId;
|
||||
private final int _CategoryChance;
|
||||
private final int _AugmentId;
|
||||
private final float _AugmentChance;
|
||||
|
||||
public AugmentationChance(String WeaponType, int StoneId, int VariationId, int CategoryChance, int AugmentId, float AugmentChance)
|
||||
{
|
||||
_WeaponType = WeaponType;
|
||||
_StoneId = StoneId;
|
||||
_VariationId = VariationId;
|
||||
_CategoryChance = CategoryChance;
|
||||
_AugmentId = AugmentId;
|
||||
_AugmentChance = AugmentChance;
|
||||
}
|
||||
|
||||
public String getWeaponType()
|
||||
{
|
||||
return _WeaponType;
|
||||
}
|
||||
|
||||
public int getStoneId()
|
||||
{
|
||||
return _StoneId;
|
||||
}
|
||||
|
||||
public int getVariationId()
|
||||
{
|
||||
return _VariationId;
|
||||
}
|
||||
|
||||
public int getCategoryChance()
|
||||
{
|
||||
return _CategoryChance;
|
||||
}
|
||||
|
||||
public int getAugmentId()
|
||||
{
|
||||
return _AugmentId;
|
||||
}
|
||||
|
||||
public float getAugmentChance()
|
||||
{
|
||||
return _AugmentChance;
|
||||
}
|
||||
}
|
||||
|
||||
public class augmentationChanceAcc
|
||||
{
|
||||
private final String _WeaponType;
|
||||
private final int _StoneId;
|
||||
private final int _VariationId;
|
||||
private final int _CategoryChance;
|
||||
private final int _AugmentId;
|
||||
private final float _AugmentChance;
|
||||
|
||||
public augmentationChanceAcc(String WeaponType, int StoneId, int VariationId, int CategoryChance, int AugmentId, float AugmentChance)
|
||||
{
|
||||
_WeaponType = WeaponType;
|
||||
_StoneId = StoneId;
|
||||
_VariationId = VariationId;
|
||||
_CategoryChance = CategoryChance;
|
||||
_AugmentId = AugmentId;
|
||||
_AugmentChance = AugmentChance;
|
||||
}
|
||||
|
||||
public String getWeaponType()
|
||||
{
|
||||
return _WeaponType;
|
||||
}
|
||||
|
||||
public int getStoneId()
|
||||
{
|
||||
return _StoneId;
|
||||
}
|
||||
|
||||
public int getVariationId()
|
||||
{
|
||||
return _VariationId;
|
||||
}
|
||||
|
||||
public int getCategoryChance()
|
||||
{
|
||||
return _CategoryChance;
|
||||
}
|
||||
|
||||
public int getAugmentId()
|
||||
{
|
||||
return _AugmentId;
|
||||
}
|
||||
|
||||
public float getAugmentChance()
|
||||
{
|
||||
return _AugmentChance;
|
||||
}
|
||||
}
|
||||
|
||||
private void load()
|
||||
{
|
||||
// Load stats
|
||||
final DocumentBuilderFactory factory2 = DocumentBuilderFactory.newInstance();
|
||||
factory2.setValidating(false);
|
||||
factory2.setIgnoringComments(true);
|
||||
|
||||
// Load the skillmap
|
||||
// Note: the skillmap data is only used when generating new augmentations
|
||||
// the client expects a different id in order to display the skill in the
|
||||
// items description...
|
||||
if (!Config.RETAIL_LIKE_AUGMENTATION)
|
||||
{
|
||||
try
|
||||
{
|
||||
int badAugmantData = 0;
|
||||
final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
|
||||
factory.setValidating(false);
|
||||
factory.setIgnoringComments(true);
|
||||
|
||||
final File file = new File(Config.DATAPACK_ROOT + "/data/stats/augmentation/augmentation_skillmap.xml");
|
||||
if (!file.exists())
|
||||
{
|
||||
LOGGER.warning(getClass().getSimpleName() + ": ERROR The augmentation skillmap file is missing.");
|
||||
return;
|
||||
}
|
||||
|
||||
final Document doc = factory.newDocumentBuilder().parse(file);
|
||||
|
||||
for (Node n = doc.getFirstChild(); n != null; n = n.getNextSibling())
|
||||
{
|
||||
if ("list".equalsIgnoreCase(n.getNodeName()))
|
||||
{
|
||||
for (Node d = n.getFirstChild(); d != null; d = d.getNextSibling())
|
||||
{
|
||||
if ("augmentation".equalsIgnoreCase(d.getNodeName()))
|
||||
{
|
||||
NamedNodeMap attrs = d.getAttributes();
|
||||
int skillId = 0;
|
||||
final int augmentationId = Integer.parseInt(attrs.getNamedItem("id").getNodeValue());
|
||||
int skillLvL = 0;
|
||||
String type = "blue";
|
||||
|
||||
for (Node cd = d.getFirstChild(); cd != null; cd = cd.getNextSibling())
|
||||
{
|
||||
if ("skillId".equalsIgnoreCase(cd.getNodeName()))
|
||||
{
|
||||
attrs = cd.getAttributes();
|
||||
skillId = Integer.parseInt(attrs.getNamedItem("val").getNodeValue());
|
||||
}
|
||||
else if ("skillLevel".equalsIgnoreCase(cd.getNodeName()))
|
||||
{
|
||||
attrs = cd.getAttributes();
|
||||
skillLvL = Integer.parseInt(attrs.getNamedItem("val").getNodeValue());
|
||||
}
|
||||
else if ("type".equalsIgnoreCase(cd.getNodeName()))
|
||||
{
|
||||
attrs = cd.getAttributes();
|
||||
type = attrs.getNamedItem("val").getNodeValue();
|
||||
}
|
||||
}
|
||||
if ((skillId == 0) || (skillLvL == 0))
|
||||
{
|
||||
badAugmantData++;
|
||||
continue;
|
||||
}
|
||||
final int k = (augmentationId - BLUE_START) / SKILLS_BLOCKSIZE;
|
||||
|
||||
if (type.equalsIgnoreCase("blue"))
|
||||
{
|
||||
_blueSkills.get(k).add(augmentationId);
|
||||
}
|
||||
else if (type.equalsIgnoreCase("purple"))
|
||||
{
|
||||
_purpleSkills.get(k).add(augmentationId);
|
||||
}
|
||||
else
|
||||
{
|
||||
_redSkills.get(k).add(augmentationId);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (badAugmantData != 0)
|
||||
{
|
||||
LOGGER.info(getClass().getSimpleName() + ": " + badAugmantData + " bad skill(s) were skipped.");
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LOGGER.log(Level.WARNING, getClass().getSimpleName() + ": ERROR parsing augmentation_skillmap.xml.", e);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
|
||||
factory.setValidating(false);
|
||||
factory.setIgnoringComments(true);
|
||||
|
||||
final File aFile = new File(Config.DATAPACK_ROOT + "/data/stats/augmentation/retailchances.xml");
|
||||
if (aFile.exists())
|
||||
{
|
||||
Document aDoc = null;
|
||||
|
||||
try
|
||||
{
|
||||
aDoc = factory.newDocumentBuilder().parse(aFile);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
return;
|
||||
}
|
||||
String aWeaponType = null;
|
||||
int aStoneId = 0;
|
||||
int aVariationId = 0;
|
||||
int aCategoryChance = 0;
|
||||
int aAugmentId = 0;
|
||||
float aAugmentChance = 0;
|
||||
|
||||
for (Node l = aDoc.getFirstChild(); l != null; l = l.getNextSibling())
|
||||
{
|
||||
if (l.getNodeName().equals("list"))
|
||||
{
|
||||
NamedNodeMap aNodeAttributes = null;
|
||||
|
||||
// System.out.println("We're going through the list now.");
|
||||
for (Node n = l.getFirstChild(); n != null; n = n.getNextSibling())
|
||||
{
|
||||
if (n.getNodeName().equals("weapon"))
|
||||
{
|
||||
aNodeAttributes = n.getAttributes();
|
||||
|
||||
aWeaponType = aNodeAttributes.getNamedItem("type").getNodeValue();
|
||||
|
||||
// System.out.println("Now showing Augmentations for " + aWeaponType + " Weapons.");
|
||||
for (Node c = n.getFirstChild(); c != null; c = c.getNextSibling())
|
||||
{
|
||||
if (c.getNodeName().equals("stone"))
|
||||
{
|
||||
aNodeAttributes = c.getAttributes();
|
||||
|
||||
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("probability").getNodeValue());
|
||||
|
||||
// System.out.println("Stone Id: " + aStoneId + ", Variation Id: " + aVariationId + ", Category Chances: " + aCategoryChance);
|
||||
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());
|
||||
|
||||
if (OptionData.getInstance().getOptions(aAugmentId) != null)
|
||||
{
|
||||
if (!_augmentationStones.contains(aStoneId))
|
||||
{
|
||||
_augmentationStones.add(aStoneId);
|
||||
}
|
||||
_augmentationChances.add(new AugmentationChance(aWeaponType, aStoneId, aVariationId, aCategoryChance, aAugmentId, aAugmentChance));
|
||||
}
|
||||
else
|
||||
{
|
||||
LOGGER.warning(getClass().getSimpleName() + ": Missing augment " + aAugmentId + " for stone " + aStoneId + " variation " + aVariationId + ".");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
LOGGER.warning(getClass().getSimpleName() + ": ERROR The retailchances.xml data file is missing.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
// Accessories disabled for Classic.
|
||||
/**
|
||||
* if (Config.RETAIL_LIKE_AUGMENTATION_ACCESSORY) { final DocumentBuilderFactory factory3 = DocumentBuilderFactory.newInstance(); factory3.setValidating(false); factory3.setIgnoringComments(true); final File aFile3 = new File(Config.DATAPACK_ROOT +
|
||||
* "/data/stats/augmentation/retailchances_accessory.xml"); if (aFile3.exists()) { Document aDoc = null; try { aDoc = factory3.newDocumentBuilder().parse(aFile3); } catch (Exception e) { e.printStackTrace(); return; } String aWeaponType = null; int aStoneId = 0; int aVariationId = 0; int
|
||||
* aCategoryChance = 0; int aAugmentId = 0; float aAugmentChance = 0; for (Node l = aDoc.getFirstChild(); l != null; l = l.getNextSibling()) { if (l.getNodeName().equals("list")) { NamedNodeMap aNodeAttributes = null; for (Node n = l.getFirstChild(); n != null; n = n.getNextSibling()) { if
|
||||
* (n.getNodeName().equals("weapon")) { aNodeAttributes = n.getAttributes(); aWeaponType = aNodeAttributes.getNamedItem("type").getNodeValue(); for (Node c = n.getFirstChild(); c != null; c = c.getNextSibling()) { if (c.getNodeName().equals("stone")) { aNodeAttributes = c.getAttributes();
|
||||
* 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("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()); if (!_augmentationStones.contains(aStoneId)) { _augmentationStones.add(aStoneId); } _augmentationChancesAcc.add(new
|
||||
* augmentationChanceAcc(aWeaponType, aStoneId, aVariationId, aCategoryChance, aAugmentId, aAugmentChance)); } } } } } } } } } } } } } else { LOGGER.warning(getClass().getSimpleName() + ": ERROR The retailchances_accessory.xml data file is missing."); } }
|
||||
*/
|
||||
}
|
||||
|
||||
public Augmentation getAugmentation(int id)
|
||||
{
|
||||
return _augmentations.computeIfAbsent(id, k -> new Augmentation(k));
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate a new random augmentation
|
||||
* @param lifeStoneLevel
|
||||
* @param lifeStoneGrade
|
||||
* @param bodyPart
|
||||
* @param lifeStoneId
|
||||
* @param targetItem
|
||||
* @return
|
||||
*/
|
||||
public Augmentation generateRandomAugmentation(int lifeStoneLevel, int lifeStoneGrade, int bodyPart, int lifeStoneId, L2ItemInstance targetItem)
|
||||
{
|
||||
switch (bodyPart)
|
||||
{
|
||||
case L2Item.SLOT_LR_FINGER:
|
||||
case L2Item.SLOT_LR_EAR:
|
||||
case L2Item.SLOT_NECK:
|
||||
{
|
||||
return generateRandomAccessoryAugmentation(lifeStoneLevel, bodyPart, lifeStoneId);
|
||||
}
|
||||
default:
|
||||
{
|
||||
return generateRandomWeaponAugmentation(lifeStoneLevel, lifeStoneGrade, lifeStoneId, targetItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private Augmentation generateRandomWeaponAugmentation(int lifeStoneLevel, int lifeStoneGrade, int lifeStoneId, L2ItemInstance item)
|
||||
{
|
||||
int stat12 = 0;
|
||||
int stat34 = 0;
|
||||
if (Config.RETAIL_LIKE_AUGMENTATION)
|
||||
{
|
||||
if (item.getItem().isMagicWeapon())
|
||||
{
|
||||
final List<AugmentationChance> _selectedChances12 = new ArrayList<>();
|
||||
final List<AugmentationChance> _selectedChances34 = new ArrayList<>();
|
||||
for (AugmentationChance ac : _augmentationChances)
|
||||
{
|
||||
if (ac.getWeaponType().equals("mage") && (ac.getStoneId() == lifeStoneId))
|
||||
{
|
||||
if (ac.getVariationId() == 1)
|
||||
{
|
||||
_selectedChances12.add(ac);
|
||||
}
|
||||
else
|
||||
{
|
||||
_selectedChances34.add(ac);
|
||||
}
|
||||
}
|
||||
}
|
||||
int r = Rnd.get(10000);
|
||||
float s = 10000;
|
||||
for (AugmentationChance ac : _selectedChances12)
|
||||
{
|
||||
if (s > r)
|
||||
{
|
||||
s -= (ac.getAugmentChance() * 100);
|
||||
stat12 = ac.getAugmentId();
|
||||
}
|
||||
}
|
||||
int[] gradeChance = null;
|
||||
switch (lifeStoneGrade)
|
||||
{
|
||||
case AbstractRefinePacket.GRADE_NONE:
|
||||
{
|
||||
gradeChance = Config.RETAIL_LIKE_AUGMENTATION_NG_CHANCE;
|
||||
break;
|
||||
}
|
||||
case AbstractRefinePacket.GRADE_MID:
|
||||
{
|
||||
gradeChance = Config.RETAIL_LIKE_AUGMENTATION_MID_CHANCE;
|
||||
break;
|
||||
}
|
||||
case AbstractRefinePacket.GRADE_HIGH:
|
||||
{
|
||||
gradeChance = Config.RETAIL_LIKE_AUGMENTATION_HIGH_CHANCE;
|
||||
break;
|
||||
}
|
||||
case AbstractRefinePacket.GRADE_TOP:
|
||||
{
|
||||
gradeChance = Config.RETAIL_LIKE_AUGMENTATION_TOP_CHANCE;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
gradeChance = Config.RETAIL_LIKE_AUGMENTATION_NG_CHANCE;
|
||||
}
|
||||
}
|
||||
|
||||
int c = Rnd.get(100);
|
||||
if (c < gradeChance[0])
|
||||
{
|
||||
c = 55;
|
||||
}
|
||||
else if (c < (gradeChance[0] + gradeChance[1]))
|
||||
{
|
||||
c = 35;
|
||||
}
|
||||
else if (c < (gradeChance[0] + gradeChance[1] + gradeChance[2]))
|
||||
{
|
||||
c = 7;
|
||||
}
|
||||
else
|
||||
{
|
||||
c = 3;
|
||||
}
|
||||
final List<AugmentationChance> _selectedChances34final = new ArrayList<>();
|
||||
for (AugmentationChance ac : _selectedChances34)
|
||||
{
|
||||
if (ac.getCategoryChance() == c)
|
||||
{
|
||||
_selectedChances34final.add(ac);
|
||||
}
|
||||
}
|
||||
|
||||
r = Rnd.get(10000);
|
||||
s = 10000;
|
||||
|
||||
for (AugmentationChance ac : _selectedChances34final)
|
||||
{
|
||||
if (s > r)
|
||||
{
|
||||
s -= (ac.getAugmentChance() * 100);
|
||||
stat34 = ac.getAugmentId();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
final List<AugmentationChance> _selectedChances12 = new ArrayList<>();
|
||||
final List<AugmentationChance> _selectedChances34 = new ArrayList<>();
|
||||
for (AugmentationChance ac : _augmentationChances)
|
||||
{
|
||||
if (ac.getWeaponType().equals("warrior") && (ac.getStoneId() == lifeStoneId))
|
||||
{
|
||||
if (ac.getVariationId() == 1)
|
||||
{
|
||||
_selectedChances12.add(ac);
|
||||
}
|
||||
else
|
||||
{
|
||||
_selectedChances34.add(ac);
|
||||
}
|
||||
}
|
||||
}
|
||||
int r = Rnd.get(10000);
|
||||
float s = 10000;
|
||||
for (AugmentationChance ac : _selectedChances12)
|
||||
{
|
||||
if (s > r)
|
||||
{
|
||||
s -= (ac.getAugmentChance() * 100);
|
||||
stat12 = ac.getAugmentId();
|
||||
}
|
||||
}
|
||||
int[] gradeChance = null;
|
||||
switch (lifeStoneGrade)
|
||||
{
|
||||
case AbstractRefinePacket.GRADE_NONE:
|
||||
{
|
||||
gradeChance = Config.RETAIL_LIKE_AUGMENTATION_NG_CHANCE;
|
||||
break;
|
||||
}
|
||||
case AbstractRefinePacket.GRADE_MID:
|
||||
{
|
||||
gradeChance = Config.RETAIL_LIKE_AUGMENTATION_MID_CHANCE;
|
||||
break;
|
||||
}
|
||||
case AbstractRefinePacket.GRADE_HIGH:
|
||||
{
|
||||
gradeChance = Config.RETAIL_LIKE_AUGMENTATION_HIGH_CHANCE;
|
||||
break;
|
||||
}
|
||||
case AbstractRefinePacket.GRADE_TOP:
|
||||
{
|
||||
gradeChance = Config.RETAIL_LIKE_AUGMENTATION_TOP_CHANCE;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
gradeChance = Config.RETAIL_LIKE_AUGMENTATION_NG_CHANCE;
|
||||
}
|
||||
}
|
||||
int c = Rnd.get(100);
|
||||
if (c < gradeChance[0])
|
||||
{
|
||||
c = 55;
|
||||
}
|
||||
else if (c < (gradeChance[0] + gradeChance[1]))
|
||||
{
|
||||
c = 35;
|
||||
}
|
||||
else if (c < (gradeChance[0] + gradeChance[1] + gradeChance[2]))
|
||||
{
|
||||
c = 7;
|
||||
}
|
||||
else
|
||||
{
|
||||
c = 3;
|
||||
}
|
||||
final List<AugmentationChance> _selectedChances34final = new ArrayList<>();
|
||||
for (AugmentationChance ac : _selectedChances34)
|
||||
{
|
||||
if (ac.getCategoryChance() == c)
|
||||
{
|
||||
_selectedChances34final.add(ac);
|
||||
}
|
||||
}
|
||||
r = Rnd.get(10000);
|
||||
s = 10000;
|
||||
for (AugmentationChance ac : _selectedChances34final)
|
||||
{
|
||||
if (s > r)
|
||||
{
|
||||
s -= ac.getAugmentChance() * 100;
|
||||
stat34 = ac.getAugmentId();
|
||||
}
|
||||
}
|
||||
}
|
||||
final int augmentationId = ((stat34 << 16) + stat12);
|
||||
return getAugmentation(augmentationId);
|
||||
}
|
||||
boolean generateSkill = false;
|
||||
boolean generateGlow = false;
|
||||
|
||||
// life stone level is used for stat Id and skill level, but here the max level is 9
|
||||
lifeStoneLevel = Math.min(lifeStoneLevel, 9);
|
||||
|
||||
switch (lifeStoneGrade)
|
||||
{
|
||||
case AbstractRefinePacket.GRADE_NONE:
|
||||
{
|
||||
if (Rnd.get(1, 100) <= Config.AUGMENTATION_NG_SKILL_CHANCE)
|
||||
{
|
||||
generateSkill = true;
|
||||
}
|
||||
if (Rnd.get(1, 100) <= Config.AUGMENTATION_NG_GLOW_CHANCE)
|
||||
{
|
||||
generateGlow = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case AbstractRefinePacket.GRADE_MID:
|
||||
{
|
||||
if (Rnd.get(1, 100) <= Config.AUGMENTATION_MID_SKILL_CHANCE)
|
||||
{
|
||||
generateSkill = true;
|
||||
}
|
||||
if (Rnd.get(1, 100) <= Config.AUGMENTATION_MID_GLOW_CHANCE)
|
||||
{
|
||||
generateGlow = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case AbstractRefinePacket.GRADE_HIGH:
|
||||
{
|
||||
if (Rnd.get(1, 100) <= Config.AUGMENTATION_HIGH_SKILL_CHANCE)
|
||||
{
|
||||
generateSkill = true;
|
||||
}
|
||||
if (Rnd.get(1, 100) <= Config.AUGMENTATION_HIGH_GLOW_CHANCE)
|
||||
{
|
||||
generateGlow = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case AbstractRefinePacket.GRADE_TOP:
|
||||
{
|
||||
if (Rnd.get(1, 100) <= Config.AUGMENTATION_TOP_SKILL_CHANCE)
|
||||
{
|
||||
generateSkill = true;
|
||||
}
|
||||
if (Rnd.get(1, 100) <= Config.AUGMENTATION_TOP_GLOW_CHANCE)
|
||||
{
|
||||
generateGlow = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case AbstractRefinePacket.GRADE_ACC:
|
||||
{
|
||||
if (Rnd.get(1, 100) <= Config.AUGMENTATION_ACC_SKILL_CHANCE)
|
||||
{
|
||||
generateSkill = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!generateSkill && (Rnd.get(1, 100) <= Config.AUGMENTATION_BASESTAT_CHANCE))
|
||||
{
|
||||
stat34 = Rnd.get(BASESTAT_STR, BASESTAT_MEN);
|
||||
}
|
||||
|
||||
// Second: decide which grade the augmentation result is going to have:
|
||||
// 0:yellow, 1:blue, 2:purple, 3:red
|
||||
// The chances used here are most likely custom,
|
||||
// what's known is: you can't have yellow with skill(or baseStatModifier)
|
||||
// noGrade stone can not have glow, mid only with skill, high has a chance(custom), top allways glow
|
||||
int resultColor = Rnd.get(0, 100);
|
||||
if ((stat34 == 0) && !generateSkill)
|
||||
{
|
||||
if (resultColor <= ((15 * lifeStoneGrade) + 40))
|
||||
{
|
||||
resultColor = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
resultColor = 0;
|
||||
}
|
||||
}
|
||||
else if ((resultColor <= ((10 * lifeStoneGrade) + 5)) || (stat34 != 0))
|
||||
{
|
||||
resultColor = 3;
|
||||
}
|
||||
else if (resultColor <= ((10 * lifeStoneGrade) + 10))
|
||||
{
|
||||
resultColor = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
resultColor = 2;
|
||||
}
|
||||
|
||||
// generate a skill if necessary
|
||||
if (generateSkill)
|
||||
{
|
||||
switch (resultColor)
|
||||
{
|
||||
case 1: // blue skill
|
||||
{
|
||||
stat34 = _blueSkills.get(lifeStoneLevel).get(Rnd.get(0, _blueSkills.get(lifeStoneLevel).size() - 1));
|
||||
break;
|
||||
}
|
||||
case 2: // purple skill
|
||||
{
|
||||
stat34 = _purpleSkills.get(lifeStoneLevel).get(Rnd.get(0, _purpleSkills.get(lifeStoneLevel).size() - 1));
|
||||
break;
|
||||
}
|
||||
case 3: // red skill
|
||||
{
|
||||
stat34 = _redSkills.get(lifeStoneLevel).get(Rnd.get(0, _redSkills.get(lifeStoneLevel).size() - 1));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Third: Calculate the subblock offset for the chosen color,
|
||||
// and the level of the lifeStone
|
||||
// from large number of retail augmentations:
|
||||
// no skill part
|
||||
// Id for stat12:
|
||||
// A:1-910 B:911-1820 C:1821-2730 D:2731-3640 E:3641-4550 F:4551-5460 G:5461-6370 H:6371-7280
|
||||
// Id for stat34(this defines the color):
|
||||
// I:7281-8190(yellow) K:8191-9100(blue) L:10921-11830(yellow) M:11831-12740(blue)
|
||||
// you can combine I-K with A-D and L-M with E-H
|
||||
// using C-D or G-H Id you will get a glow effect
|
||||
// there seems no correlation in which grade use which Id except for the glowing restriction
|
||||
// skill part
|
||||
// Id for stat12:
|
||||
// same for no skill part
|
||||
// A same as E, B same as F, C same as G, D same as H
|
||||
// A - no glow, no grade LS
|
||||
// B - weak glow, mid grade LS?
|
||||
// C - glow, high grade LS?
|
||||
// D - strong glow, top grade LS?
|
||||
|
||||
// is neither a skill nor basestat used for stat34? then generate a normal stat
|
||||
int offset;
|
||||
if (stat34 == 0)
|
||||
{
|
||||
final int temp = Rnd.get(2, 3);
|
||||
final int colorOffset = (resultColor * 10 * STAT_SUBBLOCKSIZE) + (temp * STAT_BLOCKSIZE) + 1;
|
||||
offset = (lifeStoneLevel * STAT_SUBBLOCKSIZE) + colorOffset;
|
||||
|
||||
stat34 = Rnd.get(offset, (offset + STAT_SUBBLOCKSIZE) - 1);
|
||||
if (generateGlow && (lifeStoneGrade >= 2))
|
||||
{
|
||||
offset = (lifeStoneLevel * STAT_SUBBLOCKSIZE) + ((temp - 2) * STAT_BLOCKSIZE) + (lifeStoneGrade * 10 * STAT_SUBBLOCKSIZE) + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
offset = (lifeStoneLevel * STAT_SUBBLOCKSIZE) + ((temp - 2) * STAT_BLOCKSIZE) + (Rnd.get(0, 1) * 10 * STAT_SUBBLOCKSIZE) + 1;
|
||||
}
|
||||
}
|
||||
else if (!generateGlow)
|
||||
{
|
||||
offset = (lifeStoneLevel * STAT_SUBBLOCKSIZE) + (Rnd.get(0, 1) * STAT_BLOCKSIZE) + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
offset = (lifeStoneLevel * STAT_SUBBLOCKSIZE) + (Rnd.get(0, 1) * STAT_BLOCKSIZE) + (((lifeStoneGrade + resultColor) / 2) * 10 * STAT_SUBBLOCKSIZE) + 1;
|
||||
}
|
||||
stat12 = Rnd.get(offset, (offset + STAT_SUBBLOCKSIZE) - 1);
|
||||
|
||||
return new Augmentation(((stat34 << 16) + stat12));
|
||||
}
|
||||
|
||||
private Augmentation generateRandomAccessoryAugmentation(int lifeStoneLevel, int bodyPart, int lifeStoneId)
|
||||
{
|
||||
int stat12 = 0;
|
||||
int stat34 = 0;
|
||||
if (Config.RETAIL_LIKE_AUGMENTATION_ACCESSORY)
|
||||
{
|
||||
final List<augmentationChanceAcc> _selectedChances12 = new ArrayList<>();
|
||||
final List<augmentationChanceAcc> _selectedChances34 = new ArrayList<>();
|
||||
for (augmentationChanceAcc ac : _augmentationChancesAcc)
|
||||
{
|
||||
if (ac.getWeaponType().equals("warrior") && (ac.getStoneId() == lifeStoneId))
|
||||
{
|
||||
if (ac.getVariationId() == 1)
|
||||
{
|
||||
_selectedChances12.add(ac);
|
||||
}
|
||||
else
|
||||
{
|
||||
_selectedChances34.add(ac);
|
||||
}
|
||||
}
|
||||
}
|
||||
int r = Rnd.get(10000);
|
||||
float s = 10000;
|
||||
for (augmentationChanceAcc ac : _selectedChances12)
|
||||
{
|
||||
if (s > r)
|
||||
{
|
||||
s -= ac.getAugmentChance() * 100;
|
||||
stat12 = ac.getAugmentId();
|
||||
}
|
||||
}
|
||||
int c = Rnd.get(100);
|
||||
if (c < 55)
|
||||
{
|
||||
c = 55;
|
||||
}
|
||||
else if (c < 90)
|
||||
{
|
||||
c = 35;
|
||||
}
|
||||
else if (c < 99)
|
||||
{
|
||||
c = 9;
|
||||
}
|
||||
else
|
||||
{
|
||||
c = 1;
|
||||
}
|
||||
final List<augmentationChanceAcc> _selectedChances34final = new ArrayList<>();
|
||||
for (augmentationChanceAcc ac : _selectedChances34)
|
||||
{
|
||||
if (ac.getCategoryChance() == c)
|
||||
{
|
||||
_selectedChances34final.add(ac);
|
||||
}
|
||||
}
|
||||
r = Rnd.get(10000);
|
||||
s = 10000;
|
||||
for (augmentationChanceAcc ac : _selectedChances34final)
|
||||
{
|
||||
if (s > r)
|
||||
{
|
||||
s -= ac.getAugmentChance() * 100;
|
||||
stat34 = ac.getAugmentId();
|
||||
}
|
||||
}
|
||||
|
||||
final int augmentationId = ((stat34 << 16) + stat12);
|
||||
return getAugmentation(augmentationId);
|
||||
}
|
||||
lifeStoneLevel = Math.min(lifeStoneLevel, 9);
|
||||
int base = 0;
|
||||
int skillsLength = 0;
|
||||
|
||||
switch (bodyPart)
|
||||
{
|
||||
case L2Item.SLOT_LR_FINGER:
|
||||
{
|
||||
base = ACC_RING_START + (ACC_RING_BLOCKSIZE * lifeStoneLevel);
|
||||
skillsLength = ACC_RING_SKILLS;
|
||||
break;
|
||||
}
|
||||
case L2Item.SLOT_LR_EAR:
|
||||
{
|
||||
base = ACC_EAR_START + (ACC_EAR_BLOCKSIZE * lifeStoneLevel);
|
||||
skillsLength = ACC_EAR_SKILLS;
|
||||
break;
|
||||
}
|
||||
case L2Item.SLOT_NECK:
|
||||
{
|
||||
base = ACC_NECK_START + (ACC_NECK_BLOCKSIZE * lifeStoneLevel);
|
||||
skillsLength = ACC_NECK_SKILLS;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
final int resultColor = Rnd.get(0, 3);
|
||||
|
||||
// first augmentation (stats only)
|
||||
stat12 = Rnd.get(ACC_STAT_SUBBLOCKSIZE);
|
||||
Options op = null;
|
||||
if (Rnd.get(1, 100) <= Config.AUGMENTATION_ACC_SKILL_CHANCE)
|
||||
{
|
||||
// second augmentation (skill)
|
||||
stat34 = base + Rnd.get(skillsLength);
|
||||
op = OptionData.getInstance().getOptions(stat34);
|
||||
}
|
||||
|
||||
if ((op == null) || (!op.hasActiveSkills() && !op.hasPassiveSkills() && !op.hasActivationSkills()))
|
||||
{
|
||||
// second augmentation (stats)
|
||||
// calculating any different from stat12 value inside sub-block
|
||||
// starting from next and wrapping over using remainder
|
||||
stat34 = (stat12 + 1 + Rnd.get(ACC_STAT_SUBBLOCKSIZE - 1)) % ACC_STAT_SUBBLOCKSIZE;
|
||||
// this is a stats - skipping skills
|
||||
stat34 = base + skillsLength + (ACC_STAT_SUBBLOCKSIZE * resultColor) + stat34;
|
||||
}
|
||||
|
||||
// stat12 has stats only
|
||||
stat12 = base + skillsLength + (ACC_STAT_SUBBLOCKSIZE * resultColor) + stat12;
|
||||
|
||||
final int augmentationId = ((stat34 << 16) + stat12);
|
||||
return getAugmentation(augmentationId);
|
||||
}
|
||||
|
||||
public boolean isAugmentaionStoneValid(int stoneId)
|
||||
{
|
||||
return _augmentationStones.contains(stoneId);
|
||||
}
|
||||
|
||||
public static AugmentationData getInstance()
|
||||
{
|
||||
return SingletonHolder._instance;
|
||||
}
|
||||
|
||||
private static class SingletonHolder
|
||||
{
|
||||
protected static final AugmentationData _instance = new AugmentationData();
|
||||
}
|
||||
}
|
||||
@@ -195,7 +195,7 @@ public abstract class IdFactory
|
||||
cleanCount += stmt.executeUpdate("DELETE FROM items WHERE items.owner_id NOT IN (SELECT charId FROM characters) AND items.owner_id NOT IN (SELECT clan_id FROM clan_data) AND items.owner_id != -1;");
|
||||
cleanCount += stmt.executeUpdate("DELETE FROM items WHERE items.owner_id = -1 AND loc LIKE 'MAIL' AND loc_data NOT IN (SELECT messageId FROM messages WHERE senderId = -1);");
|
||||
cleanCount += stmt.executeUpdate("DELETE FROM item_auction_bid WHERE item_auction_bid.playerObjId NOT IN (SELECT charId FROM characters);");
|
||||
cleanCount += stmt.executeUpdate("DELETE FROM item_attributes WHERE item_attributes.itemId NOT IN (SELECT object_id FROM items);");
|
||||
cleanCount += stmt.executeUpdate("DELETE FROM item_variations WHERE item_variations.itemId NOT IN (SELECT object_id FROM items);");
|
||||
cleanCount += stmt.executeUpdate("DELETE FROM item_elementals WHERE item_elementals.itemId NOT IN (SELECT object_id FROM items);");
|
||||
cleanCount += stmt.executeUpdate("DELETE FROM item_special_abilities WHERE item_special_abilities.objectId NOT IN (SELECT object_id FROM items);");
|
||||
cleanCount += stmt.executeUpdate("DELETE FROM item_variables WHERE item_variables.id NOT IN (SELECT object_id FROM items);");
|
||||
|
||||
@@ -1,101 +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 com.l2jmobius.gameserver.model;
|
||||
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.l2jmobius.gameserver.data.xml.impl.OptionData;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.options.Options;
|
||||
|
||||
/**
|
||||
* Used to store an augmentation and its bonuses.
|
||||
* @author durgus, UnAfraid
|
||||
*/
|
||||
public final class Augmentation
|
||||
{
|
||||
private static final Logger LOGGER = Logger.getLogger(Augmentation.class.getName());
|
||||
private final Options[] _options;
|
||||
private final int _id;
|
||||
|
||||
public Augmentation(int id)
|
||||
{
|
||||
_id = id;
|
||||
final int[] stats = new int[2];
|
||||
stats[0] = 0x0000FFFF & id;
|
||||
stats[1] = (id >> 16);
|
||||
_options = new Options[stats.length];
|
||||
|
||||
for (int i = 0; i < stats.length; i++)
|
||||
{
|
||||
final Options op = OptionData.getInstance().getOptions(stats[i]);
|
||||
if (op != null)
|
||||
{
|
||||
_options[i] = op;
|
||||
}
|
||||
else
|
||||
{
|
||||
LOGGER.warning(getClass().getSimpleName() + ": Couldn't find option: " + stats[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the augmentation "id" used in serverpackets.
|
||||
* @return augmentationId
|
||||
*/
|
||||
public int getId()
|
||||
{
|
||||
return _id;
|
||||
}
|
||||
|
||||
public Options[] getOptions()
|
||||
{
|
||||
return _options;
|
||||
}
|
||||
|
||||
public int getOptionId(int index)
|
||||
{
|
||||
if ((index >= 0) && (index < _options.length) && (_options[index] != null))
|
||||
{
|
||||
return _options[index].getId();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public void applyBonus(L2PcInstance player)
|
||||
{
|
||||
for (Options op : _options)
|
||||
{
|
||||
if (op != null)
|
||||
{
|
||||
op.apply(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void removeBonus(L2PcInstance player)
|
||||
{
|
||||
for (Options op : _options)
|
||||
{
|
||||
if (op != null)
|
||||
{
|
||||
op.remove(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -50,7 +50,7 @@ public class CharSelectInfoPackage
|
||||
private int _reputation = 0;
|
||||
private int _pkKills = 0;
|
||||
private int _pvpKills = 0;
|
||||
private Augmentation _augmentation;
|
||||
private VariationInstance _augmentation;
|
||||
private int _x = 0;
|
||||
private int _y = 0;
|
||||
private int _z = 0;
|
||||
@@ -336,12 +336,12 @@ public class CharSelectInfoPackage
|
||||
return _reputation;
|
||||
}
|
||||
|
||||
public void setAugmentation(Augmentation augmentation)
|
||||
public void setAugmentation(VariationInstance augmentation)
|
||||
{
|
||||
_augmentation = augmentation;
|
||||
}
|
||||
|
||||
public Augmentation getAugmentation()
|
||||
public VariationInstance getAugmentation()
|
||||
{
|
||||
return _augmentation;
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ public class ItemInfo
|
||||
private int _enchantLevel;
|
||||
|
||||
/** The augmentation of the item */
|
||||
private Augmentation _augmentation;
|
||||
private VariationInstance _augmentation;
|
||||
|
||||
/** The quantity of L2ItemInstance */
|
||||
private long _count;
|
||||
@@ -175,7 +175,10 @@ public class ItemInfo
|
||||
_enchantLevel = item.getEnchant();
|
||||
|
||||
// Get the augmentation bonus
|
||||
_augmentation = item.getAugmentation();
|
||||
if ((item.getAugmentationOption1() >= 0) && (item.getAugmentationOption2() >= 0))
|
||||
{
|
||||
_augmentation = new VariationInstance(0, item.getAugmentationOption1(), item.getAugmentationOption2());
|
||||
}
|
||||
|
||||
// Get the quantity of the L2ItemInstance
|
||||
_count = item.getCount();
|
||||
@@ -311,7 +314,7 @@ public class ItemInfo
|
||||
return _enchantLevel;
|
||||
}
|
||||
|
||||
public Augmentation getAugmentation()
|
||||
public VariationInstance getAugmentation()
|
||||
{
|
||||
return _augmentation;
|
||||
}
|
||||
@@ -400,4 +403,10 @@ public class ItemInfo
|
||||
{
|
||||
return _visualExpiration;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return String.valueOf(_item) + "[objId: " + _objectId + ", count: " + _count + "]";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,7 +51,8 @@ public class TradeItem
|
||||
private final Collection<EnsoulOption> _soulCrystalOptions;
|
||||
private final Collection<EnsoulOption> _soulCrystalSpecialOptions;
|
||||
private int _visualId;
|
||||
private Augmentation _augmentation;
|
||||
private int _augmentationOption1 = -1;
|
||||
private int _augmentationOption2 = -1;
|
||||
|
||||
public TradeItem(L2ItemInstance item, long count, long price)
|
||||
{
|
||||
@@ -74,7 +75,12 @@ public class TradeItem
|
||||
_soulCrystalOptions = item.getSpecialAbilities();
|
||||
_soulCrystalSpecialOptions = item.getAdditionalSpecialAbilities();
|
||||
_visualId = item.getVisualId();
|
||||
_augmentation = item.getAugmentation();
|
||||
|
||||
if (item.getAugmentation() != null)
|
||||
{
|
||||
_augmentationOption1 = item.getAugmentation().getOption1Id();
|
||||
_augmentationOption1 = item.getAugmentation().getOption2Id();
|
||||
}
|
||||
}
|
||||
|
||||
public TradeItem(L2Item item, long count, long price)
|
||||
@@ -215,9 +221,20 @@ public class TradeItem
|
||||
return _soulCrystalSpecialOptions;
|
||||
}
|
||||
|
||||
public Augmentation getAugmentation()
|
||||
public void setAugmentation(int option1, int option2)
|
||||
{
|
||||
return _augmentation;
|
||||
_augmentationOption1 = option1;
|
||||
_augmentationOption2 = option2;
|
||||
}
|
||||
|
||||
public int getAugmentationOption1()
|
||||
{
|
||||
return _augmentationOption1;
|
||||
}
|
||||
|
||||
public int getAugmentationOption2()
|
||||
{
|
||||
return _augmentationOption2;
|
||||
}
|
||||
|
||||
public int getVisualId()
|
||||
|
||||
@@ -0,0 +1,82 @@
|
||||
/*
|
||||
* 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 com.l2jmobius.gameserver.model;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
import com.l2jmobius.gameserver.data.xml.impl.OptionData;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.options.Options;
|
||||
|
||||
/**
|
||||
* Used to store an augmentation and its bonuses.
|
||||
* @author durgus, UnAfraid, Pere
|
||||
*/
|
||||
public final class VariationInstance
|
||||
{
|
||||
private final int _mineralId;
|
||||
private final Options _option1;
|
||||
private final Options _option2;
|
||||
|
||||
public VariationInstance(int mineralId, int option1Id, int option2Id)
|
||||
{
|
||||
_mineralId = mineralId;
|
||||
_option1 = OptionData.getInstance().getOptions(option1Id);
|
||||
_option2 = OptionData.getInstance().getOptions(option2Id);
|
||||
if ((_option1 == null) || (_option2 == null))
|
||||
{
|
||||
throw new IllegalArgumentException("Couldn't find option for id: " + option1Id + " or id: " + option1Id);
|
||||
}
|
||||
}
|
||||
|
||||
public VariationInstance(int mineralId, Options op1, Options op2)
|
||||
{
|
||||
Objects.requireNonNull(op1);
|
||||
Objects.requireNonNull(op2);
|
||||
|
||||
_mineralId = mineralId;
|
||||
_option1 = op1;
|
||||
_option2 = op2;
|
||||
}
|
||||
|
||||
public int getMineralId()
|
||||
{
|
||||
return _mineralId;
|
||||
}
|
||||
|
||||
public int getOption1Id()
|
||||
{
|
||||
return _option1.getId();
|
||||
}
|
||||
|
||||
public int getOption2Id()
|
||||
{
|
||||
return _option2.getId();
|
||||
}
|
||||
|
||||
public void applyBonus(L2PcInstance player)
|
||||
{
|
||||
_option1.apply(player);
|
||||
_option2.apply(player);
|
||||
}
|
||||
|
||||
public void removeBonus(L2PcInstance player)
|
||||
{
|
||||
_option1.remove(player);
|
||||
_option2.remove(player);
|
||||
}
|
||||
}
|
||||
@@ -16,7 +16,7 @@
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.events.impl.character.player;
|
||||
|
||||
import com.l2jmobius.gameserver.model.Augmentation;
|
||||
import com.l2jmobius.gameserver.model.VariationInstance;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.events.EventType;
|
||||
import com.l2jmobius.gameserver.model.events.impl.IBaseEvent;
|
||||
@@ -29,10 +29,10 @@ public class OnPlayerAugment implements IBaseEvent
|
||||
{
|
||||
private final L2PcInstance _activeChar;
|
||||
private final L2ItemInstance _item;
|
||||
private final Augmentation _augmentation;
|
||||
private final VariationInstance _augmentation;
|
||||
private final boolean _isAugment; // true = is being augmented // false = augment is being removed
|
||||
|
||||
public OnPlayerAugment(L2PcInstance activeChar, L2ItemInstance item, Augmentation augment, boolean isAugment)
|
||||
public OnPlayerAugment(L2PcInstance activeChar, L2ItemInstance item, VariationInstance augment, boolean isAugment)
|
||||
{
|
||||
_activeChar = activeChar;
|
||||
_item = item;
|
||||
@@ -50,7 +50,7 @@ public class OnPlayerAugment implements IBaseEvent
|
||||
return _item;
|
||||
}
|
||||
|
||||
public Augmentation getAugmentation()
|
||||
public VariationInstance getAugmentation()
|
||||
{
|
||||
return _augmentation;
|
||||
}
|
||||
|
||||
@@ -16,10 +16,8 @@
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model.itemauction;
|
||||
|
||||
import com.l2jmobius.gameserver.datatables.AugmentationData;
|
||||
import com.l2jmobius.gameserver.datatables.ItemTable;
|
||||
import com.l2jmobius.gameserver.idfactory.IdFactory;
|
||||
import com.l2jmobius.gameserver.model.Augmentation;
|
||||
import com.l2jmobius.gameserver.model.L2World;
|
||||
import com.l2jmobius.gameserver.model.StatsSet;
|
||||
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
|
||||
@@ -35,6 +33,7 @@ public final class AuctionItem
|
||||
|
||||
private final int _itemId;
|
||||
private final long _itemCount;
|
||||
@SuppressWarnings("unused")
|
||||
private final StatsSet _itemExtra;
|
||||
|
||||
public AuctionItem(int auctionItemId, int auctionLength, long auctionInitBid, int itemId, long itemCount, StatsSet itemExtra)
|
||||
@@ -84,11 +83,6 @@ public final class AuctionItem
|
||||
L2World.getInstance().storeObject(item);
|
||||
item.setCount(_itemCount);
|
||||
item.setEnchantLevel(item.getItem().getDefaultEnchantLevel());
|
||||
final Augmentation augmentation = AugmentationData.getInstance().getAugmentation(_itemExtra.getInt("augmentation_id", 0));
|
||||
if (augmentation != null)
|
||||
{
|
||||
item.setAugmentation(augmentation, false);
|
||||
}
|
||||
return item;
|
||||
}
|
||||
}
|
||||
@@ -42,10 +42,10 @@ import com.l2jmobius.gameserver.datatables.ItemTable;
|
||||
import com.l2jmobius.gameserver.enums.ItemLocation;
|
||||
import com.l2jmobius.gameserver.enums.ItemSkillType;
|
||||
import com.l2jmobius.gameserver.enums.PrivateStoreType;
|
||||
import com.l2jmobius.gameserver.model.Augmentation;
|
||||
import com.l2jmobius.gameserver.model.L2ArmorSet;
|
||||
import com.l2jmobius.gameserver.model.L2World;
|
||||
import com.l2jmobius.gameserver.model.PcCondOverride;
|
||||
import com.l2jmobius.gameserver.model.VariationInstance;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.holders.ArmorsetSkillHolder;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
@@ -1022,7 +1022,7 @@ public abstract class Inventory extends ItemContainer
|
||||
return (item != null) ? item.getVisualId() : 0;
|
||||
}
|
||||
|
||||
public Augmentation getPaperdollAugmentation(int slot)
|
||||
public VariationInstance getPaperdollAugmentation(int slot)
|
||||
{
|
||||
final L2ItemInstance item = _paperdoll[slot];
|
||||
return (item != null) ? item.getAugmentation() : null;
|
||||
|
||||
@@ -20,7 +20,7 @@ import java.util.Collection;
|
||||
import java.util.Objects;
|
||||
|
||||
import com.l2jmobius.gameserver.enums.AttributeType;
|
||||
import com.l2jmobius.gameserver.model.Augmentation;
|
||||
import com.l2jmobius.gameserver.model.VariationInstance;
|
||||
import com.l2jmobius.gameserver.model.ensoul.EnsoulOption;
|
||||
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
|
||||
import com.l2jmobius.gameserver.model.items.type.CrystalType;
|
||||
@@ -45,7 +45,7 @@ public class L2WarehouseItem
|
||||
private final int _locationSlot;
|
||||
private final int _enchant;
|
||||
private final CrystalType _grade;
|
||||
private final Augmentation _augmentation;
|
||||
private final VariationInstance _augmentation;
|
||||
private final int _customType1;
|
||||
private final int _customType2;
|
||||
private final int _mana;
|
||||
@@ -227,7 +227,7 @@ public class L2WarehouseItem
|
||||
/**
|
||||
* @return the augmentation If.
|
||||
*/
|
||||
public Augmentation getAugmentation()
|
||||
public VariationInstance getAugmentation()
|
||||
{
|
||||
return _augmentation;
|
||||
}
|
||||
|
||||
@@ -42,7 +42,6 @@ import com.l2jmobius.gameserver.data.xml.impl.AppearanceItemData;
|
||||
import com.l2jmobius.gameserver.data.xml.impl.EnchantItemOptionsData;
|
||||
import com.l2jmobius.gameserver.data.xml.impl.EnsoulData;
|
||||
import com.l2jmobius.gameserver.data.xml.impl.OptionData;
|
||||
import com.l2jmobius.gameserver.datatables.AugmentationData;
|
||||
import com.l2jmobius.gameserver.datatables.ItemTable;
|
||||
import com.l2jmobius.gameserver.enums.AttributeType;
|
||||
import com.l2jmobius.gameserver.enums.InstanceType;
|
||||
@@ -54,12 +53,12 @@ import com.l2jmobius.gameserver.idfactory.IdFactory;
|
||||
import com.l2jmobius.gameserver.instancemanager.CastleManager;
|
||||
import com.l2jmobius.gameserver.instancemanager.ItemsOnGroundManager;
|
||||
import com.l2jmobius.gameserver.instancemanager.SiegeGuardManager;
|
||||
import com.l2jmobius.gameserver.model.Augmentation;
|
||||
import com.l2jmobius.gameserver.model.DropProtection;
|
||||
import com.l2jmobius.gameserver.model.L2Object;
|
||||
import com.l2jmobius.gameserver.model.L2World;
|
||||
import com.l2jmobius.gameserver.model.L2WorldRegion;
|
||||
import com.l2jmobius.gameserver.model.Location;
|
||||
import com.l2jmobius.gameserver.model.VariationInstance;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Summon;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
@@ -136,7 +135,7 @@ public final class L2ItemInstance extends L2Object
|
||||
private boolean _wear;
|
||||
|
||||
/** Augmented Item */
|
||||
private Augmentation _augmentation = null;
|
||||
private VariationInstance _augmentation = null;
|
||||
|
||||
/** Shadow item */
|
||||
private int _mana = -1;
|
||||
@@ -949,7 +948,7 @@ public final class L2ItemInstance extends L2Object
|
||||
* Returns the augmentation object for this item
|
||||
* @return augmentation
|
||||
*/
|
||||
public Augmentation getAugmentation()
|
||||
public VariationInstance getAugmentation()
|
||||
{
|
||||
return _augmentation;
|
||||
}
|
||||
@@ -960,7 +959,7 @@ public final class L2ItemInstance extends L2Object
|
||||
* @param updateDatabase
|
||||
* @return return true if successfully
|
||||
*/
|
||||
public boolean setAugmentation(Augmentation augmentation, boolean updateDatabase)
|
||||
public boolean setAugmentation(VariationInstance augmentation, boolean updateDatabase)
|
||||
{
|
||||
// there shall be no previous augmentation..
|
||||
if (_augmentation != null)
|
||||
@@ -989,11 +988,11 @@ public final class L2ItemInstance extends L2Object
|
||||
}
|
||||
|
||||
// Copy augmentation before removing it.
|
||||
final Augmentation augment = _augmentation;
|
||||
final VariationInstance augment = _augmentation;
|
||||
_augmentation = null;
|
||||
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("DELETE FROM item_attributes WHERE itemId = ?"))
|
||||
PreparedStatement ps = con.prepareStatement("DELETE FROM item_variations WHERE itemId = ?"))
|
||||
{
|
||||
ps.setInt(1, getObjectId());
|
||||
ps.executeUpdate();
|
||||
@@ -1010,7 +1009,7 @@ public final class L2ItemInstance extends L2Object
|
||||
public void restoreAttributes()
|
||||
{
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps1 = con.prepareStatement("SELECT augAttributes FROM item_attributes WHERE itemId=?");
|
||||
PreparedStatement ps1 = con.prepareStatement("SELECT mineralId,option1,option2 FROM item_variations WHERE itemId=?");
|
||||
PreparedStatement ps2 = con.prepareStatement("SELECT elemType,elemValue FROM item_elementals WHERE itemId=?"))
|
||||
{
|
||||
ps1.setInt(1, getObjectId());
|
||||
@@ -1018,10 +1017,12 @@ public final class L2ItemInstance extends L2Object
|
||||
{
|
||||
if (rs.next())
|
||||
{
|
||||
final int aug_attributes = rs.getInt(1);
|
||||
if (aug_attributes != -1)
|
||||
int mineralId = rs.getInt("mineralId");
|
||||
int option1 = rs.getInt("option1");
|
||||
int option2 = rs.getInt("option2");
|
||||
if ((option1 != -1) && (option2 != -1))
|
||||
{
|
||||
_augmentation = AugmentationData.getInstance().getAugmentation(rs.getInt("augAttributes"));
|
||||
_augmentation = new VariationInstance(mineralId, option1, option2);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1060,10 +1061,12 @@ public final class L2ItemInstance extends L2Object
|
||||
|
||||
private void updateItemOptions(Connection con)
|
||||
{
|
||||
try (PreparedStatement ps = con.prepareStatement("REPLACE INTO item_attributes VALUES(?,?)"))
|
||||
try (PreparedStatement ps = con.prepareStatement("REPLACE INTO item_variations VALUES(?,?,?,?)"))
|
||||
{
|
||||
ps.setInt(1, getObjectId());
|
||||
ps.setInt(2, _augmentation != null ? _augmentation.getId() : -1);
|
||||
ps.setInt(2, _augmentation != null ? _augmentation.getMineralId() : 0);
|
||||
ps.setInt(3, _augmentation != null ? _augmentation.getOption1Id() : -1);
|
||||
ps.setInt(4, _augmentation != null ? _augmentation.getOption2Id() : -1);
|
||||
ps.executeUpdate();
|
||||
}
|
||||
catch (SQLException e)
|
||||
@@ -1702,7 +1705,7 @@ public final class L2ItemInstance extends L2Object
|
||||
ps.executeUpdate();
|
||||
}
|
||||
|
||||
try (PreparedStatement ps = con.prepareStatement("DELETE FROM item_attributes WHERE itemId = ?"))
|
||||
try (PreparedStatement ps = con.prepareStatement("DELETE FROM item_variations WHERE itemId = ?"))
|
||||
{
|
||||
ps.setInt(1, getObjectId());
|
||||
ps.executeUpdate();
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
/*
|
||||
* 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 com.l2jmobius.gameserver.model.options;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import com.l2jmobius.commons.util.Rnd;
|
||||
|
||||
/**
|
||||
* @author Pere
|
||||
*/
|
||||
public final class OptionDataCategory
|
||||
{
|
||||
private final Map<Options, Double> _options;
|
||||
private final double _chance;
|
||||
|
||||
public OptionDataCategory(Map<Options, Double> options, double chance)
|
||||
{
|
||||
_options = options;
|
||||
_chance = chance;
|
||||
}
|
||||
|
||||
Options getRandomOptions()
|
||||
{
|
||||
Options result = null;
|
||||
do
|
||||
{
|
||||
double random = Rnd.get() * 100.0;
|
||||
for (Map.Entry<Options, Double> entry : _options.entrySet())
|
||||
{
|
||||
if (entry.getValue() >= random)
|
||||
{
|
||||
result = entry.getKey();
|
||||
break;
|
||||
}
|
||||
|
||||
random -= entry.getValue();
|
||||
}
|
||||
}
|
||||
while (result == null);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public double getChance()
|
||||
{
|
||||
return _chance;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
* 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 com.l2jmobius.gameserver.model.options;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.l2jmobius.commons.util.Rnd;
|
||||
|
||||
/**
|
||||
* @author Pere
|
||||
*/
|
||||
public final class OptionDataGroup
|
||||
{
|
||||
private final List<OptionDataCategory> _categories;
|
||||
|
||||
public OptionDataGroup(List<OptionDataCategory> categories)
|
||||
{
|
||||
_categories = categories;
|
||||
}
|
||||
|
||||
Options getRandomEffect()
|
||||
{
|
||||
Options result = null;
|
||||
do
|
||||
{
|
||||
double random = Rnd.get() * 100.0;
|
||||
for (OptionDataCategory category : _categories)
|
||||
{
|
||||
if (category.getChance() >= random)
|
||||
{
|
||||
result = category.getRandomOptions();
|
||||
break;
|
||||
}
|
||||
|
||||
random -= category.getChance();
|
||||
}
|
||||
}
|
||||
while (result == null);
|
||||
// Should never get there
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
* 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 com.l2jmobius.gameserver.model.options;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
/**
|
||||
* @author Pere
|
||||
*/
|
||||
public final class Variation
|
||||
{
|
||||
private static final Logger LOGGER = Logger.getLogger(Variation.class.getSimpleName());
|
||||
|
||||
private final int _mineralId;
|
||||
private final Map<VariationWeaponType, OptionDataGroup[]> _effects = new HashMap<>();
|
||||
|
||||
public Variation(int mineralId)
|
||||
{
|
||||
_mineralId = mineralId;
|
||||
}
|
||||
|
||||
public int getMineralId()
|
||||
{
|
||||
return _mineralId;
|
||||
}
|
||||
|
||||
public void setEffectGroup(VariationWeaponType type, int order, OptionDataGroup group)
|
||||
{
|
||||
final OptionDataGroup[] effects = _effects.computeIfAbsent(type, k -> new OptionDataGroup[2]);
|
||||
effects[order] = group;
|
||||
}
|
||||
|
||||
public Options getRandomEffect(VariationWeaponType type, int order)
|
||||
{
|
||||
OptionDataGroup[] effects = _effects.get(type);
|
||||
if ((effects == null) || (effects[order] == null))
|
||||
{
|
||||
LOGGER.warning("Null effect: " + type + ", " + order);
|
||||
return null;
|
||||
}
|
||||
|
||||
return effects[order].getRandomEffect();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* 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 com.l2jmobius.gameserver.model.options;
|
||||
|
||||
/**
|
||||
* @author Pere
|
||||
*/
|
||||
public final class VariationFee
|
||||
{
|
||||
private final int _itemId;
|
||||
private final long _itemCount;
|
||||
private final long _cancelFee;
|
||||
|
||||
public VariationFee(int itemId, long itemCount, long cancelFee)
|
||||
{
|
||||
_itemId = itemId;
|
||||
_itemCount = itemCount;
|
||||
_cancelFee = cancelFee;
|
||||
}
|
||||
|
||||
public int getItemId()
|
||||
{
|
||||
return _itemId;
|
||||
}
|
||||
|
||||
public long getItemCount()
|
||||
{
|
||||
return _itemCount;
|
||||
}
|
||||
|
||||
public long getCancelFee()
|
||||
{
|
||||
return _cancelFee;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* 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 com.l2jmobius.gameserver.model.options;
|
||||
|
||||
/**
|
||||
* @author Pere
|
||||
*/
|
||||
public enum VariationWeaponType
|
||||
{
|
||||
WARRIOR,
|
||||
MAGE
|
||||
}
|
||||
@@ -495,7 +495,7 @@ public final class L2GameClient extends ChannelInboundHandler<L2GameClient>
|
||||
ps.execute();
|
||||
}
|
||||
|
||||
try (PreparedStatement ps = con.prepareStatement("DELETE FROM item_attributes WHERE itemId IN (SELECT object_id FROM items WHERE items.owner_id=?)"))
|
||||
try (PreparedStatement ps = con.prepareStatement("DELETE FROM item_variations WHERE itemId IN (SELECT object_id FROM items WHERE items.owner_id=?)"))
|
||||
{
|
||||
ps.setInt(1, objid);
|
||||
ps.execute();
|
||||
|
||||
@@ -17,8 +17,6 @@
|
||||
package com.l2jmobius.gameserver.network.clientpackets;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import com.l2jmobius.Config;
|
||||
import com.l2jmobius.gameserver.enums.ItemLocation;
|
||||
@@ -27,291 +25,53 @@ import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.actor.request.EnchantItemAttributeRequest;
|
||||
import com.l2jmobius.gameserver.model.actor.request.EnchantItemRequest;
|
||||
import com.l2jmobius.gameserver.model.items.L2Armor;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
import com.l2jmobius.gameserver.model.items.L2Weapon;
|
||||
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
|
||||
import com.l2jmobius.gameserver.model.items.type.CrystalType;
|
||||
import com.l2jmobius.gameserver.model.options.VariationFee;
|
||||
import com.l2jmobius.gameserver.model.skills.AbnormalType;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
|
||||
public abstract class AbstractRefinePacket implements IClientIncomingPacket
|
||||
{
|
||||
public static final int GRADE_NONE = 0;
|
||||
public static final int GRADE_MID = 1;
|
||||
public static final int GRADE_HIGH = 2;
|
||||
public static final int GRADE_TOP = 3;
|
||||
public static final int GRADE_ACC = 4; // Accessory LS
|
||||
public static final int GRADE_FORGOTTEN = 5; // Forgotten
|
||||
|
||||
protected static final int[] GEMSTONE_D = new int[]
|
||||
{
|
||||
2130
|
||||
};
|
||||
protected static final int[] GEMSTONE_C = new int[]
|
||||
{
|
||||
2131,
|
||||
36719
|
||||
};
|
||||
protected static final int[] GEMSTONE_B = new int[]
|
||||
{
|
||||
2132
|
||||
};
|
||||
protected static final int[] GEMSTONE_A = new int[]
|
||||
{
|
||||
2133
|
||||
};
|
||||
protected static final int[] GEMSTONE_S = new int[]
|
||||
{
|
||||
2134
|
||||
};
|
||||
protected static final int[] GEMSTONE_R = new int[]
|
||||
{
|
||||
19440
|
||||
};
|
||||
|
||||
private static final Map<Integer, LifeStone> _lifeStones = new HashMap<>();
|
||||
|
||||
protected static final class LifeStone
|
||||
{
|
||||
// lifestone level to player level table
|
||||
private static final int[] LEVELS =
|
||||
{
|
||||
1, // 46?
|
||||
49,
|
||||
52,
|
||||
55,
|
||||
58,
|
||||
61,
|
||||
64,
|
||||
67,
|
||||
70,
|
||||
76,
|
||||
80,
|
||||
82,
|
||||
84,
|
||||
85,
|
||||
95,
|
||||
99
|
||||
};
|
||||
private final int _grade;
|
||||
private final int _level;
|
||||
|
||||
public LifeStone(int grade, int level)
|
||||
{
|
||||
_grade = grade;
|
||||
_level = level;
|
||||
}
|
||||
|
||||
public final int getLevel()
|
||||
{
|
||||
return _level;
|
||||
}
|
||||
|
||||
public final int getGrade()
|
||||
{
|
||||
return _grade;
|
||||
}
|
||||
|
||||
public final int getPlayerLevel()
|
||||
{
|
||||
return LEVELS[_level];
|
||||
}
|
||||
}
|
||||
|
||||
static
|
||||
{
|
||||
// itemId, (LS grade, LS level)
|
||||
_lifeStones.put(36718, new LifeStone(GRADE_NONE, 0));
|
||||
|
||||
_lifeStones.put(8723, new LifeStone(GRADE_NONE, 0));
|
||||
_lifeStones.put(8724, new LifeStone(GRADE_NONE, 1));
|
||||
_lifeStones.put(8725, new LifeStone(GRADE_NONE, 2));
|
||||
_lifeStones.put(8726, new LifeStone(GRADE_NONE, 3));
|
||||
_lifeStones.put(8727, new LifeStone(GRADE_NONE, 4));
|
||||
_lifeStones.put(8728, new LifeStone(GRADE_NONE, 5));
|
||||
_lifeStones.put(8729, new LifeStone(GRADE_NONE, 6));
|
||||
_lifeStones.put(8730, new LifeStone(GRADE_NONE, 7));
|
||||
_lifeStones.put(8731, new LifeStone(GRADE_NONE, 8));
|
||||
_lifeStones.put(8732, new LifeStone(GRADE_NONE, 9));
|
||||
|
||||
_lifeStones.put(8733, new LifeStone(GRADE_MID, 0));
|
||||
_lifeStones.put(8734, new LifeStone(GRADE_MID, 1));
|
||||
_lifeStones.put(8735, new LifeStone(GRADE_MID, 2));
|
||||
_lifeStones.put(8736, new LifeStone(GRADE_MID, 3));
|
||||
_lifeStones.put(8737, new LifeStone(GRADE_MID, 4));
|
||||
_lifeStones.put(8738, new LifeStone(GRADE_MID, 5));
|
||||
_lifeStones.put(8739, new LifeStone(GRADE_MID, 6));
|
||||
_lifeStones.put(8740, new LifeStone(GRADE_MID, 7));
|
||||
_lifeStones.put(8741, new LifeStone(GRADE_MID, 8));
|
||||
_lifeStones.put(8742, new LifeStone(GRADE_MID, 9));
|
||||
|
||||
_lifeStones.put(8743, new LifeStone(GRADE_HIGH, 0));
|
||||
_lifeStones.put(8744, new LifeStone(GRADE_HIGH, 1));
|
||||
_lifeStones.put(8745, new LifeStone(GRADE_HIGH, 2));
|
||||
_lifeStones.put(8746, new LifeStone(GRADE_HIGH, 3));
|
||||
_lifeStones.put(8747, new LifeStone(GRADE_HIGH, 4));
|
||||
_lifeStones.put(8748, new LifeStone(GRADE_HIGH, 5));
|
||||
_lifeStones.put(8749, new LifeStone(GRADE_HIGH, 6));
|
||||
_lifeStones.put(8750, new LifeStone(GRADE_HIGH, 7));
|
||||
_lifeStones.put(8751, new LifeStone(GRADE_HIGH, 8));
|
||||
_lifeStones.put(8752, new LifeStone(GRADE_HIGH, 9));
|
||||
|
||||
_lifeStones.put(8753, new LifeStone(GRADE_TOP, 0));
|
||||
_lifeStones.put(8754, new LifeStone(GRADE_TOP, 1));
|
||||
_lifeStones.put(8755, new LifeStone(GRADE_TOP, 2));
|
||||
_lifeStones.put(8756, new LifeStone(GRADE_TOP, 3));
|
||||
_lifeStones.put(8757, new LifeStone(GRADE_TOP, 4));
|
||||
_lifeStones.put(8758, new LifeStone(GRADE_TOP, 5));
|
||||
_lifeStones.put(8759, new LifeStone(GRADE_TOP, 6));
|
||||
_lifeStones.put(8760, new LifeStone(GRADE_TOP, 7));
|
||||
_lifeStones.put(8761, new LifeStone(GRADE_TOP, 8));
|
||||
_lifeStones.put(8762, new LifeStone(GRADE_TOP, 9));
|
||||
|
||||
_lifeStones.put(9573, new LifeStone(GRADE_NONE, 10));
|
||||
_lifeStones.put(9574, new LifeStone(GRADE_MID, 10));
|
||||
_lifeStones.put(9575, new LifeStone(GRADE_HIGH, 10));
|
||||
_lifeStones.put(9576, new LifeStone(GRADE_TOP, 10));
|
||||
|
||||
_lifeStones.put(10483, new LifeStone(GRADE_NONE, 11));
|
||||
_lifeStones.put(10484, new LifeStone(GRADE_MID, 11));
|
||||
_lifeStones.put(10485, new LifeStone(GRADE_HIGH, 11));
|
||||
_lifeStones.put(10486, new LifeStone(GRADE_TOP, 11));
|
||||
|
||||
_lifeStones.put(12754, new LifeStone(GRADE_ACC, 0));
|
||||
_lifeStones.put(12755, new LifeStone(GRADE_ACC, 1));
|
||||
_lifeStones.put(12756, new LifeStone(GRADE_ACC, 2));
|
||||
_lifeStones.put(12757, new LifeStone(GRADE_ACC, 3));
|
||||
_lifeStones.put(12758, new LifeStone(GRADE_ACC, 4));
|
||||
_lifeStones.put(12759, new LifeStone(GRADE_ACC, 5));
|
||||
_lifeStones.put(12760, new LifeStone(GRADE_ACC, 6));
|
||||
_lifeStones.put(12761, new LifeStone(GRADE_ACC, 7));
|
||||
_lifeStones.put(12762, new LifeStone(GRADE_ACC, 8));
|
||||
_lifeStones.put(12763, new LifeStone(GRADE_ACC, 9));
|
||||
|
||||
_lifeStones.put(12821, new LifeStone(GRADE_ACC, 10));
|
||||
_lifeStones.put(12822, new LifeStone(GRADE_ACC, 11));
|
||||
|
||||
_lifeStones.put(12840, new LifeStone(GRADE_ACC, 0));
|
||||
_lifeStones.put(12841, new LifeStone(GRADE_ACC, 1));
|
||||
_lifeStones.put(12842, new LifeStone(GRADE_ACC, 2));
|
||||
_lifeStones.put(12843, new LifeStone(GRADE_ACC, 3));
|
||||
_lifeStones.put(12844, new LifeStone(GRADE_ACC, 4));
|
||||
_lifeStones.put(12845, new LifeStone(GRADE_ACC, 5));
|
||||
_lifeStones.put(12846, new LifeStone(GRADE_ACC, 6));
|
||||
_lifeStones.put(12847, new LifeStone(GRADE_ACC, 7));
|
||||
_lifeStones.put(12848, new LifeStone(GRADE_ACC, 8));
|
||||
_lifeStones.put(12849, new LifeStone(GRADE_ACC, 9));
|
||||
_lifeStones.put(12850, new LifeStone(GRADE_ACC, 10));
|
||||
_lifeStones.put(12851, new LifeStone(GRADE_ACC, 11));
|
||||
|
||||
_lifeStones.put(14008, new LifeStone(GRADE_ACC, 12));
|
||||
|
||||
_lifeStones.put(14166, new LifeStone(GRADE_NONE, 12));
|
||||
_lifeStones.put(14167, new LifeStone(GRADE_MID, 12));
|
||||
_lifeStones.put(14168, new LifeStone(GRADE_HIGH, 12));
|
||||
_lifeStones.put(14169, new LifeStone(GRADE_TOP, 12));
|
||||
|
||||
_lifeStones.put(16160, new LifeStone(GRADE_NONE, 13));
|
||||
_lifeStones.put(16161, new LifeStone(GRADE_MID, 13));
|
||||
_lifeStones.put(16162, new LifeStone(GRADE_HIGH, 13));
|
||||
_lifeStones.put(16163, new LifeStone(GRADE_TOP, 13));
|
||||
_lifeStones.put(16177, new LifeStone(GRADE_ACC, 13));
|
||||
|
||||
_lifeStones.put(16164, new LifeStone(GRADE_NONE, 13));
|
||||
_lifeStones.put(16165, new LifeStone(GRADE_MID, 13));
|
||||
_lifeStones.put(16166, new LifeStone(GRADE_HIGH, 13));
|
||||
_lifeStones.put(16167, new LifeStone(GRADE_TOP, 13));
|
||||
_lifeStones.put(16178, new LifeStone(GRADE_ACC, 13));
|
||||
|
||||
_lifeStones.put(18563, new LifeStone(GRADE_NONE, 13));
|
||||
_lifeStones.put(18564, new LifeStone(GRADE_MID, 13));
|
||||
_lifeStones.put(18565, new LifeStone(GRADE_HIGH, 13));
|
||||
_lifeStones.put(18566, new LifeStone(GRADE_TOP, 13));
|
||||
_lifeStones.put(18567, new LifeStone(GRADE_FORGOTTEN, 13));
|
||||
_lifeStones.put(19166, new LifeStone(GRADE_ACC, 13));
|
||||
|
||||
_lifeStones.put(18568, new LifeStone(GRADE_NONE, 14));
|
||||
_lifeStones.put(18569, new LifeStone(GRADE_MID, 14));
|
||||
_lifeStones.put(18570, new LifeStone(GRADE_HIGH, 14));
|
||||
_lifeStones.put(18571, new LifeStone(GRADE_TOP, 14));
|
||||
_lifeStones.put(18572, new LifeStone(GRADE_FORGOTTEN, 14));
|
||||
_lifeStones.put(19167, new LifeStone(GRADE_ACC, 14));
|
||||
|
||||
_lifeStones.put(18573, new LifeStone(GRADE_NONE, 15));
|
||||
_lifeStones.put(18574, new LifeStone(GRADE_MID, 15));
|
||||
_lifeStones.put(18575, new LifeStone(GRADE_HIGH, 15));
|
||||
_lifeStones.put(18576, new LifeStone(GRADE_TOP, 15));
|
||||
_lifeStones.put(18577, new LifeStone(GRADE_FORGOTTEN, 15));
|
||||
_lifeStones.put(19168, new LifeStone(GRADE_ACC, 15));
|
||||
|
||||
_lifeStones.put(36731, new LifeStone(GRADE_NONE, 13));
|
||||
|
||||
_lifeStones.put(45929, new LifeStone(GRADE_NONE, 0));
|
||||
_lifeStones.put(45930, new LifeStone(GRADE_MID, 13));
|
||||
_lifeStones.put(45931, new LifeStone(GRADE_HIGH, 14));
|
||||
_lifeStones.put(45932, new LifeStone(GRADE_TOP, 15));
|
||||
|
||||
_lifeStones.put(45933, new LifeStone(GRADE_ACC, 0));
|
||||
_lifeStones.put(45934, new LifeStone(GRADE_ACC, 13));
|
||||
_lifeStones.put(45935, new LifeStone(GRADE_ACC, 14));
|
||||
_lifeStones.put(45936, new LifeStone(GRADE_ACC, 15));
|
||||
|
||||
_lifeStones.put(90012, new LifeStone(GRADE_NONE, 0)); // Classic
|
||||
_lifeStones.put(90013, new LifeStone(GRADE_MID, 0)); // Classic
|
||||
_lifeStones.put(90014, new LifeStone(GRADE_HIGH, 0)); // Classic
|
||||
_lifeStones.put(90015, new LifeStone(GRADE_TOP, 0)); // Classic
|
||||
}
|
||||
|
||||
protected static LifeStone getLifeStone(int itemId)
|
||||
{
|
||||
return _lifeStones.get(itemId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks player, source item, lifestone and gemstone validity for augmentation process
|
||||
* @param player
|
||||
* @param item
|
||||
* @param refinerItem
|
||||
* @param gemStones
|
||||
* @param mineralItem
|
||||
* @param feeItem
|
||||
* @param fee
|
||||
* @return
|
||||
*/
|
||||
protected static boolean isValid(L2PcInstance player, L2ItemInstance item, L2ItemInstance refinerItem, L2ItemInstance gemStones)
|
||||
protected static boolean isValid(L2PcInstance player, L2ItemInstance item, L2ItemInstance mineralItem, L2ItemInstance feeItem, VariationFee fee)
|
||||
{
|
||||
if (!isValid(player, item, refinerItem))
|
||||
if (fee == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!isValid(player, item, mineralItem))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// GemStones must belong to owner
|
||||
if (gemStones.getOwnerId() != player.getObjectId())
|
||||
if (feeItem.getOwnerId() != player.getObjectId())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
// .. and located in inventory
|
||||
if (gemStones.getItemLocation() != ItemLocation.INVENTORY)
|
||||
if (feeItem.getItemLocation() != ItemLocation.INVENTORY)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
final CrystalType grade = item.getItem().getCrystalType();
|
||||
final LifeStone ls = _lifeStones.get(refinerItem.getId());
|
||||
|
||||
// Check for item id
|
||||
boolean gemIdFinded = false;
|
||||
for (int id : getGemStoneId(grade))
|
||||
{
|
||||
if (gemStones.getId() == id)
|
||||
{
|
||||
gemIdFinded = true;
|
||||
}
|
||||
}
|
||||
if (!gemIdFinded)
|
||||
if (fee.getItemId() != feeItem.getId())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Count must be greater or equal of required number
|
||||
if (getGemStoneCount(grade, ls.getGrade()) > gemStones.getCount())
|
||||
if (fee.getItemCount() > feeItem.getCount())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -323,10 +83,10 @@ public abstract class AbstractRefinePacket implements IClientIncomingPacket
|
||||
* Checks player, source item and lifestone validity for augmentation process
|
||||
* @param player
|
||||
* @param item
|
||||
* @param refinerItem
|
||||
* @param mineralItem
|
||||
* @return
|
||||
*/
|
||||
protected static boolean isValid(L2PcInstance player, L2ItemInstance item, L2ItemInstance refinerItem)
|
||||
protected static boolean isValid(L2PcInstance player, L2ItemInstance item, L2ItemInstance mineralItem)
|
||||
{
|
||||
if (!isValid(player, item))
|
||||
{
|
||||
@@ -334,33 +94,12 @@ public abstract class AbstractRefinePacket implements IClientIncomingPacket
|
||||
}
|
||||
|
||||
// Item must belong to owner
|
||||
if (refinerItem.getOwnerId() != player.getObjectId())
|
||||
if (mineralItem.getOwnerId() != player.getObjectId())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
// Lifestone must be located in inventory
|
||||
if (refinerItem.getItemLocation() != ItemLocation.INVENTORY)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
final LifeStone ls = _lifeStones.get(refinerItem.getId());
|
||||
if (ls == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
// weapons can't be augmented with accessory ls
|
||||
if ((item.getItem() instanceof L2Weapon) && (ls.getGrade() == GRADE_ACC))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
// and accessory can't be augmented with weapon ls
|
||||
if ((item.getItem() instanceof L2Armor) && (ls.getGrade() != GRADE_ACC))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
// check for level of the lifestone
|
||||
if (player.getLevel() < ls.getPlayerLevel())
|
||||
if (mineralItem.getItemLocation() != ItemLocation.INVENTORY)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -414,10 +153,6 @@ public abstract class AbstractRefinePacket implements IClientIncomingPacket
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (item.getItem().getCrystalType().isLesser(CrystalType.C))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Source item can be equipped or in inventory
|
||||
switch (item.getItemLocation())
|
||||
@@ -433,39 +168,7 @@ public abstract class AbstractRefinePacket implements IClientIncomingPacket
|
||||
}
|
||||
}
|
||||
|
||||
if (item.getItem() instanceof L2Weapon)
|
||||
{
|
||||
switch (((L2Weapon) item.getItem()).getItemType())
|
||||
{
|
||||
case NONE:
|
||||
case FISHINGROD:
|
||||
{
|
||||
return false;
|
||||
}
|
||||
default:
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (item.getItem() instanceof L2Armor)
|
||||
{
|
||||
// only accessories can be augmented
|
||||
switch (item.getItem().getBodyPart())
|
||||
{
|
||||
case L2Item.SLOT_LR_FINGER:
|
||||
case L2Item.SLOT_LR_EAR:
|
||||
case L2Item.SLOT_NECK:
|
||||
{
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
if (!(item.getItem() instanceof L2Weapon) && !(item.getItem() instanceof L2Armor))
|
||||
{
|
||||
return false; // neither weapon nor armor ?
|
||||
}
|
||||
@@ -527,141 +230,4 @@ public abstract class AbstractRefinePacket implements IClientIncomingPacket
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param itemGrade
|
||||
* @return GemStone itemId based on item grade
|
||||
*/
|
||||
protected static int[] getGemStoneId(CrystalType itemGrade)
|
||||
{
|
||||
switch (itemGrade)
|
||||
{
|
||||
case D:
|
||||
{
|
||||
return GEMSTONE_D; // classic
|
||||
}
|
||||
case C:
|
||||
{
|
||||
return GEMSTONE_C; // classic
|
||||
}
|
||||
case B:
|
||||
{
|
||||
return GEMSTONE_B; // classic
|
||||
}
|
||||
case A:
|
||||
{
|
||||
return GEMSTONE_A; // classic
|
||||
}
|
||||
case S:
|
||||
case S80:
|
||||
case S84:
|
||||
{
|
||||
return GEMSTONE_B;
|
||||
}
|
||||
case R:
|
||||
{
|
||||
return GEMSTONE_A;
|
||||
}
|
||||
case R95:
|
||||
{
|
||||
return GEMSTONE_S;
|
||||
}
|
||||
case R99:
|
||||
{
|
||||
return GEMSTONE_R;
|
||||
}
|
||||
default:
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Different for weapon and accessory augmentation.
|
||||
* @param itemGrade
|
||||
* @param lifeStoneGrade
|
||||
* @return GemStone count based on item grade and life stone grade
|
||||
*/
|
||||
protected static int getGemStoneCount(CrystalType itemGrade, int lifeStoneGrade)
|
||||
{
|
||||
switch (lifeStoneGrade)
|
||||
{
|
||||
case GRADE_ACC:
|
||||
{
|
||||
switch (itemGrade)
|
||||
{
|
||||
case C:
|
||||
case B:
|
||||
case A:
|
||||
case S:
|
||||
case S80:
|
||||
case S84:
|
||||
{
|
||||
return 125;
|
||||
}
|
||||
case R:
|
||||
{
|
||||
return 30;
|
||||
}
|
||||
case R95:
|
||||
{
|
||||
return 18;
|
||||
}
|
||||
case R99:
|
||||
{
|
||||
return 8;
|
||||
}
|
||||
default:
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
default:
|
||||
{
|
||||
switch (itemGrade)
|
||||
{
|
||||
case D:
|
||||
{
|
||||
return 200; // classic
|
||||
}
|
||||
case C:
|
||||
{
|
||||
return 300; // classic
|
||||
}
|
||||
case B:
|
||||
{
|
||||
return 400; // classic
|
||||
}
|
||||
case A:
|
||||
{
|
||||
return 500; // classic
|
||||
}
|
||||
case S:
|
||||
case S80:
|
||||
case S84:
|
||||
{
|
||||
return 25;
|
||||
}
|
||||
case R:
|
||||
{
|
||||
return 20;
|
||||
}
|
||||
case R95:
|
||||
{
|
||||
return 12;
|
||||
}
|
||||
case R99:
|
||||
{
|
||||
return 5;
|
||||
}
|
||||
default:
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -183,7 +183,7 @@ public class MultiSellChoose implements IClientIncomingPacket
|
||||
|| (itemEnchantment.getAttributeDefence(AttributeType.HOLY) != _holyDefence)
|
||||
|| (itemEnchantment.getAttributeDefence(AttributeType.DARK) != _darkDefence)
|
||||
|| ((itemEnchantment.getAugmentation() == null) && ((_augmentOption1 != 0) || (_augmentOption2 != 0)))
|
||||
|| ((itemEnchantment.getAugmentation() != null) && ((itemEnchantment.getAugmentation().getOptionId(0) != _augmentOption1) || (itemEnchantment.getAugmentation().getOptionId(1) != _augmentOption2)))
|
||||
|| ((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)))
|
||||
|
||||
@@ -18,6 +18,7 @@ package com.l2jmobius.gameserver.network.clientpackets;
|
||||
|
||||
import com.l2jmobius.Config;
|
||||
import com.l2jmobius.commons.network.PacketReader;
|
||||
import com.l2jmobius.gameserver.data.xml.impl.VariationData;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
|
||||
import com.l2jmobius.gameserver.network.L2GameClient;
|
||||
@@ -72,81 +73,11 @@ public final class RequestConfirmCancelItem implements IClientIncomingPacket
|
||||
return;
|
||||
}
|
||||
|
||||
int price = 0;
|
||||
switch (item.getItem().getCrystalType())
|
||||
final long price = VariationData.getInstance().getCancelFee(item.getId(), item.getAugmentation().getMineralId());
|
||||
if (price < 0)
|
||||
{
|
||||
case D:
|
||||
{
|
||||
price = 80000; // classic
|
||||
break;
|
||||
}
|
||||
case C:
|
||||
{
|
||||
price = 240000; // classic
|
||||
break;
|
||||
}
|
||||
case B:
|
||||
{
|
||||
price = 720000; // classic
|
||||
break;
|
||||
}
|
||||
case A:
|
||||
{
|
||||
price = 1500000; // classic - guessed
|
||||
break;
|
||||
}
|
||||
case S:
|
||||
{
|
||||
if (item.getCrystalCount() <= 2052)
|
||||
{
|
||||
price = 480000;
|
||||
}
|
||||
else
|
||||
{
|
||||
price = 920000;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case S80:
|
||||
case S84:
|
||||
{
|
||||
if (item.getCrystalCount() <= 4965)
|
||||
{
|
||||
price = 920000;
|
||||
}
|
||||
else if (item.getCrystalCount() <= 7050)
|
||||
{
|
||||
price = 2800000;
|
||||
}
|
||||
else if (item.getCrystalCount() <= 8233)
|
||||
{
|
||||
price = 2800000;
|
||||
}
|
||||
else
|
||||
{
|
||||
price = 3200000;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case R:
|
||||
{
|
||||
price = 3492800;
|
||||
break;
|
||||
}
|
||||
case R95:
|
||||
{
|
||||
price = 2943200;
|
||||
break;
|
||||
}
|
||||
case R99:
|
||||
{
|
||||
price = 6485800;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
return;
|
||||
}
|
||||
activeChar.sendPacket(SystemMessageId.THIS_IS_NOT_A_SUITABLE_ITEM);
|
||||
return;
|
||||
}
|
||||
|
||||
activeChar.sendPacket(new ExPutItemResultForVariationCancel(item, price));
|
||||
|
||||
@@ -17,8 +17,10 @@
|
||||
package com.l2jmobius.gameserver.network.clientpackets;
|
||||
|
||||
import com.l2jmobius.commons.network.PacketReader;
|
||||
import com.l2jmobius.gameserver.data.xml.impl.VariationData;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
|
||||
import com.l2jmobius.gameserver.model.options.VariationFee;
|
||||
import com.l2jmobius.gameserver.network.L2GameClient;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.ExPutCommissionResultForVariationMake;
|
||||
@@ -30,17 +32,17 @@ import com.l2jmobius.gameserver.network.serverpackets.ExPutCommissionResultForVa
|
||||
public final class RequestConfirmGemStone extends AbstractRefinePacket
|
||||
{
|
||||
private int _targetItemObjId;
|
||||
private int _refinerItemObjId;
|
||||
private int _gemstoneItemObjId;
|
||||
private long _gemStoneCount;
|
||||
private int _mineralItemObjId;
|
||||
private int _feeItemObjId;
|
||||
private long _feeCount;
|
||||
|
||||
@Override
|
||||
public boolean read(L2GameClient client, PacketReader packet)
|
||||
{
|
||||
_targetItemObjId = packet.readD();
|
||||
_refinerItemObjId = packet.readD();
|
||||
_gemstoneItemObjId = packet.readD();
|
||||
_gemStoneCount = packet.readQ();
|
||||
_mineralItemObjId = packet.readD();
|
||||
_feeItemObjId = packet.readD();
|
||||
_feeCount = packet.readQ();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -52,42 +54,39 @@ public final class RequestConfirmGemStone extends AbstractRefinePacket
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final L2ItemInstance targetItem = activeChar.getInventory().getItemByObjectId(_targetItemObjId);
|
||||
if (targetItem == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
final L2ItemInstance refinerItem = activeChar.getInventory().getItemByObjectId(_refinerItemObjId);
|
||||
|
||||
final L2ItemInstance refinerItem = activeChar.getInventory().getItemByObjectId(_mineralItemObjId);
|
||||
if (refinerItem == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
final L2ItemInstance gemStoneItem = activeChar.getInventory().getItemByObjectId(_gemstoneItemObjId);
|
||||
|
||||
final L2ItemInstance gemStoneItem = activeChar.getInventory().getItemByObjectId(_feeItemObjId);
|
||||
if (gemStoneItem == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Make sure the item is a gemstone
|
||||
if (!isValid(activeChar, targetItem, refinerItem, gemStoneItem))
|
||||
final VariationFee fee = VariationData.getInstance().getFee(targetItem.getId(), refinerItem.getId());
|
||||
if (!isValid(activeChar, targetItem, refinerItem, gemStoneItem, fee))
|
||||
{
|
||||
client.sendPacket(SystemMessageId.THIS_IS_NOT_A_SUITABLE_ITEM);
|
||||
return;
|
||||
}
|
||||
|
||||
// Check for gemstone count
|
||||
final LifeStone ls = getLifeStone(refinerItem.getId());
|
||||
if (ls == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (_gemStoneCount != getGemStoneCount(targetItem.getItem().getCrystalType(), ls.getGrade()))
|
||||
// Check for fee count
|
||||
if (_feeCount != fee.getItemCount())
|
||||
{
|
||||
client.sendPacket(SystemMessageId.GEMSTONE_QUANTITY_IS_INCORRECT);
|
||||
return;
|
||||
}
|
||||
|
||||
client.sendPacket(new ExPutCommissionResultForVariationMake(_gemstoneItemObjId, _gemStoneCount, gemStoneItem.getId()));
|
||||
client.sendPacket(new ExPutCommissionResultForVariationMake(_feeItemObjId, _feeCount, gemStoneItem.getId()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,10 +17,10 @@
|
||||
package com.l2jmobius.gameserver.network.clientpackets;
|
||||
|
||||
import com.l2jmobius.commons.network.PacketReader;
|
||||
import com.l2jmobius.gameserver.datatables.AugmentationData;
|
||||
import com.l2jmobius.gameserver.data.xml.impl.VariationData;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
|
||||
import com.l2jmobius.gameserver.model.items.type.CrystalType;
|
||||
import com.l2jmobius.gameserver.model.options.VariationFee;
|
||||
import com.l2jmobius.gameserver.network.L2GameClient;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.ExPutIntensiveResultForVariationMake;
|
||||
@@ -63,33 +63,13 @@ public class RequestConfirmRefinerItem extends AbstractRefinePacket
|
||||
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))
|
||||
final VariationFee fee = VariationData.getInstance().getFee(targetItem.getId(), refinerItem.getId());
|
||||
if ((fee == null) || !isValid(activeChar, targetItem, refinerItem))
|
||||
{
|
||||
activeChar.sendPacket(SystemMessageId.THIS_IS_NOT_A_SUITABLE_ITEM);
|
||||
return;
|
||||
}
|
||||
|
||||
final int refinerItemId = refinerItem.getItem().getId();
|
||||
final CrystalType grade = targetItem.getItem().getCrystalType();
|
||||
final LifeStone ls = getLifeStone(refinerItemId);
|
||||
int gemStoneId = 0;
|
||||
if (getGemStoneId(grade) != null)
|
||||
{
|
||||
for (int id : getGemStoneId(grade))
|
||||
{
|
||||
if (activeChar.getInventory().getAllItemsByItemId(id) != null)
|
||||
{
|
||||
gemStoneId = id;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
activeChar.sendPacket(new ExPutIntensiveResultForVariationMake(_refinerItemObjId, refinerItemId, gemStoneId, getGemStoneCount(grade, ls.getGrade())));
|
||||
activeChar.sendPacket(new ExPutIntensiveResultForVariationMake(_refinerItemObjId, refinerItem.getId(), fee.getItemId(), fee.getItemCount()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package com.l2jmobius.gameserver.network.clientpackets;
|
||||
|
||||
import com.l2jmobius.commons.network.PacketReader;
|
||||
import com.l2jmobius.gameserver.data.xml.impl.VariationData;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
|
||||
import com.l2jmobius.gameserver.network.L2GameClient;
|
||||
@@ -53,6 +54,12 @@ public final class RequestConfirmTargetItem extends AbstractRefinePacket
|
||||
return;
|
||||
}
|
||||
|
||||
if (!VariationData.getInstance().hasFeeData(item.getId()))
|
||||
{
|
||||
client.sendPacket(SystemMessageId.THIS_IS_NOT_A_SUITABLE_ITEM);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!isValid(activeChar, item))
|
||||
{
|
||||
// Different system message here
|
||||
|
||||
@@ -17,10 +17,12 @@
|
||||
package com.l2jmobius.gameserver.network.clientpackets;
|
||||
|
||||
import com.l2jmobius.commons.network.PacketReader;
|
||||
import com.l2jmobius.gameserver.datatables.AugmentationData;
|
||||
import com.l2jmobius.gameserver.model.Augmentation;
|
||||
import com.l2jmobius.gameserver.data.xml.impl.VariationData;
|
||||
import com.l2jmobius.gameserver.model.VariationInstance;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
|
||||
import com.l2jmobius.gameserver.model.options.Variation;
|
||||
import com.l2jmobius.gameserver.model.options.VariationFee;
|
||||
import com.l2jmobius.gameserver.network.L2GameClient;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.ExVariationResult;
|
||||
@@ -33,17 +35,17 @@ import com.l2jmobius.gameserver.network.serverpackets.InventoryUpdate;
|
||||
public final class RequestRefine extends AbstractRefinePacket
|
||||
{
|
||||
private int _targetItemObjId;
|
||||
private int _refinerItemObjId;
|
||||
private int _gemStoneItemObjId;
|
||||
private long _gemStoneCount;
|
||||
private int _mineralItemObjId;
|
||||
private int _feeItemObjId;
|
||||
private long _feeCount;
|
||||
|
||||
@Override
|
||||
public boolean read(L2GameClient client, PacketReader packet)
|
||||
{
|
||||
_targetItemObjId = packet.readD();
|
||||
_refinerItemObjId = packet.readD();
|
||||
_gemStoneItemObjId = packet.readD();
|
||||
_gemStoneCount = packet.readQ();
|
||||
_mineralItemObjId = packet.readD();
|
||||
_feeItemObjId = packet.readD();
|
||||
_feeCount = packet.readQ();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -55,77 +57,82 @@ public final class RequestRefine extends AbstractRefinePacket
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final L2ItemInstance targetItem = activeChar.getInventory().getItemByObjectId(_targetItemObjId);
|
||||
if (targetItem == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
final L2ItemInstance refinerItem = activeChar.getInventory().getItemByObjectId(_refinerItemObjId);
|
||||
if (refinerItem == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
final L2ItemInstance gemStoneItem = activeChar.getInventory().getItemByObjectId(_gemStoneItemObjId);
|
||||
if (gemStoneItem == null)
|
||||
|
||||
final L2ItemInstance mineralItem = activeChar.getInventory().getItemByObjectId(_mineralItemObjId);
|
||||
if (mineralItem == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!isValid(activeChar, targetItem, refinerItem, gemStoneItem))
|
||||
final L2ItemInstance feeItem = activeChar.getInventory().getItemByObjectId(_feeItemObjId);
|
||||
if (feeItem == null)
|
||||
{
|
||||
activeChar.sendPacket(new ExVariationResult(0, 0, 0));
|
||||
return;
|
||||
}
|
||||
|
||||
final VariationFee fee = VariationData.getInstance().getFee(targetItem.getId(), mineralItem.getId());
|
||||
if (!isValid(activeChar, targetItem, mineralItem, feeItem, fee))
|
||||
{
|
||||
activeChar.sendPacket(new ExVariationResult(0, 0, false));
|
||||
activeChar.sendPacket(SystemMessageId.AUGMENTATION_FAILED_DUE_TO_INAPPROPRIATE_CONDITIONS);
|
||||
return;
|
||||
}
|
||||
|
||||
final LifeStone ls = getLifeStone(refinerItem.getId());
|
||||
if (ls == null)
|
||||
if (_feeCount != fee.getItemCount())
|
||||
{
|
||||
activeChar.sendPacket(new ExVariationResult(0, 0, false));
|
||||
activeChar.sendPacket(SystemMessageId.AUGMENTATION_FAILED_DUE_TO_INAPPROPRIATE_CONDITIONS);
|
||||
return;
|
||||
}
|
||||
|
||||
final int lifeStoneLevel = ls.getLevel();
|
||||
final int lifeStoneGrade = ls.getGrade();
|
||||
if (_gemStoneCount != getGemStoneCount(targetItem.getItem().getCrystalType(), lifeStoneGrade))
|
||||
final Variation variation = VariationData.getInstance().getVariation(mineralItem.getId());
|
||||
if (variation == null)
|
||||
{
|
||||
activeChar.sendPacket(new ExVariationResult(0, 0, 0));
|
||||
activeChar.sendPacket(SystemMessageId.AUGMENTATION_FAILED_DUE_TO_INAPPROPRIATE_CONDITIONS);
|
||||
activeChar.sendPacket(new ExVariationResult(0, 0, false));
|
||||
return;
|
||||
}
|
||||
|
||||
final VariationInstance augment = VariationData.getInstance().generateRandomVariation(variation, targetItem);
|
||||
if (augment == null)
|
||||
{
|
||||
activeChar.sendPacket(new ExVariationResult(0, 0, false));
|
||||
return;
|
||||
}
|
||||
|
||||
// unequip item
|
||||
final InventoryUpdate iu = new InventoryUpdate();
|
||||
if (targetItem.isEquipped())
|
||||
{
|
||||
final L2ItemInstance[] unequiped = activeChar.getInventory().unEquipItemInSlotAndRecord(targetItem.getLocationSlot());
|
||||
final InventoryUpdate iu = new InventoryUpdate();
|
||||
L2ItemInstance[] unequiped = activeChar.getInventory().unEquipItemInSlotAndRecord(targetItem.getLocationSlot());
|
||||
for (L2ItemInstance itm : unequiped)
|
||||
{
|
||||
iu.addModifiedItem(itm);
|
||||
}
|
||||
activeChar.sendInventoryUpdate(iu);
|
||||
activeChar.broadcastUserInfo();
|
||||
}
|
||||
|
||||
// consume the life stone
|
||||
if (!activeChar.destroyItem("RequestRefine", refinerItem, 1, null, false))
|
||||
if (!activeChar.destroyItem("RequestRefine", mineralItem, 1, null, false))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// consume the gemstones
|
||||
if (!activeChar.destroyItem("RequestRefine", gemStoneItem, _gemStoneCount, null, false))
|
||||
if (!activeChar.destroyItem("RequestRefine", feeItem, _feeCount, null, false))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final Augmentation aug = AugmentationData.getInstance().generateRandomAugmentation(lifeStoneLevel, lifeStoneGrade, targetItem.getItem().getBodyPart(), refinerItem.getId(), targetItem);
|
||||
targetItem.setAugmentation(aug, true);
|
||||
targetItem.setAugmentation(augment, true);
|
||||
activeChar.sendPacket(new ExVariationResult(augment.getOption1Id(), augment.getOption2Id(), true));
|
||||
|
||||
activeChar.sendPacket(new ExVariationResult(aug.getOptionId(0), aug.getOptionId(1), 1));
|
||||
|
||||
final InventoryUpdate iu = new InventoryUpdate();
|
||||
iu.addModifiedItem(targetItem);
|
||||
activeChar.sendInventoryUpdate(iu);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ package com.l2jmobius.gameserver.network.clientpackets;
|
||||
|
||||
import com.l2jmobius.Config;
|
||||
import com.l2jmobius.commons.network.PacketReader;
|
||||
import com.l2jmobius.gameserver.data.xml.impl.VariationData;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
|
||||
import com.l2jmobius.gameserver.network.L2GameClient;
|
||||
@@ -53,84 +54,36 @@ public final class RequestRefineCancel implements IClientIncomingPacket
|
||||
final L2ItemInstance targetItem = activeChar.getInventory().getItemByObjectId(_targetItemObjId);
|
||||
if (targetItem == null)
|
||||
{
|
||||
client.sendPacket(new ExVariationCancelResult(0));
|
||||
client.sendPacket(ExVariationCancelResult.STATIC_PACKET_FAILURE);
|
||||
return;
|
||||
}
|
||||
|
||||
if (targetItem.getOwnerId() != activeChar.getObjectId())
|
||||
{
|
||||
Util.handleIllegalPlayerAction(client.getActiveChar(), "Warning!! Character " + client.getActiveChar().getName() + " of account " + client.getActiveChar().getAccountName() + " tryied to augment item that doesn't own.", Config.DEFAULT_PUNISH);
|
||||
return;
|
||||
}
|
||||
|
||||
// cannot remove augmentation from a not augmented item
|
||||
if (!targetItem.isAugmented())
|
||||
{
|
||||
client.sendPacket(SystemMessageId.AUGMENTATION_REMOVAL_CAN_ONLY_BE_DONE_ON_AN_AUGMENTED_ITEM);
|
||||
client.sendPacket(new ExVariationCancelResult(0));
|
||||
client.sendPacket(ExVariationCancelResult.STATIC_PACKET_FAILURE);
|
||||
return;
|
||||
}
|
||||
|
||||
// get the price
|
||||
int price = 0;
|
||||
switch (targetItem.getItem().getCrystalType())
|
||||
final long price = VariationData.getInstance().getCancelFee(targetItem.getId(), targetItem.getAugmentation().getMineralId());
|
||||
if (price < 0)
|
||||
{
|
||||
case D:
|
||||
{
|
||||
price = 80000; // classic
|
||||
break;
|
||||
}
|
||||
case C:
|
||||
{
|
||||
price = 240000; // classic
|
||||
break;
|
||||
}
|
||||
case B:
|
||||
{
|
||||
price = 720000; // classic
|
||||
break;
|
||||
}
|
||||
case A:
|
||||
{
|
||||
price = 1500000; // classic - guessed
|
||||
break;
|
||||
}
|
||||
case S:
|
||||
{
|
||||
price = 480000;
|
||||
break;
|
||||
}
|
||||
case S80:
|
||||
case S84:
|
||||
{
|
||||
price = 920000;
|
||||
break;
|
||||
}
|
||||
case R:
|
||||
{
|
||||
price = 1560000;
|
||||
break;
|
||||
}
|
||||
case R95:
|
||||
{
|
||||
price = 5400000;
|
||||
break;
|
||||
}
|
||||
case R99:
|
||||
{
|
||||
price = 14160000;
|
||||
break;
|
||||
}
|
||||
// any other item type is not augmentable
|
||||
default:
|
||||
{
|
||||
client.sendPacket(new ExVariationCancelResult(0));
|
||||
return;
|
||||
}
|
||||
client.sendPacket(ExVariationCancelResult.STATIC_PACKET_FAILURE);
|
||||
return;
|
||||
}
|
||||
|
||||
// try to reduce the players adena
|
||||
if (!activeChar.reduceAdena("RequestRefineCancel", price, null, true))
|
||||
if (!activeChar.reduceAdena("RequestRefineCancel", price, targetItem, true))
|
||||
{
|
||||
client.sendPacket(new ExVariationCancelResult(0));
|
||||
client.sendPacket(ExVariationCancelResult.STATIC_PACKET_FAILURE);
|
||||
client.sendPacket(SystemMessageId.YOU_DO_NOT_HAVE_ENOUGH_ADENA);
|
||||
return;
|
||||
}
|
||||
@@ -145,10 +98,10 @@ public final class RequestRefineCancel implements IClientIncomingPacket
|
||||
targetItem.removeAugmentation();
|
||||
|
||||
// send ExVariationCancelResult
|
||||
client.sendPacket(new ExVariationCancelResult(1));
|
||||
client.sendPacket(ExVariationCancelResult.STATIC_PACKET_SUCCESS);
|
||||
|
||||
// send inventory update
|
||||
final InventoryUpdate iu = new InventoryUpdate();
|
||||
InventoryUpdate iu = new InventoryUpdate();
|
||||
iu.addModifiedItem(targetItem);
|
||||
activeChar.sendInventoryUpdate(iu);
|
||||
}
|
||||
|
||||
@@ -145,8 +145,8 @@ public abstract class AbstractItemPacket extends AbstractMaskPacket<ItemListType
|
||||
{
|
||||
if ((item != null) && (item.getAugmentation() != null))
|
||||
{
|
||||
packet.writeD(item.getAugmentation().getOptionId(0));
|
||||
packet.writeD(item.getAugmentation().getOptionId(1));
|
||||
packet.writeD(item.getAugmentation().getOption1Id());
|
||||
packet.writeD(item.getAugmentation().getOption2Id());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -21,7 +21,7 @@ import java.util.Set;
|
||||
import com.l2jmobius.Config;
|
||||
import com.l2jmobius.commons.network.PacketWriter;
|
||||
import com.l2jmobius.gameserver.instancemanager.CursedWeaponsManager;
|
||||
import com.l2jmobius.gameserver.model.Augmentation;
|
||||
import com.l2jmobius.gameserver.model.VariationInstance;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2DecoyInstance;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.ceremonyofchaos.CeremonyOfChaosEvent;
|
||||
@@ -134,9 +134,9 @@ public class CharInfo implements IClientOutgoingPacket
|
||||
|
||||
for (int slot : getPaperdollOrderAugument())
|
||||
{
|
||||
final Augmentation augment = _activeChar.getInventory().getPaperdollAugmentation(slot);
|
||||
packet.writeD(augment != null ? augment.getOptionId(0) : 0); // Confirmed
|
||||
packet.writeD(augment != null ? augment.getOptionId(1) : 0); // Confirmed
|
||||
final VariationInstance augment = _activeChar.getInventory().getPaperdollAugmentation(slot);
|
||||
packet.writeD(augment != null ? augment.getOption1Id() : 0); // Confirmed
|
||||
packet.writeD(augment != null ? augment.getOption2Id() : 0); // Confirmed
|
||||
}
|
||||
|
||||
packet.writeC(_armorEnchant);
|
||||
|
||||
@@ -29,9 +29,9 @@ import com.l2jmobius.commons.database.DatabaseFactory;
|
||||
import com.l2jmobius.commons.network.PacketWriter;
|
||||
import com.l2jmobius.gameserver.data.sql.impl.ClanTable;
|
||||
import com.l2jmobius.gameserver.data.xml.impl.ExperienceData;
|
||||
import com.l2jmobius.gameserver.datatables.AugmentationData;
|
||||
import com.l2jmobius.gameserver.model.CharSelectInfoPackage;
|
||||
import com.l2jmobius.gameserver.model.L2Clan;
|
||||
import com.l2jmobius.gameserver.model.VariationInstance;
|
||||
import com.l2jmobius.gameserver.model.entity.Hero;
|
||||
import com.l2jmobius.gameserver.model.itemcontainer.Inventory;
|
||||
import com.l2jmobius.gameserver.network.L2GameClient;
|
||||
@@ -192,8 +192,8 @@ public class CharSelectionInfo implements IClientOutgoingPacket
|
||||
packet.writeD(i == _activeId ? 1 : 0);
|
||||
|
||||
packet.writeC(charInfoPackage.getEnchantEffect() > 127 ? 127 : charInfoPackage.getEnchantEffect());
|
||||
packet.writeD(charInfoPackage.getAugmentation() != null ? charInfoPackage.getAugmentation().getOptionId(0) : 0);
|
||||
packet.writeD(charInfoPackage.getAugmentation() != null ? charInfoPackage.getAugmentation().getOptionId(1) : 0);
|
||||
packet.writeD(charInfoPackage.getAugmentation() != null ? charInfoPackage.getAugmentation().getOption1Id() : 0);
|
||||
packet.writeD(charInfoPackage.getAugmentation() != null ? charInfoPackage.getAugmentation().getOption2Id() : 0);
|
||||
|
||||
// packet.writeD(charInfoPackage.getTransformId()); // Used to display Transformations
|
||||
packet.writeD(0x00); // Currently on retail when you are on character select you don't see your transformation.
|
||||
@@ -359,17 +359,19 @@ public class CharSelectionInfo implements IClientOutgoingPacket
|
||||
if (weaponObjId > 0)
|
||||
{
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement statement = con.prepareStatement("SELECT augAttributes FROM item_attributes WHERE itemId=?"))
|
||||
PreparedStatement statement = con.prepareStatement("SELECT mineralId,option1,option2 FROM item_variations WHERE itemId=?"))
|
||||
{
|
||||
statement.setInt(1, weaponObjId);
|
||||
try (ResultSet result = statement.executeQuery())
|
||||
{
|
||||
if (result.next())
|
||||
{
|
||||
final int augment = result.getInt("augAttributes");
|
||||
if (augment > 0)
|
||||
int mineralId = result.getInt("mineralId");
|
||||
int option1 = result.getInt("option1");
|
||||
int option2 = result.getInt("option2");
|
||||
if ((option1 != -1) && (option2 != -1))
|
||||
{
|
||||
charInfopackage.setAugmentation(AugmentationData.getInstance().getAugmentation(augment));
|
||||
charInfopackage.setAugmentation(new VariationInstance(mineralId, option1, option2));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,10 +24,10 @@ public class ExPutIntensiveResultForVariationMake implements IClientOutgoingPack
|
||||
private final int _refinerItemObjId;
|
||||
private final int _lifestoneItemId;
|
||||
private final int _gemstoneItemId;
|
||||
private final int _gemstoneCount;
|
||||
private final long _gemstoneCount;
|
||||
private final int _unk2;
|
||||
|
||||
public ExPutIntensiveResultForVariationMake(int refinerItemObjId, int lifeStoneId, int gemstoneItemId, int gemstoneCount)
|
||||
public ExPutIntensiveResultForVariationMake(int refinerItemObjId, int lifeStoneId, int gemstoneItemId, long gemstoneCount)
|
||||
{
|
||||
_refinerItemObjId = refinerItemObjId;
|
||||
_lifestoneItemId = lifeStoneId;
|
||||
|
||||
@@ -33,8 +33,8 @@ public class ExPutItemResultForVariationCancel implements IClientOutgoingPacket
|
||||
_itemObjId = item.getObjectId();
|
||||
_itemId = item.getDisplayId();
|
||||
_price = price;
|
||||
_itemAug1 = item.getAugmentation().getOptionId(0);
|
||||
_itemAug2 = item.getAugmentation().getOptionId(1);
|
||||
_itemAug1 = item.getAugmentation().getOption1Id();
|
||||
_itemAug2 = item.getAugmentation().getOption2Id();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -18,7 +18,7 @@ package com.l2jmobius.gameserver.network.serverpackets;
|
||||
|
||||
import com.l2jmobius.commons.network.PacketWriter;
|
||||
import com.l2jmobius.gameserver.enums.InventorySlot;
|
||||
import com.l2jmobius.gameserver.model.Augmentation;
|
||||
import com.l2jmobius.gameserver.model.VariationInstance;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.itemcontainer.PcInventory;
|
||||
import com.l2jmobius.gameserver.network.OutgoingPackets;
|
||||
@@ -74,12 +74,12 @@ public class ExUserInfoEquipSlot extends AbstractMaskPacket<InventorySlot>
|
||||
{
|
||||
if (containsMask(slot))
|
||||
{
|
||||
final Augmentation augment = inventory.getPaperdollAugmentation(slot.getSlot());
|
||||
final VariationInstance augment = inventory.getPaperdollAugmentation(slot.getSlot());
|
||||
packet.writeH(22); // 10 + 4 * 3
|
||||
packet.writeD(inventory.getPaperdollObjectId(slot.getSlot()));
|
||||
packet.writeD(inventory.getPaperdollItemId(slot.getSlot()));
|
||||
packet.writeD(augment != null ? augment.getOptionId(0) : 0);
|
||||
packet.writeD(augment != null ? augment.getOptionId(1) : 0);
|
||||
packet.writeD(augment != null ? augment.getOption1Id() : 0);
|
||||
packet.writeD(augment != null ? augment.getOption2Id() : 0);
|
||||
packet.writeD(inventory.getPaperdollItemVisualId(slot.getSlot()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,9 +21,12 @@ import com.l2jmobius.gameserver.network.OutgoingPackets;
|
||||
|
||||
public class ExVariationCancelResult implements IClientOutgoingPacket
|
||||
{
|
||||
public static final ExVariationCancelResult STATIC_PACKET_SUCCESS = new ExVariationCancelResult(1);
|
||||
public static final ExVariationCancelResult STATIC_PACKET_FAILURE = new ExVariationCancelResult(0);
|
||||
|
||||
private final int _result;
|
||||
|
||||
public ExVariationCancelResult(int result)
|
||||
private ExVariationCancelResult(int result)
|
||||
{
|
||||
_result = result;
|
||||
}
|
||||
|
||||
@@ -24,15 +24,15 @@ import com.l2jmobius.gameserver.network.OutgoingPackets;
|
||||
*/
|
||||
public class ExVariationResult implements IClientOutgoingPacket
|
||||
{
|
||||
private final int _stat12;
|
||||
private final int _stat34;
|
||||
private final int _unk3;
|
||||
private final int _option1;
|
||||
private final int _option2;
|
||||
private final int _success;
|
||||
|
||||
public ExVariationResult(int unk1, int unk2, int unk3)
|
||||
public ExVariationResult(int option1, int option2, boolean success)
|
||||
{
|
||||
_stat12 = unk1;
|
||||
_stat34 = unk2;
|
||||
_unk3 = unk3;
|
||||
_option1 = option1;
|
||||
_option2 = option2;
|
||||
_success = success ? 0x01 : 0x00;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -40,9 +40,9 @@ public class ExVariationResult implements IClientOutgoingPacket
|
||||
{
|
||||
OutgoingPackets.EX_VARIATION_RESULT.writeId(packet);
|
||||
|
||||
packet.writeD(_stat12);
|
||||
packet.writeD(_stat34);
|
||||
packet.writeD(_unk3);
|
||||
packet.writeD(_option1);
|
||||
packet.writeD(_option2);
|
||||
packet.writeD(_success);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ package com.l2jmobius.gameserver.network.serverpackets;
|
||||
import com.l2jmobius.commons.network.PacketWriter;
|
||||
import com.l2jmobius.gameserver.data.xml.impl.ExperienceData;
|
||||
import com.l2jmobius.gameserver.enums.AttributeType;
|
||||
import com.l2jmobius.gameserver.model.Augmentation;
|
||||
import com.l2jmobius.gameserver.model.VariationInstance;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.network.OutgoingPackets;
|
||||
|
||||
@@ -89,9 +89,9 @@ public class GMViewCharacterInfo implements IClientOutgoingPacket
|
||||
|
||||
for (int slot : getPaperdollOrder())
|
||||
{
|
||||
final Augmentation augment = _activeChar.getInventory().getPaperdollAugmentation(slot);
|
||||
packet.writeD(augment != null ? augment.getOptionId(0) : 0); // Confirmed
|
||||
packet.writeD(augment != null ? augment.getOptionId(1) : 0); // Confirmed
|
||||
final VariationInstance augment = _activeChar.getInventory().getPaperdollAugmentation(slot);
|
||||
packet.writeD(augment != null ? augment.getOption1Id() : 0); // Confirmed
|
||||
packet.writeD(augment != null ? augment.getOption2Id() : 0); // Confirmed
|
||||
}
|
||||
|
||||
packet.writeC(_activeChar.getInventory().getTalismanSlots()); // CT2.3
|
||||
|
||||
Reference in New Issue
Block a user