static int AvailableItem(int actorId, out Dictionary <int, int>[] dict) { dict = new Dictionary <int, int> [10]; int cnt = 0; for (int i = 1; i <= 9; i++) { dict[i] = new Dictionary <int, int> { } } ; Dictionary <int, int> all = DateFile.instance.actorItemsDate[actorId]; foreach (var kvp in all) { int itemId = kvp.Key; if (MyModDate.Locked(itemId)) { continue; } if (!IsMaterial(itemId)) { continue; } int grade = int.Parse(DateFile.instance.GetItemDate(itemId, 8, false)); if (grade > Main.settings.materialGrade) { continue; } //dict[grade].Add(kvp); //为啥这样不行? dict[grade].Add(kvp.Key, kvp.Value); cnt += kvp.Value; } return(cnt); }
static IEnumerable <ItemInfo> AvailableItem(int actorId) { return(DateFile.instance.actorItemsDate[actorId] .Where(kvp => !MyModDate.Locked(kvp.Key) && //未上锁 IsMaterial(kvp.Key) && //是精制材料 int.Parse(DateFile.instance.GetItemDate(kvp.Key, 8, false)) <= Main.settings.materialGrade) //品级符合要求 .AsEnumerable() .Select(kvp => new ItemInfo(kvp.Key, kvp.Value, actorId))); }
static void Postfix(WindowManage __instance, int itemId, bool setName) { if (!Main.enabled) { return; } if (setName && Main.settings.clickLock && MyModDate.Locked(itemId)) { __instance.informationName.text = DateFile.instance.SetColoer(10004, "已锁定[简化精制]") + "\n" + __instance.informationName.text; } if (Main.settings.showProduct) { RefineMaterial rm; string newText; bool isRM = RefineMaterial.TryGet(itemId, out rm); if (isRM) { string title = DateFile.instance.SetColoer(10002, "【精制效果】"); newText = $"{title}\n"; newText += $"·{rm.onWeapon} || {rm.onArmor} || {rm.onJewelry}\n"; } else { int productId = int.Parse(DateFile.instance.GetItemDate(itemId, 52, false)); bool haveProduct = productId > 0 && DateFile.instance.GetItemDate(itemId, 50, false) == "1"; if (!haveProduct) { return; } productId += 2;//满精制 string title = DateFile.instance.SetColoer(10002, "【满精制拆解产物】"); string name = Func.GetItemName(productId); newText = $"{title}\n·{name}\n"; bool hasEffect = RefineMaterial.TryGet(productId, out rm); if (hasEffect) { newText += $"·{rm.onWeapon} || {rm.onArmor} || {rm.onJewelry}\n"; } } __instance.informationMassage.text += newText + "\n"; typeof(WindowManage).GetField("baseWeaponMassage", BindingFlags.NonPublic | BindingFlags.Instance) .SetValue(__instance, __instance.informationMassage.text); } }
static int Match(int itemId) //拆解产物 { if (MyModDate.Locked(itemId)) { return(-99); } if (!IsBreakableEquip(itemId)) { return(-2); } int level = int.Parse(DateFile.instance.GetItemDate(itemId, 8)); int require = Main.settings.breakGrade; if (level > require) { return(-1); } int newItemId = int.Parse(DateFile.instance.GetItemDate(itemId, 52)); return(newItemId); }