mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
Core/Skinning: Update correct skinning skill according to creature expansion (#28861)
This commit is contained in:
@@ -5548,16 +5548,22 @@ bool Player::UpdateCraftSkill(SpellInfo const* spellInfo)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Player::UpdateGatherSkill(uint32 SkillId, uint32 SkillValue, uint32 RedLevel, uint32 Multiplicator /*= 1*/, WorldObject const* object /*= nullptr*/)
|
||||
bool Player::UpdateGatherSkill(uint32 skillId, uint32 skillValue, uint32 redLevel, uint32 multiplicator /*= 1*/, WorldObject const* object /*= nullptr*/)
|
||||
{
|
||||
TC_LOG_DEBUG("entities.player.skills", "Player::UpdateGatherSkill: Player '{}' ({}), SkillID: {}, SkillLevel: {}, RedLevel: {})",
|
||||
GetName(), GetGUID().ToString(), SkillId, SkillValue, RedLevel);
|
||||
GetName(), GetGUID().ToString(), skillId, skillValue, redLevel);
|
||||
|
||||
uint32 gathering_skill_gain = sWorld->getIntConfig(CONFIG_SKILL_GAIN_GATHERING);
|
||||
SkillLineEntry const* skillEntry = sSkillLineStore.LookupEntry(skillId);
|
||||
if (!skillEntry)
|
||||
return false;
|
||||
|
||||
uint32 gatheringSkillGain = sWorld->getIntConfig(CONFIG_SKILL_GAIN_GATHERING);
|
||||
|
||||
uint32 baseSkillLevelStep = 30;
|
||||
uint32 yellowLevel = redLevel + baseSkillLevelStep;
|
||||
uint32 greenLevel = yellowLevel + baseSkillLevelStep;
|
||||
uint32 grayLevel = greenLevel + baseSkillLevelStep;
|
||||
|
||||
uint32 grayLevel = RedLevel + 100;
|
||||
uint32 greenLevel = RedLevel + 50;
|
||||
uint32 yellowLevel = RedLevel + 25;
|
||||
if (GameObject const* go = Object::ToGameObject(object))
|
||||
{
|
||||
if (go->GetGOInfo()->GetTrivialSkillLow())
|
||||
@@ -5570,46 +5576,20 @@ bool Player::UpdateGatherSkill(uint32 SkillId, uint32 SkillValue, uint32 RedLeve
|
||||
}
|
||||
|
||||
// For skinning and Mining chance decrease with level. 1-74 - no decrease, 75-149 - 2 times, 225-299 - 8 times
|
||||
switch (SkillId)
|
||||
switch (skillEntry->ParentSkillLineID)
|
||||
{
|
||||
case SKILL_HERBALISM:
|
||||
case SKILL_CLASSIC_HERBALISM:
|
||||
case SKILL_OUTLAND_HERBALISM:
|
||||
case SKILL_NORTHREND_HERBALISM:
|
||||
case SKILL_CATACLYSM_HERBALISM:
|
||||
case SKILL_PANDARIA_HERBALISM:
|
||||
case SKILL_DRAENOR_HERBALISM:
|
||||
case SKILL_LEGION_HERBALISM:
|
||||
case SKILL_KUL_TIRAN_HERBALISM:
|
||||
case SKILL_JEWELCRAFTING:
|
||||
case SKILL_INSCRIPTION:
|
||||
return UpdateSkillPro(SkillId, SkillGainChance(SkillValue, grayLevel, greenLevel, yellowLevel) * Multiplicator, gathering_skill_gain);
|
||||
return UpdateSkillPro(skillId, SkillGainChance(skillValue, grayLevel, greenLevel, yellowLevel) * multiplicator, gatheringSkillGain);
|
||||
case SKILL_SKINNING:
|
||||
case SKILL_CLASSIC_SKINNING:
|
||||
case SKILL_OUTLAND_SKINNING:
|
||||
case SKILL_NORTHREND_SKINNING:
|
||||
case SKILL_CATACLYSM_SKINNING:
|
||||
case SKILL_PANDARIA_SKINNING:
|
||||
case SKILL_DRAENOR_SKINNING:
|
||||
case SKILL_LEGION_SKINNING:
|
||||
case SKILL_KUL_TIRAN_SKINNING:
|
||||
if (sWorld->getIntConfig(CONFIG_SKILL_CHANCE_SKINNING_STEPS) == 0)
|
||||
return UpdateSkillPro(SkillId, SkillGainChance(SkillValue, grayLevel, greenLevel, yellowLevel) * Multiplicator, gathering_skill_gain);
|
||||
return UpdateSkillPro(skillId, SkillGainChance(skillValue, grayLevel, greenLevel, yellowLevel) * multiplicator, gatheringSkillGain);
|
||||
else
|
||||
return UpdateSkillPro(SkillId, (SkillGainChance(SkillValue, grayLevel, greenLevel, yellowLevel) * Multiplicator) >> (SkillValue / sWorld->getIntConfig(CONFIG_SKILL_CHANCE_SKINNING_STEPS)), gathering_skill_gain);
|
||||
return UpdateSkillPro(skillId, (SkillGainChance(skillValue, grayLevel, greenLevel, yellowLevel) * multiplicator) >> (skillValue / sWorld->getIntConfig(CONFIG_SKILL_CHANCE_SKINNING_STEPS)), gatheringSkillGain);
|
||||
case SKILL_MINING:
|
||||
case SKILL_CLASSIC_MINING:
|
||||
case SKILL_OUTLAND_MINING:
|
||||
case SKILL_NORTHREND_MINING:
|
||||
case SKILL_CATACLYSM_MINING:
|
||||
case SKILL_PANDARIA_MINING:
|
||||
case SKILL_DRAENOR_MINING:
|
||||
case SKILL_LEGION_MINING:
|
||||
case SKILL_KUL_TIRAN_MINING:
|
||||
if (sWorld->getIntConfig(CONFIG_SKILL_CHANCE_MINING_STEPS) == 0)
|
||||
return UpdateSkillPro(SkillId, SkillGainChance(SkillValue, grayLevel, greenLevel, yellowLevel) * Multiplicator, gathering_skill_gain);
|
||||
return UpdateSkillPro(skillId, SkillGainChance(skillValue, grayLevel, greenLevel, yellowLevel) * multiplicator, gatheringSkillGain);
|
||||
else
|
||||
return UpdateSkillPro(SkillId, (SkillGainChance(SkillValue, grayLevel, greenLevel, yellowLevel) * Multiplicator) >> (SkillValue / sWorld->getIntConfig(CONFIG_SKILL_CHANCE_MINING_STEPS)), gathering_skill_gain);
|
||||
return UpdateSkillPro(skillId, (SkillGainChance(skillValue, grayLevel, greenLevel, yellowLevel) * multiplicator) >> (skillValue / sWorld->getIntConfig(CONFIG_SKILL_CHANCE_MINING_STEPS)), gatheringSkillGain);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -2024,7 +2024,7 @@ class TC_GAME_API Player : public Unit, public GridObject<Player>
|
||||
|
||||
bool UpdateSkillPro(uint16 skillId, int32 chance, uint32 step);
|
||||
bool UpdateCraftSkill(SpellInfo const* spellInfo);
|
||||
bool UpdateGatherSkill(uint32 SkillId, uint32 SkillValue, uint32 RedLevel, uint32 Multiplicator = 1, WorldObject const* object = nullptr);
|
||||
bool UpdateGatherSkill(uint32 skillId, uint32 skillValue, uint32 redLevel, uint32 multiplicator = 1, WorldObject const* object = nullptr);
|
||||
bool UpdateFishingSkill(int32 expansion);
|
||||
|
||||
float GetHealthBonusFromStamina() const;
|
||||
|
||||
@@ -852,6 +852,7 @@ class TC_GAME_API Unit : public WorldObject
|
||||
bool IsTotem() const { return (m_unitTypeMask & UNIT_MASK_TOTEM) != 0; }
|
||||
bool IsVehicle() const { return (m_unitTypeMask & UNIT_MASK_VEHICLE) != 0; }
|
||||
|
||||
int32 GetContentTuning() const { return m_unitData->ContentTuningID; }
|
||||
uint8 GetLevel() const { return uint8(m_unitData->Level); }
|
||||
uint8 GetLevelForTarget(WorldObject const* /*target*/) const override { return GetLevel(); }
|
||||
void SetLevel(uint8 lvl, bool sendUpdate = true);
|
||||
|
||||
@@ -6016,14 +6016,6 @@ SpellCastResult Spell::CheckCast(bool strict, int32* param1 /*= nullptr*/, int32
|
||||
if (loot && (!loot->isLooted() || loot->loot_type == LOOT_SKINNING))
|
||||
return SPELL_FAILED_TARGET_NOT_LOOTED;
|
||||
|
||||
uint32 skill = creature->GetCreatureTemplate()->GetRequiredLootSkill();
|
||||
|
||||
int32 skillValue = m_caster->ToPlayer()->GetSkillValue(skill);
|
||||
int32 TargetLevel = m_targets.GetUnitTarget()->GetLevelForTarget(m_caster);
|
||||
int32 ReqValue = (skillValue < 100 ? (TargetLevel-10) * 10 : TargetLevel * 5);
|
||||
if (ReqValue > skillValue)
|
||||
return SPELL_FAILED_LOW_CASTLEVEL;
|
||||
|
||||
break;
|
||||
}
|
||||
case SPELL_EFFECT_OPEN_LOCK:
|
||||
|
||||
@@ -3723,6 +3723,7 @@ void Spell::EffectSkinning()
|
||||
loot->FillLoot(creature->GetCreatureTemplate()->SkinLootId, LootTemplates_Skinning, player, true);
|
||||
player->SendLoot(*loot);
|
||||
|
||||
// This formula is still used (10.0.5.48526)
|
||||
if (skill == SKILL_SKINNING)
|
||||
{
|
||||
int32 reqValue;
|
||||
@@ -3751,12 +3752,19 @@ void Spell::EffectSkinning()
|
||||
else
|
||||
reqValue = 900;
|
||||
|
||||
// TODO: Specialize skillid for each expansion
|
||||
// new db field?
|
||||
// tied to one of existing expansion fields in creature_template?
|
||||
ContentTuningEntry const* contentTuning = sContentTuningStore.LookupEntry(creature->GetContentTuning());
|
||||
if (!contentTuning)
|
||||
return;
|
||||
|
||||
// Double chances for elites
|
||||
m_caster->ToPlayer()->UpdateGatherSkill(skill, damage, reqValue, creature->isElite() ? 2 : 1);
|
||||
uint32 skinningSkill = player->GetProfessionSkillForExp(skill, contentTuning->ExpansionID);
|
||||
if (!skinningSkill)
|
||||
return;
|
||||
|
||||
if (uint32 pureSkillValue = player->GetPureSkillValue(skinningSkill))
|
||||
{
|
||||
// Double chances for elites
|
||||
player->UpdateGatherSkill(skinningSkill, pureSkillValue, reqValue, creature->isElite() ? 2 : 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user