统一native_sdk

This commit is contained in:
Huoji's
2023-10-02 17:31:02 +08:00
parent 7d24c5a405
commit dc75327dec
46 changed files with 573 additions and 629 deletions

34
csgo2/sdk_tools.cpp Normal file
View File

@@ -0,0 +1,34 @@
#include "sdk_tools.h"
namespace SdkTools {
auto ProcessChatString(const std::string& input) -> std::tuple<bool, _ChatType, std::string>
{
_ChatType chatType;
std::string content;
bool success = true;
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD> "say_team" <20><> "say" <20><>ͷ
if (input.size() >= 9 && input.substr(0, 9) == "say_team ") {
chatType = _ChatType::kTeam;
content = input.substr(9);
}
else if (input.size() >= 5 && input.substr(0, 4) == "say ") {
chatType = _ChatType::kAll;
content = input.substr(4);
}
else {
success = false;
}
if (success == true) {
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ű<EFBFBD>Χ
if (content.front() != '"' || content.back() != '"') {
success = false;
}
else {
// <20>Ƴ<EFBFBD><C6B3><EFBFBD><EFBFBD><EFBFBD>
content = content.substr(1, content.size() - 2);
}
}
return std::make_tuple(success, chatType, content);
}
};