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
This commit is contained in:
Nay committed 2013-08-30 19:32:08 +01:00
1 parent aa5bc37e9c
commit 7776016106
16 files changed
+52 -186

No files matched your search

+14 -46
View File
@@ -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)
{