Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ### Eclipse Workspace Patch 1.0
- #P L2JHellasC
- Index: java/com/l2jhellas/gameserver/model/actor/L2Attackable.java
- ===================================================================
- --- java/com/l2jhellas/gameserver/model/actor/L2Attackable.java (revision 516)
- +++ java/com/l2jhellas/gameserver/model/actor/L2Attackable.java (working copy)
- @@ -982,6 +982,10 @@
- exp += calculateOverhitExp(exp);
- exp_premium += calculateOverhitExp(exp_premium);
- }
- + if (player.isVip() && Config.ALLOW_VIP_XPSP){
- + exp *= Config.VIP_XP;
- + sp *= Config.VIP_SP;
- + }
- }
- // Distribute the Exp and SP between the L2PcInstance and its L2Summon
- Index: java/com/l2jhellas/gameserver/model/actor/instance/L2PcInstance.java
- ===================================================================
- --- java/com/l2jhellas/gameserver/model/actor/instance/L2PcInstance.java (revision 516)
- +++ java/com/l2jhellas/gameserver/model/actor/instance/L2PcInstance.java (working copy)
- @@ -269,8 +269,8 @@
- private static final String DELETE_SKILL_SAVE = "DELETE FROM character_skills_save WHERE char_obj_id=? AND class_index=?";
- // Character Character
- - 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=?, chat_filter_count=?,hitman_target=?, event_points=? 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, hero, donator, chatban_timer, chatban_reason, chat_filter_count,hitman_target, email, emailcode, hasSubEmail, answer, secCode, emailchangecode, hasSubSec, lastVoteHopzone, lastVoteTopzone, hasVotedHop, hasVotedTop, monthVotes, totalVotes, tries, event_points 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=?, chat_filter_count=?,hitman_target=?, event_points=?, vip=?, vip_end=? 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, hero, donator, chatban_timer, chatban_reason, chat_filter_count,hitman_target, email, emailcode, hasSubEmail, answer, secCode, emailchangecode, hasSubSec, lastVoteHopzone, lastVoteTopzone, hasVotedHop, hasVotedTop, monthVotes, totalVotes, tries, event_points, vip, vip_end 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";
- private static final String INSERT_CHARACTER = "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) values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
- @@ -627,6 +627,10 @@
- private boolean _noble = false;
- private boolean _hero = false;
- +
- + /** VIP System */
- + private boolean _isVip = false;
- + private long _vip_endTime = 0;
- /** Account Manager */
- private String _email = null;
- @@ -7373,6 +7377,9 @@
- player.setDeathPenaltyBuffLevel(rset.getInt("death_penalty_level"));
- + player.setVip(rset.getInt("vip") == 1 ? true : false);
- + player.setVipEndTime(rset.getLong("vip_end"));
- +
- player.setChatFilterCount(rset.getInt("chat_filter_count"));
- player.setHitmanTarget(rset.getInt("hitman_target"));
- player._email = rset.getString("email");
- @@ -7752,7 +7759,9 @@
- statement.setInt(57, getChatFilterCount());
- statement.setInt(58, getHitmanTarget());
- statement.setInt(59, getEventPoints());
- - statement.setInt(60, getObjectId());
- + statement.setInt(60, isVip() ? 1 : 0);
- + statement.setLong(61, getVipEndTime());
- + statement.setInt(62, getObjectId());
- statement.execute();
- statement.close();
- @@ -12620,6 +12629,36 @@
- }
- }
- + 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;
- + }
- +
- + 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;
- + }
- +
- public int getPowerGrade()
- {
- return _powerGrade;
- Index: java/com/l2jhellas/gameserver/network/clientpackets/EnterWorld.java
- ===================================================================
- --- java/com/l2jhellas/gameserver/network/clientpackets/EnterWorld.java (revision 516)
- +++ java/com/l2jhellas/gameserver/network/clientpackets/EnterWorld.java (working copy)
- @@ -12,8 +12,13 @@
- */
- package com.l2jhellas.gameserver.network.clientpackets;
- +import java.util.Calendar;
- +import java.util.Date;
- +
- +import com.l2jhellas.Config;
- import com.l2jhellas.gameserver.TaskPriority;
- import com.l2jhellas.gameserver.model.actor.instance.L2PcInstance;
- +import com.l2jhellas.gameserver.network.serverpackets.CreatureSay;
- /**
- * Enter World Packet Handler
- @@ -46,6 +51,20 @@
- return;
- }
- activeChar.checks();
- +
- + 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();
- + }
- +
- }
- @Override
- @@ -53,4 +72,19 @@
- {
- return _C__03_ENTERWORLD;
- }
- +
- + private static void onEnterVip(L2PcInstance 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.HERO_VOICE,"System","Your VIP period ends."));
- + } else {
- + Date dt = new Date(endDay);
- + if(activeChar.isVip()) {
- + activeChar.sendMessage("Your VIP period ends at: " + dt);
- + }
- + }
- + }
- }
- \ No newline at end of file
- Index: config/Mods/Vip System.ini
- ===================================================================
- --- config/Mods/Vip System.ini (revision 0)
- +++ config/Mods/Vip System.ini (working copy)
- @@ -0,0 +1,16 @@
- +# ---------------------------------------
- +# 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
- \ No newline at end of file
- Index: java/com/l2jhellas/Config.java
- ===================================================================
- --- java/com/l2jhellas/Config.java (revision 516)
- +++ java/com/l2jhellas/Config.java (working copy)
- @@ -87,6 +87,7 @@
- private static final String MOD_AUTOMATION_CONFIG_FILE = "./config/Mods/Automatation.ini";
- private static final String MOD_SMART_CB_CONFIG_FILE = "./config/Mods/Smart Community Board.ini";
- private static final String MOD_CUSTOM_NPC_CONFIG_FILE = "./config/Mods/Custom Npcs.ini";
- + private static final String MOD_VIP_SYSTEM_CONFIG_FILE = "./config/Mods/VipSystem.ini";
- // Olympiad Folder
- private static final String OLYMPIAD_FILE = "./config/Olympiad/OlySettings.ini";
- // Others
- @@ -703,6 +704,16 @@
- public static boolean RAID_INFO_SHOW_TIME;
- + /**
- + * NPC Config File
- + */
- + 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;
- /** new Olympiad */
- public static int ALT_OLY_START_TIME;
- @@ -2422,8 +2433,28 @@
- BOSS_RESPAWN_INFO[info] = Integer.parseInt(notenchantable[info]);
- Arrays.sort(BOSS_RESPAWN_INFO);
- RAID_INFO_SHOW_TIME = Boolean.parseBoolean(CustomNpcSettings.getProperty("InfoShowTime", "False"));
- -
- +
- /**
- + * Custom Npc
- + */
- + Properties VipSystemSettings = new Properties();
- + try (InputStream is = new FileInputStream(new File(MOD_VIP_SYSTEM_CONFIG_FILE)))
- + {
- + CustomNpcSettings.load(is);
- + }
- + catch (Exception e)
- + {
- + _log.severe(Config.class.getName() + ": Error while loading " + MOD_VIP_SYSTEM_CONFIG_FILE + " settings!");
- + }
- + ALLOW_VIP_NCOLOR = Boolean.parseBoolean(VipSystemSettings.getProperty("AllowVipNameColor", "True"));
- + VIP_NCOLOR = Integer.decode("0x" + VipSystemSettings.getProperty("VipNameColor", "0088FF"));
- + ALLOW_VIP_TCOLOR = Boolean.parseBoolean(VipSystemSettings.getProperty("AllowVipTitleColor", "True"));
- + VIP_TCOLOR = Integer.decode("0x" + VipSystemSettings.getProperty("VipTitleColor", "0088FF"));
- + ALLOW_VIP_XPSP = Boolean.parseBoolean(VipSystemSettings.getProperty("AllowVipMulXpSp", "True"));
- + VIP_XP = Integer.parseInt(VipSystemSettings.getProperty("VipMulXp", "2"));
- + VIP_SP = Integer.parseInt(VipSystemSettings.getProperty("VipMulSp", "2"));
- +
- + /**
- * Olympiad
- */
- Properties OlySettings = new Properties();
- Index: java/com/l2jhellas/gameserver/handler/admincommandhandlers/AdminVip.java
- ===================================================================
- --- java/com/l2jhellas/gameserver/handler/admincommandhandlers/AdminVip.java (revision 0)
- +++ java/com/l2jhellas/gameserver/handler/admincommandhandlers/AdminVip.java (working copy)
- @@ -0,0 +1,218 @@
- +/*
- + * 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.l2jhellas.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.l2jhellas.Config;
- +import com.l2jhellas.util.database.L2DatabaseFactory;
- +import com.l2jhellas.gameserver.datatables.xml.AdminData;
- +import com.l2jhellas.gameserver.handler.IAdminCommandHandler;
- +import com.l2jhellas.gameserver.model.L2Object;
- +import com.l2jhellas.gameserver.model.L2World;
- +import com.l2jhellas.gameserver.model.actor.instance.L2PcInstance;
- +import com.l2jhellas.gameserver.network.clientpackets.Say2;
- +import com.l2jhellas.gameserver.network.serverpackets.CreatureSay;
- +import com.l2jhellas.gameserver.network.serverpackets.EtcStatusUpdate;
- +
- +/**
- + * Give / remove vip status to player
- + * Changes name color and title color if enabled
- + *
- + * Uses:
- + * setvip [<player_name>] [<time_duration in days>]
- + *
- + * If <player_name> is not specified, the current target player is used.
- + *
- + * @author Danilo Nascimento
- + *
- + */
- +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 boolean useAdminCommand(String command, L2PcInstance activeChar)
- + {
- + if (command.startsWith("admin_setvip"))
- + {
- + StringTokenizer str = new StringTokenizer(command);
- +
- + L2Object target = activeChar.getTarget();
- + L2PcInstance player = null;
- +
- + if (target != null && target instanceof L2PcInstance)
- + player = (L2PcInstance)target;
- + else
- + player = activeChar;
- +
- + try
- + {
- + str.nextToken();
- + String time = str.nextToken();
- + if (str.hasMoreTokens())
- + {
- + String playername = time;
- + time = str.nextToken();
- + player = L2World.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 true;
- + }
- + else if(command.startsWith("admin_removevip"))
- + {
- + StringTokenizer str = new StringTokenizer(command);
- +
- + L2Object target = activeChar.getTarget();
- + L2PcInstance player = null;
- +
- + if (target instanceof L2PcInstance)
- + player = (L2PcInstance)target;
- + else
- + player = activeChar;
- +
- + try
- + {
- + str.nextToken();
- +
- + if (str.hasMoreTokens())
- + {
- + String playername = str.nextToken();
- + player = L2World.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 false;
- + }
- + return false;
- + }
- +
- + public void doVip(L2PcInstance activeChar, L2PcInstance _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,Say2.HERO_VOICE,"System","Dear player, you are now an VIP, congratulations."));
- +
- + try (Connection con = L2DatabaseFactory.getInstance().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 && 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));
- + 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(L2PcInstance activeChar, L2PcInstance _player, String _playername)
- + {
- + if (!_player.isVip())
- + {
- + activeChar.sendMessage("Player " + _playername + " is not an VIP.");
- + return;
- + }
- +
- + _player.setVip(false);
- + _player.setVipEndTime(0);
- +
- + try (Connection con = L2DatabaseFactory.getInstance().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
- Index: java/com/l2jhellas/gameserver/handler/AdminCommandHandler.java
- ===================================================================
- --- java/com/l2jhellas/gameserver/handler/AdminCommandHandler.java (revision 516)
- +++ java/com/l2jhellas/gameserver/handler/AdminCommandHandler.java (working copy)
- @@ -17,6 +17,8 @@
- import java.util.HashMap;
- import java.util.Map;
- +import com.l2jhellas.gameserver.handler.admincommandhandlers.AdminVip;
- +
- public class AdminCommandHandler implements IHandler<IAdminCommandHandler, String>
- {
- private final Map<String, IAdminCommandHandler> _datatable;
- @@ -24,6 +26,7 @@
- protected AdminCommandHandler()
- {
- _datatable = new HashMap<>();
- + registerHandler(new AdminVip());
- }
- @Override
Advertisement
Add Comment
Please, Sign In to add comment