// Ryzom - MMORPG Framework // Copyright (C) 2010 Winch Gate Property Limited // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as // published by the Free Software Foundation, either version 3 of the // License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . #ifndef RY_NPC_DESCRIPTION_MESSAGES_H #define RY_NPC_DESCRIPTION_MESSAGES_H #include "nel/misc/types_nl.h" #include "nel/misc/sheet_id.h" #include "nel/misc/entity_id.h" #include "nel/net/transport_class.h" #include "game_share/msg_ais_egs_gen.h" #include "game_share/base_types.h" #include "game_share/synchronised_message.h" #include "game_share/sp_type.h" //---------------------------------------------------------------- // Logging and debugging stuff... //---------------------------------------------------------------- // The following serve for controlling verbose nature of logging - LOG is undefined at end of file extern bool VerboseNpcDescriptionMsgLog; #define LOG if (!(VerboseNpcDescriptionMsgLog && Mode==4)) {} else nlinfo // build a man-readable description of a chat parameter set from component parts std::string buildChatDebugString(const std::vector &ShopCategories, const std::vector &ItemTypesForSale, const std::vector &MissionIds); //---------------------------------------------------------------- // class used to describe a bot's chat possibilities //---------------------------------------------------------------- class CNpcChatProfile { public: CNpcChatProfile() : /*_guildCreator(false),*/ /*_dynamicMissionGiver(false),*/ _FilterExplicitActionTradeByPlayerRace(false), _ExplicitActionSPType(EGSPD::CSPType::Unknown), _FilterExplicitActionTradeByBotRace(true){} CNpcChatProfile(const CNpcChatProfile &other0,const CNpcChatProfile &other1); virtual ~CNpcChatProfile() {} // interface for interpreting chat info const std::vector &getShopTypes() const { return _ShopTypes; } const std::vector< RYMSG::TExplicitSale > getExplicitSales() const { return _ExplicitSales; } // const std::vector &getShopItemTypes() { return _shopItemTypes; } // const std::vector &getShopItemQualities() { return _shopItemQualities; } // const std::vector &getShopItemPrices() const { return _shopItemPrices; } // const std::vector &getShopItemFactionTypes() const { return _shopItemFactionTypes; } // const std::vector &getShopItemFactionPointPrices() const { return _shopItemFactionPointPrices; } const std::vector &getMissions() const { return _Missions; } // bool getGuildCreator() const{ return _GuildCreator; } bool getDynamicMissionGiver() const { return _DynamicMissionGiver;} const std::vector &getNewsChannels() const { return _NewsChannels; } const std::vector< RYMSG::TContextOption > &getContextOptions() const { return _ContextOptions; }; // const std::vector &getContextOptionsTitles() const { return _ContextOptionsTitles;} // const std::vector &getContextOptionsDetails() const { return _ContextOptionsDetails;} const std::vector &getOptionalProperties() const { return _OptionalProperties;} // const std::vector &getShopNamedItemNames() const { return _shopNamedItemNames; } // const std::vector &getShopNamedItemPrices() const { return _shopNamedItemPrices; } // const std::vector &getShopNamedItemFactionTypes() const { return _shopNamedItemFactionTypes; } // const std::vector &getShopNamedItemFactionPointPrices() const { return _shopNamedItemFactionPointPrices; } // const std::vector &getExplicitActionTradeList() const { return _ExplicitActionTradeList; } bool getFilterExplicitActionTradeByPlayerRace() const {return _FilterExplicitActionTradeByPlayerRace;} EGSPD::CSPType::TSPType getExplicitActionSPType() const {return _ExplicitActionSPType;} bool getFilterExplicitActionTradeByBotRace() const {return _FilterExplicitActionTradeByBotRace;} const std::string &getWelcomePhrase() const { return _WelcomePhrase; } const std::string &getWebPage() const { return _WebPage; } const std::string &getWebPageName() const { return _WebPageName; } const NLMISC::CSheetId &getOutpost() const { return _Outpost; } protected: std::vector< RYMSG::TExplicitSale > _ExplicitSales; // std::vector _shopItemTypes; // list of specific items to be found in shop // std::vector _shopItemQualities; // list of quality of specific item // std::vector _shopItemPrices; // list of specific item prices. -1 indicate "use standard price" // std::vector _shopItemFactionTypes; // std::vector _shopItemFactionPointPrices; // std::vector _shopItemTypesNegators; // field used when combining chat profiles // std::vector _shopItemQualitiesNegators; // list of quality of specific item std::vector _ShopTypes; // categories of shop inventory to include // std::vector _shopTypesNegators; // field used when combining chat profiles // std::vector _shopNamedItemNames; // std::vector _shopNamedItemPrices; // std::vector _shopNamedItemFactionTypes; // std::vector _shopNamedItemFactionPointPrices; // std::vector _ExplicitActionTradeList; // list of specific actions to be found in shop bool _FilterExplicitActionTradeByPlayerRace; EGSPD::CSPType::TSPType _ExplicitActionSPType; bool _FilterExplicitActionTradeByBotRace; std::vector _Missions; // array of mission aliases // std::vector _missionsNegators; // field used when combining chat profiles std::string _WelcomePhrase; // The welcome message std::string _WebPage; // The web page std::string _WebPageName; // The web page name (server phrase id) // bool _GuildCreator; // true if the bot proposes guild creation bool _DynamicMissionGiver; // true if this bot give dynamic mission std::vector _NewsChannels; // List of news channel. std::vector< RYMSG::TContextOption > _ContextOptions; /// titles of the bot context options ContextOptionsDetails.size() == ContextOptionsTitles.size() // std::vector< std::string > _ContextOptionsTitles; /// detail text of the option WARNING: we assert that ContextOptionsDetails.size() == ContextOptionsTitles.size() // std::vector< std::string > _ContextOptionsDetails; /// optional and rare properties std::vector _OptionalProperties; NLMISC::CSheetId _Outpost; }; //---------------------------------------------------------------- // List of Character starting chat or ending chat with bot struct CCharacterBotChatBeginEnd : public CMirrorTransportClass { // Container contains pair of Player character / bot which start or end chating std::vector< TDataSetRow > BotChatStart; std::vector< TDataSetRow > BotChatEnd; virtual void description () { className ("CCharacterBotChatBeginEnd"); propertyCont ("botChatStart", PropUInt32, BotChatStart); propertyCont ("botChatEnd", PropUInt32, BotChatEnd); } virtual void callback (const std::string &name, NLNET::TServiceId id) { } }; struct CCharacterDynChatBeginEnd : public CMirrorTransportClass { // Container contains only bot which start or end chating std::vector< TDataSetRow > DynChatStart; std::vector< TDataSetRow > DynChatEnd; virtual void description () { className ("CCharacterDynChatBeginEnd"); propertyCont ("dnChatStart", PropUInt32, DynChatStart); propertyCont ("dnChatEnd", PropUInt32, DynChatEnd); } virtual void callback (const std::string &name, NLNET::TServiceId id) { } }; struct CCustomElementId { CCustomElementId(uint32 alias = 0, const std::string &id = "") : PrimAlias(alias), Id(id) { } uint32 PrimAlias; std::string Id; void serial(NLMISC::IStream &f); }; inline bool operator<(const CCustomElementId &leftHand, const CCustomElementId &rightHand) { if (leftHand.PrimAlias < rightHand.PrimAlias) return true; if (leftHand.PrimAlias > rightHand.PrimAlias) return false; if (leftHand.Id < rightHand.Id) return true; return false; } //all script lines typedef std::vector TScriptContent; //the key is a pair, the value is the content of the script typedef std::map TScripts; //class used for serialization when receiving AIS user_model msg //also used to represent custom loot set (key : drop proba, value : set script) struct CScriptData { TScripts Scripts; void serial(NLMISC::IStream &f); }; //used for serialization when receiving AIS custom loot table msg //contains all loot sets of the table, and money infos used for dappers drop struct CCustomLootTable { CScriptData LootSets; float MoneyFactor; float MoneyProba; uint32 MoneyBase; void serial(NLMISC::IStream &f); }; //key : pair, value : all associated custom loot sets + money info typedef std::map TCustomLootTable; struct CCustomLootTableManager { TCustomLootTable Tables; void serial(NLMISC::IStream &f); }; #undef LOG //---------------------------------------------------------------- #endif