Resolve "Toggle Free Look with Hotkey"
[ryzomcore.git] / ryzom / server / src / server_share / npc_description_messages.h
blob7ef126e87bf0852171aacad6232a963778233369
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 RY_NPC_DESCRIPTION_MESSAGES_H
18 #define RY_NPC_DESCRIPTION_MESSAGES_H
20 #include "nel/misc/types_nl.h"
21 #include "nel/misc/sheet_id.h"
22 #include "nel/misc/entity_id.h"
23 #include "nel/net/transport_class.h"
24 #include "game_share/msg_ais_egs_gen.h"
25 #include "game_share/base_types.h"
26 #include "game_share/synchronised_message.h"
27 #include "game_share/sp_type.h"
30 //----------------------------------------------------------------
31 // Logging and debugging stuff...
32 //----------------------------------------------------------------
34 // The following serve for controlling verbose nature of logging - LOG is undefined at end of file
35 extern bool VerboseNpcDescriptionMsgLog;
36 #define LOG if (!(VerboseNpcDescriptionMsgLog && Mode==4)) {} else nlinfo
38 // build a man-readable description of a chat parameter set from component parts
39 std::string buildChatDebugString(const std::vector<uint32> &ShopCategories,
40 const std::vector<NLMISC::CSheetId> &ItemTypesForSale,
41 const std::vector<uint32> &MissionIds);
43 //----------------------------------------------------------------
44 // class used to describe a bot's chat possibilities
45 //----------------------------------------------------------------
47 class CNpcChatProfile
49 public:
50 CNpcChatProfile() : /*_guildCreator(false),*/ /*_dynamicMissionGiver(false),*/ _FilterExplicitActionTradeByPlayerRace(false),
51 _ExplicitActionSPType(EGSPD::CSPType::Unknown), _FilterExplicitActionTradeByBotRace(true),
52 _DynamicMissionGiver(false), _Organization(0) {}
53 CNpcChatProfile(const CNpcChatProfile &other0,const CNpcChatProfile &other1);
54 virtual ~CNpcChatProfile() {}
56 // interface for interpreting chat info
57 const std::vector<uint32> &getShopTypes() const { return _ShopTypes; }
58 const std::vector< RYMSG::TExplicitSale > getExplicitSales() const { return _ExplicitSales; }
59 // const std::vector<NLMISC::CSheetId> &getShopItemTypes() { return _shopItemTypes; }
60 // const std::vector<uint32> &getShopItemQualities() { return _shopItemQualities; }
61 // const std::vector<sint32> &getShopItemPrices() const { return _shopItemPrices; }
62 // const std::vector<uint8> &getShopItemFactionTypes() const { return _shopItemFactionTypes; }
63 // const std::vector<uint32> &getShopItemFactionPointPrices() const { return _shopItemFactionPointPrices; }
64 const std::vector<uint32> &getMissions() const { return _Missions; }
65 // bool getGuildCreator() const{ return _GuildCreator; }
66 bool getDynamicMissionGiver() const { return _DynamicMissionGiver;}
67 const std::vector<std::string> &getNewsChannels() const { return _NewsChannels; }
68 const std::vector< RYMSG::TContextOption > &getContextOptions() const { return _ContextOptions; };
69 // const std::vector<std::string> &getContextOptionsTitles() const { return _ContextOptionsTitles;}
70 // const std::vector<std::string> &getContextOptionsDetails() const { return _ContextOptionsDetails;}
71 const std::vector<std::string> &getOptionalProperties() const { return _OptionalProperties;}
73 // const std::vector<std::string> &getShopNamedItemNames() const { return _shopNamedItemNames; }
74 // const std::vector<uint32> &getShopNamedItemPrices() const { return _shopNamedItemPrices; }
75 // const std::vector<uint8> &getShopNamedItemFactionTypes() const { return _shopNamedItemFactionTypes; }
76 // const std::vector<uint32> &getShopNamedItemFactionPointPrices() const { return _shopNamedItemFactionPointPrices; }
78 // const std::vector<NLMISC::CSheetId> &getExplicitActionTradeList() const { return _ExplicitActionTradeList; }
79 bool getFilterExplicitActionTradeByPlayerRace() const {return _FilterExplicitActionTradeByPlayerRace;}
80 EGSPD::CSPType::TSPType getExplicitActionSPType() const {return _ExplicitActionSPType;}
81 bool getFilterExplicitActionTradeByBotRace() const {return _FilterExplicitActionTradeByBotRace;}
83 const std::string &getWelcomePhrase() const { return _WelcomePhrase; }
84 const std::string &getWebPage() const { return _WebPage; }
85 const std::string &getWebPageName() const { return _WebPageName; }
87 const NLMISC::CSheetId &getOutpost() const { return _Outpost; }
88 uint32 getOrganization() const { return _Organization; }
90 protected:
91 std::vector< RYMSG::TExplicitSale > _ExplicitSales;
92 // std::vector<NLMISC::CSheetId> _shopItemTypes; // list of specific items to be found in shop
93 // std::vector<uint32> _shopItemQualities; // list of quality of specific item
94 // std::vector<sint32> _shopItemPrices; // list of specific item prices. -1 indicate "use standard price"
95 // std::vector<uint8> _shopItemFactionTypes;
96 // std::vector<uint32> _shopItemFactionPointPrices;
97 // std::vector<NLMISC::CSheetId> _shopItemTypesNegators; // field used when combining chat profiles
98 // std::vector<uint32> _shopItemQualitiesNegators; // list of quality of specific item
99 std::vector<uint32> _ShopTypes; // categories of shop inventory to include
100 // std::vector<uint32> _shopTypesNegators; // field used when combining chat profiles
102 // std::vector<std::string> _shopNamedItemNames;
103 // std::vector<uint32> _shopNamedItemPrices;
104 // std::vector<uint8> _shopNamedItemFactionTypes;
105 // std::vector<uint32> _shopNamedItemFactionPointPrices;
107 // std::vector<NLMISC::CSheetId> _ExplicitActionTradeList; // list of specific actions to be found in shop
108 bool _FilterExplicitActionTradeByPlayerRace;
109 EGSPD::CSPType::TSPType _ExplicitActionSPType;
110 bool _FilterExplicitActionTradeByBotRace;
112 std::vector<uint32> _Missions; // array of mission aliases
113 // std::vector<uint32> _missionsNegators; // field used when combining chat profiles
114 std::string _WelcomePhrase; // The welcome message
115 std::string _WebPage; // The web page
116 std::string _WebPageName; // The web page name (server phrase id)
117 // bool _GuildCreator; // true if the bot proposes guild creation
118 bool _DynamicMissionGiver; // true if this bot give dynamic mission
119 std::vector<std::string> _NewsChannels; // List of news channel.
120 std::vector< RYMSG::TContextOption > _ContextOptions;
121 /// titles of the bot context options ContextOptionsDetails.size() == ContextOptionsTitles.size()
122 // std::vector< std::string > _ContextOptionsTitles;
123 /// detail text of the option WARNING: we assert that ContextOptionsDetails.size() == ContextOptionsTitles.size()
124 // std::vector< std::string > _ContextOptionsDetails;
126 /// optional and rare properties
127 std::vector<std::string> _OptionalProperties;
129 NLMISC::CSheetId _Outpost;
131 uint32 _Organization;
134 //----------------------------------------------------------------
135 // List of Character starting chat or ending chat with bot
137 struct CCharacterBotChatBeginEnd : public CMirrorTransportClass
139 // Container contains pair of Player character / bot which start or end chating
140 std::vector< TDataSetRow > BotChatStart;
141 std::vector< TDataSetRow > BotChatEnd;
143 virtual void description ()
145 className ("CCharacterBotChatBeginEnd");
146 propertyCont ("botChatStart", PropUInt32, BotChatStart);
147 propertyCont ("botChatEnd", PropUInt32, BotChatEnd);
150 virtual void callback (const std::string &/* name */, NLNET::TServiceId /* id */) { }
153 struct CCharacterDynChatBeginEnd : public CMirrorTransportClass
155 // Container contains only bot which start or end chating
156 std::vector< TDataSetRow > DynChatStart;
157 std::vector< TDataSetRow > DynChatEnd;
159 virtual void description ()
161 className ("CCharacterDynChatBeginEnd");
162 propertyCont ("dnChatStart", PropUInt32, DynChatStart);
163 propertyCont ("dnChatEnd", PropUInt32, DynChatEnd);
166 virtual void callback (const std::string &/* name */, NLNET::TServiceId /* id */) { }
169 struct CCustomElementId
171 CCustomElementId(uint32 alias = 0, const std::string &id = "") : PrimAlias(alias), Id(id) { }
172 uint32 PrimAlias;
173 std::string Id;
174 void serial(NLMISC::IStream &f);
177 inline bool operator<(const CCustomElementId &leftHand, const CCustomElementId &rightHand)
179 if (leftHand.PrimAlias < rightHand.PrimAlias)
180 return true;
181 if (leftHand.PrimAlias > rightHand.PrimAlias)
182 return false;
183 if (leftHand.Id < rightHand.Id)
184 return true;
185 return false;
188 //all script lines
189 typedef std::vector<std::string> TScriptContent;
190 //the key is a pair<primAlias, UserModelId>, the value is the content of the script
191 typedef std::map<CCustomElementId, TScriptContent> TScripts;
193 //class used for serialization when receiving AIS user_model msg
194 //also used to represent custom loot set (key : drop proba, value : set script)
195 struct CScriptData
197 TScripts Scripts;
198 void serial(NLMISC::IStream &f);
201 //used for serialization when receiving AIS custom loot table msg
202 //contains all loot sets of the table, and money infos used for dappers drop
203 struct CCustomLootTable
205 CScriptData LootSets;
206 float MoneyFactor;
207 float MoneyProba;
208 uint32 MoneyBase;
209 void serial(NLMISC::IStream &f);
212 //key : pair<primAlias, customLootTableId>, value : all associated custom loot sets + money info
213 typedef std::map<CCustomElementId, CCustomLootTable> TCustomLootTable;
215 struct CCustomLootTableManager
217 TCustomLootTable Tables;
218 void serial(NLMISC::IStream &f);
221 #undef LOG
223 //----------------------------------------------------------------
224 #endif