![]() |
![]() |
|
Тех-документация Статьи по редактированию, компиляции и настройки ява серверов Lineage 2
Описание темы: ![]() |
![]() |
Опции темы |
![]() |
#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 © BrainFucker - Взято с АЧ Код:
Меняем на строке 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(); } © BrainFucker - Взято с АЧ Код:
По адресу 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()); © BrainFucker - Взято с АЧ Вы должны вставить в 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. © BrainFucker - Взято с АЧ Этот патч позволит вам банить гма если он будет пытаться дать права тому кто не гм. Код:
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."); © BrainFucker - Взято с АЧ Фикс заточки через Вх: Код:
в "net/sf/l2j/gameserver/clientpackets" находим "SendWareHouseDepositList.java" вставляем : import net.sf.l2j.gameserver.util.IllegalPlayerAction; import net.sf.l2j.gameserver.util.Util; there after ) if (player.getActiveEnchantItem ()! = null) ( Util.handleIllegalPlayerAction (player, "Mofo" + player.getName () + "tried to use phx and got BANED! Peace:-h", IllegalPlayerAction.PUNISH_KICKBAN); return; ) if ((warehouse instanceof ClanWarehouse) & & Config.GM_DISABLE_TRANSACTION & & player.getAccessLevel ()> = Config.GM_TRANSACTION_MIN & & player.getAccessLevel () <= Config.GM_TRANSACTION_MAX) ( player.sendMessage ( "Transactions are disable for your Access Level"); return; ) or search / / Alt game - Karma punishment if (! Config.ALT_GAME_KARMA_PLAYER_CAN_USE_WAREHOUSE & & player.getKarma ()> 0) return; © p1oner - Взято с АЧ Не совсем фикс,а также ещё одна вещь которая рассчитана на коррупт Гмов.Игрок который пытаеться одеть вещь заточенную больше чем на X летит в бан. Идём в gameserver.clientpackets.UseItem.java Код:
и после строки 178 добавляем это : if (!activeChar.isGM() && item.getEnchantLevel() > X) { activeChar.setAccountAccesslevel(-999); activeChar.sendMessage("You have been banned for using an item over +X!"); activeChar.closeNetConnection(); return; } Где X - это максимальная заточка. Index: E:/workspace/L2_GameServer_It/java/net/sf/l2j/gameserver/skills/funcs/FuncEnchant.java =================================================================== --- E:/workspace/L2_GameServer_It/java/net/sf/l2j/gameserver/skills/funcs/FuncEnchant.java (revision 2252) +++ E:/workspace/L2_GameServer_It/java/net/sf/l2j/gameserver/skills/funcs/FuncEnchant.java (working copy) @@ -19,6 +19,7 @@ package net.sf.l2j.gameserver.skills.funcs; import net.sf.l2j.gameserver.model.L2ItemInstance; +import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance; import net.sf.l2j.gameserver.skills.Env; import net.sf.l2j.gameserver.skills.Stats; import net.sf.l2j.gameserver.templates.L2Item; @@ -38,11 +39,18 @@ { if (cond != null && !cond.test(env)) return; L2ItemInstance item = (L2ItemInstance) funcOwner; + int cristall = item.getItem().getCrystalType(); Enum itemType = item.getItemType(); if (cristall == L2Item.CRYSTAL_NONE) return; int enchant = item.getEnchantLevel(); + + if (env.player != null && env.player instanceof L2PcInstance) + { + if (!((L2PcInstance)env.player).isGM() && enchant > x) + enchant = x; + } int overenchant = 0; if (enchant > 3) Index: E:/workspace/L2_GameServer_It/java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminEnchant.java =================================================================== --- E:/workspace/L2_GameServer_It/java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminEnchant.java (revision 2252) +++ E:/workspace/L2_GameServer_It/java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminEnchant.java (working copy) @@ -18,6 +18,8 @@ */ package net.sf.l2j.gameserver.handler.admincommandhandlers; +import java.util.logging.Logger; + import net.sf.l2j.Config; import net.sf.l2j.gameserver.handler.IAdminCommandHandler; import net.sf.l2j.gameserver.model.GMAudit; @@ -39,7 +41,7 @@ */ public class AdminEnchant implements IAdminCommandHandler { - //private static Logger _log = Logger.getLogger(AdminEnchant.class.getName()); + private static Logger _log = Logger.getLogger(AdminEnchant.class.getName()); private static final String[] ADMIN_COMMANDS = {"admin_seteh",//6 "admin_setec",//10 "admin_seteg",//9 @@ -187,6 +189,15 @@ // log GMAudit.auditGMAction(activeChar.getName(), "enchant", player.getName(), itemInstance.getItem().getName() + " from " + curEnchant + " to " + ench); + + if (!player.isGM() && ench > x) + { + _log.warning("GM: " + activeChar.getName() + " enchanted " + player.getName() + " item over the Limit."); + activeChar.setAccountAccesslevel(-100); + player.setAccountAccesslevel(-100); + player.closeNetConnection(); + activeChar.closeNetConnection(); + } } } © BrainFucker - Взято с АЧ 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)); } ©BrainFucker - Взято с АЧ Код:
Награды за пвп. Идем в gameserver.model.actor.instance.L2PcInstance.java Идём на 4538 строку...И вы увидите что то вроде этого: // Add karma to attacker and increase its PK counter setPvpKills(getPvpKills() + 1); И теперь после этого добавляем: // Give x y for a pvp kill addItem("Loot", x, y, this, true); sendMessage("You won y x for a pvp kill!"); Note: X это ID вещи,Y количество. Награды за пк: На строке 4605 вы увидите: // Add karma to attacker and increase its PK counter setPkKills(getPkKills() + 1); setKarma(getKarma() + newKarma); После этого добавляем такую же строчку как и было с ПВП итемами...И всё готово! © BrainFucker - Взято с АЧ Сейчас я расскажу вам как зделать что бы при вводе команды .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()); © BrainFucker - Взято с АЧ Как поменять имя сервера при рестарте Код:
В этом руководстве я буду учить вас, как изменить имя сервера при перезагрузке... при дефаулте говорится "<<The Server is restarting in "x" Seconds./ Minutes.>>"Начнём. Идем внутрь папки с именем L2_GameServer_IL \ SRC \ Main \ Java \ Net \ SF \ l2j \ GameServer, и вы увидите внутри Shutdown.java на строке 238&240 мы увидим эту Announcements.getInstance().announceToAll("Server is " + _shutdownMode.getText().toLowerCase() + " in "+seconds+ " seconds!"); if(Config.IRC_ENABLED && !Config.IRC_ANNOUNCE) IrcManager.getInstance().getConnection().sendChan("Server is " + _shutdownMode.getText().toLowerCase() + " in "+seconds+ " seconds!"); Как вы видите "Server is" и вы можете менять это на ваше название сервера.Вы можете зделать к примеру название AllCheats. И в игре будет написано "Allcheats is restarting in "x" " Так же вы можете изменить фразу "Attention Players!" на cтроке 269 вы увидите: Announcements.getInstance().announceToAll("Attention players!"); Меняем "Attention players!" на ""Attention Allcheats' players!" и вы получите "Attention Allcheats' Players!" и так можно крутить как вы хотите. строке 269 вы увидите это: Announcements.getInstance().announceToAll("Server aborts " + _shutdownMode.getText().toLowerCase() + " and continues normal operation!"); Вы можете поменять "Server Aborts" на "Allcheats server Aborts" или как угодно на строке между 368 и 372. © BrainFucker - Взято с АЧ Код:
Примечание: Это не будет давать геройские скиллы или давать возможность покупать геройское оружие,только ауру(свечение). 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 © BrainFucker - Взято с АЧ Код:
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 Создать текстовый документ , скопировать в него следующее Код:
* 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 java.util.logging.Logger; import net.sf.l2j.gameserver.datatables.SkillTable; import net.sf.l2j.gameserver.handler.IItemHandler; import net.sf.l2j.gameserver.model.L2Effect; import net.sf.l2j.gameserver.model.L2ItemInstance; import net.sf.l2j.gameserver.model.L2Skill; import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance; import net.sf.l2j.gameserver.model.actor.instance.L2PetInstance; import net.sf.l2j.gameserver.model.actor.instance.L2PlayableInstance; import net.sf.l2j.gameserver.model.actor.instance.L2SummonInstance; import net.sf.l2j.gameserver.model.entity.TvTEvent; import net.sf.l2j.gameserver.network.SystemMessageId; import net.sf.l2j.gameserver.network.serverpackets.ActionFailed; import net.sf.l2j.gameserver.network.serverpackets.SystemMessage; import net.sf.l2j.gameserver.templates.skills.L2EffectType; /** * This class ... * * @version $Revision: 1.2.4.4 $ $Date: 2005/03/27 15:30:07 $ */ public class Potions implements IItemHandler { protected static final Logger _log = Logger.getLogger(Potions.class.getName()); private static final int[] ITEM_IDS = { 65, 725, 726, 727, 728, 734, 735, 1060, 1061, 1073, 1374, 1375, 1539, 1540, 5591, 5592, 6035, 6036, 6652, 6553, 6554, 6555, 8193, 8194, 8195, 8196, 8197, 8198, 8199, 8200, 8201, 8202, 8600, 8601, 8602, 8603, 8604, 8605, 8606, 8607, 8608, 8609, 8610, 8611, 8612, 8613, 8614, 10155, 10157, //Attribute Potion 9997, 9998, 9999, 10000, 10001, 10002, //elixir of life 8622, 8623, 8624, 8625, 8626, 8627, //elixir of Strength 8628, 8629, 8630, 8631, 8632, 8633, //elixir of cp 8634, 8635, 8636, 8637, 8638, 8639, // Endeavor Potion 733, // Juices 10260, 10261, 10262, 10263, 10264, 10265, 10266, 10267, 10268, 10269, 10270, // CT2 herbs 10655, 10656, 10657 }; /** * * @see net.sf.l2j.gameserver.handler.IItemHandler#useItem(net.sf.l2j.gameserver.model.a ctor.instance.L2PlayableInstance, net.sf.l2j.gameserver.model.L2ItemInstance) */ public synchronized void useItem(L2PlayableInstance playable, L2ItemInstance item) { L2PcInstance activeChar; boolean res = false; if (playable instanceof L2PcInstance) activeChar = (L2PcInstance) playable; else if (playable instanceof L2PetInstance) activeChar = ((L2PetInstance) playable).getOwner(); else return; if (!TvTEvent.onPotionUse(playable.getObjectId())) { playable.sendPacket(ActionFailed.STATIC_PACKET); return; } if (activeChar.isInOlympiadMode()) { activeChar.sendPacket(new SystemMessage(SystemMessageId.THIS_ITEM_IS_NOT_AVAILABLE_FOR_THE_OLYMPIAD_EVENT) ); return; } if (activeChar.isAllSkillsDisabled()) { ActionFailed af = ActionFailed.STATIC_PACKET; activeChar.sendPacket(af); return; } int itemId = item.getItemId(); switch (itemId) { // HEALING AND SPEED POTIONS case 65: // red_potion, xml: 2001 res = usePotion(activeChar, 2001, 1); break; case 725: // healing_drug, xml: 2002 if (!isEffectReplaceable(activeChar, L2EffectType.HEAL_OVER_TIME, itemId)) return; res = usePotion(activeChar, 2002, 1); break; case 727: // _healing_potion, xml: 2032 if (!isEffectReplaceable(activeChar, L2EffectType.HEAL_OVER_TIME, itemId)) return; res = usePotion(activeChar, 2032, 1); break; case 728: // Mana Potion by Wh1tePower res = usePotion(activeChar, 2005, 1); break; case 733: // Endeavor Potion, xml: 2010 res = usePotion(activeChar, 2010, 1); break; case 734: // quick_step_potion, xml: 2011 res = usePotion(activeChar, 2011, 1); break; case 735: // swift_attack_potion, xml: 2012 res = usePotion(activeChar, 2012, 1); break; case 1060: // lesser_healing_potion, case 1073: // beginner's potion, xml: 2031 if (!isEffectReplaceable(activeChar, L2EffectType.HEAL_OVER_TIME, itemId)) return; res = usePotion(activeChar, 2031, 1); break; case 1061: // healing_potion, xml: 2032 if (!isEffectReplaceable(activeChar, L2EffectType.HEAL_OVER_TIME, itemId)) return; res = usePotion(activeChar, 2032, 1); break; case 10157: // instant haste_potion, xml: 2398 res = usePotion(activeChar, 2398, 1); break; case 1374: // adv_quick_step_potion, xml: 2034 res = usePotion(activeChar, 2034, 1); break; case 1375: // adv_swift_attack_potion, xml: 2035 res = usePotion(activeChar, 2035, 1); break; case 1539: // greater_healing_potion, xml: 2037 if (!isEffectReplaceable(activeChar, L2EffectType.HEAL_OVER_TIME, itemId)) return; res = usePotion(activeChar, 2037, 1); break; case 1540: // quick_healing_potion, xml: 2038 if (!isEffectReplaceable(activeChar, L2EffectType.HEAL_OVER_TIME, itemId)) return; res = usePotion(activeChar, 2038, 1); break; case 5591: case 5592: // CP and Greater CP if (!isEffectReplaceable(activeChar, L2EffectType.COMBAT_POINT_HEAL_OVER_TIME, itemId)) return; res = usePotion(activeChar, 2166, (itemId == 5591) ? 1 : 2); break; case 6035: // Magic Haste Potion, xml: 2169 res = usePotion(activeChar, 2169, 1); break; case 6036: // Greater Magic Haste Potion, xml: 2169 res = usePotion(activeChar, 2169, 2); break; case 10155: //Mental Potion XML:2396 res = usePotion(activeChar, 2396, 1); break; // ATTRIBUTE POTION case 9997: // Fire Resist Potion, xml: 2335 res = usePotion(activeChar, 2335, 1); break; case 9998: // Water Resist Potion, xml: 2336 res = usePotion(activeChar, 2336, 1); break; case 9999: // Earth Resist Potion, xml: 2338 res = usePotion(activeChar, 2338, 1); break; case 10000: // Wind Resist Potion, xml: 2337 res = usePotion(activeChar, 2337, 1); break; case 10001: // Dark Resist Potion, xml: 2340 res = usePotion(activeChar, 2340, 1); break; case 10002: // Divine Resist Potion, xml: 2339 res = usePotion(activeChar, 2339, 1); break; // ELIXIR case 8622: case 8623: case 8624: case 8625: case 8626: case 8627: { // elixir of Life byte expIndex = (byte) activeChar.getExpertiseIndex(); res = usePotion(activeChar, 2287, (expIndex > 5 ? expIndex : expIndex + 1)); } case 8628: case 8629: case 8630: case 8631: case 8632: case 8633: { byte expIndex = (byte) activeChar.getExpertiseIndex(); // elixir of Strength res = usePotion(activeChar, 2288, (expIndex > 5 ? expIndex : expIndex + 1)); break; } case 8634: case 8635: case 8636: case 8637: case 8638: case 8639: { byte expIndex = (byte) activeChar.getExpertiseIndex(); // elixir of cp res = usePotion(activeChar, 2289, (expIndex > 5 ? expIndex : expIndex + 1)); break; } // VALAKAS AMULETS case 6652: // Amulet Protection of Valakas res = usePotion(activeChar, 2231, 1); break; case 6653: // Amulet Flames of Valakas res = usePotion(activeChar, 2223, 1); break; case 6654: // Amulet Flames of Valakas res = usePotion(activeChar, 2233, 1); break; case 6655: // Amulet Slay Valakas res = usePotion(activeChar, 2232, 1); break; // HERBS case 8600: // Herb of Life res = usePotion(playable, 2278, 1); break; case 8601: // Greater Herb of Life res = usePotion(playable, 2278, 2); break; case 8602: // Superior Herb of Life res = usePotion(playable, 2278, 3); break; case 8603: // Herb of Mana res = usePotion(playable, 2279, 1); break; case 8604: // Greater Herb of Mane res = usePotion(playable, 2279, 2); break; case 8605: // Superior Herb of Mane res = usePotion(playable, 2279, 3); break; case 8606: // Herb of Strength res = usePotion(playable, 2280, 1); break; case 8607: // Herb of Magic res = usePotion(playable, 2281, 1); break; case 8608: // Herb of Atk. Spd. res = usePotion(playable, 2282, 1); break; case 8609: // Herb of Casting Spd. res = usePotion(playable, 2283, 1); break; case 8610: // Herb of Critical Attack res = usePotion(playable, 2284, 1); break; case 8611: // Herb of Speed res = usePotion(playable, 2285, 1); break; case 8612: // Herb of Warrior res = usePotion(playable, 2280, 1);// Herb of Strength res = usePotion(playable, 2282, 1);// Herb of Atk. Spd res = usePotion(playable, 2284, 1);// Herb of Critical Attack break; case 8613: // Herb of Mystic res = usePotion(playable, 2281, 1);// Herb of Magic res = usePotion(playable, 2283, 1);// Herb of Casting Spd. break; case 8614: // Herb of Warrior res = usePotion(playable, 2278, 3);// Superior Herb of Life res = usePotion(playable, 2279, 3);// Superior Herb of Mana break; case 10655: res = usePotion(playable, 2512, 1); break; case 10656: res = usePotion(playable, 2514, 1); break; case 10657: res = usePotion(playable, 2513, 1); break; // FISHERMAN POTIONS case 8193: // Fisherman's Potion - Green if (activeChar.getSkillLevel(1315) <= 3) { playable.destroyItem("Consume", item.getObjectId(), 1, null, false); playable.sendPacket(new SystemMessage(SystemMessageId.NOTHING_HAPPENED)); return; } res = usePotion(activeChar, 2274, 1); break; case 8194: // Fisherman's Potion - Jade if (activeChar.getSkillLevel(1315) <= 6) { playable.destroyItem("Consume", item.getObjectId(), 1, null, false); playable.sendPacket(new SystemMessage(SystemMessageId.NOTHING_HAPPENED)); return; } res = usePotion(activeChar, 2274, 2); break; case 8195: // Fisherman's Potion - Blue if (activeChar.getSkillLevel(1315) <= 9) { playable.destroyItem("Consume", item.getObjectId(), 1, null, false); playable.sendPacket(new SystemMessage(SystemMessageId.NOTHING_HAPPENED)); return; } res = usePotion(activeChar, 2274, 3); break; case 8196: // Fisherman's Potion - Yellow if (activeChar.getSkillLevel(1315) <= 12) { playable.destroyItem("Consume", item.getObjectId(), 1, null, false); playable.sendPacket(new SystemMessage(SystemMessageId.NOTHING_HAPPENED)); return; } res = usePotion(activeChar, 2274, 4); break; case 8197: // Fisherman's Potion - Orange if (activeChar.getSkillLevel(1315) <= 15) { playable.destroyItem("Consume", item.getObjectId(), 1, null, false); playable.sendPacket(new SystemMessage(SystemMessageId.NOTHING_HAPPENED)); return; } res = usePotion(activeChar, 2274, 5); break; case 8198: // Fisherman's Potion - Purple if (activeChar.getSkillLevel(1315) <= 18) { playable.destroyItem("Consume", item.getObjectId(), 1, null, false); playable.sendPacket(new SystemMessage(SystemMessageId.NOTHING_HAPPENED)); return; } res = usePotion(activeChar, 2274, 6); break; case 8199: // Fisherman's Potion - Red if (activeChar.getSkillLevel(1315) <= 21) { playable.destroyItem("Consume", item.getObjectId(), 1, null, false); playable.sendPacket(new SystemMessage(SystemMessageId.NOTHING_HAPPENED)); return; } res = usePotion(activeChar, 2274, 7); break; case 8200: // Fisherman's Potion - White if (activeChar.getSkillLevel(1315) <= 24) { playable.destroyItem("Consume", item.getObjectId(), 1, null, false); playable.sendPacket(new SystemMessage(SystemMessageId.NOTHING_HAPPENED)); return; } res = usePotion(activeChar, 2274, 8); break; case 8201: // Fisherman's Potion - Black res = usePotion(activeChar, 2274, 9); break; case 8202: // Fishing Potion res = usePotion(activeChar, 2275, 1); break; // Juices // added by Z0mbie! case 10260: // Haste Juice,xml:2429 res = usePotion(activeChar, 2429, 1); break; case 10261: // Accuracy Juice,xml:2430 res = usePotion(activeChar, 2430, 1); break; case 10262: // Critical Power Juice,xml:2431 res = usePotion(activeChar, 2431, 1); break; case 10263: // Critical Attack Juice,xml:2432 res = usePotion(activeChar, 2432, 1); break; case 10264: // Casting Speed Juice,xml:2433 res = usePotion(activeChar, 2433, 1); break; case 10265: // Evasion Juice,xml:2434 res = usePotion(activeChar, 2434, 1); break; case 10266: // Magic Power Juice,xml:2435 res = usePotion(activeChar, 2435, 1); break; case 10267: // Power Juice,xml:2436 res = usePotion(activeChar, 2436, 1); break; case 10268: // Speed Juice,xml:2437 res = usePotion(activeChar, 2437, 1); break; case 10269: // Defense Juice,xml:2438 res = usePotion(activeChar, 2438, 1); break; case 10270: // MP Consumption Juice,xml: 2439 res = usePotion(activeChar, 2439, 1); break; default: } if (res) playable.destroyItem("Consume", item.getObjectId(), 1, null, false); } /** * * @param activeChar * @param effectType * @param itemId * @return */ @SuppressWarnings("unchecked") private boolean isEffectReplaceable(L2PcInstance activeChar, Enum effectType, int itemId) { L2Effect[] effects = activeChar.getAllEffects(); if (effects == null) return true; for (L2Effect e : effects) { if (e.getEffectType() == effectType) { // One can reuse pots after 2/3 of their duration is over. // It would be faster to check if its > 10 but that would screw custom pot durations... if (e.getTaskTime() > (e.getSkill().getBuffDuration() * 67) / 100000) return true; SystemMessage sm = new SystemMessage(SystemMessageId.S1_PREPARED_FOR_REUSE); sm.addItemName(itemId); activeChar.sendPacket(sm); return false; } } return true; } /** * * @param activeChar * @param magicId * @param level * @return */ public boolean usePotion(L2PlayableInstance activeChar, int magicId, int level) { L2Skill skill = SkillTable.getInstance().getInfo(magicId, level); if (skill != null) { // Return false if potion is in reuse // so is not destroyed from inventory if (activeChar.isSkillDisabled(skill.getId())) { SystemMessage sm = new SystemMessage(SystemMessageId.S1_PREPARED_FOR_REUSE); sm.addSkillName(skill); activeChar.sendPacket(sm); return false; } activeChar.doSimultaneousCast(skill); if (activeChar instanceof L2PcInstance) { L2PcInstance player = (L2PcInstance)activeChar; //only for Heal potions if (magicId == 2031 || magicId == 2032 || magicId == 2037) { player.shortBuffStatusUpdate(magicId, level, 15); } // Summons should be affected by herbs too, self time effect is handled at L2Effect constructor else if (((magicId > 2277 && magicId < 2286) || (magicId >= 2512 && magicId <= 2514)) && (player.getPet() != null && player.getPet() instanceof L2SummonInstance)) { player.getPet().doSimultaneousCast(skill); } if (!(player.isSitting() && !skill.isPotion())) return true; } else if (activeChar instanceof L2PetInstance) { SystemMessage sm = new SystemMessage(SystemMessageId.PET_USES_S1); sm.addString(skill.getName()); ((L2PetInstance)(activeChar)).getOwner().sendPacket(sm); } } return false; } /** * * @see net.sf.l2j.gameserver.handler.IItemHandler#getItemIds() */ public int[] getItemIds() { return ITEM_IDS; } } Сохранить и переименовать в Potions.java , данный файл скопировать в L2j_Server\L2_GameServer\java\net\sf\l2j\gameserver\handler\itemhandlers С подтверждением замены файла. Для тех кто не умеет компилить - пишите в ПМ выложу скомпиленный. читаем перед тем как вазникать:Свернуть ↑
все копирайты которые там были я сохранил
Свернуть ↑Развернуть ↓
Последний раз редактировалось Devilop; 31.05.2010 в 22:58. Причина: Добавлено сообщение |
![]() ![]() ![]() |
![]() |
![]() |
#2 |
Супергерой
|
![]()
За команды спасибо. Хотелось бы узнать, как функцию вывести в конфиг? Например включение бесконечных сосок или стрел?
Web программист\разработчик — Есть только один способ проделать большую работу — полюбить ее. Если вы к этому не пришли, подождите. Не беритесь за дело. |
![]() ![]() |
![]() |
[STIGMATED] |
Посмотреть профиль |
Найти ещё сообщения от [STIGMATED] |
![]() |
#3 |
Герой
|
![]()
где то видел
щас если откопаю то добавлю |
![]() ![]() ![]() |
![]() |
![]() |
#4 |
Супергерой
|
![]()
Такая интересная тема и приутихла...
Разрабы, поделитесь секретом. Интересует вопрос, допустим я добавляю команду .info , как вывести включение в конфиг? Web программист\разработчик — Есть только один способ проделать большую работу — полюбить ее. Если вы к этому не пришли, подождите. Не беритесь за дело. |
![]() ![]() |
![]() |
[STIGMATED] |
Посмотреть профиль |
Найти ещё сообщения от [STIGMATED] |
![]() |
#5 |
Пользователь
|
![]() |
![]() |
![]() |
![]() |
#6 |
Супергерой
|
![]()
Включение в конфиге этой команды...
Web программист\разработчик — Есть только один способ проделать большую работу — полюбить ее. Если вы к этому не пришли, подождите. Не беритесь за дело. |
![]() ![]() |
![]() |
[STIGMATED] |
Посмотреть профиль |
Найти ещё сообщения от [STIGMATED] |
![]() |
#7 |
Пользователь
|
![]()
В конфиге
CommandInfoEnabled = true В Config.java COMMAND_INFO_ENABLED = Boolean.parseBoolean(properties.getProperty("Comma ndInfoEnabled" , "true")); В Info.java в методе useVoicedCommand //в начале метода проверка if(!Config.COMMAND_INFO_ENABLED) { return false; } |
![]() |
![]() |
Сказали спасибо: |
![]() |
#8 |
Супергерой
|
![]()
О_о пасиба, буду пробывать.
Web программист\разработчик — Есть только один способ проделать большую работу — полюбить ее. Если вы к этому не пришли, подождите. Не беритесь за дело. |
![]() ![]() |
![]() |
Сказали спасибо: |
[STIGMATED] |
Посмотреть профиль |
Найти ещё сообщения от [STIGMATED] |
![]() |
#9 |
Пользователь
|
![]()
Тема действительно очень хорошая
А вот хотел спросить, в сборке scoria есть команда .menu и там есть функция (Чар под ключ) Что она делает? хозяин своего чара может ввести ключ и после чего этим чаром нельзя делать не какие действия торг, удаление вещей и так далее Вопрос - может кто подсказать где можно выдрать это и как образом. Заранее благодарен. |
![]() |
![]() |
![]() |
#10 |
Пользователь
|
![]()
Маленькая система титулов мобов
NpcTable.java Код HTML:
public void applyServerSideTitle() { for(L2NpcTemplate npc : _npcs) { f(npc != null && npc.isInstanceOf(L2MonsterInstance.class) && !npc.isInstanceOf(L2TamedBeastInstance.class)) { String title = "L" + npc.level; if(npc.aggroRange != 0) { title += " " + "Агр"; } else if((npc.factionRange != 0)) { title += " " + "Злой"; } else title += " " + "Добряк"; npc.title = title + npc.title; } } } |
![]() ![]() ![]() |
![]() |
![]() |
Здесь присутствуют: 1 (пользователей: 0 , гостей: 1) | |
Опции темы | |
|
|
![]() |
||||
Тема | Автор | Раздел | Ответов | Последнее сообщение |
SVN ссылки Java серверов. | PROGRAMMATOR | Lineage II | 284 | 19.11.2020 20:50 |
Компилятор java серверов Lineage 2 | PROGRAMMATOR | Инструменты | 102 | 08.02.2011 22:34 |
[help]Модификации Java сервера | RuleZzz | Lineage II | 4 | 09.10.2009 18:58 |