Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 1. Register the admin handler.
- 2. L2PcInstance
- @@
- 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=?,banchat_time=?,newbie=?,nobless=?,hero=?,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=?";
- add after death_penalty_level=? ,vip_time=?
- 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, banchat_time, newbie, nobless, hero, 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=?";
- add after death_penalty_level ,vip_time
- @@
- private boolean createDb()
- {
- java.sql.Connection con = null;
- try
- {
- con = L2DatabaseFactory.getInstance().getConnection();
- 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) " +
- + "base_class,newbie,nobless,power_grade,last_recom_date,vip_time) " +
- - "values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
- + "values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
- statement.setLong(57, System.currentTimeMillis());
- + statement.setLong(58, getVipTimer());
- @@
- + player.setVipTimer(rset.getLong("vip_time"));
- CursedWeaponsManager.getInstance().checkPlayer(player);
- player.setAllianceWithVarkaKetra(rset.getInt("varka_ketra_ally"));
- player.setDeathPenaltyBuffLevel(rset.getInt("death_penalty_level"));
- player.setXYZInvisible(rset.getInt("x"), rset.getInt("y"), rset.getInt("z"));
- and add to the end of class
- private long _vipTimer = 0L;
- private ScheduledFuture _vipTask = null;
- private boolean _vip = false;
- private ScheduledFuture _removeVipTask = null;
- public void setVip(boolean state, int delayInMinutes)
- {
- _vip = state;
- _vipTimer = 0L;
- stopVipTask(false);
- if(_vip && delayInMinutes > 0)
- {
- _vipTimer = (long)delayInMinutes * 60000L;
- _vipTask = ThreadPoolManager.getInstance().scheduleGeneral(new VipTask(this), _vipTimer);
- sendMessage("Your character is VIP for "+(delayInMinutes)+" minutes.");
- sendPacket(new EtcStatusUpdate(this));
- }
- storeCharBase();
- }
- public long getVipTimer()
- {
- if(_vip)
- {
- long delay = _vipTask.getDelay(TimeUnit.MILLISECONDS);
- if(delay >= 0L)
- _vipTimer = delay;
- }
- return _vipTimer;
- }
- public boolean isVip()
- {
- return _vip;
- }
- public void setVip(boolean state)
- {
- _vip = state;
- }
- public void setRemoveVipTask(ScheduledFuture task)
- {
- _removeVipTask = task;
- }
- public ScheduledFuture getRemoveVipTask()
- {
- return _removeVipTask;
- }
- public void setVipTimer(long time)
- {
- _vipTimer = time;
- }
- public void updateVipState()
- {
- if(_vipTimer > 0L)
- {
- _vip = true;
- _vipTask = ThreadPoolManager.getInstance().scheduleGeneral(new VipTask(this), _vipTimer);
- sendMessage("You are still vip for "+Math.round(_vipTimer / 60000L)+" minutes.");
- sendPacket(new EtcStatusUpdate(this));
- }
- }
- public void stopVipTask(boolean save)
- {
- if(_vipTask != null)
- {
- if(save)
- {
- long delay = _vipTask.getDelay(TimeUnit.MILLISECONDS);
- if(delay < 0L)
- delay = 0L;
- setVipTimer(delay);
- }
- _vipTask.cancel(false);
- _vip = false;
- _removeVipTask = null;
- sendPacket(new EtcStatusUpdate(this));
- }
- }
- private class VipTask implements Runnable
- {
- L2PcInstance _player;
- protected long _startedAt;
- protected VipTask(L2PcInstance player)
- {
- _player = player;
- _startedAt = System.currentTimeMillis();
- }
- public void run()
- {
- _player.setVip(false, 0);
- }
- }
- 3. EnterWorld
- if (Config.GM_STARTUP_AUTO_LIST && AdminCommandAccessRights.getInstance().hasAccess("admin_gmliston", activeChar.getAccessLevel()))
- GmListTable.getInstance().addGm(activeChar, false);
- else GmListTable.getInstance().addGm(activeChar, true);
- }
- + activeChar.updateVipState();
- 4. SQL, Character
- after `death_penalty_level`
- `banchat_time` int(10) NOT NULL,
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement