mirror of
https://github.com/mangosfour/server.git
synced 2025-12-15 01:37:00 +00:00
[9339] Use group ids for indexing groups in DB
* Use group ids in DB * Pack used group ids at server startup * Finaly drop group search by leader guid.
This commit is contained in:
parent
b50c3a9355
commit
c9c578b5c3
11 changed files with 129 additions and 68 deletions
|
|
@ -3975,12 +3975,12 @@ void Player::DeleteFromDB(uint64 playerguid, uint32 accountId, bool updateRealmC
|
|||
LeaveAllArenaTeams(playerguid);
|
||||
|
||||
// the player was uninvited already on logout so just remove from group
|
||||
QueryResult *resultGroup = CharacterDatabase.PQuery("SELECT leaderGuid FROM group_member WHERE memberGuid='%u'", guid);
|
||||
QueryResult *resultGroup = CharacterDatabase.PQuery("SELECT groupId FROM group_member WHERE memberGuid='%u'", guid);
|
||||
if(resultGroup)
|
||||
{
|
||||
uint32 leaderGuidLow = (*resultGroup)[0].GetUInt32();
|
||||
uint32 groupId = (*resultGroup)[0].GetUInt32();
|
||||
delete resultGroup;
|
||||
if (Group* group = sObjectMgr.GetGroupByLeaderLowGUID(leaderGuidLow))
|
||||
if (Group* group = sObjectMgr.GetGroupById(groupId))
|
||||
RemoveFromGroup(group, playerguid);
|
||||
}
|
||||
|
||||
|
|
@ -15816,13 +15816,13 @@ void Player::_LoadSpells(QueryResult *result)
|
|||
|
||||
void Player::_LoadGroup(QueryResult *result)
|
||||
{
|
||||
//QueryResult *result = CharacterDatabase.PQuery("SELECT leaderGuid FROM group_member WHERE memberGuid='%u'", GetGUIDLow());
|
||||
//QueryResult *result = CharacterDatabase.PQuery("SELECT groupId FROM group_member WHERE memberGuid='%u'", GetGUIDLow());
|
||||
if (result)
|
||||
{
|
||||
uint32 leaderGuidLow = (*result)[0].GetUInt32();
|
||||
uint32 groupId = (*result)[0].GetUInt32();
|
||||
delete result;
|
||||
|
||||
if (Group* group = sObjectMgr.GetGroupByLeaderLowGUID(leaderGuidLow))
|
||||
if (Group* group = sObjectMgr.GetGroupById(groupId))
|
||||
{
|
||||
uint8 subgroup = group->GetMemberGroup(GetGUID());
|
||||
SetGroup(group, subgroup);
|
||||
|
|
@ -16066,9 +16066,12 @@ void Player::ConvertInstancesToGroup(Player *player, Group *group, uint64 player
|
|||
}
|
||||
|
||||
// if the player's not online we don't know what binds it has
|
||||
if(!player || !group || has_binds) CharacterDatabase.PExecute("INSERT INTO group_instance SELECT guid, instance, permanent FROM character_instance WHERE guid = '%u'", GUID_LOPART(player_guid));
|
||||
if(!player || !group || has_binds)
|
||||
CharacterDatabase.PExecute("INSERT INTO group_instance SELECT guid, instance, permanent FROM character_instance WHERE guid = '%u'", GUID_LOPART(player_guid));
|
||||
|
||||
// the following should not get executed when changing leaders
|
||||
if(!player || has_solo) CharacterDatabase.PExecute("DELETE FROM character_instance WHERE guid = '%d' AND permanent = 0", GUID_LOPART(player_guid));
|
||||
if(!player || has_solo)
|
||||
CharacterDatabase.PExecute("DELETE FROM character_instance WHERE guid = '%d' AND permanent = 0", GUID_LOPART(player_guid));
|
||||
}
|
||||
|
||||
bool Player::_LoadHomeBind(QueryResult *result)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue