summaryrefslogtreecommitdiff
path: root/src/being
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-10-16 01:58:12 +0300
committerAndrei Karas <akaras@inbox.ru>2016-10-16 01:58:12 +0300
commit036df13f60e4d5c4e30d92c09fa376c147a68e9c (patch)
treea976693604fb050bb0f81681621e797a8162f6c6 /src/being
parentbdc9cb6d5886af2bf068bfb5ea37f724f0cecae6 (diff)
downloadmv-036df13f60e4d5c4e30d92c09fa376c147a68e9c.tar.gz
mv-036df13f60e4d5c4e30d92c09fa376c147a68e9c.tar.bz2
mv-036df13f60e4d5c4e30d92c09fa376c147a68e9c.tar.xz
mv-036df13f60e4d5c4e30d92c09fa376c147a68e9c.zip
Add option to show player name only for selected player.s20161017
Diffstat (limited to 'src/being')
-rw-r--r--src/being/being.cpp16
-rw-r--r--src/being/localplayer.cpp56
-rw-r--r--src/being/localplayer.h2
3 files changed, 60 insertions, 14 deletions
diff --git a/src/being/being.cpp b/src/being/being.cpp
index 5ad4a1006..c401f9d0b 100644
--- a/src/being/being.cpp
+++ b/src/being/being.cpp
@@ -275,7 +275,7 @@ Being::Being(const BeingId id,
setMap(map);
setSubtype(subtype, 0);
- bool showName1 = false;
+ VisibleName::Type showName1 = VisibleName::Hide;
switch (mType)
{
@@ -284,11 +284,12 @@ Being::Being(const BeingId id,
case ActorType::Pet:
case ActorType::Homunculus:
case ActorType::Elemental:
- showName1 = config.getBoolValue("visiblenames");
+ showName1 = static_cast<VisibleName::Type>(
+ config.getIntValue("visiblenames"));
break;
case ActorType::Portal:
case ActorType::SkillUnit:
- showName1 = false;
+ showName1 = VisibleName::Hide;
break;
default:
case ActorType::Unknown:
@@ -306,10 +307,11 @@ Being::Being(const BeingId id,
reReadConfig();
- if (mType == ActorType::Npc)
+ if (mType == ActorType::Npc ||
+ showName1 == VisibleName::Show)
+ {
setShowName(true);
- else if (showName1)
- setShowName(showName1);
+ }
updateColors();
updatePercentHP();
@@ -2398,7 +2400,7 @@ void Being::updateCoords() restrict2
void Being::optionChanged(const std::string &restrict value) restrict2
{
if (mType == ActorType::Player && value == "visiblenames")
- setShowName(config.getBoolValue("visiblenames"));
+ setShowName(config.getIntValue("visiblenames") == VisibleName::Show);
}
void Being::flashName(const int time) restrict2
diff --git a/src/being/localplayer.cpp b/src/being/localplayer.cpp
index 23186dc2c..9af1371bf 100644
--- a/src/being/localplayer.cpp
+++ b/src/being/localplayer.cpp
@@ -166,6 +166,8 @@ LocalPlayer::LocalPlayer(const BeingId id,
mBlockAdvert(false),
mTargetDeadPlayers(config.getBoolValue("targetDeadPlayers")),
mServerAttack(fromBool(config.getBoolValue("serverAttack"), Keep)),
+ mVisibleNames(static_cast<VisibleName::Type>(
+ config.getIntValue("visiblenames"))),
mEnableAdvert(config.getBoolValue("enableAdvert")),
mTradebot(config.getBoolValue("tradebot")),
mTargetOnlyReachable(config.getBoolValue("targetOnlyReachable")),
@@ -216,6 +218,7 @@ LocalPlayer::LocalPlayer(const BeingId id,
config.addListener("tradebot", this);
config.addListener("targetOnlyReachable", this);
config.addListener("showserverpos", this);
+ config.addListener("visiblenames", this);
setShowName(config.getBoolValue("showownname"));
}
@@ -553,21 +556,27 @@ void LocalPlayer::setTarget(Being *const target)
oldTarget = mTarget;
}
- if (mTarget && mTarget->getType() == ActorType::Monster)
- mTarget->setShowName(false);
+ if (mTarget)
+ {
+ if (mTarget->getType() == ActorType::Monster)
+ mTarget->setShowName(false);
+ }
mTarget = target;
if (oldTarget)
oldTarget->updateName();
- if (mTarget)
+ if (target)
{
- mLastTargetX = mTarget->mX;
- mLastTargetY = mTarget->mY;
- mTarget->updateName();
+ mLastTargetX = target->mX;
+ mLastTargetY = target->mY;
+ target->updateName();
+ if (mVisibleNames == VisibleName::ShowOnSelection)
+ target->setShowName(true);
}
-
+ if (oldTarget && mVisibleNames == VisibleName::ShowOnSelection)
+ oldTarget->setShowName(false);
if (target && target->getType() == ActorType::Monster)
target->setShowName(true);
}
@@ -1073,33 +1082,66 @@ void LocalPlayer::addMessageToQueue(const std::string &message,
void LocalPlayer::optionChanged(const std::string &value)
{
if (value == "showownname")
+ {
setShowName(config.getBoolValue("showownname"));
+ }
else if (value == "targetDeadPlayers")
+ {
mTargetDeadPlayers = config.getBoolValue("targetDeadPlayers");
+ }
else if (value == "enableBuggyServers")
+ {
mIsServerBuggy = serverConfig.getBoolValue("enableBuggyServers");
+ }
else if (value == "syncPlayerMove")
+ {
mSyncPlayerMove = config.getBoolValue("syncPlayerMove");
+ }
else if (value == "syncPlayerMoveDistance")
+ {
mSyncPlayerMoveDistance = config.getIntValue("syncPlayerMoveDistance");
+ }
else if (value == "drawPath")
+ {
mDrawPath = config.getBoolValue("drawPath");
+ }
else if (value == "serverAttack")
+ {
mServerAttack = fromBool(config.getBoolValue("serverAttack"), Keep);
+ }
else if (value == "attackMoving")
+ {
mAttackMoving = config.getBoolValue("attackMoving");
+ }
else if (value == "attackNext")
+ {
mAttackNext = config.getBoolValue("attackNext");
+ }
else if (value == "showJobExp")
+ {
mShowJobExp = config.getBoolValue("showJobExp");
+ }
else if (value == "enableAdvert")
+ {
mEnableAdvert = config.getBoolValue("enableAdvert");
+ }
else if (value == "tradebot")
+ {
mTradebot = config.getBoolValue("tradebot");
+ }
else if (value == "targetOnlyReachable")
+ {
mTargetOnlyReachable = config.getBoolValue("targetOnlyReachable");
+ }
else if (value == "showserverpos")
+ {
mShowServerPos = config.getBoolValue("showserverpos");
+ }
+ else if (value == "visiblenames")
+ {
+ mVisibleNames = static_cast<VisibleName::Type>(
+ config.getIntValue("visiblenames"));
+ }
}
void LocalPlayer::addJobMessage(const int change)
diff --git a/src/being/localplayer.h b/src/being/localplayer.h
index 7a3985a32..3a7f4605d 100644
--- a/src/being/localplayer.h
+++ b/src/being/localplayer.h
@@ -26,6 +26,7 @@
#include "being/being.h"
#include "enums/being/pickup.h"
+#include "enums/being/visiblename.h"
#include "enums/simpletypes/allowsort.h"
#include "enums/simpletypes/keep.h"
@@ -514,6 +515,7 @@ class LocalPlayer final : public Being,
bool mBlockAdvert;
bool mTargetDeadPlayers;
Keep mServerAttack;
+ VisibleName::Type mVisibleNames;
bool mEnableAdvert;
bool mTradebot;
bool mTargetOnlyReachable;