summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/enums/resources/notifytypes.h1
-rw-r--r--src/gui/windows/buydialog.cpp1
-rw-r--r--src/net/eathena/vendingrecv.cpp31
-rw-r--r--src/resources/notifications.h4
4 files changed, 35 insertions, 2 deletions
diff --git a/src/enums/resources/notifytypes.h b/src/enums/resources/notifytypes.h
index 60600ef0c..06dd6e69a 100644
--- a/src/enums/resources/notifytypes.h
+++ b/src/enums/resources/notifytypes.h
@@ -228,6 +228,7 @@ namespace NotifyTypes
SKILL_MEMO_SAVED,
SKILL_MEMO_ERROR_LEVEL,
SKILL_MEMO_ERROR_SKILL,
+ BUY_TRADE_FAILED,
TYPE_END
};
diff --git a/src/gui/windows/buydialog.cpp b/src/gui/windows/buydialog.cpp
index 7c7d96a13..eb01e0562 100644
--- a/src/gui/windows/buydialog.cpp
+++ b/src/gui/windows/buydialog.cpp
@@ -54,6 +54,7 @@
#include "resources/iteminfo.h"
+#include "utils/checkutils.h"
#include "utils/delete2.h"
#include <algorithm>
diff --git a/src/net/eathena/vendingrecv.cpp b/src/net/eathena/vendingrecv.cpp
index 443e02d8e..468143dfd 100644
--- a/src/net/eathena/vendingrecv.cpp
+++ b/src/net/eathena/vendingrecv.cpp
@@ -22,10 +22,13 @@
#include "actormanager.h"
#include "itemcolormanager.h"
+#include "notifymanager.h"
#include "being/localplayer.h"
#include "being/playerinfo.h"
+#include "enums/resources/notifytypes.h"
+
#include "gui/windows/buydialog.h"
#include "gui/widgets/createwidget.h"
@@ -135,10 +138,34 @@ void VendingRecv::processItemsList(Net::MessageIn &msg)
void VendingRecv::processBuyAck(Net::MessageIn &msg)
{
- UNIMPLIMENTEDPACKET;
msg.readInt16("inv index");
msg.readInt16("amount");
- msg.readUInt8("flag");
+ const int flag = msg.readUInt8("flag");
+ switch (flag)
+ {
+ case 0:
+ break;
+ case 1:
+ NotifyManager::notify(NotifyTypes::BUY_FAILED_NO_MONEY);
+ break;
+ case 2:
+ NotifyManager::notify(NotifyTypes::BUY_FAILED_OVERWEIGHT);
+ break;
+ case 4:
+ NotifyManager::notify(NotifyTypes::BUY_FAILED_TOO_MANY_ITEMS);
+ break;
+ case 5:
+ NotifyManager::notify(NotifyTypes::BUY_TRADE_FAILED);
+ break;
+ case 6: // +++ probably need show exact error messages?
+ case 7:
+ NotifyManager::notify(NotifyTypes::BUY_FAILED);
+ break;
+ default:
+ NotifyManager::notify(NotifyTypes::BUY_FAILED);
+ UNIMPLIMENTEDPACKETFIELD(flag);
+ break;
+ }
}
void VendingRecv::processOpen(Net::MessageIn &msg)
diff --git a/src/resources/notifications.h b/src/resources/notifications.h
index 8cb06d1ab..58ae9e056 100644
--- a/src/resources/notifications.h
+++ b/src/resources/notifications.h
@@ -828,6 +828,10 @@ namespace NotifyManager
// TRANSLATORS: notification message
N_("Error saving location. You do not have warp skill."),
NotifyFlags::EMPTY},
+ {"buy trade fail",
+ // TRANSLATORS: notification message
+ N_("Unable to buy while trading."),
+ NotifyFlags::EMPTY},
};
} // namespace NotifyManager
#endif // RESOURCES_NOTIFICATIONS_H