예제 #1
0
        private void repairShipAutoRecovery(DeckShips deck)
        {
            int             num     = 86;
            int             num2    = 19;
            List <Mem_ship> memShip = deck.getMemShip();

            if (memShip.Count() == 0 || memShip[0].Stype != num2)
            {
                return;
            }
            DamageState damageState = memShip[0].Get_DamageState();

            if (damageState != DamageState.Tyuuha && damageState != DamageState.Taiha && !memShip[0].ExistsNdock() && !memShip[0].IsBlingShip())
            {
                Mem_material mem_material  = Comm_UserDatas.Instance.User_material[enumMaterialCategory.Fuel];
                Mem_material mem_material2 = Comm_UserDatas.Instance.User_material[enumMaterialCategory.Steel];
                if (mem_material.Value != 0 || mem_material2.Value != 0)
                {
                    Dictionary <int, int> mstSlotItemNum_OrderId = memShip[0].GetMstSlotItemNum_OrderId(new HashSet <int>
                    {
                        num
                    });
                    int num3 = mstSlotItemNum_OrderId[num];
                    memShip = memShip.Take(num3 + 2).ToList();
                    foreach (Mem_ship item in memShip)
                    {
                        if (item.Nowhp < item.Maxhp)
                        {
                            DamageState damageState2 = item.Get_DamageState();
                            if (damageState2 != DamageState.Tyuuha && damageState2 != DamageState.Taiha && !item.ExistsNdock() && !item.IsBlingShip())
                            {
                                int    ndockTimeSpan = item.GetNdockTimeSpan();
                                int    num4          = ndockTimeSpan * 30;
                                int    num5          = 30;
                                double num6          = (double)num5 / (double)num4;
                                Dictionary <enumMaterialCategory, int> ndockMaterialNum = item.GetNdockMaterialNum();
                                int num7 = (int)Math.Ceiling((double)ndockMaterialNum[enumMaterialCategory.Fuel] * num6);
                                int num8 = (int)Math.Ceiling((double)ndockMaterialNum[enumMaterialCategory.Steel] * num6);
                                if (mem_material.Value >= num7 && mem_material2.Value >= num8)
                                {
                                    double num9  = (double)(item.Maxhp - item.Nowhp) * num6;
                                    int    num10 = (!(num9 < 1.0)) ? ((int)num9) : ((int)Math.Ceiling(num9));
                                    item.SubHp(-num10);
                                    mem_material.Sub_Material(num7);
                                    mem_material2.Sub_Material(num8);
                                }
                            }
                        }
                    }
                }
            }
        }
        private void repairShipAutoRecovery(DeckShips deck)
        {
            int             num  = 86;
            int             num2 = 19;
            List <Mem_ship> list = deck.getMemShip();

            if (Enumerable.Count <Mem_ship>(list) == 0)
            {
                return;
            }
            if (list.get_Item(0).Stype != num2)
            {
                return;
            }
            DamageState damageState = list.get_Item(0).Get_DamageState();

            if (damageState == DamageState.Tyuuha || damageState == DamageState.Taiha)
            {
                return;
            }
            if (list.get_Item(0).ExistsNdock())
            {
                return;
            }
            if (list.get_Item(0).IsBlingShip())
            {
                return;
            }
            Mem_material mem_material  = Comm_UserDatas.Instance.User_material.get_Item(enumMaterialCategory.Fuel);
            Mem_material mem_material2 = Comm_UserDatas.Instance.User_material.get_Item(enumMaterialCategory.Steel);

            if (mem_material.Value == 0 && mem_material2.Value == 0)
            {
                return;
            }
            Mem_ship      arg_C7_0 = list.get_Item(0);
            HashSet <int> hashSet  = new HashSet <int>();

            hashSet.Add(num);
            Dictionary <int, int> mstSlotItemNum_OrderId = arg_C7_0.GetMstSlotItemNum_OrderId(hashSet);
            int num3 = mstSlotItemNum_OrderId.get_Item(num);

            list = Enumerable.ToList <Mem_ship>(Enumerable.Take <Mem_ship>(list, num3 + 2));
            using (List <Mem_ship> .Enumerator enumerator = list.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    Mem_ship current = enumerator.get_Current();
                    if (current.Nowhp < current.Maxhp)
                    {
                        DamageState damageState2 = current.Get_DamageState();
                        if (damageState2 != DamageState.Tyuuha && damageState2 != DamageState.Taiha)
                        {
                            if (!current.ExistsNdock())
                            {
                                if (!current.IsBlingShip())
                                {
                                    int    ndockTimeSpan = current.GetNdockTimeSpan();
                                    int    num4          = ndockTimeSpan * 30;
                                    int    num5          = 30;
                                    double num6          = (double)num5 / (double)num4;
                                    Dictionary <enumMaterialCategory, int> ndockMaterialNum = current.GetNdockMaterialNum();
                                    int num7 = (int)Math.Ceiling((double)ndockMaterialNum.get_Item(enumMaterialCategory.Fuel) * num6);
                                    int num8 = (int)Math.Ceiling((double)ndockMaterialNum.get_Item(enumMaterialCategory.Steel) * num6);
                                    if (mem_material.Value >= num7 && mem_material2.Value >= num8)
                                    {
                                        double num9  = (double)(current.Maxhp - current.Nowhp) * num6;
                                        int    num10 = (num9 >= 1.0) ? ((int)num9) : ((int)Math.Ceiling(num9));
                                        current.SubHp(-num10);
                                        mem_material.Sub_Material(num7);
                                        mem_material2.Sub_Material(num8);
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }