| 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) |
nothing calls this directly
no test coverage detected