From abeebcba08ff2abc2993657b9043543223dce3d1 Mon Sep 17 00:00:00 2001 From: Thorbjørn Lindeijer Date: Tue, 13 Feb 2024 11:50:48 +0100 Subject: Removed no longer supported admin messages * Removed /announce command * Changed "Kick player" in player pop-up to kick by name Other messages, like CMSG_ADMIN_HIDE, CMSG_ADMIN_MUTE and CMSG_ADMIN_LOCAL_ANNOUNCE were already not used by the client. Also, none of this was implemented for Manaserv. --- src/commandhandler.cpp | 18 -------------- src/commandhandler.h | 5 ---- src/gui/popupmenu.cpp | 8 +++---- src/net/adminhandler.h | 20 ++-------------- src/net/manaserv/adminhandler.cpp | 35 ---------------------------- src/net/manaserv/adminhandler.h | 14 ----------- src/net/tmwa/adminhandler.cpp | 49 --------------------------------------- src/net/tmwa/adminhandler.h | 14 ----------- 8 files changed, 5 insertions(+), 158 deletions(-) (limited to 'src') diff --git a/src/commandhandler.cpp b/src/commandhandler.cpp index 923721e4..3211dcc3 100644 --- a/src/commandhandler.cpp +++ b/src/commandhandler.cpp @@ -59,10 +59,6 @@ void CommandHandler::handleCommand(const std::string &command, ChatTab *tab) { // Nothing to do } - else if (type == "announce") - { - handleAnnounce(args, tab); - } else if (type == "where") { handleWhere(args, tab); @@ -153,11 +149,6 @@ char CommandHandler::parseBoolean(const std::string &value) return -1; } -void CommandHandler::handleAnnounce(const std::string &args, ChatTab *tab) -{ - Net::getAdminHandler()->announce(args); -} - void CommandHandler::handleHelp(const std::string &args, ChatTab *tab) { if (args == "") @@ -197,8 +188,6 @@ void CommandHandler::handleHelp(const std::string &args, ChatTab *tab) tab->chatLog(_("/present > Get list of players present " "(sent to chat log, if logging)")); - tab->chatLog(_("/announce > Global announcement (GM only)")); - tab->showHelp(); // Allow the tab to show it's help tab->chatLog(_("For more information, type /help .")); @@ -215,13 +204,6 @@ void CommandHandler::handleHelp(const std::string &args, ChatTab *tab) { // Nothing to do } - else if (args == "announce") - { - tab->chatLog(_("Command: /announce ")); - tab->chatLog(_("*** only available to a GM ***")); - tab->chatLog(_("This command sends the message to " - "all players currently online.")); - } else if (args == "clear") { tab->chatLog(_("Command: /clear")); diff --git a/src/commandhandler.h b/src/commandhandler.h index 246b088d..2bf670c1 100644 --- a/src/commandhandler.h +++ b/src/commandhandler.h @@ -52,11 +52,6 @@ class CommandHandler friend class ChatTab; friend class WhisperTab; - /** - * Handle an announce command. - */ - void handleAnnounce(const std::string &args, ChatTab *tab); - /** * Handle a help command. */ diff --git a/src/gui/popupmenu.cpp b/src/gui/popupmenu.cpp index 4814937e..048ecc78 100644 --- a/src/gui/popupmenu.cpp +++ b/src/gui/popupmenu.cpp @@ -327,12 +327,10 @@ void PopupMenu::handleLink(const std::string &link) chatWindow->addInputText(name); } - else if (link == "admin-kick" && - being && - (being->getType() == ActorSprite::PLAYER || - being->getType() == ActorSprite::MONSTER)) + else if (link == "admin-kick" && being && + being->getType() == ActorSprite::PLAYER) { - Net::getAdminHandler()->kick(being->getId()); + Net::getAdminHandler()->kick(being->getName()); } // Unknown actions diff --git a/src/net/adminhandler.h b/src/net/adminhandler.h index ea436710..492918a7 100644 --- a/src/net/adminhandler.h +++ b/src/net/adminhandler.h @@ -22,36 +22,20 @@ #ifndef ADMINHANDLER_H #define ADMINHANDLER_H -#include +#include namespace Net { class AdminHandler { public: - virtual ~AdminHandler() {} - - virtual void announce(const std::string &text) = 0; - - virtual void localAnnounce(const std::string &text) = 0; - - virtual void hide(bool hide) = 0; - - virtual void kick(int playerId) = 0; + virtual ~AdminHandler() = default; virtual void kick(const std::string &name) = 0; - virtual void ban(int playerId) = 0; - virtual void ban(const std::string &name) = 0; - virtual void unban(int playerId) = 0; - virtual void unban(const std::string &name) = 0; - - virtual void mute(int playerId, int type, int limit) = 0; - - // TODO }; } // namespace Net diff --git a/src/net/manaserv/adminhandler.cpp b/src/net/manaserv/adminhandler.cpp index 8928a33d..8ba7c47d 100644 --- a/src/net/manaserv/adminhandler.cpp +++ b/src/net/manaserv/adminhandler.cpp @@ -46,54 +46,19 @@ void AdminHandler::handleMessage(MessageIn &msg) } -void AdminHandler::announce(const std::string &text) -{ - // TODO send warning about using @announce instead -} - -void AdminHandler::localAnnounce(const std::string &text) -{ - // TODO add @command for this -} - -void AdminHandler::hide(bool hide) -{ - // TODO -} - -void AdminHandler::kick(int playerId) -{ - // TODO -} - void AdminHandler::kick(const std::string &name) { // TODO } -void AdminHandler::ban(int playerId) -{ - // TODO -} - void AdminHandler::ban(const std::string &name) { // TODO } -void AdminHandler::unban(int playerId) -{ - // TODO -} - void AdminHandler::unban(const std::string &name) { // TODO } -void AdminHandler::mute(int playerId, int type, int limit) -{ - // TODO -} - } // namespace ManaServ diff --git a/src/net/manaserv/adminhandler.h b/src/net/manaserv/adminhandler.h index 1edcf6b6..e3bd02e0 100644 --- a/src/net/manaserv/adminhandler.h +++ b/src/net/manaserv/adminhandler.h @@ -35,25 +35,11 @@ class AdminHandler : public Net::AdminHandler, public MessageHandler void handleMessage(MessageIn &msg) override; - void announce(const std::string &text) override; - - void localAnnounce(const std::string &text) override; - - void hide(bool hide) override; - - void kick(int playerId) override; - void kick(const std::string &name) override; - void ban(int playerId) override; - void ban(const std::string &name) override; - void unban(int playerId) override; - void unban(const std::string &name) override; - - void mute(int playerId, int type, int limit) override; }; } // namespace ManaServ diff --git a/src/net/tmwa/adminhandler.cpp b/src/net/tmwa/adminhandler.cpp index 29202eb7..ce2a8264 100644 --- a/src/net/tmwa/adminhandler.cpp +++ b/src/net/tmwa/adminhandler.cpp @@ -24,18 +24,15 @@ #include "actorspritemanager.h" #include "being.h" #include "event.h" -#include "game.h" #include "playerrelations.h" #include "net/chathandler.h" #include "net/net.h" #include "net/tmwa/messagein.h" -#include "net/tmwa/messageout.h" #include "net/tmwa/protocol.h" #include "utils/gettext.h" -#include "utils/stringutils.h" #include @@ -79,65 +76,19 @@ void AdminHandler::handleMessage(MessageIn &msg) } } -void AdminHandler::announce(const std::string &text) -{ - MessageOut outMsg(CMSG_ADMIN_ANNOUNCE); - outMsg.writeInt16(text.length() + 4); - outMsg.writeString(text, text.length()); -} - -void AdminHandler::localAnnounce(const std::string &text) -{ - MessageOut outMsg(CMSG_ADMIN_LOCAL_ANNOUNCE); - outMsg.writeInt16(text.length() + 4); - outMsg.writeString(text, text.length()); -} - -void AdminHandler::hide(bool hide) -{ - MessageOut outMsg(CMSG_ADMIN_HIDE); - outMsg.writeInt32(0); //unused -} - -void AdminHandler::kick(int playerId) -{ - MessageOut outMsg(CMSG_ADMIN_KICK); - outMsg.writeInt32(playerId); -} - void AdminHandler::kick(const std::string &name) { Net::getChatHandler()->talk("@kick " + name); } -void AdminHandler::ban(int playerId) -{ - // Not supported -} - void AdminHandler::ban(const std::string &name) { Net::getChatHandler()->talk("@ban " + name); } -void AdminHandler::unban(int playerId) -{ - // Not supported -} - void AdminHandler::unban(const std::string &name) { Net::getChatHandler()->talk("@unban " + name); } -void AdminHandler::mute(int playerId, int type, int limit) -{ - return; // Still looking into this - - MessageOut outMsg(CMSG_ADMIN_MUTE); - outMsg.writeInt32(playerId); - outMsg.writeInt8(type); - outMsg.writeInt16(limit); -} - } // namespace TmwAthena diff --git a/src/net/tmwa/adminhandler.h b/src/net/tmwa/adminhandler.h index f91a093d..ce74fd8d 100644 --- a/src/net/tmwa/adminhandler.h +++ b/src/net/tmwa/adminhandler.h @@ -36,25 +36,11 @@ class AdminHandler : public MessageHandler, public Net::AdminHandler void handleMessage(MessageIn &msg) override; - void announce(const std::string &text) override; - - void localAnnounce(const std::string &text) override; - - void hide(bool hide) override; - - void kick(int playerId) override; - void kick(const std::string &name) override; - void ban(int playerId) override; - void ban(const std::string &name) override; - void unban(int playerId) override; - void unban(const std::string &name) override; - - void mute(int playerId, int type, int limit) override; }; } // namespace TmwAthena -- cgit v1.2.3-70-g09d2