Merge branch 'master' of git://github.com/TrinityCore/TrinityCore
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
-- Criteria conditions for Once Bitten, Twice Shy achievement
|
||||
DELETE FROM `achievement_criteria_data` WHERE `type`=12 AND `criteria_id` IN (13013, 13012, 13011, 12780);
|
||||
INSERT INTO `achievement_criteria_data` (`criteria_id`,`type`,`value1`,`value2`,`scriptname`) VALUES
|
||||
(13013, 12, 1, 0, ""), -- heroic
|
||||
(13012, 12, 1, 0, ""), -- heroic
|
||||
(13011, 12, 0, 0, ""), -- normal
|
||||
(12780, 12, 0, 0, ""); -- normal
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -102,6 +102,8 @@ void BattlegroundRV::StartingEventOpenDoors()
|
||||
|
||||
setState(BG_RV_STATE_OPEN_FENCES);
|
||||
setTimer(BG_RV_FIRST_TIMER);
|
||||
|
||||
TogglePillarCollision(true);
|
||||
}
|
||||
|
||||
void BattlegroundRV::AddPlayer(Player* player)
|
||||
|
||||
@@ -558,8 +558,8 @@ bool ChatHandler::HandleLookupTeleCommand(const char * args)
|
||||
uint32 maxResults = sWorld->getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS);
|
||||
bool limitReached = false;
|
||||
|
||||
GameTeleMap const & teleMap = sObjectMgr->GetGameTeleMap();
|
||||
for (GameTeleMap::const_iterator itr = teleMap.begin(); itr != teleMap.end(); ++itr)
|
||||
GameTeleContainer const & teleMap = sObjectMgr->GetGameTeleMap();
|
||||
for (GameTeleContainer::const_iterator itr = teleMap.begin(); itr != teleMap.end(); ++itr)
|
||||
{
|
||||
GameTele const* tele = &itr->second;
|
||||
|
||||
|
||||
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();
|
||||
};
|
||||
|
||||
|
||||
@@ -209,7 +209,7 @@ struct CreatureBaseStats
|
||||
static CreatureBaseStats const* GetBaseStats(uint8 level, uint8 unitClass);
|
||||
};
|
||||
|
||||
typedef UNORDERED_MAP<uint16, CreatureBaseStats> CreatureBaseStatsMap;
|
||||
typedef UNORDERED_MAP<uint16, CreatureBaseStats> CreatureBaseStatsContainer;
|
||||
|
||||
struct CreatureLocale
|
||||
{
|
||||
|
||||
@@ -881,7 +881,7 @@ bool Item::IsTargetValidForItemUse(Unit* pUnitTarget)
|
||||
|
||||
for (ConditionList::const_iterator itr = conditions.begin(); itr != conditions.end(); ++itr)
|
||||
{
|
||||
ItemRequiredTarget irt(ItemRequiredTargetType((*itr)->mConditionValue1), (*itr)->mConditionValue2);
|
||||
ItemRequiredTarget irt(ItemRequiredTargetType((*itr)->ConditionValue1), (*itr)->ConditionValue2);
|
||||
if (irt.IsFitToRequirements(pUnitTarget))
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -14086,7 +14086,7 @@ void Player::PrepareGossipMenu(WorldObject* source, uint32 menuId /*= 0*/, bool
|
||||
if (source->ToGameObject()->GetGoType() == GAMEOBJECT_TYPE_QUESTGIVER)
|
||||
PrepareQuestMenu(source->GetGUID());
|
||||
|
||||
for (GossipMenuItemsMap::const_iterator itr = menuItemBounds.first; itr != menuItemBounds.second; ++itr)
|
||||
for (GossipMenuItemsContainer::const_iterator itr = menuItemBounds.first; itr != menuItemBounds.second; ++itr)
|
||||
{
|
||||
bool canTalk = true;
|
||||
if (!sConditionMgr->IsObjectMeetToConditions(this, itr->second.Conditions))
|
||||
@@ -14390,7 +14390,7 @@ uint32 Player::GetGossipTextId(uint32 menuId)
|
||||
|
||||
GossipMenusMapBounds menuBounds = sObjectMgr->GetGossipMenusMapBounds(menuId);
|
||||
|
||||
for (GossipMenusMap::const_iterator itr = menuBounds.first; itr != menuBounds.second; ++itr)
|
||||
for (GossipMenusContainer::const_iterator itr = menuBounds.first; itr != menuBounds.second; ++itr)
|
||||
if (sConditionMgr->IsObjectMeetToConditions(this, itr->second.conditions))
|
||||
textId = itr->second.text_id;
|
||||
|
||||
@@ -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);
|
||||
@@ -15537,8 +15537,8 @@ bool Player::SatisfyQuestSeasonal(Quest const* qInfo, bool /*msg*/)
|
||||
return true;
|
||||
|
||||
uint16 eventId = sGameEventMgr->GetEventIdForQuest(qInfo);
|
||||
if (m_seasonalquests.find(eventId) == m_seasonalquests.end())
|
||||
return false;
|
||||
if (m_seasonalquests.find(eventId) == m_seasonalquests.end() || m_seasonalquests[eventId].empty())
|
||||
return true;
|
||||
|
||||
// if not found in cooldown list
|
||||
return m_seasonalquests[eventId].find(qInfo->GetQuestId()) == m_seasonalquests[eventId].end();
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -22384,7 +22384,7 @@ void Player::UpdateForQuestWorldObjects()
|
||||
continue;
|
||||
|
||||
SpellClickInfoMapBounds clickPair = sObjectMgr->GetSpellClickInfoMapBounds(obj->GetEntry());
|
||||
for (SpellClickInfoMap::const_iterator _itr = clickPair.first; _itr != clickPair.second; ++_itr)
|
||||
for (SpellClickInfoContainer::const_iterator _itr = clickPair.first; _itr != clickPair.second; ++_itr)
|
||||
if (_itr->second.questStart || _itr->second.questEnd)
|
||||
{
|
||||
obj->BuildCreateUpdateBlockForPlayer(&udata, this);
|
||||
@@ -24161,7 +24161,7 @@ bool Player::canSeeSpellClickOn(Creature const* c) const
|
||||
if (clickPair.first == clickPair.second)
|
||||
return true;
|
||||
|
||||
for (SpellClickInfoMap::const_iterator itr = clickPair.first; itr != clickPair.second; ++itr)
|
||||
for (SpellClickInfoContainer::const_iterator itr = clickPair.first; itr != clickPair.second; ++itr)
|
||||
if (itr->second.IsFitToRequirements(this, c))
|
||||
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>
|
||||
|
||||
@@ -12148,6 +12148,26 @@ bool Unit::_IsValidAttackTarget(Unit const* target, SpellInfo const* bySpell) co
|
||||
|| target->GetReactionTo(this) > REP_NEUTRAL)
|
||||
return false;
|
||||
|
||||
// Not all neutral creatures can be attacked
|
||||
if (GetReactionTo(target) == REP_NEUTRAL &&
|
||||
target->GetReactionTo(this) == REP_NEUTRAL)
|
||||
{
|
||||
if (
|
||||
!(target->GetTypeId() == TYPEID_PLAYER && GetTypeId() == TYPEID_PLAYER) &&
|
||||
!(target->GetTypeId() == TYPEID_UNIT && GetTypeId() == TYPEID_UNIT)
|
||||
)
|
||||
{
|
||||
Player const* player = target->GetTypeId() == TYPEID_PLAYER ? target->ToPlayer() : ToPlayer();
|
||||
Unit const* creature = target->GetTypeId() == TYPEID_UNIT ? target : this;
|
||||
|
||||
if (FactionTemplateEntry const* factionTemplate = creature->getFactionTemplateEntry())
|
||||
if (FactionEntry const* factionEntry = sFactionStore.LookupEntry(factionTemplate->faction))
|
||||
if (FactionState const* repState = player->GetReputationMgr().GetState(factionEntry))
|
||||
if (repState->Flags & FACTION_FLAG_PEACE_FORCED)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Creature const* creatureAttacker = ToCreature();
|
||||
if (creatureAttacker && creatureAttacker->GetCreatureInfo()->type_flags & CREATURE_TYPEFLAGS_UNK26)
|
||||
return false;
|
||||
@@ -16853,7 +16873,7 @@ bool Unit::HandleSpellClick(Unit* clicker, int8 seatId)
|
||||
bool success = false;
|
||||
uint32 spellClickEntry = GetVehicleKit() ? GetVehicleKit()->GetCreatureEntry() : GetEntry();
|
||||
SpellClickInfoMapBounds clickPair = sObjectMgr->GetSpellClickInfoMapBounds(spellClickEntry);
|
||||
for (SpellClickInfoMap::const_iterator itr = clickPair.first; itr != clickPair.second; ++itr)
|
||||
for (SpellClickInfoContainer::const_iterator itr = clickPair.first; itr != clickPair.second; ++itr)
|
||||
{
|
||||
if (itr->second.IsFitToRequirements(clicker, this))
|
||||
{
|
||||
|
||||
@@ -65,14 +65,14 @@ 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;
|
||||
typedef std::map<uint32, VehicleAccessoryList> VehicleAccessoryMap;
|
||||
typedef std::map<uint32, VehicleAccessoryList> VehicleAccessoryContainer;
|
||||
typedef std::map<int8, VehicleSeat> SeatMap;
|
||||
|
||||
#endif
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
+234
-243
@@ -82,7 +82,7 @@ struct GameTele
|
||||
std::wstring wnameLow;
|
||||
};
|
||||
|
||||
typedef UNORDERED_MAP<uint32, GameTele > GameTeleMap;
|
||||
typedef UNORDERED_MAP<uint32, GameTele > GameTeleContainer;
|
||||
|
||||
enum ScriptsType
|
||||
{
|
||||
@@ -321,8 +321,8 @@ struct ScriptInfo
|
||||
|
||||
typedef std::multimap<uint32, ScriptInfo> ScriptMap;
|
||||
typedef std::map<uint32, ScriptMap > ScriptMapMap;
|
||||
typedef std::multimap<uint32, uint32> SpellScriptsMap;
|
||||
typedef std::pair<SpellScriptsMap::iterator, SpellScriptsMap::iterator> SpellScriptsBounds;
|
||||
typedef std::multimap<uint32, uint32> SpellScriptsContainer;
|
||||
typedef std::pair<SpellScriptsContainer::iterator, SpellScriptsContainer::iterator> SpellScriptsBounds;
|
||||
extern ScriptMapMap sQuestEndScripts;
|
||||
extern ScriptMapMap sQuestStartScripts;
|
||||
extern ScriptMapMap sSpellScripts;
|
||||
@@ -349,8 +349,8 @@ struct SpellClickInfo
|
||||
bool IsFitToRequirements(Unit const* clicker, Unit const* clickee) const;
|
||||
};
|
||||
|
||||
typedef std::multimap<uint32, SpellClickInfo> SpellClickInfoMap;
|
||||
typedef std::pair<SpellClickInfoMap::const_iterator, SpellClickInfoMap::const_iterator> SpellClickInfoMapBounds;
|
||||
typedef std::multimap<uint32, SpellClickInfo> SpellClickInfoContainer;
|
||||
typedef std::pair<SpellClickInfoContainer::const_iterator, SpellClickInfoContainer::const_iterator> SpellClickInfoMapBounds;
|
||||
|
||||
struct AreaTrigger
|
||||
{
|
||||
@@ -390,24 +390,22 @@ struct TrinityStringLocale
|
||||
StringVector Content;
|
||||
};
|
||||
|
||||
typedef std::map<uint64, uint64> LinkedRespawnMap;
|
||||
typedef UNORDERED_MAP<uint32, CreatureData> CreatureDataMap;
|
||||
typedef UNORDERED_MAP<uint32, GameObjectData> GameObjectDataMap;
|
||||
typedef UNORDERED_MAP<uint32, CreatureLocale> CreatureLocaleMap;
|
||||
typedef UNORDERED_MAP<uint32, GameObjectLocale> GameObjectLocaleMap;
|
||||
typedef UNORDERED_MAP<uint32, ItemLocale> ItemLocaleMap;
|
||||
typedef UNORDERED_MAP<uint32, ItemSetNameLocale> ItemSetNameLocaleMap;
|
||||
typedef UNORDERED_MAP<uint32, QuestLocale> QuestLocaleMap;
|
||||
typedef UNORDERED_MAP<uint32, NpcTextLocale> NpcTextLocaleMap;
|
||||
typedef UNORDERED_MAP<uint32, PageTextLocale> PageTextLocaleMap;
|
||||
typedef UNORDERED_MAP<int32, TrinityStringLocale> TrinityStringLocaleMap;
|
||||
typedef UNORDERED_MAP<uint32, GossipMenuItemsLocale> GossipMenuItemsLocaleMap;
|
||||
typedef UNORDERED_MAP<uint32, PointOfInterestLocale> PointOfInterestLocaleMap;
|
||||
typedef std::map<uint64, uint64> LinkedRespawnContainer;
|
||||
typedef UNORDERED_MAP<uint32, CreatureData> CreatureDataContainer;
|
||||
typedef UNORDERED_MAP<uint32, GameObjectData> GameObjectDataContainer;
|
||||
typedef UNORDERED_MAP<uint32, CreatureLocale> CreatureLocaleContainer;
|
||||
typedef UNORDERED_MAP<uint32, GameObjectLocale> GameObjectLocaleContainer;
|
||||
typedef UNORDERED_MAP<uint32, ItemLocale> ItemLocaleContainer;
|
||||
typedef UNORDERED_MAP<uint32, ItemSetNameLocale> ItemSetNameLocaleContainer;
|
||||
typedef UNORDERED_MAP<uint32, QuestLocale> QuestLocaleContainer;
|
||||
typedef UNORDERED_MAP<uint32, NpcTextLocale> NpcTextLocaleContainer;
|
||||
typedef UNORDERED_MAP<uint32, PageTextLocale> PageTextLocaleContainer;
|
||||
typedef UNORDERED_MAP<int32, TrinityStringLocale> TrinityStringLocaleContainer;
|
||||
typedef UNORDERED_MAP<uint32, GossipMenuItemsLocale> GossipMenuItemsLocaleContainer;
|
||||
typedef UNORDERED_MAP<uint32, PointOfInterestLocale> PointOfInterestLocaleContainer;
|
||||
|
||||
typedef std::multimap<uint32, uint32> QuestRelations;
|
||||
typedef std::pair<QuestRelations::const_iterator, QuestRelations::const_iterator> QuestRelationBounds;
|
||||
typedef std::multimap<uint32, ItemRequiredTarget> ItemRequiredTargetMap;
|
||||
typedef std::pair<ItemRequiredTargetMap::const_iterator, ItemRequiredTargetMap::const_iterator> ItemRequiredTargetMapBounds;
|
||||
|
||||
struct PetLevelInfo
|
||||
{
|
||||
@@ -430,7 +428,7 @@ struct MailLevelReward
|
||||
};
|
||||
|
||||
typedef std::list<MailLevelReward> MailLevelRewardList;
|
||||
typedef UNORDERED_MAP<uint8, MailLevelRewardList> MailLevelRewardMap;
|
||||
typedef UNORDERED_MAP<uint8, MailLevelRewardList> MailLevelRewardContainer;
|
||||
|
||||
// We assume the rate is in general the same for all three types below, but chose to keep three for scalability and customization
|
||||
struct RepRewardRate
|
||||
@@ -442,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
|
||||
@@ -494,12 +492,12 @@ struct GossipMenus
|
||||
ConditionList conditions;
|
||||
};
|
||||
|
||||
typedef std::multimap<uint32, GossipMenus> GossipMenusMap;
|
||||
typedef std::pair<GossipMenusMap::const_iterator, GossipMenusMap::const_iterator> GossipMenusMapBounds;
|
||||
typedef std::pair<GossipMenusMap::iterator, GossipMenusMap::iterator> GossipMenusMapBoundsNonConst;
|
||||
typedef std::multimap<uint32, GossipMenuItems> GossipMenuItemsMap;
|
||||
typedef std::pair<GossipMenuItemsMap::const_iterator, GossipMenuItemsMap::const_iterator> GossipMenuItemsMapBounds;
|
||||
typedef std::pair<GossipMenuItemsMap::iterator, GossipMenuItemsMap::iterator> GossipMenuItemsMapBoundsNonConst;
|
||||
typedef std::multimap<uint32, GossipMenus> GossipMenusContainer;
|
||||
typedef std::pair<GossipMenusContainer::const_iterator, GossipMenusContainer::const_iterator> GossipMenusMapBounds;
|
||||
typedef std::pair<GossipMenusContainer::iterator, GossipMenusContainer::iterator> GossipMenusMapBoundsNonConst;
|
||||
typedef std::multimap<uint32, GossipMenuItems> GossipMenuItemsContainer;
|
||||
typedef std::pair<GossipMenuItemsContainer::const_iterator, GossipMenuItemsContainer::const_iterator> GossipMenuItemsMapBounds;
|
||||
typedef std::pair<GossipMenuItemsContainer::iterator, GossipMenuItemsContainer::iterator> GossipMenuItemsMapBoundsNonConst;
|
||||
|
||||
struct QuestPOIPoint
|
||||
{
|
||||
@@ -526,17 +524,17 @@ struct QuestPOI
|
||||
};
|
||||
|
||||
typedef std::vector<QuestPOI> QuestPOIVector;
|
||||
typedef UNORDERED_MAP<uint32, QuestPOIVector> QuestPOIMap;
|
||||
typedef UNORDERED_MAP<uint32, QuestPOIVector> QuestPOIContainer;
|
||||
|
||||
struct GraveYardData
|
||||
{
|
||||
uint32 safeLocId;
|
||||
uint32 team;
|
||||
};
|
||||
typedef std::multimap<uint32, GraveYardData> GraveYardMap;
|
||||
typedef std::multimap<uint32, GraveYardData> GraveYardContainer;
|
||||
|
||||
typedef UNORDERED_MAP<uint32, VendorItemData> CacheVendorItemMap;
|
||||
typedef UNORDERED_MAP<uint32, TrainerSpellData> CacheTrainerSpellMap;
|
||||
typedef UNORDERED_MAP<uint32, VendorItemData> CacheVendorItemContainer;
|
||||
typedef UNORDERED_MAP<uint32, TrainerSpellData> CacheTrainerSpellContainer;
|
||||
|
||||
enum SkillRangeType
|
||||
{
|
||||
@@ -584,7 +582,7 @@ struct DungeonEncounter
|
||||
};
|
||||
|
||||
typedef std::list<DungeonEncounter const*> DungeonEncounterList;
|
||||
typedef UNORDERED_MAP<uint32, DungeonEncounterList> DungeonEncounterMap;
|
||||
typedef UNORDERED_MAP<uint32, DungeonEncounterList> DungeonEncounterContainer;
|
||||
|
||||
class PlayerDumpReader;
|
||||
|
||||
@@ -602,33 +600,33 @@ class ObjectMgr
|
||||
|
||||
typedef UNORDERED_MAP<uint32, Quest*> QuestMap;
|
||||
|
||||
typedef UNORDERED_MAP<uint32, AreaTrigger> AreaTriggerMap;
|
||||
typedef UNORDERED_MAP<uint32, AreaTrigger> AreaTriggerContainer;
|
||||
|
||||
typedef UNORDERED_MAP<uint32, uint32> AreaTriggerScriptMap;
|
||||
typedef UNORDERED_MAP<uint32, uint32> AreaTriggerScriptContainer;
|
||||
|
||||
typedef UNORDERED_MAP<uint32, AccessRequirement> AccessRequirementMap;
|
||||
typedef UNORDERED_MAP<uint32, AccessRequirement> AccessRequirementContainer;
|
||||
|
||||
typedef UNORDERED_MAP<uint32, RepRewardRate > RepRewardRateMap;
|
||||
typedef UNORDERED_MAP<uint32, ReputationOnKillEntry> RepOnKillMap;
|
||||
typedef UNORDERED_MAP<uint32, RepSpilloverTemplate> RepSpilloverTemplateMap;
|
||||
typedef UNORDERED_MAP<uint32, RepRewardRate > RepRewardRateContainer;
|
||||
typedef UNORDERED_MAP<uint32, ReputationOnKillEntry> RepOnKillContainer;
|
||||
typedef UNORDERED_MAP<uint32, RepSpilloverTemplate> RepSpilloverTemplateContainer;
|
||||
|
||||
typedef UNORDERED_MAP<uint32, PointOfInterest> PointOfInterestMap;
|
||||
typedef UNORDERED_MAP<uint32, PointOfInterest> PointOfInterestContainer;
|
||||
|
||||
typedef std::vector<std::string> ScriptNameMap;
|
||||
typedef std::vector<std::string> ScriptNameContainer;
|
||||
|
||||
typedef std::map<uint32, uint32> CharacterConversionMap;
|
||||
|
||||
Player* GetPlayerByLowGUID(uint32 lowguid) const;
|
||||
|
||||
GameObjectTemplate const* GetGameObjectTemplate(uint32 entry);
|
||||
GameObjectTemplateContainer const* GetGameObjectTemplates() { return &GameObjectTemplateStore; }
|
||||
GameObjectTemplateContainer const* GetGameObjectTemplates() { return &_gameObjectTemplateStore; }
|
||||
int LoadReferenceVendor(int32 vendor, int32 item_id, std::set<uint32> *skip_vendors);
|
||||
|
||||
void LoadGameObjectTemplate();
|
||||
void AddGameobjectInfo(GameObjectTemplate* goinfo);
|
||||
|
||||
CreatureTemplate const* GetCreatureTemplate(uint32 entry);
|
||||
CreatureTemplateContainer const* GetCreatureTemplates() { return &CreatureTemplateStore; }
|
||||
CreatureTemplateContainer const* GetCreatureTemplates() { return &_creatureTemplateStore; }
|
||||
CreatureModelInfo const* GetCreatureModelInfo(uint32 modelId);
|
||||
CreatureModelInfo const* GetCreatureModelRandomGender(uint32* displayID);
|
||||
static uint32 ChooseDisplayId(uint32 team, const CreatureTemplate* cinfo, const CreatureData* data = NULL);
|
||||
@@ -637,12 +635,12 @@ class ObjectMgr
|
||||
CreatureAddon const* GetCreatureAddon(uint32 lowguid);
|
||||
CreatureAddon const* GetCreatureTemplateAddon(uint32 entry);
|
||||
ItemTemplate const* GetItemTemplate(uint32 entry);
|
||||
ItemTemplateContainer const* GetItemTemplateStore() { return &ItemTemplateStore; }
|
||||
ItemTemplateContainer const* GetItemTemplateStore() { return &_itemTemplateStore; }
|
||||
|
||||
ItemSetNameEntry const* GetItemSetNameEntry(uint32 itemId)
|
||||
{
|
||||
ItemSetNameMap::iterator itr = mItemSetNameMap.find(itemId);
|
||||
if (itr != mItemSetNameMap.end())
|
||||
ItemSetNameContainer::iterator itr = _itemSetNameStore.find(itemId);
|
||||
if (itr != _itemSetNameStore.end())
|
||||
return &itr->second;
|
||||
return NULL;
|
||||
}
|
||||
@@ -655,7 +653,7 @@ class ObjectMgr
|
||||
{
|
||||
if (class_ >= MAX_CLASSES)
|
||||
return NULL;
|
||||
return &playerClassInfo[class_];
|
||||
return &_playerClassInfo[class_];
|
||||
}
|
||||
void GetPlayerClassLevelInfo(uint32 class_, uint8 level, PlayerClassLevelInfo* info) const;
|
||||
|
||||
@@ -665,7 +663,7 @@ class ObjectMgr
|
||||
return NULL;
|
||||
if (class_ >= MAX_CLASSES)
|
||||
return NULL;
|
||||
PlayerInfo const* info = &playerInfo[race][class_];
|
||||
PlayerInfo const* info = &_playerInfo[race][class_];
|
||||
if (info->displayId_m == 0 || info->displayId_f == 0)
|
||||
return NULL;
|
||||
return info;
|
||||
@@ -685,28 +683,28 @@ class ObjectMgr
|
||||
|
||||
Quest const* GetQuestTemplate(uint32 quest_id) const
|
||||
{
|
||||
QuestMap::const_iterator itr = mQuestTemplates.find(quest_id);
|
||||
return itr != mQuestTemplates.end() ? itr->second : NULL;
|
||||
QuestMap::const_iterator itr = _questTemplates.find(quest_id);
|
||||
return itr != _questTemplates.end() ? itr->second : NULL;
|
||||
}
|
||||
|
||||
QuestMap const& GetQuestTemplates() const { return mQuestTemplates; }
|
||||
QuestMap const& GetQuestTemplates() const { return _questTemplates; }
|
||||
|
||||
uint32 GetQuestForAreaTrigger(uint32 Trigger_ID) const
|
||||
{
|
||||
QuestAreaTriggerMap::const_iterator itr = mQuestAreaTriggerMap.find(Trigger_ID);
|
||||
if (itr != mQuestAreaTriggerMap.end())
|
||||
QuestAreaTriggerContainer::const_iterator itr = _questAreaTriggerStore.find(Trigger_ID);
|
||||
if (itr != _questAreaTriggerStore.end())
|
||||
return itr->second;
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool IsTavernAreaTrigger(uint32 Trigger_ID) const
|
||||
{
|
||||
return mTavernAreaTriggerSet.find(Trigger_ID) != mTavernAreaTriggerSet.end();
|
||||
return _tavernAreaTriggerStore.find(Trigger_ID) != _tavernAreaTriggerStore.end();
|
||||
}
|
||||
|
||||
bool IsGameObjectForQuests(uint32 entry) const
|
||||
{
|
||||
return mGameObjectForQuestSet.find(entry) != mGameObjectForQuestSet.end();
|
||||
return _gameObjectForQuestStore.find(entry) != _gameObjectForQuestStore.end();
|
||||
}
|
||||
|
||||
GossipText const* GetGossipText(uint32 Text_ID) const;
|
||||
@@ -720,16 +718,16 @@ class ObjectMgr
|
||||
|
||||
AreaTrigger const* GetAreaTrigger(uint32 trigger) const
|
||||
{
|
||||
AreaTriggerMap::const_iterator itr = mAreaTriggers.find(trigger);
|
||||
if (itr != mAreaTriggers.end())
|
||||
AreaTriggerContainer::const_iterator itr = _areaTriggerStore.find(trigger);
|
||||
if (itr != _areaTriggerStore.end())
|
||||
return &itr->second;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
AccessRequirement const* GetAccessRequirement(uint32 mapid, Difficulty difficulty) const
|
||||
{
|
||||
AccessRequirementMap::const_iterator itr = mAccessRequirements.find(MAKE_PAIR32(mapid, difficulty));
|
||||
if (itr != mAccessRequirements.end())
|
||||
AccessRequirementContainer::const_iterator itr = _accessRequirementStore.find(MAKE_PAIR32(mapid, difficulty));
|
||||
if (itr != _accessRequirementStore.end())
|
||||
return &itr->second;
|
||||
return NULL;
|
||||
}
|
||||
@@ -742,8 +740,8 @@ class ObjectMgr
|
||||
|
||||
RepRewardRate const* GetRepRewardRate(uint32 factionId) const
|
||||
{
|
||||
RepRewardRateMap::const_iterator itr = m_RepRewardRateMap.find(factionId);
|
||||
if (itr != m_RepRewardRateMap.end())
|
||||
RepRewardRateContainer::const_iterator itr = _repRewardRateStore.find(factionId);
|
||||
if (itr != _repRewardRateStore.end())
|
||||
return &itr->second;
|
||||
|
||||
return NULL;
|
||||
@@ -751,16 +749,16 @@ class ObjectMgr
|
||||
|
||||
ReputationOnKillEntry const* GetReputationOnKilEntry(uint32 id) const
|
||||
{
|
||||
RepOnKillMap::const_iterator itr = mRepOnKill.find(id);
|
||||
if (itr != mRepOnKill.end())
|
||||
RepOnKillContainer::const_iterator itr = _repOnKillStore.find(id);
|
||||
if (itr != _repOnKillStore.end())
|
||||
return &itr->second;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
RepSpilloverTemplate const* GetRepSpilloverTemplate(uint32 factionId) const
|
||||
{
|
||||
RepSpilloverTemplateMap::const_iterator itr = m_RepSpilloverTemplateMap.find(factionId);
|
||||
if (itr != m_RepSpilloverTemplateMap.end())
|
||||
RepSpilloverTemplateContainer::const_iterator itr = _repSpilloverTemplateStore.find(factionId);
|
||||
if (itr != _repSpilloverTemplateStore.end())
|
||||
return &itr->second;
|
||||
|
||||
return NULL;
|
||||
@@ -768,16 +766,16 @@ class ObjectMgr
|
||||
|
||||
PointOfInterest const* GetPointOfInterest(uint32 id) const
|
||||
{
|
||||
PointOfInterestMap::const_iterator itr = mPointsOfInterest.find(id);
|
||||
if (itr != mPointsOfInterest.end())
|
||||
PointOfInterestContainer::const_iterator itr = _pointsOfInterestStore.find(id);
|
||||
if (itr != _pointsOfInterestStore.end())
|
||||
return &itr->second;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
QuestPOIVector const* GetQuestPOIVector(uint32 questId)
|
||||
{
|
||||
QuestPOIMap::const_iterator itr = mQuestPOIMap.find(questId);
|
||||
if (itr != mQuestPOIMap.end())
|
||||
QuestPOIContainer::const_iterator itr = _questPOIStore.find(questId);
|
||||
if (itr != _questPOIStore.end())
|
||||
return &itr->second;
|
||||
return NULL;
|
||||
}
|
||||
@@ -786,8 +784,8 @@ class ObjectMgr
|
||||
|
||||
DungeonEncounterList const* GetDungeonEncounterList(uint32 mapId, Difficulty difficulty)
|
||||
{
|
||||
UNORDERED_MAP<uint32, DungeonEncounterList>::const_iterator itr = mDungeonEncounters.find(MAKE_PAIR32(mapId, difficulty));
|
||||
if (itr != mDungeonEncounters.end())
|
||||
UNORDERED_MAP<uint32, DungeonEncounterList>::const_iterator itr = _dungeonEncounterStore.find(MAKE_PAIR32(mapId, difficulty));
|
||||
if (itr != _dungeonEncounterStore.end())
|
||||
return &itr->second;
|
||||
return NULL;
|
||||
}
|
||||
@@ -811,32 +809,32 @@ class ObjectMgr
|
||||
|
||||
QuestRelations* GetGOQuestRelationMap()
|
||||
{
|
||||
return &mGOQuestRelations;
|
||||
return &_goQuestRelations;
|
||||
}
|
||||
|
||||
QuestRelationBounds GetGOQuestRelationBounds(uint32 go_entry)
|
||||
{
|
||||
return mGOQuestRelations.equal_range(go_entry);
|
||||
return _goQuestRelations.equal_range(go_entry);
|
||||
}
|
||||
|
||||
QuestRelationBounds GetGOQuestInvolvedRelationBounds(uint32 go_entry)
|
||||
{
|
||||
return mGOQuestInvolvedRelations.equal_range(go_entry);
|
||||
return _goQuestInvolvedRelations.equal_range(go_entry);
|
||||
}
|
||||
|
||||
QuestRelations* GetCreatureQuestRelationMap()
|
||||
{
|
||||
return &mCreatureQuestRelations;
|
||||
return &_creatureQuestRelations;
|
||||
}
|
||||
|
||||
QuestRelationBounds GetCreatureQuestRelationBounds(uint32 creature_entry)
|
||||
{
|
||||
return mCreatureQuestRelations.equal_range(creature_entry);
|
||||
return _creatureQuestRelations.equal_range(creature_entry);
|
||||
}
|
||||
|
||||
QuestRelationBounds GetCreatureQuestInvolvedRelationBounds(uint32 creature_entry)
|
||||
{
|
||||
return mCreatureQuestInvolvedRelations.equal_range(creature_entry);
|
||||
return _creatureQuestInvolvedRelations.equal_range(creature_entry);
|
||||
}
|
||||
|
||||
void LoadGameObjectScripts();
|
||||
@@ -926,8 +924,8 @@ class ObjectMgr
|
||||
|
||||
int32 GetFishingBaseSkillLevel(uint32 entry) const
|
||||
{
|
||||
FishingBaseSkillMap::const_iterator itr = mFishingBaseForArea.find(entry);
|
||||
return itr != mFishingBaseForArea.end() ? itr->second : 0;
|
||||
FishingBaseSkillContainer::const_iterator itr = _fishingBaseForAreaStore.find(entry);
|
||||
return itr != _fishingBaseForAreaStore.end() ? itr->second : 0;
|
||||
}
|
||||
|
||||
void ReturnOrDeleteOldMails(bool serverUp);
|
||||
@@ -946,8 +944,8 @@ class ObjectMgr
|
||||
|
||||
MailLevelReward const* GetMailLevelReward(uint32 level, uint32 raceMask)
|
||||
{
|
||||
MailLevelRewardMap::const_iterator map_itr = m_mailLevelRewardMap.find(level);
|
||||
if (map_itr == m_mailLevelRewardMap.end())
|
||||
MailLevelRewardContainer::const_iterator map_itr = _mailLevelRewardStore.find(level);
|
||||
if (map_itr == _mailLevelRewardStore.end())
|
||||
return NULL;
|
||||
|
||||
for (MailLevelRewardList::const_iterator set_itr = map_itr->second.begin(); set_itr != map_itr->second.end(); ++set_itr)
|
||||
@@ -959,81 +957,81 @@ class ObjectMgr
|
||||
|
||||
CellObjectGuids const& GetCellObjectGuids(uint16 mapid, uint8 spawnMode, uint32 cell_id)
|
||||
{
|
||||
return mMapObjectGuids[MAKE_PAIR32(mapid, spawnMode)][cell_id];
|
||||
return _mapObjectGuidsStore[MAKE_PAIR32(mapid, spawnMode)][cell_id];
|
||||
}
|
||||
|
||||
CreatureData const* GetCreatureData(uint32 guid) const
|
||||
{
|
||||
CreatureDataMap::const_iterator itr = mCreatureDataMap.find(guid);
|
||||
if (itr == mCreatureDataMap.end()) return NULL;
|
||||
CreatureDataContainer::const_iterator itr = _creatureDataStore.find(guid);
|
||||
if (itr == _creatureDataStore.end()) return NULL;
|
||||
return &itr->second;
|
||||
}
|
||||
CreatureData& NewOrExistCreatureData(uint32 guid) { return mCreatureDataMap[guid]; }
|
||||
CreatureData& NewOrExistCreatureData(uint32 guid) { return _creatureDataStore[guid]; }
|
||||
void DeleteCreatureData(uint32 guid);
|
||||
uint64 GetLinkedRespawnGuid(uint64 guid) const
|
||||
{
|
||||
LinkedRespawnMap::const_iterator itr = mLinkedRespawnMap.find(guid);
|
||||
if (itr == mLinkedRespawnMap.end()) return 0;
|
||||
LinkedRespawnContainer::const_iterator itr = _linkedRespawnStore.find(guid);
|
||||
if (itr == _linkedRespawnStore.end()) return 0;
|
||||
return itr->second;
|
||||
}
|
||||
CreatureLocale const* GetCreatureLocale(uint32 entry) const
|
||||
{
|
||||
CreatureLocaleMap::const_iterator itr = mCreatureLocaleMap.find(entry);
|
||||
if (itr == mCreatureLocaleMap.end()) return NULL;
|
||||
CreatureLocaleContainer::const_iterator itr = _creatureLocaleStore.find(entry);
|
||||
if (itr == _creatureLocaleStore.end()) return NULL;
|
||||
return &itr->second;
|
||||
}
|
||||
GameObjectLocale const* GetGameObjectLocale(uint32 entry) const
|
||||
{
|
||||
GameObjectLocaleMap::const_iterator itr = mGameObjectLocaleMap.find(entry);
|
||||
if (itr == mGameObjectLocaleMap.end()) return NULL;
|
||||
GameObjectLocaleContainer::const_iterator itr = _gameObjectLocaleStore.find(entry);
|
||||
if (itr == _gameObjectLocaleStore.end()) return NULL;
|
||||
return &itr->second;
|
||||
}
|
||||
ItemLocale const* GetItemLocale(uint32 entry) const
|
||||
{
|
||||
ItemLocaleMap::const_iterator itr = mItemLocaleMap.find(entry);
|
||||
if (itr == mItemLocaleMap.end()) return NULL;
|
||||
ItemLocaleContainer::const_iterator itr = _itemLocaleStore.find(entry);
|
||||
if (itr == _itemLocaleStore.end()) return NULL;
|
||||
return &itr->second;
|
||||
}
|
||||
ItemSetNameLocale const* GetItemSetNameLocale(uint32 entry) const
|
||||
{
|
||||
ItemSetNameLocaleMap::const_iterator itr = mItemSetNameLocaleMap.find(entry);
|
||||
if (itr == mItemSetNameLocaleMap.end())return NULL;
|
||||
ItemSetNameLocaleContainer::const_iterator itr = _itemSetNameLocaleStore.find(entry);
|
||||
if (itr == _itemSetNameLocaleStore.end())return NULL;
|
||||
return &itr->second;
|
||||
}
|
||||
QuestLocale const* GetQuestLocale(uint32 entry) const
|
||||
{
|
||||
QuestLocaleMap::const_iterator itr = mQuestLocaleMap.find(entry);
|
||||
if (itr == mQuestLocaleMap.end()) return NULL;
|
||||
QuestLocaleContainer::const_iterator itr = _questLocaleStore.find(entry);
|
||||
if (itr == _questLocaleStore.end()) return NULL;
|
||||
return &itr->second;
|
||||
}
|
||||
NpcTextLocale const* GetNpcTextLocale(uint32 entry) const
|
||||
{
|
||||
NpcTextLocaleMap::const_iterator itr = mNpcTextLocaleMap.find(entry);
|
||||
if (itr == mNpcTextLocaleMap.end()) return NULL;
|
||||
NpcTextLocaleContainer::const_iterator itr = _npcTextLocaleStore.find(entry);
|
||||
if (itr == _npcTextLocaleStore.end()) return NULL;
|
||||
return &itr->second;
|
||||
}
|
||||
PageTextLocale const* GetPageTextLocale(uint32 entry) const
|
||||
{
|
||||
PageTextLocaleMap::const_iterator itr = mPageTextLocaleMap.find(entry);
|
||||
if (itr == mPageTextLocaleMap.end()) return NULL;
|
||||
PageTextLocaleContainer::const_iterator itr = _pageTextLocaleStore.find(entry);
|
||||
if (itr == _pageTextLocaleStore.end()) return NULL;
|
||||
return &itr->second;
|
||||
}
|
||||
GossipMenuItemsLocale const* GetGossipMenuItemsLocale(uint32 entry) const
|
||||
{
|
||||
GossipMenuItemsLocaleMap::const_iterator itr = mGossipMenuItemsLocaleMap.find(entry);
|
||||
if (itr == mGossipMenuItemsLocaleMap.end()) return NULL;
|
||||
GossipMenuItemsLocaleContainer::const_iterator itr = _gossipMenuItemsLocaleStore.find(entry);
|
||||
if (itr == _gossipMenuItemsLocaleStore.end()) return NULL;
|
||||
return &itr->second;
|
||||
}
|
||||
PointOfInterestLocale const* GetPointOfInterestLocale(uint32 poi_id) const
|
||||
{
|
||||
PointOfInterestLocaleMap::const_iterator itr = mPointOfInterestLocaleMap.find(poi_id);
|
||||
if (itr == mPointOfInterestLocaleMap.end()) return NULL;
|
||||
PointOfInterestLocaleContainer::const_iterator itr = _pointOfInterestLocaleStore.find(poi_id);
|
||||
if (itr == _pointOfInterestLocaleStore.end()) return NULL;
|
||||
return &itr->second;
|
||||
}
|
||||
|
||||
bool IsGoOfSpecificEntrySpawned(uint32 entry) const
|
||||
{
|
||||
for (GameObjectDataMap::const_iterator it = mGameObjectDataMap.begin(); it != mGameObjectDataMap.end(); ++it)
|
||||
for (GameObjectDataContainer::const_iterator it = _gameObjectDataStore.begin(); it != _gameObjectDataStore.end(); ++it)
|
||||
if (it->second.id == entry)
|
||||
return true;
|
||||
|
||||
@@ -1042,17 +1040,17 @@ class ObjectMgr
|
||||
|
||||
GameObjectData const* GetGOData(uint32 guid) const
|
||||
{
|
||||
GameObjectDataMap::const_iterator itr = mGameObjectDataMap.find(guid);
|
||||
if (itr == mGameObjectDataMap.end()) return NULL;
|
||||
GameObjectDataContainer::const_iterator itr = _gameObjectDataStore.find(guid);
|
||||
if (itr == _gameObjectDataStore.end()) return NULL;
|
||||
return &itr->second;
|
||||
}
|
||||
GameObjectData& NewGOData(uint32 guid) { return mGameObjectDataMap[guid]; }
|
||||
GameObjectData& NewGOData(uint32 guid) { return _gameObjectDataStore[guid]; }
|
||||
void DeleteGOData(uint32 guid);
|
||||
|
||||
TrinityStringLocale const* GetTrinityStringLocale(int32 entry) const
|
||||
{
|
||||
TrinityStringLocaleMap::const_iterator itr = mTrinityStringLocaleMap.find(entry);
|
||||
if (itr == mTrinityStringLocaleMap.end()) return NULL;
|
||||
TrinityStringLocaleContainer::const_iterator itr = _trinityStringLocaleStore.find(entry);
|
||||
if (itr == _trinityStringLocaleStore.end()) return NULL;
|
||||
return &itr->second;
|
||||
}
|
||||
const char *GetTrinityString(int32 entry, LocaleConstant locale_idx) const;
|
||||
@@ -1079,15 +1077,15 @@ class ObjectMgr
|
||||
|
||||
time_t GetCreatureRespawnTime(uint32 loguid, uint32 instance)
|
||||
{
|
||||
TRINITY_GUARD(ACE_Thread_Mutex, m_CreatureRespawnTimesMtx);
|
||||
return mCreatureRespawnTimes[MAKE_PAIR64(loguid, instance)];
|
||||
TRINITY_GUARD(ACE_Thread_Mutex, _creatureRespawnTimesMutex);
|
||||
return _creatureRespawnTimes[MAKE_PAIR64(loguid, instance)];
|
||||
}
|
||||
void SaveCreatureRespawnTime(uint32 loguid, uint32 instance, time_t t);
|
||||
void RemoveCreatureRespawnTime(uint32 loguid, uint32 instance);
|
||||
time_t GetGORespawnTime(uint32 loguid, uint32 instance)
|
||||
{
|
||||
TRINITY_GUARD(ACE_Thread_Mutex, m_GORespawnTimesMtx);
|
||||
return mGORespawnTimes[MAKE_PAIR64(loguid, instance)];
|
||||
TRINITY_GUARD(ACE_Thread_Mutex, _goRespawnTimesMutex);
|
||||
return _goRespawnTimes[MAKE_PAIR64(loguid, instance)];
|
||||
}
|
||||
void SaveGORespawnTime(uint32 loguid, uint32 instance, time_t t);
|
||||
void RemoveGORespawnTime(uint32 loguid, uint32 instance);
|
||||
@@ -1115,19 +1113,19 @@ class ObjectMgr
|
||||
|
||||
GameTele const* GetGameTele(uint32 id) const
|
||||
{
|
||||
GameTeleMap::const_iterator itr = m_GameTeleMap.find(id);
|
||||
if (itr == m_GameTeleMap.end()) return NULL;
|
||||
GameTeleContainer::const_iterator itr = _gameTeleStore.find(id);
|
||||
if (itr == _gameTeleStore.end()) return NULL;
|
||||
return &itr->second;
|
||||
}
|
||||
GameTele const* GetGameTele(const std::string& name) const;
|
||||
GameTeleMap const& GetGameTeleMap() const { return m_GameTeleMap; }
|
||||
GameTeleContainer const& GetGameTeleMap() const { return _gameTeleStore; }
|
||||
bool AddGameTele(GameTele& data);
|
||||
bool DeleteGameTele(const std::string& name);
|
||||
|
||||
TrainerSpellData const* GetNpcTrainerSpells(uint32 entry) const
|
||||
{
|
||||
CacheTrainerSpellMap::const_iterator iter = m_mCacheTrainerSpellMap.find(entry);
|
||||
if (iter == m_mCacheTrainerSpellMap.end())
|
||||
CacheTrainerSpellContainer::const_iterator iter = _cacheTrainerSpellStore.find(entry);
|
||||
if (iter == _cacheTrainerSpellStore.end())
|
||||
return NULL;
|
||||
|
||||
return &iter->second;
|
||||
@@ -1135,8 +1133,8 @@ class ObjectMgr
|
||||
|
||||
VendorItemData const* GetNpcVendorItemList(uint32 entry) const
|
||||
{
|
||||
CacheVendorItemMap::const_iterator iter = m_mCacheVendorItemMap.find(entry);
|
||||
if (iter == m_mCacheVendorItemMap.end())
|
||||
CacheVendorItemContainer::const_iterator iter = _cacheVendorItemStore.find(entry);
|
||||
if (iter == _cacheVendorItemStore.end())
|
||||
return NULL;
|
||||
|
||||
return &iter->second;
|
||||
@@ -1146,36 +1144,36 @@ class ObjectMgr
|
||||
bool IsVendorItemValid(uint32 vendor_entry, uint32 item, int32 maxcount, uint32 ptime, uint32 ExtendedCost, Player* player = NULL, std::set<uint32>* skip_vendors = NULL, uint32 ORnpcflag = 0) const;
|
||||
|
||||
void LoadScriptNames();
|
||||
ScriptNameMap &GetScriptNames() { return m_scriptNames; }
|
||||
const char * GetScriptName(uint32 id) { return id < m_scriptNames.size() ? m_scriptNames[id].c_str() : ""; }
|
||||
ScriptNameContainer &GetScriptNames() { return _scriptNamesStore; }
|
||||
const char * GetScriptName(uint32 id) { return id < _scriptNamesStore.size() ? _scriptNamesStore[id].c_str() : ""; }
|
||||
uint32 GetScriptId(const char *name);
|
||||
|
||||
SpellClickInfoMapBounds GetSpellClickInfoMapBounds(uint32 creature_id) const
|
||||
{
|
||||
return SpellClickInfoMapBounds(mSpellClickInfoMap.lower_bound(creature_id), mSpellClickInfoMap.upper_bound(creature_id));
|
||||
return SpellClickInfoMapBounds(_spellClickInfoStore.lower_bound(creature_id), _spellClickInfoStore.upper_bound(creature_id));
|
||||
}
|
||||
|
||||
GossipMenusMapBounds GetGossipMenusMapBounds(uint32 uiMenuId) const
|
||||
{
|
||||
return GossipMenusMapBounds(m_mGossipMenusMap.lower_bound(uiMenuId), m_mGossipMenusMap.upper_bound(uiMenuId));
|
||||
return GossipMenusMapBounds(_gossipMenusStore.lower_bound(uiMenuId), _gossipMenusStore.upper_bound(uiMenuId));
|
||||
}
|
||||
|
||||
GossipMenusMapBoundsNonConst GetGossipMenusMapBoundsNonConst(uint32 uiMenuId)
|
||||
{
|
||||
return GossipMenusMapBoundsNonConst(m_mGossipMenusMap.lower_bound(uiMenuId), m_mGossipMenusMap.upper_bound(uiMenuId));
|
||||
return GossipMenusMapBoundsNonConst(_gossipMenusStore.lower_bound(uiMenuId), _gossipMenusStore.upper_bound(uiMenuId));
|
||||
}
|
||||
|
||||
GossipMenuItemsMapBounds GetGossipMenuItemsMapBounds(uint32 uiMenuId) const
|
||||
{
|
||||
return GossipMenuItemsMapBounds(m_mGossipMenuItemsMap.lower_bound(uiMenuId), m_mGossipMenuItemsMap.upper_bound(uiMenuId));
|
||||
return GossipMenuItemsMapBounds(_gossipMenuItemsStore.lower_bound(uiMenuId), _gossipMenuItemsStore.upper_bound(uiMenuId));
|
||||
}
|
||||
GossipMenuItemsMapBoundsNonConst GetGossipMenuItemsMapBoundsNonConst(uint32 uiMenuId)
|
||||
{
|
||||
return GossipMenuItemsMapBoundsNonConst(m_mGossipMenuItemsMap.lower_bound(uiMenuId), m_mGossipMenuItemsMap.upper_bound(uiMenuId));
|
||||
return GossipMenuItemsMapBoundsNonConst(_gossipMenuItemsStore.lower_bound(uiMenuId), _gossipMenuItemsStore.upper_bound(uiMenuId));
|
||||
}
|
||||
|
||||
// for wintergrasp only
|
||||
GraveYardMap mGraveYardMap;
|
||||
GraveYardContainer GraveYardStore;
|
||||
|
||||
static void AddLocaleString(const std::string& s, LocaleConstant locale, StringVector& data);
|
||||
static inline void GetLocaleString(const StringVector& data, int loc_idx, std::string& value)
|
||||
@@ -1184,10 +1182,10 @@ class ObjectMgr
|
||||
value = data[loc_idx];
|
||||
}
|
||||
|
||||
CharacterConversionMap factionchange_achievements;
|
||||
CharacterConversionMap factionchange_items;
|
||||
CharacterConversionMap factionchange_spells;
|
||||
CharacterConversionMap factionchange_reputations;
|
||||
CharacterConversionMap FactionChange_Achievements;
|
||||
CharacterConversionMap FactionChange_Items;
|
||||
CharacterConversionMap FactionChange_Spells;
|
||||
CharacterConversionMap FactionChange_Reputation;
|
||||
|
||||
void LoadFactionChangeAchievements();
|
||||
void LoadFactionChangeItems();
|
||||
@@ -1196,80 +1194,73 @@ class ObjectMgr
|
||||
|
||||
private:
|
||||
// first free id for selected id type
|
||||
uint32 m_auctionid;
|
||||
uint64 m_equipmentSetGuid;
|
||||
uint32 m_ItemTextId;
|
||||
uint32 m_mailid;
|
||||
uint32 m_hiPetNumber;
|
||||
uint32 _auctionId;
|
||||
uint64 _equipmentSetGuid;
|
||||
uint32 _itemTextId;
|
||||
uint32 _mailId;
|
||||
uint32 _hiPetNumber;
|
||||
|
||||
// first free low guid for selected guid type
|
||||
uint32 m_hiCharGuid;
|
||||
uint32 m_hiCreatureGuid;
|
||||
uint32 m_hiPetGuid;
|
||||
uint32 m_hiVehicleGuid;
|
||||
uint32 m_hiItemGuid;
|
||||
uint32 m_hiGoGuid;
|
||||
uint32 m_hiDoGuid;
|
||||
uint32 m_hiCorpseGuid;
|
||||
uint32 m_hiMoTransGuid;
|
||||
uint32 _hiCharGuid;
|
||||
uint32 _hiCreatureGuid;
|
||||
uint32 _hiPetGuid;
|
||||
uint32 _hiVehicleGuid;
|
||||
uint32 _hiItemGuid;
|
||||
uint32 _hiGoGuid;
|
||||
uint32 _hiDoGuid;
|
||||
uint32 _hiCorpseGuid;
|
||||
uint32 _hiMoTransGuid;
|
||||
|
||||
QuestMap mQuestTemplates;
|
||||
QuestMap _questTemplates;
|
||||
|
||||
typedef UNORDERED_MAP<uint32, GossipText> GossipTextMap;
|
||||
typedef UNORDERED_MAP<uint32, uint32> QuestAreaTriggerMap;
|
||||
typedef std::set<uint32> TavernAreaTriggerSet;
|
||||
typedef std::set<uint32> GameObjectForQuestSet;
|
||||
typedef UNORDERED_MAP<uint32, GossipText> GossipTextContainer;
|
||||
typedef UNORDERED_MAP<uint32, uint32> QuestAreaTriggerContainer;
|
||||
typedef std::set<uint32> TavernAreaTriggerContainer;
|
||||
typedef std::set<uint32> GameObjectForQuestContainer;
|
||||
|
||||
QuestAreaTriggerMap mQuestAreaTriggerMap;
|
||||
TavernAreaTriggerSet mTavernAreaTriggerSet;
|
||||
GameObjectForQuestSet mGameObjectForQuestSet;
|
||||
GossipTextMap mGossipText;
|
||||
AreaTriggerMap mAreaTriggers;
|
||||
AreaTriggerScriptMap mAreaTriggerScripts;
|
||||
AccessRequirementMap mAccessRequirements;
|
||||
DungeonEncounterMap mDungeonEncounters;
|
||||
QuestAreaTriggerContainer _questAreaTriggerStore;
|
||||
TavernAreaTriggerContainer _tavernAreaTriggerStore;
|
||||
GameObjectForQuestContainer _gameObjectForQuestStore;
|
||||
GossipTextContainer _gossipTextStore;
|
||||
AreaTriggerContainer _areaTriggerStore;
|
||||
AreaTriggerScriptContainer _areaTriggerScriptStore;
|
||||
AccessRequirementContainer _accessRequirementStore;
|
||||
DungeonEncounterContainer _dungeonEncounterStore;
|
||||
|
||||
RepRewardRateMap m_RepRewardRateMap;
|
||||
RepOnKillMap mRepOnKill;
|
||||
RepSpilloverTemplateMap m_RepSpilloverTemplateMap;
|
||||
RepRewardRateContainer _repRewardRateStore;
|
||||
RepOnKillContainer _repOnKillStore;
|
||||
RepSpilloverTemplateContainer _repSpilloverTemplateStore;
|
||||
|
||||
GossipMenusMap m_mGossipMenusMap;
|
||||
GossipMenuItemsMap m_mGossipMenuItemsMap;
|
||||
PointOfInterestMap mPointsOfInterest;
|
||||
GossipMenusContainer _gossipMenusStore;
|
||||
GossipMenuItemsContainer _gossipMenuItemsStore;
|
||||
PointOfInterestContainer _pointsOfInterestStore;
|
||||
|
||||
QuestPOIMap mQuestPOIMap;
|
||||
QuestPOIContainer _questPOIStore;
|
||||
|
||||
QuestRelations mGOQuestRelations;
|
||||
QuestRelations mGOQuestInvolvedRelations;
|
||||
QuestRelations mCreatureQuestRelations;
|
||||
QuestRelations mCreatureQuestInvolvedRelations;
|
||||
QuestRelations _goQuestRelations;
|
||||
QuestRelations _goQuestInvolvedRelations;
|
||||
QuestRelations _creatureQuestRelations;
|
||||
QuestRelations _creatureQuestInvolvedRelations;
|
||||
|
||||
//character reserved names
|
||||
typedef std::set<std::wstring> ReservedNamesMap;
|
||||
ReservedNamesMap m_ReservedNames;
|
||||
typedef std::set<std::wstring> ReservedNamesContainer;
|
||||
ReservedNamesContainer _reservedNamesStore;
|
||||
|
||||
// GraveYardMap mGraveYardMap;
|
||||
GameTeleContainer _gameTeleStore;
|
||||
|
||||
GameTeleMap m_GameTeleMap;
|
||||
ScriptNameContainer _scriptNamesStore;
|
||||
|
||||
ScriptNameMap m_scriptNames;
|
||||
SpellClickInfoContainer _spellClickInfoStore;
|
||||
|
||||
SpellClickInfoMap mSpellClickInfoMap;
|
||||
SpellScriptsContainer _spellScriptsStore;
|
||||
|
||||
SpellScriptsMap mSpellScripts;
|
||||
|
||||
ItemRequiredTargetMap m_ItemRequiredTarget;
|
||||
|
||||
VehicleAccessoryMap m_VehicleTemplateAccessoryMap;
|
||||
VehicleAccessoryMap m_VehicleAccessoryMap;
|
||||
|
||||
typedef std::vector<LocaleConstant> LocalForIndex;
|
||||
LocalForIndex m_LocalForIndex;
|
||||
VehicleAccessoryContainer _vehicleTemplateAccessoryStore;
|
||||
VehicleAccessoryContainer _vehicleAccessoryStore;
|
||||
|
||||
LocaleConstant DBCLocaleIndex;
|
||||
|
||||
PageTextContainer PageTextStore;
|
||||
InstanceTemplateContainer InstanceTemplateStore;
|
||||
PageTextContainer _pageTextStore;
|
||||
InstanceTemplateContainer _instanceTemplateStore;
|
||||
|
||||
private:
|
||||
void LoadScripts(ScriptsType type);
|
||||
@@ -1277,68 +1268,68 @@ class ObjectMgr
|
||||
void LoadQuestRelationsHelper(QuestRelations& map, std::string table, bool starter, bool go);
|
||||
void PlayerCreateInfoAddItemHelper(uint32 race_, uint32 class_, uint32 itemId, int32 count);
|
||||
|
||||
MailLevelRewardMap m_mailLevelRewardMap;
|
||||
MailLevelRewardContainer _mailLevelRewardStore;
|
||||
|
||||
CreatureBaseStatsMap m_creatureBaseStatsMap;
|
||||
CreatureBaseStatsContainer _creatureBaseStatsStore;
|
||||
|
||||
typedef std::map<uint32, PetLevelInfo*> PetLevelInfoMap;
|
||||
// PetLevelInfoMap[creature_id][level]
|
||||
PetLevelInfoMap petInfo; // [creature_id][level]
|
||||
typedef std::map<uint32, PetLevelInfo*> PetLevelInfoContainer;
|
||||
// PetLevelInfoContainer[creature_id][level]
|
||||
PetLevelInfoContainer _petInfoStore; // [creature_id][level]
|
||||
|
||||
PlayerClassInfo playerClassInfo[MAX_CLASSES];
|
||||
PlayerClassInfo _playerClassInfo[MAX_CLASSES];
|
||||
|
||||
void BuildPlayerLevelInfo(uint8 race, uint8 class_, uint8 level, PlayerLevelInfo* plinfo) const;
|
||||
|
||||
PlayerInfo playerInfo[MAX_RACES][MAX_CLASSES];
|
||||
PlayerInfo _playerInfo[MAX_RACES][MAX_CLASSES];
|
||||
|
||||
typedef std::vector<uint32> PlayerXPperLevel; // [level]
|
||||
PlayerXPperLevel mPlayerXPperLevel;
|
||||
PlayerXPperLevel _playerXPperLevel;
|
||||
|
||||
typedef std::map<uint32, uint32> BaseXPMap; // [area level][base xp]
|
||||
BaseXPMap mBaseXPTable;
|
||||
typedef std::map<uint32, uint32> BaseXPContainer; // [area level][base xp]
|
||||
BaseXPContainer _baseXPTable;
|
||||
|
||||
typedef std::map<uint32, int32> FishingBaseSkillMap; // [areaId][base skill level]
|
||||
FishingBaseSkillMap mFishingBaseForArea;
|
||||
typedef std::map<uint32, int32> FishingBaseSkillContainer; // [areaId][base skill level]
|
||||
FishingBaseSkillContainer _fishingBaseForAreaStore;
|
||||
|
||||
typedef std::map<uint32, StringVector> HalfNameMap;
|
||||
HalfNameMap PetHalfName0;
|
||||
HalfNameMap PetHalfName1;
|
||||
typedef std::map<uint32, StringVector> HalfNameContainer;
|
||||
HalfNameContainer _petHalfName0;
|
||||
HalfNameContainer _petHalfName1;
|
||||
|
||||
typedef UNORDERED_MAP<uint32, ItemSetNameEntry> ItemSetNameMap;
|
||||
ItemSetNameMap mItemSetNameMap;
|
||||
typedef UNORDERED_MAP<uint32, ItemSetNameEntry> ItemSetNameContainer;
|
||||
ItemSetNameContainer _itemSetNameStore;
|
||||
|
||||
MapObjectGuids mMapObjectGuids;
|
||||
CreatureDataMap mCreatureDataMap;
|
||||
CreatureTemplateContainer CreatureTemplateStore;
|
||||
CreatureModelContainer CreatureModelStore;
|
||||
CreatureAddonContainer CreatureAddonStore;
|
||||
CreatureAddonContainer CreatureTemplateAddonStore;
|
||||
EquipmentInfoContainer EquipmentInfoStore;
|
||||
LinkedRespawnMap mLinkedRespawnMap;
|
||||
CreatureLocaleMap mCreatureLocaleMap;
|
||||
GameObjectDataMap mGameObjectDataMap;
|
||||
GameObjectLocaleMap mGameObjectLocaleMap;
|
||||
GameObjectTemplateContainer GameObjectTemplateStore;
|
||||
MapObjectGuids _mapObjectGuidsStore;
|
||||
CreatureDataContainer _creatureDataStore;
|
||||
CreatureTemplateContainer _creatureTemplateStore;
|
||||
CreatureModelContainer _creatureModelStore;
|
||||
CreatureAddonContainer _creatureAddonStore;
|
||||
CreatureAddonContainer _creatureTemplateAddonStore;
|
||||
EquipmentInfoContainer _equipmentInfoStore;
|
||||
LinkedRespawnContainer _linkedRespawnStore;
|
||||
CreatureLocaleContainer _creatureLocaleStore;
|
||||
GameObjectDataContainer _gameObjectDataStore;
|
||||
GameObjectLocaleContainer _gameObjectLocaleStore;
|
||||
GameObjectTemplateContainer _gameObjectTemplateStore;
|
||||
|
||||
ItemTemplateContainer ItemTemplateStore;
|
||||
ItemLocaleMap mItemLocaleMap;
|
||||
ItemSetNameLocaleMap mItemSetNameLocaleMap;
|
||||
QuestLocaleMap mQuestLocaleMap;
|
||||
NpcTextLocaleMap mNpcTextLocaleMap;
|
||||
PageTextLocaleMap mPageTextLocaleMap;
|
||||
TrinityStringLocaleMap mTrinityStringLocaleMap;
|
||||
GossipMenuItemsLocaleMap mGossipMenuItemsLocaleMap;
|
||||
PointOfInterestLocaleMap mPointOfInterestLocaleMap;
|
||||
RespawnTimes mCreatureRespawnTimes;
|
||||
ACE_Thread_Mutex m_CreatureRespawnTimesMtx;
|
||||
RespawnTimes mGORespawnTimes;
|
||||
ACE_Thread_Mutex m_GORespawnTimesMtx;
|
||||
ItemTemplateContainer _itemTemplateStore;
|
||||
ItemLocaleContainer _itemLocaleStore;
|
||||
ItemSetNameLocaleContainer _itemSetNameLocaleStore;
|
||||
QuestLocaleContainer _questLocaleStore;
|
||||
NpcTextLocaleContainer _npcTextLocaleStore;
|
||||
PageTextLocaleContainer _pageTextLocaleStore;
|
||||
TrinityStringLocaleContainer _trinityStringLocaleStore;
|
||||
GossipMenuItemsLocaleContainer _gossipMenuItemsLocaleStore;
|
||||
PointOfInterestLocaleContainer _pointOfInterestLocaleStore;
|
||||
RespawnTimes _creatureRespawnTimes;
|
||||
ACE_Thread_Mutex _creatureRespawnTimesMutex;
|
||||
RespawnTimes _goRespawnTimes;
|
||||
ACE_Thread_Mutex _goRespawnTimesMutex;
|
||||
|
||||
CacheVendorItemMap m_mCacheVendorItemMap;
|
||||
CacheTrainerSpellMap m_mCacheTrainerSpellMap;
|
||||
CacheVendorItemContainer _cacheVendorItemStore;
|
||||
CacheTrainerSpellContainer _cacheTrainerSpellStore;
|
||||
|
||||
std::set<uint32> difficultyEntries[MAX_DIFFICULTY - 1]; // already loaded difficulty 1 value in creatures, used in CheckCreatureTemplate
|
||||
std::set<uint32> hasDifficultyEntries[MAX_DIFFICULTY - 1]; // already loaded creatures with difficulty 1 values, used in CheckCreatureTemplate
|
||||
std::set<uint32> _difficultyEntries[MAX_DIFFICULTY - 1]; // already loaded difficulty 1 value in creatures, used in CheckCreatureTemplate
|
||||
std::set<uint32> _hasDifficultyEntries[MAX_DIFFICULTY - 1]; // already loaded creatures with difficulty 1 values, used in CheckCreatureTemplate
|
||||
|
||||
enum CreatureLinkedRespawnType
|
||||
{
|
||||
|
||||
@@ -1853,7 +1853,7 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recv_data)
|
||||
trans->Append(stmt);
|
||||
|
||||
// Achievement conversion
|
||||
for (std::map<uint32, uint32>::const_iterator it = sObjectMgr->factionchange_achievements.begin(); it != sObjectMgr->factionchange_achievements.end(); ++it)
|
||||
for (std::map<uint32, uint32>::const_iterator it = sObjectMgr->FactionChange_Achievements.begin(); it != sObjectMgr->FactionChange_Achievements.end(); ++it)
|
||||
{
|
||||
uint32 achiev_alliance = it->first;
|
||||
uint32 achiev_horde = it->second;
|
||||
@@ -1864,7 +1864,7 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recv_data)
|
||||
}
|
||||
|
||||
// Item conversion
|
||||
for (std::map<uint32, uint32>::const_iterator it = sObjectMgr->factionchange_items.begin(); it != sObjectMgr->factionchange_items.end(); ++it)
|
||||
for (std::map<uint32, uint32>::const_iterator it = sObjectMgr->FactionChange_Items.begin(); it != sObjectMgr->FactionChange_Items.end(); ++it)
|
||||
{
|
||||
uint32 item_alliance = it->first;
|
||||
uint32 item_horde = it->second;
|
||||
@@ -1873,7 +1873,7 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recv_data)
|
||||
}
|
||||
|
||||
// Spell conversion
|
||||
for (std::map<uint32, uint32>::const_iterator it = sObjectMgr->factionchange_spells.begin(); it != sObjectMgr->factionchange_spells.end(); ++it)
|
||||
for (std::map<uint32, uint32>::const_iterator it = sObjectMgr->FactionChange_Spells.begin(); it != sObjectMgr->FactionChange_Spells.end(); ++it)
|
||||
{
|
||||
uint32 spell_alliance = it->first;
|
||||
uint32 spell_horde = it->second;
|
||||
@@ -1884,7 +1884,7 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recv_data)
|
||||
}
|
||||
|
||||
// Reputation conversion
|
||||
for (std::map<uint32, uint32>::const_iterator it = sObjectMgr->factionchange_reputations.begin(); it != sObjectMgr->factionchange_reputations.end(); ++it)
|
||||
for (std::map<uint32, uint32>::const_iterator it = sObjectMgr->FactionChange_Reputation.begin(); it != sObjectMgr->FactionChange_Reputation.end(); ++it)
|
||||
{
|
||||
uint32 reputation_alliance = it->first;
|
||||
uint32 reputation_horde = it->second;
|
||||
|
||||
@@ -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;
|
||||
_liquidData = 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[] _liquidData;
|
||||
delete[] _liquidMap;
|
||||
_areaMap = NULL;
|
||||
m_V9 = NULL;
|
||||
m_V8 = NULL;
|
||||
m_liquid_type = NULL;
|
||||
m_liquid_map = NULL;
|
||||
m_gridGetHeight = &GridMap::getHeightFromFlat;
|
||||
_liquidData = 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)
|
||||
_liquidData = new uint8 [16*16];
|
||||
if (fread(_liquidData, 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 (!_liquidData)
|
||||
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 _liquidData[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 && !_liquidData)
|
||||
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 = _liquidData ? _liquidData[(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* _liquidData;
|
||||
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;
|
||||
|
||||
@@ -83,24 +83,20 @@ 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;
|
||||
typedef std::vector<_Ty> ExpireList;
|
||||
ExpireList* _expList;
|
||||
_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
|
||||
|
||||
@@ -395,7 +395,7 @@ void ScriptMgr::CreateSpellScripts(uint32 spellId, std::list<SpellScript*>& scri
|
||||
{
|
||||
SpellScriptsBounds bounds = sObjectMgr->GetSpellScriptsBounds(spellId);
|
||||
|
||||
for (SpellScriptsMap::iterator itr = bounds.first; itr != bounds.second; ++itr)
|
||||
for (SpellScriptsContainer::iterator itr = bounds.first; itr != bounds.second; ++itr)
|
||||
{
|
||||
SpellScriptLoader* tmpscript = ScriptRegistry<SpellScriptLoader>::GetScriptById(itr->second);
|
||||
if (!tmpscript)
|
||||
@@ -416,7 +416,7 @@ void ScriptMgr::CreateAuraScripts(uint32 spellId, std::list<AuraScript*>& script
|
||||
{
|
||||
SpellScriptsBounds bounds = sObjectMgr->GetSpellScriptsBounds(spellId);
|
||||
|
||||
for (SpellScriptsMap::iterator itr = bounds.first; itr != bounds.second; ++itr)
|
||||
for (SpellScriptsContainer::iterator itr = bounds.first; itr != bounds.second; ++itr)
|
||||
{
|
||||
SpellScriptLoader* tmpscript = ScriptRegistry<SpellScriptLoader>::GetScriptById(itr->second);
|
||||
if (!tmpscript)
|
||||
@@ -433,12 +433,12 @@ void ScriptMgr::CreateAuraScripts(uint32 spellId, std::list<AuraScript*>& script
|
||||
}
|
||||
}
|
||||
|
||||
void ScriptMgr::CreateSpellScriptLoaders(uint32 spellId, std::vector<std::pair<SpellScriptLoader*, SpellScriptsMap::iterator> >& scriptVector)
|
||||
void ScriptMgr::CreateSpellScriptLoaders(uint32 spellId, std::vector<std::pair<SpellScriptLoader*, SpellScriptsContainer::iterator> >& scriptVector)
|
||||
{
|
||||
SpellScriptsBounds bounds = sObjectMgr->GetSpellScriptsBounds(spellId);
|
||||
scriptVector.reserve(std::distance(bounds.first, bounds.second));
|
||||
|
||||
for (SpellScriptsMap::iterator itr = bounds.first; itr != bounds.second; ++itr)
|
||||
for (SpellScriptsContainer::iterator itr = bounds.first; itr != bounds.second; ++itr)
|
||||
{
|
||||
SpellScriptLoader* tmpscript = ScriptRegistry<SpellScriptLoader>::GetScriptById(itr->second);
|
||||
if (!tmpscript)
|
||||
@@ -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);
|
||||
};
|
||||
|
||||
@@ -1928,15 +1928,15 @@ WorldObject* Spell::SearchNearbyTarget(float range, SpellTargets TargetType, Spe
|
||||
|
||||
for (ConditionList::const_iterator i_spellST = conditions.begin(); i_spellST != conditions.end(); ++i_spellST)
|
||||
{
|
||||
if ((*i_spellST)->mConditionType != CONDITION_SPELL_SCRIPT_TARGET)
|
||||
if ((*i_spellST)->ConditionType != CONDITION_SPELL_SCRIPT_TARGET)
|
||||
continue;
|
||||
if ((*i_spellST)->mConditionValue3 && !((*i_spellST)->mConditionValue3 & (1 << uint32(effIndex))))
|
||||
if ((*i_spellST)->ConditionValue3 && !((*i_spellST)->ConditionValue3 & (1 << uint32(effIndex))))
|
||||
continue;
|
||||
switch ((*i_spellST)->mConditionValue1)
|
||||
switch ((*i_spellST)->ConditionValue1)
|
||||
{
|
||||
case SPELL_TARGET_TYPE_CONTROLLED:
|
||||
for (Unit::ControlList::iterator itr = m_caster->m_Controlled.begin(); itr != m_caster->m_Controlled.end(); ++itr)
|
||||
if ((*itr)->GetEntry() == (*i_spellST)->mConditionValue2 && (*itr)->IsWithinDistInMap(m_caster, range))
|
||||
if ((*itr)->GetEntry() == (*i_spellST)->ConditionValue2 && (*itr)->IsWithinDistInMap(m_caster, range))
|
||||
{
|
||||
goScriptTarget = NULL;
|
||||
creatureScriptTarget = (*itr)->ToCreature();
|
||||
@@ -1944,9 +1944,9 @@ WorldObject* Spell::SearchNearbyTarget(float range, SpellTargets TargetType, Spe
|
||||
}
|
||||
break;
|
||||
case SPELL_TARGET_TYPE_GAMEOBJECT:
|
||||
if ((*i_spellST)->mConditionValue2)
|
||||
if ((*i_spellST)->ConditionValue2)
|
||||
{
|
||||
if (GameObject* go = m_caster->FindNearestGameObject((*i_spellST)->mConditionValue2, range))
|
||||
if (GameObject* go = m_caster->FindNearestGameObject((*i_spellST)->ConditionValue2, range))
|
||||
{
|
||||
// remember found target and range, next attempt will find more near target with another entry
|
||||
goScriptTarget = go;
|
||||
@@ -1966,11 +1966,11 @@ WorldObject* Spell::SearchNearbyTarget(float range, SpellTargets TargetType, Spe
|
||||
}
|
||||
break;
|
||||
case SPELL_TARGET_TYPE_CREATURE:
|
||||
if (m_targets.GetUnitTarget() && m_targets.GetUnitTarget()->GetEntry() == (*i_spellST)->mConditionValue2)
|
||||
if (m_targets.GetUnitTarget() && m_targets.GetUnitTarget()->GetEntry() == (*i_spellST)->ConditionValue2)
|
||||
return m_targets.GetUnitTarget();
|
||||
case SPELL_TARGET_TYPE_DEAD:
|
||||
default:
|
||||
if (Creature* cre = m_caster->FindNearestCreature((*i_spellST)->mConditionValue2, range, (*i_spellST)->mConditionValue1 != SPELL_TARGET_TYPE_DEAD))
|
||||
if (Creature* cre = m_caster->FindNearestCreature((*i_spellST)->ConditionValue2, range, (*i_spellST)->ConditionValue1 != SPELL_TARGET_TYPE_DEAD))
|
||||
{
|
||||
creatureScriptTarget = cre;
|
||||
goScriptTarget = NULL;
|
||||
@@ -2531,16 +2531,16 @@ uint32 Spell::SelectEffectTargets(uint32 i, SpellImplicitTargetInfo const& cur)
|
||||
{
|
||||
for (ConditionList::const_iterator i_spellST = conditions.begin(); i_spellST != conditions.end(); ++i_spellST)
|
||||
{
|
||||
if ((*i_spellST)->mConditionType != CONDITION_SPELL_SCRIPT_TARGET)
|
||||
if ((*i_spellST)->ConditionType != CONDITION_SPELL_SCRIPT_TARGET)
|
||||
continue;
|
||||
if ((*i_spellST)->mConditionValue3 && !((*i_spellST)->mConditionValue3 & effectMask))
|
||||
if ((*i_spellST)->ConditionValue3 && !((*i_spellST)->ConditionValue3 & effectMask))
|
||||
continue;
|
||||
if ((*i_spellST)->mConditionValue1 == SPELL_TARGET_TYPE_CREATURE)
|
||||
SearchAreaTarget(unitList, radius, pushType, SPELL_TARGETS_ENTRY, (*i_spellST)->mConditionValue2);
|
||||
else if ((*i_spellST)->mConditionValue1 == SPELL_TARGET_TYPE_CONTROLLED)
|
||||
if ((*i_spellST)->ConditionValue1 == SPELL_TARGET_TYPE_CREATURE)
|
||||
SearchAreaTarget(unitList, radius, pushType, SPELL_TARGETS_ENTRY, (*i_spellST)->ConditionValue2);
|
||||
else if ((*i_spellST)->ConditionValue1 == SPELL_TARGET_TYPE_CONTROLLED)
|
||||
{
|
||||
for (Unit::ControlList::iterator itr = m_caster->m_Controlled.begin(); itr != m_caster->m_Controlled.end(); ++itr)
|
||||
if ((*itr)->GetEntry() == (*i_spellST)->mConditionValue2 &&
|
||||
if ((*itr)->GetEntry() == (*i_spellST)->ConditionValue2 &&
|
||||
(*itr)->IsInMap(m_caster)) // For 60243 and 52173 need skip radius check or use range (no radius entry for effect)
|
||||
unitList.push_back(*itr);
|
||||
}
|
||||
@@ -2626,12 +2626,12 @@ uint32 Spell::SelectEffectTargets(uint32 i, SpellImplicitTargetInfo const& cur)
|
||||
{
|
||||
for (ConditionList::const_iterator i_spellST = conditions.begin(); i_spellST != conditions.end(); ++i_spellST)
|
||||
{
|
||||
if ((*i_spellST)->mConditionType != CONDITION_SPELL_SCRIPT_TARGET)
|
||||
if ((*i_spellST)->ConditionType != CONDITION_SPELL_SCRIPT_TARGET)
|
||||
continue;
|
||||
if ((*i_spellST)->mConditionValue3 && !((*i_spellST)->mConditionValue3 & effectMask))
|
||||
if ((*i_spellST)->ConditionValue3 && !((*i_spellST)->ConditionValue3 & effectMask))
|
||||
continue;
|
||||
if ((*i_spellST)->mConditionValue1 == SPELL_TARGET_TYPE_GAMEOBJECT)
|
||||
SearchGOAreaTarget(gobjectList, radius, pushType, SPELL_TARGETS_GO, (*i_spellST)->mConditionValue2);
|
||||
if ((*i_spellST)->ConditionValue1 == SPELL_TARGET_TYPE_GAMEOBJECT)
|
||||
SearchGOAreaTarget(gobjectList, radius, pushType, SPELL_TARGETS_GO, (*i_spellST)->ConditionValue2);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -3481,14 +3481,6 @@ void Spell::update(uint32 difftime)
|
||||
{
|
||||
if (m_timer > 0)
|
||||
{
|
||||
// Cancel the cast if the target is not in line of sight
|
||||
if (m_targets.GetUnitTarget() && !m_caster->IsWithinLOSInMap(m_targets.GetUnitTarget()))
|
||||
{
|
||||
SendCastResult(SPELL_FAILED_LINE_OF_SIGHT);
|
||||
cancel();
|
||||
return;
|
||||
}
|
||||
|
||||
if (difftime >= (uint32)m_timer)
|
||||
m_timer = 0;
|
||||
else
|
||||
@@ -4736,8 +4728,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;
|
||||
}
|
||||
|
||||
@@ -404,15 +404,15 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s
|
||||
|
||||
// make sure the same guid doesn't already exist and is safe to use
|
||||
bool incHighest = true;
|
||||
if (guid != 0 && guid < sObjectMgr->m_hiCharGuid)
|
||||
if (guid != 0 && guid < sObjectMgr->_hiCharGuid)
|
||||
{
|
||||
result = CharacterDatabase.PQuery("SELECT 1 FROM characters WHERE guid = '%d'", guid);
|
||||
if (result)
|
||||
guid = sObjectMgr->m_hiCharGuid; // use first free if exists
|
||||
guid = sObjectMgr->_hiCharGuid; // use first free if exists
|
||||
else incHighest = false;
|
||||
}
|
||||
else
|
||||
guid = sObjectMgr->m_hiCharGuid;
|
||||
guid = sObjectMgr->_hiCharGuid;
|
||||
|
||||
// normalize the name if specified and check if it exists
|
||||
if (!normalizePlayerName(name))
|
||||
@@ -564,15 +564,15 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s
|
||||
if (!changenth(line, 1, newguid)) // character_inventory.guid update
|
||||
ROLLBACK(DUMP_FILE_BROKEN);
|
||||
|
||||
if (!changeGuid(line, 2, items, sObjectMgr->m_hiItemGuid, true))
|
||||
if (!changeGuid(line, 2, items, sObjectMgr->_hiItemGuid, true))
|
||||
ROLLBACK(DUMP_FILE_BROKEN); // character_inventory.bag update
|
||||
if (!changeGuid(line, 4, items, sObjectMgr->m_hiItemGuid))
|
||||
if (!changeGuid(line, 4, items, sObjectMgr->_hiItemGuid))
|
||||
ROLLBACK(DUMP_FILE_BROKEN); // character_inventory.item update
|
||||
break;
|
||||
}
|
||||
case DTT_MAIL: // mail
|
||||
{
|
||||
if (!changeGuid(line, 1, mails, sObjectMgr->m_mailid))
|
||||
if (!changeGuid(line, 1, mails, sObjectMgr->_mailId))
|
||||
ROLLBACK(DUMP_FILE_BROKEN); // mail.id update
|
||||
if (!changenth(line, 6, newguid)) // mail.receiver update
|
||||
ROLLBACK(DUMP_FILE_BROKEN);
|
||||
@@ -580,9 +580,9 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s
|
||||
}
|
||||
case DTT_MAIL_ITEM: // mail_items
|
||||
{
|
||||
if (!changeGuid(line, 1, mails, sObjectMgr->m_mailid))
|
||||
if (!changeGuid(line, 1, mails, sObjectMgr->_mailId))
|
||||
ROLLBACK(DUMP_FILE_BROKEN); // mail_items.id
|
||||
if (!changeGuid(line, 2, items, sObjectMgr->m_hiItemGuid))
|
||||
if (!changeGuid(line, 2, items, sObjectMgr->_hiItemGuid))
|
||||
ROLLBACK(DUMP_FILE_BROKEN); // mail_items.item_guid
|
||||
if (!changenth(line, 3, newguid)) // mail_items.receiver
|
||||
ROLLBACK(DUMP_FILE_BROKEN);
|
||||
@@ -591,7 +591,7 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s
|
||||
case DTT_ITEM:
|
||||
{
|
||||
// item, owner, data field:item, owner guid
|
||||
if (!changeGuid(line, 1, items, sObjectMgr->m_hiItemGuid))
|
||||
if (!changeGuid(line, 1, items, sObjectMgr->_hiItemGuid))
|
||||
ROLLBACK(DUMP_FILE_BROKEN); // item_instance.guid update
|
||||
if (!changenth(line, 3, newguid)) // item_instance.owner_guid update
|
||||
ROLLBACK(DUMP_FILE_BROKEN);
|
||||
@@ -601,7 +601,7 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s
|
||||
{
|
||||
if (!changenth(line, 1, newguid)) // character_gifts.guid update
|
||||
ROLLBACK(DUMP_FILE_BROKEN);
|
||||
if (!changeGuid(line, 2, items, sObjectMgr->m_hiItemGuid))
|
||||
if (!changeGuid(line, 2, items, sObjectMgr->_hiItemGuid))
|
||||
ROLLBACK(DUMP_FILE_BROKEN); // character_gifts.item_guid update
|
||||
break;
|
||||
}
|
||||
@@ -662,11 +662,11 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s
|
||||
// in case of name conflict player has to rename at login anyway
|
||||
sWorld->AddCharacterNameData(guid, name, gender, race, playerClass);
|
||||
|
||||
sObjectMgr->m_hiItemGuid += items.size();
|
||||
sObjectMgr->m_mailid += mails.size();
|
||||
sObjectMgr->_hiItemGuid += items.size();
|
||||
sObjectMgr->_mailId += mails.size();
|
||||
|
||||
if (incHighest)
|
||||
++sObjectMgr->m_hiCharGuid;
|
||||
++sObjectMgr->_hiCharGuid;
|
||||
|
||||
fclose(fin);
|
||||
|
||||
|
||||
@@ -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