Jump to content
  • 0

Gs Erorr Please Help


Question

Posted

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;
}
}

2 answers to this question

Recommended Posts

  • 0
Posted

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Posts

    • General Trackers :   IPTorrents invite IPTorrents account 1 tb TorrentLeech invite Torrentleech account 1 tb buffer  InTheShaDow ( ITS ) account Acid-lounge invite Torrentday invite Crnaberza account Abn.Lol account Limit-of-eden account Norbits account Xspeeds account Xspeeds invite Bemaniso invite Wigornot account Bithumen invite Filelist account Funfile invite AvistaZ invite Potuk.net invite ResurrectThe.Net invite GrabThe.Info invite Greek-Team invite LinkoManija invite Fano.in account tracker.czech-server.com Speed.cd invite Arab-torrents.net account Arabscene.me account Scenetime account 4thd.xyz invite Btarg.com.ar account Dedbit invite Estone.cc account Speedapp invite Finvip invite Fluxzone account GigaTorrents account Gimmepeers account Haidan.video invite Mojblink account Mycarpathians invite Newinsane.info account Oscarworld.xyz account Peers.FM invite Pt.msg.vg account Ransackedcrew account Redemption invite Scene-rush account Seedfile.io invite Teracod invite Torrent.ai account Torrentmasters invite Ttsweb invite X-files invite X-ite invite Ncore account TorrentHR account Rptorrents account BwTorrents account Superbits invite Krazyzone account Immortalseed account Tntracker invite Pt.eastgame.org account Bitturk account Rstorrent account Tracker.btnext invite Torrent-turk.de account BeiTai.PT account Pt.keepfrds account 52pt.site account Pthome account Torrentseeds account Aystorrent account Blues-brothers.biz invite Divteam account Thesceneplace invite CinemaMovies.pl account Brasiltracker account Patiodebutacas account Newheaven.nl account  Swarmazon.club invite Bc-reloaded account Crazyspirits account Silentground invite Omg.wtftrackr invite Milkie.cc invite Breathetheword invite Madsrevolution account Chilebt account Yubraca account Uniongang.tv account Frboard account Exvagos account Diablotorrent account Microbit account Carp-hunter.hu account Majomparade.eu account Theshinning.me account Youiv.info account Dragonworld-reloaded account Sharewood.tv account Partis.si account Digitalcore.club invite Fuzer.me account R3vuk.wtf invite Ztracker account 1 tb buffer 3changtrai account Best-core.info account Bitsite.us account Eliteunitedcrew invite Exitorrent.org account Tophos invite Torrent.lt account Sktorrent.eu account Oshen account Blackhattorrent account Pirata.digital account Esharenet account Ohmenarikgi.la Pirate-share account Immortuos account Kiesbits account Cliente.amigos-share.club account Broadcity invite Ilovetorzz account Torrentbytes account Polishsource account Portugas invite Shareisland account ArabaFenice account Hudbt.hust.edu.cn account Audiences account Nanyangpt account Pt.sjtu.edu.cn account Pt.zhixing.bjtu.edu.cn account Byr.pt invite Ptfiles invite Red-bits account Pt.hdpost.top account Irrenhaus.dyndns.dk (NewPropaganda) account Mnvv2.info (MaxNewVision V2) account 1ptba.com account Spidertk.top account Film-paleis account Generation-free account Aftershock-tracker account Twilightsdreams account Back-ups.me invite Sor-next.tk ( Spirit Of Revolution ) account Tfa.tf ( The Falling Angels ) account Hdmayi account S-f-p.dyndns.dk ( Share Friends Projekt ) account Unlimitz.biz account Pttime account St-tracker.eu account New-retro.eu account Zbbit account Tigers-dl.net account Jptvts.us account Lat-team account Club.hares.top account Falkonvision-team account Concen account Drugari account T.ceskeforum account Peeratiko.org account Zamunda.se account Central-torrent.eu account h-o-d.org account Torrentleech.pl account Demonoid invite Lst.gg account Fakedoor.store account LaidBackManor account Vrbsharezone.co.uk invite Torrenteros account Arenaelite account Datascene account Tracker.0day.community Tapochek.net invite Ptchina invite Lesaloon account Exyusubs account Therebels.tv account Ubits.club invite Zmpt.cc account Turktorrent.us account Dasunerwarte account Hawke.uno account Monikadesign account Fearnopeer account Alpharatio account Wukongwendao.top account Chinapyg account Azusa.wiki account Yggtorrent.top account Torrentdd account Cyanbug.net invite Hhanclub.top account Wintersakura.net account Xthor account Tctg.pm account Finelite invite Agsvpt.com account Pt.0ff.cc invite Qingwapt.com account Xingtan.one account Ptcafe.club invite W-o-t.pro account Coastal-crew.bounceme.net account Darkpeers.org account Pianyuan.org account Seedpool.org  account Tempelbox account Pt.itzmx.com account Capybarabr.com account Itatorrents.xyz  account Letseed.org account The-new-fun.com  account Malayabits.cc account Trellas.me account Yu-scene.net account Futuretorrent.org account Bitpt.cn account Tocashare.biz  account Videoteka.org  account White-angel.hu account Xbytesv2.li account   Movies Trackers :   Anthelion account Pixelhd account Cinemageddon account DVDSeed account Cinemageddon account Cinemaz account Retroflix account Classix-unlimited - invite Movie-Torrentz (m2g.link) invite Punck-tracker.net account Tmghub account Tb-asian account Cathode-ray.tube account Greatposterwall account Telly account Arabicsource.net account Upload.cx account Crabpt.vip invite Onlyencodes.cc account Exyusubs account Hellashut.net invite Nordichd.sytes.net invite Locadora.cc account   HD Trackers :   Blutopia buffered account Hd-olimpo buffered account Hdf.world account Torrentland.li account HdSky account Hdchina account Chdbits account Totheglory account Hdroute account Hdhome account TorrentCCF aka et8.org account 3DTorrents invite HD-Torrents account Bit-HDTV account HDME.eu invite Hdarea.co account Asiancinema.me account JoyHD invite HDSpace invite CrazyHD invite Bluebird-hd invite Htpt.cc account Hdtime invite Ourbits.club account Hd4fans account Siambit account Privatehd account Springsunday account Tjupt account Hdcity.leniter invite Ccfbits account Discfan account Pt.btschool.club account Ptsbao.club invite Hdzone.me invite Danishbytes account Zonaq.pw account Tracker.tekno3d account Arabp2p account Hd-united account Reelflix.xyz account Hdatmos.club account Anasch.cc invite Tigris-t account Nethd.org account Hd.ai invite Hitpt.com account Hdmonkey account Dragonhd.xyz account Hdclub.eu account Forum.bluraycd.com account Carpt account Hdfun.me invite Pt.hdupt invite Puntotorrent account Ultrahd account Rousi.zip account Bearbit account Hdturk.club account Asiandvdclub account Star-space.net account Nordicq.org account Hdkyl.in account Utp.to account Hdzero account   Music Trackers :   Dicmusic account Music-Vid account Open.cd account LzTr account ProAudioTorrents invite Jpopsuki invite TranceTraffic invite Audionews invite Kraytracker invite Libble.me invite Losslessclub invite Indietorrents.com invite Dimeadozen account Funkytorrents invite Karaokedl account zombtracker.the-zomb account Concertos account Sugoimusic account Satclubbing.club invite Metal.iplay invite Psyreactor invite Panda.cd account Adamsfile account Freehardmusic account Tracker.hqmusic.vn accouunt Twilightzoom account 3 tb buffer Hiresmusic account Metalguru account Musictorrents.org account Musebootlegs.com invite Zappateers.com account Jungleland.dnsalias.com account Naftamusic account   E-Learning Trackers :   Thevault account BitSpyder invite Brsociety account Learnbits invite Myanonamouse account Libranet account 420Project account Learnflakes account Pt.soulvoice.club account P2pelite account Aaaaarg.fail invite Ebooks-shares.org account Abtorrents account Pt.tu88.men invite Docspedia.world invite   TV-Trackers :   Skipthecommericals Cryptichaven account TV-Vault invite Shazbat.TV account Myspleen account Tasmanit.es invite Tvstore.me account Tvchaosuk account Jptv.club account Tvroad.info   XXX - Porn Trackers :   FemdomCult account Pornbay account Pussytorrents account Adult-cinema-network account Bootytape account 1 Tb buffer Exoticaz account Bitporn account Kufirc account Gaytorrent.ru invite Nicept account Gay-torrents.org invite Ourgtn account Pt.hdbd.us account BitSexy account Happyfappy.org account Kamept.com account Lesbians4u.org account   Gaming Trackers :   Mteam.fr account BitGamer invite Retrowithin invite Gamegamept account   Cartoon/Anime/Comic Trackers :   Animeworld account Oldtoons.world account U2.dmhy account CartoonChaos invite Animetorrents account Mononoke account Totallykids.tv account Bakabt.me invite Revanime account Ansktracker account Tracker.shakaw.com.br invite Bt.mdan.org account Skyey2.com account Animetracker.cc Adbt.it.cx invite Tracker.uniotaku.com account Mousebits.com account   Sports Trackers :   MMA-Tracker invite T3nnis.tv invite AcrossTheTasman account RacingForMe invite Sportscult invite Ultimatewrestlingtorrents account Worldboxingvideoarchive invite CyclingTorrents account Xtremewrestlingtorrents account Tc-boxing invite Mma-torrents account Aussierul invite Xwt-classics account Racing4everyone account Talk.tenyardtracker account Stalker.societyglitch invite Extremebits invite Rgfootball.net account F1carreras.xyz account   Software/Apps Trackers :   Brokenstones account Appzuniverse invite Teamos.xyz account Macbb.org account   Graphics Trackers: Forum.Cgpersia account Gfxpeers account Forum.gfxdomain account   Documentary Trackers:   Forums.mvgroup account   Others   Fora.snahp.eu account Board4all.biz account Filewarez.tv account Makingoff.org/forum account Xrel.to account Undergunz.su account Corebay account Endoftheinter.net ( EOTI ) account Thismight.be invite Skull.facefromouter.space account Avxhm.se (AvaxHome) account Ssdforum account Notfake.vip account Intotheinter.net account Tildes.net invite Thetoonz account Usinavirtual account Hdclasico invite HispaShare account Valentine.wtf account Adit-hd account Forum-andr.net account Warezforums account Justanothermusic.site account Forbiddenlibrary.moe account Senturion.to account Movieparadise account Militaryzone account Dcdnet.ru account Sftdevils.net account Heavy-r.com account New-team.org account Ddl.tv account Filewarez.club account Hispamula.org account Hubwarez.tv account Ultim-zone.in account   NZB :   Ninjacentral.co.za account Tabula-rasa.pw account Drunkenslug account Drunkenslug invite Usenet-4all account Brothers-of-Usenet account Dognzb.cr invite Kleverig account Nzb.cat account Nzbplanet.net invite Ng4you.com account Nzbsa.co.za account Bd25.eu account NZB.to account Samuraiplace account Abhdtv.net account Abook.link account Comix.pw account House-of-usenet Secretbinaries.net account Vnext.to account Stockboxx.top account Sky-of-use.net account Prices start from 3 $ to 100 $   Payment methods: Crypto, Neteller, Webmoney, Revolut   If you want to buy something send me a pm or contact me on:   Email: morrison2102@gmail.com   Discord: LFC4LIFE#4173   Telegram: https://t.me/LFC4LIFE4173   Skype: morrison2102@hotmail.com  
    • Pero necesito ser premium :v
    • Buenas gente , Solicito si me podrían compartir archivos originales l2 off high five 
  • Topics

×
×
  • Create New...

Important Information

This community uses essential cookies to function properly. Non-essential cookies and third-party services are used only with your consent. Read our Privacy Policy and We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue..