From 31f422c01ef2864a48e9daf4891ed535998ed263 Mon Sep 17 00:00:00 2001 From: MobiusDev <8391001+MobiusDevelopment@users.noreply.github.com> Date: Sat, 29 Apr 2017 17:22:39 +0000 Subject: [PATCH] Custom PvP titles and colors. Contributed by gigilo1968. --- .../dist/game/config/Custom/PvpTitleColor.ini | 33 +++++++++++++++ .../java/com/l2jmobius/Config.java | 41 ++++++++++++++++++- .../network/clientpackets/EnterWorld.java | 31 ++++++++++++++ .../dist/game/config/Custom/PvpTitleColor.ini | 33 +++++++++++++++ .../java/com/l2jmobius/Config.java | 41 ++++++++++++++++++- .../network/clientpackets/EnterWorld.java | 31 ++++++++++++++ 6 files changed, 206 insertions(+), 4 deletions(-) create mode 100644 L2J_Mobius_Helios/dist/game/config/Custom/PvpTitleColor.ini create mode 100644 L2J_Mobius_Underground/dist/game/config/Custom/PvpTitleColor.ini diff --git a/L2J_Mobius_Helios/dist/game/config/Custom/PvpTitleColor.ini b/L2J_Mobius_Helios/dist/game/config/Custom/PvpTitleColor.ini new file mode 100644 index 0000000000..5d5a407f39 --- /dev/null +++ b/L2J_Mobius_Helios/dist/game/config/Custom/PvpTitleColor.ini @@ -0,0 +1,33 @@ +#------------------------------------------------------------- +# Custom PvP Titles and Colors +#------------------------------------------------------------- +# Example: PvpAmmount1 = 150, Player with 500 PvP will have a title with the color specified in ColorPvpSystem. +# Attention: Colors should be specified only in RGB format, one color for each rank. +# Attention: Do not use with Faction system. + +EnablePvPColorSystem = False + +# Rank 1. +PvpAmount1 = 500 +ColorForAmount1 = 9C9C9C +PvPTitleForAmount1 = Sergant + +# Rank 2. +PvpAmount2 = 1000 +ColorForAmount2 = 696969 +PvPTitleForAmount2 = Lieutenant + +# Rank 3. +PvpAmount3 = 1500 +ColorForAmount3 = 4F4F4F +PvPTitleForAmount3 = Captain + +# Rank 4. +PvpAmount4 = 2500 +ColorForAmount4 = 363636 +PvPTitleForAmount4 = Major + +# Rank 5. +PvpAmount5 = 5000 +ColorForAmount5 = 1C1C1C +PvPTitleForAmount5 = General diff --git a/L2J_Mobius_Helios/java/com/l2jmobius/Config.java b/L2J_Mobius_Helios/java/com/l2jmobius/Config.java index c1f8a7533c..3ccb4618e8 100644 --- a/L2J_Mobius_Helios/java/com/l2jmobius/Config.java +++ b/L2J_Mobius_Helios/java/com/l2jmobius/Config.java @@ -123,6 +123,7 @@ public final class Config 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_PVP_TITLE_CONFIG_FILE = "./config/Custom/PvpTitleColor.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"; @@ -1008,6 +1009,22 @@ public final class Config 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 PVP_COLOR_SYSTEM_ENABLED; + public static int PVP_AMOUNT1; + public static int PVP_AMOUNT2; + public static int PVP_AMOUNT3; + public static int PVP_AMOUNT4; + public static int PVP_AMOUNT5; + public static int NAME_COLOR_FOR_PVP_AMOUNT1; + public static int NAME_COLOR_FOR_PVP_AMOUNT2; + public static int NAME_COLOR_FOR_PVP_AMOUNT3; + public static int NAME_COLOR_FOR_PVP_AMOUNT4; + public static int NAME_COLOR_FOR_PVP_AMOUNT5; + public static String TITLE_FOR_PVP_AMOUNT1; + public static String TITLE_FOR_PVP_AMOUNT2; + public static String TITLE_FOR_PVP_AMOUNT3; + public static String TITLE_FOR_PVP_AMOUNT4; + public static String TITLE_FOR_PVP_AMOUNT5; public static boolean CHAT_ADMIN; public static boolean MULTILANG_ENABLE; public static List MULTILANG_ALLOWED = new ArrayList<>(); @@ -2556,14 +2573,34 @@ public final class Config 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_PVP_ITEM_MESSAGE = PvpRewardItem.getBoolean("RewardPvpItemMessage", true); 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); + REWARD_PK_ITEM_MESSAGE = PvpRewardItem.getBoolean("RewardPkItemMessage", true); DISABLE_REWARDS_IN_INSTANCES = PvpRewardItem.getBoolean("DisableRewardsInInstances", true); DISABLE_REWARDS_IN_PVP_ZONES = PvpRewardItem.getBoolean("DisableRewardsInPvpZones", true); + // Load PvpRewardItem config file (if exists) + final PropertiesParser PvpTitleColor = new PropertiesParser(CUSTOM_PVP_TITLE_CONFIG_FILE); + + PVP_COLOR_SYSTEM_ENABLED = PvpTitleColor.getBoolean("EnablePvPColorSystem", false); + PVP_AMOUNT1 = PvpTitleColor.getInt("PvpAmount1", 500); + PVP_AMOUNT2 = PvpTitleColor.getInt("PvpAmount2", 1000); + PVP_AMOUNT3 = PvpTitleColor.getInt("PvpAmount3", 1500); + PVP_AMOUNT4 = PvpTitleColor.getInt("PvpAmount4", 2500); + PVP_AMOUNT5 = PvpTitleColor.getInt("PvpAmount5", 5000); + NAME_COLOR_FOR_PVP_AMOUNT1 = Integer.decode("0x" + PvpTitleColor.getString("ColorForAmount1", "00FF00")); + NAME_COLOR_FOR_PVP_AMOUNT2 = Integer.decode("0x" + PvpTitleColor.getString("ColorForAmount2", "00FF00")); + NAME_COLOR_FOR_PVP_AMOUNT3 = Integer.decode("0x" + PvpTitleColor.getString("ColorForAmount3", "00FF00")); + NAME_COLOR_FOR_PVP_AMOUNT4 = Integer.decode("0x" + PvpTitleColor.getString("ColorForAmount4", "00FF00")); + NAME_COLOR_FOR_PVP_AMOUNT5 = Integer.decode("0x" + PvpTitleColor.getString("ColorForAmount5", "00FF00")); + TITLE_FOR_PVP_AMOUNT1 = PvpTitleColor.getString("PvPTitleForAmount1", "Title"); + TITLE_FOR_PVP_AMOUNT2 = PvpTitleColor.getString("PvPTitleForAmount2", "Title"); + TITLE_FOR_PVP_AMOUNT3 = PvpTitleColor.getString("PvPTitleForAmount3", "Title"); + TITLE_FOR_PVP_AMOUNT4 = PvpTitleColor.getString("PvPTitleForAmount4", "Title"); + TITLE_FOR_PVP_AMOUNT5 = PvpTitleColor.getString("PvPTitleForAmount5", "Title"); + // 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/network/clientpackets/EnterWorld.java b/L2J_Mobius_Helios/java/com/l2jmobius/gameserver/network/clientpackets/EnterWorld.java index f4a678670e..b3c685e124 100644 --- a/L2J_Mobius_Helios/java/com/l2jmobius/gameserver/network/clientpackets/EnterWorld.java +++ b/L2J_Mobius_Helios/java/com/l2jmobius/gameserver/network/clientpackets/EnterWorld.java @@ -177,6 +177,37 @@ public class EnterWorld implements IClientIncomingPacket } } + if (Config.PVP_COLOR_SYSTEM_ENABLED && !Config.FACTION_SYSTEM_ENABLED) + { + if ((activeChar.getPvpKills() >= (Config.PVP_AMOUNT1)) && (activeChar.getPvpKills() < (Config.PVP_AMOUNT2))) + { + activeChar.setTitle("\u00AE " + Config.TITLE_FOR_PVP_AMOUNT1 + " \u00AE"); + activeChar.getAppearance().setTitleColor(Config.NAME_COLOR_FOR_PVP_AMOUNT1); + } + else if ((activeChar.getPvpKills() >= (Config.PVP_AMOUNT2)) && (activeChar.getPvpKills() < (Config.PVP_AMOUNT3))) + { + activeChar.setTitle("\u00AE " + Config.TITLE_FOR_PVP_AMOUNT2 + " \u00AE"); + activeChar.getAppearance().setTitleColor(Config.NAME_COLOR_FOR_PVP_AMOUNT2); + } + else if ((activeChar.getPvpKills() >= (Config.PVP_AMOUNT3)) && (activeChar.getPvpKills() < (Config.PVP_AMOUNT4))) + { + activeChar.setTitle("\u00AE " + Config.TITLE_FOR_PVP_AMOUNT3 + " \u00AE"); + activeChar.getAppearance().setTitleColor(Config.NAME_COLOR_FOR_PVP_AMOUNT3); + } + else if ((activeChar.getPvpKills() >= (Config.PVP_AMOUNT4)) && (activeChar.getPvpKills() < (Config.PVP_AMOUNT5))) + { + activeChar.setTitle("\u00AE " + Config.TITLE_FOR_PVP_AMOUNT4 + " \u00AE"); + activeChar.getAppearance().setTitleColor(Config.NAME_COLOR_FOR_PVP_AMOUNT4); + } + else if (activeChar.getPvpKills() >= (Config.PVP_AMOUNT5)) + { + activeChar.setTitle("\u00AE " + Config.TITLE_FOR_PVP_AMOUNT5 + " \u00AE"); + activeChar.getAppearance().setTitleColor(Config.NAME_COLOR_FOR_PVP_AMOUNT5); + } + activeChar.sendMessage("Welcome " + activeChar.getName() + ", you PvP kill count is " + activeChar.getPvpKills() + " and get a special title."); + activeChar.broadcastTitleInfo(); + } + // Apply special GM properties to the GM when entering if (activeChar.isGM()) { diff --git a/L2J_Mobius_Underground/dist/game/config/Custom/PvpTitleColor.ini b/L2J_Mobius_Underground/dist/game/config/Custom/PvpTitleColor.ini new file mode 100644 index 0000000000..5d5a407f39 --- /dev/null +++ b/L2J_Mobius_Underground/dist/game/config/Custom/PvpTitleColor.ini @@ -0,0 +1,33 @@ +#------------------------------------------------------------- +# Custom PvP Titles and Colors +#------------------------------------------------------------- +# Example: PvpAmmount1 = 150, Player with 500 PvP will have a title with the color specified in ColorPvpSystem. +# Attention: Colors should be specified only in RGB format, one color for each rank. +# Attention: Do not use with Faction system. + +EnablePvPColorSystem = False + +# Rank 1. +PvpAmount1 = 500 +ColorForAmount1 = 9C9C9C +PvPTitleForAmount1 = Sergant + +# Rank 2. +PvpAmount2 = 1000 +ColorForAmount2 = 696969 +PvPTitleForAmount2 = Lieutenant + +# Rank 3. +PvpAmount3 = 1500 +ColorForAmount3 = 4F4F4F +PvPTitleForAmount3 = Captain + +# Rank 4. +PvpAmount4 = 2500 +ColorForAmount4 = 363636 +PvPTitleForAmount4 = Major + +# Rank 5. +PvpAmount5 = 5000 +ColorForAmount5 = 1C1C1C +PvPTitleForAmount5 = General diff --git a/L2J_Mobius_Underground/java/com/l2jmobius/Config.java b/L2J_Mobius_Underground/java/com/l2jmobius/Config.java index c1f8a7533c..3ccb4618e8 100644 --- a/L2J_Mobius_Underground/java/com/l2jmobius/Config.java +++ b/L2J_Mobius_Underground/java/com/l2jmobius/Config.java @@ -123,6 +123,7 @@ public final class Config 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_PVP_TITLE_CONFIG_FILE = "./config/Custom/PvpTitleColor.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"; @@ -1008,6 +1009,22 @@ public final class Config 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 PVP_COLOR_SYSTEM_ENABLED; + public static int PVP_AMOUNT1; + public static int PVP_AMOUNT2; + public static int PVP_AMOUNT3; + public static int PVP_AMOUNT4; + public static int PVP_AMOUNT5; + public static int NAME_COLOR_FOR_PVP_AMOUNT1; + public static int NAME_COLOR_FOR_PVP_AMOUNT2; + public static int NAME_COLOR_FOR_PVP_AMOUNT3; + public static int NAME_COLOR_FOR_PVP_AMOUNT4; + public static int NAME_COLOR_FOR_PVP_AMOUNT5; + public static String TITLE_FOR_PVP_AMOUNT1; + public static String TITLE_FOR_PVP_AMOUNT2; + public static String TITLE_FOR_PVP_AMOUNT3; + public static String TITLE_FOR_PVP_AMOUNT4; + public static String TITLE_FOR_PVP_AMOUNT5; public static boolean CHAT_ADMIN; public static boolean MULTILANG_ENABLE; public static List MULTILANG_ALLOWED = new ArrayList<>(); @@ -2556,14 +2573,34 @@ public final class Config 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_PVP_ITEM_MESSAGE = PvpRewardItem.getBoolean("RewardPvpItemMessage", true); 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); + REWARD_PK_ITEM_MESSAGE = PvpRewardItem.getBoolean("RewardPkItemMessage", true); DISABLE_REWARDS_IN_INSTANCES = PvpRewardItem.getBoolean("DisableRewardsInInstances", true); DISABLE_REWARDS_IN_PVP_ZONES = PvpRewardItem.getBoolean("DisableRewardsInPvpZones", true); + // Load PvpRewardItem config file (if exists) + final PropertiesParser PvpTitleColor = new PropertiesParser(CUSTOM_PVP_TITLE_CONFIG_FILE); + + PVP_COLOR_SYSTEM_ENABLED = PvpTitleColor.getBoolean("EnablePvPColorSystem", false); + PVP_AMOUNT1 = PvpTitleColor.getInt("PvpAmount1", 500); + PVP_AMOUNT2 = PvpTitleColor.getInt("PvpAmount2", 1000); + PVP_AMOUNT3 = PvpTitleColor.getInt("PvpAmount3", 1500); + PVP_AMOUNT4 = PvpTitleColor.getInt("PvpAmount4", 2500); + PVP_AMOUNT5 = PvpTitleColor.getInt("PvpAmount5", 5000); + NAME_COLOR_FOR_PVP_AMOUNT1 = Integer.decode("0x" + PvpTitleColor.getString("ColorForAmount1", "00FF00")); + NAME_COLOR_FOR_PVP_AMOUNT2 = Integer.decode("0x" + PvpTitleColor.getString("ColorForAmount2", "00FF00")); + NAME_COLOR_FOR_PVP_AMOUNT3 = Integer.decode("0x" + PvpTitleColor.getString("ColorForAmount3", "00FF00")); + NAME_COLOR_FOR_PVP_AMOUNT4 = Integer.decode("0x" + PvpTitleColor.getString("ColorForAmount4", "00FF00")); + NAME_COLOR_FOR_PVP_AMOUNT5 = Integer.decode("0x" + PvpTitleColor.getString("ColorForAmount5", "00FF00")); + TITLE_FOR_PVP_AMOUNT1 = PvpTitleColor.getString("PvPTitleForAmount1", "Title"); + TITLE_FOR_PVP_AMOUNT2 = PvpTitleColor.getString("PvPTitleForAmount2", "Title"); + TITLE_FOR_PVP_AMOUNT3 = PvpTitleColor.getString("PvPTitleForAmount3", "Title"); + TITLE_FOR_PVP_AMOUNT4 = PvpTitleColor.getString("PvPTitleForAmount4", "Title"); + TITLE_FOR_PVP_AMOUNT5 = PvpTitleColor.getString("PvPTitleForAmount5", "Title"); + // 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/network/clientpackets/EnterWorld.java b/L2J_Mobius_Underground/java/com/l2jmobius/gameserver/network/clientpackets/EnterWorld.java index f4a678670e..b3c685e124 100644 --- a/L2J_Mobius_Underground/java/com/l2jmobius/gameserver/network/clientpackets/EnterWorld.java +++ b/L2J_Mobius_Underground/java/com/l2jmobius/gameserver/network/clientpackets/EnterWorld.java @@ -177,6 +177,37 @@ public class EnterWorld implements IClientIncomingPacket } } + if (Config.PVP_COLOR_SYSTEM_ENABLED && !Config.FACTION_SYSTEM_ENABLED) + { + if ((activeChar.getPvpKills() >= (Config.PVP_AMOUNT1)) && (activeChar.getPvpKills() < (Config.PVP_AMOUNT2))) + { + activeChar.setTitle("\u00AE " + Config.TITLE_FOR_PVP_AMOUNT1 + " \u00AE"); + activeChar.getAppearance().setTitleColor(Config.NAME_COLOR_FOR_PVP_AMOUNT1); + } + else if ((activeChar.getPvpKills() >= (Config.PVP_AMOUNT2)) && (activeChar.getPvpKills() < (Config.PVP_AMOUNT3))) + { + activeChar.setTitle("\u00AE " + Config.TITLE_FOR_PVP_AMOUNT2 + " \u00AE"); + activeChar.getAppearance().setTitleColor(Config.NAME_COLOR_FOR_PVP_AMOUNT2); + } + else if ((activeChar.getPvpKills() >= (Config.PVP_AMOUNT3)) && (activeChar.getPvpKills() < (Config.PVP_AMOUNT4))) + { + activeChar.setTitle("\u00AE " + Config.TITLE_FOR_PVP_AMOUNT3 + " \u00AE"); + activeChar.getAppearance().setTitleColor(Config.NAME_COLOR_FOR_PVP_AMOUNT3); + } + else if ((activeChar.getPvpKills() >= (Config.PVP_AMOUNT4)) && (activeChar.getPvpKills() < (Config.PVP_AMOUNT5))) + { + activeChar.setTitle("\u00AE " + Config.TITLE_FOR_PVP_AMOUNT4 + " \u00AE"); + activeChar.getAppearance().setTitleColor(Config.NAME_COLOR_FOR_PVP_AMOUNT4); + } + else if (activeChar.getPvpKills() >= (Config.PVP_AMOUNT5)) + { + activeChar.setTitle("\u00AE " + Config.TITLE_FOR_PVP_AMOUNT5 + " \u00AE"); + activeChar.getAppearance().setTitleColor(Config.NAME_COLOR_FOR_PVP_AMOUNT5); + } + activeChar.sendMessage("Welcome " + activeChar.getName() + ", you PvP kill count is " + activeChar.getPvpKills() + " and get a special title."); + activeChar.broadcastTitleInfo(); + } + // Apply special GM properties to the GM when entering if (activeChar.isGM()) {