summaryrefslogtreecommitdiff
path: root/src/being.cpp
diff options
context:
space:
mode:
authorYohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer>2010-11-01 20:04:43 +0100
committerYohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer>2010-11-01 20:04:43 +0100
commit38f7cd9a9a49dc91b1c2e69b48308bd16d4b5aad (patch)
tree81d0e898790264114683cca9cfd3355bea114415 /src/being.cpp
parentc5e341f7b5f5e4efcabd09e00e177bb873db8097 (diff)
parent1f69108501c4bf51f3adac9ffbf7a7631fb12b9a (diff)
downloadmana-38f7cd9a9a49dc91b1c2e69b48308bd16d4b5aad.tar.gz
mana-38f7cd9a9a49dc91b1c2e69b48308bd16d4b5aad.tar.bz2
mana-38f7cd9a9a49dc91b1c2e69b48308bd16d4b5aad.tar.xz
mana-38f7cd9a9a49dc91b1c2e69b48308bd16d4b5aad.zip
Merge branch '0.5' of gitorious.org:mana/mana
Conflicts: src/being.cpp src/client.cpp src/commandhandler.cpp src/gui/setup_video.cpp src/gui/socialwindow.cpp src/gui/viewport.cpp src/gui/widgets/browserbox.cpp src/gui/widgets/itemcontainer.cpp src/imageparticle.cpp src/localplayer.cpp src/localplayer.h src/map.cpp src/net/tmwa/beinghandler.cpp src/particle.cpp src/particle.h src/player.cpp src/player.h
Diffstat (limited to 'src/being.cpp')
-rw-r--r--src/being.cpp75
1 files changed, 52 insertions, 23 deletions
diff --git a/src/being.cpp b/src/being.cpp
index 20225f47..0492727c 100644
--- a/src/being.cpp
+++ b/src/being.cpp
@@ -321,7 +321,15 @@ void Being::takeDamage(Being *attacker, int amount, AttackType type)
// Selecting the right color
if (type == CRITICAL || type == FLEE)
{
- color = &userPalette->getColor(UserPalette::HIT_CRITICAL);
+ if (attacker == player_node)
+ {
+ color = &userPalette->getColor(
+ UserPalette::HIT_LOCAL_PLAYER_CRITICAL);
+ }
+ else
+ {
+ color = &userPalette->getColor(UserPalette::HIT_CRITICAL);
+ }
}
else if (!amount)
{
@@ -329,7 +337,7 @@ void Being::takeDamage(Being *attacker, int amount, AttackType type)
{
// This is intended to be the wrong direction to visually
// differentiate between hits and misses
- color = &userPalette->getColor(UserPalette::HIT_MONSTER_PLAYER);
+ color = &userPalette->getColor(UserPalette::HIT_LOCAL_PLAYER_MISS);
}
else
{
@@ -338,7 +346,16 @@ void Being::takeDamage(Being *attacker, int amount, AttackType type)
}
else if (getType() == MONSTER)
{
- color = &userPalette->getColor(UserPalette::HIT_PLAYER_MONSTER);
+ if (attacker == player_node)
+ {
+ color = &userPalette->getColor(
+ UserPalette::HIT_LOCAL_PLAYER_MONSTER);
+ }
+ else
+ {
+ color = &userPalette->getColor(
+ UserPalette::HIT_PLAYER_MONSTER);
+ }
}
else
{
@@ -421,13 +438,15 @@ void Being::setShowName(bool doShowName)
void Being::setGuildName(const std::string &name)
{
- logger->log("Got guild name \"%s\" for being %s(%i)", name.c_str(), mName.c_str(), mId);
+ logger->log("Got guild name \"%s\" for being %s(%i)", name.c_str(),
+ mName.c_str(), mId);
}
void Being::setGuildPos(const std::string &pos)
{
- logger->log("Got guild position \"%s\" for being %s(%i)", pos.c_str(), mName.c_str(), mId);
+ logger->log("Got guild position \"%s\" for being %s(%i)", pos.c_str(),
+ mName.c_str(), mId);
}
void Being::addGuild(Guild *guild)
@@ -530,7 +549,8 @@ void Being::fireMissile(Being *victim, const std::string &particle)
if (!victim || particle.empty())
return;
- Particle *missile = particleEngine->addEffect(particle, getPixelX(), getPixelY());
+ Particle *missile = particleEngine->addEffect(particle,
+ getPixelX(), getPixelY());
if (missile)
{
@@ -625,22 +645,20 @@ void Being::setAction(Action action, int attackType)
void Being::setDirection(Uint8 direction)
{
- if (mDirection == direction)
- return;
+ if (Net::getNetworkType() == ServerInfo::MANASERV)
+ {
+ if (mDirection == direction)
+ return;
+ }
mDirection = direction;
- // if the direction does not change much, keep the common component
- int mFaceDirection = mDirection & direction;
- if (!mFaceDirection)
- mFaceDirection = direction;
-
SpriteDirection dir;
- if (mFaceDirection & UP)
+ if (mDirection & UP)
dir = DIRECTION_UP;
- else if (mFaceDirection & DOWN)
+ else if (mDirection & DOWN)
dir = DIRECTION_DOWN;
- else if (mFaceDirection & RIGHT)
+ else if (mDirection & RIGHT)
dir = DIRECTION_RIGHT;
else
dir = DIRECTION_LEFT;
@@ -649,7 +667,7 @@ void Being::setDirection(Uint8 direction)
CompoundSprite::setDirection(dir);
}
-/** TODO: Used by eAthena only */
+/** Note: Used by Tmw-Athena only */
void Being::nextTile()
{
if (mPath.empty())
@@ -939,7 +957,7 @@ void Being::drawSpeech(int offsetX, int offsetY)
}
}
-/** TODO: eAthena only */
+/** Note: Used by Tmw-Athena only */
int Being::getOffset(char pos, char neg) const
{
// Check whether we're walking in the requested direction
@@ -1012,12 +1030,23 @@ void Being::showName()
mDispName = 0;
std::string mDisplayName(mName);
- if (config.getBoolValue("showgender"))
+ Being* player = static_cast<Being*>(this);
+ if (player)
{
- if (getGender() == GENDER_FEMALE)
- mDisplayName += " \u2640";
- else if (getGender() == GENDER_MALE)
- mDisplayName += " \u2642";
+ if (config.getBoolValue("showgender"))
+ {
+ if (getGender() == GENDER_FEMALE)
+ mDisplayName += " \u2640";
+ else if (getGender() == GENDER_MALE)
+ mDisplayName += " \u2642";
+ }
+
+ // Display the IP when under tmw-Athena (GM only).
+ if (Net::getNetworkType() == ServerInfo::TMWATHENA && player_node
+ && player_node->getShowIp() && player->getIp())
+ {
+ mDisplayName += strprintf(" %s", ipToString(player->getIp()));
+ }
}
if (getType() == MONSTER)