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/battlegroundrecv.h"
23
24 #include "actormanager.h"
25 #include "logger.h"
26
27 #include "being/being.h"
28
29 #include "net/messagein.h"
30
31 #include "debug.h"
32
33 namespace EAthena
34 {
35
processBattleEmblem(Net::MessageIn & msg)36 void BattleGroundRecv::processBattleEmblem(Net::MessageIn &msg)
37 {
38 UNIMPLEMENTEDPACKET;
39 msg.readBeingId("account id");
40 msg.readString(24, "name");
41 msg.readInt16("bg id");
42 }
43
processBattleEmblem2(Net::MessageIn & msg)44 void BattleGroundRecv::processBattleEmblem2(Net::MessageIn &msg)
45 {
46 if (actorManager == nullptr)
47 return;
48 const BeingId id = msg.readBeingId("account id");
49 msg.readString(24, "name");
50 msg.readInt16("bg id");
51 const int teamId = msg.readInt16("team id");
52
53 Being *const dstBeing = actorManager->findBeing(id);
54 if (dstBeing != nullptr)
55 dstBeing->setTeamId(CAST_U16(teamId));
56 }
57
processBattleUpdateScore(Net::MessageIn & msg)58 void BattleGroundRecv::processBattleUpdateScore(Net::MessageIn &msg)
59 {
60 UNIMPLEMENTEDPACKET;
61 msg.readInt16("camp a points");
62 msg.readInt16("camp b points");
63 }
64
processBattleUpdateCoords(Net::MessageIn & msg)65 void BattleGroundRecv::processBattleUpdateCoords(Net::MessageIn &msg)
66 {
67 UNIMPLEMENTEDPACKET;
68 msg.readBeingId("account id");
69 msg.readString(24, "name");
70 msg.readInt16("class");
71 msg.readInt16("x");
72 msg.readInt16("y");
73 }
74
processBattlePlay(Net::MessageIn & msg)75 void BattleGroundRecv::processBattlePlay(Net::MessageIn &msg)
76 {
77 UNIMPLEMENTEDPACKET;
78 msg.readString(24, "battle ground name");
79 }
80
processBattleQueueAck(Net::MessageIn & msg)81 void BattleGroundRecv::processBattleQueueAck(Net::MessageIn &msg)
82 {
83 UNIMPLEMENTEDPACKET;
84 msg.readUInt8("type");
85 msg.readString(24, "bg name");
86 }
87
processBattleBegins(Net::MessageIn & msg)88 void BattleGroundRecv::processBattleBegins(Net::MessageIn &msg)
89 {
90 UNIMPLEMENTEDPACKET;
91 msg.readString(24, "bg name");
92 msg.readString(24, "game name");
93 }
94
processBattleNoticeDelete(Net::MessageIn & msg)95 void BattleGroundRecv::processBattleNoticeDelete(Net::MessageIn &msg)
96 {
97 UNIMPLEMENTEDPACKET;
98 msg.readUInt8("type");
99 msg.readString(24, "bg name");
100 }
101
processBattleJoined(Net::MessageIn & msg)102 void BattleGroundRecv::processBattleJoined(Net::MessageIn &msg)
103 {
104 UNIMPLEMENTEDPACKET;
105 msg.readString(24, "name");
106 msg.readInt32("position");
107 }
108
processBattleUpdateHp(Net::MessageIn & msg)109 void BattleGroundRecv::processBattleUpdateHp(Net::MessageIn &msg)
110 {
111 UNIMPLEMENTEDPACKET;
112 msg.readBeingId("account id");
113 if (msg.getVersion() >= 20140613)
114 {
115 msg.readInt32("hp");
116 msg.readInt32("max hp");
117 }
118 else
119 {
120 msg.readString(24, "name");
121 msg.readInt16("hp");
122 msg.readInt16("max hp");
123 }
124 }
125
126 } // namespace EAthena
127