Nice Commit! :)

This commit is contained in:
TomNordesen 2021-12-07 20:35:12 +01:00
parent c48f4b08a2
commit d2fe15679c
3 changed files with 14 additions and 12 deletions

View File

@ -162,15 +162,6 @@ 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 * 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` * 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** **Setup locale**
* In the `build` directory create a `locale` directory if it does not already exist * 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 * Copy over or create symlinks from `locale.xml` in your client `locale` directory to the `build/locale` directory

View File

@ -105,9 +105,22 @@ bool dChatFilter::IsSentenceOkay(const std::string& message, int gmLevel) {
std::string segment; std::string segment;
std::regex reg("(!*|\\?*|\\;*|\\.*|\\,*)"); std::regex reg("(!*|\\?*|\\;*|\\.*|\\,*)");
#ifdef _win32
while (std::getline(file, line)) {
line.erase(std::remove(line.begin(), line.end(), '\r'), line.end()); //Remove nix line-endings
std::transform(line.begin(), line.end(), line.begin(), ::tolower); //Transform to lowercase
m_Words.push_back(CalculateHash(line));
}
#else
while (std::getline(sMessage, segment, ' ')) { while (std::getline(sMessage, segment, ' ')) {
#endif
std::transform(segment.begin(), segment.end(), segment.begin(), ::tolower); //Transform to lowercase std::transform(segment.begin(), segment.end(), segment.begin(), ::tolower); //Transform to lowercase
segment = std::regex_replace(segment, reg, ""); segment = std::regex_replace(segment, reg, "");
size_t hash = CalculateHash(segment); size_t hash = CalculateHash(segment);

View File

@ -64,8 +64,6 @@ void ClientPackets::HandleChatMessage(const SystemAddress& sysAddr, Packet* pack
std::string playerName = user->GetLastUsedChar()->GetName(); std::string playerName = user->GetLastUsedChar()->GetName();
bool isMythran = user->GetLastUsedChar()->GetGMLevel() > 0; bool isMythran = user->GetLastUsedChar()->GetGMLevel() > 0;
Game::logger->Log("IsUserMythran", "%s", isMythran?"Yes, they are mythran\n":"No, they are not mythran\n");
Game::logger->Log("IsMessageApproved", "%s", user->GetLastChatMessageApproved()?"Yes, Their message is approved\n":"No, their message is not approved\n");
if (!user->GetLastChatMessageApproved() && !isMythran) return; if (!user->GetLastChatMessageApproved() && !isMythran) return;