summaryrefslogtreecommitdiff
path: root/src/actions
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-03-22 17:41:58 +0300
committerAndrei Karas <akaras@inbox.ru>2015-03-22 17:41:58 +0300
commit57fbb242575a647b3323ede64670d0a7094189e9 (patch)
tree32d337762734bb494e8641a6356da9a5cf48acea /src/actions
parent82ceb77559198eb46d3a49beb50d130ccdce0afb (diff)
downloadmv-57fbb242575a647b3323ede64670d0a7094189e9.tar.gz
mv-57fbb242575a647b3323ede64670d0a7094189e9.tar.bz2
mv-57fbb242575a647b3323ede64670d0a7094189e9.tar.xz
mv-57fbb242575a647b3323ede64670d0a7094189e9.zip
Add adction for show equipped hat in chat.
New chat command: /hat Now irc with hats can show actual hat in chat. In some servers even in irc.
Diffstat (limited to 'src/actions')
-rw-r--r--src/actions/chat.cpp23
-rw-r--r--src/actions/chat.h1
2 files changed, 22 insertions, 2 deletions
diff --git a/src/actions/chat.cpp b/src/actions/chat.cpp
index 3f54d0dc4..77991d038 100644
--- a/src/actions/chat.cpp
+++ b/src/actions/chat.cpp
@@ -33,11 +33,16 @@
#include "gui/windows/chatwindow.h"
+#include "net/charserverhandler.h"
#include "net/chathandler.h"
#include "net/guildhandler.h"
#include "net/partyhandler.h"
#include "net/serverfeatures.h"
+#include "resources/iteminfo.h"
+
+#include "resources/db/itemdb.h"
+
#include "utils/booleanoptions.h"
#include "utils/chatutils.h"
@@ -52,7 +57,7 @@ static void outString(ChatTab *const tab,
{
if (!tab)
{
- chatHandler->me(def, GENERAL_CHANNEL);
+ chatHandler->talk(def, GENERAL_CHANNEL);
return;
}
@@ -97,7 +102,7 @@ static void outString(ChatTab *const tab,
case ChatTabType::DEBUG:
case ChatTabType::BATTLE:
case ChatTabType::LANG:
- chatHandler->me(def, GENERAL_CHANNEL);
+ chatHandler->talk(def, GENERAL_CHANNEL);
break;
}
}
@@ -554,4 +559,18 @@ impHandler0(chatGuildTab)
return true;
}
+impHandler0(hat)
+{
+ if (!localPlayer)
+ return false;
+
+ const int sprite = localPlayer->getSpriteID(
+ charServerHandler->hatSprite());
+ const ItemInfo &info = ItemDB::get(sprite);
+ const std::string str = strprintf(_("equipped hat %s."),
+ info.getName().c_str());
+ outString(event.tab, str, str);
+ return true;
+}
+
} // namespace Actions
diff --git a/src/actions/chat.h b/src/actions/chat.h
index 9be293bb8..13906a57e 100644
--- a/src/actions/chat.h
+++ b/src/actions/chat.h
@@ -58,6 +58,7 @@ namespace Actions
decHandler(chatGmTab);
decHandler(chatPartyTab);
decHandler(chatGuildTab);
+ decHandler(hat);
} // namespace Actions
#undef decHandler