Core/Conditions: Added conditions for automatic learning spells with SkillLineAbility::AcquireMethod = 4

Port From (https://github.com/TrinityCore/TrinityCore/commit/7eaa695581589e8cb9a277f9c13ad0e3daf669a7)
This commit is contained in:
Hondacrx
2025-08-11 19:42:29 -04:00
parent 5096795793
commit ceb78e5914
8 changed files with 126 additions and 39 deletions
@@ -0,0 +1,52 @@
// Copyright (c) CypherCore <http://github.com/CypherCore> All rights reserved.
// Licensed under the GNU GENERAL PUBLIC LICENSE. See LICENSE file in the project root for full license information.
using System;
using System.Collections.Generic;
namespace Game.DataStorage
{
class DB2HotfixGenerator<T> where T : new()
{
DB6Storage<T> _storage;
uint _count;
public DB2HotfixGenerator(DB6Storage<T> storage)
{
_storage = storage;
}
public void ApplyHotfix(uint id, Action<T> fixer, bool notifyClient = false) { ApplyHotfix([id, 1], fixer, notifyClient); }
public uint GetAppliedHotfixesCount() { return _count; }
void ApplyHotfix(Span<uint> ids, Action<T> fixer, bool notifyClient)
{
foreach (uint id in ids)
{
T entry = _storage.LookupByKey(id);
if (entry == null)
{
LogMissingRecord(_storage.GetName(), id);
continue;
}
fixer(entry);
++_count;
if (notifyClient)
AddClientHotfix(_storage.GetTableHash(), id);
}
}
void LogMissingRecord(string storageName, uint recordId)
{
Log.outError(LogFilter.Server, $"Hotfix specified for {storageName} row id {recordId} which does not exist");
}
void AddClientHotfix(uint tableHash, uint recordId)
{
Global.DB2Mgr.InsertNewHotfix(tableHash, recordId);
}
}
}
+17
View File
@@ -801,6 +801,7 @@ namespace Game.DataStorage
push.Records.Add(hotfixRecord);
push.AvailableLocalesMask |= hotfixRecord.AvailableLocalesMask;
_maxHotfixId = Math.Max(_maxHotfixId, id);
deletedRecords[(tableHash, recordId)] = status == HotfixRecord.Status.RecordRemoved;
++count;
@@ -960,6 +961,20 @@ namespace Game.DataStorage
return AnimationDataStorage.GetNumRows();
}
public void InsertNewHotfix(uint tableHash, uint recordId)
{
HotfixRecord hotfixRecord = new();
hotfixRecord.TableHash = tableHash;
hotfixRecord.RecordID = (int)recordId;
hotfixRecord.ID.PushID = (int)++_maxHotfixId;
hotfixRecord.ID.UniqueID = RandomHelper.Rand32();
hotfixRecord.AvailableLocalesMask = 0xDFF;
HotfixPush push = _hotfixData[hotfixRecord.ID.PushID];
push.Records.Add(hotfixRecord);
push.AvailableLocalesMask |= hotfixRecord.AvailableLocalesMask;
}
public List<uint> GetAreasForGroup(uint areaGroupId)
{
return _areaGroupMembers.LookupByKey(areaGroupId);
@@ -2479,6 +2494,8 @@ namespace Game.DataStorage
public static byte[] HordeTaxiNodesMask;
public static byte[] AllianceTaxiNodesMask;
public static Dictionary<uint, TaxiPathNodeRecord[]> TaxiPathNodesByPath = new();
int _maxHotfixId;
}
class UiMapBounds