skoupas Posted January 6, 2011 Posted January 6, 2011 Hi All i create with some help of my friend Top PvP Player Status And i want to Help all users of mxc :'D PS: If you feel there to perform the same post deletion! Lets start! :D ============================================= index/net/sf/l2j/gameserver/gameserver.java = ============================================= @657,9 657,7@ _adminCommandHandler.registerAdminCommandHandler(new AdminHero()); _adminCommandHandler.registerAdminCommandHandler(new AdminNoble()); + _adminCommandHandler.registerAdminCommandHandler(new AdminTopPvpPlayer()); =================================================================================== Index/net/sf/l2j/handlers/admincommandHandlers Create File AdminTopPvpPlayer.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 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. * */ package net.sf.l2j.gameserver.handler.admincommandhandlers; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import net.sf.l2j.L2Config; import net.sf.l2j.L2DatabaseFactory; import net.sf.l2j.gameserver.Announcements; import net.sf.l2j.gameserver.GmListTable; import net.sf.l2j.gameserver.handler.IAdminCommandHandler; import net.sf.l2j.gameserver.model.L2Object; import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance; import net.sf.l2j.gameserver.network.SystemMessageId; import net.sf.l2j.gameserver.network.serverpackets.SystemMessage; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * * Author Tsikos* * */ public class AdminTopPvpPlayer implements IAdminCommandHandler { private static String[] _adminCommands = { "admin_setTopPvpPlayer",}; private final static Log _log = LogFactory.getLog(AdminTopPvpPlayer.class.getName()); private static final int REQUIRED_LEVEL = L2Config.GM_MENU; public boolean useAdminCommand(String command, L2PcInstance activeChar) { if (!L2Config.ALT_PRIVILEGES_ADMIN) { if (!(checkLevel(activeChar.getAccessLevel()) && activeChar.isGM())) { return false; } } if (command.startsWith("admin_setTopPvpPlayer")) { L2Object target = activeChar.getTarget(); L2PcInstance player = null; SystemMessage sm = new SystemMessage(SystemMessageId.S1_S2); if (target instanceof L2PcInstance) { player = (L2PcInstance)target; } else { player = activeChar; } if (player.isTopPvpPlayer()) { player.setTopPvpPlayer(false); sm.addString("You are no longer a server TopPvpPlayer."); GmListTable.broadcastMessageToGMs("GM "+activeChar.getName()+" removed TopPvpPlayer stat of player"+ target.getName()); Connection connection = null; try { connection = L2DatabaseFactory.getInstance().getConnection(); PreparedStatement statement = connection.prepareStatement("SELECT obj_id FROM characters where char_name=?"); statement.setString(1,target.getName()); ResultSet rset = statement.executeQuery(); int objId = 0; if (rset.next()) { objId = rset.getInt(1); } rset.close(); statement.close(); if (objId == 0) {connection.close(); return false;} statement = connection.prepareStatement("UPDATE characters SET TopPvpPlayer=0 WHERE obj_id=?"); statement.setInt(1, objId); statement.execute(); statement.close(); connection.close(); } catch (Exception e) { _log.warn("could not set TopPvpPlayer stats of char:", e); } finally { try { connection.close(); } catch (Exception e) {} } } else { player.setTopPvpPlayer(true); sm.addString("You are now a server TopPvpPlayer, congratulations!"); GmListTable.broadcastMessageToGMs("GM "+activeChar.getName()+" has given TopPvpPlayer stat for player "+target.getName()+"."); Connection connection = null; try { connection = L2DatabaseFactory.getInstance().getConnection(); PreparedStatement statement = connection.prepareStatement("SELECT obj_id FROM characters where char_name=?"); statement.setString(1,target.getName()); ResultSet rset = statement.executeQuery(); int objId = 0; if (rset.next()) { objId = rset.getInt(1); } rset.close(); statement.close(); if (objId == 0) {connection.close(); return false;} statement = connection.prepareStatement("UPDATE characters SET TopPvpPlayer=1 WHERE obj_id=?"); statement.setInt(1, objId); statement.execute(); statement.close(); connection.close(); } catch (Exception e) { _log.warn("could not set TopPvpPlayer stats of char:", e); } finally { try { connection.close(); } catch (Exception e) {} } } player.sendPacket(sm); player.broadcastUserInfo(); if(player.isTopPvpPlayer() == true) { Announcements.getInstance().announceToAll(player.getName() + " Has Become a Server TopPvpPlayer!"); } } return false; } public String[] getAdminCommandList() { return _adminCommands; } private boolean checkLevel(int level) { return (level >= REQUIRED_LEVEL); } } ========================================================= index/net/sf/l2j/model/actor/instance/l2pcinstance.java = ========================================================= @225,4 225,4@ - private static final String UPDATE_CHARACTER = "UPDATE characters SET level=?,maxHp=?,curHp=?,maxCp=?,curCp=?,maxMp=?,curMp=?,str=?,con=?,dex=?,_int=?,men=?,wit=?,face=?,hairStyle=?,hairColor=?,heading=?,x=?,y=?,z=?,exp=?,expBeforeDeath=?,sp=?,karma=?,pvpkills=?,pkkills=?,rec_have=?,rec_left=?,clanid=?,maxload=?,race=?,classid=?,deletetime=?,title=?,accesslevel=?,online=?,isin7sdungeon=?,clan_privs=?,wantspeace=?,base_class=?,onlinetime=?,in_jail=?,jail_timer=?,newbie=?,nobless=?,power_grade=?,subpledge=?,last_recom_date=?,lvl_joined_academy=?,apprentice=?,sponsor=?,varka_ketra_ally=?,clan_join_expiry_time=?,clan_create_expiry_time=?,char_name=?,death_penalty_level=? WHERE obj_id=?"; - private static final String RESTORE_CHARACTER = "SELECT account_name, obj_Id, char_name, level, maxHp, curHp, maxCp, curCp, maxMp, curMp, acc, crit, evasion, mAtk, mDef, mSpd, pAtk, pDef, pSpd, runSpd, walkSpd, str, con, dex, _int, men, wit, face, hairStyle, hairColor, sex, heading, x, y, z, movement_multiplier, attack_speed_multiplier, colRad, colHeight, exp, expBeforeDeath, sp, karma, pvpkills, pkkills, clanid, maxload, race, classid, deletetime, cancraft, title, rec_have, rec_left, accesslevel, online, char_slot, lastAccess, clan_privs, wantspeace, base_class, onlinetime, isin7sdungeon, in_jail, jail_timer, newbie, nobless, power_grade, subpledge, last_recom_date, lvl_joined_academy, apprentice, sponsor, varka_ketra_ally,clan_join_expiry_time,clan_create_expiry_time,death_penalty_level FROM characters WHERE obj_id=?"; + private static final String UPDATE_CHARACTER = "UPDATE characters SET level=?,maxHp=?,curHp=?,maxCp=?,curCp=?,maxMp=?,curMp=?,str=?,con=?,dex=?,_int=?,men=?,wit=?,face=?,hairStyle=?,hairColor=?,heading=?,x=?,y=?,z=?,exp=?,expBeforeDeath=?,sp=?,karma=?,pvpkills=?,pkkills=?,rec_have=?,rec_left=?,clanid=?,maxload=?,race=?,classid=?,deletetime=?,title=?,accesslevel=?,online=?,isin7sdungeon=?,clan_privs=?,wantspeace=?,base_class=?,onlinetime=?,in_jail=?,jail_timer=?,newbie=?,nobless=?,power_grade=?,subpledge=?,last_recom_date=?,lvl_joined_academy=?,apprentice=?,sponsor=?,varka_ketra_ally=?,clan_join_expiry_time=?,clan_create_expiry_time=?,char_name=?,death_penalty_level=?,TopPvpPlayer WHERE obj_id=?"; + private static final String RESTORE_CHARACTER = "SELECT account_name, obj_Id, char_name, level, maxHp, curHp, maxCp, curCp, maxMp, curMp, acc, crit, evasion, mAtk, mDef, mSpd, pAtk, pDef, pSpd, runSpd, walkSpd, str, con, dex, _int, men, wit, face, hairStyle, hairColor, sex, heading, x, y, z, movement_multiplier, attack_speed_multiplier, colRad, colHeight, exp, expBeforeDeath, sp, karma, pvpkills, pkkills, clanid, maxload, race, classid, deletetime, cancraft, title, rec_have, rec_left, accesslevel, online, char_slot, lastAccess, clan_privs, wantspeace, base_class, onlinetime, isin7sdungeon, in_jail, jail_timer, newbie, nobless, power_grade, subpledge, last_recom_date, lvl_joined_academy, apprentice, sponsor, varka_ketra_ally,clan_join_expiry_time,clan_create_expiry_time,death_penalty_level,TopPvpPlayer FROM characters WHERE obj_id=?"; @498,1 498,1@ /** True if the L2PcInstance is newbie */ private boolean _newbie; private boolean _noble = false; private boolean _hero = false; private boolean _Customhero = false; + private boolean _TopPvpPlayer = false; @5912,30 5912,30@ player.setNewbie(rset.getInt("newbie")==1); player.setNoble(rset.getInt("nobless")==1); + player.setTopPvpPlayer(rset.getInt("TopPvpPlayer")==1); @6387,39 6387,39@ statement.setLong(41, totalOnlineTime); statement.setInt(42, isInJail() ? 1 : 0); statement.setLong(43, getJailTimer()); statement.setInt(44, isNewbie() ? 1 : 0); statement.setInt(45, isNoble() ? 1 : 0); statement.setLong(46, getPowerGrade()); statement.setInt(47, getPledgeType()); statement.setLong(48,getLastRecomUpdate()); statement.setInt(49,getLvlJoinedAcademy()); statement.setLong(50,getApprentice()); statement.setLong(51,getSponsor()); statement.setInt(52, getAllianceWithVarkaKetra()); statement.setLong(53, getClanJoinExpiryTime()); statement.setLong(54, getClanCreateExpiryTime()); statement.setString(55, getName()); statement.setLong(56, getDeathPenaltyBuffLevel()); + statement.setInt(57, isTopPvpPlayer() ? 1 : 0); @6523,25 6523,25@ + public boolean isTopPvpPlayer() + { + return _TopPvpPlayer; + } + + public void setTopPvpPlayer(boolean TopPvpPlayer) + { + _TopPvpPlayer = TopPvpPlayer; + } =================================================================== index:net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java = =================================================================== @181,38 181,38@ + if (activeChar.isTopPvpPlayer()) + { + activeChar.getAppearance().setNameColor(L2Config.TopPvpPlayer_NAME_COLOR); + activeChar.sendMessage("Welcome TopPvpPlayer "+activeChar.getName()+" !"); + activeChar.sendMessage("Enjoy your Stay Mate!"); + Announcements.getInstance().announceToAll("Top PvP Player" +activeChar.getName()+ " is Now Online!"); + } @236,29 236,29@ if (activeChar.isTopPvpPlayer() || activeChar.getPvpKills() == 5000) { activeChar.sendMessage("[Message]:You rewarded TopPvpPlayer status for your pvp kill's"); } ============================================================= Index:net/sf/l2j/gameserver/network/clientpackets/say2.java = ============================================================= @181,55 181,55@ + if (_text.startsWith("*") && activeChar.isTopPvpPlayer()) + { + for (L2PcInstance player : L2World.getInstance().getAllPlayers()) + player.sendPacket(new CreatureSay(0, 15, activeChar.getName(), _text)); + return; + } ================================ Index:net/sf/l2j/L2Config.java = ================================ @1147,23 1147,23@ public static boolean KEEP_SUBCLASS_SKILLS; + public static boolean TopPvpPlayer_NAME_COLOR_ENABLED; + public static int TopPvpPlayer_NAME_COLOR; @2659,20 2659,20@ KEEP_SUBCLASS_SKILLS = Boolean.parseBoolean(customSettings.getProperty("EnableStuckSubsMode", "False")); + TopPvpPlayer_NAME_COLOR_ENABLED = Boolean.parseBoolean(customSettings.getProperty("TopPvpPlayerNameColorEnabled", "False")); + TopPvpPlayer_NAME_COLOR = Integer.decode("0x" + customSettings.getProperty("TopPvpPlayerColorName", "0099ff")); ===================================== Gameserver/config/custom.properties = ===================================== +#------------------------------------------------# +# Top PvP Player System By Tsikos # +#------------------------------------------------# + +# TopPvpPlayer Color Name +# TopPvpPlayer Name Color Enabled?. +TopPvpPlayerNameColorEnabled = False +# TopPvpPlayer Color Name Selection +TopPvpPlayerColorName = 0099ff ========= =Code Finish= ========= ################## #All Credits Go to Tsikos*# ################## ::DownLoad Link:: [move]http://www.4shared.com/file/igL-m8m8/Top_PvP_Player.html[/move] Quote
Fanky Posted January 6, 2011 Posted January 6, 2011 and what's the point of it?:| Anyway thanks for share. Quote
skoupas Posted January 6, 2011 Author Posted January 6, 2011 and what's the point of it?:| Anyway thanks for share. Point is Color Name + Announce Log In + Special Chat :D btw Thnx Man :D Quote
vagos123 Posted January 6, 2011 Posted January 6, 2011 and what's the point of it?:| Anyway thanks for share. you know which char in your server is the terror of every body else xD @ontopic : goog share mate keep it up ! Quote
skoupas Posted January 6, 2011 Author Posted January 6, 2011 and what's the point of it?:| Anyway thanks for share. ;) Thnx Vagos :D Quote
FighterBoss Posted January 6, 2011 Posted January 6, 2011 I like the idea :) Good work skoupas Keep up Quote
skoupas Posted January 6, 2011 Author Posted January 6, 2011 thnx FighterBoss good work skoupas better call me Tsikos* the Skoupas accidentally put it :D Quote
Fanky Posted January 6, 2011 Posted January 6, 2011 Forgot to mention better make a patch instead of this shit -.-" Quote
skoupas Posted January 6, 2011 Author Posted January 6, 2011 Forgot to mention better make a patch instead of this shit -.-" I so want to do so I did not let Post if you do not like -.-' Quote
Xanderॐ Posted January 8, 2011 Posted January 8, 2011 Not so well-coded. Why do you query the DB for the char objectid ? Its already in the l2pcinstance.getObjectId(); Quote
skoupas Posted January 10, 2011 Author Posted January 10, 2011 Not so well-coded. Why do you query the DB for the char objectid ? Its already in the l2pcinstance.getObjectId(); Look Man + private static final String UPDATE_CHARACTER = "UPDATE characters SET level=?,maxHp=?,curHp=?,maxCp=?,curCp=?,maxMp=?,curMp=?,str=?,con=?,dex=?,_int=?,men=?,wit=?,face=?,hairStyle=?,hairColor=?,heading=?,x=?,y=?,z=?,exp=?,expBeforeDeath=?,sp=?,karma=?,pvpkills=?,pkkills=?,rec_have=?,rec_left=?,clanid=?,maxload=?,race=?,classid=?,deletetime=?,title=?,accesslevel=?,online=?,isin7sdungeon=?,clan_privs=?,wantspeace=?,base_class=?,onlinetime=?,in_jail=?,jail_timer=?,newbie=?,nobless=?,power_grade=?,subpledge=?,last_recom_date=?,lvl_joined_academy=?,apprentice=?,sponsor=?,varka_ketra_ally=?,clan_join_expiry_time=?,clan_create_expiry_time=?,char_name=?,death_penalty_level=?,TopPvpPlayer WHERE obj_id=?"; Finish death_penalty_level=?,TopPvpPlayer Where obj_id=?" ;) Quote
ArkeyWave Posted January 10, 2011 Posted January 10, 2011 facking owesome ! ^^ good share .. is the best for pvp servers .. now everybody will be afraid of my edited char ? xDD! neeh... thanks for sharing (YY) Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.