1 |
|
|
/* |
2 |
|
|
* The ManaPlus Client |
3 |
|
|
* Copyright (C) 2011-2019 The ManaPlus Developers |
4 |
|
|
* Copyright (C) 2019-2021 Andrei Karas |
5 |
|
|
* |
6 |
|
|
* This file is part of The ManaPlus Client. |
7 |
|
|
* |
8 |
|
|
* This program is free software; you can redistribute it and/or modify |
9 |
|
|
* it under the terms of the GNU General Public License as published by |
10 |
|
|
* the Free Software Foundation; either version 2 of the License, or |
11 |
|
|
* any later version. |
12 |
|
|
* |
13 |
|
|
* This program is distributed in the hope that it will be useful, |
14 |
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 |
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 |
|
|
* GNU General Public License for more details. |
17 |
|
|
* |
18 |
|
|
* You should have received a copy of the GNU General Public License |
19 |
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
20 |
|
|
*/ |
21 |
|
|
|
22 |
|
|
#include "net/eathena/bankhandler.h" |
23 |
|
|
|
24 |
|
|
#include "net/eathena/messageout.h" |
25 |
|
|
#include "net/eathena/protocolout.h" |
26 |
|
|
|
27 |
|
|
#include "debug.h" |
28 |
|
|
|
29 |
|
|
extern int packetVersion; |
30 |
|
|
|
31 |
|
|
namespace EAthena |
32 |
|
|
{ |
33 |
|
|
|
34 |
|
|
BankHandler::BankHandler() : |
35 |
|
|
Net::BankHandler() |
36 |
|
|
{ |
37 |
|
|
bankHandler = this; |
38 |
|
|
} |
39 |
|
|
|
40 |
|
|
BankHandler::~BankHandler() |
41 |
|
|
{ |
42 |
|
|
bankHandler = nullptr; |
43 |
|
|
} |
44 |
|
|
|
45 |
|
|
void BankHandler::deposit(const int money) const |
46 |
|
|
{ |
47 |
|
|
if (packetVersion < 20130320) |
48 |
|
|
return; |
49 |
|
|
createOutPacket(CMSG_BANK_DEPOSIT); |
50 |
|
|
outMsg.writeInt32(0, "account id"); |
51 |
|
|
outMsg.writeInt32(money, "money"); |
52 |
|
|
} |
53 |
|
|
|
54 |
|
|
void BankHandler::withdraw(const int money) const |
55 |
|
|
{ |
56 |
|
|
if (packetVersion < 20130320) |
57 |
|
|
return; |
58 |
|
|
createOutPacket(CMSG_BANK_WITHDRAW); |
59 |
|
|
outMsg.writeInt32(0, "account id"); |
60 |
|
|
outMsg.writeInt32(money, "money"); |
61 |
|
|
} |
62 |
|
|
|
63 |
|
|
void BankHandler::check() const |
64 |
|
|
{ |
65 |
|
|
if (packetVersion < 20130320) |
66 |
|
|
return; |
67 |
|
|
createOutPacket(CMSG_BANK_CHECK); |
68 |
|
|
outMsg.writeInt32(0, "account id"); |
69 |
|
|
} |
70 |
|
|
|
71 |
|
|
void BankHandler::open() const |
72 |
|
|
{ |
73 |
|
|
if (packetVersion < 20130417) |
74 |
|
|
return; |
75 |
|
|
createOutPacket(CMSG_BANK_OPEN); |
76 |
|
|
outMsg.writeInt32(0, "unused"); |
77 |
|
|
} |
78 |
|
|
|
79 |
|
|
void BankHandler::close() const |
80 |
|
|
{ |
81 |
|
|
if (packetVersion < 20130417) |
82 |
|
|
return; |
83 |
|
|
createOutPacket(CMSG_BANK_CLOSE); |
84 |
|
|
outMsg.writeInt32(0, "unused"); |
85 |
|
|
} |
86 |
|
|
|
87 |
|
|
} // namespace EAthena |