Linux multi-monitor fullscreen support
[ryzomcore.git] / ryzom / common / src / game_share / inventories.cpp
blobd6b4b5ba9d2a77ef14981329e3bec73386797f2e
1 // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
2 // Copyright (C) 2010-2018 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/>.
19 #include "stdpch.h"
20 #include "inventories.h"
21 #include "nel/misc/string_conversion.h"
23 using namespace std;
24 using namespace NLMISC;
26 namespace INVENTORIES
28 uint32 TItemId::_LastCreation = 0;
29 uint32 TItemId::_NextSerialNumber = 0;
32 NL_BEGIN_STRING_CONVERSION_TABLE(TInventory)
33 NL_STRING_CONVERSION_TABLE_ENTRY(handling)
34 NL_STRING_CONVERSION_TABLE_ENTRY(temporary)
35 NL_STRING_CONVERSION_TABLE_ENTRY(equipment)
36 NL_STRING_CONVERSION_TABLE_ENTRY(bag)
37 NL_STRING_CONVERSION_TABLE_ENTRY(pet_animal1)
38 NL_STRING_CONVERSION_TABLE_ENTRY(pet_animal2)
39 NL_STRING_CONVERSION_TABLE_ENTRY(pet_animal3)
40 NL_STRING_CONVERSION_TABLE_ENTRY(pet_animal4)
41 NL_STRING_CONVERSION_TABLE_ENTRY(pet_animal5)
42 NL_STRING_CONVERSION_TABLE_ENTRY(pet_animal6)
43 NL_STRING_CONVERSION_TABLE_ENTRY(pet_animal7)
44 // NL_STRING_CONVERSION_TABLE_ENTRY(bot_gift)
45 NL_STRING_CONVERSION_TABLE_ENTRY(UNDEFINED)
46 NL_STRING_CONVERSION_TABLE_ENTRY(exchange)
47 // NL_STRING_CONVERSION_TABLE_ENTRY(exchange_proposition)
48 NL_STRING_CONVERSION_TABLE_ENTRY(trading)
49 NL_STRING_CONVERSION_TABLE_ENTRY(reward_sharing)
50 NL_STRING_CONVERSION_TABLE_ENTRY(guild)
51 NL_STRING_CONVERSION_TABLE_ENTRY(player_room)
52 NL_END_STRING_CONVERSION_TABLE(TInventory, InventoryToString, UNDEFINED)
55 const std::string& toString( TInventory inv )
57 // if this raise, correct the table above
58 nlctassert(MAX_INVENTORY_ANIMAL==7);
59 return InventoryToString.toString(inv);
62 // convert job name to job enum value
63 TInventory toInventory( const std::string& str )
65 TInventory inv = InventoryToString.fromString(str);
67 // support for pack_animalx for backward compatibility (necessary to load old save games)
68 if (inv == UNDEFINED)
70 if (str == "pack_animal1")
71 inv = pet_animal1;
72 else if (str == "pack_animal2")
73 inv = pet_animal2;
74 else if (str == "pack_animal3")
75 inv = pet_animal3;
76 else if (str == "pack_animal4")
77 inv = pet_animal4;
78 else if (str == "pack_animal5")
79 inv = pet_animal5;
80 else if (str == "pack_animal6")
81 inv = pet_animal6;
82 else if (str == "pack_animal7")
83 inv = pet_animal7;
86 return inv;
90 // String for inventories that are not using CInventoryUpdater
91 const char *DatabaseStringFromEInventory [NUM_ALL_INVENTORY] =
93 "HAND", // handling
94 "TEMP", // temporary
95 // "", // pick-up
96 "EQUIP", // equipment
97 "", // bag
98 "", // pack_animal1
99 "", // pack_animal2
100 "", // pack_animal3
101 "", // pack_animal4
102 "", // pack_animal5
103 "", // pack_animal6
104 "", // pack_animal7
105 "", // harvest
106 // "", // bot_gift
107 "", // exchange
108 // "", // exchange_proposition
109 "", // guild
110 "", // player_room
111 "" // unknown
116 const char *CInventoryCategoryForCharacter::InventoryStr [CInventoryCategoryForCharacter::NbInventoryIds] =
117 { "BAG", "PACK_ANIMAL0", "PACK_ANIMAL1", "PACK_ANIMAL2", "PACK_ANIMAL3", "PACK_ANIMAL4", "PACK_ANIMAL5", "PACK_ANIMAL6", "ROOM" };
118 const uint CInventoryCategoryForCharacter::InventoryNbSlots [CInventoryCategoryForCharacter::NbInventoryIds] =
119 { NbBagSlots, NbPackerSlots, NbPackerSlots, NbPackerSlots, NbPackerSlots, NbPackerSlots, NbPackerSlots, NbPackerSlots, NbRoomSlots };
120 // Other values to change according to these InventoryNbSlots:
121 // - game_share.h/inventories.h: CInventoryCategoryForCharacter::SlotBitSize
122 // - data_common/database.xml: INVENTORY:BAG count
123 // - data/gamedev/interfaces_v3/inventory.xml: inventory:content:bag param inv_branch_nb
125 const char *CInventoryCategoryForGuild::InventoryStr [CInventoryCategoryForGuild::NbInventoryIds] =
126 { "GUILD" };
127 const uint CInventoryCategoryForGuild::InventoryNbSlots [CInventoryCategoryForGuild::NbInventoryIds] =
128 { NbGuildSlots };
129 // Other values to change according to this InventoryNbSlots:
130 // - game_share.h/inventories.h: CInventoryCategoryForGuild::SlotBitSize
131 // - data_common/database.xml: GUILD:INVENTORY count
132 // - data/gamedev/interfaces_v3/inventory.xml: inventory:content:guild param inv_branch_nb
134 const char *InfoVersionStr = "INFO_VERSION";
136 const char *CItemSlot::ItemPropStr [NbItemPropId] =
137 { "SHEET", "QUALITY", "QUANTITY", "USER_COLOR", "CREATE_TIME", "SERIAL", "LOCKED", "WEIGHT", "NAMEID", "ENCHANT", "RM_CLASS_TYPE", "RM_FABER_STAT_TYPE", "PRICE", "RESALE_FLAG", "PREREQUISIT_VALID", "WORNED" };
138 const uint CItemSlot::DataBitSize [NbItemPropId] =
139 { 32, 10, 10, 3, 32, 32, 10, 16, 32, 10, 3, 5, 32, 2, 1, 1 };