mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-17 08:00:48 +01:00
* 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
|
||||
{
|
||||
float uiPercentHP;
|
||||
float uiHealth;
|
||||
float uiMaxHealth;
|
||||
|
||||
if (pUnitTarget->GetTypeId() != TYPEID_UNIT)
|
||||
return false;
|
||||
|
||||
if (pUnitTarget->GetEntry() != m_uiTargetEntry)
|
||||
return false;
|
||||
|
||||
uiHealth = pUnitTarget->GetHealth();
|
||||
uiMaxHealth = pUnitTarget->GetMaxHealth();
|
||||
uiPercentHP = ((uiHealth / uiMaxHealth) * 100);
|
||||
if (m_uiMaxPercentHealth <= uiPercentHP)
|
||||
return false;
|
||||
|
||||
switch(m_uiType)
|
||||
{
|
||||
case ITEM_TARGET_TYPE_CREATURE:
|
||||
|
||||
@@ -208,10 +208,9 @@ enum ItemRequiredTargetType
|
||||
|
||||
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;
|
||||
uint32 m_uiTargetEntry;
|
||||
float m_uiMaxPercentHealth;
|
||||
|
||||
// helpers
|
||||
bool IsFitToRequirements(Unit* pUnitTarget) const;
|
||||
|
||||
@@ -2422,7 +2422,7 @@ void ObjectMgr::LoadItemRequiredTarget()
|
||||
|
||||
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)
|
||||
{
|
||||
@@ -2442,10 +2442,9 @@ void ObjectMgr::LoadItemRequiredTarget()
|
||||
Field *fields = result->Fetch();
|
||||
bar.step();
|
||||
|
||||
uint32 uiItemId = fields[0].GetUInt32();
|
||||
uint32 uiType = fields[1].GetUInt32();
|
||||
uint32 uiTargetEntry = fields[2].GetUInt32();
|
||||
float uiMaxPercentHealth = fields[3].GetUInt32();
|
||||
uint32 uiItemId = fields[0].GetUInt32();
|
||||
uint32 uiType = fields[1].GetUInt32();
|
||||
uint32 uiTargetEntry = fields[2].GetUInt32();
|
||||
|
||||
ItemPrototype const* pItemProto = sItemStorage.LookupEntry<ItemPrototype>(uiItemId);
|
||||
|
||||
@@ -2509,7 +2508,7 @@ void ObjectMgr::LoadItemRequiredTarget()
|
||||
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;
|
||||
} while (result->NextRow());
|
||||
|
||||
Reference in New Issue
Block a user