MCPcopy Create free account
hub / github.com/Norbyte/ositools / CharacterSetStatInt

Function CharacterSetStatInt

OsiInterface/Functions/CharacterFunctions.cpp:59–77  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

57 }
58
59 void CharacterSetStatInt(OsiArgumentDesc const & args)
60 {
61 auto character = FindCharacterByNameGuid(args[0].String);
62 auto stat = args[1].String;
63 auto value = args[2].Int32;
64
65 if (character == nullptr || character->Stats == nullptr) return;
66
67 auto clamped = value;
68 if (strcmp(stat, "CurrentVitality") == 0) {
69 clamped = std::clamp(value, 0, (int32_t)character->Stats->MaxVitality);
70 } else if (strcmp(stat, "CurrentArmor") == 0) {
71 clamped = std::clamp(value, 0, (int32_t)character->Stats->MaxArmor);
72 } else if (strcmp(stat, "CurrentMagicArmor") == 0) {
73 clamped = std::clamp(value, 0, (int32_t)character->Stats->MaxMagicArmor);
74 }
75
76 gCharacterStatsPropertyMap.setInt(character->Stats, stat, clamped, false, true);
77 }
78
79 template <OsiPropertyMapType Type>
80 bool CharacterGetPermanentBoost(OsiArgumentDesc & args)

Callers

nothing calls this directly

Calls 2

FindCharacterByNameGuidFunction · 0.85
setIntMethod · 0.80

Tested by

no test coverage detected