]> git.localhorst.tv Git - l2e.git/blobdiff - src/common/Hero.cpp
first scripting implementation
[l2e.git] / src / common / Hero.cpp
index 98b92ca2fdafbbef48bad6fa86216060b380bc75..bef60a4c02305f8f0e5a3fc3854663f39fa6c20e 100644 (file)
@@ -35,9 +35,7 @@ Hero::Hero()
 , battleSprite(0)
 , meleeAnimation(0)
 , attackAnimation(0)
-, spellAnimation(0)
-
-, mapSprite(0) {
+, spellAnimation(0) {
 
 }
 
@@ -61,6 +59,7 @@ void Hero::CreateTypeDescription() {
        Hero h;
 
        int animationId(TypeDescription::GetTypeId("Animation"));
+       int entityId(TypeDescription::GetTypeId("Entity"));
        int numberId(TypeDescription::GetTypeId("Number"));
        int spriteId(TypeDescription::GetTypeId("Sprite"));
        int statsId(TypeDescription::GetTypeId("Stats"));
@@ -70,24 +69,24 @@ void Hero::CreateTypeDescription() {
        td.SetConstructor(&Construct);
        td.SetSize(sizeof(Hero));
 
-       td.AddField("name", FieldDescription(((char *)&h.name) - ((char *)&h), stringId, true));
+       td.AddField("name", FieldDescription(((char *)&h.name) - ((char *)&h), stringId).SetReferenced());
 
-       td.AddField("maxHealth", FieldDescription(((char *)&h.maxHealth) - ((char *)&h), numberId, false));
-       td.AddField("health", FieldDescription(((char *)&h.health) - ((char *)&h), numberId, false));
-       td.AddField("maxMana", FieldDescription(((char *)&h.maxMana) - ((char *)&h), numberId, false));
-       td.AddField("mana", FieldDescription(((char *)&h.mana) - ((char *)&h), numberId, false));
-       td.AddField("ip", FieldDescription(((char *)&h.ip) - ((char *)&h), numberId, false));
+       td.AddField("maxHealth", FieldDescription(((char *)&h.maxHealth) - ((char *)&h), numberId));
+       td.AddField("health", FieldDescription(((char *)&h.health) - ((char *)&h), numberId));
+       td.AddField("maxMana", FieldDescription(((char *)&h.maxMana) - ((char *)&h), numberId));
+       td.AddField("mana", FieldDescription(((char *)&h.mana) - ((char *)&h), numberId));
+       td.AddField("ip", FieldDescription(((char *)&h.ip) - ((char *)&h), numberId));
 
-       td.AddField("stats", FieldDescription(((char *)&h.stats) - ((char *)&h), statsId, false));
+       td.AddField("stats", FieldDescription(((char *)&h.stats) - ((char *)&h), statsId));
 
-       td.AddField("level", FieldDescription(((char *)&h.level) - ((char *)&h), numberId, false));
+       td.AddField("level", FieldDescription(((char *)&h.level) - ((char *)&h), numberId));
 
-       td.AddField("battleSprite", FieldDescription(((char *)&h.battleSprite) - ((char *)&h), spriteId, true));
-       td.AddField("attackAnimation", FieldDescription(((char *)&h.attackAnimation) - ((char *)&h), animationId, true));
-       td.AddField("spellAnimation", FieldDescription(((char *)&h.spellAnimation) - ((char *)&h), animationId, true));
-       td.AddField("meleeAnimation", FieldDescription(((char *)&h.meleeAnimation) - ((char *)&h), animationId, true));
+       td.AddField("battleSprite", FieldDescription(((char *)&h.battleSprite) - ((char *)&h), spriteId).SetReferenced().SetDescription("the sprite used for battle scenes"));
+       td.AddField("attackAnimation", FieldDescription(((char *)&h.attackAnimation) - ((char *)&h), animationId).SetReferenced().SetDescription("the animation played for physical attacks"));
+       td.AddField("spellAnimation", FieldDescription(((char *)&h.spellAnimation) - ((char *)&h), animationId).SetReferenced().SetDescription("the animation played for magical attacks"));
+       td.AddField("meleeAnimation", FieldDescription(((char *)&h.meleeAnimation) - ((char *)&h), animationId).SetReferenced().SetDescription("the animation played on attacked monsters when the hero has no weapon"));
 
-       td.AddField("mapSprite", FieldDescription(((char *)&h.mapSprite) - ((char *)&h), spriteId, true));
+       td.AddField("mapEntity", FieldDescription(((char *)&h.mapEntity) - ((char *)&h), entityId).SetDescription("the entity representing the hero on maps"));
 }
 
 void Hero::Construct(void *data) {