Core/Auras: Implemented SPELL_AURA_KEYBOUND_OVERRIDE
Port From (https://github.com/TrinityCore/TrinityCore/commit/b37333c1d935abe05c854c41bdf7ac6aff7f2882)
This commit is contained in:
@@ -413,7 +413,7 @@ namespace Framework.Constants
|
||||
OverrideSpellVisual = 403,
|
||||
OverrideAttackPowerBySpPct = 404,
|
||||
ModRatingPct = 405,
|
||||
KeyboundOverride = 406, // NYI
|
||||
KeyboundOverride = 406,
|
||||
ModFear2 = 407,
|
||||
SetActionButtonSpellCount = 408,
|
||||
CanTurnWhileFalling = 409,
|
||||
|
||||
@@ -1190,6 +1190,10 @@ namespace Framework.Database
|
||||
"RtOperandType1, RtOperandType2, RtOperandType3, RtOperandType4, RtOperandType5, RtOperand1, RtOperand2, RtOperand3, RtOperand4, RtOperand5, " +
|
||||
"Logic1, Logic2, Logic3, Logic4, Logic5 FROM spell_item_enchantment_condition WHERE (`VerifiedBuild` > 0) = ?");
|
||||
|
||||
// SpellKeyboundOverride.db2
|
||||
PrepareStatement(HotfixStatements.SEL_SPELL_KEYBOUND_OVERRIDE, "SELECT ID, `Function`, Type, Data, Flags FROM spell_keybound_override" +
|
||||
" WHERE (`VerifiedBuild` > 0) = ?");
|
||||
|
||||
// SpellLabel.db2
|
||||
PrepareStatement(HotfixStatements.SEL_SPELL_LABEL, "SELECT ID, LabelID, SpellID FROM spell_label WHERE (`VerifiedBuild` > 0) = ?");
|
||||
|
||||
@@ -2102,6 +2106,8 @@ namespace Framework.Database
|
||||
|
||||
SEL_SPELL_ITEM_ENCHANTMENT_CONDITION,
|
||||
|
||||
SEL_SPELL_KEYBOUND_OVERRIDE,
|
||||
|
||||
SEL_SPELL_LABEL,
|
||||
|
||||
SEL_SPELL_LEARN_SPELL,
|
||||
|
||||
@@ -289,6 +289,7 @@ namespace Game.DataStorage
|
||||
SpellInterruptsStorage = ReadDB2<SpellInterruptsRecord>("SpellInterrupts.db2", HotfixStatements.SEL_SPELL_INTERRUPTS);
|
||||
SpellItemEnchantmentStorage = ReadDB2<SpellItemEnchantmentRecord>("SpellItemEnchantment.db2", HotfixStatements.SEL_SPELL_ITEM_ENCHANTMENT, HotfixStatements.SEL_SPELL_ITEM_ENCHANTMENT_LOCALE);
|
||||
SpellItemEnchantmentConditionStorage = ReadDB2<SpellItemEnchantmentConditionRecord>("SpellItemEnchantmentCondition.db2", HotfixStatements.SEL_SPELL_ITEM_ENCHANTMENT_CONDITION);
|
||||
SpellKeyboundOverrideStorage = ReadDB2<SpellKeyboundOverrideRecord>("SpellKeyboundOverride.db2", HotfixStatements.SEL_SPELL_KEYBOUND_OVERRIDE);
|
||||
SpellLabelStorage = ReadDB2<SpellLabelRecord>("SpellLabel.db2", HotfixStatements.SEL_SPELL_LABEL);
|
||||
SpellLearnSpellStorage = ReadDB2<SpellLearnSpellRecord>("SpellLearnSpell.db2", HotfixStatements.SEL_SPELL_LEARN_SPELL);
|
||||
SpellLevelsStorage = ReadDB2<SpellLevelsRecord>("SpellLevels.db2", HotfixStatements.SEL_SPELL_LEVELS);
|
||||
@@ -711,6 +712,7 @@ namespace Game.DataStorage
|
||||
public static DB6Storage<SpellInterruptsRecord> SpellInterruptsStorage;
|
||||
public static DB6Storage<SpellItemEnchantmentRecord> SpellItemEnchantmentStorage;
|
||||
public static DB6Storage<SpellItemEnchantmentConditionRecord> SpellItemEnchantmentConditionStorage;
|
||||
public static DB6Storage<SpellKeyboundOverrideRecord> SpellKeyboundOverrideStorage;
|
||||
public static DB6Storage<SpellLabelRecord> SpellLabelStorage;
|
||||
public static DB6Storage<SpellLearnSpellRecord> SpellLearnSpellStorage;
|
||||
public static DB6Storage<SpellLevelsRecord> SpellLevelsStorage;
|
||||
|
||||
@@ -380,6 +380,15 @@ namespace Game.DataStorage
|
||||
public byte[] Logic = new byte[5];
|
||||
}
|
||||
|
||||
public sealed class SpellKeyboundOverrideRecord
|
||||
{
|
||||
public uint Id;
|
||||
public string Function;
|
||||
public sbyte Type;
|
||||
public uint Data;
|
||||
public int Flags;
|
||||
}
|
||||
|
||||
public sealed class SpellLabelRecord
|
||||
{
|
||||
public uint Id;
|
||||
|
||||
@@ -701,5 +701,19 @@ namespace Game
|
||||
{
|
||||
GetPlayer().SendSpellCategoryCooldowns();
|
||||
}
|
||||
|
||||
[WorldPacketHandler(ClientOpcodes.KeyboundOverride, Processing = PacketProcessing.ThreadSafe)]
|
||||
void HandleKeyboundOverride(KeyboundOverride keyboundOverride)
|
||||
{
|
||||
Player player = GetPlayer();
|
||||
if (!player.HasAuraTypeWithMiscvalue(AuraType.KeyboundOverride, keyboundOverride.OverrideID))
|
||||
return;
|
||||
|
||||
SpellKeyboundOverrideRecord spellKeyboundOverride = CliDB.SpellKeyboundOverrideStorage.LookupByKey(keyboundOverride.OverrideID);
|
||||
if (spellKeyboundOverride == null)
|
||||
return;
|
||||
|
||||
player.CastSpell(player, spellKeyboundOverride.Data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1158,6 +1158,18 @@ namespace Game.Networking.Packets
|
||||
IsFavorite = _worldPacket.HasBit();
|
||||
}
|
||||
}
|
||||
|
||||
class KeyboundOverride : ClientPacket
|
||||
{
|
||||
public KeyboundOverride(WorldPacket packet) : base(packet) { }
|
||||
|
||||
public override void Read()
|
||||
{
|
||||
OverrideID = _worldPacket.ReadUInt16();
|
||||
}
|
||||
|
||||
public ushort OverrideID;
|
||||
}
|
||||
|
||||
//Structs
|
||||
public struct SpellLogPowerData
|
||||
|
||||
Reference in New Issue
Block a user