CS2-Kit
C++23 library for CS2 Metamod:Source plugin development
Loading...
Searching...
No Matches
Schema.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <CS2Kit/Core/Singleton.hpp>
4#include <cstdint>
5#include <map>
6#include <string>
7
8namespace CS2Kit::Sdk
9{
10
11/**
12 * Runtime schema field offset resolution via ISchemaSystem.
13 * Provides access to entity field offsets at runtime by querying the
14 * engine's schema system. Results are cached for O(1) repeated access.
15 */
16class SchemaService : public Core::Singleton<SchemaService>
17{
18public:
19 explicit SchemaService(Token) {}
20
21 bool Initialize();
22 int GetOffset(const char* className, const char* fieldName);
23
24private:
25 std::map<std::string, std::map<std::string, int>> _offsetCache;
26};
27
28} // namespace CS2Kit::Sdk
int GetOffset(const char *className, const char *fieldName)
Definition Schema.cpp:24