Core/Players: Fixed ExploredZones size and PLAYER_EXPLORED_ZONES_SIZE desync
Port From (https://github.com/TrinityCore/TrinityCore/commit/cb99b08b86f8773563276bf16ccc2210003b056b)
This commit is contained in:
@@ -3469,6 +3469,9 @@ namespace Game.Entities
|
||||
|
||||
public class ActivePlayerData : BaseUpdateData<Player>
|
||||
{
|
||||
public static int ExploredZonesSize;
|
||||
public static int ExploredZonesBits;
|
||||
|
||||
public UpdateField<bool> BackpackAutoSortDisabled = new(0, 1);
|
||||
public UpdateField<bool> BankAutoSortDisabled = new(0, 2);
|
||||
public UpdateField<bool> SortBagsRightToLeft = new(0, 3);
|
||||
@@ -3595,7 +3598,11 @@ namespace Game.Entities
|
||||
public UpdateFieldArray<uint> BankBagSlotFlags = new(7, 670, 671);
|
||||
public UpdateFieldArray<ulong> QuestCompleted = new(875, 678, 679);
|
||||
|
||||
public ActivePlayerData() : base(0, TypeId.ActivePlayer, 1554) { }
|
||||
public ActivePlayerData() : base(0, TypeId.ActivePlayer, 1554)
|
||||
{
|
||||
ExploredZonesSize = ExploredZones.GetSize();
|
||||
ExploredZonesBits = sizeof(ulong) * 8;
|
||||
}
|
||||
|
||||
public void WriteCreate(WorldPacket data, UpdateFieldFlag fieldVisibilityFlags, Player owner, Player receiver)
|
||||
{
|
||||
|
||||
@@ -2695,9 +2695,8 @@ namespace Game.Entities
|
||||
SetXP(xp);
|
||||
|
||||
StringArray exploredZonesStrings = new(exploredZones, ' ');
|
||||
if (exploredZonesStrings.Length == PlayerConst.ExploredZonesSize * 2)
|
||||
for (int i = 0; i < exploredZonesStrings.Length; ++i)
|
||||
SetUpdateFieldFlagValue(ref m_values.ModifyValue(m_activePlayerData).ModifyValue(m_activePlayerData.ExploredZones, i / 2), (ulong)((long.Parse(exploredZonesStrings[i])) << (32 * (i % 2))));
|
||||
for (int i = 0; i < exploredZonesStrings.Length && i / 2 < ActivePlayerData.ExploredZonesSize; ++i)
|
||||
SetUpdateFieldFlagValue(ref m_values.ModifyValue(m_activePlayerData).ModifyValue(m_activePlayerData.ExploredZones, i / 2), (ulong)((long.Parse(exploredZonesStrings[i])) << (32 * (i % 2))));
|
||||
|
||||
StringArray knownTitlesStrings = new(knownTitles, ' ');
|
||||
if ((knownTitlesStrings.Length % 2) == 0)
|
||||
|
||||
@@ -5852,7 +5852,7 @@ namespace Game.Entities
|
||||
return;
|
||||
}
|
||||
|
||||
int offset = areaEntry.AreaBit / 64;
|
||||
int offset = areaEntry.AreaBit / ActivePlayerData.ExploredZonesBits;
|
||||
if (offset >= PlayerConst.ExploredZonesSize)
|
||||
{
|
||||
Log.outError(LogFilter.Player, "Wrong area flag {0} in map data for (X: {1} Y: {2}) point to field PLAYER_EXPLORED_ZONES_1 + {3} ( {4} must be < {5} ).",
|
||||
@@ -5860,7 +5860,7 @@ namespace Game.Entities
|
||||
return;
|
||||
}
|
||||
|
||||
ulong val = 1ul << (areaEntry.AreaBit % 64);
|
||||
ulong val = 1ul << (areaEntry.AreaBit % ActivePlayerData.ExploredZonesBits);
|
||||
ulong currFields = m_activePlayerData.ExploredZones[offset];
|
||||
|
||||
if (!Convert.ToBoolean(currFields & val))
|
||||
|
||||
Reference in New Issue
Block a user