1 // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
2 // Copyright (C) 2010 Winch Gate Property Limited
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.
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/>.
22 #include "nel/misc/i18n.h"
23 #include "nel/misc/string_conversion.h"
25 #include "item_family.h"
28 using namespace NLMISC
;
32 // The conversion table
33 const CStringConversion
<EItemFamily
>::CPair stringTable
[] =
35 { "UNDEFINED", UNDEFINED
},
36 { "SERVICE", SERVICE
},
38 { "MELEE_WEAPON", MELEE_WEAPON
},
39 { "RANGE_WEAPON", RANGE_WEAPON
},
41 { "RAW_MATERIAL", RAW_MATERIAL
},
43 { "CRAFTING_TOOL", CRAFTING_TOOL
},
44 { "HARVEST_TOOL", HARVEST_TOOL
},
45 { "TAMING_TOOL", TAMING_TOOL
},
46 { "TRAINING_TOOL", TRAINING_TOOL
},
50 { "JEWELRY", JEWELRY
},
52 { "CARRION", CARRION
},
55 { "DEAD_SEED", DEAD_SEED
},
56 { "TELEPORT", TELEPORT
},
57 { "GUILD_FLAG", GUILD_FLAG
},
58 { "LIVING_SEED", LIVING_SEED
},
59 { "LITTLE_SEED", LITTLE_SEED
},
60 { "MEDIUM_SEED", MEDIUM_SEED
},
61 { "BIG_SEED", BIG_SEED
},
62 { "VERY_BIG_SEED", VERY_BIG_SEED
},
63 { "MISSION_ITEM", MISSION_ITEM
},
64 { "CRYSTALLIZED_SPELL", CRYSTALLIZED_SPELL
},
65 { "ITEM_SAP_RECHARGE", ITEM_SAP_RECHARGE
},
66 { "PET_ANIMAL_TICKET", PET_ANIMAL_TICKET
},
67 { "GUILD_OPTION", GUILD_OPTION
},
68 { "COSMETIC", COSMETIC
},
69 { "HANDLED_ITEM", HANDLED_ITEM
},
70 { "CONSUMABLE", CONSUMABLE
},
71 { "XP_CATALYSER", XP_CATALYSER
},
73 { "SCROLL_R2", SCROLL_R2
},
74 { "COMMAND_TICKET", COMMAND_TICKET
},
75 { "GENERIC_ITEM", GENERIC_ITEM
},
78 CStringConversion
<EItemFamily
> conversion(stringTable
, sizeof(stringTable
) / sizeof(stringTable
[0]), UNDEFINED
);
81 // convert item family id to item family name string
82 const std::string
& toString( EItemFamily itemFamily
)
84 return conversion
.toString(itemFamily
);
88 // convert item family name to item family enum value
89 EItemFamily
stringToItemFamily( const std::string
& str
)
91 return conversion
.fromString(str
);
94 bool isSellableByPlayer( EItemFamily fam
)
99 bool isResellable( EItemFamily fam
)
103 fam
== MELEE_WEAPON
||
104 fam
== RANGE_WEAPON
||
106 fam
== RAW_MATERIAL
||
109 fam
== CRYSTALLIZED_SPELL
||
111 fam
== ITEM_SAP_RECHARGE
;
115 bool isTextCustomizable( EItemFamily fam
)
119 fam
== MELEE_WEAPON
||
120 fam
== RANGE_WEAPON
||
127 bool isUsable( EItemFamily fam
)
130 fam
== ITEM_SAP_RECHARGE
||
131 fam
== CRYSTALLIZED_SPELL
||
138 * returns true if items of this family are destroyed when they are completely worned out
140 bool destroyedWhenWorned(EItemFamily family
)
144 case ITEMFAMILY::MELEE_WEAPON
:
145 case ITEMFAMILY::RANGE_WEAPON
:
146 case ITEMFAMILY::ARMOR
:
147 case ITEMFAMILY::SHIELD
: