Files
praxisandClaude Fable 5.2 c2194c59d4 Protocol core: packet translation between source and native
127 files, from working commit b1a079a.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-19 01:32:47 +02:00

106 lines
3.0 KiB
C++

#pragma once
// Generated by ops/warrior_stance_profile.py. Source forms: SharedDefines.h
// Battle=17, Defensive=18, Berserker=19; source masks use 1 << (form-1).
// Component SHA256: 32644cdb94a8be64b3d81b39e94005140df1d1c03aeccd23388dd9a4d7236e6c
#include <array>
#include <cstdint>
#include <optional>
#include <set>
namespace gateway::warrior_stance {
struct Rule {uint32_t spell,mask;};
inline constexpr std::array<Rule,78> Rules={{
{72u,196608u},
{100u,65536u},
{355u,131072u},
{676u,131072u},
{694u,65536u},
{772u,196608u},
{871u,131072u},
{1671u,196608u},
{1672u,196608u},
{1680u,262144u},
{1715u,327680u},
{1719u,262144u},
{2565u,131072u},
{5308u,327680u},
{6178u,65536u},
{6343u,196608u},
{6546u,196608u},
{6547u,196608u},
{6548u,196608u},
{6552u,327680u},
{6554u,262144u},
{6555u,65536u},
{6572u,131072u},
{6574u,131072u},
{7372u,327680u},
{7373u,327680u},
{7379u,131072u},
{7384u,65536u},
{7390u,131072u},
{7391u,131072u},
{7400u,65536u},
{7402u,65536u},
{7887u,65536u},
{7922u,65536u},
{8198u,196608u},
{8204u,196608u},
{8205u,196608u},
{11572u,196608u},
{11573u,196608u},
{11574u,196608u},
{11578u,65536u},
{11580u,196608u},
{11581u,196608u},
{11584u,65536u},
{11585u,65536u},
{11588u,131072u},
{11589u,131072u},
{11590u,131072u},
{11600u,131072u},
{11601u,131072u},
{12292u,65536u},
{13491u,65536u},
{13532u,65536u},
{18499u,262144u},
{20230u,65536u},
{20252u,262144u},
{20559u,65536u},
{20560u,65536u},
{20616u,262144u},
{20617u,262144u},
{20658u,327680u},
{20660u,327680u},
{20661u,327680u},
{20662u,327680u},
{25288u,131072u},
{30012u,65536u},
{45579u,196608u},
{45582u,131072u},
{45587u,262144u},
{45588u,262144u},
{45594u,65536u},
{45595u,131072u},
{45806u,131072u},
{46316u,262144u},
{51606u,327680u},
{51607u,327680u},
{51608u,327680u},
{52401u,262144u},
}};
struct Choice {uint32_t spell=0;uint8_t form=0;};
// No optimistic form, learned-spell, cooldown or resource state. The existing
// genuine server cast path owns GCD/rage checks and stance-switch rage clamping.
inline std::optional<Choice> choose(uint32_t ability,uint8_t player_class,
std::optional<uint8_t> form,const std::set<uint32_t>&learned){
if(player_class!=1||!form||!learned.contains(ability))return std::nullopt;
if(*form!=0&&*form!=17&&*form!=18&&*form!=19)return std::nullopt;
uint32_t mask=0;for(const auto&rule:Rules)if(rule.spell==ability){mask=rule.mask;break;}
if(!mask||(*form&&mask&(uint32_t(1)<<(*form-1))))return std::nullopt;
// Owner-approved priority: Battle, Berserker, Defensive, among learned forms.
for(const auto choice:std::array<Choice,3>{{{2457,17},{2458,19},{71,18}}})
if((mask&(uint32_t(1)<<(choice.form-1)))&&learned.contains(choice.spell))return choice;
return std::nullopt;
}
}