1. void CItem::AddNewAttr(BYTE index, BYTE bApply, BYTE bLevel)
  2. {
  3. if (HasApply(bApply))
  4. return;
  5. if (bLevel <= 0)
  6. return;
  7. int iAttributeSet = GetAttributeSetIndex();
  8. const TItemAttrTable & r = g_map_itemAttr[bApply];
  9. if (!r.bMaxLevelBySet[iAttributeSet])
  10. return;
  11. int i = GetAttributeCount();
  12. const TItemAttrTable & r = g_map_itemAttr[bApply];
  13. long lVal = r.lValues[MIN(4, bLevel - 1)];
  14. if (lVal)
  15. SetAttribute(index, bApply, lVal);
  16. }