summaryrefslogtreecommitdiff
path: root/src/gui/windows/buydialog.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/windows/buydialog.cpp')
-rw-r--r--src/gui/windows/buydialog.cpp20
1 files changed, 14 insertions, 6 deletions
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