Added ai command setEquipment
[ryzomcore.git] / ryzom / server / src / ai_service / ai_script_comp.h
blobd4782ac188617e1658a0d5ddaf5cdcc5879e19cb
1 // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
2 // Copyright (C) 2010 Winch Gate Property Limited
3 //
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU Affero General Public License as
6 // published by the Free Software Foundation, either version 3 of the
7 // License, or (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU Affero General Public License for more details.
14 // You should have received a copy of the GNU Affero General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
17 #ifndef _SCRIPT_COMP_H_
18 #define _SCRIPT_COMP_H_
21 struct ReadFightActionException :public NLMISC::Exception
23 ReadFightActionException(const std::string &reason):NLMISC::Exception(reason){}
26 class CSpawnBot;
28 class CFightScriptComp
29 :public NLMISC::CRefCount
31 public:
32 CFightScriptComp()
34 virtual ~CFightScriptComp()
36 virtual std::string toString() const = 0;
38 virtual bool update(CSpawnBot &bot) const = 0; // returns true if it behaves normally, false if there a problem and callers may not consider it behaves normally.
39 // for instance ONCE may not consider that this call happened.
40 virtual void remove(CFightScriptComp *child)
42 protected:
43 private:
46 class CFightScriptCompReader
47 :public NLMISC::CRefCount
49 public:
50 CFightScriptCompReader()
52 virtual ~CFightScriptCompReader()
54 virtual CFightScriptComp *create (const std::string &inStr) = 0;
55 virtual std::string getName () const =0;
57 static CFightScriptCompReader *getScriptReader (const std::string &str);
59 static CFightScriptComp *createScriptComp(const std::string &str);
63 class CFightScript
65 public:
66 CFightScript();
67 virtual ~CFightScript()
70 void add(CFightScriptCompReader *reader);
72 typedef CHashMap<std::string, NLMISC::CSmartPtr<CFightScriptCompReader> > TFightScriptMap;
74 static TFightScriptMap _ScriptCompList;
78 //////////////////////////////////////////////////////////////////////////
79 // Select Filter
82 class CFightSelectFilter
83 :public CFightScriptComp
85 public:
86 CFightSelectFilter(CFightScriptComp *customComp, std::string param)
87 :_CustomComp(customComp)
88 ,_Param(param)
91 virtual ~CFightSelectFilter()
93 bool update (CSpawnBot &bot) const;
94 const std::string &getParam() const
96 return _Param;
99 std::string toString() const;
101 protected:
102 private:
103 NLMISC::CSmartPtr<CFightScriptComp> _CustomComp;
104 std::string _Param;
108 class CFightSelectFilterReader
109 :public CFightScriptCompReader
111 public:
112 CFightSelectFilterReader() {}
113 virtual ~CFightSelectFilterReader() {}
115 CFightScriptComp *create(const std::string &inStr);
116 std::string getName () const
118 return std::string("SELECT");
123 #endif