mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-16 10:30:27 +00:00
feat(Core/DBLayer): replace char const* to std::string_view (#10211)
* feat(Core/DBLayer): replace `char const*` to `std::string_view` * CString * 1 * chore(Core/Misc): code cleanup * cl * db fix * fmt style sql * to fmt * py * del old * 1 * 2 * 3 * 1 * 1
This commit is contained in:
@@ -140,23 +140,23 @@ bool Group::Create(Player* leader)
|
||||
|
||||
uint8 index = 0;
|
||||
|
||||
stmt->setUInt32(index++, lowguid);
|
||||
stmt->setUInt32(index++, m_leaderGuid.GetCounter());
|
||||
stmt->setUInt8(index++, uint8(m_lootMethod));
|
||||
stmt->setUInt32(index++, m_looterGuid.GetCounter());
|
||||
stmt->setUInt8(index++, uint8(m_lootThreshold));
|
||||
stmt->setUInt64(index++, m_targetIcons[0].GetRawValue());
|
||||
stmt->setUInt64(index++, m_targetIcons[1].GetRawValue());
|
||||
stmt->setUInt64(index++, m_targetIcons[2].GetRawValue());
|
||||
stmt->setUInt64(index++, m_targetIcons[3].GetRawValue());
|
||||
stmt->setUInt64(index++, m_targetIcons[4].GetRawValue());
|
||||
stmt->setUInt64(index++, m_targetIcons[5].GetRawValue());
|
||||
stmt->setUInt64(index++, m_targetIcons[6].GetRawValue());
|
||||
stmt->setUInt64(index++, m_targetIcons[7].GetRawValue());
|
||||
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->SetData(index++, lowguid);
|
||||
stmt->SetData(index++, m_leaderGuid.GetCounter());
|
||||
stmt->SetData(index++, uint8(m_lootMethod));
|
||||
stmt->SetData(index++, m_looterGuid.GetCounter());
|
||||
stmt->SetData(index++, uint8(m_lootThreshold));
|
||||
stmt->SetData(index++, m_targetIcons[0].GetRawValue());
|
||||
stmt->SetData(index++, m_targetIcons[1].GetRawValue());
|
||||
stmt->SetData(index++, m_targetIcons[2].GetRawValue());
|
||||
stmt->SetData(index++, m_targetIcons[3].GetRawValue());
|
||||
stmt->SetData(index++, m_targetIcons[4].GetRawValue());
|
||||
stmt->SetData(index++, m_targetIcons[5].GetRawValue());
|
||||
stmt->SetData(index++, m_targetIcons[6].GetRawValue());
|
||||
stmt->SetData(index++, m_targetIcons[7].GetRawValue());
|
||||
stmt->SetData(index++, uint8(m_groupType));
|
||||
stmt->SetData(index++, uint8(m_dungeonDifficulty));
|
||||
stmt->SetData(index++, uint8(m_raidDifficulty));
|
||||
stmt->SetData(index++, m_masterLooterGuid.GetCounter());
|
||||
|
||||
CharacterDatabase.Execute(stmt);
|
||||
|
||||
@@ -172,52 +172,52 @@ bool Group::Create(Player* leader)
|
||||
|
||||
bool Group::LoadGroupFromDB(Field* fields)
|
||||
{
|
||||
ObjectGuid::LowType groupLowGuid = fields[16].GetUInt32();
|
||||
ObjectGuid::LowType groupLowGuid = fields[16].Get<uint32>();
|
||||
m_guid = ObjectGuid::Create<HighGuid::Group>(groupLowGuid);
|
||||
|
||||
m_leaderGuid = ObjectGuid::Create<HighGuid::Player>(fields[0].GetUInt32());
|
||||
m_leaderGuid = ObjectGuid::Create<HighGuid::Player>(fields[0].Get<uint32>());
|
||||
|
||||
// group leader not exist
|
||||
if (!sCharacterCache->GetCharacterNameByGuid(m_leaderGuid, m_leaderName))
|
||||
{
|
||||
CharacterDatabaseTransaction trans = CharacterDatabase.BeginTransaction();
|
||||
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_GROUP);
|
||||
stmt->setUInt32(0, groupLowGuid);
|
||||
stmt->SetData(0, groupLowGuid);
|
||||
trans->Append(stmt);
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_GROUP_MEMBER_ALL);
|
||||
stmt->setUInt32(0, groupLowGuid);
|
||||
stmt->SetData(0, groupLowGuid);
|
||||
trans->Append(stmt);
|
||||
CharacterDatabase.CommitTransaction(trans);
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_LFG_DATA);
|
||||
stmt->setUInt32(0, groupLowGuid);
|
||||
stmt->SetData(0, groupLowGuid);
|
||||
CharacterDatabase.Execute(stmt);
|
||||
return false;
|
||||
}
|
||||
|
||||
m_lootMethod = LootMethod(fields[1].GetUInt8());
|
||||
m_looterGuid = ObjectGuid::Create<HighGuid::Player>(fields[2].GetUInt32());
|
||||
m_lootThreshold = ItemQualities(fields[3].GetUInt8());
|
||||
m_lootMethod = LootMethod(fields[1].Get<uint8>());
|
||||
m_looterGuid = ObjectGuid::Create<HighGuid::Player>(fields[2].Get<uint32>());
|
||||
m_lootThreshold = ItemQualities(fields[3].Get<uint8>());
|
||||
|
||||
for (uint8 i = 0; i < TARGETICONCOUNT; ++i)
|
||||
m_targetIcons[i].Set(fields[4 + i].GetUInt64());
|
||||
m_targetIcons[i].Set(fields[4 + i].Get<uint64>());
|
||||
|
||||
m_groupType = GroupType(fields[12].GetUInt8());
|
||||
m_groupType = GroupType(fields[12].Get<uint8>());
|
||||
if (m_groupType & GROUPTYPE_RAID)
|
||||
_initRaidSubGroupsCounter();
|
||||
|
||||
uint32 diff = fields[13].GetUInt8();
|
||||
uint32 diff = fields[13].Get<uint8>();
|
||||
if (diff >= MAX_DUNGEON_DIFFICULTY)
|
||||
m_dungeonDifficulty = DUNGEON_DIFFICULTY_NORMAL;
|
||||
else
|
||||
m_dungeonDifficulty = Difficulty(diff);
|
||||
|
||||
uint32 r_diff = fields[14].GetUInt8();
|
||||
uint32 r_diff = fields[14].Get<uint8>();
|
||||
if (r_diff >= MAX_RAID_DIFFICULTY)
|
||||
m_raidDifficulty = RAID_DIFFICULTY_10MAN_NORMAL;
|
||||
else
|
||||
m_raidDifficulty = Difficulty(r_diff);
|
||||
|
||||
m_masterLooterGuid = ObjectGuid::Create<HighGuid::Player>(fields[15].GetUInt32());
|
||||
m_masterLooterGuid = ObjectGuid::Create<HighGuid::Player>(fields[15].Get<uint32>());
|
||||
|
||||
if (m_groupType & GROUPTYPE_LFG)
|
||||
sLFGMgr->_LoadFromDB(fields, GetGUID());
|
||||
@@ -234,8 +234,8 @@ 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->setUInt32(1, GetGUID().GetCounter());
|
||||
stmt->SetData(0, guidLow);
|
||||
stmt->SetData(1, GetGUID().GetCounter());
|
||||
CharacterDatabase.Execute(stmt);
|
||||
return;
|
||||
}
|
||||
@@ -269,8 +269,8 @@ void Group::ConvertToLFG(bool restricted /*= true*/)
|
||||
{
|
||||
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_GROUP_TYPE);
|
||||
|
||||
stmt->setUInt8(0, uint8(m_groupType));
|
||||
stmt->setUInt32(1, GetGUID().GetCounter());
|
||||
stmt->SetData(0, uint8(m_groupType));
|
||||
stmt->SetData(1, GetGUID().GetCounter());
|
||||
|
||||
CharacterDatabase.Execute(stmt);
|
||||
}
|
||||
@@ -288,8 +288,8 @@ void Group::ConvertToRaid()
|
||||
{
|
||||
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_GROUP_TYPE);
|
||||
|
||||
stmt->setUInt8(0, uint8(m_groupType));
|
||||
stmt->setUInt32(1, GetGUID().GetCounter());
|
||||
stmt->SetData(0, uint8(m_groupType));
|
||||
stmt->SetData(1, GetGUID().GetCounter());
|
||||
|
||||
CharacterDatabase.Execute(stmt);
|
||||
}
|
||||
@@ -437,11 +437,11 @@ bool Group::AddMember(Player* player)
|
||||
if (!isBGGroup() && !isBFGroup())
|
||||
{
|
||||
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_REP_GROUP_MEMBER);
|
||||
stmt->setUInt32(0, GetGUID().GetCounter());
|
||||
stmt->setUInt32(1, member.guid.GetCounter());
|
||||
stmt->setUInt8(2, member.flags);
|
||||
stmt->setUInt8(3, member.group);
|
||||
stmt->setUInt8(4, member.roles);
|
||||
stmt->SetData(0, GetGUID().GetCounter());
|
||||
stmt->SetData(1, member.guid.GetCounter());
|
||||
stmt->SetData(2, member.flags);
|
||||
stmt->SetData(3, member.group);
|
||||
stmt->SetData(4, member.roles);
|
||||
CharacterDatabase.Execute(stmt);
|
||||
}
|
||||
|
||||
@@ -583,8 +583,8 @@ bool Group::RemoveMember(ObjectGuid guid, const RemoveMethod& method /*= GROUP_R
|
||||
if (!isBGGroup() && !isBFGroup())
|
||||
{
|
||||
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_GROUP_MEMBER);
|
||||
stmt->setUInt32(0, guid.GetCounter());
|
||||
stmt->setUInt32(1, GetGUID().GetCounter());
|
||||
stmt->SetData(0, guid.GetCounter());
|
||||
stmt->SetData(1, GetGUID().GetCounter());
|
||||
CharacterDatabase.Execute(stmt);
|
||||
}
|
||||
|
||||
@@ -716,8 +716,8 @@ void Group::ChangeLeader(ObjectGuid newLeaderGuid)
|
||||
CharacterDatabaseTransaction trans = CharacterDatabase.BeginTransaction();
|
||||
// Update the group leader
|
||||
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_GROUP_LEADER);
|
||||
stmt->setUInt32(0, newLeader->GetGUID().GetCounter());
|
||||
stmt->setUInt32(1, GetGUID().GetCounter());
|
||||
stmt->SetData(0, newLeader->GetGUID().GetCounter());
|
||||
stmt->SetData(1, GetGUID().GetCounter());
|
||||
trans->Append(stmt);
|
||||
CharacterDatabase.CommitTransaction(trans);
|
||||
|
||||
@@ -807,17 +807,17 @@ void Group::Disband(bool hideDestroy /* = false */)
|
||||
CharacterDatabaseTransaction trans = CharacterDatabase.BeginTransaction();
|
||||
|
||||
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_GROUP);
|
||||
stmt->setUInt32(0, GetGUID().GetCounter());
|
||||
stmt->SetData(0, GetGUID().GetCounter());
|
||||
trans->Append(stmt);
|
||||
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_GROUP_MEMBER_ALL);
|
||||
stmt->setUInt32(0, GetGUID().GetCounter());
|
||||
stmt->SetData(0, GetGUID().GetCounter());
|
||||
trans->Append(stmt);
|
||||
|
||||
CharacterDatabase.CommitTransaction(trans);
|
||||
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_LFG_DATA);
|
||||
stmt->setUInt32(0, GetGUID().GetCounter());
|
||||
stmt->SetData(0, GetGUID().GetCounter());
|
||||
CharacterDatabase.Execute(stmt);
|
||||
}
|
||||
|
||||
@@ -1779,8 +1779,8 @@ 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->SetData(0, group);
|
||||
stmt->SetData(1, guid.GetCounter());
|
||||
|
||||
CharacterDatabase.Execute(stmt);
|
||||
}
|
||||
@@ -1978,8 +1978,8 @@ void Group::SetDungeonDifficulty(Difficulty difficulty)
|
||||
{
|
||||
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_GROUP_DIFFICULTY);
|
||||
|
||||
stmt->setUInt8(0, uint8(m_dungeonDifficulty));
|
||||
stmt->setUInt32(1, GetGUID().GetCounter());
|
||||
stmt->SetData(0, uint8(m_dungeonDifficulty));
|
||||
stmt->SetData(1, GetGUID().GetCounter());
|
||||
|
||||
CharacterDatabase.Execute(stmt);
|
||||
}
|
||||
@@ -1999,8 +1999,8 @@ void Group::SetRaidDifficulty(Difficulty difficulty)
|
||||
{
|
||||
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_GROUP_RAID_DIFFICULTY);
|
||||
|
||||
stmt->setUInt8(0, uint8(m_raidDifficulty));
|
||||
stmt->setUInt32(1, GetGUID().GetCounter());
|
||||
stmt->SetData(0, uint8(m_raidDifficulty));
|
||||
stmt->SetData(1, GetGUID().GetCounter());
|
||||
|
||||
CharacterDatabase.Execute(stmt);
|
||||
}
|
||||
@@ -2314,8 +2314,8 @@ void Group::SetGroupMemberFlag(ObjectGuid guid, bool apply, GroupMemberFlags fla
|
||||
// Preserve the new setting in the db
|
||||
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_GROUP_MEMBER_FLAG);
|
||||
|
||||
stmt->setUInt8(0, slot->flags);
|
||||
stmt->setUInt32(1, guid.GetCounter());
|
||||
stmt->SetData(0, slot->flags);
|
||||
stmt->SetData(1, guid.GetCounter());
|
||||
|
||||
CharacterDatabase.Execute(stmt);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user