Core/Spells: Implemented SPELL_ATTR9_ITEM_CAST_GRANTS_SKILL_GAIN
Port From (https://github.com/TrinityCore/TrinityCore/commit/00efee9ca12d6e625e9954a39768bbec029d0459)
This commit is contained in:
@@ -1972,7 +1972,7 @@ namespace Framework.Constants
|
|||||||
DoNotLogAuraRefresh = 0x08, // Do Not Log Aura Refresh (client only)
|
DoNotLogAuraRefresh = 0x08, // Do Not Log Aura Refresh (client only)
|
||||||
MissileSpeedIsDelayInSec = 0x10, // Missile Speed is Delay (in sec)
|
MissileSpeedIsDelayInSec = 0x10, // Missile Speed is Delay (in sec)
|
||||||
IgnoreTotemRequirementsForCasting = 0x20, // Ignore Totem Requirements for Casting
|
IgnoreTotemRequirementsForCasting = 0x20, // Ignore Totem Requirements for Casting
|
||||||
Unk6 = 0x40, // 6
|
ItemCastGrantsSkillGain = 0x40, // Item Cast Grants Skill Gain
|
||||||
Unk7 = 0x80, // 7
|
Unk7 = 0x80, // 7
|
||||||
AimedShot = 0x100, // 8
|
AimedShot = 0x100, // 8
|
||||||
NotUsableInArena = 0x200, // 9 Cannot Be Used In Arenas
|
NotUsableInArena = 0x200, // 9 Cannot Be Used In Arenas
|
||||||
|
|||||||
@@ -2991,6 +2991,14 @@ namespace Game.Spells
|
|||||||
player.UpdateCriteria(CriteriaType.CastSpell, m_spellInfo.Id);
|
player.UpdateCriteria(CriteriaType.CastSpell, m_spellInfo.Id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Spells that don't create items can have this attribute - handle here
|
||||||
|
if (m_CastItem && m_spellInfo.HasAttribute(SpellAttr9.ItemCastGrantsSkillGain))
|
||||||
|
{
|
||||||
|
Player playerCaster1 = m_caster.ToPlayer();
|
||||||
|
if (playerCaster1 != null)
|
||||||
|
playerCaster1.UpdateCraftSkill(m_spellInfo);
|
||||||
|
}
|
||||||
|
|
||||||
Item targetItem = m_targets.GetItemTarget();
|
Item targetItem = m_targets.GetItemTarget();
|
||||||
if (!Convert.ToBoolean(_triggeredCastFlags & TriggerCastFlags.IgnorePowerAndReagentCost))
|
if (!Convert.ToBoolean(_triggeredCastFlags & TriggerCastFlags.IgnorePowerAndReagentCost))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1015,7 +1015,8 @@ namespace Game.Spells
|
|||||||
}
|
}
|
||||||
|
|
||||||
// we succeeded in creating at least one item, so a levelup is possible
|
// we succeeded in creating at least one item, so a levelup is possible
|
||||||
player.UpdateCraftSkill(m_spellInfo);
|
if (m_CastItem == null)
|
||||||
|
player.UpdateCraftSkill(m_spellInfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1046,7 +1047,8 @@ namespace Game.Spells
|
|||||||
if (m_spellInfo.IsLootCrafting())
|
if (m_spellInfo.IsLootCrafting())
|
||||||
{
|
{
|
||||||
player.AutoStoreLoot(m_spellInfo.Id, LootStorage.Spell, context, false, true);
|
player.AutoStoreLoot(m_spellInfo.Id, LootStorage.Spell, context, false, true);
|
||||||
player.UpdateCraftSkill(m_spellInfo);
|
if (m_CastItem == null)
|
||||||
|
player.UpdateCraftSkill(m_spellInfo);
|
||||||
}
|
}
|
||||||
else // If there's no random loot entries for this spell, pick the item associated with this spell
|
else // If there's no random loot entries for this spell, pick the item associated with this spell
|
||||||
{
|
{
|
||||||
@@ -1990,7 +1992,7 @@ namespace Game.Spells
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// do not increase skill if vellum used
|
// do not increase skill if vellum used
|
||||||
if (!(m_CastItem != null && m_CastItem.GetTemplate().HasFlag(ItemFlags.NoReagentCost)))
|
if (m_CastItem == null)
|
||||||
player.UpdateCraftSkill(m_spellInfo);
|
player.UpdateCraftSkill(m_spellInfo);
|
||||||
|
|
||||||
uint enchant_id = (uint)effectInfo.MiscValue;
|
uint enchant_id = (uint)effectInfo.MiscValue;
|
||||||
@@ -3085,7 +3087,8 @@ namespace Game.Spells
|
|||||||
Player caster = m_caster.ToPlayer();
|
Player caster = m_caster.ToPlayer();
|
||||||
if (caster != null)
|
if (caster != null)
|
||||||
{
|
{
|
||||||
caster.UpdateCraftSkill(m_spellInfo);
|
if (m_CastItem == null)
|
||||||
|
caster.UpdateCraftSkill(m_spellInfo);
|
||||||
itemTarget.loot = new Loot(caster.GetMap(), itemTarget.GetGUID(), LootType.Disenchanting, null);
|
itemTarget.loot = new Loot(caster.GetMap(), itemTarget.GetGUID(), LootType.Disenchanting, null);
|
||||||
itemTarget.loot.FillLoot(itemTarget.GetDisenchantLoot(caster).Id, LootStorage.Disenchant, caster, true);
|
itemTarget.loot.FillLoot(itemTarget.GetDisenchantLoot(caster).Id, LootStorage.Disenchant, caster, true);
|
||||||
caster.SendLoot(itemTarget.loot);
|
caster.SendLoot(itemTarget.loot);
|
||||||
|
|||||||
Reference in New Issue
Block a user