forked from TrueUO/TrueUO
-
Notifications
You must be signed in to change notification settings - Fork 0
/
IAccount.cs
281 lines (230 loc) · 9.43 KB
/
IAccount.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
#region References
using System;
#endregion
namespace Server.Accounting
{
public static class AccountGold
{
public static bool Enabled = false;
/// <summary>
/// This amount specifies the value at which point Gold turns to Platinum.
/// By default, when 1,000,000,000 Gold is accumulated, it will transform
/// into 1 Platinum.
/// !!! WARNING !!!
/// The client is designed to perceive the currency threashold at 1,000,000,000
/// if you change this, it may cause unexpected results when using secure trading.
/// </summary>
public static int CurrencyThreshold = 1000000000;
/// <summary>
/// Enables or Disables automatic conversion of Gold and Checks to Bank Currency
/// when they are added to a bank box container.
/// </summary>
public static bool ConvertOnBank = true;
/// <summary>
/// Enables or Disables automatic conversion of Gold and Checks to Bank Currency
/// when they are added to a secure trade container.
/// </summary>
public static bool ConvertOnTrade = false;
public static double GetGoldTotal(Mobile m)
{
if (m == null)
{
return 0;
}
return GetGoldTotal(m.Account);
}
public static double GetGoldTotal(IGoldAccount a)
{
if (a == null)
{
return 0;
}
a.GetGoldBalance(out int gold, out double totalGold);
return totalGold;
}
public static double GetPlatTotal(Mobile m)
{
if (m == null)
{
return 0;
}
return GetPlatTotal(m.Account);
}
public static double GetPlatTotal(IGoldAccount a)
{
if (a == null)
{
return 0;
}
a.GetPlatBalance(out int plat, out double totalPlat);
return totalPlat;
}
}
public interface IGoldAccount
{
/// <summary>
/// This amount represents the total amount of currency owned by the player.
/// It is cumulative of both Gold and Platinum, the absolute total amount of
/// Gold owned by the player can be found by multiplying this value by the
/// CurrencyThreshold value.
/// </summary>
[CommandProperty(AccessLevel.Administrator)]
double TotalCurrency { get; }
/// <summary>
/// This amount represents the current amount of Gold owned by the player.
/// The value does not include the value of Platinum and ranges from
/// 0 to 999,999,999 by default.
/// </summary>
[CommandProperty(AccessLevel.Administrator)]
int TotalGold { get; }
/// <summary>
/// This amount represents the current amount of Platinum owned by the player.
/// The value does not include the value of Gold and ranges from
/// 0 to 2,147,483,647 by default.
/// One Platinum represents the value of CurrencyThreshold in Gold.
/// </summary>
[CommandProperty(AccessLevel.Administrator)]
int TotalPlat { get; }
/// <summary>
/// Attempts to deposit the given amount of Gold and Platinum into this account.
/// </summary>
/// <param name="amount">Amount to deposit.</param>
/// <returns>True if successful, false if amount given is less than or equal to zero.</returns>
bool DepositCurrency(double amount);
/// <summary>
/// Attempts to deposit the given amount of Gold into this account.
/// If the given amount is greater than the CurrencyThreshold,
/// Platinum will be deposited to offset the difference.
/// </summary>
/// <param name="amount">Amount to deposit.</param>
/// <returns>True if successful, false if amount given is less than or equal to zero.</returns>
bool DepositGold(int amount);
/// <summary>
/// Attempts to deposit the given amount of Gold into this account.
/// If the given amount is greater than the CurrencyThreshold,
/// Platinum will be deposited to offset the difference.
/// </summary>
/// <param name="amount">Amount to deposit.</param>
/// <returns>True if successful, false if amount given is less than or equal to zero.</returns>
bool DepositGold(long amount);
/// <summary>
/// Attempts to deposit the given amount of Platinum into this account.
/// </summary>
/// <param name="amount">Amount to deposit.</param>
/// <returns>True if successful, false if amount given is less than or equal to zero.</returns>
bool DepositPlat(int amount);
/// <summary>
/// Attempts to deposit the given amount of Platinum into this account.
/// </summary>
/// <param name="amount">Amount to deposit.</param>
/// <returns>True if successful, false if amount given is less than or equal to zero.</returns>
bool DepositPlat(long amount);
/// <summary>
/// Attempts to withdraw the given amount of Platinum and Gold from this account.
/// </summary>
/// <param name="amount">Amount to withdraw.</param>
/// <returns>True if successful, false if balance was too low.</returns>
bool WithdrawCurrency(double amount);
/// <summary>
/// Attempts to withdraw the given amount of Gold from this account.
/// If the given amount is greater than the CurrencyThreshold,
/// Platinum will be withdrawn to offset the difference.
/// </summary>
/// <param name="amount">Amount to withdraw.</param>
/// <returns>True if successful, false if balance was too low.</returns>
bool WithdrawGold(int amount);
/// <summary>
/// Attempts to withdraw the given amount of Gold from this account.
/// If the given amount is greater than the CurrencyThreshold,
/// Platinum will be withdrawn to offset the difference.
/// </summary>
/// <param name="amount">Amount to withdraw.</param>
/// <returns>True if successful, false if balance was too low.</returns>
bool WithdrawGold(long amount);
/// <summary>
/// Attempts to withdraw the given amount of Platinum from this account.
/// </summary>
/// <param name="amount">Amount to withdraw.</param>
/// <returns>True if successful, false if balance was too low.</returns>
bool WithdrawPlat(int amount);
/// <summary>
/// Attempts to withdraw the given amount of Platinum from this account.
/// </summary>
/// <param name="amount">Amount to withdraw.</param>
/// <returns>True if successful, false if balance was too low.</returns>
bool WithdrawPlat(long amount);
/// <summary>
/// Gets the total balance of Gold for this account.
/// </summary>
/// <param name="gold">Gold value, Platinum exclusive</param>
/// <param name="totalGold">Gold value, Platinum inclusive</param>
void GetGoldBalance(out int gold, out double totalGold);
/// <summary>
/// Gets the total balance of Gold for this account.
/// </summary>
/// <param name="gold">Gold value, Platinum exclusive</param>
/// <param name="totalGold">Gold value, Platinum inclusive</param>
void GetGoldBalance(out long gold, out double totalGold);
/// <summary>
/// Gets the total balance of Platinum for this account.
/// </summary>
/// <param name="plat">Platinum value, Gold exclusive</param>
/// <param name="totalPlat">Platinum value, Gold inclusive</param>
void GetPlatBalance(out int plat, out double totalPlat);
/// <summary>
/// Gets the total balance of Platinum for this account.
/// </summary>
/// <param name="plat">Platinum value, Gold exclusive</param>
/// <param name="totalPlat">Platinum value, Gold inclusive</param>
void GetPlatBalance(out long plat, out double totalPlat);
/// <summary>
/// Gets the total balance of Gold and Platinum for this account.
/// </summary>
/// <param name="gold">Gold value, Platinum exclusive</param>
/// <param name="totalGold">Gold value, Platinum inclusive</param>
/// <param name="plat">Platinum value, Gold exclusive</param>
/// <param name="totalPlat">Platinum value, Gold inclusive</param>
void GetBalance(out int gold, out double totalGold, out int plat, out double totalPlat);
/// <summary>
/// Gets the total balance of Gold and Platinum for this account.
/// </summary>
/// <param name="gold">Gold value, Platinum exclusive</param>
/// <param name="totalGold">Gold value, Platinum inclusive</param>
/// <param name="plat">Platinum value, Gold exclusive</param>
/// <param name="totalPlat">Platinum value, Gold inclusive</param>
void GetBalance(out long gold, out double totalGold, out long plat, out double totalPlat);
bool HasGoldBalance(double amount);
bool HasPlatBalance(double amount);
}
public interface IAccount : IGoldAccount, IComparable<IAccount>
{
[CommandProperty(AccessLevel.Administrator, true)]
string Username { get; set; }
[CommandProperty(AccessLevel.Administrator, true)]
string Email { get; set; }
[CommandProperty(AccessLevel.Administrator, AccessLevel.Owner)]
AccessLevel AccessLevel { get; set; }
[CommandProperty(AccessLevel.Administrator)]
int Length { get; }
[CommandProperty(AccessLevel.Administrator)]
int Limit { get; }
[CommandProperty(AccessLevel.Administrator)]
int Count { get; }
[CommandProperty(AccessLevel.Administrator, true)]
DateTime Created { get; set; }
[CommandProperty(AccessLevel.Administrator, true)]
DateTime LastLogin { get; set; }
[CommandProperty(AccessLevel.Administrator)]
TimeSpan Age { get; }
[CommandProperty(AccessLevel.Administrator)]
TimeSpan TotalGameTime { get; }
[CommandProperty(AccessLevel.Administrator)]
bool Banned { get; set; }
[CommandProperty(AccessLevel.Administrator)]
bool Young { get; set; }
Mobile this[int index] { get; set; }
void Delete();
void SetPassword(string password);
bool CheckPassword(string password);
}
}