diff --git a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/AlchemyData.xml b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/AlchemyData.xml deleted file mode 100644 index d09fe97193..0000000000 --- a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/AlchemyData.xml +++ /dev/null @@ -1,1221 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/xsd/AlchemyData.xsd b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/xsd/AlchemyData.xsd deleted file mode 100644 index d703156dfa..0000000000 --- a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/xsd/AlchemyData.xsd +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/GameServer.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/GameServer.java index cf9357b47a..84fc7810a1 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/GameServer.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/GameServer.java @@ -40,7 +40,6 @@ import com.l2jmobius.gameserver.data.sql.impl.CrestTable; import com.l2jmobius.gameserver.data.sql.impl.OfflineTradersTable; import com.l2jmobius.gameserver.data.xml.impl.ActionData; import com.l2jmobius.gameserver.data.xml.impl.AdminData; -import com.l2jmobius.gameserver.data.xml.impl.AlchemyData; import com.l2jmobius.gameserver.data.xml.impl.AppearanceItemData; import com.l2jmobius.gameserver.data.xml.impl.ArmorSetsData; import com.l2jmobius.gameserver.data.xml.impl.AttendanceRewardData; @@ -238,7 +237,6 @@ public class GameServer PrimeShopData.getInstance(); PcCafePointsManager.getInstance(); AppearanceItemData.getInstance(); - AlchemyData.getInstance(); CommissionManager.getInstance(); LuckyGameData.getInstance(); AttendanceRewardData.getInstance(); diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/data/xml/impl/AlchemyData.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/data/xml/impl/AlchemyData.java deleted file mode 100644 index a5d8153b82..0000000000 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/data/xml/impl/AlchemyData.java +++ /dev/null @@ -1,140 +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 . - */ -package com.l2jmobius.gameserver.data.xml.impl; - -import java.io.File; -import java.util.HashMap; -import java.util.Map; -import java.util.logging.Logger; - -import org.w3c.dom.Document; -import org.w3c.dom.NamedNodeMap; -import org.w3c.dom.Node; - -import com.l2jmobius.commons.util.IGameXmlReader; -import com.l2jmobius.gameserver.model.StatsSet; -import com.l2jmobius.gameserver.model.alchemy.AlchemyCraftData; -import com.l2jmobius.gameserver.model.holders.ItemHolder; - -/** - * @author Sdw - */ -public class AlchemyData implements IGameXmlReader -{ - private static final Logger LOGGER = Logger.getLogger(AlchemyData.class.getName()); - - private final Map _alchemy = new HashMap<>(); - - protected AlchemyData() - { - load(); - } - - @Override - public void load() - { - _alchemy.clear(); - parseDatapackFile("data/AlchemyData.xml"); - LOGGER.info(getClass().getSimpleName() + ": Loaded " + _alchemy.size() + " alchemy craft skills."); - } - - @Override - public void parseDocument(Document doc, File f) - { - StatsSet set; - Node att; - NamedNodeMap attrs; - 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 ("skill".equalsIgnoreCase(d.getNodeName())) - { - attrs = d.getAttributes(); - set = new StatsSet(); - for (int i = 0; i < attrs.getLength(); i++) - { - att = attrs.item(i); - set.set(att.getNodeName(), att.getNodeValue()); - } - - final AlchemyCraftData alchemyCraft = new AlchemyCraftData(set); - - for (Node c = d.getFirstChild(); c != null; c = c.getNextSibling()) - { - if ("ingredients".equalsIgnoreCase(c.getNodeName())) - { - for (Node b = c.getFirstChild(); b != null; b = b.getNextSibling()) - { - if ("item".equalsIgnoreCase(b.getNodeName())) - { - final int ingId = Integer.parseInt(b.getAttributes().getNamedItem("id").getNodeValue()); - final int ingCount = Integer.parseInt(b.getAttributes().getNamedItem("count").getNodeValue()); - alchemyCraft.addIngredient(new ItemHolder(ingId, ingCount)); - } - } - } - else if ("production".equalsIgnoreCase(c.getNodeName())) - { - for (Node b = c.getFirstChild(); b != null; b = b.getNextSibling()) - { - if ("item".equalsIgnoreCase(b.getNodeName())) - { - final String type = b.getAttributes().getNamedItem("type").getNodeValue(); - final int prodId = Integer.parseInt(b.getAttributes().getNamedItem("id").getNodeValue()); - final int prodCount = Integer.parseInt(b.getAttributes().getNamedItem("count").getNodeValue()); - - if (type.equalsIgnoreCase("ON_SUCCESS")) - { - alchemyCraft.setProductionSuccess(new ItemHolder(prodId, prodCount)); - } - else if (type.equalsIgnoreCase("ON_FAILURE")) - { - alchemyCraft.setProductionFailure(new ItemHolder(prodId, prodCount)); - } - } - } - } - } - _alchemy.put(SkillData.getSkillHashCode(set.getInt("id"), set.getInt("level")), alchemyCraft); - } - } - } - } - } - - public AlchemyCraftData getCraftData(int skillId, int skillLevel) - { - return _alchemy.get(SkillData.getSkillHashCode(skillId, skillLevel)); - } - - /** - * Gets the single instance of AlchemyData. - * @return single instance of AlchemyData - */ - public static AlchemyData getInstance() - { - return SingletonHolder._instance; - } - - private static class SingletonHolder - { - protected static final AlchemyData _instance = new AlchemyData(); - } -} diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/ExIncomingPackets.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/ExIncomingPackets.java index 7a41cd63fe..94f433e9a0 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/ExIncomingPackets.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/ExIncomingPackets.java @@ -28,8 +28,6 @@ import com.l2jmobius.gameserver.network.clientpackets.*; import com.l2jmobius.gameserver.network.clientpackets.adenadistribution.RequestDivideAdena; import com.l2jmobius.gameserver.network.clientpackets.adenadistribution.RequestDivideAdenaCancel; import com.l2jmobius.gameserver.network.clientpackets.adenadistribution.RequestDivideAdenaStart; -import com.l2jmobius.gameserver.network.clientpackets.alchemy.RequestAlchemyConversion; -import com.l2jmobius.gameserver.network.clientpackets.alchemy.RequestAlchemyTryMixCube; import com.l2jmobius.gameserver.network.clientpackets.appearance.RequestExCancelShape_Shifting_Item; import com.l2jmobius.gameserver.network.clientpackets.appearance.RequestExTryToPutShapeShiftingEnchantSupportItem; import com.l2jmobius.gameserver.network.clientpackets.appearance.RequestExTryToPutShapeShiftingTargetItem; @@ -340,8 +338,8 @@ public enum ExIncomingPackets implements IIncomingPackets REQUEST_NEW_ENCHANT_TRY(0xF9, RequestNewEnchantTry::new, ConnectionState.IN_GAME), EX_SEND_SELECTED_QUEST_ZONE_ID(0xFF, ExSendSelectedQuestZoneID::new, ConnectionState.IN_GAME), REQUEST_ALCHEMY_SKILL_LIST(0x100, RequestAlchemySkillList::new, ConnectionState.IN_GAME), - REQUEST_ALCHEMY_TRY_MIX_CUBE(0x101, RequestAlchemyTryMixCube::new, ConnectionState.IN_GAME), - REQUEST_ALCHEMY_CONVERSION(0x102, RequestAlchemyConversion::new, ConnectionState.IN_GAME), + REQUEST_ALCHEMY_TRY_MIX_CUBE(0x101, null, ConnectionState.IN_GAME), + REQUEST_ALCHEMY_CONVERSION(0x102, null, ConnectionState.IN_GAME), SEND_EXECUTED_UI_EVENTS_COUNT(0x103, null, ConnectionState.IN_GAME), EX_SEND_CLIENT_INI(0x104, null, ConnectionState.AUTHENTICATED), REQUEST_EX_AUTO_FISH(0x105, ExRequestAutoFish::new, ConnectionState.IN_GAME), diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/clientpackets/alchemy/RequestAlchemyConversion.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/clientpackets/alchemy/RequestAlchemyConversion.java deleted file mode 100644 index 414e817ffe..0000000000 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/clientpackets/alchemy/RequestAlchemyConversion.java +++ /dev/null @@ -1,185 +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 . - */ -package com.l2jmobius.gameserver.network.clientpackets.alchemy; - -import java.util.HashSet; -import java.util.Set; - -import com.l2jmobius.commons.network.PacketReader; -import com.l2jmobius.commons.util.Rnd; -import com.l2jmobius.gameserver.data.xml.impl.AlchemyData; -import com.l2jmobius.gameserver.enums.PrivateStoreType; -import com.l2jmobius.gameserver.enums.Race; -import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; -import com.l2jmobius.gameserver.model.alchemy.AlchemyCraftData; -import com.l2jmobius.gameserver.model.holders.ItemHolder; -import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance; -import com.l2jmobius.gameserver.network.L2GameClient; -import com.l2jmobius.gameserver.network.SystemMessageId; -import com.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket; -import com.l2jmobius.gameserver.network.serverpackets.InventoryUpdate; -import com.l2jmobius.gameserver.network.serverpackets.alchemy.ExAlchemyConversion; -import com.l2jmobius.gameserver.taskmanager.AttackStanceTaskManager; - -/** - * @author Sdw - */ -public class RequestAlchemyConversion implements IClientIncomingPacket -{ - private int _craftTimes; - private int _skillId; - private int _skillLevel; - - private final Set _ingredients = new HashSet<>(); - - @Override - public boolean read(L2GameClient client, PacketReader packet) - { - _craftTimes = packet.readD(); - packet.readH(); // TODO: Find me - _skillId = packet.readD(); - _skillLevel = packet.readD(); - - final int ingredientsSize = packet.readD(); - for (int i = 0; i < ingredientsSize; i++) - { - _ingredients.add(new ItemHolder(packet.readD(), packet.readQ())); - } - return true; - } - - @Override - public void run(L2GameClient client) - { - final L2PcInstance player = client.getActiveChar(); - if ((player == null) || (player.getRace() != Race.ERTHEIA)) - { - return; - } - - if (AttackStanceTaskManager.getInstance().hasAttackStanceTask(player)) - { - player.sendPacket(SystemMessageId.YOU_CANNOT_USE_ALCHEMY_DURING_BATTLE); - return; - } - else if (player.isInStoreMode() || (player.getPrivateStoreType() != PrivateStoreType.NONE)) - { - player.sendPacket(SystemMessageId.YOU_CANNOT_USE_ALCHEMY_WHILE_TRADING_OR_USING_A_PRIVATE_STORE_OR_SHOP); - return; - } - else if (player.isDead()) - { - player.sendPacket(SystemMessageId.YOU_CANNOT_USE_ALCHEMY_WHILE_DEAD); - return; - } - else if (player.isMovementDisabled()) - { - player.sendPacket(SystemMessageId.YOU_CANNOT_USE_ALCHEMY_WHILE_IMMOBILE); - return; - } - - final AlchemyCraftData data = AlchemyData.getInstance().getCraftData(_skillId, _skillLevel); - if (data == null) - { - _log.warning("Missing AlchemyData for skillId: " + _skillId + ", skillLevel: " + _skillLevel); - return; - } - - // TODO : Implement this - // if (!_ingredients.equals(data.getIngredients())) - // { - // LOGGER.warning("Client ingredients are not same as server ingredients for alchemy conversion player: "+ +"", player); - // return; - // } - - // TODO: Figure out the chance - final int baseChance; - switch (data.getGrade()) - { - case 1: // Elementary - { - baseChance = 100; - break; - } - case 2: // Intermediate - { - baseChance = 80; - break; - } - case 3: // Advanced - { - baseChance = 60; - break; - } - default: // Master - { - baseChance = 50; - break; - } - } - - int successCount = 0; - int failureCount = 0; - - // Run _craftItems iteration of item craft - final InventoryUpdate ui = new InventoryUpdate(); - CRAFTLOOP: for (int i = 0; i < _craftTimes; i++) - { - // for each tries, check if player have enough items and destroy - for (ItemHolder ingredient : data.getIngredients()) - { - final L2ItemInstance item = player.getInventory().getItemByItemId(ingredient.getId()); - if (item == null) - { - break CRAFTLOOP; - } - if (item.getCount() < ingredient.getCount()) - { - break CRAFTLOOP; - } - - player.getInventory().destroyItem("Alchemy", item, ingredient.getCount(), player, null); - ui.addItem(item); - } - - if (Rnd.get(100) < baseChance) - { - successCount++; - } - else - { - failureCount++; - } - } - - if (successCount > 0) - { - final L2ItemInstance item = player.getInventory().addItem("Alchemy", data.getProductionSuccess().getId(), data.getProductionSuccess().getCount() * successCount, player, null); - ui.addItem(item); - } - - if (failureCount > 0) - { - final L2ItemInstance item = player.getInventory().addItem("Alchemy", data.getProductionFailure().getId(), data.getProductionFailure().getCount() * failureCount, player, null); - ui.addItem(item); - } - - player.sendPacket(new ExAlchemyConversion(successCount, failureCount)); - player.sendInventoryUpdate(ui); - - } -} diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/clientpackets/alchemy/RequestAlchemyTryMixCube.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/clientpackets/alchemy/RequestAlchemyTryMixCube.java deleted file mode 100644 index dad7c7aefa..0000000000 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/clientpackets/alchemy/RequestAlchemyTryMixCube.java +++ /dev/null @@ -1,220 +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 . - */ -package com.l2jmobius.gameserver.network.clientpackets.alchemy; - -import java.util.LinkedList; -import java.util.List; - -import com.l2jmobius.commons.network.PacketReader; -import com.l2jmobius.commons.util.Rnd; -import com.l2jmobius.gameserver.enums.PrivateStoreType; -import com.l2jmobius.gameserver.enums.Race; -import com.l2jmobius.gameserver.enums.TryMixCubeResultType; -import com.l2jmobius.gameserver.enums.TryMixCubeType; -import com.l2jmobius.gameserver.model.PcCondOverride; -import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; -import com.l2jmobius.gameserver.model.holders.AlchemyResult; -import com.l2jmobius.gameserver.model.holders.ItemHolder; -import com.l2jmobius.gameserver.model.itemcontainer.Inventory; -import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance; -import com.l2jmobius.gameserver.model.skills.CommonSkill; -import com.l2jmobius.gameserver.network.L2GameClient; -import com.l2jmobius.gameserver.network.SystemMessageId; -import com.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket; -import com.l2jmobius.gameserver.network.serverpackets.InventoryUpdate; -import com.l2jmobius.gameserver.network.serverpackets.MagicSkillUse; -import com.l2jmobius.gameserver.network.serverpackets.alchemy.ExTryMixCube; -import com.l2jmobius.gameserver.taskmanager.AttackStanceTaskManager; - -/** - * @author Sdw - */ -public class RequestAlchemyTryMixCube implements IClientIncomingPacket -{ - // TODO: Figure out how much stones are given - private static final int TEMPEST_STONE_AMOUNT = 1; - - private final List _items = new LinkedList<>(); - - @Override - public boolean read(L2GameClient client, PacketReader packet) - { - final int itemsCount = packet.readD(); - if ((itemsCount <= 0) || (itemsCount > 4)) - { - return false; - } - - for (int i = 0; i < itemsCount; i++) - { - _items.add(new ItemHolder(packet.readD(), packet.readQ())); - } - return true; - } - - @Override - public void run(L2GameClient client) - { - final L2PcInstance player = client.getActiveChar(); - if ((player == null) || (player.getRace() != Race.ERTHEIA)) - { - return; - } - - if (AttackStanceTaskManager.getInstance().hasAttackStanceTask(player)) - { - player.sendPacket(SystemMessageId.YOU_CANNOT_USE_ALCHEMY_DURING_BATTLE); - return; - } - else if (player.isInStoreMode() || (player.getPrivateStoreType() != PrivateStoreType.NONE)) - { - player.sendPacket(SystemMessageId.YOU_CANNOT_USE_ALCHEMY_WHILE_TRADING_OR_USING_A_PRIVATE_STORE_OR_SHOP); - return; - } - else if (player.isDead()) - { - player.sendPacket(SystemMessageId.YOU_CANNOT_USE_ALCHEMY_WHILE_DEAD); - return; - } - else if (player.isMovementDisabled()) - { - player.sendPacket(SystemMessageId.YOU_CANNOT_USE_ALCHEMY_WHILE_IMMOBILE); - return; - } - - if ((player.getKnownSkill(CommonSkill.ALCHEMY_CUBE.getId()) == null) && !player.canOverrideCond(PcCondOverride.SKILL_CONDITIONS)) - { - player.sendPacket(new ExTryMixCube(TryMixCubeType.FAIL_SKILL_WRONG)); - return; - } - - int position = 0; - long itemsPrice = 0; - - // First loop for safety check + price calculation - for (ItemHolder item : _items) - { - final L2ItemInstance itemInstance = player.getInventory().getItemByObjectId(item.getId()); - if (itemInstance == null) - { - return; - } - - if ((itemInstance.getCount() <= 0) || (itemInstance.getCount() < item.getCount())) - { - player.sendPacket(new ExTryMixCube(TryMixCubeType.FAIL_ITEM_WRONG)); - return; - } - - final int price = itemInstance.getReferencePrice(); - if (itemInstance.getReferencePrice() == 0) - { - player.sendPacket(SystemMessageId.THIS_ITEM_CANNOT_BE_COMBINED); - player.sendPacket(new ExTryMixCube(TryMixCubeType.FAIL_ITEM_WRONG)); - return; - } - - if ((itemInstance.getEnchantLevel() > 0) || itemInstance.isAugmented()) - { - player.sendPacket(SystemMessageId.YOU_CANNOT_COMBINE_ITEMS_THAT_HAVE_BEEN_ENCHANTED_OR_AUGMENTED); - player.sendPacket(new ExTryMixCube(TryMixCubeType.FAIL_ITEM_WRONG)); - return; - } - - itemsPrice += price * item.getCount(); - position++; - - if ((position == 4) && (itemInstance.getId() != Inventory.ELCYUM_CRYSTAL_ID)) - { - player.sendPacket(new ExTryMixCube(TryMixCubeType.FAIL_ITEM_WRONG)); - return; - } - } - - // Calculate the amount of air stones the player should received based on the total price of items he mixed. - int airStonesCount = (int) Math.floor((itemsPrice / 5_000) * (_items.size() < 3 ? 0.3f : 0.5f)); - - // Process only if there is at least one air stone to give - if (airStonesCount > 0) - { - final InventoryUpdate iu = new InventoryUpdate(); - - long elcyumCrystals = 0; - - // Second loop for items deletion if we're still in the game - for (ItemHolder item : _items) - { - final L2ItemInstance itemInstance = player.getInventory().getItemByObjectId(item.getId()); - if (itemInstance == null) - { - return; - } - - if (itemInstance.getCount() < item.getCount()) - { - return; - } - - if (itemInstance.getId() == Inventory.ELCYUM_CRYSTAL_ID) - { - elcyumCrystals = item.getCount(); - } - - player.getInventory().destroyItem("Alchemy", itemInstance, item.getCount(), player, null); - iu.addItem(itemInstance); - } - - final ExTryMixCube mixCubeResult = new ExTryMixCube(TryMixCubeType.SUCCESS_NORMAL); - - // Whenever there is Elcyum Crystal applied there's a chance to receive Tempest Stone - // TODO: Figure out the chance - if ((elcyumCrystals > 0) && (Rnd.get(100) < 50)) - { - // Broadcast animation on success - player.broadcastPacket(new MagicSkillUse(player, CommonSkill.ALCHEMY_CUBE_RANDOM_SUCCESS.getId(), TEMPEST_STONE_AMOUNT, 500, 1500)); - - // Give Tempest Stone to the player - final L2ItemInstance tempestStonesInstance = player.addItem("Alchemy", Inventory.TEMPEST_STONE_ID, TEMPEST_STONE_AMOUNT, null, true); - iu.addItem(tempestStonesInstance); - - // Add the alchemy result entry to the packet - mixCubeResult.addItem(new AlchemyResult(Inventory.TEMPEST_STONE_ID, TEMPEST_STONE_AMOUNT, TryMixCubeResultType.EXTRA)); - } - - // Calculate the elcyum crystals bonus - final boolean bonusSuccess = ((100. * Rnd.nextDouble()) < (elcyumCrystals / 1000)); - if (bonusSuccess) - { - airStonesCount *= Math.min(elcyumCrystals, 2); - } - - final L2ItemInstance airStonesInstance = player.addItem("Alchemy", Inventory.AIR_STONE_ID, airStonesCount, null, true); - iu.addItem(airStonesInstance); - - // Add the Air Stones - mixCubeResult.addItem(new AlchemyResult(Inventory.AIR_STONE_ID, airStonesCount, bonusSuccess ? TryMixCubeResultType.BONUS : TryMixCubeResultType.NORMAL)); - - // send packets - player.sendPacket(mixCubeResult); - player.sendInventoryUpdate(iu); - } - else - { - player.sendPacket(new ExTryMixCube(TryMixCubeType.FAIL_ITEM_WRONG)); - } - } -} diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/serverpackets/alchemy/ExAlchemyConversion.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/serverpackets/alchemy/ExAlchemyConversion.java deleted file mode 100644 index c55f50ffdc..0000000000 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/serverpackets/alchemy/ExAlchemyConversion.java +++ /dev/null @@ -1,47 +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 . - */ -package com.l2jmobius.gameserver.network.serverpackets.alchemy; - -import com.l2jmobius.commons.network.PacketWriter; -import com.l2jmobius.gameserver.network.OutgoingPackets; -import com.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket; - -/** - * @author Sdw - */ -public class ExAlchemyConversion implements IClientOutgoingPacket -{ - private final int _successCount; - private final int _failureCount; - - public ExAlchemyConversion(int successCount, int failureCount) - { - _successCount = successCount; - _failureCount = failureCount; - } - - @Override - public boolean write(PacketWriter packet) - { - OutgoingPackets.EX_ALCHEMY_CONVERSION.writeId(packet); - - packet.writeC(0x00); // TODO: Find me - packet.writeD(_successCount); - packet.writeD(_failureCount); - return true; - } -} diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/serverpackets/alchemy/ExTryMixCube.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/serverpackets/alchemy/ExTryMixCube.java deleted file mode 100644 index 8f5b29a172..0000000000 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/serverpackets/alchemy/ExTryMixCube.java +++ /dev/null @@ -1,61 +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 . - */ -package com.l2jmobius.gameserver.network.serverpackets.alchemy; - -import java.util.ArrayList; -import java.util.List; - -import com.l2jmobius.commons.network.PacketWriter; -import com.l2jmobius.gameserver.enums.TryMixCubeType; -import com.l2jmobius.gameserver.model.holders.AlchemyResult; -import com.l2jmobius.gameserver.network.OutgoingPackets; -import com.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket; - -/** - * @author Sdw - */ -public class ExTryMixCube implements IClientOutgoingPacket -{ - private final TryMixCubeType _type; - private final List _items = new ArrayList<>(); - - public ExTryMixCube(TryMixCubeType type) - { - _type = type; - } - - public void addItem(AlchemyResult item) - { - _items.add(item); - } - - @Override - public boolean write(PacketWriter packet) - { - OutgoingPackets.EX_TRY_MIX_CUBE.writeId(packet); - - packet.writeC(_type.ordinal()); - packet.writeD(_items.size()); - for (AlchemyResult holder : _items) - { - packet.writeC(holder.getType().ordinal()); - packet.writeD(holder.getId()); - packet.writeQ(holder.getCount()); - } - return true; - } -} \ No newline at end of file