Misc Fixes
This commit is contained in:
@@ -938,11 +938,11 @@ namespace Game.AI
|
|||||||
Creature creature = target.ToCreature();
|
Creature creature = target.ToCreature();
|
||||||
if (creature != null)
|
if (creature != null)
|
||||||
{
|
{
|
||||||
SmartAI smartAI = (SmartAI)creature.GetAI();
|
CreatureAI smartAI = creature.GetAI();
|
||||||
if (smartAI != null)
|
if (smartAI != null && smartAI is SmartAI)
|
||||||
{
|
{
|
||||||
smartAI.SetDespawnTime(respawnDelay);
|
((SmartAI)smartAI).SetDespawnTime(respawnDelay);
|
||||||
smartAI.StartDespawn();
|
((SmartAI)smartAI).StartDespawn();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
creature.DespawnOrUnsummon(respawnDelay);
|
creature.DespawnOrUnsummon(respawnDelay);
|
||||||
|
|||||||
@@ -114,79 +114,84 @@ namespace Game.Collision
|
|||||||
return LoadResult.ReadFromFileFailed;
|
return LoadResult.ReadFromFileFailed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LoadResult result = LoadResult.FileNotFound;
|
||||||
|
|
||||||
TileFileOpenResult fileResult = OpenMapTileFile(VMapManager.VMapPath, iMapID, tileX, tileY, vm);
|
TileFileOpenResult fileResult = OpenMapTileFile(VMapManager.VMapPath, iMapID, tileX, tileY, vm);
|
||||||
if (fileResult.File != null)
|
if (fileResult.File != null)
|
||||||
{
|
{
|
||||||
|
result = LoadResult.Success;
|
||||||
using (BinaryReader reader = new BinaryReader(fileResult.File))
|
using (BinaryReader reader = new BinaryReader(fileResult.File))
|
||||||
{
|
{
|
||||||
if (reader.ReadStringFromChars(8) != MapConst.VMapMagic)
|
if (reader.ReadStringFromChars(8) != MapConst.VMapMagic)
|
||||||
return LoadResult.VersionMismatch;
|
result = LoadResult.VersionMismatch;
|
||||||
|
|
||||||
uint numSpawns = reader.ReadUInt32();
|
if (result == LoadResult.Success)
|
||||||
for (uint i = 0; i < numSpawns; ++i)
|
|
||||||
{
|
{
|
||||||
// read model spawns
|
uint numSpawns = reader.ReadUInt32();
|
||||||
if (ModelSpawn.ReadFromFile(reader, out ModelSpawn spawn))
|
for (uint i = 0; i < numSpawns && result == LoadResult.Success; ++i)
|
||||||
{
|
{
|
||||||
// acquire model instance
|
// read model spawns
|
||||||
WorldModel model = vm.AcquireModelInstance(spawn.name, spawn.flags);
|
if (ModelSpawn.ReadFromFile(reader, out ModelSpawn spawn))
|
||||||
if (model == null)
|
|
||||||
Log.outError(LogFilter.Server, "StaticMapTree.LoadMapTile() : could not acquire WorldModel [{0}, {1}]", tileX, tileY);
|
|
||||||
|
|
||||||
// update tree
|
|
||||||
if (iSpawnIndices.ContainsKey(spawn.Id))
|
|
||||||
{
|
{
|
||||||
uint referencedVal = iSpawnIndices[spawn.Id];
|
// acquire model instance
|
||||||
if (!iLoadedSpawns.ContainsKey(referencedVal))
|
WorldModel model = vm.AcquireModelInstance(spawn.name, spawn.flags);
|
||||||
|
if (model == null)
|
||||||
|
Log.outError(LogFilter.Server, "StaticMapTree.LoadMapTile() : could not acquire WorldModel [{0}, {1}]", tileX, tileY);
|
||||||
|
|
||||||
|
// update tree
|
||||||
|
if (iSpawnIndices.ContainsKey(spawn.Id))
|
||||||
{
|
{
|
||||||
if (referencedVal >= iNTreeValues)
|
uint referencedVal = iSpawnIndices[spawn.Id];
|
||||||
|
if (!iLoadedSpawns.ContainsKey(referencedVal))
|
||||||
{
|
{
|
||||||
Log.outError(LogFilter.Maps, "StaticMapTree.LoadMapTile() : invalid tree element ({0}/{1}) referenced in tile {2}", referencedVal, iNTreeValues, fileResult.Name);
|
if (referencedVal >= iNTreeValues)
|
||||||
continue;
|
{
|
||||||
}
|
Log.outError(LogFilter.Maps, "StaticMapTree.LoadMapTile() : invalid tree element ({0}/{1}) referenced in tile {2}", referencedVal, iNTreeValues, fileResult.Name);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
iTreeValues[referencedVal] = new ModelInstance(spawn, model);
|
iTreeValues[referencedVal] = new ModelInstance(spawn, model);
|
||||||
iLoadedSpawns[referencedVal] = 1;
|
iLoadedSpawns[referencedVal] = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
++iLoadedSpawns[referencedVal];
|
||||||
|
}
|
||||||
|
else if (iMapID == fileResult.UsedMapId)
|
||||||
|
{
|
||||||
|
// unknown parent spawn might appear in because it overlaps multiple tiles
|
||||||
|
// in case the original tile is swapped but its neighbour is now (adding this spawn)
|
||||||
|
// we want to not mark it as loading error and just skip that model
|
||||||
|
Log.outError(LogFilter.Maps, $"StaticMapTree.LoadMapTile() : invalid tree element (spawn {spawn.Id}) referenced in tile fileResult.Name{fileResult.Name} by map {iMapID}");
|
||||||
|
result = LoadResult.ReadFromFileFailed;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
++iLoadedSpawns[referencedVal];
|
|
||||||
}
|
|
||||||
else if (iMapID == fileResult.UsedMapId)
|
|
||||||
{
|
|
||||||
// unknown parent spawn might appear in because it overlaps multiple tiles
|
|
||||||
// in case the original tile is swapped but its neighbour is now (adding this spawn)
|
|
||||||
// we want to not mark it as loading error and just skip that model
|
|
||||||
Log.outError(LogFilter.Maps, $"StaticMapTree.LoadMapTile() : invalid tree element (spawn {spawn.Id}) referenced in tile fileResult.Name{fileResult.Name} by map {iMapID}");
|
|
||||||
return LoadResult.ReadFromFileFailed;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Log.outError(LogFilter.Maps, $"StaticMapTree.LoadMapTile() : cannot read model from file (spawn index {i}) referenced in tile {fileResult.Name} by map {iMapID}");
|
Log.outError(LogFilter.Maps, $"StaticMapTree.LoadMapTile() : cannot read model from file (spawn index {i}) referenced in tile {fileResult.Name} by map {iMapID}");
|
||||||
return LoadResult.ReadFromFileFailed;
|
result = LoadResult.ReadFromFileFailed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
iLoadedTiles[PackTileID(tileX, tileY)] = true;
|
||||||
}
|
}
|
||||||
iLoadedTiles[PackTileID(tileX, tileY)] = true;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
iLoadedTiles[PackTileID(tileX, tileY)] = false;
|
iLoadedTiles[PackTileID(tileX, tileY)] = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return LoadResult.Success;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void UnloadMapTile(uint tileX, uint tileY, VMapManager vm)
|
public void UnloadMapTile(uint tileX, uint tileY, VMapManager vm)
|
||||||
{
|
{
|
||||||
uint tileID = PackTileID(tileX, tileY);
|
uint tileID = PackTileID(tileX, tileY);
|
||||||
var tile = iLoadedTiles.LookupByKey(tileID);
|
|
||||||
if (!iLoadedTiles.ContainsKey(tileID))
|
if (!iLoadedTiles.ContainsKey(tileID))
|
||||||
{
|
{
|
||||||
Log.outError(LogFilter.Server, "StaticMapTree.UnloadMapTile() : trying to unload non-loaded tile - Map:{0} X:{1} Y:{2}", iMapID, tileX, tileY);
|
Log.outError(LogFilter.Server, "StaticMapTree.UnloadMapTile() : trying to unload non-loaded tile - Map:{0} X:{1} Y:{2}", iMapID, tileX, tileY);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (tile) // file associated with tile
|
if (iLoadedTiles[tileID]) // file associated with tile
|
||||||
{
|
{
|
||||||
TileFileOpenResult fileResult = OpenMapTileFile(VMapManager.VMapPath, iMapID, tileX, tileY, vm);
|
TileFileOpenResult fileResult = OpenMapTileFile(VMapManager.VMapPath, iMapID, tileX, tileY, vm);
|
||||||
if (fileResult.File != null)
|
if (fileResult.File != null)
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ namespace Game.DataStorage
|
|||||||
ArtifactStorage = ReadDB2<ArtifactRecord>("Artifact.db2", HotfixStatements.SEL_ARTIFACT, HotfixStatements.SEL_ARTIFACT_APPEARANCE_LOCALE);
|
ArtifactStorage = ReadDB2<ArtifactRecord>("Artifact.db2", HotfixStatements.SEL_ARTIFACT, HotfixStatements.SEL_ARTIFACT_APPEARANCE_LOCALE);
|
||||||
ArtifactAppearanceStorage = ReadDB2<ArtifactAppearanceRecord>("ArtifactAppearance.db2", HotfixStatements.SEL_ARTIFACT_APPEARANCE, HotfixStatements.SEL_ARTIFACT_APPEARANCE_LOCALE);
|
ArtifactAppearanceStorage = ReadDB2<ArtifactAppearanceRecord>("ArtifactAppearance.db2", HotfixStatements.SEL_ARTIFACT_APPEARANCE, HotfixStatements.SEL_ARTIFACT_APPEARANCE_LOCALE);
|
||||||
ArtifactAppearanceSetStorage = ReadDB2<ArtifactAppearanceSetRecord>("ArtifactAppearanceSet.db2", HotfixStatements.SEL_ARTIFACT_APPEARANCE_SET, HotfixStatements.SEL_ARTIFACT_APPEARANCE_SET_LOCALE);
|
ArtifactAppearanceSetStorage = ReadDB2<ArtifactAppearanceSetRecord>("ArtifactAppearanceSet.db2", HotfixStatements.SEL_ARTIFACT_APPEARANCE_SET, HotfixStatements.SEL_ARTIFACT_APPEARANCE_SET_LOCALE);
|
||||||
ArtifactCategoryStorage = ReadDB2<ArtifactCategoryRecord>("ArtifactCategory.db2", HotfixStatements.SEL_ARTIFACT_CATEGORY);
|
//ArtifactCategoryStorage = ReadDB2<ArtifactCategoryRecord>("ArtifactCategory.db2", HotfixStatements.SEL_ARTIFACT_CATEGORY);
|
||||||
ArtifactPowerStorage = ReadDB2<ArtifactPowerRecord>("ArtifactPower.db2", HotfixStatements.SEL_ARTIFACT_POWER);
|
ArtifactPowerStorage = ReadDB2<ArtifactPowerRecord>("ArtifactPower.db2", HotfixStatements.SEL_ARTIFACT_POWER);
|
||||||
ArtifactPowerLinkStorage = ReadDB2<ArtifactPowerLinkRecord>("ArtifactPowerLink.db2", HotfixStatements.SEL_ARTIFACT_POWER_LINK);
|
ArtifactPowerLinkStorage = ReadDB2<ArtifactPowerLinkRecord>("ArtifactPowerLink.db2", HotfixStatements.SEL_ARTIFACT_POWER_LINK);
|
||||||
ArtifactPowerPickerStorage = ReadDB2<ArtifactPowerPickerRecord>("ArtifactPowerPicker.db2", HotfixStatements.SEL_ARTIFACT_POWER_PICKER);
|
ArtifactPowerPickerStorage = ReadDB2<ArtifactPowerPickerRecord>("ArtifactPowerPicker.db2", HotfixStatements.SEL_ARTIFACT_POWER_PICKER);
|
||||||
|
|||||||
@@ -75,9 +75,13 @@ namespace Game.DataStorage
|
|||||||
foreach (AzeriteEmpoweredItemRecord azeriteEmpoweredItem in CliDB.AzeriteEmpoweredItemStorage.Values)
|
foreach (AzeriteEmpoweredItemRecord azeriteEmpoweredItem in CliDB.AzeriteEmpoweredItemStorage.Values)
|
||||||
_azeriteEmpoweredItems[azeriteEmpoweredItem.ItemID] = azeriteEmpoweredItem;
|
_azeriteEmpoweredItems[azeriteEmpoweredItem.ItemID] = azeriteEmpoweredItem;
|
||||||
|
|
||||||
|
CliDB.AzeriteEmpoweredItemStorage.Clear();
|
||||||
|
|
||||||
foreach (AzeriteEssencePowerRecord azeriteEssencePower in CliDB.AzeriteEssencePowerStorage.Values)
|
foreach (AzeriteEssencePowerRecord azeriteEssencePower in CliDB.AzeriteEssencePowerStorage.Values)
|
||||||
_azeriteEssencePowersByIdAndRank[((uint)azeriteEssencePower.AzeriteEssenceID, (uint)azeriteEssencePower.Tier)] = azeriteEssencePower;
|
_azeriteEssencePowersByIdAndRank[((uint)azeriteEssencePower.AzeriteEssenceID, (uint)azeriteEssencePower.Tier)] = azeriteEssencePower;
|
||||||
|
|
||||||
|
CliDB.AzeriteEssencePowerStorage.Clear();
|
||||||
|
|
||||||
foreach (AzeriteItemMilestonePowerRecord azeriteItemMilestonePower in CliDB.AzeriteItemMilestonePowerStorage.Values)
|
foreach (AzeriteItemMilestonePowerRecord azeriteItemMilestonePower in CliDB.AzeriteItemMilestonePowerStorage.Values)
|
||||||
_azeriteItemMilestonePowers.Add(azeriteItemMilestonePower);
|
_azeriteItemMilestonePowers.Add(azeriteItemMilestonePower);
|
||||||
|
|
||||||
@@ -99,6 +103,8 @@ namespace Game.DataStorage
|
|||||||
if (CliDB.AzeritePowerStorage.ContainsKey(azeritePowerSetMember.AzeritePowerID))
|
if (CliDB.AzeritePowerStorage.ContainsKey(azeritePowerSetMember.AzeritePowerID))
|
||||||
_azeritePowers.Add(azeritePowerSetMember.AzeritePowerSetID, azeritePowerSetMember);
|
_azeritePowers.Add(azeritePowerSetMember.AzeritePowerSetID, azeritePowerSetMember);
|
||||||
|
|
||||||
|
CliDB.AzeritePowerSetMemberStorage.Clear();
|
||||||
|
|
||||||
foreach (AzeriteTierUnlockRecord azeriteTierUnlock in CliDB.AzeriteTierUnlockStorage.Values)
|
foreach (AzeriteTierUnlockRecord azeriteTierUnlock in CliDB.AzeriteTierUnlockStorage.Values)
|
||||||
{
|
{
|
||||||
var key = (azeriteTierUnlock.AzeriteTierUnlockSetID, (ItemContext)azeriteTierUnlock.ItemCreationContext);
|
var key = (azeriteTierUnlock.AzeriteTierUnlockSetID, (ItemContext)azeriteTierUnlock.ItemCreationContext);
|
||||||
@@ -2295,7 +2301,7 @@ namespace Game.DataStorage
|
|||||||
Dictionary<short, uint> _itemLevelDeltaToBonusListContainer = new Dictionary<short, uint>();
|
Dictionary<short, uint> _itemLevelDeltaToBonusListContainer = new Dictionary<short, uint>();
|
||||||
MultiMap<uint, ItemBonusTreeNodeRecord> _itemBonusTrees = new MultiMap<uint, ItemBonusTreeNodeRecord>();
|
MultiMap<uint, ItemBonusTreeNodeRecord> _itemBonusTrees = new MultiMap<uint, ItemBonusTreeNodeRecord>();
|
||||||
Dictionary<uint, ItemChildEquipmentRecord> _itemChildEquipment = new Dictionary<uint, ItemChildEquipmentRecord>();
|
Dictionary<uint, ItemChildEquipmentRecord> _itemChildEquipment = new Dictionary<uint, ItemChildEquipmentRecord>();
|
||||||
Array<ItemClassRecord> _itemClassByOldEnum = new Array<ItemClassRecord>(19);
|
ItemClassRecord[] _itemClassByOldEnum = new ItemClassRecord[19];
|
||||||
List<uint> _itemsWithCurrencyCost = new List<uint>();
|
List<uint> _itemsWithCurrencyCost = new List<uint>();
|
||||||
MultiMap<uint, ItemLimitCategoryConditionRecord> _itemCategoryConditions = new MultiMap<uint, ItemLimitCategoryConditionRecord>();
|
MultiMap<uint, ItemLimitCategoryConditionRecord> _itemCategoryConditions = new MultiMap<uint, ItemLimitCategoryConditionRecord>();
|
||||||
MultiMap<uint, ItemLevelSelectorQualityRecord> _itemLevelQualitySelectorQualities = new MultiMap<uint, ItemLevelSelectorQualityRecord>();
|
MultiMap<uint, ItemLevelSelectorQualityRecord> _itemLevelQualitySelectorQualities = new MultiMap<uint, ItemLevelSelectorQualityRecord>();
|
||||||
|
|||||||
@@ -2627,7 +2627,6 @@ namespace Game.Entities
|
|||||||
Log.outError(LogFilter.Player, "GetQuestObjectiveData: called for quest {0} with invalid StorageIndex {1} (objective data is not tracked)", quest.Id, storageIndex);
|
Log.outError(LogFilter.Player, "GetQuestObjectiveData: called for quest {0} with invalid StorageIndex {1} (objective data is not tracked)", quest.Id, storageIndex);
|
||||||
|
|
||||||
var status = m_QuestStatus.LookupByKey(quest.Id);
|
var status = m_QuestStatus.LookupByKey(quest.Id);
|
||||||
|
|
||||||
if (status == null)
|
if (status == null)
|
||||||
{
|
{
|
||||||
Log.outError(LogFilter.Player, "GetQuestObjectiveData: player {0} ({1}) doesn't have quest status data for quest {2}", GetName(), GetGUID().ToString(), quest.Id);
|
Log.outError(LogFilter.Player, "GetQuestObjectiveData: player {0} ({1}) doesn't have quest status data for quest {2}", GetName(), GetGUID().ToString(), quest.Id);
|
||||||
|
|||||||
@@ -2196,7 +2196,6 @@ namespace Game.Entities
|
|||||||
minDamage = Math.Max(0.0f, minDamage);
|
minDamage = Math.Max(0.0f, minDamage);
|
||||||
maxDamage = Math.Max(0.0f, maxDamage);
|
maxDamage = Math.Max(0.0f, maxDamage);
|
||||||
|
|
||||||
|
|
||||||
if (minDamage > maxDamage)
|
if (minDamage > maxDamage)
|
||||||
{
|
{
|
||||||
minDamage = minDamage + maxDamage;
|
minDamage = minDamage + maxDamage;
|
||||||
|
|||||||
@@ -111,12 +111,12 @@ namespace Game.Networking.Packets
|
|||||||
uint Count = _worldPacket.ReadUInt32();
|
uint Count = _worldPacket.ReadUInt32();
|
||||||
Target = _worldPacket.ReadPackedGuid();
|
Target = _worldPacket.ReadPackedGuid();
|
||||||
|
|
||||||
for (uint i = 0; i < Count; ++i)
|
for (int i = 0; i < Count; ++i)
|
||||||
{
|
{
|
||||||
LootRequest lootRequest = new LootRequest();
|
LootRequest lootRequest = new LootRequest();
|
||||||
lootRequest.Object = _worldPacket.ReadPackedGuid();
|
lootRequest.Object = _worldPacket.ReadPackedGuid();
|
||||||
lootRequest.LootListID = _worldPacket.ReadUInt8();
|
lootRequest.LootListID = _worldPacket.ReadUInt8();
|
||||||
Loot.Add(lootRequest);
|
Loot[i] = lootRequest;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -151,7 +151,7 @@ namespace Game.Networking.Packets
|
|||||||
{
|
{
|
||||||
uint size = _worldPacket.ReadUInt32();
|
uint size = _worldPacket.ReadUInt32();
|
||||||
for (int i = 0; i < size; ++i)
|
for (int i = 0; i < size; ++i)
|
||||||
Talents[i].Read(_worldPacket);
|
Talents[i] = new PvPTalent(_worldPacket);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Array<PvPTalent> Talents = new Array<PvPTalent>(4);
|
public Array<PvPTalent> Talents = new Array<PvPTalent>(4);
|
||||||
@@ -182,7 +182,7 @@ namespace Game.Networking.Packets
|
|||||||
public ushort PvPTalentID;
|
public ushort PvPTalentID;
|
||||||
public byte Slot;
|
public byte Slot;
|
||||||
|
|
||||||
public void Read(WorldPacket data)
|
public PvPTalent(WorldPacket data)
|
||||||
{
|
{
|
||||||
PvPTalentID = data.ReadUInt16();
|
PvPTalentID = data.ReadUInt16();
|
||||||
Slot = data.ReadUInt8();
|
Slot = data.ReadUInt8();
|
||||||
|
|||||||
Reference in New Issue
Block a user