diff options
| author | Nay <dnpd.dd@gmail.com> | 2013-08-30 16:42:49 +0100 |
|---|---|---|
| committer | Nay <dnpd.dd@gmail.com> | 2013-08-30 19:32:08 +0100 |
| commit | 7776016106e748fee8cb3e052ec3c8e575e84a55 (patch) | |
| tree | a2a5f9df535dd7a22f90fe1e4e5fbbde5ea9e2a9 /src/server/game/Entities/Player | |
| parent | aa5bc37e9cf301b0917dc4fd319c91c13aff654d (diff) | |
Core/Quests: Remove CastedCreatureOrGO method
- Remove EAI's ACTION_T_CAST_EVENT and ACTION_T_CAST_EVENT_ALL
- Remove SAI's SMART_ACTION_CALL_CASTEDCREATUREORGO
- Split QUEST_TRINITY_FLAGS_KILL_OR_CAST into QUEST_TRINITY_FLAGS_KILL and QUEST_TRINITY_FLAGS_CAST
- Assign QUEST_TRINITY_FLAGS_CAST to all the quests that were using RequiredSpellCastX
- (unrelated) Fix a warning in Player.cpp
- Replace CastedCreatureOrGO usage in scripts by KilledMonsterCredit
TODO: Convert the two EAI scripts commented out in the .sql to proper SAI
Closes #10667
Diffstat (limited to 'src/server/game/Entities/Player')
| -rw-r--r-- | src/server/game/Entities/Player/Player.cpp | 60 | ||||
| -rw-r--r-- | src/server/game/Entities/Player/Player.h | 2 |
2 files changed, 15 insertions, 47 deletions
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 2c0d22bee29..9b381175280 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -5709,15 +5709,10 @@ void Player::HandleBaseModValue(BaseModGroup modGroup, BaseModType modType, floa return; } - switch (modType) - { - case FLAT_MOD: - m_auraBaseMod[modGroup][modType] += apply ? amount : -amount; - break; - case PCT_MOD: - ApplyPercentModFloatVar(m_auraBaseMod[modGroup][modType], amount, apply); - break; - } + if (modType == FLAT_MOD) + m_auraBaseMod[modGroup][modType] += apply ? amount : -amount; + else // PCT_MOD + ApplyPercentModFloatVar(m_auraBaseMod[modGroup][modType], amount, apply); if (!CanModifyStats()) return; @@ -14935,7 +14930,7 @@ bool Player::CanCompleteQuest(uint32 quest_id) } } - if (qInfo->HasFlag(QUEST_TRINITY_FLAGS_KILL_OR_CAST | QUEST_TRINITY_FLAGS_SPEAKTO)) + if (qInfo->HasFlag(QUEST_TRINITY_FLAGS_KILL | QUEST_TRINITY_FLAGS_CAST | QUEST_TRINITY_FLAGS_SPEAKTO)) { for (uint8 i = 0; i < QUEST_OBJECTIVES_COUNT; i++) { @@ -15090,7 +15085,7 @@ void Player::AddQuest(Quest const* quest, Object* questGiver) questStatusData.ItemCount[i] = 0; } - if (quest->HasFlag(QUEST_TRINITY_FLAGS_KILL_OR_CAST | QUEST_TRINITY_FLAGS_SPEAKTO)) + if (quest->HasFlag(QUEST_TRINITY_FLAGS_KILL | QUEST_TRINITY_FLAGS_CAST | QUEST_TRINITY_FLAGS_SPEAKTO)) { for (uint8 i = 0; i < QUEST_OBJECTIVES_COUNT; ++i) questStatusData.CreatureOrGOCount[i] = 0; @@ -16259,7 +16254,7 @@ void Player::KilledMonsterCredit(uint32 entry, uint64 guid /*= 0*/) QuestStatusData& q_status = m_QuestStatus[questid]; if (q_status.Status == QUEST_STATUS_INCOMPLETE && (!GetGroup() || !GetGroup()->isRaidGroup() || qInfo->IsAllowedInRaid(GetMap()->GetDifficulty()))) { - if (qInfo->HasFlag(QUEST_TRINITY_FLAGS_KILL_OR_CAST)) + if (qInfo->HasFlag(QUEST_TRINITY_FLAGS_KILL) /*&& !qInfo->HasFlag(QUEST_TRINITY_FLAGS_CAST)*/) { for (uint8 j = 0; j < QUEST_OBJECTIVES_COUNT; ++j) { @@ -16333,10 +16328,8 @@ void Player::KilledPlayerCredit() } } -void Player::CastedCreatureOrGO(uint32 entry, uint64 guid, uint32 spell_id) +void Player::KillCreditGO(uint32 entry, uint64 guid) { - bool isCreature = IS_CRE_OR_VEH_GUID(guid); - uint16 addCastCount = 1; for (uint8 i = 0; i < MAX_QUEST_LOG_SIZE; ++i) { @@ -16352,41 +16345,16 @@ void Player::CastedCreatureOrGO(uint32 entry, uint64 guid, uint32 spell_id) if (q_status.Status == QUEST_STATUS_INCOMPLETE) { - if (qInfo->HasFlag(QUEST_TRINITY_FLAGS_KILL_OR_CAST)) + if (qInfo->HasFlag(QUEST_TRINITY_FLAGS_CAST) /*&& !qInfo->HasFlag(QUEST_TRINITY_FLAGS_KILL)*/) { for (uint8 j = 0; j < QUEST_OBJECTIVES_COUNT; ++j) { uint32 reqTarget = 0; - if (isCreature) - { - // creature activate objectives - if (qInfo->RequiredNpcOrGo[j] > 0) - { - // checked at quest_template loading - reqTarget = qInfo->RequiredNpcOrGo[j]; - if (reqTarget != entry) // if entry doesn't match, check for killcredits referenced in template - { - CreatureTemplate const* cinfo = sObjectMgr->GetCreatureTemplate(entry); - if (!cinfo) - { - TC_LOG_ERROR(LOG_FILTER_PLAYER, "Player::CastedCreatureOrGO: GetCreatureTemplate failed for entry %u. Skipping.", entry); - continue; - } - - for (uint8 k = 0; k < MAX_KILL_CREDIT; ++k) - if (cinfo->KillCredit[k] == reqTarget) - entry = cinfo->KillCredit[k]; - } - } - } - else - { - // GO activate objective - if (qInfo->RequiredNpcOrGo[j] < 0) - // checked at quest_template loading - reqTarget = - qInfo->RequiredNpcOrGo[j]; - } + // GO activate objective + if (qInfo->RequiredNpcOrGo[j] < 0) + // checked at quest_template loading + reqTarget = - qInfo->RequiredNpcOrGo[j]; // other not this creature/GO related objectives if (reqTarget != entry) @@ -16431,7 +16399,7 @@ void Player::TalkedToCreature(uint32 entry, uint64 guid) if (q_status.Status == QUEST_STATUS_INCOMPLETE) { - if (qInfo->HasFlag(QUEST_TRINITY_FLAGS_KILL_OR_CAST | QUEST_TRINITY_FLAGS_SPEAKTO)) + if (qInfo->HasFlag(QUEST_TRINITY_FLAGS_KILL | QUEST_TRINITY_FLAGS_CAST | QUEST_TRINITY_FLAGS_SPEAKTO)) { for (uint8 j = 0; j < QUEST_OBJECTIVES_COUNT; ++j) { diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h index 9a17033de67..bac794422be 100644 --- a/src/server/game/Entities/Player/Player.h +++ b/src/server/game/Entities/Player/Player.h @@ -1416,7 +1416,7 @@ class Player : public Unit, public GridObject<Player> void KilledMonster(CreatureTemplate const* cInfo, uint64 guid); void KilledMonsterCredit(uint32 entry, uint64 guid = 0); void KilledPlayerCredit(); - void CastedCreatureOrGO(uint32 entry, uint64 guid, uint32 spell_id); + void KillCreditGO(uint32 entry, uint64 guid = 0); void TalkedToCreature(uint32 entry, uint64 guid); void MoneyChanged(uint32 value); void ReputationChanged(FactionEntry const* factionEntry); |
