]> git.localhorst.tv Git - l2e.git/blobdiff - src/common/LevelUp.cpp
put stat increments in level ladder
[l2e.git] / src / common / LevelUp.cpp
diff --git a/src/common/LevelUp.cpp b/src/common/LevelUp.cpp
new file mode 100644 (file)
index 0000000..0b8f85c
--- /dev/null
@@ -0,0 +1,43 @@
+#include "LevelUp.h"
+
+#include "../loader/Interpreter.h"
+#include "../loader/TypeDescription.h"
+
+using loader::FieldDescription;
+using loader::Interpreter;
+using loader::TypeDescription;
+
+
+namespace common {
+
+LevelUp::LevelUp()
+: Stats()
+, experience(0)
+, maxHealth(0)
+, maxMagic(0) {
+
+}
+
+
+void LevelUp::CreateTypeDescription() {
+       LevelUp l;
+       Stats *s = &l;
+
+       TypeDescription &td(TypeDescription::Create(TYPE_ID, "LevelUp"));
+       td.SetDescription("Describes the requirements and benefits of a levelup.");
+       td.SetConstructor(&Construct);
+       td.SetSize(sizeof(LevelUp));
+       td.AddSupertype(Stats::TYPE_ID, ((char *)s) - ((char *)&l));
+
+       td.AddField("exp", FieldDescription(((char *)&l.experience) - ((char *)&l), Interpreter::NUMBER_ID).SetDescription("reuired experience points"));
+       td.AddField("maxHP", FieldDescription(((char *)&l.maxHealth) - ((char *)&l), Interpreter::NUMBER_ID).SetDescription("increase in maximum health points"));
+       td.AddField("maxMP", FieldDescription(((char *)&l.maxMagic) - ((char *)&l), Interpreter::NUMBER_ID).SetDescription("increas in maximum magic points"));
+
+       AddFields(td, l, ((char *)s) - ((char *)&l));
+}
+
+void LevelUp::Construct(void *data) {
+       new (data) LevelUp;
+}
+
+}