Fix build and loading crashes

Port From (https://github.com/TrinityCore/TrinityCore/commit/)
This commit is contained in:
hondacrx
2020-12-15 13:20:10 -05:00
parent 3ca0947881
commit f6203e98ee
11 changed files with 26 additions and 21 deletions
+2 -2
View File
@@ -2,7 +2,7 @@
CypherCore is an open source server project for World of Warcraft written in C#. CypherCore is an open source server project for World of Warcraft written in C#.
The current support game version is: 8.3.7.35662 The current support game version is: 9.0.2.36839
### Prerequisites ### Prerequisites
* Visual Studio 2019 with netcore 3.1 [Download](https://www.visualstudio.com/downloads/) * Visual Studio 2019 with netcore 3.1 [Download](https://www.visualstudio.com/downloads/)
@@ -19,7 +19,7 @@ The current support game version is: 8.3.7.35662
* Extract the sql files into the core sql folder (ex: C:\CypherCore\sql) * Extract the sql files into the core sql folder (ex: C:\CypherCore\sql)
### Playing ### Playing
* Must use Arctium WoW Client Launcher [Download](https://arctium.io) (World of Warcraft -> Client Launchers) * Must use Arctium WoW Client Launcher [Download](https://arctium.io) (Downloads -> World of Warcraft -> Client Launcher -> Custom Server)
### Support / General Info ### Support / General Info
* Check out our channel on Arctium Discord [Here](https://discord.gg/Hac3qn6) * Check out our channel on Arctium Discord [Here](https://discord.gg/Hac3qn6)
+1 -1
View File
@@ -261,7 +261,7 @@ namespace Game.Collision
parentMapId = vm.GetParentMapId((uint)parentMapId); parentMapId = vm.GetParentMapId((uint)parentMapId);
} }
return null; return result;
} }
public static LoadResult CanLoadMap(string vmapPath, uint mapID, uint tileX, uint tileY, VMapManager vm) public static LoadResult CanLoadMap(string vmapPath, uint mapID, uint tileX, uint tileY, VMapManager vm)
+1 -1
View File
@@ -51,7 +51,7 @@ namespace Game.DataStorage
} }
AchievementStorage = ReadDB2<AchievementRecord>("Achievement.db2", HotfixStatements.SEL_ACHIEVEMENT, HotfixStatements.SEL_ACHIEVEMENT_LOCALE); AchievementStorage = ReadDB2<AchievementRecord>("Achievement.db2", HotfixStatements.SEL_ACHIEVEMENT, HotfixStatements.SEL_ACHIEVEMENT_LOCALE);
//AnimationDataStorage = ReadDB2<AnimationDataRecord>("AnimationData.db2", HotfixStatements.SEL_ANIMATION_DATA); AnimationDataStorage = ReadDB2<AnimationDataRecord>("AnimationData.db2", HotfixStatements.SEL_ANIMATION_DATA);
AnimKitStorage = ReadDB2<AnimKitRecord>("AnimKit.db2", HotfixStatements.SEL_ANIM_KIT); AnimKitStorage = ReadDB2<AnimKitRecord>("AnimKit.db2", HotfixStatements.SEL_ANIM_KIT);
AreaGroupMemberStorage = ReadDB2<AreaGroupMemberRecord>("AreaGroupMember.db2", HotfixStatements.SEL_AREA_GROUP_MEMBER); AreaGroupMemberStorage = ReadDB2<AreaGroupMemberRecord>("AreaGroupMember.db2", HotfixStatements.SEL_AREA_GROUP_MEMBER);
AreaTableStorage = ReadDB2<AreaTableRecord>("AreaTable.db2", HotfixStatements.SEL_AREA_TABLE, HotfixStatements.SEL_AREA_TABLE_LOCALE); AreaTableStorage = ReadDB2<AreaTableRecord>("AreaTable.db2", HotfixStatements.SEL_AREA_TABLE, HotfixStatements.SEL_AREA_TABLE_LOCALE);
+6 -4
View File
@@ -194,14 +194,16 @@ namespace Game.DataStorage
// link shapeshift displays to race/gender/form // link shapeshift displays to race/gender/form
foreach (var shapeshiftOptionsForModel in shapeshiftFormByModel.LookupByKey(model.Id)) foreach (var shapeshiftOptionsForModel in shapeshiftFormByModel.LookupByKey(model.Id))
{ {
ShapeshiftFormModelData data = _chrCustomizationChoicesForShapeshifts[Tuple.Create((byte)raceModel.ChrRacesID, (byte)model.Sex, shapeshiftOptionsForModel.Item2)]; ShapeshiftFormModelData data = new ShapeshiftFormModelData();
data.OptionID = shapeshiftOptionsForModel.Item2; data.OptionID = shapeshiftOptionsForModel.Item2;
data.Choices = _chrCustomizationChoicesByOption.LookupByKey(shapeshiftOptionsForModel.Item2); data.Choices = _chrCustomizationChoicesByOption.LookupByKey(shapeshiftOptionsForModel.Item2);
if (!data.Choices.Empty()) if (!data.Choices.Empty())
{ {
for (int i = 0; i < data.Choices.Count; ++i) for (int i = 0; i < data.Choices.Count; ++i)
data.Displays[i] = displayInfoByCustomizationChoice.LookupByKey(data.Choices[i].Id); data.Displays.Add(displayInfoByCustomizationChoice.LookupByKey(data.Choices[i].Id));
} }
_chrCustomizationChoicesForShapeshifts[Tuple.Create((byte)raceModel.ChrRacesID, (byte)model.Sex, shapeshiftOptionsForModel.Item2)] = data;
} }
} }
} }
@@ -905,7 +907,7 @@ namespace Game.DataStorage
public List<ChrCustomizationOptionRecord> GetCustomiztionOptions(Race race, Gender gender) public List<ChrCustomizationOptionRecord> GetCustomiztionOptions(Race race, Gender gender)
{ {
return _chrCustomizationOptionsByRaceAndGender.LookupByKey(Tuple.Create(race, gender)); return _chrCustomizationOptionsByRaceAndGender.LookupByKey(Tuple.Create((byte)race, (byte)gender));
} }
public MultiMap<uint, uint> GetRequiredCustomizationChoices(uint chrCustomizationReqId) public MultiMap<uint, uint> GetRequiredCustomizationChoices(uint chrCustomizationReqId)
@@ -915,7 +917,7 @@ namespace Game.DataStorage
public ChrModelRecord GetChrModel(Race race, Gender gender) public ChrModelRecord GetChrModel(Race race, Gender gender)
{ {
return _chrModelsByRaceAndGender.LookupByKey(Tuple.Create(race, gender)); return _chrModelsByRaceAndGender.LookupByKey(Tuple.Create((byte)race, (byte)gender));
} }
public string GetChrRaceName(Race race, Locale locale = Locale.enUS) public string GetChrRaceName(Race race, Locale locale = Locale.enUS)
@@ -2276,7 +2276,7 @@ namespace Game.Entities
} }
} }
public struct ChrCustomizationChoice public struct ChrCustomizationChoice : IComparable<ChrCustomizationChoice>
{ {
public uint ChrCustomizationOptionID; public uint ChrCustomizationOptionID;
public uint ChrCustomizationChoiceID; public uint ChrCustomizationChoiceID;
@@ -2298,6 +2298,11 @@ namespace Game.Entities
data.WriteUInt32(ChrCustomizationOptionID); data.WriteUInt32(ChrCustomizationOptionID);
data.WriteUInt32(ChrCustomizationChoiceID); data.WriteUInt32(ChrCustomizationChoiceID);
} }
public int CompareTo(ChrCustomizationChoice other)
{
return ChrCustomizationOptionID.CompareTo(other.ChrCustomizationOptionID);
}
} }
public class QuestLog : BaseUpdateData<Player> public class QuestLog : BaseUpdateData<Player>
+1 -1
View File
@@ -2506,7 +2506,7 @@ namespace Game.Entities
uint health = result.Read<uint>(fieldIndex++); uint health = result.Read<uint>(fieldIndex++);
uint[] powers = new uint[(int)PowerType.MaxPerClass]; uint[] powers = new uint[(int)PowerType.MaxPerClass];
for (var i = 0; fieldIndex < powers.Length; ++i) for (var i = 0; i < powers.Length; ++i)
powers[i] = result.Read<uint>(fieldIndex++); powers[i] = result.Read<uint>(fieldIndex++);
uint instance_id = result.Read<uint>(fieldIndex++); uint instance_id = result.Read<uint>(fieldIndex++);
+2 -2
View File
@@ -5491,13 +5491,13 @@ namespace Game
float positionZ = result.Read<float>(6); float positionZ = result.Read<float>(6);
float orientation = result.Read<float>(7); float orientation = result.Read<float>(7);
if (CliDB.ChrRacesStorage.ContainsKey(currentrace)) if (!CliDB.ChrRacesStorage.ContainsKey(currentrace))
{ {
Log.outError(LogFilter.Sql, $"Wrong race {currentrace} in `playercreateinfo` table, ignoring."); Log.outError(LogFilter.Sql, $"Wrong race {currentrace} in `playercreateinfo` table, ignoring.");
continue; continue;
} }
if (CliDB.ChrClassesStorage.ContainsKey(currentclass)) if (!CliDB.ChrClassesStorage.ContainsKey(currentclass))
{ {
Log.outError(LogFilter.Sql, $"Wrong class {currentclass} in `playercreateinfo` table, ignoring."); Log.outError(LogFilter.Sql, $"Wrong class {currentclass} in `playercreateinfo` table, ignoring.");
continue; continue;
+3 -5
View File
@@ -68,12 +68,10 @@ namespace Game
{ {
do do
{ {
var customizationsForCharacter = customizations[customizationsResult.Read<ulong>(0)];
ChrCustomizationChoice choice = new ChrCustomizationChoice(); ChrCustomizationChoice choice = new ChrCustomizationChoice();
choice.ChrCustomizationOptionID = customizationsResult.Read<uint>(1); choice.ChrCustomizationOptionID = customizationsResult.Read<uint>(1);
choice.ChrCustomizationChoiceID = customizationsResult.Read<uint>(2); choice.ChrCustomizationChoiceID = customizationsResult.Read<uint>(2);
customizationsForCharacter.Add(choice); customizations.Add(customizationsResult.Read<ulong>(0), choice);
} while (customizationsResult.NextRow()); } while (customizationsResult.NextRow());
} }
@@ -87,7 +85,7 @@ namespace Game
var customizationsForChar = customizations.LookupByKey(charInfo.Guid.GetCounter()); var customizationsForChar = customizations.LookupByKey(charInfo.Guid.GetCounter());
if (!customizationsForChar.Empty()) if (!customizationsForChar.Empty())
charInfo.Customizations = (Array<ChrCustomizationChoice>)customizationsForChar.ToList(); charInfo.Customizations = new Array<ChrCustomizationChoice>(customizationsForChar.ToArray());
Log.outInfo(LogFilter.Network, "Loading Character {0} from account {1}.", charInfo.Guid.ToString(), GetAccountId()); Log.outInfo(LogFilter.Network, "Loading Character {0} from account {1}.", charInfo.Guid.ToString(), GetAccountId());
@@ -194,7 +192,7 @@ namespace Game
if (checkRequiredDependentChoices) if (checkRequiredDependentChoices)
{ {
var requiredChoices = Global.DB2Mgr.GetRequiredCustomizationChoices(req.Id); var requiredChoices = Global.DB2Mgr.GetRequiredCustomizationChoices(req.Id);
if (!requiredChoices.Empty()) if (requiredChoices != null)
{ {
foreach (var key in requiredChoices.Keys) foreach (var key in requiredChoices.Keys)
{ {
@@ -1784,7 +1784,7 @@ namespace Game.Networking.Packets
data.WritePackedGuid(OriginalCastID); data.WritePackedGuid(OriginalCastID);
data.WriteInt32(SpellID); data.WriteInt32(SpellID);
Visual.Read(data); Visual.Write(data);
data.WriteUInt32((uint)CastFlags); data.WriteUInt32((uint)CastFlags);
data.WriteUInt32((uint)CastFlagsEx); data.WriteUInt32((uint)CastFlagsEx);
+2 -2
View File
@@ -196,7 +196,7 @@ namespace Game.Networking
if (_headerBuffer.GetRemainingSpace() > 0) if (_headerBuffer.GetRemainingSpace() > 0)
{ {
// need to receive the header // need to receive the header
int readHeaderSize = Math.Min(args.BytesTransferred, _headerBuffer.GetRemainingSpace()); int readHeaderSize = Math.Min(args.BytesTransferred - currentReadIndex, _headerBuffer.GetRemainingSpace());
_headerBuffer.Write(args.Buffer, currentReadIndex, readHeaderSize); _headerBuffer.Write(args.Buffer, currentReadIndex, readHeaderSize);
currentReadIndex += readHeaderSize; currentReadIndex += readHeaderSize;
@@ -215,7 +215,7 @@ namespace Game.Networking
if (_packetBuffer.GetRemainingSpace() > 0) if (_packetBuffer.GetRemainingSpace() > 0)
{ {
// need more data in the payload // need more data in the payload
int readDataSize = Math.Min(args.BytesTransferred, _packetBuffer.GetRemainingSpace()); int readDataSize = Math.Min(args.BytesTransferred - currentReadIndex, _packetBuffer.GetRemainingSpace());
_packetBuffer.Write(args.Buffer, currentReadIndex, readDataSize); _packetBuffer.Write(args.Buffer, currentReadIndex, readDataSize);
currentReadIndex += readDataSize; currentReadIndex += readDataSize;
+1 -1
View File
@@ -214,7 +214,7 @@ namespace Game.Scenarios
} while (result.NextRow()); } while (result.NextRow());
Log.outInfo(LogFilter.ServerLoading, "Loaded {count} scenario POI definitions in {Time.GetMSTimeDiffToNow(oldMSTime)} ms"); Log.outInfo(LogFilter.ServerLoading, $"Loaded {count} scenario POI definitions in {Time.GetMSTimeDiffToNow(oldMSTime)} ms");
} }
public List<ScenarioPOI> GetScenarioPOIs(uint CriteriaTreeID) public List<ScenarioPOI> GetScenarioPOIs(uint CriteriaTreeID)