summaryrefslogtreecommitdiff
path: root/src/net/eathena/marketrecv.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/net/eathena/marketrecv.cpp')
-rw-r--r--src/net/eathena/marketrecv.cpp28
1 files changed, 27 insertions, 1 deletions
diff --git a/src/net/eathena/marketrecv.cpp b/src/net/eathena/marketrecv.cpp
index c3ac370ff..82775acff 100644
--- a/src/net/eathena/marketrecv.cpp
+++ b/src/net/eathena/marketrecv.cpp
@@ -24,6 +24,8 @@
#include "being/playerinfo.h"
+#include "const/resources/currency.h"
+
#include "enums/resources/notifytypes.h"
#include "gui/windows/buydialog.h"
@@ -32,6 +34,12 @@
#include "net/messagein.h"
+#include "net/eathena/npcrecv.h"
+
+#include "resources/beinginfo.h"
+
+#include "resources/db/npcdb.h"
+
#include "debug.h"
namespace EAthena
@@ -47,7 +55,25 @@ void MarketRecv::processMarketOpen(Net::MessageIn &msg)
{
const int len = (msg.readInt16("len") - 4) / 13;
- CREATEWIDGETV(mBuyDialog, BuyDialog, fromInt(BuyDialog::Market, BeingId));
+ 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(mBuyDialog, BuyDialog,
+ fromInt(BuyDialog::Market, BeingId),
+ currency);
mBuyDialog->setMoney(PlayerInfo::getAttribute(Attributes::MONEY));
for (int f = 0; f < len; f ++)