Author Topic: Interlude private store sell  (Read 312 times)

Offline juantakito

  • Vassal
  • *
  • Posts: 8
private store sell
« on: May 11, 2021, 02:59:30 PM »
Hello I wanted to inform that the private store to sell does not work and the offline store does not work either. Thank you for your attention.

Online Mobius

  • Administrator
  • Distinguished King
  • *****
  • Posts: 9422
Re: private store sell
« Reply #1 on: May 11, 2021, 05:24:16 PM »
Try this.
Code: [Select]
Index: java/org/l2jmobius/gameserver/network/clientpackets/SetPrivateStoreListSell.java
===================================================================
--- java/org/l2jmobius/gameserver/network/clientpackets/SetPrivateStoreListSell.java (revision 8553)
+++ java/org/l2jmobius/gameserver/network/clientpackets/SetPrivateStoreListSell.java (working copy)
@@ -62,7 +62,7 @@
  _items[(x * 3) + 2] = price;
  }
 
- return false;
+ return true;
  }
 
  @Override

Offline juantakito

  • Vassal
  • *
  • Posts: 8
Re: private store sell
« Reply #2 on: May 11, 2021, 06:11:23 PM »
Thank you for the quick response, we are very thankful  :slight_smile:

But offline shops are still not working.

ersTable[storeOffliner()]: Error while saving offline trader: 268478798 java.util.ConcurrentModificationException

Online Mobius

  • Administrator
  • Distinguished King
  • *****
  • Posts: 9422
Re: private store sell
« Reply #3 on: May 11, 2021, 11:44:57 PM »
Try this.
Code: [Select]
Index: java/org/l2jmobius/gameserver/model/TradeList.java
===================================================================
--- java/org/l2jmobius/gameserver/model/TradeList.java (revision 8585)
+++ java/org/l2jmobius/gameserver/model/TradeList.java (working copy)
@@ -18,6 +18,7 @@
 
 import java.util.ArrayList;
 import java.util.List;
+import java.util.concurrent.CopyOnWriteArrayList;
 import java.util.logging.Logger;
 
 import org.l2jmobius.Config;
@@ -157,7 +158,7 @@
 
  public TradeList(PlayerInstance owner)
  {
- _items = new ArrayList<>();
+ _items = new CopyOnWriteArrayList<>();
  _owner = owner;
  }
 
Index: java/org/l2jmobius/gameserver/network/GameClient.java
===================================================================
--- java/org/l2jmobius/gameserver/network/GameClient.java (revision 8585)
+++ java/org/l2jmobius/gameserver/network/GameClient.java (working copy)
@@ -634,6 +634,15 @@
  player.decreaseBoxes();
  }
 
+ 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.setClient(null);
  player.deleteMe();
@@ -721,7 +730,7 @@
 
  if (Config.OFFLINE_MODE_SET_INVULNERABLE)
  {
- _player.setInvul(true);
+ player.setInvul(true);
  }
  if (Config.OFFLINE_SET_NAME_COLOR)
  {
Index: java/org/l2jmobius/gameserver/network/clientpackets/SetPrivateStoreListSell.java
===================================================================
--- java/org/l2jmobius/gameserver/network/clientpackets/SetPrivateStoreListSell.java (revision 8553)
+++ java/org/l2jmobius/gameserver/network/clientpackets/SetPrivateStoreListSell.java (working copy)
@@ -62,7 +62,7 @@
  _items[(x * 3) + 2] = price;
  }
 
- return false;
+ return true;
  }
 
  @Override

Offline juantakito

  • Vassal
  • *
  • Posts: 8
Re: private store sell
« Reply #4 on: May 12, 2021, 12:40:24 PM »
Thanks for the quick reply

The stores work correctly, the only thing that it detects is that when subtracting from the server, the offline stores do not load them and it gives the following error.


 OfflineTradersTable[loadOffliners()]: Error loading trader: java.lang.NullPointerException: Cannot invoke "io.netty.channel.Channel.attr(io.netty.util.AttributeKey)" because "this._channel" is null
[12/05 11:33:53] OfflineTradersTable[loadOffliners()]: Error loading trader: java.lang.NullPointerException: Cannot invoke "io.netty.channel.Channel.attr(io.netty.util.AttributeKey)" because "this._channel" is null
[12/05 11:33:53] OfflineTradersTable[loadOffliners()]: Error loading trader: java.lang.NullPointerException: Cannot invoke "io.netty.channel.Channel.attr(io.netty.util.AttributeKey)" because "this._channel" is null
[12/05 11:33:53] OfflineTradersTable[loadOffliners()]: Error loading trader: java.lang.NullPointerException: Cannot invoke "io.netty.channel.Channel.attr(io.netty.util.AttributeKey)" because "this._channel" is null
[12/05 11:33:53] OfflineTradersTable[loadOffliners()]: Error loading trader: java.lang.NullPointerException: Cannot invoke "io.netty.channel.Channel.attr(io.netty.util.AttributeKey)" because "this._channel" is null
[12/05 11:33:53] OfflineTradersTable[loadOffliners()]: Error loading trader: java.lang.NullPointerException: Cannot invoke "io.netty.channel.Channel.attr(io.netty.util.AttributeKey)" because "this._channel" is null

Online Mobius

  • Administrator
  • Distinguished King
  • *****
  • Posts: 9422
Re: private store sell
« Reply #5 on: May 12, 2021, 02:31:53 PM »
New patch.
Code: [Select]
Index: java/org/l2jmobius/gameserver/data/OfflineTradeTable.java
===================================================================
--- java/org/l2jmobius/gameserver/data/OfflineTradeTable.java (revision 8553)
+++ java/org/l2jmobius/gameserver/data/OfflineTradeTable.java (working copy)
@@ -32,7 +32,6 @@
 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;
 
 /**
@@ -205,7 +204,6 @@
  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);
Index: java/org/l2jmobius/gameserver/model/TradeList.java
===================================================================
--- java/org/l2jmobius/gameserver/model/TradeList.java (revision 8585)
+++ java/org/l2jmobius/gameserver/model/TradeList.java (working copy)
@@ -18,6 +18,7 @@
 
 import java.util.ArrayList;
 import java.util.List;
+import java.util.concurrent.CopyOnWriteArrayList;
 import java.util.logging.Logger;
 
 import org.l2jmobius.Config;
@@ -157,7 +158,7 @@
 
  public TradeList(PlayerInstance owner)
  {
- _items = new ArrayList<>();
+ _items = new CopyOnWriteArrayList<>();
  _owner = owner;
  }
 
Index: java/org/l2jmobius/gameserver/network/GameClient.java
===================================================================
--- java/org/l2jmobius/gameserver/network/GameClient.java (revision 8585)
+++ java/org/l2jmobius/gameserver/network/GameClient.java (working copy)
@@ -241,7 +241,7 @@
 
  public void sendPacket(IClientOutgoingPacket packet)
  {
- if (_isDetached || (packet == null))
+ if (_isDetached || (packet == null) || (_channel == null))
  {
  return;
  }
@@ -634,6 +634,15 @@
  player.decreaseBoxes();
  }
 
+ 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.setClient(null);
  player.deleteMe();
@@ -721,7 +730,7 @@
 
  if (Config.OFFLINE_MODE_SET_INVULNERABLE)
  {
- _player.setInvul(true);
+ player.setInvul(true);
  }
  if (Config.OFFLINE_SET_NAME_COLOR)
  {
Index: java/org/l2jmobius/gameserver/network/clientpackets/SetPrivateStoreListSell.java
===================================================================
--- java/org/l2jmobius/gameserver/network/clientpackets/SetPrivateStoreListSell.java (revision 8553)
+++ java/org/l2jmobius/gameserver/network/clientpackets/SetPrivateStoreListSell.java (working copy)
@@ -62,7 +62,7 @@
  _items[(x * 3) + 2] = price;
  }
 
- return false;
+ return true;
  }
 
  @Override

Offline juantakito

  • Vassal
  • *
  • Posts: 8
Re: private store sell
« Reply #6 on: May 12, 2021, 05:07:07 PM »
Thank you,
but what I saw if the server is restarted gives the following error without being able to enter the server with the pj that was in the offline store.


[12/05 16:03:30] Attempt of double login: sdaa(268477670) paco
[12/05 16:03:32] Teleporting: Duplicate character!? Closing both characters (sdaa)


Online Mobius

  • Administrator
  • Distinguished King
  • *****
  • Posts: 9422
Re: private store sell
« Reply #7 on: May 12, 2021, 05:11:23 PM »
That did not happen for me.
Will look when I get some free time.

Offline juantakito

  • Vassal
  • *
  • Posts: 8
Re: private store sell
« Reply #8 on: May 12, 2021, 06:00:24 PM »

ok when you can thanks

Online Mobius

  • Administrator
  • Distinguished King
  • *****
  • Posts: 9422
Re: private store sell
« Reply #9 on: May 12, 2021, 10:30:37 PM »
New patch.
Hopefully final.
Code: [Select]
Index: java/org/l2jmobius/gameserver/LoginServerThread.java
===================================================================
--- java/org/l2jmobius/gameserver/LoginServerThread.java (revision 8553)
+++ java/org/l2jmobius/gameserver/LoginServerThread.java (working copy)
@@ -262,8 +262,7 @@
  {
  playerList.add(player.getAccountName());
  }
- final PlayerInGame pig = new PlayerInGame(playerList);
- sendPacket(pig);
+ sendPacket(new PlayerInGame(playerList));
  }
  break;
  }
@@ -464,9 +463,10 @@
 
  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);
  }
  }
Index: java/org/l2jmobius/gameserver/data/OfflineTradeTable.java
===================================================================
--- java/org/l2jmobius/gameserver/data/OfflineTradeTable.java (revision 8553)
+++ java/org/l2jmobius/gameserver/data/OfflineTradeTable.java (working copy)
@@ -32,7 +32,6 @@
 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;
 
 /**
@@ -202,10 +201,10 @@
  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);
Index: java/org/l2jmobius/gameserver/model/TradeList.java
===================================================================
--- java/org/l2jmobius/gameserver/model/TradeList.java (revision 8585)
+++ java/org/l2jmobius/gameserver/model/TradeList.java (working copy)
@@ -18,6 +18,7 @@
 
 import java.util.ArrayList;
 import java.util.List;
+import java.util.concurrent.CopyOnWriteArrayList;
 import java.util.logging.Logger;
 
 import org.l2jmobius.Config;
@@ -157,7 +158,7 @@
 
  public TradeList(PlayerInstance owner)
  {
- _items = new ArrayList<>();
+ _items = new CopyOnWriteArrayList<>();
  _owner = owner;
  }
 
Index: java/org/l2jmobius/gameserver/model/World.java
===================================================================
--- java/org/l2jmobius/gameserver/model/World.java (revision 8553)
+++ java/org/l2jmobius/gameserver/model/World.java (working copy)
@@ -315,7 +315,7 @@
 
  if (!player.isTeleporting() && (tmp != null))
  {
- LOGGER.warning("Teleporting: Duplicate character!? Closing both characters (" + player.getName() + ")");
+ // LOGGER.warning("Teleporting: Duplicate character!? Closing both characters (" + player.getName() + ")");
  player.closeNetConnection();
  tmp.closeNetConnection();
  return;
Index: java/org/l2jmobius/gameserver/network/GameClient.java
===================================================================
--- java/org/l2jmobius/gameserver/network/GameClient.java (revision 8585)
+++ java/org/l2jmobius/gameserver/network/GameClient.java (working copy)
@@ -634,8 +634,18 @@
  player.decreaseBoxes();
  }
 
+ 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.setClient(null);
  player.deleteMe();
  player.store(true);
  }
@@ -721,7 +731,7 @@
 
  if (Config.OFFLINE_MODE_SET_INVULNERABLE)
  {
- _player.setInvul(true);
+ player.setInvul(true);
  }
  if (Config.OFFLINE_SET_NAME_COLOR)
  {
@@ -784,15 +794,6 @@
  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;
Index: java/org/l2jmobius/gameserver/network/clientpackets/SetPrivateStoreListSell.java
===================================================================
--- java/org/l2jmobius/gameserver/network/clientpackets/SetPrivateStoreListSell.java (revision 8553)
+++ java/org/l2jmobius/gameserver/network/clientpackets/SetPrivateStoreListSell.java (working copy)
@@ -62,7 +62,7 @@
  _items[(x * 3) + 2] = price;
  }
 
- return false;
+ return true;
  }
 
  @Override

Offline juantakito

  • Vassal
  • *
  • Posts: 8
Re: private store sell
« Reply #10 on: May 13, 2021, 12:39:13 AM »
I'm sorry but it still gives me a failure, I can't enter after resetting the server


error
[12/05 23:35:18] Attempt of double login: SoyGrande(268477686) coco
[12/05 23:35:41] Attempt of double login: SoyGrande(268477686) coco

Online Mobius

  • Administrator
  • Distinguished King
  • *****
  • Posts: 9422
Re: private store sell
« Reply #11 on: May 13, 2021, 01:10:12 AM »
Remove that log.
Apparently it can happen when offline mode is enabled.
There is no exploit when character gets disconnected.

Offline juantakito

  • Vassal
  • *
  • Posts: 8
Re: private store sell
« Reply #12 on: May 13, 2021, 01:56:45 AM »
I'm sorry, my fault works correctly, thank you  :) :)

Online Mobius

  • Administrator
  • Distinguished King
  • *****
  • Posts: 9422