46 lines
1.5 KiB
C++
46 lines
1.5 KiB
C++
#pragma once
|
|
#include <array>
|
|
#include <cstdint>
|
|
|
|
namespace gateway::spell_aura_restrictions {
|
|
inline constexpr std::uint32_t TableHash = 0xba978f4e;
|
|
// build_source_recipe_compat.page_id over the seven reviewed records in ID order.
|
|
inline constexpr std::int32_t PushID = 1294782901;
|
|
|
|
struct Record {
|
|
static constexpr std::uint32_t table = TableHash;
|
|
std::uint32_t id;
|
|
std::array<std::uint8_t, 46> data;
|
|
};
|
|
|
|
// Layout E7F2E213. The record ID travels in the packet header. The final
|
|
// 32-bit field in the unpacked hotfix body holds the SpellID relation.
|
|
constexpr Record restriction(std::uint32_t id, std::uint32_t spell,
|
|
std::uint32_t caster_state, std::uint32_t target_state) {
|
|
Record row{id, {}};
|
|
for (unsigned i = 0; i < 4; ++i) {
|
|
row.data[2 + i] = static_cast<std::uint8_t>(caster_state >> (8 * i));
|
|
row.data[6 + i] = static_cast<std::uint8_t>(target_state >> (8 * i));
|
|
row.data[42 + i] = static_cast<std::uint8_t>(spell >> (8 * i));
|
|
}
|
|
return row;
|
|
}
|
|
|
|
inline constexpr Record Records[] = {
|
|
restriction(2600000, 76, 1, 0),
|
|
restriction(2600001, 6174, 0, 2),
|
|
restriction(2600002, 6175, 0, 2),
|
|
restriction(2600003, 6186, 1, 0),
|
|
restriction(2600004, 6568, 1, 0),
|
|
restriction(2600005, 10374, 1, 0),
|
|
restriction(2600006, 45800, 13, 0),
|
|
};
|
|
|
|
inline const Record* lookup(std::uint32_t table, std::uint32_t id) {
|
|
if (table == TableHash)
|
|
for (const auto& row : Records)
|
|
if (row.id == id) return &row;
|
|
return nullptr;
|
|
}
|
|
}
|