remake - v1

This commit is contained in:
2026-08-10 14:21:28 +02:00
parent 1ecb7f777e
commit f1a5250613
7 changed files with 517 additions and 28 deletions

View File

@@ -3,6 +3,7 @@
#include "playerslot.h"
#include <cstdint>
#include <array>
#include <string>
#include <vector>
@@ -54,14 +55,20 @@ public:
bool AddWeaponItemDefRule(int recipientSlot, const char* target, uint16_t itemDefinitionIndex, std::string& error);
bool SetHealthMoneyTest(bool enabled, std::string& error);
bool SetHealth42Test(bool enabled, std::string& error);
bool SetRecipientHealthValue(int recipientSlot, int value, std::string& error);
void ClearRecipientHealthValues();
void Dump() const;
void SetTrace(bool value) { m_trace = value; }
bool Trace() const { return m_trace; }
size_t RuleCount() const { return m_rules.size(); }
size_t DynamicRuleCount() const { return (m_healthMoneyTest ? 1 : 0) + (m_health42Test ? 1 : 0); }
bool Empty() const { return m_rules.empty() && !m_healthMoneyTest && !m_health42Test; }
bool Health42Test() const { return m_health42Test; }
bool TryGetHealth42Value(CPlayerSlot recipient, int& value) const;
std::vector<AppliedOverride> ApplyForRecipient(CPlayerSlot slot);
std::vector<AppliedOverride> ApplyGlobalHealth42();
int MarkPlayerHealthDirty();
void Restore(const std::vector<AppliedOverride>& applied);
private:
@@ -69,13 +76,15 @@ private:
uintptr_t FindFirstEntityForTarget(const OverrideRule& rule) const;
uint8_t* ResolveAddress(uintptr_t entity, const OverrideRule& rule) const;
void ApplyHealthMoneyTest(CPlayerSlot slot, std::vector<AppliedOverride>& applied);
void ApplyHealth42Test(CPlayerSlot slot, std::vector<AppliedOverride>& applied);
std::vector<OverrideRule> m_rules;
int m_nextId {1};
bool m_trace {false};
bool m_healthMoneyTest {false};
bool m_health42Test {false};
int m_defaultHealth42Value {42};
std::array<bool, 64> m_recipientHealthSet {};
std::array<int, 64> m_recipientHealthValue {};
};
extern OverrideManager g_overrides;