Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/java/net/sf/l2j/Config.java b/java/net/sf/l2j/Config.java
- index f47b894..779c28d 100644
- --- a/java/net/sf/l2j/Config.java
- +++ b/java/net/sf/l2j/Config.java
- @@ -56,6 +56,10 @@
- public static boolean MEMBERS_CAN_WITHDRAW_FROM_CLANWH;
- public static boolean ENABLE_ALTERNATIVE_SKILL_DURATION;
- public static HashMap<Integer, Integer> SKILL_DURATION_LIST;
- + public static int BANKING_SYSTEM_GOLDBARS;
- + public static int BANKING_SYSTEM_ADENA;
- + public static boolean ENABLE_COMMAND_GOLDBAR;
- /** Manor */
- public static int MANOR_REFRESH_TIME;
- public static int MANOR_REFRESH_MIN;
- @@ -1020,6 +1024,10 @@
- {
- final ExProperties Commands = initProperties(COMMANDS);
- ENABLE_COMMAND_MENU = Boolean.parseBoolean(Commands.getProperty("EnableCommandMenu", "false"));
- + BANKING_SYSTEM_GOLDBARS = Integer.parseInt(Commands.getProperty("BankingGoldbarCount", "1"));
- + BANKING_SYSTEM_ADENA = Integer.parseInt(Commands.getProperty("BankingAdenaCount", "5000"));
- + ENABLE_COMMAND_GOLDBAR = Boolean.parseBoolean(Commands.getProperty("BankingEnabled", "false"));
- }
- private static final void loadSpecial()
- {
- diff --git a/java/net/sf/l2j/gameserver/handler/VoicedCommandHandler.java b/java/net/sf/l2j/gameserver/handler/VoicedCommandHandler.java
- index 3be641c..222492b 100644
- --- a/java/net/sf/l2j/gameserver/handler/VoicedCommandHandler.java
- +++ b/java/net/sf/l2j/gameserver/handler/VoicedCommandHandler.java
- @@ -26,6 +26,7 @@
- import net.sf.l2j.Config;
- import net.sf.l2j.gameserver.GameServer;
- +import net.sf.l2j.gameserver.handler.voicedcommandhandlers.VoicedBanking;
- import net.sf.l2j.gameserver.handler.voicedcommandhandlers.VoicedMenu;
- /**
- @@ -57,6 +58,10 @@
- {
- registerVoicedCommandHandler(new VoicedMenu());
- }
- + if(Config.ENABLE_COMMAND_GOLDBAR)
- + {
- + registerVoicedCommandHandler(new VoicedBanking());
- + }
- LOGGER.info("VoicedCommandHandler: Loaded " + _datatable.size() + " handlers.");
- diff --git a/java/net/sf/l2j/gameserver/handler/voicedcommandhandlers/VoicedBanking.java b/java/net/sf/l2j/gameserver/handler/voicedcommandhandlers/VoicedBanking.java
- new file mode 100644
- index 0000000..7b8d48c
- --- /dev/null
- +++ b/java/net/sf/l2j/gameserver/handler/voicedcommandhandlers/VoicedBanking.java
- @@ -0,0 +1,85 @@
- +package net.sf.l2j.gameserver.handler.voicedcommandhandlers;
- +
- +import net.sf.l2j.Config;
- +import net.sf.l2j.gameserver.handler.IVoicedCommandHandler;
- +import net.sf.l2j.gameserver.model.actor.Player;
- +import net.sf.l2j.gameserver.network.serverpackets.ItemList;
- +
- +public class VoicedBanking implements IVoicedCommandHandler
- +{
- + private static String[] VOICED_COMMANDS =
- + {
- + "bank",
- + "withdraw",
- + "deposit"
- + };
- +
- + @Override
- + public boolean useVoicedCommand(String command, Player activeChar, String target)
- + {
- + if (command.equalsIgnoreCase("bank"))
- + {
- + activeChar.sendMessage(".deposit (" + Config.BANKING_SYSTEM_ADENA + " Adena = " + Config.BANKING_SYSTEM_GOLDBARS + " Goldbar) / .withdraw (" + Config.BANKING_SYSTEM_GOLDBARS + " Goldbar = " + Config.BANKING_SYSTEM_ADENA + " Adena)");
- + }
- + else if (command.equalsIgnoreCase("deposit"))
- + {
- + if (activeChar.getInventory().getItemCount(57, 0) >= Config.BANKING_SYSTEM_ADENA)
- + {
- + activeChar.getInventory().reduceAdena("Goldbar", Config.BANKING_SYSTEM_ADENA, activeChar, null);
- + activeChar.getInventory().addItem("Goldbar", 3470, Config.BANKING_SYSTEM_GOLDBARS, activeChar, null);
- + activeChar.getInventory().updateDatabase();
- + activeChar.sendPacket(new ItemList(activeChar, true));
- + activeChar.sendMessage("Now you have " + Config.BANKING_SYSTEM_GOLDBARS + " Goldbar(s), and " + Config.BANKING_SYSTEM_ADENA + " less adena.");
- + }
- + else
- + {
- + activeChar.sendMessage("You do not have enough Adena to convert to Goldbar(s), you need " + Config.BANKING_SYSTEM_ADENA + " Adena.");
- + }
- + }
- + else if (command.equalsIgnoreCase("withdraw"))
- + {
- + // If player hasn't enough space for adena
- + long a = activeChar.getInventory().getItemCount(57, 0);
- + long b = Config.BANKING_SYSTEM_ADENA;
- + if (a + b > Integer.MAX_VALUE)
- + {
- + activeChar.sendMessage("You do not have enough space for all the adena in inventory!");
- + return false;
- + }
- +
- + if (activeChar.getInventory().getItemCount(3470, 0) >= Config.BANKING_SYSTEM_GOLDBARS)
- + {
- + activeChar.getInventory().destroyItemByItemId("Adena", 3470, Config.BANKING_SYSTEM_GOLDBARS, activeChar, null);
- + activeChar.getInventory().addAdena("Adena", Config.BANKING_SYSTEM_ADENA, activeChar, null);
- + activeChar.getInventory().updateDatabase();
- + activeChar.sendPacket(new ItemList(activeChar, true));
- + activeChar.sendMessage("Now you have " + Config.BANKING_SYSTEM_ADENA + " Adena, and " + Config.BANKING_SYSTEM_GOLDBARS + " less Goldbar(s).");
- + }
- + else
- + {
- + activeChar.sendMessage("You do not have any Goldbars to turn into " + Config.BANKING_SYSTEM_ADENA + " Adena.");
- + }
- + }
- + return true;
- + }
- +
- + @Override
- + public String[] getVoicedCommandList()
- + {
- + return VOICED_COMMANDS;
- + }
- +}
- \ No newline at end of file
- Index: Datapack
- +#===================================================
- +# Enable Command GoldBar
- +#===================================================
- +#Active Command: .deposit/.withdraw/.bank
- +BankingEnabled = True
- +# This is the amount of Goldbars someone will get when they do the .deposit command, and also the same amount they will lose when they do .withdraw
- +BankingGoldbarCount = 1
- +# This is the amount of Adena someone will get when they do the .withdraw command, and also the same amount they will lose when they do .deposit
- +BankingAdenaCount = 500000000
Add Comment
Please, Sign In to add comment