From bb58d4020ff5d8ade0fec58d3e311ac211c262ef Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 16 Jun 2015 16:40:49 +0300 Subject: Allow set team color to being. --- src/being/being.cpp | 35 ++++++++++++++++++++++++++++++++--- 1 file changed, 32 insertions(+), 3 deletions(-) (limited to 'src/being/being.cpp') diff --git a/src/being/being.cpp b/src/being/being.cpp index c15c80df3..08f055ed2 100644 --- a/src/being/being.cpp +++ b/src/being/being.cpp @@ -216,6 +216,7 @@ Being::Being(const BeingId id, mKarma(0), mManner(0), mAreaSize(11), + mTeamId(0U), mLook(0U), mHairColor(0), mErased(false), @@ -2049,18 +2050,37 @@ void Being::showName() updateCoords(); } +void Being::setDefaultNameColor(const UserColorIdT defaultColor) +{ + switch (mTeamId) + { + case 0: + mNameColor = &userPalette->getColor(defaultColor); + break; + case 1: + mNameColor = &userPalette->getColor(UserColorId::TEAM1); + break; + case 2: + mNameColor = &userPalette->getColor(UserColorId::TEAM2); + break; + case 3: + mNameColor = &userPalette->getColor(UserColorId::TEAM3); + break; + } +} + void Being::updateColors() { if (userPalette) { if (mType == ActorType::Monster) { - mNameColor = &userPalette->getColor(UserColorId::MONSTER); + setDefaultNameColor(UserColorId::MONSTER); mTextColor = &userPalette->getColor(UserColorId::MONSTER); } else if (mType == ActorType::Npc) { - mNameColor = &userPalette->getColor(UserColorId::NPC); + setDefaultNameColor(UserColorId::NPC); mTextColor = &userPalette->getColor(UserColorId::NPC); } else if (this == localPlayer) @@ -2119,7 +2139,7 @@ void Being::updateColors() } else { - mNameColor = &userPalette->getColor(UserColorId::PC); + setDefaultNameColor(UserColorId::PC); } } @@ -3647,6 +3667,15 @@ void Being::recreateItemParticles() } } +void Being::setTeamId(const uint16_t teamId) +{ + if (mTeamId != teamId) + { + mTeamId = teamId; + updateColors(); + } +} + #ifdef EATHENA_SUPPORT void Being::setChat(ChatObject *const obj) { -- cgit v1.2.3-70-g09d2