Codestyle: Renamed some variables to fit codestyle, corrected order in structure/class fields to match alignment (they use slightly less memory now)

Signed-off-by: Subv <[email protected]>
This commit is contained in:
Subv
2012-02-14 12:46:26 -05:00
parent f1182f0884
commit 8a72aede16
26 changed files with 967 additions and 966 deletions
+86 -86
View File
@@ -1570,7 +1570,7 @@ void Player::Update(uint32 p_time)
while (iter != m_timedquests.end())
{
QuestStatusData& q_status = m_QuestStatus[*iter];
if (q_status.m_timer <= p_time)
if (q_status.Timer <= p_time)
{
uint32 quest_id = *iter;
++iter; // current iter will be removed in FailQuest
@@ -1578,7 +1578,7 @@ void Player::Update(uint32 p_time)
}
else
{
q_status.m_timer -= p_time;
q_status.Timer -= p_time;
m_QuestStatusSave[*iter] = true;
++iter;
}
@@ -6955,38 +6955,38 @@ void Player::RewardReputation(Unit* pVictim, float rate)
float favored_rep_mult = 0;
if ((HasAura(32096) || HasAura(32098)) && (zone == 3483 || zone == 3562 || zone == 3836 || zone == 3713 || zone == 3714)) favored_rep_mult = 0.25; // Thrallmar's Favor and Honor Hold's Favor
else if (HasAura(30754) && (Rep->repfaction1 == 609 || Rep->repfaction2 == 609) && !ChampioningFaction) favored_rep_mult = 0.25; // Cenarion Favor
else if (HasAura(30754) && (Rep->RepFaction1 == 609 || Rep->RepFaction2 == 609) && !ChampioningFaction) favored_rep_mult = 0.25; // Cenarion Favor
if (favored_rep_mult > 0) favored_rep_mult *= 2; // Multiplied by 2 because the reputation is divided by 2 for some reason (See "donerep1 / 2" and "donerep2 / 2") -- if you know why this is done, please update/explain :)
// Favored reputation increase END
bool recruitAFriend = GetsRecruitAFriendBonus(false);
if (Rep->repfaction1 && (!Rep->team_dependent || team == ALLIANCE))
if (Rep->RepFaction1 && (!Rep->TeamDependent || team == ALLIANCE))
{
int32 donerep1 = CalculateReputationGain(pVictim->getLevel(), Rep->repvalue1, ChampioningFaction ? ChampioningFaction : Rep->repfaction1, false);
int32 donerep1 = CalculateReputationGain(pVictim->getLevel(), Rep->RepValue1, ChampioningFaction ? ChampioningFaction : Rep->RepFaction1, false);
donerep1 = int32(donerep1*(rate + favored_rep_mult));
if (recruitAFriend)
donerep1 = int32(donerep1 * (1 + sWorld->getRate(RATE_REPUTATION_RECRUIT_A_FRIEND_BONUS)));
FactionEntry const* factionEntry1 = sFactionStore.LookupEntry(ChampioningFaction ? ChampioningFaction : Rep->repfaction1);
FactionEntry const* factionEntry1 = sFactionStore.LookupEntry(ChampioningFaction ? ChampioningFaction : Rep->RepFaction1);
uint32 current_reputation_rank1 = GetReputationMgr().GetRank(factionEntry1);
if (factionEntry1 && current_reputation_rank1 <= Rep->reputation_max_cap1)
if (factionEntry1 && current_reputation_rank1 <= Rep->ReputationMaxCap1)
GetReputationMgr().ModifyReputation(factionEntry1, donerep1);
}
if (Rep->repfaction2 && (!Rep->team_dependent || team == HORDE))
if (Rep->RepFaction2 && (!Rep->TeamDependent || team == HORDE))
{
int32 donerep2 = CalculateReputationGain(pVictim->getLevel(), Rep->repvalue2, ChampioningFaction ? ChampioningFaction : Rep->repfaction2, false);
int32 donerep2 = CalculateReputationGain(pVictim->getLevel(), Rep->RepValue2, ChampioningFaction ? ChampioningFaction : Rep->RepFaction2, false);
donerep2 = int32(donerep2*(rate + favored_rep_mult));
if (recruitAFriend)
donerep2 = int32(donerep2 * (1 + sWorld->getRate(RATE_REPUTATION_RECRUIT_A_FRIEND_BONUS)));
FactionEntry const* factionEntry2 = sFactionStore.LookupEntry(ChampioningFaction ? ChampioningFaction : Rep->repfaction2);
FactionEntry const* factionEntry2 = sFactionStore.LookupEntry(ChampioningFaction ? ChampioningFaction : Rep->RepFaction2);
uint32 current_reputation_rank2 = GetReputationMgr().GetRank(factionEntry2);
if (factionEntry2 && current_reputation_rank2 <= Rep->reputation_max_cap2)
if (factionEntry2 && current_reputation_rank2 <= Rep->ReputationMaxCap2)
GetReputationMgr().ModifyReputation(factionEntry2, donerep2);
}
}
@@ -14678,13 +14678,13 @@ bool Player::CanCompleteQuest(uint32 quest_id)
QuestStatusData &q_status = itr->second;
if (q_status.m_status == QUEST_STATUS_INCOMPLETE)
if (q_status.Status == QUEST_STATUS_INCOMPLETE)
{
if (qInfo->HasFlag(QUEST_TRINITY_FLAGS_DELIVER))
{
for (uint8 i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; i++)
{
if (qInfo->RequiredItemCount[i]!= 0 && q_status.m_itemcount[i] < qInfo->RequiredItemCount[i])
if (qInfo->RequiredItemCount[i]!= 0 && q_status.ItemCount[i] < qInfo->RequiredItemCount[i])
return false;
}
}
@@ -14696,19 +14696,19 @@ bool Player::CanCompleteQuest(uint32 quest_id)
if (qInfo->RequiredNpcOrGo[i] == 0)
continue;
if (qInfo->RequiredNpcOrGoCount[i] != 0 && q_status.m_creatureOrGOcount[i] < qInfo->RequiredNpcOrGoCount[i])
if (qInfo->RequiredNpcOrGoCount[i] != 0 && q_status.CreatureOrGOCount[i] < qInfo->RequiredNpcOrGoCount[i])
return false;
}
}
if (qInfo->HasFlag(QUEST_TRINITY_FLAGS_PLAYER_KILL))
if (qInfo->GetPlayersSlain() != 0 && q_status.m_playercount < qInfo->GetPlayersSlain())
if (qInfo->GetPlayersSlain() != 0 && q_status.PlayerCount < qInfo->GetPlayersSlain())
return false;
if (qInfo->HasFlag(QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT) && !q_status.m_explored)
if (qInfo->HasFlag(QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT) && !q_status.Explored)
return false;
if (qInfo->HasFlag(QUEST_TRINITY_FLAGS_TIMED) && q_status.m_timer == 0)
if (qInfo->HasFlag(QUEST_TRINITY_FLAGS_TIMED) && q_status.Timer == 0)
return false;
if (qInfo->GetRewOrReqMoney() < 0)
@@ -14835,23 +14835,23 @@ void Player::AddQuest(Quest const* quest, Object* questGiver)
QuestStatusData& questStatusData = m_QuestStatus[quest_id];
// check for repeatable quests status reset
questStatusData.m_status = QUEST_STATUS_INCOMPLETE;
questStatusData.m_explored = false;
questStatusData.Status = QUEST_STATUS_INCOMPLETE;
questStatusData.Explored = false;
if (quest->HasFlag(QUEST_TRINITY_FLAGS_DELIVER))
{
for (uint8 i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; ++i)
questStatusData.m_itemcount[i] = 0;
questStatusData.ItemCount[i] = 0;
}
if (quest->HasFlag(QUEST_TRINITY_FLAGS_KILL_OR_CAST | QUEST_TRINITY_FLAGS_SPEAKTO))
{
for (uint8 i = 0; i < QUEST_OBJECTIVES_COUNT; ++i)
questStatusData.m_creatureOrGOcount[i] = 0;
questStatusData.CreatureOrGOCount[i] = 0;
}
if (quest->HasFlag(QUEST_TRINITY_FLAGS_PLAYER_KILL))
questStatusData.m_playercount = 0;
questStatusData.PlayerCount = 0;
GiveQuestSourceItem(quest);
AdjustQuestReqItemCount(quest, questStatusData);
@@ -14871,14 +14871,14 @@ void Player::AddQuest(Quest const* quest, Object* questGiver)
// shared timed quest
if (questGiver && questGiver->GetTypeId() == TYPEID_PLAYER)
limittime = questGiver->ToPlayer()->getQuestStatusMap()[quest_id].m_timer / IN_MILLISECONDS;
limittime = questGiver->ToPlayer()->getQuestStatusMap()[quest_id].Timer / IN_MILLISECONDS;
AddTimedQuest(quest_id);
questStatusData.m_timer = limittime * IN_MILLISECONDS;
questStatusData.Timer = limittime * IN_MILLISECONDS;
qtime = static_cast<uint32>(time(NULL)) + limittime;
}
else
questStatusData.m_timer = 0;
questStatusData.Timer = 0;
SetQuestSlot(log_slot, quest_id, qtime);
@@ -15141,7 +15141,7 @@ void Player::FailQuest(uint32 questId)
QuestStatusData& q_status = m_QuestStatus[questId];
RemoveTimedQuest(questId);
q_status.m_timer = 0;
q_status.Timer = 0;
SendQuestTimerFailed(questId);
}
@@ -15471,7 +15471,7 @@ bool Player::SatisfyQuestPrevChain(Quest const* qInfo, bool msg)
QuestStatusMap::const_iterator itr = m_QuestStatus.find(*iter);
// If any of the previous quests in chain active, return false
if (itr != m_QuestStatus.end() && itr->second.m_status != QUEST_STATUS_NONE)
if (itr != m_QuestStatus.end() && itr->second.Status != QUEST_STATUS_NONE)
{
if (msg)
SendCanTakeQuestResponse(INVALIDREASON_DONT_HAVE_REQ);
@@ -15631,7 +15631,7 @@ QuestStatus Player::GetQuestStatus(uint32 quest_id) const
{
QuestStatusMap::const_iterator itr = m_QuestStatus.find(quest_id);
if (itr != m_QuestStatus.end())
return itr->second.m_status;
return itr->second.Status;
if (Quest const* qInfo = sObjectMgr->GetQuestTemplate(quest_id))
if (!qInfo->IsRepeatable() && m_RewardedQuests.find(quest_id) != m_RewardedQuests.end())
@@ -15647,7 +15647,7 @@ bool Player::CanShareQuest(uint32 quest_id) const
{
QuestStatusMap::const_iterator itr = m_QuestStatus.find(quest_id);
if (itr != m_QuestStatus.end())
return itr->second.m_status == QUEST_STATUS_INCOMPLETE;
return itr->second.Status == QUEST_STATUS_INCOMPLETE;
}
return false;
}
@@ -15656,7 +15656,7 @@ void Player::SetQuestStatus(uint32 quest_id, QuestStatus status)
{
if (sObjectMgr->GetQuestTemplate(quest_id))
{
m_QuestStatus[quest_id].m_status = status;
m_QuestStatus[quest_id].Status = status;
m_QuestStatusSave[quest_id] = true;
}
@@ -15693,7 +15693,7 @@ uint16 Player::GetReqKillOrCastCurrentCount(uint32 quest_id, int32 entry)
for (uint8 j = 0; j < QUEST_OBJECTIVES_COUNT; ++j)
if (qInfo->RequiredNpcOrGo[j] == entry)
return m_QuestStatus[quest_id].m_creatureOrGOcount[j];
return m_QuestStatus[quest_id].CreatureOrGOCount[j];
return 0;
}
@@ -15709,7 +15709,7 @@ void Player::AdjustQuestReqItemCount(Quest const* quest, QuestStatusData& questS
{
uint32 curitemcount = GetItemCount(quest->RequiredItemId[i], true);
questStatusData.m_itemcount[i] = std::min(curitemcount, reqitemcount);
questStatusData.ItemCount[i] = std::min(curitemcount, reqitemcount);
m_QuestStatusSave[quest->GetQuestId()] = true;
}
}
@@ -15734,9 +15734,9 @@ void Player::AreaExploredOrEventHappens(uint32 questId)
{
QuestStatusData& q_status = m_QuestStatus[questId];
if (!q_status.m_explored)
if (!q_status.Explored)
{
q_status.m_explored = true;
q_status.Explored = true;
m_QuestStatusSave[questId] = true;
}
}
@@ -15773,7 +15773,7 @@ void Player::ItemAddedQuestCheck(uint32 entry, uint32 count)
QuestStatusData& q_status = m_QuestStatus[questid];
if (q_status.m_status != QUEST_STATUS_INCOMPLETE)
if (q_status.Status != QUEST_STATUS_INCOMPLETE)
continue;
Quest const* qInfo = sObjectMgr->GetQuestTemplate(questid);
@@ -15786,11 +15786,11 @@ void Player::ItemAddedQuestCheck(uint32 entry, uint32 count)
if (reqitem == entry)
{
uint32 reqitemcount = qInfo->RequiredItemCount[j];
uint16 curitemcount = q_status.m_itemcount[j];
uint16 curitemcount = q_status.ItemCount[j];
if (curitemcount < reqitemcount)
{
uint16 additemcount = curitemcount + count <= reqitemcount ? count : reqitemcount - curitemcount;
q_status.m_itemcount[j] += additemcount;
q_status.ItemCount[j] += additemcount;
m_QuestStatusSave[questid] = true;
@@ -15827,14 +15827,14 @@ void Player::ItemRemovedQuestCheck(uint32 entry, uint32 count)
uint32 reqitemcount = qInfo->RequiredItemCount[j];
uint16 curitemcount;
if (q_status.m_status != QUEST_STATUS_COMPLETE)
curitemcount = q_status.m_itemcount[j];
if (q_status.Status != QUEST_STATUS_COMPLETE)
curitemcount = q_status.ItemCount[j];
else
curitemcount = GetItemCount(entry, true);
if (curitemcount < reqitemcount + count)
{
uint16 remitemcount = curitemcount <= reqitemcount ? count : count + reqitemcount - curitemcount;
q_status.m_itemcount[j] = (curitemcount <= remitemcount) ? 0 : curitemcount - remitemcount;
q_status.ItemCount[j] = (curitemcount <= remitemcount) ? 0 : curitemcount - remitemcount;
m_QuestStatusSave[questid] = true;
@@ -15882,7 +15882,7 @@ void Player::KilledMonsterCredit(uint32 entry, uint64 guid)
continue;
// just if !ingroup || !noraidgroup || raidgroup
QuestStatusData& q_status = m_QuestStatus[questid];
if (q_status.m_status == QUEST_STATUS_INCOMPLETE && (!GetGroup() || !GetGroup()->isRaidGroup() || qInfo->IsAllowedInRaid()))
if (q_status.Status == QUEST_STATUS_INCOMPLETE && (!GetGroup() || !GetGroup()->isRaidGroup() || qInfo->IsAllowedInRaid()))
{
if (qInfo->HasFlag(QUEST_TRINITY_FLAGS_KILL_OR_CAST))
{
@@ -15901,10 +15901,10 @@ void Player::KilledMonsterCredit(uint32 entry, uint64 guid)
if (reqkill == real_entry)
{
uint32 reqkillcount = qInfo->RequiredNpcOrGoCount[j];
uint16 curkillcount = q_status.m_creatureOrGOcount[j];
uint16 curkillcount = q_status.CreatureOrGOCount[j];
if (curkillcount < reqkillcount)
{
q_status.m_creatureOrGOcount[j] = curkillcount + addkillcount;
q_status.CreatureOrGOCount[j] = curkillcount + addkillcount;
m_QuestStatusSave[questid] = true;
@@ -15937,16 +15937,16 @@ void Player::KilledPlayerCredit()
continue;
// just if !ingroup || !noraidgroup || raidgroup
QuestStatusData& q_status = m_QuestStatus[questid];
if (q_status.m_status == QUEST_STATUS_INCOMPLETE && (!GetGroup() || !GetGroup()->isRaidGroup() || qInfo->IsAllowedInRaid()))
if (q_status.Status == QUEST_STATUS_INCOMPLETE && (!GetGroup() || !GetGroup()->isRaidGroup() || qInfo->IsAllowedInRaid()))
{
if (qInfo->HasFlag(QUEST_TRINITY_FLAGS_PLAYER_KILL))
{
uint32 reqkill = qInfo->GetPlayersSlain();
uint16 curkill = q_status.m_playercount;
uint16 curkill = q_status.PlayerCount;
if (curkill < reqkill)
{
q_status.m_playercount = curkill + addkillcount;
q_status.PlayerCount = curkill + addkillcount;
m_QuestStatusSave[questid] = true;
@@ -15979,7 +15979,7 @@ void Player::CastedCreatureOrGO(uint32 entry, uint64 guid, uint32 spell_id)
QuestStatusData& q_status = m_QuestStatus[questid];
if (q_status.m_status == QUEST_STATUS_INCOMPLETE)
if (q_status.Status == QUEST_STATUS_INCOMPLETE)
{
if (qInfo->HasFlag(QUEST_TRINITY_FLAGS_KILL_OR_CAST))
{
@@ -16020,10 +16020,10 @@ void Player::CastedCreatureOrGO(uint32 entry, uint64 guid, uint32 spell_id)
continue;
uint32 reqCastCount = qInfo->RequiredNpcOrGoCount[j];
uint16 curCastCount = q_status.m_creatureOrGOcount[j];
uint16 curCastCount = q_status.CreatureOrGOCount[j];
if (curCastCount < reqCastCount)
{
q_status.m_creatureOrGOcount[j] = curCastCount + addCastCount;
q_status.CreatureOrGOCount[j] = curCastCount + addCastCount;
m_QuestStatusSave[questid] = true;
@@ -16056,7 +16056,7 @@ void Player::TalkedToCreature(uint32 entry, uint64 guid)
QuestStatusData& q_status = m_QuestStatus[questid];
if (q_status.m_status == QUEST_STATUS_INCOMPLETE)
if (q_status.Status == QUEST_STATUS_INCOMPLETE)
{
if (qInfo->HasFlag(QUEST_TRINITY_FLAGS_KILL_OR_CAST | QUEST_TRINITY_FLAGS_SPEAKTO))
{
@@ -16077,10 +16077,10 @@ void Player::TalkedToCreature(uint32 entry, uint64 guid)
if (reqTarget == entry)
{
uint32 reqTalkCount = qInfo->RequiredNpcOrGoCount[j];
uint16 curTalkCount = q_status.m_creatureOrGOcount[j];
uint16 curTalkCount = q_status.CreatureOrGOCount[j];
if (curTalkCount < reqTalkCount)
{
q_status.m_creatureOrGOcount[j] = curTalkCount + addTalkCount;
q_status.CreatureOrGOCount[j] = curTalkCount + addTalkCount;
m_QuestStatusSave[questid] = true;
@@ -16111,7 +16111,7 @@ void Player::MoneyChanged(uint32 count)
{
QuestStatusData& q_status = m_QuestStatus[questid];
if (q_status.m_status == QUEST_STATUS_INCOMPLETE)
if (q_status.Status == QUEST_STATUS_INCOMPLETE)
{
if (int32(count) >= -qInfo->GetRewOrReqMoney())
{
@@ -16119,7 +16119,7 @@ void Player::MoneyChanged(uint32 count)
CompleteQuest(questid);
}
}
else if (q_status.m_status == QUEST_STATUS_COMPLETE)
else if (q_status.Status == QUEST_STATUS_COMPLETE)
{
if (int32(count) < -qInfo->GetRewOrReqMoney())
IncompleteQuest(questid);
@@ -16139,13 +16139,13 @@ void Player::ReputationChanged(FactionEntry const* factionEntry)
if (qInfo->GetRepObjectiveFaction() == factionEntry->ID)
{
QuestStatusData& q_status = m_QuestStatus[questid];
if (q_status.m_status == QUEST_STATUS_INCOMPLETE)
if (q_status.Status == QUEST_STATUS_INCOMPLETE)
{
if (GetReputationMgr().GetReputation(factionEntry) >= qInfo->GetRepObjectiveValue())
if (CanCompleteQuest(questid))
CompleteQuest(questid);
}
else if (q_status.m_status == QUEST_STATUS_COMPLETE)
else if (q_status.Status == QUEST_STATUS_COMPLETE)
{
if (GetReputationMgr().GetReputation(factionEntry) < qInfo->GetRepObjectiveValue())
IncompleteQuest(questid);
@@ -16167,13 +16167,13 @@ void Player::ReputationChanged2(FactionEntry const* factionEntry)
if (qInfo->GetRepObjectiveFaction2() == factionEntry->ID)
{
QuestStatusData& q_status = m_QuestStatus[questid];
if (q_status.m_status == QUEST_STATUS_INCOMPLETE)
if (q_status.Status == QUEST_STATUS_INCOMPLETE)
{
if (GetReputationMgr().GetReputation(factionEntry) >= qInfo->GetRepObjectiveValue2())
if (CanCompleteQuest(questid))
CompleteQuest(questid);
}
else if (q_status.m_status == QUEST_STATUS_COMPLETE)
else if (q_status.Status == QUEST_STATUS_COMPLETE)
{
if (GetReputationMgr().GetReputation(factionEntry) < qInfo->GetRepObjectiveValue2())
IncompleteQuest(questid);
@@ -16198,7 +16198,7 @@ bool Player::HasQuestForItem(uint32 itemid) const
QuestStatusData const& q_status = qs_itr->second;
if (q_status.m_status == QUEST_STATUS_INCOMPLETE)
if (q_status.Status == QUEST_STATUS_INCOMPLETE)
{
Quest const* qinfo = sObjectMgr->GetQuestTemplate(questid);
if (!qinfo)
@@ -16213,7 +16213,7 @@ bool Player::HasQuestForItem(uint32 itemid) const
// This part for ReqItem drop
for (uint8 j = 0; j < QUEST_ITEM_OBJECTIVES_COUNT; ++j)
{
if (itemid == qinfo->RequiredItemId[j] && q_status.m_itemcount[j] < qinfo->RequiredItemCount[j])
if (itemid == qinfo->RequiredItemId[j] && q_status.ItemCount[j] < qinfo->RequiredItemCount[j])
return true;
}
// This part - for ReqSource
@@ -17776,14 +17776,14 @@ void Player::_LoadQuestStatus(PreparedQueryResult result)
uint8 qstatus = fields[1].GetUInt8();
if (qstatus < MAX_QUEST_STATUS)
questStatusData.m_status = QuestStatus(qstatus);
questStatusData.Status = QuestStatus(qstatus);
else
{
questStatusData.m_status = QUEST_STATUS_INCOMPLETE;
questStatusData.Status = QUEST_STATUS_INCOMPLETE;
sLog->outError("Player %s have invalid quest %d status (%u), replaced by QUEST_STATUS_INCOMPLETE(3).", GetName(), quest_id, qstatus);
}
questStatusData.m_explored = (fields[2].GetUInt8() > 0);
questStatusData.Explored = (fields[2].GetUInt8() > 0);
time_t quest_time = time_t(fields[3].GetUInt32());
@@ -17792,44 +17792,44 @@ void Player::_LoadQuestStatus(PreparedQueryResult result)
AddTimedQuest(quest_id);
if (quest_time <= sWorld->GetGameTime())
questStatusData.m_timer = 1;
questStatusData.Timer = 1;
else
questStatusData.m_timer = uint32((quest_time - sWorld->GetGameTime()) * IN_MILLISECONDS);
questStatusData.Timer = uint32((quest_time - sWorld->GetGameTime()) * IN_MILLISECONDS);
}
else
quest_time = 0;
questStatusData.m_creatureOrGOcount[0] = fields[4].GetUInt16();
questStatusData.m_creatureOrGOcount[1] = fields[5].GetUInt16();
questStatusData.m_creatureOrGOcount[2] = fields[6].GetUInt16();
questStatusData.m_creatureOrGOcount[3] = fields[7].GetUInt16();
questStatusData.m_itemcount[0] = fields[8].GetUInt16();
questStatusData.m_itemcount[1] = fields[9].GetUInt16();
questStatusData.m_itemcount[2] = fields[10].GetUInt16();
questStatusData.m_itemcount[3] = fields[11].GetUInt16();
questStatusData.m_playercount = fields[12].GetUInt16();
questStatusData.CreatureOrGOCount[0] = fields[4].GetUInt16();
questStatusData.CreatureOrGOCount[1] = fields[5].GetUInt16();
questStatusData.CreatureOrGOCount[2] = fields[6].GetUInt16();
questStatusData.CreatureOrGOCount[3] = fields[7].GetUInt16();
questStatusData.ItemCount[0] = fields[8].GetUInt16();
questStatusData.ItemCount[1] = fields[9].GetUInt16();
questStatusData.ItemCount[2] = fields[10].GetUInt16();
questStatusData.ItemCount[3] = fields[11].GetUInt16();
questStatusData.PlayerCount = fields[12].GetUInt16();
// add to quest log
if (slot < MAX_QUEST_LOG_SIZE && questStatusData.m_status != QUEST_STATUS_NONE)
if (slot < MAX_QUEST_LOG_SIZE && questStatusData.Status != QUEST_STATUS_NONE)
{
SetQuestSlot(slot, quest_id, uint32(quest_time)); // cast can't be helped
if (questStatusData.m_status == QUEST_STATUS_COMPLETE)
if (questStatusData.Status == QUEST_STATUS_COMPLETE)
SetQuestSlotState(slot, QUEST_STATE_COMPLETE);
else if (questStatusData.m_status == QUEST_STATUS_FAILED)
else if (questStatusData.Status == QUEST_STATUS_FAILED)
SetQuestSlotState(slot, QUEST_STATE_FAIL);
for (uint8 idx = 0; idx < QUEST_OBJECTIVES_COUNT; ++idx)
if (questStatusData.m_creatureOrGOcount[idx])
SetQuestSlotCounter(slot, idx, questStatusData.m_creatureOrGOcount[idx]);
if (questStatusData.CreatureOrGOCount[idx])
SetQuestSlotCounter(slot, idx, questStatusData.CreatureOrGOCount[idx]);
if (questStatusData.m_playercount)
SetQuestSlotCounter(slot, QUEST_PVP_KILL_SLOT, questStatusData.m_playercount);
if (questStatusData.PlayerCount)
SetQuestSlotCounter(slot, QUEST_PVP_KILL_SLOT, questStatusData.PlayerCount);
++slot;
}
sLog->outDebug(LOG_FILTER_PLAYER_LOADING, "Quest status is {%u} for quest {%u} for player (GUID: %u)", questStatusData.m_status, quest_id, GetGUIDLow());
sLog->outDebug(LOG_FILTER_PLAYER_LOADING, "Quest status is {%u} for quest {%u} for player (GUID: %u)", questStatusData.Status, quest_id, GetGUIDLow());
}
}
while (result->NextRow());
@@ -19004,10 +19004,10 @@ void Player::_SaveQuestStatus(SQLTransaction& trans)
if (saveItr->second)
{
statusItr = m_QuestStatus.find(saveItr->first);
if (statusItr != m_QuestStatus.end() && (keepAbandoned || statusItr->second.m_status != QUEST_STATUS_NONE))
if (statusItr != m_QuestStatus.end() && (keepAbandoned || statusItr->second.Status != QUEST_STATUS_NONE))
trans->PAppend("REPLACE INTO character_queststatus (guid, quest, status, explored, timer, mobcount1, mobcount2, mobcount3, mobcount4, itemcount1, itemcount2, itemcount3, itemcount4, playercount) "
"VALUES ('%u', '%u', '%u', '%u', '" UI64FMTD "', '%u', '%u', '%u', '%u', '%u', '%u', '%u', '%u', '%u')",
GetGUIDLow(), statusItr->first, statusItr->second.m_status, statusItr->second.m_explored, uint64(statusItr->second.m_timer / IN_MILLISECONDS+ sWorld->GetGameTime()), statusItr->second.m_creatureOrGOcount[0], statusItr->second.m_creatureOrGOcount[1], statusItr->second.m_creatureOrGOcount[2], statusItr->second.m_creatureOrGOcount[3], statusItr->second.m_itemcount[0], statusItr->second.m_itemcount[1], statusItr->second.m_itemcount[2], statusItr->second.m_itemcount[3], statusItr->second.m_playercount);
GetGUIDLow(), statusItr->first, statusItr->second.Status, statusItr->second.Explored, uint64(statusItr->second.Timer / IN_MILLISECONDS+ sWorld->GetGameTime()), statusItr->second.CreatureOrGOCount[0], statusItr->second.CreatureOrGOCount[1], statusItr->second.CreatureOrGOCount[2], statusItr->second.CreatureOrGOCount[3], statusItr->second.ItemCount[0], statusItr->second.ItemCount[1], statusItr->second.ItemCount[2], statusItr->second.ItemCount[3], statusItr->second.PlayerCount);
}
else
trans->PAppend("DELETE FROM character_queststatus WHERE guid = %u AND quest = %u", GetGUIDLow(), saveItr->first);
@@ -22337,7 +22337,7 @@ bool Player::HasQuestForGO(int32 GOId) const
QuestStatusData const& qs = qs_itr->second;
if (qs.m_status == QUEST_STATUS_INCOMPLETE)
if (qs.Status == QUEST_STATUS_INCOMPLETE)
{
Quest const* qinfo = sObjectMgr->GetQuestTemplate(questid);
if (!qinfo)
@@ -22351,7 +22351,7 @@ bool Player::HasQuestForGO(int32 GOId) const
if (qinfo->RequiredNpcOrGo[j] >= 0) //skip non GO case
continue;
if ((-1)*GOId == qinfo->RequiredNpcOrGo[j] && qs.m_creatureOrGOcount[j] < qinfo->RequiredNpcOrGoCount[j])
if ((-1)*GOId == qinfo->RequiredNpcOrGo[j] && qs.CreatureOrGOCount[j] < qinfo->RequiredNpcOrGoCount[j])
return true;
}
}