From 6fbd52540d4f2e94b4b8391110c83320557556eb Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 25 Sep 2014 13:12:05 +0300 Subject: Load data about homunculuses from homunculuses.xml. --- src/being/being.cpp | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'src/being') diff --git a/src/being/being.cpp b/src/being/being.cpp index 869d7d8b1..2626ca13a 100644 --- a/src/being/being.cpp +++ b/src/being/being.cpp @@ -72,6 +72,7 @@ #include "resources/db/avatardb.h" #include "resources/db/emotedb.h" +#include "resources/db/homunculusdb.h" #include "resources/db/itemdb.h" #include "resources/db/mercenarydb.h" #include "resources/db/monsterdb.h" @@ -224,7 +225,8 @@ Being::Being(const int id, if (mType == ActorType::Player || mType == ActorType::Mercenary - || mType == ActorType::Pet) + || mType == ActorType::Pet + || mType == ActorType::Homunculus) { mShowName = config.getBoolValue("visiblenames"); } @@ -303,7 +305,7 @@ void Being::setSubtype(const uint16_t subtype, const uint8_t look) mSubType = subtype; mLook = look; - if (mType == ActorType::Monster || mType == ActorType::Homunculus) + if (mType == ActorType::Monster) { mInfo = MonsterDB::get(mSubType); if (mInfo) @@ -336,6 +338,17 @@ void Being::setSubtype(const uint16_t subtype, const uint8_t look) mYDiff = mInfo->getSortOffsetY(); } } + if (mType == ActorType::Homunculus) + { + mInfo = HomunculusDB::get(mSubType); + if (mInfo) + { + setName(mInfo->getName()); + setupSpriteDisplay(mInfo->getDisplay(), true, 0, + mInfo->getColor(mLook)); + mYDiff = mInfo->getSortOffsetY(); + } + } else if (mType == ActorType::Npc) { mInfo = NPCDB::get(mSubType); @@ -579,7 +592,8 @@ void Being::takeDamage(Being *const attacker, const int amount, } else if (mType == ActorType::Monster || mType == ActorType::Mercenary - || mType == ActorType::Pet) + || mType == ActorType::Pet + || mType == ActorType::Homunculus) { if (attacker == localPlayer) { @@ -2945,6 +2959,7 @@ std::string Being::loadComment(const std::string &name, case ActorType::LocalPet: case ActorType::Avatar: case ActorType::Mercenary: + case ActorType::Homunculus: case ActorType::Pet: default: return ""; -- cgit v1.2.3-70-g09d2