From 5322ae75ddcd7052644c16d994bd0757eaa48d40 Mon Sep 17 00:00:00 2001 From: hondacrx Date: Thu, 10 Mar 2022 10:29:07 -0500 Subject: [PATCH] Core/Pets: Removed storing stable slot count in db Port From (https://github.com/TrinityCore/TrinityCore/commit/e458144442c1063daf3f47c58349293f90e9da80) --- .../Database/Databases/CharacterDatabase.cs | 8 ++++---- Source/Game/Entities/Pet.cs | 1 - Source/Game/Entities/Player/Player.DB.cs | 15 +++------------ 3 files changed, 7 insertions(+), 17 deletions(-) diff --git a/Source/Framework/Database/Databases/CharacterDatabase.cs b/Source/Framework/Database/Databases/CharacterDatabase.cs index 697eae6fe..0e1b30abf 100644 --- a/Source/Framework/Database/Databases/CharacterDatabase.cs +++ b/Source/Framework/Database/Databases/CharacterDatabase.cs @@ -82,7 +82,7 @@ namespace Framework.Database PrepareStatement(CharStatements.SEL_CHARACTER, "SELECT c.guid, account, name, race, class, gender, level, xp, money, inventorySlots, bankSlots, restState, playerFlags, playerFlagsEx, " + "position_x, position_y, position_z, map, orientation, taximask, createTime, createMode, cinematic, totaltime, leveltime, rest_bonus, logout_time, is_logout_resting, resettalents_cost, " + - "resettalents_time, primarySpecialization, trans_x, trans_y, trans_z, trans_o, transguid, extra_flags, stable_slots, at_login, zone, online, death_expire_time, taxi_path, dungeonDifficulty, " + + "resettalents_time, primarySpecialization, trans_x, trans_y, trans_z, trans_o, transguid, extra_flags, at_login, zone, online, death_expire_time, taxi_path, dungeonDifficulty, " + "totalKills, todayKills, yesterdayKills, chosenTitle, watchedFaction, drunk, health, power1, power2, power3, power4, power5, power6, power7, instance_id, activeTalentGroup, lootSpecId, exploredZones, " + "knownTitles, actionBars, raidDifficulty, legacyRaidDifficulty, fishingSteps, honor, honorLevel, honorRestState, honorRestBonus, numRespecs " + "FROM characters c LEFT JOIN character_fishingsteps cfs ON c.guid = cfs.guid WHERE c.guid = ?"); @@ -462,12 +462,12 @@ namespace Framework.Database PrepareStatement(CharStatements.INS_CHARACTER, "INSERT INTO characters (guid, account, name, race, class, gender, level, xp, money, inventorySlots, bankSlots, restState, playerFlags, playerFlagsEx, " + "map, instance_id, dungeonDifficulty, raidDifficulty, legacyRaidDifficulty, position_x, position_y, position_z, orientation, trans_x, trans_y, trans_z, trans_o, transguid, " + "taximask, createTime, createMode, cinematic, totaltime, leveltime, rest_bonus, logout_time, is_logout_resting, resettalents_cost, resettalents_time, primarySpecialization, " + - "extra_flags, stable_slots, at_login, death_expire_time, taxi_path, totalKills, todayKills, yesterdayKills, chosenTitle, watchedFaction, drunk, health, power1, power2, power3, " + + "extra_flags, at_login, death_expire_time, taxi_path, totalKills, todayKills, yesterdayKills, chosenTitle, watchedFaction, drunk, health, power1, power2, power3, " + "power4, power5, power6, power7, latency, activeTalentGroup, lootSpecId, exploredZones, equipmentCache, knownTitles, actionBars, lastLoginBuild) VALUES " + - "(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"); + "(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"); PrepareStatement(CharStatements.UPD_CHARACTER, "UPDATE characters SET name=?,race=?,class=?,gender=?,level=?,xp=?,money=?,inventorySlots=?,bankSlots=?,restState=?,playerFlags=?,playerFlagsEx=?," + "map=?,instance_id=?,dungeonDifficulty=?,raidDifficulty=?,legacyRaidDifficulty=?,position_x=?,position_y=?,position_z=?,orientation=?,trans_x=?,trans_y=?,trans_z=?,trans_o=?,transguid=?,taximask=?,cinematic=?,totaltime=?,leveltime=?,rest_bonus=?," + - "logout_time=?,is_logout_resting=?,resettalents_cost=?,resettalents_time=?,numRespecs=?,primarySpecialization=?,extra_flags=?,stable_slots=?,at_login=?,zone=?,death_expire_time=?,taxi_path=?," + + "logout_time=?,is_logout_resting=?,resettalents_cost=?,resettalents_time=?,numRespecs=?,primarySpecialization=?,extra_flags=?,at_login=?,zone=?,death_expire_time=?,taxi_path=?," + "totalKills=?,todayKills=?,yesterdayKills=?,chosenTitle=?," + "watchedFaction=?,drunk=?,health=?,power1=?,power2=?,power3=?,power4=?,power5=?,power6=?,power7=?,latency=?,activeTalentGroup=?,lootSpecId=?,exploredZones=?," + "equipmentCache=?,knownTitles=?,actionBars=?,online=?,honor=?,honorLevel=?,honorRestState=?,honorRestBonus=?,lastLoginBuild=? WHERE guid=?"); diff --git a/Source/Game/Entities/Pet.cs b/Source/Game/Entities/Pet.cs index 67b282fb3..c808b5fce 100644 --- a/Source/Game/Entities/Pet.cs +++ b/Source/Game/Entities/Pet.cs @@ -1697,7 +1697,6 @@ namespace Game.Entities public PetInfo CurrentPet; // PET_SAVE_AS_CURRENT public PetInfo[] StabledPets = new PetInfo[SharedConst.MaxPetStables]; // PET_SAVE_FIRST_STABLE_SLOT - PET_SAVE_LAST_STABLE_SLOT - public uint MaxStabledPets = 0; public List UnslottedPets = new(); // PET_SAVE_NOT_IN_SLOT public PetInfo GetUnslottedHunterPet() diff --git a/Source/Game/Entities/Player/Player.DB.cs b/Source/Game/Entities/Player/Player.DB.cs index b0172f77c..7b8603cb3 100644 --- a/Source/Game/Entities/Player/Player.DB.cs +++ b/Source/Game/Entities/Player/Player.DB.cs @@ -1538,18 +1538,12 @@ namespace Game.Entities m_bgData.taxiPath[1] = result.Read(8); m_bgData.mountSpell = result.Read(9); } - void _LoadPetStable(byte petStableSlots, SQLResult result) + void _LoadPetStable(SQLResult result) { - if (petStableSlots == 0 && result.IsEmpty()) + if (result.IsEmpty()) return; m_petStable = new(); - m_petStable.MaxStabledPets = petStableSlots; - if (m_petStable.MaxStabledPets > SharedConst.MaxPetStables) - { - Log.outError(LogFilter.Player, $"Player::LoadFromDB: Player ({GetGUID()}) can't have more stable slots than {SharedConst.MaxPetStables}, but has {m_petStable.MaxStabledPets} in DB"); - m_petStable.MaxStabledPets = SharedConst.MaxPetStables; - } // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 // SELECT id, entry, modelid, level, exp, Reactstate, slot, name, renamed, curhealth, curmana, abdata, savetime, CreatedBySpell, PetType, specialization FROM character_pet WHERE owner = ? @@ -2605,7 +2599,6 @@ namespace Game.Entities float trans_o = result.Read(fieldIndex++); ulong transguid = result.Read(fieldIndex++); PlayerExtraFlags extra_flags = (PlayerExtraFlags)result.Read(fieldIndex++); - byte stable_slots = result.Read(fieldIndex++); ushort at_login = result.Read(fieldIndex++); ushort zone = result.Read(fieldIndex++); byte online = result.Read(fieldIndex++); @@ -3086,7 +3079,7 @@ namespace Game.Entities m_taxi.LoadTaxiMask(taximask); // must be before InitTaxiNodesForLevel - _LoadPetStable(stable_slots, holder.GetResult(PlayerLoginQueryLoad.PetSlots)); + _LoadPetStable(holder.GetResult(PlayerLoginQueryLoad.PetSlots)); // Honor system // Update Honor kills data @@ -3453,7 +3446,6 @@ namespace Game.Entities stmt.AddValue(index++, GetTalentResetTime()); stmt.AddValue(index++, GetPrimarySpecialization()); stmt.AddValue(index++, (ushort)m_ExtraFlags); - stmt.AddValue(index++, m_petStable != null ? m_petStable.MaxStabledPets : 0); stmt.AddValue(index++, (ushort)atLoginFlags); stmt.AddValue(index++, m_deathExpireTime); @@ -3593,7 +3585,6 @@ namespace Game.Entities stmt.AddValue(index++, GetNumRespecs()); stmt.AddValue(index++, GetPrimarySpecialization()); stmt.AddValue(index++, (ushort)m_ExtraFlags); - stmt.AddValue(index++, m_petStable != null ? m_petStable.MaxStabledPets : 0); stmt.AddValue(index++, (ushort)atLoginFlags); stmt.AddValue(index++, GetZoneId()); stmt.AddValue(index++, m_deathExpireTime);