26 auto* schemaSystem = GameInterfaces::Instance().SchemaSystem;
30 auto classIt = _offsetCache.find(className);
31 if (classIt != _offsetCache.end())
33 auto fieldIt = classIt->second.find(fieldName);
34 if (fieldIt != classIt->second.end())
35 return fieldIt->second;
39 const char* moduleName =
"server.dll";
41 const char* moduleName =
"libserver.so";
44 CSchemaSystemTypeScope* pTypeScope = schemaSystem->FindTypeScopeForModule(moduleName);
47 Log::Error(
"Schema: Failed to find type scope for {}.", moduleName);
51 SchemaMetaInfoHandle_t<CSchemaClassInfo> hClassInfo = pTypeScope->FindDeclaredClass(className);
52 CSchemaClassInfo* pClassInfo = hClassInfo.Get();
55 Log::Error(
"Schema: Class '{}' not found.", className);
59 for (
int i = 0; i < pClassInfo->m_nFieldCount; ++i)
61 SchemaClassFieldData_t& field = pClassInfo->m_pFields[i];
62 if (strcmp(field.m_pszName, fieldName) == 0)
64 int offset = field.m_nSingleInheritanceOffset;
65 _offsetCache[className][fieldName] = offset;
71 Log::Warn(
"Schema: Field '{}' not found in '{}'.", fieldName, className);