From dca0e737deadddc97eca775937058c5cbdb45527 Mon Sep 17 00:00:00 2001 From: Nay Date: Sun, 4 Sep 2011 23:44:01 +0100 Subject: Core/Quests: Fix quests with RepObjective2 set. Closes #2901. Misc: Correct a file name, move a spell error to error log and a small typo in trinity_string --- sql/updates/world/2011_09_03_02_spell_script_names.sql | 10 ---------- .../world/2011_09_03_02_world_spell_script_names.sql | 10 ++++++++++ sql/updates/world/2011_09_04_02_world_trinity_string.sql | 1 + src/server/game/Entities/Creature/GossipDef.cpp | 2 +- src/server/game/Entities/Player/Player.cpp | 14 ++++++++++---- src/server/game/Globals/ObjectMgr.cpp | 8 ++++---- src/server/game/Spells/Spell.cpp | 2 +- 7 files changed, 27 insertions(+), 20 deletions(-) delete mode 100644 sql/updates/world/2011_09_03_02_spell_script_names.sql create mode 100644 sql/updates/world/2011_09_03_02_world_spell_script_names.sql create mode 100644 sql/updates/world/2011_09_04_02_world_trinity_string.sql diff --git a/sql/updates/world/2011_09_03_02_spell_script_names.sql b/sql/updates/world/2011_09_03_02_spell_script_names.sql deleted file mode 100644 index b7b6907b7f1..00000000000 --- a/sql/updates/world/2011_09_03_02_spell_script_names.sql +++ /dev/null @@ -1,10 +0,0 @@ -DELETE FROM `spell_script_names` WHERE `spell_id` IN (65879,65916,67244,67245,67246,67248,67249,67250); -INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES -(65879, 'spell_power_of_the_twins'), -(65916, 'spell_power_of_the_twins'), -(67244, 'spell_power_of_the_twins'), -(67245, 'spell_power_of_the_twins'), -(67246, 'spell_power_of_the_twins'), -(67248, 'spell_power_of_the_twins'), -(67249, 'spell_power_of_the_twins'), -(67250, 'spell_power_of_the_twins'); diff --git a/sql/updates/world/2011_09_03_02_world_spell_script_names.sql b/sql/updates/world/2011_09_03_02_world_spell_script_names.sql new file mode 100644 index 00000000000..b7b6907b7f1 --- /dev/null +++ b/sql/updates/world/2011_09_03_02_world_spell_script_names.sql @@ -0,0 +1,10 @@ +DELETE FROM `spell_script_names` WHERE `spell_id` IN (65879,65916,67244,67245,67246,67248,67249,67250); +INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES +(65879, 'spell_power_of_the_twins'), +(65916, 'spell_power_of_the_twins'), +(67244, 'spell_power_of_the_twins'), +(67245, 'spell_power_of_the_twins'), +(67246, 'spell_power_of_the_twins'), +(67248, 'spell_power_of_the_twins'), +(67249, 'spell_power_of_the_twins'), +(67250, 'spell_power_of_the_twins'); diff --git a/sql/updates/world/2011_09_04_02_world_trinity_string.sql b/sql/updates/world/2011_09_04_02_world_trinity_string.sql new file mode 100644 index 00000000000..36722947feb --- /dev/null +++ b/sql/updates/world/2011_09_04_02_world_trinity_string.sql @@ -0,0 +1 @@ +UPDATE `trinity_string` SET `content_default`='Faction %s (%u) can''t have reputation.' WHERE `entry`=326; -- can'nt -> can't diff --git a/src/server/game/Entities/Creature/GossipDef.cpp b/src/server/game/Entities/Creature/GossipDef.cpp index e17f8163bff..0d91b476fdd 100755 --- a/src/server/game/Entities/Creature/GossipDef.cpp +++ b/src/server/game/Entities/Creature/GossipDef.cpp @@ -441,7 +441,7 @@ void PlayerMenu::SendQuestQueryResponse(Quest const* quest) const data << uint32(quest->GetRepObjectiveFaction()); // shown in quest log as part of quest objective data << uint32(quest->GetRepObjectiveValue()); // shown in quest log as part of quest objective - data << uint32(quest->GetRepObjectiveFaction2()); // shown in quest log as part of quest objective OPOSITE faction + data << uint32(quest->GetRepObjectiveFaction2()); // shown in quest log as part of quest objective OPPOSITE faction data << uint32(quest->GetRepObjectiveValue2()); // shown in quest log as part of quest objective OPPOSITE faction data << uint32(quest->GetNextQuestInChain()); // client will request this quest from NPC, if not 0 diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 7052615e9c1..e0adb99bc37 100755 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -14630,10 +14630,6 @@ bool Player::CanCompleteQuest(uint32 quest_id) if (repFacId && GetReputationMgr().GetReputation(repFacId) < qInfo->GetRepObjectiveValue()) return false; - uint32 repFacId2 = qInfo->GetRepObjectiveFaction2(); - if (repFacId2 && GetReputationMgr().GetReputation(repFacId2) < qInfo->GetRepObjectiveValue2()) - return false; - return true; } } @@ -15266,6 +15262,16 @@ bool Player::SatisfyQuestReputation(Quest const* qInfo, bool msg) SendCanTakeQuestResponse(INVALIDREASON_DONT_HAVE_REQ); return false; } + + // ReputationObjective2 does not seem to be an objective requirement but a requirement + // to be able to accept the quest + uint32 fIdObj = qInfo->GetRepObjectiveFaction2(); + if (fIdObj && GetReputationMgr().GetReputation(fIdObj) >= qInfo->GetRepObjectiveValue2()) + { + if (msg) + SendCanTakeQuestResponse(INVALIDREASON_DONT_HAVE_REQ); + return false; + } return true; } diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index e1b37c121a7..62b2ce0c440 100755 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -3931,28 +3931,28 @@ void ObjectMgr::LoadQuests() // no changes, quest can't be done for this requirement } - if (!qinfo->RepObjectiveFaction && qinfo->RepObjectiveValue > 0) + if (!qinfo->RepObjectiveFaction && qinfo->RepObjectiveValue != 0) { sLog->outErrorDb("Quest %u has `RepObjectiveValue` = %d but `RepObjectiveFaction` is 0, value has no effect", qinfo->GetQuestId(), qinfo->RepObjectiveValue); // warning } - if (!qinfo->RepObjectiveFaction2 && qinfo->RepObjectiveValue2 > 0) + if (!qinfo->RepObjectiveFaction2 && qinfo->RepObjectiveValue2 != 0) { sLog->outErrorDb("Quest %u has `RepObjectiveValue2` = %d but `RepObjectiveFaction2` is 0, value has no effect", qinfo->GetQuestId(), qinfo->RepObjectiveValue2); // warning } - if (!qinfo->RequiredMinRepFaction && qinfo->RequiredMinRepValue > 0) + if (!qinfo->RequiredMinRepFaction && qinfo->RequiredMinRepValue != 0) { sLog->outErrorDb("Quest %u has `RequiredMinRepValue` = %d but `RequiredMinRepFaction` is 0, value has no effect", qinfo->GetQuestId(), qinfo->RequiredMinRepValue); // warning } - if (!qinfo->RequiredMaxRepFaction && qinfo->RequiredMaxRepValue > 0) + if (!qinfo->RequiredMaxRepFaction && qinfo->RequiredMaxRepValue != 0) { sLog->outErrorDb("Quest %u has `RequiredMaxRepValue` = %d but `RequiredMaxRepFaction` is 0, value has no effect", qinfo->GetQuestId(), qinfo->RequiredMaxRepValue); diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index 27ba070be0f..5642df13d8a 100755 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -2335,7 +2335,7 @@ void Spell::SelectEffectTargets(uint32 i, SpellImplicitTargetInfo const& cur) } else { - sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "SPELL: unknown target coordinates for spell ID %u", m_spellInfo->Id); + sLog->outError("SPELL: unknown target coordinates for spell ID %u", m_spellInfo->Id); Unit* target = NULL; if (uint64 guid = m_caster->GetUInt64Value(UNIT_FIELD_TARGET)) target = ObjectAccessor::GetUnit(*m_caster, guid); -- cgit v1.2.3