mirror of
https://github.com/mangosfour/server.git
synced 2025-12-12 19:37:03 +00:00
[12044] Add CONDITION_NOT (-3) to conditions system
Signed-off-by: Schmoozerd <schmoozerd@scriptdev2.com>
This commit is contained in:
parent
c8c6418d6e
commit
a3faf136bc
3 changed files with 30 additions and 11 deletions
38
src/game/ObjectMgr.cpp
Normal file → Executable file
38
src/game/ObjectMgr.cpp
Normal file → Executable file
|
|
@ -7540,6 +7540,9 @@ bool PlayerCondition::Meets(Player const * player) const
|
|||
|
||||
switch (m_condition)
|
||||
{
|
||||
case CONDITION_NOT:
|
||||
// Checked on load
|
||||
return !sConditionStorage.LookupEntry<PlayerCondition>(m_value1)->Meets(player);
|
||||
case CONDITION_OR:
|
||||
// Checked on load
|
||||
return sConditionStorage.LookupEntry<PlayerCondition>(m_value1)->Meets(player) || sConditionStorage.LookupEntry<PlayerCondition>(m_value2)->Meets(player);
|
||||
|
|
@ -7744,29 +7747,44 @@ bool PlayerCondition::IsValid(uint16 entry, ConditionType condition, uint32 valu
|
|||
{
|
||||
switch (condition)
|
||||
{
|
||||
case CONDITION_OR:
|
||||
case CONDITION_AND:
|
||||
case CONDITION_NOT:
|
||||
{
|
||||
if (value1 >= entry)
|
||||
{
|
||||
sLog.outErrorDb("And or Or condition (entry %u, type %d) has invalid value1 %u, must be lower than entry, skipped", entry, condition, value1);
|
||||
return false;
|
||||
}
|
||||
if (value2 >= entry)
|
||||
{
|
||||
sLog.outErrorDb("And or Or condition (entry %u, type %d) has invalid value2 %u, must be lower than entry, skipped", entry, condition, value2);
|
||||
sLog.outErrorDb("CONDITION_NOT (entry %u, type %d) has invalid value1 %u, must be lower than entry, skipped", entry, condition, value1);
|
||||
return false;
|
||||
}
|
||||
const PlayerCondition* condition1 = sConditionStorage.LookupEntry<PlayerCondition>(value1);
|
||||
if (!condition1)
|
||||
{
|
||||
sLog.outErrorDb("And or Or condition (entry %u, type %d) has value1 %u without proper condition, skipped", entry, condition, value1);
|
||||
sLog.outErrorDb("CONDITION_NOT (entry %u, type %d) has value1 %u without proper condition, skipped", entry, condition, value1);
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case CONDITION_OR:
|
||||
case CONDITION_AND:
|
||||
{
|
||||
if (value1 >= entry)
|
||||
{
|
||||
sLog.outErrorDb("CONDITION _AND or _OR (entry %u, type %d) has invalid value1 %u, must be lower than entry, skipped", entry, condition, value1);
|
||||
return false;
|
||||
}
|
||||
if (value2 >= entry)
|
||||
{
|
||||
sLog.outErrorDb("CONDITION _AND or _OR (entry %u, type %d) has invalid value2 %u, must be lower than entry, skipped", entry, condition, value2);
|
||||
return false;
|
||||
}
|
||||
const PlayerCondition* condition1 = sConditionStorage.LookupEntry<PlayerCondition>(value1);
|
||||
if (!condition1)
|
||||
{
|
||||
sLog.outErrorDb("CONDITION _AND or _OR (entry %u, type %d) has value1 %u without proper condition, skipped", entry, condition, value1);
|
||||
return false;
|
||||
}
|
||||
const PlayerCondition* condition2 = sConditionStorage.LookupEntry<PlayerCondition>(value2);
|
||||
if (!condition2)
|
||||
{
|
||||
sLog.outErrorDb("And or Or condition (entry %u, type %d) has value2 %u without proper condition, skipped", entry, condition, value2);
|
||||
sLog.outErrorDb("CONDITION _AND or _OR (entry %u, type %d) has value2 %u without proper condition, skipped", entry, condition, value2);
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue