From 47b43be223ee16979089eae8d64537cf34ecdc46 Mon Sep 17 00:00:00 2001 From: brightrim Date: Tue, 18 Jun 2024 19:48:46 +0200 Subject: [PATCH] Revert "Attempt at adding auction dialog functionality" This reverts commit e13488967f20a5f1c270c51efce198d1e9f4f05b. --- src/Character.cpp | 4 - src/Character.hpp | 2 - src/Player.cpp | 48 ------- src/Player.hpp | 7 -- src/dialog/AuctionDialog.cpp | 103 --------------- src/dialog/AuctionDialog.hpp | 126 ------------------- src/dialog/CMakeLists.txt | 1 - src/netinterface/CommandFactory.cpp | 1 - src/netinterface/protocol/ClientCommands.cpp | 44 ------- src/netinterface/protocol/ClientCommands.hpp | 22 +--- src/netinterface/protocol/ServerCommands.cpp | 36 ------ src/netinterface/protocol/ServerCommands.hpp | 8 -- src/script/LuaScript.cpp | 1 - src/script/binding/CMakeLists.txt | 1 - src/script/binding/auction_dialog.cpp | 47 ------- src/script/binding/binding.hpp | 2 - src/script/binding/character.cpp | 1 - test/test_binding_character.cpp | 15 --- tools/wireshark/illarion.lua | 2 - 19 files changed, 1 insertion(+), 470 deletions(-) delete mode 100644 src/dialog/AuctionDialog.cpp delete mode 100644 src/dialog/AuctionDialog.hpp delete mode 100644 src/script/binding/auction_dialog.cpp diff --git a/src/Character.cpp b/src/Character.cpp index 95a31ed1..c4d42f10 100644 --- a/src/Character.cpp +++ b/src/Character.cpp @@ -1472,10 +1472,6 @@ void Character::requestMerchantDialog(MerchantDialog *merchantDialog) { // Nothing to do here, overloaded in Player } -void Character::requestAuctionDialog(AuctionDialog *auctionDialog) { - // Nothing to do here, overloaded in Player -} - void Character::requestSelectionDialog(SelectionDialog *selectionDialog) { // Nothing to do here, overloaded in Player } diff --git a/src/Character.hpp b/src/Character.hpp index 8f72e57f..67aea4ca 100644 --- a/src/Character.hpp +++ b/src/Character.hpp @@ -30,7 +30,6 @@ #include "dialog/CraftingDialog.hpp" #include "dialog/InputDialog.hpp" #include "dialog/MerchantDialog.hpp" -#include "dialog/AuctionDialog.hpp" #include "dialog/MessageDialog.hpp" #include "dialog/SelectionDialog.hpp" #include "tuningConstants.hpp" @@ -429,7 +428,6 @@ class Character { virtual void requestInputDialog(InputDialog *inputDialog); virtual void requestMessageDialog(MessageDialog *messageDialog); virtual void requestMerchantDialog(MerchantDialog *merchantDialog); - virtual void requestAuctionDialog(AuctionDialog *auctionDialog); virtual void requestSelectionDialog(SelectionDialog *selectionDialog); virtual void requestCraftingDialog(CraftingDialog *craftingDialog); virtual void requestCraftingLookAt(unsigned int dialogId, ItemLookAt &lookAt); diff --git a/src/Player.cpp b/src/Player.cpp index 99b99e91..a8f6c8ae 100644 --- a/src/Player.cpp +++ b/src/Player.cpp @@ -39,7 +39,6 @@ #include "dialog/CraftingDialog.hpp" #include "dialog/InputDialog.hpp" #include "dialog/MerchantDialog.hpp" -#include "dialog/AuctionDialog.hpp" #include "dialog/MessageDialog.hpp" #include "dialog/SelectionDialog.hpp" #include "map/Field.hpp" @@ -2546,53 +2545,6 @@ void Player::executeMerchantDialogLookAt(unsigned int dialogId, uint8_t list, ui } } -void Player::requestAuctionDialog(AuctionDialog *auctionDialog) { - requestDialog(auctionDialog); -} - -void Player::executeAuctionDialogAbort(unsigned int dialogId) { - auto auctionDialog = getDialog(dialogId); - - if (auctionDialog) { - auctionDialog->setResult(AuctionDialog::playerAborts); - auctionDialog->setPurchaseIndex(0); - auctionDialog->setPurchaseAmount(0); - ScriptItem item; - auctionDialog->setSaleItem(item); - LuaScript::executeDialogCallback(*auctionDialog); - } - - dialogs.erase(dialogId); -} - -void Player::executeAuctionDialogBid(unsigned int dialogId, AuctionDialog::index_type index, - Item::number_type amount) const { - auto auctionDialog = getDialog(dialogId); - - if (auctionDialog) { - auctionDialog->setResult(AuctionDialog::playerBids); - auctionDialog->setPurchaseIndex(index); - auctionDialog->setPurchaseAmount(amount); - ScriptItem item; - auctionDialog->setSaleItem(item); - LuaScript::executeDialogCallback(*auctionDialog); - } -} - -void Player::executeAuctionDialogLookAt(unsigned int dialogId, uint8_t list, uint8_t slot) { - auto auctionDialog = getDialog(dialogId); - - if (auctionDialog) { - auctionDialog->setResult(AuctionDialog::playerLooksAt); - auctionDialog->setLookAtList(static_cast(list)); - auctionDialog->setPurchaseIndex(slot); - auto lookAt = LuaScript::executeDialogCallback(*auctionDialog); - - ServerCommandPointer cmd = std::make_shared(dialogId, list, slot, lookAt); - Connection->addCommand(cmd); - } -} - void Player::requestSelectionDialog(SelectionDialog *selectionDialog) { requestDialog(selectionDialog); } diff --git a/src/Player.hpp b/src/Player.hpp index 460e4dd2..fcfeac17 100644 --- a/src/Player.hpp +++ b/src/Player.hpp @@ -23,7 +23,6 @@ #include "Item.hpp" #include "Showcase.hpp" #include "dialog/MerchantDialog.hpp" -#include "dialog/AuctionDialog.hpp" #include "dialog/SelectionDialog.hpp" #include "netinterface/BasicServerCommand.hpp" #include "netinterface/NetInterface.hpp" @@ -510,12 +509,6 @@ class Player : public Character { Item::number_type amount); void executeMerchantDialogLookAt(unsigned int dialogId, uint8_t list, uint8_t slot); - void requestAuctionDialog(AuctionDialog *auctionDialog) override; - void executeAuctionDialogAbort(unsigned int dialogId); - void executeAuctionDialogBid(unsigned int dialogId, AuctionDialog::index_type index, - Item::number_type amount) const; - void executeAuctionDialogLookAt(unsigned int dialogId, uint8_t list, uint8_t slot); - void requestSelectionDialog(SelectionDialog *selectionDialog) override; void executeSelectionDialog(unsigned int dialogId, bool success, SelectionDialog::index_type index); diff --git a/src/dialog/AuctionDialog.cpp b/src/dialog/AuctionDialog.cpp deleted file mode 100644 index 8c88d230..00000000 --- a/src/dialog/AuctionDialog.cpp +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Illarionserver - server for the game Illarion - * Copyright 2011 Illarion e.V. - * - * This file is part of Illarionserver. - * - * Illarionserver is free software: you can redistribute it and/or modify it - * under the terms of the GNU Affero General Public License as published by the Free - * Software Foundation, either version 3 of the License, or (at your option) any - * later version. - * - * Illarionserver is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more - * details. - * - * You should have received a copy of the GNU Affero General Public License along with - * Illarionserver. If not, see . - */ - -#include "dialog/AuctionDialog.hpp" - -#include "data/Data.hpp" - -AuctionDialog::AuctionDialog(const string &title, const luabind::object &callback) - : Dialog(title, "AuctionDialog", callback) {} - -auto AuctionDialog::getOffersSize() const -> index_type { return offers.size(); } - -auto AuctionDialog::getOffersBegin() const -> offer_iterator { return offers.cbegin(); } - -auto AuctionDialog::getOffersEnd() const -> offer_iterator { return offers.cend(); } - -void AuctionDialog::addOffer(TYPE_OF_ITEM_ID item, const string &name, TYPE_OF_WORTH price) { - const auto &itemStruct = Data::items()[item]; - addOffer(item, name, price, itemStruct.BuyStack); -} - -void AuctionDialog::addOffer(TYPE_OF_ITEM_ID item, const string &name, TYPE_OF_WORTH price, TYPE_OF_BUY_STACK stack) { - if (canAddOffer()) { - offers.emplace_back(item, name, price, stack); - } -} - -auto AuctionDialog::getPrimaryRequestsSize() const -> index_type { return getProductsSize(primaryRequests); } - -auto AuctionDialog::getPrimaryRequestsBegin() const -> product_iterator { return getProductsBegin(primaryRequests); } - -auto AuctionDialog::getPrimaryRequestsEnd() const -> product_iterator { return getProductsEnd(primaryRequests); } - -void AuctionDialog::addPrimaryRequest(TYPE_OF_ITEM_ID item, const string &name, TYPE_OF_WORTH price) { - addProduct(primaryRequests, item, name, price); -} - -auto AuctionDialog::getSecondaryRequestsSize() const -> index_type { return getProductsSize(secondaryRequests); } - -auto AuctionDialog::getSecondaryRequestsBegin() const -> product_iterator { - return getProductsBegin(secondaryRequests); -} - -auto AuctionDialog::getSecondaryRequestsEnd() const -> product_iterator { return getProductsEnd(secondaryRequests); } - -void AuctionDialog::addSecondaryRequest(TYPE_OF_ITEM_ID item, const string &name, TYPE_OF_WORTH price) { - addProduct(secondaryRequests, item, name, price); -} - -auto AuctionDialog::getResult() const -> Result { return result; } - -void AuctionDialog::setResult(Result result) { this->result = result; } - -auto AuctionDialog::getPurchaseIndex() const -> index_type { return purchaseIndex; } - -void AuctionDialog::setPurchaseIndex(index_type index) { purchaseIndex = index; } - -auto AuctionDialog::getPurchaseAmount() const -> Item::number_type { return purchaseAmount; } - -void AuctionDialog::setPurchaseAmount(Item::number_type amount) { purchaseAmount = amount; } - -auto AuctionDialog::getSaleItem() const -> const ScriptItem & { return saleItem; } - -void AuctionDialog::setSaleItem(const ScriptItem &item) { saleItem = item; } - -auto AuctionDialog::getLookAtList() const -> ListType { return lookAtList; } - -void AuctionDialog::setLookAtList(ListType list) { lookAtList = list; } - -auto AuctionDialog::closeOnMove() const -> bool { return true; } - -auto AuctionDialog::getProductsSize(const product_list &products) -> index_type { return products.size(); } - -auto AuctionDialog::getProductsBegin(const product_list &products) -> product_iterator { return products.cbegin(); } - -auto AuctionDialog::getProductsEnd(const product_list &products) -> product_iterator { return products.cend(); } - -void AuctionDialog::addProduct(product_list &products, TYPE_OF_ITEM_ID item, const string &name, TYPE_OF_WORTH price) { - if (canAddProduct(products)) { - products.emplace_back(item, name, price); - } -} - -auto AuctionDialog::canAddOffer() const -> bool { return offers.size() < MAXPRODUCTS; } - -auto AuctionDialog::canAddProduct(const product_list &products) -> bool { return products.size() < MAXPRODUCTS; } diff --git a/src/dialog/AuctionDialog.hpp b/src/dialog/AuctionDialog.hpp deleted file mode 100644 index a397ec4e..00000000 --- a/src/dialog/AuctionDialog.hpp +++ /dev/null @@ -1,126 +0,0 @@ -/* - * Illarionserver - server for the game Illarion - * Copyright 2011 Illarion e.V. - * - * This file is part of Illarionserver. - * - * Illarionserver is free software: you can redistribute it and/or modify it - * under the terms of the GNU Affero General Public License as published by the Free - * Software Foundation, either version 3 of the License, or (at your option) any - * later version. - * - * Illarionserver is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more - * details. - * - * You should have received a copy of the GNU Affero General Public License along with - * Illarionserver. If not, see . - */ - -#ifndef AUCTION_DIALOG_HPP -#define AUCTION_DIALOG_HPP - -#include "Item.hpp" -#include "dialog/Dialog.hpp" - -#include -#include - -using std::vector; - -class Product { -private: - TYPE_OF_ITEM_ID item; - string name; - TYPE_OF_WORTH price; - -public: - Product(TYPE_OF_ITEM_ID item, string name, TYPE_OF_WORTH price) : item(item), name(std::move(name)), price(price){}; - [[nodiscard]] auto getItem() const -> TYPE_OF_ITEM_ID { return item; }; - [[nodiscard]] auto getName() const -> const string & { return name; }; - [[nodiscard]] auto getPrice() const -> TYPE_OF_WORTH { return price; }; -}; - -class OfferProduct : public Product { -private: - TYPE_OF_BUY_STACK stack; - -public: - OfferProduct(TYPE_OF_ITEM_ID item, const string &name, TYPE_OF_WORTH price, TYPE_OF_BUY_STACK stack) - : Product(item, name, price), stack(stack){}; - [[nodiscard]] auto getStack() const -> TYPE_OF_BUY_STACK { return stack; }; -}; - -class AuctionDialog : public Dialog { -public: - using index_type = uint8_t; - using product_list = vector; - using product_iterator = product_list::const_iterator; - using offer_list = vector; - using offer_iterator = offer_list::const_iterator; - - enum Result { playerAborts = 0, playerBids = 1, playerLooksAt = 2 }; - - enum ListType { listBid = 1 }; - -private: - static const uint32_t MAXPRODUCTS = 256; - offer_list offers; - product_list primaryRequests; - product_list secondaryRequests; - - Result result{playerAborts}; - - index_type purchaseIndex{0}; - Item::number_type purchaseAmount{0}; - - ScriptItem saleItem; - - ListType lookAtList{listSell}; - -public: - AuctionDialog(const string &title, const luabind::object &callback); - - auto getOffersSize() const -> index_type; - auto getOffersBegin() const -> offer_iterator; - auto getOffersEnd() const -> offer_iterator; - void addOffer(TYPE_OF_ITEM_ID item, const string &name, TYPE_OF_WORTH price); - void addOffer(TYPE_OF_ITEM_ID item, const string &name, TYPE_OF_WORTH price, TYPE_OF_BUY_STACK stack); - - auto getPrimaryRequestsSize() const -> index_type; - auto getPrimaryRequestsBegin() const -> product_iterator; - auto getPrimaryRequestsEnd() const -> product_iterator; - void addPrimaryRequest(TYPE_OF_ITEM_ID item, const string &name, TYPE_OF_WORTH price); - - auto getSecondaryRequestsSize() const -> index_type; - auto getSecondaryRequestsBegin() const -> product_iterator; - auto getSecondaryRequestsEnd() const -> product_iterator; - void addSecondaryRequest(TYPE_OF_ITEM_ID item, const string &name, TYPE_OF_WORTH price); - - auto getResult() const -> Result; - void setResult(Result result); - - auto getPurchaseIndex() const -> index_type; - void setPurchaseIndex(index_type index); - auto getPurchaseAmount() const -> Item::number_type; - void setPurchaseAmount(Item::number_type amount); - - auto getSaleItem() const -> const ScriptItem &; - void setSaleItem(const ScriptItem &item); - - auto getLookAtList() const -> ListType; - void setLookAtList(ListType list); - - auto closeOnMove() const -> bool override; - -private: - static auto getProductsSize(const product_list &products) -> index_type; - static auto getProductsBegin(const product_list &products) -> product_iterator; - static auto getProductsEnd(const product_list &products) -> product_iterator; - static void addProduct(product_list &products, TYPE_OF_ITEM_ID item, const string &name, TYPE_OF_WORTH price); - auto canAddOffer() const -> bool; - static auto canAddProduct(const product_list &products) -> bool; -}; - -#endif diff --git a/src/dialog/CMakeLists.txt b/src/dialog/CMakeLists.txt index 4a5deda8..fee05793 100644 --- a/src/dialog/CMakeLists.txt +++ b/src/dialog/CMakeLists.txt @@ -7,7 +7,6 @@ target_sources( dialog Dialog.cpp InputDialog.cpp MerchantDialog.cpp - AuctionDialog.cpp MessageDialog.cpp SelectionDialog.cpp ) diff --git a/src/netinterface/CommandFactory.cpp b/src/netinterface/CommandFactory.cpp index 5d82bdbe..e3c05848 100644 --- a/src/netinterface/CommandFactory.cpp +++ b/src/netinterface/CommandFactory.cpp @@ -27,7 +27,6 @@ CommandFactory::CommandFactory() { templateList[C_MESSAGEDIALOG_TS] = std::make_unique(); templateList[C_INPUTDIALOG_TS] = std::make_unique(); templateList[C_MERCHANTDIALOG_TS] = std::make_unique(); - templateList[C_AUCTIONDIALOG_TS] = std::make_unique(); templateList[C_SELECTIONDIALOG_TS] = std::make_unique(); templateList[C_CRAFTINGDIALOG_TS] = std::make_unique(); templateList[C_LOGIN_TS] = std::make_unique(); diff --git a/src/netinterface/protocol/ClientCommands.cpp b/src/netinterface/protocol/ClientCommands.cpp index ca6e51ec..094c888e 100644 --- a/src/netinterface/protocol/ClientCommands.cpp +++ b/src/netinterface/protocol/ClientCommands.cpp @@ -131,50 +131,6 @@ auto MerchantDialogTS::clone() -> ClientCommandPointer { return cmd; } -AuctionDialogTS::AuctionDialogTS() : BasicClientCommand(C_AUCTIONDIALOG_TS) {} - -void AuctionDialogTS::decodeData() { - dialogId = getIntFromBuffer(); - result = getUnsignedCharFromBuffer(); - - switch (result) { - case 0: - break; - - case 1: - purchaseIndex = getUnsignedCharFromBuffer(); - purchaseAmount = getShortIntFromBuffer(); - break; - - case 3: - lookAtList = getUnsignedCharFromBuffer(); - lookAtSlot = getUnsignedCharFromBuffer(); - break; - } -} - -void AuctionDialogTS::performAction(Player *player) { - time(&(player->lastaction)); - - switch (result) { - case 0: - player->executeAuctionDialogAbort(dialogId); - break; - case 1: - player->executeAuctionDialogBid(dialogId, purchaseIndex, purchaseAmount); - break; - - case 3: - player->executeAuctionDialogLookAt(dialogId, lookAtList, lookAtSlot); - break; - } -} - -auto AuctionDialogTS::clone() -> ClientCommandPointer { - ClientCommandPointer cmd = std::make_shared(); - return cmd; -} - SelectionDialogTS::SelectionDialogTS() : BasicClientCommand(C_SELECTIONDIALOG_TS) {} void SelectionDialogTS::decodeData() { diff --git a/src/netinterface/protocol/ClientCommands.hpp b/src/netinterface/protocol/ClientCommands.hpp index 63f88c06..9bc57491 100644 --- a/src/netinterface/protocol/ClientCommands.hpp +++ b/src/netinterface/protocol/ClientCommands.hpp @@ -69,8 +69,7 @@ enum clientcommands { C_MESSAGEDIALOG_TS = 0x51, C_MERCHANTDIALOG_TS = 0x52, C_SELECTIONDIALOG_TS = 0x53, - C_CRAFTINGDIALOG_TS = 0x54, - C_AUCTIONDIALOG_TS = 0x56 + C_CRAFTINGDIALOG_TS = 0x54 }; class InputDialogTS : public BasicClientCommand { @@ -116,25 +115,6 @@ class MerchantDialogTS : public BasicClientCommand { auto clone() -> ClientCommandPointer override; }; -class AuctionDialogTS : public BasicClientCommand { -private: - unsigned int dialogId = 0; - uint8_t result = 0; - uint8_t purchaseIndex = 0; - uint16_t purchaseAmount = 0; - uint8_t saleLocation = 0; - uint16_t saleSlot = 0; - uint16_t saleAmount = 0; - uint8_t lookAtList = 0; - uint8_t lookAtSlot = 0; - -public: - AuctionDialogTS(); - void decodeData() override; - void performAction(Player *player) override; - auto clone() -> ClientCommandPointer override; -}; - class SelectionDialogTS : public BasicClientCommand { private: unsigned int dialogId = 0; diff --git a/src/netinterface/protocol/ServerCommands.cpp b/src/netinterface/protocol/ServerCommands.cpp index 59482693..5d13037a 100644 --- a/src/netinterface/protocol/ServerCommands.cpp +++ b/src/netinterface/protocol/ServerCommands.cpp @@ -27,7 +27,6 @@ #include "dialog/CraftingDialog.hpp" #include "dialog/InputDialog.hpp" #include "dialog/MerchantDialog.hpp" -#include "dialog/AuctionDialog.hpp" #include "dialog/MessageDialog.hpp" #include "dialog/SelectionDialog.hpp" #include "globals.hpp" @@ -129,41 +128,6 @@ MerchantDialogTC::MerchantDialogTC(const MerchantDialog &merchantDialog, unsigne addIntToBuffer(static_cast(dialogId)); } -AuctionDialogTC::AuctionDialogTC(const AuctionDialog &auctionDialog, unsigned int dialogId) - : BasicServerCommand(SC_AUCTIONDIALOG_TC) { - addStringToBuffer(auctionDialog.getTitle()); - AuctionDialog::index_type size = auctionDialog.getOffersSize(); - addUnsignedCharToBuffer(size); - - for (auto it = auctionDialog.getOffersBegin(); it != auctionDialog.getOffersEnd(); ++it) { - const OfferProduct &offer = *it; - addShortIntToBuffer(offer.getItem()); - addStringToBuffer(offer.getName()); - addIntToBuffer(offer.getPrice()); - addShortIntToBuffer(offer.getStack()); - } - - size = auctionDialog.getPrimaryRequestsSize(); - addUnsignedCharToBuffer(size); - - for (auto it = auctionDialog.getPrimaryRequestsBegin(); it != auctionDialog.getPrimaryRequestsEnd(); ++it) { - addShortIntToBuffer(it->getItem()); - addStringToBuffer(it->getName()); - addIntToBuffer(it->getPrice()); - } - - size = auctionDialog.getSecondaryRequestsSize(); - addUnsignedCharToBuffer(size); - - for (auto it = auctionDialog.getSecondaryRequestsBegin(); it != auctionDialog.getSecondaryRequestsEnd(); ++it) { - addShortIntToBuffer(it->getItem()); - addStringToBuffer(it->getName()); - addIntToBuffer(it->getPrice()); - } - - addIntToBuffer(static_cast(dialogId)); -} - SelectionDialogTC::SelectionDialogTC(const SelectionDialog &selectionDialog, unsigned int dialogId) : BasicServerCommand(SC_SELECTIONDIALOG_TC) { addStringToBuffer(selectionDialog.getTitle()); diff --git a/src/netinterface/protocol/ServerCommands.hpp b/src/netinterface/protocol/ServerCommands.hpp index 4787105f..aa58b77b 100644 --- a/src/netinterface/protocol/ServerCommands.hpp +++ b/src/netinterface/protocol/ServerCommands.hpp @@ -84,7 +84,6 @@ enum ServerCommands { SC_SELECTIONDIALOG_TC = 0x53, SC_CRAFTINGDIALOG_TC = 0x54, SC_CRAFTINGDIALOGUPDATE_TC = 0x55, - SC_AUCTIONDIALOG_TC = 0x56, SC_CLOSEDIALOG_TC = 0x5F, SC_QUESTPROGRESS_TC = 0x40, SC_ABORTQUEST_TC = 0x41, @@ -130,13 +129,6 @@ class MerchantDialogTC : public BasicServerCommand { MerchantDialogTC(const MerchantDialog &merchantDialog, unsigned int dialogId); }; -class AuctionDialog; -class AuctionDialogTC : public BasicServerCommand { -public: - AuctionDialogTC(const AuctionDialog &auctionDialog, unsigned int dialogId); -}; - - class SelectionDialog; class SelectionDialogTC : public BasicServerCommand { public: diff --git a/src/script/LuaScript.cpp b/src/script/LuaScript.cpp index 7bb79c8d..3f97002f 100644 --- a/src/script/LuaScript.cpp +++ b/src/script/LuaScript.cpp @@ -362,7 +362,6 @@ void LuaScript::init_base_functions() { binding::crafting_dialog(), binding::field(), binding::input_dialog(), binding::item(), binding::item_look_at(), binding::long_time_action(), binding::long_time_character_effects(), binding::long_time_effect(), binding::long_time_effect_struct(), binding::merchant_dialog(), - binding::auction_dialog(), binding::message_dialog(), binding::monster(), binding::monster_armor(), binding::npc(), binding::player(), binding::position(), binding::random(), binding::script_item(), binding::script_variables_table(), binding::selection_dialog(), binding::tiles_struct(), diff --git a/src/script/binding/CMakeLists.txt b/src/script/binding/CMakeLists.txt index 0a979904..69245c2f 100644 --- a/src/script/binding/CMakeLists.txt +++ b/src/script/binding/CMakeLists.txt @@ -20,7 +20,6 @@ target_sources( script_binding long_time_effect.cpp long_time_effect_struct.cpp merchant_dialog.cpp - auction_dialog.cpp message_dialog.cpp monster.cpp monster_armor.cpp diff --git a/src/script/binding/auction_dialog.cpp b/src/script/binding/auction_dialog.cpp deleted file mode 100644 index d96ef53b..00000000 --- a/src/script/binding/auction_dialog.cpp +++ /dev/null @@ -1,47 +0,0 @@ -/* - * illarionserver - server for the game Illarion - * Copyright 2011 Illarion e.V. - * - * This file is part of illarionserver. - * - * illarionserver is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * illarionserver is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with illarionserver. If not, see . - */ - -#include "dialog/AuctionDialog.hpp" -#include "script/binding/binding.hpp" - -namespace binding { - -auto auction_dialog() -> Binding { - return luabind::class_("AuctionDialog") - .enum_("Result")[luabind::value("playerAborts", AuctionDialog::playerAborts), - luabind::value("playerBids", AuctionDialog::playerBids), - luabind::value("playerLooksAt", AuctionDialog::playerLooksAt)] - .enum_("ListType")[luabind::value("listBid", AuctionDialog::listBid)] - .def(luabind::constructor()) - .def("addOffer", (void (AuctionDialog::*)(TYPE_OF_ITEM_ID, const std::string &, TYPE_OF_WORTH)) & - AuctionDialog::addOffer) - .def("addOffer", - (void (AuctionDialog::*)(TYPE_OF_ITEM_ID, const std::string &, TYPE_OF_WORTH, TYPE_OF_BUY_STACK)) & - AuctionDialog::addOffer) - .def("addPrimaryRequest", &AuctionDialog::addPrimaryRequest) - .def("addSecondaryRequest", &AuctionDialog::addSecondaryRequest) - .def("getResult", &AuctionDialog::getResult) - .def("getPurchaseIndex", &AuctionDialog::getPurchaseIndex) - .def("getPurchaseAmount", &AuctionDialog::getPurchaseAmount) - .def("getSaleItem", &AuctionDialog::getSaleItem) - .def("getLookAtList", &AuctionDialog::getLookAtList); -} - -} // namespace binding diff --git a/src/script/binding/binding.hpp b/src/script/binding/binding.hpp index 487bf680..8a67f4ec 100644 --- a/src/script/binding/binding.hpp +++ b/src/script/binding/binding.hpp @@ -40,7 +40,6 @@ class LongTimeCharacterEffects; class LongTimeEffect; struct LongTimeEffectStruct; class MerchantDialog; -class AuctionDialog; class MessageDialog; class Monster; struct MonsterArmor; @@ -79,7 +78,6 @@ auto long_time_character_effects() -> Binding; auto long_time_effect() -> Binding; auto long_time_effect_struct() -> Binding; auto merchant_dialog() -> Binding; -auto auction_dialog() -> Binding; auto message_dialog() -> Binding; auto monster() -> Binding; auto monster_armor() -> Binding; diff --git a/src/script/binding/character.cpp b/src/script/binding/character.cpp index e14d5484..33b75993 100644 --- a/src/script/binding/character.cpp +++ b/src/script/binding/character.cpp @@ -53,7 +53,6 @@ auto character() -> Binding { .def("requestInputDialog", &Character::requestInputDialog, luabind::adopt(_2)) .def("requestMessageDialog", &Character::requestMessageDialog, luabind::adopt(_2)) .def("requestMerchantDialog", &Character::requestMerchantDialog, luabind::adopt(_2)) - .def("requestAuctionDialog", &Character::requestAuctionDialog, luabind::adopt(_2)) .def("requestSelectionDialog", &Character::requestSelectionDialog, luabind::adopt(_2)) .def("requestCraftingDialog", &Character::requestCraftingDialog, luabind::adopt(_2)) .def("idleTime", &Character::idleTime) diff --git a/test/test_binding_character.cpp b/test/test_binding_character.cpp index ca8ed52f..e9f62945 100644 --- a/test/test_binding_character.cpp +++ b/test/test_binding_character.cpp @@ -6,7 +6,6 @@ #include "dialog/InputDialog.hpp" #include "dialog/MessageDialog.hpp" #include "dialog/MerchantDialog.hpp" -#include "dialog/AuctionDialog.hpp" #include "dialog/SelectionDialog.hpp" #include "dialog/CraftingDialog.hpp" @@ -30,7 +29,6 @@ class MockMonster : public Monster { MOCK_METHOD(void, requestInputDialog, (InputDialog *), (override)); MOCK_METHOD(void, requestMessageDialog, (MessageDialog *), (override)); MOCK_METHOD(void, requestMerchantDialog, (MerchantDialog *), (override)); - MOCK_METHOD(void, requestAuctionDialog, (AuctionDialog *), (override)); MOCK_METHOD(void, requestSelectionDialog, (SelectionDialog *), (override)); MOCK_METHOD(void, requestCraftingDialog, (CraftingDialog *), (override)); MOCK_METHOD(void, requestCraftingLookAt, (unsigned int, ItemLookAt &), (override)); @@ -159,19 +157,6 @@ TEST_F(monster_bindings, requestMerchantDialog) { delete dialog; } -TEST_F(monster_bindings, requestAuctionDialog) { - LuaTestSupportScript script {"function test(monster) \ - dialog = AuctionDialog('foo', nil) \ - monster:requestAuctionDialog(dialog) \ - dialog = nil \ - collectgarbage() \ - end"}; - AuctionDialog *dialog = nullptr; - EXPECT_CALL(*monster, requestAuctionDialog(Property(&AuctionDialog::getTitle, "foo"))).WillOnce(SaveArg<0>(&dialog)); - script.test(monster); - delete dialog; -} - TEST_F(monster_bindings, requestSelectionDialog) { LuaTestSupportScript script {"function test(monster) \ dialog = SelectionDialog('foo', '', nil) \ diff --git a/tools/wireshark/illarion.lua b/tools/wireshark/illarion.lua index 2f780f53..78d418a8 100644 --- a/tools/wireshark/illarion.lua +++ b/tools/wireshark/illarion.lua @@ -77,7 +77,6 @@ server_commands[0x52] = "MERCHANTDIALOG" server_commands[0x53] = "SELECTIONDIALOG" server_commands[0x54] = "CRAFTINGDIALOG" server_commands[0x55] = "CRAFTINGDIALOGUPDATE" -server_commands[0x56] = "AUCTIONDIALOG" server_commands[0x5F] = "CLOSEDIALOG" server_commands[0x40] = "QUESTPROGRESS" server_commands[0x41] = "ABORTQUEST" @@ -126,7 +125,6 @@ client_commands[0x51] = "MESSAGEDIALOG" client_commands[0x52] = "MERCHANTDIALOG" client_commands[0x53] = "SELECTIONDIALOG" client_commands[0x54] = "CRAFTINGDIALOG" -client_commands[0x56] = "AUCTIONDIALOG" local function server_command_name(id) return server_commands[id] or "unknown"