As title says.
Note: You can change the colors etc from xml.
code for source:
diff --git a/java/net/sf/l2j/gameserver/data/xml/PvPColorSystem.java b/java/net/sf/l2j/gameserver/data/xml/PvPColorSystem.java
new file mode 100644
index 0000000..6b7ef6f
--- /dev/null
+++ a/java/net/sf/l2j/gameserver/data/xml/PvPColorSystem.java
@@ -0,0 +1,98 @@
+package net.sf.l2j.gameserver.data.xml;
+
+import java.nio.file.Path;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import net.sf.l2j.commons.data.xml.IXmlReader;
+
+import net.sf.l2j.gameserver.model.actor.Player;
+import org.w3c.dom.Document;
+import org.w3c.dom.NamedNodeMap;
+
+
+public class PvPColorSystem implements IXmlReader
+{
+ final Map<Integer, Integer> _nameColors = new ConcurrentHashMap<>();
+ final Map<Integer, Integer> _titleColors = new ConcurrentHashMap<>();
+
+ public static PvPColorSystem getInstance()
+ {
+ return PvPColorSystem.SingletonHolder._instance;
+ }
+
+ private static class SingletonHolder
+ {
+ protected static final PvPColorSystem _instance = new PvPColorSystem();
+ }
+
+ public PvPColorSystem()
+ {
+ load();
+ }
+
+ @Override
+ public void load()
+ {
+ parseFile("./data/xml/pvpColors.xml");
+ LOGGER.info("PvpColorSystem: loaded " + _nameColors.size() + " [Name] colors and " + _titleColors.size() + " [Title] colors.");
+ }
+
+ public void setNameColors(int pvps, int color)
+ {
+ _nameColors.put(pvps, color);
+ }
+
+ public void setTitleColors(int pvps, int color)
+ {
+ _titleColors.put(pvps, color);
+ }
+
+ public void updateNameColor(Player player)
+ {
+ _nameColors.forEach((kills, color) ->
+ {
+ if (player.getPkKills() >= kills)
+
+ player.getAppearance().setTitleColor(color);
+ });
+ }
+
+ public void updateTitleColor(Player player)
+ {
+ _titleColors.forEach((kills, color) ->
+ {
+ if (player.getPvpKills() >= kills)
+
+ player.getAppearance().setNameColor(color);
+ });
+ }
+
+ @Override
+ public void parseDocument(Document doc, Path path)
+ {
+ forEach(doc, "list", listNode -> forEach(listNode, "pvpcolors", pvpColors ->
+ {
+ forEach(pvpColors, "pvp", pVp ->
+ {
+ forEach(pVp, "title", titleColors ->
+ {
+ final NamedNodeMap pvpCls = titleColors.getAttributes();
+ setTitleColors(parseInteger(pvpCls, "pvpKills"), Integer.decode("0x" + parseString(pvpCls, "color")));
+
+ });
+ });
+
+ forEach(pvpColors, "pk", pK ->
+ {
+ forEach(pK, "name", nameColors ->
+ {
+ final NamedNodeMap pkCls = nameColors.getAttributes();
+ setNameColors(parseInteger(pkCls, "pkKills"), Integer.decode("0x" + parseString(pkCls, "color")));
+ });
+ });
+
+ }));
+ }
+}
diff --git a/aCis_gameserver/java/net/sf/l2j/gameserver.GameServer.java b/aCis_gameserver/java/net/sf/l2j/gameserver.GameServer.java
index a707ce5..d247e2e 100644
--- a/aCis_gameserver/java/net/sf/l2j/gameserver.GameServer.java
+++ b/aCis_gameserver/java/net/sf/l2j/gameserver.GameServer.java
import net.sf.l2j.gameserver.data.xml.MultisellData;
import net.sf.l2j.gameserver.data.xml.NewbieBuffData;
import net.sf.l2j.gameserver.data.xml.NpcData;
import net.sf.l2j.gameserver.data.xml.PlayerData;
import net.sf.l2j.gameserver.data.xml.PlayerLevelData;
+import net.sf.l2j.gameserver.data.xml.PvPColorSystem;
import net.sf.l2j.gameserver.data.xml.RecipeData;
import net.sf.l2j.gameserver.data.xml.ScriptData;
import net.sf.l2j.gameserver.data.xml.SkillTreeData;
StringUtil.printSection("Four Sepulchers");
FourSepulchersManager.getInstance();
StringUtil.printSection("Quests & Scripts");
ScriptData.getInstance();
+ PvPColorSystem.getInstance();
if (Config.ALLOW_BOAT)
{
BoatManager.getInstance();
diff --git a/aCis_gameserver/java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java b/aCis_gameserver/java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java
index a707ce5..d247e2e 100644
--- a/aCis_gameserver/java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java
+++ b/aCis_gameserver/java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java
import net.sf.l2j.gameserver.data.xml.AdminData;
import net.sf.l2j.gameserver.data.xml.AnnouncementData;
import net.sf.l2j.gameserver.data.xml.MapRegionData.TeleportType;
+import net.sf.l2j.gameserver.data.xml.PvPColorSystem;
import net.sf.l2j.gameserver.enums.CabalType;
import net.sf.l2j.gameserver.enums.SealType;
import net.sf.l2j.gameserver.enums.SiegeSide;
// Tutorial
final QuestState qs = player.getQuestList().getQuestState("Tutorial");
if (qs != null)
qs.getQuest().notifyEvent("UC", null, player);
+ PvpColorSystem.getInstance().updateNameColor(player);
+ PvpColorSystem.getInstance().updateTitleColor(player);
player.sendPacket(ActionFailed.STATIC_PACKET);
}
@Override
protected boolean triggersOnActionRequest()
{
return false;
}
diff --git a/aCis_gameserver/java/net/sf/l2j/gameserver/model/actor/Player.java b/aCis_gameserver/java/net/sf/l2j/gameserver/model/actor/Player.java
index a707ce5..d247e2e 100644
--- a/aCis_gameserver/java/net/sf/l2j/gameserver/model/actor/Player.java
+++ b/aCis_gameserver/java/net/sf/l2j/gameserver/model/actor/Player.java
import net.sf.l2j.gameserver.data.xml.MapRegionData.TeleportType;
import net.sf.l2j.gameserver.data.xml.NpcData;
import net.sf.l2j.gameserver.data.xml.PlayerData;
import net.sf.l2j.gameserver.data.xml.PlayerLevelData;
+import net.sf.l2j.gameserver.data.xml.PvPColorSystem;
import net.sf.l2j.gameserver.enums.AiEventType;
import net.sf.l2j.gameserver.enums.CabalType;
import net.sf.l2j.gameserver.enums.GaugeColor;
import net.sf.l2j.gameserver.enums.LootRule;
// Check if it's pvp (cases : regular, wars, victim is PKer)
if (checkIfPvP(target) || (targetPlayer.getClan() != null && getClan() != null && getClan().isAtWarWith(targetPlayer.getClanId()) && targetPlayer.getClan().isAtWarWith(getClanId()) && targetPlayer.getPledgeType() != Clan.SUBUNIT_ACADEMY && getPledgeType() != Clan.SUBUNIT_ACADEMY) || (targetPlayer.getKarma() > 0 && Config.KARMA_AWARD_PK_KILL))
{
if (target instanceof Player)
{
// Add PvP point to attacker.
setPvpKills(getPvpKills() + 1);
+ PvPColorSystem.getInstance().updateNameColor(this);
// Send UserInfo packet to attacker with its Karma and PK Counter
sendPacket(new UserInfo(this));
}
}
// Otherwise, killer is considered as a PKer.
else if (targetPlayer.getKarma() == 0 && targetPlayer.getPvpFlag() == 0)
{
// PK Points are increased only if you kill a player.
if (target instanceof Player)
setPkKills(getPkKills() + 1);
// Calculate new karma.
+ PvPColorSystem.getInstance().updateTitleColor(this);
setKarma(getKarma() + Formulas.calculateKarmaGain(getPkKills(), target instanceof Summon));
// Unequip adventurer items.
checkItemRestriction();
// Stop Pvp task if running.
PvpFlagTaskManager.getInstance().remove(this, true);
}
}
code for xml:
diff --git a/aCis_datapack/data/xml/events.xml b/aCis_datapack/data/xml/pvpColors.xml
new file mode 100644
index 0000000..6b7ef6f
--- /dev/null
+++ b/aCis_datapack/data/xml/pvpColors.xml
+<?xml version="1.0" encoding="UTF-8"?>
+<list>
+ <pvpcolors>
+ <pvp>
+ <title pvpKills = "1" color = "D4E9AA"/>
+ <title pvpKills = "2" color = "BDDB81"/>
+ <title pvpKills = "3" color = "A8CD5D"/>
+ <title pvpKills = "4" color = "91BD3A"/>
+ <title pvpKills = "5" color = "a4e8f9"/>
+ <title pvpKills = "6" color = "7bdaf2"/>
+ <title pvpKills = "7" color = "60ceea"/>
+ <title pvpKills = "8" color = "48b3ce"/>
+ <title pvpKills = "9" color = "F6ACDD"/>
+ <title pvpKills = "10" color = "F098D3"/>
+ <title pvpKills = "11" color = "DA75B8"/>
+ <title pvpKills = "12" color = "AF8BEE"/>
+ <title pvpKills = "13" color = "A276EF"/>
+ <title pvpKills = "14" color = "8A65CB"/>
+ <title pvpKills = "15" color = "A09CA6"/>
+ <title pvpKills = "16" color = "807C86"/>
+ <title pvpKills = "17" color = "544868"/>
+ </pvp>
+ <pk>
+ <name pkKills = "1" color = "D4E9AA"/>
+ <name pkKills = "2" color = "BDDB81"/>
+ <name pkKills = "3" color = "A8CD5D"/>
+ <name pkKills = "4" color = "91BD3A"/>
+ <name pkKills = "5" color = "a4e8f9"/>
+ <name pkKills = "6" color = "7bdaf2"/>
+ <name pkKills = "7" color = "60ceea"/>
+ <name pkKills = "8" color = "48b3ce"/>
+ <name pkKills = "9" color = "F6ACDD"/>
+ <name pkKills = "10" color = "F098D3"/>
+ <name pkKills = "11" color = "DA75B8"/>
+ <name pkKills = "12" color = "AF8BEE"/>
+ <name pkKills = "13" color = "A276EF"/>
+ <name pkKills = "14" color = "8A65CB"/>
+ <name pkKills = "15" color = "A09CA6"/>
+ <name pkKills = "16" color = "807C86"/>
+ <name pkKills = "17" color = "544868"/>
+ </pk>
+ </pvpcolors>
+</list>
Credits for this mod: LordPanic (I have been approved to upload his codes)