mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-24 16:10:14 +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
85a7d66c4e
commit
41844ecc69
3 changed files with 110 additions and 0 deletions
|
|
@ -1481,6 +1481,11 @@ void GameHandler::handleMessageChat(network::Packet& packet) {
|
|||
chatHistory.erase(chatHistory.begin());
|
||||
}
|
||||
|
||||
// Track whisper sender for /r command
|
||||
if (data.type == ChatType::WHISPER && !data.senderName.empty()) {
|
||||
lastWhisperSender_ = data.senderName;
|
||||
}
|
||||
|
||||
// Log the message
|
||||
std::string senderInfo;
|
||||
if (!data.senderName.empty()) {
|
||||
|
|
@ -2044,6 +2049,73 @@ void GameHandler::forfeitDuel() {
|
|||
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() {
|
||||
if (!playerDead_) return;
|
||||
if (socket && state == WorldState::IN_WORLD) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue