diff options
author | David Athay <ko2fan@gmail.com> | 2009-05-19 15:58:58 +0100 |
---|---|---|
committer | David Athay <ko2fan@gmail.com> | 2009-05-19 15:58:58 +0100 |
commit | e975b11e1885457295a51778d8337b097549228d (patch) | |
tree | 09f340afb43894c87f38a0b198392305f67d6ee0 | |
parent | 3dd404ee8a02958089bf2c6901fb877d2fae760e (diff) | |
download | mana-client-e975b11e1885457295a51778d8337b097549228d.tar.gz mana-client-e975b11e1885457295a51778d8337b097549228d.tar.bz2 mana-client-e975b11e1885457295a51778d8337b097549228d.tar.xz mana-client-e975b11e1885457295a51778d8337b097549228d.zip |
Fixed targeting and warn on attack-range not being found in itemdb.
Tried to make the client continue attacking (it does not need to send
attack packets, but just continue playing attack animation and sounds).
Now logs a warning when a weapon is found without an attack-range (I
keep finding weapons with an attack-range of 0 which makes it hard to
target monsters).
-rw-r--r-- | src/gui/viewport.cpp | 12 | ||||
-rw-r--r-- | src/localplayer.cpp | 14 | ||||
-rw-r--r-- | src/net/tmwserv/protocol.h | 6 | ||||
-rw-r--r-- | src/resources/itemdb.cpp | 4 |
4 files changed, 15 insertions, 21 deletions
diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp index cbde95c4..787723c0 100644 --- a/src/gui/viewport.cpp +++ b/src/gui/viewport.cpp @@ -357,20 +357,12 @@ void Viewport::mousePressed(gcn::MouseEvent &event) if (player_node->withinAttackRange(being) || keyboard.isKeyActive(keyboard.KEY_ATTACK)) { - player_node->setGotoTarget(being); - player_node->attack(being, !keyboard.isKeyActive(keyboard.KEY_TARGET)); - } else { -#ifdef TMWSERV_SUPPORT - player_node->setDestination(event.getX() + (int) mPixelViewX, - event.getY() + (int) mPixelViewY); -#else - player_node->setDestination(tilex, tiley); -#endif + player_node->setGotoTarget(being); } break; default: @@ -399,9 +391,9 @@ void Viewport::mousePressed(gcn::MouseEvent &event) event.getY() + (int) mPixelViewY); } #else - player_node->stopAttack(); player_node->setDestination(tilex, tiley); #endif + player_node->stopAttack(); mPlayerFollowMouse = true; } } diff --git a/src/localplayer.cpp b/src/localplayer.cpp index b9f4b850..31b963ab 100644 --- a/src/localplayer.cpp +++ b/src/localplayer.cpp @@ -209,18 +209,14 @@ void LocalPlayer::logic() // Find whether target is in range const int rangeX = abs(mTarget->getPosition().x - getPosition().x); const int rangeY = abs(mTarget->getPosition().y - getPosition().y); - const int attackRange = getAttackRange(); - const int inRange = rangeX > attackRange || rangeY > attackRange - ? 1 : 0; #else // Find whether target is in range const int rangeX = abs(mTarget->mX - mX); const int rangeY = abs(mTarget->mY - mY); +#endif const int attackRange = getAttackRange(); const int inRange = rangeX > attackRange || rangeY > attackRange ? 1 : 0; -#endif - mTarget->setTargetAnimation( mTargetCursor[inRange][mTarget->getTargetCursorSize()]); @@ -290,9 +286,7 @@ void LocalPlayer::nextStep() if (mGoingToTarget && mTarget && withinAttackRange(mTarget)) { mAction = Being::STAND; -#ifdef EATHENA_SUPPORT attack(mTarget, true); -#endif mGoingToTarget = false; mPath.clear(); return; @@ -703,11 +697,11 @@ void LocalPlayer::attack(Being *target, bool keep) #else int dist_x = target->mX - mX; int dist_y = target->mY - mY; -#endif // Must be standing to attack if (mAction != STAND) return; +#endif if (abs(dist_y) >= abs(dist_x)) { @@ -744,10 +738,12 @@ void LocalPlayer::attack(Being *target, bool keep) sound.playSfx("sfx/fist-swish.ogg"); } +#ifdef EATHENA_SUPPORT Net::getPlayerHandler()->attack(target->getId()); if (!keep) stopAttack(); +#endif } void LocalPlayer::stopAttack() @@ -872,7 +868,7 @@ int LocalPlayer::getAttackRange() const ItemInfo info = weapon->getInfo(); return info.getAttackRange(); } - return 32; // unarmed range + return 48; // unarmed range #else return mAttackRange; #endif diff --git a/src/net/tmwserv/protocol.h b/src/net/tmwserv/protocol.h index 0f2a1b0d..6124263a 100644 --- a/src/net/tmwserv/protocol.h +++ b/src/net/tmwserv/protocol.h @@ -162,9 +162,11 @@ enum { CPMSG_GUILD_QUIT_RESPONSE = 0x0361, // B error PCMSG_GUILD_PROMOTE_MEMBER = 0x0365, // W guild, S name, B rights CPMSG_GUILD_PROMOTE_MEMBER_RESPONSE = 0x0366, // B error + PCMSG_GUILD_KICK_MEMBER = 0x0370, // W guild, S name + CPMSG_GUILD_KICK_MEMBER_RESPONSE = 0x0371, // B error - CPMSG_GUILD_INVITED = 0x0370, // S char name, S guild name, W id - CPMSG_GUILD_REJOIN = 0x0371, // S name, W guild, W rights, W channel, S announce + CPMSG_GUILD_INVITED = 0x0388, // S char name, S guild name, W id + CPMSG_GUILD_REJOIN = 0x0389, // S name, W guild, W rights, W channel, S announce // Party PCMSG_PARTY_INVITE = 0x03A0, // S name diff --git a/src/resources/itemdb.cpp b/src/resources/itemdb.cpp index 99907ca7..fa31c556 100644 --- a/src/resources/itemdb.cpp +++ b/src/resources/itemdb.cpp @@ -210,6 +210,10 @@ void ItemDB::load() } } + if (weaponType > 0) + if (attackRange == 0) + logger->log("ItemDB: Missing attack range from weapon %i!", id); + #define CHECK_PARAM(param, error_value) \ if (param == error_value) \ logger->log("ItemDB: Missing " #param " attribute for item %i!",id) |