mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2024-11-14 04:08:20 +00:00
6592bbea46
* chore: default size to 33 on LU(W)Strings since that's the most common lenght Was doing this on other places, but not the main one * chore: remove all raw packet reading from chat packet handler and general chat packet cleanup * fix team invite/promote/kick * Address feedback * fix friends check * update comments * Address feedback Add GM level handeling * Address feedback
19 lines
522 B
C++
19 lines
522 B
C++
#include "PacketUtils.h"
|
|
#include <fstream>
|
|
#include "Logger.h"
|
|
#include "Game.h"
|
|
|
|
//! Saves a packet to the filesystem
|
|
void PacketUtils::SavePacket(const std::string& filename, const char* data, size_t length) {
|
|
//If we don't log to the console, don't save the bin files either. This takes up a lot of time.
|
|
if (!Game::logger->GetLogToConsole()) return;
|
|
|
|
std::string path = "packets/" + filename;
|
|
|
|
std::ofstream file(path, std::ios::binary);
|
|
if (!file.is_open()) return;
|
|
|
|
file.write(data, length);
|
|
file.close();
|
|
}
|