diff options
author | Andrei Karas <akaras@inbox.ru> | 2016-07-24 21:21:43 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2016-07-24 21:21:43 +0300 |
commit | 1e2dcd3872b4bf3bb6173688ffdfe21388517c9c (patch) | |
tree | daf3c9f2ad85e7b88d539d8d9eab6cb5573065c8 /src | |
parent | 3cdb0d5516f5234dcebb118a26e405074de701f8 (diff) | |
download | plus-1e2dcd3872b4bf3bb6173688ffdfe21388517c9c.tar.gz plus-1e2dcd3872b4bf3bb6173688ffdfe21388517c9c.tar.bz2 plus-1e2dcd3872b4bf3bb6173688ffdfe21388517c9c.tar.xz plus-1e2dcd3872b4bf3bb6173688ffdfe21388517c9c.zip |
Drop native guild support from tmwa.
Diffstat (limited to 'src')
-rw-r--r-- | src/CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/Makefile.am | 2 | ||||
-rw-r--r-- | src/net/tmwa/guildhandler.cpp | 118 | ||||
-rw-r--r-- | src/net/tmwa/guildhandler.h | 7 | ||||
-rw-r--r-- | src/net/tmwa/guildrecv.cpp | 140 | ||||
-rw-r--r-- | src/net/tmwa/guildrecv.h | 51 | ||||
-rw-r--r-- | src/net/tmwa/network.cpp | 1 | ||||
-rw-r--r-- | src/net/tmwa/packetsin.inc | 26 | ||||
-rw-r--r-- | src/net/tmwa/packetsout.inc | 19 | ||||
-rw-r--r-- | src/net/tmwa/serverfeatures.cpp | 2 |
10 files changed, 17 insertions, 351 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 67d3a0f44..e9d94246e 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1639,8 +1639,6 @@ SET(SRCS_TMWA net/tmwa/guildhandler.h net/tmwa/guildmanager.cpp net/tmwa/guildmanager.h - net/tmwa/guildrecv.cpp - net/tmwa/guildrecv.h net/tmwa/inventoryhandler.cpp net/tmwa/inventoryhandler.h net/tmwa/inventoryrecv.cpp diff --git a/src/Makefile.am b/src/Makefile.am index 8d4aa8b16..40cd06fc6 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1489,8 +1489,6 @@ manaplus_SOURCES += \ net/tmwa/guildhandler.h \ net/tmwa/guildmanager.cpp \ net/tmwa/guildmanager.h \ - net/tmwa/guildrecv.cpp \ - net/tmwa/guildrecv.h \ net/tmwa/inventoryhandler.cpp \ net/tmwa/inventoryhandler.h \ net/tmwa/inventoryrecv.cpp \ diff --git a/src/net/tmwa/guildhandler.cpp b/src/net/tmwa/guildhandler.cpp index 2f7d68285..f289fb325 100644 --- a/src/net/tmwa/guildhandler.cpp +++ b/src/net/tmwa/guildhandler.cpp @@ -21,16 +21,8 @@ #include "net/tmwa/guildhandler.h" -#include "actormanager.h" - -#include "being/localplayer.h" -#include "being/playerinfo.h" - #include "net/ea/guildrecv.h" -#include "net/tmwa/messageout.h" -#include "net/tmwa/protocolout.h" - #include "debug.h" extern Net::GuildHandler *guildHandler; @@ -48,137 +40,59 @@ GuildHandler::~GuildHandler() { } -void GuildHandler::create(const std::string &name) const +void GuildHandler::create(const std::string &name A_UNUSED) const { - createOutPacket(CMSG_GUILD_CREATE); - outMsg.writeInt32(0, "unused"); - outMsg.writeString(name, 24, "guild name"); } -void GuildHandler::invite(const std::string &name) const +void GuildHandler::invite(const std::string &name A_UNUSED) const { - if (!actorManager) - return; - - const Being *const being = actorManager->findBeingByName( - name, ActorType::Player); - if (being) - { - createOutPacket(CMSG_GUILD_INVITE); - outMsg.writeBeingId(being->getId(), "account id"); - outMsg.writeInt32(0, "unused"); - outMsg.writeInt32(0, "unused"); - } } -void GuildHandler::invite(const Being *const being) const +void GuildHandler::invite(const Being *const being A_UNUSED) const { - if (!being) - return; - - createOutPacket(CMSG_GUILD_INVITE); - outMsg.writeBeingId(being->getId(), "account id"); - outMsg.writeInt32(0, "unused"); - outMsg.writeInt32(0, "unused"); } -void GuildHandler::inviteResponse(const int guildId, const bool response) const +void GuildHandler::inviteResponse(const int guildId A_UNUSED, + const bool response A_UNUSED) const { - createOutPacket(CMSG_GUILD_INVITE_REPLY); - outMsg.writeInt32(guildId, "guild id"); - outMsg.writeInt8(response, "response"); - outMsg.writeInt8(0, "unused"); - outMsg.writeInt16(0, "unused"); } -void GuildHandler::leave(const int guildId) const +void GuildHandler::leave(const int guildId A_UNUSED) const { - if (!localPlayer) - return; - - createOutPacket(CMSG_GUILD_LEAVE); - outMsg.writeInt32(guildId, "guild id"); - outMsg.writeBeingId(localPlayer->getId(), "account id"); - outMsg.writeInt32(PlayerInfo::getCharId(), "char id"); - outMsg.writeString("", 40, "message"); } -void GuildHandler::kick(const GuildMember *restrict const member, - const std::string &restrict reason) const +void GuildHandler::kick(const GuildMember *restrict const member A_UNUSED, + const std::string &restrict reason A_UNUSED) const { - if (!member || !member->getGuild()) - return; - - createOutPacket(CMSG_GUILD_EXPULSION); - outMsg.writeInt32(member->getGuild()->getId(), "guild id"); - outMsg.writeBeingId(member->getID(), "account id"); - outMsg.writeInt32(member->getCharId(), "char id"); - outMsg.writeString(reason, 40, "message"); } -void GuildHandler::chat(const std::string &text) const +void GuildHandler::chat(const std::string &text A_UNUSED) const { - if (!localPlayer) - return; - - const std::string str = std::string(localPlayer->getName()).append( - " : ").append(text); - createOutPacket(CMSG_GUILD_MESSAGE); - outMsg.writeInt16(CAST_U16(str.size() + 4), "len"); - outMsg.writeString(str, CAST_S32(str.length()), "message"); } void GuildHandler::memberList() const { - // 0 = basic info + alliance info - // 1 = position name list + member list - // 2 = position name list + position info list - // 3 = skill info - // 4 = expulsion list - - createOutPacket(CMSG_GUILD_REQUEST_INFO); - outMsg.writeInt32(1, "action"); // Request member list } void GuildHandler::info() const { - // 0 = basic info + alliance info - // 1 = position name list + member list - // 2 = position name list + position info list - // 3 = skill info - // 4 = expulsion list - - Ea::GuildRecv::showBasicInfo = true; - createOutPacket(CMSG_GUILD_REQUEST_INFO); - outMsg.writeInt32(0, "action"); // Request basic info } -void GuildHandler::changeMemberPostion(const GuildMember *const member, - const int level) const +void GuildHandler::changeMemberPostion(const GuildMember *const member + A_UNUSED, + const int level A_UNUSED) const { - if (!member || !member->getGuild()) - return; - - createOutPacket(CMSG_GUILD_CHANGE_MEMBER_POS); - outMsg.writeInt16(16, "len"); - outMsg.writeBeingId(member->getID(), "account id"); - outMsg.writeInt32(member->getCharId(), "char id"); - outMsg.writeInt32(level, "position"); } -void GuildHandler::changeNotice(const int guildId, - const std::string &restrict msg1, - const std::string &restrict msg2) const +void GuildHandler::changeNotice(const int guildId A_UNUSED, + const std::string &restrict msg1 A_UNUSED, + const std::string &restrict msg2 A_UNUSED) + const { - createOutPacket(CMSG_GUILD_CHANGE_NOTICE); - outMsg.writeInt32(guildId, "guild id"); - outMsg.writeString(msg1, 60, "msg1"); - outMsg.writeString(msg2, 120, "msg2"); } void GuildHandler::checkMaster() const { - createOutPacket(CMSG_GUILD_CHECK_MASTER); } void GuildHandler::requestAlliance(const Being *const being A_UNUSED) const diff --git a/src/net/tmwa/guildhandler.h b/src/net/tmwa/guildhandler.h index f26acb95a..16dc3c0df 100644 --- a/src/net/tmwa/guildhandler.h +++ b/src/net/tmwa/guildhandler.h @@ -95,11 +95,4 @@ class GuildHandler final : public Ea::GuildHandler } // namespace TmwAthena -extern GuildTab *guildTab; - -namespace Ea -{ - extern Guild *taGuild; -} - #endif // NET_TMWA_GUILDHANDLER_H diff --git a/src/net/tmwa/guildrecv.cpp b/src/net/tmwa/guildrecv.cpp deleted file mode 100644 index 4073dd936..000000000 --- a/src/net/tmwa/guildrecv.cpp +++ /dev/null @@ -1,140 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2016 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/>. - */ - -#include "net/tmwa/guildrecv.h" - -#include "configuration.h" - -#include "being/localplayer.h" -#include "being/playerinfo.h" - -#include "gui/windows/chatwindow.h" -#include "gui/windows/socialwindow.h" - -#include "net/serverfeatures.h" - -#include "net/messagein.h" - -#include "net/tmwa/guildhandler.h" - -#include "gui/widgets/tabs/chat/guildtab.h" - -#include "net/ea/guildrecv.h" - -#include "debug.h" - -namespace TmwAthena -{ - -void GuildRecv::processGuildPositionInfo(Net::MessageIn &msg) -{ - const int guildId = msg.readInt32("guild id"); - const int emblem = msg.readInt32("emblem"); - const int posMode = msg.readInt32("position"); - msg.readInt32("unused"); - msg.readUInt8("usused"); - std::string guildName = msg.readString(24, "guild name"); - - PlayerInfo::setGuildPositionFlags(GuildPositionFlags::Invite); - - Guild *const g = Guild::getGuild(CAST_S16(guildId)); - if (!g) - return; - - g->setName(guildName); - g->setEmblemId(emblem); - if (!Ea::taGuild) - Ea::taGuild = g; - if (!guildTab && chatWindow) - { - guildTab = new GuildTab(chatWindow); - if (config.getBoolValue("showChatHistory")) - guildTab->loadFromLogFile("#Guild"); - if (localPlayer) - localPlayer->addGuild(Ea::taGuild); - guildHandler->memberList(); - } - - if (localPlayer) - { - localPlayer->setGuild(g); - localPlayer->setGuildName(g->getName()); - } - - logger->log("Guild position info: %d %d %d %s\n", guildId, - emblem, posMode, guildName.c_str()); -} - -void GuildRecv::processGuildMemberLogin(Net::MessageIn &msg) -{ - const BeingId accountId = msg.readBeingId("account id"); - const int charId = msg.readInt32("char id"); - const int online = msg.readInt32("flag"); - if (Ea::taGuild) - { - GuildMember *const m = Ea::taGuild->getMember(accountId, charId); - if (m) - { - m->setOnline(online); - if (guildTab) - guildTab->showOnline(m->getName(), fromBool(online, Online)); - if (socialWindow) - socialWindow->updateGuildCounter(); - } - } -} - -void GuildRecv::processGuildExpulsion(Net::MessageIn &msg) -{ - std::string nick; - if (serverFeatures->haveNewGuild()) - { - nick = msg.readString(24, "name"); - msg.readString(40, "reason"); - msg.readString(24, "kicker name"); - } - else - { - msg.readInt16("len?"); - nick = msg.readString(24, "name?"); - msg.skip(24, "player name"); - msg.readString(44, "message"); - } - Ea::GuildRecv::processGuildExpulsionContinue(nick); -} - -void GuildRecv::processGuildExpulsionList(Net::MessageIn &msg) -{ - const int length = msg.readInt16("len"); - if (length < 4) - return; - - const int count = (length - 4) / 88; - - for (int i = 0; i < count; i++) - { - msg.readString(24, "name of expulsed"); - msg.readString(24, "name of expluser"); - msg.readString(24, "message"); - } -} - -} // namespace TmwAthena diff --git a/src/net/tmwa/guildrecv.h b/src/net/tmwa/guildrecv.h deleted file mode 100644 index 253cb2d8d..000000000 --- a/src/net/tmwa/guildrecv.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2016 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_TMWA_GUILDRECV_H -#define NET_TMWA_GUILDRECV_H - -namespace Net -{ - class MessageIn; -} - -class Guild; -class GuildTab; - -namespace TmwAthena -{ - namespace GuildRecv - { - void processGuildPositionInfo(Net::MessageIn &msg); - void processGuildMemberLogin(Net::MessageIn &msg); - void processGuildExpulsion(Net::MessageIn &msg); - void processGuildExpulsionList(Net::MessageIn &msg); - } // namespace GuildRecv -} // namespace TmwAthena - -extern GuildTab *guildTab; - -namespace Ea -{ - extern Guild *taGuild; -} - -#endif // NET_TMWA_GUILDRECV_H diff --git a/src/net/tmwa/network.cpp b/src/net/tmwa/network.cpp index 12a5b1555..bd42d78cd 100644 --- a/src/net/tmwa/network.cpp +++ b/src/net/tmwa/network.cpp @@ -49,7 +49,6 @@ #include "net/tmwa/chatrecv.h" #include "net/tmwa/gamerecv.h" #include "net/tmwa/generalrecv.h" -#include "net/tmwa/guildrecv.h" #include "net/tmwa/inventoryrecv.h" #include "net/tmwa/itemrecv.h" #include "net/tmwa/loginrecv.h" diff --git a/src/net/tmwa/packetsin.inc b/src/net/tmwa/packetsin.inc index 4a0529af1..8dab8f897 100644 --- a/src/net/tmwa/packetsin.inc +++ b/src/net/tmwa/packetsin.inc @@ -50,32 +50,6 @@ packet(SMSG_CHAR_PASSWORD_RESPONSE, 0x0062, 3, &LoginRecv::processCharP packet(SMSG_CHAR_SWITCH_RESPONSE, 0x00b3, 3, &Ea::GameRecv::processCharSwitchResponse, 0); packet(SMSG_CONNECTION_PROBLEM, 0x0081, 3, &GeneralRecv::processConnectionProblem, 0); packet(SMSG_GM_CHAT, 0x009a, -1, &ChatRecv::processGmChat, 0); -packet(SMSG_GUILD_ALIANCE_INFO, 0x014c, -1, &Ea::GuildRecv::processGuildAlianceInfo, 0); -packet(SMSG_GUILD_BASIC_INFO, 0x01b6, 114, &Ea::GuildRecv::processGuildBasicInfo, 0); -packet(SMSG_GUILD_BROKEN, 0x015e, 6, &Ea::GuildRecv::processGuildBroken, 0); -packet(SMSG_GUILD_CREATE_RESPONSE, 0x0167, 3, &Ea::GuildRecv::processGuildCreateResponse, 0); -packet(SMSG_GUILD_DEL_ALLIANCE, 0x0184, 10, &Ea::GuildRecv::processGuildDelAlliance, 0); -packet(SMSG_GUILD_EMBLEM_DATA, 0x0152, -1, &Ea::GuildRecv::processGuildEmblemData, 0); -packet(SMSG_GUILD_EXPULSION, 0x015c, 90, &GuildRecv::processGuildExpulsion, 0); -packet(SMSG_GUILD_EXPULSION_LIST, 0x0163, -1, &GuildRecv::processGuildExpulsionList, 0); -packet(SMSG_GUILD_INVITE, 0x016a, 30, &Ea::GuildRecv::processGuildInvite, 0); -packet(SMSG_GUILD_INVITE_ACK, 0x0169, 3, &Ea::GuildRecv::processGuildInviteAck, 0); -packet(SMSG_GUILD_LEAVE, 0x015a, 66, &Ea::GuildRecv::processGuildLeave, 0); -packet(SMSG_GUILD_MASTER_OR_MEMBER, 0x014e, 6, &Ea::GuildRecv::processGuildMasterOrMember, 0); -packet(SMSG_GUILD_MEMBER_LIST, 0x0154, -1, &Ea::GuildRecv::processGuildMemberList, 0); -packet(SMSG_GUILD_MEMBER_LOGIN, 0x016d, 14, &GuildRecv::processGuildMemberLogin, 0); -packet(SMSG_GUILD_MEMBER_POS_CHANGE, 0x0156, -1, &Ea::GuildRecv::processGuildMemberPosChange, 0); -packet(SMSG_GUILD_MESSAGE, 0x017f, -1, &Ea::GuildRecv::processGuildMessage, 0); -packet(SMSG_GUILD_NOTICE, 0x016f, 182, &Ea::GuildRecv::processGuildNotice, 0); -packet(SMSG_GUILD_OPPOSITION_ACK, 0x0181, 3, &Ea::GuildRecv::processGuildOppositionAck, 0); -packet(SMSG_GUILD_POSITION_CHANGED, 0x0174, -1, &Ea::GuildRecv::processGuildPositionChanged, 0); -packet(SMSG_GUILD_POSITION_INFO, 0x016c, 43, &GuildRecv::processGuildPositionInfo, 0); -packet(SMSG_GUILD_POS_INFO_LIST, 0x0160, -1, &Ea::GuildRecv::processGuildPosInfoList, 0); -packet(SMSG_GUILD_POS_NAME_LIST, 0x0166, -1, &Ea::GuildRecv::processGuildPosNameList, 0); -packet(SMSG_GUILD_REQ_ALLIANCE, 0x0171, 30, &Ea::GuildRecv::processGuildReqAlliance, 0); -packet(SMSG_GUILD_REQ_ALLIANCE_ACK, 0x0173, 3, &Ea::GuildRecv::processGuildReqAllianceAck, 0); -packet(SMSG_GUILD_SKILL_INFO, 0x0162, -1, &Ea::GuildRecv::processGuildSkillInfo, 0); -packet(SMSG_GUILD_SKILL_UP, 0x010e, 11, &Ea::GuildRecv::processGuildSkillUp, 0); packet(SMSG_IGNORE_ALL_RESPONSE, 0x00d2, 4, &Ea::ChatRecv::processIgnoreAllResponse, 0); packet(SMSG_ITEM_DROPPED, 0x009e, 17, &ItemRecv::processItemDropped, 0); packet(SMSG_ITEM_REMOVE, 0x00a1, 6, &Ea::ItemRecv::processItemRemove, 0); diff --git a/src/net/tmwa/packetsout.inc b/src/net/tmwa/packetsout.inc index f789791df..102d96281 100644 --- a/src/net/tmwa/packetsout.inc +++ b/src/net/tmwa/packetsout.inc @@ -99,25 +99,6 @@ packet(CMSG_ADMIN_HIDE, 0x019D, 0, nullptr); packet(CMSG_ADMIN_KICK, 0x00CC, 0, nullptr); packet(CMSG_ADMIN_MUTE, 0x0149, 0, nullptr); -packet(CMSG_GUILD_CHECK_MASTER, 0x014d, 0, nullptr); -packet(CMSG_GUILD_REQUEST_INFO, 0x014f, 0, nullptr); -packet(CMSG_GUILD_REQUEST_EMBLEM, 0x0151, 0, nullptr); -packet(CMSG_GUILD_CHANGE_EMBLEM, 0x0153, 0, nullptr); -packet(CMSG_GUILD_CHANGE_MEMBER_POS, 0x0155, 0, nullptr); -packet(CMSG_GUILD_LEAVE, 0x0159, 0, nullptr); -packet(CMSG_GUILD_EXPULSION, 0x015b, 0, nullptr); -packet(CMSG_GUILD_BREAK, 0x015d, 0, nullptr); -packet(CMSG_GUILD_CHANGE_POS_INFO, 0x0161, 0, nullptr); -packet(CMSG_GUILD_CREATE, 0x0165, 0, nullptr); -packet(CMSG_GUILD_INVITE, 0x0168, 0, nullptr); -packet(CMSG_GUILD_INVITE_REPLY, 0x016b, 0, nullptr); -packet(CMSG_GUILD_CHANGE_NOTICE, 0x016e, 0, nullptr); -packet(CMSG_GUILD_ALLIANCE_REQUEST, 0x0170, 0, nullptr); -packet(CMSG_GUILD_ALLIANCE_REPLY, 0x0172, 0, nullptr); -packet(CMSG_GUILD_MESSAGE, 0x017e, 0, nullptr); -packet(CMSG_GUILD_OPPOSITION, 0x0180, 0, nullptr); -packet(CMSG_GUILD_ALLIANCE_DELETE, 0x0183, 0, nullptr); - packet(CMSG_SOLVE_CHAR_NAME, 0x0193, 0, nullptr); packet(CMSG_IGNORE_NICK, 0x00cf, 0, nullptr); diff --git a/src/net/tmwa/serverfeatures.cpp b/src/net/tmwa/serverfeatures.cpp index a83a6362a..d1415be72 100644 --- a/src/net/tmwa/serverfeatures.cpp +++ b/src/net/tmwa/serverfeatures.cpp @@ -70,7 +70,7 @@ bool ServerFeatures::haveBrokenPlayerAttackDistance() const bool ServerFeatures::haveNativeGuilds() const { - return tmwServerVersion <= 0; + return false; } bool ServerFeatures::haveIncompleteChatMessages() const |