From 3ba49ef75970ffd2120e91ac5f6c74c258171680 Mon Sep 17 00:00:00 2001 From: MobiusDevelopment <8391001+MobiusDevelopment@users.noreply.github.com> Date: Fri, 23 Apr 2021 14:45:16 +0000 Subject: [PATCH] Addition of item blessing system. --- .../dist/game/config/Rates.ini | 8 + .../dist/game/data/EnchantItemData.xml | 16 - .../data/scripts/handlers/MasterHandler.java | 2 + .../itemhandlers/BlessingScrolls.java | 55 +++ .../game/data/stats/items/00000-00099.xml | 25 ++ .../game/data/stats/items/00100-00199.xml | 27 ++ .../game/data/stats/items/00200-00299.xml | 72 +++ .../game/data/stats/items/00300-00399.xml | 7 + .../game/data/stats/items/02500-02599.xml | 18 + .../game/data/stats/items/05200-05299.xml | 7 + .../game/data/stats/items/05700-05799.xml | 14 + .../game/data/stats/items/07800-07899.xml | 36 ++ .../game/data/stats/items/07900-07999.xml | 9 + .../game/data/stats/items/08600-08699.xml | 97 ++++ .../game/data/stats/items/08900-08999.xml | 7 + .../game/data/stats/items/91800-91899.xml | 27 ++ .../game/data/stats/items/91900-91999.xml | 27 ++ .../game/data/stats/items/92400-92499.xml | 42 ++ .../game/data/stats/items/92900-92999.xml | 9 + .../game/data/stats/items/93800-93899.xml | 6 + .../game/data/stats/items/94100-94199.xml | 2 +- .../game/data/stats/items/94200-94299.xml | 2 +- .../game/data/stats/skills/50300-50399.xml | 120 ++++- .../game/data/stats/skills/50400-50499.xml | 415 +++++++++++++++--- .../java/org/l2jmobius/Config.java | 2 + .../gameserver/enums/ItemListType.java | 3 +- .../gameserver/enums/ItemSkillType.java | 1 + .../l2jmobius/gameserver/model/ItemInfo.java | 10 +- .../l2jmobius/gameserver/model/TradeItem.java | 8 + .../actor/request/BlessingItemRequest.java | 73 +++ .../model/itemcontainer/Inventory.java | 216 +++++++-- .../gameserver/model/items/WarehouseItem.java | 7 + .../model/items/instance/ItemInstance.java | 24 + .../model/variables/ItemVariables.java | 1 + .../model/variables/PlayerVariables.java | 1 + .../gameserver/network/ExIncomingPackets.java | 9 +- .../blessing/RequestBlessOptionCancel.java | 48 ++ .../blessing/RequestBlessOptionEnchant.java | 188 ++++++++ .../blessing/RequestBlessOptionPutItem.java | 72 +++ .../serverpackets/AbstractItemPacket.java | 19 +- .../blessing/ExBlessOptionCancel.java | 43 ++ .../blessing/ExBlessOptionEnchant.java | 42 ++ .../blessing/ExBlessOptionPutItem.java | 43 ++ .../blessing/ExOpenBlessOptionScroll.java | 42 ++ 44 files changed, 1757 insertions(+), 145 deletions(-) create mode 100644 L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/scripts/handlers/itemhandlers/BlessingScrolls.java create mode 100644 L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/actor/request/BlessingItemRequest.java create mode 100644 L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/clientpackets/blessing/RequestBlessOptionCancel.java create mode 100644 L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/clientpackets/blessing/RequestBlessOptionEnchant.java create mode 100644 L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/clientpackets/blessing/RequestBlessOptionPutItem.java create mode 100644 L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/serverpackets/blessing/ExBlessOptionCancel.java create mode 100644 L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/serverpackets/blessing/ExBlessOptionEnchant.java create mode 100644 L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/serverpackets/blessing/ExBlessOptionPutItem.java create mode 100644 L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/serverpackets/blessing/ExOpenBlessOptionScroll.java diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/config/Rates.ini b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/config/Rates.ini index 001f2cf624..55b2cb86b7 100644 --- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/config/Rates.ini +++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/config/Rates.ini @@ -201,3 +201,11 @@ KarmaRateDropEquipWeapon = 10 PetXpRate = 1 PetFoodRate = 1 SinEaterXpRate = 1 + + +# --------------------------------------------------------------------------- +# Blessed items +# --------------------------------------------------------------------------- +# Chance of blessing weapon. +# Default: 15.0 +BlessingChance = 15.0 diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/EnchantItemData.xml b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/EnchantItemData.xml index 62bc955602..7138bb1b3a 100644 --- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/EnchantItemData.xml +++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/EnchantItemData.xml @@ -213,22 +213,6 @@ - - - - - - - - - - - - - - - - diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/scripts/handlers/MasterHandler.java b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/scripts/handlers/MasterHandler.java index 32d94019d0..f761f435f9 100644 --- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/scripts/handlers/MasterHandler.java +++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/scripts/handlers/MasterHandler.java @@ -191,6 +191,7 @@ import handlers.itemhandlers.BeastSoulShot; import handlers.itemhandlers.BeastSpiritShot; import handlers.itemhandlers.BlessedSoulShots; import handlers.itemhandlers.BlessedSpiritShot; +import handlers.itemhandlers.BlessingScrolls; import handlers.itemhandlers.Book; import handlers.itemhandlers.Bypass; import handlers.itemhandlers.Calculator; @@ -541,6 +542,7 @@ public class MasterHandler BeastSpiritShot.class, BlessedSoulShots.class, BlessedSpiritShot.class, + BlessingScrolls.class, Book.class, Bypass.class, Calculator.class, diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/scripts/handlers/itemhandlers/BlessingScrolls.java b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/scripts/handlers/itemhandlers/BlessingScrolls.java new file mode 100644 index 0000000000..ca8b6cd5b2 --- /dev/null +++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/scripts/handlers/itemhandlers/BlessingScrolls.java @@ -0,0 +1,55 @@ +/* + * 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 handlers.itemhandlers; + +import org.l2jmobius.gameserver.handler.IItemHandler; +import org.l2jmobius.gameserver.model.actor.Playable; +import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import org.l2jmobius.gameserver.model.items.instance.ItemInstance; +import org.l2jmobius.gameserver.model.variables.PlayerVariables; +import org.l2jmobius.gameserver.network.SystemMessageId; +import org.l2jmobius.gameserver.network.serverpackets.blessing.ExOpenBlessOptionScroll; + +public class BlessingScrolls implements IItemHandler +{ + @Override + public boolean useItem(Playable playable, ItemInstance item, boolean forceUse) + { + if (!playable.isPlayer()) + { + playable.sendPacket(SystemMessageId.YOUR_PET_CANNOT_CARRY_THIS_ITEM); + return false; + } + + final PlayerInstance player = playable.getActingPlayer(); + if (player.isCastingNow()) + { + return false; + } + + if (player.hasItemRequest()) + { + player.sendPacket(SystemMessageId.ANOTHER_ENCHANTMENT_IS_IN_PROGRESS_PLEASE_COMPLETE_THE_PREVIOUS_TASK_THEN_TRY_AGAIN); + return false; + } + + player.getVariables().set(PlayerVariables.USED_BLESS_SCROLL_ID, item.getId()); + + player.sendPacket(new ExOpenBlessOptionScroll(item.getId())); + return true; + } +} diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/stats/items/00000-00099.xml b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/stats/items/00000-00099.xml index 34d39ccbc5..58e88b6185 100644 --- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/stats/items/00000-00099.xml +++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/stats/items/00000-00099.xml @@ -1436,6 +1436,15 @@ 10 40 + + + + + + + + + @@ -1463,6 +1472,15 @@ 10 40 + + + + + + + + + @@ -1875,6 +1893,13 @@ + + + + + + + 213 diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/stats/items/00100-00199.xml b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/stats/items/00100-00199.xml index 41dec91cd9..01bec156fa 100644 --- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/stats/items/00100-00199.xml +++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/stats/items/00100-00199.xml @@ -861,6 +861,15 @@ 10 40 + + + + + + + + + @@ -888,6 +897,15 @@ 10 40 + + + + + + + + + @@ -1200,6 +1218,15 @@ 19 40 + + + + + + + + + diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/stats/items/00200-00299.xml b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/stats/items/00200-00299.xml index 0bbf602a5a..d66d2db2e0 100644 --- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/stats/items/00200-00299.xml +++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/stats/items/00200-00299.xml @@ -363,6 +363,15 @@ 19 40 + + + + + + + + + @@ -391,6 +400,15 @@ 19 40 + + + + + + + + + @@ -943,6 +961,15 @@ 5 40 + + + + + + + + + @@ -970,6 +997,15 @@ 5 40 + + + + + + + + + @@ -1734,6 +1770,15 @@ 5 40 + + + + + + + + + @@ -1761,6 +1806,15 @@ 5 40 + + + + + + + + + @@ -2271,6 +2325,15 @@ 5 500 + + + + + + + + + @@ -2300,6 +2363,15 @@ 5 500 + + + + + + + + + diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/stats/items/00300-00399.xml b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/stats/items/00300-00399.xml index d8f093605c..6a108b1171 100644 --- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/stats/items/00300-00399.xml +++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/stats/items/00300-00399.xml @@ -139,6 +139,13 @@ + + + + + + + 232 diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/stats/items/02500-02599.xml b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/stats/items/02500-02599.xml index 3ba83a3c57..5071b662ea 100644 --- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/stats/items/02500-02599.xml +++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/stats/items/02500-02599.xml @@ -26,6 +26,15 @@ 10 40 + + + + + + + + + @@ -131,6 +140,15 @@ 19 40 + + + + + + + + + diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/stats/items/05200-05299.xml b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/stats/items/05200-05299.xml index 30c30d0936..e4081b07e1 100644 --- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/stats/items/05200-05299.xml +++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/stats/items/05200-05299.xml @@ -289,6 +289,13 @@ + + + + + + + 259 diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/stats/items/05700-05799.xml b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/stats/items/05700-05799.xml index 2fe02a6223..8a3f6c452a 100644 --- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/stats/items/05700-05799.xml +++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/stats/items/05700-05799.xml @@ -37,6 +37,13 @@ + + + + + + + 275 @@ -67,6 +74,13 @@ + + + + + + + 282 diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/stats/items/07800-07899.xml b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/stats/items/07800-07899.xml index bc9a9a4d1f..e8cf2dd749 100644 --- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/stats/items/07800-07899.xml +++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/stats/items/07800-07899.xml @@ -532,6 +532,15 @@ 10 40 + + + + + + + + + @@ -807,6 +816,15 @@ 19 40 + + + + + + + + + @@ -835,6 +853,15 @@ 19 40 + + + + + + + + + @@ -943,5 +970,14 @@ 19 40 + + + + + + + + + diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/stats/items/07900-07999.xml b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/stats/items/07900-07999.xml index 6377fbe398..f1e5380308 100644 --- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/stats/items/07900-07999.xml +++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/stats/items/07900-07999.xml @@ -80,5 +80,14 @@ 19 40 + + + + + + + + + diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/stats/items/08600-08699.xml b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/stats/items/08600-08699.xml index 3f68003bb7..9232a8c1dc 100644 --- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/stats/items/08600-08699.xml +++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/stats/items/08600-08699.xml @@ -90,6 +90,15 @@ 10 40 + + + + + + + + + @@ -117,6 +126,15 @@ 10 40 + + + + + + + + + @@ -144,6 +162,15 @@ 19 40 + + + + + + + + + @@ -171,6 +198,15 @@ 19 40 + + + + + + + + + @@ -198,6 +234,15 @@ 5 40 + + + + + + + + + @@ -218,6 +263,13 @@ + + + + + + + 251 @@ -258,6 +310,15 @@ 5 500 + + + + + + + + + @@ -285,6 +346,15 @@ 5 40 + + + + + + + + + @@ -312,6 +382,15 @@ 10 40 + + + + + + + + + @@ -340,6 +419,15 @@ 19 40 + + + + + + + + + @@ -368,6 +456,15 @@ 19 40 + + + + + + + + + diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/stats/items/08900-08999.xml b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/stats/items/08900-08999.xml index 47d8b54038..ab9e2b3b09 100644 --- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/stats/items/08900-08999.xml +++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/stats/items/08900-08999.xml @@ -20,6 +20,13 @@ + + + + + + + 305 diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/stats/items/91800-91899.xml b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/stats/items/91800-91899.xml index 7d56bb9730..4dbb18b847 100644 --- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/stats/items/91800-91899.xml +++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/stats/items/91800-91899.xml @@ -1182,6 +1182,15 @@ 15 40 + + + + + + + + + @@ -1205,6 +1214,15 @@ 15 40 + + + + + + + + + @@ -1228,6 +1246,15 @@ 15 40 + + + + + + + + + diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/stats/items/91900-91999.xml b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/stats/items/91900-91999.xml index bd99234c73..c92a8ee817 100644 --- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/stats/items/91900-91999.xml +++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/stats/items/91900-91999.xml @@ -65,6 +65,15 @@ 406 19 + + + + + + + + + @@ -87,6 +96,15 @@ 406 19 + + + + + + + + + @@ -109,6 +127,15 @@ 406 19 + + + + + + + + + diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/stats/items/92400-92499.xml b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/stats/items/92400-92499.xml index dc319bda1d..196a8e5aef 100644 --- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/stats/items/92400-92499.xml +++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/stats/items/92400-92499.xml @@ -89,6 +89,13 @@ + + + + + + + @@ -114,6 +121,13 @@ + + + + + + + @@ -138,6 +152,13 @@ + + + + + + + @@ -162,6 +183,13 @@ + + + + + + + @@ -186,6 +214,13 @@ + + + + + + + @@ -326,6 +361,13 @@ + + + + + + + diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/stats/items/92900-92999.xml b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/stats/items/92900-92999.xml index 7ce44beb7d..bd8a93c3f1 100644 --- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/stats/items/92900-92999.xml +++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/stats/items/92900-92999.xml @@ -350,6 +350,15 @@ 40 10 + + + + + + + + + diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/stats/items/93800-93899.xml b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/stats/items/93800-93899.xml index ffe7241f6f..2a9a5ff067 100644 --- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/stats/items/93800-93899.xml +++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/stats/items/93800-93899.xml @@ -898,6 +898,12 @@ 40 10 + + + + + + diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/stats/items/94100-94199.xml b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/stats/items/94100-94199.xml index a32a1f93f6..28bf16fba3 100644 --- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/stats/items/94100-94199.xml +++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/stats/items/94100-94199.xml @@ -1005,7 +1005,7 @@ - + diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/stats/items/94200-94299.xml b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/stats/items/94200-94299.xml index 97640df8c3..d2f1e6d9bb 100644 --- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/stats/items/94200-94299.xml +++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/stats/items/94200-94299.xml @@ -92,7 +92,7 @@ - + diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/stats/skills/50300-50399.xml b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/stats/skills/50300-50399.xml index 862ba61d03..c968845797 100644 --- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/stats/skills/50300-50399.xml +++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/stats/skills/50300-50399.xml @@ -3551,42 +3551,130 @@ - icon.skill0000 - A1 + icon.bless_effect_base + P + 5 + 1 + + + 2 + PER + + + 2 + PER + + - icon.skill0000 - A1 + icon.bless_effect_base + P + 5 + 1 + + + 2 + PER + + + 2 + PER + + - icon.skill0000 - A1 + icon.bless_effect_base + P + 5 + 1 + + + 2 + PER + + + 2 + PER + + - icon.skill0000 - A1 + icon.bless_effect_base + P + 5 + 1 + + + 20 + DIFF + + - icon.skill0000 - A1 + icon.bless_effect_base + P + 5 + 1 + + + 20 + DIFF + + - icon.skill0000 - A1 + icon.bless_effect_base + P + 5 + 1 + + + 1 + PER + + + 1 + PER + + - icon.skill0000 - A1 + icon.bless_effect_base + P + 5 + 1 + + + 1 + PER + + + 1 + PER + + - icon.skill0000 - A1 + icon.bless_effect_base + P + 5 + 1 + + + 30 + DIFF + + + 30 + DIFF + + diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/stats/skills/50400-50499.xml b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/stats/skills/50400-50499.xml index 999874d60d..8010aa6343 100644 --- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/stats/skills/50400-50499.xml +++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/stats/skills/50400-50499.xml @@ -2,138 +2,445 @@ - icon.skill0000 - A1 + icon.bless_effect_base + P + 5 + 1 + + + 30 + DIFF + + + 30 + DIFF + + - icon.skill0000 - A1 + icon.bless_effect_base + P + 5 + 1 + + + - icon.skill0000 - A1 + icon.bless_effect_base + P + 5 + 1 + + + 5 + PER + + - icon.skill0000 - A1 + icon.bless_effect_base + P + 5 + 1 + + + 50 + DIFF + + - icon.skill0000 - A1 + icon.bless_effect_base + P + 5 + 1 + + + 50 + DIFF + + - icon.skill0000 - A1 + icon.bless_effect_base + P + 5 + 1 + + + 20 + DIFF + + + 1 + DIFF + + - icon.skill0000 - A1 + icon.bless_effect_enchant + P + 5 + 1 + + + 15 + + - icon.skill0000 - A1 + icon.bless_effect_enchant + P + 5 + 1 + + + 90 + DIFF + + + 110 + DIFF + + - icon.skill0000 - A1 + icon.bless_effect_enchant + P + 5 + 1 + + + 4 + PER + + + 4 + DIFF + + - icon.skill0000 - A1 + icon.bless_effect_enchant + P + 5 + 1 + + + 4 + PER + + + 4 + PER + + - icon.skill0000 - A1 + icon.bless_effect_enchant + P + 5 + 1 + + + 80 + DIFF + + + 80 + DIFF + + + 80 + DIFF + + + 550 + DIFF + + - icon.skill0000 - A1 + icon.bless_effect_enchant + P + 5 + 1 + + + 10 + PER + + - icon.skill0000 - A1 + icon.bless_effect_enchant + P + 5 + 1 + + + 20 + + - icon.skill0000 - A1 + icon.bless_effect_enchant + P + 5 + 1 + + + 130 + DIFF + + + 170 + DIFF + + - icon.skill0000 - A1 + icon.bless_effect_enchant + P + 5 + 1 + + + 5 + PER + + + 5 + DIFF + + - icon.skill0000 - A1 + icon.bless_effect_enchant + P + 5 + 1 + + + 5 + PER + + + 5 + PER + + - icon.skill0000 - A1 + icon.bless_effect_enchant + P + 5 + 1 + + + 150 + DIFF + + + 150 + DIFF + + + 150 + DIFF + + + 550 + DIFF + + - icon.skill0000 - A1 + icon.bless_effect_enchant + P + 5 + 1 + + + 15 + PER + + - icon.skill0000 - A1 + icon.bless_effect_enchant + P + 5 + 1 + + + 15 + PER + + + 15 + PER + + - icon.skill0000 - A1 + icon.bless_effect_enchant + P + 5 + 1 + + + 200 + DIFF + + + 200 + DIFF + + + 200 + DIFF + + + 550 + DIFF + + - icon.skill0000 - A1 + icon.bless_effect_enchant + P + 5 + 1 + + + 20 + PER + + - icon.skill0000 - A1 + icon.bless_effect_enchant + P + 5 + 1 + + + 200 + DIFF + + + 250 + DIFF + + - icon.skill0000 - A1 + icon.bless_effect_enchant + P + 5 + 1 + + + 10 + PER + + + 10 + DIFF + + - icon.skill0000 - A1 + icon.bless_effect_enchant + P + 5 + 1 + + + 10 + PER + + + 10 + PER + + - icon.skill0000 - A1 + icon.bless_effect_enchant + P + 5 + 1 + + + 400 + DIFF + + + 600 + DIFF + + - icon.skill0000 - A1 + icon.bless_effect_enchant + P + 5 + 1 + + + 15 + PER + + + 15 + DIFF + + - icon.skill0000 - A1 + icon.bless_effect_enchant + P + 5 + 1 + + + 15 + PER + + + 15 + PER + + diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/Config.java b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/Config.java index c5385f2468..713979b599 100644 --- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/Config.java +++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/Config.java @@ -738,6 +738,7 @@ public class Config public static int DROP_ITEM_MIN_LEVEL_DIFFERENCE; public static int DROP_ITEM_MAX_LEVEL_DIFFERENCE; public static double DROP_ITEM_MIN_LEVEL_GAP_CHANCE; + public static double BLESSING_CHANCE; public static float RATE_KARMA_LOST; public static float RATE_KARMA_EXP_LOST; public static float RATE_SIEGE_GUARDS_PRICE; @@ -2326,6 +2327,7 @@ public class Config DROP_ITEM_MIN_LEVEL_DIFFERENCE = RatesSettings.getInt("DropItemMinLevelDifference", 5); DROP_ITEM_MAX_LEVEL_DIFFERENCE = RatesSettings.getInt("DropItemMaxLevelDifference", 10); DROP_ITEM_MIN_LEVEL_GAP_CHANCE = RatesSettings.getDouble("DropItemMinLevelGapChance", 10); + BLESSING_CHANCE = RatesSettings.getDouble("BlessingChance", 15.0); // Load PvP config file (if exists) final PropertiesParser PVPSettings = new PropertiesParser(PVP_CONFIG_FILE); diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/enums/ItemListType.java b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/enums/ItemListType.java index 2d38c8f5b1..e179630ccc 100644 --- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/enums/ItemListType.java +++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/enums/ItemListType.java @@ -27,7 +27,8 @@ public enum ItemListType implements IUpdateTypeComponent ELEMENTAL_ATTRIBUTE(0x02), ENCHANT_EFFECT(0x04), VISUAL_ID(0x08), - SOUL_CRYSTAL(0x10); + SOUL_CRYSTAL(0x10), + BLESSED(0x100); private final int _mask; diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/enums/ItemSkillType.java b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/enums/ItemSkillType.java index ed2662492c..d95931d0dd 100644 --- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/enums/ItemSkillType.java +++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/enums/ItemSkillType.java @@ -23,6 +23,7 @@ public enum ItemSkillType { NORMAL, ON_ENCHANT, + ON_BLESSING, ON_EQUIP, ON_UNEQUIP, ON_CRITICAL_SKILL, diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/ItemInfo.java b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/ItemInfo.java index 16f3dfe23e..194b7d7087 100644 --- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/ItemInfo.java +++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/ItemInfo.java @@ -64,7 +64,7 @@ public class ItemInfo /** The mana of this item */ private int _mana; private int _time; - + private boolean _isBlessed = false; private boolean _available = true; private int _location; @@ -148,6 +148,7 @@ public class ItemInfo { _attributeDefence[type.getClientId()] = item.getDefenceAttribute(type); } + _isBlessed = item.isBlessed(); _option = item.getEnchantOptions(); _soulCrystalOptions = item.getSpecialAbilities(); _soulCrystalSpecialOptions = item.getAdditionalSpecialAbilities(); @@ -212,6 +213,7 @@ public class ItemInfo _soulCrystalOptions = item.getSoulCrystalOptions(); _soulCrystalSpecialOptions = item.getSoulCrystalSpecialOptions(); _visualId = item.getVisualId(); + _isBlessed = item.isBlessed(); } public ItemInfo(Product item) @@ -296,6 +298,7 @@ public class ItemInfo _option = item.getEnchantOptions(); _soulCrystalOptions = item.getSoulCrystalOptions(); _soulCrystalSpecialOptions = item.getSoulCrystalSpecialOptions(); + _isBlessed = item.isBlessed(); } public int getObjectId() @@ -408,6 +411,11 @@ public class ItemInfo return _visualExpiration; } + public boolean isBlessed() + { + return _isBlessed; + } + @Override public String toString() { diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/TradeItem.java b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/TradeItem.java index 83ed3c9225..968c167303 100644 --- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/TradeItem.java +++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/TradeItem.java @@ -53,6 +53,7 @@ public class TradeItem private int _visualId; private int _augmentationOption1 = -1; private int _augmentationOption2 = -1; + private boolean _isBlessed = false; public TradeItem(ItemInstance item, long count, long price) { @@ -75,6 +76,7 @@ public class TradeItem _soulCrystalOptions = item.getSpecialAbilities(); _soulCrystalSpecialOptions = item.getAdditionalSpecialAbilities(); _visualId = item.getVisualId(); + _isBlessed = item.isBlessed(); if (item.getAugmentation() != null) { _augmentationOption1 = item.getAugmentation().getOption1Id(); @@ -123,6 +125,7 @@ public class TradeItem _soulCrystalOptions = item.getSoulCrystalOptions(); _soulCrystalSpecialOptions = item.getSoulCrystalSpecialOptions(); _visualId = item.getVisualId(); + _isBlessed = item.isBlessed(); } public void setObjectId(int objectId) @@ -270,4 +273,9 @@ public class TradeItem { return _visualId; } + + public boolean isBlessed() + { + return _isBlessed; + } } diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/actor/request/BlessingItemRequest.java b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/actor/request/BlessingItemRequest.java new file mode 100644 index 0000000000..a267409bb2 --- /dev/null +++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/actor/request/BlessingItemRequest.java @@ -0,0 +1,73 @@ +/* + * 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.actor.instance.PlayerInstance; +import org.l2jmobius.gameserver.model.items.instance.ItemInstance; + +/** + * @author Horus + */ +public class BlessingItemRequest extends AbstractRequest +{ + private volatile int _blessingItemObjectId; + private volatile int _blessingScrollObjectId; + + public BlessingItemRequest(PlayerInstance player, int enchantingScrollObjectId) + { + super(player); + _blessingScrollObjectId = enchantingScrollObjectId; + } + + public ItemInstance getBlessingItem() + { + return getActiveChar().getInventory().getItemByObjectId(_blessingItemObjectId); + } + + public void setBlessingItem(int objectId) + { + _blessingItemObjectId = objectId; + } + + public ItemInstance getBlessScroll() + { + return getActiveChar().getInventory().getItemByObjectId(_blessingScrollObjectId); + } + + public void setBlessScroll(int objectId) + { + _blessingScrollObjectId = objectId; + } + + @Override + public boolean isItemRequest() + { + return true; + } + + @Override + public boolean canWorkWith(AbstractRequest request) + { + return !request.isItemRequest(); + } + + @Override + public boolean isUsing(int objectId) + { + return (objectId > 0) && ((objectId == _blessingItemObjectId) || (objectId == _blessingScrollObjectId)); + } +} diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/itemcontainer/Inventory.java b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/itemcontainer/Inventory.java index 7b026c15e1..4cb266ff67 100644 --- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/itemcontainer/Inventory.java +++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/itemcontainer/Inventory.java @@ -365,6 +365,23 @@ public abstract class Inventory extends ItemContainer } } + if (item.isBlessed()) + { + final List onBlessingSkills = it.getSkills(ItemSkillType.ON_BLESSING); + if (onBlessingSkills != null) + { + for (ItemSkillHolder holder : onBlessingSkills) + { + final Skill skill = holder.getSkill(); + if (skill != null) + { + removedSkills.putIfAbsent(skill.getId(), skill); + update = true; + } + } + } + } + final List normalSkills = it.getSkills(ItemSkillType.NORMAL); if (normalSkills != null) { @@ -445,29 +462,52 @@ public abstract class Inventory extends ItemContainer } final List otherEnchantSkills = equipped.getItem().getSkills(ItemSkillType.ON_ENCHANT); - if (otherEnchantSkills == null) + final List otherBlessingSkills = equipped.getItem().getSkills(ItemSkillType.ON_BLESSING); + if ((otherEnchantSkills == null) && (otherBlessingSkills == null)) { continue; } - for (ItemSkillHolder holder : otherEnchantSkills) + if (otherEnchantSkills != null) { - if (equipped.getEnchantLevel() < holder.getValue()) + for (ItemSkillHolder holder : otherEnchantSkills) { - continue; + if (equipped.getEnchantLevel() < holder.getValue()) + { + continue; + } + + final Skill skill = holder.getSkill(); + if (skill == null) + { + continue; + } + + // Check passive skill conditions. + if (skill.isPassive() && !skill.checkConditions(SkillConditionScope.PASSIVE, player, player)) + { + removedSkills.putIfAbsent(skill.getId(), skill); + update = true; + } } - - final Skill skill = holder.getSkill(); - if (skill == null) + } + + if ((otherBlessingSkills != null) && equipped.isBlessed()) + { + for (ItemSkillHolder holder : otherBlessingSkills) { - continue; - } - - // Check passive skill conditions. - if (skill.isPassive() && !skill.checkConditions(SkillConditionScope.PASSIVE, player, player)) - { - removedSkills.putIfAbsent(skill.getId(), skill); - update = true; + final Skill skill = holder.getSkill(); + if (skill == null) + { + continue; + } + + // Check passive skill conditions. + if (skill.isPassive() && !skill.checkConditions(SkillConditionScope.PASSIVE, player, player)) + { + removedSkills.putIfAbsent(skill.getId(), skill); + update = true; + } } } } @@ -586,6 +626,51 @@ public abstract class Inventory extends ItemContainer } } + if (item.isBlessed()) + { + final List onBlessingSkills = item.getItem().getSkills(ItemSkillType.ON_BLESSING); + if (onBlessingSkills != null) + { + for (ItemSkillHolder holder : onBlessingSkills) + { + if (player.getSkillLevel(holder.getSkillId()) >= holder.getSkillLevel()) + { + continue; + } + + if (item.getEnchantLevel() < holder.getValue()) + { + continue; + } + + final Skill skill = holder.getSkill(); + if (skill == null) + { + continue; + } + + // Check passive skill conditions. + if (skill.isPassive() && !skill.checkConditions(SkillConditionScope.PASSIVE, player, player)) + { + continue; + } + + final Skill existingSkill = addedSkills.get(skill.getId()); + if (existingSkill != null) + { + if (existingSkill.getLevel() < skill.getLevel()) + { + addedSkills.put(skill.getId(), skill); + } + } + else + { + addedSkills.put(skill.getId(), skill); + } + } + } + } + final List normalSkills = item.getItem().getSkills(ItemSkillType.NORMAL); if (normalSkills != null) { @@ -644,46 +729,89 @@ public abstract class Inventory extends ItemContainer } final List otherEnchantSkills = equipped.getItem().getSkills(ItemSkillType.ON_ENCHANT); - if (otherEnchantSkills == null) + final List otherBlessingSkills = equipped.getItem().getSkills(ItemSkillType.ON_BLESSING); + if ((otherEnchantSkills == null) && (otherBlessingSkills == null)) { continue; } - for (ItemSkillHolder holder : otherEnchantSkills) + if (otherEnchantSkills != null) { - if (player.getSkillLevel(holder.getSkillId()) >= holder.getSkillLevel()) + for (ItemSkillHolder holder : otherEnchantSkills) { - continue; - } - - if (equipped.getEnchantLevel() < holder.getValue()) - { - continue; - } - - final Skill skill = holder.getSkill(); - if (skill == null) - { - continue; - } - - // Check passive skill conditions. - if (skill.isPassive() && !skill.checkConditions(SkillConditionScope.PASSIVE, player, player)) - { - continue; - } - - final Skill existingSkill = addedSkills.get(skill.getId()); - if (existingSkill != null) - { - if (existingSkill.getLevel() < skill.getLevel()) + if (player.getSkillLevel(holder.getSkillId()) >= holder.getSkillLevel()) + { + continue; + } + + if (equipped.getEnchantLevel() < holder.getValue()) + { + continue; + } + + final Skill skill = holder.getSkill(); + if (skill == null) + { + continue; + } + + // Check passive skill conditions. + if (skill.isPassive() && !skill.checkConditions(SkillConditionScope.PASSIVE, player, player)) + { + continue; + } + + final Skill existingSkill = addedSkills.get(skill.getId()); + if (existingSkill != null) + { + if (existingSkill.getLevel() < skill.getLevel()) + { + addedSkills.put(skill.getId(), skill); + } + } + else { addedSkills.put(skill.getId(), skill); } } - else + } + + if (otherBlessingSkills != null) + { + for (ItemSkillHolder holder : otherBlessingSkills) { - addedSkills.put(skill.getId(), skill); + if (player.getSkillLevel(holder.getSkillId()) >= holder.getSkillLevel()) + { + continue; + } + + if (equipped.isBlessed()) + { + final Skill skill = holder.getSkill(); + if (skill == null) + { + continue; + } + + // Check passive skill conditions. + if (skill.isPassive() && !skill.checkConditions(SkillConditionScope.PASSIVE, player, player)) + { + continue; + } + + final Skill existingSkill = addedSkills.get(skill.getId()); + if (existingSkill != null) + { + if (existingSkill.getLevel() < skill.getLevel()) + { + addedSkills.put(skill.getId(), skill); + } + } + else + { + addedSkills.put(skill.getId(), skill); + } + } } } } diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/items/WarehouseItem.java b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/items/WarehouseItem.java index bf2b368ddb..f63fd0092c 100644 --- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/items/WarehouseItem.java +++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/items/WarehouseItem.java @@ -68,6 +68,7 @@ public class WarehouseItem private final Collection _soulCrystalSpecialOptions; private final int _time; + private final boolean _isBlessed; public WarehouseItem(ItemInstance item) { @@ -93,6 +94,7 @@ public class WarehouseItem _enchantOptions = item.getEnchantOptions(); _soulCrystalOptions = item.getSpecialAbilities(); _soulCrystalSpecialOptions = item.getAdditionalSpecialAbilities(); + _isBlessed = item.isBlessed(); } /** @@ -289,6 +291,11 @@ public class WarehouseItem return _time; } + public boolean isBlessed() + { + return _isBlessed; + } + /** * @return the name of the item */ diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/items/instance/ItemInstance.java b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/items/instance/ItemInstance.java index 3269c057ee..705fbef1a9 100644 --- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/items/instance/ItemInstance.java +++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/items/instance/ItemInstance.java @@ -182,6 +182,7 @@ public class ItemInstance extends WorldObject private final List _enchantOptions = new ArrayList<>(); private final EnsoulOption[] _ensoulOptions = new EnsoulOption[2]; private final EnsoulOption[] _ensoulSpecialOptions = new EnsoulOption[1]; + private boolean _isBlessed = false; /** * Constructor of the ItemInstance from the objectId and the itemId. @@ -256,6 +257,8 @@ public class ItemInstance extends WorldObject restoreAttributes(); restoreSpecialAbilities(); } + + _isBlessed = getVariables().getBoolean(ItemVariables.BLESSED, false); } /** @@ -2544,4 +2547,25 @@ public class ItemInstance extends WorldObject } } } + + public boolean isBlessed() + { + return _isBlessed; + } + + public void setBlessed(boolean blessed) + { + _isBlessed = blessed; + + final ItemVariables vars = getVariables(); + if (!blessed) + { + vars.remove(ItemVariables.BLESSED); + } + else + { + vars.set(ItemVariables.BLESSED, true); + } + vars.storeMe(); + } } diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/variables/ItemVariables.java b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/variables/ItemVariables.java index a449b0bcc8..f8ccfa4970 100644 --- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/variables/ItemVariables.java +++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/variables/ItemVariables.java @@ -45,6 +45,7 @@ public class ItemVariables extends AbstractVariables public static final String VISUAL_ID = "visualId"; public static final String VISUAL_APPEARANCE_STONE_ID = "visualAppearanceStoneId"; public static final String VISUAL_APPEARANCE_LIFE_TIME = "visualAppearanceLifetime"; + public static final String BLESSED = "blessed"; public ItemVariables(int objectId) { diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/variables/PlayerVariables.java b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/variables/PlayerVariables.java index a384d2efb7..1b868b8b97 100644 --- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/variables/PlayerVariables.java +++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/variables/PlayerVariables.java @@ -77,6 +77,7 @@ public class PlayerVariables extends AbstractVariables public static final String STAT_INT = "STAT_INT"; public static final String STAT_WIT = "STAT_WIT"; public static final String STAT_MEN = "STAT_MEN"; + public static final String USED_BLESS_SCROLL_ID = "USED_BLESS_SCROLL_ID"; private final int _objectId; diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/ExIncomingPackets.java b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/ExIncomingPackets.java index 235ff081da..d5a262ea2e 100644 --- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/ExIncomingPackets.java +++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/ExIncomingPackets.java @@ -39,6 +39,9 @@ import org.l2jmobius.gameserver.network.clientpackets.attributechange.RequestCha import org.l2jmobius.gameserver.network.clientpackets.attributechange.SendChangeAttributeTargetItem; import org.l2jmobius.gameserver.network.clientpackets.autoplay.ExAutoPlaySetting; import org.l2jmobius.gameserver.network.clientpackets.autoplay.ExRequestActivateAutoShortcut; +import org.l2jmobius.gameserver.network.clientpackets.blessing.RequestBlessOptionCancel; +import org.l2jmobius.gameserver.network.clientpackets.blessing.RequestBlessOptionEnchant; +import org.l2jmobius.gameserver.network.clientpackets.blessing.RequestBlessOptionPutItem; import org.l2jmobius.gameserver.network.clientpackets.ceremonyofchaos.RequestCancelCuriousHouse; import org.l2jmobius.gameserver.network.clientpackets.ceremonyofchaos.RequestCuriousHouseHtml; import org.l2jmobius.gameserver.network.clientpackets.ceremonyofchaos.RequestJoinCuriousHouse; @@ -579,9 +582,9 @@ public enum ExIncomingPackets implements IIncomingPackets EX_MABLE_GAME_RESET(0x1BC, null, ConnectionState.IN_GAME), EX_MABLE_GAME_CLOSE(0x1BD, null, ConnectionState.IN_GAME), EX_RETURN_TO_ORIGIN(0x1BE, null, ConnectionState.IN_GAME), - EX_BLESS_OPTION_PUT_ITEM(0x1BF, null, ConnectionState.IN_GAME), - EX_BLESS_OPTION_ENCHANT(0x1C0, null, ConnectionState.IN_GAME), - EX_BLESS_OPTION_CANCEL(0x1C1, null, ConnectionState.IN_GAME), + EX_BLESS_OPTION_PUT_ITEM(0x1BF, RequestBlessOptionPutItem::new, ConnectionState.IN_GAME), + EX_BLESS_OPTION_ENCHANT(0x1C0, RequestBlessOptionEnchant::new, ConnectionState.IN_GAME), + EX_BLESS_OPTION_CANCEL(0x1C1, RequestBlessOptionCancel::new, ConnectionState.IN_GAME), EX_PVP_RANKING_MY_INFO(0x1C2, null, ConnectionState.IN_GAME), EX_PVP_RANKING_LIST(0x1C3, null, ConnectionState.IN_GAME), EX_ACQUIRE_PET_SKILL(0x1C4, null, ConnectionState.IN_GAME), diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/clientpackets/blessing/RequestBlessOptionCancel.java b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/clientpackets/blessing/RequestBlessOptionCancel.java new file mode 100644 index 0000000000..e314be1e4d --- /dev/null +++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/clientpackets/blessing/RequestBlessOptionCancel.java @@ -0,0 +1,48 @@ +/* + * 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.blessing; + +import org.l2jmobius.commons.network.PacketReader; +import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import org.l2jmobius.gameserver.network.GameClient; +import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket; +import org.l2jmobius.gameserver.network.serverpackets.blessing.ExBlessOptionCancel; + +/** + * Written by Horus, on 17.04.2021 + */ +public class RequestBlessOptionCancel implements IClientIncomingPacket +{ + + @Override + public boolean read(GameClient client, PacketReader packet) + { + return true; + } + + @Override + public void run(GameClient client) + { + final PlayerInstance player = client.getPlayer(); + if (player == null) + { + return; + } + + player.sendPacket(new ExBlessOptionCancel(1)); + } +} diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/clientpackets/blessing/RequestBlessOptionEnchant.java b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/clientpackets/blessing/RequestBlessOptionEnchant.java new file mode 100644 index 0000000000..5ab4177b38 --- /dev/null +++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/clientpackets/blessing/RequestBlessOptionEnchant.java @@ -0,0 +1,188 @@ +/* + * 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.blessing; + +import org.l2jmobius.Config; +import org.l2jmobius.commons.network.PacketReader; +import org.l2jmobius.commons.util.Rnd; +import org.l2jmobius.gameserver.enums.ItemSkillType; +import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import org.l2jmobius.gameserver.model.actor.request.BlessingItemRequest; +import org.l2jmobius.gameserver.model.items.Item; +import org.l2jmobius.gameserver.model.items.instance.ItemInstance; +import org.l2jmobius.gameserver.model.skills.CommonSkill; +import org.l2jmobius.gameserver.model.skills.Skill; +import org.l2jmobius.gameserver.model.variables.PlayerVariables; +import org.l2jmobius.gameserver.network.GameClient; +import org.l2jmobius.gameserver.network.SystemMessageId; +import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket; +import org.l2jmobius.gameserver.network.serverpackets.EnchantResult; +import org.l2jmobius.gameserver.network.serverpackets.ExItemAnnounce; +import org.l2jmobius.gameserver.network.serverpackets.MagicSkillUse; +import org.l2jmobius.gameserver.network.serverpackets.SystemMessage; +import org.l2jmobius.gameserver.network.serverpackets.blessing.ExBlessOptionEnchant; +import org.l2jmobius.gameserver.network.serverpackets.blessing.ExBlessOptionPutItem; +import org.l2jmobius.gameserver.util.Broadcast; +import org.l2jmobius.gameserver.util.Util; + +/** + * Written by Horus, on 17.04.2021 + */ +public class RequestBlessOptionEnchant implements IClientIncomingPacket +{ + private int _itemObjId; + + @Override + public boolean read(GameClient client, PacketReader packet) + { + _itemObjId = packet.readD(); + return true; + } + + @Override + public void run(GameClient client) + { + final PlayerInstance player = client.getPlayer(); + if (player == null) + { + return; + } + + final ItemInstance targetInstance = player.getInventory().getItemByObjectId(_itemObjId); + if (targetInstance == null) + { + player.sendPacket(new ExBlessOptionEnchant(EnchantResult.ERROR)); + return; + } + + ItemInstance targetScroll = player.getInventory().getItemByItemId(player.getVariables().getInt(PlayerVariables.USED_BLESS_SCROLL_ID, 0)); + if (targetScroll == null) + { + targetScroll = player.getInventory().getItemByItemId(94208); // Scroll of Blessing - Event + } + if (targetScroll == null) + { + targetScroll = player.getInventory().getItemByItemId(94184); // Scroll of Blessing + } + if (targetScroll == null) + { + player.sendPacket(new ExBlessOptionEnchant(EnchantResult.ERROR)); + return; + } + + player.addRequest(new BlessingItemRequest(player, targetInstance.getObjectId())); + final BlessingItemRequest request = player.getRequest(BlessingItemRequest.class); + if ((request == null) || request.isProcessing()) + { + player.sendPacket(new ExBlessOptionEnchant(EnchantResult.ERROR)); + return; + } + + request.setBlessingItem(_itemObjId); + request.setProcessing(true); + request.setTimestamp(System.currentTimeMillis()); + + if (!player.isOnline() || client.isDetached()) + { + player.removeRequest(request.getClass()); + return; + } + + if (player.isInStoreMode()) + { + player.sendPacket(SystemMessageId.YOU_CANNOT_ENCHANT_WHILE_OPERATING_A_PRIVATE_STORE_OR_PRIVATE_WORKSHOP); + player.removeRequest(request.getClass()); + player.sendPacket(new ExBlessOptionEnchant(EnchantResult.ERROR)); + return; + } + + final ItemInstance item = request.getBlessingItem(); + if (item == null) + { + player.removeRequest(request.getClass()); + player.sendPacket(new ExBlessOptionEnchant(EnchantResult.ERROR)); + return; + } + + // first validation check - also over enchant check + if (item.isBlessed()) + { + client.sendPacket(SystemMessageId.INAPPROPRIATE_ENCHANT_CONDITIONS); + player.removeRequest(request.getClass()); + player.sendPacket(new ExBlessOptionPutItem(0)); + return; + } + + // attempting to destroy scroll + if (player.getInventory().destroyItem("Blessing", targetScroll.getObjectId(), 1, player, item) == null) + { + client.sendPacket(SystemMessageId.INCORRECT_ITEM_COUNT_2); + Util.handleIllegalPlayerAction(player, "Player " + player.getName() + " tried to bless with a scroll he doesn't have", Config.DEFAULT_PUNISH); + player.removeRequest(request.getClass()); + player.sendPacket(new ExBlessOptionEnchant(EnchantResult.ERROR)); + return; + } + + if (Rnd.get(100) < Config.BLESSING_CHANCE) // Success + { + final Item it = item.getItem(); + // Increase enchant level only if scroll's base template has chance, some armors can success over +20 but they shouldn't have increased. + item.setBlessed(true); + item.updateDatabase(); + player.sendPacket(new ExBlessOptionEnchant(1)); + // Announce the success. + if ((item.getEnchantLevel() >= (item.isArmor() ? Config.MIN_ARMOR_ENCHANT_ANNOUNCE : Config.MIN_WEAPON_ENCHANT_ANNOUNCE)) // + && (item.getEnchantLevel() <= (item.isArmor() ? Config.MAX_ARMOR_ENCHANT_ANNOUNCE : Config.MAX_WEAPON_ENCHANT_ANNOUNCE))) + { + final SystemMessage sm = new SystemMessage(SystemMessageId.C1_HAS_SUCCESSFULLY_ENCHANTED_A_S2_S3); + sm.addString(player.getName()); + sm.addInt(item.getEnchantLevel()); + sm.addItemName(item); + player.broadcastPacket(sm); + Broadcast.toAllOnlinePlayers(new ExItemAnnounce(player, item, ExItemAnnounce.ENCHANT)); + + final Skill skill = CommonSkill.FIREWORK.getSkill(); + if (skill != null) + { + player.broadcastPacket(new MagicSkillUse(player, player, skill.getId(), skill.getLevel(), skill.getHitTime(), skill.getReuseDelay())); + } + } + if (item.isEquipped()) + { + if (item.isArmor()) + { + it.forEachSkill(ItemSkillType.ON_BLESSING, holder -> + { + player.addSkill(holder.getSkill(), false); + player.sendSkillList(); + }); + } + player.broadcastUserInfo(); + } + } + else // Failure. + { + player.sendPacket(new ExBlessOptionEnchant(0)); + } + + player.sendItemList(); + + request.setProcessing(false); + player.removeRequest(request.getClass()); + player.broadcastUserInfo(); + } +} diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/clientpackets/blessing/RequestBlessOptionPutItem.java b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/clientpackets/blessing/RequestBlessOptionPutItem.java new file mode 100644 index 0000000000..5b83e034dd --- /dev/null +++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/clientpackets/blessing/RequestBlessOptionPutItem.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.network.clientpackets.blessing; + +import org.l2jmobius.commons.network.PacketReader; +import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import org.l2jmobius.gameserver.model.items.instance.ItemInstance; +import org.l2jmobius.gameserver.network.GameClient; +import org.l2jmobius.gameserver.network.SystemMessageId; +import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket; +import org.l2jmobius.gameserver.network.serverpackets.blessing.ExBlessOptionPutItem; + +/** + * Written by Horus, on 17.04.2021 + */ +public class RequestBlessOptionPutItem implements IClientIncomingPacket +{ + + private int _objectId; + + @Override + public boolean read(GameClient client, PacketReader packet) + { + _objectId = packet.readD(); + return true; + } + + @Override + public void run(GameClient client) + { + final PlayerInstance player = client.getPlayer(); + if (player == null) + { + return; + } + + final ItemInstance item = player.getInventory().getItemByObjectId(_objectId); + if (item == null) + { + return; + } + if (player.isProcessingTransaction() || player.isInStoreMode()) + { + client.sendPacket(SystemMessageId.YOU_CANNOT_ENCHANT_WHILE_OPERATING_A_PRIVATE_STORE_OR_PRIVATE_WORKSHOP); + return; + } + + // first validation check - also over enchant check + if (item.isBlessed()) + { + client.sendPacket(SystemMessageId.INAPPROPRIATE_ENCHANT_CONDITIONS); + player.sendPacket(new ExBlessOptionPutItem(0)); + return; + } + + player.sendPacket(new ExBlessOptionPutItem(1)); + } +} diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/serverpackets/AbstractItemPacket.java b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/serverpackets/AbstractItemPacket.java index 1b2d3ce29c..242f251d35 100644 --- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/serverpackets/AbstractItemPacket.java +++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/serverpackets/AbstractItemPacket.java @@ -72,8 +72,7 @@ public abstract class AbstractItemPacket extends AbstractMaskPacket. + */ +package org.l2jmobius.gameserver.network.serverpackets.blessing; + +import org.l2jmobius.commons.network.PacketWriter; +import org.l2jmobius.gameserver.network.OutgoingPackets; +import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket; + +/** + * Written by Horus, on 17.04.2021 + */ +public class ExBlessOptionCancel implements IClientOutgoingPacket +{ + + private final int _result; + + public ExBlessOptionCancel(int result) + { + _result = result; + } + + @Override + public boolean write(PacketWriter packet) + { + OutgoingPackets.EX_BLESS_OPTION_CANCEL.writeId(packet); + packet.writeC(_result); + return true; + } +} diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/serverpackets/blessing/ExBlessOptionEnchant.java b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/serverpackets/blessing/ExBlessOptionEnchant.java new file mode 100644 index 0000000000..9a36fe5324 --- /dev/null +++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/serverpackets/blessing/ExBlessOptionEnchant.java @@ -0,0 +1,42 @@ +/* + * 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.blessing; + +import org.l2jmobius.commons.network.PacketWriter; +import org.l2jmobius.gameserver.network.OutgoingPackets; +import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket; + +/** + * Written by Horus, on 17.04.2021 + */ +public class ExBlessOptionEnchant implements IClientOutgoingPacket +{ + private final int _result; + + public ExBlessOptionEnchant(int result) + { + _result = result; + } + + @Override + public boolean write(PacketWriter packet) + { + OutgoingPackets.EX_BLESS_OPTION_ENCHANT.writeId(packet); + packet.writeD(_result); + return true; + } +} diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/serverpackets/blessing/ExBlessOptionPutItem.java b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/serverpackets/blessing/ExBlessOptionPutItem.java new file mode 100644 index 0000000000..b8826be9fe --- /dev/null +++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/serverpackets/blessing/ExBlessOptionPutItem.java @@ -0,0 +1,43 @@ +/* + * 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.blessing; + +import org.l2jmobius.commons.network.PacketWriter; +import org.l2jmobius.gameserver.network.OutgoingPackets; +import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket; + +/** + * Written by Horus, on 17.04.2021 + */ +public class ExBlessOptionPutItem implements IClientOutgoingPacket +{ + + private final int _result; + + public ExBlessOptionPutItem(int result) + { + _result = result; + } + + @Override + public boolean write(PacketWriter packet) + { + OutgoingPackets.EX_BLESS_OPTION_PUT_ITEM.writeId(packet); + packet.writeC(_result); + return true; + } +} diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/serverpackets/blessing/ExOpenBlessOptionScroll.java b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/serverpackets/blessing/ExOpenBlessOptionScroll.java new file mode 100644 index 0000000000..7dcaecb98b --- /dev/null +++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/serverpackets/blessing/ExOpenBlessOptionScroll.java @@ -0,0 +1,42 @@ +/* + * 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.blessing; + +import org.l2jmobius.commons.network.PacketWriter; +import org.l2jmobius.gameserver.network.OutgoingPackets; +import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket; + +/** + * Written by Horus, on 17.04.2021 + */ +public class ExOpenBlessOptionScroll implements IClientOutgoingPacket +{ + private final int _itemId; + + public ExOpenBlessOptionScroll(int itemId) + { + _itemId = itemId; + } + + @Override + public boolean write(PacketWriter packet) + { + OutgoingPackets.EX_OPEN_BLESS_OPTION_SCROLL.writeId(packet); + packet.writeD(_itemId); + return true; + } +}