Jump to content
  • 0

Gold Bars in Private Store (Buy/Sell)


Question

Posted

Hello, in some servers I have seen that private stores made by players use gold bars instead of adena as the currency. How can I do this? Is there a patch available?

8 answers to this question

Recommended Posts

  • 0
Posted

Hello, in some servers I have seen that private stores made by players use gold bars instead of adena as the currency. How can I do this? Is there a patch available?

Which client?

  • 0
Posted

I will be willing to pay someone to get this working.

 

dont worry, you dont have to buy anything, I will code it as soon as I go home, cause now Im from the phone

 

dont waste ur money ;)

  • 0
Posted

here is your code:

### Eclipse Workspace Patch 1.0
#P aCis_gameserver
Index: java/net/sf/l2j/gameserver/network/serverpackets/PrivateStoreListBuy.java
===================================================================
--- java/net/sf/l2j/gameserver/network/serverpackets/PrivateStoreListBuy.java	(revision 42)
+++ java/net/sf/l2j/gameserver/network/serverpackets/PrivateStoreListBuy.java	(working copy)
@@ -28,7 +28,7 @@
	{
		_storePlayer = storePlayer;
		_activeChar = player;
-		_playerAdena = _activeChar.getAdena();
+		_playerAdena = _activeChar.getInventory().getItemByItemId(3470)==null?0:_activeChar.getInventory().getItemByItemId(3470).getCount();
		_storePlayer.getSellList().updateItems(); // Update SellList for case inventory content has changed
		_items = _storePlayer.getBuyList().getAvailableItems(_activeChar.getInventory());
	}
### Eclipse Workspace Patch 1.0
#P aCis_gameserver
Index: java/net/sf/l2j/gameserver/network/serverpackets/PrivateStoreListSell.java
===================================================================
--- java/net/sf/l2j/gameserver/network/serverpackets/PrivateStoreListSell.java	(revision 42)
+++ java/net/sf/l2j/gameserver/network/serverpackets/PrivateStoreListSell.java	(working copy)
@@ -30,7 +30,7 @@
	{
		_activeChar = player;
		_storePlayer = storePlayer;
-		_playerAdena = _activeChar.getAdena();
+		_playerAdena = _activeChar.getInventory().getItemByItemId(3470)==null?0:_activeChar.getInventory().getItemByItemId(3470).getCount();
		_items = _storePlayer.getSellList().getItems();
		_packageSale = _storePlayer.getSellList().isPackaged();
	}
### Eclipse Workspace Patch 1.0
#P aCis_gameserver
Index: java/net/sf/l2j/gameserver/network/serverpackets/PrivateStoreManageListBuy.java
===================================================================
--- java/net/sf/l2j/gameserver/network/serverpackets/PrivateStoreManageListBuy.java	(revision 42)
+++ java/net/sf/l2j/gameserver/network/serverpackets/PrivateStoreManageListBuy.java	(working copy)
@@ -28,7 +28,7 @@
	public PrivateStoreManageListBuy(L2PcInstance player)
	{
		_objId = player.getObjectId();
-		_playerAdena = player.getAdena();
+		_playerAdena = player.getInventory().getItemByItemId(3470)==null?0:player.getInventory().getItemByItemId(3470).getCount();
		_itemList = player.getInventory().getUniqueItems(false, true);
		_buyList = player.getBuyList().getItems();
	}
### Eclipse Workspace Patch 1.0
#P aCis_gameserver
Index: java/net/sf/l2j/gameserver/network/serverpackets/PrivateStoreManageListSell.java
===================================================================
--- java/net/sf/l2j/gameserver/network/serverpackets/PrivateStoreManageListSell.java	(revision 42)
+++ java/net/sf/l2j/gameserver/network/serverpackets/PrivateStoreManageListSell.java	(working copy)
@@ -31,7 +31,7 @@
	public PrivateStoreManageListSell(L2PcInstance player, boolean isPackageSale)
	{
		_objId = player.getObjectId();
-		_playerAdena = player.getAdena();
+		_playerAdena = player.getInventory().getItemByItemId(3470)==null?0:player.getInventory().getItemByItemId(3470).getCount();
		player.getSellList().updateItems();
		_packageSale = isPackageSale;
		_itemList = player.getInventory().getAvailableItems(player.getSellList());
### Eclipse Workspace Patch 1.0
#P aCis_gameserver
Index: java/net/sf/l2j/gameserver/model/TradeList.java
===================================================================
--- java/net/sf/l2j/gameserver/model/TradeList.java	(revision 42)
+++ java/net/sf/l2j/gameserver/model/TradeList.java	(working copy)
@@ -759,10 +759,10 @@
			else if (playerInventory.getItemByItemId(item.getItemId()) == null)
				slots++;
		}
-		
-		if (totalPrice > playerInventory.getAdena())
+		int gbcount=playerInventory.getItemByItemId(3470)==null?0:playerInventory.getItemByItemId(3470).getCount();
+		if (totalPrice > gbcount)
		{
-			player.sendPacket(SystemMessageId.YOU_NOT_ENOUGH_ADENA);
+			player.sendMessage("Incorrect item count");
			return 1;
		}

@@ -782,15 +782,11 @@
		final InventoryUpdate ownerIU = new InventoryUpdate();
		final InventoryUpdate playerIU = new InventoryUpdate();

-		final L2ItemInstance adenaItem = playerInventory.getAdenaInstance();
-		if (!playerInventory.reduceAdena("PrivateStore", totalPrice, player, _owner))
-		{
-			player.sendPacket(SystemMessageId.YOU_NOT_ENOUGH_ADENA);
-			return 1;
-		}
+		final L2ItemInstance adenaItem = playerInventory.getItemByItemId(3470);

		playerIU.addItem(adenaItem);
-		ownerInventory.addAdena("PrivateStore", totalPrice, _owner, player);
+		ownerInventory.addItem("PrivateStore", 3470, totalPrice, player, null);
+		ownerInventory.destroyItem("PrivateStore", adenaItem, totalPrice, player, null);

		boolean ok = true;

@@ -932,7 +928,7 @@
				break;
			}

-			if (ownerInventory.getAdena() < _totalPrice)
+			if (ownerInventory.getItemByItemId(3470).getCount() < _totalPrice)
				continue;

			// TODO: eventually test and fix this.
@@ -1015,15 +1011,16 @@
		// Transfer adena
		if (totalPrice > 0)
		{
-			if (totalPrice > ownerInventory.getAdena())
+			int gbcount=ownerInventory.getItemByItemId(3470)==null?0:playerInventory.getItemByItemId(3470).getCount();
+			if (totalPrice > gbcount)
				return false;

-			final L2ItemInstance adenaItem = ownerInventory.getAdenaInstance();
-			ownerInventory.reduceAdena("PrivateStore", totalPrice, _owner, player);
+			final L2ItemInstance adenaItem = ownerInventory.getItemByItemId(3470);
+			playerInventory.destroyItem("PrivateStore", adenaItem, totalPrice, _owner, null);
			ownerIU.addItem(adenaItem);

-			playerInventory.addAdena("PrivateStore", totalPrice, player, _owner);
-			playerIU.addItem(playerInventory.getAdenaInstance());
+			ownerInventory.addItem("PrivateStore", 3470, totalPrice, player, null);
+			playerIU.addItem(playerInventory.getItemByItemId(3470));
		}

		if (ok)

 

Its handwritten and not tested, but im 95% sure that you wont have any problems

 

PS: Coded on aCis (it will be very similar with freya since aCis is based on freya)

PS2: I used the Gold Bar 3470 as ID, feel free to change it with replace all ;)

 

PS3: Dont test on live server ;D

Guest
This topic is now closed to further replies.


×
×
  • Create New...