Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Index: java/net/l2jalpha/gameserver/network/clientpackets/EnterWorld.java
- ===================================================================
- --- java/net/l2jalpha/gameserver/network/clientpackets/EnterWorld.java (revision 31)
- +++ java/net/l2jalpha/gameserver/network/clientpackets/EnterWorld.java (working copy)
- @@ -27,6 +27,7 @@
- import net.l2jalpha.gameserver.Announcements;
- import net.l2jalpha.gameserver.GmListTable;
- import net.l2jalpha.gameserver.TaskPriority;
- +import net.l2jalpha.gameserver.ThreadPoolManager;
- import net.l2jalpha.gameserver.cache.HtmCache;
- import net.l2jalpha.gameserver.communitybbs.Manager.RegionBBSManager;
- import net.l2jalpha.gameserver.datatables.sql.AdminCommandAccessRights;
- @@ -46,6 +47,7 @@
- import net.l2jalpha.gameserver.model.entity.ClanHall;
- import net.l2jalpha.gameserver.model.entity.Hero;
- import net.l2jalpha.gameserver.model.entity.Siege;
- +import net.l2jalpha.gameserver.model.entity.VipRemoval;
- import net.l2jalpha.gameserver.model.olympiad.Olympiad;
- import net.l2jalpha.gameserver.model.quest.Quest;
- import net.l2jalpha.gameserver.network.SystemMessageId;
- @@ -281,6 +283,19 @@
- RegionBBSManager.getInstance().changeCommunityBoard();
- + if (activeChar.isVip())
- + {
- + if ((activeChar.getVipSetTime()+(activeChar.getVipHours()*1000*60*60)) < System.currentTimeMillis())
- + {
- + activeChar.setVip(false);
- + activeChar.setVipHours(0);
- + activeChar.setVipSetTime(0);
- + }
- + else
- + {
- + ThreadPoolManager.getInstance().scheduleGeneral(new VipRemoval(activeChar.getName()), System.currentTimeMillis() - (activeChar.getVipSetTime()+(activeChar.getVipHours()*1000*60*60)));
- + }
- + }
- }
- /**
- Index: java/net/l2jalpha/gameserver/model/entity/VipRemoval.java
- ===================================================================
- --- java/net/l2jalpha/gameserver/model/entity/VipRemoval.java (revision 0)
- +++ java/net/l2jalpha/gameserver/model/entity/VipRemoval.java (working copy)
- @@ -0,0 +1,48 @@
- +/* 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.l2jalpha.gameserver.model.entity;
- +
- +import net.l2jalpha.gameserver.model.L2World;
- +import net.l2jalpha.gameserver.model.actor.instance.L2PcInstance;
- +
- +/**
- + *
- + * @author Anarchy
- + */
- +public class VipRemoval implements Runnable
- +{
- + private String _p = null;
- +
- + public VipRemoval(String p)
- + {
- + _p = p;
- + }
- +
- + @Override
- + public void run()
- + {
- + L2PcInstance player = L2World.getInstance().getPlayer(_p);
- +
- + if (player != null)
- + {
- + player.setVip(false);
- + player.setVipSetTime(0);
- + player.setVipHours(0);
- + }
- + }
- +}
- Index: java/net/l2jalpha/gameserver/model/actor/instance/L2TeleporterInstance.java
- ===================================================================
- --- java/net/l2jalpha/gameserver/model/actor/instance/L2TeleporterInstance.java (revision 31)
- +++ java/net/l2jalpha/gameserver/model/actor/instance/L2TeleporterInstance.java (working copy)
- @@ -37,7 +37,7 @@
- * @version $Revision: 1.3.2.2.2.5 $ $Date: 2005/03/27 15:29:32 $
- *
- */
- -public final class L2TeleporterInstance extends L2NpcInstance
- +public class L2TeleporterInstance extends L2NpcInstance
- {
- private static final int COND_ALL_FALSE = 0;
- Index: java/net/l2jalpha/gameserver/model/actor/instance/L2PcInstance.java
- ===================================================================
- --- java/net/l2jalpha/gameserver/model/actor/instance/L2PcInstance.java (revision 31)
- +++ java/net/l2jalpha/gameserver/model/actor/instance/L2PcInstance.java (working copy)
- @@ -196,6 +196,40 @@
- */
- public final class L2PcInstance extends L2Playable
- {
- + private boolean _vip = false;
- + private long _vip_settime = 0;
- + private int _vip_hours = 0;
- +
- + public int getVipHours()
- + {
- + return _vip_hours;
- + }
- +
- + public void setVipHours(int val)
- + {
- + _vip_hours = val;
- + }
- +
- + public long getVipSetTime()
- + {
- + return _vip_settime;
- + }
- +
- + public void setVipSetTime(long val)
- + {
- + _vip_settime = val;
- + }
- +
- + public boolean isVip()
- + {
- + return _vip;
- + }
- +
- + public void setVip(boolean val)
- + {
- + _vip = val;
- + }
- +
- private static final String RESTORE_SKILLS_FOR_CHAR = "SELECT skill_id,skill_level FROM character_skills WHERE char_obj_id=? AND class_index=?";
- private static final String ADD_NEW_SKILL = "INSERT INTO character_skills (char_obj_id,skill_id,skill_level,skill_name,class_index) VALUES (?,?,?,?,?)";
- private static final String UPDATE_CHARACTER_SKILL_LEVEL = "UPDATE character_skills SET skill_level=? WHERE skill_id=? AND char_obj_id=? AND class_index=?";
- @@ -207,8 +241,8 @@
- 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,movement_multiplier,attack_speed_multiplier,colRad,colHeight,exp,sp,karma,pvpkills,pkkills,clanid,maxload,race,classid,deletetime,cancraft,title,accesslevel,online,clan_privs,wantspeace,base_class,newbie,nobless,power_grade,last_recom_date) values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
- - private static final String UPDATE_CHARACTER = "UPDATE characters SET level=?,maxHp=?,curHp=?,maxCp=?,curCp=?,maxMp=?,curMp=?,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=?,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=? WHERE obj_id=?";
- - private static final String RESTORE_CHARACTER = "SELECT account_name, obj_Id, char_name, level, maxHp, curHp, maxCp, curCp, maxMp, curMp, 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, 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,death_penalty_level FROM characters WHERE obj_id=?";
- + private static final String UPDATE_CHARACTER = "UPDATE characters SET level=?,maxHp=?,curHp=?,maxCp=?,curCp=?,maxMp=?,curMp=?,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=?,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=?,vip=?,vip_settime=?,vip_hours=? WHERE obj_id=?";
- + private static final String RESTORE_CHARACTER = "SELECT account_name, obj_Id, char_name, level, maxHp, curHp, maxCp, curCp, maxMp, curMp, 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, 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,death_penalty_level,vip,vip_settime,vip_hours 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 ADD_CHAR_SUBCLASS = "INSERT INTO character_subclasses (char_obj_id,class_id,exp,sp,level,class_index) VALUES (?,?,?,?,?,?)";
- @@ -5369,6 +5403,10 @@
- player.setOnlineTime(rset.getLong("onlinetime"));
- player.setNewbie(rset.getInt("newbie")==1);
- player.setNoble(rset.getInt("nobless")==1);
- +
- + player.setVip(rset.getInt("vip")==1);
- + player.setVipSetTime(rset.getLong("vip_settime"));
- + player.setVipHours(rset.getInt("vip_hours"));
- player.setClanJoinExpiryTime(rset.getLong("clan_join_expiry_time"));
- if (player.getClanJoinExpiryTime() < System.currentTimeMillis())
- @@ -5818,7 +5856,10 @@
- statement.setLong(47, getClanCreateExpiryTime());
- statement.setString(48, getName());
- statement.setLong(49, getDeathPenaltyBuffLevel());
- - statement.setInt(50, getObjectId());
- + statement.setInt(50, isVip() ? 1 : 0);
- + statement.setLong(51, getVipSetTime());
- + statement.setInt(52, getVipHours());
- + statement.setInt(53, getObjectId());
- statement.execute();
- statement.close();
- Index: java/net/l2jalpha/gameserver/model/actor/instance/L2VipTeleporterInstance.java
- ===================================================================
- --- java/net/l2jalpha/gameserver/model/actor/instance/L2VipTeleporterInstance.java (revision 0)
- +++ java/net/l2jalpha/gameserver/model/actor/instance/L2VipTeleporterInstance.java (working copy)
- @@ -0,0 +1,64 @@
- +/* 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.l2jalpha.gameserver.model.actor.instance;
- +
- +import java.util.StringTokenizer;
- +
- +import net.l2jalpha.gameserver.datatables.json.TeleportLocationTable;
- +import net.l2jalpha.gameserver.model.L2TeleportLocation;
- +import net.l2jalpha.gameserver.templates.L2NpcTemplate;
- +
- +/**
- + *
- + * @author Anarchy
- + */
- +public class L2VipTeleporterInstance extends L2TeleporterInstance
- +{
- + public L2VipTeleporterInstance(int objectId, L2NpcTemplate template)
- + {
- + super(objectId, template);
- + }
- +
- + @Override
- + public void onBypassFeedback(L2PcInstance player, String command)
- + {
- + if (command.startsWith("vipgoto"))
- + {
- + String cmd = command.substring(8);
- + StringTokenizer st = new StringTokenizer(cmd);
- +
- + if (st.countTokens() != 1)
- + {
- + return;
- + }
- +
- + int id = Integer.parseInt(st.nextToken());
- +
- + L2TeleportLocation loc = TeleportLocationTable.getInstance().getTemplate(id);
- +
- + if (loc == null)
- + {
- + return;
- + }
- +
- + player.teleToLocation(loc.getLocX(), loc.getLocY(), loc.getLocZ(), true);
- + }
- +
- + super.onBypassFeedback(player, command);
- + }
- +}
- #P l2jalpha_datapack_mxc
- Index: sql/characters.sql
- ===================================================================
- --- sql/characters.sql (revision 31)
- +++ sql/characters.sql (working copy)
- @@ -61,6 +61,9 @@
- clan_join_expiry_time DECIMAL(20,0) NOT NULL DEFAULT 0,
- clan_create_expiry_time DECIMAL(20,0) NOT NULL DEFAULT 0,
- death_penalty_level int(2) NOT NULL DEFAULT 0,
- + vip decimal(1,0) NOT NULL DEFAULT 0,
- + vip_settime BIGINT DEFAULT 0,
- + vip_hours INT DEFAULT 0,
- PRIMARY KEY (obj_Id),
- KEY `clanid` (`clanid`)
- ) ;
- Index: data/scripts/handlers/admincommandhandlers/AdminVip.java
- ===================================================================
- --- data/scripts/handlers/admincommandhandlers/AdminVip.java (revision 0)
- +++ data/scripts/handlers/admincommandhandlers/AdminVip.java (working copy)
- @@ -0,0 +1,86 @@
- +/*
- + * 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 handlers.admincommandhandlers;
- +
- +import java.util.StringTokenizer;
- +
- +import net.l2jalpha.gameserver.ThreadPoolManager;
- +import net.l2jalpha.gameserver.handler.IAdminCommandHandler;
- +import net.l2jalpha.gameserver.model.L2Object;
- +import net.l2jalpha.gameserver.model.actor.instance.L2PcInstance;
- +import net.l2jalpha.gameserver.model.entity.VipRemoval;
- +
- +public class AdminVip implements IAdminCommandHandler
- +{
- + private static final String[] ADMIN_COMMANDS = { "admin_setvip" };
- +
- + @Override
- + public boolean useAdminCommand(String command, L2PcInstance activeChar)
- + {
- + if (command.startsWith("admin_setvip"))
- + {
- + String cmd = command.substring(13);
- + StringTokenizer st = new StringTokenizer(cmd);
- +
- + if (st.countTokens() != 1)
- + {
- + activeChar.sendMessage("Usage: //setvip hours");
- + return false;
- + }
- +
- + int hours = Integer.parseInt(st.nextToken());
- +
- + if (hours <= 0)
- + {
- + activeChar.sendMessage("Wrong value for hours; you can't enter number below or equal to 0.");
- + return false;
- + }
- +
- + L2Object target = activeChar.getTarget();
- +
- + if (target == null)
- + {
- + activeChar.sendMessage("Wrong target.");
- + return false;
- + }
- +
- + if (!(target instanceof L2PcInstance))
- + {
- + activeChar.sendMessage("Wrong target.");
- + return false;
- + }
- +
- + L2PcInstance trg = (L2PcInstance)target;
- +
- + trg.setVip(true);
- + trg.setVipSetTime(System.currentTimeMillis());
- + trg.setVipHours(hours);
- +
- + ThreadPoolManager.getInstance().scheduleGeneral(new VipRemoval(trg.getName()), hours*1000*60*60);
- + }
- +
- + return true;
- + }
- +
- + @Override
- + public String[] getAdminCommandList()
- + {
- + return ADMIN_COMMANDS;
- + }
- +}
- Index: data/scripts/handlers/MasterHandler.java
- ===================================================================
- --- data/scripts/handlers/MasterHandler.java (revision 31)
- +++ data/scripts/handlers/MasterHandler.java (working copy)
- @@ -63,6 +63,7 @@
- import handlers.admincommandhandlers.AdminTarget;
- import handlers.admincommandhandlers.AdminTeleport;
- import handlers.admincommandhandlers.AdminUnblockIp;
- +import handlers.admincommandhandlers.AdminVip;
- import handlers.admincommandhandlers.AdminZone;
- import handlers.chathandlers.ChatAll;
- import handlers.chathandlers.ChatAlliance;
- @@ -254,6 +255,7 @@
- {
- AdminCommandHandler.getInstance().registerAdminCommandHandler(new AdminReloadQuizQuestions());
- }
- + AdminCommandHandler.getInstance().registerAdminCommandHandler(new AdminVip());
- _log.config("Loaded " + AdminCommandHandler.getInstance().size() + " admin command handlers.");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement