aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/server/game/Entities/Player/Player.cpp16
-rw-r--r--src/server/game/Entities/Player/Player.h3
2 files changed, 11 insertions, 8 deletions
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
index 4a5ebe3a8a5..19e68dd2e6c 100644
--- a/src/server/game/Entities/Player/Player.cpp
+++ b/src/server/game/Entities/Player/Player.cpp
@@ -15275,7 +15275,9 @@ uint32 Player::GetQuestSlotState(uint16 slot) const
uint16 Player::GetQuestSlotCounter(uint16 slot, uint8 counter) const
{
- return (uint16)(GetUInt64Value(PLAYER_QUEST_LOG + slot * MAX_QUEST_OFFSET + QUEST_COUNTS_OFFSET) >> (counter * 16));
+ if (counter < MAX_QUEST_COUNTS)
+ return GetUInt16Value(PLAYER_QUEST_LOG + slot * MAX_QUEST_OFFSET + QUEST_COUNTS_OFFSET + counter / 2, counter % 2);
+ return 0;
}
uint32 Player::GetQuestSlotTime(uint16 slot) const
@@ -15287,17 +15289,17 @@ void Player::SetQuestSlot(uint16 slot, uint32 quest_id, uint32 timer /*= 0*/)
{
SetUInt32Value(PLAYER_QUEST_LOG + slot * MAX_QUEST_OFFSET + QUEST_ID_OFFSET, quest_id);
SetUInt32Value(PLAYER_QUEST_LOG + slot * MAX_QUEST_OFFSET + QUEST_STATE_OFFSET, 0);
- SetUInt32Value(PLAYER_QUEST_LOG + slot * MAX_QUEST_OFFSET + QUEST_COUNTS_OFFSET, 0);
- SetUInt32Value(PLAYER_QUEST_LOG + slot * MAX_QUEST_OFFSET + QUEST_COUNTS_OFFSET + 1, 0);
+ for (uint32 i = 0; i < MAX_QUEST_COUNTS / 2; ++i)
+ SetUInt32Value(PLAYER_QUEST_LOG + slot * MAX_QUEST_OFFSET + QUEST_COUNTS_OFFSET + i, 0);
SetUInt32Value(PLAYER_QUEST_LOG + slot * MAX_QUEST_OFFSET + QUEST_TIME_OFFSET, timer);
}
void Player::SetQuestSlotCounter(uint16 slot, uint8 counter, uint16 count)
{
- uint64 val = GetUInt64Value(PLAYER_QUEST_LOG + slot * MAX_QUEST_OFFSET + QUEST_COUNTS_OFFSET);
- val &= ~((uint64)0xFFFF << (counter * 16));
- val |= ((uint64)count << (counter * 16));
- SetUInt64Value(PLAYER_QUEST_LOG + slot * MAX_QUEST_OFFSET + QUEST_COUNTS_OFFSET, val);
+ if (counter >= MAX_QUEST_COUNTS)
+ return;
+
+ SetUInt16Value(PLAYER_QUEST_LOG + slot * MAX_QUEST_OFFSET + QUEST_COUNTS_OFFSET + counter / 2, counter % 2, count);
}
void Player::SetQuestSlotState(uint16 slot, uint32 state)
diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h
index 1e9f949b721..9da5232ace7 100644
--- a/src/server/game/Entities/Player/Player.h
+++ b/src/server/game/Entities/Player/Player.h
@@ -686,9 +686,10 @@ enum QuestSlotOffsets
QUEST_ID_OFFSET = 0,
QUEST_STATE_OFFSET = 1,
QUEST_COUNTS_OFFSET = 2,
- QUEST_TIME_OFFSET = 4
+ QUEST_TIME_OFFSET = 14
};
+#define MAX_QUEST_COUNTS 24
#define MAX_QUEST_OFFSET 15
enum QuestSlotStateMask