Permalink
Browse files

[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>
  • Loading branch information...
1 parent add0bd3 commit e8cdc98b429d257406eb94c909b35e13ec377cc9 @stfx stfx committed with Schmoozerd Jun 22, 2012
Showing with 28 additions and 15 deletions.
  1. +4 −4 src/game/QuestHandler.cpp
  2. +1 −1 src/game/SharedDefines.h
  3. +1 −0 src/game/Spell.h
  4. +21 −9 src/game/SpellEffects.cpp
  5. +1 −1 src/shared/revision_nr.h
@@ -123,10 +123,10 @@ void WorldSession::HandleQuestgiverAcceptQuestOpcode(WorldPacket & recv_data)
Object* pObject = _player->GetObjectByTypeMask(guid, TYPEMASK_CREATURE_GAMEOBJECT_PLAYER_OR_ITEM);
- // no or incorrect quest giver
- if(!pObject
- || (pObject->GetTypeId()!=TYPEID_PLAYER && !pObject->HasQuest(quest))
- || (pObject->GetTypeId()==TYPEID_PLAYER && !((Player*)pObject)->CanShareQuest(quest))
+ // no or incorrect quest giver (player himself is questgiver for SPELL_EFFECT_QUEST_OFFER)
+ if (!pObject
+ || (pObject->GetTypeId() != TYPEID_PLAYER && !pObject->HasQuest(quest))
+ || (pObject->GetTypeId() == TYPEID_PLAYER && pObject != _player && !((Player*)pObject)->CanShareQuest(quest))
)
{
_player->PlayerTalkClass->CloseGossip();
@@ -744,7 +744,7 @@ enum SpellEffects
SPELL_EFFECT_QUEST_FAIL = 147,
SPELL_EFFECT_148 = 148,
SPELL_EFFECT_CHARGE2 = 149,
- SPELL_EFFECT_150 = 150,
+ SPELL_EFFECT_QUEST_OFFER = 150,
SPELL_EFFECT_TRIGGER_SPELL_2 = 151,
SPELL_EFFECT_152 = 152,
SPELL_EFFECT_CREATE_PET = 153,
View
@@ -342,6 +342,7 @@ class Spell
void EffectKillCreditPersonal(SpellEffectIndex eff_idx);
void EffectKillCreditGroup(SpellEffectIndex eff_idx);
void EffectQuestFail(SpellEffectIndex eff_idx);
+ void EffectQuestOffer(SpellEffectIndex eff_idx);
void EffectActivateRune(SpellEffectIndex eff_idx);
void EffectTeachTaxiNode(SpellEffectIndex eff_idx);
void EffectTitanGrip(SpellEffectIndex eff_idx);
@@ -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,21 +9588,19 @@ 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;
// 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)
@@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
- #define REVISION_NR "12012"
+ #define REVISION_NR "12013"
#endif // __REVISION_NR_H__

0 comments on commit e8cdc98

Please sign in to comment.