[10938] Some adjustments to script calls OnQuestChooseReward replaced with OnQuestRewarded. Also fix compile in VC 8.0 and VC 9.0.

This commit is contained in:
zergtmn 2010-12-30 01:26:57 +05:00
parent 14c8db9c9a
commit 0b7e78d2a7
7 changed files with 58 additions and 87 deletions

View file

@ -13790,6 +13790,21 @@ void Player::RewardQuest(Quest const *pQuest, uint32 reward, Object* questGiver,
if (announce)
SendQuestReward(pQuest, XP, questGiver);
bool handled = false;
switch(questGiver->GetTypeId())
{
case TYPEID_UNIT:
handled = sScriptMgr.OnQuestRewarded(this, (Creature*)questGiver, pQuest);
break;
case TYPEID_GAMEOBJECT:
handled = sScriptMgr.OnQuestRewarded(this, (GameObject*)questGiver, pQuest);
break;
}
if (!handled && pQuest->GetQuestCompleteScript() != 0)
GetMap()->ScriptsStart(sQuestEndScripts, pQuest->GetQuestCompleteScript(), questGiver, this);
// cast spells after mark quest complete (some spells have quest completed state reqyurements in spell_area data)
if (pQuest->GetRewSpellCast() > 0)
CastSpell(this, pQuest->GetRewSpellCast(), true);
@ -14860,9 +14875,6 @@ void Player::SendQuestReward( Quest const *pQuest, uint32 XP, Object * questGive
data << uint32(pQuest->GetBonusTalents()); // bonus talents
data << uint32(0); // arena points
GetSession()->SendPacket( &data );
if (pQuest->GetQuestCompleteScript() != 0)
GetMap()->ScriptsStart(sQuestEndScripts, pQuest->GetQuestCompleteScript(), questGiver, this);
}
void Player::SendQuestFailed( uint32 quest_id, InventoryChangeFailure reason)