summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-11-09 22:24:00 +0300
committerAndrei Karas <akaras@inbox.ru>2015-11-09 22:24:00 +0300
commit197609376af61e4ef4a02d1e5805c2f923dee4bb (patch)
tree4c4e55613d8f7bf79ccd02688994976bb6333b92 /src
parent91e8452086ff85b1ba759e1932ac6af0a2179cf3 (diff)
downloadmanaplus-197609376af61e4ef4a02d1e5805c2f923dee4bb.tar.gz
manaplus-197609376af61e4ef4a02d1e5805c2f923dee4bb.tar.bz2
manaplus-197609376af61e4ef4a02d1e5805c2f923dee4bb.tar.xz
manaplus-197609376af61e4ef4a02d1e5805c2f923dee4bb.zip
Add skill unit support in most files excluding net code.
Diffstat (limited to 'src')
-rw-r--r--src/being/being.cpp45
-rw-r--r--src/enums/gui/usercolorid.h1
-rw-r--r--src/gui/userpalette.cpp6
3 files changed, 48 insertions, 4 deletions
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<size_t>(
"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