fix: inspect (packed GUID), follow (client-side auto-walk); add loot/raid commands

Inspect: CMSG_INSPECT was writing full uint64 GUID instead of packed GUID.
Server silently rejected the malformed packet. Fixed both InspectPacket and
QueryInspectAchievementsPacket to use writePackedGuid().

Follow: was a no-op (only stored GUID). Added client-side auto-follow system:
camera controller walks toward followed entity, faces target, cancels on
WASD/mouse input, stops within 3 units, cancels at 40+ units distance.

Party commands:
- /lootmethod (ffa/roundrobin/master/group/nbg) sends CMSG_LOOT_METHOD
- /lootthreshold (0-5 or quality name) sets minimum loot quality
- /raidconvert converts party to raid (leader only)

Equipment diagnostic logging still active for debugging naked players.
This commit is contained in:
Kelsi 2026-03-27 17:54:56 -07:00
parent 16fc3ebfdf
commit b366773f29
8 changed files with 264 additions and 8 deletions

View file

@ -283,17 +283,56 @@ void CameraController::update(float deltaTime) {
autoRunning = !autoRunning;
}
tildeWasDown = tildeDown;
// Helper: cancel auto-follow and notify game handler
auto doCancelAutoFollow = [&]() {
if (autoFollowTarget_) {
autoFollowTarget_ = nullptr;
if (autoFollowCancelCallback_) autoFollowCancelCallback_();
}
};
if (keyW || keyS) {
autoRunning = false;
doCancelAutoFollow();
}
bool mouseAutorun = !uiWantsKeyboard && !sitting && leftMouseDown && rightMouseDown;
if (mouseAutorun) {
autoRunning = false;
doCancelAutoFollow();
}
// Auto-follow: face target and walk forward when within range
bool autoFollowWalk = false;
if (autoFollowTarget_ && followTarget && !movementRooted_) {
glm::vec3 myPos = *followTarget;
glm::vec3 tgtPos = *autoFollowTarget_;
float dx = tgtPos.x - myPos.x;
float dy = tgtPos.y - myPos.y;
float dist2D = std::sqrt(dx * dx + dy * dy);
if (dist2D > FOLLOW_MAX_DIST) {
doCancelAutoFollow();
} else if (dist2D > FOLLOW_STOP_DIST) {
// Face target (render-space yaw: atan2(-dx, -dy) -> degrees)
float targetYawRad = std::atan2(-dx, -dy);
float targetYawDeg = targetYawRad * 180.0f / 3.14159265f;
facingYaw = targetYawDeg;
yaw = targetYawDeg;
autoFollowWalk = true;
}
// else: within stop distance, stay put
// Cancel on strafe/turn keys
if (keyA || keyD || keyQ || keyE) {
doCancelAutoFollow();
autoFollowWalk = false;
}
}
// When the server has rooted the player, suppress all horizontal movement input.
const bool movBlocked = movementRooted_;
bool nowForward = !movBlocked && (keyW || mouseAutorun || autoRunning);
bool nowForward = !movBlocked && (keyW || mouseAutorun || autoRunning || autoFollowWalk);
bool nowBackward = !movBlocked && keyS;
bool nowStrafeLeft = false;
bool nowStrafeRight = false;