/* * Copyright (C) 2016+ AzerothCore , released under GNU GPL v2 license, you may redistribute it * and/or modify it under version 2 of the License, or (at your option), any later version. */ #ifndef _PLAYERBOT_AIOBJECTCONTEXT_H #define _PLAYERBOT_AIOBJECTCONTEXT_H #include #include #include "Common.h" #include "DynamicObject.h" #include "NamedObjectContext.h" #include "PlayerbotAIAware.h" #include "Strategy.h" #include "Trigger.h" #include "Value.h" class PlayerbotAI; class AiObjectContext : public PlayerbotAIAware { public: AiObjectContext(PlayerbotAI* botAI); virtual ~AiObjectContext() {} virtual Strategy* GetStrategy(std::string const name); virtual std::set GetSiblingStrategy(std::string const name); virtual Trigger* GetTrigger(std::string const name); virtual Action* GetAction(std::string const name); virtual UntypedValue* GetUntypedValue(std::string const name); template Value* GetValue(std::string const name) { return dynamic_cast*>(GetUntypedValue(name)); } template Value* GetValue(std::string const name, std::string const param) { return GetValue((std::string(name) + "::" + param)); } template Value* GetValue(std::string const name, int32 param) { std::ostringstream out; out << param; return GetValue(name, out.str()); } std::set GetValues(); std::set GetSupportedStrategies(); std::set GetSupportedActions(); std::string const FormatValues(); virtual void Update(); virtual void Reset(); virtual void AddShared(NamedObjectContext* sharedValues); std::vector Save(); void Load(std::vector data); std::vector performanceStack; protected: NamedObjectContextList strategyContexts; NamedObjectContextList actionContexts; NamedObjectContextList triggerContexts; NamedObjectContextList valueContexts; }; #endif