Pastebin
API
tools
faq
paste
Login
Sign up
Please fix the following errors:
New Paste
Syntax Highlighting
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."); }
Optional Paste Settings
Category:
None
Cryptocurrency
Cybersecurity
Fixit
Food
Gaming
Haiku
Help
History
Housing
Jokes
Legal
Money
Movies
Music
Pets
Photo
Science
Software
Source Code
Spirit
Sports
Travel
TV
Writing
Tags:
Syntax Highlighting:
None
Bash
C
C#
C++
CSS
HTML
JSON
Java
JavaScript
Lua
Markdown (PRO members only)
Objective C
PHP
Perl
Python
Ruby
Swift
4CS
6502 ACME Cross Assembler
6502 Kick Assembler
6502 TASM/64TASS
ABAP
AIMMS
ALGOL 68
APT Sources
ARM
ASM (NASM)
ASP
ActionScript
ActionScript 3
Ada
Apache Log
AppleScript
Arduino
Asymptote
AutoIt
Autohotkey
Avisynth
Awk
BASCOM AVR
BNF
BOO
Bash
Basic4GL
Batch
BibTeX
Blitz Basic
Blitz3D
BlitzMax
BrainFuck
C
C (WinAPI)
C Intermediate Language
C for Macs
C#
C++
C++ (WinAPI)
C++ (with Qt extensions)
C: Loadrunner
CAD DCL
CAD Lisp
CFDG
CMake
COBOL
CSS
Ceylon
ChaiScript
Chapel
Clojure
Clone C
Clone C++
CoffeeScript
ColdFusion
Cuesheet
D
DCL
DCPU-16
DCS
DIV
DOT
Dart
Delphi
Delphi Prism (Oxygene)
Diff
E
ECMAScript
EPC
Easytrieve
Eiffel
Email
Erlang
Euphoria
F#
FO Language
Falcon
Filemaker
Formula One
Fortran
FreeBasic
FreeSWITCH
GAMBAS
GDB
GDScript
Game Maker
Genero
Genie
GetText
Go
Godot GLSL
Groovy
GwBasic
HQ9 Plus
HTML
HTML 5
Haskell
Haxe
HicEst
IDL
INI file
INTERCAL
IO
ISPF Panel Definition
Icon
Inno Script
J
JCL
JSON
Java
Java 5
JavaScript
Julia
KSP (Kontakt Script)
KiXtart
Kotlin
LDIF
LLVM
LOL Code
LScript
Latex
Liberty BASIC
Linden Scripting
Lisp
Loco Basic
Logtalk
Lotus Formulas
Lotus Script
Lua
M68000 Assembler
MIX Assembler
MK-61/52
MPASM
MXML
MagikSF
Make
MapBasic
Markdown (PRO members only)
MatLab
Mercury
MetaPost
Modula 2
Modula 3
Motorola 68000 HiSoft Dev
MySQL
Nagios
NetRexx
Nginx
Nim
NullSoft Installer
OCaml
OCaml Brief
Oberon 2
Objeck Programming Langua
Objective C
Octave
Open Object Rexx
OpenBSD PACKET FILTER
OpenGL Shading
Openoffice BASIC
Oracle 11
Oracle 8
Oz
PARI/GP
PCRE
PHP
PHP Brief
PL/I
PL/SQL
POV-Ray
ParaSail
Pascal
Pawn
Per
Perl
Perl 6
Phix
Pic 16
Pike
Pixel Bender
PostScript
PostgreSQL
PowerBuilder
PowerShell
ProFTPd
Progress
Prolog
Properties
ProvideX
Puppet
PureBasic
PyCon
Python
Python for S60
QBasic
QML
R
RBScript
REBOL
REG
RPM Spec
Racket
Rails
Rexx
Robots
Roff Manpage
Ruby
Ruby Gnuplot
Rust
SAS
SCL
SPARK
SPARQL
SQF
SQL
SSH Config
Scala
Scheme
Scilab
SdlBasic
Smalltalk
Smarty
StandardML
StoneScript
SuperCollider
Swift
SystemVerilog
T-SQL
TCL
TeXgraph
Tera Term
TypeScript
TypoScript
UPC
Unicon
UnrealScript
Urbi
VB.NET
VBScript
VHDL
VIM
Vala
Vedit
VeriLog
Visual Pro Log
VisualBasic
VisualFoxPro
WHOIS
WhiteSpace
Winbatch
XBasic
XML
XPP
Xojo
Xorg Config
YAML
YARA
Z80 Assembler
ZXBasic
autoconf
jQuery
mIRC
newLISP
q/kdb+
thinBasic
Paste Expiration:
Never
Burn after read
10 Minutes
1 Hour
1 Day
1 Week
2 Weeks
1 Month
6 Months
1 Year
Paste Exposure:
Public
Unlisted
Private
Folder:
(members only)
Password
NEW
Enabled
Disabled
Burn after read
NEW
Paste Name / Title:
Create New Paste
Hello
Guest
Sign Up
or
Login
Sign in with Facebook
Sign in with Twitter
Sign in with Google
You are currently not logged in, this means you can not edit or delete anything you paste.
Sign Up
or
Login
Public Pastes
FREE ETHEREUM METHOD
CSS | 1 hour ago | 0.39 KB
Free Crypto Method
C++ | 1 hour ago | 0.39 KB
Free Crypto Method
Puppet | 1 hour ago | 0.39 KB
Free Crypto Method
Lua | 1 hour ago | 0.39 KB
Guide
CSS | 1 hour ago | 0.38 KB
Amazon Product: 160GB MP3 Player with Bluetoo...
JSON | 2 hours ago | 9.16 KB
Untitled
JSON | 2 hours ago | 45.65 KB
Looks_Patchy.py
Python | 3 hours ago | 7.10 KB
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the
Cookies Policy
.
OK, I Understand
Not a member of Pastebin yet?
Sign Up
, it unlocks many cool features!