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) if(slot >= INVENTORY_SLOT_BAG_END || !item)
return; return;
// not apply mods for broken item
if(item->IsBroken())
return;
ItemPrototype const *proto = item->GetProto(); ItemPrototype const *proto = item->GetProto();
if(!proto) if (!proto)
return; 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()); sLog.outDetail("applying mods for item %u ",item->GetGUIDLow());
uint8 attacktype = Player::GetAttackBySlot(slot); uint8 attacktype = Player::GetAttackBySlot(slot);
@@ -19410,10 +19415,10 @@ bool Player::EnchantmentFitsRequirements(uint32 enchantmentcondition, int8 slot)
//counting current equipped gem colors //counting current equipped gem colors
for (uint8 i = EQUIPMENT_SLOT_START; i < EQUIPMENT_SLOT_END; ++i) for (uint8 i = EQUIPMENT_SLOT_START; i < EQUIPMENT_SLOT_END; ++i)
{ {
if(i == slot) if (i == slot)
continue; continue;
Item *pItem2 = GetItemByPos( INVENTORY_SLOT_BAG_0, i ); Item *pItem2 = GetItemByPos(INVENTORY_SLOT_BAG_0, i);
if(pItem2 && pItem2->GetProto()->Socket[0].Color) if (pItem2 && !pItem2->IsBroken() && pItem2->GetProto()->Socket[0].Color)
{ {
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+3; ++enchant_slot)
{ {