]> git.localhorst.tv Git - l2e.git/blob - src/common/Item.cpp
e695e8d641c0ccf3f7530a024e1c04b081cb82c2
[l2e.git] / src / common / Item.cpp
1 /*
2  * Item.cpp
3  *
4  *  Created on: Aug 9, 2012
5  *      Author: holy
6  */
7
8 #include "Item.h"
9
10 #include "../loader/TypeDescription.h"
11
12 using loader::FieldDescription;
13 using loader::TypeDescription;
14
15 namespace common {
16
17 Item::Item()
18 : name("")
19 , menuIcon(0)
20 , chestIcon(0)
21 , ikari(0)
22 , attackAnimation(0)
23
24 , value(0)
25 , properties(0)
26
27 , usability(0)
28 , equipable(0) {
29
30 }
31
32
33 void Item::CreateTypeDescription() {
34         Item i;
35         TypeDescription &td(TypeDescription::CreateOrGet("Item"));
36
37         td.SetSize(sizeof(Item));
38
39         int animationId(TypeDescription::GetTypeId("Animation"));
40         int ikariId(TypeDescription::GetTypeId("Ikari"));
41         int numberId(TypeDescription::GetTypeId("Number"));
42         int spriteId(TypeDescription::GetTypeId("Sprite"));
43         int stringId(TypeDescription::GetTypeId("String"));
44         int targetsId(TypeDescription::GetTypeId("TargetingMode"));
45
46         td.AddField("name", FieldDescription(((char *)&i.name) - ((char *)&i), stringId, true));
47         td.AddField("menuicon", FieldDescription(((char *)&i.menuIcon) - ((char *)&i), spriteId, true));
48         // TODO: implement flags/fields (e.g. for usability)
49         td.AddField("targets", FieldDescription(((char *)&i.targettingMode) - ((char *)&i), targetsId, false));
50         td.AddField("ikari", FieldDescription(((char *)&i.ikari) - ((char *)&i), ikariId, true));
51         td.AddField("attackanimation", FieldDescription(((char *)&i.attackAnimation) - ((char *)&i), animationId, true));
52 }
53
54 }