diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-05-09 22:59:16 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-05-09 22:59:16 +0300 |
commit | eb3cee0bc68ee576ed0eb429d22c6031f27def07 (patch) | |
tree | 8172ce45a24497942d489d350cc9cdb1340da97c /src | |
parent | aab80ddc8f56d6a383182ce5c241e9d94ca27bab (diff) | |
download | manaverse-eb3cee0bc68ee576ed0eb429d22c6031f27def07.tar.gz manaverse-eb3cee0bc68ee576ed0eb429d22c6031f27def07.tar.bz2 manaverse-eb3cee0bc68ee576ed0eb429d22c6031f27def07.tar.xz manaverse-eb3cee0bc68ee576ed0eb429d22c6031f27def07.zip |
Add option to allow automatically attack next target. (disabled by default)
Diffstat (limited to 'src')
-rw-r--r-- | src/defaults.cpp | 1 | ||||
-rw-r--r-- | src/gui/setup_other.cpp | 3 | ||||
-rw-r--r-- | src/localplayer.cpp | 16 | ||||
-rw-r--r-- | src/localplayer.h | 3 | ||||
-rw-r--r-- | src/net/ea/beinghandler.cpp | 2 |
5 files changed, 15 insertions, 10 deletions
diff --git a/src/defaults.cpp b/src/defaults.cpp index a5f8083c1..22ec65dfd 100644 --- a/src/defaults.cpp +++ b/src/defaults.cpp @@ -186,6 +186,7 @@ DefaultsData* getConfigDefaults() AddDEF(configData, "autofixPos", true); AddDEF(configData, "alphaCache", true); AddDEF(configData, "attackMoving", true); + AddDEF(configData, "attackNext", false); AddDEF(configData, "quickStats", true); AddDEF(configData, "warpParticle", false); AddDEF(configData, "autoShop", false); diff --git a/src/gui/setup_other.cpp b/src/gui/setup_other.cpp index aacc5d736..b88d82efa 100644 --- a/src/gui/setup_other.cpp +++ b/src/gui/setup_other.cpp @@ -101,6 +101,9 @@ Setup_Other::Setup_Other() new SetupItemCheckBox(_("Attack while moving"), "", "attackMoving", this, "attackMovingEvent"); + new SetupItemCheckBox(_("Attack next target"), "", + "attackNext", this, "attackNextEvent"); + new SetupItemCheckBox(_("Sync player move"), "", "syncPlayerMove", this, "syncPlayerMoveEvent"); diff --git a/src/localplayer.cpp b/src/localplayer.cpp index ade74edc1..68a2e295c 100644 --- a/src/localplayer.cpp +++ b/src/localplayer.cpp @@ -173,6 +173,7 @@ LocalPlayer::LocalPlayer(int id, int subtype): mDrawPath = config.getBoolValue("drawPath"); mServerAttack = config.getBoolValue("serverAttack"); mAttackMoving = config.getBoolValue("attackMoving"); + mAttackNext = config.getBoolValue("attackNext"); mShowJobExp = config.getBoolValue("showJobExp"); mEnableAdvert = config.getBoolValue("enableAdvert"); mTradebot = config.getBoolValue("tradebot"); @@ -194,6 +195,7 @@ LocalPlayer::LocalPlayer(int id, int subtype): config.addListener("drawPath", this); config.addListener("serverAttack", this); config.addListener("attackMoving", this); + config.addListener("attackNext", this); config.addListener("showJobExp", this); config.addListener("enableAdvert", this); config.addListener("tradebot", this); @@ -339,7 +341,7 @@ void LocalPlayer::logic() if (!mTarget->isAlive() && (!mTargetDeadPlayers || mTarget->getType() != Being::PLAYER)) { - stopAttack(); + stopAttack(true); } if (mKeepAttacking && mTarget) @@ -995,14 +997,9 @@ void LocalPlayer::setTarget(Being *target) return; if (target || mAction == ATTACK) - { mTargetTime = tick_time; - } else - { - mKeepAttacking = false; mTargetTime = -1; - } Being *oldTarget = nullptr; if (mTarget) @@ -1389,7 +1386,7 @@ void LocalPlayer::attack(Being *target, bool keep, bool dontChangeEquipment) stopAttack(); } -void LocalPlayer::stopAttack() +void LocalPlayer::stopAttack(bool keepAttack) { if (!Client::limitPackets(PACKET_STOPATTACK)) return; @@ -1398,6 +1395,8 @@ void LocalPlayer::stopAttack() Net::getPlayerHandler()->stopAttack(); untarget(); + if (!keepAttack || !mAttackNext) + mKeepAttacking = false; } void LocalPlayer::untarget() @@ -1408,7 +1407,6 @@ void LocalPlayer::untarget() if (mTarget) setTarget(nullptr); - mKeepAttacking = false; mLastTarget = -1; } @@ -1648,6 +1646,8 @@ void LocalPlayer::optionChanged(const std::string &value) mServerAttack = config.getBoolValue("serverAttack"); else if (value == "attackMoving") mAttackMoving = config.getBoolValue("attackMoving"); + else if (value == "attackNext") + mAttackNext = config.getBoolValue("attackNext"); else if (value == "showJobExp") mShowJobExp = config.getBoolValue("showJobExp"); else if (value == "enableAdvert") diff --git a/src/localplayer.h b/src/localplayer.h index 51d21178c..c02fc21ce 100644 --- a/src/localplayer.h +++ b/src/localplayer.h @@ -142,7 +142,7 @@ class LocalPlayer : public Being, public ActorSpriteListener, int getGMLevel() const { return mGMLevel; } - void stopAttack(); + void stopAttack(bool keepAttack = false); void untarget(); @@ -624,6 +624,7 @@ class LocalPlayer : public Being, public ActorSpriteListener, bool mSyncPlayerMove; bool mDrawPath; bool mAttackMoving; + bool mAttackNext; bool mShowJobExp; int mActivityTime; int mNavigateX; diff --git a/src/net/ea/beinghandler.cpp b/src/net/ea/beinghandler.cpp index 0c928f9fe..a773ef0b1 100644 --- a/src/net/ea/beinghandler.cpp +++ b/src/net/ea/beinghandler.cpp @@ -397,7 +397,7 @@ void BeingHandler::processBeingRemove(Net::MessageIn &msg) // If this is player's current target, clear it. if (dstBeing == player_node->getTarget()) - player_node->stopAttack(); + player_node->stopAttack(true); if (msg.readInt8() == 1) { |