示例#1
0
        public async static Task <String> CalculateLisbethResplendentOrder(String job, int finalItemId, int cMaterialId, int bMaterialId, int cComponentId, int bComponentId, int aComponentId)
        {
            List <LisbethOrder> outList = new List <LisbethOrder>();

            var item           = InventoryManager.FilledSlots.FirstOrDefault(i => i.RawItemId == finalItemId);
            int finalItemCount = (int)(item == null ? 0 : item.Count);

            LisbethOrder order;

            if (ConditionParser.HasAtLeast((uint)cMaterialId, 2))
            {
                order = new LisbethOrder(1, 1, cComponentId, NumberToCraft(finalItemCount, cMaterialId), job);
            }
            else if (ConditionParser.HasAtLeast((uint)bMaterialId, 2))
            {
                order = new LisbethOrder(1, 1, bComponentId, NumberToCraft(finalItemCount, bMaterialId), job);
            }
            else
            {
                order = new LisbethOrder(1, 1, aComponentId, 30 - finalItemCount / 2, job);
            }
            outList.Add(order);
            return(JsonConvert.SerializeObject(outList, Formatting.None));
        }
示例#2
0
        public async Task <bool> PrintGCSupplyList()
        {
            if (!ContentsInfo.Instance.IsOpen)
            {
            }


            if (!ContentsInfoDetail.Instance.IsOpen)
            {
                Logging.Write($"Trying to open window");

                if (!ContentsInfo.Instance.IsOpen)
                {
                    if (await ContentsInfo.Instance.Open())
                    {
                        ContentsInfo.Instance.OpenGCSupplyWindow();
                    }
                }

                await Coroutine.Wait(5000, () => ContentsInfoDetail.Instance.IsOpen);

                if (!ContentsInfoDetail.Instance.IsOpen)
                {
                    Logging.Write($"Nope failed opening GC Supply window");
                    return(false);
                }
            }

            if (!ContentsInfoDetail.Instance.IsOpen)
            {
                Logging.Write($"Nope failed");
                return(false);
            }
            List <LisbethOrder> outList = new List <LisbethOrder>();
            int id = 0;

            foreach (var item in ContentsInfoDetail.Instance.GetCraftingTurninItems())
            {
                Logging.Write($"{item.Key} Qty: {item.Value.Key} Class: {item.Value.Value}");
                var order = new LisbethOrder(id, 1, (int)item.Key.Id, item.Value.Key, item.Value.Value);
                outList.Add(order);

                id++;
            }

            foreach (var item in ContentsInfoDetail.Instance.GetGatheringTurninItems())
            {
                Logging.Write($"{item.Key} Qty: {item.Value.Key} Class: {item.Value.Value}");
                var order = new LisbethOrder(id, 1, (int)item.Key.Id, item.Value.Key, "Gather");
                if (!item.Value.Value.Equals("Fisher"))
                {
                    outList.Add(order);
                }
                id++;
            }

            ContentsInfoDetail.Instance.Close();
            ContentsInfo.Instance.Close();

            foreach (var order in outList)
            {
                Logging.Write($"{order}");
            }

            using (StreamWriter outputFile = new StreamWriter("GCSupply.json", false))
            {
                outputFile.Write(JsonConvert.SerializeObject(outList, Formatting.None));
            }

            return(true);
        }
示例#3
0
        public static async Task <string> GetGCSupplyList()
        {
            if (!ContentsInfoDetail.Instance.IsOpen)
            {
                Logging.Write($"Trying to open window");

                if (!ContentsInfo.Instance.IsOpen)
                {
                    if (await ContentsInfo.Instance.Open())
                    {
                        ContentsInfo.Instance.OpenGCSupplyWindow();
                    }
                }

                await Coroutine.Wait(5000, () => ContentsInfoDetail.Instance.IsOpen);

                if (!ContentsInfoDetail.Instance.IsOpen)
                {
                    Logging.Write($"Nope failed opening GC Supply window");
                    return("");
                }
            }

            if (!ContentsInfoDetail.Instance.IsOpen)
            {
                Logging.Write($"Nope failed");
                return("");
            }



            List <LisbethOrder> outList = new List <LisbethOrder>();
            int id = 0;

            foreach (var item in ContentsInfoDetail.Instance.GetCraftingTurninItems().Where(item => !InventoryManager.FilledSlots.Any(i => i.RawItemId == item.Key.Id && !i.HasMateria() && i.Count >= item.Value.Key)))
            {
                Logging.Write($"{item.Key} Qty: {item.Value.Key} Class: {item.Value.Value}");
                var order = new LisbethOrder(id, 1, (int)item.Key.Id, item.Value.Key, item.Value.Value);
                outList.Add(order);

                id++;
            }

            foreach (var item in ContentsInfoDetail.Instance.GetGatheringTurninItems().Where(item => !InventoryManager.FilledSlots.Any(i => i.RawItemId == item.Key.Id && i.Count >= item.Value.Key)))
            {
                Logging.Write($"{item.Key} Qty: {item.Value.Key} Class: {item.Value.Value}");
                string type = "Gather";
                if (item.Value.Value.Equals("Fisher"))
                {
                    continue; //type = "Fisher";
                }
                var order = new LisbethOrder(id, 2, (int)item.Key.Id, item.Value.Key, type, true);

                outList.Add(order);
                id++;
            }

            ContentsInfoDetail.Instance.Close();
            ContentsInfo.Instance.Close();

            /*foreach (var order in outList)
             * {
             *  Logging.Write($"{order}");
             * }*/
            if (outList.Count == 0)
            {
                return("");
            }
            return(JsonConvert.SerializeObject(outList, Formatting.None));
        }