Core/SmartScripts: implement SMART_ACTION_PLAY_SPELL_VISUAL_KIT
Port From (https://github.com/TrinityCore/TrinityCore/commit/7d999b70a1640b5dbe3042f59463814f13cdc834)
This commit is contained in:
@@ -363,7 +363,8 @@ namespace Framework.Constants
|
|||||||
// 131 - 134 : 3.3.5 reserved
|
// 131 - 134 : 3.3.5 reserved
|
||||||
PlayCinematic = 135, // reserved for future uses
|
PlayCinematic = 135, // reserved for future uses
|
||||||
SetMovementSpeed = 136, // movementType, speedInteger, speedFraction
|
SetMovementSpeed = 136, // movementType, speedInteger, speedFraction
|
||||||
End = 131
|
PlaySpellVisualKit = 137, // spellVisualKitId, kitType (unknown values, copypaste from packet dumps), duration
|
||||||
|
End = 138
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum SmartTargets
|
public enum SmartTargets
|
||||||
|
|||||||
@@ -963,6 +963,10 @@ namespace Framework.Database
|
|||||||
PrepareStatement(HotfixStatements.SEL_SPELL_TOTEMS, "SELECT ID, SpellID, RequiredTotemCategoryID1, RequiredTotemCategoryID2, Totem1, Totem2" +
|
PrepareStatement(HotfixStatements.SEL_SPELL_TOTEMS, "SELECT ID, SpellID, RequiredTotemCategoryID1, RequiredTotemCategoryID2, Totem1, Totem2" +
|
||||||
" FROM spell_totems ORDER BY ID DESC");
|
" FROM spell_totems ORDER BY ID DESC");
|
||||||
|
|
||||||
|
// SpellVisualKit.db2
|
||||||
|
PrepareStatement(HotfixStatements.SEL_SPELL_VISUAL_KIT, "SELECT ID, Flags, FallbackPriority, FallbackSpellVisualKitId, DelayMin, DelayMax" +
|
||||||
|
" FROM spell_visual_kit ORDER BY ID DESC");
|
||||||
|
|
||||||
// SpellXSpellVisual.db2
|
// SpellXSpellVisual.db2
|
||||||
PrepareStatement(HotfixStatements.SEL_SPELL_X_SPELL_VISUAL, "SELECT ID, DifficultyID, SpellVisualID, Probability, Flags, Priority, SpellIconFileID, " +
|
PrepareStatement(HotfixStatements.SEL_SPELL_X_SPELL_VISUAL, "SELECT ID, DifficultyID, SpellVisualID, Probability, Flags, Priority, SpellIconFileID, " +
|
||||||
"ActiveIconFileID, ViewerUnitConditionID, ViewerPlayerConditionID, CasterUnitConditionID, CasterPlayerConditionID, SpellID" +
|
"ActiveIconFileID, ViewerUnitConditionID, ViewerPlayerConditionID, CasterUnitConditionID, CasterPlayerConditionID, SpellID" +
|
||||||
@@ -1569,6 +1573,8 @@ namespace Framework.Database
|
|||||||
|
|
||||||
SEL_SPELL_TOTEMS,
|
SEL_SPELL_TOTEMS,
|
||||||
|
|
||||||
|
SEL_SPELL_VISUAL_KIT,
|
||||||
|
|
||||||
SEL_SPELL_X_SPELL_VISUAL,
|
SEL_SPELL_X_SPELL_VISUAL,
|
||||||
|
|
||||||
SEL_SUMMON_PROPERTIES,
|
SEL_SUMMON_PROPERTIES,
|
||||||
|
|||||||
@@ -430,6 +430,16 @@ namespace Game.AI
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool IsSpellVisualKitValid(SmartScriptHolder e, uint entry)
|
||||||
|
{
|
||||||
|
if (!CliDB.SpellVisualKitStorage.ContainsKey(entry))
|
||||||
|
{
|
||||||
|
Log.outError(LogFilter.Sql, $"SmartAIMgr: Entry {e.entryOrGuid} SourceType {e.GetScriptType()} Event {e.event_id} Action {e.GetActionType()} uses non-existent SpellVisualKit entry {entry}, skipped.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
bool IsEventValid(SmartScriptHolder e)
|
bool IsEventValid(SmartScriptHolder e)
|
||||||
{
|
{
|
||||||
if (e.Event.type >= SmartEvents.End)
|
if (e.Event.type >= SmartEvents.End)
|
||||||
@@ -862,6 +872,10 @@ namespace Game.AI
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case SmartActions.PlaySpellVisualKit:
|
||||||
|
if (e.Action.spellVisualKit.spellVisualKitId != 0 && !IsSpellVisualKitValid(e, e.Action.spellVisualKit.spellVisualKitId))
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
case SmartActions.FailQuest:
|
case SmartActions.FailQuest:
|
||||||
case SmartActions.OfferQuest:
|
case SmartActions.OfferQuest:
|
||||||
if (e.Action.quest.questId == 0 || !IsQuestValid(e, e.Action.quest.questId))
|
if (e.Action.quest.questId == 0 || !IsQuestValid(e, e.Action.quest.questId))
|
||||||
@@ -2344,6 +2358,9 @@ namespace Game.AI
|
|||||||
[FieldOffset(4)]
|
[FieldOffset(4)]
|
||||||
public MovementSpeed movementSpeed;
|
public MovementSpeed movementSpeed;
|
||||||
|
|
||||||
|
[FieldOffset(4)]
|
||||||
|
public SpellVisualKit spellVisualKit;
|
||||||
|
|
||||||
[FieldOffset(4)]
|
[FieldOffset(4)]
|
||||||
public Raw raw;
|
public Raw raw;
|
||||||
|
|
||||||
@@ -2841,6 +2858,12 @@ namespace Game.AI
|
|||||||
public uint speedInteger;
|
public uint speedInteger;
|
||||||
public uint speedFraction;
|
public uint speedFraction;
|
||||||
}
|
}
|
||||||
|
public struct SpellVisualKit
|
||||||
|
{
|
||||||
|
public uint spellVisualKitId;
|
||||||
|
public uint kitType;
|
||||||
|
public uint duration;
|
||||||
|
}
|
||||||
public struct Raw
|
public struct Raw
|
||||||
{
|
{
|
||||||
public uint param1;
|
public uint param1;
|
||||||
|
|||||||
@@ -2640,6 +2640,23 @@ namespace Game.AI
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case SmartActions.PlaySpellVisualKit:
|
||||||
|
{
|
||||||
|
var targets = GetTargets(e, unit);
|
||||||
|
if (targets.Empty())
|
||||||
|
break;
|
||||||
|
|
||||||
|
foreach (var obj in targets)
|
||||||
|
{
|
||||||
|
if (IsUnit(obj))
|
||||||
|
{
|
||||||
|
obj.ToUnit().SendPlaySpellVisualKit(e.Action.spellVisualKit.spellVisualKitId, e.Action.spellVisualKit.kitType, e.Action.spellVisualKit.duration);
|
||||||
|
|
||||||
|
Log.outDebug(LogFilter.ScriptsAi, $"SmartScript.ProcessAction:: SMART_ACTION_PLAY_SPELL_VISUAL_KIT: target: {obj.GetName()} ({obj.GetGUID().ToString()}), SpellVisualKit: {e.Action.spellVisualKit.spellVisualKitId}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
Log.outError(LogFilter.Sql, "SmartScript.ProcessAction: Entry {0} SourceType {1}, Event {2}, Unhandled Action type {3}", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
|
Log.outError(LogFilter.Sql, "SmartScript.ProcessAction: Entry {0} SourceType {1}, Event {2}, Unhandled Action type {3}", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -248,6 +248,7 @@ namespace Game.DataStorage
|
|||||||
SpellShapeshiftFormStorage = DBReader.Read<SpellShapeshiftFormRecord>("SpellShapeshiftForm.db2", HotfixStatements.SEL_SPELL_SHAPESHIFT_FORM, HotfixStatements.SEL_SPELL_SHAPESHIFT_FORM_LOCALE);
|
SpellShapeshiftFormStorage = DBReader.Read<SpellShapeshiftFormRecord>("SpellShapeshiftForm.db2", HotfixStatements.SEL_SPELL_SHAPESHIFT_FORM, HotfixStatements.SEL_SPELL_SHAPESHIFT_FORM_LOCALE);
|
||||||
SpellTargetRestrictionsStorage = DBReader.Read<SpellTargetRestrictionsRecord>("SpellTargetRestrictions.db2", HotfixStatements.SEL_SPELL_TARGET_RESTRICTIONS);
|
SpellTargetRestrictionsStorage = DBReader.Read<SpellTargetRestrictionsRecord>("SpellTargetRestrictions.db2", HotfixStatements.SEL_SPELL_TARGET_RESTRICTIONS);
|
||||||
SpellTotemsStorage = DBReader.Read<SpellTotemsRecord>("SpellTotems.db2", HotfixStatements.SEL_SPELL_TOTEMS);
|
SpellTotemsStorage = DBReader.Read<SpellTotemsRecord>("SpellTotems.db2", HotfixStatements.SEL_SPELL_TOTEMS);
|
||||||
|
SpellVisualKitStorage = DBReader.Read<SpellVisualKitRecord>("SpellVisualKit.db2", HotfixStatements.SEL_SPELL_VISUAL_KIT);
|
||||||
SpellXSpellVisualStorage = DBReader.Read<SpellXSpellVisualRecord>("SpellXSpellVisual.db2", HotfixStatements.SEL_SPELL_X_SPELL_VISUAL);
|
SpellXSpellVisualStorage = DBReader.Read<SpellXSpellVisualRecord>("SpellXSpellVisual.db2", HotfixStatements.SEL_SPELL_X_SPELL_VISUAL);
|
||||||
SummonPropertiesStorage = DBReader.Read<SummonPropertiesRecord>("SummonProperties.db2", HotfixStatements.SEL_SUMMON_PROPERTIES);
|
SummonPropertiesStorage = DBReader.Read<SummonPropertiesRecord>("SummonProperties.db2", HotfixStatements.SEL_SUMMON_PROPERTIES);
|
||||||
//TactKeyStorage = DBReader.Read<TactKeyRecord>("TactKey.db2", HotfixStatements.SEL_TACT_KEY);
|
//TactKeyStorage = DBReader.Read<TactKeyRecord>("TactKey.db2", HotfixStatements.SEL_TACT_KEY);
|
||||||
@@ -593,6 +594,7 @@ namespace Game.DataStorage
|
|||||||
public static DB6Storage<SpellShapeshiftFormRecord> SpellShapeshiftFormStorage;
|
public static DB6Storage<SpellShapeshiftFormRecord> SpellShapeshiftFormStorage;
|
||||||
public static DB6Storage<SpellTargetRestrictionsRecord> SpellTargetRestrictionsStorage;
|
public static DB6Storage<SpellTargetRestrictionsRecord> SpellTargetRestrictionsStorage;
|
||||||
public static DB6Storage<SpellTotemsRecord> SpellTotemsStorage;
|
public static DB6Storage<SpellTotemsRecord> SpellTotemsStorage;
|
||||||
|
public static DB6Storage<SpellVisualKitRecord> SpellVisualKitStorage;
|
||||||
public static DB6Storage<SpellXSpellVisualRecord> SpellXSpellVisualStorage;
|
public static DB6Storage<SpellXSpellVisualRecord> SpellXSpellVisualStorage;
|
||||||
public static DB6Storage<SummonPropertiesRecord> SummonPropertiesStorage;
|
public static DB6Storage<SummonPropertiesRecord> SummonPropertiesStorage;
|
||||||
//public static DB6Storage<TactKeyRecord> TactKeyStorage;
|
//public static DB6Storage<TactKeyRecord> TactKeyStorage;
|
||||||
|
|||||||
@@ -527,6 +527,16 @@ namespace Game.DataStorage
|
|||||||
public uint[] Totem = new uint[SpellConst.MaxTotems];
|
public uint[] Totem = new uint[SpellConst.MaxTotems];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public sealed class SpellVisualKitRecord
|
||||||
|
{
|
||||||
|
public uint Id;
|
||||||
|
public int Flags;
|
||||||
|
public sbyte FallbackPriority;
|
||||||
|
public uint FallbackSpellVisualKitId;
|
||||||
|
public ushort DelayMin;
|
||||||
|
public ushort DelayMax;
|
||||||
|
}
|
||||||
|
|
||||||
public sealed class SpellXSpellVisualRecord
|
public sealed class SpellXSpellVisualRecord
|
||||||
{
|
{
|
||||||
public uint Id;
|
public uint Id;
|
||||||
|
|||||||
Reference in New Issue
Block a user