aboutsummaryrefslogtreecommitdiff
path: root/src/game/Item.cpp
diff options
context:
space:
mode:
authormegamage <none@none>2008-11-20 16:16:57 -0600
committermegamage <none@none>2008-11-20 16:16:57 -0600
commit1e997b95cc89c615adf2acd27a5f6916b78e0ff3 (patch)
tree491c496b798daf9b20db6397ae3f0affb6fd3738 /src/game/Item.cpp
parent0b61584e1b19afb8dbef376a4e2903d8631bfc1d (diff)
Re-commit 262 due to EOL issues. (no difference from 262)
--HG-- branch : trunk
Diffstat (limited to 'src/game/Item.cpp')
-rw-r--r--src/game/Item.cpp25
1 files changed, 13 insertions, 12 deletions
diff --git a/src/game/Item.cpp b/src/game/Item.cpp
index 2c4ebfb0a3e..0c264a76d8b 100644
--- a/src/game/Item.cpp
+++ b/src/game/Item.cpp
@@ -10,12 +10,12 @@
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "Common.h"
@@ -179,7 +179,7 @@ bool ItemCanGoIntoBag(ItemPrototype const *pProto, ItemPrototype const *pBagProt
case ITEM_SUBCLASS_CONTAINER:
return true;
case ITEM_SUBCLASS_SOUL_CONTAINER:
- if(!(pProto->BagFamily & BAG_FAMILY_MASK_SHARDS))
+ if(!(pProto->BagFamily & BAG_FAMILY_MASK_SOUL_SHARDS))
return false;
return true;
case ITEM_SUBCLASS_HERB_CONTAINER:
@@ -247,7 +247,7 @@ bool Item::Create( uint32 guidlow, uint32 itemid, Player const* owner)
{
Object::_Create( guidlow, 0, HIGHGUID_ITEM );
- SetUInt32Value(OBJECT_FIELD_ENTRY, itemid);
+ SetEntry(itemid);
SetFloatValue(OBJECT_FIELD_SCALE_X, 1.0f);
SetUInt64Value(ITEM_FIELD_OWNER, owner ? owner->GetGUID() : 0);
@@ -429,7 +429,7 @@ void Item::DeleteFromInventoryDB()
ItemPrototype const *Item::GetProto() const
{
- return objmgr.GetItemPrototype(GetUInt32Value(OBJECT_FIELD_ENTRY));
+ return objmgr.GetItemPrototype(GetEntry());
}
Player* Item::GetOwner()const
@@ -762,9 +762,7 @@ bool Item::IsFitToSpellRequirements(SpellEntry const* spellInfo) const
void Item::SetEnchantment(EnchantmentSlot slot, uint32 id, uint32 duration, uint32 charges)
{
// Better lost small time at check in comparison lost time at item save to DB.
- if( GetUInt32Value(ITEM_FIELD_ENCHANTMENT + slot*MAX_ENCHANTMENT_OFFSET + ENCHANTMENT_ID_OFFSET)==id &&
- GetUInt32Value(ITEM_FIELD_ENCHANTMENT + slot*MAX_ENCHANTMENT_OFFSET + ENCHANTMENT_DURATION_OFFSET)==duration &&
- GetUInt32Value(ITEM_FIELD_ENCHANTMENT + slot*MAX_ENCHANTMENT_OFFSET + ENCHANTMENT_CHARGES_OFFSET)==charges )
+ if((GetEnchantmentId(slot) == id) && (GetEnchantmentDuration(slot) == duration) && (GetEnchantmentCharges(slot) == charges))
return;
SetUInt32Value(ITEM_FIELD_ENCHANTMENT + slot*MAX_ENCHANTMENT_OFFSET + ENCHANTMENT_ID_OFFSET,id);
@@ -775,7 +773,7 @@ void Item::SetEnchantment(EnchantmentSlot slot, uint32 id, uint32 duration, uint
void Item::SetEnchantmentDuration(EnchantmentSlot slot, uint32 duration)
{
- if(GetUInt32Value(ITEM_FIELD_ENCHANTMENT + slot*MAX_ENCHANTMENT_OFFSET + ENCHANTMENT_DURATION_OFFSET)==duration)
+ if(GetEnchantmentDuration(slot) == duration)
return;
SetUInt32Value(ITEM_FIELD_ENCHANTMENT + slot*MAX_ENCHANTMENT_OFFSET + ENCHANTMENT_DURATION_OFFSET,duration);
@@ -784,17 +782,20 @@ void Item::SetEnchantmentDuration(EnchantmentSlot slot, uint32 duration)
void Item::SetEnchantmentCharges(EnchantmentSlot slot, uint32 charges)
{
+ if(GetEnchantmentCharges(slot) == charges)
+ return;
+
SetUInt32Value(ITEM_FIELD_ENCHANTMENT + slot*MAX_ENCHANTMENT_OFFSET + ENCHANTMENT_CHARGES_OFFSET,charges);
SetState(ITEM_CHANGED);
}
void Item::ClearEnchantment(EnchantmentSlot slot)
{
- if(!GetUInt32Value(ITEM_FIELD_ENCHANTMENT + slot*MAX_ENCHANTMENT_OFFSET + ENCHANTMENT_ID_OFFSET))
+ if(!GetEnchantmentId(slot))
return;
- for(int x=0;x<3;x++)
- SetUInt32Value(ITEM_FIELD_ENCHANTMENT + slot*MAX_ENCHANTMENT_OFFSET + x,0);
+ for(uint8 x = 0; x < 3; ++x)
+ SetUInt32Value(ITEM_FIELD_ENCHANTMENT + slot*MAX_ENCHANTMENT_OFFSET + x, 0);
SetState(ITEM_CHANGED);
}