Jump to content
  • 0

Vip System [Help Request]


Question

Posted

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

{

 

1 answer to this question

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.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...