diff --git a/.github/workflows/gcc-build.yml b/.github/workflows/gcc-build.yml index 1f6ade7000282..ecd9c67ef6c88 100644 --- a/.github/workflows/gcc-build.yml +++ b/.github/workflows/gcc-build.yml @@ -11,8 +11,8 @@ jobs: - uses: actions/checkout@v2 - name: Dependencies run: | - sudo apt-get update && sudo apt-get install -yq libboost-all-dev g++-11 - sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 100 --slave /usr/bin/g++ g++ /usr/bin/g++-11 + sudo apt-get update && sudo apt-get install -yq libboost-all-dev g++-12 + sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-12 100 --slave /usr/bin/g++ g++ /usr/bin/g++-12 - name: Setup run: | mkdir bin diff --git a/CMakeLists.txt b/CMakeLists.txt index cc306ab0ce120..3b8f785312541 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,22 +8,17 @@ # WITHOUT ANY WARRANTY, to the extent permitted by law; without even the # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -cmake_minimum_required(VERSION 3.18) +cmake_minimum_required(VERSION 3.25) # add this options before PROJECT keyword set(CMAKE_DISABLE_SOURCE_CHANGES ON) set(CMAKE_DISABLE_IN_SOURCE_BUILD ON) # Set projectname (must be done AFTER setting configurationtypes) -project(TrinityCore) - -# CMake policies (can not be handled elsewhere) -cmake_policy(SET CMP0005 NEW) -cmake_policy(SET CMP0043 NEW) # Ignore COMPILE_DEFINITIONS_ properties -cmake_policy(SET CMP0054 NEW) # Only interpret if() arguments as variables or keywords when unquoted - prevents intepreting if(SOME_STRING_VARIABLE MATCHES "MSVC") as if(SOME_STRING_VARIABLE MATCHES "1") -cmake_policy(SET CMP0067 NEW) # Honor language standard in try_compile() source-file signature -cmake_policy(SET CMP0074 NEW) # find_package() uses _ROOT variables +project(TrinityCore + LANGUAGES CXX C) +# Policies introduced after cmake_minimum_required version (policies up to 3.25 are set automatically) if(POLICY CMP0144) cmake_policy(SET CMP0144 NEW) # find_package() uses upper-case _ROOT variables endif() @@ -32,6 +27,10 @@ if(POLICY CMP0153) cmake_policy(SET CMP0153 NEW) # The exec_program() command should not be called endif() +if(POLICY CMP0155) + cmake_policy(SET CMP0155 NEW) # C and C++ source files can have a .h extension +endif() + # Set RPATH-handing (CMake parameters) set(CMAKE_SKIP_BUILD_RPATH 0) set(CMAKE_BUILD_WITH_INSTALL_RPATH 0) diff --git a/README Part 2 b/README Part 2 new file mode 100644 index 0000000000000..1bee45427376d --- /dev/null +++ b/README Part 2 @@ -0,0 +1 @@ +"This is a High-Effort revival of TrinityCore 4.3.4, architected via AI-Human collaboration (Vibe Coding) to modernize legacy systems for C++20 and 64-bit environments." \ No newline at end of file diff --git a/changes.txt b/changes.txt new file mode 100644 index 0000000000000..5cf2fc3ef1f3f Binary files /dev/null and b/changes.txt differ diff --git a/cmake/compiler/clang/settings.cmake b/cmake/compiler/clang/settings.cmake index febe93f94dffe..0315cbd5771bf 100644 --- a/cmake/compiler/clang/settings.cmake +++ b/cmake/compiler/clang/settings.cmake @@ -1,8 +1,7 @@ -set(CLANG_EXPECTED_VERSION 11.0.0) +set(CLANG_EXPECTED_VERSION 14.0.0) if(CMAKE_CXX_COMPILER_ID MATCHES "AppleClang") - # apple doesnt like to do the sane thing which would be to use the same version numbering as regular clang - # version number pulled from https://en.wikipedia.org/wiki/Xcode#Toolchain_versions for row matching LLVM 11 - set(CLANG_EXPECTED_VERSION 12.0.5) + # As of Xcode 14 / AppleClang 14, version numbers match upstream LLVM Clang + set(CLANG_EXPECTED_VERSION 14.0.0) # enable -fpch-instantiate-templates for AppleClang (by default it is active only for regular clang) set(CMAKE_C_COMPILE_OPTIONS_INSTANTIATE_TEMPLATES_PCH -fpch-instantiate-templates) set(CMAKE_CXX_COMPILE_OPTIONS_INSTANTIATE_TEMPLATES_PCH -fpch-instantiate-templates) @@ -14,31 +13,6 @@ else() message(STATUS "Clang: Minimum version required is ${CLANG_EXPECTED_VERSION}, found ${CMAKE_CXX_COMPILER_VERSION} - ok!") endif() -# This tests for a bug in clang-7 that causes linkage to fail for 64-bit from_chars (in some configurations) -# If the clang requirement is bumped to >= clang-8, you can remove this check, as well as -# the associated ifdef block in src/common/Utilities/StringConvert.h -include(CheckCXXSourceCompiles) - -check_cxx_source_compiles(" -#include -#include - -int main() -{ - uint64_t n; - char const c[] = \"0\"; - std::from_chars(c, c+1, n); - return static_cast(n); -} -" CLANG_HAVE_PROPER_CHARCONV) - -if (NOT CLANG_HAVE_PROPER_CHARCONV) - message(STATUS "Clang: Detected from_chars bug for 64-bit integers, workaround enabled") - target_compile_definitions(trinity-compile-option-interface - INTERFACE - TRINITY_NEED_CHARCONV_WORKAROUND) -endif() - if(WITH_WARNINGS) target_compile_options(trinity-warning-interface INTERFACE diff --git a/cmake/compiler/gcc/settings.cmake b/cmake/compiler/gcc/settings.cmake index 4861f48dccc63..8776a1191e592 100644 --- a/cmake/compiler/gcc/settings.cmake +++ b/cmake/compiler/gcc/settings.cmake @@ -1,4 +1,4 @@ -set(GCC_EXPECTED_VERSION 11.1.0) +set(GCC_EXPECTED_VERSION 12.1.0) if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS GCC_EXPECTED_VERSION) message(FATAL_ERROR "GCC: TrinityCore requires version ${GCC_EXPECTED_VERSION} to build but found ${CMAKE_CXX_COMPILER_VERSION}") diff --git a/cmake/compiler/msvc/settings.cmake b/cmake/compiler/msvc/settings.cmake index b71d7e9e80843..54651137097c9 100644 --- a/cmake/compiler/msvc/settings.cmake +++ b/cmake/compiler/msvc/settings.cmake @@ -1,5 +1,5 @@ -set(MSVC_EXPECTED_VERSION 19.32) -set(MSVC_EXPECTED_VERSION_STRING "Microsoft Visual Studio 2022 17.2") +set(MSVC_EXPECTED_VERSION 19.36) +set(MSVC_EXPECTED_VERSION_STRING "Microsoft Visual Studio 2022 17.6") # This file is also used by compilers that pretend to be MSVC but report their own version number - don't version check them if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") @@ -26,7 +26,8 @@ target_compile_options(trinity-warning-interface # disable permissive mode to make msvc more eager to reject code that other compilers don't already accept target_compile_options(trinity-compile-option-interface INTERFACE - /permissive-) + /permissive- + /utf-8) # set source and execution character set to UTF-8 if(PLATFORM EQUAL 32) # mark 32 bit executables large address aware so they can use > 2GB address space diff --git a/cmake/macros/ConfigureBaseTargets.cmake b/cmake/macros/ConfigureBaseTargets.cmake index 19d11d27bd502..99e2efb93e3aa 100644 --- a/cmake/macros/ConfigureBaseTargets.cmake +++ b/cmake/macros/ConfigureBaseTargets.cmake @@ -11,9 +11,9 @@ # An interface library to make the target com available to other targets add_library(trinity-compile-option-interface INTERFACE) -# Use -std=c++11 instead of -std=gnu++11 set(CMAKE_CXX_EXTENSIONS OFF) -set(CMAKE_CXX_STANDARD 20) +set(CMAKE_CXX_STANDARD ${TRINITY_CXX_STANDARD}) +set(CMAKE_CXX_STANDARD_REQUIRED ON) # Set build-directive (used in core to tell which buildtype we used) target_compile_definitions(trinity-compile-option-interface @@ -68,3 +68,7 @@ target_link_libraries(trinity-core-interface INTERFACE trinity-default-interface trinity-warning-interface) + +target_compile_features(trinity-core-interface + INTERFACE + "cxx_std_${TRINITY_CXX_STANDARD}") diff --git a/cmake/options.cmake b/cmake/options.cmake index e939528584f0a..6bd125660827b 100644 --- a/cmake/options.cmake +++ b/cmake/options.cmake @@ -8,6 +8,12 @@ # WITHOUT ANY WARRANTY, to the extent permitted by law; without even the # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +set(TRINITY_CXX_STANDARD "20" CACHE STRING "C++ standard version to build with (20 or 23)") +set_property(CACHE TRINITY_CXX_STANDARD PROPERTY STRINGS 20 23) +if(NOT TRINITY_CXX_STANDARD MATCHES "^(20|23)$") + message(FATAL_ERROR "TRINITY_CXX_STANDARD must be 20 or 23, got: ${TRINITY_CXX_STANDARD}") +endif() + option(SERVERS "Build worldserver and authserver" 1) set(SCRIPTS_AVAILABLE_OPTIONS none static dynamic minimal-static minimal-dynamic) diff --git a/cmake/showoptions.cmake b/cmake/showoptions.cmake index 242b2500cdefc..ac7d77c9ad226 100644 --- a/cmake/showoptions.cmake +++ b/cmake/showoptions.cmake @@ -5,6 +5,7 @@ get_property(IS_MULTI_CONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) if(NOT IS_MULTI_CONFIG) message("* TrinityCore buildtype : ${CMAKE_BUILD_TYPE}") endif() +message("* C++ standard : C++${TRINITY_CXX_STANDARD}") message("") # output information about installation-directories and locations diff --git a/contrib/ScriptsConverter/ScriptConverter/obj/Debug/ScriptConverter.csproj.AssemblyReference.cache b/contrib/ScriptsConverter/ScriptConverter/obj/Debug/ScriptConverter.csproj.AssemblyReference.cache new file mode 100644 index 0000000000000..3e93227f82f86 Binary files /dev/null and b/contrib/ScriptsConverter/ScriptConverter/obj/Debug/ScriptConverter.csproj.AssemblyReference.cache differ diff --git a/contrib/ScriptsConverter/ScriptConverter/obj/Release/ScriptConverter.csproj.AssemblyReference.cache b/contrib/ScriptsConverter/ScriptConverter/obj/Release/ScriptConverter.csproj.AssemblyReference.cache new file mode 100644 index 0000000000000..3e93227f82f86 Binary files /dev/null and b/contrib/ScriptsConverter/ScriptConverter/obj/Release/ScriptConverter.csproj.AssemblyReference.cache differ diff --git a/sql/updates/characters/2025_05_09_00_characters_bigint_guid.sql b/sql/updates/characters/2025_05_09_00_characters_bigint_guid.sql new file mode 100644 index 0000000000000..dcd58a740b878 --- /dev/null +++ b/sql/updates/characters/2025_05_09_00_characters_bigint_guid.sql @@ -0,0 +1,306 @@ +-- 64-bit GUID Migration: characters database +-- Converts all player/item/pet/creature entity GUID columns from INT UNSIGNED +-- (or MEDIUMINT UNSIGNED) to BIGINT UNSIGNED. + +-- ─── Player GUIDs ────────────────────────────────────────────────────────── + +-- characters: primary key (player guid, AUTO_INCREMENT implied by application) +ALTER TABLE `characters` + MODIFY COLUMN `guid` BIGINT UNSIGNED NOT NULL DEFAULT '0' COMMENT 'Global Unique Identifier', + MODIFY COLUMN `transguid` BIGINT UNSIGNED NOT NULL DEFAULT '0'; + +-- character_account_data +ALTER TABLE `character_account_data` + MODIFY COLUMN `guid` BIGINT UNSIGNED NOT NULL DEFAULT '0'; + +-- character_achievement +ALTER TABLE `character_achievement` + MODIFY COLUMN `guid` BIGINT UNSIGNED NOT NULL; + +-- character_achievement_progress +ALTER TABLE `character_achievement_progress` + MODIFY COLUMN `guid` BIGINT UNSIGNED NOT NULL; + +-- character_action +ALTER TABLE `character_action` + MODIFY COLUMN `guid` BIGINT UNSIGNED NOT NULL DEFAULT '0'; + +-- character_arena_stats +ALTER TABLE `character_arena_stats` + MODIFY COLUMN `guid` BIGINT UNSIGNED NOT NULL DEFAULT '0'; + +-- character_aura (casterGuid/itemGuid are already BIGINT) +ALTER TABLE `character_aura` + MODIFY COLUMN `guid` BIGINT UNSIGNED NOT NULL DEFAULT '0' COMMENT 'Global Unique Identifier'; + +-- character_banned +ALTER TABLE `character_banned` + MODIFY COLUMN `guid` BIGINT UNSIGNED NOT NULL DEFAULT '0' COMMENT 'Global Unique Identifier'; + +-- character_battleground_data +ALTER TABLE `character_battleground_data` + MODIFY COLUMN `guid` BIGINT UNSIGNED NOT NULL DEFAULT '0'; + +-- character_battleground_random +ALTER TABLE `character_battleground_random` + MODIFY COLUMN `guid` BIGINT UNSIGNED NOT NULL DEFAULT '0'; + +-- character_declinedname +ALTER TABLE `character_declinedname` + MODIFY COLUMN `guid` BIGINT UNSIGNED NOT NULL DEFAULT '0'; + +-- character_equipmentsets (setguid is already BIGINT AUTO_INCREMENT) +ALTER TABLE `character_equipmentsets` + MODIFY COLUMN `guid` BIGINT UNSIGNED NOT NULL DEFAULT '0'; + +-- character_fishingsteps +ALTER TABLE `character_fishingsteps` + MODIFY COLUMN `guid` BIGINT UNSIGNED NOT NULL DEFAULT '0' COMMENT 'Global Unique Identifier'; + +-- character_gifts: guid is the character GUID, item_guid is the item GUID +ALTER TABLE `character_gifts` + MODIFY COLUMN `guid` BIGINT UNSIGNED NOT NULL DEFAULT '0', + MODIFY COLUMN `item_guid` BIGINT UNSIGNED NOT NULL DEFAULT '0'; + +-- character_glyphs +ALTER TABLE `character_glyphs` + MODIFY COLUMN `guid` BIGINT UNSIGNED NOT NULL DEFAULT '0' COMMENT 'Global Unique Identifier'; + +-- character_homebind +ALTER TABLE `character_homebind` + MODIFY COLUMN `guid` BIGINT UNSIGNED NOT NULL DEFAULT '0' COMMENT 'Global Unique Identifier'; + +-- character_instance +ALTER TABLE `character_instance` + MODIFY COLUMN `guid` BIGINT UNSIGNED NOT NULL DEFAULT '0'; + +-- character_inventory +ALTER TABLE `character_inventory` + MODIFY COLUMN `guid` BIGINT UNSIGNED NOT NULL DEFAULT '0' COMMENT 'Global Unique Identifier'; + +-- character_queststatus +ALTER TABLE `character_queststatus` + MODIFY COLUMN `guid` BIGINT UNSIGNED NOT NULL DEFAULT '0' COMMENT 'Global Unique Identifier'; + +-- character_queststatus_daily +ALTER TABLE `character_queststatus_daily` + MODIFY COLUMN `guid` BIGINT UNSIGNED NOT NULL DEFAULT '0' COMMENT 'Global Unique Identifier'; + +-- character_queststatus_monthly +ALTER TABLE `character_queststatus_monthly` + MODIFY COLUMN `guid` BIGINT UNSIGNED NOT NULL DEFAULT '0' COMMENT 'Global Unique Identifier'; + +-- character_queststatus_rewarded +ALTER TABLE `character_queststatus_rewarded` + MODIFY COLUMN `guid` BIGINT UNSIGNED NOT NULL DEFAULT '0' COMMENT 'Global Unique Identifier'; + +-- character_queststatus_seasonal +ALTER TABLE `character_queststatus_seasonal` + MODIFY COLUMN `guid` BIGINT UNSIGNED NOT NULL DEFAULT '0' COMMENT 'Global Unique Identifier'; + +-- character_queststatus_weekly +ALTER TABLE `character_queststatus_weekly` + MODIFY COLUMN `guid` BIGINT UNSIGNED NOT NULL DEFAULT '0' COMMENT 'Global Unique Identifier'; + +-- character_reputation +ALTER TABLE `character_reputation` + MODIFY COLUMN `guid` BIGINT UNSIGNED NOT NULL DEFAULT '0' COMMENT 'Global Unique Identifier'; + +-- character_skills +ALTER TABLE `character_skills` + MODIFY COLUMN `guid` BIGINT UNSIGNED NOT NULL COMMENT 'Global Unique Identifier'; + +-- character_social +ALTER TABLE `character_social` + MODIFY COLUMN `guid` BIGINT UNSIGNED NOT NULL DEFAULT '0' COMMENT 'Character Global Unique Identifier'; + +-- character_spell +ALTER TABLE `character_spell` + MODIFY COLUMN `guid` BIGINT UNSIGNED NOT NULL DEFAULT '0' COMMENT 'Global Unique Identifier, Low part'; + +-- character_spell_cooldown +ALTER TABLE `character_spell_cooldown` + MODIFY COLUMN `guid` BIGINT UNSIGNED NOT NULL DEFAULT '0' COMMENT 'Global Unique Identifier, Low part'; + +-- character_stats +ALTER TABLE `character_stats` + MODIFY COLUMN `guid` BIGINT UNSIGNED NOT NULL DEFAULT '0' COMMENT 'Global Unique Identifier'; + +-- character_talent +ALTER TABLE `character_talent` + MODIFY COLUMN `guid` BIGINT UNSIGNED NOT NULL; + +-- ─── Item GUIDs ──────────────────────────────────────────────────────────── + +-- item_instance: guid is item GUID (primary key); owner/creator/giftCreator are character GUIDs +ALTER TABLE `item_instance` + MODIFY COLUMN `guid` BIGINT UNSIGNED NOT NULL DEFAULT '0', + MODIFY COLUMN `owner_guid` BIGINT UNSIGNED NOT NULL DEFAULT '0', + MODIFY COLUMN `creatorGuid` BIGINT UNSIGNED NOT NULL DEFAULT '0', + MODIFY COLUMN `giftCreatorGuid` BIGINT UNSIGNED NOT NULL DEFAULT '0'; + +-- item_loot_items: container_id references item_instance.guid +ALTER TABLE `item_loot_items` + MODIFY COLUMN `container_id` BIGINT UNSIGNED NOT NULL DEFAULT '0' COMMENT 'guid of container (item_instance.guid)'; + +-- item_loot_money: container_id references item_instance.guid +ALTER TABLE `item_loot_money` + MODIFY COLUMN `container_id` BIGINT UNSIGNED NOT NULL DEFAULT '0' COMMENT 'guid of container (item_instance.guid)'; + +-- item_refund_instance +ALTER TABLE `item_refund_instance` + MODIFY COLUMN `item_guid` BIGINT UNSIGNED NOT NULL COMMENT 'Item GUID', + MODIFY COLUMN `player_guid` BIGINT UNSIGNED NOT NULL COMMENT 'Player GUID'; + +-- item_soulbound_trade_data +ALTER TABLE `item_soulbound_trade_data` + MODIFY COLUMN `itemGuid` BIGINT UNSIGNED NOT NULL COMMENT 'Item GUID'; + +-- ─── Pet GUIDs ───────────────────────────────────────────────────────────── + +-- character_pet: id is pet GUID (primary key), owner is character GUID +ALTER TABLE `character_pet` + MODIFY COLUMN `id` BIGINT UNSIGNED NOT NULL DEFAULT '0', + MODIFY COLUMN `owner` BIGINT UNSIGNED NOT NULL DEFAULT '0'; + +-- character_pet_declinedname +ALTER TABLE `character_pet_declinedname` + MODIFY COLUMN `id` BIGINT UNSIGNED NOT NULL DEFAULT '0', + MODIFY COLUMN `owner` BIGINT UNSIGNED NOT NULL DEFAULT '0'; + +-- pet_aura (casterGuid already BIGINT) +ALTER TABLE `pet_aura` + MODIFY COLUMN `guid` BIGINT UNSIGNED NOT NULL DEFAULT '0' COMMENT 'Global Unique Identifier'; + +-- pet_spell +ALTER TABLE `pet_spell` + MODIFY COLUMN `guid` BIGINT UNSIGNED NOT NULL DEFAULT '0' COMMENT 'Global Unique Identifier'; + +-- pet_spell_cooldown +ALTER TABLE `pet_spell_cooldown` + MODIFY COLUMN `guid` BIGINT UNSIGNED NOT NULL DEFAULT '0' COMMENT 'Global Unique Identifier, Low part'; + +-- ─── Mail ────────────────────────────────────────────────────────────────── + +-- mail: sender/receiver are character GUIDs +ALTER TABLE `mail` + MODIFY COLUMN `sender` BIGINT UNSIGNED NOT NULL DEFAULT '0' COMMENT 'Character Global Unique Identifier', + MODIFY COLUMN `receiver` BIGINT UNSIGNED NOT NULL DEFAULT '0' COMMENT 'Character Global Unique Identifier'; + +-- mail_items: item_guid is item GUID; receiver is character GUID +ALTER TABLE `mail_items` + MODIFY COLUMN `item_guid` BIGINT UNSIGNED NOT NULL DEFAULT '0', + MODIFY COLUMN `receiver` BIGINT UNSIGNED NOT NULL DEFAULT '0' COMMENT 'Character Global Unique Identifier'; + +-- ─── Auction House ───────────────────────────────────────────────────────── + +-- auctionhouse: itemguid is item GUID; itemowner/buyguid are character GUIDs +ALTER TABLE `auctionhouse` + MODIFY COLUMN `itemguid` BIGINT UNSIGNED NOT NULL DEFAULT '0', + MODIFY COLUMN `itemowner` BIGINT UNSIGNED NOT NULL DEFAULT '0', + MODIFY COLUMN `buyguid` BIGINT UNSIGNED NOT NULL DEFAULT '0'; + +-- auctionbidders: bidderguid is character GUID +ALTER TABLE `auctionbidders` + MODIFY COLUMN `bidderguid` BIGINT UNSIGNED NOT NULL DEFAULT '0'; + +-- ─── Corpse ──────────────────────────────────────────────────────────────── + +-- corpse: guid is the owning character's GUID +ALTER TABLE `corpse` + MODIFY COLUMN `guid` BIGINT UNSIGNED NOT NULL DEFAULT '0' COMMENT 'Global Unique Identifier'; + +-- ─── Guild ───────────────────────────────────────────────────────────────── + +ALTER TABLE `guild` + MODIFY COLUMN `leaderguid` BIGINT UNSIGNED NOT NULL DEFAULT '0'; + +ALTER TABLE `guild_bank_eventlog` + MODIFY COLUMN `PlayerGuid` BIGINT UNSIGNED NOT NULL DEFAULT '0'; + +ALTER TABLE `guild_bank_item` + MODIFY COLUMN `item_guid` BIGINT UNSIGNED NOT NULL DEFAULT '0'; + +ALTER TABLE `guild_eventlog` + MODIFY COLUMN `PlayerGuid1` BIGINT UNSIGNED NOT NULL COMMENT 'Player 1', + MODIFY COLUMN `PlayerGuid2` BIGINT UNSIGNED NOT NULL COMMENT 'Player 2'; + +ALTER TABLE `guild_member` + MODIFY COLUMN `guid` BIGINT UNSIGNED NOT NULL; + +ALTER TABLE `guild_member_withdraw` + MODIFY COLUMN `guid` BIGINT UNSIGNED NOT NULL DEFAULT '0'; + +-- ─── Groups ──────────────────────────────────────────────────────────────── + +ALTER TABLE `group_instance` + MODIFY COLUMN `guid` BIGINT UNSIGNED NOT NULL DEFAULT '0'; + +ALTER TABLE `group_member` + MODIFY COLUMN `guid` BIGINT UNSIGNED NOT NULL, + MODIFY COLUMN `memberGuid` BIGINT UNSIGNED NOT NULL; + +ALTER TABLE `groups` + MODIFY COLUMN `guid` BIGINT UNSIGNED NOT NULL, + MODIFY COLUMN `leaderGuid` BIGINT UNSIGNED NOT NULL, + MODIFY COLUMN `looterGuid` BIGINT UNSIGNED NOT NULL, + MODIFY COLUMN `masterLooterGuid` BIGINT UNSIGNED NOT NULL; + +-- ─── Arena ───────────────────────────────────────────────────────────────── + +ALTER TABLE `arena_team` + MODIFY COLUMN `captainGuid` BIGINT UNSIGNED NOT NULL DEFAULT '0'; + +ALTER TABLE `arena_team_member` + MODIFY COLUMN `guid` BIGINT UNSIGNED NOT NULL DEFAULT '0'; + +-- ─── Battleground ────────────────────────────────────────────────────────── + +ALTER TABLE `battleground_deserters` + MODIFY COLUMN `guid` BIGINT UNSIGNED NOT NULL COMMENT 'characters.guid'; + +-- ─── LFG ─────────────────────────────────────────────────────────────────── + +ALTER TABLE `lfg_data` + MODIFY COLUMN `guid` BIGINT UNSIGNED NOT NULL DEFAULT '0' COMMENT 'Global Unique Identifier'; + +-- ─── Petitions ───────────────────────────────────────────────────────────── + +ALTER TABLE `petition` + MODIFY COLUMN `ownerguid` BIGINT UNSIGNED NOT NULL, + MODIFY COLUMN `petitionguid` BIGINT UNSIGNED DEFAULT '0'; + +ALTER TABLE `petition_sign` + MODIFY COLUMN `ownerguid` BIGINT UNSIGNED NOT NULL, + MODIFY COLUMN `petitionguid` BIGINT UNSIGNED NOT NULL DEFAULT '0', + MODIFY COLUMN `playerguid` BIGINT UNSIGNED NOT NULL DEFAULT '0'; + +-- ─── GM Tickets / Surveys ────────────────────────────────────────────────── + +ALTER TABLE `gm_survey` + MODIFY COLUMN `guid` BIGINT UNSIGNED NOT NULL DEFAULT '0'; + +ALTER TABLE `gm_ticket` + MODIFY COLUMN `playerGuid` BIGINT UNSIGNED NOT NULL DEFAULT '0' COMMENT 'Global Unique Identifier of ticket creator', + MODIFY COLUMN `assignedTo` BIGINT UNSIGNED NOT NULL DEFAULT '0' COMMENT 'GUID of admin to whom ticket is assigned'; + +-- ─── PvP Stats ───────────────────────────────────────────────────────────── + +ALTER TABLE `pvpstats_players` + MODIFY COLUMN `character_guid` BIGINT UNSIGNED NOT NULL; + +-- ─── Quest Tracker ───────────────────────────────────────────────────────── + +ALTER TABLE `quest_tracker` + MODIFY COLUMN `character_guid` BIGINT UNSIGNED NOT NULL DEFAULT '0'; + +-- ─── Respawn ─────────────────────────────────────────────────────────────── + +-- respawn.spawnId references creature.guid or gameobject.guid +ALTER TABLE `respawn` + MODIFY COLUMN `spawnId` BIGINT UNSIGNED NOT NULL; + +-- ─── Lag Reports ─────────────────────────────────────────────────────────── + +ALTER TABLE `lag_reports` + MODIFY COLUMN `guid` BIGINT UNSIGNED NOT NULL DEFAULT '0' COMMENT 'Global Unique Identifier'; diff --git a/sql/updates/world/2025_05_09_00_world_bigint_guid.sql b/sql/updates/world/2025_05_09_00_world_bigint_guid.sql new file mode 100644 index 0000000000000..4bf7a545571bb --- /dev/null +++ b/sql/updates/world/2025_05_09_00_world_bigint_guid.sql @@ -0,0 +1,78 @@ +-- 64-bit GUID Migration: world database +-- Converts all spawn/entity GUID columns from INT UNSIGNED to BIGINT UNSIGNED. +-- Run AFTER characters migration or standalone; no cross-database FKs exist here. + +-- creature: primary key (AUTO_INCREMENT) +ALTER TABLE `creature` + MODIFY COLUMN `guid` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'Global Unique Identifier'; + +-- creature_addon: FK to creature.guid +ALTER TABLE `creature_addon` + MODIFY COLUMN `guid` BIGINT UNSIGNED NOT NULL DEFAULT '0'; + +-- creature_formations: both leader and member reference creature.guid +ALTER TABLE `creature_formations` + MODIFY COLUMN `leaderGUID` BIGINT UNSIGNED NOT NULL DEFAULT '0', + MODIFY COLUMN `memberGUID` BIGINT UNSIGNED NOT NULL DEFAULT '0'; + +-- creature_movement_override: references creature.guid as spawn ID +ALTER TABLE `creature_movement_override` + MODIFY COLUMN `SpawnId` BIGINT UNSIGNED NOT NULL DEFAULT '0'; + +-- game_event_creature: references creature.guid +ALTER TABLE `game_event_creature` + MODIFY COLUMN `guid` BIGINT UNSIGNED NOT NULL; + +-- game_event_gameobject: references gameobject.guid +ALTER TABLE `game_event_gameobject` + MODIFY COLUMN `guid` BIGINT UNSIGNED NOT NULL; + +-- game_event_model_equip: references creature.guid +ALTER TABLE `game_event_model_equip` + MODIFY COLUMN `guid` BIGINT UNSIGNED NOT NULL DEFAULT '0'; + +-- game_event_npc_vendor: references creature.guid +ALTER TABLE `game_event_npc_vendor` + MODIFY COLUMN `guid` BIGINT UNSIGNED NOT NULL DEFAULT '0'; + +-- game_event_npcflag: references creature.guid +ALTER TABLE `game_event_npcflag` + MODIFY COLUMN `guid` BIGINT UNSIGNED NOT NULL DEFAULT '0'; + +-- gameobject: primary key (AUTO_INCREMENT) +ALTER TABLE `gameobject` + MODIFY COLUMN `guid` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'Global Unique Identifier'; + +-- gameobject_addon: FK to gameobject.guid +ALTER TABLE `gameobject_addon` + MODIFY COLUMN `guid` BIGINT UNSIGNED NOT NULL DEFAULT '0'; + +-- gameobject_overrides: references gameobject.guid as spawn ID +ALTER TABLE `gameobject_overrides` + MODIFY COLUMN `spawnId` BIGINT UNSIGNED NOT NULL DEFAULT '0'; + +-- linked_respawn: both columns reference creature.guid / gameobject.guid +ALTER TABLE `linked_respawn` + MODIFY COLUMN `guid` BIGINT UNSIGNED NOT NULL COMMENT 'dependent creature', + MODIFY COLUMN `linkedGuid` BIGINT UNSIGNED NOT NULL COMMENT 'master creature'; + +-- pool_members: spawnId references creature.guid or gameobject.guid; +-- poolSpawnId references pool_template.entry (stays int, not guid) +ALTER TABLE `pool_members` + MODIFY COLUMN `spawnId` BIGINT UNSIGNED NOT NULL; + +-- spawn_group: references creature.guid or gameobject.guid +ALTER TABLE `spawn_group` + MODIFY COLUMN `spawnId` BIGINT UNSIGNED NOT NULL; + +-- transports: primary key guid (AUTO_INCREMENT, transport GUID) +ALTER TABLE `transports` + MODIFY COLUMN `guid` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT; + +-- vehicle_accessory: references creature.guid (the vehicle base) +ALTER TABLE `vehicle_accessory` + MODIFY COLUMN `guid` BIGINT UNSIGNED NOT NULL DEFAULT '0'; + +-- waypoint_data: id column is a creature spawn GUID (FK to creature.guid) +ALTER TABLE `waypoint_data` + MODIFY COLUMN `id` BIGINT UNSIGNED NOT NULL DEFAULT '0' COMMENT 'Creature GUID'; diff --git a/src/common/Utilities/StringConvert.h b/src/common/Utilities/StringConvert.h index 0d11dbb6667b8..e09445b507852 100644 --- a/src/common/Utilities/StringConvert.h +++ b/src/common/Utilities/StringConvert.h @@ -88,62 +88,6 @@ namespace Trinity::Impl::StringConvertImpl } }; -#ifdef TRINITY_NEED_CHARCONV_WORKAROUND - /* - If this is defined, std::from_chars will cause linkage errors for 64-bit types. - (This is a bug in clang-7.) - - If the clang requirement is bumped to >= clang-8, remove this ifdef block and its - associated check in cmake/compiler/clang/settings.cmake - */ - template <> - struct For - { - static Optional FromString(std::string_view str, int base = 10) - { - if (str.empty()) - return std::nullopt; - try - { - size_t n; - uint64 val = std::stoull(std::string(str), &n, base); - if (n != str.length()) - return std::nullopt; - return val; - } - catch (...) { return std::nullopt; } - } - - static std::string ToString(uint64 val) - { - return std::to_string(val); - } - }; - - template <> - struct For - { - static Optional FromString(std::string_view str, int base = 10) - { - try { - if (str.empty()) - return std::nullopt; - size_t n; - int64 val = std::stoll(std::string(str), &n, base); - if (n != str.length()) - return std::nullopt; - return val; - } - catch (...) { return std::nullopt; } - } - - static std::string ToString(int64 val) - { - return std::to_string(val); - } - }; -#endif - template <> struct For { diff --git a/src/server/authserver/Server/AuthSession.cpp b/src/server/authserver/Server/AuthSession.cpp index d2c110af7980d..8ce21fbd06149 100644 --- a/src/server/authserver/Server/AuthSession.cpp +++ b/src/server/authserver/Server/AuthSession.cpp @@ -295,8 +295,6 @@ void AuthSession::ReadHandler() packet.ReadCompleted(size); SetTimeout(); } - - AsyncRead(); } void AuthSession::SendPacket(ByteBuffer& packet) diff --git a/src/server/game/Accounts/AccountMgr.cpp b/src/server/game/Accounts/AccountMgr.cpp index a0b7bf1e23de7..98f9d87203a40 100644 --- a/src/server/game/Accounts/AccountMgr.cpp +++ b/src/server/game/Accounts/AccountMgr.cpp @@ -95,7 +95,7 @@ AccountOpResult AccountMgr::DeleteAccount(uint32 accountId) { do { - ObjectGuid guid(HighGuid::Player, (*result)[0].GetUInt32()); + ObjectGuid guid(HighGuid::Player, (*result)[0].GetUInt64()); // Kick if player is online if (Player* p = ObjectAccessor::FindConnectedPlayer(guid)) diff --git a/src/server/game/Achievements/AchievementMgr.cpp b/src/server/game/Achievements/AchievementMgr.cpp index 1fc0b8bf30403..007969f5ea16f 100644 --- a/src/server/game/Achievements/AchievementMgr.cpp +++ b/src/server/game/Achievements/AchievementMgr.cpp @@ -1,4 +1,4 @@ -/* +/* * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information * * This program is free software; you can redistribute it and/or modify it @@ -539,11 +539,11 @@ void AchievementMgr::DeleteFromDB(ObjectGuid guid) CharacterDatabaseTransaction trans = CharacterDatabase.BeginTransaction(); CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_ACHIEVEMENT); - stmt->setUInt32(0, guid.GetCounter()); + stmt->setUInt64(0, guid.GetCounter()); trans->Append(stmt); stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_ACHIEVEMENT_PROGRESS); - stmt->setUInt32(0, guid.GetCounter()); + stmt->setUInt64(0, guid.GetCounter()); trans->Append(stmt); CharacterDatabase.CommitTransaction(trans); @@ -560,11 +560,11 @@ void AchievementMgr::SaveToDB(CharacterDatabaseTransaction trans) CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_ACHIEVEMENT_BY_ACHIEVEMENT); stmt->setUInt16(0, completedAchievement.first); - stmt->setUInt32(1, GetPlayer()->GetGUID().GetCounter()); + stmt->setUInt64(1, GetPlayer()->GetGUID().GetCounter()); trans->Append(stmt); stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHAR_ACHIEVEMENT); - stmt->setUInt32(0, GetPlayer()->GetGUID().GetCounter()); + stmt->setUInt64(0, GetPlayer()->GetGUID().GetCounter()); stmt->setUInt16(1, completedAchievement.first); stmt->setUInt32(2, uint32(completedAchievement.second.date)); trans->Append(stmt); @@ -581,14 +581,14 @@ void AchievementMgr::SaveToDB(CharacterDatabaseTransaction trans) continue; CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_ACHIEVEMENT_PROGRESS_BY_CRITERIA); - stmt->setUInt32(0, GetPlayer()->GetGUID().GetCounter()); + stmt->setUInt64(0, GetPlayer()->GetGUID().GetCounter()); stmt->setUInt16(1, criteriaProgres.first); trans->Append(stmt); if (criteriaProgres.second.counter) { stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHAR_ACHIEVEMENT_PROGRESS); - stmt->setUInt32(0, GetPlayer()->GetGUID().GetCounter()); + stmt->setUInt64(0, GetPlayer()->GetGUID().GetCounter()); stmt->setUInt16(1, criteriaProgres.first); stmt->setUInt32(2, criteriaProgres.second.counter); stmt->setUInt32(3, uint32(criteriaProgres.second.date)); diff --git a/src/server/game/AuctionHouse/AuctionHouseMgr.cpp b/src/server/game/AuctionHouse/AuctionHouseMgr.cpp index 62a7ed1c61cfb..720a117eafa6e 100644 --- a/src/server/game/AuctionHouse/AuctionHouseMgr.cpp +++ b/src/server/game/AuctionHouse/AuctionHouseMgr.cpp @@ -165,7 +165,7 @@ void AuctionHouseMgr::SendAuctionWonMail(AuctionEntry* auction, CharacterDatabas // owner in `data` will set at mail receive and item extracting CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ITEM_OWNER); stmt->setUInt32(0, auction->bidder); - stmt->setUInt32(1, pItem->GetGUID().GetCounter()); + stmt->setUInt64(1, pItem->GetGUID().GetCounter()); trans->Append(stmt); if (bidder) @@ -332,7 +332,7 @@ void AuctionHouseMgr::LoadAuctionItems() { Field* fields = result->Fetch(); - ObjectGuid::LowType item_guid = fields[11].GetUInt32(); + ObjectGuid::LowType item_guid = fields[11].GetUInt64(); uint32 itemEntry = fields[12].GetUInt32(); ItemTemplate const* proto = sObjectMgr->GetItemTemplate(itemEntry); @@ -382,7 +382,7 @@ void AuctionHouseMgr::LoadAuctions() do { Field* fields = resultBidders->Fetch(); - biddersByAuction[fields[0].GetUInt32()].insert(ObjectGuid::Create(fields[1].GetUInt32())); + biddersByAuction[fields[0].GetUInt32()].insert(ObjectGuid::Create(fields[1].GetUInt64())); ++countBidders; } while (resultBidders->NextRow()); @@ -904,11 +904,11 @@ void AuctionEntry::SaveToDB(CharacterDatabaseTransaction trans) const CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_AUCTION); stmt->setUInt32(0, Id); stmt->setUInt8(1, houseId); - stmt->setUInt32(2, itemGUIDLow); - stmt->setUInt32(3, owner); + stmt->setUInt64(2, itemGUIDLow); + stmt->setUInt64(3, owner); stmt->setUInt32(4, buyout); stmt->setUInt32(5, uint32(expire_time)); - stmt->setUInt32(6, bidder); + stmt->setUInt64(6, bidder); stmt->setUInt32(7, bid); stmt->setUInt32(8, startbid); stmt->setUInt32(9, deposit); @@ -920,13 +920,13 @@ bool AuctionEntry::LoadFromDB(Field* fields) { Id = fields[0].GetUInt32(); houseId = fields[1].GetUInt8(); - itemGUIDLow = fields[2].GetUInt32(); + itemGUIDLow = fields[2].GetUInt64(); itemEntry = fields[3].GetUInt32(); itemCount = fields[4].GetUInt32(); - owner = fields[5].GetUInt32(); + owner = fields[5].GetUInt64(); buyout = fields[6].GetUInt32(); expire_time = fields[7].GetUInt32(); - bidder = fields[8].GetUInt32(); + bidder = fields[8].GetUInt64(); bid = fields[9].GetUInt32(); startbid = fields[10].GetUInt32(); deposit = fields[11].GetUInt32(); diff --git a/src/server/game/AuctionHouseBot/AuctionHouseBot.cpp b/src/server/game/AuctionHouseBot/AuctionHouseBot.cpp index ca89f687380fc..3bf4c831fac29 100644 --- a/src/server/game/AuctionHouseBot/AuctionHouseBot.cpp +++ b/src/server/game/AuctionHouseBot/AuctionHouseBot.cpp @@ -82,7 +82,7 @@ bool AuctionBotConfig::Initialize() do { Field* fields = result->Fetch(); - _AHBotCharacters.push_back(fields[0].GetUInt32()); + _AHBotCharacters.push_back(fields[0].GetUInt64()); ++count; } while (result->NextRow()); } diff --git a/src/server/game/AuctionHouseBot/AuctionHouseBot.h b/src/server/game/AuctionHouseBot/AuctionHouseBot.h index 00ec6e3c8a44c..1cf0fbe095df9 100644 --- a/src/server/game/AuctionHouseBot/AuctionHouseBot.h +++ b/src/server/game/AuctionHouseBot/AuctionHouseBot.h @@ -244,7 +244,7 @@ class TC_GAME_API AuctionBotConfig private: std::string _AHBotIncludes; std::string _AHBotExcludes; - std::vector _AHBotCharacters; + std::vector _AHBotCharacters; uint32 _itemsPerCycleBoost; uint32 _itemsPerCycleNormal; diff --git a/src/server/game/Battlegrounds/ArenaTeam.cpp b/src/server/game/Battlegrounds/ArenaTeam.cpp index 7bb47cc75e2c0..1e7d30e999f37 100644 --- a/src/server/game/Battlegrounds/ArenaTeam.cpp +++ b/src/server/game/Battlegrounds/ArenaTeam.cpp @@ -74,7 +74,7 @@ bool ArenaTeam::Create(ObjectGuid captainGuid, uint8 type, std::string const& te CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_ARENA_TEAM); stmt->setUInt32(0, TeamId); stmt->setString(1, TeamName); - stmt->setUInt32(2, captainLowGuid); + stmt->setUInt64(2, captainLowGuid); stmt->setUInt8(3, Type); stmt->setUInt16(4, Stats.Rating); stmt->setUInt32(5, BackgroundColor); @@ -134,7 +134,7 @@ bool ArenaTeam::AddMember(ObjectGuid playerGuid) // Try to get player's match maker rating from db and fall back to config setting if not found CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_MATCH_MAKER_RATING); - stmt->setUInt32(0, playerGuid.GetCounter()); + stmt->setUInt64(0, playerGuid.GetCounter()); stmt->setUInt8(1, GetSlot()); PreparedQueryResult result = CharacterDatabase.Query(stmt); @@ -166,7 +166,7 @@ bool ArenaTeam::AddMember(ObjectGuid playerGuid) // Save player's arena team membership to db stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_ARENA_TEAM_MEMBER); stmt->setUInt32(0, TeamId); - stmt->setUInt32(1, playerGuid.GetCounter()); + stmt->setUInt64(1, playerGuid.GetCounter()); stmt->setUInt16(2, personalRating); CharacterDatabase.Execute(stmt); @@ -195,7 +195,7 @@ bool ArenaTeam::LoadArenaTeamFromDB(QueryResult result) TeamId = fields[0].GetUInt32(); TeamName = fields[1].GetString(); - CaptainGuid = ObjectGuid(HighGuid::Player, fields[2].GetUInt32()); + CaptainGuid = ObjectGuid(HighGuid::Player, fields[2].GetUInt64()); Type = fields[3].GetUInt8(); BackgroundColor = fields[4].GetUInt32(); EmblemStyle = fields[5].GetUInt8(); @@ -234,7 +234,7 @@ bool ArenaTeam::LoadMembersFromDB(QueryResult result) break; ArenaTeamMember newMember; - newMember.Guid = ObjectGuid(HighGuid::Player, fields[1].GetUInt32()); + newMember.Guid = ObjectGuid(HighGuid::Player, fields[1].GetUInt64()); newMember.WeekGames = fields[2].GetUInt16(); newMember.WeekWins = fields[3].GetUInt16(); newMember.SeasonGames = fields[4].GetUInt16(); @@ -297,7 +297,7 @@ void ArenaTeam::SetCaptain(ObjectGuid guid) // Update database CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ARENA_TEAM_CAPTAIN); - stmt->setUInt32(0, guid.GetCounter()); + stmt->setUInt64(0, guid.GetCounter()); stmt->setUInt32(1, GetId()); CharacterDatabase.Execute(stmt); @@ -371,7 +371,7 @@ void ArenaTeam::DelMember(ObjectGuid guid, bool cleanDb) { CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ARENA_TEAM_MEMBER); stmt->setUInt32(0, GetId()); - stmt->setUInt32(1, guid.GetCounter()); + stmt->setUInt64(1, guid.GetCounter()); CharacterDatabase.Execute(stmt); } } @@ -950,11 +950,11 @@ void ArenaTeam::SaveToDB(bool forceMemberSave) stmt->setUInt16(3, itr->SeasonGames); stmt->setUInt16(4, itr->SeasonWins); stmt->setUInt32(5, GetId()); - stmt->setUInt32(6, itr->Guid.GetCounter()); + stmt->setUInt64(6, itr->Guid.GetCounter()); trans->Append(stmt); stmt = CharacterDatabase.GetPreparedStatement(CHAR_REP_CHARACTER_ARENA_STATS); - stmt->setUInt32(0, itr->Guid.GetCounter()); + stmt->setUInt64(0, itr->Guid.GetCounter()); stmt->setUInt8(1, GetSlot()); stmt->setUInt16(2, itr->MatchMakerRating); trans->Append(stmt); diff --git a/src/server/game/Battlegrounds/Battleground.cpp b/src/server/game/Battlegrounds/Battleground.cpp index 552650cd35d92..295cdf2dfdb7f 100644 --- a/src/server/game/Battlegrounds/Battleground.cpp +++ b/src/server/game/Battlegrounds/Battleground.cpp @@ -1,4 +1,4 @@ -/* +/* * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information * * This program is free software; you can redistribute it and/or modify it @@ -279,7 +279,7 @@ inline void Battleground::_ProcessOfflineQueue() (GetStatus() == STATUS_IN_PROGRESS || GetStatus() == STATUS_WAIT_JOIN)) { CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_DESERTER_TRACK); - stmt->setUInt32(0, itr->first.GetCounter()); + stmt->setUInt64(0, itr->first.GetCounter()); stmt->setUInt8(1, BG_DESERTION_TYPE_OFFLINE); CharacterDatabase.Execute(stmt); } @@ -762,7 +762,7 @@ void Battleground::EndBattleground(uint32 winner) BattlegroundScoreMap::const_iterator score = PlayerScores.find(player->GetGUID().GetCounter()); stmt->setUInt32(0, battlegroundId); - stmt->setUInt32(1, player->GetGUID().GetCounter()); + stmt->setUInt64(1, player->GetGUID().GetCounter()); stmt->setBool (2, team == winner); stmt->setUInt32(3, score->second->GetKillingBlows()); stmt->setUInt32(4, score->second->GetDeaths()); diff --git a/src/server/game/Battlegrounds/BattlegroundQueue.cpp b/src/server/game/Battlegrounds/BattlegroundQueue.cpp index 8ba8a15201237..5224f9c589725 100644 --- a/src/server/game/Battlegrounds/BattlegroundQueue.cpp +++ b/src/server/game/Battlegrounds/BattlegroundQueue.cpp @@ -1,4 +1,4 @@ -/* +/* * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information * * This program is free software; you can redistribute it and/or modify it @@ -1067,7 +1067,7 @@ bool BGQueueRemoveEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/) (bg->GetStatus() == STATUS_IN_PROGRESS || bg->GetStatus() == STATUS_WAIT_JOIN)) { CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_DESERTER_TRACK); - stmt->setUInt32(0, player->GetGUID().GetCounter()); + stmt->setUInt64(0, player->GetGUID().GetCounter()); stmt->setUInt8(1, BG_DESERTION_TYPE_NO_ENTER_BUTTON); CharacterDatabase.Execute(stmt); } diff --git a/src/server/game/Cache/CharacterCache.cpp b/src/server/game/Cache/CharacterCache.cpp index d47d72322bbe7..d0ec2de8dc195 100644 --- a/src/server/game/Cache/CharacterCache.cpp +++ b/src/server/game/Cache/CharacterCache.cpp @@ -82,7 +82,7 @@ void CharacterCache::LoadCharacterCacheStorage() do { Field* fields = result->Fetch(); - AddCharacterCacheEntry(ObjectGuid::Create(fields[0].GetUInt32()) /*guid*/, fields[2].GetUInt32() /*account*/, fields[1].GetString() /*name*/, + AddCharacterCacheEntry(ObjectGuid::Create(fields[0].GetUInt64()) /*guid*/, fields[2].GetUInt32() /*account*/, fields[1].GetString() /*name*/, fields[4].GetUInt8() /*gender*/, fields[3].GetUInt8() /*race*/, fields[5].GetUInt8() /*class*/, fields[6].GetUInt8() /*level*/); } while (result->NextRow()); diff --git a/src/server/game/Calendar/CalendarMgr.cpp b/src/server/game/Calendar/CalendarMgr.cpp index 3b10ccff017ea..35a9ee942dfa2 100644 --- a/src/server/game/Calendar/CalendarMgr.cpp +++ b/src/server/game/Calendar/CalendarMgr.cpp @@ -79,7 +79,7 @@ void CalendarMgr::LoadFromDB() Field* fields = result->Fetch(); uint64 eventID = fields[0].GetUInt64(); - ObjectGuid ownerGUID = ObjectGuid::Create(fields[1].GetUInt32()); + ObjectGuid ownerGUID = ObjectGuid::Create(fields[1].GetUInt64()); std::string title = fields[2].GetString(); std::string description = fields[3].GetString(); CalendarEventType type = CalendarEventType(fields[4].GetUInt8()); @@ -113,8 +113,8 @@ void CalendarMgr::LoadFromDB() uint64 inviteId = fields[0].GetUInt64(); uint64 eventId = fields[1].GetUInt64(); - ObjectGuid invitee = ObjectGuid::Create(fields[2].GetUInt32()); - ObjectGuid senderGUID = ObjectGuid::Create(fields[3].GetUInt32()); + ObjectGuid invitee = ObjectGuid::Create(fields[2].GetUInt64()); + ObjectGuid senderGUID = ObjectGuid::Create(fields[3].GetUInt64()); CalendarInviteStatus status = CalendarInviteStatus(fields[4].GetUInt8()); time_t responseTime = fields[5].GetUInt32(); CalendarModerationRank rank = CalendarModerationRank(fields[6].GetUInt8()); @@ -257,7 +257,7 @@ void CalendarMgr::UpdateEvent(CalendarEvent* calendarEvent) { CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_REP_CALENDAR_EVENT); stmt->setUInt64(0, calendarEvent->GetEventId()); - stmt->setUInt32(1, calendarEvent->GetOwnerGUID().GetCounter()); + stmt->setUInt64(1, calendarEvent->GetOwnerGUID().GetCounter()); stmt->setString(2, calendarEvent->GetTitle()); stmt->setString(3, calendarEvent->GetDescription()); stmt->setUInt8(4, calendarEvent->GetType()); @@ -273,8 +273,8 @@ void CalendarMgr::UpdateInvite(CalendarInvite* invite, CharacterDatabaseTransact CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_REP_CALENDAR_INVITE); stmt->setUInt64(0, invite->GetInviteId()); stmt->setUInt64(1, invite->GetEventId()); - stmt->setUInt32(2, invite->GetInviteeGUID().GetCounter()); - stmt->setUInt32(3, invite->GetSenderGUID().GetCounter()); + stmt->setUInt64(2, invite->GetInviteeGUID().GetCounter()); + stmt->setUInt64(3, invite->GetSenderGUID().GetCounter()); stmt->setUInt8(4, invite->GetStatus()); stmt->setUInt32(5, invite->GetResponseTime()); stmt->setUInt8(6, invite->GetRank()); diff --git a/src/server/game/DungeonFinding/LFGMgr.cpp b/src/server/game/DungeonFinding/LFGMgr.cpp index 3e4bc2c92e344..e1913266ba94d 100644 --- a/src/server/game/DungeonFinding/LFGMgr.cpp +++ b/src/server/game/DungeonFinding/LFGMgr.cpp @@ -74,7 +74,7 @@ void LFGMgr::_LoadFromDB(Field* fields, ObjectGuid guid) if (!guid.IsGroup()) return; - SetLeader(guid, ObjectGuid(HighGuid::Player, fields[0].GetUInt32())); + SetLeader(guid, ObjectGuid(HighGuid::Player, fields[0].GetUInt64())); uint32 dungeon = fields[17].GetUInt32(); uint8 state = fields[18].GetUInt8(); @@ -103,11 +103,11 @@ void LFGMgr::_SaveToDB(ObjectGuid guid, uint32 db_guid) CharacterDatabaseTransaction trans = CharacterDatabase.BeginTransaction(); CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_LFG_DATA); - stmt->setUInt32(0, db_guid); + stmt->setUInt64(0, db_guid); trans->Append(stmt); stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_LFG_DATA); - stmt->setUInt32(0, db_guid); + stmt->setUInt64(0, db_guid); stmt->setUInt32(1, GetDungeon(guid)); stmt->setUInt32(2, GetState(guid)); trans->Append(stmt); diff --git a/src/server/game/Entities/Corpse/Corpse.cpp b/src/server/game/Entities/Corpse/Corpse.cpp index 588e69302ece8..e7bc75ee73838 100644 --- a/src/server/game/Entities/Corpse/Corpse.cpp +++ b/src/server/game/Entities/Corpse/Corpse.cpp @@ -100,7 +100,7 @@ void Corpse::SaveToDB() uint16 index = 0; CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CORPSE); - stmt->setUInt32(index++, GetOwnerGUID().GetCounter()); // guid + stmt->setUInt64(index++, GetOwnerGUID().GetCounter()); // guid stmt->setFloat (index++, GetPositionX()); // posX stmt->setFloat (index++, GetPositionY()); // posY stmt->setFloat (index++, GetPositionZ()); // posZ @@ -130,7 +130,7 @@ void Corpse::DeleteFromDB(CharacterDatabaseTransaction trans) void Corpse::DeleteFromDB(ObjectGuid const& ownerGuid, CharacterDatabaseTransaction trans) { CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CORPSE); - stmt->setUInt32(0, ownerGuid.GetCounter()); + stmt->setUInt64(0, ownerGuid.GetCounter()); CharacterDatabase.ExecuteOrAppend(trans, stmt); } @@ -153,7 +153,7 @@ bool Corpse::LoadCorpseFromDB(ObjectGuid::LowType guid, Field* fields) // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 // SELECT posX, posY, posZ, orientation, mapId, displayId, itemCache, bytes1, bytes2, guildId, flags, dynFlags, time, corpseType, instanceId, phaseMask, guid FROM corpse WHERE mapId = ? AND instanceId = ? - ObjectGuid::LowType ownerGuid = fields[16].GetUInt32(); + ObjectGuid::LowType ownerGuid = fields[16].GetUInt64(); float posX = fields[0].GetFloat(); float posY = fields[1].GetFloat(); float posZ = fields[2].GetFloat(); diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp index fa44b3deac50c..bda0083f4a3e8 100644 --- a/src/server/game/Entities/Creature/Creature.cpp +++ b/src/server/game/Entities/Creature/Creature.cpp @@ -1,4 +1,4 @@ -/* +/* * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information * * This program is free software; you can redistribute it and/or modify it @@ -1384,14 +1384,14 @@ void Creature::SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask) WorldDatabaseTransaction trans = WorldDatabase.BeginTransaction(); WorldDatabasePreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_DEL_CREATURE); - stmt->setUInt32(0, m_spawnId); + stmt->setUInt64(0, m_spawnId); trans->Append(stmt); uint8 index = 0; stmt = WorldDatabase.GetPreparedStatement(WORLD_INS_CREATURE); - stmt->setUInt32(index++, m_spawnId); + stmt->setUInt64(index++, m_spawnId); stmt->setUInt32(index++, GetEntry()); stmt->setUInt16(index++, uint16(mapid)); stmt->setUInt8(index++, spawnMask); @@ -1798,43 +1798,43 @@ bool Creature::hasInvolvedQuest(uint32 quest_id) const // ... and the database WorldDatabasePreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_DEL_CREATURE); - stmt->setUInt32(0, spawnId); + stmt->setUInt64(0, spawnId); trans->Append(stmt); stmt = WorldDatabase.GetPreparedStatement(WORLD_DEL_SPAWNGROUP_MEMBER); stmt->setUInt8(0, uint8(SPAWN_TYPE_CREATURE)); - stmt->setUInt32(1, spawnId); + stmt->setUInt64(1, spawnId); trans->Append(stmt); stmt = WorldDatabase.GetPreparedStatement(WORLD_DEL_CREATURE_ADDON); - stmt->setUInt32(0, spawnId); + stmt->setUInt64(0, spawnId); trans->Append(stmt); stmt = WorldDatabase.GetPreparedStatement(WORLD_DEL_GAME_EVENT_CREATURE); - stmt->setUInt32(0, spawnId); + stmt->setUInt64(0, spawnId); trans->Append(stmt); stmt = WorldDatabase.GetPreparedStatement(WORLD_DEL_GAME_EVENT_MODEL_EQUIP); - stmt->setUInt32(0, spawnId); + stmt->setUInt64(0, spawnId); trans->Append(stmt); stmt = WorldDatabase.GetPreparedStatement(WORLD_DEL_LINKED_RESPAWN); - stmt->setUInt32(0, spawnId); + stmt->setUInt64(0, spawnId); stmt->setUInt32(1, LINKED_RESPAWN_CREATURE_TO_CREATURE); trans->Append(stmt); stmt = WorldDatabase.GetPreparedStatement(WORLD_DEL_LINKED_RESPAWN); - stmt->setUInt32(0, spawnId); + stmt->setUInt64(0, spawnId); stmt->setUInt32(1, LINKED_RESPAWN_CREATURE_TO_GO); trans->Append(stmt); stmt = WorldDatabase.GetPreparedStatement(WORLD_DEL_LINKED_RESPAWN_MASTER); - stmt->setUInt32(0, spawnId); + stmt->setUInt64(0, spawnId); stmt->setUInt32(1, LINKED_RESPAWN_CREATURE_TO_CREATURE); trans->Append(stmt); stmt = WorldDatabase.GetPreparedStatement(WORLD_DEL_LINKED_RESPAWN_MASTER); - stmt->setUInt32(0, spawnId); + stmt->setUInt64(0, spawnId); stmt->setUInt32(1, LINKED_RESPAWN_GO_TO_CREATURE); trans->Append(stmt); diff --git a/src/server/game/Entities/Creature/CreatureGroups.cpp b/src/server/game/Entities/Creature/CreatureGroups.cpp index e419e26459791..ef2143851e8fd 100644 --- a/src/server/game/Entities/Creature/CreatureGroups.cpp +++ b/src/server/game/Entities/Creature/CreatureGroups.cpp @@ -113,8 +113,8 @@ void FormationMgr::LoadCreatureFormations() //Load group member data FormationInfo member; - member.LeaderSpawnId = fields[0].GetUInt32(); - ObjectGuid::LowType memberSpawnId = fields[1].GetUInt32(); + member.LeaderSpawnId = fields[0].GetUInt64(); + ObjectGuid::LowType memberSpawnId = fields[1].GetUInt64(); member.FollowDist = 0.f; member.FollowAngle = 0.f; diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp index 62e9dc02ca5be..297c735496153 100644 --- a/src/server/game/Entities/GameObject/GameObject.cpp +++ b/src/server/game/Entities/GameObject/GameObject.cpp @@ -1,4 +1,4 @@ -/* +/* * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information * * This program is free software; you can redistribute it and/or modify it @@ -1059,11 +1059,11 @@ void GameObject::SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask) uint8 index = 0; WorldDatabasePreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_DEL_GAMEOBJECT); - stmt->setUInt32(0, m_spawnId); + stmt->setUInt64(0, m_spawnId); trans->Append(stmt); stmt = WorldDatabase.GetPreparedStatement(WORLD_INS_GAMEOBJECT); - stmt->setUInt32(index++, m_spawnId); + stmt->setUInt64(index++, m_spawnId); stmt->setUInt32(index++, GetEntry()); stmt->setUInt16(index++, uint16(mapid)); stmt->setUInt8(index++, spawnMask); @@ -1183,40 +1183,40 @@ bool GameObject::LoadFromDB(ObjectGuid::LowType spawnId, Map* map, bool addToMap // ... and the database WorldDatabasePreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_DEL_GAMEOBJECT); - stmt->setUInt32(0, spawnId); + stmt->setUInt64(0, spawnId); trans->Append(stmt); stmt = WorldDatabase.GetPreparedStatement(WORLD_DEL_SPAWNGROUP_MEMBER); stmt->setUInt8(0, uint8(SPAWN_TYPE_GAMEOBJECT)); - stmt->setUInt32(1, spawnId); + stmt->setUInt64(1, spawnId); trans->Append(stmt); stmt = WorldDatabase.GetPreparedStatement(WORLD_DEL_EVENT_GAMEOBJECT); - stmt->setUInt32(0, spawnId); + stmt->setUInt64(0, spawnId); trans->Append(stmt); stmt = WorldDatabase.GetPreparedStatement(WORLD_DEL_LINKED_RESPAWN); - stmt->setUInt32(0, spawnId); + stmt->setUInt64(0, spawnId); stmt->setUInt32(1, LINKED_RESPAWN_GO_TO_GO); trans->Append(stmt); stmt = WorldDatabase.GetPreparedStatement(WORLD_DEL_LINKED_RESPAWN); - stmt->setUInt32(0, spawnId); + stmt->setUInt64(0, spawnId); stmt->setUInt32(1, LINKED_RESPAWN_GO_TO_CREATURE); trans->Append(stmt); stmt = WorldDatabase.GetPreparedStatement(WORLD_DEL_LINKED_RESPAWN_MASTER); - stmt->setUInt32(0, spawnId); + stmt->setUInt64(0, spawnId); stmt->setUInt32(1, LINKED_RESPAWN_GO_TO_GO); trans->Append(stmt); stmt = WorldDatabase.GetPreparedStatement(WORLD_DEL_LINKED_RESPAWN_MASTER); - stmt->setUInt32(0, spawnId); + stmt->setUInt64(0, spawnId); stmt->setUInt32(1, LINKED_RESPAWN_CREATURE_TO_GO); trans->Append(stmt); stmt = WorldDatabase.GetPreparedStatement(WORLD_DEL_GAMEOBJECT_ADDON); - stmt->setUInt32(0, spawnId); + stmt->setUInt64(0, spawnId); trans->Append(stmt); WorldDatabase.CommitTransaction(trans); diff --git a/src/server/game/Entities/Item/Item.cpp b/src/server/game/Entities/Item/Item.cpp index 49363f6b1d0e1..40e6bbe4fa006 100644 --- a/src/server/game/Entities/Item/Item.cpp +++ b/src/server/game/Entities/Item/Item.cpp @@ -336,9 +336,9 @@ void Item::SaveToDB(CharacterDatabaseTransaction trans) uint8 index = 0; CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(uState == ITEM_NEW ? CHAR_REP_ITEM_INSTANCE : CHAR_UPD_ITEM_INSTANCE); stmt->setUInt32( index, GetEntry()); - stmt->setUInt32(++index, GetOwnerGUID().GetCounter()); - stmt->setUInt32(++index, GetGuidValue(ITEM_FIELD_CREATOR).GetCounter()); - stmt->setUInt32(++index, GetGuidValue(ITEM_FIELD_GIFTCREATOR).GetCounter()); + stmt->setUInt64(++index, GetOwnerGUID().GetCounter()); + stmt->setUInt64(++index, GetGuidValue(ITEM_FIELD_CREATOR).GetCounter()); + stmt->setUInt64(++index, GetGuidValue(ITEM_FIELD_GIFTCREATOR).GetCounter()); stmt->setUInt32(++index, GetCount()); stmt->setUInt32(++index, GetUInt32Value(ITEM_FIELD_DURATION)); @@ -362,15 +362,15 @@ void Item::SaveToDB(CharacterDatabaseTransaction trans) stmt->setUInt16(++index, GetUInt32Value(ITEM_FIELD_DURABILITY)); stmt->setUInt32(++index, GetUInt32Value(ITEM_FIELD_CREATE_PLAYED_TIME)); stmt->setString(++index, m_text); - stmt->setUInt32(++index, guid); + stmt->setUInt64(++index, guid); trans->Append(stmt); if ((uState == ITEM_CHANGED) && IsWrapped()) { stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_GIFT_OWNER); - stmt->setUInt32(0, GetOwnerGUID().GetCounter()); - stmt->setUInt32(1, guid); + stmt->setUInt64(0, GetOwnerGUID().GetCounter()); + stmt->setUInt64(1, guid); trans->Append(stmt); } break; @@ -378,13 +378,13 @@ void Item::SaveToDB(CharacterDatabaseTransaction trans) case ITEM_REMOVED: { CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_INSTANCE); - stmt->setUInt32(0, guid); + stmt->setUInt64(0, guid); trans->Append(stmt); if (IsWrapped()) { stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_GIFT); - stmt->setUInt32(0, guid); + stmt->setUInt64(0, guid); trans->Append(stmt); } @@ -433,8 +433,8 @@ bool Item::LoadFromDB(ObjectGuid::LowType guid, ObjectGuid owner_guid, Field* fi SetOwnerGUID(owner_guid); bool need_save = false; // need explicit save data at load fixes - SetGuidValue(ITEM_FIELD_CREATOR, ObjectGuid(HighGuid::Player, fields[0].GetUInt32())); - SetGuidValue(ITEM_FIELD_GIFTCREATOR, ObjectGuid(HighGuid::Player, fields[1].GetUInt32())); + SetGuidValue(ITEM_FIELD_CREATOR, ObjectGuid(HighGuid::Player, fields[0].GetUInt64())); + SetGuidValue(ITEM_FIELD_GIFTCREATOR, ObjectGuid(HighGuid::Player, fields[1].GetUInt64())); SetCount(fields[2].GetUInt32()); uint32 duration = fields[3].GetUInt32(); @@ -495,7 +495,7 @@ bool Item::LoadFromDB(ObjectGuid::LowType guid, ObjectGuid owner_guid, Field* fi stmt->setUInt32(0, GetUInt32Value(ITEM_FIELD_DURATION)); stmt->setUInt32(1, GetUInt32Value(ITEM_FIELD_FLAGS)); stmt->setUInt32(2, GetUInt32Value(ITEM_FIELD_DURABILITY)); - stmt->setUInt32(3, guid); + stmt->setUInt64(3, guid); CharacterDatabase.Execute(stmt); } @@ -506,7 +506,7 @@ bool Item::LoadFromDB(ObjectGuid::LowType guid, ObjectGuid owner_guid, Field* fi void Item::DeleteFromDB(CharacterDatabaseTransaction trans, ObjectGuid::LowType itemGuid) { CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_INSTANCE); - stmt->setUInt32(0, itemGuid); + stmt->setUInt64(0, itemGuid); trans->Append(stmt); } @@ -523,7 +523,7 @@ void Item::DeleteFromDB(CharacterDatabaseTransaction trans) void Item::DeleteFromInventoryDB(CharacterDatabaseTransaction trans, ObjectGuid::LowType itemGuid) { CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_INVENTORY_BY_ITEM); - stmt->setUInt32(0, itemGuid); + stmt->setUInt64(0, itemGuid); trans->Append(stmt); } @@ -1134,11 +1134,11 @@ void Item::SaveRefundDataToDB() CharacterDatabaseTransaction trans = CharacterDatabase.BeginTransaction(); CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_REFUND_INSTANCE); - stmt->setUInt32(0, GetGUID().GetCounter()); + stmt->setUInt64(0, GetGUID().GetCounter()); trans->Append(stmt); stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_ITEM_REFUND_INSTANCE); - stmt->setUInt32(0, GetGUID().GetCounter()); + stmt->setUInt64(0, GetGUID().GetCounter()); stmt->setUInt32(1, GetRefundRecipient()); stmt->setUInt32(2, GetPaidMoney()); stmt->setUInt16(3, uint16(GetPaidExtendedCost())); @@ -1152,7 +1152,7 @@ void Item::DeleteRefundDataFromDB(CharacterDatabaseTransaction* trans) if (trans) { CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_REFUND_INSTANCE); - stmt->setUInt32(0, GetGUID().GetCounter()); + stmt->setUInt64(0, GetGUID().GetCounter()); (*trans)->Append(stmt); } @@ -1231,7 +1231,7 @@ void Item::ClearSoulboundTradeable(Player* currentOwner) allowedGUIDs.clear(); SetState(ITEM_CHANGED, currentOwner); CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_BOP_TRADE); - stmt->setUInt32(0, GetGUID().GetCounter()); + stmt->setUInt64(0, GetGUID().GetCounter()); CharacterDatabase.Execute(stmt); } diff --git a/src/server/game/Entities/Object/ObjectGuid.h b/src/server/game/Entities/Object/ObjectGuid.h index 440972213335c..5f47c742ea48c 100644 --- a/src/server/game/Entities/Object/ObjectGuid.h +++ b/src/server/game/Entities/Object/ObjectGuid.h @@ -131,7 +131,7 @@ class TC_GAME_API ObjectGuid public: static ObjectGuid const Empty; - typedef uint32 LowType; + typedef uint64 LowType; template static typename std::enable_if::Global, ObjectGuid>::type Create(LowType counter) { return Global(type, counter); } @@ -159,14 +159,14 @@ class TC_GAME_API ObjectGuid { return HasEntry() ? LowType(_guid & UI64LIT(0x0000000000FFFFFF)) - : LowType(_guid & UI64LIT(0x00000000FFFFFFFF)); + : LowType(_guid & UI64LIT(0x0000FFFFFFFFFFFF)); } static LowType GetMaxCounter(HighGuid high) { return HasEntry(high) ? LowType(0x00FFFFFF) - : LowType(0xFFFFFFFF); + : LowType(UI64LIT(0x0000FFFFFFFFFFFF)); } ObjectGuid::LowType GetMaxCounter() const { return GetMaxCounter(GetHigh()); } @@ -251,8 +251,6 @@ class TC_GAME_API ObjectGuid static ObjectGuid MapSpecific(HighGuid type, uint32 entry, LowType counter); explicit ObjectGuid(uint32 const&) = delete; // no implementation, used to catch wrong type assignment - ObjectGuid(HighGuid, uint32, uint64 counter) = delete; // no implementation, used to catch wrong type assignment - ObjectGuid(HighGuid, uint64 counter) = delete; // no implementation, used to catch wrong type assignment uint64 _guid; }; diff --git a/src/server/game/Entities/Pet/Pet.cpp b/src/server/game/Entities/Pet/Pet.cpp index 3ede7366b9b7c..934474569df80 100644 --- a/src/server/game/Entities/Pet/Pet.cpp +++ b/src/server/game/Entities/Pet/Pet.cpp @@ -164,7 +164,7 @@ class PetLoadQueryHolder : public CharacterDatabaseQueryHolder CharacterDatabasePreparedStatement* stmt; stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PET_DECLINED_NAME); - stmt->setUInt32(0, ownerGuid); + stmt->setUInt64(0, ownerGuid); stmt->setUInt32(1, petNumber); SetPreparedQuery(DECLINED_NAMES, stmt); @@ -493,7 +493,7 @@ void Pet::SavePetToDB(PetSaveMode mode) if (getPetType() == HUNTER_PET && (mode == PET_SAVE_AS_CURRENT || mode > PET_SAVE_LAST_STABLE_SLOT)) { stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_PET_BY_SLOT); - stmt->setUInt32(0, ownerLowGUID); + stmt->setUInt64(0, ownerLowGUID); stmt->setUInt8(1, uint8(PET_SAVE_AS_CURRENT)); stmt->setUInt8(2, uint8(PET_SAVE_LAST_STABLE_SLOT)); trans->Append(stmt); @@ -508,7 +508,7 @@ void Pet::SavePetToDB(PetSaveMode mode) stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_PET); stmt->setUInt32(0, m_charmInfo->GetPetNumber()); stmt->setUInt32(1, GetEntry()); - stmt->setUInt32(2, ownerLowGUID); + stmt->setUInt64(2, ownerLowGUID); stmt->setUInt32(3, GetNativeDisplayId()); stmt->setUInt8(4, GetLevel()); stmt->setUInt32(5, GetUInt32Value(UNIT_FIELD_PETEXPERIENCE)); @@ -559,23 +559,23 @@ void Pet::DeleteFromDB(ObjectGuid::LowType guidlow) CharacterDatabaseTransaction trans = CharacterDatabase.BeginTransaction(); CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_PET_BY_ID); - stmt->setUInt32(0, guidlow); + stmt->setUInt64(0, guidlow); trans->Append(stmt); stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_PET_DECLINEDNAME); - stmt->setUInt32(0, guidlow); + stmt->setUInt64(0, guidlow); trans->Append(stmt); stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_PET_AURAS); - stmt->setUInt32(0, guidlow); + stmt->setUInt64(0, guidlow); trans->Append(stmt); stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_PET_SPELLS); - stmt->setUInt32(0, guidlow); + stmt->setUInt64(0, guidlow); trans->Append(stmt); stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_PET_SPELL_COOLDOWNS); - stmt->setUInt32(0, guidlow); + stmt->setUInt64(0, guidlow); trans->Append(stmt); CharacterDatabase.CommitTransaction(trans); diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index f26b01dc58a7d..b4952f15f1c47 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -1365,7 +1365,7 @@ bool Player::BuildEnumData(PreparedQueryResult result, WorldPacket* data) Field* fields = result->Fetch(); - ObjectGuid::LowType guid = fields[0].GetUInt32(); + ObjectGuid::LowType guid = fields[0].GetUInt64(); uint8 plrRace = fields[2].GetUInt8(); uint8 plrClass = fields[3].GetUInt8(); uint8 gender = fields[4].GetUInt8(); @@ -1407,7 +1407,7 @@ bool Player::BuildEnumData(PreparedQueryResult result, WorldPacket* data) { CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ADD_AT_LOGIN_FLAG); stmt->setUInt16(0, uint16(AT_LOGIN_CUSTOMIZE)); - stmt->setUInt32(1, guid); + stmt->setUInt64(1, guid); CharacterDatabase.Execute(stmt); atLoginFlags |= AT_LOGIN_CUSTOMIZE; } @@ -3992,7 +3992,7 @@ void Player::DeleteFromDB(ObjectGuid playerguid, uint32 accountId, bool updateRe // the player was uninvited already on logout so just remove from group CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_GROUP_MEMBER); - stmt->setUInt32(0, guid); + stmt->setUInt64(0, guid); PreparedQueryResult resultGroup = CharacterDatabase.Query(stmt); if (resultGroup) @@ -4008,7 +4008,7 @@ void Player::DeleteFromDB(ObjectGuid playerguid, uint32 accountId, bool updateRe case CHAR_DELETE_REMOVE: { stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_COD_ITEM_MAIL); - stmt->setUInt32(0, guid); + stmt->setUInt64(0, guid); PreparedQueryResult resultMail = CharacterDatabase.Query(stmt); if (resultMail) @@ -4016,7 +4016,7 @@ void Player::DeleteFromDB(ObjectGuid playerguid, uint32 accountId, bool updateRe std::unordered_map> itemsByMail; stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_MAILITEMS); - stmt->setUInt32(0, guid); + stmt->setUInt64(0, guid); PreparedQueryResult resultItems = CharacterDatabase.Query(stmt); if (resultItems) @@ -4090,27 +4090,27 @@ void Player::DeleteFromDB(ObjectGuid playerguid, uint32 accountId, bool updateRe // Unsummon and delete for pets in world is not required: player deleted from CLI or character list with not loaded pet. // NOW we can finally clear other DB data related to character stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_PET_IDS); - stmt->setUInt32(0, guid); + stmt->setUInt64(0, guid); PreparedQueryResult resultPets = CharacterDatabase.Query(stmt); if (resultPets) { do { - ObjectGuid::LowType petguidlow = (*resultPets)[0].GetUInt32(); + ObjectGuid::LowType petguidlow = (*resultPets)[0].GetUInt64(); Pet::DeleteFromDB(petguidlow); } while (resultPets->NextRow()); } // Delete char from social list of online chars stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_SOCIAL); - stmt->setUInt32(0, guid); + stmt->setUInt64(0, guid); if (PreparedQueryResult resultFriends = CharacterDatabase.Query(stmt)) { do { - if (Player* playerFriend = ObjectAccessor::FindPlayer(ObjectGuid(HighGuid::Player, 0, (*resultFriends)[0].GetUInt32()))) + if (Player* playerFriend = ObjectAccessor::FindPlayer(ObjectGuid(HighGuid::Player, 0, (*resultFriends)[0].GetUInt64()))) { playerFriend->GetSocial()->RemoveFromSocialList(playerguid, SOCIAL_FLAG_ALL); sSocialMgr->SendFriendStatus(playerFriend, FRIEND_REMOVED, playerguid); @@ -4119,169 +4119,169 @@ void Player::DeleteFromDB(ObjectGuid playerguid, uint32 accountId, bool updateRe } stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHARACTER); - stmt->setUInt32(0, guid); + stmt->setUInt64(0, guid); trans->Append(stmt); stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_PLAYER_ACCOUNT_DATA); - stmt->setUInt32(0, guid); + stmt->setUInt64(0, guid); trans->Append(stmt); stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_DECLINED_NAME); - stmt->setUInt32(0, guid); + stmt->setUInt64(0, guid); trans->Append(stmt); stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_ACTION); - stmt->setUInt32(0, guid); + stmt->setUInt64(0, guid); trans->Append(stmt); stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHARACTER_ARENA_STATS); - stmt->setUInt32(0, guid); + stmt->setUInt64(0, guid); trans->Append(stmt); stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_AURA); - stmt->setUInt32(0, guid); + stmt->setUInt64(0, guid); trans->Append(stmt); stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_PLAYER_BGDATA); - stmt->setUInt32(0, guid); + stmt->setUInt64(0, guid); trans->Append(stmt); stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_BATTLEGROUND_RANDOM); - stmt->setUInt32(0, guid); + stmt->setUInt64(0, guid); trans->Append(stmt); stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_GIFT); - stmt->setUInt32(0, guid); + stmt->setUInt64(0, guid); trans->Append(stmt); stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_PLAYER_HOMEBIND); - stmt->setUInt32(0, guid); + stmt->setUInt64(0, guid); trans->Append(stmt); stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_INSTANCE); - stmt->setUInt32(0, guid); + stmt->setUInt64(0, guid); trans->Append(stmt); stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_INVENTORY); - stmt->setUInt32(0, guid); + stmt->setUInt64(0, guid); trans->Append(stmt); stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_QUESTSTATUS); - stmt->setUInt32(0, guid); + stmt->setUInt64(0, guid); trans->Append(stmt); stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_QUESTSTATUS_REWARDED); - stmt->setUInt32(0, guid); + stmt->setUInt64(0, guid); trans->Append(stmt); stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_REPUTATION); - stmt->setUInt32(0, guid); + stmt->setUInt64(0, guid); trans->Append(stmt); stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_SPELL); - stmt->setUInt32(0, guid); + stmt->setUInt64(0, guid); trans->Append(stmt); stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_SPELL_COOLDOWNS); - stmt->setUInt32(0, guid); + stmt->setUInt64(0, guid); trans->Append(stmt); if (sWorld->getBoolConfig(CONFIG_DELETE_CHARACTER_TICKET_TRACE)) { stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_PLAYER_GM_TICKETS_ON_CHAR_DELETION); - stmt->setUInt32(0, guid); + stmt->setUInt64(0, guid); trans->Append(stmt); } else { stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_PLAYER_GM_TICKETS); - stmt->setUInt32(0, guid); + stmt->setUInt64(0, guid); trans->Append(stmt); } stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_INSTANCE_BY_OWNER); - stmt->setUInt32(0, guid); + stmt->setUInt64(0, guid); trans->Append(stmt); stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_SOCIAL_BY_FRIEND); - stmt->setUInt32(0, guid); + stmt->setUInt64(0, guid); trans->Append(stmt); stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_SOCIAL_BY_GUID); - stmt->setUInt32(0, guid); + stmt->setUInt64(0, guid); trans->Append(stmt); stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_MAIL); - stmt->setUInt32(0, guid); + stmt->setUInt64(0, guid); trans->Append(stmt); stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_MAIL_ITEMS); - stmt->setUInt32(0, guid); + stmt->setUInt64(0, guid); trans->Append(stmt); stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_PET_BY_OWNER); - stmt->setUInt32(0, guid); + stmt->setUInt64(0, guid); trans->Append(stmt); stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_PET_DECLINEDNAME_BY_OWNER); - stmt->setUInt32(0, guid); + stmt->setUInt64(0, guid); trans->Append(stmt); stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_ACHIEVEMENTS); - stmt->setUInt32(0, guid); + stmt->setUInt64(0, guid); trans->Append(stmt); stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_ACHIEVEMENT_PROGRESS); - stmt->setUInt32(0, guid); + stmt->setUInt64(0, guid); trans->Append(stmt); stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_EQUIPMENTSETS); - stmt->setUInt32(0, guid); + stmt->setUInt64(0, guid); trans->Append(stmt); stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_GUILD_EVENTLOG_BY_PLAYER); - stmt->setUInt32(0, guid); - stmt->setUInt32(1, guid); + stmt->setUInt64(0, guid); + stmt->setUInt64(1, guid); trans->Append(stmt); stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_GUILD_BANK_EVENTLOG_BY_PLAYER); - stmt->setUInt32(0, guid); + stmt->setUInt64(0, guid); trans->Append(stmt); stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_GLYPHS); - stmt->setUInt32(0, guid); + stmt->setUInt64(0, guid); trans->Append(stmt); stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHARACTER_QUESTSTATUS_DAILY); - stmt->setUInt32(0, guid); + stmt->setUInt64(0, guid); trans->Append(stmt); stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHARACTER_QUESTSTATUS_WEEKLY); - stmt->setUInt32(0, guid); + stmt->setUInt64(0, guid); trans->Append(stmt); stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHARACTER_QUESTSTATUS_MONTHLY); - stmt->setUInt32(0, guid); + stmt->setUInt64(0, guid); trans->Append(stmt); stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHARACTER_QUESTSTATUS_SEASONAL); - stmt->setUInt32(0, guid); + stmt->setUInt64(0, guid); trans->Append(stmt); stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_TALENT); - stmt->setUInt32(0, guid); + stmt->setUInt64(0, guid); trans->Append(stmt); stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_SKILLS); - stmt->setUInt32(0, guid); + stmt->setUInt64(0, guid); trans->Append(stmt); stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_STATS); - stmt->setUInt32(0, guid); + stmt->setUInt64(0, guid); trans->Append(stmt); stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_FISHINGSTEPS); - stmt->setUInt32(0, guid); + stmt->setUInt64(0, guid); trans->Append(stmt); Corpse::DeleteFromDB(playerguid, trans); @@ -4291,7 +4291,7 @@ void Player::DeleteFromDB(ObjectGuid playerguid, uint32 accountId, bool updateRe case CHAR_DELETE_UNLINK: { stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_DELETE_INFO); - stmt->setUInt32(0, guid); + stmt->setUInt64(0, guid); trans->Append(stmt); break; } @@ -4347,7 +4347,7 @@ void Player::DeleteOldCharacters(uint32 keepDays) do { Field* fields = result->Fetch(); - Player::DeleteFromDB(ObjectGuid(HighGuid::Player, fields[0].GetUInt32()), fields[1].GetUInt32(), true, true); + Player::DeleteFromDB(ObjectGuid(HighGuid::Player, fields[0].GetUInt64()), fields[1].GetUInt32(), true, true); } while (result->NextRow()); } @@ -6774,7 +6774,7 @@ void Player::ModifyHonorPoints(int32 value, CharacterDatabaseTransaction trans) { CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHAR_HONOR_POINTS); stmt->setUInt32(0, newValue); - stmt->setUInt32(1, GetGUID().GetCounter()); + stmt->setUInt64(1, GetGUID().GetCounter()); trans->Append(stmt); } } @@ -6790,7 +6790,7 @@ void Player::ModifyArenaPoints(int32 value, CharacterDatabaseTransaction trans) { CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHAR_ARENA_POINTS); stmt->setUInt32(0, newValue); - stmt->setUInt32(1, GetGUID().GetCounter()); + stmt->setUInt64(1, GetGUID().GetCounter()); trans->Append(stmt); } } @@ -6810,7 +6810,7 @@ uint32 Player::GetZoneIdFromDB(ObjectGuid guid) { ObjectGuid::LowType guidLow = guid.GetCounter(); CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_ZONE); - stmt->setUInt32(0, guidLow); + stmt->setUInt64(0, guidLow); PreparedQueryResult result = CharacterDatabase.Query(stmt); if (!result) @@ -6822,7 +6822,7 @@ uint32 Player::GetZoneIdFromDB(ObjectGuid guid) { // stored zone is zero, use generic and slow zone detection stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_POSITION_XYZ); - stmt->setUInt32(0, guidLow); + stmt->setUInt64(0, guidLow); result = CharacterDatabase.Query(stmt); if (!result) @@ -6843,7 +6843,7 @@ uint32 Player::GetZoneIdFromDB(ObjectGuid guid) stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ZONE); stmt->setUInt16(0, uint16(zone)); - stmt->setUInt32(1, guidLow); + stmt->setUInt64(1, guidLow); CharacterDatabase.Execute(stmt); } @@ -11779,7 +11779,7 @@ Item* Player::StoreNewItem(ItemPosCountVec const& dest, uint32 item, bool update ss << ' ' << itr->GetCounter(); CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_ITEM_BOP_TRADE); - stmt->setUInt32(0, pItem->GetGUID().GetCounter()); + stmt->setUInt64(0, pItem->GetGUID().GetCounter()); stmt->setString(1, ss.str()); CharacterDatabase.Execute(stmt); } @@ -12256,7 +12256,7 @@ void Player::DestroyItem(uint8 bag, uint8 slot, bool update) { CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_GIFT); - stmt->setUInt32(0, pItem->GetGUID().GetCounter()); + stmt->setUInt64(0, pItem->GetGUID().GetCounter()); CharacterDatabase.Execute(stmt); } @@ -14918,7 +14918,7 @@ void Player::AddQuest(Quest const* quest, Object* questGiver) // prepare Quest Tracker datas CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_QUEST_TRACK); stmt->setUInt32(0, quest_id); - stmt->setUInt32(1, GetGUID().GetCounter()); + stmt->setUInt64(1, GetGUID().GetCounter()); stmt->setString(2, GitRevision::GetHash()); stmt->setString(3, GitRevision::GetDate()); @@ -14949,7 +14949,7 @@ void Player::CompleteQuest(uint32 quest_id) // prepare Quest Tracker data CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_QUEST_TRACK_COMPLETE_TIME); stmt->setUInt32(0, quest_id); - stmt->setUInt32(1, GetGUID().GetCounter()); + stmt->setUInt64(1, GetGUID().GetCounter()); // add to Quest Tracker CharacterDatabase.Execute(stmt); @@ -16921,7 +16921,7 @@ void Player::_LoadEquipmentSets(PreparedQueryResult result) eqSet.State = EQUIPMENT_SET_UNCHANGED; for (uint32 i = 0; i < EQUIPMENT_SLOT_END; ++i) - if (ObjectGuid::LowType guid = fields[5 + i].GetUInt32()) + if (ObjectGuid::LowType guid = fields[5 + i].GetUInt64()) eqSet.Data.Pieces[i] = ObjectGuid::Create(guid); if (eqSet.Data.SetID >= MAX_EQUIPMENT_SET_INDEX) // client limit @@ -16956,7 +16956,7 @@ void Player::_LoadBGData(PreparedQueryResult result) bool Player::LoadPositionFromDB(uint32& mapid, float& x, float& y, float& z, float& o, bool& in_flight, ObjectGuid guid) { CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_POSITION); - stmt->setUInt32(0, guid.GetCounter()); + stmt->setUInt64(0, guid.GetCounter()); PreparedQueryResult result = CharacterDatabase.Query(stmt); if (!result) @@ -16987,7 +16987,7 @@ void Player::SetHomebind(WorldLocation const& loc, uint32 areaId) stmt->setFloat (2, m_homebindX); stmt->setFloat (3, m_homebindY); stmt->setFloat (4, m_homebindZ); - stmt->setUInt32(5, GetGUID().GetCounter()); + stmt->setUInt64(5, GetGUID().GetCounter()); CharacterDatabase.Execute(stmt); } @@ -17054,7 +17054,7 @@ bool Player::LoadFromDB(ObjectGuid guid, CharacterDatabaseQueryHolder const& hol { CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ADD_AT_LOGIN_FLAG); stmt->setUInt16(0, uint16(AT_LOGIN_RENAME)); - stmt->setUInt32(1, guid.GetCounter()); + stmt->setUInt64(1, guid.GetCounter()); CharacterDatabase.Execute(stmt); return false; } @@ -17155,7 +17155,7 @@ bool Player::LoadFromDB(ObjectGuid guid, CharacterDatabaseQueryHolder const& hol InitPrimaryProfessions(); // to max set before any spell loaded // init saved position, and fix it later if problematic - ObjectGuid::LowType transLowGUID = fields[35].GetUInt32(); + ObjectGuid::LowType transLowGUID = fields[35].GetUInt64(); Relocate(fields[17].GetFloat(), fields[18].GetFloat(), fields[19].GetFloat(), fields[21].GetFloat()); uint32 mapId = fields[20].GetUInt16(); uint32 instanceId = fields[63].GetUInt32(); @@ -17975,7 +17975,7 @@ void Player::_LoadInventory(PreparedQueryResult result, uint32 timeDiff) Field* fields = result->Fetch(); if (Item* item = _LoadItem(trans, zoneId, timeDiff, fields)) { - ObjectGuid::LowType bagGuid = fields[11].GetUInt32(); + ObjectGuid::LowType bagGuid = fields[11].GetUInt64(); uint8 slot = fields[12].GetUInt8(); InventoryResult err = EQUIP_ERR_OK; @@ -18085,7 +18085,7 @@ void Player::_LoadInventory(PreparedQueryResult result, uint32 timeDiff) Item* Player::_LoadItem(CharacterDatabaseTransaction trans, uint32 zoneId, uint32 timeDiff, Field* fields) { Item* item = nullptr; - ObjectGuid::LowType itemGuid = fields[13].GetUInt32(); + ObjectGuid::LowType itemGuid = fields[13].GetUInt64(); uint32 itemEntry = fields[14].GetUInt32(); if (ItemTemplate const* proto = sObjectMgr->GetItemTemplate(itemEntry)) { @@ -18117,7 +18117,7 @@ Item* Player::_LoadItem(CharacterDatabaseTransaction trans, uint32 zoneId, uint3 GetGUID().ToString(), GetName(), item->GetGUID().ToString(), item->GetPlayedTime()); stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_REFUND_INSTANCE); - stmt->setUInt32(0, item->GetGUID().GetCounter()); + stmt->setUInt64(0, item->GetGUID().GetCounter()); trans->Append(stmt); item->RemoveFlag(ITEM_FIELD_FLAGS, ITEM_FIELD_FLAG_REFUNDABLE); @@ -18125,8 +18125,8 @@ Item* Player::_LoadItem(CharacterDatabaseTransaction trans, uint32 zoneId, uint3 else { stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_ITEM_REFUNDS); - stmt->setUInt32(0, item->GetGUID().GetCounter()); - stmt->setUInt32(1, GetGUID().GetCounter()); + stmt->setUInt64(0, item->GetGUID().GetCounter()); + stmt->setUInt64(1, GetGUID().GetCounter()); if (PreparedQueryResult result = CharacterDatabase.Query(stmt)) { item->SetRefundRecipient((*result)[0].GetUInt32()); @@ -18145,7 +18145,7 @@ Item* Player::_LoadItem(CharacterDatabaseTransaction trans, uint32 zoneId, uint3 else if (item->IsBOPTradeable()) { stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_ITEM_BOP_TRADE); - stmt->setUInt32(0, item->GetGUID().GetCounter()); + stmt->setUInt64(0, item->GetGUID().GetCounter()); if (PreparedQueryResult result = CharacterDatabase.Query(stmt)) { GuidSet looters; @@ -18215,7 +18215,7 @@ Item* Player::_LoadItem(CharacterDatabaseTransaction trans, uint32 zoneId, uint3 // load mailed item which should receive current player Item* Player::_LoadMailedItem(ObjectGuid const& playerGuid, Player* player, uint32 mailId, Mail* mail, Field* fields) { - ObjectGuid::LowType itemGuid = fields[11].GetUInt32(); + ObjectGuid::LowType itemGuid = fields[11].GetUInt64(); uint32 itemEntry = fields[12].GetUInt32(); ItemTemplate const* proto = sObjectMgr->GetItemTemplate(itemEntry); @@ -18227,7 +18227,7 @@ Item* Player::_LoadMailedItem(ObjectGuid const& playerGuid, Player* player, uint CharacterDatabaseTransaction trans = CharacterDatabase.BeginTransaction(); CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_INVALID_MAIL_ITEM); - stmt->setUInt32(0, itemGuid); + stmt->setUInt64(0, itemGuid); trans->Append(stmt); Item::DeleteFromDB(trans, itemGuid); @@ -18238,13 +18238,13 @@ Item* Player::_LoadMailedItem(ObjectGuid const& playerGuid, Player* player, uint Item* item = NewItemOrBag(proto); - ObjectGuid ownerGuid = fields[13].GetUInt32() ? ObjectGuid::Create(fields[13].GetUInt32()) : ObjectGuid::Empty; + ObjectGuid ownerGuid = fields[13].GetUInt64() ? ObjectGuid::Create(fields[13].GetUInt64()) : ObjectGuid::Empty; if (!item->LoadFromDB(itemGuid, ownerGuid, fields, itemEntry)) { TC_LOG_ERROR("entities.player", "Player::_LoadMailedItems: Item (GUID: {}) in mail ({}) doesn't exist, deleted from mail.", itemGuid, mailId); CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_MAIL_ITEM); - stmt->setUInt32(0, itemGuid); + stmt->setUInt64(0, itemGuid); CharacterDatabase.Execute(stmt); item->FSetState(ITEM_REMOVED); @@ -18680,7 +18680,7 @@ void Player::_LoadBoundInstances(PreparedQueryResult result) { CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_INSTANCE_BY_INSTANCE_GUID); - stmt->setUInt32(0, GetGUID().GetCounter()); + stmt->setUInt64(0, GetGUID().GetCounter()); stmt->setUInt32(1, instanceId); CharacterDatabase.Execute(stmt); @@ -18736,7 +18736,7 @@ void Player::UnbindInstance(BoundInstancesMap::iterator &itr, Difficulty difficu { CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_INSTANCE_BY_INSTANCE_GUID); - stmt->setUInt32(0, GetGUID().GetCounter()); + stmt->setUInt64(0, GetGUID().GetCounter()); stmt->setUInt32(1, itr->second.save->GetInstanceId()); CharacterDatabase.Execute(stmt); @@ -18774,7 +18774,7 @@ InstancePlayerBind* Player::BindToInstance(InstanceSave* save, bool permanent, B stmt->setUInt32(0, save->GetInstanceId()); stmt->setBool(1, permanent); stmt->setUInt8(2, extendState); - stmt->setUInt32(3, GetGUID().GetCounter()); + stmt->setUInt64(3, GetGUID().GetCounter()); stmt->setUInt32(4, bind.save->GetInstanceId()); CharacterDatabase.Execute(stmt); @@ -18784,7 +18784,7 @@ InstancePlayerBind* Player::BindToInstance(InstanceSave* save, bool permanent, B { CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHAR_INSTANCE); - stmt->setUInt32(0, GetGUID().GetCounter()); + stmt->setUInt64(0, GetGUID().GetCounter()); stmt->setUInt32(1, save->GetInstanceId()); stmt->setBool(2, permanent); stmt->setUInt8(3, extendState); @@ -19083,7 +19083,7 @@ bool Player::_LoadHomeBind(PreparedQueryResult result) else { CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_PLAYER_HOMEBIND); - stmt->setUInt32(0, GetGUID().GetCounter()); + stmt->setUInt64(0, GetGUID().GetCounter()); CharacterDatabase.Execute(stmt); } } @@ -19097,7 +19097,7 @@ bool Player::_LoadHomeBind(PreparedQueryResult result) m_homebindZ = info->positionZ; CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_PLAYER_HOMEBIND); - stmt->setUInt32(0, GetGUID().GetCounter()); + stmt->setUInt64(0, GetGUID().GetCounter()); stmt->setUInt16(1, m_homebindMapId); stmt->setUInt16(2, m_homebindAreaId); stmt->setFloat (3, m_homebindX); @@ -19150,7 +19150,7 @@ void Player::SaveToDB(CharacterDatabaseTransaction trans, bool create /* = false uint8 index = 0; stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_FISHINGSTEPS); - stmt->setUInt32(0, GetGUID().GetCounter()); + stmt->setUInt64(0, GetGUID().GetCounter()); trans->Append(stmt); auto finiteAlways = [](float f) { return std::isfinite(f) ? f : 0.0f; }; @@ -19160,7 +19160,7 @@ void Player::SaveToDB(CharacterDatabaseTransaction trans, bool create /* = false //! Insert query /// @todo: Filter out more redundant fields that can take their default value at player create stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHARACTER); - stmt->setUInt32(index++, GetGUID().GetCounter()); + stmt->setUInt64(index++, GetGUID().GetCounter()); stmt->setUInt32(index++, GetSession()->GetAccountId()); stmt->setString(index++, GetName()); stmt->setUInt8(index++, GetRace()); @@ -19191,7 +19191,7 @@ void Player::SaveToDB(CharacterDatabaseTransaction trans, bool create /* = false ObjectGuid::LowType transLowGUID = 0; if (GetTransport()) transLowGUID = GetTransport()->GetGUID().GetCounter(); - stmt->setUInt32(index++, transLowGUID); + stmt->setUInt64(index++, transLowGUID); std::ostringstream ss; ss << m_taxi; @@ -19316,7 +19316,7 @@ void Player::SaveToDB(CharacterDatabaseTransaction trans, bool create /* = false ObjectGuid::LowType transLowGUID = 0; if (GetTransport()) transLowGUID = GetTransport()->GetGUID().GetCounter(); - stmt->setUInt32(index++, transLowGUID); + stmt->setUInt64(index++, transLowGUID); std::ostringstream ss; ss << m_taxi; @@ -19395,7 +19395,7 @@ void Player::SaveToDB(CharacterDatabaseTransaction trans, bool create /* = false stmt->setUInt8(index++, IsInWorld() && !GetSession()->PlayerLogout() ? 1 : 0); // Index - stmt->setUInt32(index++, GetGUID().GetCounter()); + stmt->setUInt64(index++, GetGUID().GetCounter()); } trans->Append(stmt); @@ -19404,7 +19404,7 @@ void Player::SaveToDB(CharacterDatabaseTransaction trans, bool create /* = false { stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHAR_FISHINGSTEPS); index = 0; - stmt->setUInt32(index++, GetGUID().GetCounter()); + stmt->setUInt64(index++, GetGUID().GetCounter()); stmt->setUInt32(index++, m_fishingSteps); trans->Append(stmt); } @@ -19453,7 +19453,7 @@ void Player::SaveGoldToDB(CharacterDatabaseTransaction trans) const { CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHAR_MONEY); stmt->setUInt32(0, GetMoney()); - stmt->setUInt32(1, GetGUID().GetCounter()); + stmt->setUInt64(1, GetGUID().GetCounter()); trans->Append(stmt); } @@ -19467,7 +19467,7 @@ void Player::_SaveActions(CharacterDatabaseTransaction trans) { case ACTIONBUTTON_NEW: stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHAR_ACTION); - stmt->setUInt32(0, GetGUID().GetCounter()); + stmt->setUInt64(0, GetGUID().GetCounter()); stmt->setUInt8(1, GetActiveSpec()); stmt->setUInt8(2, itr->first); stmt->setUInt32(3, itr->second.GetAction()); @@ -19481,7 +19481,7 @@ void Player::_SaveActions(CharacterDatabaseTransaction trans) stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHAR_ACTION); stmt->setUInt32(0, itr->second.GetAction()); stmt->setUInt8(1, uint8(itr->second.GetType())); - stmt->setUInt32(2, GetGUID().GetCounter()); + stmt->setUInt64(2, GetGUID().GetCounter()); stmt->setUInt8(3, itr->first); stmt->setUInt8(4, GetActiveSpec()); trans->Append(stmt); @@ -19491,7 +19491,7 @@ void Player::_SaveActions(CharacterDatabaseTransaction trans) break; case ACTIONBUTTON_DELETED: stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_ACTION_BY_BUTTON_SPEC); - stmt->setUInt32(0, GetGUID().GetCounter()); + stmt->setUInt64(0, GetGUID().GetCounter()); stmt->setUInt8(1, itr->first); stmt->setUInt8(2, GetActiveSpec()); trans->Append(stmt); @@ -19508,7 +19508,7 @@ void Player::_SaveActions(CharacterDatabaseTransaction trans) void Player::_SaveAuras(CharacterDatabaseTransaction trans) { CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_AURA); - stmt->setUInt32(0, GetGUID().GetCounter()); + stmt->setUInt64(0, GetGUID().GetCounter()); trans->Append(stmt); for (AuraMap::const_iterator itr = m_ownedAuras.begin(); itr != m_ownedAuras.end(); ++itr) @@ -19541,7 +19541,7 @@ void Player::_SaveAuras(CharacterDatabaseTransaction trans) uint8 index = 0; stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_AURA); - stmt->setUInt32(index++, GetGUID().GetCounter()); + stmt->setUInt64(index++, GetGUID().GetCounter()); stmt->setUInt64(index++, itr->second->GetCasterGUID().GetRawValue()); stmt->setUInt64(index++, itr->second->GetCastItemGUID().GetRawValue()); stmt->setUInt32(index++, itr->second->GetId()); @@ -19584,11 +19584,11 @@ void Player::_SaveInventory(CharacterDatabaseTransaction trans) } stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_INVENTORY_BY_ITEM); - stmt->setUInt32(0, item->GetGUID().GetCounter()); + stmt->setUInt64(0, item->GetGUID().GetCounter()); trans->Append(stmt); stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_INSTANCE); - stmt->setUInt32(0, item->GetGUID().GetCounter()); + stmt->setUInt64(0, item->GetGUID().GetCounter()); trans->Append(stmt); m_items[i]->FSetState(ITEM_NEW); @@ -19653,9 +19653,9 @@ void Player::_SaveInventory(CharacterDatabaseTransaction trans) GetName(), GetGUID().ToString(), item->GetBagSlot(), item->GetSlot(), item->GetGUID().ToString(), (int32)item->GetState()); // according to the test that was just performed nothing should be in this slot, delete stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_INVENTORY_BY_BAG_SLOT); - stmt->setUInt32(0, bagTestGUID); + stmt->setUInt64(0, bagTestGUID); stmt->setUInt8(1, item->GetSlot()); - stmt->setUInt32(2, lowGuid); + stmt->setUInt64(2, lowGuid); trans->Append(stmt); RemoveTradeableItem(item); @@ -19685,15 +19685,15 @@ void Player::_SaveInventory(CharacterDatabaseTransaction trans) case ITEM_NEW: case ITEM_CHANGED: stmt = CharacterDatabase.GetPreparedStatement(CHAR_REP_INVENTORY_ITEM); - stmt->setUInt32(0, lowGuid); - stmt->setUInt32(1, bag_guid); + stmt->setUInt64(0, lowGuid); + stmt->setUInt64(1, bag_guid); stmt->setUInt8 (2, item->GetSlot()); - stmt->setUInt32(3, item->GetGUID().GetCounter()); + stmt->setUInt64(3, item->GetGUID().GetCounter()); trans->Append(stmt); break; case ITEM_REMOVED: stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_INVENTORY_BY_ITEM); - stmt->setUInt32(0, item->GetGUID().GetCounter()); + stmt->setUInt64(0, item->GetGUID().GetCounter()); trans->Append(stmt); break; case ITEM_UNCHANGED: @@ -19744,7 +19744,7 @@ void Player::_SaveMail(CharacterDatabaseTransaction trans) for (MailItemInfoVec::iterator itr2 = m->items.begin(); itr2 != m->items.end(); ++itr2) { stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_INSTANCE); - stmt->setUInt32(0, itr2->item_guid); + stmt->setUInt64(0, itr2->item_guid); trans->Append(stmt); } } @@ -19797,7 +19797,7 @@ void Player::_SaveQuestStatus(CharacterDatabaseTransaction trans) uint8 index = 0; stmt = CharacterDatabase.GetPreparedStatement(CHAR_REP_CHAR_QUESTSTATUS); - stmt->setUInt32(index++, GetGUID().GetCounter()); + stmt->setUInt64(index++, GetGUID().GetCounter()); stmt->setUInt32(index++, statusItr->first); stmt->setUInt8(index++, uint8(statusItr->second.Status)); stmt->setBool(index++, statusItr->second.Explored); @@ -19816,7 +19816,7 @@ void Player::_SaveQuestStatus(CharacterDatabaseTransaction trans) else { stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_QUESTSTATUS_BY_QUEST); - stmt->setUInt32(0, GetGUID().GetCounter()); + stmt->setUInt64(0, GetGUID().GetCounter()); stmt->setUInt32(1, saveItr->first); trans->Append(stmt); } @@ -19829,7 +19829,7 @@ void Player::_SaveQuestStatus(CharacterDatabaseTransaction trans) if (saveItr->second == QUEST_DEFAULT_SAVE_TYPE) { stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHAR_QUESTSTATUS_REWARDED); - stmt->setUInt32(0, GetGUID().GetCounter()); + stmt->setUInt64(0, GetGUID().GetCounter()); stmt->setUInt32(1, saveItr->first); trans->Append(stmt); @@ -19837,7 +19837,7 @@ void Player::_SaveQuestStatus(CharacterDatabaseTransaction trans) else if (saveItr->second == QUEST_FORCE_DELETE_SAVE_TYPE || !keepAbandoned) { stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_QUESTSTATUS_REWARDED_BY_QUEST); - stmt->setUInt32(0, GetGUID().GetCounter()); + stmt->setUInt64(0, GetGUID().GetCounter()); stmt->setUInt32(1, saveItr->first); trans->Append(stmt); } @@ -19860,7 +19860,7 @@ void Player::_SaveDailyQuestStatus(CharacterDatabaseTransaction trans) // we don't need transactions here. CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHARACTER_QUESTSTATUS_DAILY); - stmt->setUInt32(0, GetGUID().GetCounter()); + stmt->setUInt64(0, GetGUID().GetCounter()); trans->Append(stmt); for (uint32 quest_daily_idx = 0; quest_daily_idx < PLAYER_MAX_DAILY_QUESTS; ++quest_daily_idx) @@ -19868,7 +19868,7 @@ void Player::_SaveDailyQuestStatus(CharacterDatabaseTransaction trans) if (GetUInt32Value(PLAYER_FIELD_DAILY_QUESTS_1+quest_daily_idx)) { stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHARACTER_QUESTSTATUS_DAILY); - stmt->setUInt32(0, GetGUID().GetCounter()); + stmt->setUInt64(0, GetGUID().GetCounter()); stmt->setUInt32(1, GetUInt32Value(PLAYER_FIELD_DAILY_QUESTS_1+quest_daily_idx)); stmt->setUInt64(2, uint64(m_lastDailyQuestTime)); trans->Append(stmt); @@ -19880,7 +19880,7 @@ void Player::_SaveDailyQuestStatus(CharacterDatabaseTransaction trans) for (DFQuestsDoneList::iterator itr = m_DFQuests.begin(); itr != m_DFQuests.end(); ++itr) { stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHARACTER_QUESTSTATUS_DAILY); - stmt->setUInt32(0, GetGUID().GetCounter()); + stmt->setUInt64(0, GetGUID().GetCounter()); stmt->setUInt32(1, (*itr)); stmt->setUInt64(2, uint64(m_lastDailyQuestTime)); trans->Append(stmt); @@ -19895,7 +19895,7 @@ void Player::_SaveWeeklyQuestStatus(CharacterDatabaseTransaction trans) // we don't need transactions here. CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHARACTER_QUESTSTATUS_WEEKLY); - stmt->setUInt32(0, GetGUID().GetCounter()); + stmt->setUInt64(0, GetGUID().GetCounter()); trans->Append(stmt); for (QuestSet::const_iterator iter = m_weeklyquests.begin(); iter != m_weeklyquests.end(); ++iter) @@ -19903,7 +19903,7 @@ void Player::_SaveWeeklyQuestStatus(CharacterDatabaseTransaction trans) uint32 questId = *iter; stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHARACTER_QUESTSTATUS_WEEKLY); - stmt->setUInt32(0, GetGUID().GetCounter()); + stmt->setUInt64(0, GetGUID().GetCounter()); stmt->setUInt32(1, questId); trans->Append(stmt); } @@ -19918,7 +19918,7 @@ void Player::_SaveSeasonalQuestStatus(CharacterDatabaseTransaction trans) // we don't need transactions here. CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHARACTER_QUESTSTATUS_SEASONAL); - stmt->setUInt32(0, GetGUID().GetCounter()); + stmt->setUInt64(0, GetGUID().GetCounter()); trans->Append(stmt); m_SeasonalQuestChanged = false; @@ -19936,7 +19936,7 @@ void Player::_SaveSeasonalQuestStatus(CharacterDatabaseTransaction trans) time_t completedTime = itr->second; stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHARACTER_QUESTSTATUS_SEASONAL); - stmt->setUInt32(0, GetGUID().GetCounter()); + stmt->setUInt64(0, GetGUID().GetCounter()); stmt->setUInt32(1, questId); stmt->setUInt32(2, eventId); stmt->setInt64(3, completedTime); @@ -19952,7 +19952,7 @@ void Player::_SaveMonthlyQuestStatus(CharacterDatabaseTransaction trans) // we don't need transactions here. CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHARACTER_QUESTSTATUS_MONTHLY); - stmt->setUInt32(0, GetGUID().GetCounter()); + stmt->setUInt64(0, GetGUID().GetCounter()); trans->Append(stmt); for (QuestSet::const_iterator iter = m_monthlyquests.begin(); iter != m_monthlyquests.end(); ++iter) @@ -19960,7 +19960,7 @@ void Player::_SaveMonthlyQuestStatus(CharacterDatabaseTransaction trans) uint32 questId = *iter; stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHARACTER_QUESTSTATUS_MONTHLY); - stmt->setUInt32(0, GetGUID().GetCounter()); + stmt->setUInt64(0, GetGUID().GetCounter()); stmt->setUInt32(1, questId); trans->Append(stmt); } @@ -19983,7 +19983,7 @@ void Player::_SaveSkills(CharacterDatabaseTransaction trans) if (itr->second.uState == SKILL_DELETED) { stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_SKILL_BY_SKILL); - stmt->setUInt32(0, GetGUID().GetCounter()); + stmt->setUInt64(0, GetGUID().GetCounter()); stmt->setUInt32(1, itr->first); trans->Append(stmt); @@ -19999,7 +19999,7 @@ void Player::_SaveSkills(CharacterDatabaseTransaction trans) { case SKILL_NEW: stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHAR_SKILLS); - stmt->setUInt32(0, GetGUID().GetCounter()); + stmt->setUInt64(0, GetGUID().GetCounter()); stmt->setUInt16(1, uint16(itr->first)); stmt->setUInt16(2, value); stmt->setUInt16(3, max); @@ -20010,7 +20010,7 @@ void Player::_SaveSkills(CharacterDatabaseTransaction trans) stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHAR_SKILLS); stmt->setUInt16(0, value); stmt->setUInt16(1, max); - stmt->setUInt32(2, GetGUID().GetCounter()); + stmt->setUInt64(2, GetGUID().GetCounter()); stmt->setUInt16(3, uint16(itr->first)); trans->Append(stmt); @@ -20034,7 +20034,7 @@ void Player::_SaveSpells(CharacterDatabaseTransaction trans) { stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_SPELL_BY_SPELL); stmt->setUInt32(0, itr->first); - stmt->setUInt32(1, GetGUID().GetCounter()); + stmt->setUInt64(1, GetGUID().GetCounter()); trans->Append(stmt); } @@ -20042,7 +20042,7 @@ void Player::_SaveSpells(CharacterDatabaseTransaction trans) if (!itr->second.dependent && (itr->second.state == PLAYERSPELL_NEW || itr->second.state == PLAYERSPELL_CHANGED)) { stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHAR_SPELL); - stmt->setUInt32(0, GetGUID().GetCounter()); + stmt->setUInt64(0, GetGUID().GetCounter()); stmt->setUInt32(1, itr->first); stmt->setBool(2, itr->second.active); stmt->setBool(3, itr->second.disabled); @@ -20073,13 +20073,13 @@ void Player::_SaveStats(CharacterDatabaseTransaction trans) const CharacterDatabasePreparedStatement* stmt; stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_STATS); - stmt->setUInt32(0, GetGUID().GetCounter()); + stmt->setUInt64(0, GetGUID().GetCounter()); trans->Append(stmt); uint8 index = 0; stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHAR_STATS); - stmt->setUInt32(index++, GetGUID().GetCounter()); + stmt->setUInt64(index++, GetGUID().GetCounter()); stmt->setUInt32(index++, GetMaxHealth()); for (uint8 i = 0; i < MAX_POWERS; ++i) @@ -20193,7 +20193,7 @@ void Player::SavePositionInDB(WorldLocation const& loc, uint16 zoneId, ObjectGui stmt->setFloat(3, loc.GetOrientation()); stmt->setUInt16(4, uint16(loc.GetMapId())); stmt->setUInt16(5, zoneId); - stmt->setUInt32(6, guid.GetCounter()); + stmt->setUInt64(6, guid.GetCounter()); CharacterDatabase.ExecuteOrAppend(trans, stmt); } @@ -20208,7 +20208,7 @@ void Player::Customize(CharacterCustomizeInfo const* customizeInfo, CharacterDat stmt->setUInt8(3, customizeInfo->HairStyle); stmt->setUInt8(4, customizeInfo->HairColor); stmt->setUInt8(5, customizeInfo->FacialHair); - stmt->setUInt32(6, customizeInfo->Guid.GetCounter()); + stmt->setUInt64(6, customizeInfo->Guid.GetCounter()); CharacterDatabase.ExecuteOrAppend(trans, stmt); } @@ -20507,7 +20507,7 @@ void Player::RemovePet(Pet* pet, PetSaveMode mode, bool returnreagent) // Handle removing pet while it is in "temporarily unsummoned" state, for example on mount CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHAR_PET_SLOT_BY_ID); stmt->setUInt8(0, PET_SAVE_NOT_IN_SLOT); - stmt->setUInt32(1, GetGUID().GetCounter()); + stmt->setUInt64(1, GetGUID().GetCounter()); stmt->setUInt32(2, m_petStable->CurrentPet->PetNumber); CharacterDatabase.Execute(stmt); @@ -22137,7 +22137,7 @@ void Player::LeaveBattleground(bool teleportToEntryPoint /*= true*/, bool withou (bg->GetStatus() == STATUS_IN_PROGRESS || bg->GetStatus() == STATUS_WAIT_JOIN)) { CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_DESERTER_TRACK); - stmt->setUInt32(0, GetGUID().GetCounter()); + stmt->setUInt64(0, GetGUID().GetCounter()); stmt->setUInt8(1, BG_DESERTION_TYPE_LEAVE_BG); CharacterDatabase.Execute(stmt); } @@ -24875,7 +24875,7 @@ void Player::_LoadSkills(PreparedQueryResult result) CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHARACTER_SKILL); - stmt->setUInt32(0, GetGUID().GetCounter()); + stmt->setUInt64(0, GetGUID().GetCounter()); stmt->setUInt16(1, skill); CharacterDatabase.Execute(stmt); @@ -25694,8 +25694,8 @@ void Player::_SaveEquipmentSets(CharacterDatabaseTransaction trans) stmt->setString(j++, eqSet.Data.SetIcon); stmt->setUInt32(j++, eqSet.Data.IgnoreMask); for (uint8 i = 0; i < EQUIPMENT_SLOT_END; ++i) - stmt->setUInt32(j++, eqSet.Data.Pieces[i].GetCounter()); - stmt->setUInt32(j++, GetGUID().GetCounter()); + stmt->setUInt64(j++, eqSet.Data.Pieces[i].GetCounter()); + stmt->setUInt64(j++, GetGUID().GetCounter()); stmt->setUInt64(j++, eqSet.Data.Guid); stmt->setUInt32(j, eqSet.Data.SetID); trans->Append(stmt); @@ -25704,14 +25704,14 @@ void Player::_SaveEquipmentSets(CharacterDatabaseTransaction trans) break; case EQUIPMENT_SET_NEW: stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_EQUIP_SET); - stmt->setUInt32(j++, GetGUID().GetCounter()); + stmt->setUInt64(j++, GetGUID().GetCounter()); stmt->setUInt64(j++, eqSet.Data.Guid); stmt->setUInt32(j++, eqSet.Data.SetID); stmt->setString(j++, eqSet.Data.SetName); stmt->setString(j++, eqSet.Data.SetIcon); stmt->setUInt32(j++, eqSet.Data.IgnoreMask); for (uint8 i = 0; i < EQUIPMENT_SLOT_END; ++i) - stmt->setUInt32(j++, eqSet.Data.Pieces[i].GetCounter()); + stmt->setUInt64(j++, eqSet.Data.Pieces[i].GetCounter()); trans->Append(stmt); eqSet.State = EQUIPMENT_SET_UNCHANGED; ++itr; @@ -25729,11 +25729,11 @@ void Player::_SaveEquipmentSets(CharacterDatabaseTransaction trans) void Player::_SaveBGData(CharacterDatabaseTransaction trans) { CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_PLAYER_BGDATA); - stmt->setUInt32(0, GetGUID().GetCounter()); + stmt->setUInt64(0, GetGUID().GetCounter()); trans->Append(stmt); /* guid, bgInstanceID, bgTeam, x, y, z, o, map, taxi[0], taxi[1], mountSpell */ stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_PLAYER_BGDATA); - stmt->setUInt32(0, GetGUID().GetCounter()); + stmt->setUInt64(0, GetGUID().GetCounter()); stmt->setUInt32(1, m_bgData.bgInstanceID); stmt->setUInt16(2, m_bgData.bgTeam); stmt->setFloat (3, m_bgData.joinPos.GetPositionX()); @@ -25772,7 +25772,7 @@ void Player::RemoveAtLoginFlag(AtLoginFlags flags, bool persist /*= false*/) CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_REM_AT_LOGIN_FLAG); stmt->setUInt16(0, uint16(flags)); - stmt->setUInt32(1, GetGUID().GetCounter()); + stmt->setUInt64(1, GetGUID().GetCounter()); CharacterDatabase.Execute(stmt); } @@ -25819,7 +25819,7 @@ void Player::_LoadGlyphs(PreparedQueryResult result) void Player::_SaveGlyphs(CharacterDatabaseTransaction trans) const { CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_GLYPHS); - stmt->setUInt32(0, GetGUID().GetCounter()); + stmt->setUInt64(0, GetGUID().GetCounter()); trans->Append(stmt); for (uint8 spec = 0; spec < GetSpecsCount(); ++spec) @@ -25827,7 +25827,7 @@ void Player::_SaveGlyphs(CharacterDatabaseTransaction trans) const uint8 index = 0; stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHAR_GLYPHS); - stmt->setUInt32(index++, GetGUID().GetCounter()); + stmt->setUInt64(index++, GetGUID().GetCounter()); stmt->setUInt8(index++, spec); @@ -25860,7 +25860,7 @@ void Player::_SaveTalents(CharacterDatabaseTransaction trans) if (itr->second->state == PLAYERSPELL_REMOVED || itr->second->state == PLAYERSPELL_CHANGED) { stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_TALENT_BY_SPELL_SPEC); - stmt->setUInt32(0, GetGUID().GetCounter()); + stmt->setUInt64(0, GetGUID().GetCounter()); stmt->setUInt32(1, itr->first); stmt->setUInt8(2, itr->second->spec); trans->Append(stmt); @@ -25869,7 +25869,7 @@ void Player::_SaveTalents(CharacterDatabaseTransaction trans) if (itr->second->state == PLAYERSPELL_NEW || itr->second->state == PLAYERSPELL_CHANGED) { stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHAR_TALENT); - stmt->setUInt32(0, GetGUID().GetCounter()); + stmt->setUInt64(0, GetGUID().GetCounter()); stmt->setUInt32(1, itr->first); stmt->setUInt8(2, itr->second->spec); trans->Append(stmt); @@ -25908,7 +25908,7 @@ void Player::UpdateSpecCount(uint8 count) for (ActionButtonList::iterator itr = m_actionButtons.begin(); itr != m_actionButtons.end(); ++itr) { stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHAR_ACTION); - stmt->setUInt32(0, GetGUID().GetCounter()); + stmt->setUInt64(0, GetGUID().GetCounter()); stmt->setUInt8(1, 1); stmt->setUInt8(2, itr->first); stmt->setUInt32(3, itr->second.GetAction()); @@ -25923,7 +25923,7 @@ void Player::UpdateSpecCount(uint8 count) stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_ACTION_EXCEPT_SPEC); stmt->setUInt8(0, GetActiveSpec()); - stmt->setUInt32(1, GetGUID().GetCounter()); + stmt->setUInt64(1, GetGUID().GetCounter()); trans->Append(stmt); SetActiveSpec(0); @@ -26078,7 +26078,7 @@ void Player::ActivateSpec(uint8 spec) // load them asynchronously { CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_ACTIONS_SPEC); - stmt->setUInt32(0, GetGUID().GetCounter()); + stmt->setUInt64(0, GetGUID().GetCounter()); stmt->setUInt8(1, GetActiveSpec()); WorldSession* mySess = GetSession(); @@ -26360,7 +26360,7 @@ void Player::SetRandomWinner(bool isWinner) { CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_BATTLEGROUND_RANDOM); - stmt->setUInt32(0, GetGUID().GetCounter()); + stmt->setUInt64(0, GetGUID().GetCounter()); CharacterDatabase.Execute(stmt); } diff --git a/src/server/game/Entities/Player/SocialMgr.cpp b/src/server/game/Entities/Player/SocialMgr.cpp index a7a5ef2840b57..96af570b49c91 100644 --- a/src/server/game/Entities/Player/SocialMgr.cpp +++ b/src/server/game/Entities/Player/SocialMgr.cpp @@ -51,8 +51,8 @@ bool PlayerSocial::AddToSocialList(ObjectGuid const& friendGuid, SocialFlag flag CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHARACTER_SOCIAL_FLAGS); stmt->setUInt8(0, itr->second.Flags); - stmt->setUInt32(1, GetPlayerGUID().GetCounter()); - stmt->setUInt32(2, friendGuid.GetCounter()); + stmt->setUInt64(1, GetPlayerGUID().GetCounter()); + stmt->setUInt64(2, friendGuid.GetCounter()); CharacterDatabase.Execute(stmt); } @@ -62,8 +62,8 @@ bool PlayerSocial::AddToSocialList(ObjectGuid const& friendGuid, SocialFlag flag CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHARACTER_SOCIAL); - stmt->setUInt32(0, GetPlayerGUID().GetCounter()); - stmt->setUInt32(1, friendGuid.GetCounter()); + stmt->setUInt64(0, GetPlayerGUID().GetCounter()); + stmt->setUInt64(1, friendGuid.GetCounter()); stmt->setUInt8(2, flag); CharacterDatabase.Execute(stmt); @@ -84,8 +84,8 @@ void PlayerSocial::RemoveFromSocialList(ObjectGuid const& friendGuid, SocialFlag { CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHARACTER_SOCIAL); - stmt->setUInt32(0, GetPlayerGUID().GetCounter()); - stmt->setUInt32(1, friendGuid.GetCounter()); + stmt->setUInt64(0, GetPlayerGUID().GetCounter()); + stmt->setUInt64(1, friendGuid.GetCounter()); CharacterDatabase.Execute(stmt); @@ -96,8 +96,8 @@ void PlayerSocial::RemoveFromSocialList(ObjectGuid const& friendGuid, SocialFlag CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHARACTER_SOCIAL_FLAGS); stmt->setUInt8(0, itr->second.Flags); - stmt->setUInt32(1, GetPlayerGUID()); - stmt->setUInt32(2, friendGuid); + stmt->setUInt64(1, GetPlayerGUID().GetCounter()); + stmt->setUInt64(2, friendGuid.GetCounter()); CharacterDatabase.Execute(stmt); } @@ -115,8 +115,8 @@ void PlayerSocial::SetFriendNote(ObjectGuid const& friendGuid, std::string const CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHARACTER_SOCIAL_NOTE); stmt->setString(0, itr->second.Note); - stmt->setUInt32(1, GetPlayerGUID().GetCounter()); - stmt->setUInt32(2, friendGuid.GetCounter()); + stmt->setUInt64(1, GetPlayerGUID().GetCounter()); + stmt->setUInt64(2, friendGuid.GetCounter()); CharacterDatabase.Execute(stmt); } @@ -322,7 +322,7 @@ PlayerSocial* SocialMgr::LoadFromDB(PreparedQueryResult result, ObjectGuid const { Field* fields = result->Fetch(); - ObjectGuid friendGuid = ObjectGuid::Create(fields[0].GetUInt32()); + ObjectGuid friendGuid = ObjectGuid::Create(fields[0].GetUInt64()); uint8 flag = fields[1].GetUInt8(); social->_playerSocialMap[friendGuid] = FriendInfo(flag, fields[2].GetString()); diff --git a/src/server/game/Events/GameEventMgr.cpp b/src/server/game/Events/GameEventMgr.cpp index 53b16101b08a8..d2065e0920ac3 100644 --- a/src/server/game/Events/GameEventMgr.cpp +++ b/src/server/game/Events/GameEventMgr.cpp @@ -388,7 +388,7 @@ void GameEventMgr::LoadFromDB() { Field* fields = result->Fetch(); - ObjectGuid::LowType guid = fields[0].GetUInt32(); + ObjectGuid::LowType guid = fields[0].GetUInt64(); int16 event_id = fields[1].GetInt8(); int32 internal_event_id = mGameEvent.size() + event_id - 1; @@ -438,7 +438,7 @@ void GameEventMgr::LoadFromDB() { Field* fields = result->Fetch(); - ObjectGuid::LowType guid = fields[0].GetUInt32(); + ObjectGuid::LowType guid = fields[0].GetUInt64(); int16 event_id = fields[1].GetInt8(); int32 internal_event_id = mGameEvent.size() + event_id - 1; @@ -488,7 +488,7 @@ void GameEventMgr::LoadFromDB() { Field* fields = result->Fetch(); - ObjectGuid::LowType guid = fields[0].GetUInt32(); + ObjectGuid::LowType guid = fields[0].GetUInt64(); uint32 entry = fields[1].GetUInt32(); uint16 event_id = fields[2].GetUInt8(); @@ -737,7 +737,7 @@ void GameEventMgr::LoadFromDB() { Field* fields = result->Fetch(); - ObjectGuid::LowType guid = fields[0].GetUInt32(); + ObjectGuid::LowType guid = fields[0].GetUInt64(); uint16 event_id = fields[1].GetUInt8(); uint32 npcflag = fields[2].GetUInt32(); @@ -824,7 +824,7 @@ void GameEventMgr::LoadFromDB() NPCVendorList& vendors = mGameEventVendors[event_id]; NPCVendorEntry newEntry; - ObjectGuid::LowType guid = fields[1].GetUInt32(); + ObjectGuid::LowType guid = fields[1].GetUInt64(); newEntry.item = fields[2].GetUInt32(); newEntry.maxcount = fields[3].GetUInt32(); newEntry.incrtime = fields[4].GetUInt32(); diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index 747f0aa1330cb..450f03bd63d25 100644 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -1295,7 +1295,7 @@ void ObjectMgr::LoadCreatureAddons() { Field* fields = result->Fetch(); - ObjectGuid::LowType guid = fields[0].GetUInt32(); + ObjectGuid::LowType guid = fields[0].GetUInt64(); CreatureData const* creData = GetCreatureData(guid); if (!creData) @@ -1419,7 +1419,7 @@ void ObjectMgr::LoadGameObjectAddons() { Field* fields = result->Fetch(); - ObjectGuid::LowType guid = fields[0].GetUInt32(); + ObjectGuid::LowType guid = fields[0].GetUInt64(); GameObjectData const* goData = GetGameObjectData(guid); if (!goData) @@ -1623,7 +1623,7 @@ void ObjectMgr::LoadCreatureMovementOverrides() do { Field* fields = result->Fetch(); - ObjectGuid::LowType spawnId = fields[0].GetUInt32(); + ObjectGuid::LowType spawnId = fields[0].GetUInt64(); if (!GetCreatureData(spawnId)) { TC_LOG_ERROR("sql.sql", "Creature (GUID: {}) does not exist but has a record in `creature_movement_override`", spawnId); @@ -1851,8 +1851,8 @@ void ObjectMgr::LoadLinkedRespawn() { Field* fields = result->Fetch(); - ObjectGuid::LowType guidLow = fields[0].GetUInt32(); - ObjectGuid::LowType linkedGuidLow = fields[1].GetUInt32(); + ObjectGuid::LowType guidLow = fields[0].GetUInt64(); + ObjectGuid::LowType linkedGuidLow = fields[1].GetUInt64(); uint8 linkType = fields[2].GetUInt8(); ObjectGuid guid, linkedGuid; @@ -2030,7 +2030,7 @@ bool ObjectMgr::SetCreatureLinkedRespawn(ObjectGuid::LowType guidLow, ObjectGuid { _linkedRespawnStore.erase(guid); WorldDatabasePreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_DEL_LINKED_RESPAWN); - stmt->setUInt32(0, guidLow); + stmt->setUInt64(0, guidLow); stmt->setUInt32(1, LINKED_RESPAWN_CREATURE_TO_CREATURE); WorldDatabase.Execute(stmt); return true; @@ -2060,8 +2060,8 @@ bool ObjectMgr::SetCreatureLinkedRespawn(ObjectGuid::LowType guidLow, ObjectGuid _linkedRespawnStore[guid] = linkedGuid; WorldDatabasePreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_REP_LINKED_RESPAWN); - stmt->setUInt32(0, guidLow); - stmt->setUInt32(1, linkedGuidLow); + stmt->setUInt64(0, guidLow); + stmt->setUInt64(1, linkedGuidLow); stmt->setUInt32(2, LINKED_RESPAWN_CREATURE_TO_CREATURE); WorldDatabase.Execute(stmt); return true; @@ -2189,7 +2189,7 @@ void ObjectMgr::LoadCreatures() { Field* fields = result->Fetch(); - ObjectGuid::LowType guid = fields[0].GetUInt32(); + ObjectGuid::LowType guid = fields[0].GetUInt64(); uint32 entry = fields[1].GetUInt32(); CreatureTemplate const* cInfo = GetCreatureTemplate(entry); @@ -2510,7 +2510,7 @@ void ObjectMgr::LoadGameObjects() { Field* fields = result->Fetch(); - ObjectGuid::LowType guid = fields[0].GetUInt32(); + ObjectGuid::LowType guid = fields[0].GetUInt64(); uint32 entry = fields[1].GetUInt32(); GameObjectTemplate const* gInfo = GetGameObjectTemplate(entry); @@ -2740,7 +2740,7 @@ void ObjectMgr::LoadSpawnGroups() TC_LOG_ERROR("sql.sql", "Spawn data with invalid type {} listed for spawn group {}. Skipped.", uint32(spawnType), groupId); continue; } - ObjectGuid::LowType spawnId = fields[2].GetUInt32(); + ObjectGuid::LowType spawnId = fields[2].GetUInt64(); SpawnMetadata const* data = GetSpawnMetadata(spawnType, spawnId); if (!data) @@ -3751,7 +3751,7 @@ void ObjectMgr::LoadVehicleAccessories() { Field* fields = result->Fetch(); - uint32 uiGUID = fields[0].GetUInt32(); + uint64 uiGUID = fields[0].GetUInt64(); uint32 uiAccessory = fields[1].GetUInt32(); int8 uiSeat = int8(fields[2].GetInt16()); bool bMinion = fields[3].GetBool(); @@ -6430,7 +6430,7 @@ void ObjectMgr::ReturnOrDeleteOldMails(bool serverUp) do { Field* fields = items->Fetch(); - item.item_guid = fields[0].GetUInt32(); + item.item_guid = fields[0].GetUInt64(); item.item_template = fields[1].GetUInt32(); uint32 mailId = fields[2].GetUInt32(); itemsCache[mailId].push_back(item); @@ -6442,14 +6442,14 @@ void ObjectMgr::ReturnOrDeleteOldMails(bool serverUp) do { Field* fields = result->Fetch(); - ObjectGuid::LowType receiver = fields[3].GetUInt32(); + ObjectGuid::LowType receiver = fields[3].GetUInt64(); if (serverUp && ObjectAccessor::FindConnectedPlayer(ObjectGuid(HighGuid::Player, receiver))) continue; Mail* m = new Mail; m->messageID = fields[0].GetUInt32(); m->messageType = fields[1].GetUInt8(); - m->sender = fields[2].GetUInt32(); + m->sender = fields[2].GetUInt64(); m->receiver = receiver; bool has_items = fields[4].GetBool(); m->expire_time = time_t(fields[5].GetUInt32()); @@ -6471,7 +6471,7 @@ void ObjectMgr::ReturnOrDeleteOldMails(bool serverUp) for (MailItemInfoVec::iterator itr2 = m->items.begin(); itr2 != m->items.end(); ++itr2) { stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_INSTANCE); - stmt->setUInt32(0, itr2->item_guid); + stmt->setUInt64(0, itr2->item_guid); CharacterDatabase.Execute(stmt); } @@ -6483,8 +6483,8 @@ void ObjectMgr::ReturnOrDeleteOldMails(bool serverUp) { // Mail will be returned stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_MAIL_RETURNED); - stmt->setUInt32(0, m->receiver); - stmt->setUInt32(1, m->sender); + stmt->setUInt64(0, m->receiver); + stmt->setUInt64(1, m->sender); stmt->setUInt32(2, basetime + 30 * DAY); stmt->setUInt32(3, basetime); stmt->setUInt8 (4, uint8(MAIL_CHECK_MASK_RETURNED)); @@ -6494,13 +6494,13 @@ void ObjectMgr::ReturnOrDeleteOldMails(bool serverUp) { // Update receiver in mail items for its proper delivery, and in instance_item for avoid lost item at sender delete stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_MAIL_ITEM_RECEIVER); - stmt->setUInt32(0, m->sender); - stmt->setUInt32(1, itr2->item_guid); + stmt->setUInt64(0, m->sender); + stmt->setUInt64(1, itr2->item_guid); CharacterDatabase.Execute(stmt); stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ITEM_OWNER); - stmt->setUInt32(0, m->sender); - stmt->setUInt32(1, itr2->item_guid); + stmt->setUInt64(0, m->sender); + stmt->setUInt64(1, itr2->item_guid); CharacterDatabase.Execute(stmt); } delete m; @@ -7929,7 +7929,7 @@ void ObjectMgr::LoadGameObjectOverrides() { Field* fields = result->Fetch(); - ObjectGuid::LowType spawnId = fields[0].GetUInt32(); + ObjectGuid::LowType spawnId = fields[0].GetUInt64(); GameObjectData const* goData = GetGameObjectData(spawnId); if (!goData) { diff --git a/src/server/game/Groups/Group.cpp b/src/server/game/Groups/Group.cpp index 3a810588522b2..210ce91cb4d2a 100644 --- a/src/server/game/Groups/Group.cpp +++ b/src/server/game/Groups/Group.cpp @@ -189,9 +189,9 @@ bool Group::Create(Player* leader) uint8 index = 0; stmt->setUInt32(index++, m_dbStoreId); - stmt->setUInt32(index++, m_leaderGuid.GetCounter()); + stmt->setUInt64(index++, m_leaderGuid.GetCounter()); stmt->setUInt8(index++, uint8(m_lootMethod)); - stmt->setUInt32(index++, m_looterGuid.GetCounter()); + stmt->setUInt64(index++, m_looterGuid.GetCounter()); stmt->setUInt8(index++, uint8(m_lootThreshold)); stmt->setUInt64(index++, m_targetIcons[0].GetRawValue()); stmt->setUInt64(index++, m_targetIcons[1].GetRawValue()); @@ -204,7 +204,7 @@ bool Group::Create(Player* leader) stmt->setUInt8(index++, uint8(m_groupType)); stmt->setUInt32(index++, uint8(m_dungeonDifficulty)); stmt->setUInt32(index++, uint8(m_raidDifficulty)); - stmt->setUInt32(index++, m_masterLooterGuid.GetCounter()); + stmt->setUInt64(index++, m_masterLooterGuid.GetCounter()); CharacterDatabase.Execute(stmt); @@ -223,14 +223,14 @@ void Group::LoadGroupFromDB(Field* fields) { m_dbStoreId = fields[16].GetUInt32(); m_guid = ObjectGuid(HighGuid::Group, sGroupMgr->GenerateGroupId()); - m_leaderGuid = ObjectGuid(HighGuid::Player, fields[0].GetUInt32()); + m_leaderGuid = ObjectGuid(HighGuid::Player, fields[0].GetUInt64()); // group leader not exist if (!sCharacterCache->GetCharacterNameByGuid(m_leaderGuid, m_leaderName)) return; m_lootMethod = LootMethod(fields[1].GetUInt8()); - m_looterGuid = ObjectGuid(HighGuid::Player, fields[2].GetUInt32()); + m_looterGuid = ObjectGuid(HighGuid::Player, fields[2].GetUInt64()); m_lootThreshold = ItemQualities(fields[3].GetUInt8()); for (uint8 i = 0; i < TARGET_ICONS_COUNT; ++i) @@ -252,7 +252,7 @@ void Group::LoadGroupFromDB(Field* fields) else m_raidDifficulty = Difficulty(r_diff); - m_masterLooterGuid = ObjectGuid(HighGuid::Player, fields[15].GetUInt32()); + m_masterLooterGuid = ObjectGuid(HighGuid::Player, fields[15].GetUInt64()); if (m_groupType & GROUPTYPE_LFG) sLFGMgr->_LoadFromDB(fields, GetGUID()); @@ -267,7 +267,7 @@ void Group::LoadMemberFromDB(ObjectGuid::LowType guidLow, uint8 memberFlags, uin if (!sCharacterCache->GetCharacterNameByGuid(member.guid, member.name)) { CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_GROUP_MEMBER); - stmt->setUInt32(0, guidLow); + stmt->setUInt64(0, guidLow); CharacterDatabase.Execute(stmt); return; } @@ -449,7 +449,7 @@ bool Group::AddMember(Player* player) CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_GROUP_MEMBER); stmt->setUInt32(0, m_dbStoreId); - stmt->setUInt32(1, member.guid.GetCounter()); + stmt->setUInt64(1, member.guid.GetCounter()); stmt->setUInt8(2, member.flags); stmt->setUInt8(3, member.group); stmt->setUInt8(4, member.roles); @@ -623,7 +623,7 @@ bool Group::RemoveMember(ObjectGuid guid, RemoveMethod const& method /*= GROUP_R if (!isBGGroup() && !isBFGroup()) { CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_GROUP_MEMBER); - stmt->setUInt32(0, guid.GetCounter()); + stmt->setUInt64(0, guid.GetCounter()); CharacterDatabase.Execute(stmt); DelinkMember(guid); } @@ -749,7 +749,7 @@ void Group::ChangeLeader(ObjectGuid newLeaderGuid) // Update the group leader CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_GROUP_LEADER); - stmt->setUInt32(0, newLeader->GetGUID().GetCounter()); + stmt->setUInt64(0, newLeader->GetGUID().GetCounter()); stmt->setUInt32(1, m_dbStoreId); trans->Append(stmt); @@ -1864,7 +1864,7 @@ bool Group::_setMembersGroup(ObjectGuid guid, uint8 group) CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_GROUP_MEMBER_SUBGROUP); stmt->setUInt8(0, group); - stmt->setUInt32(1, guid.GetCounter()); + stmt->setUInt64(1, guid.GetCounter()); CharacterDatabase.Execute(stmt); } @@ -1915,7 +1915,7 @@ void Group::ChangeMembersGroup(ObjectGuid guid, uint8 group) CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_GROUP_MEMBER_SUBGROUP); stmt->setUInt8(0, group); - stmt->setUInt32(1, guid.GetCounter()); + stmt->setUInt64(1, guid.GetCounter()); CharacterDatabase.Execute(stmt); } @@ -2256,7 +2256,7 @@ void Group::ResetInstances(uint8 method, bool isRaid, Player* SendMsgTo) stmt->setFloat(3, instanceEntrance->target_Orientation); stmt->setUInt32(4, graveyardLocation->Continent); stmt->setUInt32(5, zoneId); - stmt->setUInt32(6, member.guid.GetCounter()); + stmt->setUInt64(6, member.guid.GetCounter()); stmt->setUInt32(7, map->GetId()); CharacterDatabase.Execute(stmt); @@ -2610,7 +2610,7 @@ void Group::SetGroupMemberFlag(ObjectGuid guid, bool apply, GroupMemberFlags fla CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_GROUP_MEMBER_FLAG); stmt->setUInt8(0, slot->flags); - stmt->setUInt32(1, guid.GetCounter()); + stmt->setUInt64(1, guid.GetCounter()); CharacterDatabase.Execute(stmt); diff --git a/src/server/game/Groups/GroupMgr.cpp b/src/server/game/Groups/GroupMgr.cpp index 4a64c5a42a1ce..1c9d9691f3386 100644 --- a/src/server/game/Groups/GroupMgr.cpp +++ b/src/server/game/Groups/GroupMgr.cpp @@ -195,7 +195,7 @@ void GroupMgr::LoadGroups() Group* group = GetGroupByDbStoreId(fields[0].GetUInt32()); if (group) - group->LoadMemberFromDB(fields[1].GetUInt32(), fields[2].GetUInt8(), fields[3].GetUInt8(), fields[4].GetUInt8()); + group->LoadMemberFromDB(fields[1].GetUInt64(), fields[2].GetUInt8(), fields[3].GetUInt8(), fields[4].GetUInt8()); else TC_LOG_ERROR("misc", "GroupMgr::LoadGroups: Consistency failed, can't find group (storage id: {})", fields[0].GetUInt32()); diff --git a/src/server/game/Guilds/Guild.cpp b/src/server/game/Guilds/Guild.cpp index 78d88531ddaf6..9eed04e4bdffa 100644 --- a/src/server/game/Guilds/Guild.cpp +++ b/src/server/game/Guilds/Guild.cpp @@ -178,8 +178,8 @@ void Guild::EventLogEntry::SaveToDB(CharacterDatabaseTransaction trans) const stmt->setUInt32( index, m_guildId); stmt->setUInt32(++index, m_guid); stmt->setUInt8 (++index, uint8(m_eventType)); - stmt->setUInt32(++index, m_playerGuid1); - stmt->setUInt32(++index, m_playerGuid2); + stmt->setUInt64(++index, m_playerGuid1); + stmt->setUInt64(++index, m_playerGuid2); stmt->setUInt8 (++index, m_newRank); stmt->setUInt64(++index, m_timestamp); trans->Append(stmt); @@ -216,7 +216,7 @@ void Guild::BankEventLogEntry::SaveToDB(CharacterDatabaseTransaction trans) cons stmt->setUInt32(++index, m_guid); stmt->setUInt8 (++index, m_bankTabId); stmt->setUInt8 (++index, uint8(m_eventType)); - stmt->setUInt32(++index, m_playerGuid); + stmt->setUInt64(++index, m_playerGuid); stmt->setUInt32(++index, m_itemOrMoney); stmt->setUInt16(++index, m_itemStackCount); stmt->setUInt8 (++index, m_destTabId); @@ -381,7 +381,7 @@ void Guild::BankTab::LoadFromDB(Field* fields) bool Guild::BankTab::LoadItemFromDB(Field* fields) { uint8 slotId = fields[13].GetUInt8(); - ObjectGuid::LowType itemGuid = fields[14].GetUInt32(); + ObjectGuid::LowType itemGuid = fields[14].GetUInt64(); uint32 itemEntry = fields[15].GetUInt32(); if (slotId >= GUILD_BANK_MAX_SLOTS) { @@ -484,7 +484,7 @@ bool Guild::BankTab::SetItem(CharacterDatabaseTransaction trans, uint8 slotId, I stmt->setUInt32(0, m_guildId); stmt->setUInt8 (1, m_tabId); stmt->setUInt8 (2, slotId); - stmt->setUInt32(3, item->GetGUID().GetCounter()); + stmt->setUInt64(3, item->GetGUID().GetCounter()); trans->Append(stmt); item->SetGuidValue(ITEM_FIELD_CONTAINED, ObjectGuid::Empty); @@ -558,7 +558,7 @@ void Guild::Member::SetPublicNote(std::string_view publicNote) CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_GUILD_MEMBER_PNOTE); stmt->setString(0, m_publicNote); - stmt->setUInt32(1, m_guid.GetCounter()); + stmt->setUInt64(1, m_guid.GetCounter()); CharacterDatabase.Execute(stmt); } @@ -571,7 +571,7 @@ void Guild::Member::SetOfficerNote(std::string_view officerNote) CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_GUILD_MEMBER_OFFNOTE); stmt->setString(0, m_officerNote); - stmt->setUInt32(1, m_guid.GetCounter()); + stmt->setUInt64(1, m_guid.GetCounter()); CharacterDatabase.Execute(stmt); } @@ -585,7 +585,7 @@ void Guild::Member::ChangeRank(CharacterDatabaseTransaction trans, uint8 newRank CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_GUILD_MEMBER_RANK); stmt->setUInt8 (0, newRank); - stmt->setUInt32(1, m_guid.GetCounter()); + stmt->setUInt64(1, m_guid.GetCounter()); CharacterDatabase.ExecuteOrAppend(trans, stmt); } @@ -598,7 +598,7 @@ void Guild::Member::SaveToDB(CharacterDatabaseTransaction trans) const { CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_GUILD_MEMBER); stmt->setUInt32(0, m_guildId); - stmt->setUInt32(1, m_guid.GetCounter()); + stmt->setUInt64(1, m_guid.GetCounter()); stmt->setUInt8 (2, m_rankId); stmt->setString(3, m_publicNote); stmt->setString(4, m_officerNote); @@ -672,7 +672,7 @@ void Guild::Member::UpdateBankWithdrawValue(CharacterDatabaseTransaction trans, m_bankWithdraw[tabId] += amount; CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_GUILD_MEMBER_WITHDRAW); - stmt->setUInt32(0, m_guid.GetCounter()); + stmt->setUInt64(0, m_guid.GetCounter()); for (uint8 i = 0; i <= GUILD_BANK_MAX_TABS;) { uint32 withdraw = m_bankWithdraw[i++]; @@ -1115,7 +1115,7 @@ bool Guild::Create(Player* pLeader, std::string_view name) stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_GUILD); stmt->setUInt32( index, m_id); stmt->setString(++index, m_name); - stmt->setUInt32(++index, m_leaderGuid.GetCounter()); + stmt->setUInt64(++index, m_leaderGuid.GetCounter()); stmt->setString(++index, m_info); stmt->setString(++index, m_motd); stmt->setUInt64(++index, uint32(m_createdDate)); @@ -1917,7 +1917,7 @@ bool Guild::LoadFromDB(Field* fields) { m_id = fields[0].GetUInt32(); m_name = fields[1].GetString(); - m_leaderGuid = ObjectGuid(HighGuid::Player, fields[2].GetUInt32()); + m_leaderGuid = ObjectGuid(HighGuid::Player, fields[2].GetUInt64()); m_emblemInfo.LoadFromDB(fields); m_info = fields[8].GetString(); m_motd = fields[9].GetString(); @@ -1946,7 +1946,7 @@ void Guild::LoadRankFromDB(Field* fields) bool Guild::LoadMemberFromDB(Field* fields) { - ObjectGuid::LowType lowguid = fields[1].GetUInt32(); + ObjectGuid::LowType lowguid = fields[1].GetUInt64(); ObjectGuid playerGuid(HighGuid::Player, lowguid); auto [memberIt, isNew] = m_members.try_emplace(lowguid, m_id, playerGuid, fields[2].GetUInt8()); @@ -1986,8 +1986,8 @@ bool Guild::LoadEventLogFromDB(Field* fields) fields[1].GetUInt32(), // guid time_t(fields[6].GetUInt32()), // timestamp GuildEventLogTypes(fields[2].GetUInt8()), // event type - fields[3].GetUInt32(), // player guid 1 - fields[4].GetUInt32(), // player guid 2 + fields[3].GetUInt64(), // player guid 1 + fields[4].GetUInt64(), // player guid 2 fields[5].GetUInt8()); // rank return true; } @@ -2004,7 +2004,7 @@ bool Guild::LoadBankEventLogFromDB(Field* fields) LogHolder& bankLog = m_bankEventLog[tabId]; if (bankLog.CanInsert()) { - ObjectGuid::LowType guid = fields[2].GetUInt32(); + ObjectGuid::LowType guid = fields[2].GetUInt64(); GuildBankEventLogTypes eventType = GuildBankEventLogTypes(fields[3].GetUInt8()); if (BankEventLogEntry::IsMoneyEvent(eventType)) { @@ -2025,7 +2025,7 @@ bool Guild::LoadBankEventLogFromDB(Field* fields) time_t(fields[8].GetUInt32()), // timestamp dbTabId, // tab id eventType, // event type - fields[4].GetUInt32(), // player guid + fields[4].GetUInt64(), // player guid fields[5].GetUInt32(), // item or money fields[6].GetUInt16(), // itam stack count fields[7].GetUInt8()); // dest tab id @@ -2049,7 +2049,7 @@ bool Guild::LoadBankItemFromDB(Field* fields) if (tabId >= _GetPurchasedTabsSize()) { TC_LOG_ERROR("guild", "Invalid tab for item (GUID: {}, id: #{}) in guild bank, skipped.", - fields[14].GetUInt32(), fields[15].GetUInt32()); + fields[14].GetUInt64(), fields[15].GetUInt32()); return false; } return m_bankTabs[tabId].LoadItemFromDB(fields); @@ -2231,7 +2231,7 @@ bool Guild::AddMember(CharacterDatabaseTransaction trans, ObjectGuid guid, uint8 bool ok = false; // Player must exist CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_DATA_FOR_GUILD); - stmt->setUInt32(0, lowguid); + stmt->setUInt64(0, lowguid); if (PreparedQueryResult result = CharacterDatabase.Query(stmt)) { Field* fields = result->Fetch(); @@ -2408,7 +2408,7 @@ bool Guild::_HasRankRight(Player* player, uint32 right) const void Guild::_DeleteMemberFromDB(CharacterDatabaseTransaction trans, ObjectGuid::LowType lowguid) { CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_GUILD_MEMBER); - stmt->setUInt32(0, lowguid); + stmt->setUInt64(0, lowguid); CharacterDatabase.ExecuteOrAppend(trans, stmt); } @@ -2540,7 +2540,7 @@ void Guild::_SetLeader(CharacterDatabaseTransaction trans, Member& leader) leader.ChangeRank(trans, GR_GUILDMASTER); CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_GUILD_LEADER); - stmt->setUInt32(0, m_leaderGuid.GetCounter()); + stmt->setUInt64(0, m_leaderGuid.GetCounter()); stmt->setUInt32(1, m_id); trans->Append(stmt); diff --git a/src/server/game/Handlers/BattleGroundHandler.cpp b/src/server/game/Handlers/BattleGroundHandler.cpp index 81f3591dc9837..2f82c0d54c4bc 100644 --- a/src/server/game/Handlers/BattleGroundHandler.cpp +++ b/src/server/game/Handlers/BattleGroundHandler.cpp @@ -1,4 +1,4 @@ -/* +/* * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information * * This program is free software; you can redistribute it and/or modify it @@ -449,7 +449,7 @@ void WorldSession::HandleBattleFieldPortOpcode(WorldPackets::Battleground::Battl (bg->GetStatus() == STATUS_IN_PROGRESS || bg->GetStatus() == STATUS_WAIT_JOIN)) { CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_DESERTER_TRACK); - stmt->setUInt32(0, _player->GetGUID().GetCounter()); + stmt->setUInt64(0, _player->GetGUID().GetCounter()); stmt->setUInt8(1, BG_DESERTION_TYPE_LEAVE_QUEUE); CharacterDatabase.Execute(stmt); } diff --git a/src/server/game/Handlers/CharacterHandler.cpp b/src/server/game/Handlers/CharacterHandler.cpp index bd916a61f8622..3197fb5ea341c 100644 --- a/src/server/game/Handlers/CharacterHandler.cpp +++ b/src/server/game/Handlers/CharacterHandler.cpp @@ -75,142 +75,142 @@ bool LoginQueryHolder::Initialize() ObjectGuid::LowType lowGuid = m_guid.GetCounter(); CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER); - stmt->setUInt32(0, lowGuid); + stmt->setUInt64(0, lowGuid); res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOAD_FROM, stmt); stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_GROUP_MEMBER); - stmt->setUInt32(0, lowGuid); + stmt->setUInt64(0, lowGuid); res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOAD_GROUP, stmt); stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_INSTANCE); - stmt->setUInt32(0, lowGuid); + stmt->setUInt64(0, lowGuid); res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOAD_BOUND_INSTANCES, stmt); stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_AURAS); - stmt->setUInt32(0, lowGuid); + stmt->setUInt64(0, lowGuid); res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOAD_AURAS, stmt); stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_SPELL); - stmt->setUInt32(0, lowGuid); + stmt->setUInt64(0, lowGuid); res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOAD_SPELLS, stmt); stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_QUESTSTATUS); - stmt->setUInt32(0, lowGuid); + stmt->setUInt64(0, lowGuid); res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOAD_QUEST_STATUS, stmt); stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_QUESTSTATUS_DAILY); - stmt->setUInt32(0, lowGuid); + stmt->setUInt64(0, lowGuid); res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOAD_DAILY_QUEST_STATUS, stmt); stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_QUESTSTATUS_WEEKLY); - stmt->setUInt32(0, lowGuid); + stmt->setUInt64(0, lowGuid); res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOAD_WEEKLY_QUEST_STATUS, stmt); stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_QUESTSTATUS_MONTHLY); - stmt->setUInt32(0, lowGuid); + stmt->setUInt64(0, lowGuid); res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOAD_MONTHLY_QUEST_STATUS, stmt); stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_QUESTSTATUS_SEASONAL); - stmt->setUInt32(0, lowGuid); + stmt->setUInt64(0, lowGuid); res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOAD_SEASONAL_QUEST_STATUS, stmt); stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_REPUTATION); - stmt->setUInt32(0, lowGuid); + stmt->setUInt64(0, lowGuid); res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOAD_REPUTATION, stmt); stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_INVENTORY); - stmt->setUInt32(0, lowGuid); + stmt->setUInt64(0, lowGuid); res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOAD_INVENTORY, stmt); stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_ACTIONS); - stmt->setUInt32(0, lowGuid); + stmt->setUInt64(0, lowGuid); res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOAD_ACTIONS, stmt); stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_MAIL); - stmt->setUInt32(0, lowGuid); + stmt->setUInt64(0, lowGuid); res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOAD_MAILS, stmt); stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_MAILITEMS); - stmt->setUInt32(0, lowGuid); + stmt->setUInt64(0, lowGuid); res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOAD_MAIL_ITEMS, stmt); stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_SOCIALLIST); - stmt->setUInt32(0, lowGuid); + stmt->setUInt64(0, lowGuid); res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOAD_SOCIAL_LIST, stmt); stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_HOMEBIND); - stmt->setUInt32(0, lowGuid); + stmt->setUInt64(0, lowGuid); res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOAD_HOME_BIND, stmt); stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_SPELLCOOLDOWNS); - stmt->setUInt32(0, lowGuid); + stmt->setUInt64(0, lowGuid); res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOAD_SPELL_COOLDOWNS, stmt); if (sWorld->getBoolConfig(CONFIG_DECLINED_NAMES_USED)) { stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_DECLINEDNAMES); - stmt->setUInt32(0, lowGuid); + stmt->setUInt64(0, lowGuid); res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOAD_DECLINED_NAMES, stmt); } stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_GUILD_MEMBER); - stmt->setUInt32(0, lowGuid); + stmt->setUInt64(0, lowGuid); res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOAD_GUILD, stmt); stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_ARENAINFO); - stmt->setUInt32(0, lowGuid); + stmt->setUInt64(0, lowGuid); res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOAD_ARENA_INFO, stmt); stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_ACHIEVEMENTS); - stmt->setUInt32(0, lowGuid); + stmt->setUInt64(0, lowGuid); res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOAD_ACHIEVEMENTS, stmt); stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_CRITERIAPROGRESS); - stmt->setUInt32(0, lowGuid); + stmt->setUInt64(0, lowGuid); res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOAD_CRITERIA_PROGRESS, stmt); stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_EQUIPMENTSETS); - stmt->setUInt32(0, lowGuid); + stmt->setUInt64(0, lowGuid); res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOAD_EQUIPMENT_SETS, stmt); stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_BGDATA); - stmt->setUInt32(0, lowGuid); + stmt->setUInt64(0, lowGuid); res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOAD_BG_DATA, stmt); stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_GLYPHS); - stmt->setUInt32(0, lowGuid); + stmt->setUInt64(0, lowGuid); res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOAD_GLYPHS, stmt); stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_TALENTS); - stmt->setUInt32(0, lowGuid); + stmt->setUInt64(0, lowGuid); res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOAD_TALENTS, stmt); stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PLAYER_ACCOUNT_DATA); - stmt->setUInt32(0, lowGuid); + stmt->setUInt64(0, lowGuid); res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOAD_ACCOUNT_DATA, stmt); stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_SKILLS); - stmt->setUInt32(0, lowGuid); + stmt->setUInt64(0, lowGuid); res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOAD_SKILLS, stmt); stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_RANDOMBG); - stmt->setUInt32(0, lowGuid); + stmt->setUInt64(0, lowGuid); res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOAD_RANDOM_BG, stmt); stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_BANNED); - stmt->setUInt32(0, lowGuid); + stmt->setUInt64(0, lowGuid); res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOAD_BANNED, stmt); stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_QUESTSTATUSREW); - stmt->setUInt32(0, lowGuid); + stmt->setUInt64(0, lowGuid); res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOAD_QUEST_STATUS_REW, stmt); stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CORPSE_LOCATION); - stmt->setUInt32(0, lowGuid); + stmt->setUInt64(0, lowGuid); res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOAD_CORPSE_LOCATION, stmt); stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_PETS); - stmt->setUInt32(0, lowGuid); + stmt->setUInt64(0, lowGuid); res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOAD_PET_SLOTS, stmt); return res; @@ -229,7 +229,7 @@ void WorldSession::HandleCharEnum(PreparedQueryResult result) { do { - ObjectGuid guid(HighGuid::Player, (*result)[0].GetUInt32()); + ObjectGuid guid(HighGuid::Player, (*result)[0].GetUInt64()); TC_LOG_INFO("network", "Loading {} from account {}.", guid.ToString(), GetAccountId()); if (Player::BuildEnumData(result, &data)) { @@ -836,7 +836,7 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder const& holder) pCurrChar->SendInitialPacketsAfterAddToMap(); CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHAR_ONLINE); - stmt->setUInt32(0, pCurrChar->GetGUID().GetCounter()); + stmt->setUInt64(0, pCurrChar->GetGUID().GetCounter()); CharacterDatabase.Execute(stmt); LoginDatabasePreparedStatement* loginStmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_ACCOUNT_ONLINE); @@ -1130,7 +1130,7 @@ void WorldSession::HandleCharRenameOpcode(WorldPacket& recvData) // and that there is no character with the desired new name CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_FREE_NAME); - stmt->setUInt32(0, renameInfo->Guid.GetCounter()); + stmt->setUInt64(0, renameInfo->Guid.GetCounter()); stmt->setUInt32(1, GetAccountId()); stmt->setString(2, renameInfo->Name); @@ -1148,7 +1148,7 @@ void WorldSession::HandleCharRenameCallBack(std::shared_ptr Field* fields = result->Fetch(); - ObjectGuid::LowType guidLow = fields[0].GetUInt32(); + ObjectGuid::LowType guidLow = fields[0].GetUInt64(); std::string oldName = fields[1].GetString(); uint16 atLoginFlags = fields[2].GetUInt16(); @@ -1167,14 +1167,14 @@ void WorldSession::HandleCharRenameCallBack(std::shared_ptr stmt->setString(0, renameInfo->Name); stmt->setUInt16(1, atLoginFlags); - stmt->setUInt32(2, guidLow); + stmt->setUInt64(2, guidLow); CharacterDatabase.Execute(stmt); // Removed declined name from db stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_DECLINED_NAME); - stmt->setUInt32(0, guidLow); + stmt->setUInt64(0, guidLow); CharacterDatabase.Execute(stmt); @@ -1245,11 +1245,11 @@ void WorldSession::HandleSetPlayerDeclinedNames(WorldPacket& recvData) CharacterDatabaseTransaction trans = CharacterDatabase.BeginTransaction(); CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_DECLINED_NAME); - stmt->setUInt32(0, guid.GetCounter()); + stmt->setUInt64(0, guid.GetCounter()); trans->Append(stmt); stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHAR_DECLINED_NAME); - stmt->setUInt32(0, guid.GetCounter()); + stmt->setUInt64(0, guid.GetCounter()); for (uint8 i = 0; i < 5; i++) stmt->setString(i+1, declinedname.name[i]); @@ -1373,7 +1373,7 @@ void WorldSession::HandleCharCustomize(WorldPacket& recvData) >> customizeInfo->Face; CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_CUSTOMIZE_INFO); - stmt->setUInt32(0, customizeInfo->Guid.GetCounter()); + stmt->setUInt64(0, customizeInfo->Guid.GetCounter()); _queryProcessor.AddCallback(CharacterDatabase.AsyncQuery(stmt) .WithPreparedCallback(std::bind(&WorldSession::HandleCharCustomizeCallback, this, customizeInfo, std::placeholders::_1))); @@ -1459,12 +1459,12 @@ void WorldSession::HandleCharCustomizeCallback(std::shared_ptrsetString(0, customizeInfo->Name); stmt->setUInt16(1, atLoginFlags); - stmt->setUInt32(2, lowGuid); + stmt->setUInt64(2, lowGuid); trans->Append(stmt); stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_DECLINED_NAME); - stmt->setUInt32(0, lowGuid); + stmt->setUInt64(0, lowGuid); trans->Append(stmt); } @@ -1629,7 +1629,7 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recvData) factionChangeInfo->FactionChange = (recvData.GetOpcode() == CMSG_CHAR_FACTION_CHANGE); CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_RACE_OR_FACTION_CHANGE_INFOS); - stmt->setUInt32(0, factionChangeInfo->Guid.GetCounter()); + stmt->setUInt64(0, factionChangeInfo->Guid.GetCounter()); _queryProcessor.AddCallback(CharacterDatabase.AsyncQuery(stmt) .WithPreparedCallback(std::bind(&WorldSession::HandleCharFactionOrRaceChangeCallback, this, factionChangeInfo, std::placeholders::_1))); @@ -1765,11 +1765,11 @@ void WorldSession::HandleCharFactionOrRaceChangeCallback(std::shared_ptrsetString(0, factionChangeInfo->Name); stmt->setUInt16(1, uint16((atLoginFlags | AT_LOGIN_RESURRECT) & ~usedLoginFlag)); - stmt->setUInt32(2, lowGuid); + stmt->setUInt64(2, lowGuid); trans->Append(stmt); stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_DECLINED_NAME); - stmt->setUInt32(0, lowGuid); + stmt->setUInt64(0, lowGuid); trans->Append(stmt); } @@ -1781,7 +1781,7 @@ void WorldSession::HandleCharFactionOrRaceChangeCallback(std::shared_ptrsetUInt8(0, factionChangeInfo->Race); stmt->setUInt16(1, PLAYER_EXTRA_HAS_RACE_CHANGED); - stmt->setUInt32(2, lowGuid); + stmt->setUInt64(2, lowGuid); trans->Append(stmt); } @@ -1792,12 +1792,12 @@ void WorldSession::HandleCharFactionOrRaceChangeCallback(std::shared_ptrsetUInt32(0, lowGuid); + stmt->setUInt64(0, lowGuid); trans->Append(stmt); // Now add them back stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHAR_SKILL_LANGUAGE); - stmt->setUInt32(0, lowGuid); + stmt->setUInt64(0, lowGuid); // Faction specific languages if (newTeam == HORDE) @@ -1811,7 +1811,7 @@ void WorldSession::HandleCharFactionOrRaceChangeCallback(std::shared_ptrRace != RACE_ORC && factionChangeInfo->Race != RACE_HUMAN) { stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHAR_SKILL_LANGUAGE); - stmt->setUInt32(0, lowGuid); + stmt->setUInt64(0, lowGuid); switch (factionChangeInfo->Race) { @@ -1848,7 +1848,7 @@ void WorldSession::HandleCharFactionOrRaceChangeCallback(std::shared_ptrsetUInt32(0, lowGuid); + stmt->setUInt64(0, lowGuid); trans->Append(stmt); if (level > 7) @@ -1874,7 +1874,7 @@ void WorldSession::HandleCharFactionOrRaceChangeCallback(std::shared_ptrsetString(0, taximaskstream.str()); - stmt->setUInt32(1, lowGuid); + stmt->setUInt64(1, lowGuid); trans->Append(stmt); } @@ -1897,21 +1897,21 @@ void WorldSession::HandleCharFactionOrRaceChangeCallback(std::shared_ptrsetUInt32(0, lowGuid); + stmt->setUInt64(0, lowGuid); trans->Append(stmt); stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_SOCIAL_BY_FRIEND); - stmt->setUInt32(0, lowGuid); + stmt->setUInt64(0, lowGuid); trans->Append(stmt); } // Reset homebind and position stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_PLAYER_HOMEBIND); - stmt->setUInt32(0, lowGuid); + stmt->setUInt64(0, lowGuid); trans->Append(stmt); stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_PLAYER_HOMEBIND); - stmt->setUInt32(0, lowGuid); + stmt->setUInt64(0, lowGuid); WorldLocation loc; uint16 zoneId = 0; @@ -1943,13 +1943,13 @@ void WorldSession::HandleCharFactionOrRaceChangeCallback(std::shared_ptrsetUInt16(0, uint16(newTeam == ALLIANCE ? achiev_alliance : achiev_horde)); - stmt->setUInt32(1, lowGuid); + stmt->setUInt64(1, lowGuid); trans->Append(stmt); stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHAR_ACHIEVEMENT); stmt->setUInt16(0, uint16(newTeam == ALLIANCE ? achiev_alliance : achiev_horde)); stmt->setUInt16(1, uint16(newTeam == ALLIANCE ? achiev_horde : achiev_alliance)); - stmt->setUInt32(2, lowGuid); + stmt->setUInt64(2, lowGuid); trans->Append(stmt); } @@ -1962,13 +1962,13 @@ void WorldSession::HandleCharFactionOrRaceChangeCallback(std::shared_ptrsetUInt32(0, (newTeam == ALLIANCE ? item_alliance : item_horde)); stmt->setUInt32(1, (newTeam == ALLIANCE ? item_horde : item_alliance)); - stmt->setUInt32(2, lowGuid); + stmt->setUInt64(2, lowGuid); trans->Append(stmt); } // Delete all current quests stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_QUESTSTATUS); - stmt->setUInt32(0, lowGuid); + stmt->setUInt64(0, lowGuid); trans->Append(stmt); // Quest conversion @@ -1978,20 +1978,20 @@ void WorldSession::HandleCharFactionOrRaceChangeCallback(std::shared_ptrsecond; stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_QUESTSTATUS_REWARDED_BY_QUEST); - stmt->setUInt32(0, lowGuid); + stmt->setUInt64(0, lowGuid); stmt->setUInt32(1, (newTeam == ALLIANCE ? quest_alliance : quest_horde)); trans->Append(stmt); stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHAR_QUESTSTATUS_REWARDED_FACTION_CHANGE); stmt->setUInt32(0, (newTeam == ALLIANCE ? quest_alliance : quest_horde)); stmt->setUInt32(1, (newTeam == ALLIANCE ? quest_horde : quest_alliance)); - stmt->setUInt32(2, lowGuid); + stmt->setUInt64(2, lowGuid); trans->Append(stmt); } // Mark all rewarded quests as "active" (will count for completed quests achievements) stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHAR_QUESTSTATUS_REWARDED_ACTIVE); - stmt->setUInt32(0, lowGuid); + stmt->setUInt64(0, lowGuid); trans->Append(stmt); // Disable all old-faction specific quests @@ -2003,7 +2003,7 @@ void WorldSession::HandleCharFactionOrRaceChangeCallback(std::shared_ptrGetAllowableRaces() && !(quest->GetAllowableRaces() & newRaceMask)) { stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHAR_QUESTSTATUS_REWARDED_ACTIVE_BY_QUEST); - stmt->setUInt32(0, lowGuid); + stmt->setUInt64(0, lowGuid); stmt->setUInt32(1, questId); trans->Append(stmt); } @@ -2018,13 +2018,13 @@ void WorldSession::HandleCharFactionOrRaceChangeCallback(std::shared_ptrsetUInt32(0, (newTeam == ALLIANCE ? spell_alliance : spell_horde)); - stmt->setUInt32(1, lowGuid); + stmt->setUInt64(1, lowGuid); trans->Append(stmt); stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHAR_SPELL_FACTION_CHANGE); stmt->setUInt32(0, (newTeam == ALLIANCE ? spell_alliance : spell_horde)); stmt->setUInt32(1, (newTeam == ALLIANCE ? spell_horde : spell_alliance)); - stmt->setUInt32(2, lowGuid); + stmt->setUInt64(2, lowGuid); trans->Append(stmt); } @@ -2039,7 +2039,7 @@ void WorldSession::HandleCharFactionOrRaceChangeCallback(std::shared_ptrsetUInt32(0, oldReputation); - stmt->setUInt32(1, lowGuid); + stmt->setUInt64(1, lowGuid); if (PreparedQueryResult reputationResult = CharacterDatabase.Query(stmt)) { @@ -2059,14 +2059,14 @@ void WorldSession::HandleCharFactionOrRaceChangeCallback(std::shared_ptrsetUInt32(0, newReputation); - stmt->setUInt32(1, lowGuid); + stmt->setUInt64(1, lowGuid); trans->Append(stmt); stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHAR_REP_FACTION_CHANGE); stmt->setUInt16(0, uint16(newReputation)); stmt->setInt32(1, newDBRep); stmt->setUInt16(2, uint16(oldReputation)); - stmt->setUInt32(3, lowGuid); + stmt->setUInt64(3, lowGuid); trans->Append(stmt); } } @@ -2134,12 +2134,12 @@ void WorldSession::HandleCharFactionOrRaceChangeCallback(std::shared_ptrsetString(0, ss.str()); - stmt->setUInt32(1, lowGuid); + stmt->setUInt64(1, lowGuid); trans->Append(stmt); // unset any currently chosen title stmt = CharacterDatabase.GetPreparedStatement(CHAR_RES_CHAR_TITLES_FACTION_CHANGE); - stmt->setUInt32(0, lowGuid); + stmt->setUInt64(0, lowGuid); trans->Append(stmt); } } diff --git a/src/server/game/Handlers/ItemHandler.cpp b/src/server/game/Handlers/ItemHandler.cpp index b22de3116025d..09e3fe6f16cc9 100644 --- a/src/server/game/Handlers/ItemHandler.cpp +++ b/src/server/game/Handlers/ItemHandler.cpp @@ -1,4 +1,4 @@ -/* +/* * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information * * This program is free software; you can redistribute it and/or modify it @@ -894,8 +894,8 @@ void WorldSession::HandleWrapItemOpcode(WorldPacket& recvData) CharacterDatabaseTransaction trans = CharacterDatabase.BeginTransaction(); CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHAR_GIFT); - stmt->setUInt32(0, item->GetOwnerGUID().GetCounter()); - stmt->setUInt32(1, item->GetGUID().GetCounter()); + stmt->setUInt64(0, item->GetOwnerGUID().GetCounter()); + stmt->setUInt64(1, item->GetGUID().GetCounter()); stmt->setUInt32(2, item->GetEntry()); stmt->setUInt32(3, item->GetUInt32Value(ITEM_FIELD_FLAGS)); trans->Append(stmt); diff --git a/src/server/game/Handlers/MailHandler.cpp b/src/server/game/Handlers/MailHandler.cpp index 16a4df4dc0bbb..3c1c009d576b5 100644 --- a/src/server/game/Handlers/MailHandler.cpp +++ b/src/server/game/Handlers/MailHandler.cpp @@ -1,4 +1,4 @@ -/* +/* * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information * * This program is free software; you can redistribute it and/or modify it @@ -297,7 +297,7 @@ void WorldSession::HandleSendMail(WorldPackets::Mail::SendMail& sendMail) else { CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_MAIL_COUNT); - stmt->setUInt32(0, receiverGuid.GetCounter()); + stmt->setUInt64(0, receiverGuid.GetCounter()); GetQueryProcessor().AddCallback(CharacterDatabase.AsyncQuery(stmt) .WithPreparedCallback([continuation = std::move(mailCountCheckContinuation), receiverGuid](PreparedQueryResult result) mutable diff --git a/src/server/game/Handlers/NPCHandler.cpp b/src/server/game/Handlers/NPCHandler.cpp index 16edca2543677..7d304d4fa767d 100644 --- a/src/server/game/Handlers/NPCHandler.cpp +++ b/src/server/game/Handlers/NPCHandler.cpp @@ -1,4 +1,4 @@ -/* +/* * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information * * This program is free software; you can redistribute it and/or modify it @@ -424,7 +424,7 @@ void WorldSession::HandleStablePet(WorldPacket& recvData) CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHAR_PET_SLOT_BY_ID); stmt->setUInt8(0, PetSaveMode(PET_SAVE_FIRST_STABLE_SLOT + freeSlot)); - stmt->setUInt32(1, _player->GetGUID().GetCounter()); + stmt->setUInt64(1, _player->GetGUID().GetCounter()); stmt->setUInt32(2, petStable->UnslottedPets[0].PetNumber); CharacterDatabase.Execute(stmt); @@ -509,7 +509,7 @@ void WorldSession::HandleUnstablePet(WorldPacket& recvData) CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHAR_PET_SLOT_BY_ID); stmt->setUInt8(0, PetSaveMode(PET_SAVE_FIRST_STABLE_SLOT + std::distance(petStable->StabledPets.begin(), stabledPet))); - stmt->setUInt32(1, _player->GetGUID().GetCounter()); + stmt->setUInt64(1, _player->GetGUID().GetCounter()); stmt->setUInt32(2, petStable->UnslottedPets[0].PetNumber); CharacterDatabase.Execute(stmt); @@ -534,7 +534,7 @@ void WorldSession::HandleUnstablePet(WorldPacket& recvData) // update current pet slot in db immediately to maintain slot consistency, dismissed pet was already saved CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHAR_PET_SLOT_BY_ID); stmt->setUInt8(0, PET_SAVE_NOT_IN_SLOT); - stmt->setUInt32(1, _player->GetGUID().GetCounter()); + stmt->setUInt64(1, _player->GetGUID().GetCounter()); stmt->setUInt32(2, petnumber); CharacterDatabase.Execute(stmt); @@ -545,7 +545,7 @@ void WorldSession::HandleUnstablePet(WorldPacket& recvData) // update current pet slot in db immediately to maintain slot consistency, dismissed pet was already saved CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHAR_PET_SLOT_BY_ID); stmt->setUInt8(0, PET_SAVE_AS_CURRENT); - stmt->setUInt32(1, _player->GetGUID().GetCounter()); + stmt->setUInt64(1, _player->GetGUID().GetCounter()); stmt->setUInt32(2, petnumber); CharacterDatabase.Execute(stmt); @@ -661,7 +661,7 @@ void WorldSession::HandleStableSwapPet(WorldPacket& recvData) CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHAR_PET_SLOT_BY_ID); stmt->setUInt8(0, PetSaveMode(PET_SAVE_FIRST_STABLE_SLOT + std::distance(petStable->StabledPets.begin(), stabledPet))); - stmt->setUInt32(1, _player->GetGUID().GetCounter()); + stmt->setUInt64(1, _player->GetGUID().GetCounter()); stmt->setUInt32(2, petStable->UnslottedPets[0].PetNumber); CharacterDatabase.Execute(stmt); @@ -688,7 +688,7 @@ void WorldSession::HandleStableSwapPet(WorldPacket& recvData) // update current pet slot in db immediately to maintain slot consistency, dismissed pet was already saved CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHAR_PET_SLOT_BY_ID); stmt->setUInt8(0, PET_SAVE_NOT_IN_SLOT); - stmt->setUInt32(1, _player->GetGUID().GetCounter()); + stmt->setUInt64(1, _player->GetGUID().GetCounter()); stmt->setUInt32(2, petId); CharacterDatabase.Execute(stmt); } @@ -697,7 +697,7 @@ void WorldSession::HandleStableSwapPet(WorldPacket& recvData) // update current pet slot in db immediately to maintain slot consistency, dismissed pet was already saved CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHAR_PET_SLOT_BY_ID); stmt->setUInt8(0, PET_SAVE_AS_CURRENT); - stmt->setUInt32(1, _player->GetGUID().GetCounter()); + stmt->setUInt64(1, _player->GetGUID().GetCounter()); stmt->setUInt32(2, petId); CharacterDatabase.Execute(stmt); diff --git a/src/server/game/Handlers/PetHandler.cpp b/src/server/game/Handlers/PetHandler.cpp index 7c3fa78fd71dd..675db3e5ed12e 100644 --- a/src/server/game/Handlers/PetHandler.cpp +++ b/src/server/game/Handlers/PetHandler.cpp @@ -1,4 +1,4 @@ -/* +/* * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information * * This program is free software; you can redistribute it and/or modify it @@ -648,7 +648,7 @@ void WorldSession::HandlePetRename(WorldPacket& recvData) stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHAR_PET_DECLINEDNAME); stmt->setUInt32(0, pet->GetCharmInfo()->GetPetNumber()); - stmt->setUInt32(1, _player->GetGUID().GetCounter()); + stmt->setUInt64(1, _player->GetGUID().GetCounter()); for (uint8 i = 0; i < 5; i++) stmt->setString(i + 2, declinedname.name[i]); @@ -658,7 +658,7 @@ void WorldSession::HandlePetRename(WorldPacket& recvData) CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHAR_PET_NAME); stmt->setString(0, name); - stmt->setUInt32(1, _player->GetGUID().GetCounter()); + stmt->setUInt64(1, _player->GetGUID().GetCounter()); stmt->setUInt32(2, pet->GetCharmInfo()->GetPetNumber()); trans->Append(stmt); diff --git a/src/server/game/Handlers/QuestHandler.cpp b/src/server/game/Handlers/QuestHandler.cpp index 7c74891d6d35e..8e6767cba0edc 100644 --- a/src/server/game/Handlers/QuestHandler.cpp +++ b/src/server/game/Handlers/QuestHandler.cpp @@ -1,4 +1,4 @@ -/* +/* * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information * * This program is free software; you can redistribute it and/or modify it @@ -437,7 +437,7 @@ void WorldSession::HandleQuestLogRemoveQuest(WorldPacket& recvData) // prepare Quest Tracker datas CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_QUEST_TRACK_ABANDON_TIME); stmt->setUInt32(0, questId); - stmt->setUInt32(1, _player->GetGUID().GetCounter()); + stmt->setUInt64(1, _player->GetGUID().GetCounter()); // add to Quest Tracker CharacterDatabase.Execute(stmt); diff --git a/src/server/game/Handlers/SpellHandler.cpp b/src/server/game/Handlers/SpellHandler.cpp index ee694f7d366a3..fb1f3e6d59a32 100644 --- a/src/server/game/Handlers/SpellHandler.cpp +++ b/src/server/game/Handlers/SpellHandler.cpp @@ -237,7 +237,7 @@ void WorldSession::HandleOpenItemOpcode(WorldPacket& recvPacket) if (item->IsWrapped()) { CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_GIFT_BY_ITEM); - stmt->setUInt32(0, item->GetGUID().GetCounter()); + stmt->setUInt64(0, item->GetGUID().GetCounter()); _queryProcessor.AddCallback(CharacterDatabase.AsyncQuery(stmt) .WithPreparedCallback(std::bind(&WorldSession::HandleOpenWrappedItemCallback, this, item->GetPos(), item->GetGUID(), std::placeholders::_1))); } @@ -279,7 +279,7 @@ void WorldSession::HandleOpenWrappedItemCallback(uint16 pos, ObjectGuid itemGuid GetPlayer()->SaveInventoryAndGoldToDB(trans); CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_GIFT); - stmt->setUInt32(0, itemGuid.GetCounter()); + stmt->setUInt64(0, itemGuid.GetCounter()); trans->Append(stmt); CharacterDatabase.CommitTransaction(trans); diff --git a/src/server/game/Handlers/TicketHandler.cpp b/src/server/game/Handlers/TicketHandler.cpp index bd8f3f941bf1e..0f3286a824439 100644 --- a/src/server/game/Handlers/TicketHandler.cpp +++ b/src/server/game/Handlers/TicketHandler.cpp @@ -1,4 +1,4 @@ -/* +/* * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information * * This program is free software; you can redistribute it and/or modify it @@ -235,7 +235,7 @@ void WorldSession::HandleGMSurveySubmit(WorldPacket& recvData) return; CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_GM_SURVEY); - stmt->setUInt32(0, GetPlayer()->GetGUID().GetCounter()); + stmt->setUInt64(0, GetPlayer()->GetGUID().GetCounter()); stmt->setUInt32(1, nextSurveyID); stmt->setUInt32(2, mainSurvey); stmt->setString(3, comment); @@ -258,7 +258,7 @@ void WorldSession::HandleReportLag(WorldPacket& recvData) recvData >> z; CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_LAG_REPORT); - stmt->setUInt32(0, GetPlayer()->GetGUID().GetCounter()); + stmt->setUInt64(0, GetPlayer()->GetGUID().GetCounter()); stmt->setUInt8 (1, lagType); stmt->setUInt16(2, mapId); stmt->setFloat (3, x); diff --git a/src/server/game/Mails/Mail.cpp b/src/server/game/Mails/Mail.cpp index dc509e28a416f..3e7f979c9a769 100644 --- a/src/server/game/Mails/Mail.cpp +++ b/src/server/game/Mails/Mail.cpp @@ -131,7 +131,7 @@ void MailDraft::deleteIncludedItems(CharacterDatabaseTransaction trans, bool inD if (inDB) { CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_INSTANCE); - stmt->setUInt32(0, item->GetGUID().GetCounter()); + stmt->setUInt64(0, item->GetGUID().GetCounter()); trans->Append(stmt); } @@ -171,8 +171,8 @@ void MailDraft::SendReturnToSender(uint32 sender_acc, ObjectGuid::LowType sender item->SaveToDB(trans); // item not in inventory and can be save standalone // owner in data will set at mail receive and item extracting CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ITEM_OWNER); - stmt->setUInt32(0, receiver_guid); - stmt->setUInt32(1, item->GetGUID().GetCounter()); + stmt->setUInt64(0, receiver_guid); + stmt->setUInt64(1, item->GetGUID().GetCounter()); trans->Append(stmt); } } @@ -223,8 +223,8 @@ void MailDraft::SendMailTo(CharacterDatabaseTransaction trans, MailReceiver cons stmt->setUInt8 (++index, uint8(sender.GetMailMessageType())); stmt->setInt8 (++index, int8(sender.GetStationery())); stmt->setUInt16(++index, GetMailTemplateId()); - stmt->setUInt32(++index, sender.GetSenderId()); - stmt->setUInt32(++index, receiver.GetPlayerGUIDLow()); + stmt->setUInt64(++index, sender.GetSenderId()); + stmt->setUInt64(++index, receiver.GetPlayerGUIDLow()); stmt->setString(++index, GetSubject()); stmt->setString(++index, GetBody()); stmt->setBool (++index, !m_items.empty()); @@ -240,8 +240,8 @@ void MailDraft::SendMailTo(CharacterDatabaseTransaction trans, MailReceiver cons Item* pItem = mailItemIter->second; stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_MAIL_ITEM); stmt->setUInt32(0, mailId); - stmt->setUInt32(1, pItem->GetGUID().GetCounter()); - stmt->setUInt32(2, receiver.GetPlayerGUIDLow()); + stmt->setUInt64(1, pItem->GetGUID().GetCounter()); + stmt->setUInt64(2, receiver.GetPlayerGUIDLow()); trans->Append(stmt); } diff --git a/src/server/game/Maps/Map.cpp b/src/server/game/Maps/Map.cpp index 77e667bce066a..c79e60e3fd890 100644 --- a/src/server/game/Maps/Map.cpp +++ b/src/server/game/Maps/Map.cpp @@ -3224,7 +3224,7 @@ void Map::DeleteRespawnInfoFromDB(SpawnObjectType type, ObjectGuid::LowType spaw { CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_RESPAWN); stmt->setUInt16(0, type); - stmt->setUInt32(1, spawnId); + stmt->setUInt64(1, spawnId); stmt->setUInt16(2, GetId()); stmt->setUInt32(3, GetInstanceId()); CharacterDatabase.ExecuteOrAppend(dbTrans, stmt); @@ -4492,7 +4492,7 @@ void Map::SaveRespawnInfoDB(RespawnInfo const& info, CharacterDatabaseTransactio { CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_REP_RESPAWN); stmt->setUInt16(0, info.type); - stmt->setUInt32(1, info.spawnId); + stmt->setUInt64(1, info.spawnId); stmt->setUInt64(2, uint64(info.respawnTime)); stmt->setUInt16(3, GetId()); stmt->setUInt32(4, GetInstanceId()); @@ -4510,7 +4510,7 @@ void Map::LoadRespawnTimes() { Field* fields = result->Fetch(); SpawnObjectType type = SpawnObjectType(fields[0].GetUInt16()); - ObjectGuid::LowType spawnId = fields[1].GetUInt32(); + ObjectGuid::LowType spawnId = fields[1].GetUInt64(); uint64 respawnTime = fields[2].GetUInt64(); if (SpawnData::TypeHasData(type)) @@ -4569,7 +4569,7 @@ void Map::LoadCorpseData() { Field* fields = result->Fetch(); CorpseType type = CorpseType(fields[13].GetUInt8()); - ObjectGuid::LowType guid = fields[16].GetUInt32(); + ObjectGuid::LowType guid = fields[16].GetUInt64(); if (type >= MAX_CORPSE_TYPE || type == CORPSE_BONES) { TC_LOG_ERROR("misc", "Corpse (guid: {}) have wrong corpse type ({}), not loading.", guid, type); diff --git a/src/server/game/Maps/SpawnData.h b/src/server/game/Maps/SpawnData.h index d12b814f91fb1..4949b7411a190 100644 --- a/src/server/game/Maps/SpawnData.h +++ b/src/server/game/Maps/SpawnData.h @@ -18,6 +18,7 @@ #ifndef TRINITY_SPAWNDATA_H #define TRINITY_SPAWNDATA_H +#include "ObjectGuid.h" #include "Position.h" class Creature; @@ -82,7 +83,7 @@ struct SpawnMetadata SpawnData const* ToSpawnData() const { return TypeHasData(type) ? reinterpret_cast(this) : nullptr; } SpawnObjectType const type; - uint32 spawnId = 0; + ObjectGuid::LowType spawnId = 0; uint32 mapId = MAPID_INVALID; bool dbData = true; SpawnGroupTemplateData const* spawnGroupData = nullptr; diff --git a/src/server/game/Maps/TransportMgr.cpp b/src/server/game/Maps/TransportMgr.cpp index bd5b12e3e7efe..97a475f0981d9 100644 --- a/src/server/game/Maps/TransportMgr.cpp +++ b/src/server/game/Maps/TransportMgr.cpp @@ -440,7 +440,7 @@ void TransportMgr::SpawnContinentTransports() do { Field* fields = result->Fetch(); - ObjectGuid::LowType guid = fields[0].GetUInt32(); + ObjectGuid::LowType guid = fields[0].GetUInt64(); uint32 entry = fields[1].GetUInt32(); if (TransportTemplate const* tInfo = GetTransportTemplate(entry)) diff --git a/src/server/game/Petitions/PetitionMgr.cpp b/src/server/game/Petitions/PetitionMgr.cpp index 978c6b3b36ffb..a8a7ab3196e24 100644 --- a/src/server/game/Petitions/PetitionMgr.cpp +++ b/src/server/game/Petitions/PetitionMgr.cpp @@ -52,7 +52,7 @@ void PetitionMgr::LoadPetitions() do { Field* fields = result->Fetch(); - AddPetition(ObjectGuid::Create(fields[0].GetUInt32()), ObjectGuid::Create(fields[1].GetUInt32()), fields[2].GetString(), static_cast(fields[3].GetUInt8()), true); + AddPetition(ObjectGuid::Create(fields[0].GetUInt64()), ObjectGuid::Create(fields[1].GetUInt64()), fields[2].GetString(), static_cast(fields[3].GetUInt8()), true); ++count; } while (result->NextRow()); @@ -75,11 +75,11 @@ void PetitionMgr::LoadSignatures() { Field* fields = result->Fetch(); - Petition* petition = GetPetition(ObjectGuid::Create(fields[0].GetUInt32())); + Petition* petition = GetPetition(ObjectGuid::Create(fields[0].GetUInt64())); if (!petition) continue; - petition->AddSignature(fields[1].GetUInt32(), ObjectGuid::Create(fields[2].GetUInt32()), true); + petition->AddSignature(fields[1].GetUInt32(), ObjectGuid::Create(fields[2].GetUInt64()), true); ++count; } while (result->NextRow()); @@ -99,8 +99,8 @@ void PetitionMgr::AddPetition(ObjectGuid petitionGuid, ObjectGuid ownerGuid, std return; CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_PETITION); - stmt->setUInt32(0, ownerGuid.GetCounter()); - stmt->setUInt32(1, petitionGuid.GetCounter()); + stmt->setUInt64(0, ownerGuid.GetCounter()); + stmt->setUInt64(1, petitionGuid.GetCounter()); stmt->setString(2, name); stmt->setUInt8(3, uint8(type)); CharacterDatabase.Execute(stmt); @@ -114,11 +114,11 @@ void PetitionMgr::RemovePetition(ObjectGuid petitionGuid) CharacterDatabaseTransaction trans = CharacterDatabase.BeginTransaction(); CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_PETITION_BY_GUID); - stmt->setUInt32(0, petitionGuid.GetCounter()); + stmt->setUInt64(0, petitionGuid.GetCounter()); trans->Append(stmt); stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_PETITION_SIGNATURE_BY_GUID); - stmt->setUInt32(0, petitionGuid.GetCounter()); + stmt->setUInt64(0, petitionGuid.GetCounter()); trans->Append(stmt); CharacterDatabase.CommitTransaction(trans); @@ -167,22 +167,22 @@ void PetitionMgr::RemovePetitionsByOwnerAndType(ObjectGuid ownerGuid, CharterTyp if (type == CHARTER_TYPE_ANY) { stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_PETITION_BY_OWNER); - stmt->setUInt32(0, ownerGuid.GetCounter()); + stmt->setUInt64(0, ownerGuid.GetCounter()); trans->Append(stmt); stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_PETITION_SIGNATURE_BY_OWNER); - stmt->setUInt32(0, ownerGuid.GetCounter()); + stmt->setUInt64(0, ownerGuid.GetCounter()); trans->Append(stmt); } else { stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_PETITION_BY_OWNER_AND_TYPE); - stmt->setUInt32(0, ownerGuid.GetCounter()); + stmt->setUInt64(0, ownerGuid.GetCounter()); stmt->setUInt8(1, uint8(type)); trans->Append(stmt); stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_PETITION_SIGNATURE_BY_OWNER_AND_TYPE); - stmt->setUInt32(0, ownerGuid.GetCounter()); + stmt->setUInt64(0, ownerGuid.GetCounter()); stmt->setUInt8(1, uint8(type)); trans->Append(stmt); } @@ -201,12 +201,12 @@ void PetitionMgr::RemoveSignaturesBySignerAndType(ObjectGuid signerGuid, Charter if (type == CHARTER_TYPE_ANY) { stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ALL_PETITION_SIGNATURES); - stmt->setUInt32(0, signerGuid.GetCounter()); + stmt->setUInt64(0, signerGuid.GetCounter()); } else { stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_PETITION_SIGNATURE); - stmt->setUInt32(0, signerGuid.GetCounter()); + stmt->setUInt64(0, signerGuid.GetCounter()); stmt->setUInt8(1, uint8(type)); } CharacterDatabase.Execute(stmt); @@ -230,9 +230,9 @@ void Petition::AddSignature(uint32 accountId, ObjectGuid playerGuid, bool isLoad CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_PETITION_SIGNATURE); - stmt->setUInt32(0, OwnerGuid.GetCounter()); - stmt->setUInt32(1, PetitionGuid.GetCounter()); - stmt->setUInt32(2, playerGuid); + stmt->setUInt64(0, OwnerGuid.GetCounter()); + stmt->setUInt64(1, PetitionGuid.GetCounter()); + stmt->setUInt64(2, playerGuid); stmt->setUInt32(3, accountId); CharacterDatabase.Execute(stmt); @@ -244,7 +244,7 @@ void Petition::UpdateName(std::string const& newName) CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_PETITION_NAME); stmt->setString(0, newName); - stmt->setUInt32(1, PetitionGuid.GetCounter()); + stmt->setUInt64(1, PetitionGuid.GetCounter()); CharacterDatabase.Execute(stmt); } diff --git a/src/server/game/Pools/PoolMgr.cpp b/src/server/game/Pools/PoolMgr.cpp index 5d5a3d52728a5..806c08b294c82 100644 --- a/src/server/game/Pools/PoolMgr.cpp +++ b/src/server/game/Pools/PoolMgr.cpp @@ -464,7 +464,7 @@ void PoolMgr::LoadFromDB() { Field* fields = result->Fetch(); - ObjectGuid::LowType guid = fields[0].GetUInt32(); + ObjectGuid::LowType guid = fields[0].GetUInt64(); uint32 pool_id = fields[1].GetUInt32(); float chance = fields[2].GetFloat(); @@ -521,7 +521,7 @@ void PoolMgr::LoadFromDB() { Field* fields = result->Fetch(); - ObjectGuid::LowType guid = fields[0].GetUInt32(); + ObjectGuid::LowType guid = fields[0].GetUInt64(); uint32 pool_id = fields[1].GetUInt32(); float chance = fields[2].GetFloat(); diff --git a/src/server/game/Reputation/ReputationMgr.cpp b/src/server/game/Reputation/ReputationMgr.cpp index 10f27239ab216..1690a7e107a87 100644 --- a/src/server/game/Reputation/ReputationMgr.cpp +++ b/src/server/game/Reputation/ReputationMgr.cpp @@ -628,12 +628,12 @@ void ReputationMgr::SaveToDB(CharacterDatabaseTransaction trans) if (itr->second.needSave) { CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_REPUTATION_BY_FACTION); - stmt->setUInt32(0, _player->GetGUID().GetCounter()); + stmt->setUInt64(0, _player->GetGUID().GetCounter()); stmt->setUInt16(1, uint16(itr->second.ID)); trans->Append(stmt); stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHAR_REPUTATION_BY_FACTION); - stmt->setUInt32(0, _player->GetGUID().GetCounter()); + stmt->setUInt64(0, _player->GetGUID().GetCounter()); stmt->setUInt16(1, uint16(itr->second.ID)); stmt->setInt32(2, itr->second.Standing); stmt->setUInt16(3, itr->second.Flags.AsUnderlyingType()); diff --git a/src/server/game/Server/WorldSession.cpp b/src/server/game/Server/WorldSession.cpp index 182921c1cc85f..48541864cf3f4 100644 --- a/src/server/game/Server/WorldSession.cpp +++ b/src/server/game/Server/WorldSession.cpp @@ -1,4 +1,4 @@ -/* +/* * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information * * This program is free software; you can redistribute it and/or modify it @@ -534,7 +534,7 @@ void WorldSession::LogoutPlayer(bool save) if (_player->IsInvitedForBattlegroundQueueType(bgQueueTypeId) && sWorld->getBoolConfig(CONFIG_BATTLEGROUND_TRACK_DESERTERS)) { CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_DESERTER_TRACK); - stmt->setUInt32(0, _player->GetGUID().GetCounter()); + stmt->setUInt64(0, _player->GetGUID().GetCounter()); stmt->setUInt8(1, BG_DESERTION_TYPE_INVITE_LOGOUT); CharacterDatabase.Execute(stmt); } diff --git a/src/server/game/Server/WorldSocket.cpp b/src/server/game/Server/WorldSocket.cpp index 64307b823f3d3..1682cf4acdd11 100644 --- a/src/server/game/Server/WorldSocket.cpp +++ b/src/server/game/Server/WorldSocket.cpp @@ -201,12 +201,12 @@ void WorldSocket::ReadHandler() { if (result != ReadDataHandlerResult::WaitingForQuery) CloseSocket(); + else + SuspendRead(); return; } } - - AsyncRead(); } bool WorldSocket::ReadHeaderHandler() diff --git a/src/server/game/Spells/SpellHistory.cpp b/src/server/game/Spells/SpellHistory.cpp index d39d4e069ec0a..86d25ec3eb44a 100644 --- a/src/server/game/Spells/SpellHistory.cpp +++ b/src/server/game/Spells/SpellHistory.cpp @@ -1,4 +1,4 @@ -/* +/* * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information * * This program is free software; you can redistribute it and/or modify it @@ -36,7 +36,7 @@ struct SpellHistory::PersistenceHelper static CharacterDatabaseStatements const CooldownsDeleteStatement = CHAR_DEL_CHAR_SPELL_COOLDOWNS; static CharacterDatabaseStatements const CooldownsInsertStatement = CHAR_INS_CHAR_SPELL_COOLDOWN; - static void SetIdentifier(PreparedStatementBase* stmt, uint8 index, Unit* owner) { stmt->setUInt32(index, owner->GetGUID().GetCounter()); } + static void SetIdentifier(PreparedStatementBase* stmt, uint8 index, Unit* owner) { stmt->setUInt64(index, owner->GetGUID().GetCounter()); } static bool ReadCooldown(Field* fields, uint32* spellId, CooldownEntry* cooldownEntry) { diff --git a/src/server/game/Tickets/TicketMgr.cpp b/src/server/game/Tickets/TicketMgr.cpp index 59f89c24b7a1e..c7a3c2d34f99f 100644 --- a/src/server/game/Tickets/TicketMgr.cpp +++ b/src/server/game/Tickets/TicketMgr.cpp @@ -1,4 +1,4 @@ -/* +/* * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information * * This program is free software; you can redistribute it and/or modify it @@ -68,7 +68,7 @@ bool GmTicket::LoadFromDB(Field* fields) uint8 index = 0; _id = fields[ index].GetUInt32(); _type = TicketType(fields[++index].GetUInt8()); - _playerGuid = ObjectGuid(HighGuid::Player, fields[++index].GetUInt32()); + _playerGuid = ObjectGuid(HighGuid::Player, fields[++index].GetUInt64()); _playerName = fields[++index].GetString(); _message = fields[++index].GetString(); _createTime = fields[++index].GetUInt32(); @@ -77,8 +77,8 @@ bool GmTicket::LoadFromDB(Field* fields) _posY = fields[++index].GetFloat(); _posZ = fields[++index].GetFloat(); _lastModifiedTime = fields[++index].GetUInt32(); - _closedBy = ObjectGuid(uint64(fields[++index].GetInt32())); - _assignedTo = ObjectGuid(HighGuid::Player, fields[++index].GetUInt32()); + _closedBy = ObjectGuid(uint64(fields[++index].GetInt64())); + _assignedTo = ObjectGuid(HighGuid::Player, fields[++index].GetUInt64()); _comment = fields[++index].GetString(); _response = fields[++index].GetString(); _completed = fields[++index].GetBool(); @@ -96,7 +96,7 @@ void GmTicket::SaveToDB(CharacterDatabaseTransaction trans) const CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_REP_GM_TICKET); stmt->setUInt32( index, _id); stmt->setUInt8 (++index, uint8(_type)); - stmt->setUInt32(++index, _playerGuid.GetCounter()); + stmt->setUInt64(++index, _playerGuid.GetCounter()); stmt->setString(++index, _playerName); stmt->setString(++index, _message); stmt->setUInt32(++index, uint32(_createTime)); @@ -105,15 +105,15 @@ void GmTicket::SaveToDB(CharacterDatabaseTransaction trans) const stmt->setFloat (++index, _posY); stmt->setFloat (++index, _posZ); stmt->setUInt32(++index, uint32(_lastModifiedTime)); - stmt->setInt32 (++index, int32(_closedBy.GetCounter())); - stmt->setUInt32(++index, _assignedTo.GetCounter()); + stmt->setInt64 (++index, int64(_closedBy.GetCounter())); + stmt->setUInt64(++index, _assignedTo.GetCounter()); stmt->setString(++index, _comment); stmt->setString(++index, _response); stmt->setBool (++index, _completed); stmt->setUInt8 (++index, uint8(_escalatedStatus)); stmt->setBool (++index, _viewed); stmt->setBool (++index, _needMoreHelp); - stmt->setInt32 (++index, int32(_resolvedBy.GetCounter())); + stmt->setInt64 (++index, int64(_resolvedBy.GetCounter())); CharacterDatabase.ExecuteOrAppend(trans, stmt); } diff --git a/src/server/game/Tools/PlayerDump.cpp b/src/server/game/Tools/PlayerDump.cpp index d9e78dadf4c7f..b6a3c229e71ed 100644 --- a/src/server/game/Tools/PlayerDump.cpp +++ b/src/server/game/Tools/PlayerDump.cpp @@ -1,4 +1,4 @@ -/* +/* * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information * * This program is free software; you can redistribute it and/or modify it @@ -614,15 +614,15 @@ void PlayerDumpWriter::PopulateGuids(ObjectGuid::LowType guid) switch (baseTable.StoredType) { case GUID_TYPE_ITEM: - if (ObjectGuid::LowType itemLowGuid = (*result)[0].GetUInt32()) + if (ObjectGuid::LowType itemLowGuid = (*result)[0].GetUInt64()) _items.insert(itemLowGuid); break; case GUID_TYPE_MAIL: - if (ObjectGuid::LowType mailLowGuid = (*result)[0].GetUInt32()) + if (ObjectGuid::LowType mailLowGuid = (*result)[0].GetUInt64()) _mails.insert(mailLowGuid); break; case GUID_TYPE_PET: - if (ObjectGuid::LowType petLowGuid = (*result)[0].GetUInt32()) + if (ObjectGuid::LowType petLowGuid = (*result)[0].GetUInt64()) _pets.insert(petLowGuid); break; case GUID_TYPE_EQUIPMENT_SET: @@ -774,7 +774,7 @@ DumpReturn PlayerDumpReader::LoadDump(std::istream& input, uint32 account, std:: if (guid && guid < sObjectMgr->GetGenerator().GetNextAfterMaxUsed()) { CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHECK_GUID); - stmt->setUInt32(0, guid); + stmt->setUInt64(0, guid); if (PreparedQueryResult result = CharacterDatabase.Query(stmt)) guid = sObjectMgr->GetGenerator().GetNextAfterMaxUsed(); // use first free if exists diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp index f24237bc64345..d02332f3f1cef 100644 --- a/src/server/game/World/World.cpp +++ b/src/server/game/World/World.cpp @@ -1,4 +1,4 @@ -/* +/* * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information * * This program is free software; you can redistribute it and/or modify it @@ -2927,11 +2927,11 @@ BanReturn World::BanCharacter(std::string const& name, std::string const& durati CharacterDatabaseTransaction trans = CharacterDatabase.BeginTransaction(); // make sure there is only one active ban CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHARACTER_BAN); - stmt->setUInt32(0, guid); + stmt->setUInt64(0, guid); trans->Append(stmt); stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHARACTER_BAN); - stmt->setUInt32(0, guid); + stmt->setUInt64(0, guid); stmt->setUInt32(1, duration_secs); stmt->setString(2, author); stmt->setString(3, reason); @@ -2966,7 +2966,7 @@ bool World::RemoveBanCharacter(std::string const& name) return false; CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHARACTER_BAN); - stmt->setUInt32(0, guid); + stmt->setUInt64(0, guid); CharacterDatabase.Execute(stmt); return true; } diff --git a/src/server/scripts/Commands/cs_ban.cpp b/src/server/scripts/Commands/cs_ban.cpp index d3abce72b3088..c52d5ed62a409 100644 --- a/src/server/scripts/Commands/cs_ban.cpp +++ b/src/server/scripts/Commands/cs_ban.cpp @@ -335,7 +335,7 @@ class ban_commandscript : public CommandScript targetGuid = target->GetGUID().GetCounter(); CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_BANINFO); - stmt->setUInt32(0, targetGuid); + stmt->setUInt64(0, targetGuid); PreparedQueryResult result = CharacterDatabase.Query(stmt); if (!result) { diff --git a/src/server/scripts/Commands/cs_character.cpp b/src/server/scripts/Commands/cs_character.cpp index 6b8fa1b209349..808aa1b80b5db 100644 --- a/src/server/scripts/Commands/cs_character.cpp +++ b/src/server/scripts/Commands/cs_character.cpp @@ -112,7 +112,7 @@ class character_commandscript : public CommandScript if (Optional guidValue = Trinity::StringTo(searchString)) { stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_DEL_INFO_BY_GUID); - stmt->setUInt32(0, *guidValue); + stmt->setUInt64(0, *guidValue); result = CharacterDatabase.Query(stmt); } // search by name @@ -140,7 +140,7 @@ class character_commandscript : public CommandScript DeletedInfo info; - info.guid = ObjectGuid(HighGuid::Player, fields[0].GetUInt32()); + info.guid = ObjectGuid(HighGuid::Player, fields[0].GetUInt64()); info.name = fields[1].GetString(); info.accountId = fields[2].GetUInt32(); @@ -227,11 +227,11 @@ class character_commandscript : public CommandScript CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_RESTORE_DELETE_INFO); stmt->setString(0, delInfo.name); stmt->setUInt32(1, delInfo.accountId); - stmt->setUInt32(2, delInfo.guid.GetCounter()); + stmt->setUInt64(2, delInfo.guid.GetCounter()); CharacterDatabase.Execute(stmt); stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_NAME_DATA); - stmt->setUInt32(0, delInfo.guid.GetCounter()); + stmt->setUInt64(0, delInfo.guid.GetCounter()); if (PreparedQueryResult result = CharacterDatabase.Query(stmt)) sCharacterCache->AddCharacterCacheEntry(delInfo.guid, delInfo.accountId, delInfo.name, (*result)[2].GetUInt8(), (*result)[0].GetUInt8(), (*result)[1].GetUInt8(), (*result)[3].GetUInt8()); } @@ -335,7 +335,7 @@ class character_commandscript : public CommandScript // Remove declined name from db stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_DECLINED_NAME); - stmt->setUInt32(0, player->GetGUID().GetCounter()); + stmt->setUInt64(0, player->GetGUID().GetCounter()); CharacterDatabase.Execute(stmt); if (Player* target = player->GetConnectedPlayer()) @@ -349,7 +349,7 @@ class character_commandscript : public CommandScript { stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_NAME_BY_GUID); stmt->setString(0, newName); - stmt->setUInt32(1, player->GetGUID().GetCounter()); + stmt->setUInt64(1, player->GetGUID().GetCounter()); CharacterDatabase.Execute(stmt); } @@ -382,7 +382,7 @@ class character_commandscript : public CommandScript CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ADD_AT_LOGIN_FLAG); stmt->setUInt16(0, uint16(AT_LOGIN_RENAME)); - stmt->setUInt32(1, player->GetGUID().GetCounter()); + stmt->setUInt64(1, player->GetGUID().GetCounter()); CharacterDatabase.Execute(stmt); } } @@ -408,7 +408,7 @@ class character_commandscript : public CommandScript handler->PSendSysMessage(LANG_CUSTOMIZE_PLAYER_GUID, handler->playerLink(*player).c_str(), player->GetGUID().GetCounter()); CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ADD_AT_LOGIN_FLAG); stmt->setUInt16(0, static_cast(AT_LOGIN_CUSTOMIZE)); - stmt->setUInt32(1, player->GetGUID().GetCounter()); + stmt->setUInt64(1, player->GetGUID().GetCounter()); CharacterDatabase.Execute(stmt); } @@ -450,7 +450,7 @@ class character_commandscript : public CommandScript handler->PSendSysMessage(LANG_CUSTOMIZE_PLAYER_GUID, handler->playerLink(*player).c_str(), player->GetGUID().GetCounter()); CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ADD_AT_LOGIN_FLAG); stmt->setUInt16(0, uint16(AT_LOGIN_CHANGE_FACTION)); - stmt->setUInt32(1, player->GetGUID().GetCounter()); + stmt->setUInt64(1, player->GetGUID().GetCounter()); CharacterDatabase.Execute(stmt); } @@ -474,7 +474,7 @@ class character_commandscript : public CommandScript handler->PSendSysMessage(LANG_CUSTOMIZE_PLAYER_GUID, handler->playerLink(*player).c_str(), player->GetGUID().GetCounter()); CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ADD_AT_LOGIN_FLAG); stmt->setUInt16(0, uint16(AT_LOGIN_CHANGE_RACE)); - stmt->setUInt32(1, player->GetGUID().GetCounter()); + stmt->setUInt64(1, player->GetGUID().GetCounter()); CharacterDatabase.Execute(stmt); } @@ -516,7 +516,7 @@ class character_commandscript : public CommandScript CharacterDatabasePreparedStatement* charStmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ACCOUNT_BY_GUID); charStmt->setUInt32(0, newAccount.GetID()); - charStmt->setUInt32(1, player->GetGUID().GetCounter()); + charStmt->setUInt64(1, player->GetGUID().GetCounter()); CharacterDatabase.DirectExecute(charStmt); sWorld->UpdateRealmCharCount(oldAccountId); @@ -790,7 +790,7 @@ class character_commandscript : public CommandScript // Update level and reset XP, everything else will be updated at login CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_LEVEL); stmt->setUInt8(0, static_cast(newlevel)); - stmt->setUInt32(1, player->GetGUID()); + stmt->setUInt64(1, player->GetGUID().GetCounter()); CharacterDatabase.Execute(stmt); } @@ -837,7 +837,7 @@ class character_commandscript : public CommandScript // Update level and reset XP, everything else will be updated at login CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_LEVEL); stmt->setUInt8(0, static_cast(newlevel)); - stmt->setUInt32(1, player->GetGUID()); + stmt->setUInt64(1, player->GetGUID().GetCounter()); CharacterDatabase.Execute(stmt); } diff --git a/src/server/scripts/Commands/cs_gobject.cpp b/src/server/scripts/Commands/cs_gobject.cpp index 38861797e85b5..7851d4aa8c5cd 100644 --- a/src/server/scripts/Commands/cs_gobject.cpp +++ b/src/server/scripts/Commands/cs_gobject.cpp @@ -251,7 +251,7 @@ class gobject_commandscript : public CommandScript do { Field* fields = result->Fetch(); - guidLow = fields[0].GetUInt32(); + guidLow = fields[0].GetUInt64(); id = fields[1].GetUInt32(); x = fields[2].GetFloat(); y = fields[3].GetFloat(); @@ -473,7 +473,7 @@ class gobject_commandscript : public CommandScript do { Field* fields = result->Fetch(); - ObjectGuid::LowType guid = fields[0].GetUInt32(); + ObjectGuid::LowType guid = fields[0].GetUInt64(); uint32 entry = fields[1].GetUInt32(); float x = fields[2].GetFloat(); float y = fields[3].GetFloat(); diff --git a/src/server/scripts/Commands/cs_group.cpp b/src/server/scripts/Commands/cs_group.cpp index 731521ef0d7dd..869472492ccc0 100644 --- a/src/server/scripts/Commands/cs_group.cpp +++ b/src/server/scripts/Commands/cs_group.cpp @@ -443,7 +443,7 @@ class group_commandscript : public CommandScript { // If not, we extract it from the SQL. CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_GROUP_MEMBER); - stmt->setUInt32(0, target.GetGUID().GetCounter()); + stmt->setUInt64(0, target.GetGUID().GetCounter()); PreparedQueryResult resultGroup = CharacterDatabase.Query(stmt); if (resultGroup) groupTarget = sGroupMgr->GetGroupByDbStoreId((*resultGroup)[0].GetUInt32()); diff --git a/src/server/scripts/Commands/cs_lfg.cpp b/src/server/scripts/Commands/cs_lfg.cpp index 38d47c383441c..d6900619da156 100644 --- a/src/server/scripts/Commands/cs_lfg.cpp +++ b/src/server/scripts/Commands/cs_lfg.cpp @@ -96,7 +96,7 @@ class lfg_commandscript : public CommandScript else { CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_GROUP_MEMBER); - stmt->setUInt32(0, player->GetGUID().GetCounter()); + stmt->setUInt64(0, player->GetGUID().GetCounter()); PreparedQueryResult resultGroup = CharacterDatabase.Query(stmt); if (resultGroup) groupTarget = sGroupMgr->GetGroupByDbStoreId((*resultGroup)[0].GetUInt32()); diff --git a/src/server/scripts/Commands/cs_list.cpp b/src/server/scripts/Commands/cs_list.cpp index e076acad15e86..6c26a949c6824 100644 --- a/src/server/scripts/Commands/cs_list.cpp +++ b/src/server/scripts/Commands/cs_list.cpp @@ -110,7 +110,7 @@ class list_commandscript : public CommandScript do { Field* fields = result->Fetch(); - ObjectGuid::LowType guid = fields[0].GetUInt32(); + ObjectGuid::LowType guid = fields[0].GetUInt64(); float x = fields[1].GetFloat(); float y = fields[2].GetFloat(); float z = fields[3].GetFloat(); @@ -188,10 +188,10 @@ class list_commandscript : public CommandScript do { Field* fields = result->Fetch(); - uint32 itemGuid = fields[0].GetUInt32(); + uint64 itemGuid = fields[0].GetUInt64(); uint32 itemBag = fields[1].GetUInt32(); - uint8 itemSlot = fields[2].GetUInt8(); - uint32 ownerGuid = fields[3].GetUInt32(); + uint32 itemSlot = fields[2].GetUInt8(); + uint64 ownerGuid = fields[3].GetUInt64(); uint32 ownerAccountId = fields[4].GetUInt32(); std::string ownerName = fields[5].GetString(); @@ -242,9 +242,9 @@ class list_commandscript : public CommandScript do { Field* fields = result->Fetch(); - ObjectGuid::LowType itemGuid = fields[0].GetUInt32(); - ObjectGuid::LowType itemSender = fields[1].GetUInt32(); - uint32 itemReceiver = fields[2].GetUInt32(); + ObjectGuid::LowType itemGuid = fields[0].GetUInt64(); + ObjectGuid::LowType itemSender = fields[1].GetUInt64(); + uint64 itemReceiver = fields[2].GetUInt64(); uint32 itemSenderAccountId = fields[3].GetUInt32(); std::string itemSenderName = fields[4].GetString(); uint32 itemReceiverAccount = fields[5].GetUInt32(); @@ -289,8 +289,8 @@ class list_commandscript : public CommandScript do { Field* fields = result->Fetch(); - uint32 itemGuid = fields[0].GetUInt32(); - uint32 owner = fields[1].GetUInt32(); + uint64 itemGuid = fields[0].GetUInt64(); + uint64 owner = fields[1].GetUInt64(); uint32 ownerAccountId = fields[2].GetUInt32(); std::string ownerName = fields[3].GetString(); @@ -321,8 +321,8 @@ class list_commandscript : public CommandScript do { Field* fields = result->Fetch(); - uint32 itemGuid = fields[0].GetUInt32(); - uint32 guildGuid = fields[1].GetUInt32(); + uint64 itemGuid = fields[0].GetUInt64(); + uint64 guildGuid = fields[1].GetUInt64(); std::string guildName = fields[2].GetString(); char const* itemPos = "[in guild bank]"; @@ -388,7 +388,7 @@ class list_commandscript : public CommandScript do { Field* fields = result->Fetch(); - ObjectGuid::LowType guid = fields[0].GetUInt32(); + ObjectGuid::LowType guid = fields[0].GetUInt64(); float x = fields[1].GetFloat(); float y = fields[2].GetFloat(); float z = fields[3].GetFloat(); @@ -538,7 +538,7 @@ class list_commandscript : public CommandScript return false; CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_MAIL_LIST_COUNT); - stmt->setUInt32(0, player->GetGUID().GetCounter()); + stmt->setUInt64(0, player->GetGUID().GetCounter()); PreparedQueryResult queryResult = CharacterDatabase.Query(stmt); if (queryResult) { @@ -550,7 +550,7 @@ class list_commandscript : public CommandScript handler->PSendSysMessage(LANG_ACCOUNT_LIST_BAR); stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_MAIL_LIST_INFO); - stmt->setUInt32(0, player->GetGUID().GetCounter()); + stmt->setUInt64(0, player->GetGUID().GetCounter()); queryResult = CharacterDatabase.Query(stmt); if (queryResult) @@ -559,9 +559,9 @@ class list_commandscript : public CommandScript { Field* queryFields = queryResult->Fetch(); uint32 messageId = queryFields[0].GetUInt32(); - uint32 senderId = queryFields[1].GetUInt32(); + uint64 senderId = queryFields[1].GetUInt64(); std::string sender = queryFields[2].GetString(); - uint32 receiverId = queryFields[3].GetUInt32(); + uint64 receiverId = queryFields[3].GetUInt64(); std::string receiver = queryFields[4].GetString(); std::string subject = queryFields[5].GetString(); uint64 deliverTime = queryFields[6].GetUInt32(); @@ -585,9 +585,9 @@ class list_commandscript : public CommandScript { do { - ObjectGuid::LowType item_guid = (*result2)[0].GetUInt32(); + ObjectGuid::LowType item_guid = (*result2)[0].GetUInt64(); stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_MAIL_LIST_ITEMS); - stmt->setUInt32(0, item_guid); + stmt->setUInt64(0, item_guid); PreparedQueryResult result3 = CharacterDatabase.Query(stmt); if (result3) { diff --git a/src/server/scripts/Commands/cs_lookup.cpp b/src/server/scripts/Commands/cs_lookup.cpp index 75ecd1b56fe96..1cc8e98ba9376 100644 --- a/src/server/scripts/Commands/cs_lookup.cpp +++ b/src/server/scripts/Commands/cs_lookup.cpp @@ -1528,7 +1528,7 @@ class lookup_commandscript : public CommandScript do { Field* characterFields = result2->Fetch(); - ObjectGuid::LowType guid = characterFields[0].GetUInt32(); + ObjectGuid::LowType guid = characterFields[0].GetUInt64(); std::string name = characterFields[1].GetString(); uint8 online = characterFields[2].GetUInt8(); diff --git a/src/server/scripts/Commands/cs_misc.cpp b/src/server/scripts/Commands/cs_misc.cpp index a2f085b45962f..568b751bcfd92 100644 --- a/src/server/scripts/Commands/cs_misc.cpp +++ b/src/server/scripts/Commands/cs_misc.cpp @@ -1699,7 +1699,7 @@ class misc_commandscript : public CommandScript // Query informations from the DB stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_PINFO); - stmt->setUInt32(0, lowguid); + stmt->setUInt64(0, lowguid); PreparedQueryResult result = CharacterDatabase.Query(stmt); if (!result) @@ -1778,7 +1778,7 @@ class misc_commandscript : public CommandScript { banType = handler->GetTrinityString(LANG_CHARACTER); stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PINFO_BANS); - stmt->setUInt32(0, lowguid); + stmt->setUInt64(0, lowguid); result2 = CharacterDatabase.Query(stmt); } else @@ -1795,21 +1795,21 @@ class misc_commandscript : public CommandScript // Can be used to query data from Characters database stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PINFO_XP); - stmt->setUInt32(0, lowguid); + stmt->setUInt64(0, lowguid); PreparedQueryResult result4 = CharacterDatabase.Query(stmt); if (result4) { Field* fields = result4->Fetch(); xp = fields[0].GetUInt32(); // Used for "current xp" output and "%u XP Left" calculation - ObjectGuid::LowType gguid = fields[1].GetUInt32(); // We check if have a guild for the person, so we might not require to query it at all + ObjectGuid::LowType gguid = fields[1].GetUInt64(); // We check if have a guild for the person, so we might not require to query it at all xptotal = sObjectMgr->GetXPForLevel(level); if (gguid != 0) { // Guild Data - an own query, because it may not happen. stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_GUILD_MEMBER_EXTENDED); - stmt->setUInt32(0, lowguid); + stmt->setUInt64(0, lowguid); PreparedQueryResult result5 = CharacterDatabase.Query(stmt); if (result5) { @@ -1919,7 +1919,7 @@ class misc_commandscript : public CommandScript // Mail Data - an own query, because it may or may not be useful. // SQL: "SELECT SUM(CASE WHEN (checked & 1) THEN 1 ELSE 0 END) AS 'readmail', COUNT(*) AS 'totalmail' FROM mail WHERE `receiver` = ?" stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PINFO_MAILS); - stmt->setUInt32(0, lowguid); + stmt->setUInt64(0, lowguid); PreparedQueryResult result6 = CharacterDatabase.Query(stmt); if (result6) { @@ -2528,7 +2528,7 @@ class misc_commandscript : public CommandScript // If player found: delete his freeze aura CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_AURA_FROZEN); - stmt->setUInt32(0, guid.GetCounter()); + stmt->setUInt64(0, guid.GetCounter()); CharacterDatabase.Execute(stmt); handler->PSendSysMessage(LANG_COMMAND_UNFREEZE, name.c_str()); diff --git a/src/server/scripts/Commands/cs_npc.cpp b/src/server/scripts/Commands/cs_npc.cpp index 15150eea1c5b1..b8d34226c3cb4 100644 --- a/src/server/scripts/Commands/cs_npc.cpp +++ b/src/server/scripts/Commands/cs_npc.cpp @@ -217,7 +217,7 @@ class npc_commandscript : public CommandScript WorldDatabasePreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_UPD_CREATURE_MOVEMENT_TYPE); stmt->setUInt8(0, uint8(WAYPOINT_MOTION_TYPE)); - stmt->setUInt32(1, lowGuid); + stmt->setUInt64(1, lowGuid); WorldDatabase.Execute(stmt); @@ -552,7 +552,7 @@ class npc_commandscript : public CommandScript do { Field* fields = result->Fetch(); - ObjectGuid::LowType guid = fields[0].GetUInt32(); + ObjectGuid::LowType guid = fields[0].GetUInt64(); uint32 entry = fields[1].GetUInt32(); float x = fields[2].GetFloat(); float y = fields[3].GetFloat(); @@ -614,7 +614,7 @@ class npc_commandscript : public CommandScript stmt->setFloat(1, player->GetPositionY()); stmt->setFloat(2, player->GetPositionZ()); stmt->setFloat(3, player->GetOrientation()); - stmt->setUInt32(4, lowguid); + stmt->setUInt64(4, lowguid); WorldDatabase.Execute(stmt); // respawn selected creature at the new location @@ -837,7 +837,7 @@ class npc_commandscript : public CommandScript stmt->setFloat(0, option); stmt->setUInt8(1, uint8(mtype)); - stmt->setUInt32(2, guidLow); + stmt->setUInt64(2, guidLow); WorldDatabase.Execute(stmt); @@ -854,7 +854,7 @@ class npc_commandscript : public CommandScript WorldDatabasePreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_UPD_CREATURE_SPAWN_TIME_SECS); stmt->setUInt32(0, spawnTime); - stmt->setUInt32(1, creature->GetSpawnId()); + stmt->setUInt64(1, creature->GetSpawnId()); WorldDatabase.Execute(stmt); creature->SetRespawnDelay(spawnTime); @@ -1226,8 +1226,8 @@ class npc_commandscript : public CommandScript creature->SearchFormation(); WorldDatabasePreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_INS_CREATURE_FORMATION); - stmt->setUInt32(0, leaderGUID); - stmt->setUInt32(1, lowguid); + stmt->setUInt64(0, leaderGUID); + stmt->setUInt64(1, lowguid); stmt->setFloat (2, followAngle); stmt->setFloat (3, followDist); stmt->setUInt32(4, groupAI); diff --git a/src/server/scripts/Commands/cs_quest.cpp b/src/server/scripts/Commands/cs_quest.cpp index 5e15e615a6b78..47361f4ef822c 100644 --- a/src/server/scripts/Commands/cs_quest.cpp +++ b/src/server/scripts/Commands/cs_quest.cpp @@ -242,7 +242,7 @@ class quest_commandscript : public CommandScript // prepare Quest Tracker datas CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_QUEST_TRACK_GM_COMPLETE); stmt->setUInt32(0, quest->GetQuestId()); - stmt->setUInt32(1, player->GetGUID().GetCounter()); + stmt->setUInt64(1, player->GetGUID().GetCounter()); // add to Quest Tracker CharacterDatabase.Execute(stmt); diff --git a/src/server/scripts/Commands/cs_reset.cpp b/src/server/scripts/Commands/cs_reset.cpp index 3b357fcde2362..8e3702bab0e13 100644 --- a/src/server/scripts/Commands/cs_reset.cpp +++ b/src/server/scripts/Commands/cs_reset.cpp @@ -182,7 +182,7 @@ class reset_commandscript : public CommandScript { CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ADD_AT_LOGIN_FLAG); stmt->setUInt16(0, uint16(AT_LOGIN_RESET_SPELLS)); - stmt->setUInt32(1, targetGuid.GetCounter()); + stmt->setUInt64(1, targetGuid.GetCounter()); CharacterDatabase.Execute(stmt); handler->PSendSysMessage(LANG_RESET_SPELLS_OFFLINE, targetName.c_str()); @@ -254,7 +254,7 @@ class reset_commandscript : public CommandScript { CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ADD_AT_LOGIN_FLAG); stmt->setUInt16(0, uint16(AT_LOGIN_NONE | AT_LOGIN_RESET_PET_TALENTS)); - stmt->setUInt32(1, targetGuid.GetCounter()); + stmt->setUInt64(1, targetGuid.GetCounter()); CharacterDatabase.Execute(stmt); std::string nameLink = handler->playerLink(targetName); diff --git a/src/server/scripts/Commands/cs_tele.cpp b/src/server/scripts/Commands/cs_tele.cpp index 57227f93b1f00..ce96a16b4a8cc 100644 --- a/src/server/scripts/Commands/cs_tele.cpp +++ b/src/server/scripts/Commands/cs_tele.cpp @@ -185,7 +185,7 @@ class tele_commandscript : public CommandScript else { CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_HOMEBIND); - stmt->setUInt32(0, player->GetGUID().GetCounter()); + stmt->setUInt64(0, player->GetGUID().GetCounter()); PreparedQueryResult resultDB = CharacterDatabase.Query(stmt); if (resultDB) diff --git a/src/server/scripts/Commands/cs_wp.cpp b/src/server/scripts/Commands/cs_wp.cpp index 2945c116ab721..a720b687c744e 100644 --- a/src/server/scripts/Commands/cs_wp.cpp +++ b/src/server/scripts/Commands/cs_wp.cpp @@ -193,7 +193,7 @@ class wp_commandscript : public CommandScript WorldDatabasePreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_CREATURE_ADDON_BY_GUID); - stmt->setUInt32(0, guidLow); + stmt->setUInt64(0, guidLow); PreparedQueryResult result = WorldDatabase.Query(stmt); @@ -202,13 +202,13 @@ class wp_commandscript : public CommandScript stmt = WorldDatabase.GetPreparedStatement(WORLD_UPD_CREATURE_ADDON_PATH); stmt->setUInt32(0, pathid); - stmt->setUInt32(1, guidLow); + stmt->setUInt64(1, guidLow); } else { stmt = WorldDatabase.GetPreparedStatement(WORLD_INS_CREATURE_ADDON); - stmt->setUInt32(0, guidLow); + stmt->setUInt64(0, guidLow); stmt->setUInt32(1, pathid); } @@ -217,7 +217,7 @@ class wp_commandscript : public CommandScript stmt = WorldDatabase.GetPreparedStatement(WORLD_UPD_CREATURE_MOVEMENT_TYPE); stmt->setUInt8(0, uint8(WAYPOINT_MOTION_TYPE)); - stmt->setUInt32(1, guidLow); + stmt->setUInt64(1, guidLow); WorldDatabase.Execute(stmt); @@ -270,14 +270,14 @@ class wp_commandscript : public CommandScript } stmt = WorldDatabase.GetPreparedStatement(WORLD_DEL_CREATURE_ADDON); - stmt->setUInt32(0, guidLow); + stmt->setUInt64(0, guidLow); WorldDatabase.Execute(stmt); target->UpdateCurrentWaypointInfo(0, 0); stmt = WorldDatabase.GetPreparedStatement(WORLD_UPD_CREATURE_MOVEMENT_TYPE); stmt->setUInt8(0, uint8(IDLE_MOTION_TYPE)); - stmt->setUInt32(1, guidLow); + stmt->setUInt64(1, guidLow); WorldDatabase.Execute(stmt); target->LoadPath(0); @@ -586,7 +586,7 @@ class wp_commandscript : public CommandScript // Check the creature stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_WAYPOINT_DATA_BY_WPGUID); - stmt->setUInt32(0, target->GetSpawnId()); + stmt->setUInt64(0, target->GetSpawnId()); PreparedQueryResult result = WorldDatabase.Query(stmt); if (!result) @@ -788,7 +788,7 @@ class wp_commandscript : public CommandScript } stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_WAYPOINT_DATA_ALL_BY_WPGUID); - stmt->setUInt32(0, target->GetSpawnId()); + stmt->setUInt64(0, target->GetSpawnId()); PreparedQueryResult result = WorldDatabase.Query(stmt); if (!result) @@ -847,7 +847,7 @@ class wp_commandscript : public CommandScript do { Field* fields = result2->Fetch(); - uint32 wpguid = fields[0].GetUInt32(); + uint64 wpguid = fields[0].GetUInt64(); if (!Creature::DeleteFromDB(wpguid)) { handler->PSendSysMessage(LANG_WAYPOINT_NOTREMOVED, wpguid); @@ -891,7 +891,7 @@ class wp_commandscript : public CommandScript // Set "wpguid" column to the visual waypoint stmt = WorldDatabase.GetPreparedStatement(WORLD_UPD_WAYPOINT_DATA_WPGUID); - stmt->setUInt32(0, wpCreature->GetSpawnId()); + stmt->setUInt64(0, wpCreature->GetSpawnId()); stmt->setUInt32(1, pathid); stmt->setUInt32(2, point); WorldDatabase.Execute(stmt); @@ -1033,7 +1033,7 @@ class wp_commandscript : public CommandScript do { Field* fields = result->Fetch(); - ObjectGuid::LowType lowguid = fields[0].GetUInt32(); + ObjectGuid::LowType lowguid = fields[0].GetUInt64(); if (!Creature::DeleteFromDB(lowguid)) { diff --git a/src/server/scripts/World/action_ip_logger.cpp b/src/server/scripts/World/action_ip_logger.cpp index 2c3ac642795dc..2a5c9000bae7b 100644 --- a/src/server/scripts/World/action_ip_logger.cpp +++ b/src/server/scripts/World/action_ip_logger.cpp @@ -1,4 +1,4 @@ -/* +/* * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information * * This program is free software; you can redistribute it and/or modify it @@ -143,11 +143,11 @@ class AccountActionIpLogger : public AccountScript // For those, we need last_ip... LoginDatabasePreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_INS_ALDL_IP_LOGGING); - stmt->setUInt32(0, playerGuid); + stmt->setUInt64(0, playerGuid); stmt->setUInt64(1, characterGuid); stmt->setUInt32(2, realmId); stmt->setUInt8(3, aType); - stmt->setUInt32(4, playerGuid); + stmt->setUInt64(4, playerGuid); stmt->setString(5, systemNote); LoginDatabase.Execute(stmt); } @@ -155,11 +155,11 @@ class AccountActionIpLogger : public AccountScript { LoginDatabasePreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_INS_FACL_IP_LOGGING); - stmt->setUInt32(0, playerGuid); + stmt->setUInt64(0, playerGuid); stmt->setUInt64(1, characterGuid); stmt->setUInt32(2, realmId); stmt->setUInt8(3, aType); - stmt->setUInt32(4, playerGuid); + stmt->setUInt64(4, playerGuid); stmt->setString(5, systemNote); LoginDatabase.Execute(stmt); } @@ -239,7 +239,7 @@ class CharacterActionIpLogger : public PlayerScript // Once we have done everything, we can insert the new log. LoginDatabasePreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_INS_CHAR_IP_LOGGING); - stmt->setUInt32(0, playerGuid); + stmt->setUInt64(0, playerGuid); stmt->setUInt64(1, characterGuid); stmt->setUInt32(2, realmId); stmt->setUInt8(3, aType); @@ -301,11 +301,11 @@ class CharacterDeleteActionIpLogger : public PlayerScript // Once we have done everything, we can insert the new log. LoginDatabasePreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_INS_ALDL_IP_LOGGING); - stmt->setUInt32(0, playerGuid); + stmt->setUInt64(0, playerGuid); stmt->setUInt64(1, characterGuid); stmt->setUInt32(2, realmId); stmt->setUInt8(3, aType); - stmt->setUInt32(4, playerGuid); + stmt->setUInt64(4, playerGuid); stmt->setString(5, systemNote); // Seeing as the time differences should be minimal, we do not get unixtime and the timestamp right now; diff --git a/src/server/shared/Networking/AsyncAcceptor.h b/src/server/shared/Networking/AsyncAcceptor.h index e88330ebdbab9..cf240e15baeaf 100644 --- a/src/server/shared/Networking/AsyncAcceptor.h +++ b/src/server/shared/Networking/AsyncAcceptor.h @@ -22,6 +22,11 @@ #include "IpAddress.h" #include "Log.h" #include +#include +#include +#include +#include +#include #include #include @@ -46,28 +51,35 @@ class AsyncAcceptor template void AsyncAcceptWithCallback() { - tcp::socket* socket; - uint32 threadIndex; - std::tie(socket, threadIndex) = _socketFactory(); - _acceptor.async_accept(*socket, [this, socket, threadIndex](boost::system::error_code error) - { - if (!error) + boost::asio::co_spawn(_acceptor.get_executor(), + [this]() -> boost::asio::awaitable { - try - { - socket->non_blocking(true); - - acceptCallback(std::move(*socket), threadIndex); - } - catch (boost::system::system_error const& err) + while (!_closed) { - TC_LOG_INFO("network", "Failed to initialize client's socket {}", err.what()); + tcp::socket* socket; + uint32 threadIndex; + std::tie(socket, threadIndex) = _socketFactory(); + + boost::system::error_code error; + co_await _acceptor.async_accept(*socket, boost::asio::redirect_error(boost::asio::use_awaitable, error)); + if (error) + { + if (error == boost::asio::error::operation_aborted) + break; + continue; + } + + try + { + socket->non_blocking(true); + acceptCallback(std::move(*socket), threadIndex); + } + catch (boost::system::system_error const& err) + { + TC_LOG_INFO("network", "Failed to initialize client's socket {}", err.what()); + } } - } - - if (!_closed) - this->AsyncAcceptWithCallback(); - }); + }, boost::asio::detached); } bool Bind() @@ -130,25 +142,30 @@ class AsyncAcceptor template void AsyncAcceptor::AsyncAccept() { - _acceptor.async_accept(_socket, [this](boost::system::error_code error) - { - if (!error) + boost::asio::co_spawn(_acceptor.get_executor(), + [this]() -> boost::asio::awaitable { - try - { - // this-> is required here to fix an segmentation fault in gcc 4.7.2 - reason is lambdas in a templated class - std::make_shared(std::move(this->_socket))->Start(); - } - catch (boost::system::system_error const& err) + while (!_closed) { - TC_LOG_INFO("network", "Failed to retrieve client's remote address {}", err.what()); - } - } + boost::system::error_code error; + co_await _acceptor.async_accept(_socket, boost::asio::redirect_error(boost::asio::use_awaitable, error)); + if (error) + { + if (error == boost::asio::error::operation_aborted) + break; + continue; + } - // lets slap some more this-> on this so we can fix this bug with gcc 4.7.2 throwing internals in yo face - if (!_closed) - this->AsyncAccept(); - }); + try + { + std::make_shared(std::move(_socket))->Start(); + } + catch (boost::system::system_error const& err) + { + TC_LOG_INFO("network", "Failed to retrieve client's remote address {}", err.what()); + } + } + }, boost::asio::detached); } #endif /* __ASYNCACCEPT_H_ */ diff --git a/src/server/shared/Networking/Socket.h b/src/server/shared/Networking/Socket.h index 62edfa4d8cd43..dd7350685628a 100644 --- a/src/server/shared/Networking/Socket.h +++ b/src/server/shared/Networking/Socket.h @@ -26,6 +26,11 @@ #include #include #include +#include +#include +#include +#include +#include using boost::asio::ip::tcp; @@ -39,7 +44,7 @@ class Socket : public std::enable_shared_from_this { public: explicit Socket(tcp::socket&& socket) : _socket(std::move(socket)), _remoteAddress(_socket.remote_endpoint().address()), - _remotePort(_socket.remote_endpoint().port()), _readBuffer(), _closed(false), _closing(false), _isWritingAsync(false) + _remotePort(_socket.remote_endpoint().port()), _readBuffer(), _closed(false), _closing(false), _isWritingAsync(false), _isReadSuspended(false) { _readBuffer.Resize(READ_BLOCK_SIZE); } @@ -84,21 +89,17 @@ class Socket : public std::enable_shared_from_this if (!IsOpen()) return; - _readBuffer.Normalize(); - _readBuffer.EnsureFreeSpace(); - _socket.async_read_some(boost::asio::buffer(_readBuffer.GetWritePointer(), _readBuffer.GetRemainingSpace()), - std::bind(&Socket::ReadHandlerInternal, this->shared_from_this(), std::placeholders::_1, std::placeholders::_2)); + _isReadSuspended = false; + + boost::asio::co_spawn(_socket.get_executor(), + [self = this->shared_from_this()]() -> boost::asio::awaitable { + co_await self->ReadProcess(); + }, boost::asio::detached); } - void AsyncReadWithCallback(void (T::*callback)(boost::system::error_code, std::size_t)) + void SuspendRead() { - if (!IsOpen()) - return; - - _readBuffer.Normalize(); - _readBuffer.EnsureFreeSpace(); - _socket.async_read_some(boost::asio::buffer(_readBuffer.GetWritePointer(), _readBuffer.GetRemainingSpace()), - std::bind(callback, this->shared_from_this(), std::placeholders::_1, std::placeholders::_2)); + _isReadSuspended = true; } void QueuePacket(MessageBuffer&& buffer) @@ -156,12 +157,15 @@ class Socket : public std::enable_shared_from_this _isWritingAsync = true; #ifdef TC_SOCKET_USE_IOCP - MessageBuffer& buffer = _writeQueue.front(); - _socket.async_write_some(boost::asio::buffer(buffer.GetReadPointer(), buffer.GetActiveSize()), std::bind(&Socket::WriteHandler, - this->shared_from_this(), std::placeholders::_1, std::placeholders::_2)); + boost::asio::co_spawn(_socket.get_executor(), + [self = this->shared_from_this()]() -> boost::asio::awaitable { + co_await self->WriteProcess(); + }, boost::asio::detached); #else - _socket.async_write_some(boost::asio::null_buffers(), std::bind(&Socket::WriteHandlerWrapper, - this->shared_from_this(), std::placeholders::_1, std::placeholders::_2)); + boost::asio::co_spawn(_socket.get_executor(), + [self = this->shared_from_this()]() -> boost::asio::awaitable { + co_await self->WriteProcessWrapper(); + }, boost::asio::detached); #endif return false; @@ -177,44 +181,87 @@ class Socket : public std::enable_shared_from_this } private: - void ReadHandlerInternal(boost::system::error_code error, size_t transferredBytes) + boost::asio::awaitable ReadProcess() { - if (error) + while (IsOpen() && !_isReadSuspended) { - CloseSocket(); - return; - } + _readBuffer.Normalize(); + _readBuffer.EnsureFreeSpace(); + + boost::system::error_code error; + std::size_t transferredBytes = co_await _socket.async_read_some( + boost::asio::buffer(_readBuffer.GetWritePointer(), _readBuffer.GetRemainingSpace()), + boost::asio::redirect_error(boost::asio::use_awaitable, error)); + + if (error) + { + if (error != boost::asio::error::eof && error != boost::asio::error::operation_aborted) + TC_LOG_DEBUG("network", "Socket::ReadProcess error: {} - {} ({})", GetRemoteIpAddress().to_string(), error.value(), error.message()); + CloseSocket(); + co_return; + } - _readBuffer.WriteCompleted(transferredBytes); - ReadHandler(); + _readBuffer.WriteCompleted(transferredBytes); + ReadHandler(); + } } #ifdef TC_SOCKET_USE_IOCP - void WriteHandler(boost::system::error_code error, std::size_t transferedBytes) + boost::asio::awaitable WriteProcess() { - if (!error) + while (IsOpen() && !_writeQueue.empty()) { - _isWritingAsync = false; - _writeQueue.front().ReadCompleted(transferedBytes); - if (!_writeQueue.front().GetActiveSize()) - _writeQueue.pop(); - - if (!_writeQueue.empty()) - AsyncProcessQueue(); - else if (_closing) + MessageBuffer& buffer = _writeQueue.front(); + boost::system::error_code error; + std::size_t transferedBytes = co_await _socket.async_write_some( + boost::asio::buffer(buffer.GetReadPointer(), buffer.GetActiveSize()), + boost::asio::redirect_error(boost::asio::use_awaitable, error)); + + if (!error) + { + _writeQueue.front().ReadCompleted(transferedBytes); + if (!_writeQueue.front().GetActiveSize()) + _writeQueue.pop(); + + if (_closing && _writeQueue.empty()) + CloseSocket(); + } + else + { CloseSocket(); + break; + } } - else - CloseSocket(); + _isWritingAsync = false; } #else - void WriteHandlerWrapper(boost::system::error_code /*error*/, std::size_t /*transferedBytes*/) + boost::asio::awaitable WriteProcessWrapper() { + while (IsOpen() && !_writeQueue.empty()) + { + boost::system::error_code error; + co_await _socket.async_write_some(boost::asio::null_buffers(), + boost::asio::redirect_error(boost::asio::use_awaitable, error)); + + if (error) + { + if (error != boost::asio::error::would_block && error != boost::asio::error::try_again) + { + _writeQueue.pop(); + if (_closing && _writeQueue.empty()) + CloseSocket(); + CloseSocket(); + break; + } + } + + if (!HandleQueue()) + break; + } _isWritingAsync = false; - HandleQueue(); } bool HandleQueue() @@ -232,7 +279,7 @@ class Socket : public std::enable_shared_from_this if (error) { if (error == boost::asio::error::would_block || error == boost::asio::error::try_again) - return AsyncProcessQueue(); + return true; _writeQueue.pop(); if (_closing && _writeQueue.empty()) @@ -249,7 +296,7 @@ class Socket : public std::enable_shared_from_this else if (bytesSent < bytesToSend) // now n > 0 { queuedMessage.ReadCompleted(bytesSent); - return AsyncProcessQueue(); + return true; } _writeQueue.pop(); @@ -272,6 +319,7 @@ class Socket : public std::enable_shared_from_this std::atomic _closing; bool _isWritingAsync; + bool _isReadSuspended; }; #endif // __SOCKET_H__