Fix Metagem bug exploit. Thanks Azazel and p.alexej.

Fixes issue #579.
Fixes issue #453.

--HG--
branch : trunk
This commit is contained in:
Trazom62
2010-01-31 18:10:27 +01:00
parent 9de5acc4e1
commit 5114a2a327
+13 -8
View File
@@ -6888,15 +6888,20 @@ void Player::_ApplyItemMods(Item *item, uint8 slot,bool apply)
if(slot >= INVENTORY_SLOT_BAG_END || !item)
return;
// not apply mods for broken item
if(item->IsBroken())
return;
ItemPrototype const *proto = item->GetProto();
if(!proto)
if (!proto)
return;
// not apply mods for broken item
if (item->IsBroken())
{
if (proto->Socket[0].Color)
CorrectMetaGemEnchants(slot, apply);
return;
}
sLog.outDetail("applying mods for item %u ",item->GetGUIDLow());
uint8 attacktype = Player::GetAttackBySlot(slot);
@@ -19410,10 +19415,10 @@ bool Player::EnchantmentFitsRequirements(uint32 enchantmentcondition, int8 slot)
//counting current equipped gem colors
for (uint8 i = EQUIPMENT_SLOT_START; i < EQUIPMENT_SLOT_END; ++i)
{
if(i == slot)
if (i == slot)
continue;
Item *pItem2 = GetItemByPos( INVENTORY_SLOT_BAG_0, i );
if(pItem2 && pItem2->GetProto()->Socket[0].Color)
Item *pItem2 = GetItemByPos(INVENTORY_SLOT_BAG_0, i);
if (pItem2 && !pItem2->IsBroken() && pItem2->GetProto()->Socket[0].Color)
{
for (uint32 enchant_slot = SOCK_ENCHANTMENT_SLOT; enchant_slot < SOCK_ENCHANTMENT_SLOT+3; ++enchant_slot)
{