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:
@@ -1334,9 +1334,9 @@ void CreatureEventAI::ReceiveEmote(Player* player, uint32 textEmote)
|
||||
return;
|
||||
|
||||
Condition cond;
|
||||
cond.mConditionType = ConditionType((*itr).Event.receive_emote.condition);
|
||||
cond.mConditionValue1 = (*itr).Event.receive_emote.conditionValue1;
|
||||
cond.mConditionValue2 = (*itr).Event.receive_emote.conditionValue2;
|
||||
cond.ConditionType = ConditionTypes((*itr).Event.receive_emote.condition);
|
||||
cond.ConditionValue1 = (*itr).Event.receive_emote.conditionValue1;
|
||||
cond.ConditionValue2 = (*itr).Event.receive_emote.conditionValue2;
|
||||
|
||||
ConditionSourceInfo srcInfo = ConditionSourceInfo(player);
|
||||
if (cond.Meets(srcInfo))
|
||||
|
||||
@@ -359,9 +359,9 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
|
||||
if (temp.receive_emote.condition)
|
||||
{
|
||||
Condition cond;
|
||||
cond.mConditionType = ConditionType(temp.receive_emote.condition);
|
||||
cond.mConditionValue1 = temp.receive_emote.conditionValue1;
|
||||
cond.mConditionValue2 = temp.receive_emote.conditionValue2;
|
||||
cond.ConditionType = ConditionTypes(temp.receive_emote.condition);
|
||||
cond.ConditionValue1 = temp.receive_emote.conditionValue1;
|
||||
cond.ConditionValue2 = temp.receive_emote.conditionValue2;
|
||||
if (!sConditionMgr->isConditionTypeValid(&cond))
|
||||
{
|
||||
sLog->outErrorDb("CreatureEventAI: Creature %u using event %u: param2 (Condition: %u) are not valid.", temp.creature_id, i, temp.receive_emote.condition);
|
||||
|
||||
@@ -2783,10 +2783,10 @@ bool SmartScript::ConditionValid(Unit* u, int32 c, int32 v1, int32 v2, int32 v3)
|
||||
if (c == 0) return true;
|
||||
if (!u || !u->ToPlayer()) return false;
|
||||
Condition cond;
|
||||
cond.mConditionType = ConditionType(uint32(c));
|
||||
cond.mConditionValue1 = uint32(v1);
|
||||
cond.mConditionValue1 = uint32(v2);
|
||||
cond.mConditionValue1 = uint32(v3);
|
||||
cond.ConditionType = ConditionTypes(uint32(c));
|
||||
cond.ConditionValue1 = uint32(v1);
|
||||
cond.ConditionValue1 = uint32(v2);
|
||||
cond.ConditionValue1 = uint32(v3);
|
||||
ConditionSourceInfo srcInfo = ConditionSourceInfo(u->ToPlayer());
|
||||
return cond.Meets(srcInfo);
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -28,7 +28,7 @@ class WorldObject;
|
||||
class LootTemplate;
|
||||
struct Condition;
|
||||
|
||||
enum ConditionType
|
||||
enum ConditionTypes
|
||||
{ // value1 value2 value3
|
||||
CONDITION_NONE = 0, // 0 0 0 always true
|
||||
CONDITION_AURA = 1, // spell_id effindex use target? true if player (or target, if value3) has aura of spell_id with effect effindex
|
||||
@@ -140,40 +140,40 @@ struct ConditionSourceInfo
|
||||
|
||||
struct Condition
|
||||
{
|
||||
ConditionSourceType mSourceType; //SourceTypeOrReferenceId
|
||||
uint32 mSourceGroup;
|
||||
int32 mSourceEntry;
|
||||
uint32 mSourceId; // So far, only used in CONDITION_SOURCE_TYPE_SMART_EVENT
|
||||
uint32 mElseGroup;
|
||||
ConditionType mConditionType; //ConditionTypeOrReference
|
||||
uint8 mConditionTarget;
|
||||
uint32 mConditionValue1;
|
||||
uint32 mConditionValue2;
|
||||
uint32 mConditionValue3;
|
||||
uint32 ErrorTextd;
|
||||
uint32 mReferenceId;
|
||||
uint32 mScriptId;
|
||||
bool mNegativeCondition;
|
||||
ConditionSourceType SourceType; //SourceTypeOrReferenceId
|
||||
uint32 SourceGroup;
|
||||
int32 SourceEntry;
|
||||
uint32 SourceId; // So far, only used in CONDITION_SOURCE_TYPE_SMART_EVENT
|
||||
uint32 ElseGroup;
|
||||
ConditionTypes ConditionType; //ConditionTypeOrReference
|
||||
uint32 ConditionValue1;
|
||||
uint32 ConditionValue2;
|
||||
uint32 ConditionValue3;
|
||||
uint32 ErrorTextId;
|
||||
uint32 ReferenceId;
|
||||
uint32 ScriptId;
|
||||
uint8 ConditionTarget;
|
||||
bool NegativeCondition;
|
||||
|
||||
Condition()
|
||||
{
|
||||
mSourceType = CONDITION_SOURCE_TYPE_NONE;
|
||||
mSourceGroup = 0;
|
||||
mSourceEntry = 0;
|
||||
mElseGroup = 0;
|
||||
mConditionType = CONDITION_NONE;
|
||||
mConditionTarget = 0;
|
||||
mConditionValue1 = 0;
|
||||
mConditionValue2 = 0;
|
||||
mConditionValue3 = 0;
|
||||
mReferenceId = 0;
|
||||
ErrorTextd = 0;
|
||||
mScriptId = 0;
|
||||
mNegativeCondition = false;
|
||||
SourceType = CONDITION_SOURCE_TYPE_NONE;
|
||||
SourceGroup = 0;
|
||||
SourceEntry = 0;
|
||||
ElseGroup = 0;
|
||||
ConditionType = CONDITION_NONE;
|
||||
ConditionTarget = 0;
|
||||
ConditionValue1 = 0;
|
||||
ConditionValue2 = 0;
|
||||
ConditionValue3 = 0;
|
||||
ReferenceId = 0;
|
||||
ErrorTextId = 0;
|
||||
ScriptId = 0;
|
||||
NegativeCondition = false;
|
||||
}
|
||||
|
||||
bool Meets(ConditionSourceInfo& sourceInfo);
|
||||
bool isLoaded() const { return mConditionType > CONDITION_NONE || mReferenceId; }
|
||||
bool isLoaded() const { return ConditionType > CONDITION_NONE || ReferenceId; }
|
||||
uint32 GetMaxAvailableConditionTargets();
|
||||
};
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1062,19 +1062,16 @@ private:
|
||||
|
||||
Player* _killer;
|
||||
Unit* _victim;
|
||||
bool _isBattleGround;
|
||||
|
||||
bool _isPvP;
|
||||
|
||||
Group* _group;
|
||||
float _groupRate;
|
||||
uint8 _maxLevel;
|
||||
Player* _maxNotGrayMember;
|
||||
uint32 _count;
|
||||
uint32 _sumLevel;
|
||||
bool _isFullXP;
|
||||
|
||||
uint32 _xp;
|
||||
bool _isFullXP;
|
||||
uint8 _maxLevel;
|
||||
bool _isBattleGround;
|
||||
bool _isPvP;
|
||||
};
|
||||
|
||||
class Player : public Unit, public GridObject<Player>
|
||||
|
||||
@@ -65,10 +65,10 @@ struct VehicleAccessory
|
||||
VehicleAccessory(uint32 entry, int8 seatId, bool isMinion, uint8 summonType, uint32 summonTime) :
|
||||
AccessoryEntry(entry), SeatId(seatId), IsMinion(isMinion), SummonedType(summonType), SummonTime(summonTime) {}
|
||||
uint32 AccessoryEntry;
|
||||
int8 SeatId;
|
||||
uint32 IsMinion;
|
||||
uint8 SummonedType;
|
||||
uint32 SummonTime;
|
||||
int8 SeatId;
|
||||
uint8 SummonedType;
|
||||
};
|
||||
|
||||
typedef std::vector<VehicleAccessory> VehicleAccessoryList;
|
||||
|
||||
@@ -6827,15 +6827,15 @@ void ObjectMgr::LoadReputationOnKill()
|
||||
uint32 creature_id = fields[0].GetUInt32();
|
||||
|
||||
ReputationOnKillEntry repOnKill;
|
||||
repOnKill.repfaction1 = fields[1].GetUInt32();
|
||||
repOnKill.repfaction2 = fields[2].GetUInt32();
|
||||
repOnKill.is_teamaward1 = fields[3].GetBool();
|
||||
repOnKill.reputation_max_cap1 = fields[4].GetUInt32();
|
||||
repOnKill.repvalue1 = fields[5].GetInt32();
|
||||
repOnKill.is_teamaward2 = fields[6].GetBool();
|
||||
repOnKill.reputation_max_cap2 = fields[7].GetUInt32();
|
||||
repOnKill.repvalue2 = fields[8].GetInt32();
|
||||
repOnKill.team_dependent = fields[9].GetUInt8();
|
||||
repOnKill.RepFaction1 = fields[1].GetUInt32();
|
||||
repOnKill.RepFaction2 = fields[2].GetUInt32();
|
||||
repOnKill.IsTeamAward1 = fields[3].GetBool();
|
||||
repOnKill.ReputationMaxCap1 = fields[4].GetUInt32();
|
||||
repOnKill.RepValue1 = fields[5].GetInt32();
|
||||
repOnKill.IsTeamAward2 = fields[6].GetBool();
|
||||
repOnKill.ReputationMaxCap2 = fields[7].GetUInt32();
|
||||
repOnKill.RepValue2 = fields[8].GetInt32();
|
||||
repOnKill.TeamDependent = fields[9].GetUInt8();
|
||||
|
||||
if (!GetCreatureTemplate(creature_id))
|
||||
{
|
||||
@@ -6843,22 +6843,22 @@ void ObjectMgr::LoadReputationOnKill()
|
||||
continue;
|
||||
}
|
||||
|
||||
if (repOnKill.repfaction1)
|
||||
if (repOnKill.RepFaction1)
|
||||
{
|
||||
FactionEntry const* factionEntry1 = sFactionStore.LookupEntry(repOnKill.repfaction1);
|
||||
FactionEntry const* factionEntry1 = sFactionStore.LookupEntry(repOnKill.RepFaction1);
|
||||
if (!factionEntry1)
|
||||
{
|
||||
sLog->outErrorDb("Faction (faction.dbc) %u does not exist but is used in `creature_onkill_reputation`", repOnKill.repfaction1);
|
||||
sLog->outErrorDb("Faction (faction.dbc) %u does not exist but is used in `creature_onkill_reputation`", repOnKill.RepFaction1);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (repOnKill.repfaction2)
|
||||
if (repOnKill.RepFaction2)
|
||||
{
|
||||
FactionEntry const* factionEntry2 = sFactionStore.LookupEntry(repOnKill.repfaction2);
|
||||
FactionEntry const* factionEntry2 = sFactionStore.LookupEntry(repOnKill.RepFaction2);
|
||||
if (!factionEntry2)
|
||||
{
|
||||
sLog->outErrorDb("Faction (faction.dbc) %u does not exist but is used in `creature_onkill_reputation`", repOnKill.repfaction2);
|
||||
sLog->outErrorDb("Faction (faction.dbc) %u does not exist but is used in `creature_onkill_reputation`", repOnKill.RepFaction2);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -440,15 +440,15 @@ struct RepRewardRate
|
||||
|
||||
struct ReputationOnKillEntry
|
||||
{
|
||||
uint32 repfaction1;
|
||||
uint32 repfaction2;
|
||||
bool is_teamaward1;
|
||||
uint32 reputation_max_cap1;
|
||||
int32 repvalue1;
|
||||
bool is_teamaward2;
|
||||
uint32 reputation_max_cap2;
|
||||
int32 repvalue2;
|
||||
bool team_dependent;
|
||||
uint32 RepFaction1;
|
||||
uint32 RepFaction2;
|
||||
uint32 ReputationMaxCap1;
|
||||
int32 RepValue1;
|
||||
uint32 ReputationMaxCap2;
|
||||
int32 RepValue2;
|
||||
bool IsTeamAward1;
|
||||
bool IsTeamAward2;
|
||||
bool TeamDependent;
|
||||
};
|
||||
|
||||
struct RepSpilloverTemplate
|
||||
|
||||
@@ -1364,7 +1364,7 @@ bool LootTemplate::addConditionItem(Condition* cond)
|
||||
{
|
||||
for (LootStoreItemList::iterator i = Entries.begin(); i != Entries.end(); ++i)
|
||||
{
|
||||
if (i->itemid == cond->mSourceEntry)
|
||||
if (i->itemid == cond->SourceEntry)
|
||||
{
|
||||
i->conditions.push_back(cond);
|
||||
return true;
|
||||
@@ -1380,7 +1380,7 @@ bool LootTemplate::addConditionItem(Condition* cond)
|
||||
{
|
||||
for (LootStoreItemList::iterator i = itemList->begin(); i != itemList->end(); ++i)
|
||||
{
|
||||
if ((*i).itemid == cond->mSourceEntry)
|
||||
if ((*i).itemid == cond->SourceEntry)
|
||||
{
|
||||
(*i).conditions.push_back(cond);
|
||||
return true;
|
||||
@@ -1392,7 +1392,7 @@ bool LootTemplate::addConditionItem(Condition* cond)
|
||||
{
|
||||
for (LootStoreItemList::iterator i = itemList->begin(); i != itemList->end(); ++i)
|
||||
{
|
||||
if ((*i).itemid == cond->mSourceEntry)
|
||||
if ((*i).itemid == cond->SourceEntry)
|
||||
{
|
||||
(*i).conditions.push_back(cond);
|
||||
return true;
|
||||
|
||||
@@ -1022,24 +1022,24 @@ void Map::UnloadAll()
|
||||
// *****************************
|
||||
GridMap::GridMap()
|
||||
{
|
||||
m_flags = 0;
|
||||
_flags = 0;
|
||||
// Area data
|
||||
m_gridArea = 0;
|
||||
m_area_map = NULL;
|
||||
_gridArea = 0;
|
||||
_areaMap = NULL;
|
||||
// Height level data
|
||||
m_gridHeight = INVALID_HEIGHT;
|
||||
m_gridGetHeight = &GridMap::getHeightFromFlat;
|
||||
_gridHeight = INVALID_HEIGHT;
|
||||
_gridGetHeight = &GridMap::getHeightFromFlat;
|
||||
m_V9 = NULL;
|
||||
m_V8 = NULL;
|
||||
// Liquid data
|
||||
m_liquidType = 0;
|
||||
m_liquid_offX = 0;
|
||||
m_liquid_offY = 0;
|
||||
m_liquid_width = 0;
|
||||
m_liquid_height = 0;
|
||||
m_liquidLevel = INVALID_HEIGHT;
|
||||
m_liquid_type = NULL;
|
||||
m_liquid_map = NULL;
|
||||
_liquidType = 0;
|
||||
_liquidOffX = 0;
|
||||
_liquidOffY = 0;
|
||||
_liquidWidth = 0;
|
||||
_liquidHeight = 0;
|
||||
_liquidLevel = INVALID_HEIGHT;
|
||||
_liquidType = NULL;
|
||||
_liquidMap = NULL;
|
||||
}
|
||||
|
||||
GridMap::~GridMap()
|
||||
@@ -1097,17 +1097,17 @@ bool GridMap::loadData(char *filename)
|
||||
|
||||
void GridMap::unloadData()
|
||||
{
|
||||
delete[] m_area_map;
|
||||
delete[] _areaMap;
|
||||
delete[] m_V9;
|
||||
delete[] m_V8;
|
||||
delete[] m_liquid_type;
|
||||
delete[] m_liquid_map;
|
||||
m_area_map = NULL;
|
||||
delete[] _liquidType;
|
||||
delete[] _liquidMap;
|
||||
_areaMap = NULL;
|
||||
m_V9 = NULL;
|
||||
m_V8 = NULL;
|
||||
m_liquid_type = NULL;
|
||||
m_liquid_map = NULL;
|
||||
m_gridGetHeight = &GridMap::getHeightFromFlat;
|
||||
_liquidType = NULL;
|
||||
_liquidMap = NULL;
|
||||
_gridGetHeight = &GridMap::getHeightFromFlat;
|
||||
}
|
||||
|
||||
bool GridMap::loadAreaData(FILE* in, uint32 offset, uint32 /*size*/)
|
||||
@@ -1118,11 +1118,11 @@ bool GridMap::loadAreaData(FILE* in, uint32 offset, uint32 /*size*/)
|
||||
if (fread(&header, sizeof(header), 1, in) != 1 || header.fourcc != MapAreaMagic.asUInt)
|
||||
return false;
|
||||
|
||||
m_gridArea = header.gridArea;
|
||||
_gridArea = header.gridArea;
|
||||
if (!(header.flags & MAP_AREA_NO_AREA))
|
||||
{
|
||||
m_area_map = new uint16 [16*16];
|
||||
if (fread(m_area_map, sizeof(uint16), 16*16, in) != 16*16)
|
||||
_areaMap = new uint16 [16*16];
|
||||
if (fread(_areaMap, sizeof(uint16), 16*16, in) != 16*16)
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -1136,7 +1136,7 @@ bool GridMap::loadHeihgtData(FILE* in, uint32 offset, uint32 /*size*/)
|
||||
if (fread(&header, sizeof(header), 1, in) != 1 || header.fourcc != MapHeightMagic.asUInt)
|
||||
return false;
|
||||
|
||||
m_gridHeight = header.gridHeight;
|
||||
_gridHeight = header.gridHeight;
|
||||
if (!(header.flags & MAP_HEIGHT_NO_HEIGHT))
|
||||
{
|
||||
if ((header.flags & MAP_HEIGHT_AS_INT16))
|
||||
@@ -1146,8 +1146,8 @@ bool GridMap::loadHeihgtData(FILE* in, uint32 offset, uint32 /*size*/)
|
||||
if (fread(m_uint16_V9, sizeof(uint16), 129*129, in) != 129*129 ||
|
||||
fread(m_uint16_V8, sizeof(uint16), 128*128, in) != 128*128)
|
||||
return false;
|
||||
m_gridIntHeightMultiplier = (header.gridMaxHeight - header.gridHeight) / 65535;
|
||||
m_gridGetHeight = &GridMap::getHeightFromUint16;
|
||||
_gridIntHeightMultiplier = (header.gridMaxHeight - header.gridHeight) / 65535;
|
||||
_gridGetHeight = &GridMap::getHeightFromUint16;
|
||||
}
|
||||
else if ((header.flags & MAP_HEIGHT_AS_INT8))
|
||||
{
|
||||
@@ -1156,8 +1156,8 @@ bool GridMap::loadHeihgtData(FILE* in, uint32 offset, uint32 /*size*/)
|
||||
if (fread(m_uint8_V9, sizeof(uint8), 129*129, in) != 129*129 ||
|
||||
fread(m_uint8_V8, sizeof(uint8), 128*128, in) != 128*128)
|
||||
return false;
|
||||
m_gridIntHeightMultiplier = (header.gridMaxHeight - header.gridHeight) / 255;
|
||||
m_gridGetHeight = &GridMap::getHeightFromUint8;
|
||||
_gridIntHeightMultiplier = (header.gridMaxHeight - header.gridHeight) / 255;
|
||||
_gridGetHeight = &GridMap::getHeightFromUint8;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1166,11 +1166,11 @@ bool GridMap::loadHeihgtData(FILE* in, uint32 offset, uint32 /*size*/)
|
||||
if (fread(m_V9, sizeof(float), 129*129, in) != 129*129 ||
|
||||
fread(m_V8, sizeof(float), 128*128, in) != 128*128)
|
||||
return false;
|
||||
m_gridGetHeight = &GridMap::getHeightFromFloat;
|
||||
_gridGetHeight = &GridMap::getHeightFromFloat;
|
||||
}
|
||||
}
|
||||
else
|
||||
m_gridGetHeight = &GridMap::getHeightFromFlat;
|
||||
_gridGetHeight = &GridMap::getHeightFromFlat;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1182,23 +1182,23 @@ bool GridMap::loadLiquidData(FILE* in, uint32 offset, uint32 /*size*/)
|
||||
if (fread(&header, sizeof(header), 1, in) != 1 || header.fourcc != MapLiquidMagic.asUInt)
|
||||
return false;
|
||||
|
||||
m_liquidType = header.liquidType;
|
||||
m_liquid_offX = header.offsetX;
|
||||
m_liquid_offY = header.offsetY;
|
||||
m_liquid_width = header.width;
|
||||
m_liquid_height= header.height;
|
||||
m_liquidLevel = header.liquidLevel;
|
||||
_liquidType = header.liquidType;
|
||||
_liquidOffX = header.offsetX;
|
||||
_liquidOffY = header.offsetY;
|
||||
_liquidWidth = header.width;
|
||||
_liquidHeight= header.height;
|
||||
_liquidLevel = header.liquidLevel;
|
||||
|
||||
if (!(header.flags & MAP_LIQUID_NO_TYPE))
|
||||
{
|
||||
m_liquid_type = new uint8 [16*16];
|
||||
if (fread(m_liquid_type, sizeof(uint8), 16*16, in) != 16*16)
|
||||
_liquidType = new uint8 [16*16];
|
||||
if (fread(_liquidType, sizeof(uint8), 16*16, in) != 16*16)
|
||||
return false;
|
||||
}
|
||||
if (!(header.flags & MAP_LIQUID_NO_HEIGHT))
|
||||
{
|
||||
m_liquid_map = new float [m_liquid_width*m_liquid_height];
|
||||
if (fread(m_liquid_map, sizeof(float), m_liquid_width*m_liquid_height, in) != m_liquid_width*m_liquid_height)
|
||||
_liquidMap = new float [_liquidWidth*_liquidHeight];
|
||||
if (fread(_liquidMap, sizeof(float), _liquidWidth*_liquidHeight, in) != _liquidWidth*_liquidHeight)
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -1206,25 +1206,25 @@ bool GridMap::loadLiquidData(FILE* in, uint32 offset, uint32 /*size*/)
|
||||
|
||||
uint16 GridMap::getArea(float x, float y)
|
||||
{
|
||||
if (!m_area_map)
|
||||
return m_gridArea;
|
||||
if (!_areaMap)
|
||||
return _gridArea;
|
||||
|
||||
x = 16 * (32 - x/SIZE_OF_GRIDS);
|
||||
y = 16 * (32 - y/SIZE_OF_GRIDS);
|
||||
int lx = (int)x & 15;
|
||||
int ly = (int)y & 15;
|
||||
return m_area_map[lx*16 + ly];
|
||||
return _areaMap[lx*16 + ly];
|
||||
}
|
||||
|
||||
float GridMap::getHeightFromFlat(float /*x*/, float /*y*/) const
|
||||
{
|
||||
return m_gridHeight;
|
||||
return _gridHeight;
|
||||
}
|
||||
|
||||
float GridMap::getHeightFromFloat(float x, float y) const
|
||||
{
|
||||
if (!m_V8 || !m_V9)
|
||||
return m_gridHeight;
|
||||
return _gridHeight;
|
||||
|
||||
x = MAP_RESOLUTION * (32 - x/SIZE_OF_GRIDS);
|
||||
y = MAP_RESOLUTION * (32 - y/SIZE_OF_GRIDS);
|
||||
@@ -1306,7 +1306,7 @@ float GridMap::getHeightFromFloat(float x, float y) const
|
||||
float GridMap::getHeightFromUint8(float x, float y) const
|
||||
{
|
||||
if (!m_uint8_V8 || !m_uint8_V9)
|
||||
return m_gridHeight;
|
||||
return _gridHeight;
|
||||
|
||||
x = MAP_RESOLUTION * (32 - x/SIZE_OF_GRIDS);
|
||||
y = MAP_RESOLUTION * (32 - y/SIZE_OF_GRIDS);
|
||||
@@ -1367,13 +1367,13 @@ float GridMap::getHeightFromUint8(float x, float y) const
|
||||
}
|
||||
}
|
||||
// Calculate height
|
||||
return (float)((a * x) + (b * y) + c)*m_gridIntHeightMultiplier + m_gridHeight;
|
||||
return (float)((a * x) + (b * y) + c)*_gridIntHeightMultiplier + _gridHeight;
|
||||
}
|
||||
|
||||
float GridMap::getHeightFromUint16(float x, float y) const
|
||||
{
|
||||
if (!m_uint16_V8 || !m_uint16_V9)
|
||||
return m_gridHeight;
|
||||
return _gridHeight;
|
||||
|
||||
x = MAP_RESOLUTION * (32 - x/SIZE_OF_GRIDS);
|
||||
y = MAP_RESOLUTION * (32 - y/SIZE_OF_GRIDS);
|
||||
@@ -1434,45 +1434,45 @@ float GridMap::getHeightFromUint16(float x, float y) const
|
||||
}
|
||||
}
|
||||
// Calculate height
|
||||
return (float)((a * x) + (b * y) + c)*m_gridIntHeightMultiplier + m_gridHeight;
|
||||
return (float)((a * x) + (b * y) + c)*_gridIntHeightMultiplier + _gridHeight;
|
||||
}
|
||||
|
||||
float GridMap::getLiquidLevel(float x, float y)
|
||||
{
|
||||
if (!m_liquid_map)
|
||||
return m_liquidLevel;
|
||||
if (!_liquidMap)
|
||||
return _liquidLevel;
|
||||
|
||||
x = MAP_RESOLUTION * (32 - x/SIZE_OF_GRIDS);
|
||||
y = MAP_RESOLUTION * (32 - y/SIZE_OF_GRIDS);
|
||||
|
||||
int cx_int = ((int)x & (MAP_RESOLUTION-1)) - m_liquid_offY;
|
||||
int cy_int = ((int)y & (MAP_RESOLUTION-1)) - m_liquid_offX;
|
||||
int cx_int = ((int)x & (MAP_RESOLUTION-1)) - _liquidOffY;
|
||||
int cy_int = ((int)y & (MAP_RESOLUTION-1)) - _liquidOffX;
|
||||
|
||||
if (cx_int < 0 || cx_int >=m_liquid_height)
|
||||
if (cx_int < 0 || cx_int >=_liquidHeight)
|
||||
return INVALID_HEIGHT;
|
||||
if (cy_int < 0 || cy_int >=m_liquid_width)
|
||||
if (cy_int < 0 || cy_int >=_liquidWidth)
|
||||
return INVALID_HEIGHT;
|
||||
|
||||
return m_liquid_map[cx_int*m_liquid_width + cy_int];
|
||||
return _liquidMap[cx_int*_liquidWidth + cy_int];
|
||||
}
|
||||
|
||||
uint8 GridMap::getTerrainType(float x, float y)
|
||||
{
|
||||
if (!m_liquid_type)
|
||||
if (!_liquidType)
|
||||
return 0;
|
||||
|
||||
x = 16 * (32 - x/SIZE_OF_GRIDS);
|
||||
y = 16 * (32 - y/SIZE_OF_GRIDS);
|
||||
int lx = (int)x & 15;
|
||||
int ly = (int)y & 15;
|
||||
return m_liquid_type[lx*16 + ly];
|
||||
return _liquidType[lx*16 + ly];
|
||||
}
|
||||
|
||||
// Get water state on map
|
||||
inline ZLiquidStatus GridMap::getLiquidStatus(float x, float y, float z, uint8 ReqLiquidType, LiquidData* data)
|
||||
{
|
||||
// Check water type (if no water return)
|
||||
if (!m_liquid_type && !m_liquidType)
|
||||
if (!_liquidType && !_liquidType)
|
||||
return LIQUID_MAP_NO_WATER;
|
||||
|
||||
// Get cell
|
||||
@@ -1483,7 +1483,7 @@ inline ZLiquidStatus GridMap::getLiquidStatus(float x, float y, float z, uint8 R
|
||||
int y_int = (int)cy & (MAP_RESOLUTION-1);
|
||||
|
||||
// Check water type in cell
|
||||
uint8 type = m_liquid_type ? m_liquid_type[(x_int>>3)*16 + (y_int>>3)] : m_liquidType;
|
||||
uint8 type = _liquidType ? _liquidType[(x_int>>3)*16 + (y_int>>3)] : _liquidType;
|
||||
if (type == 0)
|
||||
return LIQUID_MAP_NO_WATER;
|
||||
|
||||
@@ -1493,15 +1493,15 @@ inline ZLiquidStatus GridMap::getLiquidStatus(float x, float y, float z, uint8 R
|
||||
|
||||
// Check water level:
|
||||
// Check water height map
|
||||
int lx_int = x_int - m_liquid_offY;
|
||||
int ly_int = y_int - m_liquid_offX;
|
||||
if (lx_int < 0 || lx_int >=m_liquid_height)
|
||||
int lx_int = x_int - _liquidOffY;
|
||||
int ly_int = y_int - _liquidOffX;
|
||||
if (lx_int < 0 || lx_int >=_liquidHeight)
|
||||
return LIQUID_MAP_NO_WATER;
|
||||
if (ly_int < 0 || ly_int >=m_liquid_width)
|
||||
if (ly_int < 0 || ly_int >=_liquidWidth)
|
||||
return LIQUID_MAP_NO_WATER;
|
||||
|
||||
// Get water level
|
||||
float liquid_level = m_liquid_map ? m_liquid_map[lx_int*m_liquid_width + ly_int] : m_liquidLevel;
|
||||
float liquid_level = _liquidMap ? _liquidMap[lx_int*_liquidWidth + ly_int] : _liquidLevel;
|
||||
// Get ground level (sub 0.2 for fix some errors)
|
||||
float ground_level = getHeight(x, y);
|
||||
|
||||
|
||||
+42
-39
@@ -143,55 +143,58 @@ struct LiquidData
|
||||
|
||||
class GridMap
|
||||
{
|
||||
uint32 m_flags;
|
||||
// Area data
|
||||
uint16 m_gridArea;
|
||||
uint16 *m_area_map;
|
||||
uint32 _flags;
|
||||
union{
|
||||
float* m_V9;
|
||||
uint16* m_uint16_V9;
|
||||
uint8* m_uint8_V9;
|
||||
};
|
||||
union{
|
||||
float* m_V8;
|
||||
uint16* m_uint16_V8;
|
||||
uint8* m_uint8_V8;
|
||||
};
|
||||
// Height level data
|
||||
float m_gridHeight;
|
||||
float m_gridIntHeightMultiplier;
|
||||
union{
|
||||
float *m_V9;
|
||||
uint16 *m_uint16_V9;
|
||||
uint8 *m_uint8_V9;
|
||||
};
|
||||
union{
|
||||
float *m_V8;
|
||||
uint16 *m_uint16_V8;
|
||||
uint8 *m_uint8_V8;
|
||||
};
|
||||
// Liquid data
|
||||
uint16 m_liquidType;
|
||||
uint8 m_liquid_offX;
|
||||
uint8 m_liquid_offY;
|
||||
uint8 m_liquid_width;
|
||||
uint8 m_liquid_height;
|
||||
float m_liquidLevel;
|
||||
uint8 *m_liquid_type;
|
||||
float *m_liquid_map;
|
||||
float _gridHeight;
|
||||
float _gridIntHeightMultiplier;
|
||||
|
||||
bool loadAreaData(FILE* in, uint32 offset, uint32 size);
|
||||
bool loadHeihgtData(FILE* in, uint32 offset, uint32 size);
|
||||
bool loadLiquidData(FILE* in, uint32 offset, uint32 size);
|
||||
// Area data
|
||||
uint16* _areaMap;
|
||||
|
||||
// Liquid data
|
||||
float _liquidLevel;
|
||||
uint8* _liquidType;
|
||||
float* _liquidMap;
|
||||
uint16 _gridArea;
|
||||
uint16 _liquidType;
|
||||
uint8 _liquidOffX;
|
||||
uint8 _liquidOffY;
|
||||
uint8 _liquidWidth;
|
||||
uint8 _liquidHeight;
|
||||
|
||||
|
||||
bool loadAreaData(FILE* in, uint32 offset, uint32 size);
|
||||
bool loadHeihgtData(FILE* in, uint32 offset, uint32 size);
|
||||
bool loadLiquidData(FILE* in, uint32 offset, uint32 size);
|
||||
|
||||
// Get height functions and pointers
|
||||
typedef float (GridMap::*pGetHeightPtr) (float x, float y) const;
|
||||
pGetHeightPtr m_gridGetHeight;
|
||||
float getHeightFromFloat(float x, float y) const;
|
||||
float getHeightFromUint16(float x, float y) const;
|
||||
float getHeightFromUint8(float x, float y) const;
|
||||
float getHeightFromFlat(float x, float y) const;
|
||||
typedef float (GridMap::*GetHeightPtr) (float x, float y) const;
|
||||
GetHeightPtr _gridGetHeight;
|
||||
float getHeightFromFloat(float x, float y) const;
|
||||
float getHeightFromUint16(float x, float y) const;
|
||||
float getHeightFromUint8(float x, float y) const;
|
||||
float getHeightFromFlat(float x, float y) const;
|
||||
|
||||
public:
|
||||
GridMap();
|
||||
~GridMap();
|
||||
bool loadData(char *filaname);
|
||||
void unloadData();
|
||||
bool loadData(char* filaname);
|
||||
void unloadData();
|
||||
|
||||
uint16 getArea(float x, float y);
|
||||
inline float getHeight(float x, float y) {return (this->*m_gridGetHeight)(x, y);}
|
||||
float getLiquidLevel(float x, float y);
|
||||
uint8 getTerrainType(float x, float y);
|
||||
inline float getHeight(float x, float y) {return (this->*_gridGetHeight)(x, y);}
|
||||
float getLiquidLevel(float x, float y);
|
||||
uint8 getTerrainType(float x, float y);
|
||||
ZLiquidStatus getLiquidStatus(float x, float y, float z, uint8 ReqLiquidType, LiquidData* data = 0);
|
||||
};
|
||||
|
||||
|
||||
@@ -53,9 +53,9 @@ void MotionMaster::Initialize()
|
||||
// set new default movement generator
|
||||
void MotionMaster::InitDefault()
|
||||
{
|
||||
if (i_owner->GetTypeId() == TYPEID_UNIT)
|
||||
if (_owner->GetTypeId() == TYPEID_UNIT)
|
||||
{
|
||||
MovementGenerator* movement = FactorySelector::selectMovementGenerator(i_owner->ToCreature());
|
||||
MovementGenerator* movement = FactorySelector::selectMovementGenerator(_owner->ToCreature());
|
||||
Mutate(movement == NULL ? &si_idleMovement : movement, MOTION_SLOT_IDLE);
|
||||
}
|
||||
else
|
||||
@@ -77,42 +77,42 @@ MotionMaster::~MotionMaster()
|
||||
|
||||
void MotionMaster::UpdateMotion(uint32 diff)
|
||||
{
|
||||
if (!i_owner)
|
||||
if (!_owner)
|
||||
return;
|
||||
|
||||
if (i_owner->HasUnitState(UNIT_STATE_ROOT | UNIT_STATE_STUNNED)) // what about UNIT_STATE_DISTRACTED? Why is this not included?
|
||||
if (_owner->HasUnitState(UNIT_STATE_ROOT | UNIT_STATE_STUNNED)) // what about UNIT_STATE_DISTRACTED? Why is this not included?
|
||||
return;
|
||||
|
||||
ASSERT(!empty());
|
||||
|
||||
m_cleanFlag |= MMCF_UPDATE;
|
||||
if (!top()->Update(*i_owner, diff))
|
||||
_cleanFlag |= MMCF_UPDATE;
|
||||
if (!top()->Update(*_owner, diff))
|
||||
{
|
||||
m_cleanFlag &= ~MMCF_UPDATE;
|
||||
_cleanFlag &= ~MMCF_UPDATE;
|
||||
MovementExpired();
|
||||
}
|
||||
else
|
||||
m_cleanFlag &= ~MMCF_UPDATE;
|
||||
_cleanFlag &= ~MMCF_UPDATE;
|
||||
|
||||
if (m_expList)
|
||||
if (_expList)
|
||||
{
|
||||
for (size_t i = 0; i < m_expList->size(); ++i)
|
||||
for (size_t i = 0; i < _expList->size(); ++i)
|
||||
{
|
||||
MovementGenerator* mg = (*m_expList)[i];
|
||||
MovementGenerator* mg = (*_expList)[i];
|
||||
DirectDelete(mg);
|
||||
}
|
||||
|
||||
delete m_expList;
|
||||
m_expList = NULL;
|
||||
delete _expList;
|
||||
_expList = NULL;
|
||||
|
||||
if (empty())
|
||||
Initialize();
|
||||
else if (needInitTop())
|
||||
InitTop();
|
||||
else if (m_cleanFlag & MMCF_RESET)
|
||||
top()->Reset(*i_owner);
|
||||
else if (_cleanFlag & MMCF_RESET)
|
||||
top()->Reset(*_owner);
|
||||
|
||||
m_cleanFlag &= ~MMCF_RESET;
|
||||
_cleanFlag &= ~MMCF_RESET;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -128,7 +128,7 @@ void MotionMaster::DirectClean(bool reset)
|
||||
if (needInitTop())
|
||||
InitTop();
|
||||
else if (reset)
|
||||
top()->Reset(*i_owner);
|
||||
top()->Reset(*_owner);
|
||||
}
|
||||
|
||||
void MotionMaster::DelayedClean()
|
||||
@@ -152,14 +152,14 @@ void MotionMaster::DirectExpire(bool reset)
|
||||
}
|
||||
|
||||
while (!top())
|
||||
--i_top;
|
||||
--_top;
|
||||
|
||||
if (empty())
|
||||
Initialize();
|
||||
else if (needInitTop())
|
||||
InitTop();
|
||||
else if (reset)
|
||||
top()->Reset(*i_owner);
|
||||
top()->Reset(*_owner);
|
||||
}
|
||||
|
||||
void MotionMaster::DelayedExpire()
|
||||
@@ -172,7 +172,7 @@ void MotionMaster::DelayedExpire()
|
||||
}
|
||||
|
||||
while (!top())
|
||||
--i_top;
|
||||
--_top;
|
||||
}
|
||||
|
||||
void MotionMaster::MoveIdle()
|
||||
@@ -184,9 +184,9 @@ void MotionMaster::MoveIdle()
|
||||
|
||||
void MotionMaster::MoveRandom(float spawndist)
|
||||
{
|
||||
if (i_owner->GetTypeId() == TYPEID_UNIT)
|
||||
if (_owner->GetTypeId() == TYPEID_UNIT)
|
||||
{
|
||||
sLog->outStaticDebug("Creature (GUID: %u) start moving random", i_owner->GetGUIDLow());
|
||||
sLog->outStaticDebug("Creature (GUID: %u) start moving random", _owner->GetGUIDLow());
|
||||
Mutate(new RandomMovementGenerator<Creature>(spawndist), MOTION_SLOT_IDLE);
|
||||
}
|
||||
}
|
||||
@@ -195,15 +195,15 @@ void MotionMaster::MoveTargetedHome()
|
||||
{
|
||||
Clear(false);
|
||||
|
||||
if (i_owner->GetTypeId()==TYPEID_UNIT && !((Creature*)i_owner)->GetCharmerOrOwnerGUID())
|
||||
if (_owner->GetTypeId()==TYPEID_UNIT && !((Creature*)_owner)->GetCharmerOrOwnerGUID())
|
||||
{
|
||||
sLog->outStaticDebug("Creature (Entry: %u GUID: %u) targeted home", i_owner->GetEntry(), i_owner->GetGUIDLow());
|
||||
sLog->outStaticDebug("Creature (Entry: %u GUID: %u) targeted home", _owner->GetEntry(), _owner->GetGUIDLow());
|
||||
Mutate(new HomeMovementGenerator<Creature>(), MOTION_SLOT_ACTIVE);
|
||||
}
|
||||
else if (i_owner->GetTypeId()==TYPEID_UNIT && ((Creature*)i_owner)->GetCharmerOrOwnerGUID())
|
||||
else if (_owner->GetTypeId()==TYPEID_UNIT && ((Creature*)_owner)->GetCharmerOrOwnerGUID())
|
||||
{
|
||||
sLog->outStaticDebug("Pet or controlled creature (Entry: %u GUID: %u) targeting home", i_owner->GetEntry(), i_owner->GetGUIDLow() );
|
||||
Unit *target = ((Creature*)i_owner)->GetCharmerOrOwner();
|
||||
sLog->outStaticDebug("Pet or controlled creature (Entry: %u GUID: %u) targeting home", _owner->GetEntry(), _owner->GetGUIDLow() );
|
||||
Unit *target = ((Creature*)_owner)->GetCharmerOrOwner();
|
||||
if (target)
|
||||
{
|
||||
sLog->outStaticDebug("Following %s (GUID: %u)", target->GetTypeId() == TYPEID_PLAYER ? "player" : "creature", target->GetTypeId() == TYPEID_PLAYER ? target->GetGUIDLow() : ((Creature*)target)->GetDBTableGUIDLow() );
|
||||
@@ -212,21 +212,21 @@ void MotionMaster::MoveTargetedHome()
|
||||
}
|
||||
else
|
||||
{
|
||||
sLog->outError("Player (GUID: %u) attempt targeted home", i_owner->GetGUIDLow());
|
||||
sLog->outError("Player (GUID: %u) attempt targeted home", _owner->GetGUIDLow());
|
||||
}
|
||||
}
|
||||
|
||||
void MotionMaster::MoveConfused()
|
||||
{
|
||||
if (i_owner->GetTypeId() == TYPEID_PLAYER)
|
||||
if (_owner->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
sLog->outStaticDebug("Player (GUID: %u) move confused", i_owner->GetGUIDLow());
|
||||
sLog->outStaticDebug("Player (GUID: %u) move confused", _owner->GetGUIDLow());
|
||||
Mutate(new ConfusedMovementGenerator<Player>(), MOTION_SLOT_CONTROLLED);
|
||||
}
|
||||
else
|
||||
{
|
||||
sLog->outStaticDebug("Creature (Entry: %u GUID: %u) move confused",
|
||||
i_owner->GetEntry(), i_owner->GetGUIDLow());
|
||||
_owner->GetEntry(), _owner->GetGUIDLow());
|
||||
Mutate(new ConfusedMovementGenerator<Creature>(), MOTION_SLOT_CONTROLLED);
|
||||
}
|
||||
}
|
||||
@@ -234,14 +234,14 @@ void MotionMaster::MoveConfused()
|
||||
void MotionMaster::MoveChase(Unit* target, float dist, float angle)
|
||||
{
|
||||
// ignore movement request if target not exist
|
||||
if (!target || target == i_owner || i_owner->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE))
|
||||
if (!target || target == _owner || _owner->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE))
|
||||
return;
|
||||
|
||||
//i_owner->ClearUnitState(UNIT_STATE_FOLLOW);
|
||||
if (i_owner->GetTypeId() == TYPEID_PLAYER)
|
||||
//_owner->ClearUnitState(UNIT_STATE_FOLLOW);
|
||||
if (_owner->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
sLog->outStaticDebug("Player (GUID: %u) chase to %s (GUID: %u)",
|
||||
i_owner->GetGUIDLow(),
|
||||
_owner->GetGUIDLow(),
|
||||
target->GetTypeId() == TYPEID_PLAYER ? "player" : "creature",
|
||||
target->GetTypeId() == TYPEID_PLAYER ? target->GetGUIDLow() : target->ToCreature()->GetDBTableGUIDLow());
|
||||
Mutate(new ChaseMovementGenerator<Player>(*target,dist,angle), MOTION_SLOT_ACTIVE);
|
||||
@@ -249,7 +249,7 @@ void MotionMaster::MoveChase(Unit* target, float dist, float angle)
|
||||
else
|
||||
{
|
||||
sLog->outStaticDebug("Creature (Entry: %u GUID: %u) chase to %s (GUID: %u)",
|
||||
i_owner->GetEntry(), i_owner->GetGUIDLow(),
|
||||
_owner->GetEntry(), _owner->GetGUIDLow(),
|
||||
target->GetTypeId() == TYPEID_PLAYER ? "player" : "creature",
|
||||
target->GetTypeId() == TYPEID_PLAYER ? target->GetGUIDLow() : target->ToCreature()->GetDBTableGUIDLow());
|
||||
Mutate(new ChaseMovementGenerator<Creature>(*target,dist,angle), MOTION_SLOT_ACTIVE);
|
||||
@@ -259,13 +259,13 @@ void MotionMaster::MoveChase(Unit* target, float dist, float angle)
|
||||
void MotionMaster::MoveFollow(Unit* target, float dist, float angle, MovementSlot slot)
|
||||
{
|
||||
// ignore movement request if target not exist
|
||||
if (!target || target == i_owner || i_owner->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE))
|
||||
if (!target || target == _owner || _owner->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE))
|
||||
return;
|
||||
|
||||
//i_owner->AddUnitState(UNIT_STATE_FOLLOW);
|
||||
if (i_owner->GetTypeId() == TYPEID_PLAYER)
|
||||
//_owner->AddUnitState(UNIT_STATE_FOLLOW);
|
||||
if (_owner->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
sLog->outStaticDebug("Player (GUID: %u) follow to %s (GUID: %u)", i_owner->GetGUIDLow(),
|
||||
sLog->outStaticDebug("Player (GUID: %u) follow to %s (GUID: %u)", _owner->GetGUIDLow(),
|
||||
target->GetTypeId() == TYPEID_PLAYER ? "player" : "creature",
|
||||
target->GetTypeId() == TYPEID_PLAYER ? target->GetGUIDLow() : target->ToCreature()->GetDBTableGUIDLow());
|
||||
Mutate(new FollowMovementGenerator<Player>(*target,dist,angle), slot);
|
||||
@@ -273,7 +273,7 @@ void MotionMaster::MoveFollow(Unit* target, float dist, float angle, MovementSlo
|
||||
else
|
||||
{
|
||||
sLog->outStaticDebug("Creature (Entry: %u GUID: %u) follow to %s (GUID: %u)",
|
||||
i_owner->GetEntry(), i_owner->GetGUIDLow(),
|
||||
_owner->GetEntry(), _owner->GetGUIDLow(),
|
||||
target->GetTypeId() == TYPEID_PLAYER ? "player" : "creature",
|
||||
target->GetTypeId() == TYPEID_PLAYER ? target->GetGUIDLow() : target->ToCreature()->GetDBTableGUIDLow());
|
||||
Mutate(new FollowMovementGenerator<Creature>(*target,dist,angle), slot);
|
||||
@@ -282,15 +282,15 @@ void MotionMaster::MoveFollow(Unit* target, float dist, float angle, MovementSlo
|
||||
|
||||
void MotionMaster::MovePoint(uint32 id, float x, float y, float z)
|
||||
{
|
||||
if (i_owner->GetTypeId() == TYPEID_PLAYER)
|
||||
if (_owner->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
sLog->outStaticDebug("Player (GUID: %u) targeted point (Id: %u X: %f Y: %f Z: %f)", i_owner->GetGUIDLow(), id, x, y, z);
|
||||
sLog->outStaticDebug("Player (GUID: %u) targeted point (Id: %u X: %f Y: %f Z: %f)", _owner->GetGUIDLow(), id, x, y, z);
|
||||
Mutate(new PointMovementGenerator<Player>(id, x, y, z), MOTION_SLOT_ACTIVE);
|
||||
}
|
||||
else
|
||||
{
|
||||
sLog->outStaticDebug("Creature (Entry: %u GUID: %u) targeted point (ID: %u X: %f Y: %f Z: %f)",
|
||||
i_owner->GetEntry(), i_owner->GetGUIDLow(), id, x, y, z);
|
||||
_owner->GetEntry(), _owner->GetGUIDLow(), id, x, y, z);
|
||||
Mutate(new PointMovementGenerator<Creature>(id, x, y, z), MOTION_SLOT_ACTIVE);
|
||||
}
|
||||
}
|
||||
@@ -300,9 +300,9 @@ void MotionMaster::MoveLand(uint32 id, Position const& pos, float speed)
|
||||
float x, y, z;
|
||||
pos.GetPosition(x, y, z);
|
||||
|
||||
sLog->outStaticDebug("Creature (Entry: %u) landing point (ID: %u X: %f Y: %f Z: %f)", i_owner->GetEntry(), id, x, y, z);
|
||||
sLog->outStaticDebug("Creature (Entry: %u) landing point (ID: %u X: %f Y: %f Z: %f)", _owner->GetEntry(), id, x, y, z);
|
||||
|
||||
Movement::MoveSplineInit init(*i_owner);
|
||||
Movement::MoveSplineInit init(*_owner);
|
||||
init.MoveTo(x,y,z);
|
||||
init.SetVelocity(speed);
|
||||
init.SetAnimation(Movement::ToGround);
|
||||
@@ -315,9 +315,9 @@ void MotionMaster::MoveTakeoff(uint32 id, Position const& pos, float speed)
|
||||
float x, y, z;
|
||||
pos.GetPosition(x, y, z);
|
||||
|
||||
sLog->outStaticDebug("Creature (Entry: %u) landing point (ID: %u X: %f Y: %f Z: %f)", i_owner->GetEntry(), id, x, y, z);
|
||||
sLog->outStaticDebug("Creature (Entry: %u) landing point (ID: %u X: %f Y: %f Z: %f)", _owner->GetEntry(), id, x, y, z);
|
||||
|
||||
Movement::MoveSplineInit init(*i_owner);
|
||||
Movement::MoveSplineInit init(*_owner);
|
||||
init.MoveTo(x,y,z);
|
||||
init.SetVelocity(speed);
|
||||
init.SetAnimation(Movement::ToFly);
|
||||
@@ -328,44 +328,44 @@ void MotionMaster::MoveTakeoff(uint32 id, Position const& pos, float speed)
|
||||
void MotionMaster::MoveKnockbackFrom(float srcX, float srcY, float speedXY, float speedZ)
|
||||
{
|
||||
//this function may make players fall below map
|
||||
if (i_owner->GetTypeId() == TYPEID_PLAYER)
|
||||
if (_owner->GetTypeId() == TYPEID_PLAYER)
|
||||
return;
|
||||
|
||||
float x, y, z;
|
||||
float moveTimeHalf = speedZ / Movement::gravity;
|
||||
float dist = 2 * moveTimeHalf * speedXY;
|
||||
|
||||
i_owner->GetNearPoint(i_owner, x, y, z, i_owner->GetObjectSize(), dist, i_owner->GetAngle(srcX, srcY) + M_PI);
|
||||
_owner->GetNearPoint(_owner, x, y, z, _owner->GetObjectSize(), dist, _owner->GetAngle(srcX, srcY) + M_PI);
|
||||
MoveJump(x, y, z, speedXY, speedZ);
|
||||
}
|
||||
|
||||
void MotionMaster::MoveJumpTo(float angle, float speedXY, float speedZ)
|
||||
{
|
||||
//this function may make players fall below map
|
||||
if (i_owner->GetTypeId() == TYPEID_PLAYER)
|
||||
if (_owner->GetTypeId() == TYPEID_PLAYER)
|
||||
return;
|
||||
|
||||
float x, y, z;
|
||||
|
||||
float moveTimeHalf = speedZ / Movement::gravity;
|
||||
float dist = 2 * moveTimeHalf * speedXY;
|
||||
i_owner->GetClosePoint(x, y, z, i_owner->GetObjectSize(), dist, angle);
|
||||
_owner->GetClosePoint(x, y, z, _owner->GetObjectSize(), dist, angle);
|
||||
MoveJump(x, y, z, speedXY, speedZ);
|
||||
}
|
||||
|
||||
void MotionMaster::MoveJump(float x, float y, float z, float speedXY, float speedZ, uint32 id)
|
||||
{
|
||||
sLog->outStaticDebug("Unit (GUID: %u) jump to point (X: %f Y: %f Z: %f)", i_owner->GetGUIDLow(), x, y, z);
|
||||
sLog->outStaticDebug("Unit (GUID: %u) jump to point (X: %f Y: %f Z: %f)", _owner->GetGUIDLow(), x, y, z);
|
||||
|
||||
float moveTimeHalf = speedZ / Movement::gravity;
|
||||
float max_height = -Movement::computeFallElevation(moveTimeHalf,false,-speedZ);
|
||||
|
||||
Movement::MoveSplineInit init(*i_owner);
|
||||
Movement::MoveSplineInit init(*_owner);
|
||||
init.MoveTo(x,y,z);
|
||||
init.SetParabolic(max_height,0);
|
||||
init.SetVelocity(speedXY);
|
||||
init.Launch();
|
||||
if (i_owner->GetTypeId() == TYPEID_PLAYER)
|
||||
if (_owner->GetTypeId() == TYPEID_PLAYER)
|
||||
Mutate(new EffectMovementGenerator(id), MOTION_SLOT_CONTROLLED);
|
||||
else
|
||||
Mutate(new EffectMovementGenerator(id), MOTION_SLOT_ACTIVE);
|
||||
@@ -374,20 +374,20 @@ void MotionMaster::MoveJump(float x, float y, float z, float speedXY, float spee
|
||||
void MotionMaster::MoveFall(uint32 id/*=0*/)
|
||||
{
|
||||
// use larger distance for vmap height search than in most other cases
|
||||
float tz = i_owner->GetMap()->GetHeight(i_owner->GetPhaseMask(), i_owner->GetPositionX(), i_owner->GetPositionY(), i_owner->GetPositionZ(), true, MAX_FALL_DISTANCE);
|
||||
float tz = _owner->GetMap()->GetHeight(_owner->GetPhaseMask(), _owner->GetPositionX(), _owner->GetPositionY(), _owner->GetPositionZ(), true, MAX_FALL_DISTANCE);
|
||||
if (tz <= INVALID_HEIGHT)
|
||||
{
|
||||
sLog->outStaticDebug("MotionMaster::MoveFall: unable retrive a proper height at map %u (x: %f, y: %f, z: %f).",
|
||||
i_owner->GetMap()->GetId(), i_owner->GetPositionX(), i_owner->GetPositionX(), i_owner->GetPositionZ());
|
||||
_owner->GetMap()->GetId(), _owner->GetPositionX(), _owner->GetPositionX(), _owner->GetPositionZ());
|
||||
return;
|
||||
}
|
||||
|
||||
// Abort too if the ground is very near
|
||||
if (fabs(i_owner->GetPositionZ() - tz) < 0.1f)
|
||||
if (fabs(_owner->GetPositionZ() - tz) < 0.1f)
|
||||
return;
|
||||
|
||||
Movement::MoveSplineInit init(*i_owner);
|
||||
init.MoveTo(i_owner->GetPositionX(), i_owner->GetPositionY(), tz);
|
||||
Movement::MoveSplineInit init(*_owner);
|
||||
init.MoveTo(_owner->GetPositionX(), _owner->GetPositionY(), tz);
|
||||
init.SetFall();
|
||||
init.Launch();
|
||||
Mutate(new EffectMovementGenerator(id), MOTION_SLOT_CONTROLLED);
|
||||
@@ -398,45 +398,45 @@ void MotionMaster::MoveCharge(float x, float y, float z, float speed, uint32 id)
|
||||
if (Impl[MOTION_SLOT_CONTROLLED] && Impl[MOTION_SLOT_CONTROLLED]->GetMovementGeneratorType() != DISTRACT_MOTION_TYPE)
|
||||
return;
|
||||
|
||||
if (i_owner->GetTypeId() == TYPEID_PLAYER)
|
||||
if (_owner->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
sLog->outStaticDebug("Player (GUID: %u) charge point (X: %f Y: %f Z: %f)", i_owner->GetGUIDLow(), x, y, z);
|
||||
sLog->outStaticDebug("Player (GUID: %u) charge point (X: %f Y: %f Z: %f)", _owner->GetGUIDLow(), x, y, z);
|
||||
Mutate(new PointMovementGenerator<Player>(id, x, y, z, speed), MOTION_SLOT_CONTROLLED);
|
||||
}
|
||||
else
|
||||
{
|
||||
sLog->outStaticDebug("Creature (Entry: %u GUID: %u) charge point (X: %f Y: %f Z: %f)",
|
||||
i_owner->GetEntry(), i_owner->GetGUIDLow(), x, y, z);
|
||||
_owner->GetEntry(), _owner->GetGUIDLow(), x, y, z);
|
||||
Mutate(new PointMovementGenerator<Creature>(id, x, y, z, speed), MOTION_SLOT_CONTROLLED);
|
||||
}
|
||||
}
|
||||
|
||||
void MotionMaster::MoveSeekAssistance(float x, float y, float z)
|
||||
{
|
||||
if (i_owner->GetTypeId() == TYPEID_PLAYER)
|
||||
if (_owner->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
sLog->outError("Player (GUID: %u) attempt to seek assistance", i_owner->GetGUIDLow());
|
||||
sLog->outError("Player (GUID: %u) attempt to seek assistance", _owner->GetGUIDLow());
|
||||
}
|
||||
else
|
||||
{
|
||||
sLog->outStaticDebug("Creature (Entry: %u GUID: %u) seek assistance (X: %f Y: %f Z: %f)",
|
||||
i_owner->GetEntry(), i_owner->GetGUIDLow(), x, y, z);
|
||||
i_owner->AttackStop();
|
||||
i_owner->ToCreature()->SetReactState(REACT_PASSIVE);
|
||||
_owner->GetEntry(), _owner->GetGUIDLow(), x, y, z);
|
||||
_owner->AttackStop();
|
||||
_owner->ToCreature()->SetReactState(REACT_PASSIVE);
|
||||
Mutate(new AssistanceMovementGenerator(x, y, z), MOTION_SLOT_ACTIVE);
|
||||
}
|
||||
}
|
||||
|
||||
void MotionMaster::MoveSeekAssistanceDistract(uint32 time)
|
||||
{
|
||||
if (i_owner->GetTypeId() == TYPEID_PLAYER)
|
||||
if (_owner->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
sLog->outError("Player (GUID: %u) attempt to call distract after assistance", i_owner->GetGUIDLow());
|
||||
sLog->outError("Player (GUID: %u) attempt to call distract after assistance", _owner->GetGUIDLow());
|
||||
}
|
||||
else
|
||||
{
|
||||
sLog->outStaticDebug("Creature (Entry: %u GUID: %u) is distracted after assistance call (Time: %u)",
|
||||
i_owner->GetEntry(), i_owner->GetGUIDLow(), time);
|
||||
_owner->GetEntry(), _owner->GetGUIDLow(), time);
|
||||
Mutate(new AssistanceDistractMovementGenerator(time), MOTION_SLOT_ACTIVE);
|
||||
}
|
||||
}
|
||||
@@ -446,12 +446,12 @@ void MotionMaster::MoveFleeing(Unit* enemy, uint32 time)
|
||||
if (!enemy)
|
||||
return;
|
||||
|
||||
if (i_owner->HasAuraType(SPELL_AURA_PREVENTS_FLEEING))
|
||||
if (_owner->HasAuraType(SPELL_AURA_PREVENTS_FLEEING))
|
||||
return;
|
||||
|
||||
if (i_owner->GetTypeId() == TYPEID_PLAYER)
|
||||
if (_owner->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
sLog->outStaticDebug("Player (GUID: %u) flee from %s (GUID: %u)", i_owner->GetGUIDLow(),
|
||||
sLog->outStaticDebug("Player (GUID: %u) flee from %s (GUID: %u)", _owner->GetGUIDLow(),
|
||||
enemy->GetTypeId() == TYPEID_PLAYER ? "player" : "creature",
|
||||
enemy->GetTypeId() == TYPEID_PLAYER ? enemy->GetGUIDLow() : enemy->ToCreature()->GetDBTableGUIDLow());
|
||||
Mutate(new FleeingMovementGenerator<Player>(enemy->GetGUID()), MOTION_SLOT_CONTROLLED);
|
||||
@@ -459,7 +459,7 @@ void MotionMaster::MoveFleeing(Unit* enemy, uint32 time)
|
||||
else
|
||||
{
|
||||
sLog->outStaticDebug("Creature (Entry: %u GUID: %u) flee from %s (GUID: %u)%s",
|
||||
i_owner->GetEntry(), i_owner->GetGUIDLow(),
|
||||
_owner->GetEntry(), _owner->GetGUIDLow(),
|
||||
enemy->GetTypeId() == TYPEID_PLAYER ? "player" : "creature",
|
||||
enemy->GetTypeId() == TYPEID_PLAYER ? enemy->GetGUIDLow() : enemy->ToCreature()->GetDBTableGUIDLow(),
|
||||
time ? " for a limited time" : "");
|
||||
@@ -472,24 +472,24 @@ void MotionMaster::MoveFleeing(Unit* enemy, uint32 time)
|
||||
|
||||
void MotionMaster::MoveTaxiFlight(uint32 path, uint32 pathnode)
|
||||
{
|
||||
if (i_owner->GetTypeId() == TYPEID_PLAYER)
|
||||
if (_owner->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
if (path < sTaxiPathNodesByPath.size())
|
||||
{
|
||||
sLog->outStaticDebug("%s taxi to (Path %u node %u)", i_owner->GetName(), path, pathnode);
|
||||
sLog->outStaticDebug("%s taxi to (Path %u node %u)", _owner->GetName(), path, pathnode);
|
||||
FlightPathMovementGenerator* mgen = new FlightPathMovementGenerator(sTaxiPathNodesByPath[path], pathnode);
|
||||
Mutate(mgen, MOTION_SLOT_CONTROLLED);
|
||||
}
|
||||
else
|
||||
{
|
||||
sLog->outError("%s attempt taxi to (not existed Path %u node %u)",
|
||||
i_owner->GetName(), path, pathnode);
|
||||
_owner->GetName(), path, pathnode);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sLog->outError("Creature (Entry: %u GUID: %u) attempt taxi to (Path %u node %u)",
|
||||
i_owner->GetEntry(), i_owner->GetGUIDLow(), path, pathnode);
|
||||
_owner->GetEntry(), _owner->GetGUIDLow(), path, pathnode);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -498,14 +498,14 @@ void MotionMaster::MoveDistract(uint32 timer)
|
||||
if (Impl[MOTION_SLOT_CONTROLLED])
|
||||
return;
|
||||
|
||||
if (i_owner->GetTypeId() == TYPEID_PLAYER)
|
||||
if (_owner->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
sLog->outStaticDebug("Player (GUID: %u) distracted (timer: %u)", i_owner->GetGUIDLow(), timer);
|
||||
sLog->outStaticDebug("Player (GUID: %u) distracted (timer: %u)", _owner->GetGUIDLow(), timer);
|
||||
}
|
||||
else
|
||||
{
|
||||
sLog->outStaticDebug("Creature (Entry: %u GUID: %u) (timer: %u)",
|
||||
i_owner->GetEntry(), i_owner->GetGUIDLow(), timer);
|
||||
_owner->GetEntry(), _owner->GetGUIDLow(), timer);
|
||||
}
|
||||
|
||||
DistractMovementGenerator* mgen = new DistractMovementGenerator(timer);
|
||||
@@ -517,23 +517,23 @@ void MotionMaster::Mutate(MovementGenerator *m, MovementSlot slot)
|
||||
if (MovementGenerator *curr = Impl[slot])
|
||||
{
|
||||
Impl[slot] = NULL; // in case a new one is generated in this slot during directdelete
|
||||
if (i_top == slot && (m_cleanFlag & MMCF_UPDATE))
|
||||
if (_top == slot && (_cleanFlag & MMCF_UPDATE))
|
||||
DelayedDelete(curr);
|
||||
else
|
||||
DirectDelete(curr);
|
||||
}
|
||||
else if (i_top < slot)
|
||||
else if (_top < slot)
|
||||
{
|
||||
i_top = slot;
|
||||
_top = slot;
|
||||
}
|
||||
|
||||
Impl[slot] = m;
|
||||
if (i_top > slot)
|
||||
needInit[slot] = true;
|
||||
if (_top > slot)
|
||||
_needInit[slot] = true;
|
||||
else
|
||||
{
|
||||
needInit[slot] = false;
|
||||
m->Initialize(*i_owner);
|
||||
_needInit[slot] = false;
|
||||
m->Initialize(*_owner);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -546,19 +546,19 @@ void MotionMaster::MovePath(uint32 path_id, bool repeatable)
|
||||
/*while (!empty())
|
||||
{
|
||||
MovementGenerator *curr = top();
|
||||
curr->Finalize(*i_owner);
|
||||
curr->Finalize(*_owner);
|
||||
pop();
|
||||
if (!isStatic(curr))
|
||||
delete curr;
|
||||
}*/
|
||||
|
||||
//i_owner->GetTypeId() == TYPEID_PLAYER ?
|
||||
//_owner->GetTypeId() == TYPEID_PLAYER ?
|
||||
//Mutate(new WaypointMovementGenerator<Player>(path_id, repeatable)):
|
||||
Mutate(new WaypointMovementGenerator<Creature>(path_id, repeatable), MOTION_SLOT_IDLE);
|
||||
|
||||
sLog->outStaticDebug("%s (GUID: %u) start moving over path(Id:%u, repeatable: %s)",
|
||||
i_owner->GetTypeId() == TYPEID_PLAYER ? "Player" : "Creature",
|
||||
i_owner->GetGUIDLow(), path_id, repeatable ? "YES" : "NO");
|
||||
_owner->GetTypeId() == TYPEID_PLAYER ? "Player" : "Creature",
|
||||
_owner->GetGUIDLow(), path_id, repeatable ? "YES" : "NO");
|
||||
}
|
||||
|
||||
void MotionMaster::MoveRotate(uint32 time, RotateDirection direction)
|
||||
@@ -576,7 +576,7 @@ void MotionMaster::propagateSpeedChange()
|
||||
{
|
||||
(*it)->unitSpeedChanged();
|
||||
}*/
|
||||
for (int i = 0; i <= i_top; ++i)
|
||||
for (int i = 0; i <= _top; ++i)
|
||||
{
|
||||
if (Impl[i])
|
||||
Impl[i]->unitSpeedChanged();
|
||||
@@ -601,34 +601,34 @@ MovementGeneratorType MotionMaster::GetMotionSlotType(int slot) const
|
||||
|
||||
void MotionMaster::InitTop()
|
||||
{
|
||||
top()->Initialize(*i_owner);
|
||||
needInit[i_top] = false;
|
||||
top()->Initialize(*_owner);
|
||||
_needInit[_top] = false;
|
||||
}
|
||||
|
||||
void MotionMaster::DirectDelete(_Ty curr)
|
||||
{
|
||||
if (isStatic(curr))
|
||||
return;
|
||||
curr->Finalize(*i_owner);
|
||||
curr->Finalize(*_owner);
|
||||
delete curr;
|
||||
}
|
||||
|
||||
void MotionMaster::DelayedDelete(_Ty curr)
|
||||
{
|
||||
sLog->outCrash("Unit (Entry %u) is trying to delete its updating MG (Type %u)!", i_owner->GetEntry(), curr->GetMovementGeneratorType());
|
||||
sLog->outCrash("Unit (Entry %u) is trying to delete its updating MG (Type %u)!", _owner->GetEntry(), curr->GetMovementGeneratorType());
|
||||
if (isStatic(curr))
|
||||
return;
|
||||
if (!m_expList)
|
||||
m_expList = new ExpireList();
|
||||
m_expList->push_back(curr);
|
||||
if (!_expList)
|
||||
_expList = new ExpireList();
|
||||
_expList->push_back(curr);
|
||||
}
|
||||
|
||||
bool MotionMaster::GetDestination(float &x, float &y, float &z)
|
||||
{
|
||||
if (i_owner->movespline->Finalized())
|
||||
if (_owner->movespline->Finalized())
|
||||
return false;
|
||||
|
||||
const G3D::Vector3& dest = i_owner->movespline->FinalDestination();
|
||||
const G3D::Vector3& dest = _owner->movespline->FinalDestination();
|
||||
x = dest.x;
|
||||
y = dest.y;
|
||||
z = dest.z;
|
||||
|
||||
@@ -82,25 +82,21 @@ class MotionMaster //: private std::stack<MovementGenerator *>
|
||||
{
|
||||
private:
|
||||
//typedef std::stack<MovementGenerator *> Impl;
|
||||
typedef MovementGenerator* _Ty;
|
||||
_Ty Impl[MAX_MOTION_SLOT];
|
||||
bool needInit[MAX_MOTION_SLOT];
|
||||
typedef std::vector<_Ty> ExpireList;
|
||||
int i_top;
|
||||
|
||||
void pop() { Impl[i_top] = NULL; --i_top; }
|
||||
void push(_Ty _Val) { ++i_top; Impl[i_top] = _Val; }
|
||||
void pop() { Impl[_top] = NULL; --_top; }
|
||||
void push(_Ty _Val) { ++_top; Impl[_top] = _Val; }
|
||||
|
||||
bool needInitTop() const { return needInit[i_top]; }
|
||||
bool needInitTop() const { return _needInit[_top]; }
|
||||
void InitTop();
|
||||
public:
|
||||
|
||||
explicit MotionMaster(Unit* unit) : i_top(-1), i_owner(unit), m_expList(NULL), m_cleanFlag(MMCF_NONE)
|
||||
explicit MotionMaster(Unit* unit) : _top(-1), _owner(unit), _expList(NULL), _cleanFlag(MMCF_NONE)
|
||||
{
|
||||
for (uint8 i = 0; i < MAX_MOTION_SLOT; ++i)
|
||||
{
|
||||
Impl[i] = NULL;
|
||||
needInit[i] = true;
|
||||
_needInit[i] = true;
|
||||
}
|
||||
}
|
||||
~MotionMaster();
|
||||
@@ -108,9 +104,9 @@ class MotionMaster //: private std::stack<MovementGenerator *>
|
||||
void Initialize();
|
||||
void InitDefault();
|
||||
|
||||
bool empty() const { return (i_top < 0); }
|
||||
int size() const { return i_top + 1; }
|
||||
_Ty top() const { return Impl[i_top]; }
|
||||
bool empty() const { return (_top < 0); }
|
||||
int size() const { return _top + 1; }
|
||||
_Ty top() const { return Impl[_top]; }
|
||||
_Ty GetMotionSlot(int slot) const { return Impl[slot]; }
|
||||
|
||||
void DirectDelete(_Ty curr);
|
||||
@@ -119,12 +115,12 @@ class MotionMaster //: private std::stack<MovementGenerator *>
|
||||
void UpdateMotion(uint32 diff);
|
||||
void Clear(bool reset = true)
|
||||
{
|
||||
if (m_cleanFlag & MMCF_UPDATE)
|
||||
if (_cleanFlag & MMCF_UPDATE)
|
||||
{
|
||||
if (reset)
|
||||
m_cleanFlag |= MMCF_RESET;
|
||||
_cleanFlag |= MMCF_RESET;
|
||||
else
|
||||
m_cleanFlag &= ~MMCF_RESET;
|
||||
_cleanFlag &= ~MMCF_RESET;
|
||||
DelayedClean();
|
||||
}
|
||||
else
|
||||
@@ -132,12 +128,12 @@ class MotionMaster //: private std::stack<MovementGenerator *>
|
||||
}
|
||||
void MovementExpired(bool reset = true)
|
||||
{
|
||||
if (m_cleanFlag & MMCF_UPDATE)
|
||||
if (_cleanFlag & MMCF_UPDATE)
|
||||
{
|
||||
if (reset)
|
||||
m_cleanFlag |= MMCF_RESET;
|
||||
_cleanFlag |= MMCF_RESET;
|
||||
else
|
||||
m_cleanFlag &= ~MMCF_RESET;
|
||||
_cleanFlag &= ~MMCF_RESET;
|
||||
DelayedExpire();
|
||||
}
|
||||
else
|
||||
@@ -187,9 +183,13 @@ class MotionMaster //: private std::stack<MovementGenerator *>
|
||||
void DirectExpire(bool reset);
|
||||
void DelayedExpire();
|
||||
|
||||
Unit *i_owner;
|
||||
ExpireList* m_expList;
|
||||
uint8 m_cleanFlag;
|
||||
ExpireList* _expList;
|
||||
typedef MovementGenerator* _Ty;
|
||||
_Ty Impl[MAX_MOTION_SLOT];
|
||||
int _top;
|
||||
Unit* _owner;
|
||||
bool _needInit[MAX_MOTION_SLOT];
|
||||
uint8 _cleanFlag;
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
@@ -360,17 +360,17 @@ class Quest
|
||||
|
||||
struct QuestStatusData
|
||||
{
|
||||
QuestStatusData(): m_status(QUEST_STATUS_NONE), m_explored(false), m_timer(0), m_playercount(0)
|
||||
QuestStatusData(): Status(QUEST_STATUS_NONE), Explored(false), Timer(0), PlayerCount(0)
|
||||
{
|
||||
memset(m_itemcount, 0, QUEST_ITEM_OBJECTIVES_COUNT * sizeof(uint16));
|
||||
memset(m_creatureOrGOcount, 0, QUEST_OBJECTIVES_COUNT * sizeof(uint16));
|
||||
memset(ItemCount, 0, QUEST_ITEM_OBJECTIVES_COUNT * sizeof(uint16));
|
||||
memset(CreatureOrGOCount, 0, QUEST_OBJECTIVES_COUNT * sizeof(uint16));
|
||||
}
|
||||
|
||||
QuestStatus m_status;
|
||||
bool m_explored;
|
||||
uint32 m_timer;
|
||||
uint16 m_itemcount[QUEST_ITEM_OBJECTIVES_COUNT];
|
||||
uint16 m_creatureOrGOcount[QUEST_OBJECTIVES_COUNT];
|
||||
uint16 m_playercount;
|
||||
QuestStatus Status;
|
||||
uint32 Timer;
|
||||
uint16 ItemCount[QUEST_ITEM_OBJECTIVES_COUNT];
|
||||
uint16 CreatureOrGOCount[QUEST_OBJECTIVES_COUNT];
|
||||
uint16 PlayerCount;
|
||||
bool Explored;
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -45,7 +45,7 @@ bool ReputationMgr::IsAtWar(uint32 faction_id) const
|
||||
|
||||
if (!factionEntry)
|
||||
{
|
||||
sLog->outError("ReputationMgr::IsAtWar: Can't get AtWar flag of %s for unknown faction (faction id) #%u.", m_player->GetName(), faction_id);
|
||||
sLog->outError("ReputationMgr::IsAtWar: Can't get AtWar flag of %s for unknown faction (faction id) #%u.", _player->GetName(), faction_id);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ int32 ReputationMgr::GetReputation(uint32 faction_id) const
|
||||
|
||||
if (!factionEntry)
|
||||
{
|
||||
sLog->outError("ReputationMgr::GetReputation: Can't get reputation of %s for unknown faction (faction id) #%u.", m_player->GetName(), faction_id);
|
||||
sLog->outError("ReputationMgr::GetReputation: Can't get reputation of %s for unknown faction (faction id) #%u.", _player->GetName(), faction_id);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -80,8 +80,8 @@ int32 ReputationMgr::GetBaseReputation(FactionEntry const* factionEntry) const
|
||||
if (!factionEntry)
|
||||
return 0;
|
||||
|
||||
uint32 raceMask = m_player->getRaceMask();
|
||||
uint32 classMask = m_player->getClassMask();
|
||||
uint32 raceMask = _player->getRaceMask();
|
||||
uint32 classMask = _player->getClassMask();
|
||||
for (int i=0; i < 4; i++)
|
||||
{
|
||||
if ((factionEntry->BaseRepRaceMask[i] & raceMask ||
|
||||
@@ -124,9 +124,9 @@ ReputationRank ReputationMgr::GetBaseRank(FactionEntry const* factionEntry) cons
|
||||
void ReputationMgr::ApplyForceReaction(uint32 faction_id, ReputationRank rank, bool apply)
|
||||
{
|
||||
if (apply)
|
||||
m_forcedReactions[faction_id] = rank;
|
||||
_forcedReactions[faction_id] = rank;
|
||||
else
|
||||
m_forcedReactions.erase(faction_id);
|
||||
_forcedReactions.erase(faction_id);
|
||||
}
|
||||
|
||||
uint32 ReputationMgr::GetDefaultStateFlags(FactionEntry const* factionEntry) const
|
||||
@@ -134,8 +134,8 @@ uint32 ReputationMgr::GetDefaultStateFlags(FactionEntry const* factionEntry) con
|
||||
if (!factionEntry)
|
||||
return 0;
|
||||
|
||||
uint32 raceMask = m_player->getRaceMask();
|
||||
uint32 classMask = m_player->getClassMask();
|
||||
uint32 raceMask = _player->getRaceMask();
|
||||
uint32 classMask = _player->getClassMask();
|
||||
for (int i=0; i < 4; i++)
|
||||
{
|
||||
if ((factionEntry->BaseRepRaceMask[i] & raceMask ||
|
||||
@@ -152,14 +152,14 @@ uint32 ReputationMgr::GetDefaultStateFlags(FactionEntry const* factionEntry) con
|
||||
void ReputationMgr::SendForceReactions()
|
||||
{
|
||||
WorldPacket data;
|
||||
data.Initialize(SMSG_SET_FORCED_REACTIONS, 4+m_forcedReactions.size()*(4+4));
|
||||
data << uint32(m_forcedReactions.size());
|
||||
for (ForcedReactions::const_iterator itr = m_forcedReactions.begin(); itr != m_forcedReactions.end(); ++itr)
|
||||
data.Initialize(SMSG_SET_FORCED_REACTIONS, 4+_forcedReactions.size()*(4+4));
|
||||
data << uint32(_forcedReactions.size());
|
||||
for (ForcedReactions::const_iterator itr = _forcedReactions.begin(); itr != _forcedReactions.end(); ++itr)
|
||||
{
|
||||
data << uint32(itr->first); // faction_id (Faction.dbc)
|
||||
data << uint32(itr->second); // reputation rank
|
||||
}
|
||||
m_player->SendDirectMessage(&data);
|
||||
_player->SendDirectMessage(&data);
|
||||
}
|
||||
|
||||
void ReputationMgr::SendState(FactionState const* faction)
|
||||
@@ -176,7 +176,7 @@ void ReputationMgr::SendState(FactionState const* faction)
|
||||
data << (uint32) faction->ReputationListID;
|
||||
data << (uint32) faction->Standing;
|
||||
|
||||
for (FactionStateList::iterator itr = m_factions.begin(); itr != m_factions.end(); ++itr)
|
||||
for (FactionStateList::iterator itr = _factions.begin(); itr != _factions.end(); ++itr)
|
||||
{
|
||||
if (itr->second.needSend)
|
||||
{
|
||||
@@ -191,7 +191,7 @@ void ReputationMgr::SendState(FactionState const* faction)
|
||||
}
|
||||
|
||||
data.put<uint32>(p_count, count);
|
||||
m_player->SendDirectMessage(&data);
|
||||
_player->SendDirectMessage(&data);
|
||||
}
|
||||
|
||||
void ReputationMgr::SendInitialReputations()
|
||||
@@ -201,7 +201,7 @@ void ReputationMgr::SendInitialReputations()
|
||||
|
||||
RepListID a = 0;
|
||||
|
||||
for (FactionStateList::iterator itr = m_factions.begin(); itr != m_factions.end(); ++itr)
|
||||
for (FactionStateList::iterator itr = _factions.begin(); itr != _factions.end(); ++itr)
|
||||
{
|
||||
// fill in absent fields
|
||||
for (; a != itr->first; a++)
|
||||
@@ -226,33 +226,33 @@ void ReputationMgr::SendInitialReputations()
|
||||
data << uint32 (0x00000000);
|
||||
}
|
||||
|
||||
m_player->SendDirectMessage(&data);
|
||||
_player->SendDirectMessage(&data);
|
||||
}
|
||||
|
||||
void ReputationMgr::SendStates()
|
||||
{
|
||||
for (FactionStateList::iterator itr = m_factions.begin(); itr != m_factions.end(); ++itr)
|
||||
for (FactionStateList::iterator itr = _factions.begin(); itr != _factions.end(); ++itr)
|
||||
SendState(&(itr->second));
|
||||
}
|
||||
|
||||
void ReputationMgr::SendVisible(FactionState const* faction) const
|
||||
{
|
||||
if (m_player->GetSession()->PlayerLoading())
|
||||
if (_player->GetSession()->PlayerLoading())
|
||||
return;
|
||||
|
||||
// make faction visible in reputation list at client
|
||||
WorldPacket data(SMSG_SET_FACTION_VISIBLE, 4);
|
||||
data << faction->ReputationListID;
|
||||
m_player->SendDirectMessage(&data);
|
||||
_player->SendDirectMessage(&data);
|
||||
}
|
||||
|
||||
void ReputationMgr::Initialize()
|
||||
{
|
||||
m_factions.clear();
|
||||
m_visibleFactionCount = 0;
|
||||
m_honoredFactionCount = 0;
|
||||
m_reveredFactionCount = 0;
|
||||
m_exaltedFactionCount = 0;
|
||||
_factions.clear();
|
||||
_visibleFactionCount = 0;
|
||||
_honoredFactionCount = 0;
|
||||
_reveredFactionCount = 0;
|
||||
_exaltedFactionCount = 0;
|
||||
|
||||
for (unsigned int i = 1; i < sFactionStore.GetNumRows(); i++)
|
||||
{
|
||||
@@ -269,18 +269,18 @@ void ReputationMgr::Initialize()
|
||||
newFaction.needSave = true;
|
||||
|
||||
if (newFaction.Flags & FACTION_FLAG_VISIBLE)
|
||||
++m_visibleFactionCount;
|
||||
++_visibleFactionCount;
|
||||
|
||||
UpdateRankCounters(REP_HOSTILE, GetBaseRank(factionEntry));
|
||||
|
||||
m_factions[newFaction.ReputationListID] = newFaction;
|
||||
_factions[newFaction.ReputationListID] = newFaction;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool ReputationMgr::SetReputation(FactionEntry const* factionEntry, int32 standing, bool incremental)
|
||||
{
|
||||
sScriptMgr->OnPlayerReputationChange(m_player, factionEntry->ID, standing, incremental);
|
||||
sScriptMgr->OnPlayerReputationChange(_player, factionEntry->ID, standing, incremental);
|
||||
bool res = false;
|
||||
// if spillover definition exists in DB, override DBC
|
||||
if (const RepSpilloverTemplate* repTemplate = sObjectMgr->GetRepSpilloverTemplate(factionEntry->ID))
|
||||
@@ -289,7 +289,7 @@ bool ReputationMgr::SetReputation(FactionEntry const* factionEntry, int32 standi
|
||||
{
|
||||
if (repTemplate->faction[i])
|
||||
{
|
||||
if (m_player->GetReputationRank(repTemplate->faction[i]) <= ReputationRank(repTemplate->faction_rank[i]))
|
||||
if (_player->GetReputationRank(repTemplate->faction[i]) <= ReputationRank(repTemplate->faction_rank[i]))
|
||||
{
|
||||
// bonuses are already given, so just modify standing by rate
|
||||
int32 spilloverRep = int32(standing * repTemplate->faction_rate[i]);
|
||||
@@ -309,9 +309,9 @@ bool ReputationMgr::SetReputation(FactionEntry const* factionEntry, int32 standi
|
||||
spillOverRepOut *= factionEntry->spilloverRateOut;
|
||||
if (FactionEntry const* parent = sFactionStore.LookupEntry(factionEntry->team))
|
||||
{
|
||||
FactionStateList::iterator parentState = m_factions.find(parent->reputationListID);
|
||||
FactionStateList::iterator parentState = _factions.find(parent->reputationListID);
|
||||
// some team factions have own reputation standing, in this case do not spill to other sub-factions
|
||||
if (parentState != m_factions.end() && (parentState->second.Flags & FACTION_FLAG_SPECIAL))
|
||||
if (parentState != _factions.end() && (parentState->second.Flags & FACTION_FLAG_SPECIAL))
|
||||
{
|
||||
SetOneFactionReputation(parent, int32(spillOverRepOut), incremental);
|
||||
}
|
||||
@@ -338,8 +338,8 @@ bool ReputationMgr::SetReputation(FactionEntry const* factionEntry, int32 standi
|
||||
}
|
||||
}
|
||||
// spillover done, update faction itself
|
||||
FactionStateList::iterator faction = m_factions.find(factionEntry->reputationListID);
|
||||
if (faction != m_factions.end())
|
||||
FactionStateList::iterator faction = _factions.find(factionEntry->reputationListID);
|
||||
if (faction != _factions.end())
|
||||
{
|
||||
res = SetOneFactionReputation(factionEntry, standing, incremental);
|
||||
// only this faction gets reported to client, even if it has no own visible standing
|
||||
@@ -350,8 +350,8 @@ bool ReputationMgr::SetReputation(FactionEntry const* factionEntry, int32 standi
|
||||
|
||||
bool ReputationMgr::SetOneFactionReputation(FactionEntry const* factionEntry, int32 standing, bool incremental)
|
||||
{
|
||||
FactionStateList::iterator itr = m_factions.find(factionEntry->reputationListID);
|
||||
if (itr != m_factions.end())
|
||||
FactionStateList::iterator itr = _factions.find(factionEntry->reputationListID);
|
||||
if (itr != _factions.end())
|
||||
{
|
||||
int32 BaseRep = GetBaseReputation(factionEntry);
|
||||
|
||||
@@ -381,12 +381,12 @@ bool ReputationMgr::SetOneFactionReputation(FactionEntry const* factionEntry, in
|
||||
|
||||
UpdateRankCounters(old_rank, new_rank);
|
||||
|
||||
m_player->ReputationChanged(factionEntry);
|
||||
m_player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_KNOWN_FACTIONS, factionEntry->ID);
|
||||
m_player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GAIN_REPUTATION, factionEntry->ID);
|
||||
m_player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GAIN_EXALTED_REPUTATION, factionEntry->ID);
|
||||
m_player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GAIN_REVERED_REPUTATION, factionEntry->ID);
|
||||
m_player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GAIN_HONORED_REPUTATION, factionEntry->ID);
|
||||
_player->ReputationChanged(factionEntry);
|
||||
_player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_KNOWN_FACTIONS, factionEntry->ID);
|
||||
_player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GAIN_REPUTATION, factionEntry->ID);
|
||||
_player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GAIN_EXALTED_REPUTATION, factionEntry->ID);
|
||||
_player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GAIN_REVERED_REPUTATION, factionEntry->ID);
|
||||
_player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GAIN_HONORED_REPUTATION, factionEntry->ID);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -400,7 +400,7 @@ void ReputationMgr::SetVisible(FactionTemplateEntry const*factionTemplateEntry)
|
||||
|
||||
if (FactionEntry const* factionEntry = sFactionStore.LookupEntry(factionTemplateEntry->faction))
|
||||
// Never show factions of the opposing team
|
||||
if (!(factionEntry->BaseRepRaceMask[1] & m_player->getRaceMask() && factionEntry->BaseRepValue[1] == Reputation_Bottom))
|
||||
if (!(factionEntry->BaseRepRaceMask[1] & _player->getRaceMask() && factionEntry->BaseRepValue[1] == Reputation_Bottom))
|
||||
SetVisible(factionEntry);
|
||||
}
|
||||
|
||||
@@ -409,8 +409,8 @@ void ReputationMgr::SetVisible(FactionEntry const* factionEntry)
|
||||
if (factionEntry->reputationListID < 0)
|
||||
return;
|
||||
|
||||
FactionStateList::iterator itr = m_factions.find(factionEntry->reputationListID);
|
||||
if (itr == m_factions.end())
|
||||
FactionStateList::iterator itr = _factions.find(factionEntry->reputationListID);
|
||||
if (itr == _factions.end())
|
||||
return;
|
||||
|
||||
SetVisible(&itr->second);
|
||||
@@ -431,15 +431,15 @@ void ReputationMgr::SetVisible(FactionState* faction)
|
||||
faction->needSend = true;
|
||||
faction->needSave = true;
|
||||
|
||||
++m_visibleFactionCount;
|
||||
++_visibleFactionCount;
|
||||
|
||||
SendVisible(faction);
|
||||
}
|
||||
|
||||
void ReputationMgr::SetAtWar(RepListID repListID, bool on)
|
||||
{
|
||||
FactionStateList::iterator itr = m_factions.find(repListID);
|
||||
if (itr == m_factions.end())
|
||||
FactionStateList::iterator itr = _factions.find(repListID);
|
||||
if (itr == _factions.end())
|
||||
return;
|
||||
|
||||
// always invisible or hidden faction can't change war state
|
||||
@@ -470,8 +470,8 @@ void ReputationMgr::SetAtWar(FactionState* faction, bool atWar) const
|
||||
|
||||
void ReputationMgr::SetInactive(RepListID repListID, bool on)
|
||||
{
|
||||
FactionStateList::iterator itr = m_factions.find(repListID);
|
||||
if (itr == m_factions.end())
|
||||
FactionStateList::iterator itr = _factions.find(repListID);
|
||||
if (itr == _factions.end())
|
||||
return;
|
||||
|
||||
SetInactive(&itr->second, on);
|
||||
@@ -512,7 +512,7 @@ void ReputationMgr::LoadFromDB(PreparedQueryResult result)
|
||||
FactionEntry const* factionEntry = sFactionStore.LookupEntry(fields[0].GetUInt16());
|
||||
if (factionEntry && (factionEntry->reputationListID >= 0))
|
||||
{
|
||||
FactionState* faction = &m_factions[factionEntry->reputationListID];
|
||||
FactionState* faction = &_factions[factionEntry->reputationListID];
|
||||
|
||||
// update standing to current
|
||||
faction->Standing = int32(fields[1].GetUInt32());
|
||||
@@ -558,12 +558,12 @@ void ReputationMgr::LoadFromDB(PreparedQueryResult result)
|
||||
|
||||
void ReputationMgr::SaveToDB(SQLTransaction& trans)
|
||||
{
|
||||
for (FactionStateList::iterator itr = m_factions.begin(); itr != m_factions.end(); ++itr)
|
||||
for (FactionStateList::iterator itr = _factions.begin(); itr != _factions.end(); ++itr)
|
||||
{
|
||||
if (itr->second.needSave)
|
||||
{
|
||||
trans->PAppend("DELETE FROM character_reputation WHERE guid = '%u' AND faction='%u'", m_player->GetGUIDLow(), itr->second.ID);
|
||||
trans->PAppend("INSERT INTO character_reputation (guid, faction, standing, flags) VALUES ('%u', '%u', '%i', '%u')", m_player->GetGUIDLow(), itr->second.ID, itr->second.Standing, itr->second.Flags);
|
||||
trans->PAppend("DELETE FROM character_reputation WHERE guid = '%u' AND faction='%u'", _player->GetGUIDLow(), itr->second.ID);
|
||||
trans->PAppend("INSERT INTO character_reputation (guid, faction, standing, flags) VALUES ('%u', '%u', '%i', '%u')", _player->GetGUIDLow(), itr->second.ID, itr->second.Standing, itr->second.Flags);
|
||||
itr->second.needSave = false;
|
||||
}
|
||||
}
|
||||
@@ -572,16 +572,16 @@ void ReputationMgr::SaveToDB(SQLTransaction& trans)
|
||||
void ReputationMgr::UpdateRankCounters(ReputationRank old_rank, ReputationRank new_rank)
|
||||
{
|
||||
if (old_rank >= REP_EXALTED)
|
||||
--m_exaltedFactionCount;
|
||||
--_exaltedFactionCount;
|
||||
if (old_rank >= REP_REVERED)
|
||||
--m_reveredFactionCount;
|
||||
--_reveredFactionCount;
|
||||
if (old_rank >= REP_HONORED)
|
||||
--m_honoredFactionCount;
|
||||
--_honoredFactionCount;
|
||||
|
||||
if (new_rank >= REP_EXALTED)
|
||||
++m_exaltedFactionCount;
|
||||
++_exaltedFactionCount;
|
||||
if (new_rank >= REP_REVERED)
|
||||
++m_reveredFactionCount;
|
||||
++_reveredFactionCount;
|
||||
if (new_rank >= REP_HONORED)
|
||||
++m_honoredFactionCount;
|
||||
++_honoredFactionCount;
|
||||
}
|
||||
|
||||
@@ -50,8 +50,8 @@ struct FactionState
|
||||
{
|
||||
uint32 ID;
|
||||
RepListID ReputationListID;
|
||||
uint8 Flags;
|
||||
int32 Standing;
|
||||
uint8 Flags;
|
||||
bool needSend;
|
||||
bool needSave;
|
||||
};
|
||||
@@ -64,8 +64,8 @@ class Player;
|
||||
class ReputationMgr
|
||||
{
|
||||
public: // constructors and global modifiers
|
||||
explicit ReputationMgr(Player* owner) : m_player(owner),
|
||||
m_visibleFactionCount(0), m_honoredFactionCount(0), m_reveredFactionCount(0), m_exaltedFactionCount(0) {}
|
||||
explicit ReputationMgr(Player* owner) : _player(owner),
|
||||
_visibleFactionCount(0), _honoredFactionCount(0), _reveredFactionCount(0), _exaltedFactionCount(0) {}
|
||||
~ReputationMgr() {}
|
||||
|
||||
void SaveToDB(SQLTransaction& trans);
|
||||
@@ -77,12 +77,12 @@ class ReputationMgr
|
||||
|
||||
static ReputationRank ReputationToRank(int32 standing);
|
||||
public: // accessors
|
||||
uint8 GetVisibleFactionCount() const { return m_visibleFactionCount; }
|
||||
uint8 GetHonoredFactionCount() const { return m_honoredFactionCount; }
|
||||
uint8 GetReveredFactionCount() const { return m_reveredFactionCount; }
|
||||
uint8 GetExaltedFactionCount() const { return m_exaltedFactionCount; }
|
||||
uint8 GetVisibleFactionCount() const { return _visibleFactionCount; }
|
||||
uint8 GetHonoredFactionCount() const { return _honoredFactionCount; }
|
||||
uint8 GetReveredFactionCount() const { return _reveredFactionCount; }
|
||||
uint8 GetExaltedFactionCount() const { return _exaltedFactionCount; }
|
||||
|
||||
FactionStateList const& GetStateList() const { return m_factions; }
|
||||
FactionStateList const& GetStateList() const { return _factions; }
|
||||
|
||||
FactionState const* GetState(FactionEntry const* factionEntry) const
|
||||
{
|
||||
@@ -91,8 +91,8 @@ class ReputationMgr
|
||||
|
||||
FactionState const* GetState(RepListID id) const
|
||||
{
|
||||
FactionStateList::const_iterator repItr = m_factions.find (id);
|
||||
return repItr != m_factions.end() ? &repItr->second : NULL;
|
||||
FactionStateList::const_iterator repItr = _factions.find (id);
|
||||
return repItr != _factions.end() ? &repItr->second : NULL;
|
||||
}
|
||||
|
||||
bool IsAtWar(uint32 faction_id) const;
|
||||
@@ -111,8 +111,8 @@ class ReputationMgr
|
||||
|
||||
ReputationRank const* GetForcedRankIfAny(FactionTemplateEntry const* factionTemplateEntry) const
|
||||
{
|
||||
ForcedReactions::const_iterator forceItr = m_forcedReactions.find(factionTemplateEntry->faction);
|
||||
return forceItr != m_forcedReactions.end() ? &forceItr->second : NULL;
|
||||
ForcedReactions::const_iterator forceItr = _forcedReactions.find(factionTemplateEntry->faction);
|
||||
return forceItr != _forcedReactions.end() ? &forceItr->second : NULL;
|
||||
}
|
||||
|
||||
public: // modifiers
|
||||
@@ -149,13 +149,13 @@ class ReputationMgr
|
||||
void SendVisible(FactionState const* faction) const;
|
||||
void UpdateRankCounters(ReputationRank old_rank, ReputationRank new_rank);
|
||||
private:
|
||||
Player* m_player;
|
||||
FactionStateList m_factions;
|
||||
ForcedReactions m_forcedReactions;
|
||||
uint8 m_visibleFactionCount :8;
|
||||
uint8 m_honoredFactionCount :8;
|
||||
uint8 m_reveredFactionCount :8;
|
||||
uint8 m_exaltedFactionCount :8;
|
||||
Player* _player;
|
||||
FactionStateList _factions;
|
||||
ForcedReactions _forcedReactions;
|
||||
uint8 _visibleFactionCount :8;
|
||||
uint8 _honoredFactionCount :8;
|
||||
uint8 _reveredFactionCount :8;
|
||||
uint8 _exaltedFactionCount :8;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1040,7 +1040,7 @@ bool ScriptMgr::OnConditionCheck(Condition* condition, ConditionSourceInfo& sour
|
||||
{
|
||||
ASSERT(condition);
|
||||
|
||||
GET_SCRIPT_RET(ConditionScript, condition->mScriptId, tmpscript, true);
|
||||
GET_SCRIPT_RET(ConditionScript, condition->ScriptId, tmpscript, true);
|
||||
return tmpscript->OnConditionCheck(condition, sourceInfo);
|
||||
}
|
||||
|
||||
|
||||
@@ -95,18 +95,19 @@ class AuraEffect
|
||||
Aura* const m_base;
|
||||
|
||||
SpellInfo const* const m_spellInfo;
|
||||
uint8 const m_effIndex;
|
||||
int32 const m_baseAmount;
|
||||
|
||||
int32 m_amount;
|
||||
bool m_canBeRecalculated;
|
||||
|
||||
SpellModifier* m_spellmod;
|
||||
|
||||
bool m_isPeriodic;
|
||||
int32 m_periodicTimer;
|
||||
int32 m_amplitude;
|
||||
uint32 m_tickNumber;
|
||||
|
||||
uint8 const m_effIndex;
|
||||
bool m_canBeRecalculated;
|
||||
bool m_isPeriodic;
|
||||
private:
|
||||
bool IsPeriodicTickCrit(Unit* target, Unit const* caster) const;
|
||||
|
||||
|
||||
@@ -37,8 +37,8 @@
|
||||
#include "Vehicle.h"
|
||||
|
||||
AuraApplication::AuraApplication(Unit* target, Unit* caster, Aura* aura, uint8 effMask):
|
||||
m_target(target), m_base(aura), m_slot(MAX_AURAS), m_flags(AFLAG_NONE),
|
||||
m_effectsToApply(effMask), m_removeMode(AURA_REMOVE_NONE), m_needClientUpdate(false)
|
||||
_target(target), _base(aura), _slot(MAX_AURAS), _flags(AFLAG_NONE),
|
||||
_effectsToApply(effMask), _removeMode(AURA_REMOVE_NONE), _needClientUpdate(false)
|
||||
{
|
||||
ASSERT(GetTarget() && GetBase());
|
||||
|
||||
@@ -70,7 +70,7 @@ m_effectsToApply(effMask), m_removeMode(AURA_REMOVE_NONE), m_needClientUpdate(fa
|
||||
// Register Visible Aura
|
||||
if (slot < MAX_AURAS)
|
||||
{
|
||||
m_slot = slot;
|
||||
_slot = slot;
|
||||
GetTarget()->SetVisibleAura(slot, this);
|
||||
SetNeedClientUpdate();
|
||||
sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "Aura: %u Effect: %d put to unit visible auras slot: %u", GetBase()->GetId(), GetEffectMask(), slot);
|
||||
@@ -89,7 +89,7 @@ void AuraApplication::_Remove()
|
||||
if (slot >= MAX_AURAS)
|
||||
return;
|
||||
|
||||
if (AuraApplication * foundAura = m_target->GetAuraApplication(GetBase()->GetId(), GetBase()->GetCasterGUID(), GetBase()->GetCastItemGUID()))
|
||||
if (AuraApplication * foundAura = _target->GetAuraApplication(GetBase()->GetId(), GetBase()->GetCasterGUID(), GetBase()->GetCastItemGUID()))
|
||||
{
|
||||
// Reuse visible aura slot by aura which is still applied - prevent storing dead pointers
|
||||
if (slot == foundAura->GetSlot())
|
||||
@@ -115,7 +115,7 @@ void AuraApplication::_Remove()
|
||||
void AuraApplication::_InitFlags(Unit* caster, uint8 effMask)
|
||||
{
|
||||
// mark as selfcasted if needed
|
||||
m_flags |= (GetBase()->GetCasterGUID() == GetTarget()->GetGUID()) ? AFLAG_CASTER : AFLAG_NONE;
|
||||
_flags |= (GetBase()->GetCasterGUID() == GetTarget()->GetGUID()) ? AFLAG_CASTER : AFLAG_NONE;
|
||||
|
||||
// aura is casted by self or an enemy
|
||||
// one negative effect and we know aura is negative
|
||||
@@ -130,7 +130,7 @@ void AuraApplication::_InitFlags(Unit* caster, uint8 effMask)
|
||||
break;
|
||||
}
|
||||
}
|
||||
m_flags |= negativeFound ? AFLAG_NEGATIVE : AFLAG_POSITIVE;
|
||||
_flags |= negativeFound ? AFLAG_NEGATIVE : AFLAG_POSITIVE;
|
||||
}
|
||||
// aura is casted by friend
|
||||
// one positive effect and we know aura is positive
|
||||
@@ -145,7 +145,7 @@ void AuraApplication::_InitFlags(Unit* caster, uint8 effMask)
|
||||
break;
|
||||
}
|
||||
}
|
||||
m_flags |= positiveFound ? AFLAG_POSITIVE : AFLAG_NEGATIVE;
|
||||
_flags |= positiveFound ? AFLAG_POSITIVE : AFLAG_NEGATIVE;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -154,19 +154,19 @@ void AuraApplication::_HandleEffect(uint8 effIndex, bool apply)
|
||||
AuraEffect* aurEff = GetBase()->GetEffect(effIndex);
|
||||
ASSERT(aurEff);
|
||||
ASSERT(HasEffect(effIndex) == (!apply));
|
||||
ASSERT((1<<effIndex) & m_effectsToApply);
|
||||
ASSERT((1<<effIndex) & _effectsToApply);
|
||||
sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "AuraApplication::_HandleEffect: %u, apply: %u: amount: %u", aurEff->GetAuraType(), apply, aurEff->GetAmount());
|
||||
|
||||
if (apply)
|
||||
{
|
||||
ASSERT(!(m_flags & (1<<effIndex)));
|
||||
m_flags |= 1<<effIndex;
|
||||
ASSERT(!(_flags & (1<<effIndex)));
|
||||
_flags |= 1<<effIndex;
|
||||
aurEff->HandleEffect(this, AURA_EFFECT_HANDLE_REAL, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
ASSERT(m_flags & (1<<effIndex));
|
||||
m_flags &= ~(1<<effIndex);
|
||||
ASSERT(_flags & (1<<effIndex));
|
||||
_flags &= ~(1<<effIndex);
|
||||
aurEff->HandleEffect(this, AURA_EFFECT_HANDLE_REAL, false);
|
||||
|
||||
// Remove all triggered by aura spells vs unlimited duration
|
||||
@@ -177,19 +177,19 @@ void AuraApplication::_HandleEffect(uint8 effIndex, bool apply)
|
||||
|
||||
void AuraApplication::BuildUpdatePacket(ByteBuffer& data, bool remove) const
|
||||
{
|
||||
data << uint8(m_slot);
|
||||
data << uint8(_slot);
|
||||
|
||||
if (remove)
|
||||
{
|
||||
ASSERT(!m_target->GetVisibleAura(m_slot));
|
||||
ASSERT(!_target->GetVisibleAura(_slot));
|
||||
data << uint32(0);
|
||||
return;
|
||||
}
|
||||
ASSERT(m_target->GetVisibleAura(m_slot));
|
||||
ASSERT(_target->GetVisibleAura(_slot));
|
||||
|
||||
Aura const* aura = GetBase();
|
||||
data << uint32(aura->GetId());
|
||||
uint32 flags = m_flags;
|
||||
uint32 flags = _flags;
|
||||
if (aura->GetMaxDuration() > 0 && !(aura->GetSpellInfo()->AttributesEx5 & SPELL_ATTR5_HIDE_DURATION))
|
||||
flags |= AFLAG_DURATION;
|
||||
data << uint8(flags);
|
||||
@@ -210,13 +210,13 @@ void AuraApplication::BuildUpdatePacket(ByteBuffer& data, bool remove) const
|
||||
|
||||
void AuraApplication::ClientUpdate(bool remove)
|
||||
{
|
||||
m_needClientUpdate = false;
|
||||
_needClientUpdate = false;
|
||||
|
||||
WorldPacket data(SMSG_AURA_UPDATE);
|
||||
data.append(GetTarget()->GetPackGUID());
|
||||
BuildUpdatePacket(data, remove);
|
||||
|
||||
m_target->SendMessageToSet(&data, true);
|
||||
_target->SendMessageToSet(&data, true);
|
||||
}
|
||||
|
||||
uint8 Aura::BuildEffectMaskForOwner(SpellInfo const* spellProto, uint8 avalibleEffectMask, WorldObject* owner)
|
||||
|
||||
@@ -46,13 +46,13 @@ class AuraApplication
|
||||
friend void Unit::RemoveAura(AuraApplication * aurApp, AuraRemoveMode mode);
|
||||
friend AuraApplication * Unit::_CreateAuraApplication(Aura* aura, uint8 effMask);
|
||||
private:
|
||||
Unit* const m_target;
|
||||
Aura* const m_base;
|
||||
uint8 m_slot; // Aura slot on unit
|
||||
uint8 m_flags; // Aura info flag
|
||||
uint8 m_effectsToApply; // Used only at spell hit to determine which effect should be applied
|
||||
AuraRemoveMode m_removeMode:8; // Store info for know remove aura reason
|
||||
bool m_needClientUpdate:1;
|
||||
Unit* const _target;
|
||||
Aura* const _base;
|
||||
AuraRemoveMode _removeMode:8; // Store info for know remove aura reason
|
||||
uint8 _slot; // Aura slot on unit
|
||||
uint8 _flags; // Aura info flag
|
||||
uint8 _effectsToApply; // Used only at spell hit to determine which effect should be applied
|
||||
bool _needClientUpdate:1;
|
||||
|
||||
explicit AuraApplication(Unit* target, Unit* caster, Aura* base, uint8 effMask);
|
||||
void _Remove();
|
||||
@@ -61,22 +61,22 @@ class AuraApplication
|
||||
void _HandleEffect(uint8 effIndex, bool apply);
|
||||
public:
|
||||
|
||||
Unit* GetTarget() const { return m_target; }
|
||||
Aura* GetBase() const { return m_base; }
|
||||
Unit* GetTarget() const { return _target; }
|
||||
Aura* GetBase() const { return _base; }
|
||||
|
||||
uint8 GetSlot() const { return m_slot; }
|
||||
uint8 GetFlags() const { return m_flags; }
|
||||
uint8 GetEffectMask() const { return m_flags & (AFLAG_EFF_INDEX_0 | AFLAG_EFF_INDEX_1 | AFLAG_EFF_INDEX_2); }
|
||||
bool HasEffect(uint8 effect) const { ASSERT(effect < MAX_SPELL_EFFECTS); return m_flags & (1<<effect); }
|
||||
bool IsPositive() const { return m_flags & AFLAG_POSITIVE; }
|
||||
bool IsSelfcasted() const { return m_flags & AFLAG_CASTER; }
|
||||
uint8 GetEffectsToApply() const { return m_effectsToApply; }
|
||||
uint8 GetSlot() const { return _slot; }
|
||||
uint8 GetFlags() const { return _flags; }
|
||||
uint8 GetEffectMask() const { return _flags & (AFLAG_EFF_INDEX_0 | AFLAG_EFF_INDEX_1 | AFLAG_EFF_INDEX_2); }
|
||||
bool HasEffect(uint8 effect) const { ASSERT(effect < MAX_SPELL_EFFECTS); return _flags & (1<<effect); }
|
||||
bool IsPositive() const { return _flags & AFLAG_POSITIVE; }
|
||||
bool IsSelfcasted() const { return _flags & AFLAG_CASTER; }
|
||||
uint8 GetEffectsToApply() const { return _effectsToApply; }
|
||||
|
||||
void SetRemoveMode(AuraRemoveMode mode) { m_removeMode = mode; }
|
||||
AuraRemoveMode GetRemoveMode() const {return m_removeMode;}
|
||||
void SetRemoveMode(AuraRemoveMode mode) { _removeMode = mode; }
|
||||
AuraRemoveMode GetRemoveMode() const {return _removeMode;}
|
||||
|
||||
void SetNeedClientUpdate() { m_needClientUpdate = true;}
|
||||
bool IsNeedClientUpdate() const { return m_needClientUpdate;}
|
||||
void SetNeedClientUpdate() { _needClientUpdate = true;}
|
||||
bool IsNeedClientUpdate() const { return _needClientUpdate;}
|
||||
void BuildUpdatePacket(ByteBuffer& data, bool remove) const;
|
||||
void ClientUpdate(bool remove = false);
|
||||
};
|
||||
|
||||
@@ -4736,8 +4736,8 @@ SpellCastResult Spell::CheckCast(bool strict)
|
||||
if (Player* playerCaster = m_caster->ToPlayer())
|
||||
{
|
||||
if (playerCaster->GetSession() && condInfo.mLastFailedCondition
|
||||
&& condInfo.mLastFailedCondition->ErrorTextd)
|
||||
playerCaster->GetSession()->SendNotification(condInfo.mLastFailedCondition->ErrorTextd);
|
||||
&& condInfo.mLastFailedCondition->ErrorTextId)
|
||||
playerCaster->GetSession()->SendNotification(condInfo.mLastFailedCondition->ErrorTextId);
|
||||
}
|
||||
return SPELL_FAILED_DONT_REPORT;
|
||||
}
|
||||
|
||||
@@ -551,7 +551,7 @@ public:
|
||||
return;
|
||||
|
||||
QuestStatusMap::const_iterator itr = caster->ToPlayer()->getQuestStatusMap().find(QUEST_ENTRY);
|
||||
if (itr->second.m_status != QUEST_STATUS_INCOMPLETE)
|
||||
if (itr->second.Status != QUEST_STATUS_INCOMPLETE)
|
||||
return;
|
||||
|
||||
for (uint8 i=0; i<3; i++)
|
||||
@@ -575,7 +575,7 @@ public:
|
||||
break;
|
||||
}
|
||||
|
||||
if (itr->second.m_creatureOrGOcount[i] != 0)
|
||||
if (itr->second.CreatureOrGOCount[i] != 0)
|
||||
continue;
|
||||
|
||||
caster->ToPlayer()->KilledMonsterCredit(me->GetEntry(), 0);
|
||||
|
||||
@@ -20,13 +20,13 @@
|
||||
#include "Log.h"
|
||||
|
||||
ResultSet::ResultSet(MYSQL_RES *result, MYSQL_FIELD *fields, uint64 rowCount, uint32 fieldCount) :
|
||||
m_rowCount(rowCount),
|
||||
m_fieldCount(fieldCount),
|
||||
m_result(result),
|
||||
m_fields(fields)
|
||||
_rowCount(rowCount),
|
||||
_fieldCount(fieldCount),
|
||||
_result(result),
|
||||
_fields(fields)
|
||||
{
|
||||
m_currentRow = new Field[m_fieldCount];
|
||||
ASSERT(m_currentRow);
|
||||
_currentRow = new Field[_fieldCount];
|
||||
ASSERT(_currentRow);
|
||||
}
|
||||
|
||||
PreparedResultSet::PreparedResultSet(MYSQL_STMT* stmt, MYSQL_RES *result, uint64 rowCount, uint32 fieldCount) :
|
||||
@@ -150,18 +150,18 @@ bool ResultSet::NextRow()
|
||||
{
|
||||
MYSQL_ROW row;
|
||||
|
||||
if (!m_result)
|
||||
if (!_result)
|
||||
return false;
|
||||
|
||||
row = mysql_fetch_row(m_result);
|
||||
row = mysql_fetch_row(_result);
|
||||
if (!row)
|
||||
{
|
||||
CleanUp();
|
||||
return false;
|
||||
}
|
||||
|
||||
for (uint32 i = 0; i < m_fieldCount; i++)
|
||||
m_currentRow[i].SetStructuredValue(row[i], m_fields[i].type);
|
||||
for (uint32 i = 0; i < _fieldCount; i++)
|
||||
_currentRow[i].SetStructuredValue(row[i], _fields[i].type);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -196,16 +196,16 @@ bool PreparedResultSet::_NextRow()
|
||||
|
||||
void ResultSet::CleanUp()
|
||||
{
|
||||
if (m_currentRow)
|
||||
if (_currentRow)
|
||||
{
|
||||
delete [] m_currentRow;
|
||||
m_currentRow = NULL;
|
||||
delete [] _currentRow;
|
||||
_currentRow = NULL;
|
||||
}
|
||||
|
||||
if (m_result)
|
||||
if (_result)
|
||||
{
|
||||
mysql_free_result(m_result);
|
||||
m_result = NULL;
|
||||
mysql_free_result(_result);
|
||||
_result = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -33,29 +33,29 @@
|
||||
class ResultSet
|
||||
{
|
||||
public:
|
||||
ResultSet(MYSQL_RES *result, MYSQL_FIELD *fields, uint64 rowCount, uint32 fieldCount);
|
||||
ResultSet(MYSQL_RES* result, MYSQL_FIELD* fields, uint64 rowCount, uint32 fieldCount);
|
||||
~ResultSet();
|
||||
|
||||
bool NextRow();
|
||||
uint64 GetRowCount() const { return m_rowCount; }
|
||||
uint32 GetFieldCount() const { return m_fieldCount; }
|
||||
uint64 GetRowCount() const { return _rowCount; }
|
||||
uint32 GetFieldCount() const { return _fieldCount; }
|
||||
|
||||
Field* Fetch() const { return m_currentRow; }
|
||||
Field* Fetch() const { return _currentRow; }
|
||||
const Field & operator [] (uint32 index) const
|
||||
{
|
||||
ASSERT(index < m_fieldCount);
|
||||
return m_currentRow[index];
|
||||
ASSERT(index < _fieldCount);
|
||||
return _currentRow[index];
|
||||
}
|
||||
|
||||
protected:
|
||||
Field* m_currentRow;
|
||||
uint64 m_rowCount;
|
||||
uint32 m_fieldCount;
|
||||
uint64 _rowCount;
|
||||
Field* _currentRow;
|
||||
uint32 _fieldCount;
|
||||
|
||||
private:
|
||||
void CleanUp();
|
||||
MYSQL_RES *m_result;
|
||||
MYSQL_FIELD *m_fields;
|
||||
MYSQL_RES* _result;
|
||||
MYSQL_FIELD* _fields;
|
||||
};
|
||||
|
||||
typedef ACE_Refcounted_Auto_Ptr<ResultSet, ACE_Null_Mutex> QueryResult;
|
||||
@@ -63,7 +63,7 @@ typedef ACE_Refcounted_Auto_Ptr<ResultSet, ACE_Null_Mutex> QueryResult;
|
||||
class PreparedResultSet
|
||||
{
|
||||
public:
|
||||
PreparedResultSet(MYSQL_STMT* stmt, MYSQL_RES *result, uint64 rowCount, uint32 fieldCount);
|
||||
PreparedResultSet(MYSQL_STMT* stmt, MYSQL_RES* result, uint64 rowCount, uint32 fieldCount);
|
||||
~PreparedResultSet();
|
||||
|
||||
bool NextRow();
|
||||
@@ -84,9 +84,9 @@ class PreparedResultSet
|
||||
}
|
||||
|
||||
protected:
|
||||
std::vector<Field*> m_rows;
|
||||
uint64 m_rowCount;
|
||||
uint64 m_rowPosition;
|
||||
std::vector<Field*> m_rows;
|
||||
uint32 m_fieldCount;
|
||||
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user