1 // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
2 // Copyright (C) 2010-2019 Winch Gate Property Limited
4 // This source file has been modified by the following contributors:
5 // Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) <dfighter1985@gmail.com>
7 // This program is free software: you can redistribute it and/or modify
8 // it under the terms of the GNU Affero General Public License as
9 // published by the Free Software Foundation, either version 3 of the
10 // License, or (at your option) any later version.
12 // This program is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU Affero General Public License for more details.
17 // You should have received a copy of the GNU Affero General Public License
18 // along with this program. If not, see <http://www.gnu.org/licenses/>.
22 #ifndef RY_INVENTORY_MANAGER_H
23 #define RY_INVENTORY_MANAGER_H
25 #include "nel/misc/cdb_leaf.h"
26 #include "dbgroup_list_sheet_text.h"
27 #include "dbgroup_list_sheet.h"
28 #include "game_share/item_infos.h"
29 #include "game_share/temp_inventory_mode.h"
30 #include "game_share/inventories.h"
31 #include "game_share/bot_chat_types.h"
37 class IItermInfoWaiter
;
39 const uint MAX_TEMPINV_ENTRIES
= INVENTORIES::NbTempInvSlots
;
40 const uint MAX_BAGINV_ENTRIES
= INVENTORIES::NbBagSlots
;
41 const uint MAX_HANDINV_ENTRIES
= 2;
42 const uint MAX_EQUIPINV_ENTRIES
= 19;
43 const uint MAX_ANIMALINV_ENTRIES
= INVENTORIES::NbPackerSlots
;
44 const uint MAX_GUILDINV_ENTRIES
= INVENTORIES::NbGuildSlots
;
45 const uint MAX_ROOMINV_ENTRIES
= INVENTORIES::NbRoomSlots
;
46 // This is the personal player inventory max (bag and animal)
47 const uint MAX_PLAYER_INV_ENTRIES
= std::max(MAX_BAGINV_ENTRIES
, MAX_ANIMALINV_ENTRIES
);
48 // db path for the local inventory
49 #define LOCAL_INVENTORY "LOCAL:INVENTORY"
50 #define SERVER_INVENTORY "SERVER:INVENTORY"
53 // ***************************************************************************
54 /** Image of an item in the database
55 * Unavailable fields are set to NULL
56 * \author Nicolas Vizerie
57 * \author Nevrax France
58 * \date September 2003
63 NLMISC::CCDBNodeLeaf
*Sheet
;
64 NLMISC::CCDBNodeLeaf
*Quality
;
65 NLMISC::CCDBNodeLeaf
*Quantity
;
66 NLMISC::CCDBNodeLeaf
*CreateTime
;
67 NLMISC::CCDBNodeLeaf
*Serial
;
68 NLMISC::CCDBNodeLeaf
*UserColor
;
69 NLMISC::CCDBNodeLeaf
*Price
;
70 NLMISC::CCDBNodeLeaf
*Weight
;
71 NLMISC::CCDBNodeLeaf
*NameId
;
72 NLMISC::CCDBNodeLeaf
*InfoVersion
;
73 NLMISC::CCDBNodeLeaf
*ResaleFlag
;
78 // build from a branch
79 void build(NLMISC::CCDBNodeBranch
*branch
);
80 uint64
getItemId() const;
81 // shortcuts to avoid NULL pointer tests
82 uint32
getSheetID() const { return (uint32
) (Sheet
? Sheet
->getValue32() : 0); }
83 uint16
getQuality() const { return (uint16
) (Quality
? Quality
->getValue16() : 0); }
84 uint16
getQuantity() const { return (uint16
) (Quantity
? Quantity
->getValue16() : 0); }
85 uint32
getCreateTime() const { return (uint32
) (CreateTime
? CreateTime
->getValue32() : 0); }
86 uint32
getSerial() const { return (uint32
) (Serial
? Serial
->getValue32() : 0); }
87 uint8
getUserColor() const { return (uint8
) (UserColor
? UserColor
->getValue16() : 0); }
88 uint32
getPrice() const { return (uint32
) (Price
? Price
->getValue32() : 0); }
89 uint32
getWeight() const { return (uint32
) (Weight
? Weight
->getValue32() : 0); }
90 uint32
getNameId() const { return (uint32
) (NameId
? NameId
->getValue32() : 0); }
91 uint8
getInfoVersion() const { return (uint8
) (InfoVersion
? (uint8
) InfoVersion
->getValue8() : 0); }
92 uint8
getResaleFlag() const { return (uint8
) (ResaleFlag
? (uint8
) ResaleFlag
->getValue8() : 0); }
93 bool getLockedByOwner() const { return (bool) (ResaleFlag
? (ResaleFlag
->getValue8() == BOTCHATTYPE::ResaleKOLockedByOwner
) : false); }
95 void setSheetID(uint32 si
) { if (Sheet
) Sheet
->setValue32((sint32
) si
); }
96 void setQuality(uint16 quality
) { if (Quality
) Quality
->setValue16((sint16
) quality
); }
97 void setQuantity(uint16 quantity
) { if (Quantity
) Quantity
->setValue16((sint16
) quantity
); }
98 void setCreateTime(uint32 create_time
) { if (CreateTime
) CreateTime
->setValue32((sint32
) create_time
); }
99 void setSerial(uint32 serial
) { if (Serial
) Serial
->setValue32((sint32
) serial
); }
100 void setUserColor(uint8 uc
) { if (UserColor
) UserColor
->setValue8((sint8
) uc
); }
101 void setPrice(uint32 price
) { if (Price
) Price
->setValue32((sint32
) price
); }
102 void setWeight(uint32 wgt
) { if (Weight
) Weight
->setValue32((sint32
) wgt
); }
103 void setNameId(uint32 nid
) { if (NameId
) NameId
->setValue32((sint32
) nid
); }
104 void setInfoVersion(uint8 iv
) { if (InfoVersion
) InfoVersion
->setValue8((sint8
) iv
); }
105 void setResaleFlag(uint8 resale
) { if (ResaleFlag
) ResaleFlag
->setValue8(resale
); }
109 // ***************************************************************************
110 /** Extra Item Info retrieved via ItemInfo system
112 class CClientItemInfo
: public CItemInfos
116 uint16 InfoVersionFromMsg
;
117 uint16 InfoVersionFromSlot
;
118 // This is the InfoVersionFromSlot when last request was sent to server
119 uint16 InfoVersionSlotServerWaiting
;
121 // Used to track cache age (reset on use, +1 on every save)
126 InfoVersionFromMsg
= 0;
127 InfoVersionFromSlot
= 0;
128 InfoVersionSlotServerWaiting
= 0;
132 /// Set InfoVersion from Info message (info requested by the player)
133 void readFromImpulse(const CItemInfos
&itemInfo
);
135 /// Set InfoVersion from a refresh message (to prevent missing a change when InfoVersion in the database has reached a complete cycle)
136 void refreshInfoVersion(uint8 infoVersion
) { InfoVersionFromMsg
= infoVersion
; }
142 void load(const std::string
&filename
);
143 void save(const std::string
&filename
);
144 void serial(NLMISC::IStream
&s
);
146 // retrieve pointer to item info or null if error
147 const CClientItemInfo
*getItemInfo(uint32 serial
, uint32 createTime
) const;
148 const CClientItemInfo
*getItemInfo(uint64 itemId
) const;
150 // set/update item info in cache
151 void readFromImpulse(uint64 itemId
, CItemInfos itemInfo
);
152 void debugItemInfoCache() const;
155 typedef std::map
<uint64
, CClientItemInfo
> TItemInfoCacheMap
;
156 TItemInfoCacheMap _ItemInfoCacheMap
;
159 // ***************************************************************************
160 /** This manager gives direct access to inventory slots (bag, temporary inventory, hands, and equip inventory)
161 * This also give access to player money
162 * \author Nicolas Vizerie
163 * \author Nevrax France
164 * \date September 2003
166 class CInventoryManager
169 // db path for all the inventories (without the SERVER: prefix)
170 static const std::string InventoryDBs
[];
171 static const uint InventoryIndexes
[];
172 static const uint NumInventories
;
175 // get the unique instance of that manager
176 static CInventoryManager
*getInstance();
179 static void releaseInstance();
181 /** Init the manager. This should be done after the local database has been created,
182 * because shortcuts pointers are made to the db leaf that represents the inventory.
183 * Interface manager should also have been created
187 // get item of bag (local inventory)
188 CItemImage
&getBagItem(uint index
);
189 // get temporary item (local inventory)
190 CItemImage
&getTempItem(uint index
);
191 // get hand item (local inventory) can be NULL (nothing in the hand)
192 CItemImage
*getHandItem(uint index
);
193 // get equip item (local inventory)
194 CItemImage
*getEquipItem(uint index
);
195 // get hand item (local inventory)
196 CDBCtrlSheet
*getHandSheet(uint index
);
197 // get equip item (local inventory)
198 CDBCtrlSheet
*getEquipSheet(uint index
);
200 uint64
getMoney() const;
201 void setMoney(uint64 value
);
202 // get item of pack animal (local inventory). beastIndex ranges from 0 to MAX_INVENTORY_ANIMAL-1
203 CItemImage
&getPAItem(uint beastIndex
, uint index
);
204 // get the item Image for the given inventory. assert if bad inventory
205 CItemImage
&getLocalItem(uint inv
, uint index
);
208 // get item of bag (local inventory)
209 CItemImage
&getServerBagItem(uint index
);
210 const CItemImage
&getServerBagItem(uint index
) const;
211 // get temporary item (local inventory)
212 CItemImage
&getServerTempItem(uint index
);
213 const CItemImage
&getServerTempItem(uint index
) const;
214 // get hand item (local inventory)
215 CItemImage
*getServerHandItem(uint index
);
216 // get equip item (local inventory)
217 CItemImage
*getServerEquipItem(uint index
);
218 // get/set server money
219 uint64
getServerMoney() const;
220 void setServerMoney(uint64 value
);
221 // get item of pack animal (server inventory). beastIndex ranges from 0 to MAX_INVENTORY_ANIMAL-1
222 CItemImage
&getServerPAItem(uint beastIndex
, uint index
);
223 const CItemImage
&getServerPAItem(uint beastIndex
, uint index
) const;
224 // get the item Image for the given inventory. assert if bad inventory
225 CItemImage
&getServerItem(uint inv
, uint index
);
226 // get the item Image for the given slotId or NULL if bad
227 const CItemImage
*getServerItem(uint slotId
) const;
229 // Drag'n'Drop Management
230 enum TFrom
{ Slot
, TextList
, IconList
, Nowhere
};
231 void beginDrag(CDBCtrlSheet
*pCS
, TFrom eFromWhere
);
233 bool isDragging() { return DNDCurrentItem
!= NULL
; }
234 // Is the dragged sheet comes from inventory list
235 bool isDraggingFromTextList() { return DNDFrom
== TextList
; }
236 bool isDraggingFromIconList() { return DNDFrom
== IconList
; }
237 bool isDraggingFromSlot() { return DNDFrom
== Slot
; }
238 CDBCtrlSheet
*getDraggedItem() { return DNDCurrentItem
; }
240 // Get from an interface object the corresponding database entry (ie: LOCAL:INVENTORY:EQUIP:4)
241 std::string
getDBIndexPath(CDBCtrlSheet
*);
242 // Check if an item is a 2 hand item
243 bool is2HandItem(uint32 sheetID
);
244 // Check if an item is a melee weapon item
245 bool isMeleeWeaponItem(uint32 sheetID
);
246 // Check if an item is a range weapon item
247 bool isRangeWeaponItem(uint32 sheetID
);
248 bool isDagger(uint32 sheetID
);
249 bool isSword(uint32 sheetID
);
250 // Check if an item is a forage tool
251 bool isForageToolItem(uint32 sheetID
);
252 // Get the Hand item sheet
253 uint32
getRightHandItemSheet() const { return getHandItemSheet(true); }
254 uint32
getLeftHandItemSheet() const { return getHandItemSheet(false); }
255 bool isLeftHandItemCompatibleWithRightHandItem(uint32 leftHandSheet
, uint32 rightHandSheet
, uint32 lastRightHandSheet
);
259 // lock an item in the bag because it is weared (done on interface elements of the 2 lists (text and icons))
260 void wearBagItem(sint32 bagEntryIndex
);
261 // unlock an item in the bag because it is unweared
262 void unwearBagItem(sint32 bagEntryIndex
);
263 // check if an item in the bag is weared or not
264 bool isBagItemWeared(sint32 bagEntryIndex
);
265 // Equip a part of the player with a bag entry (the params are path in the database)
266 // ie : bagPath = LOCAL:INVENTORY:BAG:0 and invPath = LOCAL:INVENTORY:HAND:0
267 void equip(const std::string
&bagPath
, const std::string
&invPath
);
268 // UnEquip a part of the player (same format as equip method)
269 void unequip(const std::string
&invPath
);
270 // auto equip an item (given by index) from the bag (return true if equipped)
271 bool autoEquip(sint bagEntryIndex
, bool allowReplace
);
273 void dropOrDestroyItem(CDBCtrlSheet
*item
, NLMISC::CBitMemStream
&out
, uint16 quantity
);
274 // check all equipement slot and reset if they point to an invalid bag index
275 void checkIndexInBagIntegrity();
277 // Get the current bag bulk
278 static double getBranchBulk(const std::string
&basePath
, uint16 startItemIndex
, uint16 numItems
);
279 // Get the number of used and max slots
280 static void getBranchSlotCounts(const std::string
&basePath
, uint
& nbUsedSlots
, uint
& nbMaxSlots
);
281 // 0 bag, 1 - 6 pack animal 1 to 5, 7 temp inv
282 double getBagBulk(uint32 inventoryIndex
);
283 double getMaxBagBulk(uint32 inventoryIndex
);
284 double getItemBulk(uint32 sheetID
);
285 // item should have :SHEET and :QUANTITY
286 bool isSpaceInAllBagsForItem(CDBCtrlSheet
*item
);
287 bool isSpaceInBagForItem(CDBCtrlSheet
*item
, uint32 quantity
, uint32 bagId
);
289 // ItemExtraInfo management. From each slot is a unique uint16
290 uint16
getItemSlotId(CDBCtrlSheet
*ctrl
);
291 uint16
getItemSlotId(const std::string
&itemDb
, uint slotIndex
);
292 const CClientItemInfo
&getItemInfo(uint slotId
) const;
293 // get item info from cache
294 const CClientItemInfo
*getItemInfoCache(uint32 serial
, uint32 createTime
) const;
295 uint
getItemSheetForSlotId(uint slotId
) const;
296 // Returns true if the item info is already in slot cache
297 bool isItemInfoAvailable(uint slotId
) const;
298 // Returns true if the item info version already matches
299 bool isItemInfoUpToDate(uint slotId
) const;
300 // Add a Waiter on ItemInfo (ItemHelp opening). no-op if here, but reorder (returns true if the version already matches or if waiter is NULL)
301 void addItemInfoWaiter(IItemInfoWaiter
*waiter
);
302 // remove a Waiter on ItemInfo (ItemHelp closing). no-op if not here. NB: no delete
303 void removeItemInfoWaiter(IItemInfoWaiter
*waiter
);
305 void onReceiveItemInfo(const CItemInfos
&itemInfo
);
306 void onRefreshItemInfoVersion(uint16 slotId
, uint8 infoVersion
);
308 void debugItemInfoWaiters();
309 void debugItemInfoCache() const;
313 // Animal Inventories
314 // Is the inventory present? if true, it may still not be available for modification (eg: animal too far)
315 bool isInventoryPresent(INVENTORIES::TInventory invId
);
316 // Is the inventory present and available for modification?
317 bool isInventoryAvailable(INVENTORIES::TInventory invId
);
318 // Is the inventory empty or not present?
319 bool isInventoryEmpty (INVENTORIES::TInventory invId
);
322 enum TInvType
{ InvBag
, InvPA0
, InvPA1
, InvPA2
, InvPA3
, InvPA4
, InvPA5
, InvPA6
, InvGuild
, InvRoom
, InvUnknown
};
323 static TInvType
invTypeFromString(const std::string
&str
);
325 // inventory and slot from slotId
326 void getSlotInvIndex(uint slotId
, uint
&inv
, uint
&index
) const;
331 CItemImage Bag
[MAX_BAGINV_ENTRIES
];
332 CItemImage TempInv
[MAX_TEMPINV_ENTRIES
];
333 sint32 Hands
[MAX_HANDINV_ENTRIES
];
334 CDBCtrlSheet
*UIHands
[MAX_HANDINV_ENTRIES
];
335 sint32 Equip
[MAX_EQUIPINV_ENTRIES
];
336 CDBCtrlSheet
*UIEquip
[MAX_EQUIPINV_ENTRIES
];
337 CDBCtrlSheet
*UIEquip2
[MAX_EQUIPINV_ENTRIES
];
338 NLMISC::CCDBNodeLeaf
*Money
;
339 CItemImage PAInv
[MAX_INVENTORY_ANIMAL
][MAX_ANIMALINV_ENTRIES
];
341 CItemImage ServerBag
[MAX_BAGINV_ENTRIES
];
342 CItemImage ServerTempInv
[MAX_TEMPINV_ENTRIES
];
343 sint32 ServerHands
[MAX_HANDINV_ENTRIES
];
344 sint32 ServerEquip
[MAX_EQUIPINV_ENTRIES
];
345 NLMISC::CCDBNodeLeaf
*ServerMoney
;
346 CItemImage ServerPAInv
[MAX_INVENTORY_ANIMAL
][MAX_ANIMALINV_ENTRIES
];
349 CDBCtrlSheet
*DNDCurrentItem
;
351 // ItemExtraInfo management.
352 std::string _ItemInfoCacheFilename
;
353 CItemInfoCache _ItemInfoCache
;
354 typedef std::map
<uint
, CClientItemInfo
> TItemInfoMap
;
355 TItemInfoMap _ItemInfoMap
;
356 typedef std::list
<IItemInfoWaiter
*> TItemInfoWaiters
;
357 TItemInfoWaiters _ItemInfoWaiters
;
359 // Cache to know if bag is locked or not, because of item worn
360 bool BagItemEquipped
[MAX_BAGINV_ENTRIES
];
363 /// Singleton's instance
364 static CInventoryManager
*_Instance
;
369 ~CInventoryManager();
371 // init an array of items from a db branch
372 void initItemArray(const std::string
&dbBranchName
, CItemImage
*dest
, uint numItems
);
373 // init array of int that represents indirection to the bag
374 void initIndirection(const std::string
&dbbranch
, sint32
*indices
, sint32 nbIndex
, bool putObs
= false);
376 // Get the Hand item sheet
377 uint32
getHandItemSheet( bool rightHand
) const;
379 // ItemExtraInfo management.
380 void onTradeChangeSession();
381 void onReceiveItemSheet(NLMISC::ICDBNode
* node
);
382 void onReceiveItemInfoSlotVersion(NLMISC::ICDBNode
* node
);
383 void updateItemInfoQueue();
384 void updateItemInfoWaiters(uint slotId
);
385 class CItemInfoSlotVersionObs
: public NLMISC::ICDBNode::IPropertyObserver
388 virtual void update(NLMISC::ICDBNode
* node
);
390 class CItemSheetObs
: public NLMISC::ICDBNode::IPropertyObserver
393 virtual void update(NLMISC::ICDBNode
* node
);
395 class CItemInfoTradeObs
: public NLMISC::ICDBNode::IPropertyObserver
398 virtual void update(NLMISC::ICDBNode
* node
);
400 CItemInfoTradeObs _DBTradeInfoObs
;
401 CItemInfoSlotVersionObs _DBInfoSlotVersionObs
;
402 CItemSheetObs _DBItemSheetObs
;
403 friend class CItemInfoTradeObs
;
404 friend class CItemInfoSlotVersionObs
;
405 friend class CItemSheetObs
;
407 // Equipment observer
408 class CDBEquipObs
: public NLMISC::ICDBNode::IPropertyObserver
411 virtual void update(NLMISC::ICDBNode
* node
);
413 CDBEquipObs _DBEquipObs
;
414 friend class CDBEquipObs
;
416 // Bag observer for auto equipment (put only on the sheet leaf)
417 class CDBBagObs
: public NLMISC::ICDBNode::IPropertyObserver
420 virtual void update(NLMISC::ICDBNode
* node
);
424 // shortcut to access the inventory
425 inline CInventoryManager
&getInventory() { return *CInventoryManager::getInstance(); }
428 // ***************************************************************************
430 * class used to manage the temporary inventory
431 * \author Matthieu 'TrapII' Besson
432 * \author Nevrax France
435 class CTempInvManager
440 /// The singleton 's instance
441 static CTempInvManager
* getInstance()
444 _Instance
= new CTempInvManager
;
449 virtual ~CTempInvManager();
452 static void releaseInstance();
454 // Called internally by the observer on the DB
457 // Called internally by the type observer on the DB
460 // Called internally by the forage observer on the DB
461 void updateForageQQ( uint whichOne
);
463 // Launch temp_inv waiting for some incoming sheet (reset local DB)
464 void open(TEMP_INV_MODE::TInventoryMode m
);
466 // Close temporary inventory (reset local DB)
471 TEMP_INV_MODE::TInventoryMode
getMode() { return _Mode
; }
478 // Database management stuff
479 class CDBObs
: public NLMISC::ICDBNode::IPropertyObserver
482 virtual void update(NLMISC::ICDBNode
* node
);
485 class CDBObsType
: public NLMISC::ICDBNode::IPropertyObserver
488 virtual void update(NLMISC::ICDBNode
* node
);
491 // Database management stuff, specialized for forage progress
492 class CDBForageQQObs
: public NLMISC::ICDBNode::IPropertyObserver
495 CDBForageQQObs() : NLMISC::ICDBNode::IPropertyObserver(), WhichOne(~0), FullValue(0.0f
) {}
496 virtual void update(NLMISC::ICDBNode
*node
);
502 CDBObsType _DBObsType
;
503 CDBForageQQObs _DBForageQQObs
[2];
506 /// Singleton's instance
507 static CTempInvManager
* _Instance
;
509 TEMP_INV_MODE::TInventoryMode _Mode
;
512 // ***************************************************************************
515 * \author Matthieu 'TrapII' Besson
516 * \author Nevrax France
521 CDBGroupListSheetText::CSheetChild
*SheetText
;
522 CDBGroupListSheet::CSheetChild
*SheetIcon
;
524 bool operator < (const SSortStruct
&o
) const { return Pos
< o
.Pos
; }
527 // Helper to sort with only one way for bag and trade
528 void initStructForItemSort(std::vector
<SSortStruct
>&vTemp
, sint32 sheetId
, sint32 quality
, sint32 indexInList
, sint32 indexInDB
);
531 // ***************************************************************************
533 * For Bag Management (shared structure between 2 lists (text and icon))
534 * \author Matthieu 'TrapII' Besson
535 * \author Nevrax France
540 CInventoryManager::TInvType InvType
;
542 NLMISC::CCDBNodeLeaf
*DbFilterArmor
;
543 NLMISC::CCDBNodeLeaf
*DbFilterWeapon
;
544 NLMISC::CCDBNodeLeaf
*DbFilterTool
;
545 NLMISC::CCDBNodeLeaf
*DbFilterPet
;
546 NLMISC::CCDBNodeLeaf
*DbFilterMP
;
547 NLMISC::CCDBNodeLeaf
*DbFilterMissMP
;
548 NLMISC::CCDBNodeLeaf
*DbFilterTP
;
550 bool LastDbFilterArmor
;
551 bool LastDbFilterWeapon
;
552 bool LastDbFilterTool
;
553 bool LastDbFilterPet
;
555 bool LastDbFilterMissMP
;
558 bool SearchFilterChanged
;
559 uint16 SearchQualityMin
;
560 uint16 SearchQualityMax
;
561 std::vector
<std::string
> SearchFilter
;
563 // -----------------------
566 InvType
= CInventoryManager::InvUnknown
;
567 DbFilterArmor
= DbFilterWeapon
= DbFilterTool
= DbFilterPet
= DbFilterMP
= DbFilterMissMP
= DbFilterTP
= NULL
;
568 LastDbFilterArmor
= LastDbFilterWeapon
= LastDbFilterTool
= LastDbFilterPet
= LastDbFilterMP
= LastDbFilterMissMP
= LastDbFilterTP
= false;
569 SearchFilterChanged
= false;
570 SearchQualityMin
= 0;
571 SearchQualityMax
= 999;
574 bool parse (xmlNodePtr cur
, CInterfaceGroup
*parentGroup
);
576 bool isSomethingChanged(); // From last call ?
578 bool isSearchFilterChanged() const { return SearchFilterChanged
; }
579 void setSearchFilter(const std::string
&s
);
581 bool getFilterArmor() const
583 if (DbFilterArmor
== NULL
) return true;
584 return (DbFilterArmor
->getValue8()!=0);
587 bool getFilterWeapon() const
589 if (DbFilterWeapon
== NULL
) return true;
590 return (DbFilterWeapon
->getValue8()!=0);
593 bool getFilterTool() const
595 if (DbFilterTool
== NULL
) return true;
596 return (DbFilterTool
->getValue8()!=0);
599 bool getFilterPet() const
601 if (DbFilterPet
== NULL
) return true;
602 return (DbFilterPet
->getValue8()!=0);
605 bool getFilterMP() const
607 if (DbFilterMP
== NULL
) return true;
608 return (DbFilterMP
->getValue8()!=0);
611 bool getFilterMissMP() const
613 if (DbFilterMissMP
== NULL
) return true;
614 return (DbFilterMissMP
->getValue8()!=0);
617 bool getFilterTP() const
619 if (DbFilterTP
== NULL
) return true;
620 return (DbFilterTP
->getValue8() != 0);
623 // Return true if the sheet can be displayed due to filters
624 bool canDisplay(CDBCtrlSheet
*pCS
) const;
628 // ***************************************************************************
630 * Special list for bag (Text list)
631 * \author Matthieu 'TrapII' Besson
632 * \author Nevrax France
633 * \date September 2003
635 class CDBGroupListSheetBag
: public CDBGroupListSheetText
638 CDBGroupListSheetBag(const TCtorParam
¶m
)
639 : CDBGroupListSheetText(param
)
643 virtual bool parse (xmlNodePtr cur
, CInterfaceGroup
*parentGroup
);
644 virtual void checkCoords ();
646 //////////////////////////////////////////////////////////////////////////
649 struct CSheetChildBag
: public CDBGroupListSheetText::CSheetChild
651 // quality is important for ItemRequirement color
653 CInterfaceProperty CurrentQuality
;
655 virtual void updateViewText(CDBGroupListSheetText
*pFather
);
656 virtual bool isSheetValid(CDBGroupListSheetText
*pFather
); // To filter
657 virtual void init(CDBGroupListSheetText
*pFather
, uint index
);
658 virtual bool isInvalidated(CDBGroupListSheetText
*pFather
);
659 virtual void update(CDBGroupListSheetText
*pFather
);
661 CSheetChildBag() : CSheetChild()
667 virtual CSheetChild
*createSheetChild() { return new CSheetChildBag
; }
668 virtual bool swapable () const {return true;}
669 virtual void onSwap (sint nDraggedSheet
, sint nDroppedSheet
);
672 CInventoryManager::TInvType
getInvType() const { return _BO
.InvType
; }
674 // Return true if the sheet can be displayed due to filters
675 bool canDisplay(CDBCtrlSheet
*pCS
) { return _BO
.canDisplay(pCS
); }
677 void setSearchFilter(const std::string
&s
) { _BO
.setSearchFilter(s
); }
684 // ***************************************************************************
686 * Special list for bag (The icon list)
687 * \author Matthieu 'TrapII' Besson
688 * \author Nevrax France
689 * \date September 2003
691 class CDBGroupIconListBag
: public CDBGroupListSheet
694 CDBGroupIconListBag(const TCtorParam
¶m
)
695 : CDBGroupListSheet(param
)
699 virtual bool parse (xmlNodePtr cur
, CInterfaceGroup
*parentGroup
);
700 virtual void checkCoords ();
702 virtual CSheetChild
*createSheetChild() { return new CSheetChildBag
; }
705 CInventoryManager::TInvType
getInvType() const { return _BO
.InvType
; }
707 // Return true if the sheet can be displayed due to filters
708 bool canDisplay(CDBCtrlSheet
*pCS
) const { return _BO
.canDisplay(pCS
); }
710 void setSearchFilter(const std::string
&s
) { _BO
.setSearchFilter(s
); }
712 //////////////////////////////////////////////////////////////////////////
715 struct CSheetChildBag
: public CDBGroupListSheet::CSheetChild
717 virtual bool isSheetValid(CDBGroupListSheet
*pFather
);
726 // ***************************************************************************
728 * Special list for filtering items according to the CLM (control launching modal)
729 * \author Lionel Berenguier
731 class CDBGroupListSheetFilterCLMSlot
: public CDBGroupListSheet
734 CDBGroupListSheetFilterCLMSlot (const TCtorParam
¶m
)
735 : CDBGroupListSheet(param
)
738 virtual CSheetChild
*createSheetChild() { return new CSheetChildFilter
; }
741 struct CSheetChildFilter
: public CDBGroupListSheet::CSheetChild
743 virtual bool isSheetValid(CDBGroupListSheet
*pFather
);
748 // ***************************************************************************
750 * Special list for filtering items which are exchangeable only
751 * \author Lionel Berenguier
753 class CDBGroupListSheetFilterExchangeable
: public CDBGroupListSheet
756 CDBGroupListSheetFilterExchangeable (const TCtorParam
¶m
)
757 : CDBGroupListSheet(param
)
760 virtual CSheetChild
*createSheetChild() { return new CSheetChildFilter
; }
763 struct CSheetChildFilter
: public CDBGroupListSheet::CSheetChild
765 virtual bool isSheetValid(CDBGroupListSheet
*pFather
);
769 bool parse (xmlNodePtr cur
, CInterfaceGroup
*parentGroup
);
776 // ***************************************************************************
778 // ***************************************************************************
780 #define WIN_TEMPINV "ui:interface:temp_inventory"
781 #define VIEW_TEMPINV_TITLE "ui:interface:temp_inventory:title"
783 #define WIN_TEMPINV_TITLE_LOOT "uiTILoot"
784 #define WIN_TEMPINV_TITLE_QUARTERING "uiTIQuartering"
785 #define WIN_TEMPINV_TITLE_FORAGING "uiTIForaging"
786 #define WIN_TEMPINV_TITLE_FORAGE_RESULT "uiTIForageResult"
787 #define WIN_TEMPINV_TITLE_BAGFULL "uiTIBagFull"
788 #define WIN_TEMPINV_TITLE_CRAFT "uiTICraft"
789 #define WIN_TEMPINV_TITLE_MISSIONREWARD "uiTIMissionItem" // in fact not only for rewards
790 #define WIN_TEMPINV_TITLE_CRYSTALLIZE "uiTICrystallize"
792 #define WIN_TEMPINV_TITLE_ERROR "uiTIError"
794 #define WIN_TEMPINV_TITLE_WAIT_LOOT "uiTIWaitLoot"
795 #define WIN_TEMPINV_TITLE_WAIT_QUARTERING "uiTIWaitQuartering"
796 #define WIN_TEMPINV_TITLE_WAIT_FORAGING "uiTIWaitForaging"
797 #define WIN_TEMPINV_TITLE_WAIT_BAGFULL "uiTIWaitBagFull"
798 #define WIN_TEMPINV_TITLE_WAIT_CRAFT "uiTIWaitCraft"
799 #define WIN_TEMPINV_TITLE_WAIT_MISSIONREWARD "uiTIWaitMissionItem"
800 #define WIN_TEMPINV_TITLE_WAIT_CRYSTALLIZE "uiTIWaitCrystallize"
802 #define WIN_TEMPINV_TITLE_WAIT_ERROR "uiTIError"
804 #define LIST_BAG_TEXT "ui:interface:inventory:content:bag:iil:bag_list"
805 #define LIST_BAG_ICONS "ui:interface:inventory:content:bag:iil:bag_icons"
807 #define LIST_ROOM_TEXT "ui:interface:inv_room:content:iil:bag_list"
808 #define LIST_ROOM_ICONS "ui:interface:inv_room:content:iil:bag_icons"
810 #define LIST_GUILD_TEXT "ui:interface:inv_guild:content:iil:bag_list"
811 #define LIST_GUILD_ICONS "ui:interface:inv_guild:content:iil:bag_icons"
813 #define LIST_PA0_TEXT "ui:interface:inv_pa0:content:iil:bag_list"
814 #define LIST_PA0_ICONS "ui:interface:inv_pa0:content:iil:bag_icons"
816 #define LIST_PA1_TEXT "ui:interface:inv_pa1:content:iil:bag_list"
817 #define LIST_PA1_ICONS "ui:interface:inv_pa1:content:iil:bag_icons"
819 #define LIST_PA2_TEXT "ui:interface:inv_pa2:content:iil:bag_list"
820 #define LIST_PA2_ICONS "ui:interface:inv_pa2:content:iil:bag_icons"
822 #define LIST_PA3_TEXT "ui:interface:inv_pa3:content:iil:bag_list"
823 #define LIST_PA3_ICONS "ui:interface:inv_pa3:content:iil:bag_icons"
825 // Theorically never used
826 #define LIST_BAG2_TEXT "ui:interface:inv_bag:content:iil:bag_list"
827 #define LIST_BAG2_ICONS "ui:interface:inv_bag:content:iil:bag_icons"
829 #define MENU_BAG_ITEM "ui:interface:item_menu_in_bag"
831 #define CTRL_HAND_RIGHT "ui:interface:gestionsets:hands:handr"
832 #define CTRL_HAND_LEFT "ui:interface:gestionsets:hands:handl"
833 #define CTRL_HAND_LEFT_2HAND "ui:interface:gestionsets:hands:handl_2h"
834 #define CTRL_HAND_LEFT_AMMO "ui:interface:gestionsets:hands:handl_ammo"
836 #define CTRL_JEWEL_EARING_LEFT "ui:interface:inv_equip:content:equip:jewelry:earing_l"
837 #define CTRL_JEWEL_BRACELET_LEFT "ui:interface:inv_equip:content:equip:jewelry:bracelet_l"
838 #define CTRL_JEWEL_RING_LEFT "ui:interface:inv_equip:content:equip:jewelry:ring_l"
839 #define CTRL_JEWEL_ANKLET_LEFT "ui:interface:inv_equip:content:equip:jewelry:anklet_l"
840 #define CTRL_JEWEL_EARING_RIGHT "ui:interface:inv_equip:content:equip:jewelry:earing_r"
841 #define CTRL_JEWEL_BRACELET_RIGHT "ui:interface:inv_equip:content:equip:jewelry:bracelet_r"
842 #define CTRL_JEWEL_RING_RIGHT "ui:interface:inv_equip:content:equip:jewelry:ring_r"
843 #define CTRL_JEWEL_ANKLET_RIGHT "ui:interface:inv_equip:content:equip:jewelry:anklet_r"
844 #define CTRL_JEWEL_HEADDRESS "ui:interface:inv_equip:content:equip:jewelry:headdress"
845 #define CTRL_JEWEL_NECK "ui:interface:inv_equip:content:equip:jewelry:neck"
847 #define CTRL_ARMOR_HEAD "ui:interface:inv_equip:content:equip:armors:head"
848 #define CTRL_ARMOR_CHEST "ui:interface:inv_equip:content:equip:armors:chest"
849 #define CTRL_ARMOR_LEGS "ui:interface:inv_equip:content:equip:armors:legs"
850 #define CTRL_ARMOR_FEET "ui:interface:inv_equip:content:equip:armors:feet"
851 #define CTRL_ARMOR_ARMS "ui:interface:inv_equip:content:equip:armors:arms"
852 #define CTRL_ARMOR_HANDS "ui:interface:inv_equip:content:equip:armors:hands"
854 #define CTRL_JEWL2_EARING_LEFT "ui:interface:inventory:content:equip:jewelry:earing_l"
855 #define CTRL_JEWL2_BRACELET_LEFT "ui:interface:inventory:content:equip:jewelry:bracelet_l"
856 #define CTRL_JEWL2_RING_LEFT "ui:interface:inventory:content:equip:jewelry:ring_l"
857 #define CTRL_JEWL2_ANKLET_LEFT "ui:interface:inventory:content:equip:jewelry:anklet_l"
858 #define CTRL_JEWL2_EARING_RIGHT "ui:interface:inventory:content:equip:jewelry:earing_r"
859 #define CTRL_JEWL2_BRACELET_RIGHT "ui:interface:inventory:content:equip:jewelry:bracelet_r"
860 #define CTRL_JEWL2_RING_RIGHT "ui:interface:inventory:content:equip:jewelry:ring_r"
861 #define CTRL_JEWL2_ANKLET_RIGHT "ui:interface:inventory:content:equip:jewelry:anklet_r"
862 #define CTRL_JEWL2_HEADDRESS "ui:interface:inventory:content:equip:jewelry:headdress"
863 #define CTRL_JEWL2_NECK "ui:interface:inventory:content:equip:jewelry:neck"
865 #define CTRL_ARMR2_HEAD "ui:interface:inventory:content:equip:armors:head"
866 #define CTRL_ARMR2_CHEST "ui:interface:inventory:content:equip:armors:chest"
867 #define CTRL_ARMR2_LEGS "ui:interface:inventory:content:equip:armors:legs"
868 #define CTRL_ARMR2_FEET "ui:interface:inventory:content:equip:armors:feet"
869 #define CTRL_ARMR2_ARMS "ui:interface:inventory:content:equip:armors:arms"
870 #define CTRL_ARMR2_HANDS "ui:interface:inventory:content:equip:armors:hands"
872 #endif // RY_INVENTORY_MANAGER_H
874 /* End of inventory_manager.h */