commit
7808e9a90c
@ -187,7 +187,7 @@ The format is based on [Keep a Changelog v0.3.0](http://keepachangelog.com/en/0.
|
|||||||
- Fixed slow motion during final killcams (#111 - #107)
|
- Fixed slow motion during final killcams (#111 - #107)
|
||||||
- Fixed sound issue that causes the game to freeze (#106)
|
- Fixed sound issue that causes the game to freeze (#106)
|
||||||
- Fixed issue where materials strings found in hostnames, player names, chat etc. caused the game to crash (#113)
|
- Fixed issue where materials strings found in hostnames, player names, chat etc. caused the game to crash (#113)
|
||||||
- Fixed issue with servers displaying an invalid player count (#144)
|
- Fixed issue with servers displaying an invalid player count (#113)
|
||||||
|
|
||||||
### Known issues
|
### Known issues
|
||||||
|
|
||||||
|
@ -5,10 +5,10 @@ namespace Assets
|
|||||||
{
|
{
|
||||||
void Isnd_alias_list_t::load(Game::XAssetHeader* header, const std::string& name, Components::ZoneBuilder::Zone* builder)
|
void Isnd_alias_list_t::load(Game::XAssetHeader* header, const std::string& name, Components::ZoneBuilder::Zone* builder)
|
||||||
{
|
{
|
||||||
Components::FileSystem::File aliasFile(Utils::String::VA("sounds/%s", name.c_str()));
|
Components::FileSystem::File aliasFile(Utils::String::VA("sounds/%s.json", name.data()));
|
||||||
if (!aliasFile.exists())
|
if (!aliasFile.exists())
|
||||||
{
|
{
|
||||||
header->sound = Components::AssetHandler::FindOriginalAsset(this->getType(), name.c_str()).sound;
|
header->sound = Components::AssetHandler::FindOriginalAsset(this->getType(), name.data()).sound;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -19,7 +19,6 @@ namespace Assets
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string errors;
|
|
||||||
nlohmann::json infoData = nlohmann::json::parse(aliasFile.getBuffer());
|
nlohmann::json infoData = nlohmann::json::parse(aliasFile.getBuffer());
|
||||||
nlohmann::json aliasesContainer = infoData["head"];
|
nlohmann::json aliasesContainer = infoData["head"];
|
||||||
|
|
||||||
|
@ -151,7 +151,8 @@ namespace Components
|
|||||||
if (idEntry.is_string())
|
if (idEntry.is_string())
|
||||||
{
|
{
|
||||||
SteamID id;
|
SteamID id;
|
||||||
id.bits = strtoull(idEntry.get<std::string>().data(), nullptr, 16);
|
auto guid = idEntry.get<std::string>();
|
||||||
|
id.bits = std::strtoull(guid.data(), nullptr, 16);
|
||||||
|
|
||||||
list->idList.push_back(id);
|
list->idList.push_back(id);
|
||||||
}
|
}
|
||||||
|
@ -20,13 +20,10 @@ namespace Components
|
|||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
return Utils::String::VA("%d", index);
|
return Utils::String::VA("%d", index);
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
return ServerInfo::PlayerContainer.playerList[index].name.data();
|
return ServerInfo::PlayerContainer.playerList[index].name.data();
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
return Utils::String::VA("%d", ServerInfo::PlayerContainer.playerList[index].score);
|
return Utils::String::VA("%d", ServerInfo::PlayerContainer.playerList[index].score);
|
||||||
|
|
||||||
case 3:
|
case 3:
|
||||||
return Utils::String::VA("%d", ServerInfo::PlayerContainer.playerList[index].ping);
|
return Utils::String::VA("%d", ServerInfo::PlayerContainer.playerList[index].ping);
|
||||||
default:
|
default:
|
||||||
@ -130,17 +127,16 @@ namespace Components
|
|||||||
|
|
||||||
Utils::InfoString ServerInfo::GetInfo()
|
Utils::InfoString ServerInfo::GetInfo()
|
||||||
{
|
{
|
||||||
int maxclientCount = *Game::svs_clientCount;
|
auto maxClientCount = *Game::svs_clientCount;
|
||||||
|
|
||||||
if (!maxclientCount)
|
if (!maxClientCount)
|
||||||
{
|
{
|
||||||
maxclientCount = Dvar::Var("party_maxplayers").get<int>();
|
maxClientCount = Dvar::Var("party_maxplayers").get<int>();
|
||||||
//maxclientCount = Game::Party_GetMaxPlayers(*Game::partyIngame);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Utils::InfoString info(Game::Dvar_InfoString_Big(1024));
|
Utils::InfoString info(Game::Dvar_InfoString_Big(Game::DVAR_SERVERINFO));
|
||||||
info.set("gamename", "IW4");
|
info.set("gamename", "IW4");
|
||||||
info.set("sv_maxclients", Utils::String::VA("%i", maxclientCount));
|
info.set("sv_maxclients", Utils::String::VA("%i", maxClientCount));
|
||||||
info.set("protocol", Utils::String::VA("%i", PROTOCOL));
|
info.set("protocol", Utils::String::VA("%i", PROTOCOL));
|
||||||
info.set("shortversion", SHORTVERSION);
|
info.set("shortversion", SHORTVERSION);
|
||||||
info.set("mapname", Dvar::Var("mapname").get<const char*>());
|
info.set("mapname", Dvar::Var("mapname").get<const char*>());
|
||||||
@ -231,84 +227,83 @@ namespace Components
|
|||||||
|
|
||||||
Network::OnPacket("statusResponse", [](const Network::Address& address, [[maybe_unused]] const std::string& data)
|
Network::OnPacket("statusResponse", [](const Network::Address& address, [[maybe_unused]] const std::string& data)
|
||||||
{
|
{
|
||||||
if (ServerInfo::PlayerContainer.target == address)
|
if (ServerInfo::PlayerContainer.target != address)
|
||||||
{
|
{
|
||||||
Utils::InfoString info(data.substr(0, data.find_first_of("\n")));
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Dvar::Var("uiSi_ServerName").set(info.get("sv_hostname"));
|
const Utils::InfoString info(data.substr(0, data.find_first_of("\n")));
|
||||||
Dvar::Var("uiSi_MaxClients").set(info.get("sv_maxclients"));
|
|
||||||
Dvar::Var("uiSi_Version").set(info.get("shortversion"));
|
|
||||||
Dvar::Var("uiSi_SecurityLevel").set(info.get("sv_securityLevel"));
|
|
||||||
Dvar::Var("uiSi_isPrivate").set(info.get("isPrivate") == "0" ? "@MENU_NO" : "@MENU_YES");
|
|
||||||
Dvar::Var("uiSi_Hardcore").set(info.get("g_hardcore") == "0" ? "@MENU_DISABLED" : "@MENU_ENABLED");
|
|
||||||
Dvar::Var("uiSi_KillCam").set(info.get("scr_game_allowkillcam") == "0" ? "@MENU_NO" : "@MENU_YES");
|
|
||||||
Dvar::Var("uiSi_MapName").set(info.get("mapname"));
|
|
||||||
Dvar::Var("uiSi_MapNameLoc").set(Game::UI_LocalizeMapName(info.get("mapname").data()));
|
|
||||||
Dvar::Var("uiSi_GameType").set(Game::UI_LocalizeGameType(info.get("g_gametype").data()));
|
|
||||||
Dvar::Var("uiSi_ModName").set("");
|
|
||||||
|
|
||||||
switch (atoi(info.get("scr_team_fftype").data()))
|
Dvar::Var("uiSi_ServerName").set(info.get("sv_hostname"));
|
||||||
|
Dvar::Var("uiSi_MaxClients").set(info.get("sv_maxclients"));
|
||||||
|
Dvar::Var("uiSi_Version").set(info.get("shortversion"));
|
||||||
|
Dvar::Var("uiSi_SecurityLevel").set(info.get("sv_securityLevel"));
|
||||||
|
Dvar::Var("uiSi_isPrivate").set(info.get("isPrivate") == "0" ? "@MENU_NO" : "@MENU_YES");
|
||||||
|
Dvar::Var("uiSi_Hardcore").set(info.get("g_hardcore") == "0" ? "@MENU_DISABLED" : "@MENU_ENABLED");
|
||||||
|
Dvar::Var("uiSi_KillCam").set(info.get("scr_game_allowkillcam") == "0" ? "@MENU_NO" : "@MENU_YES");
|
||||||
|
Dvar::Var("uiSi_MapName").set(info.get("mapname"));
|
||||||
|
Dvar::Var("uiSi_MapNameLoc").set(Game::UI_LocalizeMapName(info.get("mapname").data()));
|
||||||
|
Dvar::Var("uiSi_GameType").set(Game::UI_LocalizeGameType(info.get("g_gametype").data()));
|
||||||
|
Dvar::Var("uiSi_ModName").set("");
|
||||||
|
|
||||||
|
switch (atoi(info.get("scr_team_fftype").data()))
|
||||||
|
{
|
||||||
|
default:
|
||||||
|
Dvar::Var("uiSi_ffType").set("@MENU_DISABLED");
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
Dvar::Var("uiSi_ffType").set("@MENU_ENABLED");
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
Dvar::Var("uiSi_ffType").set("@MPUI_RULES_REFLECT");
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
Dvar::Var("uiSi_ffType").set("@MPUI_RULES_SHARED");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (info.get("fs_game").size() > 5)
|
||||||
|
{
|
||||||
|
Dvar::Var("uiSi_ModName").set(info.get("fs_game").data() + 5);
|
||||||
|
}
|
||||||
|
|
||||||
|
auto lines = Utils::String::Split(data, '\n');
|
||||||
|
|
||||||
|
if (lines.size() <= 1) return;
|
||||||
|
|
||||||
|
for (std::size_t i = 1; i < lines.size(); ++i)
|
||||||
|
{
|
||||||
|
ServerInfo::Container::Player player;
|
||||||
|
|
||||||
|
std::string currentData = lines[i];
|
||||||
|
|
||||||
|
if (currentData.size() < 3) continue;
|
||||||
|
|
||||||
|
// Insert score
|
||||||
|
player.score = atoi(currentData.substr(0, currentData.find_first_of(" ")).data());
|
||||||
|
|
||||||
|
// Remove score
|
||||||
|
currentData = currentData.substr(currentData.find_first_of(" ") + 1);
|
||||||
|
|
||||||
|
// Insert ping
|
||||||
|
player.ping = atoi(currentData.substr(0, currentData.find_first_of(" ")).data());
|
||||||
|
|
||||||
|
// Remove ping
|
||||||
|
currentData = currentData.substr(currentData.find_first_of(" ") + 1);
|
||||||
|
|
||||||
|
if (currentData[0] == '\"')
|
||||||
{
|
{
|
||||||
default:
|
currentData = currentData.substr(1);
|
||||||
Dvar::Var("uiSi_ffType").set("@MENU_DISABLED");
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 1:
|
|
||||||
Dvar::Var("uiSi_ffType").set("@MENU_ENABLED");
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 2:
|
|
||||||
Dvar::Var("uiSi_ffType").set("@MPUI_RULES_REFLECT");
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 3:
|
|
||||||
Dvar::Var("uiSi_ffType").set("@MPUI_RULES_SHARED");
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (info.get("fs_game").size() > 5)
|
if (currentData.back() == '\"')
|
||||||
{
|
{
|
||||||
Dvar::Var("uiSi_ModName").set(info.get("fs_game").data() + 5);
|
currentData.pop_back();
|
||||||
}
|
}
|
||||||
|
|
||||||
auto lines = Utils::String::Split(data, '\n');
|
player.name = currentData;
|
||||||
|
|
||||||
if (lines.size() <= 1) return;
|
ServerInfo::PlayerContainer.playerList.push_back(player);
|
||||||
|
|
||||||
for (unsigned int i = 1; i < lines.size(); ++i)
|
|
||||||
{
|
|
||||||
ServerInfo::Container::Player player;
|
|
||||||
|
|
||||||
std::string currentData = lines[i];
|
|
||||||
|
|
||||||
if (currentData.size() < 3) continue;
|
|
||||||
|
|
||||||
// Insert score
|
|
||||||
player.score = atoi(currentData.substr(0, currentData.find_first_of(" ")).data());
|
|
||||||
|
|
||||||
// Remove score
|
|
||||||
currentData = currentData.substr(currentData.find_first_of(" ") + 1);
|
|
||||||
|
|
||||||
// Insert ping
|
|
||||||
player.ping = atoi(currentData.substr(0, currentData.find_first_of(" ")).data());
|
|
||||||
|
|
||||||
// Remove ping
|
|
||||||
currentData = currentData.substr(currentData.find_first_of(" ") + 1);
|
|
||||||
|
|
||||||
if (currentData[0] == '\"')
|
|
||||||
{
|
|
||||||
currentData = currentData.substr(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (currentData.back() == '\"')
|
|
||||||
{
|
|
||||||
currentData.pop_back();
|
|
||||||
}
|
|
||||||
|
|
||||||
player.name = currentData;
|
|
||||||
|
|
||||||
ServerInfo::PlayerContainer.playerList.push_back(player);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -312,7 +312,6 @@ namespace Components
|
|||||||
|
|
||||||
void ServerList::StoreFavourite(const std::string& server)
|
void ServerList::StoreFavourite(const std::string& server)
|
||||||
{
|
{
|
||||||
//json11::Json::parse()
|
|
||||||
std::vector<std::string> servers;
|
std::vector<std::string> servers;
|
||||||
|
|
||||||
if (Utils::IO::FileExists("players/favourites.json"))
|
if (Utils::IO::FileExists("players/favourites.json"))
|
||||||
@ -327,7 +326,7 @@ namespace Components
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
nlohmann::json::array_t storedServers = object;
|
nlohmann::json::array_t storedServers = object;
|
||||||
|
|
||||||
for (unsigned int i = 0; i < storedServers.size(); ++i)
|
for (unsigned int i = 0; i < storedServers.size(); ++i)
|
||||||
{
|
{
|
||||||
@ -540,15 +539,12 @@ namespace Components
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
auto lList = ServerList::GetList();
|
auto lList = ServerList::GetList();
|
||||||
|
|
||||||
if (lList)
|
if (lList)
|
||||||
{
|
{
|
||||||
lList->push_back(server);
|
lList->push_back(server);
|
||||||
ServerList::RefreshVisibleListInternal(UIScript::Token());
|
ServerList::RefreshVisibleListInternal(UIScript::Token());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -206,7 +206,8 @@ namespace Components
|
|||||||
info.gametype = metaObject["gametype"].get<std::string>();
|
info.gametype = metaObject["gametype"].get<std::string>();
|
||||||
info.mapname = metaObject["mapname"].get<std::string>();
|
info.mapname = metaObject["mapname"].get<std::string>();
|
||||||
info.length = metaObject["length"].get<int>();
|
info.length = metaObject["length"].get<int>();
|
||||||
info.timeStamp = _atoi64(metaObject["timestamp"].get<std::string>().data());
|
auto timestamp = metaObject["timestamp"].get<std::string>();
|
||||||
|
info.timeStamp = _atoi64(timestamp.data());
|
||||||
|
|
||||||
Theatre::Demos.push_back(info);
|
Theatre::Demos.push_back(info);
|
||||||
}
|
}
|
||||||
|
@ -76,6 +76,6 @@ namespace Utils
|
|||||||
|
|
||||||
nlohmann::json InfoString::to_json() const
|
nlohmann::json InfoString::to_json() const
|
||||||
{
|
{
|
||||||
return {this->keyValuePairs};
|
return this->keyValuePairs;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user