Otclient  14/8/2020
itemtype.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2010-2020 OTClient <https://github.com/edubart/otclient>
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a copy
5  * of this software and associated documentation files (the "Software"), to deal
6  * in the Software without restriction, including without limitation the rights
7  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8  * copies of the Software, and to permit persons to whom the Software is
9  * furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice shall be included in
12  * all copies or substantial portions of the Software.
13  *
14  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20  * THE SOFTWARE.
21  */
22 
23 
24 #ifndef ITEMTYPE_H
25 #define ITEMTYPE_H
26 
29 #include <framework/xml/tinyxml.h>
30 
48 };
49 
53  ItemTypeAttrName = 18, // deprecated
54  ItemTypeAttrDesc = 19, // deprecated
56  ItemTypeAttrSlot = 21, // deprecated
57  ItemTypeAttrMaxItems = 22, // deprecated
58  ItemTypeAttrWeight = 23, // deprecated
59  ItemTypeAttrWeapon = 24, // deprecated
60  ItemTypeAttrAmmunition = 25, // deprecated
61  ItemTypeAttrArmor = 26, // deprecated
62  ItemTypeAttrMagicLevel = 27, // deprecated
63  ItemTypeAttrMagicField = 28, // deprecated
64  ItemTypeAttrWritable = 29, // deprecated
65  ItemTypeAttrRotateTo = 30, // deprecated
66  ItemTypeAttrDecay = 31, // deprecated
72  ItemTypeAttrDecay2 = 37, // deprecated
73  ItemTypeAttrWeapon2 = 38, // deprecated
74  ItemTypeAttrAmmunition2 = 39, // deprecated
75  ItemTypeAttrArmor2 = 40, // deprecated
76  ItemTypeAttrWritable2 = 41, // deprecated
79  ItemTypeAttrWrtiable3 = 44, // deprecated
82 };
83 
85 {
128 };
129 
130 class ItemType : public LuaObject
131 {
132 public:
133  ItemType();
134 
135  void unserialize(const BinaryTreePtr& node);
136 
137  void setServerId(uint16 serverId) { m_attribs.set(ItemTypeAttrServerId, serverId); }
139 
140  void setClientId(uint16 clientId) { m_attribs.set(ItemTypeAttrClientId, clientId); }
142 
143  void setCategory(ItemCategory category) { m_category = category; }
144  ItemCategory getCategory() { return m_category; }
145 
146  void setName(const std::string& name) { m_attribs.set(ItemTypeAttrName, name); }
147  std::string getName() { return m_attribs.get<std::string>(ItemTypeAttrName); }
148 
149  void setDesc(const std::string& desc) { m_attribs.set(ItemTypeAttrDesc, desc); }
150  std::string getDesc() { return m_attribs.get<std::string>(ItemTypeAttrDesc); }
151 
152  bool isNull() { return m_null; }
153  bool isWritable() { return m_attribs.get<bool>(ItemTypeAttrWritable); }
154 
155 private:
156  ItemCategory m_category;
157  stdext::boolean<true> m_null;
158 
160 };
161 
162 #endif
ItemCategoryInvalid
@ ItemCategoryInvalid
Definition: itemtype.h:32
ItemType::getDesc
std::string getDesc()
Definition: itemtype.h:150
ClientVersion760
@ ClientVersion760
Definition: itemtype.h:88
ItemTypeAttrSpeed
@ ItemTypeAttrSpeed
Definition: itemtype.h:55
ItemCategoryContainer
@ ItemCategoryContainer
Definition: itemtype.h:34
ItemCategoryLast
@ ItemCategoryLast
Definition: itemtype.h:47
ItemType::unserialize
void unserialize(const BinaryTreePtr &node)
Definition: itemtype.cpp:36
ItemTypeAttrArmor
@ ItemTypeAttrArmor
Definition: itemtype.h:61
ItemTypeAttrWrtiable3
@ ItemTypeAttrWrtiable3
Definition: itemtype.h:79
ClientVersion944_V3
@ ClientVersion944_V3
Definition: itemtype.h:119
ClientVersion780
@ ClientVersion780
Definition: itemtype.h:90
ItemCategoryFluid
@ ItemCategoryFluid
Definition: itemtype.h:44
ItemTypeAttrWeapon2
@ ItemTypeAttrWeapon2
Definition: itemtype.h:73
ClientVersion860
@ ClientVersion860
Definition: itemtype.h:106
ItemCategorySplash
@ ItemCategorySplash
Definition: itemtype.h:43
ItemTypeAttrMagicField
@ ItemTypeAttrMagicField
Definition: itemtype.h:63
ClientVersion960
@ ClientVersion960
Definition: itemtype.h:126
ItemTypeAttrDecay
@ ItemTypeAttrDecay
Definition: itemtype.h:66
ItemType::isWritable
bool isWritable()
Definition: itemtype.h:153
ItemTypeAttrWritable
@ ItemTypeAttrWritable
Definition: itemtype.h:64
ItemCategoryMagicField
@ ItemCategoryMagicField
Definition: itemtype.h:40
ItemTypeAttrMagicLevel
@ ItemTypeAttrMagicLevel
Definition: itemtype.h:62
ClientVersion910
@ ClientVersion910
Definition: itemtype.h:114
ClientVersion830
@ ClientVersion830
Definition: itemtype.h:97
ItemTypeAttrClientId
@ ItemTypeAttrClientId
Definition: itemtype.h:52
ClientVersion855
@ ClientVersion855
Definition: itemtype.h:104
ItemTypeAttrDecay2
@ ItemTypeAttrDecay2
Definition: itemtype.h:72
tinyxml.h
ClientVersion952
@ ClientVersion952
Definition: itemtype.h:123
ItemType::getName
std::string getName()
Definition: itemtype.h:147
ItemTypeAttrTopOrder
@ ItemTypeAttrTopOrder
Definition: itemtype.h:78
ItemCategoryTeleport
@ ItemCategoryTeleport
Definition: itemtype.h:39
ClientVersion810
@ ClientVersion810
Definition: itemtype.h:94
ItemTypeAttrServerId
@ ItemTypeAttrServerId
Definition: itemtype.h:51
ClientVersion873
@ ClientVersion873
Definition: itemtype.h:112
ClientVersion900
@ ClientVersion900
Definition: itemtype.h:113
ClientVersion870
@ ClientVersion870
Definition: itemtype.h:109
ItemType::getClientId
uint16 getClientId()
Definition: itemtype.h:141
ClientVersion940
@ ClientVersion940
Definition: itemtype.h:116
ClientVersion854
@ ClientVersion854
Definition: itemtype.h:103
ItemType::setDesc
void setDesc(const std::string &desc)
Definition: itemtype.h:149
stdext::boolean< true >
ItemTypeAttrAmmunition
@ ItemTypeAttrAmmunition
Definition: itemtype.h:60
stdext::dynamic_storage< uint8 >
ClientVersion792
@ ClientVersion792
Definition: itemtype.h:92
ItemType::setServerId
void setServerId(uint16 serverId)
Definition: itemtype.h:137
luaobject.h
ClientVersion842
@ ClientVersion842
Definition: itemtype.h:100
ItemCategoryDeprecated
@ ItemCategoryDeprecated
Definition: itemtype.h:46
ClientVersion840
@ ClientVersion840
Definition: itemtype.h:98
ClientVersion920
@ ClientVersion920
Definition: itemtype.h:115
uint16
uint16_t uint16
Definition: types.h:36
ClientVersion946
@ ClientVersion946
Definition: itemtype.h:121
ClientVersion861
@ ClientVersion861
Definition: itemtype.h:107
ClientVersion953
@ ClientVersion953
Definition: itemtype.h:124
ClientVersion944_V1
@ ClientVersion944_V1
Definition: itemtype.h:117
ItemTypeAttrMinimapColor
@ ItemTypeAttrMinimapColor
Definition: itemtype.h:68
stdext::dynamic_storage::set
void set(const Key &k, const T &value)
Definition: dynamic_storage.h:35
declarations.h
ItemTypeAttrAmmunition2
@ ItemTypeAttrAmmunition2
Definition: itemtype.h:74
ClientVersion872
@ ClientVersion872
Definition: itemtype.h:111
ItemType::ItemType
ItemType()
Definition: itemtype.cpp:31
ItemCategoryWeapon
@ ItemCategoryWeapon
Definition: itemtype.h:35
ItemTypeAttrLight2
@ ItemTypeAttrLight2
Definition: itemtype.h:77
ClientVersion850
@ ClientVersion850
Definition: itemtype.h:101
ClientVersion750
@ ClientVersion750
Definition: itemtype.h:86
ItemTypeAttr
ItemTypeAttr
Definition: itemtype.h:50
ClientVersion950
@ ClientVersion950
Definition: itemtype.h:122
ItemCategory
ItemCategory
Definition: itemtype.h:31
ItemType::getServerId
uint16 getServerId()
Definition: itemtype.h:138
ItemType
Definition: itemtype.h:130
ItemType::setName
void setName(const std::string &name)
Definition: itemtype.h:146
ItemTypeAttrWeapon
@ ItemTypeAttrWeapon
Definition: itemtype.h:59
ClientVersion944_V4
@ ClientVersion944_V4
Definition: itemtype.h:120
ItemTypeAttr07
@ ItemTypeAttr07
Definition: itemtype.h:69
ItemTypeAttrSlot
@ ItemTypeAttrSlot
Definition: itemtype.h:56
stdext::dynamic_storage::get
T get(const Key &k) const
Definition: dynamic_storage.h:48
ItemCategoryArmor
@ ItemCategoryArmor
Definition: itemtype.h:37
ItemTypeAttrWritable2
@ ItemTypeAttrWritable2
Definition: itemtype.h:76
ClientVersion944_V2
@ ClientVersion944_V2
Definition: itemtype.h:118
ItemCategoryCharges
@ ItemCategoryCharges
Definition: itemtype.h:38
ClientVersion854_OLD
@ ClientVersion854_OLD
Definition: itemtype.h:102
ItemTypeAttrArmor2
@ ItemTypeAttrArmor2
Definition: itemtype.h:75
ItemCategoryGround
@ ItemCategoryGround
Definition: itemtype.h:33
ClientVersion
ClientVersion
Definition: itemtype.h:84
ItemTypeAttrDesc
@ ItemTypeAttrDesc
Definition: itemtype.h:54
ClientVersion790
@ ClientVersion790
Definition: itemtype.h:91
ItemType::setCategory
void setCategory(ItemCategory category)
Definition: itemtype.h:143
ClientVersion755
@ ClientVersion755
Definition: itemtype.h:87
stdext::shared_object_ptr
Definition: shared_object.h:39
ItemTypeAttrMaxItems
@ ItemTypeAttrMaxItems
Definition: itemtype.h:57
ItemType::isNull
bool isNull()
Definition: itemtype.h:152
ClientVersion871
@ ClientVersion871
Definition: itemtype.h:110
ItemType::getCategory
ItemCategory getCategory()
Definition: itemtype.h:144
ItemCategoryKey
@ ItemCategoryKey
Definition: itemtype.h:42
ItemCategoryWritable
@ ItemCategoryWritable
Definition: itemtype.h:41
ClientVersion954
@ ClientVersion954
Definition: itemtype.h:125
ItemType::setClientId
void setClientId(uint16 clientId)
Definition: itemtype.h:140
ClientVersion770
@ ClientVersion770
Definition: itemtype.h:89
ClientVersion961
@ ClientVersion961
Definition: itemtype.h:127
ItemTypeAttrName
@ ItemTypeAttrName
Definition: itemtype.h:53
ClientVersion862
@ ClientVersion862
Definition: itemtype.h:108
ClientVersion820
@ ClientVersion820
Definition: itemtype.h:96
LuaObject
LuaObject, all script-able classes have it as base.
Definition: luaobject.h:30
ClientVersion841
@ ClientVersion841
Definition: itemtype.h:99
ItemTypeAttrWeight
@ ItemTypeAttrWeight
Definition: itemtype.h:58
ClientVersion800
@ ClientVersion800
Definition: itemtype.h:93
ItemCategoryDoor
@ ItemCategoryDoor
Definition: itemtype.h:45
ItemTypeAttrLast
@ ItemTypeAttrLast
Definition: itemtype.h:81
ItemTypeAttr08
@ ItemTypeAttr08
Definition: itemtype.h:70
ItemCategoryAmmunition
@ ItemCategoryAmmunition
Definition: itemtype.h:36
ItemTypeAttrSpriteHash
@ ItemTypeAttrSpriteHash
Definition: itemtype.h:67
ClientVersion860_OLD
@ ClientVersion860_OLD
Definition: itemtype.h:105
ItemTypeAttrRotateTo
@ ItemTypeAttrRotateTo
Definition: itemtype.h:65
ItemTypeAttrLight
@ ItemTypeAttrLight
Definition: itemtype.h:71
uint8
uint8_t uint8
Definition: types.h:37
ClientVersion811
@ ClientVersion811
Definition: itemtype.h:95
ItemTypeAttrWareId
@ ItemTypeAttrWareId
Definition: itemtype.h:80