private bool getCombatRationResult(out Dictionary <int, List <Mst_slotitem> > useShipInfo, out List <int> givenShips) { int mapBattleCellPassCount = this.mapInstance.MapBattleCellPassCount; useShipInfo = null; givenShips = null; if (mapBattleCellPassCount < 2) { return(false); } Dictionary <int, List <Mst_slotitem> > dictionary = new Dictionary <int, List <Mst_slotitem> >(); List <int> list = new List <int>(); HashSet <int> hashSet = new HashSet <int>(); hashSet.Add(145); hashSet.Add(150); HashSet <int> searchIds = hashSet; Dictionary <int, List <int> > dictionary2 = new Dictionary <int, List <int> >(); Dictionary <int, int> dictionary3 = Enumerable.ToDictionary <int, int, int>(this.userSubInfo.get_Keys(), (int key) => key, (int value) => 0); for (int i = 0; i < this.userData.ShipData.get_Count(); i++) { Mem_ship mem_ship = this.userData.ShipData.get_Item(i); if (mem_ship.IsFight()) { Dictionary <int, List <int> > slotIndexFromId = mem_ship.GetSlotIndexFromId(searchIds); if (slotIndexFromId.get_Item(145).get_Count() != 0 || slotIndexFromId.get_Item(150).get_Count() != 0) { if (this.isRationLotteryWinning(mapBattleCellPassCount, mem_ship.Luck)) { List <int> rationRecoveryShips = this.getRationRecoveryShips(i); if (rationRecoveryShips.get_Count() != 0) { dictionary.Add(mem_ship.Rid, new List <Mst_slotitem>()); int num = 0; List <int> list2 = new List <int>(); if (slotIndexFromId.get_Item(145).get_Count() > 0) { num++; int num2 = slotIndexFromId.get_Item(145).get_Count() - 1; list2.Add(slotIndexFromId.get_Item(145).get_Item(num2)); dictionary.get_Item(mem_ship.Rid).Add(Mst_DataManager.Instance.Mst_Slotitem.get_Item(145)); } if (slotIndexFromId.get_Item(150).get_Count() > 0) { num += 2; int num3 = slotIndexFromId.get_Item(150).get_Count() - 1; list2.Add(slotIndexFromId.get_Item(150).get_Item(num3)); dictionary.get_Item(mem_ship.Rid).Add(Mst_DataManager.Instance.Mst_Slotitem.get_Item(150)); } Dictionary <int, int> dictionary4; Dictionary <int, int> expr_23B = dictionary4 = dictionary3; int num4; int expr_245 = num4 = mem_ship.Rid; num4 = dictionary4.get_Item(num4); expr_23B.set_Item(expr_245, num4 + this.getCombatRationCondPlus(num, false)); dictionary2.Add(i, list2); rationRecoveryShips.Remove(mem_ship.Rid); list.AddRange(rationRecoveryShips); using (List <int> .Enumerator enumerator = rationRecoveryShips.GetEnumerator()) { while (enumerator.MoveNext()) { int current = enumerator.get_Current(); Dictionary <int, int> dictionary5; Dictionary <int, int> expr_29F = dictionary5 = dictionary3; int expr_2A4 = num4 = current; num4 = dictionary5.get_Item(num4); expr_29F.set_Item(expr_2A4, num4 + this.getCombatRationCondPlus(num, true)); } } } } } } } if (dictionary2.get_Count() == 0) { return(false); } List <int> list3 = new List <int>(); Dictionary <int, Mst_ship> mst_ship = Mst_DataManager.Instance.Mst_ship; using (Dictionary <int, List <int> > .Enumerator enumerator2 = dictionary2.GetEnumerator()) { while (enumerator2.MoveNext()) { KeyValuePair <int, List <int> > current2 = enumerator2.get_Current(); Mem_ship mem_ship2 = this.userData.ShipData.get_Item(current2.get_Key()); Mem_shipBase mem_shipBase = new Mem_shipBase(mem_ship2); List <Mst_slotitem> list4 = this.userData.SlotData.get_Item(current2.get_Key()); using (List <int> .Enumerator enumerator3 = current2.get_Value().GetEnumerator()) { while (enumerator3.MoveNext()) { int current3 = enumerator3.get_Current(); int num5; if (current3 != 2147483647) { num5 = mem_ship2.Slot.get_Item(current3); mem_shipBase.Slot.set_Item(current3, -1); list4.set_Item(current3, null); } else { num5 = mem_ship2.Exslot; mem_shipBase.Exslot = -1; } list3.Add(num5); } } mem_ship2.Set_ShipParam(mem_shipBase, mst_ship.get_Item(mem_shipBase.Ship_id), false); mem_ship2.TrimSlot(); list4.RemoveAll((Mst_slotitem x) => x == null); } } using (Dictionary <int, int> .Enumerator enumerator4 = dictionary3.GetEnumerator()) { while (enumerator4.MoveNext()) { KeyValuePair <int, int> current4 = enumerator4.get_Current(); Mem_ship shipInstance = this.userSubInfo.get_Item(current4.get_Key()).ShipInstance; int value2 = current4.get_Value(); shipInstance.AddRationItemCond(value2); } } Comm_UserDatas.Instance.Remove_Slot(list3); useShipInfo = dictionary; givenShips = Enumerable.ToList <int>(Enumerable.Distinct <int>(list)); return(true); }
private bool getCombatRationResult(out Dictionary <int, List <Mst_slotitem> > useShipInfo, out List <int> givenShips) { int mapBattleCellPassCount = mapInstance.MapBattleCellPassCount; useShipInfo = null; givenShips = null; if (mapBattleCellPassCount < 2) { return(false); } Dictionary <int, List <Mst_slotitem> > dictionary = new Dictionary <int, List <Mst_slotitem> >(); List <int> list = new List <int>(); HashSet <int> hashSet = new HashSet <int>(); hashSet.Add(145); hashSet.Add(150); HashSet <int> searchIds = hashSet; Dictionary <int, List <int> > dictionary2 = new Dictionary <int, List <int> >(); Dictionary <int, int> dictionary3 = userSubInfo.Keys.ToDictionary((int key) => key, (int value) => 0); for (int i = 0; i < userData.ShipData.Count; i++) { Mem_ship mem_ship = userData.ShipData[i]; if (!mem_ship.IsFight()) { continue; } Dictionary <int, List <int> > slotIndexFromId = mem_ship.GetSlotIndexFromId(searchIds); if ((slotIndexFromId[145].Count == 0 && slotIndexFromId[150].Count == 0) || !isRationLotteryWinning(mapBattleCellPassCount, mem_ship.Luck)) { continue; } List <int> rationRecoveryShips = getRationRecoveryShips(i); if (rationRecoveryShips.Count != 0) { dictionary.Add(mem_ship.Rid, new List <Mst_slotitem>()); int num = 0; List <int> list2 = new List <int>(); if (slotIndexFromId[145].Count > 0) { num++; int index = slotIndexFromId[145].Count - 1; list2.Add(slotIndexFromId[145][index]); dictionary[mem_ship.Rid].Add(Mst_DataManager.Instance.Mst_Slotitem[145]); } if (slotIndexFromId[150].Count > 0) { num += 2; int index2 = slotIndexFromId[150].Count - 1; list2.Add(slotIndexFromId[150][index2]); dictionary[mem_ship.Rid].Add(Mst_DataManager.Instance.Mst_Slotitem[150]); } Dictionary <int, int> dictionary4; Dictionary <int, int> dictionary5 = dictionary4 = dictionary3; int rid; int key2 = rid = mem_ship.Rid; rid = dictionary4[rid]; dictionary5[key2] = rid + getCombatRationCondPlus(num, givenShip: false); dictionary2.Add(i, list2); rationRecoveryShips.Remove(mem_ship.Rid); list.AddRange(rationRecoveryShips); foreach (int item2 in rationRecoveryShips) { Dictionary <int, int> dictionary6; Dictionary <int, int> dictionary7 = dictionary6 = dictionary3; int key3 = rid = item2; rid = dictionary6[rid]; dictionary7[key3] = rid + getCombatRationCondPlus(num, givenShip: true); } } } if (dictionary2.Count == 0) { return(false); } List <int> list3 = new List <int>(); Dictionary <int, Mst_ship> mst_ship = Mst_DataManager.Instance.Mst_ship; foreach (KeyValuePair <int, List <int> > item3 in dictionary2) { Mem_ship mem_ship2 = userData.ShipData[item3.Key]; Mem_shipBase mem_shipBase = new Mem_shipBase(mem_ship2); List <Mst_slotitem> list4 = userData.SlotData[item3.Key]; foreach (int item4 in item3.Value) { int item; if (item4 != int.MaxValue) { item = mem_ship2.Slot[item4]; mem_shipBase.Slot[item4] = -1; list4[item4] = null; } else { item = mem_ship2.Exslot; mem_shipBase.Exslot = -1; } list3.Add(item); } mem_ship2.Set_ShipParam(mem_shipBase, mst_ship[mem_shipBase.Ship_id], enemy_flag: false); mem_ship2.TrimSlot(); list4.RemoveAll((Mst_slotitem x) => x == null); } foreach (KeyValuePair <int, int> item5 in dictionary3) { Mem_ship shipInstance = userSubInfo[item5.Key].ShipInstance; int value2 = item5.Value; shipInstance.AddRationItemCond(value2); } Comm_UserDatas.Instance.Remove_Slot(list3); useShipInfo = dictionary; givenShips = list.Distinct().ToList(); return(true); }