Skip to content

Commit 0075b9b

Browse files
joschiwaldShauren
authored andcommitted
Core/NetworkIO: updated SMSG_ADDON_INFO, SMSG_CLIENTCACHE_VERSION, SMSG_MOTD
(cherry picked from commit f8e935a)
1 parent 59f8884 commit 0075b9b

15 files changed

Lines changed: 241 additions & 208 deletions

File tree

src/server/game/Handlers/AuthHandler.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,8 @@
1515
* with this program. If not, see <http://www.gnu.org/licenses/>.
1616
*/
1717

18-
#include "Opcodes.h"
1918
#include "WorldSession.h"
20-
#include "WorldPacket.h"
19+
#include "ClientConfigPackets.h"
2120

2221
void WorldSession::SendAuthResponse(uint8 code, bool shortForm, uint32 queuePos)
2322
{
@@ -39,7 +38,8 @@ void WorldSession::SendAuthResponse(uint8 code, bool shortForm, uint32 queuePos)
3938

4039
void WorldSession::SendClientCacheVersion(uint32 version)
4140
{
42-
WorldPacket data(SMSG_CLIENTCACHE_VERSION, 4);
43-
data << uint32(version);
44-
SendPacket(&data);
41+
WorldPackets::ClientConfig::ClientCacheVersion cache;
42+
cache.CacheVersion = version;
43+
44+
SendPacket(cache.Write());
4545
}

src/server/game/Handlers/CharacterHandler.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@
4747
#include "Realm.h"
4848
#include "ReputationMgr.h"
4949
#include "ScriptMgr.h"
50-
#include "ServerMotd.h"
5150
#include "SocialMgr.h"
5251
#include "StringConvert.h"
5352
#include "SystemPackets.h"
@@ -765,9 +764,13 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder const& holder)
765764

766765
// Send MOTD
767766
{
768-
SendPacket(Motd::GetMotdPacket());
767+
WorldPackets::System::MOTD motd;
768+
motd.Text = &sWorld->GetMotd();
769+
SendPacket(motd.Write());
770+
}
769771

770-
// send server info
772+
// send server info
773+
{
771774
if (sWorld->getIntConfig(CONFIG_ENABLE_SINFO_LOGIN) == 1)
772775
chH.PSendSysMessage(GitRevision::GetFullVersion());
773776
}

src/server/game/Motd/ServerMotd.cpp

Lines changed: 0 additions & 64 deletions
This file was deleted.

src/server/game/Motd/ServerMotd.h

Lines changed: 0 additions & 38 deletions
This file was deleted.

src/server/game/Server/Packets/AllPackets.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include "CalendarPackets.h"
2424
#include "CharacterPackets.h"
2525
#include "ChatPackets.h"
26+
#include "ClientConfigPackets.h"
2627
#include "CombatLogPackets.h"
2728
#include "CombatPackets.h"
2829
#include "GuildPackets.h"
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
/*
2+
* Copyright (C) 2008-2014 TrinityCore <http://www.trinitycore.org/>
3+
*
4+
* This program is free software; you can redistribute it and/or modify it
5+
* under the terms of the GNU General Public License as published by the
6+
* Free Software Foundation; either version 2 of the License, or (at your
7+
* option) any later version.
8+
*
9+
* This program is distributed in the hope that it will be useful, but WITHOUT
10+
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11+
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12+
* more details.
13+
*
14+
* You should have received a copy of the GNU General Public License along
15+
* with this program. If not, see <http://www.gnu.org/licenses/>.
16+
*/
17+
18+
#include "ClientConfigPackets.h"
19+
#include "AddonMgr.h"
20+
#include "WorldSession.h"
21+
22+
namespace WorldPackets::ClientConfig
23+
{
24+
std::array<uint8, 256> const AddonInfo::PublicKey =
25+
{
26+
0xC3, 0x5B, 0x50, 0x84, 0xB9, 0x3E, 0x32, 0x42, 0x8C, 0xD0, 0xC7, 0x48, 0xFA, 0x0E, 0x5D, 0x54,
27+
0x5A, 0xA3, 0x0E, 0x14, 0xBA, 0x9E, 0x0D, 0xB9, 0x5D, 0x8B, 0xEE, 0xB6, 0x84, 0x93, 0x45, 0x75,
28+
0xFF, 0x31, 0xFE, 0x2F, 0x64, 0x3F, 0x3D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64, 0xDD, 0x10, 0x6F, 0xF3, 0xF5, 0xE0, 0xA6,
40+
0xC3, 0xFB, 0x1B, 0x8C, 0x29, 0xEF, 0x8E, 0xE5, 0x34, 0xCB, 0xD1, 0x2A, 0xCE, 0x79, 0xC3, 0x9A,
41+
0x0D, 0x36, 0xEA, 0x01, 0xE0, 0xAA, 0x91, 0x20, 0x54, 0xF0, 0x72, 0xD8, 0x1E, 0xC7, 0x89, 0xD2
42+
};
43+
44+
WorldPacket const* AddonInfo::Write()
45+
{
46+
for (SecureAddonInfo const& addon : Addons)
47+
{
48+
// fresh install, not yet created Interface\Addons\addon_name\addon_name.pub files
49+
uint8 infoProvided = addon.Status != SecureAddonInfo::BANNED || addon.HasKey;
50+
51+
_worldPacket << uint8(addon.Status);
52+
_worldPacket << uint8(infoProvided); // InfoProvided
53+
if (infoProvided)
54+
{
55+
_worldPacket << uint8(!addon.HasKey); // KeyProvided
56+
if (!addon.HasKey)
57+
_worldPacket.append(PublicKey); // KeyData
58+
59+
_worldPacket << uint32(0); // Revision (from .toc), can be used by SECURE_VISIBLE to display "update available" in client addon controls
60+
}
61+
62+
_worldPacket << uint8(0); // UrlProvided
63+
//if (UrlProvided)
64+
// data << uint8(0); // URL, client will create internet shortcut with this destination in Interface\Addons\addon_name\addon_name.url
65+
}
66+
67+
_worldPacket << uint32(BannedAddons.size());
68+
69+
for (BannedAddon const& addon : BannedAddons)
70+
{
71+
_worldPacket << uint32(addon.Id); // Id
72+
_worldPacket.append(addon.NameMD5); // NameMD5 - MD5 of addon .toc filename without extension
73+
_worldPacket.append(addon.VersionMD5); // VersionMD5 - MD5 of version string declared in addon .toc file
74+
_worldPacket << uint32(addon.Timestamp); // LastModified
75+
_worldPacket << uint32(1); // Flags
76+
}
77+
78+
return &_worldPacket;
79+
}
80+
81+
WorldPacket const* ClientCacheVersion::Write()
82+
{
83+
_worldPacket << uint32(CacheVersion);
84+
85+
return &_worldPacket;
86+
}
87+
}
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
/*
2+
* Copyright (C) 2008-2014 TrinityCore <http://www.trinitycore.org/>
3+
*
4+
* This program is free software; you can redistribute it and/or modify it
5+
* under the terms of the GNU General Public License as published by the
6+
* Free Software Foundation; either version 2 of the License, or (at your
7+
* option) any later version.
8+
*
9+
* This program is distributed in the hope that it will be useful, but WITHOUT
10+
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11+
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12+
* more details.
13+
*
14+
* You should have received a copy of the GNU General Public License along
15+
* with this program. If not, see <http://www.gnu.org/licenses/>.
16+
*/
17+
18+
#ifndef TRINITYCORE_CLIENT_CONFIG_PACKETS_H
19+
#define TRINITYCORE_CLIENT_CONFIG_PACKETS_H
20+
21+
#include "Packet.h"
22+
#include <span>
23+
24+
struct BannedAddon;
25+
struct SecureAddonInfo;
26+
27+
namespace WorldPackets
28+
{
29+
namespace ClientConfig
30+
{
31+
class AddonInfo final : public ServerPacket
32+
{
33+
static std::array<uint8, 256> const PublicKey;
34+
35+
public:
36+
explicit AddonInfo() : ServerPacket(SMSG_ADDON_INFO) { }
37+
38+
WorldPacket const* Write() override;
39+
40+
std::span<SecureAddonInfo const> Addons;
41+
std::span<BannedAddon const> BannedAddons;
42+
};
43+
44+
class ClientCacheVersion final : public ServerPacket
45+
{
46+
public:
47+
explicit ClientCacheVersion() : ServerPacket(SMSG_CLIENTCACHE_VERSION, 4) { }
48+
49+
WorldPacket const* Write() override;
50+
51+
uint32 CacheVersion = 0;
52+
};
53+
}
54+
}
55+
56+
#endif // TRINITYCORE_CLIENT_CONFIG_PACKETS_H

src/server/game/Server/Packets/SystemPackets.cpp

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,23 @@
1717

1818
#include "SystemPackets.h"
1919

20-
WorldPacket const* WorldPackets::System::FeatureSystemStatus::Write()
20+
namespace WorldPackets::System
21+
{
22+
WorldPacket const* FeatureSystemStatus::Write()
2123
{
2224
_worldPacket << uint8(ComplaintStatus);
2325
_worldPacket << uint8(VoiceEnabled);
2426

2527
return &_worldPacket;
2628
}
29+
30+
WorldPacket const* MOTD::Write()
31+
{
32+
_worldPacket << uint32(Text->size());
33+
34+
for (std::string const& line : *Text)
35+
_worldPacket << line;
36+
37+
return &_worldPacket;
38+
}
39+
}

src/server/game/Server/Packets/SystemPackets.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,16 @@ namespace WorldPackets
3535
uint8 ComplaintStatus = COMPLAINT_ENABLED_WITH_AUTO_IGNORE;
3636
bool VoiceEnabled = false;
3737
};
38+
39+
class MOTD final : public ServerPacket
40+
{
41+
public:
42+
MOTD() : ServerPacket(SMSG_MOTD) { }
43+
44+
WorldPacket const* Write() override;
45+
46+
std::vector<std::string> const* Text = nullptr;
47+
};
3848
}
3949
}
4050

0 commit comments

Comments
 (0)