diff --git a/src/creatures/CMakeLists.txt b/src/creatures/CMakeLists.txt index c09f411ab2d..c87a45a0aa0 100644 --- a/src/creatures/CMakeLists.txt +++ b/src/creatures/CMakeLists.txt @@ -25,7 +25,6 @@ target_sources(${PROJECT_NAME}_lib PRIVATE players/cyclopedia/player_badge.cpp players/cyclopedia/player_cyclopedia.cpp players/cyclopedia/player_title.cpp - players/gamestore/player_store_detail.cpp players/wheel/player_wheel.cpp players/wheel/wheel_gems.cpp players/vocations/vocation.cpp diff --git a/src/creatures/players/gamestore/player_store_detail.cpp b/src/creatures/players/gamestore/player_store_detail.cpp deleted file mode 100644 index db56ccff14e..00000000000 --- a/src/creatures/players/gamestore/player_store_detail.cpp +++ /dev/null @@ -1,37 +0,0 @@ -/** - * Canary - A free and open-source MMORPG server emulator - * Copyright (©) 2019-2024 OpenTibiaBR - * Repository: https://github.com/opentibiabr/canary - * License: https://github.com/opentibiabr/canary/blob/main/LICENSE - * Contributors: https://github.com/opentibiabr/canary/graphs/contributors - * Website: https://docs.opentibiabr.com/ - */ - -#include "pch.hpp" - -#include "creatures/players/gamestore/player_store_detail.hpp" - -#include "kv/kv.hpp" - -std::string StoreDetail::toString() const { - return fmt::format("Description: {}, Coin Amount: {}, CreatedAt: {}, Is Gold: {}", description, coinAmount, createdAt, isGold); -} - -ValueWrapper StoreDetail::serialize() const { - return { - { "description", description }, - { "coinAmount", coinAmount }, - { "created_at", createdAt }, - { "is_gold", isGold } - }; -} - -StoreDetail StoreDetail::deserialize(const ValueWrapper &val) { - auto map = val.get(); - return { - map["description"]->get(), - map["coinAmount"]->get(), - map["created_at"]->get(), - map["is_gold"]->get() - }; -} diff --git a/src/creatures/players/gamestore/player_store_detail.hpp b/src/creatures/players/gamestore/player_store_detail.hpp deleted file mode 100644 index 9518d98d49e..00000000000 --- a/src/creatures/players/gamestore/player_store_detail.hpp +++ /dev/null @@ -1,30 +0,0 @@ -/** - * Canary - A free and open-source MMORPG server emulator - * Copyright (©) 2019-2024 OpenTibiaBR - * Repository: https://github.com/opentibiabr/canary - * License: https://github.com/opentibiabr/canary/blob/main/LICENSE - * Contributors: https://github.com/opentibiabr/canary/graphs/contributors - * Website: https://docs.opentibiabr.com/ - */ - -#pragma once - -#include "kv/value_wrapper_proto.hpp" - -class ValueWrapper; - -#ifndef USE_PRECOMPILED_HEADERS - #include - #include -#endif - -struct StoreDetail { - std::string description; - int32_t coinAmount {}; - int createdAt {}; - bool isGold {}; - - std::string toString() const; - ValueWrapper serialize() const; - static StoreDetail deserialize(const ValueWrapper &val); -}; diff --git a/src/creatures/players/player.cpp b/src/creatures/players/player.cpp index d4ffd2e1049..2244606ddef 100644 --- a/src/creatures/players/player.cpp +++ b/src/creatures/players/player.cpp @@ -45,7 +45,7 @@ #include "enums/account_group_type.hpp" #include "enums/player_blessings.hpp" #include "creatures/creatures_definitions.hpp" -#include "creatures/players/gamestore/player_store_detail.hpp" +#include "creatures/players/player_store_detail.hpp" MuteCountMap Player::muteCountMap; diff --git a/src/creatures/players/player_store_detail.hpp b/src/creatures/players/player_store_detail.hpp new file mode 100644 index 00000000000..50e85bf47cb --- /dev/null +++ b/src/creatures/players/player_store_detail.hpp @@ -0,0 +1,42 @@ + +#pragma once + +#include "kv/value_wrapper_proto.hpp" + +class ValueWrapper; + +#ifndef USE_PRECOMPILED_HEADERS + #include + #include +#endif + +struct StoreDetail { + + std::string toString() const { + return fmt::format("Description: {}, Coin Amount: {}, CreatedAt: {}, Is Gold: {}", description, coinAmount, createdAt, isGold); + } + + ValueWrapper serialize() const { + return { + { "description", description }, + { "coinAmount", coinAmount }, + { "created_at", createdAt }, + { "is_gold", isGold } + }; + } + + static StoreDetail deserialize(const ValueWrapper &val) { + auto map = val.get(); + return { + map["description"]->get(), + map["coinAmount"]->get(), + map["created_at"]->get(), + map["is_gold"]->get() + }; + } + + std::string description; + int32_t coinAmount {}; + int createdAt {}; + bool isGold {}; +}; diff --git a/src/game/game.cpp b/src/game/game.cpp index 33a9c70e6fc..bfb779cbf8b 100644 --- a/src/game/game.cpp +++ b/src/game/game.cpp @@ -41,7 +41,7 @@ #include "creatures/players/cyclopedia/player_badge.hpp" #include "creatures/players/cyclopedia/player_cyclopedia.hpp" #include "creatures/players/cyclopedia/player_title.hpp" -#include "creatures/players/gamestore/player_store_detail.hpp" +#include "creatures/players/player_store_detail.hpp" #include "creatures/npcs/npc.hpp" #include "server/network/webhook/webhook.hpp" #include "server/network/protocol/protocollogin.hpp" diff --git a/src/server/network/protocol/protocolgame.cpp b/src/server/network/protocol/protocolgame.cpp index a5ca1caea39..c447113e924 100644 --- a/src/server/network/protocol/protocolgame.cpp +++ b/src/server/network/protocol/protocolgame.cpp @@ -34,7 +34,7 @@ #include "server/network/protocol/protocolgame.hpp" #include "game/scheduling/dispatcher.hpp" #include "creatures/combat/spells.hpp" -#include "creatures/players/gamestore/player_store_detail.hpp" +#include "creatures/players/player_store_detail.hpp" #include "utils/tools.hpp" #include "creatures/players/management/waitlist.hpp" #include "items/weapons/weapons.hpp"