Ejemplo n.º 1
0
        /// <summary>
        /// 新建道具
        /// </summary>
        /// <param name="items">道具字典</param>
        public static void MakeMergeItem(Dictionary <int, int[]> items)
        {
            if (items.Count <= 0)
            {
                return;
            }

            DateFile df = DateFile.instance;

            foreach (KeyValuePair <int, int[]> item in items)
            {
                int id = int.Parse(df.GetItemDate(item.Key, 999)), surpluses = int.Parse(df.GetItemDate(item.Key, 901)), limit = int.Parse(df.GetItemDate(item.Key, 902)),
                                               level = int.Parse(df.GetItemDate(item.Key, 8)), type = int.Parse(df.GetItemDate(item.Key, 5));

                if (Main.settings.enabledSize && Main.settings.itemsSize > 1)
                {
                    int sizeCount = item.Value[1] / int.Parse(Main.settings.itemsSize.ToString());
                    int itemNaiJiu = item.Value[0], itemMaxNaiJiu = item.Value[1];
                    Main.logger.Log(sizeCount.ToString());
                    for (int i = 0; i <= sizeCount; i++)
                    {
                        int makeItemId = df.MakeNewItem(item.Key);
                        df.GetItem(df.mianActorId, makeItemId, 1, false, -1, 0);

                        //耐久小于或等于0就创建为0的道具吧,然后结束循环。
                        //耐久大于合并大小才会继续拆,继续循环。
                        //耐久小于或者等于最大耐久就走最后一个,结束循环。
                        if (itemNaiJiu <= 0)
                        {
                            df.itemsDate[makeItemId][901] = "0";
                            df.itemsDate[makeItemId][902] = itemMaxNaiJiu.ToString();
                            break;
                        }
                        else if (itemNaiJiu > Main.settings.itemsSize)
                        {
                            df.itemsDate[makeItemId][901] = Main.settings.itemsSize.ToString();
                            df.itemsDate[makeItemId][902] = Main.settings.itemsSize.ToString();
                            itemNaiJiu    -= int.Parse(Main.settings.itemsSize.ToString());
                            itemMaxNaiJiu -= int.Parse(Main.settings.itemsSize.ToString());
                        }
                        else
                        {
                            df.itemsDate[makeItemId][901] = itemNaiJiu.ToString();
                            df.itemsDate[makeItemId][902] = itemMaxNaiJiu.ToString();
                            break;
                        }
                    }
                }
                else
                {
                    //不拆直接创建。
                    int makeItemId = df.MakeNewItem(item.Key);
                    df.GetItem(df.mianActorId, makeItemId, 1, false, -1, 0);
                    df.itemsDate[makeItemId][901] = item.Value[0].ToString();
                    df.itemsDate[makeItemId][902] = item.Value[1].ToString();
                }
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 执行合并道具
        /// </summary>
        public static void RunningMergeItems()
        {
            if (!Main.enabled || Main.settings.bookLevel.Count == 0 || Main.settings.bookMergeType.Count == 0)
            {
                return;
            }

            DateFile df = DateFile.instance;
            Dictionary <int, string[]> items   = new Dictionary <int, string[]>();
            Dictionary <int, int>      itemsId = new Dictionary <int, int>();

            if (df.actorItemsDate.TryGetValue(df.mianActorId, out itemsId))
            {
                Main.LevelSon = new List <int> {
                    DateFile.instance.enemyBorn, DateFile.instance.xxLevel, DateFile.instance.enemySize,
                    DateFile.instance.worldResource, DateFile.instance.randomHeir
                };

                //处理人物身上所有书籍
                List <int> buffer = itemsId.Keys.ToList();
                foreach (int itemId in buffer)
                {
                    string id = df.GetItemDate(itemId, 999), surpluses = df.GetItemDate(itemId, 901), limit = df.GetItemDate(itemId, 902),
                             level = df.GetItemDate(itemId, 8), type = df.GetItemDate(itemId, 5), group = df.GetItemDate(itemId, 98);
                    if (type != "21" || !Main.settings.bookMergeType.Contains(int.Parse(group)))
                    {
                        continue;
                    }
                    if (!Main.settings.bookLevel.Contains(int.Parse(level)) || id == "5005")
                    {
                        continue;
                    }

                    if (items.ContainsKey(int.Parse(id)))
                    {
                        items[int.Parse(id)][0] = (int.Parse(surpluses) + int.Parse(items[int.Parse(id)][0])).ToString();
                        items[int.Parse(id)][1] = (int.Parse(limit) + int.Parse(items[int.Parse(id)][1])).ToString();
                        items[int.Parse(id)][2] = ProcessingPages(df.itemsDate[itemId][33], items[int.Parse(id)][2], int.Parse(group), int.Parse(level));
                    }
                    else
                    {
                        items.Add(int.Parse(id), new string[] { surpluses, limit, df.itemsDate[itemId][33] });
                    }

                    df.LoseItem(df.mianActorId, itemId, itemsId[itemId], true);
                }

                //生成合并后的书籍
                foreach (KeyValuePair <int, string[]> item in items)
                {
                    int makeItemId = df.MakeNewItem(item.Key);
                    df.GetItem(df.mianActorId, makeItemId, 1, false, -1, 0);
                    df.itemsDate[makeItemId][901] = item.Value[0];
                    df.itemsDate[makeItemId][902] = item.Value[1];
                    df.itemsDate[makeItemId][33]  = item.Value[2];
                }
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 拆分药品
        /// </summary>
        public static void ResolveMergeDrugs()
        {
            if (!Main.enabled || Main.settings.drugsCount <= 0) return;

            DateFile df = DateFile.instance;
            Dictionary<int, int> items = new Dictionary<int, int>();
            Dictionary<int, int> itemsId = new Dictionary<int, int>();
            if (df.actorItemsDate.TryGetValue(df.mianActorId, out itemsId))
            {
                List<int> buffer = itemsId.Keys.ToList();
                foreach (int itemId in buffer)
                {
                    string id = df.GetItemDate(itemId, 999), surpluses = df.GetItemDate(itemId, 901), limit = df.GetItemDate(itemId, 902),
                        level = df.GetItemDate(itemId, 8), type = df.GetItemDate(itemId, 5);
                    
                    if (type != "31") continue;
                    if (!Main.settings.drugsLevel.Contains(int.Parse(level))) continue;
                    if (int.Parse(surpluses) < (Main.settings.drugsCount * Main.settings.drugsSize)) continue;

                    if (!items.ContainsKey(int.Parse(id))) items.Add(int.Parse(id), itemId);
                    
                }
                Main.logger.Log(items.Count.ToString());
                if (items.Count <= 0)
                {
                    Main.logger.Log("拆分失败:没有找到足够拆分的药品,合并后再试试。");
                }
                else
                {
                    foreach (KeyValuePair<int, int> item in items)
                    {
                        Dictionary<int, string> baseItem = df.itemsDate[item.Value];
                        int size = int.Parse(Main.settings.drugsSize.ToString()) + 1;
                        if (Main.settings.drugsSize <= 1) size = 2;
                        if (Main.settings.drugsSize > 5) size = 5;

                        for (int i = 0; i < Main.settings.drugsCount; i++)
                        {
                            if (int.Parse(df.itemsDate[item.Value][901]) == size) break;

                            int makeItemId = df.MakeNewItem(item.Key);
                            df.GetItem(df.mianActorId, makeItemId, 1, false, -1, 0);
                            df.itemsDate[makeItemId][901] = size.ToString();
                            df.itemsDate[makeItemId][902] = size.ToString();
                            df.itemsDate[item.Value][901] = (int.Parse(df.itemsDate[item.Value][901]) - size).ToString();
                            df.itemsDate[item.Value][902] = (int.Parse(df.itemsDate[item.Value][902]) - size).ToString();
                        }
                    }
                    Main.logger.Log("拆分成功。");
                }
            }

            Main.logger.Log("拆分失败:没有进入游戏存档,无法读取数据。");
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 执行合并道具
        /// </summary>
        public static void RunningMergeItems()
        {
            if (!Main.enabled || Main.settings.mergeType.Count <= 0)
            {
                return;
            }

            DateFile df = DateFile.instance;

            //需要合并的道具字典
            Dictionary <int, int[]> items = new Dictionary <int, int[]>();

            Dictionary <int, int> itemsId = new Dictionary <int, int>();

            if (df.actorItemsDate.TryGetValue(df.mianActorId, out itemsId))
            {
                List <int> buffer = itemsId.Keys.ToList();
                foreach (int itemId in buffer)
                {
                    int id = int.Parse(df.GetItemDate(itemId, 999)), surpluses = int.Parse(df.GetItemDate(itemId, 901)), limit = int.Parse(df.GetItemDate(itemId, 902)),
                             level = int.Parse(df.GetItemDate(itemId, 8)), type = int.Parse(df.GetItemDate(itemId, 5));

                    //存在合并物品的类型的话
                    if (Main.settings.mergeType.Contains(type))
                    {
                        //如果是酒水药品,就检查等级,不是所需等级跳过本次循环。
                        if ((type == 37 || type == 41) && !Main.settings.itemLevel.Contains(level))
                        {
                            continue;
                        }

                        //存在就叠加数值,不存在就新增
                        if (items.ContainsKey(id))
                        {
                            items[id][0] += surpluses;
                            items[id][1] += limit;
                        }
                        else
                        {
                            items.Add(id, new int[] { surpluses, limit });
                        }

                        //删掉这个道具
                        df.LoseItem(df.mianActorId, itemId, -1, true);
                    }
                }

                Main.MakeMergeItem(items);
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 作弊的合并食物
        /// </summary>
        public static void FoodMergeCheat()
        {
            DateFile df = DateFile.instance;
            Dictionary <int, Dictionary <int, string> > foods = new Dictionary <int, Dictionary <int, string> >();
            Dictionary <int, int> itemsId = new Dictionary <int, int>();

            if (!df.actorItemsDate.TryGetValue(df.mianActorId, out itemsId))
            {
                Main.logger.Log("失败itemsId");
                return;
            }

            List <int> buffer = itemsId.Keys.ToList();

            foreach (int itemId in buffer)
            {
                string id = df.GetItemDate(itemId, 999), level = df.GetItemDate(itemId, 8), type = df.GetItemDate(itemId, 98);

                if (!Main.settings.foodLevel.Contains(int.Parse(level)))
                {
                    continue;
                }
                if (!foodType.Contains(int.Parse(type)))
                {
                    continue;
                }

                Dictionary <int, string> foodData = new Dictionary <int, string>();

                /*
                 * if (!df.itemsDate.TryGetValue(itemId, out foodData))
                 * {
                 *  Main.logger.Log("失败itemId");
                 *  continue;
                 * }
                 */
                foodData = Items.GetItem(itemId);

                CompareFoodsParams(id, foodData, ref foods);

                //删掉这个item
                df.LoseItem(df.mianActorId, itemId, itemsId[itemId], true);
            }
            Main.logger.Log("合并了" + foods.Count.ToString());
            if (foods.Count > 0)
            {
                MakeFoods(foods);
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// 执行合并道具
        /// </summary>
        public static void RunningMergeItems()
        {
            if (!Main.enabled && Main.settings.mergeType.Count <= 0)
            {
                return;
            }

            DateFile df = DateFile.instance;
            Dictionary <int, int[]> items   = new Dictionary <int, int[]>();
            Dictionary <int, int>   itemsId = new Dictionary <int, int>();

            if (df.actorItemsDate.TryGetValue(df.mianActorId, out itemsId))
            {
                List <int> buffer = itemsId.Keys.ToList();
                foreach (int itemId in buffer)
                {
                    string id = df.GetItemDate(itemId, 999), surpluses = df.GetItemDate(itemId, 901), limit = df.GetItemDate(itemId, 902),
                             level = df.GetItemDate(itemId, 8), type = df.GetItemDate(itemId, 5);
                    if (!Main.settings.mergeType.Contains(int.Parse(type)))
                    {
                        continue;
                    }
                    if ((type == "35" || type == "34") && !Main.settings.itemLevel.Contains(int.Parse(level)))
                    {
                        continue;
                    }

                    if (items.ContainsKey(int.Parse(id)))
                    {
                        items[int.Parse(id)][0] += int.Parse(surpluses);
                        items[int.Parse(id)][1] += int.Parse(limit);
                    }
                    else
                    {
                        items.Add(int.Parse(id), new int[] { int.Parse(surpluses), int.Parse(limit) });
                    }

                    df.LoseItem(df.mianActorId, itemId, itemsId[itemId], true);
                }

                foreach (KeyValuePair <int, int[]> item in items)
                {
                    int makeItemId = df.MakeNewItem(item.Key);
                    df.GetItem(df.mianActorId, makeItemId, 1, false, -1, 0);
                    df.itemsDate[makeItemId][901] = item.Value[0].ToString();
                    df.itemsDate[makeItemId][902] = item.Value[1].ToString();
                }
            }
        }
Ejemplo n.º 7
0
        public static bool GetFamilyGongFaLevel_Prefix(DateFile __instance, ref int __result, int actorId, int typ, bool getSize = false)
        {
            if (!Main.enabled || Main.settings.UsedOriginal || actorId == 0)
            {
                return(true);
            }


            int gongFaCount = 0;

            float[] pages = new float[9];

            foreach (var gongFaId in __instance.actorGongFas[actorId].Keys)
            {
                if (int.Parse(__instance.gongFaDate[gongFaId][1]) == typ)
                {
                    int gongFaGrade = int.Parse(__instance.gongFaDate[gongFaId][2]) - 1;
                    pages[gongFaGrade] += __instance.GetGongFaFLevel(actorId, gongFaId) *
                                          (__instance.GetGongFaAchievement(actorId, gongFaId) / int.Parse(__instance.gongFaDate[gongFaId][5]));
                    gongFaCount++;
                }
            }

            int attainments = 0;

            for (int j = 0; j < pages.Length; j++)
            {
                float i = pages[j];

                if (pages[j] <= 10)
                {
                }
                else if (pages[j] <= 50)
                {
                    i = (float)(-18.9957 - 0.55331 * i + 0.00343 * i * i + 14.8466 * Mathf.Log(i));
                }
                else
                {
                    i = Mathf.Log(i, (float)1.25893) + (float)3.0103;
                }
                i           *= (j + 1);
                attainments += Mathf.RoundToInt(i);
            }

            if (actorId == __instance.MianActorID() && StorySystem.useFoodId > 0)
            {
                attainments += int.Parse(__instance.GetItemDate(StorySystem.useFoodId, 50601 + typ));
            }
            __result = getSize ? gongFaCount : attainments;

            return(false);
        }
Ejemplo n.º 8
0
        /// <summary>
        /// 执行合并道具
        /// </summary>
        public static void RunningMergeItems()
        {
            if (!Main.enabled || Main.settings.mergeType.Count <= 0) return;

            DateFile df = DateFile.instance;
            Dictionary<int, int[]> items = new Dictionary<int, int[]>();
            Dictionary<int, int> itemsId = new Dictionary<int, int>();
            if (df.actorItemsDate.TryGetValue(df.mianActorId, out itemsId))
            {
                List<int> buffer = itemsId.Keys.ToList();
                foreach (int itemId in buffer)
                {
                    string id = df.GetItemDate(itemId, 999), surpluses = df.GetItemDate(itemId, 901), limit = df.GetItemDate(itemId, 902),
                        level = df.GetItemDate(itemId, 8), type = df.GetItemDate(itemId, 5);

                    if (!Main.settings.mergeType.Contains(int.Parse(type))) continue;
                    if ((type == "37" || type == "41") && !Main.settings.itemLevel.Contains(int.Parse(level))) continue;
                    if (Main.settings.enabledSize && int.Parse(df.itemsDate[itemId][902]) >= Main.settings.itemsSize) continue;
                    
                    if (items.ContainsKey(int.Parse(id)))
                    {
                        items[int.Parse(id)][0] += int.Parse(surpluses);
                        items[int.Parse(id)][1] += int.Parse(limit);
                    }
                    else
                    {
                        items.Add(int.Parse(id), new int[] { int.Parse(surpluses), int.Parse(limit) });
                    }
                    
                    df.LoseItem(df.mianActorId, itemId, itemsId[itemId], true);
                }
                
                foreach (KeyValuePair<int, int[]> item in items)
                {
                    if (Main.settings.enabledSize && Main.settings.itemsSize > 0)
                    {
                        int sizeCount = (item.Value[1] / int.Parse(Main.settings.itemsSize.ToString()));
                        int itemNaiJiu = item.Value[0], itemMaxNaiJiu = item.Value[1];
                        
                        for (int i = 0; i <= sizeCount; i++)
                        {
                            int makeItemId = df.MakeNewItem(item.Key);
                            df.GetItem(df.mianActorId, makeItemId, 1, false, -1, 0);
                            if (itemNaiJiu > Main.settings.itemsSize)
                            {
                                df.itemsDate[makeItemId][901] = Main.settings.itemsSize.ToString();
                                df.itemsDate[makeItemId][902] = Main.settings.itemsSize.ToString();
                                itemNaiJiu -= int.Parse(Main.settings.itemsSize.ToString());
                                itemMaxNaiJiu -= int.Parse(Main.settings.itemsSize.ToString());
                            }
                            else
                            {
                                df.itemsDate[makeItemId][901] = itemNaiJiu.ToString();
                                df.itemsDate[makeItemId][902] = itemMaxNaiJiu >= Main.settings.itemsSize ? Main.settings.itemsSize.ToString() : itemMaxNaiJiu.ToString();
                            }
                        }
                    }
                    else
                    {
                        int makeItemId = df.MakeNewItem(item.Key);
                        df.GetItem(df.mianActorId, makeItemId, 1, false, -1, 0);
                        df.itemsDate[makeItemId][901] = item.Value[0].ToString();
                        df.itemsDate[makeItemId][902] = item.Value[1].ToString();
                    }
                }
            }
        }
Ejemplo n.º 9
0
        /// <summary>
        /// 拆分药品
        /// </summary>
        public static void ResolveMergeDrugs(int actorId)
        {
            if (!Main.enabled || Main.settings.drugsCount <= 0)
            {
                return;
            }

            DateFile df = DateFile.instance;
            Dictionary <int, int> items   = new Dictionary <int, int>();
            Dictionary <int, int> itemsId = new Dictionary <int, int>();

            if (df.actorItemsDate.TryGetValue(actorId, out itemsId))
            {
                //层层过滤,符合条件的就加入字典。
                List <int> buffer = itemsId.Keys.ToList();
                foreach (int itemId in buffer)
                {
                    string id = df.GetItemDate(itemId, 999), surpluses = df.GetItemDate(itemId, 901), limit = df.GetItemDate(itemId, 902),
                             level = df.GetItemDate(itemId, 8), type = df.GetItemDate(itemId, 5);

                    if (type != "31")
                    {
                        continue;
                    }
                    if (!Main.settings.drugsLevel.Contains(int.Parse(level)))
                    {
                        continue;
                    }
                    if (int.Parse(surpluses) < (Main.settings.drugsCount * Main.settings.drugsSize))
                    {
                        continue;
                    }

                    if (!items.ContainsKey(int.Parse(id)))
                    {
                        items.Add(int.Parse(id), itemId);
                    }
                }

                //处理拆分
                if (items.Count == 0)
                {
                    Main.logger.Log("拆分失败:没有找到足够拆分的药品,合并后再试试。");
                }
                else
                {
                    foreach (KeyValuePair <int, int> item in items)
                    {
                        //Dictionary<int, string> baseItem = df.itemsDate[item.Value];
                        Dictionary <int, string> baseItem = Items.GetItem(item.Value);
                        int size = int.Parse(Main.settings.drugsSize.ToString()) + 1;
                        if (Main.settings.drugsSize <= 1)
                        {
                            size = 2;
                        }
                        if (Main.settings.drugsSize > 5)
                        {
                            size = 5;
                        }

                        for (int i = 0; i < Main.settings.drugsCount; i++)
                        {
                            //if (int.Parse(df.itemsDate[item.Value][901]) == size || int.Parse(df.itemsDate[item.Value][901]) < size) break;
                            if (int.Parse(df.GetItemDate(item.Value, 901)) == size || int.Parse(df.GetItemDate(item.Value, 901)) < size)
                            {
                                break;
                            }

                            int makeItemId = df.MakeNewItem(item.Key);
                            df.GetItem(actorId, makeItemId, 1, false, -1, 0);
                            Items.SetItemProperty(makeItemId, 901, size.ToString());
                            Items.SetItemProperty(makeItemId, 902, size.ToString());
                            string itemString = (int.Parse(df.GetItemDate(item.Value, 901)) - size).ToString();
                            Items.SetItemProperty(item.Value, 901, itemString);
                            Items.SetItemProperty(item.Value, 902, itemString);
                            //df.itemsDate[makeItemId][901] = size.ToString();
                            //df.itemsDate[makeItemId][902] = size.ToString();
                            //df.itemsDate[item.Value][901] = (int.Parse(df.itemsDate[item.Value][901]) - size).ToString();
                            //df.itemsDate[item.Value][902] = (int.Parse(df.itemsDate[item.Value][902]) - size).ToString();
                        }
                    }
                    Main.logger.Log("拆分成功。");
                }
            }
            else
            {
                Main.logger.Log("拆分失败:没有进入游戏存档,无法读取数据。");
            }
        }