summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/models/typelistmodel.h6
-rw-r--r--src/gui/userpalette.cpp14
-rw-r--r--src/gui/widgets/tabs/setup_colors.cpp2
-rw-r--r--src/gui/windows/buydialog.cpp16
-rw-r--r--src/gui/windows/editserverdialog.cpp10
-rw-r--r--src/gui/windows/mailviewwindow.cpp4
-rw-r--r--src/gui/windows/mailviewwindow.h1
-rw-r--r--src/gui/windows/outfitwindow.cpp57
8 files changed, 75 insertions, 35 deletions
diff --git a/src/gui/models/typelistmodel.h b/src/gui/models/typelistmodel.h
index a06aeda51..52b9afeed 100644
--- a/src/gui/models/typelistmodel.h
+++ b/src/gui/models/typelistmodel.h
@@ -55,17 +55,17 @@ class TypeListModel final : public ListModel
{
#ifdef TMWA_SUPPORT
if (elementIndex == 0)
- return "TmwAthena";
+ return "TMW Athena";
else if (elementIndex == 1)
return "Hercules";
else if (elementIndex == 2)
- return "Evol2";
+ return "Evol2 Hercules";
else
#else // TMWA_SUPPORT
if (elementIndex == 0)
return "Hercules";
else if (elementIndex == 1)
- return "Evol2";
+ return "Evol2 Hercules";
else
#endif // TMWA_SUPPORT
return "Unknown";
diff --git a/src/gui/userpalette.cpp b/src/gui/userpalette.cpp
index 8ad436a60..dbed4a93e 100644
--- a/src/gui/userpalette.cpp
+++ b/src/gui/userpalette.cpp
@@ -64,6 +64,8 @@ const std::string ColorTypeNames[CAST_SIZE(
"",
"ColorPlayerHp",
"ColorPlayerHp2",
+ "ColorPlayerMp",
+ "ColorPlayerMp2",
"ColorMonsterHp",
"ColorMonsterHp2",
"ColorHomunHp",
@@ -296,6 +298,18 @@ UserPalette::UserPalette() :
// TRANSLATORS: palette color
_("Player HP bar (background)"),
50);
+ addColor(UserColorId::PLAYER_MP_FG,
+ 0x00a0ff,
+ GradientType::STATIC,
+ // TRANSLATORS: palette color
+ _("Player MP bar"),
+ 50);
+ addColor(UserColorId::PLAYER_MP_BG,
+ 0x303030,
+ GradientType::STATIC,
+ // TRANSLATORS: palette color
+ _("Player MP bar (background)"),
+ 50);
addColor(UserColorId::MONSTER_HP_FG,
0x00ff00,
GradientType::STATIC,
diff --git a/src/gui/widgets/tabs/setup_colors.cpp b/src/gui/widgets/tabs/setup_colors.cpp
index 0fde9b1f6..71cebc71d 100644
--- a/src/gui/widgets/tabs/setup_colors.cpp
+++ b/src/gui/widgets/tabs/setup_colors.cpp
@@ -367,6 +367,8 @@ void Setup_Colors::valueChanged(const SelectionEvent &event A_UNUSED)
case UserColorId::ELEMENTAL_HP_BG:
case UserColorId::PLAYER_HP_FG:
case UserColorId::PLAYER_HP_BG:
+ case UserColorId::PLAYER_MP_FG:
+ case UserColorId::PLAYER_MP_BG:
case UserColorId::FLOOR_ITEM_TEXT:
case UserColorId::NET:
// TRANSLATORS: colors tab. label.
diff --git a/src/gui/windows/buydialog.cpp b/src/gui/windows/buydialog.cpp
index b17064e45..2786671cd 100644
--- a/src/gui/windows/buydialog.cpp
+++ b/src/gui/windows/buydialog.cpp
@@ -27,6 +27,7 @@
#include "configuration.h"
#include "being/being.h"
+#include "being/playerinfo.h"
#include "enums/gui/layouttype.h"
@@ -753,13 +754,26 @@ void BuyDialog::updateButtonsAndLabels()
const int itemPrice = item->getPrice();
// Calculate how many the player can afford
- if (mNpcId == fromInt(Items, BeingId))
+ if (mNpcId == fromInt(Items, BeingId)) // /createitems "shop"
mMaxItems = 100;
else if (itemPrice != 0)
mMaxItems = mMoney / itemPrice;
else
mMaxItems = 1;
+ // Calculate how many the player can carry
+ using namespace PlayerInfo; // trick for line-length.
+ const int itemWeight = item->getInfo().getWeight();
+ // Should be inside if, but line-length...
+ const int myTotalWeight = getAttribute(Attributes::TOTAL_WEIGHT);
+ const int myMaxWeight = getAttribute(Attributes::MAX_WEIGHT);
+ if (itemWeight != 0)
+ {
+ const int myFreeWeight = myMaxWeight - myTotalWeight;
+ const int canCarry = myFreeWeight / itemWeight;
+ mMaxItems = std::min(mMaxItems, canCarry);
+ }
+
if (mNpcId == fromInt(Market, BeingId))
{
if (mMaxItems > item->getQuantity())
diff --git a/src/gui/windows/editserverdialog.cpp b/src/gui/windows/editserverdialog.cpp
index 51b208164..e73e1ab43 100644
--- a/src/gui/windows/editserverdialog.cpp
+++ b/src/gui/windows/editserverdialog.cpp
@@ -103,19 +103,27 @@ EditServerDialog::EditServerDialog(ServerDialog *const parent,
place(0, 0, nameLabel, 1, 1);
place(1, 0, mNameField, 4, 1).setPadding(3);
+
place(0, 1, serverAdressLabel, 1, 1);
place(1, 1, mServerAddressField, 4, 1).setPadding(3);
+
place(0, 2, portLabel, 1, 1);
place(1, 2, mPortField, 4, 1).setPadding(3);
+
place(0, 3, typeLabel, 1, 1);
- place(1, 3, mTypeField, 1, 1).setPadding(3);
+ place(1, 3, mTypeField, 4, 1).setPadding(3);
+
place(0, 4, descriptionLabel, 1, 1);
place(1, 4, mDescriptionField, 4, 1).setPadding(3);
+
place(0, 5, onlineListUrlLabel, 1, 1);
place(1, 5, mOnlineListUrlField, 4, 1).setPadding(3);
+
place(0, 6, packetVersionLabel, 1, 1);
place(1, 6, mPacketVersionField, 4, 1).setPadding(3);
+
place(0, 7, mPersistentIp, 4, 1).setPadding(3);
+
place(0, 8, mConnectButton, 1, 1);
place(4, 8, mOkButton, 1, 1);
place(3, 8, mCancelButton, 1, 1);
diff --git a/src/gui/windows/mailviewwindow.cpp b/src/gui/windows/mailviewwindow.cpp
index d0d42f168..df2fe1eec 100644
--- a/src/gui/windows/mailviewwindow.cpp
+++ b/src/gui/windows/mailviewwindow.cpp
@@ -69,6 +69,9 @@ MailViewWindow::MailViewWindow(MailMessage *const message,
// TRANSLATORS: mail view window label
mTimeLabel(new Label(this, strprintf("%s %s", _("Time:"),
message->strTime.c_str()))),
+ // TRANSLATORS: mail view window label - mail expiry time
+ mExpireTimeLabel(new Label(this, strprintf("%s %s", _("Expires at:"),
+ timeToStr(message->expireTime).c_str()))),
mMoneyLabel(nullptr),
// TRANSLATORS: mail view window label
mFromLabel(new Label(this, strprintf("%s %s", _("From:"),
@@ -107,6 +110,7 @@ MailViewWindow::MailViewWindow(MailMessage *const message,
int n = 0;
placer(0, n++, mTimeLabel, 1, 1);
+ placer(0, n++, mExpireTimeLabel, 1, 1);
placer(0, n++, mFromLabel, 1, 1);
placer(0, n++, mSubjectLabel, 1, 1);
if (message->money != 0)
diff --git a/src/gui/windows/mailviewwindow.h b/src/gui/windows/mailviewwindow.h
index 201fea426..6a5da1157 100644
--- a/src/gui/windows/mailviewwindow.h
+++ b/src/gui/windows/mailviewwindow.h
@@ -66,6 +66,7 @@ class MailViewWindow final : public Window,
Button *mNextButton;
Button *mReplyButton;
Label *mTimeLabel;
+ Label *mExpireTimeLabel;
Label *mMoneyLabel;
Label *mFromLabel;
Label *mSubjectLabel;
diff --git a/src/gui/windows/outfitwindow.cpp b/src/gui/windows/outfitwindow.cpp
index d547e5486..390f31525 100644
--- a/src/gui/windows/outfitwindow.cpp
+++ b/src/gui/windows/outfitwindow.cpp
@@ -151,30 +151,17 @@ void OutfitWindow::load()
std::string buf;
std::stringstream ss(outfit);
- STD_VECTOR<int> tokens;
-
- while (ss >> buf)
- tokens.push_back(atoi(buf.c_str()));
-
- for (size_t i = 0, sz = tokens.size();
- i < sz && i < OUTFIT_ITEM_COUNT; i++)
+ for (size_t i = 0; (ss >> buf) && i < OUTFIT_ITEM_COUNT; i++)
{
- mItems[o][i] = tokens[i];
+ mItems[o][i] = atoi(buf.c_str());
}
outfit = cfg->getValue("OutfitColor" + toString(o), "1");
std::stringstream ss2(outfit);
- tokens.clear();
-
- STD_VECTOR<unsigned char> tokens2;
- while (ss2 >> buf)
- tokens2.push_back(CAST_U8(atoi(buf.c_str())));
-
- for (size_t i = 0, sz = tokens2.size();
- i < sz && i < OUTFIT_ITEM_COUNT; i++)
+ for (size_t i = 0; (ss2 >> buf) && i < OUTFIT_ITEM_COUNT; i++)
{
- mItemColors[o][i] = fromInt(tokens2[i], ItemColor);
+ mItemColors[o][i] = fromInt(CAST_U8(atoi(buf.c_str())), ItemColor);
}
mItemsUnequip[o] = cfg->getValueBool("OutfitUnequip" + toString(o),
@@ -194,31 +181,41 @@ void OutfitWindow::save() const
std::string outfitColorsStr;
for (unsigned o = 0; o < OUTFITS_COUNT; o++)
{
- bool good = false;
+ bool isEmpty = true;
for (unsigned i = 0; i < OUTFIT_ITEM_COUNT; i++)
{
const int val = mItems[o][i];
- const int res = val != 0 ? val : -1;
- if (res != -1)
- good = true;
+ // Not sure why, but "empty" is stored as -1 instead of 0.
+ int res;
+ if (val == 0)
+ res = -1;
+ else
+ {
+ isEmpty = false;
+ res = val;
+ }
+
outfitStr.append(toString(res));
+ outfitColorsStr.append(toString(CAST_S32(mItemColors[o][i])));
+
if (i < OUTFIT_ITEM_COUNT - 1)
+ {
outfitStr.append(" ");
- outfitColorsStr.append(toString(CAST_S32(
- toInt(mItemColors[o][i], int))));
- if (i < OUTFIT_ITEM_COUNT - 1)
outfitColorsStr.append(" ");
+ }
}
- if (good)
+
+ if (isEmpty)
{
- serverConfig.setValue("Outfit" + toString(o), outfitStr);
- serverConfig.setValue("OutfitColor" + toString(o),
- outfitColorsStr);
+ serverConfig.deleteKey("Outfit" + toString(o));
+ serverConfig.deleteKey("OutfitColor" + toString(o));
}
else
{
- serverConfig.deleteKey("Outfit" + toString(o));
- serverConfig.deleteKey("OutfitColor" + toString(o));
+ serverConfig.setValue("Outfit" + toString(o),
+ outfitStr);
+ serverConfig.setValue("OutfitColor" + toString(o),
+ outfitColorsStr);
}
if (mItemsUnequip[o])