+void Hero::UpdateIkariMenu(const Resources *res) {
+ IkariMenu().Clear();
+ IkariMenu().Reserve(6);
+
+ if (HasWeapon()) {
+ IkariMenu().Add(
+ Weapon()->Name(),
+ Weapon(),
+ Weapon()->HasIkari() && Weapon()->GetIkari()->Cost() <= IP(),
+ res->weaponMenuIcon,
+ 0,
+ Weapon()->HasIkari() ? Weapon()->GetIkari()->Name() : "");
+ } else {
+ IkariMenu().Add(res->noEquipmentText, 0, false, res->weaponMenuIcon);
+ }
+
+ if (HasArmor()) {
+ IkariMenu().Add(
+ Armor()->Name(),
+ Armor(),
+ Armor()->HasIkari() && Armor()->GetIkari()->Cost() <= IP(),
+ res->armorMenuIcon,
+ 0,
+ Armor()->HasIkari() ? Armor()->GetIkari()->Name() : "");
+ } else {
+ IkariMenu().Add(res->noEquipmentText, 0, false, res->armorMenuIcon);
+ }
+
+ if (HasShield()) {
+ IkariMenu().Add(
+ Shield()->Name(),
+ Shield(),
+ Shield()->HasIkari() && Shield()->GetIkari()->Cost() <= IP(),
+ res->shieldMenuIcon,
+ 0,
+ Shield()->HasIkari() ? Shield()->GetIkari()->Name() : "");
+ } else {
+ IkariMenu().Add(res->noEquipmentText, 0, false, res->shieldMenuIcon);
+ }
+
+ if (HasHelmet()) {
+ IkariMenu().Add(
+ Helmet()->Name(),
+ Helmet(),
+ Helmet()->HasIkari() && Helmet()->GetIkari()->Cost() <= IP(),
+ res->helmetMenuIcon,
+ 0,
+ Helmet()->HasIkari() ? Helmet()->GetIkari()->Name() : "");
+ } else {
+ IkariMenu().Add(res->noEquipmentText, 0, false, res->helmetMenuIcon);
+ }
+
+ if (HasRing()) {
+ IkariMenu().Add(
+ Ring()->Name(),
+ Ring(),
+ Ring()->HasIkari() && Ring()->GetIkari()->Cost() <= IP(),
+ res->ringMenuIcon,
+ 0,
+ Ring()->HasIkari() ? Ring()->GetIkari()->Name() : "");
+ } else {
+ IkariMenu().Add(res->noEquipmentText, 0, false, res->ringMenuIcon);
+ }
+
+ if (HasJewel()) {
+ IkariMenu().Add(
+ Jewel()->Name(),
+ Jewel(),
+ Jewel()->HasIkari() && Jewel()->GetIkari()->Cost() <= IP(),
+ res->jewelMenuIcon,
+ 0,
+ Jewel()->HasIkari() ? Jewel()->GetIkari()->Name() : "");
+ } else {
+ IkariMenu().Add(res->noEquipmentText, 0, false, res->jewelMenuIcon);
+ }
+}
+
+
+void Hero::CreateTypeDescription() {
+ Hero h;
+
+ int animationId(TypeDescription::GetTypeId("Animation"));
+ int numberId(TypeDescription::GetTypeId("Number"));
+ int spriteId(TypeDescription::GetTypeId("Sprite"));
+ int statsId(TypeDescription::GetTypeId("Stats"));
+ int stringId(TypeDescription::GetTypeId("String"));
+
+ TypeDescription &td(TypeDescription::CreateOrGet("Hero"));
+ td.SetConstructor(&Construct);
+ td.SetSize(sizeof(Hero));
+
+ td.AddField("name", FieldDescription(((char *)&h.name) - ((char *)&h), stringId, true));
+ td.AddField("sprite", FieldDescription(((char *)&h.sprite) - ((char *)&h), spriteId, true));
+ td.AddField("level", FieldDescription(((char *)&h.level) - ((char *)&h), numberId, false));
+
+ 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("stats", FieldDescription(((char *)&h.stats) - ((char *)&h), statsId, false));
+
+ 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));
+}
+
+void Hero::Construct(void *data) {
+ new (data) Hero;
+}
+