Added ai command setEquipment
[ryzomcore.git] / ryzom / server / src / ai_service / visual_properties_interface.cpp
blobcacc4aaf0c514b303d7528cd82f422613df5ed0e
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/>.
19 #include "stdpch.h"
20 #include "visual_properties_interface.h"
21 #include "ai.h"
22 #include "mirrors.h"
23 #include "ai_instance.h"
24 #include "ai_mgr.h"
25 #include "game_share/synchronised_message.h"
27 //#include "nel/misc/ucstring.h"
30 // Nel Include
31 #include "nel/net/unified_network.h"
32 #include "game_share/mode_and_behaviour.h"
33 #include "visual_properties_interface.h"
36 using namespace NLMISC;
37 using namespace NLNET;
38 using namespace std;
41 //-----------------------------------------------
42 /// Macro to read a Bool from the CFG.
43 /// variableName : Variable Name to Read and Set.
44 //-----------------------------------------------
45 #define READ_BOOL(variableName) \
46 /* Read the Variable Value From Script */ \
47 {CConfigFile::CVar *varPtr = IService::getInstance()->ConfigFile.getVarPtr(#variableName); \
48 /* Value found, set the Variable */ \
49 if(varPtr) \
50 variableName = varPtr->asInt() ? true : false; \
51 nlinfo("IOS Entity naming constrol: "#variableName" %d",variableName?"1":"0");}
53 bool CVisualPropertiesInterface::UseIdForName=false;
54 bool CVisualPropertiesInterface::ForceNames=false;
56 // classic init(), update() and release()
57 void CVisualPropertiesInterface::init()
59 READ_BOOL(UseIdForName);
60 READ_BOOL(ForceNames);
63 void CVisualPropertiesInterface::update()
67 void CVisualPropertiesInterface::release()
71 // set different visual properties for a bot.
72 void CVisualPropertiesInterface::setName(const TDataSetRow& dataSetRow, ucstring name)
74 if (!IOSHasMirrorReady)
75 return;
77 NLNET::CMessage msgout("CHARACTER_NAME");
78 CEntityId eid=CMirrors::DataSet->getEntityId(dataSetRow);
79 msgout.serial (const_cast<TDataSetRow&>(dataSetRow));
80 msgout.serial (name);
81 sendMessageViaMirror("IOS",msgout);