diff options
Diffstat (limited to 'src/localplayer.cpp')
-rw-r--r-- | src/localplayer.cpp | 31 |
1 files changed, 28 insertions, 3 deletions
diff --git a/src/localplayer.cpp b/src/localplayer.cpp index 0da291711..27897a486 100644 --- a/src/localplayer.cpp +++ b/src/localplayer.cpp @@ -354,7 +354,8 @@ void LocalPlayer::logic() } } - if (mEnableAdvert && !mBlockAdvert && mAdvertTime < cur_time) + if (serverVersion < 4 && mEnableAdvert && !mBlockAdvert + && mAdvertTime < cur_time) { Uint8 smile = FLAG_SPECIAL; if (mTradebot && shopWindow && !shopWindow->isShopEmpty()) @@ -1782,7 +1783,7 @@ void LocalPlayer::moveToTarget(unsigned int dist) case 6: case 7: dist = mAttackRange; - if (dist == 1) + if (dist == 1 && serverVersion < 1) dist = 2; default: break; @@ -1874,6 +1875,9 @@ void LocalPlayer::changeMode(unsigned *var, unsigned limit, const char *conf, std::string (LocalPlayer::*func)(), unsigned def, bool save) { + if (!var) + return; + (*var) ++; if (*var >= limit) *var = def; @@ -3442,6 +3446,7 @@ void LocalPlayer::setAway(const std::string &message) if (!message.empty()) config.setValue("afkMessage", message); changeAwayMode(); + updateStatus(); } void LocalPlayer::setPseudoAway(const std::string &message) @@ -3716,7 +3721,8 @@ void LocalPlayer::attack2(Being *target, bool keep, bool dontChangeEquipment) changeEquipmentBeforeAttack(target); if ((!target || getAttackType() == 0 || getAttackType() == 3) - || (withinAttackRange(target, true, 1) + || (withinAttackRange(target, serverVersion < 1, + serverVersion < 1 ? 1 : 0) && getPathLength(target) <= getAttackRange2())) { attack(target, keep); @@ -4206,11 +4212,30 @@ const char *LocalPlayer::getVarItem(const char **arr, unsigned index, return arr[sz]; } +void LocalPlayer::updateStatus() +{ + if (serverVersion >= 4 && mEnableAdvert) + { + Uint8 status = 0; + if (mTradebot && shopWindow && !shopWindow->isShopEmpty()) + status += FLAG_SHOP; + + if (mAwayMode || mPseudoAwayMode) + status += FLAG_AWAY; + + if (mInactive) + status += FLAG_INACTIVE; + + Net::getPlayerHandler()->updateStatus(status); + } +} + void AwayListener::action(const gcn::ActionEvent &event) { if (event.getId() == "ok" && player_node && player_node->getAway()) { player_node->changeAwayMode(); + player_node->updateStatus(); if (outfitWindow) outfitWindow->unwearAwayOutfit(); if (miniStatusWindow) |