Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Index: java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java
- ===================================================================
- --- java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java (revision 114)
- +++ java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java (working copy)
- @@ -26,6 +26,7 @@
- import java.util.Collection;
- import java.util.List;
- import java.util.Map;
- +import java.util.Set;
- import java.util.concurrent.Future;
- import java.util.concurrent.ScheduledFuture;
- import java.util.concurrent.TimeUnit;
- @@ -223,6 +224,9 @@
- */
- public final class L2PcInstance extends L2Playable
- {
- + // Namers.
- + private boolean isNamer = false;
- +
- // Character Skill SQL String Definitions:
- private static final String RESTORE_SKILLS_FOR_CHAR = "SELECT skill_id,skill_level FROM character_skills WHERE char_obj_id=? AND class_index=?";
- private static final String ADD_NEW_SKILL = "INSERT INTO character_skills (char_obj_id,skill_id,skill_level,class_index) VALUES (?,?,?,?)";
- @@ -4771,6 +4775,29 @@
- {
- // Add karma to attacker and increase its PK counter
- setPvpKills(getPvpKills() + 1);
- +
- + if (isNamer())
- + {
- + if (Config.NAMERS_NAME_COLOR)
- + {
- + if (!Config.NAMES_NAME_COLOR_STATIC)
- + {
- + if (Config.COLOR_NAME_DEPENDS.equals("PVP"))
- + {
- + Set<Integer> pvps = Config.NAMERS_NAME_COLORS.keySet();
- +
- + for (int i : pvps)
- + {
- + if (getPvpKills() >= i)
- + {
- + getAppearance().setNameColor(Config.NAMERS_NAME_COLORS.get(i));
- + broadcastUserInfo();
- + }
- + }
- + }
- + }
- + }
- + }
- // Send a Server->Client UserInfo packet to attacker with its Karma and PK Counter
- sendPacket(new UserInfo(this));
- @@ -4829,6 +4856,29 @@
- // Add karma to attacker and increase its PK counter
- setPkKills(getPkKills() + 1);
- setKarma(getKarma() + newKarma);
- +
- + if (isNamer())
- + {
- + if (Config.NAMERS_TITLE_COLOR)
- + {
- + if (!Config.NAMES_TITLE_COLOR_STATIC)
- + {
- + if (Config.COLOR_TITLE_DEPENDS.equals("PK"))
- + {
- + Set<Integer> pks = Config.NAMERS_TITLE_COLORS.keySet();
- +
- + for (int i : pks)
- + {
- + if (getPkKills() >= i)
- + {
- + getAppearance().setTitleColor(Config.NAMERS_TITLE_COLORS.get(i));
- + broadcastUserInfo();
- + }
- + }
- + }
- + }
- + }
- + }
- // Send a Server->Client UserInfo packet to attacker with its Karma and PK Counter
- sendPacket(new UserInfo(this));
- @@ -11355,4 +11405,139 @@
- }
- }
- }
- +
- + public void setNamer(boolean val)
- + {
- + if (!val)
- + {
- + for (int i : Config.NAMERS_CUSTOM_SKILLS.keySet())
- + {
- + L2Skill s = SkillTable.getInstance().getInfo(i, Config.NAMERS_CUSTOM_SKILLS.get(i));
- + removeSkill(s);
- + }
- +
- + setName(getName().substring(Config.NAMERS_NAME_PREFIX.length()));
- + getAppearance().setNameColor(0xFFFFFF);
- + broadcastUserInfo();
- + }
- + else
- + {
- + if (Config.ALLOW_NAMERS_CUSTOM_SKILLS)
- + {
- + for (int i : Config.NAMERS_CUSTOM_SKILLS.keySet())
- + {
- + L2Skill s = SkillTable.getInstance().getInfo(i, Config.NAMERS_CUSTOM_SKILLS.get(i));
- + addSkill(s);
- + }
- + }
- +
- + if (Config.NAMERS_HAVE_NAME_PREFIX)
- + {
- + setName(Config.NAMERS_NAME_PREFIX+getName());
- + }
- +
- + if (Config.NAMERS_NAME_COLOR)
- + {
- + if (Config.NAMES_NAME_COLOR_STATIC)
- + {
- + getAppearance().setNameColor(Config.NAMES_NAME_STATIC_COLOR);
- + broadcastUserInfo();
- + }
- + else
- + {
- + if (Config.COLOR_NAME_DEPENDS.equals("PVP"))
- + {
- + Set<Integer> pvps = Config.NAMERS_NAME_COLORS.keySet();
- +
- + for (int i : pvps)
- + {
- + if (getPvpKills() == i)
- + {
- + getAppearance().setNameColor(Config.NAMERS_NAME_COLORS.get(i));
- + }
- + }
- + }
- + if (Config.COLOR_NAME_DEPENDS.equals("PK"))
- + {
- + Set<Integer> pks = Config.NAMERS_NAME_COLORS.keySet();
- +
- + for (int i : pks)
- + {
- + if (getPkKills() == i)
- + {
- + getAppearance().setNameColor(Config.NAMERS_NAME_COLORS.get(i));
- + }
- + }
- + }
- + if (Config.COLOR_NAME_DEPENDS.equals("LEVEL"))
- + {
- + Set<Integer> levels = Config.NAMERS_NAME_COLORS.keySet();
- +
- + for (int i : levels)
- + {
- + if (getLevel() == i)
- + {
- + getAppearance().setNameColor(Config.NAMERS_NAME_COLORS.get(i));
- + }
- + }
- + }
- + }
- + }
- +
- + if (Config.NAMERS_TITLE_COLOR)
- + {
- + if (Config.NAMES_TITLE_COLOR_STATIC)
- + {
- + getAppearance().setTitleColor(Config.NAMES_TITLE_STATIC_COLOR);
- + broadcastUserInfo();
- + }
- + else
- + {
- + if (Config.COLOR_TITLE_DEPENDS.equals("PVP"))
- + {
- + Set<Integer> pvps = Config.NAMERS_TITLE_COLORS.keySet();
- +
- + for (int i : pvps)
- + {
- + if (getPvpKills() >= i)
- + {
- + getAppearance().setTitleColor(Config.NAMERS_TITLE_COLORS.get(i));
- + }
- + }
- + }
- + if (Config.COLOR_TITLE_DEPENDS.equals("PK"))
- + {
- + Set<Integer> pks = Config.NAMERS_TITLE_COLORS.keySet();
- +
- + for (int i : pks)
- + {
- + if (getPkKills() >= i)
- + {
- + getAppearance().setTitleColor(Config.NAMERS_TITLE_COLORS.get(i));
- + }
- + }
- + }
- + if (Config.COLOR_TITLE_DEPENDS.equals("LEVEL"))
- + {
- + Set<Integer> levels = Config.NAMERS_TITLE_COLORS.keySet();
- +
- + for (int i : levels)
- + {
- + if (getLevel() >= i)
- + {
- + getAppearance().setTitleColor(Config.NAMERS_TITLE_COLORS.get(i));
- + }
- + }
- + }
- + }
- + }
- + }
- +
- + isNamer = val;
- + }
- +
- + public boolean isNamer()
- + {
- + return isNamer;
- + }
- }
- \ No newline at end of file
- Index: java/net/sf/l2j/gameserver/handler/chathandlers/ChatAll.java
- ===================================================================
- --- java/net/sf/l2j/gameserver/handler/chathandlers/ChatAll.java (revision 114)
- +++ java/net/sf/l2j/gameserver/handler/chathandlers/ChatAll.java (working copy)
- @@ -15,9 +15,13 @@
- package net.sf.l2j.gameserver.handler.chathandlers;
- import java.util.Collection;
- +import java.util.Vector;
- +import net.sf.l2j.Config;
- import net.sf.l2j.gameserver.handler.IChatHandler;
- +import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminNameSystem;
- import net.sf.l2j.gameserver.model.BlockList;
- +import net.sf.l2j.gameserver.model.L2World;
- import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
- import net.sf.l2j.gameserver.network.serverpackets.CreatureSay;
- @@ -38,14 +42,47 @@
- {
- CreatureSay cs = new CreatureSay(activeChar.getObjectId(), type, activeChar.getName(), text);
- Collection<L2PcInstance> plrs = activeChar.getKnownList().getKnownPlayers().values();
- -
- - for (L2PcInstance player : plrs)
- +
- + boolean saidToNamers = false;
- + if (activeChar.isNamer())
- {
- - if (player != null && activeChar.isInsideRadius(player, 1250, false, true) && !BlockList.isBlocked(player, activeChar))
- - player.sendPacket(cs);
- + if (Config.NAMERS_CUSTOM_CHAT)
- + {
- + if (text.startsWith(Config.NAMERS_CUSTOM_CHAT_PREFIX))
- + {
- + String txt = text.substring(1);
- + CreatureSay csN = new CreatureSay(activeChar.getObjectId(), 15, activeChar.getName(), txt);
- + Vector<L2PcInstance> namers = new Vector<L2PcInstance>();
- +
- + for (String s : AdminNameSystem.getAllNamers())
- + {
- + L2PcInstance p = L2World.getInstance().getPlayer(s);
- + if (p != null)
- + {
- + namers.add(p);
- + }
- + }
- +
- + for (L2PcInstance p : namers)
- + {
- + p.sendPacket(csN);
- + }
- +
- + saidToNamers = true;
- + }
- + }
- }
- +
- + if (!saidToNamers)
- + {
- + for (L2PcInstance player : plrs)
- + {
- + if (player != null && activeChar.isInsideRadius(player, 1250, false, true) && !BlockList.isBlocked(player, activeChar))
- + player.sendPacket(cs);
- + }
- - activeChar.sendPacket(cs);
- + activeChar.sendPacket(cs);
- + }
- }
- /**
- Index: java/net/sf/l2j/gameserver/network/clientpackets/Logout.java
- ===================================================================
- --- java/net/sf/l2j/gameserver/network/clientpackets/Logout.java (revision 114)
- +++ java/net/sf/l2j/gameserver/network/clientpackets/Logout.java (working copy)
- @@ -49,6 +49,14 @@
- if (player == null)
- return;
- +
- + if (player.isNamer())
- + {
- + String i = Config.NAMERS_NAME_PREFIX;
- + String ii = player.getName();
- + String iii = player.getName().substring(i.length());
- + player.setName(iii);
- + }
- player.getInventory().updateDatabase();
- Index: java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java
- ===================================================================
- --- java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java (revision 114)
- +++ java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java (working copy)
- @@ -31,6 +31,7 @@
- import net.sf.l2j.gameserver.datatables.AdminCommandAccessRights;
- import net.sf.l2j.gameserver.datatables.MapRegionTable;
- import net.sf.l2j.gameserver.datatables.SkillTable;
- +import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminNameSystem;
- import net.sf.l2j.gameserver.instancemanager.ClanHallManager;
- import net.sf.l2j.gameserver.instancemanager.CoupleManager;
- import net.sf.l2j.gameserver.instancemanager.DimensionalRiftManager;
- @@ -87,6 +88,20 @@
- getClient().closeNow();
- return;
- }
- +
- + if (AdminNameSystem.getAllNamers().contains(activeChar.getName()))
- + {
- + activeChar.setNamer(true);
- + activeChar.broadcastUserInfo();
- + }
- +
- + if (activeChar.isNamer())
- + {
- + if (Config.NAMERS_ANNOUNCE_ON_LOGIN)
- + {
- + Announcements.getInstance().announceToAll(activeChar.getName()+", a server's "+Config.NAME_SYSTEM_NAME+", has logged in.");
- + }
- + }
- // Register in flood protector
- FloodProtector.getInstance().registerNewPlayer(activeChar.getObjectId());
- Index: java/net/sf/l2j/gameserver/network/serverpackets/UserInfo.java
- ===================================================================
- --- java/net/sf/l2j/gameserver/network/serverpackets/UserInfo.java (revision 114)
- +++ java/net/sf/l2j/gameserver/network/serverpackets/UserInfo.java (working copy)
- @@ -294,7 +294,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.isNamer() && Config.NAMERS_HERO_AURA)) ? 1 : 0); //0x01: Hero Aura
- writeC(_activeChar.isFishing() ? 1 : 0); //Fishing Mode
- writeD(_activeChar.getFishx()); //fishing x
- Index: config/namesystem.info
- ===================================================================
- Index: java/net/sf/l2j/gameserver/network/clientpackets/RequestRestart.java
- ===================================================================
- --- java/net/sf/l2j/gameserver/network/clientpackets/RequestRestart.java (revision 114)
- +++ java/net/sf/l2j/gameserver/network/clientpackets/RequestRestart.java (working copy)
- @@ -51,6 +51,14 @@
- if (player == null)
- return;
- +
- + if (player.isNamer())
- + {
- + String i = Config.NAMERS_NAME_PREFIX;
- + String ii = player.getName();
- + String iii = player.getName().substring(i.length());
- + player.setName(iii);
- + }
- if(player.getActiveEnchantItem() != null)
- {
- Index: java/net/sf/l2j/gameserver/handler/AdminCommandHandler.java
- ===================================================================
- --- java/net/sf/l2j/gameserver/handler/AdminCommandHandler.java (revision 114)
- +++ java/net/sf/l2j/gameserver/handler/AdminCommandHandler.java (working copy)
- @@ -50,6 +50,7 @@
- import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminManor;
- import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminMenu;
- import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminMonsterRace;
- +import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminNameSystem;
- import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminPForge;
- import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminPathNode;
- import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminPetition;
- @@ -129,6 +130,10 @@
- registerAdminCommandHandler(new AdminTeleport());
- registerAdminCommandHandler(new AdminUnblockIp());
- registerAdminCommandHandler(new AdminZone());
- + if (Config.ALLOW_NAME_ADMIN_COMMAND)
- + {
- + registerAdminCommandHandler(new AdminNameSystem());
- + }
- }
- public void registerAdminCommandHandler(IAdminCommandHandler handler)
- Index: java/net/sf/l2j/Config.java
- ===================================================================
- --- java/net/sf/l2j/Config.java (revision 114)
- +++ java/net/sf/l2j/Config.java (working copy)
- @@ -29,11 +29,13 @@
- import java.math.BigInteger;
- import java.util.Arrays;
- import java.util.List;
- +import java.util.Map;
- import java.util.Properties;
- import java.util.StringTokenizer;
- import java.util.logging.Logger;
- import javolution.util.FastList;
- +import javolution.util.FastMap;
- import net.sf.l2j.util.StringUtil;
- /**
- @@ -418,6 +420,29 @@
- /** Buffs */
- public static boolean STORE_SKILL_COOLTIME;
- public static byte BUFFS_MAX_AMOUNT;
- +
- + /** Namers */
- + public static String NAME_SYSTEM_NAME;
- + public static boolean ALLOW_NAME_ADMIN_COMMAND;
- + public static boolean NAMERS_NAME_COLOR;
- + public static boolean NAMES_NAME_COLOR_STATIC;
- + public static int NAMES_NAME_STATIC_COLOR;
- + public static String COLOR_NAME_DEPENDS;
- + public static Map<Integer, Integer> NAMERS_NAME_COLORS = new FastMap<Integer, Integer>();
- + public static boolean NAMERS_TITLE_COLOR;
- + public static boolean NAMES_TITLE_COLOR_STATIC;
- + public static int NAMES_TITLE_STATIC_COLOR;
- + public static String COLOR_TITLE_DEPENDS;
- + public static Map<Integer, Integer> NAMERS_TITLE_COLORS = new FastMap<Integer, Integer>();
- + public static boolean ALLOW_NAMERS_CUSTOM_SKILLS;
- + public static Map<Integer, Integer> NAMERS_CUSTOM_SKILLS = new FastMap<Integer, Integer>();
- + public static boolean NAMERS_HERO_AURA;
- + public static boolean NAMERS_ANNOUNCE_ON_BECOME;
- + public static boolean NAMERS_ANNOUNCE_ON_LOGIN;
- + public static boolean NAMERS_CUSTOM_CHAT;
- + public static String NAMERS_CUSTOM_CHAT_PREFIX;
- + public static boolean NAMERS_HAVE_NAME_PREFIX;
- + public static String NAMERS_NAME_PREFIX;
- //--------------------------------------------------
- // Server
- @@ -1022,6 +1047,46 @@
- BUFFS_MAX_AMOUNT = Byte.parseByte(players.getProperty("MaxBuffsAmount","20"));
- STORE_SKILL_COOLTIME = Boolean.parseBoolean(players.getProperty("StoreSkillCooltime", "true"));
- +
- + NAME_SYSTEM_NAME = players.getProperty("NameSystemName", "Donator");
- + ALLOW_NAME_ADMIN_COMMAND = Boolean.parseBoolean(players.getProperty("AllowNameAdminCommand", "true"));
- + NAMERS_NAME_COLOR = Boolean.parseBoolean(players.getProperty("NamersNameColor", "false"));
- + NAMES_NAME_COLOR_STATIC = Boolean.parseBoolean(players.getProperty("NamesNameColorStatic", "true"));
- + NAMES_NAME_STATIC_COLOR = Integer.decode("0x" + players.getProperty("NamesNameStaticColor", "0000FF"));
- + COLOR_NAME_DEPENDS = players.getProperty("ColorNameDepends", "PVP");
- + String NAMERS_NAME_COLOR_C = players.getProperty("NamersNameColorC", "100,00FF00;200,FF0000;300,0000FF;");
- + String[] namers_name_color_c_splitted = NAMERS_NAME_COLOR_C.split(";");
- + for (String s : namers_name_color_c_splitted)
- + {
- + String[] i = s.split(",");
- + NAMERS_NAME_COLORS.put(Integer.parseInt(i[0]), Integer.decode("0x"+i[1]));
- + }
- + NAMERS_TITLE_COLOR = Boolean.parseBoolean(players.getProperty("NamersTitleColor", "false"));
- + NAMES_TITLE_COLOR_STATIC = Boolean.parseBoolean(players.getProperty("NamesTitleColorStatic", "true"));
- + NAMES_TITLE_STATIC_COLOR = Integer.decode("0x" + players.getProperty("NamesTitleStaticColor", "FF0000"));
- + COLOR_TITLE_DEPENDS = players.getProperty("ColorTitleDepends", "PK");
- + String NAMERS_TITLE_COLOR_C = players.getProperty("NamersTitleColorC", "100,00FF00;200,FF0000;300,0000FF;");
- + String[] namers_title_color_c_splitted = NAMERS_TITLE_COLOR_C.split(";");
- + for (String s : namers_title_color_c_splitted)
- + {
- + String[] i = s.split(",");
- + NAMERS_TITLE_COLORS.put(Integer.parseInt(i[0]), Integer.decode("0x"+i[1]));
- + }
- + ALLOW_NAMERS_CUSTOM_SKILLS = Boolean.parseBoolean(players.getProperty("AllowNamersCustomSkills", "false"));
- + String namers_custom_skills = players.getProperty("NamersCustomSkills", "1,1;2,2;");
- + String[] namers_custom_skills_splitted = namers_custom_skills.split(";");
- + for (String s : namers_custom_skills_splitted)
- + {
- + String[] i = s.split(",");
- + NAMERS_CUSTOM_SKILLS.put(Integer.parseInt(i[0]), Integer.parseInt(i[1]));
- + }
- + NAMERS_HERO_AURA = Boolean.parseBoolean(players.getProperty("NamersHeroAura", "false"));
- + NAMERS_ANNOUNCE_ON_BECOME = Boolean.parseBoolean(players.getProperty("NamersAnnounceOnBecome", "false"));
- + NAMERS_ANNOUNCE_ON_LOGIN = Boolean.parseBoolean(players.getProperty("NamersAnnounceOnLogin", "false"));
- + NAMERS_CUSTOM_CHAT = Boolean.parseBoolean(players.getProperty("NamersCustomChat", "false"));
- + NAMERS_CUSTOM_CHAT_PREFIX = players.getProperty("NamersCustomChatPrefix", "~");
- + NAMERS_HAVE_NAME_PREFIX = Boolean.parseBoolean(players.getProperty("NamersHaveNamePrefix", "false"));
- + NAMERS_NAME_PREFIX = players.getProperty("NamersNamePrefix", "[DON]");
- }
- catch (Exception e)
- {
- Index: config/players.properties
- ===================================================================
- --- config/players.properties (revision 114)
- +++ config/players.properties (working copy)
- @@ -310,4 +310,51 @@
- MaxBuffsAmount = 20
- # Store buffs/debuffs on user logout?
- -StoreSkillCooltime = True
- \ No newline at end of file
- +StoreSkillCooltime = True
- +
- +# NAME system settings.
- +# NAME system name that will be used, for admin commands and other stuff like announcements.
- +NameSystemName = Donator
- +# Allow admin command to become name(//set_name(this name will be replaced by the name you put in the previous config, but all leters in lower case. Eg. you put DONATOR, admin command will be //set_donator).
- +AllowNameAdminCommand = True
- +# Will these 'name' players have name color.
- +NamersNameColor = False
- +# Color name will be static?
- +# If false, then ignore the next config and go to to the config under it(it's auto enabled if this is false).
- +NamesNameColorStatic = True
- +NamesNameStaticColor = 0000FF
- +# Color will depend on?
- +# Options: PVP, PK.
- +ColorNameDepends = PVP
- +# Which color and the level(works like eg. lvl,color;lvl,color; or eg. pvps,color;pvps,color;).
- +NamersNameColorC = 100,00FF00;200,FF0000;300,0000FF;
- +# Will these 'name' players have title color.
- +NamersTitleColor = False
- +# Color title will be static?
- +# If false, then the next config is enabled by default.
- +NamesTitleColorStatic = True
- +NamesTitleStaticColor = FF0000
- +# Color will depend on?
- +# Options: PVP, PK.
- +ColorTitleDepends = PK
- +# Which color and the level(works like eg. lvl,color;lvl,color; or eg. pvps,color;pvps,color;).
- +NamersTitleColorC = 100,00FF00;200,FF0000;300,0000FF;
- +# Will name players get custom skills.
- +AllowNamersCustomSkills = False
- +# If true, what skills will they take(works like skillid,skilllvl;skillid,skilllvl;).
- +NamersCustomSkills = 1,1;2,2;
- +# Will name players get hero aura.
- +NamersHeroAura = False
- +# Will it be announced when they become name players(like Playername has become a server's NameSystemName(eg. Anarchy has become a server's Donator.)).
- +NamersAnnounceOnBecome = False
- +# Will it be announced when they login(like Playername, a server's NameSystemName, has logged in.(eg. Anarchy, a server's Donator, has logged in.)).
- +NamersAnnounceOnLogin = False
- +# Will namers have custom chat.
- +NamersCustomChat = False
- +# What prefix will it have(eg party(#), clan(@)).
- +# NOTE: Do not use existing one.
- +NamersCustomChatPrefix = ~
- +# Will namers have custom prefix on their name? (eg. [DON]Anarchy or [VIP]Anarchy)
- +NamersHaveNamePrefix = False
- +# If true what prefix.
- +NamersNamePrefix = [DON]
- \ No newline at end of file
- Index: java/net/sf/l2j/gameserver/network/serverpackets/CharInfo.java
- ===================================================================
- --- java/net/sf/l2j/gameserver/network/serverpackets/CharInfo.java (revision 114)
- +++ java/net/sf/l2j/gameserver/network/serverpackets/CharInfo.java (working copy)
- @@ -335,7 +335,7 @@
- writeD(_activeChar.getClanCrestLargeId());
- writeC(_activeChar.isNoble() ? 1 : 0); // Symbol on char menu ctrl+I
- - writeC((_activeChar.isHero() || (_activeChar.isGM() && Config.GM_HERO_AURA)) ? 1 : 0); // Hero Aura
- + writeC((_activeChar.isHero() || (_activeChar.isGM() && Config.GM_HERO_AURA) || (_activeChar.isNamer() && Config.NAMERS_HERO_AURA)) ? 1 : 0); // Hero Aura
- writeC(_activeChar.isFishing() ? 1 : 0); //0x01: Fishing Mode (Cant be undone by setting back to 0)
- writeD(_activeChar.getFishx());
- Index: java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminNameSystem.java
- ===================================================================
- --- java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminNameSystem.java (revision 0)
- +++ java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminNameSystem.java (revision 0)
- @@ -0,0 +1,216 @@
- +/* This program is free software; you can redistribute it and/or modify
- + * it under the terms of the GNU General Public License as published by
- + * the Free Software Foundation; either version 2, or (at your option)
- + * any later version.
- + *
- + * This program is distributed in the hope that it will be useful,
- + * but WITHOUT ANY WARRANTY; without even the implied warranty of
- + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- + * GNU General Public License for more details.
- + *
- + * You should have received a copy of the GNU General Public License
- + * along with this program; if not, write to the Free Software
- + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- + * 02111-1307, USA.
- + *
- + * http://www.gnu.org/copyleft/gpl.html
- + */
- +package net.sf.l2j.gameserver.handler.admincommandhandlers;
- +
- +import java.io.BufferedReader;
- +import java.io.BufferedWriter;
- +import java.io.File;
- +import java.io.FileReader;
- +import java.io.FileWriter;
- +import java.io.IOException;
- +import java.util.Collection;
- +
- +import javolution.util.FastList;
- +import net.sf.l2j.Config;
- +import net.sf.l2j.gameserver.Announcements;
- +import net.sf.l2j.gameserver.handler.IAdminCommandHandler;
- +import net.sf.l2j.gameserver.model.L2Object;
- +import net.sf.l2j.gameserver.model.L2World;
- +import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
- +/**
- + *
- + * @author Anarchy
- + */
- +public class AdminNameSystem implements IAdminCommandHandler
- +{
- + private static final String[] ADMIN_COMMANDS = { "admin_set_"+Config.NAME_SYSTEM_NAME.toLowerCase() };
- +
- + public boolean useAdminCommand(String command, L2PcInstance activeChar)
- + {
- + if (command.equals("admin_set_"+Config.NAME_SYSTEM_NAME.toLowerCase()))
- + {
- + L2Object targetObject = activeChar.getTarget();
- +
- + if (!(targetObject instanceof L2PcInstance))
- + {
- + activeChar.sendMessage("Wrong target.");
- + return false;
- + }
- +
- + L2PcInstance target = (L2PcInstance)targetObject;
- +
- + if (getAllNamers().contains(target.getName()))
- + {
- + target.setNamer(false);
- + boolean removed = removeNamer(target.getName());
- +
- + if (!removed)
- + {
- + for (L2PcInstance gm : L2World.getInstance().getAllGMs())
- + {
- + gm.sendMessage("Error on removing namer from namesystem.info file. Player: "+target.getName()+".");
- + }
- + }
- + }
- + else
- + {
- + boolean added = addNamer(target.getName());
- + target.setNamer(true);
- + target.broadcastUserInfo();
- +
- + if (!added)
- + {
- + for (L2PcInstance gm : L2World.getInstance().getAllGMs())
- + {
- + gm.sendMessage("Error on adding namer on namesystem.info file. Player: "+target.getName()+".");
- + }
- + }
- + else
- + {
- + if (Config.NAMERS_ANNOUNCE_ON_BECOME)
- + {
- + Announcements.getInstance().announceToAll(target.getName()+" is now a "+Config.NAME_SYSTEM_NAME+"!");
- + }
- + }
- + }
- +
- + return true;
- + }
- +
- + return true;
- + }
- +
- + public static boolean addNamer(String name)
- + {
- + if (name == null)
- + {
- + return false;
- + }
- +
- + if (getAllNamers().contains(name))
- + {
- + return false;
- + }
- +
- + File f = new File("./config/", "namesystem.info");
- + try
- + {
- + FileWriter fw = new FileWriter(f, true);
- + BufferedWriter w = new BufferedWriter(fw);
- +
- + w.write(name);
- + w.newLine();
- + if (Config.NAMERS_HAVE_NAME_PREFIX)
- + {
- + w.write(Config.NAMERS_NAME_PREFIX+name);
- + w.newLine();
- + }
- +
- + w.close();
- + }
- + catch (IOException ioe)
- + { }
- +
- + return true;
- + }
- +
- + public static boolean removeNamer(String name)
- + {
- + if (name == null)
- + {
- + return false;
- + }
- +
- + if (!getAllNamers().contains(name))
- + {
- + return false;
- + }
- +
- + File f = new File("./config/", "namesystem.info");
- + try
- + {
- + FileWriter fw = new FileWriter(f);
- + BufferedWriter w = new BufferedWriter(fw);
- +
- + for (String s : getAllNamers())
- + {
- + if (!s.equals(name) && !s.equals(Config.NAMERS_NAME_PREFIX+name))
- + {
- + w.write(s);
- + w.newLine();
- + if (Config.NAMERS_HAVE_NAME_PREFIX)
- + {
- + w.write(Config.NAMERS_NAME_PREFIX+s);
- + w.newLine();
- + }
- + }
- + }
- +
- + w.close();
- + }
- + catch (IOException ioe)
- + { }
- +
- + return true;
- + }
- +
- + public static FastList<String> getAllNamers()
- + {
- + FastList<String> namers = new FastList<String>();
- + File f = new File("./config/", "namesystem.info");
- + if (!f.exists())
- + {
- + Collection<L2PcInstance> gms = L2World.getInstance().getAllGMs();
- + for (L2PcInstance gm : gms)
- + {
- + gm.sendMessage("Error on getting namers: namesystem.info does not exist.");
- + return null;
- + }
- + }
- + try
- + {
- + FileReader fr = new FileReader(f);
- + BufferedReader r = new BufferedReader(fr);
- + boolean eof = false;
- + do
- + {
- + String s = r.readLine();
- + if (s == null)
- + {
- + eof = true;
- + }
- + else
- + {
- + namers.add(s);
- + }
- + }
- + while (!eof);
- +
- + r.close();
- + }
- + catch (IOException ioe)
- + { }
- +
- + return namers;
- + }
- +
- + public String[] getAdminCommandList()
- + {
- + return ADMIN_COMMANDS;
- + }
- +}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement