mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-17 02:50:29 +00:00
feat(conditions): prevent adding bad contitions + align enums with TC (#1381)
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
INSERT INTO `version_db_world` (`sql_rev`) VALUES ('1548704473723698729');
|
||||
|
||||
-- CONDITION_QUEST_SATISFY_EXCLUSIVE
|
||||
UPDATE `conditions` SET ConditionTypeOrReference = 101 WHERE ConditionTypeOrReference = 50;
|
||||
|
||||
-- CONDITION_HAS_AURA_TYPE
|
||||
UPDATE `conditions` SET ConditionTypeOrReference = 102 WHERE ConditionTypeOrReference = 51;
|
||||
@@ -1242,6 +1242,13 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond)
|
||||
|
||||
switch (cond->SourceType)
|
||||
{
|
||||
case CONDITION_SOURCE_TYPE_TERRAIN_SWAP:
|
||||
case CONDITION_SOURCE_TYPE_PHASE:
|
||||
case CONDITION_SOURCE_TYPE_GRAVEYARD:
|
||||
{
|
||||
sLog->outErrorDb("ConditionSourceType %u in `condition` table is not supported on 3.3.5a, ignoring.", uint32(cond->SourceType));
|
||||
return false;
|
||||
}
|
||||
case CONDITION_SOURCE_TYPE_CREATURE_LOOT_TEMPLATE:
|
||||
{
|
||||
if (!LootTemplates_Creature.HaveLootFor(cond->SourceGroup))
|
||||
@@ -1577,11 +1584,6 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond)
|
||||
}
|
||||
break;
|
||||
}
|
||||
case CONDITION_SOURCE_TYPE_PHASE_DEFINITION:
|
||||
{
|
||||
sLog->outError("CONDITION_SOURCE_TYPE_PHASE_DEFINITION:: is only for 4.3.4 branch, skipped");
|
||||
return false;
|
||||
}
|
||||
case CONDITION_SOURCE_TYPE_GOSSIP_MENU:
|
||||
case CONDITION_SOURCE_TYPE_GOSSIP_MENU_OPTION:
|
||||
case CONDITION_SOURCE_TYPE_SMART_EVENT:
|
||||
@@ -1594,11 +1596,34 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond)
|
||||
}
|
||||
bool ConditionMgr::isConditionTypeValid(Condition* cond)
|
||||
{
|
||||
if (cond->ConditionType == CONDITION_NONE || cond->ConditionType >= CONDITION_MAX)
|
||||
if (cond->ConditionType == CONDITION_NONE
|
||||
|| (cond->ConditionType >= CONDITION_TC_END && cond->ConditionType <= CONDITION_AC_START)
|
||||
|| (cond->ConditionType >= CONDITION_AC_END)
|
||||
)
|
||||
{
|
||||
sLog->outErrorDb("Invalid ConditionType %u at SourceEntry %u in `condition` table, ignoring.", uint32(cond->ConditionType), cond->SourceEntry);
|
||||
sLog->outErrorDb("SourceEntry %u in `condition` table has an invalid ConditionType (%u), ignoring.",
|
||||
cond->SourceEntry, uint32(cond->ConditionType));
|
||||
return false;
|
||||
}
|
||||
switch (cond->ConditionType) {
|
||||
case CONDITION_TERRAIN_SWAP:
|
||||
case CONDITION_QUEST_OBJECTIVE_COMPLETE:
|
||||
case CONDITION_DIFFICULTY_ID:
|
||||
sLog->outErrorDb("SourceEntry %u in `condition` table has a ConditionType that is not supported on 3.3.5a (%u), ignoring.",
|
||||
cond->SourceEntry, uint32(cond->ConditionType));
|
||||
return false;
|
||||
case CONDITION_STAND_STATE:
|
||||
case CONDITION_DAILY_QUEST_DONE:
|
||||
case CONDITION_CHARMED:
|
||||
case CONDITION_PET_TYPE:
|
||||
case CONDITION_TAXI:
|
||||
case CONDITION_QUESTSTATE:
|
||||
sLog->outErrorDb("SourceEntry %u in `condition` table has a ConditionType that is not yet supported on AzerothCore (%u), ignoring.",
|
||||
cond->SourceEntry, uint32(cond->ConditionType));
|
||||
return false;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (cond->ConditionTarget >= cond->GetMaxAvailableConditionTargets())
|
||||
{
|
||||
|
||||
@@ -62,18 +62,21 @@ enum ConditionTypes
|
||||
CONDITION_HP_PCT = 38, // hpPct ComparisonType 0 true if unit's hp matches given pct
|
||||
CONDITION_REALM_ACHIEVEMENT = 39, // achievement_id 0 0 true if realm achievement is complete
|
||||
CONDITION_IN_WATER = 40, // 0 0 0 true if unit in water
|
||||
// RESERVED = 41,
|
||||
// RESERVED = 42,
|
||||
// RESERVED = 43,
|
||||
// RESERVED = 44,
|
||||
// RESERVED = 45,
|
||||
// RESERVED = 46,
|
||||
// RESERVED = 47,
|
||||
// RESERVED = 48,
|
||||
// RESERVED = 49,
|
||||
CONDITION_QUEST_SATISFY_EXCLUSIVE = 50, // quest_id 0 0 true if satisfied exclusive group
|
||||
CONDITION_HAS_AURA_TYPE = 51, // aura_type 0 0 true if has aura type
|
||||
CONDITION_MAX = 52 // MAX
|
||||
CONDITION_TERRAIN_SWAP = 41, // don't use on 3.3.5a
|
||||
CONDITION_STAND_STATE = 42, // TODO: NOT SUPPORTED YET
|
||||
CONDITION_DAILY_QUEST_DONE = 43, // TODO: NOT SUPPORTED YET
|
||||
CONDITION_CHARMED = 44, // TODO: NOT SUPPORTED YET
|
||||
CONDITION_PET_TYPE = 45, // TODO: NOT SUPPORTED YET
|
||||
CONDITION_TAXI = 46, // TODO: NOT SUPPORTED YET
|
||||
CONDITION_QUESTSTATE = 47, // TODO: NOT SUPPORTED YET
|
||||
CONDITION_QUEST_OBJECTIVE_COMPLETE = 48, // don't use on 3.3.5a
|
||||
CONDITION_DIFFICULTY_ID = 49, // don't use on 3.3.5a
|
||||
CONDITION_TC_END = 50, // placeholder
|
||||
|
||||
CONDITION_AC_START = 100,
|
||||
CONDITION_QUEST_SATISFY_EXCLUSIVE = 101, // quest_id 0 0 true if satisfied exclusive group
|
||||
CONDITION_HAS_AURA_TYPE = 102, // aura_type 0 0 true if has aura type
|
||||
CONDITION_AC_END = 103 // placeholder
|
||||
};
|
||||
|
||||
/*! Documentation on implementing a new ConditionSourceType:
|
||||
@@ -130,8 +133,10 @@ enum ConditionSourceType
|
||||
CONDITION_SOURCE_TYPE_SMART_EVENT = 22,
|
||||
CONDITION_SOURCE_TYPE_NPC_VENDOR = 23,
|
||||
CONDITION_SOURCE_TYPE_SPELL_PROC = 24,
|
||||
CONDITION_SOURCE_TYPE_PHASE_DEFINITION = 25, // only 4.3.4
|
||||
CONDITION_SOURCE_TYPE_MAX = 26 // MAX
|
||||
CONDITION_SOURCE_TYPE_TERRAIN_SWAP = 25, // don't use on 3.3.5a
|
||||
CONDITION_SOURCE_TYPE_PHASE = 26, // don't use on 3.3.5a
|
||||
CONDITION_SOURCE_TYPE_GRAVEYARD = 27, // don't use on 3.3.5a
|
||||
CONDITION_SOURCE_TYPE_MAX = 28 // placeholder
|
||||
};
|
||||
|
||||
enum RelationType
|
||||
|
||||
Reference in New Issue
Block a user