Noticias:

Debes de estar registrado para poder ver el contenido indicado. Registrate o Conectate

Menú Principal

Pvp Color/Skill Acis

Iniciado por Swarlog, Ago 31, 2022, 08:11 PM

Tema anterior - Siguiente tema

Swarlog

CitarCORE:

Index: config/custom.properties
===================================================================
--- config/custom.properties    (revision 0)
+++ config/custom.properties    (working copy)
@@ -0,0 +1,7 @@
+#=============================================================
+#                       Custom settings
+#=============================================================
+# Enable / disable pvp color system
+# Note: pvp_color.xml is located in "data/xml" folder
+# Default: false
+EnablePvpColor = false
\ No newline at end of file
Index: java/net/sf/l2j/Config.java
===================================================================
--- java/net/sf/l2j/Config.java (revision 21)
+++ java/net/sf/l2j/Config.java (working copy)
@@ -43,6 +43,7 @@
        protected static final Logger _log = Logger.getLogger(Config.class.getName());
       
        public static final String CLANS_FILE = "./config/clans.properties";
+       public static final String CUSTOM_FILE = "./config/custom.properties";
        public static final String EVENTS_FILE = "./config/events.properties";
        public static final String GEOENGINE_FILE = "./config/geoengine.properties";
        public static final String HEXID_FILE = "./config/hexid.txt";
@@ -132,6 +133,12 @@
        public static int CH_FRONT2_FEE;
       
        // --------------------------------------------------
+       // Custom settings
+       // --------------------------------------------------
+     
+       public static boolean ENABLE_PVP_COLOR;
+     
+       // --------------------------------------------------
        // Events settings
        // --------------------------------------------------
       
@@ -761,6 +768,10 @@
                        CH_FRONT1_FEE = clans.getProperty("ClanHallFrontPlatformFunctionFeeLvl1", 3031);
                        CH_FRONT2_FEE = clans.getProperty("ClanHallFrontPlatformFunctionFeeLvl2", 9331);
                       
+                       // Custom settings
+                       ExProperties custom = load(CUSTOM_FILE);
+                       ENABLE_PVP_COLOR = custom.getProperty("EnablePvpColor", false);
+                     
                        // Events config
                        ExProperties events = load(EVENTS_FILE);
                        ALT_OLY_START_TIME = events.getProperty("AltOlyStartTime", 18);
Index: java/net/sf/l2j/gameserver/GameServer.java
===================================================================
--- java/net/sf/l2j/gameserver/GameServer.java  (revision 21)
+++ java/net/sf/l2j/gameserver/GameServer.java  (working copy)
@@ -57,6 +57,7 @@
 import net.sf.l2j.gameserver.datatables.NpcTable;
 import net.sf.l2j.gameserver.datatables.NpcWalkerRoutesTable;
 import net.sf.l2j.gameserver.datatables.PetDataTable;
+import net.sf.l2j.gameserver.datatables.PvpColorTable;
 import net.sf.l2j.gameserver.datatables.RecipeTable;
 import net.sf.l2j.gameserver.datatables.ServerMemo;
 import net.sf.l2j.gameserver.datatables.SkillTable;
@@ -200,6 +201,9 @@
                PartyMatchRoomList.getInstance();
                RaidBossPointsManager.getInstance();
               
+               if (Config.ENABLE_PVP_COLOR)
+                       PvpColorTable.getInstance();
+             
                StringUtil.printSection("Community server");
                if (Config.ENABLE_COMMUNITY_BOARD) // Forums has to be loaded before clan data
                        ForumsBBSManager.getInstance().initRoot();
Index: java/net/sf/l2j/gameserver/datatables/PvpColorTable.java
===================================================================
--- java/net/sf/l2j/gameserver/datatables/PvpColorTable.java    (revision 0)
+++ java/net/sf/l2j/gameserver/datatables/PvpColorTable.java    (working copy)
@@ -0,0 +1,140 @@
+/*
+ * 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 3 of the License, 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, see <http://www.gnu.org/licenses/>.
+ */
+package net.sf.l2j.gameserver.datatables;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.logging.Logger;
+
+import net.sf.l2j.gameserver.templates.StatsSet;
+import net.sf.l2j.gameserver.xmlfactory.XMLDocumentFactory;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+
+/**
+ * @author rapfersan92
+ */
+public class PvpColorTable
+{
+       private static final Logger _log = Logger.getLogger(PvpColorTable.class.getName());
+     
+       private static List<PvpColor> _pvpColors;
+     
+       public static PvpColorTable getInstance()
+       {
+               return SingletonHolder._instance;
+       }
+     
+       private static class SingletonHolder
+       {
+               protected static final PvpColorTable _instance = new PvpColorTable();
+       }
+     
+       protected PvpColorTable()
+       {
+               _pvpColors = new ArrayList<>();
+               load();
+       }
+     
+       public void reload()
+       {
+               _pvpColors.clear();
+               load();
+       }
+     
+       private void load()
+       {
+               try
+               {
+                       File f = new File("./data/xml/pvp_color.xml");
+                       Document doc = XMLDocumentFactory.getInstance().loadDocument(f);
+                     
+                       Node n = doc.getFirstChild();
+                       for (Node d = n.getFirstChild(); d != null; d = d.getNextSibling())
+                       {
+                               if (d.getNodeName().equalsIgnoreCase("template"))
+                               {
+                                       StatsSet pvpColorData = new StatsSet();
+                                       NamedNodeMap attrs = d.getAttributes();
+                                     
+                                       pvpColorData.set("pvpAmount", Integer.valueOf(attrs.getNamedItem("pvpAmount").getNodeValue()));
+                                       pvpColorData.set("nameColor", Integer.decode("0x" + attrs.getNamedItem("nameColor").getNodeValue()));
+                                       pvpColorData.set("titleColor", Integer.decode("0x" + attrs.getNamedItem("titleColor").getNodeValue()));
+                                       pvpColorData.set("skillId", Integer.valueOf(attrs.getNamedItem("skillId").getNodeValue()));
+                                       pvpColorData.set("skillLv", Integer.valueOf(attrs.getNamedItem("skillLv").getNodeValue()));
+                                     
+                                       _pvpColors.add(new PvpColor(pvpColorData));
+                               }
+                       }
+               }
+               catch (Exception e)
+               {
+                       _log.warning("Exception: PvpColorTable load: " + e);
+               }
+             
+               _log.info("PvpColorTable: Loaded " + _pvpColors.size() + " template(s).");
+       }
+     
+       public List<PvpColor> getPvpColorTable()
+       {
+               return _pvpColors;
+       }
+     
+       public class PvpColor
+       {
+               private int _pvpAmount;
+               private int _nameColor;
+               private int _titleColor;
+               private int _skillId;
+               private int _skillLv;
+             
+               public PvpColor(StatsSet set)
+               {
+                       _pvpAmount = set.getInteger("pvpAmount");
+                       _nameColor = set.getInteger("nameColor");
+                       _titleColor = set.getInteger("titleColor");
+                       _skillId = set.getInteger("skillId");
+                       _skillLv = set.getInteger("skillLv");
+               }
+             
+               public int getPvpAmount()
+               {
+                       return _pvpAmount;
+               }
+             
+               public int getNameColor()
+               {
+                       return _nameColor;
+               }
+             
+               public int getTitleColor()
+               {
+                       return _titleColor;
+               }
+             
+               public int getSkillId()
+               {
+                       return _skillId;
+               }
+             
+               public int getSkillLv()
+               {
+                       return _skillLv;
+               }
+       }
+}
\ No newline at end of file
Index: java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminAdmin.java
===================================================================
--- java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminAdmin.java     (revision 21)
+++ java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminAdmin.java     (working copy)
@@ -28,6 +28,7 @@
 import net.sf.l2j.gameserver.datatables.MultisellData;
 import net.sf.l2j.gameserver.datatables.NpcTable;
 import net.sf.l2j.gameserver.datatables.NpcWalkerRoutesTable;
+import net.sf.l2j.gameserver.datatables.PvpColorTable;
 import net.sf.l2j.gameserver.datatables.SkillTable;
 import net.sf.l2j.gameserver.datatables.TeleportLocationTable;
 import net.sf.l2j.gameserver.handler.IAdminCommandHandler;
@@ -238,6 +239,11 @@
                                        NpcWalkerRoutesTable.getInstance().reload();
                                        activeChar.sendMessage("NPCwalkers' routes have been reloaded.");
                                }
+                               else if (type.startsWith("pvp"))
+                               {
+                                       PvpColorTable.getInstance().reload();
+                                       activeChar.sendMessage("Pvp's colors have been reloaded.");
+                               }
                                else if (type.startsWith("skill"))
                                {
                                        SkillTable.getInstance().reload();
@@ -258,7 +264,7 @@
                        {
                                activeChar.sendMessage("Usage : //reload <acar|announcement|config|crest|door>");
                                activeChar.sendMessage("Usage : //reload <htm|item|multisell|npc|npcwalker>");
-                               activeChar.sendMessage("Usage : //reload <skill|teleport|zone>");
+                               activeChar.sendMessage("Usage : //reload <pvp|skill|teleport|zone>");
                        }
                }
                return true;
Index: java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java
===================================================================
--- java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java   (revision 21)
+++ java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java   (working copy)
@@ -58,6 +58,8 @@
 import net.sf.l2j.gameserver.datatables.ItemTable;
 import net.sf.l2j.gameserver.datatables.MapRegionTable;
 import net.sf.l2j.gameserver.datatables.PetDataTable;
+import net.sf.l2j.gameserver.datatables.PvpColorTable;
+import net.sf.l2j.gameserver.datatables.PvpColorTable.PvpColor;
 import net.sf.l2j.gameserver.datatables.RecipeTable;
 import net.sf.l2j.gameserver.datatables.SkillTable;
 import net.sf.l2j.gameserver.datatables.SkillTable.FrequentSkill;
@@ -2013,6 +2015,8 @@
               
                // Add Death Penalty Buff Level
                restoreDeathPenaltyBuffLevel();
+             
+               pvpColor();
        }
       
        /**
@@ -4233,6 +4237,8 @@
                                // Add PvP point to attacker.
                                setPvpKills(getPvpKills() + 1);
                               
+                               pvpColor();
+                             
                                // Send UserInfo packet to attacker with its Karma and PK Counter
                                sendPacket(new UserInfo(this));
                        }
@@ -8665,6 +8671,8 @@
               
                revalidateZone(true);
                notifyFriends(true);
+             
+               pvpColor();
        }
       
        public long getLastAccess()
@@ -10705,4 +10713,24 @@
                                break;
                }
        }
+     
+       private void pvpColor()
+       {
+               if (!Config.ENABLE_PVP_COLOR)
+                       return;
+             
+               for (PvpColor pvpColor : PvpColorTable.getInstance().getPvpColorTable())
+               {
+                       if (getPvpKills() >= pvpColor.getPvpAmount())
+                       {
+                               getAppearance().setNameColor(pvpColor.getNameColor());
+                               getAppearance().setTitleColor(pvpColor.getTitleColor());
+                               broadcastUserInfo();
+                             
+                               final L2Skill skill = SkillTable.getInstance().getInfo(pvpColor.getSkillId(), pvpColor.getSkillLv());
+                               if (skill != null)
+                                       addSkill(skill, false);
+                       }
+               }
+       }
 }
\ No newline at end of file

CitarDATA:

Index: data/html/admin/server_menu.htm
===================================================================
--- data/html/admin/server_menu.htm     (revision 21)
+++ data/html/admin/server_menu.htm     (working copy)
@@ -18,7 +18,7 @@
        Reload
        <table width=240>
                <tr>
-                       <td><combobox width=120 height=21 var="cb" list=acar;announcement;config;crest;cw;door;htm;item;multisell;npc;npcwalker;skill;teleport;zone;></td>
+                       <td><combobox width=120 height=21 var="cb" list=acar;announcement;config;crest;cw;door;htm;item;multisell;npc;npcwalker;pvp;skill;teleport;zone;></td>
                        <td><button value="Reload" action="bypass -h admin_reload $cb" width=75 height=21 back="L2UI_ch3.Btn1_normalOn" fore="L2UI_ch3.Btn1_normal"></td>
                </tr>
        </table><br>
Index: data/xml/pvp_color.xml
===================================================================
--- data/xml/pvp_color.xml      (revision 0)
+++ data/xml/pvp_color.xml      (working copy)
@@ -0,0 +1,13 @@
+<?xml version='1.0' encoding='utf-8'?>
+<list>
+       <!--
+                       No limit for templates.
+                       Listed values below are used for examples.
+                       If you want to edit or add new templates, do it by copying a line and replacing values.
+        -->
+       <template pvpAmount="100" nameColor="FF9900" titleColor="FFFF77" skillId="3206" skillLv="10"/>
+       <template pvpAmount="200" nameColor="FF99FF" titleColor="FFFF77" skillId="3156" skillLv="1"/>
+       <template pvpAmount="300" nameColor="00FF00" titleColor="FFFF77" skillId="3157" skillLv="1"/>
+       <template pvpAmount="400" nameColor="00FFFF" titleColor="FFFF77" skillId="3147" skillLv="1"/>
+       <template pvpAmount="500" nameColor="FFFF00" titleColor="FFFF77" skillId="3158" skillLv="1"/>
+</list>
\ No newline at end of file