summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-04-28 13:58:12 +0300
committerAndrei Karas <akaras@inbox.ru>2015-04-29 14:10:28 +0300
commitd90b88aae13baf16083e58896a81826b2679cd6f (patch)
tree4cce51ef44ba5f24dcbcb35010b310055850a738 /src
parente7379712454c42cabdc60cf2db11a5906949330f (diff)
downloadmanaverse-d90b88aae13baf16083e58896a81826b2679cd6f.tar.gz
manaverse-d90b88aae13baf16083e58896a81826b2679cd6f.tar.bz2
manaverse-d90b88aae13baf16083e58896a81826b2679cd6f.tar.xz
manaverse-d90b88aae13baf16083e58896a81826b2679cd6f.zip
Allow send money by mail.
Diffstat (limited to 'src')
-rw-r--r--src/gui/windows/mailedit.cpp19
-rw-r--r--src/gui/windows/mailedit.h3
-rw-r--r--src/net/eathena/mailhandler.cpp7
-rw-r--r--src/net/eathena/mailhandler.h2
-rw-r--r--src/net/mailhandler.h2
-rw-r--r--src/net/tmwa/mailhandler.cpp4
-rw-r--r--src/net/tmwa/mailhandler.h2
7 files changed, 35 insertions, 4 deletions
diff --git a/src/gui/windows/mailedit.cpp b/src/gui/windows/mailedit.cpp
index 971a6d146..14e36063c 100644
--- a/src/gui/windows/mailedit.cpp
+++ b/src/gui/windows/mailedit.cpp
@@ -26,6 +26,7 @@
#include "gui/widgets/button.h"
#include "gui/widgets/containerplacer.h"
+#include "gui/widgets/inttextfield.h"
#include "gui/widgets/label.h"
#include "gui/widgets/layout.h"
#include "gui/widgets/layouttype.h"
@@ -46,10 +47,15 @@ MailEdit::MailEdit() :
mCloseButton(new Button(this, _("Close"), "close", this)),
// TRANSLATORS: mail edit window label
mToLabel(new Label(this, _("To:"))),
+ // TRANSLATORS: mail edit window label
mSubjectLabel(new Label(this, _("Subject:"))),
+ // TRANSLATORS: mail edit window label
+ mMoneyLabel(new Label(this, _("Money:"))),
+ // TRANSLATORS: mail edit window label
mMessageLabel(new Label(this, _("Message:"))),
mToField(new TextField(this)),
mSubjectField(new TextField(this)),
+ mMoneyField(new IntTextField(this, 0, 0, 10000000)),
mMessageField(new TextField(this))
{
setWindowName("MailEdit");
@@ -76,10 +82,12 @@ MailEdit::MailEdit() :
placer(1, 0, mToField, 2);
placer(0, 1, mSubjectLabel);
placer(1, 1, mSubjectField, 2);
- placer(0, 2, mMessageLabel);
- placer(1, 2, mMessageField, 2);
- placer(0, 3, mSendButton);
- placer(2, 3, mCloseButton);
+ placer(0, 2, mMoneyLabel);
+ placer(1, 2, mMoneyField, 2);
+ placer(0, 3, mMessageLabel);
+ placer(1, 3, mMessageField, 2);
+ placer(0, 4, mSendButton);
+ placer(2, 4, mCloseButton);
loadWindowState();
enableVisibleSound(true);
@@ -98,6 +106,9 @@ void MailEdit::action(const ActionEvent &event)
}
else if (eventId == "send")
{
+ const int money = mMoneyField->getValue();
+ if (money)
+ mailHandler->setAttachMoney(money);
mailHandler->send(mToField->getText(),
mSubjectField->getText(),
mMessageField->getText());
diff --git a/src/gui/windows/mailedit.h b/src/gui/windows/mailedit.h
index 0be9c4317..5cd482a53 100644
--- a/src/gui/windows/mailedit.h
+++ b/src/gui/windows/mailedit.h
@@ -28,6 +28,7 @@
#include "listeners/actionlistener.h"
class Button;
+class IntTextField;
class Label;
class TextField;
@@ -48,9 +49,11 @@ class MailEdit final : public Window,
Button *mCloseButton;
Label *mToLabel;
Label *mSubjectLabel;
+ Label *mMoneyLabel;
Label *mMessageLabel;
TextField *mToField;
TextField *mSubjectField;
+ IntTextField *mMoneyField;
TextField *mMessageField;
};
diff --git a/src/net/eathena/mailhandler.cpp b/src/net/eathena/mailhandler.cpp
index f49cc8a5e..5e8ae486e 100644
--- a/src/net/eathena/mailhandler.cpp
+++ b/src/net/eathena/mailhandler.cpp
@@ -265,6 +265,13 @@ void MailHandler::setAttach(const int index, const int amount)
outMsg.writeInt32(amount, "amount");
}
+void MailHandler::setAttachMoney(const int money)
+{
+ createOutPacket(CMSG_MAIL_SET_ATTACH);
+ outMsg.writeInt16(static_cast<int16_t>(0), "index");
+ outMsg.writeInt32(money, "money");
+}
+
void MailHandler::resetAttach(const int flag)
{
createOutPacket(CMSG_MAIL_RESET_ATTACH);
diff --git a/src/net/eathena/mailhandler.h b/src/net/eathena/mailhandler.h
index 92ecc9eef..3b0d17574 100644
--- a/src/net/eathena/mailhandler.h
+++ b/src/net/eathena/mailhandler.h
@@ -50,6 +50,8 @@ class MailHandler final : public MessageHandler, public Net::MailHandler
void setAttach(const int index, const int amount) override final;
+ void setAttachMoney(const int money) override final;
+
void resetAttach(const int flag) override final;
void send(const std::string &name,
diff --git a/src/net/mailhandler.h b/src/net/mailhandler.h
index f277392ec..e4e5a424d 100644
--- a/src/net/mailhandler.h
+++ b/src/net/mailhandler.h
@@ -48,6 +48,8 @@ class MailHandler notfinal
virtual void setAttach(const int index, const int amount) = 0;
+ virtual void setAttachMoney(const int money) = 0;
+
virtual void resetAttach(const int flag) = 0;
virtual void send(const std::string &name,
diff --git a/src/net/tmwa/mailhandler.cpp b/src/net/tmwa/mailhandler.cpp
index 9a224988a..53a1faba5 100644
--- a/src/net/tmwa/mailhandler.cpp
+++ b/src/net/tmwa/mailhandler.cpp
@@ -67,6 +67,10 @@ void MailHandler::setAttach(const int index A_UNUSED,
{
}
+void MailHandler::setAttachMoney(const int money A_UNUSED)
+{
+}
+
void MailHandler::resetAttach(const int flag A_UNUSED)
{
}
diff --git a/src/net/tmwa/mailhandler.h b/src/net/tmwa/mailhandler.h
index 26e50eafb..f54901f50 100644
--- a/src/net/tmwa/mailhandler.h
+++ b/src/net/tmwa/mailhandler.h
@@ -51,6 +51,8 @@ class MailHandler final : public MessageHandler, public Net::MailHandler
void setAttach(const int index, const int amount) override final;
+ void setAttachMoney(const int money) override final;
+
void resetAttach(const int flag) override final;
void send(const std::string &name,