summaryrefslogtreecommitdiff
path: root/src/being
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-07-23 00:39:12 +0300
committerAndrei Karas <akaras@inbox.ru>2014-07-23 00:39:12 +0300
commit6336dabcb33ca6b4d417b352fa0b12651b6f4c57 (patch)
treea84879f46ee80d2f98d0418cbcbbb81e28da8e76 /src/being
parent1995e723df5d5aef32b289c0122493ee6fe18b0e (diff)
downloadplus-6336dabcb33ca6b4d417b352fa0b12651b6f4c57.tar.gz
plus-6336dabcb33ca6b4d417b352fa0b12651b6f4c57.tar.bz2
plus-6336dabcb33ca6b4d417b352fa0b12651b6f4c57.tar.xz
plus-6336dabcb33ca6b4d417b352fa0b12651b6f4c57.zip
move "change away type" option into gamemodifiers.
Diffstat (limited to 'src/being')
-rw-r--r--src/being/localplayer.cpp65
-rw-r--r--src/being/localplayer.h17
2 files changed, 14 insertions, 68 deletions
diff --git a/src/being/localplayer.cpp b/src/being/localplayer.cpp
index 36275dbbe..77706051c 100644
--- a/src/being/localplayer.cpp
+++ b/src/being/localplayer.cpp
@@ -27,6 +27,7 @@
#include "client.h"
#include "configuration.h"
#include "dropshortcut.h"
+#include "gamemodifiers.h"
#include "guild.h"
#include "item.h"
#include "party.h"
@@ -173,7 +174,6 @@ LocalPlayer::LocalPlayer(const int id, const uint16_t subtype) :
mKeepAttacking(false),
mPathSetByMouse(false),
mWaitPing(false),
- mAwayMode(false),
mPseudoAwayMode(false),
mShowNavigePath(false)
{
@@ -342,7 +342,7 @@ void LocalPlayer::slowLogic()
if (mTradebot && shopWindow && !shopWindow->isShopEmpty())
smile |= BeingFlag::SHOP;
- if (mAwayMode || mPseudoAwayMode)
+ if (settings.awayMode || mPseudoAwayMode)
smile |= BeingFlag::AWAY;
if (mInactive)
@@ -1255,61 +1255,6 @@ void LocalPlayer::changeMode(unsigned *restrict const var,
debugMsg(str.substr(4));
}
-const unsigned awayModeSize = 2;
-
-void LocalPlayer::changeAwayMode()
-{
- mAwayMode = !mAwayMode;
- mAfkTime = 0;
- mInactive = false;
- updateName();
- UpdateStatusListener::distributeEvent();
- if (mAwayMode)
- {
- if (chatWindow)
- chatWindow->clearAwayLog();
-
- cancelFollow();
- navigateClean();
- if (outfitWindow)
- outfitWindow->wearAwayOutfit();
- // TRANSLATORS: away message box header
- mAwayDialog = new OkDialog(_("Away"),
- config.getStringValue("afkMessage"),
- DialogType::SILENCE, true, false);
- mAwayDialog->addActionListener(mAwayListener);
- soundManager.volumeOff();
- addAfkEffect();
- }
- else
- {
- mAwayDialog = nullptr;
- soundManager.volumeRestore();
- if (chatWindow)
- {
- chatWindow->displayAwayLog();
- chatWindow->clearAwayLog();
- }
- removeAfkEffect();
- }
-}
-
-static const char *const awayModeStrings[] =
-{
- // TRANSLATORS: away type in status bar
- N_("(O) on keyboard"),
- // TRANSLATORS: away type in status bar
- N_("(A) away"),
- // TRANSLATORS: away type in status bar
- N_("(?) away")
-};
-
-std::string LocalPlayer::getAwayModeString()
-{
- return gettext(getVarItem(&awayModeStrings[0],
- mAwayMode, awayModeSize));
-}
-
const unsigned cameraModeSize = 2;
static const char *const cameraModeStrings[] =
@@ -2576,7 +2521,7 @@ void LocalPlayer::tryPingRequest()
void LocalPlayer::setAway(const std::string &message)
{
setAfkMessage(message);
- changeAwayMode();
+ modifiers->changeAwayMode();
updateStatus();
}
@@ -2605,7 +2550,7 @@ void LocalPlayer::setPseudoAway(const std::string &message)
void LocalPlayer::afkRespond(ChatTab *const tab, const std::string &nick)
{
- if (mAwayMode)
+ if (settings.awayMode)
{
const int time = cur_time;
if (mAfkTime == 0 || time < mAfkTime
@@ -3399,7 +3344,7 @@ void LocalPlayer::updateStatus() const
if (mTradebot && shopWindow && !shopWindow->isShopEmpty())
status |= BeingFlag::SHOP;
- if (mAwayMode || mPseudoAwayMode)
+ if (settings.awayMode || mPseudoAwayMode)
status |= BeingFlag::AWAY;
if (mInactive)
diff --git a/src/being/localplayer.h b/src/being/localplayer.h
index cf604a1ca..3aabda22d 100644
--- a/src/being/localplayer.h
+++ b/src/being/localplayer.h
@@ -232,15 +232,10 @@ class LocalPlayer final : public Being,
void pingResponse();
- void changeAwayMode();
-
void setAway(const std::string &message);
void setPseudoAway(const std::string &message);
- bool getAway() const A_WARN_UNUSED
- { return mAwayMode; }
-
bool getPseudoAway() const A_WARN_UNUSED
{ return mPseudoAwayMode; }
@@ -392,8 +387,6 @@ class LocalPlayer final : public Being,
void setTestParticle(const std::string &fileName,
const bool updateHash = true);
- std::string getAwayModeString();
-
static std::string getCameraModeString();
int getLastAttackX() const override final
@@ -412,6 +405,15 @@ class LocalPlayer final : public Being,
void updateMusic();
+ void setAfkTime(const int v)
+ { mAfkTime = v; }
+
+ void setAwayDialog(OkDialog *const dialog)
+ { mAwayDialog = dialog; }
+
+ AwayListener *getAwayListener() const A_WARN_UNUSED
+ { return mAwayListener; }
+
protected:
void updateCoords() override final;
@@ -534,7 +536,6 @@ class LocalPlayer final : public Being,
// Tells if the path was set using mouse
bool mPathSetByMouse;
bool mWaitPing;
- bool mAwayMode;
bool mPseudoAwayMode;
bool mShowNavigePath;
};