summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-09-10 12:36:08 +0300
committerAndrei Karas <akaras@inbox.ru>2015-09-10 12:38:00 +0300
commit574efa8ae89f7786239753537eb32c222686f4a1 (patch)
treedc6f15a6a2a968f459bf541b30b7ef1df71d9f8b /src
parenta2af952c687ff666208a316d8b7b4e394df19d2f (diff)
downloadmv-574efa8ae89f7786239753537eb32c222686f4a1.tar.gz
mv-574efa8ae89f7786239753537eb32c222686f4a1.tar.bz2
mv-574efa8ae89f7786239753537eb32c222686f4a1.tar.xz
mv-574efa8ae89f7786239753537eb32c222686f4a1.zip
Impliment packets CMSG_SOLVE_CHAR_NAME and SMSG_SOLVE_CHAR_NAME.
Diffstat (limited to 'src')
-rw-r--r--src/actormanager.cpp22
-rw-r--r--src/actormanager.h8
-rw-r--r--src/net/beinghandler.h2
-rw-r--r--src/net/eathena/beinghandler.cpp6
-rw-r--r--src/net/eathena/beinghandler.h2
-rw-r--r--src/net/eathena/beingrecv.cpp8
-rw-r--r--src/net/eathena/beingrecv.h1
-rw-r--r--src/net/eathena/packetsin.inc2
-rw-r--r--src/net/tmwa/beinghandler.cpp4
-rw-r--r--src/net/tmwa/beinghandler.h2
10 files changed, 56 insertions, 1 deletions
diff --git a/src/actormanager.cpp b/src/actormanager.cpp
index ef4eac8c6..fd7f51368 100644
--- a/src/actormanager.cpp
+++ b/src/actormanager.cpp
@@ -191,6 +191,9 @@ ActorManager::ActorManager() :
mActors(),
mDeleteActors(),
mBlockedBeings(),
+#ifdef EATHENA_SUPPORT
+ mChars(),
+#endif
mMap(nullptr),
mSpellHeal1(serverConfig.getValue("spellHeal1", "#lum")),
mSpellHeal2(serverConfig.getValue("spellHeal2", "#inma")),
@@ -908,6 +911,10 @@ void ActorManager::clear()
if (localPlayer)
mActors.insert(localPlayer);
+
+#ifdef EATHENA_SUPPORT
+ mChars.clear();
+#endif
}
Being *ActorManager::findNearestPvpPlayer() const
@@ -1980,4 +1987,19 @@ void ActorManager::updateRoom(const ChatObject *const newChat)
}
}
}
+
+std::string ActorManager::findCharById(const int32_t id)
+{
+ std::map<int32_t, std::string>::const_iterator it = mChars.find(id);
+ if (it == mChars.end())
+ return std::string();
+ return (*it).second;
+}
+
+void ActorManager::addChar(const int32_t id,
+ const std::string &name)
+{
+ mChars[id] = name;
+}
+
#endif
diff --git a/src/actormanager.h b/src/actormanager.h
index 989947f83..00c8eb052 100644
--- a/src/actormanager.h
+++ b/src/actormanager.h
@@ -347,6 +347,11 @@ class ActorManager final: public ConfigListener
void removeRoom(const int chatId);
void updateRoom(const ChatObject *const newChat);
+
+ std::string findCharById(const int32_t id);
+
+ void addChar(const int32_t id,
+ const std::string &name);
#endif
protected:
@@ -371,6 +376,9 @@ class ActorManager final: public ConfigListener
ActorSprites mActors;
ActorSprites mDeleteActors;
std::set<BeingId> mBlockedBeings;
+#ifdef EATHENA_SUPPORT
+ std::map<int32_t, std::string> mChars;
+#endif
Map *mMap;
std::string mSpellHeal1;
std::string mSpellHeal2;
diff --git a/src/net/beinghandler.h b/src/net/beinghandler.h
index 4e0ac021e..81a9e5a79 100644
--- a/src/net/beinghandler.h
+++ b/src/net/beinghandler.h
@@ -37,6 +37,8 @@ class BeingHandler notfinal
virtual void requestNameById(const BeingId id) const = 0;
+ virtual void requestNameByCharId(const int id) const = 0;
+
virtual void undress(Being *const being) const = 0;
#ifdef EATHENA_SUPPORT
diff --git a/src/net/eathena/beinghandler.cpp b/src/net/eathena/beinghandler.cpp
index ddee2d6fa..2d4686786 100644
--- a/src/net/eathena/beinghandler.cpp
+++ b/src/net/eathena/beinghandler.cpp
@@ -73,4 +73,10 @@ void BeingHandler::viewPlayerEquipment(const Being *const being)
outMsg.writeBeingId(being->getId(), "account id");
}
+void BeingHandler::requestNameByCharId(const int id) const
+{
+ createOutPacket(CMSG_SOLVE_CHAR_NAME);
+ outMsg.writeInt32(id, "character id");
+}
+
} // namespace EAthena
diff --git a/src/net/eathena/beinghandler.h b/src/net/eathena/beinghandler.h
index 6780e9bc3..11d2250ff 100644
--- a/src/net/eathena/beinghandler.h
+++ b/src/net/eathena/beinghandler.h
@@ -41,6 +41,8 @@ class BeingHandler final : public Ea::BeingHandler
void requestRanks(const RankT rank) const override final;
+ void requestNameByCharId(const int id) const override final;
+
protected:
void viewPlayerEquipment(const Being *const being);
};
diff --git a/src/net/eathena/beingrecv.cpp b/src/net/eathena/beingrecv.cpp
index 2aaf6be7e..31a7bd371 100644
--- a/src/net/eathena/beingrecv.cpp
+++ b/src/net/eathena/beingrecv.cpp
@@ -1672,4 +1672,12 @@ void BeingRecv::processSkillCancel(Net::MessageIn &msg)
msg.readInt32("id?");
}
+void BeingRecv::processSolveCharName(Net::MessageIn &msg)
+{
+ const int id = msg.readInt32("char id");
+ const std::string name = msg.readString(24, "name");
+ if (actorManager)
+ actorManager->addChar(id, name);
+}
+
} // namespace EAthena
diff --git a/src/net/eathena/beingrecv.h b/src/net/eathena/beingrecv.h
index 95f7b50eb..31b35d5a3 100644
--- a/src/net/eathena/beingrecv.h
+++ b/src/net/eathena/beingrecv.h
@@ -110,6 +110,7 @@ namespace EAthena
void processPvpSet(Net::MessageIn &msg);
void processNameResponse2(Net::MessageIn &msg);
void processSkillCancel(Net::MessageIn &msg);
+ void processSolveCharName(Net::MessageIn &msg);
Being *createBeing2(Net::MessageIn &msg,
const BeingId id,
const int16_t job,
diff --git a/src/net/eathena/packetsin.inc b/src/net/eathena/packetsin.inc
index 7d463d043..a2ffcfcbe 100644
--- a/src/net/eathena/packetsin.inc
+++ b/src/net/eathena/packetsin.inc
@@ -399,7 +399,7 @@ packet(SMSG_SKILL_NO_DAMAGE, 0x011a, 15, &Ea::BeingRecv::processS
packet(SMSG_SKILL_SNAP, 0x08d2, 10, &SkillRecv::processSkillSnap);
packet(SMSG_SKILL_UNIT_UPDATE, 0x01ac, 6, &SkillRecv::processSkillUnitUpdate);
packet(SMSG_SKILL_WARP_POINT, 0x011c, 68, &SkillRecv::processSkillWarpPoint);
-packet(SMSG_SOLVE_CHAR_NAME, 0x0194, 30, nullptr);
+packet(SMSG_SOLVE_CHAR_NAME, 0x0194, 30, &BeingRecv::processSolveCharName);
packet(SMSG_SPIRIT_BALLS, 0x01d0, 8, &BeingRecv::processSpiritBalls);
packet(SMSG_SPIRIT_BALL_SINGLE, 0x01e1, 8, &BeingRecv::processSpiritBallSingle);
packet(SMSG_STARS_KILL, 0x020e, 32, &BeingRecv::processStarsKill);
diff --git a/src/net/tmwa/beinghandler.cpp b/src/net/tmwa/beinghandler.cpp
index 2cbd41835..61da647e1 100644
--- a/src/net/tmwa/beinghandler.cpp
+++ b/src/net/tmwa/beinghandler.cpp
@@ -68,4 +68,8 @@ void BeingHandler::viewPlayerEquipment(const Being *const being A_UNUSED)
{
}
+void BeingHandler::requestNameByCharId(const int id A_UNUSED) const
+{
+}
+
} // namespace TmwAthena
diff --git a/src/net/tmwa/beinghandler.h b/src/net/tmwa/beinghandler.h
index 1776ddd96..bb39983d5 100644
--- a/src/net/tmwa/beinghandler.h
+++ b/src/net/tmwa/beinghandler.h
@@ -43,6 +43,8 @@ class BeingHandler final : public Ea::BeingHandler
void requestRanks(const RankT rank A_UNUSED) const override final;
#endif
+ void requestNameByCharId(const int id) const override final;
+
protected:
void viewPlayerEquipment(const Being *const being);
};