1 // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
2 // Copyright (C) 2010 Winch Gate Property Limited
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.
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 "nel/misc/types_nl.h"
20 #include "nel/misc/common.h"
21 #include "nel/misc/command.h"
22 #include "nel/misc/path.h"
23 #include "npc_description_messages.h"
24 #include "../ai_share/ai_share.h"
26 using namespace NLMISC
;
30 //---------------------------------------------------------------------------------------
31 // Stuff used for management of log messages
33 bool VerboseNpcDescriptionMsgLog
=false;
34 #define LOG if (!VerboseNpcDescriptionMsgLog) {} else nlinfo
36 CNpcChatProfile::CNpcChatProfile(const CNpcChatProfile
&other0
, const CNpcChatProfile
&other1
)
40 // run through shop types in other0 - trying to add to output shop type list
41 for (i
=0;i
<other0
.getShopTypes().size();++i
)
43 // not found in negator list so add to output list
44 _ShopTypes
.push_back(other0
._ShopTypes
[i
]);
47 // run through shop types in other1 - trying to add to output shop type list
48 for (i
=0;i
<other1
._ShopTypes
.size();++i
)
50 // make sure shop type isn't already in output list
51 for (j
=0;j
<_ShopTypes
.size();++j
)
52 if (other1
._ShopTypes
[i
]==_ShopTypes
[j
])
54 if (j
<_ShopTypes
.size())
57 // not found in negator list or existing output list so add it now
58 _ShopTypes
.push_back(other0
._ShopTypes
[i
]);
61 // run through shop item types in other0 - trying to add to output shop item type list
62 for (i
=0;i
<other0
._ExplicitSales
.size();++i
)
64 _ExplicitSales
.push_back(other0
._ExplicitSales
[i
]);
67 // run through shop item types in other1 - trying to add to output shop item type list
68 for (i
=0;i
<other1
._ExplicitSales
.size();++i
)
70 // make sure shop item type isn't already in output list
71 for (j
=0;j
<_ExplicitSales
.size();++j
)
72 if (other1
._ExplicitSales
[i
]==_ExplicitSales
[j
])
74 if (j
<_ExplicitSales
.size())
77 // not found in negator list or existing output list so add it now
78 _ExplicitSales
.push_back(other1
._ExplicitSales
[i
]);
81 // run through missions in other0 - trying to add to output mission list
82 _Missions
=other0
._Missions
;
83 for (i
=0;i
<other1
._Missions
.size();++i
)
85 // make sure shop type isn't already in output list
86 for (j
=0;j
<_Missions
.size();++j
)
87 if (other1
._Missions
[i
]==_Missions
[j
])
89 if (j
<_Missions
.size())
92 // not found in existing output list so add it now
93 _Missions
.push_back(other1
._Missions
[i
]);
97 void CCustomElementId::serial(NLMISC::IStream
&f
)
103 void CScriptData::serial(NLMISC::IStream
&f
)
112 for (; i
< size
; ++i
)
114 //std::string tmpKey;
115 CCustomElementId tmpKey
;
116 std::vector
<std::string
> tmpVal
;
118 f
.serialCont(tmpVal
);
119 Scripts
.insert(make_pair(tmpKey
,tmpVal
));
124 size
= (uint16
)Scripts
.size();
126 for (TScripts::iterator it
= Scripts
.begin(); it
!= Scripts
.end(); ++it
)
128 //std::string tmp = it->first;
129 nlWrite(f
, serial
, it
->first
);
130 nlWrite(f
, serialCont
, it
->second
);
135 void CCustomLootTable::serial(NLMISC::IStream
&f
)
138 f
.serial(MoneyFactor
);
139 f
.serial(MoneyProba
);
143 void CCustomLootTableManager::serial(NLMISC::IStream
&f
)
152 for (; i
< size
; ++i
)
154 //std::string tmpKey;
155 CCustomElementId tmpKey
;
156 CCustomLootTable tmpVal
;
159 Tables
.insert(make_pair(tmpKey
,tmpVal
));
164 size
= (uint16
)Tables
.size();
166 for (TCustomLootTable::iterator it
= Tables
.begin(); it
!= Tables
.end(); ++it
)
168 nlWrite(f
, serial
, it
->first
);
169 nlWrite(f
, serial
, it
->second
);
175 //---------------------------------------------------------------------------------------
176 // Control over verbose nature of logging
177 //---------------------------------------------------------------------------------------
179 NLMISC_COMMAND(verboseNpcDescriptionMsgLog
,"Turn on or off or check the state of verbose AI->EGS NPC description message logging","")
186 if(args
[0]==string("on")||args
[0]==string("ON")||args
[0]==string("true")||args
[0]==string("TRUE")||args
[0]==string("1"))
187 VerboseNpcDescriptionMsgLog
=true;
189 if(args
[0]==string("off")||args
[0]==string("OFF")||args
[0]==string("false")||args
[0]==string("FALSE")||args
[0]==string("0"))
190 VerboseNpcDescriptionMsgLog
=false;
193 nlinfo("verbose Logging is %s",VerboseNpcDescriptionMsgLog
?"ON":"OFF");