diff options
Diffstat (limited to 'src/net/ea')
-rw-r--r-- | src/net/ea/gui/guildtab.cpp | 55 | ||||
-rw-r--r-- | src/net/ea/gui/guildtab.h | 4 | ||||
-rw-r--r-- | src/net/ea/gui/partytab.cpp | 91 | ||||
-rw-r--r-- | src/net/ea/gui/partytab.h | 6 | ||||
-rw-r--r-- | src/net/ea/inventoryhandler.cpp | 6 | ||||
-rw-r--r-- | src/net/ea/inventoryhandler.h | 6 | ||||
-rw-r--r-- | src/net/ea/itemhandler.cpp | 6 | ||||
-rw-r--r-- | src/net/ea/itemhandler.h | 6 | ||||
-rw-r--r-- | src/net/ea/playerhandler.cpp | 18 | ||||
-rw-r--r-- | src/net/ea/playerhandler.h | 18 | ||||
-rw-r--r-- | src/net/ea/skillhandler.cpp | 6 | ||||
-rw-r--r-- | src/net/ea/skillhandler.h | 6 | ||||
-rw-r--r-- | src/net/ea/tradehandler.cpp | 10 | ||||
-rw-r--r-- | src/net/ea/tradehandler.h | 10 |
14 files changed, 74 insertions, 174 deletions
diff --git a/src/net/ea/gui/guildtab.cpp b/src/net/ea/gui/guildtab.cpp index 6a801bba4..46b1f1649 100644 --- a/src/net/ea/gui/guildtab.cpp +++ b/src/net/ea/gui/guildtab.cpp @@ -63,28 +63,6 @@ GuildTab::~GuildTab() bool GuildTab::handleCommand(const std::string &restrict type, const std::string &restrict args) { - if (type == "help") - { - if (args == "invite") - { - // TRANSLATORS: guild chat help - chatLog(_("Command: /invite <nick>")); - // TRANSLATORS: guild chat help - chatLog(_("This command invites <nick> to the guild you're in.")); - // TRANSLATORS: guild chat help - chatLog(_("If the <nick> has spaces in it, enclose it in " - "double quotes (\").")); - } - else if (args == "leave") - { - // TRANSLATORS: guild chat help - chatLog(_("Command: /leave")); - // TRANSLATORS: guild chat help - chatLog(_("This command causes the player to leave the guild.")); - } - else - return false; - } /* else if (type == "create" || type == "new") { @@ -94,7 +72,7 @@ bool GuildTab::handleCommand(const std::string &restrict type, Net::getGuildHandler()->create(args); } */ - else if (type == "invite" && taGuild) + if (type == "invite" && taGuild) { Net::getGuildHandler()->invite(taGuild->getId(), args); } @@ -127,34 +105,23 @@ void GuildTab::handleInput(const std::string &msg) if (!taGuild) return; - if (chatWindow) - { - Net::getGuildHandler()->chat(taGuild->getId(), - chatWindow->doReplace(msg)); - } - else - { - Net::getGuildHandler()->chat(taGuild->getId(), msg); - } -} - -void GuildTab::showHelp() -{ - // TRANSLATORS: guild chat help - chatLog(_("/help > Display this help.")); - // TRANSLATORS: guild chat help - chatLog(_("/invite > Invite a player to your guild")); - // TRANSLATORS: guild chat help - chatLog(_("/leave > Leave the guild you are in")); - // TRANSLATORS: guild chat help - chatLog(_("/kick > Kick someone from the guild you are in")); + Net::getGuildHandler()->chat(taGuild->getId(), + ChatWindow::doReplace(msg)); } void GuildTab::getAutoCompleteList(StringVect &names) const { if (taGuild) taGuild->getNames(names); +} + +void GuildTab::getAutoCompleteCommands(StringVect &names) const +{ + names.push_back("/help"); + names.push_back("/invite "); + names.push_back("/kick "); names.push_back("/notice "); + names.push_back("/leave"); } void GuildTab::saveToLogFile(const std::string &msg) const diff --git a/src/net/ea/gui/guildtab.h b/src/net/ea/gui/guildtab.h index 442ad62d0..2b6a4bd1a 100644 --- a/src/net/ea/gui/guildtab.h +++ b/src/net/ea/gui/guildtab.h @@ -43,8 +43,6 @@ class GuildTab : public ChatTab, public ConfigListener bool handleCommand(const std::string &restrict type, const std::string &restrict args) override final; - void showHelp() override; - void saveToLogFile(const std::string &msg) const override final; int getType() const override final A_WARN_UNUSED @@ -58,6 +56,8 @@ class GuildTab : public ChatTab, public ConfigListener void handleInput(const std::string &msg) override final; void getAutoCompleteList(StringVect &names) const override final; + + void getAutoCompleteCommands(StringVect &names) const override final; }; } // namespace Ea diff --git a/src/net/ea/gui/partytab.cpp b/src/net/ea/gui/partytab.cpp index 76e204205..79a9a8897 100644 --- a/src/net/ea/gui/partytab.cpp +++ b/src/net/ea/gui/partytab.cpp @@ -64,90 +64,13 @@ PartyTab::~PartyTab() void PartyTab::handleInput(const std::string &msg) { - if (chatWindow) - Net::getPartyHandler()->chat(chatWindow->doReplace(msg)); - else - Net::getPartyHandler()->chat(msg); -} - -void PartyTab::showHelp() -{ - // TRANSLATORS: party help message - chatLog(_("/help > Display this help.")); - // TRANSLATORS: party help message - chatLog(_("/invite > Invite a player to your party")); - // TRANSLATORS: party help message - chatLog(_("/leave > Leave the party you are in")); - // TRANSLATORS: party help message - chatLog(_("/kick > Kick someone from the party you are in")); - // TRANSLATORS: party help message - chatLog(_("/item > Show/change party item sharing options")); - // TRANSLATORS: party help message - chatLog(_("/exp > Show/change party experience sharing options")); + Net::getPartyHandler()->chat(ChatWindow::doReplace(msg)); } bool PartyTab::handleCommand(const std::string &restrict type, const std::string &restrict args) { - if (type == "help") - { - if (args == "invite") - { - // TRANSLATORS: party help message - chatLog(_("Command: /invite <nick>")); - // TRANSLATORS: party help message - chatLog(_("This command invites <nick> to party with you.")); - // TRANSLATORS: party help message - chatLog(_("If the <nick> has spaces in it, enclose it in " - "double quotes (\").")); - } - else if (args == "leave") - { - // TRANSLATORS: party help message - chatLog(_("Command: /leave")); - // TRANSLATORS: party help message - chatLog(_("This command causes the player to leave the party.")); - } - else if (args == "item") - { - // TRANSLATORS: party help message - chatLog(_("Command: /item <policy>")); - // TRANSLATORS: party help message - chatLog( - _("This command changes the party's item sharing policy.")); - // TRANSLATORS: party help message - chatLog(_("<policy> can be one of \"1\", \"yes\", \"true\" to " - "enable item sharing, or \"0\", \"no\", \"false\" to " - "disable item sharing.")); - // TRANSLATORS: party help message - chatLog(_("Command: /item")); - // TRANSLATORS: party help message - chatLog(_("This command displays the party's" - " current item sharing policy.")); - } - else if (args == "exp") - { - // TRANSLATORS: party help message - chatLog(_("Command: /exp <policy>")); - // TRANSLATORS: party help message - chatLog(_("This command changes the party's " - "experience sharing policy.")); - // TRANSLATORS: party help message - chatLog(_("<policy> can be one of \"1\", \"yes\", \"true\" to " - "enable experience sharing, or \"0\"," - " \"no\", \"false\" to disable experience sharing.")); - // TRANSLATORS: party help message - chatLog(_("Command: /exp")); - // TRANSLATORS: party help message - chatLog(_("This command displays the party's current " - "experience sharing policy.")); - } - else - { - return false; - } - } - else if (type == "create" || type == "new") + if (type == "create" || type == "new") { if (args.empty()) { @@ -278,6 +201,16 @@ void PartyTab::getAutoCompleteList(StringVect &names) const p->getNames(names); } +void PartyTab::getAutoCompleteCommands(StringVect &names) const +{ + names.push_back("/help"); + names.push_back("/invite "); + names.push_back("/leave"); + names.push_back("/kick "); + names.push_back("/item"); + names.push_back("/exp"); +} + void PartyTab::saveToLogFile(const std::string &msg) const { if (chatLogger) diff --git a/src/net/ea/gui/partytab.h b/src/net/ea/gui/partytab.h index a73fbaaeb..d141452d0 100644 --- a/src/net/ea/gui/partytab.h +++ b/src/net/ea/gui/partytab.h @@ -40,8 +40,6 @@ class PartyTab : public ChatTab, public ConfigListener virtual ~PartyTab(); - void showHelp() override final; - bool handleCommand(const std::string &restrict type, const std::string &restrict args) override final; @@ -57,7 +55,9 @@ class PartyTab : public ChatTab, public ConfigListener protected: void handleInput(const std::string &msg) override final; - virtual void getAutoCompleteList(StringVect&) const override final; + void getAutoCompleteList(StringVect&) const override final; + + void getAutoCompleteCommands(StringVect &names) const override final; }; extern PartyTab *partyTab; diff --git a/src/net/ea/inventoryhandler.cpp b/src/net/ea/inventoryhandler.cpp index 94b81adb0..74f0a4ba7 100644 --- a/src/net/ea/inventoryhandler.cpp +++ b/src/net/ea/inventoryhandler.cpp @@ -337,7 +337,7 @@ void InventoryHandler::processPlayerInventoryAdd(Net::MessageIn &msg) } } -void InventoryHandler::processPlayerInventoryRemove(Net::MessageIn &msg) const +void InventoryHandler::processPlayerInventoryRemove(Net::MessageIn &msg) { Inventory *const inventory = player_node ? PlayerInfo::getInventory() : nullptr; @@ -357,7 +357,7 @@ void InventoryHandler::processPlayerInventoryRemove(Net::MessageIn &msg) const } } -void InventoryHandler::processPlayerInventoryUse(Net::MessageIn &msg) const +void InventoryHandler::processPlayerInventoryUse(Net::MessageIn &msg) { Inventory *const inventory = player_node ? PlayerInfo::getInventory() : nullptr; @@ -380,7 +380,7 @@ void InventoryHandler::processPlayerInventoryUse(Net::MessageIn &msg) const } } -void InventoryHandler::processItemUseResponse(Net::MessageIn &msg) const +void InventoryHandler::processItemUseResponse(Net::MessageIn &msg) { Inventory *const inventory = player_node ? PlayerInfo::getInventory() : nullptr; diff --git a/src/net/ea/inventoryhandler.h b/src/net/ea/inventoryhandler.h index eea4dde12..6e8ecec38 100644 --- a/src/net/ea/inventoryhandler.h +++ b/src/net/ea/inventoryhandler.h @@ -180,11 +180,11 @@ class InventoryHandler : public Net::InventoryHandler void processPlayerInventoryAdd(Net::MessageIn &msg); - void processPlayerInventoryRemove(Net::MessageIn &msg) const; + static void processPlayerInventoryRemove(Net::MessageIn &msg); - void processPlayerInventoryUse(Net::MessageIn &msg) const; + static void processPlayerInventoryUse(Net::MessageIn &msg); - void processItemUseResponse(Net::MessageIn &msg) const; + static void processItemUseResponse(Net::MessageIn &msg); void processPlayerStorageStatus(Net::MessageIn &msg); diff --git a/src/net/ea/itemhandler.cpp b/src/net/ea/itemhandler.cpp index aaab0ca3e..9ce85a59b 100644 --- a/src/net/ea/itemhandler.cpp +++ b/src/net/ea/itemhandler.cpp @@ -37,7 +37,7 @@ ItemHandler::~ItemHandler() { } -void ItemHandler::processItemVisible(Net::MessageIn &msg) const +void ItemHandler::processItemVisible(Net::MessageIn &msg) { const int id = msg.readInt32(); const int itemId = msg.readInt16(); @@ -55,7 +55,7 @@ void ItemHandler::processItemVisible(Net::MessageIn &msg) const } } -void ItemHandler::processItemDropped(Net::MessageIn &msg) const +void ItemHandler::processItemDropped(Net::MessageIn &msg) { const int id = msg.readInt32(); const int itemId = msg.readInt16(); @@ -73,7 +73,7 @@ void ItemHandler::processItemDropped(Net::MessageIn &msg) const } } -void ItemHandler::processItemRemove(Net::MessageIn &msg) const +void ItemHandler::processItemRemove(Net::MessageIn &msg) { if (actorManager) { diff --git a/src/net/ea/itemhandler.h b/src/net/ea/itemhandler.h index 8b07789f9..6bc23fb10 100644 --- a/src/net/ea/itemhandler.h +++ b/src/net/ea/itemhandler.h @@ -37,11 +37,11 @@ class ItemHandler virtual ~ItemHandler(); - void processItemVisible(Net::MessageIn &msg) const; + static void processItemVisible(Net::MessageIn &msg); - void processItemRemove(Net::MessageIn &msg) const; + static void processItemRemove(Net::MessageIn &msg); - void processItemDropped(Net::MessageIn &msg) const; + static void processItemDropped(Net::MessageIn &msg); }; } // namespace Ea diff --git a/src/net/ea/playerhandler.cpp b/src/net/ea/playerhandler.cpp index c6d20573d..3e5db9169 100644 --- a/src/net/ea/playerhandler.cpp +++ b/src/net/ea/playerhandler.cpp @@ -124,7 +124,7 @@ Vector PlayerHandler::getDefaultWalkSpeed() const return Vector(150, 150, 0); } -void PlayerHandler::processWalkResponse(Net::MessageIn &msg) const +void PlayerHandler::processWalkResponse(Net::MessageIn &msg) { BLOCK_START("PlayerHandler::processWalkResponse") /* @@ -140,7 +140,7 @@ void PlayerHandler::processWalkResponse(Net::MessageIn &msg) const BLOCK_END("PlayerHandler::processWalkResponse") } -void PlayerHandler::processPlayerWarp(Net::MessageIn &msg) const +void PlayerHandler::processPlayerWarp(Net::MessageIn &msg) { BLOCK_START("PlayerHandler::processPlayerWarp") std::string mapPath = msg.readString(16); @@ -216,7 +216,7 @@ void PlayerHandler::processPlayerWarp(Net::MessageIn &msg) const BLOCK_END("PlayerHandler::processPlayerWarp") } -void PlayerHandler::processPlayerStatUpdate1(Net::MessageIn &msg) const +void PlayerHandler::processPlayerStatUpdate1(Net::MessageIn &msg) { BLOCK_START("PlayerHandler::processPlayerStatUpdate1") const int type = msg.readInt16(); @@ -405,7 +405,7 @@ void PlayerHandler::processPlayerStatUpdate1(Net::MessageIn &msg) const BLOCK_END("PlayerHandler::processPlayerStatUpdate1") } -void PlayerHandler::processPlayerStatUpdate2(Net::MessageIn &msg) const +void PlayerHandler::processPlayerStatUpdate2(Net::MessageIn &msg) { BLOCK_START("PlayerHandler::processPlayerStatUpdate2") const int type = msg.readInt16(); @@ -450,7 +450,7 @@ void PlayerHandler::processPlayerStatUpdate2(Net::MessageIn &msg) const BLOCK_END("PlayerHandler::processPlayerStatUpdate2") } -void PlayerHandler::processPlayerStatUpdate3(Net::MessageIn &msg) const +void PlayerHandler::processPlayerStatUpdate3(Net::MessageIn &msg) { BLOCK_START("PlayerHandler::processPlayerStatUpdate3") const int type = msg.readInt32(); @@ -464,7 +464,7 @@ void PlayerHandler::processPlayerStatUpdate3(Net::MessageIn &msg) const BLOCK_END("PlayerHandler::processPlayerStatUpdate3") } -void PlayerHandler::processPlayerStatUpdate4(Net::MessageIn &msg) const +void PlayerHandler::processPlayerStatUpdate4(Net::MessageIn &msg) { BLOCK_START("PlayerHandler::processPlayerStatUpdate4") const int type = msg.readInt16(); @@ -484,7 +484,7 @@ void PlayerHandler::processPlayerStatUpdate4(Net::MessageIn &msg) const BLOCK_END("PlayerHandler::processPlayerStatUpdate4") } -void PlayerHandler::processPlayerStatUpdate5(Net::MessageIn &msg) const +void PlayerHandler::processPlayerStatUpdate5(Net::MessageIn &msg) { BLOCK_START("PlayerHandler::processPlayerStatUpdate5") PlayerInfo::setAttribute(PlayerInfo::CHAR_POINTS, msg.readInt16()); @@ -558,7 +558,7 @@ void PlayerHandler::processPlayerStatUpdate5(Net::MessageIn &msg) const BLOCK_END("PlayerHandler::processPlayerStatUpdate5") } -void PlayerHandler::processPlayerStatUpdate6(Net::MessageIn &msg) const +void PlayerHandler::processPlayerStatUpdate6(Net::MessageIn &msg) { BLOCK_START("PlayerHandler::processPlayerStatUpdate6") const int type = msg.readInt16(); @@ -593,7 +593,7 @@ void PlayerHandler::processPlayerStatUpdate6(Net::MessageIn &msg) const BLOCK_END("PlayerHandler::processPlayerStatUpdate6") } -void PlayerHandler::processPlayerArrowMessage(Net::MessageIn &msg) const +void PlayerHandler::processPlayerArrowMessage(Net::MessageIn &msg) { BLOCK_START("PlayerHandler::processPlayerArrowMessage") const int type = msg.readInt16(); diff --git a/src/net/ea/playerhandler.h b/src/net/ea/playerhandler.h index 2bac97ac1..589874e2e 100644 --- a/src/net/ea/playerhandler.h +++ b/src/net/ea/playerhandler.h @@ -53,23 +53,23 @@ class PlayerHandler : public Net::PlayerHandler int getAttackLocation() const override final A_WARN_UNUSED; - void processWalkResponse(Net::MessageIn &msg) const; + static void processWalkResponse(Net::MessageIn &msg); - void processPlayerWarp(Net::MessageIn &msg) const; + static void processPlayerWarp(Net::MessageIn &msg); - void processPlayerStatUpdate1(Net::MessageIn &msg) const; + static void processPlayerStatUpdate1(Net::MessageIn &msg); - void processPlayerStatUpdate2(Net::MessageIn &msg) const; + static void processPlayerStatUpdate2(Net::MessageIn &msg); - void processPlayerStatUpdate3(Net::MessageIn &msg) const; + static void processPlayerStatUpdate3(Net::MessageIn &msg); - void processPlayerStatUpdate4(Net::MessageIn &msg) const; + static void processPlayerStatUpdate4(Net::MessageIn &msg); - void processPlayerStatUpdate5(Net::MessageIn &msg) const; + static void processPlayerStatUpdate5(Net::MessageIn &msg); - void processPlayerStatUpdate6(Net::MessageIn &msg) const; + static void processPlayerStatUpdate6(Net::MessageIn &msg); - void processPlayerArrowMessage(Net::MessageIn &msg) const; + static void processPlayerArrowMessage(Net::MessageIn &msg); }; } // namespace Ea diff --git a/src/net/ea/skillhandler.cpp b/src/net/ea/skillhandler.cpp index 3f5b38c68..3a5a1ab75 100644 --- a/src/net/ea/skillhandler.cpp +++ b/src/net/ea/skillhandler.cpp @@ -71,7 +71,7 @@ SkillHandler::SkillHandler() { } -void SkillHandler::processPlayerSkills(Net::MessageIn &msg) const +void SkillHandler::processPlayerSkills(Net::MessageIn &msg) { msg.readInt16(); // length const int skillCount = (msg.getLength() - 4) / 37; @@ -101,7 +101,7 @@ void SkillHandler::processPlayerSkills(Net::MessageIn &msg) const skillDialog->playUpdateEffect(updateSkill); } -void SkillHandler::processPlayerSkillUp(Net::MessageIn &msg) const +void SkillHandler::processPlayerSkillUp(Net::MessageIn &msg) { const int skillId = msg.readInt16(); const int level = msg.readInt16(); @@ -119,7 +119,7 @@ void SkillHandler::processPlayerSkillUp(Net::MessageIn &msg) const } } -void SkillHandler::processSkillFailed(Net::MessageIn &msg) const +void SkillHandler::processSkillFailed(Net::MessageIn &msg) { // Action failed (ex. sit because you have not reached the // right level) diff --git a/src/net/ea/skillhandler.h b/src/net/ea/skillhandler.h index 251388969..8dc724e0a 100644 --- a/src/net/ea/skillhandler.h +++ b/src/net/ea/skillhandler.h @@ -36,11 +36,11 @@ class SkillHandler : public Net::SkillHandler A_DELETE_COPY(SkillHandler) - void processPlayerSkills(Net::MessageIn &msg) const; + static void processPlayerSkills(Net::MessageIn &msg); - void processPlayerSkillUp(Net::MessageIn &msg) const; + static void processPlayerSkillUp(Net::MessageIn &msg); - void processSkillFailed(Net::MessageIn &msg) const; + static void processSkillFailed(Net::MessageIn &msg); }; } // namespace Ea diff --git a/src/net/ea/tradehandler.cpp b/src/net/ea/tradehandler.cpp index 45948f963..9457a31db 100644 --- a/src/net/ea/tradehandler.cpp +++ b/src/net/ea/tradehandler.cpp @@ -182,7 +182,7 @@ void TradeHandler::processTradeResponse(Net::MessageIn &msg) const } } -void TradeHandler::processTradeItemAdd(Net::MessageIn &msg) const +void TradeHandler::processTradeItemAdd(Net::MessageIn &msg) { const int amount = msg.readInt32(); const int type = msg.readInt16(); @@ -205,7 +205,7 @@ void TradeHandler::processTradeItemAdd(Net::MessageIn &msg) const } } -void TradeHandler::processTradeItemAddResponse(Net::MessageIn &msg) const +void TradeHandler::processTradeItemAddResponse(Net::MessageIn &msg) { // Trade: New Item add response (was 0x00ea, now 01b1) const int index = msg.readInt16() - INVENTORY_OFFSET; @@ -255,7 +255,7 @@ void TradeHandler::processTradeItemAddResponse(Net::MessageIn &msg) const } } -void TradeHandler::processTradeOk(Net::MessageIn &msg) const +void TradeHandler::processTradeOk(Net::MessageIn &msg) { // 0 means ok from myself, 1 means ok from other; if (tradeWindow) @@ -264,7 +264,7 @@ void TradeHandler::processTradeOk(Net::MessageIn &msg) const msg.readInt8(); } -void TradeHandler::processTradeCancel(Net::MessageIn &msg A_UNUSED) const +void TradeHandler::processTradeCancel(Net::MessageIn &msg A_UNUSED) { NotifyManager::notify(NotifyManager::TRADE_CANCELLED); if (tradeWindow) @@ -275,7 +275,7 @@ void TradeHandler::processTradeCancel(Net::MessageIn &msg A_UNUSED) const PlayerInfo::setTrading(false); } -void TradeHandler::processTradeComplete(Net::MessageIn &msg A_UNUSED) const +void TradeHandler::processTradeComplete(Net::MessageIn &msg A_UNUSED) { NotifyManager::notify(NotifyManager::TRADE_COMPLETE); if (tradeWindow) diff --git a/src/net/ea/tradehandler.h b/src/net/ea/tradehandler.h index c3f759ef4..22a78e9e6 100644 --- a/src/net/ea/tradehandler.h +++ b/src/net/ea/tradehandler.h @@ -43,15 +43,15 @@ class TradeHandler : public Net::TradeHandler void processTradeResponse(Net::MessageIn &msg) const; - void processTradeItemAdd(Net::MessageIn &msg) const; + static void processTradeItemAdd(Net::MessageIn &msg); - void processTradeItemAddResponse(Net::MessageIn &msg) const; + static void processTradeItemAddResponse(Net::MessageIn &msg); - void processTradeOk(Net::MessageIn &msg) const; + static void processTradeOk(Net::MessageIn &msg); - void processTradeCancel(Net::MessageIn &msg) const; + static void processTradeCancel(Net::MessageIn &msg); - void processTradeComplete(Net::MessageIn &msg) const; + static void processTradeComplete(Net::MessageIn &msg); }; } // namespace Ea |