summaryrefslogtreecommitdiff
path: root/src
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
parent82ceb77559198eb46d3a49beb50d130ccdce0afb (diff)
downloadmanaverse-57fbb242575a647b3323ede64670d0a7094189e9.tar.gz
manaverse-57fbb242575a647b3323ede64670d0a7094189e9.tar.bz2
manaverse-57fbb242575a647b3323ede64670d0a7094189e9.tar.xz
manaverse-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')
-rw-r--r--src/actions/chat.cpp23
-rw-r--r--src/actions/chat.h1
-rw-r--r--src/input/inputaction.h1
-rw-r--r--src/input/inputactionmap.h5
-rw-r--r--src/input/pages/outfits.cpp6
5 files changed, 34 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
diff --git a/src/input/inputaction.h b/src/input/inputaction.h
index 2eb89fc22..1fc45b6d1 100644
--- a/src/input/inputaction.h
+++ b/src/input/inputaction.h
@@ -590,6 +590,7 @@ namespace InputAction
HOMUN_EMOTE_47,
HOMUN_EMOTE_48,
KICK_GUILD,
+ HAT,
TOTAL
};
} // namespace InputAction
diff --git a/src/input/inputactionmap.h b/src/input/inputactionmap.h
index a8d3853ac..d20201c79 100644
--- a/src/input/inputactionmap.h
+++ b/src/input/inputactionmap.h
@@ -4431,6 +4431,11 @@ static const InputActionData inputActionData[InputAction::TOTAL] = {
InputCondition::INGAME,
"kickguild|guildkick",
true},
+ {"keyHat",
+ defaultAction(&Actions::hat),
+ InputCondition::INGAME,
+ "hat|hats|showhat",
+ false},
};
#undef defaultAction
diff --git a/src/input/pages/outfits.cpp b/src/input/pages/outfits.cpp
index c554b5e28..20715a287 100644
--- a/src/input/pages/outfits.cpp
+++ b/src/input/pages/outfits.cpp
@@ -58,6 +58,12 @@ SetupActionData setupActionDataOutfits[] =
},
{
// TRANSLATORS: input action name
+ N_("Show hat in chat"),
+ InputAction::HAT,
+ "",
+ },
+ {
+ // TRANSLATORS: input action name
N_("Outfits shortcuts"),
InputAction::NO_VALUE,
""