summaryrefslogtreecommitdiff
path: root/src/net/eathena/buysellrecv.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-02-01 00:43:24 +0300
committerAndrei Karas <akaras@inbox.ru>2017-02-01 00:45:05 +0300
commit2c273a20b2cd3e1628840f2d87df16f0cce9ad33 (patch)
tree853d172e0fd05117d84eda712912ba2843bb87e2 /src/net/eathena/buysellrecv.cpp
parent35481061f62111f916a39ce3cac6a314579418f9 (diff)
downloadplus-2c273a20b2cd3e1628840f2d87df16f0cce9ad33.tar.gz
plus-2c273a20b2cd3e1628840f2d87df16f0cce9ad33.tar.bz2
plus-2c273a20b2cd3e1628840f2d87df16f0cce9ad33.tar.xz
plus-2c273a20b2cd3e1628840f2d87df16f0cce9ad33.zip
Set currency to buy dialog based on selected npc type id.
For now this type never set.
Diffstat (limited to 'src/net/eathena/buysellrecv.cpp')
-rw-r--r--src/net/eathena/buysellrecv.cpp30
1 files changed, 28 insertions, 2 deletions
diff --git a/src/net/eathena/buysellrecv.cpp b/src/net/eathena/buysellrecv.cpp
index f817813c6..2984eac97 100644
--- a/src/net/eathena/buysellrecv.cpp
+++ b/src/net/eathena/buysellrecv.cpp
@@ -26,15 +26,23 @@
#include "being/playerinfo.h"
+#include "const/resources/currency.h"
+
#include "enums/resources/notifytypes.h"
#include "gui/windows/buydialog.h"
#include "gui/widgets/createwidget.h"
+#include "net/messagein.h"
+
#include "net/ea/buysellrecv.h"
-#include "net/messagein.h"
+#include "net/eathena/npcrecv.h"
+
+#include "resources/beinginfo.h"
+
+#include "resources/db/npcdb.h"
#include "debug.h"
@@ -46,8 +54,26 @@ void BuySellRecv::processNpcBuy(Net::MessageIn &msg)
msg.readInt16("len");
const int sz = 11;
const int n_items = (msg.getLength() - 4) / sz;
+
+ const BeingTypeId npcId = NpcRecv::mNpcTypeId;
+ std::string currency;
+
+ if (npcId != BeingTypeId_zero)
+ {
+ const BeingInfo *info = NPCDB::get(npcId);
+ if (info)
+ currency = info->getCurrency();
+ else
+ currency = DEFAULT_CURRENCY;
+ }
+ else
+ {
+ currency = DEFAULT_CURRENCY;
+ }
+
CREATEWIDGETV(Ea::BuySellRecv::mBuyDialog, BuyDialog,
- Ea::BuySellRecv::mNpcId);
+ Ea::BuySellRecv::mNpcId,
+ currency);
Ea::BuySellRecv::mBuyDialog->setMoney(
PlayerInfo::getAttribute(Attributes::MONEY));