127 files, from working commit b1a079a. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
33 lines
1.5 KiB
C++
33 lines
1.5 KiB
C++
#pragma once
|
|
#include "gateway/protocol.hpp"
|
|
|
|
namespace gateway {
|
|
|
|
// Internally assigned presentation correlation ID for a genuine, authenticated
|
|
// server cast event. Turtle supplies no Cast GUID; this is never a Turtle wire
|
|
// identity or evidence that a spell executed. Allocate a unique nonzero counter
|
|
// in the owning session and preserve the same ID for its correlated lifecycle.
|
|
//
|
|
// Pinned Forever reference: Spell.cpp::Spell uses HighGuid::Cast (47) and
|
|
// SPELL_CAST_SOURCE_NORMAL (3), including triggered/equip spells. The factory
|
|
// ObjectGuid.cpp::CreateWorldObject packs realm13/map13/spell23/subtype6 in
|
|
// the high word, and serverId24/counter40 in the low word. The native constructor
|
|
// uses serverId0. Reject out-of-range inputs rather than silently masking them.
|
|
inline Guid128 forever_server_cast_guid(uint32_t realm, uint32_t map,
|
|
uint32_t spell, uint64_t counter) {
|
|
if (!realm || realm > 0x1fff || map > 0x1fff ||
|
|
!spell || spell > 0x7fffff || !counter || counter > 0xffffffffffULL)
|
|
throw Error("server cast presentation identity outside reviewed bounds");
|
|
|
|
const uint64_t high = (uint64_t(47) << 58) | (uint64_t(realm) << 42) |
|
|
(uint64_t(map) << 29) | (uint64_t(spell) << 6) | 3;
|
|
Guid128 result{};
|
|
for (unsigned byte = 0; byte < 8; ++byte) {
|
|
result[byte] = uint8_t(counter >> (byte * 8));
|
|
result[byte + 8] = uint8_t(high >> (byte * 8));
|
|
}
|
|
return result;
|
|
}
|
|
|
|
}
|