Core/Conditions: Type renaming

(cherry picked from commit 5e0cee85ddd67188365ead3f18206df088e1f0c7)
This commit is contained in:
Shauren committed 2015-10-31 20:26:40 +01:00
1 parent fc95812141
commit dc74454356
16 files changed
+122 -127

No files matched your search

+2
View File
@@ -43,6 +43,8 @@
#include <vector>
#include <array>
#include <boost/functional/hash.hpp>
#include "Debugging/Errors.h"
#include "Threading/LockedQueue.h"
+1 -1
View File
@@ -112,7 +112,7 @@ struct VehicleAI : public CreatureAI
private:
void LoadConditions();
void CheckConditions(uint32 diff);
ConditionList conditions;
ConditionContainer conditions;
uint32 m_ConditionsTimer;
bool m_DoDismiss;
uint32 m_DismissTimer;
@@ -90,7 +90,7 @@ void SmartScript::ProcessEventsFor(SMART_EVENT e, Unit* unit, uint32 var0, uint3
if (eventType == e /*&& (!i->event.event_phase_mask || IsInPhase(i->event.event_phase_mask)) && !(i->event.event_flags & SMART_EVENT_FLAG_NOT_REPEATABLE && i->runOnce)*/)
{
ConditionList conds = sConditionMgr->GetConditionsForSmartEvent(i->entryOrGuid, i->event_id, i->source_type);
ConditionContainer conds = sConditionMgr->GetConditionsForSmartEvent(i->entryOrGuid, i->event_id, i->source_type);
ConditionSourceInfo info = ConditionSourceInfo(unit, GetBaseObject());
if (sConditionMgr->IsObjectMeetToConditions(info, conds))
@@ -2322,7 +2322,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
void SmartScript::ProcessTimedAction(SmartScriptHolder& e, uint32 const& min, uint32 const& max, Unit* unit, uint32 var0, uint32 var1, bool bvar, const SpellInfo* spell, GameObject* gob)
{
ConditionList const conds = sConditionMgr->GetConditionsForSmartEvent(e.entryOrGuid, e.event_id, e.source_type);
ConditionContainer const conds = sConditionMgr->GetConditionsForSmartEvent(e.entryOrGuid, e.event_id, e.source_type);
ConditionSourceInfo info = ConditionSourceInfo(unit, GetBaseObject());
if (sConditionMgr->IsObjectMeetToConditions(info, conds))
+51 -51
View File
@@ -663,22 +663,22 @@ ConditionMgr::~ConditionMgr()
Clean();
}
ConditionList ConditionMgr::GetConditionReferences(uint32 refId)
ConditionContainer ConditionMgr::GetConditionReferences(uint32 refId)
{
ConditionList conditions;
ConditionContainer conditions;
ConditionReferenceContainer::const_iterator ref = ConditionReferenceStore.find(refId);
if (ref != ConditionReferenceStore.end())
conditions = (*ref).second;
return conditions;
}
uint32 ConditionMgr::GetSearcherTypeMaskForConditionList(ConditionList const& conditions)
uint32 ConditionMgr::GetSearcherTypeMaskForConditionList(ConditionContainer const& conditions)
{
if (conditions.empty())
return GRID_MAP_TYPE_MASK_ALL;
// groupId, typeMask
std::map<uint32, uint32> ElseGroupStore;
for (ConditionList::const_iterator i = conditions.begin(); i != conditions.end(); ++i)
for (ConditionContainer::const_iterator i = conditions.begin(); i != conditions.end(); ++i)
{
// no point of having not loaded conditions in list
ASSERT((*i)->isLoaded() && "ConditionMgr::GetSearcherTypeMaskForConditionList - not yet loaded condition found in list");
@@ -712,11 +712,11 @@ uint32 ConditionMgr::GetSearcherTypeMaskForConditionList(ConditionList const& co
return mask;
}
bool ConditionMgr::IsObjectMeetToConditionList(ConditionSourceInfo& sourceInfo, ConditionList const& conditions)
bool ConditionMgr::IsObjectMeetToConditionList(ConditionSourceInfo& sourceInfo, ConditionContainer const& conditions)
{
// groupId, groupCheckPassed
std::map<uint32, bool> ElseGroupStore;
for (ConditionList::const_iterator i = conditions.begin(); i != conditions.end(); ++i)
for (ConditionContainer::const_iterator i = conditions.begin(); i != conditions.end(); ++i)
{
TC_LOG_DEBUG("condition", "ConditionMgr::IsPlayerMeetToConditionList %s val1: %u", (*i)->ToString().c_str(), (*i)->ConditionValue1);
if ((*i)->isLoaded())
@@ -758,19 +758,19 @@ bool ConditionMgr::IsObjectMeetToConditionList(ConditionSourceInfo& sourceInfo,
return false;
}
bool ConditionMgr::IsObjectMeetToConditions(WorldObject* object, ConditionList const& conditions)
bool ConditionMgr::IsObjectMeetToConditions(WorldObject* object, ConditionContainer const& conditions)
{
ConditionSourceInfo srcInfo = ConditionSourceInfo(object);
return IsObjectMeetToConditions(srcInfo, conditions);
}
bool ConditionMgr::IsObjectMeetToConditions(WorldObject* object1, WorldObject* object2, ConditionList const& conditions)
bool ConditionMgr::IsObjectMeetToConditions(WorldObject* object1, WorldObject* object2, ConditionContainer const& conditions)
{
ConditionSourceInfo srcInfo = ConditionSourceInfo(object1, object2);
return IsObjectMeetToConditions(srcInfo, conditions);
}
bool ConditionMgr::IsObjectMeetToConditions(ConditionSourceInfo& sourceInfo, ConditionList const& conditions)
bool ConditionMgr::IsObjectMeetToConditions(ConditionSourceInfo& sourceInfo, ConditionContainer const& conditions)
{
if (conditions.empty())
return true;
@@ -807,15 +807,15 @@ bool ConditionMgr::CanHaveSourceIdSet(ConditionSourceType sourceType)
return (sourceType == CONDITION_SOURCE_TYPE_SMART_EVENT);
}
ConditionList ConditionMgr::GetConditionsForNotGroupedEntry(ConditionSourceType sourceType, uint32 entry)
ConditionContainer ConditionMgr::GetConditionsForNotGroupedEntry(ConditionSourceType sourceType, uint32 entry)
{
ConditionList spellCond;
ConditionContainer spellCond;
if (sourceType > CONDITION_SOURCE_TYPE_NONE && sourceType < CONDITION_SOURCE_TYPE_MAX)
{
ConditionContainer::const_iterator itr = ConditionStore.find(sourceType);
ConditionEntriesByTypeMap::const_iterator itr = ConditionStore.find(sourceType);
if (itr != ConditionStore.end())
{
ConditionTypeContainer::const_iterator i = (*itr).second.find(entry);
ConditionsByEntryMap::const_iterator i = (*itr).second.find(entry);
if (i != (*itr).second.end())
{
spellCond = (*i).second;
@@ -826,13 +826,13 @@ ConditionList ConditionMgr::GetConditionsForNotGroupedEntry(ConditionSourceType
return spellCond;
}
ConditionList ConditionMgr::GetConditionsForSpellClickEvent(uint32 creatureId, uint32 spellId)
ConditionContainer ConditionMgr::GetConditionsForSpellClickEvent(uint32 creatureId, uint32 spellId)
{
ConditionList cond;
CreatureSpellConditionContainer::const_iterator itr = SpellClickEventConditionStore.find(creatureId);
ConditionContainer cond;
ConditionEntriesByCreatureIdMap::const_iterator itr = SpellClickEventConditionStore.find(creatureId);
if (itr != SpellClickEventConditionStore.end())
{
ConditionTypeContainer::const_iterator i = (*itr).second.find(spellId);
ConditionsByEntryMap::const_iterator i = (*itr).second.find(spellId);
if (i != (*itr).second.end())
{
cond = (*i).second;
@@ -842,13 +842,13 @@ ConditionList ConditionMgr::GetConditionsForSpellClickEvent(uint32 creatureId, u
return cond;
}
ConditionList ConditionMgr::GetConditionsForVehicleSpell(uint32 creatureId, uint32 spellId)
ConditionContainer ConditionMgr::GetConditionsForVehicleSpell(uint32 creatureId, uint32 spellId)
{
ConditionList cond;
CreatureSpellConditionContainer::const_iterator itr = VehicleSpellConditionStore.find(creatureId);
ConditionContainer cond;
ConditionEntriesByCreatureIdMap::const_iterator itr = VehicleSpellConditionStore.find(creatureId);
if (itr != VehicleSpellConditionStore.end())
{
ConditionTypeContainer::const_iterator i = (*itr).second.find(spellId);
ConditionsByEntryMap::const_iterator i = (*itr).second.find(spellId);
if (i != (*itr).second.end())
{
cond = (*i).second;
@@ -858,13 +858,13 @@ ConditionList ConditionMgr::GetConditionsForVehicleSpell(uint32 creatureId, uint
return cond;
}
ConditionList ConditionMgr::GetConditionsForSmartEvent(int32 entryOrGuid, uint32 eventId, uint32 sourceType)
ConditionContainer ConditionMgr::GetConditionsForSmartEvent(int32 entryOrGuid, uint32 eventId, uint32 sourceType)
{
ConditionList cond;
ConditionContainer cond;
SmartEventConditionContainer::const_iterator itr = SmartEventConditionStore.find(std::make_pair(entryOrGuid, sourceType));
if (itr != SmartEventConditionStore.end())
{
ConditionTypeContainer::const_iterator i = (*itr).second.find(eventId + 1);
ConditionsByEntryMap::const_iterator i = (*itr).second.find(eventId + 1);
if (i != (*itr).second.end())
{
cond = (*i).second;
@@ -874,13 +874,13 @@ ConditionList ConditionMgr::GetConditionsForSmartEvent(int32 entryOrGuid, uint32
return cond;
}
ConditionList ConditionMgr::GetConditionsForNpcVendorEvent(uint32 creatureId, uint32 itemId)
ConditionContainer ConditionMgr::GetConditionsForNpcVendorEvent(uint32 creatureId, uint32 itemId)
{
ConditionList cond;
NpcVendorConditionContainer::const_iterator itr = NpcVendorConditionContainerStore.find(creatureId);
ConditionContainer cond;
ConditionEntriesByCreatureIdMap::const_iterator itr = NpcVendorConditionContainerStore.find(creatureId);
if (itr != NpcVendorConditionContainerStore.end())
{
ConditionTypeContainer::const_iterator i = (*itr).second.find(itemId);
ConditionsByEntryMap::const_iterator i = (*itr).second.find(itemId);
if (i != (*itr).second.end())
{
cond = (*i).second;
@@ -998,7 +998,7 @@ void ConditionMgr::LoadConditions(bool isReload)
uint32 uRefId = abs(iSourceTypeOrReferenceId);
if (ConditionReferenceStore.find(uRefId) == ConditionReferenceStore.end())//make sure we have a list for our conditions, based on reference id
{
ConditionList mCondList;
ConditionContainer mCondList;
ConditionReferenceStore[uRefId] = mCondList;
}
ConditionReferenceStore[uRefId].push_back(cond);//add to reference storage
@@ -1141,14 +1141,14 @@ void ConditionMgr::LoadConditions(bool isReload)
//make sure we have a storage list for our SourceType
if (ConditionStore.find(cond->SourceType) == ConditionStore.end())
{
ConditionTypeContainer mTypeMap;
ConditionsByEntryMap mTypeMap;
ConditionStore[cond->SourceType] = mTypeMap;//add new empty list for SourceType
}
//make sure we have a condition list for our SourceType's entry
if (ConditionStore[cond->SourceType].find(cond->SourceEntry) == ConditionStore[cond->SourceType].end())
{
ConditionList mCondList;
ConditionContainer mCondList;
ConditionStore[cond->SourceType][cond->SourceEntry] = mCondList;
}
@@ -1236,9 +1236,9 @@ bool ConditionMgr::addToSpellImplicitTargetConditions(Condition* cond)
continue;
// build new shared mask with found effect
uint32 sharedMask = (1 << i);
ConditionList* cmp = spellInfo->Effects[i].ImplicitTargetConditions;
for (uint8 effIndex = i+1; effIndex < MAX_SPELL_EFFECTS; ++effIndex)
uint32 sharedMask = 1 << i;
ConditionContainer* cmp = spellInfo->Effects[i].ImplicitTargetConditions;
for (uint8 effIndex = i + 1; effIndex < MAX_SPELL_EFFECTS; ++effIndex)
{
if (spellInfo->Effects[effIndex].ImplicitTargetConditions == cmp)
sharedMask |= 1 << effIndex;
@@ -1260,7 +1260,7 @@ bool ConditionMgr::addToSpellImplicitTargetConditions(Condition* cond)
return false;
// get shared data
ConditionList* sharedList = spellInfo->Effects[firstEffIndex].ImplicitTargetConditions;
ConditionContainer* sharedList = spellInfo->Effects[firstEffIndex].ImplicitTargetConditions;
// there's already data entry for that sharedMask
if (sharedList)
@@ -1277,7 +1277,7 @@ bool ConditionMgr::addToSpellImplicitTargetConditions(Condition* cond)
else
{
// add new list, create new shared mask
sharedList = new ConditionList();
sharedList = new ConditionContainer();
bool assigned = false;
for (uint8 i = firstEffIndex; i < MAX_SPELL_EFFECTS; ++i)
{
@@ -2114,18 +2114,18 @@ void ConditionMgr::Clean()
{
for (ConditionReferenceContainer::iterator itr = ConditionReferenceStore.begin(); itr != ConditionReferenceStore.end(); ++itr)
{
for (ConditionList::const_iterator it = itr->second.begin(); it != itr->second.end(); ++it)
for (ConditionContainer::const_iterator it = itr->second.begin(); it != itr->second.end(); ++it)
delete *it;
itr->second.clear();
}
ConditionReferenceStore.clear();
for (ConditionContainer::iterator itr = ConditionStore.begin(); itr != ConditionStore.end(); ++itr)
for (ConditionEntriesByTypeMap::iterator itr = ConditionStore.begin(); itr != ConditionStore.end(); ++itr)
{
for (ConditionTypeContainer::iterator it = itr->second.begin(); it != itr->second.end(); ++it)
for (ConditionsByEntryMap::iterator it = itr->second.begin(); it != itr->second.end(); ++it)
{
for (ConditionList::const_iterator i = it->second.begin(); i != it->second.end(); ++i)
for (ConditionContainer::const_iterator i = it->second.begin(); i != it->second.end(); ++i)
delete *i;
it->second.clear();
}
@@ -2134,11 +2134,11 @@ void ConditionMgr::Clean()
ConditionStore.clear();
for (CreatureSpellConditionContainer::iterator itr = VehicleSpellConditionStore.begin(); itr != VehicleSpellConditionStore.end(); ++itr)
for (ConditionEntriesByCreatureIdMap::iterator itr = VehicleSpellConditionStore.begin(); itr != VehicleSpellConditionStore.end(); ++itr)
{
for (ConditionTypeContainer::iterator it = itr->second.begin(); it != itr->second.end(); ++it)
for (ConditionsByEntryMap::iterator it = itr->second.begin(); it != itr->second.end(); ++it)
{
for (ConditionList::const_iterator i = it->second.begin(); i != it->second.end(); ++i)
for (ConditionContainer::const_iterator i = it->second.begin(); i != it->second.end(); ++i)
delete *i;
it->second.clear();
}
@@ -2149,9 +2149,9 @@ void ConditionMgr::Clean()
for (SmartEventConditionContainer::iterator itr = SmartEventConditionStore.begin(); itr != SmartEventConditionStore.end(); ++itr)
{
for (ConditionTypeContainer::iterator it = itr->second.begin(); it != itr->second.end(); ++it)
for (ConditionsByEntryMap::iterator it = itr->second.begin(); it != itr->second.end(); ++it)
{
for (ConditionList::const_iterator i = it->second.begin(); i != it->second.end(); ++i)
for (ConditionContainer::const_iterator i = it->second.begin(); i != it->second.end(); ++i)
delete *i;
it->second.clear();
}
@@ -2160,11 +2160,11 @@ void ConditionMgr::Clean()
SmartEventConditionStore.clear();
for (CreatureSpellConditionContainer::iterator itr = SpellClickEventConditionStore.begin(); itr != SpellClickEventConditionStore.end(); ++itr)
for (ConditionEntriesByCreatureIdMap::iterator itr = SpellClickEventConditionStore.begin(); itr != SpellClickEventConditionStore.end(); ++itr)
{
for (ConditionTypeContainer::iterator it = itr->second.begin(); it != itr->second.end(); ++it)
for (ConditionsByEntryMap::iterator it = itr->second.begin(); it != itr->second.end(); ++it)
{
for (ConditionList::const_iterator i = it->second.begin(); i != it->second.end(); ++i)
for (ConditionContainer::const_iterator i = it->second.begin(); i != it->second.end(); ++i)
delete *i;
it->second.clear();
}
@@ -2173,11 +2173,11 @@ void ConditionMgr::Clean()
SpellClickEventConditionStore.clear();
for (NpcVendorConditionContainer::iterator itr = NpcVendorConditionContainerStore.begin(); itr != NpcVendorConditionContainerStore.end(); ++itr)
for (ConditionEntriesByCreatureIdMap::iterator itr = NpcVendorConditionContainerStore.begin(); itr != NpcVendorConditionContainerStore.end(); ++itr)
{
for (ConditionTypeContainer::iterator it = itr->second.begin(); it != itr->second.end(); ++it)
for (ConditionsByEntryMap::iterator it = itr->second.begin(); it != itr->second.end(); ++it)
{
for (ConditionList::const_iterator i = it->second.begin(); i != it->second.end(); ++i)
for (ConditionContainer::const_iterator i = it->second.begin(); i != it->second.end(); ++i)
delete *i;
it->second.clear();
}
+24 -29
View File
@@ -19,11 +19,7 @@
#ifndef TRINITY_CONDITIONMGR_H
#define TRINITY_CONDITIONMGR_H
#include "Define.h"
#include "Errors.h"
#include <list>
#include <map>
#include <string>
#include "Common.h"
class Player;
class Unit;
@@ -217,14 +213,13 @@ struct Condition
std::string ToString(bool ext = false) const; /// For logging purpose
};
typedef std::list<Condition*> ConditionList;
typedef std::map<uint32, ConditionList> ConditionTypeContainer;
typedef std::map<ConditionSourceType, ConditionTypeContainer> ConditionContainer;
typedef std::map<uint32, ConditionTypeContainer> CreatureSpellConditionContainer;
typedef std::map<uint32, ConditionTypeContainer> NpcVendorConditionContainer;
typedef std::map<std::pair<int32, uint32 /*SAI source_type*/>, ConditionTypeContainer> SmartEventConditionContainer;
typedef std::list<Condition*> ConditionContainer;
typedef std::map<uint32 /*SourceEntry*/, ConditionContainer> ConditionsByEntryMap;
typedef std::map<ConditionSourceType /*SourceType*/, ConditionsByEntryMap> ConditionEntriesByTypeMap;
typedef std::map<uint32, ConditionsByEntryMap> ConditionEntriesByCreatureIdMap;
typedef std::map<std::pair<int32, uint32 /*SAI source_type*/>, ConditionsByEntryMap> SmartEventConditionContainer;
typedef std::map<uint32, ConditionList> ConditionReferenceContainer;//only used for references
typedef std::map<uint32, ConditionContainer> ConditionReferenceContainer;//only used for references
class ConditionMgr
{
@@ -241,19 +236,19 @@ class ConditionMgr
void LoadConditions(bool isReload = false);
bool isConditionTypeValid(Condition* cond);
ConditionList GetConditionReferences(uint32 refId);
ConditionContainer GetConditionReferences(uint32 refId);
uint32 GetSearcherTypeMaskForConditionList(ConditionList const& conditions);
bool IsObjectMeetToConditions(WorldObject* object, ConditionList const& conditions);
bool IsObjectMeetToConditions(WorldObject* object1, WorldObject* object2, ConditionList const& conditions);
bool IsObjectMeetToConditions(ConditionSourceInfo& sourceInfo, ConditionList const& conditions);
uint32 GetSearcherTypeMaskForConditionList(ConditionContainer const& conditions);
bool IsObjectMeetToConditions(WorldObject* object, ConditionContainer const& conditions);
bool IsObjectMeetToConditions(WorldObject* object1, WorldObject* object2, ConditionContainer const& conditions);
bool IsObjectMeetToConditions(ConditionSourceInfo& sourceInfo, ConditionContainer const& conditions);
static bool CanHaveSourceGroupSet(ConditionSourceType sourceType);
static bool CanHaveSourceIdSet(ConditionSourceType sourceType);
ConditionList GetConditionsForNotGroupedEntry(ConditionSourceType sourceType, uint32 entry);
ConditionList GetConditionsForSpellClickEvent(uint32 creatureId, uint32 spellId);
ConditionList GetConditionsForSmartEvent(int32 entryOrGuid, uint32 eventId, uint32 sourceType);
ConditionList GetConditionsForVehicleSpell(uint32 creatureId, uint32 spellId);
ConditionList GetConditionsForNpcVendorEvent(uint32 creatureId, uint32 itemId);
ConditionContainer GetConditionsForNotGroupedEntry(ConditionSourceType sourceType, uint32 entry);
ConditionContainer GetConditionsForSpellClickEvent(uint32 creatureId, uint32 spellId);
ConditionContainer GetConditionsForSmartEvent(int32 entryOrGuid, uint32 eventId, uint32 sourceType);
ConditionContainer GetConditionsForVehicleSpell(uint32 creatureId, uint32 spellId);
ConditionContainer GetConditionsForNpcVendorEvent(uint32 creatureId, uint32 itemId);
struct ConditionTypeInfo
{
@@ -271,19 +266,19 @@ class ConditionMgr
bool addToGossipMenus(Condition* cond);
bool addToGossipMenuItems(Condition* cond);
bool addToSpellImplicitTargetConditions(Condition* cond);
bool IsObjectMeetToConditionList(ConditionSourceInfo& sourceInfo, ConditionList const& conditions);
bool IsObjectMeetToConditionList(ConditionSourceInfo& sourceInfo, ConditionContainer const& conditions);
static void LogUselessConditionValue(Condition* cond, uint8 index, uint32 value);
void Clean(); // free up resources
std::list<Condition*> AllocatedMemoryStore; // some garbage collection :)
ConditionContainer ConditionStore;
ConditionReferenceContainer ConditionReferenceStore;
CreatureSpellConditionContainer VehicleSpellConditionStore;
CreatureSpellConditionContainer SpellClickEventConditionStore;
NpcVendorConditionContainer NpcVendorConditionContainerStore;
SmartEventConditionContainer SmartEventConditionStore;
ConditionEntriesByTypeMap ConditionStore;
ConditionReferenceContainer ConditionReferenceStore;
ConditionEntriesByCreatureIdMap VehicleSpellConditionStore;
ConditionEntriesByCreatureIdMap SpellClickEventConditionStore;
ConditionEntriesByCreatureIdMap NpcVendorConditionContainerStore;
SmartEventConditionContainer SmartEventConditionStore;
};
#define sConditionMgr ConditionMgr::instance()
@@ -21,10 +21,8 @@
#include "Common.h"
#include "ByteBuffer.h"
#include <type_traits>
#include <functional>
#include <unordered_set>
enum TypeID
{
+8 -8
View File
@@ -15643,7 +15643,7 @@ bool Player::SatisfyQuestStatus(Quest const* qInfo, bool msg)
bool Player::SatisfyQuestConditions(Quest const* qInfo, bool msg)
{
ConditionList conditions = sConditionMgr->GetConditionsForNotGroupedEntry(CONDITION_SOURCE_TYPE_QUEST_ACCEPT, qInfo->GetQuestId());
ConditionContainer conditions = sConditionMgr->GetConditionsForNotGroupedEntry(CONDITION_SOURCE_TYPE_QUEST_ACCEPT, qInfo->GetQuestId());
if (!sConditionMgr->IsObjectMeetToConditions(this, conditions))
{
if (msg)
@@ -16075,7 +16075,7 @@ QuestGiverStatus Player::GetQuestDialogStatus(Object* questgiver)
if (!quest)
continue;
ConditionList conditions = sConditionMgr->GetConditionsForNotGroupedEntry(CONDITION_SOURCE_TYPE_QUEST_SHOW_MARK, quest->GetQuestId());
ConditionContainer conditions = sConditionMgr->GetConditionsForNotGroupedEntry(CONDITION_SOURCE_TYPE_QUEST_SHOW_MARK, quest->GetQuestId());
if (!sConditionMgr->IsObjectMeetToConditions(this, conditions))
continue;
@@ -16103,7 +16103,7 @@ QuestGiverStatus Player::GetQuestDialogStatus(Object* questgiver)
if (!quest)
continue;
ConditionList conditions = sConditionMgr->GetConditionsForNotGroupedEntry(CONDITION_SOURCE_TYPE_QUEST_SHOW_MARK, quest->GetQuestId());
ConditionContainer conditions = sConditionMgr->GetConditionsForNotGroupedEntry(CONDITION_SOURCE_TYPE_QUEST_SHOW_MARK, quest->GetQuestId());
if (!sConditionMgr->IsObjectMeetToConditions(this, conditions))
continue;
@@ -20685,7 +20685,7 @@ void Player::VehicleSpellInitialize()
continue;
}
ConditionList conditions = sConditionMgr->GetConditionsForVehicleSpell(vehicle->GetEntry(), spellId);
ConditionContainer conditions = sConditionMgr->GetConditionsForVehicleSpell(vehicle->GetEntry(), spellId);
if (!sConditionMgr->IsObjectMeetToConditions(this, vehicle, conditions))
{
TC_LOG_DEBUG("condition", "VehicleSpellInitialize: conditions not met for Vehicle entry %u spell %u", vehicle->ToCreature()->GetEntry(), spellId);
@@ -21538,7 +21538,7 @@ bool Player::BuyItemFromVendorSlot(ObjectGuid vendorguid, uint32 vendorslot, uin
return false;
}
ConditionList conditions = sConditionMgr->GetConditionsForNpcVendorEvent(creature->GetEntry(), item);
ConditionContainer conditions = sConditionMgr->GetConditionsForNpcVendorEvent(creature->GetEntry(), item);
if (!sConditionMgr->IsObjectMeetToConditions(this, creature, conditions))
{
TC_LOG_DEBUG("condition", "BuyItemFromVendor: conditions not met for creature entry %u item %u", creature->GetEntry(), item);
@@ -23353,9 +23353,9 @@ void Player::UpdateForQuestWorldObjects()
{
//! This code doesn't look right, but it was logically converted to condition system to do the exact
//! same thing it did before. It definitely needs to be overlooked for intended functionality.
ConditionList conds = sConditionMgr->GetConditionsForSpellClickEvent(obj->GetEntry(), _itr->second.spellId);
ConditionContainer conds = sConditionMgr->GetConditionsForSpellClickEvent(obj->GetEntry(), _itr->second.spellId);
bool buildUpdateBlock = false;
for (ConditionList::const_iterator jtr = conds.begin(); jtr != conds.end() && !buildUpdateBlock; ++jtr)
for (ConditionContainer::const_iterator jtr = conds.begin(); jtr != conds.end() && !buildUpdateBlock; ++jtr)
if ((*jtr)->ConditionType == CONDITION_QUESTREWARDED || (*jtr)->ConditionType == CONDITION_QUESTTAKEN)
buildUpdateBlock = true;
@@ -25287,7 +25287,7 @@ bool Player::CanSeeSpellClickOn(Creature const* c) const
if (!itr->second.IsFitToRequirements(this, c))
return false;
ConditionList conds = sConditionMgr->GetConditionsForSpellClickEvent(c->GetEntry(), itr->second.spellId);
ConditionContainer conds = sConditionMgr->GetConditionsForSpellClickEvent(c->GetEntry(), itr->second.spellId);
ConditionSourceInfo info = ConditionSourceInfo(const_cast<Player*>(this), const_cast<Creature*>(c));
if (sConditionMgr->IsObjectMeetToConditions(info, conds))
return true;
+2 -2
View File
@@ -14181,7 +14181,7 @@ void Unit::ProcDamageAndSpellFor(bool isVictim, Unit* target, uint32 procFlag, u
continue;
// do checks using conditions table
ConditionList conditions = sConditionMgr->GetConditionsForNotGroupedEntry(CONDITION_SOURCE_TYPE_SPELL_PROC, spellProto->Id);
ConditionContainer conditions = sConditionMgr->GetConditionsForNotGroupedEntry(CONDITION_SOURCE_TYPE_SPELL_PROC, spellProto->Id);
ConditionSourceInfo condInfo = ConditionSourceInfo(eventInfo.GetActor(), eventInfo.GetActionTarget());
if (!sConditionMgr->IsObjectMeetToConditions(condInfo, conditions))
continue;
@@ -16887,7 +16887,7 @@ bool Unit::HandleSpellClick(Unit* clicker, int8 seatId)
continue;
//! Check database conditions
ConditionList conds = sConditionMgr->GetConditionsForSpellClickEvent(spellClickEntry, itr->second.spellId);
ConditionContainer conds = sConditionMgr->GetConditionsForSpellClickEvent(spellClickEntry, itr->second.spellId);
ConditionSourceInfo info = ConditionSourceInfo(clicker, this);
if (!sConditionMgr->IsObjectMeetToConditions(info, conds))
continue;
+2 -2
View File
@@ -564,14 +564,14 @@ struct GossipMenuItems
uint32 BoxMoney;
std::string BoxText;
uint32 BoxBroadcastTextId;
ConditionList Conditions;
ConditionContainer Conditions;
};
struct GossipMenus
{
uint32 entry;
uint32 text_id;
ConditionList conditions;
ConditionContainer conditions;
};
typedef std::multimap<uint32, GossipMenus> GossipMenusContainer;
+1 -1
View File
@@ -786,7 +786,7 @@ void WorldSession::SendListInventory(ObjectGuid vendorGuid)
if (!_player->IsGameMaster() && !leftInStock)
continue;
ConditionList conditions = sConditionMgr->GetConditionsForNpcVendorEvent(vendor->GetEntry(), item->item);
ConditionContainer conditions = sConditionMgr->GetConditionsForNpcVendorEvent(vendor->GetEntry(), item->item);
if (!sConditionMgr->IsObjectMeetToConditions(_player, vendor, conditions))
{
TC_LOG_DEBUG("condition", "SendListInventory: conditions not met for creature entry %u item %u", vendor->GetEntry(), item->item);
+4 -4
View File
@@ -95,7 +95,7 @@ class LootTemplate::LootGroup // A set of loot def
void CheckLootRefs(LootTemplateMap const& store, LootIdSet* ref_set) const;
LootStoreItemList* GetExplicitlyChancedItemList() { return &ExplicitlyChanced; }
LootStoreItemList* GetEqualChancedItemList() { return &EqualChanced; }
void CopyConditions(ConditionList conditions);
void CopyConditions(ConditionContainer conditions);
private:
LootStoreItemList ExplicitlyChanced; // Entries with chances defined in DB
LootStoreItemList EqualChanced; // Zero chances - every entry takes the same chance
@@ -218,7 +218,7 @@ void LootStore::ResetConditions()
{
for (LootTemplateMap::iterator itr = m_LootTemplates.begin(); itr != m_LootTemplates.end(); ++itr)
{
ConditionList empty;
ConditionContainer empty;
itr->second->CopyConditions(empty);
}
}
@@ -1155,7 +1155,7 @@ bool LootTemplate::LootGroup::HasQuestDropForPlayer(Player const* player) const
return false;
}
void LootTemplate::LootGroup::CopyConditions(ConditionList /*conditions*/)
void LootTemplate::LootGroup::CopyConditions(ConditionContainer /*conditions*/)
{
for (LootStoreItemList::iterator i = ExplicitlyChanced.begin(); i != ExplicitlyChanced.end(); ++i)
(*i)->conditions.clear();
@@ -1260,7 +1260,7 @@ void LootTemplate::AddEntry(LootStoreItem* item)
Entries.push_back(item);
}
void LootTemplate::CopyConditions(const ConditionList& conditions)
void LootTemplate::CopyConditions(const ConditionContainer& conditions)
{
for (LootStoreItemList::iterator i = Entries.begin(); i != Entries.end(); ++i)
(*i)->conditions.clear();
+3 -3
View File
@@ -132,7 +132,7 @@ struct LootStoreItem
uint8 groupid : 7;
uint8 mincount; // mincount for drop items
uint8 maxcount; // max drop count for the item mincount or Ref multiplicator
ConditionList conditions; // additional loot condition
ConditionContainer conditions; // additional loot condition
// Constructor
// displayid is filled in IsValid() which must be called after
@@ -153,7 +153,7 @@ struct LootItem
uint32 itemid;
uint32 randomSuffix;
int32 randomPropertyId;
ConditionList conditions; // additional loot condition
ConditionContainer conditions; // additional loot condition
AllowedLooterSet allowedGUIDs;
uint8 count : 8;
bool is_looted : 1;
@@ -252,7 +252,7 @@ class LootTemplate
void AddEntry(LootStoreItem* item);
// Rolls for every item in the template and adds the rolled items the the loot
void Process(Loot& loot, bool rate, uint16 lootMode, uint8 groupId = 0) const;
void CopyConditions(const ConditionList& conditions);
void CopyConditions(const ConditionContainer& conditions);
void CopyConditions(LootItem* li) const;
// True if template includes at least 1 quest drop entry
+1 -1
View File
@@ -1920,7 +1920,7 @@ bool Aura::IsProcTriggeredOnEvent(AuraApplication* aurApp, ProcEventInfo& eventI
return false;
// do checks using conditions table
ConditionList conditions = sConditionMgr->GetConditionsForNotGroupedEntry(CONDITION_SOURCE_TYPE_SPELL_PROC, GetId());
ConditionContainer conditions = sConditionMgr->GetConditionsForNotGroupedEntry(CONDITION_SOURCE_TYPE_SPELL_PROC, GetId());
ConditionSourceInfo condInfo = ConditionSourceInfo(eventInfo.GetActor(), eventInfo.GetActionTarget());
if (!sConditionMgr->IsObjectMeetToConditions(condInfo, conditions))
return false;
+11 -11
View File
@@ -1019,7 +1019,7 @@ void Spell::SelectImplicitNearbyTargets(SpellEffIndex effIndex, SpellImplicitTar
break;
}
ConditionList* condList = m_spellInfo->Effects[effIndex].ImplicitTargetConditions;
ConditionContainer* condList = m_spellInfo->Effects[effIndex].ImplicitTargetConditions;
// handle emergency case - try to use other provided targets if no conditions provided
if (targetType.GetCheckType() == TARGET_CHECK_ENTRY && (!condList || condList->empty()))
@@ -1105,7 +1105,7 @@ void Spell::SelectImplicitConeTargets(SpellEffIndex effIndex, SpellImplicitTarge
std::list<WorldObject*> targets;
SpellTargetObjectTypes objectType = targetType.GetObjectType();
SpellTargetCheckTypes selectionType = targetType.GetCheckType();
ConditionList* condList = m_spellInfo->Effects[effIndex].ImplicitTargetConditions;
ConditionContainer* condList = m_spellInfo->Effects[effIndex].ImplicitTargetConditions;
float coneAngle = float(M_PI) / 2;
float radius = m_spellInfo->Effects[effIndex].CalcRadius(m_caster) * m_spellValue->RadiusMod;
@@ -1725,7 +1725,7 @@ void Spell::SelectEffectTypeImplicitTargets(uint8 effIndex)
}
}
uint32 Spell::GetSearcherTypeMask(SpellTargetObjectTypes objType, ConditionList* condList)
uint32 Spell::GetSearcherTypeMask(SpellTargetObjectTypes objType, ConditionContainer* condList)
{
// this function selects which containers need to be searched for spell target
uint32 retMask = GRID_MAP_TYPE_MASK_ALL;
@@ -1793,7 +1793,7 @@ void Spell::SearchTargets(SEARCHER& searcher, uint32 containerMask, Unit* refere
}
}
WorldObject* Spell::SearchNearbyTarget(float range, SpellTargetObjectTypes objectType, SpellTargetCheckTypes selectionType, ConditionList* condList)
WorldObject* Spell::SearchNearbyTarget(float range, SpellTargetObjectTypes objectType, SpellTargetCheckTypes selectionType, ConditionContainer* condList)
{
WorldObject* target = NULL;
uint32 containerTypeMask = GetSearcherTypeMask(objectType, condList);
@@ -1805,7 +1805,7 @@ WorldObject* Spell::SearchNearbyTarget(float range, SpellTargetObjectTypes objec
return target;
}
void Spell::SearchAreaTargets(std::list<WorldObject*>& targets, float range, Position const* position, Unit* referer, SpellTargetObjectTypes objectType, SpellTargetCheckTypes selectionType, ConditionList* condList)
void Spell::SearchAreaTargets(std::list<WorldObject*>& targets, float range, Position const* position, Unit* referer, SpellTargetObjectTypes objectType, SpellTargetCheckTypes selectionType, ConditionContainer* condList)
{
uint32 containerTypeMask = GetSearcherTypeMask(objectType, condList);
if (!containerTypeMask)
@@ -1815,7 +1815,7 @@ void Spell::SearchAreaTargets(std::list<WorldObject*>& targets, float range, Pos
SearchTargets<Trinity::WorldObjectListSearcher<Trinity::WorldObjectSpellAreaTargetCheck> > (searcher, containerTypeMask, m_caster, position, range);
}
void Spell::SearchChainTargets(std::list<WorldObject*>& targets, uint32 chainTargets, WorldObject* target, SpellTargetObjectTypes objectType, SpellTargetCheckTypes selectType, ConditionList* condList, bool isChainHeal)
void Spell::SearchChainTargets(std::list<WorldObject*>& targets, uint32 chainTargets, WorldObject* target, SpellTargetObjectTypes objectType, SpellTargetCheckTypes selectType, ConditionContainer* condList, bool isChainHeal)
{
// max dist for jump target selection
float jumpRadius = 0.0f;
@@ -4791,7 +4791,7 @@ SpellCastResult Spell::CheckCast(bool strict)
{
ConditionSourceInfo condInfo = ConditionSourceInfo(m_caster);
condInfo.mConditionTargets[1] = m_targets.GetObjectTarget();
ConditionList conditions = sConditionMgr->GetConditionsForNotGroupedEntry(CONDITION_SOURCE_TYPE_SPELL, m_spellInfo->Id);
ConditionContainer conditions = sConditionMgr->GetConditionsForNotGroupedEntry(CONDITION_SOURCE_TYPE_SPELL, m_spellInfo->Id);
if (!conditions.empty() && !sConditionMgr->IsObjectMeetToConditions(condInfo, conditions))
{
// mLastFailedCondition can be NULL if there was an error processing the condition in Condition::Meets (i.e. wrong data for ConditionTarget or others)
@@ -7315,7 +7315,7 @@ namespace Trinity
{
WorldObjectSpellTargetCheck::WorldObjectSpellTargetCheck(Unit* caster, Unit* referer, SpellInfo const* spellInfo,
SpellTargetCheckTypes selectionType, ConditionList* condList) : _caster(caster), _referer(referer), _spellInfo(spellInfo),
SpellTargetCheckTypes selectionType, ConditionContainer* condList) : _caster(caster), _referer(referer), _spellInfo(spellInfo),
_targetSelectionType(selectionType), _condList(condList)
{
if (condList)
@@ -7389,7 +7389,7 @@ bool WorldObjectSpellTargetCheck::operator()(WorldObject* target)
}
WorldObjectSpellNearbyTargetCheck::WorldObjectSpellNearbyTargetCheck(float range, Unit* caster, SpellInfo const* spellInfo,
SpellTargetCheckTypes selectionType, ConditionList* condList)
SpellTargetCheckTypes selectionType, ConditionContainer* condList)
: WorldObjectSpellTargetCheck(caster, caster, spellInfo, selectionType, condList), _range(range), _position(caster) { }
bool WorldObjectSpellNearbyTargetCheck::operator()(WorldObject* target)
@@ -7404,7 +7404,7 @@ bool WorldObjectSpellNearbyTargetCheck::operator()(WorldObject* target)
}
WorldObjectSpellAreaTargetCheck::WorldObjectSpellAreaTargetCheck(float range, Position const* position, Unit* caster,
Unit* referer, SpellInfo const* spellInfo, SpellTargetCheckTypes selectionType, ConditionList* condList)
Unit* referer, SpellInfo const* spellInfo, SpellTargetCheckTypes selectionType, ConditionContainer* condList)
: WorldObjectSpellTargetCheck(caster, referer, spellInfo, selectionType, condList), _range(range), _position(position) { }
bool WorldObjectSpellAreaTargetCheck::operator()(WorldObject* target)
@@ -7415,7 +7415,7 @@ bool WorldObjectSpellAreaTargetCheck::operator()(WorldObject* target)
}
WorldObjectSpellConeTargetCheck::WorldObjectSpellConeTargetCheck(float coneAngle, float range, Unit* caster,
SpellInfo const* spellInfo, SpellTargetCheckTypes selectionType, ConditionList* condList)
SpellInfo const* spellInfo, SpellTargetCheckTypes selectionType, ConditionContainer* condList)
: WorldObjectSpellAreaTargetCheck(range, caster, caster, caster, spellInfo, selectionType, condList), _coneAngle(coneAngle) { }
bool WorldObjectSpellConeTargetCheck::operator()(WorldObject* target)
+9 -9
View File
@@ -374,12 +374,12 @@ class Spell
void SelectEffectTypeImplicitTargets(uint8 effIndex);
uint32 GetSearcherTypeMask(SpellTargetObjectTypes objType, ConditionList* condList);
uint32 GetSearcherTypeMask(SpellTargetObjectTypes objType, ConditionContainer* condList);
template<class SEARCHER> void SearchTargets(SEARCHER& searcher, uint32 containerMask, Unit* referer, Position const* pos, float radius);
WorldObject* SearchNearbyTarget(float range, SpellTargetObjectTypes objectType, SpellTargetCheckTypes selectionType, ConditionList* condList = NULL);
void SearchAreaTargets(std::list<WorldObject*>& targets, float range, Position const* position, Unit* referer, SpellTargetObjectTypes objectType, SpellTargetCheckTypes selectionType, ConditionList* condList);
void SearchChainTargets(std::list<WorldObject*>& targets, uint32 chainTargets, WorldObject* target, SpellTargetObjectTypes objectType, SpellTargetCheckTypes selectType, ConditionList* condList, bool isChainHeal);
WorldObject* SearchNearbyTarget(float range, SpellTargetObjectTypes objectType, SpellTargetCheckTypes selectionType, ConditionContainer* condList = NULL);
void SearchAreaTargets(std::list<WorldObject*>& targets, float range, Position const* position, Unit* referer, SpellTargetObjectTypes objectType, SpellTargetCheckTypes selectionType, ConditionContainer* condList);
void SearchChainTargets(std::list<WorldObject*>& targets, uint32 chainTargets, WorldObject* target, SpellTargetObjectTypes objectType, SpellTargetCheckTypes selectType, ConditionContainer* condList, bool isChainHeal);
GameObject* SearchSpellFocus();
@@ -714,10 +714,10 @@ namespace Trinity
SpellInfo const* _spellInfo;
SpellTargetCheckTypes _targetSelectionType;
ConditionSourceInfo* _condSrcInfo;
ConditionList* _condList;
ConditionContainer* _condList;
WorldObjectSpellTargetCheck(Unit* caster, Unit* referer, SpellInfo const* spellInfo,
SpellTargetCheckTypes selectionType, ConditionList* condList);
SpellTargetCheckTypes selectionType, ConditionContainer* condList);
~WorldObjectSpellTargetCheck();
bool operator()(WorldObject* target);
};
@@ -727,7 +727,7 @@ namespace Trinity
float _range;
Position const* _position;
WorldObjectSpellNearbyTargetCheck(float range, Unit* caster, SpellInfo const* spellInfo,
SpellTargetCheckTypes selectionType, ConditionList* condList);
SpellTargetCheckTypes selectionType, ConditionContainer* condList);
bool operator()(WorldObject* target);
};
@@ -736,7 +736,7 @@ namespace Trinity
float _range;
Position const* _position;
WorldObjectSpellAreaTargetCheck(float range, Position const* position, Unit* caster,
Unit* referer, SpellInfo const* spellInfo, SpellTargetCheckTypes selectionType, ConditionList* condList);
Unit* referer, SpellInfo const* spellInfo, SpellTargetCheckTypes selectionType, ConditionContainer* condList);
bool operator()(WorldObject* target);
};
@@ -744,7 +744,7 @@ namespace Trinity
{
float _coneAngle;
WorldObjectSpellConeTargetCheck(float coneAngle, float range, Unit* caster,
SpellInfo const* spellInfo, SpellTargetCheckTypes selectionType, ConditionList* condList);
SpellInfo const* spellInfo, SpellTargetCheckTypes selectionType, ConditionContainer* condList);
bool operator()(WorldObject* target);
};
+1 -1
View File
@@ -2658,7 +2658,7 @@ void SpellInfo::_UnloadImplicitTargetConditionLists()
// find the same instances of ConditionList and delete them.
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
{
ConditionList* cur = Effects[i].ImplicitTargetConditions;
ConditionContainer* cur = Effects[i].ImplicitTargetConditions;
if (!cur)
continue;
for (uint8 j = i; j < MAX_SPELL_EFFECTS; ++j)