mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-05-03 08:03:50 +00:00
Add Tier 4 commands: AFK/DND status and whisper reply
- AFK commands: /afk, /away to toggle AFK status with optional message - DND commands: /dnd, /busy to toggle DND (Do Not Disturb) with optional message - Reply command: /r, /reply to respond to the last received whisper - Track last whisper sender automatically when receiving whispers - AFK and DND are mutually exclusive (activating one clears the other)
This commit is contained in:
parent
28f14d9390
commit
ec2231dfca
3 changed files with 110 additions and 0 deletions
|
|
@ -254,6 +254,13 @@ public:
|
||||||
// Duel
|
// Duel
|
||||||
void forfeitDuel();
|
void forfeitDuel();
|
||||||
|
|
||||||
|
// AFK/DND status
|
||||||
|
void toggleAfk(const std::string& message = "");
|
||||||
|
void toggleDnd(const std::string& message = "");
|
||||||
|
void replyToLastWhisper(const std::string& message);
|
||||||
|
std::string getLastWhisperSender() const { return lastWhisperSender_; }
|
||||||
|
void setLastWhisperSender(const std::string& name) { lastWhisperSender_ = name; }
|
||||||
|
|
||||||
// ---- Phase 1: Name queries ----
|
// ---- Phase 1: Name queries ----
|
||||||
void queryPlayerName(uint64_t guid);
|
void queryPlayerName(uint64_t guid);
|
||||||
void queryCreatureInfo(uint32_t entry, uint64_t guid);
|
void queryCreatureInfo(uint32_t entry, uint64_t guid);
|
||||||
|
|
@ -660,6 +667,13 @@ private:
|
||||||
// ---- Follow state ----
|
// ---- Follow state ----
|
||||||
uint64_t followTargetGuid_ = 0;
|
uint64_t followTargetGuid_ = 0;
|
||||||
|
|
||||||
|
// ---- AFK/DND status ----
|
||||||
|
bool afkStatus_ = false;
|
||||||
|
bool dndStatus_ = false;
|
||||||
|
std::string afkMessage_;
|
||||||
|
std::string dndMessage_;
|
||||||
|
std::string lastWhisperSender_;
|
||||||
|
|
||||||
// ---- Online item tracking ----
|
// ---- Online item tracking ----
|
||||||
struct OnlineItemInfo {
|
struct OnlineItemInfo {
|
||||||
uint32_t entry = 0;
|
uint32_t entry = 0;
|
||||||
|
|
|
||||||
|
|
@ -1481,6 +1481,11 @@ void GameHandler::handleMessageChat(network::Packet& packet) {
|
||||||
chatHistory.erase(chatHistory.begin());
|
chatHistory.erase(chatHistory.begin());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Track whisper sender for /r command
|
||||||
|
if (data.type == ChatType::WHISPER && !data.senderName.empty()) {
|
||||||
|
lastWhisperSender_ = data.senderName;
|
||||||
|
}
|
||||||
|
|
||||||
// Log the message
|
// Log the message
|
||||||
std::string senderInfo;
|
std::string senderInfo;
|
||||||
if (!data.senderName.empty()) {
|
if (!data.senderName.empty()) {
|
||||||
|
|
@ -2044,6 +2049,73 @@ void GameHandler::forfeitDuel() {
|
||||||
LOG_INFO("Forfeited duel");
|
LOG_INFO("Forfeited duel");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GameHandler::toggleAfk(const std::string& message) {
|
||||||
|
afkStatus_ = !afkStatus_;
|
||||||
|
afkMessage_ = message;
|
||||||
|
|
||||||
|
if (afkStatus_) {
|
||||||
|
if (message.empty()) {
|
||||||
|
addSystemChatMessage("You are now AFK.");
|
||||||
|
} else {
|
||||||
|
addSystemChatMessage("You are now AFK: " + message);
|
||||||
|
}
|
||||||
|
// If DND was active, turn it off
|
||||||
|
if (dndStatus_) {
|
||||||
|
dndStatus_ = false;
|
||||||
|
dndMessage_.clear();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
addSystemChatMessage("You are no longer AFK.");
|
||||||
|
afkMessage_.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
LOG_INFO("AFK status: ", afkStatus_, ", message: ", message);
|
||||||
|
}
|
||||||
|
|
||||||
|
void GameHandler::toggleDnd(const std::string& message) {
|
||||||
|
dndStatus_ = !dndStatus_;
|
||||||
|
dndMessage_ = message;
|
||||||
|
|
||||||
|
if (dndStatus_) {
|
||||||
|
if (message.empty()) {
|
||||||
|
addSystemChatMessage("You are now DND (Do Not Disturb).");
|
||||||
|
} else {
|
||||||
|
addSystemChatMessage("You are now DND: " + message);
|
||||||
|
}
|
||||||
|
// If AFK was active, turn it off
|
||||||
|
if (afkStatus_) {
|
||||||
|
afkStatus_ = false;
|
||||||
|
afkMessage_.clear();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
addSystemChatMessage("You are no longer DND.");
|
||||||
|
dndMessage_.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
LOG_INFO("DND status: ", dndStatus_, ", message: ", message);
|
||||||
|
}
|
||||||
|
|
||||||
|
void GameHandler::replyToLastWhisper(const std::string& message) {
|
||||||
|
if (state != WorldState::IN_WORLD || !socket) {
|
||||||
|
LOG_WARNING("Cannot send whisper: not in world or not connected");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (lastWhisperSender_.empty()) {
|
||||||
|
addSystemChatMessage("No one has whispered you yet.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (message.empty()) {
|
||||||
|
addSystemChatMessage("You must specify a message to send.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Send whisper using the standard message chat function
|
||||||
|
sendChatMessage(ChatType::WHISPER, message, lastWhisperSender_);
|
||||||
|
LOG_INFO("Replied to ", lastWhisperSender_, ": ", message);
|
||||||
|
}
|
||||||
|
|
||||||
void GameHandler::releaseSpirit() {
|
void GameHandler::releaseSpirit() {
|
||||||
if (!playerDead_) return;
|
if (!playerDead_) return;
|
||||||
if (socket && state == WorldState::IN_WORLD) {
|
if (socket && state == WorldState::IN_WORLD) {
|
||||||
|
|
|
||||||
|
|
@ -1306,6 +1306,30 @@ void GameScreen::sendChatMessage(game::GameHandler& gameHandler) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// AFK command
|
||||||
|
if (cmdLower == "afk" || cmdLower == "away") {
|
||||||
|
std::string afkMsg = (spacePos != std::string::npos) ? command.substr(spacePos + 1) : "";
|
||||||
|
gameHandler.toggleAfk(afkMsg);
|
||||||
|
chatInputBuffer[0] = '\0';
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// DND command
|
||||||
|
if (cmdLower == "dnd" || cmdLower == "busy") {
|
||||||
|
std::string dndMsg = (spacePos != std::string::npos) ? command.substr(spacePos + 1) : "";
|
||||||
|
gameHandler.toggleDnd(dndMsg);
|
||||||
|
chatInputBuffer[0] = '\0';
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Reply command
|
||||||
|
if (cmdLower == "r" || cmdLower == "reply") {
|
||||||
|
std::string replyMsg = (spacePos != std::string::npos) ? command.substr(spacePos + 1) : "";
|
||||||
|
gameHandler.replyToLastWhisper(replyMsg);
|
||||||
|
chatInputBuffer[0] = '\0';
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Chat channel slash commands
|
// Chat channel slash commands
|
||||||
bool isChannelCommand = false;
|
bool isChannelCommand = false;
|
||||||
if (cmdLower == "s" || cmdLower == "say") {
|
if (cmdLower == "s" || cmdLower == "say") {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue