public eErrorCode ChangeLegendSetOpt(ref rdItem changeItem)
        {
            // 기존 옵션 제거
            rdOption option = changeItem.AddOpts.Find(x => x.Grade == eOptGrade.Legend || x.Grade == eOptGrade.Set);

            if (null == option)
            {
                return(eErrorCode.Error);
            }

            int hit = m_random.Next(0, 2);

            if (hit == 0)
            {
                changeItem.Grade = eGrade.Legend;
            }
            else
            {
                changeItem.Grade = eGrade.Set;
            }

            eOption kind = GetLegendSetOption(changeItem.Grade, changeItem.Parts, changeItem.Lv);

            option.Kind  = kind;
            option.Grade = GetOptGrade(kind);
            option.Value = GetValue(changeItem.Lv, kind);

            return(eErrorCode.Success);
        }
        public void GetItemWithBoss(fmDropItem fdi, eOption selecedOpt, out rdItem item)
        {
            int    lv    = fdi.Lv;
            eGrade grade = fdi.Grade;
            eParts parts = fdi.Parts;

            item         = new rdItem();
            item.Lv      = lv;
            item.Grade   = grade;
            item.Parts   = parts;
            item.BaseOpt = new List <rdOption>();
            item.AddOpts = new List <rdOption>();



            GetBaseOpt(item);


            List <eOption> temp = GetList(eGrade.Normal, parts, lv);

            int cnt = GetOptionCount(grade);

            //Console.WriteLine(cnt);
            for (int i = 0; i < cnt; ++i)
            {
                int hit = m_random.Next(0, temp.Count);

                eOption   kind = temp.ElementAt(hit);
                eOptGrade cc   = (eOptGrade)((int)kind >> 8);

                rdOption option = new rdOption(i + 1, false, GetOptGrade(kind), kind, GetValue(lv, kind));
                item.AddOpts.Add(option);
                temp.RemoveAt(hit);
                if (cc == eOptGrade.Normal)
                {
                    eOption remove = (eOption)((int)kind + ((int)eOptGrade.Normal << 8));
                    temp.Remove(remove);
                }
                else if (cc == eOptGrade.Epic)
                {
                    eOption remove = (eOption)((int)kind - ((int)eOptGrade.Normal << 8));
                    temp.Remove(remove);
                }
                // eOptCategory
            }

            if (eGrade.Legend <= grade)
            {
                eOptGrade optGrade = GetLegendSetOptGrade(grade);
                //Console.WriteLine(optGrade);
                eOption  kind   = selecedOpt;
                rdOption option = new rdOption(cnt + 1, false, optGrade, kind, GetValue(lv, kind));
                item.AddOpts.Add(option);
            }
        }
예제 #3
0
        public eErrorCode Remelt(ref rdItem remeltItem, int optIndex, eOption selectedOpt)
        {
            if (null == remeltItem)
            {
                return(eErrorCode.Auth_PleaseLogin);
            }

            eOption   kind     = selectedOpt;
            eOptGrade cc       = (eOptGrade)((int)kind >> 8);
            eOption   normKind = eOption.None;
            eOption   epicKind = eOption.None;

            if (cc == eOptGrade.Normal)
            {
                normKind = kind;
                epicKind = (eOption)((int)kind + ((int)eOptGrade.Normal << 8));
            }
            else if (cc == eOptGrade.Epic)
            {
                normKind = (eOption)((int)kind - ((int)eOptGrade.Normal << 8));
                epicKind = kind;
            }

            rdOption remeltOpt = null;

            foreach (var node in remeltItem.AddOpts)
            {
                if (node.Index == optIndex)
                {
                    remeltOpt = node;
                }
                else
                {
                    if (true == node.Remelt)
                    {
                        return(eErrorCode.Item_Remelt_AlreadyOther);
                    }
                    else
                    {
                        if (node.Kind == normKind)
                        {
                            return(eErrorCode.Item_AlreadySameOpt);
                        }

                        if (node.Kind == epicKind)
                        {
                            return(eErrorCode.Item_AlreadySameOpt);
                        }
                    }
                }
            }

            if (null == remeltOpt)
            {
                return(eErrorCode.Params_InvalidParam);
            }

            remeltOpt.Remelt = true;

            Logger.Debug("optIndex {0}", optIndex);
            Logger.Debug("remeltOpt.Grade {0}", remeltOpt.Grade);


            if (eOptGrade.Legend == remeltOpt.Grade || eOptGrade.Set == remeltOpt.Grade)
            {
                return(eErrorCode.Item_OutOfType);
            }


            remeltOpt.Kind  = selectedOpt;
            remeltOpt.Grade = GetOptGrade(selectedOpt);

            if (eBeyond.None == remeltItem.Beyond)
            {
                remeltOpt.Value = GetValue(remeltItem.Lv, remeltOpt.Kind);
            }
            else
            {
                remeltOpt.Value = GetAncientValue(remeltItem.Lv, remeltOpt.Kind);
            }



            return(eErrorCode.Success);
        }
예제 #4
0
        public eErrorCode CreateMythic(eOption selectOpt, eElement element, ref rdItem mythicItem)
        {
            rdOption keepOpt = null;

            foreach (var node in mythicItem.AddOpts)
            {
                if (eOptGrade.Legend == node.Grade || eOptGrade.Set == node.Grade)
                {
                    keepOpt = node;
                }
            }

            if (null == keepOpt)
            {
                return(eErrorCode.Error);
            }

            int    lv    = mythicItem.Lv;
            eGrade grade = mythicItem.Grade;
            eParts parts = mythicItem.Parts;

            if (parts != eParts.Weapon)
            {
                if (selectOpt == eOption.None)
                {
                    return(eErrorCode.Params_InvalidParam);
                }
            }

            int changeCode = 0;

            if (parts == eParts.Weapon)
            {
                if (false == ChangeWeaponImageCode(eBeyond.Mythic, mythicItem.Code, out changeCode))
                {
                    Logger.Error("Failed. CreateMythic {0} / {1} / {2}", parts, mythicItem.Code, selectOpt);
                    return(eErrorCode.Server_TableError);
                }
            }
            else
            {
                if (false == ChangePartsImageCode(eBeyond.Mythic, mythicItem.Parts, selectOpt, out changeCode))
                {
                    Logger.Error("Failed. CreateMythic {0} / {1} / {2}", parts, mythicItem.Code, selectOpt);
                    return(eErrorCode.Params_InvalidParam);
                }
            }

            mythicItem.Code   = changeCode;
            mythicItem.Beyond = eBeyond.Mythic;
            mythicItem.AddOpts.Clear();
            mythicItem.BaseOpt.Clear();

            if (parts == eParts.Weapon)
            {
                float min   = 0;
                float max   = 0;
                float speed = 0;
                GetWeapon(lv, out min, out max, out speed);
                {
                    eOption  select = eOption.BWDMin;
                    rdOption option = new rdOption(1, false, eOptGrade.Normal, select, min);
                    mythicItem.BaseOpt.Add(option);
                }
                {
                    eOption  select = eOption.BWDMax;
                    rdOption option = new rdOption(2, false, eOptGrade.Normal, select, max);
                    mythicItem.BaseOpt.Add(option);
                }
                {
                    eOption  select = eOption.AS;
                    rdOption option = new rdOption(3, false, eOptGrade.Normal, select, speed);
                    mythicItem.BaseOpt.Add(option);
                }
                {
                    eOption  select = eOption.Element;
                    float    value  = (float)element;
                    rdOption option = new rdOption(4, false, eOptGrade.Normal, select, value);
                    mythicItem.BaseOpt.Add(option);
                }
            }
            else
            {
                float value = 0f;
                GetBaseValue(mythicItem.Lv, selectOpt, out value);
                rdOption option = new rdOption(1, false, eOptGrade.Normal, selectOpt, value);
                mythicItem.BaseOpt.Add(option);
            }

            List <eOption> temp = GetAncientOptList(parts);

            int cnt = GetOptionCount(grade, eBeyond.Mythic);

            for (int i = 0; i < cnt; ++i)
            {
                int hit = m_random.Next(0, temp.Count);

                eOption kind = temp.ElementAt(hit);

                rdOption option = new rdOption(i + 1, false, GetOptGrade(kind), kind, GetAncientValue(lv, kind));
                mythicItem.AddOpts.Add(option);

                temp.RemoveAt(hit);
            }

            {
                keepOpt.Index = mythicItem.AddOpts.Count + 1;
                mythicItem.AddOpts.Add(keepOpt);
            }

            return(eErrorCode.Success);
        }
예제 #5
0
        public eErrorCode UpToAncient(ref rdItem remeltItem)
        {
            rdOption keepOpt = null;

            foreach (var node in remeltItem.AddOpts)
            {
                if (eOptGrade.Legend == node.Grade || eOptGrade.Set == node.Grade)
                {
                    keepOpt = node;
                }
            }

            if (null == keepOpt)
            {
                return(eErrorCode.Error);
            }


            int    lv    = remeltItem.Lv;
            eGrade grade = remeltItem.Grade;
            eParts parts = remeltItem.Parts;

            bool bChanged   = false;
            int  changeCode = 0;

            //if (parts == eParts.Jewel)
            //{
            //    bChanged = true;
            //    changeCode = remeltItem.Code;
            //}
            //else
            if (parts == eParts.Weapon)
            {
                bChanged = ChangeWeaponImageCode(eBeyond.Ancient, remeltItem.Code, out changeCode);
            }
            else
            {
                bChanged = ChangePartsImageCode(eBeyond.Ancient, parts, remeltItem.BaseOpt.ElementAt(0).Kind, out changeCode);
            }

            if (false == bChanged)
            {
                Logger.Error("Failed. UpToAncient {0} / {1} / {2}", parts, remeltItem.Code, remeltItem.BaseOpt.ElementAt(0).Kind);
                return(eErrorCode.Server_TableError);
            }

            remeltItem.Code = changeCode;
            remeltItem.AddOpts.Clear();

            List <eOption> temp = GetAncientOptList(parts);

            int cnt = GetOptionCount(grade);

            for (int i = 0; i < cnt; ++i)
            {
                int hit = m_random.Next(0, temp.Count);

                eOption kind = temp.ElementAt(hit);

                rdOption option = new rdOption(i + 1, false, GetOptGrade(kind), kind, GetAncientValue(lv, kind));
                remeltItem.AddOpts.Add(option);

                temp.RemoveAt(hit);
            }

            {
                remeltItem.AddOpts.Add(keepOpt);
            }

            remeltItem.Beyond = eBeyond.Ancient;

            return(eErrorCode.Success);
        }
예제 #6
0
        private void GetBaseOpt(rdItem item)
        {
            eOptGrade grade = eOptGrade.Normal;

            // 무기
            if (item.Parts == eParts.Weapon)
            {
                //item.Code = GetWeaponCode();

                float min   = 0;
                float max   = 0;
                float speed = 0;
                item.Code = GetWeapon(item.Lv, out min, out max, out speed);

                // 1. 무기 최소 공격력
                {
                    eOption select = eOption.BWDMin;
                    //float value = 0;
                    //GetBaseValue(item.Lv, select, out value);
                    rdOption option = new rdOption(1, false, grade, select, min);
                    item.BaseOpt.Add(option);
                }
                // 2. 무기 최대 공격력
                {
                    eOption select = eOption.BWDMax;
                    //float value = 0;
                    //GetBaseValue(item.Lv, select, out value);
                    rdOption option = new rdOption(2, false, grade, select, max);
                    item.BaseOpt.Add(option);
                }
                // 4. 공속
                {
                    eOption select = eOption.AS;
                    //float value = 0;
                    //GetBaseValue(item.Lv, select, out value);
                    rdOption option = new rdOption(3, false, grade, select, speed);
                    item.BaseOpt.Add(option);
                }
                // 3. 속성
                {
                    eOption select = eOption.Element;
                    float   value  = 0f;
                    {
                        int b = (int)eElement.None;
                        int e = 1 + (int)eElement.Nature;
                        value = m_random.Next(b, e);
                    }
                    rdOption option = new rdOption(4, false, grade, select, value);
                    item.BaseOpt.Add(option);
                }
            }
            else
            {
                // 기타
                {
                    eOption select = eOption.None;
                    float   value  = 0;
                    int     code   = 0;
                    GetBaseValue(item.Lv, item.Parts, out select, out value, out code);
                    rdOption option = new rdOption(1, false, grade, select, value);
                    item.Code = code;
                    item.BaseOpt.Add(option);
                }
            }
        }