//得到所有白色属性
    // 现在所有属性都放在白装属性里面 [3/29/2012 Ivan]
    public void GetAllWhiteAttribute(ref string strValue)
    {
        if (m_pExtraDefine == null)
        {
            strValue = "";
            return;
        }

        string szAttachAtt  = "";
        int    MAX_ATTR_NUM = DBC_DEFINE.MAX_BASE_ATTR + DBC_DEFINE.MAX_ADD_ATTR;

        // 用于UI显示的基础属性 [9/29/2011 edit by ZL]
        for (int i = 0; i < m_pExtraDefine.m_vEquipAttributes.Count; i++)
        {
            _ITEM_ATTR att = m_pExtraDefine.m_vEquipAttributes[i];
            if ((att.m_AttrType >= 0) && (att.m_AttrType <= MAX_ATTR_NUM))
            {
                string szAtt = "";
                if (att.m_Value.m_Value > 0)
                {
                    szAtt = String.Format("#{{{0}}}+{1}\n", g_szAttachAttName[att.m_AttrType], att.m_Value.m_Value);
                }
                szAttachAtt += szAtt;
            }
        }

        strValue = szAttachAtt;
    }
    //通过索引获得基础属性
    public override string GetWhiteAttribute(int nIndex)
    {
        if (m_pExtraDefine == null)
        {
            return("");
        }

        string szAttachAtt  = "";
        int    MAX_ATTR_NUM = DBC_DEFINE.MAX_BASE_ATTR + DBC_DEFINE.MAX_ADD_ATTR;
        int    index        = 0;

        for (int i = 0; i < m_pExtraDefine.m_vEquipAttributes.Count; i++)
        {
            _ITEM_ATTR att = m_pExtraDefine.m_vEquipAttributes[i];
            if ((att.m_AttrType >= 0) && (att.m_AttrType <= MAX_ATTR_NUM))
            {
                string szAtt = "";
                if (att.m_Value.m_Value > 0)
                {
                    if (index == nIndex)
                    {
                        szAtt = String.Format("#{{{0}}}+{1}\n", g_szAttachAttName[att.m_AttrType], att.m_Value.m_Value);

                        return(szAtt);
                    }

                    index++;
                }
            }
        }
        return(szAttachAtt);
    }
    //得到所有绿色属性.
    public void GetAllGreenAttribute(ref string strValue)
    {
        const int GREEN_ATT_START = 0;
        const int GREEN_ATT_END   = DBC_DEFINE.MAX_ADD_ATTR + DBC_DEFINE.MAX_BASE_ATTR - 1;

        if (m_pExtraDefine == null)
        {
            strValue = "";
            return;
        }

        string szAttachAtt = "";

        for (int i = 0; i < m_pExtraDefine.m_vEquipAttributes.Count; i++)
        {
            _ITEM_ATTR att = m_pExtraDefine.m_vEquipAttributes[i];

            if ((att.m_AttrType >= GREEN_ATT_START) && ((int)att.m_AttrType <= GREEN_ATT_END))
            {
                string szAtt = "";
                SetAttri(ref att, ref szAtt);
                szAttachAtt += szAtt;
            }
        }

        strValue = szAttachAtt;
    }
    //得到所有蓝色属性
    public void GetAllBlueAttribute(ref string strValue)
    {
        if (m_pExtraDefine == null)
        {
            strValue = "";
            return;
        }

        // 此处修改为所有扩展属性 [9/22/2011 edit by ZL]
        const int BLUE_ATT_START = DBC_DEFINE.MAX_BASE_ATTR;
        const int BLUE_ATT_END   = DBC_DEFINE.MAX_BASE_ATTR + DBC_DEFINE.MAX_ADD_ATTR - 1;

        string szAttachAtt = "";

        for (int i = 0; i < m_pExtraDefine.m_vBlueEquipAttributes.Count; i++)
        {
            _ITEM_ATTR att = m_pExtraDefine.m_vBlueEquipAttributes[i];

            if (att.m_AttrType >= BLUE_ATT_START && (int)att.m_AttrType <= BLUE_ATT_END)
            {
                string szAtt = "";

                szAtt = String.Format("#{%s}+%d\n", g_szAttachAttName[att.m_AttrType], att.m_Value.m_Value);

                szAttachAtt += szAtt;
            }
        }//

        strValue = szAttachAtt;
    }
    public string GetStrengthAttributeValue(int nStrengthLevel, int nIndex)
    {
        if (m_pExtraDefine == null)
        {
            return("");
        }

        int MAX_ATTR_NUM = DBC_DEFINE.MAX_BASE_ATTR;
        int index        = 0;

        for (int i = 0; i < m_pExtraDefine.m_vEquipAttributes.Count; i++)
        {
            _ITEM_ATTR att = m_pExtraDefine.m_vEquipAttributes[i];
            if ((att.m_AttrType >= 0) && (att.m_AttrType <= MAX_ATTR_NUM))
            {
                string szAtt = "";
                if (att.m_Value.m_Value > 0)
                {
                    if (index == nIndex)
                    {
                        //强化公式
                        int nValue = (int)(m_theBaseDef.nBaseAttr[att.m_AttrType] * CaclStrendthValue(att.m_AttrType, m_theBaseDef.nEquipPoint, nStrengthLevel) + 0.5f);

                        szAtt = String.Format("#{{{0}}}+{1}", g_szAttachAttName[att.m_AttrType], nValue);

                        return(szAtt);
                    }

                    index++;
                }
            }
        }

        return("");
    }
Exemplo n.º 6
0
 public override bool Equals(object obj)
 {
     if (obj is _ITEM_ATTR)
     {
         _ITEM_ATTR attri = (_ITEM_ATTR)obj;
         return(this == attri);
     }
     return(base.Equals(obj));
 }
    // 允许读取单个属性的值 [3/29/2012 Ivan]
    public short GetSingleAttribValue(byte attType)
    {
        if (m_pExtraDefine == null)
        {
            return(-1);
        }

        // 用于UI显示的基础属性 [9/29/2011 edit by ZL]
        for (int i = 0; i < m_pExtraDefine.m_vEquipAttributes.Count; i++)
        {
            _ITEM_ATTR att = m_pExtraDefine.m_vEquipAttributes[i];
            if (att.m_AttrType == attType)
            {
                return(att.m_Value.m_Value);
            }
        }
        return(-1);
    }
    public override int GetWhiteAttributeCount()
    {
        if (m_pExtraDefine == null)
        {
            return(0);
        }

        int MAX_ATTR_NUM = DBC_DEFINE.MAX_BASE_ATTR + DBC_DEFINE.MAX_ADD_ATTR;
        int index        = 0;

        for (int i = 0; i < m_pExtraDefine.m_vEquipAttributes.Count; i++)
        {
            _ITEM_ATTR att = m_pExtraDefine.m_vEquipAttributes[i];
            if ((att.m_AttrType >= 0) && (att.m_AttrType <= MAX_ATTR_NUM))
            {
                if (att.m_Value.m_Value > 0)
                {
                    index++;
                }
            }
        }
        return(index);
    }
    //设置详细解释
    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();
    }
Exemplo n.º 10
0
    // 格式化属性字符串
    public void SetAttri(ref _ITEM_ATTR att, ref string pszBuf)
    {
        switch (att.m_AttrType)
        {
        case 1: goto case 39;

        //case 2:goto case 39;
        case 4: goto case 39;

        case 20: goto case 39;

        case 21: goto case 39;

        case 23: goto case 39;

        case 24: goto case 39;

        case 27: goto case 39;

        case 28: goto case 39;

        case 30: goto case 39;

        case 31: goto case 39;

        case 33: goto case 39;

        case 34: goto case 39;

        case 39:
        {
            if (att.m_Value.m_Value > 0)
            {
                pszBuf = String.Format("#{0}+{1}\n", g_szAttachAttName[att.m_AttrType], att.m_Value.m_Value);
            }
            else
            {
                pszBuf = String.Format("#{0}-{1}\n", g_szAttachAttName[att.m_AttrType], att.m_Value.m_Value);
            }
            break;
        }

        case 38:
        {
            pszBuf = String.Format("{0}#{1}\n", att.m_Value.m_Value, g_szAttachAttName[att.m_AttrType]);
            break;
        }

        case 40: goto case 50;

        case 41: goto case 50;

        case 49: goto case 50;

        case 50:
        {
            pszBuf = String.Format("#{0}{1}\n", g_szAttachAttName[att.m_AttrType], att.m_Value.m_Value);
            break;
        }

        case 8: goto case 32;

        case 11: goto case 32;

        case 14: goto case 32;

        case 17: goto case 32;

        case 25: goto case 32;

        case 32:
        {
            if (att.m_Value.m_Value > 0)
            {
                pszBuf = String.Format("#{0}-{1}\n", g_szAttachAttName[att.m_AttrType], att.m_Value.m_Value);
            }
            else
            {
                pszBuf = String.Format("#{0}+{1}\n", g_szAttachAttName[att.m_AttrType], att.m_Value.m_Value);
            }
            break;
        }

        default:
        {
            if (att.m_Value.m_Value > 0)
            {
                pszBuf = String.Format("#{%s}+%d\n", g_szAttachAttName[att.m_AttrType], att.m_Value.m_Value);
            }
            break;
        }
        }
    }
Exemplo n.º 11
0
    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);
    }