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)
|
||||
MissileSpeedIsDelayInSec = 0x10, // Missile Speed is Delay (in sec)
|
||||
IgnoreTotemRequirementsForCasting = 0x20, // Ignore Totem Requirements for Casting
|
||||
Unk6 = 0x40, // 6
|
||||
ItemCastGrantsSkillGain = 0x40, // Item Cast Grants Skill Gain
|
||||
Unk7 = 0x80, // 7
|
||||
AimedShot = 0x100, // 8
|
||||
NotUsableInArena = 0x200, // 9 Cannot Be Used In Arenas
|
||||
|
||||
@@ -2991,6 +2991,14 @@ namespace Game.Spells
|
||||
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();
|
||||
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
|
||||
player.UpdateCraftSkill(m_spellInfo);
|
||||
if (m_CastItem == null)
|
||||
player.UpdateCraftSkill(m_spellInfo);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1046,7 +1047,8 @@ namespace Game.Spells
|
||||
if (m_spellInfo.IsLootCrafting())
|
||||
{
|
||||
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
|
||||
{
|
||||
@@ -1990,7 +1992,7 @@ namespace Game.Spells
|
||||
else
|
||||
{
|
||||
// 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);
|
||||
|
||||
uint enchant_id = (uint)effectInfo.MiscValue;
|
||||
@@ -3085,7 +3087,8 @@ namespace Game.Spells
|
||||
Player caster = m_caster.ToPlayer();
|
||||
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.FillLoot(itemTarget.GetDisenchantLoot(caster).Id, LootStorage.Disenchant, caster, true);
|
||||
caster.SendLoot(itemTarget.loot);
|
||||
|
||||
Reference in New Issue
Block a user