Dulens. Posted October 13, 2012 Posted October 13, 2012 ohai , today I made 2 codes for l2jesios project. 1) Simple Killing Spree System 2) .whoami command, informations about yourself. - .whoami command ### Eclipse Workspace Patch 1.0 #P l2jesios_gameserver Index: java/net/sf/l2j/gameserver/handler/VoicedCommandHandler.java =================================================================== --- java/net/sf/l2j/gameserver/handler/VoicedCommandHandler.java (revision 55) +++ java/net/sf/l2j/gameserver/handler/VoicedCommandHandler.java (working copy) @@ -67,6 +67,8 @@ if(Config.ALLOW_VIEW_DETAILS) registerVoicedCommandHandler(new ViewDetails()); + + registerVoicedCommandHandler(new WhoAmI()); } public void registerVoicedCommandHandler(IVoicedCommandHandler handler) Index: java/net/sf/l2j/gameserver/handler/voicedcommandhandlers/WhoAmI.java =================================================================== --- java/net/sf/l2j/gameserver/handler/voicedcommandhandlers/WhoAmI.java (revision 0) +++ java/net/sf/l2j/gameserver/handler/voicedcommandhandlers/WhoAmI.java (working copy) @@ -0,0 +1,115 @@ +/* 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.voicedcommandhandlers; + +import javolution.text.TextBuilder; +import net.sf.l2j.gameserver.handler.IVoicedCommandHandler; +import net.sf.l2j.gameserver.model.L2World; +import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance; +import net.sf.l2j.gameserver.network.serverpackets.NpcHtmlMessage; + +/** + * + * @author Ravage + */ + +public class WhoAmI implements IVoicedCommandHandler +{ + private static final String[] VOICED_COMMANDS = { "whoami" }; + + @Override + public boolean useVoicedCommand(String command, L2PcInstance activeChar, String target) + { + if (command.equals("whoami")) + { + TextBuilder tb = new TextBuilder(); + NpcHtmlMessage html = new NpcHtmlMessage(1); + + tb.append("<html><head><title>Who Am I ?</title></head>"); + tb.append("<body>"); + tb.append("<center>"); + tb.append("<table width=\"250\" cellpadding=\"5\" bgcolor=\"000000\">"); + tb.append("<tr>"); + tb.append("<td width=\"45\" valign=\"top\" align=\"center\"><img src=\"L2ui_ch3.menubutton4\" width=\"38\" height=\"38\"></td>"); + tb.append("<br>"); + tb.append("<td valign=\"top\"><font color=\"FF6600\">Personal Informations</font>"); + tb.append("<br>"); + tb.append("<br1><font color=\"00FF00\">"+activeChar.getName()+"</font>, read this to know some things about your self.</td></tr></table></center>"); + tb.append("<br>"); + tb.append("<font color=\"FFAA00\">Your account's username is :</font>"+activeChar.getAccountName()); + tb.append("<br>"); + tb.append("<font color=\"FFAA00\">Your character's name is :</font>"+activeChar.getName()); + tb.append("<br>"); + tb.append("<font color=\"FFAA00\">Your character's title is :</font>"+activeChar.getTitle()); + tb.append("<br>"); + tb.append("<font color=\"FFAA00\">Your adena's count is :</font>"+activeChar.getAdena()); + tb.append("<br>"); + tb.append("<font color=\"FFAA00\">Your clan's name is :</font>"+activeChar.getClan()); + tb.append("<br>"); + tb.append("<font color=\"FFAA00\">Your current CP is :</font>"+activeChar.getCurrentCp()); + tb.append("<br>"); + tb.append("<font color=\"FFAA00\">Your current HP is :</font>"+activeChar.getCurrentHp()); + tb.append("<br>"); + tb.append("<font color=\"FFAA00\">Your current MP is :</font>"+activeChar.getCurrentMp()); + tb.append("<br>"); + tb.append("<font color=\"FFAA00\">Your death penalty's level is :</font>"+activeChar.getDeathPenaltyBuffLevel()); + tb.append("<br>"); + tb.append("<font color=\"FFAA00\">Your karma total is :</font>"+activeChar.getKarma()); + tb.append("<br>"); + tb.append("<font color=\"FFAA00\">Your level is :</font>"+activeChar.getLevel()); + tb.append("<br>"); + tb.append("<font color=\"FFAA00\">Your max CP is :</font>"+activeChar.getMaxCp()); + tb.append("<br>"); + tb.append("<font color=\"FFAA00\">Your max MP is :</font>"+activeChar.getMaxMp()); + tb.append("<br>"); + tb.append("<font color=\"FFAA00\">Your max HP is :</font>"+activeChar.getMaxHp()); + tb.append("<br>"); + tb.append("<font color=\"FFAA00\">Your pk kills are :</font>"+activeChar.getPkKills()); + tb.append("<br>"); + tb.append("<font color=\"FFAA00\">Your pvp kills are :</font>"+activeChar.getPvpKills()); + tb.append("<br>"); + tb.append("<font color=\"FFAA00\">Your recommends are :</font>"+activeChar.getRecomHave()); + tb.append("<br>"); + tb.append("<font color=\"FFAA00\">Your total subclasses are :</font>"+activeChar.getTotalSubClasses()); + tb.append("<br>"); + tb.append("<br>"); + + int playersOnline = L2World.getInstance().getAllPlayersCount(); + + if (playersOnline == 1) + tb.append("<font color=\"FF0000\">Server has </font>" + playersOnline + "<font color=\"FF0000\">player online!</font>"); + else + tb.append("<font color=\"FF0000\">Server has </font>" + playersOnline + "<font color=\"FF0000\">players online!</font>"); + + tb.append("<br>"); + tb.append("</center>"); + tb.append("</body></html>"); + + html.setHtml(tb.toString()); + activeChar.sendPacket(html); + } + + return true; +} + + @Override + public String[] getVoicedCommandList() + { + return VOICED_COMMANDS; + } +} \ No newline at end of file - Killing Spree ### Eclipse Workspace Patch 1.0 #P l2jesios_gameserver Index: java/net/sf/l2j/Config.java =================================================================== --- java/net/sf/l2j/Config.java (revision 55) +++ java/net/sf/l2j/Config.java (working copy) @@ -216,6 +216,7 @@ public static String PVP_CHAT_PREFIX; public static int PVP_AMOUNT_FOR_CHAT; public static boolean ALLOW_VIEW_DETAILS; + public static boolean ENABLE_KILLING_SPREE; // -------------------------------------------------- // Events settings @@ -1443,7 +1444,7 @@ PVP_CHAT_PREFIX = esios.getProperty("PvpChatPrefix", "-"); ALLOW_VIEW_DETAILS = Boolean.parseBoolean(esios.getProperty("AllowViewDetails", "True")); - + ENABLE_KILLING_SPREE = Boolean.parseBoolean(esios.getProperty("EnableKillingSpree", "True")); } catch (Exception e) { Index: config/esios.properties =================================================================== --- config/esios.properties (revision 55) +++ config/esios.properties (working copy) @@ -223,3 +223,6 @@ # ViewDetailsVoicedCommand #========================================# AllowViewDetails = True + +# Killing Spree System +EnableKillingSpree = True Index: java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java =================================================================== --- java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java (revision 55) +++ java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java (working copy) @@ -38,6 +38,7 @@ import net.sf.l2j.Config; import net.sf.l2j.L2DatabaseFactory; +import net.sf.l2j.gameserver.Announcements; import net.sf.l2j.gameserver.GameTimeController; import net.sf.l2j.gameserver.GeoData; import net.sf.l2j.gameserver.ItemsAutoDestroy; @@ -401,6 +402,9 @@ return bastard; } + // killing spree system. + private int killingSpree = 0; + private boolean _isIn7sDungeon = false; private PunishLevel _punishLevel = PunishLevel.NONE; @@ -4706,11 +4710,40 @@ /** * Increase the pvp kills count and send the info to the player */ + @SuppressWarnings("static-access") public void increasePvpKills() { // Add karma to attacker and increase its PK counter setPvpKills(getPvpKills() + 1); + if (Config.ENABLE_KILLING_SPREE) + { + killingSpree++; + } + + switch (killingSpree){ + + case 5 : + Announcements.getInstance().announceToAll(getName()+" is dominating!"); + break; + + case 10 : + Announcements.getInstance().announceToAll(getName()+" is on rampage!"); + break; + + case 15 : + Announcements.getInstance().announceToAll(getName()+" is on a killing spree!"); + break; + + case 20 : + Announcements.getInstance().announceToAll(getName()+" is unstoppable!"); + break; + + case 25 : + Announcements.getInstance().announceToAll(getName()+" is on a hilarious kill!"); + break; + } + if(Config.PVP_COLOR_ENABLED) { PvPColorSystem pvpcolor = new PvPColorSystem(); Thanks!
GOld3x Posted October 13, 2012 Posted October 13, 2012 since its for l2jesios why you post it herE? go on l2jesios forum...
Dulens. Posted October 13, 2012 Author Posted October 13, 2012 since its for l2jesios why you post it herE? go on l2jesios forum... it's already posted. maybe, some guys need that codes for another project.
FinalGod Posted October 13, 2012 Posted October 13, 2012 That codes are shared 3742589446 times and dint tell me that u shared them here cuz for others and not for a little fame..
Trance Posted October 13, 2012 Posted October 13, 2012 Damn girls, use htm file instead of. I see the same mistake every day.
Fanky Posted October 13, 2012 Posted October 13, 2012 That codes are shared 3742589446 times and dint tell me that u shared them here cuz for others and not for a little fame.. you can't get fame by sharing such codes,even if you want it too much :P locked anyway.
Recommended Posts