From 887683e8837ffd974932df095a6ab9560e43818b Mon Sep 17 00:00:00 2001 From: Matt Gomez Date: Thu, 14 Sep 2023 09:40:30 -0600 Subject: [PATCH] update code to: https://github.com/opentibiabr/canary/commit/eb20f2604cfa59ea866c8804dc029287218c2581 --- CMakeLists.txt | 1 + CMakePresets.json | 16 +- cmake/modules/CanaryLib.cmake | 16 +- config.lua.dist | 4 +- schema.sql | 11 +- src/account/CMakeLists.txt | 4 + src/account/account.cpp | 263 + src/account/account.hpp | 157 + src/account/account_definitions.hpp | 64 + src/account/account_repository.hpp | 37 + src/account/account_repository_db.cpp | 189 + src/account/account_repository_db.hpp | 54 + src/canary_server.cpp | 3 +- src/config/config_definitions.hpp | 4 +- src/config/configmanager.cpp | 8 +- src/core.hpp | 2 +- src/creatures/CMakeLists.txt | 1 - src/creatures/combat/combat.cpp | 144 +- src/creatures/combat/combat.hpp | 3 +- src/creatures/combat/condition.cpp | 2 +- src/creatures/creature.cpp | 25 +- src/creatures/creature.hpp | 38 +- src/creatures/interactions/chat.cpp | 4 +- src/creatures/monsters/monster.cpp | 16 +- src/creatures/monsters/monster.hpp | 28 +- src/creatures/monsters/monsters.cpp | 2 +- .../monsters/spawns/spawn_monster.cpp | 6 +- src/creatures/npcs/npc.cpp | 12 +- src/creatures/npcs/npc.hpp | 2 +- src/creatures/npcs/spawns/spawn_npc.cpp | 6 +- src/creatures/players/account/account.cpp | 511 - src/creatures/players/account/account.hpp | 265 - src/creatures/players/grouping/party.cpp | 75 +- src/creatures/players/grouping/party.hpp | 7 +- src/creatures/players/player.cpp | 109 +- src/creatures/players/player.hpp | 74 +- src/creatures/players/wheel/player_wheel.cpp | 10 +- src/database/database.cpp | 5 + src/database/database.hpp | 7 +- src/database/databasetasks.cpp | 5 +- src/database/databasetasks.hpp | 1 - src/enums/item_attribute.hpp | 1 + src/game/game.cpp | 263 +- src/game/game.hpp | 10 +- src/game/movement/position.hpp | 5 + src/game/scheduling/dispatcher.cpp | 41 +- src/game/scheduling/dispatcher.hpp | 7 +- src/game/scheduling/scheduler.cpp | 10 +- src/game/scheduling/scheduler.hpp | 4 +- src/game/scheduling/task.hpp | 32 +- src/io/functions/iologindata_load_player.cpp | 88 +- src/io/io_bosstiary.cpp | 12 + src/io/iologindata.cpp | 100 +- src/io/iologindata.hpp | 10 +- src/io/iomarket.cpp | 2 +- src/io/iomarket.hpp | 1 + src/items/bed.cpp | 2 +- src/items/containers/container.cpp | 127 +- src/items/containers/container.hpp | 6 + src/items/containers/mailbox/mailbox.cpp | 10 + src/items/decay/decay.cpp | 12 +- src/items/functions/item/attribute.hpp | 1 + src/items/functions/item/item_parse.cpp | 8 +- src/items/functions/item/item_parse.hpp | 2 + src/items/item.cpp | 22 +- src/items/item.hpp | 14 +- src/items/items.cpp | 1 + src/items/items.hpp | 8 + src/items/items_definitions.hpp | 127 + src/kv/CMakeLists.txt | 5 + src/kv/README.md | 142 + src/kv/kv.cpp | 70 + src/kv/kv.hpp | 150 + src/kv/kv_sql.cpp | 74 + src/kv/kv_sql.hpp | 33 + src/kv/value_wrapper.cpp | 51 + src/kv/value_wrapper.hpp | 180 + src/kv/value_wrapper_proto.hpp | 113 + src/lib/di/container.hpp | 4 + src/lua/creature/events.cpp | 10 - src/lua/creature/raids.cpp | 8 +- src/lua/creature/talkaction.hpp | 2 +- src/lua/functions/core/CMakeLists.txt | 1 + .../functions/core/game/game_functions.cpp | 4 +- .../functions/core/game/global_functions.cpp | 4 +- src/lua/functions/core/game/lua_enums.cpp | 10 +- src/lua/functions/core/game/lua_enums.hpp | 2 +- .../core/libs/core_libs_functions.hpp | 2 + src/lua/functions/core/libs/kv_functions.cpp | 169 + src/lua/functions/core/libs/kv_functions.hpp | 40 + .../creatures/creature_functions.cpp | 83 +- .../creatures/creature_functions.hpp | 6 + .../creatures/monster/monster_functions.cpp | 18 +- .../creatures/monster/monster_functions.hpp | 2 + .../monster/monster_type_functions.cpp | 4 +- .../functions/creatures/npc/npc_functions.cpp | 8 +- .../creatures/player/player_functions.cpp | 315 +- .../creatures/player/player_functions.hpp | 18 + .../events/talk_action_functions.cpp | 2 +- .../functions/items/item_type_functions.cpp | 13 + .../functions/items/item_type_functions.hpp | 2 + src/lua/functions/lua_functions_loader.hpp | 1 + src/lua/global/globalevent.cpp | 12 +- src/lua/global/globalevent.hpp | 2 +- src/map/house/house.cpp | 6 +- src/map/mapcache.cpp | 3 +- src/protobuf/CMakeLists.txt | 13 +- src/protobuf/appearances.pb.cc | 289 +- src/protobuf/appearances.pb.h | 86 + src/protobuf/appearances.pb.hpp | 11420 ---------------- src/protobuf/appearances.proto | 2 + src/protobuf/kv.pb.cc | 1214 ++ src/protobuf/kv.pb.h | 1386 ++ src/protobuf/kv.proto | 31 + src/security/argon.cpp | 2 +- src/server/network/connection/connection.cpp | 4 +- src/server/network/message/outputmessage.cpp | 2 +- src/server/network/protocol/protocol.cpp | 2 +- src/server/network/protocol/protocolgame.cpp | 227 +- src/server/network/protocol/protocolgame.hpp | 2 +- src/server/network/protocol/protocollogin.cpp | 39 +- src/server/network/protocol/protocollogin.hpp | 2 +- .../network/protocol/protocolstatus.cpp | 8 +- src/server/network/webhook/webhook.cpp | 4 +- src/server/server.cpp | 4 +- src/server/signals.cpp | 10 +- src/utils/tools.cpp | 96 +- src/utils/tools.hpp | 7 + tests/CMakeLists.txt | 24 + tests/Dockerfile.database | 4 + tests/README.md | 125 + tests/build_and_run.sh | 12 + tests/docker-compose.yaml | 16 + .../account/in_memory_account_repository.hpp | 147 + tests/fixture/injection_fixture.hpp | 74 + tests/fixture/kv/in_memory_kv.hpp | 49 + .../fixture/lib/logging/in_memory_logger.hpp | 84 + tests/fixture/test_injection.hpp | 12 + tests/integration/CMakeLists.txt | 1 + tests/integration/main.cpp | 161 + tests/unit/CMakeLists.txt | 7 + tests/unit/account/CMakeLists.txt | 3 + tests/unit/account/account_test.cpp | 590 + tests/unit/kv/CMakeLists.txt | 3 + tests/unit/kv/kv_test.cpp | 100 + tests/unit/lib/CMakeLists.txt | 1 + tests/unit/lib/di/CMakeLists.txt | 3 + tests/unit/lib/di/soft_singleton_test.cpp | 61 + tests/unit/lib/logging/in_memory_logger.hpp | 84 + tests/unit/main.cpp | 5 + tests/unit/security/CMakeLists.txt | 3 + tests/unit/security/rsa_test.cpp | 33 + tests/unit/utils/CMakeLists.txt | 4 + tests/unit/utils/position_functions_test.cpp | 53 + tests/unit/utils/string_functions_test.cpp | 34 + vcproj/otxserver.vcxproj | 31 +- 156 files changed, 8147 insertions(+), 13113 deletions(-) create mode 100644 src/account/CMakeLists.txt create mode 100644 src/account/account.cpp create mode 100644 src/account/account.hpp create mode 100644 src/account/account_definitions.hpp create mode 100644 src/account/account_repository.hpp create mode 100644 src/account/account_repository_db.cpp create mode 100644 src/account/account_repository_db.hpp delete mode 100644 src/creatures/players/account/account.cpp delete mode 100644 src/creatures/players/account/account.hpp create mode 100644 src/kv/CMakeLists.txt create mode 100644 src/kv/README.md create mode 100644 src/kv/kv.cpp create mode 100644 src/kv/kv.hpp create mode 100644 src/kv/kv_sql.cpp create mode 100644 src/kv/kv_sql.hpp create mode 100644 src/kv/value_wrapper.cpp create mode 100644 src/kv/value_wrapper.hpp create mode 100644 src/kv/value_wrapper_proto.hpp create mode 100644 src/lua/functions/core/libs/kv_functions.cpp create mode 100644 src/lua/functions/core/libs/kv_functions.hpp delete mode 100644 src/protobuf/appearances.pb.hpp create mode 100644 src/protobuf/kv.pb.cc create mode 100644 src/protobuf/kv.pb.h create mode 100644 src/protobuf/kv.proto create mode 100644 tests/CMakeLists.txt create mode 100644 tests/Dockerfile.database create mode 100644 tests/README.md create mode 100644 tests/build_and_run.sh create mode 100644 tests/docker-compose.yaml create mode 100644 tests/fixture/account/in_memory_account_repository.hpp create mode 100644 tests/fixture/injection_fixture.hpp create mode 100644 tests/fixture/kv/in_memory_kv.hpp create mode 100644 tests/fixture/lib/logging/in_memory_logger.hpp create mode 100644 tests/fixture/test_injection.hpp create mode 100644 tests/integration/CMakeLists.txt create mode 100644 tests/integration/main.cpp create mode 100644 tests/unit/CMakeLists.txt create mode 100644 tests/unit/account/CMakeLists.txt create mode 100644 tests/unit/account/account_test.cpp create mode 100644 tests/unit/kv/CMakeLists.txt create mode 100644 tests/unit/kv/kv_test.cpp create mode 100644 tests/unit/lib/CMakeLists.txt create mode 100644 tests/unit/lib/di/CMakeLists.txt create mode 100644 tests/unit/lib/di/soft_singleton_test.cpp create mode 100644 tests/unit/lib/logging/in_memory_logger.hpp create mode 100644 tests/unit/main.cpp create mode 100644 tests/unit/security/CMakeLists.txt create mode 100644 tests/unit/security/rsa_test.cpp create mode 100644 tests/unit/utils/CMakeLists.txt create mode 100644 tests/unit/utils/position_functions_test.cpp create mode 100644 tests/unit/utils/string_functions_test.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index d82eeaea7..2f8278b7a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -95,6 +95,7 @@ else() endif() option(BUILD_TESTS "Build tests" OFF) # By default, tests will not be built +option(RUN_TESTS_AFTER_BUILD "Run tests when building" OFF) # By default, tests will only run if requested # ***************************************************************************** # Add project diff --git a/CMakePresets.json b/CMakePresets.json index 780849c68..35ba674b4 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -50,7 +50,8 @@ }, "BUILD_STATIC_LIBRARY": "ON", "CMAKE_BUILD_TYPE": "RelWithDebInfo", - "OPTIONS_ENABLE_CCACHE": "ON" + "OPTIONS_ENABLE_CCACHE": "ON", + "RUN_TESTS_AFTER_BUILD": "OFF" }, "condition": { "type": "equals", @@ -102,6 +103,15 @@ "SPEED_UP_BUILD_UNITY": "OFF", "ASAN_ENABLED": "ON" } + }, + { + "name": "linux-test", + "inherits": "linux-release", + "displayName": "Linux - Test Build", + "description": "Build Tests", + "cacheVariables": { + "BUILD_TESTS": "ON" + } } ], "buildPresets": [ @@ -113,6 +123,10 @@ "name": "linux-debug", "configurePreset": "linux-debug" }, + { + "name": "linux-test", + "configurePreset": "linux-test" + }, { "name": "windows-release", "configurePreset": "windows-release" diff --git a/cmake/modules/CanaryLib.cmake b/cmake/modules/CanaryLib.cmake index df29dda48..4b7d69d2b 100644 --- a/cmake/modules/CanaryLib.cmake +++ b/cmake/modules/CanaryLib.cmake @@ -3,6 +3,7 @@ add_library(${PROJECT_NAME}_lib) setup_target(${PROJECT_NAME}_lib) # Add subdirectories +add_subdirectory(account) add_subdirectory(config) add_subdirectory(creatures) add_subdirectory(database) @@ -10,6 +11,7 @@ add_subdirectory(game) add_subdirectory(io) add_subdirectory(items) add_subdirectory(lib) +add_subdirectory(kv) add_subdirectory(lua) add_subdirectory(map) add_subdirectory(security) @@ -17,7 +19,19 @@ add_subdirectory(server) add_subdirectory(utils) # Add more global sources - please add preferably in the sub_directory CMakeLists. -target_sources(${PROJECT_NAME}_lib PRIVATE canary_server.cpp protobuf/appearances.pb.cc) +set(ProtobufFiles + protobuf/appearances.pb.cc + protobuf/kv.pb.cc +) + +# Add more global sources - please add preferably in the sub_directory CMakeLists. +target_sources(${PROJECT_NAME}_lib PRIVATE canary_server.cpp ${ProtobufFiles}) + +# Skip unity build inclusion for protobuf files +set_source_files_properties( + ${ProtobufFiles} PROPERTIES SKIP_UNITY_BUILD_INCLUSION ON +) + # Add public pre compiler header to lib, to pass down to related targets target_precompile_headers(${PROJECT_NAME}_lib PUBLIC pch.hpp) diff --git a/config.lua.dist b/config.lua.dist index beb0da057..f557db782 100644 --- a/config.lua.dist +++ b/config.lua.dist @@ -34,7 +34,6 @@ redSkullDuration = 1 blackSkullDuration = 3 orangeSkullDuration = 7 -onlyInvitedCanMoveHouseItems = true cleanProtectionZones = false -- Connection Config @@ -161,6 +160,7 @@ wheelPointsPerLevel = 1 -- Only change it here if you know what you are doing or to make testing easier with familiars familiarTime = 30 +partyAutoShareExperience = true partyShareLootBoosts = false partyShareLootBoostsDimishingFactor = 0.7 @@ -261,6 +261,8 @@ houseRentPeriod = "never" houseRentRate = 1.0 houseOwnedByAccount = false houseBuyLevel = 100 +housePurchasedShowPrice = false +onlyInvitedCanMoveHouseItems = true -- Item Usage timeBetweenActions = 200 diff --git a/schema.sql b/schema.sql index 349fec67e..d4a69c8c8 100644 --- a/schema.sql +++ b/schema.sql @@ -7,7 +7,7 @@ CREATE TABLE IF NOT EXISTS `server_config` ( CONSTRAINT `server_config_pk` PRIMARY KEY (`config`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -INSERT INTO `server_config` (`config`, `value`) VALUES ('db_version', '36'), ('motd_hash', ''), ('motd_num', '0'), ('players_record', '0'); +INSERT INTO `server_config` (`config`, `value`) VALUES ('db_version', '38'), ('motd_hash', ''), ('motd_num', '0'), ('players_record', '0'); -- Table structure `accounts` CREATE TABLE IF NOT EXISTS `accounts` ( @@ -33,6 +33,7 @@ CREATE TABLE IF NOT EXISTS `coins_transactions` ( `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT, `account_id` int(11) UNSIGNED NOT NULL, `type` tinyint(1) UNSIGNED NOT NULL, + `coin_type` tinyint(1) UNSIGNED NOT NULL DEFAULT '1', `amount` int(12) UNSIGNED NOT NULL, `description` varchar(3500) NOT NULL, `timestamp` timestamp DEFAULT CURRENT_TIMESTAMP, @@ -72,6 +73,7 @@ CREATE TABLE IF NOT EXISTS `players` ( `conditions` blob NOT NULL, `cap` int(11) NOT NULL DEFAULT '0', `sex` int(11) NOT NULL DEFAULT '0', + `pronoun` int(11) NOT NULL DEFAULT '0', `lastlogin` bigint(20) UNSIGNED NOT NULL DEFAULT '0', `lastip` int(10) UNSIGNED NOT NULL DEFAULT '0', `save` tinyint(1) NOT NULL DEFAULT '1', @@ -791,6 +793,13 @@ CREATE TABLE IF NOT EXISTS `account_sessions` ( PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; +CREATE TABLE IF NOT EXISTS `kv_store` ( + `key_name` varchar(191) NOT NULL, + `timestamp` bigint NOT NULL, + `value` longblob NOT NULL, + PRIMARY KEY (`key_name`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + -- Create Account god/god INSERT INTO `accounts` (`id`, `name`, `email`, `password`, `type`) VALUES diff --git a/src/account/CMakeLists.txt b/src/account/CMakeLists.txt new file mode 100644 index 000000000..59d8f2afa --- /dev/null +++ b/src/account/CMakeLists.txt @@ -0,0 +1,4 @@ +target_sources(${PROJECT_NAME}_lib PRIVATE + account.cpp + account_repository_db.cpp +) diff --git a/src/account/account.cpp b/src/account/account.cpp new file mode 100644 index 000000000..30b92b5c6 --- /dev/null +++ b/src/account/account.cpp @@ -0,0 +1,263 @@ +/** + * Canary - A free and open-source MMORPG server emulator + * Copyright (©) 2019-2022 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 + +#include "account/account.hpp" +#include "utils/tools.hpp" + +namespace account { + Account::Account(const uint32_t &id) { + m_descriptor.clear(); + m_account.id = id; + m_account.premiumRemainingDays = 0; + m_account.premiumLastDay = 0; + m_account.accountType = ACCOUNT_TYPE_NORMAL; + } + + Account::Account(std::string descriptor) : + m_descriptor(std::move(descriptor)) { + m_account.id = 0; + m_account.premiumRemainingDays = 0; + m_account.premiumLastDay = 0; + m_account.accountType = ACCOUNT_TYPE_NORMAL; + } + + error_t Account::load() { + if (m_account.id != 0 && accountRepository.loadByID(m_account.id, m_account)) { + m_accLoaded = true; + return ERROR_NO; + } + + if (!m_descriptor.empty() && accountRepository.loadByEmail(m_descriptor, m_account)) { + m_accLoaded = true; + return ERROR_NO; + } + + if (!m_descriptor.empty() && accountRepository.loadBySession(m_descriptor, m_account)) { + m_accLoaded = true; + return ERROR_NO; + } + + updatePremiumTime(); + + return ERROR_LOADING_ACCOUNT; + } + + error_t Account::reload() { + if (!m_accLoaded) { + return ERROR_NOT_INITIALIZED; + } + + return load(); + } + + error_t Account::save() { + if (!m_accLoaded) { + return ERROR_NOT_INITIALIZED; + } + + if (!accountRepository.save(m_account)) { + return ERROR_STORAGE; + } + + return ERROR_NO; + } + + std::tuple Account::getCoins(const CoinType &type) const { + if (!m_accLoaded) { + return { 0, ERROR_NOT_INITIALIZED }; + } + + uint32_t coins = 0; + if (!accountRepository.getCoins(m_account.id, type, coins)) { + return { 0, ERROR_STORAGE }; + } + + return { coins, ERROR_NO }; + } + + error_t Account::addCoins(const CoinType &type, const uint32_t &amount, const std::string &detail) { + if (!m_accLoaded) { + return ERROR_NOT_INITIALIZED; + } + + if (amount == 0) { + return ERROR_NO; + } + + auto [coins, result] = getCoins(type); + + if (ERROR_NO != result) { + return result; + } + + if (!accountRepository.setCoins(m_account.id, type, coins + amount)) { + return ERROR_STORAGE; + } + + registerCoinTransaction(CoinTransactionType::ADD, type, amount, detail); + + return ERROR_NO; + } + + error_t Account::removeCoins(const CoinType &type, const uint32_t &amount, const std::string &detail) { + if (!m_accLoaded) { + return ERROR_NOT_INITIALIZED; + } + + if (amount == 0) { + return ERROR_NO; + } + + auto [coins, result] = getCoins(type); + + if (ERROR_NO != result) { + return result; + } + + if (coins < amount) { + logger.info("Account doesn't have enough coins! current[{}], remove:[{}]", coins, amount); + return ERROR_REMOVE_COINS; + } + + if (!accountRepository.setCoins(m_account.id, type, coins - amount)) { + return ERROR_STORAGE; + } + + registerCoinTransaction(CoinTransactionType::REMOVE, type, amount, detail); + + return ERROR_NO; + } + + void Account::registerCoinTransaction(const CoinTransactionType &transactionType, const CoinType &type, const uint32_t &amount, const std::string &detail) { + if (!m_accLoaded) { + return; + } + + if (detail.empty()) { + return; + } + + if (!accountRepository.registerCoinsTransaction(m_account.id, transactionType, amount, type, detail)) { + logger.error( + "Failed to register transaction: 'account:[{}], transaction " + "type:[{}], coins:[{}], coin type:[{}], description:[{}]", + m_account.id, static_cast(transactionType), amount, static_cast(type), detail + ); + } + } + + std::string Account::getPassword() { + if (!m_accLoaded) { + return ""; + } + + std::string password; + if (!accountRepository.getPassword(m_account.id, password)) { + password.clear(); + logger.error("Failed to get password for account[{}]!", m_account.id); + } + + return password; + } + + void Account::addPremiumDays(const int32_t &days) { + uint32_t timeLeft = static_cast((m_account.premiumLastDay - getTimeNow()) % 86400); + setPremiumDays(m_account.premiumRemainingDays + days); + + if (timeLeft > 0) { + m_account.premiumLastDay += timeLeft; + } + } + + void Account::setPremiumDays(const int32_t &days) { + m_account.premiumRemainingDays = days; + m_account.premiumLastDay = getTimeNow() + (days * 86400); + + if (days <= 0) { + m_account.premiumLastDay = 0; + m_account.premiumRemainingDays = 0; + } + } + + error_t Account::setAccountType(const AccountType &accountType) { + m_account.accountType = accountType; + return ERROR_NO; + } + + void Account::updatePremiumTime() { + time_t lastDay = m_account.premiumLastDay; + uint32_t remainingDays = m_account.premiumRemainingDays; + + time_t currentTime = getTimeNow(); + + uint32_t daysLeft = static_cast((lastDay - currentTime) / 86400); + uint32_t timeLeft = static_cast((lastDay - currentTime) % 86400); + + m_account.premiumRemainingDays = daysLeft > 0 ? daysLeft : 0; + + if (daysLeft == 0 && timeLeft == 0) { + setPremiumDays(0); + } + + if (lastDay < currentTime || lastDay == 0) { + setPremiumDays(0); + } + + if (remainingDays == m_account.premiumRemainingDays) { + return; + } + + if (account::ERROR_NO != save()) { + logger.error("Failed to update account premium time: [{}]", getDescriptor()); + } + } + + std::tuple, error_t> + Account::getAccountPlayers() const { + return { m_account.players, m_accLoaded ? ERROR_NO : ERROR_NOT_INITIALIZED }; + } + + bool Account::authenticate() { + // authenticate called without secret, so we use session authentication + return authenticateSession(); + } + + bool Account::authenticate(const std::string &secret) { + return authenticatePassword(secret); + } + + bool Account::authenticateSession() { + if (m_account.sessionExpires < getTimeNow()) { + logger.error("Session expired for account[{}] expired at [{}] current time [{}]!", m_account.id, m_account.sessionExpires, getTimeNow()); + return false; + } + return true; + } + + bool Account::authenticatePassword(const std::string &password) { + if (Argon2 {}.argon(password.c_str(), getPassword())) { + return true; + } + + if (transformToSHA1(password) == getPassword()) { + return true; + } + + logger.error("Password '{}' doesn't match any account", getPassword()); + return false; + } + + uint32_t Account::getAccountAgeInDays() const { + return static_cast(std::ceil((getTimeNow() - m_account.creationTime) / 86400)); + } + +} // namespace account diff --git a/src/account/account.hpp b/src/account/account.hpp new file mode 100644 index 000000000..839b99283 --- /dev/null +++ b/src/account/account.hpp @@ -0,0 +1,157 @@ +/** + * Canary - A free and open-source MMORPG server emulator + * Copyright (©) 2019-2022 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 "account/account_repository_db.hpp" +#include "config/configmanager.hpp" +#include "utils/definitions.hpp" +#include "security/argon.hpp" + +namespace account { + class Account { + public: + explicit Account(const uint32_t &id); + explicit Account(std::string descriptor); + + /** Coins + * @brief Get the amount of coins that the account has from database. + * + * @param type Type of the coin + * + * @return uint32_t Number of coins + * @return error_t ERROR_NO(0) Success, otherwise Fail. + */ + [[nodiscard]] std::tuple getCoins(const CoinType &type) const; + + /** + * @brief Add coins to the account. + * + * @param type Type of the coin + * @param amount Amount of coins to be added + * @return error_t ERROR_NO(0) Success, otherwise Fail. + */ + error_t addCoins(const CoinType &type, const uint32_t &amount, const std::string &detail = "ADD Coins"); + + /** + * @brief Removes coins from the account. + * + * @param type Type of the coin + * @param amount Amount of coins to be removed + * @return error_t ERROR_NO(0) Success, otherwise Fail. + */ + error_t removeCoins(const CoinType &type, const uint32_t &amount, const std::string &detail = "REMOVE Coins"); + + /** + * @brief Registers a coin transaction. + * + * @param type Type of the coin + * @param amount Amount of coins to be added + * @param detail Detail of the transaction + */ + void registerCoinTransaction(const CoinTransactionType &transactionType, const CoinType &type, const uint32_t &amount, const std::string &detail); + + /*************************************************************************** + * Account Load/Save + **************************************************************************/ + + /** + * @brief Save Account. + * + * @return error_t ERROR_NO(0) Success, otherwise Fail. + */ + error_t save(); + + /** + * @brief Load Account Information. + * + * @return error_t ERROR_NO(0) Success, otherwise Fail. + */ + error_t load(); + + /** + * @brief Re-Load Account Information to get update information(mainly the + * players list). + * + * @return error_t ERROR_NO(0) Success, otherwise Fail. + */ + error_t reload(); + + /*************************************************************************** + * Setters and Getters + **************************************************************************/ + + [[nodiscard]] inline uint32_t getID() const { + return m_account.id; + }; + + /** + * @brief Get the Descriptor object + * @warning Descriptors are credentials that may be used to login into the account. DO NOT BPUBLISH THIS INFORMATION. + * + * @return std::string + */ + inline std::string getDescriptor() const { + return m_descriptor; + } + + std::string getPassword(); + + void addPremiumDays(const int32_t &days); + void setPremiumDays(const int32_t &days); + [[nodiscard]] inline uint32_t getPremiumRemainingDays() const { + return m_account.premiumRemainingDays; + } + + [[nodiscard]] inline uint32_t getPremiumDaysPurchased() const { + return m_account.premiumDaysPurchased; + } + + [[nodiscard]] uint32_t getAccountAgeInDays() const; + + [[nodiscard]] inline time_t getPremiumLastDay() const { + return m_account.premiumLastDay; + } + + error_t setAccountType(const AccountType &accountType); + [[nodiscard]] inline AccountType getAccountType() const { + return m_account.accountType; + } + + void updatePremiumTime(); + + std::tuple, error_t> getAccountPlayers() const; + + // Old protocol compat + void setProtocolCompat(bool toggle) { + m_account.oldProtocol = toggle; + } + + bool getProtocolCompat() const { + return m_account.oldProtocol; + } + + bool authenticate(); + bool authenticate(const std::string &secret); + + bool authenticateSession(); + + bool authenticatePassword(const std::string &password); + + private: + std::string m_descriptor; + AccountInfo m_account; + bool m_accLoaded = false; + + Logger &logger = inject(); + ConfigManager &configManager = inject(); + AccountRepository &accountRepository = inject(); + }; + +} // namespace account diff --git a/src/account/account_definitions.hpp b/src/account/account_definitions.hpp new file mode 100644 index 000000000..0948055f2 --- /dev/null +++ b/src/account/account_definitions.hpp @@ -0,0 +1,64 @@ +/** + * Canary - A free and open-source MMORPG server emulator + * Copyright (©) 2019-2022 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 + +namespace account { + enum Errors : uint8_t { + ERROR_NO = 0, + ERROR_STORAGE, + ERROR_REMOVE_COINS, + ERROR_INVALID_LAST_DAY, + ERROR_LOADING_ACCOUNT, + ERROR_NOT_INITIALIZED + }; + + enum AccountType : uint8_t { + ACCOUNT_TYPE_NORMAL = 1, + ACCOUNT_TYPE_TUTOR = 2, + ACCOUNT_TYPE_SENIORTUTOR = 3, + ACCOUNT_TYPE_GAMEMASTER = 4, + ACCOUNT_TYPE_GOD = 5 + }; + + enum GroupType : uint8_t { + GROUP_TYPE_NONE = 0, + GROUP_TYPE_NORMAL = 1, + GROUP_TYPE_TUTOR = 2, + GROUP_TYPE_SENIORTUTOR = 3, + GROUP_TYPE_GAMEMASTER = 4, + GROUP_TYPE_COMMUNITYMANAGER = 5, + GROUP_TYPE_GOD = 6 + }; + + enum class CoinTransactionType : uint8_t { + ADD = 1, + REMOVE = 2 + }; + + enum class CoinType : uint8_t { + COIN = 1, + TOURNAMENT = 2, + TRANSFERABLE = 3 + }; + + struct AccountInfo { + uint32_t id = 0; + uint32_t premiumRemainingDays = 0; + time_t premiumLastDay = 0; + AccountType accountType = ACCOUNT_TYPE_NORMAL; + phmap::flat_hash_map players; + bool oldProtocol = false; + time_t sessionExpires = 0; + uint32_t premiumDaysPurchased = 0; + uint32_t creationTime = 0; + }; +} // namespace account diff --git a/src/account/account_repository.hpp b/src/account/account_repository.hpp new file mode 100644 index 000000000..daf869e24 --- /dev/null +++ b/src/account/account_repository.hpp @@ -0,0 +1,37 @@ +/** + * Canary - A free and open-source MMORPG server emulator + * Copyright (©) 2019-2022 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 "account/account_definitions.hpp" + +namespace account { + class AccountRepository { + public: + virtual ~AccountRepository() = default; + + virtual bool loadByID(const uint32_t &id, AccountInfo &acc) = 0; + virtual bool loadByEmail(const std::string &email, AccountInfo &acc) = 0; + virtual bool loadBySession(const std::string &email, AccountInfo &acc) = 0; + virtual bool save(const AccountInfo &accInfo) = 0; + + virtual bool getPassword(const uint32_t &id, std::string &password) = 0; + + virtual bool getCoins(const uint32_t &id, const CoinType &type, uint32_t &coins) = 0; + virtual bool setCoins(const uint32_t &id, const CoinType &type, const uint32_t &amount) = 0; + virtual bool registerCoinsTransaction( + const uint32_t &id, + CoinTransactionType type, + uint32_t coins, + const CoinType &coinType, + const std::string &description + ) = 0; + }; + +} // namespace account diff --git a/src/account/account_repository_db.cpp b/src/account/account_repository_db.cpp new file mode 100644 index 000000000..601aa1ec8 --- /dev/null +++ b/src/account/account_repository_db.cpp @@ -0,0 +1,189 @@ +/** + * Canary - A free and open-source MMORPG server emulator + * Copyright (©) 2019-2022 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 "account/account_repository_db.hpp" + +#include "utils/tools.hpp" + +namespace account { + bool AccountRepositoryDB::loadByID(const uint32_t &id, AccountInfo &acc) { + auto query = fmt::format("SELECT `id`, `type`, `premdays`, `lastday`, `creation`, `premdays_purchased`, 0 AS `expires` FROM `accounts` WHERE `id` = {}", id); + return load(query, acc); + }; + + bool AccountRepositoryDB::loadByEmail(const std::string &email, AccountInfo &acc) { + auto query = fmt::format("SELECT `id`, `type`, `premdays`, `lastday`, `creation`, `premdays_purchased`, 0 AS `expires` FROM `accounts` WHERE `email` = {}", db.escapeString(email)); + return load(query, acc); + }; + + bool AccountRepositoryDB::loadBySession(const std::string &sessionKey, AccountInfo &acc) { + auto query = fmt::format( + "SELECT `accounts`.`id`, `type`, `premdays`, `lastday`, `creation`, `premdays_purchased`, `account_sessions`.`expires` " + "FROM `accounts` " + "INNER JOIN `account_sessions` ON `account_sessions`.`account_id` = `accounts`.`id` " + "WHERE `account_sessions`.`id` = {}", + db.escapeString(transformToSHA1(sessionKey)) + ); + return load(query, acc); + }; + + bool AccountRepositoryDB::save(const AccountInfo &accInfo) { + bool successful = db.executeQuery( + fmt::format( + "UPDATE `accounts` SET `type` = {}, `premdays` = {}, `lastday` = {}, `creation` = {}, `premdays_purchased` = {} WHERE `id` = {}", + static_cast(accInfo.accountType), + accInfo.premiumRemainingDays, + accInfo.premiumLastDay, + accInfo.creationTime, + accInfo.premiumDaysPurchased, + accInfo.id + ) + ); + + if (!successful) { + logger.error("Failed to save account:[{}]", accInfo.id); + } + + return successful; + }; + + bool AccountRepositoryDB::getPassword(const uint32_t &id, std::string &password) { + auto result = db.storeQuery(fmt::format("SELECT * FROM `accounts` WHERE `id` = {}", id)); + if (!result) { + logger.error("Failed to get account:[{}] password!", id); + return false; + } + + password = result->getString("password"); + return true; + }; + + bool AccountRepositoryDB::getCoins(const uint32_t &id, const CoinType &type, uint32_t &coins) { + auto result = db.storeQuery(fmt::format( + "SELECT `{}` FROM `accounts` WHERE `id` = {}", + coinTypeToColumn.at(type), + id + )); + + if (!result) { + return false; + } + + coins = result->getNumber(coinTypeToColumn.at(type)); + + return true; + }; + + bool AccountRepositoryDB::setCoins(const uint32_t &id, const CoinType &type, const uint32_t &amount) { + bool successful = db.executeQuery(fmt::format( + "UPDATE `accounts` SET `{}` = {} WHERE `id` = {}", + coinTypeToColumn.at(type), + amount, + id + )); + + if (!successful) { + logger.error("Error setting account[{}] coins to [{}]", id, amount); + } + + return successful; + }; + + bool AccountRepositoryDB::registerCoinsTransaction( + const uint32_t &id, + CoinTransactionType type, + uint32_t coins, + const CoinType &coinType, + const std::string &description + ) { + bool successful = db.executeQuery( + fmt::format( + "INSERT INTO `coins_transactions` (`account_id`, `type`, `coin_type`, `amount`, `description`) VALUES ({}, {}, {}, {}, {})", + id, + static_cast(type), + static_cast(coinType), + coins, + db.escapeString(description) + ) + ); + + if (!successful) { + logger.error( + "Error registering coin transaction! account_id:[{}], type:[{}], coin_type:[{}], coins:[{}], description:[{}]", + id, + static_cast(type), + static_cast(coinType), + coins, + db.escapeString(description) + ); + } + + return successful; + }; + + bool AccountRepositoryDB::loadAccountPlayers(AccountInfo &acc) { + auto result = db.storeQuery( + fmt::format("SELECT `name`, `deletion` FROM `players` WHERE `account_id` = {} ORDER BY `name` ASC", acc.id) + ); + + if (!result) { + logger.error("Failed to load account[{}] players!", acc.id); + return false; + } + + do { + if (result->getNumber("deletion") != 0) { + continue; + } + + acc.players.try_emplace({ result->getString("name"), result->getNumber("deletion") }); + } while (result->next()); + + return true; + } + + bool AccountRepositoryDB::load(const std::string &query, AccountInfo &acc) { + auto result = db.storeQuery(query); + + if (result == nullptr) { + return false; + } + + acc.id = result->getNumber("id"); + acc.accountType = static_cast(result->getNumber("type")); + acc.premiumRemainingDays = result->getNumber("premdays"); + acc.premiumLastDay = result->getNumber("lastday"); + acc.sessionExpires = result->getNumber("expires"); + acc.premiumDaysPurchased = result->getNumber("premdays_purchased"); + acc.creationTime = result->getNumber("creation"); + + setupLoyaltyInfo(acc); + + return loadAccountPlayers(acc); + } + + void AccountRepositoryDB::setupLoyaltyInfo(account::AccountInfo &acc) { + if (acc.premiumDaysPurchased >= acc.premiumRemainingDays && acc.creationTime != 0) { + return; + } + + if (acc.premiumDaysPurchased < acc.premiumRemainingDays) { + acc.premiumDaysPurchased = acc.premiumRemainingDays; + } + + if (acc.creationTime == 0) { + acc.creationTime = getTimeNow(); + } + + save(acc); + } + +} // namespace account diff --git a/src/account/account_repository_db.hpp b/src/account/account_repository_db.hpp new file mode 100644 index 000000000..9da0486ee --- /dev/null +++ b/src/account/account_repository_db.hpp @@ -0,0 +1,54 @@ +/** + * Canary - A free and open-source MMORPG server emulator + * Copyright (©) 2019-2022 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 "account/account_repository.hpp" +#include "database/database.hpp" +#include "lib/logging/logger.hpp" +#include "utils/definitions.hpp" + +namespace account { + class AccountRepositoryDB final : public AccountRepository { + public: + AccountRepositoryDB(Database &db, Logger &logger) : + db(db), logger(logger) { } + + bool loadByID(const uint32_t &id, AccountInfo &acc) override; + bool loadByEmail(const std::string &email, AccountInfo &acc) override; + bool loadBySession(const std::string &esseionKey, AccountInfo &acc) override; + bool save(const AccountInfo &accInfo) override; + + bool getPassword(const uint32_t &id, std::string &password) override; + + bool getCoins(const uint32_t &id, const CoinType &type, uint32_t &coins) override; + bool setCoins(const uint32_t &id, const CoinType &type, const uint32_t &amount) override; + bool registerCoinsTransaction( + const uint32_t &id, + CoinTransactionType type, + uint32_t coins, + const CoinType &coinType, + const std::string &description + ) override; + + private: + const std::map coinTypeToColumn = { + { CoinType::COIN, "coins" }, + { CoinType::TOURNAMENT, "tournament_coins" }, + { CoinType::TRANSFERABLE, "coins_transferable" } + }; + Database &db; + Logger &logger; + + bool load(const std::string &query, AccountInfo &acc); + bool loadAccountPlayers(AccountInfo &acc); + void setupLoyaltyInfo(AccountInfo &acc); + }; + +} // namespace account diff --git a/src/canary_server.cpp b/src/canary_server.cpp index 54bce5a3c..c5f170514 100644 --- a/src/canary_server.cpp +++ b/src/canary_server.cpp @@ -101,7 +101,8 @@ int CanaryServer::run() { loaderSignal.notify_all(); } - }); + }, + "CanaryServer::run"); loaderSignal.wait(loaderUniqueLock, [this] { return loaderDone || loadFailed; }); diff --git a/src/config/config_definitions.hpp b/src/config/config_definitions.hpp index f6df1d37b..98f72a90b 100644 --- a/src/config/config_definitions.hpp +++ b/src/config/config_definitions.hpp @@ -38,6 +38,7 @@ enum booleanConfig_t { HOUSE_OWNED_BY_ACCOUNT, CLEAN_PROTECTION_ZONES, ALLOW_BLOCK_SPAWN, + HOUSE_PURSHASED_SHOW_PRICE, ONLY_INVITED_CAN_MOVE_HOUSE_ITEMS, WEATHER_RAIN, WEATHER_THUNDER, @@ -76,6 +77,7 @@ enum booleanConfig_t { OLD_PROTOCOL, TOGGLE_HAZARDSYSTEM, LOYALTY_ENABLED, + PARTY_AUTO_SHARE_EXPERIENCE, PARTY_SHARE_LOOT_BOOSTS, RESET_SESSIONS_ON_STARTUP, TOGGLE_WHEELSYSTEM, @@ -154,7 +156,7 @@ enum integerConfig_t { STATUS_PORT, STAIRHOP_DELAY, MAX_CONTAINER, - MAX_ITEM, + MAX_CONTAINER_ITEM, MARKET_OFFER_DURATION, DEPOT_BOXES, FREE_DEPOT_LIMIT, diff --git a/src/config/configmanager.cpp b/src/config/configmanager.cpp index 5bed1cd17..6f04e5320 100644 --- a/src/config/configmanager.cpp +++ b/src/config/configmanager.cpp @@ -165,7 +165,6 @@ bool ConfigManager::load() { boolean[HOUSE_OWNED_BY_ACCOUNT] = getGlobalBoolean(L, "houseOwnedByAccount", false); boolean[CLEAN_PROTECTION_ZONES] = getGlobalBoolean(L, "cleanProtectionZones", false); boolean[GLOBAL_SERVER_SAVE_SHUTDOWN] = getGlobalBoolean(L, "globalServerSaveShutdown", true); - boolean[ONLY_INVITED_CAN_MOVE_HOUSE_ITEMS] = getGlobalBoolean(L, "onlyInvitedCanMoveHouseItems", true); boolean[PUSH_WHEN_ATTACKING] = getGlobalBoolean(L, "pushWhenAttacking", false); boolean[WEATHER_RAIN] = getGlobalBoolean(L, "weatherRain", false); @@ -220,8 +219,12 @@ bool ConfigManager::load() { integer[RATE_MAGIC] = getGlobalNumber(L, "rateMagic", 1); integer[RATE_SPAWN] = getGlobalNumber(L, "rateSpawn", 1); integer[RATE_KILLING_IN_THE_NAME_OF_POINTS] = getGlobalNumber(L, "rateKillingInTheNameOfPoints", 1); + integer[HOUSE_PRICE_PER_SQM] = getGlobalNumber(L, "housePriceEachSQM", 1000); integer[HOUSE_BUY_LEVEL] = getGlobalNumber(L, "houseBuyLevel", 0); + boolean[HOUSE_PURSHASED_SHOW_PRICE] = getGlobalBoolean(L, "housePurchasedShowPrice", false); + boolean[ONLY_INVITED_CAN_MOVE_HOUSE_ITEMS] = getGlobalBoolean(L, "onlyInvitedCanMoveHouseItems", true); + integer[ACTIONS_DELAY_INTERVAL] = getGlobalNumber(L, "timeBetweenActions", 200); integer[EX_ACTIONS_DELAY_INTERVAL] = getGlobalNumber(L, "timeBetweenExActions", 1000); integer[MAX_MESSAGEBUFFER] = getGlobalNumber(L, "maxMessageBuffer", 4); @@ -233,7 +236,7 @@ bool ConfigManager::load() { integer[WHITE_SKULL_TIME] = getGlobalNumber(L, "whiteSkullTime", 15 * 60 * 1000); integer[STAIRHOP_DELAY] = getGlobalNumber(L, "stairJumpExhaustion", 2000); integer[MAX_CONTAINER] = getGlobalNumber(L, "maxContainer", 500); - integer[MAX_ITEM] = getGlobalNumber(L, "maxItem", 10000); + integer[MAX_CONTAINER_ITEM] = getGlobalNumber(L, "maxItem", 5000); integer[EXP_FROM_PLAYERS_LEVEL_RANGE] = getGlobalNumber(L, "expFromPlayersLevelRange", 75); integer[CHECK_EXPIRED_MARKET_OFFERS_EACH_MINUTES] = getGlobalNumber(L, "checkExpiredMarketOffersEachMinutes", 60); integer[MAX_MARKET_OFFERS_AT_A_TIME_PER_PLAYER] = getGlobalNumber(L, "maxMarketOffersAtATimePerPlayer", 100); @@ -363,6 +366,7 @@ bool ConfigManager::load() { boolean[TOGGLE_WHEELSYSTEM] = getGlobalBoolean(L, "wheelSystemEnabled", true); integer[WHEEL_POINTS_PER_LEVEL] = getGlobalNumber(L, "wheelPointsPerLevel", 1); + boolean[PARTY_AUTO_SHARE_EXPERIENCE] = getGlobalBoolean(L, "partyAutoShareExperience", true); boolean[PARTY_SHARE_LOOT_BOOSTS] = getGlobalBoolean(L, "partyShareLootBoosts", true); floating[PARTY_SHARE_LOOT_BOOSTS_DIMINISHING_FACTOR] = getGlobalFloat(L, "partyShareLootBoostsDimishingFactor", 0.7f); integer[TIBIADROME_CONCOCTION_COOLDOWN] = getGlobalNumber(L, "tibiadromeConcoctionCooldown", 24 * 60 * 60); diff --git a/src/core.hpp b/src/core.hpp index 64934dfe8..a998bc8c2 100644 --- a/src/core.hpp +++ b/src/core.hpp @@ -16,7 +16,7 @@ static constexpr auto STATUS_SERVER_DEVELOPERS = "OpenTibiaBR Organization and d static constexpr auto AUTHENTICATOR_DIGITS = 6U; static constexpr auto AUTHENTICATOR_PERIOD = 30U; -static constexpr auto CLIENT_VERSION = 1320; +static constexpr auto CLIENT_VERSION = 1321; #define CLIENT_VERSION_UPPER (CLIENT_VERSION / 100) #define CLIENT_VERSION_LOWER (CLIENT_VERSION % 100) diff --git a/src/creatures/CMakeLists.txt b/src/creatures/CMakeLists.txt index 799c99e48..3c055d508 100644 --- a/src/creatures/CMakeLists.txt +++ b/src/creatures/CMakeLists.txt @@ -12,7 +12,6 @@ target_sources(${PROJECT_NAME}_lib PRIVATE npcs/npc.cpp npcs/npcs.cpp npcs/spawns/spawn_npc.cpp - players/account/account.cpp players/grouping/familiars.cpp players/grouping/groups.cpp players/grouping/guild.cpp diff --git a/src/creatures/combat/combat.cpp b/src/creatures/combat/combat.cpp index 5ccbca9bd..6b5b1a9ae 100644 --- a/src/creatures/combat/combat.cpp +++ b/src/creatures/combat/combat.cpp @@ -878,6 +878,14 @@ void Combat::addDistanceEffect(Creature* caster, const Position &fromPos, const case WEAPON_CLUB: effect = CONST_ANI_WHIRLWINDCLUB; break; + case WEAPON_MISSILE: { + auto weapon = player->getWeapon(); + if (weapon) { + const auto &iType = Item::items[weapon->getID()]; + effect = iType.shootType; + } + break; + } default: effect = CONST_ANI_NONE; break; @@ -908,36 +916,33 @@ void Combat::doChainEffect(const Position &origin, const Position &dest, uint8_t } bool Combat::doCombatChain(Creature* caster, Creature* target, bool aggressive) const { - auto targets = std::vector(); - auto targetSet = std::set(); - auto visitedChain = std::set(); - if (target != nullptr) { - targets.push_back(target); - targetSet.insert(target->getID()); - } - if (caster != nullptr) { - visitedChain.insert(caster->getID()); - } - if (params.chainCallback) { - uint8_t maxTargets, chainDistance; - bool backtracking = false; - params.chainCallback->onChainCombat(caster, maxTargets, chainDistance, backtracking); - pickChainTargets(caster, targets, targetSet, visitedChain, params, chainDistance, maxTargets, backtracking, aggressive); - } - if (targets.empty() || targets.size() == 1 && targets[0] == caster) { + if (!params.chainCallback) { return false; } - Creature* previousTarget = caster; - for (auto currentTarget : targets) { - if (currentTarget == caster) { - continue; + + uint8_t maxTargets; + uint8_t chainDistance; + bool backtracking = false; + params.chainCallback->onChainCombat(caster, maxTargets, chainDistance, backtracking); + auto targets = pickChainTargets(caster, params, chainDistance, maxTargets, backtracking, aggressive, target); + + g_logger().debug("[{}] Chain targets: {}", __FUNCTION__, targets.size()); + if (targets.empty() || targets.size() == 1 && targets.begin()->second.empty()) { + return false; + } + + for (const auto &[from, toVector] : targets) { + auto combat = this; + for (auto to : toVector) { + auto nextTarget = g_game().getCreatureByID(to); + if (!nextTarget) { + continue; + } + combat->doChainEffect(from, nextTarget->getPosition(), combat->params.chainEffect); + combat->doCombat(caster, nextTarget, from); } - g_logger().debug("Combat: {} -> {}", previousTarget ? previousTarget->getName() : "none", currentTarget ? currentTarget->getName() : "none"); - auto origin = previousTarget != nullptr ? previousTarget->getPosition() : Position(); - doChainEffect(origin, currentTarget->getPosition(), params.chainEffect); - doCombat(caster, currentTarget, origin); - previousTarget = currentTarget; } + return true; } @@ -1372,55 +1377,84 @@ void Combat::setRuneSpellName(const std::string &value) { runeSpellName = value; } -void Combat::pickChainTargets(Creature* caster, std::vector &targets, std::set &targetSet, std::set &visited, const CombatParams ¶ms, uint8_t chainDistance, uint8_t maxTargets, bool backtracking, bool aggressive) { - if (maxTargets == 0 || targets.size() > maxTargets) { - return; +std::vector>> Combat::pickChainTargets(Creature* caster, const CombatParams ¶ms, uint8_t chainDistance, uint8_t maxTargets, bool backtracking, bool aggressive, Creature* initialTarget /* = nullptr */) { + if (!caster) { + return {}; } - // we need a target to chain from - if (targets.empty()) { - return; + + std::vector>> resultMap; + std::vector targets; + std::set visited; + + if (initialTarget && initialTarget != caster) { + targets.push_back(initialTarget); + visited.insert(initialTarget->getID()); + resultMap.push_back({ caster->getPosition(), { initialTarget->getID() } }); + } else { + targets.push_back(caster); + maxTargets++; } - auto currentTarget = targets.back(); - SpectatorHashSet spectators; - g_game().map.getSpectators(spectators, currentTarget->getPosition(), false, false, chainDistance, chainDistance, chainDistance, chainDistance); - g_logger().debug("Combat::pickChainTargets: currentTarget: {}, spectators: {}", currentTarget->getName(), spectators.size()); - auto maxBacktrackingAttempts = 10; - for (auto attempts = 0; targets.size() <= maxTargets && attempts < maxBacktrackingAttempts; ++attempts) { - auto closestDistance = std::numeric_limits::max(); + const int maxBacktrackingAttempts = 10; // Can be adjusted as needed + while (!targets.empty() && targets.size() <= maxTargets) { + Creature* currentTarget = targets.back(); + SpectatorHashSet spectators; + g_game().map.getSpectators(spectators, currentTarget->getPosition(), false, false, chainDistance, chainDistance, chainDistance, chainDistance); + g_logger().debug("Combat::pickChainTargets: currentTarget: {}, spectators: {}", currentTarget->getName(), spectators.size()); + + double closestDistance = std::numeric_limits::max(); Creature* closestSpectator = nullptr; - for (auto spectator : spectators) { - Creature* creature = spectator; - if (creature == nullptr || visited.contains(creature->getID())) { + for (Creature* spectator : spectators) { + if (!spectator || visited.contains(spectator->getID())) { continue; } - bool canCombat = canDoCombat(caster, creature, aggressive) == RETURNVALUE_NOERROR; - bool pick = params.chainPickerCallback ? params.chainPickerCallback->onChainCombat(caster, creature) : true; - bool hasSight = g_game().isSightClear(currentTarget->getPosition(), creature->getPosition(), true); - if (!canCombat || !pick || !hasSight) { - visited.insert(creature->getID()); + if (!isValidChainTarget(caster, currentTarget, spectator, params, aggressive)) { + visited.insert(spectator->getID()); continue; } - auto distance = Position::getDiagonalDistance(currentTarget->getPosition(), creature->getPosition()); + double distance = Position::getEuclideanDistance(currentTarget->getPosition(), spectator->getPosition()); if (distance < closestDistance) { closestDistance = distance; closestSpectator = spectator; } } - if (closestSpectator != nullptr) { + if (closestSpectator) { g_logger().debug("Combat::pickChainTargets: closestSpectator: {}", closestSpectator->getName()); + + bool found = false; + for (auto &[pos, vec] : resultMap) { + if (pos == currentTarget->getPosition()) { + vec.push_back(closestSpectator->getID()); + found = true; + break; + } + } + if (!found) { + resultMap.push_back({ currentTarget->getPosition(), { closestSpectator->getID() } }); + } + targets.push_back(closestSpectator); - targetSet.insert(closestSpectator->getID()); visited.insert(closestSpectator->getID()); - pickChainTargets(caster, targets, targetSet, visited, params, chainDistance, maxTargets, backtracking, aggressive); - } - - if (!backtracking || closestSpectator == nullptr) { - break; + continue; + } else if (backtracking) { + targets.pop_back(); + if (targets.size() <= maxBacktrackingAttempts) { + continue; + } } + break; } + + return resultMap; +} + +bool Combat::isValidChainTarget(Creature* caster, Creature* currentTarget, Creature* potentialTarget, const CombatParams ¶ms, bool aggressive) { + bool canCombat = canDoCombat(caster, potentialTarget, aggressive) == RETURNVALUE_NOERROR; + bool pick = params.chainPickerCallback ? params.chainPickerCallback->onChainCombat(caster, potentialTarget) : true; + bool hasSight = g_game().isSightClear(currentTarget->getPosition(), potentialTarget->getPosition(), true); + return canCombat && pick && hasSight; } //**********************************************************// diff --git a/src/creatures/combat/combat.hpp b/src/creatures/combat/combat.hpp index 5a66c0484..241d1c05f 100644 --- a/src/creatures/combat/combat.hpp +++ b/src/creatures/combat/combat.hpp @@ -324,7 +324,8 @@ class Combat { private: static void doChainEffect(const Position &origin, const Position &pos, uint8_t effect); - static void pickChainTargets(Creature* caster, std::vector &targets, std::set &targetSet, std::set &visited, const CombatParams ¶ms, uint8_t chainDistance, uint8_t maxTargets, bool backtracking, bool aggressive); + static std::vector>> pickChainTargets(Creature* caster, const CombatParams ¶ms, uint8_t chainDistance, uint8_t maxTargets, bool aggressive, bool backtracking, Creature* initialTarget = nullptr); + static bool isValidChainTarget(Creature* caster, Creature* currentTarget, Creature* potentialTarget, const CombatParams ¶ms, bool aggressive); static void doCombatDefault(Creature* caster, Creature* target, const CombatParams ¶ms); diff --git a/src/creatures/combat/condition.cpp b/src/creatures/combat/condition.cpp index 573591fdd..f7c1f4810 100644 --- a/src/creatures/combat/condition.cpp +++ b/src/creatures/combat/condition.cpp @@ -2040,7 +2040,7 @@ bool ConditionFeared::executeCondition(Creature* creature, int32_t interval) { } if (getFleePath(creature, currentPos, listDir)) { - g_dispatcher().addTask(std::bind(&Game::forcePlayerAutoWalk, &g_game(), creature->getID(), listDir), true); + g_dispatcher().addTask(std::bind(&Game::forcePlayerAutoWalk, &g_game(), creature->getID(), listDir), "ConditionFeared::executeCondition"); g_logger().debug("[ConditionFeared::executeCondition] Walking Scheduled"); } } diff --git a/src/creatures/creature.cpp b/src/creatures/creature.cpp index bd28dc413..78d7720bf 100644 --- a/src/creatures/creature.cpp +++ b/src/creatures/creature.cpp @@ -260,7 +260,10 @@ void Creature::addEventWalk(bool firstStep) { g_game().checkCreatureWalk(getID()); } - eventWalk = g_scheduler().addEvent(static_cast(ticks), std::bind(&Game::checkCreatureWalk, &g_game(), getID())); + eventWalk = g_scheduler().addEvent( + static_cast(ticks), std::bind(&Game::checkCreatureWalk, &g_game(), getID()), + "Creature::checkCreatureWalk" + ); } void Creature::stopEventWalk() { @@ -593,7 +596,7 @@ void Creature::onCreatureMove(Creature* creature, const Tile* newTile, const Pos if (followCreature && (creature == this || creature == followCreature)) { if (hasFollowPath) { isUpdatingPath = true; - g_dispatcher().addTask(std::bind(&Game::updateCreatureWalk, &g_game(), getID())); + g_dispatcher().addTask(std::bind(&Game::updateCreatureWalk, &g_game(), getID()), "Game::updateCreatureWalk"); } if (newPos.z != oldPos.z || !canSee(followCreature->getPosition())) { @@ -607,7 +610,7 @@ void Creature::onCreatureMove(Creature* creature, const Tile* newTile, const Pos } else { if (hasExtraSwing()) { // our target is moving lets see if we can get in hit - g_dispatcher().addTask(std::bind(&Game::checkCreatureAttack, &g_game(), getID())); + g_dispatcher().addTask(std::bind(&Game::checkCreatureAttack, &g_game(), getID()), "Game::checkCreatureAttack"); } if (newTile->getZoneType() != oldTile->getZoneType()) { @@ -745,7 +748,10 @@ bool Creature::dropCorpse(Creature* lastHitCreature, Creature* mostDamageCreatur if (player->checkAutoLoot()) { int32_t pos = tile->getStackposOfItem(player, corpse); - g_dispatcher().addTask(std::bind(&Game::playerQuickLoot, &g_game(), mostDamageCreature->getID(), this->getPosition(), corpse->getID(), pos - 1, nullptr, false, true)); + g_dispatcher().addTask( + std::bind(&Game::playerQuickLoot, &g_game(), mostDamageCreature->getID(), this->getPosition(), corpse->getID(), pos - 1, nullptr, false, true), + "Game::playerQuickLoot" + ); } } } @@ -789,7 +795,7 @@ void Creature::changeHealth(int32_t healthChange, bool sendHealthChange /* = tru g_game().addCreatureHealth(this); } if (health <= 0) { - g_dispatcher().addTask(std::bind(&Game::executeDeath, &g_game(), getID())); + g_dispatcher().addTask(std::bind(&Game::executeDeath, &g_game(), getID()), "Game::executeDeath"); } } @@ -1295,7 +1301,11 @@ void Creature::removeCondition(ConditionType_t conditionType, ConditionId_t cond if (!force && conditionType == CONDITION_PARALYZE) { int32_t walkDelay = getWalkDelay(); if (walkDelay > 0) { - g_scheduler().addEvent(walkDelay, std::bind(&Game::forceRemoveCondition, &g_game(), getID(), conditionType, conditionId)); + g_scheduler().addEvent( + walkDelay, + std::bind(&Game::forceRemoveCondition, &g_game(), getID(), conditionType, conditionId), + "Game::forceRemoveCondition" + ); return; } } @@ -1778,8 +1788,7 @@ const phmap::parallel_flat_hash_set> Creature::getZones() return Zone::getZones(getPosition()); } -void Creature::setIcon(CreatureIcon icon) { - creatureIcon = icon; +void Creature::iconChanged() const { if (!tile) { return; } diff --git a/src/creatures/creature.hpp b/src/creatures/creature.hpp index 9070ae412..3349ddb83 100644 --- a/src/creatures/creature.hpp +++ b/src/creatures/creature.hpp @@ -222,16 +222,41 @@ class Creature : virtual public Thing { varBuffs[buff] += modifier; } - virtual CreatureIcon getIcon() const { - return creatureIcon; + virtual std::vector getIcons() const { + std::vector icons; + icons.reserve(creatureIcons.size()); + for (const auto &[_, icon] : creatureIcons) { + if (icon.isSet()) { + icons.push_back(icon); + } + } + return icons; + } + + virtual CreatureIcon getIcon(const std::string &key) const { + if (!creatureIcons.contains(key)) { + return CreatureIcon(); + } + return creatureIcons.at(key); } - void setIcon(CreatureIcon icon); + void setIcon(const std::string &key, CreatureIcon icon) { + creatureIcons[key] = icon; + iconChanged(); + } + + void removeIcon(const std::string &key) { + creatureIcons.erase(key); + iconChanged(); + } - void clearIcon() { - setIcon(CreatureIcon()); + void clearIcons() { + creatureIcons.clear(); + iconChanged(); } + void iconChanged() const; + const Outfit_t getCurrentOutfit() const { return currentOutfit; } @@ -726,7 +751,8 @@ class Creature : virtual public Thing { uint8_t wheelOfDestinyDrainBodyDebuff = 0; - CreatureIcon creatureIcon = CreatureIcon(); + // use map here instead of phmap to keep the keys in a predictable order + std::map creatureIcons = {}; // creature script events bool hasEventRegistered(CreatureEventType_t event) const { diff --git a/src/creatures/interactions/chat.cpp b/src/creatures/interactions/chat.cpp index 2e95b8396..1e6dab2d7 100644 --- a/src/creatures/interactions/chat.cpp +++ b/src/creatures/interactions/chat.cpp @@ -32,7 +32,7 @@ void PrivateChatChannel::invitePlayer(const Player &player, Player &invitePlayer } std::ostringstream ss; - ss << player.getName() << " invites you to " << (player.getSex() == PLAYERSEX_FEMALE ? "her" : "his") << " private chat channel."; + ss << player.getName() << " invites you to " << player.getPossessivePronoun() << " private chat channel."; invitePlayer.sendTextMessage(MESSAGE_PARTY_MANAGEMENT, ss.str()); ss.str(std::string()); @@ -81,7 +81,7 @@ bool ChatChannel::addUser(Player &player) { if (id == CHANNEL_GUILD) { const auto guild = player.getGuild(); if (guild && !guild->getMotd().empty()) { - g_scheduler().addEvent(150, std::bind(&Game::sendGuildMotd, &g_game(), player.getID())); + g_scheduler().addEvent(150, std::bind(&Game::sendGuildMotd, &g_game(), player.getID()), "Game::sendGuildMotd"); } } diff --git a/src/creatures/monsters/monster.cpp b/src/creatures/monsters/monster.cpp index d42b50b09..43d41567b 100644 --- a/src/creatures/monsters/monster.cpp +++ b/src/creatures/monsters/monster.cpp @@ -676,7 +676,7 @@ bool Monster::selectTarget(Creature* creature) { if (isHostile() || isSummon()) { if (setAttackedCreature(creature)) { - g_dispatcher().addTask(std::bind(&Game::checkCreatureAttack, &g_game(), getID())); + g_dispatcher().addTask(std::bind(&Game::checkCreatureAttack, &g_game(), getID()), "Game::checkCreatureAttack"); } } return setFollowCreature(creature); @@ -850,9 +850,9 @@ void Monster::doAttacking(uint32_t interval) { float multiplier; if (maxCombatValue > 0) { // Defense - multiplier = mType->getDefenseMultiplier(); + multiplier = getDefenseMultiplier(); } else { // Attack - multiplier = mType->getAttackMultiplier(); + multiplier = getAttackMultiplier(); } minCombatValue = spellBlock.minCombatValue * multiplier; @@ -1924,9 +1924,9 @@ bool Monster::getCombatValues(int32_t &min, int32_t &max) { float multiplier; if (maxCombatValue > 0) { // Defense - multiplier = mType->getDefenseMultiplier(); + multiplier = getDefenseMultiplier(); } else { // Attack - multiplier = mType->getAttackMultiplier(); + multiplier = getAttackMultiplier(); } min = minCombatValue * multiplier; @@ -2122,12 +2122,12 @@ void Monster::configureForgeSystem() { if (monsterForgeClassification == ForgeClassifications_t::FORGE_FIENDISH_MONSTER) { setForgeStack(15); - setIcon(CreatureIcon(CreatureIconModifications_t::Fiendish, 0 /* don't show stacks on fiends */)); + setIcon("forge", CreatureIcon(CreatureIconModifications_t::Fiendish, 0 /* don't show stacks on fiends */)); g_game().updateCreatureIcon(this); } else if (monsterForgeClassification == ForgeClassifications_t::FORGE_INFLUENCED_MONSTER) { auto stack = static_cast(normal_random(1, 5)); setForgeStack(stack); - setIcon(CreatureIcon(CreatureIconModifications_t::Influenced, stack)); + setIcon("forge", CreatureIcon(CreatureIconModifications_t::Influenced, stack)); g_game().updateCreatureIcon(this); } @@ -2153,7 +2153,7 @@ void Monster::clearFiendishStatus() { health = mType->info.health * mType->getHealthMultiplier(); healthMax = mType->info.healthMax * mType->getHealthMultiplier(); - clearIcon(); + removeIcon("forge"); g_game().updateCreatureIcon(this); g_game().sendUpdateCreature(this); } diff --git a/src/creatures/monsters/monster.hpp b/src/creatures/monsters/monster.hpp index 9a343fd1e..a479b494a 100644 --- a/src/creatures/monsters/monster.hpp +++ b/src/creatures/monsters/monster.hpp @@ -156,19 +156,23 @@ class Monster final : public Creature { bool challengeCreature(Creature* creature, int targetChangeCooldown) override; bool changeTargetDistance(int32_t distance, uint32_t duration = 12000); + bool isChallenged() const { + return challengeFocusDuration > 0; + } - CreatureIcon getIcon() const override { - if (creatureIcon.isSet()) { - return creatureIcon; + std::vector getIcons() const override { + const auto creatureIcons = Creature::getIcons(); + if (!creatureIcons.empty()) { + return creatureIcons; } if (challengeMeleeDuration > 0 && mType->info.targetDistance > targetDistance) { - return CreatureIcon(CreatureIconModifications_t::TurnedMelee); + return { CreatureIcon(CreatureIconModifications_t::TurnedMelee) }; } else if (varBuffs[BUFF_DAMAGERECEIVED] > 100) { - return CreatureIcon(CreatureIconModifications_t::HigherDamageReceived); + return { CreatureIcon(CreatureIconModifications_t::HigherDamageReceived) }; } else if (varBuffs[BUFF_DAMAGEDEALT] < 100) { - return CreatureIcon(CreatureIconModifications_t::LowerDamageDealt); + return { CreatureIcon(CreatureIconModifications_t::LowerDamageDealt) }; } - return CreatureIcon(); + return {}; } void setNormalCreatureLight() override; @@ -410,4 +414,14 @@ class Monster final : public Creature { void doRandomStep(Direction &nextDirection, bool &result); void onConditionStatusChange(const ConditionType_t &type); + + float getAttackMultiplier() const { + float multiplier = mType->getAttackMultiplier(); + return multiplier * std::pow(1.03f, getForgeStack()); + } + + float getDefenseMultiplier() const { + float multiplier = mType->getAttackMultiplier(); + return multiplier * std::pow(1.01f, getForgeStack()); + } }; diff --git a/src/creatures/monsters/monsters.cpp b/src/creatures/monsters/monsters.cpp index 69d6accba..6bba74225 100644 --- a/src/creatures/monsters/monsters.cpp +++ b/src/creatures/monsters/monsters.cpp @@ -189,7 +189,7 @@ bool Monsters::deserializeSpell(const std::shared_ptr spell, spell Condition* condition = Condition::createCondition(CONDITIONID_COMBAT, CONDITION_DRUNK, duration, 0); combatPtr->addCondition(condition); - } else if (spellName == "fear") { + } else if (spellName == "soulwars fear" || spellName == "fear") { int32_t duration = 6000; if (spell->duration != 0) { diff --git a/src/creatures/monsters/spawns/spawn_monster.cpp b/src/creatures/monsters/spawns/spawn_monster.cpp index 1a0cb6bdf..83793f7a1 100644 --- a/src/creatures/monsters/spawns/spawn_monster.cpp +++ b/src/creatures/monsters/spawns/spawn_monster.cpp @@ -143,7 +143,7 @@ bool SpawnsMonster::isInZone(const Position ¢erPos, int32_t radius, const Po void SpawnMonster::startSpawnMonsterCheck() { if (checkSpawnMonsterEvent == 0) { - checkSpawnMonsterEvent = g_scheduler().addEvent(getInterval(), std::bind(&SpawnMonster::checkSpawnMonster, this)); + checkSpawnMonsterEvent = g_scheduler().addEvent(getInterval(), std::bind(&SpawnMonster::checkSpawnMonster, this), "SpawnMonster::checkSpawnMonster"); } } @@ -242,7 +242,7 @@ void SpawnMonster::checkSpawnMonster() { } if (spawnedMonsterMap.size() < spawnMonsterMap.size()) { - checkSpawnMonsterEvent = g_scheduler().addEvent(getInterval(), std::bind(&SpawnMonster::checkSpawnMonster, this)); + checkSpawnMonsterEvent = g_scheduler().addEvent(getInterval(), std::bind(&SpawnMonster::checkSpawnMonster, this), __FUNCTION__); } } @@ -251,7 +251,7 @@ void SpawnMonster::scheduleSpawn(uint32_t spawnMonsterId, spawnBlock_t &sb, uint spawnMonster(spawnMonsterId, sb.monsterType, sb.pos, sb.direction); } else { g_game().addMagicEffect(sb.pos, CONST_ME_TELEPORT); - g_scheduler().addEvent(1400, std::bind(&SpawnMonster::scheduleSpawn, this, spawnMonsterId, sb, interval - NONBLOCKABLE_SPAWN_MONSTER_INTERVAL)); + g_scheduler().addEvent(1400, std::bind(&SpawnMonster::scheduleSpawn, this, spawnMonsterId, sb, interval - NONBLOCKABLE_SPAWN_MONSTER_INTERVAL), __FUNCTION__); } } diff --git a/src/creatures/npcs/npc.cpp b/src/creatures/npcs/npc.cpp index 6d5a05628..9d95a2e91 100644 --- a/src/creatures/npcs/npc.cpp +++ b/src/creatures/npcs/npc.cpp @@ -340,7 +340,7 @@ void Npc::onPlayerSellAllLoot(uint32_t playerId, uint16_t itemId, bool ignore, u } } for (auto &[itemId, amount] : toSell) { - onPlayerSellItem(player, itemId, 0, amount, ignore, totalPrice); + onPlayerSellItem(player, itemId, 0, amount, ignore, totalPrice, container); } auto ss = std::stringstream(); if (totalPrice == 0) { @@ -349,7 +349,7 @@ void Npc::onPlayerSellAllLoot(uint32_t playerId, uint16_t itemId, bool ignore, u return; } if (hasMore) { - g_scheduler().addEvent(SCHEDULER_MINTICKS, std::bind(&Npc::onPlayerSellAllLoot, this, player->getID(), itemId, ignore, totalPrice)); + g_scheduler().addEvent(SCHEDULER_MINTICKS, std::bind(&Npc::onPlayerSellAllLoot, this, player->getID(), itemId, ignore, totalPrice), __FUNCTION__); return; } ss << "You sold all of the items from your loot pouch for "; @@ -359,12 +359,12 @@ void Npc::onPlayerSellAllLoot(uint32_t playerId, uint16_t itemId, bool ignore, u } } -void Npc::onPlayerSellItem(Player* player, uint16_t itemId, uint8_t subType, uint16_t amount, bool ignore, uint64_t &totalPrice) { +void Npc::onPlayerSellItem(Player* player, uint16_t itemId, uint8_t subType, uint16_t amount, bool ignore, uint64_t &totalPrice, Cylinder* parent /*= nullptr*/) { if (!player) { return; } if (itemId == ITEM_GOLD_POUCH) { - g_scheduler().addEvent(SCHEDULER_MINTICKS, std::bind(&Npc::onPlayerSellAllLoot, this, player->getID(), itemId, ignore, 0)); + g_scheduler().addEvent(SCHEDULER_MINTICKS, std::bind(&Npc::onPlayerSellAllLoot, this, player->getID(), itemId, ignore, 0), __FUNCTION__); return; } @@ -386,6 +386,10 @@ void Npc::onPlayerSellItem(Player* player, uint16_t itemId, uint8_t subType, uin continue; } + if (parent && item->getParent() != parent) { + continue; + } + auto removeCount = std::min(toRemove, item->getItemCount()); if (g_game().internalRemoveItem(item, removeCount) != RETURNVALUE_NOERROR) { diff --git a/src/creatures/npcs/npc.hpp b/src/creatures/npcs/npc.hpp index 9aeb2de72..e0c8c7286 100644 --- a/src/creatures/npcs/npc.hpp +++ b/src/creatures/npcs/npc.hpp @@ -145,7 +145,7 @@ class Npc final : public Creature { void onPlayerBuyItem(Player* player, uint16_t itemid, uint8_t count, uint16_t amount, bool ignore, bool inBackpacks); void onPlayerSellAllLoot(uint32_t playerId, uint16_t itemid, bool ignore, uint64_t totalPrice); void onPlayerSellItem(Player* player, uint16_t itemid, uint8_t count, uint16_t amount, bool ignore); - void onPlayerSellItem(Player* player, uint16_t itemid, uint8_t count, uint16_t amount, bool ignore, uint64_t &totalPrice); + void onPlayerSellItem(Player* player, uint16_t itemid, uint8_t count, uint16_t amount, bool ignore, uint64_t &totalPrice, Cylinder* parent = nullptr); void onPlayerCheckItem(Player* player, uint16_t itemid, uint8_t count); void onPlayerCloseChannel(Creature* creature); void onPlacedCreature() override; diff --git a/src/creatures/npcs/spawns/spawn_npc.cpp b/src/creatures/npcs/spawns/spawn_npc.cpp index 75d7964a0..20ae9ba91 100644 --- a/src/creatures/npcs/spawns/spawn_npc.cpp +++ b/src/creatures/npcs/spawns/spawn_npc.cpp @@ -131,7 +131,7 @@ bool SpawnsNpc::isInZone(const Position ¢erPos, int32_t radius, const Positi void SpawnNpc::startSpawnNpcCheck() { if (checkSpawnNpcEvent == 0) { - checkSpawnNpcEvent = g_scheduler().addEvent(getInterval(), std::bind(&SpawnNpc::checkSpawnNpc, this)); + checkSpawnNpcEvent = g_scheduler().addEvent(getInterval(), std::bind(&SpawnNpc::checkSpawnNpc, this), "SpawnNpc::checkSpawnNpc"); } } @@ -221,7 +221,7 @@ void SpawnNpc::checkSpawnNpc() { } if (spawnedNpcMap.size() < spawnNpcMap.size()) { - checkSpawnNpcEvent = g_scheduler().addEvent(getInterval(), std::bind(&SpawnNpc::checkSpawnNpc, this)); + checkSpawnNpcEvent = g_scheduler().addEvent(getInterval(), std::bind(&SpawnNpc::checkSpawnNpc, this), __FUNCTION__); } } @@ -230,7 +230,7 @@ void SpawnNpc::scheduleSpawnNpc(uint32_t spawnId, spawnBlockNpc_t &sb, uint16_t spawnNpc(spawnId, sb.npcType, sb.pos, sb.direction); } else { g_game().addMagicEffect(sb.pos, CONST_ME_TELEPORT); - g_scheduler().addEvent(1400, std::bind(&SpawnNpc::scheduleSpawnNpc, this, spawnId, sb, interval - NONBLOCKABLE_SPAWN_NPC_INTERVAL)); + g_scheduler().addEvent(1400, std::bind(&SpawnNpc::scheduleSpawnNpc, this, spawnId, sb, interval - NONBLOCKABLE_SPAWN_NPC_INTERVAL), __FUNCTION__); } } diff --git a/src/creatures/players/account/account.cpp b/src/creatures/players/account/account.cpp deleted file mode 100644 index 3d64499f6..000000000 --- a/src/creatures/players/account/account.cpp +++ /dev/null @@ -1,511 +0,0 @@ -/** - * Canary - A free and open-source MMORPG server emulator - * Copyright (©) 2019-2022 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/account/account.hpp" -#include "database/databasetasks.hpp" -#include "utils/tools.hpp" - -namespace account { - - Account::Account() { - id_ = 0; - accountIdentifier_.clear(); - password_.clear(); - premium_remaining_days_ = 0; - premium_last_day_ = 0; - account_type_ = ACCOUNT_TYPE_NORMAL; - db_ = &Database::getInstance(); - db_tasks_ = &g_databaseTasks(); - } - - Account::Account(uint32_t id) { - id_ = id; - accountIdentifier_.clear(); - password_.clear(); - premium_remaining_days_ = 0; - premium_last_day_ = 0; - account_type_ = ACCOUNT_TYPE_NORMAL; - db_ = &Database::getInstance(); - db_tasks_ = &g_databaseTasks(); - } - - Account::Account(const std::string &accountIdentifier) : - accountIdentifier_(accountIdentifier) { - id_ = 0; - password_.clear(); - premium_remaining_days_ = 0; - premium_last_day_ = 0; - account_type_ = ACCOUNT_TYPE_NORMAL; - db_ = &Database::getInstance(); - db_tasks_ = &g_databaseTasks(); - } - - /******************************************************************************* - * Interfaces - ******************************************************************************/ - - error_t Account::SetDatabaseInterface(Database* database) { - if (database == nullptr) { - return ERROR_NULLPTR; - } - - db_ = database; - return ERROR_NO; - } - - error_t Account::SetDatabaseTasksInterface(DatabaseTasks* database_tasks) { - if (database_tasks == nullptr) { - return ERROR_NULLPTR; - } - - db_tasks_ = database_tasks; - return ERROR_NO; - } - - /******************************************************************************* - * Coins Methods - ******************************************************************************/ - - error_t Account::GetTransferableCoins(uint32_t* coins) { - - if (db_ == nullptr || coins == nullptr || id_ == 0) { - return ERROR_NOT_INITIALIZED; - } - - std::ostringstream query; - query << "SELECT `coins_transferable` FROM `accounts` WHERE `id` = " << id_; - - DBResult_ptr result = db_->storeQuery(query.str()); - if (!result) { - return ERROR_DB; - } - - *coins = result->getNumber("coins_transferable"); - return ERROR_NO; - } - - error_t Account::AddTransferableCoins(uint32_t amount) { - - if (db_tasks_ == nullptr) { - return ERROR_NULLPTR; - } - if (amount == 0) { - return ERROR_NO; - } - - uint32_t current_coins = 0; - this->GetTransferableCoins(¤t_coins); - if ((current_coins + amount) < current_coins) { - return ERROR_VALUE_OVERFLOW; - } - - std::ostringstream query; - query << "UPDATE `accounts` SET `coins_transferable` = " << (current_coins + amount) - << " WHERE `id` = " << id_; - - db_tasks_->execute(query.str()); - return ERROR_NO; - } - - error_t Account::RemoveTransferableCoins(uint32_t amount) { - - if (db_tasks_ == nullptr) { - return ERROR_NULLPTR; - } - - if (amount == 0) { - return ERROR_NO; - } - - uint32_t current_coins = 0; - this->GetTransferableCoins(¤t_coins); - - if ((current_coins - amount) > current_coins) { - return ERROR_VALUE_NOT_ENOUGH_COINS; - } - - std::ostringstream query; - query << "UPDATE `accounts` SET `coins_transferable` = " << (current_coins - amount) - << " WHERE `id` = " << id_; - - db_tasks_->execute(query.str()); - - return ERROR_NO; - } - - error_t Account::GetCoins(uint32_t* coins) { - - if (db_ == nullptr || coins == nullptr || id_ == 0) { - return ERROR_NOT_INITIALIZED; - } - - std::ostringstream query; - query << "SELECT `coins` FROM `accounts` WHERE `id` = " << id_; - - DBResult_ptr result = db_->storeQuery(query.str()); - if (!result) { - return ERROR_DB; - } - - *coins = result->getNumber("coins"); - return ERROR_NO; - } - - error_t Account::AddCoins(uint32_t amount) { - - if (db_tasks_ == nullptr) { - return ERROR_NULLPTR; - } - if (amount == 0) { - return ERROR_NO; - } - - uint32_t current_coins = 0; - this->GetCoins(¤t_coins); - if ((current_coins + amount) < current_coins) { - return ERROR_VALUE_OVERFLOW; - } - - std::ostringstream query; - query << "UPDATE `accounts` SET `coins` = " << (current_coins + amount) - << " WHERE `id` = " << id_; - - db_tasks_->execute(query.str()); - return ERROR_NO; - } - - error_t Account::RemoveCoins(uint32_t amount) { - - if (db_tasks_ == nullptr) { - return ERROR_NULLPTR; - } - - if (amount == 0) { - return ERROR_NO; - } - - uint32_t current_coins = 0; - this->GetCoins(¤t_coins); - - if ((current_coins - amount) > current_coins) { - return ERROR_VALUE_NOT_ENOUGH_COINS; - } - - std::ostringstream query; - query << "UPDATE `accounts` SET `coins` = " << (current_coins - amount) - << " WHERE `id` = " << id_; - - db_tasks_->execute(query.str()); - - return ERROR_NO; - } - - error_t Account::RegisterCoinsTransaction(CoinTransactionType type, uint32_t coins, const std::string &description) { - - if (db_ == nullptr) { - return ERROR_NULLPTR; - } - - std::ostringstream query; - query << "INSERT INTO `coins_transactions` (`account_id`, `type`, `amount`," - " `description`) VALUES (" - << id_ << ", " << static_cast(type) << ", " << coins - << ", " << db_->escapeString(description) << ")"; - - if (!db_->executeQuery(query.str())) { - return ERROR_DB; - } - - return ERROR_NO; - } - - /******************************************************************************* - * Database - ******************************************************************************/ - - error_t Account::LoadAccountDB() { - if (id_ != 0) { - return this->LoadAccountDB(id_); - } else if (!accountIdentifier_.empty()) { - return this->LoadAccountDB(accountIdentifier_); - } - - return ERROR_NOT_INITIALIZED; - } - - error_t Account::LoadAccountDB(std::string accountIdentifier) { - std::ostringstream query; - query << "SELECT * FROM `accounts` WHERE "; - if (oldProtocol_) { - query << "`name` = "; - } else { - query << "`email` = "; - } - query << db_->escapeString(accountIdentifier); - return this->LoadAccountDB(query); - } - - error_t Account::LoadAccountDB(uint32_t id) { - std::ostringstream query; - query << "SELECT * FROM `accounts` WHERE `id` = " << id; - return this->LoadAccountDB(query); - } - - error_t Account::LoadAccountDB(std::ostringstream &query) { - if (db_ == nullptr) { - return ERROR_NULLPTR; - } - - DBResult_ptr result = db_->storeQuery(query.str()); - if (!result) { - return false; - } - - this->SetID(result->getNumber("id")); - this->SetAccountIdentifier(oldProtocol_ ? result->getString("name") : result->getString("email")); - this->SetAccountType(static_cast(result->getNumber("type"))); - this->SetPassword(result->getString("password")); - this->SetPremiumRemainingDays(result->getNumber("premdays")); - this->SetPremiumLastDay(result->getNumber("lastday")); - - return ERROR_NO; - } - - error_t Account::LoadAccountPlayerDB(Player* player, std::string &characterName) { - if (id_ == 0) { - return ERROR_NOT_INITIALIZED; - } - - std::ostringstream query; - query << "SELECT `name`, `deletion` FROM `players` WHERE `account_id` = " - << id_ << " AND `name` = " << db_->escapeString(characterName) << " ORDER BY `name` ASC"; - - DBResult_ptr result = db_->storeQuery(query.str()); - if (!result || result->getNumber("deletion") != 0) { - return ERROR_PLAYER_NOT_FOUND; - } - - player->name = result->getString("name"); - player->deletion = result->getNumber("deletion"); - - return ERROR_NO; - } - - error_t Account::LoadAccountPlayersDB(std::vector* players) { - if (id_ == 0) { - return ERROR_NOT_INITIALIZED; - } - - std::ostringstream query; - query << "SELECT `name`, `deletion` FROM `players` WHERE `account_id` = " - << id_ << " ORDER BY `name` ASC"; - DBResult_ptr result = db_->storeQuery(query.str()); - if (!result) { - return ERROR_DB; - } - - do { - if (result->getNumber("deletion") == 0) { - Player new_player; - new_player.name = result->getString("name"); - new_player.deletion = result->getNumber("deletion"); - players->push_back(new_player); - } - } while (result->next()); - return ERROR_NO; - } - - error_t Account::SaveAccountDB() { - std::ostringstream query; - - query << "UPDATE `accounts` SET "; - - if (oldProtocol_) { - query << "`name` = " << db_->escapeString(accountIdentifier_) << " , "; - } else { - query << "`email` = " << db_->escapeString(accountIdentifier_) << " , "; - } - - query << "`premdays` = " << premium_remaining_days_ << " , " - << "`lastday` = " << premium_last_day_; - - if (id_ != 0) { - query << " WHERE `id` = " << id_; - } else if (!accountIdentifier_.empty()) { - if (oldProtocol_) { - query << " WHERE `name` = " << accountIdentifier_; - } else { - query << " WHERE `email` = " << accountIdentifier_; - } - } - - if (!db_->executeQuery(query.str())) { - return ERROR_DB; - } - - return ERROR_NO; - } - - void Account::UpdatePremium() { - uint32_t remainingDays = 0; - time_t lastDay; - std::string accountIdentifier; - GetPremiumRemainingDays(&remainingDays); - GetPremiumLastDay(&lastDay); - GetAccountIdentifier(&accountIdentifier); - time_t currentTime = getTimeNow(); - - if (lastDay < currentTime) { - if (SetPremiumRemainingDays(0) != ERROR_NO || SetPremiumLastDay(0) != ERROR_NO) { - g_logger().error("Failed to reset premium from account {}: {}", getProtocolCompat() ? "name" : "email", accountIdentifier); - } - } else if (lastDay == 0) { - SetPremiumRemainingDays(0); - } else { - uint32_t daysLeft = static_cast((lastDay - currentTime) / 86400); - uint32_t timeLeft = static_cast((lastDay - currentTime) % 86400); - if (daysLeft > 0) { - SetPremiumRemainingDays(daysLeft); - } else if (timeLeft > 0) { - SetPremiumRemainingDays(1); - } else { - if (SetPremiumRemainingDays(0) != ERROR_NO || SetPremiumLastDay(0) != ERROR_NO) { - g_logger().error("Failed to remove premium from account {}: {}", getProtocolCompat() ? "name" : "email", accountIdentifier); - } - } - } - - if (SaveAccountDB() != ERROR_NO) { - GetAccountIdentifier(&accountIdentifier); - g_logger().error("Failed to save account: {}", accountIdentifier); - } - } - - /******************************************************************************* - * Setters and Getters - ******************************************************************************/ - - error_t Account::SetID(uint32_t id) { - if (id == 0) { - return ERROR_INVALID_ID; - } - id_ = id; - return ERROR_NO; - } - - error_t Account::GetID(uint32_t* id) { - if (id == nullptr) { - return ERROR_NULLPTR; - } - - *id = id_; - return ERROR_NO; - } - - error_t Account::SetAccountIdentifier(std::string accountIdentifier) { - if (accountIdentifier.empty()) { - return ERROR_INVALID_ACCOUNT_IDENTIFIER; - } - accountIdentifier_ = accountIdentifier; - return ERROR_NO; - } - - error_t Account::GetAccountIdentifier(std::string* accountIdentifier) { - if (accountIdentifier == nullptr) { - return ERROR_NULLPTR; - } - - *accountIdentifier = accountIdentifier_; - return ERROR_NO; - } - - error_t Account::SetPassword(std::string password) { - if (password.empty()) { - return ERROR_INVALID_ACC_PASSWORD; - } - password_ = password; - return ERROR_NO; - } - - error_t Account::GetPassword(std::string* password) { - if (password == nullptr) { - return ERROR_NULLPTR; - } - - *password = password_; - return ERROR_NO; - } - - error_t Account::SetPremiumRemainingDays(uint32_t days) { - premium_remaining_days_ = days; - return ERROR_NO; - } - - error_t Account::GetPremiumRemainingDays(uint32_t* days) const { - if (days == nullptr) { - return ERROR_NULLPTR; - } - - *days = premium_remaining_days_; - return ERROR_NO; - } - - error_t Account::SetPremiumLastDay(time_t last_day) { - if (last_day < 0) { - return ERROR_INVALID_LAST_DAY; - } - premium_last_day_ = last_day; - return ERROR_NO; - } - - error_t Account::GetPremiumLastDay(time_t* last_day) const { - if (last_day == nullptr) { - return ERROR_NULLPTR; - } - - *last_day = premium_last_day_; - return ERROR_NO; - } - - error_t Account::SetAccountType(AccountType account_type) { - if (account_type > 5) { - return ERROR_INVALID_ACC_TYPE; - } - account_type_ = account_type; - return ERROR_NO; - } - - error_t Account::GetAccountType(AccountType* account_type) { - if (account_type == nullptr) { - return ERROR_NULLPTR; - } - - *account_type = account_type_; - return ERROR_NO; - } - - error_t Account::GetAccountPlayer(Player* player, std::string &characterName) { - if (player == nullptr) { - return ERROR_NULLPTR; - } - - return this->LoadAccountPlayerDB(player, characterName); - } - - error_t Account::GetAccountPlayers(std::vector* players) { - if (players == nullptr) { - return ERROR_NULLPTR; - } - - return this->LoadAccountPlayersDB(players); - } - -} // namespace account diff --git a/src/creatures/players/account/account.hpp b/src/creatures/players/account/account.hpp deleted file mode 100644 index 8f210e24a..000000000 --- a/src/creatures/players/account/account.hpp +++ /dev/null @@ -1,265 +0,0 @@ -/** - * Canary - A free and open-source MMORPG server emulator - * Copyright (©) 2019-2022 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 "database/database.hpp" -#include "database/databasetasks.hpp" -#include "utils/definitions.hpp" - -namespace account { - - enum Errors : uint8_t { - ERROR_NO = 0, - ERROR_DB, - ERROR_INVALID_ACCOUNT_IDENTIFIER, - ERROR_INVALID_ACC_PASSWORD, - ERROR_INVALID_ACC_TYPE, - ERROR_INVALID_ID, - ERROR_INVALID_LAST_DAY, - ERROR_LOADING_ACCOUNT_PLAYERS, - ERROR_NOT_INITIALIZED, - ERROR_NULLPTR, - ERROR_VALUE_NOT_ENOUGH_COINS, - ERROR_VALUE_OVERFLOW, - ERROR_PLAYER_NOT_FOUND - }; - - enum AccountType : uint8_t { - ACCOUNT_TYPE_NORMAL = 1, - ACCOUNT_TYPE_TUTOR = 2, - ACCOUNT_TYPE_SENIORTUTOR = 3, - ACCOUNT_TYPE_GAMEMASTER = 4, - ACCOUNT_TYPE_GOD = 5 - }; - - enum GroupType : uint8_t { - GROUP_TYPE_NONE = 0, - GROUP_TYPE_NORMAL = 1, - GROUP_TYPE_TUTOR = 2, - GROUP_TYPE_SENIORTUTOR = 3, - GROUP_TYPE_GAMEMASTER = 4, - GROUP_TYPE_COMMUNITYMANAGER = 5, - GROUP_TYPE_GOD = 6 - }; - - enum CoinTransactionType : uint8_t { - COIN_ADD = 1, - COIN_REMOVE = 2 - }; - - typedef struct { - std::string name; - uint64_t deletion; - } Player; - - /** - * @brief Account class to handle account information - * - */ - class Account { - public: - /** - * @brief Construct a new Account object - * - */ - Account(); - - /** - * @brief Construct a new Account object - * - * @param id Set Account ID to be used by LoadAccountDB - */ - explicit Account(uint32_t id); - - /** - * @brief Construct a new Account object - * - * @param name Set Account Name or Email to be used by LoadAccountDB - */ - explicit Account(const std::string &name); - - /*************************************************************************** - * Interfaces - **************************************************************************/ - - /** - * @brief Set the Database Interface used to get and set information from - * the database - * - * @param database Database Interface pointer to be used - * @return error_t ERROR_NO(0) Success, otherwise Fail. - */ - error_t SetDatabaseInterface(Database* database); - - /** - * @brief Set the Database Tasks Interface used to schedule db update - * - * @param database Database Interface pointer to be used - * @return error_t ERROR_NO(0) Success, otherwise Fail. - */ - error_t SetDatabaseTasksInterface(DatabaseTasks* db_tasks); - - /*************************************************************************** - * Coins Methods - **************************************************************************/ - - /** - * @brief Get the amount of transfer coins that the account has from database. - * - * @param accountId Account ID to get the transfer coins. - * @param coins Pointer to return the number of transfer coins - * @return error_t ERROR_NO(0) Success, otherwise Fail. - */ - error_t GetTransferableCoins(uint32_t* coins); - - /** - * @brief Add transfer coins to the account and update database. - * - * @param amount Amount of transfer coins to be added - * @return error_t ERROR_NO(0) Success, otherwise Fail. - */ - error_t AddTransferableCoins(uint32_t amount); - - /** - * @brief Removes transfer coins from the account and update database. - * - * @param amount Amount of transfer coins to be removed - * @return error_t ERROR_NO(0) Success, otherwise Fail. - */ - error_t RemoveTransferableCoins(uint32_t amount); - - /** - * @brief Get the amount of coins that the account has from database. - * - * @param accountId Account ID to get the coins. - * @param coins Pointer to return the number of coins - * @return error_t ERROR_NO(0) Success, otherwise Fail. - */ - error_t GetCoins(uint32_t* coins); - - /** - * @brief Add coins to the account and update database. - * - * @param amount Amount of coins to be added - * @return error_t ERROR_NO(0) Success, otherwise Fail. - */ - error_t AddCoins(uint32_t amount); - - /** - * @brief Removes coins from the account and update database. - * - * @param amount Amount of coins to be removed - * @return error_t ERROR_NO(0) Success, otherwise Fail. - */ - error_t RemoveCoins(uint32_t amount); - - /** - * @brief Register account coins transactions in database. - * - * @param type Type of the transaction(Add/Remove). - * @param coins Amount of coins - * @param description Description of the transaction - * @return error_t ERROR_NO(0) Success, otherwise Fail. - */ - error_t RegisterCoinsTransaction(CoinTransactionType type, uint32_t coins, const std::string &description); - - /*************************************************************************** - * Database - **************************************************************************/ - - /** - * @brief Try to load account from DB using Account ID or Name if they were - * initialized. - * - * @return error_t ERROR_NO(0) Success, otherwise Fail. - */ - error_t LoadAccountDB(); - - /** - * @brief Try to - * - * @param accountIdentifier - * @return error_t ERROR_NO(0) Success, otherwise Fail. - */ - error_t LoadAccountDB(std::string accountIdentifier); - - /** - * @brief - * - * @param id - * @return error_t ERROR_NO(0) Success, otherwise Fail. - */ - error_t LoadAccountDB(uint32_t id); - - /** - * @brief - * - * @return error_t ERROR_NO(0) Success, otherwise Fail. - */ - error_t SaveAccountDB(); - - /** - * @brief Calculate and update remaining days and last day of premium account - * - */ - void UpdatePremium(); - - /*************************************************************************** - * Setters and Getters - **************************************************************************/ - - error_t GetID(uint32_t* id); - - error_t SetAccountIdentifier(std::string accountIdentifier); - error_t GetAccountIdentifier(std::string* accountIdentifier); - - error_t SetPassword(std::string password); - error_t GetPassword(std::string* password); - - error_t SetPremiumRemainingDays(uint32_t days); - error_t GetPremiumRemainingDays(uint32_t* days) const; - - error_t SetPremiumLastDay(time_t last_day); - error_t GetPremiumLastDay(time_t* last_day) const; - - error_t SetAccountType(AccountType account_type); - error_t GetAccountType(AccountType* account_type); - - error_t GetAccountPlayer(Player* player, std::string &characterName); - error_t GetAccountPlayers(std::vector* players); - - // Old protocol compat - void setProtocolCompat(bool toggle) { - oldProtocol_ = toggle; - } - bool getProtocolCompat() const { - return oldProtocol_; - } - - private: - error_t SetID(uint32_t id); - error_t LoadAccountDB(std::ostringstream &query); - error_t LoadAccountPlayersDB(std::vector* players); - error_t LoadAccountPlayerDB(Player* player, std::string &characterName); - - Database* db_; - DatabaseTasks* db_tasks_; - - uint32_t id_; - std::string accountIdentifier_; - std::string password_; - uint32_t premium_remaining_days_; - time_t premium_last_day_; - AccountType account_type_; - - bool oldProtocol_; - }; - -} // namespace account diff --git a/src/creatures/players/grouping/party.cpp b/src/creatures/players/grouping/party.cpp index aecc51f6c..55dc1a678 100644 --- a/src/creatures/players/grouping/party.cpp +++ b/src/creatures/players/grouping/party.cpp @@ -18,6 +18,9 @@ Party::Party(Player* initLeader) : leader(initLeader) { leader->setParty(this); + if (g_configManager().getBoolean(PARTY_AUTO_SHARE_EXPERIENCE)) { + setSharedExperience(initLeader, true); + } } void Party::disband() { @@ -261,7 +264,7 @@ bool Party::removeInvite(Player &player, bool removeFromPlayer /* = true*/) { void Party::revokeInvitation(Player &player) { std::ostringstream ss; - ss << leader->getName() << " has revoked " << (leader->getSex() == PLAYERSEX_FEMALE ? "her" : "his") << " invitation."; + ss << leader->getName() << " has revoked " << leader->getPossessivePronoun() << " invitation."; player.sendTextMessage(MESSAGE_PARTY_MANAGEMENT, ss.str()); ss.str(std::string()); @@ -277,7 +280,7 @@ bool Party::invitePlayer(Player &player) { } std::ostringstream ss; - ss << player.getName() << " has been invited."; + ss << player.getName() << " has been invited to join the party (Share range: " << getMinLevel() << "-" << getMaxLevel() << ")."; if (empty()) { ss << " Open the party channel to communicate with your members."; @@ -300,8 +303,9 @@ bool Party::invitePlayer(Player &player) { player.addPartyInvitation(this); ss.str(std::string()); - ss << leader->getName() << " has invited you to " << (leader->getSex() == PLAYERSEX_FEMALE ? "her" : "his") << " party."; + ss << leader->getName() << " has invited you to " << leader->getPossessivePronoun() << " party (Share range: " << getMinLevel() << "-" << getMaxLevel() << ")."; player.sendTextMessage(MESSAGE_PARTY_MANAGEMENT, ss.str()); + return true; } @@ -363,7 +367,7 @@ const char* Party::getSharedExpReturnMessage(SharedExpStatus_t value) { } } -bool Party::setSharedExperience(Player* player, bool newSharedExpActive) { +bool Party::setSharedExperience(Player* player, bool newSharedExpActive, bool silent /*= false*/) { if (!player || leader != player) { return false; } @@ -377,9 +381,13 @@ bool Party::setSharedExperience(Player* player, bool newSharedExpActive) { if (newSharedExpActive) { SharedExpStatus_t sharedExpStatus = getSharedExperienceStatus(); this->sharedExpEnabled = sharedExpStatus == SHAREDEXP_OK; - leader->sendTextMessage(MESSAGE_PARTY_MANAGEMENT, getSharedExpReturnMessage(sharedExpStatus)); + if (!silent) { + leader->sendTextMessage(MESSAGE_PARTY_MANAGEMENT, getSharedExpReturnMessage(sharedExpStatus)); + } } else { - leader->sendTextMessage(MESSAGE_PARTY_MANAGEMENT, "Shared Experience has been deactivated."); + if (!silent) { + leader->sendTextMessage(MESSAGE_PARTY_MANAGEMENT, "Shared Experience has been deactivated."); + } } updateAllPartyIcons(); @@ -406,14 +414,8 @@ SharedExpStatus_t Party::getMemberSharedExperienceStatus(const Player* player) c return SHAREDEXP_EMPTYPARTY; } - uint32_t highestLevel = leader->getLevel(); - for (Player* member : memberList) { - if (member->getLevel() > highestLevel) { - highestLevel = member->getLevel(); - } - } - - uint32_t minLevel = static_cast(std::ceil((static_cast(highestLevel) * 2) / 3)); + uint32_t highestLevel = getHighestLevel(); + uint32_t minLevel = getMinLevel(); if (player->getLevel() < minLevel) { return SHAREDEXP_LEVELDIFFTOOLARGE; } @@ -423,18 +425,49 @@ SharedExpStatus_t Party::getMemberSharedExperienceStatus(const Player* player) c } if (!player->hasFlag(PlayerFlags_t::NotGainInFight)) { - // check if the player has healed/attacked anything recently - auto it = ticksMap.find(player->getID()); - if (it == ticksMap.end()) { + if (!isPlayerActive(player)) { return SHAREDEXP_MEMBERINACTIVE; } + } + return SHAREDEXP_OK; +} - uint64_t timeDiff = OTSYS_TIME() - it->second; - if (timeDiff > static_cast(g_configManager().getNumber(PZ_LOCKED))) { - return SHAREDEXP_MEMBERINACTIVE; +uint32_t Party::getHighestLevel() const { + uint32_t highestLevel = leader->getLevel(); + for (Player* member : memberList) { + if (member->getLevel() > highestLevel) { + highestLevel = member->getLevel(); } } - return SHAREDEXP_OK; + return highestLevel; +} + +uint32_t Party::getMinLevel() const { + return static_cast(std::ceil((static_cast(getHighestLevel()) * 2) / 3)); +} + +uint32_t Party::getLowestLevel() const { + uint32_t lowestLevel = leader->getLevel(); + for (Player* member : memberList) { + if (member->getLevel() < lowestLevel) { + lowestLevel = member->getLevel(); + } + } + return lowestLevel; +} + +uint32_t Party::getMaxLevel() const { + return static_cast(std::floor((static_cast(getLowestLevel()) * 3) / 2)); +} + +bool Party::isPlayerActive(const Player* player) const { + auto it = ticksMap.find(player->getID()); + if (it == ticksMap.end()) { + return false; + } + + uint64_t timeDiff = OTSYS_TIME() - it->second; + return timeDiff <= 2 * 60 * 1000; } SharedExpStatus_t Party::getSharedExperienceStatus() { diff --git a/src/creatures/players/grouping/party.hpp b/src/creatures/players/grouping/party.hpp index e66a42489..c89a6eb65 100644 --- a/src/creatures/players/grouping/party.hpp +++ b/src/creatures/players/grouping/party.hpp @@ -64,7 +64,7 @@ class Party { bool canOpenCorpse(uint32_t ownerId) const; void shareExperience(uint64_t experience, Creature* target = nullptr); - bool setSharedExperience(Player* player, bool sharedExpActive); + bool setSharedExperience(Player* player, bool sharedExpActive, bool silent = false); bool isSharedExperienceActive() const { return sharedExpActive; } @@ -117,7 +117,12 @@ class Party { private: const char* getSharedExpReturnMessage(SharedExpStatus_t value); + bool isPlayerActive(const Player* player) const; SharedExpStatus_t getSharedExperienceStatus(); + uint32_t getHighestLevel() const; + uint32_t getLowestLevel() const; + uint32_t getMinLevel() const; + uint32_t getMaxLevel() const; std::map ticksMap; diff --git a/src/creatures/players/player.cpp b/src/creatures/players/player.cpp index ba62b71e0..b018a9d5e 100644 --- a/src/creatures/players/player.cpp +++ b/src/creatures/players/player.cpp @@ -105,8 +105,8 @@ bool Player::isPushable() const { return Creature::isPushable(); } -std::shared_ptr Player::createPlayerTask(uint32_t delay, std::function f) { - return std::make_shared(std::move(f), delay); +std::shared_ptr Player::createPlayerTask(uint32_t delay, std::function f, std::string context) { + return std::make_shared(std::move(f), std::move(context), delay); } uint32_t Player::playerFirstID = 0x10000000; @@ -130,6 +130,9 @@ void Player::setID() { std::string Player::getDescription(int32_t lookDistance) const { std::ostringstream s; + std::string subjectPronoun = getSubjectPronoun(); + capitalizeWords(subjectPronoun); + if (lookDistance == -1) { s << "yourself."; @@ -155,42 +158,34 @@ std::string Player::getDescription(int32_t lookDistance) const { } s << '.'; - std::string pronoun; - if (sex == PLAYERSEX_FEMALE) { - pronoun = " She"; - } else { - pronoun = " He"; - } - s << pronoun; + s << " " << subjectPronoun; if (group->access) { - s << " is " << group->name << '.'; + s << " " << getSubjectVerb() << " " << group->name << '.'; } else if (vocation->getId() != VOCATION_NONE) { - s << " is " << vocation->getVocDescription() << '.'; + s << " " << getSubjectVerb() << " " << vocation->getVocDescription() << '.'; } else { s << " has no vocation."; } if (loyaltyTitle.length() != 0) { - if (sex == PLAYERSEX_FEMALE) { - s << " She is a " << loyaltyTitle << "."; - } else { - s << " He is a " << loyaltyTitle << "."; + std::string article = "a"; + if (loyaltyTitle[0] == 'A' || loyaltyTitle[0] == 'E' || loyaltyTitle[0] == 'I' || loyaltyTitle[0] == 'O' || loyaltyTitle[0] == 'U') { + article = "an"; } + s << " " << subjectPronoun << " " << getSubjectVerb() << " " << article << " " << loyaltyTitle << "."; } if (isVip()) { - s << pronoun << " is VIP."; + s << " " << subjectPronoun << " " << getSubjectVerb() << " VIP."; } } if (party) { if (lookDistance == -1) { s << " Your party has "; - } else if (sex == PLAYERSEX_FEMALE) { - s << " She is in a party with "; } else { - s << " He is in a party with "; + s << " " << subjectPronoun << " " << getSubjectVerb() << " in a party with "; } size_t memberCount = party->getMemberCount() + 1; @@ -217,10 +212,8 @@ std::string Player::getDescription(int32_t lookDistance) const { if (lookDistance == -1) { s << " You are "; - } else if (sex == PLAYERSEX_FEMALE) { - s << " She is "; } else { - s << " He is "; + s << " " << subjectPronoun << " " << getSubjectVerb() << " "; } s << guildRank->name << " of the " << guild->getName(); @@ -1843,7 +1836,7 @@ void Player::onCreatureMove(Creature* creature, const Tile* newTile, const Posit if (hasFollowPath && (creature == followCreature || (creature == this && followCreature))) { isUpdatingPath = false; - g_dispatcher().addTask(std::bind(&Game::updateCreatureWalk, &g_game(), getID())); + g_dispatcher().addTask(std::bind(&Game::updateCreatureWalk, &g_game(), getID()), "Game::updateCreatureWalk"); } if (creature != this) { @@ -1935,7 +1928,7 @@ void Player::onCloseContainer(const Container* container) { } void Player::onSendContainer(const Container* container) { - if (!client) { + if (!client || !container) { return; } @@ -2891,7 +2884,9 @@ Item* Player::getCorpse(Creature* lastHitCreature, Creature* mostDamageCreature) if (corpse && corpse->getContainer()) { std::ostringstream ss; if (lastHitCreature) { - ss << "You recognize " << getNameDescription() << ". " << (getSex() == PLAYERSEX_FEMALE ? "She" : "He") << " was killed by " << lastHitCreature->getNameDescription() << '.'; + std::string subjectPronoun = getSubjectPronoun(); + capitalizeWords(subjectPronoun); + ss << "You recognize " << getNameDescription() << ". " << subjectPronoun << " " << getSubjectVerb(true) << " killed by " << lastHitCreature->getNameDescription() << '.'; } else { ss << "You recognize " << getNameDescription() << '.'; } @@ -2970,7 +2965,10 @@ bool Player::removeVIP(uint32_t vipGuid) { return false; } - IOLoginData::removeVIPEntry(accountNumber, vipGuid); + if (account) { + IOLoginData::removeVIPEntry(account->getID(), vipGuid); + } + return true; } @@ -2986,10 +2984,14 @@ bool Player::addVIP(uint32_t vipGuid, const std::string &vipName, VipStatus_t st return false; } - IOLoginData::addVIPEntry(accountNumber, vipGuid, "", 0, false); + if (account) { + IOLoginData::addVIPEntry(account->getID(), vipGuid, "", 0, false); + } + if (client) { client->sendVIP(vipGuid, vipName, "", 0, false, status); } + return true; } @@ -3007,7 +3009,10 @@ bool Player::editVIP(uint32_t vipGuid, const std::string &description, uint32_t return false; // player is not in VIP } - IOLoginData::editVIPEntry(accountNumber, vipGuid, description, icon, notify); + if (account) { + IOLoginData::editVIPEntry(account->getID(), vipGuid, description, icon, notify); + } + return true; } @@ -3466,8 +3471,10 @@ Cylinder* Player::queryDestination(int32_t &index, const Thing &thing, Item** de *destItem = destThing->getItem(); } - // force quiver/shield any slot right to player cylinder - if (index == CONST_SLOT_RIGHT) { + const Item* item = thing.getItem(); + bool movingAmmoToQuiver = item && *destItem && (*destItem)->isQuiver() && item->isAmmo(); + // force shield any slot right to player cylinder + if (index == CONST_SLOT_RIGHT && !movingAmmoToQuiver) { return this; } @@ -4138,7 +4145,7 @@ bool Player::updateSaleShopList(const Item* item) { return true; } - g_dispatcher().addTask(std::bind(&Game::updatePlayerSaleItems, &g_game(), getID())); + g_dispatcher().addTask(std::bind(&Game::updatePlayerSaleItems, &g_game(), getID()), "updatePlayerSaleItems"); scheduledSaleUpdate = true; return true; } @@ -4209,7 +4216,7 @@ bool Player::setAttackedCreature(Creature* creature) { } if (creature) { - g_dispatcher().addTask(std::bind(&Game::checkCreatureAttack, &g_game(), getID())); + g_dispatcher().addTask(std::bind(&Game::checkCreatureAttack, &g_game(), getID()), "Game::checkCreatureAttack"); } return true; } @@ -4264,7 +4271,7 @@ void Player::doAttacking(uint32_t) { result = Weapon::useFist(this, attackedCreature); } - std::shared_ptr task = createPlayerTask(std::max(SCHEDULER_MINTICKS, delay), std::bind(&Game::checkCreatureAttack, &g_game(), getID())); + std::shared_ptr task = createPlayerTask(std::max(SCHEDULER_MINTICKS, delay), std::bind(&Game::checkCreatureAttack, &g_game(), getID()), "Game::checkCreatureAttack"); if (!classicSpeed) { setNextActionTask(task, false); } else { @@ -4932,6 +4939,10 @@ void Player::setSex(PlayerSex_t newSex) { sex = newSex; } +void Player::setPronoun(PlayerPronoun_t newPronoun) { + pronoun = newPronoun; +} + Skulls_t Player::getSkull() const { if (hasFlag(PlayerFlags_t::NotGainInFight)) { return SKULL_NONE; @@ -5245,12 +5256,11 @@ bool Player::isPremium() const { return true; } - return premiumDays > 0 || premiumLastDay > getTimeNow(); -} + if (!account) { + return false; + } -void Player::setPremiumDays(uint32_t v) { - premiumDays = v; - sendBasicData(); + return account->getPremiumRemainingDays() > 0 || account->getPremiumLastDay() > getTimeNow(); } void Player::setTibiaCoins(int32_t v) { @@ -7536,9 +7546,9 @@ bool Player::canAutoWalk(const Position &toPosition, const std::function // Check if can walk to the toPosition and send event to use function std::forward_list listDir; if (getPathTo(toPosition, listDir, 0, 1, true, true)) { - g_dispatcher().addTask(std::bind(&Game::playerAutoWalk, &g_game(), getID(), listDir)); + g_dispatcher().addTask(std::bind(&Game::playerAutoWalk, &g_game(), getID(), listDir), __FUNCTION__); - std::shared_ptr task = createPlayerTask(delay, function); + std::shared_ptr task = createPlayerTask(delay, function, __FUNCTION__); setNextWalkActionTask(task); return true; } else { @@ -7559,9 +7569,9 @@ void Player::setHazardSystemPoints(int32_t count) { addStorageValue(STORAGEVALUE_HAZARDCOUNT, std::max(0, std::min(0xFFFF, count)), true); reloadHazardSystemPointsCounter = true; if (count > 0) { - setIcon(CreatureIcon(CreatureIconQuests_t::Hazard, count)); + setIcon("hazard", CreatureIcon(CreatureIconQuests_t::Hazard, count)); } else { - clearIcon(); + removeIcon("hazard"); } } @@ -7680,21 +7690,6 @@ const std::unique_ptr &Player::wheel() const { return m_wheelPlayer; } -// Account interface -error_t Player::SetAccountInterface(account::Account* account) { - if (account == nullptr) { - return account::ERROR_NULLPTR; - } - - account_ = account; - return account::ERROR_NO; -} - -error_t Player::GetAccountInterface(account::Account* account) { - account = account_; - return account::ERROR_NO; -} - void Player::sendLootMessage(const std::string &message) const { if (!party) { sendTextMessage(MESSAGE_LOOT, message); diff --git a/src/creatures/players/player.hpp b/src/creatures/players/player.hpp index 2db6cf48a..34bda5485 100644 --- a/src/creatures/players/player.hpp +++ b/src/creatures/players/player.hpp @@ -107,7 +107,7 @@ class Player final : public Creature, public Cylinder, public Bankable { return this; } - static std::shared_ptr createPlayerTask(uint32_t delay, std::function f); + static std::shared_ptr createPlayerTask(uint32_t delay, std::function f, std::string context); void setID() override; @@ -474,6 +474,10 @@ class Player final : public Creature, public Cylinder, public Bankable { int32_t getStorageValueByName(const std::string &storageName) const; void addStorageValueByName(const std::string &storageName, const int32_t value, const bool isLogin = false); + std::shared_ptr kv() const { + return g_kv().scoped("player")->scoped(getID()); + } + void genReservedStorageRange(); void setGroup(Group* newGroup) { @@ -548,13 +552,6 @@ class Player final : public Creature, public Cylinder, public Bankable { void switchGhostMode() { ghostMode = !ghostMode; } - - uint32_t getAccount() const { - return accountNumber; - } - account::AccountType getAccountType() const { - return accountType; - } uint32_t getLevel() const { return level; } @@ -580,11 +577,10 @@ class Player final : public Creature, public Cylinder, public Bankable { } bool isPremium() const; uint32_t getPremiumDays() const { - return premiumDays; + return account->getPremiumRemainingDays(); } - void setPremiumDays(uint32_t v); time_t getPremiumLastDay() const { - return premiumLastDay; + return account->getPremiumLastDay(); } bool isVip() const { @@ -604,7 +600,26 @@ class Player final : public Creature, public Cylinder, public Bankable { PlayerSex_t getSex() const { return sex; } + PlayerPronoun_t getPronoun() const { + return pronoun; + } + std::string getObjectPronoun() const { + return getPlayerObjectPronoun(pronoun, sex, name); + } + std::string getSubjectPronoun() const { + return getPlayerSubjectPronoun(pronoun, sex, name); + } + std::string getPossessivePronoun() const { + return getPlayerPossessivePronoun(pronoun, sex, name); + } + std::string getReflexivePronoun() const { + return getPlayerReflexivePronoun(pronoun, sex, name); + } + std::string getSubjectVerb(bool past = false) const { + return getVerbForPronoun(pronoun, past); + } void setSex(PlayerSex_t); + void setPronoun(PlayerPronoun_t); uint64_t getExperience() const { return experience; } @@ -1999,17 +2014,35 @@ class Player final : public Creature, public Cylinder, public Bankable { bool canAutoWalk(const Position &toPosition, const std::function &function, uint32_t delay = 500); - // Interfaces - // Account - error_t SetAccountInterface(account::Account* account); - error_t GetAccountInterface(account::Account* account); - void sendMessageDialog(const std::string &message) const { if (client) { client->sendMessageDialog(message); } } + // Account + bool setAccount(uint32_t accountId) { + if (account) { + g_logger().warn("Account was already set!"); + return true; + } + + account = std::make_shared(accountId); + return account::ERROR_NO == account->load(); + } + + account::AccountType getAccountType() const { + return account ? account->getAccountType() : account::AccountType::ACCOUNT_TYPE_NORMAL; + } + + uint32_t getAccountId() const { + return account ? account->getID() : 0; + } + + std::shared_ptr getAccount() const { + return account; + } + // Prey system void initializePrey(); void removePreySlotById(PreySlot_t slotid); @@ -2215,7 +2248,7 @@ class Player final : public Creature, public Cylinder, public Bankable { return nullptr; } - uint16_t getLoyaltyPoints() const { + uint32_t getLoyaltyPoints() const { return loyaltyPoints; } @@ -2657,7 +2690,6 @@ class Player final : public Creature, public Cylinder, public Bankable { uint32_t walkTaskEvent = 0; uint32_t MessageBufferTicks = 0; uint32_t lastIP = 0; - uint32_t accountNumber = 0; uint32_t guid = 0; uint32_t loyaltyPoints = 0; uint8_t isDailyReward = DAILY_REWARD_NOTCOLLECTED; @@ -2668,8 +2700,6 @@ class Player final : public Creature, public Cylinder, public Bankable { int32_t varStats[STAT_LAST + 1] = {}; int32_t shopCallback = -1; int32_t MessageBufferCount = 0; - uint32_t premiumDays = 0; - time_t premiumLastDay = 0; int32_t bloodHitCount = 0; int32_t shieldBlockCount = 0; int8_t offlineTrainingSkill = SKILL_NONE; @@ -2737,9 +2767,9 @@ class Player final : public Creature, public Cylinder, public Bankable { TradeState_t tradeState = TRADE_NONE; FightMode_t fightMode = FIGHTMODE_ATTACK; Faction_t faction = FACTION_PLAYER; - account::AccountType accountType = account::AccountType::ACCOUNT_TYPE_NORMAL; QuickLootFilter_t quickLootFilter; VipStatus_t statusVipList = VIPSTATUS_ONLINE; + PlayerPronoun_t pronoun = PLAYERPRONOUN_THEY; bool chaseMode = false; bool secureMode = true; @@ -2853,7 +2883,7 @@ class Player final : public Creature, public Cylinder, public Bankable { std::mutex quickLootMutex; - account::Account* account_; + std::shared_ptr account; bool online = true; bool hasQuiverEquipped() const; diff --git a/src/creatures/players/wheel/player_wheel.cpp b/src/creatures/players/wheel/player_wheel.cpp index 935df00b6..06a25f4d7 100644 --- a/src/creatures/players/wheel/player_wheel.cpp +++ b/src/creatures/players/wheel/player_wheel.cpp @@ -39,7 +39,7 @@ namespace { } template - int checkSpellAdditionalTarget(const std::array &spellsTable, const std::string &spellName, uint8_t stage) { + int checkSpellAdditionalTarget(const std::array &spellsTable, const std::string_view &spellName, uint8_t stage) { for (const auto &spellTable : spellsTable) { auto size = std::ssize(spellTable.grade); g_logger().debug("spell target stage {}, grade {}", stage, size); @@ -55,7 +55,7 @@ namespace { } template - int checkSpellAdditionalDuration(const std::array &spellsTable, const std::string &spellName, uint8_t stage) { + int checkSpellAdditionalDuration(const std::array &spellsTable, const std::string_view &spellName, uint8_t stage) { for (const auto &spellTable : spellsTable) { auto size = std::ssize(spellTable.grade); g_logger().debug("spell duration stage {}, grade {}", stage, size); @@ -880,12 +880,6 @@ void PlayerWheel::loadDBPlayerSlotPointsOnLogin() { bool PlayerWheel::saveDBPlayerSlotPointsOnLogout() const { Database &db = Database::getInstance(); std::ostringstream query; - query << "DELETE FROM `player_wheeldata` WHERE `player_id` = " << m_player.getGUID(); - if (!db.executeQuery(query.str())) { - return false; - } - query.str(std::string()); - DBInsert insertWheelData("INSERT INTO `player_wheeldata` (`player_id`, `slot`) VALUES "); insertWheelData.upsert({ "slot" }); PropWriteStream stream; diff --git a/src/database/database.cpp b/src/database/database.cpp index 5f5cdf321..a2a6969b7 100644 --- a/src/database/database.cpp +++ b/src/database/database.cpp @@ -11,6 +11,7 @@ #include "config/configmanager.hpp" #include "database/database.hpp" +#include "lib/di/container.hpp" Database::~Database() { if (handle != nullptr) { @@ -18,6 +19,10 @@ Database::~Database() { } } +Database &Database::getInstance() { + return inject(); +} + bool Database::connect() { return connect(&g_configManager().getString(MYSQL_HOST), &g_configManager().getString(MYSQL_USER), &g_configManager().getString(MYSQL_PASS), &g_configManager().getString(MYSQL_DB), g_configManager().getNumber(SQL_PORT), &g_configManager().getString(MYSQL_SOCK)); } diff --git a/src/database/database.hpp b/src/database/database.hpp index 4b6992506..f471a227c 100644 --- a/src/database/database.hpp +++ b/src/database/database.hpp @@ -10,7 +10,7 @@ #pragma once #include "declarations.hpp" -#include "lib/di/container.hpp" +#include "lib/logging/log_with_spd_log.hpp" class DBResult; using DBResult_ptr = std::shared_ptr; @@ -24,9 +24,7 @@ class Database { Database(const Database &) = delete; Database &operator=(const Database &) = delete; - static Database &getInstance() { - return inject(); - } + static Database &getInstance(); bool connect(); @@ -62,7 +60,6 @@ class Database { return error == CR_SERVER_LOST || error == CR_SERVER_GONE_ERROR || error == CR_CONN_HOST_ERROR || error == 1053 /*ER_SERVER_SHUTDOWN*/ || error == CR_CONNECTION_ERROR; } -private: MYSQL* handle = nullptr; std::recursive_mutex databaseLock; uint64_t maxPacketSize = 1048576; diff --git a/src/database/databasetasks.cpp b/src/database/databasetasks.cpp index ab401d91b..b69be96fd 100644 --- a/src/database/databasetasks.cpp +++ b/src/database/databasetasks.cpp @@ -12,6 +12,7 @@ #include "database/databasetasks.hpp" #include "game/scheduling/dispatcher.hpp" #include "lib/thread/thread_pool.hpp" +#include "lib/di/container.hpp" DatabaseTasks::DatabaseTasks(ThreadPool &threadPool, Database &db) : db(db), threadPool(threadPool) { @@ -25,7 +26,7 @@ void DatabaseTasks::execute(const std::string &query, std::functiontm_min; lightHour = (minutes * LIGHT_DAY_LENGTH) / 60; - g_scheduler().addEvent(EVENT_LIGHTINTERVAL_MS, std::bind(&Game::checkLight, this)); - g_scheduler().addEvent(EVENT_CREATURE_THINK_INTERVAL, std::bind(&Game::checkCreatures, this, 0)); - g_scheduler().addEvent(EVENT_IMBUEMENT_INTERVAL, std::bind(&Game::checkImbuements, this)); - g_scheduler().addEvent(EVENT_MS, std::bind_front(&Game::updateForgeableMonsters, this)); - g_scheduler().addEvent(EVENT_MS + 1000, std::bind_front(&Game::createFiendishMonsters, this)); - g_scheduler().addEvent(EVENT_MS + 1000, std::bind_front(&Game::createInfluencedMonsters, this)); + g_scheduler().addEvent(EVENT_LIGHTINTERVAL_MS, std::bind(&Game::checkLight, this), "Game::checkLight"); + g_scheduler().addEvent(EVENT_CREATURE_THINK_INTERVAL, std::bind(&Game::checkCreatures, this, 0), "Game::checkCreatures"); + g_scheduler().addEvent(EVENT_IMBUEMENT_INTERVAL, std::bind(&Game::checkImbuements, this), "Game::checkImbuements"); + g_scheduler().addEvent(EVENT_MS, std::bind_front(&Game::updateForgeableMonsters, this), "Game::updateForgeableMonsters"); + g_scheduler().addEvent(EVENT_MS + 1000, std::bind_front(&Game::createFiendishMonsters, this), "Game::createFiendishMonsters"); + g_scheduler().addEvent(EVENT_MS + 1000, std::bind_front(&Game::createInfluencedMonsters, this), "Game::createInfluencedMonsters"); } GameState_t Game::getGameState() const { @@ -360,7 +362,7 @@ void Game::setGameState(GameState_t newState) { saveMotdNum(); saveGameState(); - g_dispatcher().addTask(std::bind(&Game::shutdown, this)); + g_dispatcher().addTask(std::bind(&Game::shutdown, this), "Game::shutdown"); break; } @@ -404,6 +406,8 @@ void Game::saveGameState() { Map::save(); + g_kv().saveAll(); + if (gameState == GAME_STATE_MAINTAIN) { setGameState(GAME_STATE_NORMAL); } @@ -612,7 +616,12 @@ Thing* Game::internalGetThing(Player* player, const Position &pos, int32_t index } uint8_t slot = pos.z; - return parentContainer->getItemByIndex(player->getContainerIndex(fromCid) + slot); + auto containerIndex = player->getContainerIndex(fromCid) + slot; + if (parentContainer->isStoreInboxFiltered()) { + return parentContainer->getFilteredItemByIndex(containerIndex); + } + + return parentContainer->getItemByIndex(containerIndex); } else if (pos.y == 0x20 || pos.y == 0x21) { // '0x20' -> From depot. // '0x21' -> From inbox. @@ -825,7 +834,7 @@ ReturnValue Game::getPlayerByNameWildcard(const std::string &s, Player*&player) Player* Game::getPlayerByAccount(uint32_t acc) { for (const auto &it : players) { - if (it.second->getAccount() == acc) { + if (it.second->getAccountId() == acc) { return it.second; } } @@ -1077,7 +1086,8 @@ void Game::playerMoveThing(uint32_t playerId, const Position &fromPos, uint16_t if (Position::areInRange<1, 1, 0>(movingCreature->getPosition(), player->getPosition())) { std::shared_ptr task = createPlayerTask( g_configManager().getNumber(PUSH_DELAY), - std::bind(&Game::playerMoveCreatureByID, this, player->getID(), movingCreature->getID(), movingCreature->getPosition(), tile->getPosition()) + std::bind(&Game::playerMoveCreatureByID, this, player->getID(), movingCreature->getID(), movingCreature->getPosition(), tile->getPosition()), + "Game::playerMoveCreatureByID" ); player->setNextActionPushTask(task); } else { @@ -1117,7 +1127,7 @@ void Game::playerMoveCreatureByID(uint32_t playerId, uint32_t movingCreatureId, void Game::playerMoveCreature(Player* player, Creature* movingCreature, const Position &movingCreatureOrigPos, Tile* toTile) { if (!player->canDoAction()) { uint32_t delay = 600; - std::shared_ptr task = createPlayerTask(delay, std::bind(&Game::playerMoveCreatureByID, this, player->getID(), movingCreature->getID(), movingCreatureOrigPos, toTile->getPosition())); + std::shared_ptr task = createPlayerTask(delay, std::bind(&Game::playerMoveCreatureByID, this, player->getID(), movingCreature->getID(), movingCreatureOrigPos, toTile->getPosition()), "Game::playerMoveCreatureByID"); player->setNextActionPushTask(task); return; @@ -1129,9 +1139,9 @@ void Game::playerMoveCreature(Player* player, Creature* movingCreature, const Po // need to walk to the creature first before moving it std::forward_list listDir; if (player->getPathTo(movingCreatureOrigPos, listDir, 0, 1, true, true)) { - g_dispatcher().addTask(std::bind(&Game::playerAutoWalk, this, player->getID(), listDir)); + g_dispatcher().addTask(std::bind(&Game::playerAutoWalk, this, player->getID(), listDir), "Game::playerAutoWalk"); - std::shared_ptr task = createPlayerTask(600, std::bind(&Game::playerMoveCreatureByID, this, player->getID(), movingCreature->getID(), movingCreatureOrigPos, toTile->getPosition())); + std::shared_ptr task = createPlayerTask(600, std::bind(&Game::playerMoveCreatureByID, this, player->getID(), movingCreature->getID(), movingCreatureOrigPos, toTile->getPosition()), "Game::playerMoveCreatureByID"); player->pushEvent(true); player->setNextActionPushTask(task); @@ -1331,7 +1341,7 @@ void Game::playerMoveItemByPlayerID(uint32_t playerId, const Position &fromPos, void Game::playerMoveItem(Player* player, const Position &fromPos, uint16_t itemId, uint8_t fromStackPos, const Position &toPos, uint8_t count, Item* item, Cylinder* toCylinder) { if (!player->canDoAction()) { uint32_t delay = player->getNextActionTime(); - std::shared_ptr task = createPlayerTask(delay, std::bind(&Game::playerMoveItemByPlayerID, this, player->getID(), fromPos, itemId, fromStackPos, toPos, count)); + std::shared_ptr task = createPlayerTask(delay, std::bind(&Game::playerMoveItemByPlayerID, this, player->getID(), fromPos, itemId, fromStackPos, toPos, count), "Game::playerMoveItemByPlayerID"); player->setNextActionTask(task); return; } @@ -1426,9 +1436,9 @@ void Game::playerMoveItem(Player* player, const Position &fromPos, uint16_t item // need to walk to the item first before using it std::forward_list listDir; if (player->getPathTo(item->getPosition(), listDir, 0, 1, true, true)) { - g_dispatcher().addTask(std::bind(&Game::playerAutoWalk, this, player->getID(), listDir)); + g_dispatcher().addTask(std::bind(&Game::playerAutoWalk, this, player->getID(), listDir), "Game::playerAutoWalk"); - std::shared_ptr task = createPlayerTask(400, std::bind(&Game::playerMoveItemByPlayerID, this, player->getID(), fromPos, itemId, fromStackPos, toPos, count)); + std::shared_ptr task = createPlayerTask(400, std::bind(&Game::playerMoveItemByPlayerID, this, player->getID(), fromPos, itemId, fromStackPos, toPos, count), "Game::playerMoveItemByPlayerID"); player->setNextWalkActionTask(task); } else { player->sendCancelMessage(RETURNVALUE_THEREISNOWAY); @@ -1483,9 +1493,9 @@ void Game::playerMoveItem(Player* player, const Position &fromPos, uint16_t item std::forward_list listDir; if (player->getPathTo(walkPos, listDir, 0, 0, true, true)) { - g_dispatcher().addTask(std::bind(&Game::playerAutoWalk, this, player->getID(), listDir)); + g_dispatcher().addTask(std::bind(&Game::playerAutoWalk, this, player->getID(), listDir), "Game::playerAutoWalk"); - std::shared_ptr task = createPlayerTask(400, std::bind(&Game::playerMoveItemByPlayerID, this, player->getID(), itemPos, itemId, itemStackPos, toPos, count)); + std::shared_ptr task = createPlayerTask(400, std::bind(&Game::playerMoveItemByPlayerID, this, player->getID(), itemPos, itemId, itemStackPos, toPos, count), "Game::playerMoveItemByPlayerID"); player->setNextWalkActionTask(task); } else { player->sendCancelMessage(RETURNVALUE_THEREISNOWAY); @@ -1585,8 +1595,9 @@ ReturnValue Game::checkMoveItemToCylinder(Player* player, Cylinder* fromCylinder } const Container* topParentContainer = toCylinderContainer->getRootContainer(); - - if (!item->isStoreItem() && (containerID == ITEM_STORE_INBOX || topParentContainer->getParent() && topParentContainer->getParent()->getContainer() && topParentContainer->getParent()->getContainer()->getID() == ITEM_STORE_INBOX)) { + const auto parentContainer = topParentContainer->getParent() ? topParentContainer->getParent()->getContainer() : nullptr; + auto isStoreInbox = parentContainer && parentContainer->isStoreInbox(); + if (!item->isStoreItem() && (containerID == ITEM_STORE_INBOX || isStoreInbox)) { return RETURNVALUE_CONTAINERNOTENOUGHROOM; } @@ -1600,7 +1611,7 @@ ReturnValue Game::checkMoveItemToCylinder(Player* player, Cylinder* fromCylinder isValidMoveItem = true; } - if (topParentContainer->getParent() && topParentContainer->getParent()->getContainer() && (topParentContainer->getParent()->getContainer()->isDepotChest() || topParentContainer->getParent()->getContainer()->getID() == ITEM_STORE_INBOX)) { + if (parentContainer && (parentContainer->isDepotChest() || isStoreInbox)) { isValidMoveItem = true; } @@ -1643,7 +1654,7 @@ ReturnValue Game::checkMoveItemToCylinder(Player* player, Cylinder* fromCylinder return RETURNVALUE_NOERROR; } -ReturnValue Game::internalMoveItem(Cylinder* fromCylinder, Cylinder* toCylinder, int32_t index, Item* item, uint32_t count, Item** internalMoveItem, uint32_t flags /*= 0*/, Creature* actor /*=nullptr*/, Item* tradeItem /* = nullptr*/) { +ReturnValue Game::internalMoveItem(Cylinder* fromCylinder, Cylinder* toCylinder, int32_t index, Item* item, uint32_t count, Item** movedItem, uint32_t flags /*= 0*/, Creature* actor /*=nullptr*/, Item* tradeItem /* = nullptr*/, bool checkTile /* = true*/) { if (fromCylinder == nullptr) { g_logger().error("[{}] fromCylinder is nullptr", __FUNCTION__); return RETURNVALUE_NOTPOSSIBLE; @@ -1653,11 +1664,12 @@ ReturnValue Game::internalMoveItem(Cylinder* fromCylinder, Cylinder* toCylinder, return RETURNVALUE_NOTPOSSIBLE; } - Tile* fromTile = fromCylinder->getTile(); - if (fromTile) { - auto it = browseFields.find(fromTile); - if (it != browseFields.end() && it->second == fromCylinder) { - fromCylinder = fromTile; + if (checkTile) { + if (Tile* fromTile = fromCylinder->getTile()) { + auto it = browseFields.find(fromTile); + if (it != browseFields.end() && it->second == fromCylinder) { + fromCylinder = fromTile; + } } } @@ -1817,11 +1829,11 @@ ReturnValue Game::internalMoveItem(Cylinder* fromCylinder, Cylinder* toCylinder, updateItem->startDecaying(); } - if (internalMoveItem) { + if (movedItem) { if (moveItem) { - *internalMoveItem = moveItem; + *movedItem = moveItem; } else { - *internalMoveItem = item; + *movedItem = item; } } @@ -1853,9 +1865,18 @@ ReturnValue Game::internalMoveItem(Cylinder* fromCylinder, Cylinder* toCylinder, return retMaxCount; } - // looting analyser from this point forward + auto fromContainer = fromCylinder ? fromCylinder->getContainer() : nullptr; + auto toContainer = toCylinder ? toCylinder->getContainer() : nullptr; + auto player = actor ? actor->getPlayer() : nullptr; + if (player) { + // Update containers + player->onSendContainer(toContainer); + player->onSendContainer(fromContainer); + } + + // Actor related actions if (fromCylinder && actor && toCylinder) { - if (!fromCylinder->getContainer() || !actor->getPlayer() || !toCylinder->getContainer()) { + if (!fromContainer || !toContainer || !player) { return ret; } @@ -1870,7 +1891,8 @@ ReturnValue Game::internalMoveItem(Cylinder* fromCylinder, Cylinder* toCylinder, return ret; } - if (it.isCorpse && toCylinder->getContainer()->getTopParent() == player && item->getIsLootTrackeable()) { + // Looting analyser + if (it.isCorpse && toContainer->getTopParent() == player && item->getIsLootTrackeable()) { player->sendLootStats(item, static_cast(item->getItemCount())); } } @@ -2003,7 +2025,7 @@ ReturnValue Game::internalRemoveItem(Item* item, int32_t count /*= -1*/, bool te } // Not remove item with decay loaded from map - if (!force && item->canDecay() && cylinder->getTile() && item->getLoadedFromMap()) { + if (!force && item->canDecay() && cylinder->getTile() && item->isLoadedFromMap()) { g_logger().debug("Cannot remove item with id {}, name {}, on position {}", item->getID(), item->getName(), cylinder->getPosition().toString()); item->stopDecaying(); return RETURNVALUE_THISISIMPOSSIBLE; @@ -2519,7 +2541,7 @@ void Game::internalQuickLootCorpse(Player* player, Container* corpse) { ss << " (automatic looting)"; } ss << "."; - player->sendTextMessage(MESSAGE_LOOT, ss.str()); + player->sendTextMessage(MESSAGE_STATUS, ss.str()); if (shouldNotifyCapacity) { ss.str(std::string()); @@ -2601,7 +2623,7 @@ ReturnValue Game::processMoveOrAddItemToLootContainer(Item* item, Container* loo Item* moveItem = nullptr; ReturnValue ret; if (item->getParent()) { - ret = internalMoveItem(item->getParent(), lootContainer, INDEX_WHEREEVER, item, item->getItemCount(), &moveItem, 0, player); + ret = internalMoveItem(item->getParent(), lootContainer, INDEX_WHEREEVER, item, item->getItemCount(), &moveItem, 0, player, nullptr, false); } else { ret = internalAddItem(lootContainer, item, INDEX_WHEREEVER); } @@ -3183,9 +3205,9 @@ void Game::playerUseItemEx(uint32_t playerId, const Position &fromPos, uint8_t f std::forward_list listDir; if (player->getPathTo(walkToPos, listDir, 0, 1, true, true)) { - g_dispatcher().addTask(std::bind(&Game::playerAutoWalk, this, player->getID(), listDir)); + g_dispatcher().addTask(std::bind(&Game::playerAutoWalk, this, player->getID(), listDir), "Game::playerAutoWalk"); - std::shared_ptr task = createPlayerTask(400, std::bind(&Game::playerUseItemEx, this, playerId, itemPos, itemStackPos, fromItemId, toPos, toStackPos, toItemId)); + std::shared_ptr task = createPlayerTask(400, std::bind(&Game::playerUseItemEx, this, playerId, itemPos, itemStackPos, fromItemId, toPos, toStackPos, toItemId), "Game::playerUseItemEx"); if (it.isRune() || it.type == ITEM_TYPE_POTION) { player->setNextPotionActionTask(task); } else { @@ -3211,7 +3233,7 @@ void Game::playerUseItemEx(uint32_t playerId, const Position &fromPos, uint8_t f if (it.isRune() || it.type == ITEM_TYPE_POTION) { delay = player->getNextPotionActionTime(); } - std::shared_ptr task = createPlayerTask(delay, std::bind(&Game::playerUseItemEx, this, playerId, fromPos, fromStackPos, fromItemId, toPos, toStackPos, toItemId)); + std::shared_ptr task = createPlayerTask(delay, std::bind(&Game::playerUseItemEx, this, playerId, fromPos, fromStackPos, fromItemId, toPos, toStackPos, toItemId), "Game::playerUseItemEx"); if (it.isRune() || it.type == ITEM_TYPE_POTION) { player->setNextPotionActionTask(task); } else { @@ -3288,9 +3310,9 @@ void Game::playerUseItem(uint32_t playerId, const Position &pos, uint8_t stackPo if (ret == RETURNVALUE_TOOFARAWAY) { std::forward_list listDir; if (player->getPathTo(pos, listDir, 0, 1, true, true)) { - g_dispatcher().addTask(std::bind(&Game::playerAutoWalk, this, player->getID(), listDir)); + g_dispatcher().addTask(std::bind(&Game::playerAutoWalk, this, player->getID(), listDir), "Game::playerAutoWalk"); - std::shared_ptr task = createPlayerTask(400, std::bind(&Game::playerUseItem, this, playerId, pos, stackPos, index, itemId)); + std::shared_ptr task = createPlayerTask(400, std::bind(&Game::playerUseItem, this, playerId, pos, stackPos, index, itemId), "Game::playerUseItem"); if (it.isRune() || it.type == ITEM_TYPE_POTION) { player->setNextPotionActionTask(task); } else { @@ -3316,7 +3338,7 @@ void Game::playerUseItem(uint32_t playerId, const Position &pos, uint8_t stackPo if (it.isRune() || it.type == ITEM_TYPE_POTION) { delay = player->getNextPotionActionTime(); } - std::shared_ptr task = createPlayerTask(delay, std::bind(&Game::playerUseItem, this, playerId, pos, stackPos, index, itemId)); + std::shared_ptr task = createPlayerTask(delay, std::bind(&Game::playerUseItem, this, playerId, pos, stackPos, index, itemId), "Game::playerUseItem"); if (it.isRune() || it.type == ITEM_TYPE_POTION) { player->setNextPotionActionTask(task); } else { @@ -3422,9 +3444,9 @@ void Game::playerUseWithCreature(uint32_t playerId, const Position &fromPos, uin std::forward_list listDir; if (player->getPathTo(walkToPos, listDir, 0, 1, true, true)) { - g_dispatcher().addTask(std::bind(&Game::playerAutoWalk, this, player->getID(), listDir)); + g_dispatcher().addTask(std::bind(&Game::playerAutoWalk, this, player->getID(), listDir), "Game::playerAutoWalk"); - std::shared_ptr task = createPlayerTask(400, std::bind(&Game::playerUseWithCreature, this, playerId, itemPos, itemStackPos, creatureId, itemId)); + std::shared_ptr task = createPlayerTask(400, std::bind(&Game::playerUseWithCreature, this, playerId, itemPos, itemStackPos, creatureId, itemId), "Game::playerUseWithCreature"); if (it.isRune() || it.type == ITEM_TYPE_POTION) { player->setNextPotionActionTask(task); } else { @@ -3450,7 +3472,7 @@ void Game::playerUseWithCreature(uint32_t playerId, const Position &fromPos, uin if (it.isRune() || it.type == ITEM_TYPE_POTION) { delay = player->getNextPotionActionTime(); } - std::shared_ptr task = createPlayerTask(delay, std::bind(&Game::playerUseWithCreature, this, playerId, fromPos, fromStackPos, creatureId, itemId)); + std::shared_ptr task = createPlayerTask(delay, std::bind(&Game::playerUseWithCreature, this, playerId, fromPos, fromStackPos, creatureId, itemId), "Game::playerUseWithCreature"); if (it.isRune() || it.type == ITEM_TYPE_POTION) { player->setNextPotionActionTask(task); @@ -3511,7 +3533,7 @@ void Game::playerMoveUpContainer(uint32_t playerId, uint8_t cid) { parentContainer = new Container(tile); parentContainer->incrementReferenceCounter(); browseFields[tile] = parentContainer; - g_scheduler().addEvent(30000, std::bind(&Game::decreaseBrowseFieldRef, this, tile->getPosition())); + g_scheduler().addEvent(30000, std::bind(&Game::decreaseBrowseFieldRef, this, tile->getPosition()), "Game::decreaseBrowseFieldRef"); } else { parentContainer = it->second; } @@ -3563,9 +3585,9 @@ void Game::playerRotateItem(uint32_t playerId, const Position &pos, uint8_t stac if (pos.x != 0xFFFF && !Position::areInRange<1, 1, 0>(pos, player->getPosition())) { std::forward_list listDir; if (player->getPathTo(pos, listDir, 0, 1, true, true)) { - g_dispatcher().addTask(std::bind(&Game::playerAutoWalk, this, player->getID(), listDir)); + g_dispatcher().addTask(std::bind(&Game::playerAutoWalk, this, player->getID(), listDir), "Game::playerAutoWalk"); - std::shared_ptr task = createPlayerTask(400, std::bind(&Game::playerRotateItem, this, playerId, pos, stackPos, itemId)); + std::shared_ptr task = createPlayerTask(400, std::bind(&Game::playerRotateItem, this, playerId, pos, stackPos, itemId), "Game::playerRotateItem"); player->setNextWalkActionTask(task); } else { player->sendCancelMessage(RETURNVALUE_THEREISNOWAY); @@ -3604,12 +3626,12 @@ void Game::playerConfigureShowOffSocket(uint32_t playerId, const Position &pos, if (!Position::areInRange<1, 1, 0>(pos, player->getPosition())) { std::forward_list listDir; if (player->getPathTo(pos, listDir, 0, 1, true, false)) { - g_dispatcher().addTask(std::bind(&Game::playerAutoWalk, this, player->getID(), listDir)); + g_dispatcher().addTask(std::bind(&Game::playerAutoWalk, this, player->getID(), listDir), "Game::playerAutoWalk"); std::shared_ptr task; if (isPodiumOfRenown) { - task = createPlayerTask(400, std::bind_front(&Player::sendPodiumWindow, player, item, pos, itemId, stackPos)); + task = createPlayerTask(400, std::bind_front(&Player::sendPodiumWindow, player, item, pos, itemId, stackPos), "Game::playerConfigureShowOffSocket"); } else { - task = createPlayerTask(400, std::bind_front(&Player::sendMonsterPodiumWindow, player, item, pos, itemId, stackPos)); + task = createPlayerTask(400, std::bind_front(&Player::sendMonsterPodiumWindow, player, item, pos, itemId, stackPos), "Game::playerConfigureShowOffSocket"); } player->setNextWalkActionTask(task); } else { @@ -3651,8 +3673,8 @@ void Game::playerSetShowOffSocket(uint32_t playerId, Outfit_t &outfit, const Pos if (!Position::areInRange<1, 1, 0>(pos, player->getPosition())) { std::forward_list listDir; if (player->getPathTo(pos, listDir, 0, 1, true, false)) { - g_dispatcher().addTask(std::bind(&Game::playerAutoWalk, this, player->getID(), listDir)); - std::shared_ptr task = createPlayerTask(400, std::bind(&Game::playerBrowseField, this, playerId, pos)); + g_dispatcher().addTask(std::bind(&Game::playerAutoWalk, this, player->getID(), listDir), "Game::playerAutoWalk"); + std::shared_ptr task = createPlayerTask(400, std::bind(&Game::playerBrowseField, this, playerId, pos), "Game::playerBrowseField"); player->setNextWalkActionTask(task); } else { player->sendCancelMessage(RETURNVALUE_THEREISNOWAY); @@ -3785,9 +3807,9 @@ void Game::playerWrapableItem(uint32_t playerId, const Position &pos, uint8_t st if (pos.x != 0xFFFF && !Position::areInRange<1, 1, 0>(pos, player->getPosition())) { std::forward_list listDir; if (player->getPathTo(pos, listDir, 0, 1, true, true)) { - g_dispatcher().addTask(std::bind(&Game::playerAutoWalk, this, player->getID(), listDir)); + g_dispatcher().addTask(std::bind(&Game::playerAutoWalk, this, player->getID(), listDir), "Game::playerAutoWalk"); - std::shared_ptr task = createPlayerTask(400, std::bind(&Game::playerWrapableItem, this, playerId, pos, stackPos, itemId)); + std::shared_ptr task = createPlayerTask(400, std::bind(&Game::playerWrapableItem, this, playerId, pos, stackPos, itemId), "Game::playerWrapableItem"); player->setNextWalkActionTask(task); } else { player->sendCancelMessage(RETURNVALUE_THEREISNOWAY); @@ -3954,8 +3976,8 @@ void Game::playerBrowseField(uint32_t playerId, const Position &pos) { if (!Position::areInRange<1, 1>(playerPos, pos)) { std::forward_list listDir; if (player->getPathTo(pos, listDir, 0, 1, true, true)) { - g_dispatcher().addTask(std::bind(&Game::playerAutoWalk, this, player->getID(), listDir)); - std::shared_ptr task = createPlayerTask(400, std::bind(&Game::playerBrowseField, this, playerId, pos)); + g_dispatcher().addTask(std::bind(&Game::playerAutoWalk, this, player->getID(), listDir), "Game::playerAutoWalk"); + std::shared_ptr task = createPlayerTask(400, std::bind(&Game::playerBrowseField, this, playerId, pos), "Game::playerBrowseField"); player->setNextWalkActionTask(task); } else { player->sendCancelMessage(RETURNVALUE_THEREISNOWAY); @@ -3983,7 +4005,7 @@ void Game::playerBrowseField(uint32_t playerId, const Position &pos) { container = new Container(tile); container->incrementReferenceCounter(); browseFields[tile] = container; - g_scheduler().addEvent(30000, std::bind(&Game::decreaseBrowseFieldRef, this, tile->getPosition())); + g_scheduler().addEvent(30000, std::bind(&Game::decreaseBrowseFieldRef, this, tile->getPosition()), "Game::decreaseBrowseFieldRef"); } else { container = it->second; } @@ -4108,7 +4130,7 @@ void Game::playerStashWithdraw(uint32_t playerId, uint16_t itemId, uint32_t coun } } -void Game::playerSeekInContainer(uint32_t playerId, uint8_t containerId, uint16_t index) { +void Game::playerSeekInContainer(uint32_t playerId, uint8_t containerId, uint16_t index, uint8_t containerCategory) { Player* player = getPlayerByID(playerId); if (!player) { return; @@ -4119,6 +4141,12 @@ void Game::playerSeekInContainer(uint32_t playerId, uint8_t containerId, uint16_ return; } + if (container->isStoreInbox()) { + auto enumName = magic_enum::enum_name(static_cast(containerCategory)).data(); + container->setAttribute(ItemAttribute_t::STORE_INBOX_CATEGORY, enumName); + g_logger().debug("Setting new container with store inbox category name {}", enumName); + } + if ((index % container->capacity()) != 0 || index >= container->size()) { return; } @@ -4200,9 +4228,9 @@ void Game::playerRequestTrade(uint32_t playerId, const Position &pos, uint8_t st if (!Position::areInRange<1, 1>(tradeItemPosition, playerPosition)) { std::forward_list listDir; if (player->getPathTo(pos, listDir, 0, 1, true, true)) { - g_dispatcher().addTask(std::bind(&Game::playerAutoWalk, this, player->getID(), listDir)); + g_dispatcher().addTask(std::bind(&Game::playerAutoWalk, this, player->getID(), listDir), "Game::playerAutoWalk"); - std::shared_ptr task = createPlayerTask(400, std::bind(&Game::playerRequestTrade, this, playerId, pos, stackPos, tradePlayerId, itemId)); + std::shared_ptr task = createPlayerTask(400, std::bind(&Game::playerRequestTrade, this, playerId, pos, stackPos, tradePlayerId, itemId), "Game::playerRequestTrade"); player->setNextWalkActionTask(task); } else { player->sendCancelMessage(RETURNVALUE_THEREISNOWAY); @@ -4744,7 +4772,7 @@ void Game::playerQuickLoot(uint32_t playerId, const Position &pos, uint16_t item if (!autoLoot && !player->canDoAction()) { uint32_t delay = player->getNextActionTime(); - std::shared_ptr task = createPlayerTask(delay, std::bind(&Game::playerQuickLoot, this, player->getID(), pos, itemId, stackPos, defaultItem, lootAllCorpses, autoLoot)); + std::shared_ptr task = createPlayerTask(delay, std::bind(&Game::playerQuickLoot, this, player->getID(), pos, itemId, stackPos, defaultItem, lootAllCorpses, autoLoot), "Game::playerQuickLoot"); player->setNextActionTask(task); return; } @@ -4754,8 +4782,8 @@ void Game::playerQuickLoot(uint32_t playerId, const Position &pos, uint16_t item // need to walk to the corpse first before looting it std::forward_list listDir; if (player->getPathTo(pos, listDir, 0, 1, true, true)) { - g_dispatcher().addTask(std::bind(&Game::playerAutoWalk, this, player->getID(), listDir)); - std::shared_ptr task = createPlayerTask(0, std::bind(&Game::playerQuickLoot, this, player->getID(), pos, itemId, stackPos, defaultItem, lootAllCorpses, autoLoot)); + g_dispatcher().addTask(std::bind(&Game::playerAutoWalk, this, player->getID(), listDir), "Game::playerAutoWalk"); + std::shared_ptr task = createPlayerTask(0, std::bind(&Game::playerQuickLoot, this, player->getID(), pos, itemId, stackPos, defaultItem, lootAllCorpses, autoLoot), "Game::playerQuickLoot"); player->setNextWalkActionTask(task); } else { player->sendCancelMessage(RETURNVALUE_THEREISNOWAY); @@ -5117,7 +5145,7 @@ void Game::playerSetAttackedCreature(uint32_t playerId, uint32_t creatureId) { } player->setAttackedCreature(attackCreature); - g_dispatcher().addTask(std::bind(&Game::updateCreatureWalk, this, player->getID())); + g_dispatcher().addTask(std::bind(&Game::updateCreatureWalk, this, player->getID()), "Game::updateCreatureWalk"); } void Game::playerFollowCreature(uint32_t playerId, uint32_t creatureId) { @@ -5127,7 +5155,7 @@ void Game::playerFollowCreature(uint32_t playerId, uint32_t creatureId) { } player->setAttackedCreature(nullptr); - g_dispatcher().addTask(std::bind(&Game::updateCreatureWalk, this, player->getID())); + g_dispatcher().addTask(std::bind(&Game::updateCreatureWalk, this, player->getID()), "Game::updateCreatureWalk"); player->setFollowCreature(getCreatureByID(creatureId)); } @@ -5567,8 +5595,8 @@ void Game::playerSpeakToNpc(Player* player, const std::string &text) { player->updateUIExhausted(); } -std::shared_ptr Game::createPlayerTask(uint32_t delay, std::function f) { - return Player::createPlayerTask(delay, f); +std::shared_ptr Game::createPlayerTask(uint32_t delay, std::function f, std::string context) const { + return Player::createPlayerTask(delay, f, context); } //-- @@ -5690,7 +5718,7 @@ void Game::removeCreatureCheck(Creature* creature) { } void Game::checkCreatures(size_t index) { - g_scheduler().addEvent(EVENT_CHECK_CREATURE_INTERVAL, std::bind(&Game::checkCreatures, this, (index + 1) % EVENT_CREATURECOUNT)); + g_scheduler().addEvent(EVENT_CHECK_CREATURE_INTERVAL, std::bind(&Game::checkCreatures, this, (index + 1) % EVENT_CREATURECOUNT), "Game::checkCreatures"); auto &checkCreatureList = checkCreatureLists[index]; size_t it = 0, end = checkCreatureList.size(); @@ -6391,7 +6419,7 @@ bool Game::combatChangeHealth(Creature* attacker, Creature* target, CombatDamage } else { ss << ucfirst(attacker->getNameDescription()) << " healed "; if (attacker == target) { - ss << (targetPlayer ? (targetPlayer->getSex() == PLAYERSEX_FEMALE ? "herself" : "himself") : "itself"); + ss << (targetPlayer ? targetPlayer->getReflexivePronoun() : "itself"); } else { ss << target->getNameDescription(); } @@ -6618,8 +6646,7 @@ bool Game::combatChangeHealth(Creature* attacker, Creature* target, CombatDamage if (attacker) { ss << " due to "; if (attacker == target) { - ss << (targetPlayer ? (targetPlayer->getSex() == PLAYERSEX_FEMALE ? "her own " : "his own ") : "its own "); - ss << attackMsg; + ss << (targetPlayer ? targetPlayer->getPossessivePronoun() : "its") << " own attack"; } else { ss << "an " << attackMsg << " by " << attacker->getNameDescription(); } @@ -6813,7 +6840,7 @@ void Game::buildMessageAsSpectator( ss << " due to "; if (attacker == target) { if (targetPlayer) { - ss << (targetPlayer->getSex() == PLAYERSEX_FEMALE ? "her own attack" : "his own attack"); + ss << targetPlayer->getPossessivePronoun() << " own attack"; } else { ss << "its own attack"; } @@ -7017,7 +7044,7 @@ bool Game::combatChangeMana(Creature* attacker, Creature* target, CombatDamage & spectatorMessage += ucfirst(attacker->getNameDescription()); spectatorMessage += " restored "; if (attacker == target) { - spectatorMessage += (targetPlayer ? (targetPlayer->getSex() == PLAYERSEX_FEMALE ? "herself" : "himself") : "itself"); + spectatorMessage += (targetPlayer ? targetPlayer->getReflexivePronoun() : "itself"); } else { spectatorMessage += target->getNameDescription(); } @@ -7162,7 +7189,7 @@ bool Game::combatChangeMana(Creature* attacker, Creature* target, CombatDamage & if (attacker) { ss << " due to "; if (attacker == target) { - ss << (targetPlayer ? (targetPlayer->getSex() == PLAYERSEX_FEMALE ? "her own attack" : "his own attack") : "its own attack"); + ss << (targetPlayer ? targetPlayer->getPossessivePronoun() : "its") << " own attack"; } else { ss << "an attack by " << attacker->getNameDescription(); } @@ -7272,7 +7299,7 @@ void Game::addDistanceEffect(const SpectatorHashSet &spectators, const Position } void Game::checkImbuements() { - g_scheduler().addEvent(EVENT_IMBUEMENT_INTERVAL, std::bind(&Game::checkImbuements, this)); + g_scheduler().addEvent(EVENT_IMBUEMENT_INTERVAL, std::bind(&Game::checkImbuements, this), "Game::checkImbuements"); for (const auto &[mapPlayerId, mapPlayer] : getPlayers()) { if (!mapPlayer) { @@ -7284,7 +7311,7 @@ void Game::checkImbuements() { } void Game::checkLight() { - g_scheduler().addEvent(EVENT_LIGHTINTERVAL_MS, std::bind(&Game::checkLight, this)); + g_scheduler().addEvent(EVENT_LIGHTINTERVAL_MS, std::bind(&Game::checkLight, this), "Game::checkLight"); lightHour += lightHourDelta; @@ -8225,6 +8252,11 @@ bool checkCanInitCreateMarketOffer(const Player* player, uint8_t type, const Ite return false; } + if (!player->getAccount()) { + offerStatus << "Failed to load player account"; + return false; + } + if (!player->isInMarket()) { offerStatus << "Failed to load market for player " << player->getName(); return false; @@ -8306,17 +8338,15 @@ void Game::playerCreateMarketOffer(uint32_t playerId, uint8_t type, uint16_t ite } if (it.id == ITEM_STORE_COIN) { - account::Account account(player->getAccount()); - account.LoadAccountDB(); - uint32_t transferableCoins; - account.GetTransferableCoins(&transferableCoins); + auto [transferableCoins, result] = player->getAccount()->getCoins(account::CoinType::TRANSFERABLE); if (amount > transferableCoins) { offerStatus << "Amount is greater than coins for player " << player->getName(); return; } - account.RemoveTransferableCoins(static_cast(amount)); + // Do not register a transaction for coins creating an offer + player->getAccount()->removeCoins(account::CoinType::TRANSFERABLE, static_cast(amount), ""); } else { if (!removeOfferItems(*player, *depotLocker, it, amount, tier, offerStatus)) { g_logger().error("[{}] failed to remove item with id {}, from player {}, errorcode: {}", __FUNCTION__, it.id, player->getName(), offerStatus.str()); @@ -8375,7 +8405,7 @@ void Game::playerCreateMarketOffer(uint32_t playerId, uint8_t type, uint16_t ite void Game::playerCancelMarketOffer(uint32_t playerId, uint32_t timestamp, uint16_t counter) { Player* player = getPlayerByID(playerId); - if (!player) { + if (!player || !player->getAccount()) { return; } @@ -8404,9 +8434,8 @@ void Game::playerCancelMarketOffer(uint32_t playerId, uint32_t timestamp, uint16 } if (it.id == ITEM_STORE_COIN) { - account::Account account; - account.LoadAccountDB(player->getAccount()); - account.AddTransferableCoins(offer.amount); + // Do not register a transaction for coins upon cancellation + player->getAccount()->addCoins(account::CoinType::TRANSFERABLE, offer.amount, ""); } else if (it.stackable) { uint16_t tmpAmount = offer.amount; while (tmpAmount > 0) { @@ -8460,7 +8489,7 @@ void Game::playerCancelMarketOffer(uint32_t playerId, uint32_t timestamp, uint16 void Game::playerAcceptMarketOffer(uint32_t playerId, uint32_t timestamp, uint16_t counter, uint16_t amount) { std::ostringstream offerStatus; Player* player = getPlayerByID(playerId); - if (!player) { + if (!player || !player->getAccount()) { offerStatus << "Failed to load player"; return; } @@ -8513,23 +8542,34 @@ void Game::playerAcceptMarketOffer(uint32_t playerId, uint32_t timestamp, uint16 } } + if (!buyerPlayer->getAccount()) { + player->sendTextMessage(MESSAGE_MARKET, "Cannot accept offer."); + return; + } + if (player == buyerPlayer || player->getAccount() == buyerPlayer->getAccount()) { player->sendTextMessage(MESSAGE_MARKET, "You cannot accept your own offer."); return; } if (it.id == ITEM_STORE_COIN) { - account::Account account; - account.LoadAccountDB(player->getAccount()); - uint32_t transferableCoins; - account.GetTransferableCoins(&transferableCoins); + auto [transferableCoins, error] = player->getAccount()->getCoins(account::CoinType::TRANSFERABLE); + + if (error != account::ERROR_NO) { + offerStatus << "Failed to load transferable coins for player " << player->getName(); + return; + } + if (amount > transferableCoins) { offerStatus << "Amount is greater than coins"; return; } - account.RemoveTransferableCoins(amount); - account.RegisterCoinsTransaction(account::COIN_REMOVE, amount, "Sold on Market"); + player->getAccount()->removeCoins( + account::CoinType::TRANSFERABLE, + amount, + "Sold on Market" + ); } else { if (!removeOfferItems(*player, *depotLocker, it, amount, offer.tier, offerStatus)) { g_logger().error("[{}] failed to remove item with id {}, from player {}, errorcode: {}", __FUNCTION__, it.id, player->getName(), offerStatus.str()); @@ -8553,10 +8593,7 @@ void Game::playerAcceptMarketOffer(uint32_t playerId, uint32_t timestamp, uint16 player->setBankBalance(player->getBankBalance() + totalPrice); if (it.id == ITEM_STORE_COIN) { - account::Account account; - account.LoadAccountDB(buyerPlayer->getAccount()); - account.AddTransferableCoins(amount); - account.RegisterCoinsTransaction(account::COIN_ADD, amount, "Purchased on Market"); + buyerPlayer->getAccount()->addCoins(account::CoinType::TRANSFERABLE, amount, "Purchased on Market"); } else if (it.stackable) { uint16_t tmpAmount = amount; while (tmpAmount > 0) { @@ -8631,10 +8668,7 @@ void Game::playerAcceptMarketOffer(uint32_t playerId, uint32_t timestamp, uint16 } if (it.id == ITEM_STORE_COIN) { - account::Account account; - account.LoadAccountDB(player->getAccount()); - account.AddTransferableCoins(amount); - account.RegisterCoinsTransaction(account::COIN_ADD, amount, "Purchased on Market"); + player->getAccount()->addCoins(account::CoinType::TRANSFERABLE, amount, "Purchased on Market"); } else if (it.stackable) { uint16_t tmpAmount = amount; while (tmpAmount > 0) { @@ -8687,9 +8721,7 @@ void Game::playerAcceptMarketOffer(uint32_t playerId, uint32_t timestamp, uint16 sellerPlayer->setBankBalance(sellerPlayer->getBankBalance() + totalPrice); if (it.id == ITEM_STORE_COIN) { - account::Account account; - account.LoadAccountDB(sellerPlayer->getAccount()); - account.RegisterCoinsTransaction(account::COIN_REMOVE, amount, "Sold on Market"); + sellerPlayer->getAccount()->registerCoinTransaction(account::CoinTransactionType::REMOVE, account::CoinType::TRANSFERABLE, amount, "Sold on Market"); } if (it.id != ITEM_STORE_COIN) { @@ -8912,8 +8944,8 @@ void Game::playerSetMonsterPodium(uint32_t playerId, uint32_t monsterRaceId, con if (!Position::areInRange<1, 1, 0>(pos, player->getPosition())) { if (std::forward_list listDir; player->getPathTo(pos, listDir, 0, 1, true, false)) { - g_dispatcher().addTask(std::bind_front(&Game::playerAutoWalk, this, player->getID(), listDir)); - std::shared_ptr task = createPlayerTask(400, std::bind_front(&Game::playerBrowseField, this, playerId, pos)); + g_dispatcher().addTask(std::bind_front(&Game::playerAutoWalk, this, player->getID(), listDir), "Game::playerAutoWalk"); + std::shared_ptr task = createPlayerTask(400, std::bind_front(&Game::playerBrowseField, this, playerId, pos), "Game::playerBrowseField"); player->setNextWalkActionTask(task); } else { player->sendCancelMessage(RETURNVALUE_THEREISNOWAY); @@ -9009,9 +9041,9 @@ void Game::playerRotatePodium(uint32_t playerId, const Position &pos, uint8_t st if (pos.x != 0xFFFF && !Position::areInRange<1, 1, 0>(pos, player->getPosition())) { if (std::forward_list listDir; player->getPathTo(pos, listDir, 0, 1, true, true)) { - g_dispatcher().addTask(std::bind_front(&Game::playerAutoWalk, this, player->getID(), listDir)); + g_dispatcher().addTask(std::bind_front(&Game::playerAutoWalk, this, player->getID(), listDir), "Game::playerAutoWalk"); - std::shared_ptr task = createPlayerTask(400, std::bind_front(&Game::playerRotatePodium, this, playerId, pos, stackPos, itemId)); + std::shared_ptr task = createPlayerTask(400, std::bind_front(&Game::playerRotatePodium, this, playerId, pos, stackPos, itemId), "Game::playerRotatePodium"); player->setNextWalkActionTask(task); } else { player->sendCancelMessage(RETURNVALUE_THEREISNOWAY); @@ -9509,7 +9541,8 @@ uint32_t Game::makeFiendishMonster(uint32_t forgeableMonsterId /* = 0*/, bool cr auto schedulerTask = createPlayerTask( finalTime, - std::bind_front(&Game::updateFiendishMonsterStatus, this, monster->getID(), monster->getName()) + std::bind_front(&Game::updateFiendishMonsterStatus, this, monster->getID(), monster->getName()), + "Game::updateFiendishMonsterStatus" ); forgeMonsterEventIds[monster->getID()] = g_scheduler().addEvent(schedulerTask); return monster->getID(); @@ -9547,7 +9580,7 @@ bool Game::removeInfluencedMonster(uint32_t id, bool create /* = false*/) { influencedMonsters.erase(find); if (create) { - g_scheduler().addEvent(200 * 1000, std::bind_front(&Game::makeInfluencedMonster, this)); + g_scheduler().addEvent(200 * 1000, std::bind_front(&Game::makeInfluencedMonster, this), "Game::makeInfluencedMonster"); } } else { g_logger().warn("[Game::removeInfluencedMonster] - Failed to remove a Influenced Monster, error code: monster id not exist in the influenced monsters map"); @@ -9563,7 +9596,7 @@ bool Game::removeFiendishMonster(uint32_t id, bool create /* = true*/) { checkForgeEventId(id); if (create) { - g_scheduler().addEvent(300 * 1000, std::bind_front(&Game::makeFiendishMonster, this, 0, false)); + g_scheduler().addEvent(300 * 1000, std::bind_front(&Game::makeFiendishMonster, this, 0, false), "Game::makeFiendishMonster"); } } else { g_logger().warn("[Game::removeFiendishMonster] - Failed to remove a Fiendish Monster, error code: monster id not exist in the fiendish monsters map"); @@ -9573,7 +9606,7 @@ bool Game::removeFiendishMonster(uint32_t id, bool create /* = true*/) { } void Game::updateForgeableMonsters() { - g_scheduler().addEvent(EVENT_FORGEABLEMONSTERCHECKINTERVAL, std::bind_front(&Game::updateForgeableMonsters, this)); + g_scheduler().addEvent(EVENT_FORGEABLEMONSTERCHECKINTERVAL, std::bind_front(&Game::updateForgeableMonsters, this), "Game::updateForgeableMonsters"); forgeableMonsters.clear(); for (auto [monsterId, monster] : monsters) { auto monsterTile = monster->getTile(); @@ -9762,7 +9795,7 @@ void Game::playerCheckActivity(const std::string &playerName, int interval) { } } - g_scheduler().addEvent(1000, std::bind(&Game::playerCheckActivity, this, playerName, interval)); + g_scheduler().addEvent(1000, std::bind(&Game::playerCheckActivity, this, playerName, interval), "Game::playerCheckActivity"); } void Game::playerRewardChestCollect(uint32_t playerId, const Position &pos, uint16_t itemId, uint8_t stackPos, uint32_t maxMoveItems /* = 0*/) { diff --git a/src/game/game.hpp b/src/game/game.hpp index eef9a0ffc..047a7f474 100644 --- a/src/game/game.hpp +++ b/src/game/game.hpp @@ -9,7 +9,7 @@ #pragma once -#include "creatures/players/account/account.hpp" +#include "account/account.hpp" #include "creatures/combat/combat.hpp" #include "items/containers/container.hpp" #include "creatures/players/grouping/groups.hpp" @@ -23,7 +23,7 @@ #include "creatures/players/grouping/team_finder.hpp" #include "utils/wildcardtree.hpp" #include "items/items_classification.hpp" -#include "protobuf/appearances.pb.hpp" +#include "protobuf/appearances.pb.h" class ServiceManager; class Creature; @@ -177,7 +177,7 @@ class Game { ReturnValue internalMoveCreature(Creature &creature, Tile &toTile, uint32_t flags = 0); ReturnValue checkMoveItemToCylinder(Player* player, Cylinder* fromCylinder, Cylinder* toCylinder, Item* item, Position toPos); - ReturnValue internalMoveItem(Cylinder* fromCylinder, Cylinder* toCylinder, int32_t index, Item* item, uint32_t count, Item** internalMoveItem, uint32_t flags = 0, Creature* actor = nullptr, Item* tradeItem = nullptr); + ReturnValue internalMoveItem(Cylinder* fromCylinder, Cylinder* toCylinder, int32_t index, Item* item, uint32_t count, Item** movedItem, uint32_t flags = 0, Creature* actor = nullptr, Item* tradeItem = nullptr, bool checkTile = true); ReturnValue internalAddItem(Cylinder* toCylinder, Item* item, int32_t index = INDEX_WHEREEVER, uint32_t flags = 0, bool test = false); ReturnValue internalAddItem(Cylinder* toCylinder, Item* item, int32_t index, uint32_t flags, bool test, uint32_t &remainderCount); @@ -295,7 +295,7 @@ class Game { void playerWrapableItem(uint32_t playerId, const Position &pos, uint8_t stackPos, const uint16_t itemId); void playerWriteItem(uint32_t playerId, uint32_t windowTextId, const std::string &text); void playerBrowseField(uint32_t playerId, const Position &pos); - void playerSeekInContainer(uint32_t playerId, uint8_t containerId, uint16_t index); + void playerSeekInContainer(uint32_t playerId, uint8_t containerId, uint16_t index, uint8_t containerCategory); void playerUpdateHouseWindow(uint32_t playerId, uint8_t listId, uint32_t windowTextId, const std::string &text); void playerRequestTrade(uint32_t playerId, const Position &pos, uint8_t stackPos, uint32_t tradePlayerId, uint16_t itemId); void playerAcceptTrade(uint32_t playerId); @@ -650,7 +650,7 @@ class Game { bool playerYell(Player* player, const std::string &text); bool playerSpeakTo(Player* player, SpeakClasses type, const std::string &receiver, const std::string &text); void playerSpeakToNpc(Player* player, const std::string &text); - std::shared_ptr createPlayerTask(uint32_t delay, std::function f); + std::shared_ptr createPlayerTask(uint32_t delay, std::function f, std::string context) const; /** * Player wants to loot a corpse diff --git a/src/game/movement/position.hpp b/src/game/movement/position.hpp index ad6aa8ca8..2f79453eb 100644 --- a/src/game/movement/position.hpp +++ b/src/game/movement/position.hpp @@ -62,6 +62,11 @@ struct Position { static int32_t getDiagonalDistance(const Position &p1, const Position &p2) { return std::max(Position::getDistanceX(p1, p2), Position::getDistanceY(p1, p2)); } + static double getEuclideanDistance(const Position &p1, const Position &p2) { + int32_t dx = Position::getDistanceX(p1, p2); + int32_t dy = Position::getDistanceY(p1, p2); + return std::sqrt(dx * dx + dy * dy); + } static Direction getRandomDirection(); diff --git a/src/game/scheduling/dispatcher.cpp b/src/game/scheduling/dispatcher.cpp index 46efe9930..9f37393e3 100644 --- a/src/game/scheduling/dispatcher.cpp +++ b/src/game/scheduling/dispatcher.cpp @@ -21,17 +21,34 @@ Dispatcher &Dispatcher::getInstance() { return inject(); } -void Dispatcher::addTask(std::function f, uint32_t expiresAfterMs /* = 0*/) { - addTask(std::make_shared(std::move(f)), expiresAfterMs); +void Dispatcher::addTask(std::function f, std::string context) { + addTask(std::make_shared(std::move(f), std::move(context))); } -void Dispatcher::addTask(const std::shared_ptr task, uint32_t expiresAfterMs /* = 0*/) { +void Dispatcher::addTask(std::function f, std::string context, uint32_t expiresAfterMs) { + addTask(std::make_shared(std::move(f), std::move(context)), expiresAfterMs); +} + +void Dispatcher::addTask(const std::shared_ptr task) { + addTask(task, 0); +} + +void Dispatcher::addTask(const std::shared_ptr task, uint32_t expiresAfterMs) { + auto executeTask = [this, task]() { + std::lock_guard lockClass(threadSafetyMutex); + + if (task->hasTraceableContext()) { + g_logger().trace("Executing task {}.", task->getContext()); + } else { + g_logger().debug("Executing task {}.", task->getContext()); + } + + ++dispatcherCycle; + (*task)(); + }; + if (expiresAfterMs == 0) { - threadPool.addLoad([this, task]() { - std::lock_guard lockClass(threadSafetyMutex); - ++dispatcherCycle; - (*task)(); - }); + threadPool.addLoad(executeTask); return; }; @@ -44,16 +61,14 @@ void Dispatcher::addTask(const std::shared_ptr task, uint32_t expiresAfter return; } - g_logger().info("Task was not executed within {} ms, so it was cancelled.", expiresAfterMs); + g_logger().info("Task '{}' was not executed within {} ms, so it was cancelled.", task->getContext(), expiresAfterMs); }); - threadPool.addLoad([this, task, timer]() { - std::lock_guard lockClass(threadSafetyMutex); + threadPool.addLoad([timer, executeTask]() { if (timer->cancel() <= 0) { return; } - ++dispatcherCycle; - (*task)(); + executeTask(); }); } diff --git a/src/game/scheduling/dispatcher.hpp b/src/game/scheduling/dispatcher.hpp index 2d03e6399..2beda8b34 100644 --- a/src/game/scheduling/dispatcher.hpp +++ b/src/game/scheduling/dispatcher.hpp @@ -30,8 +30,11 @@ class Dispatcher { static Dispatcher &getInstance(); - void addTask(std::function f, uint32_t expiresAfterMs = 0); - void addTask(const std::shared_ptr task, uint32_t expiresAfterMs = 0); + void addTask(std::function f, std::string context); + void addTask(std::function f, std::string context, uint32_t expiresAfterMs); + + void addTask(const std::shared_ptr task); + void addTask(const std::shared_ptr task, uint32_t expiresAfterMs); [[nodiscard]] uint64_t getDispatcherCycle() const { return dispatcherCycle; diff --git a/src/game/scheduling/scheduler.cpp b/src/game/scheduling/scheduler.cpp index 99e46e1ea..4b351cd22 100644 --- a/src/game/scheduling/scheduler.cpp +++ b/src/game/scheduling/scheduler.cpp @@ -22,8 +22,8 @@ Scheduler &Scheduler::getInstance() { return inject(); } -uint64_t Scheduler::addEvent(uint32_t delay, std::function f) { - return addEvent(std::make_shared(std::move(f), delay)); +uint64_t Scheduler::addEvent(uint32_t delay, std::function f, std::string context) { + return addEvent(std::make_shared(std::move(f), std::move(context), delay)); } uint64_t Scheduler::addEvent(const std::shared_ptr task) { @@ -46,6 +46,12 @@ uint64_t Scheduler::addEvent(const std::shared_ptr task) { return; } + if (task->hasTraceableContext()) { + g_logger().trace("Dispatching scheduled task {}.", task->getContext()); + } else { + g_logger().debug("Dispatching scheduled task {}.", task->getContext()); + } + g_dispatcher().addTask(task); }); }); diff --git a/src/game/scheduling/scheduler.hpp b/src/game/scheduling/scheduler.hpp index 16fab7f5b..79fad1e77 100644 --- a/src/game/scheduling/scheduler.hpp +++ b/src/game/scheduling/scheduler.hpp @@ -29,7 +29,7 @@ class Scheduler { static Scheduler &getInstance(); - uint64_t addEvent(uint32_t delay, std::function f); + uint64_t addEvent(uint32_t delay, std::function f, std::string context); uint64_t addEvent(const std::shared_ptr task); void stopEvent(uint64_t eventId); @@ -37,7 +37,7 @@ class Scheduler { ThreadPool &threadPool; std::mutex threadSafetyMutex; std::atomic lastEventId { 0 }; - std::unordered_map eventIds; + phmap::flat_hash_map eventIds; }; constexpr auto g_scheduler = Scheduler::getInstance; diff --git a/src/game/scheduling/task.hpp b/src/game/scheduling/task.hpp index 3e8218cfe..1424679e8 100644 --- a/src/game/scheduling/task.hpp +++ b/src/game/scheduling/task.hpp @@ -12,8 +12,15 @@ class Task { public: // DO NOT allocate this class on the stack - Task(std::function &&f, uint32_t delay = 0) : - func(std::move(f)), delay(delay) { } + Task(std::function &&f, std::string context) : + context(std::move(context)), func(std::move(f)) { + assert(!this->context.empty() && "Context cannot be empty!"); + } + + Task(std::function &&f, std::string context, uint32_t delay) : + delay(delay), context(std::move(context)), func(std::move(f)) { + assert(!this->context.empty() && "Context cannot be empty!"); + } virtual ~Task() = default; void operator()() { @@ -32,8 +39,29 @@ class Task { return delay; } + std::string getContext() const { + return context; + } + + bool hasTraceableContext() const { + return std::set { + "Game::checkCreatures", + "Game::checkImbuements", + "Game::checkLight", + "Game::createFiendishMonsters", + "Game::createInfluencedMonsters", + "Game::updateForgeableMonsters", + "GlobalEvents::think", + "OutputMessagePool::sendAll", + "SpawnMonster::checkSpawnMonster", + "Webhook::run", + } + .contains(context); + } + private: uint32_t delay = 0; uint64_t eventId = 0; + std::string context {}; std::function func {}; }; diff --git a/src/io/functions/iologindata_load_player.cpp b/src/io/functions/iologindata_load_player.cpp index f141c87b0..39dcf910f 100644 --- a/src/io/functions/iologindata_load_player.cpp +++ b/src/io/functions/iologindata_load_player.cpp @@ -29,7 +29,7 @@ void IOLoginDataLoad::loadItems(ItemsMap &itemsMap, DBResult_ptr result, Player Item* item = Item::CreateItem(type, count); if (item) { if (!item->unserializeAttr(propStream)) { - g_logger().warn("[{}] - Failed to deserialize item attributes {}, from player {}, from account id {}", __FUNCTION__, item->getID(), player.getName(), player.getAccount()); + g_logger().warn("[{}] - Failed to deserialize item attributes {}, from player {}, from account id {}", __FUNCTION__, item->getID(), player.getName(), player.getAccountId()); savePlayer(&player); g_logger().info("[{}] - Deleting wrong item: {}", __FUNCTION__, item->getID()); delete item; @@ -37,7 +37,7 @@ void IOLoginDataLoad::loadItems(ItemsMap &itemsMap, DBResult_ptr result, Player } itemsMap[sid] = std::make_pair(item, pid); } else { - g_logger().warn("[{}] - Failed to create item of type {} for player {}, from account id {}", __FUNCTION__, type, player.getName(), player.getAccount()); + g_logger().warn("[{}] - Failed to create item of type {} for player {}, from account id {}", __FUNCTION__, type, player.getName(), player.getAccountId()); } } catch (const std::exception &e) { g_logger().warn("[{}] - Exception during the creation or deserialization of the item: {}", __FUNCTION__, e.what()); @@ -53,12 +53,7 @@ bool IOLoginDataLoad::preLoadPlayer(Player* player, const std::string &name) { Database &db = Database::getInstance(); std::ostringstream query; - query << "SELECT `id`, `account_id`, `group_id`, `deletion`, (SELECT `type` FROM `accounts` WHERE `accounts`.`id` = `account_id`) AS `account_type`"; - query << ", (SELECT `premdays` FROM `accounts` WHERE `accounts`.`id` = `account_id`) AS `premium_days`"; - query << ", (SELECT `lastday` FROM `accounts` WHERE `accounts`.`id` = `account_id`) AS `premium_last_day`"; - query << ", (SELECT `premdays_purchased` FROM `accounts` WHERE `accounts`.`id` = `account_id`) AS `premium_days_purchased`"; - query << ", (SELECT `creation` FROM `accounts` WHERE `accounts`.`id` = `account_id`) AS `creation_timestamp`"; - query << " FROM `players` WHERE `name` = " << db.escapeString(name); + query << "SELECT `id`, `account_id`, `group_id`, `deletion` FROM `players` WHERE `name` = " << db.escapeString(name); DBResult_ptr result = db.storeQuery(query.str()); if (!result) { return false; @@ -75,35 +70,33 @@ bool IOLoginDataLoad::preLoadPlayer(Player* player, const std::string &name) { return false; } player->setGroup(group); - player->accountNumber = result->getNumber("account_id"); - player->accountType = static_cast(result->getNumber("account_type")); - player->premiumDays = result->getNumber("premium_days"); - player->premiumLastDay = result->getNumber("premium_last_day"); - - /* - Loyalty system: - - If creation timestamp is 0, that means it's the first time the player is trying to login on this account. - - Since it's the first login, we must update the database manually. - - This should be handled by the account manager, but not all of then do it so we handle it by ourself. - */ - time_t creation = result->getNumber("creation_timestamp"); - int32_t premiumDays = result->getNumber("premium_days"); - int32_t premiumDaysPurchased = result->getNumber("premium_days_purchased"); - if (creation == 0) { - query.str(std::string()); - query << "UPDATE `accounts` SET `creation` = " << static_cast(time(nullptr)) << " WHERE `id` = " << player->accountNumber; - db.executeQuery(query.str()); - } - - // If the player has more premium days than he purchased, it means data existed before the loyalty system was implemented. - // Update premdays_purchased to the minimum acceptable value. - if (premiumDays > premiumDaysPurchased) { - query.str(std::string()); - query << "UPDATE `accounts` SET `premdays_purchased` = " << premiumDays << " WHERE `id` = " << player->accountNumber; - db.executeQuery(query.str()); - } - - player->loyaltyPoints = static_cast(std::ceil((static_cast(time(nullptr) - creation)) / 86400)) * g_configManager().getNumber(LOYALTY_POINTS_PER_CREATION_DAY) + + auto accountId = result->getNumber("account_id"); + if (!player->setAccount(accountId)) { + g_logger().error("Player {} has account id {} which doesn't exist", player->name, accountId); + return false; + } + + auto [coins, error] = player->account->getCoins(account::CoinType::COIN); + if (error != account::ERROR_NO) { + g_logger().error("Failed to get coins for player {}, error {}", player->name, static_cast(error)); + return false; + } + + player->coinBalance = coins; + + auto [transferableCoins, errorT] = player->account->getCoins(account::CoinType::TRANSFERABLE); + if (errorT != account::ERROR_NO) { + g_logger().error("Failed to get transferable coins for player {}, error {}", player->name, static_cast(errorT)); + return false; + } + + player->coinTransferableBalance = transferableCoins; + + uint32_t premiumDays = player->getAccount()->getPremiumRemainingDays(); + uint32_t premiumDaysPurchased = player->getAccount()->getPremiumDaysPurchased(); + + player->loyaltyPoints = player->getAccount()->getAccountAgeInDays() * g_configManager().getNumber(LOYALTY_POINTS_PER_CREATION_DAY) + (premiumDaysPurchased - premiumDays) * g_configManager().getNumber(LOYALTY_POINTS_PER_PREMIUM_DAY_SPENT) + premiumDaysPurchased * g_configManager().getNumber(LOYALTY_POINTS_PER_PREMIUM_DAY_PURCHASED); @@ -116,22 +109,12 @@ bool IOLoginDataLoad::loadPlayerFirst(Player* player, DBResult_ptr result) { return false; } - Database &db = Database::getInstance(); - - uint32_t accountId = result->getNumber("account_id"); - account::Account acc; - acc.SetDatabaseInterface(&db); - acc.LoadAccountDB(accountId); - - bool oldProtocol = g_configManager().getBoolean(OLD_PROTOCOL) && player->getProtocolVersion() < 1200; player->setGUID(result->getNumber("id")); player->name = result->getString("name"); - acc.GetID(&(player->accountNumber)); - acc.GetAccountType(&(player->accountType)); - acc.GetPremiumRemainingDays(&(player->premiumDays)); - acc.GetPremiumLastDay(&(player->premiumLastDay)); - acc.GetCoins(&(player->coinBalance)); - acc.GetTransferableCoins(&(player->coinTransferableBalance)); + + if (!player->getAccount()) { + player->setAccount(result->getNumber("account_id")); + } Group* group = g_game().groups.getGroup(result->getNumber("group_id")); if (!group) { @@ -148,6 +131,7 @@ bool IOLoginDataLoad::loadPlayerFirst(Player* player, DBResult_ptr result) { player->setBankBalance(result->getNumber("balance")); player->quickLootFallbackToMainContainer = result->getNumber("quickloot_fallback"); player->setSex(static_cast(result->getNumber("sex"))); + player->setPronoun(static_cast(result->getNumber("pronoun"))); player->level = std::max(1, result->getNumber("level")); player->soul = static_cast(result->getNumber("soul")); player->capacity = result->getNumber("cap") * 100; @@ -696,7 +680,7 @@ void IOLoginDataLoad::loadPlayerVip(Player* player, DBResult_ptr result) { Database &db = Database::getInstance(); std::ostringstream query; - query << "SELECT `player_id` FROM `account_viplist` WHERE `account_id` = " << player->getAccount(); + query << "SELECT `player_id` FROM `account_viplist` WHERE `account_id` = " << player->getAccountId(); if ((result = db.storeQuery(query.str()))) { do { player->addVIPInternal(result->getNumber("player_id")); diff --git a/src/io/io_bosstiary.cpp b/src/io/io_bosstiary.cpp index cb31ccec9..45a650765 100644 --- a/src/io/io_bosstiary.cpp +++ b/src/io/io_bosstiary.cpp @@ -100,6 +100,18 @@ void IOBosstiary::loadBoostedBoss() { return; } + query.str(std::string()); + query << "UPDATE `player_bosstiary` SET `bossIdSlotOne` = 0 WHERE `bossIdSlotOne` = " << bossId; + if (!database.executeQuery(query.str())) { + g_logger().error("[{}] Failed to reset players selected boss slot 1. (CODE 03)", __FUNCTION__); + } + + query.str(std::string()); + query << "UPDATE `player_bosstiary` SET `bossIdSlotTwo` = 0 WHERE `bossIdSlotTwo` = " << bossId; + if (!database.executeQuery(query.str())) { + g_logger().error("[{}] Failed to reset players selected boss slot 1. (CODE 03)", __FUNCTION__); + } + setBossBoostedName(bossName); setBossBoostedId(bossId); g_logger().info("Boosted boss: {}", bossName); diff --git a/src/io/iologindata.cpp b/src/io/iologindata.cpp index 41a9cc21e..3314cd5cf 100644 --- a/src/io/iologindata.cpp +++ b/src/io/iologindata.cpp @@ -16,73 +16,43 @@ #include "creatures/monsters/monster.hpp" #include "creatures/players/wheel/player_wheel.hpp" #include "io/ioprey.hpp" -#include "security/argon.hpp" -bool IOLoginData::authenticateAccountPassword(const std::string &accountIdentifier, const std::string &password, account::Account* account) { - if (account::ERROR_NO != account->LoadAccountDB(accountIdentifier)) { - g_logger().error("{} {} doesn't match any account.", account->getProtocolCompat() ? "Username" : "Email", accountIdentifier); +bool IOLoginData::gameWorldAuthentication(const std::string &accountDescriptor, const std::string &password, std::string &characterName, uint32_t &accountId, bool oldProtocol) { + account::Account account(accountDescriptor); + account.setProtocolCompat(oldProtocol); + + if (account::ERROR_NO != account.load()) { + g_logger().error("Couldn't load account [{}].", account.getDescriptor()); return false; } - std::string accountPassword; - account->GetPassword(&accountPassword); - - Argon2 argon2; - if (!argon2.argon(password.c_str(), accountPassword)) { - if (transformToSHA1(password) != accountPassword) { - g_logger().error("Password '{}' doesn't match any account", accountPassword); + if (g_configManager().getString(AUTH_TYPE) == "session") { + if (!account.authenticate()) { + return false; + } + } else { + if (!account.authenticate(password)) { return false; } } - return true; -} - -bool IOLoginData::authenticateAccountSession(const std::string &sessionId, account::Account* account) { - Database &db = Database::getInstance(); - std::ostringstream query; - query << "SELECT `account_id`, `expires` FROM `account_sessions` WHERE `id` = " << db.escapeString(transformToSHA1(sessionId)); - DBResult_ptr result = Database::getInstance().storeQuery(query.str()); - if (!result) { - g_logger().error("Session id {} not found in the database", sessionId); - return false; - } - uint32_t expires = result->getNumber("expires"); - if (expires < getTimeNow()) { - g_logger().error("Session id {} found, but it is expired", sessionId); + if (account::ERROR_NO != account.load()) { + g_logger().error("Failed to load account [{}]", accountDescriptor); return false; } - uint32_t accountId = result->getNumber("account_id"); - if (account::ERROR_NO != account->LoadAccountDB(accountId)) { - g_logger().error("Session id {} found account id {}, but it doesn't match any account.", sessionId, accountId); - return false; - } - - return true; -} -bool IOLoginData::gameWorldAuthentication(const std::string &accountIdentifier, const std::string &sessionOrPassword, std::string &characterName, uint32_t* accountId, bool oldProtocol) { - account::Account account; - account.setProtocolCompat(oldProtocol); - std::string authType = g_configManager().getString(AUTH_TYPE); - - if (authType == "session") { - if (!IOLoginData::authenticateAccountSession(sessionOrPassword, &account)) { - return false; - } - } else { // authType == "password" - if (!IOLoginData::authenticateAccountPassword(accountIdentifier, sessionOrPassword, &account)) { - return false; - } + auto [players, result] = account.getAccountPlayers(); + if (account::ERROR_NO != result) { + g_logger().error("Failed to load account [{}] players", accountDescriptor); + return false; } - account::Player player; - if (account::ERROR_NO != account.GetAccountPlayer(&player, characterName)) { - g_logger().error("Player not found or deleted for account."); + if (players[characterName] != 0) { + g_logger().error("Account [{}] player [{}] not found or deleted.", accountDescriptor, characterName); return false; } - account.GetID(accountId); + accountId = account.getID(); return true; } @@ -97,12 +67,6 @@ account::AccountType IOLoginData::getAccountType(uint32_t accountId) { return static_cast(result->getNumber("type")); } -void IOLoginData::setAccountType(uint32_t accountId, account::AccountType accountType) { - std::ostringstream query; - query << "UPDATE `accounts` SET `type` = " << static_cast(accountType) << " WHERE `id` = " << accountId; - Database::getInstance().executeQuery(query.str()); -} - void IOLoginData::updateOnlineStatus(uint32_t guid, bool login) { static phmap::flat_hash_map updateOnline; if (login && updateOnline.find(guid) != updateOnline.end() || guid <= 0) { @@ -414,25 +378,3 @@ void IOLoginData::removeVIPEntry(uint32_t accountId, uint32_t guid) { query << "DELETE FROM `account_viplist` WHERE `account_id` = " << accountId << " AND `player_id` = " << guid; Database::getInstance().executeQuery(query.str()); } - -void IOLoginData::addPremiumDays(Player* player, uint32_t addDays) { - std::ostringstream query; - time_t lastDay = player->getPremiumLastDay(); - query << "UPDATE `accounts` SET" - << "`premdays` = `premdays` + " << addDays - << ", `premdays_purchased` = `premdays_purchased` + " << addDays - << ", `lastday` = " << (((lastDay == 0 || lastDay < getTimeNow()) ? getTimeNow() : lastDay) + (addDays * 86400)) - << " WHERE `id` = " << player->getAccount(); - - Database::getInstance().executeQuery(query.str()); -} - -void IOLoginData::removePremiumDays(Player* player, uint32_t removeDays) { - std::ostringstream query; - uint32_t days = removeDays > player->premiumDays ? player->premiumDays : removeDays; - query << "UPDATE `accounts` SET" - << "`premdays` = `premdays` - " << days - << ", `lastday` = " << (player->getPremiumLastDay() - (days * 86400)) - << " WHERE `id` = " << player->getAccount(); - Database::getInstance().executeQuery(query.str()); -} diff --git a/src/io/iologindata.hpp b/src/io/iologindata.hpp index 0efc20447..baae9a57b 100644 --- a/src/io/iologindata.hpp +++ b/src/io/iologindata.hpp @@ -9,7 +9,7 @@ #pragma once -#include "creatures/players/account/account.hpp" +#include "account/account.hpp" #include "creatures/players/player.hpp" #include "database/database.hpp" @@ -17,11 +17,8 @@ using ItemBlockList = std::list>; class IOLoginData { public: - static bool authenticateAccountPassword(const std::string &accountIdentifier, const std::string &password, account::Account* account); - static bool authenticateAccountSession(const std::string &sessionId, account::Account* account); - static bool gameWorldAuthentication(const std::string &accountIdentifier, const std::string &sessionOrPassword, std::string &characterName, uint32_t* accountId, bool oldProcotol); + static bool gameWorldAuthentication(const std::string &accountDescriptor, const std::string &sessionOrPassword, std::string &characterName, uint32_t &accountId, bool oldProcotol); static account::AccountType getAccountType(uint32_t accountId); - static void setAccountType(uint32_t accountId, account::AccountType accountType); static void updateOnlineStatus(uint32_t guid, bool login); static bool loadPlayerById(Player* player, uint32_t id, bool disable = true); static bool loadPlayerByName(Player* player, const std::string &name, bool disable = true); @@ -39,9 +36,6 @@ class IOLoginData { static void editVIPEntry(uint32_t accountId, uint32_t guid, const std::string &description, uint32_t icon, bool notify); static void removeVIPEntry(uint32_t accountId, uint32_t guid); - static void addPremiumDays(Player* player, uint32_t addDays); - static void removePremiumDays(Player* player, uint32_t removeDays); - private: static bool savePlayerGuard(Player* player); }; diff --git a/src/io/iomarket.cpp b/src/io/iomarket.cpp index 3b32331e4..cf07aa04f 100644 --- a/src/io/iomarket.cpp +++ b/src/io/iomarket.cpp @@ -207,7 +207,7 @@ void IOMarket::checkExpiredOffers() { return; } - g_scheduler().addEvent(checkExpiredMarketOffersEachMinutes * 60 * 1000, IOMarket::checkExpiredOffers); + g_scheduler().addEvent(checkExpiredMarketOffersEachMinutes * 60 * 1000, IOMarket::checkExpiredOffers, __FUNCTION__); } uint32_t IOMarket::getPlayerOfferCount(uint32_t playerId) { diff --git a/src/io/iomarket.hpp b/src/io/iomarket.hpp index 12fbaf9be..f192acca5 100644 --- a/src/io/iomarket.hpp +++ b/src/io/iomarket.hpp @@ -11,6 +11,7 @@ #include "database/database.hpp" #include "declarations.hpp" +#include "lib/di/container.hpp" class IOMarket { using StatisticsMap = std::map>; diff --git a/src/items/bed.cpp b/src/items/bed.cpp index 71928b122..f166320a2 100644 --- a/src/items/bed.cpp +++ b/src/items/bed.cpp @@ -153,7 +153,7 @@ bool BedItem::sleep(Player* player) { g_game().addMagicEffect(player->getPosition(), CONST_ME_SLEEP); // logout player after he sees himself walk onto the bed and it change id - g_scheduler().addEvent(SCHEDULER_MINTICKS, std::bind(&ProtocolGame::logout, player->client, false, false)); + g_scheduler().addEvent(SCHEDULER_MINTICKS, std::bind(&ProtocolGame::logout, player->client, false, false), "ProtocolGame::logout"); // change self and partner's appearance updateAppearance(player); diff --git a/src/items/containers/container.cpp b/src/items/containers/container.cpp index 8c1683c47..fbe9486c3 100644 --- a/src/items/containers/container.cpp +++ b/src/items/containers/container.cpp @@ -16,8 +16,11 @@ Container::Container(uint16_t type) : Container(type, items[type].maxItems) { - if (getID() == ITEM_GOLD_POUCH) { + m_maxItems = static_cast(g_configManager().getNumber(MAX_CONTAINER_ITEM)); + if (getID() == ITEM_GOLD_POUCH || isStoreInbox()) { pagination = true; + m_maxItems = 2000; + maxSize = 32; } } @@ -229,10 +232,86 @@ std::ostringstream &Container::getContentDescription(std::ostringstream &os, boo return os; } +bool Container::isStoreInbox() const { + return getID() == ITEM_STORE_INBOX; +} + +bool Container::isStoreInboxFiltered() const { + auto attribute = getAttribute(ItemAttribute_t::STORE_INBOX_CATEGORY); + if (isStoreInbox() && !attribute.empty() && attribute != "All") { + return true; + } + + return false; +} + +std::deque Container::getStoreInboxFilteredItems() const { + const auto enumName = getAttribute(ItemAttribute_t::STORE_INBOX_CATEGORY); + ItemDeque storeInboxFilteredList; + if (isStoreInboxFiltered()) { + for (Item* item : getItemList()) { + auto itemId = item->getID(); + auto attribute = item->getCustomAttribute("unWrapId"); + uint16_t unWrapId = attribute ? static_cast(attribute->getInteger()) : 0; + if (unWrapId != 0) { + itemId = unWrapId; + } + const auto &itemType = Item::items.getItemType(itemId); + auto primaryType = toPascalCase(itemType.m_primaryType); + auto name = toPascalCase(enumName); + g_logger().debug("Get filtered items, primaty type {}, enum name {}", primaryType, name); + if (primaryType == name) { + storeInboxFilteredList.push_back(item); + } + } + } + + return storeInboxFilteredList; +} + +phmap::flat_hash_set Container::getStoreInboxValidCategories() const { + phmap::flat_hash_set validCategories; + for (const auto &item : itemlist) { + auto itemId = item->getID(); + auto attribute = item->getCustomAttribute("unWrapId"); + uint16_t unWrapId = attribute ? static_cast(attribute->getInteger()) : 0; + if (unWrapId != 0) { + itemId = unWrapId; + } + const auto &itemType = Item::items.getItemType(itemId); + auto convertedString = toPascalCase(itemType.m_primaryType); + g_logger().debug("Store item '{}', primary type {}", itemId, convertedString); + auto category = magic_enum::enum_cast(convertedString); + if (category.has_value()) { + g_logger().debug("Adding valid category {}", static_cast(category.value())); + validCategories.insert(category.value()); + } + } + + return validCategories; +} + +Item* Container::getFilteredItemByIndex(size_t index) const { + const auto &filteredItems = getStoreInboxFilteredItems(); + if (index >= filteredItems.size()) { + return nullptr; + } + + auto item = filteredItems[index]; + + auto it = std::find(itemlist.begin(), itemlist.end(), item); + if (it == itemlist.end()) { + return nullptr; + } + + return *it; +} + Item* Container::getItemByIndex(size_t index) const { if (index >= size()) { return nullptr; } + return itemlist[index]; } @@ -344,49 +423,43 @@ ReturnValue Container::queryAdd(int32_t addIndex, const Thing &addThing, uint32_ } const Cylinder* cylinder = getParent(); - if (!hasBitSet(FLAG_NOLIMIT, flags)) { - while (cylinder) { - if (cylinder == &addThing) { - return RETURNVALUE_THISISIMPOSSIBLE; - } - - if (dynamic_cast(cylinder)) { - return RETURNVALUE_CONTAINERNOTENOUGHROOM; - } - - cylinder = cylinder->getParent(); + auto noLimit = hasBitSet(FLAG_NOLIMIT, flags); + while (cylinder) { + if (cylinder == &addThing) { + return RETURNVALUE_THISISIMPOSSIBLE; } - - if (addIndex == INDEX_WHEREEVER && size() >= capacity() && !hasPagination()) { + const Container* container = cylinder->getContainer(); + if (!noLimit && container && container->isInbox()) { return RETURNVALUE_CONTAINERNOTENOUGHROOM; } - } else { - while (cylinder) { - if (cylinder == &addThing) { - return RETURNVALUE_THISISIMPOSSIBLE; - } - - cylinder = cylinder->getParent(); + const Cylinder* parent = cylinder->getParent(); + if (cylinder == parent) { + g_logger().error("Container::queryAdd: parent == cylinder. Preventing infinite loop."); + return RETURNVALUE_NOTPOSSIBLE; } + cylinder = parent; + } + + if (!noLimit && addIndex == INDEX_WHEREEVER && size() >= capacity() && !hasPagination()) { + return RETURNVALUE_CONTAINERNOTENOUGHROOM; } if (const Container* topParentContainer = getTopParentContainer()) { - uint32_t maxItem = static_cast(g_configManager().getNumber(MAX_ITEM)); if (const Container* addContainer = item->getContainer()) { uint32_t addContainerCount = addContainer->getContainerHoldingCount() + 1; uint32_t maxContainer = static_cast(g_configManager().getNumber(MAX_CONTAINER)); if (addContainerCount + topParentContainer->getContainerHoldingCount() > maxContainer) { - return RETURNVALUE_NOTPOSSIBLE; + return RETURNVALUE_CONTAINERISFULL; } uint32_t addItemCount = addContainer->getItemHoldingCount() + 1; - if (addItemCount + topParentContainer->getItemHoldingCount() > maxItem) { - return RETURNVALUE_NOTPOSSIBLE; + if (addItemCount + topParentContainer->getItemHoldingCount() > m_maxItems) { + return RETURNVALUE_CONTAINERISFULL; } } - if (topParentContainer->getItemHoldingCount() + 1 > maxItem) { - return RETURNVALUE_NOTPOSSIBLE; + if (topParentContainer->getItemHoldingCount() + 1 > m_maxItems) { + return RETURNVALUE_CONTAINERISFULL; } } diff --git a/src/items/containers/container.hpp b/src/items/containers/container.hpp index 30bc40032..b58929b36 100644 --- a/src/items/containers/container.hpp +++ b/src/items/containers/container.hpp @@ -115,6 +115,11 @@ class Container : public Item, public Cylinder { bool hasParent() const; void addItem(Item* item); StashContainerList getStowableItems() const; + bool isStoreInbox() const; + bool isStoreInboxFiltered() const; + std::deque getStoreInboxFilteredItems() const; + phmap::flat_hash_set getStoreInboxValidCategories() const; + Item* getFilteredItemByIndex(size_t index) const; Item* getItemByIndex(size_t index) const; bool isHoldingItem(const Item* item) const; bool isHoldingItemWithId(const uint16_t id) const; @@ -168,6 +173,7 @@ class Container : public Item, public Cylinder { protected: std::ostringstream &getContentDescription(std::ostringstream &os, bool oldProtocol) const; + uint32_t m_maxItems; uint32_t maxSize; uint32_t totalWeight = 0; ItemDeque itemlist; diff --git a/src/items/containers/mailbox/mailbox.cpp b/src/items/containers/mailbox/mailbox.cpp index 248c5c853..af3b79eae 100644 --- a/src/items/containers/mailbox/mailbox.cpp +++ b/src/items/containers/mailbox/mailbox.cpp @@ -80,6 +80,16 @@ bool Mailbox::sendItem(Item* item) const { return false; } + if (item && item->getContainer() && item->getTile()) { + SpectatorHashSet spectators; + g_game().map.getSpectators(spectators, item->getTile()->getPosition(), false, true); + for (Creature* spectator : spectators) { + if (spectator && spectator->getPlayer()) { + spectator->getPlayer()->autoCloseContainers(item->getContainer()); + } + } + } + Player* player = g_game().getPlayerByName(receiver, true); std::string writer; time_t date = time(0); diff --git a/src/items/decay/decay.cpp b/src/items/decay/decay.cpp index 0aa440832..0dbf2fa0f 100644 --- a/src/items/decay/decay.cpp +++ b/src/items/decay/decay.cpp @@ -14,11 +14,11 @@ #include "game/scheduling/scheduler.hpp" void Decay::startDecay(Item* item) { - if (!item || item->getLoadedFromMap()) { + if (!item) { return; } - auto decayState = item->getDecaying(); + const auto decayState = item->getDecaying(); if (decayState == DECAYING_STOPPING || (!item->canDecay() && decayState == DECAYING_TRUE)) { stopDecay(item); return; @@ -41,11 +41,11 @@ void Decay::startDecay(Item* item) { int64_t timestamp = OTSYS_TIME() + duration; if (decayMap.empty()) { - eventId = g_scheduler().addEvent(std::max(SCHEDULER_MINTICKS, duration), std::bind(&Decay::checkDecay, this)); + eventId = g_scheduler().addEvent(std::max(SCHEDULER_MINTICKS, duration), std::bind(&Decay::checkDecay, this), "Decay::checkDecay"); } else { if (timestamp < decayMap.begin()->first) { g_scheduler().stopEvent(eventId); - eventId = g_scheduler().addEvent(std::max(SCHEDULER_MINTICKS, duration), std::bind(&Decay::checkDecay, this)); + eventId = g_scheduler().addEvent(std::max(SCHEDULER_MINTICKS, duration), std::bind(&Decay::checkDecay, this), "Decay::checkDecay"); } } @@ -132,7 +132,7 @@ void Decay::checkDecay() { } if (it != end) { - eventId = g_scheduler().addEvent(std::max(SCHEDULER_MINTICKS, static_cast(it->first - timestamp)), std::bind(&Decay::checkDecay, this)); + eventId = g_scheduler().addEvent(std::max(SCHEDULER_MINTICKS, static_cast(it->first - timestamp)), std::bind(&Decay::checkDecay, this), __FUNCTION__); } } @@ -176,7 +176,7 @@ void Decay::internalDecayItem(Item* item) { } g_game().transformItem(item, static_cast(it.decayTo)); } else { - if (item->getLoadedFromMap()) { + if (item->isLoadedFromMap()) { return; } diff --git a/src/items/functions/item/attribute.hpp b/src/items/functions/item/attribute.hpp index 20cf43694..4a68cc0ec 100644 --- a/src/items/functions/item/attribute.hpp +++ b/src/items/functions/item/attribute.hpp @@ -57,6 +57,7 @@ class ItemAttributeHelper { case ItemAttribute_t::PLURALNAME: case ItemAttribute_t::SPECIAL: case ItemAttribute_t::LOOTMESSAGE_SUFFIX: + case ItemAttribute_t::STORE_INBOX_CATEGORY: return true; default: return false; diff --git a/src/items/functions/item/item_parse.cpp b/src/items/functions/item/item_parse.cpp index b3324f8dd..2172326f0 100644 --- a/src/items/functions/item/item_parse.cpp +++ b/src/items/functions/item/item_parse.cpp @@ -56,7 +56,6 @@ void ItemParse::initParse(const std::string &tmpStrValue, pugi::xml_node attribu ItemParse::parseMagicLevelPoint(tmpStrValue, valueAttribute, itemType); ItemParse::parseFieldAbsorbPercent(tmpStrValue, valueAttribute, itemType); ItemParse::parseAbsorbPercent(tmpStrValue, valueAttribute, itemType); - ItemParse::parseSupressDrunk(tmpStrValue, valueAttribute, itemType); ItemParse::parseField(tmpStrValue, attributeNode, valueAttribute, itemType); ItemParse::parseReplaceable(tmpStrValue, valueAttribute, itemType); @@ -73,6 +72,7 @@ void ItemParse::initParse(const std::string &tmpStrValue, pugi::xml_node attribu ItemParse::parseCleavePercent(tmpStrValue, valueAttribute, itemType); ItemParse::parseReflectDamage(tmpStrValue, valueAttribute, itemType); ItemParse::parseTransformOnUse(tmpStrValue, valueAttribute, itemType); + ItemParse::parsePrimaryType(tmpStrValue, valueAttribute, itemType); } void ItemParse::parseDummyRate(pugi::xml_node attributeNode, ItemType &itemType) { @@ -940,3 +940,9 @@ void ItemParse::parseTransformOnUse(const std::string_view &tmpStrValue, pugi::x itemType.m_transformOnUse = pugi::cast(valueAttribute.value()); } } + +void ItemParse::parsePrimaryType(const std::string_view &tmpStrValue, pugi::xml_attribute valueAttribute, ItemType &itemType) { + if (tmpStrValue == "primarytype") { + itemType.m_primaryType = asLowerCaseString(valueAttribute.as_string()); + } +} diff --git a/src/items/functions/item/item_parse.hpp b/src/items/functions/item/item_parse.hpp index 28a8e71fc..510129df9 100644 --- a/src/items/functions/item/item_parse.hpp +++ b/src/items/functions/item/item_parse.hpp @@ -155,6 +155,7 @@ const phmap::flat_hash_map ItemParseAttribut { "cleavepercent", ITEM_PARSE_CLEAVEPERCENT }, { "reflectdamage", ITEM_PARSE_REFLECTDAMAGE }, { "reflectpercentall", ITEM_PARSE_REFLECTPERCENTALL }, + { "primarytype", ITEM_PARSE_PRIMARYTYPE }, }; const phmap::flat_hash_map ItemTypesMap = { @@ -308,6 +309,7 @@ class ItemParse : public Items { static void parseCleavePercent(const std::string &tmpStrValue, pugi::xml_attribute valueAttribute, ItemType &itemType); static void parseReflectDamage(const std::string &tmpStrValue, pugi::xml_attribute valueAttribute, ItemType &itemType); static void parseTransformOnUse(const std::string_view &tmpStrValue, pugi::xml_attribute valueAttribute, ItemType &itemType); + static void parsePrimaryType(const std::string_view &tmpStrValue, pugi::xml_attribute valueAttribute, ItemType &itemType); private: // Parent of the function: static void parseField diff --git a/src/items/item.cpp b/src/items/item.cpp index a33ce1c39..f38ac6c9e 100644 --- a/src/items/item.cpp +++ b/src/items/item.cpp @@ -794,6 +794,17 @@ Attr_ReadValue Item::readAttr(AttrTypes_t attr, PropStream &propStream) { break; } + case ATTR_STORE_INBOX_CATEGORY: { + std::string category; + if (!propStream.readString(category)) { + g_logger().error("[{}] failed to read store inbox category from item {}", __FUNCTION__, getName()); + return ATTR_READ_ERROR; + } + + setAttribute(ItemAttribute_t::STORE_INBOX_CATEGORY, category); + break; + } + default: return ATTR_READ_ERROR; } @@ -954,6 +965,10 @@ void Item::serializeAttr(PropWriteStream &propWriteStream) const { propWriteStream.write(ATTR_AMOUNT); propWriteStream.write(getAttribute(AMOUNT)); } + if (hasAttribute(STORE_INBOX_CATEGORY)) { + propWriteStream.write(ATTR_STORE_INBOX_CATEGORY); + propWriteStream.writeString(getString(ItemAttribute_t::STORE_INBOX_CATEGORY)); + } // Serialize custom attributes, only serialize if the map not is empty if (hasCustomAttribute()) { @@ -1006,8 +1021,9 @@ bool Item::canBeMoved() const { } void Item::checkDecayMapItemOnMove() { - if (getDuration() > 0 && getLoadedFromMap() && canBeMoved()) { - setLoadedFromMap(false); + if (getDuration() > 0 && isDecayDisabled() && canBeMoved()) { + decayDisabled = false; + loadedFromMap = false; startDecaying(); } } @@ -3033,7 +3049,7 @@ void Item::addUniqueId(uint16_t uniqueId) { } bool Item::canDecay() const { - if (isRemoved()) { + if (isRemoved() || isDecayDisabled()) { return false; } diff --git a/src/items/item.hpp b/src/items/item.hpp index 2d4c3a5a4..b54b47411 100644 --- a/src/items/item.hpp +++ b/src/items/item.hpp @@ -465,6 +465,9 @@ class Item : virtual public Thing, public ItemProperties { bool isWrapable() const { return items[id].wrapable && items[id].wrapableTo; } + bool isAmmo() const { + return items[id].isAmmo(); + } bool hasWalkStack() const { return items[id].walkStack; } @@ -487,6 +490,10 @@ class Item : virtual public Thing, public ItemProperties { return isBlocking() && isAlwaysOnTop() && !items[id].hasHeight; } + bool isDecayDisabled() const { + return decayDisabled; + } + const std::string &getName() const { if (hasAttribute(ItemAttribute_t::NAME)) { return getString(ItemAttribute_t::NAME); @@ -565,13 +572,10 @@ class Item : virtual public Thing, public ItemProperties { Item* transform(uint16_t itemId, uint16_t itemCount = -1); - bool getLoadedFromMap() const { + bool isLoadedFromMap() const { return loadedFromMap; } - void setLoadedFromMap(bool value) { - loadedFromMap = value; - } bool isCleanable() const { return !loadedFromMap && canRemove() && isPickupable() && !hasAttribute(ItemAttribute_t::UNIQUEID) && !hasAttribute(ItemAttribute_t::ACTIONID); } @@ -708,6 +712,7 @@ class Item : virtual public Thing, public ItemProperties { bool loadedFromMap = false; bool isLootTrackeable = false; + bool decayDisabled = false; private: void setImbuement(uint8_t slot, uint16_t imbuementId, uint32_t duration); @@ -715,6 +720,7 @@ class Item : virtual public Thing, public ItemProperties { std::string getWeightDescription(uint32_t weight) const; friend class Decay; + friend class MapCache; }; using ItemList = std::list; diff --git a/src/items/items.cpp b/src/items/items.cpp index 6611af095..986f2b272 100644 --- a/src/items/items.cpp +++ b/src/items/items.cpp @@ -176,6 +176,7 @@ void Items::loadFromProtobuf() { iType.clockExpire = object.flags().clockexpire(); iType.expire = object.flags().expire(); iType.expireStop = object.flags().expirestop(); + iType.isWrapKit = object.flags().wrapkit(); if (!iType.name.empty()) { nameToItems.insert({ asLowerCaseString(iType.name), diff --git a/src/items/items.hpp b/src/items/items.hpp index 09dc637ad..b21dbc7e4 100644 --- a/src/items/items.hpp +++ b/src/items/items.hpp @@ -159,6 +159,9 @@ class ItemType { bool isBed() const { return (type == ITEM_TYPE_BED); } + bool isWrappable() const { + return (wrapableTo > 0); + } bool isRune() const { return (type == ITEM_TYPE_RUNE); } @@ -171,6 +174,9 @@ class ItemType { bool isQuiver() const { return (type == ITEM_TYPE_QUIVER); } + bool isAmmo() const { + return (type == ITEM_TYPE_AMMO); + } bool isLadder() const { return (type == ITEM_TYPE_LADDER); } @@ -233,6 +239,7 @@ class ItemType { std::string description; std::string runeSpellName; std::string vocationString; + std::string m_primaryType; std::unique_ptr abilities; std::unique_ptr conditionDamage; @@ -334,6 +341,7 @@ class ItemType { bool isCorpse = false; bool loaded = false; bool spellbook = false; + bool isWrapKit = false; }; class Items { diff --git a/src/items/items_definitions.hpp b/src/items/items_definitions.hpp index 85dee43bf..8b54fa679 100644 --- a/src/items/items_definitions.hpp +++ b/src/items/items_definitions.hpp @@ -60,6 +60,7 @@ enum ReturnValue { RETURNVALUE_CANNOTPICKUP, RETURNVALUE_THISISIMPOSSIBLE, RETURNVALUE_DEPOTISFULL, + RETURNVALUE_CONTAINERISFULL, RETURNVALUE_CREATUREDOESNOTEXIST, RETURNVALUE_CANNOTUSETHISOBJECT, RETURNVALUE_PLAYERWITHTHISNAMEISNOTONLINE, @@ -234,6 +235,7 @@ enum AttrTypes_t { ATTR_AMOUNT = 39, ATTR_TIER = 40, ATTR_CUSTOM = 41, + ATTR_STORE_INBOX_CATEGORY = 42, // Always the last ATTR_NONE = 0 @@ -261,6 +263,130 @@ enum ImbuementTypes_t : int64_t { IMBUEMENT_INCREASE_CAPACITY = 17 }; +enum class ContainerCategory_t : uint8_t { + All, + Ammunition, + AmuletsAndNecklaces, + Animals, + Annelids, + Arachnids, + Armors, + ArtificialTiles, + AstralShapers, + AttackRunes, + AxeWeapons, + Bats, + Bears, + Birds, + BlessingCharms, + Blobs, + Books, + Boots, + Bushes, + Cactuses, + Canines, + Casks, + Closets, + ClothingAccessories, + ClubWeapons, + Coffins, + Constructions, + Containers, + ContestPrizes, + CreatureProducts, + Decoration, + Demons, + DistanceWeapons, + DocumentsAndPapers, + DollsAndBears, + Doors, + Dragons, + Dreamhaunters, + Dropdowns, + EnchantedItems, + EventCreatures, + ExerciseWeapons, + FansiteItems, + Ferns, + Fields, + Flags, + FloorDecorations, + FloraAndMinerals, + Flowers, + FluidContainers, + Food, + Furniture, + GameTokens, + Ghosts, + Glires, + Grass, + HealingRunes, + Helmets, + HiveBorn, + Illumination, + Keys, + KitchenTools, + Ladders, + Legs, + LightSources, + Liquids, + MachinesObjects, + Machines, + MagicalItems, + Metals, + Mollusks, + Mushrooms, + MusicalInstruments, + NaturalProducts, + NaturalTiles, + OtherItems, + Outlaws, + PaintingEquipment, + PartyItems, + Pillars, + PlantsAndHerbs, + Plants, + Portals, + QuestItems, + QuestObjects, + Quivers, + Refuse, + Remains, + Rings, + Rocks, + Rods, + Rubbish, + Shields, + ShrinesAndAltars, + Signs, + Skeletons, + Spellbooks, + Stairs, + Statues, + SupportRunes, + SwordWeapons, + Tables, + TamingItems, + Teleporters, + ToolsObjects, + Tools, + TortureInstruments, + TournamentRewards, + TrainingWeapons, + Transportation, + Traps, + Trees, + Trophies, + UndeadHumanoids, + Ungulates, + Utilities, + Valuables, + WallHangings, + Walls, + Wands, + Windows +}; + enum SlotPositionBits : uint32_t { SLOTP_WHEREEVER = 0xFFFFFFFF, SLOTP_HEAD = 1 << 0, @@ -465,6 +591,7 @@ enum ItemParseAttributes_t { ITEM_PARSE_CLEAVEPERCENT, ITEM_PARSE_REFLECTPERCENTALL, ITEM_PARSE_REFLECTDAMAGE, + ITEM_PARSE_PRIMARYTYPE, }; struct ImbuementInfo { diff --git a/src/kv/CMakeLists.txt b/src/kv/CMakeLists.txt new file mode 100644 index 000000000..71f8a18b6 --- /dev/null +++ b/src/kv/CMakeLists.txt @@ -0,0 +1,5 @@ +target_sources(${PROJECT_NAME}_lib PRIVATE + value_wrapper.cpp + kv.cpp + kv_sql.cpp +) diff --git a/src/kv/README.md b/src/kv/README.md new file mode 100644 index 000000000..6c2349572 --- /dev/null +++ b/src/kv/README.md @@ -0,0 +1,142 @@ +# KV Library + +## Overview + +The Canary KV Library is designed to offer a simple, efficient, persistent, and thread-safe key-value store. It's an abstraction layer that can support various backends (currently, only MySQL is supported). The library provides features such as scoped access to stored values, LRU caching, and type safety. Additionally, it includes a Lua API for easy integration into Lua-based applications. + +## Features + +- Thread-safe Operations: Multi-threaded environment friendly. +- Pluggable Backends: Support for various storage backends. +- Scoped Access: Organization-friendly scoped key-value pairs. +- LRU Caching: Cache management using LRU strategy. +- Strongly Typed: Type-safe value storage. +- Lua API Support: Manipulate KV store via Lua scripts. + +## C++ API + +### Initialization + +```cpp +#include + +// In your class constructor +MyClass(KVStore &kv) : kv(kv) {} + +// Or use the global singleton +KVStore &kv = g_kv(); +``` + +### Basic Usage + +```cpp +// Set an integer value +kv.set("age", 30); + +// Get an integer value +int age = kv.get("age"); +``` + +### Scoped Access + +```cpp +// Create a scoped KV store +auto scope = kv.scoped("raids"); + +// Set and get values in the scoped KV +scope->set("last-occurrence", getTimeNow()); +int lastOccurrence = scope->get("last-occurrence"); +``` + +### Nested Scopes + +```cpp +// Create a scoped KV store +auto scope = kv.scoped("raids")->scoped("raid-123"); +scope->set("last-occurrence", getTimeNow()); +int lastOccurrence = scope->get("last-occurrence"); +``` + +### Player Scope + +```cpp +// Create a player-scoped KV store +auto player = g_game().getPlayerById(123); +auto playerKV = player->kv(); +playerKV->set("coins", 100); +``` + +### Complex Types + +```cpp +// arrays +kv.set("some-array", {1, 2, 3}); +auto someArray = kv.get("some-array"); + +// maps +kv.set("some-map", {{"a", 1}, {"b", 2}, {"c", 3}}); +auto someMap = kv.get("some-map"); + +// nested maps/arrays with non-uniform types +kv.set("some-nested", {{"a", {1, "string", 3}}, {"b", {"hehe", 5, 6}}}); +auto someNested = kv.get("some-nested"); +``` + +## Lua API + +### Error Handling + +Errors are logged and return nil. Always check for nil when using kv.get(). + +### Basic Usage + +```lua +-- Set and get an integer value +kv.set("age", 30) +local age = kv.get("age") +``` + +### Scoped Access + +```lua +-- Create a scoped KV store +local scope = kv.scoped("raids") + +-- Set and get values in the scoped KV +scope.set("last-occurrence", getTimeNow()) +local lastOccurrence = scope:get("last-occurrence") +``` + +### Nested Scopes + +```lua +-- Create a scoped KV store +local scope = kv.scoped("raids"):scoped("raid-123") +scope:set("last-occurrence", getTimeNow()) +local lastOccurrence = scope:get("last-occurrence") +``` + +### Player Scope + +```lua +-- Create a player-scoped KV store +local player = Player(123) +local playerKV = player:kv() +playerKV:set("coins", 100) +``` + +### Complex Types + +```lua +-- arrays +kv.set("some-array", {1, 2, 3}) +local someArray = kv.get("some-array") + +-- maps +kv.set("some-map", {{"a", 1}, {"b", 2}, {"c", 3}}) +local someMap = kv.get("some-map") + +-- nested maps/arrays with non-uniform types +kv.set("some-nested", {{"a", {1, "string", 3}}, {"b", {"hehe", 5, 6}}}) +local someNested = kv.get("some-nested") +``` diff --git a/src/kv/kv.cpp b/src/kv/kv.cpp new file mode 100644 index 000000000..812b68492 --- /dev/null +++ b/src/kv/kv.cpp @@ -0,0 +1,70 @@ +/** + * Canary - A free and open-source MMORPG server emulator + * Copyright (©) 2019-2022 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 "kv/kv.hpp" +#include "lib/di/container.hpp" +#include "utils/tools.hpp" + +KVStore &KVStore::getInstance() { + return inject(); +} + +void KVStore::set(const std::string &key, const std::initializer_list &init_list) { + ValueWrapper wrappedInitList(init_list); + set(key, wrappedInitList); +} + +void KVStore::set(const std::string &key, const std::initializer_list> &init_list) { + ValueWrapper wrappedInitList(init_list); + set(key, wrappedInitList); +} + +void KVStore::set(const std::string &key, const ValueWrapper &value) { + std::lock_guard lock(mutex_); + return setLocked(key, value); +} + +void KVStore::setLocked(const std::string &key, const ValueWrapper &value) { + logger.debug("KVStore::set({})", key); + auto it = store_.find(key); + if (it != store_.end()) { + it->second.first = value; + lruQueue_.splice(lruQueue_.begin(), lruQueue_, it->second.second); + } else { + if (store_.size() >= MAX_SIZE) { + logger.debug("KVStore::set() - MAX_SIZE reached, removing last element"); + auto last = lruQueue_.end(); + last--; + save(*last, store_[*last].first); + store_.erase(*last); + lruQueue_.pop_back(); + } + + lruQueue_.push_front(key); + store_.try_emplace(key, std::make_pair(value, lruQueue_.begin())); + } +} + +std::optional KVStore::get(const std::string &key, bool forceLoad /*= false */) { + logger.debug("KVStore::get({})", key); + std::lock_guard lock(mutex_); + if (forceLoad || !store_.contains(key)) { + auto value = load(key); + if (value) { + setLocked(key, *value); + } + return value; + } + + auto &[value, timestamp] = store_[key]; + lruQueue_.splice(lruQueue_.begin(), lruQueue_, timestamp); + return value; +} diff --git a/src/kv/kv.hpp b/src/kv/kv.hpp new file mode 100644 index 000000000..27c61751b --- /dev/null +++ b/src/kv/kv.hpp @@ -0,0 +1,150 @@ +/** + * Canary - A free and open-source MMORPG server emulator + * Copyright (©) 2019-2022 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 +#include +#include +#include +#include + +#include "lib/logging/logger.hpp" +#include "kv/value_wrapper.hpp" + +class KVStore { +public: + static constexpr size_t MAX_SIZE = 10000; + + static KVStore &getInstance(); + + explicit KVStore(Logger &logger) : + logger(logger) { } + virtual ~KVStore() = default; + + template + void set(const std::string &key, const std::vector &vec); + virtual void set(const std::string &key, const std::initializer_list &init_list); + virtual void set(const std::string &key, const std::initializer_list> &init_list); + virtual void set(const std::string &key, const ValueWrapper &value); + + virtual std::optional get(const std::string &key, bool forceLoad = false); + + template + T get(const std::string &key, bool forceLoad = false); + + virtual bool saveAll() { + return true; + } + + template + std::shared_ptr scoped(const T &scope); + + friend class ScopedKV; + + void flush() { + saveAll(); + store_.clear(); + } + +protected: + phmap::parallel_flat_hash_map::iterator>> getStore() { + std::scoped_lock lock(mutex_); + phmap::parallel_flat_hash_map::iterator>> copy; + for (const auto &[key, value] : store_) { + copy.try_emplace(key, value); + } + return copy; + } + virtual std::optional load(const std::string &key) = 0; + virtual bool save(const std::string &key, const ValueWrapper &value) = 0; + Logger &logger; + +private: + void setLocked(const std::string &key, const ValueWrapper &value); + + phmap::parallel_flat_hash_map::iterator>> store_; + std::list lruQueue_; + std::mutex mutex_; +}; + +template +void KVStore::set(const std::string &key, const std::vector &vec) { + ValueWrapper wrapped(vec); + set(key, wrapped); +} + +template +T KVStore::get(const std::string &key, bool forceLoad /*= false */) { + auto optValue = get(key, forceLoad); + if (optValue.has_value()) { + return optValue->get(); + } + return T {}; +} + +class ScopedKV final : public KVStore { +public: + ScopedKV(KVStore &parentKV, const std::string &prefix) : + KVStore(parentKV.logger), parentKV_(parentKV), prefix_(prefix) { } + + template + void set(const std::string &key, const std::vector &vec) { + parentKV_.set(buildKey(key), vec); + } + void set(const std::string &key, const std::initializer_list &init_list) override { + parentKV_.set(buildKey(key), init_list); + } + void set(const std::string &key, const std::initializer_list> &init_list) override { + parentKV_.set(buildKey(key), init_list); + } + void set(const std::string &key, const ValueWrapper &value) override { + parentKV_.set(buildKey(key), value); + } + + std::optional get(const std::string &key, bool forceLoad = false) override { + return parentKV_.get(buildKey(key), forceLoad); + } + + template + T get(const std::string &key, bool forceLoad = false) { + auto optValue = get(key, forceLoad); + if (optValue.has_value()) { + return optValue->get(); + } + return T {}; + } + + bool saveAll() override { + return parentKV_.saveAll(); + } + +protected: + std::optional load(const std::string &key) override { + return parentKV_.load(buildKey(key)); + } + bool save(const std::string &key, const ValueWrapper &value) override { + return parentKV_.save(buildKey(key), value); + } + +private: + std::string buildKey(const std::string &key) const { + return prefix_ + "." + key; + } + + KVStore &parentKV_; + std::string prefix_; +}; + +template +std::shared_ptr KVStore::scoped(const T &scope) { + return std::make_shared(*this, fmt::format("{}", scope)); +} + +constexpr auto g_kv = KVStore::getInstance; diff --git a/src/kv/kv_sql.cpp b/src/kv/kv_sql.cpp new file mode 100644 index 000000000..d73bb5912 --- /dev/null +++ b/src/kv/kv_sql.cpp @@ -0,0 +1,74 @@ +/** + * Canary - A free and open-source MMORPG server emulator + * Copyright (©) 2019-2022 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 +#include + +#include "kv/kv_sql.hpp" +#include "kv/value_wrapper_proto.hpp" +#include "protobuf/kv.pb.h" +#include "utils/tools.hpp" + +std::optional KVSQL::load(const std::string &key) { + auto query = fmt::format("SELECT `key_name`, `timestamp`, `value` FROM `kv_store` WHERE `key_name` = {}", db.escapeString(key)); + auto result = db.storeQuery(query); + if (result == nullptr) { + return std::nullopt; + } + + unsigned long size; + auto data = result->getStream("value", size); + if (data == nullptr) { + return std::nullopt; + } + + ValueWrapper valueWrapper; + auto timestamp = result->getNumber("timestamp"); + Canary::protobuf::kv::ValueWrapper protoValue; + if (protoValue.ParseFromArray(data, static_cast(size))) { + valueWrapper = ProtoSerializable::fromProto(protoValue, timestamp); + return valueWrapper; + } + logger.error("Failed to deserialize value for key {}", key); + return std::nullopt; +} + +bool KVSQL::save(const std::string &key, const ValueWrapper &value) { + auto protoValue = ProtoSerializable::toProto(value); + std::string data; + if (!protoValue.SerializeToString(&data)) { + return false; + } + auto query = fmt::format( + "REPLACE INTO `kv_store` (`key_name`, `timestamp`, `value`) VALUES ({}, {}, {})", + db.escapeString(key), + getTimeMsNow(), + db.escapeString(data) + ); + return db.executeQuery(query); +} + +bool KVSQL::saveAll() { + auto store = getStore(); + bool success = DBTransaction::executeWithinTransaction([this, &store]() { + return std::ranges::all_of(store, [this](const auto &kv) { + const auto &[key, value] = kv; + return save(key, value.first); + }); + return true; + }); + + if (!success) { + g_logger().error("[{}] Error occurred saving player", __FUNCTION__); + } + + return success; +} diff --git a/src/kv/kv_sql.hpp b/src/kv/kv_sql.hpp new file mode 100644 index 000000000..178891179 --- /dev/null +++ b/src/kv/kv_sql.hpp @@ -0,0 +1,33 @@ +/** + * Canary - A free and open-source MMORPG server emulator + * Copyright (©) 2019-2022 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/kv.hpp" + +#include "database/database.hpp" +#include "lib/logging/logger.hpp" + +class Database; + +class KVSQL final : public KVStore { +public: + explicit KVSQL(Database &db, Logger &logger) : + KVStore(logger), + db(db) { } + + bool saveAll() override; + +protected: + std::optional load(const std::string &key) override; + bool save(const std::string &key, const ValueWrapper &value) override; + +private: + Database &db; +}; diff --git a/src/kv/value_wrapper.cpp b/src/kv/value_wrapper.cpp new file mode 100644 index 000000000..a88930a8c --- /dev/null +++ b/src/kv/value_wrapper.cpp @@ -0,0 +1,51 @@ +#include "kv/value_wrapper.hpp" + +ValueWrapper::ValueWrapper(uint64_t timestamp) : + timestamp_(timestamp) { } + +ValueWrapper::ValueWrapper(const ValueVariant &value, uint64_t timestamp) : + data_(value), timestamp_(timestamp) { } + +ValueWrapper::ValueWrapper(const std::string &value, uint64_t timestamp) : + data_(value), timestamp_(timestamp) { } + +ValueWrapper::ValueWrapper(int value, uint64_t timestamp) : + data_(value), timestamp_(timestamp) { } + +ValueWrapper::ValueWrapper(double value, uint64_t timestamp) : + data_(value), timestamp_(timestamp) { } + +ValueWrapper::ValueWrapper(const phmap::flat_hash_map &value, uint64_t timestamp) : + data_(createMapFromRange(value.begin(), value.end(), timestamp)), + timestamp_(timestamp) { } + +ValueWrapper::ValueWrapper(const std::initializer_list> &init_list, uint64_t timestamp) : + data_(createMapFromRange(init_list.begin(), init_list.end(), timestamp)), + timestamp_(timestamp) { } + +std::optional ValueWrapper::get(const std::string &key) const { + auto pval = std::get_if(&data_); + if (!pval) { + return std::nullopt; + } + + if (!pval->contains(key)) { + return std::nullopt; + } + + const auto &[_, valuePtr] = *pval->find(key); + if (!valuePtr) { + return std::nullopt; + } + + return *valuePtr; +} + +std::optional ValueWrapper::get(size_t index) const { + if (auto pval = std::get_if(&data_)) { + if (index < pval->size()) { + return (*pval)[index]; + } + } + return std::nullopt; +} diff --git a/src/kv/value_wrapper.hpp b/src/kv/value_wrapper.hpp new file mode 100644 index 000000000..d079a6690 --- /dev/null +++ b/src/kv/value_wrapper.hpp @@ -0,0 +1,180 @@ +/** + * Canary - A free and open-source MMORPG server emulator + * Copyright (©) 2019-2022 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 +#include +#include +#include +#include +#include +#include +#include +#include + +class ValueWrapper; + +using StringType = std::string; +using IntType = int; +using DoubleType = double; +using ArrayType = std::vector; +using MapType = phmap::flat_hash_map>; + +using ValueVariant = std::variant; + +class ValueWrapper { +public: + explicit ValueWrapper(uint64_t timestamp = 0); + explicit(false) ValueWrapper(const ValueVariant &value, uint64_t timestamp = 0); + explicit(false) ValueWrapper(const std::string &value, uint64_t timestamp = 0); + explicit(false) ValueWrapper(int value, uint64_t timestamp = 0); + explicit(false) ValueWrapper(double value, uint64_t timestamp = 0); + explicit(false) ValueWrapper(const phmap::flat_hash_map &value, uint64_t timestamp = 0); + explicit(false) ValueWrapper(const std::initializer_list> &init_list, uint64_t timestamp = 0); + + template + T get() const { + return std::get(data_); + } + + const ValueVariant &getVariant() const { + return data_; + } + + std::optional get(const std::string &key) const; + std::optional get(size_t index) const; + + template + T get(const std::string &key) const; + + template + T get(size_t index) const; + + uint64_t getTimestamp() const { + return timestamp_; + } + + void setTimestamp(uint64_t timestamp) { + timestamp_ = timestamp; + } + + bool operator==(const ValueWrapper &rhs) const; + + explicit(false) operator std::string() const { + return get(); + } + + explicit(false) operator int() const { + return get(); + } + + explicit(false) operator double() const { + return get(); + } + + explicit(false) operator ArrayType() const { + return get(); + } + + explicit(false) operator MapType() const { + return get(); + } + +private: + ValueVariant data_; + uint64_t timestamp_ = 0; + + template + static MapType createMapFromRange(Iter begin, Iter end, uint64_t timestamp) { + static_assert(std::is_base_of_v::iterator_category>, "The iterator must be at least an input iterator."); + + MapType map; + for (auto it = begin; it != end; ++it) { + const auto &[key, val] = *it; + std::visit( + [&map, &key, ×tamp](const auto &val) { + if constexpr (std::is_same_v, std::shared_ptr>) { + map[key] = val; + } else { + map[key] = std::make_shared(val, timestamp); + } + }, + val.data_ + ); + } + return map; + } +}; + +template +T ValueWrapper::get(const std::string &key) const { + auto optValue = get(key); + if (optValue.has_value()) { + if (auto pval = std::get_if(&optValue->data_)) { + return *pval; + } + } + return T {}; +} + +template +T ValueWrapper::get(size_t index) const { + auto optValue = get(index); + if (optValue.has_value()) { + if (auto pval = std::get_if(&optValue->data_)) { + return *pval; + } + } + return T {}; +} + +inline bool ValueWrapper::operator==(const ValueWrapper &rhs) const { + return data_ == rhs.data_; +} + +inline bool operator==(const ValueVariant &lhs, const ValueVariant &rhs) { + return std::visit( + [](const auto &a, const auto &b) { + using A = std::decay_t; + using B = std::decay_t; + + if constexpr (!std::is_same_v) { + return false; + } + // Perform shallow comparison for maps + if constexpr (std::is_same_v && std::is_same_v) { + if (a.size() != b.size()) { + return false; + } + return std::ranges::all_of(a, [&b](const auto &pair) { + const auto &[key, value] = pair; + return b.contains(key) && value.get() == b.at(key).get(); + }); + } + return a == b; + }, + lhs, rhs + ); +} + +inline std::ostream &operator<<(std::ostream &os, const ValueVariant &val) { + std::visit( + [&os](const auto &v) { + os << v; + }, + val + ); + return os; +} + +inline std::ostream &operator<<(std::ostream &os, const ValueWrapper &wrapper) { + os << wrapper.getVariant(); + return os; +} diff --git a/src/kv/value_wrapper_proto.hpp b/src/kv/value_wrapper_proto.hpp new file mode 100644 index 000000000..1d05de1f5 --- /dev/null +++ b/src/kv/value_wrapper_proto.hpp @@ -0,0 +1,113 @@ +/** + * Canary - A free and open-source MMORPG server emulator + * Copyright (©) 2019-2022 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 + +#include "kv/value_wrapper.hpp" +#include "protobuf/kv.pb.h" + +template +struct ProtoSerializable { + static Canary::protobuf::kv::ValueWrapper toProto(const T &obj); + static T fromProto(const Canary::protobuf::kv::ValueWrapper &protoValue, uint64_t timestamp); +}; + +template <> +struct ProtoSerializable { + static Canary::protobuf::kv::ValueWrapper toProto(const ValueWrapper &obj); + static ValueWrapper fromProto(const Canary::protobuf::kv::ValueWrapper &protoValue, uint64_t timestamp); +}; + +namespace ProtoHelpers { + void setProtoStringValue(Canary::protobuf::kv::ValueWrapper &protoValue, const StringType &arg) { + protoValue.set_str_value(arg); + } + + void setProtoIntValue(Canary::protobuf::kv::ValueWrapper &protoValue, const IntType &arg) { + protoValue.set_int_value(arg); + } + + void setProtoDoubleValue(Canary::protobuf::kv::ValueWrapper &protoValue, const DoubleType &arg) { + protoValue.set_double_value(arg); + } + + void setProtoArrayValue(Canary::protobuf::kv::ValueWrapper &protoValue, const ArrayType &arg) { + auto arrayValue = protoValue.mutable_array_value(); + for (const auto &elem : arg) { + *arrayValue->add_values() = ProtoSerializable::toProto(elem); + } + } + + void setProtoMapValue(Canary::protobuf::kv::ValueWrapper &protoValue, const MapType &arg) { + auto mapValue = protoValue.mutable_map_value(); + for (const auto &[key, value] : arg) { + auto* elem = mapValue->add_items(); + elem->set_key(key); + *elem->mutable_value() = ProtoSerializable::toProto(*value); + } + } +} + +inline Canary::protobuf::kv::ValueWrapper ProtoSerializable::toProto(const ValueWrapper &obj) { + Canary::protobuf::kv::ValueWrapper protoValue; + + std::visit( + [&protoValue](const auto &arg) { + using T = std::decay_t; + if constexpr (std::is_same_v) { + ProtoHelpers::setProtoStringValue(protoValue, arg); + } else if constexpr (std::is_same_v) { + ProtoHelpers::setProtoIntValue(protoValue, arg); + } else if constexpr (std::is_same_v) { + ProtoHelpers::setProtoDoubleValue(protoValue, arg); + } else if constexpr (std::is_same_v) { + ProtoHelpers::setProtoArrayValue(protoValue, arg); + } else if constexpr (std::is_same_v) { + ProtoHelpers::setProtoMapValue(protoValue, arg); + } + }, + obj.getVariant() + ); + + return protoValue; +} + +inline ValueWrapper ProtoSerializable::fromProto(const Canary::protobuf::kv::ValueWrapper &protoValue, uint64_t timestamp) { + ValueVariant data; + switch (protoValue.value_case()) { + case Canary::protobuf::kv::ValueWrapper::kStrValue: + data = protoValue.str_value(); + break; + case Canary::protobuf::kv::ValueWrapper::kIntValue: + data = protoValue.int_value(); + break; + case Canary::protobuf::kv::ValueWrapper::kDoubleValue: + data = protoValue.double_value(); + break; + case Canary::protobuf::kv::ValueWrapper::kArrayValue: { + ArrayType array; + for (const auto &protoElem : protoValue.array_value().values()) { + array.emplace_back(fromProto(protoElem, timestamp)); + } + data = array; + } break; + case Canary::protobuf::kv::ValueWrapper::kMapValue: { + MapType map; + for (const auto &protoElem : protoValue.map_value().items()) { + map[protoElem.key()] = std::make_shared(fromProto(protoElem.value(), timestamp)); + } + data = map; + } break; + default: + break; + } + return ValueWrapper(data, timestamp); +} diff --git a/src/lib/di/container.hpp b/src/lib/di/container.hpp index cb395c0eb..c7d7a2655 100644 --- a/src/lib/di/container.hpp +++ b/src/lib/di/container.hpp @@ -8,9 +8,11 @@ */ #pragma once +#include "account/account_repository_db.hpp" #include "lib/di/injector.hpp" #include "lib/logging/logger.hpp" #include "lib/logging/log_with_spd_log.hpp" +#include "kv/kv_sql.hpp" namespace di = boost::di; @@ -18,6 +20,8 @@ class DI final { private: inline static di::extension::injector<>* testContainer; const inline static auto defaultContainer = di::make_injector( + di::bind().to().in(di::singleton), + di::bind().to().in(di::singleton), di::bind().to().in(di::singleton) ); diff --git a/src/lua/creature/events.cpp b/src/lua/creature/events.cpp index dcbabd1da..1625e50fd 100644 --- a/src/lua/creature/events.cpp +++ b/src/lua/creature/events.cpp @@ -1186,16 +1186,6 @@ void Events::eventPlayerOnCombat(Player* player, Creature* target, Item* item, C damage.primary.value = -damage.primary.value; damage.secondary.value = -damage.secondary.value; } - /* - Only EK with dealing physical damage will get elemental damage on skill - */ - if (damage.origin == ORIGIN_SPELL) { - if (player->getVocationId() != 4 && player->getVocationId() != 8) { - damage.primary.value = damage.primary.value + damage.secondary.value; - damage.secondary.type = COMBAT_NONE; - damage.secondary.value = 0; - } - } } scriptInterface.resetScriptEnv(); diff --git a/src/lua/creature/raids.cpp b/src/lua/creature/raids.cpp index 2e9a611cd..93936d94a 100644 --- a/src/lua/creature/raids.cpp +++ b/src/lua/creature/raids.cpp @@ -102,7 +102,7 @@ bool Raids::startup() { setLastRaidEnd(OTSYS_TIME()); - checkRaidsEvent = g_scheduler().addEvent(CHECK_RAIDS_INTERVAL * 1000, std::bind(&Raids::checkRaids, this)); + checkRaidsEvent = g_scheduler().addEvent(CHECK_RAIDS_INTERVAL * 1000, std::bind(&Raids::checkRaids, this), "Raids::checkRaids"); started = true; return started; @@ -131,7 +131,7 @@ void Raids::checkRaids() { } } - checkRaidsEvent = g_scheduler().addEvent(CHECK_RAIDS_INTERVAL * 1000, std::bind(&Raids::checkRaids, this)); + checkRaidsEvent = g_scheduler().addEvent(CHECK_RAIDS_INTERVAL * 1000, std::bind(&Raids::checkRaids, this), __FUNCTION__); } void Raids::clear() { @@ -213,7 +213,7 @@ void Raid::startRaid() { const auto &raidEvent = getNextRaidEvent(); if (raidEvent) { state = RAIDSTATE_EXECUTING; - nextEventEvent = g_scheduler().addEvent(raidEvent->getDelay(), std::bind(&Raid::executeRaidEvent, this, raidEvent)); + nextEventEvent = g_scheduler().addEvent(raidEvent->getDelay(), std::bind(&Raid::executeRaidEvent, this, raidEvent), "Raid::executeRaidEvent"); } else { g_logger().warn("[raids] Raid {} has no events", name); resetRaid(); @@ -227,7 +227,7 @@ void Raid::executeRaidEvent(const std::shared_ptr raidEvent) { if (newRaidEvent) { uint32_t ticks = static_cast(std::max(RAID_MINTICKS, newRaidEvent->getDelay() - raidEvent->getDelay())); - nextEventEvent = g_scheduler().addEvent(ticks, std::bind(&Raid::executeRaidEvent, this, newRaidEvent)); + nextEventEvent = g_scheduler().addEvent(ticks, std::bind(&Raid::executeRaidEvent, this, newRaidEvent), __FUNCTION__); } else { resetRaid(); } diff --git a/src/lua/creature/talkaction.hpp b/src/lua/creature/talkaction.hpp index 01cf2ff56..f5e42ff7c 100644 --- a/src/lua/creature/talkaction.hpp +++ b/src/lua/creature/talkaction.hpp @@ -9,7 +9,7 @@ #pragma once -#include "creatures/players/account/account.hpp" +#include "account/account.hpp" #include "lua/global/baseevents.hpp" #include "utils/utils_definitions.hpp" #include "declarations.hpp" diff --git a/src/lua/functions/core/CMakeLists.txt b/src/lua/functions/core/CMakeLists.txt index 072c73a25..6f4168f0f 100644 --- a/src/lua/functions/core/CMakeLists.txt +++ b/src/lua/functions/core/CMakeLists.txt @@ -10,6 +10,7 @@ target_sources(${PROJECT_NAME}_lib PRIVATE libs/db_functions.cpp libs/result_functions.cpp libs/logger_functions.cpp + libs/kv_functions.cpp network/network_message_functions.cpp network/webhook_functions.cpp ) diff --git a/src/lua/functions/core/game/game_functions.cpp b/src/lua/functions/core/game/game_functions.cpp index 8f260ca00..6f872c690 100644 --- a/src/lua/functions/core/game/game_functions.cpp +++ b/src/lua/functions/core/game/game_functions.cpp @@ -147,7 +147,7 @@ int GameFunctions::luaGameGetPlayers(lua_State* L) { int GameFunctions::luaGameLoadMap(lua_State* L) { // Game.loadMap(path) const std::string &path = getString(L, 1); - g_dispatcher().addTask([path]() { g_game().loadMap(path); }); + g_dispatcher().addTask([path]() { g_game().loadMap(path); }, "GameFunctions::luaGameLoadMap"); return 0; } @@ -155,7 +155,7 @@ int GameFunctions::luaGameloadMapChunk(lua_State* L) { // Game.loadMapChunk(path, position, remove) const std::string &path = getString(L, 1); const Position &position = getPosition(L, 2); - g_dispatcher().addTask([path, position]() { g_game().loadMap(path, position); }); + g_dispatcher().addTask([path, position]() { g_game().loadMap(path, position); }, "GameFunctions::luaGameloadMapChunk"); return 0; } diff --git a/src/lua/functions/core/game/global_functions.cpp b/src/lua/functions/core/game/global_functions.cpp index eb4310838..4a4a4dee6 100644 --- a/src/lua/functions/core/game/global_functions.cpp +++ b/src/lua/functions/core/game/global_functions.cpp @@ -681,7 +681,9 @@ int GlobalFunctions::luaAddEvent(lua_State* L) { auto &lastTimerEventId = g_luaEnvironment().lastEventTimerId; eventDesc.eventId = g_scheduler().addEvent( - delay, std::bind(&LuaEnvironment::executeTimerEvent, &g_luaEnvironment(), lastTimerEventId) + delay, + std::bind(&LuaEnvironment::executeTimerEvent, &g_luaEnvironment(), lastTimerEventId), + "LuaEnvironment::executeTimerEvent" ); g_luaEnvironment().timerEvents.emplace(lastTimerEventId, std::move(eventDesc)); diff --git a/src/lua/functions/core/game/lua_enums.cpp b/src/lua/functions/core/game/lua_enums.cpp index 69372955b..8a28b0655 100644 --- a/src/lua/functions/core/game/lua_enums.cpp +++ b/src/lua/functions/core/game/lua_enums.cpp @@ -11,7 +11,7 @@ #include "lua/functions/core/game/lua_enums.hpp" -#include "creatures/players/account/account.hpp" +#include "account/account.hpp" #include "creatures/players/wheel/wheel_definitions.hpp" #include "io/io_bosstiary.hpp" #include "config/configmanager.hpp" @@ -164,6 +164,13 @@ void LuaEnums::initOthersEnums(lua_State* L) { registerEnum(L, PLAYERSEX_FEMALE); registerEnum(L, PLAYERSEX_MALE); + registerEnum(L, PLAYERPRONOUN_UNSET); + registerEnum(L, PLAYERPRONOUN_THEY); + registerEnum(L, PLAYERPRONOUN_SHE); + registerEnum(L, PLAYERPRONOUN_HE); + registerEnum(L, PLAYERPRONOUN_ZE); + registerEnum(L, PLAYERPRONOUN_NAME); + registerEnum(L, RESPAWNPERIOD_ALL); registerEnum(L, RESPAWNPERIOD_DAY); registerEnum(L, RESPAWNPERIOD_NIGHT); @@ -822,6 +829,7 @@ void LuaEnums::initItemIdEnums(lua_State* L) { registerEnum(L, ITEM_GOLD_COIN); registerEnum(L, ITEM_PLATINUM_COIN); registerEnum(L, ITEM_CRYSTAL_COIN); + registerEnum(L, ITEM_STORE_COIN); registerEnum(L, ITEM_REWARD_CHEST); registerEnum(L, ITEM_REWARD_CONTAINER); registerEnum(L, ITEM_AMULETOFLOSS); diff --git a/src/lua/functions/core/game/lua_enums.hpp b/src/lua/functions/core/game/lua_enums.hpp index b4380d139..0acec93a9 100644 --- a/src/lua/functions/core/game/lua_enums.hpp +++ b/src/lua/functions/core/game/lua_enums.hpp @@ -11,7 +11,7 @@ #include "pch.hpp" -#include "creatures/players/account/account.hpp" +#include "account/account.hpp" #include "declarations.hpp" #include "lua/scripts/luascript.hpp" diff --git a/src/lua/functions/core/libs/core_libs_functions.hpp b/src/lua/functions/core/libs/core_libs_functions.hpp index ae5e0d847..29b8c8896 100644 --- a/src/lua/functions/core/libs/core_libs_functions.hpp +++ b/src/lua/functions/core/libs/core_libs_functions.hpp @@ -14,6 +14,7 @@ #include "lua/functions/core/libs/db_functions.hpp" #include "lua/functions/core/libs/result_functions.hpp" #include "lua/functions/core/libs/logger_functions.hpp" +#include "lua/functions/core/libs/kv_functions.hpp" class CoreLibsFunctions final : LuaScriptInterface { public: @@ -22,6 +23,7 @@ class CoreLibsFunctions final : LuaScriptInterface { DBFunctions::init(L); ResultFunctions::init(L); LoggerFunctions::init(L); + KVFunctions::init(L); } private: diff --git a/src/lua/functions/core/libs/kv_functions.cpp b/src/lua/functions/core/libs/kv_functions.cpp new file mode 100644 index 000000000..432cf3a50 --- /dev/null +++ b/src/lua/functions/core/libs/kv_functions.cpp @@ -0,0 +1,169 @@ +/** + * Canary - A free and open-source MMORPG server emulator + * Copyright (©) 2019-2022 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 + +#include "kv/kv.hpp" +#include "lua/functions/core/libs/kv_functions.hpp" +#include "lua/scripts/lua_environment.hpp" + +int KVFunctions::luaKVScoped(lua_State* L) { + // KV.scoped(key) + auto key = getString(L, -1); + auto scopedKV = g_kv().scoped(key); + pushUserdata(L, scopedKV); + setMetatable(L, -1, "KVStore"); + return 1; +} + +int KVFunctions::luaKVSet(lua_State* L) { + // KV.set(key, value) | scopedKV:set(key, value) + auto key = getString(L, -2); + auto valueWrapper = getValueWrapper(L); + + if (!valueWrapper) { + g_logger().warn("[{}] invalid param type", __FUNCTION__); + pushBoolean(L, false); + return 1; + } + + if (isUserdata(L, 1)) { + auto scopedKV = getUserdata(L, 1); + scopedKV->set(key, valueWrapper.value()); + pushBoolean(L, true); + return 1; + } + + g_kv().set(key, valueWrapper.value()); + pushBoolean(L, true); + return 1; +} + +int KVFunctions::luaKVGet(lua_State* L) { + // KV.get(key[, forceLoad = false]) | scopedKV:get(key[, forceLoad = false]) + std::optional valueWrapper; + bool forceLoad = false; + auto key = getString(L, -1); + if (isBoolean(L, -1)) { + forceLoad = getBoolean(L, -1); + key = getString(L, -2); + } + if (isUserdata(L, 1)) { + auto scopedKV = getUserdata(L, 1); + valueWrapper = scopedKV->get(key, forceLoad); + } else { + valueWrapper = g_kv().get(key, forceLoad); + } + + if (valueWrapper) { + pushValueWrapper(L, *valueWrapper); + } else { + lua_pushnil(L); + } + return 1; +} + +std::optional KVFunctions::getValueWrapper(lua_State* L) { + if (isString(L, -1)) { + return ValueWrapper(getString(L, -1)); + } + if (isNumber(L, -1)) { + return ValueWrapper(getNumber(L, -1)); + } + if (isBoolean(L, -1)) { + return ValueWrapper(getBoolean(L, -1)); + } + + if (isTable(L, -1) && lua_objlen(L, -1) > 0) { + ArrayType array; + for (int i = 1; i <= lua_objlen(L, -1); ++i) { + lua_rawgeti(L, -1, i); + auto value = getValueWrapper(L); + if (!value) { + g_logger().warn("[{}] invalid param type", __FUNCTION__); + return std::nullopt; + } + array.push_back(value.value()); + lua_pop(L, 1); + } + return ValueWrapper(array); + } + + if (isTable(L, -1)) { + MapType map; + lua_pushnil(L); + while (lua_next(L, -2) != 0) { + auto value = getValueWrapper(L); + if (!value) { + g_logger().warn("[{}] invalid param type", __FUNCTION__); + return std::nullopt; + } + map[getString(L, -2)] = std::make_shared(value.value()); + lua_pop(L, 1); + } + return ValueWrapper(map); + } + + if (isNil(L, -1)) { + return std::nullopt; + } + + g_logger().warn("[{}] invalid param type", __FUNCTION__); + return std::nullopt; +} + +void KVFunctions::pushStringValue(lua_State* L, const StringType &value) { + pushString(L, value); +} + +void KVFunctions::pushIntValue(lua_State* L, const IntType &value) { + lua_pushnumber(L, value); +} + +void KVFunctions::pushDoubleValue(lua_State* L, const DoubleType &value) { + lua_pushnumber(L, value); +} + +void KVFunctions::pushArrayValue(lua_State* L, const ArrayType &value) { + lua_newtable(L); + for (int i = 0; i < value.size(); ++i) { + pushValueWrapper(L, value[i]); + lua_rawseti(L, -2, i + 1); + } +} + +void KVFunctions::pushMapValue(lua_State* L, const MapType &value) { + lua_newtable(L); + for (const auto &[key, val] : value) { + pushValueWrapper(L, *val); + lua_setfield(L, -2, key.c_str()); + } +} + +void KVFunctions::pushValueWrapper(lua_State* L, const ValueWrapper &valueWrapper) { + std::visit( + [L](const auto &arg) { + using T = std::decay_t; + if constexpr (std::is_same_v) { + pushStringValue(L, arg); + } else if constexpr (std::is_same_v) { + pushIntValue(L, arg); + } else if constexpr (std::is_same_v) { + pushDoubleValue(L, arg); + } else if constexpr (std::is_same_v) { + pushArrayValue(L, arg); + } else if constexpr (std::is_same_v) { + pushMapValue(L, arg); + } + }, + valueWrapper.getVariant() + ); +} diff --git a/src/lua/functions/core/libs/kv_functions.hpp b/src/lua/functions/core/libs/kv_functions.hpp new file mode 100644 index 000000000..5d4c1829a --- /dev/null +++ b/src/lua/functions/core/libs/kv_functions.hpp @@ -0,0 +1,40 @@ +/** + * Canary - A free and open-source MMORPG server emulator + * Copyright (©) 2019-2022 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 "lua/scripts/luascript.hpp" + +class KVFunctions final : LuaScriptInterface { +public: + static void init(lua_State* L) { + registerTable(L, "kv"); + registerMethod(L, "kv", "scoped", KVFunctions::luaKVScoped); + registerMethod(L, "kv", "set", KVFunctions::luaKVSet); + registerMethod(L, "kv", "get", KVFunctions::luaKVGet); + + registerClass(L, "KVStore", ""); + registerMethod(L, "KVStore", "scoped", KVFunctions::luaKVScoped); + registerMethod(L, "KVStore", "set", KVFunctions::luaKVSet); + registerMethod(L, "KVStore", "get", KVFunctions::luaKVGet); + } + +private: + static int luaKVScoped(lua_State* L); + static int luaKVSet(lua_State* L); + static int luaKVGet(lua_State* L); + + static std::optional getValueWrapper(lua_State* L); + static void pushStringValue(lua_State* L, const StringType &value); + static void pushIntValue(lua_State* L, const IntType &value); + static void pushDoubleValue(lua_State* L, const DoubleType &value); + static void pushArrayValue(lua_State* L, const ArrayType &value); + static void pushMapValue(lua_State* L, const MapType &value); + static void pushValueWrapper(lua_State* L, const ValueWrapper &valueWrapper); +}; diff --git a/src/lua/functions/creatures/creature_functions.cpp b/src/lua/functions/creatures/creature_functions.cpp index b97f3eff4..d1ec3d19d 100644 --- a/src/lua/functions/creatures/creature_functions.cpp +++ b/src/lua/functions/creatures/creature_functions.cpp @@ -766,7 +766,7 @@ int CreatureFunctions::luaCreatureTeleportTo(lua_State* L) { const Position oldPosition = creature->getPosition(); if (auto ret = g_game().internalTeleport(creature, position, pushMovement); ret != RETURNVALUE_NOERROR) { - g_logger().error("[{}] Failed to teleport creature {}, on position {}, error code: {}", __FUNCTION__, creature->getName(), oldPosition.toString(), getReturnMessage(ret)); + g_logger().debug("[{}] Failed to teleport creature {}, on position {}, error code: {}", __FUNCTION__, creature->getName(), oldPosition.toString(), getReturnMessage(ret)); pushBoolean(L, false); return 1; } @@ -982,46 +982,95 @@ int CreatureFunctions::luaCreatureGetZones(lua_State* L) { } int CreatureFunctions::luaCreatureSetIcon(lua_State* L) { - // creature:setIcon(category, icon[, number]) - Creature* creature = getUserdata(L, 1); + // creature:setIcon(key, category, icon[, number]) + auto creature = getUserdata(L, 1); if (!creature) { reportErrorFunc(getErrorDesc(LUA_ERROR_CREATURE_NOT_FOUND)); pushBoolean(L, false); return 1; } - auto category = getNumber(L, 2); - auto count = getNumber(L, 4, 0); + const auto key = getString(L, 2); + auto category = getNumber(L, 3); + auto count = getNumber(L, 5, 0); CreatureIcon creatureIcon; if (category == CreatureIconCategory_t::Modifications) { - auto icon = getNumber(L, 3); + auto icon = getNumber(L, 5); creatureIcon = CreatureIcon(icon, count); } else { - auto icon = getNumber(L, 3); + auto icon = getNumber(L, 4); creatureIcon = CreatureIcon(icon, count); } - creature->setIcon(creatureIcon); + creature->setIcon(key, creatureIcon); pushBoolean(L, true); return 1; } -int CreatureFunctions::luaCreatureGetIcon(lua_State* L) { - // creature:getIcon() - Creature* creature = getUserdata(L, 1); +int CreatureFunctions::luaCreatureGetIcons(lua_State* L) { + // creature:getIcons() + const auto creature = getUserdata(L, 1); if (!creature) { reportErrorFunc(getErrorDesc(LUA_ERROR_CREATURE_NOT_FOUND)); pushBoolean(L, false); return 1; } - auto creatureIcon = creature->getIcon(); - if (creatureIcon.isNone()) { + auto icons = creature->getIcons(); + lua_createtable(L, static_cast(icons.size()), 0); + for (auto &icon : icons) { + lua_createtable(L, 0, 3); + setField(L, "category", static_cast(icon.category)); + setField(L, "icon", icon.serialize()); + setField(L, "count", icon.count); + lua_rawseti(L, -2, static_cast(icon.category)); + } + return 1; +} + +int CreatureFunctions::luaCreatureGetIcon(lua_State* L) { + // creature:getIcon(key) + const auto creature = getUserdata(L, 1); + if (!creature) { + reportErrorFunc(getErrorDesc(LUA_ERROR_CREATURE_NOT_FOUND)); + pushBoolean(L, false); + return 1; + } + const auto key = getString(L, 2); + auto icon = creature->getIcon(key); + if (icon.isSet()) { + lua_createtable(L, 0, 3); + setField(L, "category", static_cast(icon.category)); + setField(L, "icon", icon.serialize()); + setField(L, "count", icon.count); + } else { lua_pushnil(L); + } + return 1; +} + +int CreatureFunctions::luaCreatureRemoveIcon(lua_State* L) { + // creature:removeIcon(key) + auto creature = getUserdata(L, 1); + if (!creature) { + reportErrorFunc(getErrorDesc(LUA_ERROR_CREATURE_NOT_FOUND)); + pushBoolean(L, false); return 1; } - lua_createtable(L, 0, 3); - setField(L, "category", static_cast(creatureIcon.category)); - setField(L, "icon", creatureIcon.serialize()); - setField(L, "count", creatureIcon.count); + const auto key = getString(L, 2); + creature->removeIcon(key); + pushBoolean(L, true); + return 1; +} + +int CreatureFunctions::luaCreatureClearIcons(lua_State* L) { + // creature:clearIcons() + auto creature = getUserdata(L, 1); + if (!creature) { + reportErrorFunc(getErrorDesc(LUA_ERROR_CREATURE_NOT_FOUND)); + pushBoolean(L, false); + return 1; + } + creature->clearIcons(); + pushBoolean(L, true); return 1; } diff --git a/src/lua/functions/creatures/creature_functions.hpp b/src/lua/functions/creatures/creature_functions.hpp index 1d1b22a9f..426e48591 100644 --- a/src/lua/functions/creatures/creature_functions.hpp +++ b/src/lua/functions/creatures/creature_functions.hpp @@ -82,6 +82,9 @@ class CreatureFunctions final : LuaScriptInterface { registerMethod(L, "Creature", "getZones", CreatureFunctions::luaCreatureGetZones); registerMethod(L, "Creature", "setIcon", CreatureFunctions::luaCreatureSetIcon); registerMethod(L, "Creature", "getIcon", CreatureFunctions::luaCreatureGetIcon); + registerMethod(L, "Creature", "getIcons", CreatureFunctions::luaCreatureGetIcons); + registerMethod(L, "Creature", "removeIcon", CreatureFunctions::luaCreatureRemoveIcon); + registerMethod(L, "Creature", "clearIcons", CreatureFunctions::luaCreatureClearIcons); CombatFunctions::init(L); MonsterFunctions::init(L); @@ -178,5 +181,8 @@ class CreatureFunctions final : LuaScriptInterface { static int luaCreatureGetZones(lua_State* L); static int luaCreatureSetIcon(lua_State* L); + static int luaCreatureGetIcons(lua_State* L); static int luaCreatureGetIcon(lua_State* L); + static int luaCreatureRemoveIcon(lua_State* L); + static int luaCreatureClearIcons(lua_State* L); }; diff --git a/src/lua/functions/creatures/monster/monster_functions.cpp b/src/lua/functions/creatures/monster/monster_functions.cpp index 0611a4c21..bca5a2e42 100644 --- a/src/lua/functions/creatures/monster/monster_functions.cpp +++ b/src/lua/functions/creatures/monster/monster_functions.cpp @@ -317,6 +317,17 @@ int MonsterFunctions::luaMonsterChangeTargetDistance(lua_State* L) { return 1; } +int MonsterFunctions::luaMonsterIsChallenged(lua_State* L) { + // monster:isChallenged() + Monster* monster = getUserdata(L, 1); + if (monster) { + pushBoolean(L, monster->isChallenged()); + } else { + lua_pushnil(L); + } + return 1; +} + int MonsterFunctions::luaMonsterSelectTarget(lua_State* L) { // monster:selectTarget(creature) Monster* monster = getUserdata(L, 1); @@ -459,12 +470,7 @@ int MonsterFunctions::luaMonsterSetForgeStack(lua_State* L) { auto icon = stack < 15 ? CreatureIconModifications_t::Influenced : CreatureIconModifications_t::Fiendish; - monster->setIcon(CreatureIcon( - icon, - icon == CreatureIconModifications_t::Influenced - ? static_cast(stack) - : 0 // don't show the stack for fiendish - )); + monster->setIcon("forge", CreatureIcon(icon, icon == CreatureIconModifications_t::Influenced ? static_cast(stack) : 0)); g_game().updateCreatureIcon(monster); g_game().sendUpdateCreature(monster); return 1; diff --git a/src/lua/functions/creatures/monster/monster_functions.hpp b/src/lua/functions/creatures/monster/monster_functions.hpp index 479553f02..95f972f1f 100644 --- a/src/lua/functions/creatures/monster/monster_functions.hpp +++ b/src/lua/functions/creatures/monster/monster_functions.hpp @@ -39,6 +39,7 @@ class MonsterFunctions final : LuaScriptInterface { registerMethod(L, "Monster", "getTargetList", MonsterFunctions::luaMonsterGetTargetList); registerMethod(L, "Monster", "getTargetCount", MonsterFunctions::luaMonsterGetTargetCount); registerMethod(L, "Monster", "changeTargetDistance", MonsterFunctions::luaMonsterChangeTargetDistance); + registerMethod(L, "Monster", "isChallenged", MonsterFunctions::luaMonsterIsChallenged); registerMethod(L, "Monster", "selectTarget", MonsterFunctions::luaMonsterSelectTarget); registerMethod(L, "Monster", "searchTarget", MonsterFunctions::luaMonsterSearchTarget); registerMethod(L, "Monster", "setSpawnPosition", MonsterFunctions::luaMonsterSetSpawnPosition); @@ -95,6 +96,7 @@ class MonsterFunctions final : LuaScriptInterface { static int luaMonsterGetTargetCount(lua_State* L); static int luaMonsterChangeTargetDistance(lua_State* L); + static int luaMonsterIsChallenged(lua_State* L); static int luaMonsterSelectTarget(lua_State* L); static int luaMonsterSearchTarget(lua_State* L); diff --git a/src/lua/functions/creatures/monster/monster_type_functions.cpp b/src/lua/functions/creatures/monster/monster_type_functions.cpp index 9fc7066ab..aa9103877 100644 --- a/src/lua/functions/creatures/monster/monster_type_functions.cpp +++ b/src/lua/functions/creatures/monster/monster_type_functions.cpp @@ -622,7 +622,7 @@ int MonsterTypeFunctions::luaMonsterTypeBestiaryrace(lua_State* L) { int MonsterTypeFunctions::luaMonsterTypeCombatImmunities(lua_State* L) { // get: monsterType:combatImmunities() set: monsterType:combatImmunities(immunity) - MonsterType* monsterType = getUserdata(L, 1); + const auto &monsterType = getUserdataShared(L, 1); if (!monsterType) { pushBoolean(L, false); reportErrorFunc(getErrorDesc(LUA_ERROR_MONSTER_TYPE_NOT_FOUND)); @@ -678,7 +678,7 @@ int MonsterTypeFunctions::luaMonsterTypeCombatImmunities(lua_State* L) { int MonsterTypeFunctions::luaMonsterTypeConditionImmunities(lua_State* L) { // get: monsterType:conditionImmunities() set: monsterType:conditionImmunities(immunity) - MonsterType* monsterType = getUserdata(L, 1); + const auto &monsterType = getUserdataShared(L, 1); if (!monsterType) { pushBoolean(L, false); reportErrorFunc(getErrorDesc(LUA_ERROR_MONSTER_TYPE_NOT_FOUND)); diff --git a/src/lua/functions/creatures/npc/npc_functions.cpp b/src/lua/functions/creatures/npc/npc_functions.cpp index 28abbf1c5..dd6563f65 100644 --- a/src/lua/functions/creatures/npc/npc_functions.cpp +++ b/src/lua/functions/creatures/npc/npc_functions.cpp @@ -543,7 +543,7 @@ int NpcFunctions::luaNpcSellItem(lua_State* L) { uint8_t internalAmount = (remainingAmount > internalCount) ? internalCount : static_cast(remainingAmount); const ItemType &iType = Item::items[itemId]; Item* item; - if (iType.isBed()) { + if (iType.isWrappable()) { item = Item::CreateItem(ITEM_DECORATION_KIT, subType); item->setAttribute(ItemAttribute_t::DESCRIPTION, "Unwrap this item in your own house to create a <" + iType.name + ">."); item->setCustomAttribute("unWrapId", static_cast(itemId)); @@ -563,7 +563,7 @@ int NpcFunctions::luaNpcSellItem(lua_State* L) { itemsPurchased += internalAmount; remainingAmount -= internalAmount; internalAmount = (remainingAmount > internalCount) ? internalCount : static_cast(remainingAmount); - if (iType.isBed()) { + if (iType.isWrappable()) { item = Item::CreateItem(ITEM_DECORATION_KIT, subType); item->setAttribute(ItemAttribute_t::DESCRIPTION, "Unwrap this item in your own house to create a <" + iType.name + ">."); item->setCustomAttribute("unWrapId", static_cast(itemId)); @@ -576,7 +576,7 @@ int NpcFunctions::luaNpcSellItem(lua_State* L) { uint8_t internalAmount = (remainingAmount > internalCount) ? internalCount : static_cast(remainingAmount); const ItemType &iType = Item::items[itemId]; Item* item; - if (iType.isBed()) { + if (iType.isWrappable()) { item = Item::CreateItem(ITEM_DECORATION_KIT, subType); item->setAttribute(ItemAttribute_t::DESCRIPTION, "Unwrap this item in your own house to create a <" + iType.name + ">."); item->setCustomAttribute("unWrapId", static_cast(itemId)); @@ -596,7 +596,7 @@ int NpcFunctions::luaNpcSellItem(lua_State* L) { itemsPurchased += internalAmount; remainingAmount -= internalAmount; internalAmount = (remainingAmount > internalCount) ? internalCount : static_cast(remainingAmount); - if (iType.isBed()) { + if (iType.isWrappable()) { item = Item::CreateItem(ITEM_DECORATION_KIT, subType); item->setAttribute(ItemAttribute_t::DESCRIPTION, "Unwrap this item in your own house to create a <" + iType.name + ">."); item->setCustomAttribute("unWrapId", static_cast(itemId)); diff --git a/src/lua/functions/creatures/player/player_functions.cpp b/src/lua/functions/creatures/player/player_functions.cpp index c616053a5..4b72347b2 100644 --- a/src/lua/functions/creatures/player/player_functions.cpp +++ b/src/lua/functions/creatures/player/player_functions.cpp @@ -228,11 +228,13 @@ int PlayerFunctions::luaPlayerGetIp(lua_State* L) { int PlayerFunctions::luaPlayerGetAccountId(lua_State* L) { // player:getAccountId() Player* player = getUserdata(L, 1); - if (player) { - lua_pushnumber(L, player->getAccount()); - } else { + if (!player || player->getAccountId() == 0) { lua_pushnil(L); + return 1; } + + lua_pushnumber(L, player->getAccountId()); + return 1; } @@ -272,13 +274,22 @@ int PlayerFunctions::luaPlayerGetAccountType(lua_State* L) { int PlayerFunctions::luaPlayerSetAccountType(lua_State* L) { // player:setAccountType(accountType) Player* player = getUserdata(L, 1); - if (player) { - player->accountType = getNumber(L, 2); - IOLoginData::setAccountType(player->getAccount(), player->accountType); - pushBoolean(L, true); - } else { + if (!player || !player->getAccount()) { + lua_pushnil(L); + return 1; + } + + if (player->getAccount()->setAccountType(getNumber(L, 2)) != account::ERROR_NO) { lua_pushnil(L); + return 1; + } + + if (player->getAccount()->save() != account::ERROR_NO) { + lua_pushnil(L); + return 1; } + + pushBoolean(L, true); return 1; } @@ -1088,6 +1099,22 @@ int PlayerFunctions::luaPlayerAddSkillTries(lua_State* L) { return 1; } +int PlayerFunctions::luaPlayerSetLevel(lua_State* L) { + // player:setLevel(level) + Player* player = getUserdata(L, 1); + if (player) { + uint16_t level = getNumber(L, 2); + player->level = level; + player->experience = Player::getExpForLevel(level); + player->sendStats(); + player->sendSkills(); + pushBoolean(L, true); + } else { + lua_pushnil(L); + } + return 1; +} + int PlayerFunctions::luaPlayerSetMagicLevel(lua_State* L) { // player:setMagicLevel(level[, manaSpent]) Player* player = getUserdata(L, 1); @@ -1376,6 +1403,30 @@ int PlayerFunctions::luaPlayerSetSex(lua_State* L) { return 1; } +int PlayerFunctions::luaPlayerGetPronoun(lua_State* L) { + // player:getPronoun() + Player* player = getUserdata(L, 1); + if (player) { + lua_pushnumber(L, player->getPronoun()); + } else { + lua_pushnil(L); + } + return 1; +} + +int PlayerFunctions::luaPlayerSetPronoun(lua_State* L) { + // player:setPronoun(newPronoun) + Player* player = getUserdata(L, 1); + if (player) { + PlayerPronoun_t newPronoun = getNumber(L, 2); + player->setPronoun(newPronoun); + pushBoolean(L, true); + } else { + lua_pushnil(L); + } + return 1; +} + int PlayerFunctions::luaPlayerGetTown(lua_State* L) { // player:getTown() Player* player = getUserdata(L, 1); @@ -1625,7 +1676,7 @@ int PlayerFunctions::luaPlayerSetBankBalance(lua_State* L) { int PlayerFunctions::luaPlayerGetStorageValue(lua_State* L) { // player:getStorageValue(key) - Player* player = getUserdata(L, 1); + const auto &player = getUserdata(L, 1); if (!player) { lua_pushnil(L); return 1; @@ -1894,6 +1945,25 @@ int PlayerFunctions::luaPlayerSendContainer(lua_State* L) { return 1; } +int PlayerFunctions::luaPlayerSendUpdateContainer(lua_State* L) { + // player:sendUpdateContainer(container) + Player* player = getUserdata(L, 1); + if (!player) { + lua_pushnil(L); + return 1; + } + + const auto container = getUserdata(L, 2); + if (!container) { + reportErrorFunc("Container is nullptr"); + return 1; + } + + player->onSendContainer(container); + pushBoolean(L, true); + return 1; +} + int PlayerFunctions::luaPlayerGetMoney(lua_State* L) { // player:getMoney() Player* player = getUserdata(L, 1); @@ -2340,8 +2410,8 @@ int PlayerFunctions::luaPlayerGetFamiliarLooktype(lua_State* L) { int PlayerFunctions::luaPlayerGetPremiumDays(lua_State* L) { // player:getPremiumDays() Player* player = getUserdata(L, 1); - if (player) { - lua_pushnumber(L, player->premiumDays); + if (player && player->getAccount()) { + lua_pushnumber(L, player->getAccount()->getPremiumRemainingDays()); } else { lua_pushnil(L); } @@ -2351,19 +2421,28 @@ int PlayerFunctions::luaPlayerGetPremiumDays(lua_State* L) { int PlayerFunctions::luaPlayerAddPremiumDays(lua_State* L) { // player:addPremiumDays(days) Player* player = getUserdata(L, 1); - if (!player) { + if (!player || !player->getAccount()) { lua_pushnil(L); return 1; } - if (player->premiumDays != std::numeric_limits::max()) { - uint16_t days = getNumber(L, 2); - int32_t addDays = std::min(0xFFFE - player->premiumDays, days); - if (addDays > 0) { - player->setPremiumDays(player->premiumDays + addDays); - IOLoginData::addPremiumDays(player, addDays); - } + auto premiumDays = player->getAccount()->getPremiumRemainingDays(); + + if (premiumDays == std::numeric_limits::max()) { + return 1; + } + + int32_t addDays = std::min(0xFFFE - premiumDays, getNumber(L, 2)); + if (addDays <= 0) { + return 1; } + + player->getAccount()->addPremiumDays(addDays); + + if (player->getAccount()->save() != account::ERROR_NO) { + return 1; + } + pushBoolean(L, true); return 1; } @@ -2371,19 +2450,28 @@ int PlayerFunctions::luaPlayerAddPremiumDays(lua_State* L) { int PlayerFunctions::luaPlayerRemovePremiumDays(lua_State* L) { // player:removePremiumDays(days) Player* player = getUserdata(L, 1); - if (!player) { + if (!player || !player->getAccount()) { lua_pushnil(L); return 1; } - if (player->premiumDays != std::numeric_limits::max()) { - uint16_t days = getNumber(L, 2); - int32_t removeDays = std::min(player->premiumDays, days); - if (removeDays > 0) { - player->setPremiumDays(player->premiumDays - removeDays); - IOLoginData::removePremiumDays(player, removeDays); - } + auto premiumDays = player->getAccount()->getPremiumRemainingDays(); + + if (premiumDays == std::numeric_limits::max()) { + return 1; + } + + int32_t removeDays = std::min(0xFFFE - premiumDays, getNumber(L, 2)); + if (removeDays <= 0) { + return 1; } + + player->getAccount()->addPremiumDays(-removeDays); + + if (player->getAccount()->save() != account::ERROR_NO) { + return 1; + } + pushBoolean(L, true); return 1; } @@ -2391,118 +2479,139 @@ int PlayerFunctions::luaPlayerRemovePremiumDays(lua_State* L) { int PlayerFunctions::luaPlayerGetTibiaCoins(lua_State* L) { // player:getTibiaCoins() Player* player = getUserdata(L, 1); - if (player) { - account::Account account(player->getAccount()); - account.LoadAccountDB(); - uint32_t coins; - account.GetCoins(&coins); - lua_pushnumber(L, coins); - } else { + if (!player || !player->getAccount()) { + reportErrorFunc(getErrorDesc(LUA_ERROR_PLAYER_NOT_FOUND)); lua_pushnil(L); + return 1; } + + auto [coins, result] = player->getAccount()->getCoins(account::CoinType::COIN); + + if (result == account::ERROR_NO) { + lua_pushnumber(L, coins); + } + return 1; } int PlayerFunctions::luaPlayerAddTibiaCoins(lua_State* L) { // player:addTibiaCoins(coins) Player* player = getUserdata(L, 1); - if (!player) { + if (!player || !player->getAccount()) { + reportErrorFunc(getErrorDesc(LUA_ERROR_PLAYER_NOT_FOUND)); lua_pushnil(L); return 1; } - uint32_t coins = getNumber(L, 2); + if (player->account->addCoins(account::CoinType::COIN, getNumber(L, 2)) != account::ERROR_NO) { + reportErrorFunc("Failed to add coins"); + lua_pushnil(L); + return 1; + } - account::Account account(player->getAccount()); - account.LoadAccountDB(); - if (account.AddCoins(coins)) { - account.GetCoins(&(player->coinBalance)); - pushBoolean(L, true); - } else { + if (player->getAccount()->save() != account::ERROR_NO) { + reportErrorFunc("Failed to save account"); lua_pushnil(L); + return 1; } + pushBoolean(L, true); + return 1; } int PlayerFunctions::luaPlayerRemoveTibiaCoins(lua_State* L) { // player:removeTibiaCoins(coins) Player* player = getUserdata(L, 1); - if (!player) { + if (!player || !player->getAccount()) { + reportErrorFunc(getErrorDesc(LUA_ERROR_PLAYER_NOT_FOUND)); lua_pushnil(L); return 1; } - uint32_t coins = getNumber(L, 2); + if (player->account->removeCoins(account::CoinType::COIN, getNumber(L, 2)) != account::ERROR_NO) { + reportErrorFunc("Failed to remove coins"); + return 1; + } - account::Account account(player->getAccount()); - account.LoadAccountDB(); - if (account.RemoveCoins(coins)) { - account.GetCoins(&(player->coinBalance)); - pushBoolean(L, true); - } else { + if (player->getAccount()->save() != account::ERROR_NO) { + reportErrorFunc("Failed to save account"); lua_pushnil(L); + return 1; } + pushBoolean(L, true); + return 1; } int PlayerFunctions::luaPlayerGetTransferableCoins(lua_State* L) { // player:getTransferableCoins() Player* player = getUserdata(L, 1); - if (player) { - account::Account account(player->getAccount()); - account.LoadAccountDB(); - uint32_t coins; - account.GetTransferableCoins(&coins); - lua_pushnumber(L, coins); - } else { + if (!player || !player->getAccount()) { + reportErrorFunc(getErrorDesc(LUA_ERROR_PLAYER_NOT_FOUND)); lua_pushnil(L); + return 1; + } + + auto [coins, result] = player->getAccount()->getCoins(account::CoinType::TRANSFERABLE); + + if (result == account::ERROR_NO) { + lua_pushnumber(L, coins); } + return 1; } int PlayerFunctions::luaPlayerAddTransferableCoins(lua_State* L) { // player:addTransferableCoins(coins) Player* player = getUserdata(L, 1); - if (!player) { + if (!player || !player->getAccount()) { + reportErrorFunc(getErrorDesc(LUA_ERROR_PLAYER_NOT_FOUND)); lua_pushnil(L); return 1; } - uint32_t coins = getNumber(L, 2); + if (player->account->addCoins(account::CoinType::TRANSFERABLE, getNumber(L, 2)) != account::ERROR_NO) { + reportErrorFunc("failed to add transferable coins"); + lua_pushnil(L); + return 1; + } - account::Account account(player->getAccount()); - account.LoadAccountDB(); - if (account.AddTransferableCoins(coins)) { - account.GetTransferableCoins(&(player->coinTransferableBalance)); - pushBoolean(L, true); - } else { + if (player->getAccount()->save() != account::ERROR_NO) { + reportErrorFunc("failed to save account"); lua_pushnil(L); + return 1; } + pushBoolean(L, true); + return 1; } int PlayerFunctions::luaPlayerRemoveTransferableCoins(lua_State* L) { // player:removeTransferableCoins(coins) Player* player = getUserdata(L, 1); - if (!player) { + if (!player || !player->getAccount()) { + reportErrorFunc(getErrorDesc(LUA_ERROR_PLAYER_NOT_FOUND)); lua_pushnil(L); return 1; } - uint32_t coins = getNumber(L, 2); + if (player->account->removeCoins(account::CoinType::TRANSFERABLE, getNumber(L, 2)) != account::ERROR_NO) { + reportErrorFunc("failed to remove transferable coins"); + lua_pushnil(L); + return 1; + } - account::Account account(player->getAccount()); - account.LoadAccountDB(); - if (account.RemoveTransferableCoins(coins)) { - account.GetTransferableCoins(&(player->coinTransferableBalance)); - pushBoolean(L, true); - } else { + if (player->getAccount()->save() != account::ERROR_NO) { + reportErrorFunc("failed to save account"); lua_pushnil(L); + return 1; } + pushBoolean(L, true); + return 1; } @@ -3401,6 +3510,50 @@ int PlayerFunctions::luaPlayerBosstiaryCooldownTimer(lua_State* L) { return 1; } +int PlayerFunctions::luaPlayerGetBosstiaryLevel(lua_State* L) { + // player:getBosstiaryLevel(name) + if (Player* player = getUserdata(L, 1); + player) { + const auto mtype = g_monsters().getMonsterType(getString(L, 2)); + if (mtype) { + uint32_t bossId = mtype->info.raceid; + if (bossId == 0) { + lua_pushnil(L); + return 0; + } + auto level = g_ioBosstiary().getBossCurrentLevel(player, bossId); + lua_pushnumber(L, level); + } else { + lua_pushnil(L); + } + } else { + lua_pushnil(L); + } + return 1; +} + +int PlayerFunctions::luaPlayerGetBosstiaryKills(lua_State* L) { + // player:getBosstiaryKills(name) + if (Player* player = getUserdata(L, 1); + player) { + const auto mtype = g_monsters().getMonsterType(getString(L, 2)); + if (mtype) { + uint32_t bossId = mtype->info.raceid; + if (bossId == 0) { + lua_pushnil(L); + return 0; + } + uint32_t currentKills = player->getBestiaryKillCount(static_cast(bossId)); + lua_pushnumber(L, currentKills); + } else { + lua_pushnil(L); + } + } else { + lua_pushnil(L); + } + return 1; +} + int PlayerFunctions::luaPlayerAddBosstiaryKill(lua_State* L) { // player:addBosstiaryKill(name[, amount = 1]) if (Player* player = getUserdata(L, 1); @@ -3625,7 +3778,7 @@ int PlayerFunctions::luaPlayerGetLoyaltyBonus(lua_State* L) { int PlayerFunctions::luaPlayerGetLoyaltyPoints(lua_State* L) { // player:getLoyaltyPoints() - Player* player = getUserdata(L, 1); + const auto &player = getUserdata(L, 1); if (!player) { lua_pushnil(L); return 1; @@ -3924,3 +4077,17 @@ int PlayerFunctions::luaPlayerGetVipTime(lua_State* L) { lua_pushinteger(L, player->getPremiumLastDay()); return 1; } + +int PlayerFunctions::luaPlayerKV(lua_State* L) { + // player:kv() + auto player = getUserdata(L, 1); + if (!player) { + reportErrorFunc(getErrorDesc(LUA_ERROR_PLAYER_NOT_FOUND)); + pushBoolean(L, false); + return 1; + } + + pushUserdata(L, player->kv()); + setMetatable(L, -1, "KVStore"); + return 1; +} diff --git a/src/lua/functions/creatures/player/player_functions.hpp b/src/lua/functions/creatures/player/player_functions.hpp index 294c77de5..ff047fb12 100644 --- a/src/lua/functions/creatures/player/player_functions.hpp +++ b/src/lua/functions/creatures/player/player_functions.hpp @@ -111,6 +111,7 @@ class PlayerFunctions final : LuaScriptInterface { registerMethod(L, "Player", "getSkillTries", PlayerFunctions::luaPlayerGetSkillTries); registerMethod(L, "Player", "addSkillTries", PlayerFunctions::luaPlayerAddSkillTries); + registerMethod(L, "Player", "setLevel", PlayerFunctions::luaPlayerSetLevel); registerMethod(L, "Player", "setMagicLevel", PlayerFunctions::luaPlayerSetMagicLevel); registerMethod(L, "Player", "setSkillLevel", PlayerFunctions::luaPlayerSetSkillLevel); @@ -133,6 +134,9 @@ class PlayerFunctions final : LuaScriptInterface { registerMethod(L, "Player", "getSex", PlayerFunctions::luaPlayerGetSex); registerMethod(L, "Player", "setSex", PlayerFunctions::luaPlayerSetSex); + registerMethod(L, "Player", "getPronoun", PlayerFunctions::luaPlayerGetPronoun); + registerMethod(L, "Player", "setPronoun", PlayerFunctions::luaPlayerSetPronoun); + registerMethod(L, "Player", "getTown", PlayerFunctions::luaPlayerGetTown); registerMethod(L, "Player", "setTown", PlayerFunctions::luaPlayerSetTown); @@ -173,6 +177,7 @@ class PlayerFunctions final : LuaScriptInterface { registerMethod(L, "Player", "removeStashItem", PlayerFunctions::luaPlayerRemoveStashItem); registerMethod(L, "Player", "removeItem", PlayerFunctions::luaPlayerRemoveItem); registerMethod(L, "Player", "sendContainer", PlayerFunctions::luaPlayerSendContainer); + registerMethod(L, "Player", "sendUpdateContainer", PlayerFunctions::luaPlayerSendUpdateContainer); registerMethod(L, "Player", "getMoney", PlayerFunctions::luaPlayerGetMoney); registerMethod(L, "Player", "addMoney", PlayerFunctions::luaPlayerAddMoney); @@ -311,6 +316,8 @@ class PlayerFunctions final : LuaScriptInterface { registerMethod(L, "Player", "getFaction", PlayerFunctions::luaPlayerGetFaction); // Bosstiary Functions + registerMethod(L, "Player", "getBosstiaryLevel", PlayerFunctions::luaPlayerGetBosstiaryLevel); + registerMethod(L, "Player", "getBosstiaryKills", PlayerFunctions::luaPlayerGetBosstiaryKills); registerMethod(L, "Player", "addBosstiaryKill", PlayerFunctions::luaPlayerAddBosstiaryKill); registerMethod(L, "Player", "setBossPoints", PlayerFunctions::luaPlayerSetBossPoints); registerMethod(L, "Player", "setRemoveBossTime", PlayerFunctions::luaPlayerSetRemoveBossTime); @@ -343,6 +350,8 @@ class PlayerFunctions final : LuaScriptInterface { registerMethod(L, "Player", "getVipDays", PlayerFunctions::luaPlayerGetVipDays); registerMethod(L, "Player", "getVipTime", PlayerFunctions::luaPlayerGetVipTime); + registerMethod(L, "Player", "kv", PlayerFunctions::luaPlayerKV); + GroupFunctions::init(L); GuildFunctions::init(L); MountFunctions::init(L); @@ -441,6 +450,7 @@ class PlayerFunctions final : LuaScriptInterface { static int luaPlayerGetSkillTries(lua_State* L); static int luaPlayerAddSkillTries(lua_State* L); + static int luaPlayerSetLevel(lua_State* L); static int luaPlayerSetMagicLevel(lua_State* L); static int luaPlayerSetSkillLevel(lua_State* L); @@ -463,6 +473,9 @@ class PlayerFunctions final : LuaScriptInterface { static int luaPlayerGetSex(lua_State* L); static int luaPlayerSetSex(lua_State* L); + static int luaPlayerGetPronoun(lua_State* L); + static int luaPlayerSetPronoun(lua_State* L); + static int luaPlayerGetTown(lua_State* L); static int luaPlayerSetTown(lua_State* L); @@ -503,6 +516,7 @@ class PlayerFunctions final : LuaScriptInterface { static int luaPlayerRemoveStashItem(lua_State* L); static int luaPlayerRemoveItem(lua_State* L); static int luaPlayerSendContainer(lua_State* L); + static int luaPlayerSendUpdateContainer(lua_State* L); static int luaPlayerGetMoney(lua_State* L); static int luaPlayerAddMoney(lua_State* L); @@ -645,6 +659,8 @@ class PlayerFunctions final : LuaScriptInterface { static int luaPlayerSetFaction(lua_State* L); static int luaPlayerGetFaction(lua_State* L); + static int luaPlayerGetBosstiaryLevel(lua_State* L); + static int luaPlayerGetBosstiaryKills(lua_State* L); static int luaPlayerAddBosstiaryKill(lua_State* L); static int luaPlayerSetBossPoints(lua_State* L); static int luaPlayerSetRemoveBossTime(lua_State* L); @@ -680,5 +696,7 @@ class PlayerFunctions final : LuaScriptInterface { static int luaPlayerGetVipDays(lua_State* L); static int luaPlayerGetVipTime(lua_State* L); + static int luaPlayerKV(lua_State* L); + friend class CreatureFunctions; }; diff --git a/src/lua/functions/events/talk_action_functions.cpp b/src/lua/functions/events/talk_action_functions.cpp index 3ccedf54e..a004f67e0 100644 --- a/src/lua/functions/events/talk_action_functions.cpp +++ b/src/lua/functions/events/talk_action_functions.cpp @@ -9,7 +9,7 @@ #include "pch.hpp" -#include "creatures/players/account/account.hpp" +#include "account/account.hpp" #include "lua/creature/talkaction.hpp" #include "lua/functions/events/talk_action_functions.hpp" diff --git a/src/lua/functions/items/item_type_functions.cpp b/src/lua/functions/items/item_type_functions.cpp index 53ca97aae..bc14c3696 100644 --- a/src/lua/functions/items/item_type_functions.cpp +++ b/src/lua/functions/items/item_type_functions.cpp @@ -329,6 +329,19 @@ int ItemTypeFunctions::luaItemTypeGetWeight(lua_State* L) { return 1; } +int ItemTypeFunctions::luaItemTypeGetStackSize(lua_State* L) { + // itemType:getStackSize() + const ItemType* itemType = getUserdata(L, 1); + if (!itemType) { + lua_pushnil(L); + return 1; + } + + uint64_t stackSize = static_cast(itemType->stackSize); + lua_pushnumber(L, stackSize); + return 1; +} + int ItemTypeFunctions::luaItemTypeGetHitChance(lua_State* L) { // itemType:getHitChance() const ItemType* itemType = getUserdata(L, 1); diff --git a/src/lua/functions/items/item_type_functions.hpp b/src/lua/functions/items/item_type_functions.hpp index 0afb8b3cd..7ee9032e5 100644 --- a/src/lua/functions/items/item_type_functions.hpp +++ b/src/lua/functions/items/item_type_functions.hpp @@ -47,6 +47,7 @@ class ItemTypeFunctions final : LuaScriptInterface { registerMethod(L, "ItemType", "getFluidSource", ItemTypeFunctions::luaItemTypeGetFluidSource); registerMethod(L, "ItemType", "getCapacity", ItemTypeFunctions::luaItemTypeGetCapacity); registerMethod(L, "ItemType", "getWeight", ItemTypeFunctions::luaItemTypeGetWeight); + registerMethod(L, "ItemType", "getStackSize", ItemTypeFunctions::luaItemTypeGetStackSize); registerMethod(L, "ItemType", "getHitChance", ItemTypeFunctions::luaItemTypeGetHitChance); registerMethod(L, "ItemType", "getShootRange", ItemTypeFunctions::luaItemTypeGetShootRange); @@ -112,6 +113,7 @@ class ItemTypeFunctions final : LuaScriptInterface { static int luaItemTypeGetFluidSource(lua_State* L); static int luaItemTypeGetCapacity(lua_State* L); static int luaItemTypeGetWeight(lua_State* L); + static int luaItemTypeGetStackSize(lua_State* L); static int luaItemTypeGetHitChance(lua_State* L); static int luaItemTypeGetShootRange(lua_State* L); diff --git a/src/lua/functions/lua_functions_loader.hpp b/src/lua/functions/lua_functions_loader.hpp index 4d17d5884..3eca065cd 100644 --- a/src/lua/functions/lua_functions_loader.hpp +++ b/src/lua/functions/lua_functions_loader.hpp @@ -24,6 +24,7 @@ class Player; class Thing; class Guild; class Zone; +class KVStore; #define reportErrorFunc(a) reportError(__FUNCTION__, a, true) diff --git a/src/lua/global/globalevent.cpp b/src/lua/global/globalevent.cpp index db97baa82..2366ef261 100644 --- a/src/lua/global/globalevent.cpp +++ b/src/lua/global/globalevent.cpp @@ -35,7 +35,7 @@ bool GlobalEvents::registerLuaEvent(const std::shared_ptr globalEve auto result = timerMap.emplace(globalEvent->getName(), globalEvent); if (result.second) { if (timerEventId == 0) { - timerEventId = g_scheduler().addEvent(SCHEDULER_MINTICKS, std::bind(&GlobalEvents::timer, this)); + timerEventId = g_scheduler().addEvent(SCHEDULER_MINTICKS, std::bind(&GlobalEvents::timer, this), "GlobalEvents::timer"); } return true; } @@ -48,7 +48,9 @@ bool GlobalEvents::registerLuaEvent(const std::shared_ptr globalEve auto result = thinkMap.emplace(globalEvent->getName(), globalEvent); if (result.second) { if (thinkEventId == 0) { - thinkEventId = g_scheduler().addEvent(SCHEDULER_MINTICKS, std::bind(&GlobalEvents::think, this)); + thinkEventId = g_scheduler().addEvent( + SCHEDULER_MINTICKS, [this] { think(); }, "GlobalEvents::think" + ); } return true; } @@ -97,7 +99,7 @@ void GlobalEvents::timer() { } if (nextScheduledTime != std::numeric_limits::max()) { - timerEventId = g_scheduler().addEvent(std::max(1000, nextScheduledTime * 1000), std::bind(&GlobalEvents::timer, this)); + timerEventId = g_scheduler().addEvent(std::max(1000, nextScheduledTime * 1000), std::bind(&GlobalEvents::timer, this), __FUNCTION__); } } @@ -116,6 +118,8 @@ void GlobalEvents::think() { continue; } + g_logger().trace("[GlobalEvents::think] - Executing event: {}", globalEvent->getName()); + if (!globalEvent->executeEvent()) { g_logger().error("[GlobalEvents::think] - " "Failed to execute event: {}", @@ -132,7 +136,7 @@ void GlobalEvents::think() { if (nextScheduledTime != std::numeric_limits::max()) { auto delay = static_cast(nextScheduledTime); - thinkEventId = g_scheduler().addEvent(delay, std::bind(&GlobalEvents::think, this)); + thinkEventId = g_scheduler().addEvent(delay, std::bind(&GlobalEvents::think, this), "GlobalEvents::think"); } } diff --git a/src/lua/global/globalevent.hpp b/src/lua/global/globalevent.hpp index 0076f24c0..683da7126 100644 --- a/src/lua/global/globalevent.hpp +++ b/src/lua/global/globalevent.hpp @@ -41,7 +41,7 @@ class GlobalEvents final : public Scripts { private: GlobalEventMap thinkMap, serverMap, timerMap; - int32_t thinkEventId = 0, timerEventId = 0; + uint64_t thinkEventId = 0, timerEventId = 0; }; constexpr auto g_globalEvents = GlobalEvents::getInstance; diff --git a/src/map/house/house.cpp b/src/map/house/house.cpp index 30c1304df..0ee5a5946 100644 --- a/src/map/house/house.cpp +++ b/src/map/house/house.cpp @@ -122,7 +122,9 @@ void House::updateDoorDescription() const { ss << " It is " << houseTiles.size() << " square meters."; const int32_t housePrice = getPrice(); if (housePrice != -1) { - ss << " It costs " << formatNumber(getPrice()) << " gold coins."; + if (g_configManager().getBoolean(HOUSE_PURSHASED_SHOW_PRICE) || owner == 0) { + ss << " It costs " << formatNumber(getPrice()) << " gold coins."; + } std::string strRentPeriod = asLowerCaseString(g_configManager().getString(HOUSE_RENT_PERIOD)); if (strRentPeriod != "never") { ss << " The rent cost is " << formatNumber(getRent()) << " gold coins and it is billed " << strRentPeriod << "."; @@ -140,7 +142,7 @@ AccessHouseLevel_t House::getHouseAccessLevel(const Player* player) { } if (g_configManager().getBoolean(HOUSE_OWNED_BY_ACCOUNT)) { - if (ownerAccountId == player->getAccount()) { + if (ownerAccountId == player->getAccountId()) { return HOUSE_OWNER; } } diff --git a/src/map/mapcache.cpp b/src/map/mapcache.cpp index 618d7ac85..7660b7629 100644 --- a/src/map/mapcache.cpp +++ b/src/map/mapcache.cpp @@ -94,7 +94,8 @@ Item* MapCache::createItem(const BasicItemPtr &BasicItem, Position position) { } item->startDecaying(); - item->setLoadedFromMap(true); + item->loadedFromMap = true; + item->decayDisabled = Item::items[item->getID()].decayTo != -1; return item; } diff --git a/src/protobuf/CMakeLists.txt b/src/protobuf/CMakeLists.txt index b4923dfca..4ca2bac2c 100644 --- a/src/protobuf/CMakeLists.txt +++ b/src/protobuf/CMakeLists.txt @@ -9,6 +9,7 @@ include_directories(${PROTOBUF_INCLUDE_DIRS}) file(GLOB ProtoFiles "${CMAKE_CURRENT_SOURCE_DIR}/appearances.proto" + "${CMAKE_CURRENT_SOURCE_DIR}/kv.proto" ) PROTOBUF_GENERATE_CPP(ProtoSources ProtoHeaders ${ProtoFiles}) add_library(${PROJECT_NAME} ${ProtoSources} ${ProtoHeaders}) @@ -21,8 +22,18 @@ add_custom_command( ${CMAKE_CURRENT_BINARY_DIR}/appearances.pb.cc ${CMAKE_CURRENT_SOURCE_DIR}/appearances.pb.cc - # Copy files "appearances.pb.hpp" to the "src/protobuf" folder + # Copy files "appearances.pb.h" to the "src/protobuf" folder COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/appearances.pb.h ${CMAKE_CURRENT_SOURCE_DIR}/appearances.pb.h + + # Copy files "kv.pb.cc" to the "src/protobuf" folder + COMMAND ${CMAKE_COMMAND} -E copy + ${CMAKE_CURRENT_BINARY_DIR}/kv.pb.cc + ${CMAKE_CURRENT_SOURCE_DIR}/kv.pb.cc + + # Copy files "kv.pb.hpp" to the "src/protobuf" folder + COMMAND ${CMAKE_COMMAND} -E copy + ${CMAKE_CURRENT_BINARY_DIR}/kv.pb.h + ${CMAKE_CURRENT_SOURCE_DIR}/kv.pb.h ) diff --git a/src/protobuf/appearances.pb.cc b/src/protobuf/appearances.pb.cc index cc96bcf73..ced2a6173 100644 --- a/src/protobuf/appearances.pb.cc +++ b/src/protobuf/appearances.pb.cc @@ -223,7 +223,8 @@ PROTOBUF_CONSTEXPR AppearanceFlags::AppearanceFlags( , /*decltype(_impl_.wearout_)*/false , /*decltype(_impl_.clockexpire_)*/false , /*decltype(_impl_.expire_)*/false - , /*decltype(_impl_.expirestop_)*/false} {} + , /*decltype(_impl_.expirestop_)*/false + , /*decltype(_impl_.wrapkit_)*/false} {} struct AppearanceFlagsDefaultTypeInternal { PROTOBUF_CONSTEXPR AppearanceFlagsDefaultTypeInternal() : _instance(::_pbi::ConstantInitialized{}) {} @@ -477,7 +478,8 @@ PROTOBUF_CONSTEXPR SpecialMeaningAppearanceIds::SpecialMeaningAppearanceIds( , /*decltype(_impl_.crystal_coin_id_)*/0u , /*decltype(_impl_.tibia_coin_id_)*/0u , /*decltype(_impl_.stamped_letter_id_)*/0u - , /*decltype(_impl_.supply_stash_id_)*/0u} {} + , /*decltype(_impl_.supply_stash_id_)*/0u + , /*decltype(_impl_.reward_chest_id_)*/0u} {} struct SpecialMeaningAppearanceIdsDefaultTypeInternal { PROTOBUF_CONSTEXPR SpecialMeaningAppearanceIdsDefaultTypeInternal() : _instance(::_pbi::ConstantInitialized{}) {} @@ -679,6 +681,7 @@ const uint32_t TableStruct_appearances_2eproto::offsets[] PROTOBUF_SECTION_VARIA PROTOBUF_FIELD_OFFSET(::Canary::protobuf::appearances::AppearanceFlags, _impl_.clockexpire_), PROTOBUF_FIELD_OFFSET(::Canary::protobuf::appearances::AppearanceFlags, _impl_.expire_), PROTOBUF_FIELD_OFFSET(::Canary::protobuf::appearances::AppearanceFlags, _impl_.expirestop_), + PROTOBUF_FIELD_OFFSET(::Canary::protobuf::appearances::AppearanceFlags, _impl_.wrapkit_), 0, 15, 16, @@ -735,6 +738,7 @@ const uint32_t TableStruct_appearances_2eproto::offsets[] PROTOBUF_SECTION_VARIA 52, 53, 54, + 55, PROTOBUF_FIELD_OFFSET(::Canary::protobuf::appearances::AppearanceFlagUpgradeClassification, _impl_._has_bits_), PROTOBUF_FIELD_OFFSET(::Canary::protobuf::appearances::AppearanceFlagUpgradeClassification, _internal_metadata_), ~0u, // no _extensions_ @@ -897,12 +901,14 @@ const uint32_t TableStruct_appearances_2eproto::offsets[] PROTOBUF_SECTION_VARIA PROTOBUF_FIELD_OFFSET(::Canary::protobuf::appearances::SpecialMeaningAppearanceIds, _impl_.tibia_coin_id_), PROTOBUF_FIELD_OFFSET(::Canary::protobuf::appearances::SpecialMeaningAppearanceIds, _impl_.stamped_letter_id_), PROTOBUF_FIELD_OFFSET(::Canary::protobuf::appearances::SpecialMeaningAppearanceIds, _impl_.supply_stash_id_), + PROTOBUF_FIELD_OFFSET(::Canary::protobuf::appearances::SpecialMeaningAppearanceIds, _impl_.reward_chest_id_), 0, 1, 2, 3, 4, 5, + 6, }; static const ::_pbi::MigrationSchema schemas[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { { 0, 9, -1, sizeof(::Canary::protobuf::appearances::Coordinate)}, @@ -913,24 +919,24 @@ static const ::_pbi::MigrationSchema schemas[] PROTOBUF_SECTION_VARIABLE(protode { 70, 85, -1, sizeof(::Canary::protobuf::appearances::SpriteInfo)}, { 94, 103, -1, sizeof(::Canary::protobuf::appearances::FrameGroup)}, { 106, 117, -1, sizeof(::Canary::protobuf::appearances::Appearance)}, - { 122, 184, -1, sizeof(::Canary::protobuf::appearances::AppearanceFlags)}, - { 240, 247, -1, sizeof(::Canary::protobuf::appearances::AppearanceFlagUpgradeClassification)}, - { 248, 255, -1, sizeof(::Canary::protobuf::appearances::AppearanceFlagBank)}, - { 256, 263, -1, sizeof(::Canary::protobuf::appearances::AppearanceFlagWrite)}, - { 264, 271, -1, sizeof(::Canary::protobuf::appearances::AppearanceFlagWriteOnce)}, - { 272, 280, -1, sizeof(::Canary::protobuf::appearances::AppearanceFlagLight)}, - { 282, 289, -1, sizeof(::Canary::protobuf::appearances::AppearanceFlagHeight)}, - { 290, 298, -1, sizeof(::Canary::protobuf::appearances::AppearanceFlagShift)}, - { 300, 307, -1, sizeof(::Canary::protobuf::appearances::AppearanceFlagClothes)}, - { 308, 315, -1, sizeof(::Canary::protobuf::appearances::AppearanceFlagDefaultAction)}, - { 316, 327, -1, sizeof(::Canary::protobuf::appearances::AppearanceFlagMarket)}, - { 332, 344, -1, sizeof(::Canary::protobuf::appearances::AppearanceFlagNPC)}, - { 350, 357, -1, sizeof(::Canary::protobuf::appearances::AppearanceFlagAutomap)}, - { 358, 365, -1, sizeof(::Canary::protobuf::appearances::AppearanceFlagHook)}, - { 366, 373, -1, sizeof(::Canary::protobuf::appearances::AppearanceFlagLenshelp)}, - { 374, 381, -1, sizeof(::Canary::protobuf::appearances::AppearanceFlagChangedToExpire)}, - { 382, 389, -1, sizeof(::Canary::protobuf::appearances::AppearanceFlagCyclopedia)}, - { 390, 402, -1, sizeof(::Canary::protobuf::appearances::SpecialMeaningAppearanceIds)}, + { 122, 185, -1, sizeof(::Canary::protobuf::appearances::AppearanceFlags)}, + { 242, 249, -1, sizeof(::Canary::protobuf::appearances::AppearanceFlagUpgradeClassification)}, + { 250, 257, -1, sizeof(::Canary::protobuf::appearances::AppearanceFlagBank)}, + { 258, 265, -1, sizeof(::Canary::protobuf::appearances::AppearanceFlagWrite)}, + { 266, 273, -1, sizeof(::Canary::protobuf::appearances::AppearanceFlagWriteOnce)}, + { 274, 282, -1, sizeof(::Canary::protobuf::appearances::AppearanceFlagLight)}, + { 284, 291, -1, sizeof(::Canary::protobuf::appearances::AppearanceFlagHeight)}, + { 292, 300, -1, sizeof(::Canary::protobuf::appearances::AppearanceFlagShift)}, + { 302, 309, -1, sizeof(::Canary::protobuf::appearances::AppearanceFlagClothes)}, + { 310, 317, -1, sizeof(::Canary::protobuf::appearances::AppearanceFlagDefaultAction)}, + { 318, 329, -1, sizeof(::Canary::protobuf::appearances::AppearanceFlagMarket)}, + { 334, 346, -1, sizeof(::Canary::protobuf::appearances::AppearanceFlagNPC)}, + { 352, 359, -1, sizeof(::Canary::protobuf::appearances::AppearanceFlagAutomap)}, + { 360, 367, -1, sizeof(::Canary::protobuf::appearances::AppearanceFlagHook)}, + { 368, 375, -1, sizeof(::Canary::protobuf::appearances::AppearanceFlagLenshelp)}, + { 376, 383, -1, sizeof(::Canary::protobuf::appearances::AppearanceFlagChangedToExpire)}, + { 384, 391, -1, sizeof(::Canary::protobuf::appearances::AppearanceFlagCyclopedia)}, + { 392, 405, -1, sizeof(::Canary::protobuf::appearances::SpecialMeaningAppearanceIds)}, }; static const ::_pb::Message* const file_default_instances[] = { @@ -999,7 +1005,7 @@ const char descriptor_table_protodef_appearances_2eproto[] PROTOBUF_SECTION_VARI "2\'.Canary.protobuf.appearances.FrameGrou" "p\022;\n\005flags\030\003 \001(\0132,.Canary.protobuf.appea" "rances.AppearanceFlags\022\014\n\004name\030\004 \001(\014\022\023\n\013" - "description\030\005 \001(\014\"\235\017\n\017AppearanceFlags\022=\n" + "description\030\005 \001(\014\"\256\017\n\017AppearanceFlags\022=\n" "\004bank\030\001 \001(\0132/.Canary.protobuf.appearance" "s.AppearanceFlagBank\022\014\n\004clip\030\002 \001(\010\022\016\n\006bo" "ttom\030\003 \001(\010\022\013\n\003top\030\004 \001(\010\022\021\n\tcontainer\030\005 \001" @@ -1048,81 +1054,82 @@ const char descriptor_table_protodef_appearances_2eproto[] PROTOBUF_SECTION_VARI "everse_addons_south\0303 \001(\010\022\034\n\024reverse_add" "ons_north\0304 \001(\010\022\017\n\007wearout\0305 \001(\010\022\023\n\013cloc" "kexpire\0306 \001(\010\022\016\n\006expire\0307 \001(\010\022\022\n\nexpires" - "top\0308 \001(\010\"E\n#AppearanceFlagUpgradeClassi" - "fication\022\036\n\026upgrade_classification\030\001 \001(\r" - "\"\'\n\022AppearanceFlagBank\022\021\n\twaypoints\030\001 \001(" - "\r\".\n\023AppearanceFlagWrite\022\027\n\017max_text_len" - "gth\030\001 \001(\r\"7\n\027AppearanceFlagWriteOnce\022\034\n\024" - "max_text_length_once\030\001 \001(\r\"8\n\023Appearance" - "FlagLight\022\022\n\nbrightness\030\001 \001(\r\022\r\n\005color\030\002" - " \001(\r\")\n\024AppearanceFlagHeight\022\021\n\televatio" - "n\030\001 \001(\r\"+\n\023AppearanceFlagShift\022\t\n\001x\030\001 \001(" - "\r\022\t\n\001y\030\002 \001(\r\"%\n\025AppearanceFlagClothes\022\014\n" - "\004slot\030\001 \001(\r\"Y\n\033AppearanceFlagDefaultActi" - "on\022:\n\006action\030\001 \001(\0162*.Canary.protobuf.app" - "earances.PLAYER_ACTION\"\362\001\n\024AppearanceFla" - "gMarket\022<\n\010category\030\001 \001(\0162*.Canary.proto" - "buf.appearances.ITEM_CATEGORY\022\032\n\022trade_a" - "s_object_id\030\002 \001(\r\022\031\n\021show_as_object_id\030\003" - " \001(\r\022N\n\026restrict_to_profession\030\005 \003(\0162..C" - "anary.protobuf.appearances.PLAYER_PROFES" - "SION\022\025\n\rminimum_level\030\006 \001(\r\"\245\001\n\021Appearan" - "ceFlagNPC\022\014\n\004name\030\001 \001(\014\022\020\n\010location\030\002 \001(" - "\014\022\022\n\nsale_price\030\003 \001(\r\022\021\n\tbuy_price\030\004 \001(\r" - "\022\037\n\027currency_object_type_id\030\005 \001(\r\022(\n cur" - "rency_quest_flag_display_name\030\006 \001(\014\"&\n\025A" - "ppearanceFlagAutomap\022\r\n\005color\030\001 \001(\r\"O\n\022A" - "ppearanceFlagHook\0229\n\tdirection\030\001 \001(\0162&.C" - "anary.protobuf.appearances.HOOK_TYPE\"$\n\026" - "AppearanceFlagLenshelp\022\n\n\002id\030\001 \001(\r\"=\n\035Ap" - "pearanceFlagChangedToExpire\022\034\n\024former_ob" - "ject_typeid\030\001 \001(\r\"3\n\030AppearanceFlagCyclo" - "pedia\022\027\n\017cyclopedia_type\030\001 \001(\r\"\261\001\n\033Speci" - "alMeaningAppearanceIds\022\024\n\014gold_coin_id\030\001" - " \001(\r\022\030\n\020platinum_coin_id\030\002 \001(\r\022\027\n\017crysta" - "l_coin_id\030\003 \001(\r\022\025\n\rtibia_coin_id\030\004 \001(\r\022\031" - "\n\021stamped_letter_id\030\005 \001(\r\022\027\n\017supply_stas" - "h_id\030\006 \001(\r*\224\001\n\rPLAYER_ACTION\022\026\n\022PLAYER_A" - "CTION_NONE\020\000\022\026\n\022PLAYER_ACTION_LOOK\020\001\022\025\n\021" - "PLAYER_ACTION_USE\020\002\022\026\n\022PLAYER_ACTION_OPE" - "N\020\003\022$\n PLAYER_ACTION_AUTOWALK_HIGHLIGHT\020" - "\004*\315\005\n\rITEM_CATEGORY\022\030\n\024ITEM_CATEGORY_ARM" - "ORS\020\001\022\031\n\025ITEM_CATEGORY_AMULETS\020\002\022\027\n\023ITEM" - "_CATEGORY_BOOTS\020\003\022\034\n\030ITEM_CATEGORY_CONTA" - "INERS\020\004\022\034\n\030ITEM_CATEGORY_DECORATION\020\005\022\026\n" - "\022ITEM_CATEGORY_FOOD\020\006\022\036\n\032ITEM_CATEGORY_H" - "ELMETS_HATS\020\007\022\026\n\022ITEM_CATEGORY_LEGS\020\010\022\030\n" - "\024ITEM_CATEGORY_OTHERS\020\t\022\031\n\025ITEM_CATEGORY" - "_POTIONS\020\n\022\027\n\023ITEM_CATEGORY_RINGS\020\013\022\027\n\023I" - "TEM_CATEGORY_RUNES\020\014\022\031\n\025ITEM_CATEGORY_SH" - "IELDS\020\r\022\027\n\023ITEM_CATEGORY_TOOLS\020\016\022\033\n\027ITEM" - "_CATEGORY_VALUABLES\020\017\022\034\n\030ITEM_CATEGORY_A" - "MMUNITION\020\020\022\026\n\022ITEM_CATEGORY_AXES\020\021\022\027\n\023I" - "TEM_CATEGORY_CLUBS\020\022\022\"\n\036ITEM_CATEGORY_DI" - "STANCE_WEAPONS\020\023\022\030\n\024ITEM_CATEGORY_SWORDS" - "\020\024\022\034\n\030ITEM_CATEGORY_WANDS_RODS\020\025\022!\n\035ITEM" - "_CATEGORY_PREMIUM_SCROLLS\020\026\022\035\n\031ITEM_CATE" - "GORY_TIBIA_COINS\020\027\022#\n\037ITEM_CATEGORY_CREA" - "TURE_PRODUCTS\020\030\022\030\n\024ITEM_CATEGORY_QUIVER\020" - "\031*\355\001\n\021PLAYER_PROFESSION\022\"\n\025PLAYER_PROFES" - "SION_ANY\020\377\377\377\377\377\377\377\377\377\001\022\032\n\026PLAYER_PROFESSION" - "_NONE\020\000\022\034\n\030PLAYER_PROFESSION_KNIGHT\020\001\022\035\n" - "\031PLAYER_PROFESSION_PALADIN\020\002\022\036\n\032PLAYER_P" - "ROFESSION_SORCERER\020\003\022\033\n\027PLAYER_PROFESSIO" - "N_DRUID\020\004\022\036\n\032PLAYER_PROFESSION_PROMOTED\020" - "\n*\203\001\n\023ANIMATION_LOOP_TYPE\022)\n\034ANIMATION_L" - "OOP_TYPE_PINGPONG\020\377\377\377\377\377\377\377\377\377\001\022 \n\034ANIMATIO" - "N_LOOP_TYPE_INFINITE\020\000\022\037\n\033ANIMATION_LOOP" - "_TYPE_COUNTED\020\001*4\n\tHOOK_TYPE\022\023\n\017HOOK_TYP" - "E_SOUTH\020\001\022\022\n\016HOOK_TYPE_EAST\020\002*\201\001\n\021FIXED_" - "FRAME_GROUP\022!\n\035FIXED_FRAME_GROUP_OUTFIT_" - "IDLE\020\000\022#\n\037FIXED_FRAME_GROUP_OUTFIT_MOVIN" - "G\020\001\022$\n FIXED_FRAME_GROUP_OBJECT_INITIAL\020" - "\002" + "top\0308 \001(\010\022\017\n\007wrapkit\0309 \001(\010\"E\n#Appearance" + "FlagUpgradeClassification\022\036\n\026upgrade_cla" + "ssification\030\001 \001(\r\"\'\n\022AppearanceFlagBank\022" + "\021\n\twaypoints\030\001 \001(\r\".\n\023AppearanceFlagWrit" + "e\022\027\n\017max_text_length\030\001 \001(\r\"7\n\027Appearance" + "FlagWriteOnce\022\034\n\024max_text_length_once\030\001 " + "\001(\r\"8\n\023AppearanceFlagLight\022\022\n\nbrightness" + "\030\001 \001(\r\022\r\n\005color\030\002 \001(\r\")\n\024AppearanceFlagH" + "eight\022\021\n\televation\030\001 \001(\r\"+\n\023AppearanceFl" + "agShift\022\t\n\001x\030\001 \001(\r\022\t\n\001y\030\002 \001(\r\"%\n\025Appeara" + "nceFlagClothes\022\014\n\004slot\030\001 \001(\r\"Y\n\033Appearan" + "ceFlagDefaultAction\022:\n\006action\030\001 \001(\0162*.Ca" + "nary.protobuf.appearances.PLAYER_ACTION\"" + "\362\001\n\024AppearanceFlagMarket\022<\n\010category\030\001 \001" + "(\0162*.Canary.protobuf.appearances.ITEM_CA" + "TEGORY\022\032\n\022trade_as_object_id\030\002 \001(\r\022\031\n\021sh" + "ow_as_object_id\030\003 \001(\r\022N\n\026restrict_to_pro" + "fession\030\005 \003(\0162..Canary.protobuf.appearan" + "ces.PLAYER_PROFESSION\022\025\n\rminimum_level\030\006" + " \001(\r\"\245\001\n\021AppearanceFlagNPC\022\014\n\004name\030\001 \001(\014" + "\022\020\n\010location\030\002 \001(\014\022\022\n\nsale_price\030\003 \001(\r\022\021" + "\n\tbuy_price\030\004 \001(\r\022\037\n\027currency_object_typ" + "e_id\030\005 \001(\r\022(\n currency_quest_flag_displa" + "y_name\030\006 \001(\014\"&\n\025AppearanceFlagAutomap\022\r\n" + "\005color\030\001 \001(\r\"O\n\022AppearanceFlagHook\0229\n\tdi" + "rection\030\001 \001(\0162&.Canary.protobuf.appearan" + "ces.HOOK_TYPE\"$\n\026AppearanceFlagLenshelp\022" + "\n\n\002id\030\001 \001(\r\"=\n\035AppearanceFlagChangedToEx" + "pire\022\034\n\024former_object_typeid\030\001 \001(\r\"3\n\030Ap" + "pearanceFlagCyclopedia\022\027\n\017cyclopedia_typ" + "e\030\001 \001(\r\"\312\001\n\033SpecialMeaningAppearanceIds\022" + "\024\n\014gold_coin_id\030\001 \001(\r\022\030\n\020platinum_coin_i" + "d\030\002 \001(\r\022\027\n\017crystal_coin_id\030\003 \001(\r\022\025\n\rtibi" + "a_coin_id\030\004 \001(\r\022\031\n\021stamped_letter_id\030\005 \001" + "(\r\022\027\n\017supply_stash_id\030\006 \001(\r\022\027\n\017reward_ch" + "est_id\030\007 \001(\r*\224\001\n\rPLAYER_ACTION\022\026\n\022PLAYER" + "_ACTION_NONE\020\000\022\026\n\022PLAYER_ACTION_LOOK\020\001\022\025" + "\n\021PLAYER_ACTION_USE\020\002\022\026\n\022PLAYER_ACTION_O" + "PEN\020\003\022$\n PLAYER_ACTION_AUTOWALK_HIGHLIGH" + "T\020\004*\315\005\n\rITEM_CATEGORY\022\030\n\024ITEM_CATEGORY_A" + "RMORS\020\001\022\031\n\025ITEM_CATEGORY_AMULETS\020\002\022\027\n\023IT" + "EM_CATEGORY_BOOTS\020\003\022\034\n\030ITEM_CATEGORY_CON" + "TAINERS\020\004\022\034\n\030ITEM_CATEGORY_DECORATION\020\005\022" + "\026\n\022ITEM_CATEGORY_FOOD\020\006\022\036\n\032ITEM_CATEGORY" + "_HELMETS_HATS\020\007\022\026\n\022ITEM_CATEGORY_LEGS\020\010\022" + "\030\n\024ITEM_CATEGORY_OTHERS\020\t\022\031\n\025ITEM_CATEGO" + "RY_POTIONS\020\n\022\027\n\023ITEM_CATEGORY_RINGS\020\013\022\027\n" + "\023ITEM_CATEGORY_RUNES\020\014\022\031\n\025ITEM_CATEGORY_" + "SHIELDS\020\r\022\027\n\023ITEM_CATEGORY_TOOLS\020\016\022\033\n\027IT" + "EM_CATEGORY_VALUABLES\020\017\022\034\n\030ITEM_CATEGORY" + "_AMMUNITION\020\020\022\026\n\022ITEM_CATEGORY_AXES\020\021\022\027\n" + "\023ITEM_CATEGORY_CLUBS\020\022\022\"\n\036ITEM_CATEGORY_" + "DISTANCE_WEAPONS\020\023\022\030\n\024ITEM_CATEGORY_SWOR" + "DS\020\024\022\034\n\030ITEM_CATEGORY_WANDS_RODS\020\025\022!\n\035IT" + "EM_CATEGORY_PREMIUM_SCROLLS\020\026\022\035\n\031ITEM_CA" + "TEGORY_TIBIA_COINS\020\027\022#\n\037ITEM_CATEGORY_CR" + "EATURE_PRODUCTS\020\030\022\030\n\024ITEM_CATEGORY_QUIVE" + "R\020\031*\355\001\n\021PLAYER_PROFESSION\022\"\n\025PLAYER_PROF" + "ESSION_ANY\020\377\377\377\377\377\377\377\377\377\001\022\032\n\026PLAYER_PROFESSI" + "ON_NONE\020\000\022\034\n\030PLAYER_PROFESSION_KNIGHT\020\001\022" + "\035\n\031PLAYER_PROFESSION_PALADIN\020\002\022\036\n\032PLAYER" + "_PROFESSION_SORCERER\020\003\022\033\n\027PLAYER_PROFESS" + "ION_DRUID\020\004\022\036\n\032PLAYER_PROFESSION_PROMOTE" + "D\020\n*\203\001\n\023ANIMATION_LOOP_TYPE\022)\n\034ANIMATION" + "_LOOP_TYPE_PINGPONG\020\377\377\377\377\377\377\377\377\377\001\022 \n\034ANIMAT" + "ION_LOOP_TYPE_INFINITE\020\000\022\037\n\033ANIMATION_LO" + "OP_TYPE_COUNTED\020\001*4\n\tHOOK_TYPE\022\023\n\017HOOK_T" + "YPE_SOUTH\020\001\022\022\n\016HOOK_TYPE_EAST\020\002*\201\001\n\021FIXE" + "D_FRAME_GROUP\022!\n\035FIXED_FRAME_GROUP_OUTFI" + "T_IDLE\020\000\022#\n\037FIXED_FRAME_GROUP_OUTFIT_MOV" + "ING\020\001\022$\n FIXED_FRAME_GROUP_OBJECT_INITIA" + "L\020\002" ; static ::_pbi::once_flag descriptor_table_appearances_2eproto_once; const ::_pbi::DescriptorTable descriptor_table_appearances_2eproto = { - false, false, 6201, descriptor_table_protodef_appearances_2eproto, + false, false, 6243, descriptor_table_protodef_appearances_2eproto, "appearances.proto", &descriptor_table_appearances_2eproto_once, nullptr, 0, 26, schemas, file_default_instances, TableStruct_appearances_2eproto::offsets, @@ -4077,6 +4084,9 @@ class AppearanceFlags::_Internal { static void set_has_expirestop(HasBits* has_bits) { (*has_bits)[1] |= 4194304u; } + static void set_has_wrapkit(HasBits* has_bits) { + (*has_bits)[1] |= 8388608u; + } }; const ::Canary::protobuf::appearances::AppearanceFlagBank& @@ -4206,7 +4216,8 @@ AppearanceFlags::AppearanceFlags(const AppearanceFlags& from) , decltype(_impl_.wearout_){} , decltype(_impl_.clockexpire_){} , decltype(_impl_.expire_){} - , decltype(_impl_.expirestop_){}}; + , decltype(_impl_.expirestop_){} + , decltype(_impl_.wrapkit_){}}; _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); if (from._internal_has_bank()) { @@ -4255,8 +4266,8 @@ AppearanceFlags::AppearanceFlags(const AppearanceFlags& from) _this->_impl_.upgradeclassification_ = new ::Canary::protobuf::appearances::AppearanceFlagUpgradeClassification(*from._impl_.upgradeclassification_); } ::memcpy(&_impl_.clip_, &from._impl_.clip_, - static_cast(reinterpret_cast(&_impl_.expirestop_) - - reinterpret_cast(&_impl_.clip_)) + sizeof(_impl_.expirestop_)); + static_cast(reinterpret_cast(&_impl_.wrapkit_) - + reinterpret_cast(&_impl_.clip_)) + sizeof(_impl_.wrapkit_)); // @@protoc_insertion_point(copy_constructor:Canary.protobuf.appearances.AppearanceFlags) } @@ -4323,6 +4334,7 @@ inline void AppearanceFlags::SharedCtor( , decltype(_impl_.clockexpire_){false} , decltype(_impl_.expire_){false} , decltype(_impl_.expirestop_){false} + , decltype(_impl_.wrapkit_){false} }; } @@ -4453,10 +4465,10 @@ void AppearanceFlags::Clear() { reinterpret_cast(&_impl_.reverse_addons_east_) - reinterpret_cast(&_impl_.unwrap_)) + sizeof(_impl_.reverse_addons_east_)); } - if (cached_has_bits & 0x007f0000u) { + if (cached_has_bits & 0x00ff0000u) { ::memset(&_impl_.reverse_addons_west_, 0, static_cast( - reinterpret_cast(&_impl_.expirestop_) - - reinterpret_cast(&_impl_.reverse_addons_west_)) + sizeof(_impl_.expirestop_)); + reinterpret_cast(&_impl_.wrapkit_) - + reinterpret_cast(&_impl_.reverse_addons_west_)) + sizeof(_impl_.wrapkit_)); } _impl_._has_bits_.Clear(); _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); @@ -4961,6 +4973,15 @@ const char* AppearanceFlags::_InternalParse(const char* ptr, ::_pbi::ParseContex } else goto handle_unusual; continue; + // optional bool wrapkit = 57; + case 57: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 200)) { + _Internal::set_has_wrapkit(&_impl_._has_bits_); + _impl_.wrapkit_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; default: goto handle_unusual; } // switch @@ -5359,6 +5380,12 @@ uint8_t* AppearanceFlags::_InternalSerialize( target = ::_pbi::WireFormatLite::WriteBoolToArray(56, this->_internal_expirestop(), target); } + // optional bool wrapkit = 57; + if (cached_has_bits & 0x00800000u) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteBoolToArray(57, this->_internal_wrapkit(), target); + } + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { target = ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream); @@ -5666,7 +5693,7 @@ size_t AppearanceFlags::ByteSizeLong() const { } } - if (cached_has_bits & 0x007f0000u) { + if (cached_has_bits & 0x00ff0000u) { // optional bool reverse_addons_west = 50; if (cached_has_bits & 0x00010000u) { total_size += 2 + 1; @@ -5702,6 +5729,11 @@ size_t AppearanceFlags::ByteSizeLong() const { total_size += 2 + 1; } + // optional bool wrapkit = 57; + if (cached_has_bits & 0x00800000u) { + total_size += 2 + 1; + } + } return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_); } @@ -5900,7 +5932,7 @@ void AppearanceFlags::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const } _this->_impl_._has_bits_[1] |= cached_has_bits; } - if (cached_has_bits & 0x007f0000u) { + if (cached_has_bits & 0x00ff0000u) { if (cached_has_bits & 0x00010000u) { _this->_impl_.reverse_addons_west_ = from._impl_.reverse_addons_west_; } @@ -5922,6 +5954,9 @@ void AppearanceFlags::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const if (cached_has_bits & 0x00400000u) { _this->_impl_.expirestop_ = from._impl_.expirestop_; } + if (cached_has_bits & 0x00800000u) { + _this->_impl_.wrapkit_ = from._impl_.wrapkit_; + } _this->_impl_._has_bits_[1] |= cached_has_bits; } _this->_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); @@ -5945,8 +5980,8 @@ void AppearanceFlags::InternalSwap(AppearanceFlags* other) { swap(_impl_._has_bits_[1], other->_impl_._has_bits_[1]); _impl_.npcsaledata_.InternalSwap(&other->_impl_.npcsaledata_); ::PROTOBUF_NAMESPACE_ID::internal::memswap< - PROTOBUF_FIELD_OFFSET(AppearanceFlags, _impl_.expirestop_) - + sizeof(AppearanceFlags::_impl_.expirestop_) + PROTOBUF_FIELD_OFFSET(AppearanceFlags, _impl_.wrapkit_) + + sizeof(AppearanceFlags::_impl_.wrapkit_) - PROTOBUF_FIELD_OFFSET(AppearanceFlags, _impl_.bank_)>( reinterpret_cast(&_impl_.bank_), reinterpret_cast(&other->_impl_.bank_)); @@ -9523,6 +9558,9 @@ class SpecialMeaningAppearanceIds::_Internal { static void set_has_supply_stash_id(HasBits* has_bits) { (*has_bits)[0] |= 32u; } + static void set_has_reward_chest_id(HasBits* has_bits) { + (*has_bits)[0] |= 64u; + } }; SpecialMeaningAppearanceIds::SpecialMeaningAppearanceIds(::PROTOBUF_NAMESPACE_ID::Arena* arena, @@ -9542,12 +9580,13 @@ SpecialMeaningAppearanceIds::SpecialMeaningAppearanceIds(const SpecialMeaningApp , decltype(_impl_.crystal_coin_id_){} , decltype(_impl_.tibia_coin_id_){} , decltype(_impl_.stamped_letter_id_){} - , decltype(_impl_.supply_stash_id_){}}; + , decltype(_impl_.supply_stash_id_){} + , decltype(_impl_.reward_chest_id_){}}; _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); ::memcpy(&_impl_.gold_coin_id_, &from._impl_.gold_coin_id_, - static_cast(reinterpret_cast(&_impl_.supply_stash_id_) - - reinterpret_cast(&_impl_.gold_coin_id_)) + sizeof(_impl_.supply_stash_id_)); + static_cast(reinterpret_cast(&_impl_.reward_chest_id_) - + reinterpret_cast(&_impl_.gold_coin_id_)) + sizeof(_impl_.reward_chest_id_)); // @@protoc_insertion_point(copy_constructor:Canary.protobuf.appearances.SpecialMeaningAppearanceIds) } @@ -9564,6 +9603,7 @@ inline void SpecialMeaningAppearanceIds::SharedCtor( , decltype(_impl_.tibia_coin_id_){0u} , decltype(_impl_.stamped_letter_id_){0u} , decltype(_impl_.supply_stash_id_){0u} + , decltype(_impl_.reward_chest_id_){0u} }; } @@ -9591,10 +9631,10 @@ void SpecialMeaningAppearanceIds::Clear() { (void) cached_has_bits; cached_has_bits = _impl_._has_bits_[0]; - if (cached_has_bits & 0x0000003fu) { + if (cached_has_bits & 0x0000007fu) { ::memset(&_impl_.gold_coin_id_, 0, static_cast( - reinterpret_cast(&_impl_.supply_stash_id_) - - reinterpret_cast(&_impl_.gold_coin_id_)) + sizeof(_impl_.supply_stash_id_)); + reinterpret_cast(&_impl_.reward_chest_id_) - + reinterpret_cast(&_impl_.gold_coin_id_)) + sizeof(_impl_.reward_chest_id_)); } _impl_._has_bits_.Clear(); _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); @@ -9661,6 +9701,15 @@ const char* SpecialMeaningAppearanceIds::_InternalParse(const char* ptr, ::_pbi: } else goto handle_unusual; continue; + // optional uint32 reward_chest_id = 7; + case 7: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 56)) { + _Internal::set_has_reward_chest_id(&has_bits); + _impl_.reward_chest_id_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; default: goto handle_unusual; } // switch @@ -9728,6 +9777,12 @@ uint8_t* SpecialMeaningAppearanceIds::_InternalSerialize( target = ::_pbi::WireFormatLite::WriteUInt32ToArray(6, this->_internal_supply_stash_id(), target); } + // optional uint32 reward_chest_id = 7; + if (cached_has_bits & 0x00000040u) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteUInt32ToArray(7, this->_internal_reward_chest_id(), target); + } + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { target = ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream); @@ -9745,7 +9800,7 @@ size_t SpecialMeaningAppearanceIds::ByteSizeLong() const { (void) cached_has_bits; cached_has_bits = _impl_._has_bits_[0]; - if (cached_has_bits & 0x0000003fu) { + if (cached_has_bits & 0x0000007fu) { // optional uint32 gold_coin_id = 1; if (cached_has_bits & 0x00000001u) { total_size += ::_pbi::WireFormatLite::UInt32SizePlusOne(this->_internal_gold_coin_id()); @@ -9776,6 +9831,11 @@ size_t SpecialMeaningAppearanceIds::ByteSizeLong() const { total_size += ::_pbi::WireFormatLite::UInt32SizePlusOne(this->_internal_supply_stash_id()); } + // optional uint32 reward_chest_id = 7; + if (cached_has_bits & 0x00000040u) { + total_size += ::_pbi::WireFormatLite::UInt32SizePlusOne(this->_internal_reward_chest_id()); + } + } return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_); } @@ -9796,7 +9856,7 @@ void SpecialMeaningAppearanceIds::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to (void) cached_has_bits; cached_has_bits = from._impl_._has_bits_[0]; - if (cached_has_bits & 0x0000003fu) { + if (cached_has_bits & 0x0000007fu) { if (cached_has_bits & 0x00000001u) { _this->_impl_.gold_coin_id_ = from._impl_.gold_coin_id_; } @@ -9815,6 +9875,9 @@ void SpecialMeaningAppearanceIds::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to if (cached_has_bits & 0x00000020u) { _this->_impl_.supply_stash_id_ = from._impl_.supply_stash_id_; } + if (cached_has_bits & 0x00000040u) { + _this->_impl_.reward_chest_id_ = from._impl_.reward_chest_id_; + } _this->_impl_._has_bits_[0] |= cached_has_bits; } _this->_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); @@ -9836,8 +9899,8 @@ void SpecialMeaningAppearanceIds::InternalSwap(SpecialMeaningAppearanceIds* othe _internal_metadata_.InternalSwap(&other->_internal_metadata_); swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]); ::PROTOBUF_NAMESPACE_ID::internal::memswap< - PROTOBUF_FIELD_OFFSET(SpecialMeaningAppearanceIds, _impl_.supply_stash_id_) - + sizeof(SpecialMeaningAppearanceIds::_impl_.supply_stash_id_) + PROTOBUF_FIELD_OFFSET(SpecialMeaningAppearanceIds, _impl_.reward_chest_id_) + + sizeof(SpecialMeaningAppearanceIds::_impl_.reward_chest_id_) - PROTOBUF_FIELD_OFFSET(SpecialMeaningAppearanceIds, _impl_.gold_coin_id_)>( reinterpret_cast(&_impl_.gold_coin_id_), reinterpret_cast(&other->_impl_.gold_coin_id_)); diff --git a/src/protobuf/appearances.pb.h b/src/protobuf/appearances.pb.h index 64f6a7485..65bc2c7e9 100644 --- a/src/protobuf/appearances.pb.h +++ b/src/protobuf/appearances.pb.h @@ -2307,6 +2307,7 @@ class AppearanceFlags final : kClockexpireFieldNumber = 54, kExpireFieldNumber = 55, kExpirestopFieldNumber = 56, + kWrapkitFieldNumber = 57, }; // repeated .Canary.protobuf.appearances.AppearanceFlagNPC npcsaledata = 40; int npcsaledata_size() const; @@ -3116,6 +3117,19 @@ class AppearanceFlags final : void _internal_set_expirestop(bool value); public: + // optional bool wrapkit = 57; + bool has_wrapkit() const; + private: + bool _internal_has_wrapkit() const; + public: + void clear_wrapkit(); + bool wrapkit() const; + void set_wrapkit(bool value); + private: + bool _internal_wrapkit() const; + void _internal_set_wrapkit(bool value); + public: + // @@protoc_insertion_point(class_scope:Canary.protobuf.appearances.AppearanceFlags) private: class _Internal; @@ -3182,6 +3196,7 @@ class AppearanceFlags final : bool clockexpire_; bool expire_; bool expirestop_; + bool wrapkit_; }; union { Impl_ _impl_; }; friend struct ::TableStruct_appearances_2eproto; @@ -6066,6 +6081,7 @@ class SpecialMeaningAppearanceIds final : kTibiaCoinIdFieldNumber = 4, kStampedLetterIdFieldNumber = 5, kSupplyStashIdFieldNumber = 6, + kRewardChestIdFieldNumber = 7, }; // optional uint32 gold_coin_id = 1; bool has_gold_coin_id() const; @@ -6145,6 +6161,19 @@ class SpecialMeaningAppearanceIds final : void _internal_set_supply_stash_id(uint32_t value); public: + // optional uint32 reward_chest_id = 7; + bool has_reward_chest_id() const; + private: + bool _internal_has_reward_chest_id() const; + public: + void clear_reward_chest_id(); + uint32_t reward_chest_id() const; + void set_reward_chest_id(uint32_t value); + private: + uint32_t _internal_reward_chest_id() const; + void _internal_set_reward_chest_id(uint32_t value); + public: + // @@protoc_insertion_point(class_scope:Canary.protobuf.appearances.SpecialMeaningAppearanceIds) private: class _Internal; @@ -6161,6 +6190,7 @@ class SpecialMeaningAppearanceIds final : uint32_t tibia_coin_id_; uint32_t stamped_letter_id_; uint32_t supply_stash_id_; + uint32_t reward_chest_id_; }; union { Impl_ _impl_; }; friend struct ::TableStruct_appearances_2eproto; @@ -10187,6 +10217,34 @@ inline void AppearanceFlags::set_expirestop(bool value) { // @@protoc_insertion_point(field_set:Canary.protobuf.appearances.AppearanceFlags.expirestop) } +// optional bool wrapkit = 57; +inline bool AppearanceFlags::_internal_has_wrapkit() const { + bool value = (_impl_._has_bits_[1] & 0x00800000u) != 0; + return value; +} +inline bool AppearanceFlags::has_wrapkit() const { + return _internal_has_wrapkit(); +} +inline void AppearanceFlags::clear_wrapkit() { + _impl_.wrapkit_ = false; + _impl_._has_bits_[1] &= ~0x00800000u; +} +inline bool AppearanceFlags::_internal_wrapkit() const { + return _impl_.wrapkit_; +} +inline bool AppearanceFlags::wrapkit() const { + // @@protoc_insertion_point(field_get:Canary.protobuf.appearances.AppearanceFlags.wrapkit) + return _internal_wrapkit(); +} +inline void AppearanceFlags::_internal_set_wrapkit(bool value) { + _impl_._has_bits_[1] |= 0x00800000u; + _impl_.wrapkit_ = value; +} +inline void AppearanceFlags::set_wrapkit(bool value) { + _internal_set_wrapkit(value); + // @@protoc_insertion_point(field_set:Canary.protobuf.appearances.AppearanceFlags.wrapkit) +} + // ------------------------------------------------------------------- // AppearanceFlagUpgradeClassification @@ -11319,6 +11377,34 @@ inline void SpecialMeaningAppearanceIds::set_supply_stash_id(uint32_t value) { // @@protoc_insertion_point(field_set:Canary.protobuf.appearances.SpecialMeaningAppearanceIds.supply_stash_id) } +// optional uint32 reward_chest_id = 7; +inline bool SpecialMeaningAppearanceIds::_internal_has_reward_chest_id() const { + bool value = (_impl_._has_bits_[0] & 0x00000040u) != 0; + return value; +} +inline bool SpecialMeaningAppearanceIds::has_reward_chest_id() const { + return _internal_has_reward_chest_id(); +} +inline void SpecialMeaningAppearanceIds::clear_reward_chest_id() { + _impl_.reward_chest_id_ = 0u; + _impl_._has_bits_[0] &= ~0x00000040u; +} +inline uint32_t SpecialMeaningAppearanceIds::_internal_reward_chest_id() const { + return _impl_.reward_chest_id_; +} +inline uint32_t SpecialMeaningAppearanceIds::reward_chest_id() const { + // @@protoc_insertion_point(field_get:Canary.protobuf.appearances.SpecialMeaningAppearanceIds.reward_chest_id) + return _internal_reward_chest_id(); +} +inline void SpecialMeaningAppearanceIds::_internal_set_reward_chest_id(uint32_t value) { + _impl_._has_bits_[0] |= 0x00000040u; + _impl_.reward_chest_id_ = value; +} +inline void SpecialMeaningAppearanceIds::set_reward_chest_id(uint32_t value) { + _internal_set_reward_chest_id(value); + // @@protoc_insertion_point(field_set:Canary.protobuf.appearances.SpecialMeaningAppearanceIds.reward_chest_id) +} + #ifdef __GNUC__ #pragma GCC diagnostic pop #endif // __GNUC__ diff --git a/src/protobuf/appearances.pb.hpp b/src/protobuf/appearances.pb.hpp deleted file mode 100644 index 64f6a7485..000000000 --- a/src/protobuf/appearances.pb.hpp +++ /dev/null @@ -1,11420 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: appearances.proto - -#ifndef GOOGLE_PROTOBUF_INCLUDED_appearances_2eproto -#define GOOGLE_PROTOBUF_INCLUDED_appearances_2eproto - -#include -#include - -#include -#if PROTOBUF_VERSION < 3021000 -#error This file was generated by a newer version of protoc which is -#error incompatible with your Protocol Buffer headers. Please update -#error your headers. -#endif -#if 3021012 < PROTOBUF_MIN_PROTOC_VERSION -#error This file was generated by an older version of protoc which is -#error incompatible with your Protocol Buffer headers. Please -#error regenerate this file with a newer version of protoc. -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include // IWYU pragma: export -#include // IWYU pragma: export -#include -#include -// @@protoc_insertion_point(includes) -#include -#define PROTOBUF_INTERNAL_EXPORT_appearances_2eproto -PROTOBUF_NAMESPACE_OPEN -namespace internal { -class AnyMetadata; -} // namespace internal -PROTOBUF_NAMESPACE_CLOSE - -// Internal implementation detail -- do not use these members. -struct TableStruct_appearances_2eproto { - static const uint32_t offsets[]; -}; -extern const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_appearances_2eproto; -namespace Canary { -namespace protobuf { -namespace appearances { -class Appearance; -struct AppearanceDefaultTypeInternal; -extern AppearanceDefaultTypeInternal _Appearance_default_instance_; -class AppearanceFlagAutomap; -struct AppearanceFlagAutomapDefaultTypeInternal; -extern AppearanceFlagAutomapDefaultTypeInternal _AppearanceFlagAutomap_default_instance_; -class AppearanceFlagBank; -struct AppearanceFlagBankDefaultTypeInternal; -extern AppearanceFlagBankDefaultTypeInternal _AppearanceFlagBank_default_instance_; -class AppearanceFlagChangedToExpire; -struct AppearanceFlagChangedToExpireDefaultTypeInternal; -extern AppearanceFlagChangedToExpireDefaultTypeInternal _AppearanceFlagChangedToExpire_default_instance_; -class AppearanceFlagClothes; -struct AppearanceFlagClothesDefaultTypeInternal; -extern AppearanceFlagClothesDefaultTypeInternal _AppearanceFlagClothes_default_instance_; -class AppearanceFlagCyclopedia; -struct AppearanceFlagCyclopediaDefaultTypeInternal; -extern AppearanceFlagCyclopediaDefaultTypeInternal _AppearanceFlagCyclopedia_default_instance_; -class AppearanceFlagDefaultAction; -struct AppearanceFlagDefaultActionDefaultTypeInternal; -extern AppearanceFlagDefaultActionDefaultTypeInternal _AppearanceFlagDefaultAction_default_instance_; -class AppearanceFlagHeight; -struct AppearanceFlagHeightDefaultTypeInternal; -extern AppearanceFlagHeightDefaultTypeInternal _AppearanceFlagHeight_default_instance_; -class AppearanceFlagHook; -struct AppearanceFlagHookDefaultTypeInternal; -extern AppearanceFlagHookDefaultTypeInternal _AppearanceFlagHook_default_instance_; -class AppearanceFlagLenshelp; -struct AppearanceFlagLenshelpDefaultTypeInternal; -extern AppearanceFlagLenshelpDefaultTypeInternal _AppearanceFlagLenshelp_default_instance_; -class AppearanceFlagLight; -struct AppearanceFlagLightDefaultTypeInternal; -extern AppearanceFlagLightDefaultTypeInternal _AppearanceFlagLight_default_instance_; -class AppearanceFlagMarket; -struct AppearanceFlagMarketDefaultTypeInternal; -extern AppearanceFlagMarketDefaultTypeInternal _AppearanceFlagMarket_default_instance_; -class AppearanceFlagNPC; -struct AppearanceFlagNPCDefaultTypeInternal; -extern AppearanceFlagNPCDefaultTypeInternal _AppearanceFlagNPC_default_instance_; -class AppearanceFlagShift; -struct AppearanceFlagShiftDefaultTypeInternal; -extern AppearanceFlagShiftDefaultTypeInternal _AppearanceFlagShift_default_instance_; -class AppearanceFlagUpgradeClassification; -struct AppearanceFlagUpgradeClassificationDefaultTypeInternal; -extern AppearanceFlagUpgradeClassificationDefaultTypeInternal _AppearanceFlagUpgradeClassification_default_instance_; -class AppearanceFlagWrite; -struct AppearanceFlagWriteDefaultTypeInternal; -extern AppearanceFlagWriteDefaultTypeInternal _AppearanceFlagWrite_default_instance_; -class AppearanceFlagWriteOnce; -struct AppearanceFlagWriteOnceDefaultTypeInternal; -extern AppearanceFlagWriteOnceDefaultTypeInternal _AppearanceFlagWriteOnce_default_instance_; -class AppearanceFlags; -struct AppearanceFlagsDefaultTypeInternal; -extern AppearanceFlagsDefaultTypeInternal _AppearanceFlags_default_instance_; -class Appearances; -struct AppearancesDefaultTypeInternal; -extern AppearancesDefaultTypeInternal _Appearances_default_instance_; -class Box; -struct BoxDefaultTypeInternal; -extern BoxDefaultTypeInternal _Box_default_instance_; -class Coordinate; -struct CoordinateDefaultTypeInternal; -extern CoordinateDefaultTypeInternal _Coordinate_default_instance_; -class FrameGroup; -struct FrameGroupDefaultTypeInternal; -extern FrameGroupDefaultTypeInternal _FrameGroup_default_instance_; -class SpecialMeaningAppearanceIds; -struct SpecialMeaningAppearanceIdsDefaultTypeInternal; -extern SpecialMeaningAppearanceIdsDefaultTypeInternal _SpecialMeaningAppearanceIds_default_instance_; -class SpriteAnimation; -struct SpriteAnimationDefaultTypeInternal; -extern SpriteAnimationDefaultTypeInternal _SpriteAnimation_default_instance_; -class SpriteInfo; -struct SpriteInfoDefaultTypeInternal; -extern SpriteInfoDefaultTypeInternal _SpriteInfo_default_instance_; -class SpritePhase; -struct SpritePhaseDefaultTypeInternal; -extern SpritePhaseDefaultTypeInternal _SpritePhase_default_instance_; -} // namespace appearances -} // namespace protobuf -} // namespace Canary -PROTOBUF_NAMESPACE_OPEN -template<> ::Canary::protobuf::appearances::Appearance* Arena::CreateMaybeMessage<::Canary::protobuf::appearances::Appearance>(Arena*); -template<> ::Canary::protobuf::appearances::AppearanceFlagAutomap* Arena::CreateMaybeMessage<::Canary::protobuf::appearances::AppearanceFlagAutomap>(Arena*); -template<> ::Canary::protobuf::appearances::AppearanceFlagBank* Arena::CreateMaybeMessage<::Canary::protobuf::appearances::AppearanceFlagBank>(Arena*); -template<> ::Canary::protobuf::appearances::AppearanceFlagChangedToExpire* Arena::CreateMaybeMessage<::Canary::protobuf::appearances::AppearanceFlagChangedToExpire>(Arena*); -template<> ::Canary::protobuf::appearances::AppearanceFlagClothes* Arena::CreateMaybeMessage<::Canary::protobuf::appearances::AppearanceFlagClothes>(Arena*); -template<> ::Canary::protobuf::appearances::AppearanceFlagCyclopedia* Arena::CreateMaybeMessage<::Canary::protobuf::appearances::AppearanceFlagCyclopedia>(Arena*); -template<> ::Canary::protobuf::appearances::AppearanceFlagDefaultAction* Arena::CreateMaybeMessage<::Canary::protobuf::appearances::AppearanceFlagDefaultAction>(Arena*); -template<> ::Canary::protobuf::appearances::AppearanceFlagHeight* Arena::CreateMaybeMessage<::Canary::protobuf::appearances::AppearanceFlagHeight>(Arena*); -template<> ::Canary::protobuf::appearances::AppearanceFlagHook* Arena::CreateMaybeMessage<::Canary::protobuf::appearances::AppearanceFlagHook>(Arena*); -template<> ::Canary::protobuf::appearances::AppearanceFlagLenshelp* Arena::CreateMaybeMessage<::Canary::protobuf::appearances::AppearanceFlagLenshelp>(Arena*); -template<> ::Canary::protobuf::appearances::AppearanceFlagLight* Arena::CreateMaybeMessage<::Canary::protobuf::appearances::AppearanceFlagLight>(Arena*); -template<> ::Canary::protobuf::appearances::AppearanceFlagMarket* Arena::CreateMaybeMessage<::Canary::protobuf::appearances::AppearanceFlagMarket>(Arena*); -template<> ::Canary::protobuf::appearances::AppearanceFlagNPC* Arena::CreateMaybeMessage<::Canary::protobuf::appearances::AppearanceFlagNPC>(Arena*); -template<> ::Canary::protobuf::appearances::AppearanceFlagShift* Arena::CreateMaybeMessage<::Canary::protobuf::appearances::AppearanceFlagShift>(Arena*); -template<> ::Canary::protobuf::appearances::AppearanceFlagUpgradeClassification* Arena::CreateMaybeMessage<::Canary::protobuf::appearances::AppearanceFlagUpgradeClassification>(Arena*); -template<> ::Canary::protobuf::appearances::AppearanceFlagWrite* Arena::CreateMaybeMessage<::Canary::protobuf::appearances::AppearanceFlagWrite>(Arena*); -template<> ::Canary::protobuf::appearances::AppearanceFlagWriteOnce* Arena::CreateMaybeMessage<::Canary::protobuf::appearances::AppearanceFlagWriteOnce>(Arena*); -template<> ::Canary::protobuf::appearances::AppearanceFlags* Arena::CreateMaybeMessage<::Canary::protobuf::appearances::AppearanceFlags>(Arena*); -template<> ::Canary::protobuf::appearances::Appearances* Arena::CreateMaybeMessage<::Canary::protobuf::appearances::Appearances>(Arena*); -template<> ::Canary::protobuf::appearances::Box* Arena::CreateMaybeMessage<::Canary::protobuf::appearances::Box>(Arena*); -template<> ::Canary::protobuf::appearances::Coordinate* Arena::CreateMaybeMessage<::Canary::protobuf::appearances::Coordinate>(Arena*); -template<> ::Canary::protobuf::appearances::FrameGroup* Arena::CreateMaybeMessage<::Canary::protobuf::appearances::FrameGroup>(Arena*); -template<> ::Canary::protobuf::appearances::SpecialMeaningAppearanceIds* Arena::CreateMaybeMessage<::Canary::protobuf::appearances::SpecialMeaningAppearanceIds>(Arena*); -template<> ::Canary::protobuf::appearances::SpriteAnimation* Arena::CreateMaybeMessage<::Canary::protobuf::appearances::SpriteAnimation>(Arena*); -template<> ::Canary::protobuf::appearances::SpriteInfo* Arena::CreateMaybeMessage<::Canary::protobuf::appearances::SpriteInfo>(Arena*); -template<> ::Canary::protobuf::appearances::SpritePhase* Arena::CreateMaybeMessage<::Canary::protobuf::appearances::SpritePhase>(Arena*); -PROTOBUF_NAMESPACE_CLOSE -namespace Canary { -namespace protobuf { -namespace appearances { - -enum PLAYER_ACTION : int { - PLAYER_ACTION_NONE = 0, - PLAYER_ACTION_LOOK = 1, - PLAYER_ACTION_USE = 2, - PLAYER_ACTION_OPEN = 3, - PLAYER_ACTION_AUTOWALK_HIGHLIGHT = 4 -}; -bool PLAYER_ACTION_IsValid(int value); -constexpr PLAYER_ACTION PLAYER_ACTION_MIN = PLAYER_ACTION_NONE; -constexpr PLAYER_ACTION PLAYER_ACTION_MAX = PLAYER_ACTION_AUTOWALK_HIGHLIGHT; -constexpr int PLAYER_ACTION_ARRAYSIZE = PLAYER_ACTION_MAX + 1; - -const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* PLAYER_ACTION_descriptor(); -template -inline const std::string& PLAYER_ACTION_Name(T enum_t_value) { - static_assert(::std::is_same::value || - ::std::is_integral::value, - "Incorrect type passed to function PLAYER_ACTION_Name."); - return ::PROTOBUF_NAMESPACE_ID::internal::NameOfEnum( - PLAYER_ACTION_descriptor(), enum_t_value); -} -inline bool PLAYER_ACTION_Parse( - ::PROTOBUF_NAMESPACE_ID::ConstStringParam name, PLAYER_ACTION* value) { - return ::PROTOBUF_NAMESPACE_ID::internal::ParseNamedEnum( - PLAYER_ACTION_descriptor(), name, value); -} -enum ITEM_CATEGORY : int { - ITEM_CATEGORY_ARMORS = 1, - ITEM_CATEGORY_AMULETS = 2, - ITEM_CATEGORY_BOOTS = 3, - ITEM_CATEGORY_CONTAINERS = 4, - ITEM_CATEGORY_DECORATION = 5, - ITEM_CATEGORY_FOOD = 6, - ITEM_CATEGORY_HELMETS_HATS = 7, - ITEM_CATEGORY_LEGS = 8, - ITEM_CATEGORY_OTHERS = 9, - ITEM_CATEGORY_POTIONS = 10, - ITEM_CATEGORY_RINGS = 11, - ITEM_CATEGORY_RUNES = 12, - ITEM_CATEGORY_SHIELDS = 13, - ITEM_CATEGORY_TOOLS = 14, - ITEM_CATEGORY_VALUABLES = 15, - ITEM_CATEGORY_AMMUNITION = 16, - ITEM_CATEGORY_AXES = 17, - ITEM_CATEGORY_CLUBS = 18, - ITEM_CATEGORY_DISTANCE_WEAPONS = 19, - ITEM_CATEGORY_SWORDS = 20, - ITEM_CATEGORY_WANDS_RODS = 21, - ITEM_CATEGORY_PREMIUM_SCROLLS = 22, - ITEM_CATEGORY_TIBIA_COINS = 23, - ITEM_CATEGORY_CREATURE_PRODUCTS = 24, - ITEM_CATEGORY_QUIVER = 25 -}; -bool ITEM_CATEGORY_IsValid(int value); -constexpr ITEM_CATEGORY ITEM_CATEGORY_MIN = ITEM_CATEGORY_ARMORS; -constexpr ITEM_CATEGORY ITEM_CATEGORY_MAX = ITEM_CATEGORY_QUIVER; -constexpr int ITEM_CATEGORY_ARRAYSIZE = ITEM_CATEGORY_MAX + 1; - -const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* ITEM_CATEGORY_descriptor(); -template -inline const std::string& ITEM_CATEGORY_Name(T enum_t_value) { - static_assert(::std::is_same::value || - ::std::is_integral::value, - "Incorrect type passed to function ITEM_CATEGORY_Name."); - return ::PROTOBUF_NAMESPACE_ID::internal::NameOfEnum( - ITEM_CATEGORY_descriptor(), enum_t_value); -} -inline bool ITEM_CATEGORY_Parse( - ::PROTOBUF_NAMESPACE_ID::ConstStringParam name, ITEM_CATEGORY* value) { - return ::PROTOBUF_NAMESPACE_ID::internal::ParseNamedEnum( - ITEM_CATEGORY_descriptor(), name, value); -} -enum PLAYER_PROFESSION : int { - PLAYER_PROFESSION_ANY = -1, - PLAYER_PROFESSION_NONE = 0, - PLAYER_PROFESSION_KNIGHT = 1, - PLAYER_PROFESSION_PALADIN = 2, - PLAYER_PROFESSION_SORCERER = 3, - PLAYER_PROFESSION_DRUID = 4, - PLAYER_PROFESSION_PROMOTED = 10 -}; -bool PLAYER_PROFESSION_IsValid(int value); -constexpr PLAYER_PROFESSION PLAYER_PROFESSION_MIN = PLAYER_PROFESSION_ANY; -constexpr PLAYER_PROFESSION PLAYER_PROFESSION_MAX = PLAYER_PROFESSION_PROMOTED; -constexpr int PLAYER_PROFESSION_ARRAYSIZE = PLAYER_PROFESSION_MAX + 1; - -const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* PLAYER_PROFESSION_descriptor(); -template -inline const std::string& PLAYER_PROFESSION_Name(T enum_t_value) { - static_assert(::std::is_same::value || - ::std::is_integral::value, - "Incorrect type passed to function PLAYER_PROFESSION_Name."); - return ::PROTOBUF_NAMESPACE_ID::internal::NameOfEnum( - PLAYER_PROFESSION_descriptor(), enum_t_value); -} -inline bool PLAYER_PROFESSION_Parse( - ::PROTOBUF_NAMESPACE_ID::ConstStringParam name, PLAYER_PROFESSION* value) { - return ::PROTOBUF_NAMESPACE_ID::internal::ParseNamedEnum( - PLAYER_PROFESSION_descriptor(), name, value); -} -enum ANIMATION_LOOP_TYPE : int { - ANIMATION_LOOP_TYPE_PINGPONG = -1, - ANIMATION_LOOP_TYPE_INFINITE = 0, - ANIMATION_LOOP_TYPE_COUNTED = 1 -}; -bool ANIMATION_LOOP_TYPE_IsValid(int value); -constexpr ANIMATION_LOOP_TYPE ANIMATION_LOOP_TYPE_MIN = ANIMATION_LOOP_TYPE_PINGPONG; -constexpr ANIMATION_LOOP_TYPE ANIMATION_LOOP_TYPE_MAX = ANIMATION_LOOP_TYPE_COUNTED; -constexpr int ANIMATION_LOOP_TYPE_ARRAYSIZE = ANIMATION_LOOP_TYPE_MAX + 1; - -const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* ANIMATION_LOOP_TYPE_descriptor(); -template -inline const std::string& ANIMATION_LOOP_TYPE_Name(T enum_t_value) { - static_assert(::std::is_same::value || - ::std::is_integral::value, - "Incorrect type passed to function ANIMATION_LOOP_TYPE_Name."); - return ::PROTOBUF_NAMESPACE_ID::internal::NameOfEnum( - ANIMATION_LOOP_TYPE_descriptor(), enum_t_value); -} -inline bool ANIMATION_LOOP_TYPE_Parse( - ::PROTOBUF_NAMESPACE_ID::ConstStringParam name, ANIMATION_LOOP_TYPE* value) { - return ::PROTOBUF_NAMESPACE_ID::internal::ParseNamedEnum( - ANIMATION_LOOP_TYPE_descriptor(), name, value); -} -enum HOOK_TYPE : int { - HOOK_TYPE_SOUTH = 1, - HOOK_TYPE_EAST = 2 -}; -bool HOOK_TYPE_IsValid(int value); -constexpr HOOK_TYPE HOOK_TYPE_MIN = HOOK_TYPE_SOUTH; -constexpr HOOK_TYPE HOOK_TYPE_MAX = HOOK_TYPE_EAST; -constexpr int HOOK_TYPE_ARRAYSIZE = HOOK_TYPE_MAX + 1; - -const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* HOOK_TYPE_descriptor(); -template -inline const std::string& HOOK_TYPE_Name(T enum_t_value) { - static_assert(::std::is_same::value || - ::std::is_integral::value, - "Incorrect type passed to function HOOK_TYPE_Name."); - return ::PROTOBUF_NAMESPACE_ID::internal::NameOfEnum( - HOOK_TYPE_descriptor(), enum_t_value); -} -inline bool HOOK_TYPE_Parse( - ::PROTOBUF_NAMESPACE_ID::ConstStringParam name, HOOK_TYPE* value) { - return ::PROTOBUF_NAMESPACE_ID::internal::ParseNamedEnum( - HOOK_TYPE_descriptor(), name, value); -} -enum FIXED_FRAME_GROUP : int { - FIXED_FRAME_GROUP_OUTFIT_IDLE = 0, - FIXED_FRAME_GROUP_OUTFIT_MOVING = 1, - FIXED_FRAME_GROUP_OBJECT_INITIAL = 2 -}; -bool FIXED_FRAME_GROUP_IsValid(int value); -constexpr FIXED_FRAME_GROUP FIXED_FRAME_GROUP_MIN = FIXED_FRAME_GROUP_OUTFIT_IDLE; -constexpr FIXED_FRAME_GROUP FIXED_FRAME_GROUP_MAX = FIXED_FRAME_GROUP_OBJECT_INITIAL; -constexpr int FIXED_FRAME_GROUP_ARRAYSIZE = FIXED_FRAME_GROUP_MAX + 1; - -const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* FIXED_FRAME_GROUP_descriptor(); -template -inline const std::string& FIXED_FRAME_GROUP_Name(T enum_t_value) { - static_assert(::std::is_same::value || - ::std::is_integral::value, - "Incorrect type passed to function FIXED_FRAME_GROUP_Name."); - return ::PROTOBUF_NAMESPACE_ID::internal::NameOfEnum( - FIXED_FRAME_GROUP_descriptor(), enum_t_value); -} -inline bool FIXED_FRAME_GROUP_Parse( - ::PROTOBUF_NAMESPACE_ID::ConstStringParam name, FIXED_FRAME_GROUP* value) { - return ::PROTOBUF_NAMESPACE_ID::internal::ParseNamedEnum( - FIXED_FRAME_GROUP_descriptor(), name, value); -} -// =================================================================== - -class Coordinate final : - public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:Canary.protobuf.appearances.Coordinate) */ { - public: - inline Coordinate() : Coordinate(nullptr) {} - ~Coordinate() override; - explicit PROTOBUF_CONSTEXPR Coordinate(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); - - Coordinate(const Coordinate& from); - Coordinate(Coordinate&& from) noexcept - : Coordinate() { - *this = ::std::move(from); - } - - inline Coordinate& operator=(const Coordinate& from) { - CopyFrom(from); - return *this; - } - inline Coordinate& operator=(Coordinate&& from) noexcept { - if (this == &from) return *this; - if (GetOwningArena() == from.GetOwningArena() - #ifdef PROTOBUF_FORCE_COPY_IN_MOVE - && GetOwningArena() != nullptr - #endif // !PROTOBUF_FORCE_COPY_IN_MOVE - ) { - InternalSwap(&from); - } else { - CopyFrom(from); - } - return *this; - } - - inline const ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet& unknown_fields() const { - return _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance); - } - inline ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet* mutable_unknown_fields() { - return _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); - } - - static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { - return GetDescriptor(); - } - static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { - return default_instance().GetMetadata().descriptor; - } - static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { - return default_instance().GetMetadata().reflection; - } - static const Coordinate& default_instance() { - return *internal_default_instance(); - } - static inline const Coordinate* internal_default_instance() { - return reinterpret_cast( - &_Coordinate_default_instance_); - } - static constexpr int kIndexInFileMessages = - 0; - - friend void swap(Coordinate& a, Coordinate& b) { - a.Swap(&b); - } - inline void Swap(Coordinate* other) { - if (other == this) return; - #ifdef PROTOBUF_FORCE_COPY_IN_SWAP - if (GetOwningArena() != nullptr && - GetOwningArena() == other->GetOwningArena()) { - #else // PROTOBUF_FORCE_COPY_IN_SWAP - if (GetOwningArena() == other->GetOwningArena()) { - #endif // !PROTOBUF_FORCE_COPY_IN_SWAP - InternalSwap(other); - } else { - ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); - } - } - void UnsafeArenaSwap(Coordinate* other) { - if (other == this) return; - GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); - InternalSwap(other); - } - - // implements Message ---------------------------------------------- - - Coordinate* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { - return CreateMaybeMessage(arena); - } - using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; - void CopyFrom(const Coordinate& from); - using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; - void MergeFrom( const Coordinate& from) { - Coordinate::MergeImpl(*this, from); - } - private: - static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg); - public: - PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; - bool IsInitialized() const final; - - size_t ByteSizeLong() const final; - const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; - uint8_t* _InternalSerialize( - uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; - int GetCachedSize() const final { return _impl_._cached_size_.Get(); } - - private: - void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned); - void SharedDtor(); - void SetCachedSize(int size) const final; - void InternalSwap(Coordinate* other); - - private: - friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; - static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { - return "Canary.protobuf.appearances.Coordinate"; - } - protected: - explicit Coordinate(::PROTOBUF_NAMESPACE_ID::Arena* arena, - bool is_message_owned = false); - public: - - static const ClassData _class_data_; - const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; - - ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; - - // nested types ---------------------------------------------------- - - // accessors ------------------------------------------------------- - - enum : int { - kXFieldNumber = 1, - kYFieldNumber = 2, - kZFieldNumber = 3, - }; - // optional uint32 x = 1; - bool has_x() const; - private: - bool _internal_has_x() const; - public: - void clear_x(); - uint32_t x() const; - void set_x(uint32_t value); - private: - uint32_t _internal_x() const; - void _internal_set_x(uint32_t value); - public: - - // optional uint32 y = 2; - bool has_y() const; - private: - bool _internal_has_y() const; - public: - void clear_y(); - uint32_t y() const; - void set_y(uint32_t value); - private: - uint32_t _internal_y() const; - void _internal_set_y(uint32_t value); - public: - - // optional uint32 z = 3; - bool has_z() const; - private: - bool _internal_has_z() const; - public: - void clear_z(); - uint32_t z() const; - void set_z(uint32_t value); - private: - uint32_t _internal_z() const; - void _internal_set_z(uint32_t value); - public: - - // @@protoc_insertion_point(class_scope:Canary.protobuf.appearances.Coordinate) - private: - class _Internal; - - template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; - typedef void InternalArenaConstructable_; - typedef void DestructorSkippable_; - struct Impl_ { - ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; - mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; - uint32_t x_; - uint32_t y_; - uint32_t z_; - }; - union { Impl_ _impl_; }; - friend struct ::TableStruct_appearances_2eproto; -}; -// ------------------------------------------------------------------- - -class Appearances final : - public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:Canary.protobuf.appearances.Appearances) */ { - public: - inline Appearances() : Appearances(nullptr) {} - ~Appearances() override; - explicit PROTOBUF_CONSTEXPR Appearances(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); - - Appearances(const Appearances& from); - Appearances(Appearances&& from) noexcept - : Appearances() { - *this = ::std::move(from); - } - - inline Appearances& operator=(const Appearances& from) { - CopyFrom(from); - return *this; - } - inline Appearances& operator=(Appearances&& from) noexcept { - if (this == &from) return *this; - if (GetOwningArena() == from.GetOwningArena() - #ifdef PROTOBUF_FORCE_COPY_IN_MOVE - && GetOwningArena() != nullptr - #endif // !PROTOBUF_FORCE_COPY_IN_MOVE - ) { - InternalSwap(&from); - } else { - CopyFrom(from); - } - return *this; - } - - inline const ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet& unknown_fields() const { - return _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance); - } - inline ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet* mutable_unknown_fields() { - return _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); - } - - static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { - return GetDescriptor(); - } - static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { - return default_instance().GetMetadata().descriptor; - } - static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { - return default_instance().GetMetadata().reflection; - } - static const Appearances& default_instance() { - return *internal_default_instance(); - } - static inline const Appearances* internal_default_instance() { - return reinterpret_cast( - &_Appearances_default_instance_); - } - static constexpr int kIndexInFileMessages = - 1; - - friend void swap(Appearances& a, Appearances& b) { - a.Swap(&b); - } - inline void Swap(Appearances* other) { - if (other == this) return; - #ifdef PROTOBUF_FORCE_COPY_IN_SWAP - if (GetOwningArena() != nullptr && - GetOwningArena() == other->GetOwningArena()) { - #else // PROTOBUF_FORCE_COPY_IN_SWAP - if (GetOwningArena() == other->GetOwningArena()) { - #endif // !PROTOBUF_FORCE_COPY_IN_SWAP - InternalSwap(other); - } else { - ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); - } - } - void UnsafeArenaSwap(Appearances* other) { - if (other == this) return; - GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); - InternalSwap(other); - } - - // implements Message ---------------------------------------------- - - Appearances* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { - return CreateMaybeMessage(arena); - } - using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; - void CopyFrom(const Appearances& from); - using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; - void MergeFrom( const Appearances& from) { - Appearances::MergeImpl(*this, from); - } - private: - static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg); - public: - PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; - bool IsInitialized() const final; - - size_t ByteSizeLong() const final; - const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; - uint8_t* _InternalSerialize( - uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; - int GetCachedSize() const final { return _impl_._cached_size_.Get(); } - - private: - void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned); - void SharedDtor(); - void SetCachedSize(int size) const final; - void InternalSwap(Appearances* other); - - private: - friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; - static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { - return "Canary.protobuf.appearances.Appearances"; - } - protected: - explicit Appearances(::PROTOBUF_NAMESPACE_ID::Arena* arena, - bool is_message_owned = false); - public: - - static const ClassData _class_data_; - const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; - - ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; - - // nested types ---------------------------------------------------- - - // accessors ------------------------------------------------------- - - enum : int { - kObjectFieldNumber = 1, - kOutfitFieldNumber = 2, - kEffectFieldNumber = 3, - kMissileFieldNumber = 4, - kSpecialMeaningAppearanceIdsFieldNumber = 5, - }; - // repeated .Canary.protobuf.appearances.Appearance object = 1; - int object_size() const; - private: - int _internal_object_size() const; - public: - void clear_object(); - ::Canary::protobuf::appearances::Appearance* mutable_object(int index); - ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::Canary::protobuf::appearances::Appearance >* - mutable_object(); - private: - const ::Canary::protobuf::appearances::Appearance& _internal_object(int index) const; - ::Canary::protobuf::appearances::Appearance* _internal_add_object(); - public: - const ::Canary::protobuf::appearances::Appearance& object(int index) const; - ::Canary::protobuf::appearances::Appearance* add_object(); - const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::Canary::protobuf::appearances::Appearance >& - object() const; - - // repeated .Canary.protobuf.appearances.Appearance outfit = 2; - int outfit_size() const; - private: - int _internal_outfit_size() const; - public: - void clear_outfit(); - ::Canary::protobuf::appearances::Appearance* mutable_outfit(int index); - ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::Canary::protobuf::appearances::Appearance >* - mutable_outfit(); - private: - const ::Canary::protobuf::appearances::Appearance& _internal_outfit(int index) const; - ::Canary::protobuf::appearances::Appearance* _internal_add_outfit(); - public: - const ::Canary::protobuf::appearances::Appearance& outfit(int index) const; - ::Canary::protobuf::appearances::Appearance* add_outfit(); - const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::Canary::protobuf::appearances::Appearance >& - outfit() const; - - // repeated .Canary.protobuf.appearances.Appearance effect = 3; - int effect_size() const; - private: - int _internal_effect_size() const; - public: - void clear_effect(); - ::Canary::protobuf::appearances::Appearance* mutable_effect(int index); - ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::Canary::protobuf::appearances::Appearance >* - mutable_effect(); - private: - const ::Canary::protobuf::appearances::Appearance& _internal_effect(int index) const; - ::Canary::protobuf::appearances::Appearance* _internal_add_effect(); - public: - const ::Canary::protobuf::appearances::Appearance& effect(int index) const; - ::Canary::protobuf::appearances::Appearance* add_effect(); - const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::Canary::protobuf::appearances::Appearance >& - effect() const; - - // repeated .Canary.protobuf.appearances.Appearance missile = 4; - int missile_size() const; - private: - int _internal_missile_size() const; - public: - void clear_missile(); - ::Canary::protobuf::appearances::Appearance* mutable_missile(int index); - ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::Canary::protobuf::appearances::Appearance >* - mutable_missile(); - private: - const ::Canary::protobuf::appearances::Appearance& _internal_missile(int index) const; - ::Canary::protobuf::appearances::Appearance* _internal_add_missile(); - public: - const ::Canary::protobuf::appearances::Appearance& missile(int index) const; - ::Canary::protobuf::appearances::Appearance* add_missile(); - const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::Canary::protobuf::appearances::Appearance >& - missile() const; - - // optional .Canary.protobuf.appearances.SpecialMeaningAppearanceIds special_meaning_appearance_ids = 5; - bool has_special_meaning_appearance_ids() const; - private: - bool _internal_has_special_meaning_appearance_ids() const; - public: - void clear_special_meaning_appearance_ids(); - const ::Canary::protobuf::appearances::SpecialMeaningAppearanceIds& special_meaning_appearance_ids() const; - PROTOBUF_NODISCARD ::Canary::protobuf::appearances::SpecialMeaningAppearanceIds* release_special_meaning_appearance_ids(); - ::Canary::protobuf::appearances::SpecialMeaningAppearanceIds* mutable_special_meaning_appearance_ids(); - void set_allocated_special_meaning_appearance_ids(::Canary::protobuf::appearances::SpecialMeaningAppearanceIds* special_meaning_appearance_ids); - private: - const ::Canary::protobuf::appearances::SpecialMeaningAppearanceIds& _internal_special_meaning_appearance_ids() const; - ::Canary::protobuf::appearances::SpecialMeaningAppearanceIds* _internal_mutable_special_meaning_appearance_ids(); - public: - void unsafe_arena_set_allocated_special_meaning_appearance_ids( - ::Canary::protobuf::appearances::SpecialMeaningAppearanceIds* special_meaning_appearance_ids); - ::Canary::protobuf::appearances::SpecialMeaningAppearanceIds* unsafe_arena_release_special_meaning_appearance_ids(); - - // @@protoc_insertion_point(class_scope:Canary.protobuf.appearances.Appearances) - private: - class _Internal; - - template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; - typedef void InternalArenaConstructable_; - typedef void DestructorSkippable_; - struct Impl_ { - ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; - mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; - ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::Canary::protobuf::appearances::Appearance > object_; - ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::Canary::protobuf::appearances::Appearance > outfit_; - ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::Canary::protobuf::appearances::Appearance > effect_; - ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::Canary::protobuf::appearances::Appearance > missile_; - ::Canary::protobuf::appearances::SpecialMeaningAppearanceIds* special_meaning_appearance_ids_; - }; - union { Impl_ _impl_; }; - friend struct ::TableStruct_appearances_2eproto; -}; -// ------------------------------------------------------------------- - -class SpritePhase final : - public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:Canary.protobuf.appearances.SpritePhase) */ { - public: - inline SpritePhase() : SpritePhase(nullptr) {} - ~SpritePhase() override; - explicit PROTOBUF_CONSTEXPR SpritePhase(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); - - SpritePhase(const SpritePhase& from); - SpritePhase(SpritePhase&& from) noexcept - : SpritePhase() { - *this = ::std::move(from); - } - - inline SpritePhase& operator=(const SpritePhase& from) { - CopyFrom(from); - return *this; - } - inline SpritePhase& operator=(SpritePhase&& from) noexcept { - if (this == &from) return *this; - if (GetOwningArena() == from.GetOwningArena() - #ifdef PROTOBUF_FORCE_COPY_IN_MOVE - && GetOwningArena() != nullptr - #endif // !PROTOBUF_FORCE_COPY_IN_MOVE - ) { - InternalSwap(&from); - } else { - CopyFrom(from); - } - return *this; - } - - inline const ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet& unknown_fields() const { - return _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance); - } - inline ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet* mutable_unknown_fields() { - return _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); - } - - static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { - return GetDescriptor(); - } - static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { - return default_instance().GetMetadata().descriptor; - } - static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { - return default_instance().GetMetadata().reflection; - } - static const SpritePhase& default_instance() { - return *internal_default_instance(); - } - static inline const SpritePhase* internal_default_instance() { - return reinterpret_cast( - &_SpritePhase_default_instance_); - } - static constexpr int kIndexInFileMessages = - 2; - - friend void swap(SpritePhase& a, SpritePhase& b) { - a.Swap(&b); - } - inline void Swap(SpritePhase* other) { - if (other == this) return; - #ifdef PROTOBUF_FORCE_COPY_IN_SWAP - if (GetOwningArena() != nullptr && - GetOwningArena() == other->GetOwningArena()) { - #else // PROTOBUF_FORCE_COPY_IN_SWAP - if (GetOwningArena() == other->GetOwningArena()) { - #endif // !PROTOBUF_FORCE_COPY_IN_SWAP - InternalSwap(other); - } else { - ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); - } - } - void UnsafeArenaSwap(SpritePhase* other) { - if (other == this) return; - GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); - InternalSwap(other); - } - - // implements Message ---------------------------------------------- - - SpritePhase* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { - return CreateMaybeMessage(arena); - } - using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; - void CopyFrom(const SpritePhase& from); - using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; - void MergeFrom( const SpritePhase& from) { - SpritePhase::MergeImpl(*this, from); - } - private: - static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg); - public: - PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; - bool IsInitialized() const final; - - size_t ByteSizeLong() const final; - const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; - uint8_t* _InternalSerialize( - uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; - int GetCachedSize() const final { return _impl_._cached_size_.Get(); } - - private: - void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned); - void SharedDtor(); - void SetCachedSize(int size) const final; - void InternalSwap(SpritePhase* other); - - private: - friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; - static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { - return "Canary.protobuf.appearances.SpritePhase"; - } - protected: - explicit SpritePhase(::PROTOBUF_NAMESPACE_ID::Arena* arena, - bool is_message_owned = false); - public: - - static const ClassData _class_data_; - const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; - - ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; - - // nested types ---------------------------------------------------- - - // accessors ------------------------------------------------------- - - enum : int { - kDurationMinFieldNumber = 1, - kDurationMaxFieldNumber = 2, - }; - // optional uint32 duration_min = 1; - bool has_duration_min() const; - private: - bool _internal_has_duration_min() const; - public: - void clear_duration_min(); - uint32_t duration_min() const; - void set_duration_min(uint32_t value); - private: - uint32_t _internal_duration_min() const; - void _internal_set_duration_min(uint32_t value); - public: - - // optional uint32 duration_max = 2; - bool has_duration_max() const; - private: - bool _internal_has_duration_max() const; - public: - void clear_duration_max(); - uint32_t duration_max() const; - void set_duration_max(uint32_t value); - private: - uint32_t _internal_duration_max() const; - void _internal_set_duration_max(uint32_t value); - public: - - // @@protoc_insertion_point(class_scope:Canary.protobuf.appearances.SpritePhase) - private: - class _Internal; - - template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; - typedef void InternalArenaConstructable_; - typedef void DestructorSkippable_; - struct Impl_ { - ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; - mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; - uint32_t duration_min_; - uint32_t duration_max_; - }; - union { Impl_ _impl_; }; - friend struct ::TableStruct_appearances_2eproto; -}; -// ------------------------------------------------------------------- - -class SpriteAnimation final : - public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:Canary.protobuf.appearances.SpriteAnimation) */ { - public: - inline SpriteAnimation() : SpriteAnimation(nullptr) {} - ~SpriteAnimation() override; - explicit PROTOBUF_CONSTEXPR SpriteAnimation(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); - - SpriteAnimation(const SpriteAnimation& from); - SpriteAnimation(SpriteAnimation&& from) noexcept - : SpriteAnimation() { - *this = ::std::move(from); - } - - inline SpriteAnimation& operator=(const SpriteAnimation& from) { - CopyFrom(from); - return *this; - } - inline SpriteAnimation& operator=(SpriteAnimation&& from) noexcept { - if (this == &from) return *this; - if (GetOwningArena() == from.GetOwningArena() - #ifdef PROTOBUF_FORCE_COPY_IN_MOVE - && GetOwningArena() != nullptr - #endif // !PROTOBUF_FORCE_COPY_IN_MOVE - ) { - InternalSwap(&from); - } else { - CopyFrom(from); - } - return *this; - } - - inline const ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet& unknown_fields() const { - return _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance); - } - inline ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet* mutable_unknown_fields() { - return _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); - } - - static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { - return GetDescriptor(); - } - static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { - return default_instance().GetMetadata().descriptor; - } - static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { - return default_instance().GetMetadata().reflection; - } - static const SpriteAnimation& default_instance() { - return *internal_default_instance(); - } - static inline const SpriteAnimation* internal_default_instance() { - return reinterpret_cast( - &_SpriteAnimation_default_instance_); - } - static constexpr int kIndexInFileMessages = - 3; - - friend void swap(SpriteAnimation& a, SpriteAnimation& b) { - a.Swap(&b); - } - inline void Swap(SpriteAnimation* other) { - if (other == this) return; - #ifdef PROTOBUF_FORCE_COPY_IN_SWAP - if (GetOwningArena() != nullptr && - GetOwningArena() == other->GetOwningArena()) { - #else // PROTOBUF_FORCE_COPY_IN_SWAP - if (GetOwningArena() == other->GetOwningArena()) { - #endif // !PROTOBUF_FORCE_COPY_IN_SWAP - InternalSwap(other); - } else { - ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); - } - } - void UnsafeArenaSwap(SpriteAnimation* other) { - if (other == this) return; - GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); - InternalSwap(other); - } - - // implements Message ---------------------------------------------- - - SpriteAnimation* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { - return CreateMaybeMessage(arena); - } - using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; - void CopyFrom(const SpriteAnimation& from); - using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; - void MergeFrom( const SpriteAnimation& from) { - SpriteAnimation::MergeImpl(*this, from); - } - private: - static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg); - public: - PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; - bool IsInitialized() const final; - - size_t ByteSizeLong() const final; - const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; - uint8_t* _InternalSerialize( - uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; - int GetCachedSize() const final { return _impl_._cached_size_.Get(); } - - private: - void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned); - void SharedDtor(); - void SetCachedSize(int size) const final; - void InternalSwap(SpriteAnimation* other); - - private: - friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; - static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { - return "Canary.protobuf.appearances.SpriteAnimation"; - } - protected: - explicit SpriteAnimation(::PROTOBUF_NAMESPACE_ID::Arena* arena, - bool is_message_owned = false); - public: - - static const ClassData _class_data_; - const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; - - ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; - - // nested types ---------------------------------------------------- - - // accessors ------------------------------------------------------- - - enum : int { - kSpritePhaseFieldNumber = 6, - kDefaultStartPhaseFieldNumber = 1, - kSynchronizedFieldNumber = 2, - kRandomStartPhaseFieldNumber = 3, - kLoopCountFieldNumber = 5, - kLoopTypeFieldNumber = 4, - }; - // repeated .Canary.protobuf.appearances.SpritePhase sprite_phase = 6; - int sprite_phase_size() const; - private: - int _internal_sprite_phase_size() const; - public: - void clear_sprite_phase(); - ::Canary::protobuf::appearances::SpritePhase* mutable_sprite_phase(int index); - ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::Canary::protobuf::appearances::SpritePhase >* - mutable_sprite_phase(); - private: - const ::Canary::protobuf::appearances::SpritePhase& _internal_sprite_phase(int index) const; - ::Canary::protobuf::appearances::SpritePhase* _internal_add_sprite_phase(); - public: - const ::Canary::protobuf::appearances::SpritePhase& sprite_phase(int index) const; - ::Canary::protobuf::appearances::SpritePhase* add_sprite_phase(); - const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::Canary::protobuf::appearances::SpritePhase >& - sprite_phase() const; - - // optional uint32 default_start_phase = 1; - bool has_default_start_phase() const; - private: - bool _internal_has_default_start_phase() const; - public: - void clear_default_start_phase(); - uint32_t default_start_phase() const; - void set_default_start_phase(uint32_t value); - private: - uint32_t _internal_default_start_phase() const; - void _internal_set_default_start_phase(uint32_t value); - public: - - // optional bool synchronized = 2; - bool has_synchronized() const; - private: - bool _internal_has_synchronized() const; - public: - void clear_synchronized(); - bool synchronized() const; - void set_synchronized(bool value); - private: - bool _internal_synchronized() const; - void _internal_set_synchronized(bool value); - public: - - // optional bool random_start_phase = 3; - bool has_random_start_phase() const; - private: - bool _internal_has_random_start_phase() const; - public: - void clear_random_start_phase(); - bool random_start_phase() const; - void set_random_start_phase(bool value); - private: - bool _internal_random_start_phase() const; - void _internal_set_random_start_phase(bool value); - public: - - // optional uint32 loop_count = 5; - bool has_loop_count() const; - private: - bool _internal_has_loop_count() const; - public: - void clear_loop_count(); - uint32_t loop_count() const; - void set_loop_count(uint32_t value); - private: - uint32_t _internal_loop_count() const; - void _internal_set_loop_count(uint32_t value); - public: - - // optional .Canary.protobuf.appearances.ANIMATION_LOOP_TYPE loop_type = 4; - bool has_loop_type() const; - private: - bool _internal_has_loop_type() const; - public: - void clear_loop_type(); - ::Canary::protobuf::appearances::ANIMATION_LOOP_TYPE loop_type() const; - void set_loop_type(::Canary::protobuf::appearances::ANIMATION_LOOP_TYPE value); - private: - ::Canary::protobuf::appearances::ANIMATION_LOOP_TYPE _internal_loop_type() const; - void _internal_set_loop_type(::Canary::protobuf::appearances::ANIMATION_LOOP_TYPE value); - public: - - // @@protoc_insertion_point(class_scope:Canary.protobuf.appearances.SpriteAnimation) - private: - class _Internal; - - template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; - typedef void InternalArenaConstructable_; - typedef void DestructorSkippable_; - struct Impl_ { - ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; - mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; - ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::Canary::protobuf::appearances::SpritePhase > sprite_phase_; - uint32_t default_start_phase_; - bool synchronized_; - bool random_start_phase_; - uint32_t loop_count_; - int loop_type_; - }; - union { Impl_ _impl_; }; - friend struct ::TableStruct_appearances_2eproto; -}; -// ------------------------------------------------------------------- - -class Box final : - public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:Canary.protobuf.appearances.Box) */ { - public: - inline Box() : Box(nullptr) {} - ~Box() override; - explicit PROTOBUF_CONSTEXPR Box(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); - - Box(const Box& from); - Box(Box&& from) noexcept - : Box() { - *this = ::std::move(from); - } - - inline Box& operator=(const Box& from) { - CopyFrom(from); - return *this; - } - inline Box& operator=(Box&& from) noexcept { - if (this == &from) return *this; - if (GetOwningArena() == from.GetOwningArena() - #ifdef PROTOBUF_FORCE_COPY_IN_MOVE - && GetOwningArena() != nullptr - #endif // !PROTOBUF_FORCE_COPY_IN_MOVE - ) { - InternalSwap(&from); - } else { - CopyFrom(from); - } - return *this; - } - - inline const ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet& unknown_fields() const { - return _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance); - } - inline ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet* mutable_unknown_fields() { - return _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); - } - - static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { - return GetDescriptor(); - } - static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { - return default_instance().GetMetadata().descriptor; - } - static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { - return default_instance().GetMetadata().reflection; - } - static const Box& default_instance() { - return *internal_default_instance(); - } - static inline const Box* internal_default_instance() { - return reinterpret_cast( - &_Box_default_instance_); - } - static constexpr int kIndexInFileMessages = - 4; - - friend void swap(Box& a, Box& b) { - a.Swap(&b); - } - inline void Swap(Box* other) { - if (other == this) return; - #ifdef PROTOBUF_FORCE_COPY_IN_SWAP - if (GetOwningArena() != nullptr && - GetOwningArena() == other->GetOwningArena()) { - #else // PROTOBUF_FORCE_COPY_IN_SWAP - if (GetOwningArena() == other->GetOwningArena()) { - #endif // !PROTOBUF_FORCE_COPY_IN_SWAP - InternalSwap(other); - } else { - ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); - } - } - void UnsafeArenaSwap(Box* other) { - if (other == this) return; - GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); - InternalSwap(other); - } - - // implements Message ---------------------------------------------- - - Box* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { - return CreateMaybeMessage(arena); - } - using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; - void CopyFrom(const Box& from); - using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; - void MergeFrom( const Box& from) { - Box::MergeImpl(*this, from); - } - private: - static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg); - public: - PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; - bool IsInitialized() const final; - - size_t ByteSizeLong() const final; - const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; - uint8_t* _InternalSerialize( - uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; - int GetCachedSize() const final { return _impl_._cached_size_.Get(); } - - private: - void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned); - void SharedDtor(); - void SetCachedSize(int size) const final; - void InternalSwap(Box* other); - - private: - friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; - static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { - return "Canary.protobuf.appearances.Box"; - } - protected: - explicit Box(::PROTOBUF_NAMESPACE_ID::Arena* arena, - bool is_message_owned = false); - public: - - static const ClassData _class_data_; - const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; - - ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; - - // nested types ---------------------------------------------------- - - // accessors ------------------------------------------------------- - - enum : int { - kXFieldNumber = 1, - kYFieldNumber = 2, - kWidthFieldNumber = 3, - kHeightFieldNumber = 4, - }; - // optional uint32 x = 1; - bool has_x() const; - private: - bool _internal_has_x() const; - public: - void clear_x(); - uint32_t x() const; - void set_x(uint32_t value); - private: - uint32_t _internal_x() const; - void _internal_set_x(uint32_t value); - public: - - // optional uint32 y = 2; - bool has_y() const; - private: - bool _internal_has_y() const; - public: - void clear_y(); - uint32_t y() const; - void set_y(uint32_t value); - private: - uint32_t _internal_y() const; - void _internal_set_y(uint32_t value); - public: - - // optional uint32 width = 3; - bool has_width() const; - private: - bool _internal_has_width() const; - public: - void clear_width(); - uint32_t width() const; - void set_width(uint32_t value); - private: - uint32_t _internal_width() const; - void _internal_set_width(uint32_t value); - public: - - // optional uint32 height = 4; - bool has_height() const; - private: - bool _internal_has_height() const; - public: - void clear_height(); - uint32_t height() const; - void set_height(uint32_t value); - private: - uint32_t _internal_height() const; - void _internal_set_height(uint32_t value); - public: - - // @@protoc_insertion_point(class_scope:Canary.protobuf.appearances.Box) - private: - class _Internal; - - template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; - typedef void InternalArenaConstructable_; - typedef void DestructorSkippable_; - struct Impl_ { - ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; - mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; - uint32_t x_; - uint32_t y_; - uint32_t width_; - uint32_t height_; - }; - union { Impl_ _impl_; }; - friend struct ::TableStruct_appearances_2eproto; -}; -// ------------------------------------------------------------------- - -class SpriteInfo final : - public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:Canary.protobuf.appearances.SpriteInfo) */ { - public: - inline SpriteInfo() : SpriteInfo(nullptr) {} - ~SpriteInfo() override; - explicit PROTOBUF_CONSTEXPR SpriteInfo(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); - - SpriteInfo(const SpriteInfo& from); - SpriteInfo(SpriteInfo&& from) noexcept - : SpriteInfo() { - *this = ::std::move(from); - } - - inline SpriteInfo& operator=(const SpriteInfo& from) { - CopyFrom(from); - return *this; - } - inline SpriteInfo& operator=(SpriteInfo&& from) noexcept { - if (this == &from) return *this; - if (GetOwningArena() == from.GetOwningArena() - #ifdef PROTOBUF_FORCE_COPY_IN_MOVE - && GetOwningArena() != nullptr - #endif // !PROTOBUF_FORCE_COPY_IN_MOVE - ) { - InternalSwap(&from); - } else { - CopyFrom(from); - } - return *this; - } - - inline const ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet& unknown_fields() const { - return _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance); - } - inline ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet* mutable_unknown_fields() { - return _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); - } - - static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { - return GetDescriptor(); - } - static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { - return default_instance().GetMetadata().descriptor; - } - static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { - return default_instance().GetMetadata().reflection; - } - static const SpriteInfo& default_instance() { - return *internal_default_instance(); - } - static inline const SpriteInfo* internal_default_instance() { - return reinterpret_cast( - &_SpriteInfo_default_instance_); - } - static constexpr int kIndexInFileMessages = - 5; - - friend void swap(SpriteInfo& a, SpriteInfo& b) { - a.Swap(&b); - } - inline void Swap(SpriteInfo* other) { - if (other == this) return; - #ifdef PROTOBUF_FORCE_COPY_IN_SWAP - if (GetOwningArena() != nullptr && - GetOwningArena() == other->GetOwningArena()) { - #else // PROTOBUF_FORCE_COPY_IN_SWAP - if (GetOwningArena() == other->GetOwningArena()) { - #endif // !PROTOBUF_FORCE_COPY_IN_SWAP - InternalSwap(other); - } else { - ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); - } - } - void UnsafeArenaSwap(SpriteInfo* other) { - if (other == this) return; - GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); - InternalSwap(other); - } - - // implements Message ---------------------------------------------- - - SpriteInfo* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { - return CreateMaybeMessage(arena); - } - using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; - void CopyFrom(const SpriteInfo& from); - using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; - void MergeFrom( const SpriteInfo& from) { - SpriteInfo::MergeImpl(*this, from); - } - private: - static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg); - public: - PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; - bool IsInitialized() const final; - - size_t ByteSizeLong() const final; - const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; - uint8_t* _InternalSerialize( - uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; - int GetCachedSize() const final { return _impl_._cached_size_.Get(); } - - private: - void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned); - void SharedDtor(); - void SetCachedSize(int size) const final; - void InternalSwap(SpriteInfo* other); - - private: - friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; - static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { - return "Canary.protobuf.appearances.SpriteInfo"; - } - protected: - explicit SpriteInfo(::PROTOBUF_NAMESPACE_ID::Arena* arena, - bool is_message_owned = false); - public: - - static const ClassData _class_data_; - const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; - - ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; - - // nested types ---------------------------------------------------- - - // accessors ------------------------------------------------------- - - enum : int { - kSpriteIdFieldNumber = 5, - kBoundingBoxPerDirectionFieldNumber = 9, - kAnimationFieldNumber = 6, - kPatternWidthFieldNumber = 1, - kPatternHeightFieldNumber = 2, - kPatternDepthFieldNumber = 3, - kLayersFieldNumber = 4, - kBoundingSquareFieldNumber = 7, - kIsOpaqueFieldNumber = 8, - }; - // repeated uint32 sprite_id = 5; - int sprite_id_size() const; - private: - int _internal_sprite_id_size() const; - public: - void clear_sprite_id(); - private: - uint32_t _internal_sprite_id(int index) const; - const ::PROTOBUF_NAMESPACE_ID::RepeatedField< uint32_t >& - _internal_sprite_id() const; - void _internal_add_sprite_id(uint32_t value); - ::PROTOBUF_NAMESPACE_ID::RepeatedField< uint32_t >* - _internal_mutable_sprite_id(); - public: - uint32_t sprite_id(int index) const; - void set_sprite_id(int index, uint32_t value); - void add_sprite_id(uint32_t value); - const ::PROTOBUF_NAMESPACE_ID::RepeatedField< uint32_t >& - sprite_id() const; - ::PROTOBUF_NAMESPACE_ID::RepeatedField< uint32_t >* - mutable_sprite_id(); - - // repeated .Canary.protobuf.appearances.Box bounding_box_per_direction = 9; - int bounding_box_per_direction_size() const; - private: - int _internal_bounding_box_per_direction_size() const; - public: - void clear_bounding_box_per_direction(); - ::Canary::protobuf::appearances::Box* mutable_bounding_box_per_direction(int index); - ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::Canary::protobuf::appearances::Box >* - mutable_bounding_box_per_direction(); - private: - const ::Canary::protobuf::appearances::Box& _internal_bounding_box_per_direction(int index) const; - ::Canary::protobuf::appearances::Box* _internal_add_bounding_box_per_direction(); - public: - const ::Canary::protobuf::appearances::Box& bounding_box_per_direction(int index) const; - ::Canary::protobuf::appearances::Box* add_bounding_box_per_direction(); - const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::Canary::protobuf::appearances::Box >& - bounding_box_per_direction() const; - - // optional .Canary.protobuf.appearances.SpriteAnimation animation = 6; - bool has_animation() const; - private: - bool _internal_has_animation() const; - public: - void clear_animation(); - const ::Canary::protobuf::appearances::SpriteAnimation& animation() const; - PROTOBUF_NODISCARD ::Canary::protobuf::appearances::SpriteAnimation* release_animation(); - ::Canary::protobuf::appearances::SpriteAnimation* mutable_animation(); - void set_allocated_animation(::Canary::protobuf::appearances::SpriteAnimation* animation); - private: - const ::Canary::protobuf::appearances::SpriteAnimation& _internal_animation() const; - ::Canary::protobuf::appearances::SpriteAnimation* _internal_mutable_animation(); - public: - void unsafe_arena_set_allocated_animation( - ::Canary::protobuf::appearances::SpriteAnimation* animation); - ::Canary::protobuf::appearances::SpriteAnimation* unsafe_arena_release_animation(); - - // optional uint32 pattern_width = 1; - bool has_pattern_width() const; - private: - bool _internal_has_pattern_width() const; - public: - void clear_pattern_width(); - uint32_t pattern_width() const; - void set_pattern_width(uint32_t value); - private: - uint32_t _internal_pattern_width() const; - void _internal_set_pattern_width(uint32_t value); - public: - - // optional uint32 pattern_height = 2; - bool has_pattern_height() const; - private: - bool _internal_has_pattern_height() const; - public: - void clear_pattern_height(); - uint32_t pattern_height() const; - void set_pattern_height(uint32_t value); - private: - uint32_t _internal_pattern_height() const; - void _internal_set_pattern_height(uint32_t value); - public: - - // optional uint32 pattern_depth = 3; - bool has_pattern_depth() const; - private: - bool _internal_has_pattern_depth() const; - public: - void clear_pattern_depth(); - uint32_t pattern_depth() const; - void set_pattern_depth(uint32_t value); - private: - uint32_t _internal_pattern_depth() const; - void _internal_set_pattern_depth(uint32_t value); - public: - - // optional uint32 layers = 4; - bool has_layers() const; - private: - bool _internal_has_layers() const; - public: - void clear_layers(); - uint32_t layers() const; - void set_layers(uint32_t value); - private: - uint32_t _internal_layers() const; - void _internal_set_layers(uint32_t value); - public: - - // optional uint32 bounding_square = 7; - bool has_bounding_square() const; - private: - bool _internal_has_bounding_square() const; - public: - void clear_bounding_square(); - uint32_t bounding_square() const; - void set_bounding_square(uint32_t value); - private: - uint32_t _internal_bounding_square() const; - void _internal_set_bounding_square(uint32_t value); - public: - - // optional bool is_opaque = 8; - bool has_is_opaque() const; - private: - bool _internal_has_is_opaque() const; - public: - void clear_is_opaque(); - bool is_opaque() const; - void set_is_opaque(bool value); - private: - bool _internal_is_opaque() const; - void _internal_set_is_opaque(bool value); - public: - - // @@protoc_insertion_point(class_scope:Canary.protobuf.appearances.SpriteInfo) - private: - class _Internal; - - template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; - typedef void InternalArenaConstructable_; - typedef void DestructorSkippable_; - struct Impl_ { - ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; - mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; - ::PROTOBUF_NAMESPACE_ID::RepeatedField< uint32_t > sprite_id_; - ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::Canary::protobuf::appearances::Box > bounding_box_per_direction_; - ::Canary::protobuf::appearances::SpriteAnimation* animation_; - uint32_t pattern_width_; - uint32_t pattern_height_; - uint32_t pattern_depth_; - uint32_t layers_; - uint32_t bounding_square_; - bool is_opaque_; - }; - union { Impl_ _impl_; }; - friend struct ::TableStruct_appearances_2eproto; -}; -// ------------------------------------------------------------------- - -class FrameGroup final : - public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:Canary.protobuf.appearances.FrameGroup) */ { - public: - inline FrameGroup() : FrameGroup(nullptr) {} - ~FrameGroup() override; - explicit PROTOBUF_CONSTEXPR FrameGroup(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); - - FrameGroup(const FrameGroup& from); - FrameGroup(FrameGroup&& from) noexcept - : FrameGroup() { - *this = ::std::move(from); - } - - inline FrameGroup& operator=(const FrameGroup& from) { - CopyFrom(from); - return *this; - } - inline FrameGroup& operator=(FrameGroup&& from) noexcept { - if (this == &from) return *this; - if (GetOwningArena() == from.GetOwningArena() - #ifdef PROTOBUF_FORCE_COPY_IN_MOVE - && GetOwningArena() != nullptr - #endif // !PROTOBUF_FORCE_COPY_IN_MOVE - ) { - InternalSwap(&from); - } else { - CopyFrom(from); - } - return *this; - } - - inline const ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet& unknown_fields() const { - return _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance); - } - inline ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet* mutable_unknown_fields() { - return _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); - } - - static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { - return GetDescriptor(); - } - static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { - return default_instance().GetMetadata().descriptor; - } - static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { - return default_instance().GetMetadata().reflection; - } - static const FrameGroup& default_instance() { - return *internal_default_instance(); - } - static inline const FrameGroup* internal_default_instance() { - return reinterpret_cast( - &_FrameGroup_default_instance_); - } - static constexpr int kIndexInFileMessages = - 6; - - friend void swap(FrameGroup& a, FrameGroup& b) { - a.Swap(&b); - } - inline void Swap(FrameGroup* other) { - if (other == this) return; - #ifdef PROTOBUF_FORCE_COPY_IN_SWAP - if (GetOwningArena() != nullptr && - GetOwningArena() == other->GetOwningArena()) { - #else // PROTOBUF_FORCE_COPY_IN_SWAP - if (GetOwningArena() == other->GetOwningArena()) { - #endif // !PROTOBUF_FORCE_COPY_IN_SWAP - InternalSwap(other); - } else { - ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); - } - } - void UnsafeArenaSwap(FrameGroup* other) { - if (other == this) return; - GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); - InternalSwap(other); - } - - // implements Message ---------------------------------------------- - - FrameGroup* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { - return CreateMaybeMessage(arena); - } - using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; - void CopyFrom(const FrameGroup& from); - using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; - void MergeFrom( const FrameGroup& from) { - FrameGroup::MergeImpl(*this, from); - } - private: - static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg); - public: - PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; - bool IsInitialized() const final; - - size_t ByteSizeLong() const final; - const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; - uint8_t* _InternalSerialize( - uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; - int GetCachedSize() const final { return _impl_._cached_size_.Get(); } - - private: - void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned); - void SharedDtor(); - void SetCachedSize(int size) const final; - void InternalSwap(FrameGroup* other); - - private: - friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; - static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { - return "Canary.protobuf.appearances.FrameGroup"; - } - protected: - explicit FrameGroup(::PROTOBUF_NAMESPACE_ID::Arena* arena, - bool is_message_owned = false); - public: - - static const ClassData _class_data_; - const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; - - ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; - - // nested types ---------------------------------------------------- - - // accessors ------------------------------------------------------- - - enum : int { - kSpriteInfoFieldNumber = 3, - kFixedFrameGroupFieldNumber = 1, - kIdFieldNumber = 2, - }; - // optional .Canary.protobuf.appearances.SpriteInfo sprite_info = 3; - bool has_sprite_info() const; - private: - bool _internal_has_sprite_info() const; - public: - void clear_sprite_info(); - const ::Canary::protobuf::appearances::SpriteInfo& sprite_info() const; - PROTOBUF_NODISCARD ::Canary::protobuf::appearances::SpriteInfo* release_sprite_info(); - ::Canary::protobuf::appearances::SpriteInfo* mutable_sprite_info(); - void set_allocated_sprite_info(::Canary::protobuf::appearances::SpriteInfo* sprite_info); - private: - const ::Canary::protobuf::appearances::SpriteInfo& _internal_sprite_info() const; - ::Canary::protobuf::appearances::SpriteInfo* _internal_mutable_sprite_info(); - public: - void unsafe_arena_set_allocated_sprite_info( - ::Canary::protobuf::appearances::SpriteInfo* sprite_info); - ::Canary::protobuf::appearances::SpriteInfo* unsafe_arena_release_sprite_info(); - - // optional .Canary.protobuf.appearances.FIXED_FRAME_GROUP fixed_frame_group = 1; - bool has_fixed_frame_group() const; - private: - bool _internal_has_fixed_frame_group() const; - public: - void clear_fixed_frame_group(); - ::Canary::protobuf::appearances::FIXED_FRAME_GROUP fixed_frame_group() const; - void set_fixed_frame_group(::Canary::protobuf::appearances::FIXED_FRAME_GROUP value); - private: - ::Canary::protobuf::appearances::FIXED_FRAME_GROUP _internal_fixed_frame_group() const; - void _internal_set_fixed_frame_group(::Canary::protobuf::appearances::FIXED_FRAME_GROUP value); - public: - - // optional uint32 id = 2; - bool has_id() const; - private: - bool _internal_has_id() const; - public: - void clear_id(); - uint32_t id() const; - void set_id(uint32_t value); - private: - uint32_t _internal_id() const; - void _internal_set_id(uint32_t value); - public: - - // @@protoc_insertion_point(class_scope:Canary.protobuf.appearances.FrameGroup) - private: - class _Internal; - - template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; - typedef void InternalArenaConstructable_; - typedef void DestructorSkippable_; - struct Impl_ { - ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; - mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; - ::Canary::protobuf::appearances::SpriteInfo* sprite_info_; - int fixed_frame_group_; - uint32_t id_; - }; - union { Impl_ _impl_; }; - friend struct ::TableStruct_appearances_2eproto; -}; -// ------------------------------------------------------------------- - -class Appearance final : - public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:Canary.protobuf.appearances.Appearance) */ { - public: - inline Appearance() : Appearance(nullptr) {} - ~Appearance() override; - explicit PROTOBUF_CONSTEXPR Appearance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); - - Appearance(const Appearance& from); - Appearance(Appearance&& from) noexcept - : Appearance() { - *this = ::std::move(from); - } - - inline Appearance& operator=(const Appearance& from) { - CopyFrom(from); - return *this; - } - inline Appearance& operator=(Appearance&& from) noexcept { - if (this == &from) return *this; - if (GetOwningArena() == from.GetOwningArena() - #ifdef PROTOBUF_FORCE_COPY_IN_MOVE - && GetOwningArena() != nullptr - #endif // !PROTOBUF_FORCE_COPY_IN_MOVE - ) { - InternalSwap(&from); - } else { - CopyFrom(from); - } - return *this; - } - - inline const ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet& unknown_fields() const { - return _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance); - } - inline ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet* mutable_unknown_fields() { - return _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); - } - - static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { - return GetDescriptor(); - } - static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { - return default_instance().GetMetadata().descriptor; - } - static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { - return default_instance().GetMetadata().reflection; - } - static const Appearance& default_instance() { - return *internal_default_instance(); - } - static inline const Appearance* internal_default_instance() { - return reinterpret_cast( - &_Appearance_default_instance_); - } - static constexpr int kIndexInFileMessages = - 7; - - friend void swap(Appearance& a, Appearance& b) { - a.Swap(&b); - } - inline void Swap(Appearance* other) { - if (other == this) return; - #ifdef PROTOBUF_FORCE_COPY_IN_SWAP - if (GetOwningArena() != nullptr && - GetOwningArena() == other->GetOwningArena()) { - #else // PROTOBUF_FORCE_COPY_IN_SWAP - if (GetOwningArena() == other->GetOwningArena()) { - #endif // !PROTOBUF_FORCE_COPY_IN_SWAP - InternalSwap(other); - } else { - ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); - } - } - void UnsafeArenaSwap(Appearance* other) { - if (other == this) return; - GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); - InternalSwap(other); - } - - // implements Message ---------------------------------------------- - - Appearance* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { - return CreateMaybeMessage(arena); - } - using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; - void CopyFrom(const Appearance& from); - using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; - void MergeFrom( const Appearance& from) { - Appearance::MergeImpl(*this, from); - } - private: - static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg); - public: - PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; - bool IsInitialized() const final; - - size_t ByteSizeLong() const final; - const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; - uint8_t* _InternalSerialize( - uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; - int GetCachedSize() const final { return _impl_._cached_size_.Get(); } - - private: - void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned); - void SharedDtor(); - void SetCachedSize(int size) const final; - void InternalSwap(Appearance* other); - - private: - friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; - static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { - return "Canary.protobuf.appearances.Appearance"; - } - protected: - explicit Appearance(::PROTOBUF_NAMESPACE_ID::Arena* arena, - bool is_message_owned = false); - public: - - static const ClassData _class_data_; - const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; - - ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; - - // nested types ---------------------------------------------------- - - // accessors ------------------------------------------------------- - - enum : int { - kFrameGroupFieldNumber = 2, - kNameFieldNumber = 4, - kDescriptionFieldNumber = 5, - kFlagsFieldNumber = 3, - kIdFieldNumber = 1, - }; - // repeated .Canary.protobuf.appearances.FrameGroup frame_group = 2; - int frame_group_size() const; - private: - int _internal_frame_group_size() const; - public: - void clear_frame_group(); - ::Canary::protobuf::appearances::FrameGroup* mutable_frame_group(int index); - ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::Canary::protobuf::appearances::FrameGroup >* - mutable_frame_group(); - private: - const ::Canary::protobuf::appearances::FrameGroup& _internal_frame_group(int index) const; - ::Canary::protobuf::appearances::FrameGroup* _internal_add_frame_group(); - public: - const ::Canary::protobuf::appearances::FrameGroup& frame_group(int index) const; - ::Canary::protobuf::appearances::FrameGroup* add_frame_group(); - const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::Canary::protobuf::appearances::FrameGroup >& - frame_group() const; - - // optional bytes name = 4; - bool has_name() const; - private: - bool _internal_has_name() const; - public: - void clear_name(); - const std::string& name() const; - template - void set_name(ArgT0&& arg0, ArgT... args); - std::string* mutable_name(); - PROTOBUF_NODISCARD std::string* release_name(); - void set_allocated_name(std::string* name); - private: - const std::string& _internal_name() const; - inline PROTOBUF_ALWAYS_INLINE void _internal_set_name(const std::string& value); - std::string* _internal_mutable_name(); - public: - - // optional bytes description = 5; - bool has_description() const; - private: - bool _internal_has_description() const; - public: - void clear_description(); - const std::string& description() const; - template - void set_description(ArgT0&& arg0, ArgT... args); - std::string* mutable_description(); - PROTOBUF_NODISCARD std::string* release_description(); - void set_allocated_description(std::string* description); - private: - const std::string& _internal_description() const; - inline PROTOBUF_ALWAYS_INLINE void _internal_set_description(const std::string& value); - std::string* _internal_mutable_description(); - public: - - // optional .Canary.protobuf.appearances.AppearanceFlags flags = 3; - bool has_flags() const; - private: - bool _internal_has_flags() const; - public: - void clear_flags(); - const ::Canary::protobuf::appearances::AppearanceFlags& flags() const; - PROTOBUF_NODISCARD ::Canary::protobuf::appearances::AppearanceFlags* release_flags(); - ::Canary::protobuf::appearances::AppearanceFlags* mutable_flags(); - void set_allocated_flags(::Canary::protobuf::appearances::AppearanceFlags* flags); - private: - const ::Canary::protobuf::appearances::AppearanceFlags& _internal_flags() const; - ::Canary::protobuf::appearances::AppearanceFlags* _internal_mutable_flags(); - public: - void unsafe_arena_set_allocated_flags( - ::Canary::protobuf::appearances::AppearanceFlags* flags); - ::Canary::protobuf::appearances::AppearanceFlags* unsafe_arena_release_flags(); - - // optional uint32 id = 1; - bool has_id() const; - private: - bool _internal_has_id() const; - public: - void clear_id(); - uint32_t id() const; - void set_id(uint32_t value); - private: - uint32_t _internal_id() const; - void _internal_set_id(uint32_t value); - public: - - // @@protoc_insertion_point(class_scope:Canary.protobuf.appearances.Appearance) - private: - class _Internal; - - template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; - typedef void InternalArenaConstructable_; - typedef void DestructorSkippable_; - struct Impl_ { - ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; - mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; - ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::Canary::protobuf::appearances::FrameGroup > frame_group_; - ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr name_; - ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr description_; - ::Canary::protobuf::appearances::AppearanceFlags* flags_; - uint32_t id_; - }; - union { Impl_ _impl_; }; - friend struct ::TableStruct_appearances_2eproto; -}; -// ------------------------------------------------------------------- - -class AppearanceFlags final : - public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:Canary.protobuf.appearances.AppearanceFlags) */ { - public: - inline AppearanceFlags() : AppearanceFlags(nullptr) {} - ~AppearanceFlags() override; - explicit PROTOBUF_CONSTEXPR AppearanceFlags(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); - - AppearanceFlags(const AppearanceFlags& from); - AppearanceFlags(AppearanceFlags&& from) noexcept - : AppearanceFlags() { - *this = ::std::move(from); - } - - inline AppearanceFlags& operator=(const AppearanceFlags& from) { - CopyFrom(from); - return *this; - } - inline AppearanceFlags& operator=(AppearanceFlags&& from) noexcept { - if (this == &from) return *this; - if (GetOwningArena() == from.GetOwningArena() - #ifdef PROTOBUF_FORCE_COPY_IN_MOVE - && GetOwningArena() != nullptr - #endif // !PROTOBUF_FORCE_COPY_IN_MOVE - ) { - InternalSwap(&from); - } else { - CopyFrom(from); - } - return *this; - } - - inline const ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet& unknown_fields() const { - return _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance); - } - inline ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet* mutable_unknown_fields() { - return _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); - } - - static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { - return GetDescriptor(); - } - static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { - return default_instance().GetMetadata().descriptor; - } - static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { - return default_instance().GetMetadata().reflection; - } - static const AppearanceFlags& default_instance() { - return *internal_default_instance(); - } - static inline const AppearanceFlags* internal_default_instance() { - return reinterpret_cast( - &_AppearanceFlags_default_instance_); - } - static constexpr int kIndexInFileMessages = - 8; - - friend void swap(AppearanceFlags& a, AppearanceFlags& b) { - a.Swap(&b); - } - inline void Swap(AppearanceFlags* other) { - if (other == this) return; - #ifdef PROTOBUF_FORCE_COPY_IN_SWAP - if (GetOwningArena() != nullptr && - GetOwningArena() == other->GetOwningArena()) { - #else // PROTOBUF_FORCE_COPY_IN_SWAP - if (GetOwningArena() == other->GetOwningArena()) { - #endif // !PROTOBUF_FORCE_COPY_IN_SWAP - InternalSwap(other); - } else { - ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); - } - } - void UnsafeArenaSwap(AppearanceFlags* other) { - if (other == this) return; - GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); - InternalSwap(other); - } - - // implements Message ---------------------------------------------- - - AppearanceFlags* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { - return CreateMaybeMessage(arena); - } - using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; - void CopyFrom(const AppearanceFlags& from); - using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; - void MergeFrom( const AppearanceFlags& from) { - AppearanceFlags::MergeImpl(*this, from); - } - private: - static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg); - public: - PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; - bool IsInitialized() const final; - - size_t ByteSizeLong() const final; - const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; - uint8_t* _InternalSerialize( - uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; - int GetCachedSize() const final { return _impl_._cached_size_.Get(); } - - private: - void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned); - void SharedDtor(); - void SetCachedSize(int size) const final; - void InternalSwap(AppearanceFlags* other); - - private: - friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; - static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { - return "Canary.protobuf.appearances.AppearanceFlags"; - } - protected: - explicit AppearanceFlags(::PROTOBUF_NAMESPACE_ID::Arena* arena, - bool is_message_owned = false); - public: - - static const ClassData _class_data_; - const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; - - ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; - - // nested types ---------------------------------------------------- - - // accessors ------------------------------------------------------- - - enum : int { - kNpcsaledataFieldNumber = 40, - kBankFieldNumber = 1, - kWriteFieldNumber = 10, - kWriteOnceFieldNumber = 11, - kHookFieldNumber = 21, - kLightFieldNumber = 23, - kShiftFieldNumber = 26, - kHeightFieldNumber = 27, - kAutomapFieldNumber = 30, - kLenshelpFieldNumber = 31, - kClothesFieldNumber = 34, - kDefaultActionFieldNumber = 35, - kMarketFieldNumber = 36, - kChangedtoexpireFieldNumber = 41, - kCyclopediaitemFieldNumber = 44, - kUpgradeclassificationFieldNumber = 48, - kClipFieldNumber = 2, - kBottomFieldNumber = 3, - kTopFieldNumber = 4, - kContainerFieldNumber = 5, - kCumulativeFieldNumber = 6, - kUsableFieldNumber = 7, - kForceuseFieldNumber = 8, - kMultiuseFieldNumber = 9, - kLiquidpoolFieldNumber = 12, - kUnpassFieldNumber = 13, - kUnmoveFieldNumber = 14, - kUnsightFieldNumber = 15, - kAvoidFieldNumber = 16, - kNoMovementAnimationFieldNumber = 17, - kTakeFieldNumber = 18, - kLiquidcontainerFieldNumber = 19, - kHangFieldNumber = 20, - kRotateFieldNumber = 22, - kDontHideFieldNumber = 24, - kTranslucentFieldNumber = 25, - kLyingObjectFieldNumber = 28, - kAnimateAlwaysFieldNumber = 29, - kFullbankFieldNumber = 32, - kIgnoreLookFieldNumber = 33, - kWrapFieldNumber = 37, - kUnwrapFieldNumber = 38, - kTopeffectFieldNumber = 39, - kCorpseFieldNumber = 42, - kPlayerCorpseFieldNumber = 43, - kAmmoFieldNumber = 45, - kShowOffSocketFieldNumber = 46, - kReportableFieldNumber = 47, - kReverseAddonsEastFieldNumber = 49, - kReverseAddonsWestFieldNumber = 50, - kReverseAddonsSouthFieldNumber = 51, - kReverseAddonsNorthFieldNumber = 52, - kWearoutFieldNumber = 53, - kClockexpireFieldNumber = 54, - kExpireFieldNumber = 55, - kExpirestopFieldNumber = 56, - }; - // repeated .Canary.protobuf.appearances.AppearanceFlagNPC npcsaledata = 40; - int npcsaledata_size() const; - private: - int _internal_npcsaledata_size() const; - public: - void clear_npcsaledata(); - ::Canary::protobuf::appearances::AppearanceFlagNPC* mutable_npcsaledata(int index); - ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::Canary::protobuf::appearances::AppearanceFlagNPC >* - mutable_npcsaledata(); - private: - const ::Canary::protobuf::appearances::AppearanceFlagNPC& _internal_npcsaledata(int index) const; - ::Canary::protobuf::appearances::AppearanceFlagNPC* _internal_add_npcsaledata(); - public: - const ::Canary::protobuf::appearances::AppearanceFlagNPC& npcsaledata(int index) const; - ::Canary::protobuf::appearances::AppearanceFlagNPC* add_npcsaledata(); - const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::Canary::protobuf::appearances::AppearanceFlagNPC >& - npcsaledata() const; - - // optional .Canary.protobuf.appearances.AppearanceFlagBank bank = 1; - bool has_bank() const; - private: - bool _internal_has_bank() const; - public: - void clear_bank(); - const ::Canary::protobuf::appearances::AppearanceFlagBank& bank() const; - PROTOBUF_NODISCARD ::Canary::protobuf::appearances::AppearanceFlagBank* release_bank(); - ::Canary::protobuf::appearances::AppearanceFlagBank* mutable_bank(); - void set_allocated_bank(::Canary::protobuf::appearances::AppearanceFlagBank* bank); - private: - const ::Canary::protobuf::appearances::AppearanceFlagBank& _internal_bank() const; - ::Canary::protobuf::appearances::AppearanceFlagBank* _internal_mutable_bank(); - public: - void unsafe_arena_set_allocated_bank( - ::Canary::protobuf::appearances::AppearanceFlagBank* bank); - ::Canary::protobuf::appearances::AppearanceFlagBank* unsafe_arena_release_bank(); - - // optional .Canary.protobuf.appearances.AppearanceFlagWrite write = 10; - bool has_write() const; - private: - bool _internal_has_write() const; - public: - void clear_write(); - const ::Canary::protobuf::appearances::AppearanceFlagWrite& write() const; - PROTOBUF_NODISCARD ::Canary::protobuf::appearances::AppearanceFlagWrite* release_write(); - ::Canary::protobuf::appearances::AppearanceFlagWrite* mutable_write(); - void set_allocated_write(::Canary::protobuf::appearances::AppearanceFlagWrite* write); - private: - const ::Canary::protobuf::appearances::AppearanceFlagWrite& _internal_write() const; - ::Canary::protobuf::appearances::AppearanceFlagWrite* _internal_mutable_write(); - public: - void unsafe_arena_set_allocated_write( - ::Canary::protobuf::appearances::AppearanceFlagWrite* write); - ::Canary::protobuf::appearances::AppearanceFlagWrite* unsafe_arena_release_write(); - - // optional .Canary.protobuf.appearances.AppearanceFlagWriteOnce write_once = 11; - bool has_write_once() const; - private: - bool _internal_has_write_once() const; - public: - void clear_write_once(); - const ::Canary::protobuf::appearances::AppearanceFlagWriteOnce& write_once() const; - PROTOBUF_NODISCARD ::Canary::protobuf::appearances::AppearanceFlagWriteOnce* release_write_once(); - ::Canary::protobuf::appearances::AppearanceFlagWriteOnce* mutable_write_once(); - void set_allocated_write_once(::Canary::protobuf::appearances::AppearanceFlagWriteOnce* write_once); - private: - const ::Canary::protobuf::appearances::AppearanceFlagWriteOnce& _internal_write_once() const; - ::Canary::protobuf::appearances::AppearanceFlagWriteOnce* _internal_mutable_write_once(); - public: - void unsafe_arena_set_allocated_write_once( - ::Canary::protobuf::appearances::AppearanceFlagWriteOnce* write_once); - ::Canary::protobuf::appearances::AppearanceFlagWriteOnce* unsafe_arena_release_write_once(); - - // optional .Canary.protobuf.appearances.AppearanceFlagHook hook = 21; - bool has_hook() const; - private: - bool _internal_has_hook() const; - public: - void clear_hook(); - const ::Canary::protobuf::appearances::AppearanceFlagHook& hook() const; - PROTOBUF_NODISCARD ::Canary::protobuf::appearances::AppearanceFlagHook* release_hook(); - ::Canary::protobuf::appearances::AppearanceFlagHook* mutable_hook(); - void set_allocated_hook(::Canary::protobuf::appearances::AppearanceFlagHook* hook); - private: - const ::Canary::protobuf::appearances::AppearanceFlagHook& _internal_hook() const; - ::Canary::protobuf::appearances::AppearanceFlagHook* _internal_mutable_hook(); - public: - void unsafe_arena_set_allocated_hook( - ::Canary::protobuf::appearances::AppearanceFlagHook* hook); - ::Canary::protobuf::appearances::AppearanceFlagHook* unsafe_arena_release_hook(); - - // optional .Canary.protobuf.appearances.AppearanceFlagLight light = 23; - bool has_light() const; - private: - bool _internal_has_light() const; - public: - void clear_light(); - const ::Canary::protobuf::appearances::AppearanceFlagLight& light() const; - PROTOBUF_NODISCARD ::Canary::protobuf::appearances::AppearanceFlagLight* release_light(); - ::Canary::protobuf::appearances::AppearanceFlagLight* mutable_light(); - void set_allocated_light(::Canary::protobuf::appearances::AppearanceFlagLight* light); - private: - const ::Canary::protobuf::appearances::AppearanceFlagLight& _internal_light() const; - ::Canary::protobuf::appearances::AppearanceFlagLight* _internal_mutable_light(); - public: - void unsafe_arena_set_allocated_light( - ::Canary::protobuf::appearances::AppearanceFlagLight* light); - ::Canary::protobuf::appearances::AppearanceFlagLight* unsafe_arena_release_light(); - - // optional .Canary.protobuf.appearances.AppearanceFlagShift shift = 26; - bool has_shift() const; - private: - bool _internal_has_shift() const; - public: - void clear_shift(); - const ::Canary::protobuf::appearances::AppearanceFlagShift& shift() const; - PROTOBUF_NODISCARD ::Canary::protobuf::appearances::AppearanceFlagShift* release_shift(); - ::Canary::protobuf::appearances::AppearanceFlagShift* mutable_shift(); - void set_allocated_shift(::Canary::protobuf::appearances::AppearanceFlagShift* shift); - private: - const ::Canary::protobuf::appearances::AppearanceFlagShift& _internal_shift() const; - ::Canary::protobuf::appearances::AppearanceFlagShift* _internal_mutable_shift(); - public: - void unsafe_arena_set_allocated_shift( - ::Canary::protobuf::appearances::AppearanceFlagShift* shift); - ::Canary::protobuf::appearances::AppearanceFlagShift* unsafe_arena_release_shift(); - - // optional .Canary.protobuf.appearances.AppearanceFlagHeight height = 27; - bool has_height() const; - private: - bool _internal_has_height() const; - public: - void clear_height(); - const ::Canary::protobuf::appearances::AppearanceFlagHeight& height() const; - PROTOBUF_NODISCARD ::Canary::protobuf::appearances::AppearanceFlagHeight* release_height(); - ::Canary::protobuf::appearances::AppearanceFlagHeight* mutable_height(); - void set_allocated_height(::Canary::protobuf::appearances::AppearanceFlagHeight* height); - private: - const ::Canary::protobuf::appearances::AppearanceFlagHeight& _internal_height() const; - ::Canary::protobuf::appearances::AppearanceFlagHeight* _internal_mutable_height(); - public: - void unsafe_arena_set_allocated_height( - ::Canary::protobuf::appearances::AppearanceFlagHeight* height); - ::Canary::protobuf::appearances::AppearanceFlagHeight* unsafe_arena_release_height(); - - // optional .Canary.protobuf.appearances.AppearanceFlagAutomap automap = 30; - bool has_automap() const; - private: - bool _internal_has_automap() const; - public: - void clear_automap(); - const ::Canary::protobuf::appearances::AppearanceFlagAutomap& automap() const; - PROTOBUF_NODISCARD ::Canary::protobuf::appearances::AppearanceFlagAutomap* release_automap(); - ::Canary::protobuf::appearances::AppearanceFlagAutomap* mutable_automap(); - void set_allocated_automap(::Canary::protobuf::appearances::AppearanceFlagAutomap* automap); - private: - const ::Canary::protobuf::appearances::AppearanceFlagAutomap& _internal_automap() const; - ::Canary::protobuf::appearances::AppearanceFlagAutomap* _internal_mutable_automap(); - public: - void unsafe_arena_set_allocated_automap( - ::Canary::protobuf::appearances::AppearanceFlagAutomap* automap); - ::Canary::protobuf::appearances::AppearanceFlagAutomap* unsafe_arena_release_automap(); - - // optional .Canary.protobuf.appearances.AppearanceFlagLenshelp lenshelp = 31; - bool has_lenshelp() const; - private: - bool _internal_has_lenshelp() const; - public: - void clear_lenshelp(); - const ::Canary::protobuf::appearances::AppearanceFlagLenshelp& lenshelp() const; - PROTOBUF_NODISCARD ::Canary::protobuf::appearances::AppearanceFlagLenshelp* release_lenshelp(); - ::Canary::protobuf::appearances::AppearanceFlagLenshelp* mutable_lenshelp(); - void set_allocated_lenshelp(::Canary::protobuf::appearances::AppearanceFlagLenshelp* lenshelp); - private: - const ::Canary::protobuf::appearances::AppearanceFlagLenshelp& _internal_lenshelp() const; - ::Canary::protobuf::appearances::AppearanceFlagLenshelp* _internal_mutable_lenshelp(); - public: - void unsafe_arena_set_allocated_lenshelp( - ::Canary::protobuf::appearances::AppearanceFlagLenshelp* lenshelp); - ::Canary::protobuf::appearances::AppearanceFlagLenshelp* unsafe_arena_release_lenshelp(); - - // optional .Canary.protobuf.appearances.AppearanceFlagClothes clothes = 34; - bool has_clothes() const; - private: - bool _internal_has_clothes() const; - public: - void clear_clothes(); - const ::Canary::protobuf::appearances::AppearanceFlagClothes& clothes() const; - PROTOBUF_NODISCARD ::Canary::protobuf::appearances::AppearanceFlagClothes* release_clothes(); - ::Canary::protobuf::appearances::AppearanceFlagClothes* mutable_clothes(); - void set_allocated_clothes(::Canary::protobuf::appearances::AppearanceFlagClothes* clothes); - private: - const ::Canary::protobuf::appearances::AppearanceFlagClothes& _internal_clothes() const; - ::Canary::protobuf::appearances::AppearanceFlagClothes* _internal_mutable_clothes(); - public: - void unsafe_arena_set_allocated_clothes( - ::Canary::protobuf::appearances::AppearanceFlagClothes* clothes); - ::Canary::protobuf::appearances::AppearanceFlagClothes* unsafe_arena_release_clothes(); - - // optional .Canary.protobuf.appearances.AppearanceFlagDefaultAction default_action = 35; - bool has_default_action() const; - private: - bool _internal_has_default_action() const; - public: - void clear_default_action(); - const ::Canary::protobuf::appearances::AppearanceFlagDefaultAction& default_action() const; - PROTOBUF_NODISCARD ::Canary::protobuf::appearances::AppearanceFlagDefaultAction* release_default_action(); - ::Canary::protobuf::appearances::AppearanceFlagDefaultAction* mutable_default_action(); - void set_allocated_default_action(::Canary::protobuf::appearances::AppearanceFlagDefaultAction* default_action); - private: - const ::Canary::protobuf::appearances::AppearanceFlagDefaultAction& _internal_default_action() const; - ::Canary::protobuf::appearances::AppearanceFlagDefaultAction* _internal_mutable_default_action(); - public: - void unsafe_arena_set_allocated_default_action( - ::Canary::protobuf::appearances::AppearanceFlagDefaultAction* default_action); - ::Canary::protobuf::appearances::AppearanceFlagDefaultAction* unsafe_arena_release_default_action(); - - // optional .Canary.protobuf.appearances.AppearanceFlagMarket market = 36; - bool has_market() const; - private: - bool _internal_has_market() const; - public: - void clear_market(); - const ::Canary::protobuf::appearances::AppearanceFlagMarket& market() const; - PROTOBUF_NODISCARD ::Canary::protobuf::appearances::AppearanceFlagMarket* release_market(); - ::Canary::protobuf::appearances::AppearanceFlagMarket* mutable_market(); - void set_allocated_market(::Canary::protobuf::appearances::AppearanceFlagMarket* market); - private: - const ::Canary::protobuf::appearances::AppearanceFlagMarket& _internal_market() const; - ::Canary::protobuf::appearances::AppearanceFlagMarket* _internal_mutable_market(); - public: - void unsafe_arena_set_allocated_market( - ::Canary::protobuf::appearances::AppearanceFlagMarket* market); - ::Canary::protobuf::appearances::AppearanceFlagMarket* unsafe_arena_release_market(); - - // optional .Canary.protobuf.appearances.AppearanceFlagChangedToExpire changedtoexpire = 41; - bool has_changedtoexpire() const; - private: - bool _internal_has_changedtoexpire() const; - public: - void clear_changedtoexpire(); - const ::Canary::protobuf::appearances::AppearanceFlagChangedToExpire& changedtoexpire() const; - PROTOBUF_NODISCARD ::Canary::protobuf::appearances::AppearanceFlagChangedToExpire* release_changedtoexpire(); - ::Canary::protobuf::appearances::AppearanceFlagChangedToExpire* mutable_changedtoexpire(); - void set_allocated_changedtoexpire(::Canary::protobuf::appearances::AppearanceFlagChangedToExpire* changedtoexpire); - private: - const ::Canary::protobuf::appearances::AppearanceFlagChangedToExpire& _internal_changedtoexpire() const; - ::Canary::protobuf::appearances::AppearanceFlagChangedToExpire* _internal_mutable_changedtoexpire(); - public: - void unsafe_arena_set_allocated_changedtoexpire( - ::Canary::protobuf::appearances::AppearanceFlagChangedToExpire* changedtoexpire); - ::Canary::protobuf::appearances::AppearanceFlagChangedToExpire* unsafe_arena_release_changedtoexpire(); - - // optional .Canary.protobuf.appearances.AppearanceFlagCyclopedia cyclopediaitem = 44; - bool has_cyclopediaitem() const; - private: - bool _internal_has_cyclopediaitem() const; - public: - void clear_cyclopediaitem(); - const ::Canary::protobuf::appearances::AppearanceFlagCyclopedia& cyclopediaitem() const; - PROTOBUF_NODISCARD ::Canary::protobuf::appearances::AppearanceFlagCyclopedia* release_cyclopediaitem(); - ::Canary::protobuf::appearances::AppearanceFlagCyclopedia* mutable_cyclopediaitem(); - void set_allocated_cyclopediaitem(::Canary::protobuf::appearances::AppearanceFlagCyclopedia* cyclopediaitem); - private: - const ::Canary::protobuf::appearances::AppearanceFlagCyclopedia& _internal_cyclopediaitem() const; - ::Canary::protobuf::appearances::AppearanceFlagCyclopedia* _internal_mutable_cyclopediaitem(); - public: - void unsafe_arena_set_allocated_cyclopediaitem( - ::Canary::protobuf::appearances::AppearanceFlagCyclopedia* cyclopediaitem); - ::Canary::protobuf::appearances::AppearanceFlagCyclopedia* unsafe_arena_release_cyclopediaitem(); - - // optional .Canary.protobuf.appearances.AppearanceFlagUpgradeClassification upgradeclassification = 48; - bool has_upgradeclassification() const; - private: - bool _internal_has_upgradeclassification() const; - public: - void clear_upgradeclassification(); - const ::Canary::protobuf::appearances::AppearanceFlagUpgradeClassification& upgradeclassification() const; - PROTOBUF_NODISCARD ::Canary::protobuf::appearances::AppearanceFlagUpgradeClassification* release_upgradeclassification(); - ::Canary::protobuf::appearances::AppearanceFlagUpgradeClassification* mutable_upgradeclassification(); - void set_allocated_upgradeclassification(::Canary::protobuf::appearances::AppearanceFlagUpgradeClassification* upgradeclassification); - private: - const ::Canary::protobuf::appearances::AppearanceFlagUpgradeClassification& _internal_upgradeclassification() const; - ::Canary::protobuf::appearances::AppearanceFlagUpgradeClassification* _internal_mutable_upgradeclassification(); - public: - void unsafe_arena_set_allocated_upgradeclassification( - ::Canary::protobuf::appearances::AppearanceFlagUpgradeClassification* upgradeclassification); - ::Canary::protobuf::appearances::AppearanceFlagUpgradeClassification* unsafe_arena_release_upgradeclassification(); - - // optional bool clip = 2; - bool has_clip() const; - private: - bool _internal_has_clip() const; - public: - void clear_clip(); - bool clip() const; - void set_clip(bool value); - private: - bool _internal_clip() const; - void _internal_set_clip(bool value); - public: - - // optional bool bottom = 3; - bool has_bottom() const; - private: - bool _internal_has_bottom() const; - public: - void clear_bottom(); - bool bottom() const; - void set_bottom(bool value); - private: - bool _internal_bottom() const; - void _internal_set_bottom(bool value); - public: - - // optional bool top = 4; - bool has_top() const; - private: - bool _internal_has_top() const; - public: - void clear_top(); - bool top() const; - void set_top(bool value); - private: - bool _internal_top() const; - void _internal_set_top(bool value); - public: - - // optional bool container = 5; - bool has_container() const; - private: - bool _internal_has_container() const; - public: - void clear_container(); - bool container() const; - void set_container(bool value); - private: - bool _internal_container() const; - void _internal_set_container(bool value); - public: - - // optional bool cumulative = 6; - bool has_cumulative() const; - private: - bool _internal_has_cumulative() const; - public: - void clear_cumulative(); - bool cumulative() const; - void set_cumulative(bool value); - private: - bool _internal_cumulative() const; - void _internal_set_cumulative(bool value); - public: - - // optional bool usable = 7; - bool has_usable() const; - private: - bool _internal_has_usable() const; - public: - void clear_usable(); - bool usable() const; - void set_usable(bool value); - private: - bool _internal_usable() const; - void _internal_set_usable(bool value); - public: - - // optional bool forceuse = 8; - bool has_forceuse() const; - private: - bool _internal_has_forceuse() const; - public: - void clear_forceuse(); - bool forceuse() const; - void set_forceuse(bool value); - private: - bool _internal_forceuse() const; - void _internal_set_forceuse(bool value); - public: - - // optional bool multiuse = 9; - bool has_multiuse() const; - private: - bool _internal_has_multiuse() const; - public: - void clear_multiuse(); - bool multiuse() const; - void set_multiuse(bool value); - private: - bool _internal_multiuse() const; - void _internal_set_multiuse(bool value); - public: - - // optional bool liquidpool = 12; - bool has_liquidpool() const; - private: - bool _internal_has_liquidpool() const; - public: - void clear_liquidpool(); - bool liquidpool() const; - void set_liquidpool(bool value); - private: - bool _internal_liquidpool() const; - void _internal_set_liquidpool(bool value); - public: - - // optional bool unpass = 13; - bool has_unpass() const; - private: - bool _internal_has_unpass() const; - public: - void clear_unpass(); - bool unpass() const; - void set_unpass(bool value); - private: - bool _internal_unpass() const; - void _internal_set_unpass(bool value); - public: - - // optional bool unmove = 14; - bool has_unmove() const; - private: - bool _internal_has_unmove() const; - public: - void clear_unmove(); - bool unmove() const; - void set_unmove(bool value); - private: - bool _internal_unmove() const; - void _internal_set_unmove(bool value); - public: - - // optional bool unsight = 15; - bool has_unsight() const; - private: - bool _internal_has_unsight() const; - public: - void clear_unsight(); - bool unsight() const; - void set_unsight(bool value); - private: - bool _internal_unsight() const; - void _internal_set_unsight(bool value); - public: - - // optional bool avoid = 16; - bool has_avoid() const; - private: - bool _internal_has_avoid() const; - public: - void clear_avoid(); - bool avoid() const; - void set_avoid(bool value); - private: - bool _internal_avoid() const; - void _internal_set_avoid(bool value); - public: - - // optional bool no_movement_animation = 17; - bool has_no_movement_animation() const; - private: - bool _internal_has_no_movement_animation() const; - public: - void clear_no_movement_animation(); - bool no_movement_animation() const; - void set_no_movement_animation(bool value); - private: - bool _internal_no_movement_animation() const; - void _internal_set_no_movement_animation(bool value); - public: - - // optional bool take = 18; - bool has_take() const; - private: - bool _internal_has_take() const; - public: - void clear_take(); - bool take() const; - void set_take(bool value); - private: - bool _internal_take() const; - void _internal_set_take(bool value); - public: - - // optional bool liquidcontainer = 19; - bool has_liquidcontainer() const; - private: - bool _internal_has_liquidcontainer() const; - public: - void clear_liquidcontainer(); - bool liquidcontainer() const; - void set_liquidcontainer(bool value); - private: - bool _internal_liquidcontainer() const; - void _internal_set_liquidcontainer(bool value); - public: - - // optional bool hang = 20; - bool has_hang() const; - private: - bool _internal_has_hang() const; - public: - void clear_hang(); - bool hang() const; - void set_hang(bool value); - private: - bool _internal_hang() const; - void _internal_set_hang(bool value); - public: - - // optional bool rotate = 22; - bool has_rotate() const; - private: - bool _internal_has_rotate() const; - public: - void clear_rotate(); - bool rotate() const; - void set_rotate(bool value); - private: - bool _internal_rotate() const; - void _internal_set_rotate(bool value); - public: - - // optional bool dont_hide = 24; - bool has_dont_hide() const; - private: - bool _internal_has_dont_hide() const; - public: - void clear_dont_hide(); - bool dont_hide() const; - void set_dont_hide(bool value); - private: - bool _internal_dont_hide() const; - void _internal_set_dont_hide(bool value); - public: - - // optional bool translucent = 25; - bool has_translucent() const; - private: - bool _internal_has_translucent() const; - public: - void clear_translucent(); - bool translucent() const; - void set_translucent(bool value); - private: - bool _internal_translucent() const; - void _internal_set_translucent(bool value); - public: - - // optional bool lying_object = 28; - bool has_lying_object() const; - private: - bool _internal_has_lying_object() const; - public: - void clear_lying_object(); - bool lying_object() const; - void set_lying_object(bool value); - private: - bool _internal_lying_object() const; - void _internal_set_lying_object(bool value); - public: - - // optional bool animate_always = 29; - bool has_animate_always() const; - private: - bool _internal_has_animate_always() const; - public: - void clear_animate_always(); - bool animate_always() const; - void set_animate_always(bool value); - private: - bool _internal_animate_always() const; - void _internal_set_animate_always(bool value); - public: - - // optional bool fullbank = 32; - bool has_fullbank() const; - private: - bool _internal_has_fullbank() const; - public: - void clear_fullbank(); - bool fullbank() const; - void set_fullbank(bool value); - private: - bool _internal_fullbank() const; - void _internal_set_fullbank(bool value); - public: - - // optional bool ignore_look = 33; - bool has_ignore_look() const; - private: - bool _internal_has_ignore_look() const; - public: - void clear_ignore_look(); - bool ignore_look() const; - void set_ignore_look(bool value); - private: - bool _internal_ignore_look() const; - void _internal_set_ignore_look(bool value); - public: - - // optional bool wrap = 37; - bool has_wrap() const; - private: - bool _internal_has_wrap() const; - public: - void clear_wrap(); - bool wrap() const; - void set_wrap(bool value); - private: - bool _internal_wrap() const; - void _internal_set_wrap(bool value); - public: - - // optional bool unwrap = 38; - bool has_unwrap() const; - private: - bool _internal_has_unwrap() const; - public: - void clear_unwrap(); - bool unwrap() const; - void set_unwrap(bool value); - private: - bool _internal_unwrap() const; - void _internal_set_unwrap(bool value); - public: - - // optional bool topeffect = 39; - bool has_topeffect() const; - private: - bool _internal_has_topeffect() const; - public: - void clear_topeffect(); - bool topeffect() const; - void set_topeffect(bool value); - private: - bool _internal_topeffect() const; - void _internal_set_topeffect(bool value); - public: - - // optional bool corpse = 42; - bool has_corpse() const; - private: - bool _internal_has_corpse() const; - public: - void clear_corpse(); - bool corpse() const; - void set_corpse(bool value); - private: - bool _internal_corpse() const; - void _internal_set_corpse(bool value); - public: - - // optional bool player_corpse = 43; - bool has_player_corpse() const; - private: - bool _internal_has_player_corpse() const; - public: - void clear_player_corpse(); - bool player_corpse() const; - void set_player_corpse(bool value); - private: - bool _internal_player_corpse() const; - void _internal_set_player_corpse(bool value); - public: - - // optional bool ammo = 45; - bool has_ammo() const; - private: - bool _internal_has_ammo() const; - public: - void clear_ammo(); - bool ammo() const; - void set_ammo(bool value); - private: - bool _internal_ammo() const; - void _internal_set_ammo(bool value); - public: - - // optional bool show_off_socket = 46; - bool has_show_off_socket() const; - private: - bool _internal_has_show_off_socket() const; - public: - void clear_show_off_socket(); - bool show_off_socket() const; - void set_show_off_socket(bool value); - private: - bool _internal_show_off_socket() const; - void _internal_set_show_off_socket(bool value); - public: - - // optional bool reportable = 47; - bool has_reportable() const; - private: - bool _internal_has_reportable() const; - public: - void clear_reportable(); - bool reportable() const; - void set_reportable(bool value); - private: - bool _internal_reportable() const; - void _internal_set_reportable(bool value); - public: - - // optional bool reverse_addons_east = 49; - bool has_reverse_addons_east() const; - private: - bool _internal_has_reverse_addons_east() const; - public: - void clear_reverse_addons_east(); - bool reverse_addons_east() const; - void set_reverse_addons_east(bool value); - private: - bool _internal_reverse_addons_east() const; - void _internal_set_reverse_addons_east(bool value); - public: - - // optional bool reverse_addons_west = 50; - bool has_reverse_addons_west() const; - private: - bool _internal_has_reverse_addons_west() const; - public: - void clear_reverse_addons_west(); - bool reverse_addons_west() const; - void set_reverse_addons_west(bool value); - private: - bool _internal_reverse_addons_west() const; - void _internal_set_reverse_addons_west(bool value); - public: - - // optional bool reverse_addons_south = 51; - bool has_reverse_addons_south() const; - private: - bool _internal_has_reverse_addons_south() const; - public: - void clear_reverse_addons_south(); - bool reverse_addons_south() const; - void set_reverse_addons_south(bool value); - private: - bool _internal_reverse_addons_south() const; - void _internal_set_reverse_addons_south(bool value); - public: - - // optional bool reverse_addons_north = 52; - bool has_reverse_addons_north() const; - private: - bool _internal_has_reverse_addons_north() const; - public: - void clear_reverse_addons_north(); - bool reverse_addons_north() const; - void set_reverse_addons_north(bool value); - private: - bool _internal_reverse_addons_north() const; - void _internal_set_reverse_addons_north(bool value); - public: - - // optional bool wearout = 53; - bool has_wearout() const; - private: - bool _internal_has_wearout() const; - public: - void clear_wearout(); - bool wearout() const; - void set_wearout(bool value); - private: - bool _internal_wearout() const; - void _internal_set_wearout(bool value); - public: - - // optional bool clockexpire = 54; - bool has_clockexpire() const; - private: - bool _internal_has_clockexpire() const; - public: - void clear_clockexpire(); - bool clockexpire() const; - void set_clockexpire(bool value); - private: - bool _internal_clockexpire() const; - void _internal_set_clockexpire(bool value); - public: - - // optional bool expire = 55; - bool has_expire() const; - private: - bool _internal_has_expire() const; - public: - void clear_expire(); - bool expire() const; - void set_expire(bool value); - private: - bool _internal_expire() const; - void _internal_set_expire(bool value); - public: - - // optional bool expirestop = 56; - bool has_expirestop() const; - private: - bool _internal_has_expirestop() const; - public: - void clear_expirestop(); - bool expirestop() const; - void set_expirestop(bool value); - private: - bool _internal_expirestop() const; - void _internal_set_expirestop(bool value); - public: - - // @@protoc_insertion_point(class_scope:Canary.protobuf.appearances.AppearanceFlags) - private: - class _Internal; - - template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; - typedef void InternalArenaConstructable_; - typedef void DestructorSkippable_; - struct Impl_ { - ::PROTOBUF_NAMESPACE_ID::internal::HasBits<2> _has_bits_; - mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; - ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::Canary::protobuf::appearances::AppearanceFlagNPC > npcsaledata_; - ::Canary::protobuf::appearances::AppearanceFlagBank* bank_; - ::Canary::protobuf::appearances::AppearanceFlagWrite* write_; - ::Canary::protobuf::appearances::AppearanceFlagWriteOnce* write_once_; - ::Canary::protobuf::appearances::AppearanceFlagHook* hook_; - ::Canary::protobuf::appearances::AppearanceFlagLight* light_; - ::Canary::protobuf::appearances::AppearanceFlagShift* shift_; - ::Canary::protobuf::appearances::AppearanceFlagHeight* height_; - ::Canary::protobuf::appearances::AppearanceFlagAutomap* automap_; - ::Canary::protobuf::appearances::AppearanceFlagLenshelp* lenshelp_; - ::Canary::protobuf::appearances::AppearanceFlagClothes* clothes_; - ::Canary::protobuf::appearances::AppearanceFlagDefaultAction* default_action_; - ::Canary::protobuf::appearances::AppearanceFlagMarket* market_; - ::Canary::protobuf::appearances::AppearanceFlagChangedToExpire* changedtoexpire_; - ::Canary::protobuf::appearances::AppearanceFlagCyclopedia* cyclopediaitem_; - ::Canary::protobuf::appearances::AppearanceFlagUpgradeClassification* upgradeclassification_; - bool clip_; - bool bottom_; - bool top_; - bool container_; - bool cumulative_; - bool usable_; - bool forceuse_; - bool multiuse_; - bool liquidpool_; - bool unpass_; - bool unmove_; - bool unsight_; - bool avoid_; - bool no_movement_animation_; - bool take_; - bool liquidcontainer_; - bool hang_; - bool rotate_; - bool dont_hide_; - bool translucent_; - bool lying_object_; - bool animate_always_; - bool fullbank_; - bool ignore_look_; - bool wrap_; - bool unwrap_; - bool topeffect_; - bool corpse_; - bool player_corpse_; - bool ammo_; - bool show_off_socket_; - bool reportable_; - bool reverse_addons_east_; - bool reverse_addons_west_; - bool reverse_addons_south_; - bool reverse_addons_north_; - bool wearout_; - bool clockexpire_; - bool expire_; - bool expirestop_; - }; - union { Impl_ _impl_; }; - friend struct ::TableStruct_appearances_2eproto; -}; -// ------------------------------------------------------------------- - -class AppearanceFlagUpgradeClassification final : - public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:Canary.protobuf.appearances.AppearanceFlagUpgradeClassification) */ { - public: - inline AppearanceFlagUpgradeClassification() : AppearanceFlagUpgradeClassification(nullptr) {} - ~AppearanceFlagUpgradeClassification() override; - explicit PROTOBUF_CONSTEXPR AppearanceFlagUpgradeClassification(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); - - AppearanceFlagUpgradeClassification(const AppearanceFlagUpgradeClassification& from); - AppearanceFlagUpgradeClassification(AppearanceFlagUpgradeClassification&& from) noexcept - : AppearanceFlagUpgradeClassification() { - *this = ::std::move(from); - } - - inline AppearanceFlagUpgradeClassification& operator=(const AppearanceFlagUpgradeClassification& from) { - CopyFrom(from); - return *this; - } - inline AppearanceFlagUpgradeClassification& operator=(AppearanceFlagUpgradeClassification&& from) noexcept { - if (this == &from) return *this; - if (GetOwningArena() == from.GetOwningArena() - #ifdef PROTOBUF_FORCE_COPY_IN_MOVE - && GetOwningArena() != nullptr - #endif // !PROTOBUF_FORCE_COPY_IN_MOVE - ) { - InternalSwap(&from); - } else { - CopyFrom(from); - } - return *this; - } - - inline const ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet& unknown_fields() const { - return _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance); - } - inline ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet* mutable_unknown_fields() { - return _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); - } - - static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { - return GetDescriptor(); - } - static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { - return default_instance().GetMetadata().descriptor; - } - static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { - return default_instance().GetMetadata().reflection; - } - static const AppearanceFlagUpgradeClassification& default_instance() { - return *internal_default_instance(); - } - static inline const AppearanceFlagUpgradeClassification* internal_default_instance() { - return reinterpret_cast( - &_AppearanceFlagUpgradeClassification_default_instance_); - } - static constexpr int kIndexInFileMessages = - 9; - - friend void swap(AppearanceFlagUpgradeClassification& a, AppearanceFlagUpgradeClassification& b) { - a.Swap(&b); - } - inline void Swap(AppearanceFlagUpgradeClassification* other) { - if (other == this) return; - #ifdef PROTOBUF_FORCE_COPY_IN_SWAP - if (GetOwningArena() != nullptr && - GetOwningArena() == other->GetOwningArena()) { - #else // PROTOBUF_FORCE_COPY_IN_SWAP - if (GetOwningArena() == other->GetOwningArena()) { - #endif // !PROTOBUF_FORCE_COPY_IN_SWAP - InternalSwap(other); - } else { - ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); - } - } - void UnsafeArenaSwap(AppearanceFlagUpgradeClassification* other) { - if (other == this) return; - GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); - InternalSwap(other); - } - - // implements Message ---------------------------------------------- - - AppearanceFlagUpgradeClassification* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { - return CreateMaybeMessage(arena); - } - using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; - void CopyFrom(const AppearanceFlagUpgradeClassification& from); - using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; - void MergeFrom( const AppearanceFlagUpgradeClassification& from) { - AppearanceFlagUpgradeClassification::MergeImpl(*this, from); - } - private: - static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg); - public: - PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; - bool IsInitialized() const final; - - size_t ByteSizeLong() const final; - const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; - uint8_t* _InternalSerialize( - uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; - int GetCachedSize() const final { return _impl_._cached_size_.Get(); } - - private: - void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned); - void SharedDtor(); - void SetCachedSize(int size) const final; - void InternalSwap(AppearanceFlagUpgradeClassification* other); - - private: - friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; - static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { - return "Canary.protobuf.appearances.AppearanceFlagUpgradeClassification"; - } - protected: - explicit AppearanceFlagUpgradeClassification(::PROTOBUF_NAMESPACE_ID::Arena* arena, - bool is_message_owned = false); - public: - - static const ClassData _class_data_; - const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; - - ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; - - // nested types ---------------------------------------------------- - - // accessors ------------------------------------------------------- - - enum : int { - kUpgradeClassificationFieldNumber = 1, - }; - // optional uint32 upgrade_classification = 1; - bool has_upgrade_classification() const; - private: - bool _internal_has_upgrade_classification() const; - public: - void clear_upgrade_classification(); - uint32_t upgrade_classification() const; - void set_upgrade_classification(uint32_t value); - private: - uint32_t _internal_upgrade_classification() const; - void _internal_set_upgrade_classification(uint32_t value); - public: - - // @@protoc_insertion_point(class_scope:Canary.protobuf.appearances.AppearanceFlagUpgradeClassification) - private: - class _Internal; - - template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; - typedef void InternalArenaConstructable_; - typedef void DestructorSkippable_; - struct Impl_ { - ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; - mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; - uint32_t upgrade_classification_; - }; - union { Impl_ _impl_; }; - friend struct ::TableStruct_appearances_2eproto; -}; -// ------------------------------------------------------------------- - -class AppearanceFlagBank final : - public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:Canary.protobuf.appearances.AppearanceFlagBank) */ { - public: - inline AppearanceFlagBank() : AppearanceFlagBank(nullptr) {} - ~AppearanceFlagBank() override; - explicit PROTOBUF_CONSTEXPR AppearanceFlagBank(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); - - AppearanceFlagBank(const AppearanceFlagBank& from); - AppearanceFlagBank(AppearanceFlagBank&& from) noexcept - : AppearanceFlagBank() { - *this = ::std::move(from); - } - - inline AppearanceFlagBank& operator=(const AppearanceFlagBank& from) { - CopyFrom(from); - return *this; - } - inline AppearanceFlagBank& operator=(AppearanceFlagBank&& from) noexcept { - if (this == &from) return *this; - if (GetOwningArena() == from.GetOwningArena() - #ifdef PROTOBUF_FORCE_COPY_IN_MOVE - && GetOwningArena() != nullptr - #endif // !PROTOBUF_FORCE_COPY_IN_MOVE - ) { - InternalSwap(&from); - } else { - CopyFrom(from); - } - return *this; - } - - inline const ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet& unknown_fields() const { - return _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance); - } - inline ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet* mutable_unknown_fields() { - return _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); - } - - static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { - return GetDescriptor(); - } - static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { - return default_instance().GetMetadata().descriptor; - } - static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { - return default_instance().GetMetadata().reflection; - } - static const AppearanceFlagBank& default_instance() { - return *internal_default_instance(); - } - static inline const AppearanceFlagBank* internal_default_instance() { - return reinterpret_cast( - &_AppearanceFlagBank_default_instance_); - } - static constexpr int kIndexInFileMessages = - 10; - - friend void swap(AppearanceFlagBank& a, AppearanceFlagBank& b) { - a.Swap(&b); - } - inline void Swap(AppearanceFlagBank* other) { - if (other == this) return; - #ifdef PROTOBUF_FORCE_COPY_IN_SWAP - if (GetOwningArena() != nullptr && - GetOwningArena() == other->GetOwningArena()) { - #else // PROTOBUF_FORCE_COPY_IN_SWAP - if (GetOwningArena() == other->GetOwningArena()) { - #endif // !PROTOBUF_FORCE_COPY_IN_SWAP - InternalSwap(other); - } else { - ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); - } - } - void UnsafeArenaSwap(AppearanceFlagBank* other) { - if (other == this) return; - GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); - InternalSwap(other); - } - - // implements Message ---------------------------------------------- - - AppearanceFlagBank* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { - return CreateMaybeMessage(arena); - } - using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; - void CopyFrom(const AppearanceFlagBank& from); - using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; - void MergeFrom( const AppearanceFlagBank& from) { - AppearanceFlagBank::MergeImpl(*this, from); - } - private: - static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg); - public: - PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; - bool IsInitialized() const final; - - size_t ByteSizeLong() const final; - const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; - uint8_t* _InternalSerialize( - uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; - int GetCachedSize() const final { return _impl_._cached_size_.Get(); } - - private: - void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned); - void SharedDtor(); - void SetCachedSize(int size) const final; - void InternalSwap(AppearanceFlagBank* other); - - private: - friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; - static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { - return "Canary.protobuf.appearances.AppearanceFlagBank"; - } - protected: - explicit AppearanceFlagBank(::PROTOBUF_NAMESPACE_ID::Arena* arena, - bool is_message_owned = false); - public: - - static const ClassData _class_data_; - const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; - - ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; - - // nested types ---------------------------------------------------- - - // accessors ------------------------------------------------------- - - enum : int { - kWaypointsFieldNumber = 1, - }; - // optional uint32 waypoints = 1; - bool has_waypoints() const; - private: - bool _internal_has_waypoints() const; - public: - void clear_waypoints(); - uint32_t waypoints() const; - void set_waypoints(uint32_t value); - private: - uint32_t _internal_waypoints() const; - void _internal_set_waypoints(uint32_t value); - public: - - // @@protoc_insertion_point(class_scope:Canary.protobuf.appearances.AppearanceFlagBank) - private: - class _Internal; - - template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; - typedef void InternalArenaConstructable_; - typedef void DestructorSkippable_; - struct Impl_ { - ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; - mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; - uint32_t waypoints_; - }; - union { Impl_ _impl_; }; - friend struct ::TableStruct_appearances_2eproto; -}; -// ------------------------------------------------------------------- - -class AppearanceFlagWrite final : - public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:Canary.protobuf.appearances.AppearanceFlagWrite) */ { - public: - inline AppearanceFlagWrite() : AppearanceFlagWrite(nullptr) {} - ~AppearanceFlagWrite() override; - explicit PROTOBUF_CONSTEXPR AppearanceFlagWrite(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); - - AppearanceFlagWrite(const AppearanceFlagWrite& from); - AppearanceFlagWrite(AppearanceFlagWrite&& from) noexcept - : AppearanceFlagWrite() { - *this = ::std::move(from); - } - - inline AppearanceFlagWrite& operator=(const AppearanceFlagWrite& from) { - CopyFrom(from); - return *this; - } - inline AppearanceFlagWrite& operator=(AppearanceFlagWrite&& from) noexcept { - if (this == &from) return *this; - if (GetOwningArena() == from.GetOwningArena() - #ifdef PROTOBUF_FORCE_COPY_IN_MOVE - && GetOwningArena() != nullptr - #endif // !PROTOBUF_FORCE_COPY_IN_MOVE - ) { - InternalSwap(&from); - } else { - CopyFrom(from); - } - return *this; - } - - inline const ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet& unknown_fields() const { - return _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance); - } - inline ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet* mutable_unknown_fields() { - return _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); - } - - static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { - return GetDescriptor(); - } - static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { - return default_instance().GetMetadata().descriptor; - } - static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { - return default_instance().GetMetadata().reflection; - } - static const AppearanceFlagWrite& default_instance() { - return *internal_default_instance(); - } - static inline const AppearanceFlagWrite* internal_default_instance() { - return reinterpret_cast( - &_AppearanceFlagWrite_default_instance_); - } - static constexpr int kIndexInFileMessages = - 11; - - friend void swap(AppearanceFlagWrite& a, AppearanceFlagWrite& b) { - a.Swap(&b); - } - inline void Swap(AppearanceFlagWrite* other) { - if (other == this) return; - #ifdef PROTOBUF_FORCE_COPY_IN_SWAP - if (GetOwningArena() != nullptr && - GetOwningArena() == other->GetOwningArena()) { - #else // PROTOBUF_FORCE_COPY_IN_SWAP - if (GetOwningArena() == other->GetOwningArena()) { - #endif // !PROTOBUF_FORCE_COPY_IN_SWAP - InternalSwap(other); - } else { - ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); - } - } - void UnsafeArenaSwap(AppearanceFlagWrite* other) { - if (other == this) return; - GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); - InternalSwap(other); - } - - // implements Message ---------------------------------------------- - - AppearanceFlagWrite* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { - return CreateMaybeMessage(arena); - } - using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; - void CopyFrom(const AppearanceFlagWrite& from); - using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; - void MergeFrom( const AppearanceFlagWrite& from) { - AppearanceFlagWrite::MergeImpl(*this, from); - } - private: - static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg); - public: - PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; - bool IsInitialized() const final; - - size_t ByteSizeLong() const final; - const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; - uint8_t* _InternalSerialize( - uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; - int GetCachedSize() const final { return _impl_._cached_size_.Get(); } - - private: - void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned); - void SharedDtor(); - void SetCachedSize(int size) const final; - void InternalSwap(AppearanceFlagWrite* other); - - private: - friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; - static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { - return "Canary.protobuf.appearances.AppearanceFlagWrite"; - } - protected: - explicit AppearanceFlagWrite(::PROTOBUF_NAMESPACE_ID::Arena* arena, - bool is_message_owned = false); - public: - - static const ClassData _class_data_; - const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; - - ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; - - // nested types ---------------------------------------------------- - - // accessors ------------------------------------------------------- - - enum : int { - kMaxTextLengthFieldNumber = 1, - }; - // optional uint32 max_text_length = 1; - bool has_max_text_length() const; - private: - bool _internal_has_max_text_length() const; - public: - void clear_max_text_length(); - uint32_t max_text_length() const; - void set_max_text_length(uint32_t value); - private: - uint32_t _internal_max_text_length() const; - void _internal_set_max_text_length(uint32_t value); - public: - - // @@protoc_insertion_point(class_scope:Canary.protobuf.appearances.AppearanceFlagWrite) - private: - class _Internal; - - template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; - typedef void InternalArenaConstructable_; - typedef void DestructorSkippable_; - struct Impl_ { - ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; - mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; - uint32_t max_text_length_; - }; - union { Impl_ _impl_; }; - friend struct ::TableStruct_appearances_2eproto; -}; -// ------------------------------------------------------------------- - -class AppearanceFlagWriteOnce final : - public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:Canary.protobuf.appearances.AppearanceFlagWriteOnce) */ { - public: - inline AppearanceFlagWriteOnce() : AppearanceFlagWriteOnce(nullptr) {} - ~AppearanceFlagWriteOnce() override; - explicit PROTOBUF_CONSTEXPR AppearanceFlagWriteOnce(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); - - AppearanceFlagWriteOnce(const AppearanceFlagWriteOnce& from); - AppearanceFlagWriteOnce(AppearanceFlagWriteOnce&& from) noexcept - : AppearanceFlagWriteOnce() { - *this = ::std::move(from); - } - - inline AppearanceFlagWriteOnce& operator=(const AppearanceFlagWriteOnce& from) { - CopyFrom(from); - return *this; - } - inline AppearanceFlagWriteOnce& operator=(AppearanceFlagWriteOnce&& from) noexcept { - if (this == &from) return *this; - if (GetOwningArena() == from.GetOwningArena() - #ifdef PROTOBUF_FORCE_COPY_IN_MOVE - && GetOwningArena() != nullptr - #endif // !PROTOBUF_FORCE_COPY_IN_MOVE - ) { - InternalSwap(&from); - } else { - CopyFrom(from); - } - return *this; - } - - inline const ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet& unknown_fields() const { - return _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance); - } - inline ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet* mutable_unknown_fields() { - return _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); - } - - static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { - return GetDescriptor(); - } - static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { - return default_instance().GetMetadata().descriptor; - } - static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { - return default_instance().GetMetadata().reflection; - } - static const AppearanceFlagWriteOnce& default_instance() { - return *internal_default_instance(); - } - static inline const AppearanceFlagWriteOnce* internal_default_instance() { - return reinterpret_cast( - &_AppearanceFlagWriteOnce_default_instance_); - } - static constexpr int kIndexInFileMessages = - 12; - - friend void swap(AppearanceFlagWriteOnce& a, AppearanceFlagWriteOnce& b) { - a.Swap(&b); - } - inline void Swap(AppearanceFlagWriteOnce* other) { - if (other == this) return; - #ifdef PROTOBUF_FORCE_COPY_IN_SWAP - if (GetOwningArena() != nullptr && - GetOwningArena() == other->GetOwningArena()) { - #else // PROTOBUF_FORCE_COPY_IN_SWAP - if (GetOwningArena() == other->GetOwningArena()) { - #endif // !PROTOBUF_FORCE_COPY_IN_SWAP - InternalSwap(other); - } else { - ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); - } - } - void UnsafeArenaSwap(AppearanceFlagWriteOnce* other) { - if (other == this) return; - GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); - InternalSwap(other); - } - - // implements Message ---------------------------------------------- - - AppearanceFlagWriteOnce* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { - return CreateMaybeMessage(arena); - } - using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; - void CopyFrom(const AppearanceFlagWriteOnce& from); - using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; - void MergeFrom( const AppearanceFlagWriteOnce& from) { - AppearanceFlagWriteOnce::MergeImpl(*this, from); - } - private: - static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg); - public: - PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; - bool IsInitialized() const final; - - size_t ByteSizeLong() const final; - const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; - uint8_t* _InternalSerialize( - uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; - int GetCachedSize() const final { return _impl_._cached_size_.Get(); } - - private: - void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned); - void SharedDtor(); - void SetCachedSize(int size) const final; - void InternalSwap(AppearanceFlagWriteOnce* other); - - private: - friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; - static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { - return "Canary.protobuf.appearances.AppearanceFlagWriteOnce"; - } - protected: - explicit AppearanceFlagWriteOnce(::PROTOBUF_NAMESPACE_ID::Arena* arena, - bool is_message_owned = false); - public: - - static const ClassData _class_data_; - const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; - - ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; - - // nested types ---------------------------------------------------- - - // accessors ------------------------------------------------------- - - enum : int { - kMaxTextLengthOnceFieldNumber = 1, - }; - // optional uint32 max_text_length_once = 1; - bool has_max_text_length_once() const; - private: - bool _internal_has_max_text_length_once() const; - public: - void clear_max_text_length_once(); - uint32_t max_text_length_once() const; - void set_max_text_length_once(uint32_t value); - private: - uint32_t _internal_max_text_length_once() const; - void _internal_set_max_text_length_once(uint32_t value); - public: - - // @@protoc_insertion_point(class_scope:Canary.protobuf.appearances.AppearanceFlagWriteOnce) - private: - class _Internal; - - template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; - typedef void InternalArenaConstructable_; - typedef void DestructorSkippable_; - struct Impl_ { - ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; - mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; - uint32_t max_text_length_once_; - }; - union { Impl_ _impl_; }; - friend struct ::TableStruct_appearances_2eproto; -}; -// ------------------------------------------------------------------- - -class AppearanceFlagLight final : - public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:Canary.protobuf.appearances.AppearanceFlagLight) */ { - public: - inline AppearanceFlagLight() : AppearanceFlagLight(nullptr) {} - ~AppearanceFlagLight() override; - explicit PROTOBUF_CONSTEXPR AppearanceFlagLight(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); - - AppearanceFlagLight(const AppearanceFlagLight& from); - AppearanceFlagLight(AppearanceFlagLight&& from) noexcept - : AppearanceFlagLight() { - *this = ::std::move(from); - } - - inline AppearanceFlagLight& operator=(const AppearanceFlagLight& from) { - CopyFrom(from); - return *this; - } - inline AppearanceFlagLight& operator=(AppearanceFlagLight&& from) noexcept { - if (this == &from) return *this; - if (GetOwningArena() == from.GetOwningArena() - #ifdef PROTOBUF_FORCE_COPY_IN_MOVE - && GetOwningArena() != nullptr - #endif // !PROTOBUF_FORCE_COPY_IN_MOVE - ) { - InternalSwap(&from); - } else { - CopyFrom(from); - } - return *this; - } - - inline const ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet& unknown_fields() const { - return _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance); - } - inline ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet* mutable_unknown_fields() { - return _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); - } - - static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { - return GetDescriptor(); - } - static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { - return default_instance().GetMetadata().descriptor; - } - static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { - return default_instance().GetMetadata().reflection; - } - static const AppearanceFlagLight& default_instance() { - return *internal_default_instance(); - } - static inline const AppearanceFlagLight* internal_default_instance() { - return reinterpret_cast( - &_AppearanceFlagLight_default_instance_); - } - static constexpr int kIndexInFileMessages = - 13; - - friend void swap(AppearanceFlagLight& a, AppearanceFlagLight& b) { - a.Swap(&b); - } - inline void Swap(AppearanceFlagLight* other) { - if (other == this) return; - #ifdef PROTOBUF_FORCE_COPY_IN_SWAP - if (GetOwningArena() != nullptr && - GetOwningArena() == other->GetOwningArena()) { - #else // PROTOBUF_FORCE_COPY_IN_SWAP - if (GetOwningArena() == other->GetOwningArena()) { - #endif // !PROTOBUF_FORCE_COPY_IN_SWAP - InternalSwap(other); - } else { - ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); - } - } - void UnsafeArenaSwap(AppearanceFlagLight* other) { - if (other == this) return; - GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); - InternalSwap(other); - } - - // implements Message ---------------------------------------------- - - AppearanceFlagLight* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { - return CreateMaybeMessage(arena); - } - using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; - void CopyFrom(const AppearanceFlagLight& from); - using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; - void MergeFrom( const AppearanceFlagLight& from) { - AppearanceFlagLight::MergeImpl(*this, from); - } - private: - static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg); - public: - PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; - bool IsInitialized() const final; - - size_t ByteSizeLong() const final; - const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; - uint8_t* _InternalSerialize( - uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; - int GetCachedSize() const final { return _impl_._cached_size_.Get(); } - - private: - void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned); - void SharedDtor(); - void SetCachedSize(int size) const final; - void InternalSwap(AppearanceFlagLight* other); - - private: - friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; - static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { - return "Canary.protobuf.appearances.AppearanceFlagLight"; - } - protected: - explicit AppearanceFlagLight(::PROTOBUF_NAMESPACE_ID::Arena* arena, - bool is_message_owned = false); - public: - - static const ClassData _class_data_; - const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; - - ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; - - // nested types ---------------------------------------------------- - - // accessors ------------------------------------------------------- - - enum : int { - kBrightnessFieldNumber = 1, - kColorFieldNumber = 2, - }; - // optional uint32 brightness = 1; - bool has_brightness() const; - private: - bool _internal_has_brightness() const; - public: - void clear_brightness(); - uint32_t brightness() const; - void set_brightness(uint32_t value); - private: - uint32_t _internal_brightness() const; - void _internal_set_brightness(uint32_t value); - public: - - // optional uint32 color = 2; - bool has_color() const; - private: - bool _internal_has_color() const; - public: - void clear_color(); - uint32_t color() const; - void set_color(uint32_t value); - private: - uint32_t _internal_color() const; - void _internal_set_color(uint32_t value); - public: - - // @@protoc_insertion_point(class_scope:Canary.protobuf.appearances.AppearanceFlagLight) - private: - class _Internal; - - template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; - typedef void InternalArenaConstructable_; - typedef void DestructorSkippable_; - struct Impl_ { - ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; - mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; - uint32_t brightness_; - uint32_t color_; - }; - union { Impl_ _impl_; }; - friend struct ::TableStruct_appearances_2eproto; -}; -// ------------------------------------------------------------------- - -class AppearanceFlagHeight final : - public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:Canary.protobuf.appearances.AppearanceFlagHeight) */ { - public: - inline AppearanceFlagHeight() : AppearanceFlagHeight(nullptr) {} - ~AppearanceFlagHeight() override; - explicit PROTOBUF_CONSTEXPR AppearanceFlagHeight(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); - - AppearanceFlagHeight(const AppearanceFlagHeight& from); - AppearanceFlagHeight(AppearanceFlagHeight&& from) noexcept - : AppearanceFlagHeight() { - *this = ::std::move(from); - } - - inline AppearanceFlagHeight& operator=(const AppearanceFlagHeight& from) { - CopyFrom(from); - return *this; - } - inline AppearanceFlagHeight& operator=(AppearanceFlagHeight&& from) noexcept { - if (this == &from) return *this; - if (GetOwningArena() == from.GetOwningArena() - #ifdef PROTOBUF_FORCE_COPY_IN_MOVE - && GetOwningArena() != nullptr - #endif // !PROTOBUF_FORCE_COPY_IN_MOVE - ) { - InternalSwap(&from); - } else { - CopyFrom(from); - } - return *this; - } - - inline const ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet& unknown_fields() const { - return _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance); - } - inline ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet* mutable_unknown_fields() { - return _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); - } - - static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { - return GetDescriptor(); - } - static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { - return default_instance().GetMetadata().descriptor; - } - static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { - return default_instance().GetMetadata().reflection; - } - static const AppearanceFlagHeight& default_instance() { - return *internal_default_instance(); - } - static inline const AppearanceFlagHeight* internal_default_instance() { - return reinterpret_cast( - &_AppearanceFlagHeight_default_instance_); - } - static constexpr int kIndexInFileMessages = - 14; - - friend void swap(AppearanceFlagHeight& a, AppearanceFlagHeight& b) { - a.Swap(&b); - } - inline void Swap(AppearanceFlagHeight* other) { - if (other == this) return; - #ifdef PROTOBUF_FORCE_COPY_IN_SWAP - if (GetOwningArena() != nullptr && - GetOwningArena() == other->GetOwningArena()) { - #else // PROTOBUF_FORCE_COPY_IN_SWAP - if (GetOwningArena() == other->GetOwningArena()) { - #endif // !PROTOBUF_FORCE_COPY_IN_SWAP - InternalSwap(other); - } else { - ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); - } - } - void UnsafeArenaSwap(AppearanceFlagHeight* other) { - if (other == this) return; - GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); - InternalSwap(other); - } - - // implements Message ---------------------------------------------- - - AppearanceFlagHeight* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { - return CreateMaybeMessage(arena); - } - using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; - void CopyFrom(const AppearanceFlagHeight& from); - using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; - void MergeFrom( const AppearanceFlagHeight& from) { - AppearanceFlagHeight::MergeImpl(*this, from); - } - private: - static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg); - public: - PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; - bool IsInitialized() const final; - - size_t ByteSizeLong() const final; - const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; - uint8_t* _InternalSerialize( - uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; - int GetCachedSize() const final { return _impl_._cached_size_.Get(); } - - private: - void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned); - void SharedDtor(); - void SetCachedSize(int size) const final; - void InternalSwap(AppearanceFlagHeight* other); - - private: - friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; - static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { - return "Canary.protobuf.appearances.AppearanceFlagHeight"; - } - protected: - explicit AppearanceFlagHeight(::PROTOBUF_NAMESPACE_ID::Arena* arena, - bool is_message_owned = false); - public: - - static const ClassData _class_data_; - const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; - - ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; - - // nested types ---------------------------------------------------- - - // accessors ------------------------------------------------------- - - enum : int { - kElevationFieldNumber = 1, - }; - // optional uint32 elevation = 1; - bool has_elevation() const; - private: - bool _internal_has_elevation() const; - public: - void clear_elevation(); - uint32_t elevation() const; - void set_elevation(uint32_t value); - private: - uint32_t _internal_elevation() const; - void _internal_set_elevation(uint32_t value); - public: - - // @@protoc_insertion_point(class_scope:Canary.protobuf.appearances.AppearanceFlagHeight) - private: - class _Internal; - - template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; - typedef void InternalArenaConstructable_; - typedef void DestructorSkippable_; - struct Impl_ { - ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; - mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; - uint32_t elevation_; - }; - union { Impl_ _impl_; }; - friend struct ::TableStruct_appearances_2eproto; -}; -// ------------------------------------------------------------------- - -class AppearanceFlagShift final : - public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:Canary.protobuf.appearances.AppearanceFlagShift) */ { - public: - inline AppearanceFlagShift() : AppearanceFlagShift(nullptr) {} - ~AppearanceFlagShift() override; - explicit PROTOBUF_CONSTEXPR AppearanceFlagShift(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); - - AppearanceFlagShift(const AppearanceFlagShift& from); - AppearanceFlagShift(AppearanceFlagShift&& from) noexcept - : AppearanceFlagShift() { - *this = ::std::move(from); - } - - inline AppearanceFlagShift& operator=(const AppearanceFlagShift& from) { - CopyFrom(from); - return *this; - } - inline AppearanceFlagShift& operator=(AppearanceFlagShift&& from) noexcept { - if (this == &from) return *this; - if (GetOwningArena() == from.GetOwningArena() - #ifdef PROTOBUF_FORCE_COPY_IN_MOVE - && GetOwningArena() != nullptr - #endif // !PROTOBUF_FORCE_COPY_IN_MOVE - ) { - InternalSwap(&from); - } else { - CopyFrom(from); - } - return *this; - } - - inline const ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet& unknown_fields() const { - return _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance); - } - inline ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet* mutable_unknown_fields() { - return _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); - } - - static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { - return GetDescriptor(); - } - static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { - return default_instance().GetMetadata().descriptor; - } - static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { - return default_instance().GetMetadata().reflection; - } - static const AppearanceFlagShift& default_instance() { - return *internal_default_instance(); - } - static inline const AppearanceFlagShift* internal_default_instance() { - return reinterpret_cast( - &_AppearanceFlagShift_default_instance_); - } - static constexpr int kIndexInFileMessages = - 15; - - friend void swap(AppearanceFlagShift& a, AppearanceFlagShift& b) { - a.Swap(&b); - } - inline void Swap(AppearanceFlagShift* other) { - if (other == this) return; - #ifdef PROTOBUF_FORCE_COPY_IN_SWAP - if (GetOwningArena() != nullptr && - GetOwningArena() == other->GetOwningArena()) { - #else // PROTOBUF_FORCE_COPY_IN_SWAP - if (GetOwningArena() == other->GetOwningArena()) { - #endif // !PROTOBUF_FORCE_COPY_IN_SWAP - InternalSwap(other); - } else { - ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); - } - } - void UnsafeArenaSwap(AppearanceFlagShift* other) { - if (other == this) return; - GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); - InternalSwap(other); - } - - // implements Message ---------------------------------------------- - - AppearanceFlagShift* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { - return CreateMaybeMessage(arena); - } - using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; - void CopyFrom(const AppearanceFlagShift& from); - using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; - void MergeFrom( const AppearanceFlagShift& from) { - AppearanceFlagShift::MergeImpl(*this, from); - } - private: - static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg); - public: - PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; - bool IsInitialized() const final; - - size_t ByteSizeLong() const final; - const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; - uint8_t* _InternalSerialize( - uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; - int GetCachedSize() const final { return _impl_._cached_size_.Get(); } - - private: - void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned); - void SharedDtor(); - void SetCachedSize(int size) const final; - void InternalSwap(AppearanceFlagShift* other); - - private: - friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; - static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { - return "Canary.protobuf.appearances.AppearanceFlagShift"; - } - protected: - explicit AppearanceFlagShift(::PROTOBUF_NAMESPACE_ID::Arena* arena, - bool is_message_owned = false); - public: - - static const ClassData _class_data_; - const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; - - ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; - - // nested types ---------------------------------------------------- - - // accessors ------------------------------------------------------- - - enum : int { - kXFieldNumber = 1, - kYFieldNumber = 2, - }; - // optional uint32 x = 1; - bool has_x() const; - private: - bool _internal_has_x() const; - public: - void clear_x(); - uint32_t x() const; - void set_x(uint32_t value); - private: - uint32_t _internal_x() const; - void _internal_set_x(uint32_t value); - public: - - // optional uint32 y = 2; - bool has_y() const; - private: - bool _internal_has_y() const; - public: - void clear_y(); - uint32_t y() const; - void set_y(uint32_t value); - private: - uint32_t _internal_y() const; - void _internal_set_y(uint32_t value); - public: - - // @@protoc_insertion_point(class_scope:Canary.protobuf.appearances.AppearanceFlagShift) - private: - class _Internal; - - template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; - typedef void InternalArenaConstructable_; - typedef void DestructorSkippable_; - struct Impl_ { - ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; - mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; - uint32_t x_; - uint32_t y_; - }; - union { Impl_ _impl_; }; - friend struct ::TableStruct_appearances_2eproto; -}; -// ------------------------------------------------------------------- - -class AppearanceFlagClothes final : - public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:Canary.protobuf.appearances.AppearanceFlagClothes) */ { - public: - inline AppearanceFlagClothes() : AppearanceFlagClothes(nullptr) {} - ~AppearanceFlagClothes() override; - explicit PROTOBUF_CONSTEXPR AppearanceFlagClothes(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); - - AppearanceFlagClothes(const AppearanceFlagClothes& from); - AppearanceFlagClothes(AppearanceFlagClothes&& from) noexcept - : AppearanceFlagClothes() { - *this = ::std::move(from); - } - - inline AppearanceFlagClothes& operator=(const AppearanceFlagClothes& from) { - CopyFrom(from); - return *this; - } - inline AppearanceFlagClothes& operator=(AppearanceFlagClothes&& from) noexcept { - if (this == &from) return *this; - if (GetOwningArena() == from.GetOwningArena() - #ifdef PROTOBUF_FORCE_COPY_IN_MOVE - && GetOwningArena() != nullptr - #endif // !PROTOBUF_FORCE_COPY_IN_MOVE - ) { - InternalSwap(&from); - } else { - CopyFrom(from); - } - return *this; - } - - inline const ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet& unknown_fields() const { - return _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance); - } - inline ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet* mutable_unknown_fields() { - return _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); - } - - static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { - return GetDescriptor(); - } - static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { - return default_instance().GetMetadata().descriptor; - } - static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { - return default_instance().GetMetadata().reflection; - } - static const AppearanceFlagClothes& default_instance() { - return *internal_default_instance(); - } - static inline const AppearanceFlagClothes* internal_default_instance() { - return reinterpret_cast( - &_AppearanceFlagClothes_default_instance_); - } - static constexpr int kIndexInFileMessages = - 16; - - friend void swap(AppearanceFlagClothes& a, AppearanceFlagClothes& b) { - a.Swap(&b); - } - inline void Swap(AppearanceFlagClothes* other) { - if (other == this) return; - #ifdef PROTOBUF_FORCE_COPY_IN_SWAP - if (GetOwningArena() != nullptr && - GetOwningArena() == other->GetOwningArena()) { - #else // PROTOBUF_FORCE_COPY_IN_SWAP - if (GetOwningArena() == other->GetOwningArena()) { - #endif // !PROTOBUF_FORCE_COPY_IN_SWAP - InternalSwap(other); - } else { - ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); - } - } - void UnsafeArenaSwap(AppearanceFlagClothes* other) { - if (other == this) return; - GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); - InternalSwap(other); - } - - // implements Message ---------------------------------------------- - - AppearanceFlagClothes* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { - return CreateMaybeMessage(arena); - } - using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; - void CopyFrom(const AppearanceFlagClothes& from); - using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; - void MergeFrom( const AppearanceFlagClothes& from) { - AppearanceFlagClothes::MergeImpl(*this, from); - } - private: - static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg); - public: - PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; - bool IsInitialized() const final; - - size_t ByteSizeLong() const final; - const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; - uint8_t* _InternalSerialize( - uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; - int GetCachedSize() const final { return _impl_._cached_size_.Get(); } - - private: - void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned); - void SharedDtor(); - void SetCachedSize(int size) const final; - void InternalSwap(AppearanceFlagClothes* other); - - private: - friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; - static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { - return "Canary.protobuf.appearances.AppearanceFlagClothes"; - } - protected: - explicit AppearanceFlagClothes(::PROTOBUF_NAMESPACE_ID::Arena* arena, - bool is_message_owned = false); - public: - - static const ClassData _class_data_; - const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; - - ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; - - // nested types ---------------------------------------------------- - - // accessors ------------------------------------------------------- - - enum : int { - kSlotFieldNumber = 1, - }; - // optional uint32 slot = 1; - bool has_slot() const; - private: - bool _internal_has_slot() const; - public: - void clear_slot(); - uint32_t slot() const; - void set_slot(uint32_t value); - private: - uint32_t _internal_slot() const; - void _internal_set_slot(uint32_t value); - public: - - // @@protoc_insertion_point(class_scope:Canary.protobuf.appearances.AppearanceFlagClothes) - private: - class _Internal; - - template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; - typedef void InternalArenaConstructable_; - typedef void DestructorSkippable_; - struct Impl_ { - ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; - mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; - uint32_t slot_; - }; - union { Impl_ _impl_; }; - friend struct ::TableStruct_appearances_2eproto; -}; -// ------------------------------------------------------------------- - -class AppearanceFlagDefaultAction final : - public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:Canary.protobuf.appearances.AppearanceFlagDefaultAction) */ { - public: - inline AppearanceFlagDefaultAction() : AppearanceFlagDefaultAction(nullptr) {} - ~AppearanceFlagDefaultAction() override; - explicit PROTOBUF_CONSTEXPR AppearanceFlagDefaultAction(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); - - AppearanceFlagDefaultAction(const AppearanceFlagDefaultAction& from); - AppearanceFlagDefaultAction(AppearanceFlagDefaultAction&& from) noexcept - : AppearanceFlagDefaultAction() { - *this = ::std::move(from); - } - - inline AppearanceFlagDefaultAction& operator=(const AppearanceFlagDefaultAction& from) { - CopyFrom(from); - return *this; - } - inline AppearanceFlagDefaultAction& operator=(AppearanceFlagDefaultAction&& from) noexcept { - if (this == &from) return *this; - if (GetOwningArena() == from.GetOwningArena() - #ifdef PROTOBUF_FORCE_COPY_IN_MOVE - && GetOwningArena() != nullptr - #endif // !PROTOBUF_FORCE_COPY_IN_MOVE - ) { - InternalSwap(&from); - } else { - CopyFrom(from); - } - return *this; - } - - inline const ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet& unknown_fields() const { - return _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance); - } - inline ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet* mutable_unknown_fields() { - return _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); - } - - static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { - return GetDescriptor(); - } - static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { - return default_instance().GetMetadata().descriptor; - } - static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { - return default_instance().GetMetadata().reflection; - } - static const AppearanceFlagDefaultAction& default_instance() { - return *internal_default_instance(); - } - static inline const AppearanceFlagDefaultAction* internal_default_instance() { - return reinterpret_cast( - &_AppearanceFlagDefaultAction_default_instance_); - } - static constexpr int kIndexInFileMessages = - 17; - - friend void swap(AppearanceFlagDefaultAction& a, AppearanceFlagDefaultAction& b) { - a.Swap(&b); - } - inline void Swap(AppearanceFlagDefaultAction* other) { - if (other == this) return; - #ifdef PROTOBUF_FORCE_COPY_IN_SWAP - if (GetOwningArena() != nullptr && - GetOwningArena() == other->GetOwningArena()) { - #else // PROTOBUF_FORCE_COPY_IN_SWAP - if (GetOwningArena() == other->GetOwningArena()) { - #endif // !PROTOBUF_FORCE_COPY_IN_SWAP - InternalSwap(other); - } else { - ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); - } - } - void UnsafeArenaSwap(AppearanceFlagDefaultAction* other) { - if (other == this) return; - GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); - InternalSwap(other); - } - - // implements Message ---------------------------------------------- - - AppearanceFlagDefaultAction* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { - return CreateMaybeMessage(arena); - } - using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; - void CopyFrom(const AppearanceFlagDefaultAction& from); - using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; - void MergeFrom( const AppearanceFlagDefaultAction& from) { - AppearanceFlagDefaultAction::MergeImpl(*this, from); - } - private: - static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg); - public: - PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; - bool IsInitialized() const final; - - size_t ByteSizeLong() const final; - const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; - uint8_t* _InternalSerialize( - uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; - int GetCachedSize() const final { return _impl_._cached_size_.Get(); } - - private: - void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned); - void SharedDtor(); - void SetCachedSize(int size) const final; - void InternalSwap(AppearanceFlagDefaultAction* other); - - private: - friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; - static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { - return "Canary.protobuf.appearances.AppearanceFlagDefaultAction"; - } - protected: - explicit AppearanceFlagDefaultAction(::PROTOBUF_NAMESPACE_ID::Arena* arena, - bool is_message_owned = false); - public: - - static const ClassData _class_data_; - const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; - - ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; - - // nested types ---------------------------------------------------- - - // accessors ------------------------------------------------------- - - enum : int { - kActionFieldNumber = 1, - }; - // optional .Canary.protobuf.appearances.PLAYER_ACTION action = 1; - bool has_action() const; - private: - bool _internal_has_action() const; - public: - void clear_action(); - ::Canary::protobuf::appearances::PLAYER_ACTION action() const; - void set_action(::Canary::protobuf::appearances::PLAYER_ACTION value); - private: - ::Canary::protobuf::appearances::PLAYER_ACTION _internal_action() const; - void _internal_set_action(::Canary::protobuf::appearances::PLAYER_ACTION value); - public: - - // @@protoc_insertion_point(class_scope:Canary.protobuf.appearances.AppearanceFlagDefaultAction) - private: - class _Internal; - - template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; - typedef void InternalArenaConstructable_; - typedef void DestructorSkippable_; - struct Impl_ { - ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; - mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; - int action_; - }; - union { Impl_ _impl_; }; - friend struct ::TableStruct_appearances_2eproto; -}; -// ------------------------------------------------------------------- - -class AppearanceFlagMarket final : - public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:Canary.protobuf.appearances.AppearanceFlagMarket) */ { - public: - inline AppearanceFlagMarket() : AppearanceFlagMarket(nullptr) {} - ~AppearanceFlagMarket() override; - explicit PROTOBUF_CONSTEXPR AppearanceFlagMarket(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); - - AppearanceFlagMarket(const AppearanceFlagMarket& from); - AppearanceFlagMarket(AppearanceFlagMarket&& from) noexcept - : AppearanceFlagMarket() { - *this = ::std::move(from); - } - - inline AppearanceFlagMarket& operator=(const AppearanceFlagMarket& from) { - CopyFrom(from); - return *this; - } - inline AppearanceFlagMarket& operator=(AppearanceFlagMarket&& from) noexcept { - if (this == &from) return *this; - if (GetOwningArena() == from.GetOwningArena() - #ifdef PROTOBUF_FORCE_COPY_IN_MOVE - && GetOwningArena() != nullptr - #endif // !PROTOBUF_FORCE_COPY_IN_MOVE - ) { - InternalSwap(&from); - } else { - CopyFrom(from); - } - return *this; - } - - inline const ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet& unknown_fields() const { - return _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance); - } - inline ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet* mutable_unknown_fields() { - return _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); - } - - static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { - return GetDescriptor(); - } - static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { - return default_instance().GetMetadata().descriptor; - } - static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { - return default_instance().GetMetadata().reflection; - } - static const AppearanceFlagMarket& default_instance() { - return *internal_default_instance(); - } - static inline const AppearanceFlagMarket* internal_default_instance() { - return reinterpret_cast( - &_AppearanceFlagMarket_default_instance_); - } - static constexpr int kIndexInFileMessages = - 18; - - friend void swap(AppearanceFlagMarket& a, AppearanceFlagMarket& b) { - a.Swap(&b); - } - inline void Swap(AppearanceFlagMarket* other) { - if (other == this) return; - #ifdef PROTOBUF_FORCE_COPY_IN_SWAP - if (GetOwningArena() != nullptr && - GetOwningArena() == other->GetOwningArena()) { - #else // PROTOBUF_FORCE_COPY_IN_SWAP - if (GetOwningArena() == other->GetOwningArena()) { - #endif // !PROTOBUF_FORCE_COPY_IN_SWAP - InternalSwap(other); - } else { - ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); - } - } - void UnsafeArenaSwap(AppearanceFlagMarket* other) { - if (other == this) return; - GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); - InternalSwap(other); - } - - // implements Message ---------------------------------------------- - - AppearanceFlagMarket* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { - return CreateMaybeMessage(arena); - } - using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; - void CopyFrom(const AppearanceFlagMarket& from); - using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; - void MergeFrom( const AppearanceFlagMarket& from) { - AppearanceFlagMarket::MergeImpl(*this, from); - } - private: - static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg); - public: - PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; - bool IsInitialized() const final; - - size_t ByteSizeLong() const final; - const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; - uint8_t* _InternalSerialize( - uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; - int GetCachedSize() const final { return _impl_._cached_size_.Get(); } - - private: - void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned); - void SharedDtor(); - void SetCachedSize(int size) const final; - void InternalSwap(AppearanceFlagMarket* other); - - private: - friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; - static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { - return "Canary.protobuf.appearances.AppearanceFlagMarket"; - } - protected: - explicit AppearanceFlagMarket(::PROTOBUF_NAMESPACE_ID::Arena* arena, - bool is_message_owned = false); - public: - - static const ClassData _class_data_; - const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; - - ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; - - // nested types ---------------------------------------------------- - - // accessors ------------------------------------------------------- - - enum : int { - kRestrictToProfessionFieldNumber = 5, - kTradeAsObjectIdFieldNumber = 2, - kShowAsObjectIdFieldNumber = 3, - kMinimumLevelFieldNumber = 6, - kCategoryFieldNumber = 1, - }; - // repeated .Canary.protobuf.appearances.PLAYER_PROFESSION restrict_to_profession = 5; - int restrict_to_profession_size() const; - private: - int _internal_restrict_to_profession_size() const; - public: - void clear_restrict_to_profession(); - private: - ::Canary::protobuf::appearances::PLAYER_PROFESSION _internal_restrict_to_profession(int index) const; - void _internal_add_restrict_to_profession(::Canary::protobuf::appearances::PLAYER_PROFESSION value); - ::PROTOBUF_NAMESPACE_ID::RepeatedField* _internal_mutable_restrict_to_profession(); - public: - ::Canary::protobuf::appearances::PLAYER_PROFESSION restrict_to_profession(int index) const; - void set_restrict_to_profession(int index, ::Canary::protobuf::appearances::PLAYER_PROFESSION value); - void add_restrict_to_profession(::Canary::protobuf::appearances::PLAYER_PROFESSION value); - const ::PROTOBUF_NAMESPACE_ID::RepeatedField& restrict_to_profession() const; - ::PROTOBUF_NAMESPACE_ID::RepeatedField* mutable_restrict_to_profession(); - - // optional uint32 trade_as_object_id = 2; - bool has_trade_as_object_id() const; - private: - bool _internal_has_trade_as_object_id() const; - public: - void clear_trade_as_object_id(); - uint32_t trade_as_object_id() const; - void set_trade_as_object_id(uint32_t value); - private: - uint32_t _internal_trade_as_object_id() const; - void _internal_set_trade_as_object_id(uint32_t value); - public: - - // optional uint32 show_as_object_id = 3; - bool has_show_as_object_id() const; - private: - bool _internal_has_show_as_object_id() const; - public: - void clear_show_as_object_id(); - uint32_t show_as_object_id() const; - void set_show_as_object_id(uint32_t value); - private: - uint32_t _internal_show_as_object_id() const; - void _internal_set_show_as_object_id(uint32_t value); - public: - - // optional uint32 minimum_level = 6; - bool has_minimum_level() const; - private: - bool _internal_has_minimum_level() const; - public: - void clear_minimum_level(); - uint32_t minimum_level() const; - void set_minimum_level(uint32_t value); - private: - uint32_t _internal_minimum_level() const; - void _internal_set_minimum_level(uint32_t value); - public: - - // optional .Canary.protobuf.appearances.ITEM_CATEGORY category = 1; - bool has_category() const; - private: - bool _internal_has_category() const; - public: - void clear_category(); - ::Canary::protobuf::appearances::ITEM_CATEGORY category() const; - void set_category(::Canary::protobuf::appearances::ITEM_CATEGORY value); - private: - ::Canary::protobuf::appearances::ITEM_CATEGORY _internal_category() const; - void _internal_set_category(::Canary::protobuf::appearances::ITEM_CATEGORY value); - public: - - // @@protoc_insertion_point(class_scope:Canary.protobuf.appearances.AppearanceFlagMarket) - private: - class _Internal; - - template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; - typedef void InternalArenaConstructable_; - typedef void DestructorSkippable_; - struct Impl_ { - ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; - mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; - ::PROTOBUF_NAMESPACE_ID::RepeatedField restrict_to_profession_; - uint32_t trade_as_object_id_; - uint32_t show_as_object_id_; - uint32_t minimum_level_; - int category_; - }; - union { Impl_ _impl_; }; - friend struct ::TableStruct_appearances_2eproto; -}; -// ------------------------------------------------------------------- - -class AppearanceFlagNPC final : - public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:Canary.protobuf.appearances.AppearanceFlagNPC) */ { - public: - inline AppearanceFlagNPC() : AppearanceFlagNPC(nullptr) {} - ~AppearanceFlagNPC() override; - explicit PROTOBUF_CONSTEXPR AppearanceFlagNPC(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); - - AppearanceFlagNPC(const AppearanceFlagNPC& from); - AppearanceFlagNPC(AppearanceFlagNPC&& from) noexcept - : AppearanceFlagNPC() { - *this = ::std::move(from); - } - - inline AppearanceFlagNPC& operator=(const AppearanceFlagNPC& from) { - CopyFrom(from); - return *this; - } - inline AppearanceFlagNPC& operator=(AppearanceFlagNPC&& from) noexcept { - if (this == &from) return *this; - if (GetOwningArena() == from.GetOwningArena() - #ifdef PROTOBUF_FORCE_COPY_IN_MOVE - && GetOwningArena() != nullptr - #endif // !PROTOBUF_FORCE_COPY_IN_MOVE - ) { - InternalSwap(&from); - } else { - CopyFrom(from); - } - return *this; - } - - inline const ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet& unknown_fields() const { - return _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance); - } - inline ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet* mutable_unknown_fields() { - return _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); - } - - static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { - return GetDescriptor(); - } - static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { - return default_instance().GetMetadata().descriptor; - } - static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { - return default_instance().GetMetadata().reflection; - } - static const AppearanceFlagNPC& default_instance() { - return *internal_default_instance(); - } - static inline const AppearanceFlagNPC* internal_default_instance() { - return reinterpret_cast( - &_AppearanceFlagNPC_default_instance_); - } - static constexpr int kIndexInFileMessages = - 19; - - friend void swap(AppearanceFlagNPC& a, AppearanceFlagNPC& b) { - a.Swap(&b); - } - inline void Swap(AppearanceFlagNPC* other) { - if (other == this) return; - #ifdef PROTOBUF_FORCE_COPY_IN_SWAP - if (GetOwningArena() != nullptr && - GetOwningArena() == other->GetOwningArena()) { - #else // PROTOBUF_FORCE_COPY_IN_SWAP - if (GetOwningArena() == other->GetOwningArena()) { - #endif // !PROTOBUF_FORCE_COPY_IN_SWAP - InternalSwap(other); - } else { - ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); - } - } - void UnsafeArenaSwap(AppearanceFlagNPC* other) { - if (other == this) return; - GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); - InternalSwap(other); - } - - // implements Message ---------------------------------------------- - - AppearanceFlagNPC* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { - return CreateMaybeMessage(arena); - } - using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; - void CopyFrom(const AppearanceFlagNPC& from); - using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; - void MergeFrom( const AppearanceFlagNPC& from) { - AppearanceFlagNPC::MergeImpl(*this, from); - } - private: - static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg); - public: - PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; - bool IsInitialized() const final; - - size_t ByteSizeLong() const final; - const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; - uint8_t* _InternalSerialize( - uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; - int GetCachedSize() const final { return _impl_._cached_size_.Get(); } - - private: - void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned); - void SharedDtor(); - void SetCachedSize(int size) const final; - void InternalSwap(AppearanceFlagNPC* other); - - private: - friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; - static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { - return "Canary.protobuf.appearances.AppearanceFlagNPC"; - } - protected: - explicit AppearanceFlagNPC(::PROTOBUF_NAMESPACE_ID::Arena* arena, - bool is_message_owned = false); - public: - - static const ClassData _class_data_; - const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; - - ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; - - // nested types ---------------------------------------------------- - - // accessors ------------------------------------------------------- - - enum : int { - kNameFieldNumber = 1, - kLocationFieldNumber = 2, - kCurrencyQuestFlagDisplayNameFieldNumber = 6, - kSalePriceFieldNumber = 3, - kBuyPriceFieldNumber = 4, - kCurrencyObjectTypeIdFieldNumber = 5, - }; - // optional bytes name = 1; - bool has_name() const; - private: - bool _internal_has_name() const; - public: - void clear_name(); - const std::string& name() const; - template - void set_name(ArgT0&& arg0, ArgT... args); - std::string* mutable_name(); - PROTOBUF_NODISCARD std::string* release_name(); - void set_allocated_name(std::string* name); - private: - const std::string& _internal_name() const; - inline PROTOBUF_ALWAYS_INLINE void _internal_set_name(const std::string& value); - std::string* _internal_mutable_name(); - public: - - // optional bytes location = 2; - bool has_location() const; - private: - bool _internal_has_location() const; - public: - void clear_location(); - const std::string& location() const; - template - void set_location(ArgT0&& arg0, ArgT... args); - std::string* mutable_location(); - PROTOBUF_NODISCARD std::string* release_location(); - void set_allocated_location(std::string* location); - private: - const std::string& _internal_location() const; - inline PROTOBUF_ALWAYS_INLINE void _internal_set_location(const std::string& value); - std::string* _internal_mutable_location(); - public: - - // optional bytes currency_quest_flag_display_name = 6; - bool has_currency_quest_flag_display_name() const; - private: - bool _internal_has_currency_quest_flag_display_name() const; - public: - void clear_currency_quest_flag_display_name(); - const std::string& currency_quest_flag_display_name() const; - template - void set_currency_quest_flag_display_name(ArgT0&& arg0, ArgT... args); - std::string* mutable_currency_quest_flag_display_name(); - PROTOBUF_NODISCARD std::string* release_currency_quest_flag_display_name(); - void set_allocated_currency_quest_flag_display_name(std::string* currency_quest_flag_display_name); - private: - const std::string& _internal_currency_quest_flag_display_name() const; - inline PROTOBUF_ALWAYS_INLINE void _internal_set_currency_quest_flag_display_name(const std::string& value); - std::string* _internal_mutable_currency_quest_flag_display_name(); - public: - - // optional uint32 sale_price = 3; - bool has_sale_price() const; - private: - bool _internal_has_sale_price() const; - public: - void clear_sale_price(); - uint32_t sale_price() const; - void set_sale_price(uint32_t value); - private: - uint32_t _internal_sale_price() const; - void _internal_set_sale_price(uint32_t value); - public: - - // optional uint32 buy_price = 4; - bool has_buy_price() const; - private: - bool _internal_has_buy_price() const; - public: - void clear_buy_price(); - uint32_t buy_price() const; - void set_buy_price(uint32_t value); - private: - uint32_t _internal_buy_price() const; - void _internal_set_buy_price(uint32_t value); - public: - - // optional uint32 currency_object_type_id = 5; - bool has_currency_object_type_id() const; - private: - bool _internal_has_currency_object_type_id() const; - public: - void clear_currency_object_type_id(); - uint32_t currency_object_type_id() const; - void set_currency_object_type_id(uint32_t value); - private: - uint32_t _internal_currency_object_type_id() const; - void _internal_set_currency_object_type_id(uint32_t value); - public: - - // @@protoc_insertion_point(class_scope:Canary.protobuf.appearances.AppearanceFlagNPC) - private: - class _Internal; - - template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; - typedef void InternalArenaConstructable_; - typedef void DestructorSkippable_; - struct Impl_ { - ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; - mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; - ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr name_; - ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr location_; - ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr currency_quest_flag_display_name_; - uint32_t sale_price_; - uint32_t buy_price_; - uint32_t currency_object_type_id_; - }; - union { Impl_ _impl_; }; - friend struct ::TableStruct_appearances_2eproto; -}; -// ------------------------------------------------------------------- - -class AppearanceFlagAutomap final : - public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:Canary.protobuf.appearances.AppearanceFlagAutomap) */ { - public: - inline AppearanceFlagAutomap() : AppearanceFlagAutomap(nullptr) {} - ~AppearanceFlagAutomap() override; - explicit PROTOBUF_CONSTEXPR AppearanceFlagAutomap(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); - - AppearanceFlagAutomap(const AppearanceFlagAutomap& from); - AppearanceFlagAutomap(AppearanceFlagAutomap&& from) noexcept - : AppearanceFlagAutomap() { - *this = ::std::move(from); - } - - inline AppearanceFlagAutomap& operator=(const AppearanceFlagAutomap& from) { - CopyFrom(from); - return *this; - } - inline AppearanceFlagAutomap& operator=(AppearanceFlagAutomap&& from) noexcept { - if (this == &from) return *this; - if (GetOwningArena() == from.GetOwningArena() - #ifdef PROTOBUF_FORCE_COPY_IN_MOVE - && GetOwningArena() != nullptr - #endif // !PROTOBUF_FORCE_COPY_IN_MOVE - ) { - InternalSwap(&from); - } else { - CopyFrom(from); - } - return *this; - } - - inline const ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet& unknown_fields() const { - return _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance); - } - inline ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet* mutable_unknown_fields() { - return _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); - } - - static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { - return GetDescriptor(); - } - static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { - return default_instance().GetMetadata().descriptor; - } - static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { - return default_instance().GetMetadata().reflection; - } - static const AppearanceFlagAutomap& default_instance() { - return *internal_default_instance(); - } - static inline const AppearanceFlagAutomap* internal_default_instance() { - return reinterpret_cast( - &_AppearanceFlagAutomap_default_instance_); - } - static constexpr int kIndexInFileMessages = - 20; - - friend void swap(AppearanceFlagAutomap& a, AppearanceFlagAutomap& b) { - a.Swap(&b); - } - inline void Swap(AppearanceFlagAutomap* other) { - if (other == this) return; - #ifdef PROTOBUF_FORCE_COPY_IN_SWAP - if (GetOwningArena() != nullptr && - GetOwningArena() == other->GetOwningArena()) { - #else // PROTOBUF_FORCE_COPY_IN_SWAP - if (GetOwningArena() == other->GetOwningArena()) { - #endif // !PROTOBUF_FORCE_COPY_IN_SWAP - InternalSwap(other); - } else { - ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); - } - } - void UnsafeArenaSwap(AppearanceFlagAutomap* other) { - if (other == this) return; - GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); - InternalSwap(other); - } - - // implements Message ---------------------------------------------- - - AppearanceFlagAutomap* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { - return CreateMaybeMessage(arena); - } - using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; - void CopyFrom(const AppearanceFlagAutomap& from); - using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; - void MergeFrom( const AppearanceFlagAutomap& from) { - AppearanceFlagAutomap::MergeImpl(*this, from); - } - private: - static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg); - public: - PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; - bool IsInitialized() const final; - - size_t ByteSizeLong() const final; - const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; - uint8_t* _InternalSerialize( - uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; - int GetCachedSize() const final { return _impl_._cached_size_.Get(); } - - private: - void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned); - void SharedDtor(); - void SetCachedSize(int size) const final; - void InternalSwap(AppearanceFlagAutomap* other); - - private: - friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; - static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { - return "Canary.protobuf.appearances.AppearanceFlagAutomap"; - } - protected: - explicit AppearanceFlagAutomap(::PROTOBUF_NAMESPACE_ID::Arena* arena, - bool is_message_owned = false); - public: - - static const ClassData _class_data_; - const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; - - ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; - - // nested types ---------------------------------------------------- - - // accessors ------------------------------------------------------- - - enum : int { - kColorFieldNumber = 1, - }; - // optional uint32 color = 1; - bool has_color() const; - private: - bool _internal_has_color() const; - public: - void clear_color(); - uint32_t color() const; - void set_color(uint32_t value); - private: - uint32_t _internal_color() const; - void _internal_set_color(uint32_t value); - public: - - // @@protoc_insertion_point(class_scope:Canary.protobuf.appearances.AppearanceFlagAutomap) - private: - class _Internal; - - template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; - typedef void InternalArenaConstructable_; - typedef void DestructorSkippable_; - struct Impl_ { - ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; - mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; - uint32_t color_; - }; - union { Impl_ _impl_; }; - friend struct ::TableStruct_appearances_2eproto; -}; -// ------------------------------------------------------------------- - -class AppearanceFlagHook final : - public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:Canary.protobuf.appearances.AppearanceFlagHook) */ { - public: - inline AppearanceFlagHook() : AppearanceFlagHook(nullptr) {} - ~AppearanceFlagHook() override; - explicit PROTOBUF_CONSTEXPR AppearanceFlagHook(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); - - AppearanceFlagHook(const AppearanceFlagHook& from); - AppearanceFlagHook(AppearanceFlagHook&& from) noexcept - : AppearanceFlagHook() { - *this = ::std::move(from); - } - - inline AppearanceFlagHook& operator=(const AppearanceFlagHook& from) { - CopyFrom(from); - return *this; - } - inline AppearanceFlagHook& operator=(AppearanceFlagHook&& from) noexcept { - if (this == &from) return *this; - if (GetOwningArena() == from.GetOwningArena() - #ifdef PROTOBUF_FORCE_COPY_IN_MOVE - && GetOwningArena() != nullptr - #endif // !PROTOBUF_FORCE_COPY_IN_MOVE - ) { - InternalSwap(&from); - } else { - CopyFrom(from); - } - return *this; - } - - inline const ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet& unknown_fields() const { - return _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance); - } - inline ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet* mutable_unknown_fields() { - return _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); - } - - static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { - return GetDescriptor(); - } - static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { - return default_instance().GetMetadata().descriptor; - } - static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { - return default_instance().GetMetadata().reflection; - } - static const AppearanceFlagHook& default_instance() { - return *internal_default_instance(); - } - static inline const AppearanceFlagHook* internal_default_instance() { - return reinterpret_cast( - &_AppearanceFlagHook_default_instance_); - } - static constexpr int kIndexInFileMessages = - 21; - - friend void swap(AppearanceFlagHook& a, AppearanceFlagHook& b) { - a.Swap(&b); - } - inline void Swap(AppearanceFlagHook* other) { - if (other == this) return; - #ifdef PROTOBUF_FORCE_COPY_IN_SWAP - if (GetOwningArena() != nullptr && - GetOwningArena() == other->GetOwningArena()) { - #else // PROTOBUF_FORCE_COPY_IN_SWAP - if (GetOwningArena() == other->GetOwningArena()) { - #endif // !PROTOBUF_FORCE_COPY_IN_SWAP - InternalSwap(other); - } else { - ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); - } - } - void UnsafeArenaSwap(AppearanceFlagHook* other) { - if (other == this) return; - GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); - InternalSwap(other); - } - - // implements Message ---------------------------------------------- - - AppearanceFlagHook* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { - return CreateMaybeMessage(arena); - } - using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; - void CopyFrom(const AppearanceFlagHook& from); - using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; - void MergeFrom( const AppearanceFlagHook& from) { - AppearanceFlagHook::MergeImpl(*this, from); - } - private: - static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg); - public: - PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; - bool IsInitialized() const final; - - size_t ByteSizeLong() const final; - const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; - uint8_t* _InternalSerialize( - uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; - int GetCachedSize() const final { return _impl_._cached_size_.Get(); } - - private: - void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned); - void SharedDtor(); - void SetCachedSize(int size) const final; - void InternalSwap(AppearanceFlagHook* other); - - private: - friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; - static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { - return "Canary.protobuf.appearances.AppearanceFlagHook"; - } - protected: - explicit AppearanceFlagHook(::PROTOBUF_NAMESPACE_ID::Arena* arena, - bool is_message_owned = false); - public: - - static const ClassData _class_data_; - const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; - - ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; - - // nested types ---------------------------------------------------- - - // accessors ------------------------------------------------------- - - enum : int { - kDirectionFieldNumber = 1, - }; - // optional .Canary.protobuf.appearances.HOOK_TYPE direction = 1; - bool has_direction() const; - private: - bool _internal_has_direction() const; - public: - void clear_direction(); - ::Canary::protobuf::appearances::HOOK_TYPE direction() const; - void set_direction(::Canary::protobuf::appearances::HOOK_TYPE value); - private: - ::Canary::protobuf::appearances::HOOK_TYPE _internal_direction() const; - void _internal_set_direction(::Canary::protobuf::appearances::HOOK_TYPE value); - public: - - // @@protoc_insertion_point(class_scope:Canary.protobuf.appearances.AppearanceFlagHook) - private: - class _Internal; - - template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; - typedef void InternalArenaConstructable_; - typedef void DestructorSkippable_; - struct Impl_ { - ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; - mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; - int direction_; - }; - union { Impl_ _impl_; }; - friend struct ::TableStruct_appearances_2eproto; -}; -// ------------------------------------------------------------------- - -class AppearanceFlagLenshelp final : - public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:Canary.protobuf.appearances.AppearanceFlagLenshelp) */ { - public: - inline AppearanceFlagLenshelp() : AppearanceFlagLenshelp(nullptr) {} - ~AppearanceFlagLenshelp() override; - explicit PROTOBUF_CONSTEXPR AppearanceFlagLenshelp(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); - - AppearanceFlagLenshelp(const AppearanceFlagLenshelp& from); - AppearanceFlagLenshelp(AppearanceFlagLenshelp&& from) noexcept - : AppearanceFlagLenshelp() { - *this = ::std::move(from); - } - - inline AppearanceFlagLenshelp& operator=(const AppearanceFlagLenshelp& from) { - CopyFrom(from); - return *this; - } - inline AppearanceFlagLenshelp& operator=(AppearanceFlagLenshelp&& from) noexcept { - if (this == &from) return *this; - if (GetOwningArena() == from.GetOwningArena() - #ifdef PROTOBUF_FORCE_COPY_IN_MOVE - && GetOwningArena() != nullptr - #endif // !PROTOBUF_FORCE_COPY_IN_MOVE - ) { - InternalSwap(&from); - } else { - CopyFrom(from); - } - return *this; - } - - inline const ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet& unknown_fields() const { - return _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance); - } - inline ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet* mutable_unknown_fields() { - return _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); - } - - static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { - return GetDescriptor(); - } - static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { - return default_instance().GetMetadata().descriptor; - } - static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { - return default_instance().GetMetadata().reflection; - } - static const AppearanceFlagLenshelp& default_instance() { - return *internal_default_instance(); - } - static inline const AppearanceFlagLenshelp* internal_default_instance() { - return reinterpret_cast( - &_AppearanceFlagLenshelp_default_instance_); - } - static constexpr int kIndexInFileMessages = - 22; - - friend void swap(AppearanceFlagLenshelp& a, AppearanceFlagLenshelp& b) { - a.Swap(&b); - } - inline void Swap(AppearanceFlagLenshelp* other) { - if (other == this) return; - #ifdef PROTOBUF_FORCE_COPY_IN_SWAP - if (GetOwningArena() != nullptr && - GetOwningArena() == other->GetOwningArena()) { - #else // PROTOBUF_FORCE_COPY_IN_SWAP - if (GetOwningArena() == other->GetOwningArena()) { - #endif // !PROTOBUF_FORCE_COPY_IN_SWAP - InternalSwap(other); - } else { - ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); - } - } - void UnsafeArenaSwap(AppearanceFlagLenshelp* other) { - if (other == this) return; - GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); - InternalSwap(other); - } - - // implements Message ---------------------------------------------- - - AppearanceFlagLenshelp* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { - return CreateMaybeMessage(arena); - } - using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; - void CopyFrom(const AppearanceFlagLenshelp& from); - using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; - void MergeFrom( const AppearanceFlagLenshelp& from) { - AppearanceFlagLenshelp::MergeImpl(*this, from); - } - private: - static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg); - public: - PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; - bool IsInitialized() const final; - - size_t ByteSizeLong() const final; - const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; - uint8_t* _InternalSerialize( - uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; - int GetCachedSize() const final { return _impl_._cached_size_.Get(); } - - private: - void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned); - void SharedDtor(); - void SetCachedSize(int size) const final; - void InternalSwap(AppearanceFlagLenshelp* other); - - private: - friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; - static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { - return "Canary.protobuf.appearances.AppearanceFlagLenshelp"; - } - protected: - explicit AppearanceFlagLenshelp(::PROTOBUF_NAMESPACE_ID::Arena* arena, - bool is_message_owned = false); - public: - - static const ClassData _class_data_; - const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; - - ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; - - // nested types ---------------------------------------------------- - - // accessors ------------------------------------------------------- - - enum : int { - kIdFieldNumber = 1, - }; - // optional uint32 id = 1; - bool has_id() const; - private: - bool _internal_has_id() const; - public: - void clear_id(); - uint32_t id() const; - void set_id(uint32_t value); - private: - uint32_t _internal_id() const; - void _internal_set_id(uint32_t value); - public: - - // @@protoc_insertion_point(class_scope:Canary.protobuf.appearances.AppearanceFlagLenshelp) - private: - class _Internal; - - template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; - typedef void InternalArenaConstructable_; - typedef void DestructorSkippable_; - struct Impl_ { - ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; - mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; - uint32_t id_; - }; - union { Impl_ _impl_; }; - friend struct ::TableStruct_appearances_2eproto; -}; -// ------------------------------------------------------------------- - -class AppearanceFlagChangedToExpire final : - public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:Canary.protobuf.appearances.AppearanceFlagChangedToExpire) */ { - public: - inline AppearanceFlagChangedToExpire() : AppearanceFlagChangedToExpire(nullptr) {} - ~AppearanceFlagChangedToExpire() override; - explicit PROTOBUF_CONSTEXPR AppearanceFlagChangedToExpire(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); - - AppearanceFlagChangedToExpire(const AppearanceFlagChangedToExpire& from); - AppearanceFlagChangedToExpire(AppearanceFlagChangedToExpire&& from) noexcept - : AppearanceFlagChangedToExpire() { - *this = ::std::move(from); - } - - inline AppearanceFlagChangedToExpire& operator=(const AppearanceFlagChangedToExpire& from) { - CopyFrom(from); - return *this; - } - inline AppearanceFlagChangedToExpire& operator=(AppearanceFlagChangedToExpire&& from) noexcept { - if (this == &from) return *this; - if (GetOwningArena() == from.GetOwningArena() - #ifdef PROTOBUF_FORCE_COPY_IN_MOVE - && GetOwningArena() != nullptr - #endif // !PROTOBUF_FORCE_COPY_IN_MOVE - ) { - InternalSwap(&from); - } else { - CopyFrom(from); - } - return *this; - } - - inline const ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet& unknown_fields() const { - return _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance); - } - inline ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet* mutable_unknown_fields() { - return _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); - } - - static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { - return GetDescriptor(); - } - static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { - return default_instance().GetMetadata().descriptor; - } - static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { - return default_instance().GetMetadata().reflection; - } - static const AppearanceFlagChangedToExpire& default_instance() { - return *internal_default_instance(); - } - static inline const AppearanceFlagChangedToExpire* internal_default_instance() { - return reinterpret_cast( - &_AppearanceFlagChangedToExpire_default_instance_); - } - static constexpr int kIndexInFileMessages = - 23; - - friend void swap(AppearanceFlagChangedToExpire& a, AppearanceFlagChangedToExpire& b) { - a.Swap(&b); - } - inline void Swap(AppearanceFlagChangedToExpire* other) { - if (other == this) return; - #ifdef PROTOBUF_FORCE_COPY_IN_SWAP - if (GetOwningArena() != nullptr && - GetOwningArena() == other->GetOwningArena()) { - #else // PROTOBUF_FORCE_COPY_IN_SWAP - if (GetOwningArena() == other->GetOwningArena()) { - #endif // !PROTOBUF_FORCE_COPY_IN_SWAP - InternalSwap(other); - } else { - ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); - } - } - void UnsafeArenaSwap(AppearanceFlagChangedToExpire* other) { - if (other == this) return; - GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); - InternalSwap(other); - } - - // implements Message ---------------------------------------------- - - AppearanceFlagChangedToExpire* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { - return CreateMaybeMessage(arena); - } - using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; - void CopyFrom(const AppearanceFlagChangedToExpire& from); - using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; - void MergeFrom( const AppearanceFlagChangedToExpire& from) { - AppearanceFlagChangedToExpire::MergeImpl(*this, from); - } - private: - static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg); - public: - PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; - bool IsInitialized() const final; - - size_t ByteSizeLong() const final; - const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; - uint8_t* _InternalSerialize( - uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; - int GetCachedSize() const final { return _impl_._cached_size_.Get(); } - - private: - void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned); - void SharedDtor(); - void SetCachedSize(int size) const final; - void InternalSwap(AppearanceFlagChangedToExpire* other); - - private: - friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; - static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { - return "Canary.protobuf.appearances.AppearanceFlagChangedToExpire"; - } - protected: - explicit AppearanceFlagChangedToExpire(::PROTOBUF_NAMESPACE_ID::Arena* arena, - bool is_message_owned = false); - public: - - static const ClassData _class_data_; - const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; - - ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; - - // nested types ---------------------------------------------------- - - // accessors ------------------------------------------------------- - - enum : int { - kFormerObjectTypeidFieldNumber = 1, - }; - // optional uint32 former_object_typeid = 1; - bool has_former_object_typeid() const; - private: - bool _internal_has_former_object_typeid() const; - public: - void clear_former_object_typeid(); - uint32_t former_object_typeid() const; - void set_former_object_typeid(uint32_t value); - private: - uint32_t _internal_former_object_typeid() const; - void _internal_set_former_object_typeid(uint32_t value); - public: - - // @@protoc_insertion_point(class_scope:Canary.protobuf.appearances.AppearanceFlagChangedToExpire) - private: - class _Internal; - - template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; - typedef void InternalArenaConstructable_; - typedef void DestructorSkippable_; - struct Impl_ { - ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; - mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; - uint32_t former_object_typeid_; - }; - union { Impl_ _impl_; }; - friend struct ::TableStruct_appearances_2eproto; -}; -// ------------------------------------------------------------------- - -class AppearanceFlagCyclopedia final : - public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:Canary.protobuf.appearances.AppearanceFlagCyclopedia) */ { - public: - inline AppearanceFlagCyclopedia() : AppearanceFlagCyclopedia(nullptr) {} - ~AppearanceFlagCyclopedia() override; - explicit PROTOBUF_CONSTEXPR AppearanceFlagCyclopedia(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); - - AppearanceFlagCyclopedia(const AppearanceFlagCyclopedia& from); - AppearanceFlagCyclopedia(AppearanceFlagCyclopedia&& from) noexcept - : AppearanceFlagCyclopedia() { - *this = ::std::move(from); - } - - inline AppearanceFlagCyclopedia& operator=(const AppearanceFlagCyclopedia& from) { - CopyFrom(from); - return *this; - } - inline AppearanceFlagCyclopedia& operator=(AppearanceFlagCyclopedia&& from) noexcept { - if (this == &from) return *this; - if (GetOwningArena() == from.GetOwningArena() - #ifdef PROTOBUF_FORCE_COPY_IN_MOVE - && GetOwningArena() != nullptr - #endif // !PROTOBUF_FORCE_COPY_IN_MOVE - ) { - InternalSwap(&from); - } else { - CopyFrom(from); - } - return *this; - } - - inline const ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet& unknown_fields() const { - return _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance); - } - inline ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet* mutable_unknown_fields() { - return _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); - } - - static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { - return GetDescriptor(); - } - static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { - return default_instance().GetMetadata().descriptor; - } - static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { - return default_instance().GetMetadata().reflection; - } - static const AppearanceFlagCyclopedia& default_instance() { - return *internal_default_instance(); - } - static inline const AppearanceFlagCyclopedia* internal_default_instance() { - return reinterpret_cast( - &_AppearanceFlagCyclopedia_default_instance_); - } - static constexpr int kIndexInFileMessages = - 24; - - friend void swap(AppearanceFlagCyclopedia& a, AppearanceFlagCyclopedia& b) { - a.Swap(&b); - } - inline void Swap(AppearanceFlagCyclopedia* other) { - if (other == this) return; - #ifdef PROTOBUF_FORCE_COPY_IN_SWAP - if (GetOwningArena() != nullptr && - GetOwningArena() == other->GetOwningArena()) { - #else // PROTOBUF_FORCE_COPY_IN_SWAP - if (GetOwningArena() == other->GetOwningArena()) { - #endif // !PROTOBUF_FORCE_COPY_IN_SWAP - InternalSwap(other); - } else { - ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); - } - } - void UnsafeArenaSwap(AppearanceFlagCyclopedia* other) { - if (other == this) return; - GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); - InternalSwap(other); - } - - // implements Message ---------------------------------------------- - - AppearanceFlagCyclopedia* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { - return CreateMaybeMessage(arena); - } - using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; - void CopyFrom(const AppearanceFlagCyclopedia& from); - using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; - void MergeFrom( const AppearanceFlagCyclopedia& from) { - AppearanceFlagCyclopedia::MergeImpl(*this, from); - } - private: - static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg); - public: - PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; - bool IsInitialized() const final; - - size_t ByteSizeLong() const final; - const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; - uint8_t* _InternalSerialize( - uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; - int GetCachedSize() const final { return _impl_._cached_size_.Get(); } - - private: - void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned); - void SharedDtor(); - void SetCachedSize(int size) const final; - void InternalSwap(AppearanceFlagCyclopedia* other); - - private: - friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; - static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { - return "Canary.protobuf.appearances.AppearanceFlagCyclopedia"; - } - protected: - explicit AppearanceFlagCyclopedia(::PROTOBUF_NAMESPACE_ID::Arena* arena, - bool is_message_owned = false); - public: - - static const ClassData _class_data_; - const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; - - ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; - - // nested types ---------------------------------------------------- - - // accessors ------------------------------------------------------- - - enum : int { - kCyclopediaTypeFieldNumber = 1, - }; - // optional uint32 cyclopedia_type = 1; - bool has_cyclopedia_type() const; - private: - bool _internal_has_cyclopedia_type() const; - public: - void clear_cyclopedia_type(); - uint32_t cyclopedia_type() const; - void set_cyclopedia_type(uint32_t value); - private: - uint32_t _internal_cyclopedia_type() const; - void _internal_set_cyclopedia_type(uint32_t value); - public: - - // @@protoc_insertion_point(class_scope:Canary.protobuf.appearances.AppearanceFlagCyclopedia) - private: - class _Internal; - - template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; - typedef void InternalArenaConstructable_; - typedef void DestructorSkippable_; - struct Impl_ { - ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; - mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; - uint32_t cyclopedia_type_; - }; - union { Impl_ _impl_; }; - friend struct ::TableStruct_appearances_2eproto; -}; -// ------------------------------------------------------------------- - -class SpecialMeaningAppearanceIds final : - public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:Canary.protobuf.appearances.SpecialMeaningAppearanceIds) */ { - public: - inline SpecialMeaningAppearanceIds() : SpecialMeaningAppearanceIds(nullptr) {} - ~SpecialMeaningAppearanceIds() override; - explicit PROTOBUF_CONSTEXPR SpecialMeaningAppearanceIds(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); - - SpecialMeaningAppearanceIds(const SpecialMeaningAppearanceIds& from); - SpecialMeaningAppearanceIds(SpecialMeaningAppearanceIds&& from) noexcept - : SpecialMeaningAppearanceIds() { - *this = ::std::move(from); - } - - inline SpecialMeaningAppearanceIds& operator=(const SpecialMeaningAppearanceIds& from) { - CopyFrom(from); - return *this; - } - inline SpecialMeaningAppearanceIds& operator=(SpecialMeaningAppearanceIds&& from) noexcept { - if (this == &from) return *this; - if (GetOwningArena() == from.GetOwningArena() - #ifdef PROTOBUF_FORCE_COPY_IN_MOVE - && GetOwningArena() != nullptr - #endif // !PROTOBUF_FORCE_COPY_IN_MOVE - ) { - InternalSwap(&from); - } else { - CopyFrom(from); - } - return *this; - } - - inline const ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet& unknown_fields() const { - return _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance); - } - inline ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet* mutable_unknown_fields() { - return _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); - } - - static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { - return GetDescriptor(); - } - static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { - return default_instance().GetMetadata().descriptor; - } - static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { - return default_instance().GetMetadata().reflection; - } - static const SpecialMeaningAppearanceIds& default_instance() { - return *internal_default_instance(); - } - static inline const SpecialMeaningAppearanceIds* internal_default_instance() { - return reinterpret_cast( - &_SpecialMeaningAppearanceIds_default_instance_); - } - static constexpr int kIndexInFileMessages = - 25; - - friend void swap(SpecialMeaningAppearanceIds& a, SpecialMeaningAppearanceIds& b) { - a.Swap(&b); - } - inline void Swap(SpecialMeaningAppearanceIds* other) { - if (other == this) return; - #ifdef PROTOBUF_FORCE_COPY_IN_SWAP - if (GetOwningArena() != nullptr && - GetOwningArena() == other->GetOwningArena()) { - #else // PROTOBUF_FORCE_COPY_IN_SWAP - if (GetOwningArena() == other->GetOwningArena()) { - #endif // !PROTOBUF_FORCE_COPY_IN_SWAP - InternalSwap(other); - } else { - ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); - } - } - void UnsafeArenaSwap(SpecialMeaningAppearanceIds* other) { - if (other == this) return; - GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); - InternalSwap(other); - } - - // implements Message ---------------------------------------------- - - SpecialMeaningAppearanceIds* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { - return CreateMaybeMessage(arena); - } - using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; - void CopyFrom(const SpecialMeaningAppearanceIds& from); - using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; - void MergeFrom( const SpecialMeaningAppearanceIds& from) { - SpecialMeaningAppearanceIds::MergeImpl(*this, from); - } - private: - static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg); - public: - PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; - bool IsInitialized() const final; - - size_t ByteSizeLong() const final; - const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; - uint8_t* _InternalSerialize( - uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; - int GetCachedSize() const final { return _impl_._cached_size_.Get(); } - - private: - void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned); - void SharedDtor(); - void SetCachedSize(int size) const final; - void InternalSwap(SpecialMeaningAppearanceIds* other); - - private: - friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; - static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { - return "Canary.protobuf.appearances.SpecialMeaningAppearanceIds"; - } - protected: - explicit SpecialMeaningAppearanceIds(::PROTOBUF_NAMESPACE_ID::Arena* arena, - bool is_message_owned = false); - public: - - static const ClassData _class_data_; - const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; - - ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; - - // nested types ---------------------------------------------------- - - // accessors ------------------------------------------------------- - - enum : int { - kGoldCoinIdFieldNumber = 1, - kPlatinumCoinIdFieldNumber = 2, - kCrystalCoinIdFieldNumber = 3, - kTibiaCoinIdFieldNumber = 4, - kStampedLetterIdFieldNumber = 5, - kSupplyStashIdFieldNumber = 6, - }; - // optional uint32 gold_coin_id = 1; - bool has_gold_coin_id() const; - private: - bool _internal_has_gold_coin_id() const; - public: - void clear_gold_coin_id(); - uint32_t gold_coin_id() const; - void set_gold_coin_id(uint32_t value); - private: - uint32_t _internal_gold_coin_id() const; - void _internal_set_gold_coin_id(uint32_t value); - public: - - // optional uint32 platinum_coin_id = 2; - bool has_platinum_coin_id() const; - private: - bool _internal_has_platinum_coin_id() const; - public: - void clear_platinum_coin_id(); - uint32_t platinum_coin_id() const; - void set_platinum_coin_id(uint32_t value); - private: - uint32_t _internal_platinum_coin_id() const; - void _internal_set_platinum_coin_id(uint32_t value); - public: - - // optional uint32 crystal_coin_id = 3; - bool has_crystal_coin_id() const; - private: - bool _internal_has_crystal_coin_id() const; - public: - void clear_crystal_coin_id(); - uint32_t crystal_coin_id() const; - void set_crystal_coin_id(uint32_t value); - private: - uint32_t _internal_crystal_coin_id() const; - void _internal_set_crystal_coin_id(uint32_t value); - public: - - // optional uint32 tibia_coin_id = 4; - bool has_tibia_coin_id() const; - private: - bool _internal_has_tibia_coin_id() const; - public: - void clear_tibia_coin_id(); - uint32_t tibia_coin_id() const; - void set_tibia_coin_id(uint32_t value); - private: - uint32_t _internal_tibia_coin_id() const; - void _internal_set_tibia_coin_id(uint32_t value); - public: - - // optional uint32 stamped_letter_id = 5; - bool has_stamped_letter_id() const; - private: - bool _internal_has_stamped_letter_id() const; - public: - void clear_stamped_letter_id(); - uint32_t stamped_letter_id() const; - void set_stamped_letter_id(uint32_t value); - private: - uint32_t _internal_stamped_letter_id() const; - void _internal_set_stamped_letter_id(uint32_t value); - public: - - // optional uint32 supply_stash_id = 6; - bool has_supply_stash_id() const; - private: - bool _internal_has_supply_stash_id() const; - public: - void clear_supply_stash_id(); - uint32_t supply_stash_id() const; - void set_supply_stash_id(uint32_t value); - private: - uint32_t _internal_supply_stash_id() const; - void _internal_set_supply_stash_id(uint32_t value); - public: - - // @@protoc_insertion_point(class_scope:Canary.protobuf.appearances.SpecialMeaningAppearanceIds) - private: - class _Internal; - - template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; - typedef void InternalArenaConstructable_; - typedef void DestructorSkippable_; - struct Impl_ { - ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; - mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; - uint32_t gold_coin_id_; - uint32_t platinum_coin_id_; - uint32_t crystal_coin_id_; - uint32_t tibia_coin_id_; - uint32_t stamped_letter_id_; - uint32_t supply_stash_id_; - }; - union { Impl_ _impl_; }; - friend struct ::TableStruct_appearances_2eproto; -}; -// =================================================================== - - -// =================================================================== - -#ifdef __GNUC__ - #pragma GCC diagnostic push - #pragma GCC diagnostic ignored "-Wstrict-aliasing" -#endif // __GNUC__ -// Coordinate - -// optional uint32 x = 1; -inline bool Coordinate::_internal_has_x() const { - bool value = (_impl_._has_bits_[0] & 0x00000001u) != 0; - return value; -} -inline bool Coordinate::has_x() const { - return _internal_has_x(); -} -inline void Coordinate::clear_x() { - _impl_.x_ = 0u; - _impl_._has_bits_[0] &= ~0x00000001u; -} -inline uint32_t Coordinate::_internal_x() const { - return _impl_.x_; -} -inline uint32_t Coordinate::x() const { - // @@protoc_insertion_point(field_get:Canary.protobuf.appearances.Coordinate.x) - return _internal_x(); -} -inline void Coordinate::_internal_set_x(uint32_t value) { - _impl_._has_bits_[0] |= 0x00000001u; - _impl_.x_ = value; -} -inline void Coordinate::set_x(uint32_t value) { - _internal_set_x(value); - // @@protoc_insertion_point(field_set:Canary.protobuf.appearances.Coordinate.x) -} - -// optional uint32 y = 2; -inline bool Coordinate::_internal_has_y() const { - bool value = (_impl_._has_bits_[0] & 0x00000002u) != 0; - return value; -} -inline bool Coordinate::has_y() const { - return _internal_has_y(); -} -inline void Coordinate::clear_y() { - _impl_.y_ = 0u; - _impl_._has_bits_[0] &= ~0x00000002u; -} -inline uint32_t Coordinate::_internal_y() const { - return _impl_.y_; -} -inline uint32_t Coordinate::y() const { - // @@protoc_insertion_point(field_get:Canary.protobuf.appearances.Coordinate.y) - return _internal_y(); -} -inline void Coordinate::_internal_set_y(uint32_t value) { - _impl_._has_bits_[0] |= 0x00000002u; - _impl_.y_ = value; -} -inline void Coordinate::set_y(uint32_t value) { - _internal_set_y(value); - // @@protoc_insertion_point(field_set:Canary.protobuf.appearances.Coordinate.y) -} - -// optional uint32 z = 3; -inline bool Coordinate::_internal_has_z() const { - bool value = (_impl_._has_bits_[0] & 0x00000004u) != 0; - return value; -} -inline bool Coordinate::has_z() const { - return _internal_has_z(); -} -inline void Coordinate::clear_z() { - _impl_.z_ = 0u; - _impl_._has_bits_[0] &= ~0x00000004u; -} -inline uint32_t Coordinate::_internal_z() const { - return _impl_.z_; -} -inline uint32_t Coordinate::z() const { - // @@protoc_insertion_point(field_get:Canary.protobuf.appearances.Coordinate.z) - return _internal_z(); -} -inline void Coordinate::_internal_set_z(uint32_t value) { - _impl_._has_bits_[0] |= 0x00000004u; - _impl_.z_ = value; -} -inline void Coordinate::set_z(uint32_t value) { - _internal_set_z(value); - // @@protoc_insertion_point(field_set:Canary.protobuf.appearances.Coordinate.z) -} - -// ------------------------------------------------------------------- - -// Appearances - -// repeated .Canary.protobuf.appearances.Appearance object = 1; -inline int Appearances::_internal_object_size() const { - return _impl_.object_.size(); -} -inline int Appearances::object_size() const { - return _internal_object_size(); -} -inline void Appearances::clear_object() { - _impl_.object_.Clear(); -} -inline ::Canary::protobuf::appearances::Appearance* Appearances::mutable_object(int index) { - // @@protoc_insertion_point(field_mutable:Canary.protobuf.appearances.Appearances.object) - return _impl_.object_.Mutable(index); -} -inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::Canary::protobuf::appearances::Appearance >* -Appearances::mutable_object() { - // @@protoc_insertion_point(field_mutable_list:Canary.protobuf.appearances.Appearances.object) - return &_impl_.object_; -} -inline const ::Canary::protobuf::appearances::Appearance& Appearances::_internal_object(int index) const { - return _impl_.object_.Get(index); -} -inline const ::Canary::protobuf::appearances::Appearance& Appearances::object(int index) const { - // @@protoc_insertion_point(field_get:Canary.protobuf.appearances.Appearances.object) - return _internal_object(index); -} -inline ::Canary::protobuf::appearances::Appearance* Appearances::_internal_add_object() { - return _impl_.object_.Add(); -} -inline ::Canary::protobuf::appearances::Appearance* Appearances::add_object() { - ::Canary::protobuf::appearances::Appearance* _add = _internal_add_object(); - // @@protoc_insertion_point(field_add:Canary.protobuf.appearances.Appearances.object) - return _add; -} -inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::Canary::protobuf::appearances::Appearance >& -Appearances::object() const { - // @@protoc_insertion_point(field_list:Canary.protobuf.appearances.Appearances.object) - return _impl_.object_; -} - -// repeated .Canary.protobuf.appearances.Appearance outfit = 2; -inline int Appearances::_internal_outfit_size() const { - return _impl_.outfit_.size(); -} -inline int Appearances::outfit_size() const { - return _internal_outfit_size(); -} -inline void Appearances::clear_outfit() { - _impl_.outfit_.Clear(); -} -inline ::Canary::protobuf::appearances::Appearance* Appearances::mutable_outfit(int index) { - // @@protoc_insertion_point(field_mutable:Canary.protobuf.appearances.Appearances.outfit) - return _impl_.outfit_.Mutable(index); -} -inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::Canary::protobuf::appearances::Appearance >* -Appearances::mutable_outfit() { - // @@protoc_insertion_point(field_mutable_list:Canary.protobuf.appearances.Appearances.outfit) - return &_impl_.outfit_; -} -inline const ::Canary::protobuf::appearances::Appearance& Appearances::_internal_outfit(int index) const { - return _impl_.outfit_.Get(index); -} -inline const ::Canary::protobuf::appearances::Appearance& Appearances::outfit(int index) const { - // @@protoc_insertion_point(field_get:Canary.protobuf.appearances.Appearances.outfit) - return _internal_outfit(index); -} -inline ::Canary::protobuf::appearances::Appearance* Appearances::_internal_add_outfit() { - return _impl_.outfit_.Add(); -} -inline ::Canary::protobuf::appearances::Appearance* Appearances::add_outfit() { - ::Canary::protobuf::appearances::Appearance* _add = _internal_add_outfit(); - // @@protoc_insertion_point(field_add:Canary.protobuf.appearances.Appearances.outfit) - return _add; -} -inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::Canary::protobuf::appearances::Appearance >& -Appearances::outfit() const { - // @@protoc_insertion_point(field_list:Canary.protobuf.appearances.Appearances.outfit) - return _impl_.outfit_; -} - -// repeated .Canary.protobuf.appearances.Appearance effect = 3; -inline int Appearances::_internal_effect_size() const { - return _impl_.effect_.size(); -} -inline int Appearances::effect_size() const { - return _internal_effect_size(); -} -inline void Appearances::clear_effect() { - _impl_.effect_.Clear(); -} -inline ::Canary::protobuf::appearances::Appearance* Appearances::mutable_effect(int index) { - // @@protoc_insertion_point(field_mutable:Canary.protobuf.appearances.Appearances.effect) - return _impl_.effect_.Mutable(index); -} -inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::Canary::protobuf::appearances::Appearance >* -Appearances::mutable_effect() { - // @@protoc_insertion_point(field_mutable_list:Canary.protobuf.appearances.Appearances.effect) - return &_impl_.effect_; -} -inline const ::Canary::protobuf::appearances::Appearance& Appearances::_internal_effect(int index) const { - return _impl_.effect_.Get(index); -} -inline const ::Canary::protobuf::appearances::Appearance& Appearances::effect(int index) const { - // @@protoc_insertion_point(field_get:Canary.protobuf.appearances.Appearances.effect) - return _internal_effect(index); -} -inline ::Canary::protobuf::appearances::Appearance* Appearances::_internal_add_effect() { - return _impl_.effect_.Add(); -} -inline ::Canary::protobuf::appearances::Appearance* Appearances::add_effect() { - ::Canary::protobuf::appearances::Appearance* _add = _internal_add_effect(); - // @@protoc_insertion_point(field_add:Canary.protobuf.appearances.Appearances.effect) - return _add; -} -inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::Canary::protobuf::appearances::Appearance >& -Appearances::effect() const { - // @@protoc_insertion_point(field_list:Canary.protobuf.appearances.Appearances.effect) - return _impl_.effect_; -} - -// repeated .Canary.protobuf.appearances.Appearance missile = 4; -inline int Appearances::_internal_missile_size() const { - return _impl_.missile_.size(); -} -inline int Appearances::missile_size() const { - return _internal_missile_size(); -} -inline void Appearances::clear_missile() { - _impl_.missile_.Clear(); -} -inline ::Canary::protobuf::appearances::Appearance* Appearances::mutable_missile(int index) { - // @@protoc_insertion_point(field_mutable:Canary.protobuf.appearances.Appearances.missile) - return _impl_.missile_.Mutable(index); -} -inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::Canary::protobuf::appearances::Appearance >* -Appearances::mutable_missile() { - // @@protoc_insertion_point(field_mutable_list:Canary.protobuf.appearances.Appearances.missile) - return &_impl_.missile_; -} -inline const ::Canary::protobuf::appearances::Appearance& Appearances::_internal_missile(int index) const { - return _impl_.missile_.Get(index); -} -inline const ::Canary::protobuf::appearances::Appearance& Appearances::missile(int index) const { - // @@protoc_insertion_point(field_get:Canary.protobuf.appearances.Appearances.missile) - return _internal_missile(index); -} -inline ::Canary::protobuf::appearances::Appearance* Appearances::_internal_add_missile() { - return _impl_.missile_.Add(); -} -inline ::Canary::protobuf::appearances::Appearance* Appearances::add_missile() { - ::Canary::protobuf::appearances::Appearance* _add = _internal_add_missile(); - // @@protoc_insertion_point(field_add:Canary.protobuf.appearances.Appearances.missile) - return _add; -} -inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::Canary::protobuf::appearances::Appearance >& -Appearances::missile() const { - // @@protoc_insertion_point(field_list:Canary.protobuf.appearances.Appearances.missile) - return _impl_.missile_; -} - -// optional .Canary.protobuf.appearances.SpecialMeaningAppearanceIds special_meaning_appearance_ids = 5; -inline bool Appearances::_internal_has_special_meaning_appearance_ids() const { - bool value = (_impl_._has_bits_[0] & 0x00000001u) != 0; - PROTOBUF_ASSUME(!value || _impl_.special_meaning_appearance_ids_ != nullptr); - return value; -} -inline bool Appearances::has_special_meaning_appearance_ids() const { - return _internal_has_special_meaning_appearance_ids(); -} -inline void Appearances::clear_special_meaning_appearance_ids() { - if (_impl_.special_meaning_appearance_ids_ != nullptr) _impl_.special_meaning_appearance_ids_->Clear(); - _impl_._has_bits_[0] &= ~0x00000001u; -} -inline const ::Canary::protobuf::appearances::SpecialMeaningAppearanceIds& Appearances::_internal_special_meaning_appearance_ids() const { - const ::Canary::protobuf::appearances::SpecialMeaningAppearanceIds* p = _impl_.special_meaning_appearance_ids_; - return p != nullptr ? *p : reinterpret_cast( - ::Canary::protobuf::appearances::_SpecialMeaningAppearanceIds_default_instance_); -} -inline const ::Canary::protobuf::appearances::SpecialMeaningAppearanceIds& Appearances::special_meaning_appearance_ids() const { - // @@protoc_insertion_point(field_get:Canary.protobuf.appearances.Appearances.special_meaning_appearance_ids) - return _internal_special_meaning_appearance_ids(); -} -inline void Appearances::unsafe_arena_set_allocated_special_meaning_appearance_ids( - ::Canary::protobuf::appearances::SpecialMeaningAppearanceIds* special_meaning_appearance_ids) { - if (GetArenaForAllocation() == nullptr) { - delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(_impl_.special_meaning_appearance_ids_); - } - _impl_.special_meaning_appearance_ids_ = special_meaning_appearance_ids; - if (special_meaning_appearance_ids) { - _impl_._has_bits_[0] |= 0x00000001u; - } else { - _impl_._has_bits_[0] &= ~0x00000001u; - } - // @@protoc_insertion_point(field_unsafe_arena_set_allocated:Canary.protobuf.appearances.Appearances.special_meaning_appearance_ids) -} -inline ::Canary::protobuf::appearances::SpecialMeaningAppearanceIds* Appearances::release_special_meaning_appearance_ids() { - _impl_._has_bits_[0] &= ~0x00000001u; - ::Canary::protobuf::appearances::SpecialMeaningAppearanceIds* temp = _impl_.special_meaning_appearance_ids_; - _impl_.special_meaning_appearance_ids_ = nullptr; -#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE - auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); - temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); - if (GetArenaForAllocation() == nullptr) { delete old; } -#else // PROTOBUF_FORCE_COPY_IN_RELEASE - if (GetArenaForAllocation() != nullptr) { - temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); - } -#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE - return temp; -} -inline ::Canary::protobuf::appearances::SpecialMeaningAppearanceIds* Appearances::unsafe_arena_release_special_meaning_appearance_ids() { - // @@protoc_insertion_point(field_release:Canary.protobuf.appearances.Appearances.special_meaning_appearance_ids) - _impl_._has_bits_[0] &= ~0x00000001u; - ::Canary::protobuf::appearances::SpecialMeaningAppearanceIds* temp = _impl_.special_meaning_appearance_ids_; - _impl_.special_meaning_appearance_ids_ = nullptr; - return temp; -} -inline ::Canary::protobuf::appearances::SpecialMeaningAppearanceIds* Appearances::_internal_mutable_special_meaning_appearance_ids() { - _impl_._has_bits_[0] |= 0x00000001u; - if (_impl_.special_meaning_appearance_ids_ == nullptr) { - auto* p = CreateMaybeMessage<::Canary::protobuf::appearances::SpecialMeaningAppearanceIds>(GetArenaForAllocation()); - _impl_.special_meaning_appearance_ids_ = p; - } - return _impl_.special_meaning_appearance_ids_; -} -inline ::Canary::protobuf::appearances::SpecialMeaningAppearanceIds* Appearances::mutable_special_meaning_appearance_ids() { - ::Canary::protobuf::appearances::SpecialMeaningAppearanceIds* _msg = _internal_mutable_special_meaning_appearance_ids(); - // @@protoc_insertion_point(field_mutable:Canary.protobuf.appearances.Appearances.special_meaning_appearance_ids) - return _msg; -} -inline void Appearances::set_allocated_special_meaning_appearance_ids(::Canary::protobuf::appearances::SpecialMeaningAppearanceIds* special_meaning_appearance_ids) { - ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); - if (message_arena == nullptr) { - delete _impl_.special_meaning_appearance_ids_; - } - if (special_meaning_appearance_ids) { - ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = - ::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena(special_meaning_appearance_ids); - if (message_arena != submessage_arena) { - special_meaning_appearance_ids = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( - message_arena, special_meaning_appearance_ids, submessage_arena); - } - _impl_._has_bits_[0] |= 0x00000001u; - } else { - _impl_._has_bits_[0] &= ~0x00000001u; - } - _impl_.special_meaning_appearance_ids_ = special_meaning_appearance_ids; - // @@protoc_insertion_point(field_set_allocated:Canary.protobuf.appearances.Appearances.special_meaning_appearance_ids) -} - -// ------------------------------------------------------------------- - -// SpritePhase - -// optional uint32 duration_min = 1; -inline bool SpritePhase::_internal_has_duration_min() const { - bool value = (_impl_._has_bits_[0] & 0x00000001u) != 0; - return value; -} -inline bool SpritePhase::has_duration_min() const { - return _internal_has_duration_min(); -} -inline void SpritePhase::clear_duration_min() { - _impl_.duration_min_ = 0u; - _impl_._has_bits_[0] &= ~0x00000001u; -} -inline uint32_t SpritePhase::_internal_duration_min() const { - return _impl_.duration_min_; -} -inline uint32_t SpritePhase::duration_min() const { - // @@protoc_insertion_point(field_get:Canary.protobuf.appearances.SpritePhase.duration_min) - return _internal_duration_min(); -} -inline void SpritePhase::_internal_set_duration_min(uint32_t value) { - _impl_._has_bits_[0] |= 0x00000001u; - _impl_.duration_min_ = value; -} -inline void SpritePhase::set_duration_min(uint32_t value) { - _internal_set_duration_min(value); - // @@protoc_insertion_point(field_set:Canary.protobuf.appearances.SpritePhase.duration_min) -} - -// optional uint32 duration_max = 2; -inline bool SpritePhase::_internal_has_duration_max() const { - bool value = (_impl_._has_bits_[0] & 0x00000002u) != 0; - return value; -} -inline bool SpritePhase::has_duration_max() const { - return _internal_has_duration_max(); -} -inline void SpritePhase::clear_duration_max() { - _impl_.duration_max_ = 0u; - _impl_._has_bits_[0] &= ~0x00000002u; -} -inline uint32_t SpritePhase::_internal_duration_max() const { - return _impl_.duration_max_; -} -inline uint32_t SpritePhase::duration_max() const { - // @@protoc_insertion_point(field_get:Canary.protobuf.appearances.SpritePhase.duration_max) - return _internal_duration_max(); -} -inline void SpritePhase::_internal_set_duration_max(uint32_t value) { - _impl_._has_bits_[0] |= 0x00000002u; - _impl_.duration_max_ = value; -} -inline void SpritePhase::set_duration_max(uint32_t value) { - _internal_set_duration_max(value); - // @@protoc_insertion_point(field_set:Canary.protobuf.appearances.SpritePhase.duration_max) -} - -// ------------------------------------------------------------------- - -// SpriteAnimation - -// optional uint32 default_start_phase = 1; -inline bool SpriteAnimation::_internal_has_default_start_phase() const { - bool value = (_impl_._has_bits_[0] & 0x00000001u) != 0; - return value; -} -inline bool SpriteAnimation::has_default_start_phase() const { - return _internal_has_default_start_phase(); -} -inline void SpriteAnimation::clear_default_start_phase() { - _impl_.default_start_phase_ = 0u; - _impl_._has_bits_[0] &= ~0x00000001u; -} -inline uint32_t SpriteAnimation::_internal_default_start_phase() const { - return _impl_.default_start_phase_; -} -inline uint32_t SpriteAnimation::default_start_phase() const { - // @@protoc_insertion_point(field_get:Canary.protobuf.appearances.SpriteAnimation.default_start_phase) - return _internal_default_start_phase(); -} -inline void SpriteAnimation::_internal_set_default_start_phase(uint32_t value) { - _impl_._has_bits_[0] |= 0x00000001u; - _impl_.default_start_phase_ = value; -} -inline void SpriteAnimation::set_default_start_phase(uint32_t value) { - _internal_set_default_start_phase(value); - // @@protoc_insertion_point(field_set:Canary.protobuf.appearances.SpriteAnimation.default_start_phase) -} - -// optional bool synchronized = 2; -inline bool SpriteAnimation::_internal_has_synchronized() const { - bool value = (_impl_._has_bits_[0] & 0x00000002u) != 0; - return value; -} -inline bool SpriteAnimation::has_synchronized() const { - return _internal_has_synchronized(); -} -inline void SpriteAnimation::clear_synchronized() { - _impl_.synchronized_ = false; - _impl_._has_bits_[0] &= ~0x00000002u; -} -inline bool SpriteAnimation::_internal_synchronized() const { - return _impl_.synchronized_; -} -inline bool SpriteAnimation::synchronized() const { - // @@protoc_insertion_point(field_get:Canary.protobuf.appearances.SpriteAnimation.synchronized) - return _internal_synchronized(); -} -inline void SpriteAnimation::_internal_set_synchronized(bool value) { - _impl_._has_bits_[0] |= 0x00000002u; - _impl_.synchronized_ = value; -} -inline void SpriteAnimation::set_synchronized(bool value) { - _internal_set_synchronized(value); - // @@protoc_insertion_point(field_set:Canary.protobuf.appearances.SpriteAnimation.synchronized) -} - -// optional bool random_start_phase = 3; -inline bool SpriteAnimation::_internal_has_random_start_phase() const { - bool value = (_impl_._has_bits_[0] & 0x00000004u) != 0; - return value; -} -inline bool SpriteAnimation::has_random_start_phase() const { - return _internal_has_random_start_phase(); -} -inline void SpriteAnimation::clear_random_start_phase() { - _impl_.random_start_phase_ = false; - _impl_._has_bits_[0] &= ~0x00000004u; -} -inline bool SpriteAnimation::_internal_random_start_phase() const { - return _impl_.random_start_phase_; -} -inline bool SpriteAnimation::random_start_phase() const { - // @@protoc_insertion_point(field_get:Canary.protobuf.appearances.SpriteAnimation.random_start_phase) - return _internal_random_start_phase(); -} -inline void SpriteAnimation::_internal_set_random_start_phase(bool value) { - _impl_._has_bits_[0] |= 0x00000004u; - _impl_.random_start_phase_ = value; -} -inline void SpriteAnimation::set_random_start_phase(bool value) { - _internal_set_random_start_phase(value); - // @@protoc_insertion_point(field_set:Canary.protobuf.appearances.SpriteAnimation.random_start_phase) -} - -// optional .Canary.protobuf.appearances.ANIMATION_LOOP_TYPE loop_type = 4; -inline bool SpriteAnimation::_internal_has_loop_type() const { - bool value = (_impl_._has_bits_[0] & 0x00000010u) != 0; - return value; -} -inline bool SpriteAnimation::has_loop_type() const { - return _internal_has_loop_type(); -} -inline void SpriteAnimation::clear_loop_type() { - _impl_.loop_type_ = -1; - _impl_._has_bits_[0] &= ~0x00000010u; -} -inline ::Canary::protobuf::appearances::ANIMATION_LOOP_TYPE SpriteAnimation::_internal_loop_type() const { - return static_cast< ::Canary::protobuf::appearances::ANIMATION_LOOP_TYPE >(_impl_.loop_type_); -} -inline ::Canary::protobuf::appearances::ANIMATION_LOOP_TYPE SpriteAnimation::loop_type() const { - // @@protoc_insertion_point(field_get:Canary.protobuf.appearances.SpriteAnimation.loop_type) - return _internal_loop_type(); -} -inline void SpriteAnimation::_internal_set_loop_type(::Canary::protobuf::appearances::ANIMATION_LOOP_TYPE value) { - assert(::Canary::protobuf::appearances::ANIMATION_LOOP_TYPE_IsValid(value)); - _impl_._has_bits_[0] |= 0x00000010u; - _impl_.loop_type_ = value; -} -inline void SpriteAnimation::set_loop_type(::Canary::protobuf::appearances::ANIMATION_LOOP_TYPE value) { - _internal_set_loop_type(value); - // @@protoc_insertion_point(field_set:Canary.protobuf.appearances.SpriteAnimation.loop_type) -} - -// optional uint32 loop_count = 5; -inline bool SpriteAnimation::_internal_has_loop_count() const { - bool value = (_impl_._has_bits_[0] & 0x00000008u) != 0; - return value; -} -inline bool SpriteAnimation::has_loop_count() const { - return _internal_has_loop_count(); -} -inline void SpriteAnimation::clear_loop_count() { - _impl_.loop_count_ = 0u; - _impl_._has_bits_[0] &= ~0x00000008u; -} -inline uint32_t SpriteAnimation::_internal_loop_count() const { - return _impl_.loop_count_; -} -inline uint32_t SpriteAnimation::loop_count() const { - // @@protoc_insertion_point(field_get:Canary.protobuf.appearances.SpriteAnimation.loop_count) - return _internal_loop_count(); -} -inline void SpriteAnimation::_internal_set_loop_count(uint32_t value) { - _impl_._has_bits_[0] |= 0x00000008u; - _impl_.loop_count_ = value; -} -inline void SpriteAnimation::set_loop_count(uint32_t value) { - _internal_set_loop_count(value); - // @@protoc_insertion_point(field_set:Canary.protobuf.appearances.SpriteAnimation.loop_count) -} - -// repeated .Canary.protobuf.appearances.SpritePhase sprite_phase = 6; -inline int SpriteAnimation::_internal_sprite_phase_size() const { - return _impl_.sprite_phase_.size(); -} -inline int SpriteAnimation::sprite_phase_size() const { - return _internal_sprite_phase_size(); -} -inline void SpriteAnimation::clear_sprite_phase() { - _impl_.sprite_phase_.Clear(); -} -inline ::Canary::protobuf::appearances::SpritePhase* SpriteAnimation::mutable_sprite_phase(int index) { - // @@protoc_insertion_point(field_mutable:Canary.protobuf.appearances.SpriteAnimation.sprite_phase) - return _impl_.sprite_phase_.Mutable(index); -} -inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::Canary::protobuf::appearances::SpritePhase >* -SpriteAnimation::mutable_sprite_phase() { - // @@protoc_insertion_point(field_mutable_list:Canary.protobuf.appearances.SpriteAnimation.sprite_phase) - return &_impl_.sprite_phase_; -} -inline const ::Canary::protobuf::appearances::SpritePhase& SpriteAnimation::_internal_sprite_phase(int index) const { - return _impl_.sprite_phase_.Get(index); -} -inline const ::Canary::protobuf::appearances::SpritePhase& SpriteAnimation::sprite_phase(int index) const { - // @@protoc_insertion_point(field_get:Canary.protobuf.appearances.SpriteAnimation.sprite_phase) - return _internal_sprite_phase(index); -} -inline ::Canary::protobuf::appearances::SpritePhase* SpriteAnimation::_internal_add_sprite_phase() { - return _impl_.sprite_phase_.Add(); -} -inline ::Canary::protobuf::appearances::SpritePhase* SpriteAnimation::add_sprite_phase() { - ::Canary::protobuf::appearances::SpritePhase* _add = _internal_add_sprite_phase(); - // @@protoc_insertion_point(field_add:Canary.protobuf.appearances.SpriteAnimation.sprite_phase) - return _add; -} -inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::Canary::protobuf::appearances::SpritePhase >& -SpriteAnimation::sprite_phase() const { - // @@protoc_insertion_point(field_list:Canary.protobuf.appearances.SpriteAnimation.sprite_phase) - return _impl_.sprite_phase_; -} - -// ------------------------------------------------------------------- - -// Box - -// optional uint32 x = 1; -inline bool Box::_internal_has_x() const { - bool value = (_impl_._has_bits_[0] & 0x00000001u) != 0; - return value; -} -inline bool Box::has_x() const { - return _internal_has_x(); -} -inline void Box::clear_x() { - _impl_.x_ = 0u; - _impl_._has_bits_[0] &= ~0x00000001u; -} -inline uint32_t Box::_internal_x() const { - return _impl_.x_; -} -inline uint32_t Box::x() const { - // @@protoc_insertion_point(field_get:Canary.protobuf.appearances.Box.x) - return _internal_x(); -} -inline void Box::_internal_set_x(uint32_t value) { - _impl_._has_bits_[0] |= 0x00000001u; - _impl_.x_ = value; -} -inline void Box::set_x(uint32_t value) { - _internal_set_x(value); - // @@protoc_insertion_point(field_set:Canary.protobuf.appearances.Box.x) -} - -// optional uint32 y = 2; -inline bool Box::_internal_has_y() const { - bool value = (_impl_._has_bits_[0] & 0x00000002u) != 0; - return value; -} -inline bool Box::has_y() const { - return _internal_has_y(); -} -inline void Box::clear_y() { - _impl_.y_ = 0u; - _impl_._has_bits_[0] &= ~0x00000002u; -} -inline uint32_t Box::_internal_y() const { - return _impl_.y_; -} -inline uint32_t Box::y() const { - // @@protoc_insertion_point(field_get:Canary.protobuf.appearances.Box.y) - return _internal_y(); -} -inline void Box::_internal_set_y(uint32_t value) { - _impl_._has_bits_[0] |= 0x00000002u; - _impl_.y_ = value; -} -inline void Box::set_y(uint32_t value) { - _internal_set_y(value); - // @@protoc_insertion_point(field_set:Canary.protobuf.appearances.Box.y) -} - -// optional uint32 width = 3; -inline bool Box::_internal_has_width() const { - bool value = (_impl_._has_bits_[0] & 0x00000004u) != 0; - return value; -} -inline bool Box::has_width() const { - return _internal_has_width(); -} -inline void Box::clear_width() { - _impl_.width_ = 0u; - _impl_._has_bits_[0] &= ~0x00000004u; -} -inline uint32_t Box::_internal_width() const { - return _impl_.width_; -} -inline uint32_t Box::width() const { - // @@protoc_insertion_point(field_get:Canary.protobuf.appearances.Box.width) - return _internal_width(); -} -inline void Box::_internal_set_width(uint32_t value) { - _impl_._has_bits_[0] |= 0x00000004u; - _impl_.width_ = value; -} -inline void Box::set_width(uint32_t value) { - _internal_set_width(value); - // @@protoc_insertion_point(field_set:Canary.protobuf.appearances.Box.width) -} - -// optional uint32 height = 4; -inline bool Box::_internal_has_height() const { - bool value = (_impl_._has_bits_[0] & 0x00000008u) != 0; - return value; -} -inline bool Box::has_height() const { - return _internal_has_height(); -} -inline void Box::clear_height() { - _impl_.height_ = 0u; - _impl_._has_bits_[0] &= ~0x00000008u; -} -inline uint32_t Box::_internal_height() const { - return _impl_.height_; -} -inline uint32_t Box::height() const { - // @@protoc_insertion_point(field_get:Canary.protobuf.appearances.Box.height) - return _internal_height(); -} -inline void Box::_internal_set_height(uint32_t value) { - _impl_._has_bits_[0] |= 0x00000008u; - _impl_.height_ = value; -} -inline void Box::set_height(uint32_t value) { - _internal_set_height(value); - // @@protoc_insertion_point(field_set:Canary.protobuf.appearances.Box.height) -} - -// ------------------------------------------------------------------- - -// SpriteInfo - -// optional uint32 pattern_width = 1; -inline bool SpriteInfo::_internal_has_pattern_width() const { - bool value = (_impl_._has_bits_[0] & 0x00000002u) != 0; - return value; -} -inline bool SpriteInfo::has_pattern_width() const { - return _internal_has_pattern_width(); -} -inline void SpriteInfo::clear_pattern_width() { - _impl_.pattern_width_ = 0u; - _impl_._has_bits_[0] &= ~0x00000002u; -} -inline uint32_t SpriteInfo::_internal_pattern_width() const { - return _impl_.pattern_width_; -} -inline uint32_t SpriteInfo::pattern_width() const { - // @@protoc_insertion_point(field_get:Canary.protobuf.appearances.SpriteInfo.pattern_width) - return _internal_pattern_width(); -} -inline void SpriteInfo::_internal_set_pattern_width(uint32_t value) { - _impl_._has_bits_[0] |= 0x00000002u; - _impl_.pattern_width_ = value; -} -inline void SpriteInfo::set_pattern_width(uint32_t value) { - _internal_set_pattern_width(value); - // @@protoc_insertion_point(field_set:Canary.protobuf.appearances.SpriteInfo.pattern_width) -} - -// optional uint32 pattern_height = 2; -inline bool SpriteInfo::_internal_has_pattern_height() const { - bool value = (_impl_._has_bits_[0] & 0x00000004u) != 0; - return value; -} -inline bool SpriteInfo::has_pattern_height() const { - return _internal_has_pattern_height(); -} -inline void SpriteInfo::clear_pattern_height() { - _impl_.pattern_height_ = 0u; - _impl_._has_bits_[0] &= ~0x00000004u; -} -inline uint32_t SpriteInfo::_internal_pattern_height() const { - return _impl_.pattern_height_; -} -inline uint32_t SpriteInfo::pattern_height() const { - // @@protoc_insertion_point(field_get:Canary.protobuf.appearances.SpriteInfo.pattern_height) - return _internal_pattern_height(); -} -inline void SpriteInfo::_internal_set_pattern_height(uint32_t value) { - _impl_._has_bits_[0] |= 0x00000004u; - _impl_.pattern_height_ = value; -} -inline void SpriteInfo::set_pattern_height(uint32_t value) { - _internal_set_pattern_height(value); - // @@protoc_insertion_point(field_set:Canary.protobuf.appearances.SpriteInfo.pattern_height) -} - -// optional uint32 pattern_depth = 3; -inline bool SpriteInfo::_internal_has_pattern_depth() const { - bool value = (_impl_._has_bits_[0] & 0x00000008u) != 0; - return value; -} -inline bool SpriteInfo::has_pattern_depth() const { - return _internal_has_pattern_depth(); -} -inline void SpriteInfo::clear_pattern_depth() { - _impl_.pattern_depth_ = 0u; - _impl_._has_bits_[0] &= ~0x00000008u; -} -inline uint32_t SpriteInfo::_internal_pattern_depth() const { - return _impl_.pattern_depth_; -} -inline uint32_t SpriteInfo::pattern_depth() const { - // @@protoc_insertion_point(field_get:Canary.protobuf.appearances.SpriteInfo.pattern_depth) - return _internal_pattern_depth(); -} -inline void SpriteInfo::_internal_set_pattern_depth(uint32_t value) { - _impl_._has_bits_[0] |= 0x00000008u; - _impl_.pattern_depth_ = value; -} -inline void SpriteInfo::set_pattern_depth(uint32_t value) { - _internal_set_pattern_depth(value); - // @@protoc_insertion_point(field_set:Canary.protobuf.appearances.SpriteInfo.pattern_depth) -} - -// optional uint32 layers = 4; -inline bool SpriteInfo::_internal_has_layers() const { - bool value = (_impl_._has_bits_[0] & 0x00000010u) != 0; - return value; -} -inline bool SpriteInfo::has_layers() const { - return _internal_has_layers(); -} -inline void SpriteInfo::clear_layers() { - _impl_.layers_ = 0u; - _impl_._has_bits_[0] &= ~0x00000010u; -} -inline uint32_t SpriteInfo::_internal_layers() const { - return _impl_.layers_; -} -inline uint32_t SpriteInfo::layers() const { - // @@protoc_insertion_point(field_get:Canary.protobuf.appearances.SpriteInfo.layers) - return _internal_layers(); -} -inline void SpriteInfo::_internal_set_layers(uint32_t value) { - _impl_._has_bits_[0] |= 0x00000010u; - _impl_.layers_ = value; -} -inline void SpriteInfo::set_layers(uint32_t value) { - _internal_set_layers(value); - // @@protoc_insertion_point(field_set:Canary.protobuf.appearances.SpriteInfo.layers) -} - -// repeated uint32 sprite_id = 5; -inline int SpriteInfo::_internal_sprite_id_size() const { - return _impl_.sprite_id_.size(); -} -inline int SpriteInfo::sprite_id_size() const { - return _internal_sprite_id_size(); -} -inline void SpriteInfo::clear_sprite_id() { - _impl_.sprite_id_.Clear(); -} -inline uint32_t SpriteInfo::_internal_sprite_id(int index) const { - return _impl_.sprite_id_.Get(index); -} -inline uint32_t SpriteInfo::sprite_id(int index) const { - // @@protoc_insertion_point(field_get:Canary.protobuf.appearances.SpriteInfo.sprite_id) - return _internal_sprite_id(index); -} -inline void SpriteInfo::set_sprite_id(int index, uint32_t value) { - _impl_.sprite_id_.Set(index, value); - // @@protoc_insertion_point(field_set:Canary.protobuf.appearances.SpriteInfo.sprite_id) -} -inline void SpriteInfo::_internal_add_sprite_id(uint32_t value) { - _impl_.sprite_id_.Add(value); -} -inline void SpriteInfo::add_sprite_id(uint32_t value) { - _internal_add_sprite_id(value); - // @@protoc_insertion_point(field_add:Canary.protobuf.appearances.SpriteInfo.sprite_id) -} -inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< uint32_t >& -SpriteInfo::_internal_sprite_id() const { - return _impl_.sprite_id_; -} -inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< uint32_t >& -SpriteInfo::sprite_id() const { - // @@protoc_insertion_point(field_list:Canary.protobuf.appearances.SpriteInfo.sprite_id) - return _internal_sprite_id(); -} -inline ::PROTOBUF_NAMESPACE_ID::RepeatedField< uint32_t >* -SpriteInfo::_internal_mutable_sprite_id() { - return &_impl_.sprite_id_; -} -inline ::PROTOBUF_NAMESPACE_ID::RepeatedField< uint32_t >* -SpriteInfo::mutable_sprite_id() { - // @@protoc_insertion_point(field_mutable_list:Canary.protobuf.appearances.SpriteInfo.sprite_id) - return _internal_mutable_sprite_id(); -} - -// optional uint32 bounding_square = 7; -inline bool SpriteInfo::_internal_has_bounding_square() const { - bool value = (_impl_._has_bits_[0] & 0x00000020u) != 0; - return value; -} -inline bool SpriteInfo::has_bounding_square() const { - return _internal_has_bounding_square(); -} -inline void SpriteInfo::clear_bounding_square() { - _impl_.bounding_square_ = 0u; - _impl_._has_bits_[0] &= ~0x00000020u; -} -inline uint32_t SpriteInfo::_internal_bounding_square() const { - return _impl_.bounding_square_; -} -inline uint32_t SpriteInfo::bounding_square() const { - // @@protoc_insertion_point(field_get:Canary.protobuf.appearances.SpriteInfo.bounding_square) - return _internal_bounding_square(); -} -inline void SpriteInfo::_internal_set_bounding_square(uint32_t value) { - _impl_._has_bits_[0] |= 0x00000020u; - _impl_.bounding_square_ = value; -} -inline void SpriteInfo::set_bounding_square(uint32_t value) { - _internal_set_bounding_square(value); - // @@protoc_insertion_point(field_set:Canary.protobuf.appearances.SpriteInfo.bounding_square) -} - -// optional .Canary.protobuf.appearances.SpriteAnimation animation = 6; -inline bool SpriteInfo::_internal_has_animation() const { - bool value = (_impl_._has_bits_[0] & 0x00000001u) != 0; - PROTOBUF_ASSUME(!value || _impl_.animation_ != nullptr); - return value; -} -inline bool SpriteInfo::has_animation() const { - return _internal_has_animation(); -} -inline void SpriteInfo::clear_animation() { - if (_impl_.animation_ != nullptr) _impl_.animation_->Clear(); - _impl_._has_bits_[0] &= ~0x00000001u; -} -inline const ::Canary::protobuf::appearances::SpriteAnimation& SpriteInfo::_internal_animation() const { - const ::Canary::protobuf::appearances::SpriteAnimation* p = _impl_.animation_; - return p != nullptr ? *p : reinterpret_cast( - ::Canary::protobuf::appearances::_SpriteAnimation_default_instance_); -} -inline const ::Canary::protobuf::appearances::SpriteAnimation& SpriteInfo::animation() const { - // @@protoc_insertion_point(field_get:Canary.protobuf.appearances.SpriteInfo.animation) - return _internal_animation(); -} -inline void SpriteInfo::unsafe_arena_set_allocated_animation( - ::Canary::protobuf::appearances::SpriteAnimation* animation) { - if (GetArenaForAllocation() == nullptr) { - delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(_impl_.animation_); - } - _impl_.animation_ = animation; - if (animation) { - _impl_._has_bits_[0] |= 0x00000001u; - } else { - _impl_._has_bits_[0] &= ~0x00000001u; - } - // @@protoc_insertion_point(field_unsafe_arena_set_allocated:Canary.protobuf.appearances.SpriteInfo.animation) -} -inline ::Canary::protobuf::appearances::SpriteAnimation* SpriteInfo::release_animation() { - _impl_._has_bits_[0] &= ~0x00000001u; - ::Canary::protobuf::appearances::SpriteAnimation* temp = _impl_.animation_; - _impl_.animation_ = nullptr; -#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE - auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); - temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); - if (GetArenaForAllocation() == nullptr) { delete old; } -#else // PROTOBUF_FORCE_COPY_IN_RELEASE - if (GetArenaForAllocation() != nullptr) { - temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); - } -#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE - return temp; -} -inline ::Canary::protobuf::appearances::SpriteAnimation* SpriteInfo::unsafe_arena_release_animation() { - // @@protoc_insertion_point(field_release:Canary.protobuf.appearances.SpriteInfo.animation) - _impl_._has_bits_[0] &= ~0x00000001u; - ::Canary::protobuf::appearances::SpriteAnimation* temp = _impl_.animation_; - _impl_.animation_ = nullptr; - return temp; -} -inline ::Canary::protobuf::appearances::SpriteAnimation* SpriteInfo::_internal_mutable_animation() { - _impl_._has_bits_[0] |= 0x00000001u; - if (_impl_.animation_ == nullptr) { - auto* p = CreateMaybeMessage<::Canary::protobuf::appearances::SpriteAnimation>(GetArenaForAllocation()); - _impl_.animation_ = p; - } - return _impl_.animation_; -} -inline ::Canary::protobuf::appearances::SpriteAnimation* SpriteInfo::mutable_animation() { - ::Canary::protobuf::appearances::SpriteAnimation* _msg = _internal_mutable_animation(); - // @@protoc_insertion_point(field_mutable:Canary.protobuf.appearances.SpriteInfo.animation) - return _msg; -} -inline void SpriteInfo::set_allocated_animation(::Canary::protobuf::appearances::SpriteAnimation* animation) { - ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); - if (message_arena == nullptr) { - delete _impl_.animation_; - } - if (animation) { - ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = - ::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena(animation); - if (message_arena != submessage_arena) { - animation = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( - message_arena, animation, submessage_arena); - } - _impl_._has_bits_[0] |= 0x00000001u; - } else { - _impl_._has_bits_[0] &= ~0x00000001u; - } - _impl_.animation_ = animation; - // @@protoc_insertion_point(field_set_allocated:Canary.protobuf.appearances.SpriteInfo.animation) -} - -// optional bool is_opaque = 8; -inline bool SpriteInfo::_internal_has_is_opaque() const { - bool value = (_impl_._has_bits_[0] & 0x00000040u) != 0; - return value; -} -inline bool SpriteInfo::has_is_opaque() const { - return _internal_has_is_opaque(); -} -inline void SpriteInfo::clear_is_opaque() { - _impl_.is_opaque_ = false; - _impl_._has_bits_[0] &= ~0x00000040u; -} -inline bool SpriteInfo::_internal_is_opaque() const { - return _impl_.is_opaque_; -} -inline bool SpriteInfo::is_opaque() const { - // @@protoc_insertion_point(field_get:Canary.protobuf.appearances.SpriteInfo.is_opaque) - return _internal_is_opaque(); -} -inline void SpriteInfo::_internal_set_is_opaque(bool value) { - _impl_._has_bits_[0] |= 0x00000040u; - _impl_.is_opaque_ = value; -} -inline void SpriteInfo::set_is_opaque(bool value) { - _internal_set_is_opaque(value); - // @@protoc_insertion_point(field_set:Canary.protobuf.appearances.SpriteInfo.is_opaque) -} - -// repeated .Canary.protobuf.appearances.Box bounding_box_per_direction = 9; -inline int SpriteInfo::_internal_bounding_box_per_direction_size() const { - return _impl_.bounding_box_per_direction_.size(); -} -inline int SpriteInfo::bounding_box_per_direction_size() const { - return _internal_bounding_box_per_direction_size(); -} -inline void SpriteInfo::clear_bounding_box_per_direction() { - _impl_.bounding_box_per_direction_.Clear(); -} -inline ::Canary::protobuf::appearances::Box* SpriteInfo::mutable_bounding_box_per_direction(int index) { - // @@protoc_insertion_point(field_mutable:Canary.protobuf.appearances.SpriteInfo.bounding_box_per_direction) - return _impl_.bounding_box_per_direction_.Mutable(index); -} -inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::Canary::protobuf::appearances::Box >* -SpriteInfo::mutable_bounding_box_per_direction() { - // @@protoc_insertion_point(field_mutable_list:Canary.protobuf.appearances.SpriteInfo.bounding_box_per_direction) - return &_impl_.bounding_box_per_direction_; -} -inline const ::Canary::protobuf::appearances::Box& SpriteInfo::_internal_bounding_box_per_direction(int index) const { - return _impl_.bounding_box_per_direction_.Get(index); -} -inline const ::Canary::protobuf::appearances::Box& SpriteInfo::bounding_box_per_direction(int index) const { - // @@protoc_insertion_point(field_get:Canary.protobuf.appearances.SpriteInfo.bounding_box_per_direction) - return _internal_bounding_box_per_direction(index); -} -inline ::Canary::protobuf::appearances::Box* SpriteInfo::_internal_add_bounding_box_per_direction() { - return _impl_.bounding_box_per_direction_.Add(); -} -inline ::Canary::protobuf::appearances::Box* SpriteInfo::add_bounding_box_per_direction() { - ::Canary::protobuf::appearances::Box* _add = _internal_add_bounding_box_per_direction(); - // @@protoc_insertion_point(field_add:Canary.protobuf.appearances.SpriteInfo.bounding_box_per_direction) - return _add; -} -inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::Canary::protobuf::appearances::Box >& -SpriteInfo::bounding_box_per_direction() const { - // @@protoc_insertion_point(field_list:Canary.protobuf.appearances.SpriteInfo.bounding_box_per_direction) - return _impl_.bounding_box_per_direction_; -} - -// ------------------------------------------------------------------- - -// FrameGroup - -// optional .Canary.protobuf.appearances.FIXED_FRAME_GROUP fixed_frame_group = 1; -inline bool FrameGroup::_internal_has_fixed_frame_group() const { - bool value = (_impl_._has_bits_[0] & 0x00000002u) != 0; - return value; -} -inline bool FrameGroup::has_fixed_frame_group() const { - return _internal_has_fixed_frame_group(); -} -inline void FrameGroup::clear_fixed_frame_group() { - _impl_.fixed_frame_group_ = 0; - _impl_._has_bits_[0] &= ~0x00000002u; -} -inline ::Canary::protobuf::appearances::FIXED_FRAME_GROUP FrameGroup::_internal_fixed_frame_group() const { - return static_cast< ::Canary::protobuf::appearances::FIXED_FRAME_GROUP >(_impl_.fixed_frame_group_); -} -inline ::Canary::protobuf::appearances::FIXED_FRAME_GROUP FrameGroup::fixed_frame_group() const { - // @@protoc_insertion_point(field_get:Canary.protobuf.appearances.FrameGroup.fixed_frame_group) - return _internal_fixed_frame_group(); -} -inline void FrameGroup::_internal_set_fixed_frame_group(::Canary::protobuf::appearances::FIXED_FRAME_GROUP value) { - assert(::Canary::protobuf::appearances::FIXED_FRAME_GROUP_IsValid(value)); - _impl_._has_bits_[0] |= 0x00000002u; - _impl_.fixed_frame_group_ = value; -} -inline void FrameGroup::set_fixed_frame_group(::Canary::protobuf::appearances::FIXED_FRAME_GROUP value) { - _internal_set_fixed_frame_group(value); - // @@protoc_insertion_point(field_set:Canary.protobuf.appearances.FrameGroup.fixed_frame_group) -} - -// optional uint32 id = 2; -inline bool FrameGroup::_internal_has_id() const { - bool value = (_impl_._has_bits_[0] & 0x00000004u) != 0; - return value; -} -inline bool FrameGroup::has_id() const { - return _internal_has_id(); -} -inline void FrameGroup::clear_id() { - _impl_.id_ = 0u; - _impl_._has_bits_[0] &= ~0x00000004u; -} -inline uint32_t FrameGroup::_internal_id() const { - return _impl_.id_; -} -inline uint32_t FrameGroup::id() const { - // @@protoc_insertion_point(field_get:Canary.protobuf.appearances.FrameGroup.id) - return _internal_id(); -} -inline void FrameGroup::_internal_set_id(uint32_t value) { - _impl_._has_bits_[0] |= 0x00000004u; - _impl_.id_ = value; -} -inline void FrameGroup::set_id(uint32_t value) { - _internal_set_id(value); - // @@protoc_insertion_point(field_set:Canary.protobuf.appearances.FrameGroup.id) -} - -// optional .Canary.protobuf.appearances.SpriteInfo sprite_info = 3; -inline bool FrameGroup::_internal_has_sprite_info() const { - bool value = (_impl_._has_bits_[0] & 0x00000001u) != 0; - PROTOBUF_ASSUME(!value || _impl_.sprite_info_ != nullptr); - return value; -} -inline bool FrameGroup::has_sprite_info() const { - return _internal_has_sprite_info(); -} -inline void FrameGroup::clear_sprite_info() { - if (_impl_.sprite_info_ != nullptr) _impl_.sprite_info_->Clear(); - _impl_._has_bits_[0] &= ~0x00000001u; -} -inline const ::Canary::protobuf::appearances::SpriteInfo& FrameGroup::_internal_sprite_info() const { - const ::Canary::protobuf::appearances::SpriteInfo* p = _impl_.sprite_info_; - return p != nullptr ? *p : reinterpret_cast( - ::Canary::protobuf::appearances::_SpriteInfo_default_instance_); -} -inline const ::Canary::protobuf::appearances::SpriteInfo& FrameGroup::sprite_info() const { - // @@protoc_insertion_point(field_get:Canary.protobuf.appearances.FrameGroup.sprite_info) - return _internal_sprite_info(); -} -inline void FrameGroup::unsafe_arena_set_allocated_sprite_info( - ::Canary::protobuf::appearances::SpriteInfo* sprite_info) { - if (GetArenaForAllocation() == nullptr) { - delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(_impl_.sprite_info_); - } - _impl_.sprite_info_ = sprite_info; - if (sprite_info) { - _impl_._has_bits_[0] |= 0x00000001u; - } else { - _impl_._has_bits_[0] &= ~0x00000001u; - } - // @@protoc_insertion_point(field_unsafe_arena_set_allocated:Canary.protobuf.appearances.FrameGroup.sprite_info) -} -inline ::Canary::protobuf::appearances::SpriteInfo* FrameGroup::release_sprite_info() { - _impl_._has_bits_[0] &= ~0x00000001u; - ::Canary::protobuf::appearances::SpriteInfo* temp = _impl_.sprite_info_; - _impl_.sprite_info_ = nullptr; -#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE - auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); - temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); - if (GetArenaForAllocation() == nullptr) { delete old; } -#else // PROTOBUF_FORCE_COPY_IN_RELEASE - if (GetArenaForAllocation() != nullptr) { - temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); - } -#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE - return temp; -} -inline ::Canary::protobuf::appearances::SpriteInfo* FrameGroup::unsafe_arena_release_sprite_info() { - // @@protoc_insertion_point(field_release:Canary.protobuf.appearances.FrameGroup.sprite_info) - _impl_._has_bits_[0] &= ~0x00000001u; - ::Canary::protobuf::appearances::SpriteInfo* temp = _impl_.sprite_info_; - _impl_.sprite_info_ = nullptr; - return temp; -} -inline ::Canary::protobuf::appearances::SpriteInfo* FrameGroup::_internal_mutable_sprite_info() { - _impl_._has_bits_[0] |= 0x00000001u; - if (_impl_.sprite_info_ == nullptr) { - auto* p = CreateMaybeMessage<::Canary::protobuf::appearances::SpriteInfo>(GetArenaForAllocation()); - _impl_.sprite_info_ = p; - } - return _impl_.sprite_info_; -} -inline ::Canary::protobuf::appearances::SpriteInfo* FrameGroup::mutable_sprite_info() { - ::Canary::protobuf::appearances::SpriteInfo* _msg = _internal_mutable_sprite_info(); - // @@protoc_insertion_point(field_mutable:Canary.protobuf.appearances.FrameGroup.sprite_info) - return _msg; -} -inline void FrameGroup::set_allocated_sprite_info(::Canary::protobuf::appearances::SpriteInfo* sprite_info) { - ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); - if (message_arena == nullptr) { - delete _impl_.sprite_info_; - } - if (sprite_info) { - ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = - ::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena(sprite_info); - if (message_arena != submessage_arena) { - sprite_info = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( - message_arena, sprite_info, submessage_arena); - } - _impl_._has_bits_[0] |= 0x00000001u; - } else { - _impl_._has_bits_[0] &= ~0x00000001u; - } - _impl_.sprite_info_ = sprite_info; - // @@protoc_insertion_point(field_set_allocated:Canary.protobuf.appearances.FrameGroup.sprite_info) -} - -// ------------------------------------------------------------------- - -// Appearance - -// optional uint32 id = 1; -inline bool Appearance::_internal_has_id() const { - bool value = (_impl_._has_bits_[0] & 0x00000008u) != 0; - return value; -} -inline bool Appearance::has_id() const { - return _internal_has_id(); -} -inline void Appearance::clear_id() { - _impl_.id_ = 0u; - _impl_._has_bits_[0] &= ~0x00000008u; -} -inline uint32_t Appearance::_internal_id() const { - return _impl_.id_; -} -inline uint32_t Appearance::id() const { - // @@protoc_insertion_point(field_get:Canary.protobuf.appearances.Appearance.id) - return _internal_id(); -} -inline void Appearance::_internal_set_id(uint32_t value) { - _impl_._has_bits_[0] |= 0x00000008u; - _impl_.id_ = value; -} -inline void Appearance::set_id(uint32_t value) { - _internal_set_id(value); - // @@protoc_insertion_point(field_set:Canary.protobuf.appearances.Appearance.id) -} - -// repeated .Canary.protobuf.appearances.FrameGroup frame_group = 2; -inline int Appearance::_internal_frame_group_size() const { - return _impl_.frame_group_.size(); -} -inline int Appearance::frame_group_size() const { - return _internal_frame_group_size(); -} -inline void Appearance::clear_frame_group() { - _impl_.frame_group_.Clear(); -} -inline ::Canary::protobuf::appearances::FrameGroup* Appearance::mutable_frame_group(int index) { - // @@protoc_insertion_point(field_mutable:Canary.protobuf.appearances.Appearance.frame_group) - return _impl_.frame_group_.Mutable(index); -} -inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::Canary::protobuf::appearances::FrameGroup >* -Appearance::mutable_frame_group() { - // @@protoc_insertion_point(field_mutable_list:Canary.protobuf.appearances.Appearance.frame_group) - return &_impl_.frame_group_; -} -inline const ::Canary::protobuf::appearances::FrameGroup& Appearance::_internal_frame_group(int index) const { - return _impl_.frame_group_.Get(index); -} -inline const ::Canary::protobuf::appearances::FrameGroup& Appearance::frame_group(int index) const { - // @@protoc_insertion_point(field_get:Canary.protobuf.appearances.Appearance.frame_group) - return _internal_frame_group(index); -} -inline ::Canary::protobuf::appearances::FrameGroup* Appearance::_internal_add_frame_group() { - return _impl_.frame_group_.Add(); -} -inline ::Canary::protobuf::appearances::FrameGroup* Appearance::add_frame_group() { - ::Canary::protobuf::appearances::FrameGroup* _add = _internal_add_frame_group(); - // @@protoc_insertion_point(field_add:Canary.protobuf.appearances.Appearance.frame_group) - return _add; -} -inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::Canary::protobuf::appearances::FrameGroup >& -Appearance::frame_group() const { - // @@protoc_insertion_point(field_list:Canary.protobuf.appearances.Appearance.frame_group) - return _impl_.frame_group_; -} - -// optional .Canary.protobuf.appearances.AppearanceFlags flags = 3; -inline bool Appearance::_internal_has_flags() const { - bool value = (_impl_._has_bits_[0] & 0x00000004u) != 0; - PROTOBUF_ASSUME(!value || _impl_.flags_ != nullptr); - return value; -} -inline bool Appearance::has_flags() const { - return _internal_has_flags(); -} -inline void Appearance::clear_flags() { - if (_impl_.flags_ != nullptr) _impl_.flags_->Clear(); - _impl_._has_bits_[0] &= ~0x00000004u; -} -inline const ::Canary::protobuf::appearances::AppearanceFlags& Appearance::_internal_flags() const { - const ::Canary::protobuf::appearances::AppearanceFlags* p = _impl_.flags_; - return p != nullptr ? *p : reinterpret_cast( - ::Canary::protobuf::appearances::_AppearanceFlags_default_instance_); -} -inline const ::Canary::protobuf::appearances::AppearanceFlags& Appearance::flags() const { - // @@protoc_insertion_point(field_get:Canary.protobuf.appearances.Appearance.flags) - return _internal_flags(); -} -inline void Appearance::unsafe_arena_set_allocated_flags( - ::Canary::protobuf::appearances::AppearanceFlags* flags) { - if (GetArenaForAllocation() == nullptr) { - delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(_impl_.flags_); - } - _impl_.flags_ = flags; - if (flags) { - _impl_._has_bits_[0] |= 0x00000004u; - } else { - _impl_._has_bits_[0] &= ~0x00000004u; - } - // @@protoc_insertion_point(field_unsafe_arena_set_allocated:Canary.protobuf.appearances.Appearance.flags) -} -inline ::Canary::protobuf::appearances::AppearanceFlags* Appearance::release_flags() { - _impl_._has_bits_[0] &= ~0x00000004u; - ::Canary::protobuf::appearances::AppearanceFlags* temp = _impl_.flags_; - _impl_.flags_ = nullptr; -#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE - auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); - temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); - if (GetArenaForAllocation() == nullptr) { delete old; } -#else // PROTOBUF_FORCE_COPY_IN_RELEASE - if (GetArenaForAllocation() != nullptr) { - temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); - } -#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE - return temp; -} -inline ::Canary::protobuf::appearances::AppearanceFlags* Appearance::unsafe_arena_release_flags() { - // @@protoc_insertion_point(field_release:Canary.protobuf.appearances.Appearance.flags) - _impl_._has_bits_[0] &= ~0x00000004u; - ::Canary::protobuf::appearances::AppearanceFlags* temp = _impl_.flags_; - _impl_.flags_ = nullptr; - return temp; -} -inline ::Canary::protobuf::appearances::AppearanceFlags* Appearance::_internal_mutable_flags() { - _impl_._has_bits_[0] |= 0x00000004u; - if (_impl_.flags_ == nullptr) { - auto* p = CreateMaybeMessage<::Canary::protobuf::appearances::AppearanceFlags>(GetArenaForAllocation()); - _impl_.flags_ = p; - } - return _impl_.flags_; -} -inline ::Canary::protobuf::appearances::AppearanceFlags* Appearance::mutable_flags() { - ::Canary::protobuf::appearances::AppearanceFlags* _msg = _internal_mutable_flags(); - // @@protoc_insertion_point(field_mutable:Canary.protobuf.appearances.Appearance.flags) - return _msg; -} -inline void Appearance::set_allocated_flags(::Canary::protobuf::appearances::AppearanceFlags* flags) { - ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); - if (message_arena == nullptr) { - delete _impl_.flags_; - } - if (flags) { - ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = - ::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena(flags); - if (message_arena != submessage_arena) { - flags = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( - message_arena, flags, submessage_arena); - } - _impl_._has_bits_[0] |= 0x00000004u; - } else { - _impl_._has_bits_[0] &= ~0x00000004u; - } - _impl_.flags_ = flags; - // @@protoc_insertion_point(field_set_allocated:Canary.protobuf.appearances.Appearance.flags) -} - -// optional bytes name = 4; -inline bool Appearance::_internal_has_name() const { - bool value = (_impl_._has_bits_[0] & 0x00000001u) != 0; - return value; -} -inline bool Appearance::has_name() const { - return _internal_has_name(); -} -inline void Appearance::clear_name() { - _impl_.name_.ClearToEmpty(); - _impl_._has_bits_[0] &= ~0x00000001u; -} -inline const std::string& Appearance::name() const { - // @@protoc_insertion_point(field_get:Canary.protobuf.appearances.Appearance.name) - return _internal_name(); -} -template -inline PROTOBUF_ALWAYS_INLINE -void Appearance::set_name(ArgT0&& arg0, ArgT... args) { - _impl_._has_bits_[0] |= 0x00000001u; - _impl_.name_.SetBytes(static_cast(arg0), args..., GetArenaForAllocation()); - // @@protoc_insertion_point(field_set:Canary.protobuf.appearances.Appearance.name) -} -inline std::string* Appearance::mutable_name() { - std::string* _s = _internal_mutable_name(); - // @@protoc_insertion_point(field_mutable:Canary.protobuf.appearances.Appearance.name) - return _s; -} -inline const std::string& Appearance::_internal_name() const { - return _impl_.name_.Get(); -} -inline void Appearance::_internal_set_name(const std::string& value) { - _impl_._has_bits_[0] |= 0x00000001u; - _impl_.name_.Set(value, GetArenaForAllocation()); -} -inline std::string* Appearance::_internal_mutable_name() { - _impl_._has_bits_[0] |= 0x00000001u; - return _impl_.name_.Mutable(GetArenaForAllocation()); -} -inline std::string* Appearance::release_name() { - // @@protoc_insertion_point(field_release:Canary.protobuf.appearances.Appearance.name) - if (!_internal_has_name()) { - return nullptr; - } - _impl_._has_bits_[0] &= ~0x00000001u; - auto* p = _impl_.name_.Release(); -#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING - if (_impl_.name_.IsDefault()) { - _impl_.name_.Set("", GetArenaForAllocation()); - } -#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING - return p; -} -inline void Appearance::set_allocated_name(std::string* name) { - if (name != nullptr) { - _impl_._has_bits_[0] |= 0x00000001u; - } else { - _impl_._has_bits_[0] &= ~0x00000001u; - } - _impl_.name_.SetAllocated(name, GetArenaForAllocation()); -#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING - if (_impl_.name_.IsDefault()) { - _impl_.name_.Set("", GetArenaForAllocation()); - } -#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING - // @@protoc_insertion_point(field_set_allocated:Canary.protobuf.appearances.Appearance.name) -} - -// optional bytes description = 5; -inline bool Appearance::_internal_has_description() const { - bool value = (_impl_._has_bits_[0] & 0x00000002u) != 0; - return value; -} -inline bool Appearance::has_description() const { - return _internal_has_description(); -} -inline void Appearance::clear_description() { - _impl_.description_.ClearToEmpty(); - _impl_._has_bits_[0] &= ~0x00000002u; -} -inline const std::string& Appearance::description() const { - // @@protoc_insertion_point(field_get:Canary.protobuf.appearances.Appearance.description) - return _internal_description(); -} -template -inline PROTOBUF_ALWAYS_INLINE -void Appearance::set_description(ArgT0&& arg0, ArgT... args) { - _impl_._has_bits_[0] |= 0x00000002u; - _impl_.description_.SetBytes(static_cast(arg0), args..., GetArenaForAllocation()); - // @@protoc_insertion_point(field_set:Canary.protobuf.appearances.Appearance.description) -} -inline std::string* Appearance::mutable_description() { - std::string* _s = _internal_mutable_description(); - // @@protoc_insertion_point(field_mutable:Canary.protobuf.appearances.Appearance.description) - return _s; -} -inline const std::string& Appearance::_internal_description() const { - return _impl_.description_.Get(); -} -inline void Appearance::_internal_set_description(const std::string& value) { - _impl_._has_bits_[0] |= 0x00000002u; - _impl_.description_.Set(value, GetArenaForAllocation()); -} -inline std::string* Appearance::_internal_mutable_description() { - _impl_._has_bits_[0] |= 0x00000002u; - return _impl_.description_.Mutable(GetArenaForAllocation()); -} -inline std::string* Appearance::release_description() { - // @@protoc_insertion_point(field_release:Canary.protobuf.appearances.Appearance.description) - if (!_internal_has_description()) { - return nullptr; - } - _impl_._has_bits_[0] &= ~0x00000002u; - auto* p = _impl_.description_.Release(); -#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING - if (_impl_.description_.IsDefault()) { - _impl_.description_.Set("", GetArenaForAllocation()); - } -#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING - return p; -} -inline void Appearance::set_allocated_description(std::string* description) { - if (description != nullptr) { - _impl_._has_bits_[0] |= 0x00000002u; - } else { - _impl_._has_bits_[0] &= ~0x00000002u; - } - _impl_.description_.SetAllocated(description, GetArenaForAllocation()); -#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING - if (_impl_.description_.IsDefault()) { - _impl_.description_.Set("", GetArenaForAllocation()); - } -#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING - // @@protoc_insertion_point(field_set_allocated:Canary.protobuf.appearances.Appearance.description) -} - -// ------------------------------------------------------------------- - -// AppearanceFlags - -// optional .Canary.protobuf.appearances.AppearanceFlagBank bank = 1; -inline bool AppearanceFlags::_internal_has_bank() const { - bool value = (_impl_._has_bits_[0] & 0x00000001u) != 0; - PROTOBUF_ASSUME(!value || _impl_.bank_ != nullptr); - return value; -} -inline bool AppearanceFlags::has_bank() const { - return _internal_has_bank(); -} -inline void AppearanceFlags::clear_bank() { - if (_impl_.bank_ != nullptr) _impl_.bank_->Clear(); - _impl_._has_bits_[0] &= ~0x00000001u; -} -inline const ::Canary::protobuf::appearances::AppearanceFlagBank& AppearanceFlags::_internal_bank() const { - const ::Canary::protobuf::appearances::AppearanceFlagBank* p = _impl_.bank_; - return p != nullptr ? *p : reinterpret_cast( - ::Canary::protobuf::appearances::_AppearanceFlagBank_default_instance_); -} -inline const ::Canary::protobuf::appearances::AppearanceFlagBank& AppearanceFlags::bank() const { - // @@protoc_insertion_point(field_get:Canary.protobuf.appearances.AppearanceFlags.bank) - return _internal_bank(); -} -inline void AppearanceFlags::unsafe_arena_set_allocated_bank( - ::Canary::protobuf::appearances::AppearanceFlagBank* bank) { - if (GetArenaForAllocation() == nullptr) { - delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(_impl_.bank_); - } - _impl_.bank_ = bank; - if (bank) { - _impl_._has_bits_[0] |= 0x00000001u; - } else { - _impl_._has_bits_[0] &= ~0x00000001u; - } - // @@protoc_insertion_point(field_unsafe_arena_set_allocated:Canary.protobuf.appearances.AppearanceFlags.bank) -} -inline ::Canary::protobuf::appearances::AppearanceFlagBank* AppearanceFlags::release_bank() { - _impl_._has_bits_[0] &= ~0x00000001u; - ::Canary::protobuf::appearances::AppearanceFlagBank* temp = _impl_.bank_; - _impl_.bank_ = nullptr; -#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE - auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); - temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); - if (GetArenaForAllocation() == nullptr) { delete old; } -#else // PROTOBUF_FORCE_COPY_IN_RELEASE - if (GetArenaForAllocation() != nullptr) { - temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); - } -#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE - return temp; -} -inline ::Canary::protobuf::appearances::AppearanceFlagBank* AppearanceFlags::unsafe_arena_release_bank() { - // @@protoc_insertion_point(field_release:Canary.protobuf.appearances.AppearanceFlags.bank) - _impl_._has_bits_[0] &= ~0x00000001u; - ::Canary::protobuf::appearances::AppearanceFlagBank* temp = _impl_.bank_; - _impl_.bank_ = nullptr; - return temp; -} -inline ::Canary::protobuf::appearances::AppearanceFlagBank* AppearanceFlags::_internal_mutable_bank() { - _impl_._has_bits_[0] |= 0x00000001u; - if (_impl_.bank_ == nullptr) { - auto* p = CreateMaybeMessage<::Canary::protobuf::appearances::AppearanceFlagBank>(GetArenaForAllocation()); - _impl_.bank_ = p; - } - return _impl_.bank_; -} -inline ::Canary::protobuf::appearances::AppearanceFlagBank* AppearanceFlags::mutable_bank() { - ::Canary::protobuf::appearances::AppearanceFlagBank* _msg = _internal_mutable_bank(); - // @@protoc_insertion_point(field_mutable:Canary.protobuf.appearances.AppearanceFlags.bank) - return _msg; -} -inline void AppearanceFlags::set_allocated_bank(::Canary::protobuf::appearances::AppearanceFlagBank* bank) { - ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); - if (message_arena == nullptr) { - delete _impl_.bank_; - } - if (bank) { - ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = - ::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena(bank); - if (message_arena != submessage_arena) { - bank = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( - message_arena, bank, submessage_arena); - } - _impl_._has_bits_[0] |= 0x00000001u; - } else { - _impl_._has_bits_[0] &= ~0x00000001u; - } - _impl_.bank_ = bank; - // @@protoc_insertion_point(field_set_allocated:Canary.protobuf.appearances.AppearanceFlags.bank) -} - -// optional bool clip = 2; -inline bool AppearanceFlags::_internal_has_clip() const { - bool value = (_impl_._has_bits_[0] & 0x00008000u) != 0; - return value; -} -inline bool AppearanceFlags::has_clip() const { - return _internal_has_clip(); -} -inline void AppearanceFlags::clear_clip() { - _impl_.clip_ = false; - _impl_._has_bits_[0] &= ~0x00008000u; -} -inline bool AppearanceFlags::_internal_clip() const { - return _impl_.clip_; -} -inline bool AppearanceFlags::clip() const { - // @@protoc_insertion_point(field_get:Canary.protobuf.appearances.AppearanceFlags.clip) - return _internal_clip(); -} -inline void AppearanceFlags::_internal_set_clip(bool value) { - _impl_._has_bits_[0] |= 0x00008000u; - _impl_.clip_ = value; -} -inline void AppearanceFlags::set_clip(bool value) { - _internal_set_clip(value); - // @@protoc_insertion_point(field_set:Canary.protobuf.appearances.AppearanceFlags.clip) -} - -// optional bool bottom = 3; -inline bool AppearanceFlags::_internal_has_bottom() const { - bool value = (_impl_._has_bits_[0] & 0x00010000u) != 0; - return value; -} -inline bool AppearanceFlags::has_bottom() const { - return _internal_has_bottom(); -} -inline void AppearanceFlags::clear_bottom() { - _impl_.bottom_ = false; - _impl_._has_bits_[0] &= ~0x00010000u; -} -inline bool AppearanceFlags::_internal_bottom() const { - return _impl_.bottom_; -} -inline bool AppearanceFlags::bottom() const { - // @@protoc_insertion_point(field_get:Canary.protobuf.appearances.AppearanceFlags.bottom) - return _internal_bottom(); -} -inline void AppearanceFlags::_internal_set_bottom(bool value) { - _impl_._has_bits_[0] |= 0x00010000u; - _impl_.bottom_ = value; -} -inline void AppearanceFlags::set_bottom(bool value) { - _internal_set_bottom(value); - // @@protoc_insertion_point(field_set:Canary.protobuf.appearances.AppearanceFlags.bottom) -} - -// optional bool top = 4; -inline bool AppearanceFlags::_internal_has_top() const { - bool value = (_impl_._has_bits_[0] & 0x00020000u) != 0; - return value; -} -inline bool AppearanceFlags::has_top() const { - return _internal_has_top(); -} -inline void AppearanceFlags::clear_top() { - _impl_.top_ = false; - _impl_._has_bits_[0] &= ~0x00020000u; -} -inline bool AppearanceFlags::_internal_top() const { - return _impl_.top_; -} -inline bool AppearanceFlags::top() const { - // @@protoc_insertion_point(field_get:Canary.protobuf.appearances.AppearanceFlags.top) - return _internal_top(); -} -inline void AppearanceFlags::_internal_set_top(bool value) { - _impl_._has_bits_[0] |= 0x00020000u; - _impl_.top_ = value; -} -inline void AppearanceFlags::set_top(bool value) { - _internal_set_top(value); - // @@protoc_insertion_point(field_set:Canary.protobuf.appearances.AppearanceFlags.top) -} - -// optional bool container = 5; -inline bool AppearanceFlags::_internal_has_container() const { - bool value = (_impl_._has_bits_[0] & 0x00040000u) != 0; - return value; -} -inline bool AppearanceFlags::has_container() const { - return _internal_has_container(); -} -inline void AppearanceFlags::clear_container() { - _impl_.container_ = false; - _impl_._has_bits_[0] &= ~0x00040000u; -} -inline bool AppearanceFlags::_internal_container() const { - return _impl_.container_; -} -inline bool AppearanceFlags::container() const { - // @@protoc_insertion_point(field_get:Canary.protobuf.appearances.AppearanceFlags.container) - return _internal_container(); -} -inline void AppearanceFlags::_internal_set_container(bool value) { - _impl_._has_bits_[0] |= 0x00040000u; - _impl_.container_ = value; -} -inline void AppearanceFlags::set_container(bool value) { - _internal_set_container(value); - // @@protoc_insertion_point(field_set:Canary.protobuf.appearances.AppearanceFlags.container) -} - -// optional bool cumulative = 6; -inline bool AppearanceFlags::_internal_has_cumulative() const { - bool value = (_impl_._has_bits_[0] & 0x00080000u) != 0; - return value; -} -inline bool AppearanceFlags::has_cumulative() const { - return _internal_has_cumulative(); -} -inline void AppearanceFlags::clear_cumulative() { - _impl_.cumulative_ = false; - _impl_._has_bits_[0] &= ~0x00080000u; -} -inline bool AppearanceFlags::_internal_cumulative() const { - return _impl_.cumulative_; -} -inline bool AppearanceFlags::cumulative() const { - // @@protoc_insertion_point(field_get:Canary.protobuf.appearances.AppearanceFlags.cumulative) - return _internal_cumulative(); -} -inline void AppearanceFlags::_internal_set_cumulative(bool value) { - _impl_._has_bits_[0] |= 0x00080000u; - _impl_.cumulative_ = value; -} -inline void AppearanceFlags::set_cumulative(bool value) { - _internal_set_cumulative(value); - // @@protoc_insertion_point(field_set:Canary.protobuf.appearances.AppearanceFlags.cumulative) -} - -// optional bool usable = 7; -inline bool AppearanceFlags::_internal_has_usable() const { - bool value = (_impl_._has_bits_[0] & 0x00100000u) != 0; - return value; -} -inline bool AppearanceFlags::has_usable() const { - return _internal_has_usable(); -} -inline void AppearanceFlags::clear_usable() { - _impl_.usable_ = false; - _impl_._has_bits_[0] &= ~0x00100000u; -} -inline bool AppearanceFlags::_internal_usable() const { - return _impl_.usable_; -} -inline bool AppearanceFlags::usable() const { - // @@protoc_insertion_point(field_get:Canary.protobuf.appearances.AppearanceFlags.usable) - return _internal_usable(); -} -inline void AppearanceFlags::_internal_set_usable(bool value) { - _impl_._has_bits_[0] |= 0x00100000u; - _impl_.usable_ = value; -} -inline void AppearanceFlags::set_usable(bool value) { - _internal_set_usable(value); - // @@protoc_insertion_point(field_set:Canary.protobuf.appearances.AppearanceFlags.usable) -} - -// optional bool forceuse = 8; -inline bool AppearanceFlags::_internal_has_forceuse() const { - bool value = (_impl_._has_bits_[0] & 0x00200000u) != 0; - return value; -} -inline bool AppearanceFlags::has_forceuse() const { - return _internal_has_forceuse(); -} -inline void AppearanceFlags::clear_forceuse() { - _impl_.forceuse_ = false; - _impl_._has_bits_[0] &= ~0x00200000u; -} -inline bool AppearanceFlags::_internal_forceuse() const { - return _impl_.forceuse_; -} -inline bool AppearanceFlags::forceuse() const { - // @@protoc_insertion_point(field_get:Canary.protobuf.appearances.AppearanceFlags.forceuse) - return _internal_forceuse(); -} -inline void AppearanceFlags::_internal_set_forceuse(bool value) { - _impl_._has_bits_[0] |= 0x00200000u; - _impl_.forceuse_ = value; -} -inline void AppearanceFlags::set_forceuse(bool value) { - _internal_set_forceuse(value); - // @@protoc_insertion_point(field_set:Canary.protobuf.appearances.AppearanceFlags.forceuse) -} - -// optional bool multiuse = 9; -inline bool AppearanceFlags::_internal_has_multiuse() const { - bool value = (_impl_._has_bits_[0] & 0x00400000u) != 0; - return value; -} -inline bool AppearanceFlags::has_multiuse() const { - return _internal_has_multiuse(); -} -inline void AppearanceFlags::clear_multiuse() { - _impl_.multiuse_ = false; - _impl_._has_bits_[0] &= ~0x00400000u; -} -inline bool AppearanceFlags::_internal_multiuse() const { - return _impl_.multiuse_; -} -inline bool AppearanceFlags::multiuse() const { - // @@protoc_insertion_point(field_get:Canary.protobuf.appearances.AppearanceFlags.multiuse) - return _internal_multiuse(); -} -inline void AppearanceFlags::_internal_set_multiuse(bool value) { - _impl_._has_bits_[0] |= 0x00400000u; - _impl_.multiuse_ = value; -} -inline void AppearanceFlags::set_multiuse(bool value) { - _internal_set_multiuse(value); - // @@protoc_insertion_point(field_set:Canary.protobuf.appearances.AppearanceFlags.multiuse) -} - -// optional .Canary.protobuf.appearances.AppearanceFlagWrite write = 10; -inline bool AppearanceFlags::_internal_has_write() const { - bool value = (_impl_._has_bits_[0] & 0x00000002u) != 0; - PROTOBUF_ASSUME(!value || _impl_.write_ != nullptr); - return value; -} -inline bool AppearanceFlags::has_write() const { - return _internal_has_write(); -} -inline void AppearanceFlags::clear_write() { - if (_impl_.write_ != nullptr) _impl_.write_->Clear(); - _impl_._has_bits_[0] &= ~0x00000002u; -} -inline const ::Canary::protobuf::appearances::AppearanceFlagWrite& AppearanceFlags::_internal_write() const { - const ::Canary::protobuf::appearances::AppearanceFlagWrite* p = _impl_.write_; - return p != nullptr ? *p : reinterpret_cast( - ::Canary::protobuf::appearances::_AppearanceFlagWrite_default_instance_); -} -inline const ::Canary::protobuf::appearances::AppearanceFlagWrite& AppearanceFlags::write() const { - // @@protoc_insertion_point(field_get:Canary.protobuf.appearances.AppearanceFlags.write) - return _internal_write(); -} -inline void AppearanceFlags::unsafe_arena_set_allocated_write( - ::Canary::protobuf::appearances::AppearanceFlagWrite* write) { - if (GetArenaForAllocation() == nullptr) { - delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(_impl_.write_); - } - _impl_.write_ = write; - if (write) { - _impl_._has_bits_[0] |= 0x00000002u; - } else { - _impl_._has_bits_[0] &= ~0x00000002u; - } - // @@protoc_insertion_point(field_unsafe_arena_set_allocated:Canary.protobuf.appearances.AppearanceFlags.write) -} -inline ::Canary::protobuf::appearances::AppearanceFlagWrite* AppearanceFlags::release_write() { - _impl_._has_bits_[0] &= ~0x00000002u; - ::Canary::protobuf::appearances::AppearanceFlagWrite* temp = _impl_.write_; - _impl_.write_ = nullptr; -#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE - auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); - temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); - if (GetArenaForAllocation() == nullptr) { delete old; } -#else // PROTOBUF_FORCE_COPY_IN_RELEASE - if (GetArenaForAllocation() != nullptr) { - temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); - } -#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE - return temp; -} -inline ::Canary::protobuf::appearances::AppearanceFlagWrite* AppearanceFlags::unsafe_arena_release_write() { - // @@protoc_insertion_point(field_release:Canary.protobuf.appearances.AppearanceFlags.write) - _impl_._has_bits_[0] &= ~0x00000002u; - ::Canary::protobuf::appearances::AppearanceFlagWrite* temp = _impl_.write_; - _impl_.write_ = nullptr; - return temp; -} -inline ::Canary::protobuf::appearances::AppearanceFlagWrite* AppearanceFlags::_internal_mutable_write() { - _impl_._has_bits_[0] |= 0x00000002u; - if (_impl_.write_ == nullptr) { - auto* p = CreateMaybeMessage<::Canary::protobuf::appearances::AppearanceFlagWrite>(GetArenaForAllocation()); - _impl_.write_ = p; - } - return _impl_.write_; -} -inline ::Canary::protobuf::appearances::AppearanceFlagWrite* AppearanceFlags::mutable_write() { - ::Canary::protobuf::appearances::AppearanceFlagWrite* _msg = _internal_mutable_write(); - // @@protoc_insertion_point(field_mutable:Canary.protobuf.appearances.AppearanceFlags.write) - return _msg; -} -inline void AppearanceFlags::set_allocated_write(::Canary::protobuf::appearances::AppearanceFlagWrite* write) { - ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); - if (message_arena == nullptr) { - delete _impl_.write_; - } - if (write) { - ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = - ::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena(write); - if (message_arena != submessage_arena) { - write = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( - message_arena, write, submessage_arena); - } - _impl_._has_bits_[0] |= 0x00000002u; - } else { - _impl_._has_bits_[0] &= ~0x00000002u; - } - _impl_.write_ = write; - // @@protoc_insertion_point(field_set_allocated:Canary.protobuf.appearances.AppearanceFlags.write) -} - -// optional .Canary.protobuf.appearances.AppearanceFlagWriteOnce write_once = 11; -inline bool AppearanceFlags::_internal_has_write_once() const { - bool value = (_impl_._has_bits_[0] & 0x00000004u) != 0; - PROTOBUF_ASSUME(!value || _impl_.write_once_ != nullptr); - return value; -} -inline bool AppearanceFlags::has_write_once() const { - return _internal_has_write_once(); -} -inline void AppearanceFlags::clear_write_once() { - if (_impl_.write_once_ != nullptr) _impl_.write_once_->Clear(); - _impl_._has_bits_[0] &= ~0x00000004u; -} -inline const ::Canary::protobuf::appearances::AppearanceFlagWriteOnce& AppearanceFlags::_internal_write_once() const { - const ::Canary::protobuf::appearances::AppearanceFlagWriteOnce* p = _impl_.write_once_; - return p != nullptr ? *p : reinterpret_cast( - ::Canary::protobuf::appearances::_AppearanceFlagWriteOnce_default_instance_); -} -inline const ::Canary::protobuf::appearances::AppearanceFlagWriteOnce& AppearanceFlags::write_once() const { - // @@protoc_insertion_point(field_get:Canary.protobuf.appearances.AppearanceFlags.write_once) - return _internal_write_once(); -} -inline void AppearanceFlags::unsafe_arena_set_allocated_write_once( - ::Canary::protobuf::appearances::AppearanceFlagWriteOnce* write_once) { - if (GetArenaForAllocation() == nullptr) { - delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(_impl_.write_once_); - } - _impl_.write_once_ = write_once; - if (write_once) { - _impl_._has_bits_[0] |= 0x00000004u; - } else { - _impl_._has_bits_[0] &= ~0x00000004u; - } - // @@protoc_insertion_point(field_unsafe_arena_set_allocated:Canary.protobuf.appearances.AppearanceFlags.write_once) -} -inline ::Canary::protobuf::appearances::AppearanceFlagWriteOnce* AppearanceFlags::release_write_once() { - _impl_._has_bits_[0] &= ~0x00000004u; - ::Canary::protobuf::appearances::AppearanceFlagWriteOnce* temp = _impl_.write_once_; - _impl_.write_once_ = nullptr; -#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE - auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); - temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); - if (GetArenaForAllocation() == nullptr) { delete old; } -#else // PROTOBUF_FORCE_COPY_IN_RELEASE - if (GetArenaForAllocation() != nullptr) { - temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); - } -#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE - return temp; -} -inline ::Canary::protobuf::appearances::AppearanceFlagWriteOnce* AppearanceFlags::unsafe_arena_release_write_once() { - // @@protoc_insertion_point(field_release:Canary.protobuf.appearances.AppearanceFlags.write_once) - _impl_._has_bits_[0] &= ~0x00000004u; - ::Canary::protobuf::appearances::AppearanceFlagWriteOnce* temp = _impl_.write_once_; - _impl_.write_once_ = nullptr; - return temp; -} -inline ::Canary::protobuf::appearances::AppearanceFlagWriteOnce* AppearanceFlags::_internal_mutable_write_once() { - _impl_._has_bits_[0] |= 0x00000004u; - if (_impl_.write_once_ == nullptr) { - auto* p = CreateMaybeMessage<::Canary::protobuf::appearances::AppearanceFlagWriteOnce>(GetArenaForAllocation()); - _impl_.write_once_ = p; - } - return _impl_.write_once_; -} -inline ::Canary::protobuf::appearances::AppearanceFlagWriteOnce* AppearanceFlags::mutable_write_once() { - ::Canary::protobuf::appearances::AppearanceFlagWriteOnce* _msg = _internal_mutable_write_once(); - // @@protoc_insertion_point(field_mutable:Canary.protobuf.appearances.AppearanceFlags.write_once) - return _msg; -} -inline void AppearanceFlags::set_allocated_write_once(::Canary::protobuf::appearances::AppearanceFlagWriteOnce* write_once) { - ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); - if (message_arena == nullptr) { - delete _impl_.write_once_; - } - if (write_once) { - ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = - ::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena(write_once); - if (message_arena != submessage_arena) { - write_once = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( - message_arena, write_once, submessage_arena); - } - _impl_._has_bits_[0] |= 0x00000004u; - } else { - _impl_._has_bits_[0] &= ~0x00000004u; - } - _impl_.write_once_ = write_once; - // @@protoc_insertion_point(field_set_allocated:Canary.protobuf.appearances.AppearanceFlags.write_once) -} - -// optional bool liquidpool = 12; -inline bool AppearanceFlags::_internal_has_liquidpool() const { - bool value = (_impl_._has_bits_[0] & 0x00800000u) != 0; - return value; -} -inline bool AppearanceFlags::has_liquidpool() const { - return _internal_has_liquidpool(); -} -inline void AppearanceFlags::clear_liquidpool() { - _impl_.liquidpool_ = false; - _impl_._has_bits_[0] &= ~0x00800000u; -} -inline bool AppearanceFlags::_internal_liquidpool() const { - return _impl_.liquidpool_; -} -inline bool AppearanceFlags::liquidpool() const { - // @@protoc_insertion_point(field_get:Canary.protobuf.appearances.AppearanceFlags.liquidpool) - return _internal_liquidpool(); -} -inline void AppearanceFlags::_internal_set_liquidpool(bool value) { - _impl_._has_bits_[0] |= 0x00800000u; - _impl_.liquidpool_ = value; -} -inline void AppearanceFlags::set_liquidpool(bool value) { - _internal_set_liquidpool(value); - // @@protoc_insertion_point(field_set:Canary.protobuf.appearances.AppearanceFlags.liquidpool) -} - -// optional bool unpass = 13; -inline bool AppearanceFlags::_internal_has_unpass() const { - bool value = (_impl_._has_bits_[0] & 0x01000000u) != 0; - return value; -} -inline bool AppearanceFlags::has_unpass() const { - return _internal_has_unpass(); -} -inline void AppearanceFlags::clear_unpass() { - _impl_.unpass_ = false; - _impl_._has_bits_[0] &= ~0x01000000u; -} -inline bool AppearanceFlags::_internal_unpass() const { - return _impl_.unpass_; -} -inline bool AppearanceFlags::unpass() const { - // @@protoc_insertion_point(field_get:Canary.protobuf.appearances.AppearanceFlags.unpass) - return _internal_unpass(); -} -inline void AppearanceFlags::_internal_set_unpass(bool value) { - _impl_._has_bits_[0] |= 0x01000000u; - _impl_.unpass_ = value; -} -inline void AppearanceFlags::set_unpass(bool value) { - _internal_set_unpass(value); - // @@protoc_insertion_point(field_set:Canary.protobuf.appearances.AppearanceFlags.unpass) -} - -// optional bool unmove = 14; -inline bool AppearanceFlags::_internal_has_unmove() const { - bool value = (_impl_._has_bits_[0] & 0x02000000u) != 0; - return value; -} -inline bool AppearanceFlags::has_unmove() const { - return _internal_has_unmove(); -} -inline void AppearanceFlags::clear_unmove() { - _impl_.unmove_ = false; - _impl_._has_bits_[0] &= ~0x02000000u; -} -inline bool AppearanceFlags::_internal_unmove() const { - return _impl_.unmove_; -} -inline bool AppearanceFlags::unmove() const { - // @@protoc_insertion_point(field_get:Canary.protobuf.appearances.AppearanceFlags.unmove) - return _internal_unmove(); -} -inline void AppearanceFlags::_internal_set_unmove(bool value) { - _impl_._has_bits_[0] |= 0x02000000u; - _impl_.unmove_ = value; -} -inline void AppearanceFlags::set_unmove(bool value) { - _internal_set_unmove(value); - // @@protoc_insertion_point(field_set:Canary.protobuf.appearances.AppearanceFlags.unmove) -} - -// optional bool unsight = 15; -inline bool AppearanceFlags::_internal_has_unsight() const { - bool value = (_impl_._has_bits_[0] & 0x04000000u) != 0; - return value; -} -inline bool AppearanceFlags::has_unsight() const { - return _internal_has_unsight(); -} -inline void AppearanceFlags::clear_unsight() { - _impl_.unsight_ = false; - _impl_._has_bits_[0] &= ~0x04000000u; -} -inline bool AppearanceFlags::_internal_unsight() const { - return _impl_.unsight_; -} -inline bool AppearanceFlags::unsight() const { - // @@protoc_insertion_point(field_get:Canary.protobuf.appearances.AppearanceFlags.unsight) - return _internal_unsight(); -} -inline void AppearanceFlags::_internal_set_unsight(bool value) { - _impl_._has_bits_[0] |= 0x04000000u; - _impl_.unsight_ = value; -} -inline void AppearanceFlags::set_unsight(bool value) { - _internal_set_unsight(value); - // @@protoc_insertion_point(field_set:Canary.protobuf.appearances.AppearanceFlags.unsight) -} - -// optional bool avoid = 16; -inline bool AppearanceFlags::_internal_has_avoid() const { - bool value = (_impl_._has_bits_[0] & 0x08000000u) != 0; - return value; -} -inline bool AppearanceFlags::has_avoid() const { - return _internal_has_avoid(); -} -inline void AppearanceFlags::clear_avoid() { - _impl_.avoid_ = false; - _impl_._has_bits_[0] &= ~0x08000000u; -} -inline bool AppearanceFlags::_internal_avoid() const { - return _impl_.avoid_; -} -inline bool AppearanceFlags::avoid() const { - // @@protoc_insertion_point(field_get:Canary.protobuf.appearances.AppearanceFlags.avoid) - return _internal_avoid(); -} -inline void AppearanceFlags::_internal_set_avoid(bool value) { - _impl_._has_bits_[0] |= 0x08000000u; - _impl_.avoid_ = value; -} -inline void AppearanceFlags::set_avoid(bool value) { - _internal_set_avoid(value); - // @@protoc_insertion_point(field_set:Canary.protobuf.appearances.AppearanceFlags.avoid) -} - -// optional bool no_movement_animation = 17; -inline bool AppearanceFlags::_internal_has_no_movement_animation() const { - bool value = (_impl_._has_bits_[0] & 0x10000000u) != 0; - return value; -} -inline bool AppearanceFlags::has_no_movement_animation() const { - return _internal_has_no_movement_animation(); -} -inline void AppearanceFlags::clear_no_movement_animation() { - _impl_.no_movement_animation_ = false; - _impl_._has_bits_[0] &= ~0x10000000u; -} -inline bool AppearanceFlags::_internal_no_movement_animation() const { - return _impl_.no_movement_animation_; -} -inline bool AppearanceFlags::no_movement_animation() const { - // @@protoc_insertion_point(field_get:Canary.protobuf.appearances.AppearanceFlags.no_movement_animation) - return _internal_no_movement_animation(); -} -inline void AppearanceFlags::_internal_set_no_movement_animation(bool value) { - _impl_._has_bits_[0] |= 0x10000000u; - _impl_.no_movement_animation_ = value; -} -inline void AppearanceFlags::set_no_movement_animation(bool value) { - _internal_set_no_movement_animation(value); - // @@protoc_insertion_point(field_set:Canary.protobuf.appearances.AppearanceFlags.no_movement_animation) -} - -// optional bool take = 18; -inline bool AppearanceFlags::_internal_has_take() const { - bool value = (_impl_._has_bits_[0] & 0x20000000u) != 0; - return value; -} -inline bool AppearanceFlags::has_take() const { - return _internal_has_take(); -} -inline void AppearanceFlags::clear_take() { - _impl_.take_ = false; - _impl_._has_bits_[0] &= ~0x20000000u; -} -inline bool AppearanceFlags::_internal_take() const { - return _impl_.take_; -} -inline bool AppearanceFlags::take() const { - // @@protoc_insertion_point(field_get:Canary.protobuf.appearances.AppearanceFlags.take) - return _internal_take(); -} -inline void AppearanceFlags::_internal_set_take(bool value) { - _impl_._has_bits_[0] |= 0x20000000u; - _impl_.take_ = value; -} -inline void AppearanceFlags::set_take(bool value) { - _internal_set_take(value); - // @@protoc_insertion_point(field_set:Canary.protobuf.appearances.AppearanceFlags.take) -} - -// optional bool liquidcontainer = 19; -inline bool AppearanceFlags::_internal_has_liquidcontainer() const { - bool value = (_impl_._has_bits_[0] & 0x40000000u) != 0; - return value; -} -inline bool AppearanceFlags::has_liquidcontainer() const { - return _internal_has_liquidcontainer(); -} -inline void AppearanceFlags::clear_liquidcontainer() { - _impl_.liquidcontainer_ = false; - _impl_._has_bits_[0] &= ~0x40000000u; -} -inline bool AppearanceFlags::_internal_liquidcontainer() const { - return _impl_.liquidcontainer_; -} -inline bool AppearanceFlags::liquidcontainer() const { - // @@protoc_insertion_point(field_get:Canary.protobuf.appearances.AppearanceFlags.liquidcontainer) - return _internal_liquidcontainer(); -} -inline void AppearanceFlags::_internal_set_liquidcontainer(bool value) { - _impl_._has_bits_[0] |= 0x40000000u; - _impl_.liquidcontainer_ = value; -} -inline void AppearanceFlags::set_liquidcontainer(bool value) { - _internal_set_liquidcontainer(value); - // @@protoc_insertion_point(field_set:Canary.protobuf.appearances.AppearanceFlags.liquidcontainer) -} - -// optional bool hang = 20; -inline bool AppearanceFlags::_internal_has_hang() const { - bool value = (_impl_._has_bits_[0] & 0x80000000u) != 0; - return value; -} -inline bool AppearanceFlags::has_hang() const { - return _internal_has_hang(); -} -inline void AppearanceFlags::clear_hang() { - _impl_.hang_ = false; - _impl_._has_bits_[0] &= ~0x80000000u; -} -inline bool AppearanceFlags::_internal_hang() const { - return _impl_.hang_; -} -inline bool AppearanceFlags::hang() const { - // @@protoc_insertion_point(field_get:Canary.protobuf.appearances.AppearanceFlags.hang) - return _internal_hang(); -} -inline void AppearanceFlags::_internal_set_hang(bool value) { - _impl_._has_bits_[0] |= 0x80000000u; - _impl_.hang_ = value; -} -inline void AppearanceFlags::set_hang(bool value) { - _internal_set_hang(value); - // @@protoc_insertion_point(field_set:Canary.protobuf.appearances.AppearanceFlags.hang) -} - -// optional .Canary.protobuf.appearances.AppearanceFlagHook hook = 21; -inline bool AppearanceFlags::_internal_has_hook() const { - bool value = (_impl_._has_bits_[0] & 0x00000008u) != 0; - PROTOBUF_ASSUME(!value || _impl_.hook_ != nullptr); - return value; -} -inline bool AppearanceFlags::has_hook() const { - return _internal_has_hook(); -} -inline void AppearanceFlags::clear_hook() { - if (_impl_.hook_ != nullptr) _impl_.hook_->Clear(); - _impl_._has_bits_[0] &= ~0x00000008u; -} -inline const ::Canary::protobuf::appearances::AppearanceFlagHook& AppearanceFlags::_internal_hook() const { - const ::Canary::protobuf::appearances::AppearanceFlagHook* p = _impl_.hook_; - return p != nullptr ? *p : reinterpret_cast( - ::Canary::protobuf::appearances::_AppearanceFlagHook_default_instance_); -} -inline const ::Canary::protobuf::appearances::AppearanceFlagHook& AppearanceFlags::hook() const { - // @@protoc_insertion_point(field_get:Canary.protobuf.appearances.AppearanceFlags.hook) - return _internal_hook(); -} -inline void AppearanceFlags::unsafe_arena_set_allocated_hook( - ::Canary::protobuf::appearances::AppearanceFlagHook* hook) { - if (GetArenaForAllocation() == nullptr) { - delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(_impl_.hook_); - } - _impl_.hook_ = hook; - if (hook) { - _impl_._has_bits_[0] |= 0x00000008u; - } else { - _impl_._has_bits_[0] &= ~0x00000008u; - } - // @@protoc_insertion_point(field_unsafe_arena_set_allocated:Canary.protobuf.appearances.AppearanceFlags.hook) -} -inline ::Canary::protobuf::appearances::AppearanceFlagHook* AppearanceFlags::release_hook() { - _impl_._has_bits_[0] &= ~0x00000008u; - ::Canary::protobuf::appearances::AppearanceFlagHook* temp = _impl_.hook_; - _impl_.hook_ = nullptr; -#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE - auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); - temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); - if (GetArenaForAllocation() == nullptr) { delete old; } -#else // PROTOBUF_FORCE_COPY_IN_RELEASE - if (GetArenaForAllocation() != nullptr) { - temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); - } -#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE - return temp; -} -inline ::Canary::protobuf::appearances::AppearanceFlagHook* AppearanceFlags::unsafe_arena_release_hook() { - // @@protoc_insertion_point(field_release:Canary.protobuf.appearances.AppearanceFlags.hook) - _impl_._has_bits_[0] &= ~0x00000008u; - ::Canary::protobuf::appearances::AppearanceFlagHook* temp = _impl_.hook_; - _impl_.hook_ = nullptr; - return temp; -} -inline ::Canary::protobuf::appearances::AppearanceFlagHook* AppearanceFlags::_internal_mutable_hook() { - _impl_._has_bits_[0] |= 0x00000008u; - if (_impl_.hook_ == nullptr) { - auto* p = CreateMaybeMessage<::Canary::protobuf::appearances::AppearanceFlagHook>(GetArenaForAllocation()); - _impl_.hook_ = p; - } - return _impl_.hook_; -} -inline ::Canary::protobuf::appearances::AppearanceFlagHook* AppearanceFlags::mutable_hook() { - ::Canary::protobuf::appearances::AppearanceFlagHook* _msg = _internal_mutable_hook(); - // @@protoc_insertion_point(field_mutable:Canary.protobuf.appearances.AppearanceFlags.hook) - return _msg; -} -inline void AppearanceFlags::set_allocated_hook(::Canary::protobuf::appearances::AppearanceFlagHook* hook) { - ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); - if (message_arena == nullptr) { - delete _impl_.hook_; - } - if (hook) { - ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = - ::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena(hook); - if (message_arena != submessage_arena) { - hook = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( - message_arena, hook, submessage_arena); - } - _impl_._has_bits_[0] |= 0x00000008u; - } else { - _impl_._has_bits_[0] &= ~0x00000008u; - } - _impl_.hook_ = hook; - // @@protoc_insertion_point(field_set_allocated:Canary.protobuf.appearances.AppearanceFlags.hook) -} - -// optional bool rotate = 22; -inline bool AppearanceFlags::_internal_has_rotate() const { - bool value = (_impl_._has_bits_[1] & 0x00000001u) != 0; - return value; -} -inline bool AppearanceFlags::has_rotate() const { - return _internal_has_rotate(); -} -inline void AppearanceFlags::clear_rotate() { - _impl_.rotate_ = false; - _impl_._has_bits_[1] &= ~0x00000001u; -} -inline bool AppearanceFlags::_internal_rotate() const { - return _impl_.rotate_; -} -inline bool AppearanceFlags::rotate() const { - // @@protoc_insertion_point(field_get:Canary.protobuf.appearances.AppearanceFlags.rotate) - return _internal_rotate(); -} -inline void AppearanceFlags::_internal_set_rotate(bool value) { - _impl_._has_bits_[1] |= 0x00000001u; - _impl_.rotate_ = value; -} -inline void AppearanceFlags::set_rotate(bool value) { - _internal_set_rotate(value); - // @@protoc_insertion_point(field_set:Canary.protobuf.appearances.AppearanceFlags.rotate) -} - -// optional .Canary.protobuf.appearances.AppearanceFlagLight light = 23; -inline bool AppearanceFlags::_internal_has_light() const { - bool value = (_impl_._has_bits_[0] & 0x00000010u) != 0; - PROTOBUF_ASSUME(!value || _impl_.light_ != nullptr); - return value; -} -inline bool AppearanceFlags::has_light() const { - return _internal_has_light(); -} -inline void AppearanceFlags::clear_light() { - if (_impl_.light_ != nullptr) _impl_.light_->Clear(); - _impl_._has_bits_[0] &= ~0x00000010u; -} -inline const ::Canary::protobuf::appearances::AppearanceFlagLight& AppearanceFlags::_internal_light() const { - const ::Canary::protobuf::appearances::AppearanceFlagLight* p = _impl_.light_; - return p != nullptr ? *p : reinterpret_cast( - ::Canary::protobuf::appearances::_AppearanceFlagLight_default_instance_); -} -inline const ::Canary::protobuf::appearances::AppearanceFlagLight& AppearanceFlags::light() const { - // @@protoc_insertion_point(field_get:Canary.protobuf.appearances.AppearanceFlags.light) - return _internal_light(); -} -inline void AppearanceFlags::unsafe_arena_set_allocated_light( - ::Canary::protobuf::appearances::AppearanceFlagLight* light) { - if (GetArenaForAllocation() == nullptr) { - delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(_impl_.light_); - } - _impl_.light_ = light; - if (light) { - _impl_._has_bits_[0] |= 0x00000010u; - } else { - _impl_._has_bits_[0] &= ~0x00000010u; - } - // @@protoc_insertion_point(field_unsafe_arena_set_allocated:Canary.protobuf.appearances.AppearanceFlags.light) -} -inline ::Canary::protobuf::appearances::AppearanceFlagLight* AppearanceFlags::release_light() { - _impl_._has_bits_[0] &= ~0x00000010u; - ::Canary::protobuf::appearances::AppearanceFlagLight* temp = _impl_.light_; - _impl_.light_ = nullptr; -#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE - auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); - temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); - if (GetArenaForAllocation() == nullptr) { delete old; } -#else // PROTOBUF_FORCE_COPY_IN_RELEASE - if (GetArenaForAllocation() != nullptr) { - temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); - } -#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE - return temp; -} -inline ::Canary::protobuf::appearances::AppearanceFlagLight* AppearanceFlags::unsafe_arena_release_light() { - // @@protoc_insertion_point(field_release:Canary.protobuf.appearances.AppearanceFlags.light) - _impl_._has_bits_[0] &= ~0x00000010u; - ::Canary::protobuf::appearances::AppearanceFlagLight* temp = _impl_.light_; - _impl_.light_ = nullptr; - return temp; -} -inline ::Canary::protobuf::appearances::AppearanceFlagLight* AppearanceFlags::_internal_mutable_light() { - _impl_._has_bits_[0] |= 0x00000010u; - if (_impl_.light_ == nullptr) { - auto* p = CreateMaybeMessage<::Canary::protobuf::appearances::AppearanceFlagLight>(GetArenaForAllocation()); - _impl_.light_ = p; - } - return _impl_.light_; -} -inline ::Canary::protobuf::appearances::AppearanceFlagLight* AppearanceFlags::mutable_light() { - ::Canary::protobuf::appearances::AppearanceFlagLight* _msg = _internal_mutable_light(); - // @@protoc_insertion_point(field_mutable:Canary.protobuf.appearances.AppearanceFlags.light) - return _msg; -} -inline void AppearanceFlags::set_allocated_light(::Canary::protobuf::appearances::AppearanceFlagLight* light) { - ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); - if (message_arena == nullptr) { - delete _impl_.light_; - } - if (light) { - ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = - ::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena(light); - if (message_arena != submessage_arena) { - light = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( - message_arena, light, submessage_arena); - } - _impl_._has_bits_[0] |= 0x00000010u; - } else { - _impl_._has_bits_[0] &= ~0x00000010u; - } - _impl_.light_ = light; - // @@protoc_insertion_point(field_set_allocated:Canary.protobuf.appearances.AppearanceFlags.light) -} - -// optional bool dont_hide = 24; -inline bool AppearanceFlags::_internal_has_dont_hide() const { - bool value = (_impl_._has_bits_[1] & 0x00000002u) != 0; - return value; -} -inline bool AppearanceFlags::has_dont_hide() const { - return _internal_has_dont_hide(); -} -inline void AppearanceFlags::clear_dont_hide() { - _impl_.dont_hide_ = false; - _impl_._has_bits_[1] &= ~0x00000002u; -} -inline bool AppearanceFlags::_internal_dont_hide() const { - return _impl_.dont_hide_; -} -inline bool AppearanceFlags::dont_hide() const { - // @@protoc_insertion_point(field_get:Canary.protobuf.appearances.AppearanceFlags.dont_hide) - return _internal_dont_hide(); -} -inline void AppearanceFlags::_internal_set_dont_hide(bool value) { - _impl_._has_bits_[1] |= 0x00000002u; - _impl_.dont_hide_ = value; -} -inline void AppearanceFlags::set_dont_hide(bool value) { - _internal_set_dont_hide(value); - // @@protoc_insertion_point(field_set:Canary.protobuf.appearances.AppearanceFlags.dont_hide) -} - -// optional bool translucent = 25; -inline bool AppearanceFlags::_internal_has_translucent() const { - bool value = (_impl_._has_bits_[1] & 0x00000004u) != 0; - return value; -} -inline bool AppearanceFlags::has_translucent() const { - return _internal_has_translucent(); -} -inline void AppearanceFlags::clear_translucent() { - _impl_.translucent_ = false; - _impl_._has_bits_[1] &= ~0x00000004u; -} -inline bool AppearanceFlags::_internal_translucent() const { - return _impl_.translucent_; -} -inline bool AppearanceFlags::translucent() const { - // @@protoc_insertion_point(field_get:Canary.protobuf.appearances.AppearanceFlags.translucent) - return _internal_translucent(); -} -inline void AppearanceFlags::_internal_set_translucent(bool value) { - _impl_._has_bits_[1] |= 0x00000004u; - _impl_.translucent_ = value; -} -inline void AppearanceFlags::set_translucent(bool value) { - _internal_set_translucent(value); - // @@protoc_insertion_point(field_set:Canary.protobuf.appearances.AppearanceFlags.translucent) -} - -// optional .Canary.protobuf.appearances.AppearanceFlagShift shift = 26; -inline bool AppearanceFlags::_internal_has_shift() const { - bool value = (_impl_._has_bits_[0] & 0x00000020u) != 0; - PROTOBUF_ASSUME(!value || _impl_.shift_ != nullptr); - return value; -} -inline bool AppearanceFlags::has_shift() const { - return _internal_has_shift(); -} -inline void AppearanceFlags::clear_shift() { - if (_impl_.shift_ != nullptr) _impl_.shift_->Clear(); - _impl_._has_bits_[0] &= ~0x00000020u; -} -inline const ::Canary::protobuf::appearances::AppearanceFlagShift& AppearanceFlags::_internal_shift() const { - const ::Canary::protobuf::appearances::AppearanceFlagShift* p = _impl_.shift_; - return p != nullptr ? *p : reinterpret_cast( - ::Canary::protobuf::appearances::_AppearanceFlagShift_default_instance_); -} -inline const ::Canary::protobuf::appearances::AppearanceFlagShift& AppearanceFlags::shift() const { - // @@protoc_insertion_point(field_get:Canary.protobuf.appearances.AppearanceFlags.shift) - return _internal_shift(); -} -inline void AppearanceFlags::unsafe_arena_set_allocated_shift( - ::Canary::protobuf::appearances::AppearanceFlagShift* shift) { - if (GetArenaForAllocation() == nullptr) { - delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(_impl_.shift_); - } - _impl_.shift_ = shift; - if (shift) { - _impl_._has_bits_[0] |= 0x00000020u; - } else { - _impl_._has_bits_[0] &= ~0x00000020u; - } - // @@protoc_insertion_point(field_unsafe_arena_set_allocated:Canary.protobuf.appearances.AppearanceFlags.shift) -} -inline ::Canary::protobuf::appearances::AppearanceFlagShift* AppearanceFlags::release_shift() { - _impl_._has_bits_[0] &= ~0x00000020u; - ::Canary::protobuf::appearances::AppearanceFlagShift* temp = _impl_.shift_; - _impl_.shift_ = nullptr; -#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE - auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); - temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); - if (GetArenaForAllocation() == nullptr) { delete old; } -#else // PROTOBUF_FORCE_COPY_IN_RELEASE - if (GetArenaForAllocation() != nullptr) { - temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); - } -#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE - return temp; -} -inline ::Canary::protobuf::appearances::AppearanceFlagShift* AppearanceFlags::unsafe_arena_release_shift() { - // @@protoc_insertion_point(field_release:Canary.protobuf.appearances.AppearanceFlags.shift) - _impl_._has_bits_[0] &= ~0x00000020u; - ::Canary::protobuf::appearances::AppearanceFlagShift* temp = _impl_.shift_; - _impl_.shift_ = nullptr; - return temp; -} -inline ::Canary::protobuf::appearances::AppearanceFlagShift* AppearanceFlags::_internal_mutable_shift() { - _impl_._has_bits_[0] |= 0x00000020u; - if (_impl_.shift_ == nullptr) { - auto* p = CreateMaybeMessage<::Canary::protobuf::appearances::AppearanceFlagShift>(GetArenaForAllocation()); - _impl_.shift_ = p; - } - return _impl_.shift_; -} -inline ::Canary::protobuf::appearances::AppearanceFlagShift* AppearanceFlags::mutable_shift() { - ::Canary::protobuf::appearances::AppearanceFlagShift* _msg = _internal_mutable_shift(); - // @@protoc_insertion_point(field_mutable:Canary.protobuf.appearances.AppearanceFlags.shift) - return _msg; -} -inline void AppearanceFlags::set_allocated_shift(::Canary::protobuf::appearances::AppearanceFlagShift* shift) { - ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); - if (message_arena == nullptr) { - delete _impl_.shift_; - } - if (shift) { - ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = - ::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena(shift); - if (message_arena != submessage_arena) { - shift = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( - message_arena, shift, submessage_arena); - } - _impl_._has_bits_[0] |= 0x00000020u; - } else { - _impl_._has_bits_[0] &= ~0x00000020u; - } - _impl_.shift_ = shift; - // @@protoc_insertion_point(field_set_allocated:Canary.protobuf.appearances.AppearanceFlags.shift) -} - -// optional .Canary.protobuf.appearances.AppearanceFlagHeight height = 27; -inline bool AppearanceFlags::_internal_has_height() const { - bool value = (_impl_._has_bits_[0] & 0x00000040u) != 0; - PROTOBUF_ASSUME(!value || _impl_.height_ != nullptr); - return value; -} -inline bool AppearanceFlags::has_height() const { - return _internal_has_height(); -} -inline void AppearanceFlags::clear_height() { - if (_impl_.height_ != nullptr) _impl_.height_->Clear(); - _impl_._has_bits_[0] &= ~0x00000040u; -} -inline const ::Canary::protobuf::appearances::AppearanceFlagHeight& AppearanceFlags::_internal_height() const { - const ::Canary::protobuf::appearances::AppearanceFlagHeight* p = _impl_.height_; - return p != nullptr ? *p : reinterpret_cast( - ::Canary::protobuf::appearances::_AppearanceFlagHeight_default_instance_); -} -inline const ::Canary::protobuf::appearances::AppearanceFlagHeight& AppearanceFlags::height() const { - // @@protoc_insertion_point(field_get:Canary.protobuf.appearances.AppearanceFlags.height) - return _internal_height(); -} -inline void AppearanceFlags::unsafe_arena_set_allocated_height( - ::Canary::protobuf::appearances::AppearanceFlagHeight* height) { - if (GetArenaForAllocation() == nullptr) { - delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(_impl_.height_); - } - _impl_.height_ = height; - if (height) { - _impl_._has_bits_[0] |= 0x00000040u; - } else { - _impl_._has_bits_[0] &= ~0x00000040u; - } - // @@protoc_insertion_point(field_unsafe_arena_set_allocated:Canary.protobuf.appearances.AppearanceFlags.height) -} -inline ::Canary::protobuf::appearances::AppearanceFlagHeight* AppearanceFlags::release_height() { - _impl_._has_bits_[0] &= ~0x00000040u; - ::Canary::protobuf::appearances::AppearanceFlagHeight* temp = _impl_.height_; - _impl_.height_ = nullptr; -#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE - auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); - temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); - if (GetArenaForAllocation() == nullptr) { delete old; } -#else // PROTOBUF_FORCE_COPY_IN_RELEASE - if (GetArenaForAllocation() != nullptr) { - temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); - } -#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE - return temp; -} -inline ::Canary::protobuf::appearances::AppearanceFlagHeight* AppearanceFlags::unsafe_arena_release_height() { - // @@protoc_insertion_point(field_release:Canary.protobuf.appearances.AppearanceFlags.height) - _impl_._has_bits_[0] &= ~0x00000040u; - ::Canary::protobuf::appearances::AppearanceFlagHeight* temp = _impl_.height_; - _impl_.height_ = nullptr; - return temp; -} -inline ::Canary::protobuf::appearances::AppearanceFlagHeight* AppearanceFlags::_internal_mutable_height() { - _impl_._has_bits_[0] |= 0x00000040u; - if (_impl_.height_ == nullptr) { - auto* p = CreateMaybeMessage<::Canary::protobuf::appearances::AppearanceFlagHeight>(GetArenaForAllocation()); - _impl_.height_ = p; - } - return _impl_.height_; -} -inline ::Canary::protobuf::appearances::AppearanceFlagHeight* AppearanceFlags::mutable_height() { - ::Canary::protobuf::appearances::AppearanceFlagHeight* _msg = _internal_mutable_height(); - // @@protoc_insertion_point(field_mutable:Canary.protobuf.appearances.AppearanceFlags.height) - return _msg; -} -inline void AppearanceFlags::set_allocated_height(::Canary::protobuf::appearances::AppearanceFlagHeight* height) { - ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); - if (message_arena == nullptr) { - delete _impl_.height_; - } - if (height) { - ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = - ::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena(height); - if (message_arena != submessage_arena) { - height = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( - message_arena, height, submessage_arena); - } - _impl_._has_bits_[0] |= 0x00000040u; - } else { - _impl_._has_bits_[0] &= ~0x00000040u; - } - _impl_.height_ = height; - // @@protoc_insertion_point(field_set_allocated:Canary.protobuf.appearances.AppearanceFlags.height) -} - -// optional bool lying_object = 28; -inline bool AppearanceFlags::_internal_has_lying_object() const { - bool value = (_impl_._has_bits_[1] & 0x00000008u) != 0; - return value; -} -inline bool AppearanceFlags::has_lying_object() const { - return _internal_has_lying_object(); -} -inline void AppearanceFlags::clear_lying_object() { - _impl_.lying_object_ = false; - _impl_._has_bits_[1] &= ~0x00000008u; -} -inline bool AppearanceFlags::_internal_lying_object() const { - return _impl_.lying_object_; -} -inline bool AppearanceFlags::lying_object() const { - // @@protoc_insertion_point(field_get:Canary.protobuf.appearances.AppearanceFlags.lying_object) - return _internal_lying_object(); -} -inline void AppearanceFlags::_internal_set_lying_object(bool value) { - _impl_._has_bits_[1] |= 0x00000008u; - _impl_.lying_object_ = value; -} -inline void AppearanceFlags::set_lying_object(bool value) { - _internal_set_lying_object(value); - // @@protoc_insertion_point(field_set:Canary.protobuf.appearances.AppearanceFlags.lying_object) -} - -// optional bool animate_always = 29; -inline bool AppearanceFlags::_internal_has_animate_always() const { - bool value = (_impl_._has_bits_[1] & 0x00000010u) != 0; - return value; -} -inline bool AppearanceFlags::has_animate_always() const { - return _internal_has_animate_always(); -} -inline void AppearanceFlags::clear_animate_always() { - _impl_.animate_always_ = false; - _impl_._has_bits_[1] &= ~0x00000010u; -} -inline bool AppearanceFlags::_internal_animate_always() const { - return _impl_.animate_always_; -} -inline bool AppearanceFlags::animate_always() const { - // @@protoc_insertion_point(field_get:Canary.protobuf.appearances.AppearanceFlags.animate_always) - return _internal_animate_always(); -} -inline void AppearanceFlags::_internal_set_animate_always(bool value) { - _impl_._has_bits_[1] |= 0x00000010u; - _impl_.animate_always_ = value; -} -inline void AppearanceFlags::set_animate_always(bool value) { - _internal_set_animate_always(value); - // @@protoc_insertion_point(field_set:Canary.protobuf.appearances.AppearanceFlags.animate_always) -} - -// optional .Canary.protobuf.appearances.AppearanceFlagAutomap automap = 30; -inline bool AppearanceFlags::_internal_has_automap() const { - bool value = (_impl_._has_bits_[0] & 0x00000080u) != 0; - PROTOBUF_ASSUME(!value || _impl_.automap_ != nullptr); - return value; -} -inline bool AppearanceFlags::has_automap() const { - return _internal_has_automap(); -} -inline void AppearanceFlags::clear_automap() { - if (_impl_.automap_ != nullptr) _impl_.automap_->Clear(); - _impl_._has_bits_[0] &= ~0x00000080u; -} -inline const ::Canary::protobuf::appearances::AppearanceFlagAutomap& AppearanceFlags::_internal_automap() const { - const ::Canary::protobuf::appearances::AppearanceFlagAutomap* p = _impl_.automap_; - return p != nullptr ? *p : reinterpret_cast( - ::Canary::protobuf::appearances::_AppearanceFlagAutomap_default_instance_); -} -inline const ::Canary::protobuf::appearances::AppearanceFlagAutomap& AppearanceFlags::automap() const { - // @@protoc_insertion_point(field_get:Canary.protobuf.appearances.AppearanceFlags.automap) - return _internal_automap(); -} -inline void AppearanceFlags::unsafe_arena_set_allocated_automap( - ::Canary::protobuf::appearances::AppearanceFlagAutomap* automap) { - if (GetArenaForAllocation() == nullptr) { - delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(_impl_.automap_); - } - _impl_.automap_ = automap; - if (automap) { - _impl_._has_bits_[0] |= 0x00000080u; - } else { - _impl_._has_bits_[0] &= ~0x00000080u; - } - // @@protoc_insertion_point(field_unsafe_arena_set_allocated:Canary.protobuf.appearances.AppearanceFlags.automap) -} -inline ::Canary::protobuf::appearances::AppearanceFlagAutomap* AppearanceFlags::release_automap() { - _impl_._has_bits_[0] &= ~0x00000080u; - ::Canary::protobuf::appearances::AppearanceFlagAutomap* temp = _impl_.automap_; - _impl_.automap_ = nullptr; -#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE - auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); - temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); - if (GetArenaForAllocation() == nullptr) { delete old; } -#else // PROTOBUF_FORCE_COPY_IN_RELEASE - if (GetArenaForAllocation() != nullptr) { - temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); - } -#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE - return temp; -} -inline ::Canary::protobuf::appearances::AppearanceFlagAutomap* AppearanceFlags::unsafe_arena_release_automap() { - // @@protoc_insertion_point(field_release:Canary.protobuf.appearances.AppearanceFlags.automap) - _impl_._has_bits_[0] &= ~0x00000080u; - ::Canary::protobuf::appearances::AppearanceFlagAutomap* temp = _impl_.automap_; - _impl_.automap_ = nullptr; - return temp; -} -inline ::Canary::protobuf::appearances::AppearanceFlagAutomap* AppearanceFlags::_internal_mutable_automap() { - _impl_._has_bits_[0] |= 0x00000080u; - if (_impl_.automap_ == nullptr) { - auto* p = CreateMaybeMessage<::Canary::protobuf::appearances::AppearanceFlagAutomap>(GetArenaForAllocation()); - _impl_.automap_ = p; - } - return _impl_.automap_; -} -inline ::Canary::protobuf::appearances::AppearanceFlagAutomap* AppearanceFlags::mutable_automap() { - ::Canary::protobuf::appearances::AppearanceFlagAutomap* _msg = _internal_mutable_automap(); - // @@protoc_insertion_point(field_mutable:Canary.protobuf.appearances.AppearanceFlags.automap) - return _msg; -} -inline void AppearanceFlags::set_allocated_automap(::Canary::protobuf::appearances::AppearanceFlagAutomap* automap) { - ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); - if (message_arena == nullptr) { - delete _impl_.automap_; - } - if (automap) { - ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = - ::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena(automap); - if (message_arena != submessage_arena) { - automap = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( - message_arena, automap, submessage_arena); - } - _impl_._has_bits_[0] |= 0x00000080u; - } else { - _impl_._has_bits_[0] &= ~0x00000080u; - } - _impl_.automap_ = automap; - // @@protoc_insertion_point(field_set_allocated:Canary.protobuf.appearances.AppearanceFlags.automap) -} - -// optional .Canary.protobuf.appearances.AppearanceFlagLenshelp lenshelp = 31; -inline bool AppearanceFlags::_internal_has_lenshelp() const { - bool value = (_impl_._has_bits_[0] & 0x00000100u) != 0; - PROTOBUF_ASSUME(!value || _impl_.lenshelp_ != nullptr); - return value; -} -inline bool AppearanceFlags::has_lenshelp() const { - return _internal_has_lenshelp(); -} -inline void AppearanceFlags::clear_lenshelp() { - if (_impl_.lenshelp_ != nullptr) _impl_.lenshelp_->Clear(); - _impl_._has_bits_[0] &= ~0x00000100u; -} -inline const ::Canary::protobuf::appearances::AppearanceFlagLenshelp& AppearanceFlags::_internal_lenshelp() const { - const ::Canary::protobuf::appearances::AppearanceFlagLenshelp* p = _impl_.lenshelp_; - return p != nullptr ? *p : reinterpret_cast( - ::Canary::protobuf::appearances::_AppearanceFlagLenshelp_default_instance_); -} -inline const ::Canary::protobuf::appearances::AppearanceFlagLenshelp& AppearanceFlags::lenshelp() const { - // @@protoc_insertion_point(field_get:Canary.protobuf.appearances.AppearanceFlags.lenshelp) - return _internal_lenshelp(); -} -inline void AppearanceFlags::unsafe_arena_set_allocated_lenshelp( - ::Canary::protobuf::appearances::AppearanceFlagLenshelp* lenshelp) { - if (GetArenaForAllocation() == nullptr) { - delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(_impl_.lenshelp_); - } - _impl_.lenshelp_ = lenshelp; - if (lenshelp) { - _impl_._has_bits_[0] |= 0x00000100u; - } else { - _impl_._has_bits_[0] &= ~0x00000100u; - } - // @@protoc_insertion_point(field_unsafe_arena_set_allocated:Canary.protobuf.appearances.AppearanceFlags.lenshelp) -} -inline ::Canary::protobuf::appearances::AppearanceFlagLenshelp* AppearanceFlags::release_lenshelp() { - _impl_._has_bits_[0] &= ~0x00000100u; - ::Canary::protobuf::appearances::AppearanceFlagLenshelp* temp = _impl_.lenshelp_; - _impl_.lenshelp_ = nullptr; -#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE - auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); - temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); - if (GetArenaForAllocation() == nullptr) { delete old; } -#else // PROTOBUF_FORCE_COPY_IN_RELEASE - if (GetArenaForAllocation() != nullptr) { - temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); - } -#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE - return temp; -} -inline ::Canary::protobuf::appearances::AppearanceFlagLenshelp* AppearanceFlags::unsafe_arena_release_lenshelp() { - // @@protoc_insertion_point(field_release:Canary.protobuf.appearances.AppearanceFlags.lenshelp) - _impl_._has_bits_[0] &= ~0x00000100u; - ::Canary::protobuf::appearances::AppearanceFlagLenshelp* temp = _impl_.lenshelp_; - _impl_.lenshelp_ = nullptr; - return temp; -} -inline ::Canary::protobuf::appearances::AppearanceFlagLenshelp* AppearanceFlags::_internal_mutable_lenshelp() { - _impl_._has_bits_[0] |= 0x00000100u; - if (_impl_.lenshelp_ == nullptr) { - auto* p = CreateMaybeMessage<::Canary::protobuf::appearances::AppearanceFlagLenshelp>(GetArenaForAllocation()); - _impl_.lenshelp_ = p; - } - return _impl_.lenshelp_; -} -inline ::Canary::protobuf::appearances::AppearanceFlagLenshelp* AppearanceFlags::mutable_lenshelp() { - ::Canary::protobuf::appearances::AppearanceFlagLenshelp* _msg = _internal_mutable_lenshelp(); - // @@protoc_insertion_point(field_mutable:Canary.protobuf.appearances.AppearanceFlags.lenshelp) - return _msg; -} -inline void AppearanceFlags::set_allocated_lenshelp(::Canary::protobuf::appearances::AppearanceFlagLenshelp* lenshelp) { - ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); - if (message_arena == nullptr) { - delete _impl_.lenshelp_; - } - if (lenshelp) { - ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = - ::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena(lenshelp); - if (message_arena != submessage_arena) { - lenshelp = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( - message_arena, lenshelp, submessage_arena); - } - _impl_._has_bits_[0] |= 0x00000100u; - } else { - _impl_._has_bits_[0] &= ~0x00000100u; - } - _impl_.lenshelp_ = lenshelp; - // @@protoc_insertion_point(field_set_allocated:Canary.protobuf.appearances.AppearanceFlags.lenshelp) -} - -// optional bool fullbank = 32; -inline bool AppearanceFlags::_internal_has_fullbank() const { - bool value = (_impl_._has_bits_[1] & 0x00000020u) != 0; - return value; -} -inline bool AppearanceFlags::has_fullbank() const { - return _internal_has_fullbank(); -} -inline void AppearanceFlags::clear_fullbank() { - _impl_.fullbank_ = false; - _impl_._has_bits_[1] &= ~0x00000020u; -} -inline bool AppearanceFlags::_internal_fullbank() const { - return _impl_.fullbank_; -} -inline bool AppearanceFlags::fullbank() const { - // @@protoc_insertion_point(field_get:Canary.protobuf.appearances.AppearanceFlags.fullbank) - return _internal_fullbank(); -} -inline void AppearanceFlags::_internal_set_fullbank(bool value) { - _impl_._has_bits_[1] |= 0x00000020u; - _impl_.fullbank_ = value; -} -inline void AppearanceFlags::set_fullbank(bool value) { - _internal_set_fullbank(value); - // @@protoc_insertion_point(field_set:Canary.protobuf.appearances.AppearanceFlags.fullbank) -} - -// optional bool ignore_look = 33; -inline bool AppearanceFlags::_internal_has_ignore_look() const { - bool value = (_impl_._has_bits_[1] & 0x00000040u) != 0; - return value; -} -inline bool AppearanceFlags::has_ignore_look() const { - return _internal_has_ignore_look(); -} -inline void AppearanceFlags::clear_ignore_look() { - _impl_.ignore_look_ = false; - _impl_._has_bits_[1] &= ~0x00000040u; -} -inline bool AppearanceFlags::_internal_ignore_look() const { - return _impl_.ignore_look_; -} -inline bool AppearanceFlags::ignore_look() const { - // @@protoc_insertion_point(field_get:Canary.protobuf.appearances.AppearanceFlags.ignore_look) - return _internal_ignore_look(); -} -inline void AppearanceFlags::_internal_set_ignore_look(bool value) { - _impl_._has_bits_[1] |= 0x00000040u; - _impl_.ignore_look_ = value; -} -inline void AppearanceFlags::set_ignore_look(bool value) { - _internal_set_ignore_look(value); - // @@protoc_insertion_point(field_set:Canary.protobuf.appearances.AppearanceFlags.ignore_look) -} - -// optional .Canary.protobuf.appearances.AppearanceFlagClothes clothes = 34; -inline bool AppearanceFlags::_internal_has_clothes() const { - bool value = (_impl_._has_bits_[0] & 0x00000200u) != 0; - PROTOBUF_ASSUME(!value || _impl_.clothes_ != nullptr); - return value; -} -inline bool AppearanceFlags::has_clothes() const { - return _internal_has_clothes(); -} -inline void AppearanceFlags::clear_clothes() { - if (_impl_.clothes_ != nullptr) _impl_.clothes_->Clear(); - _impl_._has_bits_[0] &= ~0x00000200u; -} -inline const ::Canary::protobuf::appearances::AppearanceFlagClothes& AppearanceFlags::_internal_clothes() const { - const ::Canary::protobuf::appearances::AppearanceFlagClothes* p = _impl_.clothes_; - return p != nullptr ? *p : reinterpret_cast( - ::Canary::protobuf::appearances::_AppearanceFlagClothes_default_instance_); -} -inline const ::Canary::protobuf::appearances::AppearanceFlagClothes& AppearanceFlags::clothes() const { - // @@protoc_insertion_point(field_get:Canary.protobuf.appearances.AppearanceFlags.clothes) - return _internal_clothes(); -} -inline void AppearanceFlags::unsafe_arena_set_allocated_clothes( - ::Canary::protobuf::appearances::AppearanceFlagClothes* clothes) { - if (GetArenaForAllocation() == nullptr) { - delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(_impl_.clothes_); - } - _impl_.clothes_ = clothes; - if (clothes) { - _impl_._has_bits_[0] |= 0x00000200u; - } else { - _impl_._has_bits_[0] &= ~0x00000200u; - } - // @@protoc_insertion_point(field_unsafe_arena_set_allocated:Canary.protobuf.appearances.AppearanceFlags.clothes) -} -inline ::Canary::protobuf::appearances::AppearanceFlagClothes* AppearanceFlags::release_clothes() { - _impl_._has_bits_[0] &= ~0x00000200u; - ::Canary::protobuf::appearances::AppearanceFlagClothes* temp = _impl_.clothes_; - _impl_.clothes_ = nullptr; -#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE - auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); - temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); - if (GetArenaForAllocation() == nullptr) { delete old; } -#else // PROTOBUF_FORCE_COPY_IN_RELEASE - if (GetArenaForAllocation() != nullptr) { - temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); - } -#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE - return temp; -} -inline ::Canary::protobuf::appearances::AppearanceFlagClothes* AppearanceFlags::unsafe_arena_release_clothes() { - // @@protoc_insertion_point(field_release:Canary.protobuf.appearances.AppearanceFlags.clothes) - _impl_._has_bits_[0] &= ~0x00000200u; - ::Canary::protobuf::appearances::AppearanceFlagClothes* temp = _impl_.clothes_; - _impl_.clothes_ = nullptr; - return temp; -} -inline ::Canary::protobuf::appearances::AppearanceFlagClothes* AppearanceFlags::_internal_mutable_clothes() { - _impl_._has_bits_[0] |= 0x00000200u; - if (_impl_.clothes_ == nullptr) { - auto* p = CreateMaybeMessage<::Canary::protobuf::appearances::AppearanceFlagClothes>(GetArenaForAllocation()); - _impl_.clothes_ = p; - } - return _impl_.clothes_; -} -inline ::Canary::protobuf::appearances::AppearanceFlagClothes* AppearanceFlags::mutable_clothes() { - ::Canary::protobuf::appearances::AppearanceFlagClothes* _msg = _internal_mutable_clothes(); - // @@protoc_insertion_point(field_mutable:Canary.protobuf.appearances.AppearanceFlags.clothes) - return _msg; -} -inline void AppearanceFlags::set_allocated_clothes(::Canary::protobuf::appearances::AppearanceFlagClothes* clothes) { - ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); - if (message_arena == nullptr) { - delete _impl_.clothes_; - } - if (clothes) { - ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = - ::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena(clothes); - if (message_arena != submessage_arena) { - clothes = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( - message_arena, clothes, submessage_arena); - } - _impl_._has_bits_[0] |= 0x00000200u; - } else { - _impl_._has_bits_[0] &= ~0x00000200u; - } - _impl_.clothes_ = clothes; - // @@protoc_insertion_point(field_set_allocated:Canary.protobuf.appearances.AppearanceFlags.clothes) -} - -// optional .Canary.protobuf.appearances.AppearanceFlagDefaultAction default_action = 35; -inline bool AppearanceFlags::_internal_has_default_action() const { - bool value = (_impl_._has_bits_[0] & 0x00000400u) != 0; - PROTOBUF_ASSUME(!value || _impl_.default_action_ != nullptr); - return value; -} -inline bool AppearanceFlags::has_default_action() const { - return _internal_has_default_action(); -} -inline void AppearanceFlags::clear_default_action() { - if (_impl_.default_action_ != nullptr) _impl_.default_action_->Clear(); - _impl_._has_bits_[0] &= ~0x00000400u; -} -inline const ::Canary::protobuf::appearances::AppearanceFlagDefaultAction& AppearanceFlags::_internal_default_action() const { - const ::Canary::protobuf::appearances::AppearanceFlagDefaultAction* p = _impl_.default_action_; - return p != nullptr ? *p : reinterpret_cast( - ::Canary::protobuf::appearances::_AppearanceFlagDefaultAction_default_instance_); -} -inline const ::Canary::protobuf::appearances::AppearanceFlagDefaultAction& AppearanceFlags::default_action() const { - // @@protoc_insertion_point(field_get:Canary.protobuf.appearances.AppearanceFlags.default_action) - return _internal_default_action(); -} -inline void AppearanceFlags::unsafe_arena_set_allocated_default_action( - ::Canary::protobuf::appearances::AppearanceFlagDefaultAction* default_action) { - if (GetArenaForAllocation() == nullptr) { - delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(_impl_.default_action_); - } - _impl_.default_action_ = default_action; - if (default_action) { - _impl_._has_bits_[0] |= 0x00000400u; - } else { - _impl_._has_bits_[0] &= ~0x00000400u; - } - // @@protoc_insertion_point(field_unsafe_arena_set_allocated:Canary.protobuf.appearances.AppearanceFlags.default_action) -} -inline ::Canary::protobuf::appearances::AppearanceFlagDefaultAction* AppearanceFlags::release_default_action() { - _impl_._has_bits_[0] &= ~0x00000400u; - ::Canary::protobuf::appearances::AppearanceFlagDefaultAction* temp = _impl_.default_action_; - _impl_.default_action_ = nullptr; -#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE - auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); - temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); - if (GetArenaForAllocation() == nullptr) { delete old; } -#else // PROTOBUF_FORCE_COPY_IN_RELEASE - if (GetArenaForAllocation() != nullptr) { - temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); - } -#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE - return temp; -} -inline ::Canary::protobuf::appearances::AppearanceFlagDefaultAction* AppearanceFlags::unsafe_arena_release_default_action() { - // @@protoc_insertion_point(field_release:Canary.protobuf.appearances.AppearanceFlags.default_action) - _impl_._has_bits_[0] &= ~0x00000400u; - ::Canary::protobuf::appearances::AppearanceFlagDefaultAction* temp = _impl_.default_action_; - _impl_.default_action_ = nullptr; - return temp; -} -inline ::Canary::protobuf::appearances::AppearanceFlagDefaultAction* AppearanceFlags::_internal_mutable_default_action() { - _impl_._has_bits_[0] |= 0x00000400u; - if (_impl_.default_action_ == nullptr) { - auto* p = CreateMaybeMessage<::Canary::protobuf::appearances::AppearanceFlagDefaultAction>(GetArenaForAllocation()); - _impl_.default_action_ = p; - } - return _impl_.default_action_; -} -inline ::Canary::protobuf::appearances::AppearanceFlagDefaultAction* AppearanceFlags::mutable_default_action() { - ::Canary::protobuf::appearances::AppearanceFlagDefaultAction* _msg = _internal_mutable_default_action(); - // @@protoc_insertion_point(field_mutable:Canary.protobuf.appearances.AppearanceFlags.default_action) - return _msg; -} -inline void AppearanceFlags::set_allocated_default_action(::Canary::protobuf::appearances::AppearanceFlagDefaultAction* default_action) { - ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); - if (message_arena == nullptr) { - delete _impl_.default_action_; - } - if (default_action) { - ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = - ::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena(default_action); - if (message_arena != submessage_arena) { - default_action = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( - message_arena, default_action, submessage_arena); - } - _impl_._has_bits_[0] |= 0x00000400u; - } else { - _impl_._has_bits_[0] &= ~0x00000400u; - } - _impl_.default_action_ = default_action; - // @@protoc_insertion_point(field_set_allocated:Canary.protobuf.appearances.AppearanceFlags.default_action) -} - -// optional .Canary.protobuf.appearances.AppearanceFlagMarket market = 36; -inline bool AppearanceFlags::_internal_has_market() const { - bool value = (_impl_._has_bits_[0] & 0x00000800u) != 0; - PROTOBUF_ASSUME(!value || _impl_.market_ != nullptr); - return value; -} -inline bool AppearanceFlags::has_market() const { - return _internal_has_market(); -} -inline void AppearanceFlags::clear_market() { - if (_impl_.market_ != nullptr) _impl_.market_->Clear(); - _impl_._has_bits_[0] &= ~0x00000800u; -} -inline const ::Canary::protobuf::appearances::AppearanceFlagMarket& AppearanceFlags::_internal_market() const { - const ::Canary::protobuf::appearances::AppearanceFlagMarket* p = _impl_.market_; - return p != nullptr ? *p : reinterpret_cast( - ::Canary::protobuf::appearances::_AppearanceFlagMarket_default_instance_); -} -inline const ::Canary::protobuf::appearances::AppearanceFlagMarket& AppearanceFlags::market() const { - // @@protoc_insertion_point(field_get:Canary.protobuf.appearances.AppearanceFlags.market) - return _internal_market(); -} -inline void AppearanceFlags::unsafe_arena_set_allocated_market( - ::Canary::protobuf::appearances::AppearanceFlagMarket* market) { - if (GetArenaForAllocation() == nullptr) { - delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(_impl_.market_); - } - _impl_.market_ = market; - if (market) { - _impl_._has_bits_[0] |= 0x00000800u; - } else { - _impl_._has_bits_[0] &= ~0x00000800u; - } - // @@protoc_insertion_point(field_unsafe_arena_set_allocated:Canary.protobuf.appearances.AppearanceFlags.market) -} -inline ::Canary::protobuf::appearances::AppearanceFlagMarket* AppearanceFlags::release_market() { - _impl_._has_bits_[0] &= ~0x00000800u; - ::Canary::protobuf::appearances::AppearanceFlagMarket* temp = _impl_.market_; - _impl_.market_ = nullptr; -#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE - auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); - temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); - if (GetArenaForAllocation() == nullptr) { delete old; } -#else // PROTOBUF_FORCE_COPY_IN_RELEASE - if (GetArenaForAllocation() != nullptr) { - temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); - } -#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE - return temp; -} -inline ::Canary::protobuf::appearances::AppearanceFlagMarket* AppearanceFlags::unsafe_arena_release_market() { - // @@protoc_insertion_point(field_release:Canary.protobuf.appearances.AppearanceFlags.market) - _impl_._has_bits_[0] &= ~0x00000800u; - ::Canary::protobuf::appearances::AppearanceFlagMarket* temp = _impl_.market_; - _impl_.market_ = nullptr; - return temp; -} -inline ::Canary::protobuf::appearances::AppearanceFlagMarket* AppearanceFlags::_internal_mutable_market() { - _impl_._has_bits_[0] |= 0x00000800u; - if (_impl_.market_ == nullptr) { - auto* p = CreateMaybeMessage<::Canary::protobuf::appearances::AppearanceFlagMarket>(GetArenaForAllocation()); - _impl_.market_ = p; - } - return _impl_.market_; -} -inline ::Canary::protobuf::appearances::AppearanceFlagMarket* AppearanceFlags::mutable_market() { - ::Canary::protobuf::appearances::AppearanceFlagMarket* _msg = _internal_mutable_market(); - // @@protoc_insertion_point(field_mutable:Canary.protobuf.appearances.AppearanceFlags.market) - return _msg; -} -inline void AppearanceFlags::set_allocated_market(::Canary::protobuf::appearances::AppearanceFlagMarket* market) { - ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); - if (message_arena == nullptr) { - delete _impl_.market_; - } - if (market) { - ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = - ::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena(market); - if (message_arena != submessage_arena) { - market = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( - message_arena, market, submessage_arena); - } - _impl_._has_bits_[0] |= 0x00000800u; - } else { - _impl_._has_bits_[0] &= ~0x00000800u; - } - _impl_.market_ = market; - // @@protoc_insertion_point(field_set_allocated:Canary.protobuf.appearances.AppearanceFlags.market) -} - -// optional bool wrap = 37; -inline bool AppearanceFlags::_internal_has_wrap() const { - bool value = (_impl_._has_bits_[1] & 0x00000080u) != 0; - return value; -} -inline bool AppearanceFlags::has_wrap() const { - return _internal_has_wrap(); -} -inline void AppearanceFlags::clear_wrap() { - _impl_.wrap_ = false; - _impl_._has_bits_[1] &= ~0x00000080u; -} -inline bool AppearanceFlags::_internal_wrap() const { - return _impl_.wrap_; -} -inline bool AppearanceFlags::wrap() const { - // @@protoc_insertion_point(field_get:Canary.protobuf.appearances.AppearanceFlags.wrap) - return _internal_wrap(); -} -inline void AppearanceFlags::_internal_set_wrap(bool value) { - _impl_._has_bits_[1] |= 0x00000080u; - _impl_.wrap_ = value; -} -inline void AppearanceFlags::set_wrap(bool value) { - _internal_set_wrap(value); - // @@protoc_insertion_point(field_set:Canary.protobuf.appearances.AppearanceFlags.wrap) -} - -// optional bool unwrap = 38; -inline bool AppearanceFlags::_internal_has_unwrap() const { - bool value = (_impl_._has_bits_[1] & 0x00000100u) != 0; - return value; -} -inline bool AppearanceFlags::has_unwrap() const { - return _internal_has_unwrap(); -} -inline void AppearanceFlags::clear_unwrap() { - _impl_.unwrap_ = false; - _impl_._has_bits_[1] &= ~0x00000100u; -} -inline bool AppearanceFlags::_internal_unwrap() const { - return _impl_.unwrap_; -} -inline bool AppearanceFlags::unwrap() const { - // @@protoc_insertion_point(field_get:Canary.protobuf.appearances.AppearanceFlags.unwrap) - return _internal_unwrap(); -} -inline void AppearanceFlags::_internal_set_unwrap(bool value) { - _impl_._has_bits_[1] |= 0x00000100u; - _impl_.unwrap_ = value; -} -inline void AppearanceFlags::set_unwrap(bool value) { - _internal_set_unwrap(value); - // @@protoc_insertion_point(field_set:Canary.protobuf.appearances.AppearanceFlags.unwrap) -} - -// optional bool topeffect = 39; -inline bool AppearanceFlags::_internal_has_topeffect() const { - bool value = (_impl_._has_bits_[1] & 0x00000200u) != 0; - return value; -} -inline bool AppearanceFlags::has_topeffect() const { - return _internal_has_topeffect(); -} -inline void AppearanceFlags::clear_topeffect() { - _impl_.topeffect_ = false; - _impl_._has_bits_[1] &= ~0x00000200u; -} -inline bool AppearanceFlags::_internal_topeffect() const { - return _impl_.topeffect_; -} -inline bool AppearanceFlags::topeffect() const { - // @@protoc_insertion_point(field_get:Canary.protobuf.appearances.AppearanceFlags.topeffect) - return _internal_topeffect(); -} -inline void AppearanceFlags::_internal_set_topeffect(bool value) { - _impl_._has_bits_[1] |= 0x00000200u; - _impl_.topeffect_ = value; -} -inline void AppearanceFlags::set_topeffect(bool value) { - _internal_set_topeffect(value); - // @@protoc_insertion_point(field_set:Canary.protobuf.appearances.AppearanceFlags.topeffect) -} - -// repeated .Canary.protobuf.appearances.AppearanceFlagNPC npcsaledata = 40; -inline int AppearanceFlags::_internal_npcsaledata_size() const { - return _impl_.npcsaledata_.size(); -} -inline int AppearanceFlags::npcsaledata_size() const { - return _internal_npcsaledata_size(); -} -inline void AppearanceFlags::clear_npcsaledata() { - _impl_.npcsaledata_.Clear(); -} -inline ::Canary::protobuf::appearances::AppearanceFlagNPC* AppearanceFlags::mutable_npcsaledata(int index) { - // @@protoc_insertion_point(field_mutable:Canary.protobuf.appearances.AppearanceFlags.npcsaledata) - return _impl_.npcsaledata_.Mutable(index); -} -inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::Canary::protobuf::appearances::AppearanceFlagNPC >* -AppearanceFlags::mutable_npcsaledata() { - // @@protoc_insertion_point(field_mutable_list:Canary.protobuf.appearances.AppearanceFlags.npcsaledata) - return &_impl_.npcsaledata_; -} -inline const ::Canary::protobuf::appearances::AppearanceFlagNPC& AppearanceFlags::_internal_npcsaledata(int index) const { - return _impl_.npcsaledata_.Get(index); -} -inline const ::Canary::protobuf::appearances::AppearanceFlagNPC& AppearanceFlags::npcsaledata(int index) const { - // @@protoc_insertion_point(field_get:Canary.protobuf.appearances.AppearanceFlags.npcsaledata) - return _internal_npcsaledata(index); -} -inline ::Canary::protobuf::appearances::AppearanceFlagNPC* AppearanceFlags::_internal_add_npcsaledata() { - return _impl_.npcsaledata_.Add(); -} -inline ::Canary::protobuf::appearances::AppearanceFlagNPC* AppearanceFlags::add_npcsaledata() { - ::Canary::protobuf::appearances::AppearanceFlagNPC* _add = _internal_add_npcsaledata(); - // @@protoc_insertion_point(field_add:Canary.protobuf.appearances.AppearanceFlags.npcsaledata) - return _add; -} -inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::Canary::protobuf::appearances::AppearanceFlagNPC >& -AppearanceFlags::npcsaledata() const { - // @@protoc_insertion_point(field_list:Canary.protobuf.appearances.AppearanceFlags.npcsaledata) - return _impl_.npcsaledata_; -} - -// optional .Canary.protobuf.appearances.AppearanceFlagChangedToExpire changedtoexpire = 41; -inline bool AppearanceFlags::_internal_has_changedtoexpire() const { - bool value = (_impl_._has_bits_[0] & 0x00001000u) != 0; - PROTOBUF_ASSUME(!value || _impl_.changedtoexpire_ != nullptr); - return value; -} -inline bool AppearanceFlags::has_changedtoexpire() const { - return _internal_has_changedtoexpire(); -} -inline void AppearanceFlags::clear_changedtoexpire() { - if (_impl_.changedtoexpire_ != nullptr) _impl_.changedtoexpire_->Clear(); - _impl_._has_bits_[0] &= ~0x00001000u; -} -inline const ::Canary::protobuf::appearances::AppearanceFlagChangedToExpire& AppearanceFlags::_internal_changedtoexpire() const { - const ::Canary::protobuf::appearances::AppearanceFlagChangedToExpire* p = _impl_.changedtoexpire_; - return p != nullptr ? *p : reinterpret_cast( - ::Canary::protobuf::appearances::_AppearanceFlagChangedToExpire_default_instance_); -} -inline const ::Canary::protobuf::appearances::AppearanceFlagChangedToExpire& AppearanceFlags::changedtoexpire() const { - // @@protoc_insertion_point(field_get:Canary.protobuf.appearances.AppearanceFlags.changedtoexpire) - return _internal_changedtoexpire(); -} -inline void AppearanceFlags::unsafe_arena_set_allocated_changedtoexpire( - ::Canary::protobuf::appearances::AppearanceFlagChangedToExpire* changedtoexpire) { - if (GetArenaForAllocation() == nullptr) { - delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(_impl_.changedtoexpire_); - } - _impl_.changedtoexpire_ = changedtoexpire; - if (changedtoexpire) { - _impl_._has_bits_[0] |= 0x00001000u; - } else { - _impl_._has_bits_[0] &= ~0x00001000u; - } - // @@protoc_insertion_point(field_unsafe_arena_set_allocated:Canary.protobuf.appearances.AppearanceFlags.changedtoexpire) -} -inline ::Canary::protobuf::appearances::AppearanceFlagChangedToExpire* AppearanceFlags::release_changedtoexpire() { - _impl_._has_bits_[0] &= ~0x00001000u; - ::Canary::protobuf::appearances::AppearanceFlagChangedToExpire* temp = _impl_.changedtoexpire_; - _impl_.changedtoexpire_ = nullptr; -#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE - auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); - temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); - if (GetArenaForAllocation() == nullptr) { delete old; } -#else // PROTOBUF_FORCE_COPY_IN_RELEASE - if (GetArenaForAllocation() != nullptr) { - temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); - } -#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE - return temp; -} -inline ::Canary::protobuf::appearances::AppearanceFlagChangedToExpire* AppearanceFlags::unsafe_arena_release_changedtoexpire() { - // @@protoc_insertion_point(field_release:Canary.protobuf.appearances.AppearanceFlags.changedtoexpire) - _impl_._has_bits_[0] &= ~0x00001000u; - ::Canary::protobuf::appearances::AppearanceFlagChangedToExpire* temp = _impl_.changedtoexpire_; - _impl_.changedtoexpire_ = nullptr; - return temp; -} -inline ::Canary::protobuf::appearances::AppearanceFlagChangedToExpire* AppearanceFlags::_internal_mutable_changedtoexpire() { - _impl_._has_bits_[0] |= 0x00001000u; - if (_impl_.changedtoexpire_ == nullptr) { - auto* p = CreateMaybeMessage<::Canary::protobuf::appearances::AppearanceFlagChangedToExpire>(GetArenaForAllocation()); - _impl_.changedtoexpire_ = p; - } - return _impl_.changedtoexpire_; -} -inline ::Canary::protobuf::appearances::AppearanceFlagChangedToExpire* AppearanceFlags::mutable_changedtoexpire() { - ::Canary::protobuf::appearances::AppearanceFlagChangedToExpire* _msg = _internal_mutable_changedtoexpire(); - // @@protoc_insertion_point(field_mutable:Canary.protobuf.appearances.AppearanceFlags.changedtoexpire) - return _msg; -} -inline void AppearanceFlags::set_allocated_changedtoexpire(::Canary::protobuf::appearances::AppearanceFlagChangedToExpire* changedtoexpire) { - ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); - if (message_arena == nullptr) { - delete _impl_.changedtoexpire_; - } - if (changedtoexpire) { - ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = - ::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena(changedtoexpire); - if (message_arena != submessage_arena) { - changedtoexpire = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( - message_arena, changedtoexpire, submessage_arena); - } - _impl_._has_bits_[0] |= 0x00001000u; - } else { - _impl_._has_bits_[0] &= ~0x00001000u; - } - _impl_.changedtoexpire_ = changedtoexpire; - // @@protoc_insertion_point(field_set_allocated:Canary.protobuf.appearances.AppearanceFlags.changedtoexpire) -} - -// optional bool corpse = 42; -inline bool AppearanceFlags::_internal_has_corpse() const { - bool value = (_impl_._has_bits_[1] & 0x00000400u) != 0; - return value; -} -inline bool AppearanceFlags::has_corpse() const { - return _internal_has_corpse(); -} -inline void AppearanceFlags::clear_corpse() { - _impl_.corpse_ = false; - _impl_._has_bits_[1] &= ~0x00000400u; -} -inline bool AppearanceFlags::_internal_corpse() const { - return _impl_.corpse_; -} -inline bool AppearanceFlags::corpse() const { - // @@protoc_insertion_point(field_get:Canary.protobuf.appearances.AppearanceFlags.corpse) - return _internal_corpse(); -} -inline void AppearanceFlags::_internal_set_corpse(bool value) { - _impl_._has_bits_[1] |= 0x00000400u; - _impl_.corpse_ = value; -} -inline void AppearanceFlags::set_corpse(bool value) { - _internal_set_corpse(value); - // @@protoc_insertion_point(field_set:Canary.protobuf.appearances.AppearanceFlags.corpse) -} - -// optional bool player_corpse = 43; -inline bool AppearanceFlags::_internal_has_player_corpse() const { - bool value = (_impl_._has_bits_[1] & 0x00000800u) != 0; - return value; -} -inline bool AppearanceFlags::has_player_corpse() const { - return _internal_has_player_corpse(); -} -inline void AppearanceFlags::clear_player_corpse() { - _impl_.player_corpse_ = false; - _impl_._has_bits_[1] &= ~0x00000800u; -} -inline bool AppearanceFlags::_internal_player_corpse() const { - return _impl_.player_corpse_; -} -inline bool AppearanceFlags::player_corpse() const { - // @@protoc_insertion_point(field_get:Canary.protobuf.appearances.AppearanceFlags.player_corpse) - return _internal_player_corpse(); -} -inline void AppearanceFlags::_internal_set_player_corpse(bool value) { - _impl_._has_bits_[1] |= 0x00000800u; - _impl_.player_corpse_ = value; -} -inline void AppearanceFlags::set_player_corpse(bool value) { - _internal_set_player_corpse(value); - // @@protoc_insertion_point(field_set:Canary.protobuf.appearances.AppearanceFlags.player_corpse) -} - -// optional .Canary.protobuf.appearances.AppearanceFlagCyclopedia cyclopediaitem = 44; -inline bool AppearanceFlags::_internal_has_cyclopediaitem() const { - bool value = (_impl_._has_bits_[0] & 0x00002000u) != 0; - PROTOBUF_ASSUME(!value || _impl_.cyclopediaitem_ != nullptr); - return value; -} -inline bool AppearanceFlags::has_cyclopediaitem() const { - return _internal_has_cyclopediaitem(); -} -inline void AppearanceFlags::clear_cyclopediaitem() { - if (_impl_.cyclopediaitem_ != nullptr) _impl_.cyclopediaitem_->Clear(); - _impl_._has_bits_[0] &= ~0x00002000u; -} -inline const ::Canary::protobuf::appearances::AppearanceFlagCyclopedia& AppearanceFlags::_internal_cyclopediaitem() const { - const ::Canary::protobuf::appearances::AppearanceFlagCyclopedia* p = _impl_.cyclopediaitem_; - return p != nullptr ? *p : reinterpret_cast( - ::Canary::protobuf::appearances::_AppearanceFlagCyclopedia_default_instance_); -} -inline const ::Canary::protobuf::appearances::AppearanceFlagCyclopedia& AppearanceFlags::cyclopediaitem() const { - // @@protoc_insertion_point(field_get:Canary.protobuf.appearances.AppearanceFlags.cyclopediaitem) - return _internal_cyclopediaitem(); -} -inline void AppearanceFlags::unsafe_arena_set_allocated_cyclopediaitem( - ::Canary::protobuf::appearances::AppearanceFlagCyclopedia* cyclopediaitem) { - if (GetArenaForAllocation() == nullptr) { - delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(_impl_.cyclopediaitem_); - } - _impl_.cyclopediaitem_ = cyclopediaitem; - if (cyclopediaitem) { - _impl_._has_bits_[0] |= 0x00002000u; - } else { - _impl_._has_bits_[0] &= ~0x00002000u; - } - // @@protoc_insertion_point(field_unsafe_arena_set_allocated:Canary.protobuf.appearances.AppearanceFlags.cyclopediaitem) -} -inline ::Canary::protobuf::appearances::AppearanceFlagCyclopedia* AppearanceFlags::release_cyclopediaitem() { - _impl_._has_bits_[0] &= ~0x00002000u; - ::Canary::protobuf::appearances::AppearanceFlagCyclopedia* temp = _impl_.cyclopediaitem_; - _impl_.cyclopediaitem_ = nullptr; -#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE - auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); - temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); - if (GetArenaForAllocation() == nullptr) { delete old; } -#else // PROTOBUF_FORCE_COPY_IN_RELEASE - if (GetArenaForAllocation() != nullptr) { - temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); - } -#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE - return temp; -} -inline ::Canary::protobuf::appearances::AppearanceFlagCyclopedia* AppearanceFlags::unsafe_arena_release_cyclopediaitem() { - // @@protoc_insertion_point(field_release:Canary.protobuf.appearances.AppearanceFlags.cyclopediaitem) - _impl_._has_bits_[0] &= ~0x00002000u; - ::Canary::protobuf::appearances::AppearanceFlagCyclopedia* temp = _impl_.cyclopediaitem_; - _impl_.cyclopediaitem_ = nullptr; - return temp; -} -inline ::Canary::protobuf::appearances::AppearanceFlagCyclopedia* AppearanceFlags::_internal_mutable_cyclopediaitem() { - _impl_._has_bits_[0] |= 0x00002000u; - if (_impl_.cyclopediaitem_ == nullptr) { - auto* p = CreateMaybeMessage<::Canary::protobuf::appearances::AppearanceFlagCyclopedia>(GetArenaForAllocation()); - _impl_.cyclopediaitem_ = p; - } - return _impl_.cyclopediaitem_; -} -inline ::Canary::protobuf::appearances::AppearanceFlagCyclopedia* AppearanceFlags::mutable_cyclopediaitem() { - ::Canary::protobuf::appearances::AppearanceFlagCyclopedia* _msg = _internal_mutable_cyclopediaitem(); - // @@protoc_insertion_point(field_mutable:Canary.protobuf.appearances.AppearanceFlags.cyclopediaitem) - return _msg; -} -inline void AppearanceFlags::set_allocated_cyclopediaitem(::Canary::protobuf::appearances::AppearanceFlagCyclopedia* cyclopediaitem) { - ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); - if (message_arena == nullptr) { - delete _impl_.cyclopediaitem_; - } - if (cyclopediaitem) { - ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = - ::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena(cyclopediaitem); - if (message_arena != submessage_arena) { - cyclopediaitem = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( - message_arena, cyclopediaitem, submessage_arena); - } - _impl_._has_bits_[0] |= 0x00002000u; - } else { - _impl_._has_bits_[0] &= ~0x00002000u; - } - _impl_.cyclopediaitem_ = cyclopediaitem; - // @@protoc_insertion_point(field_set_allocated:Canary.protobuf.appearances.AppearanceFlags.cyclopediaitem) -} - -// optional bool ammo = 45; -inline bool AppearanceFlags::_internal_has_ammo() const { - bool value = (_impl_._has_bits_[1] & 0x00001000u) != 0; - return value; -} -inline bool AppearanceFlags::has_ammo() const { - return _internal_has_ammo(); -} -inline void AppearanceFlags::clear_ammo() { - _impl_.ammo_ = false; - _impl_._has_bits_[1] &= ~0x00001000u; -} -inline bool AppearanceFlags::_internal_ammo() const { - return _impl_.ammo_; -} -inline bool AppearanceFlags::ammo() const { - // @@protoc_insertion_point(field_get:Canary.protobuf.appearances.AppearanceFlags.ammo) - return _internal_ammo(); -} -inline void AppearanceFlags::_internal_set_ammo(bool value) { - _impl_._has_bits_[1] |= 0x00001000u; - _impl_.ammo_ = value; -} -inline void AppearanceFlags::set_ammo(bool value) { - _internal_set_ammo(value); - // @@protoc_insertion_point(field_set:Canary.protobuf.appearances.AppearanceFlags.ammo) -} - -// optional bool show_off_socket = 46; -inline bool AppearanceFlags::_internal_has_show_off_socket() const { - bool value = (_impl_._has_bits_[1] & 0x00002000u) != 0; - return value; -} -inline bool AppearanceFlags::has_show_off_socket() const { - return _internal_has_show_off_socket(); -} -inline void AppearanceFlags::clear_show_off_socket() { - _impl_.show_off_socket_ = false; - _impl_._has_bits_[1] &= ~0x00002000u; -} -inline bool AppearanceFlags::_internal_show_off_socket() const { - return _impl_.show_off_socket_; -} -inline bool AppearanceFlags::show_off_socket() const { - // @@protoc_insertion_point(field_get:Canary.protobuf.appearances.AppearanceFlags.show_off_socket) - return _internal_show_off_socket(); -} -inline void AppearanceFlags::_internal_set_show_off_socket(bool value) { - _impl_._has_bits_[1] |= 0x00002000u; - _impl_.show_off_socket_ = value; -} -inline void AppearanceFlags::set_show_off_socket(bool value) { - _internal_set_show_off_socket(value); - // @@protoc_insertion_point(field_set:Canary.protobuf.appearances.AppearanceFlags.show_off_socket) -} - -// optional bool reportable = 47; -inline bool AppearanceFlags::_internal_has_reportable() const { - bool value = (_impl_._has_bits_[1] & 0x00004000u) != 0; - return value; -} -inline bool AppearanceFlags::has_reportable() const { - return _internal_has_reportable(); -} -inline void AppearanceFlags::clear_reportable() { - _impl_.reportable_ = false; - _impl_._has_bits_[1] &= ~0x00004000u; -} -inline bool AppearanceFlags::_internal_reportable() const { - return _impl_.reportable_; -} -inline bool AppearanceFlags::reportable() const { - // @@protoc_insertion_point(field_get:Canary.protobuf.appearances.AppearanceFlags.reportable) - return _internal_reportable(); -} -inline void AppearanceFlags::_internal_set_reportable(bool value) { - _impl_._has_bits_[1] |= 0x00004000u; - _impl_.reportable_ = value; -} -inline void AppearanceFlags::set_reportable(bool value) { - _internal_set_reportable(value); - // @@protoc_insertion_point(field_set:Canary.protobuf.appearances.AppearanceFlags.reportable) -} - -// optional .Canary.protobuf.appearances.AppearanceFlagUpgradeClassification upgradeclassification = 48; -inline bool AppearanceFlags::_internal_has_upgradeclassification() const { - bool value = (_impl_._has_bits_[0] & 0x00004000u) != 0; - PROTOBUF_ASSUME(!value || _impl_.upgradeclassification_ != nullptr); - return value; -} -inline bool AppearanceFlags::has_upgradeclassification() const { - return _internal_has_upgradeclassification(); -} -inline void AppearanceFlags::clear_upgradeclassification() { - if (_impl_.upgradeclassification_ != nullptr) _impl_.upgradeclassification_->Clear(); - _impl_._has_bits_[0] &= ~0x00004000u; -} -inline const ::Canary::protobuf::appearances::AppearanceFlagUpgradeClassification& AppearanceFlags::_internal_upgradeclassification() const { - const ::Canary::protobuf::appearances::AppearanceFlagUpgradeClassification* p = _impl_.upgradeclassification_; - return p != nullptr ? *p : reinterpret_cast( - ::Canary::protobuf::appearances::_AppearanceFlagUpgradeClassification_default_instance_); -} -inline const ::Canary::protobuf::appearances::AppearanceFlagUpgradeClassification& AppearanceFlags::upgradeclassification() const { - // @@protoc_insertion_point(field_get:Canary.protobuf.appearances.AppearanceFlags.upgradeclassification) - return _internal_upgradeclassification(); -} -inline void AppearanceFlags::unsafe_arena_set_allocated_upgradeclassification( - ::Canary::protobuf::appearances::AppearanceFlagUpgradeClassification* upgradeclassification) { - if (GetArenaForAllocation() == nullptr) { - delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(_impl_.upgradeclassification_); - } - _impl_.upgradeclassification_ = upgradeclassification; - if (upgradeclassification) { - _impl_._has_bits_[0] |= 0x00004000u; - } else { - _impl_._has_bits_[0] &= ~0x00004000u; - } - // @@protoc_insertion_point(field_unsafe_arena_set_allocated:Canary.protobuf.appearances.AppearanceFlags.upgradeclassification) -} -inline ::Canary::protobuf::appearances::AppearanceFlagUpgradeClassification* AppearanceFlags::release_upgradeclassification() { - _impl_._has_bits_[0] &= ~0x00004000u; - ::Canary::protobuf::appearances::AppearanceFlagUpgradeClassification* temp = _impl_.upgradeclassification_; - _impl_.upgradeclassification_ = nullptr; -#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE - auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); - temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); - if (GetArenaForAllocation() == nullptr) { delete old; } -#else // PROTOBUF_FORCE_COPY_IN_RELEASE - if (GetArenaForAllocation() != nullptr) { - temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); - } -#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE - return temp; -} -inline ::Canary::protobuf::appearances::AppearanceFlagUpgradeClassification* AppearanceFlags::unsafe_arena_release_upgradeclassification() { - // @@protoc_insertion_point(field_release:Canary.protobuf.appearances.AppearanceFlags.upgradeclassification) - _impl_._has_bits_[0] &= ~0x00004000u; - ::Canary::protobuf::appearances::AppearanceFlagUpgradeClassification* temp = _impl_.upgradeclassification_; - _impl_.upgradeclassification_ = nullptr; - return temp; -} -inline ::Canary::protobuf::appearances::AppearanceFlagUpgradeClassification* AppearanceFlags::_internal_mutable_upgradeclassification() { - _impl_._has_bits_[0] |= 0x00004000u; - if (_impl_.upgradeclassification_ == nullptr) { - auto* p = CreateMaybeMessage<::Canary::protobuf::appearances::AppearanceFlagUpgradeClassification>(GetArenaForAllocation()); - _impl_.upgradeclassification_ = p; - } - return _impl_.upgradeclassification_; -} -inline ::Canary::protobuf::appearances::AppearanceFlagUpgradeClassification* AppearanceFlags::mutable_upgradeclassification() { - ::Canary::protobuf::appearances::AppearanceFlagUpgradeClassification* _msg = _internal_mutable_upgradeclassification(); - // @@protoc_insertion_point(field_mutable:Canary.protobuf.appearances.AppearanceFlags.upgradeclassification) - return _msg; -} -inline void AppearanceFlags::set_allocated_upgradeclassification(::Canary::protobuf::appearances::AppearanceFlagUpgradeClassification* upgradeclassification) { - ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); - if (message_arena == nullptr) { - delete _impl_.upgradeclassification_; - } - if (upgradeclassification) { - ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = - ::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena(upgradeclassification); - if (message_arena != submessage_arena) { - upgradeclassification = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( - message_arena, upgradeclassification, submessage_arena); - } - _impl_._has_bits_[0] |= 0x00004000u; - } else { - _impl_._has_bits_[0] &= ~0x00004000u; - } - _impl_.upgradeclassification_ = upgradeclassification; - // @@protoc_insertion_point(field_set_allocated:Canary.protobuf.appearances.AppearanceFlags.upgradeclassification) -} - -// optional bool reverse_addons_east = 49; -inline bool AppearanceFlags::_internal_has_reverse_addons_east() const { - bool value = (_impl_._has_bits_[1] & 0x00008000u) != 0; - return value; -} -inline bool AppearanceFlags::has_reverse_addons_east() const { - return _internal_has_reverse_addons_east(); -} -inline void AppearanceFlags::clear_reverse_addons_east() { - _impl_.reverse_addons_east_ = false; - _impl_._has_bits_[1] &= ~0x00008000u; -} -inline bool AppearanceFlags::_internal_reverse_addons_east() const { - return _impl_.reverse_addons_east_; -} -inline bool AppearanceFlags::reverse_addons_east() const { - // @@protoc_insertion_point(field_get:Canary.protobuf.appearances.AppearanceFlags.reverse_addons_east) - return _internal_reverse_addons_east(); -} -inline void AppearanceFlags::_internal_set_reverse_addons_east(bool value) { - _impl_._has_bits_[1] |= 0x00008000u; - _impl_.reverse_addons_east_ = value; -} -inline void AppearanceFlags::set_reverse_addons_east(bool value) { - _internal_set_reverse_addons_east(value); - // @@protoc_insertion_point(field_set:Canary.protobuf.appearances.AppearanceFlags.reverse_addons_east) -} - -// optional bool reverse_addons_west = 50; -inline bool AppearanceFlags::_internal_has_reverse_addons_west() const { - bool value = (_impl_._has_bits_[1] & 0x00010000u) != 0; - return value; -} -inline bool AppearanceFlags::has_reverse_addons_west() const { - return _internal_has_reverse_addons_west(); -} -inline void AppearanceFlags::clear_reverse_addons_west() { - _impl_.reverse_addons_west_ = false; - _impl_._has_bits_[1] &= ~0x00010000u; -} -inline bool AppearanceFlags::_internal_reverse_addons_west() const { - return _impl_.reverse_addons_west_; -} -inline bool AppearanceFlags::reverse_addons_west() const { - // @@protoc_insertion_point(field_get:Canary.protobuf.appearances.AppearanceFlags.reverse_addons_west) - return _internal_reverse_addons_west(); -} -inline void AppearanceFlags::_internal_set_reverse_addons_west(bool value) { - _impl_._has_bits_[1] |= 0x00010000u; - _impl_.reverse_addons_west_ = value; -} -inline void AppearanceFlags::set_reverse_addons_west(bool value) { - _internal_set_reverse_addons_west(value); - // @@protoc_insertion_point(field_set:Canary.protobuf.appearances.AppearanceFlags.reverse_addons_west) -} - -// optional bool reverse_addons_south = 51; -inline bool AppearanceFlags::_internal_has_reverse_addons_south() const { - bool value = (_impl_._has_bits_[1] & 0x00020000u) != 0; - return value; -} -inline bool AppearanceFlags::has_reverse_addons_south() const { - return _internal_has_reverse_addons_south(); -} -inline void AppearanceFlags::clear_reverse_addons_south() { - _impl_.reverse_addons_south_ = false; - _impl_._has_bits_[1] &= ~0x00020000u; -} -inline bool AppearanceFlags::_internal_reverse_addons_south() const { - return _impl_.reverse_addons_south_; -} -inline bool AppearanceFlags::reverse_addons_south() const { - // @@protoc_insertion_point(field_get:Canary.protobuf.appearances.AppearanceFlags.reverse_addons_south) - return _internal_reverse_addons_south(); -} -inline void AppearanceFlags::_internal_set_reverse_addons_south(bool value) { - _impl_._has_bits_[1] |= 0x00020000u; - _impl_.reverse_addons_south_ = value; -} -inline void AppearanceFlags::set_reverse_addons_south(bool value) { - _internal_set_reverse_addons_south(value); - // @@protoc_insertion_point(field_set:Canary.protobuf.appearances.AppearanceFlags.reverse_addons_south) -} - -// optional bool reverse_addons_north = 52; -inline bool AppearanceFlags::_internal_has_reverse_addons_north() const { - bool value = (_impl_._has_bits_[1] & 0x00040000u) != 0; - return value; -} -inline bool AppearanceFlags::has_reverse_addons_north() const { - return _internal_has_reverse_addons_north(); -} -inline void AppearanceFlags::clear_reverse_addons_north() { - _impl_.reverse_addons_north_ = false; - _impl_._has_bits_[1] &= ~0x00040000u; -} -inline bool AppearanceFlags::_internal_reverse_addons_north() const { - return _impl_.reverse_addons_north_; -} -inline bool AppearanceFlags::reverse_addons_north() const { - // @@protoc_insertion_point(field_get:Canary.protobuf.appearances.AppearanceFlags.reverse_addons_north) - return _internal_reverse_addons_north(); -} -inline void AppearanceFlags::_internal_set_reverse_addons_north(bool value) { - _impl_._has_bits_[1] |= 0x00040000u; - _impl_.reverse_addons_north_ = value; -} -inline void AppearanceFlags::set_reverse_addons_north(bool value) { - _internal_set_reverse_addons_north(value); - // @@protoc_insertion_point(field_set:Canary.protobuf.appearances.AppearanceFlags.reverse_addons_north) -} - -// optional bool wearout = 53; -inline bool AppearanceFlags::_internal_has_wearout() const { - bool value = (_impl_._has_bits_[1] & 0x00080000u) != 0; - return value; -} -inline bool AppearanceFlags::has_wearout() const { - return _internal_has_wearout(); -} -inline void AppearanceFlags::clear_wearout() { - _impl_.wearout_ = false; - _impl_._has_bits_[1] &= ~0x00080000u; -} -inline bool AppearanceFlags::_internal_wearout() const { - return _impl_.wearout_; -} -inline bool AppearanceFlags::wearout() const { - // @@protoc_insertion_point(field_get:Canary.protobuf.appearances.AppearanceFlags.wearout) - return _internal_wearout(); -} -inline void AppearanceFlags::_internal_set_wearout(bool value) { - _impl_._has_bits_[1] |= 0x00080000u; - _impl_.wearout_ = value; -} -inline void AppearanceFlags::set_wearout(bool value) { - _internal_set_wearout(value); - // @@protoc_insertion_point(field_set:Canary.protobuf.appearances.AppearanceFlags.wearout) -} - -// optional bool clockexpire = 54; -inline bool AppearanceFlags::_internal_has_clockexpire() const { - bool value = (_impl_._has_bits_[1] & 0x00100000u) != 0; - return value; -} -inline bool AppearanceFlags::has_clockexpire() const { - return _internal_has_clockexpire(); -} -inline void AppearanceFlags::clear_clockexpire() { - _impl_.clockexpire_ = false; - _impl_._has_bits_[1] &= ~0x00100000u; -} -inline bool AppearanceFlags::_internal_clockexpire() const { - return _impl_.clockexpire_; -} -inline bool AppearanceFlags::clockexpire() const { - // @@protoc_insertion_point(field_get:Canary.protobuf.appearances.AppearanceFlags.clockexpire) - return _internal_clockexpire(); -} -inline void AppearanceFlags::_internal_set_clockexpire(bool value) { - _impl_._has_bits_[1] |= 0x00100000u; - _impl_.clockexpire_ = value; -} -inline void AppearanceFlags::set_clockexpire(bool value) { - _internal_set_clockexpire(value); - // @@protoc_insertion_point(field_set:Canary.protobuf.appearances.AppearanceFlags.clockexpire) -} - -// optional bool expire = 55; -inline bool AppearanceFlags::_internal_has_expire() const { - bool value = (_impl_._has_bits_[1] & 0x00200000u) != 0; - return value; -} -inline bool AppearanceFlags::has_expire() const { - return _internal_has_expire(); -} -inline void AppearanceFlags::clear_expire() { - _impl_.expire_ = false; - _impl_._has_bits_[1] &= ~0x00200000u; -} -inline bool AppearanceFlags::_internal_expire() const { - return _impl_.expire_; -} -inline bool AppearanceFlags::expire() const { - // @@protoc_insertion_point(field_get:Canary.protobuf.appearances.AppearanceFlags.expire) - return _internal_expire(); -} -inline void AppearanceFlags::_internal_set_expire(bool value) { - _impl_._has_bits_[1] |= 0x00200000u; - _impl_.expire_ = value; -} -inline void AppearanceFlags::set_expire(bool value) { - _internal_set_expire(value); - // @@protoc_insertion_point(field_set:Canary.protobuf.appearances.AppearanceFlags.expire) -} - -// optional bool expirestop = 56; -inline bool AppearanceFlags::_internal_has_expirestop() const { - bool value = (_impl_._has_bits_[1] & 0x00400000u) != 0; - return value; -} -inline bool AppearanceFlags::has_expirestop() const { - return _internal_has_expirestop(); -} -inline void AppearanceFlags::clear_expirestop() { - _impl_.expirestop_ = false; - _impl_._has_bits_[1] &= ~0x00400000u; -} -inline bool AppearanceFlags::_internal_expirestop() const { - return _impl_.expirestop_; -} -inline bool AppearanceFlags::expirestop() const { - // @@protoc_insertion_point(field_get:Canary.protobuf.appearances.AppearanceFlags.expirestop) - return _internal_expirestop(); -} -inline void AppearanceFlags::_internal_set_expirestop(bool value) { - _impl_._has_bits_[1] |= 0x00400000u; - _impl_.expirestop_ = value; -} -inline void AppearanceFlags::set_expirestop(bool value) { - _internal_set_expirestop(value); - // @@protoc_insertion_point(field_set:Canary.protobuf.appearances.AppearanceFlags.expirestop) -} - -// ------------------------------------------------------------------- - -// AppearanceFlagUpgradeClassification - -// optional uint32 upgrade_classification = 1; -inline bool AppearanceFlagUpgradeClassification::_internal_has_upgrade_classification() const { - bool value = (_impl_._has_bits_[0] & 0x00000001u) != 0; - return value; -} -inline bool AppearanceFlagUpgradeClassification::has_upgrade_classification() const { - return _internal_has_upgrade_classification(); -} -inline void AppearanceFlagUpgradeClassification::clear_upgrade_classification() { - _impl_.upgrade_classification_ = 0u; - _impl_._has_bits_[0] &= ~0x00000001u; -} -inline uint32_t AppearanceFlagUpgradeClassification::_internal_upgrade_classification() const { - return _impl_.upgrade_classification_; -} -inline uint32_t AppearanceFlagUpgradeClassification::upgrade_classification() const { - // @@protoc_insertion_point(field_get:Canary.protobuf.appearances.AppearanceFlagUpgradeClassification.upgrade_classification) - return _internal_upgrade_classification(); -} -inline void AppearanceFlagUpgradeClassification::_internal_set_upgrade_classification(uint32_t value) { - _impl_._has_bits_[0] |= 0x00000001u; - _impl_.upgrade_classification_ = value; -} -inline void AppearanceFlagUpgradeClassification::set_upgrade_classification(uint32_t value) { - _internal_set_upgrade_classification(value); - // @@protoc_insertion_point(field_set:Canary.protobuf.appearances.AppearanceFlagUpgradeClassification.upgrade_classification) -} - -// ------------------------------------------------------------------- - -// AppearanceFlagBank - -// optional uint32 waypoints = 1; -inline bool AppearanceFlagBank::_internal_has_waypoints() const { - bool value = (_impl_._has_bits_[0] & 0x00000001u) != 0; - return value; -} -inline bool AppearanceFlagBank::has_waypoints() const { - return _internal_has_waypoints(); -} -inline void AppearanceFlagBank::clear_waypoints() { - _impl_.waypoints_ = 0u; - _impl_._has_bits_[0] &= ~0x00000001u; -} -inline uint32_t AppearanceFlagBank::_internal_waypoints() const { - return _impl_.waypoints_; -} -inline uint32_t AppearanceFlagBank::waypoints() const { - // @@protoc_insertion_point(field_get:Canary.protobuf.appearances.AppearanceFlagBank.waypoints) - return _internal_waypoints(); -} -inline void AppearanceFlagBank::_internal_set_waypoints(uint32_t value) { - _impl_._has_bits_[0] |= 0x00000001u; - _impl_.waypoints_ = value; -} -inline void AppearanceFlagBank::set_waypoints(uint32_t value) { - _internal_set_waypoints(value); - // @@protoc_insertion_point(field_set:Canary.protobuf.appearances.AppearanceFlagBank.waypoints) -} - -// ------------------------------------------------------------------- - -// AppearanceFlagWrite - -// optional uint32 max_text_length = 1; -inline bool AppearanceFlagWrite::_internal_has_max_text_length() const { - bool value = (_impl_._has_bits_[0] & 0x00000001u) != 0; - return value; -} -inline bool AppearanceFlagWrite::has_max_text_length() const { - return _internal_has_max_text_length(); -} -inline void AppearanceFlagWrite::clear_max_text_length() { - _impl_.max_text_length_ = 0u; - _impl_._has_bits_[0] &= ~0x00000001u; -} -inline uint32_t AppearanceFlagWrite::_internal_max_text_length() const { - return _impl_.max_text_length_; -} -inline uint32_t AppearanceFlagWrite::max_text_length() const { - // @@protoc_insertion_point(field_get:Canary.protobuf.appearances.AppearanceFlagWrite.max_text_length) - return _internal_max_text_length(); -} -inline void AppearanceFlagWrite::_internal_set_max_text_length(uint32_t value) { - _impl_._has_bits_[0] |= 0x00000001u; - _impl_.max_text_length_ = value; -} -inline void AppearanceFlagWrite::set_max_text_length(uint32_t value) { - _internal_set_max_text_length(value); - // @@protoc_insertion_point(field_set:Canary.protobuf.appearances.AppearanceFlagWrite.max_text_length) -} - -// ------------------------------------------------------------------- - -// AppearanceFlagWriteOnce - -// optional uint32 max_text_length_once = 1; -inline bool AppearanceFlagWriteOnce::_internal_has_max_text_length_once() const { - bool value = (_impl_._has_bits_[0] & 0x00000001u) != 0; - return value; -} -inline bool AppearanceFlagWriteOnce::has_max_text_length_once() const { - return _internal_has_max_text_length_once(); -} -inline void AppearanceFlagWriteOnce::clear_max_text_length_once() { - _impl_.max_text_length_once_ = 0u; - _impl_._has_bits_[0] &= ~0x00000001u; -} -inline uint32_t AppearanceFlagWriteOnce::_internal_max_text_length_once() const { - return _impl_.max_text_length_once_; -} -inline uint32_t AppearanceFlagWriteOnce::max_text_length_once() const { - // @@protoc_insertion_point(field_get:Canary.protobuf.appearances.AppearanceFlagWriteOnce.max_text_length_once) - return _internal_max_text_length_once(); -} -inline void AppearanceFlagWriteOnce::_internal_set_max_text_length_once(uint32_t value) { - _impl_._has_bits_[0] |= 0x00000001u; - _impl_.max_text_length_once_ = value; -} -inline void AppearanceFlagWriteOnce::set_max_text_length_once(uint32_t value) { - _internal_set_max_text_length_once(value); - // @@protoc_insertion_point(field_set:Canary.protobuf.appearances.AppearanceFlagWriteOnce.max_text_length_once) -} - -// ------------------------------------------------------------------- - -// AppearanceFlagLight - -// optional uint32 brightness = 1; -inline bool AppearanceFlagLight::_internal_has_brightness() const { - bool value = (_impl_._has_bits_[0] & 0x00000001u) != 0; - return value; -} -inline bool AppearanceFlagLight::has_brightness() const { - return _internal_has_brightness(); -} -inline void AppearanceFlagLight::clear_brightness() { - _impl_.brightness_ = 0u; - _impl_._has_bits_[0] &= ~0x00000001u; -} -inline uint32_t AppearanceFlagLight::_internal_brightness() const { - return _impl_.brightness_; -} -inline uint32_t AppearanceFlagLight::brightness() const { - // @@protoc_insertion_point(field_get:Canary.protobuf.appearances.AppearanceFlagLight.brightness) - return _internal_brightness(); -} -inline void AppearanceFlagLight::_internal_set_brightness(uint32_t value) { - _impl_._has_bits_[0] |= 0x00000001u; - _impl_.brightness_ = value; -} -inline void AppearanceFlagLight::set_brightness(uint32_t value) { - _internal_set_brightness(value); - // @@protoc_insertion_point(field_set:Canary.protobuf.appearances.AppearanceFlagLight.brightness) -} - -// optional uint32 color = 2; -inline bool AppearanceFlagLight::_internal_has_color() const { - bool value = (_impl_._has_bits_[0] & 0x00000002u) != 0; - return value; -} -inline bool AppearanceFlagLight::has_color() const { - return _internal_has_color(); -} -inline void AppearanceFlagLight::clear_color() { - _impl_.color_ = 0u; - _impl_._has_bits_[0] &= ~0x00000002u; -} -inline uint32_t AppearanceFlagLight::_internal_color() const { - return _impl_.color_; -} -inline uint32_t AppearanceFlagLight::color() const { - // @@protoc_insertion_point(field_get:Canary.protobuf.appearances.AppearanceFlagLight.color) - return _internal_color(); -} -inline void AppearanceFlagLight::_internal_set_color(uint32_t value) { - _impl_._has_bits_[0] |= 0x00000002u; - _impl_.color_ = value; -} -inline void AppearanceFlagLight::set_color(uint32_t value) { - _internal_set_color(value); - // @@protoc_insertion_point(field_set:Canary.protobuf.appearances.AppearanceFlagLight.color) -} - -// ------------------------------------------------------------------- - -// AppearanceFlagHeight - -// optional uint32 elevation = 1; -inline bool AppearanceFlagHeight::_internal_has_elevation() const { - bool value = (_impl_._has_bits_[0] & 0x00000001u) != 0; - return value; -} -inline bool AppearanceFlagHeight::has_elevation() const { - return _internal_has_elevation(); -} -inline void AppearanceFlagHeight::clear_elevation() { - _impl_.elevation_ = 0u; - _impl_._has_bits_[0] &= ~0x00000001u; -} -inline uint32_t AppearanceFlagHeight::_internal_elevation() const { - return _impl_.elevation_; -} -inline uint32_t AppearanceFlagHeight::elevation() const { - // @@protoc_insertion_point(field_get:Canary.protobuf.appearances.AppearanceFlagHeight.elevation) - return _internal_elevation(); -} -inline void AppearanceFlagHeight::_internal_set_elevation(uint32_t value) { - _impl_._has_bits_[0] |= 0x00000001u; - _impl_.elevation_ = value; -} -inline void AppearanceFlagHeight::set_elevation(uint32_t value) { - _internal_set_elevation(value); - // @@protoc_insertion_point(field_set:Canary.protobuf.appearances.AppearanceFlagHeight.elevation) -} - -// ------------------------------------------------------------------- - -// AppearanceFlagShift - -// optional uint32 x = 1; -inline bool AppearanceFlagShift::_internal_has_x() const { - bool value = (_impl_._has_bits_[0] & 0x00000001u) != 0; - return value; -} -inline bool AppearanceFlagShift::has_x() const { - return _internal_has_x(); -} -inline void AppearanceFlagShift::clear_x() { - _impl_.x_ = 0u; - _impl_._has_bits_[0] &= ~0x00000001u; -} -inline uint32_t AppearanceFlagShift::_internal_x() const { - return _impl_.x_; -} -inline uint32_t AppearanceFlagShift::x() const { - // @@protoc_insertion_point(field_get:Canary.protobuf.appearances.AppearanceFlagShift.x) - return _internal_x(); -} -inline void AppearanceFlagShift::_internal_set_x(uint32_t value) { - _impl_._has_bits_[0] |= 0x00000001u; - _impl_.x_ = value; -} -inline void AppearanceFlagShift::set_x(uint32_t value) { - _internal_set_x(value); - // @@protoc_insertion_point(field_set:Canary.protobuf.appearances.AppearanceFlagShift.x) -} - -// optional uint32 y = 2; -inline bool AppearanceFlagShift::_internal_has_y() const { - bool value = (_impl_._has_bits_[0] & 0x00000002u) != 0; - return value; -} -inline bool AppearanceFlagShift::has_y() const { - return _internal_has_y(); -} -inline void AppearanceFlagShift::clear_y() { - _impl_.y_ = 0u; - _impl_._has_bits_[0] &= ~0x00000002u; -} -inline uint32_t AppearanceFlagShift::_internal_y() const { - return _impl_.y_; -} -inline uint32_t AppearanceFlagShift::y() const { - // @@protoc_insertion_point(field_get:Canary.protobuf.appearances.AppearanceFlagShift.y) - return _internal_y(); -} -inline void AppearanceFlagShift::_internal_set_y(uint32_t value) { - _impl_._has_bits_[0] |= 0x00000002u; - _impl_.y_ = value; -} -inline void AppearanceFlagShift::set_y(uint32_t value) { - _internal_set_y(value); - // @@protoc_insertion_point(field_set:Canary.protobuf.appearances.AppearanceFlagShift.y) -} - -// ------------------------------------------------------------------- - -// AppearanceFlagClothes - -// optional uint32 slot = 1; -inline bool AppearanceFlagClothes::_internal_has_slot() const { - bool value = (_impl_._has_bits_[0] & 0x00000001u) != 0; - return value; -} -inline bool AppearanceFlagClothes::has_slot() const { - return _internal_has_slot(); -} -inline void AppearanceFlagClothes::clear_slot() { - _impl_.slot_ = 0u; - _impl_._has_bits_[0] &= ~0x00000001u; -} -inline uint32_t AppearanceFlagClothes::_internal_slot() const { - return _impl_.slot_; -} -inline uint32_t AppearanceFlagClothes::slot() const { - // @@protoc_insertion_point(field_get:Canary.protobuf.appearances.AppearanceFlagClothes.slot) - return _internal_slot(); -} -inline void AppearanceFlagClothes::_internal_set_slot(uint32_t value) { - _impl_._has_bits_[0] |= 0x00000001u; - _impl_.slot_ = value; -} -inline void AppearanceFlagClothes::set_slot(uint32_t value) { - _internal_set_slot(value); - // @@protoc_insertion_point(field_set:Canary.protobuf.appearances.AppearanceFlagClothes.slot) -} - -// ------------------------------------------------------------------- - -// AppearanceFlagDefaultAction - -// optional .Canary.protobuf.appearances.PLAYER_ACTION action = 1; -inline bool AppearanceFlagDefaultAction::_internal_has_action() const { - bool value = (_impl_._has_bits_[0] & 0x00000001u) != 0; - return value; -} -inline bool AppearanceFlagDefaultAction::has_action() const { - return _internal_has_action(); -} -inline void AppearanceFlagDefaultAction::clear_action() { - _impl_.action_ = 0; - _impl_._has_bits_[0] &= ~0x00000001u; -} -inline ::Canary::protobuf::appearances::PLAYER_ACTION AppearanceFlagDefaultAction::_internal_action() const { - return static_cast< ::Canary::protobuf::appearances::PLAYER_ACTION >(_impl_.action_); -} -inline ::Canary::protobuf::appearances::PLAYER_ACTION AppearanceFlagDefaultAction::action() const { - // @@protoc_insertion_point(field_get:Canary.protobuf.appearances.AppearanceFlagDefaultAction.action) - return _internal_action(); -} -inline void AppearanceFlagDefaultAction::_internal_set_action(::Canary::protobuf::appearances::PLAYER_ACTION value) { - assert(::Canary::protobuf::appearances::PLAYER_ACTION_IsValid(value)); - _impl_._has_bits_[0] |= 0x00000001u; - _impl_.action_ = value; -} -inline void AppearanceFlagDefaultAction::set_action(::Canary::protobuf::appearances::PLAYER_ACTION value) { - _internal_set_action(value); - // @@protoc_insertion_point(field_set:Canary.protobuf.appearances.AppearanceFlagDefaultAction.action) -} - -// ------------------------------------------------------------------- - -// AppearanceFlagMarket - -// optional .Canary.protobuf.appearances.ITEM_CATEGORY category = 1; -inline bool AppearanceFlagMarket::_internal_has_category() const { - bool value = (_impl_._has_bits_[0] & 0x00000008u) != 0; - return value; -} -inline bool AppearanceFlagMarket::has_category() const { - return _internal_has_category(); -} -inline void AppearanceFlagMarket::clear_category() { - _impl_.category_ = 1; - _impl_._has_bits_[0] &= ~0x00000008u; -} -inline ::Canary::protobuf::appearances::ITEM_CATEGORY AppearanceFlagMarket::_internal_category() const { - return static_cast< ::Canary::protobuf::appearances::ITEM_CATEGORY >(_impl_.category_); -} -inline ::Canary::protobuf::appearances::ITEM_CATEGORY AppearanceFlagMarket::category() const { - // @@protoc_insertion_point(field_get:Canary.protobuf.appearances.AppearanceFlagMarket.category) - return _internal_category(); -} -inline void AppearanceFlagMarket::_internal_set_category(::Canary::protobuf::appearances::ITEM_CATEGORY value) { - assert(::Canary::protobuf::appearances::ITEM_CATEGORY_IsValid(value)); - _impl_._has_bits_[0] |= 0x00000008u; - _impl_.category_ = value; -} -inline void AppearanceFlagMarket::set_category(::Canary::protobuf::appearances::ITEM_CATEGORY value) { - _internal_set_category(value); - // @@protoc_insertion_point(field_set:Canary.protobuf.appearances.AppearanceFlagMarket.category) -} - -// optional uint32 trade_as_object_id = 2; -inline bool AppearanceFlagMarket::_internal_has_trade_as_object_id() const { - bool value = (_impl_._has_bits_[0] & 0x00000001u) != 0; - return value; -} -inline bool AppearanceFlagMarket::has_trade_as_object_id() const { - return _internal_has_trade_as_object_id(); -} -inline void AppearanceFlagMarket::clear_trade_as_object_id() { - _impl_.trade_as_object_id_ = 0u; - _impl_._has_bits_[0] &= ~0x00000001u; -} -inline uint32_t AppearanceFlagMarket::_internal_trade_as_object_id() const { - return _impl_.trade_as_object_id_; -} -inline uint32_t AppearanceFlagMarket::trade_as_object_id() const { - // @@protoc_insertion_point(field_get:Canary.protobuf.appearances.AppearanceFlagMarket.trade_as_object_id) - return _internal_trade_as_object_id(); -} -inline void AppearanceFlagMarket::_internal_set_trade_as_object_id(uint32_t value) { - _impl_._has_bits_[0] |= 0x00000001u; - _impl_.trade_as_object_id_ = value; -} -inline void AppearanceFlagMarket::set_trade_as_object_id(uint32_t value) { - _internal_set_trade_as_object_id(value); - // @@protoc_insertion_point(field_set:Canary.protobuf.appearances.AppearanceFlagMarket.trade_as_object_id) -} - -// optional uint32 show_as_object_id = 3; -inline bool AppearanceFlagMarket::_internal_has_show_as_object_id() const { - bool value = (_impl_._has_bits_[0] & 0x00000002u) != 0; - return value; -} -inline bool AppearanceFlagMarket::has_show_as_object_id() const { - return _internal_has_show_as_object_id(); -} -inline void AppearanceFlagMarket::clear_show_as_object_id() { - _impl_.show_as_object_id_ = 0u; - _impl_._has_bits_[0] &= ~0x00000002u; -} -inline uint32_t AppearanceFlagMarket::_internal_show_as_object_id() const { - return _impl_.show_as_object_id_; -} -inline uint32_t AppearanceFlagMarket::show_as_object_id() const { - // @@protoc_insertion_point(field_get:Canary.protobuf.appearances.AppearanceFlagMarket.show_as_object_id) - return _internal_show_as_object_id(); -} -inline void AppearanceFlagMarket::_internal_set_show_as_object_id(uint32_t value) { - _impl_._has_bits_[0] |= 0x00000002u; - _impl_.show_as_object_id_ = value; -} -inline void AppearanceFlagMarket::set_show_as_object_id(uint32_t value) { - _internal_set_show_as_object_id(value); - // @@protoc_insertion_point(field_set:Canary.protobuf.appearances.AppearanceFlagMarket.show_as_object_id) -} - -// repeated .Canary.protobuf.appearances.PLAYER_PROFESSION restrict_to_profession = 5; -inline int AppearanceFlagMarket::_internal_restrict_to_profession_size() const { - return _impl_.restrict_to_profession_.size(); -} -inline int AppearanceFlagMarket::restrict_to_profession_size() const { - return _internal_restrict_to_profession_size(); -} -inline void AppearanceFlagMarket::clear_restrict_to_profession() { - _impl_.restrict_to_profession_.Clear(); -} -inline ::Canary::protobuf::appearances::PLAYER_PROFESSION AppearanceFlagMarket::_internal_restrict_to_profession(int index) const { - return static_cast< ::Canary::protobuf::appearances::PLAYER_PROFESSION >(_impl_.restrict_to_profession_.Get(index)); -} -inline ::Canary::protobuf::appearances::PLAYER_PROFESSION AppearanceFlagMarket::restrict_to_profession(int index) const { - // @@protoc_insertion_point(field_get:Canary.protobuf.appearances.AppearanceFlagMarket.restrict_to_profession) - return _internal_restrict_to_profession(index); -} -inline void AppearanceFlagMarket::set_restrict_to_profession(int index, ::Canary::protobuf::appearances::PLAYER_PROFESSION value) { - assert(::Canary::protobuf::appearances::PLAYER_PROFESSION_IsValid(value)); - _impl_.restrict_to_profession_.Set(index, value); - // @@protoc_insertion_point(field_set:Canary.protobuf.appearances.AppearanceFlagMarket.restrict_to_profession) -} -inline void AppearanceFlagMarket::_internal_add_restrict_to_profession(::Canary::protobuf::appearances::PLAYER_PROFESSION value) { - assert(::Canary::protobuf::appearances::PLAYER_PROFESSION_IsValid(value)); - _impl_.restrict_to_profession_.Add(value); -} -inline void AppearanceFlagMarket::add_restrict_to_profession(::Canary::protobuf::appearances::PLAYER_PROFESSION value) { - _internal_add_restrict_to_profession(value); - // @@protoc_insertion_point(field_add:Canary.protobuf.appearances.AppearanceFlagMarket.restrict_to_profession) -} -inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField& -AppearanceFlagMarket::restrict_to_profession() const { - // @@protoc_insertion_point(field_list:Canary.protobuf.appearances.AppearanceFlagMarket.restrict_to_profession) - return _impl_.restrict_to_profession_; -} -inline ::PROTOBUF_NAMESPACE_ID::RepeatedField* -AppearanceFlagMarket::_internal_mutable_restrict_to_profession() { - return &_impl_.restrict_to_profession_; -} -inline ::PROTOBUF_NAMESPACE_ID::RepeatedField* -AppearanceFlagMarket::mutable_restrict_to_profession() { - // @@protoc_insertion_point(field_mutable_list:Canary.protobuf.appearances.AppearanceFlagMarket.restrict_to_profession) - return _internal_mutable_restrict_to_profession(); -} - -// optional uint32 minimum_level = 6; -inline bool AppearanceFlagMarket::_internal_has_minimum_level() const { - bool value = (_impl_._has_bits_[0] & 0x00000004u) != 0; - return value; -} -inline bool AppearanceFlagMarket::has_minimum_level() const { - return _internal_has_minimum_level(); -} -inline void AppearanceFlagMarket::clear_minimum_level() { - _impl_.minimum_level_ = 0u; - _impl_._has_bits_[0] &= ~0x00000004u; -} -inline uint32_t AppearanceFlagMarket::_internal_minimum_level() const { - return _impl_.minimum_level_; -} -inline uint32_t AppearanceFlagMarket::minimum_level() const { - // @@protoc_insertion_point(field_get:Canary.protobuf.appearances.AppearanceFlagMarket.minimum_level) - return _internal_minimum_level(); -} -inline void AppearanceFlagMarket::_internal_set_minimum_level(uint32_t value) { - _impl_._has_bits_[0] |= 0x00000004u; - _impl_.minimum_level_ = value; -} -inline void AppearanceFlagMarket::set_minimum_level(uint32_t value) { - _internal_set_minimum_level(value); - // @@protoc_insertion_point(field_set:Canary.protobuf.appearances.AppearanceFlagMarket.minimum_level) -} - -// ------------------------------------------------------------------- - -// AppearanceFlagNPC - -// optional bytes name = 1; -inline bool AppearanceFlagNPC::_internal_has_name() const { - bool value = (_impl_._has_bits_[0] & 0x00000001u) != 0; - return value; -} -inline bool AppearanceFlagNPC::has_name() const { - return _internal_has_name(); -} -inline void AppearanceFlagNPC::clear_name() { - _impl_.name_.ClearToEmpty(); - _impl_._has_bits_[0] &= ~0x00000001u; -} -inline const std::string& AppearanceFlagNPC::name() const { - // @@protoc_insertion_point(field_get:Canary.protobuf.appearances.AppearanceFlagNPC.name) - return _internal_name(); -} -template -inline PROTOBUF_ALWAYS_INLINE -void AppearanceFlagNPC::set_name(ArgT0&& arg0, ArgT... args) { - _impl_._has_bits_[0] |= 0x00000001u; - _impl_.name_.SetBytes(static_cast(arg0), args..., GetArenaForAllocation()); - // @@protoc_insertion_point(field_set:Canary.protobuf.appearances.AppearanceFlagNPC.name) -} -inline std::string* AppearanceFlagNPC::mutable_name() { - std::string* _s = _internal_mutable_name(); - // @@protoc_insertion_point(field_mutable:Canary.protobuf.appearances.AppearanceFlagNPC.name) - return _s; -} -inline const std::string& AppearanceFlagNPC::_internal_name() const { - return _impl_.name_.Get(); -} -inline void AppearanceFlagNPC::_internal_set_name(const std::string& value) { - _impl_._has_bits_[0] |= 0x00000001u; - _impl_.name_.Set(value, GetArenaForAllocation()); -} -inline std::string* AppearanceFlagNPC::_internal_mutable_name() { - _impl_._has_bits_[0] |= 0x00000001u; - return _impl_.name_.Mutable(GetArenaForAllocation()); -} -inline std::string* AppearanceFlagNPC::release_name() { - // @@protoc_insertion_point(field_release:Canary.protobuf.appearances.AppearanceFlagNPC.name) - if (!_internal_has_name()) { - return nullptr; - } - _impl_._has_bits_[0] &= ~0x00000001u; - auto* p = _impl_.name_.Release(); -#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING - if (_impl_.name_.IsDefault()) { - _impl_.name_.Set("", GetArenaForAllocation()); - } -#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING - return p; -} -inline void AppearanceFlagNPC::set_allocated_name(std::string* name) { - if (name != nullptr) { - _impl_._has_bits_[0] |= 0x00000001u; - } else { - _impl_._has_bits_[0] &= ~0x00000001u; - } - _impl_.name_.SetAllocated(name, GetArenaForAllocation()); -#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING - if (_impl_.name_.IsDefault()) { - _impl_.name_.Set("", GetArenaForAllocation()); - } -#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING - // @@protoc_insertion_point(field_set_allocated:Canary.protobuf.appearances.AppearanceFlagNPC.name) -} - -// optional bytes location = 2; -inline bool AppearanceFlagNPC::_internal_has_location() const { - bool value = (_impl_._has_bits_[0] & 0x00000002u) != 0; - return value; -} -inline bool AppearanceFlagNPC::has_location() const { - return _internal_has_location(); -} -inline void AppearanceFlagNPC::clear_location() { - _impl_.location_.ClearToEmpty(); - _impl_._has_bits_[0] &= ~0x00000002u; -} -inline const std::string& AppearanceFlagNPC::location() const { - // @@protoc_insertion_point(field_get:Canary.protobuf.appearances.AppearanceFlagNPC.location) - return _internal_location(); -} -template -inline PROTOBUF_ALWAYS_INLINE -void AppearanceFlagNPC::set_location(ArgT0&& arg0, ArgT... args) { - _impl_._has_bits_[0] |= 0x00000002u; - _impl_.location_.SetBytes(static_cast(arg0), args..., GetArenaForAllocation()); - // @@protoc_insertion_point(field_set:Canary.protobuf.appearances.AppearanceFlagNPC.location) -} -inline std::string* AppearanceFlagNPC::mutable_location() { - std::string* _s = _internal_mutable_location(); - // @@protoc_insertion_point(field_mutable:Canary.protobuf.appearances.AppearanceFlagNPC.location) - return _s; -} -inline const std::string& AppearanceFlagNPC::_internal_location() const { - return _impl_.location_.Get(); -} -inline void AppearanceFlagNPC::_internal_set_location(const std::string& value) { - _impl_._has_bits_[0] |= 0x00000002u; - _impl_.location_.Set(value, GetArenaForAllocation()); -} -inline std::string* AppearanceFlagNPC::_internal_mutable_location() { - _impl_._has_bits_[0] |= 0x00000002u; - return _impl_.location_.Mutable(GetArenaForAllocation()); -} -inline std::string* AppearanceFlagNPC::release_location() { - // @@protoc_insertion_point(field_release:Canary.protobuf.appearances.AppearanceFlagNPC.location) - if (!_internal_has_location()) { - return nullptr; - } - _impl_._has_bits_[0] &= ~0x00000002u; - auto* p = _impl_.location_.Release(); -#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING - if (_impl_.location_.IsDefault()) { - _impl_.location_.Set("", GetArenaForAllocation()); - } -#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING - return p; -} -inline void AppearanceFlagNPC::set_allocated_location(std::string* location) { - if (location != nullptr) { - _impl_._has_bits_[0] |= 0x00000002u; - } else { - _impl_._has_bits_[0] &= ~0x00000002u; - } - _impl_.location_.SetAllocated(location, GetArenaForAllocation()); -#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING - if (_impl_.location_.IsDefault()) { - _impl_.location_.Set("", GetArenaForAllocation()); - } -#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING - // @@protoc_insertion_point(field_set_allocated:Canary.protobuf.appearances.AppearanceFlagNPC.location) -} - -// optional uint32 sale_price = 3; -inline bool AppearanceFlagNPC::_internal_has_sale_price() const { - bool value = (_impl_._has_bits_[0] & 0x00000008u) != 0; - return value; -} -inline bool AppearanceFlagNPC::has_sale_price() const { - return _internal_has_sale_price(); -} -inline void AppearanceFlagNPC::clear_sale_price() { - _impl_.sale_price_ = 0u; - _impl_._has_bits_[0] &= ~0x00000008u; -} -inline uint32_t AppearanceFlagNPC::_internal_sale_price() const { - return _impl_.sale_price_; -} -inline uint32_t AppearanceFlagNPC::sale_price() const { - // @@protoc_insertion_point(field_get:Canary.protobuf.appearances.AppearanceFlagNPC.sale_price) - return _internal_sale_price(); -} -inline void AppearanceFlagNPC::_internal_set_sale_price(uint32_t value) { - _impl_._has_bits_[0] |= 0x00000008u; - _impl_.sale_price_ = value; -} -inline void AppearanceFlagNPC::set_sale_price(uint32_t value) { - _internal_set_sale_price(value); - // @@protoc_insertion_point(field_set:Canary.protobuf.appearances.AppearanceFlagNPC.sale_price) -} - -// optional uint32 buy_price = 4; -inline bool AppearanceFlagNPC::_internal_has_buy_price() const { - bool value = (_impl_._has_bits_[0] & 0x00000010u) != 0; - return value; -} -inline bool AppearanceFlagNPC::has_buy_price() const { - return _internal_has_buy_price(); -} -inline void AppearanceFlagNPC::clear_buy_price() { - _impl_.buy_price_ = 0u; - _impl_._has_bits_[0] &= ~0x00000010u; -} -inline uint32_t AppearanceFlagNPC::_internal_buy_price() const { - return _impl_.buy_price_; -} -inline uint32_t AppearanceFlagNPC::buy_price() const { - // @@protoc_insertion_point(field_get:Canary.protobuf.appearances.AppearanceFlagNPC.buy_price) - return _internal_buy_price(); -} -inline void AppearanceFlagNPC::_internal_set_buy_price(uint32_t value) { - _impl_._has_bits_[0] |= 0x00000010u; - _impl_.buy_price_ = value; -} -inline void AppearanceFlagNPC::set_buy_price(uint32_t value) { - _internal_set_buy_price(value); - // @@protoc_insertion_point(field_set:Canary.protobuf.appearances.AppearanceFlagNPC.buy_price) -} - -// optional uint32 currency_object_type_id = 5; -inline bool AppearanceFlagNPC::_internal_has_currency_object_type_id() const { - bool value = (_impl_._has_bits_[0] & 0x00000020u) != 0; - return value; -} -inline bool AppearanceFlagNPC::has_currency_object_type_id() const { - return _internal_has_currency_object_type_id(); -} -inline void AppearanceFlagNPC::clear_currency_object_type_id() { - _impl_.currency_object_type_id_ = 0u; - _impl_._has_bits_[0] &= ~0x00000020u; -} -inline uint32_t AppearanceFlagNPC::_internal_currency_object_type_id() const { - return _impl_.currency_object_type_id_; -} -inline uint32_t AppearanceFlagNPC::currency_object_type_id() const { - // @@protoc_insertion_point(field_get:Canary.protobuf.appearances.AppearanceFlagNPC.currency_object_type_id) - return _internal_currency_object_type_id(); -} -inline void AppearanceFlagNPC::_internal_set_currency_object_type_id(uint32_t value) { - _impl_._has_bits_[0] |= 0x00000020u; - _impl_.currency_object_type_id_ = value; -} -inline void AppearanceFlagNPC::set_currency_object_type_id(uint32_t value) { - _internal_set_currency_object_type_id(value); - // @@protoc_insertion_point(field_set:Canary.protobuf.appearances.AppearanceFlagNPC.currency_object_type_id) -} - -// optional bytes currency_quest_flag_display_name = 6; -inline bool AppearanceFlagNPC::_internal_has_currency_quest_flag_display_name() const { - bool value = (_impl_._has_bits_[0] & 0x00000004u) != 0; - return value; -} -inline bool AppearanceFlagNPC::has_currency_quest_flag_display_name() const { - return _internal_has_currency_quest_flag_display_name(); -} -inline void AppearanceFlagNPC::clear_currency_quest_flag_display_name() { - _impl_.currency_quest_flag_display_name_.ClearToEmpty(); - _impl_._has_bits_[0] &= ~0x00000004u; -} -inline const std::string& AppearanceFlagNPC::currency_quest_flag_display_name() const { - // @@protoc_insertion_point(field_get:Canary.protobuf.appearances.AppearanceFlagNPC.currency_quest_flag_display_name) - return _internal_currency_quest_flag_display_name(); -} -template -inline PROTOBUF_ALWAYS_INLINE -void AppearanceFlagNPC::set_currency_quest_flag_display_name(ArgT0&& arg0, ArgT... args) { - _impl_._has_bits_[0] |= 0x00000004u; - _impl_.currency_quest_flag_display_name_.SetBytes(static_cast(arg0), args..., GetArenaForAllocation()); - // @@protoc_insertion_point(field_set:Canary.protobuf.appearances.AppearanceFlagNPC.currency_quest_flag_display_name) -} -inline std::string* AppearanceFlagNPC::mutable_currency_quest_flag_display_name() { - std::string* _s = _internal_mutable_currency_quest_flag_display_name(); - // @@protoc_insertion_point(field_mutable:Canary.protobuf.appearances.AppearanceFlagNPC.currency_quest_flag_display_name) - return _s; -} -inline const std::string& AppearanceFlagNPC::_internal_currency_quest_flag_display_name() const { - return _impl_.currency_quest_flag_display_name_.Get(); -} -inline void AppearanceFlagNPC::_internal_set_currency_quest_flag_display_name(const std::string& value) { - _impl_._has_bits_[0] |= 0x00000004u; - _impl_.currency_quest_flag_display_name_.Set(value, GetArenaForAllocation()); -} -inline std::string* AppearanceFlagNPC::_internal_mutable_currency_quest_flag_display_name() { - _impl_._has_bits_[0] |= 0x00000004u; - return _impl_.currency_quest_flag_display_name_.Mutable(GetArenaForAllocation()); -} -inline std::string* AppearanceFlagNPC::release_currency_quest_flag_display_name() { - // @@protoc_insertion_point(field_release:Canary.protobuf.appearances.AppearanceFlagNPC.currency_quest_flag_display_name) - if (!_internal_has_currency_quest_flag_display_name()) { - return nullptr; - } - _impl_._has_bits_[0] &= ~0x00000004u; - auto* p = _impl_.currency_quest_flag_display_name_.Release(); -#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING - if (_impl_.currency_quest_flag_display_name_.IsDefault()) { - _impl_.currency_quest_flag_display_name_.Set("", GetArenaForAllocation()); - } -#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING - return p; -} -inline void AppearanceFlagNPC::set_allocated_currency_quest_flag_display_name(std::string* currency_quest_flag_display_name) { - if (currency_quest_flag_display_name != nullptr) { - _impl_._has_bits_[0] |= 0x00000004u; - } else { - _impl_._has_bits_[0] &= ~0x00000004u; - } - _impl_.currency_quest_flag_display_name_.SetAllocated(currency_quest_flag_display_name, GetArenaForAllocation()); -#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING - if (_impl_.currency_quest_flag_display_name_.IsDefault()) { - _impl_.currency_quest_flag_display_name_.Set("", GetArenaForAllocation()); - } -#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING - // @@protoc_insertion_point(field_set_allocated:Canary.protobuf.appearances.AppearanceFlagNPC.currency_quest_flag_display_name) -} - -// ------------------------------------------------------------------- - -// AppearanceFlagAutomap - -// optional uint32 color = 1; -inline bool AppearanceFlagAutomap::_internal_has_color() const { - bool value = (_impl_._has_bits_[0] & 0x00000001u) != 0; - return value; -} -inline bool AppearanceFlagAutomap::has_color() const { - return _internal_has_color(); -} -inline void AppearanceFlagAutomap::clear_color() { - _impl_.color_ = 0u; - _impl_._has_bits_[0] &= ~0x00000001u; -} -inline uint32_t AppearanceFlagAutomap::_internal_color() const { - return _impl_.color_; -} -inline uint32_t AppearanceFlagAutomap::color() const { - // @@protoc_insertion_point(field_get:Canary.protobuf.appearances.AppearanceFlagAutomap.color) - return _internal_color(); -} -inline void AppearanceFlagAutomap::_internal_set_color(uint32_t value) { - _impl_._has_bits_[0] |= 0x00000001u; - _impl_.color_ = value; -} -inline void AppearanceFlagAutomap::set_color(uint32_t value) { - _internal_set_color(value); - // @@protoc_insertion_point(field_set:Canary.protobuf.appearances.AppearanceFlagAutomap.color) -} - -// ------------------------------------------------------------------- - -// AppearanceFlagHook - -// optional .Canary.protobuf.appearances.HOOK_TYPE direction = 1; -inline bool AppearanceFlagHook::_internal_has_direction() const { - bool value = (_impl_._has_bits_[0] & 0x00000001u) != 0; - return value; -} -inline bool AppearanceFlagHook::has_direction() const { - return _internal_has_direction(); -} -inline void AppearanceFlagHook::clear_direction() { - _impl_.direction_ = 1; - _impl_._has_bits_[0] &= ~0x00000001u; -} -inline ::Canary::protobuf::appearances::HOOK_TYPE AppearanceFlagHook::_internal_direction() const { - return static_cast< ::Canary::protobuf::appearances::HOOK_TYPE >(_impl_.direction_); -} -inline ::Canary::protobuf::appearances::HOOK_TYPE AppearanceFlagHook::direction() const { - // @@protoc_insertion_point(field_get:Canary.protobuf.appearances.AppearanceFlagHook.direction) - return _internal_direction(); -} -inline void AppearanceFlagHook::_internal_set_direction(::Canary::protobuf::appearances::HOOK_TYPE value) { - assert(::Canary::protobuf::appearances::HOOK_TYPE_IsValid(value)); - _impl_._has_bits_[0] |= 0x00000001u; - _impl_.direction_ = value; -} -inline void AppearanceFlagHook::set_direction(::Canary::protobuf::appearances::HOOK_TYPE value) { - _internal_set_direction(value); - // @@protoc_insertion_point(field_set:Canary.protobuf.appearances.AppearanceFlagHook.direction) -} - -// ------------------------------------------------------------------- - -// AppearanceFlagLenshelp - -// optional uint32 id = 1; -inline bool AppearanceFlagLenshelp::_internal_has_id() const { - bool value = (_impl_._has_bits_[0] & 0x00000001u) != 0; - return value; -} -inline bool AppearanceFlagLenshelp::has_id() const { - return _internal_has_id(); -} -inline void AppearanceFlagLenshelp::clear_id() { - _impl_.id_ = 0u; - _impl_._has_bits_[0] &= ~0x00000001u; -} -inline uint32_t AppearanceFlagLenshelp::_internal_id() const { - return _impl_.id_; -} -inline uint32_t AppearanceFlagLenshelp::id() const { - // @@protoc_insertion_point(field_get:Canary.protobuf.appearances.AppearanceFlagLenshelp.id) - return _internal_id(); -} -inline void AppearanceFlagLenshelp::_internal_set_id(uint32_t value) { - _impl_._has_bits_[0] |= 0x00000001u; - _impl_.id_ = value; -} -inline void AppearanceFlagLenshelp::set_id(uint32_t value) { - _internal_set_id(value); - // @@protoc_insertion_point(field_set:Canary.protobuf.appearances.AppearanceFlagLenshelp.id) -} - -// ------------------------------------------------------------------- - -// AppearanceFlagChangedToExpire - -// optional uint32 former_object_typeid = 1; -inline bool AppearanceFlagChangedToExpire::_internal_has_former_object_typeid() const { - bool value = (_impl_._has_bits_[0] & 0x00000001u) != 0; - return value; -} -inline bool AppearanceFlagChangedToExpire::has_former_object_typeid() const { - return _internal_has_former_object_typeid(); -} -inline void AppearanceFlagChangedToExpire::clear_former_object_typeid() { - _impl_.former_object_typeid_ = 0u; - _impl_._has_bits_[0] &= ~0x00000001u; -} -inline uint32_t AppearanceFlagChangedToExpire::_internal_former_object_typeid() const { - return _impl_.former_object_typeid_; -} -inline uint32_t AppearanceFlagChangedToExpire::former_object_typeid() const { - // @@protoc_insertion_point(field_get:Canary.protobuf.appearances.AppearanceFlagChangedToExpire.former_object_typeid) - return _internal_former_object_typeid(); -} -inline void AppearanceFlagChangedToExpire::_internal_set_former_object_typeid(uint32_t value) { - _impl_._has_bits_[0] |= 0x00000001u; - _impl_.former_object_typeid_ = value; -} -inline void AppearanceFlagChangedToExpire::set_former_object_typeid(uint32_t value) { - _internal_set_former_object_typeid(value); - // @@protoc_insertion_point(field_set:Canary.protobuf.appearances.AppearanceFlagChangedToExpire.former_object_typeid) -} - -// ------------------------------------------------------------------- - -// AppearanceFlagCyclopedia - -// optional uint32 cyclopedia_type = 1; -inline bool AppearanceFlagCyclopedia::_internal_has_cyclopedia_type() const { - bool value = (_impl_._has_bits_[0] & 0x00000001u) != 0; - return value; -} -inline bool AppearanceFlagCyclopedia::has_cyclopedia_type() const { - return _internal_has_cyclopedia_type(); -} -inline void AppearanceFlagCyclopedia::clear_cyclopedia_type() { - _impl_.cyclopedia_type_ = 0u; - _impl_._has_bits_[0] &= ~0x00000001u; -} -inline uint32_t AppearanceFlagCyclopedia::_internal_cyclopedia_type() const { - return _impl_.cyclopedia_type_; -} -inline uint32_t AppearanceFlagCyclopedia::cyclopedia_type() const { - // @@protoc_insertion_point(field_get:Canary.protobuf.appearances.AppearanceFlagCyclopedia.cyclopedia_type) - return _internal_cyclopedia_type(); -} -inline void AppearanceFlagCyclopedia::_internal_set_cyclopedia_type(uint32_t value) { - _impl_._has_bits_[0] |= 0x00000001u; - _impl_.cyclopedia_type_ = value; -} -inline void AppearanceFlagCyclopedia::set_cyclopedia_type(uint32_t value) { - _internal_set_cyclopedia_type(value); - // @@protoc_insertion_point(field_set:Canary.protobuf.appearances.AppearanceFlagCyclopedia.cyclopedia_type) -} - -// ------------------------------------------------------------------- - -// SpecialMeaningAppearanceIds - -// optional uint32 gold_coin_id = 1; -inline bool SpecialMeaningAppearanceIds::_internal_has_gold_coin_id() const { - bool value = (_impl_._has_bits_[0] & 0x00000001u) != 0; - return value; -} -inline bool SpecialMeaningAppearanceIds::has_gold_coin_id() const { - return _internal_has_gold_coin_id(); -} -inline void SpecialMeaningAppearanceIds::clear_gold_coin_id() { - _impl_.gold_coin_id_ = 0u; - _impl_._has_bits_[0] &= ~0x00000001u; -} -inline uint32_t SpecialMeaningAppearanceIds::_internal_gold_coin_id() const { - return _impl_.gold_coin_id_; -} -inline uint32_t SpecialMeaningAppearanceIds::gold_coin_id() const { - // @@protoc_insertion_point(field_get:Canary.protobuf.appearances.SpecialMeaningAppearanceIds.gold_coin_id) - return _internal_gold_coin_id(); -} -inline void SpecialMeaningAppearanceIds::_internal_set_gold_coin_id(uint32_t value) { - _impl_._has_bits_[0] |= 0x00000001u; - _impl_.gold_coin_id_ = value; -} -inline void SpecialMeaningAppearanceIds::set_gold_coin_id(uint32_t value) { - _internal_set_gold_coin_id(value); - // @@protoc_insertion_point(field_set:Canary.protobuf.appearances.SpecialMeaningAppearanceIds.gold_coin_id) -} - -// optional uint32 platinum_coin_id = 2; -inline bool SpecialMeaningAppearanceIds::_internal_has_platinum_coin_id() const { - bool value = (_impl_._has_bits_[0] & 0x00000002u) != 0; - return value; -} -inline bool SpecialMeaningAppearanceIds::has_platinum_coin_id() const { - return _internal_has_platinum_coin_id(); -} -inline void SpecialMeaningAppearanceIds::clear_platinum_coin_id() { - _impl_.platinum_coin_id_ = 0u; - _impl_._has_bits_[0] &= ~0x00000002u; -} -inline uint32_t SpecialMeaningAppearanceIds::_internal_platinum_coin_id() const { - return _impl_.platinum_coin_id_; -} -inline uint32_t SpecialMeaningAppearanceIds::platinum_coin_id() const { - // @@protoc_insertion_point(field_get:Canary.protobuf.appearances.SpecialMeaningAppearanceIds.platinum_coin_id) - return _internal_platinum_coin_id(); -} -inline void SpecialMeaningAppearanceIds::_internal_set_platinum_coin_id(uint32_t value) { - _impl_._has_bits_[0] |= 0x00000002u; - _impl_.platinum_coin_id_ = value; -} -inline void SpecialMeaningAppearanceIds::set_platinum_coin_id(uint32_t value) { - _internal_set_platinum_coin_id(value); - // @@protoc_insertion_point(field_set:Canary.protobuf.appearances.SpecialMeaningAppearanceIds.platinum_coin_id) -} - -// optional uint32 crystal_coin_id = 3; -inline bool SpecialMeaningAppearanceIds::_internal_has_crystal_coin_id() const { - bool value = (_impl_._has_bits_[0] & 0x00000004u) != 0; - return value; -} -inline bool SpecialMeaningAppearanceIds::has_crystal_coin_id() const { - return _internal_has_crystal_coin_id(); -} -inline void SpecialMeaningAppearanceIds::clear_crystal_coin_id() { - _impl_.crystal_coin_id_ = 0u; - _impl_._has_bits_[0] &= ~0x00000004u; -} -inline uint32_t SpecialMeaningAppearanceIds::_internal_crystal_coin_id() const { - return _impl_.crystal_coin_id_; -} -inline uint32_t SpecialMeaningAppearanceIds::crystal_coin_id() const { - // @@protoc_insertion_point(field_get:Canary.protobuf.appearances.SpecialMeaningAppearanceIds.crystal_coin_id) - return _internal_crystal_coin_id(); -} -inline void SpecialMeaningAppearanceIds::_internal_set_crystal_coin_id(uint32_t value) { - _impl_._has_bits_[0] |= 0x00000004u; - _impl_.crystal_coin_id_ = value; -} -inline void SpecialMeaningAppearanceIds::set_crystal_coin_id(uint32_t value) { - _internal_set_crystal_coin_id(value); - // @@protoc_insertion_point(field_set:Canary.protobuf.appearances.SpecialMeaningAppearanceIds.crystal_coin_id) -} - -// optional uint32 tibia_coin_id = 4; -inline bool SpecialMeaningAppearanceIds::_internal_has_tibia_coin_id() const { - bool value = (_impl_._has_bits_[0] & 0x00000008u) != 0; - return value; -} -inline bool SpecialMeaningAppearanceIds::has_tibia_coin_id() const { - return _internal_has_tibia_coin_id(); -} -inline void SpecialMeaningAppearanceIds::clear_tibia_coin_id() { - _impl_.tibia_coin_id_ = 0u; - _impl_._has_bits_[0] &= ~0x00000008u; -} -inline uint32_t SpecialMeaningAppearanceIds::_internal_tibia_coin_id() const { - return _impl_.tibia_coin_id_; -} -inline uint32_t SpecialMeaningAppearanceIds::tibia_coin_id() const { - // @@protoc_insertion_point(field_get:Canary.protobuf.appearances.SpecialMeaningAppearanceIds.tibia_coin_id) - return _internal_tibia_coin_id(); -} -inline void SpecialMeaningAppearanceIds::_internal_set_tibia_coin_id(uint32_t value) { - _impl_._has_bits_[0] |= 0x00000008u; - _impl_.tibia_coin_id_ = value; -} -inline void SpecialMeaningAppearanceIds::set_tibia_coin_id(uint32_t value) { - _internal_set_tibia_coin_id(value); - // @@protoc_insertion_point(field_set:Canary.protobuf.appearances.SpecialMeaningAppearanceIds.tibia_coin_id) -} - -// optional uint32 stamped_letter_id = 5; -inline bool SpecialMeaningAppearanceIds::_internal_has_stamped_letter_id() const { - bool value = (_impl_._has_bits_[0] & 0x00000010u) != 0; - return value; -} -inline bool SpecialMeaningAppearanceIds::has_stamped_letter_id() const { - return _internal_has_stamped_letter_id(); -} -inline void SpecialMeaningAppearanceIds::clear_stamped_letter_id() { - _impl_.stamped_letter_id_ = 0u; - _impl_._has_bits_[0] &= ~0x00000010u; -} -inline uint32_t SpecialMeaningAppearanceIds::_internal_stamped_letter_id() const { - return _impl_.stamped_letter_id_; -} -inline uint32_t SpecialMeaningAppearanceIds::stamped_letter_id() const { - // @@protoc_insertion_point(field_get:Canary.protobuf.appearances.SpecialMeaningAppearanceIds.stamped_letter_id) - return _internal_stamped_letter_id(); -} -inline void SpecialMeaningAppearanceIds::_internal_set_stamped_letter_id(uint32_t value) { - _impl_._has_bits_[0] |= 0x00000010u; - _impl_.stamped_letter_id_ = value; -} -inline void SpecialMeaningAppearanceIds::set_stamped_letter_id(uint32_t value) { - _internal_set_stamped_letter_id(value); - // @@protoc_insertion_point(field_set:Canary.protobuf.appearances.SpecialMeaningAppearanceIds.stamped_letter_id) -} - -// optional uint32 supply_stash_id = 6; -inline bool SpecialMeaningAppearanceIds::_internal_has_supply_stash_id() const { - bool value = (_impl_._has_bits_[0] & 0x00000020u) != 0; - return value; -} -inline bool SpecialMeaningAppearanceIds::has_supply_stash_id() const { - return _internal_has_supply_stash_id(); -} -inline void SpecialMeaningAppearanceIds::clear_supply_stash_id() { - _impl_.supply_stash_id_ = 0u; - _impl_._has_bits_[0] &= ~0x00000020u; -} -inline uint32_t SpecialMeaningAppearanceIds::_internal_supply_stash_id() const { - return _impl_.supply_stash_id_; -} -inline uint32_t SpecialMeaningAppearanceIds::supply_stash_id() const { - // @@protoc_insertion_point(field_get:Canary.protobuf.appearances.SpecialMeaningAppearanceIds.supply_stash_id) - return _internal_supply_stash_id(); -} -inline void SpecialMeaningAppearanceIds::_internal_set_supply_stash_id(uint32_t value) { - _impl_._has_bits_[0] |= 0x00000020u; - _impl_.supply_stash_id_ = value; -} -inline void SpecialMeaningAppearanceIds::set_supply_stash_id(uint32_t value) { - _internal_set_supply_stash_id(value); - // @@protoc_insertion_point(field_set:Canary.protobuf.appearances.SpecialMeaningAppearanceIds.supply_stash_id) -} - -#ifdef __GNUC__ - #pragma GCC diagnostic pop -#endif // __GNUC__ -// ------------------------------------------------------------------- - -// ------------------------------------------------------------------- - -// ------------------------------------------------------------------- - -// ------------------------------------------------------------------- - -// ------------------------------------------------------------------- - -// ------------------------------------------------------------------- - -// ------------------------------------------------------------------- - -// ------------------------------------------------------------------- - -// ------------------------------------------------------------------- - -// ------------------------------------------------------------------- - -// ------------------------------------------------------------------- - -// ------------------------------------------------------------------- - -// ------------------------------------------------------------------- - -// ------------------------------------------------------------------- - -// ------------------------------------------------------------------- - -// ------------------------------------------------------------------- - -// ------------------------------------------------------------------- - -// ------------------------------------------------------------------- - -// ------------------------------------------------------------------- - -// ------------------------------------------------------------------- - -// ------------------------------------------------------------------- - -// ------------------------------------------------------------------- - -// ------------------------------------------------------------------- - -// ------------------------------------------------------------------- - -// ------------------------------------------------------------------- - - -// @@protoc_insertion_point(namespace_scope) - -} // namespace appearances -} // namespace protobuf -} // namespace Canary - -PROTOBUF_NAMESPACE_OPEN - -template <> struct is_proto_enum< ::Canary::protobuf::appearances::PLAYER_ACTION> : ::std::true_type {}; -template <> -inline const EnumDescriptor* GetEnumDescriptor< ::Canary::protobuf::appearances::PLAYER_ACTION>() { - return ::Canary::protobuf::appearances::PLAYER_ACTION_descriptor(); -} -template <> struct is_proto_enum< ::Canary::protobuf::appearances::ITEM_CATEGORY> : ::std::true_type {}; -template <> -inline const EnumDescriptor* GetEnumDescriptor< ::Canary::protobuf::appearances::ITEM_CATEGORY>() { - return ::Canary::protobuf::appearances::ITEM_CATEGORY_descriptor(); -} -template <> struct is_proto_enum< ::Canary::protobuf::appearances::PLAYER_PROFESSION> : ::std::true_type {}; -template <> -inline const EnumDescriptor* GetEnumDescriptor< ::Canary::protobuf::appearances::PLAYER_PROFESSION>() { - return ::Canary::protobuf::appearances::PLAYER_PROFESSION_descriptor(); -} -template <> struct is_proto_enum< ::Canary::protobuf::appearances::ANIMATION_LOOP_TYPE> : ::std::true_type {}; -template <> -inline const EnumDescriptor* GetEnumDescriptor< ::Canary::protobuf::appearances::ANIMATION_LOOP_TYPE>() { - return ::Canary::protobuf::appearances::ANIMATION_LOOP_TYPE_descriptor(); -} -template <> struct is_proto_enum< ::Canary::protobuf::appearances::HOOK_TYPE> : ::std::true_type {}; -template <> -inline const EnumDescriptor* GetEnumDescriptor< ::Canary::protobuf::appearances::HOOK_TYPE>() { - return ::Canary::protobuf::appearances::HOOK_TYPE_descriptor(); -} -template <> struct is_proto_enum< ::Canary::protobuf::appearances::FIXED_FRAME_GROUP> : ::std::true_type {}; -template <> -inline const EnumDescriptor* GetEnumDescriptor< ::Canary::protobuf::appearances::FIXED_FRAME_GROUP>() { - return ::Canary::protobuf::appearances::FIXED_FRAME_GROUP_descriptor(); -} - -PROTOBUF_NAMESPACE_CLOSE - -// @@protoc_insertion_point(global_scope) - -#include -#endif // GOOGLE_PROTOBUF_INCLUDED_GOOGLE_PROTOBUF_INCLUDED_appearances_2eproto diff --git a/src/protobuf/appearances.proto b/src/protobuf/appearances.proto index 2bb1690fc..ed924febf 100644 --- a/src/protobuf/appearances.proto +++ b/src/protobuf/appearances.proto @@ -177,6 +177,7 @@ message AppearanceFlags { optional bool clockexpire = 54; optional bool expire = 55; optional bool expirestop = 56; + optional bool wrapkit = 57; } message AppearanceFlagUpgradeClassification { @@ -261,6 +262,7 @@ message SpecialMeaningAppearanceIds { optional uint32 tibia_coin_id = 4; optional uint32 stamped_letter_id = 5; optional uint32 supply_stash_id = 6; + optional uint32 reward_chest_id = 7; } enum FIXED_FRAME_GROUP { diff --git a/src/protobuf/kv.pb.cc b/src/protobuf/kv.pb.cc new file mode 100644 index 000000000..bde2e92a3 --- /dev/null +++ b/src/protobuf/kv.pb.cc @@ -0,0 +1,1214 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: kv.proto + +#include "kv.pb.h" + +#include + +#include +#include +#include +#include +#include +#include +#include +// @@protoc_insertion_point(includes) +#include + +PROTOBUF_PRAGMA_INIT_SEG + +namespace _pb = ::PROTOBUF_NAMESPACE_ID; +namespace _pbi = _pb::internal; + +namespace Canary { +namespace protobuf { +namespace kv { +PROTOBUF_CONSTEXPR ValueWrapper::ValueWrapper( + ::_pbi::ConstantInitialized): _impl_{ + /*decltype(_impl_.value_)*/{} + , /*decltype(_impl_._cached_size_)*/{} + , /*decltype(_impl_._oneof_case_)*/{}} {} +struct ValueWrapperDefaultTypeInternal { + PROTOBUF_CONSTEXPR ValueWrapperDefaultTypeInternal() + : _instance(::_pbi::ConstantInitialized{}) {} + ~ValueWrapperDefaultTypeInternal() {} + union { + ValueWrapper _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 ValueWrapperDefaultTypeInternal _ValueWrapper_default_instance_; +PROTOBUF_CONSTEXPR ArrayType::ArrayType( + ::_pbi::ConstantInitialized): _impl_{ + /*decltype(_impl_.values_)*/{} + , /*decltype(_impl_._cached_size_)*/{}} {} +struct ArrayTypeDefaultTypeInternal { + PROTOBUF_CONSTEXPR ArrayTypeDefaultTypeInternal() + : _instance(::_pbi::ConstantInitialized{}) {} + ~ArrayTypeDefaultTypeInternal() {} + union { + ArrayType _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 ArrayTypeDefaultTypeInternal _ArrayType_default_instance_; +PROTOBUF_CONSTEXPR KeyValuePair::KeyValuePair( + ::_pbi::ConstantInitialized): _impl_{ + /*decltype(_impl_.key_)*/{&::_pbi::fixed_address_empty_string, ::_pbi::ConstantInitialized{}} + , /*decltype(_impl_.value_)*/nullptr + , /*decltype(_impl_._cached_size_)*/{}} {} +struct KeyValuePairDefaultTypeInternal { + PROTOBUF_CONSTEXPR KeyValuePairDefaultTypeInternal() + : _instance(::_pbi::ConstantInitialized{}) {} + ~KeyValuePairDefaultTypeInternal() {} + union { + KeyValuePair _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 KeyValuePairDefaultTypeInternal _KeyValuePair_default_instance_; +PROTOBUF_CONSTEXPR MapType::MapType( + ::_pbi::ConstantInitialized): _impl_{ + /*decltype(_impl_.items_)*/{} + , /*decltype(_impl_._cached_size_)*/{}} {} +struct MapTypeDefaultTypeInternal { + PROTOBUF_CONSTEXPR MapTypeDefaultTypeInternal() + : _instance(::_pbi::ConstantInitialized{}) {} + ~MapTypeDefaultTypeInternal() {} + union { + MapType _instance; + }; +}; +PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 MapTypeDefaultTypeInternal _MapType_default_instance_; +} // namespace kv +} // namespace protobuf +} // namespace Canary +static ::_pb::Metadata file_level_metadata_kv_2eproto[4]; +static constexpr ::_pb::EnumDescriptor const** file_level_enum_descriptors_kv_2eproto = nullptr; +static constexpr ::_pb::ServiceDescriptor const** file_level_service_descriptors_kv_2eproto = nullptr; + +const uint32_t TableStruct_kv_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { + ~0u, // no _has_bits_ + PROTOBUF_FIELD_OFFSET(::Canary::protobuf::kv::ValueWrapper, _internal_metadata_), + ~0u, // no _extensions_ + PROTOBUF_FIELD_OFFSET(::Canary::protobuf::kv::ValueWrapper, _impl_._oneof_case_[0]), + ~0u, // no _weak_field_map_ + ~0u, // no _inlined_string_donated_ + ::_pbi::kInvalidFieldOffsetTag, + ::_pbi::kInvalidFieldOffsetTag, + ::_pbi::kInvalidFieldOffsetTag, + ::_pbi::kInvalidFieldOffsetTag, + ::_pbi::kInvalidFieldOffsetTag, + PROTOBUF_FIELD_OFFSET(::Canary::protobuf::kv::ValueWrapper, _impl_.value_), + ~0u, // no _has_bits_ + PROTOBUF_FIELD_OFFSET(::Canary::protobuf::kv::ArrayType, _internal_metadata_), + ~0u, // no _extensions_ + ~0u, // no _oneof_case_ + ~0u, // no _weak_field_map_ + ~0u, // no _inlined_string_donated_ + PROTOBUF_FIELD_OFFSET(::Canary::protobuf::kv::ArrayType, _impl_.values_), + ~0u, // no _has_bits_ + PROTOBUF_FIELD_OFFSET(::Canary::protobuf::kv::KeyValuePair, _internal_metadata_), + ~0u, // no _extensions_ + ~0u, // no _oneof_case_ + ~0u, // no _weak_field_map_ + ~0u, // no _inlined_string_donated_ + PROTOBUF_FIELD_OFFSET(::Canary::protobuf::kv::KeyValuePair, _impl_.key_), + PROTOBUF_FIELD_OFFSET(::Canary::protobuf::kv::KeyValuePair, _impl_.value_), + ~0u, // no _has_bits_ + PROTOBUF_FIELD_OFFSET(::Canary::protobuf::kv::MapType, _internal_metadata_), + ~0u, // no _extensions_ + ~0u, // no _oneof_case_ + ~0u, // no _weak_field_map_ + ~0u, // no _inlined_string_donated_ + PROTOBUF_FIELD_OFFSET(::Canary::protobuf::kv::MapType, _impl_.items_), +}; +static const ::_pbi::MigrationSchema schemas[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { + { 0, -1, -1, sizeof(::Canary::protobuf::kv::ValueWrapper)}, + { 12, -1, -1, sizeof(::Canary::protobuf::kv::ArrayType)}, + { 19, -1, -1, sizeof(::Canary::protobuf::kv::KeyValuePair)}, + { 27, -1, -1, sizeof(::Canary::protobuf::kv::MapType)}, +}; + +static const ::_pb::Message* const file_default_instances[] = { + &::Canary::protobuf::kv::_ValueWrapper_default_instance_._instance, + &::Canary::protobuf::kv::_ArrayType_default_instance_._instance, + &::Canary::protobuf::kv::_KeyValuePair_default_instance_._instance, + &::Canary::protobuf::kv::_MapType_default_instance_._instance, +}; + +const char descriptor_table_protodef_kv_2eproto[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = + "\n\010kv.proto\022\022Canary.protobuf.kv\"\301\001\n\014Value" + "Wrapper\022\023\n\tstr_value\030\001 \001(\tH\000\022\023\n\tint_valu" + "e\030\002 \001(\005H\000\022\026\n\014double_value\030\003 \001(\001H\000\0224\n\013arr" + "ay_value\030\004 \001(\0132\035.Canary.protobuf.kv.Arra" + "yTypeH\000\0220\n\tmap_value\030\005 \001(\0132\033.Canary.prot" + "obuf.kv.MapTypeH\000B\007\n\005value\"=\n\tArrayType\022" + "0\n\006values\030\001 \003(\0132 .Canary.protobuf.kv.Val" + "ueWrapper\"L\n\014KeyValuePair\022\013\n\003key\030\001 \001(\t\022/" + "\n\005value\030\002 \001(\0132 .Canary.protobuf.kv.Value" + "Wrapper\":\n\007MapType\022/\n\005items\030\001 \003(\0132 .Cana" + "ry.protobuf.kv.KeyValuePairb\006proto3" + ; +static ::_pbi::once_flag descriptor_table_kv_2eproto_once; +const ::_pbi::DescriptorTable descriptor_table_kv_2eproto = { + false, false, 435, descriptor_table_protodef_kv_2eproto, + "kv.proto", + &descriptor_table_kv_2eproto_once, nullptr, 0, 4, + schemas, file_default_instances, TableStruct_kv_2eproto::offsets, + file_level_metadata_kv_2eproto, file_level_enum_descriptors_kv_2eproto, + file_level_service_descriptors_kv_2eproto, +}; +PROTOBUF_ATTRIBUTE_WEAK const ::_pbi::DescriptorTable* descriptor_table_kv_2eproto_getter() { + return &descriptor_table_kv_2eproto; +} + +// Force running AddDescriptors() at dynamic initialization time. +PROTOBUF_ATTRIBUTE_INIT_PRIORITY2 static ::_pbi::AddDescriptorsRunner dynamic_init_dummy_kv_2eproto(&descriptor_table_kv_2eproto); +namespace Canary { +namespace protobuf { +namespace kv { + +// =================================================================== + +class ValueWrapper::_Internal { + public: + static const ::Canary::protobuf::kv::ArrayType& array_value(const ValueWrapper* msg); + static const ::Canary::protobuf::kv::MapType& map_value(const ValueWrapper* msg); +}; + +const ::Canary::protobuf::kv::ArrayType& +ValueWrapper::_Internal::array_value(const ValueWrapper* msg) { + return *msg->_impl_.value_.array_value_; +} +const ::Canary::protobuf::kv::MapType& +ValueWrapper::_Internal::map_value(const ValueWrapper* msg) { + return *msg->_impl_.value_.map_value_; +} +void ValueWrapper::set_allocated_array_value(::Canary::protobuf::kv::ArrayType* array_value) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + clear_value(); + if (array_value) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena(array_value); + if (message_arena != submessage_arena) { + array_value = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, array_value, submessage_arena); + } + set_has_array_value(); + _impl_.value_.array_value_ = array_value; + } + // @@protoc_insertion_point(field_set_allocated:Canary.protobuf.kv.ValueWrapper.array_value) +} +void ValueWrapper::set_allocated_map_value(::Canary::protobuf::kv::MapType* map_value) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + clear_value(); + if (map_value) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena(map_value); + if (message_arena != submessage_arena) { + map_value = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, map_value, submessage_arena); + } + set_has_map_value(); + _impl_.value_.map_value_ = map_value; + } + // @@protoc_insertion_point(field_set_allocated:Canary.protobuf.kv.ValueWrapper.map_value) +} +ValueWrapper::ValueWrapper(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) { + SharedCtor(arena, is_message_owned); + // @@protoc_insertion_point(arena_constructor:Canary.protobuf.kv.ValueWrapper) +} +ValueWrapper::ValueWrapper(const ValueWrapper& from) + : ::PROTOBUF_NAMESPACE_ID::Message() { + ValueWrapper* const _this = this; (void)_this; + new (&_impl_) Impl_{ + decltype(_impl_.value_){} + , /*decltype(_impl_._cached_size_)*/{} + , /*decltype(_impl_._oneof_case_)*/{}}; + + _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); + clear_has_value(); + switch (from.value_case()) { + case kStrValue: { + _this->_internal_set_str_value(from._internal_str_value()); + break; + } + case kIntValue: { + _this->_internal_set_int_value(from._internal_int_value()); + break; + } + case kDoubleValue: { + _this->_internal_set_double_value(from._internal_double_value()); + break; + } + case kArrayValue: { + _this->_internal_mutable_array_value()->::Canary::protobuf::kv::ArrayType::MergeFrom( + from._internal_array_value()); + break; + } + case kMapValue: { + _this->_internal_mutable_map_value()->::Canary::protobuf::kv::MapType::MergeFrom( + from._internal_map_value()); + break; + } + case VALUE_NOT_SET: { + break; + } + } + // @@protoc_insertion_point(copy_constructor:Canary.protobuf.kv.ValueWrapper) +} + +inline void ValueWrapper::SharedCtor( + ::_pb::Arena* arena, bool is_message_owned) { + (void)arena; + (void)is_message_owned; + new (&_impl_) Impl_{ + decltype(_impl_.value_){} + , /*decltype(_impl_._cached_size_)*/{} + , /*decltype(_impl_._oneof_case_)*/{} + }; + clear_has_value(); +} + +ValueWrapper::~ValueWrapper() { + // @@protoc_insertion_point(destructor:Canary.protobuf.kv.ValueWrapper) + if (auto *arena = _internal_metadata_.DeleteReturnArena<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>()) { + (void)arena; + return; + } + SharedDtor(); +} + +inline void ValueWrapper::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); + if (has_value()) { + clear_value(); + } +} + +void ValueWrapper::SetCachedSize(int size) const { + _impl_._cached_size_.Set(size); +} + +void ValueWrapper::clear_value() { +// @@protoc_insertion_point(one_of_clear_start:Canary.protobuf.kv.ValueWrapper) + switch (value_case()) { + case kStrValue: { + _impl_.value_.str_value_.Destroy(); + break; + } + case kIntValue: { + // No need to clear + break; + } + case kDoubleValue: { + // No need to clear + break; + } + case kArrayValue: { + if (GetArenaForAllocation() == nullptr) { + delete _impl_.value_.array_value_; + } + break; + } + case kMapValue: { + if (GetArenaForAllocation() == nullptr) { + delete _impl_.value_.map_value_; + } + break; + } + case VALUE_NOT_SET: { + break; + } + } + _impl_._oneof_case_[0] = VALUE_NOT_SET; +} + + +void ValueWrapper::Clear() { +// @@protoc_insertion_point(message_clear_start:Canary.protobuf.kv.ValueWrapper) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + clear_value(); + _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); +} + +const char* ValueWrapper::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::_pbi::ReadTag(ptr, &tag); + switch (tag >> 3) { + // string str_value = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 10)) { + auto str = _internal_mutable_str_value(); + ptr = ::_pbi::InlineGreedyStringParser(str, ptr, ctx); + CHK_(ptr); + CHK_(::_pbi::VerifyUTF8(str, "Canary.protobuf.kv.ValueWrapper.str_value")); + } else + goto handle_unusual; + continue; + // int32 int_value = 2; + case 2: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 16)) { + _internal_set_int_value(::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr)); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // double double_value = 3; + case 3: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 25)) { + _internal_set_double_value(::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad(ptr)); + ptr += sizeof(double); + } else + goto handle_unusual; + continue; + // .Canary.protobuf.kv.ArrayType array_value = 4; + case 4: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 34)) { + ptr = ctx->ParseMessage(_internal_mutable_array_value(), ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + // .Canary.protobuf.kv.MapType map_value = 5; + case 5: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 42)) { + ptr = ctx->ParseMessage(_internal_mutable_map_value(), ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* ValueWrapper::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:Canary.protobuf.kv.ValueWrapper) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + // string str_value = 1; + if (_internal_has_str_value()) { + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String( + this->_internal_str_value().data(), static_cast(this->_internal_str_value().length()), + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE, + "Canary.protobuf.kv.ValueWrapper.str_value"); + target = stream->WriteStringMaybeAliased( + 1, this->_internal_str_value(), target); + } + + // int32 int_value = 2; + if (_internal_has_int_value()) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteInt32ToArray(2, this->_internal_int_value(), target); + } + + // double double_value = 3; + if (_internal_has_double_value()) { + target = stream->EnsureSpace(target); + target = ::_pbi::WireFormatLite::WriteDoubleToArray(3, this->_internal_double_value(), target); + } + + // .Canary.protobuf.kv.ArrayType array_value = 4; + if (_internal_has_array_value()) { + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage(4, _Internal::array_value(this), + _Internal::array_value(this).GetCachedSize(), target, stream); + } + + // .Canary.protobuf.kv.MapType map_value = 5; + if (_internal_has_map_value()) { + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage(5, _Internal::map_value(this), + _Internal::map_value(this).GetCachedSize(), target, stream); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( + _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:Canary.protobuf.kv.ValueWrapper) + return target; +} + +size_t ValueWrapper::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:Canary.protobuf.kv.ValueWrapper) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + switch (value_case()) { + // string str_value = 1; + case kStrValue: { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( + this->_internal_str_value()); + break; + } + // int32 int_value = 2; + case kIntValue: { + total_size += ::_pbi::WireFormatLite::Int32SizePlusOne(this->_internal_int_value()); + break; + } + // double double_value = 3; + case kDoubleValue: { + total_size += 1 + 8; + break; + } + // .Canary.protobuf.kv.ArrayType array_value = 4; + case kArrayValue: { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( + *_impl_.value_.array_value_); + break; + } + // .Canary.protobuf.kv.MapType map_value = 5; + case kMapValue: { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( + *_impl_.value_.map_value_); + break; + } + case VALUE_NOT_SET: { + break; + } + } + return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_); +} + +const ::PROTOBUF_NAMESPACE_ID::Message::ClassData ValueWrapper::_class_data_ = { + ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSourceCheck, + ValueWrapper::MergeImpl +}; +const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*ValueWrapper::GetClassData() const { return &_class_data_; } + + +void ValueWrapper::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg) { + auto* const _this = static_cast(&to_msg); + auto& from = static_cast(from_msg); + // @@protoc_insertion_point(class_specific_merge_from_start:Canary.protobuf.kv.ValueWrapper) + GOOGLE_DCHECK_NE(&from, _this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + switch (from.value_case()) { + case kStrValue: { + _this->_internal_set_str_value(from._internal_str_value()); + break; + } + case kIntValue: { + _this->_internal_set_int_value(from._internal_int_value()); + break; + } + case kDoubleValue: { + _this->_internal_set_double_value(from._internal_double_value()); + break; + } + case kArrayValue: { + _this->_internal_mutable_array_value()->::Canary::protobuf::kv::ArrayType::MergeFrom( + from._internal_array_value()); + break; + } + case kMapValue: { + _this->_internal_mutable_map_value()->::Canary::protobuf::kv::MapType::MergeFrom( + from._internal_map_value()); + break; + } + case VALUE_NOT_SET: { + break; + } + } + _this->_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); +} + +void ValueWrapper::CopyFrom(const ValueWrapper& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:Canary.protobuf.kv.ValueWrapper) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool ValueWrapper::IsInitialized() const { + return true; +} + +void ValueWrapper::InternalSwap(ValueWrapper* other) { + using std::swap; + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + swap(_impl_.value_, other->_impl_.value_); + swap(_impl_._oneof_case_[0], other->_impl_._oneof_case_[0]); +} + +::PROTOBUF_NAMESPACE_ID::Metadata ValueWrapper::GetMetadata() const { + return ::_pbi::AssignDescriptors( + &descriptor_table_kv_2eproto_getter, &descriptor_table_kv_2eproto_once, + file_level_metadata_kv_2eproto[0]); +} + +// =================================================================== + +class ArrayType::_Internal { + public: +}; + +ArrayType::ArrayType(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) { + SharedCtor(arena, is_message_owned); + // @@protoc_insertion_point(arena_constructor:Canary.protobuf.kv.ArrayType) +} +ArrayType::ArrayType(const ArrayType& from) + : ::PROTOBUF_NAMESPACE_ID::Message() { + ArrayType* const _this = this; (void)_this; + new (&_impl_) Impl_{ + decltype(_impl_.values_){from._impl_.values_} + , /*decltype(_impl_._cached_size_)*/{}}; + + _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); + // @@protoc_insertion_point(copy_constructor:Canary.protobuf.kv.ArrayType) +} + +inline void ArrayType::SharedCtor( + ::_pb::Arena* arena, bool is_message_owned) { + (void)arena; + (void)is_message_owned; + new (&_impl_) Impl_{ + decltype(_impl_.values_){arena} + , /*decltype(_impl_._cached_size_)*/{} + }; +} + +ArrayType::~ArrayType() { + // @@protoc_insertion_point(destructor:Canary.protobuf.kv.ArrayType) + if (auto *arena = _internal_metadata_.DeleteReturnArena<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>()) { + (void)arena; + return; + } + SharedDtor(); +} + +inline void ArrayType::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); + _impl_.values_.~RepeatedPtrField(); +} + +void ArrayType::SetCachedSize(int size) const { + _impl_._cached_size_.Set(size); +} + +void ArrayType::Clear() { +// @@protoc_insertion_point(message_clear_start:Canary.protobuf.kv.ArrayType) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + _impl_.values_.Clear(); + _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); +} + +const char* ArrayType::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::_pbi::ReadTag(ptr, &tag); + switch (tag >> 3) { + // repeated .Canary.protobuf.kv.ValueWrapper values = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 10)) { + ptr -= 1; + do { + ptr += 1; + ptr = ctx->ParseMessage(_internal_add_values(), ptr); + CHK_(ptr); + if (!ctx->DataAvailable(ptr)) break; + } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<10>(ptr)); + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* ArrayType::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:Canary.protobuf.kv.ArrayType) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + // repeated .Canary.protobuf.kv.ValueWrapper values = 1; + for (unsigned i = 0, + n = static_cast(this->_internal_values_size()); i < n; i++) { + const auto& repfield = this->_internal_values(i); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage(1, repfield, repfield.GetCachedSize(), target, stream); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( + _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:Canary.protobuf.kv.ArrayType) + return target; +} + +size_t ArrayType::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:Canary.protobuf.kv.ArrayType) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + // repeated .Canary.protobuf.kv.ValueWrapper values = 1; + total_size += 1UL * this->_internal_values_size(); + for (const auto& msg : this->_impl_.values_) { + total_size += + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg); + } + + return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_); +} + +const ::PROTOBUF_NAMESPACE_ID::Message::ClassData ArrayType::_class_data_ = { + ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSourceCheck, + ArrayType::MergeImpl +}; +const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*ArrayType::GetClassData() const { return &_class_data_; } + + +void ArrayType::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg) { + auto* const _this = static_cast(&to_msg); + auto& from = static_cast(from_msg); + // @@protoc_insertion_point(class_specific_merge_from_start:Canary.protobuf.kv.ArrayType) + GOOGLE_DCHECK_NE(&from, _this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + _this->_impl_.values_.MergeFrom(from._impl_.values_); + _this->_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); +} + +void ArrayType::CopyFrom(const ArrayType& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:Canary.protobuf.kv.ArrayType) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool ArrayType::IsInitialized() const { + return true; +} + +void ArrayType::InternalSwap(ArrayType* other) { + using std::swap; + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + _impl_.values_.InternalSwap(&other->_impl_.values_); +} + +::PROTOBUF_NAMESPACE_ID::Metadata ArrayType::GetMetadata() const { + return ::_pbi::AssignDescriptors( + &descriptor_table_kv_2eproto_getter, &descriptor_table_kv_2eproto_once, + file_level_metadata_kv_2eproto[1]); +} + +// =================================================================== + +class KeyValuePair::_Internal { + public: + static const ::Canary::protobuf::kv::ValueWrapper& value(const KeyValuePair* msg); +}; + +const ::Canary::protobuf::kv::ValueWrapper& +KeyValuePair::_Internal::value(const KeyValuePair* msg) { + return *msg->_impl_.value_; +} +KeyValuePair::KeyValuePair(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) { + SharedCtor(arena, is_message_owned); + // @@protoc_insertion_point(arena_constructor:Canary.protobuf.kv.KeyValuePair) +} +KeyValuePair::KeyValuePair(const KeyValuePair& from) + : ::PROTOBUF_NAMESPACE_ID::Message() { + KeyValuePair* const _this = this; (void)_this; + new (&_impl_) Impl_{ + decltype(_impl_.key_){} + , decltype(_impl_.value_){nullptr} + , /*decltype(_impl_._cached_size_)*/{}}; + + _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); + _impl_.key_.InitDefault(); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + _impl_.key_.Set("", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (!from._internal_key().empty()) { + _this->_impl_.key_.Set(from._internal_key(), + _this->GetArenaForAllocation()); + } + if (from._internal_has_value()) { + _this->_impl_.value_ = new ::Canary::protobuf::kv::ValueWrapper(*from._impl_.value_); + } + // @@protoc_insertion_point(copy_constructor:Canary.protobuf.kv.KeyValuePair) +} + +inline void KeyValuePair::SharedCtor( + ::_pb::Arena* arena, bool is_message_owned) { + (void)arena; + (void)is_message_owned; + new (&_impl_) Impl_{ + decltype(_impl_.key_){} + , decltype(_impl_.value_){nullptr} + , /*decltype(_impl_._cached_size_)*/{} + }; + _impl_.key_.InitDefault(); + #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + _impl_.key_.Set("", GetArenaForAllocation()); + #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING +} + +KeyValuePair::~KeyValuePair() { + // @@protoc_insertion_point(destructor:Canary.protobuf.kv.KeyValuePair) + if (auto *arena = _internal_metadata_.DeleteReturnArena<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>()) { + (void)arena; + return; + } + SharedDtor(); +} + +inline void KeyValuePair::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); + _impl_.key_.Destroy(); + if (this != internal_default_instance()) delete _impl_.value_; +} + +void KeyValuePair::SetCachedSize(int size) const { + _impl_._cached_size_.Set(size); +} + +void KeyValuePair::Clear() { +// @@protoc_insertion_point(message_clear_start:Canary.protobuf.kv.KeyValuePair) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + _impl_.key_.ClearToEmpty(); + if (GetArenaForAllocation() == nullptr && _impl_.value_ != nullptr) { + delete _impl_.value_; + } + _impl_.value_ = nullptr; + _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); +} + +const char* KeyValuePair::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::_pbi::ReadTag(ptr, &tag); + switch (tag >> 3) { + // string key = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 10)) { + auto str = _internal_mutable_key(); + ptr = ::_pbi::InlineGreedyStringParser(str, ptr, ctx); + CHK_(ptr); + CHK_(::_pbi::VerifyUTF8(str, "Canary.protobuf.kv.KeyValuePair.key")); + } else + goto handle_unusual; + continue; + // .Canary.protobuf.kv.ValueWrapper value = 2; + case 2: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 18)) { + ptr = ctx->ParseMessage(_internal_mutable_value(), ptr); + CHK_(ptr); + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* KeyValuePair::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:Canary.protobuf.kv.KeyValuePair) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + // string key = 1; + if (!this->_internal_key().empty()) { + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String( + this->_internal_key().data(), static_cast(this->_internal_key().length()), + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE, + "Canary.protobuf.kv.KeyValuePair.key"); + target = stream->WriteStringMaybeAliased( + 1, this->_internal_key(), target); + } + + // .Canary.protobuf.kv.ValueWrapper value = 2; + if (this->_internal_has_value()) { + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage(2, _Internal::value(this), + _Internal::value(this).GetCachedSize(), target, stream); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( + _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:Canary.protobuf.kv.KeyValuePair) + return target; +} + +size_t KeyValuePair::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:Canary.protobuf.kv.KeyValuePair) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + // string key = 1; + if (!this->_internal_key().empty()) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( + this->_internal_key()); + } + + // .Canary.protobuf.kv.ValueWrapper value = 2; + if (this->_internal_has_value()) { + total_size += 1 + + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( + *_impl_.value_); + } + + return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_); +} + +const ::PROTOBUF_NAMESPACE_ID::Message::ClassData KeyValuePair::_class_data_ = { + ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSourceCheck, + KeyValuePair::MergeImpl +}; +const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*KeyValuePair::GetClassData() const { return &_class_data_; } + + +void KeyValuePair::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg) { + auto* const _this = static_cast(&to_msg); + auto& from = static_cast(from_msg); + // @@protoc_insertion_point(class_specific_merge_from_start:Canary.protobuf.kv.KeyValuePair) + GOOGLE_DCHECK_NE(&from, _this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + if (!from._internal_key().empty()) { + _this->_internal_set_key(from._internal_key()); + } + if (from._internal_has_value()) { + _this->_internal_mutable_value()->::Canary::protobuf::kv::ValueWrapper::MergeFrom( + from._internal_value()); + } + _this->_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); +} + +void KeyValuePair::CopyFrom(const KeyValuePair& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:Canary.protobuf.kv.KeyValuePair) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool KeyValuePair::IsInitialized() const { + return true; +} + +void KeyValuePair::InternalSwap(KeyValuePair* other) { + using std::swap; + auto* lhs_arena = GetArenaForAllocation(); + auto* rhs_arena = other->GetArenaForAllocation(); + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( + &_impl_.key_, lhs_arena, + &other->_impl_.key_, rhs_arena + ); + swap(_impl_.value_, other->_impl_.value_); +} + +::PROTOBUF_NAMESPACE_ID::Metadata KeyValuePair::GetMetadata() const { + return ::_pbi::AssignDescriptors( + &descriptor_table_kv_2eproto_getter, &descriptor_table_kv_2eproto_once, + file_level_metadata_kv_2eproto[2]); +} + +// =================================================================== + +class MapType::_Internal { + public: +}; + +MapType::MapType(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned) + : ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) { + SharedCtor(arena, is_message_owned); + // @@protoc_insertion_point(arena_constructor:Canary.protobuf.kv.MapType) +} +MapType::MapType(const MapType& from) + : ::PROTOBUF_NAMESPACE_ID::Message() { + MapType* const _this = this; (void)_this; + new (&_impl_) Impl_{ + decltype(_impl_.items_){from._impl_.items_} + , /*decltype(_impl_._cached_size_)*/{}}; + + _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); + // @@protoc_insertion_point(copy_constructor:Canary.protobuf.kv.MapType) +} + +inline void MapType::SharedCtor( + ::_pb::Arena* arena, bool is_message_owned) { + (void)arena; + (void)is_message_owned; + new (&_impl_) Impl_{ + decltype(_impl_.items_){arena} + , /*decltype(_impl_._cached_size_)*/{} + }; +} + +MapType::~MapType() { + // @@protoc_insertion_point(destructor:Canary.protobuf.kv.MapType) + if (auto *arena = _internal_metadata_.DeleteReturnArena<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>()) { + (void)arena; + return; + } + SharedDtor(); +} + +inline void MapType::SharedDtor() { + GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); + _impl_.items_.~RepeatedPtrField(); +} + +void MapType::SetCachedSize(int size) const { + _impl_._cached_size_.Set(size); +} + +void MapType::Clear() { +// @@protoc_insertion_point(message_clear_start:Canary.protobuf.kv.MapType) + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + _impl_.items_.Clear(); + _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); +} + +const char* MapType::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) { +#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure + while (!ctx->Done(&ptr)) { + uint32_t tag; + ptr = ::_pbi::ReadTag(ptr, &tag); + switch (tag >> 3) { + // repeated .Canary.protobuf.kv.KeyValuePair items = 1; + case 1: + if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 10)) { + ptr -= 1; + do { + ptr += 1; + ptr = ctx->ParseMessage(_internal_add_items(), ptr); + CHK_(ptr); + if (!ctx->DataAvailable(ptr)) break; + } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<10>(ptr)); + } else + goto handle_unusual; + continue; + default: + goto handle_unusual; + } // switch + handle_unusual: + if ((tag == 0) || ((tag & 7) == 4)) { + CHK_(ptr); + ctx->SetLastTag(tag); + goto message_done; + } + ptr = UnknownFieldParse( + tag, + _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), + ptr, ctx); + CHK_(ptr != nullptr); + } // while +message_done: + return ptr; +failure: + ptr = nullptr; + goto message_done; +#undef CHK_ +} + +uint8_t* MapType::_InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { + // @@protoc_insertion_point(serialize_to_array_start:Canary.protobuf.kv.MapType) + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + // repeated .Canary.protobuf.kv.KeyValuePair items = 1; + for (unsigned i = 0, + n = static_cast(this->_internal_items_size()); i < n; i++) { + const auto& repfield = this->_internal_items(i); + target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: + InternalWriteMessage(1, repfield, repfield.GetCachedSize(), target, stream); + } + + if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { + target = ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray( + _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream); + } + // @@protoc_insertion_point(serialize_to_array_end:Canary.protobuf.kv.MapType) + return target; +} + +size_t MapType::ByteSizeLong() const { +// @@protoc_insertion_point(message_byte_size_start:Canary.protobuf.kv.MapType) + size_t total_size = 0; + + uint32_t cached_has_bits = 0; + // Prevent compiler warnings about cached_has_bits being unused + (void) cached_has_bits; + + // repeated .Canary.protobuf.kv.KeyValuePair items = 1; + total_size += 1UL * this->_internal_items_size(); + for (const auto& msg : this->_impl_.items_) { + total_size += + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg); + } + + return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_); +} + +const ::PROTOBUF_NAMESPACE_ID::Message::ClassData MapType::_class_data_ = { + ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSourceCheck, + MapType::MergeImpl +}; +const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*MapType::GetClassData() const { return &_class_data_; } + + +void MapType::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg) { + auto* const _this = static_cast(&to_msg); + auto& from = static_cast(from_msg); + // @@protoc_insertion_point(class_specific_merge_from_start:Canary.protobuf.kv.MapType) + GOOGLE_DCHECK_NE(&from, _this); + uint32_t cached_has_bits = 0; + (void) cached_has_bits; + + _this->_impl_.items_.MergeFrom(from._impl_.items_); + _this->_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); +} + +void MapType::CopyFrom(const MapType& from) { +// @@protoc_insertion_point(class_specific_copy_from_start:Canary.protobuf.kv.MapType) + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool MapType::IsInitialized() const { + return true; +} + +void MapType::InternalSwap(MapType* other) { + using std::swap; + _internal_metadata_.InternalSwap(&other->_internal_metadata_); + _impl_.items_.InternalSwap(&other->_impl_.items_); +} + +::PROTOBUF_NAMESPACE_ID::Metadata MapType::GetMetadata() const { + return ::_pbi::AssignDescriptors( + &descriptor_table_kv_2eproto_getter, &descriptor_table_kv_2eproto_once, + file_level_metadata_kv_2eproto[3]); +} + +// @@protoc_insertion_point(namespace_scope) +} // namespace kv +} // namespace protobuf +} // namespace Canary +PROTOBUF_NAMESPACE_OPEN +template<> PROTOBUF_NOINLINE ::Canary::protobuf::kv::ValueWrapper* +Arena::CreateMaybeMessage< ::Canary::protobuf::kv::ValueWrapper >(Arena* arena) { + return Arena::CreateMessageInternal< ::Canary::protobuf::kv::ValueWrapper >(arena); +} +template<> PROTOBUF_NOINLINE ::Canary::protobuf::kv::ArrayType* +Arena::CreateMaybeMessage< ::Canary::protobuf::kv::ArrayType >(Arena* arena) { + return Arena::CreateMessageInternal< ::Canary::protobuf::kv::ArrayType >(arena); +} +template<> PROTOBUF_NOINLINE ::Canary::protobuf::kv::KeyValuePair* +Arena::CreateMaybeMessage< ::Canary::protobuf::kv::KeyValuePair >(Arena* arena) { + return Arena::CreateMessageInternal< ::Canary::protobuf::kv::KeyValuePair >(arena); +} +template<> PROTOBUF_NOINLINE ::Canary::protobuf::kv::MapType* +Arena::CreateMaybeMessage< ::Canary::protobuf::kv::MapType >(Arena* arena) { + return Arena::CreateMessageInternal< ::Canary::protobuf::kv::MapType >(arena); +} +PROTOBUF_NAMESPACE_CLOSE + +// @@protoc_insertion_point(global_scope) +#include diff --git a/src/protobuf/kv.pb.h b/src/protobuf/kv.pb.h new file mode 100644 index 000000000..c1688e421 --- /dev/null +++ b/src/protobuf/kv.pb.h @@ -0,0 +1,1386 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: kv.proto + +#ifndef GOOGLE_PROTOBUF_INCLUDED_kv_2eproto +#define GOOGLE_PROTOBUF_INCLUDED_kv_2eproto + +#include +#include + +#include +#if PROTOBUF_VERSION < 3021000 +#error This file was generated by a newer version of protoc which is +#error incompatible with your Protocol Buffer headers. Please update +#error your headers. +#endif +#if 3021012 < PROTOBUF_MIN_PROTOC_VERSION +#error This file was generated by an older version of protoc which is +#error incompatible with your Protocol Buffer headers. Please +#error regenerate this file with a newer version of protoc. +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include // IWYU pragma: export +#include // IWYU pragma: export +#include +// @@protoc_insertion_point(includes) +#include +#define PROTOBUF_INTERNAL_EXPORT_kv_2eproto +PROTOBUF_NAMESPACE_OPEN +namespace internal { +class AnyMetadata; +} // namespace internal +PROTOBUF_NAMESPACE_CLOSE + +// Internal implementation detail -- do not use these members. +struct TableStruct_kv_2eproto { + static const uint32_t offsets[]; +}; +extern const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_kv_2eproto; +namespace Canary { +namespace protobuf { +namespace kv { +class ArrayType; +struct ArrayTypeDefaultTypeInternal; +extern ArrayTypeDefaultTypeInternal _ArrayType_default_instance_; +class KeyValuePair; +struct KeyValuePairDefaultTypeInternal; +extern KeyValuePairDefaultTypeInternal _KeyValuePair_default_instance_; +class MapType; +struct MapTypeDefaultTypeInternal; +extern MapTypeDefaultTypeInternal _MapType_default_instance_; +class ValueWrapper; +struct ValueWrapperDefaultTypeInternal; +extern ValueWrapperDefaultTypeInternal _ValueWrapper_default_instance_; +} // namespace kv +} // namespace protobuf +} // namespace Canary +PROTOBUF_NAMESPACE_OPEN +template<> ::Canary::protobuf::kv::ArrayType* Arena::CreateMaybeMessage<::Canary::protobuf::kv::ArrayType>(Arena*); +template<> ::Canary::protobuf::kv::KeyValuePair* Arena::CreateMaybeMessage<::Canary::protobuf::kv::KeyValuePair>(Arena*); +template<> ::Canary::protobuf::kv::MapType* Arena::CreateMaybeMessage<::Canary::protobuf::kv::MapType>(Arena*); +template<> ::Canary::protobuf::kv::ValueWrapper* Arena::CreateMaybeMessage<::Canary::protobuf::kv::ValueWrapper>(Arena*); +PROTOBUF_NAMESPACE_CLOSE +namespace Canary { +namespace protobuf { +namespace kv { + +// =================================================================== + +class ValueWrapper final : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:Canary.protobuf.kv.ValueWrapper) */ { + public: + inline ValueWrapper() : ValueWrapper(nullptr) {} + ~ValueWrapper() override; + explicit PROTOBUF_CONSTEXPR ValueWrapper(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + ValueWrapper(const ValueWrapper& from); + ValueWrapper(ValueWrapper&& from) noexcept + : ValueWrapper() { + *this = ::std::move(from); + } + + inline ValueWrapper& operator=(const ValueWrapper& from) { + CopyFrom(from); + return *this; + } + inline ValueWrapper& operator=(ValueWrapper&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return default_instance().GetMetadata().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return default_instance().GetMetadata().reflection; + } + static const ValueWrapper& default_instance() { + return *internal_default_instance(); + } + enum ValueCase { + kStrValue = 1, + kIntValue = 2, + kDoubleValue = 3, + kArrayValue = 4, + kMapValue = 5, + VALUE_NOT_SET = 0, + }; + + static inline const ValueWrapper* internal_default_instance() { + return reinterpret_cast( + &_ValueWrapper_default_instance_); + } + static constexpr int kIndexInFileMessages = + 0; + + friend void swap(ValueWrapper& a, ValueWrapper& b) { + a.Swap(&b); + } + inline void Swap(ValueWrapper* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(ValueWrapper* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + ValueWrapper* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; + void CopyFrom(const ValueWrapper& from); + using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; + void MergeFrom( const ValueWrapper& from) { + ValueWrapper::MergeImpl(*this, from); + } + private: + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg); + public: + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _impl_._cached_size_.Get(); } + + private: + void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned); + void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(ValueWrapper* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "Canary.protobuf.kv.ValueWrapper"; + } + protected: + explicit ValueWrapper(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + public: + + static const ClassData _class_data_; + const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kStrValueFieldNumber = 1, + kIntValueFieldNumber = 2, + kDoubleValueFieldNumber = 3, + kArrayValueFieldNumber = 4, + kMapValueFieldNumber = 5, + }; + // string str_value = 1; + bool has_str_value() const; + private: + bool _internal_has_str_value() const; + public: + void clear_str_value(); + const std::string& str_value() const; + template + void set_str_value(ArgT0&& arg0, ArgT... args); + std::string* mutable_str_value(); + PROTOBUF_NODISCARD std::string* release_str_value(); + void set_allocated_str_value(std::string* str_value); + private: + const std::string& _internal_str_value() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_str_value(const std::string& value); + std::string* _internal_mutable_str_value(); + public: + + // int32 int_value = 2; + bool has_int_value() const; + private: + bool _internal_has_int_value() const; + public: + void clear_int_value(); + int32_t int_value() const; + void set_int_value(int32_t value); + private: + int32_t _internal_int_value() const; + void _internal_set_int_value(int32_t value); + public: + + // double double_value = 3; + bool has_double_value() const; + private: + bool _internal_has_double_value() const; + public: + void clear_double_value(); + double double_value() const; + void set_double_value(double value); + private: + double _internal_double_value() const; + void _internal_set_double_value(double value); + public: + + // .Canary.protobuf.kv.ArrayType array_value = 4; + bool has_array_value() const; + private: + bool _internal_has_array_value() const; + public: + void clear_array_value(); + const ::Canary::protobuf::kv::ArrayType& array_value() const; + PROTOBUF_NODISCARD ::Canary::protobuf::kv::ArrayType* release_array_value(); + ::Canary::protobuf::kv::ArrayType* mutable_array_value(); + void set_allocated_array_value(::Canary::protobuf::kv::ArrayType* array_value); + private: + const ::Canary::protobuf::kv::ArrayType& _internal_array_value() const; + ::Canary::protobuf::kv::ArrayType* _internal_mutable_array_value(); + public: + void unsafe_arena_set_allocated_array_value( + ::Canary::protobuf::kv::ArrayType* array_value); + ::Canary::protobuf::kv::ArrayType* unsafe_arena_release_array_value(); + + // .Canary.protobuf.kv.MapType map_value = 5; + bool has_map_value() const; + private: + bool _internal_has_map_value() const; + public: + void clear_map_value(); + const ::Canary::protobuf::kv::MapType& map_value() const; + PROTOBUF_NODISCARD ::Canary::protobuf::kv::MapType* release_map_value(); + ::Canary::protobuf::kv::MapType* mutable_map_value(); + void set_allocated_map_value(::Canary::protobuf::kv::MapType* map_value); + private: + const ::Canary::protobuf::kv::MapType& _internal_map_value() const; + ::Canary::protobuf::kv::MapType* _internal_mutable_map_value(); + public: + void unsafe_arena_set_allocated_map_value( + ::Canary::protobuf::kv::MapType* map_value); + ::Canary::protobuf::kv::MapType* unsafe_arena_release_map_value(); + + void clear_value(); + ValueCase value_case() const; + // @@protoc_insertion_point(class_scope:Canary.protobuf.kv.ValueWrapper) + private: + class _Internal; + void set_has_str_value(); + void set_has_int_value(); + void set_has_double_value(); + void set_has_array_value(); + void set_has_map_value(); + + inline bool has_value() const; + inline void clear_has_value(); + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + struct Impl_ { + union ValueUnion { + constexpr ValueUnion() : _constinit_{} {} + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized _constinit_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr str_value_; + int32_t int_value_; + double double_value_; + ::Canary::protobuf::kv::ArrayType* array_value_; + ::Canary::protobuf::kv::MapType* map_value_; + } value_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + uint32_t _oneof_case_[1]; + + }; + union { Impl_ _impl_; }; + friend struct ::TableStruct_kv_2eproto; +}; +// ------------------------------------------------------------------- + +class ArrayType final : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:Canary.protobuf.kv.ArrayType) */ { + public: + inline ArrayType() : ArrayType(nullptr) {} + ~ArrayType() override; + explicit PROTOBUF_CONSTEXPR ArrayType(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + ArrayType(const ArrayType& from); + ArrayType(ArrayType&& from) noexcept + : ArrayType() { + *this = ::std::move(from); + } + + inline ArrayType& operator=(const ArrayType& from) { + CopyFrom(from); + return *this; + } + inline ArrayType& operator=(ArrayType&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return default_instance().GetMetadata().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return default_instance().GetMetadata().reflection; + } + static const ArrayType& default_instance() { + return *internal_default_instance(); + } + static inline const ArrayType* internal_default_instance() { + return reinterpret_cast( + &_ArrayType_default_instance_); + } + static constexpr int kIndexInFileMessages = + 1; + + friend void swap(ArrayType& a, ArrayType& b) { + a.Swap(&b); + } + inline void Swap(ArrayType* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(ArrayType* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + ArrayType* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; + void CopyFrom(const ArrayType& from); + using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; + void MergeFrom( const ArrayType& from) { + ArrayType::MergeImpl(*this, from); + } + private: + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg); + public: + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _impl_._cached_size_.Get(); } + + private: + void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned); + void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(ArrayType* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "Canary.protobuf.kv.ArrayType"; + } + protected: + explicit ArrayType(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + public: + + static const ClassData _class_data_; + const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kValuesFieldNumber = 1, + }; + // repeated .Canary.protobuf.kv.ValueWrapper values = 1; + int values_size() const; + private: + int _internal_values_size() const; + public: + void clear_values(); + ::Canary::protobuf::kv::ValueWrapper* mutable_values(int index); + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::Canary::protobuf::kv::ValueWrapper >* + mutable_values(); + private: + const ::Canary::protobuf::kv::ValueWrapper& _internal_values(int index) const; + ::Canary::protobuf::kv::ValueWrapper* _internal_add_values(); + public: + const ::Canary::protobuf::kv::ValueWrapper& values(int index) const; + ::Canary::protobuf::kv::ValueWrapper* add_values(); + const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::Canary::protobuf::kv::ValueWrapper >& + values() const; + + // @@protoc_insertion_point(class_scope:Canary.protobuf.kv.ArrayType) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + struct Impl_ { + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::Canary::protobuf::kv::ValueWrapper > values_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + }; + union { Impl_ _impl_; }; + friend struct ::TableStruct_kv_2eproto; +}; +// ------------------------------------------------------------------- + +class KeyValuePair final : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:Canary.protobuf.kv.KeyValuePair) */ { + public: + inline KeyValuePair() : KeyValuePair(nullptr) {} + ~KeyValuePair() override; + explicit PROTOBUF_CONSTEXPR KeyValuePair(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + KeyValuePair(const KeyValuePair& from); + KeyValuePair(KeyValuePair&& from) noexcept + : KeyValuePair() { + *this = ::std::move(from); + } + + inline KeyValuePair& operator=(const KeyValuePair& from) { + CopyFrom(from); + return *this; + } + inline KeyValuePair& operator=(KeyValuePair&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return default_instance().GetMetadata().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return default_instance().GetMetadata().reflection; + } + static const KeyValuePair& default_instance() { + return *internal_default_instance(); + } + static inline const KeyValuePair* internal_default_instance() { + return reinterpret_cast( + &_KeyValuePair_default_instance_); + } + static constexpr int kIndexInFileMessages = + 2; + + friend void swap(KeyValuePair& a, KeyValuePair& b) { + a.Swap(&b); + } + inline void Swap(KeyValuePair* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(KeyValuePair* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + KeyValuePair* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; + void CopyFrom(const KeyValuePair& from); + using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; + void MergeFrom( const KeyValuePair& from) { + KeyValuePair::MergeImpl(*this, from); + } + private: + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg); + public: + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _impl_._cached_size_.Get(); } + + private: + void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned); + void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(KeyValuePair* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "Canary.protobuf.kv.KeyValuePair"; + } + protected: + explicit KeyValuePair(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + public: + + static const ClassData _class_data_; + const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kKeyFieldNumber = 1, + kValueFieldNumber = 2, + }; + // string key = 1; + void clear_key(); + const std::string& key() const; + template + void set_key(ArgT0&& arg0, ArgT... args); + std::string* mutable_key(); + PROTOBUF_NODISCARD std::string* release_key(); + void set_allocated_key(std::string* key); + private: + const std::string& _internal_key() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_key(const std::string& value); + std::string* _internal_mutable_key(); + public: + + // .Canary.protobuf.kv.ValueWrapper value = 2; + bool has_value() const; + private: + bool _internal_has_value() const; + public: + void clear_value(); + const ::Canary::protobuf::kv::ValueWrapper& value() const; + PROTOBUF_NODISCARD ::Canary::protobuf::kv::ValueWrapper* release_value(); + ::Canary::protobuf::kv::ValueWrapper* mutable_value(); + void set_allocated_value(::Canary::protobuf::kv::ValueWrapper* value); + private: + const ::Canary::protobuf::kv::ValueWrapper& _internal_value() const; + ::Canary::protobuf::kv::ValueWrapper* _internal_mutable_value(); + public: + void unsafe_arena_set_allocated_value( + ::Canary::protobuf::kv::ValueWrapper* value); + ::Canary::protobuf::kv::ValueWrapper* unsafe_arena_release_value(); + + // @@protoc_insertion_point(class_scope:Canary.protobuf.kv.KeyValuePair) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + struct Impl_ { + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr key_; + ::Canary::protobuf::kv::ValueWrapper* value_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + }; + union { Impl_ _impl_; }; + friend struct ::TableStruct_kv_2eproto; +}; +// ------------------------------------------------------------------- + +class MapType final : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:Canary.protobuf.kv.MapType) */ { + public: + inline MapType() : MapType(nullptr) {} + ~MapType() override; + explicit PROTOBUF_CONSTEXPR MapType(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + MapType(const MapType& from); + MapType(MapType&& from) noexcept + : MapType() { + *this = ::std::move(from); + } + + inline MapType& operator=(const MapType& from) { + CopyFrom(from); + return *this; + } + inline MapType& operator=(MapType&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return default_instance().GetMetadata().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return default_instance().GetMetadata().reflection; + } + static const MapType& default_instance() { + return *internal_default_instance(); + } + static inline const MapType* internal_default_instance() { + return reinterpret_cast( + &_MapType_default_instance_); + } + static constexpr int kIndexInFileMessages = + 3; + + friend void swap(MapType& a, MapType& b) { + a.Swap(&b); + } + inline void Swap(MapType* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(MapType* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + MapType* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; + void CopyFrom(const MapType& from); + using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; + void MergeFrom( const MapType& from) { + MapType::MergeImpl(*this, from); + } + private: + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg); + public: + PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final; + bool IsInitialized() const final; + + size_t ByteSizeLong() const final; + const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _impl_._cached_size_.Get(); } + + private: + void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned); + void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(MapType* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "Canary.protobuf.kv.MapType"; + } + protected: + explicit MapType(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + public: + + static const ClassData _class_data_; + const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kItemsFieldNumber = 1, + }; + // repeated .Canary.protobuf.kv.KeyValuePair items = 1; + int items_size() const; + private: + int _internal_items_size() const; + public: + void clear_items(); + ::Canary::protobuf::kv::KeyValuePair* mutable_items(int index); + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::Canary::protobuf::kv::KeyValuePair >* + mutable_items(); + private: + const ::Canary::protobuf::kv::KeyValuePair& _internal_items(int index) const; + ::Canary::protobuf::kv::KeyValuePair* _internal_add_items(); + public: + const ::Canary::protobuf::kv::KeyValuePair& items(int index) const; + ::Canary::protobuf::kv::KeyValuePair* add_items(); + const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::Canary::protobuf::kv::KeyValuePair >& + items() const; + + // @@protoc_insertion_point(class_scope:Canary.protobuf.kv.MapType) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + struct Impl_ { + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::Canary::protobuf::kv::KeyValuePair > items_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + }; + union { Impl_ _impl_; }; + friend struct ::TableStruct_kv_2eproto; +}; +// =================================================================== + + +// =================================================================== + +#ifdef __GNUC__ + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wstrict-aliasing" +#endif // __GNUC__ +// ValueWrapper + +// string str_value = 1; +inline bool ValueWrapper::_internal_has_str_value() const { + return value_case() == kStrValue; +} +inline bool ValueWrapper::has_str_value() const { + return _internal_has_str_value(); +} +inline void ValueWrapper::set_has_str_value() { + _impl_._oneof_case_[0] = kStrValue; +} +inline void ValueWrapper::clear_str_value() { + if (_internal_has_str_value()) { + _impl_.value_.str_value_.Destroy(); + clear_has_value(); + } +} +inline const std::string& ValueWrapper::str_value() const { + // @@protoc_insertion_point(field_get:Canary.protobuf.kv.ValueWrapper.str_value) + return _internal_str_value(); +} +template +inline void ValueWrapper::set_str_value(ArgT0&& arg0, ArgT... args) { + if (!_internal_has_str_value()) { + clear_value(); + set_has_str_value(); + _impl_.value_.str_value_.InitDefault(); + } + _impl_.value_.str_value_.Set( static_cast(arg0), args..., GetArenaForAllocation()); + // @@protoc_insertion_point(field_set:Canary.protobuf.kv.ValueWrapper.str_value) +} +inline std::string* ValueWrapper::mutable_str_value() { + std::string* _s = _internal_mutable_str_value(); + // @@protoc_insertion_point(field_mutable:Canary.protobuf.kv.ValueWrapper.str_value) + return _s; +} +inline const std::string& ValueWrapper::_internal_str_value() const { + if (_internal_has_str_value()) { + return _impl_.value_.str_value_.Get(); + } + return ::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(); +} +inline void ValueWrapper::_internal_set_str_value(const std::string& value) { + if (!_internal_has_str_value()) { + clear_value(); + set_has_str_value(); + _impl_.value_.str_value_.InitDefault(); + } + _impl_.value_.str_value_.Set(value, GetArenaForAllocation()); +} +inline std::string* ValueWrapper::_internal_mutable_str_value() { + if (!_internal_has_str_value()) { + clear_value(); + set_has_str_value(); + _impl_.value_.str_value_.InitDefault(); + } + return _impl_.value_.str_value_.Mutable( GetArenaForAllocation()); +} +inline std::string* ValueWrapper::release_str_value() { + // @@protoc_insertion_point(field_release:Canary.protobuf.kv.ValueWrapper.str_value) + if (_internal_has_str_value()) { + clear_has_value(); + return _impl_.value_.str_value_.Release(); + } else { + return nullptr; + } +} +inline void ValueWrapper::set_allocated_str_value(std::string* str_value) { + if (has_value()) { + clear_value(); + } + if (str_value != nullptr) { + set_has_str_value(); + _impl_.value_.str_value_.InitAllocated(str_value, GetArenaForAllocation()); + } + // @@protoc_insertion_point(field_set_allocated:Canary.protobuf.kv.ValueWrapper.str_value) +} + +// int32 int_value = 2; +inline bool ValueWrapper::_internal_has_int_value() const { + return value_case() == kIntValue; +} +inline bool ValueWrapper::has_int_value() const { + return _internal_has_int_value(); +} +inline void ValueWrapper::set_has_int_value() { + _impl_._oneof_case_[0] = kIntValue; +} +inline void ValueWrapper::clear_int_value() { + if (_internal_has_int_value()) { + _impl_.value_.int_value_ = 0; + clear_has_value(); + } +} +inline int32_t ValueWrapper::_internal_int_value() const { + if (_internal_has_int_value()) { + return _impl_.value_.int_value_; + } + return 0; +} +inline void ValueWrapper::_internal_set_int_value(int32_t value) { + if (!_internal_has_int_value()) { + clear_value(); + set_has_int_value(); + } + _impl_.value_.int_value_ = value; +} +inline int32_t ValueWrapper::int_value() const { + // @@protoc_insertion_point(field_get:Canary.protobuf.kv.ValueWrapper.int_value) + return _internal_int_value(); +} +inline void ValueWrapper::set_int_value(int32_t value) { + _internal_set_int_value(value); + // @@protoc_insertion_point(field_set:Canary.protobuf.kv.ValueWrapper.int_value) +} + +// double double_value = 3; +inline bool ValueWrapper::_internal_has_double_value() const { + return value_case() == kDoubleValue; +} +inline bool ValueWrapper::has_double_value() const { + return _internal_has_double_value(); +} +inline void ValueWrapper::set_has_double_value() { + _impl_._oneof_case_[0] = kDoubleValue; +} +inline void ValueWrapper::clear_double_value() { + if (_internal_has_double_value()) { + _impl_.value_.double_value_ = 0; + clear_has_value(); + } +} +inline double ValueWrapper::_internal_double_value() const { + if (_internal_has_double_value()) { + return _impl_.value_.double_value_; + } + return 0; +} +inline void ValueWrapper::_internal_set_double_value(double value) { + if (!_internal_has_double_value()) { + clear_value(); + set_has_double_value(); + } + _impl_.value_.double_value_ = value; +} +inline double ValueWrapper::double_value() const { + // @@protoc_insertion_point(field_get:Canary.protobuf.kv.ValueWrapper.double_value) + return _internal_double_value(); +} +inline void ValueWrapper::set_double_value(double value) { + _internal_set_double_value(value); + // @@protoc_insertion_point(field_set:Canary.protobuf.kv.ValueWrapper.double_value) +} + +// .Canary.protobuf.kv.ArrayType array_value = 4; +inline bool ValueWrapper::_internal_has_array_value() const { + return value_case() == kArrayValue; +} +inline bool ValueWrapper::has_array_value() const { + return _internal_has_array_value(); +} +inline void ValueWrapper::set_has_array_value() { + _impl_._oneof_case_[0] = kArrayValue; +} +inline void ValueWrapper::clear_array_value() { + if (_internal_has_array_value()) { + if (GetArenaForAllocation() == nullptr) { + delete _impl_.value_.array_value_; + } + clear_has_value(); + } +} +inline ::Canary::protobuf::kv::ArrayType* ValueWrapper::release_array_value() { + // @@protoc_insertion_point(field_release:Canary.protobuf.kv.ValueWrapper.array_value) + if (_internal_has_array_value()) { + clear_has_value(); + ::Canary::protobuf::kv::ArrayType* temp = _impl_.value_.array_value_; + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } + _impl_.value_.array_value_ = nullptr; + return temp; + } else { + return nullptr; + } +} +inline const ::Canary::protobuf::kv::ArrayType& ValueWrapper::_internal_array_value() const { + return _internal_has_array_value() + ? *_impl_.value_.array_value_ + : reinterpret_cast< ::Canary::protobuf::kv::ArrayType&>(::Canary::protobuf::kv::_ArrayType_default_instance_); +} +inline const ::Canary::protobuf::kv::ArrayType& ValueWrapper::array_value() const { + // @@protoc_insertion_point(field_get:Canary.protobuf.kv.ValueWrapper.array_value) + return _internal_array_value(); +} +inline ::Canary::protobuf::kv::ArrayType* ValueWrapper::unsafe_arena_release_array_value() { + // @@protoc_insertion_point(field_unsafe_arena_release:Canary.protobuf.kv.ValueWrapper.array_value) + if (_internal_has_array_value()) { + clear_has_value(); + ::Canary::protobuf::kv::ArrayType* temp = _impl_.value_.array_value_; + _impl_.value_.array_value_ = nullptr; + return temp; + } else { + return nullptr; + } +} +inline void ValueWrapper::unsafe_arena_set_allocated_array_value(::Canary::protobuf::kv::ArrayType* array_value) { + clear_value(); + if (array_value) { + set_has_array_value(); + _impl_.value_.array_value_ = array_value; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:Canary.protobuf.kv.ValueWrapper.array_value) +} +inline ::Canary::protobuf::kv::ArrayType* ValueWrapper::_internal_mutable_array_value() { + if (!_internal_has_array_value()) { + clear_value(); + set_has_array_value(); + _impl_.value_.array_value_ = CreateMaybeMessage< ::Canary::protobuf::kv::ArrayType >(GetArenaForAllocation()); + } + return _impl_.value_.array_value_; +} +inline ::Canary::protobuf::kv::ArrayType* ValueWrapper::mutable_array_value() { + ::Canary::protobuf::kv::ArrayType* _msg = _internal_mutable_array_value(); + // @@protoc_insertion_point(field_mutable:Canary.protobuf.kv.ValueWrapper.array_value) + return _msg; +} + +// .Canary.protobuf.kv.MapType map_value = 5; +inline bool ValueWrapper::_internal_has_map_value() const { + return value_case() == kMapValue; +} +inline bool ValueWrapper::has_map_value() const { + return _internal_has_map_value(); +} +inline void ValueWrapper::set_has_map_value() { + _impl_._oneof_case_[0] = kMapValue; +} +inline void ValueWrapper::clear_map_value() { + if (_internal_has_map_value()) { + if (GetArenaForAllocation() == nullptr) { + delete _impl_.value_.map_value_; + } + clear_has_value(); + } +} +inline ::Canary::protobuf::kv::MapType* ValueWrapper::release_map_value() { + // @@protoc_insertion_point(field_release:Canary.protobuf.kv.ValueWrapper.map_value) + if (_internal_has_map_value()) { + clear_has_value(); + ::Canary::protobuf::kv::MapType* temp = _impl_.value_.map_value_; + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } + _impl_.value_.map_value_ = nullptr; + return temp; + } else { + return nullptr; + } +} +inline const ::Canary::protobuf::kv::MapType& ValueWrapper::_internal_map_value() const { + return _internal_has_map_value() + ? *_impl_.value_.map_value_ + : reinterpret_cast< ::Canary::protobuf::kv::MapType&>(::Canary::protobuf::kv::_MapType_default_instance_); +} +inline const ::Canary::protobuf::kv::MapType& ValueWrapper::map_value() const { + // @@protoc_insertion_point(field_get:Canary.protobuf.kv.ValueWrapper.map_value) + return _internal_map_value(); +} +inline ::Canary::protobuf::kv::MapType* ValueWrapper::unsafe_arena_release_map_value() { + // @@protoc_insertion_point(field_unsafe_arena_release:Canary.protobuf.kv.ValueWrapper.map_value) + if (_internal_has_map_value()) { + clear_has_value(); + ::Canary::protobuf::kv::MapType* temp = _impl_.value_.map_value_; + _impl_.value_.map_value_ = nullptr; + return temp; + } else { + return nullptr; + } +} +inline void ValueWrapper::unsafe_arena_set_allocated_map_value(::Canary::protobuf::kv::MapType* map_value) { + clear_value(); + if (map_value) { + set_has_map_value(); + _impl_.value_.map_value_ = map_value; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:Canary.protobuf.kv.ValueWrapper.map_value) +} +inline ::Canary::protobuf::kv::MapType* ValueWrapper::_internal_mutable_map_value() { + if (!_internal_has_map_value()) { + clear_value(); + set_has_map_value(); + _impl_.value_.map_value_ = CreateMaybeMessage< ::Canary::protobuf::kv::MapType >(GetArenaForAllocation()); + } + return _impl_.value_.map_value_; +} +inline ::Canary::protobuf::kv::MapType* ValueWrapper::mutable_map_value() { + ::Canary::protobuf::kv::MapType* _msg = _internal_mutable_map_value(); + // @@protoc_insertion_point(field_mutable:Canary.protobuf.kv.ValueWrapper.map_value) + return _msg; +} + +inline bool ValueWrapper::has_value() const { + return value_case() != VALUE_NOT_SET; +} +inline void ValueWrapper::clear_has_value() { + _impl_._oneof_case_[0] = VALUE_NOT_SET; +} +inline ValueWrapper::ValueCase ValueWrapper::value_case() const { + return ValueWrapper::ValueCase(_impl_._oneof_case_[0]); +} +// ------------------------------------------------------------------- + +// ArrayType + +// repeated .Canary.protobuf.kv.ValueWrapper values = 1; +inline int ArrayType::_internal_values_size() const { + return _impl_.values_.size(); +} +inline int ArrayType::values_size() const { + return _internal_values_size(); +} +inline void ArrayType::clear_values() { + _impl_.values_.Clear(); +} +inline ::Canary::protobuf::kv::ValueWrapper* ArrayType::mutable_values(int index) { + // @@protoc_insertion_point(field_mutable:Canary.protobuf.kv.ArrayType.values) + return _impl_.values_.Mutable(index); +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::Canary::protobuf::kv::ValueWrapper >* +ArrayType::mutable_values() { + // @@protoc_insertion_point(field_mutable_list:Canary.protobuf.kv.ArrayType.values) + return &_impl_.values_; +} +inline const ::Canary::protobuf::kv::ValueWrapper& ArrayType::_internal_values(int index) const { + return _impl_.values_.Get(index); +} +inline const ::Canary::protobuf::kv::ValueWrapper& ArrayType::values(int index) const { + // @@protoc_insertion_point(field_get:Canary.protobuf.kv.ArrayType.values) + return _internal_values(index); +} +inline ::Canary::protobuf::kv::ValueWrapper* ArrayType::_internal_add_values() { + return _impl_.values_.Add(); +} +inline ::Canary::protobuf::kv::ValueWrapper* ArrayType::add_values() { + ::Canary::protobuf::kv::ValueWrapper* _add = _internal_add_values(); + // @@protoc_insertion_point(field_add:Canary.protobuf.kv.ArrayType.values) + return _add; +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::Canary::protobuf::kv::ValueWrapper >& +ArrayType::values() const { + // @@protoc_insertion_point(field_list:Canary.protobuf.kv.ArrayType.values) + return _impl_.values_; +} + +// ------------------------------------------------------------------- + +// KeyValuePair + +// string key = 1; +inline void KeyValuePair::clear_key() { + _impl_.key_.ClearToEmpty(); +} +inline const std::string& KeyValuePair::key() const { + // @@protoc_insertion_point(field_get:Canary.protobuf.kv.KeyValuePair.key) + return _internal_key(); +} +template +inline PROTOBUF_ALWAYS_INLINE +void KeyValuePair::set_key(ArgT0&& arg0, ArgT... args) { + + _impl_.key_.Set(static_cast(arg0), args..., GetArenaForAllocation()); + // @@protoc_insertion_point(field_set:Canary.protobuf.kv.KeyValuePair.key) +} +inline std::string* KeyValuePair::mutable_key() { + std::string* _s = _internal_mutable_key(); + // @@protoc_insertion_point(field_mutable:Canary.protobuf.kv.KeyValuePair.key) + return _s; +} +inline const std::string& KeyValuePair::_internal_key() const { + return _impl_.key_.Get(); +} +inline void KeyValuePair::_internal_set_key(const std::string& value) { + + _impl_.key_.Set(value, GetArenaForAllocation()); +} +inline std::string* KeyValuePair::_internal_mutable_key() { + + return _impl_.key_.Mutable(GetArenaForAllocation()); +} +inline std::string* KeyValuePair::release_key() { + // @@protoc_insertion_point(field_release:Canary.protobuf.kv.KeyValuePair.key) + return _impl_.key_.Release(); +} +inline void KeyValuePair::set_allocated_key(std::string* key) { + if (key != nullptr) { + + } else { + + } + _impl_.key_.SetAllocated(key, GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (_impl_.key_.IsDefault()) { + _impl_.key_.Set("", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + // @@protoc_insertion_point(field_set_allocated:Canary.protobuf.kv.KeyValuePair.key) +} + +// .Canary.protobuf.kv.ValueWrapper value = 2; +inline bool KeyValuePair::_internal_has_value() const { + return this != internal_default_instance() && _impl_.value_ != nullptr; +} +inline bool KeyValuePair::has_value() const { + return _internal_has_value(); +} +inline void KeyValuePair::clear_value() { + if (GetArenaForAllocation() == nullptr && _impl_.value_ != nullptr) { + delete _impl_.value_; + } + _impl_.value_ = nullptr; +} +inline const ::Canary::protobuf::kv::ValueWrapper& KeyValuePair::_internal_value() const { + const ::Canary::protobuf::kv::ValueWrapper* p = _impl_.value_; + return p != nullptr ? *p : reinterpret_cast( + ::Canary::protobuf::kv::_ValueWrapper_default_instance_); +} +inline const ::Canary::protobuf::kv::ValueWrapper& KeyValuePair::value() const { + // @@protoc_insertion_point(field_get:Canary.protobuf.kv.KeyValuePair.value) + return _internal_value(); +} +inline void KeyValuePair::unsafe_arena_set_allocated_value( + ::Canary::protobuf::kv::ValueWrapper* value) { + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(_impl_.value_); + } + _impl_.value_ = value; + if (value) { + + } else { + + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:Canary.protobuf.kv.KeyValuePair.value) +} +inline ::Canary::protobuf::kv::ValueWrapper* KeyValuePair::release_value() { + + ::Canary::protobuf::kv::ValueWrapper* temp = _impl_.value_; + _impl_.value_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + if (GetArenaForAllocation() == nullptr) { delete old; } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return temp; +} +inline ::Canary::protobuf::kv::ValueWrapper* KeyValuePair::unsafe_arena_release_value() { + // @@protoc_insertion_point(field_release:Canary.protobuf.kv.KeyValuePair.value) + + ::Canary::protobuf::kv::ValueWrapper* temp = _impl_.value_; + _impl_.value_ = nullptr; + return temp; +} +inline ::Canary::protobuf::kv::ValueWrapper* KeyValuePair::_internal_mutable_value() { + + if (_impl_.value_ == nullptr) { + auto* p = CreateMaybeMessage<::Canary::protobuf::kv::ValueWrapper>(GetArenaForAllocation()); + _impl_.value_ = p; + } + return _impl_.value_; +} +inline ::Canary::protobuf::kv::ValueWrapper* KeyValuePair::mutable_value() { + ::Canary::protobuf::kv::ValueWrapper* _msg = _internal_mutable_value(); + // @@protoc_insertion_point(field_mutable:Canary.protobuf.kv.KeyValuePair.value) + return _msg; +} +inline void KeyValuePair::set_allocated_value(::Canary::protobuf::kv::ValueWrapper* value) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + if (message_arena == nullptr) { + delete _impl_.value_; + } + if (value) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena(value); + if (message_arena != submessage_arena) { + value = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, value, submessage_arena); + } + + } else { + + } + _impl_.value_ = value; + // @@protoc_insertion_point(field_set_allocated:Canary.protobuf.kv.KeyValuePair.value) +} + +// ------------------------------------------------------------------- + +// MapType + +// repeated .Canary.protobuf.kv.KeyValuePair items = 1; +inline int MapType::_internal_items_size() const { + return _impl_.items_.size(); +} +inline int MapType::items_size() const { + return _internal_items_size(); +} +inline void MapType::clear_items() { + _impl_.items_.Clear(); +} +inline ::Canary::protobuf::kv::KeyValuePair* MapType::mutable_items(int index) { + // @@protoc_insertion_point(field_mutable:Canary.protobuf.kv.MapType.items) + return _impl_.items_.Mutable(index); +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::Canary::protobuf::kv::KeyValuePair >* +MapType::mutable_items() { + // @@protoc_insertion_point(field_mutable_list:Canary.protobuf.kv.MapType.items) + return &_impl_.items_; +} +inline const ::Canary::protobuf::kv::KeyValuePair& MapType::_internal_items(int index) const { + return _impl_.items_.Get(index); +} +inline const ::Canary::protobuf::kv::KeyValuePair& MapType::items(int index) const { + // @@protoc_insertion_point(field_get:Canary.protobuf.kv.MapType.items) + return _internal_items(index); +} +inline ::Canary::protobuf::kv::KeyValuePair* MapType::_internal_add_items() { + return _impl_.items_.Add(); +} +inline ::Canary::protobuf::kv::KeyValuePair* MapType::add_items() { + ::Canary::protobuf::kv::KeyValuePair* _add = _internal_add_items(); + // @@protoc_insertion_point(field_add:Canary.protobuf.kv.MapType.items) + return _add; +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::Canary::protobuf::kv::KeyValuePair >& +MapType::items() const { + // @@protoc_insertion_point(field_list:Canary.protobuf.kv.MapType.items) + return _impl_.items_; +} + +#ifdef __GNUC__ + #pragma GCC diagnostic pop +#endif // __GNUC__ +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + + +// @@protoc_insertion_point(namespace_scope) + +} // namespace kv +} // namespace protobuf +} // namespace Canary + +// @@protoc_insertion_point(global_scope) + +#include +#endif // GOOGLE_PROTOBUF_INCLUDED_GOOGLE_PROTOBUF_INCLUDED_kv_2eproto diff --git a/src/protobuf/kv.proto b/src/protobuf/kv.proto new file mode 100644 index 000000000..e9f9bfc9d --- /dev/null +++ b/src/protobuf/kv.proto @@ -0,0 +1,31 @@ + syntax = "proto3"; + +package Canary.protobuf.kv; + +// Define a message for the ValueWrapper type +message ValueWrapper { + // Define a oneof construct to ensure only one type can be set at a time + oneof value { + string str_value = 1; + int32 int_value = 2; + double double_value = 3; + ArrayType array_value = 4; + MapType map_value = 5; + } +} + +// Define a message to represent an array of ValueWrapper objects +message ArrayType { + repeated ValueWrapper values = 1; +} + +// Define a message to represent a key-value pair in a map +message KeyValuePair { + string key = 1; + ValueWrapper value = 2; +} + +// Define a message to represent a map of string to ValueWrapper objects +message MapType { + repeated KeyValuePair items = 1; +} diff --git a/src/security/argon.cpp b/src/security/argon.cpp index 7404ec667..606e1d2b7 100644 --- a/src/security/argon.cpp +++ b/src/security/argon.cpp @@ -44,7 +44,7 @@ uint32_t Argon2::parseBitShift(const std::string &bitShiftStr) const { bool Argon2::verifyPassword(const std::string &password, const std::string &phash) const { std::smatch match; if (!std::regex_search(phash, match, re)) { - g_logger().debug("Failed to parse hash string"); + g_logger().debug("No argon2 hash found in string"); return false; } diff --git a/src/server/network/connection/connection.cpp b/src/server/network/connection/connection.cpp index a3fdce090..04e7a82a6 100644 --- a/src/server/network/connection/connection.cpp +++ b/src/server/network/connection/connection.cpp @@ -67,7 +67,7 @@ void Connection::close(bool force) { connectionState = CONNECTION_STATE_CLOSED; if (protocol) { - g_dispatcher().addTask(std::bind_front(&Protocol::release, protocol), 1000); + g_dispatcher().addTask(std::bind_front(&Protocol::release, protocol), "Protocol::release", 1000); } if (messageQueue.empty() || force) { @@ -94,7 +94,7 @@ void Connection::closeSocket() { void Connection::accept(Protocol_ptr protocolPtr) { this->connectionState = CONNECTION_STATE_IDENTIFYING; this->protocol = protocolPtr; - g_dispatcher().addTask(std::bind_front(&Protocol::onConnect, protocolPtr), 1000); + g_dispatcher().addTask(std::bind_front(&Protocol::onConnect, protocolPtr), "Protocol::onConnect", 1000); // Call second accept for not duplicate code accept(false); diff --git a/src/server/network/message/outputmessage.cpp b/src/server/network/message/outputmessage.cpp index 8a2bfcc5f..3579178f2 100644 --- a/src/server/network/message/outputmessage.cpp +++ b/src/server/network/message/outputmessage.cpp @@ -17,7 +17,7 @@ const std::chrono::milliseconds OUTPUTMESSAGE_AUTOSEND_DELAY { 10 }; void OutputMessagePool::scheduleSendAll() { auto function = std::bind_front(&OutputMessagePool::sendAll, this); - g_scheduler().addEvent(OUTPUTMESSAGE_AUTOSEND_DELAY.count(), function); + g_scheduler().addEvent(OUTPUTMESSAGE_AUTOSEND_DELAY.count(), function, "OutputMessagePool::sendAll"); } void OutputMessagePool::sendAll() { diff --git a/src/server/network/protocol/protocol.cpp b/src/server/network/protocol/protocol.cpp index 6270f67ae..735e06c94 100644 --- a/src/server/network/protocol/protocol.cpp +++ b/src/server/network/protocol/protocol.cpp @@ -58,7 +58,7 @@ bool Protocol::sendRecvMessageCallback(NetworkMessage &msg) { } } }; - g_dispatcher().addTask(callback); + g_dispatcher().addTask(callback, __FUNCTION__); return true; } diff --git a/src/server/network/protocol/protocolgame.cpp b/src/server/network/protocol/protocolgame.cpp index f6e022319..f4b70f31d 100644 --- a/src/server/network/protocol/protocolgame.cpp +++ b/src/server/network/protocol/protocolgame.cpp @@ -207,6 +207,32 @@ namespace { } } } + + /** + * @brief Sends the container category to the network message. + * + * @note The default value is "all", which is the first enum (0). The message must always start with "All". + * + * @details for example of enum see the ContainerCategory_t + * + * @param msg The network message to send the category to. + */ + template + void sendContainerCategory(NetworkMessage &msg, phmap::flat_hash_set categories = {}, uint8_t categoryType = 0) { + msg.addByte(categoryType); + g_logger().debug("Sendding category type '{}', categories total size '{}'", categoryType, categories.size()); + msg.addByte(categories.size()); + for (auto value : categories) { + if (value == T::All) { + continue; + } + + g_logger().debug("Sendding category number '{}', category name '{}'", static_cast(value), magic_enum::enum_name(value).data()); + msg.addByte(static_cast(value)); + msg.addString(toStartCaseWithSpace(magic_enum::enum_name(value).data())); + } + } + } // namespace ProtocolGame::ProtocolGame(Connection_ptr initConnection) : @@ -216,12 +242,12 @@ ProtocolGame::ProtocolGame(Connection_ptr initConnection) : template void ProtocolGame::addGameTask(Callable function, Args &&... args) { - g_dispatcher().addTask(std::bind(function, &g_game(), std::forward(args)...)); + g_dispatcher().addTask(std::bind(function, &g_game(), std::forward(args)...), "ProtocolGame::addGameTask"); } template -void ProtocolGame::addGameTaskTimed(uint32_t delay, Callable function, Args &&... args) { - g_dispatcher().addTask(std::bind(function, &g_game(), std::forward(args)...), delay); +void ProtocolGame::addGameTaskTimed(uint32_t delay, std::string context, Callable function, Args &&... args) { + g_dispatcher().addTask(std::bind(function, &g_game(), std::forward(args)...), context, delay); } void ProtocolGame::AddItem(NetworkMessage &msg, uint16_t id, uint8_t count, uint8_t tier) { @@ -277,6 +303,10 @@ void ProtocolGame::AddItem(NetworkMessage &msg, uint16_t id, uint8_t count, uint msg.add(it.charges); msg.addByte(0x01); // Brand-new } + + if (it.isWrapKit && !oldProtocol) { + msg.add(0x00); + } } void ProtocolGame::AddItem(NetworkMessage &msg, const Item* item) { @@ -404,6 +434,15 @@ void ProtocolGame::AddItem(NetworkMessage &msg, const Item* item) { msg.addByte(item->getSubType() == it.charges ? 0x01 : 0x00); // Brand-new } } + + if (it.isWrapKit && !oldProtocol) { + uint16_t unWrapId = item->getCustomAttribute("unWrapId") ? static_cast(item->getCustomAttribute("unWrapId")->getInteger()) : 0; + if (unWrapId != 0) { + msg.add(unWrapId); + } else { + msg.add(0x00); + } + } } void ProtocolGame::release() { @@ -433,15 +472,6 @@ void ProtocolGame::login(const std::string &name, uint32_t accountId, OperatingS writeToOutputBuffer(opcodeMessage); } - account::Account playerAccount; - if (playerAccount.LoadAccountDB(accountId) != account::ERROR_NO) { - disconnectClient("Your account could not be loaded."); - return; - } - - // Update premium days - playerAccount.UpdatePremium(); - // dispatcher thread Player* foundPlayer = g_game().getPlayerUniqueLogin(name); if (!foundPlayer) { @@ -482,7 +512,7 @@ void ProtocolGame::login(const std::string &name, uint32_t accountId, OperatingS return; } - if (g_configManager().getBoolean(ONE_PLAYER_ON_ACCOUNT) && player->getAccountType() < account::ACCOUNT_TYPE_GAMEMASTER && g_game().getPlayerByAccount(player->getAccount())) { + if (g_configManager().getBoolean(ONE_PLAYER_ON_ACCOUNT) && player->getAccountType() < account::ACCOUNT_TYPE_GAMEMASTER && g_game().getPlayerByAccount(player->getAccountId())) { g_game().removePlayerUniqueLogin(player); disconnectClient("You may only login with one character\nof your account at the same time."); return; @@ -558,7 +588,7 @@ void ProtocolGame::login(const std::string &name, uint32_t accountId, OperatingS foundPlayer->disconnect(); foundPlayer->isConnecting = true; - eventConnect = g_scheduler().addEvent(1000, std::bind(&ProtocolGame::connect, getThis(), foundPlayer->getName(), operatingSystem)); + eventConnect = g_scheduler().addEvent(1000, std::bind(&ProtocolGame::connect, getThis(), foundPlayer->getName(), operatingSystem), "ProtocolGame::connect"); } else { connect(foundPlayer->getName(), operatingSystem); } @@ -675,8 +705,8 @@ void ProtocolGame::onRecvFirstMessage(NetworkMessage &msg) { std::string authType = g_configManager().getString(AUTH_TYPE); std::ostringstream ss; std::string sessionKey = msg.getString(); - std::string accountIdentifier = ""; - std::string sessionOrPassword = sessionKey; + std::string accountDescriptor = sessionKey; + std::string password = ""; if (authType != "session") { size_t pos = sessionKey.find('\n'); @@ -685,14 +715,14 @@ void ProtocolGame::onRecvFirstMessage(NetworkMessage &msg) { disconnectClient(ss.str()); return; } - accountIdentifier = sessionKey.substr(0, pos); - if (accountIdentifier.empty()) { + accountDescriptor = sessionKey.substr(0, pos); + if (accountDescriptor.empty()) { ss.str(std::string()); ss << "You must enter your " << (oldProtocol ? "username" : "email") << "."; disconnectClient(ss.str()); return; } - sessionOrPassword = sessionKey.substr(pos + 1); + password = sessionKey.substr(pos + 1); } if (!oldProtocol && operatingSystem == CLIENTOS_NEW_LINUX) { @@ -756,7 +786,7 @@ void ProtocolGame::onRecvFirstMessage(NetworkMessage &msg) { } uint32_t accountId; - if (!IOLoginData::gameWorldAuthentication(accountIdentifier, sessionOrPassword, characterName, &accountId, oldProtocol)) { + if (!IOLoginData::gameWorldAuthentication(accountDescriptor, password, characterName, accountId, oldProtocol)) { ss.str(std::string()); if (authType == "session") { ss << "Your session has expired. Please log in again."; @@ -768,11 +798,11 @@ void ProtocolGame::onRecvFirstMessage(NetworkMessage &msg) { output->addByte(0x14); output->addString(ss.str()); send(output); - g_scheduler().addEvent(1000, std::bind(&ProtocolGame::disconnect, getThis())); + g_scheduler().addEvent(1000, std::bind(&ProtocolGame::disconnect, getThis()), "ProtocolGame::disconnect"); return; } - g_dispatcher().addTask(std::bind(&ProtocolGame::login, getThis(), characterName, accountId, operatingSystem)); + g_dispatcher().addTask(std::bind(&ProtocolGame::login, getThis(), characterName, accountId, operatingSystem), "ProtocolGame::login"); } void ProtocolGame::onConnect() { @@ -837,16 +867,16 @@ void ProtocolGame::parsePacket(NetworkMessage &msg) { m_playerDeathTime++; } - g_dispatcher().addTask(std::bind(&ProtocolGame::parsePacketDead, getThis(), recvbyte)); + g_dispatcher().addTask(std::bind(&ProtocolGame::parsePacketDead, getThis(), recvbyte), "ProtocolGame::parsePacketDead"); return; } // Modules system if (player && recvbyte != 0xD3) { - g_dispatcher().addTask(std::bind(&Modules::executeOnRecvbyte, &g_modules(), player->getID(), msg, recvbyte)); + g_dispatcher().addTask(std::bind(&Modules::executeOnRecvbyte, &g_modules(), player->getID(), msg, recvbyte), "Modules::executeOnRecvbyte"); } - g_dispatcher().addTask(std::bind(&ProtocolGame::parsePacketFromDispatcher, getThis(), msg, recvbyte)); + g_dispatcher().addTask(std::bind(&ProtocolGame::parsePacketFromDispatcher, getThis(), msg, recvbyte), "ProtocolGame::parsePacketFromDispatcher"); } void ProtocolGame::parsePacketDead(uint8_t recvbyte) { @@ -856,7 +886,7 @@ void ProtocolGame::parsePacketDead(uint8_t recvbyte) { g_game().removePlayerUniqueLogin(player->getName()); } disconnect(); - g_dispatcher().addTask(std::bind(&IOLoginData::updateOnlineStatus, player->getGUID(), false)); + g_dispatcher().addTask(std::bind(&IOLoginData::updateOnlineStatus, player->getGUID(), false), "IOLoginData::updateOnlineStatus"); return; } @@ -865,7 +895,7 @@ void ProtocolGame::parsePacketDead(uint8_t recvbyte) { return; } - g_scheduler().addEvent(100, std::bind(&ProtocolGame::sendPing, getThis())); + g_scheduler().addEvent(100, std::bind(&ProtocolGame::sendPing, getThis()), "ProtocolGame::sendPing"); if (!player->spawn()) { disconnect(); @@ -873,15 +903,15 @@ void ProtocolGame::parsePacketDead(uint8_t recvbyte) { return; } - g_dispatcher().addTask(std::bind(&ProtocolGame::sendAddCreature, getThis(), player, player->getPosition(), 0, false)); - g_dispatcher().addTask(std::bind(&ProtocolGame::addBless, getThis())); + g_dispatcher().addTask(std::bind(&ProtocolGame::sendAddCreature, getThis(), player, player->getPosition(), 0, false), "ProtocolGame::sendAddCreature"); + g_dispatcher().addTask(std::bind(&ProtocolGame::addBless, getThis()), "ProtocolGame::addBless"); resetPlayerDeathTime(); return; } if (recvbyte == 0x1D) { // keep the connection alive - g_scheduler().addEvent(100, std::bind(&ProtocolGame::sendPingBack, getThis())); + g_scheduler().addEvent(100, std::bind(&ProtocolGame::sendPingBack, getThis()), "ProtocolGame::sendPingBack"); return; } } @@ -916,7 +946,7 @@ void ProtocolGame::parsePacketFromDispatcher(NetworkMessage msg, uint8_t recvbyt switch (recvbyte) { case 0x14: - g_dispatcher().addTask(std::bind(&ProtocolGame::logout, getThis(), true, false)); + g_dispatcher().addTask(std::bind(&ProtocolGame::logout, getThis(), true, false), "ProtocolGame::logout"); break; case 0x1D: addGameTask(&Game::playerReceivePingBack, player->getID()); @@ -985,16 +1015,16 @@ void ProtocolGame::parsePacketFromDispatcher(NetworkMessage msg, uint8_t recvbyt addGameTask(&Game::playerMove, player->getID(), DIRECTION_NORTHWEST); break; case 0x6F: - addGameTaskTimed(DISPATCHER_TASK_EXPIRATION, &Game::playerTurn, player->getID(), DIRECTION_NORTH); + addGameTaskTimed(DISPATCHER_TASK_EXPIRATION, "Game::playerTurn", &Game::playerTurn, player->getID(), DIRECTION_NORTH); break; case 0x70: - addGameTaskTimed(DISPATCHER_TASK_EXPIRATION, &Game::playerTurn, player->getID(), DIRECTION_EAST); + addGameTaskTimed(DISPATCHER_TASK_EXPIRATION, "Game::playerTurn", &Game::playerTurn, player->getID(), DIRECTION_EAST); break; case 0x71: - addGameTaskTimed(DISPATCHER_TASK_EXPIRATION, &Game::playerTurn, player->getID(), DIRECTION_SOUTH); + addGameTaskTimed(DISPATCHER_TASK_EXPIRATION, "Game::playerTurn", &Game::playerTurn, player->getID(), DIRECTION_SOUTH); break; case 0x72: - addGameTaskTimed(DISPATCHER_TASK_EXPIRATION, &Game::playerTurn, player->getID(), DIRECTION_WEST); + addGameTaskTimed(DISPATCHER_TASK_EXPIRATION, "Game::playerTurn", &Game::playerTurn, player->getID(), DIRECTION_WEST); break; case 0x73: parseTeleport(msg); @@ -1188,7 +1218,7 @@ void ProtocolGame::parsePacketFromDispatcher(NetworkMessage msg, uint8_t recvbyt break; // g_dispatcher().addTask(std::bind(&Modules::executeOnRecvbyte, g_modules, player, msg, recvbyte)); case 0xD3: - g_dispatcher().addTask(std::bind(&ProtocolGame::parseSetOutfit, getThis(), msg)); + g_dispatcher().addTask(std::bind(&ProtocolGame::parseSetOutfit, getThis(), msg), "ProtocolGame::parseSetOutfit"); break; case 0xD4: parseToggleMount(msg); @@ -1246,7 +1276,7 @@ void ProtocolGame::parsePacketFromDispatcher(NetworkMessage msg, uint8_t recvbyt // Premium coins transfer // case 0xEF: parseCoinTransfer(msg); break; case 0xF0: - addGameTaskTimed(DISPATCHER_TASK_EXPIRATION, &Game::playerShowQuestLog, player->getID()); + addGameTaskTimed(DISPATCHER_TASK_EXPIRATION, "Game::playerShowQuestLog", &Game::playerShowQuestLog, player->getID()); break; case 0xF1: parseQuestLine(msg); @@ -1284,7 +1314,8 @@ void ProtocolGame::parsePacketFromDispatcher(NetworkMessage msg, uint8_t recvbyt // case 0xDF, 0xE0, 0xE1, 0xFB, 0xFC, 0xFD, 0xFE Premium Shop. default: - g_logger().debug("Player: {} sent an unknown packet header: x0{}", player->getName(), static_cast(recvbyte)); + std::string hexString = fmt::format("0x{:02x}", recvbyte); + g_logger().debug("Player '{}' sent unknown packet header: hex[{}], decimal[{}]", player->getName(), asUpperCaseString(hexString), recvbyte); break; } } @@ -1648,7 +1679,7 @@ void ProtocolGame::parseUseItem(NetworkMessage &msg) { uint16_t itemId = msg.get(); uint8_t stackpos = msg.getByte(); uint8_t index = msg.getByte(); - addGameTaskTimed(DISPATCHER_TASK_EXPIRATION, &Game::playerUseItem, player->getID(), pos, stackpos, index, itemId); + addGameTaskTimed(DISPATCHER_TASK_EXPIRATION, "Game::playerUseItem", &Game::playerUseItem, player->getID(), pos, stackpos, index, itemId); } void ProtocolGame::parseUseItemEx(NetworkMessage &msg) { @@ -1658,7 +1689,7 @@ void ProtocolGame::parseUseItemEx(NetworkMessage &msg) { Position toPos = msg.getPosition(); uint16_t toItemId = msg.get(); uint8_t toStackPos = msg.getByte(); - addGameTaskTimed(DISPATCHER_TASK_EXPIRATION, &Game::playerUseItemEx, player->getID(), fromPos, fromStackPos, fromItemId, toPos, toStackPos, toItemId); + addGameTaskTimed(DISPATCHER_TASK_EXPIRATION, "Game::playerUseItemEx", &Game::playerUseItemEx, player->getID(), fromPos, fromStackPos, fromItemId, toPos, toStackPos, toItemId); } void ProtocolGame::parseUseWithCreature(NetworkMessage &msg) { @@ -1666,7 +1697,7 @@ void ProtocolGame::parseUseWithCreature(NetworkMessage &msg) { uint16_t itemId = msg.get(); uint8_t fromStackPos = msg.getByte(); uint32_t creatureId = msg.get(); - addGameTaskTimed(DISPATCHER_TASK_EXPIRATION, &Game::playerUseWithCreature, player->getID(), fromPos, fromStackPos, creatureId, itemId); + addGameTaskTimed(DISPATCHER_TASK_EXPIRATION, "Game::playerUseWithCreature", &Game::playerUseWithCreature, player->getID(), fromPos, fromStackPos, creatureId, itemId); } void ProtocolGame::parseCloseContainer(NetworkMessage &msg) { @@ -1697,7 +1728,7 @@ void ProtocolGame::parseThrow(NetworkMessage &msg) { uint8_t count = msg.getByte(); if (toPos != fromPos) { - addGameTaskTimed(DISPATCHER_TASK_EXPIRATION, &Game::playerMoveThing, player->getID(), fromPos, itemId, fromStackpos, toPos, count); + addGameTaskTimed(DISPATCHER_TASK_EXPIRATION, "Game::playerMoveThing", &Game::playerMoveThing, player->getID(), fromPos, itemId, fromStackpos, toPos, count); } } @@ -1705,12 +1736,12 @@ void ProtocolGame::parseLookAt(NetworkMessage &msg) { Position pos = msg.getPosition(); uint16_t itemId = msg.get(); uint8_t stackpos = msg.getByte(); - addGameTaskTimed(DISPATCHER_TASK_EXPIRATION, &Game::playerLookAt, player->getID(), itemId, pos, stackpos); + addGameTaskTimed(DISPATCHER_TASK_EXPIRATION, "Game::playerLookAt", &Game::playerLookAt, player->getID(), itemId, pos, stackpos); } void ProtocolGame::parseLookInBattleList(NetworkMessage &msg) { uint32_t creatureId = msg.get(); - addGameTaskTimed(DISPATCHER_TASK_EXPIRATION, &Game::playerLookInBattleList, player->getID(), creatureId); + addGameTaskTimed(DISPATCHER_TASK_EXPIRATION, "Game::playerLookInBattleList", &Game::playerLookInBattleList, player->getID(), creatureId); } void ProtocolGame::parseQuickLoot(NetworkMessage &msg) { @@ -1844,7 +1875,7 @@ void ProtocolGame::parseHouseWindow(NetworkMessage &msg) { void ProtocolGame::parseLookInShop(NetworkMessage &msg) { uint16_t id = msg.get(); uint8_t count = msg.getByte(); - addGameTaskTimed(DISPATCHER_TASK_EXPIRATION, &Game::playerLookInShop, player->getID(), id, count); + addGameTaskTimed(DISPATCHER_TASK_EXPIRATION, "Game::playerLookInShop", &Game::playerLookInShop, player->getID(), id, count); } void ProtocolGame::parsePlayerBuyOnShop(NetworkMessage &msg) { @@ -1853,7 +1884,7 @@ void ProtocolGame::parsePlayerBuyOnShop(NetworkMessage &msg) { uint16_t amount = oldProtocol ? static_cast(msg.getByte()) : msg.get(); bool ignoreCap = msg.getByte() != 0; bool inBackpacks = msg.getByte() != 0; - addGameTaskTimed(DISPATCHER_TASK_EXPIRATION, &Game::playerBuyItem, player->getID(), id, count, amount, ignoreCap, inBackpacks); + addGameTaskTimed(DISPATCHER_TASK_EXPIRATION, "Game::playerBuyItem", &Game::playerBuyItem, player->getID(), id, count, amount, ignoreCap, inBackpacks); } void ProtocolGame::parsePlayerSellOnShop(NetworkMessage &msg) { @@ -1862,7 +1893,7 @@ void ProtocolGame::parsePlayerSellOnShop(NetworkMessage &msg) { uint16_t amount = oldProtocol ? static_cast(msg.getByte()) : msg.get(); bool ignoreEquipped = msg.getByte() != 0; - addGameTaskTimed(DISPATCHER_TASK_EXPIRATION, &Game::playerSellItem, player->getID(), id, count, amount, ignoreEquipped); + addGameTaskTimed(DISPATCHER_TASK_EXPIRATION, "Game::playerSellItem", &Game::playerSellItem, player->getID(), id, count, amount, ignoreEquipped); } void ProtocolGame::parseRequestTrade(NetworkMessage &msg) { @@ -1876,7 +1907,7 @@ void ProtocolGame::parseRequestTrade(NetworkMessage &msg) { void ProtocolGame::parseLookInTrade(NetworkMessage &msg) { bool counterOffer = (msg.getByte() == 0x01); uint8_t index = msg.getByte(); - addGameTaskTimed(DISPATCHER_TASK_EXPIRATION, &Game::playerLookInTrade, player->getID(), counterOffer, index); + addGameTaskTimed(DISPATCHER_TASK_EXPIRATION, "Game::playerLookInTrade", &Game::playerLookInTrade, player->getID(), counterOffer, index); } void ProtocolGame::parseAddVip(NetworkMessage &msg) { @@ -1903,9 +1934,9 @@ void ProtocolGame::parseRotateItem(NetworkMessage &msg) { uint8_t stackpos = msg.getByte(); const auto &itemType = Item::items[itemId]; if (itemType.isPodium) { - addGameTaskTimed(DISPATCHER_TASK_EXPIRATION, &Game::playerRotatePodium, player->getID(), pos, stackpos, itemId); + addGameTaskTimed(DISPATCHER_TASK_EXPIRATION, "Game::playerRotatePodium", &Game::playerRotatePodium, player->getID(), pos, stackpos, itemId); } else { - addGameTaskTimed(DISPATCHER_TASK_EXPIRATION, &Game::playerRotateItem, player->getID(), pos, stackpos, itemId); + addGameTaskTimed(DISPATCHER_TASK_EXPIRATION, "Game::playerRotateItem", &Game::playerRotateItem, player->getID(), pos, stackpos, itemId); } } @@ -1913,7 +1944,7 @@ void ProtocolGame::parseWrapableItem(NetworkMessage &msg) { Position pos = msg.getPosition(); uint16_t itemId = msg.get(); uint8_t stackpos = msg.getByte(); - addGameTaskTimed(DISPATCHER_TASK_EXPIRATION, &Game::playerWrapableItem, player->getID(), pos, stackpos, itemId); + addGameTaskTimed(DISPATCHER_TASK_EXPIRATION, "Game::playerWrapableItem", &Game::playerWrapableItem, player->getID(), pos, stackpos, itemId); } void ProtocolGame::parseInspectionObject(NetworkMessage &msg) { @@ -2999,7 +3030,7 @@ void ProtocolGame::parseMarketBrowse(NetworkMessage &msg) { if ((oldProtocol && browseId == MARKETREQUEST_OWN_OFFERS_OLD) || (!oldProtocol && browseId == MARKETREQUEST_OWN_OFFERS)) { addGameTask(&Game::playerBrowseMarketOwnOffers, player->getID()); - } else if ((oldProtocol && browseId == MARKETREQUEST_OWN_HISTORY) || (!oldProtocol && browseId == MARKETREQUEST_OWN_HISTORY_OLD)) { + } else if ((oldProtocol && browseId == MARKETREQUEST_OWN_HISTORY_OLD) || (!oldProtocol && browseId == MARKETREQUEST_OWN_HISTORY)) { addGameTask(&Game::playerBrowseMarketOwnHistory, player->getID()); } else if (!oldProtocol) { uint16_t itemId = msg.get(); @@ -3078,7 +3109,8 @@ void ProtocolGame::parseBrowseField(NetworkMessage &msg) { void ProtocolGame::parseSeekInContainer(NetworkMessage &msg) { uint8_t containerId = msg.getByte(); uint16_t index = msg.get(); - addGameTask(&Game::playerSeekInContainer, player->getID(), containerId, index); + auto primaryType = msg.getByte(); + addGameTask(&Game::playerSeekInContainer, player->getID(), containerId, index, primaryType); } // Send methods @@ -3143,12 +3175,12 @@ void ProtocolGame::addCreatureIcon(NetworkMessage &msg, const Creature* creature return; } - const auto icon = creature->getIcon(); - // 0 = no icon, 1 = we'll send an icon - if (icon.isNone()) { - msg.addByte(0); - } else { - msg.addByte(1); + const auto icons = creature->getIcons(); + // client only supports 3 icons, otherwise it will crash + const auto count = icons.size() > 3 ? 3 : icons.size(); + msg.addByte(count); + for (uint8_t i = 0; i < count; ++i) { + const auto &icon = icons[i]; msg.addByte(icon.serialize()); msg.addByte(static_cast(icon.category)); msg.add(icon.count); @@ -3891,7 +3923,7 @@ void ProtocolGame::sendBasicData() { msg.addByte(0x9F); if (player->isPremium() || player->isVip()) { msg.addByte(1); - msg.add(getTimeNow() + ((player->premiumDays + 1) * 86400)); + msg.add(getTimeNow() + ((player->getPremiumDays() + 1) * 86400)); } else { msg.addByte(0); msg.add(0); @@ -3932,7 +3964,7 @@ void ProtocolGame::sendBasicData() { if (spell->isLearnable() && !player->hasLearnedInstantSpell(spell->getName())) { msg.add(0); } else if (spell && spell->isLearnable() && player->hasLearnedInstantSpell(spell->getName())) { - // Ignore spell if not have wheel grade (or send if have) + // Ignore spell if not have wheel grade (or send if you have) auto grade = player->wheel()->getSpellUpgrade(spell->getName()); if (static_cast(grade) == 0) { msg.add(0); @@ -3977,7 +4009,7 @@ void ProtocolGame::sendBlessStatus() { msg.add(blessCount >= 5 ? 0x01 : 0x00); } else { bool glow = (g_configManager().getBoolean(INVENTORY_GLOW) && blessCount >= 5) || player->getLevel() < g_configManager().getNumber(ADVENTURERSBLESSING_LEVEL); - msg.add(glow ? 1 : 0); // Show up the glowing effect in items if have all blesses or adventurer's blessing + msg.add(glow ? 1 : 0); // Show up the glowing effect in items if you have all blesses or adventurer's blessing msg.addByte((blessCount >= 7) ? 3 : ((blessCount >= 5) ? 2 : 1)); // 1 = Disabled | 2 = normal | 3 = green } @@ -4195,6 +4227,10 @@ void ProtocolGame::sendUnjustifiedPoints(const uint8_t &dayProgress, const uint8 } void ProtocolGame::sendContainer(uint8_t cid, const Container* container, bool hasParent, uint16_t firstIndex) { + if (!player) { + return; + } + NetworkMessage msg; msg.addByte(0x6E); @@ -4208,6 +4244,8 @@ void ProtocolGame::sendContainer(uint8_t cid, const Container* container, bool h msg.addString(container->getName()); } + const auto itemsStoreInboxToSend = container->getStoreInboxFilteredItems(); + msg.addByte(container->capacity()); msg.addByte(hasParent ? 0x01 : 0x00); @@ -4221,6 +4259,9 @@ void ProtocolGame::sendContainer(uint8_t cid, const Container* container, bool h msg.addByte(container->hasPagination() ? 0x01 : 0x00); // Pagination uint32_t containerSize = container->size(); + if (!itemsStoreInboxToSend.empty()) { + containerSize = itemsStoreInboxToSend.size(); + } msg.add(containerSize); msg.add(firstIndex); @@ -4232,17 +4273,58 @@ void ProtocolGame::sendContainer(uint8_t cid, const Container* container, bool h maxItemsToSend = container->capacity(); } + const ItemDeque &itemList = container->getItemList(); if (firstIndex >= containerSize) { msg.addByte(0x00); + } else if (container->getID() == ITEM_STORE_INBOX && !itemsStoreInboxToSend.empty()) { + msg.addByte(std::min(maxItemsToSend, containerSize)); + for (const auto item : itemsStoreInboxToSend) { + AddItem(msg, item); + } } else { msg.addByte(std::min(maxItemsToSend, containerSize)); uint32_t i = 0; - const ItemDeque &itemList = container->getItemList(); for (ItemDeque::const_iterator it = itemList.begin() + firstIndex, end = itemList.end(); i < maxItemsToSend && it != end; ++it, ++i) { AddItem(msg, *it); } } + + // From here on down is for version 13.21+ + if (oldProtocol) { + writeToOutputBuffer(msg); + return; + } + + if (container->isStoreInbox()) { + auto categories = container->getStoreInboxValidCategories(); + const auto enumName = container->getAttribute(ItemAttribute_t::STORE_INBOX_CATEGORY); + auto category = magic_enum::enum_cast(enumName); + if (category.has_value()) { + bool toSendCategory = false; + // Check if category exist in the deque + for (const auto &tempCategory : categories) { + if (tempCategory == category.value()) { + toSendCategory = true; + g_logger().debug("found category {}", toSendCategory); + } + } + + if (!toSendCategory) { + Container* container = player->getContainerByID(cid); + if (container) { + container->removeAttribute(ItemAttribute_t::STORE_INBOX_CATEGORY); + } + } + sendContainerCategory(msg, categories, static_cast(category.value())); + } else { + sendContainerCategory(msg, categories); + } + } else { + msg.addByte(0x00); + msg.addByte(0x00); + } + writeToOutputBuffer(msg); } @@ -4520,19 +4602,18 @@ void ProtocolGame::updateCoinBalance() { g_dispatcher().addTask( std::bind([](uint32_t playerId) { Player* threadPlayer = g_game().getPlayerByID(playerId); - if (threadPlayer) { - account::Account account; - account.LoadAccountDB(threadPlayer->getAccount()); - uint32_t coins; - account.GetCoins(&coins); - uint32_t transfercoins; - account.GetTransferableCoins(&transfercoins); + if (threadPlayer && threadPlayer->getAccount()) { + + auto [coins, errCoin] = threadPlayer->getAccount()->getCoins(account::CoinType::COIN); + auto [transferCoins, errTCoin] = threadPlayer->getAccount()->getCoins(account::CoinType::TRANSFERABLE); + threadPlayer->coinBalance = coins; - threadPlayer->coinTransferableBalance = transfercoins; + threadPlayer->coinTransferableBalance = transferCoins; threadPlayer->sendCoinBalance(); } }, - player->getID()) + player->getID()), + "ProtocolGame::updateCoinBalance" ); } @@ -6097,7 +6178,7 @@ void ProtocolGame::sendAddCreature(const Creature* creature, const Position &pos // player light level sendCreatureLight(creature); - const std::forward_list &vipEntries = IOLoginData::getVIPEntries(player->getAccount()); + const std::forward_list &vipEntries = IOLoginData::getVIPEntries(player->getAccountId()); if (player->isAccessPlayer()) { for (const VIPEntry &entry : vipEntries) { diff --git a/src/server/network/protocol/protocolgame.hpp b/src/server/network/protocol/protocolgame.hpp index da6898eb1..1b57e3c13 100644 --- a/src/server/network/protocol/protocolgame.hpp +++ b/src/server/network/protocol/protocolgame.hpp @@ -72,7 +72,7 @@ class ProtocolGame final : public Protocol { template void addGameTask(Callable function, Args &&... args); template - void addGameTaskTimed(uint32_t delay, Callable function, Args &&... args); + void addGameTaskTimed(uint32_t delay, std::string context, Callable function, Args &&... args); ProtocolGame_ptr getThis() { return std::static_pointer_cast(shared_from_this()); diff --git a/src/server/network/protocol/protocollogin.cpp b/src/server/network/protocol/protocollogin.cpp index d039f7783..756dc07a1 100644 --- a/src/server/network/protocol/protocollogin.cpp +++ b/src/server/network/protocol/protocollogin.cpp @@ -12,7 +12,7 @@ #include "server/network/protocol/protocollogin.hpp" #include "server/network/message/outputmessage.hpp" #include "game/scheduling/dispatcher.hpp" -#include "creatures/players/account/account.hpp" +#include "account/account.hpp" #include "io/iologindata.hpp" #include "creatures/players/management/ban.hpp" #include "game/game.hpp" @@ -28,8 +28,8 @@ void ProtocolLogin::disconnectClient(const std::string &message) { disconnect(); } -void ProtocolLogin::getCharacterList(const std::string &accountIdentifier, const std::string &password) { - account::Account account; +void ProtocolLogin::getCharacterList(const std::string &accountDescriptor, const std::string &password) { + account::Account account(accountDescriptor); account.setProtocolCompat(oldProtocol); if (oldProtocol && !g_configManager().getBoolean(OLD_PROTOCOL)) { @@ -40,16 +40,13 @@ void ProtocolLogin::getCharacterList(const std::string &accountIdentifier, const return; } - if (!IOLoginData::authenticateAccountPassword(accountIdentifier, password, &account)) { + if (account.load() != account::ERROR_NO || !account.authenticate(password)) { std::ostringstream ss; ss << (oldProtocol ? "Username" : "Email") << " or password is not correct."; disconnectClient(ss.str()); return; } - // Update premium days - account.UpdatePremium(); - auto output = OutputMessagePool::getOutputMessage(); const std::string &motd = g_configManager().getString(SERVER_MOTD); if (!motd.empty()) { @@ -64,11 +61,14 @@ void ProtocolLogin::getCharacterList(const std::string &accountIdentifier, const // Add session key output->addByte(0x28); - output->addString(accountIdentifier + "\n" + password); + output->addString(accountDescriptor + "\n" + password); // Add char list - std::vector players; - account.GetAccountPlayers(&players); + auto [players, result] = account.getAccountPlayers(); + if (account::ERROR_NO != result) { + g_logger().warn("Account[{}] failed to load players!", account.getID()); + } + output->addByte(0x64); output->addByte(1); // number of worlds @@ -83,19 +83,16 @@ void ProtocolLogin::getCharacterList(const std::string &accountIdentifier, const uint8_t size = std::min(std::numeric_limits::max(), players.size()); output->addByte(size); - for (uint8_t i = 0; i < size; i++) { + for (const auto &[name, deletion] : players) { output->addByte(0); - output->addString(players[i].name); + output->addString(name); } // Add premium days output->addByte(0); - uint32_t days; - time_t lastDay; - account.GetPremiumRemainingDays(&days); - account.GetPremiumLastDay(&lastDay); - output->addByte(0); - output->add(lastDay); + + output->addByte(account.getPremiumRemainingDays() > 0); + output->add(account.getPremiumLastDay()); send(output); @@ -163,8 +160,8 @@ void ProtocolLogin::onRecvFirstMessage(NetworkMessage &msg) { return; } - std::string accountIdentifier = msg.getString(); - if (accountIdentifier.empty()) { + std::string accountDescriptor = msg.getString(); + if (accountDescriptor.empty()) { std::ostringstream ss; ss << "Invalid " << (oldProtocol ? "username" : "email") << "."; disconnectClient(ss.str()); @@ -178,5 +175,5 @@ void ProtocolLogin::onRecvFirstMessage(NetworkMessage &msg) { } auto thisPtr = std::static_pointer_cast(shared_from_this()); - g_dispatcher().addTask(std::bind(&ProtocolLogin::getCharacterList, thisPtr, accountIdentifier, password)); + g_dispatcher().addTask(std::bind(&ProtocolLogin::getCharacterList, thisPtr, accountDescriptor, password), "ProtocolLogin::getCharacterList"); } diff --git a/src/server/network/protocol/protocollogin.hpp b/src/server/network/protocol/protocollogin.hpp index cd19c2157..367c4ccf1 100644 --- a/src/server/network/protocol/protocollogin.hpp +++ b/src/server/network/protocol/protocollogin.hpp @@ -32,7 +32,7 @@ class ProtocolLogin : public Protocol { private: void disconnectClient(const std::string &message); - void getCharacterList(const std::string &accountIdentifier, const std::string &password); + void getCharacterList(const std::string &accountDescriptor, const std::string &password); bool oldProtocol = false; }; diff --git a/src/server/network/protocol/protocolstatus.cpp b/src/server/network/protocol/protocolstatus.cpp index 0d9203ece..9ca24df82 100644 --- a/src/server/network/protocol/protocolstatus.cpp +++ b/src/server/network/protocol/protocolstatus.cpp @@ -38,11 +38,7 @@ void ProtocolStatus::onRecvFirstMessage(NetworkMessage &msg) { // XML info protocol case 0xFF: { if (msg.getString(4) == "info") { - g_dispatcher().addTask(std::bind( - &ProtocolStatus::sendStatusString, - std::static_pointer_cast< - ProtocolStatus>(shared_from_this()) - )); + g_dispatcher().addTask(std::bind(&ProtocolStatus::sendStatusString, std::static_pointer_cast(shared_from_this())), "ProtocolStatus::sendStatusString"); return; } break; @@ -55,7 +51,7 @@ void ProtocolStatus::onRecvFirstMessage(NetworkMessage &msg) { if (requestedInfo & REQUEST_PLAYER_STATUS_INFO) { characterName = msg.getString(); } - g_dispatcher().addTask(std::bind(&ProtocolStatus::sendInfo, std::static_pointer_cast(shared_from_this()), requestedInfo, characterName)); + g_dispatcher().addTask(std::bind(&ProtocolStatus::sendInfo, std::static_pointer_cast(shared_from_this()), requestedInfo, characterName), "ProtocolStatus::sendInfo"); return; } diff --git a/src/server/network/webhook/webhook.cpp b/src/server/network/webhook/webhook.cpp index 9e8aea5ad..06bc8eb9e 100644 --- a/src/server/network/webhook/webhook.cpp +++ b/src/server/network/webhook/webhook.cpp @@ -38,7 +38,9 @@ Webhook &Webhook::getInstance() { void Webhook::run() { threadPool.addLoad([this] { sendWebhook(); }); - g_scheduler().addEvent(g_configManager().getNumber(DISCORD_WEBHOOK_DELAY_MS), [this] { run(); }); + g_scheduler().addEvent( + g_configManager().getNumber(DISCORD_WEBHOOK_DELAY_MS), [this] { run(); }, "Webhook::run" + ); } void Webhook::sendMessage(const std::string payload, std::string url) { diff --git a/src/server/server.cpp b/src/server/server.cpp index 6e16f139d..19ccf0ed5 100644 --- a/src/server/server.cpp +++ b/src/server/server.cpp @@ -108,7 +108,7 @@ void ServicePort::onAccept(Connection_ptr connection, const std::error_code &err if (!pendingStart) { close(); pendingStart = true; - g_scheduler().addEvent(15000, std::bind_front(&ServicePort::openAcceptor, std::weak_ptr(shared_from_this()), serverPort)); + g_scheduler().addEvent(15000, std::bind_front(&ServicePort::openAcceptor, std::weak_ptr(shared_from_this()), serverPort), "ServicePort::openAcceptor"); } } } @@ -157,7 +157,7 @@ void ServicePort::open(uint16_t port) { g_logger().warn("[ServicePort::open] - Error code: {}", e.what()); pendingStart = true; - g_scheduler().addEvent(15000, std::bind_front(&ServicePort::openAcceptor, std::weak_ptr(shared_from_this()), port)); + g_scheduler().addEvent(15000, std::bind_front(&ServicePort::openAcceptor, std::weak_ptr(shared_from_this()), port), "ServicePort::openAcceptor"); } } diff --git a/src/server/signals.cpp b/src/server/signals.cpp index 8cd5310f9..8fb718386 100644 --- a/src/server/signals.cpp +++ b/src/server/signals.cpp @@ -52,21 +52,21 @@ void Signals::asyncWait() { void Signals::dispatchSignalHandler(int signal) { switch (signal) { case SIGINT: // Shuts the server down - g_dispatcher().addTask(sigintHandler); + g_dispatcher().addTask(sigintHandler, "sigintHandler"); break; case SIGTERM: // Shuts the server down - g_dispatcher().addTask(sigtermHandler); + g_dispatcher().addTask(sigtermHandler, "sigtermHandler"); break; #ifndef _WIN32 case SIGHUP: // Reload config/data - g_dispatcher().addTask(sighupHandler); + g_dispatcher().addTask(sighupHandler, "sighupHandler"); break; case SIGUSR1: // Saves game state - g_dispatcher().addTask(sigusr1Handler); + g_dispatcher().addTask(sigusr1Handler, "sigusr1Handler"); break; #else case SIGBREAK: // Shuts the server down - g_dispatcher().addTask(sigbreakHandler); + g_dispatcher().addTask(sigbreakHandler, "sigbreakHandler"); // hold the thread until other threads end inject().shutdown(); break; diff --git a/src/utils/tools.cpp b/src/utils/tools.cpp index e990e8ba8..f7f0a7251 100644 --- a/src/utils/tools.cpp +++ b/src/utils/tools.cpp @@ -303,7 +303,7 @@ std::string toPascalCase(const std::string &str) { result += std::toupper(ch); capitalizeNext = false; } else { - result += std::tolower(ch); + result += ch; // Keep the character as is. } } } @@ -343,6 +343,22 @@ std::string toKebabCase(const std::string &str) { return result; } +std::string toStartCaseWithSpace(const std::string &str) { + std::string result; + for (size_t i = 0; i < str.length(); ++i) { + char ch = str[i]; + if (i == 0 || std::isupper(ch)) { + if (i > 0) { + result += ' '; + } + result += std::toupper(ch); + } else { + result += std::tolower(ch); + } + } + return result; +} + StringVector explodeString(const std::string &inString, const std::string &separator, int32_t limit /* = -1*/) { StringVector returnVector; std::string::size_type start = 0, end = 0; @@ -1258,6 +1274,9 @@ const char* getReturnMessage(ReturnValue value) { case RETURNVALUE_DEPOTISFULL: return "You cannot put more items in this depot."; + case RETURNVALUE_CONTAINERISFULL: + return "You cannot put more items in this container."; + case RETURNVALUE_CANNOTUSETHISOBJECT: return "You cannot use this object."; @@ -1641,6 +1660,81 @@ std::string formatPrice(std::string price, bool space /* = false*/) { return price; } +std::string getPlayerSubjectPronoun(PlayerPronoun_t pronoun, PlayerSex_t sex, const std::string &name) { + switch (pronoun) { + case PLAYERPRONOUN_THEY: + return "they"; + case PLAYERPRONOUN_SHE: + return "she"; + case PLAYERPRONOUN_HE: + return "he"; + case PLAYERPRONOUN_ZE: + return "ze"; + case PLAYERPRONOUN_NAME: + return name; + default: + return sex == PLAYERSEX_FEMALE ? "she" : "he"; + } +} + +std::string getPlayerObjectPronoun(PlayerPronoun_t pronoun, PlayerSex_t sex, const std::string &name) { + switch (pronoun) { + case PLAYERPRONOUN_THEY: + return "them"; + case PLAYERPRONOUN_SHE: + return "her"; + case PLAYERPRONOUN_HE: + return "him"; + case PLAYERPRONOUN_ZE: + return "zir"; + case PLAYERPRONOUN_NAME: + return name; + default: + return sex == PLAYERSEX_FEMALE ? "her" : "him"; + } +} + +std::string getPlayerPossessivePronoun(PlayerPronoun_t pronoun, PlayerSex_t sex, const std::string &name) { + switch (pronoun) { + case PLAYERPRONOUN_THEY: + return "their"; + case PLAYERPRONOUN_SHE: + return "her"; + case PLAYERPRONOUN_HE: + return "his"; + case PLAYERPRONOUN_ZE: + return "zir"; + case PLAYERPRONOUN_NAME: + return name + "'s"; + default: + return sex == PLAYERSEX_FEMALE ? "her" : "his"; + } +} + +std::string getPlayerReflexivePronoun(PlayerPronoun_t pronoun, PlayerSex_t sex, const std::string &name) { + switch (pronoun) { + case PLAYERPRONOUN_THEY: + return "themself"; + case PLAYERPRONOUN_SHE: + return "herself"; + case PLAYERPRONOUN_HE: + return "himself"; + case PLAYERPRONOUN_ZE: + return "zirself"; + case PLAYERPRONOUN_NAME: + return name; + default: + return sex == PLAYERSEX_FEMALE ? "herself" : "himself"; + } +} + +std::string getVerbForPronoun(PlayerPronoun_t pronoun, bool pastTense) { + if (pronoun == PLAYERPRONOUN_THEY) { + return pastTense ? "were" : "are"; + } + return pastTense ? "was" : "is"; +} + std::vector split(const std::string &str) { std::vector tokens; std::string token; diff --git a/src/utils/tools.hpp b/src/utils/tools.hpp index 74bad70b8..e6f709733 100644 --- a/src/utils/tools.hpp +++ b/src/utils/tools.hpp @@ -33,6 +33,7 @@ std::string toCamelCase(const std::string &str); std::string toPascalCase(const std::string &str); std::string toSnakeCase(const std::string &str); std::string toKebabCase(const std::string &str); +std::string toStartCaseWithSpace(const std::string &str); using StringVector = std::vector; using IntegerVector = std::vector; @@ -178,3 +179,9 @@ static inline Cipbia_Elementals_t getCipbiaElement(CombatType_t combatType) { } std::string formatNumber(uint64_t number); + +std::string getPlayerSubjectPronoun(PlayerPronoun_t pronoun, PlayerSex_t sex, const std::string &name); +std::string getPlayerObjectPronoun(PlayerPronoun_t pronoun, PlayerSex_t sex, const std::string &name); +std::string getPlayerPossessivePronoun(PlayerPronoun_t pronoun, PlayerSex_t sex, const std::string &name); +std::string getPlayerReflexivePronoun(PlayerPronoun_t pronoun, PlayerSex_t sex, const std::string &name); +std::string getVerbForPronoun(PlayerPronoun_t pronoun, bool pastTense = false); diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt new file mode 100644 index 000000000..5cf5c5d80 --- /dev/null +++ b/tests/CMakeLists.txt @@ -0,0 +1,24 @@ +find_package(ut CONFIG REQUIRED) + +enable_testing() + +function(setup_test TARGET_NAME DIR) + add_executable(${TARGET_NAME} main.cpp) + + target_compile_definitions(${TARGET_NAME} PUBLIC -DDEBUG_LOG) + target_link_libraries(${TARGET_NAME} PRIVATE Boost::ut ${PROJECT_NAME}_lib) + target_include_directories(${TARGET_NAME} PRIVATE ${CMAKE_SOURCE_DIR}/tests/fixture PRIVATE ${CMAKE_SOURCE_DIR}/tests/${DIR}) + + add_test(NAME ${DIR} COMMAND ${TARGET_NAME}) + if(RUN_TESTS_AFTER_BUILD) + add_custom_command( + TARGET ${TARGET_NAME} POST_BUILD + COMMAND ${CMAKE_CTEST_COMMAND} --verbose + COMMENT "Running ctest ${DIR} after building ${TARGET_NAME}" + WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/tests/${DIR} + ) + endif (RUN_TESTS_AFTER_BUILD) +endfunction() + +add_subdirectory(unit) +add_subdirectory(integration) \ No newline at end of file diff --git a/tests/Dockerfile.database b/tests/Dockerfile.database new file mode 100644 index 000000000..ffd586aa4 --- /dev/null +++ b/tests/Dockerfile.database @@ -0,0 +1,4 @@ +FROM mariadb:10 + +WORKDIR /docker-entrypoint-initdb.d +COPY schema.sql ./ diff --git a/tests/README.md b/tests/README.md new file mode 100644 index 000000000..405d30d72 --- /dev/null +++ b/tests/README.md @@ -0,0 +1,125 @@ +## Testing + +### Running tests + +To run the tests, you need to compile with the flag `BUILD_TESTS` enabled (`-DBUILD_TESTS:BOOL=ON`). +This will build all tests within the `tests` directory and generate a `tests` folder in the build directory, which contains the test executable. + +Once the executable is generated, you can run the tests with the following command: +```bash +cd build/{build_type}/tests/unit +./canary_ut + +cd build/{build_type}/tests/integration +./canary_it +``` + +#### Running tests with CTest + +You can also run the tests using CTest: +```bash +-- from the build/{build_type} directory +-- to run all tests +ctest --verbose + +-- to run only unit tests +ctest --verbose -R unit + +-- to run only integration tests +ctest --verbose -R integration +``` + +### Adding tests + +Tests are added in the `tests` folder, in the root of the repository. +As much as possible, tests should be added in the same folder as the code they are testing: + +``` +- src + - foo + - foo.cpp + - bar + - bar.cpp +- tests + - foo + - foo_test.cpp + - bar + - bar_test.cpp +``` + +### Boost::ut + +Tests are written using the Boost::ut framework. We've chosen this framework because it is simple, macro-free, intuitive, and easy to use. +In this section, we will go over the basics of the framework, but you can find more information in the [Boost::ut documentation](https://boost-ext.github.io/ut/). +There are many ways to write tests, and we encourage you to read the documentation to find the way that works best for you. + +#### Suites + +Tests needs to be encapsulated by suites, which are defined using `suite<>` structure. +```cpp +suite<"foo"> test_foo = [] { + // Tests go here +}; +``` + +This puts all tests within test_foo under the suite "foo". +You can use declare multiple suites with the same name, and they will be merged together. +This allows you to declare suites in different files, and they will be merged together, keeping test files clean. + +Avoid creating tests directly in the main function, as this will put them in the `global` suite, which is not recommended. + +#### Tests + +Tests can be defined using the `test()` lambda or the `_test` operator: +```cpp +suite<"foo"> test_foo = [] { + "test 1"_test = [] { + // Test 1 + }; + + test("test 2") = [] { + // Test 2 + }; +}; +``` + +#### Assertions + +Both are equivalent, the received argument is the description of the test. +The description is used to identify the test in the output, and should be unique within a suite. + +Assertions are done using the `expect()` function: +```cpp +suite<"foo"> test_foo = [] { + "test 1"_test = [] { + expect(eq(1_i, 1_i)); + }; +}; +``` + +It's always preferable to use comparison operators (eq, neq, etc.), as they provide better error messages. + +#### Testing against injected dependencies + +Testing against injected dependencies is done using the `di::extension::injector<>` class. +This class is used to create the dependency injection container, and can be used to set up the container for testing. +For example, to test the `RSA` class, we need to inject a `Logger` class, otherwise it will use the default SpdLog implementation. + +```cpp +suite<"security"> rsaTest = [] { + test("RSA::start logs error for missing .pem file") = [] { + di::extension::injector<> injector{}; + DI::setTestContainer(&InMemoryLogger::install(injector)); + + DI::create().start(); + + auto &logger = dynamic_cast(injector.create()); + + expect(eq(1, logger.logs.size()) >> fatal); + expect( + eq(std::string{"error"}, logger.logs[0].level) and + eq(std::string{"File key.pem not found or have problem on loading... Setting standard rsa key\n"}, logger.logs[0].message) + ); + }; +}; +``` diff --git a/tests/build_and_run.sh b/tests/build_and_run.sh new file mode 100644 index 000000000..3d5531ebf --- /dev/null +++ b/tests/build_and_run.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash + +docker-compose down --rmi all -v --remove-orphans +docker-compose up --build -d +cd .. +mkdir build +cd build +cmake -DPACKAGE_TESTS=On .. ; make -j`nproc` +./tests/canary_unittest --reporter compact --success -d yes +cd .. +cd tests +docker-compose down --rmi all -v --remove-orphans diff --git a/tests/docker-compose.yaml b/tests/docker-compose.yaml new file mode 100644 index 000000000..1066170f8 --- /dev/null +++ b/tests/docker-compose.yaml @@ -0,0 +1,16 @@ +version: "3.3" + +services: + otdb-test: + container_name: otdb-test + build: + context: ../ + dockerfile: ./tests/Dockerfile.database + restart: unless-stopped + environment: + - MYSQL_DATABASE=otserver + - MYSQL_USER=otserver + - MYSQL_PASSWORD=otserver + - MYSQL_RANDOM_ROOT_PASSWORD=yes + ports: + - "3306:3306" diff --git a/tests/fixture/account/in_memory_account_repository.hpp b/tests/fixture/account/in_memory_account_repository.hpp new file mode 100644 index 000000000..dd4e77881 --- /dev/null +++ b/tests/fixture/account/in_memory_account_repository.hpp @@ -0,0 +1,147 @@ +/** + * Canary - A free and open-source MMORPG server emulator + * Copyright (©) 2019-2022 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 +#include +#include + +#include "account/account_definitions.hpp" +#include "test_injection.hpp" +#include "lib/di/container.hpp" + +namespace di = boost::di; + +namespace account::tests { + class InMemoryAccountRepository : public AccountRepository { + public: + static di::extension::injector<> &install(di::extension::injector<> &injector) { + injector.install(di::bind.to().in(di::singleton)); + return injector; + } + + void addAccount(const std::string &descriptor, const AccountInfo &acc) { + accounts[descriptor] = acc; + } + + bool loadByID(const uint32_t &id, AccountInfo &acc) final { + for (const auto &account : accounts) { + if (account.second.id == id) { + acc = account.second; + return true; + } + } + + return false; + } + + bool loadByEmail(const std::string &email, AccountInfo &acc) final { + auto account = accounts.find(email); + + if (account == accounts.end()) { + return false; + } + + acc = account->second; + return true; + } + + bool loadBySession(const std::string &sessionKey, AccountInfo &acc) final { + auto account = accounts.find(sessionKey); + + if (account == accounts.end()) { + return false; + } + + acc = account->second; + return true; + } + + bool save(const AccountInfo &accInfo) final { + return !failSave; + } + + bool getPassword(const uint32_t &id, std::string &password) final { + password = password_; + return !failGetPassword; + } + + bool getCoins(const uint32_t &id, const CoinType &type, uint32_t &coins) final { + auto accountCoins = coins_.find(id); + + if (accountCoins == coins_.end()) { + return false; + } + + auto coinsOfType = accountCoins->second.find(type); + + if (coinsOfType == accountCoins->second.end()) { + return false; + } + + coins = coinsOfType->second; + return true; + } + + bool setCoins(const uint32_t &id, const CoinType &type, const uint32_t &amount) final { + auto accountCoins = coins_.find(id); + + if (accountCoins == coins_.end()) { + coins_[id] = phmap::flat_hash_map(); + } + + coins_[id][type] = amount; + return !failAddCoins; + } + + bool registerCoinsTransaction( + const uint32_t &id, + CoinTransactionType type, + uint32_t coins, + const CoinType &coinType, + const std::string &description + ) final { + auto accountCoins = coinsTransactions_.find(id); + + if (accountCoins == coinsTransactions_.end()) { + coinsTransactions_[id] = std::vector>(); + } + + coinsTransactions_[id].emplace_back(type, coins, coinType, description); + return true; + } + + InMemoryAccountRepository &reset() { + accounts.clear(); + coins_.clear(); + coinsTransactions_.clear(); + failSave = false; + failAddCoins = false; + failGetPassword = false; + failAuthenticateFromSession = false; + password_ = "123456"; + + return *this; + } + + bool failSave = false; + bool failAddCoins = false; + bool failGetPassword = false; + bool failAuthenticateFromSession = false; + std::string password_ = "123456"; + phmap::flat_hash_map accounts; + phmap::flat_hash_map> coins_; + phmap::flat_hash_map>> coinsTransactions_; + }; +} + +template <> +struct TestInjection { + using type = account::tests::InMemoryAccountRepository; +}; diff --git a/tests/fixture/injection_fixture.hpp b/tests/fixture/injection_fixture.hpp new file mode 100644 index 000000000..370412c71 --- /dev/null +++ b/tests/fixture/injection_fixture.hpp @@ -0,0 +1,74 @@ +// +// Created by lgrossi on 27-8-23. +// + +#pragma once + +#include + +#include "account/in_memory_account_repository.hpp" +#include "kv/in_memory_kv.hpp" +#include "test_injection.hpp" +#include "lib/logging/in_memory_logger.hpp" + +using namespace account; +using namespace boost::ut; + +struct InjectionFixture { + di::extension::injector<> injector {}; + + InjectionFixture() { + setup(); + } + + InjectionFixture(const InjectionFixture &) { + setup(); + } + + InjectionFixture(InjectionFixture &&other) noexcept + : + injector(std::move(other.injector)) { + setup(); + } + + template + auto get() const { + return std::tuple::type &...>(getImpl()...); + } + + InMemoryLogger &logger() const { + return getImpl(); + } + + tests::InMemoryAccountRepository &accountRepository() const { + return getImpl(); + } + + KVMemory &kv() const { + return getImpl(); + } + +private: + template + typename TestInjection::type &getImpl() const { + return dynamic_cast::type &>(injector.create()).reset(); + } + + void setup() { + InMemoryLogger::install(injector); + tests::InMemoryAccountRepository::install(injector); + KVMemory::install(injector); + + DI::setTestContainer(&injector); + } +}; + +namespace std { + template <> + struct tuple_size : std::integral_constant { }; + + template + struct tuple_element { + using type = decltype(std::declval().get()); + }; +} diff --git a/tests/fixture/kv/in_memory_kv.hpp b/tests/fixture/kv/in_memory_kv.hpp new file mode 100644 index 000000000..b738a9847 --- /dev/null +++ b/tests/fixture/kv/in_memory_kv.hpp @@ -0,0 +1,49 @@ +/** + * Canary - A free and open-source MMORPG server emulator + * Copyright (©) 2019-2022 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 +#include +#include + +#include "kv/kv.hpp" + +#include "test_injection.hpp" +#include "lib/di/container.hpp" + +namespace di = boost::di; + +class KVMemory final : public KVStore { +public: + static di::extension::injector<> &install(di::extension::injector<> &injector) { + injector.install(di::bind.to().in(di::singleton)); + return injector; + } + + explicit KVMemory(Logger &logger) : + KVStore(logger) { } + + KVMemory &reset() { + flush(); + return *this; + } + +protected: + std::optional load(const std::string &key) override { + return std::nullopt; + } + bool save(const std::string &key, const ValueWrapper &value) override { + return false; + } +}; + +template <> +struct TestInjection { + using type = KVMemory; +}; diff --git a/tests/fixture/lib/logging/in_memory_logger.hpp b/tests/fixture/lib/logging/in_memory_logger.hpp new file mode 100644 index 000000000..581a453ee --- /dev/null +++ b/tests/fixture/lib/logging/in_memory_logger.hpp @@ -0,0 +1,84 @@ +/** + * Canary - A free and open-source MMORPG server emulator + * Copyright (©) 2019-2022 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 +#include +#include + +#include "test_injection.hpp" +#include "lib/di/container.hpp" + +namespace di = boost::di; + +class InMemoryLogger : public Logger { + private: + struct LogEntry { + std::string level; + std::string message; + }; + + public: + mutable std::vector logs; + + InMemoryLogger() = default; + InMemoryLogger(const InMemoryLogger &) {} + InMemoryLogger(const InMemoryLogger &&) {} + + static di::extension::injector<> & install(di::extension::injector<> &injector) { + injector.install(di::bind.to().in(di::singleton)); + return injector; + } + + InMemoryLogger &reset() { + logs.clear(); + return *this; + } + + bool hasLogEntry(const std::string& lvl, const std::string& expectedMsg) const { + for (const auto& entry : logs) { + if (entry.level == lvl && entry.message == expectedMsg) { + return true; + } + } + + return false; + } + + void setLevel(const std::string &name) override { + // For the stub, setting a level might not have any behavior. + // But you can implement level filtering if you like. + } + + [[nodiscard]] std::string getLevel() const override { + // For simplicity, let's just return a default level. You can adjust as needed. + return "DEBUG"; + } + + virtual void log(std::string lvl, fmt::basic_string_view msg) const override { + logs.push_back({lvl, {msg.data(), msg.size()}}); + } + + // Helper methods for testing + size_t logCount() const { + return logs.size(); + } + + std::pair getLogEntry(size_t index) const { + if (index < logs.size()) { + return {logs[index].level, logs[index].message}; + } + return {"", ""}; // Return empty pair for out-of-bounds. Alternatively, you could throw an exception. + } +}; + +template <> +struct TestInjection { + using type = InMemoryLogger; +}; \ No newline at end of file diff --git a/tests/fixture/test_injection.hpp b/tests/fixture/test_injection.hpp new file mode 100644 index 000000000..31a64acf7 --- /dev/null +++ b/tests/fixture/test_injection.hpp @@ -0,0 +1,12 @@ +/** +* Canary - A free and open-source MMORPG server emulator +* Copyright (©) 2019-2023 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 + +template +struct TestInjection {}; \ No newline at end of file diff --git a/tests/integration/CMakeLists.txt b/tests/integration/CMakeLists.txt new file mode 100644 index 000000000..2d90d6af6 --- /dev/null +++ b/tests/integration/CMakeLists.txt @@ -0,0 +1 @@ +setup_test(canary_it integration) \ No newline at end of file diff --git a/tests/integration/main.cpp b/tests/integration/main.cpp new file mode 100644 index 000000000..91fd28a30 --- /dev/null +++ b/tests/integration/main.cpp @@ -0,0 +1,161 @@ +#include + +#include "account/account_repository_db.hpp" +#include "lib/logging/in_memory_logger.hpp" +#include "utils/tools.hpp" + +using namespace account; +using namespace boost::ut; + +auto databaseTest(Database &db, const std::function &load) { + return [&db, load] { + db.executeQuery("BEGIN"); + + try { + load(); + } catch (...) { + } + + db.executeQuery("ROLLBACK"); + }; +} + +void createAccount(Database &db) { + db.executeQuery( + "INSERT INTO `accounts` " + "(`id`, `name`, `email`, `password`, `type`, `premdays`, `lastday`, `premdays_purchased`, `creation`) " + "VALUES(111, 'test', '@test', '', 3, 11, 1293912, 11, 42183281)" + ); + + db.executeQuery(fmt::format( + "INSERT INTO `account_sessions` (`id`, `account_id`, `expires`) " + "VALUES ('{}', 111, 1337)", + transformToSHA1("test") + )); +} + +void assertAccountLoad(account::AccountInfo acc) { + expect(eq(acc.id, 111)); + expect(eq(acc.accountType, AccountType::ACCOUNT_TYPE_SENIORTUTOR)); + expect(eq(acc.premiumRemainingDays, 11)); + expect(eq(acc.premiumLastDay, 1293912)); + expect(eq(acc.players.size(), 0)); + expect(eq(acc.oldProtocol, false)); + expect(eq(acc.premiumDaysPurchased, 11)); + expect(approx(acc.creationTime, 42183281, 60 * 60 * 1000)); +} + +int main() { + struct DbConfig { + public: + std::string host = "127.0.0.1"; + std::string user = "root"; + std::string password = "root"; + std::string database = "otservbr-global"; + uint32_t port = 3306; + std::string sock; + }; + Database db{}; + DbConfig dbConfig{}; + + db.connect( + &dbConfig.host, + &dbConfig.user, + &dbConfig.password, + &dbConfig.database, + dbConfig.port, + &dbConfig.sock + ); + + test("AccountRepositoryDB::loadByID") = databaseTest(db, [&db] { + InMemoryLogger logger{}; + AccountRepositoryDB accRepo{db, logger}; + createAccount(db); + + AccountInfo acc{}; + accRepo.loadByID(111, acc); + assertAccountLoad(acc); + expect(eq(acc.sessionExpires, 0)); + }); + + test("AccountRepositoryDB::loadByEmail") = databaseTest(db, [&db] { + InMemoryLogger logger {}; + AccountRepositoryDB accRepo { db, logger }; + createAccount(db); + + AccountInfo acc {}; + accRepo.loadByEmail("@test", acc); + assertAccountLoad(acc); + expect(eq(acc.sessionExpires, 0)); + }); + + test("AccountRepositoryDB::loadBySession") = databaseTest(db, [&db] { + InMemoryLogger logger {}; + AccountRepositoryDB accRepo { db, logger }; + createAccount(db); + + AccountInfo acc {}; + accRepo.loadBySession("test", acc); + + assertAccountLoad(acc); + expect(eq(acc.sessionExpires, 1337)); + }); + + test("AccountRepositoryDB load sets premium day purchased = remaining days, if needed") = databaseTest(db, [&db] { + InMemoryLogger logger{}; + AccountRepositoryDB accRepo{db, logger}; + + AccountInfo acc{}; + accRepo.loadByID(1, acc); + acc.premiumRemainingDays = 10; + accRepo.save(acc); + + accRepo.loadByID(1, acc); + + expect(eq(acc.premiumDaysPurchased, 10)); + }); + + test("AccountRepositoryDB::getPassword") = databaseTest(db, [&db] { + InMemoryLogger logger {}; + AccountRepositoryDB accRepo { db, logger }; + + std::string password; + + expect(accRepo.getPassword(1, password)); + expect(eq(password, std::string { "21298df8a3277357ee55b01df9530b535cf08ec1" })); + }); + + test("AccountRepositoryDB::getPassword logs on failure") = databaseTest(db, [&db] { + InMemoryLogger logger {}; + AccountRepositoryDB accRepo { db, logger }; + + std::string password; + + expect(!accRepo.getPassword(891237, password)); + expect(eq(logger.logs.size(), 1) >> fatal); + expect(eq(logger.logs[0].level, std::string { "error" })); + expect(eq(logger.logs[0].message, std::string { "Failed to get account:[891237] password!" })); + }); + + test("AccountRepositoryDB::save") = databaseTest(db, [&db] { + InMemoryLogger logger {}; + AccountRepositoryDB accRepo { db, logger }; + + AccountInfo acc {}; + acc.id = 1; + acc.accountType = AccountType::ACCOUNT_TYPE_SENIORTUTOR; + acc.premiumRemainingDays = 10; + acc.premiumLastDay = 10; + acc.sessionExpires = 99999999; + expect(accRepo.save(acc)); + + AccountInfo acc2 {}; + accRepo.loadByID(1, acc2); + expect(eq(acc2.id, 1)); + expect(eq(acc2.accountType, AccountType::ACCOUNT_TYPE_SENIORTUTOR)); + expect(eq(acc2.premiumRemainingDays, 10)); + expect(eq(acc2.premiumLastDay, 10)); + // sessionExpires is not saved + expect(eq(acc2.sessionExpires, 0)); + }); +} diff --git a/tests/unit/CMakeLists.txt b/tests/unit/CMakeLists.txt new file mode 100644 index 000000000..8d234a676 --- /dev/null +++ b/tests/unit/CMakeLists.txt @@ -0,0 +1,7 @@ +setup_test(canary_ut unit) + +add_subdirectory(account) +add_subdirectory(kv) +add_subdirectory(lib) +add_subdirectory(security) +add_subdirectory(utils) diff --git a/tests/unit/account/CMakeLists.txt b/tests/unit/account/CMakeLists.txt new file mode 100644 index 000000000..27b5fd233 --- /dev/null +++ b/tests/unit/account/CMakeLists.txt @@ -0,0 +1,3 @@ +target_sources(canary_ut PRIVATE + account_test.cpp +) diff --git a/tests/unit/account/account_test.cpp b/tests/unit/account/account_test.cpp new file mode 100644 index 000000000..e8e428a1e --- /dev/null +++ b/tests/unit/account/account_test.cpp @@ -0,0 +1,590 @@ +/** + * Canary - A free and open-source MMORPG server emulator + * Copyright (©) 2019-2023 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 + +#include "account/account.hpp" +#include "utils/tools.hpp" +#include "injection_fixture.hpp" + +suite<"account"> accountTest = [] { + InjectionFixture injectionFixture {}; + test("Account::Account default constructors") = [] { + Account byId { 1 }, byDescriptor { "canary@test.com" }; + + expect(eq(byId.getID(), 1)); + expect(eq(byDescriptor.getID(), 0)); + + expect(byId.getDescriptor().empty()); + expect(eq(byDescriptor.getDescriptor(), std::string { "canary@test.com" })); + + for (auto &account : { byId, byDescriptor }) { + expect( + eq(account.getPremiumRemainingDays(), 0) and + eq(account.getPremiumLastDay(), 0) and + eq(account.getAccountType(), AccountType::ACCOUNT_TYPE_NORMAL) + ); + } + }; + + struct AccountLoadTestCase { + std::string description; + Account account; + Errors expectedError; + }; + + std::vector accountLoadTestCases { + { "returns by id if exists", Account { 1 }, Errors::ERROR_NO }, + { "returns by descriptor if exists", Account { "canary@test.com" }, Errors::ERROR_NO }, + { "returns error if id is not valid", Account { 2 }, Errors::ERROR_LOADING_ACCOUNT }, + { "returns error if descriptor is not valid", Account { "not@valid.com" }, Errors::ERROR_LOADING_ACCOUNT } + }; + + for (auto accountLoadTestCase : accountLoadTestCases) { + test(accountLoadTestCase.description) = [&injectionFixture, &accountLoadTestCase] { + auto [accountRepository] = injectionFixture.get(); + accountRepository.addAccount("canary@test.com", AccountInfo { 1, 1, 1, AccountType::ACCOUNT_TYPE_GOD }); + expect(eq(accountLoadTestCase.account.load(), accountLoadTestCase.expectedError)) << accountLoadTestCase.description; + }; + } + + test("Account::reload returns error if not yet loaded") = [] { + expect(eq(Account { 1 }.reload(), Errors::ERROR_NOT_INITIALIZED)); + }; + + test("Account::reload reloads account info") = [&injectionFixture] { + auto [accountRepository] = injectionFixture.get(); + + Account acc { 1 }; + accountRepository.addAccount("canary@test.com", AccountInfo { 1, 1, 1, AccountType::ACCOUNT_TYPE_GOD }); + + expect( + eq(acc.load(), Errors::ERROR_NO) and + eq(acc.getAccountType(), AccountType::ACCOUNT_TYPE_GOD) + ); + + accountRepository.addAccount("canary2@test.com", AccountInfo { 1, 1, 1, AccountType::ACCOUNT_TYPE_GAMEMASTER }); + + expect( + eq(acc.reload(), Errors::ERROR_NO) and + eq(acc.getAccountType(), AccountType::ACCOUNT_TYPE_GAMEMASTER) + ); + }; + + test("Account::save returns error if not yet loaded") = [] { + expect(eq(Account { 1 }.save(), Errors::ERROR_NOT_INITIALIZED)); + }; + + test("Account::save returns error if it fails") = [&injectionFixture] { + auto [accountRepository] = injectionFixture.get(); + + Account acc { 1 }; + accountRepository.failSave = true; + accountRepository.addAccount("canary@test.com", AccountInfo { 1, 1, 1, AccountType::ACCOUNT_TYPE_GOD }); + + expect(eq(acc.load(), Errors::ERROR_NO and eq(acc.save(), Errors::ERROR_STORAGE))); + }; + + test("Account::save saves account info") = [&injectionFixture] { + auto [accountRepository] = injectionFixture.get(); + + Account acc { 1 }; + accountRepository.failSave = false; + accountRepository.addAccount("canary@test.com", AccountInfo { 1, 1, 1, AccountType::ACCOUNT_TYPE_GOD }); + + expect(eq(acc.load(), Errors::ERROR_NO and eq(acc.save(), Errors::ERROR_NO))); + }; + + test("Account::getCoins returns error if not yet loaded") = [&injectionFixture] { + expect(eq(std::get<1>(Account { 1 }.getCoins(CoinType::COIN)), Errors::ERROR_NOT_INITIALIZED)); + }; + + test("Account::getCoins returns error if it fails") = [&injectionFixture] { + auto [accountRepository] = injectionFixture.get(); + + Account acc { 1 }; + accountRepository.addAccount("canary@test.com", AccountInfo { 1, 1, 1, AccountType::ACCOUNT_TYPE_GOD }); + + expect( + eq(acc.load(), Errors::ERROR_NO) and + eq(std::get<1>(acc.getCoins(CoinType::COIN)), Errors::ERROR_STORAGE) + ); + }; + + test("Account::getCoins returns coins") = [&injectionFixture] { + auto [accountRepository] = injectionFixture.get(); + + Account acc { 1 }; + accountRepository.addAccount("canary@test.com", AccountInfo { 1, 1, 1, AccountType::ACCOUNT_TYPE_GOD }); + accountRepository.setCoins(1, CoinType::COIN, 100); + + expect( + eq(acc.load(), Errors::ERROR_NO) and + eq(std::get<0>(acc.getCoins(CoinType::COIN)), 100) and + eq(std::get<1>(acc.getCoins(CoinType::COIN)), Errors::ERROR_NO) + ); + }; + + test("Account::getCoins returns coins for specified account only") = [&injectionFixture] { + auto [accountRepository] = injectionFixture.get(); + + Account acc { 2 }; + accountRepository.addAccount("canary@test.com", AccountInfo { 1, 1, 1, AccountType::ACCOUNT_TYPE_GOD }); + accountRepository.setCoins(1, CoinType::COIN, 100); + + accountRepository.addAccount("canary2@test.com", AccountInfo { 2, 1, 1, AccountType::ACCOUNT_TYPE_GOD }); + accountRepository.setCoins(2, CoinType::COIN, 33); + + expect( + eq(acc.load(), Errors::ERROR_NO) and + eq(std::get<0>(acc.getCoins(CoinType::COIN)), 33) and + eq(std::get<1>(acc.getCoins(CoinType::COIN)), Errors::ERROR_NO) + ); + }; + + test("Account::getCoins returns coins for specified coin type only") = [&injectionFixture] { + auto [accountRepository] = injectionFixture.get(); + + Account acc { 1 }; + accountRepository.addAccount("canary@test.com", AccountInfo { 1, 1, 1, AccountType::ACCOUNT_TYPE_GOD }); + accountRepository.setCoins(1, CoinType::COIN, 100); + accountRepository.setCoins(1, CoinType::TOURNAMENT, 100); + + expect( + eq(acc.load(), Errors::ERROR_NO) and + eq(std::get<0>(acc.getCoins(CoinType::COIN)), 100) and + eq(std::get<1>(acc.getCoins(CoinType::COIN)), Errors::ERROR_NO) and + eq(std::get<0>(acc.getCoins(CoinType::TOURNAMENT)), 100) and + eq(std::get<1>(acc.getCoins(CoinType::TOURNAMENT)), Errors::ERROR_NO) + ); + }; + + test("Account::addCoins returns error if not yet loaded") = [] { + expect(eq(Account { 1 }.addCoins(CoinType::COIN, 100), Errors::ERROR_NOT_INITIALIZED)); + }; + + test("Account::addCoins returns error if it fails") = [&injectionFixture] { + auto [accountRepository] = injectionFixture.get(); + + Account acc { 1 }; + accountRepository.failAddCoins = true; + accountRepository.addAccount("canary@test.com", AccountInfo { 1, 1, 1, AccountType::ACCOUNT_TYPE_GOD }); + accountRepository.setCoins(1, CoinType::COIN, 100); + + expect( + eq(acc.load(), Errors::ERROR_NO) and + eq(acc.addCoins(CoinType::COIN, 100), Errors::ERROR_STORAGE) + ); + }; + + test("Account::addCoins returns error if get coins fail") = [&injectionFixture] { + auto [accountRepository] = injectionFixture.get(); + + Account acc { 1 }; + accountRepository.addAccount("canary@test.com", AccountInfo { 1, 1, 1, AccountType::ACCOUNT_TYPE_GOD }); + accountRepository.setCoins(1, CoinType::COIN, 100); + + expect( + eq(acc.load(), Errors::ERROR_NO) and + eq(acc.addCoins(CoinType::TOURNAMENT, 100), Errors::ERROR_STORAGE) + ); + }; + + test("Account::addCoins adds coins") = [&injectionFixture] { + auto [accountRepository] = injectionFixture.get(); + + Account acc { 1 }; + accountRepository.failAddCoins = false; + accountRepository.addAccount("canary@test.com", AccountInfo { 1, 1, 1, AccountType::ACCOUNT_TYPE_GOD }); + accountRepository.setCoins(1, CoinType::COIN, 100); + + expect( + eq(acc.load(), Errors::ERROR_NO) and + eq(acc.addCoins(CoinType::COIN, 100), Errors::ERROR_NO) + and eq(std::get<0>(acc.getCoins(CoinType::COIN)), 200) and + eq(std::get<1>(acc.getCoins(CoinType::COIN)), Errors::ERROR_NO) + ); + }; + + test("Account::addCoins adds coins for specified account only") = [&injectionFixture] { + auto [accountRepository] = injectionFixture.get(); + + Account acc { 2 }; + accountRepository.failAddCoins = false; + accountRepository.addAccount("canary@test.com", AccountInfo { 1, 1, 1, AccountType::ACCOUNT_TYPE_GOD }); + accountRepository.setCoins(1, CoinType::COIN, 100); + + accountRepository.addAccount("canary2@test.com", AccountInfo { 2, 1, 1, AccountType::ACCOUNT_TYPE_GOD }); + accountRepository.setCoins(2, CoinType::COIN, 33); + + expect( + eq(acc.load(), Errors::ERROR_NO) and + eq(acc.addCoins(CoinType::COIN, 100), Errors::ERROR_NO) and + eq(std::get<0>(acc.getCoins(CoinType::COIN)), 133) and + eq(std::get<1>(acc.getCoins(CoinType::COIN)), Errors::ERROR_NO) + ); + }; + + test("Account::addCoins adds coins for specified coin type only") = [&injectionFixture] { + auto [accountRepository] = injectionFixture.get(); + + Account acc { 1 }; + accountRepository.failAddCoins = false; + accountRepository.setCoins(1, CoinType::COIN, 100); + accountRepository.setCoins(1, CoinType::TOURNAMENT, 57); + accountRepository.addAccount("canary@test.com", AccountInfo { 1, 1, 1, AccountType::ACCOUNT_TYPE_GOD }); + + expect( + eq(acc.load(), Errors::ERROR_NO) and + eq(acc.addCoins(CoinType::COIN, 100), Errors::ERROR_NO) and + eq(std::get<0>(acc.getCoins(CoinType::COIN)), 200) and + eq(std::get<1>(acc.getCoins(CoinType::COIN)), Errors::ERROR_NO) and + eq(std::get<0>(acc.getCoins(CoinType::TOURNAMENT)), 57) and + eq(std::get<1>(acc.getCoins(CoinType::TOURNAMENT)), Errors::ERROR_NO) + ); + + expect(eq(accountRepository.coinsTransactions_.size(), 1) >> fatal); + expect(eq(accountRepository.coinsTransactions_[1].size(), 1) >> fatal); + + auto [type, coins, coinType, description] = accountRepository.coinsTransactions_[1][0]; + expect( + eq(coins, 100) and + eq(static_cast(coinType), static_cast(CoinType::COIN)) and + eq(static_cast(type), static_cast(CoinTransactionType::ADD)) and + eq(description, std::string { "ADD Coins" }) + ); + }; + + test("Account::removeCoins returns error if not yet loaded") = [] { + expect(eq(Account { 1 }.removeCoins(CoinType::COIN, 100), Errors::ERROR_NOT_INITIALIZED)); + }; + + test("Account::removeCoins returns error if it fails") = [&injectionFixture] { + auto [accountRepository] = injectionFixture.get(); + + Account acc { 1 }; + accountRepository.failAddCoins = true; + accountRepository.addAccount("canary@test.com", AccountInfo { 1, 1, 1, AccountType::ACCOUNT_TYPE_GOD }); + accountRepository.setCoins(1, CoinType::COIN, 100); + + expect( + eq(acc.load(), Errors::ERROR_NO) and + eq(acc.removeCoins(CoinType::COIN, 100), Errors::ERROR_STORAGE) + ); + }; + + test("Account::removeCoins returns error if get coins fail") = [&injectionFixture] { + auto [accountRepository] = injectionFixture.get(); + + Account acc { 1 }; + accountRepository.addAccount("canary@test.com", AccountInfo { 1, 1, 1, AccountType::ACCOUNT_TYPE_GOD }); + accountRepository.setCoins(1, CoinType::COIN, 100); + + expect( + eq(acc.load(), Errors::ERROR_NO) and + eq(acc.removeCoins(CoinType::TOURNAMENT, 100), Errors::ERROR_STORAGE) + ); + }; + + test("Account::removeCoins removes coins") = [&injectionFixture] { + auto [accountRepository] = injectionFixture.get(); + + Account acc { 1 }; + accountRepository.failAddCoins = false; + accountRepository.addAccount("canary@test.com", AccountInfo { 1, 1, 1, AccountType::ACCOUNT_TYPE_GOD }); + accountRepository.setCoins(1, CoinType::COIN, 100); + + expect( + eq(acc.load(), Errors::ERROR_NO) and + eq(acc.removeCoins(CoinType::COIN, 100), Errors::ERROR_NO) and + eq(std::get<0>(acc.getCoins(CoinType::COIN)), 0) and + eq(std::get<1>(acc.getCoins(CoinType::COIN)), Errors::ERROR_NO) + ); + }; + + test("Account::removeCoins removes coins for specified account only") = [&injectionFixture] { + auto [accountRepository] = injectionFixture.get(); + + Account acc { 1 }; + accountRepository.failAddCoins = false; + accountRepository.addAccount("canary@test.com", AccountInfo { 1, 1, 1, AccountType::ACCOUNT_TYPE_GOD }); + accountRepository.setCoins(1, CoinType::COIN, 100); + + accountRepository.addAccount("canary2@test.com", AccountInfo { 2, 1, 1, AccountType::ACCOUNT_TYPE_GOD }); + accountRepository.setCoins(2, CoinType::COIN, 33); + + expect( + eq(acc.load(), Errors::ERROR_NO) and + eq(acc.removeCoins(CoinType::COIN, 100), Errors::ERROR_NO) and + eq(std::get<0>(acc.getCoins(CoinType::COIN)), 0) and + eq(std::get<1>(acc.getCoins(CoinType::COIN)), Errors::ERROR_NO) + ); + }; + + test("Account::removeCoins removes coins for specified coin type only") = [&injectionFixture] { + auto [accountRepository] = injectionFixture.get(); + + Account acc { 1 }; + accountRepository.failAddCoins = false; + accountRepository.addAccount("canary@test.com", AccountInfo { 1, 1, 1, AccountType::ACCOUNT_TYPE_GOD }); + accountRepository.setCoins(1, CoinType::COIN, 100); + accountRepository.setCoins(1, CoinType::TOURNAMENT, 57); + + expect( + eq(acc.load(), Errors::ERROR_NO) and + eq(acc.removeCoins(CoinType::COIN, 100), Errors::ERROR_NO) and + eq(std::get<0>(acc.getCoins(CoinType::COIN)), 0) and + eq(std::get<1>(acc.getCoins(CoinType::COIN)), Errors::ERROR_NO) and + eq(std::get<0>(acc.getCoins(CoinType::TOURNAMENT)), 57) and + eq(std::get<1>(acc.getCoins(CoinType::TOURNAMENT)), Errors::ERROR_NO) + ); + + expect(eq(accountRepository.coinsTransactions_.size(), 1) >> fatal); + expect(eq(accountRepository.coinsTransactions_[1].size(), 1) >> fatal); + + auto [type, coins, coinType, description] = accountRepository.coinsTransactions_[1][0]; + expect( + eq(coins, 100) and + eq(static_cast(coinType), static_cast(CoinType::COIN)) and + eq(static_cast(type), static_cast(CoinTransactionType::REMOVE)) and + eq(description, std::string { "REMOVE Coins" }) + ); + }; + + test("Account::removeCoins returns error if account doesn't have enough coins") = [&injectionFixture] { + auto [accountRepository] = injectionFixture.get(); + + Account acc { 1 }; + accountRepository.failAddCoins = false; + accountRepository.setCoins(1, CoinType::COIN, 1); + accountRepository.addAccount("canary@test.com", AccountInfo { 1, 1, 1, AccountType::ACCOUNT_TYPE_GOD }); + expect( + eq(acc.load(), Errors::ERROR_NO) and eq(acc.removeCoins(CoinType::COIN, 100), Errors::ERROR_REMOVE_COINS) + ); + + accountRepository.setCoins(1, CoinType::COIN, 50); + expect( + eq(acc.load(), Errors::ERROR_NO) and + eq(acc.removeCoins(CoinType::COIN, 100), Errors::ERROR_REMOVE_COINS) + ); + + accountRepository.setCoins(1, CoinType::COIN, 100); + expect( + eq(acc.load(), Errors::ERROR_NO) and + eq(acc.removeCoins(CoinType::COIN, 100), Errors::ERROR_NO) + ); + + expect(eq(accountRepository.coinsTransactions_.size(), 1) >> fatal); + expect(eq(accountRepository.coinsTransactions_[1].size(), 1) >> fatal); + + auto [type, coins, coinType, description] = accountRepository.coinsTransactions_[1][0]; + expect( + eq(coins, 100) and + eq(static_cast(coinType), static_cast(CoinType::COIN)) and + eq(static_cast(type), static_cast(CoinTransactionType::REMOVE)) and + eq(description, std::string { "REMOVE Coins" }) + ); + + expect( + eq(acc.load(), Errors::ERROR_NO) and eq(acc.removeCoins(CoinType::COIN, 100), Errors::ERROR_REMOVE_COINS) + ); + + expect(eq(accountRepository.coinsTransactions_.size(), 1) >> fatal); + expect(eq(accountRepository.coinsTransactions_[1].size(), 1) >> fatal); + }; + + test("Account::registerCoinTransaction does nothing if detail is empty") = [&injectionFixture] { + auto [accountRepository] = injectionFixture.get(); + + Account acc { 1 }; + accountRepository.addAccount("canary@test.com", AccountInfo { 1, 1, 1, AccountType::ACCOUNT_TYPE_GOD }); + expect(eq(acc.load(), Errors::ERROR_NO)); + accountRepository.setCoins(1, CoinType::COIN, 1); + + expect(eq(acc.addCoins(CoinType::COIN, 100, ""), Errors::ERROR_NO)); + expect(eq(acc.removeCoins(CoinType::COIN, 80, ""), Errors::ERROR_NO)); + + expect(eq(std::get<0>(acc.getCoins(CoinType::COIN)), 21)); + expect(eq(std::get<1>(acc.getCoins(CoinType::COIN)), Errors::ERROR_NO)); + + acc.registerCoinTransaction(CoinTransactionType::ADD, CoinType::COIN, 100, ""); + acc.registerCoinTransaction(CoinTransactionType::REMOVE, CoinType::COIN, 100, ""); + + expect(eq(accountRepository.coinsTransactions_.size(), 0)); + }; + + test("Account::getPassword returns empty string if not yet loaded") = [] { + expect(eq(Account { 1 }.getPassword(), std::string { "" })); + }; + + test("Account::getPassword returns password") = [&injectionFixture] { + auto [accountRepository] = injectionFixture.get(); + + Account acc { 1 }; + accountRepository.addAccount("canary@test.com", AccountInfo { 1, 1, 1, AccountType::ACCOUNT_TYPE_GOD }); + + expect( + eq(acc.load(), Errors::ERROR_NO) and + eq(acc.getPassword(), std::string { "123456" }) + ); + }; + + test("Account::getPassword returns logs error if it fails") = [&injectionFixture] { + auto [logger, accountRepository] = injectionFixture.get(); + + Account acc { 1 }; + accountRepository.failGetPassword = true; + accountRepository.addAccount("canary@test.com", AccountInfo { 1, 1, 1, AccountType::ACCOUNT_TYPE_GOD }); + + expect( + eq(acc.load(), Errors::ERROR_NO) and + eq(std::string{}, acc.getPassword()) and + eq(std::string{"error"}, logger.logs[0].level) and + eq(std::string{"Failed to get password for account[1]!"}, logger.logs[0].message) + ); + }; + + test("Account::addPremiumDays sets premium remaining days") = [] { + Account acc { 1 }; + acc.addPremiumDays(100); + + expect(eq(acc.getPremiumRemainingDays(), 100)); + }; + + test("Account::addPremiumDays can increase premium") = [] { + Account acc { 1 }; + + acc.setPremiumDays(50); + acc.addPremiumDays(50); + + expect( + approx(acc.getPremiumLastDay(), getTimeNow() + (100 * 86400), 60 * 60 * 1000) and + eq(acc.getPremiumRemainingDays(), 100) + ); + }; + + test("Account::addPremiumDays can reduce premium") = [] { + Account acc { 1 }; + + acc.setPremiumDays(50); + acc.addPremiumDays(-30); + + expect( + approx(acc.getPremiumLastDay(), getTimeNow() - (20 * 86400), 60 * 60 * 1000) and + eq(acc.getPremiumRemainingDays(), 20) + ); + }; + + test("Account::setPremiumDays sets to 0 if day is negative") = [] { + Account acc { 1 }; + acc.setPremiumDays(10); + acc.setPremiumDays(-20); + + expect( + eq(acc.getPremiumLastDay(), 0) and + eq(acc.getPremiumLastDay(), 0) + ); + }; + + test("Account::setAccountType sets account type") = [] { + Account acc { 1 }; + expect( + eq(acc.setAccountType(AccountType::ACCOUNT_TYPE_GAMEMASTER), Errors::ERROR_NO) and + eq(acc.getAccountType(), AccountType::ACCOUNT_TYPE_GAMEMASTER) + ); + }; + + test("Account::updatePremiumTime sets premium remaining days to 0 if last day is in the past") = [] { + Account acc { 1 }; + acc.setPremiumDays(-10); + acc.updatePremiumTime(); + expect(eq(acc.getPremiumRemainingDays(), 0)); + expect(eq(acc.getPremiumLastDay(), 0)); + }; + + test("Account::updatePremiumTime sets premium remaining days to 0 if last day is 0") = [] { + Account acc { 1 }; + acc.setPremiumDays(0); + acc.updatePremiumTime(); + expect(eq(acc.getPremiumLastDay(), 0)); + expect(eq(acc.getPremiumRemainingDays(), 0)); + }; + + test("Account::updatePremiumTime sets premium remaining days to N if last day is in the future") = [] { + Account acc { 1 }; + acc.setPremiumDays(8); + acc.updatePremiumTime(); + + auto remainingTime = (acc.getPremiumLastDay() - getTimeNow()) / 86400; + expect(approx(remainingTime, 8, 0.1)); + expect(eq(acc.getPremiumRemainingDays(), 8)); + }; + + test("Account::updatePremiumTime sets premium remaining days to 1 if last day is in less than a day from now") = [] { + Account acc { 1 }; + acc.setPremiumDays(1); + acc.updatePremiumTime(); + + auto remainingTime = (acc.getPremiumLastDay() - getTimeNow()) / 86400; + expect(approx(remainingTime, 1, 0.1)); + expect(eq(acc.getPremiumRemainingDays(), 1)); + }; + + test("Account::getAccountPlayer returns error if not yet loaded") = [] { + expect(eq(std::get<1>(Account { 1 }.getAccountPlayers()), Errors::ERROR_NOT_INITIALIZED)); + }; + + test("Account::getAccountPlayer returns players") = [&injectionFixture] { + auto [accountRepository] = injectionFixture.get(); + + Account acc { 1 }; + accountRepository.addAccount( + "canary@test.com", + AccountInfo { 1, 1, 1, AccountType::ACCOUNT_TYPE_GOD, {{ "Canary", 1 }, { "Canary2", 2 }} } + ); + + expect(acc.load() == Errors::ERROR_NO); + auto [players, error] = acc.getAccountPlayers(); + + expect( + eq(error, Errors::ERROR_NO) and + eq(players.size(), 2) and + eq(players["Canary"], 1) and + eq(players["Canary2"], 2) + ); + }; + + test("Account::authenticate password using sha1") = [&injectionFixture] { + auto [accountRepository] = injectionFixture.get(); + + Account acc { 1 }; + accountRepository.addAccount( + "canary@test.com", + AccountInfo { 1, 1, 1, AccountType::ACCOUNT_TYPE_GOD, { { "Canary", 1 }, { "Canary2", 2 } } } + ); + + expect(acc.load() == Errors::ERROR_NO); + accountRepository.password_ = "7c4a8d09ca3762af61e59520943dc26494f8941b"; + expect(acc.authenticate("123456")); + }; + + test("Account::authenticate using sessions") = [&injectionFixture] { + auto [accountRepository] = injectionFixture.get(); + + Account acc { 1 }; + accountRepository.addAccount( + "session-key", + AccountInfo { 1, 1, 1, AccountType::ACCOUNT_TYPE_GOD, { { "Canary", 1 }, { "Canary2", 2 } }, false, getTimeNow() + 24 * 60 * 60 * 1000 } + ); + + expect(acc.load() == Errors::ERROR_NO); + expect(acc.authenticate()); + }; +}; diff --git a/tests/unit/kv/CMakeLists.txt b/tests/unit/kv/CMakeLists.txt new file mode 100644 index 000000000..3d26b4c40 --- /dev/null +++ b/tests/unit/kv/CMakeLists.txt @@ -0,0 +1,3 @@ +target_sources(canary_ut PRIVATE + kv_test.cpp +) diff --git a/tests/unit/kv/kv_test.cpp b/tests/unit/kv/kv_test.cpp new file mode 100644 index 000000000..2e6b2c06c --- /dev/null +++ b/tests/unit/kv/kv_test.cpp @@ -0,0 +1,100 @@ +/** + * Canary - A free and open-source MMORPG server emulator + * Copyright (©) 2019-2023 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 + +#include "kv/kv.hpp" +#include "utils/tools.hpp" +#include "injection_fixture.hpp" + +suite<"kv"> kvTest = [] { + InjectionFixture injectionFixture {}; + + test("Set and get integer value") = [&injectionFixture] { + auto [kv] = injectionFixture.get(); + kv.set("keyInt", 42); + expect(eq(kv.get("keyInt"), 42)); + }; + + test("Set and get string value") = [&injectionFixture] { + auto [kv] = injectionFixture.get(); + kv.set("keyString", std::string("hello")); + expect(eq(kv.get("keyString"), std::string("hello"))); + }; + + test("Set and get double value") = [&injectionFixture] { + auto [kv] = injectionFixture.get(); + kv.set("keyDouble", 3.14); + expect(eq(kv.get("keyDouble"), 3.14)); + }; + + test("Overwrite existing key") = [&injectionFixture] { + auto [kv] = injectionFixture.get(); + kv.set("keyInt", 42); + kv.set("keyInt", 43); + expect(eq(kv.get("keyInt"), 43)); + }; + + test("Multiple key-value pairs") = [&injectionFixture] { + auto [kv] = injectionFixture.get(); + kv.set("key1", 1); + kv.set("key2", 2); + kv.set("key3", 3); + expect(eq(kv.get("key1"), 1)); + expect(eq(kv.get("key2"), 2)); + expect(eq(kv.get("key3"), 3)); + }; + + test("non-existant key") = [&injectionFixture] { + auto [kv] = injectionFixture.get(); + expect(!kv.get("non-existant").has_value()); + // default values + expect(eq(kv.get("non-existant"), 0)); + expect(eq(kv.get("non-existant"), std::string(""))); + expect(kv.get("non-existant").empty()); + expect(kv.get("non-existant").empty()); + }; + + test("Set and get MapType value") = [&injectionFixture] { + auto [kv] = injectionFixture.get(); + ValueWrapper mapValue { { "key1", 1 }, { "key2", 2 } }; + kv.set("keyMap", mapValue); + expect(eq(kv.get("keyMap"), mapValue.getVariant())); + }; + + test("Set and get ArrayType value") = [&injectionFixture] { + auto [kv] = injectionFixture.get(); + ValueWrapper arrayValue(ArrayType({ 1, 2, 3 })); + kv.set("keyArray", arrayValue); + expect(eq(kv.get("keyArray"), arrayValue.getVariant())); + }; + + test("Mixed types in MapType") = [&injectionFixture] { + auto [kv] = injectionFixture.get(); + ValueWrapper mixedMap { { "keyInt", 1 }, { "keyString", std::string("hello") }, { "keyDouble", 3.14 } }; + kv.set("keyMixedMap", mixedMap); + expect(eq(kv.get("keyMixedMap"), mixedMap.getVariant())); + }; + + test("Nested MapType and ArrayType") = [&injectionFixture] { + auto [kv] = injectionFixture.get(); + ValueWrapper nestedMap { { "keyArray", ValueWrapper { 1, 2 } }, { "keyInnerMap", ValueWrapper { { "key3", 3 } } } }; + kv.set("keyNested", nestedMap); + expect(eq(kv.get("keyNested"), nestedMap.getVariant())); + }; + + test("Scoped KV") = [&injectionFixture] { + auto [kv] = injectionFixture.get(); + auto scoped = kv.scoped("scope-name"); + scoped->set("key1", 1); + expect(eq(scoped->get("key1"), 1)); + expect(eq(kv.get("scope-name.key1"), 1)); + }; +}; diff --git a/tests/unit/lib/CMakeLists.txt b/tests/unit/lib/CMakeLists.txt new file mode 100644 index 000000000..9fcda69fb --- /dev/null +++ b/tests/unit/lib/CMakeLists.txt @@ -0,0 +1 @@ +add_subdirectory(di) diff --git a/tests/unit/lib/di/CMakeLists.txt b/tests/unit/lib/di/CMakeLists.txt new file mode 100644 index 000000000..c1c7576d1 --- /dev/null +++ b/tests/unit/lib/di/CMakeLists.txt @@ -0,0 +1,3 @@ +target_sources(canary_ut PRIVATE + soft_singleton_test.cpp +) diff --git a/tests/unit/lib/di/soft_singleton_test.cpp b/tests/unit/lib/di/soft_singleton_test.cpp new file mode 100644 index 000000000..99bb194e7 --- /dev/null +++ b/tests/unit/lib/di/soft_singleton_test.cpp @@ -0,0 +1,61 @@ +/** +* Canary - A free and open-source MMORPG server emulator +* Copyright (©) 2019-2023 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 + +#include "lib/di/container.hpp" +#include "lib/di/soft_singleton.hpp" +#include "lib/logging/in_memory_logger.hpp" + +using namespace boost::ut; + +suite<"lib"> softSingletonTest = [] { + test("SoftSingleton warns about multiple instances") = [] { + di::extension::injector<> injector{}; + DI::setTestContainer(&InMemoryLogger::install(injector)); + + SoftSingleton softSingleton{"Test"}; + SoftSingletonGuard guard{softSingleton}; + SoftSingletonGuard guard2{softSingleton}; + softSingleton.increment(); + + auto &logger = dynamic_cast(injector.create()); + expect(eq(2, logger.logCount()) >> fatal); + expect( + eq(std::string{"warning"}, logger.logs[0].level) and + eq(std::string{"2 instances created for Test. This is a soft singleton, you probably want to use g_test instead."}, logger.logs[0].message) + ); + expect( + eq(std::string{"warning"}, logger.logs[1].level) and + eq(std::string{"3 instances created for Test. This is a soft singleton, you probably want to use g_test instead."}, logger.logs[1].message) + ); + }; + + test("SoftSingleton doesn't warn if instance was released") = [] { + di::extension::injector<> injector{}; + DI::setTestContainer(&InMemoryLogger::install(injector)); + SoftSingleton softSingleton{"Test"}; + + [&softSingleton] { SoftSingletonGuard guard{softSingleton}; }(); + + // Lambda scope, guard was destructed. + [&softSingleton] { SoftSingletonGuard guard{softSingleton}; }(); + + // Lambda scope, guard2 was destructed. + softSingleton.increment(); + softSingleton.decrement(); + + // Decrement resets the counter; + softSingleton.increment(); + + auto &logger = dynamic_cast(injector.create()); + expect(eq(0, logger.logCount())); + }; +}; diff --git a/tests/unit/lib/logging/in_memory_logger.hpp b/tests/unit/lib/logging/in_memory_logger.hpp new file mode 100644 index 000000000..581a453ee --- /dev/null +++ b/tests/unit/lib/logging/in_memory_logger.hpp @@ -0,0 +1,84 @@ +/** + * Canary - A free and open-source MMORPG server emulator + * Copyright (©) 2019-2022 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 +#include +#include + +#include "test_injection.hpp" +#include "lib/di/container.hpp" + +namespace di = boost::di; + +class InMemoryLogger : public Logger { + private: + struct LogEntry { + std::string level; + std::string message; + }; + + public: + mutable std::vector logs; + + InMemoryLogger() = default; + InMemoryLogger(const InMemoryLogger &) {} + InMemoryLogger(const InMemoryLogger &&) {} + + static di::extension::injector<> & install(di::extension::injector<> &injector) { + injector.install(di::bind.to().in(di::singleton)); + return injector; + } + + InMemoryLogger &reset() { + logs.clear(); + return *this; + } + + bool hasLogEntry(const std::string& lvl, const std::string& expectedMsg) const { + for (const auto& entry : logs) { + if (entry.level == lvl && entry.message == expectedMsg) { + return true; + } + } + + return false; + } + + void setLevel(const std::string &name) override { + // For the stub, setting a level might not have any behavior. + // But you can implement level filtering if you like. + } + + [[nodiscard]] std::string getLevel() const override { + // For simplicity, let's just return a default level. You can adjust as needed. + return "DEBUG"; + } + + virtual void log(std::string lvl, fmt::basic_string_view msg) const override { + logs.push_back({lvl, {msg.data(), msg.size()}}); + } + + // Helper methods for testing + size_t logCount() const { + return logs.size(); + } + + std::pair getLogEntry(size_t index) const { + if (index < logs.size()) { + return {logs[index].level, logs[index].message}; + } + return {"", ""}; // Return empty pair for out-of-bounds. Alternatively, you could throw an exception. + } +}; + +template <> +struct TestInjection { + using type = InMemoryLogger; +}; \ No newline at end of file diff --git a/tests/unit/main.cpp b/tests/unit/main.cpp new file mode 100644 index 000000000..5cf3982af --- /dev/null +++ b/tests/unit/main.cpp @@ -0,0 +1,5 @@ +#include + +using namespace boost::ut; + +int main() {} diff --git a/tests/unit/security/CMakeLists.txt b/tests/unit/security/CMakeLists.txt new file mode 100644 index 000000000..143dc4ebb --- /dev/null +++ b/tests/unit/security/CMakeLists.txt @@ -0,0 +1,3 @@ +target_sources(canary_ut PRIVATE + rsa_test.cpp +) diff --git a/tests/unit/security/rsa_test.cpp b/tests/unit/security/rsa_test.cpp new file mode 100644 index 000000000..710ea45d2 --- /dev/null +++ b/tests/unit/security/rsa_test.cpp @@ -0,0 +1,33 @@ +/** +* Canary - A free and open-source MMORPG server emulator +* Copyright (©) 2019-2023 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 + +#include "lib/logging/in_memory_logger.hpp" +#include "security/rsa.hpp" + +using namespace boost::ut; + +suite<"security"> rsaTest = [] { + test("RSA::start logs error for missing .pem file") = [] { + di::extension::injector<> injector{}; + DI::setTestContainer(&InMemoryLogger::install(injector)); + + DI::create().start(); + + auto &logger = dynamic_cast(injector.create()); + + expect(eq(1, logger.logs.size()) >> fatal); + expect( + eq(std::string{"error"}, logger.logs[0].level) and + eq(std::string{"File key.pem not found or have problem on loading... Setting standard rsa key\n"}, logger.logs[0].message) + ); + }; +}; diff --git a/tests/unit/utils/CMakeLists.txt b/tests/unit/utils/CMakeLists.txt new file mode 100644 index 000000000..45825b981 --- /dev/null +++ b/tests/unit/utils/CMakeLists.txt @@ -0,0 +1,4 @@ +target_sources(canary_ut PRIVATE + position_functions_test.cpp + string_functions_test.cpp +) diff --git a/tests/unit/utils/position_functions_test.cpp b/tests/unit/utils/position_functions_test.cpp new file mode 100644 index 000000000..52341fd8d --- /dev/null +++ b/tests/unit/utils/position_functions_test.cpp @@ -0,0 +1,53 @@ +#include "pch.hpp" + +#include + +#include "utils/tools.hpp" + +using namespace boost::ut; + +suite<"utils"> getDirectionToTest = [] { + struct GetDirectionToTestCase { + Position from, to; + Direction expected, expectedForExactDiagonal; + + [[nodiscard]] std::string toString() const { + return fmt::format("from {} to {}", from.toString(), to.toString()); + } + }; + + std::vector getDirectionToTestCases{ + GetDirectionToTestCase{ Position{}, Position{}, DIRECTION_SOUTH, DIRECTION_SOUTH }, + GetDirectionToTestCase{ Position{0,0,0}, Position{0,0,0}, DIRECTION_SOUTH, DIRECTION_SOUTH }, + GetDirectionToTestCase{ Position{100,100,100}, Position{100,100,100}, DIRECTION_SOUTH, DIRECTION_SOUTH }, + GetDirectionToTestCase{ Position{125,1123,5}, Position{125,1153,5}, DIRECTION_SOUTH, DIRECTION_SOUTH }, + GetDirectionToTestCase{ Position{5555,3212,15}, Position{5555,3211,15}, DIRECTION_NORTH, DIRECTION_NORTH }, + GetDirectionToTestCase{ Position{32132,65000,11}, Position{31512,65000,11}, DIRECTION_WEST, DIRECTION_WEST }, + GetDirectionToTestCase{ Position{5123,6554,7}, Position{40000,6554,7}, DIRECTION_EAST, DIRECTION_EAST }, + GetDirectionToTestCase{ Position{25200,33173,8}, Position{5200,13173,7}, DIRECTION_NORTHWEST, DIRECTION_NORTHWEST }, + GetDirectionToTestCase{ Position{22137,6,9}, Position{22141,2,15}, DIRECTION_NORTHEAST, DIRECTION_NORTHEAST }, + GetDirectionToTestCase{ Position{32011,2197,1}, Position{32135,2321,13}, DIRECTION_SOUTHEAST, DIRECTION_SOUTHEAST }, + GetDirectionToTestCase{ Position{13121,5213,5}, Position{5213,13121,5}, DIRECTION_SOUTHWEST, DIRECTION_SOUTHWEST }, + + GetDirectionToTestCase{ Position{123,122,0}, Position{0,0,0}, DIRECTION_NORTHWEST, DIRECTION_WEST }, + GetDirectionToTestCase{ Position{122,123,0}, Position{0,0,0}, DIRECTION_NORTHWEST, DIRECTION_NORTH }, + GetDirectionToTestCase{ Position{0,122,0}, Position{123,0,0}, DIRECTION_NORTHEAST, DIRECTION_EAST }, + GetDirectionToTestCase{ Position{0,123,0}, Position{122,0,0}, DIRECTION_NORTHEAST, DIRECTION_NORTH }, + GetDirectionToTestCase{ Position{0,0,0}, Position{123,122,0}, DIRECTION_SOUTHEAST, DIRECTION_EAST }, + GetDirectionToTestCase{ Position{0,0,0}, Position{122,123,0}, DIRECTION_SOUTHEAST, DIRECTION_SOUTH }, + GetDirectionToTestCase{ Position{123,0,0}, Position{0,122,0}, DIRECTION_SOUTHWEST, DIRECTION_WEST }, + GetDirectionToTestCase{ Position{122,0,0}, Position{0,123,0}, DIRECTION_SOUTHWEST, DIRECTION_SOUTH }, + }; + + for (auto getDirectionToTestCase : getDirectionToTestCases) { + test("getDirectionTo " + getDirectionToTestCase.toString()) = [getDirectionToTestCase] { + auto [from, to, expected, expectedForExactDiagonal] = getDirectionToTestCase; + + auto result = getDirectionTo(from, to); + expect(eq(expectedForExactDiagonal, result)) << fmt::format("[exact diagonal] {} != {}", static_cast(expectedForExactDiagonal), static_cast(result)); + + result = getDirectionTo(from, to, false); + expect(eq(expected, result)) << fmt::format("[non-exact diagonal] {} != {}", static_cast(expected), static_cast(result)); + }; + } +}; diff --git a/tests/unit/utils/string_functions_test.cpp b/tests/unit/utils/string_functions_test.cpp new file mode 100644 index 000000000..659f4b195 --- /dev/null +++ b/tests/unit/utils/string_functions_test.cpp @@ -0,0 +1,34 @@ +#include "pch.hpp" + +#include + +#include "utils/tools.hpp" + +using namespace boost::ut; + +suite<"utils"> replaceStringTest = [] { + struct ReplaceStringTestCase { + std::string subject, search, replace, expected; + + [[nodiscard]] std::string toString() const { + return fmt::format("replace {} in {} by {}", search, subject, replace); + } + }; + + std::vector replaceStringTestCases{ + ReplaceStringTestCase { "", "", "", "" }, + ReplaceStringTestCase { "all together", " ", "_", "all_together" }, + ReplaceStringTestCase { "beautiful", "u", "", "beatifl" }, + ReplaceStringTestCase { "empty_empty_empty_", "empty_", "", "" }, + ReplaceStringTestCase { "I am someone", "someone", "Lucas", "I am Lucas" }, + ReplaceStringTestCase { "[[123[[[[[[124[[asf[[ccc[[[", "[[", "\\[[", "\\[[123\\[[\\[[\\[[124\\[[asf\\[[ccc\\[[[" }, + }; + + for (const auto &replaceStringTestCase : replaceStringTestCases) { + test(replaceStringTestCase.toString()) = [&replaceStringTestCase] { + auto [subject, search, replace, expected] = replaceStringTestCase; + replaceString(subject, search, replace); + expect(eq(expected, subject)) << fmt::format("{} != {}", expected, subject); + }; + } +}; diff --git a/vcproj/otxserver.vcxproj b/vcproj/otxserver.vcxproj index 0ccc00ced..cdf4fc3f7 100644 --- a/vcproj/otxserver.vcxproj +++ b/vcproj/otxserver.vcxproj @@ -11,6 +11,10 @@ + + + + @@ -28,7 +32,6 @@ - @@ -94,6 +97,10 @@ + + + + @@ -125,6 +132,7 @@ + @@ -189,7 +197,8 @@ - + + @@ -212,6 +221,7 @@ + @@ -226,7 +236,7 @@ - + @@ -282,6 +292,9 @@ + + + @@ -302,6 +315,7 @@ + @@ -360,7 +374,14 @@ - + + false + false + + + false + false + @@ -523,4 +544,4 @@ - + \ No newline at end of file