Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Index: config/pvpcolorsystem.properties
- ===================================================================
- --- config/pvpcolorsystem.properties (revision 0)
- +++ config/pvpcolorsystem.properties (revision 0)
- @@ -0,0 +1,9 @@
- +# Advanced pvp/pk color system, by Anarchy.
- +
- +# PvP Name color System.
- +# It works like: pvps,color;pvps,color, eg. 100,00FF00;200,FF0000;300,0000FF;.
- +PvpsColors = 100,00FF00;
- +
- +# Pk Title color System.
- +# It works like: pks,color;pks,color, eg. 100,00FF00;200,FF0000;300,0000FF;.
- +PksColors = 100,00FF00;
- \ No newline at end of file
- Index: java/net/sf/l2j/Config.java
- ===================================================================
- --- java/net/sf/l2j/Config.java (revision 2)
- +++ java/net/sf/l2j/Config.java (working copy)
- @@ -46,6 +46,7 @@
- public static final String RUS_ACIS_FILE = "./config/rus_acis.properties";
- public static final String SERVER_FILE = "./config/server.properties";
- public static final String SIEGE_FILE = "./config/siege.properties";
- + private static final String PVP_COLOR_SYSTEM_CONFIG_FILE = "./config/pvpcolorsystem.properties";
- // --------------------------------------------------
- // Clans settings
- @@ -776,6 +777,11 @@
- public static boolean CABAL_BUFFER;
- public static int[] NO_DROP_ITEMS;
- + /** PVP COLOR SYSTEM */
- + public static String PVPS_COLORS;
- + public static Map<Integer, Integer> PVPS_COLORS_LIST;
- + public static String PKS_COLORS;
- + public static Map<Integer, Integer> PKS_COLORS_LIST;
- /**
- * Initialize {@link ExProperties} from specified configuration file.
- * @param filename : File name to be loaded.
- @@ -814,6 +820,46 @@
- }
- /**
- + * Loads PvPColor settings.
- + */
- + private static final void loadPvPColors() {
- + final ExProperties pvpcolor = initProperties(PVP_COLOR_SYSTEM_CONFIG_FILE);
- +
- + PVPS_COLORS = pvpcolor.getProperty("PvpsColors", "");
- + PVPS_COLORS_LIST = new HashMap <> ();
- +
- + String[] splitted_pvps_colors = PVPS_COLORS.split(";");
- +
- + for (String iii: splitted_pvps_colors) {
- +
- + String[] pvps_colors = iii.split(",");
- +
- + if (pvps_colors.length != 2) {
- + System.out.println("Invalid properties.");
- + } else {
- + PVPS_COLORS_LIST.put(Integer.parseInt(pvps_colors[0]), Integer.decode("0x" + pvps_colors[1]));
- + }
- +
- + }
- +
- + PKS_COLORS = pvpcolor.getProperty("PksColors", "");
- + PKS_COLORS_LIST = new HashMap <> ();
- +
- + String[] splitted_pks_colors = PKS_COLORS.split(";");
- +
- + for (String iii: splitted_pks_colors) {
- +
- + String[] pks_colors = iii.split(",");
- +
- + if (pks_colors.length != 2) {
- + System.out.println("Invalid properties.");
- + } else {
- + PKS_COLORS_LIST.put(Integer.parseInt(pks_colors[0]), Integer.decode("0x" + pks_colors[1]));
- + }
- +
- + }
- + }
- + /**
- * Loads clan and clan hall settings.
- */
- private static final void loadClans()
- @@ -1646,6 +1692,9 @@
- // clans settings
- loadClans();
- +
- + // pvpcolor settings
- + loadPvPColors();
- // events settings
- loadEvents();
- Index: java/net/sf/l2j/gameserver/anarchy/PvPColorSystem.java
- ===================================================================
- --- java/net/sf/l2j/gameserver/anarchy/PvPColorSystem.java (revision 0)
- +++ java/net/sf/l2j/gameserver/anarchy/PvPColorSystem.java (revision 0)
- @@ -0,0 +1,53 @@
- +/* 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 2, 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, write to the Free Software
- + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- + * 02111-1307, USA.
- + *
- + * http://www.gnu.org/copyleft/gpl.html
- + */
- +package net.sf.l2j.gameserver.anarchy;
- +
- +import java.util.Set;
- +
- +import net.sf.l2j.Config;
- +import net.sf.l2j.gameserver.model.actor.Player;
- +
- +/**
- + *
- + * @author Anarchy
- + */
- +public class PvPColorSystem
- +{
- + public void updateNameColor(Player player)
- + {
- + Set<Integer> pvpscolors = Config.PVPS_COLORS_LIST.keySet();
- + for (Integer i : pvpscolors)
- + {
- + if (player.getPvpKills() >= i)
- + {
- + player.getAppearance().setNameColor(Config.PVPS_COLORS_LIST.get(i));
- + }
- + }
- + }
- + public void updateTitleColor(Player player)
- + {
- + Set<Integer> pkscolors = Config.PKS_COLORS_LIST.keySet();
- + for (Integer i : pkscolors)
- + {
- + if (player.getPkKills() >= i)
- + {
- + player.getAppearance().setTitleColor(Config.PKS_COLORS_LIST.get(i));
- + }
- + }
- + }
- +}
- \ No newline at end of file
- Index: java/net/sf/l2j/gameserver/model/actor/Player.java
- ===================================================================
- --- java/net/sf/l2j/gameserver/model/actor/Player.java (revision 2)
- +++ java/net/sf/l2j/gameserver/model/actor/Player.java (working copy)
- @@ -32,6 +32,7 @@
- import net.sf.l2j.Config;
- import net.sf.l2j.gameserver.LoginServerThread;
- +import net.sf.l2j.gameserver.anarchy.PvPColorSystem;
- import net.sf.l2j.gameserver.communitybbs.CommunityBoard;
- import net.sf.l2j.gameserver.communitybbs.model.Forum;
- import net.sf.l2j.gameserver.data.SkillTable;
- @@ -2971,7 +2972,9 @@
- {
- // Add PvP point to attacker.
- setPvpKills(getPvpKills() + 1);
- -
- + PvPColorSystem pvpcolor = new PvPColorSystem();
- + pvpcolor.updateNameColor(this);
- + pvpcolor.updateTitleColor(this);
- // Send UserInfo packet to attacker with its Karma and PK Counter
- sendPacket(new UserInfo(this));
- }
- Index: java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java
- ===================================================================
- --- java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java (revision 2)
- +++ java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java (working copy)
- @@ -54,6 +54,7 @@
- import net.sf.l2j.gameserver.scripting.QuestState;
- import net.sf.l2j.gameserver.skills.L2Skill;
- import net.sf.l2j.gameserver.taskmanager.GameTimeTaskManager;
- +import net.sf.l2j.gameserver.anarchy.PvPColorSystem;
- public class EnterWorld extends L2GameClientPacket
- {
- @@ -94,6 +95,9 @@
- else
- AdminData.getInstance().addGm(player, true);
- }
- + PvPColorSystem pvpcolor = new PvPColorSystem();
- + pvpcolor.updateNameColor(player);
- + pvpcolor.updateTitleColor(player);
- // Set dead status if applies
- if (player.getStatus().getHp() < 0.5 && player.isMortal())
Advertisement
Add Comment
Please, Sign In to add comment