Skip to content

Commit

Permalink
[12013] Implement SpellEffect 150 as SPELL_EFFECT_QUEST_OFFER
Browse files Browse the repository at this point in the history
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
DomGries authored and Schmoozerd committed Jun 22, 2012
1 parent add0bd3 commit e8cdc98
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 15 deletions.
8 changes: 4 additions & 4 deletions src/game/QuestHandler.cpp
Expand Up @@ -123,10 +123,10 @@ void WorldSession::HandleQuestgiverAcceptQuestOpcode(WorldPacket & recv_data)


Object* pObject = _player->GetObjectByTypeMask(guid, TYPEMASK_CREATURE_GAMEOBJECT_PLAYER_OR_ITEM); Object* pObject = _player->GetObjectByTypeMask(guid, TYPEMASK_CREATURE_GAMEOBJECT_PLAYER_OR_ITEM);


// no or incorrect quest giver // no or incorrect quest giver (player himself is questgiver for SPELL_EFFECT_QUEST_OFFER)
if(!pObject if (!pObject
|| (pObject->GetTypeId()!=TYPEID_PLAYER && !pObject->HasQuest(quest)) || (pObject->GetTypeId() != TYPEID_PLAYER && !pObject->HasQuest(quest))
|| (pObject->GetTypeId()==TYPEID_PLAYER && !((Player*)pObject)->CanShareQuest(quest)) || (pObject->GetTypeId() == TYPEID_PLAYER && pObject != _player && !((Player*)pObject)->CanShareQuest(quest))
) )
{ {
_player->PlayerTalkClass->CloseGossip(); _player->PlayerTalkClass->CloseGossip();
Expand Down
2 changes: 1 addition & 1 deletion src/game/SharedDefines.h
Expand Up @@ -744,7 +744,7 @@ enum SpellEffects
SPELL_EFFECT_QUEST_FAIL = 147, SPELL_EFFECT_QUEST_FAIL = 147,
SPELL_EFFECT_148 = 148, SPELL_EFFECT_148 = 148,
SPELL_EFFECT_CHARGE2 = 149, SPELL_EFFECT_CHARGE2 = 149,
SPELL_EFFECT_150 = 150, SPELL_EFFECT_QUEST_OFFER = 150,
SPELL_EFFECT_TRIGGER_SPELL_2 = 151, SPELL_EFFECT_TRIGGER_SPELL_2 = 151,
SPELL_EFFECT_152 = 152, SPELL_EFFECT_152 = 152,
SPELL_EFFECT_CREATE_PET = 153, SPELL_EFFECT_CREATE_PET = 153,
Expand Down
1 change: 1 addition & 0 deletions src/game/Spell.h
Expand Up @@ -342,6 +342,7 @@ class Spell
void EffectKillCreditPersonal(SpellEffectIndex eff_idx); void EffectKillCreditPersonal(SpellEffectIndex eff_idx);
void EffectKillCreditGroup(SpellEffectIndex eff_idx); void EffectKillCreditGroup(SpellEffectIndex eff_idx);
void EffectQuestFail(SpellEffectIndex eff_idx); void EffectQuestFail(SpellEffectIndex eff_idx);
void EffectQuestOffer(SpellEffectIndex eff_idx);
void EffectActivateRune(SpellEffectIndex eff_idx); void EffectActivateRune(SpellEffectIndex eff_idx);
void EffectTeachTaxiNode(SpellEffectIndex eff_idx); void EffectTeachTaxiNode(SpellEffectIndex eff_idx);
void EffectTitanGrip(SpellEffectIndex eff_idx); void EffectTitanGrip(SpellEffectIndex eff_idx);
Expand Down
30 changes: 21 additions & 9 deletions src/game/SpellEffects.cpp
Expand Up @@ -210,7 +210,7 @@ pEffect SpellEffects[TOTAL_SPELL_EFFECTS]=
&Spell::EffectQuestFail, //147 SPELL_EFFECT_QUEST_FAIL quest fail &Spell::EffectQuestFail, //147 SPELL_EFFECT_QUEST_FAIL quest fail
&Spell::EffectNULL, //148 SPELL_EFFECT_148 single spell: Inflicts Fire damage to an enemy. &Spell::EffectNULL, //148 SPELL_EFFECT_148 single spell: Inflicts Fire damage to an enemy.
&Spell::EffectCharge2, //149 SPELL_EFFECT_CHARGE2 swoop &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::EffectTriggerRitualOfSummoning, //151 SPELL_EFFECT_TRIGGER_SPELL_2
&Spell::EffectNULL, //152 SPELL_EFFECT_152 summon Refer-a-Friend &Spell::EffectNULL, //152 SPELL_EFFECT_152 summon Refer-a-Friend
&Spell::EffectNULL, //153 SPELL_EFFECT_CREATE_PET misc value is creature entry &Spell::EffectNULL, //153 SPELL_EFFECT_CREATE_PET misc value is creature entry
Expand Down Expand Up @@ -9588,21 +9588,19 @@ void Spell::EffectBind(SpellEffectIndex eff_idx)


void Spell::EffectRestoreItemCharges( SpellEffectIndex eff_idx ) void Spell::EffectRestoreItemCharges( SpellEffectIndex eff_idx )
{ {
if (unitTarget->GetTypeId() != TYPEID_PLAYER) if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER)
return; return;


Player* player = (Player*)unitTarget;

ItemPrototype const* itemProto = ObjectMgr::GetItemPrototype(m_spellInfo->EffectItemType[eff_idx]); ItemPrototype const* itemProto = ObjectMgr::GetItemPrototype(m_spellInfo->EffectItemType[eff_idx]);
if (!itemProto) if (!itemProto)
return; return;


// In case item from limited category recharge any from category, is this valid checked early in spell checks // In case item from limited category recharge any from category, is this valid checked early in spell checks
Item* item; Item* item;
if (itemProto->ItemLimitCategory) if (itemProto->ItemLimitCategory)
item = player->GetItemByLimitedCategory(itemProto->ItemLimitCategory); item = ((Player*)unitTarget)->GetItemByLimitedCategory(itemProto->ItemLimitCategory);
else else
item = player->GetItemByEntry(m_spellInfo->EffectItemType[eff_idx]); item = ((Player*)unitTarget)->GetItemByEntry(m_spellInfo->EffectItemType[eff_idx]);


if (!item) if (!item)
return; return;
Expand All @@ -9624,15 +9622,15 @@ void Spell::EffectRedirectThreat(SpellEffectIndex eff_idx)


void Spell::EffectTeachTaxiNode( SpellEffectIndex eff_idx ) void Spell::EffectTeachTaxiNode( SpellEffectIndex eff_idx )
{ {
if (unitTarget->GetTypeId() != TYPEID_PLAYER) if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER)
return; return;


Player* player = (Player*)unitTarget;

uint32 taxiNodeId = m_spellInfo->EffectMiscValue[eff_idx]; uint32 taxiNodeId = m_spellInfo->EffectMiscValue[eff_idx];
if (!sTaxiNodesStore.LookupEntry(taxiNodeId)) if (!sTaxiNodesStore.LookupEntry(taxiNodeId))
return; return;


Player* player = (Player*)unitTarget;

if (player->m_taxi.SetTaximaskNode(taxiNodeId)) if (player->m_taxi.SetTaximaskNode(taxiNodeId))
{ {
WorldPacket data(SMSG_NEW_TAXI_PATH, 0); WorldPacket data(SMSG_NEW_TAXI_PATH, 0);
Expand All @@ -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) void Spell::EffectCancelAura(SpellEffectIndex eff_idx)
{ {
if (!unitTarget) if (!unitTarget)
Expand Down
2 changes: 1 addition & 1 deletion src/shared/revision_nr.h
@@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__ #ifndef __REVISION_NR_H__
#define __REVISION_NR_H__ #define __REVISION_NR_H__
#define REVISION_NR "12012" #define REVISION_NR "12013"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__

0 comments on commit e8cdc98

Please sign in to comment.