Beispiel #1
0
        /// <summary>
        /// 유저 아이템 목록을 수집합니다.
        /// </summary>
        /// <param name="oS"></param>
        private void TreasureDetail(Session oS)
        {
            LoadingEnd = false;
            JArray  jsonVal = JArray.Parse(oS.GetResponseBodyAsString()) as JArray;
            dynamic Details = jsonVal;

            CurrentTreasureList = new Dictionary <string, TreasureInfo>();

            //this.TreasureReadStart();
            foreach (dynamic detail in Details)
            {
                string name   = detail.name;
                int    count  = detail.number;
                int    image  = detail.image;
                string imgUrl = "http://gbf.game-a.mbga.jp/assets/img/sp/assets/item/article/s/" + image + ".jpg";
                GrandcypherClient.Current.GreetHooker.FileDownloader(imgUrl, image + ".jpg", false);
                TreasureInfo temp = new TreasureInfo
                {
                    Name   = name,
                    count  = count,
                    ItemID = image
                };

                try
                {
                    CurrentTreasureList.Add(name, temp);
                }
                catch (ArgumentException ex)
                {
                    Debug.WriteLine(ex);
                }
            }
            this.TreasureReadEnd();
            LoadingEnd = true;
        }
Beispiel #2
0
        public List <Bullet> GetBulletList()
        {
            InitItemIdx();
            List <Bullet>          templist        = new List <Bullet>();
            IEnumerable <XElement> TranslationList = GetTranslationList(TranslationType.BulletMake);

            foreach (var item in TranslationList)
            {
                Bullet temp = new Bullet();
                temp.MaterialList = new List <TreasureInfo>();

                temp.Name       = ElementOutput(item, "Name");
                temp.TrName     = ElementOutput(item, "TrName");
                temp.MasterID   = Convert.ToInt32(ElementOutput(item, "ID"));
                temp.BulletKind = Convert.ToInt32(ElementOutput(item, "BulletKind"));
                temp.Rank       = Convert.ToInt32(ElementOutput(item, "Rank"));

                int  Count   = 1;
                bool Checker = true;

                while (Checker)
                {
                    //이름작성
                    string Materialstr = "Material";
                    var    strtemp     = Materialstr + Count.ToString();

                    TreasureInfo material = new TreasureInfo();

                    if (item.Element(strtemp) != null)
                    {
                        material.Name = item.Element(strtemp).Value;
                        strtemp       = "MaterialCount" + Count.ToString();
                        material.max  = Convert.ToInt32(item.Element(strtemp).Value);
                        try
                        {
                            material.ItemID = ItemDic[material.Name];
                        }
                        catch
                        {
                            material.ItemID = -1;
                        }

                        temp.MaterialList.Add(material);
                        Count++;
                    }
                    else
                    {
                        break;
                    }
                }                //while구문 종료

                templist.Add(temp);
            }

            return(templist);
        }
Beispiel #3
0
        public List<Bullet> GetBulletList()
        {
            InitItemIdx();
            List<Bullet> templist = new List<Bullet>();
            IEnumerable<XElement> TranslationList = GetTranslationList(TranslationType.BulletMake);
            foreach (var item in TranslationList)
            {
                Bullet temp = new Bullet();
                temp.MaterialList = new List<TreasureInfo>();

                temp.Name = ElementOutput(item, "Name");
                temp.TrName = ElementOutput(item, "TrName");
                temp.MasterID = Convert.ToInt32(ElementOutput(item, "ID"));
                temp.BulletKind = Convert.ToInt32(ElementOutput(item, "BulletKind"));
                temp.Rank = Convert.ToInt32(ElementOutput(item, "Rank"));

                int Count = 1;
                bool Checker = true;

                while (Checker)
                {
                    //이름작성
                    string Materialstr = "Material";
                    var strtemp = Materialstr + Count.ToString();

                    TreasureInfo material = new TreasureInfo();

                    if (item.Element(strtemp) != null)
                    {
                        material.Name = item.Element(strtemp).Value;
                        strtemp = "MaterialCount" + Count.ToString();
                        material.max = Convert.ToInt32(item.Element(strtemp).Value);
                        try
                        {
                            material.ItemID = ItemDic[material.Name];
                        }
                        catch
                        {
                            material.ItemID = -1;
                        }

                        temp.MaterialList.Add(material);
                        Count++;
                    }
                    else
                    {
                        break;
                    }

                }//while구문 종료

                templist.Add(temp);
            }

            return templist;
        }
        private void CalcTreasure()
        {
            if (this.CustomList.Count < 1 || GrandcypherClient.Current.TreasureHooker.CurrentTreasureList == null) return;

            this.TreasureList = new List<TreasureInfo>();
            List<TreasureInfo> temp_lst = new List<TreasureInfo>();

            foreach (var item in this.CustomList)
            {
                var customtemp = item.GetMaterialList();
                temp_lst = temp_lst.Concat(customtemp).ToList();
            }
            foreach (var item in temp_lst)
            {
                TreasureInfo treasure_temp = new TreasureInfo();
                if (TreasureList.Any(x => x.ItemID == item.ItemID))
                {
                    TreasureList.Find(x => x.ItemID == item.ItemID).max += item.max;
                }
                else
                {
                    treasure_temp.Name = item.Name;
                    treasure_temp.max = item.max;
                    treasure_temp.ItemID = item.ItemID;
                    TreasureList.Add(treasure_temp);
                }
            }
            List<TreasureInfo> calcList = new List<TreasureInfo>();
            //GrandcypherClient.Current.TreasureHooker.CurrentTreasureList.Values= 현재 트래저 목록
            //TreasureList= 설정에 따라 불러온 트래저 목록
            foreach (var current in GrandcypherClient.Current.TreasureHooker.CurrentTreasureList.Values)
            {
                foreach (var target in TreasureList)
                {
                    if (target.ItemID == current.ItemID)
                    {
                        TreasureInfo temp_t = new TreasureInfo();

                        temp_t.Name = current.Name;
                        temp_t.result = target.max - current.count;
                        temp_t.ItemID = current.ItemID;

                        if (temp_t.result > 0) calcList.Add(temp_t);
                    }
                }
            }
            List<TreasureInfo> modified_list = new List<TreasureInfo>(calcList);
            foreach (var item in TreasureList)
            {
                if (GrandcypherClient.Current.TreasureHooker.CurrentTreasureList.Values.Where(x => x.ItemID == item.ItemID).FirstOrDefault() == default(TreasureInfo))
                {
                    TreasureInfo temp_t = new TreasureInfo();

                    temp_t.Name = item.Name;
                    temp_t.result = item.max;
                    temp_t.ItemID = item.ItemID;
                    if (temp_t.result > 0) modified_list.Add(temp_t);
                }
            }
            this.TreasureList = new List<TreasureInfo>(modified_list);
        }
        private void RemoveCompleteTreasure()
        {
            if (GrandcypherClient.Current.TreasureHooker.CurrentTreasureList == null) return;
            if (GrandcypherClient.Current.TreasureHooker.CurrentTreasureList.Count < 1) return;

            List<TreasureInfo> temp = new List<TreasureInfo>(GrandcypherClient.Current.TreasureHooker.CurrentTreasureList.Values);
            List<TreasureInfo> result = new List<TreasureInfo>();

            List<TenTreasureInfo> targetList = new List<TenTreasureInfo>(GrandcypherClient.Current.Translations.GetTreasureList());
            List<TenTreasureInfo> ElementList = targetList.Where(x => x.ElementID != 0).ToList();
            List<TenTreasureInfo> AnotherList = targetList.Where(x => x.ElementID == 0).ToList();

            var Origin = ElementList.Where(x => x.Origin == 1).ToList();
            var Magna = ElementList.Where(x => x.Origin == 2).ToList();
            List<TenTreasureInfo> ProtoList = new List<TenTreasureInfo>();

            for (int i = 0; i < Origin.Count; i++)
            {
                if (Origin[i].ElementID == ElementTable[this.SelectedElement])
                {
                    Origin[i].Element += 3;
                    Origin[i].Second += 3;
                    Origin[i].Fourth += 3;
                }
            }

            for (int i = 0; i < Magna.Count; i++)
            {
                if (Magna[i].ElementID == ElementTable[this.SelectedElement])
                    Magna[i].Fifth += 60;
            }

            ProtoList = ElementList.Where(x => x.Proto > 0).ToList();

            switch (ElementTable[this.SelectedElement])
            {
                case 1:
                    ElementList = ElementList.Where(x => x.ElementID == 1 && x.Origin == 0).ToList();
                    break;
                case 2:
                    ElementList = ElementList.Where(x => x.ElementID == 2 && x.Origin == 0).ToList();
                    break;
                case 3:
                    ElementList = ElementList.Where(x => x.ElementID == 3 && x.Origin == 0).ToList();
                    break;
                case 4:
                    ElementList = ElementList.Where(x => x.ElementID == 4 && x.Origin == 0).ToList();
                    break;
                case 5:
                    ElementList = ElementList.Where(x => x.ElementID == 5 && x.Origin == 0).ToList();
                    break;
                case 6:
                    ElementList = ElementList.Where(x => x.ElementID == 6 && x.Origin == 0).ToList();
                    break;
            }
            targetList = new List<TenTreasureInfo>(AnotherList.Concat(ElementList).Concat(Magna).Concat(Origin).ToList());
            if (ElementTable[this.SelectedElement] != 5)
            {
                List<TenTreasureInfo> outputList = new List<TenTreasureInfo>();
                foreach (var item in ProtoList)
                {
                    TenTreasureInfo tempoutput = new TenTreasureInfo
                    {
                        Name = item.Name,
                        Proto = item.Proto
                    };
                    outputList.Add(tempoutput);
                }
                targetList = new List<TenTreasureInfo>(outputList.Concat(targetList).ToList());
            }
            //temp=현재 보유하고 있는 아이템목록
            //targetlist=정리된 십천중 필요목록
            targetList = new List<TenTreasureInfo>(GrandcypherClient.Current.Translations.SetItemIdxList(targetList));
            foreach (var item in targetList)
            {
                var search = temp.Where(x => x.ItemID == item.idx).ToList();
                TreasureInfo target = new TreasureInfo();

                //아이템 보유목록에 필요목록에 있는 아이템이 존재하는 경우
                if (search.Count > 0)
                {
                    target = search[0];
                }
                else//아이템이 비활성화인 경우 기초값으로 생성
                {
                    target = new TreasureInfo
                    {
                        Name = item.Name,
                        count = 0,
                        ItemID = -1,
                    };
                }
                if (target.Name == null || target.Name == string.Empty) continue;
                target.max = 0;//max값을 초기화

                //max값에 필요 아이템값을 모두 합산
                if (!Proto && item.Proto > 0)
                    target.max += item.Proto;
                if (!Rust && item.Rust > 0)
                    target.max += item.Rust;
                if (!Element && item.Element > 0)
                    target.max += item.Element;
                if (!First && item.First > 0)
                    target.max += item.First;
                if (!Second && item.Second > 0)
                    target.max += item.Second;
                if (!Third && item.Third > 0)
                    target.max += item.Third;
                if (!Fourth && item.Fourth > 0)
                    target.max += item.Fourth;
                if (!Fifth && item.Fifth > 0)
                    target.max += item.Fifth;

                target.max += item.Sixth;
                target.result = target.max - target.count;

                if (target.result > 0)
                    result.Add(target);
            }
            this.TreasureList = new List<TreasureInfo>(result);
        }
        /// <summary>
        /// 유저 아이템 목록을 수집합니다.
        /// </summary>
        /// <param name="oS"></param>
        private void TreasureDetail(Session oS)
        {
            LoadingEnd = false;
            JArray jsonVal = JArray.Parse(oS.GetResponseBodyAsString()) as JArray;
            dynamic Details = jsonVal;

            CurrentTreasureList = new Dictionary<string, TreasureInfo>();

            //this.TreasureReadStart();
            foreach (dynamic detail in Details)
            {
                string name = detail.name;
                int count = detail.number;
                int image = detail.image;
                string imgUrl = "http://gbf.game-a.mbga.jp/assets/img/sp/assets/item/article/s/" + image + ".jpg";
                GrandcypherClient.Current.GreetHooker.FileDownloader(imgUrl, image + ".jpg", false);
                TreasureInfo temp = new TreasureInfo
                {
                    Name = name,
                    count = count,
                    ItemID = image
                };

                CurrentTreasureList.Add(name, temp);
            }
            this.TreasureReadEnd();
            LoadingEnd = true;
        }