diff options
Diffstat (limited to 'src/gui/sell.cpp')
-rw-r--r-- | src/gui/sell.cpp | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/src/gui/sell.cpp b/src/gui/sell.cpp index 13e0ba99..46bef092 100644 --- a/src/gui/sell.cpp +++ b/src/gui/sell.cpp @@ -21,7 +21,8 @@ #include "gui/sell.h" -#include "npc.h" +#include "client.h" +#include "playerinfo.h" #include "shopitem.h" #include "units.h" @@ -111,6 +112,8 @@ SellDialog::SellDialog(int npcId): instances.push_back(this); setVisible(true); + + PlayerInfo::setBuySellState(BUYSELL_SELLING); } SellDialog::~SellDialog() @@ -118,6 +121,9 @@ SellDialog::~SellDialog() delete mShopItems; instances.remove(this); + + if (PlayerInfo::getBuySellState() == BUYSELL_SELLING) + PlayerInfo::setBuySellState(BUYSELL_NONE); } void SellDialog::reset() @@ -197,6 +203,11 @@ void SellDialog::action(const gcn::ActionEvent &event) // the inventory index of the next Duplicate otherwise. itemIndex = item->getCurrentInvIndex(); sellCount = item->sellCurrentDuplicate(mAmountItems); + + // For Manaserv, the Item id is to be given as index. + if ((Net::getNetworkType() == ServerInfo::MANASERV)) + itemIndex = item->getId(); + Net::getNpcHandler()->sellItem(mNpcId, itemIndex, sellCount); mAmountItems -= sellCount; } @@ -238,6 +249,15 @@ void SellDialog::valueChanged(const gcn::SelectionEvent &event) mSlider->gcn::Slider::setScale(1, mMaxItems); } +void SellDialog::mouseClicked(gcn::MouseEvent &mouseEvent) +{ + if (mouseEvent.getSource() == mShopItemList && + isDoubleClick(mShopItemList->getSelected())) + { + action(gcn::ActionEvent(mSellButton, mSellButton->getActionEventId())); + } +} + void SellDialog::setMoney(int amount) { mPlayerMoney = amount; |