Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/config/CustomMods/Donate.ini b/config/CustomMods/Donate.ini
- index e69de29..71feaed 100644
- --- a/config/CustomMods/Donate.ini
- +++ b/config/CustomMods/Donate.ini
- @@ -0,0 +1,59 @@
- +#=============================================================
- +# VIP System
- +#=============================================================
- +EnableVipSystem = True
- +
- +# Enable / Disable Name Color
- +AllowVipNameColor = True
- +VipNameColor = 88AA88
- +
- +# Enable / Disable Title Color
- +AllowVipTitleColor = True
- +VipTitleColor = 88AA88
- +
- +# VIP Xp/Sp Rate
- +VIPXpSpRate = 1.5
- +# VIP Adena rate
- +VIPAdenaRate = 1.5
- +# VIP drop rate
- +VIPDropRate = 1.5
- +# VIP spoil rate
- +VIPSpoilRate = 1.5
- +
- +#Mensagem vip ao entrar em game
- +ScreenVIPMessageText = voce e vip por:
- +#Tempo de mensagem na tela
- +ScreenVIPMessageTime = 4
- +
- +#Mensagem quando acabar o periodo vip
- +ScreenVIPMessageExitText = seu periodo VIP terminou!
- +#Tempo de mensagem na tela Exit
- +ScreenVIPMessageTimeExit = 4
- +
- +#=============================================================
- +# VIP Item 1
- +#=============================================================
- +#registrar esse nome no item no xml abaixo
- +#<set name="handler" val="VipCoin" />
- +#Item Coin 1
- +VipCoin = 0
- +VipCoinDays = 1
- +
- +#=============================================================
- +# VIP Item 2
- +#=============================================================
- +#registrar esse nome no item no xml abaixo
- +#<set name="handler" val="VipCoin" />
- +#Item Coin 2
- +VipCoin2 = 0
- +VipCoinDays2 = 30
- +
- +#=============================================================
- +# VIP Item 3
- +#=============================================================
- +#registrar esse nome no item no xml abaixo
- +#<set name="handler" val="VipCoin" />
- +#Item Coin 3
- +VipCoin3 = 0
- +VipCoinDays3 = 45
- +
- diff --git a/java/net/sf/l2j/Config.java b/java/net/sf/l2j/Config.java
- index 53f4314..574f9e0 100644
- --- a/java/net/sf/l2j/Config.java
- +++ b/java/net/sf/l2j/Config.java
- @@ -43,6 +43,7 @@
- public static final String FLAGZONEMOD = "./config/CustomMods/FlagZone.ini";
- public static final String OFFLINEMOD = "./config/CustomMods/OfflineShop.ini";
- public static final String PROTECTION_MODS = "./config/CustomMods/ProtectionMods.ini";
- + public static final String DONATEMODS = "./config/CustomMods/Donate.ini";
- // --------------------------------------------------
- // Clans settings
- // --------------------------------------------------
- @@ -534,7 +535,25 @@
- public static boolean SERVER_LIST_TESTSERVER;
- public static boolean SERVER_LIST_PVPSERVER;
- public static boolean SERVER_GMONLY;
- -
- + public static boolean ENABLE_VIP_SYSTEM;
- + public static boolean ALLOW_VIP_NCOLOR;
- + public static int VIP_NCOLOR;
- + public static boolean ALLOW_VIP_TCOLOR;
- + public static int VIP_TCOLOR;
- + public static float VIP_XP_SP_RATE;
- + public static float VIP_ADENA_RATE;
- + public static float VIP_DROP_RATE;
- + public static float VIP_SPOIL_RATE;
- + public static String MESSAGE_VIP_ENTER;
- + public static int MESSAGE_TIME_VIP;
- + public static String MESSAGE_VIP_EXIT;
- + public static int MESSAGE_EXIT_VIP_TIME;
- + public static int VIP_COIN_ID1;
- + public static int VIP_DAYS_ID1;
- + public static int VIP_COIN_ID2;
- + public static int VIP_DAYS_ID2;
- + public static int VIP_COIN_ID3;
- + public static int VIP_DAYS_ID3;
- /** clients related */
- public static int DELETE_DAYS;
- public static int MAXIMUM_ONLINE_USERS;
- @@ -1188,6 +1207,30 @@
- }
- + private static final void loadDonate()
- + {
- + final ExProperties Donate = initProperties(DONATEMODS);
- + ENABLE_VIP_SYSTEM = Boolean.parseBoolean(Donate.getProperty("EnableVipSystem", "True"));
- + ALLOW_VIP_NCOLOR = Boolean.parseBoolean(Donate.getProperty("AllowVipNameColor", "True"));
- + VIP_NCOLOR = Integer.decode("0x" + Donate.getProperty("VipNameColor", "88AA88"));
- + ALLOW_VIP_TCOLOR = Boolean.parseBoolean(Donate.getProperty("AllowVipTitleColor", "True"));
- + VIP_TCOLOR = Integer.decode("0x" + Donate.getProperty("VipTitleColor", "88AA88"));
- + VIP_XP_SP_RATE = Float.parseFloat(Donate.getProperty("VIPXpSpRate", "1.5"));
- + VIP_ADENA_RATE = Float.parseFloat(Donate.getProperty("VIPAdenaRate", "1.5"));
- + VIP_DROP_RATE = Float.parseFloat(Donate.getProperty("VIPDropRate", "1.5"));
- + VIP_SPOIL_RATE = Float.parseFloat(Donate.getProperty("VIPSpoilRate", "1.5"));
- + MESSAGE_VIP_ENTER = Donate.getProperty("ScreenVIPMessageText", "Forbidden to Use Enchant near the bank!");
- + MESSAGE_TIME_VIP = Integer.parseInt(Donate.getProperty("ScreenVIPMessageTime", "6")) * 1000;
- + MESSAGE_VIP_EXIT = Donate.getProperty("ScreenVIPMessageExitText", "Forbidden to Use Enchant near the bank!");
- + MESSAGE_EXIT_VIP_TIME = Integer.parseInt(Donate.getProperty("ScreenVIPMessageTimeExit", "6")) * 1000;
- + VIP_COIN_ID1 = Integer.parseInt(Donate.getProperty("VipCoin", "6392"));
- + VIP_DAYS_ID1 = Integer.parseInt(Donate.getProperty("VipCoinDays", "1"));
- + VIP_COIN_ID2 = Integer.parseInt(Donate.getProperty("VipCoin2", "6393"));
- + VIP_DAYS_ID2 = Integer.parseInt(Donate.getProperty("VipCoinDays2", "2"));
- + VIP_COIN_ID3 = Integer.parseInt(Donate.getProperty("VipCoin3", "5557"));
- + VIP_DAYS_ID3 = Integer.parseInt(Donate.getProperty("VipCoinDays3", "3"));
- + }
- +
- private static final void loadFlag()
- {
- final ExProperties flagzone = initProperties(FLAGZONEMOD);
- @@ -1652,6 +1695,7 @@
- loadCommands();
- loadScheme();
- loadFlag();
- + loadDonate();
- loadBoss();
- loadNewChar();
- // players settings
- diff --git a/java/net/sf/l2j/gameserver/handler/AdminCommandHandler.java b/java/net/sf/l2j/gameserver/handler/AdminCommandHandler.java
- index 56beb09..99efa93 100644
- --- a/java/net/sf/l2j/gameserver/handler/AdminCommandHandler.java
- +++ b/java/net/sf/l2j/gameserver/handler/AdminCommandHandler.java
- @@ -34,6 +34,7 @@
- import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminTarget;
- import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminTeleport;
- import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminTest;
- +import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminVip;
- import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminZone;
- public class AdminCommandHandler
- @@ -42,6 +43,7 @@
- protected AdminCommandHandler()
- {
- + registerHandler(new AdminVip());
- registerHandler(new AdminAdmin());
- registerHandler(new AdminAnnouncements());
- registerHandler(new AdminBookmark());
- diff --git a/java/net/sf/l2j/gameserver/handler/ItemHandler.java b/java/net/sf/l2j/gameserver/handler/ItemHandler.java
- index cf6ae07..dbc54c4 100644
- --- a/java/net/sf/l2j/gameserver/handler/ItemHandler.java
- +++ b/java/net/sf/l2j/gameserver/handler/ItemHandler.java
- @@ -29,6 +29,7 @@
- import net.sf.l2j.gameserver.handler.itemhandlers.SpecialXMas;
- import net.sf.l2j.gameserver.handler.itemhandlers.SpiritShots;
- import net.sf.l2j.gameserver.handler.itemhandlers.SummonItems;
- +import net.sf.l2j.gameserver.handler.itemhandlers.VipCoin;
- import net.sf.l2j.gameserver.model.item.kind.EtcItem;
- public class ItemHandler
- @@ -37,6 +38,7 @@
- protected ItemHandler()
- {
- + registerHandler(new VipCoin());
- registerHandler(new BeastSoulShots());
- registerHandler(new BeastSpices());
- registerHandler(new BeastSpiritShots());
- diff --git a/java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminVip.java b/java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminVip.java
- new file mode 100644
- index 0000000..6b957e3
- --- /dev/null
- +++ b/java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminVip.java
- @@ -0,0 +1,213 @@
- +/*
- + * 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.sql.Connection;
- +import java.sql.PreparedStatement;
- +import java.util.StringTokenizer;
- +import java.util.logging.Level;
- +import java.util.logging.Logger;
- +
- +import net.sf.l2j.commons.pool.ConnectionPool;
- +
- +import net.sf.l2j.Config;
- +import net.sf.l2j.gameserver.data.xml.AdminData;
- +import net.sf.l2j.gameserver.enums.SayType;
- +import net.sf.l2j.gameserver.handler.IAdminCommandHandler;
- +import net.sf.l2j.gameserver.model.World;
- +import net.sf.l2j.gameserver.model.WorldObject;
- +import net.sf.l2j.gameserver.model.actor.Player;
- +import net.sf.l2j.gameserver.network.serverpackets.CreatureSay;
- +/**
- + *
- + * @author Sarada
- + *
- + */
- +public class AdminVip implements IAdminCommandHandler
- +{
- + private static String[] _adminCommands = { "admin_setvip", "admin_removevip" };
- + private final static Logger _log = Logger.getLogger(AdminVip.class.getName());
- +
- + @Override
- + public void useAdminCommand(String command, Player activeChar)
- + {
- + if (command.startsWith("admin_setvip"))
- + {
- + StringTokenizer str = new StringTokenizer(command);
- +
- + WorldObject target = activeChar.getTarget();
- + Player player = null;
- +
- + if (target != null && target instanceof Player)
- + player = (Player)target;
- + else
- + player = activeChar;
- +
- + try
- + {
- + str.nextToken();
- + String time = str.nextToken();
- + if (str.hasMoreTokens())
- + {
- + String playername = time;
- + time = str.nextToken();
- + player = World.getInstance().getPlayer(playername);
- + doVip(activeChar, player, playername, time);
- + }
- + else
- + {
- + String playername = player.getName();
- + doVip(activeChar, player, playername, time);
- + }
- + }
- + catch(Exception e)
- + {
- + activeChar.sendMessage("Usage: //setvip <char_name> [time](in days)");
- + }
- +
- + player.broadcastUserInfo();
- +
- + if(player.isVip())
- + return;
- + }
- + else if(command.startsWith("admin_removevip"))
- + {
- + StringTokenizer str = new StringTokenizer(command);
- +
- + WorldObject target = activeChar.getTarget();
- + Player player = null;
- +
- + if (target instanceof Player)
- + player = (Player)target;
- + else
- + player = activeChar;
- +
- + try
- + {
- + str.nextToken();
- +
- + if (str.hasMoreTokens())
- + {
- + String playername = str.nextToken();
- + player = World.getInstance().getPlayer(playername);
- + removeVip(activeChar, player, playername);
- + }
- + else
- + {
- + String playername = player.getName();
- + removeVip(activeChar, player, playername);
- + }
- + }
- + catch(Exception e)
- + {
- + activeChar.sendMessage("Usage: //removevip <char_name>");
- + }
- +
- + player.broadcastUserInfo();
- +
- + if(player.isVip())
- + return;
- + }
- + return;
- + }
- +
- + public void doVip(Player activeChar, Player _player, String _playername, String _time)
- + {
- + int days = Integer.parseInt(_time);
- +
- + if (_player == null)
- + {
- + activeChar.sendMessage("Character not found.");
- + return;
- + }
- + if (_player.isVip())
- + {
- + activeChar.sendMessage("Player " + _playername + " is already an VIP.");
- + return;
- + }
- +
- + if(days > 0)
- + {
- + _player.setVip(true);
- + _player.setEndTime("vip", days);
- + _player.sendPacket(new CreatureSay(0,SayType.PARTYROOM_COMMANDER,"System","Dear player, you are now an VIP, congratulations."));
- +
- + try (Connection con = ConnectionPool.getConnection())
- + {
- + PreparedStatement statement = con.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();
- +
- + if(Config.ALLOW_VIP_NCOLOR)
- + _player.getAppearance().setNameColor(Config.VIP_NCOLOR);
- +
- + if(Config.ALLOW_VIP_TCOLOR)
- + _player.getAppearance().setTitleColor(Config.VIP_TCOLOR);
- +
- + _player.broadcastUserInfo();
- + _player.sendSkillList();
- +
- + AdminData.getInstance().broadcastMessageToGMs("GM "+ activeChar.getName()+ " set an VIP status for player "+ _playername + " for " + _time + " day(s)");
- + }
- + catch (Exception e)
- + {
- + _log.log(Level.WARNING,"Something went wrong, check log folder for details", e);
- + }
- + }
- + }
- +
- + public void removeVip(Player activeChar, Player _player, String _playername)
- + {
- + if (!_player.isVip())
- + {
- + activeChar.sendMessage("Player " + _playername + " is not an VIP.");
- + return;
- + }
- +
- + _player.setVip(false);
- + _player.setVipEndTime(0);
- +
- + try (Connection con = ConnectionPool.getConnection())
- + {
- + PreparedStatement statement = con.prepareStatement("UPDATE characters SET Vip=0, Vip_end=0 WHERE obj_id=?");
- + statement.setInt(1, _player.getObjectId());
- + statement.execute();
- + statement.close();
- +
- + _player.getAppearance().setNameColor(0xFFFF77);
- + _player.getAppearance().setTitleColor(0xFFFF77);
- + _player.broadcastUserInfo();
- + _player.sendSkillList();
- +
- + AdminData.getInstance().broadcastMessageToGMs("GM "+activeChar.getName()+" removed Vip status of player "+ _playername);
- + }
- + catch (Exception e)
- + {
- + _log.log(Level.WARNING,"Something went wrong, check log folder for details", e);
- + }
- + }
- +
- + @Override
- + public String[] getAdminCommandList()
- + {
- + return _adminCommands;
- + }
- +}
- \ No newline at end of file
- diff --git a/java/net/sf/l2j/gameserver/handler/itemhandlers/VipCoin.java b/java/net/sf/l2j/gameserver/handler/itemhandlers/VipCoin.java
- new file mode 100644
- index 0000000..c80e15a
- --- /dev/null
- +++ b/java/net/sf/l2j/gameserver/handler/itemhandlers/VipCoin.java
- @@ -0,0 +1,149 @@
- +package net.sf.l2j.gameserver.handler.itemhandlers;
- +
- +import java.util.Calendar;
- +
- +import net.sf.l2j.Config;
- +import net.sf.l2j.gameserver.handler.IItemHandler;
- +import net.sf.l2j.gameserver.model.actor.Playable;
- +import net.sf.l2j.gameserver.model.actor.Player;
- +import net.sf.l2j.gameserver.model.item.instance.ItemInstance;
- +import net.sf.l2j.gameserver.network.serverpackets.EtcStatusUpdate;
- +
- +/**
- + *
- + * @author Sarada
- + *
- + */
- +public class VipCoin implements IItemHandler
- +{
- + private static final int ITEM_IDS[] = { Config.VIP_COIN_ID1, Config.VIP_COIN_ID2, Config.VIP_COIN_ID3};
- +
- + @Override
- + public void useItem(Playable playable, ItemInstance item, boolean forceUse)
- + {
- + if (!(playable instanceof Player))
- + return;
- +
- + Player activeChar = (Player)playable;
- +
- + int itemId = item.getItemId();
- +
- + if (itemId == Config.VIP_COIN_ID1)
- + {
- + if (activeChar.isInOlympiadMode())
- + {
- + activeChar.sendMessage("This item cannot be used on Olympiad Games.");
- + return;
- + }
- + else if (activeChar.isVip())
- + {
- + activeChar.sendMessage("You Are Vip!.");
- + return;
- + }
- + if (activeChar.destroyItem("Consume", item.getObjectId(), 1, null, false))
- + {
- + if (activeChar.isVip())
- + {
- + long daysleft = (activeChar.getVipEndTime() - Calendar.getInstance().getTimeInMillis()) / 86400000L;
- + activeChar.setEndTime("vip", (int)(daysleft + Config.VIP_DAYS_ID1));
- + activeChar.sendMessage("Congratulations, You just received another " + Config.VIP_DAYS_ID1 + " day of VIP.");
- + }
- + else
- + {
- + activeChar.setVip(true);
- + activeChar.setEndTime("vip", Config.VIP_DAYS_ID1);
- + activeChar.sendMessage("Congrats, you just became VIP per " + Config.VIP_DAYS_ID1 + " day.");
- + }
- +
- + 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);
- +
- + activeChar.broadcastUserInfo();
- + activeChar.sendPacket(new EtcStatusUpdate(activeChar));
- + }
- + }
- +
- + if (itemId == Config.VIP_COIN_ID2)
- + {
- + if (activeChar.isInOlympiadMode())
- + {
- + activeChar.sendMessage("This item cannot be used on Olympiad Games.");
- + return;
- + }
- + else if (activeChar.isVip())
- + {
- + activeChar.sendMessage("You Are Vip!.");
- + return;
- + }
- + if (activeChar.destroyItem("Consume", item.getObjectId(), 1, null, false))
- + {
- + if (activeChar.isVip())
- + {
- + long daysleft = (activeChar.getVipEndTime() - Calendar.getInstance().getTimeInMillis()) / 86400000L;
- + activeChar.setEndTime("vip", (int)(daysleft + Config.VIP_DAYS_ID2));
- + activeChar.sendMessage("Congratulations, You just received another " + Config.VIP_DAYS_ID2 + " day of VIP.");
- + }
- + else
- + {
- + activeChar.setVip(true);
- + activeChar.setEndTime("vip", Config.VIP_DAYS_ID2);
- + activeChar.sendMessage("Congrats, you just became VIP per " + Config.VIP_DAYS_ID2 + " day.");
- + }
- +
- + 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);
- +
- + activeChar.broadcastUserInfo();
- + activeChar.sendPacket(new EtcStatusUpdate(activeChar));
- + }
- + }
- +
- + if (itemId == Config.VIP_COIN_ID3)
- + {
- + if (activeChar.isInOlympiadMode())
- + {
- + activeChar.sendMessage("This item cannot be used on Olympiad Games.");
- + return;
- + }
- + else if (activeChar.isVip())
- + {
- + activeChar.sendMessage("You Are Vip!.");
- + return;
- + }
- + if (activeChar.destroyItem("Consume", item.getObjectId(), 1, null, false))
- + {
- + if (activeChar.isVip())
- + {
- + long daysleft = (activeChar.getVipEndTime() - Calendar.getInstance().getTimeInMillis()) / 86400000L;
- + activeChar.setEndTime("vip", (int)(daysleft + Config.VIP_DAYS_ID3));
- + activeChar.sendMessage("Congratulations, You just received another " + Config.VIP_DAYS_ID3 + " day of VIP.");
- + }
- + else
- + {
- + activeChar.setVip(true);
- + activeChar.setEndTime("vip", Config.VIP_DAYS_ID3);
- + activeChar.sendMessage("Congrats, you just became VIP per " + Config.VIP_DAYS_ID3 + " day.");
- + }
- +
- + 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);
- +
- + activeChar.broadcastUserInfo();
- + activeChar.sendPacket(new EtcStatusUpdate(activeChar));
- + }
- + }
- + }
- + public int[] getItemIds()
- + {
- + return ITEM_IDS;
- + }
- +}
- diff --git a/java/net/sf/l2j/gameserver/model/actor/Player.java b/java/net/sf/l2j/gameserver/model/actor/Player.java
- index de2c3e1..6c99cca 100644
- --- a/java/net/sf/l2j/gameserver/model/actor/Player.java
- +++ b/java/net/sf/l2j/gameserver/model/actor/Player.java
- @@ -5,6 +5,7 @@
- import java.sql.ResultSet;
- import java.util.ArrayList;
- import java.util.Arrays;
- +import java.util.Calendar;
- import java.util.Collection;
- import java.util.Comparator;
- import java.util.HashMap;
- @@ -237,7 +238,7 @@
- private static final String DELETE_SKILL_SAVE = "DELETE FROM character_skills_save WHERE char_obj_id=? AND class_index=?";
- private static final String INSERT_CHARACTER = "INSERT INTO characters (account_name,obj_Id,char_name,level,maxHp,curHp,maxCp,curCp,maxMp,curMp,face,hairStyle,hairColor,sex,exp,sp,karma,pvpkills,pkkills,clanid,race,classid,deletetime,cancraft,title,accesslevel,online,isin7sdungeon,clan_privs,wantspeace,base_class,nobless,power_grade) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
- - private static final String UPDATE_CHARACTER = "UPDATE characters SET level=?,maxHp=?,curHp=?,maxCp=?,curCp=?,maxMp=?,curMp=?,face=?,hairStyle=?,hairColor=?,sex=?,heading=?,x=?,y=?,z=?,exp=?,expBeforeDeath=?,sp=?,karma=?,pvpkills=?,pkkills=?,clanid=?,race=?,classid=?,deletetime=?,title=?,accesslevel=?,online=?,isin7sdungeon=?,clan_privs=?,wantspeace=?,base_class=?,onlinetime=?,punish_level=?,punish_timer=?,nobless=?,power_grade=?,subpledge=?,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 UPDATE_CHARACTER = "UPDATE characters SET level=?,maxHp=?,curHp=?,maxCp=?,curCp=?,maxMp=?,curMp=?,face=?,hairStyle=?,hairColor=?,sex=?,heading=?,x=?,y=?,z=?,exp=?,expBeforeDeath=?,sp=?,karma=?,pvpkills=?,pkkills=?,clanid=?,race=?,classid=?,deletetime=?,title=?,accesslevel=?,online=?,isin7sdungeon=?,clan_privs=?,wantspeace=?,base_class=?,onlinetime=?,punish_level=?,punish_timer=?,nobless=?,power_grade=?,subpledge=?,lvl_joined_academy=?,apprentice=?,sponsor=?,varka_ketra_ally=?,clan_join_expiry_time=?,clan_create_expiry_time=?,char_name=?,death_penalty_level=?,vip=?,vip_end=? WHERE obj_id=?";
- private static final String RESTORE_CHARACTER = "SELECT * FROM characters WHERE obj_id=?";
- private static final String RESTORE_CHAR_SUBCLASSES = "SELECT class_id,exp,sp,level,class_index FROM character_subclasses WHERE char_obj_id=? ORDER BY class_index ASC";
- @@ -320,7 +321,9 @@
- private int _mountNpcId;
- private int _mountLevel;
- private int _mountObjectId;
- -
- + /** VIP System */
- + private boolean _isVip = false;
- + private long _vip_endTime = 0;
- protected int _throneId;
- private TeleportMode _teleportMode = TeleportMode.NONE;
- @@ -4344,6 +4347,8 @@
- player.setAllianceWithVarkaKetra(rs.getInt("varka_ketra_ally"));
- player.setDeathPenaltyBuffLevel(rs.getInt("death_penalty_level"));
- + player.setVip(rs.getInt("vip") == 1 ? true : false);
- + player.setVipEndTime(rs.getLong("vip_end"));
- // Set the position of the Player.
- player.getPosition().set(rs.getInt("x"), rs.getInt("y"), rs.getInt("z"), rs.getInt("heading"));
- @@ -4574,7 +4579,9 @@
- ps.setLong(44, getClanCreateExpiryTime());
- ps.setString(45, getName());
- ps.setLong(46, getDeathPenaltyBuffLevel());
- - ps.setInt(47, getObjectId());
- + ps.setInt(47, isVip() ? 1 : 0);
- + ps.setLong(48, getVipEndTime());
- + ps.setInt(49, getObjectId());
- ps.execute();
- }
- @@ -4705,7 +4712,25 @@
- LOGGER.error("Couldn't store player effects.", e);
- }
- }
- + public boolean isVip()
- + {
- + return _isVip;
- + }
- + public void setVip(boolean val)
- + {
- + _isVip = val;
- + }
- +
- + public long getVipEndTime()
- + {
- + return _vip_endTime;
- + }
- +
- + public void setVipEndTime(long val)
- + {
- + _vip_endTime = val;
- + }
- /**
- * @return True if the Player is online.
- */
- @@ -4713,7 +4738,22 @@
- {
- return _isOnline;
- }
- -
- + /**
- + * Sets the end time.
- + * @param process the process
- + * @param val the val
- + */
- + public void setEndTime(String process, int val)
- + {
- + Calendar calendar = Calendar.getInstance();
- + calendar.add(Calendar.DAY_OF_MONTH, val);
- + long end_day = calendar.getTimeInMillis();
- +
- + if(process.equals("vip"))
- + _vip_endTime = end_day;
- + /*if(process.equals("aio"))
- + _aio_endTime = end_day;*/
- + }
- /**
- * @return an int interpretation of online status.
- */
- diff --git a/java/net/sf/l2j/gameserver/model/actor/instance/Monster.java b/java/net/sf/l2j/gameserver/model/actor/instance/Monster.java
- index 51afb41..8663495 100644
- --- a/java/net/sf/l2j/gameserver/model/actor/instance/Monster.java
- +++ b/java/net/sf/l2j/gameserver/model/actor/instance/Monster.java
- @@ -70,6 +70,7 @@
- super(objectId, template);
- }
- + @SuppressWarnings("cast")
- @Override
- protected void calculateRewards(Creature creature)
- {
- @@ -163,7 +164,16 @@
- long exp = expSp[0];
- int sp = expSp[1];
- -
- + if (attacker instanceof Player)
- + {
- + Player a = (Player)attacker;
- +
- + if (a.isVip())
- + {
- + exp *= Config.VIP_XP_SP_RATE;
- + sp *= Config.VIP_XP_SP_RATE;
- + }
- + }
- exp *= 1 - penalty;
- // Test over-hit.
- @@ -234,7 +244,16 @@
- final int[] expSp = calculateExpAndSp(levelDiff, partyDmg, totalDamage);
- long exp = expSp[0];
- int sp = expSp[1];
- -
- + if (attacker instanceof Player)
- + {
- + Player a = (Player)attacker;
- +
- + if (a.isVip())
- + {
- + exp *= Config.VIP_XP_SP_RATE;
- + sp *= Config.VIP_XP_SP_RATE;
- + }
- + }
- exp *= partyMul;
- sp *= partyMul;
- @@ -514,12 +533,13 @@
- /**
- * Calculate the quantity for a specific drop.
- + * @param lastAttacker
- * @param drop : The {@link DropData} informations to use.
- * @param levelModifier : The level modifier (will be subtracted from drop chance).
- * @param isSweep : If True, use the spoil drop chance.
- * @return An {@link IntIntHolder} corresponding to the item id and count.
- */
- - private IntIntHolder calculateRewardItem(DropData drop, int levelModifier, boolean isSweep)
- + private IntIntHolder calculateRewardItem(Player lastAttacker,DropData drop, int levelModifier, boolean isSweep)
- {
- // Get default drop chance
- double dropChance = drop.getChance();
- @@ -547,11 +567,23 @@
- // Applies Drop rates
- if (drop.getItemId() == 57)
- dropChance *= Config.RATE_DROP_ADENA;
- + if (lastAttacker.isVip())
- + {
- + dropChance *= Config.VIP_ADENA_RATE;
- + }
- +
- else if (isSweep)
- dropChance *= Config.RATE_DROP_SPOIL;
- + if (lastAttacker.isVip())
- + {
- + dropChance *= Config.VIP_SPOIL_RATE;
- + }
- else
- dropChance *= (isRaidBoss()) ? Config.RATE_DROP_ITEMS_BY_RAID : Config.RATE_DROP_ITEMS;
- -
- + if (lastAttacker.isVip())
- + {
- + dropChance *= Config.VIP_DROP_RATE;
- + }
- // Set our limits for chance of drop
- if (dropChance < 1)
- dropChance = 1;
- @@ -589,11 +621,12 @@
- * Calculate the quantity for a specific drop, according its {@link DropCategory}.<br>
- * <br>
- * Only a maximum of ONE item from a {@link DropCategory} is allowed to be dropped.
- + * @param lastAttacker
- * @param cat : The {@link DropCategory} informations to use.
- * @param levelModifier : The level modifier (will be subtracted from drop chance).
- * @return An {@link IntIntHolder} corresponding to the item id and count.
- */
- - private IntIntHolder calculateCategorizedRewardItem(DropCategory cat, int levelModifier)
- + private IntIntHolder calculateCategorizedRewardItem(Player lastAttacker,DropCategory cat, int levelModifier)
- {
- if (cat == null)
- return null;
- @@ -641,9 +674,16 @@
- double dropChance = drop.getChance();
- if (drop.getItemId() == 57)
- dropChance *= Config.RATE_DROP_ADENA;
- + if (lastAttacker.isVip())
- + {
- + dropChance *= Config.VIP_ADENA_RATE;
- + }
- else
- dropChance *= (isRaidBoss()) ? Config.RATE_DROP_ITEMS_BY_RAID : Config.RATE_DROP_ITEMS;
- -
- + if (lastAttacker.isVip())
- + {
- + dropChance *= Config.VIP_DROP_RATE;
- + }
- if (dropChance < DropData.MAX_CHANCE)
- dropChance = DropData.MAX_CHANCE;
- @@ -838,7 +878,7 @@
- {
- for (DropData drop : cat.getAllDrops())
- {
- - holder = calculateRewardItem(drop, levelModifier, true);
- + holder = calculateRewardItem(player,drop, levelModifier, true);
- if (holder == null)
- continue;
- @@ -854,10 +894,10 @@
- if (drop == null)
- continue;
- - holder = calculateRewardItem(drop, levelModifier, false);
- + holder = calculateRewardItem(player,drop, levelModifier, false);
- }
- else
- - holder = calculateCategorizedRewardItem(cat, levelModifier);
- + holder = calculateCategorizedRewardItem(player,cat, levelModifier);
- if (holder == null)
- continue;
- diff --git a/java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java b/java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java
- index 3e30838..9f6addd 100644
- --- a/java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java
- +++ b/java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java
- @@ -1,5 +1,7 @@
- package net.sf.l2j.gameserver.network.clientpackets;
- +import java.util.Calendar;
- +import java.util.Date;
- import java.util.Map.Entry;
- import net.sf.l2j.Config;
- @@ -37,6 +39,7 @@
- import net.sf.l2j.gameserver.network.serverpackets.Die;
- import net.sf.l2j.gameserver.network.serverpackets.EtcStatusUpdate;
- import net.sf.l2j.gameserver.network.serverpackets.ExMailArrived;
- +import net.sf.l2j.gameserver.network.serverpackets.ExShowScreenMessage;
- import net.sf.l2j.gameserver.network.serverpackets.ExStorageMaxCount;
- import net.sf.l2j.gameserver.network.serverpackets.FriendList;
- import net.sf.l2j.gameserver.network.serverpackets.HennaInfo;
- @@ -241,6 +244,16 @@
- player.sendMessage("I'm sorry, but multibox is not allowed here.");
- player.logout(true);
- }
- +
- + if(player.isVip())
- + onEnterVip(player);
- +
- + if(Config.ALLOW_VIP_NCOLOR && player.isVip())
- + player.getAppearance().setNameColor(Config.VIP_NCOLOR);
- +
- + if(Config.ALLOW_VIP_TCOLOR && player.isVip())
- + player.getAppearance().setTitleColor(Config.VIP_TCOLOR);
- +
- // If the Player is a Dark Elf, check for Shadow Sense at night.
- if (player.getRace() == ClassRace.DARK_ELF && player.hasSkill(L2Skill.SKILL_SHADOW_SENSE))
- player.sendPacket(SystemMessage.getSystemMessage((GameTimeTaskManager.getInstance().isNight()) ? SystemMessageId.NIGHT_S1_EFFECT_APPLIES : SystemMessageId.DAY_S1_EFFECT_DISAPPEARS).addSkillName(L2Skill.SKILL_SHADOW_SENSE));
- @@ -320,7 +333,25 @@
- {
- activeChar.sendMessage("Next Restart: " + Restart.getInstance().getRestartNextTime());
- }
- -
- + private static void onEnterVip(Player activeChar)
- + {
- + long now = Calendar.getInstance().getTimeInMillis();
- + long endDay = activeChar.getVipEndTime();
- + if(now > endDay)
- + {
- + activeChar.setVip(false);
- + activeChar.setVipEndTime(0);
- + //activeChar.sendPacket(new CreatureSay(0,Say2.PARTY,"System","Your VIP period ends."));
- + activeChar.sendPacket(new ExShowScreenMessage(Config.MESSAGE_VIP_EXIT, Config.MESSAGE_EXIT_VIP_TIME));
- + }
- + else
- + {
- + Date dt = new Date(endDay);
- + if(activeChar.isVip())
- + //activeChar.sendMessage("Your VIP period ends at: " + dt);
- + activeChar.sendPacket(new ExShowScreenMessage(Config.MESSAGE_VIP_ENTER + dt, Config.MESSAGE_TIME_VIP));
- + }
- + }
- @Override
- protected boolean triggersOnActionRequest()
- {
- Colocar num bloco de notas e salvar como SQL e executar em seu navicat
- +ALTER TABLE `characters` ADD COLUMN `vip` decimal(1,0) NOT NULL DEFAULT 0 AFTER `death_penalty_level`;
- +ALTER TABLE `characters` ADD COLUMN `vip_end` decimal(20,0) NOT NULL DEFAULT 0 AFTER `vip`;
- Registrar admincomands no xml
- +<aCar name="admin_setvip" accessLevel="7" />
- +<aCar name="admin_removevip" accessLevel="7" />
Add Comment
Please, Sign In to add comment