diff --git a/ryzom/client/src/commands.cpp b/ryzom/client/src/commands.cpp index d06e975ca..396b63404 100644 --- a/ryzom/client/src/commands.cpp +++ b/ryzom/client/src/commands.cpp @@ -4487,12 +4487,14 @@ NLMISC_COMMAND(debugItemInfoWaiters, "log ItemInfoWaiters", "") return true; } +#ifdef RYZOM_FORGE NLMISC_COMMAND(debugItemInfoCache, "log ItemInfoCache", "") { getInventory().debugItemInfoCache(); return true; } +#endif NLMISC_COMMAND(debugInfoWindows, "log info windows sheetId", "") { diff --git a/ryzom/client/src/interface_v3/action_handler_game.cpp b/ryzom/client/src/interface_v3/action_handler_game.cpp index acb8a62ef..5a7b25c93 100644 --- a/ryzom/client/src/interface_v3/action_handler_game.cpp +++ b/ryzom/client/src/interface_v3/action_handler_game.cpp @@ -4628,6 +4628,8 @@ public: }; REGISTER_ACTION_HANDLER( CHandlerSortTribeFame, "sort_tribefame"); +#ifdef RYZOM_FORGE + // *************************************************************************** class CHandlerTriggerIconBuffs : public IActionHandler { @@ -4642,3 +4644,4 @@ public: }; REGISTER_ACTION_HANDLER(CHandlerTriggerIconBuffs, "trigger_show_icon_buffs"); +#endif diff --git a/ryzom/client/src/interface_v3/dbctrl_sheet.cpp b/ryzom/client/src/interface_v3/dbctrl_sheet.cpp index 3a265b0e2..af28ec185 100644 --- a/ryzom/client/src/interface_v3/dbctrl_sheet.cpp +++ b/ryzom/client/src/interface_v3/dbctrl_sheet.cpp @@ -78,6 +78,8 @@ REGISTER_UI_CLASS(CDBCtrlSheet) const uint64 NOTIFY_ANIM_MS_DURATION = 1000; +#ifdef RYZOM_FORGE + // state kept and changed by UI:SAVE:SHOW_ICON_BUFFS bool CDBCtrlSheet::_ShowIconBuffs = true; @@ -147,6 +149,8 @@ string CControlSheetInfoWaiter::infoValidated() const #endif } +#endif + // *************************************************************************** int CDBCtrlSheet::luaGetDraggedSheet(CLuaState &ls) { @@ -154,6 +158,8 @@ int CDBCtrlSheet::luaGetDraggedSheet(CLuaState &ls) return 1; } +#ifdef RYZOM_FORGE + // *************************************************************************** int CDBCtrlSheet::luaGetItemInfo(CLuaState &ls) { @@ -189,6 +195,8 @@ int CDBCtrlSheet::luaGetItemInfo(CLuaState &ls) return 1; } +#endif + // *************************************************************************** int CDBCtrlSheet::luaGetName(CLuaState &ls) { @@ -533,7 +541,9 @@ CCtrlDraggable(param) _Useable= true; _GrayedLink= NULL; _NeedSetup= true; +#ifdef RYZOM_FORGE _ItemInfoChanged = true; +#endif _IconW = 0; _IconH = 0; _SetupInit= false; @@ -572,10 +582,12 @@ CDBCtrlSheet::~CDBCtrlSheet() { NL3D::UDriver *Driver = CViewRenderer::getInstance()->getDriver(); +#ifdef RYZOM_FORGE if (_ItemInfoWaiter.Requesting) { getInventory().removeItemInfoWaiter(&_ItemInfoWaiter); } +#endif if (_GuildBack) { @@ -1097,6 +1109,7 @@ void CDBCtrlSheet::updateIconSize() } } +#ifdef RYZOM_FORGE // *************************************************************************** void CDBCtrlSheet::clearIconBuffs() { @@ -1163,6 +1176,7 @@ void CDBCtrlSheet::infoReceived() } } } +#endif // *************************************************************************** void CDBCtrlSheet::setupPact() @@ -1205,6 +1219,8 @@ void CDBCtrlSheet::setupPact() } } +#ifdef RYZOM_FORGE + // *************************************************************************** bool CDBCtrlSheet::useItemInfoForFamily(ITEMFAMILY::EItemFamily family) const { @@ -1220,6 +1236,8 @@ bool CDBCtrlSheet::useItemInfoForFamily(ITEMFAMILY::EItemFamily family) const || family == ITEMFAMILY::TRAINING_TOOL; } +#endif + // *************************************************************************** void CDBCtrlSheet::setupItem () { @@ -1328,8 +1346,10 @@ void CDBCtrlSheet::setupItem () // Special Item requirement updateItemCharacRequirement(_LastSheetId); +#ifdef RYZOM_FORGE // update item info markers _ItemInfoChanged = true; +#endif } else { @@ -1405,12 +1425,14 @@ void CDBCtrlSheet::setupItem () } */ +#ifdef RYZOM_FORGE // at each frame, update item info icon if changed if (_ItemInfoChanged) { _ItemInfoChanged = false; setupItemInfoWaiter(); } +#endif } @@ -2390,7 +2412,12 @@ void CDBCtrlSheet::drawSheet (sint32 x, sint32 y, bool draging, bool showSelecti rVR.draw11RotFlipBitmap (_RenderLayer+1, x, y, 0, false, _DispOver2BmpId, fastMulRGB(curSheetColor, _IconOver2Color)); } - if (_ShowIconBuffs && !_BuffIcons.empty()) +#ifdef RYZOM_FORGE + if (_ShowIconBuffs && +#else + if ( +#endif + !_BuffIcons.empty()) { // there is max 4 icons sint32 hArea = (hSheet / 4); @@ -2425,7 +2452,12 @@ void CDBCtrlSheet::drawSheet (sint32 x, sint32 y, bool draging, bool showSelecti drawNumber(x+1, y-2+hSheet-rVR.getFigurTextureH(), wSheet, hSheet, numberColor, enchant, false); } - if (_ShowIconBuffs && !_EnchantIcons.empty()) +#ifdef RYZOM_FORGE + if (_ShowIconBuffs && +#else + if ( +#endif + !_EnchantIcons.empty()) { // should only only 2 icons at most // draw them in single line, top-right @@ -3225,8 +3257,10 @@ void CDBCtrlSheet::swapSheet(CDBCtrlSheet *other) swapDBProps(getItemRMClassTypePtr(), other->getItemRMClassTypePtr()); swapDBProps(getItemRMFaberStatTypePtr(), other->getItemRMFaberStatTypePtr()); swapDBProps(getItemPrerequisitValidPtr(), other->getItemPrerequisitValidPtr()); +#ifdef RYZOM_FORGE swapDBProps(getItemSerialPtr(), other->getItemSerialPtr()); swapDBProps(getItemCreateTimePtr(), other->getItemCreateTimePtr()); +#endif } } @@ -3338,6 +3372,7 @@ const COutpostBuildingSheet *CDBCtrlSheet::asOutpostBuildingSheet() const return NULL; } +#ifdef RYZOM_FORGE // *************************************************************************** void CDBCtrlSheet::setupItemInfoWaiter() { @@ -3393,6 +3428,7 @@ void CDBCtrlSheet::setupItemInfoWaiter() } } } +#endif // *************************************************************************** void CDBCtrlSheet::getContextHelp(std::string &help) const @@ -3455,6 +3491,7 @@ void CDBCtrlSheet::getContextHelp(std::string &help) const const CItemSheet *item= asItemSheet(); if(item) { +#ifdef RYZOM_FORGE if (useItemInfoForFamily(item->Family)) { // call lua function to update tooltip window @@ -3464,7 +3501,9 @@ void CDBCtrlSheet::getContextHelp(std::string &help) const if (help.empty()) help = getItemActualName(); } - else if (!_ContextHelp.empty()) + else +#endif + if (!_ContextHelp.empty()) { help = _ContextHelp; } @@ -3587,6 +3626,7 @@ void CDBCtrlSheet::getContextHelp(std::string &help) const // *************************************************************************** void CDBCtrlSheet::getContextHelpToolTip(std::string &help) const { +#ifdef RYZOM_FORGE // Special case for buff items and spell crystals, only for tooltips if (getType() == CCtrlSheetInfo::SheetType_Item) { @@ -3601,6 +3641,7 @@ void CDBCtrlSheet::getContextHelpToolTip(std::string &help) const } } } +#endif // Default getContextHelp(help); @@ -3812,7 +3853,9 @@ void CDBCtrlSheet::resetAllTexIDs() _IconW = 0; _IconH = 0; +#ifdef RYZOM_FORGE _ItemInfoChanged = true; +#endif _EnchantIcons.clear(); _BuffIcons.clear(); } @@ -3895,10 +3938,12 @@ void CDBCtrlSheet::copyAspect(CDBCtrlSheet *dest) dest->setItemRMFaberStatType(getItemRMFaberStatType()); // copy prerequisit valid flag dest->setItemPrerequisitValid(getItemPrerequisitValid()); +#ifdef RYZOM_FORGE // copy item serial dest->setItemSerial(getItemSerial()); // copy item create time dest->setItemCreateTime(getItemCreateTime()); +#endif } // if brick, sphrase or sphraseId if(isSBrick() || isSPhrase() || isSPhraseId()) @@ -4430,6 +4475,8 @@ void CDBCtrlSheet::setItemResaleFlag(sint32 rf) node->setValue32(rf); } +#ifdef RYZOM_FORGE + // *************************************************************************** sint32 CDBCtrlSheet::getItemCreateTime() const { @@ -4478,6 +4525,8 @@ void CDBCtrlSheet::setItemSerial(sint32 rf) node->setValue32(rf); } +#endif + // *************************************************************************** bool CDBCtrlSheet::getLockedByOwner() const { @@ -4736,6 +4785,7 @@ std::string CDBCtrlSheet::getContextHelpWindowName() const { return "action_context_help"; } +#ifdef RYZOM_FORGE if (getType() == CCtrlSheetInfo::SheetType_Item) { const CItemSheet *item= asItemSheet(); @@ -4751,6 +4801,7 @@ std::string CDBCtrlSheet::getContextHelpWindowName() const } } } +#endif return CCtrlBase::getContextHelpWindowName(); } diff --git a/ryzom/client/src/interface_v3/dbctrl_sheet.h b/ryzom/client/src/interface_v3/dbctrl_sheet.h index a26a74b22..d023d41af 100644 --- a/ryzom/client/src/interface_v3/dbctrl_sheet.h +++ b/ryzom/client/src/interface_v3/dbctrl_sheet.h @@ -61,6 +61,8 @@ namespace NLGUI class CDBCtrlSheet; +#ifdef RYZOM_FORGE + // *************************************************************************** // Item info request from server class CControlSheetInfoWaiter : public IItemInfoWaiter @@ -78,6 +80,7 @@ public: virtual void infoReceived(); }; +#endif // *************************************************************************** /** Common info for CDBCtrlSheet and CDBGroupListSheet @@ -306,7 +309,9 @@ public: REFLECT_STRING_REF ("on_can_drop", getActionOnCanDrop, setActionOnCanDrop); REFLECT_STRING_REF ("on_can_drop_params", getParamsOnCanDrop, setParamsOnCanDrop); REFLECT_LUA_METHOD("getDraggedSheet", luaGetDraggedSheet); +#ifdef RYZOM_FORGE REFLECT_LUA_METHOD("getItemInfo", luaGetItemInfo); +#endif REFLECT_LUA_METHOD("getName", luaGetName); REFLECT_LUA_METHOD("getCreatorName", luaGetCreatorName); REFLECT_LUA_METHOD("waitInfo", luaWaitInfo); @@ -314,7 +319,9 @@ public: REFLECT_EXPORT_END int luaGetDraggedSheet(CLuaState &ls); +#ifdef RYZOM_FORGE int luaGetItemInfo(CLuaState &ls); +#endif int luaGetName(CLuaState &ls); int luaGetCreatorName(CLuaState &ls); int luaWaitInfo(CLuaState &ls); @@ -534,6 +541,8 @@ public: // set item RESALE_FLAG void setItemResaleFlag(sint32 rf); +#ifdef RYZOM_FORGE + //get item CREATE_TIME. 0 if no DB sint32 getItemCreateTime() const; NLMISC::CCDBNodeLeaf *getItemCreateTimePtr() const; @@ -546,6 +555,8 @@ public: // set item CREATE_TIME void setItemSerial(sint32 serial); +#endif + // get item locked by owner bool getLockedByOwner() const; @@ -605,14 +616,20 @@ public: // start notify anim (at the end of regen usually) void startNotifyAnim(); +#ifdef RYZOM_FORGE // callback from info waiter void infoReceived(); +#endif // set enchant/buff marker visiblility +#ifdef RYZOM_FORGE static void setShowIconBuffs(bool b) { _ShowIconBuffs = b; } +#endif protected: +#ifdef RYZOM_FORGE inline bool useItemInfoForFamily(ITEMFAMILY::EItemFamily family) const; +#endif void setupItem(); void setupPact(); @@ -652,7 +669,9 @@ protected: NLMISC::CCDBNodeLeaf *_ItemRMFaberStatType; mutable sint32 _LastSheetId; +#ifdef RYZOM_FORGE bool _ItemInfoChanged; +#endif /// Display sint32 _DispSlotBmpId; // Display slot bitmap id @@ -803,22 +822,28 @@ protected: static NLMISC::CSmartPtr _PhraseAdapter; sint64 _NotifyAnimEndTime; - + +#ifdef RYZOM_FORGE mutable CControlSheetInfoWaiter _ItemInfoWaiter; +#endif private: mutable TSheetType _ActualType; static CDBCtrlSheet *_CurrSelection; static CDBCtrlSheet *_CurrMenuSheet; +#ifdef RYZOM_FORGE static bool _ShowIconBuffs; +#endif private: void updateActualType() const; void updateIconSize(); void resetAllTexIDs(); void setupInit(); +#ifdef RYZOM_FORGE // remove enchant and buff markers from item icon void clearIconBuffs(); +#endif void setupCharBitmaps(sint32 maxW, sint32 maxLine, sint32 maxWChar= 1000, bool topDown= false); void resetCharBitmaps(); @@ -827,8 +852,10 @@ private: // special for items void updateItemCharacRequirement(sint32 sheetId); +#ifdef RYZOM_FORGE // Send ITEM_INFO:GET request to server to fetch Buffs, Enchant info void setupItemInfoWaiter(); +#endif // update armour color, and cache void updateArmourColor(sint8 col); diff --git a/ryzom/client/src/interface_v3/inventory_manager.cpp b/ryzom/client/src/interface_v3/inventory_manager.cpp index 9fe203a0e..5cb60842b 100644 --- a/ryzom/client/src/interface_v3/inventory_manager.cpp +++ b/ryzom/client/src/interface_v3/inventory_manager.cpp @@ -150,6 +150,8 @@ void CItemImage::build(CCDBNodeBranch *branch) nlassert(Sheet && Quality && Quantity && UserColor && Weight && NameId && InfoVersion); } +#ifdef RYZOM_FORGE + // ************************************************************************************************* void CItemInfoCache::load(const std::string &filename) { @@ -283,6 +285,8 @@ void CItemInfoCache::debugItemInfoCache() const pIM->displaySystemInfo(toString("ItemInfoCache: %d entries written to client.log", _ItemInfoCacheMap.size())); } +#endif + // ************************************************************************************************* // CInventoryManager // ************************************************************************************************* @@ -311,16 +315,22 @@ CInventoryManager::CInventoryManager() BagItemEquipped[i]= false; } +#ifdef RYZOM_FORGE + _ItemInfoCacheFilename = toString("save/item_infos_%d.cache", CharacterHomeSessionId.asInt()); _ItemInfoCache.load(_ItemInfoCacheFilename); +#endif + nlctassert(NumInventories== sizeof(InventoryIndexes)/sizeof(InventoryIndexes[0])); } // *************************************************************************** CInventoryManager::~CInventoryManager() { +#ifdef RYZOM_FORGE _ItemInfoCache.save(_ItemInfoCacheFilename); +#endif } // ************************************************************************************************* @@ -3385,11 +3395,13 @@ uint CInventoryManager::getItemSheetForSlotId(uint slotId) const return 0; } +#ifdef RYZOM_FORGE // *************************************************************************** const CClientItemInfo *CInventoryManager::getItemInfoCache(uint32 serial, uint32 createTime) const { return _ItemInfoCache.getItemInfo(serial, createTime); } +#endif // *************************************************************************** const CClientItemInfo &CInventoryManager::getItemInfo(uint slotId) const @@ -3674,10 +3686,12 @@ void CInventoryManager::debugItemInfoWaiters() } // *************************************************************************** +#ifdef RYZOM_FORGE void CInventoryManager::debugItemInfoCache() const { _ItemInfoCache.debugItemInfoCache(); } +#endif // *************************************************************************** void CInventoryManager::sortBag() diff --git a/ryzom/client/src/interface_v3/inventory_manager.h b/ryzom/client/src/interface_v3/inventory_manager.h index f33f627b1..255f7bf6f 100644 --- a/ryzom/client/src/interface_v3/inventory_manager.h +++ b/ryzom/client/src/interface_v3/inventory_manager.h @@ -129,6 +129,8 @@ public: void refreshInfoVersion(uint8 infoVersion) { InfoVersionFromMsg= infoVersion; } }; +#ifdef RYZOM_FORGE + class CItemInfoCache { public: @@ -149,6 +151,8 @@ private: TItemInfoCacheMap _ItemInfoCacheMap; }; +#endif + // *************************************************************************** /** This manager gives direct access to inventory slots (bag, temporary inventory, hands, and equip inventory) * This also give access to player money @@ -283,8 +287,10 @@ public: uint16 getItemSlotId(CDBCtrlSheet *ctrl); uint16 getItemSlotId(const std::string &itemDb, uint slotIndex); const CClientItemInfo &getItemInfo(uint slotId) const; +#ifdef RYZOM_FORGE // get item info from cache const CClientItemInfo *getItemInfoCache(uint32 serial, uint32 createTime) const; +#endif uint getItemSheetForSlotId(uint slotId) const; // Returns true if the item info is already in slot cache bool isItemInfoAvailable(uint slotId) const; @@ -299,7 +305,9 @@ public: void onRefreshItemInfoVersion(uint16 slotId, uint8 infoVersion); // Log for debug void debugItemInfoWaiters(); +#ifdef RYZOM_FORGE void debugItemInfoCache() const; +#endif void sortBag(); @@ -342,8 +350,10 @@ private: CDBCtrlSheet *DNDCurrentItem; // ItemExtraInfo management. +#ifdef RYZOM_FORGE std::string _ItemInfoCacheFilename; CItemInfoCache _ItemInfoCache; +#endif typedef std::map TItemInfoMap; TItemInfoMap _ItemInfoMap; typedef std::list TItemInfoWaiters;