summaryrefslogtreecommitdiff
path: root/src/net
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-03-10 19:06:53 +0300
committerAndrei Karas <akaras@inbox.ru>2015-03-10 19:06:53 +0300
commitc63a2bb4b0277758694b10d5f88b5639b57ea8a6 (patch)
tree1b553df33085ebc31078dcee6609db07615f61b6 /src/net
parent3b25ab9075318c52271307eefdc616a671657ee3 (diff)
downloadmv-c63a2bb4b0277758694b10d5f88b5639b57ea8a6.tar.gz
mv-c63a2bb4b0277758694b10d5f88b5639b57ea8a6.tar.bz2
mv-c63a2bb4b0277758694b10d5f88b5639b57ea8a6.tar.xz
mv-c63a2bb4b0277758694b10d5f88b5639b57ea8a6.zip
eathena: show pvp or gvg map mode.
Diffstat (limited to 'src/net')
-rw-r--r--src/net/eathena/beinghandler.cpp21
-rw-r--r--src/net/eathena/maptypeproperty2.h50
2 files changed, 67 insertions, 4 deletions
diff --git a/src/net/eathena/beinghandler.cpp b/src/net/eathena/beinghandler.cpp
index 895ab5c77..5a2a9208f 100644
--- a/src/net/eathena/beinghandler.cpp
+++ b/src/net/eathena/beinghandler.cpp
@@ -24,6 +24,7 @@
#include "actormanager.h"
#include "effectmanager.h"
+#include "game.h"
#include "guildmanager.h"
#include "being/localplayer.h"
@@ -42,6 +43,7 @@
#include "net/ea/eaprotocol.h"
+#include "net/eathena/maptypeproperty2.h"
#include "net/eathena/messageout.h"
#include "net/eathena/protocol.h"
#include "net/eathena/sprite.h"
@@ -50,6 +52,8 @@
#include "resources/db/itemdb.h"
+#include "resources/map/map.h"
+
#include "utils/stringutils.h"
#include "utils/timer.h"
@@ -1015,10 +1019,19 @@ void BeingHandler::processBeingSpawn(Net::MessageIn &msg)
void BeingHandler::processMapTypeProperty(Net::MessageIn &msg)
{
- UNIMPLIMENTEDPACKET;
- msg.readInt16("type");
- // +++ need get pvp and other flags from here
- msg.readInt32("flags");
+ const int16_t type = msg.readInt16("type");
+ const int flags = msg.readInt32("flags");
+ if (type == 0x28)
+ {
+ // +++ need get other flags from here
+ MapTypeProperty2 props;
+ props.data = static_cast<uint32_t>(flags);
+ Game *const game = Game::instance();
+ Map *const map = game->getCurrentMap();
+ if (!map)
+ return;
+ map->setPvpMode(props.bits.party | (props.bits.guild * 2));
+ }
}
void BeingHandler::processMapType(Net::MessageIn &msg)
diff --git a/src/net/eathena/maptypeproperty2.h b/src/net/eathena/maptypeproperty2.h
new file mode 100644
index 000000000..a7d2b4c41
--- /dev/null
+++ b/src/net/eathena/maptypeproperty2.h
@@ -0,0 +1,50 @@
+/*
+ * The ManaPlus Client
+ * Copyright (C) 2015 The ManaPlus Developers
+ *
+ * This file is part of The ManaPlus Client.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef NET_EATHENA_MAPTYPEPROPERTY2_H
+#define NET_EATHENA_MAPTYPEPROPERTY2_H
+
+namespace EAthena
+{
+ struct MapTypeProperty2Bits final
+ {
+ unsigned int party : 1; // allow attack party members (PvP)
+ unsigned int guild : 1; // allow attack guild members (GvG)
+ unsigned int siege : 1; // show emblem in GvG (WoE castle)
+ unsigned int mineffect : 1; // mine effect?
+ unsigned int nolockon : 1; // unknown
+ unsigned int countpk : 1; // show PvP counter
+ unsigned int nopartyformation : 1; // prevent party creation/modification
+ unsigned int bg : 1; // is on battle ground
+ unsigned int noitemconsumption : 1; // unused
+ unsigned int usecart : 1; // unused
+ unsigned int summonstarmiracle : 1; // unused
+ unsigned int SpareBits : 15; // unused bits
+ } __attribute__((packed));
+
+ union MapTypeProperty2 final
+ {
+ MapTypeProperty2Bits bits;
+ uint32_t data;
+ } __attribute__((packed));
+
+} // namespace EAthena
+
+#endif // NET_EATHENA_MAPTYPEPROPERTY2_H