From a5f9e965323ad4b211405736eda7557cbe6a013a Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 24 Feb 2013 15:44:24 +0300 Subject: Rename specialhandler to skillhandler. --- src/CMakeLists.txt | 14 +-- src/Makefile.am | 14 +-- src/gui/skilldialog.cpp | 6 +- src/localplayer.cpp | 2 +- src/net/ea/skillhandler.cpp | 237 +++++++++++++++++++++++++++++++++++++ src/net/ea/skillhandler.h | 53 +++++++++ src/net/ea/specialhandler.cpp | 237 ------------------------------------- src/net/ea/specialhandler.h | 53 --------- src/net/eathena/generalhandler.cpp | 6 +- src/net/eathena/generalhandler.h | 2 +- src/net/eathena/skillhandler.cpp | 96 +++++++++++++++ src/net/eathena/skillhandler.h | 54 +++++++++ src/net/eathena/specialhandler.cpp | 96 --------------- src/net/eathena/specialhandler.h | 54 --------- src/net/net.cpp | 8 +- src/net/net.h | 4 +- src/net/skillhandler.h | 46 +++++++ src/net/specialhandler.h | 46 ------- src/net/tmwa/generalhandler.cpp | 6 +- src/net/tmwa/generalhandler.h | 2 +- src/net/tmwa/skillhandler.cpp | 98 +++++++++++++++ src/net/tmwa/skillhandler.h | 54 +++++++++ src/net/tmwa/specialhandler.cpp | 98 --------------- src/net/tmwa/specialhandler.h | 54 --------- 24 files changed, 670 insertions(+), 670 deletions(-) create mode 100644 src/net/ea/skillhandler.cpp create mode 100644 src/net/ea/skillhandler.h delete mode 100644 src/net/ea/specialhandler.cpp delete mode 100644 src/net/ea/specialhandler.h create mode 100644 src/net/eathena/skillhandler.cpp create mode 100644 src/net/eathena/skillhandler.h delete mode 100644 src/net/eathena/specialhandler.cpp delete mode 100644 src/net/eathena/specialhandler.h create mode 100644 src/net/skillhandler.h delete mode 100644 src/net/specialhandler.h create mode 100644 src/net/tmwa/skillhandler.cpp create mode 100644 src/net/tmwa/skillhandler.h delete mode 100644 src/net/tmwa/specialhandler.cpp delete mode 100644 src/net/tmwa/specialhandler.h (limited to 'src') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index b32459621..d86d4d3de 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -400,7 +400,7 @@ SET(SRCS net/partyhandler.h net/playerhandler.h net/serverinfo.h - net/specialhandler.h + net/skillhandler.h net/tradehandler.h net/worldinfo.h net/packetcounters.cpp @@ -773,8 +773,8 @@ SET(SRCS_EVOL net/ea/partyhandler.h net/ea/playerhandler.cpp net/ea/playerhandler.h - net/ea/specialhandler.cpp - net/ea/specialhandler.h + net/ea/skillhandler.cpp + net/ea/skillhandler.h net/ea/token.h net/ea/tradehandler.cpp net/ea/tradehandler.h @@ -824,8 +824,8 @@ SET(SRCS_TMWA net/tmwa/protocol.h net/tmwa/questhandler.cpp net/tmwa/questhandler.h - net/tmwa/specialhandler.cpp - net/tmwa/specialhandler.h + net/tmwa/skillhandler.cpp + net/tmwa/skillhandler.h net/tmwa/tradehandler.cpp net/tmwa/tradehandler.h ) @@ -872,8 +872,8 @@ SET(SRCS_EATHENA net/eathena/playerhandler.cpp net/eathena/playerhandler.h net/eathena/protocol.h - net/eathena/specialhandler.cpp - net/eathena/specialhandler.h + net/eathena/skillhandler.cpp + net/eathena/skillhandler.h net/eathena/tradehandler.cpp net/eathena/tradehandler.h ) diff --git a/src/Makefile.am b/src/Makefile.am index 63e3247f6..b6cca8f67 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -401,7 +401,7 @@ manaplus_SOURCES += gui/widgets/avatarlistbox.cpp \ net/partyhandler.h \ net/playerhandler.h \ net/serverinfo.h \ - net/specialhandler.h \ + net/skillhandler.h \ net/tradehandler.h \ net/worldinfo.h \ net/packetcounters.cpp \ @@ -696,8 +696,8 @@ manaplus_SOURCES += \ net/ea/partyhandler.h \ net/ea/playerhandler.cpp \ net/ea/playerhandler.h \ - net/ea/specialhandler.cpp \ - net/ea/specialhandler.h \ + net/ea/skillhandler.cpp \ + net/ea/skillhandler.h \ net/ea/token.h \ net/ea/tradehandler.cpp \ net/ea/tradehandler.h \ @@ -744,8 +744,8 @@ manaplus_SOURCES += \ net/tmwa/protocol.h \ net/tmwa/questhandler.cpp \ net/tmwa/questhandler.h \ - net/tmwa/specialhandler.cpp \ - net/tmwa/specialhandler.h \ + net/tmwa/skillhandler.cpp \ + net/tmwa/skillhandler.h \ net/tmwa/tradehandler.cpp \ net/tmwa/tradehandler.h @@ -792,8 +792,8 @@ manaplus_SOURCES += net/eathena/gui/guildtab.cpp \ net/eathena/playerhandler.cpp \ net/eathena/playerhandler.h \ net/eathena/protocol.h \ - net/eathena/specialhandler.cpp \ - net/eathena/specialhandler.h \ + net/eathena/skillhandler.cpp \ + net/eathena/skillhandler.h \ net/eathena/tradehandler.cpp \ net/eathena/tradehandler.h endif diff --git a/src/gui/skilldialog.cpp b/src/gui/skilldialog.cpp index ee248562a..11b11ba8e 100644 --- a/src/gui/skilldialog.cpp +++ b/src/gui/skilldialog.cpp @@ -41,7 +41,7 @@ #include "net/net.h" #include "net/playerhandler.h" -#include "net/specialhandler.h" +#include "net/skillhandler.h" #include "resources/image.h" #include "resources/resourcemanager.h" @@ -345,7 +345,7 @@ void SkillDialog::action(const gcn::ActionEvent &event) const Being *const being = player_node->getTarget(); if (being) { - Net::getSpecialHandler()->useBeing(info->level, + Net::getSkillHandler()->useBeing(info->level, info->id, being->getId()); } } @@ -627,7 +627,7 @@ void SkillDialog::useItem(const int itemId) const Being *const being = player_node->getTarget(); if (being) { - Net::getSpecialHandler()->useBeing(info->level, + Net::getSkillHandler()->useBeing(info->level, info->id, being->getId()); } } diff --git a/src/localplayer.cpp b/src/localplayer.cpp index f7a95625f..a9213f75e 100644 --- a/src/localplayer.cpp +++ b/src/localplayer.cpp @@ -61,7 +61,7 @@ #include "net/net.h" #include "net/partyhandler.h" #include "net/playerhandler.h" -#include "net/specialhandler.h" +#include "net/skillhandler.h" #include "net/tradehandler.h" #include "resources/imageset.h" diff --git a/src/net/ea/skillhandler.cpp b/src/net/ea/skillhandler.cpp new file mode 100644 index 000000000..45177f7e6 --- /dev/null +++ b/src/net/ea/skillhandler.cpp @@ -0,0 +1,237 @@ +/* + * The ManaPlus Client + * Copyright (C) 2004-2009 The Mana World Development Team + * Copyright (C) 2009-2010 The Mana Developers + * Copyright (C) 2011-2013 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 . + */ + +#include "net/ea/skillhandler.h" + +#include "logger.h" +#include "localplayer.h" +#include "playerinfo.h" + +#include "gui/skilldialog.h" + +#include "gui/widgets/chattab.h" + +#include "net/messageout.h" + +#include "utils/gettext.h" + +#include "debug.h" + +/** job dependend identifiers (?) */ +static const unsigned int SKILL_BASIC = 0x0001; +static const unsigned int SKILL_WARP = 0x001b; +static const unsigned int SKILL_STEAL = 0x0032; +static const unsigned int SKILL_ENVENOM = 0x0034; + +/** basic skills identifiers */ +static const unsigned int BSKILL_TRADE = 0x0000; +static const unsigned int BSKILL_EMOTE = 0x0001; +static const unsigned int BSKILL_SIT = 0x0002; +static const unsigned int BSKILL_CREATECHAT = 0x0003; +static const unsigned int BSKILL_JOINPARTY = 0x0004; +static const unsigned int BSKILL_SHOUT = 0x0005; + +/** reasons why action failed */ +static const unsigned int RFAIL_SKILLDEP = 0x00; +static const unsigned int RFAIL_INSUFSP = 0x01; +static const unsigned int RFAIL_INSUFHP = 0x02; +static const unsigned int RFAIL_NOMEMO = 0x03; +static const unsigned int RFAIL_SKILLDELAY = 0x04; +static const unsigned int RFAIL_ZENY = 0x05; +static const unsigned int RFAIL_WEAPON = 0x06; +static const unsigned int RFAIL_REDGEM = 0x07; +static const unsigned int RFAIL_BLUEGEM = 0x08; +static const unsigned int RFAIL_OVERWEIGHT = 0x09; + +/** should always be zero if failed */ +static const unsigned int SKILL_FAILED = 0x00; + +namespace Ea +{ + +SkillHandler::SkillHandler() +{ +} + +void SkillHandler::use(int id A_UNUSED) +{ + // TODO +} + +void SkillHandler::processPlayerSkills(Net::MessageIn &msg) +{ + msg.readInt16(); // length + const int skillCount = (msg.getLength() - 4) / 37; + + for (int k = 0; k < skillCount; k++) + { + const int skillId = msg.readInt16(); + msg.readInt16(); // target type + msg.skip(2); // skill pool flags + const int level = msg.readInt16(); + msg.readInt16(); // sp + const int range = msg.readInt16(); + msg.skip(24); // 0 unused + const int up = msg.readInt8(); + + PlayerInfo::setStatBase(skillId, level); + if (skillDialog) + { + if (!skillDialog->updateSkill(skillId, range, up)) + skillDialog->addSkill(skillId, level, range, up); + } + } +} + +void SkillHandler::processPlayerSkillUp(Net::MessageIn &msg) +{ + const int skillId = msg.readInt16(); + const int level = msg.readInt16(); + msg.readInt16(); // sp + const int range = msg.readInt16(); + const int up = msg.readInt8(); + + PlayerInfo::setStatBase(skillId, level); + if (skillDialog) + { + if (!skillDialog->updateSkill(skillId, range, up)) + skillDialog->addSkill(skillId, level, range, up); + } +} + +void SkillHandler::processSkillFailed(Net::MessageIn &msg) +{ + // Action failed (ex. sit because you have not reached the + // right level) + const int skillId = msg.readInt16(); + const short bskill = msg.readInt16(); + msg.readInt16(); // btype + const signed char success = msg.readInt8(); + const signed char reason = msg.readInt8(); + if (success != static_cast(SKILL_FAILED) + && bskill == static_cast(BSKILL_EMOTE)) + { + logger->log("Action: %d/%d", bskill, success); + } + + std::string txt; + if (success == static_cast(SKILL_FAILED) + && skillId == static_cast(SKILL_BASIC)) + { + if (player_node && bskill == static_cast(BSKILL_EMOTE) + && reason == static_cast(RFAIL_SKILLDEP)) + { + player_node->stopAdvert(); + } + + switch (bskill) + { + case BSKILL_TRADE: + txt = _("Trade failed!"); + break; + case BSKILL_EMOTE: + txt = _("Emote failed!"); + break; + case BSKILL_SIT: + txt = _("Sit failed!"); + break; + case BSKILL_CREATECHAT: + txt = _("Chat creating failed!"); + break; + case BSKILL_JOINPARTY: + txt = _("Could not join party!"); + break; + case BSKILL_SHOUT: + txt = _("Cannot shout!"); + break; + default: + logger->log("QQQ SMSG_SKILL_FAILED: bskill " + + toString(bskill)); + break; + } + + txt += " "; + + switch (reason) + { + case RFAIL_SKILLDEP: + txt += _("You have not yet reached a high enough lvl!"); + break; + case RFAIL_INSUFHP: + txt += _("Insufficient HP!"); + break; + case RFAIL_INSUFSP: + txt += _("Insufficient SP!"); + break; + case RFAIL_NOMEMO: + txt += _("You have no memos!"); + break; + case RFAIL_SKILLDELAY: + txt += _("You cannot do that right now!"); + break; + case RFAIL_ZENY: + txt += _("Seems you need more money... ;-)"); + break; + case RFAIL_WEAPON: + txt += _("You cannot use this skill with that " + "kind of weapon!"); + break; + case RFAIL_REDGEM: + txt += _("You need another red gem!"); + break; + case RFAIL_BLUEGEM: + txt += _("You need another blue gem!"); + break; + case RFAIL_OVERWEIGHT: + txt += _("You're carrying to much to do this!"); + break; + default: + txt += _("Huh? What's that?"); + logger->log("QQQ SMSG_SKILL_FAILED: reason " + + toString(reason)); + break; + } + } + else + { + switch (skillId) + { + case SKILL_WARP : + txt = _("Warp failed..."); + break; + case SKILL_STEAL : + txt = _("Could not steal anything..."); + break; + case SKILL_ENVENOM : + txt = _("Poison had no effect..."); + break; + default: + logger->log("QQQ SMSG_SKILL_FAILED: skillId " + + toString(skillId)); + break; + } + } + + if (localChatTab) + localChatTab->chatLog(txt); +} +} // namespace Ea diff --git a/src/net/ea/skillhandler.h b/src/net/ea/skillhandler.h new file mode 100644 index 000000000..c07cb7c46 --- /dev/null +++ b/src/net/ea/skillhandler.h @@ -0,0 +1,53 @@ +/* + * The ManaPlus Client + * Copyright (C) 2004-2009 The Mana World Development Team + * Copyright (C) 2009-2010 The Mana Developers + * Copyright (C) 2011-2013 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 . + */ + +#ifndef NET_EA_SKILLHANDLER_H +#define NET_EA_SKILLHANDLER_H + +#include "net/messagein.h" +#include "net/net.h" +#include "net/skillhandler.h" + +namespace Ea +{ + +class SkillHandler : public Net::SkillHandler +{ + public: + SkillHandler(); + + A_DELETE_COPY(SkillHandler) + + void handleMessage(Net::MessageIn &msg); + + void use(int id); + + void processPlayerSkills(Net::MessageIn &msg); + + void processPlayerSkillUp(Net::MessageIn &msg); + + void processSkillFailed(Net::MessageIn &msg); +}; + +} // namespace Ea + +#endif // NET_EA_SKILLHANDLER_H diff --git a/src/net/ea/specialhandler.cpp b/src/net/ea/specialhandler.cpp deleted file mode 100644 index 6f9b346a3..000000000 --- a/src/net/ea/specialhandler.cpp +++ /dev/null @@ -1,237 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2004-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2013 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 . - */ - -#include "net/ea/specialhandler.h" - -#include "logger.h" -#include "localplayer.h" -#include "playerinfo.h" - -#include "gui/skilldialog.h" - -#include "gui/widgets/chattab.h" - -#include "net/messageout.h" - -#include "utils/gettext.h" - -#include "debug.h" - -/** job dependend identifiers (?) */ -static const unsigned int SKILL_BASIC = 0x0001; -static const unsigned int SKILL_WARP = 0x001b; -static const unsigned int SKILL_STEAL = 0x0032; -static const unsigned int SKILL_ENVENOM = 0x0034; - -/** basic skills identifiers */ -static const unsigned int BSKILL_TRADE = 0x0000; -static const unsigned int BSKILL_EMOTE = 0x0001; -static const unsigned int BSKILL_SIT = 0x0002; -static const unsigned int BSKILL_CREATECHAT = 0x0003; -static const unsigned int BSKILL_JOINPARTY = 0x0004; -static const unsigned int BSKILL_SHOUT = 0x0005; - -/** reasons why action failed */ -static const unsigned int RFAIL_SKILLDEP = 0x00; -static const unsigned int RFAIL_INSUFSP = 0x01; -static const unsigned int RFAIL_INSUFHP = 0x02; -static const unsigned int RFAIL_NOMEMO = 0x03; -static const unsigned int RFAIL_SKILLDELAY = 0x04; -static const unsigned int RFAIL_ZENY = 0x05; -static const unsigned int RFAIL_WEAPON = 0x06; -static const unsigned int RFAIL_REDGEM = 0x07; -static const unsigned int RFAIL_BLUEGEM = 0x08; -static const unsigned int RFAIL_OVERWEIGHT = 0x09; - -/** should always be zero if failed */ -static const unsigned int SKILL_FAILED = 0x00; - -namespace Ea -{ - -SpecialHandler::SpecialHandler() -{ -} - -void SpecialHandler::use(int id A_UNUSED) -{ - // TODO -} - -void SpecialHandler::processPlayerSkills(Net::MessageIn &msg) -{ - msg.readInt16(); // length - const int skillCount = (msg.getLength() - 4) / 37; - - for (int k = 0; k < skillCount; k++) - { - const int skillId = msg.readInt16(); - msg.readInt16(); // target type - msg.skip(2); // skill pool flags - const int level = msg.readInt16(); - msg.readInt16(); // sp - const int range = msg.readInt16(); - msg.skip(24); // 0 unused - const int up = msg.readInt8(); - - PlayerInfo::setStatBase(skillId, level); - if (skillDialog) - { - if (!skillDialog->updateSkill(skillId, range, up)) - skillDialog->addSkill(skillId, level, range, up); - } - } -} - -void SpecialHandler::processPlayerSkillUp(Net::MessageIn &msg) -{ - const int skillId = msg.readInt16(); - const int level = msg.readInt16(); - msg.readInt16(); // sp - const int range = msg.readInt16(); - const int up = msg.readInt8(); - - PlayerInfo::setStatBase(skillId, level); - if (skillDialog) - { - if (!skillDialog->updateSkill(skillId, range, up)) - skillDialog->addSkill(skillId, level, range, up); - } -} - -void SpecialHandler::processSkillFailed(Net::MessageIn &msg) -{ - // Action failed (ex. sit because you have not reached the - // right level) - const int skillId = msg.readInt16(); - const short bskill = msg.readInt16(); - msg.readInt16(); // btype - const signed char success = msg.readInt8(); - const signed char reason = msg.readInt8(); - if (success != static_cast(SKILL_FAILED) - && bskill == static_cast(BSKILL_EMOTE)) - { - logger->log("Action: %d/%d", bskill, success); - } - - std::string txt; - if (success == static_cast(SKILL_FAILED) - && skillId == static_cast(SKILL_BASIC)) - { - if (player_node && bskill == static_cast(BSKILL_EMOTE) - && reason == static_cast(RFAIL_SKILLDEP)) - { - player_node->stopAdvert(); - } - - switch (bskill) - { - case BSKILL_TRADE: - txt = _("Trade failed!"); - break; - case BSKILL_EMOTE: - txt = _("Emote failed!"); - break; - case BSKILL_SIT: - txt = _("Sit failed!"); - break; - case BSKILL_CREATECHAT: - txt = _("Chat creating failed!"); - break; - case BSKILL_JOINPARTY: - txt = _("Could not join party!"); - break; - case BSKILL_SHOUT: - txt = _("Cannot shout!"); - break; - default: - logger->log("QQQ SMSG_SKILL_FAILED: bskill " - + toString(bskill)); - break; - } - - txt += " "; - - switch (reason) - { - case RFAIL_SKILLDEP: - txt += _("You have not yet reached a high enough lvl!"); - break; - case RFAIL_INSUFHP: - txt += _("Insufficient HP!"); - break; - case RFAIL_INSUFSP: - txt += _("Insufficient SP!"); - break; - case RFAIL_NOMEMO: - txt += _("You have no memos!"); - break; - case RFAIL_SKILLDELAY: - txt += _("You cannot do that right now!"); - break; - case RFAIL_ZENY: - txt += _("Seems you need more money... ;-)"); - break; - case RFAIL_WEAPON: - txt += _("You cannot use this skill with that " - "kind of weapon!"); - break; - case RFAIL_REDGEM: - txt += _("You need another red gem!"); - break; - case RFAIL_BLUEGEM: - txt += _("You need another blue gem!"); - break; - case RFAIL_OVERWEIGHT: - txt += _("You're carrying to much to do this!"); - break; - default: - txt += _("Huh? What's that?"); - logger->log("QQQ SMSG_SKILL_FAILED: reason " - + toString(reason)); - break; - } - } - else - { - switch (skillId) - { - case SKILL_WARP : - txt = _("Warp failed..."); - break; - case SKILL_STEAL : - txt = _("Could not steal anything..."); - break; - case SKILL_ENVENOM : - txt = _("Poison had no effect..."); - break; - default: - logger->log("QQQ SMSG_SKILL_FAILED: skillId " - + toString(skillId)); - break; - } - } - - if (localChatTab) - localChatTab->chatLog(txt); -} -} // namespace Ea diff --git a/src/net/ea/specialhandler.h b/src/net/ea/specialhandler.h deleted file mode 100644 index 3c3317251..000000000 --- a/src/net/ea/specialhandler.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2004-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2013 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 . - */ - -#ifndef NET_EA_SKILLHANDLER_H -#define NET_EA_SKILLHANDLER_H - -#include "net/messagein.h" -#include "net/net.h" -#include "net/specialhandler.h" - -namespace Ea -{ - -class SpecialHandler : public Net::SpecialHandler -{ - public: - SpecialHandler(); - - A_DELETE_COPY(SpecialHandler) - - void handleMessage(Net::MessageIn &msg); - - void use(int id); - - void processPlayerSkills(Net::MessageIn &msg); - - void processPlayerSkillUp(Net::MessageIn &msg); - - void processSkillFailed(Net::MessageIn &msg); -}; - -} // namespace Ea - -#endif // NET_EA_SKILLHANDLER_H diff --git a/src/net/eathena/generalhandler.cpp b/src/net/eathena/generalhandler.cpp index 5ac27b5cc..c656b944d 100644 --- a/src/net/eathena/generalhandler.cpp +++ b/src/net/eathena/generalhandler.cpp @@ -53,7 +53,7 @@ #include "net/eathena/playerhandler.h" #include "net/eathena/protocol.h" #include "net/eathena/tradehandler.h" -#include "net/eathena/specialhandler.h" +#include "net/eathena/skillhandler.h" #include "net/eathena/gui/guildtab.h" #include "net/eathena/gui/partytab.h" @@ -87,7 +87,7 @@ GeneralHandler::GeneralHandler() : mNpcHandler(new NpcHandler), mPartyHandler(new PartyHandler), mPlayerHandler(new PlayerHandler), - mSpecialHandler(new SpecialHandler), + mSkillHandler(new SkillHandler), mTradeHandler(new TradeHandler) { static const uint16_t _messages[] = @@ -183,7 +183,7 @@ void GeneralHandler::load() mNetwork->registerHandler(mLoginHandler.get()); mNetwork->registerHandler(mNpcHandler.get()); mNetwork->registerHandler(mPlayerHandler.get()); - mNetwork->registerHandler(mSpecialHandler.get()); + mNetwork->registerHandler(mSkillHandler.get()); mNetwork->registerHandler(mTradeHandler.get()); mNetwork->registerHandler(mPartyHandler.get()); } diff --git a/src/net/eathena/generalhandler.h b/src/net/eathena/generalhandler.h index 23b9cf66b..58c0d1e2e 100644 --- a/src/net/eathena/generalhandler.h +++ b/src/net/eathena/generalhandler.h @@ -77,7 +77,7 @@ class GeneralHandler final : public MessageHandler, MessageHandlerPtr mNpcHandler; MessageHandlerPtr mPartyHandler; MessageHandlerPtr mPlayerHandler; - MessageHandlerPtr mSpecialHandler; + MessageHandlerPtr mSkillHandler; MessageHandlerPtr mTradeHandler; }; diff --git a/src/net/eathena/skillhandler.cpp b/src/net/eathena/skillhandler.cpp new file mode 100644 index 000000000..a36ba7435 --- /dev/null +++ b/src/net/eathena/skillhandler.cpp @@ -0,0 +1,96 @@ +/* + * The ManaPlus Client + * Copyright (C) 2004-2009 The Mana World Development Team + * Copyright (C) 2009-2010 The Mana Developers + * Copyright (C) 2011-2013 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 . + */ + +#include "net/eathena/skillhandler.h" + +#include "logger.h" + +#include "net/eathena/protocol.h" + +#include "debug.h" + +extern Net::SkillHandler *skillHandler; + +namespace EAthena +{ + +SkillHandler::SkillHandler() : + MessageHandler(), + Ea::SkillHandler() +{ + static const uint16_t _messages[] = + { + SMSG_PLAYER_SKILLS, + SMSG_SKILL_FAILED, + SMSG_PLAYER_SKILL_UP, + 0 + }; + handledMessages = _messages; + skillHandler = this; +} + +void SkillHandler::handleMessage(Net::MessageIn &msg) +{ + switch (msg.getId()) + { + case SMSG_PLAYER_SKILLS: + processPlayerSkills(msg); + break; + + case SMSG_PLAYER_SKILL_UP: + processPlayerSkillUp(msg); + break; + + case SMSG_SKILL_FAILED: + processSkillFailed(msg); + break; + + default: + break; + } +} + +void SkillHandler::useBeing(int id, int level, int beingId) +{ + MessageOut outMsg(CMSG_SKILL_USE_BEING); + outMsg.writeInt16(static_cast(id)); + outMsg.writeInt16(static_cast(level)); + outMsg.writeInt32(beingId); +} + +void SkillHandler::usePos(int id, int level, int x, int y) +{ + MessageOut outMsg(CMSG_SKILL_USE_POSITION); + outMsg.writeInt16(static_cast(level)); + outMsg.writeInt16(static_cast(id)); + outMsg.writeInt16(static_cast(x)); + outMsg.writeInt16(static_cast(y)); +} + +void SkillHandler::useMap(int id, const std::string &map) +{ + MessageOut outMsg(CMSG_SKILL_USE_MAP); + outMsg.writeInt16(static_cast(id)); + outMsg.writeString(map, 16); +} + +} // namespace EAthena diff --git a/src/net/eathena/skillhandler.h b/src/net/eathena/skillhandler.h new file mode 100644 index 000000000..be2025da7 --- /dev/null +++ b/src/net/eathena/skillhandler.h @@ -0,0 +1,54 @@ +/* + * The ManaPlus Client + * Copyright (C) 2004-2009 The Mana World Development Team + * Copyright (C) 2009-2010 The Mana Developers + * Copyright (C) 2011-2013 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 . + */ + +#ifndef NET_EATHENA_SKILLHANDLER_H +#define NET_EATHENA_SKILLHANDLER_H + +#include "net/net.h" +#include "net/skillhandler.h" + +#include "net/ea/skillhandler.h" + +#include "net/eathena/messagehandler.h" + +namespace EAthena +{ + +class SkillHandler final : public MessageHandler, public Ea::SkillHandler +{ + public: + SkillHandler(); + + A_DELETE_COPY(SkillHandler) + + void handleMessage(Net::MessageIn &msg); + + void useBeing(int id, int level, int beingId); + + void usePos(int id, int level, int x, int y); + + void useMap(int id, const std::string &map); +}; + +} // namespace EAthena + +#endif // NET_EATHENA_SKILLHANDLER_H diff --git a/src/net/eathena/specialhandler.cpp b/src/net/eathena/specialhandler.cpp deleted file mode 100644 index e30dc6024..000000000 --- a/src/net/eathena/specialhandler.cpp +++ /dev/null @@ -1,96 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2004-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2013 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 . - */ - -#include "net/eathena/specialhandler.h" - -#include "logger.h" - -#include "net/eathena/protocol.h" - -#include "debug.h" - -extern Net::SpecialHandler *specialHandler; - -namespace EAthena -{ - -SpecialHandler::SpecialHandler() : - MessageHandler(), - Ea::SpecialHandler() -{ - static const uint16_t _messages[] = - { - SMSG_PLAYER_SKILLS, - SMSG_SKILL_FAILED, - SMSG_PLAYER_SKILL_UP, - 0 - }; - handledMessages = _messages; - specialHandler = this; -} - -void SpecialHandler::handleMessage(Net::MessageIn &msg) -{ - switch (msg.getId()) - { - case SMSG_PLAYER_SKILLS: - processPlayerSkills(msg); - break; - - case SMSG_PLAYER_SKILL_UP: - processPlayerSkillUp(msg); - break; - - case SMSG_SKILL_FAILED: - processSkillFailed(msg); - break; - - default: - break; - } -} - -void SpecialHandler::useBeing(int id, int level, int beingId) -{ - MessageOut outMsg(CMSG_SKILL_USE_BEING); - outMsg.writeInt16(static_cast(id)); - outMsg.writeInt16(static_cast(level)); - outMsg.writeInt32(beingId); -} - -void SpecialHandler::usePos(int id, int level, int x, int y) -{ - MessageOut outMsg(CMSG_SKILL_USE_POSITION); - outMsg.writeInt16(static_cast(level)); - outMsg.writeInt16(static_cast(id)); - outMsg.writeInt16(static_cast(x)); - outMsg.writeInt16(static_cast(y)); -} - -void SpecialHandler::useMap(int id, const std::string &map) -{ - MessageOut outMsg(CMSG_SKILL_USE_MAP); - outMsg.writeInt16(static_cast(id)); - outMsg.writeString(map, 16); -} - -} // namespace EAthena diff --git a/src/net/eathena/specialhandler.h b/src/net/eathena/specialhandler.h deleted file mode 100644 index 8e77a8439..000000000 --- a/src/net/eathena/specialhandler.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2004-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2013 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 . - */ - -#ifndef NET_EATHENA_SKILLHANDLER_H -#define NET_EATHENA_SKILLHANDLER_H - -#include "net/net.h" -#include "net/specialhandler.h" - -#include "net/ea/specialhandler.h" - -#include "net/eathena/messagehandler.h" - -namespace EAthena -{ - -class SpecialHandler final : public MessageHandler, public Ea::SpecialHandler -{ - public: - SpecialHandler(); - - A_DELETE_COPY(SpecialHandler) - - void handleMessage(Net::MessageIn &msg); - - void useBeing(int id, int level, int beingId); - - void usePos(int id, int level, int x, int y); - - void useMap(int id, const std::string &map); -}; - -} // namespace EAthena - -#endif // NET_EATHENA_SKILLHANDLER_H diff --git a/src/net/net.cpp b/src/net/net.cpp index af8c9ad1d..e614f9dc6 100644 --- a/src/net/net.cpp +++ b/src/net/net.cpp @@ -37,7 +37,7 @@ #include "net/npchandler.h" #include "net/partyhandler.h" #include "net/playerhandler.h" -#include "net/specialhandler.h" +#include "net/skillhandler.h" #include "net/tradehandler.h" #include "net/tmwa/generalhandler.h" @@ -63,7 +63,7 @@ Net::GuildHandler *guildHandler = nullptr; Net::NpcHandler *npcHandler = nullptr; Net::PartyHandler *partyHandler = nullptr; Net::PlayerHandler *playerHandler = nullptr; -Net::SpecialHandler *specialHandler = nullptr; +Net::SkillHandler *skillHandler = nullptr; Net::TradeHandler *tradeHandler = nullptr; Net::BeingHandler *beingHandler = nullptr; Net::BuySellHandler *buySellHandler = nullptr; @@ -123,9 +123,9 @@ Net::PlayerHandler *Net::getPlayerHandler() return playerHandler; } -Net::SpecialHandler *Net::getSpecialHandler() +Net::SkillHandler *Net::getSkillHandler() { - return specialHandler; + return skillHandler; } Net::TradeHandler *Net::getTradeHandler() diff --git a/src/net/net.h b/src/net/net.h index b92d470f0..0be63a3de 100644 --- a/src/net/net.h +++ b/src/net/net.h @@ -48,7 +48,7 @@ class LoginHandler; class NpcHandler; class PartyHandler; class PlayerHandler; -class SpecialHandler; +class SkillHandler; class TradeHandler; class BuySellHandler; @@ -64,7 +64,7 @@ LoginHandler *getLoginHandler() A_WARN_UNUSED; NpcHandler *getNpcHandler() A_WARN_UNUSED; PartyHandler *getPartyHandler() A_WARN_UNUSED; PlayerHandler *getPlayerHandler() A_WARN_UNUSED; -SpecialHandler *getSpecialHandler() A_WARN_UNUSED; +SkillHandler *getSkillHandler() A_WARN_UNUSED; TradeHandler *getTradeHandler() A_WARN_UNUSED; BuySellHandler *getBuySellHandler() A_WARN_UNUSED; diff --git a/src/net/skillhandler.h b/src/net/skillhandler.h new file mode 100644 index 000000000..fa044ebd6 --- /dev/null +++ b/src/net/skillhandler.h @@ -0,0 +1,46 @@ +/* + * The ManaPlus Client + * Copyright (C) 2009 The Mana World Development Team + * Copyright (C) 2009-2010 The Mana Developers + * Copyright (C) 2011-2013 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 . + */ + +#ifndef SKILLHANDLER_H +#define SKILLHANDLER_H + +#include + +namespace Net +{ +class SkillHandler +{ + public: + virtual ~SkillHandler () + { } + + virtual void use(int id) = 0; + + virtual void useBeing(int id, int level, int beingId) = 0; + + virtual void usePos(int id, int level, int x, int y) = 0; + + virtual void useMap(int id, const std::string &map) = 0; +}; +} + +#endif // SKILLHANDLER_H diff --git a/src/net/specialhandler.h b/src/net/specialhandler.h deleted file mode 100644 index dea0719e0..000000000 --- a/src/net/specialhandler.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2013 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 . - */ - -#ifndef SPECIALHANDLER_H -#define SPECIALHANDLER_H - -#include - -namespace Net -{ -class SpecialHandler -{ - public: - virtual ~SpecialHandler () - { } - - virtual void use(int id) = 0; - - virtual void useBeing(int id, int level, int beingId) = 0; - - virtual void usePos(int id, int level, int x, int y) = 0; - - virtual void useMap(int id, const std::string &map) = 0; -}; -} - -#endif // SPECIALHANDLER_H diff --git a/src/net/tmwa/generalhandler.cpp b/src/net/tmwa/generalhandler.cpp index dc1ae6aba..c366efc9d 100644 --- a/src/net/tmwa/generalhandler.cpp +++ b/src/net/tmwa/generalhandler.cpp @@ -53,7 +53,7 @@ #include "net/tmwa/playerhandler.h" #include "net/tmwa/protocol.h" #include "net/tmwa/tradehandler.h" -#include "net/tmwa/specialhandler.h" +#include "net/tmwa/skillhandler.h" #include "net/tmwa/questhandler.h" #include "net/tmwa/gui/guildtab.h" @@ -88,7 +88,7 @@ GeneralHandler::GeneralHandler() : mNpcHandler(new NpcHandler), mPartyHandler(new PartyHandler), mPlayerHandler(new PlayerHandler), - mSpecialHandler(new SpecialHandler), + mSkillHandler(new SkillHandler), mTradeHandler(new TradeHandler), mQuestHandler(new QuestHandler) { @@ -187,7 +187,7 @@ void GeneralHandler::load() mNetwork->registerHandler(mLoginHandler.get()); mNetwork->registerHandler(mNpcHandler.get()); mNetwork->registerHandler(mPlayerHandler.get()); - mNetwork->registerHandler(mSpecialHandler.get()); + mNetwork->registerHandler(mSkillHandler.get()); mNetwork->registerHandler(mTradeHandler.get()); mNetwork->registerHandler(mPartyHandler.get()); mNetwork->registerHandler(mQuestHandler.get()); diff --git a/src/net/tmwa/generalhandler.h b/src/net/tmwa/generalhandler.h index f404d939e..2fcc625d1 100644 --- a/src/net/tmwa/generalhandler.h +++ b/src/net/tmwa/generalhandler.h @@ -74,7 +74,7 @@ class GeneralHandler final : public MessageHandler, public Net::GeneralHandler, MessageHandlerPtr mNpcHandler; MessageHandlerPtr mPartyHandler; MessageHandlerPtr mPlayerHandler; - MessageHandlerPtr mSpecialHandler; + MessageHandlerPtr mSkillHandler; MessageHandlerPtr mTradeHandler; MessageHandlerPtr mQuestHandler; }; diff --git a/src/net/tmwa/skillhandler.cpp b/src/net/tmwa/skillhandler.cpp new file mode 100644 index 000000000..72ab4b6ec --- /dev/null +++ b/src/net/tmwa/skillhandler.cpp @@ -0,0 +1,98 @@ +/* + * The ManaPlus Client + * Copyright (C) 2004-2009 The Mana World Development Team + * Copyright (C) 2009-2010 The Mana Developers + * Copyright (C) 2011-2013 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 . + */ + +#include "net/tmwa/skillhandler.h" + +#include "logger.h" + +#include "net/tmwa/protocol.h" + +#include "debug.h" + +extern Net::SkillHandler *skillHandler; + +namespace TmwAthena +{ + +SkillHandler::SkillHandler() : + MessageHandler(), + Ea::SkillHandler() +{ + static const uint16_t _messages[] = + { + SMSG_PLAYER_SKILLS, + SMSG_SKILL_FAILED, + SMSG_PLAYER_SKILL_UP, + 0 + }; + handledMessages = _messages; + skillHandler = this; +} + +void SkillHandler::handleMessage(Net::MessageIn &msg) +{ + BLOCK_START("SkillHandler::handleMessage") + switch (msg.getId()) + { + case SMSG_PLAYER_SKILLS: + processPlayerSkills(msg); + break; + + case SMSG_PLAYER_SKILL_UP: + processPlayerSkillUp(msg); + break; + + case SMSG_SKILL_FAILED: + processSkillFailed(msg); + break; + + default: + break; + } + BLOCK_END("SkillHandler::handleMessage") +} + +void SkillHandler::useBeing(int id, int level, int beingId) +{ + MessageOut outMsg(CMSG_SKILL_USE_BEING); + outMsg.writeInt16(static_cast(id)); + outMsg.writeInt16(static_cast(level)); + outMsg.writeInt32(beingId); +} + +void SkillHandler::usePos(int id, int level, int x, int y) +{ + MessageOut outMsg(CMSG_SKILL_USE_POSITION); + outMsg.writeInt16(static_cast(level)); + outMsg.writeInt16(static_cast(id)); + outMsg.writeInt16(static_cast(x)); + outMsg.writeInt16(static_cast(y)); +} + +void SkillHandler::useMap(int id, const std::string &map) +{ + MessageOut outMsg(CMSG_SKILL_USE_MAP); + outMsg.writeInt16(static_cast(id)); + outMsg.writeString(map, 16); +} + +} // namespace TmwAthena diff --git a/src/net/tmwa/skillhandler.h b/src/net/tmwa/skillhandler.h new file mode 100644 index 000000000..a7db40a2d --- /dev/null +++ b/src/net/tmwa/skillhandler.h @@ -0,0 +1,54 @@ +/* + * The ManaPlus Client + * Copyright (C) 2004-2009 The Mana World Development Team + * Copyright (C) 2009-2010 The Mana Developers + * Copyright (C) 2011-2013 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 . + */ + +#ifndef NET_TA_SKILLHANDLER_H +#define NET_TA_SKILLHANDLER_H + +#include "net/net.h" +#include "net/skillhandler.h" + +#include "net/ea/skillhandler.h" + +#include "net/tmwa/messagehandler.h" + +namespace TmwAthena +{ + +class SkillHandler final : public MessageHandler, public Ea::SkillHandler +{ + public: + SkillHandler(); + + A_DELETE_COPY(SkillHandler) + + void handleMessage(Net::MessageIn &msg); + + void useBeing(int id, int level, int beingId); + + void usePos(int id, int level, int x, int y); + + void useMap(int id, const std::string &map); +}; + +} // namespace TmwAthena + +#endif // NET_TA_SKILLHANDLER_H diff --git a/src/net/tmwa/specialhandler.cpp b/src/net/tmwa/specialhandler.cpp deleted file mode 100644 index 51f447282..000000000 --- a/src/net/tmwa/specialhandler.cpp +++ /dev/null @@ -1,98 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2004-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2013 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 . - */ - -#include "net/tmwa/specialhandler.h" - -#include "logger.h" - -#include "net/tmwa/protocol.h" - -#include "debug.h" - -extern Net::SpecialHandler *specialHandler; - -namespace TmwAthena -{ - -SpecialHandler::SpecialHandler() : - MessageHandler(), - Ea::SpecialHandler() -{ - static const uint16_t _messages[] = - { - SMSG_PLAYER_SKILLS, - SMSG_SKILL_FAILED, - SMSG_PLAYER_SKILL_UP, - 0 - }; - handledMessages = _messages; - specialHandler = this; -} - -void SpecialHandler::handleMessage(Net::MessageIn &msg) -{ - BLOCK_START("SpecialHandler::handleMessage") - switch (msg.getId()) - { - case SMSG_PLAYER_SKILLS: - processPlayerSkills(msg); - break; - - case SMSG_PLAYER_SKILL_UP: - processPlayerSkillUp(msg); - break; - - case SMSG_SKILL_FAILED: - processSkillFailed(msg); - break; - - default: - break; - } - BLOCK_END("SpecialHandler::handleMessage") -} - -void SpecialHandler::useBeing(int id, int level, int beingId) -{ - MessageOut outMsg(CMSG_SKILL_USE_BEING); - outMsg.writeInt16(static_cast(id)); - outMsg.writeInt16(static_cast(level)); - outMsg.writeInt32(beingId); -} - -void SpecialHandler::usePos(int id, int level, int x, int y) -{ - MessageOut outMsg(CMSG_SKILL_USE_POSITION); - outMsg.writeInt16(static_cast(level)); - outMsg.writeInt16(static_cast(id)); - outMsg.writeInt16(static_cast(x)); - outMsg.writeInt16(static_cast(y)); -} - -void SpecialHandler::useMap(int id, const std::string &map) -{ - MessageOut outMsg(CMSG_SKILL_USE_MAP); - outMsg.writeInt16(static_cast(id)); - outMsg.writeString(map, 16); -} - -} // namespace TmwAthena diff --git a/src/net/tmwa/specialhandler.h b/src/net/tmwa/specialhandler.h deleted file mode 100644 index 5a72e59b7..000000000 --- a/src/net/tmwa/specialhandler.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2004-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2013 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 . - */ - -#ifndef NET_TA_SKILLHANDLER_H -#define NET_TA_SKILLHANDLER_H - -#include "net/net.h" -#include "net/specialhandler.h" - -#include "net/ea/specialhandler.h" - -#include "net/tmwa/messagehandler.h" - -namespace TmwAthena -{ - -class SpecialHandler final : public MessageHandler, public Ea::SpecialHandler -{ - public: - SpecialHandler(); - - A_DELETE_COPY(SpecialHandler) - - void handleMessage(Net::MessageIn &msg); - - void useBeing(int id, int level, int beingId); - - void usePos(int id, int level, int x, int y); - - void useMap(int id, const std::string &map); -}; - -} // namespace TmwAthena - -#endif // NET_TA_SKILLHANDLER_H -- cgit v1.2.3-60-g2f50