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 +++++++++++++++++++++++++++++++++++++++++---- src/enums/gui/usercolorid.h | 1 + src/gui/userpalette.cpp | 6 ++++++ 3 files changed, 48 insertions(+), 4 deletions(-) (limited to 'src') 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); diff --git a/src/enums/gui/usercolorid.h b/src/enums/gui/usercolorid.h index 5ecd64458..9cca4dd02 100644 --- a/src/enums/gui/usercolorid.h +++ b/src/enums/gui/usercolorid.h @@ -44,6 +44,7 @@ enumStart(UserColorId) PET, MERCENARY, HOMUNCULUS, + SKILLUNIT, PARTY, GUILD, TEAM1, diff --git a/src/gui/userpalette.cpp b/src/gui/userpalette.cpp index d9469b78d..50e966d80 100644 --- a/src/gui/userpalette.cpp +++ b/src/gui/userpalette.cpp @@ -49,6 +49,7 @@ const std::string ColorTypeNames[static_cast( "ColorPet", "ColorMercenary", "ColorHomunculus", + "ColorSkillUnit", "ColorParty", "ColorGuild", "ColorTeam1", @@ -197,6 +198,11 @@ UserPalette::UserPalette() : GradientType::STATIC, // TRANSLATORS: palette color _("Homunculus")); + addColor(UserColorId::SKILLUNIT, + 0xffffff, + GradientType::STATIC, + // TRANSLATORS: palette color + _("Skill unit")); addColor(UserColorId::PARTY, 0xff00d8, // TRANSLATORS: palette color -- cgit v1.2.3-60-g2f50