Files
azerothshard-core/modules/PlayerStats/src/scripts/AzthGroupMgr.cpp
2019-08-27 02:58:10 +07:00

35 lines
774 B
C++

#include "AzthGroupMgr.h"
#include "DatabaseEnv.h"
AzthGroupMgr::AzthGroupMgr(Group* original)
{
group = original;
QueryResult result = CharacterDatabase.PQuery("SELECT `MaxlevelGroup`, `MaxGroupSize` FROM `azth_groups` WHERE `guid` = '%u'", group->GetLowGUID());
if (!result)
{
levelMaxGroup = 0;
groupSize = 1;
}
else
{
Field* fields = result->Fetch();
levelMaxGroup = fields[0].GetUInt32();
groupSize = fields[1].GetUInt32();
}
}
AzthGroupMgr::~AzthGroupMgr()
{
}
void AzthGroupMgr::saveToDb()
{
ASSERT(group);
CharacterDatabase.PExecute("UPDATE azth_groups SET MaxLevelGroup = %u, MaxGroupSize = %u WHERE leaderGuid = %u", levelMaxGroup, groupSize, this->group->GetLeaderGUID());
}