mirror of
https://github.com/mangosfour/server.git
synced 2025-12-15 19:37:02 +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)
|
switch (m_condition)
|
||||||
{
|
{
|
||||||
|
case CONDITION_NOT:
|
||||||
|
// Checked on load
|
||||||
|
return !sConditionStorage.LookupEntry<PlayerCondition>(m_value1)->Meets(player);
|
||||||
case CONDITION_OR:
|
case CONDITION_OR:
|
||||||
// Checked on load
|
// Checked on load
|
||||||
return sConditionStorage.LookupEntry<PlayerCondition>(m_value1)->Meets(player) || sConditionStorage.LookupEntry<PlayerCondition>(m_value2)->Meets(player);
|
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)
|
switch (condition)
|
||||||
{
|
{
|
||||||
case CONDITION_OR:
|
case CONDITION_NOT:
|
||||||
case CONDITION_AND:
|
|
||||||
{
|
{
|
||||||
if (value1 >= entry)
|
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);
|
sLog.outErrorDb("CONDITION_NOT (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);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
const PlayerCondition* condition1 = sConditionStorage.LookupEntry<PlayerCondition>(value1);
|
const PlayerCondition* condition1 = sConditionStorage.LookupEntry<PlayerCondition>(value1);
|
||||||
if (!condition1)
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
const PlayerCondition* condition2 = sConditionStorage.LookupEntry<PlayerCondition>(value2);
|
const PlayerCondition* condition2 = sConditionStorage.LookupEntry<PlayerCondition>(value2);
|
||||||
if (!condition2)
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
1
src/game/ObjectMgr.h
Normal file → Executable file
1
src/game/ObjectMgr.h
Normal file → Executable file
|
|
@ -338,6 +338,7 @@ typedef std::pair<GraveYardMap::const_iterator, GraveYardMap::const_iterator> Gr
|
||||||
|
|
||||||
enum ConditionType
|
enum ConditionType
|
||||||
{ // value1 value2 for the Condition enumed
|
{ // value1 value2 for the Condition enumed
|
||||||
|
CONDITION_NOT = -3, // cond-id-1 0 returns !cond-id-1
|
||||||
CONDITION_OR = -2, // cond-id-1 cond-id-2 returns cond-id-1 OR cond-id-2
|
CONDITION_OR = -2, // cond-id-1 cond-id-2 returns cond-id-1 OR cond-id-2
|
||||||
CONDITION_AND = -1, // cond-id-1 cond-id-2 returns cond-id-1 AND cond-id-2
|
CONDITION_AND = -1, // cond-id-1 cond-id-2 returns cond-id-1 AND cond-id-2
|
||||||
CONDITION_NONE = 0, // 0 0
|
CONDITION_NONE = 0, // 0 0
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "12043"
|
#define REVISION_NR "12044"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue