Skip to content

Commit

Permalink
SpawnGroup: Implement immutable entries after first spawn in dungeons
Browse files Browse the repository at this point in the history
Trash packs respawn with same entry after wipe or respawn
  • Loading branch information
killerwife committed Jan 16, 2022
1 parent e202f81 commit db67e15
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
22 changes: 21 additions & 1 deletion src/game/Maps/SpawnGroup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,27 @@ void SpawnGroup::Spawn(bool force)
for (auto itr = eligibleGuids.begin(); itr != eligibleGuids.end() && !eligibleGuids.empty() && m_objects.size() < m_entry.MaxCount; ++itr)
{
uint32 dbGuid = *itr;
uint32 entry = GetEligibleEntry(validEntries, minEntries);
uint32 entry = 0;
// creatures pick random entry on first spawn in dungeons - else always pick random entry
if (GetObjectTypeId() == TYPEID_UNIT)
{
if (m_map.IsDungeon())
{
// only held in memory - implement saving to db if it becomes a major issue
if (m_chosenEntries.find(dbGuid) == m_chosenEntries.end())
{
entry = GetEligibleEntry(validEntries, minEntries);
m_chosenEntries[dbGuid] = entry;
}
else
entry = m_chosenEntries[dbGuid];
}
else
entry = GetEligibleEntry(validEntries, minEntries);
}
else // GOs always pick random entry
entry = GetEligibleEntry(validEntries, minEntries);

float x, y;
if (GetObjectTypeId() == TYPEID_UNIT)
{
Expand Down
1 change: 1 addition & 0 deletions src/game/Maps/SpawnGroup.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ class SpawnGroup
SpawnGroupEntry const& m_entry;
Map& m_map;
std::map<uint32, uint32> m_objects;
std::map<uint32, uint32> m_chosenEntries; // dungeon saving for entry per dynguid
uint32 m_objectTypeId;
bool m_enabled;
};
Expand Down

0 comments on commit db67e15

Please sign in to comment.