mirror of
https://github.com/mangosfour/server.git
synced 2025-12-12 10:37:03 +00:00
[9228] Speedup groups store and other code work.
Signed-off-by: VladimirMangos <vladimir@getmangos.com>
This commit is contained in:
parent
4995a6d298
commit
4178d5bb6a
7 changed files with 74 additions and 91 deletions
|
|
@ -404,8 +404,7 @@ void Creature::Update(uint32 diff)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Group* group = sObjectMgr.GetGroupByLeader(lootingGroupLeaderGUID);
|
if (Group* group = sObjectMgr.GetGroupByLeaderLowGUID(GUID_LOPART(lootingGroupLeaderGUID)))
|
||||||
if (group)
|
|
||||||
group->EndRoll();
|
group->EndRoll();
|
||||||
m_groupLootTimer = 0;
|
m_groupLootTimer = 0;
|
||||||
lootingGroupLeaderGUID = 0;
|
lootingGroupLeaderGUID = 0;
|
||||||
|
|
|
||||||
|
|
@ -1086,7 +1086,7 @@ void LoadLootTemplates_Creature()
|
||||||
{
|
{
|
||||||
if(uint32 lootid = cInfo->lootid)
|
if(uint32 lootid = cInfo->lootid)
|
||||||
{
|
{
|
||||||
if(!ids_set.count(lootid))
|
if (ids_set.find(lootid) == ids_set.end())
|
||||||
LootTemplates_Creature.ReportNotExistedId(lootid);
|
LootTemplates_Creature.ReportNotExistedId(lootid);
|
||||||
else
|
else
|
||||||
ids_setUsed.insert(lootid);
|
ids_setUsed.insert(lootid);
|
||||||
|
|
@ -1116,7 +1116,7 @@ void LoadLootTemplates_Disenchant()
|
||||||
{
|
{
|
||||||
if(uint32 lootid = proto->DisenchantID)
|
if(uint32 lootid = proto->DisenchantID)
|
||||||
{
|
{
|
||||||
if(!ids_set.count(lootid))
|
if (ids_set.find(lootid) == ids_set.end())
|
||||||
LootTemplates_Disenchant.ReportNotExistedId(lootid);
|
LootTemplates_Disenchant.ReportNotExistedId(lootid);
|
||||||
else
|
else
|
||||||
ids_setUsed.insert(lootid);
|
ids_setUsed.insert(lootid);
|
||||||
|
|
@ -1138,7 +1138,7 @@ void LoadLootTemplates_Fishing()
|
||||||
for(uint32 i = 1; i < sAreaStore.GetNumRows(); ++i )
|
for(uint32 i = 1; i < sAreaStore.GetNumRows(); ++i )
|
||||||
{
|
{
|
||||||
if(AreaTableEntry const* areaEntry = sAreaStore.LookupEntry(i))
|
if(AreaTableEntry const* areaEntry = sAreaStore.LookupEntry(i))
|
||||||
if(ids_set.count(areaEntry->ID))
|
if (ids_set.find(areaEntry->ID) != ids_set.end())
|
||||||
ids_set.erase(areaEntry->ID);
|
ids_set.erase(areaEntry->ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1158,7 +1158,7 @@ void LoadLootTemplates_Gameobject()
|
||||||
{
|
{
|
||||||
if(uint32 lootid = gInfo->GetLootId())
|
if(uint32 lootid = gInfo->GetLootId())
|
||||||
{
|
{
|
||||||
if(!ids_set.count(lootid))
|
if (ids_set.find(lootid) == ids_set.end())
|
||||||
LootTemplates_Gameobject.ReportNotExistedId(lootid);
|
LootTemplates_Gameobject.ReportNotExistedId(lootid);
|
||||||
else
|
else
|
||||||
ids_setUsed.insert(lootid);
|
ids_setUsed.insert(lootid);
|
||||||
|
|
@ -1180,7 +1180,7 @@ void LoadLootTemplates_Item()
|
||||||
// remove real entries and check existence loot
|
// remove real entries and check existence loot
|
||||||
for(uint32 i = 1; i < sItemStorage.MaxEntry; ++i )
|
for(uint32 i = 1; i < sItemStorage.MaxEntry; ++i )
|
||||||
if(ItemPrototype const* proto = sItemStorage.LookupEntry<ItemPrototype>(i))
|
if(ItemPrototype const* proto = sItemStorage.LookupEntry<ItemPrototype>(i))
|
||||||
if(ids_set.count(proto->ItemId))
|
if (ids_set.find(proto->ItemId) != ids_set.end())
|
||||||
ids_set.erase(proto->ItemId);
|
ids_set.erase(proto->ItemId);
|
||||||
|
|
||||||
// output error for any still listed (not referenced from appropriate table) ids
|
// output error for any still listed (not referenced from appropriate table) ids
|
||||||
|
|
@ -1202,7 +1202,7 @@ void LoadLootTemplates_Milling()
|
||||||
if((proto->BagFamily & BAG_FAMILY_MASK_HERBS)==0)
|
if((proto->BagFamily & BAG_FAMILY_MASK_HERBS)==0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if(ids_set.count(proto->ItemId))
|
if (ids_set.find(proto->ItemId) != ids_set.end())
|
||||||
ids_set.erase(proto->ItemId);
|
ids_set.erase(proto->ItemId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1222,7 +1222,7 @@ void LoadLootTemplates_Pickpocketing()
|
||||||
{
|
{
|
||||||
if(uint32 lootid = cInfo->pickpocketLootId)
|
if(uint32 lootid = cInfo->pickpocketLootId)
|
||||||
{
|
{
|
||||||
if(!ids_set.count(lootid))
|
if (ids_set.find(lootid) == ids_set.end())
|
||||||
LootTemplates_Pickpocketing.ReportNotExistedId(lootid);
|
LootTemplates_Pickpocketing.ReportNotExistedId(lootid);
|
||||||
else
|
else
|
||||||
ids_setUsed.insert(lootid);
|
ids_setUsed.insert(lootid);
|
||||||
|
|
@ -1251,7 +1251,7 @@ void LoadLootTemplates_Prospecting()
|
||||||
if((proto->BagFamily & BAG_FAMILY_MASK_MINING_SUPP)==0)
|
if((proto->BagFamily & BAG_FAMILY_MASK_MINING_SUPP)==0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if(ids_set.count(proto->ItemId))
|
if (ids_set.find(proto->ItemId) != ids_set.end())
|
||||||
ids_set.erase(proto->ItemId);
|
ids_set.erase(proto->ItemId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1267,7 +1267,7 @@ void LoadLootTemplates_Mail()
|
||||||
// remove real entries and check existence loot
|
// remove real entries and check existence loot
|
||||||
for(uint32 i = 1; i < sMailTemplateStore.GetNumRows(); ++i )
|
for(uint32 i = 1; i < sMailTemplateStore.GetNumRows(); ++i )
|
||||||
if(sMailTemplateStore.LookupEntry(i))
|
if(sMailTemplateStore.LookupEntry(i))
|
||||||
if(ids_set.count(i))
|
if (ids_set.find(i) != ids_set.end())
|
||||||
ids_set.erase(i);
|
ids_set.erase(i);
|
||||||
|
|
||||||
// output error for any still listed (not referenced from appropriate table) ids
|
// output error for any still listed (not referenced from appropriate table) ids
|
||||||
|
|
@ -1286,7 +1286,7 @@ void LoadLootTemplates_Skinning()
|
||||||
{
|
{
|
||||||
if(uint32 lootid = cInfo->SkinLootId)
|
if(uint32 lootid = cInfo->SkinLootId)
|
||||||
{
|
{
|
||||||
if(!ids_set.count(lootid))
|
if (ids_set.find(lootid) == ids_set.end())
|
||||||
LootTemplates_Skinning.ReportNotExistedId(lootid);
|
LootTemplates_Skinning.ReportNotExistedId(lootid);
|
||||||
else
|
else
|
||||||
ids_setUsed.insert(lootid);
|
ids_setUsed.insert(lootid);
|
||||||
|
|
@ -1316,7 +1316,7 @@ void LoadLootTemplates_Spell()
|
||||||
if( !IsLootCraftingSpell(spellInfo))
|
if( !IsLootCraftingSpell(spellInfo))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if(!ids_set.count(spell_id))
|
if (ids_set.find(spell_id) == ids_set.end())
|
||||||
{
|
{
|
||||||
// not report about not trainable spells (optionally supported by DB)
|
// not report about not trainable spells (optionally supported by DB)
|
||||||
// ignore 61756 (Northrend Inscription Research (FAST QA VERSION) for example
|
// ignore 61756 (Northrend Inscription Research (FAST QA VERSION) for example
|
||||||
|
|
|
||||||
|
|
@ -164,8 +164,8 @@ ObjectMgr::~ObjectMgr()
|
||||||
delete[] playerInfo[race][class_].levelInfo;
|
delete[] playerInfo[race][class_].levelInfo;
|
||||||
|
|
||||||
// free group and guild objects
|
// free group and guild objects
|
||||||
for (GroupSet::iterator itr = mGroupSet.begin(); itr != mGroupSet.end(); ++itr)
|
for (GroupMap::iterator itr = mGroupMap.begin(); itr != mGroupMap.end(); ++itr)
|
||||||
delete (*itr);
|
delete itr->second;
|
||||||
|
|
||||||
for (GuildMap::iterator itr = mGuildMap.begin(); itr != mGuildMap.end(); ++itr)
|
for (GuildMap::iterator itr = mGuildMap.begin(); itr != mGuildMap.end(); ++itr)
|
||||||
delete itr->second;
|
delete itr->second;
|
||||||
|
|
@ -180,11 +180,11 @@ ObjectMgr::~ObjectMgr()
|
||||||
itr->second.Clear();
|
itr->second.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
Group * ObjectMgr::GetGroupByLeader(const uint64 &guid) const
|
Group * ObjectMgr::GetGroupByLeaderLowGUID(uint32 guid) const
|
||||||
{
|
{
|
||||||
for(GroupSet::const_iterator itr = mGroupSet.begin(); itr != mGroupSet.end(); ++itr)
|
GroupMap::const_iterator itr = mGroupMap.find(guid);
|
||||||
if ((*itr)->GetLeaderGUID() == guid)
|
if (itr != mGroupMap.end())
|
||||||
return *itr;
|
return itr->second;
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
@ -225,16 +225,6 @@ Guild* ObjectMgr::GetGuildByLeader(const uint64 &guid) const
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ObjectMgr::AddGuild(Guild* guild)
|
|
||||||
{
|
|
||||||
mGuildMap[guild->GetId()] = guild;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ObjectMgr::RemoveGuild(uint32 Id)
|
|
||||||
{
|
|
||||||
mGuildMap.erase(Id);
|
|
||||||
}
|
|
||||||
|
|
||||||
ArenaTeam* ObjectMgr::GetArenaTeamById(uint32 arenateamid) const
|
ArenaTeam* ObjectMgr::GetArenaTeamById(uint32 arenateamid) const
|
||||||
{
|
{
|
||||||
ArenaTeamMap::const_iterator itr = mArenaTeamMap.find(arenateamid);
|
ArenaTeamMap::const_iterator itr = mArenaTeamMap.find(arenateamid);
|
||||||
|
|
@ -262,16 +252,6 @@ ArenaTeam* ObjectMgr::GetArenaTeamByCaptain(uint64 const& guid) const
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ObjectMgr::AddArenaTeam(ArenaTeam* arenaTeam)
|
|
||||||
{
|
|
||||||
mArenaTeamMap[arenaTeam->GetId()] = arenaTeam;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ObjectMgr::RemoveArenaTeam(uint32 Id)
|
|
||||||
{
|
|
||||||
mArenaTeamMap.erase(Id);
|
|
||||||
}
|
|
||||||
|
|
||||||
CreatureInfo const* ObjectMgr::GetCreatureTemplate(uint32 id)
|
CreatureInfo const* ObjectMgr::GetCreatureTemplate(uint32 id)
|
||||||
{
|
{
|
||||||
return sCreatureStorage.LookupEntry<CreatureInfo>(id);
|
return sCreatureStorage.LookupEntry<CreatureInfo>(id);
|
||||||
|
|
@ -3128,8 +3108,6 @@ void ObjectMgr::LoadArenaTeams()
|
||||||
void ObjectMgr::LoadGroups()
|
void ObjectMgr::LoadGroups()
|
||||||
{
|
{
|
||||||
// -- loading groups --
|
// -- loading groups --
|
||||||
Group *group = NULL;
|
|
||||||
uint64 leaderGuid = 0;
|
|
||||||
uint32 count = 0;
|
uint32 count = 0;
|
||||||
// 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
|
// 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
|
||||||
QueryResult *result = CharacterDatabase.Query("SELECT mainTank, mainAssistant, lootMethod, looterGuid, lootThreshold, icon1, icon2, icon3, icon4, icon5, icon6, icon7, icon8, isRaid, difficulty, raiddifficulty, leaderGuid FROM groups");
|
QueryResult *result = CharacterDatabase.Query("SELECT mainTank, mainAssistant, lootMethod, looterGuid, lootThreshold, icon1, icon2, icon3, icon4, icon5, icon6, icon7, icon8, isRaid, difficulty, raiddifficulty, leaderGuid FROM groups");
|
||||||
|
|
@ -3152,9 +3130,8 @@ void ObjectMgr::LoadGroups()
|
||||||
bar.step();
|
bar.step();
|
||||||
Field *fields = result->Fetch();
|
Field *fields = result->Fetch();
|
||||||
++count;
|
++count;
|
||||||
leaderGuid = MAKE_NEW_GUID(fields[16].GetUInt32(),0,HIGHGUID_PLAYER);
|
uint64 leaderGuid = MAKE_NEW_GUID(fields[16].GetUInt32(),0,HIGHGUID_PLAYER);
|
||||||
|
Group *group = new Group;
|
||||||
group = new Group;
|
|
||||||
if(!group->LoadGroupFromDB(leaderGuid, result, false))
|
if(!group->LoadGroupFromDB(leaderGuid, result, false))
|
||||||
{
|
{
|
||||||
group->Disband();
|
group->Disband();
|
||||||
|
|
@ -3171,8 +3148,6 @@ void ObjectMgr::LoadGroups()
|
||||||
|
|
||||||
// -- loading members --
|
// -- loading members --
|
||||||
count = 0;
|
count = 0;
|
||||||
group = NULL;
|
|
||||||
leaderGuid = 0;
|
|
||||||
// 0 1 2 3
|
// 0 1 2 3
|
||||||
result = CharacterDatabase.Query("SELECT memberGuid, assistant, subgroup, leaderGuid FROM group_member ORDER BY leaderGuid");
|
result = CharacterDatabase.Query("SELECT memberGuid, assistant, subgroup, leaderGuid FROM group_member ORDER BY leaderGuid");
|
||||||
if(!result)
|
if(!result)
|
||||||
|
|
@ -3182,28 +3157,34 @@ void ObjectMgr::LoadGroups()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Group* group = NULL; // used as cached pointer for avoid relookup group for each member
|
||||||
|
|
||||||
barGoLink bar2( result->GetRowCount() );
|
barGoLink bar2( result->GetRowCount() );
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
bar2.step();
|
bar2.step();
|
||||||
Field *fields = result->Fetch();
|
Field *fields = result->Fetch();
|
||||||
count++;
|
count++;
|
||||||
leaderGuid = MAKE_NEW_GUID(fields[3].GetUInt32(), 0, HIGHGUID_PLAYER);
|
|
||||||
if(!group || group->GetLeaderGUID() != leaderGuid)
|
uint32 memberGuidlow = fields[0].GetUInt32();
|
||||||
|
bool assistent = fields[1].GetBool();
|
||||||
|
uint8 subgroup = fields[2].GetUInt8();
|
||||||
|
uint32 leaderGuidLow = fields[3].GetUInt32();
|
||||||
|
if(!group || GUID_LOPART(group->GetLeaderGUID()) != leaderGuidLow)
|
||||||
{
|
{
|
||||||
group = GetGroupByLeader(leaderGuid);
|
group = GetGroupByLeaderLowGUID(leaderGuidLow);
|
||||||
if(!group)
|
if(!group)
|
||||||
{
|
{
|
||||||
sLog.outErrorDb("Incorrect entry in group_member table : no group with leader %d for member %d!", fields[3].GetUInt32(), fields[0].GetUInt32());
|
sLog.outErrorDb("Incorrect entry in group_member table : no group with leader %d for member %d!", leaderGuidLow, memberGuidlow);
|
||||||
CharacterDatabase.PExecute("DELETE FROM group_member WHERE memberGuid = '%d'", fields[0].GetUInt32());
|
CharacterDatabase.PExecute("DELETE FROM group_member WHERE memberGuid = '%d'", memberGuidlow);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!group->LoadMemberFromDB(fields[0].GetUInt32(), fields[2].GetUInt8(), fields[1].GetBool()))
|
if(!group->LoadMemberFromDB(memberGuidlow, subgroup, assistent))
|
||||||
{
|
{
|
||||||
sLog.outErrorDb("Incorrect entry in group_member table : member %d cannot be added to player %d's group!", fields[0].GetUInt32(), fields[3].GetUInt32());
|
sLog.outErrorDb("Incorrect entry in group_member table : member %d cannot be added to player %d's group!", memberGuidlow, leaderGuidLow);
|
||||||
CharacterDatabase.PExecute("DELETE FROM group_member WHERE memberGuid = '%d'", fields[0].GetUInt32());
|
CharacterDatabase.PExecute("DELETE FROM group_member WHERE memberGuid = '%d'", memberGuidlow);
|
||||||
}
|
}
|
||||||
}while( result->NextRow() );
|
}while( result->NextRow() );
|
||||||
delete result;
|
delete result;
|
||||||
|
|
@ -3211,13 +3192,13 @@ void ObjectMgr::LoadGroups()
|
||||||
|
|
||||||
// clean groups
|
// clean groups
|
||||||
// TODO: maybe delete from the DB before loading in this case
|
// TODO: maybe delete from the DB before loading in this case
|
||||||
for(GroupSet::iterator itr = mGroupSet.begin(); itr != mGroupSet.end();)
|
for (GroupMap::iterator itr = mGroupMap.begin(); itr != mGroupMap.end();)
|
||||||
{
|
{
|
||||||
if((*itr)->GetMembersCount() < 2)
|
if (itr->second->GetMembersCount() < 2)
|
||||||
{
|
{
|
||||||
(*itr)->Disband();
|
itr->second->Disband();
|
||||||
delete *itr;
|
delete itr->second;
|
||||||
mGroupSet.erase(itr++);
|
mGroupMap.erase(itr++);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
++itr;
|
++itr;
|
||||||
|
|
@ -3225,8 +3206,6 @@ void ObjectMgr::LoadGroups()
|
||||||
|
|
||||||
// -- loading instances --
|
// -- loading instances --
|
||||||
count = 0;
|
count = 0;
|
||||||
group = NULL;
|
|
||||||
leaderGuid = 0;
|
|
||||||
result = CharacterDatabase.Query(
|
result = CharacterDatabase.Query(
|
||||||
// 0 1 2 3 4 5
|
// 0 1 2 3 4 5
|
||||||
"SELECT leaderGuid, map, instance, permanent, difficulty, resettime, "
|
"SELECT leaderGuid, map, instance, permanent, difficulty, resettime, "
|
||||||
|
|
@ -3242,31 +3221,36 @@ void ObjectMgr::LoadGroups()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Group* group = NULL; // used as cached pointer for avoid relookup group for each member
|
||||||
|
|
||||||
barGoLink bar2( result->GetRowCount() );
|
barGoLink bar2( result->GetRowCount() );
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
bar2.step();
|
bar2.step();
|
||||||
Field *fields = result->Fetch();
|
Field *fields = result->Fetch();
|
||||||
count++;
|
count++;
|
||||||
leaderGuid = MAKE_NEW_GUID(fields[0].GetUInt32(), 0, HIGHGUID_PLAYER);
|
|
||||||
if(!group || group->GetLeaderGUID() != leaderGuid)
|
uint32 leaderGuidLow = fields[0].GetUInt32();
|
||||||
|
uint32 mapId = fields[1].GetUInt32();
|
||||||
|
uint32 diff = fields[4].GetUInt8();
|
||||||
|
|
||||||
|
if(!group || GUID_LOPART(group->GetLeaderGUID()) != leaderGuidLow)
|
||||||
{
|
{
|
||||||
group = GetGroupByLeader(leaderGuid);
|
group = GetGroupByLeaderLowGUID(leaderGuidLow);
|
||||||
if(!group)
|
if(!group)
|
||||||
{
|
{
|
||||||
sLog.outErrorDb("Incorrect entry in group_instance table : no group with leader %d", fields[0].GetUInt32());
|
sLog.outErrorDb("Incorrect entry in group_instance table : no group with leader %d", leaderGuidLow);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MapEntry const* mapEntry = sMapStore.LookupEntry(fields[1].GetUInt32());
|
MapEntry const* mapEntry = sMapStore.LookupEntry(mapId);
|
||||||
if(!mapEntry || !mapEntry->IsDungeon())
|
if(!mapEntry || !mapEntry->IsDungeon())
|
||||||
{
|
{
|
||||||
sLog.outErrorDb("Incorrect entry in group_instance table : no dungeon map %d", fields[1].GetUInt32());
|
sLog.outErrorDb("Incorrect entry in group_instance table : no dungeon map %d", mapId);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 diff = fields[4].GetUInt8();
|
|
||||||
if(diff >= (mapEntry->IsRaid() ? MAX_RAID_DIFFICULTY : MAX_DUNGEON_DIFFICULTY))
|
if(diff >= (mapEntry->IsRaid() ? MAX_RAID_DIFFICULTY : MAX_DUNGEON_DIFFICULTY))
|
||||||
{
|
{
|
||||||
sLog.outErrorDb("Wrong dungeon difficulty use in group_instance table: %d", diff + 1);
|
sLog.outErrorDb("Wrong dungeon difficulty use in group_instance table: %d", diff + 1);
|
||||||
|
|
@ -7829,7 +7813,7 @@ void ObjectMgr::LoadTrainerSpell()
|
||||||
|
|
||||||
if(!(cInfo->npcflag & UNIT_NPC_FLAG_TRAINER))
|
if(!(cInfo->npcflag & UNIT_NPC_FLAG_TRAINER))
|
||||||
{
|
{
|
||||||
if(skip_trainers.count(entry) == 0)
|
if (skip_trainers.find(entry) == skip_trainers.end())
|
||||||
{
|
{
|
||||||
sLog.outErrorDb("Table `npc_trainer` have data for not creature template (Entry: %u) without trainer flag, ignore", entry);
|
sLog.outErrorDb("Table `npc_trainer` have data for not creature template (Entry: %u) without trainer flag, ignore", entry);
|
||||||
skip_trainers.insert(entry);
|
skip_trainers.insert(entry);
|
||||||
|
|
@ -7852,7 +7836,7 @@ void ObjectMgr::LoadTrainerSpell()
|
||||||
|
|
||||||
if(GetTalentSpellCost(spell))
|
if(GetTalentSpellCost(spell))
|
||||||
{
|
{
|
||||||
if(talentIds.count(spell)==0)
|
if (talentIds.find(spell) == talentIds.end())
|
||||||
{
|
{
|
||||||
sLog.outErrorDb("Table `npc_trainer` has talent as learning spell %u, ignore", spell);
|
sLog.outErrorDb("Table `npc_trainer` has talent as learning spell %u, ignore", spell);
|
||||||
talentIds.insert(spell);
|
talentIds.insert(spell);
|
||||||
|
|
@ -8380,7 +8364,7 @@ void ObjectMgr::CheckScripts(ScriptMapMap const& scripts,std::set<int32>& ids)
|
||||||
if(!GetMangosStringLocale (itrM->second.dataint))
|
if(!GetMangosStringLocale (itrM->second.dataint))
|
||||||
sLog.outErrorDb( "Table `db_script_string` is missing string id %u, used in database script id %u.", itrM->second.dataint, itrMM->first);
|
sLog.outErrorDb( "Table `db_script_string` is missing string id %u, used in database script id %u.", itrM->second.dataint, itrMM->first);
|
||||||
|
|
||||||
if(ids.count(itrM->second.dataint))
|
if (ids.find(itrM->second.dataint) != ids.end())
|
||||||
ids.erase(itrM->second.dataint);
|
ids.erase(itrM->second.dataint);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,9 @@
|
||||||
#include "Database/DatabaseEnv.h"
|
#include "Database/DatabaseEnv.h"
|
||||||
#include "Mail.h"
|
#include "Mail.h"
|
||||||
#include "Map.h"
|
#include "Map.h"
|
||||||
|
#include "Group.h"
|
||||||
|
#include "Guild.h"
|
||||||
|
#include "ArenaTeam.h"
|
||||||
#include "ObjectAccessor.h"
|
#include "ObjectAccessor.h"
|
||||||
#include "ObjectDefines.h"
|
#include "ObjectDefines.h"
|
||||||
#include "Policies/Singleton.h"
|
#include "Policies/Singleton.h"
|
||||||
|
|
@ -381,9 +384,9 @@ class ObjectMgr
|
||||||
|
|
||||||
typedef UNORDERED_MAP<uint32, Item*> ItemMap;
|
typedef UNORDERED_MAP<uint32, Item*> ItemMap;
|
||||||
|
|
||||||
typedef std::set< Group * > GroupSet;
|
typedef UNORDERED_MAP<uint32, Group*> GroupMap;
|
||||||
|
|
||||||
typedef UNORDERED_MAP<uint32, Guild *> GuildMap;
|
typedef UNORDERED_MAP<uint32, Guild*> GuildMap;
|
||||||
|
|
||||||
typedef UNORDERED_MAP<uint32, ArenaTeam*> ArenaTeamMap;
|
typedef UNORDERED_MAP<uint32, ArenaTeam*> ArenaTeamMap;
|
||||||
|
|
||||||
|
|
@ -408,22 +411,22 @@ class ObjectMgr
|
||||||
void LoadGameobjectInfo();
|
void LoadGameobjectInfo();
|
||||||
void AddGameobjectInfo(GameObjectInfo *goinfo);
|
void AddGameobjectInfo(GameObjectInfo *goinfo);
|
||||||
|
|
||||||
Group * GetGroupByLeader(const uint64 &guid) const;
|
Group * GetGroupByLeaderLowGUID(uint32 lowguid) const;
|
||||||
void AddGroup(Group* group) { mGroupSet.insert( group ); }
|
void AddGroup(Group* group) { mGroupMap[GUID_LOPART(group->GetLeaderGUID())] = group ; }
|
||||||
void RemoveGroup(Group* group) { mGroupSet.erase( group ); }
|
void RemoveGroup(Group* group) { mGroupMap.erase(GUID_LOPART(group->GetLeaderGUID())); }
|
||||||
|
|
||||||
Guild* GetGuildByLeader(uint64 const&guid) const;
|
Guild* GetGuildByLeader(uint64 const&guid) const;
|
||||||
Guild* GetGuildById(uint32 GuildId) const;
|
Guild* GetGuildById(uint32 GuildId) const;
|
||||||
Guild* GetGuildByName(const std::string& guildname) const;
|
Guild* GetGuildByName(const std::string& guildname) const;
|
||||||
std::string GetGuildNameById(uint32 GuildId) const;
|
std::string GetGuildNameById(uint32 GuildId) const;
|
||||||
void AddGuild(Guild* guild);
|
void AddGuild(Guild* guild) { mGuildMap[guild->GetId()] = guild ; }
|
||||||
void RemoveGuild(uint32 Id);
|
void RemoveGuild(uint32 Id) { mGuildMap.erase(Id); }
|
||||||
|
|
||||||
ArenaTeam* GetArenaTeamById(uint32 arenateamid) const;
|
ArenaTeam* GetArenaTeamById(uint32 arenateamid) const;
|
||||||
ArenaTeam* GetArenaTeamByName(const std::string& arenateamname) const;
|
ArenaTeam* GetArenaTeamByName(const std::string& arenateamname) const;
|
||||||
ArenaTeam* GetArenaTeamByCaptain(uint64 const& guid) const;
|
ArenaTeam* GetArenaTeamByCaptain(uint64 const& guid) const;
|
||||||
void AddArenaTeam(ArenaTeam* arenaTeam);
|
void AddArenaTeam(ArenaTeam* arenaTeam) { mArenaTeamMap[arenaTeam->GetId()] = arenaTeam; }
|
||||||
void RemoveArenaTeam(uint32 Id);
|
void RemoveArenaTeam(uint32 Id) { mArenaTeamMap.erase(Id); }
|
||||||
ArenaTeamMap::iterator GetArenaTeamMapBegin() { return mArenaTeamMap.begin(); }
|
ArenaTeamMap::iterator GetArenaTeamMapBegin() { return mArenaTeamMap.begin(); }
|
||||||
ArenaTeamMap::iterator GetArenaTeamMapEnd() { return mArenaTeamMap.end(); }
|
ArenaTeamMap::iterator GetArenaTeamMapEnd() { return mArenaTeamMap.end(); }
|
||||||
|
|
||||||
|
|
@ -909,7 +912,7 @@ class ObjectMgr
|
||||||
typedef std::set<uint32> TavernAreaTriggerSet;
|
typedef std::set<uint32> TavernAreaTriggerSet;
|
||||||
typedef std::set<uint32> GameObjectForQuestSet;
|
typedef std::set<uint32> GameObjectForQuestSet;
|
||||||
|
|
||||||
GroupSet mGroupSet;
|
GroupMap mGroupMap;
|
||||||
GuildMap mGuildMap;
|
GuildMap mGuildMap;
|
||||||
ArenaTeamMap mArenaTeamMap;
|
ArenaTeamMap mArenaTeamMap;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3973,13 +3973,10 @@ void Player::DeleteFromDB(uint64 playerguid, uint32 accountId, bool updateRealmC
|
||||||
QueryResult *resultGroup = CharacterDatabase.PQuery("SELECT leaderGuid FROM group_member WHERE memberGuid='%u'", guid);
|
QueryResult *resultGroup = CharacterDatabase.PQuery("SELECT leaderGuid FROM group_member WHERE memberGuid='%u'", guid);
|
||||||
if(resultGroup)
|
if(resultGroup)
|
||||||
{
|
{
|
||||||
uint64 leaderGuid = MAKE_NEW_GUID((*resultGroup)[0].GetUInt32(), 0, HIGHGUID_PLAYER);
|
uint32 leaderGuidLow = (*resultGroup)[0].GetUInt32();
|
||||||
delete resultGroup;
|
delete resultGroup;
|
||||||
Group* group = sObjectMgr.GetGroupByLeader(leaderGuid);
|
if (Group* group = sObjectMgr.GetGroupByLeaderLowGUID(leaderGuidLow))
|
||||||
if(group)
|
|
||||||
{
|
|
||||||
RemoveFromGroup(group, playerguid);
|
RemoveFromGroup(group, playerguid);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// remove signs from petitions (also remove petitions if owner);
|
// remove signs from petitions (also remove petitions if owner);
|
||||||
|
|
@ -15781,10 +15778,10 @@ void Player::_LoadGroup(QueryResult *result)
|
||||||
//QueryResult *result = CharacterDatabase.PQuery("SELECT leaderGuid FROM group_member WHERE memberGuid='%u'", GetGUIDLow());
|
//QueryResult *result = CharacterDatabase.PQuery("SELECT leaderGuid FROM group_member WHERE memberGuid='%u'", GetGUIDLow());
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
uint64 leaderGuid = MAKE_NEW_GUID((*result)[0].GetUInt32(), 0, HIGHGUID_PLAYER);
|
uint32 leaderGuidLow = (*result)[0].GetUInt32();
|
||||||
delete result;
|
delete result;
|
||||||
|
|
||||||
if (Group* group = sObjectMgr.GetGroupByLeader(leaderGuid))
|
if (Group* group = sObjectMgr.GetGroupByLeaderLowGUID(leaderGuidLow))
|
||||||
{
|
{
|
||||||
uint8 subgroup = group->GetMemberGroup(GetGUID());
|
uint8 subgroup = group->GetMemberGroup(GetGUID());
|
||||||
SetGroup(group, subgroup);
|
SetGroup(group, subgroup);
|
||||||
|
|
|
||||||
|
|
@ -89,7 +89,7 @@ void LoadSkillDiscoveryTable()
|
||||||
SpellEntry const* reqSpellEntry = sSpellStore.LookupEntry(reqSkillOrSpell);
|
SpellEntry const* reqSpellEntry = sSpellStore.LookupEntry(reqSkillOrSpell);
|
||||||
if (!reqSpellEntry)
|
if (!reqSpellEntry)
|
||||||
{
|
{
|
||||||
if(reportedReqSpells.count(reqSkillOrSpell)==0)
|
if (reportedReqSpells.find(reqSkillOrSpell) == reportedReqSpells.end())
|
||||||
{
|
{
|
||||||
sLog.outErrorDb("Spell (ID: %u) have not existed spell (ID: %i) in `reqSpell` field in `skill_discovery_template` table",spellId,reqSkillOrSpell);
|
sLog.outErrorDb("Spell (ID: %u) have not existed spell (ID: %i) in `reqSpell` field in `skill_discovery_template` table",spellId,reqSkillOrSpell);
|
||||||
reportedReqSpells.insert(reqSkillOrSpell);
|
reportedReqSpells.insert(reqSkillOrSpell);
|
||||||
|
|
@ -102,7 +102,7 @@ void LoadSkillDiscoveryTable()
|
||||||
// explicit discovery ability
|
// explicit discovery ability
|
||||||
!IsExplicitDiscoverySpell(reqSpellEntry))
|
!IsExplicitDiscoverySpell(reqSpellEntry))
|
||||||
{
|
{
|
||||||
if (reportedReqSpells.count(reqSkillOrSpell)==0)
|
if (reportedReqSpells.find(reqSkillOrSpell) == reportedReqSpells.end())
|
||||||
{
|
{
|
||||||
sLog.outErrorDb("Spell (ID: %u) not have MECHANIC_DISCOVERY (28) value in Mechanic field in spell.dbc"
|
sLog.outErrorDb("Spell (ID: %u) not have MECHANIC_DISCOVERY (28) value in Mechanic field in spell.dbc"
|
||||||
" and not 100%% chance random discovery ability but listed for spellId %u (and maybe more) in `skill_discovery_template` table",
|
" and not 100%% chance random discovery ability but listed for spellId %u (and maybe more) in `skill_discovery_template` table",
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "9227"
|
#define REVISION_NR "9228"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue