Core: Updated to 10.2.5

Port From (https://github.com/TrinityCore/TrinityCore/commit/a4a4d010a0e329d4dbd82c0be5feab1fc06c8834)
This commit is contained in:
hondacrx
2024-02-06 13:07:17 -05:00
parent 1d13b710f9
commit d1ad9f662e
23 changed files with 1457 additions and 1337 deletions
+11 -6
View File
@@ -2953,8 +2953,13 @@ namespace Game.Entities
SetXP(xp);
StringArray exploredZonesStrings = new(exploredZones, ' ');
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))));
for (int i = 0; i < exploredZonesStrings.Length && i / 2 < PlayerConst.ExploredZonesSize; ++i)
{
if (!ulong.TryParse(exploredZonesStrings[i], out ulong value))
value = 0;
AddExploredZones(i / 2, (value << (32 * (i % 2))));
}
StringArray knownTitlesStrings = new(knownTitles, ' ');
if ((knownTitlesStrings.Length % 2) == 0)
@@ -3742,8 +3747,8 @@ namespace Game.Entities
stmt.AddValue(index++, GetLootSpecId());
ss.Clear();
for (int i = 0; i < PlayerConst.ExploredZonesSize; ++i)
ss.Append($"{(uint)(m_activePlayerData.ExploredZones[i] & 0xFFFFFFFF)} {(uint)((m_activePlayerData.ExploredZones[i] >> 32) & 0xFFFFFFFF)} ");
for (int i = 0; i < m_activePlayerData.DataFlags[(int)PlayerDataFlag.ExploredZonesIndex].Size(); ++i)
ss.Append($"{(uint)(m_activePlayerData.DataFlags[(int)PlayerDataFlag.ExploredZonesIndex][i] & 0xFFFFFFFF)} {(uint)((m_activePlayerData.DataFlags[(int)PlayerDataFlag.ExploredZonesIndex][i] >> 32) & 0xFFFFFFFF)} ");
stmt.AddValue(index++, ss.ToString());
@@ -3877,8 +3882,8 @@ namespace Game.Entities
stmt.AddValue(index++, GetLootSpecId());
ss.Clear();
for (int i = 0; i < PlayerConst.ExploredZonesSize; ++i)
ss.Append($"{(uint)(m_activePlayerData.ExploredZones[i] & 0xFFFFFFFF)} {(uint)((m_activePlayerData.ExploredZones[i] >> 32) & 0xFFFFFFFF)} ");
for (int i = 0; i < m_activePlayerData.DataFlags[(int)PlayerDataFlag.ExploredZonesIndex].Size(); ++i)
ss.Append($"{(uint)(m_activePlayerData.DataFlags[(int)PlayerDataFlag.ExploredZonesIndex][i] & 0xFFFFFFFF)} {(uint)((m_activePlayerData.DataFlags[(int)PlayerDataFlag.ExploredZonesIndex][i] >> 32) & 0xFFFFFFFF)} ");
stmt.AddValue(index++, ss.ToString());
+37 -14
View File
@@ -6301,8 +6301,6 @@ namespace Game.Entities
SendPacket(new ResetWeeklyCurrency());
}
public void AddExploredZones(uint pos, ulong mask) { SetUpdateFieldFlagValue(ref m_values.ModifyValue(m_activePlayerData).ModifyValue(m_activePlayerData.ExploredZones, (int)pos), mask); }
public void RemoveExploredZones(uint pos, ulong mask) { RemoveUpdateFieldFlagValue(ref m_values.ModifyValue(m_activePlayerData).ModifyValue(m_activePlayerData.ExploredZones, (int)pos), mask); }
void CheckAreaExploreAndOutdoor()
{
if (!IsAlive())
@@ -6326,20 +6324,13 @@ namespace Game.Entities
return;
}
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} ).",
areaId, GetPositionX(), GetPositionY(), offset, offset, PlayerConst.ExploredZonesSize);
return;
}
int offset = (areaEntry.AreaBit / PlayerConst.ExploredZonesBits);
ulong val = 1ul << (areaEntry.AreaBit % PlayerConst.ExploredZonesBits);
ulong val = 1ul << (areaEntry.AreaBit % ActivePlayerData.ExploredZonesBits);
ulong currFields = m_activePlayerData.ExploredZones[offset];
if (!Convert.ToBoolean(currFields & val))
if (offset >= m_activePlayerData.DataFlags[(int)PlayerDataFlag.ExploredZonesIndex].Size()
|| (m_activePlayerData.DataFlags[(int)PlayerDataFlag.ExploredZonesIndex][offset] & val) == 0)
{
SetUpdateFieldFlagValue(ref m_values.ModifyValue(m_activePlayerData).ModifyValue(m_activePlayerData.ExploredZones, (int)offset), val);
AddExploredZones(offset, val);
UpdateCriteria(CriteriaType.RevealWorldMapOverlay, GetAreaId());
@@ -6385,6 +6376,38 @@ namespace Game.Entities
}
}
}
public void AddExploredZones(int pos, ulong mask)
{
SetUpdateFieldFlagValue(m_values
.ModifyValue(m_activePlayerData)
.ModifyValue(m_activePlayerData.DataFlags, (int)PlayerDataFlag.ExploredZonesIndex), pos, mask);
}
public void RemoveExploredZones(int pos, ulong mask)
{
RemoveUpdateFieldFlagValue(m_values
.ModifyValue(m_activePlayerData)
.ModifyValue(m_activePlayerData.DataFlags, (int)PlayerDataFlag.ExploredZonesIndex), pos, mask);
}
public bool HasExploredZone(uint areaId)
{
var area = CliDB.AreaTableStorage.LookupByKey(areaId);
if (area == null)
return false;
if (area.AreaBit < 0)
return false;
int playerIndexOffset = area.AreaBit / PlayerConst.ExploredZonesBits;
if (playerIndexOffset >= m_activePlayerData.DataFlags[(int)PlayerDataFlag.ExploredZonesIndex].Size())
return false;
ulong mask = 1ul << (area.AreaBit % PlayerConst.ExploredZonesBits);
return (m_activePlayerData.DataFlags[(int)PlayerDataFlag.ExploredZonesIndex][playerIndexOffset] & mask) != 0;
}
void SendExplorationExperience(uint Area, uint Experience)
{
SendPacket(new ExplorationExperience(Experience, Area));