Jump to content
  • 0

[L2J H5] Change Currency Used In The Mailing System And Private Shops.


Silverwind

Question

2 answers to this question

Recommended Posts

  • 0

for buy-sell stores

### Eclipse Workspace Patch 1.0
#P Core
Index: java/l2j/gabbs/gameserver/network/serverpackets/PrivateStoreListBuy.java
===================================================================
--- java/l2j/gabbs/gameserver/network/serverpackets/PrivateStoreListBuy.java (revision 17)
+++ java/l2j/gabbs/gameserver/network/serverpackets/PrivateStoreListBuy.java (working copy)
@@ -34,7 +34,7 @@
public PrivateStoreListBuy(L2PcInstance player, L2PcInstance storePlayer)
{
_objId = storePlayer.getObjectId();
- _playerAdena = player.getAdena();
+ _playerAdena = player.getBuyStoreCurrency();
storePlayer.getSellList().updateItems(); // Update SellList for case inventory content has changed
_items = storePlayer.getBuyList().getAvailableItems(player.getInventory());
}
Index: java/l2j/gabbs/gameserver/network/serverpackets/PrivateStoreListSell.java
===================================================================
--- java/l2j/gabbs/gameserver/network/serverpackets/PrivateStoreListSell.java (revision 17)
+++ java/l2j/gabbs/gameserver/network/serverpackets/PrivateStoreListSell.java (working copy)
@@ -31,7 +31,7 @@
public PrivateStoreListSell(L2PcInstance player, L2PcInstance storePlayer)
{
_objId = storePlayer.getObjectId();
- _playerAdena = player.getAdena();
+ _playerAdena = player.getSellStoreCurrency();
_items = storePlayer.getSellList().getItems();
_packageSale = storePlayer.getSellList().isPackaged();
}
Index: java/l2j/gabbs/gameserver/network/serverpackets/PrivateStoreManageListBuy.java
===================================================================
--- java/l2j/gabbs/gameserver/network/serverpackets/PrivateStoreManageListBuy.java (revision 17)
+++ java/l2j/gabbs/gameserver/network/serverpackets/PrivateStoreManageListBuy.java (working copy)
@@ -32,7 +32,7 @@
public PrivateStoreManageListBuy(L2PcInstance player)
{
_objId = player.getObjectId();
- _playerAdena = player.getAdena();
+ _playerAdena = player.getBuyStoreCurrency();
_itemList = player.getInventory().getUniqueItems(false, true);
_buyList = player.getBuyList().getItems();
}
Index: java/l2j/gabbs/gameserver/model/itemcontainer/PcInventory.java
===================================================================
--- java/l2j/gabbs/gameserver/model/itemcontainer/PcInventory.java (revision 17)
+++ java/l2j/gabbs/gameserver/model/itemcontainer/PcInventory.java (working copy)
@@ -25,7 +25,6 @@
import java.util.logging.Logger;
 
import javolution.util.FastList;
-
import l2j.gabbs.Config;
import l2j.gabbs.L2DatabaseFactory;
import l2j.gabbs.gameserver.datatables.ItemTable;
@@ -141,14 +140,19 @@
{
continue;
}
- if ((!allowAdena && (item.getItemId() == ADENA_ID)))
+ final int itemId = item.getItemId();
+ if ((!allowAdena && (itemId == ADENA_ID)))
{
continue;
}
- if ((!allowAncientAdena && (item.getItemId() == ANCIENT_ADENA_ID)))
+ if ((!allowAncientAdena && (itemId == ANCIENT_ADENA_ID)))
{
continue;
}
+ if (itemId == Config.STORE_BUY_CURRENCY)
+ {
+ continue;
+ }
boolean isDuplicate = false;
for (L2ItemInstance litem : list)
{
Index: java/l2j/gabbs/gameserver/model/actor/instance/L2PcInstance.java
===================================================================
--- java/l2j/gabbs/gameserver/model/actor/instance/L2PcInstance.java (revision 40)
+++ java/l2j/gabbs/gameserver/model/actor/instance/L2PcInstance.java (working copy)
@@ -6375,6 +6375,25 @@
}
 
/**
+ * TODO: Private Story Currency variables
+ * @author ThiagoPrati
+ * @return
+ */
+ public synchronized long getBuyStoreCurrency()
+ {
+ L2ItemInstance item = this.getInventory().getItemByItemId(Config.STORE_BUY_CURRENCY);
+
+ return item == null ? 0 : item.getCount();
+ }
+
+ public synchronized long getSellStoreCurrency()
+ {
+ L2ItemInstance item = this.getInventory().getItemByItemId(Config.STORE_SELL_CURRENCY);
+
+ return item == null ? 0 : item.getCount();
+ }
+
+ /**
* TODO: Unhardcode by implementing Lucky effect (Support for effects on passive skills required).
* @return Returns {@code true} if player has Lucky skill and is level 9 or less.
*/
Index: java/l2j/gabbs/Config.java
===================================================================
--- java/l2j/gabbs/Config.java (revision 47)
+++ java/l2j/gabbs/Config.java (working copy)
@@ -799,6 +799,8 @@
// --------------------------------------------------
// Custom Settings
// --------------------------------------------------
+ public static int STORE_BUY_CURRENCY;
+ public static int STORE_SELL_CURRENCY;
 
// --------------------------------------------------
// NPC Settings
@@ -2802,6 +2804,8 @@
{
_log.log(Level.SEVERE, "Error while loading gabbs settings!", e);
}
+ STORE_BUY_CURRENCY = Integer.parseInt(gabbs.getProperty("PrivateStoreBuyMoneda", "57"));
+ STORE_SELL_CURRENCY = Integer.parseInt(gabbs.getProperty("PrivateStoreSellMoneda", "57"));
 
// Load Olympiad L2Properties file (if exists)
final File oly = new File(OLYMPIAD_CONFIG_FILE);
Index: dist/game/config/InGame/Custom.properties
===================================================================
--- dist/game/config/InGame/Custom.properties (revision 47)
+++ dist/game/config/InGame/Custom.properties (working copy)
@@ -2,4 +2,12 @@
# Custom - non-retail-like systems that have been integrated into the L2J project.
# Be warned that there may be no support for these mods beyond the original author's assistance.
# ---------------------------------------------------------------------------
+# Private Store Buy/Sell - Trade Item
+# ---------------------------------------------------------------------------
+# Choose the item for use in the Private Store Buy (Yellow)
+# Retail: 57
+PrivateStoreBuyMoneda = 57
 
+# Choose the item for use in the Private Store Sell (Purple)
+# Retail: 57
+PrivateStoreSellMoneda = 57
\ No newline at end of file
Index: java/l2j/gabbs/gameserver/network/serverpackets/PrivateStoreManageListSell.java
===================================================================
--- java/l2j/gabbs/gameserver/network/serverpackets/PrivateStoreManageListSell.java (revision 17)
+++ java/l2j/gabbs/gameserver/network/serverpackets/PrivateStoreManageListSell.java (working copy)
@@ -32,7 +32,7 @@
public PrivateStoreManageListSell(L2PcInstance player, boolean isPackageSale)
{
_objId = player.getObjectId();
- _playerAdena = player.getAdena();
+ _playerAdena = player.getSellStoreCurrency();
player.getSellList().updateItems();
_packageSale = isPackageSale;
_itemList = player.getInventory().getAvailableItems(player.getSellList());
Index: java/l2j/gabbs/gameserver/network/clientpackets/SetPrivateStoreListBuy.java
===================================================================
--- java/l2j/gabbs/gameserver/network/clientpackets/SetPrivateStoreListBuy.java (revision 17)
+++ java/l2j/gabbs/gameserver/network/clientpackets/SetPrivateStoreListBuy.java (working copy)
@@ -19,7 +19,6 @@
package l2j.gabbs.gameserver.network.clientpackets;
 
import static l2j.gabbs.gameserver.model.itemcontainer.PcInventory.MAX_ADENA;
-
import l2j.gabbs.Config;
import l2j.gabbs.gameserver.model.TradeList;
import l2j.gabbs.gameserver.model.actor.instance.L2PcInstance;
@@ -143,7 +142,7 @@
}
 
// Check for available funds
- if (totalCost > player.getAdena())
+ if (totalCost > player.getBuyStoreCurrency())
{
player.sendPacket(new PrivateStoreManageListBuy(player));
player.sendPacket(SystemMessageId.THE_PURCHASE_PRICE_IS_HIGHER_THAN_MONEY);
Index: java/l2j/gabbs/gameserver/model/TradeList.java
===================================================================
--- java/l2j/gabbs/gameserver/model/TradeList.java (revision 17)
+++ java/l2j/gabbs/gameserver/model/TradeList.java (working copy)
@@ -25,7 +25,6 @@
 
import javolution.util.FastList;
import javolution.util.FastSet;
-
import l2j.gabbs.Config;
import l2j.gabbs.gameserver.datatables.ItemTable;
import l2j.gabbs.gameserver.model.actor.instance.L2PcInstance;
@@ -771,9 +770,10 @@
}
}
 
- if (totalPrice > playerInventory.getAdena())
+ if (totalPrice > player.getBuyStoreCurrency())
{
- player.sendPacket(SystemMessageId.YOU_NOT_ENOUGH_ADENA);
+ final String name = ItemTable.getInstance().getTemplate(Config.STORE_BUY_CURRENCY).getName();
+ player.sendMessage("You dont have enough " + name);
return 1;
}
 
@@ -793,15 +793,16 @@
final InventoryUpdate ownerIU = new InventoryUpdate();
final InventoryUpdate playerIU = new InventoryUpdate();
 
- final L2ItemInstance adenaItem = playerInventory.getAdenaInstance();
- if (!playerInventory.reduceAdena("PrivateStore", totalPrice, player, _owner))
+ final int moneda = Config.STORE_BUY_CURRENCY;
+ final L2ItemInstance adenaItem = playerInventory.getItemByItemId(moneda);
+ if (!player.destroyItemByItemId("PrivateStore", moneda, totalPrice, _owner, true))
{
player.sendPacket(SystemMessageId.YOU_NOT_ENOUGH_ADENA);
return 1;
}
playerIU.addItem(adenaItem);
- ownerInventory.addAdena("PrivateStore", totalPrice, _owner, player);
- // ownerIU.addItem(ownerInventory.getAdenaInstance());
+ ownerInventory.addItem("PrivateStore", moneda, totalPrice, _owner, player);
+ ownerIU.addItem(ownerInventory.getItemByItemId(moneda));
 
boolean ok = true;
 
@@ -962,7 +963,7 @@
break;
}
 
- if (ownerInventory.getAdena() < _totalPrice)
+ if (_owner.getSellStoreCurrency() < _totalPrice)
{
continue;
}
@@ -1065,11 +1066,12 @@
// should not happens, just a precaution
return false;
}
- final L2ItemInstance adenaItem = ownerInventory.getAdenaInstance();
- ownerInventory.reduceAdena("PrivateStore", totalPrice, _owner, player);
+ final int moneda = Config.STORE_SELL_CURRENCY;
+ final L2ItemInstance adenaItem = ownerInventory.getItemByItemId(moneda);
+ ownerInventory.destroyItemByItemId("PrivateStore", moneda, totalPrice, _owner, player);
ownerIU.addItem(adenaItem);
- playerInventory.addAdena("PrivateStore", totalPrice, player, _owner);
- playerIU.addItem(playerInventory.getAdenaInstance());
+ playerInventory.addItem("PrivateStore", moneda, totalPrice, player, _owner);
+ playerIU.addItem(playerInventory.getItemByItemId(moneda));
}
 
if (ok)

Mark as solved if it helped you. 
Link to comment
Share on other sites

  • 0

 

for buy-sell stores

### Eclipse Workspace Patch 1.0
#P Core
Index: java/l2j/gabbs/gameserver/network/serverpackets/PrivateStoreListBuy.java
===================================================================
--- java/l2j/gabbs/gameserver/network/serverpackets/PrivateStoreListBuy.java (revision 17)
+++ java/l2j/gabbs/gameserver/network/serverpackets/PrivateStoreListBuy.java (working copy)
@@ -34,7 +34,7 @@
public PrivateStoreListBuy(L2PcInstance player, L2PcInstance storePlayer)
{
_objId = storePlayer.getObjectId();
- _playerAdena = player.getAdena();
+ _playerAdena = player.getBuyStoreCurrency();
storePlayer.getSellList().updateItems(); // Update SellList for case inventory content has changed
_items = storePlayer.getBuyList().getAvailableItems(player.getInventory());
}
Index: java/l2j/gabbs/gameserver/network/serverpackets/PrivateStoreListSell.java
===================================================================
--- java/l2j/gabbs/gameserver/network/serverpackets/PrivateStoreListSell.java (revision 17)
+++ java/l2j/gabbs/gameserver/network/serverpackets/PrivateStoreListSell.java (working copy)
@@ -31,7 +31,7 @@
public PrivateStoreListSell(L2PcInstance player, L2PcInstance storePlayer)
{
_objId = storePlayer.getObjectId();
- _playerAdena = player.getAdena();
+ _playerAdena = player.getSellStoreCurrency();
_items = storePlayer.getSellList().getItems();
_packageSale = storePlayer.getSellList().isPackaged();
}
Index: java/l2j/gabbs/gameserver/network/serverpackets/PrivateStoreManageListBuy.java
===================================================================
--- java/l2j/gabbs/gameserver/network/serverpackets/PrivateStoreManageListBuy.java (revision 17)
+++ java/l2j/gabbs/gameserver/network/serverpackets/PrivateStoreManageListBuy.java (working copy)
@@ -32,7 +32,7 @@
public PrivateStoreManageListBuy(L2PcInstance player)
{
_objId = player.getObjectId();
- _playerAdena = player.getAdena();
+ _playerAdena = player.getBuyStoreCurrency();
_itemList = player.getInventory().getUniqueItems(false, true);
_buyList = player.getBuyList().getItems();
}
Index: java/l2j/gabbs/gameserver/model/itemcontainer/PcInventory.java
===================================================================
--- java/l2j/gabbs/gameserver/model/itemcontainer/PcInventory.java (revision 17)
+++ java/l2j/gabbs/gameserver/model/itemcontainer/PcInventory.java (working copy)
@@ -25,7 +25,6 @@
import java.util.logging.Logger;
 
import javolution.util.FastList;
-
import l2j.gabbs.Config;
import l2j.gabbs.L2DatabaseFactory;
import l2j.gabbs.gameserver.datatables.ItemTable;
@@ -141,14 +140,19 @@
{
continue;
}
- if ((!allowAdena && (item.getItemId() == ADENA_ID)))
+ final int itemId = item.getItemId();
+ if ((!allowAdena && (itemId == ADENA_ID)))
{
continue;
}
- if ((!allowAncientAdena && (item.getItemId() == ANCIENT_ADENA_ID)))
+ if ((!allowAncientAdena && (itemId == ANCIENT_ADENA_ID)))
{
continue;
}
+ if (itemId == Config.STORE_BUY_CURRENCY)
+ {
+ continue;
+ }
boolean isDuplicate = false;
for (L2ItemInstance litem : list)
{
Index: java/l2j/gabbs/gameserver/model/actor/instance/L2PcInstance.java
===================================================================
--- java/l2j/gabbs/gameserver/model/actor/instance/L2PcInstance.java (revision 40)
+++ java/l2j/gabbs/gameserver/model/actor/instance/L2PcInstance.java (working copy)
@@ -6375,6 +6375,25 @@
}
 
/**
+ * TODO: Private Story Currency variables
+ * @author ThiagoPrati
+ * @return
+ */
+ public synchronized long getBuyStoreCurrency()
+ {
+ L2ItemInstance item = this.getInventory().getItemByItemId(Config.STORE_BUY_CURRENCY);
+
+ return item == null ? 0 : item.getCount();
+ }
+
+ public synchronized long getSellStoreCurrency()
+ {
+ L2ItemInstance item = this.getInventory().getItemByItemId(Config.STORE_SELL_CURRENCY);
+
+ return item == null ? 0 : item.getCount();
+ }
+
+ /**
* TODO: Unhardcode by implementing Lucky effect (Support for effects on passive skills required).
* @return Returns {@code true} if player has Lucky skill and is level 9 or less.
*/
Index: java/l2j/gabbs/Config.java
===================================================================
--- java/l2j/gabbs/Config.java (revision 47)
+++ java/l2j/gabbs/Config.java (working copy)
@@ -799,6 +799,8 @@
// --------------------------------------------------
// Custom Settings
// --------------------------------------------------
+ public static int STORE_BUY_CURRENCY;
+ public static int STORE_SELL_CURRENCY;
 
// --------------------------------------------------
// NPC Settings
@@ -2802,6 +2804,8 @@
{
_log.log(Level.SEVERE, "Error while loading gabbs settings!", e);
}
+ STORE_BUY_CURRENCY = Integer.parseInt(gabbs.getProperty("PrivateStoreBuyMoneda", "57"));
+ STORE_SELL_CURRENCY = Integer.parseInt(gabbs.getProperty("PrivateStoreSellMoneda", "57"));
 
// Load Olympiad L2Properties file (if exists)
final File oly = new File(OLYMPIAD_CONFIG_FILE);
Index: dist/game/config/InGame/Custom.properties
===================================================================
--- dist/game/config/InGame/Custom.properties (revision 47)
+++ dist/game/config/InGame/Custom.properties (working copy)
@@ -2,4 +2,12 @@
# Custom - non-retail-like systems that have been integrated into the L2J project.
# Be warned that there may be no support for these mods beyond the original author's assistance.
# ---------------------------------------------------------------------------
+# Private Store Buy/Sell - Trade Item
+# ---------------------------------------------------------------------------
+# Choose the item for use in the Private Store Buy (Yellow)
+# Retail: 57
+PrivateStoreBuyMoneda = 57
 
+# Choose the item for use in the Private Store Sell (Purple)
+# Retail: 57
+PrivateStoreSellMoneda = 57
\ No newline at end of file
Index: java/l2j/gabbs/gameserver/network/serverpackets/PrivateStoreManageListSell.java
===================================================================
--- java/l2j/gabbs/gameserver/network/serverpackets/PrivateStoreManageListSell.java (revision 17)
+++ java/l2j/gabbs/gameserver/network/serverpackets/PrivateStoreManageListSell.java (working copy)
@@ -32,7 +32,7 @@
public PrivateStoreManageListSell(L2PcInstance player, boolean isPackageSale)
{
_objId = player.getObjectId();
- _playerAdena = player.getAdena();
+ _playerAdena = player.getSellStoreCurrency();
player.getSellList().updateItems();
_packageSale = isPackageSale;
_itemList = player.getInventory().getAvailableItems(player.getSellList());
Index: java/l2j/gabbs/gameserver/network/clientpackets/SetPrivateStoreListBuy.java
===================================================================
--- java/l2j/gabbs/gameserver/network/clientpackets/SetPrivateStoreListBuy.java (revision 17)
+++ java/l2j/gabbs/gameserver/network/clientpackets/SetPrivateStoreListBuy.java (working copy)
@@ -19,7 +19,6 @@
package l2j.gabbs.gameserver.network.clientpackets;
 
import static l2j.gabbs.gameserver.model.itemcontainer.PcInventory.MAX_ADENA;
-
import l2j.gabbs.Config;
import l2j.gabbs.gameserver.model.TradeList;
import l2j.gabbs.gameserver.model.actor.instance.L2PcInstance;
@@ -143,7 +142,7 @@
}
 
// Check for available funds
- if (totalCost > player.getAdena())
+ if (totalCost > player.getBuyStoreCurrency())
{
player.sendPacket(new PrivateStoreManageListBuy(player));
player.sendPacket(SystemMessageId.THE_PURCHASE_PRICE_IS_HIGHER_THAN_MONEY);
Index: java/l2j/gabbs/gameserver/model/TradeList.java
===================================================================
--- java/l2j/gabbs/gameserver/model/TradeList.java (revision 17)
+++ java/l2j/gabbs/gameserver/model/TradeList.java (working copy)
@@ -25,7 +25,6 @@
 
import javolution.util.FastList;
import javolution.util.FastSet;
-
import l2j.gabbs.Config;
import l2j.gabbs.gameserver.datatables.ItemTable;
import l2j.gabbs.gameserver.model.actor.instance.L2PcInstance;
@@ -771,9 +770,10 @@
}
}
 
- if (totalPrice > playerInventory.getAdena())
+ if (totalPrice > player.getBuyStoreCurrency())
{
- player.sendPacket(SystemMessageId.YOU_NOT_ENOUGH_ADENA);
+ final String name = ItemTable.getInstance().getTemplate(Config.STORE_BUY_CURRENCY).getName();
+ player.sendMessage("You dont have enough " + name);
return 1;
}
 
@@ -793,15 +793,16 @@
final InventoryUpdate ownerIU = new InventoryUpdate();
final InventoryUpdate playerIU = new InventoryUpdate();
 
- final L2ItemInstance adenaItem = playerInventory.getAdenaInstance();
- if (!playerInventory.reduceAdena("PrivateStore", totalPrice, player, _owner))
+ final int moneda = Config.STORE_BUY_CURRENCY;
+ final L2ItemInstance adenaItem = playerInventory.getItemByItemId(moneda);
+ if (!player.destroyItemByItemId("PrivateStore", moneda, totalPrice, _owner, true))
{
player.sendPacket(SystemMessageId.YOU_NOT_ENOUGH_ADENA);
return 1;
}
playerIU.addItem(adenaItem);
- ownerInventory.addAdena("PrivateStore", totalPrice, _owner, player);
- // ownerIU.addItem(ownerInventory.getAdenaInstance());
+ ownerInventory.addItem("PrivateStore", moneda, totalPrice, _owner, player);
+ ownerIU.addItem(ownerInventory.getItemByItemId(moneda));
 
boolean ok = true;
 
@@ -962,7 +963,7 @@
break;
}
 
- if (ownerInventory.getAdena() < _totalPrice)
+ if (_owner.getSellStoreCurrency() < _totalPrice)
{
continue;
}
@@ -1065,11 +1066,12 @@
// should not happens, just a precaution
return false;
}
- final L2ItemInstance adenaItem = ownerInventory.getAdenaInstance();
- ownerInventory.reduceAdena("PrivateStore", totalPrice, _owner, player);
+ final int moneda = Config.STORE_SELL_CURRENCY;
+ final L2ItemInstance adenaItem = ownerInventory.getItemByItemId(moneda);
+ ownerInventory.destroyItemByItemId("PrivateStore", moneda, totalPrice, _owner, player);
ownerIU.addItem(adenaItem);
- playerInventory.addAdena("PrivateStore", totalPrice, player, _owner);
- playerIU.addItem(playerInventory.getAdenaInstance());
+ playerInventory.addItem("PrivateStore", moneda, totalPrice, player, _owner);
+ playerIU.addItem(playerInventory.getItemByItemId(moneda));
}
 
if (ok)
Mark as solved if it helped you. 

 

Thank you, I'll try it. Any ideas on how to change the currency of the mailing system?

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now


×
×
  • Create New...