Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Index: java/net/sf/l2j/Config.java
- ===================================================================
- --- java/net/sf/l2j/Config.java (revision 82)
- +++ java/net/sf/l2j/Config.java (working copy)
- @@ -34,6 +34,7 @@
- import java.util.logging.Logger;
- import javolution.util.FastList;
- +import javolution.util.FastMap;
- import net.sf.l2j.util.StringUtil;
- /**
- @@ -60,6 +61,7 @@
- public static final String SERVER_FILE = "./config/server.properties";
- public static final String SIEGE_FILE = "./config/siege.properties";
- public static final String TELNET_FILE = "./config/telnet.properties";
- + private static final String PVP_COLOR_SYSTEM_CONFIG_FILE = "./config/pvpcolorsystem.properties";
- /**--------------------------------------------------
- // Variable Definitions
- @@ -642,6 +644,11 @@
- public static int CLIENT_PACKET_QUEUE_MAX_UNKNOWN_PER_MIN = 5; // default 5
- //--------------------------------------------------
- +
- + public static String PVPS_COLORS;
- + public static FastMap<Integer, Integer> PVPS_COLORS_LIST;
- + public static String PKS_COLORS;
- + public static FastMap<Integer, Integer> PKS_COLORS_LIST;
- /**
- * This class initializes all global variables for configuration.<br>
- @@ -653,6 +660,60 @@
- {
- _log.info("Loading gameserver configuration files.");
- + try
- + {
- + Properties pvpcolor = new Properties();
- + InputStream is = new FileInputStream(new File(PVP_COLOR_SYSTEM_CONFIG_FILE));
- + pvpcolor.load(is);
- + is.close();
- +
- + PVPS_COLORS = pvpcolor.getProperty("PvpsColors", "");
- + PVPS_COLORS_LIST = new FastMap<Integer, Integer>();
- +
- + 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 FastMap<Integer, Integer>();
- +
- + 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]));
- + }
- +
- + }
- + }
- + catch (Exception e)
- + {
- + e.printStackTrace();
- + throw new Error("Server failed to load "+PVP_COLOR_SYSTEM_CONFIG_FILE+" file.");
- + }
- // Clans settings
- try
- {
- Index: java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminEditChar.java
- ===================================================================
- --- java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminEditChar.java (revision 82)
- +++ java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminEditChar.java (working copy)
- @@ -33,6 +33,7 @@
- import net.sf.l2j.L2DatabaseFactory;
- import net.sf.l2j.gameserver.GmListTable;
- import net.sf.l2j.gameserver.ai.CtrlIntention;
- +import net.sf.l2j.gameserver.anarchy.PvPColorSystem;
- import net.sf.l2j.gameserver.datatables.ClanTable;
- import net.sf.l2j.gameserver.handler.IAdminCommandHandler;
- import net.sf.l2j.gameserver.model.L2Object;
- @@ -638,7 +639,10 @@
- player.setCurrentCp(cpval);
- player.setPvpFlag(pvpflagval);
- player.setPvpKills(pvpkillsval);
- + PvPColorSystem pvpcolor = new PvPColorSystem();
- + pvpcolor.updateNameColor(player);
- player.setPkKills(pkkillsval);
- + pvpcolor.updateTitleColor(player);
- // Save the changed parameters to the database.
- player.store();
- Index: java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java
- ===================================================================
- --- java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java (revision 82)
- +++ java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java (working copy)
- @@ -50,6 +50,7 @@
- import net.sf.l2j.gameserver.ai.CtrlIntention;
- import net.sf.l2j.gameserver.ai.L2CharacterAI;
- import net.sf.l2j.gameserver.ai.L2PlayerAI;
- +import net.sf.l2j.gameserver.anarchy.PvPColorSystem;
- import net.sf.l2j.gameserver.cache.HtmCache;
- import net.sf.l2j.gameserver.communitybbs.BB.Forum;
- import net.sf.l2j.gameserver.communitybbs.Manager.ForumsBBSManager;
- @@ -4640,6 +4641,10 @@
- {
- // Add karma to attacker and increase its PK counter
- setPvpKills(getPvpKills() + 1);
- +
- + PvPColorSystem pvpcolor = new PvPColorSystem();
- + pvpcolor.updateNameColor(this);
- + pvpcolor.updateTitleColor(this);
- // Send a Server->Client UserInfo packet to attacker with its Karma and PK Counter
- sendPacket(new UserInfo(this));
- 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.instance.L2PcInstance;
- +
- +/**
- + *
- + * @author Anarchy
- + */
- +public class PvPColorSystem
- +{
- + public void updateNameColor(L2PcInstance 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(L2PcInstance 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));
- + }
- + }
- + }
- +}
- Index: java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java
- ===================================================================
- --- java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java (revision 82)
- +++ java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java (working copy)
- @@ -27,6 +27,7 @@
- import net.sf.l2j.gameserver.Olympiad;
- import net.sf.l2j.gameserver.SevenSigns;
- import net.sf.l2j.gameserver.TaskPriority;
- +import net.sf.l2j.gameserver.anarchy.PvPColorSystem;
- import net.sf.l2j.gameserver.cache.HtmCache;
- import net.sf.l2j.gameserver.datatables.AdminCommandAccessRights;
- import net.sf.l2j.gameserver.datatables.MapRegionTable;
- @@ -85,6 +86,10 @@
- {
- L2PcInstance activeChar = getClient().getActiveChar();
- + PvPColorSystem pvpcolor = new PvPColorSystem();
- + pvpcolor.updateNameColor(activeChar);
- + pvpcolor.updateTitleColor(activeChar);
- +
- if (activeChar == null)
- {
- _log.warning("EnterWorld failed! activeChar is null...");
- 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
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement