Exemple #1
0
        public Api_Result <int> Powerup(int ship_rid, HashSet <int> rid_items)
        {
            Api_Result <int> api_Result = new Api_Result <int>();

            api_Result.data = 0;
            Mem_ship mem_ship = null;

            if (!Comm_UserDatas.Instance.User_ship.TryGetValue(ship_rid, ref mem_ship))
            {
                api_Result.state = Api_Result_State.Parameter_Error;
                return(api_Result);
            }
            if (mem_ship.IsBlingShip())
            {
                api_Result.state = Api_Result_State.Parameter_Error;
                return(api_Result);
            }
            List <Mem_ship> list = new List <Mem_ship>();
            Dictionary <Mem_ship.enumKyoukaIdx, int> dictionary = new Dictionary <Mem_ship.enumKyoukaIdx, int>();

            dictionary.Add(Mem_ship.enumKyoukaIdx.Houg, 0);
            dictionary.Add(Mem_ship.enumKyoukaIdx.Raig, 0);
            dictionary.Add(Mem_ship.enumKyoukaIdx.Tyku, 0);
            dictionary.Add(Mem_ship.enumKyoukaIdx.Souk, 0);
            Dictionary <Mem_ship.enumKyoukaIdx, int> dictionary2 = dictionary;
            Dictionary <Mem_ship, int> dictionary3 = new Dictionary <Mem_ship, int>();
            Dictionary <int, Mem_deck> user_deck   = Comm_UserDatas.Instance.User_deck;
            Dictionary <double, int>   dictionary4 = new Dictionary <double, int>();

            using (HashSet <int> .Enumerator enumerator = rid_items.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    int      current   = enumerator.get_Current();
                    Mem_ship mem_ship2 = null;
                    if (!Comm_UserDatas.Instance.User_ship.TryGetValue(current, ref mem_ship2))
                    {
                        api_Result.state = Api_Result_State.Parameter_Error;
                        Api_Result <int> result = api_Result;
                        return(result);
                    }
                    if (mem_ship2.Locked == 1 || mem_ship2.IsBlingShip() || mem_ship2.GetLockSlotItems().get_Count() > 0)
                    {
                        api_Result.state = Api_Result_State.Parameter_Error;
                        Api_Result <int> result = api_Result;
                        return(result);
                    }
                    list.Add(mem_ship2);
                    Mst_ship   mst_ship = Mst_DataManager.Instance.Mst_ship.get_Item(mem_ship2.Ship_id);
                    List <int> powup    = mst_ship.Powup;
                    Dictionary <Mem_ship.enumKyoukaIdx, int> expr_135 = dictionary = dictionary2;
                    Mem_ship.enumKyoukaIdx enumKyoukaIdx;
                    Mem_ship.enumKyoukaIdx expr_139 = enumKyoukaIdx = Mem_ship.enumKyoukaIdx.Houg;
                    int num = dictionary.get_Item(enumKyoukaIdx);
                    expr_135.set_Item(expr_139, num + powup.get_Item(0));
                    Dictionary <Mem_ship.enumKyoukaIdx, int> dictionary5;
                    Dictionary <Mem_ship.enumKyoukaIdx, int> expr_158 = dictionary5 = dictionary2;
                    Mem_ship.enumKyoukaIdx expr_15C = enumKyoukaIdx = Mem_ship.enumKyoukaIdx.Raig;
                    num = dictionary5.get_Item(enumKyoukaIdx);
                    expr_158.set_Item(expr_15C, num + powup.get_Item(1));
                    Dictionary <Mem_ship.enumKyoukaIdx, int> dictionary6;
                    Dictionary <Mem_ship.enumKyoukaIdx, int> expr_17B = dictionary6 = dictionary2;
                    Mem_ship.enumKyoukaIdx expr_17F = enumKyoukaIdx = Mem_ship.enumKyoukaIdx.Tyku;
                    num = dictionary6.get_Item(enumKyoukaIdx);
                    expr_17B.set_Item(expr_17F, num + powup.get_Item(2));
                    Dictionary <Mem_ship.enumKyoukaIdx, int> dictionary7;
                    Dictionary <Mem_ship.enumKyoukaIdx, int> expr_19E = dictionary7 = dictionary2;
                    Mem_ship.enumKyoukaIdx expr_1A2 = enumKyoukaIdx = Mem_ship.enumKyoukaIdx.Souk;
                    num = dictionary7.get_Item(enumKyoukaIdx);
                    expr_19E.set_Item(expr_1A2, num + powup.get_Item(3));
                    double luckUpKeisu = mst_ship.GetLuckUpKeisu();
                    if (luckUpKeisu != 0.0)
                    {
                        if (dictionary4.ContainsKey(luckUpKeisu))
                        {
                            Dictionary <double, int> dictionary8;
                            Dictionary <double, int> expr_1E9 = dictionary8 = dictionary4;
                            double num2;
                            double expr_1EE = num2 = luckUpKeisu;
                            num = dictionary8.get_Item(num2);
                            expr_1E9.set_Item(expr_1EE, num + 1);
                        }
                        else
                        {
                            dictionary4.Add(luckUpKeisu, 1);
                        }
                    }
                    int[] array = user_deck.get_Item(1).Search_ShipIdx(mem_ship2.Rid);
                    if (array[0] != -1 && array[0] == 1 && array[1] == 0)
                    {
                        api_Result.state = Api_Result_State.Parameter_Error;
                        Api_Result <int> result = api_Result;
                        return(result);
                    }
                    dictionary3.Add(mem_ship2, array[0]);
                }
            }
            Mst_ship mst_ship2 = Mst_DataManager.Instance.Mst_ship.get_Item(mem_ship.Ship_id);
            Dictionary <Mem_ship.enumKyoukaIdx, int> dictionary9 = new Dictionary <Mem_ship.enumKyoukaIdx, int>();

            dictionary9.Add(Mem_ship.enumKyoukaIdx.Houg, mst_ship2.Houg_max);
            dictionary9.Add(Mem_ship.enumKyoukaIdx.Raig, mst_ship2.Raig_max);
            dictionary9.Add(Mem_ship.enumKyoukaIdx.Tyku, mst_ship2.Tyku_max);
            dictionary9.Add(Mem_ship.enumKyoukaIdx.Souk, mst_ship2.Souk_max);
            dictionary9.Add(Mem_ship.enumKyoukaIdx.Luck, mst_ship2.Luck_max);
            Dictionary <Mem_ship.enumKyoukaIdx, int> dictionary10 = dictionary9;

            dictionary9 = new Dictionary <Mem_ship.enumKyoukaIdx, int>();
            dictionary9.Add(Mem_ship.enumKyoukaIdx.Houg, mst_ship2.Houg);
            dictionary9.Add(Mem_ship.enumKyoukaIdx.Raig, mst_ship2.Raig);
            dictionary9.Add(Mem_ship.enumKyoukaIdx.Tyku, mst_ship2.Tyku);
            dictionary9.Add(Mem_ship.enumKyoukaIdx.Souk, mst_ship2.Souk);
            dictionary9.Add(Mem_ship.enumKyoukaIdx.Luck, mst_ship2.Luck);
            Dictionary <Mem_ship.enumKyoukaIdx, int> dictionary11 = dictionary9;
            Dictionary <Mem_ship.enumKyoukaIdx, int> kyouka       = mem_ship.Kyouka;

            dictionary9 = new Dictionary <Mem_ship.enumKyoukaIdx, int>();
            dictionary9.Add(Mem_ship.enumKyoukaIdx.Houg, kyouka.get_Item(Mem_ship.enumKyoukaIdx.Houg));
            dictionary9.Add(Mem_ship.enumKyoukaIdx.Raig, kyouka.get_Item(Mem_ship.enumKyoukaIdx.Raig));
            dictionary9.Add(Mem_ship.enumKyoukaIdx.Tyku, kyouka.get_Item(Mem_ship.enumKyoukaIdx.Tyku));
            dictionary9.Add(Mem_ship.enumKyoukaIdx.Souk, kyouka.get_Item(Mem_ship.enumKyoukaIdx.Souk));
            dictionary9.Add(Mem_ship.enumKyoukaIdx.Kaihi, kyouka.get_Item(Mem_ship.enumKyoukaIdx.Kaihi));
            dictionary9.Add(Mem_ship.enumKyoukaIdx.Taisen, kyouka.get_Item(Mem_ship.enumKyoukaIdx.Taisen));
            dictionary9.Add(Mem_ship.enumKyoukaIdx.Luck, kyouka.get_Item(Mem_ship.enumKyoukaIdx.Luck));
            Dictionary <Mem_ship.enumKyoukaIdx, int> dictionary12 = dictionary9;
            Random random = new Random();

            using (Dictionary <Mem_ship.enumKyoukaIdx, int> .Enumerator enumerator2 = dictionary2.GetEnumerator())
            {
                while (enumerator2.MoveNext())
                {
                    KeyValuePair <Mem_ship.enumKyoukaIdx, int> current2 = enumerator2.get_Current();
                    if (current2.get_Value() > 0)
                    {
                        int num3 = dictionary11.get_Item(current2.get_Key()) + kyouka.get_Item(current2.get_Key());
                        if (dictionary10.get_Item(current2.get_Key()) > num3)
                        {
                            int num4 = random.Next(2);
                            int num5 = (int)Math.Floor((double)((float)current2.get_Value() * 0.6f + (float)current2.get_Value() * 0.6f * (float)num4 + 0.3f));
                            if (num3 + num5 > dictionary10.get_Item(current2.get_Key()))
                            {
                                dictionary12.set_Item(current2.get_Key(), dictionary10.get_Item(current2.get_Key()) - dictionary11.get_Item(current2.get_Key()));
                            }
                            else
                            {
                                Dictionary <Mem_ship.enumKyoukaIdx, int> expr_4B3 = dictionary9 = dictionary12;
                                Mem_ship.enumKyoukaIdx enumKyoukaIdx;
                                Mem_ship.enumKyoukaIdx expr_4BD = enumKyoukaIdx = current2.get_Key();
                                int num = dictionary9.get_Item(enumKyoukaIdx);
                                expr_4B3.set_Item(expr_4BD, num + num5);
                            }
                        }
                    }
                }
            }
            int num6 = kyouka.get_Item(Mem_ship.enumKyoukaIdx.Luck) + dictionary11.get_Item(Mem_ship.enumKyoukaIdx.Luck);
            int num7 = dictionary10.get_Item(Mem_ship.enumKyoukaIdx.Luck);

            if (dictionary4.get_Count() > 0 && dictionary10.get_Item(Mem_ship.enumKyoukaIdx.Luck) > num6)
            {
                double num8 = 0.0;
                using (Dictionary <double, int> .Enumerator enumerator3 = dictionary4.GetEnumerator())
                {
                    while (enumerator3.MoveNext())
                    {
                        KeyValuePair <double, int> current3 = enumerator3.get_Current();
                        double num9 = current3.get_Key() * (double)current3.get_Value();
                        num8 += num9;
                    }
                }
                int num10 = (int)Math.Floor(num8 + Utils.GetRandDouble(0.0, 0.9, 0.1, 2));
                if (num7 < num10 + num6)
                {
                    dictionary12.set_Item(Mem_ship.enumKyoukaIdx.Luck, num7 - dictionary11.get_Item(Mem_ship.enumKyoukaIdx.Luck));
                }
                else
                {
                    Dictionary <Mem_ship.enumKyoukaIdx, int> dictionary13;
                    Dictionary <Mem_ship.enumKyoukaIdx, int> expr_5D7 = dictionary13 = dictionary12;
                    Mem_ship.enumKyoukaIdx enumKyoukaIdx;
                    Mem_ship.enumKyoukaIdx expr_5DB = enumKyoukaIdx = Mem_ship.enumKyoukaIdx.Luck;
                    int num = dictionary13.get_Item(enumKyoukaIdx);
                    expr_5D7.set_Item(expr_5DB, num + num10);
                }
            }
            bool flag = false;

            using (Dictionary <Mem_ship.enumKyoukaIdx, int> .Enumerator enumerator4 = dictionary12.GetEnumerator())
            {
                while (enumerator4.MoveNext())
                {
                    KeyValuePair <Mem_ship.enumKyoukaIdx, int> current4 = enumerator4.get_Current();
                    if (kyouka.get_Item(current4.get_Key()) != current4.get_Value())
                    {
                        flag = true;
                    }
                }
            }
            List <Mem_ship> list2         = Enumerable.ToList <Mem_ship>(dictionary3.get_Keys());
            int             num11         = 0;
            int             num12         = 0;
            int             sameShipCount = this.getSameShipCount(mem_ship, list2);
            int             num13         = this.selectSamePowerupType(sameShipCount);

            dictionary12.Add(Mem_ship.enumKyoukaIdx.Taik_Powerup, mem_ship.Kyouka.get_Item(Mem_ship.enumKyoukaIdx.Taik_Powerup));
            if (num13 == 1)
            {
                num12 = this.GetSameShipPowerupLuck(mem_ship, sameShipCount, false);
            }
            else if (num13 == 3)
            {
                num12 = this.GetSameShipPowerupLuck(mem_ship, sameShipCount, true);
            }
            else if (num13 == 2)
            {
                num11 = this.GetSameShipPowerupTaikyu(mem_ship, sameShipCount, false);
            }
            int num14 = mst_ship2.Luck + dictionary12.get_Item(Mem_ship.enumKyoukaIdx.Luck);
            int num15 = mst_ship2.Luck_max - num14;
            int num16 = mst_ship2.Taik + mem_ship.Kyouka.get_Item(Mem_ship.enumKyoukaIdx.Taik) + mem_ship.Kyouka.get_Item(Mem_ship.enumKyoukaIdx.Taik_Powerup);
            int num17 = mst_ship2.Taik_max - num16;

            if (num12 > num15)
            {
                num12 = num15;
            }
            if (num11 > num17)
            {
                num11 = num17;
            }
            bool flag2 = false;

            if (num12 > 0)
            {
                flag2 = true;
                Dictionary <Mem_ship.enumKyoukaIdx, int> dictionary14;
                Dictionary <Mem_ship.enumKyoukaIdx, int> expr_742 = dictionary14 = dictionary12;
                Mem_ship.enumKyoukaIdx enumKyoukaIdx;
                Mem_ship.enumKyoukaIdx expr_746 = enumKyoukaIdx = Mem_ship.enumKyoukaIdx.Luck;
                int num = dictionary14.get_Item(enumKyoukaIdx);
                expr_742.set_Item(expr_746, num + num12);
                flag = true;
            }
            if (num11 > 0)
            {
                flag2 = true;
                Dictionary <Mem_ship.enumKyoukaIdx, int> dictionary15;
                Dictionary <Mem_ship.enumKyoukaIdx, int> expr_76E = dictionary15 = dictionary12;
                Mem_ship.enumKyoukaIdx enumKyoukaIdx;
                Mem_ship.enumKyoukaIdx expr_772 = enumKyoukaIdx = Mem_ship.enumKyoukaIdx.Taik_Powerup;
                int num = dictionary15.get_Item(enumKyoukaIdx);
                expr_76E.set_Item(expr_772, num + num11);
                flag = true;
            }
            if (flag)
            {
                Mem_shipBase mem_shipBase = new Mem_shipBase(mem_ship);
                dictionary12.Add(Mem_ship.enumKyoukaIdx.Taik, mem_ship.Kyouka.get_Item(Mem_ship.enumKyoukaIdx.Taik));
                mem_shipBase.SetKyoukaValue(dictionary12);
                mem_ship.Set_ShipParam(mem_shipBase, mst_ship2, false);
                api_Result.data = ((!flag2) ? 1 : 2);
            }
            mem_ship.SumLovToKaisouPowUp(rid_items.get_Count());
            using (Dictionary <Mem_ship, int> .Enumerator enumerator5 = dictionary3.GetEnumerator())
            {
                while (enumerator5.MoveNext())
                {
                    KeyValuePair <Mem_ship, int> current5 = enumerator5.get_Current();
                    if (current5.get_Value() != -1)
                    {
                        Mem_deck mem_deck = Comm_UserDatas.Instance.User_deck.get_Item(current5.get_Value());
                        mem_deck.Ship.RemoveShip(current5.get_Key().Rid);
                    }
                }
            }
            Comm_UserDatas.Instance.Remove_Ship(list2);
            QuestKaisou questKaisou = new QuestKaisou(flag);

            questKaisou.ExecuteCheck();
            return(api_Result);
        }
Exemple #2
0
        public Api_Result <int> Powerup(int ship_rid, HashSet <int> rid_items)
        {
            Api_Result <int> api_Result = new Api_Result <int>();

            api_Result.data = 0;
            Mem_ship value = null;

            if (!Comm_UserDatas.Instance.User_ship.TryGetValue(ship_rid, out value))
            {
                api_Result.state = Api_Result_State.Parameter_Error;
                return(api_Result);
            }
            if (value.IsBlingShip())
            {
                api_Result.state = Api_Result_State.Parameter_Error;
                return(api_Result);
            }
            List <Mem_ship> list = new List <Mem_ship>();
            Dictionary <Mem_ship.enumKyoukaIdx, int> dictionary = new Dictionary <Mem_ship.enumKyoukaIdx, int>();

            dictionary.Add(Mem_ship.enumKyoukaIdx.Houg, 0);
            dictionary.Add(Mem_ship.enumKyoukaIdx.Raig, 0);
            dictionary.Add(Mem_ship.enumKyoukaIdx.Tyku, 0);
            dictionary.Add(Mem_ship.enumKyoukaIdx.Souk, 0);
            Dictionary <Mem_ship.enumKyoukaIdx, int> dictionary2 = dictionary;
            Dictionary <Mem_ship, int> dictionary3 = new Dictionary <Mem_ship, int>();
            Dictionary <int, Mem_deck> user_deck   = Comm_UserDatas.Instance.User_deck;
            Dictionary <double, int>   dictionary4 = new Dictionary <double, int>();

            foreach (int rid_item in rid_items)
            {
                Mem_ship value2 = null;
                if (!Comm_UserDatas.Instance.User_ship.TryGetValue(rid_item, out value2))
                {
                    api_Result.state = Api_Result_State.Parameter_Error;
                    return(api_Result);
                }
                if (value2.Locked == 1 || value2.IsBlingShip() || value2.GetLockSlotItems().Count > 0)
                {
                    api_Result.state = Api_Result_State.Parameter_Error;
                    return(api_Result);
                }
                list.Add(value2);
                Mst_ship   mst_ship = Mst_DataManager.Instance.Mst_ship[value2.Ship_id];
                List <int> powup    = mst_ship.Powup;
                Dictionary <Mem_ship.enumKyoukaIdx, int> dictionary5 = dictionary = dictionary2;
                Mem_ship.enumKyoukaIdx key;
                Mem_ship.enumKyoukaIdx key2 = key = Mem_ship.enumKyoukaIdx.Houg;
                int num = dictionary[key];
                dictionary5[key2] = num + powup[0];
                Dictionary <Mem_ship.enumKyoukaIdx, int> dictionary6;
                Dictionary <Mem_ship.enumKyoukaIdx, int> dictionary7 = dictionary6 = dictionary2;
                Mem_ship.enumKyoukaIdx key3 = key = Mem_ship.enumKyoukaIdx.Raig;
                num = dictionary6[key];
                dictionary7[key3] = num + powup[1];
                Dictionary <Mem_ship.enumKyoukaIdx, int> dictionary8;
                Dictionary <Mem_ship.enumKyoukaIdx, int> dictionary9 = dictionary8 = dictionary2;
                Mem_ship.enumKyoukaIdx key4 = key = Mem_ship.enumKyoukaIdx.Tyku;
                num = dictionary8[key];
                dictionary9[key4] = num + powup[2];
                Dictionary <Mem_ship.enumKyoukaIdx, int> dictionary10;
                Dictionary <Mem_ship.enumKyoukaIdx, int> dictionary11 = dictionary10 = dictionary2;
                Mem_ship.enumKyoukaIdx key5 = key = Mem_ship.enumKyoukaIdx.Souk;
                num = dictionary10[key];
                dictionary11[key5] = num + powup[3];
                double luckUpKeisu = mst_ship.GetLuckUpKeisu();
                if (luckUpKeisu != 0.0)
                {
                    if (dictionary4.ContainsKey(luckUpKeisu))
                    {
                        Dictionary <double, int> dictionary12;
                        Dictionary <double, int> dictionary13 = dictionary12 = dictionary4;
                        double key6;
                        double key7 = key6 = luckUpKeisu;
                        num = dictionary12[key6];
                        dictionary13[key7] = num + 1;
                    }
                    else
                    {
                        dictionary4.Add(luckUpKeisu, 1);
                    }
                }
                int[] array = user_deck[1].Search_ShipIdx(value2.Rid);
                if (array[0] != -1 && array[0] == 1 && array[1] == 0)
                {
                    api_Result.state = Api_Result_State.Parameter_Error;
                    return(api_Result);
                }
                dictionary3.Add(value2, array[0]);
            }
            Mst_ship mst_ship2 = Mst_DataManager.Instance.Mst_ship[value.Ship_id];
            Dictionary <Mem_ship.enumKyoukaIdx, int> dictionary14 = new Dictionary <Mem_ship.enumKyoukaIdx, int>();

            dictionary14.Add(Mem_ship.enumKyoukaIdx.Houg, mst_ship2.Houg_max);
            dictionary14.Add(Mem_ship.enumKyoukaIdx.Raig, mst_ship2.Raig_max);
            dictionary14.Add(Mem_ship.enumKyoukaIdx.Tyku, mst_ship2.Tyku_max);
            dictionary14.Add(Mem_ship.enumKyoukaIdx.Souk, mst_ship2.Souk_max);
            dictionary14.Add(Mem_ship.enumKyoukaIdx.Luck, mst_ship2.Luck_max);
            Dictionary <Mem_ship.enumKyoukaIdx, int> dictionary15 = dictionary14;

            dictionary14 = new Dictionary <Mem_ship.enumKyoukaIdx, int>();
            dictionary14.Add(Mem_ship.enumKyoukaIdx.Houg, mst_ship2.Houg);
            dictionary14.Add(Mem_ship.enumKyoukaIdx.Raig, mst_ship2.Raig);
            dictionary14.Add(Mem_ship.enumKyoukaIdx.Tyku, mst_ship2.Tyku);
            dictionary14.Add(Mem_ship.enumKyoukaIdx.Souk, mst_ship2.Souk);
            dictionary14.Add(Mem_ship.enumKyoukaIdx.Luck, mst_ship2.Luck);
            Dictionary <Mem_ship.enumKyoukaIdx, int> dictionary16 = dictionary14;
            Dictionary <Mem_ship.enumKyoukaIdx, int> kyouka       = value.Kyouka;

            dictionary14 = new Dictionary <Mem_ship.enumKyoukaIdx, int>();
            dictionary14.Add(Mem_ship.enumKyoukaIdx.Houg, kyouka[Mem_ship.enumKyoukaIdx.Houg]);
            dictionary14.Add(Mem_ship.enumKyoukaIdx.Raig, kyouka[Mem_ship.enumKyoukaIdx.Raig]);
            dictionary14.Add(Mem_ship.enumKyoukaIdx.Tyku, kyouka[Mem_ship.enumKyoukaIdx.Tyku]);
            dictionary14.Add(Mem_ship.enumKyoukaIdx.Souk, kyouka[Mem_ship.enumKyoukaIdx.Souk]);
            dictionary14.Add(Mem_ship.enumKyoukaIdx.Kaihi, kyouka[Mem_ship.enumKyoukaIdx.Kaihi]);
            dictionary14.Add(Mem_ship.enumKyoukaIdx.Taisen, kyouka[Mem_ship.enumKyoukaIdx.Taisen]);
            dictionary14.Add(Mem_ship.enumKyoukaIdx.Luck, kyouka[Mem_ship.enumKyoukaIdx.Luck]);
            Dictionary <Mem_ship.enumKyoukaIdx, int> dictionary17 = dictionary14;
            Random random = new Random();

            foreach (KeyValuePair <Mem_ship.enumKyoukaIdx, int> item in dictionary2)
            {
                if (item.Value > 0)
                {
                    int num2 = dictionary16[item.Key] + kyouka[item.Key];
                    if (dictionary15[item.Key] > num2)
                    {
                        int num3 = random.Next(2);
                        int num4 = (int)Math.Floor((float)item.Value * 0.6f + (float)item.Value * 0.6f * (float)num3 + 0.3f);
                        if (num2 + num4 > dictionary15[item.Key])
                        {
                            dictionary17[item.Key] = dictionary15[item.Key] - dictionary16[item.Key];
                        }
                        else
                        {
                            Dictionary <Mem_ship.enumKyoukaIdx, int> dictionary18 = dictionary14 = dictionary17;
                            Mem_ship.enumKyoukaIdx key;
                            Mem_ship.enumKyoukaIdx key8 = key = item.Key;
                            int num = dictionary14[key];
                            dictionary18[key8] = num + num4;
                        }
                    }
                }
            }
            int num5 = kyouka[Mem_ship.enumKyoukaIdx.Luck] + dictionary16[Mem_ship.enumKyoukaIdx.Luck];
            int num6 = dictionary15[Mem_ship.enumKyoukaIdx.Luck];

            if (dictionary4.Count > 0 && dictionary15[Mem_ship.enumKyoukaIdx.Luck] > num5)
            {
                double num7 = 0.0;
                foreach (KeyValuePair <double, int> item2 in dictionary4)
                {
                    double num8 = item2.Key * (double)item2.Value;
                    num7 += num8;
                }
                int num9 = (int)Math.Floor(num7 + Utils.GetRandDouble(0.0, 0.9, 0.1, 2));
                if (num6 < num9 + num5)
                {
                    dictionary17[Mem_ship.enumKyoukaIdx.Luck] = num6 - dictionary16[Mem_ship.enumKyoukaIdx.Luck];
                }
                else
                {
                    Dictionary <Mem_ship.enumKyoukaIdx, int> dictionary19;
                    Dictionary <Mem_ship.enumKyoukaIdx, int> dictionary20 = dictionary19 = dictionary17;
                    Mem_ship.enumKyoukaIdx key;
                    Mem_ship.enumKyoukaIdx key9 = key = Mem_ship.enumKyoukaIdx.Luck;
                    int num = dictionary19[key];
                    dictionary20[key9] = num + num9;
                }
            }
            bool flag = false;

            foreach (KeyValuePair <Mem_ship.enumKyoukaIdx, int> item3 in dictionary17)
            {
                if (kyouka[item3.Key] != item3.Value)
                {
                    flag = true;
                }
            }
            List <Mem_ship> list2         = dictionary3.Keys.ToList();
            int             num10         = 0;
            int             num11         = 0;
            int             sameShipCount = getSameShipCount(value, list2);
            int             num12         = selectSamePowerupType(sameShipCount);

            dictionary17.Add(Mem_ship.enumKyoukaIdx.Taik_Powerup, value.Kyouka[Mem_ship.enumKyoukaIdx.Taik_Powerup]);
            switch (num12)
            {
            case 1:
                num11 = GetSameShipPowerupLuck(value, sameShipCount, maxFlag: false);
                break;

            case 3:
                num11 = GetSameShipPowerupLuck(value, sameShipCount, maxFlag: true);
                break;

            case 2:
                num10 = GetSameShipPowerupTaikyu(value, sameShipCount, maxFlag: false);
                break;
            }
            int num13 = mst_ship2.Luck + dictionary17[Mem_ship.enumKyoukaIdx.Luck];
            int num14 = mst_ship2.Luck_max - num13;
            int num15 = mst_ship2.Taik + value.Kyouka[Mem_ship.enumKyoukaIdx.Taik] + value.Kyouka[Mem_ship.enumKyoukaIdx.Taik_Powerup];
            int num16 = mst_ship2.Taik_max - num15;

            if (num11 > num14)
            {
                num11 = num14;
            }
            if (num10 > num16)
            {
                num10 = num16;
            }
            bool flag2 = false;

            if (num11 > 0)
            {
                flag2 = true;
                Dictionary <Mem_ship.enumKyoukaIdx, int> dictionary21;
                Dictionary <Mem_ship.enumKyoukaIdx, int> dictionary22 = dictionary21 = dictionary17;
                Mem_ship.enumKyoukaIdx key;
                Mem_ship.enumKyoukaIdx key10 = key = Mem_ship.enumKyoukaIdx.Luck;
                int num = dictionary21[key];
                dictionary22[key10] = num + num11;
                flag = true;
            }
            if (num10 > 0)
            {
                flag2 = true;
                Dictionary <Mem_ship.enumKyoukaIdx, int> dictionary23;
                Dictionary <Mem_ship.enumKyoukaIdx, int> dictionary24 = dictionary23 = dictionary17;
                Mem_ship.enumKyoukaIdx key;
                Mem_ship.enumKyoukaIdx key11 = key = Mem_ship.enumKyoukaIdx.Taik_Powerup;
                int num = dictionary23[key];
                dictionary24[key11] = num + num10;
                flag = true;
            }
            if (flag)
            {
                Mem_shipBase mem_shipBase = new Mem_shipBase(value);
                dictionary17.Add(Mem_ship.enumKyoukaIdx.Taik, value.Kyouka[Mem_ship.enumKyoukaIdx.Taik]);
                mem_shipBase.SetKyoukaValue(dictionary17);
                value.Set_ShipParam(mem_shipBase, mst_ship2, enemy_flag: false);
                api_Result.data = ((!flag2) ? 1 : 2);
            }
            value.SumLovToKaisouPowUp(rid_items.Count);
            foreach (KeyValuePair <Mem_ship, int> item4 in dictionary3)
            {
                if (item4.Value != -1)
                {
                    Mem_deck mem_deck = Comm_UserDatas.Instance.User_deck[item4.Value];
                    mem_deck.Ship.RemoveShip(item4.Key.Rid);
                }
            }
            Comm_UserDatas.Instance.Remove_Ship(list2);
            QuestKaisou questKaisou = new QuestKaisou(flag);

            questKaisou.ExecuteCheck();
            return(api_Result);
        }