[10021] Move item disenchanting static req. checks to server start.

This commit is contained in:
VladimirMangos 2010-06-02 14:55:47 +04:00
parent d6c5207867
commit e823b30f4f
5 changed files with 53 additions and 20 deletions

View file

@ -414,13 +414,13 @@ void WorldSession::HandleItemQuerySingleOpcode( WorldPacket & recv_data )
data << pProto->Socket[s].Color; data << pProto->Socket[s].Color;
data << pProto->Socket[s].Content; data << pProto->Socket[s].Content;
} }
data << pProto->socketBonus; data << uint32(pProto->socketBonus);
data << pProto->GemProperties; data << uint32(pProto->GemProperties);
data << pProto->RequiredDisenchantSkill; data << int32(pProto->RequiredDisenchantSkill);
data << pProto->ArmorDamageModifier; data << float(pProto->ArmorDamageModifier);
data << pProto->Duration; // added in 2.4.2.8209, duration (seconds) data << uint32(pProto->Duration); // added in 2.4.2.8209, duration (seconds)
data << pProto->ItemLimitCategory; // WotLK, ItemLimitCategory data << uint32(pProto->ItemLimitCategory); // WotLK, ItemLimitCategory
data << pProto->HolidayId; // Holiday.dbc? data << uint32(pProto->HolidayId); // Holiday.dbc?
SendPacket( &data ); SendPacket( &data );
} }
else else

View file

@ -586,7 +586,7 @@ struct ItemPrototype
_Socket Socket[MAX_ITEM_PROTO_SOCKETS]; _Socket Socket[MAX_ITEM_PROTO_SOCKETS];
uint32 socketBonus; // id from SpellItemEnchantment.dbc uint32 socketBonus; // id from SpellItemEnchantment.dbc
uint32 GemProperties; // id from GemProperties.dbc uint32 GemProperties; // id from GemProperties.dbc
uint32 RequiredDisenchantSkill; int32 RequiredDisenchantSkill;
float ArmorDamageModifier; float ArmorDamageModifier;
uint32 Duration; // negative = realtime, positive = ingame time uint32 Duration; // negative = realtime, positive = ingame time
uint32 ItemLimitCategory; // id from ItemLimitCategory.dbc uint32 ItemLimitCategory; // id from ItemLimitCategory.dbc

View file

@ -2058,6 +2058,44 @@ void ObjectMgr::LoadItemPrototypes()
if(proto->GemProperties && !sGemPropertiesStore.LookupEntry(proto->GemProperties)) if(proto->GemProperties && !sGemPropertiesStore.LookupEntry(proto->GemProperties))
sLog.outErrorDb("Item (Entry: %u) has wrong GemProperties (%u)",i,proto->GemProperties); sLog.outErrorDb("Item (Entry: %u) has wrong GemProperties (%u)",i,proto->GemProperties);
if (proto->RequiredDisenchantSkill < -1)
{
sLog.outErrorDb("Item (Entry: %u) has wrong RequiredDisenchantSkill (%i), set to (-1).",i,proto->RequiredDisenchantSkill);
const_cast<ItemPrototype*>(proto)->RequiredDisenchantSkill = -1;
}
else if (proto->RequiredDisenchantSkill != -1)
{
if (proto->Quality > ITEM_QUALITY_EPIC || proto->Quality < ITEM_QUALITY_UNCOMMON)
{
sLog.outErrorDb("Item (Entry: %u) has unexpected RequiredDisenchantSkill (%u) for non-disenchantable quality (%u), reset it.",i,proto->RequiredDisenchantSkill,proto->Quality);
const_cast<ItemPrototype*>(proto)->RequiredDisenchantSkill = -1;
}
else if (proto->Class != ITEM_CLASS_WEAPON && proto->Class != ITEM_CLASS_ARMOR)
{
sLog.outErrorDb("Item (Entry: %u) has unexpected RequiredDisenchantSkill (%u) for non-disenchantable item class (%u), reset it.",i,proto->RequiredDisenchantSkill,proto->Class);
const_cast<ItemPrototype*>(proto)->RequiredDisenchantSkill = -1;
}
}
if (proto->DisenchantID)
{
if (proto->Quality > ITEM_QUALITY_EPIC || proto->Quality < ITEM_QUALITY_UNCOMMON)
{
sLog.outErrorDb("Item (Entry: %u) has wrong quality (%u) for disenchanting, remove disenchanting loot id.",i,proto->Quality);
const_cast<ItemPrototype*>(proto)->DisenchantID = 0;
}
else if (proto->Class != ITEM_CLASS_WEAPON && proto->Class != ITEM_CLASS_ARMOR)
{
sLog.outErrorDb("Item (Entry: %u) has wrong item class (%u) for disenchanting, remove disenchanting loot id.",i,proto->Class);
const_cast<ItemPrototype*>(proto)->DisenchantID = 0;
}
else if (proto->RequiredDisenchantSkill < 0)
{
sLog.outErrorDb("Item (Entry: %u) marked as non-disenchantable by RequiredDisenchantSkill == -1, remove disenchanting loot id.",i);
const_cast<ItemPrototype*>(proto)->DisenchantID = 0;
}
}
if(proto->FoodType >= MAX_PET_DIET) if(proto->FoodType >= MAX_PET_DIET)
{ {
sLog.outErrorDb("Item (Entry: %u) has wrong FoodType value (%u)",i,proto->FoodType); sLog.outErrorDb("Item (Entry: %u) has wrong FoodType value (%u)",i,proto->FoodType);

View file

@ -5871,19 +5871,14 @@ SpellCastResult Spell::CheckItems()
if(!itemProto) if(!itemProto)
return SPELL_FAILED_CANT_BE_DISENCHANTED; return SPELL_FAILED_CANT_BE_DISENCHANTED;
uint32 item_quality = itemProto->Quality; // must have disenchant loot (other static req. checked at item prototype loading)
// 2.0.x addon: Check player enchanting level against the item disenchanting requirements
uint32 item_disenchantskilllevel = itemProto->RequiredDisenchantSkill;
if (item_disenchantskilllevel == uint32(-1))
return SPELL_FAILED_CANT_BE_DISENCHANTED;
if (item_disenchantskilllevel > p_caster->GetSkillValue(SKILL_ENCHANTING))
return SPELL_FAILED_LOW_CASTLEVEL;
if(item_quality > 4 || item_quality < 2)
return SPELL_FAILED_CANT_BE_DISENCHANTED;
if(itemProto->Class != ITEM_CLASS_WEAPON && itemProto->Class != ITEM_CLASS_ARMOR)
return SPELL_FAILED_CANT_BE_DISENCHANTED;
if (!itemProto->DisenchantID) if (!itemProto->DisenchantID)
return SPELL_FAILED_CANT_BE_DISENCHANTED; return SPELL_FAILED_CANT_BE_DISENCHANTED;
// 2.0.x addon: Check player enchanting level against the item disenchanting requirements
int32 item_disenchantskilllevel = itemProto->RequiredDisenchantSkill;
if (item_disenchantskilllevel > int32(p_caster->GetSkillValue(SKILL_ENCHANTING)))
return SPELL_FAILED_LOW_CASTLEVEL;
break; break;
} }
case SPELL_EFFECT_PROSPECTING: case SPELL_EFFECT_PROSPECTING:

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__ #ifndef __REVISION_NR_H__
#define __REVISION_NR_H__ #define __REVISION_NR_H__
#define REVISION_NR "10020" #define REVISION_NR "10021"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__