Use localized string for motd (async).
This commit is contained in:
parent
b1e16f70e7
commit
b819f7e68e
@ -20,14 +20,6 @@ namespace Components
|
||||
data.push_back({ "weapons_mp", 1, 0 });
|
||||
|
||||
Game::DB_LoadXAssets(data.data(), data.size(), sync);
|
||||
|
||||
#ifdef DEBUG
|
||||
if (!ZoneBuilder::IsEnabled())
|
||||
{
|
||||
info = { "penis", 1, 0 };
|
||||
Game::DB_LoadXAssets(&info, 1, 1);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
const char* FastFiles::GetZoneLocation(const char* file)
|
||||
|
@ -2,27 +2,34 @@
|
||||
|
||||
namespace Components
|
||||
{
|
||||
std::string News::Motd;
|
||||
|
||||
const char* News::GetMotd()
|
||||
{
|
||||
return News::Motd.data();
|
||||
}
|
||||
std::thread* News::Thread = 0;
|
||||
|
||||
News::News()
|
||||
{
|
||||
Localization::Set("MPUI_CHANGELOG_TEXT", "");
|
||||
Localization::Set("MPUI_MOTD_TEXT", "Welcome to ReactIW4x Multiplayer!");
|
||||
|
||||
News::Motd = Utils::WebIO("IW4x", "https://iw4xcachep26muba.onion.to/iw4/motd.txt").SetTimeout(1000)->Get();
|
||||
|
||||
if (!News::Motd.size())
|
||||
News::Thread = new std::thread([] ()
|
||||
{
|
||||
News::Motd = "Welcome to ReactIW4x Multiplayer!";
|
||||
Localization::Set("MPUI_CHANGELOG_TEXT", Utils::WebIO("IW4x", "https://iw4xcachep26muba.onion.to/iw4/changelog.txt").Get().data());
|
||||
|
||||
std::string data = Utils::WebIO("IW4x", "https://iw4xcachep26muba.onion.to/iw4/motd.txt").Get();
|
||||
|
||||
if (data.size())
|
||||
{
|
||||
Localization::Set("MPUI_MOTD_TEXT", data.data());
|
||||
}
|
||||
|
||||
Localization::Set("MPUI_CHANGELOG_TEXT", Utils::WebIO("IW4x", "https://iw4xcachep26muba.onion.to/iw4/changelog.txt").SetTimeout(1000)->Get().data());
|
||||
// TODO: Implement update checks here!
|
||||
});
|
||||
}
|
||||
|
||||
// Patch motd setting
|
||||
Utils::Hook(0x60BF19, News::GetMotd, HOOK_CALL).Install()->Quick();
|
||||
News::~News()
|
||||
{
|
||||
if (News::Thread)
|
||||
{
|
||||
News::Thread->join();
|
||||
delete News::Thread;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4,10 +4,10 @@ namespace Components
|
||||
{
|
||||
public:
|
||||
News();
|
||||
~News();
|
||||
const char* GetName() { return "News"; };
|
||||
|
||||
private:
|
||||
static std::string Motd;
|
||||
static const char* GetMotd();
|
||||
static std::thread* Thread;
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user