Core/ObjectMgr: Refactor group related functions into dedicated class
This commit is contained in:
@@ -21,6 +21,7 @@
|
||||
#include "WorldPacket.h"
|
||||
#include "World.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "GroupMgr.h"
|
||||
#include "SpellMgr.h"
|
||||
#include "Creature.h"
|
||||
#include "QuestDef.h"
|
||||
@@ -480,7 +481,7 @@ void Creature::Update(uint32 diff)
|
||||
|
||||
if (m_groupLootTimer <= diff)
|
||||
{
|
||||
Group* group = sObjectMgr->GetGroupByGUID(lootingGroupLowGUID);
|
||||
Group* group = sGroupMgr->GetGroupByGUID(lootingGroupLowGUID);
|
||||
if (group)
|
||||
group->EndRoll(&loot);
|
||||
m_groupLootTimer = 0;
|
||||
@@ -977,7 +978,7 @@ Group *Creature::GetLootRecipientGroup() const
|
||||
{
|
||||
if (!m_lootRecipientGroup)
|
||||
return NULL;
|
||||
return sObjectMgr->GetGroupByGUID(m_lootRecipientGroup);
|
||||
return sGroupMgr->GetGroupByGUID(m_lootRecipientGroup);
|
||||
}
|
||||
|
||||
void Creature::SetLootRecipient(Unit *unit)
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include "QuestDef.h"
|
||||
#include "GameObjectAI.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "GroupMgr.h"
|
||||
#include "PoolMgr.h"
|
||||
#include "SpellMgr.h"
|
||||
#include "Spell.h"
|
||||
@@ -500,7 +501,7 @@ void GameObject::Update(uint32 diff)
|
||||
{
|
||||
if (m_groupLootTimer <= diff)
|
||||
{
|
||||
Group* group = sObjectMgr->GetGroupByGUID(lootingGroupLowGUID);
|
||||
Group* group = sGroupMgr->GetGroupByGUID(lootingGroupLowGUID);
|
||||
if (group)
|
||||
group->EndRoll(&loot);
|
||||
m_groupLootTimer = 0;
|
||||
|
||||
@@ -43,6 +43,7 @@
|
||||
#include "ObjectMgr.h"
|
||||
#include "ArenaTeamMgr.h"
|
||||
#include "GuildMgr.h"
|
||||
#include "GroupMgr.h"
|
||||
#include "ObjectAccessor.h"
|
||||
#include "CreatureAI.h"
|
||||
#include "Formulas.h"
|
||||
@@ -4736,7 +4737,7 @@ void Player::DeleteFromDB(uint64 playerguid, uint32 accountId, bool updateRealmC
|
||||
// the player was uninvited already on logout so just remove from group
|
||||
QueryResult resultGroup = CharacterDatabase.PQuery("SELECT guid FROM group_member WHERE memberGuid=%u", guid);
|
||||
if (resultGroup)
|
||||
if (Group* group = sObjectMgr->GetGroupByStorageId((*resultGroup)[0].GetUInt32()))
|
||||
if (Group* group = sGroupMgr->GetGroupByDbStoreId((*resultGroup)[0].GetUInt32()))
|
||||
RemoveFromGroup(group, playerguid);
|
||||
|
||||
// Remove signs from petitions (also remove petitions if owner);
|
||||
@@ -17722,7 +17723,7 @@ void Player::_LoadGroup(PreparedQueryResult result)
|
||||
//QueryResult *result = CharacterDatabase.PQuery("SELECT guid FROM group_member WHERE memberGuid=%u", GetGUIDLow());
|
||||
if (result)
|
||||
{
|
||||
if (Group* group = sObjectMgr->GetGroupByStorageId((*result)[0].GetUInt32()))
|
||||
if (Group* group = sGroupMgr->GetGroupByDbStoreId((*result)[0].GetUInt32()))
|
||||
{
|
||||
uint8 subgroup = group->GetMemberGroup(GetGUID());
|
||||
SetGroup(group, subgroup);
|
||||
|
||||
Reference in New Issue
Block a user