GetQuality() public method

public GetQuality ( ) : int
return int
Beispiel #1
0
        /*
         * 通过灵魂晶石来锻造提高武器的品质,每个等级锻造的成功率不一样。
         * 1--2,2--3,3--4,4--5的升级成功率都是100%。
         * 普通升良(0--1):30%成功
         * 良升上(1--2):12%成功
         * 上升精(2--3):6%成功
         * 精升极(3--4):4%成功
         *
         */
        private int RateSuccForQuality(GameStruct.RoleItemInfo item)
        {
            int iQuality = item.GetQuality();

            if (iQuality == 0)
            {
                return(30);
            }
            else if (iQuality == 1)
            {
                return(12);
            }
            else if (iQuality == 2)
            {
                return(6);
            }
            else if (iQuality == 3)
            {
                return(4);
            }
            //神器
            else if (iQuality == 4)
            {
                return(12);
            }
            else if (iQuality == 5)
            {
                return(6);
            }
            else if (iQuality == 6)
            {
                return(4);
            }
            return(-1);
        }
Beispiel #2
0
        //提升装备品质
        public void EquipQuality(PlayerObject play, uint srcid, uint materialid)
        {
            const int LINGHUNJINGSHI = 1037160; //灵魂晶石ID
            const int LINGHUNWANG    = 1037169; //灵魂王
            const int SHENQIZHILEI   = 1037200; //神祈之泪
            // const int HUNWUSHENQIZHILEI = 1025754; //魂武神祈之泪
            const int MAX_QUALIY = 7;           //最高品质 神器

            GameStruct.RoleItemInfo item         = play.GetItemSystem().FindItem(srcid);
            GameStruct.RoleItemInfo materialitem = play.GetItemSystem().FindItem(materialid);
            if (item == null || materialitem == null)
            {
                return;
            }
            if (item.GetQuality() == MAX_QUALIY)
            {
                return;                                  //已达到最高品质
            }
            int  rand    = GameStruct.IRandom.Random(1, 100);
            bool bUpdate = false;

            if (!play.GetItemSystem().IsEquip(item.itemid))
            {
                return;                                             //不是装备就不提升了
            }
            NetMsg.MsgEquipOperationRet ret = new NetMsg.MsgEquipOperationRet();
            ret.Create(null, play.GetGamePackKeyEx());
            ret.srcid  = srcid;
            ret.destid = materialid;
            ret.type   = 196610;//{2,0,3,0}
            if (materialitem.itemid == LINGHUNJINGSHI ||
                materialitem.itemid == SHENQIZHILEI)
            {
                //检测是否有足够的灵魂晶石或者神祈之类
                if (!play.GetItemSystem().DeleteItemByID(materialid))
                {
                    return;
                }
                if (rand < this.RateSuccForQuality(item))
                {
                    item.UpQuality();
                    bUpdate = true;
                    ret.ret = 1;
                }
            }
            else if (materialitem.itemid == LINGHUNWANG &&
                     item.GetQuality() <= 4 /*极品武器以下可以用灵魂王升级*/)
            {
                //检测是否有足够的灵魂王
                if (!play.GetItemSystem().DeleteItemByID(materialid))
                {
                    return;
                }
                item.UpQuality();
                bUpdate = true;
                ret.ret = 1;
            }
            if (bUpdate)
            {
                //锻造者名称-
                if (item.forgename.Length == 0)
                {
                    item.forgename = play.GetName();
                }
                play.GetItemSystem().UpdateItemInfo(item.id);
            }
            play.SendData(ret.GetBuffer());
        }