]> git.localhorst.tv Git - l2e.git/blobdiff - src/common/Ikari.cpp
first scripting implementation
[l2e.git] / src / common / Ikari.cpp
index fb3767e8a43be63a0a19321e95b3533a2186df38..3a023926b5fe8e5d94c9448c49ef03d61bda459c 100644 (file)
@@ -7,12 +7,43 @@
 
 #include "Ikari.h"
 
+#include "../loader/TypeDescription.h"
+
+using loader::FieldDescription;
+using loader::TypeDescription;
+
 namespace common {
 
 Ikari::Ikari()
 : name("")
-, cost(0) {
+, cost(0)
+, isPhysical(false) {
+
+}
+
+
+void Ikari::CreateTypeDescription() {
+       Ikari i;
+
+       int boolId(TypeDescription::GetTypeId("Boolean"));
+       int numberId(TypeDescription::GetTypeId("Number")); // FIXME: need small number type
+       int stringId(TypeDescription::GetTypeId("String"));
+       int targetsId(TypeDescription::GetTypeId("TargetingMode"));
+
+       TypeDescription &td(TypeDescription::CreateOrGet("Ikari"));
+       td.SetDescription(
+                       "Information of a single ikari attack.");
+       td.SetConstructor(&Construct);
+       td.SetSize(sizeof(Ikari));
+
+       td.AddField("name", FieldDescription(((char *)&i.name) - ((char *)&i), stringId).SetReferenced().SetDescription("the attack's name"));
+       td.AddField("cost", FieldDescription(((char *)&i.cost) - ((char *)&i), numberId).SetDescription("amount of ikari points needed and deducted for use"));
+       td.AddField("targets", FieldDescription(((char *)&i.targetingMode) - ((char *)&i), targetsId).SetDescription("how target selection is to be performed"));
+       td.AddField("type", FieldDescription(((char *)&i.isPhysical) - ((char *)&i), boolId).SetDescription("if the attack is physical (true) or magical(false)"));
+}
 
+void Ikari::Construct(void *data) {
+       new (data) Ikari;
 }
 
 }