From c91ccb29481d0ba4f5a4de340622677acc703cce Mon Sep 17 00:00:00 2001 From: MobiusDevelopment <8391001+MobiusDevelopment@users.noreply.github.com> Date: Mon, 26 Apr 2021 10:32:31 +0000 Subject: [PATCH] Enchant menu rework. Contributed by realAprox and CostyKiller. --- .../dist/game/config/AdminCommands.xml | 34 +++ .../dist/game/data/html/admin/enchant.htm | 193 ++++++------ .../game/data/html/admin/enchantAgathion.htm | 75 +++++ .../game/data/html/admin/enchantArtifact.htm | 195 ++++++++++++ .../admincommandhandlers/AdminEnchant.java | 282 ++++++++++++++++- .../dist/game/config/AdminCommands.xml | 34 +++ .../dist/game/data/html/admin/enchant.htm | 193 ++++++------ .../game/data/html/admin/enchantAgathion.htm | 75 +++++ .../game/data/html/admin/enchantArtifact.htm | 195 ++++++++++++ .../admincommandhandlers/AdminEnchant.java | 282 ++++++++++++++++- .../dist/game/config/AdminCommands.xml | 34 +++ .../dist/game/data/html/admin/enchant.htm | 193 ++++++------ .../game/data/html/admin/enchantAgathion.htm | 75 +++++ .../game/data/html/admin/enchantArtifact.htm | 195 ++++++++++++ .../admincommandhandlers/AdminEnchant.java | 282 ++++++++++++++++- .../dist/game/config/AdminCommands.xml | 35 ++- .../dist/game/data/html/admin/enchant.htm | 207 ++++++------- .../game/data/html/admin/enchantAgathion.htm | 75 +++++ .../game/data/html/admin/enchantArtifact.htm | 195 ++++++++++++ .../admincommandhandlers/AdminEnchant.java | 285 ++++++++++++++++-- .../dist/game/config/AdminCommands.xml | 35 ++- .../dist/game/data/html/admin/enchant.htm | 207 ++++++------- .../game/data/html/admin/enchantAgathion.htm | 75 +++++ .../game/data/html/admin/enchantArtifact.htm | 195 ++++++++++++ .../admincommandhandlers/AdminEnchant.java | 285 ++++++++++++++++-- 25 files changed, 3379 insertions(+), 552 deletions(-) create mode 100644 L2J_Mobius_5.5_EtinasFate/dist/game/data/html/admin/enchantAgathion.htm create mode 100644 L2J_Mobius_5.5_EtinasFate/dist/game/data/html/admin/enchantArtifact.htm create mode 100644 L2J_Mobius_6.0_Fafurion/dist/game/data/html/admin/enchantAgathion.htm create mode 100644 L2J_Mobius_6.0_Fafurion/dist/game/data/html/admin/enchantArtifact.htm create mode 100644 L2J_Mobius_7.0_PreludeOfWar/dist/game/data/html/admin/enchantAgathion.htm create mode 100644 L2J_Mobius_7.0_PreludeOfWar/dist/game/data/html/admin/enchantArtifact.htm create mode 100644 L2J_Mobius_8.0_Homunculus/dist/game/data/html/admin/enchantAgathion.htm create mode 100644 L2J_Mobius_8.0_Homunculus/dist/game/data/html/admin/enchantArtifact.htm create mode 100644 L2J_Mobius_9.0_ReturnOfTheQueenAnt/dist/game/data/html/admin/enchantAgathion.htm create mode 100644 L2J_Mobius_9.0_ReturnOfTheQueenAnt/dist/game/data/html/admin/enchantArtifact.htm diff --git a/L2J_Mobius_5.5_EtinasFate/dist/game/config/AdminCommands.xml b/L2J_Mobius_5.5_EtinasFate/dist/game/config/AdminCommands.xml index c7a1a461b6..2bc10f119f 100644 --- a/L2J_Mobius_5.5_EtinasFate/dist/game/config/AdminCommands.xml +++ b/L2J_Mobius_5.5_EtinasFate/dist/game/config/AdminCommands.xml @@ -220,6 +220,40 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/L2J_Mobius_5.5_EtinasFate/dist/game/data/html/admin/enchant.htm b/L2J_Mobius_5.5_EtinasFate/dist/game/data/html/admin/enchant.htm index bd7221aa27..65aacbe2fa 100644 --- a/L2J_Mobius_5.5_EtinasFate/dist/game/data/html/admin/enchant.htm +++ b/L2J_Mobius_5.5_EtinasFate/dist/game/data/html/admin/enchant.htm @@ -1,101 +1,120 @@ Enchant & Attribute Menu
+ + + + + + + +
Enchant Value 0-127:
- - - - - + + + + +
Enchant & Attribute
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

-Enchant Enhancement:
- - - - - +
Enchant Value 0-127:
+ + + + + + + + + + + + + + + + + + + + + + + +

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-

Attribute Enhancement:
- - - - - - - - + + + + + + + +
Element Type:
Element Value 0-450:
Element Type:
Element Value 0-450:

- - - - - - - - - - - - - - - - - - - +
+ + + + + + + + + + + + + + + + + +

diff --git a/L2J_Mobius_5.5_EtinasFate/dist/game/data/html/admin/enchantAgathion.htm b/L2J_Mobius_5.5_EtinasFate/dist/game/data/html/admin/enchantAgathion.htm new file mode 100644 index 0000000000..105643c84a --- /dev/null +++ b/L2J_Mobius_5.5_EtinasFate/dist/game/data/html/admin/enchantAgathion.htm @@ -0,0 +1,75 @@ +Agathion Enchant Menu +
+ + + + + + + +
Enchant Value 0-10:
+
+



+ +
+ + + + + +
Enchante Equipped Agathions
Equip and un-equip while enchanting.
Each button corresponds to agathion slot
in your inventory.
+



+ + + + + + + + + + + + + + + + + + +
+ +
+
+
+
+
+
+
+
+
+
+
+
+
+
+ +
+ + + + + + +
+
+
+
+ +
+ \ No newline at end of file diff --git a/L2J_Mobius_5.5_EtinasFate/dist/game/data/html/admin/enchantArtifact.htm b/L2J_Mobius_5.5_EtinasFate/dist/game/data/html/admin/enchantArtifact.htm new file mode 100644 index 0000000000..d5fff6c4a5 --- /dev/null +++ b/L2J_Mobius_5.5_EtinasFate/dist/game/data/html/admin/enchantArtifact.htm @@ -0,0 +1,195 @@ +Artifact Enchant Menu +
+ + + + + + + +
Enchant Value 0-10:
+
+ +
+ + + + + + +
+
+
+
+
+
+
+ + + + + + +
+
+
+
+
+
+
+ + + + + +
+
+
+
+
+
+
+ + + + + +
+
+
+
+
+ + + +
+ + +
+ + + + + +
+
+
+
+ + + + + +
+
+
+
+
+
+
+ + + + + + +
+
+
+
+
+
+
+ + + + + + +
+
+
+
+
+
+
+
+
+ + +
+ + + + + +
+
+
+
+ + + + + +
+
+
+
+
+
+
+ + + + + + +
+
+
+
+
+
+
+ + + + + + +
+
+
+
+
+
+
+
+
+
+
+ +
+ \ No newline at end of file diff --git a/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/handlers/admincommandhandlers/AdminEnchant.java b/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/handlers/admincommandhandlers/AdminEnchant.java index be416b4b4a..a50cea3c2d 100644 --- a/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/handlers/admincommandhandlers/AdminEnchant.java +++ b/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/handlers/admincommandhandlers/AdminEnchant.java @@ -19,12 +19,16 @@ package handlers.admincommandhandlers; import java.util.logging.Logger; import org.l2jmobius.Config; +import org.l2jmobius.gameserver.cache.HtmCache; +import org.l2jmobius.gameserver.data.ItemTable; import org.l2jmobius.gameserver.handler.IAdminCommandHandler; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import org.l2jmobius.gameserver.model.itemcontainer.Inventory; +import org.l2jmobius.gameserver.model.items.Item; import org.l2jmobius.gameserver.model.items.instance.ItemInstance; import org.l2jmobius.gameserver.network.SystemMessageId; import org.l2jmobius.gameserver.network.serverpackets.InventoryUpdate; +import org.l2jmobius.gameserver.network.serverpackets.NpcHtmlMessage; import org.l2jmobius.gameserver.util.BuilderUtil; /** @@ -51,16 +55,62 @@ public class AdminEnchant implements IAdminCommandHandler "admin_seten", // 3 "admin_setun", // 0 "admin_setba", // 13 - "admin_setbe", + "admin_setbe", // belt + "admin_seth1", // L Hair + "admin_seth2", // R Hair + "admin_setbr", // Brooch + "admin_setbt", // L Bracelet + "admin_setsb", // Seed (R) Bracelet + "admin_setab", // Artifact Book + "admin_seta1", // Agathion SLOT1 + "admin_seta2", // Agathion SLOT2 + "admin_seta3", // Agathion SLOT3 + "admin_seta4", // Agathion SLOT4 + "admin_seta5", // Agathion SLOT5 + "admin_set01", // Artifact (balance) + "admin_set02", // Artifact (balance) + "admin_set03", // Artifact (balance) + "admin_set04", // Artifact (balance) + "admin_set05", // Artifact (balance) + "admin_set06", // Artifact (balance) + "admin_set07", // Artifact (balance) + "admin_set08", // Artifact (balance) + "admin_set09", // Artifact (balance) + "admin_set10", // Artifact (balance) + "admin_set11", // Artifact (balance) + "admin_set12", // Artifact (balance) + "admin_set13", // Artifact (Attack) + "admin_set14", // Artifact (Attack) + "admin_set15", // Artifact (Attack) + "admin_set16", // Artifact (Protection) + "admin_set17", // Artifact (Protection) + "admin_set18", // Artifact (Protection) + "admin_set19", // Artifact (Support) + "admin_set20", // Artifact (Support) + "admin_set21", // Artifact (Support) + "admin_artifact", + "admin_agathion", "admin_enchant" }; @Override public boolean useAdminCommand(String command, PlayerInstance activeChar) { + int currentPage = 0; if (command.equals("admin_enchant")) { - showMainPage(activeChar); + currentPage = 1; + showMainPage(activeChar, currentPage); + } + else if (command.equals("admin_artifact")) + { + currentPage = 2; + showMainPage(activeChar, currentPage); + } + else if (command.equals("admin_agathion")) + { + currentPage = 3; + showMainPage(activeChar, currentPage); } else { @@ -125,17 +175,146 @@ public class AdminEnchant implements IAdminCommandHandler { armorType = Inventory.PAPERDOLL_BELT; } + else if (command.startsWith("admin_seth1")) + { + armorType = Inventory.PAPERDOLL_HAIR; + } + else if (command.startsWith("admin_seth2")) + { + armorType = Inventory.PAPERDOLL_HAIR2; + } + else if (command.startsWith("admin_setbr")) + { + armorType = Inventory.PAPERDOLL_BROOCH; + } + else if (command.startsWith("admin_setbt")) // bracelet + { + armorType = Inventory.PAPERDOLL_RBRACELET; + } + else if (command.startsWith("admin_setsb")) // seed bracelet + { + armorType = Inventory.PAPERDOLL_LBRACELET; + } + else if (command.startsWith("admin_setab")) + { + armorType = Inventory.PAPERDOLL_ARTIFACT_BOOK; + } + else if (command.startsWith("admin_seta1")) + { + armorType = Inventory.PAPERDOLL_AGATHION1; + } + else if (command.startsWith("admin_seta2")) + { + armorType = Inventory.PAPERDOLL_AGATHION2; + } + else if (command.startsWith("admin_seta3")) + { + armorType = Inventory.PAPERDOLL_AGATHION3; + } + else if (command.startsWith("admin_seta4")) + { + armorType = Inventory.PAPERDOLL_AGATHION4; + } + else if (command.startsWith("admin_seta5")) + { + armorType = Inventory.PAPERDOLL_AGATHION5; + } + else if (command.startsWith("admin_set01")) + { + armorType = Inventory.PAPERDOLL_ARTIFACT1; + } + else if (command.startsWith("admin_set02")) + { + armorType = Inventory.PAPERDOLL_ARTIFACT2; + } + else if (command.startsWith("admin_set03")) + { + armorType = Inventory.PAPERDOLL_ARTIFACT3; + } + else if (command.startsWith("admin_set04")) + { + armorType = Inventory.PAPERDOLL_ARTIFACT4; + } + else if (command.startsWith("admin_set05")) + { + armorType = Inventory.PAPERDOLL_ARTIFACT5; + } + else if (command.startsWith("admin_set06")) + { + armorType = Inventory.PAPERDOLL_ARTIFACT6; + } + else if (command.startsWith("admin_set07")) + { + armorType = Inventory.PAPERDOLL_ARTIFACT7; + } + else if (command.startsWith("admin_set08")) + { + armorType = Inventory.PAPERDOLL_ARTIFACT8; + } + else if (command.startsWith("admin_set09")) + { + armorType = Inventory.PAPERDOLL_ARTIFACT9; + } + else if (command.startsWith("admin_set10")) + { + armorType = Inventory.PAPERDOLL_ARTIFACT10; + } + else if (command.startsWith("admin_set11")) + { + armorType = Inventory.PAPERDOLL_ARTIFACT11; + } + else if (command.startsWith("admin_set12")) + { + armorType = Inventory.PAPERDOLL_ARTIFACT12; + } + else if (command.startsWith("admin_set13")) + { + armorType = Inventory.PAPERDOLL_ARTIFACT13; + } + else if (command.startsWith("admin_set14")) + { + armorType = Inventory.PAPERDOLL_ARTIFACT14; + } + else if (command.startsWith("admin_set15")) + { + armorType = Inventory.PAPERDOLL_ARTIFACT15; + } + else if (command.startsWith("admin_set16")) + { + armorType = Inventory.PAPERDOLL_ARTIFACT16; + } + else if (command.startsWith("admin_set17")) + { + armorType = Inventory.PAPERDOLL_ARTIFACT17; + } + else if (command.startsWith("admin_set18")) + { + armorType = Inventory.PAPERDOLL_ARTIFACT18; + } + else if (command.startsWith("admin_set19")) + { + armorType = Inventory.PAPERDOLL_ARTIFACT19; + } + else if (command.startsWith("admin_set20")) + { + armorType = Inventory.PAPERDOLL_ARTIFACT20; + } + else if (command.startsWith("admin_set21")) + { + armorType = Inventory.PAPERDOLL_ARTIFACT21; + } if (armorType != -1) { try { - final int ench = Integer.parseInt(command.substring(12)); + final int enchIn = Integer.parseInt(command.substring(12)); + int ench = enchIn; // check value if ((ench < 0) || (ench > 127)) { - BuilderUtil.sendSysMessage(activeChar, "You must set the enchant level to be between 0-127."); + BuilderUtil.sendSysMessage(activeChar, "New enchant value can only be 0 - 127."); } else { @@ -144,11 +323,15 @@ public class AdminEnchant implements IAdminCommandHandler } catch (StringIndexOutOfBoundsException e) { + // quality of life change. if no input - set enchant value to 0 + int fuse = 0; if (Config.DEVELOPER) { - LOGGER.warning("Set enchant error: " + e); + LOGGER.warning("Enchant Value set to: " + fuse); } - BuilderUtil.sendSysMessage(activeChar, "Please specify a new enchant value."); + BuilderUtil.sendSysMessage(activeChar, "Auto-Set Enchant value to 0."); + + setEnchant(activeChar, fuse, armorType); } catch (NumberFormatException e) { @@ -161,7 +344,7 @@ public class AdminEnchant implements IAdminCommandHandler } // show the enchant menu after an action - showMainPage(activeChar); + showMainPage(activeChar, currentPage); } return true; } @@ -192,9 +375,7 @@ public class AdminEnchant implements IAdminCommandHandler final int curEnchant = itemInstance.getEnchantLevel(); // set enchant value - player.getInventory().unEquipItemInSlot(armorType); itemInstance.setEnchantLevel(ench); - player.getInventory().equipItem(itemInstance); // send packets final InventoryUpdate iu = new InventoryUpdate(); @@ -208,9 +389,88 @@ public class AdminEnchant implements IAdminCommandHandler } } - private void showMainPage(PlayerInstance activeChar) + private void showMainPage(PlayerInstance activeChar, int currentPage) { - AdminHtml.showAdminHtml(activeChar, "enchant.htm"); + if (currentPage == 1) + { + AdminHtml.showAdminHtml(activeChar, "enchant.htm"); + } + else if (currentPage == 2) + { + String getVars = HtmCache.getInstance().getHtm(activeChar, "data/html/admin/enchantArtifact.htm"); + ItemInstance findItem = null; + int currentEnch = 0; + for (int i = 0; i < 21; i++) + { + Item item = ItemTable.getInstance().getTemplate(activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_ARTIFACT1 + i)); + findItem = activeChar.getInventory().getPaperdollItem(Inventory.PAPERDOLL_ARTIFACT1 + i); + if (findItem != null) // null check for unequipped slots + { + currentEnch = findItem.getEnchantLevel(); + } + // If no agathion in slot - returns blank square icon + if (item == null) + { + getVars = getVars.replace("%ar" + i + "_icon%", "L2UI_CT1.Windows.Windows_DF_TooltipBG"); + getVars = getVars.replace("%ar" + i + "_ench%", " "); + } + else + { + getVars = getVars.replace("%ar" + i + "_icon%", item.getIcon()); + // if enchant value is 0 - show "blank instead of 0 + if (currentEnch != 0) + { + getVars = getVars.replace("%ar" + i + "_ench%", Integer.toString(currentEnch));// send ench value + } + else + { + getVars = getVars.replace("%ar" + i + "_ench%", " ");// send "space" so displays icon correctly + } + } + } + + final NpcHtmlMessage html = new NpcHtmlMessage(0, 1); + html.setHtml(getVars); + activeChar.sendPacket(html); + } + else if (currentPage == 3) + { + String getVars = HtmCache.getInstance().getHtm(activeChar, "data/html/admin/enchantAgathion.htm"); + ItemInstance findItem = null; + int currentEnch = 0; + for (int i = 0; i < 5; i++) + { + Item item = ItemTable.getInstance().getTemplate(activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_AGATHION1 + i)); + findItem = activeChar.getInventory().getPaperdollItem(Inventory.PAPERDOLL_AGATHION1 + i); + if (findItem != null) // null check for unequipped slots + { + currentEnch = findItem.getEnchantLevel(); + } + // If no agathion in slot - returns blank square icon + if (item == null) + { + getVars = getVars.replace("%ag" + i + "_icon%", "L2UI_CT1.Windows.Windows_DF_TooltipBG"); + getVars = getVars.replace("%ag" + i + "_ench%", " "); + } + else + { + getVars = getVars.replace("%ag" + i + "_icon%", item.getIcon()); + // if enchant value is 0 - show "blank instead of 0 + if (currentEnch != 0) + { + getVars = getVars.replace("%ag" + i + "_ench%", Integer.toString(currentEnch));// send ench value + } + else + { + getVars = getVars.replace("%ag" + i + "_ench%", " ");// send "space" so displays icon correctly + } + } + } + + final NpcHtmlMessage html = new NpcHtmlMessage(0, 1); + html.setHtml(getVars); + activeChar.sendPacket(html); + } } @Override diff --git a/L2J_Mobius_6.0_Fafurion/dist/game/config/AdminCommands.xml b/L2J_Mobius_6.0_Fafurion/dist/game/config/AdminCommands.xml index c7a1a461b6..2bc10f119f 100644 --- a/L2J_Mobius_6.0_Fafurion/dist/game/config/AdminCommands.xml +++ b/L2J_Mobius_6.0_Fafurion/dist/game/config/AdminCommands.xml @@ -220,6 +220,40 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/L2J_Mobius_6.0_Fafurion/dist/game/data/html/admin/enchant.htm b/L2J_Mobius_6.0_Fafurion/dist/game/data/html/admin/enchant.htm index bd7221aa27..65aacbe2fa 100644 --- a/L2J_Mobius_6.0_Fafurion/dist/game/data/html/admin/enchant.htm +++ b/L2J_Mobius_6.0_Fafurion/dist/game/data/html/admin/enchant.htm @@ -1,101 +1,120 @@ Enchant & Attribute Menu
+ + + + + + + +
Enchant Value 0-127:
- - - - - + + + + +
Enchant & Attribute
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

-Enchant Enhancement:
- - - - - +
Enchant Value 0-127:
+ + + + + + + + + + + + + + + + + + + + + + + +

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-

Attribute Enhancement:
- - - - - - - - + + + + + + + +
Element Type:
Element Value 0-450:
Element Type:
Element Value 0-450:

- - - - - - - - - - - - - - - - - - - +
+ + + + + + + + + + + + + + + + + +

diff --git a/L2J_Mobius_6.0_Fafurion/dist/game/data/html/admin/enchantAgathion.htm b/L2J_Mobius_6.0_Fafurion/dist/game/data/html/admin/enchantAgathion.htm new file mode 100644 index 0000000000..105643c84a --- /dev/null +++ b/L2J_Mobius_6.0_Fafurion/dist/game/data/html/admin/enchantAgathion.htm @@ -0,0 +1,75 @@ +Agathion Enchant Menu +
+ + + + + + + +
Enchant Value 0-10:
+
+



+ +
+ + + + + +
Enchante Equipped Agathions
Equip and un-equip while enchanting.
Each button corresponds to agathion slot
in your inventory.
+



+ + + + + + + + + + + + + + + + + + +
+ +
+
+
+
+
+
+
+
+
+
+
+
+
+
+ +
+ + + + + + +
+
+
+
+ +
+ \ No newline at end of file diff --git a/L2J_Mobius_6.0_Fafurion/dist/game/data/html/admin/enchantArtifact.htm b/L2J_Mobius_6.0_Fafurion/dist/game/data/html/admin/enchantArtifact.htm new file mode 100644 index 0000000000..d5fff6c4a5 --- /dev/null +++ b/L2J_Mobius_6.0_Fafurion/dist/game/data/html/admin/enchantArtifact.htm @@ -0,0 +1,195 @@ +Artifact Enchant Menu +
+ + + + + + + +
Enchant Value 0-10:
+
+ +
+ + + + + + +
+
+
+
+
+
+
+ + + + + + +
+
+
+
+
+
+
+ + + + + +
+
+
+
+
+
+
+ + + + + +
+
+
+
+
+ + + +
+ + +
+ + + + + +
+
+
+
+ + + + + +
+
+
+
+
+
+
+ + + + + + +
+
+
+
+
+
+
+ + + + + + +
+
+
+
+
+
+
+
+
+ + +
+ + + + + +
+
+
+
+ + + + + +
+
+
+
+
+
+
+ + + + + + +
+
+
+
+
+
+
+ + + + + + +
+
+
+
+
+
+
+
+
+
+
+ +
+ \ No newline at end of file diff --git a/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/handlers/admincommandhandlers/AdminEnchant.java b/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/handlers/admincommandhandlers/AdminEnchant.java index be416b4b4a..a50cea3c2d 100644 --- a/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/handlers/admincommandhandlers/AdminEnchant.java +++ b/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/handlers/admincommandhandlers/AdminEnchant.java @@ -19,12 +19,16 @@ package handlers.admincommandhandlers; import java.util.logging.Logger; import org.l2jmobius.Config; +import org.l2jmobius.gameserver.cache.HtmCache; +import org.l2jmobius.gameserver.data.ItemTable; import org.l2jmobius.gameserver.handler.IAdminCommandHandler; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import org.l2jmobius.gameserver.model.itemcontainer.Inventory; +import org.l2jmobius.gameserver.model.items.Item; import org.l2jmobius.gameserver.model.items.instance.ItemInstance; import org.l2jmobius.gameserver.network.SystemMessageId; import org.l2jmobius.gameserver.network.serverpackets.InventoryUpdate; +import org.l2jmobius.gameserver.network.serverpackets.NpcHtmlMessage; import org.l2jmobius.gameserver.util.BuilderUtil; /** @@ -51,16 +55,62 @@ public class AdminEnchant implements IAdminCommandHandler "admin_seten", // 3 "admin_setun", // 0 "admin_setba", // 13 - "admin_setbe", + "admin_setbe", // belt + "admin_seth1", // L Hair + "admin_seth2", // R Hair + "admin_setbr", // Brooch + "admin_setbt", // L Bracelet + "admin_setsb", // Seed (R) Bracelet + "admin_setab", // Artifact Book + "admin_seta1", // Agathion SLOT1 + "admin_seta2", // Agathion SLOT2 + "admin_seta3", // Agathion SLOT3 + "admin_seta4", // Agathion SLOT4 + "admin_seta5", // Agathion SLOT5 + "admin_set01", // Artifact (balance) + "admin_set02", // Artifact (balance) + "admin_set03", // Artifact (balance) + "admin_set04", // Artifact (balance) + "admin_set05", // Artifact (balance) + "admin_set06", // Artifact (balance) + "admin_set07", // Artifact (balance) + "admin_set08", // Artifact (balance) + "admin_set09", // Artifact (balance) + "admin_set10", // Artifact (balance) + "admin_set11", // Artifact (balance) + "admin_set12", // Artifact (balance) + "admin_set13", // Artifact (Attack) + "admin_set14", // Artifact (Attack) + "admin_set15", // Artifact (Attack) + "admin_set16", // Artifact (Protection) + "admin_set17", // Artifact (Protection) + "admin_set18", // Artifact (Protection) + "admin_set19", // Artifact (Support) + "admin_set20", // Artifact (Support) + "admin_set21", // Artifact (Support) + "admin_artifact", + "admin_agathion", "admin_enchant" }; @Override public boolean useAdminCommand(String command, PlayerInstance activeChar) { + int currentPage = 0; if (command.equals("admin_enchant")) { - showMainPage(activeChar); + currentPage = 1; + showMainPage(activeChar, currentPage); + } + else if (command.equals("admin_artifact")) + { + currentPage = 2; + showMainPage(activeChar, currentPage); + } + else if (command.equals("admin_agathion")) + { + currentPage = 3; + showMainPage(activeChar, currentPage); } else { @@ -125,17 +175,146 @@ public class AdminEnchant implements IAdminCommandHandler { armorType = Inventory.PAPERDOLL_BELT; } + else if (command.startsWith("admin_seth1")) + { + armorType = Inventory.PAPERDOLL_HAIR; + } + else if (command.startsWith("admin_seth2")) + { + armorType = Inventory.PAPERDOLL_HAIR2; + } + else if (command.startsWith("admin_setbr")) + { + armorType = Inventory.PAPERDOLL_BROOCH; + } + else if (command.startsWith("admin_setbt")) // bracelet + { + armorType = Inventory.PAPERDOLL_RBRACELET; + } + else if (command.startsWith("admin_setsb")) // seed bracelet + { + armorType = Inventory.PAPERDOLL_LBRACELET; + } + else if (command.startsWith("admin_setab")) + { + armorType = Inventory.PAPERDOLL_ARTIFACT_BOOK; + } + else if (command.startsWith("admin_seta1")) + { + armorType = Inventory.PAPERDOLL_AGATHION1; + } + else if (command.startsWith("admin_seta2")) + { + armorType = Inventory.PAPERDOLL_AGATHION2; + } + else if (command.startsWith("admin_seta3")) + { + armorType = Inventory.PAPERDOLL_AGATHION3; + } + else if (command.startsWith("admin_seta4")) + { + armorType = Inventory.PAPERDOLL_AGATHION4; + } + else if (command.startsWith("admin_seta5")) + { + armorType = Inventory.PAPERDOLL_AGATHION5; + } + else if (command.startsWith("admin_set01")) + { + armorType = Inventory.PAPERDOLL_ARTIFACT1; + } + else if (command.startsWith("admin_set02")) + { + armorType = Inventory.PAPERDOLL_ARTIFACT2; + } + else if (command.startsWith("admin_set03")) + { + armorType = Inventory.PAPERDOLL_ARTIFACT3; + } + else if (command.startsWith("admin_set04")) + { + armorType = Inventory.PAPERDOLL_ARTIFACT4; + } + else if (command.startsWith("admin_set05")) + { + armorType = Inventory.PAPERDOLL_ARTIFACT5; + } + else if (command.startsWith("admin_set06")) + { + armorType = Inventory.PAPERDOLL_ARTIFACT6; + } + else if (command.startsWith("admin_set07")) + { + armorType = Inventory.PAPERDOLL_ARTIFACT7; + } + else if (command.startsWith("admin_set08")) + { + armorType = Inventory.PAPERDOLL_ARTIFACT8; + } + else if (command.startsWith("admin_set09")) + { + armorType = Inventory.PAPERDOLL_ARTIFACT9; + } + else if (command.startsWith("admin_set10")) + { + armorType = Inventory.PAPERDOLL_ARTIFACT10; + } + else if (command.startsWith("admin_set11")) + { + armorType = Inventory.PAPERDOLL_ARTIFACT11; + } + else if (command.startsWith("admin_set12")) + { + armorType = Inventory.PAPERDOLL_ARTIFACT12; + } + else if (command.startsWith("admin_set13")) + { + armorType = Inventory.PAPERDOLL_ARTIFACT13; + } + else if (command.startsWith("admin_set14")) + { + armorType = Inventory.PAPERDOLL_ARTIFACT14; + } + else if (command.startsWith("admin_set15")) + { + armorType = Inventory.PAPERDOLL_ARTIFACT15; + } + else if (command.startsWith("admin_set16")) + { + armorType = Inventory.PAPERDOLL_ARTIFACT16; + } + else if (command.startsWith("admin_set17")) + { + armorType = Inventory.PAPERDOLL_ARTIFACT17; + } + else if (command.startsWith("admin_set18")) + { + armorType = Inventory.PAPERDOLL_ARTIFACT18; + } + else if (command.startsWith("admin_set19")) + { + armorType = Inventory.PAPERDOLL_ARTIFACT19; + } + else if (command.startsWith("admin_set20")) + { + armorType = Inventory.PAPERDOLL_ARTIFACT20; + } + else if (command.startsWith("admin_set21")) + { + armorType = Inventory.PAPERDOLL_ARTIFACT21; + } if (armorType != -1) { try { - final int ench = Integer.parseInt(command.substring(12)); + final int enchIn = Integer.parseInt(command.substring(12)); + int ench = enchIn; // check value if ((ench < 0) || (ench > 127)) { - BuilderUtil.sendSysMessage(activeChar, "You must set the enchant level to be between 0-127."); + BuilderUtil.sendSysMessage(activeChar, "New enchant value can only be 0 - 127."); } else { @@ -144,11 +323,15 @@ public class AdminEnchant implements IAdminCommandHandler } catch (StringIndexOutOfBoundsException e) { + // quality of life change. if no input - set enchant value to 0 + int fuse = 0; if (Config.DEVELOPER) { - LOGGER.warning("Set enchant error: " + e); + LOGGER.warning("Enchant Value set to: " + fuse); } - BuilderUtil.sendSysMessage(activeChar, "Please specify a new enchant value."); + BuilderUtil.sendSysMessage(activeChar, "Auto-Set Enchant value to 0."); + + setEnchant(activeChar, fuse, armorType); } catch (NumberFormatException e) { @@ -161,7 +344,7 @@ public class AdminEnchant implements IAdminCommandHandler } // show the enchant menu after an action - showMainPage(activeChar); + showMainPage(activeChar, currentPage); } return true; } @@ -192,9 +375,7 @@ public class AdminEnchant implements IAdminCommandHandler final int curEnchant = itemInstance.getEnchantLevel(); // set enchant value - player.getInventory().unEquipItemInSlot(armorType); itemInstance.setEnchantLevel(ench); - player.getInventory().equipItem(itemInstance); // send packets final InventoryUpdate iu = new InventoryUpdate(); @@ -208,9 +389,88 @@ public class AdminEnchant implements IAdminCommandHandler } } - private void showMainPage(PlayerInstance activeChar) + private void showMainPage(PlayerInstance activeChar, int currentPage) { - AdminHtml.showAdminHtml(activeChar, "enchant.htm"); + if (currentPage == 1) + { + AdminHtml.showAdminHtml(activeChar, "enchant.htm"); + } + else if (currentPage == 2) + { + String getVars = HtmCache.getInstance().getHtm(activeChar, "data/html/admin/enchantArtifact.htm"); + ItemInstance findItem = null; + int currentEnch = 0; + for (int i = 0; i < 21; i++) + { + Item item = ItemTable.getInstance().getTemplate(activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_ARTIFACT1 + i)); + findItem = activeChar.getInventory().getPaperdollItem(Inventory.PAPERDOLL_ARTIFACT1 + i); + if (findItem != null) // null check for unequipped slots + { + currentEnch = findItem.getEnchantLevel(); + } + // If no agathion in slot - returns blank square icon + if (item == null) + { + getVars = getVars.replace("%ar" + i + "_icon%", "L2UI_CT1.Windows.Windows_DF_TooltipBG"); + getVars = getVars.replace("%ar" + i + "_ench%", " "); + } + else + { + getVars = getVars.replace("%ar" + i + "_icon%", item.getIcon()); + // if enchant value is 0 - show "blank instead of 0 + if (currentEnch != 0) + { + getVars = getVars.replace("%ar" + i + "_ench%", Integer.toString(currentEnch));// send ench value + } + else + { + getVars = getVars.replace("%ar" + i + "_ench%", " ");// send "space" so displays icon correctly + } + } + } + + final NpcHtmlMessage html = new NpcHtmlMessage(0, 1); + html.setHtml(getVars); + activeChar.sendPacket(html); + } + else if (currentPage == 3) + { + String getVars = HtmCache.getInstance().getHtm(activeChar, "data/html/admin/enchantAgathion.htm"); + ItemInstance findItem = null; + int currentEnch = 0; + for (int i = 0; i < 5; i++) + { + Item item = ItemTable.getInstance().getTemplate(activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_AGATHION1 + i)); + findItem = activeChar.getInventory().getPaperdollItem(Inventory.PAPERDOLL_AGATHION1 + i); + if (findItem != null) // null check for unequipped slots + { + currentEnch = findItem.getEnchantLevel(); + } + // If no agathion in slot - returns blank square icon + if (item == null) + { + getVars = getVars.replace("%ag" + i + "_icon%", "L2UI_CT1.Windows.Windows_DF_TooltipBG"); + getVars = getVars.replace("%ag" + i + "_ench%", " "); + } + else + { + getVars = getVars.replace("%ag" + i + "_icon%", item.getIcon()); + // if enchant value is 0 - show "blank instead of 0 + if (currentEnch != 0) + { + getVars = getVars.replace("%ag" + i + "_ench%", Integer.toString(currentEnch));// send ench value + } + else + { + getVars = getVars.replace("%ag" + i + "_ench%", " ");// send "space" so displays icon correctly + } + } + } + + final NpcHtmlMessage html = new NpcHtmlMessage(0, 1); + html.setHtml(getVars); + activeChar.sendPacket(html); + } } @Override diff --git a/L2J_Mobius_7.0_PreludeOfWar/dist/game/config/AdminCommands.xml b/L2J_Mobius_7.0_PreludeOfWar/dist/game/config/AdminCommands.xml index c7a1a461b6..2bc10f119f 100644 --- a/L2J_Mobius_7.0_PreludeOfWar/dist/game/config/AdminCommands.xml +++ b/L2J_Mobius_7.0_PreludeOfWar/dist/game/config/AdminCommands.xml @@ -220,6 +220,40 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/html/admin/enchant.htm b/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/html/admin/enchant.htm index bd7221aa27..65aacbe2fa 100644 --- a/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/html/admin/enchant.htm +++ b/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/html/admin/enchant.htm @@ -1,101 +1,120 @@ Enchant & Attribute Menu
+ + + + + + + +
Enchant Value 0-127:
- - - - - + + + + +
Enchant & Attribute
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

-Enchant Enhancement:
- - - - - +
Enchant Value 0-127:
+ + + + + + + + + + + + + + + + + + + + + + + +

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-

Attribute Enhancement:
- - - - - - - - + + + + + + + +
Element Type:
Element Value 0-450:
Element Type:
Element Value 0-450:

- - - - - - - - - - - - - - - - - - - +
+ + + + + + + + + + + + + + + + + +

diff --git a/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/html/admin/enchantAgathion.htm b/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/html/admin/enchantAgathion.htm new file mode 100644 index 0000000000..105643c84a --- /dev/null +++ b/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/html/admin/enchantAgathion.htm @@ -0,0 +1,75 @@ +Agathion Enchant Menu +
+ + + + + + + +
Enchant Value 0-10:
+
+



+ +
+ + + + + +
Enchante Equipped Agathions
Equip and un-equip while enchanting.
Each button corresponds to agathion slot
in your inventory.
+



+ + + + + + + + + + + + + + + + + + +
+ +
+
+
+
+
+
+
+
+
+
+
+
+
+
+ +
+ + + + + + +
+
+
+
+ +
+ \ No newline at end of file diff --git a/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/html/admin/enchantArtifact.htm b/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/html/admin/enchantArtifact.htm new file mode 100644 index 0000000000..d5fff6c4a5 --- /dev/null +++ b/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/html/admin/enchantArtifact.htm @@ -0,0 +1,195 @@ +Artifact Enchant Menu +
+ + + + + + + +
Enchant Value 0-10:
+
+ +
+ + + + + + +
+
+
+
+
+
+
+ + + + + + +
+
+
+
+
+
+
+ + + + + +
+
+
+
+
+
+
+ + + + + +
+
+
+
+
+ + + +
+ + +
+ + + + + +
+
+
+
+ + + + + +
+
+
+
+
+
+
+ + + + + + +
+
+
+
+
+
+
+ + + + + + +
+
+
+
+
+
+
+
+
+ + +
+ + + + + +
+
+
+
+ + + + + +
+
+
+
+
+
+
+ + + + + + +
+
+
+
+
+
+
+ + + + + + +
+
+
+
+
+
+
+
+
+
+
+ +
+ \ No newline at end of file diff --git a/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/scripts/handlers/admincommandhandlers/AdminEnchant.java b/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/scripts/handlers/admincommandhandlers/AdminEnchant.java index be416b4b4a..a50cea3c2d 100644 --- a/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/scripts/handlers/admincommandhandlers/AdminEnchant.java +++ b/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/scripts/handlers/admincommandhandlers/AdminEnchant.java @@ -19,12 +19,16 @@ package handlers.admincommandhandlers; import java.util.logging.Logger; import org.l2jmobius.Config; +import org.l2jmobius.gameserver.cache.HtmCache; +import org.l2jmobius.gameserver.data.ItemTable; import org.l2jmobius.gameserver.handler.IAdminCommandHandler; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import org.l2jmobius.gameserver.model.itemcontainer.Inventory; +import org.l2jmobius.gameserver.model.items.Item; import org.l2jmobius.gameserver.model.items.instance.ItemInstance; import org.l2jmobius.gameserver.network.SystemMessageId; import org.l2jmobius.gameserver.network.serverpackets.InventoryUpdate; +import org.l2jmobius.gameserver.network.serverpackets.NpcHtmlMessage; import org.l2jmobius.gameserver.util.BuilderUtil; /** @@ -51,16 +55,62 @@ public class AdminEnchant implements IAdminCommandHandler "admin_seten", // 3 "admin_setun", // 0 "admin_setba", // 13 - "admin_setbe", + "admin_setbe", // belt + "admin_seth1", // L Hair + "admin_seth2", // R Hair + "admin_setbr", // Brooch + "admin_setbt", // L Bracelet + "admin_setsb", // Seed (R) Bracelet + "admin_setab", // Artifact Book + "admin_seta1", // Agathion SLOT1 + "admin_seta2", // Agathion SLOT2 + "admin_seta3", // Agathion SLOT3 + "admin_seta4", // Agathion SLOT4 + "admin_seta5", // Agathion SLOT5 + "admin_set01", // Artifact (balance) + "admin_set02", // Artifact (balance) + "admin_set03", // Artifact (balance) + "admin_set04", // Artifact (balance) + "admin_set05", // Artifact (balance) + "admin_set06", // Artifact (balance) + "admin_set07", // Artifact (balance) + "admin_set08", // Artifact (balance) + "admin_set09", // Artifact (balance) + "admin_set10", // Artifact (balance) + "admin_set11", // Artifact (balance) + "admin_set12", // Artifact (balance) + "admin_set13", // Artifact (Attack) + "admin_set14", // Artifact (Attack) + "admin_set15", // Artifact (Attack) + "admin_set16", // Artifact (Protection) + "admin_set17", // Artifact (Protection) + "admin_set18", // Artifact (Protection) + "admin_set19", // Artifact (Support) + "admin_set20", // Artifact (Support) + "admin_set21", // Artifact (Support) + "admin_artifact", + "admin_agathion", "admin_enchant" }; @Override public boolean useAdminCommand(String command, PlayerInstance activeChar) { + int currentPage = 0; if (command.equals("admin_enchant")) { - showMainPage(activeChar); + currentPage = 1; + showMainPage(activeChar, currentPage); + } + else if (command.equals("admin_artifact")) + { + currentPage = 2; + showMainPage(activeChar, currentPage); + } + else if (command.equals("admin_agathion")) + { + currentPage = 3; + showMainPage(activeChar, currentPage); } else { @@ -125,17 +175,146 @@ public class AdminEnchant implements IAdminCommandHandler { armorType = Inventory.PAPERDOLL_BELT; } + else if (command.startsWith("admin_seth1")) + { + armorType = Inventory.PAPERDOLL_HAIR; + } + else if (command.startsWith("admin_seth2")) + { + armorType = Inventory.PAPERDOLL_HAIR2; + } + else if (command.startsWith("admin_setbr")) + { + armorType = Inventory.PAPERDOLL_BROOCH; + } + else if (command.startsWith("admin_setbt")) // bracelet + { + armorType = Inventory.PAPERDOLL_RBRACELET; + } + else if (command.startsWith("admin_setsb")) // seed bracelet + { + armorType = Inventory.PAPERDOLL_LBRACELET; + } + else if (command.startsWith("admin_setab")) + { + armorType = Inventory.PAPERDOLL_ARTIFACT_BOOK; + } + else if (command.startsWith("admin_seta1")) + { + armorType = Inventory.PAPERDOLL_AGATHION1; + } + else if (command.startsWith("admin_seta2")) + { + armorType = Inventory.PAPERDOLL_AGATHION2; + } + else if (command.startsWith("admin_seta3")) + { + armorType = Inventory.PAPERDOLL_AGATHION3; + } + else if (command.startsWith("admin_seta4")) + { + armorType = Inventory.PAPERDOLL_AGATHION4; + } + else if (command.startsWith("admin_seta5")) + { + armorType = Inventory.PAPERDOLL_AGATHION5; + } + else if (command.startsWith("admin_set01")) + { + armorType = Inventory.PAPERDOLL_ARTIFACT1; + } + else if (command.startsWith("admin_set02")) + { + armorType = Inventory.PAPERDOLL_ARTIFACT2; + } + else if (command.startsWith("admin_set03")) + { + armorType = Inventory.PAPERDOLL_ARTIFACT3; + } + else if (command.startsWith("admin_set04")) + { + armorType = Inventory.PAPERDOLL_ARTIFACT4; + } + else if (command.startsWith("admin_set05")) + { + armorType = Inventory.PAPERDOLL_ARTIFACT5; + } + else if (command.startsWith("admin_set06")) + { + armorType = Inventory.PAPERDOLL_ARTIFACT6; + } + else if (command.startsWith("admin_set07")) + { + armorType = Inventory.PAPERDOLL_ARTIFACT7; + } + else if (command.startsWith("admin_set08")) + { + armorType = Inventory.PAPERDOLL_ARTIFACT8; + } + else if (command.startsWith("admin_set09")) + { + armorType = Inventory.PAPERDOLL_ARTIFACT9; + } + else if (command.startsWith("admin_set10")) + { + armorType = Inventory.PAPERDOLL_ARTIFACT10; + } + else if (command.startsWith("admin_set11")) + { + armorType = Inventory.PAPERDOLL_ARTIFACT11; + } + else if (command.startsWith("admin_set12")) + { + armorType = Inventory.PAPERDOLL_ARTIFACT12; + } + else if (command.startsWith("admin_set13")) + { + armorType = Inventory.PAPERDOLL_ARTIFACT13; + } + else if (command.startsWith("admin_set14")) + { + armorType = Inventory.PAPERDOLL_ARTIFACT14; + } + else if (command.startsWith("admin_set15")) + { + armorType = Inventory.PAPERDOLL_ARTIFACT15; + } + else if (command.startsWith("admin_set16")) + { + armorType = Inventory.PAPERDOLL_ARTIFACT16; + } + else if (command.startsWith("admin_set17")) + { + armorType = Inventory.PAPERDOLL_ARTIFACT17; + } + else if (command.startsWith("admin_set18")) + { + armorType = Inventory.PAPERDOLL_ARTIFACT18; + } + else if (command.startsWith("admin_set19")) + { + armorType = Inventory.PAPERDOLL_ARTIFACT19; + } + else if (command.startsWith("admin_set20")) + { + armorType = Inventory.PAPERDOLL_ARTIFACT20; + } + else if (command.startsWith("admin_set21")) + { + armorType = Inventory.PAPERDOLL_ARTIFACT21; + } if (armorType != -1) { try { - final int ench = Integer.parseInt(command.substring(12)); + final int enchIn = Integer.parseInt(command.substring(12)); + int ench = enchIn; // check value if ((ench < 0) || (ench > 127)) { - BuilderUtil.sendSysMessage(activeChar, "You must set the enchant level to be between 0-127."); + BuilderUtil.sendSysMessage(activeChar, "New enchant value can only be 0 - 127."); } else { @@ -144,11 +323,15 @@ public class AdminEnchant implements IAdminCommandHandler } catch (StringIndexOutOfBoundsException e) { + // quality of life change. if no input - set enchant value to 0 + int fuse = 0; if (Config.DEVELOPER) { - LOGGER.warning("Set enchant error: " + e); + LOGGER.warning("Enchant Value set to: " + fuse); } - BuilderUtil.sendSysMessage(activeChar, "Please specify a new enchant value."); + BuilderUtil.sendSysMessage(activeChar, "Auto-Set Enchant value to 0."); + + setEnchant(activeChar, fuse, armorType); } catch (NumberFormatException e) { @@ -161,7 +344,7 @@ public class AdminEnchant implements IAdminCommandHandler } // show the enchant menu after an action - showMainPage(activeChar); + showMainPage(activeChar, currentPage); } return true; } @@ -192,9 +375,7 @@ public class AdminEnchant implements IAdminCommandHandler final int curEnchant = itemInstance.getEnchantLevel(); // set enchant value - player.getInventory().unEquipItemInSlot(armorType); itemInstance.setEnchantLevel(ench); - player.getInventory().equipItem(itemInstance); // send packets final InventoryUpdate iu = new InventoryUpdate(); @@ -208,9 +389,88 @@ public class AdminEnchant implements IAdminCommandHandler } } - private void showMainPage(PlayerInstance activeChar) + private void showMainPage(PlayerInstance activeChar, int currentPage) { - AdminHtml.showAdminHtml(activeChar, "enchant.htm"); + if (currentPage == 1) + { + AdminHtml.showAdminHtml(activeChar, "enchant.htm"); + } + else if (currentPage == 2) + { + String getVars = HtmCache.getInstance().getHtm(activeChar, "data/html/admin/enchantArtifact.htm"); + ItemInstance findItem = null; + int currentEnch = 0; + for (int i = 0; i < 21; i++) + { + Item item = ItemTable.getInstance().getTemplate(activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_ARTIFACT1 + i)); + findItem = activeChar.getInventory().getPaperdollItem(Inventory.PAPERDOLL_ARTIFACT1 + i); + if (findItem != null) // null check for unequipped slots + { + currentEnch = findItem.getEnchantLevel(); + } + // If no agathion in slot - returns blank square icon + if (item == null) + { + getVars = getVars.replace("%ar" + i + "_icon%", "L2UI_CT1.Windows.Windows_DF_TooltipBG"); + getVars = getVars.replace("%ar" + i + "_ench%", " "); + } + else + { + getVars = getVars.replace("%ar" + i + "_icon%", item.getIcon()); + // if enchant value is 0 - show "blank instead of 0 + if (currentEnch != 0) + { + getVars = getVars.replace("%ar" + i + "_ench%", Integer.toString(currentEnch));// send ench value + } + else + { + getVars = getVars.replace("%ar" + i + "_ench%", " ");// send "space" so displays icon correctly + } + } + } + + final NpcHtmlMessage html = new NpcHtmlMessage(0, 1); + html.setHtml(getVars); + activeChar.sendPacket(html); + } + else if (currentPage == 3) + { + String getVars = HtmCache.getInstance().getHtm(activeChar, "data/html/admin/enchantAgathion.htm"); + ItemInstance findItem = null; + int currentEnch = 0; + for (int i = 0; i < 5; i++) + { + Item item = ItemTable.getInstance().getTemplate(activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_AGATHION1 + i)); + findItem = activeChar.getInventory().getPaperdollItem(Inventory.PAPERDOLL_AGATHION1 + i); + if (findItem != null) // null check for unequipped slots + { + currentEnch = findItem.getEnchantLevel(); + } + // If no agathion in slot - returns blank square icon + if (item == null) + { + getVars = getVars.replace("%ag" + i + "_icon%", "L2UI_CT1.Windows.Windows_DF_TooltipBG"); + getVars = getVars.replace("%ag" + i + "_ench%", " "); + } + else + { + getVars = getVars.replace("%ag" + i + "_icon%", item.getIcon()); + // if enchant value is 0 - show "blank instead of 0 + if (currentEnch != 0) + { + getVars = getVars.replace("%ag" + i + "_ench%", Integer.toString(currentEnch));// send ench value + } + else + { + getVars = getVars.replace("%ag" + i + "_ench%", " ");// send "space" so displays icon correctly + } + } + } + + final NpcHtmlMessage html = new NpcHtmlMessage(0, 1); + html.setHtml(getVars); + activeChar.sendPacket(html); + } } @Override diff --git a/L2J_Mobius_8.0_Homunculus/dist/game/config/AdminCommands.xml b/L2J_Mobius_8.0_Homunculus/dist/game/config/AdminCommands.xml index f6c405db35..fadaa47ea7 100644 --- a/L2J_Mobius_8.0_Homunculus/dist/game/config/AdminCommands.xml +++ b/L2J_Mobius_8.0_Homunculus/dist/game/config/AdminCommands.xml @@ -220,11 +220,40 @@ - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/L2J_Mobius_8.0_Homunculus/dist/game/data/html/admin/enchant.htm b/L2J_Mobius_8.0_Homunculus/dist/game/data/html/admin/enchant.htm index 34734af999..65aacbe2fa 100644 --- a/L2J_Mobius_8.0_Homunculus/dist/game/data/html/admin/enchant.htm +++ b/L2J_Mobius_8.0_Homunculus/dist/game/data/html/admin/enchant.htm @@ -1,115 +1,120 @@ Enchant & Attribute Menu
+ + + + + + + +
Enchant Value 0-127:
- - - - - + + + + +
Enchant & Attribute
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

-Enchant Enhancement:
- - - - - +
Enchant Value 0-127:
+ + + + + + + + + + + + + + + + + + + + + + + +

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-

Attribute Enhancement:
- - - - - - - - + + + + + + + +
Element Type:
Element Value 0-450:
Element Type:
Element Value 0-450:

- - - - - - - - - - - - - - - - - - - +
+ + + + + + + + + + + + + + + + + +

diff --git a/L2J_Mobius_8.0_Homunculus/dist/game/data/html/admin/enchantAgathion.htm b/L2J_Mobius_8.0_Homunculus/dist/game/data/html/admin/enchantAgathion.htm new file mode 100644 index 0000000000..105643c84a --- /dev/null +++ b/L2J_Mobius_8.0_Homunculus/dist/game/data/html/admin/enchantAgathion.htm @@ -0,0 +1,75 @@ +Agathion Enchant Menu +
+ + + + + + + +
Enchant Value 0-10:
+
+



+ +
+ + + + + +
Enchante Equipped Agathions
Equip and un-equip while enchanting.
Each button corresponds to agathion slot
in your inventory.
+



+ + + + + + + + + + + + + + + + + + +
+ +
+
+
+
+
+
+
+
+
+
+
+
+
+
+ +
+ + + + + + +
+
+
+
+ +
+ \ No newline at end of file diff --git a/L2J_Mobius_8.0_Homunculus/dist/game/data/html/admin/enchantArtifact.htm b/L2J_Mobius_8.0_Homunculus/dist/game/data/html/admin/enchantArtifact.htm new file mode 100644 index 0000000000..d5fff6c4a5 --- /dev/null +++ b/L2J_Mobius_8.0_Homunculus/dist/game/data/html/admin/enchantArtifact.htm @@ -0,0 +1,195 @@ +Artifact Enchant Menu +
+ + + + + + + +
Enchant Value 0-10:
+
+ +
+ + + + + + +
+
+
+
+
+
+
+ + + + + + +
+
+
+
+
+
+
+ + + + + +
+
+
+
+
+
+
+ + + + + +
+
+
+
+
+ + + +
+ + +
+ + + + + +
+
+
+
+ + + + + +
+
+
+
+
+
+
+ + + + + + +
+
+
+
+
+
+
+ + + + + + +
+
+
+
+
+
+
+
+
+ + +
+ + + + + +
+
+
+
+ + + + + +
+
+
+
+
+
+
+ + + + + + +
+
+
+
+
+
+
+ + + + + + +
+
+
+
+
+
+
+
+
+
+
+ +
+ \ No newline at end of file diff --git a/L2J_Mobius_8.0_Homunculus/dist/game/data/scripts/handlers/admincommandhandlers/AdminEnchant.java b/L2J_Mobius_8.0_Homunculus/dist/game/data/scripts/handlers/admincommandhandlers/AdminEnchant.java index c25f4d8a7e..a50cea3c2d 100644 --- a/L2J_Mobius_8.0_Homunculus/dist/game/data/scripts/handlers/admincommandhandlers/AdminEnchant.java +++ b/L2J_Mobius_8.0_Homunculus/dist/game/data/scripts/handlers/admincommandhandlers/AdminEnchant.java @@ -19,12 +19,16 @@ package handlers.admincommandhandlers; import java.util.logging.Logger; import org.l2jmobius.Config; +import org.l2jmobius.gameserver.cache.HtmCache; +import org.l2jmobius.gameserver.data.ItemTable; import org.l2jmobius.gameserver.handler.IAdminCommandHandler; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import org.l2jmobius.gameserver.model.itemcontainer.Inventory; +import org.l2jmobius.gameserver.model.items.Item; import org.l2jmobius.gameserver.model.items.instance.ItemInstance; import org.l2jmobius.gameserver.network.SystemMessageId; import org.l2jmobius.gameserver.network.serverpackets.InventoryUpdate; +import org.l2jmobius.gameserver.network.serverpackets.NpcHtmlMessage; import org.l2jmobius.gameserver.util.BuilderUtil; /** @@ -51,21 +55,62 @@ public class AdminEnchant implements IAdminCommandHandler "admin_seten", // 3 "admin_setun", // 0 "admin_setba", // 13 - "admin_setbe", // 29 - "admin_setrb", // 16 - "admin_setci", // 2 - "admin_setma", // 3 - "admin_setbr", // 30 - "admin_setab", // 37 + "admin_setbe", // belt + "admin_seth1", // L Hair + "admin_seth2", // R Hair + "admin_setbr", // Brooch + "admin_setbt", // L Bracelet + "admin_setsb", // Seed (R) Bracelet + "admin_setab", // Artifact Book + "admin_seta1", // Agathion SLOT1 + "admin_seta2", // Agathion SLOT2 + "admin_seta3", // Agathion SLOT3 + "admin_seta4", // Agathion SLOT4 + "admin_seta5", // Agathion SLOT5 + "admin_set01", // Artifact (balance) + "admin_set02", // Artifact (balance) + "admin_set03", // Artifact (balance) + "admin_set04", // Artifact (balance) + "admin_set05", // Artifact (balance) + "admin_set06", // Artifact (balance) + "admin_set07", // Artifact (balance) + "admin_set08", // Artifact (balance) + "admin_set09", // Artifact (balance) + "admin_set10", // Artifact (balance) + "admin_set11", // Artifact (balance) + "admin_set12", // Artifact (balance) + "admin_set13", // Artifact (Attack) + "admin_set14", // Artifact (Attack) + "admin_set15", // Artifact (Attack) + "admin_set16", // Artifact (Protection) + "admin_set17", // Artifact (Protection) + "admin_set18", // Artifact (Protection) + "admin_set19", // Artifact (Support) + "admin_set20", // Artifact (Support) + "admin_set21", // Artifact (Support) + "admin_artifact", + "admin_agathion", "admin_enchant" }; @Override public boolean useAdminCommand(String command, PlayerInstance activeChar) { + int currentPage = 0; if (command.equals("admin_enchant")) { - showMainPage(activeChar); + currentPage = 1; + showMainPage(activeChar, currentPage); + } + else if (command.equals("admin_artifact")) + { + currentPage = 2; + showMainPage(activeChar, currentPage); + } + else if (command.equals("admin_agathion")) + { + currentPage = 3; + showMainPage(activeChar, currentPage); } else { @@ -130,37 +175,146 @@ public class AdminEnchant implements IAdminCommandHandler { armorType = Inventory.PAPERDOLL_BELT; } - else if (command.startsWith("admin_setrb")) - { - armorType = Inventory.PAPERDOLL_RBRACELET; - } - else if (command.startsWith("admin_setci")) - { - armorType = Inventory.PAPERDOLL_HAIR2; - } - else if (command.startsWith("admin_setma")) + else if (command.startsWith("admin_seth1")) { armorType = Inventory.PAPERDOLL_HAIR; } + else if (command.startsWith("admin_seth2")) + { + armorType = Inventory.PAPERDOLL_HAIR2; + } else if (command.startsWith("admin_setbr")) { armorType = Inventory.PAPERDOLL_BROOCH; } + else if (command.startsWith("admin_setbt")) // bracelet + { + armorType = Inventory.PAPERDOLL_RBRACELET; + } + else if (command.startsWith("admin_setsb")) // seed bracelet + { + armorType = Inventory.PAPERDOLL_LBRACELET; + } else if (command.startsWith("admin_setab")) { armorType = Inventory.PAPERDOLL_ARTIFACT_BOOK; } + else if (command.startsWith("admin_seta1")) + { + armorType = Inventory.PAPERDOLL_AGATHION1; + } + else if (command.startsWith("admin_seta2")) + { + armorType = Inventory.PAPERDOLL_AGATHION2; + } + else if (command.startsWith("admin_seta3")) + { + armorType = Inventory.PAPERDOLL_AGATHION3; + } + else if (command.startsWith("admin_seta4")) + { + armorType = Inventory.PAPERDOLL_AGATHION4; + } + else if (command.startsWith("admin_seta5")) + { + armorType = Inventory.PAPERDOLL_AGATHION5; + } + else if (command.startsWith("admin_set01")) + { + armorType = Inventory.PAPERDOLL_ARTIFACT1; + } + else if (command.startsWith("admin_set02")) + { + armorType = Inventory.PAPERDOLL_ARTIFACT2; + } + else if (command.startsWith("admin_set03")) + { + armorType = Inventory.PAPERDOLL_ARTIFACT3; + } + else if (command.startsWith("admin_set04")) + { + armorType = Inventory.PAPERDOLL_ARTIFACT4; + } + else if (command.startsWith("admin_set05")) + { + armorType = Inventory.PAPERDOLL_ARTIFACT5; + } + else if (command.startsWith("admin_set06")) + { + armorType = Inventory.PAPERDOLL_ARTIFACT6; + } + else if (command.startsWith("admin_set07")) + { + armorType = Inventory.PAPERDOLL_ARTIFACT7; + } + else if (command.startsWith("admin_set08")) + { + armorType = Inventory.PAPERDOLL_ARTIFACT8; + } + else if (command.startsWith("admin_set09")) + { + armorType = Inventory.PAPERDOLL_ARTIFACT9; + } + else if (command.startsWith("admin_set10")) + { + armorType = Inventory.PAPERDOLL_ARTIFACT10; + } + else if (command.startsWith("admin_set11")) + { + armorType = Inventory.PAPERDOLL_ARTIFACT11; + } + else if (command.startsWith("admin_set12")) + { + armorType = Inventory.PAPERDOLL_ARTIFACT12; + } + else if (command.startsWith("admin_set13")) + { + armorType = Inventory.PAPERDOLL_ARTIFACT13; + } + else if (command.startsWith("admin_set14")) + { + armorType = Inventory.PAPERDOLL_ARTIFACT14; + } + else if (command.startsWith("admin_set15")) + { + armorType = Inventory.PAPERDOLL_ARTIFACT15; + } + else if (command.startsWith("admin_set16")) + { + armorType = Inventory.PAPERDOLL_ARTIFACT16; + } + else if (command.startsWith("admin_set17")) + { + armorType = Inventory.PAPERDOLL_ARTIFACT17; + } + else if (command.startsWith("admin_set18")) + { + armorType = Inventory.PAPERDOLL_ARTIFACT18; + } + else if (command.startsWith("admin_set19")) + { + armorType = Inventory.PAPERDOLL_ARTIFACT19; + } + else if (command.startsWith("admin_set20")) + { + armorType = Inventory.PAPERDOLL_ARTIFACT20; + } + else if (command.startsWith("admin_set21")) + { + armorType = Inventory.PAPERDOLL_ARTIFACT21; + } if (armorType != -1) { try { - final int ench = Integer.parseInt(command.substring(12)); + final int enchIn = Integer.parseInt(command.substring(12)); + int ench = enchIn; // check value if ((ench < 0) || (ench > 127)) { - BuilderUtil.sendSysMessage(activeChar, "You must set the enchant level to be between 0-127."); + BuilderUtil.sendSysMessage(activeChar, "New enchant value can only be 0 - 127."); } else { @@ -169,11 +323,15 @@ public class AdminEnchant implements IAdminCommandHandler } catch (StringIndexOutOfBoundsException e) { + // quality of life change. if no input - set enchant value to 0 + int fuse = 0; if (Config.DEVELOPER) { - LOGGER.warning("Set enchant error: " + e); + LOGGER.warning("Enchant Value set to: " + fuse); } - BuilderUtil.sendSysMessage(activeChar, "Please specify a new enchant value."); + BuilderUtil.sendSysMessage(activeChar, "Auto-Set Enchant value to 0."); + + setEnchant(activeChar, fuse, armorType); } catch (NumberFormatException e) { @@ -186,7 +344,7 @@ public class AdminEnchant implements IAdminCommandHandler } // show the enchant menu after an action - showMainPage(activeChar); + showMainPage(activeChar, currentPage); } return true; } @@ -217,9 +375,7 @@ public class AdminEnchant implements IAdminCommandHandler final int curEnchant = itemInstance.getEnchantLevel(); // set enchant value - player.getInventory().unEquipItemInSlot(armorType); itemInstance.setEnchantLevel(ench); - player.getInventory().equipItem(itemInstance); // send packets final InventoryUpdate iu = new InventoryUpdate(); @@ -233,9 +389,88 @@ public class AdminEnchant implements IAdminCommandHandler } } - private void showMainPage(PlayerInstance activeChar) + private void showMainPage(PlayerInstance activeChar, int currentPage) { - AdminHtml.showAdminHtml(activeChar, "enchant.htm"); + if (currentPage == 1) + { + AdminHtml.showAdminHtml(activeChar, "enchant.htm"); + } + else if (currentPage == 2) + { + String getVars = HtmCache.getInstance().getHtm(activeChar, "data/html/admin/enchantArtifact.htm"); + ItemInstance findItem = null; + int currentEnch = 0; + for (int i = 0; i < 21; i++) + { + Item item = ItemTable.getInstance().getTemplate(activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_ARTIFACT1 + i)); + findItem = activeChar.getInventory().getPaperdollItem(Inventory.PAPERDOLL_ARTIFACT1 + i); + if (findItem != null) // null check for unequipped slots + { + currentEnch = findItem.getEnchantLevel(); + } + // If no agathion in slot - returns blank square icon + if (item == null) + { + getVars = getVars.replace("%ar" + i + "_icon%", "L2UI_CT1.Windows.Windows_DF_TooltipBG"); + getVars = getVars.replace("%ar" + i + "_ench%", " "); + } + else + { + getVars = getVars.replace("%ar" + i + "_icon%", item.getIcon()); + // if enchant value is 0 - show "blank instead of 0 + if (currentEnch != 0) + { + getVars = getVars.replace("%ar" + i + "_ench%", Integer.toString(currentEnch));// send ench value + } + else + { + getVars = getVars.replace("%ar" + i + "_ench%", " ");// send "space" so displays icon correctly + } + } + } + + final NpcHtmlMessage html = new NpcHtmlMessage(0, 1); + html.setHtml(getVars); + activeChar.sendPacket(html); + } + else if (currentPage == 3) + { + String getVars = HtmCache.getInstance().getHtm(activeChar, "data/html/admin/enchantAgathion.htm"); + ItemInstance findItem = null; + int currentEnch = 0; + for (int i = 0; i < 5; i++) + { + Item item = ItemTable.getInstance().getTemplate(activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_AGATHION1 + i)); + findItem = activeChar.getInventory().getPaperdollItem(Inventory.PAPERDOLL_AGATHION1 + i); + if (findItem != null) // null check for unequipped slots + { + currentEnch = findItem.getEnchantLevel(); + } + // If no agathion in slot - returns blank square icon + if (item == null) + { + getVars = getVars.replace("%ag" + i + "_icon%", "L2UI_CT1.Windows.Windows_DF_TooltipBG"); + getVars = getVars.replace("%ag" + i + "_ench%", " "); + } + else + { + getVars = getVars.replace("%ag" + i + "_icon%", item.getIcon()); + // if enchant value is 0 - show "blank instead of 0 + if (currentEnch != 0) + { + getVars = getVars.replace("%ag" + i + "_ench%", Integer.toString(currentEnch));// send ench value + } + else + { + getVars = getVars.replace("%ag" + i + "_ench%", " ");// send "space" so displays icon correctly + } + } + } + + final NpcHtmlMessage html = new NpcHtmlMessage(0, 1); + html.setHtml(getVars); + activeChar.sendPacket(html); + } } @Override diff --git a/L2J_Mobius_9.0_ReturnOfTheQueenAnt/dist/game/config/AdminCommands.xml b/L2J_Mobius_9.0_ReturnOfTheQueenAnt/dist/game/config/AdminCommands.xml index f6c405db35..fadaa47ea7 100644 --- a/L2J_Mobius_9.0_ReturnOfTheQueenAnt/dist/game/config/AdminCommands.xml +++ b/L2J_Mobius_9.0_ReturnOfTheQueenAnt/dist/game/config/AdminCommands.xml @@ -220,11 +220,40 @@ - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/L2J_Mobius_9.0_ReturnOfTheQueenAnt/dist/game/data/html/admin/enchant.htm b/L2J_Mobius_9.0_ReturnOfTheQueenAnt/dist/game/data/html/admin/enchant.htm index 34734af999..65aacbe2fa 100644 --- a/L2J_Mobius_9.0_ReturnOfTheQueenAnt/dist/game/data/html/admin/enchant.htm +++ b/L2J_Mobius_9.0_ReturnOfTheQueenAnt/dist/game/data/html/admin/enchant.htm @@ -1,115 +1,120 @@ Enchant & Attribute Menu
+ + + + + + + +
Enchant Value 0-127:
- - - - - + + + + +
Enchant & Attribute
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

-Enchant Enhancement:
- - - - - +
Enchant Value 0-127:
+ + + + + + + + + + + + + + + + + + + + + + + +

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-

Attribute Enhancement:
- - - - - - - - + + + + + + + +
Element Type:
Element Value 0-450:
Element Type:
Element Value 0-450:

- - - - - - - - - - - - - - - - - - - +
+ + + + + + + + + + + + + + + + + +

diff --git a/L2J_Mobius_9.0_ReturnOfTheQueenAnt/dist/game/data/html/admin/enchantAgathion.htm b/L2J_Mobius_9.0_ReturnOfTheQueenAnt/dist/game/data/html/admin/enchantAgathion.htm new file mode 100644 index 0000000000..105643c84a --- /dev/null +++ b/L2J_Mobius_9.0_ReturnOfTheQueenAnt/dist/game/data/html/admin/enchantAgathion.htm @@ -0,0 +1,75 @@ +Agathion Enchant Menu +
+ + + + + + + +
Enchant Value 0-10:
+
+



+ +
+ + + + + +
Enchante Equipped Agathions
Equip and un-equip while enchanting.
Each button corresponds to agathion slot
in your inventory.
+



+ + + + + + + + + + + + + + + + + + +
+ +
+
+
+
+
+
+
+
+
+
+
+
+
+
+ +
+ + + + + + +
+
+
+
+ +
+ \ No newline at end of file diff --git a/L2J_Mobius_9.0_ReturnOfTheQueenAnt/dist/game/data/html/admin/enchantArtifact.htm b/L2J_Mobius_9.0_ReturnOfTheQueenAnt/dist/game/data/html/admin/enchantArtifact.htm new file mode 100644 index 0000000000..d5fff6c4a5 --- /dev/null +++ b/L2J_Mobius_9.0_ReturnOfTheQueenAnt/dist/game/data/html/admin/enchantArtifact.htm @@ -0,0 +1,195 @@ +Artifact Enchant Menu +
+ + + + + + + +
Enchant Value 0-10:
+
+ +
+ + + + + + +
+
+
+
+
+
+
+ + + + + + +
+
+
+
+
+
+
+ + + + + +
+
+
+
+
+
+
+ + + + + +
+
+
+
+
+ + + +
+ + +
+ + + + + +
+
+
+
+ + + + + +
+
+
+
+
+
+
+ + + + + + +
+
+
+
+
+
+
+ + + + + + +
+
+
+
+
+
+
+
+
+ + +
+ + + + + +
+
+
+
+ + + + + +
+
+
+
+
+
+
+ + + + + + +
+
+
+
+
+
+
+ + + + + + +
+
+
+
+
+
+
+
+
+
+
+ +
+ \ No newline at end of file diff --git a/L2J_Mobius_9.0_ReturnOfTheQueenAnt/dist/game/data/scripts/handlers/admincommandhandlers/AdminEnchant.java b/L2J_Mobius_9.0_ReturnOfTheQueenAnt/dist/game/data/scripts/handlers/admincommandhandlers/AdminEnchant.java index c25f4d8a7e..a50cea3c2d 100644 --- a/L2J_Mobius_9.0_ReturnOfTheQueenAnt/dist/game/data/scripts/handlers/admincommandhandlers/AdminEnchant.java +++ b/L2J_Mobius_9.0_ReturnOfTheQueenAnt/dist/game/data/scripts/handlers/admincommandhandlers/AdminEnchant.java @@ -19,12 +19,16 @@ package handlers.admincommandhandlers; import java.util.logging.Logger; import org.l2jmobius.Config; +import org.l2jmobius.gameserver.cache.HtmCache; +import org.l2jmobius.gameserver.data.ItemTable; import org.l2jmobius.gameserver.handler.IAdminCommandHandler; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import org.l2jmobius.gameserver.model.itemcontainer.Inventory; +import org.l2jmobius.gameserver.model.items.Item; import org.l2jmobius.gameserver.model.items.instance.ItemInstance; import org.l2jmobius.gameserver.network.SystemMessageId; import org.l2jmobius.gameserver.network.serverpackets.InventoryUpdate; +import org.l2jmobius.gameserver.network.serverpackets.NpcHtmlMessage; import org.l2jmobius.gameserver.util.BuilderUtil; /** @@ -51,21 +55,62 @@ public class AdminEnchant implements IAdminCommandHandler "admin_seten", // 3 "admin_setun", // 0 "admin_setba", // 13 - "admin_setbe", // 29 - "admin_setrb", // 16 - "admin_setci", // 2 - "admin_setma", // 3 - "admin_setbr", // 30 - "admin_setab", // 37 + "admin_setbe", // belt + "admin_seth1", // L Hair + "admin_seth2", // R Hair + "admin_setbr", // Brooch + "admin_setbt", // L Bracelet + "admin_setsb", // Seed (R) Bracelet + "admin_setab", // Artifact Book + "admin_seta1", // Agathion SLOT1 + "admin_seta2", // Agathion SLOT2 + "admin_seta3", // Agathion SLOT3 + "admin_seta4", // Agathion SLOT4 + "admin_seta5", // Agathion SLOT5 + "admin_set01", // Artifact (balance) + "admin_set02", // Artifact (balance) + "admin_set03", // Artifact (balance) + "admin_set04", // Artifact (balance) + "admin_set05", // Artifact (balance) + "admin_set06", // Artifact (balance) + "admin_set07", // Artifact (balance) + "admin_set08", // Artifact (balance) + "admin_set09", // Artifact (balance) + "admin_set10", // Artifact (balance) + "admin_set11", // Artifact (balance) + "admin_set12", // Artifact (balance) + "admin_set13", // Artifact (Attack) + "admin_set14", // Artifact (Attack) + "admin_set15", // Artifact (Attack) + "admin_set16", // Artifact (Protection) + "admin_set17", // Artifact (Protection) + "admin_set18", // Artifact (Protection) + "admin_set19", // Artifact (Support) + "admin_set20", // Artifact (Support) + "admin_set21", // Artifact (Support) + "admin_artifact", + "admin_agathion", "admin_enchant" }; @Override public boolean useAdminCommand(String command, PlayerInstance activeChar) { + int currentPage = 0; if (command.equals("admin_enchant")) { - showMainPage(activeChar); + currentPage = 1; + showMainPage(activeChar, currentPage); + } + else if (command.equals("admin_artifact")) + { + currentPage = 2; + showMainPage(activeChar, currentPage); + } + else if (command.equals("admin_agathion")) + { + currentPage = 3; + showMainPage(activeChar, currentPage); } else { @@ -130,37 +175,146 @@ public class AdminEnchant implements IAdminCommandHandler { armorType = Inventory.PAPERDOLL_BELT; } - else if (command.startsWith("admin_setrb")) - { - armorType = Inventory.PAPERDOLL_RBRACELET; - } - else if (command.startsWith("admin_setci")) - { - armorType = Inventory.PAPERDOLL_HAIR2; - } - else if (command.startsWith("admin_setma")) + else if (command.startsWith("admin_seth1")) { armorType = Inventory.PAPERDOLL_HAIR; } + else if (command.startsWith("admin_seth2")) + { + armorType = Inventory.PAPERDOLL_HAIR2; + } else if (command.startsWith("admin_setbr")) { armorType = Inventory.PAPERDOLL_BROOCH; } + else if (command.startsWith("admin_setbt")) // bracelet + { + armorType = Inventory.PAPERDOLL_RBRACELET; + } + else if (command.startsWith("admin_setsb")) // seed bracelet + { + armorType = Inventory.PAPERDOLL_LBRACELET; + } else if (command.startsWith("admin_setab")) { armorType = Inventory.PAPERDOLL_ARTIFACT_BOOK; } + else if (command.startsWith("admin_seta1")) + { + armorType = Inventory.PAPERDOLL_AGATHION1; + } + else if (command.startsWith("admin_seta2")) + { + armorType = Inventory.PAPERDOLL_AGATHION2; + } + else if (command.startsWith("admin_seta3")) + { + armorType = Inventory.PAPERDOLL_AGATHION3; + } + else if (command.startsWith("admin_seta4")) + { + armorType = Inventory.PAPERDOLL_AGATHION4; + } + else if (command.startsWith("admin_seta5")) + { + armorType = Inventory.PAPERDOLL_AGATHION5; + } + else if (command.startsWith("admin_set01")) + { + armorType = Inventory.PAPERDOLL_ARTIFACT1; + } + else if (command.startsWith("admin_set02")) + { + armorType = Inventory.PAPERDOLL_ARTIFACT2; + } + else if (command.startsWith("admin_set03")) + { + armorType = Inventory.PAPERDOLL_ARTIFACT3; + } + else if (command.startsWith("admin_set04")) + { + armorType = Inventory.PAPERDOLL_ARTIFACT4; + } + else if (command.startsWith("admin_set05")) + { + armorType = Inventory.PAPERDOLL_ARTIFACT5; + } + else if (command.startsWith("admin_set06")) + { + armorType = Inventory.PAPERDOLL_ARTIFACT6; + } + else if (command.startsWith("admin_set07")) + { + armorType = Inventory.PAPERDOLL_ARTIFACT7; + } + else if (command.startsWith("admin_set08")) + { + armorType = Inventory.PAPERDOLL_ARTIFACT8; + } + else if (command.startsWith("admin_set09")) + { + armorType = Inventory.PAPERDOLL_ARTIFACT9; + } + else if (command.startsWith("admin_set10")) + { + armorType = Inventory.PAPERDOLL_ARTIFACT10; + } + else if (command.startsWith("admin_set11")) + { + armorType = Inventory.PAPERDOLL_ARTIFACT11; + } + else if (command.startsWith("admin_set12")) + { + armorType = Inventory.PAPERDOLL_ARTIFACT12; + } + else if (command.startsWith("admin_set13")) + { + armorType = Inventory.PAPERDOLL_ARTIFACT13; + } + else if (command.startsWith("admin_set14")) + { + armorType = Inventory.PAPERDOLL_ARTIFACT14; + } + else if (command.startsWith("admin_set15")) + { + armorType = Inventory.PAPERDOLL_ARTIFACT15; + } + else if (command.startsWith("admin_set16")) + { + armorType = Inventory.PAPERDOLL_ARTIFACT16; + } + else if (command.startsWith("admin_set17")) + { + armorType = Inventory.PAPERDOLL_ARTIFACT17; + } + else if (command.startsWith("admin_set18")) + { + armorType = Inventory.PAPERDOLL_ARTIFACT18; + } + else if (command.startsWith("admin_set19")) + { + armorType = Inventory.PAPERDOLL_ARTIFACT19; + } + else if (command.startsWith("admin_set20")) + { + armorType = Inventory.PAPERDOLL_ARTIFACT20; + } + else if (command.startsWith("admin_set21")) + { + armorType = Inventory.PAPERDOLL_ARTIFACT21; + } if (armorType != -1) { try { - final int ench = Integer.parseInt(command.substring(12)); + final int enchIn = Integer.parseInt(command.substring(12)); + int ench = enchIn; // check value if ((ench < 0) || (ench > 127)) { - BuilderUtil.sendSysMessage(activeChar, "You must set the enchant level to be between 0-127."); + BuilderUtil.sendSysMessage(activeChar, "New enchant value can only be 0 - 127."); } else { @@ -169,11 +323,15 @@ public class AdminEnchant implements IAdminCommandHandler } catch (StringIndexOutOfBoundsException e) { + // quality of life change. if no input - set enchant value to 0 + int fuse = 0; if (Config.DEVELOPER) { - LOGGER.warning("Set enchant error: " + e); + LOGGER.warning("Enchant Value set to: " + fuse); } - BuilderUtil.sendSysMessage(activeChar, "Please specify a new enchant value."); + BuilderUtil.sendSysMessage(activeChar, "Auto-Set Enchant value to 0."); + + setEnchant(activeChar, fuse, armorType); } catch (NumberFormatException e) { @@ -186,7 +344,7 @@ public class AdminEnchant implements IAdminCommandHandler } // show the enchant menu after an action - showMainPage(activeChar); + showMainPage(activeChar, currentPage); } return true; } @@ -217,9 +375,7 @@ public class AdminEnchant implements IAdminCommandHandler final int curEnchant = itemInstance.getEnchantLevel(); // set enchant value - player.getInventory().unEquipItemInSlot(armorType); itemInstance.setEnchantLevel(ench); - player.getInventory().equipItem(itemInstance); // send packets final InventoryUpdate iu = new InventoryUpdate(); @@ -233,9 +389,88 @@ public class AdminEnchant implements IAdminCommandHandler } } - private void showMainPage(PlayerInstance activeChar) + private void showMainPage(PlayerInstance activeChar, int currentPage) { - AdminHtml.showAdminHtml(activeChar, "enchant.htm"); + if (currentPage == 1) + { + AdminHtml.showAdminHtml(activeChar, "enchant.htm"); + } + else if (currentPage == 2) + { + String getVars = HtmCache.getInstance().getHtm(activeChar, "data/html/admin/enchantArtifact.htm"); + ItemInstance findItem = null; + int currentEnch = 0; + for (int i = 0; i < 21; i++) + { + Item item = ItemTable.getInstance().getTemplate(activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_ARTIFACT1 + i)); + findItem = activeChar.getInventory().getPaperdollItem(Inventory.PAPERDOLL_ARTIFACT1 + i); + if (findItem != null) // null check for unequipped slots + { + currentEnch = findItem.getEnchantLevel(); + } + // If no agathion in slot - returns blank square icon + if (item == null) + { + getVars = getVars.replace("%ar" + i + "_icon%", "L2UI_CT1.Windows.Windows_DF_TooltipBG"); + getVars = getVars.replace("%ar" + i + "_ench%", " "); + } + else + { + getVars = getVars.replace("%ar" + i + "_icon%", item.getIcon()); + // if enchant value is 0 - show "blank instead of 0 + if (currentEnch != 0) + { + getVars = getVars.replace("%ar" + i + "_ench%", Integer.toString(currentEnch));// send ench value + } + else + { + getVars = getVars.replace("%ar" + i + "_ench%", " ");// send "space" so displays icon correctly + } + } + } + + final NpcHtmlMessage html = new NpcHtmlMessage(0, 1); + html.setHtml(getVars); + activeChar.sendPacket(html); + } + else if (currentPage == 3) + { + String getVars = HtmCache.getInstance().getHtm(activeChar, "data/html/admin/enchantAgathion.htm"); + ItemInstance findItem = null; + int currentEnch = 0; + for (int i = 0; i < 5; i++) + { + Item item = ItemTable.getInstance().getTemplate(activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_AGATHION1 + i)); + findItem = activeChar.getInventory().getPaperdollItem(Inventory.PAPERDOLL_AGATHION1 + i); + if (findItem != null) // null check for unequipped slots + { + currentEnch = findItem.getEnchantLevel(); + } + // If no agathion in slot - returns blank square icon + if (item == null) + { + getVars = getVars.replace("%ag" + i + "_icon%", "L2UI_CT1.Windows.Windows_DF_TooltipBG"); + getVars = getVars.replace("%ag" + i + "_ench%", " "); + } + else + { + getVars = getVars.replace("%ag" + i + "_icon%", item.getIcon()); + // if enchant value is 0 - show "blank instead of 0 + if (currentEnch != 0) + { + getVars = getVars.replace("%ag" + i + "_ench%", Integer.toString(currentEnch));// send ench value + } + else + { + getVars = getVars.replace("%ag" + i + "_ench%", " ");// send "space" so displays icon correctly + } + } + } + + final NpcHtmlMessage html = new NpcHtmlMessage(0, 1); + html.setHtml(getVars); + activeChar.sendPacket(html); + } } @Override