Core/Instances: Kill instance_encounters table, it is no longer neccessary
Port From (https://github.com/TrinityCore/TrinityCore/commit/47fc3cb852324119e81c01015b7cc4f39d43e559)
This commit is contained in:
@@ -5495,97 +5495,6 @@ namespace Game
|
||||
|
||||
Log.outInfo(LogFilter.ServerLoading, "Loaded {0} access requirement definitions in {1} ms", count, Time.GetMSTimeDiffToNow(oldMSTime));
|
||||
}
|
||||
public void LoadInstanceEncounters()
|
||||
{
|
||||
uint oldMSTime = Time.GetMSTime();
|
||||
|
||||
// 0 1 2 3
|
||||
SQLResult result = DB.World.Query("SELECT entry, creditType, creditEntry, lastEncounterDungeon FROM instance_encounters");
|
||||
if (result.IsEmpty())
|
||||
{
|
||||
Log.outInfo(LogFilter.ServerLoading, "Loaded 0 instance encounters, table is empty!");
|
||||
return;
|
||||
}
|
||||
|
||||
uint count = 0;
|
||||
Dictionary<uint, Tuple<uint, DungeonEncounterRecord>> dungeonLastBosses = new();
|
||||
do
|
||||
{
|
||||
uint entry = result.Read<uint>(0);
|
||||
EncounterCreditType creditType = (EncounterCreditType)result.Read<byte>(1);
|
||||
uint creditEntry = result.Read<uint>(2);
|
||||
uint lastEncounterDungeon = result.Read<uint>(3);
|
||||
DungeonEncounterRecord dungeonEncounter = CliDB.DungeonEncounterStorage.LookupByKey(entry);
|
||||
if (dungeonEncounter == null)
|
||||
{
|
||||
Log.outError(LogFilter.Sql, "Table `instance_encounters` has an invalid encounter id {0}, skipped!", entry);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (lastEncounterDungeon != 0 && Global.LFGMgr.GetLFGDungeonEntry(lastEncounterDungeon) == 0)
|
||||
{
|
||||
Log.outError(LogFilter.Sql, "Table `instance_encounters` has an encounter {0} ({1}) marked as final for invalid dungeon id {2}, skipped!",
|
||||
entry, dungeonEncounter.Name[Global.WorldMgr.GetDefaultDbcLocale()], lastEncounterDungeon);
|
||||
continue;
|
||||
}
|
||||
|
||||
var pair = dungeonLastBosses.LookupByKey(lastEncounterDungeon);
|
||||
if (lastEncounterDungeon != 0)
|
||||
{
|
||||
if (pair != null)
|
||||
{
|
||||
Log.outError(LogFilter.Sql, "Table `instance_encounters` specified encounter {0} ({1}) as last encounter but {2} ({3}) is already marked as one, skipped!",
|
||||
entry, dungeonEncounter.Name[Global.WorldMgr.GetDefaultDbcLocale()], pair.Item1, pair.Item2.Name[Global.WorldMgr.GetDefaultDbcLocale()]);
|
||||
continue;
|
||||
}
|
||||
|
||||
dungeonLastBosses[lastEncounterDungeon] = Tuple.Create(entry, dungeonEncounter);
|
||||
}
|
||||
|
||||
switch (creditType)
|
||||
{
|
||||
case EncounterCreditType.KillCreature:
|
||||
{
|
||||
CreatureTemplate creatureInfo = GetCreatureTemplate(creditEntry);
|
||||
if (creatureInfo == null)
|
||||
{
|
||||
Log.outError(LogFilter.Sql, "Table `instance_encounters` has an invalid creature (entry {0}) linked to the encounter {1} ({2}), skipped!",
|
||||
creditEntry, entry, dungeonEncounter.Name[Global.WorldMgr.GetDefaultDbcLocale()]);
|
||||
continue;
|
||||
}
|
||||
creatureInfo.FlagsExtra |= CreatureFlagsExtra.DungeonBoss;
|
||||
break;
|
||||
}
|
||||
case EncounterCreditType.CastSpell:
|
||||
if (!Global.SpellMgr.HasSpellInfo(creditEntry, Difficulty.None))
|
||||
{
|
||||
Log.outError(LogFilter.Sql, "Table `instance_encounters` has an invalid spell (entry {0}) linked to the encounter {1} ({2}), skipped!",
|
||||
creditEntry, entry, dungeonEncounter.Name[Global.WorldMgr.GetDefaultDbcLocale()]);
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
Log.outError(LogFilter.Sql, "Table `instance_encounters` has an invalid credit type ({0}) for encounter {1} ({2}), skipped!",
|
||||
creditType, entry, dungeonEncounter.Name[Global.WorldMgr.GetDefaultDbcLocale()]);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (dungeonEncounter.DifficultyID == 0)
|
||||
{
|
||||
foreach (var difficulty in CliDB.DifficultyStorage.Values)
|
||||
{
|
||||
if (Global.DB2Mgr.GetMapDifficultyData((uint)dungeonEncounter.MapID, (Difficulty)difficulty.Id) != null)
|
||||
_dungeonEncounterStorage.Add(MathFunctions.MakePair64((uint)dungeonEncounter.MapID, difficulty.Id), new DungeonEncounter(dungeonEncounter, creditType, creditEntry, lastEncounterDungeon));
|
||||
}
|
||||
}
|
||||
else
|
||||
_dungeonEncounterStorage.Add(MathFunctions.MakePair64((uint)dungeonEncounter.MapID, (uint)dungeonEncounter.DifficultyID), new DungeonEncounter(dungeonEncounter, creditType, creditEntry, lastEncounterDungeon));
|
||||
|
||||
++count;
|
||||
} while (result.NextRow());
|
||||
|
||||
Log.outInfo(LogFilter.ServerLoading, "Loaded {0} instance encounters in {1} ms", count, Time.GetMSTimeDiffToNow(oldMSTime));
|
||||
}
|
||||
public void LoadSpawnGroupTemplates()
|
||||
{
|
||||
uint oldMSTime = Time.GetMSTime();
|
||||
@@ -5876,10 +5785,6 @@ namespace Game
|
||||
|
||||
return false;
|
||||
}
|
||||
public List<DungeonEncounter> GetDungeonEncounterList(uint mapId, Difficulty difficulty)
|
||||
{
|
||||
return _dungeonEncounterStorage.LookupByKey(MathFunctions.MakePair64(mapId, (uint)difficulty));
|
||||
}
|
||||
public bool IsTransportMap(uint mapId) { return _transportMaps.Contains((ushort)mapId); }
|
||||
public SpawnGroupTemplateData GetSpawnGroupData(uint groupId) { return _spawnGroupDataStorage.LookupByKey(groupId); }
|
||||
public SpawnGroupTemplateData GetSpawnGroupData(SpawnObjectType type, ulong spawnId)
|
||||
@@ -10992,7 +10897,6 @@ namespace Game
|
||||
List<uint> _tavernAreaTriggerStorage = new();
|
||||
Dictionary<uint, AreaTriggerStruct> _areaTriggerStorage = new();
|
||||
Dictionary<ulong, AccessRequirement> _accessRequirementStorage = new();
|
||||
MultiMap<ulong, DungeonEncounter> _dungeonEncounterStorage = new();
|
||||
Dictionary<uint, WorldSafeLocsEntry> _worldSafeLocs = new();
|
||||
|
||||
Dictionary<HighGuid, ObjectGuidGenerator> _guidGenerators = new();
|
||||
@@ -11530,22 +11434,6 @@ namespace Game
|
||||
public uint PortLocId;
|
||||
}
|
||||
|
||||
public class DungeonEncounter
|
||||
{
|
||||
public DungeonEncounter(DungeonEncounterRecord _dbcEntry, EncounterCreditType _creditType, uint _creditEntry, uint _lastEncounterDungeon)
|
||||
{
|
||||
dbcEntry = _dbcEntry;
|
||||
creditType = _creditType;
|
||||
creditEntry = _creditEntry;
|
||||
lastEncounterDungeon = _lastEncounterDungeon;
|
||||
}
|
||||
|
||||
public DungeonEncounterRecord dbcEntry;
|
||||
public EncounterCreditType creditType;
|
||||
public uint creditEntry;
|
||||
public uint lastEncounterDungeon;
|
||||
}
|
||||
|
||||
public class MailLevelReward
|
||||
{
|
||||
public MailLevelReward(RaceMask<ulong> _raceMask, uint _mailTemplateId = 0, uint _senderEntry = 0)
|
||||
|
||||
Reference in New Issue
Block a user