-
Posts
332 -
Credits
0 -
Joined
-
Last visited
-
Feedback
0%
Content Type
Articles
Profiles
Forums
Store
Everything posted by extr3me
-
[help]L2jarchid TvT
extr3me replied to activeChar's question in Request Server Development Help [L2J]
Archid Dead use Teon or Brasil -
this is java is not a script
-
[Hidden Content]
-
mrex i will fix thx ;) and mosti21 thx
-
5 pvp for killing spree ;) and have tatoo and mask no more
-
Lineage 2 Mass PvP Game specs: Rates 3000x XP/SP, 3000x Adena , 1x Drop Stable. No lag. (Depending on your location, this has nothing to do with our server) Skills works 99,8% Duel system working All Boss working Augmentation working Oly Work 100 % Enchant: Safe: 5 Max weapon: 25 Max armor: 25 Max jewelry: 25 Normal scroll: 75% Crystal scroll: 75% Blessed scroll: 100% Items : Tatoo Mask Rb Jews Clan Item Offline Shop: Offline shop means players can disconnect and their private stores will stay online until they login again. Killing Spree system: If you consecutively kill players, a message will appear in main chat. VoiceCommand : .buyrec .aio .info .stat Webiste : http://www.l2masspvp.com/
-
is not fix is rev 1425 :|
-
Exception in thread "SelectorThread-52" java.lang.NullPointerException at com.it.br.gameserver.network.L2GameClient.onForcedDisconnection(L2Gam eClient.java:496) at com.l2jserver.mmocore.network.SelectorThread.readPacket(SelectorThrea d.java:310) at com.l2jserver.mmocore.network.SelectorThread.run(SelectorThread.java: 169) how i can fix it
-
where ?
-
import sys from lt.equal import Config from java.lang import System from cStringIO import StringIO from lt.equal.gameserver.model.quest import State from lt.equal.gameserver.model.quest import QuestState from lt.equal.gameserver.model.quest.jython import QuestJython as JQuest from lt.equal.gameserver.datatables import ItemTable from lt.equal.gameserver.datatables import CharTemplateTable from lt.equal.gameserver.model.base import Race from lt.equal.gameserver.model.base import ClassId from lt.equal.gameserver.network import SystemMessageId from lt.equal.gameserver import Olympiad from lt.equal.gameserver.serverpackets import SystemMessage from lt.equal.gameserver.serverpackets import SetupGauge ##################### CONFIG ##################### ALLOW_REQ_ITEMS = False ITEM_REQ = 3483 ITEM_AMOUNT = 500 ALLOW_KARMA_PLAYER = True TIME_OUT = True BLOCK_TIME = 10 try: MAX_SUBCLASS = Config.MAX_SUBCLASS except: try: MAX_SUBCLASS = Config.ALT_MAX_SUBCLASSES except: MAX_SUBCLASS = 3 ################################################## npcId = 957 QuestId = 957 QuestName = "AIOGrandMaster" QI = "%s_%s" % (QuestId,QuestName) QuestDesc = "custom" print "=============================" print "INFO LOADED AIO GRANDMASTER" print "=============================" def IHTML(st) : HTML = StringIO() HTML.write("<html><title>AIO GRANDMASTER</title><body><center>") HTML.write("<br><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br><br>") HTML.write("<font color=\"FF0000\">.::Subclass Master Opciones::.</font><br><br>") if st.player.getTotalSubClasses() == 0: HTML.write("If you want to add any Subclass, your<br1>current occupation must be second or<br1>third, besides reach level <font color=\"LEVEL\">75 or above</font>") if ALLOW_REQ_ITEMS: HTML.write("<br1>and get <font color=\"LEVEL\">%s %s</font>.</font><br>" % (ITEM_AMOUNT, getitemname(ITEM_REQ))) else : HTML.write(".<br>") if st.player.getTotalSubClasses() < MAX_SUBCLASS : HTML.write("<button value=\"Add Subclass\" action=\"bypass -h Quest %s getracemenu addsub 0 0\" width=150 height=30 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"><br>" % QI) if st.player.getTotalSubClasses() > 0 : HTML.write("<button value=\"Change Subclass\" action=\"bypass -h Quest %s subclass changesub 0 0\" width=150 height=30 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"><br>" % QI) HTML.write("<button value=\"Remove Subclass\" action=\"bypass -h Quest %s subclass deletesub 0 0\" width=150 height=30 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"><br>" % QI) HTML.write("<br><font color=\"303030\">%s</font>" % AIO()) HTML.write("</center></body></html>") return HTML.getvalue() def IIHTML(st,case,case2) : if ALLOW_REQ_ITEMS and st.player.getTotalSubClasses() == 0: if st.getQuestItemsCount(ITEM_REQ) < ITEM_AMOUNT: return IIIHTML("Sorry","You don't have the required items!<br>You will need: <font color =\"LEVEL\">%s %s</font><br>to add any subclass" % (ITEM_AMOUNT,getitemname(ITEM_REQ))) HTML = StringIO() HTML.write("<html><title>AIO GRANDMASTER</title><body><center>") HTML.write("<img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br>") HTML.write("<font color=\"FF0000\">.::Chooce a Race::.</font><br>") HTML.write("<button value=\"Human\" action=\"bypass -h Quest %s subclass %s 0 %s\" width=120 height=30 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" % (QI,case,case2)) if st.player.getRace().ordinal() != 2: HTML.write("<button value=\"Elf\" action=\"bypass -h Quest %s subclass %s 1 %s\" width=120 height=30 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" % (QI,case,case2)) if st.player.getRace().ordinal() != 1: HTML.write("<button value=\"Dark Elf\" action=\"bypass -h Quest %s subclass %s 2 %s\" width=120 height=30 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" % (QI,case,case2)) HTML.write("<button value=\"Orc\" action=\"bypass -h Quest %s subclass %s 3 %s\" width=120 height=30 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" % (QI,case,case2)) HTML.write("<button value=\"Dwarf\" action=\"bypass -h Quest %s subclass %s 4 %s\" width=120 height=30 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" % (QI,case,case2)) HTML.write("<br><font color=\"303030\">%s</font>" % AIO()) HTML.write("</center></body></html>") return HTML.getvalue() def IIIHTML(type,text) : HTML = StringIO() HTML.write("<html><head><title>AIO GRANDMASTER</title></head><body><center><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br>") HTML.write("<font color=\"LEVEL\">%s</font><br>%s<br>" % (type,text)) HTML.write("<font color=\"303030\">%s</font></center></body></html>" % AIO ()) return HTML.getvalue() def getitemname(case): try: val =ItemTable.getInstance().createDummyItem(case).getItemName() except: val = "0" return val def getnames(case): try: val = CharTemplateTable.getInstance().getClassNameById(case) except: val = "0" return val def AIO(): xe="l";xf="e";xg="n";xa="B";xb="y";xc=" ";xd="A"; val= "%(xa)s%(xb)s%(xc)s%(xd)s%(xe)s%(xe)s%(xf)s%(xg)s" % locals() return val def addTimeout(st,gaugeColor,amount,offset) : endtime = int(System.currentTimeMillis()/1000) + amount st.set("blockUntilTime",`endtime`) st.getPlayer().sendPacket(SetupGauge(gaugeColor, amount * 1000 + offset)) return True def subclasslist(st,cases,case2,index) : HTML = StringIO() if st.player.getLevel() < 75 and int(index) == 0 or st.getPlayer().getClassId().level() < 2: HTML.write("<br><br><br><br><br><br><br><br><br><br><br><br><br><br><font color=\"FF0000\">You cannot add a new subclass!<br1>First your current occupation must be<br1>second or third job and all of your sub<br1>classes must be at level 75 or above.</font><br>") return HTML.getvalue() currentBaseId = st.player.getBaseClass() baseCID = ClassId.values()[currentBaseId] if baseCID.level() > 2: baseClassId = baseCID.getParent().ordinal() else: baseClassId = currentBaseId num = 0 if baseClassId in [5,6,20,33]: subclasses = [5,6,20,33,57,51] elif baseClassId in [8,23,36]: subclasses = [8,23,36,57,51] elif baseClassId in [9,24,37]: subclasses = [9,24,37,57,51] elif baseClassId in [12,27,40]: subclasses = [12,27,40,57,51] else: subclasses = [baseClassId,57,51] for i in range(MAX_SUBCLASS): if st.player.getSubClasses().containsKey(i+1): if st.player.getSubClasses().get(i+1).getLevel() < 75 and int(index) == 0: HTML.write("<br><br><br><br><br><br><br><br><br><br><br><br><br><br><font color=\"FF0000\">You cannot add a new subclass!<br1>First your current occupation must be<br1>second or third job and all of your sub<br1>classes must be at level 75 or above.</font><br>") return HTML.getvalue() temp = ClassId.values()[st.player.getSubClasses().get(i+1).getClassId()] if temp.level() > 2: subclasses.append(temp.getParent().ordinal()) else: subclasses.append(temp.getId()) HTML.write("<img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br>") if int(index) == 0: HTML.write("<font color=\"FF0000\">Add Subclass:<br>Which subclass do you wish to add?</font><br><br1>") if int(index) > 0: HTML.write("<font color=\"FF0000\">Please<br1>Select a new subclass to change.</font><br><font color=\"LEVEL\">Warning!</font> Your previous subclass and<br1>all the skills will be removed.") for child in ClassId.values(): if child.getRace() == Race.values()[int(case2)] and child.level() == 2 and child.getId() not in subclasses: num = 1 HTML.write("<button value=\"%s\" action=\"bypass -h Quest %s subclass %s %s %s\" width=150 height=30 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" % (getnames(child.getId()),QI,cases,child.getId(),index)) if num == 0: HTML = StringIO() HTML.write("<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><font color=\"FF0000\">There are no available subclasses at this moment.</font><br>") return HTML.getvalue() def subclassopcions(st,cases,id,index) : if st.player.isCastingNow() or st.player.isAllSkillsDisabled(): st.player.sendPacket(SystemMessage(SystemMessageId.SUBCLASS_NO_CHANGE_OR_CREATE_WHILE_SKILL_IN_USE)) return if Olympiad.getInstance().isRegistered(st.player): st.player.sendMessage("You have already been registered in a Olympiad game.") return HTML = StringIO() if cases == "addsub": if st.player.isSubClassActive(): return IIIHTML("Sorry","You are not allow to add a subclass!<br>Come back when you're using your main class") if st.player.getTotalSubClasses() >= MAX_SUBCLASS : if TIME_OUT: if addTimeout(st,3,BLOCK_TIME,300) : pass st.player.sendMessage("You can now only change one of your current sub classes.") return else: HTML.write("<html><title>AIO GRANDMASTER</title><body><center>") HTML.write(subclasslist(st,"acceptsub",id,"0")) HTML.write("</center></body></html>") return HTML.getvalue() if cases == "acceptsub": if ALLOW_REQ_ITEMS and st.player.getTotalSubClasses() == 0: if st.getQuestItemsCount(ITEM_REQ) < ITEM_AMOUNT: return IIIHTML("Sorry","You don't have the required items!<br>You will need: <font color =\"LEVEL\">%s %s</font><br>to add any subclass" % (ITEM_AMOUNT,getitemname(ITEM_REQ))) else: st.takeItems(ITEM_REQ,ITEM_AMOUNT) if not st.player.addSubClass(int(id),st.player.getTotalSubClasses() + 1): st.player.sendMessage("The sub class could not be added.") return st.player.setActiveClass(st.player.getTotalSubClasses()) HTML.write("<html><title>AIO GRANDMASTER</title><body><center>") HTML.write("<br><br>Add Subclass:<br>The sub class of <font color=\"LEVEL\">%s</font><br> has been added.<br>" % getnames(int(id))) HTML.write("</center></body></html>") st.player.sendPacket(SystemMessage(SystemMessageId.CLASS_TRANSFER)) return HTML.getvalue() if cases == "acceptchangesub": if not st.player.setActiveClass(int(index)): if TIME_OUT: if addTimeout(st,3,BLOCK_TIME,300) : pass st.player.sendMessage("The sub class could not be changed.") return else: HTML.write("<html><title>AIO GRANDMASTER</title><body><center>") HTML.write("<br><br>Change Subclass:<br>Your active class is now a:<br><font color=\"LEVEL\">%s</font>" % getnames(int(id))) HTML.write("</center></body></html>") st.player.sendPacket(SystemMessage(SystemMessageId.ADD_NEW_SUBCLASS)) if TIME_OUT: if addTimeout(st,3,BLOCK_TIME,300) : pass return HTML.getvalue() if cases == "changesub": if st.player.getTotalSubClasses() > MAX_SUBCLASS : st.player.sendMessage("You can now only delete one of your current sub classes.") if TIME_OUT: if addTimeout(st,3,BLOCK_TIME,300) : pass return else: j=0 HTML.write("<html><title>AIO GRANDMASTER</title><body><center>") HTML.write("<img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br>") HTML.write("<font color=\"FF0000\">Change Subclass:<br1>Which sub class do you wish to change?</font><br>") if st.player.isSubClassActive(): j=1 HTML.write("<font color=\"LEVEL\">Main-class</font>") HTML.write("<button value=\"%s\" action=\"bypass -h Quest %s subclass acceptchangesub %s 0\" width=150 height=30 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"><br>" % (getnames(st.player.getBaseClass()),QI,st.player.getBaseClass())) for i in range(MAX_SUBCLASS): if st.player.getSubClasses().containsKey(i+1): xsubclassid = st.player.getSubClasses().get(i+1).getClassId() if int(st.player.getClassId().getId()) != xsubclassid: j=i+1 HTML.write("<font color=\"LEVEL\">Sub-class %s</font>" % (i+1)) HTML.write("<button value=\"%s\" action=\"bypass -h Quest %s subclass acceptchangesub %s %s\" width=150 height=30 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" % (getnames(xsubclassid),QI,xsubclassid,i+1)) if j == 0: HTML.write("<html><title>AIO GRANDMASTER</title><body><center>") HTML.write("<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><font color=\"FF0000\">There are no sub classes available<br>to change at this time.</font><br>") if TIME_OUT: if addTimeout(st,3,BLOCK_TIME,300) : pass HTML.write("</center></body></html>") return HTML.getvalue() if cases == "deletesub": if st.player.isSubClassActive(): return IIIHTML("Sorry","You are not allow to delete a subclass!<br>Come back when you're using your main class") if st.player.getTotalSubClasses() > MAX_SUBCLASS : if TIME_OUT: if addTimeout(st,3,BLOCK_TIME,300) : pass st.player.sendMessage("You can now only delete one of your current sub classes.") return else: j=0 HTML.write("<html><title>AIO GRANDMASTER</title><body><center>") HTML.write("<img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br>") HTML.write("<font color=\"FF0000\">Which sub class do you wish to delete?</font><br>") for i in range(MAX_SUBCLASS): if st.player.getSubClasses().containsKey(i+1): j=i+1 HTML.write("<font color=\"LEVEL\">Sub-class %s</font>" % (i+1)) HTML.write("<button value=\"%s\" action=\"bypass -h Quest %s getracemenu acceptnewsub %s 0\" width=150 height=30 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" % (getnames(st.player.getSubClasses().get(i+1).getClassId()),QI,i+1)) HTML.write("<br>If you change a sub class, you'll start at level 40<br1>after the 2nd class transfer.") if j == 0: HTML.write("<html><title>AIO GRANDMASTER</title><body><center>") HTML.write("<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><font color=\"FF0000\">There are no sub classes available<br>to delete at this time.</font><br>") if TIME_OUT: if addTimeout(st,3,BLOCK_TIME,300) : pass HTML.write("</center></body></html>") return HTML.getvalue() if cases == "acceptnewsub": HTML.write("<html><title>AIO GRANDMASTER</title><body><center>") HTML.write(subclasslist(st,"acceptdelsub",id,index)) HTML.write("</center></body></html>") return HTML.getvalue() if cases == "acceptdelsub": if st.player.modifySubClass(int(index), int(id)): st.player.stopAllEffects() st.player.setActiveClass(int(index)) HTML.write("<html><title>AIO GRANDMASTER</title><body><center>") HTML.write("<br><br>Change Subclass:<br>Your sub class has been changed to<br1><font color=\"LEVEL\">%s</font>" % getnames(int(id))) HTML.write("</center></body></html>") st.player.sendPacket(SystemMessage(SystemMessageId.ADD_NEW_SUBCLASS)) if TIME_OUT: if addTimeout(st,3,BLOCK_TIME,300) : pass return HTML.getvalue() else: player.setActiveClass(0) if TIME_OUT: if addTimeout(st,3,BLOCK_TIME,300) : pass st.player.sendMessage("The sub class could not be added, you have been reverted to your base class.") return class Quest (JQuest) : def __init__(self,id,name,descr): JQuest.__init__(self,id,name,descr) def onAdvEvent (self,event,npc,player) : try: st = player.getQuestState(QI) except: return eventSplit = event.split(" ") event = eventSplit[0] event1 = eventSplit[1] event2 = eventSplit[2] event3 = eventSplit[3] if event == "getracemenu": return IIHTML(st,event1,event2) if event == "subclass" : if int(System.currentTimeMillis()/1000) > st.getInt("blockUntilTime"): return subclassopcions(st, event1, event2, event3) return IHTML(st) else: return def onFirstTalk (self,npc,player): st = player.getQuestState(QI) if not st : st = self.newQuestState(player) if int(System.currentTimeMillis()/1000) > st.getInt("blockUntilTime"): if ALLOW_KARMA_PLAYER == False and player.getKarma() > 0 : return IIIHTML("Info","You have too much karma!<br>Come back,<br>when you don't have any karma!") elif st.player.getPvpFlag() > 0 : return IIIHTML("Info","You can't use my services while you are flagged!<br>Wait some time and try again!") elif st.player.isInCombat() : return IIIHTML("Info","You can't use my services while you are attacking!<br>Stop your fight and try again!") else: return IHTML(st) else: return QUEST = Quest(QuestId,QI,QuestDesc) CREATED = State('Start', QUEST) QUEST.setInitialState(CREATED) QUEST.addStartNpc(npcId) QUEST.addFirstTalkId(npcId) QUEST.addTalkId(npcId) faild import : 978_Shop_Enchants in gs
-
and * 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 3 of the License, 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, see <http://www.gnu.org/licenses/>. */ package lt.equal.gameserver.network; import java.net.InetAddress; import java.nio.ByteBuffer; import java.sql.PreparedStatement; import java.util.List; import java.util.concurrent.RejectedExecutionException; import java.util.concurrent.ScheduledFuture; import java.util.concurrent.locks.ReentrantLock; import java.util.logging.Level; import java.util.logging.Logger; import javolution.util.FastList; import lt.equal.Config; import lt.equal.L2DatabaseFactory; import lt.equal.gameserver.LoginServerThread; import lt.equal.gameserver.Olympiad; import lt.equal.gameserver.ThreadPoolManager; import lt.equal.gameserver.LoginServerThread.SessionKey; import lt.equal.gameserver.communitybbs.Manager.RegionBBSManager; import lt.equal.gameserver.datatables.SkillTable; import lt.equal.gameserver.model.CharSelectInfoPackage; import lt.equal.gameserver.model.L2World; import lt.equal.gameserver.model.actor.instance.L2PcInstance; import lt.equal.gameserver.model.entity.L2Event; import lt.equal.gameserver.model.entity.TvTEvent; import lt.equal.gameserver.network.serverpackets.L2GameServerPacket; import lt.equal.gameserver.network.serverpackets.SystemMessage; import lt.equal.gameserver.network.serverpackets.UserInfo; import lt.equal.gameserver.templates.StatsSet; import lt.equal.util.EventData; import org.mmocore.network.MMOClient; import org.mmocore.network.MMOConnection; /** * Represents a client connected on Game Server * * @author KenM */ public final class L2GameClient extends MMOClient<MMOConnection<L2GameClient>> { protected static final Logger _log = Logger.getLogger(L2GameClient.class.getName()); /** * CONNECTED - client has just connected AUTHED - client has authed but doesnt has character attached to it yet IN_GAME - client has selected a char and is in game * * @author KenM */ public static enum GameClientState { CONNECTED, AUTHED, IN_GAME }; public GameClientState state; // Info public String accountName; public SessionKey sessionId; public L2PcInstance activeChar; private ReentrantLock _activeCharLock = new ReentrantLock(); @SuppressWarnings("unused") private boolean _isAuthedGG; private long _connectionStartTime; private List<Integer> _charSlotMapping = new FastList<Integer>(); // Task protected final ScheduledFuture<?> _autoSaveInDB; protected ScheduledFuture<?> _cleanupTask = null; // Crypt public GameCrypt crypt; // Flood protection public byte packetsSentInSec = 0; public int packetsSentStartTick = 0; private boolean _isDetached = false; // UnknownPacket protection private int unknownPacketCount = 0; public L2GameClient(MMOConnection<L2GameClient> con) { super(con); state = GameClientState.CONNECTED; _connectionStartTime = System.currentTimeMillis(); crypt = new GameCrypt(); _autoSaveInDB = ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(new AutoSaveTask(), 300000L, 900000L); } public byte[] enableCrypt() { byte[] key = BlowFishKeygen.getRandomKey(); crypt.setKey(key); return key; } public GameClientState getState() { return state; } public void setState(GameClientState pState) { state = pState; } public long getConnectionStartTime() { return _connectionStartTime; } @Override public boolean decrypt(ByteBuffer buf, int size) { crypt.decrypt(buf.array(), buf.position(), size); return true; } @Override public boolean encrypt(final ByteBuffer buf, final int size) { crypt.encrypt(buf.array(), buf.position(), size); buf.position(buf.position() + size); return true; } public L2PcInstance getActiveChar() { return activeChar; } public void setActiveChar(L2PcInstance pActiveChar) { activeChar = pActiveChar; if (activeChar != null) { L2World.getInstance().storeObject(getActiveChar()); } } public ReentrantLock getActiveCharLock() { return _activeCharLock; } public void setGameGuardOk(boolean val) { _isAuthedGG = val; } public void setAccountName(String pAccountName) { accountName = pAccountName; } public String getAccountName() { return accountName; } public void setSessionId(SessionKey sk) { sessionId = sk; } public SessionKey getSessionId() { return sessionId; } public void sendPacket(L2GameServerPacket gsp) { if (_isDetached) return; getConnection().sendPacket(gsp); gsp.runImpl(); } public boolean isDetached() { return _isDetached; } public void isDetached(boolean b) { _isDetached = b; } public L2PcInstance markToDeleteChar(int charslot) throws Exception { // have to make sure active character must be nulled /* * if (getActiveChar() != null) { saveCharToDisk(getActiveChar()); if (Config.DEBUG) { _log.fine("active Char saved"); } this.setActiveChar(null); } */ int objid = getObjectIdForSlot(charslot); if (objid < 0) return null; L2PcInstance character = L2PcInstance.load(objid); if (character.getClanId() != 0) return character; java.sql.Connection con = null; try { con = L2DatabaseFactory.getInstance().getConnection(); PreparedStatement statement = con.prepareStatement("UPDATE characters SET deletetime=? WHERE obj_id=?"); statement.setLong(1, System.currentTimeMillis() + Config.DELETE_DAYS * 86400000L); // 24*60*60*1000 = 86400000 statement.setInt(2, objid); statement.execute(); statement.close(); } catch (Exception e) { _log.warning("Data error on update delete time of char: " + e); } finally { try { con.close(); } catch (Exception e) { } } return null; } public L2PcInstance deleteChar(int charslot) throws Exception { // have to make sure active character must be nulled /* * if (getActiveChar() != null) { saveCharToDisk (getActiveChar()); if (Config.DEBUG) _log.fine("active Char saved"); this.setActiveChar(null); } */ int objid = getObjectIdForSlot(charslot); if (objid < 0) return null; L2PcInstance character = L2PcInstance.load(objid); if (character.getClanId() != 0) return character; deleteCharByObjId(objid); return null; } /** * Save the L2PcInstance to the database. */ public static void saveCharToDisk(L2PcInstance cha) { try { cha.store(); } catch (Exception e) { _log.severe("Error saving player character: " + e); } } public void markRestoredChar(int charslot) throws Exception { // have to make sure active character must be nulled /* * if (getActiveChar() != null) { saveCharToDisk (getActiveChar()); if (Config.DEBUG) _log.fine("active Char saved"); this.setActiveChar(null); } */ int objid = getObjectIdForSlot(charslot); if (objid < 0) return; java.sql.Connection con = null; try { con = L2DatabaseFactory.getInstance().getConnection(); PreparedStatement statement = con.prepareStatement("UPDATE characters SET deletetime=0 WHERE obj_id=?"); statement.setInt(1, objid); statement.execute(); statement.close(); } catch (Exception e) { _log.severe("Data error on restoring char: " + e); } finally { try { con.close(); } catch (Exception e) { } } } public static void deleteCharByObjId(int objid) { if (objid < 0) return; java.sql.Connection con = null; try { con = L2DatabaseFactory.getInstance().getConnection(); PreparedStatement statement; statement = con.prepareStatement("DELETE FROM character_friends WHERE char_id=? OR friend_id=?"); statement.setInt(1, objid); statement.setInt(2, objid); statement.execute(); statement.close(); statement = con.prepareStatement("DELETE FROM character_hennas WHERE char_obj_id=?"); statement.setInt(1, objid); statement.execute(); statement.close(); statement = con.prepareStatement("DELETE FROM character_macroses WHERE char_obj_id=?"); statement.setInt(1, objid); statement.execute(); statement.close(); statement = con.prepareStatement("DELETE FROM character_quests WHERE char_id=?"); statement.setInt(1, objid); statement.execute(); statement.close(); statement = con.prepareStatement("DELETE FROM character_recipebook WHERE char_id=?"); statement.setInt(1, objid); statement.execute(); statement.close(); statement = con.prepareStatement("DELETE FROM character_shortcuts WHERE char_obj_id=?"); statement.setInt(1, objid); statement.execute(); statement.close(); statement = con.prepareStatement("DELETE FROM character_skills WHERE char_obj_id=?"); statement.setInt(1, objid); statement.execute(); statement.close(); statement = con.prepareStatement("DELETE FROM character_skills_save WHERE char_obj_id=?"); statement.setInt(1, objid); statement.execute(); statement.close(); statement = con.prepareStatement("DELETE FROM character_subclasses WHERE char_obj_id=?"); statement.setInt(1, objid); statement.execute(); statement.close(); statement = con.prepareStatement("DELETE FROM heroes WHERE char_id=?"); statement.setInt(1, objid); statement.execute(); statement.close(); statement = con.prepareStatement("DELETE FROM olympiad_nobles WHERE char_id=?"); statement.setInt(1, objid); statement.execute(); statement.close(); statement = con.prepareStatement("DELETE FROM seven_signs WHERE char_obj_id=?"); statement.setInt(1, objid); statement.execute(); statement.close(); statement = con.prepareStatement("DELETE FROM pets WHERE item_obj_id IN (SELECT object_id FROM items WHERE items.owner_id=?)"); statement.setInt(1, objid); statement.execute(); statement.close(); statement = con.prepareStatement("DELETE FROM augmentations WHERE item_id IN (SELECT object_id FROM items WHERE items.owner_id=?)"); statement.setInt(1, objid); statement.execute(); statement.close(); statement = con.prepareStatement("DELETE FROM items WHERE owner_id=?"); statement.setInt(1, objid); statement.execute(); statement.close(); statement = con.prepareStatement("DELETE FROM merchant_lease WHERE player_id=?"); statement.setInt(1, objid); statement.execute(); statement.close(); statement = con.prepareStatement("DELETE FROM characters WHERE obj_Id=?"); statement.setInt(1, objid); statement.execute(); statement.close(); } catch (Exception e) { _log.warning("Data error on deleting char: " + e); } finally { try { con.close(); } catch (Exception e) { } } } public L2PcInstance loadCharFromDisk(int charslot) { L2PcInstance character = L2PcInstance.load(getObjectIdForSlot(charslot)); if (character != null) { // restoreInventory(character); // restoreSkills(character); // character.restoreSkills(); // restoreShortCuts(character); // restoreWarehouse(character); // preinit some values for each login character.setRunning(); // running is default character.standUp(); // standing is default character.refreshOverloaded(); character.refreshExpertisePenalty(); character.sendPacket(new UserInfo(character)); character.broadcastKarma(); character.setOnlineStatus(true); } else { _log.severe("could not restore in slot: " + charslot); } // setCharacter(character); return character; } /** * @param chars */ public void setCharSelection(CharSelectInfoPackage[] chars) { _charSlotMapping.clear(); for (int i = 0; i < chars.length; i++) { int objectId = chars[i].getObjectId(); _charSlotMapping.add(new Integer(objectId)); } } public void close(L2GameServerPacket gsp) { getConnection().close(gsp); } /** * @param charslot * @return */ private int getObjectIdForSlot(int charslot) { if (charslot < 0 || charslot >= _charSlotMapping.size()) { _log.warning(toString() + " tried to delete Character in slot " + charslot + " but no characters exits at that slot."); return -1; } Integer objectId = _charSlotMapping.get(charslot); return objectId.intValue(); } @Override protected void onForcedDisconnection() { if (Config.DEBUG) _log.info("Client " + toString() + " disconnected abnormally."); if(activeChar.isInOlympiadMode()) { Olympiad.processPlayer(activeChar); } } @Override protected void onDisconnection() { // no long running tasks here, do it async try { ThreadPoolManager.getInstance().executeTask(new DisconnectTask()); } catch (RejectedExecutionException e) { // server is closing } } public boolean checkUnknownPackets() // TODO flood protector rework. { if (this.getActiveChar() != null && !this.getActiveChar().getFloodProtectors().getDropItem().tryPerformAction("unk packets")) { unknownPacketCount++; if (unknownPacketCount >= Config.MAX_UNKNOWN_PACKETS) return true; else return false; } else { unknownPacketCount = 0; return false; } } /** * Produces the best possible string representation of this client. */ @Override public String toString() { try { InetAddress address = getConnection().getInetAddress(); switch (getState()) { case CONNECTED: return "[iP: " + (address == null ? "disconnected" : address.getHostAddress()) + "]"; case AUTHED: return "[Account: " + getAccountName() + " - IP: " + (address == null ? "disconnected" : address.getHostAddress()) + "]"; case IN_GAME: return "[Character: " + (getActiveChar() == null ? "disconnected" : getActiveChar().getName()) + " - Account: " + getAccountName() + " - IP: " + (address == null ? "disconnected" : address.getHostAddress()) + "]"; default: throw new IllegalStateException("Missing state on switch"); } } catch (NullPointerException e) { return "[Character read failed due to disconnect]"; } } class DisconnectTask implements Runnable { /** * @see java.lang.Runnable#run() */ public void run() { boolean fast = true; try { isDetached(true); L2PcInstance player = L2GameClient.this.getActiveChar(); if (player != null) { if (!player.isInOlympiadMode() && !player.isFestivalParticipant() && !TvTEvent.isPlayerParticipant(player.getName()) && !player.isInJail()) { if ((player.isInStoreMode() && Config.OFFLINE_TRADE_ENABLE) || (player.isInCraftMode() && Config.OFFLINE_CRAFT_ENABLE)) { player.leaveParty(); if (Config.OFFLINE_SET_NAME_COLOR) { player.getAppearance().setNameColor(Config.OFFLINE_NAME_COLOR); player.broadcastUserInfo(); } return; } } if (player.isInCombat()) { fast = false; } } cleanMe(fast); } catch (Exception e1) { _log.log(Level.WARNING, "Error while disconnecting client.", e1); } } } public void cleanMe(boolean fast) { try { synchronized (this) { if (_cleanupTask == null) { _cleanupTask = ThreadPoolManager.getInstance().scheduleGeneral(new CleanupTask(), fast ? 5 : 15000L); } } } catch (Exception e1) { _log.log(Level.WARNING, "Error during cleanup.", e1); } } class CleanupTask implements Runnable { /** * @see java.lang.Runnable#run() */ public void run() { try { // Update BBS try { RegionBBSManager.getInstance().changeCommunityBoard(); } catch (Exception e) { e.printStackTrace(); } // we are going to manually save the char bellow thus we can force the cancel if (_autoSaveInDB != null) { _autoSaveInDB.cancel(true); } L2PcInstance player = L2GameClient.this.getActiveChar(); if (player != null) // this should only happen on connection loss { // we store all data from players who are disconnected while in an event in order to restore it in the next login if (player.atEvent) { EventData data = new EventData(player.eventX, player.eventY, player.eventZ, player.eventkarma, player.eventpvpkills, player.eventpkkills, player.eventTitle, player.kills, player.eventSitForced); L2Event.connectionLossData.put(player.getName(), data); } if (player.isFlying()) { player.removeSkill(SkillTable.getInstance().getInfo(4289, 1)); } // to prevent call cleanMe() again isDetached(false); // Check if the L2PcInstance is in observer mode to set its position to its position before entering in observer mode if (player.inObserverMode()) player.setXYZ(player.getObsX(), player.getObsY(), player.getObsZ()); //If player is in Olympiadmode set the right coordinates to port on relogin and reset all olympiad's variables if(player.isInOlympiadMode()) { player.setXYZ(player.getOlyX(), player.getOlyY(), player.getOlyZ()); player.setIsInOlympiadMode(false); player.setIsOlympiadStart(false); player.setOlympiadSide(-1); player.setOlympiadGameId(-1); player.setCurrentCp(player.getMaxCp()); player.setCurrentHp(player.getMaxHp()); player.setCurrentMp(player.getMaxMp()); player.getStatus().startHpMpRegeneration(); } try { saveCharToDisk(player); } catch (Exception e2) { /* ignore any problems here */ } // notify the world about our disconnect player.deleteMe(); } L2GameClient.this.setActiveChar(null); } catch (Exception e1) { _log.log(Level.WARNING, "Error while cleanup client.", e1); } finally { LoginServerThread.getInstance().sendLogout(L2GameClient.this.getAccountName()); } } } class AutoSaveTask implements Runnable { public void run() { try { L2PcInstance player = L2GameClient.this.getActiveChar(); if (player != null) { saveCharToDisk(player); } } catch (Throwable e) { _log.severe(e.toString()); } } } public void closeNow() { super.getConnection().close(null); cleanMe(true); } } sorry for dubble posting
-
Client: [Account: extr3me - IP: 89.136.27.10] - Failed running: [C] 0B Character Create java.lang.NullPointerException at lt.equal.gameserver.network.clientpackets.CharacterCreate.runImpl(Cha racterCreate.java:126) at lt.equal.gameserver.network.clientpackets.L2GameClientPacket.run(L2Ga meClientPacket.java:77) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source ) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) * 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 3 of the License, 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, see <http://www.gnu.org/licenses/>. */ package lt.equal.gameserver.network.clientpackets; import java.util.logging.Logger; import java.util.regex.Matcher; import java.util.regex.Pattern; import java.util.regex.PatternSyntaxException; import lt.equal.Config; import lt.equal.gameserver.datatables.CharNameTable; import lt.equal.gameserver.datatables.CharTemplateTable; import lt.equal.gameserver.datatables.ItemTable; import lt.equal.gameserver.datatables.SkillTable; import lt.equal.gameserver.datatables.SkillTreeTable; import lt.equal.gameserver.idfactory.IdFactory; import lt.equal.gameserver.model.L2ItemInstance; import lt.equal.gameserver.model.L2ShortCut; import lt.equal.gameserver.model.L2SkillLearn; import lt.equal.gameserver.model.L2World; import lt.equal.gameserver.model.quest.Quest; import lt.equal.gameserver.model.quest.QuestState; import lt.equal.gameserver.instancemanager.QuestManager; import lt.equal.gameserver.model.actor.instance.L2PcInstance; import lt.equal.gameserver.network.L2GameClient; import lt.equal.gameserver.network.serverpackets.CharCreateFail; import lt.equal.gameserver.network.serverpackets.CharCreateOk; import lt.equal.gameserver.network.serverpackets.CharSelectInfo; import lt.equal.gameserver.templates.L2Item; import lt.equal.gameserver.templates.L2PcTemplate; import lt.equal.gameserver.util.Util; @SuppressWarnings("unused") public final class CharacterCreate extends L2GameClientPacket { private static final String _C__0B_CHARACTERCREATE = "[C] 0B CharacterCreate"; private static Logger _log = Logger.getLogger(CharacterCreate.class.getName()); // cSdddddddddddd private String _name; private int _race; private byte _sex; private int _classId; private int _int; private int _str; private int _con; private int _men; private int _dex; private int _wit; private byte _hairStyle; private byte _hairColor; private byte _face; @Override protected void readImpl() { _name = readS(); _race = readD(); _sex = (byte)readD(); _classId = readD(); _int = readD(); _str = readD(); _con = readD(); _men = readD(); _dex = readD(); _wit = readD(); _hairStyle = (byte)readD(); _hairColor = (byte)readD(); _face = (byte)readD(); } @Override protected void runImpl() { if (CharNameTable.getInstance().accountCharNumber(getClient().getAccountName()) >= Config.MAX_CHARACTERS_NUMBER_PER_ACCOUNT && Config.MAX_CHARACTERS_NUMBER_PER_ACCOUNT != 0) { if (Config.DEBUG) _log.fine("Max number of characters reached. Creation failed."); CharCreateFail ccf = new CharCreateFail(CharCreateFail.REASON_TOO_MANY_CHARACTERS); sendPacket(ccf); return; } else if (CharNameTable.getInstance().doesCharNameExist(_name)) { if (Config.DEBUG) _log.fine("charname: "+ _name + " already exists. creation failed."); CharCreateFail ccf = new CharCreateFail(CharCreateFail.REASON_NAME_ALREADY_EXISTS); sendPacket(ccf); return; } else if ((_name.length() < 3) || (_name.length() > 16) || !Util.isAlphaNumeric(_name) || !isValidName(_name)) { if (Config.DEBUG) _log.fine("charname: " + _name + " is invalid. creation failed."); CharCreateFail ccf = new CharCreateFail(CharCreateFail.REASON_16_ENG_CHARS); sendPacket(ccf); return; } if (Config.DEBUG) _log.fine("charname: " + _name + " classId: " + _classId); L2PcTemplate template = CharTemplateTable.getInstance().getTemplate(_classId); if(template == null || template.classBaseLevel > 1) { CharCreateFail ccf = new CharCreateFail(CharCreateFail.REASON_CREATION_FAILED); sendPacket(ccf); return; } int objectId = IdFactory.getInstance().getNextId(); L2PcInstance newChar = L2PcInstance.create(objectId, template, getClient().getAccountName(), _name, _hairStyle, _hairColor, _face, _sex!=0); newChar.setCurrentHp(template.baseHpMax); newChar.setCurrentCp(template.baseCpMax); newChar.setCurrentMp(template.baseMpMax); //newChar.setMaxLoad(template.baseLoad); // send acknowledgement CharCreateOk cco = new CharCreateOk(); sendPacket(cco); initNewChar(getClient(), newChar); } private boolean isValidName(String text) { boolean result = true; String test = text; Pattern pattern; try { pattern = Pattern.compile(Config.CNAME_TEMPLATE); } catch (PatternSyntaxException e) // case of illegal pattern { _log.warning("ERROR : Character name pattern of config is wrong!"); pattern = Pattern.compile(".*"); } Matcher regexp = pattern.matcher(test); if (!regexp.matches()) { result = false; } return result; } private void initNewChar(L2GameClient client, L2PcInstance newChar) { if (Config.DEBUG) _log.fine("Character init start"); L2World.getInstance().storeObject(newChar); L2PcTemplate template = newChar.getTemplate(); newChar.addAdena("Init", Config.STARTING_ADENA, null, false); newChar.setXYZInvisible(-83063, 150791, -3133); newChar.setTitle("HeroesOfMight"); L2ShortCut shortcut; //add attack shortcut shortcut = new L2ShortCut(0,0,3,2,-1,1); newChar.registerShortCut(shortcut); //add take shortcut shortcut = new L2ShortCut(3,0,3,5,-1,1); newChar.registerShortCut(shortcut); //add sit shortcut shortcut = new L2ShortCut(10,0,3,0,-1,1); newChar.registerShortCut(shortcut); ItemTable itemTable = ItemTable.getInstance(); L2Item[] items = template.getItems(); for (int i = 0; i < items.length; i++) { L2ItemInstance item = newChar.getInventory().addItem("Init", items[i].getItemId(), 1, newChar, null); if (item.getItemId()==5588){ //add tutbook shortcut shortcut = new L2ShortCut(11,0,1,item.getObjectId(),-1,1); newChar.registerShortCut(shortcut); } if (item.isEquipable()){ if (newChar.getActiveWeaponItem() == null || !(item.getItem().getType2() != L2Item.TYPE2_WEAPON)) newChar.getInventory().equipItemAndRecord(item); } } L2SkillLearn[] startSkills = SkillTreeTable.getInstance().getAvailableSkills(newChar, newChar.getClassId()); for (int i = 0; i < startSkills.length; i++) { newChar.addSkill(SkillTable.getInstance().getInfo(startSkills[i].getId(), startSkills[i].getLevel()), true); if (startSkills[i].getId()==1001 || startSkills[i].getId()==1177){ shortcut = new L2ShortCut(1,0,2,startSkills[i].getId(),1,1); newChar.registerShortCut(shortcut); } if (startSkills[i].getId()==1216){ shortcut = new L2ShortCut(10,0,2,startSkills[i].getId(),1,1); newChar.registerShortCut(shortcut); } if (Config.DEBUG) _log.fine("adding starter skill:" + startSkills[i].getId()+ " / "+ startSkills[i].getLevel()); } L2GameClient.saveCharToDisk(newChar); newChar.deleteMe(); // release the world of this character and it's inventory startTutorialQuest(newChar); // send char list CharSelectInfo cl = new CharSelectInfo(client.getAccountName(), client.getSessionId().playOkID1); client.getConnection().sendPacket(cl); client.setCharSelection(cl.getCharInfo()); if (Config.DEBUG) _log.fine("Character init end"); } public void startTutorialQuest(L2PcInstance player) { QuestState qs = player.getQuestState("255_Tutorial"); Quest q = null; if (qs == null) q = QuestManager.getInstance().getQuest("255_Tutorial"); if (q != null) q.newQuestState(player); } @Override public String getType() { return _C__0B_CHARACTERCREATE; } }
-
Report To My Forum No HERE X(
-
Please Leave This Topic and go get another job to talk nonsense
-
Thx Very Much And Realtek The Website Work Fine
-
yes it's mine and to me it does not show any virus
-
Lineage 2 Mass PvP Game specs: Rates 3000x XP/SP, 3000x Adena , 1x Drop Stable. No lag. (Depending on your location, this has nothing to do with our server) Skills works 99,8% Duel system working All Boss working Augmentation working Oly Work 100 % Enchant: Safe: 5 Max weapon: 25 Max armor: 25 Max jewelry: 25 Normal scroll: 75% Crystal scroll: 75% Blessed scroll: 100% Offline Shop: Offline shop means players can disconnect and their private stores will stay online until they login again. Killing Spree system: If you consecutively kill players, a message will appear in main chat. VoiceCommand : .buyrec .aio .info .stat Webiste : http://www.l2masspvp.com/
-
hmmm the problem is your pc than
-
import net.sf.l2j.gameserver.model.actor.instance.L2NpcInstance; and done
-
Men Try To Use no-ip is more simple
-
i need some help with java server i am absoulitle newbie :)
extr3me replied to kafroylis's question in Request Server Development Help [L2J]
ERROR : Access denied for user 'root'@'localhost' (using password: NO) Go in config and search or in gameserver.properties or network.properties or server.properties and loginserver.properties and you will find that # --------------------------------------------------------------------------- # Database # --------------------------------------------------------------------------- # Uncomment the appropriate driver and url for the database you're using. If you don't know what this is... www.google.com Driver = com.mysql.jdbc.Driver #Driver = org.hsqldb.jdbcDriver #Driver = com.microsoft.sqlserver.jdbc.SQLServerDriver URL = jdbc:mysql://localhost/l2jdb #URL = jdbc:hsqldb:hsql://localhost/l2jdb #URL = jdbc:sqlserver://localhost/database = l2jdb/user = sa/password = #Database user info (using root user is not recommended) Login = root Password = Put Your Password witch you used on mysql server [sorry for my bad english] -
package custom.BossRespawn; import javolution.text.TextBuilder; import net.sf.l2j.gameserver.instancemanager.GrandBossManager; import net.sf.l2j.gameserver.model.actor.L2NpcInstance; import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance; import net.sf.l2j.gameserver.model.quest.Quest; import net.sf.l2j.gameserver.network.serverpackets.NpcHtmlMessage; import net.sf.l2j.gameserver.datatables.NpcTable; public class BossRespawn extends Quest { private static final int NPC_ID = 93000; private static final int[] BOSSES = {29001, 29006, 29014, 29019, 29020, 29022, 29028, 29045}; public BossRespawn(int questid, String name, String descr) { super(questid, name, descr); addFirstTalkId(NPC_ID); } public String onFirstTalk(L2Npc npc, L2PcInstance pc) { if(npc == null || pc == null) return null; if(npc.getNpcId() == NPC_ID) { sendInfo(pc); } return null; } private void sendInfo(L2PcInstance activeChar) { TextBuilder tb = new TextBuilder(); tb.append("<html><title>Grand Boss Info By Dleogr</title><body><br><center>"); tb.append("<img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br><br>"); for(int boss : BOSSES) { String name = NpcTable.getInstance().getTemplate(boss).getName(); long delay = GrandBossManager.getInstance().getStatsSet(boss).getLong("respawn_time"); if (delay <= System.currentTimeMillis()) { tb.append("<font color=\"00C3FF\">" + name + "</color>: " + "<font color=\"9CC300\">Is Alive</color>"+"<br1>"); } else { int hours = (int) ((delay - System.currentTimeMillis()) / 1000 / 60 / 60); int mins = (int) (((delay - (hours * 60 * 60 * 1000)) - System.currentTimeMillis()) / 1000 / 60); int seconts = (int) (((delay - ((hours * 60 * 60 * 1000) + (mins * 60 * 1000))) - System.currentTimeMillis()) / 1000); tb.append("<font color=\"00C3FF\">" + name + "</color>" + "<font color=\"FFFFFF\">" +" " + "Respawn in :</color>" + " " + " <font color=\"32C332\">" + hours + " : " + mins + " : " + seconts + "</color><br1>"); } } tb.append("<br><img src=\"L2UI_CH3.herotower_deco\" width=256 height=32><br>"); tb.append("</center></body></html>"); NpcHtmlMessage msg = new NpcHtmlMessage(NPC_ID); msg.setHtml(tb.toString()); activeChar.sendPacket(msg); } public static void main(String[] args) { new BossRespawn(-1, "BossRespawn", "custom"); } } Try This
-
Change gracia to interlude code
extr3me replied to extr3me's question in Request Server Development Help [L2J]
Thank's Man TOPIK LOKED -
/* * 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 3 of the License, 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, see <http://www.gnu.org/licenses/>. */ package net.sf.l2j.gameserver.handler.voicedcommandhandlers; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.logging.Logger; import net.sf.l2j.gameserver.cache.HtmCache; import net.sf.l2j.L2DatabaseFactory; import net.sf.l2j.gameserver.handler.IVoicedCommandHandler; import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance; import net.sf.l2j.gameserver.serverpackets.NpcHtmlMessage; /** * <B><U>User Character .repair voicecommand - SL2 L2JEmu</U></B><BR><BR> * * * <U>NOTICE:</U> Voice command .repair that when used, allows player to * try to repair any of characters on his account, by setting spawn * to Floran, removing all shortcuts and moving everything equipped to * that char warehouse.<BR><BR> * * * (solving client crashes on character entering world)<BR><BR> * * * @author szponiasty * @version $Revision: 0.17.2.95.2.9 $ $Date: 2010/03/03 9:07:11 $ */ public class Repair implements IVoicedCommandHandler { static final Logger _log = Logger.getLogger(Repair.class.getName()); private static final String[] _voicedCommands = { "repair", "startrepair" }; public boolean useVoicedCommand(String command, L2PcInstance activeChar, String target) { if (activeChar==null) return false; String repairChar=null; try { if(target != null) if(target.length() > 1) { String[] cmdParams = target.split(" "); repairChar=cmdParams[0]; } } catch (Exception e) { repairChar = null; } // Send activeChar HTML page if (command.startsWith("repair")) { String htmContent = HtmCache.getInstance().getHtm(activeChar.getHtmlPrefix(), "data/html/mods/repair/repair.htm"); NpcHtmlMessage npcHtmlMessage = new NpcHtmlMessage(5); npcHtmlMessage.setHtml(htmContent); npcHtmlMessage.replace("%acc_chars%", getCharList(activeChar)); activeChar.sendPacket(npcHtmlMessage); return true; } // Command for enter repairFunction from html if (command.startsWith("startrepair") && (repairChar != null)) { //_log.warning("Repair Attempt: Character " + repairChar); if (checkAcc(activeChar,repairChar)) { if (checkChar(activeChar,repairChar)) { String htmContent = HtmCache.getInstance().getHtm(activeChar.getHtmlPrefix(), "data/html/mods/repair/repair-self.htm"); NpcHtmlMessage npcHtmlMessage = new NpcHtmlMessage(5); npcHtmlMessage.setHtml(htmContent); activeChar.sendPacket(npcHtmlMessage); return false; } else if (checkJail(activeChar,repairChar)) { String htmContent = HtmCache.getInstance().getHtm(activeChar.getHtmlPrefix(), "data/html/mods/repair/repair-jail.htm"); NpcHtmlMessage npcHtmlMessage = new NpcHtmlMessage(5); npcHtmlMessage.setHtml(htmContent); activeChar.sendPacket(npcHtmlMessage); return false; } else { repairBadCharacter(repairChar); String htmContent = HtmCache.getInstance().getHtm(activeChar.getHtmlPrefix(), "data/html/mods/repair/repair-done.htm"); NpcHtmlMessage npcHtmlMessage = new NpcHtmlMessage(5); npcHtmlMessage.setHtml(htmContent); activeChar.sendPacket(npcHtmlMessage); return true; } } else { String htmContent = HtmCache.getInstance().getHtm(activeChar.getHtmlPrefix(), "data/html/mods/repair/repair-error.htm"); NpcHtmlMessage npcHtmlMessage = new NpcHtmlMessage(5); npcHtmlMessage.setHtml(htmContent); activeChar.sendPacket(npcHtmlMessage); return false; } } //_log.warning("Repair Attempt: Failed. "); return false; } private String getCharList(L2PcInstance activeChar) { String result=""; String repCharAcc=activeChar.getAccountName(); Connection con = null; try { con = L2DatabaseFactory.getInstance().getConnection(); PreparedStatement statement = con.prepareStatement("SELECT char_name FROM characters WHERE account_name=?"); statement.setString(1, repCharAcc); ResultSet rset = statement.executeQuery(); while (rset.next()) { if (activeChar.getName().compareTo(rset.getString(1)) != 0) result += rset.getString(1)+";"; } //_log.warning("Repair Attempt: Output Result for searching characters on account:"+result); rset.close(); statement.close(); } catch (SQLException e) { e.printStackTrace(); return result; } finally { try { if (con != null) con.close(); } catch (SQLException e) { e.printStackTrace(); } } return result; } private boolean checkAcc(L2PcInstance activeChar,String repairChar) { boolean result=false; String repCharAcc=""; Connection con = null; try { con = L2DatabaseFactory.getInstance().getConnection(); PreparedStatement statement = con.prepareStatement("SELECT account_name FROM characters WHERE char_name=?"); statement.setString(1, repairChar); ResultSet rset = statement.executeQuery(); if (rset.next()) { repCharAcc = rset.getString(1); } rset.close(); statement.close(); } catch (SQLException e) { e.printStackTrace(); return result; } finally { try { if (con != null) con.close(); } catch (SQLException e) { e.printStackTrace(); } } if (activeChar.getAccountName().compareTo(repCharAcc)==0) result=true; return result; } private boolean checkJail(L2PcInstance activeChar,String repairChar) { boolean result=false; int repCharJail = 0; Connection con = null; try { con = L2DatabaseFactory.getInstance().getConnection(); PreparedStatement statement = con.prepareStatement("SELECT punish_level FROM characters WHERE char_name=?"); statement.setString(1, repairChar); ResultSet rset = statement.executeQuery(); if (rset.next()) { repCharJail = rset.getInt(1); } rset.close(); statement.close(); } catch (SQLException e) { e.printStackTrace(); return result; } finally { try { if (con != null) con.close(); } catch (SQLException e) { e.printStackTrace(); } } if (repCharJail > 1) // 0 norm, 1 chat ban, 2 jail, 3.... result=true; return result; } private boolean checkChar(L2PcInstance activeChar,String repairChar) { boolean result=false; if (activeChar.getName().compareTo(repairChar)==0) result=true; return result; } private void repairBadCharacter(String charName) { Connection con = null; try { con = L2DatabaseFactory.getInstance().getConnection(); PreparedStatement statement; statement = con.prepareStatement("SELECT charId FROM characters WHERE char_name=?"); statement.setString(1, charName); ResultSet rset = statement.executeQuery(); int objId = 0; if (rset.next()) { objId = rset.getInt(1); } rset.close(); statement.close(); if (objId == 0) { con.close(); return; } statement = con.prepareStatement("UPDATE characters SET x=17867, y=170259, z=-3503 WHERE charId=?"); statement.setInt(1, objId); statement.execute(); statement.close(); statement = con.prepareStatement("DELETE FROM character_shortcuts WHERE charId=?"); statement.setInt(1, objId); statement.execute(); statement.close(); statement = con.prepareStatement("UPDATE items SET loc=\"WAREHOUSE\" WHERE owner_id=? AND loc=\"PAPERDOLL\""); statement.setInt(1, objId); statement.execute(); statement.close(); } catch (Exception e) { _log.warning("GameServer: could not repair character:" + e); } finally { try { if (con != null) con.close(); } catch (SQLException e) { e.printStackTrace(); } } } public String[] getVoicedCommandList() { return _voicedCommands; } } I Change Import For Interlude but i have error with this activeChar.getHtmlPrefix()