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/cashshoprecv.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/cashshoprecv.cpp')
-rw-r--r-- | src/net/eathena/cashshoprecv.cpp | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/src/net/eathena/cashshoprecv.cpp b/src/net/eathena/cashshoprecv.cpp index e051f8ba0..fefe422f1 100644 --- a/src/net/eathena/cashshoprecv.cpp +++ b/src/net/eathena/cashshoprecv.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" extern int packetVersion; @@ -52,7 +60,24 @@ void CashShopRecv::processCashShopOpen(Net::MessageIn &msg) else count = (msg.readInt16("len") - 8) / 11; - CREATEWIDGETV(mBuyDialog, BuyDialog, fromInt(BuyDialog::Cash, 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::Cash, BeingId), + currency); const int points = msg.readInt32("cash points"); mBuyDialog->setMoney(points); |