Implementation of QAston proc system
This commit is contained in:
@@ -643,12 +643,12 @@ namespace Scripts.Spells.Druid
|
||||
void HandleProc(AuraEffect aurEff, ProcEventInfo eventInfo)
|
||||
{
|
||||
PreventDefaultAction();
|
||||
SpellInfo spellInfo = eventInfo.GetSpellInfo();
|
||||
if (spellInfo == null)
|
||||
Spell spell = eventInfo.GetProcSpell();
|
||||
if (spell == null)
|
||||
return;
|
||||
|
||||
Unit caster = eventInfo.GetActor();
|
||||
var costs = spellInfo.CalcPowerCost(caster, spellInfo.GetSchoolMask());
|
||||
var costs = spell.GetPowerCost();
|
||||
var m = costs.First(cost => { return cost.Power == PowerType.Mana; });
|
||||
if (m == null)
|
||||
return;
|
||||
|
||||
@@ -2536,30 +2536,51 @@ namespace Scripts.Spells.Generic
|
||||
}
|
||||
}
|
||||
|
||||
[Script]
|
||||
[Script("spell_pvp_trinket_shared_cd", SpellIds.WillOfTheForsakenCooldownTrigger)]
|
||||
[Script("spell_wotf_shared_cd", SpellIds.WillOfTheForsakenCooldownTriggerWotf)]
|
||||
class spell_pvp_trinket_wotf_shared_cd : SpellScript
|
||||
{
|
||||
public override bool Load()
|
||||
public spell_pvp_trinket_wotf_shared_cd(uint triggered)
|
||||
{
|
||||
return GetCaster().IsTypeId(TypeId.Player);
|
||||
_triggered = triggered;
|
||||
}
|
||||
|
||||
public override bool Validate(SpellInfo spellInfo)
|
||||
{
|
||||
return ValidateSpellInfo(SpellIds.WillOfTheForsakenCooldownTrigger, SpellIds.WillOfTheForsakenCooldownTriggerWotf);
|
||||
return ValidateSpellInfo(_triggered);
|
||||
}
|
||||
|
||||
void HandleScript()
|
||||
{
|
||||
// This is only needed because spells cast from spell_linked_spell are triggered by default
|
||||
// Spell.SendSpellCooldown() skips all spells with TRIGGERED_IGNORE_SPELL_AND_CATEGORY_CD
|
||||
GetCaster().GetSpellHistory().StartCooldown(GetSpellInfo(), 0, GetSpell());
|
||||
/*
|
||||
* @workaround: PendingCast flag normally means 'triggered' spell, however
|
||||
* if the spell is cast triggered, the core won't send SMSG_SPELL_GO packet
|
||||
* so client never registers the cooldown (see Spell::IsNeedSendToClient)
|
||||
*
|
||||
* ServerToClient: SMSG_SPELL_GO (0x0132) Length: 42 ConnIdx: 0 Time: 07/19/2010 02:32:35.000 Number: 362675
|
||||
* Caster GUID: Full: Player
|
||||
* Caster Unit GUID: Full: Player
|
||||
* Cast Count: 0
|
||||
* Spell ID: 72752 (72752)
|
||||
* Cast Flags: PendingCast, Unknown3, Unknown7 (265)
|
||||
* Time: 3901468825
|
||||
* Hit Count: 1
|
||||
* [0] Hit GUID: Player
|
||||
* Miss Count: 0
|
||||
* Target Flags: Unit (2)
|
||||
* Target GUID: 0x0
|
||||
*/
|
||||
|
||||
// Spell flags need further research, until then just cast not triggered
|
||||
GetCaster().CastSpell((Unit)null, _triggered, false);
|
||||
}
|
||||
|
||||
public override void Register()
|
||||
{
|
||||
AfterCast.Add(new CastHandler(HandleScript));
|
||||
}
|
||||
|
||||
uint _triggered;
|
||||
}
|
||||
|
||||
[Script]
|
||||
|
||||
@@ -1444,10 +1444,10 @@ namespace Scripts.Spells.Items
|
||||
{
|
||||
bool CheckProc(ProcEventInfo eventInfo)
|
||||
{
|
||||
SpellInfo spellInfo = eventInfo.GetSpellInfo();
|
||||
if (spellInfo != null)
|
||||
Spell spell = eventInfo.GetProcSpell();
|
||||
if (spell != null)
|
||||
{
|
||||
var costs = spellInfo.CalcPowerCost(GetTarget(), spellInfo.GetSchoolMask());
|
||||
var costs = spell.GetPowerCost();
|
||||
var m = costs.FirstOrDefault(cost => { return cost.Power == PowerType.Mana && cost.Amount > 0; });
|
||||
if (m != null)
|
||||
return true;
|
||||
|
||||
@@ -417,14 +417,14 @@ namespace Scripts.Spells.Mage
|
||||
|
||||
bool CheckProc(ProcEventInfo eventInfo)
|
||||
{
|
||||
return eventInfo.GetDamageInfo().GetSpellInfo() != null; // eventInfo.GetSpellInfo()
|
||||
return eventInfo.GetProcSpell() != null;
|
||||
}
|
||||
|
||||
void HandleProc(AuraEffect aurEff, ProcEventInfo eventInfo)
|
||||
{
|
||||
PreventDefaultAction();
|
||||
|
||||
var costs = eventInfo.GetDamageInfo().GetSpellInfo().CalcPowerCost(GetTarget(), eventInfo.GetDamageInfo().GetSchoolMask());
|
||||
var costs = eventInfo.GetProcSpell().GetPowerCost();
|
||||
var m = costs.Find(cost => cost.Power == PowerType.Mana);
|
||||
if (m != null)
|
||||
{
|
||||
|
||||
@@ -442,17 +442,14 @@ namespace Scripts.Spells.Shaman
|
||||
|
||||
bool CheckProc(ProcEventInfo eventInfo)
|
||||
{
|
||||
return eventInfo.GetSpellInfo() != null;
|
||||
return eventInfo.GetProcSpell() != null;
|
||||
}
|
||||
|
||||
void HandleProc(AuraEffect aurEff, ProcEventInfo eventInfo)
|
||||
{
|
||||
PreventDefaultAction();
|
||||
SpellInfo spellInfo = eventInfo.GetSpellInfo();
|
||||
if (spellInfo == null)
|
||||
return;
|
||||
|
||||
var costs = eventInfo.GetDamageInfo().GetSpellInfo().CalcPowerCost(GetTarget(), eventInfo.GetDamageInfo().GetSchoolMask());
|
||||
var costs = eventInfo.GetProcSpell().GetPowerCost();
|
||||
var m = costs.Find(cost => cost.Power == PowerType.Mana);
|
||||
if (m != null)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user