From 4f6006b9db8cbb7de6ce536d859ece17908b338e Mon Sep 17 00:00:00 2001 From: tomrus88 Date: Sat, 3 Apr 2010 17:49:12 +0400 Subject: [PATCH] Fixed few opcodes. --- src/game/ChatHandler.cpp | 22 ++++++++++++++- src/game/GroupHandler.cpp | 57 ++++++++++++++++++++++----------------- src/game/Opcodes.h | 2 +- src/game/Player.cpp | 10 +++---- src/game/WorldSession.h | 54 ++++++++++++++++++++++++++++--------- 5 files changed, 101 insertions(+), 44 deletions(-) diff --git a/src/game/ChatHandler.cpp b/src/game/ChatHandler.cpp index e6e71691c..ce8ace410 100644 --- a/src/game/ChatHandler.cpp +++ b/src/game/ChatHandler.cpp @@ -219,7 +219,7 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data ) uint32 sideb = player->GetTeam(); if( sidea != sideb ) { - SendPlayerNotFoundNotice(to); + SendWrongFactionNotice(); return; } } @@ -615,3 +615,23 @@ void WorldSession::SendPlayerNotFoundNotice(std::string name) data << name; SendPacket(&data); } + +void WorldSession::SendPlayerAmbiguousNotice(std::string name) +{ + WorldPacket data(SMSG_CHAT_PLAYER_AMBIGUOUS, name.size()+1); + data << name; + SendPacket(&data); +} + +void WorldSession::SendWrongFactionNotice() +{ + WorldPacket data(SMSG_CHAT_WRONG_FACTION, 0); + SendPacket(&data); +} + +void WorldSession::SendChatRestrictedNotice(ChatRestrictionType restriction) +{ + WorldPacket data(SMSG_CHAT_RESTRICTED, 1); + data << uint8(restriction); + SendPacket(&data); +} diff --git a/src/game/GroupHandler.cpp b/src/game/GroupHandler.cpp index 97d68c304..7338a223a 100644 --- a/src/game/GroupHandler.cpp +++ b/src/game/GroupHandler.cpp @@ -42,10 +42,11 @@ void WorldSession::SendPartyResult(PartyOperation operation, const std::string& member, PartyResult res) { - WorldPacket data(SMSG_PARTY_COMMAND_RESULT, (8+member.size()+1)); + WorldPacket data(SMSG_PARTY_COMMAND_RESULT, (4+member.size()+1+4+4)); data << uint32(operation); - data << member; + data << member; // max len 48 data << uint32(res); + data << uint32(0); // LFD cooldown related (used with ERR_PARTY_LFG_BOOT_COOLDOWN_S and ERR_PARTY_LFG_BOOT_NOT_ELIGIBLE_S) SendPacket( &data ); } @@ -54,14 +55,14 @@ void WorldSession::HandleGroupInviteOpcode( WorldPacket & recv_data ) { std::string membername; recv_data >> membername; - recv_data.read_skip(); // 0 for all known invite ways + recv_data.read_skip(); // roles mask? // attempt add selected player // cheating if(!normalizePlayerName(membername)) { - SendPartyResult(PARTY_OP_INVITE, membername, PARTY_RESULT_CANT_FIND_TARGET); + SendPartyResult(PARTY_OP_INVITE, membername, ERR_BAD_PLAYER_NAME_S); return; } @@ -70,25 +71,25 @@ void WorldSession::HandleGroupInviteOpcode( WorldPacket & recv_data ) // no player if(!player) { - SendPartyResult(PARTY_OP_INVITE, membername, PARTY_RESULT_CANT_FIND_TARGET); + SendPartyResult(PARTY_OP_INVITE, membername, ERR_BAD_PLAYER_NAME_S); return; } // can't group with if(!sWorld.getConfig(CONFIG_BOOL_ALLOW_TWO_SIDE_INTERACTION_GROUP) && GetPlayer()->GetTeam() != player->GetTeam()) { - SendPartyResult(PARTY_OP_INVITE, membername, PARTY_RESULT_TARGET_UNFRIENDLY); + SendPartyResult(PARTY_OP_INVITE, membername, ERR_PLAYER_WRONG_FACTION); return; } if(GetPlayer()->GetInstanceId() != 0 && player->GetInstanceId() != 0 && GetPlayer()->GetInstanceId() != player->GetInstanceId() && GetPlayer()->GetMapId() == player->GetMapId()) { - SendPartyResult(PARTY_OP_INVITE, membername, PARTY_RESULT_NOT_IN_YOUR_INSTANCE); + SendPartyResult(PARTY_OP_INVITE, membername, ERR_TARGET_NOT_IN_INSTANCE_S); return; } // just ignore us if(player->GetSocial()->HasIgnore(GetPlayer()->GetGUIDLow())) { - SendPartyResult(PARTY_OP_INVITE, membername, PARTY_RESULT_TARGET_IGNORE_YOU); + SendPartyResult(PARTY_OP_INVITE, membername, ERR_IGNORING_YOU_S); return; } @@ -102,7 +103,7 @@ void WorldSession::HandleGroupInviteOpcode( WorldPacket & recv_data ) // player already in another group or invited if( group2 || player->GetGroupInvite() ) { - SendPartyResult(PARTY_OP_INVITE, membername, PARTY_RESULT_ALREADY_IN_GROUP); + SendPartyResult(PARTY_OP_INVITE, membername, ERR_ALREADY_IN_GROUP_S); return; } @@ -111,13 +112,13 @@ void WorldSession::HandleGroupInviteOpcode( WorldPacket & recv_data ) // not have permissions for invite if(!group->IsLeader(GetPlayer()->GetGUID()) && !group->IsAssistant(GetPlayer()->GetGUID())) { - SendPartyResult(PARTY_OP_INVITE, "", PARTY_RESULT_YOU_NOT_LEADER); + SendPartyResult(PARTY_OP_INVITE, "", ERR_NOT_LEADER); return; } // not have place if(group->IsFull()) { - SendPartyResult(PARTY_OP_INVITE, "", PARTY_RESULT_PARTY_FULL); + SendPartyResult(PARTY_OP_INVITE, "", ERR_GROUP_FULL); return; } } @@ -151,19 +152,25 @@ void WorldSession::HandleGroupInviteOpcode( WorldPacket & recv_data ) // ok, we do it WorldPacket data(SMSG_GROUP_INVITE, 10); // guess size - data << uint8(1); // ok - data << GetPlayer()->GetName(); + data << uint8(1); // invited/already in group flag + data << GetPlayer()->GetName(); // max len 48 + data << uint32(0); // unk + data << uint8(0); // count + //for(int i = 0; i < count; ++i) + // data << uint32(0); + data << uint32(0); // unk player->GetSession()->SendPacket(&data); - SendPartyResult(PARTY_OP_INVITE, membername, PARTY_RESULT_OK); + SendPartyResult(PARTY_OP_INVITE, membername, ERR_PARTY_RESULT_OK); } void WorldSession::HandleGroupAcceptOpcode( WorldPacket & recv_data ) { - recv_data.read_skip(); // value received in WorldSession::HandleGroupInviteOpcode and also skipeed currently? + recv_data.read_skip(); // roles mask? Group *group = GetPlayer()->GetGroupInvite(); - if (!group) return; + if (!group) + return; if(group->GetLeaderGUID() == GetPlayer()->GetGUID()) { @@ -180,7 +187,7 @@ void WorldSession::HandleGroupAcceptOpcode( WorldPacket & recv_data ) // not have place if(group->IsFull()) { - SendPartyResult(PARTY_OP_INVITE, "", PARTY_RESULT_PARTY_FULL); + SendPartyResult(PARTY_OP_INVITE, "", ERR_GROUP_FULL); return; } @@ -227,7 +234,7 @@ void WorldSession::HandleGroupUninviteGuidOpcode(WorldPacket & recv_data) { uint64 guid; recv_data >> guid; - recv_data.read_skip(); + recv_data.read_skip(); // reason // can't uninvite yourself if(guid == GetPlayer()->GetGUID()) @@ -237,7 +244,7 @@ void WorldSession::HandleGroupUninviteGuidOpcode(WorldPacket & recv_data) } PartyResult res = GetPlayer()->CanUninviteFromGroup(); - if(res != PARTY_RESULT_OK) + if(res != ERR_PARTY_RESULT_OK) { SendPartyResult(PARTY_OP_LEAVE, "", res); return; @@ -259,7 +266,7 @@ void WorldSession::HandleGroupUninviteGuidOpcode(WorldPacket & recv_data) return; } - SendPartyResult(PARTY_OP_LEAVE, "", PARTY_RESULT_NOT_IN_YOUR_PARTY); + SendPartyResult(PARTY_OP_LEAVE, "", ERR_TARGET_NOT_IN_GROUP_S); } void WorldSession::HandleGroupUninviteOpcode(WorldPacket & recv_data) @@ -279,7 +286,7 @@ void WorldSession::HandleGroupUninviteOpcode(WorldPacket & recv_data) } PartyResult res = GetPlayer()->CanUninviteFromGroup(); - if(res != PARTY_RESULT_OK) + if(res != ERR_PARTY_RESULT_OK) { SendPartyResult(PARTY_OP_LEAVE, "", res); return; @@ -301,7 +308,7 @@ void WorldSession::HandleGroupUninviteOpcode(WorldPacket & recv_data) return; } - SendPartyResult(PARTY_OP_LEAVE, membername, PARTY_RESULT_NOT_IN_YOUR_PARTY); + SendPartyResult(PARTY_OP_LEAVE, membername, ERR_TARGET_NOT_IN_GROUP_S); } void WorldSession::HandleGroupSetLeaderOpcode( WorldPacket & recv_data ) @@ -331,7 +338,7 @@ void WorldSession::HandleGroupDisbandOpcode( WorldPacket & /*recv_data*/ ) if(_player->InBattleGround()) { - SendPartyResult(PARTY_OP_INVITE, "", PARTY_RESULT_INVITE_RESTRICTED); + SendPartyResult(PARTY_OP_INVITE, "", ERR_INVITE_RESTRICTED); return; } @@ -339,7 +346,7 @@ void WorldSession::HandleGroupDisbandOpcode( WorldPacket & /*recv_data*/ ) /********************/ // everything is fine, do it - SendPartyResult(PARTY_OP_LEAVE, GetPlayer()->GetName(), PARTY_RESULT_OK); + SendPartyResult(PARTY_OP_LEAVE, GetPlayer()->GetName(), ERR_PARTY_RESULT_OK); GetPlayer()->RemoveFromGroup(); } @@ -488,7 +495,7 @@ void WorldSession::HandleGroupRaidConvertOpcode( WorldPacket & /*recv_data*/ ) /********************/ // everything is fine, do it (is it 0 (PARTY_OP_INVITE) correct code) - SendPartyResult(PARTY_OP_INVITE, "", PARTY_RESULT_OK); + SendPartyResult(PARTY_OP_INVITE, "", ERR_PARTY_RESULT_OK); group->ConvertToRaid(); } diff --git a/src/game/Opcodes.h b/src/game/Opcodes.h index 6dc882262..6ab1eb322 100644 --- a/src/game/Opcodes.h +++ b/src/game/Opcodes.h @@ -1324,7 +1324,7 @@ enum Opcodes UMSG_UNKNOWN_1287 = 0x507, // not found CMSG_UNKNOWN_1288 = 0x508, // lua: SetAllowLowLevelRaid CMSG_UNKNOWN_1289 = 0x509, // lua: SetAllowLowLevelRaid - SMSG_UNKNOWN_1290 = 0x50A, // uint32 SpellEffectCameraShakes.dbc uint32, camera shake? + SMSG_CAMERA_SHAKE = 0x50A, // uint32 SpellEffectCameraShakes.dbc index, uint32 SMSG_UNKNOWN_1291 = 0x50B, // some item update packet? UMSG_UNKNOWN_1292 = 0x50C, // not found SMSG_UNKNOWN_1293 = 0x50D, // diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 2ac803ded..66f8aec00 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -12427,7 +12427,7 @@ void Player::SendNewItem(Item *item, uint32 count, bool received, bool created, data << uint64(GetGUID()); // player GUID data << uint32(received); // 0=looted, 1=from npc data << uint32(created); // 0=received, 1=created - data << uint32(1); // always 0x01 (probably meant to be count of listed items) + data << uint32(1); // IsShowChatMessage data << uint8(item->GetBagSlot()); // bagslot // item slot, but when added to stack: 0xFFFFFFFF data << uint32((item->GetCount() == count) ? item->GetSlot() : -1); @@ -20227,15 +20227,15 @@ PartyResult Player::CanUninviteFromGroup() const { const Group* grp = GetGroup(); if(!grp) - return PARTY_RESULT_YOU_NOT_IN_GROUP; + return ERR_NOT_IN_GROUP; if(!grp->IsLeader(GetGUID()) && !grp->IsAssistant(GetGUID())) - return PARTY_RESULT_YOU_NOT_LEADER; + return ERR_NOT_LEADER; if(InBattleGround()) - return PARTY_RESULT_INVITE_RESTRICTED; + return ERR_INVITE_RESTRICTED; - return PARTY_RESULT_OK; + return ERR_PARTY_RESULT_OK; } void Player::SetBattleGroundRaid(Group* group, int8 subgroup) diff --git a/src/game/WorldSession.h b/src/game/WorldSession.h index caa794a25..6bc037373 100644 --- a/src/game/WorldSession.h +++ b/src/game/WorldSession.h @@ -86,22 +86,49 @@ typedef std::list AddonsList; enum PartyOperation { PARTY_OP_INVITE = 0, - PARTY_OP_LEAVE = 2 + PARTY_OP_LEAVE = 2, + PARTY_OP_SWAP = 4 }; enum PartyResult { - PARTY_RESULT_OK = 0, - PARTY_RESULT_CANT_FIND_TARGET = 1, - PARTY_RESULT_NOT_IN_YOUR_PARTY = 2, - PARTY_RESULT_NOT_IN_YOUR_INSTANCE = 3, - PARTY_RESULT_PARTY_FULL = 4, - PARTY_RESULT_ALREADY_IN_GROUP = 5, - PARTY_RESULT_YOU_NOT_IN_GROUP = 6, - PARTY_RESULT_YOU_NOT_LEADER = 7, - PARTY_RESULT_TARGET_UNFRIENDLY = 8, - PARTY_RESULT_TARGET_IGNORE_YOU = 9, - PARTY_RESULT_INVITE_RESTRICTED = 13 + ERR_PARTY_RESULT_OK = 0, + ERR_BAD_PLAYER_NAME_S = 1, + ERR_TARGET_NOT_IN_GROUP_S = 2, + ERR_TARGET_NOT_IN_INSTANCE_S = 3, + ERR_GROUP_FULL = 4, + ERR_ALREADY_IN_GROUP_S = 5, + ERR_NOT_IN_GROUP = 6, + ERR_NOT_LEADER = 7, + ERR_PLAYER_WRONG_FACTION = 8, + ERR_IGNORING_YOU_S = 9, + ERR_LFG_PENDING = 12, + ERR_INVITE_RESTRICTED = 13, + ERR_GROUP_SWAP_FAILED = 14, // if (PartyOperation == PARTY_OP_SWAP) ERR_GROUP_SWAP_FAILED else ERR_INVITE_IN_COMBAT + ERR_INVITE_UNKNOWN_REALM = 15, + ERR_INVITE_NO_PARTY_SERVER = 16, + ERR_INVITE_PARTY_BUSY = 17, + ERR_PARTY_TARGET_AMBIGUOUS = 18, + ERR_PARTY_LFG_INVITE_RAID_LOCKED = 19, + ERR_PARTY_LFG_BOOT_LIMIT = 20, + ERR_PARTY_LFG_BOOT_COOLDOWN_S = 21, + ERR_PARTY_LFG_BOOT_IN_PROGRESS = 22, + ERR_PARTY_LFG_BOOT_TOO_FEW_PLAYERS = 23, + ERR_PARTY_LFG_BOOT_NOT_ELIGIBLE_S = 24, + ERR_RAID_DISALLOWED_BY_LEVEL = 25, + ERR_PARTY_LFG_BOOT_IN_COMBAT = 26, + ERR_VOTE_KICK_REASON_NEEDED = 27, + ERR_PARTY_LFG_BOOT_DUNGEON_COMPLETE = 28, + ERR_PARTY_LFG_BOOT_LOOT_ROLLS = 29, + ERR_PARTY_LFG_TELEPORT_IN_COMBAT = 30 +}; + +enum ChatRestrictionType +{ + ERR_CHAT_RESTRICTED = 0, + ERR_CHAT_THROTTLED = 1, + ERR_USER_SQUELCHED = 2, + ERR_YELL_RESTRICTED = 3 }; /// Player session in the World @@ -561,6 +588,9 @@ class MANGOS_DLL_SPEC WorldSession bool processChatmessageFurtherAfterSecurityChecks(std::string&, uint32); void SendPlayerNotFoundNotice(std::string name); + void SendPlayerAmbiguousNotice(std::string name); + void SendWrongFactionNotice(); + void SendChatRestrictedNotice(ChatRestrictionType restriction); void HandleMessagechatOpcode(WorldPacket& recvPacket); void HandleTextEmoteOpcode(WorldPacket& recvPacket); void HandleChatIgnoredOpcode(WorldPacket& recvPacket);