Nice Commit! :)

This commit is contained in:
TomNordesen 2021-12-07 20:19:47 +01:00
parent bfcce19649
commit c48f4b08a2
3 changed files with 11 additions and 9 deletions

View File

@ -162,6 +162,15 @@ certutil -hashfile <file> SHA256
* Copy over or create symlinks from `macros`, `BrickModels`, `chatplus_en_us.txt`, `names`, and `maps` in your client `res` directory to the server `build/res` directory
* Unzip the navmeshes [here](./resources/navmeshes.zip) and place them in `build/res/maps/navmeshes`
**Fix chatplus_en_us.txt**
* If the file has been made in windows it has to be converted to support unix. Inside of WSL run this command
* Move yourself into build/res using cd if you are not yet in there.
```bash
cd build/res
sudo apt install dos2unix
dos2unix -o chatplus_en_us.txt chatplus_en_us.txt
```
**Setup locale**
* In the `build` directory create a `locale` directory if it does not already exist
* Copy over or create symlinks from `locale.xml` in your client `locale` directory to the `build/locale` directory

View File

@ -83,7 +83,7 @@ void dChatFilter::ReadWordlistDCF(const std::string& filepath) {
}
void dChatFilter::ExportWordlistToDCF(const std::string& filepath) {
std::ofstream file(filepath, std::ios::binary);
std::ofstream file(filepath, std::ios::binary | std::ios_base::out );
if (file) {
BinaryIO::BinaryWrite(file, uint32_t(dChatFilterDCF::header));
BinaryIO::BinaryWrite(file, uint32_t(dChatFilterDCF::formatVersion));
@ -110,22 +110,16 @@ bool dChatFilter::IsSentenceOkay(const std::string& message, int gmLevel) {
segment = std::regex_replace(segment, reg, "");
size_t hash = CalculateHash(segment);
Game::logger->Log("SEGMENT", "Word: %s Hash: %zu", segment.c_str(), hash);
if (std::find(m_UserUnapprovedWordCache.begin(), m_UserUnapprovedWordCache.end(), hash) != m_UserUnapprovedWordCache.end()) {
Game::logger->Log("SENTENCEOKAY", "SENTENCE IS UNNAPROVED");
return false;
}
bool a = IsInWordlist(hash);
Game::logger->Log("ISWORDLIST", "ISINWORDLIST: %s", a?"YES":"NO");
if (!a) {
Game::logger->Log("SENTENCEOKAY", "SENTENCE IS NOT IN WORDLIST");
if (!IsInWordlist(hash)) {
m_UserUnapprovedWordCache.push_back(hash);
return false;
}
}
Game::logger->Log("SENTENCEOKAY", "SENTENCE IS OKAY TO SEND");
return true;
}

View File

@ -295,7 +295,6 @@ void ClientPackets::HandleChatModerationRequest(const SystemAddress& sysAddr, Pa
std::unordered_map<char, char> unacceptedItems;
bool bAllClean = Game::chatFilter->IsSentenceOkay(message, user->GetLastUsedChar()->GetGMLevel());
Game::logger->Log("BALLCLEAN", "%s", bAllClean?"Is Clean":"IS NOT CLEAN!!!");
if (!bAllClean) {
unacceptedItems.insert(std::make_pair((char)0, (char)message.length()));
}