From b8376dd74e613ef556be0fcc2939648103227f7a Mon Sep 17 00:00:00 2001 From: MobiusDev <8391001+MobiusDevelopment@users.noreply.github.com> Date: Fri, 28 Apr 2017 21:29:48 +0000 Subject: [PATCH] Custom reward item on PvP. --- .../dist/game/config/Custom/PvpRewardItem.ini | 33 +++++++++++++++++++ .../java/com/l2jmobius/Config.java | 25 ++++++++++++++ .../model/actor/instance/L2PcInstance.java | 15 +++++++++ .../dist/game/config/Custom/PvpRewardItem.ini | 33 +++++++++++++++++++ .../java/com/l2jmobius/Config.java | 25 ++++++++++++++ .../model/actor/instance/L2PcInstance.java | 15 +++++++++ 6 files changed, 146 insertions(+) create mode 100644 L2J_Mobius_Helios/dist/game/config/Custom/PvpRewardItem.ini create mode 100644 L2J_Mobius_Underground/dist/game/config/Custom/PvpRewardItem.ini diff --git a/L2J_Mobius_Helios/dist/game/config/Custom/PvpRewardItem.ini b/L2J_Mobius_Helios/dist/game/config/Custom/PvpRewardItem.ini new file mode 100644 index 0000000000..a2bfe52944 --- /dev/null +++ b/L2J_Mobius_Helios/dist/game/config/Custom/PvpRewardItem.ini @@ -0,0 +1,33 @@ +# --------------------------------------------------------------------------- +# PvP/PK Reward Item +# --------------------------------------------------------------------------- + +# Reward item on PvP +RewardPvpItem = False + +# Reward PvP item ID +RewardPvpItemId = 57 + +# Reward PvP item Amount +RewardPvpItemAmount = 1000 + +# Show PvP item reward message? +RewardPvpItemMessage = True + +# Reward item on PK +RewardPkItem = False + +# Reward PK item ID +RewardPkItemId = 57 + +# Reward PK item Amount +RewardPkItemAmount = 500 + +# Show PK item reward message? +RewardPkItemMessage = True + +# Disable rewards in instances. +DisableRewardsInInstances = True + +# Disable rewards in PvP zones. +DisableRewardsInPvpZones = True diff --git a/L2J_Mobius_Helios/java/com/l2jmobius/Config.java b/L2J_Mobius_Helios/java/com/l2jmobius/Config.java index 1e09d88031..c1f8a7533c 100644 --- a/L2J_Mobius_Helios/java/com/l2jmobius/Config.java +++ b/L2J_Mobius_Helios/java/com/l2jmobius/Config.java @@ -122,6 +122,7 @@ public final class Config public static final String CUSTOM_PREMIUM_SYSTEM_CONFIG_FILE = "./config/Custom/PremiumSystem.ini"; public static final String CUSTOM_PRIVATE_STORE_RANGE_CONFIG_FILE = "./config/Custom/PrivateStoreRange.ini"; public static final String CUSTOM_PVP_ANNOUNCE_CONFIG_FILE = "./config/Custom/PvpAnnounce.ini"; + public static final String CUSTOM_PVP_REWARD_ITEM_CONFIG_FILE = "./config/Custom/PvpRewardItem.ini"; public static final String CUSTOM_SAYUNE_FOR_ALL_CONFIG_FILE = "./config/Custom/SayuneForAll.ini"; public static final String CUSTOM_SCREEN_WELCOME_MESSAGE_CONFIG_FILE = "./config/Custom/ScreenWelcomeMessage.ini"; public static final String CUSTOM_SELL_BUFFS_CONFIG_FILE = "./config/Custom/SellBuffs.ini"; @@ -997,6 +998,16 @@ public final class Config public static boolean ANNOUNCE_PK_PVP_NORMAL_MESSAGE; public static String ANNOUNCE_PK_MSG; public static String ANNOUNCE_PVP_MSG; + public static boolean REWARD_PVP_ITEM; + public static int REWARD_PVP_ITEM_ID; + public static int REWARD_PVP_ITEM_AMOUNT; + public static boolean REWARD_PVP_ITEM_MESSAGE; + public static boolean REWARD_PK_ITEM; + public static int REWARD_PK_ITEM_ID; + public static int REWARD_PK_ITEM_AMOUNT; + public static boolean REWARD_PK_ITEM_MESSAGE; + public static boolean DISABLE_REWARDS_IN_INSTANCES; + public static boolean DISABLE_REWARDS_IN_PVP_ZONES; public static boolean CHAT_ADMIN; public static boolean MULTILANG_ENABLE; public static List MULTILANG_ALLOWED = new ArrayList<>(); @@ -2539,6 +2550,20 @@ public final class Config ANNOUNCE_PK_MSG = PvpAnnounce.getString("AnnouncePkMsg", "$killer has slaughtered $target"); ANNOUNCE_PVP_MSG = PvpAnnounce.getString("AnnouncePvpMsg", "$killer has defeated $target"); + // Load PvpRewardItem config file (if exists) + final PropertiesParser PvpRewardItem = new PropertiesParser(CUSTOM_PVP_REWARD_ITEM_CONFIG_FILE); + + REWARD_PVP_ITEM = PvpRewardItem.getBoolean("RewardPvpItem", false); + REWARD_PVP_ITEM_ID = PvpRewardItem.getInt("RewardPvpItemId", 57); + REWARD_PVP_ITEM_AMOUNT = PvpRewardItem.getInt("RewardPvpItemAmount", 1000); + REWARD_PVP_ITEM_MESSAGE = PvpRewardItem.getBoolean("RewardPvpItemMessage", false); + REWARD_PK_ITEM = PvpRewardItem.getBoolean("RewardPkItem", false); + REWARD_PK_ITEM_ID = PvpRewardItem.getInt("RewardPkItemId", 57); + REWARD_PK_ITEM_AMOUNT = PvpRewardItem.getInt("RewardPkItemAmount", 500); + REWARD_PK_ITEM_MESSAGE = PvpRewardItem.getBoolean("RewardPkItemMessage", false); + DISABLE_REWARDS_IN_INSTANCES = PvpRewardItem.getBoolean("DisableRewardsInInstances", true); + DISABLE_REWARDS_IN_PVP_ZONES = PvpRewardItem.getBoolean("DisableRewardsInPvpZones", true); + // Load SayuneForAll config file (if exists) final PropertiesParser SayuneForAll = new PropertiesParser(CUSTOM_SAYUNE_FOR_ALL_CONFIG_FILE); diff --git a/L2J_Mobius_Helios/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java b/L2J_Mobius_Helios/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java index 6d11cbce75..73943ce6d6 100644 --- a/L2J_Mobius_Helios/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java +++ b/L2J_Mobius_Helios/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java @@ -4962,6 +4962,21 @@ public final class L2PcInstance extends L2Playable } } + // pvp/pk item rewards + if (!(Config.DISABLE_REWARDS_IN_INSTANCES && (getInstanceId() != 0)) && // + !(Config.DISABLE_REWARDS_IN_PVP_ZONES && isInsideZone(ZoneId.PVP))) + { + // pvp + if (Config.REWARD_PVP_ITEM && (getPvpFlag() != 0)) + { + pk.addItem("PvP Item Reward", Config.REWARD_PVP_ITEM_ID, Config.REWARD_PVP_ITEM_AMOUNT, this, Config.REWARD_PVP_ITEM_MESSAGE); + } + // pk + if (Config.REWARD_PK_ITEM && (getPvpFlag() == 0)) + { + pk.addItem("PK Item Reward", Config.REWARD_PK_ITEM_ID, Config.REWARD_PK_ITEM_AMOUNT, this, Config.REWARD_PK_ITEM_MESSAGE); + } + } } broadcastStatusUpdate(); diff --git a/L2J_Mobius_Underground/dist/game/config/Custom/PvpRewardItem.ini b/L2J_Mobius_Underground/dist/game/config/Custom/PvpRewardItem.ini new file mode 100644 index 0000000000..a2bfe52944 --- /dev/null +++ b/L2J_Mobius_Underground/dist/game/config/Custom/PvpRewardItem.ini @@ -0,0 +1,33 @@ +# --------------------------------------------------------------------------- +# PvP/PK Reward Item +# --------------------------------------------------------------------------- + +# Reward item on PvP +RewardPvpItem = False + +# Reward PvP item ID +RewardPvpItemId = 57 + +# Reward PvP item Amount +RewardPvpItemAmount = 1000 + +# Show PvP item reward message? +RewardPvpItemMessage = True + +# Reward item on PK +RewardPkItem = False + +# Reward PK item ID +RewardPkItemId = 57 + +# Reward PK item Amount +RewardPkItemAmount = 500 + +# Show PK item reward message? +RewardPkItemMessage = True + +# Disable rewards in instances. +DisableRewardsInInstances = True + +# Disable rewards in PvP zones. +DisableRewardsInPvpZones = True diff --git a/L2J_Mobius_Underground/java/com/l2jmobius/Config.java b/L2J_Mobius_Underground/java/com/l2jmobius/Config.java index 1e09d88031..c1f8a7533c 100644 --- a/L2J_Mobius_Underground/java/com/l2jmobius/Config.java +++ b/L2J_Mobius_Underground/java/com/l2jmobius/Config.java @@ -122,6 +122,7 @@ public final class Config public static final String CUSTOM_PREMIUM_SYSTEM_CONFIG_FILE = "./config/Custom/PremiumSystem.ini"; public static final String CUSTOM_PRIVATE_STORE_RANGE_CONFIG_FILE = "./config/Custom/PrivateStoreRange.ini"; public static final String CUSTOM_PVP_ANNOUNCE_CONFIG_FILE = "./config/Custom/PvpAnnounce.ini"; + public static final String CUSTOM_PVP_REWARD_ITEM_CONFIG_FILE = "./config/Custom/PvpRewardItem.ini"; public static final String CUSTOM_SAYUNE_FOR_ALL_CONFIG_FILE = "./config/Custom/SayuneForAll.ini"; public static final String CUSTOM_SCREEN_WELCOME_MESSAGE_CONFIG_FILE = "./config/Custom/ScreenWelcomeMessage.ini"; public static final String CUSTOM_SELL_BUFFS_CONFIG_FILE = "./config/Custom/SellBuffs.ini"; @@ -997,6 +998,16 @@ public final class Config public static boolean ANNOUNCE_PK_PVP_NORMAL_MESSAGE; public static String ANNOUNCE_PK_MSG; public static String ANNOUNCE_PVP_MSG; + public static boolean REWARD_PVP_ITEM; + public static int REWARD_PVP_ITEM_ID; + public static int REWARD_PVP_ITEM_AMOUNT; + public static boolean REWARD_PVP_ITEM_MESSAGE; + public static boolean REWARD_PK_ITEM; + public static int REWARD_PK_ITEM_ID; + public static int REWARD_PK_ITEM_AMOUNT; + public static boolean REWARD_PK_ITEM_MESSAGE; + public static boolean DISABLE_REWARDS_IN_INSTANCES; + public static boolean DISABLE_REWARDS_IN_PVP_ZONES; public static boolean CHAT_ADMIN; public static boolean MULTILANG_ENABLE; public static List MULTILANG_ALLOWED = new ArrayList<>(); @@ -2539,6 +2550,20 @@ public final class Config ANNOUNCE_PK_MSG = PvpAnnounce.getString("AnnouncePkMsg", "$killer has slaughtered $target"); ANNOUNCE_PVP_MSG = PvpAnnounce.getString("AnnouncePvpMsg", "$killer has defeated $target"); + // Load PvpRewardItem config file (if exists) + final PropertiesParser PvpRewardItem = new PropertiesParser(CUSTOM_PVP_REWARD_ITEM_CONFIG_FILE); + + REWARD_PVP_ITEM = PvpRewardItem.getBoolean("RewardPvpItem", false); + REWARD_PVP_ITEM_ID = PvpRewardItem.getInt("RewardPvpItemId", 57); + REWARD_PVP_ITEM_AMOUNT = PvpRewardItem.getInt("RewardPvpItemAmount", 1000); + REWARD_PVP_ITEM_MESSAGE = PvpRewardItem.getBoolean("RewardPvpItemMessage", false); + REWARD_PK_ITEM = PvpRewardItem.getBoolean("RewardPkItem", false); + REWARD_PK_ITEM_ID = PvpRewardItem.getInt("RewardPkItemId", 57); + REWARD_PK_ITEM_AMOUNT = PvpRewardItem.getInt("RewardPkItemAmount", 500); + REWARD_PK_ITEM_MESSAGE = PvpRewardItem.getBoolean("RewardPkItemMessage", false); + DISABLE_REWARDS_IN_INSTANCES = PvpRewardItem.getBoolean("DisableRewardsInInstances", true); + DISABLE_REWARDS_IN_PVP_ZONES = PvpRewardItem.getBoolean("DisableRewardsInPvpZones", true); + // Load SayuneForAll config file (if exists) final PropertiesParser SayuneForAll = new PropertiesParser(CUSTOM_SAYUNE_FOR_ALL_CONFIG_FILE); diff --git a/L2J_Mobius_Underground/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java b/L2J_Mobius_Underground/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java index a363f272b6..9fca753529 100644 --- a/L2J_Mobius_Underground/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java +++ b/L2J_Mobius_Underground/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java @@ -4961,6 +4961,21 @@ public final class L2PcInstance extends L2Playable } } + // pvp/pk item rewards + if (!(Config.DISABLE_REWARDS_IN_INSTANCES && (getInstanceId() != 0)) && // + !(Config.DISABLE_REWARDS_IN_PVP_ZONES && isInsideZone(ZoneId.PVP))) + { + // pvp + if (Config.REWARD_PVP_ITEM && (getPvpFlag() != 0)) + { + pk.addItem("PvP Item Reward", Config.REWARD_PVP_ITEM_ID, Config.REWARD_PVP_ITEM_AMOUNT, this, Config.REWARD_PVP_ITEM_MESSAGE); + } + // pk + if (Config.REWARD_PK_ITEM && (getPvpFlag() == 0)) + { + pk.addItem("PK Item Reward", Config.REWARD_PK_ITEM_ID, Config.REWARD_PK_ITEM_AMOUNT, this, Config.REWARD_PK_ITEM_MESSAGE); + } + } } broadcastStatusUpdate();