summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2011-10-30 21:32:28 +0300
committerAndrei Karas <akaras@inbox.ru>2011-10-30 21:32:28 +0300
commitcefd145c44d73dd7c1d8739cba404418ccb74602 (patch)
treed54c9be187be569cb499771071188e710a6c9fef
parentb2a0d0719989384171061edff8d720a9ab33467f (diff)
downloadmanaplus-cefd145c44d73dd7c1d8739cba404418ccb74602.tar.gz
manaplus-cefd145c44d73dd7c1d8739cba404418ccb74602.tar.bz2
manaplus-cefd145c44d73dd7c1d8739cba404418ccb74602.tar.xz
manaplus-cefd145c44d73dd7c1d8739cba404418ccb74602.zip
Add pseudo away chat command.
Command: /pseudoaway [test]
-rw-r--r--src/commandhandler.cpp9
-rw-r--r--src/commandhandler.h5
-rw-r--r--src/gui/chatwindow.cpp1
-rw-r--r--src/localplayer.cpp10
-rw-r--r--src/localplayer.h6
5 files changed, 30 insertions, 1 deletions
diff --git a/src/commandhandler.cpp b/src/commandhandler.cpp
index cac12b8ec..f90fd364f 100644
--- a/src/commandhandler.cpp
+++ b/src/commandhandler.cpp
@@ -149,6 +149,8 @@ void CommandHandler::handleCommand(const std::string &command, ChatTab *tab)
handleEmote(args, tab);
else if (type == "away")
handleAway(args, tab);
+ else if (type == "pseudoaway")
+ handlePseudoAway(args, tab);
else if (type == "follow")
handleFollow(args, tab);
else if (type == "heal")
@@ -712,6 +714,13 @@ void CommandHandler::handleAway(const std::string &args, ChatTab *tab A_UNUSED)
player_node->setAway(args);
}
+void CommandHandler::handlePseudoAway(const std::string &args,
+ ChatTab *tab A_UNUSED)
+{
+ if (player_node)
+ player_node->setPseudoAway(args);
+}
+
void CommandHandler::handleFollow(const std::string &args, ChatTab *tab)
{
if (!player_node)
diff --git a/src/commandhandler.h b/src/commandhandler.h
index 0b3146af8..c18a9d4c9 100644
--- a/src/commandhandler.h
+++ b/src/commandhandler.h
@@ -234,6 +234,11 @@ class CommandHandler
void handleAway(const std::string &args, ChatTab *tab);
/**
+ * Handle pseudo away command.
+ */
+ void handlePseudoAway(const std::string &args, ChatTab *tab);
+
+ /**
* Handle follow command.
*/
void handleFollow(const std::string &args, ChatTab *tab);
diff --git a/src/gui/chatwindow.cpp b/src/gui/chatwindow.cpp
index 95f89bcad..1fa91cfa6 100644
--- a/src/gui/chatwindow.cpp
+++ b/src/gui/chatwindow.cpp
@@ -297,6 +297,7 @@ void ChatWindow::fillCommands()
mCommands.push_back("/serverignoreall");
mCommands.push_back("/serverunignoreall");
mCommands.push_back("/dumpg");
+ mCommands.push_back("/pseudoaway ");
}
void ChatWindow::resetToDefaultSize()
diff --git a/src/localplayer.cpp b/src/localplayer.cpp
index 7fc1d8c7d..16409d16c 100644
--- a/src/localplayer.cpp
+++ b/src/localplayer.cpp
@@ -113,6 +113,7 @@ LocalPlayer::LocalPlayer(int id, int subtype):
mAwayDialog(0),
mAfkTime(0),
mAwayMode(false),
+ mPseudoAwayMode(false),
mShowNavigePath(false),
mDrawPath(false),
mActivityTime(0),
@@ -357,7 +358,7 @@ void LocalPlayer::logic()
if (mTradebot && shopWindow && !shopWindow->isShopEmpty())
smile += FLAG_SHOP;
- if (mAwayMode)
+ if (mAwayMode || mPseudoAwayMode)
smile += FLAG_AWAY;
if (mInactive)
@@ -3202,6 +3203,13 @@ void LocalPlayer::setAway(const std::string &message)
changeAwayMode();
}
+void LocalPlayer::setPseudoAway(const std::string &message)
+{
+ if (!message.empty())
+ config.setValue("afkMessage", message);
+ mPseudoAwayMode = !mPseudoAwayMode;
+}
+
void LocalPlayer::afkRespond(ChatTab *tab, const std::string &nick)
{
if (mAwayMode)
diff --git a/src/localplayer.h b/src/localplayer.h
index a35c42de7..fc8c3339b 100644
--- a/src/localplayer.h
+++ b/src/localplayer.h
@@ -327,9 +327,14 @@ class LocalPlayer : public Being, public ActorSpriteListener,
void setAway(const std::string &message);
+ void setPseudoAway(const std::string &message);
+
bool getAway()
{ return mAwayMode; }
+ bool getPseudoAway()
+ { return mPseudoAwayMode; }
+
void setHalfAway(bool n)
{ mInactive = n; }
@@ -568,6 +573,7 @@ class LocalPlayer : public Being, public ActorSpriteListener,
int mPingTime;
int mAfkTime;
bool mAwayMode;
+ bool mPseudoAwayMode;
bool mShowNavigePath;
bool mIsServerBuggy;