mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-17 19:05:42 +00:00
feat(Core/Database): port TrinityCore database API (#5611)
This commit is contained in:
@@ -124,7 +124,7 @@ bool Group::Create(Player* leader)
|
||||
m_raidDifficulty = leader->GetRaidDifficulty();
|
||||
|
||||
// Store group in database
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_GROUP);
|
||||
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_GROUP);
|
||||
|
||||
uint8 index = 0;
|
||||
|
||||
@@ -168,8 +168,8 @@ bool Group::LoadGroupFromDB(Field* fields)
|
||||
// group leader not exist
|
||||
if (!sObjectMgr->GetPlayerNameByGUID(fields[0].GetUInt32(), m_leaderName))
|
||||
{
|
||||
SQLTransaction trans = CharacterDatabase.BeginTransaction();
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_GROUP);
|
||||
CharacterDatabaseTransaction trans = CharacterDatabase.BeginTransaction();
|
||||
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_GROUP);
|
||||
stmt->setUInt32(0, groupLowGuid);
|
||||
trans->Append(stmt);
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_GROUP_MEMBER_ALL);
|
||||
@@ -221,7 +221,7 @@ void Group::LoadMemberFromDB(ObjectGuid::LowType guidLow, uint8 memberFlags, uin
|
||||
// skip non-existed member
|
||||
if (!sObjectMgr->GetPlayerNameByGUID(member.guid.GetCounter(), member.name))
|
||||
{
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_GROUP_MEMBER);
|
||||
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_GROUP_MEMBER);
|
||||
stmt->setUInt32(0, guidLow);
|
||||
stmt->setUInt32(1, GetGUID().GetCounter());
|
||||
CharacterDatabase.Execute(stmt);
|
||||
@@ -247,7 +247,7 @@ void Group::ConvertToLFG()
|
||||
m_lootMethod = NEED_BEFORE_GREED;
|
||||
if (!isBGGroup() && !isBFGroup())
|
||||
{
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_GROUP_TYPE);
|
||||
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_GROUP_TYPE);
|
||||
|
||||
stmt->setUInt8(0, uint8(m_groupType));
|
||||
stmt->setUInt32(1, GetGUID().GetCounter());
|
||||
@@ -266,7 +266,7 @@ void Group::ConvertToRaid()
|
||||
|
||||
if (!isBGGroup() && !isBFGroup())
|
||||
{
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_GROUP_TYPE);
|
||||
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_GROUP_TYPE);
|
||||
|
||||
stmt->setUInt8(0, uint8(m_groupType));
|
||||
stmt->setUInt32(1, GetGUID().GetCounter());
|
||||
@@ -413,7 +413,7 @@ bool Group::AddMember(Player* player)
|
||||
|
||||
if (!isBGGroup() && !isBFGroup())
|
||||
{
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_REP_GROUP_MEMBER);
|
||||
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_REP_GROUP_MEMBER);
|
||||
stmt->setUInt32(0, GetGUID().GetCounter());
|
||||
stmt->setUInt32(1, member.guid.GetCounter());
|
||||
stmt->setUInt8(2, member.flags);
|
||||
@@ -559,7 +559,7 @@ bool Group::RemoveMember(ObjectGuid guid, const RemoveMethod& method /*= GROUP_R
|
||||
// Remove player from group in DB
|
||||
if (!isBGGroup() && !isBFGroup())
|
||||
{
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_GROUP_MEMBER);
|
||||
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_GROUP_MEMBER);
|
||||
stmt->setUInt32(0, guid.GetCounter());
|
||||
stmt->setUInt32(1, GetGUID().GetCounter());
|
||||
CharacterDatabase.Execute(stmt);
|
||||
@@ -687,9 +687,9 @@ void Group::ChangeLeader(ObjectGuid newLeaderGuid)
|
||||
|
||||
if (!isBGGroup() && !isBFGroup())
|
||||
{
|
||||
SQLTransaction trans = CharacterDatabase.BeginTransaction();
|
||||
CharacterDatabaseTransaction trans = CharacterDatabase.BeginTransaction();
|
||||
// Update the group leader
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_GROUP_LEADER);
|
||||
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_GROUP_LEADER);
|
||||
stmt->setUInt32(0, newLeader->GetGUID().GetCounter());
|
||||
stmt->setUInt32(1, GetGUID().GetCounter());
|
||||
trans->Append(stmt);
|
||||
@@ -776,9 +776,9 @@ void Group::Disband(bool hideDestroy /* = false */)
|
||||
|
||||
if (!isBGGroup() && !isBFGroup())
|
||||
{
|
||||
SQLTransaction trans = CharacterDatabase.BeginTransaction();
|
||||
CharacterDatabaseTransaction trans = CharacterDatabase.BeginTransaction();
|
||||
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_GROUP);
|
||||
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_GROUP);
|
||||
stmt->setUInt32(0, GetGUID().GetCounter());
|
||||
trans->Append(stmt);
|
||||
|
||||
@@ -1728,7 +1728,7 @@ void Group::ChangeMembersGroup(ObjectGuid guid, uint8 group)
|
||||
// Preserve new sub group in database for non-raid groups
|
||||
if (!isBGGroup() && !isBFGroup())
|
||||
{
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_GROUP_MEMBER_SUBGROUP);
|
||||
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_GROUP_MEMBER_SUBGROUP);
|
||||
|
||||
stmt->setUInt8(0, group);
|
||||
stmt->setUInt32(1, guid.GetCounter());
|
||||
@@ -1927,7 +1927,7 @@ void Group::SetDungeonDifficulty(Difficulty difficulty)
|
||||
m_dungeonDifficulty = difficulty;
|
||||
if (!isBGGroup() && !isBFGroup())
|
||||
{
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_GROUP_DIFFICULTY);
|
||||
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_GROUP_DIFFICULTY);
|
||||
|
||||
stmt->setUInt8(0, uint8(m_dungeonDifficulty));
|
||||
stmt->setUInt32(1, GetGUID().GetCounter());
|
||||
@@ -1948,7 +1948,7 @@ void Group::SetRaidDifficulty(Difficulty difficulty)
|
||||
m_raidDifficulty = difficulty;
|
||||
if (!isBGGroup() && !isBFGroup())
|
||||
{
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_GROUP_RAID_DIFFICULTY);
|
||||
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_GROUP_RAID_DIFFICULTY);
|
||||
|
||||
stmt->setUInt8(0, uint8(m_raidDifficulty));
|
||||
stmt->setUInt32(1, GetGUID().GetCounter());
|
||||
@@ -2262,7 +2262,7 @@ void Group::SetGroupMemberFlag(ObjectGuid guid, bool apply, GroupMemberFlags fla
|
||||
ToggleGroupMemberFlag(slot, flag, apply);
|
||||
|
||||
// Preserve the new setting in the db
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_GROUP_MEMBER_FLAG);
|
||||
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_GROUP_MEMBER_FLAG);
|
||||
|
||||
stmt->setUInt8(0, slot->flags);
|
||||
stmt->setUInt32(1, guid.GetCounter());
|
||||
|
||||
Reference in New Issue
Block a user