From c0bf535e5bc978257952c9bd4e258eed238d1828 Mon Sep 17 00:00:00 2001 From: Vincent-Michael Date: Sun, 11 Aug 2013 02:07:42 +0200 Subject: [PATCH 1/8] Core/Spells: Convert "Summon Memory" in spell script --- src/server/game/Spells/SpellEffects.cpp | 8 -- .../boss_argent_challenge.cpp | 111 +++++++++++++++++- 2 files changed, 109 insertions(+), 10 deletions(-) diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index 80d326e2c7..ac3f12ed8c 100644 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -4114,14 +4114,6 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex) } break; } - case 66545: //Summon Memory - { - uint8 uiRandom = urand(0, 25); - uint32 uiSpells[26] = {66704, 66705, 66706, 66707, 66709, 66710, 66711, 66712, 66713, 66714, 66715, 66708, 66708, 66691, 66692, 66694, 66695, 66696, 66697, 66698, 66699, 66700, 66701, 66702, 66703, 66543}; - - m_caster->CastSpell(m_caster, uiSpells[uiRandom], true); - break; - } case 45668: // Ultra-Advanced Proto-Typical Shortening Blaster { if (!unitTarget || unitTarget->GetTypeId() != TYPEID_UNIT) diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_argent_challenge.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_argent_challenge.cpp index 9bc9afa4fa..5a1bf00a3f 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_argent_challenge.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_argent_challenge.cpp @@ -61,7 +61,7 @@ enum Spells SPELL_RADIANCE = 66935, SPELL_VENGEANCE = 66865, - //Paletress + // Paletress SPELL_SMITE = 66536, SPELL_SMITE_H = 67674, SPELL_HOLY_FIRE = 66538, @@ -73,7 +73,34 @@ enum Spells SPELL_CONFESS = 66680, SPELL_SUMMON_MEMORY = 66545, - //Memory + // Merory of X (Summon) + SPELL_MEMORY_ALGALON = 66715, + SPELL_MEMORY_ARCHIMONDE = 66715, + SPELL_MEMORY_CHROMAGGUS = 66697, + SPELL_MEMORY_CYANIGOSA = 66697, + SPELL_MEMORY_DELRISSA = 66706, + SPELL_MEMORY_ECK = 66710, + SPELL_MEMORY_ENTROPIUS = 66707, + SPELL_MEMORY_GRUUL = 66702, + SPELL_MEMORY_HAKKAR = 66698, + SPELL_MEMORY_HEIGAN = 66712, + SPELL_MEMORY_HEROD = 66694, + SPELL_MEMORY_HOGGER = 66543, + SPELL_MEMORY_IGNIS = 66713, + SPELL_MEMORY_ILLIDAN = 66705, + SPELL_MEMORY_INGVAR = 66708, + SPELL_MEMORY_KALITHRESH = 66700, + SPELL_MEMORY_LUCIFRON = 66695, + SPELL_MEMORY_MALCHEZAAR = 66701, + SPELL_MEMORY_MUTANUS = 66692, + SPELL_MEMORY_ONYXIA = 66711, + SPELL_MEMORY_THUNDERAAN = 66696, + SPELL_MEMORY_VANCLEEF = 66691, + SPELL_MEMORY_VASHJ = 66703, + SPELL_MEMORY_VEKNILASH = 66699, + SPELL_MEMORY_VEZAX = 66714, + + // Memory SPELL_OLD_WOUNDS = 66620, SPELL_OLD_WOUNDS_H = 67679, SPELL_SHADOWS_PAST = 66619, @@ -566,6 +593,85 @@ public: } }; +uint32 const memorySpellId[25] = +{ + SPELL_MEMORY_ALGALON, + SPELL_MEMORY_ARCHIMONDE, + SPELL_MEMORY_CHROMAGGUS, + SPELL_MEMORY_CYANIGOSA, + SPELL_MEMORY_DELRISSA, + SPELL_MEMORY_ECK, + SPELL_MEMORY_ENTROPIUS, + SPELL_MEMORY_GRUUL, + SPELL_MEMORY_HAKKAR, + SPELL_MEMORY_HEIGAN, + SPELL_MEMORY_HEROD, + SPELL_MEMORY_HOGGER, + SPELL_MEMORY_IGNIS, + SPELL_MEMORY_ILLIDAN, + SPELL_MEMORY_INGVAR, + SPELL_MEMORY_KALITHRESH, + SPELL_MEMORY_LUCIFRON, + SPELL_MEMORY_MALCHEZAAR, + SPELL_MEMORY_MUTANUS, + SPELL_MEMORY_ONYXIA, + SPELL_MEMORY_THUNDERAAN, + SPELL_MEMORY_VANCLEEF, + SPELL_MEMORY_VASHJ, + SPELL_MEMORY_VEKNILASH, + SPELL_MEMORY_VEZAX +}; + +// 66545 - Summon Memory +class spell_summon_memory : public SpellScriptLoader +{ + public: + spell_summon_memory() : SpellScriptLoader("spell_summon_memory") { } + + class spell_summon_memory_SpellScript : public SpellScript + { + PrepareSpellScript(spell_summon_memory_SpellScript); + + + bool Validate(SpellInfo const* /*spellInfo*/) OVERRIDE + { + for (uint8 i = 0; i < 25; ++i) + if (!sSpellMgr->GetSpellInfo(memorySpellId[i])) + return false; + return true; + } + + void FilterTargets(std::list& targets) + { + if (targets.empty()) + return; + + WorldObject* target = Trinity::Containers::SelectRandomContainerElement(targets); + targets.clear(); + targets.push_back(target); + } + + void HandleScript(SpellEffIndex /*effIndex*/) + { + Unit* caster = GetCaster(); + + if (Player* target = GetHitPlayer()) + caster->CastSpell(target, memorySpellId[urand(0, 24)], true); + } + + void Register() OVERRIDE + { + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_summon_memory_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); + OnEffectHitTarget += SpellEffectFn(spell_summon_memory_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } + }; + + SpellScript* GetSpellScript() const OVERRIDE + { + return new spell_summon_memory_SpellScript(); + } +}; + void AddSC_boss_argent_challenge() { new boss_eadric(); @@ -573,4 +679,5 @@ void AddSC_boss_argent_challenge() new boss_paletress(); new npc_memory(); new npc_argent_soldier(); + new spell_summon_memory(); } From 80bd5b363aa77efb9c151e805c45a5ca06a565d4 Mon Sep 17 00:00:00 2001 From: Discover- Date: Sun, 11 Aug 2013 02:58:53 +0200 Subject: [PATCH 2/8] Core/SmartAI: Drop support for SMART_ACTION_SEND_CASTCREATUREORGO. It is unused in the current newest TDB, it never even worked like it should and the exact same purpose of this function is already fulfilled by SMART_ACTION_CALL_CASTEDCREATUREORGO (the correct way). --- .../game/AI/SmartScripts/SmartScript.cpp | 26 ++----------------- .../game/AI/SmartScripts/SmartScriptMgr.cpp | 11 ++------ .../game/AI/SmartScripts/SmartScriptMgr.h | 10 ++----- 3 files changed, 6 insertions(+), 41 deletions(-) diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp index 261c4166a1..ca5b50ea56 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.cpp +++ b/src/server/game/AI/SmartScripts/SmartScript.cpp @@ -489,28 +489,6 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u delete targets; break; } - case SMART_ACTION_SEND_CASTCREATUREORGO: - { - if (!GetBaseObject()) - break; - - ObjectList* targets = GetTargets(e, unit); - if (!targets) - break; - - for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr) - { - if (IsPlayer(*itr)) - { - (*itr)->ToPlayer()->CastedCreatureOrGO(e.action.castedCreatureOrGO.creature, GetBaseObject()->GetGUID(), e.action.castedCreatureOrGO.spell); - TC_LOG_DEBUG(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction:: SMART_ACTION_SEND_CASTCREATUREORGO: Player guidLow %u.org Creature: %u, BaseObject GUID: "UI64FMTD", Spell: %u", - (*itr)->GetGUIDLow(), e.action.castedCreatureOrGO.creature, GetBaseObject()->GetGUID(), e.action.castedCreatureOrGO.spell); - } - } - - delete targets; - break; - } case SMART_ACTION_CAST: { if (!me) @@ -800,9 +778,9 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u { if (IsPlayer((*itr))) { - (*itr)->ToPlayer()->CastedCreatureOrGO(e.action.castedCreatureOrGO.creature, GetBaseObject()->GetGUID(), e.action.castedCreatureOrGO.spell); + (*itr)->ToPlayer()->CastedCreatureOrGO(e.action.callCastedCreatureOrGO.creature, GetBaseObject()->GetGUID(), e.action.callCastedCreatureOrGO.spell); TC_LOG_DEBUG(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction: SMART_ACTION_CALL_CASTEDCREATUREORGO: Player %u, target %u, spell %u", - (*itr)->GetGUIDLow(), e.action.castedCreatureOrGO.creature, e.action.castedCreatureOrGO.spell); + (*itr)->GetGUIDLow(), e.action.callCastedCreatureOrGO.creature, e.action.callCastedCreatureOrGO.spell); } } diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp index eeeacb3603..5fb3e2481c 100644 --- a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp +++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp @@ -682,13 +682,6 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e) return false; } break; - case SMART_ACTION_SEND_CASTCREATUREORGO: - if (!IsQuestValid(e, e.action.castCreatureOrGO.quest)) - return false; - - if (!IsSpellValid(e, e.action.castCreatureOrGO.spell)) - return false; - break; case SMART_ACTION_SET_EVENT_PHASE: if (e.action.setEventPhase.phase >= SMART_EVENT_PHASE_MAX) { @@ -709,10 +702,10 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e) } break; case SMART_ACTION_CALL_CASTEDCREATUREORGO: - if (!IsCreatureValid(e, e.action.castedCreatureOrGO.creature)) + if (!IsCreatureValid(e, e.action.callCastedCreatureOrGO.creature)) return false; - if (!IsSpellValid(e, e.action.castedCreatureOrGO.spell)) + if (!IsSpellValid(e, e.action.callCastedCreatureOrGO.spell)) return false; break; case SMART_ACTION_REMOVEAURASFROMSPELL: diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.h b/src/server/game/AI/SmartScripts/SmartScriptMgr.h index 394ede7fb5..2f8c3cc33a 100644 --- a/src/server/game/AI/SmartScripts/SmartScriptMgr.h +++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.h @@ -397,7 +397,7 @@ enum SMART_ACTION SMART_ACTION_THREAT_SINGLE_PCT = 13, // Threat% SMART_ACTION_THREAT_ALL_PCT = 14, // Threat% SMART_ACTION_CALL_AREAEXPLOREDOREVENTHAPPENS = 15, // QuestID - SMART_ACTION_SEND_CASTCREATUREORGO = 16, // QuestID, SpellId + SMART_ACTION_UNUSED_16 = 16, // UNUSED SMART_ACTION_SET_EMOTE_STATE = 17, // emoteID SMART_ACTION_SET_UNIT_FLAG = 18, // Flags (may be more than one field OR'd together), Target SMART_ACTION_REMOVE_UNIT_FLAG = 19, // Flags (may be more than one field OR'd together), Target @@ -572,12 +572,6 @@ struct SmartAction uint32 threatDEC; } threatPCT; - struct - { - uint32 quest; - uint32 spell; - } castCreatureOrGO; - struct { uint32 flag1; @@ -623,7 +617,7 @@ struct SmartAction { uint32 creature; uint32 spell; - } castedCreatureOrGO; + } callCastedCreatureOrGO; struct { From 9e45731f3270b44d45d1b96e96d0fceb6ccf4ec3 Mon Sep 17 00:00:00 2001 From: Vincent-Michael Date: Sun, 11 Aug 2013 11:51:59 +0200 Subject: [PATCH 3/8] Scripted/ToC5: Add missing stuff in c0bf535e5bc978257952c9bd4e258eed238d1828 --- ...2013_08_11_00_world_spell_script_names.sql | 3 +++ .../boss_argent_challenge.cpp | 21 +++++++++---------- 2 files changed, 13 insertions(+), 11 deletions(-) create mode 100644 sql/updates/world/2013_08_11_00_world_spell_script_names.sql diff --git a/sql/updates/world/2013_08_11_00_world_spell_script_names.sql b/sql/updates/world/2013_08_11_00_world_spell_script_names.sql new file mode 100644 index 0000000000..00aee10402 --- /dev/null +++ b/sql/updates/world/2013_08_11_00_world_spell_script_names.sql @@ -0,0 +1,3 @@ +DELETE FROM `spell_script_names` WHERE `spell_id`=66545; +INSERT INTO `spell_script_names` (`spell_id` ,`ScriptName`) VALUES +(66545, 'spell_paletress_summon_memory'); diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_argent_challenge.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_argent_challenge.cpp index 5a1bf00a3f..0f8e9de89b 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_argent_challenge.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_argent_challenge.cpp @@ -75,9 +75,9 @@ enum Spells // Merory of X (Summon) SPELL_MEMORY_ALGALON = 66715, - SPELL_MEMORY_ARCHIMONDE = 66715, + SPELL_MEMORY_ARCHIMONDE = 66704, SPELL_MEMORY_CHROMAGGUS = 66697, - SPELL_MEMORY_CYANIGOSA = 66697, + SPELL_MEMORY_CYANIGOSA = 66709, SPELL_MEMORY_DELRISSA = 66706, SPELL_MEMORY_ECK = 66710, SPELL_MEMORY_ENTROPIUS = 66707, @@ -623,15 +623,14 @@ uint32 const memorySpellId[25] = }; // 66545 - Summon Memory -class spell_summon_memory : public SpellScriptLoader +class spell_paletress_summon_memory : public SpellScriptLoader { public: - spell_summon_memory() : SpellScriptLoader("spell_summon_memory") { } + spell_paletress_summon_memory() : SpellScriptLoader("spell_paletress_summon_memory") { } - class spell_summon_memory_SpellScript : public SpellScript + class spell_paletress_summon_memory_SpellScript : public SpellScript { - PrepareSpellScript(spell_summon_memory_SpellScript); - + PrepareSpellScript(spell_paletress_summon_memory_SpellScript); bool Validate(SpellInfo const* /*spellInfo*/) OVERRIDE { @@ -661,14 +660,14 @@ class spell_summon_memory : public SpellScriptLoader void Register() OVERRIDE { - OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_summon_memory_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); - OnEffectHitTarget += SpellEffectFn(spell_summon_memory_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_paletress_summon_memory_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); + OnEffectHitTarget += SpellEffectFn(spell_paletress_summon_memory_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); } }; SpellScript* GetSpellScript() const OVERRIDE { - return new spell_summon_memory_SpellScript(); + return new spell_paletress_summon_memory_SpellScript(); } }; @@ -679,5 +678,5 @@ void AddSC_boss_argent_challenge() new boss_paletress(); new npc_memory(); new npc_argent_soldier(); - new spell_summon_memory(); + new spell_paletress_summon_memory(); } From d0bde02b21241773c908c18ade368a1bbb5ee8bb Mon Sep 17 00:00:00 2001 From: Nay Date: Sun, 11 Aug 2013 15:52:23 +0100 Subject: [PATCH 4/8] Core/CreatureAI: Do not remove clone_caster auras on evade (in addition to control_vehicle auras) --- src/server/game/AI/CreatureAI.cpp | 5 ++-- src/server/game/Entities/Unit/Unit.cpp | 33 +++++++++++++++++++++----- src/server/game/Entities/Unit/Unit.h | 1 + 3 files changed, 31 insertions(+), 8 deletions(-) diff --git a/src/server/game/AI/CreatureAI.cpp b/src/server/game/AI/CreatureAI.cpp index a494507919..cbb79b4795 100644 --- a/src/server/game/AI/CreatureAI.cpp +++ b/src/server/game/AI/CreatureAI.cpp @@ -225,8 +225,9 @@ bool CreatureAI::_EnterEvadeMode() if (!me->IsAlive()) return false; - // dont remove vehicle auras, passengers arent supposed to drop off the vehicle - me->RemoveAllAurasExceptType(SPELL_AURA_CONTROL_VEHICLE); + // don't remove vehicle auras, passengers aren't supposed to drop off the vehicle + // don't remove clone caster on evade (to be verified) + me->RemoveAllAurasExceptType(SPELL_AURA_CONTROL_VEHICLE, SPELL_AURA_CLONE_CASTER); // sometimes bosses stuck in combat? me->DeleteThreatList(); diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 327c4b96c3..fc3a9efb90 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -4068,19 +4068,40 @@ void Unit::RemoveAllAurasExceptType(AuraType type) for (AuraApplicationMap::iterator iter = m_appliedAuras.begin(); iter != m_appliedAuras.end();) { Aura const* aura = iter->second->GetBase(); - if (!aura->GetSpellInfo()->HasAura(type)) - _UnapplyAura(iter, AURA_REMOVE_BY_DEFAULT); - else + if (aura->GetSpellInfo()->HasAura(type)) ++iter; + else + _UnapplyAura(iter, AURA_REMOVE_BY_DEFAULT); } for (AuraMap::iterator iter = m_ownedAuras.begin(); iter != m_ownedAuras.end();) { Aura* aura = iter->second; - if (!aura->GetSpellInfo()->HasAura(type)) - RemoveOwnedAura(iter, AURA_REMOVE_BY_DEFAULT); - else + if (aura->GetSpellInfo()->HasAura(type)) ++iter; + else + RemoveOwnedAura(iter, AURA_REMOVE_BY_DEFAULT); + } +} + +void Unit::RemoveAllAurasExceptType(AuraType type1, AuraType type2) +{ + for (AuraApplicationMap::iterator iter = m_appliedAuras.begin(); iter != m_appliedAuras.end();) + { + Aura const* aura = iter->second->GetBase(); + if (aura->GetSpellInfo()->HasAura(type1) || aura->GetSpellInfo()->HasAura(type2)) + ++iter; + else + _UnapplyAura(iter, AURA_REMOVE_BY_DEFAULT); + } + + for (AuraMap::iterator iter = m_ownedAuras.begin(); iter != m_ownedAuras.end();) + { + Aura* aura = iter->second; + if (aura->GetSpellInfo()->HasAura(type1) || aura->GetSpellInfo()->HasAura(type2)) + ++iter; + else + RemoveOwnedAura(iter, AURA_REMOVE_BY_DEFAULT); } } diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h index 56f4e7142a..5e2e746ae6 100644 --- a/src/server/game/Entities/Unit/Unit.h +++ b/src/server/game/Entities/Unit/Unit.h @@ -1743,6 +1743,7 @@ class Unit : public WorldObject void RemoveAllAurasOnDeath(); void RemoveAllAurasRequiringDeadTarget(); void RemoveAllAurasExceptType(AuraType type); + void RemoveAllAurasExceptType(AuraType type1, AuraType type2); /// @todo: once we support variadic templates use them here void DelayOwnedAuras(uint32 spellId, uint64 caster, int32 delaytime); void _RemoveAllAuraStatMods(); From 3d1c549aa42aff4d146350b6936d90a5adb859ef Mon Sep 17 00:00:00 2001 From: Discover- Date: Sun, 11 Aug 2013 16:02:17 +0100 Subject: [PATCH 5/8] DB/EAI: Fix some typos in EAI scripts We are updating EAI scripts so the conversion to SAI is correctly done --- sql/updates/world/2013_08_11_01_world_eai_335.sql | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 sql/updates/world/2013_08_11_01_world_eai_335.sql diff --git a/sql/updates/world/2013_08_11_01_world_eai_335.sql b/sql/updates/world/2013_08_11_01_world_eai_335.sql new file mode 100644 index 0000000000..94b5324e50 --- /dev/null +++ b/sql/updates/world/2013_08_11_01_world_eai_335.sql @@ -0,0 +1,3 @@ +UPDATE `creature_ai_scripts` SET `action1_param1`=15 WHERE `id`=1730003; -- Call For Help radius from 0 to 15 +UPDATE `creature_ai_scripts` SET `action1_type`=`action2_type`,`action2_type`=0,`action1_param1`=`action2_param1`,`action2_param1`=0 WHERE `id` IN (1772701,3547605); -- Action type gap +UPDATE `creature_ai_scripts` SET `action1_param1`=10255 WHERE `id`=1688002; -- Wrong quest credit (used npc id, should use quest id), fixes quest Testing the Antidote (or at least it should) From 2abaf6224e96920956d003e1894cc96382f18d0f Mon Sep 17 00:00:00 2001 From: Nay Date: Sun, 11 Aug 2013 16:36:36 +0100 Subject: [PATCH 6/8] Core/Player: Add debug log when SendCanTakeQuestResponse(INVALIDREASON_*) is used Intent is to find broken quest chains Requested by Aokromes --- src/server/game/Entities/Player/Player.cpp | 63 +++++++++++++++++++++- src/server/game/Entities/Player/Player.h | 27 +++++----- src/server/game/Quests/QuestDef.h | 2 +- src/server/scripts/Commands/cs_debug.cpp | 2 +- 4 files changed, 76 insertions(+), 18 deletions(-) diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index ed08e5f55e..d1b42151e0 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -15384,7 +15384,10 @@ bool Player::SatisfyQuestSkill(Quest const* qInfo, bool msg) const if (GetSkillValue(skill) < qInfo->GetRequiredSkillValue()) { if (msg) + { SendCanTakeQuestResponse(INVALIDREASON_DONT_HAVE_REQ); + TC_LOG_DEBUG(LOG_FILTER_GENERAL, "SatisfyQuestSkill: Sent INVALIDREASON_DONT_HAVE_REQ (questId: %u) because player does not have required skill value.", qInfo->GetQuestId()); + } return false; } @@ -15397,13 +15400,19 @@ bool Player::SatisfyQuestLevel(Quest const* qInfo, bool msg) if (getLevel() < qInfo->GetMinLevel()) { if (msg) + { SendCanTakeQuestResponse(INVALIDREASON_QUEST_FAILED_LOW_LEVEL); + TC_LOG_DEBUG(LOG_FILTER_GENERAL, "SatisfyQuestLevel: Sent INVALIDREASON_QUEST_FAILED_LOW_LEVEL (questId: %u) because player does not have required (min) level.", qInfo->GetQuestId()); + } return false; } else if (qInfo->GetMaxLevel() > 0 && getLevel() > qInfo->GetMaxLevel()) { if (msg) + { SendCanTakeQuestResponse(INVALIDREASON_DONT_HAVE_REQ); // There doesn't seem to be a specific response for too high player level + TC_LOG_DEBUG(LOG_FILTER_GENERAL, "SatisfyQuestLevel: Sent INVALIDREASON_QUEST_FAILED_LOW_LEVEL (questId: %u) because player does not have required (max) level.", qInfo->GetQuestId()); + } return false; } return true; @@ -15460,11 +15469,14 @@ bool Player::SatisfyQuestPreviousQuest(Quest const* qInfo, bool msg) if (exclude_Id == prevId) continue; - // alternative quest from group also must be completed and rewarded(reported) + // alternative quest from group also must be completed and rewarded (reported) if (m_RewardedQuests.find(exclude_Id) == m_RewardedQuests.end()) { if (msg) + { SendCanTakeQuestResponse(INVALIDREASON_DONT_HAVE_REQ); + TC_LOG_DEBUG(LOG_FILTER_GENERAL, "SatisfyQuestPreviousQuest: Sent INVALIDREASON_DONT_HAVE_REQ (questId: %u) because player does not have required quest (1).", qInfo->GetQuestId()); + } return false; } } @@ -15497,7 +15509,11 @@ bool Player::SatisfyQuestPreviousQuest(Quest const* qInfo, bool msg) if (GetQuestStatus(exclude_Id) != QUEST_STATUS_NONE) { if (msg) + { SendCanTakeQuestResponse(INVALIDREASON_DONT_HAVE_REQ); + TC_LOG_DEBUG(LOG_FILTER_GENERAL, "SatisfyQuestPreviousQuest: Sent INVALIDREASON_DONT_HAVE_REQ (questId: %u) because player does not have required quest (2).", qInfo->GetQuestId()); + + } return false; } } @@ -15509,7 +15525,10 @@ bool Player::SatisfyQuestPreviousQuest(Quest const* qInfo, bool msg) // Has only positive prev. quests in non-rewarded state // and negative prev. quests in non-active state if (msg) + { SendCanTakeQuestResponse(INVALIDREASON_DONT_HAVE_REQ); + TC_LOG_DEBUG(LOG_FILTER_GENERAL, "SatisfyQuestPreviousQuest: Sent INVALIDREASON_DONT_HAVE_REQ (questId: %u) because player does not have required quest (3).", qInfo->GetQuestId()); + } return false; } @@ -15524,7 +15543,10 @@ bool Player::SatisfyQuestClass(Quest const* qInfo, bool msg) const if ((reqClass & getClassMask()) == 0) { if (msg) + { SendCanTakeQuestResponse(INVALIDREASON_DONT_HAVE_REQ); + TC_LOG_DEBUG(LOG_FILTER_GENERAL, "SatisfyQuestClass: Sent INVALIDREASON_DONT_HAVE_REQ (questId: %u) because player does not have required class.", qInfo->GetQuestId()); + } return false; } @@ -15540,7 +15562,11 @@ bool Player::SatisfyQuestRace(Quest const* qInfo, bool msg) if ((reqraces & getRaceMask()) == 0) { if (msg) + { SendCanTakeQuestResponse(INVALIDREASON_QUEST_FAILED_WRONG_RACE); + TC_LOG_DEBUG(LOG_FILTER_GENERAL, "SatisfyQuestRace: Sent INVALIDREASON_QUEST_FAILED_WRONG_RACE (questId: %u) because player does not have required race.", qInfo->GetQuestId()); + + } return false; } return true; @@ -15552,7 +15578,10 @@ bool Player::SatisfyQuestReputation(Quest const* qInfo, bool msg) if (fIdMin && GetReputationMgr().GetReputation(fIdMin) < qInfo->GetRequiredMinRepValue()) { if (msg) + { SendCanTakeQuestResponse(INVALIDREASON_DONT_HAVE_REQ); + TC_LOG_DEBUG(LOG_FILTER_GENERAL, "SatisfyQuestReputation: Sent INVALIDREASON_DONT_HAVE_REQ (questId: %u) because player does not have required reputation (min).", qInfo->GetQuestId()); + } return false; } @@ -15560,7 +15589,10 @@ bool Player::SatisfyQuestReputation(Quest const* qInfo, bool msg) if (fIdMax && GetReputationMgr().GetReputation(fIdMax) >= qInfo->GetRequiredMaxRepValue()) { if (msg) + { SendCanTakeQuestResponse(INVALIDREASON_DONT_HAVE_REQ); + TC_LOG_DEBUG(LOG_FILTER_GENERAL, "SatisfyQuestReputation: Sent INVALIDREASON_DONT_HAVE_REQ (questId: %u) because player does not have required reputation (max).", qInfo->GetQuestId()); + } return false; } @@ -15570,7 +15602,10 @@ bool Player::SatisfyQuestReputation(Quest const* qInfo, bool msg) if (fIdObj && GetReputationMgr().GetReputation(fIdObj) >= qInfo->GetRepObjectiveValue2()) { if (msg) + { SendCanTakeQuestResponse(INVALIDREASON_DONT_HAVE_REQ); + TC_LOG_DEBUG(LOG_FILTER_GENERAL, "SatisfyQuestReputation: Sent INVALIDREASON_DONT_HAVE_REQ (questId: %u) because player does not have required reputation (ReputationObjective2).", qInfo->GetQuestId()); + } return false; } @@ -15582,7 +15617,10 @@ bool Player::SatisfyQuestStatus(Quest const* qInfo, bool msg) if (GetQuestStatus(qInfo->GetQuestId()) != QUEST_STATUS_NONE) { if (msg) + { SendCanTakeQuestResponse(INVALIDREASON_QUEST_ALREADY_ON); + TC_LOG_DEBUG(LOG_FILTER_GENERAL, "SatisfyQuestStatus: Sent INVALIDREASON_QUEST_ALREADY_ON (questId: %u) because player quest status is not NONE.", qInfo->GetQuestId()); + } return false; } return true; @@ -15594,7 +15632,10 @@ bool Player::SatisfyQuestConditions(Quest const* qInfo, bool msg) if (!sConditionMgr->IsObjectMeetToConditions(this, conditions)) { if (msg) + { SendCanTakeQuestResponse(INVALIDREASON_DONT_HAVE_REQ); + TC_LOG_DEBUG(LOG_FILTER_GENERAL, "SatisfyQuestConditions: Sent INVALIDREASON_DONT_HAVE_REQ (questId: %u) because player does not meet conditions.", qInfo->GetQuestId()); + } TC_LOG_DEBUG(LOG_FILTER_CONDITIONSYS, "Player::SatisfyQuestConditions: conditions not met for quest %u", qInfo->GetQuestId()); return false; } @@ -15606,7 +15647,10 @@ bool Player::SatisfyQuestTimed(Quest const* qInfo, bool msg) if (!m_timedquests.empty() && qInfo->HasFlag(QUEST_TRINITY_FLAGS_TIMED)) { if (msg) + { SendCanTakeQuestResponse(INVALIDREASON_QUEST_ONLY_ONE_TIMED); + TC_LOG_DEBUG(LOG_FILTER_GENERAL, "SatisfyQuestTimed: Sent INVALIDREASON_QUEST_ONLY_ONE_TIMED (questId: %u) because player is already on a timed quest.", qInfo->GetQuestId()); + } return false; } return true; @@ -15636,7 +15680,10 @@ bool Player::SatisfyQuestExclusiveGroup(Quest const* qInfo, bool msg) if (!SatisfyQuestDay(Nquest, false) || !SatisfyQuestWeek(Nquest, false) || !SatisfyQuestSeasonal(Nquest, false)) { if (msg) + { SendCanTakeQuestResponse(INVALIDREASON_DONT_HAVE_REQ); + TC_LOG_DEBUG(LOG_FILTER_GENERAL, "SatisfyQuestExclusiveGroup: Sent INVALIDREASON_DONT_HAVE_REQ (questId: %u) because player already did daily quests in exclusive group.", qInfo->GetQuestId()); + } return false; } @@ -15645,7 +15692,10 @@ bool Player::SatisfyQuestExclusiveGroup(Quest const* qInfo, bool msg) if (GetQuestStatus(exclude_Id) != QUEST_STATUS_NONE || (!(qInfo->IsRepeatable() && Nquest->IsRepeatable()) && (m_RewardedQuests.find(exclude_Id) != m_RewardedQuests.end()))) { if (msg) + { SendCanTakeQuestResponse(INVALIDREASON_DONT_HAVE_REQ); + TC_LOG_DEBUG(LOG_FILTER_GENERAL, "SatisfyQuestExclusiveGroup: Sent INVALIDREASON_DONT_HAVE_REQ (questId: %u) because player already did quest in exclusive group.", qInfo->GetQuestId()); + } return false; } } @@ -15662,7 +15712,10 @@ bool Player::SatisfyQuestNextChain(Quest const* qInfo, bool msg) if (GetQuestStatus(nextQuest) != QUEST_STATUS_NONE) // GetQuestStatus returns QUEST_STATUS_COMPLETED for rewarded quests { if (msg) + { SendCanTakeQuestResponse(INVALIDREASON_DONT_HAVE_REQ); + TC_LOG_DEBUG(LOG_FILTER_GENERAL, "SatisfyQuestNextChain: Sent INVALIDREASON_DONT_HAVE_REQ (questId: %u) because player already did or started next quest in chain.", qInfo->GetQuestId()); + } return false; } @@ -15686,7 +15739,10 @@ bool Player::SatisfyQuestPrevChain(Quest const* qInfo, bool msg) if (itr != m_QuestStatus.end() && itr->second.Status != QUEST_STATUS_NONE) { if (msg) + { SendCanTakeQuestResponse(INVALIDREASON_DONT_HAVE_REQ); + TC_LOG_DEBUG(LOG_FILTER_GENERAL, "SatisfyQuestNextChain: Sent INVALIDREASON_DONT_HAVE_REQ (questId: %u) because player already did or started next quest in chain.", qInfo->GetQuestId()); + } return false; } @@ -15727,7 +15783,10 @@ bool Player::SatisfyQuestDay(Quest const* qInfo, bool msg) if (!have_slot) { if (msg) + { SendCanTakeQuestResponse(INVALIDREASON_DAILY_QUESTS_REMAINING); + TC_LOG_DEBUG(LOG_FILTER_GENERAL, "SatisfyQuestDay: Sent INVALIDREASON_DAILY_QUESTS_REMAINING (questId: %u) because player already did all possible quests today.", qInfo->GetQuestId()); + } return false; } @@ -16619,7 +16678,7 @@ void Player::SendQuestTimerFailed(uint32 quest_id) } } -void Player::SendCanTakeQuestResponse(uint32 msg) const +void Player::SendCanTakeQuestResponse(QuestFailedReason msg) const { WorldPacket data(SMSG_QUESTGIVER_QUEST_INVALID, 4); data << uint32(msg); diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h index c26d2d8033..2cdf89dce7 100644 --- a/src/server/game/Entities/Player/Player.h +++ b/src/server/game/Entities/Player/Player.h @@ -1420,31 +1420,30 @@ class Player : public Unit, public GridObject void MoneyChanged(uint32 value); void ReputationChanged(FactionEntry const* factionEntry); void ReputationChanged2(FactionEntry const* factionEntry); - bool HasQuestForItem(uint32 itemid) const; - bool HasQuestForGO(int32 GOId) const; + bool HasQuestForItem(uint32 itemId) const; + bool HasQuestForGO(int32 goId) const; void UpdateForQuestWorldObjects(); - bool CanShareQuest(uint32 quest_id) const; + bool CanShareQuest(uint32 questId) const; - void SendQuestComplete(uint32 quest_id); + void SendQuestComplete(uint32 questId); void SendQuestReward(Quest const* quest, uint32 XP); void SendQuestFailed(uint32 questId, InventoryResult reason = EQUIP_ERR_OK); - void SendQuestTimerFailed(uint32 quest_id); - void SendCanTakeQuestResponse(uint32 msg) const; + void SendQuestTimerFailed(uint32 questId); + void SendCanTakeQuestResponse(QuestFailedReason msg) const; void SendQuestConfirmAccept(Quest const* quest, Player* pReceiver); void SendPushToPartyResponse(Player* player, uint8 msg); - void SendQuestUpdateAddItem(Quest const* quest, uint32 item_idx, uint16 count); - void SendQuestUpdateAddCreatureOrGo(Quest const* quest, uint64 guid, uint32 creatureOrGO_idx, uint16 old_count, uint16 add_count); - void SendQuestUpdateAddPlayer(Quest const* quest, uint16 old_count, uint16 add_count); + void SendQuestUpdateAddItem(Quest const* quest, uint32 itemIdx, uint16 count); + void SendQuestUpdateAddCreatureOrGo(Quest const* quest, uint64 guid, uint32 creatureOrGOIdx, uint16 oldCount, uint16 addCount); + void SendQuestUpdateAddPlayer(Quest const* quest, uint16 oldCount, uint16 addCount); - uint64 GetDivider() { return m_divider; } + uint64 GetDivider() const { return m_divider; } void SetDivider(uint64 guid) { m_divider = guid; } - uint32 GetInGameTime() { return m_ingametime; } - + uint32 GetInGameTime() const { return m_ingametime; } void SetInGameTime(uint32 time) { m_ingametime = time; } - void AddTimedQuest(uint32 quest_id) { m_timedquests.insert(quest_id); } - void RemoveTimedQuest(uint32 quest_id) { m_timedquests.erase(quest_id); } + void AddTimedQuest(uint32 questId) { m_timedquests.insert(questId); } + void RemoveTimedQuest(uint32 questId) { m_timedquests.erase(questId); } bool HasPvPForcingQuest() const; diff --git a/src/server/game/Quests/QuestDef.h b/src/server/game/Quests/QuestDef.h index a447f4a8f5..8c2bbc192b 100644 --- a/src/server/game/Quests/QuestDef.h +++ b/src/server/game/Quests/QuestDef.h @@ -43,7 +43,7 @@ class ObjectMgr; #define QUEST_EMOTE_COUNT 4 #define QUEST_PVP_KILL_SLOT 0 -enum QuestFailedReasons +enum QuestFailedReason { INVALIDREASON_DONT_HAVE_REQ = 0, INVALIDREASON_QUEST_FAILED_LOW_LEVEL = 1, // You are not high enough level for that quest. diff --git a/src/server/scripts/Commands/cs_debug.cpp b/src/server/scripts/Commands/cs_debug.cpp index f6ee0faaa3..c01a8e9555 100644 --- a/src/server/scripts/Commands/cs_debug.cpp +++ b/src/server/scripts/Commands/cs_debug.cpp @@ -505,7 +505,7 @@ public: static bool HandleDebugSendQuestInvalidMsgCommand(ChatHandler* handler, char const* args) { - uint32 msg = atol((char*)args); + QuestFailedReason msg = static_cast(atol((char*)args)); handler->GetSession()->GetPlayer()->SendCanTakeQuestResponse(msg); return true; } From 795e9327f708abd6a6943a4864b7f9a7358e5ae2 Mon Sep 17 00:00:00 2001 From: Vincent-Michael Date: Sun, 11 Aug 2013 18:19:17 +0200 Subject: [PATCH 7/8] Core/Spells: Fix hunter talent "Rapid Killing" Close #1166 --- src/server/game/Spells/SpellMgr.cpp | 2 ++ .../TrialOfTheChampion/boss_argent_challenge.cpp | 7 ++----- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp index 63827c1110..6c90aabf48 100644 --- a/src/server/game/Spells/SpellMgr.cpp +++ b/src/server/game/Spells/SpellMgr.cpp @@ -3101,6 +3101,8 @@ void SpellMgr::LoadSpellInfoCorrections() case 20335: // Heart of the Crusader case 20336: case 20337: + case 53228: // Rapid Killing (Rank 1) + case 53232: // Rapid Killing (Rank 2) case 63320: // Glyph of Life Tap // Entries were not updated after spell effect change, we have to do that manually :/ spellInfo->AttributesEx3 |= SPELL_ATTR3_CAN_PROC_WITH_TRIGGERED; diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_argent_challenge.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_argent_challenge.cpp index 0f8e9de89b..9d7a3c17b1 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_argent_challenge.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_argent_challenge.cpp @@ -73,7 +73,7 @@ enum Spells SPELL_CONFESS = 66680, SPELL_SUMMON_MEMORY = 66545, - // Merory of X (Summon) + // Memory of X (Summon) SPELL_MEMORY_ALGALON = 66715, SPELL_MEMORY_ARCHIMONDE = 66704, SPELL_MEMORY_CHROMAGGUS = 66697, @@ -652,10 +652,7 @@ class spell_paletress_summon_memory : public SpellScriptLoader void HandleScript(SpellEffIndex /*effIndex*/) { - Unit* caster = GetCaster(); - - if (Player* target = GetHitPlayer()) - caster->CastSpell(target, memorySpellId[urand(0, 24)], true); + GetHitUnit()->CastSpell(GetHitUnit(), memorySpellId[urand(0, 24)], true, NULL, NULL, GetCaster()->GetGUID()); } void Register() OVERRIDE From eefdceea71135c6b281d181233da04159e63b179 Mon Sep 17 00:00:00 2001 From: Vincent-Michael Date: Sun, 11 Aug 2013 18:26:53 +0200 Subject: [PATCH 8/8] Core/Spells: Fix client crash on pressing ESC at Using Steam Tonk Controller / Steam Tonk Controller Closes #3010 --- src/server/game/Spells/SpellMgr.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp index 6c90aabf48..24bd19d2d2 100644 --- a/src/server/game/Spells/SpellMgr.cpp +++ b/src/server/game/Spells/SpellMgr.cpp @@ -2819,10 +2819,6 @@ void SpellMgr::LoadSpellInfoCustomAttributes() switch (spellInfo->Id) { - case 60256: - //Crashes client on pressing ESC (Maybe because of ReqSpellFocus and GameObject) - spellInfo->AttributesEx4 &= ~SPELL_ATTR4_TRIGGERED; - break; case 1776: // Gouge case 1777: case 8629: @@ -3104,7 +3100,7 @@ void SpellMgr::LoadSpellInfoCorrections() case 53228: // Rapid Killing (Rank 1) case 53232: // Rapid Killing (Rank 2) case 63320: // Glyph of Life Tap - // Entries were not updated after spell effect change, we have to do that manually :/ + // Entries were not updated after spell effect change, we have to do that manually :/ spellInfo->AttributesEx3 |= SPELL_ATTR3_CAN_PROC_WITH_TRIGGERED; break; case 59725: // Improved Spell Reflection - aoe aura @@ -3737,6 +3733,13 @@ void SpellMgr::LoadSpellInfoCorrections() break; case 24314: // Threatening Gaze spellInfo->AuraInterruptFlags |= AURA_INTERRUPT_FLAG_CAST | AURA_INTERRUPT_FLAG_MOVE | AURA_INTERRUPT_FLAG_JUMP; + break; + case 45257: // Using Steam Tonk Controller + case 45440: // Steam Tonk Controller + case 60256: // Collect Sample + // Crashes client on pressing ESC + spellInfo->AttributesEx4 &= ~SPELL_ATTR4_TRIGGERED; + break; default: break; }