KaLeDoR

Members
  • Content Count

    34
  • Joined

  • Last visited

  • Days Won

    1
  • Feedback

    N/A

KaLeDoR last won the day on January 13 2019

KaLeDoR had the most liked content!

Community Reputation

1 Neutral

About KaLeDoR

  • Rank
    Vassal

Profile Information

  • Gender
    Male
  • Country
    Greece

Recent Profile Visitors

767 profile views
  1. can i have a preview cause i'm a newbie java coder? in my code i posted above? thank you very much
  2. Hi guys once again i need your help. I added a shift + click droplist panel on my server works fine except one missfaction. When the droplist is too big for example grandbosses the html page crashes. "Your html is too long use database for this action" So i need to seperate the droplist data in pages [1,2,3] or adding a next page button. Looking for someone to help me! Thank you! My java code is here i use only requestbypasstoserver.java : else if (_command.startsWith("DropListNpc")) { final L2Object object = activeChar.getTarget(); if (object instanceof L2NpcInstance) { NpcHtmlMessage html = new NpcHtmlMessage(0); StringBuilder html1 = new StringBuilder("<html>"); html1.append("<title>Npc Name: " + object.getName() + "</title>"); html1.append("<body>"); html1.append("<br>"); html1.append("<table cellspacing=2 cellpadding=1 width=\"280\">"); if (((L2NpcInstance) object).getTemplate().getDropData() != null) { for (L2DropCategory cat : ((L2NpcInstance) object).getTemplate().getDropData()) { for (L2DropData drop : cat.getAllDrops()) { final L2Item item = ItemTable.getInstance().getTemplate(drop.getItemId()); if (item == null) continue; int mind = 0, maxd = 0; String smind = null, smaxd = null; String name = item.getName(); if (cat.isSweep()) { mind = (int) (Config.RATE_DROP_SPOIL * drop.getMinDrop()); maxd = (int) (Config.RATE_DROP_SPOIL * drop.getMaxDrop()); } else if (drop.getItemId() == 57) { mind = 300 * drop.getMinDrop(); maxd = 300 * drop.getMaxDrop(); } else { mind = (int) (Config.RATE_DROP_ITEMS * drop.getMinDrop()); maxd = (int) (Config.RATE_DROP_ITEMS * drop.getMaxDrop()); } if (mind > 999999) { DecimalFormat df = new DecimalFormat("###.#"); smind = df.format(((double) (mind)) / 1000000) + " KK"; smaxd = df.format(((double) (maxd)) / 1000000) + " KK"; } else if (mind > 999) { smind = ((mind / 1000)) + " K"; smaxd = ((maxd / 1000)) + " K"; } else { smind = Integer.toString(mind); smaxd = Integer.toString(maxd); } if (name.startsWith("Common Item - ")) { name = "(CI)" + name.substring(14); } if (name.length() >= 34) { name = name.substring(0, 30) + "..."; } html1.append("<tr>"); html1.append("<td valign=top align=center height=38 width=40><img src=\"" + getIcon(item.getItemId()) + "\" height=32 width=32></td>"); html1.append("<td>"); html1.append("<table cellpadding=0 cellspacing=1 width=260>"); html1.append("<tr>"); html1.append("<td><font color=fff600>" + name + "</font> " + (maxd == 1 ? "[1]" : "[" + smind + " - " + smaxd + "]") + "</td>"); html1.append("</tr>"); html1.append("<tr>"); html1.append("<td><font color=00ff00>Chance: </font>" + (drop.getChance() >= 10000 ? (double) drop.getChance() / 10000 : drop.getChance() < 10000 ? (double) drop.getChance() / 10000 : "N/A") + "% "+ "</td>"); html1.append("</tr>"); html1.append("<tr>"); html1.append("<td><font color=00b3b3>Drop Type:</font> " + (drop.isQuestDrop() ? "<font color=00b3b3>[Quest]</font>" : (cat.isSweep() ? "<font color=ff00ff>[Spoil]</font> " : "<font color=00b3b3>[Drop]</font>")) + "</td>"); html1.append("</tr>"); html1.append("</table><img src=L2UI.SquareGray width=260 height=1>"); html1.append("</td>"); } } } html1.append("</tr></table>"); html1.append("</body>"); html1.append("</html>"); html.setHtml(html1.toString()); activeChar.sendPacket(html); html1 = null; html = null; } } }
  3. Thank you @Rootware but i found a sql statement to adapt my chances easier and leaving some mobs i dont wanna change retail. ty very much for your time! if anyone need it here it is: Update `droplist` SET `chance` = `chance`*8 Where NOT `mobId` IN ('1','2','3',...) Lock this topic!
  4. thank you for your reply but i'm thinking, if i make a config in l2attackable wont be easier than writing every id i want to increase the chance?
  5. Hi guys is there any easy way to adapt the chance of droplist? For example crafted leather dropchance 15% to edit it to x3 chance? [45% chance] i'm asking if there is an easy way adapting all dropchances of all mobs without editing l2attackable. Or i should make a new config for the chances ?
  6. nope mate only the npc dont work i think that's a html missing or java code dont call on showfirsthtml method i think
  7. Hi guys i tried an old version shared from rizel of the Phoenix Event Engine. I implented the code smoothly with no errors patches/sql/skills/xml configs but when i spawn the eventmanager npc it doesnt work. I tested pop up and events run smootly but i cant find a fix for the npc with eventmanager instance type. I see a lot of people asking for help but i didnt find any solution shared. Anyone with good will to help me? Thanks a lot. I use l2jfrozen source and if you want i can share the EventManagerInstance.java if you want more info.
  8. hi guys i'm using a l2jfrozen pack and i'm a bit new to java coding... I have this vip system but i wanna add to vips x2 drop not only xp /sp. how can i do this? any help and tip would be soooo helpfull Index: config/head/other.properties =================================================================== --- config/head/other.properties (revision 900) +++ config/head/other.properties (working copy) @@ -225,5 +225,21 @@ # Aio Buffers can speak to Class Master? AllowAioUseClassMaster = false + +# --------------------------------------- +# Vip System +# --------------------------------------- +# Enable / Disable Name Color +AllowVipNameColor = True +VipNameColor = 0088FF +# Enable / Disable Title Color +AllowVipTitleColor = True +VipTitleColor = 0088FF + +# if True Player Vip gain Xp*VipMulXp and Sp*VipMulSp +# Note only works if player not in party +AllowVipMulXpSp = True +VipMulXp = 2 +VipMulSp = 2 # Announce castle lords on enter game. default = false AnnounceCastleLords = False \ No newline at end of file Index: head-src/com/l2jfrozen/gameserver/network/clientpackets/EnterWorld.java =================================================================== --- head-src/com/l2jfrozen/gameserver/network/clientpackets/EnterWorld.java (revision 900) +++ head-src/com/l2jfrozen/gameserver/network/clientpackets/EnterWorld.java (working copy) @@ -101,9 +101,9 @@ { private static Logger _log = Logger.getLogger(EnterWorld.class.getName()); - private static final SimpleDateFormat fmt = new SimpleDateFormat("H:mm."); + private static final SimpleDateFormat fmt = new SimpleDateFormat("HH:mm."); private long _daysleft; - SimpleDateFormat df = new SimpleDateFormat("dd MM yyyy"); + SimpleDateFormat df = new SimpleDateFormat("dd/MM/yyyy"); public TaskPriority getPriority() { @@ -599,8 +599,17 @@ if (activeChar.isAio()) onEnterAio(activeChar); - activeChar.updateNameTitleColor(); + if(Config.ALLOW_VIP_NCOLOR && activeChar.isVip()) + activeChar.getAppearance().setNameColor(Config.VIP_NCOLOR); + if(Config.ALLOW_VIP_TCOLOR && activeChar.isVip()) + activeChar.getAppearance().setTitleColor(Config.VIP_TCOLOR); + + if(activeChar.isVip()) + onEnterVip(activeChar); + + activeChar.updateNameTitleColor(); + sendPacket(new UserInfo(activeChar)); sendPacket(new HennaInfo(activeChar)); sendPacket(new FriendList(activeChar)); @@ -638,6 +647,32 @@ } } + private void onEnterVip(L2PcInstance activeChar) + { + long curDay = Calendar.getInstance().getTimeInMillis(); + long endDay = activeChar.getVipEndTime(); + if(curDay > endDay) + { + activeChar.setVip(false); + activeChar.setVipEndTime(0); + activeChar.sendMessage("[Vip System]: Removed your Vip stats... period ends "); + } + else + { + Date dt = new Date(endDay); + _daysleft = (endDay - curDay) / 86400000; + if(_daysleft > 30) + activeChar.sendMessage("[Vip System]: Vip period ends in " + df.format(dt) + ". enjoy the Game"); + else if(_daysleft > 0) + activeChar.sendMessage("[Vip System]: Left " + (int)_daysleft + " days for Vip period ends"); + else if(_daysleft < 1) + { + long hour = (endDay - curDay) / 3600000; + activeChar.sendMessage("[Vip System]: Left " + (int)hour + " hours to Vip period ends"); + } + } + } + /** * @param activeChar */ Index: head-src/com/l2jfrozen/gameserver/model/actor/instance/L2PcInstance.java =================================================================== --- head-src/com/l2jfrozen/gameserver/model/actor/instance/L2PcInstance.java (revision 900) +++ head-src/com/l2jfrozen/gameserver/model/actor/instance/L2PcInstance.java (working copy) @@ -410,7 +410,7 @@ * =?,apprentice=?,sponsor=?,varka_ketra_ally=?,clan_join_expiry_time=?,clan_create_expiry_time=? * ,char_name=?,death_penalty_level=?,good=?,evil=?,gve_kills=? 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=?,punish_level=?,punish_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=?,pc_point=?,name_color=?,title_color=?,aio=?,aio_end=? 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=?,punish_level=?,punish_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=?,pc_point=?,name_color=?,title_color=?,aio=?,aio_end=?,vip=?,vip_end=? WHERE obj_id=?"; /** * SELECT account_name, obj_Id, char_name, level, maxHp, curHp, maxCp, curCp, maxMp, curMp, acc, crit, evasion, @@ -423,7 +423,7 @@ * FROM characters 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,pc_point,banchat_time,name_color,title_color,first_log,aio,aio_end FROM characters 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,punish_level,punish_timer,"+/* 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,pc_point"+/*,banchat_time*/",name_color,title_color,first_log,aio,aio_end FROM characters 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,punish_level,punish_timer,"+/* 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,pc_point"+/*,banchat_time*/",name_color,title_color,first_log,aio,aio_end,vip,vip_end FROM characters WHERE obj_id=?"; private static final String STATUS_DATA_GET = "SELECT hero, noble, donator, hero_end_date FROM characters_custom_data WHERE obj_Id = ?"; @@ -665,7 +665,10 @@ private boolean _isAio = false; private long _aio_endTime = 0; - + + private boolean _isVip = false; + private long _vip_endTime = 0; + /** Event parameters */ public int eventX; public int eventY; @@ -8359,7 +8362,7 @@ { con = L2DatabaseFactory.getInstance().getConnection(false); PreparedStatement statement; - statement = con.prepareStatement("INSERT INTO characters " + "(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," + "movement_multiplier,attack_speed_multiplier,colRad,colHeight," + "exp,sp,karma,pvpkills,pkkills,clanid,maxload,race,classid,deletetime," + "cancraft,title,accesslevel,online,isin7sdungeon,clan_privs,wantspeace," + "base_class,newbie,nobless,power_grade,last_recom_date"/*,banchat_time,*/+",name_color,title_color,aio,aio_end) " + "values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"); + statement = con.prepareStatement("INSERT INTO characters " + "(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," + "movement_multiplier,attack_speed_multiplier,colRad,colHeight," + "exp,sp,karma,pvpkills,pkkills,clanid,maxload,race,classid,deletetime," + "cancraft,title,accesslevel,online,isin7sdungeon,clan_privs,wantspeace," + "base_class,newbie,nobless,power_grade,last_recom_date"/*,banchat_time,*/+",name_color,title_color,aio,aio_end,vip,vip_end) " + "values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"); statement.setString(1, _accountName); statement.setInt(2, getObjectId()); statement.setString(3, getName()); @@ -8427,6 +8430,8 @@ statement.setString(59, StringToHex(Integer.toHexString(getAppearance().getTitleColor()).toUpperCase())); statement.setInt(60, isAio() ? 1 :0); statement.setLong(61, 0); + statement.setInt(62, isVip() ? 1 :0); + statement.setLong(63, 0); statement.executeUpdate(); statement.close(); @@ -8660,6 +8665,8 @@ player.setDeathPenaltyBuffLevel(rset.getInt("death_penalty_level")); player.setAio(rset.getInt("aio") == 1 ? true : false); player.setAioEndTime(rset.getLong("aio_end")); + player.setVip(rset.getInt("vip") == 1 ? true : false); + player.setVipEndTime(rset.getLong("vip_end")); // Add the L2PcInstance object in _allObjects //L2World.getInstance().storeObject(player); @@ -9123,8 +9130,11 @@ statement.setInt(60, isAio() ? 1 : 0); statement.setLong(61, getAioEndTime()); - - statement.setInt(62, getObjectId()); + + statement.setInt(62, isVip() ? 1 : 0); + statement.setLong(63, getVipEndTime()); + + statement.setInt(64, getObjectId()); //statement.setLong(58, getChatBanTimer()); @@ -16035,69 +16045,91 @@ _aio_endTime = val; } - public void setEndTime(String process, int val) - { - if (val > 0) - { - long end_day; - Calendar calendar = Calendar.getInstance(); - if (val >= 30) - { - while(val >= 30) - { - if(calendar.get(Calendar.MONTH)== 11) - calendar.roll(Calendar.YEAR, true); - calendar.roll(Calendar.MONTH, true); - val -= 30; - } - } - if (val < 30 && val > 0) - { - while(val > 0) - { - if(calendar.get(Calendar.DATE)== 28 && calendar.get(Calendar.MONTH) == 1) - calendar.roll(Calendar.MONTH, true); - if(calendar.get(Calendar.DATE)== 30) - { - if(calendar.get(Calendar.MONTH) == 11) - calendar.roll(Calendar.YEAR, true); - calendar.roll(Calendar.MONTH, true); - - } - calendar.roll(Calendar.DATE, true); - val--; - } - } - - end_day = calendar.getTimeInMillis(); - if(process.equals("aio")) - _aio_endTime = end_day; - - else - { - System.out.println("process "+ process + "no Known while try set end date"); - return; - } - Date dt = new Date(end_day); - System.out.println(""+process +" end time for player " + getName() + " is " + dt); - } - else - { - if(process.equals("aio")) - _aio_endTime = 0; - - else - { - System.out.println("process "+ process + "no Known while try set end date"); - return; - } - } - } - public long getAioEndTime() { return _aio_endTime; } + + /** Vip System Start */ + public boolean isVip() + { + return _isVip; + } + + public void setVip(boolean val) + { + _isVip = val; + } + + public void setVipEndTime(long val) + { + _vip_endTime = val; + } + + public long getVipEndTime() + { + return _vip_endTime; + } + + public void setEndTime(String process, int val) + { + if (val > 0) + { + long end_day; + Calendar calendar = Calendar.getInstance(); + if (val >= 30) + { + while(val >= 30) + { + if(calendar.get(Calendar.MONTH)== 11) + calendar.roll(Calendar.YEAR, true); + calendar.roll(Calendar.MONTH, true); + val -= 30; + } + } + if (val < 30 && val > 0) + { + while(val > 0) + { + if(calendar.get(Calendar.DATE)== 28 && calendar.get(Calendar.MONTH) == 1) + calendar.roll(Calendar.MONTH, true); + if(calendar.get(Calendar.DATE)== 30) + { + if(calendar.get(Calendar.MONTH) == 11) + calendar.roll(Calendar.YEAR, true); + calendar.roll(Calendar.MONTH, true); + } + calendar.roll(Calendar.DATE, true); + val--; + } + } + end_day = calendar.getTimeInMillis(); + if(process.equals("aio")) + _aio_endTime = end_day; + else if(process.equals("vip")) + _vip_endTime = end_day; + else + { + System.out.println("Process " + process + " no Known while try set end date."); + return; + } + Date dt = new Date(end_day); + System.out.println("" + process + " end time for player " + getName() + " is " + dt + "."); + } + else + { + if(process.equals("aio")) + _aio_endTime = 0; + else if(process.equals("vip")) + _vip_endTime = 0; + else + { + System.out.println("Process " + process + " no Known while try set end date."); + return; + } + } + } + public long getOfflineStartTime() { return _offlineShopStart; Index: head-src/com/l2jfrozen/gameserver/model/L2Attackable.java =================================================================== --- head-src/com/l2jfrozen/gameserver/model/L2Attackable.java (revision 900) +++ head-src/com/l2jfrozen/gameserver/model/L2Attackable.java (working copy) @@ -823,12 +823,18 @@ player.sendPacket(new SystemMessage(SystemMessageId.OVER_HIT)); exp += calculateOverhitExp(exp); } + if(player.isDonator()) { exp = (long) (exp * Config.DONATOR_XPSP_RATE); sp = (int) (sp * Config.DONATOR_XPSP_RATE); } + if (player.isVip() && Config.ALLOW_VIP_XPSP) + { + exp *= Config.VIP_XP; + sp *= Config.VIP_SP; + } player = null; } Index: head-src/com/l2jfrozen/gameserver/handler/AdminCommandHandler.java =================================================================== --- head-src/com/l2jfrozen/gameserver/handler/AdminCommandHandler.java (revision 900) +++ head-src/com/l2jfrozen/gameserver/handler/AdminCommandHandler.java (working copy) @@ -91,6 +91,7 @@ import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminTvTEngine; import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminUnblockIp; import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminVIPEngine; +import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminVip; import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminZone; /** @@ -185,6 +186,7 @@ registerAdminCommandHandler(new AdminNoble()); registerAdminCommandHandler(new AdminBuffs()); registerAdminCommandHandler(new AdminAio()); + registerAdminCommandHandler(new AdminVip()); //ATTENTION: adding new command handlers, you have to change the //sql file containing the access levels rights Index: head-src/com/l2jfrozen/gameserver/handler/admincommandhandlers/AdminVip.java =================================================================== --- head-src/com/l2jfrozen/gameserver/handler/admincommandhandlers/AdminVip.java (revision 900) +++ head-src/com/l2jfrozen/gameserver/handler/admincommandhandlers/AdminVip.java (working copy) @@ -0,0 +1,273 @@ +/* + * 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 com.l2jfrozen.gameserver.handler.admincommandhandlers; + +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.util.StringTokenizer; +import java.util.logging.Level; +import java.util.logging.Logger; + +import com.l2jfrozen.Config; +import com.l2jfrozen.gameserver.datatables.GmListTable; +import com.l2jfrozen.gameserver.handler.IAdminCommandHandler; +import com.l2jfrozen.gameserver.model.L2World; +import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance; +import com.l2jfrozen.gameserver.network.serverpackets.EtcStatusUpdate; +import com.l2jfrozen.util.CloseUtil; +import com.l2jfrozen.util.database.L2DatabaseFactory; + +/** + * Give / Take Status Vip to Player + * Changes name color and title color if enabled + * + * Uses: + * setvip [<player_name>] [<time_duration in days>] + * removevip [<player_name>] + * + * If <player_name> is not specified, the current target player is used. + * + * + * @author KhayrusS + * + */ +public class AdminVip implements IAdminCommandHandler +{ + private final static Logger _log = Logger.getLogger(AdminVip.class.getName()); + + private static String[] _adminCommands = + { + "admin_setvip", "admin_removevip" + }; + + private enum CommandEnum + { + admin_setvip, + admin_removevip + } + + public boolean useAdminCommand(String command, L2PcInstance activeChar) + { + StringTokenizer st = new StringTokenizer(command); + + CommandEnum comm = CommandEnum.valueOf(st.nextToken()); + + if(comm == null) + return false; + + switch(comm) + { + case admin_setvip: + { + boolean no_token = false; + + if(st.hasMoreTokens()) + { + String char_name = st.nextToken(); + + L2PcInstance player = L2World.getInstance().getPlayer(char_name); + + if(player != null) + { + if (st.hasMoreTokens()) + { + String time = st.nextToken(); + + try{ + int value = Integer.parseInt(time); + + if(value>0) + { + doVip(activeChar, player, char_name, time); + + if(player.isVip()) + return true; + } + else + { + activeChar.sendMessage("Time must be bigger then 0!"); + return false; + } + } + catch(NumberFormatException e) + { + activeChar.sendMessage("Time must be a number!"); + return false; + } + } + else + { + no_token = true; + } + } + else + { + activeChar.sendMessage("Player must be online to set VIP status"); + no_token = true; + } + } + else + { + no_token=true; + } + + if(no_token) + { + activeChar.sendMessage("Usage: //setvip <char_name> [time](in days)"); + return false; + } + } + + case admin_removevip: + { + boolean no_token = false; + + if(st.hasMoreTokens()) + { + String char_name = st.nextToken(); + + L2PcInstance player = L2World.getInstance().getPlayer(char_name); + + if(player!=null) + { + removeVip(activeChar, player, char_name); + + if(!player.isVip()) + return true; + } + else + { + activeChar.sendMessage("Player must be online to remove VIP status"); + no_token = true; + } + } + else + { + no_token = true; + } + + if(no_token) + { + activeChar.sendMessage("Usage: //removevip <char_name>"); + return false; + } + } + } + return true; + } + + public void doVip(L2PcInstance activeChar, L2PcInstance _player, String _playername, String _time) + { + int days = Integer.parseInt(_time); + if (_player == null) + { + activeChar.sendMessage("not found char" + _playername); + return; + } + + if(days > 0) + { + _player.setVip(true); + _player.setEndTime("vip", days); + + Connection connection = null; + try + { + connection = L2DatabaseFactory.getInstance().getConnection(false); + + PreparedStatement statement = connection.prepareStatement("UPDATE characters SET vip=1, vip_end=? WHERE obj_id=?"); + statement.setLong(1, _player.getVipEndTime()); + statement.setInt(2, _player.getObjectId()); + statement.execute(); + statement.close(); + connection.close(); + + if(Config.ALLOW_VIP_NCOLOR && activeChar.isVip()) + _player.getAppearance().setNameColor(Config.VIP_NCOLOR); + + if(Config.ALLOW_VIP_TCOLOR && activeChar.isVip()) + _player.getAppearance().setTitleColor(Config.VIP_TCOLOR); + + _player.broadcastUserInfo(); + _player.sendPacket(new EtcStatusUpdate(_player)); + GmListTable.broadcastMessageToGMs("GM " + activeChar.getName() + " set vip stat for player " + _playername + " for " + _time + " day(s)"); + _player.sendMessage("You are now an Vip, Congratulations!"); + _player.broadcastUserInfo(); + } + catch (Exception e) + { + if(Config.DEBUG) + e.printStackTrace(); + + _log.log(Level.WARNING,"could not set vip stats of char:", e); + } + finally + { + CloseUtil.close(connection); + } + } + else + { + removeVip(activeChar, _player, _playername); + } + } + + public void removeVip(L2PcInstance activeChar, L2PcInstance _player, String _playername) + { + _player.setVip(false); + _player.setVipEndTime(0); + + Connection connection = null; + try + { + connection = L2DatabaseFactory.getInstance().getConnection(false); + + PreparedStatement statement = connection.prepareStatement("UPDATE characters SET vip=0, vip_end=0 WHERE obj_id=?"); + statement.setInt(1, _player.getObjectId()); + statement.execute(); + statement.close(); + connection.close(); + + _player.getAppearance().setTitleColor(0xFFFF77); + _player.getAppearance().setNameColor(0xFFFFFF); + _player.broadcastUserInfo(); + _player.sendPacket(new EtcStatusUpdate(_player)); + GmListTable.broadcastMessageToGMs("GM " + activeChar.getName() + " remove vip stat of player " + _playername); + _player.sendMessage("Now You are not an Vip.."); + _player.broadcastUserInfo(); + } + catch (Exception e) + { + if(Config.DEBUG) + e.printStackTrace(); + + _log.log(Level.WARNING,"could not remove vip stats of char:", e); + } + finally + { + CloseUtil.close(connection); + } + } + + public String[] getAdminCommandList() + { + return _adminCommands; + } +} Index: head-src/com/l2jfrozen/Config.java =================================================================== --- head-src/com/l2jfrozen/Config.java (revision 900) +++ head-src/com/l2jfrozen/Config.java (working copy) @@ -548,6 +548,13 @@ public static int AIO_TCOLOR; public static boolean ALLOW_AIO_USE_GK; public static boolean ALLOW_AIO_USE_CM; + public static boolean ALLOW_VIP_NCOLOR; + public static int VIP_NCOLOR; + public static boolean ALLOW_VIP_TCOLOR; + public static int VIP_TCOLOR; + public static boolean ALLOW_VIP_XPSP; + public static int VIP_XP; + public static int VIP_SP; public static boolean ANNOUNCE_CASTLE_LORDS; /** Configuration to allow custom items to be given on character creation */ @@ -644,6 +651,13 @@ AIO_TCOLOR = Integer.decode("0x" + otherSettings.getProperty("AioTitleColor", "88AA88")); ALLOW_AIO_USE_GK = Boolean.parseBoolean(otherSettings.getProperty("AllowAioUseGk", "False")); ALLOW_AIO_USE_CM = Boolean.parseBoolean(otherSettings.getProperty("AllowAioUseClassMaster", "False")); + ALLOW_VIP_NCOLOR = Boolean.parseBoolean(otherSettings.getProperty("AllowVipNameColor", "True")); + VIP_NCOLOR = Integer.decode("0x" + otherSettings.getProperty("VipNameColor", "0088FF")); + ALLOW_VIP_TCOLOR = Boolean.parseBoolean(otherSettings.getProperty("AllowVipTitleColor", "True")); + VIP_TCOLOR = Integer.decode("0x" + otherSettings.getProperty("VipTitleColor", "0088FF")); + ALLOW_VIP_XPSP = Boolean.parseBoolean(otherSettings.getProperty("AllowVipMulXpSp", "True")); + VIP_XP = Integer.parseInt(otherSettings.getProperty("VipMulXp", "2")); + VIP_SP = Integer.parseInt(otherSettings.getProperty("VipMulSp", "2")); ANNOUNCE_CASTLE_LORDS = Boolean.parseBoolean(otherSettings.getProperty("AnnounceCastleLords", "False")); if(ENABLE_AIO_SYSTEM) //create map if system is enabled {
  9. Does anyone have adapted this code for l2j frozen? can i have a copy? thank you
  10. Could you plz sent me a pm with the ipn updated? or if anyone could help me plz?
  11. Looking for a Graphic Designer i wanna create a logo fror my server plz inform me by pm! I am gonna pay with paypal! Thank you!