diff options
| author | Shauren <shauren.trinity@gmail.com> | 2015-10-06 00:30:47 +0200 |
|---|---|---|
| committer | Shauren <shauren.trinity@gmail.com> | 2015-10-06 00:30:47 +0200 |
| commit | 63def8aa3291d0a6e5f83b289ad12c4c8a3cebd9 (patch) | |
| tree | cfb5fe68515b5421c0719430f3689733bde20429 /src/server/bnetserver/Realms | |
| parent | 2c828a47a5aa03c850f0a0fdf7c2100771f69ef8 (diff) | |
Core/Battle.net:
* Changed packet structures to mirror client names
* Simplified ToString Building
* Removed deprecated structures
World: Cleaned up duplicate realm info 'realm' and 'realmHandle' variables (realmHandle was removed, that data is fully contained in realm)
Diffstat (limited to 'src/server/bnetserver/Realms')
| -rw-r--r-- | src/server/bnetserver/Realms/RealmList.cpp | 19 | ||||
| -rw-r--r-- | src/server/bnetserver/Realms/RealmList.h | 8 | ||||
| -rw-r--r-- | src/server/bnetserver/Realms/WorldListener.cpp | 19 |
3 files changed, 28 insertions, 18 deletions
diff --git a/src/server/bnetserver/Realms/RealmList.cpp b/src/server/bnetserver/Realms/RealmList.cpp index ff7e2779a6e..089ca37a54a 100644 --- a/src/server/bnetserver/Realms/RealmList.cpp +++ b/src/server/bnetserver/Realms/RealmList.cpp @@ -65,7 +65,7 @@ inline void UpdateField(FieldType& out, FieldType const& in, bool& changed) } } -void RealmList::UpdateRealm(Battlenet::RealmId const& id, const std::string& name, ip::address const& address, ip::address const& localAddr, +void RealmList::UpdateRealm(Battlenet::RealmHandle const& id, uint32 build, const std::string& name, ip::address const& address, ip::address const& localAddr, ip::address const& localSubmask, uint16 port, uint8 icon, RealmFlags flag, uint8 timezone, AccountTypes allowedSecurityLevel, float population) { @@ -75,6 +75,7 @@ void RealmList::UpdateRealm(Battlenet::RealmId const& id, const std::string& nam realm.Keep = true; realm.Id = id; + UpdateField(realm.Build, build, realm.Updated); UpdateField(realm.Name, name, realm.Updated); UpdateField(realm.Type, icon, realm.Updated); UpdateField(realm.Flags, flag, realm.Updated); @@ -142,6 +143,10 @@ void RealmList::UpdateRealms(boost::system::error_code const& error) uint16 port = fields[5].GetUInt16(); uint8 icon = fields[6].GetUInt8(); + if (icon == REALM_TYPE_FFA_PVP) + icon = REALM_TYPE_PVP; + if (icon >= MAX_CLIENT_REALM_TYPE) + icon = REALM_TYPE_NORMAL; RealmFlags flag = RealmFlags(fields[7].GetUInt8()); uint8 timezone = fields[8].GetUInt8(); uint8 allowedSecurityLevel = fields[9].GetUInt8(); @@ -151,10 +156,10 @@ void RealmList::UpdateRealms(boost::system::error_code const& error) uint8 region = fields[12].GetUInt8(); uint8 battlegroup = fields[13].GetUInt8(); - Battlenet::RealmId id{ region, battlegroup, realmId, build }; + Battlenet::RealmHandle id{ region, battlegroup, realmId }; - UpdateRealm(id, name, externalAddress, localAddress, localSubmask, port, icon, flag, timezone, - (allowedSecurityLevel <= SEC_ADMINISTRATOR ? AccountTypes(allowedSecurityLevel) : SEC_ADMINISTRATOR), pop); + UpdateRealm(id, build, name, externalAddress, localAddress, localSubmask, port, icon, flag, + timezone, (allowedSecurityLevel <= SEC_ADMINISTRATOR ? AccountTypes(allowedSecurityLevel) : SEC_ADMINISTRATOR), pop); TC_LOG_TRACE("realmlist", "Realm \"%s\" at %s:%u.", name.c_str(), externalAddress.to_string().c_str(), port); } @@ -168,7 +173,7 @@ void RealmList::UpdateRealms(boost::system::error_code const& error) } std::vector<Realm const*> updatedRealms; - std::vector<Battlenet::RealmId> deletedRealms; + std::vector<Battlenet::RealmHandle> deletedRealms; for (RealmMap::value_type& pair : _realms) { @@ -181,7 +186,7 @@ void RealmList::UpdateRealms(boost::system::error_code const& error) pair.second.Keep = false; } - for (Battlenet::RealmId const& deleted : deletedRealms) + for (Battlenet::RealmHandle const& deleted : deletedRealms) _realms.erase(deleted); if (!updatedRealms.empty() || !deletedRealms.empty()) @@ -200,7 +205,7 @@ void RealmList::UpdateRealms(boost::system::error_code const& error) } } -Realm const* RealmList::GetRealm(Battlenet::RealmId const& id) const +Realm const* RealmList::GetRealm(Battlenet::RealmHandle const& id) const { auto itr = _realms.find(id); if (itr != _realms.end()) diff --git a/src/server/bnetserver/Realms/RealmList.h b/src/server/bnetserver/Realms/RealmList.h index 5e0a73017cc..670c51a7c36 100644 --- a/src/server/bnetserver/Realms/RealmList.h +++ b/src/server/bnetserver/Realms/RealmList.h @@ -20,7 +20,7 @@ #define _REALMLIST_H #include "Common.h" -#include "Realm.h" +#include "Realm/Realm.h" #include "WorldListener.h" #include <boost/asio/ip/address.hpp> #include <boost/asio/ip/tcp.hpp> @@ -33,7 +33,7 @@ using namespace boost::asio; class RealmList { public: - typedef std::map<Battlenet::RealmId, Realm> RealmMap; + typedef std::map<Battlenet::RealmHandle, Realm> RealmMap; static RealmList* instance() { @@ -47,13 +47,13 @@ public: void Close(); RealmMap const& GetRealms() const { return _realms; } - Realm const* GetRealm(Battlenet::RealmId const& id) const; + Realm const* GetRealm(Battlenet::RealmHandle const& id) const; private: RealmList(); void UpdateRealms(boost::system::error_code const& error); - void UpdateRealm(Battlenet::RealmId const& id, const std::string& name, ip::address const& address, ip::address const& localAddr, + void UpdateRealm(Battlenet::RealmHandle const& id, uint32 build, const std::string& name, ip::address const& address, ip::address const& localAddr, ip::address const& localSubmask, uint16 port, uint8 icon, RealmFlags flag, uint8 timezone, AccountTypes allowedSecurityLevel, float population); RealmMap _realms; diff --git a/src/server/bnetserver/Realms/WorldListener.cpp b/src/server/bnetserver/Realms/WorldListener.cpp index d6a12453644..3bf7e4ecf03 100644 --- a/src/server/bnetserver/Realms/WorldListener.cpp +++ b/src/server/bnetserver/Realms/WorldListener.cpp @@ -85,7 +85,7 @@ void WorldListener::HandleClose() void WorldListener::Dispatch(zmqpp::message& msg) const { - Battlenet::Header ipcHeader; + IPC::BattlenetComm::Header ipcHeader; msg >> ipcHeader; if (ipcHeader.Ipc.Channel != IPC_CHANNEL_BNET) @@ -97,7 +97,7 @@ void WorldListener::Dispatch(zmqpp::message& msg) const void WorldListener::HandleToonOnlineStatusChange(Battlenet::RealmHandle const& realm, zmqpp::message& msg) const { - Battlenet::ToonHandle toonHandle; + IPC::BattlenetComm::ToonHandle toonHandle; bool online; msg >> toonHandle; msg >> online; @@ -109,11 +109,16 @@ void WorldListener::HandleToonOnlineStatusChange(Battlenet::RealmHandle const& r if (!session->IsToonOnline()) { Battlenet::WoWRealm::ToonReady* toonReady = new Battlenet::WoWRealm::ToonReady(); - toonReady->Realm.Battlegroup = realm.Battlegroup; - toonReady->Realm.Index = realm.Index; - toonReady->Realm.Region = realm.Region; - toonReady->Guid = toonHandle.Guid; - toonReady->Name = toonHandle.Name; + toonReady->Name.Region = realm.Region; + toonReady->Name.ProgramId = "WoW"; + toonReady->Name.Realm = realm.GetAddress(); + toonReady->Name.Name = toonHandle.Name; + + toonReady->Handle.Region = realm.Region; + toonReady->Handle.ProgramId = "WoW"; + toonReady->Handle.Realm = realm.GetAddress(); + toonReady->Handle.Id = toonHandle.Guid; + session->SetToonOnline(true); session->AsyncWrite(toonReady); } |
