diff --git a/src/game/GossipDef.cpp b/src/game/GossipDef.cpp index 3093651de..9e0ce99df 100644 --- a/src/game/GossipDef.cpp +++ b/src/game/GossipDef.cpp @@ -419,8 +419,6 @@ void PlayerMenu::SendQuestGiverStatus( uint8 questStatus, uint64 npcGUID ) void PlayerMenu::SendQuestGiverQuestDetails( Quest const *pQuest, uint64 npcGUID, bool ActivateAccept ) { - WorldPacket data(SMSG_QUESTGIVER_QUEST_DETAILS, 100); // guess size - std::string Title = pQuest->GetTitle(); std::string Details = pQuest->GetDetails(); std::string Objectives = pQuest->GetObjectives(); @@ -443,16 +441,18 @@ void PlayerMenu::SendQuestGiverQuestDetails( Quest const *pQuest, uint64 npcGUID } } + WorldPacket data(SMSG_QUESTGIVER_QUEST_DETAILS, 100); // guess size data << uint64(npcGUID); data << uint64(0); // wotlk, something todo with quest sharing? data << uint32(pQuest->GetQuestId()); data << Title; data << Details; data << Objectives; - data << uint32(ActivateAccept); + data << uint8(ActivateAccept ? 1 : 0); data << uint32(pQuest->GetSuggestedPlayers()); data << uint8(0); // new wotlk data << uint8(0); // new 3.1 + data << uint8(0); // new 3.3.0 if (pQuest->HasFlag(QUEST_FLAGS_HIDDEN_REWARDS)) { @@ -493,12 +493,25 @@ void PlayerMenu::SendQuestGiverQuestDetails( Quest const *pQuest, uint64 npcGUID data << uint32(pQuest->GetRewOrReqMoney()); } + data << uint32(0); // rewarded honor points. Multiply with 10 to satisfy client data << uint32(10*MaNGOS::Honor::hk_honor_at_level(pSession->GetPlayer()->getLevel(), pQuest->GetRewHonorableKills())); + data << float(0); // new 3.3.0 data << uint32(pQuest->GetRewSpell()); // reward spell, this spell will display (icon) (casted if RewSpellCast==0) data << uint32(pQuest->GetRewSpellCast()); // casted spell data << uint32(pQuest->GetCharTitleId()); // CharTitleId, new 2.4.0, player gets this title (id from CharTitles) data << uint32(pQuest->GetBonusTalents()); // bonus talents + data << uint32(0); + data << uint32(0); + + for(int i = 0; i < QUEST_REPUTATIONS_COUNT; ++i) + data << uint32(0); + + for(int i = 0; i < QUEST_REPUTATIONS_COUNT; ++i) + data << uint32(0); + + for(int i = 0; i < QUEST_REPUTATIONS_COUNT; ++i) + data << uint32(0); data << uint32(QUEST_EMOTE_COUNT); for (uint32 i=0; i < QUEST_EMOTE_COUNT; ++i) @@ -679,12 +692,12 @@ void PlayerMenu::SendQuestGiverOfferReward( Quest const* pQuest, uint64 npcGUID, WorldPacket data( SMSG_QUESTGIVER_OFFER_REWARD, 50 ); // guess size - data << npcGUID; - data << pQuest->GetQuestId(); + data << uint64(npcGUID); + data << uint32(pQuest->GetQuestId()); data << Title; data << OfferRewardText; - data << uint32( EnableNext ); + data << uint8(EnableNext ? 1 : 0); data << uint32(0); // unk uint32 EmoteCount = 0; @@ -731,15 +744,29 @@ void PlayerMenu::SendQuestGiverOfferReward( Quest const* pQuest, uint64 npcGUID, data << uint32(0); } + data << uint32(0); data << uint32(pQuest->GetRewOrReqMoney()); // rewarded honor points. Multiply with 10 to satisfy client data << uint32(10*MaNGOS::Honor::hk_honor_at_level(pSession->GetPlayer()->getLevel(), pQuest->GetRewHonorableKills())); + data << float(0); data << uint32(0x08); // unused by client? data << uint32(pQuest->GetRewSpell()); // reward spell, this spell will display (icon) (casted if RewSpellCast==0) data << uint32(pQuest->GetRewSpellCast()); // casted spell data << uint32(0); // unknown data << uint32(pQuest->GetBonusTalents()); // bonus talents + data << uint32(0); + data << uint32(0); + + for(int i = 0; i < QUEST_REPUTATIONS_COUNT; ++i) // reward factions ids + data << uint32(0); + + for(int i = 0; i < QUEST_REPUTATIONS_COUNT; ++i) // columnid in QuestFactionReward.dbc (zero based)? + data << uint32(0); + + for(int i = 0; i < QUEST_REPUTATIONS_COUNT; ++i) // reward reputation override? + data << uint32(0); + pSession->SendPacket( &data ); sLog.outDebug( "WORLD: Sent SMSG_QUESTGIVER_OFFER_REWARD NPCGuid=%u, questid=%u", GUID_LOPART(npcGUID), pQuest->GetQuestId() ); } diff --git a/src/game/Opcodes.h b/src/game/Opcodes.h index 80b63331e..323d8b5ca 100644 --- a/src/game/Opcodes.h +++ b/src/game/Opcodes.h @@ -545,7 +545,7 @@ enum Opcodes SMSG_ENVIRONMENTALDAMAGELOG = 0x1FC, CMSG_PLAYER_DIFFICULTY_CHANGE = 0x1FD, SMSG_RWHOIS = 0x1FE, - MSG_LOOKING_FOR_GROUP = 0x1FF, + MSG_LOOKING_FOR_GROUP = 0x1FF, // uint32, uint8, uint32, uint32, uint32, uint32, uint32, uint8, for(uint8) {uint32,uint32,uint32} CMSG_SET_LOOKING_FOR_GROUP = 0x200, CMSG_UNLEARN_SPELL = 0x201, CMSG_UNLEARN_SKILL = 0x202, @@ -894,29 +894,29 @@ enum Opcodes MSG_MOVE_START_ASCEND = 0x359, MSG_MOVE_STOP_ASCEND = 0x35A, SMSG_ARENA_TEAM_STATS = 0x35B, - CMSG_LFG_SET_AUTOJOIN = 0x35C, - CMSG_LFG_CLEAR_AUTOJOIN = 0x35D, - CMSG_LFM_SET_AUTOFILL = 0x35E, - CMSG_LFM_CLEAR_AUTOFILL = 0x35F, - CMSG_ACCEPT_LFG_MATCH = 0x360, - CMSG_DECLINE_LFG_MATCH = 0x361, - CMSG_CANCEL_PENDING_LFG = 0x362, - CMSG_CLEAR_LOOKING_FOR_GROUP = 0x363, - CMSG_CLEAR_LOOKING_FOR_MORE = 0x364, - CMSG_SET_LOOKING_FOR_MORE = 0x365, - CMSG_SET_LFG_COMMENT = 0x366, - SMSG_LFG_TIMEDOUT = 0x367, - SMSG_LFG_OTHER_TIMEDOUT = 0x368, - SMSG_LFG_AUTOJOIN_FAILED = 0x369, - SMSG_LFG_AUTOJOIN_FAILED_NO_PLAYER = 0x36A, - SMSG_LFG_LEADER_IS_LFM = 0x36B, - SMSG_LFG_UPDATE = 0x36C, - SMSG_LFG_UPDATE_LFM = 0x36D, - SMSG_LFG_UPDATE_LFG = 0x36E, - SMSG_LFG_UPDATE_QUEUED = 0x36F, - SMSG_LFG_PENDING_INVITE = 0x370, - SMSG_LFG_PENDING_MATCH = 0x371, - SMSG_LFG_PENDING_MATCH_DONE = 0x372, + CMSG_LFG_SET_AUTOJOIN = 0x35C, // CMSG JoinLFG + CMSG_LFG_CLEAR_AUTOJOIN = 0x35D, // CMSG LeaveLFG + CMSG_LFM_SET_AUTOFILL = 0x35E, // CMSG SearchLFGJoin + CMSG_LFM_CLEAR_AUTOFILL = 0x35F, // CMSG SearchLFGLeave + CMSG_ACCEPT_LFG_MATCH = 0x360, // SMSG uint32, uint32, if(uint8) { uint32 count, for(count) { uint64} }, uint32 count2, uint32, for(count2) { uint64, uint32 flags, if(flags & 0x2) {string}, if(flags & 0x10) {for(3) uint8}, if(flags & 0x80) {uint64, uint32}}, uint32 count3, uint32, for(count3) {uint64, uint32 flags, if(flags & 0x1) {uint8, uint8, uint8, for(3) uint8, uint32, uint32, uint32, uint32, uint32, uint32, float, float, uint32, uint32, uint32, uint32, uint32, float, uint32, uint32, uint32, uint32, uint32, uint32}, if(flags&0x2) string, if(flags&0x4) uint8, if(flags&0x8) uint64, if(flags&0x10) uint8, if(flags&0x20) uint32, if(flags&0x40) uint8, if(flags& 0x80) {uint64, uint32}} + CMSG_DECLINE_LFG_MATCH = 0x361, // SMSG uint32, uint8, uint32, uint32, uint8, for(uint8) {uint32,uint8,uint8,uint8,uint8} + CMSG_CANCEL_PENDING_LFG = 0x362, // CMSG AcceptProposal, RejectProposal + CMSG_CLEAR_LOOKING_FOR_GROUP = 0x363, // SMSG uint32, uint8, for(uint8) uint32, uint8, for(uint8) { uint64, uint8, uint32, uint8, } + CMSG_CLEAR_LOOKING_FOR_MORE = 0x364, // SMSG uint32 unk, uint32, if(unk==6) { uint8 count, for(count) uint64 } + CMSG_SET_LOOKING_FOR_MORE = 0x365, // SMSG uint32, uint32, uint32, uint32, uint32, uint32, uint8, uint8, uint8, uint8 + CMSG_SET_LFG_COMMENT = 0x366, // CMSG SetLFGComment + SMSG_LFG_TIMEDOUT = 0x367, // SMSG uint8, if(uint8) { uint8, uint8, uint8, uint8, if(uint8) uint32, string} + SMSG_LFG_OTHER_TIMEDOUT = 0x368, // SMSG uint8, if(uint8) { uint8, uint8, uint8, for(3) uint8, uint8, if(uint8) for(uint8) uint32, string} + SMSG_LFG_AUTOJOIN_FAILED = 0x369, // SMSG uint8 + SMSG_LFG_AUTOJOIN_FAILED_NO_PLAYER = 0x36A, // CMSG SetLFGRoles + SMSG_LFG_LEADER_IS_LFM = 0x36B, // CMSG SetLFGNeeds + SMSG_LFG_UPDATE = 0x36C, // CMSG SetLFGBootVote + SMSG_LFG_UPDATE_LFM = 0x36D, // SMSG uint8, uint8, uint8, uint64, uint32, uint32, uint32, uint32 + SMSG_LFG_UPDATE_LFG = 0x36E, // CMSG RequestLFDPlayerLockInfo + SMSG_LFG_UPDATE_QUEUED = 0x36F, // SMSG uint8, for(uint8) { uint32, uint8, uint32, uint32, uint32, uint32, uint8, for(uint8) {uint32,uint32, uint32}}, uint32, for(uint32) {uint32,uint32} + SMSG_LFG_PENDING_INVITE = 0x370, // CMSG LFGTeleport + SMSG_LFG_PENDING_MATCH = 0x371, // CMSG RequestLFDPartyLockInfo + SMSG_LFG_PENDING_MATCH_DONE = 0x372, // SMSG uint8, for(uint8) uint64 SMSG_TITLE_EARNED = 0x373, CMSG_SET_TITLE = 0x374, CMSG_CANCEL_MOUNT_AURA = 0x375, diff --git a/src/game/Player.cpp b/src/game/Player.cpp index a7bbcc4a0..a91668bdd 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -3733,7 +3733,7 @@ void Player::InitVisibleBits() updateVisualBits.SetBit(PLAYER_GUILD_TIMESTAMP); // PLAYER_QUEST_LOG_x also visible bit on official (but only on party/raid)... - for(uint16 i = PLAYER_QUEST_LOG_1_1; i < PLAYER_QUEST_LOG_25_2; i += 4) + for(uint16 i = PLAYER_QUEST_LOG_1_1; i < PLAYER_QUEST_LOG_25_2; i += MAX_QUEST_OFFSET) updateVisualBits.SetBit(i); // Players visible items are not inventory stuff @@ -13864,6 +13864,7 @@ void Player::SendQuestReward( Quest const *pQuest, uint32 XP, Object * questGive data << uint32(10*MaNGOS::Honor::hk_honor_at_level(getLevel(), pQuest->GetRewHonorableKills())); data << uint32(pQuest->GetBonusTalents()); // bonus talents + data << uint32(0); GetSession()->SendPacket( &data ); if (pQuest->GetQuestCompleteScript() != 0) @@ -13951,7 +13952,7 @@ void Player::SendQuestUpdateAddItem( Quest const* pQuest, uint32 item_idx, uint3 void Player::SendQuestUpdateAddCreatureOrGo( Quest const* pQuest, uint64 guid, uint32 creatureOrGO_idx, uint32 old_count, uint32 add_count ) { - assert(old_count + add_count < 256 && "mob/GO count store in 8 bits 2^8 = 256 (0..256)"); + assert(old_count + add_count < 65536 && "mob/GO count store in 16 bits 2^16 = 65536 (0..65536)"); int32 entry = pQuest->ReqCreatureOrGOId[ creatureOrGO_idx ]; if (entry < 0) diff --git a/src/game/Player.h b/src/game/Player.h index 8cb49f033..ed4ee3b76 100644 --- a/src/game/Player.h +++ b/src/game/Player.h @@ -548,13 +548,13 @@ typedef std::map QuestStatusMap; enum QuestSlotOffsets { - QUEST_ID_OFFSET = 0, - QUEST_STATE_OFFSET = 1, - QUEST_COUNTS_OFFSET = 2, - QUEST_TIME_OFFSET = 3 + QUEST_ID_OFFSET = 0, + QUEST_STATE_OFFSET = 1, + QUEST_COUNTS_OFFSET = 2, // 2 and 3 + QUEST_TIME_OFFSET = 4 }; -#define MAX_QUEST_OFFSET 4 +#define MAX_QUEST_OFFSET 5 enum QuestSlotStateMask { @@ -1320,31 +1320,37 @@ class MANGOS_DLL_SPEC Player : public Unit void ResetDailyQuestStatus(); uint16 FindQuestSlot( uint32 quest_id ) const; - uint32 GetQuestSlotQuestId(uint16 slot) const { return GetUInt32Value(PLAYER_QUEST_LOG_1_1 + slot*MAX_QUEST_OFFSET + QUEST_ID_OFFSET); } - uint32 GetQuestSlotState(uint16 slot) const { return GetUInt32Value(PLAYER_QUEST_LOG_1_1 + slot*MAX_QUEST_OFFSET + QUEST_STATE_OFFSET); } - uint32 GetQuestSlotCounters(uint16 slot)const { return GetUInt32Value(PLAYER_QUEST_LOG_1_1 + slot*MAX_QUEST_OFFSET + QUEST_COUNTS_OFFSET); } - uint8 GetQuestSlotCounter(uint16 slot,uint8 counter) const { return GetByteValue(PLAYER_QUEST_LOG_1_1 + slot*MAX_QUEST_OFFSET + QUEST_COUNTS_OFFSET,counter); } - uint32 GetQuestSlotTime(uint16 slot) const { return GetUInt32Value(PLAYER_QUEST_LOG_1_1 + slot*MAX_QUEST_OFFSET + QUEST_TIME_OFFSET); } - void SetQuestSlot(uint16 slot,uint32 quest_id, uint32 timer = 0) + uint32 GetQuestSlotQuestId(uint16 slot) const { return GetUInt32Value(PLAYER_QUEST_LOG_1_1 + slot * MAX_QUEST_OFFSET + QUEST_ID_OFFSET); } + uint32 GetQuestSlotState(uint16 slot) const { return GetUInt32Value(PLAYER_QUEST_LOG_1_1 + slot * MAX_QUEST_OFFSET + QUEST_STATE_OFFSET); } + uint16 GetQuestSlotCounter(uint16 slot, uint8 counter) const { return (uint16)(GetUInt64Value(PLAYER_QUEST_LOG_1_1 + slot * MAX_QUEST_OFFSET + QUEST_COUNTS_OFFSET) >> (counter * 16)); } + uint32 GetQuestSlotTime(uint16 slot) const { return GetUInt32Value(PLAYER_QUEST_LOG_1_1 + slot * MAX_QUEST_OFFSET + QUEST_TIME_OFFSET); } + void SetQuestSlot(uint16 slot, uint32 quest_id, uint32 timer = 0) { - SetUInt32Value(PLAYER_QUEST_LOG_1_1 + slot*MAX_QUEST_OFFSET + QUEST_ID_OFFSET,quest_id); - SetUInt32Value(PLAYER_QUEST_LOG_1_1 + slot*MAX_QUEST_OFFSET + QUEST_STATE_OFFSET,0); - SetUInt32Value(PLAYER_QUEST_LOG_1_1 + slot*MAX_QUEST_OFFSET + QUEST_COUNTS_OFFSET,0); - SetUInt32Value(PLAYER_QUEST_LOG_1_1 + slot*MAX_QUEST_OFFSET + QUEST_TIME_OFFSET,timer); + SetUInt32Value(PLAYER_QUEST_LOG_1_1 + slot * MAX_QUEST_OFFSET + QUEST_ID_OFFSET, quest_id); + SetUInt32Value(PLAYER_QUEST_LOG_1_1 + slot * MAX_QUEST_OFFSET + QUEST_STATE_OFFSET, 0); + SetUInt32Value(PLAYER_QUEST_LOG_1_1 + slot * MAX_QUEST_OFFSET + QUEST_COUNTS_OFFSET, 0); + SetUInt32Value(PLAYER_QUEST_LOG_1_1 + slot * MAX_QUEST_OFFSET + QUEST_COUNTS_OFFSET + 1, 0); + SetUInt32Value(PLAYER_QUEST_LOG_1_1 + slot * MAX_QUEST_OFFSET + QUEST_TIME_OFFSET, timer); } - void SetQuestSlotCounter(uint16 slot,uint8 counter,uint8 count) { SetByteValue(PLAYER_QUEST_LOG_1_1 + slot*MAX_QUEST_OFFSET + QUEST_COUNTS_OFFSET,counter,count); } - void SetQuestSlotState(uint16 slot,uint32 state) { SetFlag(PLAYER_QUEST_LOG_1_1 + slot*MAX_QUEST_OFFSET + QUEST_STATE_OFFSET,state); } - void RemoveQuestSlotState(uint16 slot,uint32 state) { RemoveFlag(PLAYER_QUEST_LOG_1_1 + slot*MAX_QUEST_OFFSET + QUEST_STATE_OFFSET,state); } - void SetQuestSlotTimer(uint16 slot,uint32 timer) { SetUInt32Value(PLAYER_QUEST_LOG_1_1 + slot*MAX_QUEST_OFFSET + QUEST_TIME_OFFSET,timer); } - void SwapQuestSlot(uint16 slot1,uint16 slot2) + void SetQuestSlotCounter(uint16 slot, uint8 counter, uint16 count) { - for (int i = 0; i < MAX_QUEST_OFFSET ; ++i ) + uint64 val = GetUInt64Value(PLAYER_QUEST_LOG_1_1 + slot * MAX_QUEST_OFFSET + QUEST_COUNTS_OFFSET); + val &= ~((uint64)0xFFFF << (counter * 16)); + val |= ((uint64)count << (counter * 16)); + SetUInt64Value(PLAYER_QUEST_LOG_1_1 + slot * MAX_QUEST_OFFSET + QUEST_COUNTS_OFFSET, val); + } + void SetQuestSlotState(uint16 slot, uint32 state) { SetFlag(PLAYER_QUEST_LOG_1_1 + slot * MAX_QUEST_OFFSET + QUEST_STATE_OFFSET, state); } + void RemoveQuestSlotState(uint16 slot, uint32 state) { RemoveFlag(PLAYER_QUEST_LOG_1_1 + slot * MAX_QUEST_OFFSET + QUEST_STATE_OFFSET, state); } + void SetQuestSlotTimer(uint16 slot, uint32 timer) { SetUInt32Value(PLAYER_QUEST_LOG_1_1 + slot * MAX_QUEST_OFFSET + QUEST_TIME_OFFSET, timer); } + void SwapQuestSlot(uint16 slot1, uint16 slot2) + { + for (int i = 0; i < MAX_QUEST_OFFSET; ++i) { - uint32 temp1 = GetUInt32Value(PLAYER_QUEST_LOG_1_1 + MAX_QUEST_OFFSET *slot1 + i); - uint32 temp2 = GetUInt32Value(PLAYER_QUEST_LOG_1_1 + MAX_QUEST_OFFSET *slot2 + i); + uint32 temp1 = GetUInt32Value(PLAYER_QUEST_LOG_1_1 + MAX_QUEST_OFFSET * slot1 + i); + uint32 temp2 = GetUInt32Value(PLAYER_QUEST_LOG_1_1 + MAX_QUEST_OFFSET * slot2 + i); - SetUInt32Value(PLAYER_QUEST_LOG_1_1 + MAX_QUEST_OFFSET *slot1 + i, temp2); - SetUInt32Value(PLAYER_QUEST_LOG_1_1 + MAX_QUEST_OFFSET *slot2 + i, temp1); + SetUInt32Value(PLAYER_QUEST_LOG_1_1 + MAX_QUEST_OFFSET * slot1 + i, temp2); + SetUInt32Value(PLAYER_QUEST_LOG_1_1 + MAX_QUEST_OFFSET * slot2 + i, temp1); } } uint32 GetReqKillOrCastCurrentCount(uint32 quest_id, int32 entry); diff --git a/src/game/UpdateFields.h b/src/game/UpdateFields.h index 9e30fbf2c..526913c41 100644 --- a/src/game/UpdateFields.h +++ b/src/game/UpdateFields.h @@ -187,7 +187,7 @@ enum EUnitFields PLAYER_QUEST_LOG_1_1 = UNIT_END + 0x000A, // Size: 1, Type: INT, Flags: PARTY_MEMBER PLAYER_QUEST_LOG_1_2 = UNIT_END + 0x000B, // Size: 1, Type: INT, Flags: PRIVATE PLAYER_QUEST_LOG_1_3 = UNIT_END + 0x000C, // Size: 2, Type: TWO_SHORT, Flags: PRIVATE - PLAYER_QUEST_LOG_1_4 = UNIT_END + 0x000E, // Size: 1, Type: INT, Flags: PRIVATE + PLAYER_QUEST_LOG_1_5 = UNIT_END + 0x000E, // Size: 1, Type: INT, Flags: PRIVATE PLAYER_QUEST_LOG_2_1 = UNIT_END + 0x000F, // Size: 1, Type: INT, Flags: PARTY_MEMBER PLAYER_QUEST_LOG_2_2 = UNIT_END + 0x0010, // Size: 1, Type: INT, Flags: PRIVATE PLAYER_QUEST_LOG_2_3 = UNIT_END + 0x0011, // Size: 2, Type: TWO_SHORT, Flags: PRIVATE