コード例 #1
0
        /// <summary>
        /// 是否可以被强化,一般都是道具的硬条件,例如品质等
        /// </summary>
        /// <param name="oResult">错误信息,如果成功为空</param>
        /// <returns>true 可以升级, false 不可升级</returns>
        public override bool isCanOperated(out string oResult)
        {
            oResult = "";
            //所有装备均可升档
            if (mEquip == null)
            {
                return(false);
            }

            SCLIENT_PRESCR myPrescr = CObjectManager.Instance.getPlayerMySelf().GetCharacterData().Get_Prescr(mPrescrId);

            if (myPrescr == null)
            {
                oResult = "#{NotLearnPrescr}";
                return(false);
            }
            //穿戴等级
            _DBC_ITEM_EQUIP_BASE equipInfo = ObjectSystem.EquipDBC.Search_Index_EQU(myPrescr.m_pDefine.nResultID);

            if (equipInfo == null)
            {
                oResult = "NoResultID";
                return(false);
            }
            // if (CObjectManager.Instance.getPlayerMySelf().GetCharacterData().Get_Level() < equipInfo.nLevelRequire)
            {
                //     oResult = "LowLevel";
                //     return false;
            }
            return(true);
        }
コード例 #2
0
        public int GetPrescrStuffCount(int nPrescrID)
        {
            SCLIENT_PRESCR myPrescr = CObjectManager.Instance.getPlayerMySelf().GetCharacterData().Get_Prescr(nPrescrID);

            if (myPrescr == null)
            {
                throw new NullReferenceException("can not found prescr id=" + nPrescrID + " in GetPrescrStuffCount()");
            }


            return(myPrescr.m_pDefine.mStuffs.Length);
        }
コード例 #3
0
        public Stuff GetPrescrStuff(int nIndex, int nPrescrID)
        {
            SCLIENT_PRESCR myPrescr = CObjectManager.Instance.getPlayerMySelf().GetCharacterData().Get_Prescr(nPrescrID);

            if (myPrescr == null)
            {
                throw new NullReferenceException("can not found prescr id=" + nPrescrID + " in GetPrescrStuff()");
            }
            if (nIndex >= myPrescr.m_pDefine.mStuffs.Length)
            {
                throw new NullReferenceException("Not validate stuff index= " + nIndex + "in Prescr=" + nPrescrID);
            }

            return(myPrescr.m_pDefine.mStuffs[nIndex]);
        }
コード例 #4
0
        //配方
        public Stuff GetPrescrResult(int nPrescrID)
        {
            SCLIENT_PRESCR myPrescr = CObjectManager.Instance.getPlayerMySelf().GetCharacterData().Get_Prescr(nPrescrID);

            if (myPrescr == null)
            {
                throw new NullReferenceException("can not found prescr id=" + nPrescrID + " in GetPrescrResult()");
            }

            Stuff stuffPair = new Stuff();

            stuffPair.nID  = myPrescr.m_pDefine.nResultID;
            stuffPair.nNum = myPrescr.m_pDefine.nResultNum;

            return(stuffPair);
        }
コード例 #5
0
        public static int getPrescrID(int nTableId)
        {
            Dictionary <int, SCLIENT_PRESCR> myPrescrs = CObjectManager.Instance.getPlayerMySelf().GetCharacterData().Get_Prescr();

            if (myPrescrs != null)
            {
                Dictionary <int, SCLIENT_PRESCR> .Enumerator et = myPrescrs.GetEnumerator();
                while (et.MoveNext())
                {
                    SCLIENT_PRESCR prescr = et.Current.Value;
                    if (prescr.m_pDefine.mStuffs[0].nID == nTableId)
                    {
                        return(prescr.m_pDefine.nID);
                    }
                }
            }
            return(-1);
        }
コード例 #6
0
        public override bool checkDeplete(out string oResult)
        {
            oResult = null;
            if (mEquip == null)
            {
                throw new Exception("The equip is null: checkDeplete()");
            }

            SCLIENT_PRESCR myPrescr = CObjectManager.Instance.getPlayerMySelf().GetCharacterData().Get_Prescr(mPrescrId);

            if (myPrescr == null)
            {
                return(true);
            }
            Stuff stuff  = new Stuff();
            int   nCount = 0;

            for (int i = 1; i < myPrescr.m_pDefine.mStuffs.Length; i++)
            {
                stuff = myPrescr.m_pDefine.mStuffs[i];
                if (stuff.nID != -1)
                {
                    nCount = CDataPool.Instance.UserBag_CountItemByIDTable(stuff.nID);
                    if (nCount < stuff.nNum)
                    {
                        oResult = "#{NoEnoughStuff}";
                        return(false);
                    }
                }
            }

            //金钱
            if (myPrescr.m_pDefine.nBindLingShi <= CObjectManager.Instance.getPlayerMySelf().GetCharacterData().Get_Money())
            {
                return(true);
            }
            else
            {
                oResult = "#{Money_Not_Enough}";
            }

            return(false);
        }
コード例 #7
0
        public COMPOSE_ITEM_RESULT ComposeItem_Begin(int nPrescrID, int nMakeCount)
        {
            if (nMakeCount < 1)
            {
                return(COMPOSE_ITEM_RESULT.COMPOSE_ERROR);
            }
            bool           bEnoughStuff = true;
            SCLIENT_PRESCR myPrescr     = CObjectManager.Instance.getPlayerMySelf().GetCharacterData().Get_Prescr(nPrescrID);

            if (myPrescr == null)
            {
                //throw new NullReferenceException("can not found prescr id=" + nPrescrID + " in ComposeItem_Begin()");
                //告知玩家需要使用/学习什么生活技能 [2012/4/18 ZZY]
                _DBC_LIFEABILITY_ITEMCOMPOSE pDefine =
                    CDataBaseSystem.Instance.GetDataBase <_DBC_LIFEABILITY_ITEMCOMPOSE>((int)DataBaseStruct.DBC_LIFEABILITY_ITEMCOMPOSE).Search_Index_EQU(nPrescrID);
                CEventSystem.Instance.PushEvent(GAME_EVENT_ID.GE_INFO_SELF, "合成该物品前需要学习/使用:" + pDefine.szName);
                return(COMPOSE_ITEM_RESULT.COMPOSE_NO_ABILITY);
            }

            for (int i = 0; i < myPrescr.m_pDefine.mStuffs.Length; i++)
            {
                Stuff stuffNeed = myPrescr.m_pDefine.mStuffs[i];
                if (stuffNeed.nID != MacroDefine.INVALID_ID)
                {
                    int nCount = CDataPool.Instance.UserBag_CountItemByIDTable(stuffNeed.nID);
                    if (nCount < stuffNeed.nNum * nMakeCount)
                    {
                        bEnoughStuff = false;
                        break;
                    }
                }
            }
            if (!bEnoughStuff)
            {
                CEventSystem.Instance.PushEvent(GAME_EVENT_ID.GE_INFO_SELF, "材料不足");
                return(COMPOSE_ITEM_RESULT.COMPOSE_NO_ENOUGHSTUFF);
            }
            GameProcedure.s_pGameInterface.Player_UseLifeAbility(nPrescrID, nMakeCount, 0);
            return(COMPOSE_ITEM_RESULT.COMPOSE_SUCCESS);
        }