Core/Game: Include cleanup
* Mostly aimed at removing Log/DatabaseEnv includes from other headers * Fix most packet headers including other packet headers - moved common structures such as ItemInstance to their own files * Moved SAI function definitions to source files (massive or requiring many different dependencies)
This commit is contained in:
+1
-1
@@ -79,7 +79,7 @@ enum AccountTypes
|
||||
SEC_CONSOLE = 4 // must be always last in list, accounts must have less security level always also
|
||||
};
|
||||
|
||||
enum LocaleConstant
|
||||
enum LocaleConstant : uint8
|
||||
{
|
||||
LOCALE_enUS = 0,
|
||||
LOCALE_koKR = 1,
|
||||
|
||||
@@ -17,6 +17,8 @@
|
||||
*/
|
||||
|
||||
#include "GameObjectAI.h"
|
||||
#include "CreatureAI.h"
|
||||
#include "GameObject.h"
|
||||
|
||||
//GameObjectAI::GameObjectAI(GameObject* g) : go(g) { }
|
||||
int GameObjectAI::Permissible(const GameObject* go)
|
||||
@@ -27,3 +29,8 @@ int GameObjectAI::Permissible(const GameObject* go)
|
||||
}
|
||||
|
||||
NullGameObjectAI::NullGameObjectAI(GameObject* g) : GameObjectAI(g) { }
|
||||
|
||||
int NullGameObjectAI::Permissible(GameObject const* /*go*/)
|
||||
{
|
||||
return PERMIT_BASE_IDLE;
|
||||
}
|
||||
|
||||
@@ -20,11 +20,11 @@
|
||||
#define TRINITY_GAMEOBJECTAI_H
|
||||
|
||||
#include "Define.h"
|
||||
#include <list>
|
||||
#include "Object.h"
|
||||
#include "QuestDef.h"
|
||||
#include "GameObject.h"
|
||||
#include "CreatureAI.h"
|
||||
#include <list>
|
||||
|
||||
class GameObject;
|
||||
class Unit;
|
||||
|
||||
class TC_GAME_API GameObjectAI
|
||||
{
|
||||
@@ -70,6 +70,6 @@ class TC_GAME_API NullGameObjectAI : public GameObjectAI
|
||||
|
||||
void UpdateAI(uint32 /*diff*/) override { }
|
||||
|
||||
static int Permissible(GameObject const* /*go*/) { return PERMIT_BASE_IDLE; }
|
||||
static int Permissible(GameObject const* /*go*/);
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
#include "GuardAI.h"
|
||||
#include "Errors.h"
|
||||
#include "Log.h"
|
||||
#include "Player.h"
|
||||
|
||||
int GuardAI::Permissible(Creature const* creature)
|
||||
|
||||
@@ -17,17 +17,18 @@
|
||||
*/
|
||||
|
||||
#include "PetAI.h"
|
||||
#include "Creature.h"
|
||||
#include "Errors.h"
|
||||
#include "Group.h"
|
||||
#include "Log.h"
|
||||
#include "ObjectAccessor.h"
|
||||
#include "Pet.h"
|
||||
#include "Player.h"
|
||||
#include "Spell.h"
|
||||
#include "ObjectAccessor.h"
|
||||
#include "SpellMgr.h"
|
||||
#include "Creature.h"
|
||||
#include "Util.h"
|
||||
#include "Group.h"
|
||||
#include "SpellInfo.h"
|
||||
#include "SpellHistory.h"
|
||||
#include "SpellInfo.h"
|
||||
#include "SpellMgr.h"
|
||||
#include "Util.h"
|
||||
|
||||
int PetAI::Permissible(const Creature* creature)
|
||||
{
|
||||
|
||||
@@ -16,8 +16,8 @@
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "ByteBuffer.h"
|
||||
#include "ReactorAI.h"
|
||||
#include "Creature.h"
|
||||
|
||||
int ReactorAI::Permissible(const Creature* creature)
|
||||
{
|
||||
|
||||
@@ -21,8 +21,6 @@
|
||||
|
||||
#include "CreatureAI.h"
|
||||
|
||||
class Unit;
|
||||
|
||||
class TC_GAME_API ReactorAI : public CreatureAI
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -230,6 +230,40 @@ void UnitAI::FillAISpellInfo()
|
||||
}
|
||||
}
|
||||
|
||||
bool DefaultTargetSelector::operator()(Unit const* target) const
|
||||
{
|
||||
if (!me)
|
||||
return false;
|
||||
|
||||
if (!target)
|
||||
return false;
|
||||
|
||||
if (m_playerOnly && (target->GetTypeId() != TYPEID_PLAYER))
|
||||
return false;
|
||||
|
||||
if (m_dist > 0.0f && !me->IsWithinCombatRange(target, m_dist))
|
||||
return false;
|
||||
|
||||
if (m_dist < 0.0f && me->IsWithinCombatRange(target, -m_dist))
|
||||
return false;
|
||||
|
||||
if (m_aura)
|
||||
{
|
||||
if (m_aura > 0)
|
||||
{
|
||||
if (!target->HasAura(m_aura))
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (target->HasAura(-m_aura))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
SpellTargetSelector::SpellTargetSelector(Unit* caster, uint32 spellId) :
|
||||
_caster(caster), _spellInfo(sSpellMgr->GetSpellInfo(spellId))
|
||||
{
|
||||
|
||||
@@ -25,6 +25,17 @@
|
||||
#include "EventMap.h"
|
||||
#include <list>
|
||||
|
||||
#define CAST_AI(a, b) (dynamic_cast<a*>(b))
|
||||
#define ENSURE_AI(a,b) (EnsureAI<a>(b))
|
||||
|
||||
template<class T, class U>
|
||||
inline T* EnsureAI(U* ai)
|
||||
{
|
||||
T* cast_ai = dynamic_cast<T*>(ai);
|
||||
ASSERT(cast_ai);
|
||||
return cast_ai;
|
||||
};
|
||||
|
||||
class Player;
|
||||
class Quest;
|
||||
struct AISpellInfoType;
|
||||
@@ -53,39 +64,7 @@ struct TC_GAME_API DefaultTargetSelector : public std::unary_function<Unit*, boo
|
||||
// aura: if 0: ignored, if > 0: the target shall have the aura, if < 0, the target shall NOT have the aura
|
||||
DefaultTargetSelector(Unit const* unit, float dist, bool playerOnly, int32 aura) : me(unit), m_dist(dist), m_playerOnly(playerOnly), m_aura(aura) { }
|
||||
|
||||
bool operator()(Unit const* target) const
|
||||
{
|
||||
if (!me)
|
||||
return false;
|
||||
|
||||
if (!target)
|
||||
return false;
|
||||
|
||||
if (m_playerOnly && (target->GetTypeId() != TYPEID_PLAYER))
|
||||
return false;
|
||||
|
||||
if (m_dist > 0.0f && !me->IsWithinCombatRange(target, m_dist))
|
||||
return false;
|
||||
|
||||
if (m_dist < 0.0f && me->IsWithinCombatRange(target, -m_dist))
|
||||
return false;
|
||||
|
||||
if (m_aura)
|
||||
{
|
||||
if (m_aura > 0)
|
||||
{
|
||||
if (!target->HasAura(m_aura))
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (target->HasAura(-m_aura))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
bool operator()(Unit const* target) const;
|
||||
};
|
||||
|
||||
// Target selector for spell casts checking range, auras and attributes
|
||||
|
||||
@@ -41,6 +41,14 @@ void CreatureAI::OnCharmed(bool apply)
|
||||
AISpellInfoType* UnitAI::AISpellInfo;
|
||||
AISpellInfoType* GetAISpellInfo(uint32 i) { return &CreatureAI::AISpellInfo[i]; }
|
||||
|
||||
CreatureAI::CreatureAI(Creature* creature) : UnitAI(creature), me(creature), _boundary(nullptr), m_MoveInLineOfSight_locked(false)
|
||||
{
|
||||
}
|
||||
|
||||
CreatureAI::~CreatureAI()
|
||||
{
|
||||
}
|
||||
|
||||
void CreatureAI::Talk(uint8 id, WorldObject const* whisperTarget /*= nullptr*/)
|
||||
{
|
||||
sCreatureTextMgr->SendChat(me, id, whisperTarget);
|
||||
@@ -363,6 +371,12 @@ bool CreatureAI::CheckBoundary(Position const* who) const
|
||||
return true;
|
||||
}
|
||||
|
||||
void CreatureAI::SetBoundary(CreatureBoundary const* boundary)
|
||||
{
|
||||
_boundary = boundary;
|
||||
me->DoImmediateBoundaryCheck();
|
||||
}
|
||||
|
||||
bool CreatureAI::CheckInRoom()
|
||||
{
|
||||
if (CheckBoundary())
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
#ifndef TRINITY_CREATUREAI_H
|
||||
#define TRINITY_CREATUREAI_H
|
||||
|
||||
#include "Creature.h"
|
||||
#include "UnitAI.h"
|
||||
#include "AreaBoundary.h"
|
||||
#include "Common.h"
|
||||
@@ -81,7 +80,7 @@ class TC_GAME_API CreatureAI : public UnitAI
|
||||
Creature* DoSummonFlyer(uint32 entry, WorldObject* obj, float flightZ, float radius = 5.0f, uint32 despawnTime = 30000, TempSummonType summonType = TEMPSUMMON_CORPSE_TIMED_DESPAWN);
|
||||
|
||||
bool CheckBoundary(Position const* who = nullptr) const;
|
||||
void SetBoundary(CreatureBoundary const* boundary) { _boundary = boundary; me->DoImmediateBoundaryCheck(); }
|
||||
void SetBoundary(CreatureBoundary const* boundary);
|
||||
public:
|
||||
enum EvadeReason
|
||||
{
|
||||
@@ -92,12 +91,12 @@ class TC_GAME_API CreatureAI : public UnitAI
|
||||
EVADE_REASON_OTHER
|
||||
};
|
||||
|
||||
explicit CreatureAI(Creature* creature);
|
||||
|
||||
virtual ~CreatureAI();
|
||||
|
||||
void Talk(uint8 id, WorldObject const* whisperTarget = nullptr);
|
||||
|
||||
explicit CreatureAI(Creature* creature) : UnitAI(creature), me(creature), _boundary(nullptr), m_MoveInLineOfSight_locked(false) { }
|
||||
|
||||
virtual ~CreatureAI() { }
|
||||
|
||||
/// == Reactions At =================================
|
||||
|
||||
// Called if IsVisible(Unit* who) is true at each who move, reaction at visibility zone enter
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
#include "Creature.h"
|
||||
#include "CreatureAISelector.h"
|
||||
#include "GameObject.h"
|
||||
#include "PassiveAI.h"
|
||||
#include "Log.h"
|
||||
#include "MovementGenerator.h"
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include "GridNotifiersImpl.h"
|
||||
#include "Cell.h"
|
||||
#include "CellImpl.h"
|
||||
#include "Log.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "AreaBoundary.h"
|
||||
|
||||
|
||||
@@ -25,17 +25,6 @@
|
||||
#include "InstanceScript.h"
|
||||
#include "TaskScheduler.h"
|
||||
|
||||
#define CAST_AI(a, b) (dynamic_cast<a*>(b))
|
||||
#define ENSURE_AI(a,b) (EnsureAI<a>(b))
|
||||
|
||||
template<class T, class U>
|
||||
T* EnsureAI(U* ai)
|
||||
{
|
||||
T* cast_ai = dynamic_cast<T*>(ai);
|
||||
ASSERT(cast_ai);
|
||||
return cast_ai;
|
||||
};
|
||||
|
||||
class InstanceScript;
|
||||
|
||||
class TC_GAME_API SummonList
|
||||
|
||||
@@ -23,9 +23,10 @@ SDComment:
|
||||
SDCategory: Npc
|
||||
EndScriptData */
|
||||
|
||||
#include "ScriptedEscortAI.h"
|
||||
#include "Log.h"
|
||||
#include "Player.h"
|
||||
#include "ScriptedCreature.h"
|
||||
#include "ScriptedEscortAI.h"
|
||||
#include "Group.h"
|
||||
|
||||
enum Points
|
||||
|
||||
@@ -19,8 +19,11 @@
|
||||
#ifndef SC_ESCORTAI_H
|
||||
#define SC_ESCORTAI_H
|
||||
|
||||
#include "ScriptedCreature.h"
|
||||
#include "ScriptSystem.h"
|
||||
|
||||
class Quest;
|
||||
|
||||
#define DEFAULT_MAX_PLAYER_DISTANCE 50
|
||||
|
||||
struct Escort_Waypoint
|
||||
|
||||
@@ -23,9 +23,10 @@ SDComment: This AI is under development
|
||||
SDCategory: Npc
|
||||
EndScriptData */
|
||||
|
||||
#include "ScriptedFollowerAI.h"
|
||||
#include "Log.h"
|
||||
#include "Player.h"
|
||||
#include "ScriptedCreature.h"
|
||||
#include "ScriptedFollowerAI.h"
|
||||
#include "Group.h"
|
||||
|
||||
const float MAX_PLAYER_DISTANCE = 100.0f;
|
||||
|
||||
@@ -19,8 +19,11 @@
|
||||
#ifndef SC_FOLLOWERAI_H
|
||||
#define SC_FOLLOWERAI_H
|
||||
|
||||
#include "ScriptedCreature.h"
|
||||
#include "ScriptSystem.h"
|
||||
|
||||
class Quest;
|
||||
|
||||
enum eFollowState
|
||||
{
|
||||
STATE_FOLLOW_NONE = 0x000,
|
||||
|
||||
@@ -15,15 +15,14 @@
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "DatabaseEnv.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "ObjectDefines.h"
|
||||
#include "GridDefines.h"
|
||||
#include "GridNotifiers.h"
|
||||
#include "SpellMgr.h"
|
||||
#include "Cell.h"
|
||||
#include "Group.h"
|
||||
#include "SmartAI.h"
|
||||
#include "Creature.h"
|
||||
#include "GameObject.h"
|
||||
#include "Group.h"
|
||||
#include "Log.h"
|
||||
#include "ObjectAccessor.h"
|
||||
#include "PetDefines.h"
|
||||
#include "Player.h"
|
||||
#include "ScriptMgr.h"
|
||||
|
||||
SmartAI::SmartAI(Creature* c) : CreatureAI(c)
|
||||
|
||||
@@ -18,15 +18,12 @@
|
||||
#ifndef TRINITY_SMARTAI_H
|
||||
#define TRINITY_SMARTAI_H
|
||||
|
||||
#include "Common.h"
|
||||
#include "Creature.h"
|
||||
#include "Define.h"
|
||||
#include "CreatureAI.h"
|
||||
#include "Unit.h"
|
||||
#include "Spell.h"
|
||||
|
||||
#include "SmartScript.h"
|
||||
#include "SmartScriptMgr.h"
|
||||
#include "GameObjectAI.h"
|
||||
#include "SmartScript.h"
|
||||
|
||||
struct WayPoint;
|
||||
|
||||
enum SmartEscortState
|
||||
{
|
||||
|
||||
@@ -15,27 +15,25 @@
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "Cell.h"
|
||||
#include "SmartScript.h"
|
||||
#include "CellImpl.h"
|
||||
#include "ChatTextBuilder.h"
|
||||
#include "Creature.h"
|
||||
#include "CreatureTextMgr.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "GossipDef.h"
|
||||
#include "GridDefines.h"
|
||||
#include "GridNotifiers.h"
|
||||
#include "GameEventMgr.h"
|
||||
#include "GameObject.h"
|
||||
#include "GridNotifiersImpl.h"
|
||||
#include "Group.h"
|
||||
#include "InstanceScript.h"
|
||||
#include "Language.h"
|
||||
#include "ObjectDefines.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "Log.h"
|
||||
#include "Map.h"
|
||||
#include "ObjectAccessor.h"
|
||||
#include "Random.h"
|
||||
#include "ScriptedCreature.h"
|
||||
#include "ScriptedGossip.h"
|
||||
#include "SmartAI.h"
|
||||
#include "SmartScript.h"
|
||||
#include "SpellMgr.h"
|
||||
#include "SpellAuras.h"
|
||||
#include "Vehicle.h"
|
||||
#include "GameEventMgr.h"
|
||||
|
||||
SmartScript::SmartScript()
|
||||
{
|
||||
@@ -64,6 +62,113 @@ SmartScript::~SmartScript()
|
||||
mCounterList.clear();
|
||||
}
|
||||
|
||||
bool SmartScript::IsSmart(Creature* c /*= NULL*/)
|
||||
{
|
||||
bool smart = true;
|
||||
if (c && c->GetAIName() != "SmartAI")
|
||||
smart = false;
|
||||
|
||||
if (!me || me->GetAIName() != "SmartAI")
|
||||
smart = false;
|
||||
|
||||
if (!smart)
|
||||
TC_LOG_ERROR("sql.sql", "SmartScript: Action target Creature (GUID: " UI64FMTD " Entry: %u) is not using SmartAI, action called by Creature (GUID: " UI64FMTD " Entry: %u) skipped to prevent crash.", uint64(c ? c->GetSpawnId() : UI64LIT(0)), c ? c->GetEntry() : 0, uint64(me ? me->GetSpawnId() : UI64LIT(0)), me ? me->GetEntry() : 0);
|
||||
|
||||
return smart;
|
||||
}
|
||||
|
||||
bool SmartScript::IsSmartGO(GameObject* g /*= NULL*/)
|
||||
{
|
||||
bool smart = true;
|
||||
if (g && g->GetAIName() != "SmartGameObjectAI")
|
||||
smart = false;
|
||||
|
||||
if (!go || go->GetAIName() != "SmartGameObjectAI")
|
||||
smart = false;
|
||||
if (!smart)
|
||||
TC_LOG_ERROR("sql.sql", "SmartScript: Action target GameObject (GUID: " UI64FMTD " Entry: %u) is not using SmartGameObjectAI, action called by GameObject (GUID: " UI64FMTD " Entry: %u) skipped to prevent crash.", uint64(g ? g->GetSpawnId() : UI64LIT(0)), g ? g->GetEntry() : 0, uint64(go ? go->GetSpawnId() : UI64LIT(0)), go ? go->GetEntry() : 0);
|
||||
|
||||
return smart;
|
||||
}
|
||||
|
||||
void SmartScript::StoreTargetList(ObjectList* targets, uint32 id)
|
||||
{
|
||||
if (!targets)
|
||||
return;
|
||||
|
||||
if (mTargetStorage->find(id) != mTargetStorage->end())
|
||||
{
|
||||
// check if already stored
|
||||
if ((*mTargetStorage)[id]->Equals(targets))
|
||||
return;
|
||||
|
||||
delete (*mTargetStorage)[id];
|
||||
}
|
||||
|
||||
(*mTargetStorage)[id] = new ObjectGuidList(targets, GetBaseObject());
|
||||
}
|
||||
|
||||
ObjectList* SmartScript::GetTargetList(uint32 id)
|
||||
{
|
||||
ObjectListMap::iterator itr = mTargetStorage->find(id);
|
||||
if (itr != mTargetStorage->end())
|
||||
return (*itr).second->GetObjectList();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void SmartScript::StoreCounter(uint32 id, uint32 value, uint32 reset)
|
||||
{
|
||||
CounterMap::const_iterator itr = mCounterList.find(id);
|
||||
if (itr != mCounterList.end())
|
||||
{
|
||||
if (reset == 0)
|
||||
value += GetCounterValue(id);
|
||||
mCounterList.erase(id);
|
||||
}
|
||||
|
||||
mCounterList.insert(std::make_pair(id, value));
|
||||
ProcessEventsFor(SMART_EVENT_COUNTER_SET);
|
||||
}
|
||||
|
||||
uint32 SmartScript::GetCounterId(uint32 id)
|
||||
{
|
||||
CounterMap::iterator itr = mCounterList.find(id);
|
||||
if (itr != mCounterList.end())
|
||||
return itr->first;
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32 SmartScript::GetCounterValue(uint32 id)
|
||||
{
|
||||
CounterMap::iterator itr = mCounterList.find(id);
|
||||
if (itr != mCounterList.end())
|
||||
return itr->second;
|
||||
return 0;
|
||||
}
|
||||
|
||||
GameObject* SmartScript::FindGameObjectNear(WorldObject* searchObject, ObjectGuid::LowType guid) const
|
||||
{
|
||||
auto bounds = searchObject->GetMap()->GetGameObjectBySpawnIdStore().equal_range(guid);
|
||||
if (bounds.first == bounds.second)
|
||||
return nullptr;
|
||||
|
||||
return bounds.first->second;
|
||||
}
|
||||
|
||||
Creature* SmartScript::FindCreatureNear(WorldObject* searchObject, ObjectGuid::LowType guid) const
|
||||
{
|
||||
auto bounds = searchObject->GetMap()->GetCreatureBySpawnIdStore().equal_range(guid);
|
||||
if (bounds.first == bounds.second)
|
||||
return nullptr;
|
||||
|
||||
auto creatureItr = std::find_if(bounds.first, bounds.second, [](Map::CreatureBySpawnIdContainer::value_type const& pair)
|
||||
{
|
||||
return pair.second->IsAlive();
|
||||
});
|
||||
|
||||
return creatureItr != bounds.second ? creatureItr->second : bounds.first->second;
|
||||
}
|
||||
|
||||
void SmartScript::OnReset()
|
||||
{
|
||||
SetPhase(0);
|
||||
@@ -81,6 +186,35 @@ void SmartScript::OnReset()
|
||||
mCounterList.clear();
|
||||
}
|
||||
|
||||
void SmartScript::ResetBaseObject()
|
||||
{
|
||||
WorldObject* lookupRoot = me;
|
||||
if (!lookupRoot)
|
||||
lookupRoot = go;
|
||||
|
||||
if (lookupRoot)
|
||||
{
|
||||
if (!meOrigGUID.IsEmpty())
|
||||
{
|
||||
if (Creature* m = ObjectAccessor::GetCreature(*lookupRoot, meOrigGUID))
|
||||
{
|
||||
me = m;
|
||||
go = NULL;
|
||||
}
|
||||
}
|
||||
if (!goOrigGUID.IsEmpty())
|
||||
{
|
||||
if (GameObject* o = ObjectAccessor::GetGameObject(*lookupRoot, goOrigGUID))
|
||||
{
|
||||
me = NULL;
|
||||
go = o;
|
||||
}
|
||||
}
|
||||
}
|
||||
goOrigGUID.Clear();
|
||||
meOrigGUID.Clear();
|
||||
}
|
||||
|
||||
void SmartScript::ProcessEventsFor(SMART_EVENT e, Unit* unit, uint32 var0, uint32 var1, bool bvar, const SpellInfo* spell, GameObject* gob, std::string const& varString)
|
||||
{
|
||||
for (SmartAIEventList::iterator i = mEvents.begin(); i != mEvents.end(); ++i)
|
||||
@@ -1814,7 +1948,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
||||
}
|
||||
case SMART_ACTION_CROSS_CAST:
|
||||
{
|
||||
ObjectList* casters = GetTargets(CreateEvent(SMART_EVENT_UPDATE_IC, 0, 0, 0, 0, 0, SMART_ACTION_NONE, 0, 0, 0, 0, 0, 0, (SMARTAI_TARGETS)e.action.crossCast.targetType, e.action.crossCast.targetParam1, e.action.crossCast.targetParam2, e.action.crossCast.targetParam3, 0), unit);
|
||||
ObjectList* casters = GetTargets(CreateSmartEvent(SMART_EVENT_UPDATE_IC, 0, 0, 0, 0, 0, SMART_ACTION_NONE, 0, 0, 0, 0, 0, 0, (SMARTAI_TARGETS)e.action.crossCast.targetType, e.action.crossCast.targetParam1, e.action.crossCast.targetParam2, e.action.crossCast.targetParam3, 0), unit);
|
||||
if (!casters)
|
||||
break;
|
||||
|
||||
@@ -2395,7 +2529,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
||||
case SMART_ACTION_RANDOM_SOUND:
|
||||
{
|
||||
std::vector<uint32> sounds;
|
||||
std::copy_if(e.action.randomSound.sounds.begin(), e.action.randomSound.sounds.end(),
|
||||
std::copy_if(std::begin(e.action.randomSound.sounds), std::end(e.action.randomSound.sounds),
|
||||
std::back_inserter(sounds), [](uint32 sound) { return sound != 0; });
|
||||
|
||||
bool onlySelf = e.action.randomSound.onlySelf != 0;
|
||||
@@ -2597,10 +2731,10 @@ void SmartScript::InstallTemplate(SmartScriptHolder const& e)
|
||||
|
||||
void SmartScript::AddEvent(SMART_EVENT e, uint32 event_flags, uint32 event_param1, uint32 event_param2, uint32 event_param3, uint32 event_param4, SMART_ACTION action, uint32 action_param1, uint32 action_param2, uint32 action_param3, uint32 action_param4, uint32 action_param5, uint32 action_param6, SMARTAI_TARGETS t, uint32 target_param1, uint32 target_param2, uint32 target_param3, uint32 phaseMask)
|
||||
{
|
||||
mInstallEvents.push_back(CreateEvent(e, event_flags, event_param1, event_param2, event_param3, event_param4, action, action_param1, action_param2, action_param3, action_param4, action_param5, action_param6, t, target_param1, target_param2, target_param3, phaseMask));
|
||||
mInstallEvents.push_back(CreateSmartEvent(e, event_flags, event_param1, event_param2, event_param3, event_param4, action, action_param1, action_param2, action_param3, action_param4, action_param5, action_param6, t, target_param1, target_param2, target_param3, phaseMask));
|
||||
}
|
||||
|
||||
SmartScriptHolder SmartScript::CreateEvent(SMART_EVENT e, uint32 event_flags, uint32 event_param1, uint32 event_param2, uint32 event_param3, uint32 event_param4, SMART_ACTION action, uint32 action_param1, uint32 action_param2, uint32 action_param3, uint32 action_param4, uint32 action_param5, uint32 action_param6, SMARTAI_TARGETS t, uint32 target_param1, uint32 target_param2, uint32 target_param3, uint32 phaseMask)
|
||||
SmartScriptHolder SmartScript::CreateSmartEvent(SMART_EVENT e, uint32 event_flags, uint32 event_param1, uint32 event_param2, uint32 event_param3, uint32 event_param4, SMART_ACTION action, uint32 action_param1, uint32 action_param2, uint32 action_param3, uint32 action_param4, uint32 action_param5, uint32 action_param6, SMARTAI_TARGETS t, uint32 target_param1, uint32 target_param2, uint32 target_param3, uint32 phaseMask)
|
||||
{
|
||||
SmartScriptHolder script;
|
||||
script.event.type = e;
|
||||
@@ -3637,6 +3771,69 @@ void SmartScript::InstallEvents()
|
||||
}
|
||||
}
|
||||
|
||||
void SmartScript::RemoveStoredEvent(uint32 id)
|
||||
{
|
||||
if (!mStoredEvents.empty())
|
||||
{
|
||||
for (SmartAIEventList::iterator i = mStoredEvents.begin(); i != mStoredEvents.end(); ++i)
|
||||
{
|
||||
if (i->event_id == id)
|
||||
{
|
||||
mStoredEvents.erase(i);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
WorldObject* SmartScript::GetBaseObject()
|
||||
{
|
||||
WorldObject* obj = nullptr;
|
||||
if (me)
|
||||
obj = me;
|
||||
else if (go)
|
||||
obj = go;
|
||||
return obj;
|
||||
}
|
||||
|
||||
WorldObject* SmartScript::GetBaseObjectOrUnit(Unit* unit)
|
||||
{
|
||||
WorldObject* summoner = GetBaseObject();
|
||||
|
||||
if (!summoner && unit)
|
||||
return unit;
|
||||
|
||||
return summoner;
|
||||
}
|
||||
|
||||
bool SmartScript::IsUnit(WorldObject* obj)
|
||||
{
|
||||
return obj && (obj->GetTypeId() == TYPEID_UNIT || obj->GetTypeId() == TYPEID_PLAYER);
|
||||
}
|
||||
|
||||
bool SmartScript::IsPlayer(WorldObject* obj)
|
||||
{
|
||||
return obj && obj->GetTypeId() == TYPEID_PLAYER;
|
||||
}
|
||||
|
||||
bool SmartScript::IsCreature(WorldObject* obj)
|
||||
{
|
||||
return obj && obj->GetTypeId() == TYPEID_UNIT;
|
||||
}
|
||||
|
||||
bool SmartScript::IsCreatureInControlOfSelf(WorldObject* obj)
|
||||
{
|
||||
if (Creature* creatureObj = obj ? obj->ToCreature() : nullptr)
|
||||
return !creatureObj->IsCharmed() && !creatureObj->IsControlledByPlayer();
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
bool SmartScript::IsGameObject(WorldObject* obj)
|
||||
{
|
||||
return obj && obj->GetTypeId() == TYPEID_GAMEOBJECT;
|
||||
}
|
||||
|
||||
void SmartScript::OnUpdate(uint32 const diff)
|
||||
{
|
||||
if ((mScriptType == SMART_SCRIPT_TYPE_CREATURE || mScriptType == SMART_SCRIPT_TYPE_GAMEOBJECT) && !GetBaseObject())
|
||||
|
||||
@@ -18,17 +18,17 @@
|
||||
#ifndef TRINITY_SMARTSCRIPT_H
|
||||
#define TRINITY_SMARTSCRIPT_H
|
||||
|
||||
#include "Common.h"
|
||||
#include "Creature.h"
|
||||
#include "CreatureAI.h"
|
||||
#include "Unit.h"
|
||||
#include "Spell.h"
|
||||
#include "GridNotifiers.h"
|
||||
|
||||
#include "Define.h"
|
||||
#include "SmartScriptMgr.h"
|
||||
//#include "SmartAI.h"
|
||||
|
||||
class Creature;
|
||||
class GameObject;
|
||||
class Player;
|
||||
class SpellInfo;
|
||||
class Unit;
|
||||
class WorldObject;
|
||||
struct AreaTriggerEntry;
|
||||
struct SceneTemplate;
|
||||
|
||||
class TC_GAME_API SmartScript
|
||||
{
|
||||
@@ -51,56 +51,18 @@ class TC_GAME_API SmartScript
|
||||
ObjectList* GetTargets(SmartScriptHolder const& e, Unit* invoker = nullptr);
|
||||
ObjectList* GetWorldObjectsInDist(float dist);
|
||||
void InstallTemplate(SmartScriptHolder const& e);
|
||||
SmartScriptHolder CreateEvent(SMART_EVENT e, uint32 event_flags, uint32 event_param1, uint32 event_param2, uint32 event_param3, uint32 event_param4, SMART_ACTION action, uint32 action_param1, uint32 action_param2, uint32 action_param3, uint32 action_param4, uint32 action_param5, uint32 action_param6, SMARTAI_TARGETS t, uint32 target_param1, uint32 target_param2, uint32 target_param3, uint32 phaseMask = 0);
|
||||
SmartScriptHolder CreateSmartEvent(SMART_EVENT e, uint32 event_flags, uint32 event_param1, uint32 event_param2, uint32 event_param3, uint32 event_param4, SMART_ACTION action, uint32 action_param1, uint32 action_param2, uint32 action_param3, uint32 action_param4, uint32 action_param5, uint32 action_param6, SMARTAI_TARGETS t, uint32 target_param1, uint32 target_param2, uint32 target_param3, uint32 phaseMask = 0);
|
||||
void AddEvent(SMART_EVENT e, uint32 event_flags, uint32 event_param1, uint32 event_param2, uint32 event_param3, uint32 event_param4, SMART_ACTION action, uint32 action_param1, uint32 action_param2, uint32 action_param3, uint32 action_param4, uint32 action_param5, uint32 action_param6, SMARTAI_TARGETS t, uint32 target_param1, uint32 target_param2, uint32 target_param3, uint32 phaseMask = 0);
|
||||
void SetPathId(uint32 id) { mPathId = id; }
|
||||
uint32 GetPathId() const { return mPathId; }
|
||||
WorldObject* GetBaseObject()
|
||||
{
|
||||
WorldObject* obj = nullptr;
|
||||
if (me)
|
||||
obj = me;
|
||||
else if (go)
|
||||
obj = go;
|
||||
return obj;
|
||||
}
|
||||
WorldObject* GetBaseObjectOrUnit(Unit* unit)
|
||||
{
|
||||
WorldObject* summoner = GetBaseObject();
|
||||
|
||||
if (!summoner && unit)
|
||||
return unit;
|
||||
|
||||
return summoner;
|
||||
}
|
||||
|
||||
static bool IsUnit(WorldObject* obj)
|
||||
{
|
||||
return obj && (obj->GetTypeId() == TYPEID_UNIT || obj->GetTypeId() == TYPEID_PLAYER);
|
||||
}
|
||||
|
||||
static bool IsPlayer(WorldObject* obj)
|
||||
{
|
||||
return obj && obj->GetTypeId() == TYPEID_PLAYER;
|
||||
}
|
||||
|
||||
static bool IsCreature(WorldObject* obj)
|
||||
{
|
||||
return obj && obj->GetTypeId() == TYPEID_UNIT;
|
||||
}
|
||||
|
||||
static bool IsCreatureInControlOfSelf(WorldObject* obj)
|
||||
{
|
||||
if (Creature* creatureObj = obj ? obj->ToCreature() : nullptr)
|
||||
return !creatureObj->IsCharmed() && !creatureObj->IsControlledByPlayer();
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool IsGameObject(WorldObject* obj)
|
||||
{
|
||||
return obj && obj->GetTypeId() == TYPEID_GAMEOBJECT;
|
||||
}
|
||||
WorldObject* GetBaseObject();
|
||||
WorldObject* GetBaseObjectOrUnit(Unit* unit);
|
||||
static bool IsUnit(WorldObject* obj);
|
||||
static bool IsPlayer(WorldObject* obj);
|
||||
static bool IsCreature(WorldObject* obj);
|
||||
static bool IsCreatureInControlOfSelf(WorldObject* obj);
|
||||
static bool IsGameObject(WorldObject* obj);
|
||||
|
||||
void OnUpdate(const uint32 diff);
|
||||
void OnMoveInLineOfSight(Unit* who);
|
||||
@@ -110,144 +72,23 @@ class TC_GAME_API SmartScript
|
||||
void DoFindFriendlyMissingBuff(std::list<Creature*>& list, float range, uint32 spellid);
|
||||
Unit* DoFindClosestFriendlyInRange(float range, bool playerOnly);
|
||||
|
||||
void StoreTargetList(ObjectList* targets, uint32 id)
|
||||
{
|
||||
if (!targets)
|
||||
return;
|
||||
bool IsSmart(Creature* c = NULL);
|
||||
bool IsSmartGO(GameObject* g = NULL);
|
||||
|
||||
if (mTargetStorage->find(id) != mTargetStorage->end())
|
||||
{
|
||||
// check if already stored
|
||||
if ((*mTargetStorage)[id]->Equals(targets))
|
||||
return;
|
||||
void StoreTargetList(ObjectList* targets, uint32 id);
|
||||
ObjectList* GetTargetList(uint32 id);
|
||||
|
||||
delete (*mTargetStorage)[id];
|
||||
}
|
||||
void StoreCounter(uint32 id, uint32 value, uint32 reset);
|
||||
uint32 GetCounterId(uint32 id);
|
||||
uint32 GetCounterValue(uint32 id);
|
||||
|
||||
(*mTargetStorage)[id] = new ObjectGuidList(targets, GetBaseObject());
|
||||
}
|
||||
|
||||
bool IsSmart(Creature* c = nullptr)
|
||||
{
|
||||
bool smart = true;
|
||||
if (c && c->GetAIName() != "SmartAI")
|
||||
smart = false;
|
||||
|
||||
if (!me || me->GetAIName() != "SmartAI")
|
||||
smart = false;
|
||||
|
||||
if (!smart)
|
||||
TC_LOG_ERROR("sql.sql", "SmartScript: Action target Creature (GUID: " UI64FMTD " Entry: %u) is not using SmartAI, action called by Creature (GUID: " UI64FMTD " Entry: %u) skipped to prevent crash.", uint64(c ? c->GetSpawnId() : UI64LIT(0)), c ? c->GetEntry() : 0, uint64(me ? me->GetSpawnId() : UI64LIT(0)), me ? me->GetEntry() : 0);
|
||||
|
||||
return smart;
|
||||
}
|
||||
|
||||
bool IsSmartGO(GameObject* g = nullptr)
|
||||
{
|
||||
bool smart = true;
|
||||
if (g && g->GetAIName() != "SmartGameObjectAI")
|
||||
smart = false;
|
||||
|
||||
if (!go || go->GetAIName() != "SmartGameObjectAI")
|
||||
smart = false;
|
||||
if (!smart)
|
||||
TC_LOG_ERROR("sql.sql", "SmartScript: Action target GameObject (GUID: " UI64FMTD " Entry: %u) is not using SmartGameObjectAI, action called by GameObject (GUID: " UI64FMTD " Entry: %u) skipped to prevent crash.", uint64(g ? g->GetSpawnId() : UI64LIT(0)), g ? g->GetEntry() : 0, uint64(go ? go->GetSpawnId() : UI64LIT(0)), go ? go->GetEntry() : 0);
|
||||
|
||||
return smart;
|
||||
}
|
||||
|
||||
ObjectList* GetTargetList(uint32 id)
|
||||
{
|
||||
ObjectListMap::iterator itr = mTargetStorage->find(id);
|
||||
if (itr != mTargetStorage->end())
|
||||
return (*itr).second->GetObjectList();
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void StoreCounter(uint32 id, uint32 value, uint32 reset)
|
||||
{
|
||||
CounterMap::const_iterator itr = mCounterList.find(id);
|
||||
if (itr != mCounterList.end())
|
||||
{
|
||||
if (reset == 0)
|
||||
value += GetCounterValue(id);
|
||||
mCounterList.erase(id);
|
||||
}
|
||||
|
||||
mCounterList.insert(std::make_pair(id, value));
|
||||
ProcessEventsFor(SMART_EVENT_COUNTER_SET);
|
||||
}
|
||||
|
||||
uint32 GetCounterId(uint32 id)
|
||||
{
|
||||
CounterMap::iterator itr = mCounterList.find(id);
|
||||
if (itr != mCounterList.end())
|
||||
return itr->first;
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32 GetCounterValue(uint32 id)
|
||||
{
|
||||
CounterMap::iterator itr = mCounterList.find(id);
|
||||
if (itr != mCounterList.end())
|
||||
return itr->second;
|
||||
return 0;
|
||||
}
|
||||
|
||||
GameObject* FindGameObjectNear(WorldObject* searchObject, ObjectGuid::LowType guid) const
|
||||
{
|
||||
auto bounds = searchObject->GetMap()->GetGameObjectBySpawnIdStore().equal_range(guid);
|
||||
if (bounds.first == bounds.second)
|
||||
return nullptr;
|
||||
|
||||
return bounds.first->second;
|
||||
}
|
||||
|
||||
Creature* FindCreatureNear(WorldObject* searchObject, ObjectGuid::LowType guid) const
|
||||
{
|
||||
auto bounds = searchObject->GetMap()->GetCreatureBySpawnIdStore().equal_range(guid);
|
||||
if (bounds.first == bounds.second)
|
||||
return nullptr;
|
||||
|
||||
auto creatureItr = std::find_if(bounds.first, bounds.second, [](Map::CreatureBySpawnIdContainer::value_type const& pair)
|
||||
{
|
||||
return pair.second->IsAlive();
|
||||
});
|
||||
|
||||
return creatureItr != bounds.second ? creatureItr->second : bounds.first->second;
|
||||
}
|
||||
GameObject* FindGameObjectNear(WorldObject* searchObject, ObjectGuid::LowType guid) const;
|
||||
Creature* FindCreatureNear(WorldObject* searchObject, ObjectGuid::LowType guid) const;
|
||||
|
||||
ObjectListMap* mTargetStorage;
|
||||
|
||||
void OnReset();
|
||||
void ResetBaseObject()
|
||||
{
|
||||
WorldObject* lookupRoot = me;
|
||||
if (!lookupRoot)
|
||||
lookupRoot = go;
|
||||
|
||||
if (lookupRoot)
|
||||
{
|
||||
if (!meOrigGUID.IsEmpty())
|
||||
{
|
||||
if (Creature* m = ObjectAccessor::GetCreature(*lookupRoot, meOrigGUID))
|
||||
{
|
||||
me = m;
|
||||
go = nullptr;
|
||||
}
|
||||
}
|
||||
if (!goOrigGUID.IsEmpty())
|
||||
{
|
||||
if (GameObject* o = ObjectAccessor::GetGameObject(*lookupRoot, goOrigGUID))
|
||||
{
|
||||
me = nullptr;
|
||||
go = o;
|
||||
}
|
||||
}
|
||||
}
|
||||
goOrigGUID.Clear();
|
||||
meOrigGUID.Clear();
|
||||
}
|
||||
void ResetBaseObject();
|
||||
|
||||
//TIMED_ACTIONLIST (script type 9 aka script9)
|
||||
void SetScript9(SmartScriptHolder& e, uint32 entry);
|
||||
@@ -291,7 +132,7 @@ class TC_GAME_API SmartScript
|
||||
|
||||
uint32 mPathId;
|
||||
SmartAIEventList mStoredEvents;
|
||||
std::list<uint32>mRemIDs;
|
||||
std::list<uint32> mRemIDs;
|
||||
|
||||
uint32 mTextTimer;
|
||||
uint32 mLastTextID;
|
||||
@@ -301,20 +142,7 @@ class TC_GAME_API SmartScript
|
||||
SMARTAI_TEMPLATE mTemplate;
|
||||
void InstallEvents();
|
||||
|
||||
void RemoveStoredEvent(uint32 id)
|
||||
{
|
||||
if (!mStoredEvents.empty())
|
||||
{
|
||||
for (SmartAIEventList::iterator i = mStoredEvents.begin(); i != mStoredEvents.end(); ++i)
|
||||
{
|
||||
if (i->event_id == id)
|
||||
{
|
||||
mStoredEvents.erase(i);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
void RemoveStoredEvent(uint32 id);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -15,19 +15,15 @@
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "DatabaseEnv.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "ObjectDefines.h"
|
||||
#include "GridDefines.h"
|
||||
#include "GridNotifiers.h"
|
||||
#include "InstanceScript.h"
|
||||
#include "SpellMgr.h"
|
||||
#include "Cell.h"
|
||||
#include "GameEventMgr.h"
|
||||
#include "CreatureTextMgr.h"
|
||||
#include "SpellInfo.h"
|
||||
|
||||
#include "SmartScriptMgr.h"
|
||||
#include "CreatureTextMgr.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "GameEventMgr.h"
|
||||
#include "InstanceScript.h"
|
||||
#include "Log.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "SpellInfo.h"
|
||||
#include "SpellMgr.h"
|
||||
|
||||
SmartWaypointMgr* SmartWaypointMgr::instance()
|
||||
{
|
||||
@@ -313,6 +309,43 @@ void SmartAIMgr::LoadSmartAIFromDB()
|
||||
UnLoadHelperStores();
|
||||
}
|
||||
|
||||
SmartAIEventList SmartAIMgr::GetScript(int32 entry, SmartScriptType type)
|
||||
{
|
||||
SmartAIEventList temp;
|
||||
if (mEventMap[uint32(type)].find(entry) != mEventMap[uint32(type)].end())
|
||||
return mEventMap[uint32(type)][entry];
|
||||
else
|
||||
{
|
||||
if (entry > 0)//first search is for guid (negative), do not drop error if not found
|
||||
TC_LOG_DEBUG("scripts.ai", "SmartAIMgr::GetScript: Could not load Script for Entry %d ScriptType %u.", entry, uint32(type));
|
||||
return temp;
|
||||
}
|
||||
}
|
||||
|
||||
SmartScriptHolder& SmartAIMgr::FindLinkedSourceEvent(SmartAIEventList& list, uint32 eventId)
|
||||
{
|
||||
SmartAIEventList::iterator itr = std::find_if(list.begin(), list.end(),
|
||||
[eventId](SmartScriptHolder& source) { return source.link == eventId; });
|
||||
|
||||
if (itr != list.end())
|
||||
return *itr;
|
||||
|
||||
static SmartScriptHolder SmartScriptHolderDummy;
|
||||
return SmartScriptHolderDummy;
|
||||
}
|
||||
|
||||
SmartScriptHolder& SmartAIMgr::FindLinkedEvent(SmartAIEventList& list, uint32 link)
|
||||
{
|
||||
SmartAIEventList::iterator itr = std::find_if(list.begin(), list.end(),
|
||||
[link](SmartScriptHolder& linked) { return linked.event_id == link && linked.GetEventType() == SMART_EVENT_LINK; });
|
||||
|
||||
if (itr != list.end())
|
||||
return *itr;
|
||||
|
||||
static SmartScriptHolder SmartScriptHolderDummy;
|
||||
return SmartScriptHolderDummy;
|
||||
}
|
||||
|
||||
bool SmartAIMgr::IsTargetValid(SmartScriptHolder const& e)
|
||||
{
|
||||
if (std::abs(e.target.o) > 2 * float(M_PI))
|
||||
@@ -395,6 +428,126 @@ bool SmartAIMgr::IsTargetValid(SmartScriptHolder const& e)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SmartAIMgr::IsMinMaxValid(SmartScriptHolder const& e, uint32 min, uint32 max)
|
||||
{
|
||||
if (max < min)
|
||||
{
|
||||
TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry " SI64FMTD " SourceType %u Event %u Action %u uses min/max params wrong (%u/%u), skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), min, max);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SmartAIMgr::NotNULL(SmartScriptHolder const& e, uint32 data)
|
||||
{
|
||||
if (!data)
|
||||
{
|
||||
TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry " SI64FMTD " SourceType %u Event %u Action %u Parameter can not be NULL, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SmartAIMgr::IsCreatureValid(SmartScriptHolder const& e, uint32 entry)
|
||||
{
|
||||
if (!sObjectMgr->GetCreatureTemplate(entry))
|
||||
{
|
||||
TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry " SI64FMTD " SourceType %u Event %u Action %u uses non-existent Creature entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SmartAIMgr::IsQuestValid(SmartScriptHolder const& e, uint32 entry)
|
||||
{
|
||||
if (!sObjectMgr->GetQuestTemplate(entry))
|
||||
{
|
||||
TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry " SI64FMTD " SourceType %u Event %u Action %u uses non-existent Quest entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SmartAIMgr::IsGameObjectValid(SmartScriptHolder const& e, uint32 entry)
|
||||
{
|
||||
if (!sObjectMgr->GetGameObjectTemplate(entry))
|
||||
{
|
||||
TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry " SI64FMTD " SourceType %u Event %u Action %u uses non-existent GameObject entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SmartAIMgr::IsSpellValid(SmartScriptHolder const& e, uint32 entry)
|
||||
{
|
||||
if (!sSpellMgr->GetSpellInfo(entry))
|
||||
{
|
||||
TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry " SI64FMTD " SourceType %u Event %u Action %u uses non-existent Spell entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SmartAIMgr::IsItemValid(SmartScriptHolder const& e, uint32 entry)
|
||||
{
|
||||
if (!sItemStore.LookupEntry(entry))
|
||||
{
|
||||
TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry " SI64FMTD " SourceType %u Event %u Action %u uses non-existent Item entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SmartAIMgr::IsTextEmoteValid(SmartScriptHolder const& e, uint32 entry)
|
||||
{
|
||||
if (!sEmotesTextStore.LookupEntry(entry))
|
||||
{
|
||||
TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry " SI64FMTD " SourceType %u Event %u Action %u uses non-existent Text Emote entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SmartAIMgr::IsEmoteValid(SmartScriptHolder const& e, uint32 entry)
|
||||
{
|
||||
if (!sEmotesStore.LookupEntry(entry))
|
||||
{
|
||||
TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry " SI64FMTD " SourceType %u Event %u Action %u uses non-existent Emote entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SmartAIMgr::IsAreaTriggerValid(SmartScriptHolder const& e, uint32 entry)
|
||||
{
|
||||
if (!sAreaTriggerStore.LookupEntry(entry))
|
||||
{
|
||||
TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry " SI64FMTD " SourceType %u Event %u Action %u uses non-existent AreaTrigger entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SmartAIMgr::IsSoundValid(SmartScriptHolder const& e, uint32 entry)
|
||||
{
|
||||
if (!sSoundKitStore.LookupEntry(entry))
|
||||
{
|
||||
TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry " SI64FMTD " SourceType %u Event %u Action %u uses non-existent Sound entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SmartAIMgr::IsAnimKitValid(SmartScriptHolder const& e, uint32 entry)
|
||||
{
|
||||
if (!sAnimKitStore.LookupEntry(entry))
|
||||
{
|
||||
TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry " SI64FMTD " SourceType %u Event %u Action %u uses non-existent AnimKit entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
|
||||
{
|
||||
if (e.event.type >= SMART_EVENT_END)
|
||||
@@ -869,7 +1022,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
|
||||
break;
|
||||
case SMART_ACTION_RANDOM_SOUND:
|
||||
{
|
||||
if (std::all_of(e.action.randomSound.sounds.begin(), e.action.randomSound.sounds.end(), [](uint32 sound) { return sound == 0; }))
|
||||
if (std::all_of(std::begin(e.action.randomSound.sounds), std::end(e.action.randomSound.sounds), [](uint32 sound) { return sound == 0; }))
|
||||
{
|
||||
TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry " SI64FMTD " SourceType %u Event %u Action %u does not have any non-zero sound",
|
||||
e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
|
||||
@@ -1438,3 +1591,34 @@ CacheSpellContainerBounds SmartAIMgr::GetCreateItemSpellContainerBounds(uint32 i
|
||||
return CreateItemSpellStore.equal_range(itemId);
|
||||
}
|
||||
|
||||
ObjectGuidList::ObjectGuidList(ObjectList* objectList, WorldObject* baseObject)
|
||||
{
|
||||
ASSERT(objectList != NULL);
|
||||
m_objectList = objectList;
|
||||
m_baseObject = baseObject;
|
||||
m_guidList = new GuidList();
|
||||
|
||||
for (ObjectList::iterator itr = objectList->begin(); itr != objectList->end(); ++itr)
|
||||
{
|
||||
m_guidList->push_back((*itr)->GetGUID());
|
||||
}
|
||||
}
|
||||
|
||||
ObjectList* ObjectGuidList::GetObjectList()
|
||||
{
|
||||
if (m_baseObject)
|
||||
{
|
||||
//sanitize list using m_guidList
|
||||
m_objectList->clear();
|
||||
|
||||
for (GuidList::iterator itr = m_guidList->begin(); itr != m_guidList->end(); ++itr)
|
||||
{
|
||||
if (WorldObject* obj = ObjectAccessor::GetWorldObject(*m_baseObject, *itr))
|
||||
m_objectList->push_back(obj);
|
||||
else
|
||||
TC_LOG_DEBUG("scripts.ai", "SmartScript::mTargetStorage stores a guid to an invalid object: %s", itr->ToString().c_str());
|
||||
}
|
||||
}
|
||||
|
||||
return m_objectList;
|
||||
}
|
||||
|
||||
@@ -18,15 +18,14 @@
|
||||
#ifndef TRINITY_SMARTSCRIPTMGR_H
|
||||
#define TRINITY_SMARTSCRIPTMGR_H
|
||||
|
||||
#include "Common.h"
|
||||
#include "Creature.h"
|
||||
#include "CreatureAI.h"
|
||||
#include "Unit.h"
|
||||
#include "Spell.h"
|
||||
#include "DB2Stores.h"
|
||||
#include "Define.h"
|
||||
#include "ObjectGuid.h"
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
|
||||
//#include "SmartScript.h"
|
||||
//#include "SmartAI.h"
|
||||
class WorldObject;
|
||||
enum SpellEffIndex : uint8;
|
||||
|
||||
struct WayPoint
|
||||
{
|
||||
@@ -1075,7 +1074,7 @@ struct SmartAction
|
||||
|
||||
struct
|
||||
{
|
||||
std::array<uint32, SMART_ACTION_PARAM_COUNT - 1> sounds;
|
||||
uint32 sounds[SMART_ACTION_PARAM_COUNT - 1];
|
||||
uint32 onlySelf;
|
||||
} randomSound;
|
||||
|
||||
@@ -1471,37 +1470,9 @@ class ObjectGuidList
|
||||
WorldObject* m_baseObject;
|
||||
|
||||
public:
|
||||
ObjectGuidList(ObjectList* objectList, WorldObject* baseObject)
|
||||
{
|
||||
ASSERT(objectList != NULL);
|
||||
m_objectList = objectList;
|
||||
m_baseObject = baseObject;
|
||||
m_guidList = new GuidList();
|
||||
ObjectGuidList(ObjectList* objectList, WorldObject* baseObject);
|
||||
|
||||
for (ObjectList::iterator itr = objectList->begin(); itr != objectList->end(); ++itr)
|
||||
{
|
||||
m_guidList->push_back((*itr)->GetGUID());
|
||||
}
|
||||
}
|
||||
|
||||
ObjectList* GetObjectList()
|
||||
{
|
||||
if (m_baseObject)
|
||||
{
|
||||
//sanitize list using m_guidList
|
||||
m_objectList->clear();
|
||||
|
||||
for (GuidList::iterator itr = m_guidList->begin(); itr != m_guidList->end(); ++itr)
|
||||
{
|
||||
if (WorldObject* obj = ObjectAccessor::GetWorldObject(*m_baseObject, *itr))
|
||||
m_objectList->push_back(obj);
|
||||
else
|
||||
TC_LOG_DEBUG("scripts.ai", "SmartScript::mTargetStorage stores a guid to an invalid object: %s", itr->ToString().c_str());
|
||||
}
|
||||
}
|
||||
|
||||
return m_objectList;
|
||||
}
|
||||
ObjectList* GetObjectList();
|
||||
|
||||
bool Equals(ObjectList* objectList)
|
||||
{
|
||||
@@ -1559,42 +1530,11 @@ class TC_GAME_API SmartAIMgr
|
||||
|
||||
void LoadSmartAIFromDB();
|
||||
|
||||
SmartAIEventList GetScript(int32 entry, SmartScriptType type)
|
||||
{
|
||||
SmartAIEventList temp;
|
||||
if (mEventMap[uint32(type)].find(entry) != mEventMap[uint32(type)].end())
|
||||
return mEventMap[uint32(type)][entry];
|
||||
else
|
||||
{
|
||||
if (entry > 0)//first search is for guid (negative), do not drop error if not found
|
||||
TC_LOG_DEBUG("scripts.ai", "SmartAIMgr::GetScript: Could not load Script for Entry %d ScriptType %u.", entry, uint32(type));
|
||||
return temp;
|
||||
}
|
||||
}
|
||||
SmartAIEventList GetScript(int32 entry, SmartScriptType type);
|
||||
|
||||
static SmartScriptHolder& FindLinkedSourceEvent(SmartAIEventList& list, uint32 eventId)
|
||||
{
|
||||
SmartAIEventList::iterator itr = std::find_if(list.begin(), list.end(),
|
||||
[eventId](SmartScriptHolder& source) { return source.link == eventId; });
|
||||
static SmartScriptHolder& FindLinkedSourceEvent(SmartAIEventList& list, uint32 eventId);
|
||||
|
||||
if (itr != list.end())
|
||||
return *itr;
|
||||
|
||||
static SmartScriptHolder SmartScriptHolderDummy;
|
||||
return SmartScriptHolderDummy;
|
||||
}
|
||||
|
||||
static SmartScriptHolder& FindLinkedEvent(SmartAIEventList& list, uint32 link)
|
||||
{
|
||||
SmartAIEventList::iterator itr = std::find_if(list.begin(), list.end(),
|
||||
[link](SmartScriptHolder& linked) { return linked.event_id == link && linked.GetEventType() == SMART_EVENT_LINK; });
|
||||
|
||||
if (itr != list.end())
|
||||
return *itr;
|
||||
|
||||
static SmartScriptHolder SmartScriptHolderDummy;
|
||||
return SmartScriptHolderDummy;
|
||||
}
|
||||
static SmartScriptHolder& FindLinkedEvent(SmartAIEventList& list, uint32 link);
|
||||
|
||||
private:
|
||||
//event stores
|
||||
@@ -1602,16 +1542,7 @@ class TC_GAME_API SmartAIMgr
|
||||
|
||||
bool IsEventValid(SmartScriptHolder& e);
|
||||
bool IsTargetValid(SmartScriptHolder const& e);
|
||||
|
||||
bool IsMinMaxValid(SmartScriptHolder const& e, uint32 min, uint32 max)
|
||||
{
|
||||
if (max < min)
|
||||
{
|
||||
TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry " SI64FMTD " SourceType %u Event %u Action %u uses min/max params wrong (%u/%u), skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), min, max);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
bool IsMinMaxValid(SmartScriptHolder const& e, uint32 min, uint32 max);
|
||||
|
||||
/*inline bool IsPercentValid(SmartScriptHolder e, int32 pct)
|
||||
{
|
||||
@@ -1623,116 +1554,17 @@ class TC_GAME_API SmartAIMgr
|
||||
return true;
|
||||
}*/
|
||||
|
||||
bool NotNULL(SmartScriptHolder const& e, uint32 data)
|
||||
{
|
||||
if (!data)
|
||||
{
|
||||
TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry " SI64FMTD " SourceType %u Event %u Action %u Parameter can not be NULL, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool IsCreatureValid(SmartScriptHolder const& e, uint32 entry)
|
||||
{
|
||||
if (!sObjectMgr->GetCreatureTemplate(entry))
|
||||
{
|
||||
TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry " SI64FMTD " SourceType %u Event %u Action %u uses non-existent Creature entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool IsQuestValid(SmartScriptHolder const& e, uint32 entry)
|
||||
{
|
||||
if (!sObjectMgr->GetQuestTemplate(entry))
|
||||
{
|
||||
TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry " SI64FMTD " SourceType %u Event %u Action %u uses non-existent Quest entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool IsGameObjectValid(SmartScriptHolder const& e, uint32 entry)
|
||||
{
|
||||
if (!sObjectMgr->GetGameObjectTemplate(entry))
|
||||
{
|
||||
TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry " SI64FMTD " SourceType %u Event %u Action %u uses non-existent GameObject entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool IsSpellValid(SmartScriptHolder const& e, uint32 entry)
|
||||
{
|
||||
if (!sSpellMgr->GetSpellInfo(entry))
|
||||
{
|
||||
TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry " SI64FMTD " SourceType %u Event %u Action %u uses non-existent Spell entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool IsItemValid(SmartScriptHolder const& e, uint32 entry)
|
||||
{
|
||||
if (!sItemStore.LookupEntry(entry))
|
||||
{
|
||||
TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry " SI64FMTD " SourceType %u Event %u Action %u uses non-existent Item entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool IsTextEmoteValid(SmartScriptHolder const& e, uint32 entry)
|
||||
{
|
||||
if (!sEmotesTextStore.LookupEntry(entry))
|
||||
{
|
||||
TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry " SI64FMTD " SourceType %u Event %u Action %u uses non-existent Text Emote entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool IsEmoteValid(SmartScriptHolder const& e, uint32 entry)
|
||||
{
|
||||
if (!sEmotesStore.LookupEntry(entry))
|
||||
{
|
||||
TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry " SI64FMTD " SourceType %u Event %u Action %u uses non-existent Emote entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool IsAreaTriggerValid(SmartScriptHolder const& e, uint32 entry)
|
||||
{
|
||||
if (!sAreaTriggerStore.LookupEntry(entry))
|
||||
{
|
||||
TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry " SI64FMTD " SourceType %u Event %u Action %u uses non-existent AreaTrigger entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool IsSoundValid(SmartScriptHolder const& e, uint32 entry)
|
||||
{
|
||||
if (!sSoundKitStore.LookupEntry(entry))
|
||||
{
|
||||
TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry " SI64FMTD " SourceType %u Event %u Action %u uses non-existent Sound entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool IsAnimKitValid(SmartScriptHolder const& e, uint32 entry)
|
||||
{
|
||||
if (!sAnimKitStore.LookupEntry(entry))
|
||||
{
|
||||
TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry " SI64FMTD " SourceType %u Event %u Action %u uses non-existent AnimKit entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool NotNULL(SmartScriptHolder const& e, uint32 data);
|
||||
bool IsCreatureValid(SmartScriptHolder const& e, uint32 entry);
|
||||
bool IsQuestValid(SmartScriptHolder const& e, uint32 entry);
|
||||
bool IsGameObjectValid(SmartScriptHolder const& e, uint32 entry);
|
||||
bool IsSpellValid(SmartScriptHolder const& e, uint32 entry);
|
||||
bool IsItemValid(SmartScriptHolder const& e, uint32 entry);
|
||||
bool IsTextEmoteValid(SmartScriptHolder const& e, uint32 entry);
|
||||
bool IsEmoteValid(SmartScriptHolder const& e, uint32 entry);
|
||||
bool IsAreaTriggerValid(SmartScriptHolder const& e, uint32 entry);
|
||||
bool IsSoundValid(SmartScriptHolder const& e, uint32 entry);
|
||||
bool IsAnimKitValid(SmartScriptHolder const& e, uint32 entry);
|
||||
bool IsTextValid(SmartScriptHolder const& e, uint32 id);
|
||||
|
||||
// Helpers
|
||||
|
||||
@@ -22,9 +22,11 @@
|
||||
#include "Log.h"
|
||||
#include "ObjectAccessor.h"
|
||||
#include "Player.h"
|
||||
#include "Realm.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "Util.h"
|
||||
#include "SHA1.h"
|
||||
#include "World.h"
|
||||
#include "WorldSession.h"
|
||||
|
||||
AccountMgr::AccountMgr() { }
|
||||
|
||||
@@ -15,8 +15,8 @@
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "AccountMgr.h"
|
||||
#include "BattlenetAccountMgr.h"
|
||||
#include "AccountMgr.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "Util.h"
|
||||
#include "SHA256.h"
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
|
||||
#include "RBAC.h"
|
||||
#include "AccountMgr.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "Log.h"
|
||||
#include "QueryCallback.h"
|
||||
#include <sstream>
|
||||
|
||||
namespace rbac
|
||||
|
||||
@@ -40,7 +40,8 @@
|
||||
#ifndef _RBAC_H
|
||||
#define _RBAC_H
|
||||
|
||||
#include "DatabaseEnv.h"
|
||||
#include "Define.h"
|
||||
#include "DatabaseEnvFwd.h"
|
||||
#include <string>
|
||||
#include <set>
|
||||
#include <map>
|
||||
|
||||
@@ -20,11 +20,15 @@
|
||||
#include "AchievementPackets.h"
|
||||
#include "CellImpl.h"
|
||||
#include "ChatTextBuilder.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "GridNotifiersImpl.h"
|
||||
#include "Group.h"
|
||||
#include "Guild.h"
|
||||
#include "GuildMgr.h"
|
||||
#include "Language.h"
|
||||
#include "Log.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "World.h"
|
||||
|
||||
struct VisibleAchievementCheck
|
||||
{
|
||||
|
||||
@@ -18,12 +18,14 @@
|
||||
#include "CriteriaHandler.h"
|
||||
#include "ArenaTeamMgr.h"
|
||||
#include "Battleground.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "DB2Stores.h"
|
||||
#include "DisableMgr.h"
|
||||
#include "GameEventMgr.h"
|
||||
#include "Garrison.h"
|
||||
#include "Group.h"
|
||||
#include "InstanceScript.h"
|
||||
#include "Log.h"
|
||||
#include "MapManager.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "Player.h"
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
|
||||
#include "DBCEnums.h"
|
||||
#include "ObjectGuid.h"
|
||||
#include "Transaction.h"
|
||||
#include "DatabaseEnvFwd.h"
|
||||
#include "Common.h"
|
||||
#include <map>
|
||||
#include <unordered_map>
|
||||
|
||||
@@ -16,19 +16,21 @@
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "Common.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "Player.h"
|
||||
#include "World.h"
|
||||
#include "WorldPacket.h"
|
||||
#include "WorldSession.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "AccountMgr.h"
|
||||
#include "AuctionHouseMgr.h"
|
||||
#include "AuctionHousePackets.h"
|
||||
#include "AccountMgr.h"
|
||||
#include "Common.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "Item.h"
|
||||
#include "Language.h"
|
||||
#include "Log.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "Player.h"
|
||||
#include "Realm.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "World.h"
|
||||
#include "WorldPacket.h"
|
||||
#include "WorldSession.h"
|
||||
#include <vector>
|
||||
|
||||
enum eAuctionHouse
|
||||
|
||||
@@ -19,16 +19,31 @@
|
||||
#ifndef _AUCTION_HOUSE_MGR_H
|
||||
#define _AUCTION_HOUSE_MGR_H
|
||||
|
||||
#include "Common.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "Define.h"
|
||||
#include "DatabaseEnvFwd.h"
|
||||
#include "ItemTemplate.h"
|
||||
#include "ObjectGuid.h"
|
||||
#include "AuctionHousePackets.h"
|
||||
#include "Optional.h"
|
||||
#include <map>
|
||||
#include <set>
|
||||
#include <unordered_map>
|
||||
|
||||
class Item;
|
||||
class Player;
|
||||
class WorldPacket;
|
||||
|
||||
namespace WorldPackets
|
||||
{
|
||||
namespace AuctionHouse
|
||||
{
|
||||
struct AuctionItem;
|
||||
class AuctionListBidderItemsResult;
|
||||
class AuctionListOwnerItemsResult;
|
||||
class AuctionListItemsResult;
|
||||
class AuctionReplicateResponse;
|
||||
}
|
||||
}
|
||||
|
||||
#define MIN_AUCTION_TIME (12*HOUR)
|
||||
|
||||
enum AuctionError
|
||||
|
||||
@@ -15,10 +15,11 @@
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "Log.h"
|
||||
#include "AuctionHouseBotBuyer.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "Item.h"
|
||||
#include "ItemTemplate.h"
|
||||
#include "AuctionHouseBotBuyer.h"
|
||||
#include "Log.h"
|
||||
#include "Random.h"
|
||||
|
||||
AuctionBotBuyer::AuctionBotBuyer() : _checkInterval(20 * MINUTE)
|
||||
|
||||
@@ -15,10 +15,11 @@
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "AuctionHouseBotSeller.h"
|
||||
#include "AuctionHouseMgr.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "Log.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "AuctionHouseMgr.h"
|
||||
#include "AuctionHouseBotSeller.h"
|
||||
#include "Random.h"
|
||||
|
||||
AuctionBotSeller::AuctionBotSeller()
|
||||
@@ -988,7 +989,7 @@ void AuctionBotSeller::AddNewAuctions(SellerConfiguration& config)
|
||||
|
||||
// Update the just created item so that if it needs random properties it has them.
|
||||
// Ex: Notched Shortsword of Stamina will only generate as a Notched Shortsword without this.
|
||||
item->SetItemRandomProperties(Item::GenerateItemRandomPropertyId(itemId));
|
||||
item->SetItemRandomProperties(GenerateItemRandomPropertyId(itemId));
|
||||
|
||||
uint32 buyoutPrice;
|
||||
uint32 bidPrice = 0;
|
||||
|
||||
@@ -15,13 +15,14 @@
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "ObjectMgr.h"
|
||||
#include "BattlePetMgr.h"
|
||||
#include "Containers.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "Log.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "Player.h"
|
||||
#include "WorldSession.h"
|
||||
|
||||
|
||||
void BattlePetMgr::BattlePet::CalculateStats()
|
||||
{
|
||||
float health = 0.0f;
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#ifndef BattlePetMgr_h__
|
||||
#define BattlePetMgr_h__
|
||||
|
||||
#include "DatabaseEnvFwd.h"
|
||||
#include "DB2Stores.h"
|
||||
#include "BattlePetPackets.h"
|
||||
|
||||
|
||||
@@ -24,12 +24,15 @@
|
||||
#include "GridNotifiersImpl.h"
|
||||
#include "Group.h"
|
||||
#include "GroupMgr.h"
|
||||
#include "Log.h"
|
||||
#include "Map.h"
|
||||
#include "MapManager.h"
|
||||
#include "ObjectAccessor.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "WorldPacket.h"
|
||||
#include "BattlegroundPackets.h"
|
||||
#include "MiscPackets.h"
|
||||
#include "WorldStatePackets.h"
|
||||
|
||||
Battlefield::Battlefield()
|
||||
{
|
||||
@@ -252,6 +255,11 @@ void Battlefield::InvitePlayersInZoneToWar()
|
||||
}
|
||||
}
|
||||
|
||||
uint64 Battlefield::GetQueueId() const
|
||||
{
|
||||
return MAKE_PAIR64(m_BattleId | 0x20000, 0x1F100000);
|
||||
}
|
||||
|
||||
void Battlefield::InvitePlayerToWar(Player* player)
|
||||
{
|
||||
if (!player)
|
||||
|
||||
@@ -18,10 +18,10 @@
|
||||
#ifndef BATTLEFIELD_H_
|
||||
#define BATTLEFIELD_H_
|
||||
|
||||
#include "ObjectDefines.h"
|
||||
#include "Position.h"
|
||||
#include "SharedDefines.h"
|
||||
#include "ZoneScript.h"
|
||||
#include "Packets/WorldStatePackets.h"
|
||||
#include <map>
|
||||
|
||||
enum BattlefieldTypes
|
||||
{
|
||||
@@ -67,14 +67,31 @@ enum BattlefieldTimers
|
||||
};
|
||||
|
||||
// some class predefs
|
||||
class Player;
|
||||
class GameObject;
|
||||
class WorldPacket;
|
||||
class Creature;
|
||||
class Unit;
|
||||
|
||||
class Battlefield;
|
||||
class BfGraveyard;
|
||||
class Creature;
|
||||
class GameObject;
|
||||
class Group;
|
||||
class Map;
|
||||
class Player;
|
||||
class Unit;
|
||||
class WorldPacket;
|
||||
|
||||
struct Position;
|
||||
struct WorldSafeLocsEntry;
|
||||
|
||||
namespace WorldPackets
|
||||
{
|
||||
namespace WorldState
|
||||
{
|
||||
class InitWorldStates;
|
||||
}
|
||||
}
|
||||
|
||||
namespace G3D
|
||||
{
|
||||
class Quat;
|
||||
}
|
||||
|
||||
typedef std::vector<BfGraveyard*> GraveyardVect;
|
||||
typedef std::map<ObjectGuid, time_t> PlayerTimerMap;
|
||||
@@ -234,7 +251,7 @@ class TC_GAME_API Battlefield : public ZoneScript
|
||||
|
||||
uint32 GetTypeId() const { return m_TypeId; }
|
||||
uint32 GetZoneId() const { return m_ZoneId; }
|
||||
uint64 GetQueueId() const { return MAKE_PAIR64(m_BattleId | 0x20000, 0x1F100000); }
|
||||
uint64 GetQueueId() const;
|
||||
|
||||
void TeamApplyBuff(TeamId team, uint32 spellId, uint32 spellId2 = 0);
|
||||
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
#include "SpellAuras.h"
|
||||
#include "TemporarySummon.h"
|
||||
#include "WorldSession.h"
|
||||
#include "WorldStatePackets.h"
|
||||
|
||||
BattlefieldTB::~BattlefieldTB() { }
|
||||
|
||||
|
||||
@@ -24,12 +24,14 @@
|
||||
#include "CreatureTextMgr.h"
|
||||
#include "Battleground.h"
|
||||
#include "MapManager.h"
|
||||
#include "Log.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "Opcodes.h"
|
||||
#include "Player.h"
|
||||
#include "SpellAuras.h"
|
||||
#include "TemporarySummon.h"
|
||||
#include "WorldSession.h"
|
||||
#include "WorldStatePackets.h"
|
||||
|
||||
struct BfWGCoordGY
|
||||
{
|
||||
|
||||
@@ -21,9 +21,11 @@
|
||||
#include "GuildMgr.h"
|
||||
#include "Guild.h"
|
||||
#include "Language.h"
|
||||
#include "Log.h"
|
||||
#include "ObjectAccessor.h"
|
||||
#include "Player.h"
|
||||
#include "World.h"
|
||||
#include "WorldStatePackets.h"
|
||||
#include "WorldSession.h"
|
||||
|
||||
Arena::Arena()
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include "SharedDefines.h"
|
||||
#include "Player.h"
|
||||
#include "ObjectAccessor.h"
|
||||
#include <sstream>
|
||||
|
||||
struct TC_GAME_API ArenaScore : public BattlegroundScore
|
||||
{
|
||||
|
||||
@@ -16,15 +16,16 @@
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "ArenaTeam.h"
|
||||
#include "ArenaTeamMgr.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "Group.h"
|
||||
#include "Log.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "Player.h"
|
||||
#include "WorldPacket.h"
|
||||
#include "ArenaTeam.h"
|
||||
#include "World.h"
|
||||
#include "Group.h"
|
||||
#include "ArenaTeamMgr.h"
|
||||
#include "WorldPacket.h"
|
||||
#include "WorldSession.h"
|
||||
#include "Opcodes.h"
|
||||
|
||||
ArenaTeam::ArenaTeam()
|
||||
: TeamId(0), Type(0), TeamName(), CaptainGuid(), BackgroundColor(0), EmblemStyle(0), EmblemColor(0),
|
||||
|
||||
@@ -22,11 +22,13 @@
|
||||
#include "BattlegroundScore.h"
|
||||
#include "Creature.h"
|
||||
#include "CreatureTextMgr.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "Formulas.h"
|
||||
#include "GridNotifiersImpl.h"
|
||||
#include "Group.h"
|
||||
#include "GuildMgr.h"
|
||||
#include "Guild.h"
|
||||
#include "Log.h"
|
||||
#include "Object.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "Player.h"
|
||||
@@ -35,7 +37,9 @@
|
||||
#include "Util.h"
|
||||
#include "WorldPacket.h"
|
||||
#include "Transport.h"
|
||||
#include "BattlegroundPackets.h"
|
||||
#include "MiscPackets.h"
|
||||
#include "WorldStatePackets.h"
|
||||
|
||||
namespace Trinity
|
||||
{
|
||||
|
||||
@@ -26,8 +26,6 @@
|
||||
#include "WorldPacket.h"
|
||||
#include "Object.h"
|
||||
#include "GameObject.h"
|
||||
#include "Packets/WorldStatePackets.h"
|
||||
#include "Packets/BattlegroundPackets.h"
|
||||
#include "EventMap.h"
|
||||
|
||||
class Creature;
|
||||
@@ -42,6 +40,20 @@ class BattlegroundMap;
|
||||
struct PvpDifficultyEntry;
|
||||
struct WorldSafeLocsEntry;
|
||||
|
||||
namespace WorldPackets
|
||||
{
|
||||
namespace Battleground
|
||||
{
|
||||
class PVPLogData;
|
||||
struct BattlegroundPlayerPosition;
|
||||
}
|
||||
|
||||
namespace WorldState
|
||||
{
|
||||
class InitWorldStates;
|
||||
}
|
||||
}
|
||||
|
||||
enum BattlegroundCriteriaId
|
||||
{
|
||||
BG_CRITERIA_CHECK_RESILIENT_VICTORY,
|
||||
|
||||
@@ -16,34 +16,36 @@
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "Common.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "World.h"
|
||||
#include "WorldPacket.h"
|
||||
|
||||
#include "BattlegroundMgr.h"
|
||||
#include "BattlegroundAV.h"
|
||||
#include "BattlegroundAB.h"
|
||||
#include "BattlegroundEY.h"
|
||||
#include "BattlegroundWS.h"
|
||||
#include "BattlegroundNA.h"
|
||||
#include "BattlegroundAV.h"
|
||||
#include "BattlegroundBE.h"
|
||||
#include "BattlegroundRL.h"
|
||||
#include "BattlegroundSA.h"
|
||||
#include "BattlegroundDS.h"
|
||||
#include "BattlegroundRV.h"
|
||||
#include "BattlegroundIC.h"
|
||||
#include "BattlegroundTP.h"
|
||||
#include "BattlegroundBFG.h"
|
||||
#include "BattlegroundDS.h"
|
||||
#include "BattlegroundEY.h"
|
||||
#include "BattlegroundIC.h"
|
||||
#include "BattlegroundNA.h"
|
||||
#include "BattlegroundPackets.h"
|
||||
#include "BattlegroundRL.h"
|
||||
#include "BattlegroundRV.h"
|
||||
#include "BattlegroundSA.h"
|
||||
#include "BattlegroundTP.h"
|
||||
#include "BattlegroundWS.h"
|
||||
#include "Common.h"
|
||||
#include "Containers.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "DisableMgr.h"
|
||||
#include "GameEventMgr.h"
|
||||
#include "Log.h"
|
||||
#include "Map.h"
|
||||
#include "MapInstanced.h"
|
||||
#include "MapManager.h"
|
||||
#include "Player.h"
|
||||
#include "GameEventMgr.h"
|
||||
#include "SharedDefines.h"
|
||||
#include "DisableMgr.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "Opcodes.h"
|
||||
#include "Containers.h"
|
||||
#include "Player.h"
|
||||
#include "SharedDefines.h"
|
||||
#include "World.h"
|
||||
#include "WorldPacket.h"
|
||||
|
||||
/*********************************************************/
|
||||
/*** BATTLEGROUND MANAGER ***/
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
#include "ArenaTeam.h"
|
||||
#include "ArenaTeamMgr.h"
|
||||
#include "BattlegroundPackets.h"
|
||||
#include "BattlegroundMgr.h"
|
||||
#include "BattlegroundQueue.h"
|
||||
#include "Chat.h"
|
||||
@@ -25,6 +26,7 @@
|
||||
#include "Log.h"
|
||||
#include "Language.h"
|
||||
#include "Player.h"
|
||||
#include "World.h"
|
||||
|
||||
/*********************************************************/
|
||||
/*** BATTLEGROUND QUEUE SYSTEM ***/
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include "Random.h"
|
||||
#include "Util.h"
|
||||
#include "WorldSession.h"
|
||||
#include "WorldStatePackets.h"
|
||||
|
||||
BattlegroundAB::BattlegroundAB()
|
||||
{
|
||||
|
||||
@@ -17,14 +17,13 @@
|
||||
*/
|
||||
|
||||
#include "BattlegroundAV.h"
|
||||
|
||||
#include "ObjectMgr.h"
|
||||
#include "WorldPacket.h"
|
||||
|
||||
#include "GameObject.h"
|
||||
#include "Language.h"
|
||||
#include "Log.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "Player.h"
|
||||
#include "ScriptedCreature.h"
|
||||
#include "WorldPacket.h"
|
||||
#include "WorldSession.h"
|
||||
|
||||
BattlegroundAV::BattlegroundAV()
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include "Log.h"
|
||||
#include "Player.h"
|
||||
#include "WorldPacket.h"
|
||||
#include "WorldStatePackets.h"
|
||||
|
||||
BattlegroundBE::BattlegroundBE()
|
||||
{
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include "Player.h"
|
||||
#include "Random.h"
|
||||
#include "WorldPacket.h"
|
||||
#include "WorldStatePackets.h"
|
||||
|
||||
BattlegroundDS::BattlegroundDS()
|
||||
{
|
||||
|
||||
@@ -25,6 +25,8 @@
|
||||
#include "Player.h"
|
||||
#include "Random.h"
|
||||
#include "Util.h"
|
||||
#include "BattlegroundPackets.h"
|
||||
#include "WorldStatePackets.h"
|
||||
|
||||
// these variables aren't used outside of this file, so declare them only here
|
||||
uint32 BG_EY_HonorScoreTicks[BG_HONOR_MODE_NUM] =
|
||||
|
||||
@@ -16,16 +16,16 @@
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "Player.h"
|
||||
#include "Battleground.h"
|
||||
#include "BattlegroundIC.h"
|
||||
#include "Language.h"
|
||||
#include "WorldPacket.h"
|
||||
#include "GameObject.h"
|
||||
#include "Language.h"
|
||||
#include "Log.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "Vehicle.h"
|
||||
#include "Transport.h"
|
||||
#include "Player.h"
|
||||
#include "ScriptedCreature.h"
|
||||
#include "Transport.h"
|
||||
#include "Vehicle.h"
|
||||
#include "WorldPacket.h"
|
||||
|
||||
BattlegroundIC::BattlegroundIC()
|
||||
{
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include "Log.h"
|
||||
#include "Player.h"
|
||||
#include "WorldPacket.h"
|
||||
#include "WorldStatePackets.h"
|
||||
|
||||
BattlegroundNA::BattlegroundNA()
|
||||
{
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include "Log.h"
|
||||
#include "Player.h"
|
||||
#include "WorldPacket.h"
|
||||
#include "WorldStatePackets.h"
|
||||
|
||||
BattlegroundRL::BattlegroundRL()
|
||||
{
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include "ObjectAccessor.h"
|
||||
#include "Player.h"
|
||||
#include "WorldPacket.h"
|
||||
#include "WorldStatePackets.h"
|
||||
|
||||
BattlegroundRV::BattlegroundRV()
|
||||
{
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#include "BattlegroundSA.h"
|
||||
#include "GameObject.h"
|
||||
#include "Language.h"
|
||||
#include "Log.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "Player.h"
|
||||
#include "ScriptedCreature.h"
|
||||
|
||||
@@ -24,6 +24,8 @@
|
||||
#include "BattlegroundMgr.h"
|
||||
#include "Player.h"
|
||||
#include "WorldPacket.h"
|
||||
#include "BattlegroundPackets.h"
|
||||
#include "WorldStatePackets.h"
|
||||
|
||||
// these variables aren't used outside of this file, so declare them only here
|
||||
enum BG_WSG_Rewards
|
||||
|
||||
@@ -16,11 +16,19 @@
|
||||
*/
|
||||
|
||||
#include "BlackMarketMgr.h"
|
||||
#include "AccountMgr.h"
|
||||
#include "BlackMarketPackets.h"
|
||||
#include "Containers.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "Language.h"
|
||||
#include "Log.h"
|
||||
#include "Mail.h"
|
||||
#include "ObjectAccessor.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "Player.h"
|
||||
#include "Language.h"
|
||||
#include "Realm.h"
|
||||
#include "World.h"
|
||||
#include <sstream>
|
||||
|
||||
BlackMarketMgr::BlackMarketMgr()
|
||||
{
|
||||
@@ -208,8 +216,30 @@ void BlackMarketMgr::BuildItemsResponse(WorldPackets::BlackMarket::BlackMarketRe
|
||||
packet.Items.reserve(_auctions.size());
|
||||
for (auto itr = _auctions.begin(); itr != _auctions.end(); ++itr)
|
||||
{
|
||||
BlackMarketTemplate const* templ = itr->second->GetTemplate();
|
||||
|
||||
WorldPackets::BlackMarket::BlackMarketItem item;
|
||||
item.Initialize(itr->second, player);
|
||||
item.MarketID = itr->second->GetMarketId();
|
||||
item.SellerNPC = templ->SellerNPC;
|
||||
item.Item = templ->Item;
|
||||
item.Quantity = templ->Quantity;
|
||||
|
||||
// No bids yet
|
||||
if (!itr->second->GetNumBids())
|
||||
{
|
||||
item.MinBid = templ->MinBid;
|
||||
item.MinIncrement = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
item.MinIncrement = itr->second->GetMinIncrement(); // 5% increment minimum
|
||||
item.MinBid = itr->second->GetCurrentBid() + item.MinIncrement;
|
||||
}
|
||||
|
||||
item.CurrentBid = itr->second->GetCurrentBid();
|
||||
item.SecondsRemaining = itr->second->GetSecondsRemaining();
|
||||
item.HighBid = (itr->second->GetBidder() == player->GetGUID().GetCounter());
|
||||
item.NumBids = itr->second->GetNumBids();
|
||||
|
||||
packet.Items.push_back(item);
|
||||
}
|
||||
|
||||
@@ -18,10 +18,13 @@
|
||||
#ifndef BLACK_MARKET_H
|
||||
#define BLACK_MARKET_H
|
||||
|
||||
#include "Common.h"
|
||||
#include "SharedDefines.h"
|
||||
#include "DatabaseEnvFwd.h"
|
||||
#include "ObjectGuid.h"
|
||||
#include "ItemPackets.h"
|
||||
#include "Item.h"
|
||||
#include "ItemPacketsCommon.h"
|
||||
#include <unordered_map>
|
||||
|
||||
class Player;
|
||||
|
||||
namespace WorldPackets
|
||||
{
|
||||
|
||||
@@ -16,13 +16,15 @@
|
||||
*/
|
||||
|
||||
#include "CalendarMgr.h"
|
||||
#include "QueryResult.h"
|
||||
#include "Log.h"
|
||||
#include "Player.h"
|
||||
#include "CalendarPackets.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "Guild.h"
|
||||
#include "GuildMgr.h"
|
||||
#include "Log.h"
|
||||
#include "Mail.h"
|
||||
#include "ObjectAccessor.h"
|
||||
#include "Opcodes.h"
|
||||
#include "CalendarPackets.h"
|
||||
#include "Player.h"
|
||||
|
||||
CalendarInvite::~CalendarInvite()
|
||||
{
|
||||
|
||||
@@ -19,9 +19,14 @@
|
||||
#define TRINITY_CALENDARMGR_H
|
||||
|
||||
#include "Common.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "WorldPacket.h"
|
||||
#include "DatabaseEnvFwd.h"
|
||||
#include "ObjectGuid.h"
|
||||
#include <deque>
|
||||
#include <map>
|
||||
#include <set>
|
||||
#include <vector>
|
||||
|
||||
class WorldPacket;
|
||||
|
||||
enum CalendarMailAnswers
|
||||
{
|
||||
|
||||
@@ -17,14 +17,15 @@
|
||||
*/
|
||||
|
||||
#include "Channel.h"
|
||||
#include "ChannelAppenders.h"
|
||||
#include "AccountMgr.h"
|
||||
#include "ChannelAppenders.h"
|
||||
#include "Chat.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "GridNotifiers.h"
|
||||
#include "GridNotifiersImpl.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "Language.h"
|
||||
#include "Log.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "Player.h"
|
||||
#include "SocialMgr.h"
|
||||
#include "World.h"
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
|
||||
#include "Common.h"
|
||||
#include "ObjectGuid.h"
|
||||
#include "WorldPacket.h"
|
||||
#include <map>
|
||||
#include <unordered_set>
|
||||
|
||||
class Player;
|
||||
|
||||
|
||||
@@ -18,11 +18,14 @@
|
||||
#ifndef __TRINITY_CHANNELMGR_H
|
||||
#define __TRINITY_CHANNELMGR_H
|
||||
|
||||
#include "Common.h"
|
||||
#include "Define.h"
|
||||
#include "Hash.h"
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
|
||||
class Channel;
|
||||
class Player;
|
||||
struct AreaTableEntry;
|
||||
|
||||
class TC_GAME_API ChannelMgr
|
||||
{
|
||||
|
||||
@@ -17,21 +17,21 @@
|
||||
*/
|
||||
|
||||
#include "Common.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "World.h"
|
||||
#include "WorldSession.h"
|
||||
#include "DatabaseEnv.h"
|
||||
|
||||
#include "AccountMgr.h"
|
||||
#include "CellImpl.h"
|
||||
#include "Chat.h"
|
||||
#include "ChatLink.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "GridNotifiersImpl.h"
|
||||
#include "Group.h"
|
||||
#include "Language.h"
|
||||
#include "Log.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "Player.h"
|
||||
#include "Realm.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "ChatLink.h"
|
||||
#include "Group.h"
|
||||
#include "World.h"
|
||||
#include "WorldSession.h"
|
||||
|
||||
ChatCommand::ChatCommand(char const* name, uint32 permission, bool allowConsole, pHandler handler, std::string help, std::vector<ChatCommand> childCommands /*= std::vector<ChatCommand>()*/)
|
||||
: Name(ASSERT_NOTNULL(name)), Permission(permission), AllowConsole(allowConsole), Handler(handler), Help(std::move(help)), ChildCommands(std::move(childCommands))
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
|
||||
class ChatHandler;
|
||||
class Creature;
|
||||
class GameObject;
|
||||
class Group;
|
||||
class Player;
|
||||
class Unit;
|
||||
@@ -37,6 +38,8 @@ class WorldObject;
|
||||
|
||||
struct GameTele;
|
||||
|
||||
enum LocaleConstant : uint8;
|
||||
|
||||
class TC_GAME_API ChatCommand
|
||||
{
|
||||
typedef bool(*pHandler)(ChatHandler*, char const*);
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
*/
|
||||
|
||||
#include "ChatLink.h"
|
||||
#include "Log.h"
|
||||
#include "SpellMgr.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "SpellInfo.h"
|
||||
|
||||
@@ -18,9 +18,12 @@
|
||||
|
||||
#include "ConditionMgr.h"
|
||||
#include "AchievementMgr.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "GameEventMgr.h"
|
||||
#include "Group.h"
|
||||
#include "InstanceScript.h"
|
||||
#include "Log.h"
|
||||
#include "LootMgr.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "Player.h"
|
||||
#include "Pet.h"
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
#ifndef TRINITY_CONDITIONMGR_H
|
||||
#define TRINITY_CONDITIONMGR_H
|
||||
|
||||
#include "Common.h"
|
||||
#include "Define.h"
|
||||
#include "Hash.h"
|
||||
#include <array>
|
||||
#include <unordered_map>
|
||||
|
||||
@@ -18,10 +18,13 @@
|
||||
|
||||
#include "DisableMgr.h"
|
||||
#include "CriteriaHandler.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "Log.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "OutdoorPvP.h"
|
||||
#include "SpellMgr.h"
|
||||
#include "Player.h"
|
||||
#include "SpellMgr.h"
|
||||
#include "VMapManager2.h"
|
||||
#include "World.h"
|
||||
|
||||
namespace DisableMgr
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
#ifndef TRINITY_DISABLEMGR_H
|
||||
#define TRINITY_DISABLEMGR_H
|
||||
|
||||
#include "VMapManager2.h"
|
||||
#include "Define.h"
|
||||
|
||||
class Unit;
|
||||
|
||||
@@ -20,9 +20,13 @@
|
||||
#include "Containers.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "DB2LoadInfo.h"
|
||||
#include "Hash.h"
|
||||
#include "Log.h"
|
||||
#include "Regex.h"
|
||||
#include "TransportMgr.h"
|
||||
#include "World.h"
|
||||
#include <array>
|
||||
#include <sstream>
|
||||
#include <cctype>
|
||||
|
||||
// temporary hack until includes are sorted out (don't want to pull in Windows.h)
|
||||
@@ -248,10 +252,106 @@ TaxiMask sAllianceTaxiNodesMask;
|
||||
TaxiPathSetBySource sTaxiPathSetBySource;
|
||||
TaxiPathNodesByPath sTaxiPathNodesByPath;
|
||||
|
||||
DEFINE_DB2_SET_COMPARATOR(ChrClassesXPowerTypesEntry)
|
||||
|
||||
typedef std::map<uint32 /*hash*/, DB2StorageBase*> StorageMap;
|
||||
typedef std::unordered_map<uint32 /*areaGroupId*/, std::vector<uint32/*areaId*/>> AreaGroupMemberContainer;
|
||||
typedef std::unordered_map<uint32, std::vector<ArtifactPowerEntry const*>> ArtifactPowersContainer;
|
||||
typedef std::unordered_map<uint32, std::unordered_set<uint32>> ArtifactPowerLinksContainer;
|
||||
typedef std::unordered_map<std::pair<uint32, uint8>, ArtifactPowerRankEntry const*> ArtifactPowerRanksContainer;
|
||||
typedef std::unordered_multimap<uint32, CharSectionsEntry const*> CharSectionsContainer;
|
||||
typedef std::unordered_map<uint32, CharStartOutfitEntry const*> CharStartOutfitContainer;
|
||||
typedef ChrSpecializationEntry const* ChrSpecializationByIndexContainer[MAX_CLASSES + 1][MAX_SPECIALIZATIONS];
|
||||
typedef std::unordered_map<uint32, ChrSpecializationEntry const*> ChrSpecialzationByClassContainer;
|
||||
typedef std::unordered_map<uint32 /*curveID*/, std::vector<CurvePointEntry const*>> CurvePointsContainer;
|
||||
typedef std::map<std::tuple<uint32, uint8, uint8, uint8>, EmotesTextSoundEntry const*> EmotesTextSoundContainer;
|
||||
typedef std::unordered_map<uint32, std::vector<uint32>> FactionTeamContainer;
|
||||
typedef std::unordered_map<uint32, HeirloomEntry const*> HeirloomItemsContainer;
|
||||
typedef std::unordered_map<uint32 /*glyphPropertiesId*/, std::vector<uint32>> GlyphBindableSpellsContainer;
|
||||
typedef std::unordered_map<uint32 /*glyphPropertiesId*/, std::vector<uint32>> GlyphRequiredSpecsContainer;
|
||||
typedef std::unordered_map<uint32 /*bonusListId*/, DB2Manager::ItemBonusList> ItemBonusListContainer;
|
||||
typedef std::unordered_map<int16, uint32> ItemBonusListLevelDeltaContainer;
|
||||
typedef std::unordered_multimap<uint32 /*itemId*/, uint32 /*bonusTreeId*/> ItemToBonusTreeContainer;
|
||||
typedef std::unordered_map<uint32 /*itemId*/, ItemChildEquipmentEntry const*> ItemChildEquipmentContainer;
|
||||
typedef std::array<ItemClassEntry const*, 19> ItemClassByOldEnumContainer;
|
||||
typedef std::unordered_map<uint32 /*itemId | appearanceMod << 24*/, ItemModifiedAppearanceEntry const*> ItemModifiedAppearanceByItemContainer;
|
||||
typedef std::unordered_map<uint32, std::set<ItemBonusTreeNodeEntry const*>> ItemBonusTreeContainer;
|
||||
typedef std::unordered_map<uint32, std::vector<ItemSetSpellEntry const*>> ItemSetSpellContainer;
|
||||
typedef std::unordered_map<uint32, std::vector<ItemSpecOverrideEntry const*>> ItemSpecOverridesContainer;
|
||||
typedef std::unordered_map<uint32, MountEntry const*> MountContainer;
|
||||
typedef std::unordered_map<uint32, DB2Manager::MountTypeXCapabilitySet> MountCapabilitiesByTypeContainer;
|
||||
typedef std::unordered_map<uint32, DB2Manager::MountXDisplayContainer> MountDisplaysCointainer;
|
||||
typedef std::unordered_map<uint32, std::array<std::vector<NameGenEntry const*>, 2>> NameGenContainer;
|
||||
typedef std::array<std::vector<Trinity::wregex>, TOTAL_LOCALES + 1> NameValidationRegexContainer;
|
||||
typedef std::unordered_map<uint32, std::set<uint32>> PhaseGroupContainer;
|
||||
typedef std::array<PowerTypeEntry const*, MAX_POWERS> PowerTypesContainer;
|
||||
typedef std::unordered_map<uint32, std::pair<std::vector<QuestPackageItemEntry const*>, std::vector<QuestPackageItemEntry const*>>> QuestPackageItemContainer;
|
||||
typedef std::unordered_map<uint32, uint32> RulesetItemUpgradeContainer;
|
||||
typedef std::unordered_multimap<uint32, SkillRaceClassInfoEntry const*> SkillRaceClassInfoContainer;
|
||||
typedef std::unordered_map<uint32, std::vector<SpecializationSpellsEntry const*>> SpecializationSpellsContainer;
|
||||
typedef std::unordered_map<uint32, std::vector<SpellPowerEntry const*>> SpellPowerContainer;
|
||||
typedef std::unordered_map<uint32, std::unordered_map<uint32, std::vector<SpellPowerEntry const*>>> SpellPowerDifficultyContainer;
|
||||
typedef std::unordered_map<uint32, std::vector<SpellProcsPerMinuteModEntry const*>> SpellProcsPerMinuteModContainer;
|
||||
typedef std::vector<TalentEntry const*> TalentsByPosition[MAX_CLASSES][MAX_TALENT_TIERS][MAX_TALENT_COLUMNS];
|
||||
typedef std::unordered_set<uint32> ToyItemIdsContainer;
|
||||
typedef std::tuple<int16, int8, int32> WMOAreaTableKey;
|
||||
typedef std::map<WMOAreaTableKey, WMOAreaTableEntry const*> WMOAreaTableLookupContainer;
|
||||
typedef std::unordered_map<uint32, WorldMapAreaEntry const*> WorldMapAreaByAreaIDContainer;
|
||||
namespace
|
||||
{
|
||||
StorageMap _stores;
|
||||
std::map<int32, HotfixData> _hotfixData;
|
||||
|
||||
AreaGroupMemberContainer _areaGroupMembers;
|
||||
ArtifactPowersContainer _artifactPowers;
|
||||
ArtifactPowerLinksContainer _artifactPowerLinks;
|
||||
ArtifactPowerRanksContainer _artifactPowerRanks;
|
||||
CharSectionsContainer _charSections;
|
||||
CharStartOutfitContainer _charStartOutfits;
|
||||
uint32 _powersByClass[MAX_CLASSES][MAX_POWERS];
|
||||
ChrSpecializationByIndexContainer _chrSpecializationsByIndex;
|
||||
ChrSpecialzationByClassContainer _defaultChrSpecializationsByClass;
|
||||
CurvePointsContainer _curvePoints;
|
||||
EmotesTextSoundContainer _emoteTextSounds;
|
||||
FactionTeamContainer _factionTeams;
|
||||
HeirloomItemsContainer _heirlooms;
|
||||
GlyphBindableSpellsContainer _glyphBindableSpells;
|
||||
GlyphRequiredSpecsContainer _glyphRequiredSpecs;
|
||||
ItemBonusListContainer _itemBonusLists;
|
||||
ItemBonusListLevelDeltaContainer _itemLevelDeltaToBonusListContainer;
|
||||
ItemBonusTreeContainer _itemBonusTrees;
|
||||
ItemChildEquipmentContainer _itemChildEquipment;
|
||||
ItemClassByOldEnumContainer _itemClassByOldEnum;
|
||||
std::unordered_set<uint32> _itemsWithCurrencyCost;
|
||||
ItemModifiedAppearanceByItemContainer _itemModifiedAppearancesByItem;
|
||||
ItemToBonusTreeContainer _itemToBonusTree;
|
||||
ItemSetSpellContainer _itemSetSpells;
|
||||
ItemSpecOverridesContainer _itemSpecOverrides;
|
||||
DB2Manager::MapDifficultyContainer _mapDifficulties;
|
||||
MountContainer _mountsBySpellId;
|
||||
MountCapabilitiesByTypeContainer _mountCapabilitiesByType;
|
||||
MountDisplaysCointainer _mountDisplays;
|
||||
NameGenContainer _nameGenData;
|
||||
NameValidationRegexContainer _nameValidators;
|
||||
PhaseGroupContainer _phasesByGroup;
|
||||
PowerTypesContainer _powerTypes;
|
||||
QuestPackageItemContainer _questPackages;
|
||||
RulesetItemUpgradeContainer _rulesetItemUpgrade;
|
||||
SkillRaceClassInfoContainer _skillRaceClassInfoBySkill;
|
||||
SpecializationSpellsContainer _specializationSpellsBySpec;
|
||||
SpellPowerContainer _spellPowers;
|
||||
SpellPowerDifficultyContainer _spellPowerDifficulties;
|
||||
SpellProcsPerMinuteModContainer _spellProcsPerMinuteMods;
|
||||
TalentsByPosition _talentsByPosition;
|
||||
ToyItemIdsContainer _toys;
|
||||
WMOAreaTableLookupContainer _wmoAreaTableLookup;
|
||||
WorldMapAreaByAreaIDContainer _worldMapAreaByAreaID;
|
||||
}
|
||||
|
||||
typedef std::vector<std::string> DB2StoreProblemList;
|
||||
|
||||
template<class T, template<class> class DB2>
|
||||
inline void LoadDB2(uint32& availableDb2Locales, DB2StoreProblemList& errlist, DB2Manager::StorageMap& stores, DB2StorageBase* storage, std::string const& db2Path, uint32 defaultLocale, DB2<T> const& /*hint*/)
|
||||
inline void LoadDB2(uint32& availableDb2Locales, DB2StoreProblemList& errlist, StorageMap& stores, DB2StorageBase* storage, std::string const& db2Path, uint32 defaultLocale, DB2<T> const& /*hint*/)
|
||||
{
|
||||
// validate structure
|
||||
DB2LoadInfo const* loadInfo = storage->GetLoadInfo();
|
||||
@@ -1011,6 +1111,11 @@ void DB2Manager::LoadHotfixData()
|
||||
TC_LOG_INFO("server.loading", ">> Loaded %u hotfix records in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
|
||||
}
|
||||
|
||||
std::map<int32, HotfixData> const& DB2Manager::GetHotfixData() const
|
||||
{
|
||||
return _hotfixData;
|
||||
}
|
||||
|
||||
std::vector<uint32> DB2Manager::GetAreasForGroup(uint32 areaGroupId) const
|
||||
{
|
||||
auto itr = _areaGroupMembers.find(areaGroupId);
|
||||
@@ -1395,6 +1500,11 @@ ItemClassEntry const* DB2Manager::GetItemClassByOldEnum(uint32 itemClass) const
|
||||
return _itemClassByOldEnum[itemClass];
|
||||
}
|
||||
|
||||
bool DB2Manager::HasItemCurrencyCost(uint32 itemId) const
|
||||
{
|
||||
return _itemsWithCurrencyCost.count(itemId) > 0;
|
||||
}
|
||||
|
||||
uint32 DB2Manager::GetItemDisplayId(uint32 itemId, uint32 appearanceModId) const
|
||||
{
|
||||
if (ItemModifiedAppearanceEntry const* modifiedAppearance = GetItemModifiedAppearance(itemId, appearanceModId))
|
||||
@@ -1480,6 +1590,11 @@ uint32 DB2Manager::GetLiquidFlags(uint32 liquidType)
|
||||
return 0;
|
||||
}
|
||||
|
||||
DB2Manager::MapDifficultyContainer const& DB2Manager::GetMapDifficulties() const
|
||||
{
|
||||
return _mapDifficulties;
|
||||
}
|
||||
|
||||
MapDifficultyEntry const* DB2Manager::GetDefaultMapDifficulty(uint32 mapId, Difficulty* difficulty /*= nullptr*/) const
|
||||
{
|
||||
auto itr = _mapDifficulties.find(mapId);
|
||||
@@ -1888,7 +2003,7 @@ void DB2Manager::DeterminaAlternateMapPosition(uint32 mapId, float x, float y, f
|
||||
newPos->Y = y + transformation->RegionOffset.Y;
|
||||
}
|
||||
|
||||
bool DB2Manager::ChrClassesXPowerTypesEntryComparator::Compare(ChrClassesXPowerTypesEntry const* left, ChrClassesXPowerTypesEntry const* right)
|
||||
bool ChrClassesXPowerTypesEntryComparator::Compare(ChrClassesXPowerTypesEntry const* left, ChrClassesXPowerTypesEntry const* right)
|
||||
{
|
||||
if (left->ClassID != right->ClassID)
|
||||
return left->ClassID < right->ClassID;
|
||||
|
||||
@@ -20,10 +20,7 @@
|
||||
|
||||
#include "DB2Store.h"
|
||||
#include "DB2Structure.h"
|
||||
#include "Hash.h"
|
||||
#include "SharedDefines.h"
|
||||
#include "Regex.h"
|
||||
#include <array>
|
||||
#include <map>
|
||||
#include <set>
|
||||
#include <unordered_map>
|
||||
@@ -247,56 +244,12 @@ struct HotfixData
|
||||
class TC_GAME_API DB2Manager
|
||||
{
|
||||
public:
|
||||
DEFINE_DB2_SET_COMPARATOR(ChrClassesXPowerTypesEntry)
|
||||
DEFINE_DB2_SET_COMPARATOR(MountTypeXCapabilityEntry)
|
||||
|
||||
typedef std::map<uint32 /*hash*/, DB2StorageBase*> StorageMap;
|
||||
typedef std::unordered_map<uint32 /*areaGroupId*/, std::vector<uint32/*areaId*/>> AreaGroupMemberContainer;
|
||||
typedef std::unordered_map<uint32, std::vector<ArtifactPowerEntry const*>> ArtifactPowersContainer;
|
||||
typedef std::unordered_map<uint32, std::unordered_set<uint32>> ArtifactPowerLinksContainer;
|
||||
typedef std::unordered_map<std::pair<uint32, uint8>, ArtifactPowerRankEntry const*> ArtifactPowerRanksContainer;
|
||||
typedef std::unordered_multimap<uint32, CharSectionsEntry const*> CharSectionsContainer;
|
||||
typedef std::unordered_map<uint32, CharStartOutfitEntry const*> CharStartOutfitContainer;
|
||||
typedef ChrSpecializationEntry const* ChrSpecializationByIndexContainer[MAX_CLASSES + 1][MAX_SPECIALIZATIONS];
|
||||
typedef std::unordered_map<uint32, ChrSpecializationEntry const*> ChrSpecialzationByClassContainer;
|
||||
typedef std::unordered_map<uint32 /*curveID*/, std::vector<CurvePointEntry const*>> CurvePointsContainer;
|
||||
typedef std::map<std::tuple<uint32, uint8, uint8, uint8>, EmotesTextSoundEntry const*> EmotesTextSoundContainer;
|
||||
typedef std::unordered_map<uint32, std::vector<uint32>> FactionTeamContainer;
|
||||
typedef std::unordered_map<uint32, HeirloomEntry const*> HeirloomItemsContainer;
|
||||
typedef std::unordered_map<uint32 /*glyphPropertiesId*/, std::vector<uint32>> GlyphBindableSpellsContainer;
|
||||
typedef std::unordered_map<uint32 /*glyphPropertiesId*/, std::vector<uint32>> GlyphRequiredSpecsContainer;
|
||||
typedef std::vector<ItemBonusEntry const*> ItemBonusList;
|
||||
typedef std::unordered_map<uint32 /*bonusListId*/, ItemBonusList> ItemBonusListContainer;
|
||||
typedef std::unordered_map<int16, uint32> ItemBonusListLevelDeltaContainer;
|
||||
typedef std::unordered_multimap<uint32 /*itemId*/, uint32 /*bonusTreeId*/> ItemToBonusTreeContainer;
|
||||
typedef std::unordered_map<uint32 /*itemId*/, ItemChildEquipmentEntry const*> ItemChildEquipmentContainer;
|
||||
typedef std::array<ItemClassEntry const*, 19> ItemClassByOldEnumContainer;
|
||||
typedef std::unordered_map<uint32 /*itemId | appearanceMod << 24*/, ItemModifiedAppearanceEntry const*> ItemModifiedAppearanceByItemContainer;
|
||||
typedef std::unordered_map<uint32, std::set<ItemBonusTreeNodeEntry const*>> ItemBonusTreeContainer;
|
||||
typedef std::unordered_map<uint32, std::vector<ItemSetSpellEntry const*>> ItemSetSpellContainer;
|
||||
typedef std::unordered_map<uint32, std::vector<ItemSpecOverrideEntry const*>> ItemSpecOverridesContainer;
|
||||
typedef std::unordered_map<uint32, std::unordered_map<uint32, MapDifficultyEntry const*>> MapDifficultyContainer;
|
||||
typedef std::unordered_map<uint32, MountEntry const*> MountContainer;
|
||||
typedef std::set<MountTypeXCapabilityEntry const*, MountTypeXCapabilityEntryComparator> MountTypeXCapabilitySet;
|
||||
typedef std::unordered_map<uint32, MountTypeXCapabilitySet> MountCapabilitiesByTypeContainer;
|
||||
typedef std::vector<MountXDisplayEntry const*> MountXDisplayContainer;
|
||||
typedef std::unordered_map<uint32, MountXDisplayContainer> MountDisplaysCointainer;
|
||||
typedef std::unordered_map<uint32, std::array<std::vector<NameGenEntry const*>, 2>> NameGenContainer;
|
||||
typedef std::array<std::vector<Trinity::wregex>, TOTAL_LOCALES + 1> NameValidationRegexContainer;
|
||||
typedef std::unordered_map<uint32, std::set<uint32>> PhaseGroupContainer;
|
||||
typedef std::array<PowerTypeEntry const*, MAX_POWERS> PowerTypesContainer;
|
||||
typedef std::unordered_map<uint32, std::pair<std::vector<QuestPackageItemEntry const*>, std::vector<QuestPackageItemEntry const*>>> QuestPackageItemContainer;
|
||||
typedef std::unordered_map<uint32, uint32> RulesetItemUpgradeContainer;
|
||||
typedef std::unordered_multimap<uint32, SkillRaceClassInfoEntry const*> SkillRaceClassInfoContainer;
|
||||
typedef std::unordered_map<uint32, std::vector<SpecializationSpellsEntry const*>> SpecializationSpellsContainer;
|
||||
typedef std::unordered_map<uint32, std::vector<SpellPowerEntry const*>> SpellPowerContainer;
|
||||
typedef std::unordered_map<uint32, std::unordered_map<uint32, std::vector<SpellPowerEntry const*>>> SpellPowerDifficultyContainer;
|
||||
typedef std::unordered_map<uint32, std::vector<SpellProcsPerMinuteModEntry const*>> SpellProcsPerMinuteModContainer;
|
||||
typedef std::vector<TalentEntry const*> TalentsByPosition[MAX_CLASSES][MAX_TALENT_TIERS][MAX_TALENT_COLUMNS];
|
||||
typedef std::unordered_set<uint32> ToyItemIdsContainer;
|
||||
typedef std::tuple<int16, int8, int32> WMOAreaTableKey;
|
||||
typedef std::map<WMOAreaTableKey, WMOAreaTableEntry const*> WMOAreaTableLookupContainer;
|
||||
typedef std::unordered_map<uint32, WorldMapAreaEntry const*> WorldMapAreaByAreaIDContainer;
|
||||
|
||||
static DB2Manager& Instance();
|
||||
|
||||
@@ -304,7 +257,7 @@ public:
|
||||
DB2StorageBase const* GetStorage(uint32 type) const;
|
||||
|
||||
void LoadHotfixData();
|
||||
std::map<int32, HotfixData> const& GetHotfixData() const { return _hotfixData; }
|
||||
std::map<int32, HotfixData> const& GetHotfixData() const;
|
||||
|
||||
std::vector<uint32> GetAreasForGroup(uint32 areaGroupId) const;
|
||||
std::vector<ArtifactPowerEntry const*> GetArtifactPowers(uint8 artifactId) const;
|
||||
@@ -330,7 +283,7 @@ public:
|
||||
std::set<uint32> GetItemBonusTree(uint32 itemId, uint32 itemBonusTreeMod) const;
|
||||
ItemChildEquipmentEntry const* GetItemChildEquipment(uint32 itemId) const;
|
||||
ItemClassEntry const* GetItemClassByOldEnum(uint32 itemClass) const;
|
||||
bool HasItemCurrencyCost(uint32 itemId) const { return _itemsWithCurrencyCost.count(itemId) > 0; }
|
||||
bool HasItemCurrencyCost(uint32 itemId) const;
|
||||
uint32 GetItemDisplayId(uint32 itemId, uint32 appearanceModId) const;
|
||||
ItemModifiedAppearanceEntry const* GetItemModifiedAppearance(uint32 itemId, uint32 appearanceModId) const;
|
||||
ItemModifiedAppearanceEntry const* GetDefaultItemModifiedAppearance(uint32 itemId) const;
|
||||
@@ -339,7 +292,7 @@ public:
|
||||
static LfgDungeonsEntry const* GetLfgDungeon(uint32 mapId, Difficulty difficulty);
|
||||
static uint32 GetDefaultMapLight(uint32 mapId);
|
||||
static uint32 GetLiquidFlags(uint32 liquidType);
|
||||
MapDifficultyContainer const& GetMapDifficulties() const { return _mapDifficulties; }
|
||||
MapDifficultyContainer const& GetMapDifficulties() const;
|
||||
MapDifficultyEntry const* GetDefaultMapDifficulty(uint32 mapId, Difficulty* difficulty = nullptr) const;
|
||||
MapDifficultyEntry const* GetMapDifficultyData(uint32 mapId, Difficulty difficulty) const;
|
||||
MapDifficultyEntry const* GetDownscaledMapDifficultyData(uint32 mapId, Difficulty &difficulty) const;
|
||||
@@ -369,55 +322,6 @@ public:
|
||||
void Zone2MapCoordinates(uint32 areaId, float& x, float& y) const;
|
||||
void Map2ZoneCoordinates(uint32 areaId, float& x, float& y) const;
|
||||
static void DeterminaAlternateMapPosition(uint32 mapId, float x, float y, float z, uint32* newMapId = nullptr, DBCPosition2D* newPos = nullptr);
|
||||
|
||||
private:
|
||||
StorageMap _stores;
|
||||
std::map<int32, HotfixData> _hotfixData;
|
||||
|
||||
AreaGroupMemberContainer _areaGroupMembers;
|
||||
ArtifactPowersContainer _artifactPowers;
|
||||
ArtifactPowerLinksContainer _artifactPowerLinks;
|
||||
ArtifactPowerRanksContainer _artifactPowerRanks;
|
||||
CharSectionsContainer _charSections;
|
||||
CharStartOutfitContainer _charStartOutfits;
|
||||
uint32 _powersByClass[MAX_CLASSES][MAX_POWERS];
|
||||
ChrSpecializationByIndexContainer _chrSpecializationsByIndex;
|
||||
ChrSpecialzationByClassContainer _defaultChrSpecializationsByClass;
|
||||
CurvePointsContainer _curvePoints;
|
||||
EmotesTextSoundContainer _emoteTextSounds;
|
||||
FactionTeamContainer _factionTeams;
|
||||
HeirloomItemsContainer _heirlooms;
|
||||
GlyphBindableSpellsContainer _glyphBindableSpells;
|
||||
GlyphRequiredSpecsContainer _glyphRequiredSpecs;
|
||||
ItemBonusListContainer _itemBonusLists;
|
||||
ItemBonusListLevelDeltaContainer _itemLevelDeltaToBonusListContainer;
|
||||
ItemBonusTreeContainer _itemBonusTrees;
|
||||
ItemChildEquipmentContainer _itemChildEquipment;
|
||||
ItemClassByOldEnumContainer _itemClassByOldEnum;
|
||||
std::unordered_set<uint32> _itemsWithCurrencyCost;
|
||||
ItemModifiedAppearanceByItemContainer _itemModifiedAppearancesByItem;
|
||||
ItemToBonusTreeContainer _itemToBonusTree;
|
||||
ItemSetSpellContainer _itemSetSpells;
|
||||
ItemSpecOverridesContainer _itemSpecOverrides;
|
||||
MapDifficultyContainer _mapDifficulties;
|
||||
MountContainer _mountsBySpellId;
|
||||
MountCapabilitiesByTypeContainer _mountCapabilitiesByType;
|
||||
MountDisplaysCointainer _mountDisplays;
|
||||
NameGenContainer _nameGenData;
|
||||
NameValidationRegexContainer _nameValidators;
|
||||
PhaseGroupContainer _phasesByGroup;
|
||||
PowerTypesContainer _powerTypes;
|
||||
QuestPackageItemContainer _questPackages;
|
||||
RulesetItemUpgradeContainer _rulesetItemUpgrade;
|
||||
SkillRaceClassInfoContainer _skillRaceClassInfoBySkill;
|
||||
SpecializationSpellsContainer _specializationSpellsBySpec;
|
||||
SpellPowerContainer _spellPowers;
|
||||
SpellPowerDifficultyContainer _spellPowerDifficulties;
|
||||
SpellProcsPerMinuteModContainer _spellProcsPerMinuteMods;
|
||||
TalentsByPosition _talentsByPosition;
|
||||
ToyItemIdsContainer _toys;
|
||||
WMOAreaTableLookupContainer _wmoAreaTableLookup;
|
||||
WorldMapAreaByAreaIDContainer _worldMapAreaByAreaID;
|
||||
};
|
||||
|
||||
#define sDB2Manager DB2Manager::Instance()
|
||||
|
||||
@@ -18,12 +18,14 @@
|
||||
#ifndef TRINITY_DB2STRUCTURE_H
|
||||
#define TRINITY_DB2STRUCTURE_H
|
||||
|
||||
#include "Common.h"
|
||||
#include "Define.h"
|
||||
#include "DBCEnums.h"
|
||||
#include "Util.h"
|
||||
|
||||
#pragma pack(push, 1)
|
||||
|
||||
struct LocalizedString;
|
||||
|
||||
struct AchievementEntry
|
||||
{
|
||||
LocalizedString* Title;
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#include "LFG.h"
|
||||
#include "Language.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include <sstream>
|
||||
|
||||
namespace lfg
|
||||
{
|
||||
|
||||
@@ -18,9 +18,11 @@
|
||||
#ifndef _LFG_H
|
||||
#define _LFG_H
|
||||
|
||||
#include "Common.h"
|
||||
#include "Define.h"
|
||||
#include "ObjectGuid.h"
|
||||
#include <map>
|
||||
#include <set>
|
||||
#include <string>
|
||||
|
||||
namespace lfg
|
||||
{
|
||||
|
||||
@@ -15,23 +15,25 @@
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "Common.h"
|
||||
#include "SharedDefines.h"
|
||||
#include "DisableMgr.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "SocialMgr.h"
|
||||
#include "LFGMgr.h"
|
||||
#include "LFGScripts.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "DisableMgr.h"
|
||||
#include "GameEventMgr.h"
|
||||
#include "Group.h"
|
||||
#include "GroupMgr.h"
|
||||
#include "InstanceSaveMgr.h"
|
||||
#include "LFGGroupData.h"
|
||||
#include "LFGPlayerData.h"
|
||||
#include "LFGQueue.h"
|
||||
#include "Group.h"
|
||||
#include "LFGScripts.h"
|
||||
#include "Log.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "Player.h"
|
||||
#include "RBAC.h"
|
||||
#include "GroupMgr.h"
|
||||
#include "GameEventMgr.h"
|
||||
#include "SharedDefines.h"
|
||||
#include "SocialMgr.h"
|
||||
#include "World.h"
|
||||
#include "WorldSession.h"
|
||||
#include "InstanceSaveMgr.h"
|
||||
|
||||
namespace lfg
|
||||
{
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#ifndef _LFGMGR_H
|
||||
#define _LFGMGR_H
|
||||
|
||||
#include "Common.h"
|
||||
#include "Field.h"
|
||||
#include "LFG.h"
|
||||
#include "LFGQueue.h"
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#define _LFGQUEUE_H
|
||||
|
||||
#include "LFG.h"
|
||||
#include <list>
|
||||
|
||||
namespace lfg
|
||||
{
|
||||
|
||||
@@ -18,11 +18,12 @@
|
||||
|
||||
#include "Common.h"
|
||||
#include "Corpse.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "Log.h"
|
||||
#include "ObjectAccessor.h"
|
||||
#include "Player.h"
|
||||
#include "UpdateData.h"
|
||||
#include "ObjectAccessor.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "World.h"
|
||||
|
||||
Corpse::Corpse(CorpseType type) : WorldObject(type != CORPSE_BONES), m_type(type)
|
||||
{
|
||||
|
||||
@@ -20,9 +20,9 @@
|
||||
#define TRINITYCORE_CORPSE_H
|
||||
|
||||
#include "Object.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "DatabaseEnvFwd.h"
|
||||
#include "GridDefines.h"
|
||||
#include "LootMgr.h"
|
||||
#include "Loot.h"
|
||||
|
||||
enum CorpseType
|
||||
{
|
||||
|
||||
@@ -23,8 +23,8 @@
|
||||
#include "Duration.h"
|
||||
#include "Unit.h"
|
||||
#include "ItemTemplate.h"
|
||||
#include "LootMgr.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "Loot.h"
|
||||
#include "DatabaseEnvFwd.h"
|
||||
#include "MapObject.h"
|
||||
|
||||
#include <list>
|
||||
@@ -489,17 +489,6 @@ struct CreatureLocale
|
||||
std::vector<std::string> TitleAlt;
|
||||
};
|
||||
|
||||
struct GossipMenuItemsLocale
|
||||
{
|
||||
std::vector<std::string> OptionText;
|
||||
std::vector<std::string> BoxText;
|
||||
};
|
||||
|
||||
struct PointOfInterestLocale
|
||||
{
|
||||
std::vector<std::string> Name;
|
||||
};
|
||||
|
||||
struct EquipmentItem
|
||||
{
|
||||
uint32 ItemId = 0;
|
||||
@@ -569,19 +558,6 @@ enum InhabitTypeValues
|
||||
INHABIT_ANYWHERE = INHABIT_GROUND | INHABIT_WATER | INHABIT_AIR | INHABIT_ROOT
|
||||
};
|
||||
|
||||
// Enums used by StringTextData::Type (CreatureEventAI)
|
||||
enum ChatType
|
||||
{
|
||||
CHAT_TYPE_SAY = 0,
|
||||
CHAT_TYPE_YELL = 1,
|
||||
CHAT_TYPE_TEXT_EMOTE = 2,
|
||||
CHAT_TYPE_BOSS_EMOTE = 3,
|
||||
CHAT_TYPE_WHISPER = 4,
|
||||
CHAT_TYPE_BOSS_WHISPER = 5,
|
||||
CHAT_TYPE_ZONE_YELL = 6,
|
||||
CHAT_TYPE_END = 255
|
||||
};
|
||||
|
||||
#pragma pack(pop)
|
||||
|
||||
// `creature_addon` table
|
||||
|
||||
@@ -16,11 +16,12 @@
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "Creature.h"
|
||||
#include "CreatureGroups.h"
|
||||
#include "ObjectMgr.h"
|
||||
|
||||
#include "Creature.h"
|
||||
#include "CreatureAI.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "Log.h"
|
||||
#include "ObjectMgr.h"
|
||||
|
||||
#define MAX_DESYNC 5.0f
|
||||
|
||||
|
||||
@@ -20,11 +20,13 @@
|
||||
#define _FORMATIONS_H
|
||||
|
||||
#include "Define.h"
|
||||
#include "ObjectGuid.h"
|
||||
#include <unordered_map>
|
||||
#include <map>
|
||||
|
||||
class Creature;
|
||||
class CreatureGroup;
|
||||
class Unit;
|
||||
|
||||
struct FormationInfo
|
||||
{
|
||||
|
||||
@@ -16,13 +16,14 @@
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "QuestDef.h"
|
||||
#include "GossipDef.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "WorldSession.h"
|
||||
#include "Formulas.h"
|
||||
#include "QuestPackets.h"
|
||||
#include "Log.h"
|
||||
#include "NPCPackets.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "QuestDef.h"
|
||||
#include "QuestPackets.h"
|
||||
#include "WorldSession.h"
|
||||
|
||||
GossipMenu::GossipMenu()
|
||||
{
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include "ObjectGuid.h"
|
||||
#include "QuestDef.h"
|
||||
#include "NPCHandler.h"
|
||||
#include <map>
|
||||
|
||||
class WorldSession;
|
||||
|
||||
|
||||
@@ -17,14 +17,13 @@
|
||||
*/
|
||||
|
||||
#include "Common.h"
|
||||
#include "Opcodes.h"
|
||||
#include "World.h"
|
||||
#include "ObjectAccessor.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "GridNotifiers.h"
|
||||
#include "GridNotifiersImpl.h"
|
||||
#include "Log.h"
|
||||
#include "ObjectAccessor.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "Transport.h"
|
||||
#include "World.h"
|
||||
|
||||
DynamicObject::DynamicObject(bool isWorldObject) : WorldObject(isWorldObject),
|
||||
_aura(NULL), _removedAura(NULL), _caster(NULL), _duration(0), _spellXSpellVisualId(0), _isViewpoint(false)
|
||||
|
||||
@@ -16,25 +16,29 @@
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "GameObjectAI.h"
|
||||
#include "GameObject.h"
|
||||
#include "ArtifactPackets.h"
|
||||
#include "Battleground.h"
|
||||
#include "CellImpl.h"
|
||||
#include "CreatureAISelector.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "GameObjectAI.h"
|
||||
#include "GameObjectModel.h"
|
||||
#include "GameObjectPackets.h"
|
||||
#include "GridNotifiersImpl.h"
|
||||
#include "Group.h"
|
||||
#include "GroupMgr.h"
|
||||
#include "ArtifactPackets.h"
|
||||
#include "Log.h"
|
||||
#include "LootMgr.h"
|
||||
#include "MiscPackets.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "OutdoorPvPMgr.h"
|
||||
#include "PoolMgr.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "SpellMgr.h"
|
||||
#include "Transport.h"
|
||||
#include "UpdateFieldFlags.h"
|
||||
#include "World.h"
|
||||
#include "Transport.h"
|
||||
|
||||
GameObject::GameObject() : WorldObject(false), MapObject(),
|
||||
m_model(nullptr), m_goValue(), m_AI(nullptr), _animKitId(0)
|
||||
|
||||
@@ -23,8 +23,8 @@
|
||||
#include "SharedDefines.h"
|
||||
#include "Unit.h"
|
||||
#include "Object.h"
|
||||
#include "LootMgr.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "Loot.h"
|
||||
#include "DatabaseEnvFwd.h"
|
||||
#include "MapObject.h"
|
||||
#include <G3D/Quat.h>
|
||||
|
||||
|
||||
@@ -16,25 +16,27 @@
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "Common.h"
|
||||
#include "Item.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "WorldPacket.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "ItemEnchantmentMgr.h"
|
||||
#include "SpellMgr.h"
|
||||
#include "SpellInfo.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "ConditionMgr.h"
|
||||
#include "Player.h"
|
||||
#include "Opcodes.h"
|
||||
#include "WorldSession.h"
|
||||
#include "ItemPackets.h"
|
||||
#include "TradeData.h"
|
||||
#include "GameTables.h"
|
||||
#include "CollectionMgr.h"
|
||||
#include "ArtifactPackets.h"
|
||||
#include "CollectionMgr.h"
|
||||
#include "Common.h"
|
||||
#include "ConditionMgr.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "GameTables.h"
|
||||
#include "ItemEnchantmentMgr.h"
|
||||
#include "ItemPackets.h"
|
||||
#include "Log.h"
|
||||
#include "LootMgr.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "Opcodes.h"
|
||||
#include "Player.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "SpellInfo.h"
|
||||
#include "SpellMgr.h"
|
||||
#include "TradeData.h"
|
||||
#include "UpdateData.h"
|
||||
#include "WorldPacket.h"
|
||||
#include "WorldSession.h"
|
||||
|
||||
void AddItemsSetItem(Player* player, Item* item)
|
||||
{
|
||||
@@ -898,31 +900,6 @@ uint32 Item::GetSkill()
|
||||
return proto->GetSkill();
|
||||
}
|
||||
|
||||
ItemRandomEnchantmentId Item::GenerateItemRandomPropertyId(uint32 item_id)
|
||||
{
|
||||
ItemTemplate const* itemProto = sObjectMgr->GetItemTemplate(item_id);
|
||||
if (!itemProto)
|
||||
return{};
|
||||
|
||||
// item must have one from this field values not null if it can have random enchantments
|
||||
if (!itemProto->GetRandomProperty() && !itemProto->GetRandomSuffix())
|
||||
return{};
|
||||
|
||||
// item can have not null only one from field values
|
||||
if (itemProto->GetRandomProperty() && itemProto->GetRandomSuffix())
|
||||
{
|
||||
TC_LOG_ERROR("sql.sql", "Item template %u have RandomProperty == %u and RandomSuffix == %u, but must have one from field =0", itemProto->GetId(), itemProto->GetRandomProperty(), itemProto->GetRandomSuffix());
|
||||
return{};
|
||||
}
|
||||
|
||||
// RandomProperty case
|
||||
if (itemProto->GetRandomProperty())
|
||||
return GetItemEnchantMod(itemProto->GetRandomProperty(), ItemRandomEnchantmentType::Property);
|
||||
// RandomSuffix case
|
||||
else
|
||||
return GetItemEnchantMod(itemProto->GetRandomSuffix(), ItemRandomEnchantmentType::Suffix);
|
||||
}
|
||||
|
||||
void Item::SetItemRandomProperties(ItemRandomEnchantmentId const& randomPropId)
|
||||
{
|
||||
if (!randomPropId.Id)
|
||||
|
||||
@@ -21,10 +21,11 @@
|
||||
|
||||
#include "Common.h"
|
||||
#include "Object.h"
|
||||
#include "LootMgr.h"
|
||||
#include "Loot.h"
|
||||
#include "ItemEnchantmentMgr.h"
|
||||
#include "ItemTemplate.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "DatabaseEnvFwd.h"
|
||||
#include <unordered_set>
|
||||
|
||||
class SpellInfo;
|
||||
class Bag;
|
||||
@@ -404,7 +405,6 @@ class TC_GAME_API Item : public Object
|
||||
uint32 GetItemSuffixFactor() const { return GetUInt32Value(ITEM_FIELD_PROPERTY_SEED); }
|
||||
void SetItemRandomProperties(ItemRandomEnchantmentId const& randomPropId);
|
||||
void UpdateItemSuffixFactor();
|
||||
static ItemRandomEnchantmentId GenerateItemRandomPropertyId(uint32 item_id);
|
||||
ItemRandomEnchantmentId GetItemRandomEnchantmentId() const { return m_randomEnchantment; }
|
||||
void SetEnchantment(EnchantmentSlot slot, uint32 id, uint32 duration, uint32 charges, ObjectGuid caster = ObjectGuid::Empty);
|
||||
void SetEnchantmentDuration(EnchantmentSlot slot, uint32 duration, Player* owner);
|
||||
|
||||
@@ -19,10 +19,13 @@
|
||||
#include "ItemEnchantmentMgr.h"
|
||||
#include "Containers.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "DB2Stores.h"
|
||||
#include "ItemTemplate.h"
|
||||
#include "Log.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "Util.h"
|
||||
#include "Random.h"
|
||||
#include "Timer.h"
|
||||
#include "Util.h"
|
||||
|
||||
#include <list>
|
||||
#include <vector>
|
||||
@@ -158,6 +161,31 @@ ItemRandomEnchantmentId GetItemEnchantMod(int32 entry, ItemRandomEnchantmentType
|
||||
return{ selectedItr->type, selectedItr->ench };
|
||||
}
|
||||
|
||||
ItemRandomEnchantmentId GenerateItemRandomPropertyId(uint32 item_id)
|
||||
{
|
||||
ItemTemplate const* itemProto = sObjectMgr->GetItemTemplate(item_id);
|
||||
if (!itemProto)
|
||||
return{};
|
||||
|
||||
// item must have one from this field values not null if it can have random enchantments
|
||||
if (!itemProto->GetRandomProperty() && !itemProto->GetRandomSuffix())
|
||||
return{};
|
||||
|
||||
// item can have not null only one from field values
|
||||
if (itemProto->GetRandomProperty() && itemProto->GetRandomSuffix())
|
||||
{
|
||||
TC_LOG_ERROR("sql.sql", "Item template %u have RandomProperty == %u and RandomSuffix == %u, but must have one from field =0", itemProto->GetId(), itemProto->GetRandomProperty(), itemProto->GetRandomSuffix());
|
||||
return{};
|
||||
}
|
||||
|
||||
// RandomProperty case
|
||||
if (itemProto->GetRandomProperty())
|
||||
return GetItemEnchantMod(itemProto->GetRandomProperty(), ItemRandomEnchantmentType::Property);
|
||||
// RandomSuffix case
|
||||
else
|
||||
return GetItemEnchantMod(itemProto->GetRandomSuffix(), ItemRandomEnchantmentType::Suffix);
|
||||
}
|
||||
|
||||
uint32 GenerateEnchSuffixFactor(uint32 item_id)
|
||||
{
|
||||
ItemTemplate const* itemProto = sObjectMgr->GetItemTemplate(item_id);
|
||||
|
||||
@@ -38,7 +38,7 @@ struct ItemRandomEnchantmentId
|
||||
};
|
||||
|
||||
TC_GAME_API void LoadRandomEnchantmentsTable();
|
||||
TC_GAME_API ItemRandomEnchantmentId GetItemEnchantMod(int32 entry, ItemRandomEnchantmentType type);
|
||||
TC_GAME_API ItemRandomEnchantmentId GenerateItemRandomPropertyId(uint32 item_id);
|
||||
TC_GAME_API uint32 GenerateEnchSuffixFactor(uint32 item_id);
|
||||
TC_GAME_API uint32 GetRandomPropertyPoints(uint32 itemLevel, uint32 quality, uint32 inventoryType, uint32 subclass);
|
||||
|
||||
|
||||
@@ -19,9 +19,12 @@
|
||||
#ifndef _ITEMPROTOTYPE_H
|
||||
#define _ITEMPROTOTYPE_H
|
||||
|
||||
#include "Common.h"
|
||||
#include "DB2Structure.h"
|
||||
#include "SharedDefines.h"
|
||||
#include <bitset>
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
|
||||
enum ItemModType
|
||||
{
|
||||
|
||||
@@ -127,7 +127,6 @@ void Object::_Create(ObjectGuid const& guid)
|
||||
|
||||
SetGuidValue(OBJECT_FIELD_GUID, guid);
|
||||
SetUInt16Value(OBJECT_FIELD_TYPE, 0, m_objectType);
|
||||
m_PackGUID.Set(guid);
|
||||
}
|
||||
|
||||
std::string Object::_ConcatFields(uint16 startIndex, uint16 size) const
|
||||
@@ -239,7 +238,7 @@ void Object::BuildCreateUpdateBlockForPlayer(UpdateData* data, Player* target) c
|
||||
|
||||
ByteBuffer buf(0x400);
|
||||
buf << uint8(updateType);
|
||||
buf << GetPackGUID();
|
||||
buf << GetGUID();
|
||||
buf << uint8(m_objectTypeId);
|
||||
|
||||
BuildMovementUpdate(&buf, flags);
|
||||
@@ -267,7 +266,7 @@ void Object::BuildValuesUpdateBlockForPlayer(UpdateData* data, Player* target) c
|
||||
ByteBuffer buf(500);
|
||||
|
||||
buf << uint8(UPDATETYPE_VALUES);
|
||||
buf << GetPackGUID();
|
||||
buf << GetGUID();
|
||||
|
||||
BuildValuesUpdate(UPDATETYPE_VALUES, &buf, target);
|
||||
BuildDynamicValuesUpdate(UPDATETYPE_VALUES, &buf, target);
|
||||
@@ -385,7 +384,7 @@ void Object::BuildMovementUpdate(ByteBuffer* data, uint32 flags) const
|
||||
bool HasFall = HasFallDirection || unit->m_movementInfo.jump.fallTime != 0;
|
||||
bool HasSpline = unit->IsSplineEnabled();
|
||||
|
||||
*data << GetPackGUID(); // MoverGUID
|
||||
*data << GetGUID(); // MoverGUID
|
||||
|
||||
*data << uint32(unit->m_movementInfo.time); // MoveTime
|
||||
*data << float(unit->GetPositionX());
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include "ObjectGuid.h"
|
||||
#include "Position.h"
|
||||
#include "SharedDefines.h"
|
||||
|
||||
#include "UpdateFields.h"
|
||||
#include <list>
|
||||
#include <set>
|
||||
@@ -170,7 +171,6 @@ class TC_GAME_API Object
|
||||
virtual void RemoveFromWorld();
|
||||
|
||||
ObjectGuid const& GetGUID() const { return GetGuidValue(OBJECT_FIELD_GUID); }
|
||||
PackedGuid const& GetPackGUID() const { return m_PackGUID; }
|
||||
uint32 GetEntry() const { return GetUInt32Value(OBJECT_FIELD_ENTRY); }
|
||||
void SetEntry(uint32 entry) { SetUInt32Value(OBJECT_FIELD_ENTRY, entry); }
|
||||
|
||||
@@ -373,8 +373,6 @@ class TC_GAME_API Object
|
||||
private:
|
||||
bool m_inWorld;
|
||||
|
||||
PackedGuid m_PackGUID;
|
||||
|
||||
// for output helpfull error messages from asserts
|
||||
bool PrintIndexError(uint32 index, bool set) const;
|
||||
Object(Object const& right) = delete;
|
||||
|
||||
@@ -17,9 +17,11 @@
|
||||
*/
|
||||
|
||||
#include "ObjectGuid.h"
|
||||
#include "ByteBuffer.h"
|
||||
#include "Errors.h"
|
||||
#include "Hash.h"
|
||||
#include "Log.h"
|
||||
#include "Realm.h"
|
||||
#include "World.h"
|
||||
#include <sstream>
|
||||
#include <iomanip>
|
||||
@@ -148,10 +150,16 @@ void ObjectGuid::SetRawValue(std::vector<uint8> const& guid)
|
||||
memcpy(this, guid.data(), sizeof(*this));
|
||||
}
|
||||
|
||||
void PackedGuid::Set(ObjectGuid const& guid)
|
||||
uint8& ObjectGuid::operator[](uint32 index)
|
||||
{
|
||||
_packedGuid.clear();
|
||||
_packedGuid << guid;
|
||||
ASSERT(index < sizeof(uint64) * 2);
|
||||
return ((uint8*)&_low)[index];
|
||||
}
|
||||
|
||||
uint8 const& ObjectGuid::operator[](uint32 index) const
|
||||
{
|
||||
ASSERT(index < sizeof(uint64) * 2);
|
||||
return ((uint8 const*)&_low)[index];
|
||||
}
|
||||
|
||||
ByteBuffer& operator<<(ByteBuffer& buf, ObjectGuid const& guid)
|
||||
@@ -184,12 +192,6 @@ ByteBuffer& operator>>(ByteBuffer& buf, ObjectGuid& guid)
|
||||
return buf;
|
||||
}
|
||||
|
||||
ByteBuffer& operator<<(ByteBuffer& buf, PackedGuid const& guid)
|
||||
{
|
||||
buf.append(guid._packedGuid);
|
||||
return buf;
|
||||
}
|
||||
|
||||
std::ostream& operator<<(std::ostream& stream, ObjectGuid const& guid)
|
||||
{
|
||||
std::ostringstream tmp;
|
||||
|
||||
@@ -19,14 +19,14 @@
|
||||
#ifndef ObjectGuid_h__
|
||||
#define ObjectGuid_h__
|
||||
|
||||
#include "ByteBuffer.h"
|
||||
#include "Define.h"
|
||||
#include <deque>
|
||||
#include <functional>
|
||||
#include <list>
|
||||
#include <set>
|
||||
#include <type_traits>
|
||||
#include <unordered_set>
|
||||
#include <vector>
|
||||
#include <unordered_set>
|
||||
|
||||
enum TypeID
|
||||
{
|
||||
@@ -199,8 +199,7 @@ struct ObjectGuidTraits<HighGuid::Transport>
|
||||
static bool const MapSpecific = true;
|
||||
};
|
||||
|
||||
class ObjectGuid;
|
||||
class PackedGuid;
|
||||
class ByteBuffer;
|
||||
|
||||
#pragma pack(push, 1)
|
||||
|
||||
@@ -248,19 +247,8 @@ class TC_GAME_API ObjectGuid
|
||||
|
||||
LowType GetMaxCounter() const { return GetMaxCounter(GetHigh()); }
|
||||
|
||||
// deprecated
|
||||
uint8& operator[](uint32 index)
|
||||
{
|
||||
//ASSERT(index < sizeof(uint64) * 2);
|
||||
return ((uint8*)&_low)[index];
|
||||
}
|
||||
|
||||
// deprecated
|
||||
uint8 const& operator[](uint32 index) const
|
||||
{
|
||||
//ASSERT(index < sizeof(uint64) * 2);
|
||||
return ((uint8 const*)&_low)[index];
|
||||
}
|
||||
uint8& operator[](uint32 index);
|
||||
uint8 const& operator[](uint32 index) const;
|
||||
|
||||
bool IsEmpty() const { return _low == 0 && _high == 0; }
|
||||
bool IsCreature() const { return GetHigh() == HighGuid::Creature; }
|
||||
@@ -360,25 +348,6 @@ typedef std::deque<ObjectGuid> GuidDeque;
|
||||
typedef std::vector<ObjectGuid> GuidVector;
|
||||
typedef std::unordered_set<ObjectGuid> GuidUnorderedSet;
|
||||
|
||||
// maximum buffer size for packed guid is 18 bytes
|
||||
#define PACKED_GUID_MIN_BUFFER_SIZE 18
|
||||
|
||||
class TC_GAME_API PackedGuid
|
||||
{
|
||||
friend TC_GAME_API ByteBuffer& operator<<(ByteBuffer& buf, PackedGuid const& guid);
|
||||
|
||||
public:
|
||||
explicit PackedGuid() : _packedGuid(PACKED_GUID_MIN_BUFFER_SIZE) { _packedGuid << uint16(0); }
|
||||
explicit PackedGuid(ObjectGuid const& guid) : _packedGuid(PACKED_GUID_MIN_BUFFER_SIZE) { Set(guid); }
|
||||
|
||||
void Set(ObjectGuid const& guid);
|
||||
|
||||
size_t size() const { return _packedGuid.size(); }
|
||||
|
||||
private:
|
||||
ByteBuffer _packedGuid;
|
||||
};
|
||||
|
||||
class TC_GAME_API ObjectGuidGeneratorBase
|
||||
{
|
||||
public:
|
||||
@@ -410,8 +379,6 @@ public:
|
||||
TC_GAME_API ByteBuffer& operator<<(ByteBuffer& buf, ObjectGuid const& guid);
|
||||
TC_GAME_API ByteBuffer& operator>>(ByteBuffer& buf, ObjectGuid& guid);
|
||||
|
||||
TC_GAME_API ByteBuffer& operator<<(ByteBuffer& buf, PackedGuid const& guid);
|
||||
|
||||
TC_GAME_API std::ostream& operator<<(std::ostream& stream, ObjectGuid const& guid);
|
||||
|
||||
namespace std
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user