ManaPlus
adminhandler.cpp
Go to the documentation of this file.
1 /*
2  * The ManaPlus Client
3  * Copyright (C) 2004-2009 The Mana World Development Team
4  * Copyright (C) 2009-2010 The Mana Developers
5  * Copyright (C) 2011-2019 The ManaPlus Developers
6  * Copyright (C) 2019-2021 Andrei Karas
7  *
8  * This file is part of The ManaPlus Client.
9  *
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program. If not, see <http://www.gnu.org/licenses/>.
22  */
23 
24 #include "net/tmwa/adminhandler.h"
25 
26 #include "game.h"
27 
28 #include "net/tmwa/messageout.h"
29 #include "net/tmwa/protocolout.h"
30 
31 #include "utils/gmfunctions.h"
32 #include "utils/stringutils.h"
33 
34 #include "debug.h"
35 
36 namespace TmwAthena
37 {
38 
40  Ea::AdminHandler()
41 {
42  adminHandler = this;
43 }
44 
46 {
47  adminHandler = nullptr;
48 }
49 
50 void AdminHandler::announce(const std::string &text) const
51 {
52  createOutPacket(CMSG_ADMIN_ANNOUNCE);
53  outMsg.writeInt16(CAST_S16(text.length() + 4), "len");
54  outMsg.writeString(text, CAST_S32(text.length()), "message");
55 }
56 
57 void AdminHandler::localAnnounce(const std::string &text) const
58 {
59  createOutPacket(CMSG_ADMIN_LOCAL_ANNOUNCE);
60  outMsg.writeInt16(CAST_S16(text.length() + 4), "len");
61  outMsg.writeString(text, CAST_S32(text.length()), "message");
62 }
63 
64 void AdminHandler::hide(const bool h A_UNUSED) const
65 {
66  createOutPacket(CMSG_ADMIN_HIDE);
67  outMsg.writeInt32(0, "unused");
68 }
69 
70 void AdminHandler::kick(const BeingId playerId) const
71 {
72  createOutPacket(CMSG_ADMIN_KICK);
73  outMsg.writeBeingId(playerId, "account id");
74 }
75 
77 {
78 }
79 
80 void AdminHandler::warp(const std::string &map, const int x, const int y) const
81 {
82  Gm::runCommand("warp",
83  strprintf("%s %d %d", map.c_str(), x, y));
84 }
85 
87 {
88 }
89 
91 {
92 }
93 
94 void AdminHandler::gotoName(const std::string &name) const
95 {
96  Gm::runCommand("goto", name);
97 }
98 
99 void AdminHandler::recallName(const std::string &name) const
100 {
101  Gm::runCommand("recall", name);
102 }
103 
104 void AdminHandler::mute(const Being *const being A_UNUSED,
105  const int type A_UNUSED,
106  const int limit A_UNUSED) const
107 {
108 }
109 
110 void AdminHandler::muteName(const std::string &name A_UNUSED) const
111 {
112 }
113 
114 void AdminHandler::requestLogin(const Being *const being A_UNUSED) const
115 {
116 }
117 
118 void AdminHandler::setTileType(const int x A_UNUSED, const int y A_UNUSED,
119  const int type A_UNUSED) const
120 {
121 }
122 
123 void AdminHandler::unequipAll(const Being *const being A_UNUSED) const
124 {
125 }
126 
127 void AdminHandler::requestStats(const std::string &name A_UNUSED) const
128 {
129 }
130 
131 void AdminHandler::monsterInfo(const std::string &name A_UNUSED) const
132 {
133 }
134 
135 void AdminHandler::itemInfo(const std::string &name A_UNUSED) const
136 {
137 }
138 
139 void AdminHandler::whoDrops(const std::string &name A_UNUSED) const
140 {
141 }
142 
143 void AdminHandler::mobSearch(const std::string &name A_UNUSED) const
144 {
145 }
146 
147 void AdminHandler::mobSpawnSearch(const std::string &name A_UNUSED) const
148 {
149 }
150 
151 void AdminHandler::playerGmCommands(const std::string &name A_UNUSED) const
152 {
153 }
154 
155 void AdminHandler::playerCharGmCommands(const std::string &name A_UNUSED) const
156 {
157 }
158 
159 void AdminHandler::showLevel(const std::string &name A_UNUSED) const
160 {
161 }
162 
163 void AdminHandler::showStats(const std::string &name A_UNUSED) const
164 {
165 }
166 
167 void AdminHandler::showStorageList(const std::string &name A_UNUSED) const
168 {
169 }
170 
171 void AdminHandler::showCartList(const std::string &name A_UNUSED) const
172 {
173 }
174 
175 void AdminHandler::showInventoryList(const std::string &name A_UNUSED) const
176 {
177 }
178 
179 void AdminHandler::locatePlayer(const std::string &name A_UNUSED) const
180 {
181 }
182 
183 void AdminHandler::showAccountInfo(const std::string &name A_UNUSED) const
184 {
185 }
186 
187 void AdminHandler::spawnSlave(const std::string &name A_UNUSED) const
188 {
189 }
190 
191 void AdminHandler::spawnClone(const std::string &name A_UNUSED) const
192 {
193 }
194 
195 void AdminHandler::spawnSlaveClone(const std::string &name A_UNUSED) const
196 {
197 }
198 
199 void AdminHandler::spawnEvilClone(const std::string &name A_UNUSED) const
200 {
201 }
202 
203 void AdminHandler::savePosition(const std::string &name A_UNUSED) const
204 {
205 }
206 
207 void AdminHandler::loadPosition(const std::string &name A_UNUSED) const
208 {
209 }
210 
211 void AdminHandler::randomWarp(const std::string &name A_UNUSED) const
212 {
213 }
214 
215 void AdminHandler::gotoNpc(const std::string &name A_UNUSED) const
216 {
217 }
218 
219 void AdminHandler::killer(const std::string &name A_UNUSED) const
220 {
221 }
222 
223 void AdminHandler::killable(const std::string &name A_UNUSED) const
224 {
225 }
226 
227 void AdminHandler::heal(const std::string &name A_UNUSED) const
228 {
229 }
230 
231 void AdminHandler::alive(const std::string &name) const
232 {
233  Gm::runCommand("revive", name);
234 }
235 
236 void AdminHandler::disguise(const std::string &name A_UNUSED) const
237 {
238 }
239 
240 void AdminHandler::immortal(const std::string &name A_UNUSED) const
241 {
242 }
243 
244 void AdminHandler::hide(const std::string &name A_UNUSED) const
245 {
246  Gm::runCommand("hide");
247 }
248 
249 void AdminHandler::nuke(const std::string &name A_UNUSED) const
250 {
251 }
252 
253 void AdminHandler::kill(const std::string &name A_UNUSED) const
254 {
255 }
256 
257 void AdminHandler::jail(const std::string &name A_UNUSED) const
258 {
259 }
260 
261 void AdminHandler::unjail(const std::string &name A_UNUSED) const
262 {
263 }
264 
265 void AdminHandler::npcMove(const std::string &name A_UNUSED,
266  const int x A_UNUSED,
267  const int y A_UNUSED) const
268 {
269 }
270 
271 void AdminHandler::hideNpc(const std::string &name A_UNUSED) const
272 {
273 }
274 
275 void AdminHandler::showNpc(const std::string &name A_UNUSED) const
276 {
277 }
278 
279 void AdminHandler::changePartyLeader(const std::string &name A_UNUSED) const
280 {
281 }
282 
283 void AdminHandler::partyRecall(const std::string &name A_UNUSED) const
284 {
285 }
286 
287 void AdminHandler::breakGuild(const std::string &name A_UNUSED) const
288 {
289 }
290 
291 void AdminHandler::guildRecall(const std::string &name A_UNUSED) const
292 {
293 }
294 
295 void AdminHandler::slide(const int x, const int y) const
296 {
297  warp(Game::instance()->getCurrentMapName(), x, y);
298 }
299 
301 {
302 }
303 
305 {
306 }
307 
308 } // namespace TmwAthena
Net::AdminHandler * adminHandler
Definition: net.cpp:84
int BeingId
Definition: beingid.h:30
#define CAST_S16
Definition: cast.h:28
#define CAST_S32
Definition: cast.h:30
Definition: being.h:96
static Game * instance()
Definition: game.h:82
void unjail(const std::string &name) const
void kick(const BeingId playerId) const
void setTileType(const int x, const int y, const int type) const
void gotoNpc(const std::string &name) const
void showStats(const std::string &name) const
void showInventoryList(const std::string &name) const
void spawnSlaveClone(const std::string &name) const
void nuke(const std::string &name) const
void muteName(const std::string &name) const
void playerGmCommands(const std::string &name) const
void guildRecall(const std::string &name) const
void unequipAll(const Being *const being) const
void jail(const std::string &name) const
void alive(const std::string &name) const
void killer(const std::string &name) const
void showAccountInfo(const std::string &name) const
void heal(const std::string &name) const
void announce(const std::string &text) const
void showNpc(const std::string &name) const
void slide(const int x, const int y) const
void showStorageList(const std::string &name) const
void requestStats(const std::string &name) const
void spawnClone(const std::string &name) const
void showLevel(const std::string &name) const
void mobSearch(const std::string &name) const
void showCartList(const std::string &name) const
void localAnnounce(const std::string &text) const
void mobSpawnSearch(const std::string &name) const
void changePartyLeader(const std::string &name) const
void immortal(const std::string &name) const
void gotoName(const std::string &name) const
void npcMove(const std::string &name, const int x, const int y) const
void requestLogin(const Being *const being) const
void kill(const std::string &name) const
void spawnEvilClone(const std::string &name) const
void warp(const std::string &map, const int x, const int y) const
void spawnSlave(const std::string &name) const
void monsterInfo(const std::string &name) const
void breakGuild(const std::string &name) const
void playerCharGmCommands(const std::string &name) const
void itemInfo(const std::string &name) const
void killable(const std::string &name) const
void hide(const bool h) const
void partyRecall(const std::string &name) const
void hideNpc(const std::string &name) const
void mute(const Being *const being, const int type, const int limit) const
void loadPosition(const std::string &name) const
void whoDrops(const std::string &name) const
void recallName(const std::string &name) const
void savePosition(const std::string &name) const
void randomWarp(const std::string &name) const
void disguise(const std::string &name) const
void locatePlayer(const std::string &name) const
#define A_UNUSED
Definition: localconsts.h:160
#define createOutPacket(name)
Definition: messageout.h:37
void runCommand(const std::string &command, const std::string &params)
Definition: gmfunctions.cpp:35
std::string strprintf(const char *const format,...)