From db5651d4a9e9d324632a05c561197df43c3f5548 Mon Sep 17 00:00:00 2001
From: MobiusDevelopment <8391001+MobiusDevelopment@users.noreply.github.com>
Date: Fri, 11 Mar 2022 07:31:34 +0000
Subject: [PATCH] Augmentation system additions. Contributed by Index.
---
.../handlers/bypasshandlers/Augment.java | 4 +-
.../model/actor/request/VariationRequest.java | 72 ++++++++++++++
.../gameserver/network/ExIncomingPackets.java | 11 ++-
.../network/clientpackets/UseItem.java | 2 +-
.../variation/ExApplyVariationOption.java | 93 +++++++++++++++++++
.../variation/ExVariationCloseUi.java | 53 +++++++++++
.../variation/ExVariationOpenUi.java | 46 +++++++++
.../{ => variation}/RequestRefine.java | 32 +++----
.../variation/ApplyVariationOption.java | 51 ++++++++++
...ExPutCommissionResultForVariationMake.java | 6 +-
.../ExShowVariationCancelWindow.java | 7 +-
.../ExShowVariationMakeWindow.java | 5 +-
.../variation}/RequestConfirmGemStone.java | 6 +-
.../others/GameAssistant/GameAssistant.java | 2 +-
.../handlers/bypasshandlers/Augment.java | 4 +-
.../model/actor/request/VariationRequest.java | 72 ++++++++++++++
.../gameserver/network/ExIncomingPackets.java | 11 ++-
.../network/clientpackets/UseItem.java | 2 +-
.../variation/ExApplyVariationOption.java | 93 +++++++++++++++++++
.../variation/ExVariationCloseUi.java | 53 +++++++++++
.../variation/ExVariationOpenUi.java | 46 +++++++++
.../{ => variation}/RequestRefine.java | 32 +++----
.../variation/ApplyVariationOption.java | 51 ++++++++++
...ExPutCommissionResultForVariationMake.java | 6 +-
.../ExShowVariationCancelWindow.java | 7 +-
.../ExShowVariationMakeWindow.java | 5 +-
.../variation}/RequestConfirmGemStone.java | 6 +-
27 files changed, 705 insertions(+), 73 deletions(-)
create mode 100644 L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/model/actor/request/VariationRequest.java
create mode 100644 L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/network/clientpackets/variation/ExApplyVariationOption.java
create mode 100644 L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/network/clientpackets/variation/ExVariationCloseUi.java
create mode 100644 L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/network/clientpackets/variation/ExVariationOpenUi.java
rename L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/network/clientpackets/{ => variation}/RequestRefine.java (83%)
create mode 100644 L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/network/serverpackets/variation/ApplyVariationOption.java
rename {L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/network/serverpackets => L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/network/serverpackets/variation}/ExPutCommissionResultForVariationMake.java (87%)
rename {L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/network/serverpackets => L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/network/serverpackets/variation}/ExShowVariationCancelWindow.java (84%)
rename L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/network/serverpackets/{ => variation}/ExShowVariationMakeWindow.java (84%)
rename L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/network/{clientpackets => serverpackets/variation}/RequestConfirmGemStone.java (90%)
create mode 100644 L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/model/actor/request/VariationRequest.java
create mode 100644 L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/network/clientpackets/variation/ExApplyVariationOption.java
create mode 100644 L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/network/clientpackets/variation/ExVariationCloseUi.java
create mode 100644 L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/network/clientpackets/variation/ExVariationOpenUi.java
rename L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/network/clientpackets/{ => variation}/RequestRefine.java (83%)
create mode 100644 L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/network/serverpackets/variation/ApplyVariationOption.java
rename {L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/network/serverpackets => L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/network/serverpackets/variation}/ExPutCommissionResultForVariationMake.java (87%)
rename {L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/network/serverpackets => L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/network/serverpackets/variation}/ExShowVariationCancelWindow.java (84%)
rename L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/network/serverpackets/{ => variation}/ExShowVariationMakeWindow.java (84%)
rename L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/network/{clientpackets => serverpackets/variation}/RequestConfirmGemStone.java (90%)
diff --git a/L2J_Mobius_10.2_MasterClass/dist/game/data/scripts/handlers/bypasshandlers/Augment.java b/L2J_Mobius_10.2_MasterClass/dist/game/data/scripts/handlers/bypasshandlers/Augment.java
index f8c7e77d89..e0dfb8d809 100644
--- a/L2J_Mobius_10.2_MasterClass/dist/game/data/scripts/handlers/bypasshandlers/Augment.java
+++ b/L2J_Mobius_10.2_MasterClass/dist/game/data/scripts/handlers/bypasshandlers/Augment.java
@@ -21,8 +21,8 @@ import java.util.logging.Level;
import org.l2jmobius.gameserver.handler.IBypassHandler;
import org.l2jmobius.gameserver.model.actor.Creature;
import org.l2jmobius.gameserver.model.actor.Player;
-import org.l2jmobius.gameserver.network.serverpackets.ExShowVariationCancelWindow;
-import org.l2jmobius.gameserver.network.serverpackets.ExShowVariationMakeWindow;
+import org.l2jmobius.gameserver.network.serverpackets.variation.ExShowVariationCancelWindow;
+import org.l2jmobius.gameserver.network.serverpackets.variation.ExShowVariationMakeWindow;
public class Augment implements IBypassHandler
{
diff --git a/L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/model/actor/request/VariationRequest.java b/L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/model/actor/request/VariationRequest.java
new file mode 100644
index 0000000000..7dbda5255a
--- /dev/null
+++ b/L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/model/actor/request/VariationRequest.java
@@ -0,0 +1,72 @@
+/*
+ * 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 org.l2jmobius.gameserver.model.actor.request;
+
+import org.l2jmobius.gameserver.model.VariationInstance;
+import org.l2jmobius.gameserver.model.actor.Player;
+import org.l2jmobius.gameserver.model.item.instance.Item;
+
+/**
+ * @author Index
+ */
+public class VariationRequest extends AbstractRequest
+{
+ private Item _augmented;
+ private Item _mineral;
+ private VariationInstance _augmentation;
+
+ public VariationRequest(Player player)
+ {
+ super(player);
+ }
+
+ public synchronized void setAugmentedItem(int objectId)
+ {
+ _augmented = getActiveChar().getInventory().getItemByObjectId(objectId);
+ }
+
+ public synchronized Item getAugmentedItem()
+ {
+ return _augmented;
+ }
+
+ public synchronized void setMineralItem(int objectId)
+ {
+ _mineral = getActiveChar().getInventory().getItemByObjectId(objectId);
+ }
+
+ public synchronized Item getMineralItem()
+ {
+ return _mineral;
+ }
+
+ public synchronized void setAugment(VariationInstance augment)
+ {
+ _augmentation = augment;
+ }
+
+ public synchronized VariationInstance getAugment()
+ {
+ return _augmentation;
+ }
+
+ @Override
+ public boolean isUsing(int objectId)
+ {
+ return false;
+ }
+}
diff --git a/L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/network/ExIncomingPackets.java b/L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/network/ExIncomingPackets.java
index bdacf11902..b6a05c7554 100644
--- a/L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/network/ExIncomingPackets.java
+++ b/L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/network/ExIncomingPackets.java
@@ -162,7 +162,12 @@ import org.l2jmobius.gameserver.network.clientpackets.teleports.ExRequestTelepor
import org.l2jmobius.gameserver.network.clientpackets.teleports.ExRequestTeleportFavoritesAddDel;
import org.l2jmobius.gameserver.network.clientpackets.teleports.ExRequestTeleportFavoritesUIToggle;
import org.l2jmobius.gameserver.network.clientpackets.training.NotifyTrainingRoomEnd;
+import org.l2jmobius.gameserver.network.clientpackets.variation.ExApplyVariationOption;
+import org.l2jmobius.gameserver.network.clientpackets.variation.ExVariationCloseUi;
+import org.l2jmobius.gameserver.network.clientpackets.variation.ExVariationOpenUi;
+import org.l2jmobius.gameserver.network.clientpackets.variation.RequestRefine;
import org.l2jmobius.gameserver.network.serverpackets.enchant.RequestExRemoveEnchantSupportItem;
+import org.l2jmobius.gameserver.network.serverpackets.variation.RequestConfirmGemStone;
/**
* @author Sdw
@@ -755,9 +760,9 @@ public enum ExIncomingPackets implements IIncomingPackets
EX_READY_ITEM_AUTO_PEEL(0x242, null, ConnectionState.IN_GAME),
EX_REQUEST_ITEM_AUTO_PEEL(0x243, null, ConnectionState.IN_GAME),
EX_STOP_ITEM_AUTO_PEEL(0x244, null, ConnectionState.IN_GAME),
- EX_VARIATION_OPEN_UI(0x245, null, ConnectionState.IN_GAME),
- EX_VARIATION_CLOSE_UI(0x246, null, ConnectionState.IN_GAME),
- EX_APPLY_VARIATION_OPTION(0x247, null, ConnectionState.IN_GAME),
+ EX_VARIATION_OPEN_UI(0x245, ExVariationOpenUi::new, ConnectionState.IN_GAME),
+ EX_VARIATION_CLOSE_UI(0x246, ExVariationCloseUi::new, ConnectionState.IN_GAME),
+ EX_APPLY_VARIATION_OPTION(0x247, ExApplyVariationOption::new, ConnectionState.IN_GAME),
EX_BR_VERSION(0x248, null, ConnectionState.IN_GAME),
EX_MAX(0x249, null, ConnectionState.IN_GAME);
diff --git a/L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/network/clientpackets/UseItem.java b/L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/network/clientpackets/UseItem.java
index 922070a4d2..e5df9d36d5 100644
--- a/L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/network/clientpackets/UseItem.java
+++ b/L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/network/clientpackets/UseItem.java
@@ -47,9 +47,9 @@ import org.l2jmobius.gameserver.network.GameClient;
import org.l2jmobius.gameserver.network.PacketLogger;
import org.l2jmobius.gameserver.network.SystemMessageId;
import org.l2jmobius.gameserver.network.serverpackets.ActionFailed;
-import org.l2jmobius.gameserver.network.serverpackets.ExShowVariationMakeWindow;
import org.l2jmobius.gameserver.network.serverpackets.ExUseSharedGroupItem;
import org.l2jmobius.gameserver.network.serverpackets.SystemMessage;
+import org.l2jmobius.gameserver.network.serverpackets.variation.ExShowVariationMakeWindow;
public class UseItem implements IClientIncomingPacket
{
diff --git a/L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/network/clientpackets/variation/ExApplyVariationOption.java b/L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/network/clientpackets/variation/ExApplyVariationOption.java
new file mode 100644
index 0000000000..d51bc1e9ff
--- /dev/null
+++ b/L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/network/clientpackets/variation/ExApplyVariationOption.java
@@ -0,0 +1,93 @@
+/*
+ * 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 org.l2jmobius.gameserver.network.clientpackets.variation;
+
+import org.l2jmobius.commons.network.PacketReader;
+import org.l2jmobius.gameserver.model.VariationInstance;
+import org.l2jmobius.gameserver.model.actor.Player;
+import org.l2jmobius.gameserver.model.actor.request.VariationRequest;
+import org.l2jmobius.gameserver.model.item.instance.Item;
+import org.l2jmobius.gameserver.network.GameClient;
+import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
+import org.l2jmobius.gameserver.network.serverpackets.InventoryUpdate;
+import org.l2jmobius.gameserver.network.serverpackets.variation.ApplyVariationOption;
+
+/**
+ * @author Index
+ */
+public class ExApplyVariationOption implements IClientIncomingPacket
+{
+ private int _enchantedObjectId;
+ private int _option1;
+ private int _option2;
+
+ @Override
+ public boolean read(GameClient client, PacketReader packet)
+ {
+ _enchantedObjectId = packet.readD();
+ _option1 = packet.readD();
+ _option2 = packet.readD();
+ return true;
+ }
+
+ @Override
+ public void run(GameClient client)
+ {
+ final Player player = client.getPlayer();
+ if (player == null)
+ {
+ return;
+ }
+
+ final VariationRequest request = player.getRequest(VariationRequest.class);
+ final Item targetItem = request.getAugmentedItem();
+ final VariationInstance augment = request.getAugment();
+ final int option1Id = augment.getOption1Id();
+ final int option2Id = augment.getOption2Id();
+
+ if ((targetItem.getObjectId() != _enchantedObjectId) || (_option1 != option1Id) || (_option2 != option2Id))
+ {
+ player.sendPacket(new ApplyVariationOption(0, 0, 0, 0));
+ return;
+ }
+
+ // Remove the augmentation if any (286).
+ if (targetItem.isAugmented())
+ {
+ targetItem.removeAugmentation();
+ }
+
+ targetItem.setAugmentation(augment, true);
+
+ // Unequip item.
+ final InventoryUpdate iu = new InventoryUpdate();
+ if (targetItem.isEquipped())
+ {
+ for (Item itm : player.getInventory().unEquipItemInSlotAndRecord(targetItem.getLocationSlot()))
+ {
+ iu.addModifiedItem(itm);
+ }
+ player.broadcastUserInfo();
+ }
+
+ iu.addModifiedItem(targetItem);
+ player.sendInventoryUpdate(iu);
+
+ player.removeRequest(VariationRequest.class);
+ player.sendPacket(new ApplyVariationOption(1, _enchantedObjectId, _option1, _option2));
+ }
+}
\ No newline at end of file
diff --git a/L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/network/clientpackets/variation/ExVariationCloseUi.java b/L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/network/clientpackets/variation/ExVariationCloseUi.java
new file mode 100644
index 0000000000..f46100b6e2
--- /dev/null
+++ b/L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/network/clientpackets/variation/ExVariationCloseUi.java
@@ -0,0 +1,53 @@
+/*
+ * 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 org.l2jmobius.gameserver.network.clientpackets.variation;
+
+import org.l2jmobius.commons.network.PacketReader;
+import org.l2jmobius.gameserver.model.actor.Player;
+import org.l2jmobius.gameserver.model.actor.request.VariationRequest;
+import org.l2jmobius.gameserver.network.GameClient;
+import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
+
+/**
+ * @author Index
+ */
+public class ExVariationCloseUi implements IClientIncomingPacket
+{
+ @Override
+ public boolean read(GameClient client, PacketReader packet)
+ {
+ packet.readC();
+ return true;
+ }
+
+ @Override
+ public void run(GameClient client)
+ {
+ final Player player = client.getPlayer();
+ if (player == null)
+ {
+ return;
+ }
+
+ // player.sendPacket(ExShowVariationCancelWindow.STATIC_PACKET);
+
+ if (player.getRequest(VariationRequest.class) != null)
+ {
+ player.removeRequest(VariationRequest.class);
+ }
+ }
+}
\ No newline at end of file
diff --git a/L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/network/clientpackets/variation/ExVariationOpenUi.java b/L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/network/clientpackets/variation/ExVariationOpenUi.java
new file mode 100644
index 0000000000..2afb770592
--- /dev/null
+++ b/L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/network/clientpackets/variation/ExVariationOpenUi.java
@@ -0,0 +1,46 @@
+/*
+ * 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 org.l2jmobius.gameserver.network.clientpackets.variation;
+
+import org.l2jmobius.commons.network.PacketReader;
+import org.l2jmobius.gameserver.network.GameClient;
+import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
+
+/**
+ * @author Index
+ */
+public class ExVariationOpenUi implements IClientIncomingPacket
+{
+ @Override
+ public boolean read(GameClient client, PacketReader packet)
+ {
+ packet.readC();
+ return true;
+ }
+
+ @Override
+ public void run(GameClient client)
+ {
+ // final Player player = client.getPlayer();
+ // if (player == null)
+ // {
+ // return;
+ // }
+
+ // player.sendPacket(ExShowVariationMakeWindow.STATIC_PACKET);
+ }
+}
\ No newline at end of file
diff --git a/L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/network/clientpackets/RequestRefine.java b/L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/network/clientpackets/variation/RequestRefine.java
similarity index 83%
rename from L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/network/clientpackets/RequestRefine.java
rename to L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/network/clientpackets/variation/RequestRefine.java
index b84ac7619d..c66eb248f9 100644
--- a/L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/network/clientpackets/RequestRefine.java
+++ b/L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/network/clientpackets/variation/RequestRefine.java
@@ -14,19 +14,20 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
-package org.l2jmobius.gameserver.network.clientpackets;
+package org.l2jmobius.gameserver.network.clientpackets.variation;
import org.l2jmobius.commons.network.PacketReader;
import org.l2jmobius.gameserver.data.xml.VariationData;
import org.l2jmobius.gameserver.model.VariationInstance;
import org.l2jmobius.gameserver.model.actor.Player;
+import org.l2jmobius.gameserver.model.actor.request.VariationRequest;
import org.l2jmobius.gameserver.model.item.instance.Item;
import org.l2jmobius.gameserver.model.options.Variation;
import org.l2jmobius.gameserver.model.options.VariationFee;
import org.l2jmobius.gameserver.network.GameClient;
import org.l2jmobius.gameserver.network.SystemMessageId;
+import org.l2jmobius.gameserver.network.clientpackets.AbstractRefinePacket;
import org.l2jmobius.gameserver.network.serverpackets.ExVariationResult;
-import org.l2jmobius.gameserver.network.serverpackets.InventoryUpdate;
/**
* Format:(ch) dddd
@@ -88,8 +89,6 @@ public class RequestRefine extends AbstractRefinePacket
return;
}
- // TODO: Update XMLs.
- // if (_feeCount != fee.getItemCount())
if (_feeCount <= 0)
{
player.sendPacket(new ExVariationResult(0, 0, false));
@@ -138,17 +137,6 @@ public class RequestRefine extends AbstractRefinePacket
}
}
- // Unequip item.
- final InventoryUpdate iu = new InventoryUpdate();
- if (targetItem.isEquipped())
- {
- for (Item itm : player.getInventory().unEquipItemInSlotAndRecord(targetItem.getLocationSlot()))
- {
- iu.addModifiedItem(itm);
- }
- player.broadcastUserInfo();
- }
-
// Consume the life stone.
if (!player.destroyItem("RequestRefine", mineralItem, 1, null, false))
{
@@ -167,15 +155,17 @@ public class RequestRefine extends AbstractRefinePacket
return;
}
- // Remove the augmentation if any (286).
- if (targetItem.isAugmented())
+ if (player.getRequest(VariationRequest.class) == null)
{
- targetItem.removeAugmentation();
+ player.addRequest(new VariationRequest(player));
}
- targetItem.setAugmentation(augment, true);
+ VariationRequest request = player.getRequest(VariationRequest.class);
+ request.setAugmentedItem(_targetItemObjId);
+ request.setMineralItem(_mineralItemObjId);
+ request.setAugment(augment);
+
player.sendPacket(new ExVariationResult(augment.getOption1Id(), augment.getOption2Id(), true));
- iu.addModifiedItem(targetItem);
- player.sendInventoryUpdate(iu);
+
}
}
diff --git a/L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/network/serverpackets/variation/ApplyVariationOption.java b/L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/network/serverpackets/variation/ApplyVariationOption.java
new file mode 100644
index 0000000000..53642639a0
--- /dev/null
+++ b/L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/network/serverpackets/variation/ApplyVariationOption.java
@@ -0,0 +1,51 @@
+/*
+ * 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 org.l2jmobius.gameserver.network.serverpackets.variation;
+
+import org.l2jmobius.commons.network.PacketWriter;
+import org.l2jmobius.gameserver.network.OutgoingPackets;
+import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
+
+/**
+ * @author Index
+ */
+public class ApplyVariationOption implements IClientOutgoingPacket
+{
+ private final int _result;
+ private final int _enchantedObjectId;
+ private final int _option1;
+ private final int _option2;
+
+ public ApplyVariationOption(int result, int enchantedObjectId, int option1, int option2)
+ {
+ _result = result;
+ _enchantedObjectId = enchantedObjectId;
+ _option1 = option1;
+ _option2 = option2;
+ }
+
+ @Override
+ public boolean write(PacketWriter packet)
+ {
+ OutgoingPackets.EX_APPLY_VARIATION_OPTION.writeId(packet);
+ packet.writeC(_result);
+ packet.writeD(_enchantedObjectId);
+ packet.writeD(_option1);
+ packet.writeD(_option2);
+ return true;
+ }
+}
diff --git a/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/network/serverpackets/ExPutCommissionResultForVariationMake.java b/L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/network/serverpackets/variation/ExPutCommissionResultForVariationMake.java
similarity index 87%
rename from L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/network/serverpackets/ExPutCommissionResultForVariationMake.java
rename to L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/network/serverpackets/variation/ExPutCommissionResultForVariationMake.java
index ff996b5d0c..5ac38832e5 100644
--- a/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/network/serverpackets/ExPutCommissionResultForVariationMake.java
+++ b/L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/network/serverpackets/variation/ExPutCommissionResultForVariationMake.java
@@ -14,11 +14,15 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
-package org.l2jmobius.gameserver.network.serverpackets;
+package org.l2jmobius.gameserver.network.serverpackets.variation;
import org.l2jmobius.commons.network.PacketWriter;
import org.l2jmobius.gameserver.network.OutgoingPackets;
+import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
+/**
+ * @author Index
+ */
public class ExPutCommissionResultForVariationMake implements IClientOutgoingPacket
{
private final int _gemstoneObjId;
diff --git a/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/network/serverpackets/ExShowVariationCancelWindow.java b/L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/network/serverpackets/variation/ExShowVariationCancelWindow.java
similarity index 84%
rename from L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/network/serverpackets/ExShowVariationCancelWindow.java
rename to L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/network/serverpackets/variation/ExShowVariationCancelWindow.java
index 1f1a14c31b..5edb81d7cf 100644
--- a/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/network/serverpackets/ExShowVariationCancelWindow.java
+++ b/L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/network/serverpackets/variation/ExShowVariationCancelWindow.java
@@ -14,10 +14,11 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
-package org.l2jmobius.gameserver.network.serverpackets;
+package org.l2jmobius.gameserver.network.serverpackets.variation;
import org.l2jmobius.commons.network.PacketWriter;
import org.l2jmobius.gameserver.network.OutgoingPackets;
+import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
/**
* @author KenM
@@ -25,8 +26,8 @@ import org.l2jmobius.gameserver.network.OutgoingPackets;
public class ExShowVariationCancelWindow implements IClientOutgoingPacket
{
public static final ExShowVariationCancelWindow STATIC_PACKET = new ExShowVariationCancelWindow();
-
- private ExShowVariationCancelWindow()
+
+ public ExShowVariationCancelWindow()
{
}
diff --git a/L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/network/serverpackets/ExShowVariationMakeWindow.java b/L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/network/serverpackets/variation/ExShowVariationMakeWindow.java
similarity index 84%
rename from L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/network/serverpackets/ExShowVariationMakeWindow.java
rename to L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/network/serverpackets/variation/ExShowVariationMakeWindow.java
index 9870424e26..9af9aa5112 100644
--- a/L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/network/serverpackets/ExShowVariationMakeWindow.java
+++ b/L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/network/serverpackets/variation/ExShowVariationMakeWindow.java
@@ -14,10 +14,11 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
-package org.l2jmobius.gameserver.network.serverpackets;
+package org.l2jmobius.gameserver.network.serverpackets.variation;
import org.l2jmobius.commons.network.PacketWriter;
import org.l2jmobius.gameserver.network.OutgoingPackets;
+import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
/**
* Trigger packet
@@ -27,7 +28,7 @@ public class ExShowVariationMakeWindow implements IClientOutgoingPacket
{
public static final ExShowVariationMakeWindow STATIC_PACKET = new ExShowVariationMakeWindow();
- private ExShowVariationMakeWindow()
+ public ExShowVariationMakeWindow()
{
}
diff --git a/L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/network/clientpackets/RequestConfirmGemStone.java b/L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/network/serverpackets/variation/RequestConfirmGemStone.java
similarity index 90%
rename from L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/network/clientpackets/RequestConfirmGemStone.java
rename to L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/network/serverpackets/variation/RequestConfirmGemStone.java
index 5ae334f854..6b125822fb 100644
--- a/L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/network/clientpackets/RequestConfirmGemStone.java
+++ b/L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/network/serverpackets/variation/RequestConfirmGemStone.java
@@ -14,7 +14,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
-package org.l2jmobius.gameserver.network.clientpackets;
+package org.l2jmobius.gameserver.network.serverpackets.variation;
import org.l2jmobius.commons.network.PacketReader;
import org.l2jmobius.gameserver.data.xml.VariationData;
@@ -23,7 +23,7 @@ import org.l2jmobius.gameserver.model.item.instance.Item;
import org.l2jmobius.gameserver.model.options.VariationFee;
import org.l2jmobius.gameserver.network.GameClient;
import org.l2jmobius.gameserver.network.SystemMessageId;
-import org.l2jmobius.gameserver.network.serverpackets.ExPutCommissionResultForVariationMake;
+import org.l2jmobius.gameserver.network.clientpackets.AbstractRefinePacket;
/**
* Format:(ch) dddd
@@ -80,7 +80,7 @@ public class RequestConfirmGemStone extends AbstractRefinePacket
return;
}
- // Check for fee count
+ // Check for fee count.
if (_feeCount != fee.getItemCount())
{
player.sendPacket(SystemMessageId.GEMSTONE_QUANTITY_IS_INCORRECT);
diff --git a/L2J_Mobius_Essence_6.2_Vanguard/dist/game/data/scripts/ai/others/GameAssistant/GameAssistant.java b/L2J_Mobius_Essence_6.2_Vanguard/dist/game/data/scripts/ai/others/GameAssistant/GameAssistant.java
index a84ec9e869..69f516bc3d 100644
--- a/L2J_Mobius_Essence_6.2_Vanguard/dist/game/data/scripts/ai/others/GameAssistant/GameAssistant.java
+++ b/L2J_Mobius_Essence_6.2_Vanguard/dist/game/data/scripts/ai/others/GameAssistant/GameAssistant.java
@@ -32,13 +32,13 @@ import org.l2jmobius.gameserver.model.item.instance.Item;
import org.l2jmobius.gameserver.model.itemcontainer.PlayerFreight;
import org.l2jmobius.gameserver.network.SystemMessageId;
import org.l2jmobius.gameserver.network.serverpackets.ExPremiumManagerShowHtml;
-import org.l2jmobius.gameserver.network.serverpackets.ExShowVariationCancelWindow;
import org.l2jmobius.gameserver.network.serverpackets.NpcHtmlMessage;
import org.l2jmobius.gameserver.network.serverpackets.PackageToList;
import org.l2jmobius.gameserver.network.serverpackets.WareHouseWithdrawalList;
import org.l2jmobius.gameserver.network.serverpackets.ensoul.ExShowEnsoulExtractionWindow;
import org.l2jmobius.gameserver.network.serverpackets.ensoul.ExShowEnsoulWindow;
import org.l2jmobius.gameserver.network.serverpackets.equipmentupgrade.ExShowUpgradeSystem;
+import org.l2jmobius.gameserver.network.serverpackets.variation.ExShowVariationCancelWindow;
import ai.AbstractNpcAI;
diff --git a/L2J_Mobius_Essence_6.2_Vanguard/dist/game/data/scripts/handlers/bypasshandlers/Augment.java b/L2J_Mobius_Essence_6.2_Vanguard/dist/game/data/scripts/handlers/bypasshandlers/Augment.java
index f8c7e77d89..e0dfb8d809 100644
--- a/L2J_Mobius_Essence_6.2_Vanguard/dist/game/data/scripts/handlers/bypasshandlers/Augment.java
+++ b/L2J_Mobius_Essence_6.2_Vanguard/dist/game/data/scripts/handlers/bypasshandlers/Augment.java
@@ -21,8 +21,8 @@ import java.util.logging.Level;
import org.l2jmobius.gameserver.handler.IBypassHandler;
import org.l2jmobius.gameserver.model.actor.Creature;
import org.l2jmobius.gameserver.model.actor.Player;
-import org.l2jmobius.gameserver.network.serverpackets.ExShowVariationCancelWindow;
-import org.l2jmobius.gameserver.network.serverpackets.ExShowVariationMakeWindow;
+import org.l2jmobius.gameserver.network.serverpackets.variation.ExShowVariationCancelWindow;
+import org.l2jmobius.gameserver.network.serverpackets.variation.ExShowVariationMakeWindow;
public class Augment implements IBypassHandler
{
diff --git a/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/model/actor/request/VariationRequest.java b/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/model/actor/request/VariationRequest.java
new file mode 100644
index 0000000000..7dbda5255a
--- /dev/null
+++ b/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/model/actor/request/VariationRequest.java
@@ -0,0 +1,72 @@
+/*
+ * 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 org.l2jmobius.gameserver.model.actor.request;
+
+import org.l2jmobius.gameserver.model.VariationInstance;
+import org.l2jmobius.gameserver.model.actor.Player;
+import org.l2jmobius.gameserver.model.item.instance.Item;
+
+/**
+ * @author Index
+ */
+public class VariationRequest extends AbstractRequest
+{
+ private Item _augmented;
+ private Item _mineral;
+ private VariationInstance _augmentation;
+
+ public VariationRequest(Player player)
+ {
+ super(player);
+ }
+
+ public synchronized void setAugmentedItem(int objectId)
+ {
+ _augmented = getActiveChar().getInventory().getItemByObjectId(objectId);
+ }
+
+ public synchronized Item getAugmentedItem()
+ {
+ return _augmented;
+ }
+
+ public synchronized void setMineralItem(int objectId)
+ {
+ _mineral = getActiveChar().getInventory().getItemByObjectId(objectId);
+ }
+
+ public synchronized Item getMineralItem()
+ {
+ return _mineral;
+ }
+
+ public synchronized void setAugment(VariationInstance augment)
+ {
+ _augmentation = augment;
+ }
+
+ public synchronized VariationInstance getAugment()
+ {
+ return _augmentation;
+ }
+
+ @Override
+ public boolean isUsing(int objectId)
+ {
+ return false;
+ }
+}
diff --git a/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/network/ExIncomingPackets.java b/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/network/ExIncomingPackets.java
index 34bcbe3c40..3439aa5931 100644
--- a/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/network/ExIncomingPackets.java
+++ b/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/network/ExIncomingPackets.java
@@ -176,9 +176,14 @@ import org.l2jmobius.gameserver.network.clientpackets.teleports.ExRequestTelepor
import org.l2jmobius.gameserver.network.clientpackets.teleports.ExTeleportToRaidPosition;
import org.l2jmobius.gameserver.network.clientpackets.teleports.RequestRaidTeleportInfo;
import org.l2jmobius.gameserver.network.clientpackets.training.NotifyTrainingRoomEnd;
+import org.l2jmobius.gameserver.network.clientpackets.variation.ExApplyVariationOption;
+import org.l2jmobius.gameserver.network.clientpackets.variation.ExVariationCloseUi;
+import org.l2jmobius.gameserver.network.clientpackets.variation.ExVariationOpenUi;
+import org.l2jmobius.gameserver.network.clientpackets.variation.RequestRefine;
import org.l2jmobius.gameserver.network.clientpackets.vip.ExRequestVipInfo;
import org.l2jmobius.gameserver.network.clientpackets.vip.RequestVipLuckGameInfo;
import org.l2jmobius.gameserver.network.serverpackets.enchant.RequestExRemoveEnchantSupportItem;
+import org.l2jmobius.gameserver.network.serverpackets.variation.RequestConfirmGemStone;
/**
* @author Sdw
@@ -771,9 +776,9 @@ public enum ExIncomingPackets implements IIncomingPackets
EX_READY_ITEM_AUTO_PEEL(0x242, null, ConnectionState.IN_GAME),
EX_REQUEST_ITEM_AUTO_PEEL(0x243, null, ConnectionState.IN_GAME),
EX_STOP_ITEM_AUTO_PEEL(0x244, null, ConnectionState.IN_GAME),
- EX_VARIATION_OPEN_UI(0x245, null, ConnectionState.IN_GAME),
- EX_VARIATION_CLOSE_UI(0x246, null, ConnectionState.IN_GAME),
- EX_APPLY_VARIATION_OPTION(0x247, null, ConnectionState.IN_GAME),
+ EX_VARIATION_OPEN_UI(0x245, ExVariationOpenUi::new, ConnectionState.IN_GAME),
+ EX_VARIATION_CLOSE_UI(0x246, ExVariationCloseUi::new, ConnectionState.IN_GAME),
+ EX_APPLY_VARIATION_OPTION(0x247, ExApplyVariationOption::new, ConnectionState.IN_GAME),
EX_BR_VERSION(0x248, null, ConnectionState.IN_GAME),
EX_MAX(0x249, null, ConnectionState.IN_GAME);
diff --git a/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/network/clientpackets/UseItem.java b/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/network/clientpackets/UseItem.java
index 95ca234046..d0a641a1b7 100644
--- a/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/network/clientpackets/UseItem.java
+++ b/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/network/clientpackets/UseItem.java
@@ -52,9 +52,9 @@ import org.l2jmobius.gameserver.network.GameClient;
import org.l2jmobius.gameserver.network.PacketLogger;
import org.l2jmobius.gameserver.network.SystemMessageId;
import org.l2jmobius.gameserver.network.serverpackets.ActionFailed;
-import org.l2jmobius.gameserver.network.serverpackets.ExShowVariationMakeWindow;
import org.l2jmobius.gameserver.network.serverpackets.ExUseSharedGroupItem;
import org.l2jmobius.gameserver.network.serverpackets.SystemMessage;
+import org.l2jmobius.gameserver.network.serverpackets.variation.ExShowVariationMakeWindow;
public class UseItem implements IClientIncomingPacket
{
diff --git a/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/network/clientpackets/variation/ExApplyVariationOption.java b/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/network/clientpackets/variation/ExApplyVariationOption.java
new file mode 100644
index 0000000000..d51bc1e9ff
--- /dev/null
+++ b/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/network/clientpackets/variation/ExApplyVariationOption.java
@@ -0,0 +1,93 @@
+/*
+ * 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 org.l2jmobius.gameserver.network.clientpackets.variation;
+
+import org.l2jmobius.commons.network.PacketReader;
+import org.l2jmobius.gameserver.model.VariationInstance;
+import org.l2jmobius.gameserver.model.actor.Player;
+import org.l2jmobius.gameserver.model.actor.request.VariationRequest;
+import org.l2jmobius.gameserver.model.item.instance.Item;
+import org.l2jmobius.gameserver.network.GameClient;
+import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
+import org.l2jmobius.gameserver.network.serverpackets.InventoryUpdate;
+import org.l2jmobius.gameserver.network.serverpackets.variation.ApplyVariationOption;
+
+/**
+ * @author Index
+ */
+public class ExApplyVariationOption implements IClientIncomingPacket
+{
+ private int _enchantedObjectId;
+ private int _option1;
+ private int _option2;
+
+ @Override
+ public boolean read(GameClient client, PacketReader packet)
+ {
+ _enchantedObjectId = packet.readD();
+ _option1 = packet.readD();
+ _option2 = packet.readD();
+ return true;
+ }
+
+ @Override
+ public void run(GameClient client)
+ {
+ final Player player = client.getPlayer();
+ if (player == null)
+ {
+ return;
+ }
+
+ final VariationRequest request = player.getRequest(VariationRequest.class);
+ final Item targetItem = request.getAugmentedItem();
+ final VariationInstance augment = request.getAugment();
+ final int option1Id = augment.getOption1Id();
+ final int option2Id = augment.getOption2Id();
+
+ if ((targetItem.getObjectId() != _enchantedObjectId) || (_option1 != option1Id) || (_option2 != option2Id))
+ {
+ player.sendPacket(new ApplyVariationOption(0, 0, 0, 0));
+ return;
+ }
+
+ // Remove the augmentation if any (286).
+ if (targetItem.isAugmented())
+ {
+ targetItem.removeAugmentation();
+ }
+
+ targetItem.setAugmentation(augment, true);
+
+ // Unequip item.
+ final InventoryUpdate iu = new InventoryUpdate();
+ if (targetItem.isEquipped())
+ {
+ for (Item itm : player.getInventory().unEquipItemInSlotAndRecord(targetItem.getLocationSlot()))
+ {
+ iu.addModifiedItem(itm);
+ }
+ player.broadcastUserInfo();
+ }
+
+ iu.addModifiedItem(targetItem);
+ player.sendInventoryUpdate(iu);
+
+ player.removeRequest(VariationRequest.class);
+ player.sendPacket(new ApplyVariationOption(1, _enchantedObjectId, _option1, _option2));
+ }
+}
\ No newline at end of file
diff --git a/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/network/clientpackets/variation/ExVariationCloseUi.java b/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/network/clientpackets/variation/ExVariationCloseUi.java
new file mode 100644
index 0000000000..f46100b6e2
--- /dev/null
+++ b/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/network/clientpackets/variation/ExVariationCloseUi.java
@@ -0,0 +1,53 @@
+/*
+ * 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 org.l2jmobius.gameserver.network.clientpackets.variation;
+
+import org.l2jmobius.commons.network.PacketReader;
+import org.l2jmobius.gameserver.model.actor.Player;
+import org.l2jmobius.gameserver.model.actor.request.VariationRequest;
+import org.l2jmobius.gameserver.network.GameClient;
+import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
+
+/**
+ * @author Index
+ */
+public class ExVariationCloseUi implements IClientIncomingPacket
+{
+ @Override
+ public boolean read(GameClient client, PacketReader packet)
+ {
+ packet.readC();
+ return true;
+ }
+
+ @Override
+ public void run(GameClient client)
+ {
+ final Player player = client.getPlayer();
+ if (player == null)
+ {
+ return;
+ }
+
+ // player.sendPacket(ExShowVariationCancelWindow.STATIC_PACKET);
+
+ if (player.getRequest(VariationRequest.class) != null)
+ {
+ player.removeRequest(VariationRequest.class);
+ }
+ }
+}
\ No newline at end of file
diff --git a/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/network/clientpackets/variation/ExVariationOpenUi.java b/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/network/clientpackets/variation/ExVariationOpenUi.java
new file mode 100644
index 0000000000..2afb770592
--- /dev/null
+++ b/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/network/clientpackets/variation/ExVariationOpenUi.java
@@ -0,0 +1,46 @@
+/*
+ * 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 org.l2jmobius.gameserver.network.clientpackets.variation;
+
+import org.l2jmobius.commons.network.PacketReader;
+import org.l2jmobius.gameserver.network.GameClient;
+import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
+
+/**
+ * @author Index
+ */
+public class ExVariationOpenUi implements IClientIncomingPacket
+{
+ @Override
+ public boolean read(GameClient client, PacketReader packet)
+ {
+ packet.readC();
+ return true;
+ }
+
+ @Override
+ public void run(GameClient client)
+ {
+ // final Player player = client.getPlayer();
+ // if (player == null)
+ // {
+ // return;
+ // }
+
+ // player.sendPacket(ExShowVariationMakeWindow.STATIC_PACKET);
+ }
+}
\ No newline at end of file
diff --git a/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/network/clientpackets/RequestRefine.java b/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/network/clientpackets/variation/RequestRefine.java
similarity index 83%
rename from L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/network/clientpackets/RequestRefine.java
rename to L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/network/clientpackets/variation/RequestRefine.java
index b84ac7619d..c66eb248f9 100644
--- a/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/network/clientpackets/RequestRefine.java
+++ b/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/network/clientpackets/variation/RequestRefine.java
@@ -14,19 +14,20 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
-package org.l2jmobius.gameserver.network.clientpackets;
+package org.l2jmobius.gameserver.network.clientpackets.variation;
import org.l2jmobius.commons.network.PacketReader;
import org.l2jmobius.gameserver.data.xml.VariationData;
import org.l2jmobius.gameserver.model.VariationInstance;
import org.l2jmobius.gameserver.model.actor.Player;
+import org.l2jmobius.gameserver.model.actor.request.VariationRequest;
import org.l2jmobius.gameserver.model.item.instance.Item;
import org.l2jmobius.gameserver.model.options.Variation;
import org.l2jmobius.gameserver.model.options.VariationFee;
import org.l2jmobius.gameserver.network.GameClient;
import org.l2jmobius.gameserver.network.SystemMessageId;
+import org.l2jmobius.gameserver.network.clientpackets.AbstractRefinePacket;
import org.l2jmobius.gameserver.network.serverpackets.ExVariationResult;
-import org.l2jmobius.gameserver.network.serverpackets.InventoryUpdate;
/**
* Format:(ch) dddd
@@ -88,8 +89,6 @@ public class RequestRefine extends AbstractRefinePacket
return;
}
- // TODO: Update XMLs.
- // if (_feeCount != fee.getItemCount())
if (_feeCount <= 0)
{
player.sendPacket(new ExVariationResult(0, 0, false));
@@ -138,17 +137,6 @@ public class RequestRefine extends AbstractRefinePacket
}
}
- // Unequip item.
- final InventoryUpdate iu = new InventoryUpdate();
- if (targetItem.isEquipped())
- {
- for (Item itm : player.getInventory().unEquipItemInSlotAndRecord(targetItem.getLocationSlot()))
- {
- iu.addModifiedItem(itm);
- }
- player.broadcastUserInfo();
- }
-
// Consume the life stone.
if (!player.destroyItem("RequestRefine", mineralItem, 1, null, false))
{
@@ -167,15 +155,17 @@ public class RequestRefine extends AbstractRefinePacket
return;
}
- // Remove the augmentation if any (286).
- if (targetItem.isAugmented())
+ if (player.getRequest(VariationRequest.class) == null)
{
- targetItem.removeAugmentation();
+ player.addRequest(new VariationRequest(player));
}
- targetItem.setAugmentation(augment, true);
+ VariationRequest request = player.getRequest(VariationRequest.class);
+ request.setAugmentedItem(_targetItemObjId);
+ request.setMineralItem(_mineralItemObjId);
+ request.setAugment(augment);
+
player.sendPacket(new ExVariationResult(augment.getOption1Id(), augment.getOption2Id(), true));
- iu.addModifiedItem(targetItem);
- player.sendInventoryUpdate(iu);
+
}
}
diff --git a/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/network/serverpackets/variation/ApplyVariationOption.java b/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/network/serverpackets/variation/ApplyVariationOption.java
new file mode 100644
index 0000000000..53642639a0
--- /dev/null
+++ b/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/network/serverpackets/variation/ApplyVariationOption.java
@@ -0,0 +1,51 @@
+/*
+ * 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 org.l2jmobius.gameserver.network.serverpackets.variation;
+
+import org.l2jmobius.commons.network.PacketWriter;
+import org.l2jmobius.gameserver.network.OutgoingPackets;
+import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
+
+/**
+ * @author Index
+ */
+public class ApplyVariationOption implements IClientOutgoingPacket
+{
+ private final int _result;
+ private final int _enchantedObjectId;
+ private final int _option1;
+ private final int _option2;
+
+ public ApplyVariationOption(int result, int enchantedObjectId, int option1, int option2)
+ {
+ _result = result;
+ _enchantedObjectId = enchantedObjectId;
+ _option1 = option1;
+ _option2 = option2;
+ }
+
+ @Override
+ public boolean write(PacketWriter packet)
+ {
+ OutgoingPackets.EX_APPLY_VARIATION_OPTION.writeId(packet);
+ packet.writeC(_result);
+ packet.writeD(_enchantedObjectId);
+ packet.writeD(_option1);
+ packet.writeD(_option2);
+ return true;
+ }
+}
diff --git a/L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/network/serverpackets/ExPutCommissionResultForVariationMake.java b/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/network/serverpackets/variation/ExPutCommissionResultForVariationMake.java
similarity index 87%
rename from L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/network/serverpackets/ExPutCommissionResultForVariationMake.java
rename to L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/network/serverpackets/variation/ExPutCommissionResultForVariationMake.java
index ff996b5d0c..5ac38832e5 100644
--- a/L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/network/serverpackets/ExPutCommissionResultForVariationMake.java
+++ b/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/network/serverpackets/variation/ExPutCommissionResultForVariationMake.java
@@ -14,11 +14,15 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
-package org.l2jmobius.gameserver.network.serverpackets;
+package org.l2jmobius.gameserver.network.serverpackets.variation;
import org.l2jmobius.commons.network.PacketWriter;
import org.l2jmobius.gameserver.network.OutgoingPackets;
+import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
+/**
+ * @author Index
+ */
public class ExPutCommissionResultForVariationMake implements IClientOutgoingPacket
{
private final int _gemstoneObjId;
diff --git a/L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/network/serverpackets/ExShowVariationCancelWindow.java b/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/network/serverpackets/variation/ExShowVariationCancelWindow.java
similarity index 84%
rename from L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/network/serverpackets/ExShowVariationCancelWindow.java
rename to L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/network/serverpackets/variation/ExShowVariationCancelWindow.java
index 1f1a14c31b..5edb81d7cf 100644
--- a/L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/network/serverpackets/ExShowVariationCancelWindow.java
+++ b/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/network/serverpackets/variation/ExShowVariationCancelWindow.java
@@ -14,10 +14,11 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
-package org.l2jmobius.gameserver.network.serverpackets;
+package org.l2jmobius.gameserver.network.serverpackets.variation;
import org.l2jmobius.commons.network.PacketWriter;
import org.l2jmobius.gameserver.network.OutgoingPackets;
+import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
/**
* @author KenM
@@ -25,8 +26,8 @@ import org.l2jmobius.gameserver.network.OutgoingPackets;
public class ExShowVariationCancelWindow implements IClientOutgoingPacket
{
public static final ExShowVariationCancelWindow STATIC_PACKET = new ExShowVariationCancelWindow();
-
- private ExShowVariationCancelWindow()
+
+ public ExShowVariationCancelWindow()
{
}
diff --git a/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/network/serverpackets/ExShowVariationMakeWindow.java b/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/network/serverpackets/variation/ExShowVariationMakeWindow.java
similarity index 84%
rename from L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/network/serverpackets/ExShowVariationMakeWindow.java
rename to L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/network/serverpackets/variation/ExShowVariationMakeWindow.java
index 9870424e26..9af9aa5112 100644
--- a/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/network/serverpackets/ExShowVariationMakeWindow.java
+++ b/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/network/serverpackets/variation/ExShowVariationMakeWindow.java
@@ -14,10 +14,11 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
-package org.l2jmobius.gameserver.network.serverpackets;
+package org.l2jmobius.gameserver.network.serverpackets.variation;
import org.l2jmobius.commons.network.PacketWriter;
import org.l2jmobius.gameserver.network.OutgoingPackets;
+import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
/**
* Trigger packet
@@ -27,7 +28,7 @@ public class ExShowVariationMakeWindow implements IClientOutgoingPacket
{
public static final ExShowVariationMakeWindow STATIC_PACKET = new ExShowVariationMakeWindow();
- private ExShowVariationMakeWindow()
+ public ExShowVariationMakeWindow()
{
}
diff --git a/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/network/clientpackets/RequestConfirmGemStone.java b/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/network/serverpackets/variation/RequestConfirmGemStone.java
similarity index 90%
rename from L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/network/clientpackets/RequestConfirmGemStone.java
rename to L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/network/serverpackets/variation/RequestConfirmGemStone.java
index 5ae334f854..6b125822fb 100644
--- a/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/network/clientpackets/RequestConfirmGemStone.java
+++ b/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/network/serverpackets/variation/RequestConfirmGemStone.java
@@ -14,7 +14,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
-package org.l2jmobius.gameserver.network.clientpackets;
+package org.l2jmobius.gameserver.network.serverpackets.variation;
import org.l2jmobius.commons.network.PacketReader;
import org.l2jmobius.gameserver.data.xml.VariationData;
@@ -23,7 +23,7 @@ import org.l2jmobius.gameserver.model.item.instance.Item;
import org.l2jmobius.gameserver.model.options.VariationFee;
import org.l2jmobius.gameserver.network.GameClient;
import org.l2jmobius.gameserver.network.SystemMessageId;
-import org.l2jmobius.gameserver.network.serverpackets.ExPutCommissionResultForVariationMake;
+import org.l2jmobius.gameserver.network.clientpackets.AbstractRefinePacket;
/**
* Format:(ch) dddd
@@ -80,7 +80,7 @@ public class RequestConfirmGemStone extends AbstractRefinePacket
return;
}
- // Check for fee count
+ // Check for fee count.
if (_feeCount != fee.getItemCount())
{
player.sendPacket(SystemMessageId.GEMSTONE_QUANTITY_IS_INCORRECT);