* Backed out changeset 44ff24439269
* We will implement this in a generic way using the conditions system --HG-- branch : trunk
This commit is contained in:
@@ -1,2 +0,0 @@
|
|||||||
ALTER TABLE `item_required_target`
|
|
||||||
ADD `maxPercentHealth` TINYINT(3) UNSIGNED NOT NULL DEFAULT 100;
|
|
||||||
@@ -1028,22 +1028,12 @@ bool Item::IsBindedNotWith( Player const* player ) const
|
|||||||
|
|
||||||
bool ItemRequiredTarget::IsFitToRequirements( Unit* pUnitTarget ) const
|
bool ItemRequiredTarget::IsFitToRequirements( Unit* pUnitTarget ) const
|
||||||
{
|
{
|
||||||
float uiPercentHP;
|
|
||||||
float uiHealth;
|
|
||||||
float uiMaxHealth;
|
|
||||||
|
|
||||||
if (pUnitTarget->GetTypeId() != TYPEID_UNIT)
|
if (pUnitTarget->GetTypeId() != TYPEID_UNIT)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (pUnitTarget->GetEntry() != m_uiTargetEntry)
|
if (pUnitTarget->GetEntry() != m_uiTargetEntry)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
uiHealth = pUnitTarget->GetHealth();
|
|
||||||
uiMaxHealth = pUnitTarget->GetMaxHealth();
|
|
||||||
uiPercentHP = ((uiHealth / uiMaxHealth) * 100);
|
|
||||||
if (m_uiMaxPercentHealth <= uiPercentHP)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
switch(m_uiType)
|
switch(m_uiType)
|
||||||
{
|
{
|
||||||
case ITEM_TARGET_TYPE_CREATURE:
|
case ITEM_TARGET_TYPE_CREATURE:
|
||||||
|
|||||||
+1
-2
@@ -208,10 +208,9 @@ enum ItemRequiredTargetType
|
|||||||
|
|
||||||
struct ItemRequiredTarget
|
struct ItemRequiredTarget
|
||||||
{
|
{
|
||||||
ItemRequiredTarget(ItemRequiredTargetType uiType, uint32 uiTargetEntry, float uiMaxPercentHealth) : m_uiType(uiType), m_uiTargetEntry(uiTargetEntry), m_uiMaxPercentHealth(uiMaxPercentHealth) {}
|
ItemRequiredTarget(ItemRequiredTargetType uiType, uint32 uiTargetEntry) : m_uiType(uiType), m_uiTargetEntry(uiTargetEntry) {}
|
||||||
ItemRequiredTargetType m_uiType;
|
ItemRequiredTargetType m_uiType;
|
||||||
uint32 m_uiTargetEntry;
|
uint32 m_uiTargetEntry;
|
||||||
float m_uiMaxPercentHealth;
|
|
||||||
|
|
||||||
// helpers
|
// helpers
|
||||||
bool IsFitToRequirements(Unit* pUnitTarget) const;
|
bool IsFitToRequirements(Unit* pUnitTarget) const;
|
||||||
|
|||||||
@@ -2422,7 +2422,7 @@ void ObjectMgr::LoadItemRequiredTarget()
|
|||||||
|
|
||||||
uint32 count = 0;
|
uint32 count = 0;
|
||||||
|
|
||||||
QueryResult_AutoPtr result = WorldDatabase.Query("SELECT entry,type,targetEntry,maxPercentHealth FROM item_required_target");
|
QueryResult_AutoPtr result = WorldDatabase.Query("SELECT entry,type,targetEntry FROM item_required_target");
|
||||||
|
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
@@ -2445,7 +2445,6 @@ void ObjectMgr::LoadItemRequiredTarget()
|
|||||||
uint32 uiItemId = fields[0].GetUInt32();
|
uint32 uiItemId = fields[0].GetUInt32();
|
||||||
uint32 uiType = fields[1].GetUInt32();
|
uint32 uiType = fields[1].GetUInt32();
|
||||||
uint32 uiTargetEntry = fields[2].GetUInt32();
|
uint32 uiTargetEntry = fields[2].GetUInt32();
|
||||||
float uiMaxPercentHealth = fields[3].GetUInt32();
|
|
||||||
|
|
||||||
ItemPrototype const* pItemProto = sItemStorage.LookupEntry<ItemPrototype>(uiItemId);
|
ItemPrototype const* pItemProto = sItemStorage.LookupEntry<ItemPrototype>(uiItemId);
|
||||||
|
|
||||||
@@ -2509,7 +2508,7 @@ void ObjectMgr::LoadItemRequiredTarget()
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_ItemRequiredTarget.insert(ItemRequiredTargetMap::value_type(uiItemId,ItemRequiredTarget(ItemRequiredTargetType(uiType),uiTargetEntry,uiMaxPercentHealth)));
|
m_ItemRequiredTarget.insert(ItemRequiredTargetMap::value_type(uiItemId,ItemRequiredTarget(ItemRequiredTargetType(uiType),uiTargetEntry)));
|
||||||
|
|
||||||
++count;
|
++count;
|
||||||
} while (result->NextRow());
|
} while (result->NextRow());
|
||||||
|
|||||||
Reference in New Issue
Block a user