Core/Skills: Fixed updating riding skill value when learning riding spells automatically
Port From (https://github.com/TrinityCore/TrinityCore/commit/68b6d81d4c0fdb35391147725a21e5cfc347dedf)
This commit is contained in:
@@ -110,6 +110,11 @@ namespace Game.Entities
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ushort GetSkillStep(SkillType skill)
|
public ushort GetSkillStep(SkillType skill)
|
||||||
|
{
|
||||||
|
return GetSkillStep((uint)skill);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ushort GetSkillStep(uint skill)
|
||||||
{
|
{
|
||||||
if (skill == 0)
|
if (skill == 0)
|
||||||
return 0;
|
return 0;
|
||||||
@@ -2261,17 +2266,51 @@ namespace Game.Entities
|
|||||||
SetSkill(spellLearnSkill.skill, 0, 0, 0);
|
SetSkill(spellLearnSkill.skill, 0, 0, 0);
|
||||||
else // set to prev. skill setting values
|
else // set to prev. skill setting values
|
||||||
{
|
{
|
||||||
uint skill_value = GetPureSkillValue(prevSkill.skill);
|
ushort skill_value = GetPureSkillValue(prevSkill.skill);
|
||||||
uint skill_max_value = GetPureMaxSkillValue(prevSkill.skill);
|
ushort skill_max_value = GetPureMaxSkillValue(prevSkill.skill);
|
||||||
|
|
||||||
if (skill_value > prevSkill.value)
|
ushort new_skill_max_value = prevSkill.maxvalue;
|
||||||
|
|
||||||
|
if (new_skill_max_value == 0)
|
||||||
|
{
|
||||||
|
var rcInfo = Global.DB2Mgr.GetSkillRaceClassInfo((uint)prevSkill.skill, GetRace(), GetClass());
|
||||||
|
if (rcInfo != null)
|
||||||
|
{
|
||||||
|
switch (Global.SpellMgr.GetSkillRangeType(rcInfo))
|
||||||
|
{
|
||||||
|
case SkillRangeType.Language:
|
||||||
|
skill_value = 300;
|
||||||
|
new_skill_max_value = 300;
|
||||||
|
break;
|
||||||
|
case SkillRangeType.Level:
|
||||||
|
new_skill_max_value = GetMaxSkillValueForLevel();
|
||||||
|
break;
|
||||||
|
case SkillRangeType.Mono:
|
||||||
|
new_skill_max_value = 1;
|
||||||
|
break;
|
||||||
|
case SkillRangeType.Rank:
|
||||||
|
{
|
||||||
|
var tier = Global.ObjectMgr.GetSkillTier(rcInfo.SkillTierID);
|
||||||
|
new_skill_max_value = (ushort)tier.Value[prevSkill.step - 1];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (rcInfo.Flags.HasAnyFlag(SkillRaceClassInfoFlags.AlwaysMaxValue))
|
||||||
|
skill_value = new_skill_max_value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (skill_value > prevSkill.value)
|
||||||
skill_value = prevSkill.value;
|
skill_value = prevSkill.value;
|
||||||
|
|
||||||
uint new_skill_max_value = prevSkill.maxvalue == 0 ? GetMaxSkillValueForLevel() : prevSkill.maxvalue;
|
|
||||||
|
|
||||||
if (skill_max_value > new_skill_max_value)
|
if (skill_max_value > new_skill_max_value)
|
||||||
skill_max_value = new_skill_max_value;
|
skill_max_value = new_skill_max_value;
|
||||||
|
|
||||||
|
if (skill_value > new_skill_max_value)
|
||||||
|
skill_value = new_skill_max_value;
|
||||||
|
|
||||||
SetSkill(prevSkill.skill, prevSkill.step, skill_value, skill_max_value);
|
SetSkill(prevSkill.skill, prevSkill.step, skill_value, skill_max_value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2738,7 +2777,39 @@ namespace Game.Entities
|
|||||||
if (skill_value < spellLearnSkill.value)
|
if (skill_value < spellLearnSkill.value)
|
||||||
skill_value = spellLearnSkill.value;
|
skill_value = spellLearnSkill.value;
|
||||||
|
|
||||||
ushort new_skill_max_value = spellLearnSkill.maxvalue == 0 ? GetMaxSkillValueForLevel() : spellLearnSkill.maxvalue;
|
ushort new_skill_max_value = spellLearnSkill.maxvalue;
|
||||||
|
|
||||||
|
if (new_skill_max_value == 0)
|
||||||
|
{
|
||||||
|
var rcInfo = Global.DB2Mgr.GetSkillRaceClassInfo((uint)spellLearnSkill.skill, GetRace(), GetClass());
|
||||||
|
if (rcInfo != null)
|
||||||
|
{
|
||||||
|
switch (Global.SpellMgr.GetSkillRangeType(rcInfo))
|
||||||
|
{
|
||||||
|
case SkillRangeType.Language:
|
||||||
|
skill_value = 300;
|
||||||
|
new_skill_max_value = 300;
|
||||||
|
break;
|
||||||
|
case SkillRangeType.Level:
|
||||||
|
new_skill_max_value = GetMaxSkillValueForLevel();
|
||||||
|
break;
|
||||||
|
case SkillRangeType.Mono:
|
||||||
|
new_skill_max_value = 1;
|
||||||
|
break;
|
||||||
|
case SkillRangeType.Rank:
|
||||||
|
{
|
||||||
|
var tier = Global.ObjectMgr.GetSkillTier(rcInfo.SkillTierID);
|
||||||
|
new_skill_max_value = (ushort)tier.Value[spellLearnSkill.step - 1];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (rcInfo.Flags.HasAnyFlag(SkillRaceClassInfoFlags.AlwaysMaxValue))
|
||||||
|
skill_value = new_skill_max_value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (skill_max_value < new_skill_max_value)
|
if (skill_max_value < new_skill_max_value)
|
||||||
skill_max_value = new_skill_max_value;
|
skill_max_value = new_skill_max_value;
|
||||||
|
|||||||
@@ -1595,9 +1595,9 @@ namespace Game.Spells
|
|||||||
|
|
||||||
TempSummonType summonType = TempSummonType.TimedDespawn;
|
TempSummonType summonType = TempSummonType.TimedDespawn;
|
||||||
if (duration == TimeSpan.Zero)
|
if (duration == TimeSpan.Zero)
|
||||||
summonType = TempSummonType.DeadDespawn;
|
summonType = TempSummonType.DeadDespawn;
|
||||||
else if (duration == TimeSpan.FromMilliseconds(-1))
|
else if (duration == TimeSpan.FromMilliseconds(-1))
|
||||||
summonType = TempSummonType.ManualDespawn;
|
summonType = TempSummonType.ManualDespawn;
|
||||||
|
|
||||||
for (uint count = 0; count < numSummons; ++count)
|
for (uint count = 0; count < numSummons; ++count)
|
||||||
{
|
{
|
||||||
@@ -1943,22 +1943,32 @@ namespace Game.Spells
|
|||||||
if (effectHandleMode != SpellEffectHandleMode.HitTarget)
|
if (effectHandleMode != SpellEffectHandleMode.HitTarget)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!unitTarget.IsTypeId(TypeId.Player))
|
Player playerTarget = unitTarget?.ToPlayer();
|
||||||
|
if (playerTarget == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (damage < 1)
|
if (damage < 1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
uint skillid = (uint)effectInfo.MiscValue;
|
uint skillid = (uint)effectInfo.MiscValue;
|
||||||
SkillRaceClassInfoRecord rcEntry = Global.DB2Mgr.GetSkillRaceClassInfo(skillid, unitTarget.GetRace(), unitTarget.GetClass());
|
if (effectInfo.Effect == SpellEffectName.Skill && playerTarget.GetSkillStep(skillid) >= damage)
|
||||||
|
return;
|
||||||
|
|
||||||
|
SkillRaceClassInfoRecord rcEntry = Global.DB2Mgr.GetSkillRaceClassInfo(skillid, playerTarget.GetRace(), playerTarget.GetClass());
|
||||||
if (rcEntry == null)
|
if (rcEntry == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
SkillTiersEntry tier = Global.ObjectMgr.GetSkillTier(rcEntry.SkillTierID);
|
SkillTiersEntry tier = Global.ObjectMgr.GetSkillTier(rcEntry.SkillTierID);
|
||||||
if (tier == null)
|
if (tier == null)
|
||||||
return;
|
return;
|
||||||
ushort skillval = unitTarget.ToPlayer().GetPureSkillValue((SkillType)skillid);
|
|
||||||
unitTarget.ToPlayer().SetSkill(skillid, (uint)damage, Math.Max(skillval, (ushort)1), tier.Value[damage - 1]);
|
ushort skillval = Math.Max((ushort)1, playerTarget.GetPureSkillValue(skillid));
|
||||||
|
ushort maxSkillVal = (ushort)tier.Value[damage - 1];
|
||||||
|
|
||||||
|
if (rcEntry.Flags.HasAnyFlag(SkillRaceClassInfoFlags.AlwaysMaxValue))
|
||||||
|
skillval = maxSkillVal;
|
||||||
|
|
||||||
|
playerTarget.SetSkill(skillid, (uint)damage, skillval, maxSkillVal);
|
||||||
}
|
}
|
||||||
|
|
||||||
[SpellEffectHandler(SpellEffectName.PlayMovie)]
|
[SpellEffectHandler(SpellEffectName.PlayMovie)]
|
||||||
@@ -4268,7 +4278,32 @@ namespace Game.Spells
|
|||||||
if (effectHandleMode != SpellEffectHandleMode.Hit)
|
if (effectHandleMode != SpellEffectHandleMode.Hit)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Log.outDebug(LogFilter.Spells, "WORLD: SkillEFFECT");
|
Player playerTarget = GetUnitCasterForEffectHandlers()?.ToPlayer();
|
||||||
|
if (playerTarget == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (damage < 1)
|
||||||
|
return;
|
||||||
|
|
||||||
|
uint skillid = (uint)effectInfo.MiscValue;
|
||||||
|
if (effectInfo.Effect == SpellEffectName.Skill && playerTarget.GetSkillStep(skillid) >= damage)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var rcEntry = Global.DB2Mgr.GetSkillRaceClassInfo(skillid, playerTarget.GetRace(), playerTarget.GetClass());
|
||||||
|
if (rcEntry == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var tier = Global.ObjectMgr.GetSkillTier(rcEntry.SkillTierID);
|
||||||
|
if (tier == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
ushort skillval = Math.Max((ushort)1, playerTarget.GetPureSkillValue(skillid));
|
||||||
|
ushort maxSkillVal = (ushort)tier.Value[damage - 1];
|
||||||
|
|
||||||
|
if (rcEntry.Flags.HasAnyFlag(SkillRaceClassInfoFlags.AlwaysMaxValue))
|
||||||
|
skillval = maxSkillVal;
|
||||||
|
|
||||||
|
playerTarget.SetSkill(skillid, (uint)damage, skillval, maxSkillVal);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EffectSpiritHeal()
|
void EffectSpiritHeal()
|
||||||
|
|||||||
@@ -819,11 +819,8 @@ namespace Game.Entities
|
|||||||
case SpellEffectName.Skill:
|
case SpellEffectName.Skill:
|
||||||
dbc_node.skill = (SkillType)spellEffectInfo.MiscValue;
|
dbc_node.skill = (SkillType)spellEffectInfo.MiscValue;
|
||||||
dbc_node.step = (ushort)spellEffectInfo.CalcValue();
|
dbc_node.step = (ushort)spellEffectInfo.CalcValue();
|
||||||
if (dbc_node.skill != SkillType.Riding)
|
dbc_node.value = 0;
|
||||||
dbc_node.value = 1;
|
dbc_node.maxvalue = 0;
|
||||||
else
|
|
||||||
dbc_node.value = (ushort)(dbc_node.step * 75);
|
|
||||||
dbc_node.maxvalue = (ushort)(dbc_node.step * 75);
|
|
||||||
break;
|
break;
|
||||||
case SpellEffectName.DualWield:
|
case SpellEffectName.DualWield:
|
||||||
dbc_node.skill = SkillType.DualWield;
|
dbc_node.skill = SkillType.DualWield;
|
||||||
@@ -3065,7 +3062,7 @@ namespace Game.Entities
|
|||||||
{
|
{
|
||||||
ApplySpellEffectFix(spellInfo, 1, spellEffectInfo =>
|
ApplySpellEffectFix(spellInfo, 1, spellEffectInfo =>
|
||||||
{
|
{
|
||||||
spellEffectInfo.ApplyAuraPeriod = 1 * Time.InMilliseconds;;
|
spellEffectInfo.ApplyAuraPeriod = 1 * Time.InMilliseconds;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -3074,7 +3071,7 @@ namespace Game.Entities
|
|||||||
{
|
{
|
||||||
ApplySpellEffectFix(spellInfo, 1, spellEffectInfo =>
|
ApplySpellEffectFix(spellInfo, 1, spellEffectInfo =>
|
||||||
{
|
{
|
||||||
spellEffectInfo.ApplyAuraPeriod = 5 * Time.InMilliseconds;;
|
spellEffectInfo.ApplyAuraPeriod = 5 * Time.InMilliseconds;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -3083,7 +3080,7 @@ namespace Game.Entities
|
|||||||
{
|
{
|
||||||
ApplySpellEffectFix(spellInfo, 1, spellEffectInfo =>
|
ApplySpellEffectFix(spellInfo, 1, spellEffectInfo =>
|
||||||
{
|
{
|
||||||
spellEffectInfo.ApplyAuraPeriod = 1 * Time.InMilliseconds;;
|
spellEffectInfo.ApplyAuraPeriod = 1 * Time.InMilliseconds;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -3597,8 +3594,8 @@ namespace Game.Entities
|
|||||||
44408 // Trained Rock Falcon/Hawk Hunting
|
44408 // Trained Rock Falcon/Hawk Hunting
|
||||||
}, spellInfo =>
|
}, spellInfo =>
|
||||||
{
|
{
|
||||||
spellInfo.Speed = 0.0f;
|
spellInfo.Speed = 0.0f;
|
||||||
});
|
});
|
||||||
|
|
||||||
// Summon Corpse Scarabs
|
// Summon Corpse Scarabs
|
||||||
ApplySpellFix(new[] { 28864, 29105 }, spellInfo =>
|
ApplySpellFix(new[] { 28864, 29105 }, spellInfo =>
|
||||||
@@ -4091,7 +4088,7 @@ namespace Game.Entities
|
|||||||
ApplySpellEffectFix(spellInfo, 0, spellEffectInfo =>
|
ApplySpellEffectFix(spellInfo, 0, spellEffectInfo =>
|
||||||
{
|
{
|
||||||
spellEffectInfo.TargetARadiusEntry = CliDB.SpellRadiusStorage.LookupByKey(EffectRadiusIndex.Yards10); // 10yd
|
spellEffectInfo.TargetARadiusEntry = CliDB.SpellRadiusStorage.LookupByKey(EffectRadiusIndex.Yards10); // 10yd
|
||||||
spellEffectInfo.MiscValue = 190;
|
spellEffectInfo.MiscValue = 190;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
// ENDOF ICECROWN CITADEL SPELLS
|
// ENDOF ICECROWN CITADEL SPELLS
|
||||||
@@ -4260,7 +4257,7 @@ namespace Game.Entities
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Baron Rivendare (Stratholme) - Unholy Aura
|
// Baron Rivendare (Stratholme) - Unholy Aura
|
||||||
ApplySpellFix(new [] { 17466, 17467 }, spellInfo =>
|
ApplySpellFix(new[] { 17466, 17467 }, spellInfo =>
|
||||||
{
|
{
|
||||||
spellInfo.AttributesEx2 |= SpellAttr2.NoInitialThreat;
|
spellInfo.AttributesEx2 |= SpellAttr2.NoInitialThreat;
|
||||||
});
|
});
|
||||||
@@ -4333,7 +4330,7 @@ namespace Game.Entities
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Earthquake
|
// Earthquake
|
||||||
ApplySpellFix(new [] { 61882 }, spellInfo =>
|
ApplySpellFix(new[] { 61882 }, spellInfo =>
|
||||||
{
|
{
|
||||||
spellInfo.NegativeEffects[2] = true;
|
spellInfo.NegativeEffects[2] = true;
|
||||||
});
|
});
|
||||||
@@ -4391,7 +4388,7 @@ namespace Game.Entities
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Burning Rush
|
// Burning Rush
|
||||||
ApplySpellFix(new[] {111400 }, spellInfo =>
|
ApplySpellFix(new[] { 111400 }, spellInfo =>
|
||||||
{
|
{
|
||||||
spellInfo.AttributesEx4 |= SpellAttr4.AuraIsBuff;
|
spellInfo.AttributesEx4 |= SpellAttr4.AuraIsBuff;
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user