mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-23 07:40:14 +00:00
Add Tier 7 commands: combat and trade
Combat Commands: - /duel - Challenge target to a duel (CMSG_DUEL_PROPOSED 0x166) - /trade - Open trade window with target (CMSG_INITIATE_TRADE 0x116) - /startattack - Begin auto-attacking target - /stopattack - Stop auto-attacking - /stopcasting - Cancel current spell cast New opcodes: - CMSG_DUEL_PROPOSED (0x166) for initiating duels - CMSG_INITIATE_TRADE (0x116) for starting trades Packet builders: - DuelProposedPacket - sends duel challenge to target GUID - InitiateTradePacket - sends trade request to target GUID - AttackSwingPacket, AttackStopPacket, CancelCastPacket reused from existing Game handler methods: - proposeDuel(targetGuid) - challenge target to duel - initiateTrade(targetGuid) - open trade with target - stopCasting() - cancel current spell cast (uses existing casting state) All commands include validation for target selection and world state. Removed duplicate packet class definitions from previous phases.
This commit is contained in:
parent
d5b734a591
commit
bca3f64af6
6 changed files with 201 additions and 38 deletions
|
|
@ -2219,6 +2219,63 @@ void GameHandler::requestRaidInfo() {
|
|||
LOG_INFO("Requested raid info");
|
||||
}
|
||||
|
||||
void GameHandler::proposeDuel(uint64_t targetGuid) {
|
||||
if (state != WorldState::IN_WORLD || !socket) {
|
||||
LOG_WARNING("Cannot propose duel: not in world or not connected");
|
||||
return;
|
||||
}
|
||||
|
||||
if (targetGuid == 0) {
|
||||
addSystemChatMessage("You must target a player to challenge to a duel.");
|
||||
return;
|
||||
}
|
||||
|
||||
auto packet = DuelProposedPacket::build(targetGuid);
|
||||
socket->send(packet);
|
||||
addSystemChatMessage("You have challenged your target to a duel.");
|
||||
LOG_INFO("Proposed duel to target: 0x", std::hex, targetGuid, std::dec);
|
||||
}
|
||||
|
||||
void GameHandler::initiateTrade(uint64_t targetGuid) {
|
||||
if (state != WorldState::IN_WORLD || !socket) {
|
||||
LOG_WARNING("Cannot initiate trade: not in world or not connected");
|
||||
return;
|
||||
}
|
||||
|
||||
if (targetGuid == 0) {
|
||||
addSystemChatMessage("You must target a player to trade with.");
|
||||
return;
|
||||
}
|
||||
|
||||
auto packet = InitiateTradePacket::build(targetGuid);
|
||||
socket->send(packet);
|
||||
addSystemChatMessage("Requesting trade with target.");
|
||||
LOG_INFO("Initiated trade with target: 0x", std::hex, targetGuid, std::dec);
|
||||
}
|
||||
|
||||
void GameHandler::stopCasting() {
|
||||
if (state != WorldState::IN_WORLD || !socket) {
|
||||
LOG_WARNING("Cannot stop casting: not in world or not connected");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!casting) {
|
||||
return; // Not casting anything
|
||||
}
|
||||
|
||||
// Send cancel cast packet with current spell ID
|
||||
auto packet = CancelCastPacket::build(currentCastSpellId);
|
||||
socket->send(packet);
|
||||
|
||||
// Reset casting state
|
||||
casting = false;
|
||||
currentCastSpellId = 0;
|
||||
castTimeRemaining = 0.0f;
|
||||
castTimeTotal = 0.0f;
|
||||
|
||||
LOG_INFO("Cancelled spell cast");
|
||||
}
|
||||
|
||||
void GameHandler::releaseSpirit() {
|
||||
if (!playerDead_) return;
|
||||
if (socket && state == WorldState::IN_WORLD) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue