Fixed offline trading.
This commit is contained in:
@@ -39,7 +39,6 @@ import org.l2jmobius.gameserver.communitybbs.Manager.ForumsBBSManager;
|
||||
import org.l2jmobius.gameserver.data.HeroSkillTable;
|
||||
import org.l2jmobius.gameserver.data.ItemTable;
|
||||
import org.l2jmobius.gameserver.data.NobleSkillTable;
|
||||
import org.l2jmobius.gameserver.data.OfflineTradeTable;
|
||||
import org.l2jmobius.gameserver.data.SchemeBufferTable;
|
||||
import org.l2jmobius.gameserver.data.SkillTable;
|
||||
import org.l2jmobius.gameserver.data.sql.AnnouncementsTable;
|
||||
@@ -47,6 +46,7 @@ import org.l2jmobius.gameserver.data.sql.CharNameTable;
|
||||
import org.l2jmobius.gameserver.data.sql.ClanTable;
|
||||
import org.l2jmobius.gameserver.data.sql.HelperBuffTable;
|
||||
import org.l2jmobius.gameserver.data.sql.NpcTable;
|
||||
import org.l2jmobius.gameserver.data.sql.OfflineTraderTable;
|
||||
import org.l2jmobius.gameserver.data.sql.PetDataTable;
|
||||
import org.l2jmobius.gameserver.data.sql.SkillSpellbookTable;
|
||||
import org.l2jmobius.gameserver.data.sql.SkillTreeTable;
|
||||
@@ -440,7 +440,7 @@ public class GameServer
|
||||
|
||||
if ((Config.OFFLINE_TRADE_ENABLE || Config.OFFLINE_CRAFT_ENABLE) && Config.RESTORE_OFFLINERS)
|
||||
{
|
||||
OfflineTradeTable.restoreOfflineTraders();
|
||||
OfflineTraderTable.restoreOfflineTraders();
|
||||
}
|
||||
|
||||
Util.printSection("Protection");
|
||||
|
@@ -261,8 +261,7 @@ public class LoginServerThread extends Thread
|
||||
{
|
||||
playerList.add(player.getAccountName());
|
||||
}
|
||||
final PlayerInGame pig = new PlayerInGame(playerList);
|
||||
sendPacket(pig);
|
||||
sendPacket(new PlayerInGame(playerList));
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -463,9 +462,10 @@ public class LoginServerThread extends Thread
|
||||
|
||||
public void doKickPlayer(String account)
|
||||
{
|
||||
if (_accountsInGameServer.get(account) != null)
|
||||
final GameClient client = _accountsInGameServer.get(account);
|
||||
if (client != null)
|
||||
{
|
||||
_accountsInGameServer.get(account).closeNow();
|
||||
client.close(true);
|
||||
getInstance().sendLogout(account);
|
||||
}
|
||||
}
|
||||
|
@@ -22,9 +22,9 @@ import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||
import org.l2jmobius.commons.database.DatabaseBackup;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.gameserver.data.OfflineTradeTable;
|
||||
import org.l2jmobius.gameserver.data.SchemeBufferTable;
|
||||
import org.l2jmobius.gameserver.data.sql.AnnouncementsTable;
|
||||
import org.l2jmobius.gameserver.data.sql.OfflineTraderTable;
|
||||
import org.l2jmobius.gameserver.instancemanager.CastleManorManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.GlobalVariablesManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.GrandBossManager;
|
||||
@@ -413,7 +413,7 @@ public class Shutdown extends Thread
|
||||
{
|
||||
if ((Config.OFFLINE_TRADE_ENABLE || Config.OFFLINE_CRAFT_ENABLE) && Config.RESTORE_OFFLINERS)
|
||||
{
|
||||
OfflineTradeTable.storeOffliners();
|
||||
OfflineTraderTable.storeOffliners();
|
||||
}
|
||||
}
|
||||
catch (Throwable t)
|
||||
|
@@ -14,7 +14,7 @@
|
||||
* 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 org.l2jmobius.gameserver.data;
|
||||
package org.l2jmobius.gameserver.data.sql;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
@@ -32,15 +32,14 @@ import org.l2jmobius.gameserver.model.TradeList.TradeItem;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.network.ConnectionState;
|
||||
import org.l2jmobius.gameserver.network.GameClient;
|
||||
|
||||
/**
|
||||
* @author Shyla
|
||||
*/
|
||||
public class OfflineTradeTable
|
||||
public class OfflineTraderTable
|
||||
{
|
||||
private static final Logger LOGGER = Logger.getLogger(OfflineTradeTable.class.getName());
|
||||
private static final Logger LOGGER = Logger.getLogger(OfflineTraderTable.class.getName());
|
||||
|
||||
// SQL DEFINITIONS
|
||||
private static final String SAVE_OFFLINE_STATUS = "INSERT INTO character_offline_trade (`charId`,`time`,`type`,`title`) VALUES (?,?,?,?)";
|
||||
@@ -143,7 +142,7 @@ public class OfflineTradeTable
|
||||
}
|
||||
default:
|
||||
{
|
||||
// LOGGER.info( "OfflineTradersTable[storeTradeItems()]: Error while saving offline trader: " + pc.getObjectId() + ", store type: "+pc.getPrivateStoreType());
|
||||
// LOGGER.info( "OfflineTraderTable[storeTradeItems()]: Error while saving offline trader: " + pc.getObjectId() + ", store type: "+pc.getPrivateStoreType());
|
||||
// no save for this kind of shop
|
||||
continue;
|
||||
}
|
||||
@@ -156,7 +155,7 @@ public class OfflineTradeTable
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LOGGER.warning("OfflineTradersTable[storeTradeItems()]: Error while saving offline trader: " + pc.getObjectId() + " " + e);
|
||||
LOGGER.warning("OfflineTraderTable[storeTradeItems()]: Error while saving offline trader: " + pc.getObjectId() + " " + e);
|
||||
}
|
||||
}
|
||||
stm.close();
|
||||
@@ -165,7 +164,7 @@ public class OfflineTradeTable
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LOGGER.warning("OfflineTradersTable[storeTradeItems()]: Error while saving offline traders: " + e);
|
||||
LOGGER.warning("OfflineTraderTable[storeTradeItems()]: Error while saving offline traders: " + e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -202,10 +201,10 @@ public class OfflineTradeTable
|
||||
try
|
||||
{
|
||||
final GameClient client = new GameClient();
|
||||
client.setDetached(true);
|
||||
player = PlayerInstance.load(rs.getInt("charId"));
|
||||
client.setPlayer(player);
|
||||
client.setAccountName(player.getAccountName());
|
||||
client.setConnectionState(ConnectionState.IN_GAME);
|
||||
player.setClient(client);
|
||||
player.setOfflineMode(true);
|
||||
player.setOnlineStatus(false);
|
||||
@@ -279,7 +278,7 @@ public class OfflineTradeTable
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LOGGER.warning("OfflineTradersTable[loadOffliners()]: Error loading trader: " + e);
|
||||
LOGGER.warning("OfflineTraderTable[loadOffliners()]: Error loading trader: " + e);
|
||||
if (player != null)
|
||||
{
|
||||
player.logout();
|
||||
@@ -293,7 +292,7 @@ public class OfflineTradeTable
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LOGGER.warning("OfflineTradersTable[loadOffliners()]: Error while loading offline traders: " + e);
|
||||
LOGGER.warning("OfflineTraderTable[loadOffliners()]: Error while loading offline traders: " + e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -392,7 +391,7 @@ public class OfflineTradeTable
|
||||
}
|
||||
default:
|
||||
{
|
||||
// LOGGER.info( "OfflineTradersTable[storeOffliner()]: Error while saving offline trader: " + pc.getObjectId() + ", store type: "+pc.getPrivateStoreType());
|
||||
// LOGGER.info( "OfflineTraderTable[storeOffliner()]: Error while saving offline trader: " + pc.getObjectId() + ", store type: "+pc.getPrivateStoreType());
|
||||
// no save for this kind of shop
|
||||
save = false;
|
||||
}
|
||||
@@ -408,7 +407,7 @@ public class OfflineTradeTable
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LOGGER.warning("OfflineTradersTable[storeOffliner()]: Error while saving offline trader: " + pc.getObjectId() + " " + e);
|
||||
LOGGER.warning("OfflineTraderTable[storeOffliner()]: Error while saving offline trader: " + pc.getObjectId() + " " + e);
|
||||
}
|
||||
|
||||
stm.close();
|
||||
@@ -416,7 +415,7 @@ public class OfflineTradeTable
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LOGGER.warning("OfflineTradersTable[storeOffliner()]: Error while saving offline traders: " + e);
|
||||
LOGGER.warning("OfflineTraderTable[storeOffliner()]: Error while saving offline traders: " + e);
|
||||
}
|
||||
}
|
||||
}
|
@@ -18,11 +18,12 @@ package org.l2jmobius.gameserver.model;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.gameserver.data.ItemTable;
|
||||
import org.l2jmobius.gameserver.data.OfflineTradeTable;
|
||||
import org.l2jmobius.gameserver.data.sql.OfflineTraderTable;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.itemcontainer.PlayerInventory;
|
||||
import org.l2jmobius.gameserver.model.items.Item;
|
||||
@@ -145,7 +146,7 @@ public class TradeList
|
||||
|
||||
public TradeList(PlayerInstance owner)
|
||||
{
|
||||
_items = new ArrayList<>();
|
||||
_items = new CopyOnWriteArrayList<>();
|
||||
_owner = owner;
|
||||
}
|
||||
|
||||
@@ -1053,7 +1054,7 @@ public class TradeList
|
||||
|
||||
if (_owner.isInOfflineMode())
|
||||
{
|
||||
OfflineTradeTable.storeOffliner(_owner);
|
||||
OfflineTraderTable.storeOffliner(_owner);
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -1302,7 +1303,7 @@ public class TradeList
|
||||
|
||||
if (_owner.isInOfflineMode())
|
||||
{
|
||||
OfflineTradeTable.storeOffliner(_owner);
|
||||
OfflineTraderTable.storeOffliner(_owner);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@@ -315,7 +315,8 @@ public class World
|
||||
|
||||
if (!player.isTeleporting() && (tmp != null))
|
||||
{
|
||||
LOGGER.warning("Teleporting: Duplicate character!? Closing both characters (" + player.getName() + ")");
|
||||
// This can happen when offline system is enabled.
|
||||
// LOGGER.warning("Teleporting: Duplicate character!? Closing both characters (" + player.getName() + ")");
|
||||
player.closeNetConnection();
|
||||
tmp.closeNetConnection();
|
||||
return;
|
||||
|
@@ -39,9 +39,9 @@ import org.l2jmobius.commons.network.IIncomingPacket;
|
||||
import org.l2jmobius.commons.util.Chronos;
|
||||
import org.l2jmobius.gameserver.LoginServerThread;
|
||||
import org.l2jmobius.gameserver.LoginServerThread.SessionKey;
|
||||
import org.l2jmobius.gameserver.data.OfflineTradeTable;
|
||||
import org.l2jmobius.gameserver.data.SkillTable;
|
||||
import org.l2jmobius.gameserver.data.sql.ClanTable;
|
||||
import org.l2jmobius.gameserver.data.sql.OfflineTraderTable;
|
||||
import org.l2jmobius.gameserver.instancemanager.events.CTF;
|
||||
import org.l2jmobius.gameserver.instancemanager.events.DM;
|
||||
import org.l2jmobius.gameserver.instancemanager.events.GameEvent;
|
||||
@@ -490,8 +490,8 @@ public class GameClient extends ChannelInboundHandler<GameClient>
|
||||
PlayerInstance player = World.getInstance().getPlayer(objectId);
|
||||
if (player != null)
|
||||
{
|
||||
// exploit prevention, should not happens in normal way
|
||||
LOGGER.warning("Attempt of double login: " + player.getName() + "(" + objectId + ") " + _accountName);
|
||||
// This can happen when offline system is enabled.
|
||||
// LOGGER.warning("Attempt of double login: " + player.getName() + "(" + objectId + ") " + _accountName);
|
||||
|
||||
if (player.getClient() != null)
|
||||
{
|
||||
@@ -505,9 +505,9 @@ public class GameClient extends ChannelInboundHandler<GameClient>
|
||||
{
|
||||
player.store();
|
||||
}
|
||||
catch (Exception e2)
|
||||
catch (Exception e)
|
||||
{
|
||||
LOGGER.warning("fixme:unhandled exception " + e2);
|
||||
LOGGER.warning("GameClient: Count not store player. " + e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -640,8 +640,18 @@ public class GameClient extends ChannelInboundHandler<GameClient>
|
||||
player.decreaseBoxes();
|
||||
}
|
||||
|
||||
// prevent closing again
|
||||
player.setClient(null);
|
||||
|
||||
if ((player.isInStoreMode() && Config.OFFLINE_TRADE_ENABLE) //
|
||||
|| (player.isCrafting() && Config.OFFLINE_CRAFT_ENABLE))
|
||||
{
|
||||
if (!Config.OFFLINE_MODE_IN_PEACE_ZONE || (Config.OFFLINE_MODE_IN_PEACE_ZONE && player.isInsideZone(ZoneId.PEACE)))
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// prevent closing again
|
||||
player.deleteMe();
|
||||
player.store(true);
|
||||
}
|
||||
@@ -727,7 +737,7 @@ public class GameClient extends ChannelInboundHandler<GameClient>
|
||||
|
||||
if (Config.OFFLINE_MODE_SET_INVULNERABLE)
|
||||
{
|
||||
_player.setInvul(true);
|
||||
player.setInvul(true);
|
||||
}
|
||||
if (Config.OFFLINE_SET_NAME_COLOR)
|
||||
{
|
||||
@@ -741,7 +751,7 @@ public class GameClient extends ChannelInboundHandler<GameClient>
|
||||
player.setOfflineStartTime(Chronos.currentTimeMillis());
|
||||
}
|
||||
|
||||
OfflineTradeTable.storeOffliner(player);
|
||||
OfflineTraderTable.storeOffliner(player);
|
||||
World.OFFLINE_TRADE_COUNT++;
|
||||
return;
|
||||
}
|
||||
@@ -790,15 +800,6 @@ public class GameClient extends ChannelInboundHandler<GameClient>
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns false if client can receive packets. True if detached or queue overflow detected and queue still not empty.
|
||||
* @return
|
||||
*/
|
||||
public boolean dropPacket()
|
||||
{
|
||||
return _isDetached;
|
||||
}
|
||||
|
||||
public void setProtocolVersion(int version)
|
||||
{
|
||||
_protocolVersion = version;
|
||||
|
@@ -62,7 +62,7 @@ public class SetPrivateStoreListSell implements IClientIncomingPacket
|
||||
_items[(x * 3) + 2] = price;
|
||||
}
|
||||
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -39,7 +39,6 @@ import org.l2jmobius.gameserver.communitybbs.Manager.ForumsBBSManager;
|
||||
import org.l2jmobius.gameserver.data.HeroSkillTable;
|
||||
import org.l2jmobius.gameserver.data.ItemTable;
|
||||
import org.l2jmobius.gameserver.data.NobleSkillTable;
|
||||
import org.l2jmobius.gameserver.data.OfflineTradeTable;
|
||||
import org.l2jmobius.gameserver.data.SchemeBufferTable;
|
||||
import org.l2jmobius.gameserver.data.SkillTable;
|
||||
import org.l2jmobius.gameserver.data.sql.AnnouncementsTable;
|
||||
@@ -47,6 +46,7 @@ import org.l2jmobius.gameserver.data.sql.CharNameTable;
|
||||
import org.l2jmobius.gameserver.data.sql.ClanTable;
|
||||
import org.l2jmobius.gameserver.data.sql.HelperBuffTable;
|
||||
import org.l2jmobius.gameserver.data.sql.NpcTable;
|
||||
import org.l2jmobius.gameserver.data.sql.OfflineTraderTable;
|
||||
import org.l2jmobius.gameserver.data.sql.PetDataTable;
|
||||
import org.l2jmobius.gameserver.data.sql.SkillSpellbookTable;
|
||||
import org.l2jmobius.gameserver.data.sql.SkillTreeTable;
|
||||
@@ -452,7 +452,7 @@ public class GameServer
|
||||
|
||||
if ((Config.OFFLINE_TRADE_ENABLE || Config.OFFLINE_CRAFT_ENABLE) && Config.RESTORE_OFFLINERS)
|
||||
{
|
||||
OfflineTradeTable.restoreOfflineTraders();
|
||||
OfflineTraderTable.restoreOfflineTraders();
|
||||
}
|
||||
|
||||
Util.printSection("Protection");
|
||||
|
@@ -262,8 +262,7 @@ public class LoginServerThread extends Thread
|
||||
{
|
||||
playerList.add(player.getAccountName());
|
||||
}
|
||||
final PlayerInGame pig = new PlayerInGame(playerList);
|
||||
sendPacket(pig);
|
||||
sendPacket(new PlayerInGame(playerList));
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -464,9 +463,10 @@ public class LoginServerThread extends Thread
|
||||
|
||||
public void doKickPlayer(String account)
|
||||
{
|
||||
if (_accountsInGameServer.get(account) != null)
|
||||
final GameClient client = _accountsInGameServer.get(account);
|
||||
if (client != null)
|
||||
{
|
||||
_accountsInGameServer.get(account).closeNow();
|
||||
client.close(true);
|
||||
getInstance().sendLogout(account);
|
||||
}
|
||||
}
|
||||
|
@@ -22,9 +22,9 @@ import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||
import org.l2jmobius.commons.database.DatabaseBackup;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.gameserver.data.OfflineTradeTable;
|
||||
import org.l2jmobius.gameserver.data.SchemeBufferTable;
|
||||
import org.l2jmobius.gameserver.data.sql.AnnouncementsTable;
|
||||
import org.l2jmobius.gameserver.data.sql.OfflineTraderTable;
|
||||
import org.l2jmobius.gameserver.instancemanager.CastleManorManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.CursedWeaponsManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.FishingChampionshipManager;
|
||||
@@ -415,7 +415,7 @@ public class Shutdown extends Thread
|
||||
{
|
||||
if ((Config.OFFLINE_TRADE_ENABLE || Config.OFFLINE_CRAFT_ENABLE) && Config.RESTORE_OFFLINERS)
|
||||
{
|
||||
OfflineTradeTable.storeOffliners();
|
||||
OfflineTraderTable.storeOffliners();
|
||||
}
|
||||
}
|
||||
catch (Throwable t)
|
||||
|
@@ -14,7 +14,7 @@
|
||||
* 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 org.l2jmobius.gameserver.data;
|
||||
package org.l2jmobius.gameserver.data.sql;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
@@ -32,15 +32,14 @@ import org.l2jmobius.gameserver.model.TradeList.TradeItem;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.network.ConnectionState;
|
||||
import org.l2jmobius.gameserver.network.GameClient;
|
||||
|
||||
/**
|
||||
* @author Shyla
|
||||
*/
|
||||
public class OfflineTradeTable
|
||||
public class OfflineTraderTable
|
||||
{
|
||||
private static final Logger LOGGER = Logger.getLogger(OfflineTradeTable.class.getName());
|
||||
private static final Logger LOGGER = Logger.getLogger(OfflineTraderTable.class.getName());
|
||||
|
||||
// SQL DEFINITIONS
|
||||
private static final String SAVE_OFFLINE_STATUS = "INSERT INTO character_offline_trade (`charId`,`time`,`type`,`title`) VALUES (?,?,?,?)";
|
||||
@@ -143,7 +142,7 @@ public class OfflineTradeTable
|
||||
}
|
||||
default:
|
||||
{
|
||||
// LOGGER.info( "OfflineTradersTable[storeTradeItems()]: Error while saving offline trader: " + pc.getObjectId() + ", store type: "+pc.getPrivateStoreType());
|
||||
// LOGGER.info( "OfflineTraderTable[storeTradeItems()]: Error while saving offline trader: " + pc.getObjectId() + ", store type: "+pc.getPrivateStoreType());
|
||||
// no save for this kind of shop
|
||||
continue;
|
||||
}
|
||||
@@ -156,7 +155,7 @@ public class OfflineTradeTable
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LOGGER.warning("OfflineTradersTable[storeTradeItems()]: Error while saving offline trader: " + pc.getObjectId() + " " + e);
|
||||
LOGGER.warning("OfflineTraderTable[storeTradeItems()]: Error while saving offline trader: " + pc.getObjectId() + " " + e);
|
||||
}
|
||||
}
|
||||
stm.close();
|
||||
@@ -165,7 +164,7 @@ public class OfflineTradeTable
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LOGGER.warning("OfflineTradersTable[storeTradeItems()]: Error while saving offline traders: " + e);
|
||||
LOGGER.warning("OfflineTraderTable[storeTradeItems()]: Error while saving offline traders: " + e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -202,10 +201,10 @@ public class OfflineTradeTable
|
||||
try
|
||||
{
|
||||
final GameClient client = new GameClient();
|
||||
client.setDetached(true);
|
||||
player = PlayerInstance.load(rs.getInt("charId"));
|
||||
client.setPlayer(player);
|
||||
client.setAccountName(player.getAccountName());
|
||||
client.setConnectionState(ConnectionState.IN_GAME);
|
||||
player.setClient(client);
|
||||
player.setOfflineMode(true);
|
||||
player.setOnlineStatus(false);
|
||||
@@ -279,7 +278,7 @@ public class OfflineTradeTable
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LOGGER.warning("OfflineTradersTable[loadOffliners()]: Error loading trader: " + e);
|
||||
LOGGER.warning("OfflineTraderTable[loadOffliners()]: Error loading trader: " + e);
|
||||
if (player != null)
|
||||
{
|
||||
player.logout();
|
||||
@@ -293,7 +292,7 @@ public class OfflineTradeTable
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LOGGER.warning("OfflineTradersTable[loadOffliners()]: Error while loading offline traders: " + e);
|
||||
LOGGER.warning("OfflineTraderTable[loadOffliners()]: Error while loading offline traders: " + e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -392,7 +391,7 @@ public class OfflineTradeTable
|
||||
}
|
||||
default:
|
||||
{
|
||||
// LOGGER.info( "OfflineTradersTable[storeOffliner()]: Error while saving offline trader: " + pc.getObjectId() + ", store type: "+pc.getPrivateStoreType());
|
||||
// LOGGER.info( "OfflineTraderTable[storeOffliner()]: Error while saving offline trader: " + pc.getObjectId() + ", store type: "+pc.getPrivateStoreType());
|
||||
// no save for this kind of shop
|
||||
save = false;
|
||||
}
|
||||
@@ -408,7 +407,7 @@ public class OfflineTradeTable
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LOGGER.warning("OfflineTradersTable[storeOffliner()]: Error while saving offline trader: " + pc.getObjectId() + " " + e);
|
||||
LOGGER.warning("OfflineTraderTable[storeOffliner()]: Error while saving offline trader: " + pc.getObjectId() + " " + e);
|
||||
}
|
||||
|
||||
stm.close();
|
||||
@@ -416,7 +415,7 @@ public class OfflineTradeTable
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LOGGER.warning("OfflineTradersTable[storeOffliner()]: Error while saving offline traders: " + e);
|
||||
LOGGER.warning("OfflineTraderTable[storeOffliner()]: Error while saving offline traders: " + e);
|
||||
}
|
||||
}
|
||||
}
|
@@ -18,11 +18,12 @@ package org.l2jmobius.gameserver.model;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.gameserver.data.ItemTable;
|
||||
import org.l2jmobius.gameserver.data.OfflineTradeTable;
|
||||
import org.l2jmobius.gameserver.data.sql.OfflineTraderTable;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.itemcontainer.PlayerInventory;
|
||||
import org.l2jmobius.gameserver.model.items.Item;
|
||||
@@ -157,7 +158,7 @@ public class TradeList
|
||||
|
||||
public TradeList(PlayerInstance owner)
|
||||
{
|
||||
_items = new ArrayList<>();
|
||||
_items = new CopyOnWriteArrayList<>();
|
||||
_owner = owner;
|
||||
}
|
||||
|
||||
@@ -1065,7 +1066,7 @@ public class TradeList
|
||||
|
||||
if (_owner.isInOfflineMode())
|
||||
{
|
||||
OfflineTradeTable.storeOffliner(_owner);
|
||||
OfflineTraderTable.storeOffliner(_owner);
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -1322,7 +1323,7 @@ public class TradeList
|
||||
|
||||
if (_owner.isInOfflineMode())
|
||||
{
|
||||
OfflineTradeTable.storeOffliner(_owner);
|
||||
OfflineTraderTable.storeOffliner(_owner);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@@ -315,7 +315,8 @@ public class World
|
||||
|
||||
if (!player.isTeleporting() && (tmp != null))
|
||||
{
|
||||
LOGGER.warning("Teleporting: Duplicate character!? Closing both characters (" + player.getName() + ")");
|
||||
// This can happen when offline system is enabled.
|
||||
// LOGGER.warning("Teleporting: Duplicate character!? Closing both characters (" + player.getName() + ")");
|
||||
player.closeNetConnection();
|
||||
tmp.closeNetConnection();
|
||||
return;
|
||||
|
@@ -39,9 +39,9 @@ import org.l2jmobius.commons.network.IIncomingPacket;
|
||||
import org.l2jmobius.commons.util.Chronos;
|
||||
import org.l2jmobius.gameserver.LoginServerThread;
|
||||
import org.l2jmobius.gameserver.LoginServerThread.SessionKey;
|
||||
import org.l2jmobius.gameserver.data.OfflineTradeTable;
|
||||
import org.l2jmobius.gameserver.data.SkillTable;
|
||||
import org.l2jmobius.gameserver.data.sql.ClanTable;
|
||||
import org.l2jmobius.gameserver.data.sql.OfflineTraderTable;
|
||||
import org.l2jmobius.gameserver.instancemanager.events.CTF;
|
||||
import org.l2jmobius.gameserver.instancemanager.events.DM;
|
||||
import org.l2jmobius.gameserver.instancemanager.events.GameEvent;
|
||||
@@ -484,8 +484,8 @@ public class GameClient extends ChannelInboundHandler<GameClient>
|
||||
PlayerInstance player = World.getInstance().getPlayer(objectId);
|
||||
if (player != null)
|
||||
{
|
||||
// exploit prevention, should not happens in normal way
|
||||
LOGGER.warning("Attempt of double login: " + player.getName() + "(" + objectId + ") " + _accountName);
|
||||
// This can happen when offline system is enabled.
|
||||
// LOGGER.warning("Attempt of double login: " + player.getName() + "(" + objectId + ") " + _accountName);
|
||||
|
||||
if (player.getClient() != null)
|
||||
{
|
||||
@@ -499,9 +499,9 @@ public class GameClient extends ChannelInboundHandler<GameClient>
|
||||
{
|
||||
player.store();
|
||||
}
|
||||
catch (Exception e2)
|
||||
catch (Exception e)
|
||||
{
|
||||
LOGGER.warning("fixme:unhandled exception " + e2);
|
||||
LOGGER.warning("GameClient: Count not store player. " + e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -634,8 +634,18 @@ public class GameClient extends ChannelInboundHandler<GameClient>
|
||||
player.decreaseBoxes();
|
||||
}
|
||||
|
||||
// prevent closing again
|
||||
player.setClient(null);
|
||||
|
||||
if ((player.isInStoreMode() && Config.OFFLINE_TRADE_ENABLE) //
|
||||
|| (player.isCrafting() && Config.OFFLINE_CRAFT_ENABLE))
|
||||
{
|
||||
if (!Config.OFFLINE_MODE_IN_PEACE_ZONE || (Config.OFFLINE_MODE_IN_PEACE_ZONE && player.isInsideZone(ZoneId.PEACE)))
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// prevent closing again
|
||||
player.deleteMe();
|
||||
player.store(true);
|
||||
}
|
||||
@@ -721,7 +731,7 @@ public class GameClient extends ChannelInboundHandler<GameClient>
|
||||
|
||||
if (Config.OFFLINE_MODE_SET_INVULNERABLE)
|
||||
{
|
||||
_player.setInvul(true);
|
||||
player.setInvul(true);
|
||||
}
|
||||
if (Config.OFFLINE_SET_NAME_COLOR)
|
||||
{
|
||||
@@ -735,7 +745,7 @@ public class GameClient extends ChannelInboundHandler<GameClient>
|
||||
player.setOfflineStartTime(Chronos.currentTimeMillis());
|
||||
}
|
||||
|
||||
OfflineTradeTable.storeOffliner(player);
|
||||
OfflineTraderTable.storeOffliner(player);
|
||||
World.OFFLINE_TRADE_COUNT++;
|
||||
return;
|
||||
}
|
||||
@@ -784,15 +794,6 @@ public class GameClient extends ChannelInboundHandler<GameClient>
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns false if client can receive packets. True if detached or queue overflow detected and queue still not empty.
|
||||
* @return
|
||||
*/
|
||||
public boolean dropPacket()
|
||||
{
|
||||
return _isDetached;
|
||||
}
|
||||
|
||||
public void setProtocolVersion(int version)
|
||||
{
|
||||
_protocolVersion = version;
|
||||
|
@@ -62,7 +62,7 @@ public class SetPrivateStoreListSell implements IClientIncomingPacket
|
||||
_items[(x * 3) + 2] = price;
|
||||
}
|
||||
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Reference in New Issue
Block a user