Further implement Property Behavior parsing (#936)

Further implements the ControlBehavior processing and adds preparations for cheat detection
This commit is contained in:
David Markowitz
2023-02-13 18:55:44 -08:00
committed by GitHub
parent 3cd0d1ec3d
commit 72c93c8913
56 changed files with 1181 additions and 362 deletions

View File

@@ -0,0 +1,39 @@
#include "AddActionMessage.h"
AddActionMessage::AddActionMessage(AMFArrayValue* arguments) {
auto* actionIndexAmf = arguments->FindValue<AMFDoubleValue>("actionIndex");
if (!actionIndexAmf) return;
actionIndex = static_cast<uint32_t>(actionIndexAmf->GetDoubleValue());
stripId = GetStripIDFromArgument(arguments);
stateId = GetBehaviorStateFromArgument(arguments);
type = "";
valueParameterName = "";
valueParameterString = "";
valueParameterDouble = 0.0;
auto* action = arguments->FindValue<AMFArrayValue>("action");
if (!action) return;
for (auto& typeValueMap : action->GetAssociativeMap()) {
if (typeValueMap.first == "Type") {
if (typeValueMap.second->GetValueType() != AMFValueType::AMFString) continue;
type = static_cast<AMFStringValue*>(typeValueMap.second)->GetStringValue();
} else {
valueParameterName = typeValueMap.first;
// Message is the only known string parameter
if (valueParameterName == "Message") {
if (typeValueMap.second->GetValueType() != AMFValueType::AMFString) continue;
valueParameterString = static_cast<AMFStringValue*>(typeValueMap.second)->GetStringValue();
} else {
if (typeValueMap.second->GetValueType() != AMFValueType::AMFDouble) continue;
valueParameterDouble = static_cast<AMFDoubleValue*>(typeValueMap.second)->GetDoubleValue();
}
}
}
behaviorId = GetBehaviorIDFromArgument(arguments);
Game::logger->LogDebug("AddActionMessage", "acnNdx %i stpId %i sttId %i t %s vpn %s vps %s vpd %f bhId %i", actionIndex, stripId, stateId, type.c_str(), valueParameterName.c_str(), valueParameterString.c_str(), valueParameterDouble, behaviorId);
}