diff options
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/buy.cpp | 17 | ||||
-rw-r--r-- | src/gui/buysell.cpp | 9 | ||||
-rw-r--r-- | src/gui/npc_text.cpp | 34 | ||||
-rw-r--r-- | src/gui/npcintegerdialog.cpp | 27 | ||||
-rw-r--r-- | src/gui/npclistdialog.cpp | 35 | ||||
-rw-r--r-- | src/gui/npcpostdialog.cpp | 9 | ||||
-rw-r--r-- | src/gui/npcstringdialog.cpp | 27 | ||||
-rw-r--r-- | src/gui/sell.cpp | 27 | ||||
-rw-r--r-- | src/gui/sell.h | 4 | ||||
-rw-r--r-- | src/gui/shop.cpp | 2 | ||||
-rw-r--r-- | src/gui/shop.h | 2 |
11 files changed, 69 insertions, 124 deletions
diff --git a/src/gui/buy.cpp b/src/gui/buy.cpp index 7cefa3e5..8d963227 100644 --- a/src/gui/buy.cpp +++ b/src/gui/buy.cpp @@ -34,11 +34,8 @@ #include "shopitem.h" #include "units.h" -#ifdef TMWSERV_SUPPORT -#include "net/tmwserv/gameserver/player.h" -#else -#include "net/ea/npchandler.h" -#endif +#include "net/net.h" +#include "net/npchandler.h" #include "resources/iteminfo.h" @@ -187,13 +184,9 @@ void BuyDialog::action(const gcn::ActionEvent &event) else if (event.getId() == "buy" && mAmountItems > 0 && mAmountItems <= mMaxItems) { - // Net::getNpcHandler()->buyItem(current_npc, mShopItems->at(selectedItem)->getId(), mAmountItems); -#ifdef TMWSERV_SUPPORT - Net::GameServer::Player::tradeWithNPC - (mShopItems->at(selectedItem)->getId(), mAmountItems); -#else - npcHandler->buyItem(current_npc, mShopItems->at(selectedItem)->getId(), mAmountItems); -#endif + Net::getNpcHandler()->buyItem(current_npc, + mShopItems->at(selectedItem)->getId(), + mAmountItems); // Update money and adjust the max number of items that can be bought mMaxItems -= mAmountItems; diff --git a/src/gui/buysell.cpp b/src/gui/buysell.cpp index 33e12e87..80e2cdfe 100644 --- a/src/gui/buysell.cpp +++ b/src/gui/buysell.cpp @@ -25,7 +25,8 @@ #include "gui/button.h" -#include "net/ea/npchandler.h" +#include "net/net.h" +#include "net/npchandler.h" #include "utils/gettext.h" @@ -81,13 +82,11 @@ void BuySellDialog::action(const gcn::ActionEvent &event) if (event.getId() == "Buy") { - // Net::getNpcHandler()->buy(current_npc); - npcHandler->buy(current_npc); + Net::getNpcHandler()->buy(current_npc); } else if (event.getId() == "Sell") { - // Net::getNpcHandler()->buy(current_npc); - npcHandler->sell(current_npc); + Net::getNpcHandler()->buy(current_npc); } else if (event.getId() == "Cancel") { diff --git a/src/gui/npc_text.cpp b/src/gui/npc_text.cpp index b33b9970..2d4a5891 100644 --- a/src/gui/npc_text.cpp +++ b/src/gui/npc_text.cpp @@ -19,22 +19,20 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "button.h" -#include "npc_text.h" -#include "scrollarea.h" -#include "textbox.h" +#include "gui/npc_text.h" -#include "widgets/layout.h" +#include "gui/button.h" +#include "gui/scrollarea.h" +#include "gui/textbox.h" -#include "../npc.h" +#include "gui/widgets/layout.h" -#ifdef TMWSERV_SUPPORT -#include "../net/tmwserv/gameserver/player.h" -#else -#include "../net/ea/npchandler.h" -#endif +#include "npc.h" -#include "../utils/gettext.h" +#include "net/net.h" +#include "net/npchandler.h" + +#include "utils/gettext.h" NpcTextDialog::NpcTextDialog() : Window(_("NPC")) @@ -125,20 +123,12 @@ void NpcTextDialog::action(const gcn::ActionEvent &event) void NpcTextDialog::nextDialog(int npcID) { - // Net::getNpcHandler()->nextDialog(npcID); -#ifdef TMWSERV_SUPPORT - Net::GameServer::Player::talkToNPC(npcID, false); -#else - npcHandler->nextDialog(npcID); -#endif + Net::getNpcHandler()->nextDialog(npcID); } void NpcTextDialog::closeDialog(int npcID) { - // Net::getNpcHandler()->closeDialog(npcID); -#ifdef EATHENA_SUPPORT - npcHandler->closeDialog(npcID); -#endif + Net::getNpcHandler()->closeDialog(npcID); } void NpcTextDialog::widgetResized(const gcn::Event &event) diff --git a/src/gui/npcintegerdialog.cpp b/src/gui/npcintegerdialog.cpp index 86dad4ab..7955214c 100644 --- a/src/gui/npcintegerdialog.cpp +++ b/src/gui/npcintegerdialog.cpp @@ -19,21 +19,21 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "button.h" -#include "inttextfield.h" -#include "npc_text.h" -#include "npcintegerdialog.h" +#include "gui/npcintegerdialog.h" -#include "widgets/layout.h" +#include "gui/button.h" +#include "gui/inttextfield.h" +#include "gui/npc_text.h" -#include "../npc.h" +#include "gui/widgets/layout.h" -#ifdef EATHENA_SUPPORT -#include "../net/ea/npchandler.h" -#endif +#include "npc.h" -#include "../utils/gettext.h" -#include "../utils/strprintf.h" +#include "net/net.h" +#include "net/npchandler.h" + +#include "utils/gettext.h" +#include "utils/strprintf.h" NpcIntegerDialog::NpcIntegerDialog() : Window(_("NPC Number Request")) @@ -118,10 +118,7 @@ void NpcIntegerDialog::action(const gcn::ActionEvent &event) setVisible(false); NPC::isTalking = false; - // Net::getNpcHandler()->integerInput(current_npc, mValueField->getValue()); -#ifdef EATHENA_SUPPORT - npcHandler->integerInput(current_npc, mValueField->getValue()); -#endif + Net::getNpcHandler()->integerInput(current_npc, mValueField->getValue()); mValueField->reset(); } diff --git a/src/gui/npclistdialog.cpp b/src/gui/npclistdialog.cpp index 8b0128d5..5cd7dbab 100644 --- a/src/gui/npclistdialog.cpp +++ b/src/gui/npclistdialog.cpp @@ -19,26 +19,24 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include <sstream> +#include "gui/npclistdialog.h" + +#include "gui/button.h" +#include "gui/listbox.h" +#include "gui/npc_text.h" +#include "gui/scrollarea.h" -#include "button.h" -#include "listbox.h" -#include "npc_text.h" -#include "npclistdialog.h" -#include "scrollarea.h" +#include "gui/widgets/layout.h" -#include "widgets/layout.h" +#include "npc.h" -#include "../npc.h" +#include "net/net.h" +#include "net/npchandler.h" -#ifdef TMWSERV_SUPPORT -#include "../net/tmwserv/gameserver/player.h" -#else -#include "../net/ea/npchandler.h" -#endif +#include "utils/gettext.h" +#include "utils/strprintf.h" -#include "../utils/gettext.h" -#include "../utils/strprintf.h" +#include <sstream> NpcListDialog::NpcListDialog() : Window("NPC") @@ -132,12 +130,7 @@ void NpcListDialog::action(const gcn::ActionEvent &event) saveWindowState(); reset(); - // Net::getNpcHandler()->listInput(current_npc, choice); -#ifdef TMWSERV_SUPPORT - Net::GameServer::Player::selectFromNPC(current_npc, choice); -#else - npcHandler->listInput(current_npc, choice); -#endif + Net::getNpcHandler()->listInput(current_npc, choice); } } diff --git a/src/gui/npcpostdialog.cpp b/src/gui/npcpostdialog.cpp index 5c083612..2b178cff 100644 --- a/src/gui/npcpostdialog.cpp +++ b/src/gui/npcpostdialog.cpp @@ -28,7 +28,11 @@ #include "gui/widgets/chattab.h" -#include "net/tmwserv/gameserver/player.h" +#include "npc.h" + +#include "net/net.h" +#include "net/npchandler.h" + #include "utils/gettext.h" #include <guichan/widgets/label.hpp> @@ -84,7 +88,8 @@ void NpcPostDialog::action(const gcn::ActionEvent &event) } else { - Net::GameServer::Player::sendLetter(mSender->getText(), mText->getText()); + Net::getNpcHandler()->sendLetter(current_npc, mSender->getText(), + mText->getText()); } setVisible(false); clear(); diff --git a/src/gui/npcstringdialog.cpp b/src/gui/npcstringdialog.cpp index 8d45e332..7ce4060c 100644 --- a/src/gui/npcstringdialog.cpp +++ b/src/gui/npcstringdialog.cpp @@ -19,21 +19,21 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "button.h" -#include "npc_text.h" -#include "npcstringdialog.h" -#include "textfield.h" +#include "gui/npc_text.h" -#include "widgets/layout.h" +#include "gui/button.h" +#include "gui/npcstringdialog.h" +#include "gui/textfield.h" -#include "../npc.h" +#include "gui/widgets/layout.h" -#ifdef EATHENA_SUPPORT -#include "../net/ea/npchandler.h" -#endif +#include "npc.h" -#include "../utils/gettext.h" -#include "../utils/strprintf.h" +#include "net/net.h" +#include "net/npchandler.h" + +#include "utils/gettext.h" +#include "utils/strprintf.h" NpcStringDialog::NpcStringDialog() : Window(_("NPC Text Request")) @@ -86,10 +86,7 @@ void NpcStringDialog::action(const gcn::ActionEvent &event) std::string text = mValueField->getText(); mValueField->setText(""); - // Net::getNpcHandler()->stringInput(current_npc, text); -#ifdef EATHENA_SUPPORT - npcHandler->stringInput(current_npc, text); -#endif + Net::getNpcHandler()->stringInput(current_npc, text); } bool NpcStringDialog::isInputFocused() diff --git a/src/gui/sell.cpp b/src/gui/sell.cpp index 3b4e9982..2dfc66a7 100644 --- a/src/gui/sell.cpp +++ b/src/gui/sell.cpp @@ -34,11 +34,8 @@ #include "shopitem.h" #include "units.h" -#ifdef TMWSERV_SUPPORT -#include "net/tmwserv/gameserver/player.h" -#else -#include "net/ea/npchandler.h" -#endif +#include "net/net.h" +#include "net/npchandler.h" #include "resources/iteminfo.h" @@ -129,16 +126,6 @@ void SellDialog::reset() updateButtonsAndLabels(); } -#ifdef TMWSERV_SUPPORT - -void SellDialog::addItem(int item, int amount, int price) -{ - mShopItems->addItem(item, amount, price); - mShopItemList->adjustSize(); -} - -#else - void SellDialog::addItem(const Item *item, int price) { if (!item) @@ -150,8 +137,6 @@ void SellDialog::addItem(const Item *item, int price) mShopItemList->adjustSize(); } -#endif - void SellDialog::action(const gcn::ActionEvent &event) { if (event.getId() == "quit") @@ -195,10 +180,6 @@ void SellDialog::action(const gcn::ActionEvent &event) else if (event.getId() == "sell" && mAmountItems > 0 && mAmountItems <= mMaxItems) { -#ifdef TMWSERV_SUPPORT - Net::GameServer::Player::tradeWithNPC - (mShopItems->at(selectedItem)->getId(), mAmountItems); -#else // Attempt sell ShopItem *item = mShopItems->at(selectedItem); int sellCount; @@ -210,10 +191,8 @@ void SellDialog::action(const gcn::ActionEvent &event) // the inventory index of the next Duplicate otherwise. sellCount = item->sellCurrentDuplicate(mAmountItems); mAmountItems -= sellCount; - // Net::getNpcHandler()->sellItem(current_npc, item->getCurrentInvIndex(), sellCount); - npcHandler->sellItem(current_npc, item->getCurrentInvIndex(), sellCount); + Net::getNpcHandler()->sellItem(current_npc, item->getCurrentInvIndex(), sellCount); } -#endif mPlayerMoney += mAmountItems * mShopItems->at(selectedItem)->getPrice(); diff --git a/src/gui/sell.h b/src/gui/sell.h index b3e59b4f..89ae06c4 100644 --- a/src/gui/sell.h +++ b/src/gui/sell.h @@ -61,11 +61,7 @@ class SellDialog : public Window, gcn::ActionListener, gcn::SelectionListener /** * Adds an item to the inventory. */ -#ifdef TMWSERV_SUPPORT - void addItem(int item, int amount, int price); -#else void addItem(const Item *item, int price); -#endif /** * Called when receiving actions from the widgets. diff --git a/src/gui/shop.cpp b/src/gui/shop.cpp index 4799ea42..b72be694 100644 --- a/src/gui/shop.cpp +++ b/src/gui/shop.cpp @@ -50,7 +50,6 @@ void ShopItems::addItem(int id, int amount, int price) mShopItems.push_back(new ShopItem(-1, id, amount, price)); } -#ifdef EATHENA_SUPPORT void ShopItems::addItem(int inventoryIndex, int id, int quantity, int price) { ShopItem *item = 0; @@ -69,7 +68,6 @@ void ShopItems::addItem(int inventoryIndex, int id, int quantity, int price) mShopItems.push_back(item); } } -#endif ShopItem *ShopItems::at(int i) const { diff --git a/src/gui/shop.h b/src/gui/shop.h index 190ef655..28f5d4b3 100644 --- a/src/gui/shop.h +++ b/src/gui/shop.h @@ -56,7 +56,6 @@ class ShopItems : public gcn::ListModel */ void addItem(int id, int amount, int price); -#ifdef EATHENA_SUPPORT /** * Adds an item to the list (used by sell dialog). Looks for * duplicate entries, if mergeDuplicates was turned on. @@ -67,7 +66,6 @@ class ShopItems : public gcn::ListModel * @param price price of the item */ void addItem(int inventoryIndex, int id, int amount, int price); -#endif /** * Returns the number of items in the shop. |