]> git.localhorst.tv Git - l2e.git/blob - src/common/LevelUp.cpp
put stat increments in level ladder
[l2e.git] / src / common / LevelUp.cpp
1 #include "LevelUp.h"
2
3 #include "../loader/Interpreter.h"
4 #include "../loader/TypeDescription.h"
5
6 using loader::FieldDescription;
7 using loader::Interpreter;
8 using loader::TypeDescription;
9
10
11 namespace common {
12
13 LevelUp::LevelUp()
14 : Stats()
15 , experience(0)
16 , maxHealth(0)
17 , maxMagic(0) {
18
19 }
20
21
22 void LevelUp::CreateTypeDescription() {
23         LevelUp l;
24         Stats *s = &l;
25
26         TypeDescription &td(TypeDescription::Create(TYPE_ID, "LevelUp"));
27         td.SetDescription("Describes the requirements and benefits of a levelup.");
28         td.SetConstructor(&Construct);
29         td.SetSize(sizeof(LevelUp));
30         td.AddSupertype(Stats::TYPE_ID, ((char *)s) - ((char *)&l));
31
32         td.AddField("exp", FieldDescription(((char *)&l.experience) - ((char *)&l), Interpreter::NUMBER_ID).SetDescription("reuired experience points"));
33         td.AddField("maxHP", FieldDescription(((char *)&l.maxHealth) - ((char *)&l), Interpreter::NUMBER_ID).SetDescription("increase in maximum health points"));
34         td.AddField("maxMP", FieldDescription(((char *)&l.maxMagic) - ((char *)&l), Interpreter::NUMBER_ID).SetDescription("increas in maximum magic points"));
35
36         AddFields(td, l, ((char *)s) - ((char *)&l));
37 }
38
39 void LevelUp::Construct(void *data) {
40         new (data) LevelUp;
41 }
42
43 }