Some Cleanups
This commit is contained in:
@@ -79,7 +79,7 @@ namespace BNetServer
|
|||||||
|
|
||||||
static bool StartDB()
|
static bool StartDB()
|
||||||
{
|
{
|
||||||
DatabaseLoader loader = new DatabaseLoader(DatabaseTypeFlags.None);
|
DatabaseLoader loader = new(DatabaseTypeFlags.None);
|
||||||
loader.AddDatabase(DB.Login, "Login");
|
loader.AddDatabase(DB.Login, "Login");
|
||||||
|
|
||||||
if (!loader.Load())
|
if (!loader.Load())
|
||||||
@@ -111,11 +111,11 @@ namespace BNetServer
|
|||||||
|
|
||||||
bool hadWarning = false;
|
bool hadWarning = false;
|
||||||
uint count = 0;
|
uint count = 0;
|
||||||
SQLTransaction trans = new SQLTransaction();
|
SQLTransaction trans = new();
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
uint id = result.Read<uint>(0);
|
uint id = result.Read<uint>(0);
|
||||||
(byte[] salt, byte[] verifier) registrationData = SRP6.MakeRegistrationDataFromHash(result.Read<string>(1).ToByteArray());
|
(byte[] salt, byte[] verifier) = SRP6.MakeRegistrationDataFromHash(result.Read<string>(1).ToByteArray());
|
||||||
|
|
||||||
if (result.Read<long>(2) != 0 && !hadWarning)
|
if (result.Read<long>(2) != 0 && !hadWarning)
|
||||||
{
|
{
|
||||||
@@ -124,8 +124,8 @@ namespace BNetServer
|
|||||||
}
|
}
|
||||||
|
|
||||||
PreparedStatement stmt = DB.Login.GetPreparedStatement(LoginStatements.UPD_LOGON);
|
PreparedStatement stmt = DB.Login.GetPreparedStatement(LoginStatements.UPD_LOGON);
|
||||||
stmt.AddValue(0, registrationData.salt);
|
stmt.AddValue(0, salt);
|
||||||
stmt.AddValue(1, registrationData.verifier);
|
stmt.AddValue(1, verifier);
|
||||||
stmt.AddValue(2, id);
|
stmt.AddValue(2, id);
|
||||||
trans.Append(stmt);
|
trans.Append(stmt);
|
||||||
|
|
||||||
|
|||||||
@@ -1023,6 +1023,7 @@ namespace Framework.Constants
|
|||||||
PlusMaxLevelForExpansion = 2
|
PlusMaxLevelForExpansion = 2
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Flags]
|
||||||
public enum ContentTuningFlag
|
public enum ContentTuningFlag
|
||||||
{
|
{
|
||||||
DisabledForItem = 0x04,
|
DisabledForItem = 0x04,
|
||||||
@@ -1679,6 +1680,7 @@ namespace Framework.Constants
|
|||||||
CooldownExpiresAtDailyReset = 0x08
|
CooldownExpiresAtDailyReset = 0x08
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Flags]
|
||||||
public enum SpellEffectAttributes
|
public enum SpellEffectAttributes
|
||||||
{
|
{
|
||||||
None = 0,
|
None = 0,
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ namespace Framework.Constants
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public const int GTMaxLevel = 100; // All Gt* DBC store data for 100 levels, some by 100 per class/race
|
public const int GTMaxLevel = 100; // All Gt* DBC store data for 100 levels, some by 100 per class/race
|
||||||
public const int GTMaxRating = 32; // gtOCTClassCombatRatingScalar.dbc stores data for 32 ratings, look at MAX_COMBAT_RATING for real used amount
|
public const int GTMaxRating = 32; // gtOCTClassCombatRatingScalar.dbc stores data for 32 ratings, look at MAX_COMBAT_RATING for real used amount
|
||||||
public const int ReputationCap = 42999;
|
public const int ReputationCap = 42000;
|
||||||
public const int ReputationBottom = -42000;
|
public const int ReputationBottom = -42000;
|
||||||
public const int MaxClientMailItems = 12; // max number of items a player is allowed to attach
|
public const int MaxClientMailItems = 12; // max number of items a player is allowed to attach
|
||||||
public const int MaxMailItems = 16;
|
public const int MaxMailItems = 16;
|
||||||
|
|||||||
@@ -98,6 +98,7 @@ namespace Framework.Constants
|
|||||||
Ranged = 2 //hunter range and ranged weapon
|
Ranged = 2 //hunter range and ranged weapon
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Flags]
|
||||||
public enum SpellInterruptFlags
|
public enum SpellInterruptFlags
|
||||||
{
|
{
|
||||||
None = 0,
|
None = 0,
|
||||||
|
|||||||
@@ -744,7 +744,7 @@ namespace Game.Achievements
|
|||||||
DeleteFromDB(guid);
|
DeleteFromDB(guid);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeleteFromDB(ObjectGuid guid)
|
public static void DeleteFromDB(ObjectGuid guid)
|
||||||
{
|
{
|
||||||
SQLTransaction trans = new();
|
SQLTransaction trans = new();
|
||||||
|
|
||||||
|
|||||||
@@ -1625,7 +1625,7 @@ namespace Game.Achievements
|
|||||||
break;
|
break;
|
||||||
case ModifierTreeType.BattlePetAchievementPointsEqualOrGreaterThan: // 76
|
case ModifierTreeType.BattlePetAchievementPointsEqualOrGreaterThan: // 76
|
||||||
{
|
{
|
||||||
short getRootAchievementCategory(AchievementRecord achievement)
|
static short getRootAchievementCategory(AchievementRecord achievement)
|
||||||
{
|
{
|
||||||
short category = (short)achievement.Category;
|
short category = (short)achievement.Category;
|
||||||
do
|
do
|
||||||
|
|||||||
@@ -223,7 +223,7 @@ namespace Game.Chat
|
|||||||
InventoryResult msg = playerTarget.CanStoreNewItem(ItemConst.NullBag, ItemConst.NullSlot, dest, template.Value.GetId(), 1);
|
InventoryResult msg = playerTarget.CanStoreNewItem(ItemConst.NullBag, ItemConst.NullSlot, dest, template.Value.GetId(), 1);
|
||||||
if (msg == InventoryResult.Ok)
|
if (msg == InventoryResult.Ok)
|
||||||
{
|
{
|
||||||
List<uint> bonusListIDsForItem = new List<uint>(bonusListIDs); // copy, bonuses for each depending on context might be different for each item
|
List<uint> bonusListIDsForItem = new(bonusListIDs); // copy, bonuses for each depending on context might be different for each item
|
||||||
if (itemContext != ItemContext.None && itemContext < ItemContext.Max)
|
if (itemContext != ItemContext.None && itemContext < ItemContext.Max)
|
||||||
{
|
{
|
||||||
var contextBonuses = Global.DB2Mgr.GetDefaultItemBonusTree(template.Value.GetId(), itemContext);
|
var contextBonuses = Global.DB2Mgr.GetDefaultItemBonusTree(template.Value.GetId(), itemContext);
|
||||||
|
|||||||
@@ -299,7 +299,7 @@ namespace Game.Combat
|
|||||||
return; // typical causes: bad scripts trying to add threat to GMs, dead targets etc
|
return; // typical causes: bad scripts trying to add threat to GMs, dead targets etc
|
||||||
|
|
||||||
// ok, we're now in combat - create the threat list reference and push it to the respective managers
|
// ok, we're now in combat - create the threat list reference and push it to the respective managers
|
||||||
ThreatReference newRefe = new ThreatReference(this, target, amount);
|
ThreatReference newRefe = new(this, target, amount);
|
||||||
PutThreatListRef(target.GetGUID(), newRefe);
|
PutThreatListRef(target.GetGUID(), newRefe);
|
||||||
target.GetThreatManager().PutThreatenedByMeRef(_owner.GetGUID(), newRefe);
|
target.GetThreatManager().PutThreatenedByMeRef(_owner.GetGUID(), newRefe);
|
||||||
if (!newRefe.IsOffline() && !_ownerEngaged)
|
if (!newRefe.IsOffline() && !_ownerEngaged)
|
||||||
|
|||||||
@@ -27,6 +27,8 @@ using Framework.Dynamic;
|
|||||||
|
|
||||||
namespace Game.DataStorage
|
namespace Game.DataStorage
|
||||||
{
|
{
|
||||||
|
using static CliDB;
|
||||||
|
|
||||||
public class DB2Manager : Singleton<DB2Manager>
|
public class DB2Manager : Singleton<DB2Manager>
|
||||||
{
|
{
|
||||||
DB2Manager()
|
DB2Manager()
|
||||||
@@ -51,28 +53,28 @@ namespace Game.DataStorage
|
|||||||
|
|
||||||
public void LoadStores()
|
public void LoadStores()
|
||||||
{
|
{
|
||||||
foreach (var areaGroupMember in CliDB.AreaGroupMemberStorage.Values)
|
foreach (var areaGroupMember in AreaGroupMemberStorage.Values)
|
||||||
_areaGroupMembers.Add(areaGroupMember.AreaGroupID, areaGroupMember.AreaID);
|
_areaGroupMembers.Add(areaGroupMember.AreaGroupID, areaGroupMember.AreaID);
|
||||||
|
|
||||||
foreach (ArtifactPowerRecord artifactPower in CliDB.ArtifactPowerStorage.Values)
|
foreach (ArtifactPowerRecord artifactPower in ArtifactPowerStorage.Values)
|
||||||
_artifactPowers.Add(artifactPower.ArtifactID, artifactPower);
|
_artifactPowers.Add(artifactPower.ArtifactID, artifactPower);
|
||||||
|
|
||||||
foreach (ArtifactPowerLinkRecord artifactPowerLink in CliDB.ArtifactPowerLinkStorage.Values)
|
foreach (ArtifactPowerLinkRecord artifactPowerLink in ArtifactPowerLinkStorage.Values)
|
||||||
{
|
{
|
||||||
_artifactPowerLinks.Add(artifactPowerLink.PowerA, artifactPowerLink.PowerB);
|
_artifactPowerLinks.Add(artifactPowerLink.PowerA, artifactPowerLink.PowerB);
|
||||||
_artifactPowerLinks.Add(artifactPowerLink.PowerB, artifactPowerLink.PowerA);
|
_artifactPowerLinks.Add(artifactPowerLink.PowerB, artifactPowerLink.PowerA);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (ArtifactPowerRankRecord artifactPowerRank in CliDB.ArtifactPowerRankStorage.Values)
|
foreach (ArtifactPowerRankRecord artifactPowerRank in ArtifactPowerRankStorage.Values)
|
||||||
_artifactPowerRanks[Tuple.Create(artifactPowerRank.ArtifactPowerID, artifactPowerRank.RankIndex)] = artifactPowerRank;
|
_artifactPowerRanks[Tuple.Create(artifactPowerRank.ArtifactPowerID, artifactPowerRank.RankIndex)] = artifactPowerRank;
|
||||||
|
|
||||||
foreach (AzeriteEmpoweredItemRecord azeriteEmpoweredItem in CliDB.AzeriteEmpoweredItemStorage.Values)
|
foreach (AzeriteEmpoweredItemRecord azeriteEmpoweredItem in AzeriteEmpoweredItemStorage.Values)
|
||||||
_azeriteEmpoweredItems[azeriteEmpoweredItem.ItemID] = azeriteEmpoweredItem;
|
_azeriteEmpoweredItems[azeriteEmpoweredItem.ItemID] = azeriteEmpoweredItem;
|
||||||
|
|
||||||
foreach (AzeriteEssencePowerRecord azeriteEssencePower in CliDB.AzeriteEssencePowerStorage.Values)
|
foreach (AzeriteEssencePowerRecord azeriteEssencePower in AzeriteEssencePowerStorage.Values)
|
||||||
_azeriteEssencePowersByIdAndRank[((uint)azeriteEssencePower.AzeriteEssenceID, (uint)azeriteEssencePower.Tier)] = azeriteEssencePower;
|
_azeriteEssencePowersByIdAndRank[((uint)azeriteEssencePower.AzeriteEssenceID, azeriteEssencePower.Tier)] = azeriteEssencePower;
|
||||||
|
|
||||||
foreach (AzeriteItemMilestonePowerRecord azeriteItemMilestonePower in CliDB.AzeriteItemMilestonePowerStorage.Values)
|
foreach (AzeriteItemMilestonePowerRecord azeriteItemMilestonePower in AzeriteItemMilestonePowerStorage.Values)
|
||||||
_azeriteItemMilestonePowers.Add(azeriteItemMilestonePower);
|
_azeriteItemMilestonePowers.Add(azeriteItemMilestonePower);
|
||||||
|
|
||||||
_azeriteItemMilestonePowers = _azeriteItemMilestonePowers.OrderBy(p => p.RequiredLevel).ToList();
|
_azeriteItemMilestonePowers = _azeriteItemMilestonePowers.OrderBy(p => p.RequiredLevel).ToList();
|
||||||
@@ -89,11 +91,11 @@ namespace Game.DataStorage
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (AzeritePowerSetMemberRecord azeritePowerSetMember in CliDB.AzeritePowerSetMemberStorage.Values)
|
foreach (AzeritePowerSetMemberRecord azeritePowerSetMember in AzeritePowerSetMemberStorage.Values)
|
||||||
if (CliDB.AzeritePowerStorage.ContainsKey(azeritePowerSetMember.AzeritePowerID))
|
if (AzeritePowerStorage.ContainsKey(azeritePowerSetMember.AzeritePowerID))
|
||||||
_azeritePowers.Add(azeritePowerSetMember.AzeritePowerSetID, azeritePowerSetMember);
|
_azeritePowers.Add(azeritePowerSetMember.AzeritePowerSetID, azeritePowerSetMember);
|
||||||
|
|
||||||
foreach (AzeriteTierUnlockRecord azeriteTierUnlock in CliDB.AzeriteTierUnlockStorage.Values)
|
foreach (AzeriteTierUnlockRecord azeriteTierUnlock in AzeriteTierUnlockStorage.Values)
|
||||||
{
|
{
|
||||||
var key = (azeriteTierUnlock.AzeriteTierUnlockSetID, (ItemContext)azeriteTierUnlock.ItemCreationContext);
|
var key = (azeriteTierUnlock.AzeriteTierUnlockSetID, (ItemContext)azeriteTierUnlock.ItemCreationContext);
|
||||||
|
|
||||||
@@ -104,10 +106,10 @@ namespace Game.DataStorage
|
|||||||
}
|
}
|
||||||
|
|
||||||
MultiMap<uint, AzeriteUnlockMappingRecord> azeriteUnlockMappings = new();
|
MultiMap<uint, AzeriteUnlockMappingRecord> azeriteUnlockMappings = new();
|
||||||
foreach (AzeriteUnlockMappingRecord azeriteUnlockMapping in CliDB.AzeriteUnlockMappingStorage.Values)
|
foreach (AzeriteUnlockMappingRecord azeriteUnlockMapping in AzeriteUnlockMappingStorage.Values)
|
||||||
azeriteUnlockMappings.Add(azeriteUnlockMapping.AzeriteUnlockMappingSetID, azeriteUnlockMapping);
|
azeriteUnlockMappings.Add(azeriteUnlockMapping.AzeriteUnlockMappingSetID, azeriteUnlockMapping);
|
||||||
|
|
||||||
foreach (BattlemasterListRecord battlemaster in CliDB.BattlemasterListStorage.Values)
|
foreach (BattlemasterListRecord battlemaster in BattlemasterListStorage.Values)
|
||||||
{
|
{
|
||||||
if (battlemaster.MaxLevel < battlemaster.MinLevel)
|
if (battlemaster.MaxLevel < battlemaster.MinLevel)
|
||||||
{
|
{
|
||||||
@@ -121,14 +123,14 @@ namespace Game.DataStorage
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var uiDisplay in CliDB.ChrClassUIDisplayStorage.Values)
|
foreach (var uiDisplay in ChrClassUIDisplayStorage.Values)
|
||||||
{
|
{
|
||||||
Cypher.Assert(uiDisplay.ChrClassesID < (byte)Class.Max);
|
Cypher.Assert(uiDisplay.ChrClassesID < (byte)Class.Max);
|
||||||
_uiDisplayByClass[uiDisplay.ChrClassesID] = uiDisplay;
|
_uiDisplayByClass[uiDisplay.ChrClassesID] = uiDisplay;
|
||||||
}
|
}
|
||||||
|
|
||||||
var powers = new List<ChrClassesXPowerTypesRecord>();
|
var powers = new List<ChrClassesXPowerTypesRecord>();
|
||||||
foreach (var chrClasses in CliDB.ChrClassesXPowerTypesStorage.Values)
|
foreach (var chrClasses in ChrClassesXPowerTypesStorage.Values)
|
||||||
powers.Add(chrClasses);
|
powers.Add(chrClasses);
|
||||||
|
|
||||||
powers.Sort(new ChrClassesXPowerTypesRecordComparer());
|
powers.Sort(new ChrClassesXPowerTypesRecordComparer());
|
||||||
@@ -142,23 +144,23 @@ namespace Game.DataStorage
|
|||||||
_powersByClass[power.ClassID][power.PowerType] = index;
|
_powersByClass[power.ClassID][power.PowerType] = index;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var customizationChoice in CliDB.ChrCustomizationChoiceStorage.Values)
|
foreach (var customizationChoice in ChrCustomizationChoiceStorage.Values)
|
||||||
_chrCustomizationChoicesByOption.Add(customizationChoice.ChrCustomizationOptionID, customizationChoice);
|
_chrCustomizationChoicesByOption.Add(customizationChoice.ChrCustomizationOptionID, customizationChoice);
|
||||||
|
|
||||||
MultiMap<uint, Tuple<uint, byte>> shapeshiftFormByModel = new();
|
MultiMap<uint, Tuple<uint, byte>> shapeshiftFormByModel = new();
|
||||||
Dictionary<uint, ChrCustomizationDisplayInfoRecord> displayInfoByCustomizationChoice = new();
|
Dictionary<uint, ChrCustomizationDisplayInfoRecord> displayInfoByCustomizationChoice = new();
|
||||||
|
|
||||||
// build shapeshift form model lookup
|
// build shapeshift form model lookup
|
||||||
foreach (ChrCustomizationElementRecord customizationElement in CliDB.ChrCustomizationElementStorage.Values)
|
foreach (ChrCustomizationElementRecord customizationElement in ChrCustomizationElementStorage.Values)
|
||||||
{
|
{
|
||||||
ChrCustomizationDisplayInfoRecord customizationDisplayInfo = CliDB.ChrCustomizationDisplayInfoStorage.LookupByKey(customizationElement.ChrCustomizationDisplayInfoID);
|
ChrCustomizationDisplayInfoRecord customizationDisplayInfo = ChrCustomizationDisplayInfoStorage.LookupByKey(customizationElement.ChrCustomizationDisplayInfoID);
|
||||||
if (customizationDisplayInfo != null)
|
if (customizationDisplayInfo != null)
|
||||||
{
|
{
|
||||||
ChrCustomizationChoiceRecord customizationChoice = CliDB.ChrCustomizationChoiceStorage.LookupByKey(customizationElement.ChrCustomizationChoiceID);
|
ChrCustomizationChoiceRecord customizationChoice = ChrCustomizationChoiceStorage.LookupByKey(customizationElement.ChrCustomizationChoiceID);
|
||||||
if (customizationChoice != null)
|
if (customizationChoice != null)
|
||||||
{
|
{
|
||||||
displayInfoByCustomizationChoice[customizationElement.ChrCustomizationChoiceID] = customizationDisplayInfo;
|
displayInfoByCustomizationChoice[customizationElement.ChrCustomizationChoiceID] = customizationDisplayInfo;
|
||||||
ChrCustomizationOptionRecord customizationOption = CliDB.ChrCustomizationOptionStorage.LookupByKey(customizationChoice.ChrCustomizationOptionID);
|
ChrCustomizationOptionRecord customizationOption = ChrCustomizationOptionStorage.LookupByKey(customizationChoice.ChrCustomizationOptionID);
|
||||||
if (customizationOption != null)
|
if (customizationOption != null)
|
||||||
shapeshiftFormByModel.Add(customizationOption.ChrModelID, Tuple.Create(customizationOption.Id, (byte)customizationDisplayInfo.ShapeshiftFormID));
|
shapeshiftFormByModel.Add(customizationOption.ChrModelID, Tuple.Create(customizationOption.Id, (byte)customizationDisplayInfo.ShapeshiftFormID));
|
||||||
}
|
}
|
||||||
@@ -166,12 +168,12 @@ namespace Game.DataStorage
|
|||||||
}
|
}
|
||||||
|
|
||||||
MultiMap<uint, ChrCustomizationOptionRecord> customizationOptionsByModel = new();
|
MultiMap<uint, ChrCustomizationOptionRecord> customizationOptionsByModel = new();
|
||||||
foreach (ChrCustomizationOptionRecord customizationOption in CliDB.ChrCustomizationOptionStorage.Values)
|
foreach (ChrCustomizationOptionRecord customizationOption in ChrCustomizationOptionStorage.Values)
|
||||||
customizationOptionsByModel.Add(customizationOption.ChrModelID, customizationOption);
|
customizationOptionsByModel.Add(customizationOption.ChrModelID, customizationOption);
|
||||||
|
|
||||||
foreach (ChrCustomizationReqChoiceRecord reqChoice in CliDB.ChrCustomizationReqChoiceStorage.Values)
|
foreach (ChrCustomizationReqChoiceRecord reqChoice in ChrCustomizationReqChoiceStorage.Values)
|
||||||
{
|
{
|
||||||
ChrCustomizationChoiceRecord customizationChoice = CliDB.ChrCustomizationChoiceStorage.LookupByKey(reqChoice.ChrCustomizationChoiceID);
|
ChrCustomizationChoiceRecord customizationChoice = ChrCustomizationChoiceStorage.LookupByKey(reqChoice.ChrCustomizationChoiceID);
|
||||||
if (customizationChoice != null)
|
if (customizationChoice != null)
|
||||||
{
|
{
|
||||||
if (!_chrCustomizationRequiredChoices.ContainsKey(reqChoice.ChrCustomizationReqID))
|
if (!_chrCustomizationRequiredChoices.ContainsKey(reqChoice.ChrCustomizationReqID))
|
||||||
@@ -182,13 +184,13 @@ namespace Game.DataStorage
|
|||||||
}
|
}
|
||||||
|
|
||||||
Dictionary<uint, uint> parentRaces = new();
|
Dictionary<uint, uint> parentRaces = new();
|
||||||
foreach (ChrRacesRecord chrRace in CliDB.ChrRacesStorage.Values)
|
foreach (ChrRacesRecord chrRace in ChrRacesStorage.Values)
|
||||||
if (chrRace.UnalteredVisualRaceID != 0)
|
if (chrRace.UnalteredVisualRaceID != 0)
|
||||||
parentRaces[(uint)chrRace.UnalteredVisualRaceID] = chrRace.Id;
|
parentRaces[(uint)chrRace.UnalteredVisualRaceID] = chrRace.Id;
|
||||||
|
|
||||||
foreach (ChrRaceXChrModelRecord raceModel in CliDB.ChrRaceXChrModelStorage.Values)
|
foreach (ChrRaceXChrModelRecord raceModel in ChrRaceXChrModelStorage.Values)
|
||||||
{
|
{
|
||||||
ChrModelRecord model = CliDB.ChrModelStorage.LookupByKey(raceModel.ChrModelID);
|
ChrModelRecord model = ChrModelStorage.LookupByKey(raceModel.ChrModelID);
|
||||||
if (model != null)
|
if (model != null)
|
||||||
{
|
{
|
||||||
_chrModelsByRaceAndGender[Tuple.Create((byte)raceModel.ChrRacesID, (byte)model.Sex)] = model;
|
_chrModelsByRaceAndGender[Tuple.Create((byte)raceModel.ChrRacesID, (byte)model.Sex)] = model;
|
||||||
@@ -220,7 +222,7 @@ namespace Game.DataStorage
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (ChrSpecializationRecord chrSpec in CliDB.ChrSpecializationStorage.Values)
|
foreach (ChrSpecializationRecord chrSpec in ChrSpecializationStorage.Values)
|
||||||
{
|
{
|
||||||
//ASSERT(chrSpec.ClassID < MAX_CLASSES);
|
//ASSERT(chrSpec.ClassID < MAX_CLASSES);
|
||||||
//ASSERT(chrSpec.OrderIndex < MAX_SPECIALIZATIONS);
|
//ASSERT(chrSpec.OrderIndex < MAX_SPECIALIZATIONS);
|
||||||
@@ -237,39 +239,39 @@ namespace Game.DataStorage
|
|||||||
_chrSpecializationsByIndex[storageIndex][chrSpec.OrderIndex] = chrSpec;
|
_chrSpecializationsByIndex[storageIndex][chrSpec.OrderIndex] = chrSpec;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (ContentTuningXExpectedRecord contentTuningXExpectedStat in CliDB.ContentTuningXExpectedStorage.Values)
|
foreach (ContentTuningXExpectedRecord contentTuningXExpectedStat in ContentTuningXExpectedStorage.Values)
|
||||||
{
|
{
|
||||||
ExpectedStatModRecord expectedStatMod = CliDB.ExpectedStatModStorage.LookupByKey(contentTuningXExpectedStat.ExpectedStatModID);
|
ExpectedStatModRecord expectedStatMod = ExpectedStatModStorage.LookupByKey(contentTuningXExpectedStat.ExpectedStatModID);
|
||||||
if (expectedStatMod != null)
|
if (expectedStatMod != null)
|
||||||
_expectedStatModsByContentTuning.Add(contentTuningXExpectedStat.ContentTuningID, expectedStatMod);
|
_expectedStatModsByContentTuning.Add(contentTuningXExpectedStat.ContentTuningID, expectedStatMod);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (CurvePointRecord curvePoint in CliDB.CurvePointStorage.Values)
|
foreach (CurvePointRecord curvePoint in CurvePointStorage.Values)
|
||||||
{
|
{
|
||||||
if (CliDB.CurveStorage.ContainsKey(curvePoint.CurveID))
|
if (CurveStorage.ContainsKey(curvePoint.CurveID))
|
||||||
_curvePoints.Add(curvePoint.CurveID, curvePoint);
|
_curvePoints.Add(curvePoint.CurveID, curvePoint);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var key in _curvePoints.Keys.ToList())
|
foreach (var key in _curvePoints.Keys.ToList())
|
||||||
_curvePoints[key] = _curvePoints[key].OrderBy(point => point.OrderIndex).ToList();
|
_curvePoints[key] = _curvePoints[key].OrderBy(point => point.OrderIndex).ToList();
|
||||||
|
|
||||||
foreach (EmotesTextSoundRecord emoteTextSound in CliDB.EmotesTextSoundStorage.Values)
|
foreach (EmotesTextSoundRecord emoteTextSound in EmotesTextSoundStorage.Values)
|
||||||
_emoteTextSounds[Tuple.Create(emoteTextSound.EmotesTextId, emoteTextSound.RaceId, emoteTextSound.SexId, emoteTextSound.ClassId)] = emoteTextSound;
|
_emoteTextSounds[Tuple.Create(emoteTextSound.EmotesTextId, emoteTextSound.RaceId, emoteTextSound.SexId, emoteTextSound.ClassId)] = emoteTextSound;
|
||||||
|
|
||||||
foreach (ExpectedStatRecord expectedStat in CliDB.ExpectedStatStorage.Values)
|
foreach (ExpectedStatRecord expectedStat in ExpectedStatStorage.Values)
|
||||||
_expectedStatsByLevel[Tuple.Create(expectedStat.Lvl, expectedStat.ExpansionID)] = expectedStat;
|
_expectedStatsByLevel[Tuple.Create(expectedStat.Lvl, expectedStat.ExpansionID)] = expectedStat;
|
||||||
|
|
||||||
foreach (FactionRecord faction in CliDB.FactionStorage.Values)
|
foreach (FactionRecord faction in FactionStorage.Values)
|
||||||
if (faction.ParentFactionID != 0)
|
if (faction.ParentFactionID != 0)
|
||||||
_factionTeams.Add(faction.ParentFactionID, faction.Id);
|
_factionTeams.Add(faction.ParentFactionID, faction.Id);
|
||||||
|
|
||||||
foreach (FriendshipRepReactionRecord friendshipRepReaction in CliDB.FriendshipRepReactionStorage.Values)
|
foreach (FriendshipRepReactionRecord friendshipRepReaction in FriendshipRepReactionStorage.Values)
|
||||||
_friendshipRepReactions.Add(friendshipRepReaction.FriendshipRepID, friendshipRepReaction);
|
_friendshipRepReactions.Add(friendshipRepReaction.FriendshipRepID, friendshipRepReaction);
|
||||||
|
|
||||||
foreach (var key in _friendshipRepReactions.Keys)
|
foreach (var key in _friendshipRepReactions.Keys)
|
||||||
_friendshipRepReactions[key].Sort(new FriendshipRepReactionRecordComparer());
|
_friendshipRepReactions[key].Sort(new FriendshipRepReactionRecordComparer());
|
||||||
|
|
||||||
foreach (GameObjectDisplayInfoRecord gameObjectDisplayInfo in CliDB.GameObjectDisplayInfoStorage.Values)
|
foreach (GameObjectDisplayInfoRecord gameObjectDisplayInfo in GameObjectDisplayInfoStorage.Values)
|
||||||
{
|
{
|
||||||
if (gameObjectDisplayInfo.GeoBoxMax.X < gameObjectDisplayInfo.GeoBoxMin.X)
|
if (gameObjectDisplayInfo.GeoBoxMax.X < gameObjectDisplayInfo.GeoBoxMin.X)
|
||||||
Extensions.Swap(ref gameObjectDisplayInfo.GeoBox[3], ref gameObjectDisplayInfo.GeoBox[0]);
|
Extensions.Swap(ref gameObjectDisplayInfo.GeoBox[3], ref gameObjectDisplayInfo.GeoBox[0]);
|
||||||
@@ -279,65 +281,65 @@ namespace Game.DataStorage
|
|||||||
Extensions.Swap(ref gameObjectDisplayInfo.GeoBox[5], ref gameObjectDisplayInfo.GeoBox[2]);
|
Extensions.Swap(ref gameObjectDisplayInfo.GeoBox[5], ref gameObjectDisplayInfo.GeoBox[2]);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (HeirloomRecord heirloom in CliDB.HeirloomStorage.Values)
|
foreach (HeirloomRecord heirloom in HeirloomStorage.Values)
|
||||||
_heirlooms[heirloom.ItemID] = heirloom;
|
_heirlooms[heirloom.ItemID] = heirloom;
|
||||||
|
|
||||||
foreach (GlyphBindableSpellRecord glyphBindableSpell in CliDB.GlyphBindableSpellStorage.Values)
|
foreach (GlyphBindableSpellRecord glyphBindableSpell in GlyphBindableSpellStorage.Values)
|
||||||
_glyphBindableSpells.Add(glyphBindableSpell.GlyphPropertiesID, (uint)glyphBindableSpell.SpellID);
|
_glyphBindableSpells.Add(glyphBindableSpell.GlyphPropertiesID, (uint)glyphBindableSpell.SpellID);
|
||||||
|
|
||||||
foreach (GlyphRequiredSpecRecord glyphRequiredSpec in CliDB.GlyphRequiredSpecStorage.Values)
|
foreach (GlyphRequiredSpecRecord glyphRequiredSpec in GlyphRequiredSpecStorage.Values)
|
||||||
_glyphRequiredSpecs.Add(glyphRequiredSpec.GlyphPropertiesID, glyphRequiredSpec.ChrSpecializationID);
|
_glyphRequiredSpecs.Add(glyphRequiredSpec.GlyphPropertiesID, glyphRequiredSpec.ChrSpecializationID);
|
||||||
|
|
||||||
foreach (var bonus in CliDB.ItemBonusStorage.Values)
|
foreach (var bonus in ItemBonusStorage.Values)
|
||||||
_itemBonusLists.Add(bonus.ParentItemBonusListID, bonus);
|
_itemBonusLists.Add(bonus.ParentItemBonusListID, bonus);
|
||||||
|
|
||||||
foreach (ItemBonusListLevelDeltaRecord itemBonusListLevelDelta in CliDB.ItemBonusListLevelDeltaStorage.Values)
|
foreach (ItemBonusListLevelDeltaRecord itemBonusListLevelDelta in ItemBonusListLevelDeltaStorage.Values)
|
||||||
_itemLevelDeltaToBonusListContainer[itemBonusListLevelDelta.ItemLevelDelta] = itemBonusListLevelDelta.Id;
|
_itemLevelDeltaToBonusListContainer[itemBonusListLevelDelta.ItemLevelDelta] = itemBonusListLevelDelta.Id;
|
||||||
|
|
||||||
foreach (var bonusTreeNode in CliDB.ItemBonusTreeNodeStorage.Values)
|
foreach (var bonusTreeNode in ItemBonusTreeNodeStorage.Values)
|
||||||
_itemBonusTrees.Add(bonusTreeNode.ParentItemBonusTreeID, bonusTreeNode);
|
_itemBonusTrees.Add(bonusTreeNode.ParentItemBonusTreeID, bonusTreeNode);
|
||||||
|
|
||||||
foreach (ItemChildEquipmentRecord itemChildEquipment in CliDB.ItemChildEquipmentStorage.Values)
|
foreach (ItemChildEquipmentRecord itemChildEquipment in ItemChildEquipmentStorage.Values)
|
||||||
{
|
{
|
||||||
//ASSERT(_itemChildEquipment.find(itemChildEquipment.ParentItemID) == _itemChildEquipment.end(), "Item must have max 1 child item.");
|
//ASSERT(_itemChildEquipment.find(itemChildEquipment.ParentItemID) == _itemChildEquipment.end(), "Item must have max 1 child item.");
|
||||||
_itemChildEquipment[itemChildEquipment.ParentItemID] = itemChildEquipment;
|
_itemChildEquipment[itemChildEquipment.ParentItemID] = itemChildEquipment;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (ItemClassRecord itemClass in CliDB.ItemClassStorage.Values)
|
foreach (ItemClassRecord itemClass in ItemClassStorage.Values)
|
||||||
{
|
{
|
||||||
//ASSERT(itemClass.ClassID < _itemClassByOldEnum.size());
|
//ASSERT(itemClass.ClassID < _itemClassByOldEnum.size());
|
||||||
//ASSERT(!_itemClassByOldEnum[itemClass.ClassID]);
|
//ASSERT(!_itemClassByOldEnum[itemClass.ClassID]);
|
||||||
_itemClassByOldEnum[itemClass.ClassID] = itemClass;
|
_itemClassByOldEnum[itemClass.ClassID] = itemClass;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (ItemCurrencyCostRecord itemCurrencyCost in CliDB.ItemCurrencyCostStorage.Values)
|
foreach (ItemCurrencyCostRecord itemCurrencyCost in ItemCurrencyCostStorage.Values)
|
||||||
_itemsWithCurrencyCost.Add(itemCurrencyCost.ItemID);
|
_itemsWithCurrencyCost.Add(itemCurrencyCost.ItemID);
|
||||||
|
|
||||||
foreach (ItemLimitCategoryConditionRecord condition in CliDB.ItemLimitCategoryConditionStorage.Values)
|
foreach (ItemLimitCategoryConditionRecord condition in ItemLimitCategoryConditionStorage.Values)
|
||||||
_itemCategoryConditions.Add(condition.ParentItemLimitCategoryID, condition);
|
_itemCategoryConditions.Add(condition.ParentItemLimitCategoryID, condition);
|
||||||
|
|
||||||
foreach (ItemLevelSelectorQualityRecord itemLevelSelectorQuality in CliDB.ItemLevelSelectorQualityStorage.Values)
|
foreach (ItemLevelSelectorQualityRecord itemLevelSelectorQuality in ItemLevelSelectorQualityStorage.Values)
|
||||||
_itemLevelQualitySelectorQualities.Add(itemLevelSelectorQuality.ParentILSQualitySetID, itemLevelSelectorQuality);
|
_itemLevelQualitySelectorQualities.Add(itemLevelSelectorQuality.ParentILSQualitySetID, itemLevelSelectorQuality);
|
||||||
|
|
||||||
foreach (var appearanceMod in CliDB.ItemModifiedAppearanceStorage.Values)
|
foreach (var appearanceMod in ItemModifiedAppearanceStorage.Values)
|
||||||
{
|
{
|
||||||
//ASSERT(appearanceMod.ItemID <= 0xFFFFFF);
|
//ASSERT(appearanceMod.ItemID <= 0xFFFFFF);
|
||||||
_itemModifiedAppearancesByItem[(uint)((int)appearanceMod.ItemID | (appearanceMod.ItemAppearanceModifierID << 24))] = appearanceMod;
|
_itemModifiedAppearancesByItem[(uint)((int)appearanceMod.ItemID | (appearanceMod.ItemAppearanceModifierID << 24))] = appearanceMod;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (ItemSetSpellRecord itemSetSpell in CliDB.ItemSetSpellStorage.Values)
|
foreach (ItemSetSpellRecord itemSetSpell in ItemSetSpellStorage.Values)
|
||||||
_itemSetSpells.Add(itemSetSpell.ItemSetID, itemSetSpell);
|
_itemSetSpells.Add(itemSetSpell.ItemSetID, itemSetSpell);
|
||||||
|
|
||||||
foreach (var itemSpecOverride in CliDB.ItemSpecOverrideStorage.Values)
|
foreach (var itemSpecOverride in ItemSpecOverrideStorage.Values)
|
||||||
_itemSpecOverrides.Add(itemSpecOverride.ItemID, itemSpecOverride);
|
_itemSpecOverrides.Add(itemSpecOverride.ItemID, itemSpecOverride);
|
||||||
|
|
||||||
foreach (var itemBonusTreeAssignment in CliDB.ItemXBonusTreeStorage.Values)
|
foreach (var itemBonusTreeAssignment in ItemXBonusTreeStorage.Values)
|
||||||
_itemToBonusTree.Add(itemBonusTreeAssignment.ItemID, itemBonusTreeAssignment.ItemBonusTreeID);
|
_itemToBonusTree.Add(itemBonusTreeAssignment.ItemID, itemBonusTreeAssignment.ItemBonusTreeID);
|
||||||
|
|
||||||
foreach (var pair in _azeriteEmpoweredItems)
|
foreach (var pair in _azeriteEmpoweredItems)
|
||||||
LoadAzeriteEmpoweredItemUnlockMappings(azeriteUnlockMappings, pair.Key);
|
LoadAzeriteEmpoweredItemUnlockMappings(azeriteUnlockMappings, pair.Key);
|
||||||
|
|
||||||
foreach (MapDifficultyRecord entry in CliDB.MapDifficultyStorage.Values)
|
foreach (MapDifficultyRecord entry in MapDifficultyStorage.Values)
|
||||||
{
|
{
|
||||||
if (!_mapDifficulties.ContainsKey(entry.MapID))
|
if (!_mapDifficulties.ContainsKey(entry.MapID))
|
||||||
_mapDifficulties[entry.MapID] = new Dictionary<uint, MapDifficultyRecord>();
|
_mapDifficulties[entry.MapID] = new Dictionary<uint, MapDifficultyRecord>();
|
||||||
@@ -347,31 +349,31 @@ namespace Game.DataStorage
|
|||||||
_mapDifficulties[0][0] = _mapDifficulties[1][0]; // map 0 is missing from MapDifficulty.dbc so we cheat a bit
|
_mapDifficulties[0][0] = _mapDifficulties[1][0]; // map 0 is missing from MapDifficulty.dbc so we cheat a bit
|
||||||
|
|
||||||
List<MapDifficultyXConditionRecord> mapDifficultyConditions = new();
|
List<MapDifficultyXConditionRecord> mapDifficultyConditions = new();
|
||||||
foreach (var mapDifficultyCondition in CliDB.MapDifficultyXConditionStorage.Values)
|
foreach (var mapDifficultyCondition in MapDifficultyXConditionStorage.Values)
|
||||||
mapDifficultyConditions.Add(mapDifficultyCondition);
|
mapDifficultyConditions.Add(mapDifficultyCondition);
|
||||||
|
|
||||||
mapDifficultyConditions = mapDifficultyConditions.OrderBy(p => p.OrderIndex).ToList();
|
mapDifficultyConditions = mapDifficultyConditions.OrderBy(p => p.OrderIndex).ToList();
|
||||||
|
|
||||||
foreach (var mapDifficultyCondition in mapDifficultyConditions)
|
foreach (var mapDifficultyCondition in mapDifficultyConditions)
|
||||||
{
|
{
|
||||||
PlayerConditionRecord playerCondition = CliDB.PlayerConditionStorage.LookupByKey(mapDifficultyCondition.PlayerConditionID);
|
PlayerConditionRecord playerCondition = PlayerConditionStorage.LookupByKey(mapDifficultyCondition.PlayerConditionID);
|
||||||
if (playerCondition != null)
|
if (playerCondition != null)
|
||||||
_mapDifficultyConditions.Add(mapDifficultyCondition.MapDifficultyID, Tuple.Create(mapDifficultyCondition.Id, playerCondition));
|
_mapDifficultyConditions.Add(mapDifficultyCondition.MapDifficultyID, Tuple.Create(mapDifficultyCondition.Id, playerCondition));
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var mount in CliDB.MountStorage.Values)
|
foreach (var mount in MountStorage.Values)
|
||||||
_mountsBySpellId[mount.SourceSpellID] = mount;
|
_mountsBySpellId[mount.SourceSpellID] = mount;
|
||||||
|
|
||||||
foreach (MountTypeXCapabilityRecord mountTypeCapability in CliDB.MountTypeXCapabilityStorage.Values)
|
foreach (MountTypeXCapabilityRecord mountTypeCapability in MountTypeXCapabilityStorage.Values)
|
||||||
_mountCapabilitiesByType.Add(mountTypeCapability.MountTypeID, mountTypeCapability);
|
_mountCapabilitiesByType.Add(mountTypeCapability.MountTypeID, mountTypeCapability);
|
||||||
|
|
||||||
foreach (var key in _mountCapabilitiesByType.Keys)
|
foreach (var key in _mountCapabilitiesByType.Keys)
|
||||||
_mountCapabilitiesByType[key].Sort(new MountTypeXCapabilityRecordComparer());
|
_mountCapabilitiesByType[key].Sort(new MountTypeXCapabilityRecordComparer());
|
||||||
|
|
||||||
foreach (MountXDisplayRecord mountDisplay in CliDB.MountXDisplayStorage.Values)
|
foreach (MountXDisplayRecord mountDisplay in MountXDisplayStorage.Values)
|
||||||
_mountDisplays.Add(mountDisplay.MountID, mountDisplay);
|
_mountDisplays.Add(mountDisplay.MountID, mountDisplay);
|
||||||
|
|
||||||
foreach (var entry in CliDB.NameGenStorage.Values)
|
foreach (var entry in NameGenStorage.Values)
|
||||||
{
|
{
|
||||||
if (!_nameGenData.ContainsKey(entry.RaceID))
|
if (!_nameGenData.ContainsKey(entry.RaceID))
|
||||||
{
|
{
|
||||||
@@ -383,7 +385,7 @@ namespace Game.DataStorage
|
|||||||
_nameGenData[entry.RaceID][entry.Sex].Add(entry);
|
_nameGenData[entry.RaceID][entry.Sex].Add(entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var namesProfanity in CliDB.NamesProfanityStorage.Values)
|
foreach (var namesProfanity in NamesProfanityStorage.Values)
|
||||||
{
|
{
|
||||||
Cypher.Assert(namesProfanity.Language < (int)Locale.Total || namesProfanity.Language == -1);
|
Cypher.Assert(namesProfanity.Language < (int)Locale.Total || namesProfanity.Language == -1);
|
||||||
if (namesProfanity.Language != -1)
|
if (namesProfanity.Language != -1)
|
||||||
@@ -398,10 +400,10 @@ namespace Game.DataStorage
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var namesReserved in CliDB.NamesReservedStorage.Values)
|
foreach (var namesReserved in NamesReservedStorage.Values)
|
||||||
_nameValidators[(int)Locale.Total].Add(namesReserved.Name);
|
_nameValidators[(int)Locale.Total].Add(namesReserved.Name);
|
||||||
|
|
||||||
foreach (var namesReserved in CliDB.NamesReservedLocaleStorage.Values)
|
foreach (var namesReserved in NamesReservedLocaleStorage.Values)
|
||||||
{
|
{
|
||||||
Cypher.Assert(!Convert.ToBoolean(namesReserved.LocaleMask & ~((1 << (int)Locale.Total) - 1)));
|
Cypher.Assert(!Convert.ToBoolean(namesReserved.LocaleMask & ~((1 << (int)Locale.Total) - 1)));
|
||||||
for (int i = 0; i < (int)Locale.Total; ++i)
|
for (int i = 0; i < (int)Locale.Total; ++i)
|
||||||
@@ -414,28 +416,28 @@ namespace Game.DataStorage
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (ParagonReputationRecord paragonReputation in CliDB.ParagonReputationStorage.Values)
|
foreach (ParagonReputationRecord paragonReputation in ParagonReputationStorage.Values)
|
||||||
if (CliDB.FactionStorage.HasRecord(paragonReputation.FactionID))
|
if (FactionStorage.HasRecord(paragonReputation.FactionID))
|
||||||
_paragonReputations[paragonReputation.FactionID] = paragonReputation;
|
_paragonReputations[paragonReputation.FactionID] = paragonReputation;
|
||||||
|
|
||||||
foreach (var group in CliDB.PhaseXPhaseGroupStorage.Values)
|
foreach (var group in PhaseXPhaseGroupStorage.Values)
|
||||||
{
|
{
|
||||||
PhaseRecord phase = CliDB.PhaseStorage.LookupByKey(group.PhaseId);
|
PhaseRecord phase = PhaseStorage.LookupByKey(group.PhaseId);
|
||||||
if (phase != null)
|
if (phase != null)
|
||||||
_phasesByGroup.Add(group.PhaseGroupID, phase.Id);
|
_phasesByGroup.Add(group.PhaseGroupID, phase.Id);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (PowerTypeRecord powerType in CliDB.PowerTypeStorage.Values)
|
foreach (PowerTypeRecord powerType in PowerTypeStorage.Values)
|
||||||
{
|
{
|
||||||
Cypher.Assert(powerType.PowerTypeEnum < PowerType.Max);
|
Cypher.Assert(powerType.PowerTypeEnum < PowerType.Max);
|
||||||
|
|
||||||
_powerTypes[powerType.PowerTypeEnum] = powerType;
|
_powerTypes[powerType.PowerTypeEnum] = powerType;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (PvpItemRecord pvpItem in CliDB.PvpItemStorage.Values)
|
foreach (PvpItemRecord pvpItem in PvpItemStorage.Values)
|
||||||
_pvpItemBonus[pvpItem.ItemID] = pvpItem.ItemLevelDelta;
|
_pvpItemBonus[pvpItem.ItemID] = pvpItem.ItemLevelDelta;
|
||||||
|
|
||||||
foreach (PvpTalentSlotUnlockRecord talentUnlock in CliDB.PvpTalentSlotUnlockStorage.Values)
|
foreach (PvpTalentSlotUnlockRecord talentUnlock in PvpTalentSlotUnlockStorage.Values)
|
||||||
{
|
{
|
||||||
Cypher.Assert(talentUnlock.Slot < (1 << PlayerConst.MaxPvpTalentSlots));
|
Cypher.Assert(talentUnlock.Slot < (1 << PlayerConst.MaxPvpTalentSlots));
|
||||||
for (byte i = 0; i < PlayerConst.MaxPvpTalentSlots; ++i)
|
for (byte i = 0; i < PlayerConst.MaxPvpTalentSlots; ++i)
|
||||||
@@ -448,10 +450,10 @@ namespace Game.DataStorage
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (QuestLineXQuestRecord questLineQuest in CliDB.QuestLineXQuestStorage.Values)
|
foreach (QuestLineXQuestRecord questLineQuest in QuestLineXQuestStorage.Values)
|
||||||
_questsByQuestLine.Add(questLineQuest.QuestLineID, questLineQuest);
|
_questsByQuestLine.Add(questLineQuest.QuestLineID, questLineQuest);
|
||||||
|
|
||||||
foreach (QuestPackageItemRecord questPackageItem in CliDB.QuestPackageItemStorage.Values)
|
foreach (QuestPackageItemRecord questPackageItem in QuestPackageItemStorage.Values)
|
||||||
{
|
{
|
||||||
if (!_questPackages.ContainsKey(questPackageItem.PackageID))
|
if (!_questPackages.ContainsKey(questPackageItem.PackageID))
|
||||||
_questPackages[questPackageItem.PackageID] = Tuple.Create(new List<QuestPackageItemRecord>(), new List<QuestPackageItemRecord>());
|
_questPackages[questPackageItem.PackageID] = Tuple.Create(new List<QuestPackageItemRecord>(), new List<QuestPackageItemRecord>());
|
||||||
@@ -462,37 +464,37 @@ namespace Game.DataStorage
|
|||||||
_questPackages[questPackageItem.PackageID].Item2.Add(questPackageItem);
|
_questPackages[questPackageItem.PackageID].Item2.Add(questPackageItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (RewardPackXCurrencyTypeRecord rewardPackXCurrencyType in CliDB.RewardPackXCurrencyTypeStorage.Values)
|
foreach (RewardPackXCurrencyTypeRecord rewardPackXCurrencyType in RewardPackXCurrencyTypeStorage.Values)
|
||||||
_rewardPackCurrencyTypes.Add(rewardPackXCurrencyType.RewardPackID, rewardPackXCurrencyType);
|
_rewardPackCurrencyTypes.Add(rewardPackXCurrencyType.RewardPackID, rewardPackXCurrencyType);
|
||||||
|
|
||||||
foreach (RewardPackXItemRecord rewardPackXItem in CliDB.RewardPackXItemStorage.Values)
|
foreach (RewardPackXItemRecord rewardPackXItem in RewardPackXItemStorage.Values)
|
||||||
_rewardPackItems.Add(rewardPackXItem.RewardPackID, rewardPackXItem);
|
_rewardPackItems.Add(rewardPackXItem.RewardPackID, rewardPackXItem);
|
||||||
|
|
||||||
foreach (SkillLineRecord skill in CliDB.SkillLineStorage.Values)
|
foreach (SkillLineRecord skill in SkillLineStorage.Values)
|
||||||
{
|
{
|
||||||
if (skill.ParentSkillLineID != 0)
|
if (skill.ParentSkillLineID != 0)
|
||||||
_skillLinesByParentSkillLine.Add(skill.ParentSkillLineID, skill);
|
_skillLinesByParentSkillLine.Add(skill.ParentSkillLineID, skill);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (SkillLineAbilityRecord skillLineAbility in CliDB.SkillLineAbilityStorage.Values)
|
foreach (SkillLineAbilityRecord skillLineAbility in SkillLineAbilityStorage.Values)
|
||||||
_skillLineAbilitiesBySkillupSkill.Add(skillLineAbility.SkillupSkillLineID != 0 ? skillLineAbility.SkillupSkillLineID : skillLineAbility.SkillLine, skillLineAbility);
|
_skillLineAbilitiesBySkillupSkill.Add(skillLineAbility.SkillupSkillLineID != 0 ? skillLineAbility.SkillupSkillLineID : skillLineAbility.SkillLine, skillLineAbility);
|
||||||
|
|
||||||
foreach (SkillRaceClassInfoRecord entry in CliDB.SkillRaceClassInfoStorage.Values)
|
foreach (SkillRaceClassInfoRecord entry in SkillRaceClassInfoStorage.Values)
|
||||||
{
|
{
|
||||||
if (CliDB.SkillLineStorage.ContainsKey(entry.SkillID))
|
if (SkillLineStorage.ContainsKey(entry.SkillID))
|
||||||
_skillRaceClassInfoBySkill.Add((uint)entry.SkillID, entry);
|
_skillRaceClassInfoBySkill.Add((uint)entry.SkillID, entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var specSpells in CliDB.SpecializationSpellsStorage.Values)
|
foreach (var specSpells in SpecializationSpellsStorage.Values)
|
||||||
_specializationSpellsBySpec.Add(specSpells.SpecID, specSpells);
|
_specializationSpellsBySpec.Add(specSpells.SpecID, specSpells);
|
||||||
|
|
||||||
foreach (SpecSetMemberRecord specSetMember in CliDB.SpecSetMemberStorage.Values)
|
foreach (SpecSetMemberRecord specSetMember in SpecSetMemberStorage.Values)
|
||||||
_specsBySpecSet.Add(Tuple.Create((int)specSetMember.SpecSetID, (uint)specSetMember.ChrSpecializationID));
|
_specsBySpecSet.Add(Tuple.Create((int)specSetMember.SpecSetID, (uint)specSetMember.ChrSpecializationID));
|
||||||
|
|
||||||
foreach (SpellClassOptionsRecord classOption in CliDB.SpellClassOptionsStorage.Values)
|
foreach (SpellClassOptionsRecord classOption in SpellClassOptionsStorage.Values)
|
||||||
_spellFamilyNames.Add(classOption.SpellClassSet);
|
_spellFamilyNames.Add(classOption.SpellClassSet);
|
||||||
|
|
||||||
foreach (SpellProcsPerMinuteModRecord ppmMod in CliDB.SpellProcsPerMinuteModStorage.Values)
|
foreach (SpellProcsPerMinuteModRecord ppmMod in SpellProcsPerMinuteModStorage.Values)
|
||||||
_spellProcsPerMinuteMods.Add(ppmMod.SpellProcsPerMinuteID, ppmMod);
|
_spellProcsPerMinuteMods.Add(ppmMod.SpellProcsPerMinuteID, ppmMod);
|
||||||
|
|
||||||
for (var i = 0; i < (int)Class.Max; ++i)
|
for (var i = 0; i < (int)Class.Max; ++i)
|
||||||
@@ -507,7 +509,7 @@ namespace Game.DataStorage
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (TalentRecord talentInfo in CliDB.TalentStorage.Values)
|
foreach (TalentRecord talentInfo in TalentStorage.Values)
|
||||||
{
|
{
|
||||||
//ASSERT(talentInfo.ClassID < MAX_CLASSES);
|
//ASSERT(talentInfo.ClassID < MAX_CLASSES);
|
||||||
//ASSERT(talentInfo.TierID < MAX_TALENT_TIERS, "MAX_TALENT_TIERS must be at least {0}", talentInfo.TierID);
|
//ASSERT(talentInfo.TierID < MAX_TALENT_TIERS, "MAX_TALENT_TIERS must be at least {0}", talentInfo.TierID);
|
||||||
@@ -515,12 +517,12 @@ namespace Game.DataStorage
|
|||||||
_talentsByPosition[talentInfo.ClassID][talentInfo.TierID][talentInfo.ColumnIndex].Add(talentInfo);
|
_talentsByPosition[talentInfo.ClassID][talentInfo.TierID][talentInfo.ColumnIndex].Add(talentInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (ToyRecord toy in CliDB.ToyStorage.Values)
|
foreach (ToyRecord toy in ToyStorage.Values)
|
||||||
_toys.Add(toy.ItemID);
|
_toys.Add(toy.ItemID);
|
||||||
|
|
||||||
foreach (TransmogSetItemRecord transmogSetItem in CliDB.TransmogSetItemStorage.Values)
|
foreach (TransmogSetItemRecord transmogSetItem in TransmogSetItemStorage.Values)
|
||||||
{
|
{
|
||||||
TransmogSetRecord set = CliDB.TransmogSetStorage.LookupByKey(transmogSetItem.TransmogSetID);
|
TransmogSetRecord set = TransmogSetStorage.LookupByKey(transmogSetItem.TransmogSetID);
|
||||||
if (set == null)
|
if (set == null)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -537,10 +539,10 @@ namespace Game.DataStorage
|
|||||||
}
|
}
|
||||||
|
|
||||||
MultiMap<int, UiMapAssignmentRecord> uiMapAssignmentByUiMap = new();
|
MultiMap<int, UiMapAssignmentRecord> uiMapAssignmentByUiMap = new();
|
||||||
foreach (UiMapAssignmentRecord uiMapAssignment in CliDB.UiMapAssignmentStorage.Values)
|
foreach (UiMapAssignmentRecord uiMapAssignment in UiMapAssignmentStorage.Values)
|
||||||
{
|
{
|
||||||
uiMapAssignmentByUiMap.Add(uiMapAssignment.UiMapID, uiMapAssignment);
|
uiMapAssignmentByUiMap.Add(uiMapAssignment.UiMapID, uiMapAssignment);
|
||||||
UiMapRecord uiMap = CliDB.UiMapStorage.LookupByKey(uiMapAssignment.UiMapID);
|
UiMapRecord uiMap = UiMapStorage.LookupByKey(uiMapAssignment.UiMapID);
|
||||||
if (uiMap != null)
|
if (uiMap != null)
|
||||||
{
|
{
|
||||||
//ASSERT(uiMap.System < MAX_UI_MAP_SYSTEM, $"MAX_TALENT_TIERS must be at least {uiMap.System + 1}");
|
//ASSERT(uiMap.System < MAX_UI_MAP_SYSTEM, $"MAX_TALENT_TIERS must be at least {uiMap.System + 1}");
|
||||||
@@ -556,13 +558,13 @@ namespace Game.DataStorage
|
|||||||
}
|
}
|
||||||
|
|
||||||
Dictionary<Tuple<int, uint>, UiMapLinkRecord> uiMapLinks = new();
|
Dictionary<Tuple<int, uint>, UiMapLinkRecord> uiMapLinks = new();
|
||||||
foreach (UiMapLinkRecord uiMapLink in CliDB.UiMapLinkStorage.Values)
|
foreach (UiMapLinkRecord uiMapLink in UiMapLinkStorage.Values)
|
||||||
uiMapLinks[Tuple.Create(uiMapLink.ParentUiMapID, (uint)uiMapLink.ChildUiMapID)] = uiMapLink;
|
uiMapLinks[Tuple.Create(uiMapLink.ParentUiMapID, (uint)uiMapLink.ChildUiMapID)] = uiMapLink;
|
||||||
|
|
||||||
foreach (UiMapRecord uiMap in CliDB.UiMapStorage.Values)
|
foreach (UiMapRecord uiMap in UiMapStorage.Values)
|
||||||
{
|
{
|
||||||
UiMapBounds bounds = new();
|
UiMapBounds bounds = new();
|
||||||
UiMapRecord parentUiMap = CliDB.UiMapStorage.LookupByKey(uiMap.ParentUiMapID);
|
UiMapRecord parentUiMap = UiMapStorage.LookupByKey(uiMap.ParentUiMapID);
|
||||||
if (parentUiMap != null)
|
if (parentUiMap != null)
|
||||||
{
|
{
|
||||||
if (parentUiMap.GetFlags().HasAnyFlag(UiMapFlag.NoWorldPositions))
|
if (parentUiMap.GetFlags().HasAnyFlag(UiMapFlag.NoWorldPositions))
|
||||||
@@ -629,11 +631,11 @@ namespace Game.DataStorage
|
|||||||
_uiMapBounds[(int)uiMap.Id] = bounds;
|
_uiMapBounds[(int)uiMap.Id] = bounds;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (UiMapXMapArtRecord uiMapArt in CliDB.UiMapXMapArtStorage.Values)
|
foreach (UiMapXMapArtRecord uiMapArt in UiMapXMapArtStorage.Values)
|
||||||
if (uiMapArt.PhaseID != 0)
|
if (uiMapArt.PhaseID != 0)
|
||||||
_uiMapPhases.Add(uiMapArt.PhaseID);
|
_uiMapPhases.Add(uiMapArt.PhaseID);
|
||||||
|
|
||||||
foreach (WMOAreaTableRecord entry in CliDB.WMOAreaTableStorage.Values)
|
foreach (WMOAreaTableRecord entry in WMOAreaTableStorage.Values)
|
||||||
_wmoAreaTableLookup[Tuple.Create((short)entry.WmoID, (sbyte)entry.NameSetID, entry.WmoGroupID)] = entry;
|
_wmoAreaTableLookup[Tuple.Create((short)entry.WmoID, (sbyte)entry.NameSetID, entry.WmoGroupID)] = entry;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -740,7 +742,7 @@ namespace Game.DataStorage
|
|||||||
public void LoadHotfixOptionalData(BitSet availableDb2Locales)
|
public void LoadHotfixOptionalData(BitSet availableDb2Locales)
|
||||||
{
|
{
|
||||||
// Register allowed optional data keys
|
// Register allowed optional data keys
|
||||||
_allowedHotfixOptionalData.Add(CliDB.BroadcastTextStorage.GetTableHash(), Tuple.Create(CliDB.TactKeyStorage.GetTableHash(), (AllowedHotfixOptionalData)ValidateBroadcastTextTactKeyOptionalData));
|
_allowedHotfixOptionalData.Add(BroadcastTextStorage.GetTableHash(), Tuple.Create(TactKeyStorage.GetTableHash(), (AllowedHotfixOptionalData)ValidateBroadcastTextTactKeyOptionalData));
|
||||||
|
|
||||||
uint oldMSTime = Time.GetMSTime();
|
uint oldMSTime = Time.GetMSTime();
|
||||||
|
|
||||||
@@ -833,7 +835,7 @@ namespace Game.DataStorage
|
|||||||
|
|
||||||
public uint GetEmptyAnimStateID()
|
public uint GetEmptyAnimStateID()
|
||||||
{
|
{
|
||||||
return (uint)CliDB.AnimationDataStorage.Count;
|
return (uint)AnimationDataStorage.Count;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<uint> GetAreasForGroup(uint areaGroupId)
|
public List<uint> GetAreasForGroup(uint areaGroupId)
|
||||||
@@ -848,7 +850,7 @@ namespace Game.DataStorage
|
|||||||
if (objectAreaId == areaId)
|
if (objectAreaId == areaId)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
AreaTableRecord objectArea = CliDB.AreaTableStorage.LookupByKey(objectAreaId);
|
AreaTableRecord objectArea = AreaTableStorage.LookupByKey(objectAreaId);
|
||||||
if (objectArea == null)
|
if (objectArea == null)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -880,7 +882,7 @@ namespace Game.DataStorage
|
|||||||
|
|
||||||
public bool IsAzeriteItem(uint itemId)
|
public bool IsAzeriteItem(uint itemId)
|
||||||
{
|
{
|
||||||
return CliDB.AzeriteItemStorage.Any(pair => pair.Value.ItemID == itemId);
|
return AzeriteItemStorage.Any(pair => pair.Value.ItemID == itemId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public AzeriteEssencePowerRecord GetAzeriteEssencePower(uint azeriteEssenceId, uint rank)
|
public AzeriteEssencePowerRecord GetAzeriteEssencePower(uint azeriteEssenceId, uint rank)
|
||||||
@@ -915,7 +917,7 @@ namespace Game.DataStorage
|
|||||||
if (levels != null)
|
if (levels != null)
|
||||||
return levels[tier];
|
return levels[tier];
|
||||||
|
|
||||||
AzeriteTierUnlockSetRecord azeriteTierUnlockSet = CliDB.AzeriteTierUnlockSetStorage.LookupByKey(azeriteUnlockSetId);
|
AzeriteTierUnlockSetRecord azeriteTierUnlockSet = AzeriteTierUnlockSetStorage.LookupByKey(azeriteUnlockSetId);
|
||||||
if (azeriteTierUnlockSet != null && azeriteTierUnlockSet.Flags.HasAnyFlag(AzeriteTierUnlockSetFlags.Default))
|
if (azeriteTierUnlockSet != null && azeriteTierUnlockSet.Flags.HasAnyFlag(AzeriteTierUnlockSetFlags.Default))
|
||||||
{
|
{
|
||||||
levels = _azeriteTierUnlockLevels.LookupByKey((azeriteUnlockSetId, ItemContext.None));
|
levels = _azeriteTierUnlockLevels.LookupByKey((azeriteUnlockSetId, ItemContext.None));
|
||||||
@@ -923,7 +925,7 @@ namespace Game.DataStorage
|
|||||||
return levels[tier];
|
return levels[tier];
|
||||||
}
|
}
|
||||||
|
|
||||||
return (uint)CliDB.AzeriteLevelInfoStorage.Count;
|
return (uint)AzeriteLevelInfoStorage.Count;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string GetBroadcastTextValue(BroadcastTextRecord broadcastText, Locale locale = Locale.enUS, Gender gender = Gender.Male, bool forceGender = false)
|
public string GetBroadcastTextValue(BroadcastTextRecord broadcastText, Locale locale = Locale.enUS, Gender gender = Gender.Male, bool forceGender = false)
|
||||||
@@ -950,7 +952,7 @@ namespace Game.DataStorage
|
|||||||
|
|
||||||
public string GetClassName(Class class_, Locale locale = Locale.enUS)
|
public string GetClassName(Class class_, Locale locale = Locale.enUS)
|
||||||
{
|
{
|
||||||
ChrClassesRecord classEntry = CliDB.ChrClassesStorage.LookupByKey(class_);
|
ChrClassesRecord classEntry = ChrClassesStorage.LookupByKey(class_);
|
||||||
if (classEntry == null)
|
if (classEntry == null)
|
||||||
return "";
|
return "";
|
||||||
|
|
||||||
@@ -987,7 +989,7 @@ namespace Game.DataStorage
|
|||||||
|
|
||||||
public string GetChrRaceName(Race race, Locale locale = Locale.enUS)
|
public string GetChrRaceName(Race race, Locale locale = Locale.enUS)
|
||||||
{
|
{
|
||||||
ChrRacesRecord raceEntry = CliDB.ChrRacesStorage.LookupByKey(race);
|
ChrRacesRecord raceEntry = ChrRacesStorage.LookupByKey(race);
|
||||||
if (raceEntry == null)
|
if (raceEntry == null)
|
||||||
return "";
|
return "";
|
||||||
|
|
||||||
@@ -1009,14 +1011,14 @@ namespace Game.DataStorage
|
|||||||
|
|
||||||
public ContentTuningLevels? GetContentTuningData(uint contentTuningId, uint replacementConditionMask, bool forItem = false)
|
public ContentTuningLevels? GetContentTuningData(uint contentTuningId, uint replacementConditionMask, bool forItem = false)
|
||||||
{
|
{
|
||||||
ContentTuningRecord contentTuning = CliDB.ContentTuningStorage.LookupByKey(contentTuningId);
|
ContentTuningRecord contentTuning = ContentTuningStorage.LookupByKey(contentTuningId);
|
||||||
if (contentTuning == null)
|
if (contentTuning == null)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
if (forItem && contentTuning.GetFlags().HasFlag(ContentTuningFlag.DisabledForItem))
|
if (forItem && contentTuning.GetFlags().HasFlag(ContentTuningFlag.DisabledForItem))
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
int getLevelAdjustment(ContentTuningCalcType type) => type switch
|
static int getLevelAdjustment(ContentTuningCalcType type) => type switch
|
||||||
{
|
{
|
||||||
ContentTuningCalcType.PlusOne => 1,
|
ContentTuningCalcType.PlusOne => 1,
|
||||||
ContentTuningCalcType.PlusMaxLevelForExpansion => (int)Global.ObjectMgr.GetMaxLevelForExpansion((Expansion)WorldConfig.GetUIntValue(WorldCfg.Expansion)),
|
ContentTuningCalcType.PlusMaxLevelForExpansion => (int)Global.ObjectMgr.GetMaxLevelForExpansion((Expansion)WorldConfig.GetUIntValue(WorldCfg.Expansion)),
|
||||||
@@ -1051,7 +1053,7 @@ namespace Game.DataStorage
|
|||||||
if (petfamily == CreatureFamily.None)
|
if (petfamily == CreatureFamily.None)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
CreatureFamilyRecord petFamily = CliDB.CreatureFamilyStorage.LookupByKey(petfamily);
|
CreatureFamilyRecord petFamily = CreatureFamilyStorage.LookupByKey(petfamily);
|
||||||
if (petFamily == null)
|
if (petFamily == null)
|
||||||
return "";
|
return "";
|
||||||
|
|
||||||
@@ -1096,7 +1098,7 @@ namespace Game.DataStorage
|
|||||||
if (points.Empty())
|
if (points.Empty())
|
||||||
return 0.0f;
|
return 0.0f;
|
||||||
|
|
||||||
CurveRecord curve = CliDB.CurveStorage.LookupByKey(curveId);
|
CurveRecord curve = CurveStorage.LookupByKey(curveId);
|
||||||
switch (DetermineCurveType(curve, points))
|
switch (DetermineCurveType(curve, points))
|
||||||
{
|
{
|
||||||
case CurveInterpolationMode.Linear:
|
case CurveInterpolationMode.Linear:
|
||||||
@@ -1135,7 +1137,7 @@ namespace Game.DataStorage
|
|||||||
if (pointIndex == 1)
|
if (pointIndex == 1)
|
||||||
return points[1].Pos.Y;
|
return points[1].Pos.Y;
|
||||||
if (pointIndex >= points.Count - 1)
|
if (pointIndex >= points.Count - 1)
|
||||||
return points[points.Count - 2].Pos.Y;
|
return points[^2].Pos.Y;
|
||||||
float xDiff = points[pointIndex].Pos.X - points[pointIndex - 1].Pos.X;
|
float xDiff = points[pointIndex].Pos.X - points[pointIndex - 1].Pos.X;
|
||||||
if (xDiff == 0.0)
|
if (xDiff == 0.0)
|
||||||
return points[pointIndex].Pos.Y;
|
return points[pointIndex].Pos.Y;
|
||||||
@@ -1224,16 +1226,16 @@ namespace Game.DataStorage
|
|||||||
switch (unitClass)
|
switch (unitClass)
|
||||||
{
|
{
|
||||||
case Class.Warrior:
|
case Class.Warrior:
|
||||||
classMod = CliDB.ExpectedStatModStorage.LookupByKey(4);
|
classMod = ExpectedStatModStorage.LookupByKey(4);
|
||||||
break;
|
break;
|
||||||
case Class.Paladin:
|
case Class.Paladin:
|
||||||
classMod = CliDB.ExpectedStatModStorage.LookupByKey(2);
|
classMod = ExpectedStatModStorage.LookupByKey(2);
|
||||||
break;
|
break;
|
||||||
case Class.Rogue:
|
case Class.Rogue:
|
||||||
classMod = CliDB.ExpectedStatModStorage.LookupByKey(3);
|
classMod = ExpectedStatModStorage.LookupByKey(3);
|
||||||
break;
|
break;
|
||||||
case Class.Mage:
|
case Class.Mage:
|
||||||
classMod = CliDB.ExpectedStatModStorage.LookupByKey(1);
|
classMod = ExpectedStatModStorage.LookupByKey(1);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@@ -1326,7 +1328,7 @@ namespace Game.DataStorage
|
|||||||
|
|
||||||
public uint GetGlobalCurveId(GlobalCurve globalCurveType)
|
public uint GetGlobalCurveId(GlobalCurve globalCurveType)
|
||||||
{
|
{
|
||||||
foreach (var globalCurveEntry in CliDB.GlobalCurveStorage.Values)
|
foreach (var globalCurveEntry in GlobalCurveStorage.Values)
|
||||||
if (globalCurveEntry.Type == globalCurveType)
|
if (globalCurveEntry.Type == globalCurveType)
|
||||||
return globalCurveEntry.CurveID;
|
return globalCurveEntry.CurveID;
|
||||||
|
|
||||||
@@ -1376,7 +1378,7 @@ namespace Game.DataStorage
|
|||||||
{
|
{
|
||||||
List<uint> bonusListIDs = new();
|
List<uint> bonusListIDs = new();
|
||||||
|
|
||||||
ItemSparseRecord proto = CliDB.ItemSparseStorage.LookupByKey(itemId);
|
ItemSparseRecord proto = ItemSparseStorage.LookupByKey(itemId);
|
||||||
if (proto == null)
|
if (proto == null)
|
||||||
return bonusListIDs;
|
return bonusListIDs;
|
||||||
|
|
||||||
@@ -1413,7 +1415,7 @@ namespace Game.DataStorage
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
ItemLevelSelectorRecord selector = CliDB.ItemLevelSelectorStorage.LookupByKey(itemLevelSelectorId);
|
ItemLevelSelectorRecord selector = ItemLevelSelectorStorage.LookupByKey(itemLevelSelectorId);
|
||||||
if (selector != null)
|
if (selector != null)
|
||||||
{
|
{
|
||||||
short delta = (short)(selector.MinItemLevel - proto.ItemLevel);
|
short delta = (short)(selector.MinItemLevel - proto.ItemLevel);
|
||||||
@@ -1422,7 +1424,7 @@ namespace Game.DataStorage
|
|||||||
if (bonus != 0)
|
if (bonus != 0)
|
||||||
bonusListIDs.Add(bonus);
|
bonusListIDs.Add(bonus);
|
||||||
|
|
||||||
ItemLevelSelectorQualitySetRecord selectorQualitySet = CliDB.ItemLevelSelectorQualitySetStorage.LookupByKey(selector.ItemLevelSelectorQualitySetID);
|
ItemLevelSelectorQualitySetRecord selectorQualitySet = ItemLevelSelectorQualitySetStorage.LookupByKey(selector.ItemLevelSelectorQualitySetID);
|
||||||
if (selectorQualitySet != null)
|
if (selectorQualitySet != null)
|
||||||
{
|
{
|
||||||
var itemSelectorQualities = _itemLevelQualitySelectorQualities.LookupByKey(selector.ItemLevelSelectorQualitySetID);
|
var itemSelectorQualities = _itemLevelQualitySelectorQualities.LookupByKey(selector.ItemLevelSelectorQualitySetID);
|
||||||
@@ -1465,7 +1467,7 @@ namespace Game.DataStorage
|
|||||||
|
|
||||||
public List<uint> GetAllItemBonusTreeBonuses(uint itemBonusTreeId)
|
public List<uint> GetAllItemBonusTreeBonuses(uint itemBonusTreeId)
|
||||||
{
|
{
|
||||||
List<uint> bonusListIDs = new List<uint>();
|
List<uint> bonusListIDs = new();
|
||||||
VisitItemBonusTree(itemBonusTreeId, true, bonusTreeNode =>
|
VisitItemBonusTree(itemBonusTreeId, true, bonusTreeNode =>
|
||||||
{
|
{
|
||||||
if (bonusTreeNode.ChildItemBonusListID != 0)
|
if (bonusTreeNode.ChildItemBonusListID != 0)
|
||||||
@@ -1486,7 +1488,7 @@ namespace Game.DataStorage
|
|||||||
{
|
{
|
||||||
if (bonusTreeNode.ChildItemBonusListID == 0 && bonusTreeNode.ChildItemLevelSelectorID != 0)
|
if (bonusTreeNode.ChildItemBonusListID == 0 && bonusTreeNode.ChildItemLevelSelectorID != 0)
|
||||||
{
|
{
|
||||||
ItemLevelSelectorRecord selector = CliDB.ItemLevelSelectorStorage.LookupByKey(bonusTreeNode.ChildItemLevelSelectorID);
|
ItemLevelSelectorRecord selector = ItemLevelSelectorStorage.LookupByKey(bonusTreeNode.ChildItemLevelSelectorID);
|
||||||
if (selector == null)
|
if (selector == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -1531,7 +1533,7 @@ namespace Game.DataStorage
|
|||||||
ItemModifiedAppearanceRecord modifiedAppearance = GetItemModifiedAppearance(itemId, appearanceModId);
|
ItemModifiedAppearanceRecord modifiedAppearance = GetItemModifiedAppearance(itemId, appearanceModId);
|
||||||
if (modifiedAppearance != null)
|
if (modifiedAppearance != null)
|
||||||
{
|
{
|
||||||
ItemAppearanceRecord itemAppearance = CliDB.ItemAppearanceStorage.LookupByKey(modifiedAppearance.ItemAppearanceID);
|
ItemAppearanceRecord itemAppearance = ItemAppearanceStorage.LookupByKey(modifiedAppearance.ItemAppearanceID);
|
||||||
if (itemAppearance != null)
|
if (itemAppearance != null)
|
||||||
return itemAppearance.ItemDisplayInfoID;
|
return itemAppearance.ItemDisplayInfoID;
|
||||||
}
|
}
|
||||||
@@ -1573,7 +1575,7 @@ namespace Game.DataStorage
|
|||||||
|
|
||||||
public LFGDungeonsRecord GetLfgDungeon(uint mapId, Difficulty difficulty)
|
public LFGDungeonsRecord GetLfgDungeon(uint mapId, Difficulty difficulty)
|
||||||
{
|
{
|
||||||
foreach (LFGDungeonsRecord dungeon in CliDB.LFGDungeonsStorage.Values)
|
foreach (LFGDungeonsRecord dungeon in LFGDungeonsStorage.Values)
|
||||||
if (dungeon.MapID == mapId && dungeon.DifficultyID == difficulty)
|
if (dungeon.MapID == mapId && dungeon.DifficultyID == difficulty)
|
||||||
return dungeon;
|
return dungeon;
|
||||||
|
|
||||||
@@ -1582,7 +1584,7 @@ namespace Game.DataStorage
|
|||||||
|
|
||||||
public uint GetDefaultMapLight(uint mapId)
|
public uint GetDefaultMapLight(uint mapId)
|
||||||
{
|
{
|
||||||
foreach (var light in CliDB.LightStorage.Values.Reverse())
|
foreach (var light in LightStorage.Values.Reverse())
|
||||||
{
|
{
|
||||||
if (light.ContinentID == mapId && light.GameCoords.X == 0.0f && light.GameCoords.Y == 0.0f && light.GameCoords.Z == 0.0f)
|
if (light.ContinentID == mapId && light.GameCoords.X == 0.0f && light.GameCoords.Y == 0.0f && light.GameCoords.Z == 0.0f)
|
||||||
return light.Id;
|
return light.Id;
|
||||||
@@ -1593,7 +1595,7 @@ namespace Game.DataStorage
|
|||||||
|
|
||||||
public uint GetLiquidFlags(uint liquidType)
|
public uint GetLiquidFlags(uint liquidType)
|
||||||
{
|
{
|
||||||
LiquidTypeRecord liq = CliDB.LiquidTypeStorage.LookupByKey(liquidType);
|
LiquidTypeRecord liq = LiquidTypeStorage.LookupByKey(liquidType);
|
||||||
if (liq != null)
|
if (liq != null)
|
||||||
return 1u << liq.SoundBank;
|
return 1u << liq.SoundBank;
|
||||||
|
|
||||||
@@ -1616,7 +1618,7 @@ namespace Game.DataStorage
|
|||||||
|
|
||||||
foreach (var pair in dicMapDiff)
|
foreach (var pair in dicMapDiff)
|
||||||
{
|
{
|
||||||
DifficultyRecord difficultyEntry = CliDB.DifficultyStorage.LookupByKey(pair.Key);
|
DifficultyRecord difficultyEntry = DifficultyStorage.LookupByKey(pair.Key);
|
||||||
if (difficultyEntry == null)
|
if (difficultyEntry == null)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -1647,7 +1649,7 @@ namespace Game.DataStorage
|
|||||||
|
|
||||||
public MapDifficultyRecord GetDownscaledMapDifficultyData(uint mapId, ref Difficulty difficulty)
|
public MapDifficultyRecord GetDownscaledMapDifficultyData(uint mapId, ref Difficulty difficulty)
|
||||||
{
|
{
|
||||||
DifficultyRecord diffEntry = CliDB.DifficultyStorage.LookupByKey(difficulty);
|
DifficultyRecord diffEntry = DifficultyStorage.LookupByKey(difficulty);
|
||||||
if (diffEntry == null)
|
if (diffEntry == null)
|
||||||
return GetDefaultMapDifficulty(mapId, ref difficulty);
|
return GetDefaultMapDifficulty(mapId, ref difficulty);
|
||||||
|
|
||||||
@@ -1656,7 +1658,7 @@ namespace Game.DataStorage
|
|||||||
while (mapDiff == null)
|
while (mapDiff == null)
|
||||||
{
|
{
|
||||||
tmpDiff = (Difficulty)diffEntry.FallbackDifficultyID;
|
tmpDiff = (Difficulty)diffEntry.FallbackDifficultyID;
|
||||||
diffEntry = CliDB.DifficultyStorage.LookupByKey(tmpDiff);
|
diffEntry = DifficultyStorage.LookupByKey(tmpDiff);
|
||||||
if (diffEntry == null)
|
if (diffEntry == null)
|
||||||
return GetDefaultMapDifficulty(mapId, ref difficulty);
|
return GetDefaultMapDifficulty(mapId, ref difficulty);
|
||||||
|
|
||||||
@@ -1680,7 +1682,7 @@ namespace Game.DataStorage
|
|||||||
|
|
||||||
public MountRecord GetMountById(uint id)
|
public MountRecord GetMountById(uint id)
|
||||||
{
|
{
|
||||||
return CliDB.MountStorage.LookupByKey(id);
|
return MountStorage.LookupByKey(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<MountTypeXCapabilityRecord> GetMountCapabilities(uint mountType)
|
public List<MountTypeXCapabilityRecord> GetMountCapabilities(uint mountType)
|
||||||
@@ -1722,20 +1724,17 @@ namespace Game.DataStorage
|
|||||||
|
|
||||||
public uint GetNumTalentsAtLevel(uint level, Class playerClass)
|
public uint GetNumTalentsAtLevel(uint level, Class playerClass)
|
||||||
{
|
{
|
||||||
NumTalentsAtLevelRecord numTalentsAtLevel = CliDB.NumTalentsAtLevelStorage.LookupByKey(level);
|
NumTalentsAtLevelRecord numTalentsAtLevel = NumTalentsAtLevelStorage.LookupByKey(level);
|
||||||
if (numTalentsAtLevel == null)
|
if (numTalentsAtLevel == null)
|
||||||
numTalentsAtLevel = CliDB.NumTalentsAtLevelStorage.LastOrDefault().Value;
|
numTalentsAtLevel = NumTalentsAtLevelStorage.LastOrDefault().Value;
|
||||||
if (numTalentsAtLevel != null)
|
if (numTalentsAtLevel != null)
|
||||||
{
|
{
|
||||||
switch (playerClass)
|
return playerClass switch
|
||||||
{
|
{
|
||||||
case Class.Deathknight:
|
Class.Deathknight => numTalentsAtLevel.NumTalentsDeathKnight,
|
||||||
return numTalentsAtLevel.NumTalentsDeathKnight;
|
Class.DemonHunter => numTalentsAtLevel.NumTalentsDemonHunter,
|
||||||
case Class.DemonHunter:
|
_ => numTalentsAtLevel.NumTalents,
|
||||||
return numTalentsAtLevel.NumTalentsDemonHunter;
|
};
|
||||||
default:
|
|
||||||
return numTalentsAtLevel.NumTalents;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -1748,7 +1747,7 @@ namespace Game.DataStorage
|
|||||||
public PvpDifficultyRecord GetBattlegroundBracketByLevel(uint mapid, uint level)
|
public PvpDifficultyRecord GetBattlegroundBracketByLevel(uint mapid, uint level)
|
||||||
{
|
{
|
||||||
PvpDifficultyRecord maxEntry = null; // used for level > max listed level case
|
PvpDifficultyRecord maxEntry = null; // used for level > max listed level case
|
||||||
foreach (var entry in CliDB.PvpDifficultyStorage.Values)
|
foreach (var entry in PvpDifficultyStorage.Values)
|
||||||
{
|
{
|
||||||
// skip unrelated and too-high brackets
|
// skip unrelated and too-high brackets
|
||||||
if (entry.MapID != mapid || entry.MinLevel > level)
|
if (entry.MapID != mapid || entry.MinLevel > level)
|
||||||
@@ -1768,7 +1767,7 @@ namespace Game.DataStorage
|
|||||||
|
|
||||||
public PvpDifficultyRecord GetBattlegroundBracketById(uint mapid, BattlegroundBracketId id)
|
public PvpDifficultyRecord GetBattlegroundBracketById(uint mapid, BattlegroundBracketId id)
|
||||||
{
|
{
|
||||||
foreach (var entry in CliDB.PvpDifficultyStorage.Values)
|
foreach (var entry in PvpDifficultyStorage.Values)
|
||||||
if (entry.MapID == mapid && entry.GetBracketId() == id)
|
if (entry.MapID == mapid && entry.GetBracketId() == id)
|
||||||
return entry;
|
return entry;
|
||||||
|
|
||||||
@@ -1824,7 +1823,7 @@ namespace Game.DataStorage
|
|||||||
|
|
||||||
public uint GetQuestUniqueBitFlag(uint questId)
|
public uint GetQuestUniqueBitFlag(uint questId)
|
||||||
{
|
{
|
||||||
QuestV2Record v2 = CliDB.QuestV2Storage.LookupByKey(questId);
|
QuestV2Record v2 = QuestV2Storage.LookupByKey(questId);
|
||||||
if (v2 == null)
|
if (v2 == null)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
@@ -1846,7 +1845,7 @@ namespace Game.DataStorage
|
|||||||
|
|
||||||
public PowerTypeRecord GetPowerTypeByName(string name)
|
public PowerTypeRecord GetPowerTypeByName(string name)
|
||||||
{
|
{
|
||||||
foreach (PowerTypeRecord powerType in CliDB.PowerTypeStorage.Values)
|
foreach (PowerTypeRecord powerType in PowerTypeStorage.Values)
|
||||||
{
|
{
|
||||||
string powerName = powerType.NameGlobalStringTag;
|
string powerName = powerType.NameGlobalStringTag;
|
||||||
if (powerName.ToLower() == name)
|
if (powerName.ToLower() == name)
|
||||||
@@ -1938,10 +1937,10 @@ namespace Game.DataStorage
|
|||||||
if (itemTotemCategoryId == 0)
|
if (itemTotemCategoryId == 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
TotemCategoryRecord itemEntry = CliDB.TotemCategoryStorage.LookupByKey(itemTotemCategoryId);
|
TotemCategoryRecord itemEntry = TotemCategoryStorage.LookupByKey(itemTotemCategoryId);
|
||||||
if (itemEntry == null)
|
if (itemEntry == null)
|
||||||
return false;
|
return false;
|
||||||
TotemCategoryRecord reqEntry = CliDB.TotemCategoryStorage.LookupByKey(requiredTotemCategoryId);
|
TotemCategoryRecord reqEntry = TotemCategoryStorage.LookupByKey(requiredTotemCategoryId);
|
||||||
if (reqEntry == null)
|
if (reqEntry == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@@ -2027,7 +2026,7 @@ namespace Game.DataStorage
|
|||||||
{
|
{
|
||||||
while (areaId != uiMapAssignment.AreaID)
|
while (areaId != uiMapAssignment.AreaID)
|
||||||
{
|
{
|
||||||
AreaTableRecord areaEntry = CliDB.AreaTableStorage.LookupByKey(areaId);
|
AreaTableRecord areaEntry = AreaTableStorage.LookupByKey(areaId);
|
||||||
if (areaEntry != null)
|
if (areaEntry != null)
|
||||||
{
|
{
|
||||||
areaId = areaEntry.ParentAreaID;
|
areaId = areaEntry.ParentAreaID;
|
||||||
@@ -2047,7 +2046,7 @@ namespace Game.DataStorage
|
|||||||
{
|
{
|
||||||
if (mapId != uiMapAssignment.MapID)
|
if (mapId != uiMapAssignment.MapID)
|
||||||
{
|
{
|
||||||
MapRecord mapEntry = CliDB.MapStorage.LookupByKey(mapId);
|
MapRecord mapEntry = MapStorage.LookupByKey(mapId);
|
||||||
if (mapEntry != null)
|
if (mapEntry != null)
|
||||||
{
|
{
|
||||||
if (mapEntry.ParentMapID == uiMapAssignment.MapID)
|
if (mapEntry.ParentMapID == uiMapAssignment.MapID)
|
||||||
@@ -2112,16 +2111,16 @@ namespace Game.DataStorage
|
|||||||
iterateUiMapAssignments(_uiMapAssignmentByWmoGroup[(int)system], wmoGroupId);
|
iterateUiMapAssignments(_uiMapAssignmentByWmoGroup[(int)system], wmoGroupId);
|
||||||
iterateUiMapAssignments(_uiMapAssignmentByWmoDoodadPlacement[(int)system], wmoDoodadPlacementId);
|
iterateUiMapAssignments(_uiMapAssignmentByWmoDoodadPlacement[(int)system], wmoDoodadPlacementId);
|
||||||
|
|
||||||
AreaTableRecord areaEntry = CliDB.AreaTableStorage.LookupByKey(areaId);
|
AreaTableRecord areaEntry = AreaTableStorage.LookupByKey(areaId);
|
||||||
while (areaEntry != null)
|
while (areaEntry != null)
|
||||||
{
|
{
|
||||||
iterateUiMapAssignments(_uiMapAssignmentByArea[(int)system], (int)areaEntry.Id);
|
iterateUiMapAssignments(_uiMapAssignmentByArea[(int)system], (int)areaEntry.Id);
|
||||||
areaEntry = CliDB.AreaTableStorage.LookupByKey(areaEntry.ParentAreaID);
|
areaEntry = AreaTableStorage.LookupByKey(areaEntry.ParentAreaID);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mapId > 0)
|
if (mapId > 0)
|
||||||
{
|
{
|
||||||
MapRecord mapEntry = CliDB.MapStorage.LookupByKey(mapId);
|
MapRecord mapEntry = MapStorage.LookupByKey(mapId);
|
||||||
if (mapEntry != null)
|
if (mapEntry != null)
|
||||||
{
|
{
|
||||||
iterateUiMapAssignments(_uiMapAssignmentByMap[(int)system], (int)mapEntry.Id);
|
iterateUiMapAssignments(_uiMapAssignmentByMap[(int)system], (int)mapEntry.Id);
|
||||||
@@ -2137,7 +2136,7 @@ namespace Game.DataStorage
|
|||||||
|
|
||||||
Vector2 CalculateGlobalUiMapPosition(int uiMapID, Vector2 uiPosition)
|
Vector2 CalculateGlobalUiMapPosition(int uiMapID, Vector2 uiPosition)
|
||||||
{
|
{
|
||||||
UiMapRecord uiMap = CliDB.UiMapStorage.LookupByKey(uiMapID);
|
UiMapRecord uiMap = UiMapStorage.LookupByKey(uiMapID);
|
||||||
while (uiMap != null)
|
while (uiMap != null)
|
||||||
{
|
{
|
||||||
if (uiMap.Type <= UiMapType.Continent)
|
if (uiMap.Type <= UiMapType.Continent)
|
||||||
@@ -2150,7 +2149,7 @@ namespace Game.DataStorage
|
|||||||
uiPosition.X = ((1.0f - uiPosition.X) * bounds.Bounds[1]) + (bounds.Bounds[3] * uiPosition.X);
|
uiPosition.X = ((1.0f - uiPosition.X) * bounds.Bounds[1]) + (bounds.Bounds[3] * uiPosition.X);
|
||||||
uiPosition.Y = ((1.0f - uiPosition.Y) * bounds.Bounds[0]) + (bounds.Bounds[2] * uiPosition.Y);
|
uiPosition.Y = ((1.0f - uiPosition.Y) * bounds.Bounds[0]) + (bounds.Bounds[2] * uiPosition.Y);
|
||||||
|
|
||||||
uiMap = CliDB.UiMapStorage.LookupByKey(uiMap.ParentUiMapID);
|
uiMap = UiMapStorage.LookupByKey(uiMap.ParentUiMapID);
|
||||||
}
|
}
|
||||||
|
|
||||||
return uiPosition;
|
return uiPosition;
|
||||||
@@ -2158,14 +2157,12 @@ namespace Game.DataStorage
|
|||||||
|
|
||||||
public bool GetUiMapPosition(float x, float y, float z, int mapId, int areaId, int wmoDoodadPlacementId, int wmoGroupId, UiMapSystem system, bool local, out Vector2 newPos)
|
public bool GetUiMapPosition(float x, float y, float z, int mapId, int areaId, int wmoDoodadPlacementId, int wmoGroupId, UiMapSystem system, bool local, out Vector2 newPos)
|
||||||
{
|
{
|
||||||
int throwaway;
|
return GetUiMapPosition(x, y, z, mapId, areaId, wmoDoodadPlacementId, wmoGroupId, system, local, out _, out newPos);
|
||||||
return GetUiMapPosition(x, y, z, mapId, areaId, wmoDoodadPlacementId, wmoGroupId, system, local, out throwaway, out newPos);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool GetUiMapPosition(float x, float y, float z, int mapId, int areaId, int wmoDoodadPlacementId, int wmoGroupId, UiMapSystem system, bool local, out int uiMapId)
|
public bool GetUiMapPosition(float x, float y, float z, int mapId, int areaId, int wmoDoodadPlacementId, int wmoGroupId, UiMapSystem system, bool local, out int uiMapId)
|
||||||
{
|
{
|
||||||
Vector2 throwaway;
|
return GetUiMapPosition(x, y, z, mapId, areaId, wmoDoodadPlacementId, wmoGroupId, system, local, out uiMapId, out _);
|
||||||
return GetUiMapPosition(x, y, z, mapId, areaId, wmoDoodadPlacementId, wmoGroupId, system, local, out uiMapId, out throwaway);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool GetUiMapPosition(float x, float y, float z, int mapId, int areaId, int wmoDoodadPlacementId, int wmoGroupId, UiMapSystem system, bool local, out int uiMapId, out Vector2 newPos)
|
public bool GetUiMapPosition(float x, float y, float z, int mapId, int areaId, int wmoDoodadPlacementId, int wmoGroupId, UiMapSystem system, bool local, out int uiMapId, out Vector2 newPos)
|
||||||
@@ -2198,7 +2195,7 @@ namespace Game.DataStorage
|
|||||||
|
|
||||||
public void Zone2MapCoordinates(uint areaId, ref float x, ref float y)
|
public void Zone2MapCoordinates(uint areaId, ref float x, ref float y)
|
||||||
{
|
{
|
||||||
AreaTableRecord areaEntry = CliDB.AreaTableStorage.LookupByKey(areaId);
|
AreaTableRecord areaEntry = AreaTableStorage.LookupByKey(areaId);
|
||||||
if (areaEntry == null)
|
if (areaEntry == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -2554,19 +2551,6 @@ namespace Game.DataStorage
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class ItemLevelSelectorQualityRecordComparator : IComparer<ItemLevelSelectorQualityRecord>
|
|
||||||
{
|
|
||||||
public bool Compare(ItemLevelSelectorQualityRecord left, ItemQuality quality)
|
|
||||||
{
|
|
||||||
return left.Quality < (byte)quality;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int Compare(ItemLevelSelectorQualityRecord left, ItemLevelSelectorQualityRecord right)
|
|
||||||
{
|
|
||||||
return left.Quality.CompareTo(right.Quality);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public struct ContentTuningLevels
|
public struct ContentTuningLevels
|
||||||
{
|
{
|
||||||
public short MinLevel;
|
public short MinLevel;
|
||||||
|
|||||||
@@ -2078,7 +2078,7 @@ namespace Game.Entities
|
|||||||
|
|
||||||
PhasingHandler.InheritPhaseShift(trigger, this);
|
PhasingHandler.InheritPhaseShift(trigger, this);
|
||||||
|
|
||||||
CastSpellExtraArgs args = new CastSpellExtraArgs(triggered);
|
CastSpellExtraArgs args = new(triggered);
|
||||||
Unit owner = GetOwner();
|
Unit owner = GetOwner();
|
||||||
if (owner)
|
if (owner)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1398,7 +1398,7 @@ namespace Game.Entities
|
|||||||
if (auraId == 0)
|
if (auraId == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
CastSpellExtraArgs args = new CastSpellExtraArgs(TriggerCastFlags.FullMask);
|
CastSpellExtraArgs args = new(TriggerCastFlags.FullMask);
|
||||||
|
|
||||||
if (auraId == 35696) // Demonic Knowledge
|
if (auraId == 35696) // Demonic Knowledge
|
||||||
args.SpellValueOverrides.Add(SpellValueMod.BasePoint0, MathFunctions.CalculatePct(aura.GetDamage(), GetStat(Stats.Stamina) + GetStat(Stats.Intellect)));
|
args.SpellValueOverrides.Add(SpellValueMod.BasePoint0, MathFunctions.CalculatePct(aura.GetDamage(), GetStat(Stats.Stamina) + GetStat(Stats.Intellect)));
|
||||||
|
|||||||
@@ -1367,7 +1367,7 @@ namespace Game.Entities
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
WorldLocation location = new WorldLocation(result.Read<uint>(1), result.Read<float>(2), result.Read<float>(3), result.Read<float>(4), result.Read<float>(5));
|
WorldLocation location = new(result.Read<uint>(1), result.Read<float>(2), result.Read<float>(3), result.Read<float>(4), result.Read<float>(5));
|
||||||
if (!GridDefines.IsValidMapCoord(location))
|
if (!GridDefines.IsValidMapCoord(location))
|
||||||
{
|
{
|
||||||
Log.outError(LogFilter.Spells, $"Player._LoadStoredAuraTeleportLocations: Player {GetName()} ({GetGUID()}) spell (ID: {spellId}) has invalid position on map {location.GetMapId()}, {location}.");
|
Log.outError(LogFilter.Spells, $"Player._LoadStoredAuraTeleportLocations: Player {GetName()} ({GetGUID()}) spell (ID: {spellId}) has invalid position on map {location.GetMapId()}, {location}.");
|
||||||
|
|||||||
@@ -5134,7 +5134,7 @@ namespace Game.Entities
|
|||||||
}
|
}
|
||||||
else if (apply)
|
else if (apply)
|
||||||
{
|
{
|
||||||
CastSpellExtraArgs args = new CastSpellExtraArgs(TriggerCastFlags.FullMask);
|
CastSpellExtraArgs args = new(TriggerCastFlags.FullMask);
|
||||||
args.CastItem = artifact;
|
args.CastItem = artifact;
|
||||||
if (artifactPowerRank.AuraPointsOverride != 0)
|
if (artifactPowerRank.AuraPointsOverride != 0)
|
||||||
for (int i = 0; i < SpellConst.MaxEffects; ++i)
|
for (int i = 0; i < SpellConst.MaxEffects; ++i)
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ namespace Game
|
|||||||
{
|
{
|
||||||
foreach (var hotfixRecord in hotfixRecords)
|
foreach (var hotfixRecord in hotfixRecords)
|
||||||
{
|
{
|
||||||
HotfixConnect.HotfixData hotfixData = new HotfixConnect.HotfixData();
|
HotfixConnect.HotfixData hotfixData = new();
|
||||||
hotfixData.Record = hotfixRecord;
|
hotfixData.Record = hotfixRecord;
|
||||||
if (hotfixRecord.HotfixStatus == HotfixRecord.Status.Valid)
|
if (hotfixRecord.HotfixStatus == HotfixRecord.Status.Valid)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -261,7 +261,7 @@ namespace Game.Loots
|
|||||||
|
|
||||||
// Process currency items
|
// Process currency items
|
||||||
uint max_slot = GetMaxSlotInLootFor(player);
|
uint max_slot = GetMaxSlotInLootFor(player);
|
||||||
LootItem item = null;
|
LootItem item;
|
||||||
int itemsSize = items.Count;
|
int itemsSize = items.Count;
|
||||||
for (byte i = 0; i < max_slot; ++i)
|
for (byte i = 0; i < max_slot; ++i)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -42,7 +42,6 @@ namespace Game.Loots
|
|||||||
do
|
do
|
||||||
{
|
{
|
||||||
ulong key = result.Read<ulong>(0);
|
ulong key = result.Read<ulong>(0);
|
||||||
var itr = _lootItemStorage.LookupByKey(key);
|
|
||||||
if (!_lootItemStorage.ContainsKey(key))
|
if (!_lootItemStorage.ContainsKey(key))
|
||||||
_lootItemStorage[key] = new StoredLootContainer(key);
|
_lootItemStorage[key] = new StoredLootContainer(key);
|
||||||
|
|
||||||
@@ -252,15 +251,12 @@ namespace Game.Loots
|
|||||||
stmt.AddValue(9, lootItem.randomBonusListId);
|
stmt.AddValue(9, lootItem.randomBonusListId);
|
||||||
stmt.AddValue(10, (uint)lootItem.context);
|
stmt.AddValue(10, (uint)lootItem.context);
|
||||||
|
|
||||||
foreach (uint token in lootItem.BonusListIDs)
|
StringBuilder bonusListIDs = new();
|
||||||
{
|
foreach (int bonusListID in lootItem.BonusListIDs)
|
||||||
StringBuilder bonusListIDs = new();
|
bonusListIDs.Append(bonusListID + ' ');
|
||||||
foreach (int bonusListID in lootItem.BonusListIDs)
|
|
||||||
bonusListIDs.Append(bonusListID + ' ');
|
|
||||||
|
|
||||||
stmt.AddValue(11, bonusListIDs.ToString());
|
stmt.AddValue(11, bonusListIDs.ToString());
|
||||||
trans.Append(stmt);
|
trans.Append(stmt);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddMoney(uint money, SQLTransaction trans)
|
public void AddMoney(uint money, SQLTransaction trans)
|
||||||
|
|||||||
+26
-28
@@ -43,35 +43,33 @@ namespace Game.Maps
|
|||||||
if (!File.Exists(filename))
|
if (!File.Exists(filename))
|
||||||
return LoadResult.FileNotFound;
|
return LoadResult.FileNotFound;
|
||||||
|
|
||||||
using (BinaryReader reader = new(new FileStream(filename, FileMode.Open, FileAccess.Read)))
|
using BinaryReader reader = new(new FileStream(filename, FileMode.Open, FileAccess.Read));
|
||||||
|
MapFileHeader header = reader.Read<MapFileHeader>();
|
||||||
|
if (header.mapMagic != MapConst.MapMagic || (header.versionMagic != MapConst.MapVersionMagic && header.versionMagic != MapConst.MapVersionMagic2)) // Hack for some different extractors using v2.0 header
|
||||||
{
|
{
|
||||||
MapFileHeader header = reader.Read<MapFileHeader>();
|
Log.outError(LogFilter.Maps, $"Map file '{filename}' is from an incompatible map version. Please recreate using the mapextractor.");
|
||||||
if (header.mapMagic != MapConst.MapMagic || (header.versionMagic != MapConst.MapVersionMagic && header.versionMagic != MapConst.MapVersionMagic2)) // Hack for some different extractors using v2.0 header
|
return LoadResult.ReadFromFileFailed;
|
||||||
{
|
|
||||||
Log.outError(LogFilter.Maps, $"Map file '{filename}' is from an incompatible map version. Please recreate using the mapextractor.");
|
|
||||||
return LoadResult.ReadFromFileFailed;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (header.areaMapOffset != 0 && !LoadAreaData(reader, header.areaMapOffset))
|
|
||||||
{
|
|
||||||
Log.outError(LogFilter.Maps, "Error loading map area data");
|
|
||||||
return LoadResult.ReadFromFileFailed;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (header.heightMapOffset != 0 && !LoadHeightData(reader, header.heightMapOffset))
|
|
||||||
{
|
|
||||||
Log.outError(LogFilter.Maps, "Error loading map height data");
|
|
||||||
return LoadResult.ReadFromFileFailed;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (header.liquidMapOffset != 0 && !LoadLiquidData(reader, header.liquidMapOffset))
|
|
||||||
{
|
|
||||||
Log.outError(LogFilter.Maps, "Error loading map liquids data");
|
|
||||||
return LoadResult.ReadFromFileFailed;
|
|
||||||
}
|
|
||||||
|
|
||||||
return LoadResult.Success;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (header.areaMapOffset != 0 && !LoadAreaData(reader, header.areaMapOffset))
|
||||||
|
{
|
||||||
|
Log.outError(LogFilter.Maps, "Error loading map area data");
|
||||||
|
return LoadResult.ReadFromFileFailed;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (header.heightMapOffset != 0 && !LoadHeightData(reader, header.heightMapOffset))
|
||||||
|
{
|
||||||
|
Log.outError(LogFilter.Maps, "Error loading map height data");
|
||||||
|
return LoadResult.ReadFromFileFailed;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (header.liquidMapOffset != 0 && !LoadLiquidData(reader, header.liquidMapOffset))
|
||||||
|
{
|
||||||
|
Log.outError(LogFilter.Maps, "Error loading map liquids data");
|
||||||
|
return LoadResult.ReadFromFileFailed;
|
||||||
|
}
|
||||||
|
|
||||||
|
return LoadResult.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void UnloadData()
|
public void UnloadData()
|
||||||
@@ -450,7 +448,7 @@ namespace Game.Maps
|
|||||||
float gx = x - ((int)gridCoord.X_coord - MapConst.CenterGridId + 1) * MapConst.SizeofGrids;
|
float gx = x - ((int)gridCoord.X_coord - MapConst.CenterGridId + 1) * MapConst.SizeofGrids;
|
||||||
float gy = y - ((int)gridCoord.Y_coord - MapConst.CenterGridId + 1) * MapConst.SizeofGrids;
|
float gy = y - ((int)gridCoord.Y_coord - MapConst.CenterGridId + 1) * MapConst.SizeofGrids;
|
||||||
|
|
||||||
uint quarterIndex = 0;
|
uint quarterIndex;
|
||||||
if (Convert.ToBoolean(doubleGridY & 1))
|
if (Convert.ToBoolean(doubleGridY & 1))
|
||||||
{
|
{
|
||||||
if (Convert.ToBoolean(doubleGridX & 1))
|
if (Convert.ToBoolean(doubleGridX & 1))
|
||||||
|
|||||||
@@ -2156,7 +2156,7 @@ namespace Game.Maps
|
|||||||
{
|
{
|
||||||
me = creature;
|
me = creature;
|
||||||
m_range = (dist == 0 ? 9999 : dist);
|
m_range = (dist == 0 ? 9999 : dist);
|
||||||
m_force = (dist == 0 ? false : true);
|
m_force = (dist != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Invoke(Unit u)
|
public bool Invoke(Unit u)
|
||||||
|
|||||||
@@ -82,8 +82,8 @@ namespace Game.Maps
|
|||||||
if (GetId() != mapId || player == null)
|
if (GetId() != mapId || player == null)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
Map map = null;
|
Map map;
|
||||||
uint newInstanceId = 0; // instanceId of the resulting map
|
uint newInstanceId; // instanceId of the resulting map
|
||||||
|
|
||||||
if (IsBattlegroundOrArena())
|
if (IsBattlegroundOrArena())
|
||||||
{
|
{
|
||||||
@@ -124,7 +124,7 @@ namespace Game.Maps
|
|||||||
return (map && map.GetId() == GetId()) ? map : null; // is this check necessary? or does MapInstanced only find instances of itself?
|
return (map && map.GetId() == GetId()) ? map : null; // is this check necessary? or does MapInstanced only find instances of itself?
|
||||||
}
|
}
|
||||||
|
|
||||||
InstanceBind groupBind = null;
|
InstanceBind groupBind;
|
||||||
Group group = player.GetGroup();
|
Group group = player.GetGroup();
|
||||||
// use the player's difficulty setting (it may not be the same as the group's)
|
// use the player's difficulty setting (it may not be the same as the group's)
|
||||||
if (group)
|
if (group)
|
||||||
|
|||||||
@@ -57,31 +57,29 @@ namespace Game
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
using (BinaryReader reader = new(new FileStream(filename, FileMode.Open, FileAccess.Read), Encoding.UTF8))
|
using BinaryReader reader = new(new FileStream(filename, FileMode.Open, FileAccess.Read), Encoding.UTF8);
|
||||||
|
Detour.dtNavMeshParams Params = new();
|
||||||
|
Params.orig[0] = reader.ReadSingle();
|
||||||
|
Params.orig[1] = reader.ReadSingle();
|
||||||
|
Params.orig[2] = reader.ReadSingle();
|
||||||
|
|
||||||
|
Params.tileWidth = reader.ReadSingle();
|
||||||
|
Params.tileHeight = reader.ReadSingle();
|
||||||
|
Params.maxTiles = reader.ReadInt32();
|
||||||
|
Params.maxPolys = reader.ReadInt32();
|
||||||
|
|
||||||
|
Detour.dtNavMesh mesh = new();
|
||||||
|
if (Detour.dtStatusFailed(mesh.init(Params)))
|
||||||
{
|
{
|
||||||
Detour.dtNavMeshParams Params = new();
|
Log.outError(LogFilter.Maps, "MMAP:loadMapData: Failed to initialize dtNavMesh for mmap {0:D4} from file {1}", mapId, filename);
|
||||||
Params.orig[0] = reader.ReadSingle();
|
return false;
|
||||||
Params.orig[1] = reader.ReadSingle();
|
|
||||||
Params.orig[2] = reader.ReadSingle();
|
|
||||||
|
|
||||||
Params.tileWidth = reader.ReadSingle();
|
|
||||||
Params.tileHeight = reader.ReadSingle();
|
|
||||||
Params.maxTiles = reader.ReadInt32();
|
|
||||||
Params.maxPolys = reader.ReadInt32();
|
|
||||||
|
|
||||||
Detour.dtNavMesh mesh = new();
|
|
||||||
if (Detour.dtStatusFailed(mesh.init(Params)))
|
|
||||||
{
|
|
||||||
Log.outError(LogFilter.Maps, "MMAP:loadMapData: Failed to initialize dtNavMesh for mmap {0:D4} from file {1}", mapId, filename);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
Log.outInfo(LogFilter.Maps, "MMAP:loadMapData: Loaded {0:D4}.mmap", mapId);
|
|
||||||
|
|
||||||
// store inside our map list
|
|
||||||
loadedMMaps[mapId] = new MMapData(mesh);
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Log.outInfo(LogFilter.Maps, "MMAP:loadMapData: Loaded {0:D4}.mmap", mapId);
|
||||||
|
|
||||||
|
// store inside our map list
|
||||||
|
loadedMMaps[mapId] = new MMapData(mesh);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint PackTileID(uint x, uint y)
|
uint PackTileID(uint x, uint y)
|
||||||
@@ -133,38 +131,36 @@ namespace Game
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
using (BinaryReader reader = new(new FileStream(fileName, FileMode.Open, FileAccess.Read)))
|
using BinaryReader reader = new(new FileStream(fileName, FileMode.Open, FileAccess.Read));
|
||||||
|
MmapTileHeader fileHeader = reader.Read<MmapTileHeader>();
|
||||||
|
if (fileHeader.mmapMagic != MapConst.mmapMagic)
|
||||||
{
|
{
|
||||||
MmapTileHeader fileHeader = reader.Read<MmapTileHeader>();
|
Log.outError(LogFilter.Maps, "MMAP:loadMap: Bad header in mmap {0:D4}{1:D2}{2:D2}.mmtile", mapId, x, y);
|
||||||
if (fileHeader.mmapMagic != MapConst.mmapMagic)
|
|
||||||
{
|
|
||||||
Log.outError(LogFilter.Maps, "MMAP:loadMap: Bad header in mmap {0:D4}{1:D2}{2:D2}.mmtile", mapId, x, y);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (fileHeader.mmapVersion != MapConst.mmapVersion)
|
|
||||||
{
|
|
||||||
Log.outError(LogFilter.Maps, "MMAP:loadMap: {0:D4}{1:D2}{2:D2}.mmtile was built with generator v{3}, expected v{4}",
|
|
||||||
mapId, x, y, fileHeader.mmapVersion, MapConst.mmapVersion);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
var bytes = reader.ReadBytes((int)fileHeader.size);
|
|
||||||
Detour.dtRawTileData data = new();
|
|
||||||
data.FromBytes(bytes, 0);
|
|
||||||
|
|
||||||
ulong tileRef = 0;
|
|
||||||
// memory allocated for data is now managed by detour, and will be deallocated when the tile is removed
|
|
||||||
if (Detour.dtStatusSucceed(mmap.navMesh.addTile(data, 1, 0, ref tileRef)))
|
|
||||||
{
|
|
||||||
mmap.loadedTileRefs.Add(packedGridPos, tileRef);
|
|
||||||
++loadedTiles;
|
|
||||||
Log.outInfo(LogFilter.Maps, "MMAP:loadMap: Loaded mmtile {0:D4}[{1:D2}, {2:D2}]", mapId, x, y);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
Log.outError(LogFilter.Maps, "MMAP:loadMap: Could not load {0:D4}{1:D2}{2:D2}.mmtile into navmesh", mapId, x, y);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
if (fileHeader.mmapVersion != MapConst.mmapVersion)
|
||||||
|
{
|
||||||
|
Log.outError(LogFilter.Maps, "MMAP:loadMap: {0:D4}{1:D2}{2:D2}.mmtile was built with generator v{3}, expected v{4}",
|
||||||
|
mapId, x, y, fileHeader.mmapVersion, MapConst.mmapVersion);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
var bytes = reader.ReadBytes((int)fileHeader.size);
|
||||||
|
Detour.dtRawTileData data = new();
|
||||||
|
data.FromBytes(bytes, 0);
|
||||||
|
|
||||||
|
ulong tileRef = 0;
|
||||||
|
// memory allocated for data is now managed by detour, and will be deallocated when the tile is removed
|
||||||
|
if (Detour.dtStatusSucceed(mmap.navMesh.addTile(data, 1, 0, ref tileRef)))
|
||||||
|
{
|
||||||
|
mmap.loadedTileRefs.Add(packedGridPos, tileRef);
|
||||||
|
++loadedTiles;
|
||||||
|
Log.outInfo(LogFilter.Maps, "MMAP:loadMap: Loaded mmtile {0:D4}[{1:D2}, {2:D2}]", mapId, x, y);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
Log.outError(LogFilter.Maps, "MMAP:loadMap: Could not load {0:D4}{1:D2}{2:D2}.mmtile into navmesh", mapId, x, y);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool LoadMapInstance(string basePath, uint mapId, uint instanceId)
|
public bool LoadMapInstance(string basePath, uint mapId, uint instanceId)
|
||||||
@@ -235,8 +231,7 @@ namespace Game
|
|||||||
ulong tileRef = mmap.loadedTileRefs[packedGridPos];
|
ulong tileRef = mmap.loadedTileRefs[packedGridPos];
|
||||||
|
|
||||||
// unload, and mark as non loaded
|
// unload, and mark as non loaded
|
||||||
Detour.dtRawTileData data;
|
if (Detour.dtStatusFailed(mmap.navMesh.removeTile(tileRef, out _)))
|
||||||
if (Detour.dtStatusFailed(mmap.navMesh.removeTile(tileRef, out data)))
|
|
||||||
{
|
{
|
||||||
// this is technically a memory leak
|
// this is technically a memory leak
|
||||||
// if the grid is later reloaded, dtNavMesh.addTile will return error but no extra memory is used
|
// if the grid is later reloaded, dtNavMesh.addTile will return error but no extra memory is used
|
||||||
@@ -270,8 +265,7 @@ namespace Game
|
|||||||
{
|
{
|
||||||
uint x = (i.Key >> 16);
|
uint x = (i.Key >> 16);
|
||||||
uint y = (i.Key & 0x0000FFFF);
|
uint y = (i.Key & 0x0000FFFF);
|
||||||
Detour.dtRawTileData data;
|
if (Detour.dtStatusFailed(mmap.navMesh.removeTile(i.Value, out _)))
|
||||||
if (Detour.dtStatusFailed(mmap.navMesh.removeTile(i.Value, out data)))
|
|
||||||
Log.outError(LogFilter.Maps, "MMAP:unloadMap: Could not unload {0:D4}{1:D2}{2:D2}.mmtile from navmesh", mapId, x, y);
|
Log.outError(LogFilter.Maps, "MMAP:unloadMap: Could not unload {0:D4}{1:D2}{2:D2}.mmtile from navmesh", mapId, x, y);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
+18
-23
@@ -119,20 +119,18 @@ namespace Game.Maps
|
|||||||
// tile list is optional
|
// tile list is optional
|
||||||
if (File.Exists(tileListName))
|
if (File.Exists(tileListName))
|
||||||
{
|
{
|
||||||
using (var reader = new BinaryReader(new FileStream(tileListName, FileMode.Open, FileAccess.Read)))
|
using var reader = new BinaryReader(new FileStream(tileListName, FileMode.Open, FileAccess.Read));
|
||||||
|
var mapMagic = reader.ReadUInt32();
|
||||||
|
var versionMagic = reader.ReadUInt32();
|
||||||
|
if (mapMagic == MapConst.MapMagic && versionMagic == MapConst.MapVersionMagic)
|
||||||
{
|
{
|
||||||
var mapMagic = reader.ReadUInt32();
|
var build = reader.ReadUInt32();
|
||||||
var versionMagic = reader.ReadUInt32();
|
byte[] tilesData = reader.ReadArray<byte>(MapConst.MaxGrids * MapConst.MaxGrids);
|
||||||
if (mapMagic == MapConst.MapMagic && versionMagic == MapConst.MapVersionMagic)
|
for (uint gx = 0; gx < MapConst.MaxGrids; ++gx)
|
||||||
{
|
for (uint gy = 0; gy < MapConst.MaxGrids; ++gy)
|
||||||
var build = reader.ReadUInt32();
|
i_gridFileExists[(int)(gx * MapConst.MaxGrids + gy)] = tilesData[(int)(gx * MapConst.MaxGrids + gy)] == 49; // char of 1
|
||||||
byte[] tilesData = reader.ReadArray<byte>(MapConst.MaxGrids * MapConst.MaxGrids);
|
|
||||||
for (uint gx = 0; gx < MapConst.MaxGrids; ++gx)
|
|
||||||
for (uint gy = 0; gy < MapConst.MaxGrids; ++gy)
|
|
||||||
i_gridFileExists[(int)(gx * MapConst.MaxGrids + gy)] = tilesData[(int)(gx * MapConst.MaxGrids + gy)] == 49; // char of 1
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -159,17 +157,15 @@ namespace Game.Maps
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
using (var reader = new BinaryReader(new FileStream(fileName, FileMode.Open, FileAccess.Read)))
|
using var reader = new BinaryReader(new FileStream(fileName, FileMode.Open, FileAccess.Read));
|
||||||
|
var header = reader.Read<MapFileHeader>();
|
||||||
|
if (header.mapMagic != MapConst.MapMagic || (header.versionMagic != MapConst.MapVersionMagic && header.versionMagic != MapConst.MapVersionMagic2)) // Hack for some different extractors using v2.0 header
|
||||||
{
|
{
|
||||||
var header = reader.Read<MapFileHeader>();
|
Log.outError(LogFilter.Maps, "Map file '{0}' is from an incompatible map version ({1}), {2} is expected. Please recreate using the mapextractor.",
|
||||||
if (header.mapMagic != MapConst.MapMagic || (header.versionMagic != MapConst.MapVersionMagic && header.versionMagic != MapConst.MapVersionMagic2)) // Hack for some different extractors using v2.0 header
|
fileName, header.versionMagic, MapConst.MapVersionMagic);
|
||||||
{
|
return false;
|
||||||
Log.outError(LogFilter.Maps, "Map file '{0}' is from an incompatible map version ({1}), {2} is expected. Please recreate using the mapextractor.",
|
|
||||||
fileName, header.versionMagic, MapConst.MapVersionMagic);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool ExistVMap(uint mapid, uint gx, uint gy)
|
public static bool ExistVMap(uint mapid, uint gx, uint gy)
|
||||||
@@ -1004,7 +1000,7 @@ namespace Game.Maps
|
|||||||
bool CheckGridIntegrity<T>(T obj, bool moved) where T : WorldObject
|
bool CheckGridIntegrity<T>(T obj, bool moved) where T : WorldObject
|
||||||
{
|
{
|
||||||
Cell cur_cell = obj.GetCurrentCell();
|
Cell cur_cell = obj.GetCurrentCell();
|
||||||
Cell xy_cell = new Cell(obj.GetPositionX(), obj.GetPositionY());
|
Cell xy_cell = new(obj.GetPositionX(), obj.GetPositionY());
|
||||||
if (xy_cell != cur_cell)
|
if (xy_cell != cur_cell)
|
||||||
{
|
{
|
||||||
//$"grid[{GetGridX()}, {GetGridY()}]cell[{GetCellX()}, {GetCellY()}]";
|
//$"grid[{GetGridX()}, {GetGridY()}]cell[{GetCellX()}, {GetCellY()}]";
|
||||||
@@ -4966,7 +4962,6 @@ namespace Game.Maps
|
|||||||
public Dictionary<ulong, CreatureGroup> CreatureGroupHolder = new();
|
public Dictionary<ulong, CreatureGroup> CreatureGroupHolder = new();
|
||||||
internal uint i_InstanceId;
|
internal uint i_InstanceId;
|
||||||
long i_gridExpiry;
|
long i_gridExpiry;
|
||||||
List<WorldObject> i_objects = new();
|
|
||||||
bool i_scriptLock;
|
bool i_scriptLock;
|
||||||
|
|
||||||
public int m_VisibilityNotifyPeriod;
|
public int m_VisibilityNotifyPeriod;
|
||||||
|
|||||||
@@ -259,7 +259,7 @@ namespace Game.Entities
|
|||||||
MapRecord mEntry = CliDB.MapStorage.LookupByKey(mapid);
|
MapRecord mEntry = CliDB.MapStorage.LookupByKey(mapid);
|
||||||
|
|
||||||
if (startUp)
|
if (startUp)
|
||||||
return mEntry != null ? true : false;
|
return mEntry != null;
|
||||||
else
|
else
|
||||||
return mEntry != null && (!mEntry.IsDungeon() || Global.ObjectMgr.GetInstanceTemplate(mapid) != null);
|
return mEntry != null && (!mEntry.IsDungeon() || Global.ObjectMgr.GetInstanceTemplate(mapid) != null);
|
||||||
|
|
||||||
|
|||||||
@@ -110,8 +110,8 @@ namespace Game.Maps
|
|||||||
|
|
||||||
// Add extra points to allow derivative calculations for all path nodes
|
// Add extra points to allow derivative calculations for all path nodes
|
||||||
allPoints.Insert(0, allPoints.First().lerp(allPoints[1], -0.2f));
|
allPoints.Insert(0, allPoints.First().lerp(allPoints[1], -0.2f));
|
||||||
allPoints.Add(allPoints.Last().lerp(allPoints[allPoints.Count - 2], -0.2f));
|
allPoints.Add(allPoints.Last().lerp(allPoints[^2], -0.2f));
|
||||||
allPoints.Add(allPoints.Last().lerp(allPoints[allPoints.Count - 2], -1.0f));
|
allPoints.Add(allPoints.Last().lerp(allPoints[^2], -1.0f));
|
||||||
|
|
||||||
SplineRawInitializer initer = new(allPoints);
|
SplineRawInitializer initer = new(allPoints);
|
||||||
Spline orientationSpline = new();
|
Spline orientationSpline = new();
|
||||||
@@ -204,7 +204,7 @@ namespace Game.Maps
|
|||||||
int extra = !keyFrames[i - 1].Teleport ? 1 : 0;
|
int extra = !keyFrames[i - 1].Teleport ? 1 : 0;
|
||||||
Spline spline = new();
|
Spline spline = new();
|
||||||
Span<Vector3> span = splinePath.ToArray();
|
Span<Vector3> span = splinePath.ToArray();
|
||||||
spline.InitSpline(span.Slice(start), i - start + extra, Spline.EvaluationMode.Catmullrom);
|
spline.InitSpline(span[start..], i - start + extra, Spline.EvaluationMode.Catmullrom);
|
||||||
spline.InitLengths();
|
spline.InitLengths();
|
||||||
for (int j = start; j < i + extra; ++j)
|
for (int j = start; j < i + extra; ++j)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ namespace Game.Movement
|
|||||||
if (!nodes.Empty())
|
if (!nodes.Empty())
|
||||||
{
|
{
|
||||||
TaxiPathNodeRecord start = nodes[0];
|
TaxiPathNodeRecord start = nodes[0];
|
||||||
TaxiPathNodeRecord end = nodes[nodes.Length - 1];
|
TaxiPathNodeRecord end = nodes[^1];
|
||||||
bool passedPreviousSegmentProximityCheck = false;
|
bool passedPreviousSegmentProximityCheck = false;
|
||||||
for (uint i = 0; i < nodes.Length; ++i)
|
for (uint i = 0; i < nodes.Length; ++i)
|
||||||
{
|
{
|
||||||
@@ -83,7 +83,7 @@ namespace Game.Movement
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
_path.RemoveAt(_path.Count - 1);
|
_path.RemoveAt(_path.Count - 1);
|
||||||
_pointsForPathSwitch[_pointsForPathSwitch.Count - 1].PathIndex -= 1;
|
_pointsForPathSwitch[^1].PathIndex -= 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -468,7 +468,7 @@ namespace Game.Movement
|
|||||||
{
|
{
|
||||||
float[] pathPoints = new float[74 * 3];
|
float[] pathPoints = new float[74 * 3];
|
||||||
int pointCount = 0;
|
int pointCount = 0;
|
||||||
uint dtResult = Detour.DT_FAILURE;
|
uint dtResult;
|
||||||
|
|
||||||
if (_straightLine)
|
if (_straightLine)
|
||||||
{
|
{
|
||||||
@@ -556,7 +556,7 @@ namespace Game.Movement
|
|||||||
if (Dist3DSqr(GetActualEndPosition(), GetEndPosition()) < 0.3f * Dist3DSqr(GetStartPosition(), GetEndPosition()))
|
if (Dist3DSqr(GetActualEndPosition(), GetEndPosition()) < 0.3f * Dist3DSqr(GetStartPosition(), GetEndPosition()))
|
||||||
{
|
{
|
||||||
SetActualEndPosition(GetEndPosition());
|
SetActualEndPosition(GetEndPosition());
|
||||||
_pathPoints[_pathPoints.Length - 1] = GetEndPosition();
|
_pathPoints[^1] = GetEndPosition();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -636,7 +636,7 @@ namespace Game.Movement
|
|||||||
Span<float> span = steerPath;
|
Span<float> span = steerPath;
|
||||||
// Stop at Off-Mesh link or when point is further than slop away.
|
// Stop at Off-Mesh link or when point is further than slop away.
|
||||||
if ((steerPathFlags[ns].HasAnyFlag((byte)Detour.dtStraightPathFlags.DT_STRAIGHTPATH_OFFMESH_CONNECTION) ||
|
if ((steerPathFlags[ns].HasAnyFlag((byte)Detour.dtStraightPathFlags.DT_STRAIGHTPATH_OFFMESH_CONNECTION) ||
|
||||||
!InRangeYZX(span.Slice((int)ns * 3).ToArray(), startPos, minTargetDist, 1000.0f)))
|
!InRangeYZX(span[((int)ns * 3)..].ToArray(), startPos, minTargetDist, 1000.0f)))
|
||||||
break;
|
break;
|
||||||
ns++;
|
ns++;
|
||||||
}
|
}
|
||||||
@@ -678,11 +678,7 @@ namespace Game.Movement
|
|||||||
while (npolys != 0 && nsmoothPath < maxSmoothPathSize)
|
while (npolys != 0 && nsmoothPath < maxSmoothPathSize)
|
||||||
{
|
{
|
||||||
// Find location to steer towards.
|
// Find location to steer towards.
|
||||||
float[] steerPos;
|
if (!GetSteerTarget(iterPos, targetPos, 0.3f, polys, npolys, out float[] steerPos, out Detour.dtStraightPathFlags steerPosFlag, out ulong steerPosRef))
|
||||||
Detour.dtStraightPathFlags steerPosFlag;
|
|
||||||
ulong steerPosRef = 0;
|
|
||||||
|
|
||||||
if (!GetSteerTarget(iterPos, targetPos, 0.3f, polys, npolys, out steerPos, out steerPosFlag, out steerPosRef))
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
bool endOfPath = steerPosFlag.HasAnyFlag(Detour.dtStraightPathFlags.DT_STRAIGHTPATH_END);
|
bool endOfPath = steerPosFlag.HasAnyFlag(Detour.dtStraightPathFlags.DT_STRAIGHTPATH_END);
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ namespace Game.Movement
|
|||||||
return (uint)init.Launch();
|
return (uint)init.Launch();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SendSplineFor(Unit me, int index, uint toNext)
|
void SendSplineFor(Unit me, int index, ref uint toNext)
|
||||||
{
|
{
|
||||||
Cypher.Assert(index < _chainSize);
|
Cypher.Assert(index < _chainSize);
|
||||||
Log.outDebug(LogFilter.Movement, "{0}: Sending spline for {1}.", me.GetGUID().ToString(), index);
|
Log.outDebug(LogFilter.Movement, "{0}: Sending spline for {1}.", me.GetGUID().ToString(), index);
|
||||||
@@ -90,7 +90,7 @@ namespace Game.Movement
|
|||||||
_nextFirstWP = (byte)(thisLink.Points.Count - 1);
|
_nextFirstWP = (byte)(thisLink.Points.Count - 1);
|
||||||
}
|
}
|
||||||
Span<Vector3> span = thisLink.Points.ToArray();
|
Span<Vector3> span = thisLink.Points.ToArray();
|
||||||
SendPathSpline(me, span.Slice(_nextFirstWP - 1));
|
SendPathSpline(me, span[(_nextFirstWP - 1)..]);
|
||||||
Log.outDebug(LogFilter.Movement, "{0}: Resumed spline chain generator from resume state.", me.GetGUID().ToString());
|
Log.outDebug(LogFilter.Movement, "{0}: Resumed spline chain generator from resume state.", me.GetGUID().ToString());
|
||||||
++_nextIndex;
|
++_nextIndex;
|
||||||
if (_nextIndex >= _chainSize)
|
if (_nextIndex >= _chainSize)
|
||||||
@@ -102,7 +102,7 @@ namespace Game.Movement
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
_msToNext = Math.Max(_chain[_nextIndex].TimeToNext, 1u);
|
_msToNext = Math.Max(_chain[_nextIndex].TimeToNext, 1u);
|
||||||
SendSplineFor(me, _nextIndex, _msToNext);
|
SendSplineFor(me, _nextIndex, ref _msToNext);
|
||||||
++_nextIndex;
|
++_nextIndex;
|
||||||
if (_nextIndex >= _chainSize)
|
if (_nextIndex >= _chainSize)
|
||||||
_msToNext = 0;
|
_msToNext = 0;
|
||||||
@@ -141,7 +141,7 @@ namespace Game.Movement
|
|||||||
// Send next spline
|
// Send next spline
|
||||||
Log.outDebug(LogFilter.Movement, "{0}: Should send spline {1} ({2} ms late).", me.GetGUID().ToString(), _nextIndex, diff - _msToNext);
|
Log.outDebug(LogFilter.Movement, "{0}: Should send spline {1} ({2} ms late).", me.GetGUID().ToString(), _nextIndex, diff - _msToNext);
|
||||||
_msToNext = Math.Max(_chain[_nextIndex].TimeToNext, 1u);
|
_msToNext = Math.Max(_chain[_nextIndex].TimeToNext, 1u);
|
||||||
SendSplineFor(me, _nextIndex, _msToNext);
|
SendSplineFor(me, _nextIndex, ref _msToNext);
|
||||||
++_nextIndex;
|
++_nextIndex;
|
||||||
if (_nextIndex >= _chainSize)
|
if (_nextIndex >= _chainSize)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -228,7 +228,7 @@ namespace Game.Movement
|
|||||||
init.Launch();
|
init.Launch();
|
||||||
|
|
||||||
// inform formation
|
// inform formation
|
||||||
creature.SignalFormationMovement(formationDest, waypoint.id, waypoint.moveType, (waypoint.orientation != 0 && waypoint.delay != 0) ? true : false);
|
creature.SignalFormationMovement(formationDest, waypoint.id, waypoint.moveType, (waypoint.orientation != 0 && waypoint.delay != 0));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -307,7 +307,7 @@ namespace Game.Movement
|
|||||||
|
|
||||||
public override void Pause(uint timer = 0)
|
public override void Pause(uint timer = 0)
|
||||||
{
|
{
|
||||||
_stalled = timer != 0 ? false : true;
|
_stalled = timer == 0;
|
||||||
_nextMoveTime.Reset(timer != 0 ? (int)timer : 1);
|
_nextMoveTime.Reset(timer != 0 ? (int)timer : 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -113,7 +113,7 @@ namespace Game.Movement
|
|||||||
{
|
{
|
||||||
int point = point_Idx_offset + point_Idx - spline.First() + (Finalized() ? 1 : 0);
|
int point = point_Idx_offset + point_Idx - spline.First() + (Finalized() ? 1 : 0);
|
||||||
if (IsCyclic())
|
if (IsCyclic())
|
||||||
point = point % (spline.Last() - spline.First());
|
point %= (spline.Last() - spline.First());
|
||||||
return point;
|
return point;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -164,7 +164,7 @@ namespace Game.Movement
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (splineflags.HasFlag(SplineFlag.Backward))
|
if (splineflags.HasFlag(SplineFlag.Backward))
|
||||||
orientation = orientation - (float)Math.PI;
|
orientation -= (float)Math.PI;
|
||||||
}
|
}
|
||||||
|
|
||||||
return new Vector4(c.X, c.Y, c.Z, orientation);
|
return new Vector4(c.X, c.Y, c.Z, orientation);
|
||||||
@@ -274,7 +274,7 @@ namespace Game.Movement
|
|||||||
if (spline.IsCyclic())
|
if (spline.IsCyclic())
|
||||||
{
|
{
|
||||||
point_Idx = spline.First();
|
point_Idx = spline.First();
|
||||||
time_passed = time_passed % Duration();
|
time_passed %= Duration();
|
||||||
result = UpdateResult.NextCycle;
|
result = UpdateResult.NextCycle;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -64,13 +64,13 @@ namespace Game.Movement
|
|||||||
void EvaluateCatmullRom(int index, float t, out Vector3 result)
|
void EvaluateCatmullRom(int index, float t, out Vector3 result)
|
||||||
{
|
{
|
||||||
Span<Vector3> span = points;
|
Span<Vector3> span = points;
|
||||||
C_Evaluate(span.Slice(index - 1), t, s_catmullRomCoeffs, out result);
|
C_Evaluate(span[(index - 1)..], t, s_catmullRomCoeffs, out result);
|
||||||
}
|
}
|
||||||
void EvaluateBezier3(int index, float t, out Vector3 result)
|
void EvaluateBezier3(int index, float t, out Vector3 result)
|
||||||
{
|
{
|
||||||
index *= (int)3u;
|
index *= (int)3u;
|
||||||
Span<Vector3> span = points;
|
Span<Vector3> span = points;
|
||||||
C_Evaluate(span.Slice(index), t, s_Bezier3Coeffs, out result);
|
C_Evaluate(span[index..], t, s_Bezier3Coeffs, out result);
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@@ -192,13 +192,13 @@ namespace Game.Movement
|
|||||||
void EvaluateDerivativeCatmullRom(int index, float t, out Vector3 result)
|
void EvaluateDerivativeCatmullRom(int index, float t, out Vector3 result)
|
||||||
{
|
{
|
||||||
Span<Vector3> span = points;
|
Span<Vector3> span = points;
|
||||||
C_Evaluate_Derivative(span.Slice(index - 1), t, s_catmullRomCoeffs, out result);
|
C_Evaluate_Derivative(span[(index - 1)..], t, s_catmullRomCoeffs, out result);
|
||||||
}
|
}
|
||||||
void EvaluateDerivativeBezier3(int index, float t, out Vector3 result)
|
void EvaluateDerivativeBezier3(int index, float t, out Vector3 result)
|
||||||
{
|
{
|
||||||
index *= (int)3u;
|
index *= (int)3u;
|
||||||
Span<Vector3> span = points;
|
Span<Vector3> span = points;
|
||||||
C_Evaluate_Derivative(span.Slice(index), t, s_Bezier3Coeffs, out result);
|
C_Evaluate_Derivative(span[index..], t, s_Bezier3Coeffs, out result);
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@@ -225,7 +225,7 @@ namespace Game.Movement
|
|||||||
{
|
{
|
||||||
Vector3 nextPos;
|
Vector3 nextPos;
|
||||||
Span<Vector3> p = points.AsSpan(index - 1);
|
Span<Vector3> p = points.AsSpan(index - 1);
|
||||||
Vector3 curPos = nextPos = p[1];
|
Vector3 curPos = p[1];
|
||||||
|
|
||||||
int i = 1;
|
int i = 1;
|
||||||
double length = 0;
|
double length = 0;
|
||||||
@@ -329,7 +329,8 @@ namespace Game.Movement
|
|||||||
{
|
{
|
||||||
int i = index_lo;
|
int i = index_lo;
|
||||||
Array.Resize(ref lengths, index_hi+1);
|
Array.Resize(ref lengths, index_hi+1);
|
||||||
int prev_length = 0, new_length = 0;
|
int prev_length;
|
||||||
|
int new_length;
|
||||||
while (i < index_hi)
|
while (i < index_hi)
|
||||||
{
|
{
|
||||||
new_length = cacher.SetGetTime(this, i);
|
new_length = cacher.SetGetTime(this, i);
|
||||||
@@ -355,8 +356,8 @@ namespace Game.Movement
|
|||||||
|
|
||||||
public bool Empty() { return index_lo == index_hi;}
|
public bool Empty() { return index_lo == index_hi;}
|
||||||
|
|
||||||
int[] lengths = new int[0];
|
int[] lengths = Array.Empty<int>();
|
||||||
Vector3[] points = new Vector3[0];
|
Vector3[] points = Array.Empty<Vector3>();
|
||||||
public EvaluationMode m_mode;
|
public EvaluationMode m_mode;
|
||||||
bool _cyclic;
|
bool _cyclic;
|
||||||
int index_lo;
|
int index_lo;
|
||||||
|
|||||||
@@ -34,18 +34,16 @@ public class PacketLog
|
|||||||
if (!string.IsNullOrEmpty(logname))
|
if (!string.IsNullOrEmpty(logname))
|
||||||
{
|
{
|
||||||
FullPath = logsDir + @"\" + logname;
|
FullPath = logsDir + @"\" + logname;
|
||||||
using (var writer = new BinaryWriter(File.Open(FullPath, FileMode.Create)))
|
using var writer = new BinaryWriter(File.Open(FullPath, FileMode.Create));
|
||||||
{
|
writer.Write(Encoding.ASCII.GetBytes("PKT"));
|
||||||
writer.Write(Encoding.ASCII.GetBytes("PKT"));
|
writer.Write((ushort)769);
|
||||||
writer.Write((ushort)769);
|
writer.Write(Encoding.ASCII.GetBytes("T"));
|
||||||
writer.Write(Encoding.ASCII.GetBytes("T"));
|
writer.Write(Global.WorldMgr.GetRealm().Build);
|
||||||
writer.Write(Global.WorldMgr.GetRealm().Build);
|
writer.Write(Encoding.ASCII.GetBytes("enUS"));
|
||||||
writer.Write(Encoding.ASCII.GetBytes("enUS"));
|
writer.Write(new byte[40]);//SessionKey
|
||||||
writer.Write(new byte[40]);//SessionKey
|
writer.Write((uint)GameTime.GetGameTime());
|
||||||
writer.Write((uint)GameTime.GetGameTime());
|
writer.Write(Time.GetMSTime());
|
||||||
writer.Write(Time.GetMSTime());
|
writer.Write(0);
|
||||||
writer.Write(0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -56,33 +54,31 @@ public class PacketLog
|
|||||||
|
|
||||||
lock (syncObj)
|
lock (syncObj)
|
||||||
{
|
{
|
||||||
using (var writer = new BinaryWriter(File.Open(FullPath, FileMode.Append), Encoding.ASCII))
|
using var writer = new BinaryWriter(File.Open(FullPath, FileMode.Append), Encoding.ASCII);
|
||||||
{
|
writer.Write(isClientPacket ? 0x47534d43 : 0x47534d53);
|
||||||
writer.Write(isClientPacket ? 0x47534d43 : 0x47534d53);
|
writer.Write((uint)connectionType);
|
||||||
writer.Write((uint)connectionType);
|
writer.Write(Time.GetMSTime());
|
||||||
writer.Write(Time.GetMSTime());
|
|
||||||
|
|
||||||
writer.Write(20);
|
writer.Write(20);
|
||||||
byte[] SocketIPBytes = new byte[16];
|
byte[] SocketIPBytes = new byte[16];
|
||||||
if (endPoint.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork)
|
if (endPoint.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork)
|
||||||
Buffer.BlockCopy(endPoint.Address.GetAddressBytes(), 0, SocketIPBytes, 0, 4);
|
Buffer.BlockCopy(endPoint.Address.GetAddressBytes(), 0, SocketIPBytes, 0, 4);
|
||||||
else
|
else
|
||||||
Buffer.BlockCopy(endPoint.Address.GetAddressBytes(), 0, SocketIPBytes, 0, 16);
|
Buffer.BlockCopy(endPoint.Address.GetAddressBytes(), 0, SocketIPBytes, 0, 16);
|
||||||
|
|
||||||
int size = data.Length;
|
int size = data.Length;
|
||||||
if (isClientPacket)
|
if (isClientPacket)
|
||||||
size -= 2;
|
size -= 2;
|
||||||
|
|
||||||
writer.Write(size + 4);
|
writer.Write(size + 4);
|
||||||
writer.Write(SocketIPBytes);
|
writer.Write(SocketIPBytes);
|
||||||
writer.Write(endPoint.Port);
|
writer.Write(endPoint.Port);
|
||||||
writer.Write(opcode);
|
writer.Write(opcode);
|
||||||
|
|
||||||
if (isClientPacket)
|
if (isClientPacket)
|
||||||
writer.Write(data, 2, size);
|
writer.Write(data, 2, size);
|
||||||
else
|
else
|
||||||
writer.Write(data, 0, size);
|
writer.Write(data, 0, size);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -133,12 +133,10 @@ namespace Game.Networking
|
|||||||
if (packetType == null)
|
if (packetType == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
using (var clientPacket = (ClientPacket)Activator.CreateInstance(packetType, packet))
|
using var clientPacket = (ClientPacket)Activator.CreateInstance(packetType, packet);
|
||||||
{
|
clientPacket.Read();
|
||||||
clientPacket.Read();
|
clientPacket.LogPacket(session);
|
||||||
clientPacket.LogPacket(session);
|
methodCaller(session, clientPacket);
|
||||||
methodCaller(session, clientPacket);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static Action<WorldSession, ClientPacket> CreateDelegate<P1>(MethodInfo method) where P1 : ClientPacket
|
static Action<WorldSession, ClientPacket> CreateDelegate<P1>(MethodInfo method) where P1 : ClientPacket
|
||||||
|
|||||||
@@ -250,7 +250,7 @@ namespace Game.Networking.Packets
|
|||||||
violenceLevel = _worldPacket.ReadInt8();
|
violenceLevel = _worldPacket.ReadInt8();
|
||||||
}
|
}
|
||||||
|
|
||||||
sbyte violenceLevel = -1; // 0 - no combat effects, 1 - display some combat effects, 2 - blood, 3 - bloody, 4 - bloodier, 5 - bloodiest
|
public sbyte violenceLevel; // 0 - no combat effects, 1 - display some combat effects, 2 - blood, 3 - bloody, 4 - bloodier, 5 - bloodiest
|
||||||
}
|
}
|
||||||
|
|
||||||
public class TimeSyncRequest : ServerPacket
|
public class TimeSyncRequest : ServerPacket
|
||||||
@@ -1155,7 +1155,7 @@ namespace Game.Networking.Packets
|
|||||||
|
|
||||||
public bool IsFullUpdate;
|
public bool IsFullUpdate;
|
||||||
public Dictionary<uint, HeirloomData> Heirlooms = new();
|
public Dictionary<uint, HeirloomData> Heirlooms = new();
|
||||||
int Unk;
|
public int Unk;
|
||||||
}
|
}
|
||||||
|
|
||||||
class MountSpecial : ClientPacket
|
class MountSpecial : ClientPacket
|
||||||
|
|||||||
@@ -56,8 +56,8 @@ namespace Game.Networking.Packets
|
|||||||
Reason = _worldPacket.ReadInt32();
|
Reason = _worldPacket.ReadInt32();
|
||||||
}
|
}
|
||||||
|
|
||||||
int ChannelSpell;
|
public int ChannelSpell;
|
||||||
int Reason = 0; // 40 = /run SpellStopCasting(), 16 = movement/AURA_INTERRUPT_FLAG_MOVE, 41 = turning/AURA_INTERRUPT_FLAG_TURNING
|
public int Reason; // 40 = /run SpellStopCasting(), 16 = movement/AURA_INTERRUPT_FLAG_MOVE, 41 = turning/AURA_INTERRUPT_FLAG_TURNING
|
||||||
// does not match SpellCastResult enum
|
// does not match SpellCastResult enum
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1448,7 +1448,7 @@ namespace Game.Networking.Packets
|
|||||||
public Optional<int> Duration;
|
public Optional<int> Duration;
|
||||||
public Optional<int> Remaining;
|
public Optional<int> Remaining;
|
||||||
Optional<float> TimeMod;
|
Optional<float> TimeMod;
|
||||||
public float[] Points = new float[0];
|
public float[] Points = Array.Empty<float>();
|
||||||
public List<float> EstimatedPoints = new();
|
public List<float> EstimatedPoints = new();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ namespace Game.Networking
|
|||||||
public WorldSocket(Socket socket) : base(socket)
|
public WorldSocket(Socket socket) : base(socket)
|
||||||
{
|
{
|
||||||
_connectType = ConnectionType.Realm;
|
_connectType = ConnectionType.Realm;
|
||||||
_serverChallenge = new byte[0].GenerateRandomKey(16);
|
_serverChallenge = Array.Empty<byte>().GenerateRandomKey(16);
|
||||||
_worldCrypt = new WorldCrypt();
|
_worldCrypt = new WorldCrypt();
|
||||||
|
|
||||||
_encryptKey = new byte[16];
|
_encryptKey = new byte[16];
|
||||||
|
|||||||
@@ -540,7 +540,7 @@ namespace Game.PvP
|
|||||||
if (fact_diff == 0.0f)
|
if (fact_diff == 0.0f)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
Team Challenger = 0;
|
Team Challenger;
|
||||||
float maxDiff = m_maxSpeed * diff;
|
float maxDiff = m_maxSpeed * diff;
|
||||||
|
|
||||||
if (fact_diff < 0)
|
if (fact_diff < 0)
|
||||||
|
|||||||
@@ -288,6 +288,7 @@ namespace Game
|
|||||||
public int References;
|
public int References;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Flags]
|
||||||
public enum PhaseShiftFlags
|
public enum PhaseShiftFlags
|
||||||
{
|
{
|
||||||
None = 0x00,
|
None = 0x00,
|
||||||
@@ -299,6 +300,7 @@ namespace Game
|
|||||||
NoCosmetic = 0x10 // This flag ignores shared cosmetic phases (two players that both have shared cosmetic phase but no other phase cannot see each other)
|
NoCosmetic = 0x10 // This flag ignores shared cosmetic phases (two players that both have shared cosmetic phase but no other phase cannot see each other)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Flags]
|
||||||
public enum PhaseFlags : ushort
|
public enum PhaseFlags : ushort
|
||||||
{
|
{
|
||||||
None = 0x0,
|
None = 0x0,
|
||||||
|
|||||||
@@ -1029,9 +1029,8 @@ namespace Game
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint val = mSpawnedPools[pool_id];
|
if (mSpawnedPools[pool_id] > 0)
|
||||||
if (val > 0)
|
--mSpawnedPools[pool_id];
|
||||||
--val;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<ulong> GetActiveQuests() { return mActiveQuests; } // a copy of the set
|
public List<ulong> GetActiveQuests() { return mActiveQuests; } // a copy of the set
|
||||||
|
|||||||
@@ -809,7 +809,7 @@ namespace Game
|
|||||||
public uint Flags2;
|
public uint Flags2;
|
||||||
public float ProgressBarWeight;
|
public float ProgressBarWeight;
|
||||||
public string Description;
|
public string Description;
|
||||||
public int[] VisualEffects = new int[0];
|
public int[] VisualEffects = Array.Empty<int>();
|
||||||
|
|
||||||
public bool IsStoringValue()
|
public bool IsStoringValue()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -492,7 +492,7 @@ namespace Game
|
|||||||
var factionEntry = CliDB.FactionStorage.LookupByKey(factionTemplateEntry.Faction);
|
var factionEntry = CliDB.FactionStorage.LookupByKey(factionTemplateEntry.Faction);
|
||||||
if (factionEntry.Id != 0)
|
if (factionEntry.Id != 0)
|
||||||
// Never show factions of the opposing team
|
// Never show factions of the opposing team
|
||||||
if (!Convert.ToBoolean(factionEntry.ReputationRaceMask[1] & SharedConst.GetMaskForRace(_player.GetRace())) && factionEntry.ReputationBase[1] == Reputation_Bottom)
|
if (!Convert.ToBoolean(factionEntry.ReputationRaceMask[1] & SharedConst.GetMaskForRace(_player.GetRace())) && factionEntry.ReputationBase[1] == SharedConst.ReputationBottom)
|
||||||
SetVisible(factionEntry);
|
SetVisible(factionEntry);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -783,7 +783,7 @@ namespace Game
|
|||||||
bool _sendFactionIncreased; //! Play visual effect on next SMSG_SET_FACTION_STANDING sent
|
bool _sendFactionIncreased; //! Play visual effect on next SMSG_SET_FACTION_STANDING sent
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
public static int[] ReputationRankThresholds =
|
static int[] ReputationRankThresholds =
|
||||||
{
|
{
|
||||||
-42000,
|
-42000,
|
||||||
// Hated
|
// Hated
|
||||||
@@ -803,14 +803,12 @@ namespace Game
|
|||||||
// Exalted
|
// Exalted
|
||||||
};
|
};
|
||||||
|
|
||||||
public static CypherStrings[] ReputationRankStrIndex =
|
static CypherStrings[] ReputationRankStrIndex =
|
||||||
{
|
{
|
||||||
CypherStrings.RepHated, CypherStrings.RepHostile, CypherStrings.RepUnfriendly, CypherStrings.RepNeutral,
|
CypherStrings.RepHated, CypherStrings.RepHostile, CypherStrings.RepUnfriendly, CypherStrings.RepNeutral,
|
||||||
CypherStrings.RepFriendly, CypherStrings.RepHonored, CypherStrings.RepRevered, CypherStrings.RepExalted
|
CypherStrings.RepFriendly, CypherStrings.RepHonored, CypherStrings.RepRevered, CypherStrings.RepExalted
|
||||||
};
|
};
|
||||||
|
|
||||||
const int Reputation_Cap = 42000;
|
|
||||||
const int Reputation_Bottom = -42000;
|
|
||||||
SortedDictionary<uint, FactionState> _factions = new();
|
SortedDictionary<uint, FactionState> _factions = new();
|
||||||
Dictionary<uint, ReputationRank> _forcedReactions = new();
|
Dictionary<uint, ReputationRank> _forcedReactions = new();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -159,7 +159,6 @@ namespace Game.Scenarios
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Vector2>[][] POIs = new List<Vector2>[0][];
|
|
||||||
Dictionary<uint, MultiMap<int, ScenarioPOIPoint>> allPoints = new();
|
Dictionary<uint, MultiMap<int, ScenarioPOIPoint>> allPoints = new();
|
||||||
|
|
||||||
// 0 1 2 3 4
|
// 0 1 2 3 4
|
||||||
|
|||||||
@@ -1097,15 +1097,15 @@ namespace Game.Scripting
|
|||||||
|
|
||||||
public override bool _Validate(SpellInfo entry)
|
public override bool _Validate(SpellInfo entry)
|
||||||
{
|
{
|
||||||
foreach (var eff in DoCheckAreaTarget)
|
foreach (var _ in DoCheckAreaTarget)
|
||||||
if (!entry.HasAreaAuraEffect() && !entry.HasEffect(SpellEffectName.PersistentAreaAura) && !entry.HasEffect(SpellEffectName.ApplyAura))
|
if (!entry.HasAreaAuraEffect() && !entry.HasEffect(SpellEffectName.PersistentAreaAura) && !entry.HasEffect(SpellEffectName.ApplyAura))
|
||||||
Log.outError(LogFilter.Scripts, "Spell `{0}` of script `{1}` does not have apply aura effect - handler bound to hook `DoCheckAreaTarget` of AuraScript won't be executed", entry.Id, m_scriptName);
|
Log.outError(LogFilter.Scripts, "Spell `{0}` of script `{1}` does not have apply aura effect - handler bound to hook `DoCheckAreaTarget` of AuraScript won't be executed", entry.Id, m_scriptName);
|
||||||
|
|
||||||
foreach (var eff in OnDispel)
|
foreach (var _ in OnDispel)
|
||||||
if (!entry.HasEffect(SpellEffectName.ApplyAura) && !entry.HasAreaAuraEffect())
|
if (!entry.HasEffect(SpellEffectName.ApplyAura) && !entry.HasAreaAuraEffect())
|
||||||
Log.outError(LogFilter.Scripts, "Spell `{0}` of script `{1}` does not have apply aura effect - handler bound to hook `OnDispel` of AuraScript won't be executed", entry.Id, m_scriptName);
|
Log.outError(LogFilter.Scripts, "Spell `{0}` of script `{1}` does not have apply aura effect - handler bound to hook `OnDispel` of AuraScript won't be executed", entry.Id, m_scriptName);
|
||||||
|
|
||||||
foreach (var eff in AfterDispel)
|
foreach (var _ in AfterDispel)
|
||||||
if (!entry.HasEffect(SpellEffectName.ApplyAura) && !entry.HasAreaAuraEffect())
|
if (!entry.HasEffect(SpellEffectName.ApplyAura) && !entry.HasAreaAuraEffect())
|
||||||
Log.outError(LogFilter.Scripts, "Spell `{0}` of script `{1}` does not have apply aura effect - handler bound to hook `AfterDispel` of AuraScript won't be executed", entry.Id, m_scriptName);
|
Log.outError(LogFilter.Scripts, "Spell `{0}` of script `{1}` does not have apply aura effect - handler bound to hook `AfterDispel` of AuraScript won't be executed", entry.Id, m_scriptName);
|
||||||
|
|
||||||
@@ -1169,7 +1169,7 @@ namespace Game.Scripting
|
|||||||
if (eff.GetAffectedEffectsMask(entry) == 0)
|
if (eff.GetAffectedEffectsMask(entry) == 0)
|
||||||
Log.outError(LogFilter.Scripts, "Spell `{0}` Effect `{1}` of script `{2}` did not match dbc effect data - handler bound to hook `OnEffectSplit` of AuraScript won't be executed", entry.Id, eff.ToString(), m_scriptName);
|
Log.outError(LogFilter.Scripts, "Spell `{0}` Effect `{1}` of script `{2}` did not match dbc effect data - handler bound to hook `OnEffectSplit` of AuraScript won't be executed", entry.Id, eff.ToString(), m_scriptName);
|
||||||
|
|
||||||
foreach (var eff in DoCheckProc)
|
foreach (var _ in DoCheckProc)
|
||||||
if (!entry.HasEffect(SpellEffectName.ApplyAura) && !entry.HasAreaAuraEffect())
|
if (!entry.HasEffect(SpellEffectName.ApplyAura) && !entry.HasAreaAuraEffect())
|
||||||
Log.outError(LogFilter.Scripts, "Spell `{0}` of script `{1}` does not have apply aura effect - handler bound to hook `DoCheckProc` of AuraScript won't be executed", entry.Id, m_scriptName);
|
Log.outError(LogFilter.Scripts, "Spell `{0}` of script `{1}` does not have apply aura effect - handler bound to hook `DoCheckProc` of AuraScript won't be executed", entry.Id, m_scriptName);
|
||||||
|
|
||||||
@@ -1177,15 +1177,15 @@ namespace Game.Scripting
|
|||||||
if (eff.GetAffectedEffectsMask(entry) == 0)
|
if (eff.GetAffectedEffectsMask(entry) == 0)
|
||||||
Log.outError(LogFilter.Scripts, "Spell `{0}` Effect `{1}` of script `{2}` did not match dbc effect data - handler bound to hook `DoCheckEffectProc` of AuraScript won't be executed", entry.Id, eff.ToString(), m_scriptName);
|
Log.outError(LogFilter.Scripts, "Spell `{0}` Effect `{1}` of script `{2}` did not match dbc effect data - handler bound to hook `DoCheckEffectProc` of AuraScript won't be executed", entry.Id, eff.ToString(), m_scriptName);
|
||||||
|
|
||||||
foreach (var eff in DoPrepareProc)
|
foreach (var _ in DoPrepareProc)
|
||||||
if (!entry.HasEffect(SpellEffectName.ApplyAura) && !entry.HasAreaAuraEffect())
|
if (!entry.HasEffect(SpellEffectName.ApplyAura) && !entry.HasAreaAuraEffect())
|
||||||
Log.outError(LogFilter.Scripts, "Spell `{0}` of script `{1}` does not have apply aura effect - handler bound to hook `DoPrepareProc` of AuraScript won't be executed", entry.Id, m_scriptName);
|
Log.outError(LogFilter.Scripts, "Spell `{0}` of script `{1}` does not have apply aura effect - handler bound to hook `DoPrepareProc` of AuraScript won't be executed", entry.Id, m_scriptName);
|
||||||
|
|
||||||
foreach (var eff in OnProc)
|
foreach (var _ in OnProc)
|
||||||
if (!entry.HasEffect(SpellEffectName.ApplyAura) && !entry.HasAreaAuraEffect())
|
if (!entry.HasEffect(SpellEffectName.ApplyAura) && !entry.HasAreaAuraEffect())
|
||||||
Log.outError(LogFilter.Scripts, "Spell `{0}` of script `{1}` does not have apply aura effect - handler bound to hook `OnProc` of AuraScript won't be executed", entry.Id, m_scriptName);
|
Log.outError(LogFilter.Scripts, "Spell `{0}` of script `{1}` does not have apply aura effect - handler bound to hook `OnProc` of AuraScript won't be executed", entry.Id, m_scriptName);
|
||||||
|
|
||||||
foreach (var eff in AfterProc)
|
foreach (var _ in AfterProc)
|
||||||
if (!entry.HasEffect(SpellEffectName.ApplyAura) && !entry.HasAreaAuraEffect())
|
if (!entry.HasEffect(SpellEffectName.ApplyAura) && !entry.HasAreaAuraEffect())
|
||||||
Log.outError(LogFilter.Scripts, "Spell `{0}` of script `{1}` does not have apply aura effect - handler bound to hook `AfterProc` of AuraScript won't be executed", entry.Id, m_scriptName);
|
Log.outError(LogFilter.Scripts, "Spell `{0}` of script `{1}` does not have apply aura effect - handler bound to hook `AfterProc` of AuraScript won't be executed", entry.Id, m_scriptName);
|
||||||
|
|
||||||
|
|||||||
@@ -1231,7 +1231,7 @@ namespace Game
|
|||||||
public void Update(uint diff)
|
public void Update(uint diff)
|
||||||
{
|
{
|
||||||
///- Update the game time and check for shutdown time
|
///- Update the game time and check for shutdown time
|
||||||
_UpdateGameTime();
|
UpdateGameTime();
|
||||||
long currentGameTime = GameTime.GetGameTime();
|
long currentGameTime = GameTime.GetGameTime();
|
||||||
|
|
||||||
_worldUpdateTime.UpdateWithDiff(diff);
|
_worldUpdateTime.UpdateWithDiff(diff);
|
||||||
@@ -1731,7 +1731,7 @@ namespace Game
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void _UpdateGameTime()
|
void UpdateGameTime()
|
||||||
{
|
{
|
||||||
// update the time
|
// update the time
|
||||||
long lastGameTime = GameTime.GetGameTime();
|
long lastGameTime = GameTime.GetGameTime();
|
||||||
@@ -1899,10 +1899,10 @@ namespace Game
|
|||||||
{
|
{
|
||||||
PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_CHARACTER_COUNT);
|
PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_CHARACTER_COUNT);
|
||||||
stmt.AddValue(0, accountId);
|
stmt.AddValue(0, accountId);
|
||||||
_queryProcessor.AddCallback(DB.Characters.AsyncQuery(stmt).WithCallback(_UpdateRealmCharCount));
|
_queryProcessor.AddCallback(DB.Characters.AsyncQuery(stmt).WithCallback(UpdateRealmCharCount));
|
||||||
}
|
}
|
||||||
|
|
||||||
void _UpdateRealmCharCount(SQLResult result)
|
void UpdateRealmCharCount(SQLResult result)
|
||||||
{
|
{
|
||||||
if (!result.IsEmpty())
|
if (!result.IsEmpty())
|
||||||
{
|
{
|
||||||
@@ -2061,7 +2061,7 @@ namespace Game
|
|||||||
if (session.GetPlayer() != null)
|
if (session.GetPlayer() != null)
|
||||||
session.GetPlayer().ResetCurrencyWeekCap();
|
session.GetPlayer().ResetCurrencyWeekCap();
|
||||||
|
|
||||||
m_NextCurrencyReset = m_NextCurrencyReset + Time.Day * WorldConfig.GetIntValue(WorldCfg.CurrencyResetInterval);
|
m_NextCurrencyReset += Time.Day * WorldConfig.GetIntValue(WorldCfg.CurrencyResetInterval);
|
||||||
SetWorldState(WorldStates.CurrencyResetTime, (ulong)m_NextCurrencyReset);
|
SetWorldState(WorldStates.CurrencyResetTime, (ulong)m_NextCurrencyReset);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2095,7 +2095,7 @@ namespace Game
|
|||||||
if (session.GetPlayer() != null)
|
if (session.GetPlayer() != null)
|
||||||
session.GetPlayer().ResetWeeklyQuestStatus();
|
session.GetPlayer().ResetWeeklyQuestStatus();
|
||||||
|
|
||||||
m_NextWeeklyQuestReset = (m_NextWeeklyQuestReset + Time.Week);
|
m_NextWeeklyQuestReset += Time.Week;
|
||||||
SetWorldState(WorldStates.WeeklyQuestResetTime, (ulong)m_NextWeeklyQuestReset);
|
SetWorldState(WorldStates.WeeklyQuestResetTime, (ulong)m_NextWeeklyQuestReset);
|
||||||
|
|
||||||
// change available weeklies
|
// change available weeklies
|
||||||
@@ -2149,13 +2149,13 @@ namespace Game
|
|||||||
if (session.GetPlayer())
|
if (session.GetPlayer())
|
||||||
session.GetPlayer().SetRandomWinner(false);
|
session.GetPlayer().SetRandomWinner(false);
|
||||||
|
|
||||||
m_NextRandomBGReset = m_NextRandomBGReset + Time.Day;
|
m_NextRandomBGReset += Time.Day;
|
||||||
SetWorldState(WorldStates.BGDailyResetTime, (ulong)m_NextRandomBGReset);
|
SetWorldState(WorldStates.BGDailyResetTime, (ulong)m_NextRandomBGReset);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ResetGuildCap()
|
void ResetGuildCap()
|
||||||
{
|
{
|
||||||
m_NextGuildReset = (m_NextGuildReset + Time.Day);
|
m_NextGuildReset += Time.Day;
|
||||||
SetWorldState(WorldStates.GuildDailyResetTime, (ulong)m_NextGuildReset);
|
SetWorldState(WorldStates.GuildDailyResetTime, (ulong)m_NextGuildReset);
|
||||||
ulong week = GetWorldState(WorldStates.GuildWeeklyResetTime);
|
ulong week = GetWorldState(WorldStates.GuildWeeklyResetTime);
|
||||||
week = week < 7 ? week + 1 : 1;
|
week = week < 7 ? week + 1 : 1;
|
||||||
@@ -2532,7 +2532,7 @@ namespace Game
|
|||||||
if (i_args != null)
|
if (i_args != null)
|
||||||
text = string.Format(text, i_args);
|
text = string.Format(text, i_args);
|
||||||
|
|
||||||
MultiplePacketSender sender = new MultiplePacketSender();
|
MultiplePacketSender sender = new();
|
||||||
|
|
||||||
var lines = new StringArray(text, "\n");
|
var lines = new StringArray(text, "\n");
|
||||||
for (var i = 0; i < lines.Length; ++i)
|
for (var i = 0; i < lines.Length; ++i)
|
||||||
|
|||||||
@@ -81,8 +81,7 @@ namespace Game
|
|||||||
}
|
}
|
||||||
|
|
||||||
// empty incoming packet queue
|
// empty incoming packet queue
|
||||||
WorldPacket packet;
|
_recvQueue.Clear();
|
||||||
while (_recvQueue.TryDequeue(out packet)) ;
|
|
||||||
|
|
||||||
DB.Login.Execute("UPDATE account SET online = 0 WHERE id = {0};", GetAccountId()); // One-time query
|
DB.Login.Execute("UPDATE account SET online = 0 WHERE id = {0};", GetAccountId()); // One-time query
|
||||||
}
|
}
|
||||||
@@ -773,9 +772,6 @@ namespace Game
|
|||||||
SendPacket(bnetConnected);
|
SendPacket(bnetConnected);
|
||||||
|
|
||||||
_battlePetMgr.LoadFromDB(holder.GetResult(AccountInfoQueryLoad.BattlePets), holder.GetResult(AccountInfoQueryLoad.BattlePetSlot));
|
_battlePetMgr.LoadFromDB(holder.GetResult(AccountInfoQueryLoad.BattlePets), holder.GetResult(AccountInfoQueryLoad.BattlePetSlot));
|
||||||
|
|
||||||
realmHolder = null;
|
|
||||||
holder = null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public RBACData GetRBACData()
|
public RBACData GetRBACData()
|
||||||
@@ -840,10 +836,6 @@ namespace Game
|
|||||||
public BattlePetMgr GetBattlePetMgr() { return _battlePetMgr; }
|
public BattlePetMgr GetBattlePetMgr() { return _battlePetMgr; }
|
||||||
public CollectionMgr GetCollectionMgr() { return _collectionMgr; }
|
public CollectionMgr GetCollectionMgr() { return _collectionMgr; }
|
||||||
|
|
||||||
void ClearRedirectFlag(SessionFlags flag) { m_flags &= ~flag; }
|
|
||||||
public bool WasRedirected() { return m_flags.HasAnyFlag(SessionFlags.FromRedirect); }
|
|
||||||
bool HasRedirected() { return m_flags.HasAnyFlag(SessionFlags.HasRedirected); }
|
|
||||||
|
|
||||||
// Battlenet
|
// Battlenet
|
||||||
public Array<byte> GetRealmListSecret() { return _realmListSecret; }
|
public Array<byte> GetRealmListSecret() { return _realmListSecret; }
|
||||||
void SetRealmListSecret(Array<byte> secret) { _realmListSecret = secret; }
|
void SetRealmListSecret(Array<byte> secret) { _realmListSecret = secret; }
|
||||||
|
|||||||
@@ -1313,7 +1313,7 @@ namespace Game.Spells
|
|||||||
if (aurEff != null)
|
if (aurEff != null)
|
||||||
{
|
{
|
||||||
float multiplier = aurEff.GetAmount();
|
float multiplier = aurEff.GetAmount();
|
||||||
CastSpellExtraArgs args = new CastSpellExtraArgs(TriggerCastFlags.FullMask);
|
CastSpellExtraArgs args = new(TriggerCastFlags.FullMask);
|
||||||
args.SpellValueOverrides.Add(SpellValueMod.BasePoint0, MathFunctions.CalculatePct(caster.GetMaxPower(PowerType.Mana), multiplier));
|
args.SpellValueOverrides.Add(SpellValueMod.BasePoint0, MathFunctions.CalculatePct(caster.GetMaxPower(PowerType.Mana), multiplier));
|
||||||
caster.CastSpell(caster, 47755, args);
|
caster.CastSpell(caster, 47755, args);
|
||||||
}
|
}
|
||||||
@@ -2487,7 +2487,7 @@ namespace Game.Spells
|
|||||||
if (casterGUID != owner.GetGUID() && spellproto.IsSingleTarget())
|
if (casterGUID != owner.GetGUID() && spellproto.IsSingleTarget())
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
Aura aura = null;
|
Aura aura;
|
||||||
switch (owner.GetTypeId())
|
switch (owner.GetTypeId())
|
||||||
{
|
{
|
||||||
case TypeId.Unit:
|
case TypeId.Unit:
|
||||||
|
|||||||
@@ -5625,7 +5625,7 @@ namespace Game.Spells
|
|||||||
// on apply cast summon spell
|
// on apply cast summon spell
|
||||||
if (apply)
|
if (apply)
|
||||||
{
|
{
|
||||||
CastSpellExtraArgs args = new CastSpellExtraArgs(TriggerCastFlags.FullMask);
|
CastSpellExtraArgs args = new(TriggerCastFlags.FullMask);
|
||||||
args.TriggeringAura = this;
|
args.TriggeringAura = this;
|
||||||
args.CastDifficulty = triggerSpellInfo.Difficulty;
|
args.CastDifficulty = triggerSpellInfo.Difficulty;
|
||||||
target.CastSpell(target, triggerSpellInfo.Id, args);
|
target.CastSpell(target, triggerSpellInfo.Id, args);
|
||||||
|
|||||||
@@ -255,8 +255,8 @@ namespace Game.Spells
|
|||||||
if (Convert.ToBoolean(implicitTargetMask & (SpellCastTargetFlags.Gameobject | SpellCastTargetFlags.GameobjectItem)))
|
if (Convert.ToBoolean(implicitTargetMask & (SpellCastTargetFlags.Gameobject | SpellCastTargetFlags.GameobjectItem)))
|
||||||
m_targets.SetTargetFlag(SpellCastTargetFlags.Gameobject);
|
m_targets.SetTargetFlag(SpellCastTargetFlags.Gameobject);
|
||||||
|
|
||||||
SelectEffectImplicitTargets(effect.EffectIndex, effect.TargetA, processedAreaEffectsMask);
|
SelectEffectImplicitTargets(effect.EffectIndex, effect.TargetA, ref processedAreaEffectsMask);
|
||||||
SelectEffectImplicitTargets(effect.EffectIndex, effect.TargetB, processedAreaEffectsMask);
|
SelectEffectImplicitTargets(effect.EffectIndex, effect.TargetB, ref processedAreaEffectsMask);
|
||||||
|
|
||||||
// Select targets of effect based on effect type
|
// Select targets of effect based on effect type
|
||||||
// those are used when no valid target could be added for spell effect based on spell target type
|
// those are used when no valid target could be added for spell effect based on spell target type
|
||||||
@@ -325,7 +325,7 @@ namespace Game.Spells
|
|||||||
m_caster.m_Events.ModifyEventTime(_spellEvent, GetDelayStart() + m_delayMoment);
|
m_caster.m_Events.ModifyEventTime(_spellEvent, GetDelayStart() + m_delayMoment);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SelectEffectImplicitTargets(uint effIndex, SpellImplicitTargetInfo targetType, uint processedEffectMask)
|
void SelectEffectImplicitTargets(uint effIndex, SpellImplicitTargetInfo targetType, ref uint processedEffectMask)
|
||||||
{
|
{
|
||||||
if (targetType.GetTarget() == 0)
|
if (targetType.GetTarget() == 0)
|
||||||
return;
|
return;
|
||||||
@@ -2168,7 +2168,7 @@ namespace Game.Spells
|
|||||||
basePoints[auraSpellEffect.EffectIndex] = (m_spellValue.CustomBasePointsMask & (1 << (int)auraSpellEffect.EffectIndex)) != 0 ?
|
basePoints[auraSpellEffect.EffectIndex] = (m_spellValue.CustomBasePointsMask & (1 << (int)auraSpellEffect.EffectIndex)) != 0 ?
|
||||||
m_spellValue.EffectBasePoints[auraSpellEffect.EffectIndex] : auraSpellEffect.CalcBaseValue(m_originalCaster, unit, m_castItemEntry, m_castItemLevel);
|
m_spellValue.EffectBasePoints[auraSpellEffect.EffectIndex] : auraSpellEffect.CalcBaseValue(m_originalCaster, unit, m_castItemEntry, m_castItemLevel);
|
||||||
|
|
||||||
bool refresh = false;
|
bool refresh;
|
||||||
bool resetPeriodicTimer = !_triggeredCastFlags.HasAnyFlag(TriggerCastFlags.DontResetPeriodicTimer);
|
bool resetPeriodicTimer = !_triggeredCastFlags.HasAnyFlag(TriggerCastFlags.DontResetPeriodicTimer);
|
||||||
m_spellAura = Aura.TryRefreshStackOrCreate(m_spellInfo, m_castId, effectMask, unit,
|
m_spellAura = Aura.TryRefreshStackOrCreate(m_spellInfo, m_castId, effectMask, unit,
|
||||||
m_originalCaster, GetCastDifficulty(), out refresh, basePoints, m_CastItem, ObjectGuid.Empty, resetPeriodicTimer, ObjectGuid.Empty, m_castItemEntry, m_castItemLevel);
|
m_originalCaster, GetCastDifficulty(), out refresh, basePoints, m_CastItem, ObjectGuid.Empty, resetPeriodicTimer, ObjectGuid.Empty, m_castItemEntry, m_castItemLevel);
|
||||||
@@ -4822,8 +4822,6 @@ namespace Game.Spells
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
castResult = SpellCastResult.SpellCastOk;
|
|
||||||
|
|
||||||
// always (except passive spells) check items (focus object can be required for any type casts)
|
// always (except passive spells) check items (focus object can be required for any type casts)
|
||||||
if (!m_spellInfo.IsPassive())
|
if (!m_spellInfo.IsPassive())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1044,7 +1044,7 @@ namespace Game.Spells
|
|||||||
|
|
||||||
// can the player store the new item?
|
// can the player store the new item?
|
||||||
List<ItemPosCount> dest = new();
|
List<ItemPosCount> dest = new();
|
||||||
uint no_space = 0;
|
uint no_space;
|
||||||
InventoryResult msg = player.CanStoreNewItem(ItemConst.NullBag, ItemConst.NullSlot, dest, newitemid, num_to_add, out no_space);
|
InventoryResult msg = player.CanStoreNewItem(ItemConst.NullBag, ItemConst.NullSlot, dest, newitemid, num_to_add, out no_space);
|
||||||
if (msg != InventoryResult.Ok)
|
if (msg != InventoryResult.Ok)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1854,7 +1854,7 @@ namespace Game.Entities
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void LoadPetDefaultSpells()
|
public void LoadPetDefaultSpells()
|
||||||
{
|
{
|
||||||
uint oldMSTime = Time.GetMSTime();
|
uint oldMSTime = Time.GetMSTime();
|
||||||
|
|
||||||
mPetDefaultSpellsMap.Clear();
|
mPetDefaultSpellsMap.Clear();
|
||||||
@@ -1862,7 +1862,6 @@ namespace Game.Entities
|
|||||||
uint countCreature = 0;
|
uint countCreature = 0;
|
||||||
|
|
||||||
Log.outInfo(LogFilter.ServerLoading, "Loading summonable creature templates...");
|
Log.outInfo(LogFilter.ServerLoading, "Loading summonable creature templates...");
|
||||||
oldMSTime = Time.GetMSTime();
|
|
||||||
|
|
||||||
// different summon spells
|
// different summon spells
|
||||||
foreach (var spellEntry in mSpellInfoMap.Values)
|
foreach (var spellEntry in mSpellInfoMap.Values)
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ using Framework.Constants;
|
|||||||
using Framework.Dynamic;
|
using Framework.Dynamic;
|
||||||
using Game.DataStorage;
|
using Game.DataStorage;
|
||||||
using Game.Entities;
|
using Game.Entities;
|
||||||
using Game.Maps;
|
|
||||||
using Game.Networking.Packets;
|
using Game.Networking.Packets;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
|||||||
@@ -401,7 +401,7 @@ namespace Game
|
|||||||
if (locale >= Locale.Total)
|
if (locale >= Locale.Total)
|
||||||
locale = Locale.enUS;
|
locale = Locale.enUS;
|
||||||
|
|
||||||
string baseText = "";
|
string baseText;
|
||||||
BroadcastTextRecord bct = CliDB.BroadcastTextStorage.LookupByKey(creatureTextEntry.BroadcastTextId);
|
BroadcastTextRecord bct = CliDB.BroadcastTextStorage.LookupByKey(creatureTextEntry.BroadcastTextId);
|
||||||
|
|
||||||
if (bct != null)
|
if (bct != null)
|
||||||
@@ -499,50 +499,6 @@ namespace Game
|
|||||||
Dictionary<CreatureTextId, CreatureTextLocale> mLocaleTextMap = new();
|
Dictionary<CreatureTextId, CreatureTextLocale> mLocaleTextMap = new();
|
||||||
}
|
}
|
||||||
|
|
||||||
public class CreatureTextHolder
|
|
||||||
{
|
|
||||||
public CreatureTextHolder(uint entry)
|
|
||||||
{
|
|
||||||
Entry = entry;
|
|
||||||
Groups = new MultiMap<uint, CreatureTextEntry>();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void AddText(uint group, CreatureTextEntry entry)
|
|
||||||
{
|
|
||||||
Groups.Add(group, entry);
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<CreatureTextEntry> GetGroupList(uint group)
|
|
||||||
{
|
|
||||||
return Groups.LookupByKey(group);
|
|
||||||
}
|
|
||||||
|
|
||||||
uint Entry;
|
|
||||||
MultiMap<uint, CreatureTextEntry> Groups;
|
|
||||||
}
|
|
||||||
|
|
||||||
public class CreatureTextRepeatHolder
|
|
||||||
{
|
|
||||||
public CreatureTextRepeatHolder(ulong guid)
|
|
||||||
{
|
|
||||||
Guid = guid;
|
|
||||||
Groups = new MultiMap<byte, byte>();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void AddText(byte group, byte entry)
|
|
||||||
{
|
|
||||||
Groups.Add(group, entry);
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<byte> GetGroupList(byte group)
|
|
||||||
{
|
|
||||||
return Groups.LookupByKey(group);
|
|
||||||
}
|
|
||||||
|
|
||||||
ulong Guid;
|
|
||||||
MultiMap<byte, byte> Groups;
|
|
||||||
}
|
|
||||||
|
|
||||||
public class CreatureTextEntry
|
public class CreatureTextEntry
|
||||||
{
|
{
|
||||||
public uint creatureId;
|
public uint creatureId;
|
||||||
@@ -558,10 +514,12 @@ namespace Game
|
|||||||
public uint BroadcastTextId;
|
public uint BroadcastTextId;
|
||||||
public CreatureTextRange TextRange;
|
public CreatureTextRange TextRange;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class CreatureTextLocale
|
public class CreatureTextLocale
|
||||||
{
|
{
|
||||||
public StringArray Text = new((int)Locale.Total);
|
public StringArray Text = new((int)Locale.Total);
|
||||||
}
|
}
|
||||||
|
|
||||||
public class CreatureTextId
|
public class CreatureTextId
|
||||||
{
|
{
|
||||||
public CreatureTextId(uint e, uint g, uint i)
|
public CreatureTextId(uint e, uint g, uint i)
|
||||||
@@ -571,9 +529,9 @@ namespace Game
|
|||||||
textId = i;
|
textId = i;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint entry;
|
public uint entry;
|
||||||
uint textGroup;
|
public uint textGroup;
|
||||||
uint textId;
|
public uint textId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum CreatureTextRange
|
public enum CreatureTextRange
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ namespace Game
|
|||||||
_maxUpdateTimeOfCurrentTable = 0;
|
_maxUpdateTimeOfCurrentTable = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_updateTimeDataTable[_updateTimeDataTable.Length - 1] != 0)
|
if (_updateTimeDataTable[^1] != 0)
|
||||||
_averageUpdateTime = (uint)(_totalUpdateTime / _updateTimeDataTable.Length);
|
_averageUpdateTime = (uint)(_totalUpdateTime / _updateTimeDataTable.Length);
|
||||||
else if (_updateTimeTableIndex != 0)
|
else if (_updateTimeTableIndex != 0)
|
||||||
_averageUpdateTime = _totalUpdateTime / _updateTimeTableIndex;
|
_averageUpdateTime = _totalUpdateTime / _updateTimeTableIndex;
|
||||||
|
|||||||
@@ -153,7 +153,7 @@ namespace Game
|
|||||||
var hash = sha.ComputeHash(data, 0, (int)length);
|
var hash = sha.ComputeHash(data, 0, (int)length);
|
||||||
uint checkSum = 0;
|
uint checkSum = 0;
|
||||||
for (byte i = 0; i < 5; ++i)
|
for (byte i = 0; i < 5; ++i)
|
||||||
checkSum = checkSum ^ BitConverter.ToUInt32(hash, i * 4);
|
checkSum ^= BitConverter.ToUInt32(hash, i * 4);
|
||||||
|
|
||||||
return checkSum;
|
return checkSum;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ namespace Game
|
|||||||
o1 = sh.ComputeHash(buff, 0, halfSize);
|
o1 = sh.ComputeHash(buff, 0, halfSize);
|
||||||
|
|
||||||
sh = SHA1.Create();
|
sh = SHA1.Create();
|
||||||
o2 = sh.ComputeHash(span.Slice(halfSize).ToArray(), 0, buff.Length - halfSize);
|
o2 = sh.ComputeHash(span[halfSize..].ToArray(), 0, buff.Length - halfSize);
|
||||||
|
|
||||||
FillUp();
|
FillUp();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user