Open Xadras opened 9 years ago
Original comment by robinsch (Bitbucket: robinsch, GitHub: robinsch):
#!diff
From ccb728954fc482baef2b4f6b1fe661c54cd63843 Mon Sep 17 00:00:00 2001
From: robinsch
Date: Thu, 3 Sep 2015 10:00:51 +0200
Subject: [PATCH] Core/SpellEffects: SPELL_FAILED_TRY_AGAIN should be reported
after finish casting Skinning/Mining/Gathering/Lockpicking.
---
src/server/game/Spells/Spell.cpp | 31 ++++++++++---------------------
src/server/game/Spells/SpellEffects.cpp | 23 ++++++++++++++++++++---
2 files changed, 30 insertions(+), 24 deletions(-)
diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp
index 29ce1ed..bd6af7e 100644
--- a/src/server/game/Spells/Spell.cpp
+++ b/src/server/game/Spells/Spell.cpp
@@ -4189,12 +4189,6 @@ uint8 Spell::CanCast(bool strict)
if (ReqValue > skillValue)
return SPELL_FAILED_LOW_CASTLEVEL;
- // chance for fail at orange skinning attempt
- if ((m_selfContainer && (*m_selfContainer) == this) &&
- skillValue < sWorld->GetConfigMaxSkillValue() &&
- (ReqValue < 0 ? 0 : ReqValue) > irand(skillValue - 25, skillValue + 37))
- return SPELL_FAILED_TRY_AGAIN;
-
break;
}
case SPELL_EFFECT_OPEN_LOCK_ITEM:
@@ -4285,19 +4279,18 @@ uint8 Spell::CanCast(bool strict)
// get the skill value of the player
int32 SkillValue = 0;
- bool canFailAtMax = true;
- if (m_spellInfo->EffectMiscValue[i] == LOCKTYPE_HERBALISM)
+ switch (m_spellInfo->EffectMiscValue[i])
{
- SkillValue = m_caster->ToPlayer()->GetSkillValue(SKILL_HERBALISM);
- canFailAtMax = false;
- }
- else if (m_spellInfo->EffectMiscValue[i] == LOCKTYPE_MINING)
- {
- SkillValue = m_caster->ToPlayer()->GetSkillValue(SKILL_MINING);
- canFailAtMax = false;
+ case LOCKTYPE_HERBALISM:
+ SkillValue = m_caster->ToPlayer()->GetSkillValue(SKILL_HERBALISM);
+ break;
+ case LOCKTYPE_MINING:
+ SkillValue = m_caster->ToPlayer()->GetSkillValue(SKILL_MINING);
+ break;
+ case LOCKTYPE_PICKLOCK:
+ SkillValue = m_caster->ToPlayer()->GetSkillValue(SKILL_LOCKPICKING);
+ break;
}
- else if (m_spellInfo->EffectMiscValue[i] == LOCKTYPE_PICKLOCK)
- SkillValue = m_caster->ToPlayer()->GetSkillValue(SKILL_LOCKPICKING);
// castitem check: rogue using skeleton keys. the skill values should not be added in this case.
if (m_CastItem)
@@ -4335,10 +4328,6 @@ uint8 Spell::CanCast(bool strict)
if (ReqValue > SkillValue)
return SPELL_FAILED_LOW_CASTLEVEL;
- // chance for failure in orange gather / lockpick (gathering skill can't fail at maxskill)
- if ((canFailAtMax || SkillValue < sWorld->GetConfigMaxSkillValue()) && ReqValue > irand(SkillValue-25, SkillValue+37))
- return SPELL_FAILED_TRY_AGAIN;
-
break;
}
case SPELL_EFFECT_SUMMON_DEAD_PET:
diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp
index 67c8a95..b33abb0 100644
--- a/src/server/game/Spells/SpellEffects.cpp
+++ b/src/server/game/Spells/SpellEffects.cpp
@@ -3325,6 +3325,13 @@ void Spell::EffectOpenLock(uint32 /*i*/)
uint32 SkillValue = player->GetPureSkillValue(SkillId);
if (SkillValue) // non only item base skill
{
+ // chance for failure in orange gather / lockpick (gathering skill can't fail at maxskill)
+ if ((SkillValue < sWorld->GetConfigMaxSkillValue()) && reqSkillValue > irand(SkillValue - 25, SkillValue + 37))
+ {
+ SendCastResult(SPELL_FAILED_TRY_AGAIN);
+ return;
+ }
+
if (gameObjTarget)
{
// Allow one skill-up until respawned
@@ -6168,18 +6175,28 @@ void Spell::EffectSkinning(uint32 /*i*/)
Creature* creature = unitTarget->ToCreature();
int32 targetLevel = creature->getLevel();
-
uint32 skill = creature->GetCreatureTemplate()->GetRequiredLootSkill();
+ int32 skillValue = m_caster->ToPlayer()->GetSkillValue(skill);
+ int32 ReqValue = (skillValue < 100 ? (targetLevel - 10) * 10 : targetLevel * 5);
+
+ // chance for fail at orange skinning attempt
+ if ((m_selfContainer && (*m_selfContainer) == this) &&
+ skillValue < sWorld->GetConfigMaxSkillValue() &&
+ (ReqValue < 0 ? 0 : ReqValue) > irand(skillValue - 25, skillValue + 37))
+ {
+ SendCastResult(SPELL_FAILED_TRY_AGAIN);
+ return;
+ }
m_caster->ToPlayer()->SendLoot(creature->GetGUID(), LOOT_SKINNING);
creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE);
int32 reqValue = targetLevel < 10 ? 0 : targetLevel < 20 ? (targetLevel-10)*10 : targetLevel*5;
- int32 skillValue = m_caster->ToPlayer()->GetPureSkillValue(skill);
+ int32 pureSkillValue = m_caster->ToPlayer()->GetPureSkillValue(skill);
// Double chances for elites
- m_caster->ToPlayer()->UpdateGatherSkill(skill, skillValue, reqValue, creature->isElite() ? 2 : 1);
+ m_caster->ToPlayer()->UpdateGatherSkill(skill, pureSkillValue, reqValue, creature->isElite() ? 2 : 1);
}
void Spell::EffectCharge(uint32 /*i*/)
--
Originally reported by: robinsch (Bitbucket: robinsch, GitHub: robinsch)
Normal: Nach dem casten von Mining/Herbalism/Skinning besteht die Chance das es zu einem "failed attempt" kommt.
LFG: "failed attempt" kommt vor dem casten, beim anklicken des node.