Core/ConditionMgr: added two new conditions NEAR_CREATURE and NEAR_GAMEOBJECT
--HG-- branch : trunk
This commit is contained in:
@@ -27,6 +27,7 @@
|
|||||||
#include "InstanceScript.h"
|
#include "InstanceScript.h"
|
||||||
#include "ConditionMgr.h"
|
#include "ConditionMgr.h"
|
||||||
#include "ScriptMgr.h"
|
#include "ScriptMgr.h"
|
||||||
|
#include "ScriptedCreature.h"
|
||||||
|
|
||||||
// Checks if player meets the condition
|
// Checks if player meets the condition
|
||||||
// Can have CONDITION_SOURCE_TYPE_NONE && !mReferenceId if called from a special event (ie: eventAI)
|
// Can have CONDITION_SOURCE_TYPE_NONE && !mReferenceId if called from a special event (ie: eventAI)
|
||||||
@@ -187,6 +188,16 @@ bool Condition::Meets(Player * player, Unit* invoker)
|
|||||||
condMeets = (uint32)Player::GetDrunkenstateByValue(player->GetDrunkValue()) >= mConditionValue1;
|
condMeets = (uint32)Player::GetDrunkenstateByValue(player->GetDrunkValue()) >= mConditionValue1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case CONDITION_NEAR_CREATURE:
|
||||||
|
{
|
||||||
|
condMeets = GetClosestCreatureWithEntry(player, mConditionValue1, (float)mConditionValue2) ? true : false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case CONDITION_NEAR_GAMEOBJECT:
|
||||||
|
{
|
||||||
|
condMeets = GetClosestGameObjectWithEntry(player, mConditionValue1, (float)mConditionValue2) ? true : false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
condMeets = false;
|
condMeets = false;
|
||||||
refId = 0;
|
refId = 0;
|
||||||
@@ -1344,6 +1355,24 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case CONDITION_NEAR_CREATURE:
|
||||||
|
{
|
||||||
|
if (!sCreatureStorage.LookupEntry<CreatureInfo>(cond->mConditionValue1))
|
||||||
|
{
|
||||||
|
sLog.outErrorDb("NearCreature condition has non existing creature template entry (%u), skipped", cond->mConditionValue1);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case CONDITION_NEAR_GAMEOBJECT:
|
||||||
|
{
|
||||||
|
if (!sGOStorage.LookupEntry<GameObjectInfo>(cond->mConditionValue1))
|
||||||
|
{
|
||||||
|
sLog.outErrorDb("NearGameObject condition has non existing gameobject template entry (%u), skipped", cond->mConditionValue1);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
case CONDITION_AREAID:
|
case CONDITION_AREAID:
|
||||||
case CONDITION_INSTANCE_DATA:
|
case CONDITION_INSTANCE_DATA:
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -56,7 +56,9 @@ enum ConditionType
|
|||||||
CONDITION_NOITEM = 26, // item_id bank +referenceID true if player does not have any of the item (if 'bank' is set it searches in bank slots too)
|
CONDITION_NOITEM = 26, // item_id bank +referenceID true if player does not have any of the item (if 'bank' is set it searches in bank slots too)
|
||||||
CONDITION_LEVEL = 27, // level opt +referenceID true if player's level is equal to param1 (param2 can modify the statement)
|
CONDITION_LEVEL = 27, // level opt +referenceID true if player's level is equal to param1 (param2 can modify the statement)
|
||||||
CONDITION_QUEST_COMPLETE = 28, // quest_id 0 +referenceID true if player has quest_id with all objectives complete, but not yet rewarded
|
CONDITION_QUEST_COMPLETE = 28, // quest_id 0 +referenceID true if player has quest_id with all objectives complete, but not yet rewarded
|
||||||
CONDITION_MAX = 29 // MAX
|
CONDITION_NEAR_CREATURE = 29, // creature entry distance +referenceID true if there is a creature of entry in range
|
||||||
|
CONDITION_NEAR_GAMEOBJECT = 30, // gameobject entry distance +referenceID true if there is a gameobject of entry in range
|
||||||
|
CONDITION_MAX = 31 // MAX
|
||||||
};
|
};
|
||||||
|
|
||||||
enum LevelConditionType
|
enum LevelConditionType
|
||||||
|
|||||||
Reference in New Issue
Block a user