[12013] Implement SpellEffect 150 as SPELL_EFFECT_QUEST_OFFER

The implementation is a bit vague as there are only two spells atm with this effect.

Signed-off-by: Schmoozerd <schmoozerd@scriptdev2.com>
This commit is contained in:
stfx 2012-06-22 13:10:56 +02:00 committed by Schmoozerd
parent 956e307ba1
commit 17b10b5e75
5 changed files with 28 additions and 15 deletions

View file

@ -210,7 +210,7 @@ pEffect SpellEffects[TOTAL_SPELL_EFFECTS]=
&Spell::EffectQuestFail, //147 SPELL_EFFECT_QUEST_FAIL quest fail
&Spell::EffectNULL, //148 SPELL_EFFECT_148 single spell: Inflicts Fire damage to an enemy.
&Spell::EffectCharge2, //149 SPELL_EFFECT_CHARGE2 swoop
&Spell::EffectNULL, //150 SPELL_EFFECT_150 2 spells in 3.3.2
&Spell::EffectQuestOffer, //150 SPELL_EFFECT_QUEST_OFFER
&Spell::EffectTriggerRitualOfSummoning, //151 SPELL_EFFECT_TRIGGER_SPELL_2
&Spell::EffectNULL, //152 SPELL_EFFECT_152 summon Refer-a-Friend
&Spell::EffectNULL, //153 SPELL_EFFECT_CREATE_PET misc value is creature entry
@ -9588,11 +9588,9 @@ void Spell::EffectBind(SpellEffectIndex eff_idx)
void Spell::EffectRestoreItemCharges( SpellEffectIndex eff_idx )
{
if (unitTarget->GetTypeId() != TYPEID_PLAYER)
if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER)
return;
Player* player = (Player*)unitTarget;
ItemPrototype const* itemProto = ObjectMgr::GetItemPrototype(m_spellInfo->EffectItemType[eff_idx]);
if (!itemProto)
return;
@ -9600,9 +9598,9 @@ void Spell::EffectRestoreItemCharges( SpellEffectIndex eff_idx )
// In case item from limited category recharge any from category, is this valid checked early in spell checks
Item* item;
if (itemProto->ItemLimitCategory)
item = player->GetItemByLimitedCategory(itemProto->ItemLimitCategory);
item = ((Player*)unitTarget)->GetItemByLimitedCategory(itemProto->ItemLimitCategory);
else
item = player->GetItemByEntry(m_spellInfo->EffectItemType[eff_idx]);
item = ((Player*)unitTarget)->GetItemByEntry(m_spellInfo->EffectItemType[eff_idx]);
if (!item)
return;
@ -9624,15 +9622,15 @@ void Spell::EffectRedirectThreat(SpellEffectIndex eff_idx)
void Spell::EffectTeachTaxiNode( SpellEffectIndex eff_idx )
{
if (unitTarget->GetTypeId() != TYPEID_PLAYER)
if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER)
return;
Player* player = (Player*)unitTarget;
uint32 taxiNodeId = m_spellInfo->EffectMiscValue[eff_idx];
if (!sTaxiNodesStore.LookupEntry(taxiNodeId))
return;
Player* player = (Player*)unitTarget;
if (player->m_taxi.SetTaximaskNode(taxiNodeId))
{
WorldPacket data(SMSG_NEW_TAXI_PATH, 0);
@ -9645,6 +9643,20 @@ void Spell::EffectTeachTaxiNode( SpellEffectIndex eff_idx )
}
}
void Spell::EffectQuestOffer(SpellEffectIndex eff_idx)
{
if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER)
return;
if (Quest const* quest = sObjectMgr.GetQuestTemplate(m_spellInfo->EffectMiscValue[eff_idx]))
{
Player* player = (Player*)unitTarget;
if (player->CanTakeQuest(quest, false))
player->PlayerTalkClass->SendQuestGiverQuestDetails(quest, player->GetObjectGuid(), true);
}
}
void Spell::EffectCancelAura(SpellEffectIndex eff_idx)
{
if (!unitTarget)