View difference between Paste ID: V2u1t6rT and 0zCks4fP
SHOW: | | - or go back to the newest paste.
1
diff --git a/java/net/sf/l2j/Config.java b/java/net/sf/l2j/Config.java
2
index f47b894..779c28d 100644
3
--- a/java/net/sf/l2j/Config.java
4
+++ b/java/net/sf/l2j/Config.java
5
@@ -56,6 +56,10 @@
6
 	public static boolean MEMBERS_CAN_WITHDRAW_FROM_CLANWH;
7
 	public static boolean ENABLE_ALTERNATIVE_SKILL_DURATION;
8
 	public static HashMap<Integer, Integer> SKILL_DURATION_LIST;
9
+	public static int BANKING_SYSTEM_GOLDBARS;
10
+	public static int BANKING_SYSTEM_ADENA;
11
+	public static boolean ENABLE_COMMAND_GOLDBAR;
12
 	/** Manor */
13
 	public static int MANOR_REFRESH_TIME;
14
 	public static int MANOR_REFRESH_MIN;
15
@@ -1020,6 +1024,10 @@
16
 	{
17
 		final ExProperties Commands = initProperties(COMMANDS);
18
 		ENABLE_COMMAND_MENU = Boolean.parseBoolean(Commands.getProperty("EnableCommandMenu", "false"));
19
+		BANKING_SYSTEM_GOLDBARS = Integer.parseInt(Commands.getProperty("BankingGoldbarCount", "1"));
20
+		BANKING_SYSTEM_ADENA = Integer.parseInt(Commands.getProperty("BankingAdenaCount", "5000"));
21
+		ENABLE_COMMAND_GOLDBAR = Boolean.parseBoolean(Commands.getProperty("BankingEnabled", "false"));
22
 	}
23
 	private static final void loadSpecial()
24
 	{
25
diff --git a/java/net/sf/l2j/gameserver/handler/VoicedCommandHandler.java b/java/net/sf/l2j/gameserver/handler/VoicedCommandHandler.java
26
index 3be641c..222492b 100644
27
--- a/java/net/sf/l2j/gameserver/handler/VoicedCommandHandler.java
28
+++ b/java/net/sf/l2j/gameserver/handler/VoicedCommandHandler.java
29
@@ -26,6 +26,7 @@
30
 
31
 import net.sf.l2j.Config;
32
 import net.sf.l2j.gameserver.GameServer;
33
+import net.sf.l2j.gameserver.handler.voicedcommandhandlers.VoicedBanking;
34
 import net.sf.l2j.gameserver.handler.voicedcommandhandlers.VoicedMenu;
35
 
36
 /**
37
@@ -57,6 +58,10 @@
38
 		{
39
 			registerVoicedCommandHandler(new VoicedMenu());
40
 		}
41
+		if(Config.ENABLE_COMMAND_GOLDBAR)
42
+		{
43
+			registerVoicedCommandHandler(new VoicedBanking());
44
+		}
45
 		
46
 		LOGGER.info("VoicedCommandHandler: Loaded " + _datatable.size() + " handlers.");
47
 		
48
diff --git a/java/net/sf/l2j/gameserver/handler/voicedcommandhandlers/VoicedBanking.java b/java/net/sf/l2j/gameserver/handler/voicedcommandhandlers/VoicedBanking.java
49
new file mode 100644
50
index 0000000..7b8d48c
51
--- /dev/null
52
+++ b/java/net/sf/l2j/gameserver/handler/voicedcommandhandlers/VoicedBanking.java
53
@@ -0,0 +1,85 @@
54
+package net.sf.l2j.gameserver.handler.voicedcommandhandlers;
55
+
56
+import net.sf.l2j.Config;
57
+import net.sf.l2j.gameserver.handler.IVoicedCommandHandler;
58
+import net.sf.l2j.gameserver.model.actor.Player;
59
+import net.sf.l2j.gameserver.network.serverpackets.ItemList;
60
+
61
+public class VoicedBanking implements IVoicedCommandHandler
62
+{
63
+	private static String[] VOICED_COMMANDS =
64
+	{
65
+		"bank",
66
+		"withdraw",
67
+		"deposit"
68
+	};
69
+
70
+	@Override
71
+	public boolean useVoicedCommand(String command, Player activeChar, String target)
72
+	{
73
+		if (command.equalsIgnoreCase("bank"))
74
+		{
75
+			activeChar.sendMessage(".deposit (" + Config.BANKING_SYSTEM_ADENA + " Adena = " + Config.BANKING_SYSTEM_GOLDBARS + " Goldbar) / .withdraw (" + Config.BANKING_SYSTEM_GOLDBARS + " Goldbar = " + Config.BANKING_SYSTEM_ADENA + " Adena)");
76
+		}
77
+		else if (command.equalsIgnoreCase("deposit"))
78
+		{
79
+			if (activeChar.getInventory().getItemCount(57, 0) >= Config.BANKING_SYSTEM_ADENA)
80
+			{
81
+				activeChar.getInventory().reduceAdena("Goldbar", Config.BANKING_SYSTEM_ADENA, activeChar, null);
82
+				activeChar.getInventory().addItem("Goldbar", 3470, Config.BANKING_SYSTEM_GOLDBARS, activeChar, null);
83
+				activeChar.getInventory().updateDatabase();
84
+				activeChar.sendPacket(new ItemList(activeChar, true));
85
+				activeChar.sendMessage("Now you have " + Config.BANKING_SYSTEM_GOLDBARS + " Goldbar(s), and " + Config.BANKING_SYSTEM_ADENA + " less adena.");
86
+			}
87
+			else
88
+			{
89
+				activeChar.sendMessage("You do not have enough Adena to convert to Goldbar(s), you need " + Config.BANKING_SYSTEM_ADENA + " Adena.");
90
+			}
91
+		}
92
+		else if (command.equalsIgnoreCase("withdraw"))
93
+		{
94
+			// If player hasn't enough space for adena
95
+			long a = activeChar.getInventory().getItemCount(57, 0);
96
+			long b = Config.BANKING_SYSTEM_ADENA;
97
+			if (a + b > Integer.MAX_VALUE)
98
+			{
99
+				activeChar.sendMessage("You do not have enough space for all the adena in inventory!");
100
+				return false;
101
+			}
102
+
103
+			if (activeChar.getInventory().getItemCount(3470, 0) >= Config.BANKING_SYSTEM_GOLDBARS)
104
+			{
105
+				activeChar.getInventory().destroyItemByItemId("Adena", 3470, Config.BANKING_SYSTEM_GOLDBARS, activeChar, null);
106
+				activeChar.getInventory().addAdena("Adena", Config.BANKING_SYSTEM_ADENA, activeChar, null);
107
+				activeChar.getInventory().updateDatabase();
108
+				activeChar.sendPacket(new ItemList(activeChar, true));
109
+				activeChar.sendMessage("Now you have " + Config.BANKING_SYSTEM_ADENA + " Adena, and " + Config.BANKING_SYSTEM_GOLDBARS + " less Goldbar(s).");
110
+			}
111
+			else
112
+			{
113
+				activeChar.sendMessage("You do not have any Goldbars to turn into " + Config.BANKING_SYSTEM_ADENA + " Adena.");
114
+			}
115
+		}
116
+		return true;
117
+	}
118
+
119
+	@Override
120
+	public String[] getVoicedCommandList()
121
+	{
122
+		return VOICED_COMMANDS;
123
+	}
124
+}
125
\ No newline at end of file
126
127
Index: Datapack
128
129
+#===================================================
130
+#             Enable Command GoldBar
131
+#===================================================
132
+#Active Command: .deposit/.withdraw/.bank
133
+BankingEnabled = True
134
+# 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
135
+BankingGoldbarCount = 1
136
+# 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
137
+BankingAdenaCount = 500000000