forum.you4games.ru
Статус сервера :Powered by Blackout Gaming Status Checker



Gr_TOP

Maxi-Game

Информация о пользователе

Привет, Гость! Войдите или зарегистрируйтесь.


Вы здесь » Maxi-Game » Всё для Java серверов » [core]Модификации Java серверов


[core]Модификации Java серверов

Сообщений 1 страница 9 из 9

1

Это базовая и простая банковская система. Она очень простая:
Работает со следующими коммандами:
.bank
.deposit
.withdraw
.bank - Даёт инфу о банковской системе
.deposit - Будет менять Х адены на У голд бар
.withdraw - Будет делать обратное действие

Вы можете расширить её, как вам нравится, или полностью игнорировать ее, либо использовать ее в качестве справочного материала для чего-то большего.

Код:
Index: java/config/l2jmods.properties
===================================================================
--- java/config/l2jmods.properties    (revision 1791)
+++ java/config/l2jmods.properties    (working copy)
@@ -138,3 +138,13 @@
# ex.: 1;2;3;4;5;6
# no ";" at the start or end
TvTEventDoorsCloseOpenOnStartEnd =
+
+#---------------------------------------------------------------
+# L2J Banking System                                           -
+#---------------------------------------------------------------
+# To enable banking system set this value to true, default is false.
+BankingEnabled = false
+# This is the amount of Goldbars someone will get when they do the .deposit command, and also the same amount they will lose when they do .withdraw
+BankingGoldbarCount = 1
+# This is the amount of Adena someone will get when they do the .withdraw command, and also the same amount they will lose when they do .deposit
+BankingAdenaCount = 500000000
Index: java/net/sf/l2j/Config.java
===================================================================
--- java/net/sf/l2j/Config.java    (revision 1791)
+++ java/net/sf/l2j/Config.java    (working copy)
@@ -529,6 +529,9 @@
     public static boolean    L2JMOD_WEDDING_SAMESEX;
     public static boolean    L2JMOD_WEDDING_FORMALWEAR;
     public static int        L2JMOD_WEDDING_DIVORCE_COSTS;
+    public static boolean    BANKING_SYSTEM_ENABLED;
+    public static int        BANKING_SYSTEM_GOLDBARS;
+    public static int        BANKING_SYSTEM_ADENA;
     
     /** ************************************************** **/
    /** L2JMods Settings -End                              **/
@@ -1676,6 +1679,10 @@
                         }
                     }
                 }
+                
+                BANKING_SYSTEM_ENABLED    = Boolean.parseBoolean(L2JModSettings.getProperty("BankingEnabled", "false"));
+                BANKING_SYSTEM_GOLDBARS    = Integer.parseInt(L2JModSettings.getProperty("BankingGoldbarCount", "1"));
+                BANKING_SYSTEM_ADENA    = Integer.parseInt(L2JModSettings.getProperty("BankingAdenaCount", "500000000"));

             }
             catch (Exception e)
Index: java/net/sf/l2j/gameserver/GameServer.java
===================================================================
--- java/net/sf/l2j/gameserver/GameServer.java    (revision 1791)
+++ java/net/sf/l2j/gameserver/GameServer.java    (working copy)
@@ -197,6 +197,7 @@
import net.sf.l2j.gameserver.handler.usercommandhandlers.OlympiadStat;
import net.sf.l2j.gameserver.handler.usercommandhandlers.PartyInfo;
import net.sf.l2j.gameserver.handler.usercommandhandlers.Time;
+import net.sf.l2j.gameserver.handler.voicedcommandhandlers.Banking;
import net.sf.l2j.gameserver.handler.voicedcommandhandlers.Wedding;
import net.sf.l2j.gameserver.handler.voicedcommandhandlers.stats;
import net.sf.l2j.gameserver.idfactory.IdFactory;
@@ -618,9 +619,10 @@
        if(Config.L2JMOD_ALLOW_WEDDING)
            _voicedCommandHandler.registerVoicedCommandHandler(new Wedding());

+        if(Config.BANKING_SYSTEM_ENABLED)
+            _voicedCommandHandler.registerVoicedCommandHandler(new Banking());
+        
        _log.config("VoicedCommandHandler: Loaded " + _voicedCommandHandler.size() + " handlers.");
-
-        
                        
        if(Config.L2JMOD_ALLOW_WEDDING)
            CoupleManager.getInstance();
Index: java/net/sf/l2j/gameserver/handler/voicedcommandhandlers/Banking.java
===================================================================
--- java/net/sf/l2j/gameserver/handler/voicedcommandhandlers/Banking.java    (revision 0)
+++ java/net/sf/l2j/gameserver/handler/voicedcommandhandlers/Banking.java    (revision 0)
@@ -0,0 +1,73 @@
+/*
+ * 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.handler.voicedcommandhandlers;
+
+import net.sf.l2j.Config;
+import net.sf.l2j.gameserver.handler.IVoicedCommandHandler;
+import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
+import net.sf.l2j.gameserver.serverpackets.InventoryUpdate;
+
+/**
+ * This class trades Gold Bars for Adena and vice versa.
+ *
+ * @author Ahmed
+ */
+public class Banking implements IVoicedCommandHandler
+{
+    private static String[] _voicedCommands = { "bank", "withdraw", "deposit" };
+
+    public boolean useVoicedCommand(String command, L2PcInstance activeChar,
+            String target)
+    {
+        if (command.equalsIgnoreCase("bank"))
+        {
+            activeChar.sendMessage(".deposit (" + Config.BANKING_SYSTEM_ADENA + " Adena = " + Config.BANKING_SYSTEM_GOLDBARS + " Goldbar) / .withdraw (" + Config.BANKING_SYSTEM_GOLDBARS + " Goldbar = " + Config.BANKING_SYSTEM_ADENA + " Adena)");
+        } else if (command.equalsIgnoreCase("deposit"))
+        {
+            if (activeChar.getInventory().getInventoryItemCount(57, 0) >= Config.BANKING_SYSTEM_ADENA)
+            {
+                InventoryUpdate iu = new InventoryUpdate();
+                activeChar.getInventory().reduceAdena("Goldbar", Config.BANKING_SYSTEM_ADENA, activeChar, null);
+                activeChar.getInventory().addItem("Goldbar", 3470, Config.BANKING_SYSTEM_GOLDBARS, activeChar, null);
+                activeChar.getInventory().updateDatabase();
+                activeChar.sendPacket(iu);
+                activeChar.sendMessage("Thank you, you now have " + Config.BANKING_SYSTEM_GOLDBARS + " Goldbar(s), and " + Config.BANKING_SYSTEM_ADENA + " less adena.");
+            } else
+            {
+                activeChar.sendMessage("You do not have enough Adena to convert to Goldbar(s), you need " + Config.BANKING_SYSTEM_ADENA + " Adena.");
+            }
+        } else if (command.equalsIgnoreCase("withdraw"))
+        {
+            if (activeChar.getInventory().getInventoryItemCount(3470, 0) >= Config.BANKING_SYSTEM_GOLDBARS)
+            {
+                InventoryUpdate iu = new InventoryUpdate();
+                activeChar.getInventory().destroyItemByItemId("Adena", 3470, Config.BANKING_SYSTEM_GOLDBARS, activeChar, null);
+                activeChar.getInventory().addAdena("Adena", Config.BANKING_SYSTEM_ADENA, activeChar, null);
+                activeChar.getInventory().updateDatabase();
+                activeChar.sendPacket(iu);
+                activeChar.sendMessage("Thank you, you now have " + Config.BANKING_SYSTEM_ADENA + " Adena, and " + Config.BANKING_SYSTEM_GOLDBARS + " less Goldbar(s).");
+            } else
+            {
+                activeChar.sendMessage("You do not have any Goldbars to turn into " + Config.BANKING_SYSTEM_ADENA + " Adena.");
+            }
+        }
+        return true;
+    }
+
+    public String[] getVoicedCommandList()
+    {
+        return _voicedCommands;
+    }
+}
\ No newline at end of file

0

2

Hero skills для всех сабов

Меняем на строке
java/net/sf/l2j/gameserver/model/actor/instance/l2pcinstance.java

8901.

Код:
public void setHero(boolean hero)
{
if (hero && _baseClass == _activeClass)
{
for (L2Skill s : HeroSkillTable.getHeroSkills())
addSkill(s, false); //Dont Save Hero skills to database
}
else
{
for (L2Skill s : HeroSkillTable.getHeroSkills())
super.removeSkill(s); //Just Remove skills from nonHero characters
}
_hero = hero;

sendSkillList();
}

To:

public void setHero(boolean hero)
{
if (hero)
{
for (L2Skill s : HeroSkillTable.getHeroSkills())
addSkill(s, false); //Dont Save Hero skills to database
}
else
{
for (L2Skill s : HeroSkillTable.getHeroSkills())
super.removeSkill(s); //Just Remove skills from nonHero characters
}
_hero = hero;

sendSkillList();
}

0

3

Вещь для получения геройства после рестарта

По адресу net.sf.l2j.gameserver.handler.itemhandlers создаем новый файл под названием HeroItem.java

Код:
/*
* 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.handler.itemhandlers;

import net.sf.l2j.gameserver.handler.IItemHandler;
import net.sf.l2j.gameserver.model.L2ItemInstance;
import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
import net.sf.l2j.gameserver.model.actor.instance.L2PlayableInstance;


/**
*
* @author  HanWik
*/
public class HeroItem implements IItemHandler
{
   private static final int[] ITEM_IDS = { YOUR ITEM ID - replace here };

   public void useItem(L2PlayableInstance playable, L2ItemInstance item)
   {
      if (!(playable instanceof L2PcInstance))
         return;
      L2PcInstance activeChar = (L2PcInstance)playable;
       int itemId = item.getItemId();
      
       if (itemId = Айди вашей вещи здесь!) // Вещь что бы стать героем
       {
          activeChar.setHero(true);
          activeChar.broadcastUserInfo();
       }
   }
   
   /**
    * @see net.sf.l2j.gameserver.handler.IItemHandler#getItemIds()
    */
   public int[] getItemIds()
   {
      return ITEM_IDS;
   }
}

Открываем GameServer.java и добавляем это :

Код:
import net.sf.l2j.gameserver.handler.itemhandlers.Harvester;
на
import net.sf.l2j.gameserver.handler.itemhandlers.HeroItem;
import net.sf.l2j.gameserver.handler.itemhandlers.Maps;
Код:
_itemHandler.registerItemHandler(new BeastSpice());
    на  _itemHandler.registerItemHandler(new HeroItem());

0

4

Если вы хотите поставить запрет на ношение оружия или предметов (к примеру Дестр с луком) Вы можете юзать этот скрипт.
Вы должны вставить в network/clientpackets/UseItem.java следующие строки:

Код:
f (item.isEquipable())
        {
            if (activeChar.isDisarmed())
                return;

            if (!((L2Equip) item.getItem()).allowEquip(activeChar))
            {
                activeChar.sendPacket(new SystemMessage(SystemMessageId.NO_CONDITION_TO_EQUIP));
                return;
            }

            //Begining the script
+            if (activeChar.getClassId().getId() == 88)
+            {
+                if (item.getItemType() == L2ArmorType.MAGIC)
+                {
+                    activeChar.sendPacket(new +SystemMessage(SystemMessageId.NO_CONDITION_TO_EQUIP));
+                    return;
+                }    
+            }

К примеру Глад и Роба Армор.
Если вы хотите зделать это с каким то оружием то поменяйте эту строку

Код:
if (item.getItemType() == L2ArmorType.MAGIC)

на

Код:
if (item.getItemType() == L2WeaponType.DAGGER)

the available class-ids and item types are listed below.

Что бы избежать юзанья бага с саб классом я использую этот скрип что бы обезвредить всё оружие и доспехи с заменой класса.
model/actor/instance/L2PcInstance.java

Код:
/**
     * Changes the character's class based on the given class index.
     * <BR><BR>
     * An index of zero specifies the character's original (base) class,
     * while indexes 1-3 specifies the character's sub-classes respectively.
     *  
     * @param classIndex
     */
    public boolean setActiveClass(int classIndex)
    {
+        L2ItemInstance chest = getInventory().getPaperdollItem(Inventory.PAPERDOLL_CHEST);
+        if (chest != null)
+        {
+            
+                L2ItemInstance[] unequipped = +getInventory().unEquipItemInBodySlotAndRecord(chest.getItem().getBodyPart());
+                InventoryUpdate iu = new InventoryUpdate();
+                for (L2ItemInstance element : unequipped)
+                    iu.addModifiedItem(element);
+                sendPacket(iu);
+            
+        }
+        
+        L2ItemInstance head = getInventory().getPaperdollItem(Inventory.PAPERDOLL_HEAD);
+        if (head != null)
+        {
+            
+                L2ItemInstance[] unequipped = +getInventory().unEquipItemInBodySlotAndRecord(head.getItem().getBodyPart());
+                InventoryUpdate iu = new InventoryUpdate();
+                for (L2ItemInstance element : unequipped)
+                    iu.addModifiedItem(element);
+                sendPacket(iu);
+            
+        }
+        
+        L2ItemInstance gloves = getInventory().getPaperdollItem(Inventory.PAPERDOLL_GLOVES);
+        if (gloves != null)
+        {
+            
+                L2ItemInstance[] unequipped = +getInventory().unEquipItemInBodySlotAndRecord(gloves.getItem().getBodyPart());
+                InventoryUpdate iu = new InventoryUpdate();
+                for (L2ItemInstance element : unequipped)
+                    iu.addModifiedItem(element);
+                sendPacket(iu);
+            
+        }
+        
+        L2ItemInstance feet = getInventory().getPaperdollItem(Inventory.PAPERDOLL_FEET);
+        if (feet != null)
+        {
+            
+                L2ItemInstance[] unequipped = +getInventory().unEquipItemInBodySlotAndRecord(feet.getItem().getBodyPart());
+                InventoryUpdate iu = new InventoryUpdate();
+                for (L2ItemInstance element : unequipped)
+                    iu.addModifiedItem(element);
+                sendPacket(iu);
+            
+        }
+        
+        L2ItemInstance legs = getInventory().getPaperdollItem(Inventory.PAPERDOLL_LEGS);
+        if (legs != null)
+        {
+            
+                L2ItemInstance[] unequipped = +getInventory().unEquipItemInBodySlotAndRecord(legs.getItem().getBodyPart());
+                InventoryUpdate iu = new InventoryUpdate();
+                for (L2ItemInstance element : unequipped)
+                    iu.addModifiedItem(element);
+                sendPacket(iu);
+            
+        }
+        
+        L2ItemInstance rhand = getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND);
+        if (rhand != null)
+        {
+            
+                L2ItemInstance[] unequipped = +getInventory().unEquipItemInBodySlotAndRecord(rhand.getItem().getBodyPart());
+                InventoryUpdate iu = new InventoryUpdate();
+                for (L2ItemInstance element : unequipped)
+                    iu.addModifiedItem(element);
+                sendPacket(iu);
+            
+        }
+        
+        L2ItemInstance lhand = getInventory().getPaperdollItem(Inventory.PAPERDOLL_LHAND);
+        if (lhand != null)
+        {
+            
+                L2ItemInstance[] unequipped = +getInventory().unEquipItemInBodySlotAndRecord(lhand.getItem().getBodyPart());
+                InventoryUpdate iu = new InventoryUpdate();
+                for (L2ItemInstance element : unequipped)
+                    iu.addModifiedItem(element);
+                sendPacket(iu);
+            
+        }

Что бы вам было проще:
Class ID-s: Item types
HUMANS
-- 0=Human Fighter | 1=Warrior | 2=Gladiator | 3=Warlord | 4=Human Knight
-- 5=Paladin | 6=Dark Avenger | 7=Rogue | 8=Treasure Hunter | 9=Hawkeye
-- 10=Human Mystic | 11=Wizard | 12=Sorcerer/ss | 13=Necromancer | 14=Warlock
-- 15=Cleric | 16=Bishop | 17=Prophet

-- ELVES
-- 18=Elven Fighter | 19=Elven Knight | 20=Temple Knight | 21=Swordsinger | 22=Elven Scout
-- 23=Plainswalker | 24=Silver Ranger | 25=Elven Mystic | 26=Elven Wizard | 27=Spellsinger
-- 28=Elemental Summoner | 29=Elven Oracle | 30=Elven Elder

-- DARK ELVES
-- 31=Dark Fighter | 32=Palus Knight | 33=Shillien Knight | 34=Bladedancer | 35=Assassin
-- 36=Abyss Walker | 37=Phantom Ranger | 38=Dark Mystic | 39=Dark Wizard | 40=Spellhowler
-- 41=Phantom Summoner | 42=Shillien Oracle | 43=Shillien Elder

-- ORCS
-- 44=Orc Fighter | 45=Orc Raider | 46=Destroyer | 47=Monk | 48=Tyrant
-- 49=Orc Mystic | 50=Orc Shaman | 51=Overlord | 52=Warcryer

-- DWARVES
-- 53=Dwarven Fighter | 54=Scavenger | 55=Bounty Hunter | 56=Artisan | 57=Warsmith

-- HUMANS 3rd Professions
-- 88=Duelist | 89=Dreadnought | 90=Phoenix Knight | 91=Hell Knight | 92=Sagittarius
-- 93=Adventurer | 94=Archmage | 95=Soultaker | 96=Arcana Lord | 97=Cardinal
-- 98=Hierophant

-- ELVES 3rd Professions
-- 99=Evas Templar | 100=Sword Muse | 101=Wind Rider | 102=Moonlight Sentinel
-- 103=Mystic Muse | 104=Elemental Master | 105=Evas Saint

-- DARK ELVES 3rd Professions
-- 106=Shillien Templar | 107=Spectral Dancer | 108=Ghost Hunter | 109=Ghost Sentinel
-- 110=Storm Screamer | 111=Spectral Master | 112=Shillien Saint

-- ORCS 3rd Professions
-- 113=Titan | 114=Grand Khavatari
-- 115=Dominator | 116=Doomcryer

-- DWARVES 3rd Professions
-- 117=Fortune Seeker | 118=Maestro

-- KAMAELS
-- 123=Male Soldier | 124=Female Soldier | 125=Trooper | 126=Warder
-- 127=Berserker | 128=Male Soul Breaker | 129=Female Soul Breaker | 130=Arbalester
-- 131=Doombringer | 132=Male Soul Hound | 133=Female Soul Hound | 134=Trickster
-- 135=Inspector | 136=Judicator -Weapons-
NONE (Shield)
SWORD
BLUNT
DAGGER
BOW
POLE
ETC
FIST
DUAL
DUALFIST
BIGSWORD (Two Handed Swords)
PET
ROD
BIGBLUNT (Two handed blunt)
ANCIENT_SWORD
CROSSBOW
RAPIER

-Armors-
HEAVY
LIGHT
MAGIC

Тестилось на L2JFree.

0

5

Решение со Лже Гмами.
Этот патч позволит вам банить гма если он будет пытаться дать права тому кто не гм.

Код:
Index: D:/Workspace/GameServer_Clean/java/config/options.properties
===================================================================
--- D:/Workspace/GameServer_Clean/java/config/options.properties    (revision 708)
+++ D:/Workspace/GameServer_Clean/java/config/options.properties    (working copy)
@@ -168,6 +168,8 @@
L2WalkerRevision   = 552
# Ban account if account using l2walker and is not GM, AllowL2Walker = False
AutobanL2WalkerAcc = False
+# Ban Edited Player and Corrupt GM if a GM edits a NON GM character.
+GMEdit = False


# =================================================================
Index: D:/Workspace/GameServer_Clean/java/net/sf/l2j/Config.java
===================================================================
--- D:/Workspace/GameServer_Clean/java/net/sf/l2j/Config.java    (revision 708)
+++ D:/Workspace/GameServer_Clean/java/net/sf/l2j/Config.java    (working copy)
@@ -520,6 +520,9 @@
     public static boolean         AUTOBAN_L2WALKER_ACC;
     /** Revision of L2Walker */
     public static int             L2WALKER_REVISION;
+    
+    /** GM Edit allowed on Non Gm players? */
+    public static boolean           GM_EDIT;

     /** Allow Discard item ?*/
     public static boolean         ALLOW_DISCARDITEM;
@@ -1127,6 +1130,7 @@
                 ALLOW_L2WALKER_CLIENT           = L2WalkerAllowed.valueOf(optionsSettings.getProperty("AllowL2Walker", "False"));
                 L2WALKER_REVISION               = Integer.parseInt(optionsSettings.getProperty("L2WalkerRevision", "537"));
                 AUTOBAN_L2WALKER_ACC            = Boolean.valueOf(optionsSettings.getProperty("AutobanL2WalkerAcc", "False"));
+                GM_EDIT                            = Boolean.valueOf(optionsSettings.getProperty("GMEdit", "False"));
                 
                 ACTIVATE_POSITION_RECORDER      = Boolean.valueOf(optionsSettings.getProperty("ActivatePositionRecorder", "False"));
              
Index: D:/Workspace/GameServer_Clean/java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminExpSp.java
===================================================================
--- D:/Workspace/GameServer_Clean/java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminExpSp.java    (revision 708)
+++ D:/Workspace/GameServer_Clean/java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminExpSp.java    (working copy)
@@ -29,6 +29,8 @@
import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
import net.sf.l2j.gameserver.serverpackets.NpcHtmlMessage;
import net.sf.l2j.gameserver.serverpackets.SystemMessage;
+import net.sf.l2j.gameserver.util.IllegalPlayerAction;
+import net.sf.l2j.gameserver.util.Util;

/**
  * This class handles following admin commands:
@@ -222,8 +224,24 @@
                 smA.addString("Wrong Number Format");
                 activeChar.sendPacket(smA);
             }
-            if(expval != 0 || spval != 0)
+            /**
+             * Anti-Corrupt GMs Protection.
+             * If GMEdit enabled, a GM won't be able to Add Exp or SP to any other
+             * player that's NOT  a GM character. And in addition.. both player and
+             * GM WILL be banned.
+             */
+            if(Config.GM_EDIT && (expval != 0 || spval != 0)&& !player.isGM())
             {
+                //Warn the player about his inmediate ban.
+                player.sendMessage("A GM tried to edit you in "+expval+" exp points and in "+spval+" sp points.You will both be banned.");
+                Util.handleIllegalPlayerAction(player,"The player "+player.getName()+" has been edited. BAN!!", IllegalPlayerAction.PUNISH_KICKBAN);
+                //Warn the GM about his inmediate ban.
+                player.sendMessage("You tried to edit "+player.getName()+" by "+expval+" exp points and "+spval+". You both be banned now.");
+                Util.handleIllegalPlayerAction(activeChar,"El GM "+activeChar.getName()+" ha editado a alguien. BAN!!", IllegalPlayerAction.PUNISH_KICKBAN);
+                _log.severe("GM "+activeChar.getName()+" tried to edit "+player.getName()+". They both have been Banned.");
+            }
+            else if(expval != 0 || spval != 0)
+              {
                 //Common character information
                 SystemMessage sm = new SystemMessage(614);
                 sm.addString("Admin is adding you "+expval+" xp and "+spval+" sp.");

0

6

PvP Color system

C этим патчем цвет ника будет меняться в зависимости от количества PVP очков,а титул от количества PK

Код:
Index: /java/config/l2jmods.properties
===================================================================
--- /java/config/l2jmods.properties    (revision 174)
+++ /java/config/l2jmods.properties    (working copy)
@@ -161,4 +161,62 @@
#----------------------------------
EnableWarehouseSortingClan = False
EnableWarehouseSortingPrivate = False
-EnableWarehouseSortingFreight = False
\ No newline at end of file
+EnableWarehouseSortingFreight = False
+
+# ---------------------------------------
+# Section: PvP Title Color Change System by Level
+# ---------------------------------------
+# Each Amount will change the name color to the values defined here.
+# Example: PvpAmmount1 = 500, when a character's PvP counter reaches 500, their name color will change
+# according to the ColorForAmount value.
+# Note: Colors Must Use RBG format
+EnablePvPColorSystem = false
+
+# Pvp Amount & Name color level 1.
+PvpAmount1 = 500
+ColorForAmount1 = CCFF00
+
+# Pvp Amount & Name color level 2.
+PvpAmount2 = 1000
+ColorForAmount2 = 00FF00
+
+# Pvp Amount & Name color level 3.
+PvpAmount3 = 1500
+ColorForAmount3 = 00FF00
+
+# Pvp Amount & Name color level 4.
+PvpAmount4 = 2500
+ColorForAmount4 = 00FF00
+
+# Pvp Amount & Name color level 5.
+PvpAmount5 = 5000
+ColorForAmount5 = 00FF00
+
+# ---------------------------------------
+# Section: PvP Nick Color System by Level
+# ---------------------------------------
+# Same as above, with the difference that the PK counter changes the title color.
+# Example:  PkAmmount1 = 500, when a character's PK counter reaches 500, their title color will change
+# according to the Title For Amount
+# WAN: Colors Must Use RBG format
+EnablePkColorSystem = false
+
+# Pk Amount & Title color level 1.
+PkAmount1 = 500
+TitleForAmount1 = 00FF00
+
+# Pk Amount & Title color level 2.
+PkAmount2 = 1000
+TitleForAmount2 = 00FF00
+
+# Pk Amount & Title color level 3.
+PkAmount3 = 1500
+TitleForAmount3 = 00FF00
+
+# Pk Amount & Title color level 4.
+PkAmount4 = 2500
+TitleForAmount4 = 00FF00
+
+# Pk Amount & Title color level 5.
+PkAmount5 = 5000
+TitleForAmount5 = 00FF00
\ No newline at end of file
Index: /java/net/sf/l2j/Config.java
===================================================================
--- /java/net/sf/l2j/Config.java    (revision 174)
+++ /java/net/sf/l2j/Config.java    (working copy)
@@ -544,6 +546,28 @@
     public static boolean    L2JMOD_ENABLE_WAREHOUSESORTING_CLAN;
     public static boolean    L2JMOD_ENABLE_WAREHOUSESORTING_PRIVATE;
     public static boolean    L2JMOD_ENABLE_WAREHOUSESORTING_FREIGHT;
+    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 boolean        PK_COLOR_SYSTEM_ENABLED;
+    public static int            PK_AMOUNT1;
+    public static int            PK_AMOUNT2;
+    public static int            PK_AMOUNT3;
+    public static int            PK_AMOUNT4;
+    public static int            PK_AMOUNT5;
+    public static int            TITLE_COLOR_FOR_PK_AMOUNT1;
+    public static int            TITLE_COLOR_FOR_PK_AMOUNT2;
+    public static int            TITLE_COLOR_FOR_PK_AMOUNT3;
+    public static int            TITLE_COLOR_FOR_PK_AMOUNT4;
+    public static int            TITLE_COLOR_FOR_PK_AMOUNT5;
     
     /** ************************************************** **/
    /** L2JMods Settings -End                              **/
@@ -1654,6 +1678,34 @@
                 L2JMOD_ENABLE_WAREHOUSESORTING_CLAN     = Boolean.valueOf(L2JModSettings.getProperty("EnableWarehouseSortingClan", "False"));
                 L2JMOD_ENABLE_WAREHOUSESORTING_PRIVATE  = Boolean.valueOf(L2JModSettings.getProperty("EnableWarehouseSortingPrivate", "False"));
                 L2JMOD_ENABLE_WAREHOUSESORTING_FREIGHT  = Boolean.valueOf(L2JModSettings.getProperty("EnableWarehouseSortingFreight", "False"));
+                
+                // PVP Name Color System configs - Start
+                PVP_COLOR_SYSTEM_ENABLED = Boolean.parseBoolean(L2JModSettings.getProperty("EnablePvPColorSystem", "false"));
+                PVP_AMOUNT1 = Integer.parseInt(L2JModSettings.getProperty("PvpAmount1", "500"));
+                PVP_AMOUNT2 = Integer.parseInt(L2JModSettings.getProperty("PvpAmount2", "1000"));
+                PVP_AMOUNT3 = Integer.parseInt(L2JModSettings.getProperty("PvpAmount3", "1500"));
+                PVP_AMOUNT4 = Integer.parseInt(L2JModSettings.getProperty("PvpAmount4", "2500"));
+                PVP_AMOUNT5 = Integer.parseInt(L2JModSettings.getProperty("PvpAmount5", "5000"));
+                NAME_COLOR_FOR_PVP_AMOUNT1 = Integer.decode("0x" + L2JModSettings.getProperty("ColorForAmount1", "00FF00"));
+                NAME_COLOR_FOR_PVP_AMOUNT2 = Integer.decode("0x" + L2JModSettings.getProperty("ColorForAmount2", "00FF00"));
+                NAME_COLOR_FOR_PVP_AMOUNT3 = Integer.decode("0x" + L2JModSettings.getProperty("ColorForAmount3", "00FF00"));
+                NAME_COLOR_FOR_PVP_AMOUNT4 = Integer.decode("0x" + L2JModSettings.getProperty("ColorForAmount4", "00FF00"));
+                NAME_COLOR_FOR_PVP_AMOUNT5 = Integer.decode("0x" + L2JModSettings.getProperty("ColorForAmount4", "00FF00"));
+                // PvP Name Color System configs - End
+                
+                // PK Title Color System configs - Start
+                PK_COLOR_SYSTEM_ENABLED = Boolean.parseBoolean(L2JModSettings.getProperty("EnablePkColorSystem", "false"));
+                PK_AMOUNT1 = Integer.parseInt(L2JModSettings.getProperty("PkAmount1", "500"));
+                PK_AMOUNT2 = Integer.parseInt(L2JModSettings.getProperty("PkAmount2", "1000"));
+                PK_AMOUNT3 = Integer.parseInt(L2JModSettings.getProperty("PkAmount3", "1500"));
+                PK_AMOUNT4 = Integer.parseInt(L2JModSettings.getProperty("PkAmount4", "2500"));
+                PK_AMOUNT5 = Integer.parseInt(L2JModSettings.getProperty("PkAmount5", "5000"));
+                TITLE_COLOR_FOR_PK_AMOUNT1 = Integer.decode("0x" + L2JModSettings.getProperty("TitleForAmount1", "00FF00"));
+                TITLE_COLOR_FOR_PK_AMOUNT2 = Integer.decode("0x" + L2JModSettings.getProperty("TitleForAmount2", "00FF00"));
+                TITLE_COLOR_FOR_PK_AMOUNT3 = Integer.decode("0x" + L2JModSettings.getProperty("TitleForAmount3", "00FF00"));
+                TITLE_COLOR_FOR_PK_AMOUNT4 = Integer.decode("0x" + L2JModSettings.getProperty("TitleForAmount4", "00FF00"));
+                TITLE_COLOR_FOR_PK_AMOUNT5 = Integer.decode("0x" + L2JModSettings.getProperty("TitleForAmount5", "00FF00"));
+                //PK Title Color System configs - End

                 if (TVT_EVENT_PARTICIPATION_NPC_ID == 0)
                 {
Index: /java/net/sf/l2j/gameserver/clientpackets/EnterWorld.java
===================================================================
--- /java/net/sf/l2j/gameserver/clientpackets/EnterWorld.java    (revision 174)
+++ /java/net/sf/l2j/gameserver/clientpackets/EnterWorld.java    (working copy)
@@ -177,6 +177,16 @@
         Quest.playerEnter(activeChar);
         activeChar.sendPacket(new QuestList());
         loadTutorial(activeChar);
+
+        // ================================================================================
=
+        // Color System checks - Start =====================================================
+        // Check if the custom PvP and PK color systems are enabled and if so ==============
+        // check the character's counters and apply any color changes that must be done. ===
+        if (activeChar.getPvpKills()>=(Config.PVP_AMOUNT1) && (Config.PVP_COLOR_SYSTEM_ENABLED)) activeChar.updatePvPColor(activeChar.getPvpKills());
+        if (activeChar.getPkKills()>=(Config.PK_AMOUNT1) && (Config.PK_COLOR_SYSTEM_ENABLED)) activeChar.updatePkColor(activeChar.getPkKills());
+        // Color System checks - End =======================================================
+        // ================================================================================
=
+        
         
         if (Config.PLAYER_SPAWN_PROTECTION > 0)
             activeChar.setProtection(true);
@@ -3660,7 +3661,75 @@
             DuelManager.getInstance().broadcastToOppositTeam(this, update);
         }
    }
-    
+
+    // Custom PVP Color System - Start
+    public void updatePvPColor(int pvpKillAmount)
+    {
+        if (Config.PVP_COLOR_SYSTEM_ENABLED)
+        {
+            //Check if the character has GM access and if so, let them be.
+            if (isGM())
+                return;
+            {
+                if ((pvpKillAmount >= (Config.PVP_AMOUNT1)) && (pvpKillAmount <= (Config.PVP_AMOUNT2)))
+                {
+                    getAppearance().setNameColor(Config.NAME_COLOR_FOR_PVP_AMOUNT1);
+                }
+                else if ((pvpKillAmount >= (Config.PVP_AMOUNT2)) && (pvpKillAmount <= (Config.PVP_AMOUNT3)))
+                {
+                    getAppearance().setNameColor(Config.NAME_COLOR_FOR_PVP_AMOUNT2);
+                }
+                else if ((pvpKillAmount >= (Config.PVP_AMOUNT3)) && (pvpKillAmount <= (Config.PVP_AMOUNT4)))
+                {
+                    getAppearance().setNameColor(Config.NAME_COLOR_FOR_PVP_AMOUNT3);
+                }
+                else if ((pvpKillAmount >= (Config.PVP_AMOUNT4)) && (pvpKillAmount <= (Config.PVP_AMOUNT5)))
+                {
+                    getAppearance().setNameColor(Config.NAME_COLOR_FOR_PVP_AMOUNT4);
+                }
+                else if (pvpKillAmount >= (Config.PVP_AMOUNT5))
+                {
+                    getAppearance().setNameColor(Config.NAME_COLOR_FOR_PVP_AMOUNT5);
+                }
+            }
+        }
+    }
+    //Custom PVP Color System - End
+    
+    // Custom Pk Color System - Start
+    public void updatePkColor(int pkKillAmount)
+    {
+        if (Config.PK_COLOR_SYSTEM_ENABLED)
+        {
+            //Check if the character has GM access and if so, let them be, like above.
+            if (isGM())
+                return;
+            {
+                if ((pkKillAmount >= (Config.PK_AMOUNT1)) && (pkKillAmount <= (Config.PVP_AMOUNT2)))
+                {
+                    getAppearance().setTitleColor(Config.TITLE_COLOR_FOR_PK_AMOUNT1);
+                }
+                else if ((pkKillAmount >= (Config.PK_AMOUNT2)) && (pkKillAmount <= (Config.PVP_AMOUNT3)))
+                {
+                    getAppearance().setTitleColor(Config.TITLE_COLOR_FOR_PK_AMOUNT2);
+                }
+                else if ((pkKillAmount >= (Config.PK_AMOUNT3)) && (pkKillAmount <= (Config.PVP_AMOUNT4)))
+                {
+                    getAppearance().setTitleColor(Config.TITLE_COLOR_FOR_PK_AMOUNT3);
+                }
+                else if ((pkKillAmount >= (Config.PK_AMOUNT4)) && (pkKillAmount <= (Config.PVP_AMOUNT5)))
+                {
+                    getAppearance().setTitleColor(Config.TITLE_COLOR_FOR_PK_AMOUNT4);
+                }
+                else if (pkKillAmount >= (Config.PK_AMOUNT5))
+                {
+                    getAppearance().setTitleColor(Config.TITLE_COLOR_FOR_PK_AMOUNT5);
+                }
+            }
+        }
+    }
+    //Custom Pk Color System - End
+    
     @Override
     public final void updateEffectIcons(boolean partyOnly)
     {
@@ -4996,6 +5065,10 @@
         // Add karma to attacker and increase its PK counter
         setPvpKills(getPvpKills() + 1);

+      //Update the character's name color if they reached any of the 5 PvP levels.
+        updatePvPColor(getPvpKills());
+        broadcastUserInfo();
+
         // Send a Server->Client UserInfo packet to attacker with its Karma and PK Counter
         sendPacket(new UserInfo(this));
     }
@@ -5047,6 +5120,10 @@
         setPkKills(getPkKills() + 1);
         setKarma(getKarma() + newKarma);

+        //Update the character's title color if they reached any of the 5 PK levels.
+        updatePkColor(getPkKills());
+        broadcastUserInfo();
+        
         // Send a Server->Client UserInfo packet to attacker with its Karma and PK Counter
         sendPacket(new UserInfo(this));
     }

0

7

Как вставлять .info Команду.

Сейчас я расскажу вам как зделать что бы при вводе команды .info показывался Htm файл в котором вы можете написать всё что пожелаете.Начнём!
1.Идём в L2_GameServer_IL \ SRC \ Main \ Java \ Net \ SF \ l2j \ GameServer \ Handler \ voicedcommandhandlers
И создаём новый файл VoiceInfo.java

Код:
/*
* 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.handler.voicedcommandhandlers;

import net.sf.l2j.Config;
import net.sf.l2j.gameserver.GameServer;
import net.sf.l2j.gameserver.cache.HtmCache;
import net.sf.l2j.gameserver.handler.IVoicedCommandHandler;
import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
import net.sf.l2j.gameserver.serverpackets.NpcHtmlMessage;

/**
* @author Michiru
*
*/
public class VoiceInfo implements IVoicedCommandHandler
{
    private static String[]    VOICED_COMMANDS    =
                                            { "info" };

    /* (non-Javadoc)
    * @see net.sf.l2j.gameserver.handler.IVoicedCommandHandler#useVoicedCommand(java.lang.String, net.sf.l2j.gameserver.model.actor.instance.L2PcInstance, java.lang.String)
    */
    public boolean useVoicedCommand(String command, L2PcInstance activeChar, String target)
    {
        String htmFile = "data/html/custom/xx.htm";
        String htmContent = HtmCache.getInstance().getHtm(htmFile);
        if (htmContent != null)
        {
            NpcHtmlMessage infoHtml = new NpcHtmlMessage(1);
            infoHtml.setHtml(htmContent);
            activeChar.sendPacket(infoHtml);
        }
        else
        {
            activeChar.sendMessage("omg lame error! where is " + htmFile + " ! blame the Server Admin");
        }
        return true;
    }

    public String[] getVoicedCommandList()
    {
        return VOICED_COMMANDS;
    }
}

Вы видите что бы ввести пусть к вашему файлу поменяйте строку htmFile = "data/html/custom/xx.htm"; Теперь идём в L2_GameServer_IL \ SRC \ Main \ Java \ Net \ SF \ l2j \ GameServer \ Handler \
октрываем voicecommandhandlers.java и вставляем:

Код:
import net.sf.l2j.gameserver.handler.voicedcommandhandlers.VoiceInfo;

После

Код:
import net.sf.l2j.gameserver.handler.voicedcommandhandlers.CastleDoors;

Потом идём на 54 строчку и вставляем:

Код:
registerVoicedCommandHandler(new VoiceInfo());

0

8

Геройское свечение за PVP

Примечание: Это не будет давать геройские скиллы или давать возможность покупать геройское оружие,только ауру(свечение).

Код:
Index: java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java
===================================================================
--- java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java   (revision 1901)
+++ java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java   (working copy)
@@ -488,6 +488,11 @@

    private boolean _noble = false;
    private boolean _hero = false;
+   
+   /** Special hero aura values */
+   private int heroConsecutiveKillCount = 0;
+   private boolean isPermaHero = false;
+   private boolean isPVPHero = false; 

    /** The L2FolkInstance corresponding to the last Folk wich one the player talked. */
    private L2FolkInstance _lastFolkNpc = null;
@@ -1971,6 +1976,13 @@
    public void setPvpKills(int pvpKills)
    {
       _pvpKills = pvpKills;
+      
+      // Set hero aura if pvp kills > 100
+      if (pvpKills > 100)
+      {
+         isPermaHero = true;
+         setHeroAura(true);
+      }
    }

    /**
@@ -4678,6 +4690,14 @@

       stopRentPet();
       stopWaterTask();
+      
+      // Remove kill count for special hero aura if total pvp < 100
+      heroConsecutiveKillCount = 0;
+      if (!isPermaHero)
+      {
+         setHeroAura(false);
+         sendPacket(new UserInfo(this));
+      }
       return true;
    }

@@ -4897,6 +4917,13 @@
     {
         // Add karma to attacker and increase its PK counter
         setPvpKills(getPvpKills() + 1);
+        
+        // Increase the kill count for a special hero aura
+        heroConsecutiveKillCount++;
+        
+        // If heroConsecutiveKillCount > 4 (5+ kills) give hero aura
+        if(heroConsecutiveKillCount > 4)
+           setHeroAura(true);

         // Send a Server->Client UserInfo packet to attacker with its Karma and PK Counter
         sendPacket(new UserInfo(this));
@@ -8715,6 +8742,22 @@
    {
       return _blockList;
    }
+   
+   public void reloadPVPHeroAura()
+   {
+      sendPacket(new UserInfo(this));
+   }
+   
+   public void setHeroAura (boolean heroAura)
+   {
+      isPVPHero = heroAura;
+      return;
+   }
+   
+   public boolean getIsPVPHero()
+   {
+      return isPVPHero;
+   }

    public void setHero(boolean hero)
    {
Index: java/net/sf/l2j/gameserver/serverpackets/UserInfo.java
===================================================================
--- java/net/sf/l2j/gameserver/serverpackets/UserInfo.java   (revision 1901)
+++ java/net/sf/l2j/gameserver/serverpackets/UserInfo.java   (working copy)
@@ -337,7 +337,7 @@

         writeD(_activeChar.getClanCrestLargeId());
         writeC(_activeChar.isNoble() ? 1 : 0); //0x01: symbol on char menu ctrl+I
-        writeC((_activeChar.isHero() || (_activeChar.isGM() && Config.GM_HERO_AURA)) ? 1 : 0); //0x01: Hero Aura
+        writeC((_activeChar.isHero() || (_activeChar.isGM() && Config.GM_HERO_AURA) || _activeChar.getIsPVPHero()) ? 1 : 0); //0x01: Hero Aura

         writeC(_activeChar.isFishing() ? 1 : 0); //Fishing Mode
         writeD(_activeChar.getFishx()); //fishing x

0

9

Смена цвета ника клан лидера:

Код:
Index: L2_GameServer_It/java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java
===================================================================
--- L2_GameServer_It/java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java    (revision 1434)
+++ L2_GameServer_It/java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java    (working copy)
@@ -1659,6 +1659,21 @@
    {
        return !_recomChars.contains(target.getObjectId());
    }
+    
+    public int getNameColor()
+    {
+        if ((getAppearance().getNameColor() == 0xFFFFFF) && (getClan() != null))
+        {
+            if (getClan().getHasCastle() > 0)
+            {
+                if (isClanLeader())
+                    return 0xFFFF00;    //TODO: fill in Lord's Color
+                else
+                    return 0xFF33FF;    //TODO: fill in Member's Color
+            }
+        }
+        return getAppearance().getNameColor();
+    }

    /**
     * Set the exp of the L2PcInstance before a death
Index: L2_GameServer_It/java/net/sf/l2j/gameserver/model/L2Clan.java
===================================================================
--- L2_GameServer_It/java/net/sf/l2j/gameserver/model/L2Clan.java    (revision 1434)
+++ L2_GameServer_It/java/net/sf/l2j/gameserver/model/L2Clan.java    (working copy)
@@ -34,6 +34,7 @@
import net.sf.l2j.gameserver.datatables.SkillTable;
import net.sf.l2j.gameserver.instancemanager.CastleManager;
import net.sf.l2j.gameserver.instancemanager.SiegeManager;
+import net.sf.l2j.gameserver.model.L2World;
import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
import net.sf.l2j.gameserver.network.SystemMessageId;
import net.sf.l2j.gameserver.serverpackets.ItemList;
@@ -580,6 +581,24 @@
    public void setHasCastle(int hasCastle)
    {
        _hasCastle = hasCastle;
+        // Force online clan members to re-broadcast their info
+        //    because castle status has changed.  This is due to
+        //    new custom name color changes related to a clan's
+        //    castle (if any).
+        // This is expected to be an expensive operation though
+        //    considering how often this is called it should not
+        //    be too bad (called rarely).
+        for (L2ClanMember clanMember: _members.values())
+        {
+            L2PcInstance player = null;
+            try
+            {
+                player = L2World.getInstance().getPlayer(clanMember.getName());
+            }
+            catch(Exception e) {}
+            if (player != null)
+                player.broadcastUserInfo();
+        }
    }
    /**
     * @param hasHideout The hasHideout to set.
Index: L2_GameServer_It/java/net/sf/l2j/gameserver/serverpackets/CharInfo.java
===================================================================
--- L2_GameServer_It/java/net/sf/l2j/gameserver/serverpackets/CharInfo.java    (revision 1434)
+++ L2_GameServer_It/java/net/sf/l2j/gameserver/serverpackets/CharInfo.java    (working copy)
@@ -332,7 +332,7 @@
            writeD(_activeChar.GetFishy());
            writeD(_activeChar.GetFishz());

-            writeD(_activeChar.getAppearance().getNameColor());
+            writeD(_activeChar.getNameColor());

            writeD(0x00); // isRunning() as in UserInfo?

Index: L2_GameServer_It/java/net/sf/l2j/gameserver/serverpackets/UserInfo.java
===================================================================
--- L2_GameServer_It/java/net/sf/l2j/gameserver/serverpackets/UserInfo.java    (revision 1434)
+++ L2_GameServer_It/java/net/sf/l2j/gameserver/serverpackets/UserInfo.java    (working copy)
@@ -300,7 +300,7 @@
         writeD(_activeChar.GetFishx()); //fishing x
         writeD(_activeChar.GetFishy()); //fishing y
         writeD(_activeChar.GetFishz()); //fishing z
-        writeD(_activeChar.getAppearance().getNameColor());
+        writeD(_activeChar.getNameColor());

        //new c5
            writeC(_activeChar.isRunning() ? 0x01 : 0x00); //changes the Speed display on Status Window

0


Вы здесь » Maxi-Game » Всё для Java серверов » [core]Модификации Java серверов