Files
WoW-Hybrid-gateway/include/gateway/spell_modifier_operations.hpp

29 lines
1.6 KiB
C++

#pragma once
#include <cstdint>
#include <optional>
namespace gateway::spell_modifier {
enum class Kind : uint8_t { Flat, Percent };
struct OperationMapping {
uint8_t native_operation;
// Unit conversion applies only to flat aggregates, never percentage factors.
double flat_scale;
bool requires_power_index_zero;
};
struct NativeAggregate { uint8_t native_operation; float value; };
// Semantic operation mapping only: callers still own authenticated class,
// complete source/native family membership, metadata and lifecycle admission.
// No per-effect rebase is inferred for source aura-specific/custom operations.
std::optional<OperationMapping> operation_mapping(uint8_t source_operation) noexcept;
// Numeric conversion of a producer-qualified target/effect mapping only.
// This API does not qualify source semantics, membership, timing or native op ID.
// The caller must establish those before supplying a mapping; no global rebase
// is inferred. A finite flat scale is required even for percentage conversion.
std::optional<NativeAggregate> translate_qualified_aggregate(OperationMapping mapping,
Kind kind, int32_t source_aggregate, bool power_index_zero = false) noexcept;
// Source packets replace a SUM, not a delta. Flat reset=0; percent reset=1.
// power_index_zero must mean ALL affected native spell costs use index0.
// Reject inexact flat conversions; percentages use normal native float rounding.
std::optional<NativeAggregate> translate_aggregate(uint8_t source_operation,
Kind kind, int32_t source_aggregate, bool power_index_zero = false) noexcept;
}