]> git.localhorst.tv Git - l2e.git/blob - src/common/Item.cpp
1b54c9a2ac73eef37a0278f64e32bee9b7d72d30
[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 spriteId(TypeDescription::GetTypeId("Sprite"));
42         int stringId(TypeDescription::GetTypeId("String"));
43         int targetsId(TypeDescription::GetTypeId("TargetingMode"));
44
45         td.AddField("name", FieldDescription(((char *)&i.name) - ((char *)&i), stringId, true));
46         td.AddField("menuicon", FieldDescription(((char *)&i.menuIcon) - ((char *)&i), spriteId, true));
47         // TODO: implement flags/fields (e.g. for usability)
48         td.AddField("targets", FieldDescription(((char *)&i.targettingMode) - ((char *)&i), targetsId, false));
49         td.AddField("ikari", FieldDescription(((char *)&i.ikari) - ((char *)&i), ikariId, true));
50         td.AddField("attackanimation", FieldDescription(((char *)&i.attackAnimation) - ((char *)&i), animationId, true));
51 }
52
53 }