mirror of
https://github.com/mangosfour/server.git
synced 2025-12-14 07:37:01 +00:00
[8135] Cast quest rewarded spells after mark spell as completed.
Some spell have spell_area requirement for cast (for later re-apply)
This commit is contained in:
parent
ef6b3f978d
commit
5d8bd14d38
2 changed files with 30 additions and 28 deletions
|
|
@ -12539,7 +12539,7 @@ void Player::RewardQuest( Quest const *pQuest, uint32 reward, Object* questGiver
|
|||
|
||||
for (int i = 0; i < QUEST_OBJECTIVES_COUNT; ++i )
|
||||
{
|
||||
if ( pQuest->ReqItemId[i] )
|
||||
if (pQuest->ReqItemId[i])
|
||||
DestroyItemCount( pQuest->ReqItemId[i], pQuest->ReqItemCount[i], true);
|
||||
}
|
||||
|
||||
|
|
@ -12547,12 +12547,12 @@ void Player::RewardQuest( Quest const *pQuest, uint32 reward, Object* questGiver
|
|||
// SetTimedQuest( 0 );
|
||||
m_timedquests.erase(pQuest->GetQuestId());
|
||||
|
||||
if ( pQuest->GetRewChoiceItemsCount() > 0 )
|
||||
if (pQuest->GetRewChoiceItemsCount() > 0)
|
||||
{
|
||||
if( pQuest->RewChoiceItemId[reward] )
|
||||
if (pQuest->RewChoiceItemId[reward])
|
||||
{
|
||||
ItemPosCountVec dest;
|
||||
if( CanStoreNewItem( NULL_BAG, NULL_SLOT, dest, pQuest->RewChoiceItemId[reward], pQuest->RewChoiceItemCount[reward] ) == EQUIP_ERR_OK )
|
||||
if (CanStoreNewItem( NULL_BAG, NULL_SLOT, dest, pQuest->RewChoiceItemId[reward], pQuest->RewChoiceItemCount[reward] ) == EQUIP_ERR_OK)
|
||||
{
|
||||
Item* item = StoreNewItem( dest, pQuest->RewChoiceItemId[reward], true);
|
||||
SendNewItem(item, pQuest->RewChoiceItemCount[reward], true, false);
|
||||
|
|
@ -12560,14 +12560,14 @@ void Player::RewardQuest( Quest const *pQuest, uint32 reward, Object* questGiver
|
|||
}
|
||||
}
|
||||
|
||||
if ( pQuest->GetRewItemsCount() > 0 )
|
||||
if (pQuest->GetRewItemsCount() > 0)
|
||||
{
|
||||
for (uint32 i=0; i < pQuest->GetRewItemsCount(); ++i)
|
||||
{
|
||||
if( pQuest->RewItemId[i] )
|
||||
if (pQuest->RewItemId[i])
|
||||
{
|
||||
ItemPosCountVec dest;
|
||||
if( CanStoreNewItem( NULL_BAG, NULL_SLOT, dest, pQuest->RewItemId[i], pQuest->RewItemCount[i] ) == EQUIP_ERR_OK )
|
||||
if (CanStoreNewItem( NULL_BAG, NULL_SLOT, dest, pQuest->RewItemId[i], pQuest->RewItemCount[i] ) == EQUIP_ERR_OK)
|
||||
{
|
||||
Item* item = StoreNewItem( dest, pQuest->RewItemId[i], true);
|
||||
SendNewItem(item, pQuest->RewItemCount[i], true, false);
|
||||
|
|
@ -12578,13 +12578,8 @@ void Player::RewardQuest( Quest const *pQuest, uint32 reward, Object* questGiver
|
|||
|
||||
RewardReputation( pQuest );
|
||||
|
||||
if( pQuest->GetRewSpellCast() > 0 )
|
||||
CastSpell( this, pQuest->GetRewSpellCast(), true);
|
||||
else if( pQuest->GetRewSpell() > 0)
|
||||
CastSpell( this, pQuest->GetRewSpell(), true);
|
||||
|
||||
uint16 log_slot = FindQuestSlot( quest_id );
|
||||
if( log_slot < MAX_QUEST_LOG_SIZE)
|
||||
if (log_slot < MAX_QUEST_LOG_SIZE)
|
||||
SetQuestSlot(log_slot,0);
|
||||
|
||||
QuestStatusData& q_status = mQuestStatus[quest_id];
|
||||
|
|
@ -12592,7 +12587,7 @@ void Player::RewardQuest( Quest const *pQuest, uint32 reward, Object* questGiver
|
|||
// Not give XP in case already completed once repeatable quest
|
||||
uint32 XP = q_status.m_rewarded ? 0 : uint32(pQuest->XPValue( this )*sWorld.getRate(RATE_XP_QUEST));
|
||||
|
||||
if ( getLevel() < sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL) )
|
||||
if (getLevel() < sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL))
|
||||
GiveXP( XP , NULL );
|
||||
else
|
||||
{
|
||||
|
|
@ -12602,33 +12597,33 @@ void Player::RewardQuest( Quest const *pQuest, uint32 reward, Object* questGiver
|
|||
}
|
||||
|
||||
// Give player extra money if GetRewOrReqMoney > 0 and get ReqMoney if negative
|
||||
if(pQuest->GetRewOrReqMoney())
|
||||
if (pQuest->GetRewOrReqMoney())
|
||||
{
|
||||
ModifyMoney( pQuest->GetRewOrReqMoney() );
|
||||
|
||||
if(pQuest->GetRewOrReqMoney() > 0)
|
||||
if (pQuest->GetRewOrReqMoney() > 0)
|
||||
GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_MONEY_FROM_QUEST_REWARD, pQuest->GetRewOrReqMoney());
|
||||
}
|
||||
|
||||
// honor reward
|
||||
if(pQuest->GetRewHonorableKills())
|
||||
if (pQuest->GetRewHonorableKills())
|
||||
RewardHonor(NULL, 0, MaNGOS::Honor::hk_honor_at_level(getLevel(), pQuest->GetRewHonorableKills()));
|
||||
|
||||
// title reward
|
||||
if(pQuest->GetCharTitleId())
|
||||
if (pQuest->GetCharTitleId())
|
||||
{
|
||||
if(CharTitlesEntry const* titleEntry = sCharTitlesStore.LookupEntry(pQuest->GetCharTitleId()))
|
||||
if (CharTitlesEntry const* titleEntry = sCharTitlesStore.LookupEntry(pQuest->GetCharTitleId()))
|
||||
SetTitle(titleEntry);
|
||||
}
|
||||
|
||||
if(pQuest->GetBonusTalents())
|
||||
if (pQuest->GetBonusTalents())
|
||||
{
|
||||
m_questRewardTalentCount+=pQuest->GetBonusTalents();
|
||||
InitTalentForLevel();
|
||||
}
|
||||
|
||||
// Send reward mail
|
||||
if(pQuest->GetRewMailTemplateId())
|
||||
if (pQuest->GetRewMailTemplateId())
|
||||
{
|
||||
MailMessageType mailType;
|
||||
uint32 senderGuidOrEntry;
|
||||
|
|
@ -12666,9 +12661,9 @@ void Player::RewardQuest( Quest const *pQuest, uint32 reward, Object* questGiver
|
|||
uint32 max_slot = questMailLoot.GetMaxSlotInLootFor(this);
|
||||
for(uint32 i = 0; mi.size() < MAX_MAIL_ITEMS && i < max_slot; ++i)
|
||||
{
|
||||
if(LootItem* lootitem = questMailLoot.LootItemInSlot(i,this))
|
||||
if (LootItem* lootitem = questMailLoot.LootItemInSlot(i,this))
|
||||
{
|
||||
if(Item* item = Item::CreateItem(lootitem->itemid,lootitem->count,this))
|
||||
if (Item* item = Item::CreateItem(lootitem->itemid,lootitem->count,this))
|
||||
{
|
||||
item->SaveToDB(); // save for prevent lost at next mail load, if send fail then item will deleted
|
||||
mi.AddItem(item->GetGUIDLow(), item->GetEntry(), item);
|
||||
|
|
@ -12679,23 +12674,30 @@ void Player::RewardQuest( Quest const *pQuest, uint32 reward, Object* questGiver
|
|||
WorldSession::SendMailTo(this, mailType, MAIL_STATIONERY_NORMAL, senderGuidOrEntry, GetGUIDLow(), "", 0, &mi, 0, 0, MAIL_CHECK_MASK_NONE,pQuest->GetRewMailDelaySecs(),pQuest->GetRewMailTemplateId());
|
||||
}
|
||||
|
||||
if(pQuest->IsDaily())
|
||||
if (pQuest->IsDaily())
|
||||
{
|
||||
SetDailyQuestStatus(quest_id);
|
||||
GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_DAILY_QUEST, 1);
|
||||
}
|
||||
|
||||
if ( !pQuest->IsRepeatable() )
|
||||
if (!pQuest->IsRepeatable())
|
||||
SetQuestStatus(quest_id, QUEST_STATUS_COMPLETE);
|
||||
else
|
||||
SetQuestStatus(quest_id, QUEST_STATUS_NONE);
|
||||
|
||||
q_status.m_rewarded = true;
|
||||
if (q_status.uState != QUEST_NEW)
|
||||
q_status.uState = QUEST_CHANGED;
|
||||
|
||||
if(announce)
|
||||
if (announce)
|
||||
SendQuestReward( pQuest, XP, questGiver );
|
||||
|
||||
if (q_status.uState != QUEST_NEW) q_status.uState = QUEST_CHANGED;
|
||||
// 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);
|
||||
else if ( pQuest->GetRewSpell() > 0)
|
||||
CastSpell( this, pQuest->GetRewSpell(), true);
|
||||
|
||||
if (pQuest->GetZoneOrSort() > 0)
|
||||
GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUESTS_IN_ZONE, pQuest->GetZoneOrSort());
|
||||
GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUEST_COUNT);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue