Files
WoW-Hybrid-gateway/tests/pvp_presentation_test.cpp

30 lines
1.7 KiB
C++

#include "gateway/unit_presentation.hpp"
#include <cassert>
#include <iostream>
int main() {
// Actual70334 GetPVPDesired tests0x200 at17C8017. These are Source
// acknowledgment states, not optimistic local responses to UI dispatch.
constexpr uint32_t desired=0x200, timer=0x40000;
assert((gateway::forever_player_flags(0)&desired)==0);
assert((gateway::forever_player_flags(desired)&desired)!=0);
assert((gateway::forever_player_flags(timer)&desired)==0);
assert((gateway::forever_player_flags(timer)&timer)!=0);
assert(gateway::forever_player_flags(desired|timer)==(desired|timer));
// Preserve every prior independent mapping; do not accidentally expose
// FFA, hide-item flags, or Source-only capability bits through PlayerFlags.
for(unsigned bit=0;bit<32;++bit) {
const uint32_t value=uint32_t(1)<<bit;
if(value!=desired)
assert(gateway::forever_player_flags(value)==(value&0x0006313f));
}
// #67: Turtle drunk value (PLAYER_BYTES_3 bits 1..15) -> native Inebriation with matching state bands
// (tipsy >0, drunk >=12800 -> >=50, smashed >=23000 -> >=90); gender bit 0 and PvP rank byte 3 ignored.
using gateway::forever_inebriation;
assert(forever_inebriation(0)==0 && forever_inebriation(1)==0 && forever_inebriation(0x0E000001)==0);
assert(forever_inebriation(2)>=1 && forever_inebriation(12798)==49);
assert(forever_inebriation(12800)==50 && forever_inebriation(22998)==89);
assert(forever_inebriation(23000)==90 && forever_inebriation(0xFFFF)<=100 && forever_inebriation(0xFFFE)>=99);
assert(forever_inebriation(0x05005000|1)==forever_inebriation(0x5000));
std::cout << "PASS native desired0x200, authoritative disable timer, unchanged independent flag mappings\n";
}