mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-15 23:20:36 +01:00
Core/Pets: Removed storing stable slot count in db
This commit is contained in:
@@ -1826,7 +1826,6 @@ CREATE TABLE `characters` (
|
||||
`trans_o` float NOT NULL DEFAULT '0',
|
||||
`transguid` bigint unsigned NOT NULL DEFAULT '0',
|
||||
`extra_flags` smallint unsigned NOT NULL DEFAULT '0',
|
||||
`stable_slots` tinyint unsigned NOT NULL DEFAULT '0',
|
||||
`at_login` smallint unsigned NOT NULL DEFAULT '0',
|
||||
`zone` smallint unsigned NOT NULL DEFAULT '0',
|
||||
`death_expire_time` bigint NOT NULL DEFAULT '0',
|
||||
@@ -3659,7 +3658,8 @@ INSERT INTO `updates` VALUES
|
||||
('2021_12_31_02_characters.sql','C66A367F0AD7A9D6837238C21E91298413BD960C','ARCHIVED','2021-12-31 16:10:30',0),
|
||||
('2022_01_02_00_characters.sql','5169A5BBACB42E6CEDE405D3C4843FD386CDF92E','ARCHIVED','2022-01-02 21:22:35',0),
|
||||
('2022_01_09_00_characters.sql','3AC51F589821C17027CBA861EF762A709430CDB3','ARCHIVED','2022-01-09 21:29:45',0),
|
||||
('2022_01_15_00_characters.sql','884EFB6592DC8A765E0C0BF8BF907B4E4733BB0C','ARCHIVED','2022-01-15 23:24:58',0);
|
||||
('2022_01_15_00_characters.sql','884EFB6592DC8A765E0C0BF8BF907B4E4733BB0C','ARCHIVED','2022-01-15 23:24:58',0),
|
||||
('2022_01_31_00_characters.sql','19551474AA6079F0616B565F254914C5DD9ED1A1','RELEASED','2022-01-31 14:32:49',0);
|
||||
/*!40000 ALTER TABLE `updates` ENABLE KEYS */;
|
||||
UNLOCK TABLES;
|
||||
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
ALTER TABLE `characters` DROP `stable_slots`;
|
||||
@@ -84,7 +84,7 @@ void CharacterDatabaseConnection::DoPrepareStatements()
|
||||
|
||||
PrepareStatement(CHAR_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 "
|
||||
@@ -471,14 +471,14 @@ void CharacterDatabaseConnection::DoPrepareStatements()
|
||||
"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, "
|
||||
"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 "
|
||||
"(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)", CONNECTION_ASYNC);
|
||||
"(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)", CONNECTION_ASYNC);
|
||||
PrepareStatement(CHAR_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=?", CONNECTION_ASYNC);
|
||||
|
||||
@@ -130,7 +130,6 @@ public:
|
||||
|
||||
Optional<PetInfo> CurrentPet; // PET_SAVE_AS_CURRENT
|
||||
std::array<Optional<PetInfo>, MAX_PET_STABLES> StabledPets; // PET_SAVE_FIRST_STABLE_SLOT - PET_SAVE_LAST_STABLE_SLOT
|
||||
uint32 MaxStabledPets = 0;
|
||||
std::vector<PetInfo> UnslottedPets; // PET_SAVE_NOT_IN_SLOT
|
||||
|
||||
PetInfo const* GetUnslottedHunterPet() const
|
||||
|
||||
@@ -17819,7 +17819,7 @@ bool Player::LoadFromDB(ObjectGuid guid, CharacterDatabaseQueryHolder* holder)
|
||||
{
|
||||
// "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 "
|
||||
@@ -17862,7 +17862,6 @@ bool Player::LoadFromDB(ObjectGuid guid, CharacterDatabaseQueryHolder* holder)
|
||||
float trans_o;
|
||||
ObjectGuid::LowType transguid;
|
||||
uint16 extra_flags;
|
||||
uint8 stable_slots;
|
||||
uint16 at_login;
|
||||
uint16 zone;
|
||||
uint8 online;
|
||||
@@ -17932,7 +17931,6 @@ bool Player::LoadFromDB(ObjectGuid guid, CharacterDatabaseQueryHolder* holder)
|
||||
trans_o = fields[i++].GetFloat();
|
||||
transguid = fields[i++].GetUInt64();
|
||||
extra_flags = fields[i++].GetUInt16();
|
||||
stable_slots = fields[i++].GetUInt8();
|
||||
at_login = fields[i++].GetUInt16();
|
||||
zone = fields[i++].GetUInt16();
|
||||
online = fields[i++].GetUInt8();
|
||||
@@ -18413,7 +18411,7 @@ bool Player::LoadFromDB(ObjectGuid guid, CharacterDatabaseQueryHolder* holder)
|
||||
|
||||
uint32 extraflags = fields.extra_flags;
|
||||
|
||||
_LoadPetStable(fields.stable_slots, holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_PET_SLOTS));
|
||||
_LoadPetStable(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_PET_SLOTS));
|
||||
|
||||
if (HasAtLoginFlag(AT_LOGIN_RENAME))
|
||||
{
|
||||
@@ -20477,7 +20475,6 @@ void Player::SaveToDB(LoginDatabaseTransaction loginTransaction, CharacterDataba
|
||||
stmt->setInt64(index++, GetTalentResetTime());
|
||||
stmt->setUInt32(index++, GetPrimarySpecialization());
|
||||
stmt->setUInt16(index++, (uint16)m_ExtraFlags);
|
||||
stmt->setUInt8(index++, m_petStable ? m_petStable->MaxStabledPets : 0);
|
||||
stmt->setUInt16(index++, (uint16)m_atLoginFlags);
|
||||
stmt->setInt64(index++, m_deathExpireTime);
|
||||
|
||||
@@ -20621,7 +20618,6 @@ void Player::SaveToDB(LoginDatabaseTransaction loginTransaction, CharacterDataba
|
||||
stmt->setUInt8(index++, GetNumRespecs());
|
||||
stmt->setUInt32(index++, GetPrimarySpecialization());
|
||||
stmt->setUInt16(index++, (uint16)m_ExtraFlags);
|
||||
stmt->setUInt8(index++, m_petStable ? m_petStable->MaxStabledPets : 0);
|
||||
stmt->setUInt16(index++, (uint16)m_atLoginFlags);
|
||||
stmt->setUInt16(index++, GetZoneId());
|
||||
stmt->setInt64(index++, m_deathExpireTime);
|
||||
@@ -28296,19 +28292,12 @@ void Player::_LoadInstanceTimeRestrictions(PreparedQueryResult result)
|
||||
} while (result->NextRow());
|
||||
}
|
||||
|
||||
void Player::_LoadPetStable(uint8 petStableSlots, PreparedQueryResult result)
|
||||
void Player::_LoadPetStable(PreparedQueryResult result)
|
||||
{
|
||||
if (!petStableSlots && !result)
|
||||
if (!result)
|
||||
return;
|
||||
|
||||
m_petStable = std::make_unique<PetStable>();
|
||||
m_petStable->MaxStabledPets = petStableSlots;
|
||||
if (m_petStable->MaxStabledPets > MAX_PET_STABLES)
|
||||
{
|
||||
TC_LOG_ERROR("entities.player", "Player::LoadFromDB: Player (%s) can't have more stable slots than %u, but has %u in DB",
|
||||
GetGUID().ToString().c_str(), MAX_PET_STABLES, m_petStable->MaxStabledPets);
|
||||
m_petStable->MaxStabledPets = MAX_PET_STABLES;
|
||||
}
|
||||
|
||||
// 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 = ?
|
||||
|
||||
@@ -2836,7 +2836,7 @@ class TC_GAME_API Player : public Unit, public GridObject<Player>
|
||||
void _LoadTalents(PreparedQueryResult result);
|
||||
void _LoadPvpTalents(PreparedQueryResult result);
|
||||
void _LoadInstanceTimeRestrictions(PreparedQueryResult result);
|
||||
void _LoadPetStable(uint8 petStableSlots, PreparedQueryResult result);
|
||||
void _LoadPetStable(PreparedQueryResult result);
|
||||
void _LoadCurrency(PreparedQueryResult result);
|
||||
void _LoadCUFProfiles(PreparedQueryResult result);
|
||||
|
||||
|
||||
@@ -466,7 +466,7 @@ void WorldSession::HandleStablePet(WorldPacket& recvData)
|
||||
return;
|
||||
}
|
||||
|
||||
for (uint32 freeSlot = 0; freeSlot < petStable->MaxStabledPets; ++freeSlot)
|
||||
for (uint32 freeSlot = 0; freeSlot < petStable->StabledPets.size(); ++freeSlot)
|
||||
{
|
||||
if (!petStable->StabledPets[freeSlot])
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user