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 });
|
data.push_back({ "weapons_mp", 1, 0 });
|
||||||
|
|
||||||
Game::DB_LoadXAssets(data.data(), data.size(), sync);
|
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)
|
const char* FastFiles::GetZoneLocation(const char* file)
|
||||||
|
@ -2,27 +2,34 @@
|
|||||||
|
|
||||||
namespace Components
|
namespace Components
|
||||||
{
|
{
|
||||||
std::string News::Motd;
|
std::thread* News::Thread = 0;
|
||||||
|
|
||||||
const char* News::GetMotd()
|
|
||||||
{
|
|
||||||
return News::Motd.data();
|
|
||||||
}
|
|
||||||
|
|
||||||
News::News()
|
News::News()
|
||||||
{
|
{
|
||||||
Localization::Set("MPUI_CHANGELOG_TEXT", "");
|
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();
|
News::Thread = new std::thread([] ()
|
||||||
|
|
||||||
if (!News::Motd.size())
|
|
||||||
{
|
{
|
||||||
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());
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: Implement update checks here!
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
News::~News()
|
||||||
|
{
|
||||||
|
if (News::Thread)
|
||||||
|
{
|
||||||
|
News::Thread->join();
|
||||||
|
delete News::Thread;
|
||||||
}
|
}
|
||||||
|
|
||||||
Localization::Set("MPUI_CHANGELOG_TEXT", Utils::WebIO("IW4x", "https://iw4xcachep26muba.onion.to/iw4/changelog.txt").SetTimeout(1000)->Get().data());
|
|
||||||
|
|
||||||
// Patch motd setting
|
|
||||||
Utils::Hook(0x60BF19, News::GetMotd, HOOK_CALL).Install()->Quick();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,10 +4,10 @@ namespace Components
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
News();
|
News();
|
||||||
|
~News();
|
||||||
const char* GetName() { return "News"; };
|
const char* GetName() { return "News"; };
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static std::string Motd;
|
static std::thread* Thread;
|
||||||
static const char* GetMotd();
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user