Core/Dungeon Finder: Modified LFGMgr to use DF quests to reward.

* In this way we will store the character's day progress in the db, preventing to lose the information because of a crash/restart/shutdown.

Patch by Gyullo and me, thanks to Spp & linencloth for help.

* The next commit will modify the current Quest System to support DF quests.

--HG--
branch : trunk
This commit is contained in:
_manuel_
2010-09-28 00:19:37 -03:00
parent 952d3cf10e
commit 6246d79b55
4 changed files with 36 additions and 51 deletions
@@ -194,7 +194,6 @@ void WorldSession::HandleLfgPlayerLockInfoRequestOpcode(WorldPacket &/*recv_data
sLog.outDebug("CMSG_LFD_PLAYER_LOCK_INFO_REQUEST [" UI64FMTD "]", GetPlayer()->GetGUID());
uint32 rsize = 0;
uint32 lsize = 0;
bool done;
LfgDungeonSet* randomlist = sLFGMgr.GetRandomDungeons(GetPlayer()->getLevel(), GetPlayer()->GetSession()->Expansion());
LfgLockStatusSet* lockSet = sLFGMgr.GetPlayerLockStatusDungeons(GetPlayer());
@@ -212,23 +211,34 @@ void WorldSession::HandleLfgPlayerLockInfoRequestOpcode(WorldPacket &/*recv_data
{
LfgReward const* reward = NULL;
Quest const* qRew = NULL;
uint8 done;
data << uint8(randomlist->size()); // Random Dungeon count
for (LfgDungeonSet::iterator it = randomlist->begin(); it != randomlist->end(); ++it)
{
done = GetPlayer()->isLfgDungeonDone(*it);
reward = sLFGMgr.GetRandomDungeonReward(*it, GetPlayer()->getLevel());
data << uint32(*it); // Entry
data << uint8(done);
reward = sLFGMgr.GetRandomDungeonReward(*it, GetPlayer()->getLevel());
qRew = NULL;
if (reward)
{
qRew = sObjectMgr.GetQuestTemplate(reward->reward[done].questId);
data << uint32(qRew ? qRew->GetRewOrReqMoney() : 0);
data << uint32(qRew ? qRew->XPValue(GetPlayer()) : 0);
qRew = sObjectMgr.GetQuestTemplate(reward->reward[0].questId);
if (qRew)
{
done = !GetPlayer()->CanRewardQuest(qRew,false);
if (done)
qRew = sObjectMgr.GetQuestTemplate(reward->reward[1].questId);
}
}
if (qRew)
{
data << uint8(done);
data << uint32(qRew->GetRewOrReqMoney());
data << uint32(qRew->XPValue(GetPlayer()));
data << uint32(reward->reward[done].variableMoney);
data << uint32(reward->reward[done].variableXP);
data << uint8(qRew ? qRew->GetRewItemsCount() : 0);
if (qRew && qRew->GetRewItemsCount())
data << uint8(qRew->GetRewItemsCount());
if (qRew->GetRewItemsCount())
{
ItemPrototype const* iProto = NULL;
for (uint8 i = 0; i < QUEST_REWARDS_COUNT; ++i)
@@ -246,6 +256,7 @@ void WorldSession::HandleLfgPlayerLockInfoRequestOpcode(WorldPacket &/*recv_data
}
else
{
data << uint8(0);
data << uint32(0);
data << uint32(0);
data << uint32(0);