From 8764d8fed61e7f0148ede9a6a836b402145578aa Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 24 Dec 2014 19:28:46 +0300 Subject: eathena: add support for buy from cash shop. --- src/gui/windows/buydialog.cpp | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'src/gui') diff --git a/src/gui/windows/buydialog.cpp b/src/gui/windows/buydialog.cpp index 33e3932bc..ec83e610c 100644 --- a/src/gui/windows/buydialog.cpp +++ b/src/gui/windows/buydialog.cpp @@ -45,6 +45,7 @@ #include "net/adminhandler.h" #include "net/buysellhandler.h" +#include "net/cashshophandler.h" #include "net/markethandler.h" #include "net/npchandler.h" @@ -442,21 +443,28 @@ void BuyDialog::action(const ActionEvent &event) } else if (mNpcId != Nick) { - if (mNpcId != Market) + if (mNpcId == Market) { - npcHandler->buyItem(mNpcId, + marketHandler->buyItem(item->getId(), + item->getType(), + item->getColor(), + mAmountItems); + item->increaseQuantity(-mAmountItems); + item->update(); + } + else if (mNpcId == Cash) + { + cashShopHandler->buyItem(item->getPrice(), item->getId(), item->getColor(), mAmountItems); } else { - marketHandler->buyItem(item->getId(), - item->getType(), + npcHandler->buyItem(mNpcId, + item->getId(), item->getColor(), mAmountItems); - item->increaseQuantity(-mAmountItems); - item->update(); } // Update money and adjust the max number of items -- cgit v1.2.3-60-g2f50