Core: Updated to 10.2.5
Port From (https://github.com/TrinityCore/TrinityCore/commit/a4a4d010a0e329d4dbd82c0be5feab1fc06c8834)
This commit is contained in:
@@ -196,6 +196,10 @@ namespace Game.Entities
|
||||
if (items != null)
|
||||
stats.QuestItems.AddRange(items);
|
||||
|
||||
var currencies = Global.ObjectMgr.GetCreatureQuestCurrencyList(Entry);
|
||||
if (currencies != null)
|
||||
stats.QuestCurrencies.AddRange(currencies);
|
||||
|
||||
if (locale != Locale.enUS)
|
||||
{
|
||||
CreatureLocale creatureLocale = Global.ObjectMgr.GetCreatureLocale(Entry);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -855,6 +855,12 @@ namespace Game.Entities
|
||||
SetUpdateFieldValue(updateField, (T)(updateField.GetValue() | (dynamic)flag));
|
||||
}
|
||||
|
||||
public void SetUpdateFieldFlagValue<T>(DynamicUpdateField<T> updateField, int index, T flag) where T : new()
|
||||
{
|
||||
//static_assert(std::is_integral < T >::value, "SetUpdateFieldFlagValue must be used with integral types");
|
||||
InsertDynamicUpdateFieldValue(updateField, index, (T)(updateField[index] | (dynamic)flag));
|
||||
}
|
||||
|
||||
public void SetUpdateFieldFlagValue<T>(ref T value, T flag) where T : new()
|
||||
{
|
||||
//static_assert(std::is_integral < T >::value, "SetUpdateFieldFlagValue must be used with integral types");
|
||||
@@ -867,6 +873,12 @@ namespace Game.Entities
|
||||
SetUpdateFieldValue(updateField, (T)(updateField.GetValue() & ~(dynamic)flag));
|
||||
}
|
||||
|
||||
public void RemoveUpdateFieldFlagValue<T>(DynamicUpdateField<T> updateField, int index, T flag) where T : new()
|
||||
{
|
||||
//static_assert(std::is_integral < T >::value, "SetUpdateFieldFlagValue must be used with integral types");
|
||||
InsertDynamicUpdateFieldValue(updateField, index, (T)(updateField[index] & ~(dynamic)flag));
|
||||
}
|
||||
|
||||
public void RemoveUpdateFieldFlagValue<T>(ref T value, T flag) where T : new()
|
||||
{
|
||||
//static_assert(std::is_integral < T >::value, "RemoveUpdateFieldFlagValue must be used with integral types");
|
||||
|
||||
@@ -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());
|
||||
|
||||
|
||||
@@ -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));
|
||||
|
||||
Reference in New Issue
Block a user