summaryrefslogtreecommitdiff
path: root/src/actormanager.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-02-03 18:39:14 +0300
committerAndrei Karas <akaras@inbox.ru>2016-02-03 18:39:14 +0300
commit0928d201335e8c247a44a1406cfbee3921ee7901 (patch)
tree06e5d2acf36921f368ae445ba1eac8e351181f18 /src/actormanager.cpp
parent74397044b572c323f9c6bbc6338c17ce743ee3af (diff)
downloadmanaverse-0928d201335e8c247a44a1406cfbee3921ee7901.tar.gz
manaverse-0928d201335e8c247a44a1406cfbee3921ee7901.tar.bz2
manaverse-0928d201335e8c247a44a1406cfbee3921ee7901.tar.xz
manaverse-0928d201335e8c247a44a1406cfbee3921ee7901.zip
Add option for saving mapping between account id and nicks.
This information stored in separate files.
Diffstat (limited to 'src/actormanager.cpp')
-rw-r--r--src/actormanager.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/actormanager.cpp b/src/actormanager.cpp
index ba8822bf0..a250fba35 100644
--- a/src/actormanager.cpp
+++ b/src/actormanager.cpp
@@ -42,6 +42,7 @@
#include "input/inputmanager.h"
#include "utils/checkutils.h"
+#include "utils/files.h"
#include "utils/mathutils.h"
#include "utils/gettext.h"
@@ -191,6 +192,7 @@ class SortBeingFunctor final
ActorManager::ActorManager() :
mActors(),
mDeleteActors(),
+ mIdName(),
mBlockedBeings(),
#ifdef EATHENA_SUPPORT
mChars(),
@@ -205,6 +207,7 @@ ActorManager::ActorManager() :
mCycleMonsters(config.getBoolValue("cycleMonsters")),
mCycleNPC(config.getBoolValue("cycleNPC")),
mExtMouseTargeting(config.getBoolValue("extMouseTargeting")),
+ mEnableIdCollecting(config.getBoolValue("enableIdCollecting")),
mPriorityAttackMobs(),
mPriorityAttackMobsSet(),
mPriorityAttackMobsMap(),
@@ -226,6 +229,7 @@ ActorManager::ActorManager() :
config.addListener("cycleNPC", this);
config.addListener("extMouseTargeting", this);
config.addListener("showBadges", this);
+ config.addListener("enableIdCollecting", this);
loadAttackList();
}
@@ -1666,6 +1670,8 @@ void ActorManager::optionChanged(const std::string &name)
mExtMouseTargeting = config.getBoolValue("extMouseTargeting");
else if (name == "showBadges")
updateBadges();
+ else if (name == "enableIdCollecting")
+ mEnableIdCollecting = config.getBoolValue("enableIdCollecting");
}
void ActorManager::removeAttackMob(const std::string &name)
@@ -1953,6 +1959,29 @@ void ActorManager::updateBadges()
}
}
+void ActorManager::updateNameId(const std::string &name,
+ const BeingId beingId)
+{
+ if (!mEnableIdCollecting)
+ return;
+ const int id = static_cast<int>(beingId);
+ if (id < 2000000 || id >= 110000000)
+ return;
+
+ if (mIdName.find(beingId) == mIdName.end() ||
+ mIdName[beingId].find(name) == mIdName[beingId].end())
+ {
+ mIdName[beingId].insert(name);
+ std::string dir = settings.usersIdDir;
+ dir.append(toString(id));
+ dir.append("/");
+ dir.append(stringToHexPath(name));
+ Files::saveTextFile(dir,
+ "info.txt",
+ (name + "\n").append(getDateString()));
+ }
+}
+
#ifdef EATHENA_SUPPORT
void ActorManager::removeRoom(const int chatId)
{