Implemented limit category check for item/gem at equip or gem inserting. Author: VladimirMangos
--HG-- branch : trunk
This commit is contained in:
1 parent
419b749520
commit
97ac3aba05
10 files changed
+249
-70
No files matched your search
+25
-2
@@ -806,7 +806,7 @@ void Item::ClearEnchantment(EnchantmentSlot slot)
|
||||
bool Item::GemsFitSockets() const
|
||||
{
|
||||
bool fits = true;
|
||||
for(uint32 enchant_slot = SOCK_ENCHANTMENT_SLOT; enchant_slot < SOCK_ENCHANTMENT_SLOT+3; ++enchant_slot)
|
||||
for(uint32 enchant_slot = SOCK_ENCHANTMENT_SLOT; enchant_slot < SOCK_ENCHANTMENT_SLOT+MAX_GEM_SOCKETS; ++enchant_slot)
|
||||
{
|
||||
uint8 SocketColor = GetProto()->Socket[enchant_slot-SOCK_ENCHANTMENT_SLOT].Color;
|
||||
|
||||
@@ -846,7 +846,7 @@ bool Item::GemsFitSockets() const
|
||||
uint8 Item::GetGemCountWithID(uint32 GemID) const
|
||||
{
|
||||
uint8 count = 0;
|
||||
for(uint32 enchant_slot = SOCK_ENCHANTMENT_SLOT; enchant_slot < SOCK_ENCHANTMENT_SLOT+3; ++enchant_slot)
|
||||
for(uint32 enchant_slot = SOCK_ENCHANTMENT_SLOT; enchant_slot < SOCK_ENCHANTMENT_SLOT+MAX_GEM_SOCKETS; ++enchant_slot)
|
||||
{
|
||||
uint32 enchant_id = GetEnchantmentId(EnchantmentSlot(enchant_slot));
|
||||
if(!enchant_id)
|
||||
@@ -862,6 +862,29 @@ uint8 Item::GetGemCountWithID(uint32 GemID) const
|
||||
return count;
|
||||
}
|
||||
|
||||
uint8 Item::GetGemCountWithLimitCategory(uint32 limitCategory) const
|
||||
{
|
||||
uint8 count = 0;
|
||||
for(uint32 enchant_slot = SOCK_ENCHANTMENT_SLOT; enchant_slot < SOCK_ENCHANTMENT_SLOT+MAX_GEM_SOCKETS; ++enchant_slot)
|
||||
{
|
||||
uint32 enchant_id = GetEnchantmentId(EnchantmentSlot(enchant_slot));
|
||||
if(!enchant_id)
|
||||
continue;
|
||||
|
||||
SpellItemEnchantmentEntry const* enchantEntry = sSpellItemEnchantmentStore.LookupEntry(enchant_id);
|
||||
if(!enchantEntry)
|
||||
continue;
|
||||
|
||||
ItemPrototype const* gemProto = ObjectMgr::GetItemPrototype(enchantEntry->GemID);
|
||||
if(!gemProto)
|
||||
continue;
|
||||
|
||||
if(gemProto->ItemLimitCategory==limitCategory)
|
||||
++count;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
bool Item::IsLimitedToAnotherMapOrZone( uint32 cur_mapId, uint32 cur_zoneId) const
|
||||
{
|
||||
ItemPrototype const* proto = GetProto();
|
||||
|
||||
Reference in new issue
Block a user