Core/Skinning: Update correct skinning skill according to creature expansion
Port From (https://github.com/TrinityCore/TrinityCore/commit/229a7ac79d38b9db76387f92e846c04c151ad3aa)
This commit is contained in:
@@ -1305,20 +1305,25 @@ namespace Game.Entities
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool UpdateGatherSkill(uint SkillId, uint SkillValue, uint RedLevel, uint Multiplicator = 1, WorldObject obj = null)
|
||||
public bool UpdateGatherSkill(uint skillId, uint skillValue, uint redLevel, uint multiplicator = 1, WorldObject obj = null)
|
||||
{
|
||||
return UpdateGatherSkill((SkillType)SkillId, SkillValue, RedLevel, Multiplicator, obj);
|
||||
return UpdateGatherSkill((SkillType)skillId, skillValue, redLevel, multiplicator, obj);
|
||||
}
|
||||
|
||||
public bool UpdateGatherSkill(SkillType SkillId, uint SkillValue, uint RedLevel, uint Multiplicator = 1, WorldObject obj = null)
|
||||
public bool UpdateGatherSkill(SkillType skillId, uint skillValue, uint redLevel, uint multiplicator = 1, WorldObject obj = null)
|
||||
{
|
||||
Log.outDebug(LogFilter.Player, "UpdateGatherSkill(SkillId {0} SkillLevel {1} RedLevel {2})", SkillId, SkillValue, RedLevel);
|
||||
Log.outDebug(LogFilter.Player, $"UpdateGatherSkill(SkillId {skillId} SkillLevel {skillValue} RedLevel {redLevel})");
|
||||
|
||||
uint gathering_skill_gain = WorldConfig.GetUIntValue(WorldCfg.SkillGainGathering);
|
||||
SkillLineRecord skillEntry = CliDB.SkillLineStorage.LookupByKey(skillId);
|
||||
if (skillEntry == null)
|
||||
return false;
|
||||
|
||||
uint grayLevel = RedLevel + 100;
|
||||
uint greenLevel = RedLevel + 50;
|
||||
uint yellowLevel = RedLevel + 25;
|
||||
uint gatheringSkillGain = WorldConfig.GetUIntValue(WorldCfg.SkillGainGathering);
|
||||
|
||||
uint baseSkillLevelStep = 30;
|
||||
uint yellowLevel = redLevel + baseSkillLevelStep;
|
||||
uint greenLevel = yellowLevel + baseSkillLevelStep;
|
||||
uint grayLevel = greenLevel + baseSkillLevelStep;
|
||||
|
||||
GameObject go = obj?.ToGameObject();
|
||||
if (go != null)
|
||||
@@ -1333,46 +1338,20 @@ namespace Game.Entities
|
||||
}
|
||||
|
||||
// For skinning and Mining chance decrease with level. 1-74 - no decrease, 75-149 - 2 times, 225-299 - 8 times
|
||||
switch (SkillId)
|
||||
switch ((SkillType)skillEntry.ParentSkillLineID)
|
||||
{
|
||||
case SkillType.Herbalism:
|
||||
case SkillType.ClassicHerbalism:
|
||||
case SkillType.OutlandHerbalism:
|
||||
case SkillType.NorthrendHerbalism:
|
||||
case SkillType.CataclysmHerbalism:
|
||||
case SkillType.PandariaHerbalism:
|
||||
case SkillType.DraenorHerbalism:
|
||||
case SkillType.LegionHerbalism:
|
||||
case SkillType.KulTiranHerbalism:
|
||||
case SkillType.Jewelcrafting:
|
||||
case SkillType.Inscription:
|
||||
return UpdateSkillPro(SkillId, SkillGainChance(SkillValue, grayLevel, greenLevel, yellowLevel) * (int)Multiplicator, gathering_skill_gain);
|
||||
return UpdateSkillPro(skillId, SkillGainChance(skillValue, grayLevel, greenLevel, yellowLevel) * (int)multiplicator, gatheringSkillGain);
|
||||
case SkillType.Skinning:
|
||||
case SkillType.ClassicSkinning:
|
||||
case SkillType.OutlandSkinning:
|
||||
case SkillType.NorthrendSkinning:
|
||||
case SkillType.CataclysmSkinning:
|
||||
case SkillType.PandariaSkinning:
|
||||
case SkillType.DraenorSkinning:
|
||||
case SkillType.LegionSkinning:
|
||||
case SkillType.KulTiranSkinning:
|
||||
if (WorldConfig.GetIntValue(WorldCfg.SkillChanceSkinningSteps) == 0)
|
||||
return UpdateSkillPro(SkillId, SkillGainChance(SkillValue, grayLevel, greenLevel, yellowLevel) * (int)Multiplicator, gathering_skill_gain);
|
||||
return UpdateSkillPro(skillId, SkillGainChance(skillValue, grayLevel, greenLevel, yellowLevel) * (int)multiplicator, gatheringSkillGain);
|
||||
else
|
||||
return UpdateSkillPro(SkillId, (int)(SkillGainChance(SkillValue, grayLevel, greenLevel, yellowLevel) * Multiplicator) >> (int)(SkillValue / WorldConfig.GetIntValue(WorldCfg.SkillChanceSkinningSteps)), gathering_skill_gain);
|
||||
return UpdateSkillPro(skillId, (int)(SkillGainChance(skillValue, grayLevel, greenLevel, yellowLevel) * multiplicator) >> (int)(skillValue / WorldConfig.GetIntValue(WorldCfg.SkillChanceSkinningSteps)), gatheringSkillGain);
|
||||
case SkillType.Mining:
|
||||
case SkillType.ClassicMining:
|
||||
case SkillType.OutlandMining:
|
||||
case SkillType.NorthrendMining:
|
||||
case SkillType.CataclysmMining:
|
||||
case SkillType.PandariaMining:
|
||||
case SkillType.DraenorMining:
|
||||
case SkillType.LegionMining:
|
||||
case SkillType.KulTiranMining:
|
||||
if (WorldConfig.GetIntValue(WorldCfg.SkillChanceMiningSteps) == 0)
|
||||
return UpdateSkillPro(SkillId, SkillGainChance(SkillValue, grayLevel, greenLevel, yellowLevel) * (int)Multiplicator, gathering_skill_gain);
|
||||
return UpdateSkillPro(skillId, SkillGainChance(skillValue, grayLevel, greenLevel, yellowLevel) * (int)multiplicator, gatheringSkillGain);
|
||||
else
|
||||
return UpdateSkillPro(SkillId, (int)(SkillGainChance(SkillValue, grayLevel, greenLevel, yellowLevel) * Multiplicator) >> (int)(SkillValue / WorldConfig.GetIntValue(WorldCfg.SkillChanceMiningSteps)), gathering_skill_gain);
|
||||
return UpdateSkillPro(skillId, (int)(SkillGainChance(skillValue, grayLevel, greenLevel, yellowLevel) * multiplicator) >> (int)(skillValue / WorldConfig.GetIntValue(WorldCfg.SkillChanceMiningSteps)), gatheringSkillGain);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -563,7 +563,7 @@ namespace Game.Entities
|
||||
vehicleRoot = vehicleRoot.GetVehicleBase();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public Creature GetVehicleCreatureBase()
|
||||
{
|
||||
Unit veh = GetVehicleBase();
|
||||
@@ -891,7 +891,7 @@ namespace Game.Entities
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
|
||||
public Guardian GetGuardianPet()
|
||||
{
|
||||
ObjectGuid pet_guid = GetPetGUID();
|
||||
@@ -1315,12 +1315,12 @@ namespace Game.Entities
|
||||
else
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public bool IsPossessedByPlayer()
|
||||
{
|
||||
return HasUnitState(UnitState.Possessed) && GetCharmerGUID().IsPlayer();
|
||||
}
|
||||
|
||||
|
||||
public bool IsPossessing()
|
||||
{
|
||||
Unit u = GetCharmed();
|
||||
@@ -1857,7 +1857,7 @@ namespace Game.Entities
|
||||
public Gender GetGender() { return (Gender)(byte)m_unitData.Sex; }
|
||||
public void SetGender(Gender sex) { SetUpdateFieldValue(m_values.ModifyValue(m_unitData).ModifyValue(m_unitData.Sex), (byte)sex); }
|
||||
|
||||
public virtual Gender GetNativeGender() { return GetGender(); }
|
||||
public virtual Gender GetNativeGender() { return GetGender(); }
|
||||
public virtual void SetNativeGender(Gender gender) { SetGender(gender); }
|
||||
|
||||
public void RecalculateObjectScale()
|
||||
@@ -1869,7 +1869,7 @@ namespace Game.Entities
|
||||
}
|
||||
|
||||
public virtual float GetNativeObjectScale() { return 1.0f; }
|
||||
|
||||
|
||||
public uint GetDisplayId() { return m_unitData.DisplayID; }
|
||||
|
||||
public virtual void SetDisplayId(uint modelId, float displayScale = 1f)
|
||||
@@ -1995,7 +1995,7 @@ namespace Game.Entities
|
||||
public void SetBattlePetCompanionGUID(ObjectGuid guid) { SetUpdateFieldValue(m_values.ModifyValue(m_unitData).ModifyValue(m_unitData.BattlePetCompanionGUID), guid); }
|
||||
public ObjectGuid GetDemonCreatorGUID() { return m_unitData.DemonCreator; }
|
||||
public void SetDemonCreatorGUID(ObjectGuid guid) { SetUpdateFieldValue(m_values.ModifyValue(m_unitData).ModifyValue(m_unitData.DemonCreator), guid); }
|
||||
|
||||
|
||||
public ObjectGuid GetCharmerGUID() { return m_unitData.CharmedBy; }
|
||||
|
||||
public Unit GetCharmer() { return m_charmer; }
|
||||
@@ -2097,7 +2097,7 @@ namespace Game.Entities
|
||||
else
|
||||
{
|
||||
var raceEntry = CliDB.ChrRacesStorage.LookupByKey(GetRace());
|
||||
return (CreatureType)raceEntry.CreatureType;
|
||||
return (CreatureType)raceEntry.CreatureType;
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -2122,6 +2122,8 @@ namespace Game.Entities
|
||||
public bool IsTotem() { return UnitTypeMask.HasAnyFlag(UnitTypeMask.Totem); }
|
||||
public bool IsVehicle() { return UnitTypeMask.HasAnyFlag(UnitTypeMask.Vehicle); }
|
||||
|
||||
public uint GetContentTuning() { return m_unitData.ContentTuningID; }
|
||||
|
||||
public void AddUnitState(UnitState f)
|
||||
{
|
||||
m_state |= f;
|
||||
@@ -2266,7 +2268,7 @@ namespace Game.Entities
|
||||
}
|
||||
|
||||
public AnimTier GetAnimTier() { return (AnimTier)(byte)m_unitData.AnimTier; }
|
||||
|
||||
|
||||
public void SetAnimTier(AnimTier animTier, bool notifyClient = true)
|
||||
{
|
||||
SetUpdateFieldValue(m_values.ModifyValue(m_unitData).ModifyValue(m_unitData.AnimTier), (byte)animTier);
|
||||
@@ -2507,7 +2509,7 @@ namespace Game.Entities
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Player player = victim.ToPlayer();
|
||||
if (player != null && player.GetCommandStatus(PlayerCommandStates.God))
|
||||
return 0;
|
||||
|
||||
@@ -5180,14 +5180,6 @@ namespace Game.Spells
|
||||
if (loot != null && (!loot.IsLooted() || loot.loot_type == LootType.Skinning))
|
||||
return SpellCastResult.TargetNotLooted;
|
||||
|
||||
SkillType skill = creature.GetCreatureTemplate().GetRequiredLootSkill();
|
||||
|
||||
ushort skillValue = m_caster.ToPlayer().GetSkillValue(skill);
|
||||
uint TargetLevel = m_targets.GetUnitTarget().GetLevelForTarget(m_caster);
|
||||
int ReqValue = (int)(skillValue < 100 ? (TargetLevel - 10) * 10 : TargetLevel * 5);
|
||||
if (ReqValue > skillValue)
|
||||
return SpellCastResult.LowCastlevel;
|
||||
|
||||
break;
|
||||
}
|
||||
case SpellEffectName.OpenLock:
|
||||
|
||||
@@ -3450,6 +3450,7 @@ namespace Game.Spells
|
||||
loot.FillLoot(creature.GetCreatureTemplate().SkinLootId, LootStorage.Skinning, player, true);
|
||||
player.SendLoot(loot);
|
||||
|
||||
// This formula is still used (10.0.5.48526)
|
||||
if (skill == SkillType.Skinning)
|
||||
{
|
||||
int reqValue;
|
||||
@@ -3478,12 +3479,20 @@ namespace Game.Spells
|
||||
else
|
||||
reqValue = 900;
|
||||
|
||||
// TODO: Specialize skillid for each expansion
|
||||
// new db field?
|
||||
// tied to one of existing expansion fields in creature_template?
|
||||
ContentTuningRecord contentTuning = CliDB.ContentTuningStorage.LookupByKey(creature.GetContentTuning());
|
||||
if (contentTuning == null)
|
||||
return;
|
||||
|
||||
// Double chances for elites
|
||||
m_caster.ToPlayer().UpdateGatherSkill(skill, (uint)damage, (uint)reqValue, (uint)(creature.IsElite() ? 2 : 1));
|
||||
uint skinningSkill = player.GetProfessionSkillForExp(skill, contentTuning.ExpansionID);
|
||||
if (skinningSkill == 0)
|
||||
return;
|
||||
|
||||
uint pureSkillValue = player.GetPureSkillValue(skinningSkill);
|
||||
if (pureSkillValue != 0)
|
||||
{
|
||||
// Double chances for elites
|
||||
player.UpdateGatherSkill(skinningSkill, pureSkillValue, (uint)reqValue, creature.IsElite() ? 2 : 1u);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user