Add Tier 8 commands: advanced targeting system

Targeting Commands:
- /cleartarget - Clear current target selection
- /targetenemy - Cycle to next hostile target (Tab equivalent)
- /targetfriend - Cycle to next friendly player
- /targetlasttarget, /targetlast - Switch to previous target
- /targetlastenemy - Cycle to previous hostile target
- /targetlastfriend - Cycle to previous friendly player
- /focus - Set current target as focus (client-side)
- /clearfocus - Clear focus target

Implementation:
- Added focusGuid and lastTargetGuid to GameHandler for client-side tracking
- setTarget() now automatically saves previous target to lastTargetGuid
- setFocus() and clearFocus() manage focus target with user feedback
- targetLastTarget() swaps current and previous targets
- targetEnemy() cycles through hostile entities (Units)
- targetFriend() cycles through friendly entities (Players)
- Both targetEnemy/targetFriend support reverse parameter for backwards cycling

Features:
- Focus targeting is client-side (no server opcode in 3.3.5a)
- Last target tracking happens automatically on every target change
- Enemy/friend cycling iterates through visible entities
- Provides user feedback when no targets available
- Tab-like cycling behavior with wraparound

All commands work entirely client-side for responsive targeting.
This commit is contained in:
kelsi davis 2026-02-07 13:44:36 -08:00
parent bca3f64af6
commit dfc4008ec7
3 changed files with 206 additions and 0 deletions

View file

@ -1460,6 +1460,63 @@ void GameScreen::sendChatMessage(game::GameHandler& gameHandler) {
return;
}
// Targeting commands
if (cmdLower == "cleartarget") {
gameHandler.clearTarget();
chatInputBuffer[0] = '\0';
return;
}
if (cmdLower == "targetenemy") {
gameHandler.targetEnemy(false);
chatInputBuffer[0] = '\0';
return;
}
if (cmdLower == "targetfriend") {
gameHandler.targetFriend(false);
chatInputBuffer[0] = '\0';
return;
}
if (cmdLower == "targetlasttarget" || cmdLower == "targetlast") {
gameHandler.targetLastTarget();
chatInputBuffer[0] = '\0';
return;
}
if (cmdLower == "targetlastenemy") {
gameHandler.targetEnemy(true); // Reverse direction
chatInputBuffer[0] = '\0';
return;
}
if (cmdLower == "targetlastfriend") {
gameHandler.targetFriend(true); // Reverse direction
chatInputBuffer[0] = '\0';
return;
}
if (cmdLower == "focus") {
if (gameHandler.hasTarget()) {
gameHandler.setFocus(gameHandler.getTargetGuid());
} else {
game::MessageChatData msg;
msg.type = game::ChatType::SYSTEM;
msg.language = game::ChatLanguage::UNIVERSAL;
msg.message = "You must target a unit to set as focus.";
gameHandler.addLocalChatMessage(msg);
}
chatInputBuffer[0] = '\0';
return;
}
if (cmdLower == "clearfocus") {
gameHandler.clearFocus();
chatInputBuffer[0] = '\0';
return;
}
// Chat channel slash commands
bool isChannelCommand = false;
if (cmdLower == "s" || cmdLower == "say") {