// 得到物品卖给npc的价格
    public override int GetItemPrice()
    {
        EXTRA_DEFINE pInfo = GetExtraInfo();

        if (pInfo != null)
        {
            return(pInfo.m_nSellPrice);
        }
        return(-1);
    }
    //// 取得当前装备的五行 [9/22/2011 edit by ZL]
    //INT				GetCurrentWuXing() { return m_theBaseDef.pDefineAsBase->nMenPai; }

    //// 取得当前装备的装备点 [9/22/2011 edit by ZL]
    //INT				GetEquipPoint() { return m_theBaseDef.pDefineAsBase->nEquipPoint; }

    //// 取得当前装备的魂印类型 [10/10/2011 edit by ZL]
    //INT				GetCurrentSoulType() { return m_pExtraDefine ? m_pExtraDefine->m_PrintSoulType : 0; }

    //// 取得当前装备的魂印类型 [10/10/2011 edit by ZL]
    //VOID			GetCurrentSoulAttr(STRING& strValue);

    // 按照参数生成不同品质装备 [11/4/2010 Sun]
    void AsEquipBase(_DBC_ITEM_EQUIP_BASE pDefine, EQUIP_QUALITY quality)
    {
        m_Quality       = quality;
        m_theBaseDef    = pDefine;
        m_nParticularID = (((((m_theBaseDef.nClass * 100) + m_theBaseDef.nQuality) * 100) + m_theBaseDef.nType) * 1000) + m_theBaseDef.nIndex;

        if (m_pExtraDefine == null)
        {
            m_pExtraDefine = new EXTRA_DEFINE();
        }

        m_pExtraDefine.m_CurDurPoint         = pDefine.nBMaxDur;
        m_pExtraDefine.m_MaxDurPoint         = pDefine.nBMaxDur;
        m_pExtraDefine.m_nLevelNeed          = pDefine.nLevelRequire;
        m_pExtraDefine.m_nRepairFailureTimes = pDefine.nBMaxRepair;
        m_pExtraDefine.m_nEquipQulity        = (int)m_Quality;
        m_pExtraDefine.m_nSellPrice          = pDefine.nBasePrice;

        // 暂时无绑定信息以后需要添加
        //m_pExtraDefine.m_bLocked  = FALSE;


        //for(INT i=0; i<pItemInfo.GetEquipData().m_AttrCount; i++)
        //{
        //	m_pExtraDefine.m_vEquipAttributes.push_back(pItemInfo.GetEquipData().m_pAttr[i]);
        //}

        //for(INT i=0; i<pItemInfo.GetEquipData().m_StoneCount; i++)
        //{
        //	m_pExtraDefine.m_vEquipAttachGem.push_back(pItemInfo.GetEquipData().m_pGemInfo[i]);
        //}

        _ITEM_ATTR  attr;
        _ITEM_VALUE attrValue;

        m_pExtraDefine.m_vBlueEquipAttributes.Clear();
        m_pExtraDefine.m_vEquipAttributes.Clear();
        // 客户端生成装备只生成基础属性且基础属性为一品 [10/11/2011 edit by ZL]
        for (int i = 0; i < (int)ITEM_ATTRIBUTE.IATTRIBUTE_NUMBER; i++)
        {
            if (i < DBC_DEFINE.MAX_BASE_ATTR && (pDefine.nBaseAttr[i] != -1))
            {
                attrValue.m_Value = (short)pDefine.nBaseAttr[i];
                attr.m_AttrType   = (byte)i;
                attr.m_Value      = attrValue;
                m_pExtraDefine.m_vEquipAttributes.Add(attr);
            }
        }
    }
    //克隆详细信息
    public void ClonetExtraInfo(CObject_Item_Equip pItemSource)
    {
        if (m_pExtraDefine != null)
        {
            m_pExtraDefine = new EXTRA_DEFINE();
        }

        EXTRA_DEFINE pNewExtraDefine = pItemSource.GetExtraInfo();

        m_pExtraDefine.m_CurDurPoint = pNewExtraDefine.m_CurDurPoint;
        m_pExtraDefine.m_MaxDurPoint = pNewExtraDefine.m_MaxDurPoint;
        m_pExtraDefine.m_nLevelNeed  = pNewExtraDefine.m_nLevelNeed;
        //	m_pExtraDefine.m_nFrogLevel  = pItemInfo.GetEquipData().m_Level;
        m_pExtraDefine.m_nRepairFailureTimes = pNewExtraDefine.m_nRepairFailureTimes;
        m_pExtraDefine.m_nSellPrice          = pNewExtraDefine.m_nSellPrice;
        m_pExtraDefine.M_nEquipBindInfo      = pNewExtraDefine.M_nEquipBindInfo;
        // 增加克隆时候的可以镶嵌的宝石个数、强化等级 [9/14/2011 edit by ZL]
        m_pExtraDefine.m_EnableGemCount    = pNewExtraDefine.m_EnableGemCount;
        m_pExtraDefine.m_EquipEnhanceLevel = pNewExtraDefine.m_EquipEnhanceLevel;

        m_pExtraDefine.m_vEquipAttachGem.Clear();
        m_pExtraDefine.m_vBlueEquipAttributes.Clear();
        m_pExtraDefine.m_vEquipAttributes.Clear();

        for (int i = 0; i < pNewExtraDefine.m_vEquipAttachGem.Count; i++)
        {
            m_pExtraDefine.m_vEquipAttachGem.Add(pNewExtraDefine.m_vEquipAttachGem[i]);
        }

        for (int i = 0; i < pNewExtraDefine.m_vBlueEquipAttributes.Count; i++)
        {
            m_pExtraDefine.m_vBlueEquipAttributes.Add(pNewExtraDefine.m_vBlueEquipAttributes[i]);
        }
        // 增加基础属性克隆 [9/14/2011 edit by ZL]
        for (int i = 0; i < pNewExtraDefine.m_vEquipAttributes.Count; i++)
        {
            m_pExtraDefine.m_vEquipAttributes.Add(pNewExtraDefine.m_vEquipAttributes[i]);
        }
        SetNumber(pItemSource.GetNumber());

        m_Quality    = pItemSource.GetEquipQuantity();
        m_theBaseDef = pItemSource.GetEquipBaseDefine();

        // 装备是否鉴定过属性。2006-4-10。
        m_EquipAttrib = pItemSource.m_EquipAttrib;
    }
    //设置详细解释
    public override void SetExtraInfo(ref _ITEM pItemInfo)
    {
        if (m_pExtraDefine == null)
        {
            m_pExtraDefine = new EXTRA_DEFINE();
        }

        m_pExtraDefine.m_CurDurPoint = pItemInfo.GetEquipData().m_CurDurPoint;
        m_pExtraDefine.m_MaxDurPoint = pItemInfo.GetEquipData().m_MaxDurPoint;
        m_pExtraDefine.m_nLevelNeed  = pItemInfo.GetEquipData().m_NeedLevel;
        //	m_pExtraDefine.m_nFrogLevel  = pItemInfo.GetEquipData().m_Level;
        m_pExtraDefine.m_nRepairFailureTimes = pItemInfo.GetEquipData().m_FaileTimes;
        m_pExtraDefine.m_nSellPrice          = (int)pItemInfo.GetEquipData().m_BasePrice;
        // 可以镶嵌的宝石个数
        m_pExtraDefine.m_EnableGemCount = pItemInfo.GetEquipData().m_GemMax;
        // 物品强化等级/品级属性/魂印属性[10/10/2011 edit by ZL]
        m_pExtraDefine.m_EquipEnhanceLevel = pItemInfo.GetEquipData().m_EquipEnhanceLevel;
        m_pExtraDefine.m_PrintSoulType     = pItemInfo.GetEquipData().m_CurSoulType;

        // 得到鉴定信息。
        if (pItemInfo.GetItemIdent())
        {
            // 已经鉴定
            m_EquipAttrib = EQUIP_ATTRIB.EQUIP_ATTRIB_IDENTIFY;
        }
        else
        {
            // 未鉴定
            m_EquipAttrib = EQUIP_ATTRIB.EQUIP_ATTRIB_UNIDENTIFY;
        }

        // 得到绑定信息。
        if (pItemInfo.GetItemBind())
        {
            m_pExtraDefine.M_nEquipBindInfo = EQUIP_BIND_INFO.BINDED;
        }
        else
        {
            if (Rule(ITEM_RULE.RULE_PICKBIND))
            {
                m_pExtraDefine.M_nEquipBindInfo = EQUIP_BIND_INFO.GETUP_BIND;
            }
            else if (Rule(ITEM_RULE.RULE_EQUIPBIND))
            {
                m_pExtraDefine.M_nEquipBindInfo = EQUIP_BIND_INFO.EQUIP_BIND;
            }
        }

        // m_vEquipAttributes存放6个的基础属性, m_vBlueEquipAttributes存放所有的扩展属性 [9/22/2011 edit by ZL]
        m_pExtraDefine.m_vBlueEquipAttributes.Clear();
        m_pExtraDefine.m_vEquipAttributes.Clear();

        // 临时将属性划分  0-5基础属性  6-20扩展属性  21-27魂印属性 [10/10/2011 edit by ZL]
        int BASE_ATTR_START       = 0;
        int EXTER_ATTR_START      = DBC_DEFINE.MAX_BASE_ATTR;
        int PRINT_SOUL_ATTR_START = DBC_DEFINE.MAX_BASE_ATTR + DBC_DEFINE.MAX_ADD_ATTR - DBC_DEFINE.MAX_SOUL_ATTR;
        int MAX_ATTR_NUM          = DBC_DEFINE.MAX_BASE_ATTR + DBC_DEFINE.MAX_ADD_ATTR;

        for (int i = 0; i < pItemInfo.GetEquipData().m_AttrCount; i++)
        {
            _ITEM_ATTR att = pItemInfo.GetEquipData().m_pAttr[i];
            //if(att.m_AttrType >= BASE_ATTR_START && att.m_AttrType < EXTER_ATTR_START) {
            //    m_pExtraDefine.m_vEquipAttributes.Add(att);
            //}
            //else if(att.m_AttrType >= EXTER_ATTR_START && att.m_AttrType < PRINT_SOUL_ATTR_START){
            //    m_pExtraDefine.m_vBlueEquipAttributes.Add(att);
            //}
            //else if(att.m_AttrType >= PRINT_SOUL_ATTR_START && att.m_AttrType < MAX_ATTR_NUM){
            //    m_pExtraDefine.m_PrintSoulAttribute = att;
            //}

            // 装备属性不再区分对待,统一放在一个地方 [3/29/2012 Ivan]
            if (att.m_AttrType >= BASE_ATTR_START && att.m_AttrType < MAX_ATTR_NUM)
            {
                m_pExtraDefine.m_vEquipAttributes.Add(att);
            }
        }

        // 清空宝石信息
        m_pExtraDefine.m_vEquipAttachGem.Clear();
        // 宝石信息设置 [9/28/2011 edit by ZL]
        for (int i = 0; i < GAMEDEFINE.MAX_ITEM_GEM; i++)
        {
            m_pExtraDefine.m_vEquipAttachGem.Add(pItemInfo.GetEquipData().m_pGemInfo[i]);
        }

        SetNumber(pItemInfo.GetItemCount());
        SetManufacturer(ref pItemInfo);

        // 因为服务器在发送装备属性的时候,把宝石的附加属性也加在了里面,所以需要删除掉 [10/25/2011 Ivan edit]
        ClearGemAttrInBlueAttrs();
    }
    public void CloneForUpLevel(CObject_Item_Equip pItemSource)
    {
        //克隆额外属性
        if (m_pExtraDefine != null)
        {
            m_pExtraDefine = new EXTRA_DEFINE();
        }

        EXTRA_DEFINE pNewExtraDefine = pItemSource.GetExtraInfo();

        m_pExtraDefine.m_CurDurPoint = pNewExtraDefine.m_CurDurPoint;
        m_pExtraDefine.m_MaxDurPoint = pNewExtraDefine.m_MaxDurPoint;
        m_pExtraDefine.m_nLevelNeed  = pNewExtraDefine.m_nLevelNeed;
        //	m_pExtraDefine.m_nFrogLevel  = pItemInfo.GetEquipData().m_Level;
        m_pExtraDefine.m_nRepairFailureTimes = pNewExtraDefine.m_nRepairFailureTimes;
        m_pExtraDefine.m_nSellPrice          = pNewExtraDefine.m_nSellPrice;
        m_pExtraDefine.M_nEquipBindInfo      = pNewExtraDefine.M_nEquipBindInfo;
        // 增加克隆时候的可以镶嵌的宝石个数、强化等级 [9/14/2011 edit by ZL]
        m_pExtraDefine.m_EnableGemCount    = pNewExtraDefine.m_EnableGemCount;
        m_pExtraDefine.m_EquipEnhanceLevel = pNewExtraDefine.m_EquipEnhanceLevel;

        m_pExtraDefine.m_vEquipAttachGem.Clear();
        m_pExtraDefine.m_vBlueEquipAttributes.Clear();


        for (int i = 0; i < pNewExtraDefine.m_vEquipAttachGem.Count; i++)
        {
            m_pExtraDefine.m_vEquipAttachGem.Add(pNewExtraDefine.m_vEquipAttachGem[i]);
        }

        for (int i = 0; i < pNewExtraDefine.m_vBlueEquipAttributes.Count; i++)
        {
            m_pExtraDefine.m_vBlueEquipAttributes.Add(pNewExtraDefine.m_vBlueEquipAttributes[i]);
        }

        //升档回退强化
        if (m_pExtraDefine.m_EquipEnhanceLevel >= 5)
        {
            m_pExtraDefine.m_EquipEnhanceLevel -= 5;
        }

        //基础属性根据新的强化等级计算
        int nEnchanceIndex = m_theBaseDef.nEquipPoint * 110 + m_pExtraDefine.m_EquipEnhanceLevel;

        for (int i = 0; i < pNewExtraDefine.m_vEquipAttributes.Count; i++)
        {
            _ITEM_ATTR value = pNewExtraDefine.m_vEquipAttributes[i];
            if (value.m_Value.m_Value > 0)
            {
                value.m_Value.m_Value = (short)(m_theBaseDef.nBaseAttr[value.m_AttrType] * CaclStrendthValue(value.m_AttrType, m_theBaseDef.nEquipPoint, m_pExtraDefine.m_EquipEnhanceLevel) + 0.5f);
            }
            m_pExtraDefine.m_vEquipAttributes.Add(value);
        }
        SetNumber(pItemSource.GetNumber());

        m_Quality = pItemSource.GetEquipQuantity();

        m_EquipAttrib = pItemSource.m_EquipAttrib;

        base.Clone(pItemSource);
    }