summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2011-11-18 04:32:55 +0300
committerAndrei Karas <akaras@inbox.ru>2011-11-19 17:29:03 +0300
commit80c6992f9ccb088679cab206056caaafec33c287 (patch)
treeaa3c0d0dabf97d36fa18d04c52afd1576e926442 /src
parentf03bacd61c383ff642694489e0e39c43d5dd893a (diff)
downloadmanaplus-80c6992f9ccb088679cab206056caaafec33c287.tar.gz
manaplus-80c6992f9ccb088679cab206056caaafec33c287.tar.bz2
manaplus-80c6992f9ccb088679cab206056caaafec33c287.tar.xz
manaplus-80c6992f9ccb088679cab206056caaafec33c287.zip
Show changed yellow bar modes in debug chat tab.
Diffstat (limited to 'src')
-rw-r--r--src/gui/statuspopup.cpp411
-rw-r--r--src/gui/statuspopup.h5
-rw-r--r--src/gui/statuswindow.cpp289
-rw-r--r--src/gui/statuswindow.h4
-rw-r--r--src/localplayer.cpp482
-rw-r--r--src/localplayer.h35
6 files changed, 457 insertions, 769 deletions
diff --git a/src/gui/statuspopup.cpp b/src/gui/statuspopup.cpp
index 5f2ec71e3..a77af4478 100644
--- a/src/gui/statuspopup.cpp
+++ b/src/gui/statuspopup.cpp
@@ -187,387 +187,52 @@ void StatusPopup::view(int x, int y)
requestMoveToTop();
}
-void StatusPopup::setLabelText(gcn::Label *label, char *text, int key)
+void StatusPopup::setLabelText(gcn::Label *label, const char *text, int key)
{
label->setCaption(strprintf("%s %s", text,
keyboard.getKeyValueString(key).c_str()));
}
+void StatusPopup::setLabelText2(gcn::Label *label, std::string text, int key)
+{
+ label->setCaption(strprintf("%s %s", text.c_str(),
+ keyboard.getKeyValueString(key).c_str()));
+ label->adjustSize();
+}
+
void StatusPopup::updateLabels()
{
if (!player_node || !viewport)
return;
- switch (player_node->getInvertDirection())
- {
- case 0:
- setLabelText(mMoveType, _("(D) default moves"),
- keyboard.KEY_INVERT_DIRECTION);
- break;
-
- case 1:
- setLabelText(mMoveType, _("(I) invert moves"),
- keyboard.KEY_INVERT_DIRECTION);
- break;
-
- case 2:
- setLabelText(mMoveType, _("(c) moves with some crazy moves"),
- keyboard.KEY_INVERT_DIRECTION);
- break;
-
- case 3:
- setLabelText(mMoveType, _("(C) moves with crazy moves"),
- keyboard.KEY_INVERT_DIRECTION);
- break;
-
- case 4:
- setLabelText(mMoveType, _("(d) double normal + crazy"),
- keyboard.KEY_INVERT_DIRECTION);
- break;
-
- default:
- setLabelText(mMoveType, _("(?) move"),
- keyboard.KEY_INVERT_DIRECTION);
- break;
- }
- mMoveType->adjustSize();
-
- if (player_node->getCrazyMoveType() < 10)
- {
- mCrazyMoveType->setCaption(strprintf("(%d) crazy move number %d %s",
- player_node->getCrazyMoveType(), player_node->getCrazyMoveType(),
- keyboard.getKeyValueString(
- keyboard.KEY_CHANGE_CRAZY_MOVES_TYPE).c_str()));
- }
- else
- {
- switch (player_node->getCrazyMoveType())
- {
- case 10:
- setLabelText(mCrazyMoveType, _("(a) custom crazy move"),
- keyboard.KEY_CHANGE_CRAZY_MOVES_TYPE);
- break;
- default:
- setLabelText(mCrazyMoveType, _("(?) crazy move"),
- keyboard.KEY_CHANGE_CRAZY_MOVES_TYPE);
- break;
- }
- }
- mCrazyMoveType->adjustSize();
-
- switch (player_node->getMoveToTargetType())
- {
- case 0:
- setLabelText(mMoveToTargetType, _("(0) default moves to target"),
- keyboard.KEY_CHANGE_MOVE_TO_TARGET);
- break;
- case 1:
- setLabelText(mMoveToTargetType,
- _("(1) moves to target in distance 1"),
- keyboard.KEY_CHANGE_MOVE_TO_TARGET);
- break;
- case 2:
- setLabelText(mMoveToTargetType,
- _("(2) moves to target in distance 2"),
- keyboard.KEY_CHANGE_MOVE_TO_TARGET);
- break;
- case 3:
- setLabelText(mMoveToTargetType,
- _("(3) moves to target in distance 3"),
- keyboard.KEY_CHANGE_MOVE_TO_TARGET);
- break;
- case 4:
- setLabelText(mMoveToTargetType,
- _("(5) moves to target in distance 5"),
- keyboard.KEY_CHANGE_MOVE_TO_TARGET);
- break;
- case 5:
- setLabelText(mMoveToTargetType,
- _("(7) moves to target in distance 7"),
- keyboard.KEY_CHANGE_MOVE_TO_TARGET);
- break;
- case 6:
- setLabelText(mMoveToTargetType,
- _("(A) moves to target in attack range"),
- keyboard.KEY_CHANGE_MOVE_TO_TARGET);
- break;
- case 7:
- setLabelText(mMoveToTargetType,
- _("(a) archer attack range"),
- keyboard.KEY_CHANGE_MOVE_TO_TARGET);
- break;
- default:
- setLabelText(mMoveToTargetType,
- _("(?) move to target"), keyboard.KEY_CHANGE_MOVE_TO_TARGET);
- break;
- }
- mMoveToTargetType->adjustSize();
-
- switch (player_node->getFollowMode())
- {
- case 0:
- setLabelText(mFollowMode, _("(D) default follow"),
- keyboard.KEY_CHANGE_FOLLOW_MODE);
- break;
- case 1:
- setLabelText(mFollowMode, _("(R) relative follow"),
- keyboard.KEY_CHANGE_FOLLOW_MODE);
- break;
- case 2:
- setLabelText(mFollowMode, _("(M) mirror follow"),
- keyboard.KEY_CHANGE_FOLLOW_MODE);
- break;
- case 3:
- setLabelText(mFollowMode, _("(P) pet follow"),
- keyboard.KEY_CHANGE_FOLLOW_MODE);
- break;
- default:
- setLabelText(mFollowMode, _("(?) unknown follow"),
- keyboard.KEY_CHANGE_FOLLOW_MODE);
- break;
- }
- mFollowMode->adjustSize();
-
- switch (player_node->getAttackWeaponType())
- {
- case 1:
- setLabelText(mAttackWeaponType, _("(D) default attack"),
- keyboard.KEY_CHANGE_ATTACK_WEAPON_TYPE);
- break;
- case 2:
- setLabelText(mAttackWeaponType,
- _("(s) switch attack without shield"),
- keyboard.KEY_CHANGE_ATTACK_WEAPON_TYPE);
- break;
- case 3:
- setLabelText(mAttackWeaponType,
- _("(S) switch attack with shield"),
- keyboard.KEY_CHANGE_ATTACK_WEAPON_TYPE);
- break;
- default:
- setLabelText(mAttackWeaponType, _("(?) attack"),
- keyboard.KEY_CHANGE_ATTACK_WEAPON_TYPE);
- break;
- }
- mAttackWeaponType->adjustSize();
-
- switch (player_node->getAttackType())
- {
- case 0:
- setLabelText(mAttackType, _("(D) default attack"),
- keyboard.KEY_CHANGE_ATTACK_TYPE);
- break;
- case 1:
- setLabelText(mAttackType, _("(G) go and attack"),
- keyboard.KEY_CHANGE_ATTACK_TYPE);
- break;
- case 2:
- setLabelText(mAttackType, _("(A) go, attack, pickup"),
- keyboard.KEY_CHANGE_ATTACK_TYPE);
- break;
- case 3:
- setLabelText(mAttackType, _("(d) without auto attack"),
- keyboard.KEY_CHANGE_ATTACK_TYPE);
- break;
- default:
- setLabelText(mAttackType, _("(?) attack"),
- keyboard.KEY_CHANGE_ATTACK_TYPE);
- break;
- }
- mAttackType->adjustSize();
-
- mDropCounter->setCaption(strprintf("(%d) drop counter %d %s",
- player_node->getQuickDropCounter(), player_node->getQuickDropCounter(),
- keyboard.getKeyValueString(keyboard.KEY_SWITCH_QUICK_DROP).c_str()));
- mDropCounter->adjustSize();
-
- switch (player_node->getPickUpType())
- {
- case 0:
- setLabelText(mPickUpType, _("(S) small pick up 1x1 cells"),
- keyboard.KEY_CHANGE_PICKUP_TYPE);
- break;
- case 1:
- setLabelText(mPickUpType, _("(D) default pick up 2x1 cells"),
- keyboard.KEY_CHANGE_PICKUP_TYPE);
- break;
- case 2:
- setLabelText(mPickUpType, _("(F) forward pick up 2x3 cells"),
- keyboard.KEY_CHANGE_PICKUP_TYPE);
- break;
- case 3:
- setLabelText(mPickUpType, _("(3) pick up 3x3 cells"),
- keyboard.KEY_CHANGE_PICKUP_TYPE);
- break;
- case 4:
- setLabelText(mPickUpType, _("(g) go and pick up in distance 4"),
- keyboard.KEY_CHANGE_PICKUP_TYPE);
- break;
- case 5:
- setLabelText(mPickUpType, _("(G) go and pick up in distance 8"),
- keyboard.KEY_CHANGE_PICKUP_TYPE);
- break;
- case 6:
- setLabelText(mPickUpType, _("(A) go and pick up in max distance"),
- keyboard.KEY_CHANGE_PICKUP_TYPE);
- break;
- default:
- setLabelText(mPickUpType, _("(?) pick up"),
- keyboard.KEY_CHANGE_PICKUP_TYPE);
- break;
- }
- mPickUpType->adjustSize();
-
- switch (viewport->getDebugPath())
- {
- case 0:
- setLabelText(mMapType, _("(N) normal map view"),
- keyboard.KEY_PATHFIND);
- break;
- case 1:
- setLabelText(mMapType, _("(D) debug map view"),
- keyboard.KEY_PATHFIND);
- break;
- case 2:
- setLabelText(mMapType, _("(u) ultra map view"),
- keyboard.KEY_PATHFIND);
- break;
- case 3:
- setLabelText(mMapType, _("(U) ultra map view 2"),
- keyboard.KEY_PATHFIND);
- break;
- case 4:
- setLabelText(mMapType, _("(e) empty map view"),
- keyboard.KEY_PATHFIND);
- break;
- case 5:
- setLabelText(mMapType, _("(b) black & white map view"),
- keyboard.KEY_PATHFIND);
- break;
- default:
- setLabelText(mMapType, _("(?) map view"), keyboard.KEY_PATHFIND);
- break;
- }
- mMapType->adjustSize();
-
- switch (player_node->getMagicAttackType())
- {
- case 0:
- setLabelText(mMagicAttackType, _("(f) use #flar for magic attack"),
- keyboard.KEY_SWITCH_MAGIC_ATTACK);
- break;
- case 1:
- setLabelText(mMagicAttackType,
- _("(c) use #chiza for magic attack"),
- keyboard.KEY_SWITCH_MAGIC_ATTACK);
- break;
- case 2:
- setLabelText(mMagicAttackType,
- _("(I) use #ingrav for magic attack"),
- keyboard.KEY_SWITCH_MAGIC_ATTACK);
- break;
- case 3:
- setLabelText(mMagicAttackType,
- _("(F) use #frillyar for magic attack"),
- keyboard.KEY_SWITCH_MAGIC_ATTACK);
- break;
- case 4:
- setLabelText(mMagicAttackType,
- _("(U) use #upmarmu for magic attack"),
- keyboard.KEY_SWITCH_MAGIC_ATTACK);
- break;
- default:
- setLabelText(mMagicAttackType, _("(?) magic attack"),
- keyboard.KEY_SWITCH_MAGIC_ATTACK);
- break;
- }
- mMagicAttackType->adjustSize();
-
- switch (player_node->getPvpAttackType())
- {
- case 0:
- setLabelText(mPvpAttackType, _("(a) attack all players"),
- keyboard.KEY_SWITCH_PVP_ATTACK);
- break;
- case 1:
- setLabelText(mPvpAttackType, _("(f) attack not friends"),
- keyboard.KEY_SWITCH_PVP_ATTACK);
- break;
- case 2:
- setLabelText(mPvpAttackType, _("(b) attack bad relations"),
- keyboard.KEY_SWITCH_PVP_ATTACK);
- break;
- case 3:
- setLabelText(mPvpAttackType, _("(d) dont attack players"),
- keyboard.KEY_SWITCH_PVP_ATTACK);
- break;
- default:
- setLabelText(mMagicAttackType, _("(?) pvp attack"),
- keyboard.KEY_SWITCH_MAGIC_ATTACK);
- break;
- }
- mPvpAttackType->adjustSize();
-
- switch (player_node->getImitationMode())
- {
- case 0:
- setLabelText(mImitationMode, _("(D) default imitation"),
- keyboard.KEY_CHANGE_IMITATION_MODE);
- break;
- case 1:
- setLabelText(mImitationMode, _("(O) outfits imitation"),
- keyboard.KEY_CHANGE_IMITATION_MODE);
- break;
- default:
- setLabelText(mImitationMode, _("(?) imitation"),
- keyboard.KEY_CHANGE_IMITATION_MODE);
- break;
- }
- mImitationMode->adjustSize();
-
- switch ((int)player_node->getAway())
- {
- case 0:
- setLabelText(mAwayMode, _("(O) on keyboard"), keyboard.KEY_AWAY);
- break;
- case 1:
- setLabelText(mAwayMode, _("(A) away"), keyboard.KEY_AWAY);
- break;
- default:
- setLabelText(mAwayMode, _("(?) away"), keyboard.KEY_AWAY);
- break;
- }
- mAwayMode->adjustSize();
-
- switch (viewport->getCameraMode())
- {
- case 0:
- setLabelText(mCameraMode, _("(G) game camera mode"),
- keyboard.KEY_CAMERA);
- break;
- case 1:
- setLabelText(mCameraMode, _("(F) free camera mode"),
- keyboard.KEY_CAMERA);
- break;
- case 2:
- setLabelText(mCameraMode, _("(D) design camera mode"),
- keyboard.KEY_CAMERA);
- break;
- default:
- setLabelText(mCameraMode, _("(?) away"), keyboard.KEY_CAMERA);
- break;
- }
- mCameraMode->adjustSize();
-
- if (player_node->getDisableGameModifiers())
- {
- setLabelText(mDisableGameModifiers, _("Game modifiers are disabled"),
- keyboard.KEY_DISABLE_GAME_MODIFIERS);
- }
- else
- {
- setLabelText(mDisableGameModifiers, _("Game modifiers are enabled"),
- keyboard.KEY_DISABLE_GAME_MODIFIERS);
- }
- mDisableGameModifiers->adjustSize();
+ setLabelText2(mMoveType, player_node->getInvertDirectionString(),
+ keyboard.KEY_INVERT_DIRECTION);
+ setLabelText2(mCrazyMoveType, player_node->getCrazyMoveTypeString(),
+ keyboard.KEY_CHANGE_CRAZY_MOVES_TYPE);
+ setLabelText2(mMoveToTargetType, player_node->getMoveToTargetTypeString(),
+ keyboard.KEY_CHANGE_MOVE_TO_TARGET);
+ setLabelText2(mFollowMode, player_node->getFollowModeString(),
+ keyboard.KEY_CHANGE_FOLLOW_MODE);
+ setLabelText2(mAttackWeaponType, player_node->getAttackWeaponTypeString(),
+ keyboard.KEY_CHANGE_ATTACK_WEAPON_TYPE);
+ setLabelText2(mAttackType, player_node->getAttackTypeString(),
+ keyboard.KEY_CHANGE_ATTACK_TYPE);
+ setLabelText2(mDropCounter, player_node->getQuickDropCounterString(),
+ keyboard.KEY_SWITCH_QUICK_DROP);
+ setLabelText2(mPickUpType, player_node->getPickUpTypeString(),
+ keyboard.KEY_CHANGE_PICKUP_TYPE);
+ setLabelText2(mMapType, player_node->getDebugPathString(),
+ keyboard.KEY_PATHFIND);
+ setLabelText2(mMagicAttackType, player_node->getMagicAttackString(),
+ keyboard.KEY_SWITCH_MAGIC_ATTACK);
+ setLabelText2(mPvpAttackType, player_node->getPvpAttackString(),
+ keyboard.KEY_SWITCH_PVP_ATTACK);
+ setLabelText2(mImitationMode, player_node->getImitationModeString(),
+ keyboard.KEY_CHANGE_IMITATION_MODE);
+ setLabelText2(mAwayMode, player_node->getAwayModeString(),
+ keyboard.KEY_AWAY);
+ setLabelText2(mCameraMode, player_node->getCameraModeString(),
+ keyboard.KEY_CAMERA);
+ setLabelText2(mDisableGameModifiers, player_node->getGameModifiersString(),
+ keyboard.KEY_DISABLE_GAME_MODIFIERS);
}
diff --git a/src/gui/statuspopup.h b/src/gui/statuspopup.h
index 2af8064c5..976b5e57b 100644
--- a/src/gui/statuspopup.h
+++ b/src/gui/statuspopup.h
@@ -60,7 +60,10 @@ class StatusPopup : public Popup
private:
void updateLabels();
- void setLabelText(gcn::Label *label, char *text, int key);
+
+ void setLabelText(gcn::Label *label, const char *text, int key);
+
+ void setLabelText2(gcn::Label *label, std::string text, int key);
gcn::Label *mMoveType;
gcn::Label *mCrazyMoveType;
diff --git a/src/gui/statuswindow.cpp b/src/gui/statuswindow.cpp
index 37a706baf..5ac14d132 100644
--- a/src/gui/statuswindow.cpp
+++ b/src/gui/statuswindow.cpp
@@ -624,7 +624,7 @@ void StatusWindow::updateInvSlotsBar(ProgressBar *bar)
bar->setText(strprintf("%d", usedSlots));
}
-std::string StatusWindow::translateLetter(char* letters)
+std::string StatusWindow::translateLetter(const char* letters)
{
char buf[2];
char *str = gettext(letters);
@@ -636,277 +636,34 @@ std::string StatusWindow::translateLetter(char* letters)
return std::string(buf);
}
+std::string StatusWindow::translateLetter2(std::string letters)
+{
+ if (letters.size() < 5)
+ return "";
+
+ return std::string(gettext(letters.substr(1, 1).c_str()));
+}
+
void StatusWindow::updateStatusBar(ProgressBar *bar, bool percent A_UNUSED)
{
if (!player_node || !viewport)
return;
- std::string str;
-
- switch (player_node->getInvertDirection())
- {
- case 0:
- str = translateLetter(N_("(D)"));
- break;
- case 1:
- str = translateLetter(N_("(I)"));
- break;
- case 2:
- str = translateLetter(N_("(c)"));
- break;
- case 3:
- str = translateLetter(N_("(C)"));
- break;
- case 4:
- str = translateLetter(N_("(d)"));
- break;
- default:
- str = translateLetter(N_("(?)"));
- break;
- }
-
- if (player_node->getCrazyMoveType() < 10)
- str += toString(player_node->getCrazyMoveType());
- else
- {
- switch (player_node->getCrazyMoveType())
- {
- case 10:
- str += translateLetter(N_("(a)"));
- break;
- default:
- str += translateLetter(N_("(?)"));
- break;
- }
- }
-
- switch (player_node->getMoveToTargetType())
- {
- case 0:
- str += translateLetter(N_("(0)"));
- break;
- case 1:
- str += translateLetter(N_("(1)"));
- break;
- case 2:
- str += translateLetter(N_("(2)"));
- break;
- case 3:
- str += translateLetter(N_("(3)"));
- break;
- case 4:
- str += translateLetter(N_("(5)"));
- break;
- case 5:
- str += translateLetter(N_("(7)"));
- break;
- case 6:
- str += translateLetter(N_("(A)"));
- break;
- case 7:
- str += translateLetter(N_("(a)"));
- break;
- default:
- str += translateLetter(N_("(?)"));
- break;
- }
-
- switch (player_node->getFollowMode())
- {
- case 0:
- str += translateLetter(N_("(D)"));
- break;
- case 1:
- str += translateLetter(N_("(R)"));
- break;
- case 2:
- str += translateLetter(N_("(M)"));
- break;
- case 3:
- str += translateLetter(N_("(P)"));
- break;
- default:
- str += translateLetter(N_("(?)"));
- break;
- }
-
- str += " ";
- switch (player_node->getAttackWeaponType())
- {
- case 1:
- str += translateLetter(N_("(D)"));
- break;
- case 2:
- str += translateLetter(N_("(s)"));
- break;
- case 3:
- str += translateLetter(N_("(S)"));
- break;
- default:
- str += translateLetter(N_("(?)"));
- break;
- }
-
- switch (player_node->getAttackType())
- {
- case 0:
- str += translateLetter(N_("(D)"));
- break;
- case 1:
- str += translateLetter(N_("(G)"));
- break;
- case 2:
- str += translateLetter(N_("(A)"));
- break;
- case 3:
- str += translateLetter(N_("(d)"));
- break;
- default:
- str += translateLetter(N_("(?)"));
- break;
- }
-
- switch (player_node->getMagicAttackType())
- {
- case 0:
- str += translateLetter(N_("(f)"));
- break;
- case 1:
- str += translateLetter(N_("(c)"));
- break;
- case 2:
- str += translateLetter(N_("(I)"));
- break;
- case 3:
- str += translateLetter(N_("(F)"));
- break;
- case 4:
- str += translateLetter(N_("(U)"));
- break;
- default:
- str += translateLetter(N_("(?)"));
- break;
- }
-
- switch (player_node->getPvpAttackType())
- {
- case 0:
- str += translateLetter(N_("(a)"));
- break;
- case 1:
- str += translateLetter(N_("(f)"));
- break;
- case 2:
- str += translateLetter(N_("(b)"));
- break;
- case 3:
- str += translateLetter(N_("(d)"));
- break;
- default:
- str += translateLetter(N_("(?)"));
- break;
- }
-
- str += " " + toString(player_node->getQuickDropCounter());
-
- switch (player_node->getPickUpType())
- {
- case 0:
- str += translateLetter(N_("(S)"));
- break;
- case 1:
- str += translateLetter(N_("(D)"));
- break;
- case 2:
- str += translateLetter(N_("(F)"));
- break;
- case 3:
- str += translateLetter(N_("(3)"));
- break;
- case 4:
- str += translateLetter(N_("(g)"));
- break;
- case 5:
- str += translateLetter(N_("(G)"));
- break;
- case 6:
- str += translateLetter(N_("(A)"));
- break;
- default:
- str += translateLetter(N_("(?)"));
- break;
- }
-
- str += " ";
- switch (viewport->getDebugPath())
- {
- case 0:
- str += translateLetter(N_("(N)"));
- break;
- case 1:
- str += translateLetter(N_("(D)"));
- break;
- case 2:
- str += translateLetter(N_("(u)"));
- break;
- case 3:
- str += translateLetter(N_("(U)"));
- break;
- case 4:
- str += translateLetter(N_("(e)"));
- break;
- case 5:
- str += translateLetter(N_("(b)"));
- break;
- default:
- str += translateLetter(N_("(?)"));
- break;
- }
-
- str += " ";
- switch (player_node->getImitationMode())
- {
- case 0:
- str += translateLetter(N_("(D)"));
- break;
- case 1:
- str += translateLetter(N_("(O)"));
- break;
- default:
- str += translateLetter(N_("(?)"));
- break;
- }
-
- switch (viewport->getCameraMode())
- {
- case 0:
- str += translateLetter(N_("(G)"));
- break;
- case 1:
- str += translateLetter(N_("(F)"));
- break;
- case 2:
- str += translateLetter(N_("(D)"));
- break;
- default:
- str += translateLetter(N_("(?)"));
- break;
- }
-
- switch ((int)player_node->getAway())
- {
- case 0:
- str += translateLetter(N_("(O)"));
- break;
- case 1:
- str += translateLetter(N_("(A)"));
- break;
- default:
- str += translateLetter(N_("(?)"));
- break;
- }
+ bar->setText(translateLetter2(player_node->getInvertDirectionString())
+ += translateLetter2(player_node->getCrazyMoveTypeString())
+ += translateLetter2(player_node->getMoveToTargetTypeString())
+ += translateLetter2(player_node->getFollowModeString())
+ += " " + translateLetter2(player_node->getAttackWeaponTypeString())
+ += translateLetter2(player_node->getAttackTypeString())
+ += translateLetter2(player_node->getMagicAttackString())
+ += translateLetter2(player_node->getPvpAttackString())
+ += " " + translateLetter2(player_node->getQuickDropCounterString())
+ += translateLetter2(player_node->getPickUpTypeString())
+ += " " + translateLetter2(player_node->getDebugPathString())
+ += " " + translateLetter2(player_node->getImitationModeString())
+ += translateLetter2(player_node->getCameraModeString())
+ += translateLetter2(player_node->getAwayModeString()));
- bar->setText(str);
bar->setProgress(50);
if (player_node->getDisableGameModifiers())
{
diff --git a/src/gui/statuswindow.h b/src/gui/statuswindow.h
index fa957d059..0af8d4276 100644
--- a/src/gui/statuswindow.h
+++ b/src/gui/statuswindow.h
@@ -82,7 +82,9 @@ class StatusWindow : public Window,
void action(const gcn::ActionEvent &event);
private:
- static std::string translateLetter(char* letters);
+ static std::string translateLetter(const char* letters);
+
+ static std::string translateLetter2(std::string letters);
/**
* Status Part
diff --git a/src/localplayer.cpp b/src/localplayer.cpp
index 0739ab538..51f1f244e 100644
--- a/src/localplayer.cpp
+++ b/src/localplayer.cpp
@@ -1867,84 +1867,384 @@ void LocalPlayer::moveToHome()
}
}
-void LocalPlayer::changeAttackWeaponType()
-{
- mAttackWeaponType++;
- if (mAttackWeaponType > 3)
- mAttackWeaponType = 1;
-
- config.setValue("attackWeaponType", mAttackWeaponType);
- if (miniStatusWindow)
- miniStatusWindow->updateStatus();
-}
+static const unsigned invertDirectionSize = 5;
-void LocalPlayer::changeAttackType()
+void LocalPlayer::changeMode(unsigned *var, unsigned limit, const char *conf,
+ std::string (LocalPlayer::*func)(), unsigned def)
{
- mAttackType++;
- if (mAttackType > 3)
- mAttackType = 0;
-
- config.setValue("attackType", mAttackType);
+ (*var) ++;
+ if (*var >= limit)
+ *var = def;
+ config.setValue(conf, *var);
if (miniStatusWindow)
miniStatusWindow->updateStatus();
+ const std::string str = (this->*func)();
+ if (str.size() > 4)
+ debugMsg(str.substr(4));
}
void LocalPlayer::invertDirection()
{
mMoveState = 0;
- mInvertDirection ++;
- if (mInvertDirection > 4)
- mInvertDirection = 0;
- config.setValue("invertMoveDirection", mInvertDirection);
- if (miniStatusWindow)
- miniStatusWindow->updateStatus();
+ changeMode(&mInvertDirection, invertDirectionSize, "invertMoveDirection",
+ &LocalPlayer::getInvertDirectionString);
}
+static const char *invertDirectionStrings[] =
+{
+ N_("(D) default moves"),
+ N_("(I) invert moves"),
+ N_("(c) moves with some crazy moves"),
+ N_("(C) moves with crazy moves"),
+ N_("(d) double normal + crazy"),
+ N_("(?) unknown move")
+};
+
+std::string LocalPlayer::getInvertDirectionString()
+{
+ return gettext(getVarItem(&invertDirectionStrings[0],
+ mInvertDirection, invertDirectionSize));
+}
+
+static const unsigned crazyMoveTypeSize = 11;
+
void LocalPlayer::changeCrazyMoveType()
{
mCrazyMoveState = 0;
- mCrazyMoveType++;
- if (mCrazyMoveType > 10)
- mCrazyMoveType = 1;
+ changeMode(&mCrazyMoveType, crazyMoveTypeSize, "crazyMoveType",
+ &LocalPlayer::getCrazyMoveTypeString, 1);
+}
- config.setValue("crazyMoveType", mCrazyMoveType);
- if (miniStatusWindow)
- miniStatusWindow->updateStatus();
+std::string LocalPlayer::getCrazyMoveTypeString()
+{
+ if (mCrazyMoveType < crazyMoveTypeSize - 1)
+ {
+ return strprintf(_("(%d) crazy move number %d"),
+ mCrazyMoveType, mCrazyMoveType);
+ }
+ else if (mCrazyMoveType == crazyMoveTypeSize - 1)
+ {
+ return _("(a) custom crazy move");
+ }
+ else
+ {
+ return _("(?) crazy move");
+ }
}
-void LocalPlayer::changePickUpType()
+static const unsigned moveToTargetTypeSize = 8;
+
+void LocalPlayer::changeMoveToTargetType()
{
- mPickUpType++;
- if (mPickUpType > 6)
- mPickUpType = 0;
+ changeMode(&mMoveToTargetType, moveToTargetTypeSize, "moveToTargetType",
+ &LocalPlayer::getMoveToTargetTypeString);
+}
- config.setValue("pickUpType", mPickUpType);
- if (miniStatusWindow)
- miniStatusWindow->updateStatus();
+static const char *moveToTargetTypeStrings[] =
+{
+ N_("(0) default moves to target"),
+ N_("(1) moves to target in distance 1"),
+ N_("(2) moves to target in distance 2"),
+ N_("(3) moves to target in distance 3"),
+ N_("(5) moves to target in distance 5"),
+ N_("(7) moves to target in distance 7"),
+ N_("(A) moves to target in attack range"),
+ N_("(a) archer attack range"),
+ N_("(?) move to target")
+};
+
+std::string LocalPlayer::getMoveToTargetTypeString()
+{
+ return gettext(getVarItem(&moveToTargetTypeStrings[0],
+ mMoveToTargetType, moveToTargetTypeSize));
}
+static const unsigned followModeSize = 4;
+
void LocalPlayer::changeFollowMode()
{
- mFollowMode++;
- if (mFollowMode > 3)
- mFollowMode = 0;
+ changeMode(&mFollowMode, followModeSize, "followMode",
+ &LocalPlayer::getFollowModeString);
+}
- config.setValue("followMode", mFollowMode);
- if (miniStatusWindow)
- miniStatusWindow->updateStatus();
+static const char *followModeStrings[] =
+{
+ N_("(D) default follow"),
+ N_("(R) relative follow"),
+ N_("(M) mirror follow"),
+ N_("(P) pet follow"),
+ N_("(?) unknown follow")
+};
+
+std::string LocalPlayer::getFollowModeString()
+{
+ return gettext(getVarItem(&followModeStrings[0],
+ mFollowMode, followModeSize));
+}
+
+const unsigned attackWeaponTypeSize = 4;
+
+void LocalPlayer::changeAttackWeaponType()
+{
+ changeMode(&mAttackWeaponType, attackWeaponTypeSize, "attackWeaponType",
+ &LocalPlayer::getAttackWeaponTypeString, 1);
}
+static const char *attackWeaponTypeStrings[] =
+{
+ N_("(?) attack"),
+ N_("(D) default attack"),
+ N_("(s) switch attack without shield"),
+ N_("(S) switch attack with shield"),
+ N_("(?) attack")
+};
+
+std::string LocalPlayer::getAttackWeaponTypeString()
+{
+ return gettext(getVarItem(&attackWeaponTypeStrings[0],
+ mAttackWeaponType, attackWeaponTypeSize));
+}
+
+const unsigned attackTypeSize = 4;
+
+void LocalPlayer::changeAttackType()
+{
+ changeMode(&mAttackType, attackTypeSize, "attackType",
+ &LocalPlayer::getAttackTypeString);
+}
+
+static const char *attackTypeStrings[] =
+{
+ N_("(D) default attack"),
+ N_("(G) go and attack"),
+ N_("(A) go, attack, pickup"),
+ N_("(d) without auto attack"),
+ N_("(?) attack")
+};
+
+std::string LocalPlayer::getAttackTypeString()
+{
+ return gettext(getVarItem(&attackTypeStrings[0],
+ mAttackType, attackTypeSize));
+}
+
+const unsigned quickDropCounterSize = 10;
+
+void LocalPlayer::changeQuickDropCounter()
+{
+ changeMode(&mQuickDropCounter, quickDropCounterSize, "quickDropCounter",
+ &LocalPlayer::getQuickDropCounterString, 1);
+}
+
+std::string LocalPlayer::getQuickDropCounterString()
+{
+ return strprintf("(%d) drop counter %d",
+ mQuickDropCounter, mQuickDropCounter);
+}
+
+const unsigned pickUpTypeSize = 7;
+
+void LocalPlayer::changePickUpType()
+{
+ changeMode(&mPickUpType, pickUpTypeSize, "pickUpType",
+ &LocalPlayer::getPickUpTypeString);
+}
+
+static const char *pickUpTypeStrings[] =
+{
+ N_("(S) small pick up 1x1 cells"),
+ N_("(D) default pick up 2x1 cells"),
+ N_("(F) forward pick up 2x3 cells"),
+ N_("(3) pick up 3x3 cells"),
+ N_("(g) go and pick up in distance 4"),
+ N_("(G) go and pick up in distance 8"),
+ N_("(A) go and pick up in max distance"),
+ N_("(?) pick up")
+};
+
+std::string LocalPlayer::getPickUpTypeString()
+{
+ return gettext(getVarItem(&pickUpTypeStrings[0],
+ mPickUpType, pickUpTypeSize));
+}
+
+const unsigned debugPathSize = 5;
+
+static const char *debugPathStrings[] =
+{
+ N_("(N) normal map view"),
+ N_("(D) debug map view"),
+ N_("(u) ultra map view"),
+ N_("(U) ultra map view 2"),
+ N_("(e) empty map view"),
+ N_("(b) black & white map view")
+};
+
+std::string LocalPlayer::getDebugPathString()
+{
+ return gettext(getVarItem(&debugPathStrings[0],
+ viewport->getDebugPath(), debugPathSize));
+}
+
+const unsigned magicAttackSize = 5;
+
+void LocalPlayer::switchMagicAttack()
+{
+ changeMode(&mMagicAttackType, magicAttackSize, "magicAttackType",
+ &LocalPlayer::getMagicAttackString);
+}
+
+static const char *magicAttackStrings[] =
+{
+ N_("(f) use #flar for magic attack"),
+ N_("(c) use #chiza for magic attack"),
+ N_("(I) use #ingrav for magic attack"),
+ N_("(F) use #frillyar for magic attack"),
+ N_("(U) use #upmarmu for magic attack"),
+ N_("(?) magic attack")
+};
+
+std::string LocalPlayer::getMagicAttackString()
+{
+ return gettext(getVarItem(&magicAttackStrings[0],
+ mMagicAttackType, magicAttackSize));
+}
+
+const unsigned pvpAttackSize = 4;
+
+void LocalPlayer::switchPvpAttack()
+{
+ changeMode(&mPvpAttackType, pvpAttackSize, "pvpAttackType",
+ &LocalPlayer::getPvpAttackString);
+}
+
+static const char *pvpAttackStrings[] =
+{
+ N_("(a) attack all players"),
+ N_("(f) attack not friends"),
+ N_("(b) attack bad relations"),
+ N_("(d) dont attack players"),
+ N_("(?) pvp attack")
+};
+
+std::string LocalPlayer::getPvpAttackString()
+{
+ return gettext(getVarItem(&pvpAttackStrings[0],
+ mPvpAttackType, pvpAttackSize));
+}
+
+const unsigned imitationModeSize = 2;
+
void LocalPlayer::changeImitationMode()
{
- mImitationMode++;
- if (mImitationMode > 1)
- mImitationMode = 0;
+ changeMode(&mImitationMode, imitationModeSize, "imitationMode",
+ &LocalPlayer::getImitationModeString);
+}
- config.setValue("imitationMode", mImitationMode);
+static const char *imitationModeStrings[] =
+{
+ N_("(D) default imitation"),
+ N_("(O) outfits imitation"),
+ N_("(?) imitation")
+};
+
+std::string LocalPlayer::getImitationModeString()
+{
+ return gettext(getVarItem(&imitationModeStrings[0],
+ mImitationMode, imitationModeSize));
+}
+
+const unsigned awayModeSize = 2;
+
+void LocalPlayer::changeAwayMode()
+{
+ mAwayMode = !mAwayMode;
+ mAfkTime = 0;
+ mInactive = false;
+ updateName();
if (miniStatusWindow)
miniStatusWindow->updateStatus();
+ if (mAwayMode)
+ {
+ if (chatWindow)
+ chatWindow->clearAwayLog();
+
+ cancelFollow();
+ navigateClean();
+ if (outfitWindow)
+ outfitWindow->wearAwayOutfit();
+ mAwayDialog = new OkDialog(_("Away"),
+ config.getStringValue("afkMessage"), true, false);
+ mAwayDialog->addActionListener(mAwayListener);
+ sound.volumeOff();
+ }
+ else
+ {
+ mAwayDialog = nullptr;
+ sound.volumeRestore();
+ if (chatWindow)
+ {
+ chatWindow->displayAwayLog();
+ chatWindow->clearAwayLog();
+ }
+ }
+}
+
+static const char *awayModeStrings[] =
+{
+ N_("(O) on keyboard"),
+ N_("(A) away"),
+ N_("(?) away")
+};
+
+std::string LocalPlayer::getAwayModeString()
+{
+ return gettext(getVarItem(&awayModeStrings[0],
+ mAwayMode, awayModeSize));
+}
+
+const unsigned cameraModeSize = 2;
+
+static const char *cameraModeStrings[] =
+{
+ N_("(G) game camera mode"),
+ N_("(F) free camera mode"),
+ N_("(?) away")
+};
+
+std::string LocalPlayer::getCameraModeString()
+{
+ return gettext(getVarItem(&cameraModeStrings[0],
+ viewport->getCameraMode(), cameraModeSize));
+}
+
+const unsigned gameModifiersSize = 2;
+
+void LocalPlayer::switchGameModifiers()
+{
+ mDisableGameModifiers = !mDisableGameModifiers;
+ config.setValue("disableGameModifiers", mDisableGameModifiers);
+ miniStatusWindow->updateStatus();
+
+ const std::string str = getGameModifiersString();
+ if (str.size() > 4)
+ debugMsg(str.substr(4));
+}
+
+static const char *gameModifiersStrings[] =
+{
+ _("Game modifiers are enabled"),
+ _("Game modifiers are disabled"),
+ _("Game modifiers are unknown")
+};
+
+std::string LocalPlayer::getGameModifiersString()
+{
+ return gettext(getVarItem(&gameModifiersStrings[0],
+ mDisableGameModifiers, gameModifiersSize));
}
+
void LocalPlayer::changeEquipmentBeforeAttack(Being* target)
{
if (mAttackWeaponType == 1 || !target || !PlayerInfo::getInventory())
@@ -2806,15 +3106,6 @@ bool LocalPlayer::pickUpItems(int pickUpType)
return status;
}
-void LocalPlayer::changeQuickDropCounter()
-{
- mQuickDropCounter++;
- if (mQuickDropCounter > 9)
- mQuickDropCounter = 1;
-
- config.setValue("quickDropCounter", mQuickDropCounter);
- miniStatusWindow->updateStatus();
-}
void LocalPlayer::moveByDirection(unsigned char dir)
{
@@ -2891,28 +3182,6 @@ void LocalPlayer::debugMsg(std::string str)
debugChatTab->chatLog(str);
}
-void LocalPlayer::switchMagicAttack()
-{
- mMagicAttackType++;
- if (mMagicAttackType > 4)
- mMagicAttackType = 0;
-
- config.setValue("magicAttackType", mMagicAttackType);
- if (miniStatusWindow)
- miniStatusWindow->updateStatus();
-}
-
-void LocalPlayer::switchPvpAttack()
-{
- mPvpAttackType++;
- if (mPvpAttackType > 3)
- mPvpAttackType = 0;
-
- config.setValue("pvpAttackType", mPvpAttackType);
- if (miniStatusWindow)
- miniStatusWindow->updateStatus();
-}
-
void LocalPlayer::magicAttack()
{
if (!chatWindow || !isAlive()
@@ -2970,17 +3239,6 @@ void LocalPlayer::tryMagic(std::string spell, int baseMagic,
}
}
-void LocalPlayer::changeMoveToTargetType()
-{
- mMoveToTargetType++;
- if (mMoveToTargetType > 7)
- mMoveToTargetType = 0;
-
- config.setValue("moveToTargetType", mMoveToTargetType);
- if (miniStatusWindow)
- miniStatusWindow->updateStatus();
-}
-
void LocalPlayer::loadHomes()
{
std::string homeStr = serverConfig.getValue("playerHomes",
@@ -3136,14 +3394,6 @@ void LocalPlayer::saveHomes()
serverConfig.setValue("playerHomes", ss.str());
}
-
-void LocalPlayer::switchGameModifiers()
-{
- mDisableGameModifiers = !mDisableGameModifiers;
- config.setValue("disableGameModifiers", mDisableGameModifiers);
- miniStatusWindow->updateStatus();
-}
-
void LocalPlayer::pingRequest()
{
if (mWaitPing == true && mPingSendTick != 0)
@@ -3186,39 +3436,6 @@ void LocalPlayer::tryPingRequest()
}
}
-void LocalPlayer::changeAwayMode()
-{
- mAwayMode = !mAwayMode;
- mAfkTime = 0;
- mInactive = false;
- updateName();
- if (miniStatusWindow)
- miniStatusWindow->updateStatus();
- if (mAwayMode)
- {
- if (chatWindow)
- chatWindow->clearAwayLog();
-
- cancelFollow();
- navigateClean();
- if (outfitWindow)
- outfitWindow->wearAwayOutfit();
- mAwayDialog = new OkDialog(_("Away"),
- config.getStringValue("afkMessage"), true, false);
- mAwayDialog->addActionListener(mAwayListener);
- sound.volumeOff();
- }
- else
- {
- mAwayDialog = nullptr;
- sound.volumeRestore();
- if (chatWindow)
- {
- chatWindow->displayAwayLog();
- chatWindow->clearAwayLog();
- }
- }
-}
void LocalPlayer::setAway(const std::string &message)
{
@@ -3981,6 +4198,15 @@ bool LocalPlayer::checAttackPermissions(Being *target)
}
}
+
+const char *LocalPlayer::getVarItem(const char **arr, unsigned index,
+ unsigned sz)
+{
+ if (index < sz)
+ return arr[index];
+ return arr[sz];
+}
+
void AwayListener::action(const gcn::ActionEvent &event)
{
if (event.getId() == "ok" && player_node && player_node->getAway())
diff --git a/src/localplayer.h b/src/localplayer.h
index 08ebbe841..56867a0b8 100644
--- a/src/localplayer.h
+++ b/src/localplayer.h
@@ -483,6 +483,36 @@ class LocalPlayer : public Being, public ActorSpriteListener,
bool checAttackPermissions(Being *target);
+ std::string getInvertDirectionString();
+
+ std::string getCrazyMoveTypeString();
+
+ std::string getMoveToTargetTypeString();
+
+ std::string getFollowModeString();
+
+ std::string getAttackWeaponTypeString();
+
+ std::string getAttackTypeString();
+
+ std::string getQuickDropCounterString();
+
+ std::string getPickUpTypeString();
+
+ std::string getDebugPathString();
+
+ std::string getMagicAttackString();
+
+ std::string getPvpAttackString();
+
+ std::string getImitationModeString();
+
+ std::string getAwayModeString();
+
+ std::string getCameraModeString();
+
+ std::string getGameModifiersString();
+
protected:
/** Whether or not the name settings have changed */
bool mUpdateName;
@@ -496,6 +526,11 @@ class LocalPlayer : public Being, public ActorSpriteListener,
void tryMagic(std::string spell, int baseMagic,
int schoolMagic, int mana);
+ const char *getVarItem(const char **arr, unsigned index, unsigned sz);
+
+ void changeMode(unsigned *var, unsigned limit, const char *conf,
+ std::string (LocalPlayer::*func)(), unsigned def = 0);
+
void crazyMove1();
void crazyMove2();
void crazyMove3();