| 75 | } |
| 76 | |
| 77 | bool CharacterGetCustomStat(OsiArgumentDesc & args) |
| 78 | { |
| 79 | auto character = FindCharacterByNameGuid(args[0].String); |
| 80 | auto statId = args[1].String; |
| 81 | auto & statValue = args[2].Int32; |
| 82 | |
| 83 | auto statDefn = FindCustomStatDefinitionById(statId); |
| 84 | if (statDefn == nullptr) return false; |
| 85 | |
| 86 | auto entityWorld = GetEntityWorld(); |
| 87 | auto statsComponent = entityWorld->GetCustomStatsComponentByEntityHandle(character->Base.EntityObjectHandle); |
| 88 | if (statsComponent == nullptr) { |
| 89 | OsiError("Character has no CustomStatsComponent"); |
| 90 | return false; |
| 91 | } |
| 92 | |
| 93 | auto value = statsComponent->StatValues.Find(statDefn->Id.Str); |
| 94 | if (value == nullptr) { |
| 95 | OsiWarn("Character has no custom stat named '" << statId << "'"); |
| 96 | return false; |
| 97 | } |
| 98 | |
| 99 | statValue = *value; |
| 100 | return true; |
| 101 | } |
| 102 | |
| 103 | void CharacterSyncCustomStats(esv::Character * character, eoc::CustomStatsComponent * stats, |
| 104 | FixedString statKey, int statValue) |
nothing calls this directly
no test coverage detected