Add warden and comprehensive movement checks (#216)
* Initial Warden Implementation. * Send notification to gamemasters. * Implement support for all modules. * Misc improvements. * Fix copy paste error. * Update wrong file header. * Fix travis build. * Fix possible crash. * Add new anticheat. * Resolve issue when being teleported. * Add config checks. * More config checks. * Move enum to more appropriate header. * Fix compile for old builds. * Sent root on possessed creature after active mover packet. * Allow out of order acks. * Return result of tests in handle speed ack. * Stop disconnected player from moving. * Remove no longer needed include. * Fix wrong speed when jumping in water. * Add back the braces. * Only send heartbeat for resendable changes. Fixes https://github.com/vmangos/core/issues/212
This commit is contained in:
@@ -525,3 +525,46 @@ void hexEncodeByteArray(uint8* bytes, uint32 arrayLen, std::string& result)
|
||||
}
|
||||
result = ss.str();
|
||||
}
|
||||
|
||||
std::string ByteArrayToHexStr(uint8 const* bytes, uint32 arrayLen, bool reverse /* = false */) {
|
||||
int32 init = 0;
|
||||
int32 end = arrayLen;
|
||||
int8 op = 1;
|
||||
|
||||
if (reverse) {
|
||||
init = arrayLen - 1;
|
||||
end = -1;
|
||||
op = -1;
|
||||
}
|
||||
|
||||
std::ostringstream ss;
|
||||
for (int32 i = init; i != end; i += op) {
|
||||
char buffer[4];
|
||||
sprintf(buffer, "%02X", bytes[i]);
|
||||
ss << buffer;
|
||||
}
|
||||
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
void HexStrToByteArray(std::string const& str, uint8* out, bool reverse /*= false*/) {
|
||||
// string must have even number of characters
|
||||
if (str.length() & 1)
|
||||
return;
|
||||
|
||||
int32 init = 0;
|
||||
int32 end = str.length();
|
||||
int8 op = 1;
|
||||
|
||||
if (reverse) {
|
||||
init = str.length() - 2;
|
||||
end = -2;
|
||||
op = -1;
|
||||
}
|
||||
|
||||
uint32 j = 0;
|
||||
for (int32 i = init; i != end; i += 2 * op) {
|
||||
char buffer[3] = { str[i], str[i + 1], '\0' };
|
||||
out[j++] = strtoul(buffer, NULL, 16);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user