diff options
author | Andrei Karas <akaras@inbox.ru> | 2017-02-01 00:43:24 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2017-02-01 00:45:05 +0300 |
commit | 2c273a20b2cd3e1628840f2d87df16f0cce9ad33 (patch) | |
tree | 853d172e0fd05117d84eda712912ba2843bb87e2 /src/net/eathena/marketrecv.cpp | |
parent | 35481061f62111f916a39ce3cac6a314579418f9 (diff) | |
download | manaverse-2c273a20b2cd3e1628840f2d87df16f0cce9ad33.tar.gz manaverse-2c273a20b2cd3e1628840f2d87df16f0cce9ad33.tar.bz2 manaverse-2c273a20b2cd3e1628840f2d87df16f0cce9ad33.tar.xz manaverse-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/marketrecv.cpp')
-rw-r--r-- | src/net/eathena/marketrecv.cpp | 28 |
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 ++) |