From 197609376af61e4ef4a02d1e5805c2f923dee4bb Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 9 Nov 2015 22:24:00 +0300 Subject: Add skill unit support in most files excluding net code. --- src/being/being.cpp | 45 +++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 41 insertions(+), 4 deletions(-) (limited to 'src/being') diff --git a/src/being/being.cpp b/src/being/being.cpp index 7a937ceaf..9e8b1f6db 100644 --- a/src/being/being.cpp +++ b/src/being/being.cpp @@ -80,6 +80,7 @@ #include "resources/db/monsterdb.h" #include "resources/db/npcdb.h" #include "resources/db/petdb.h" +#include "resources/db/skillunitdb.h" #include "resources/map/map.h" @@ -269,8 +270,11 @@ Being::Being(const BeingId id, mGotComment = true; } - if (mType == ActorType::Portal) + if (mType == ActorType::Portal || + mType == ActorType::SkillUnit) + { mShowName = false; + } config.addListener("visiblenames", this); @@ -403,6 +407,19 @@ void Being::setSubtype(const BeingTypeId subtype, mYDiff = mInfo->getSortOffsetY(); } } + if (mType == ActorType::SkillUnit) + { + mInfo = SkillUnitDb::get(mSubType); + if (mInfo) + { + setName(mInfo->getName()); + setupSpriteDisplay(mInfo->getDisplay(), + ForceDisplay_true, + 0, + mInfo->getColor(fromInt(mLook, ItemColor))); + mYDiff = mInfo->getSortOffsetY(); + } + } #endif else if (mType == ActorType::Npc) { @@ -681,8 +698,9 @@ void Being::takeDamage(Being *const attacker, UserColorId::HIT_PLAYER_MONSTER); } } - else if (mType == ActorType::Player && attacker != localPlayer - && this == localPlayer) + else if (mType == ActorType::Player && + attacker != localPlayer && + this == localPlayer) { // here player was attacked by other player. mark him as enemy. color = &userPalette->getColor(UserColorId::HIT_PLAYER_PLAYER); @@ -1439,8 +1457,12 @@ void Being::setAction(const BeingActionT &action, const int attackId) this, false, mX, mY); - if (mType == ActorType::Monster || mType == ActorType::Npc) + if (mType == ActorType::Monster || + mType == ActorType::Npc || + mType == ActorType::SkillUnit) + { mYDiff = mInfo->getDeadSortOffsetY(); + } } break; case BeingAction::STAND: @@ -2248,6 +2270,21 @@ void Being::updateColors() setDefaultNameColor(UserColorId::NPC); mTextColor = &userPalette->getColor(UserColorId::NPC); } + else if (mType == ActorType::Pet) + { + setDefaultNameColor(UserColorId::PET); + mTextColor = &userPalette->getColor(UserColorId::PET); + } + else if (mType == ActorType::Homunculus) + { + setDefaultNameColor(UserColorId::HOMUNCULUS); + mTextColor = &userPalette->getColor(UserColorId::HOMUNCULUS); + } + else if (mType == ActorType::SkillUnit) + { + setDefaultNameColor(UserColorId::SKILLUNIT); + mTextColor = &userPalette->getColor(UserColorId::SKILLUNIT); + } else if (this == localPlayer) { mNameColor = &userPalette->getColor(UserColorId::SELF); -- cgit v1.2.3-70-g09d2