示例#1
0
        private void updateShip(Dictionary <int, int> shipExp, out Dictionary <int, List <int> > lvupInfo)
        {
            lvupInfo = new Dictionary <int, List <int> >();
            int count = mem_ships.Count;

            for (int i = 0; i < count; i++)
            {
                mem_ships[i].SetSubFuel_ToMission(mst_mission.Use_fuel);
                mem_ships[i].SetSubBull_ToMission(mst_mission.Use_bull);
                Mem_shipBase mem_shipBase = new Mem_shipBase(mem_ships[i]);
                Mst_ship     mst_data     = Mst_DataManager.Instance.Mst_ship[mem_shipBase.Ship_id];
                List <int>   lvupInfo2    = null;
                int          addExp       = shipExp[mem_ships[i].Rid];
                int          levelupInfo  = mem_ships[i].getLevelupInfo(mst_level, mem_ships[i].Level, mem_ships[i].Exp, ref addExp, out lvupInfo2);
                lvupInfo.Add(mem_ships[i].Rid, lvupInfo2);
                mem_shipBase.Level = levelupInfo;
                mem_shipBase.Exp  += addExp;
                int num = levelupInfo - mem_ships[i].Level;
                Dictionary <Mem_ship.enumKyoukaIdx, int> dictionary = mem_ships[i].Kyouka;
                for (int j = 0; j < num; j++)
                {
                    dictionary = mem_ships[i].getLevelupKyoukaValue(mem_ships[i].Ship_id, dictionary);
                }
                mem_shipBase.SetKyoukaValue(dictionary);
                setCondSubValue(ref mem_shipBase.Cond);
                int value  = 0;
                int value2 = 0;
                mst_level.TryGetValue(mem_shipBase.Level - 1, out value);
                mst_level.TryGetValue(mem_shipBase.Level + 1, out value2);
                mem_ships[i].SetRequireExp(mem_shipBase.Level, mst_level);
                mem_ships[i].Set_ShipParam(mem_shipBase, mst_data, enemy_flag: false);
                mem_ships[i].SumLovToMission(resultInfo.MissionResult);
            }
        }
示例#2
0
        public void ShipAddExp(List <Mem_ship> ships, List <int> addExps)
        {
            int count = addExps.get_Count();
            Dictionary <int, int> dictionary = Mst_DataManager.Instance.Get_MstLevel(true);

            for (int i = 0; i < count; i++)
            {
                Mem_shipBase mem_shipBase = new Mem_shipBase(ships.get_Item(i));
                Mst_ship     mst_data     = Mst_DataManager.Instance.Mst_ship.get_Item(mem_shipBase.Ship_id);
                List <int>   list         = null;
                int          num          = addExps.get_Item(i);
                int          levelupInfo  = ships.get_Item(i).getLevelupInfo(dictionary, ships.get_Item(i).Level, ships.get_Item(i).Exp, ref num, out list);
                mem_shipBase.Level = levelupInfo;
                mem_shipBase.Exp  += num;
                int num2 = levelupInfo - ships.get_Item(i).Level;
                Dictionary <Mem_ship.enumKyoukaIdx, int> dictionary2 = ships.get_Item(i).Kyouka;
                for (int j = 0; j < num2; j++)
                {
                    dictionary2 = ships.get_Item(i).getLevelupKyoukaValue(ships.get_Item(i).Ship_id, dictionary2);
                }
                mem_shipBase.SetKyoukaValue(dictionary2);
                int num3 = 0;
                int num4 = 0;
                dictionary.TryGetValue(mem_shipBase.Level - 1, ref num3);
                dictionary.TryGetValue(mem_shipBase.Level + 1, ref num4);
                ships.get_Item(i).SetRequireExp(mem_shipBase.Level, dictionary);
                ships.get_Item(i).Set_ShipParam(mem_shipBase, mst_data, false);
            }
        }
示例#3
0
        private void updateShipPracticeEnemy(SerializableDictionary <int, int> getShipExp, ref SerializableDictionary <int, List <int> > lvupInfo)
        {
            List <Mem_ship>       shipData  = E_Data.ShipData;
            Dictionary <int, int> mst_level = mst_shiplevel;

            foreach (Mem_ship item in shipData)
            {
                Mem_ship     mem_ship     = Comm_UserDatas.Instance.User_ship[item.Rid];
                Mem_shipBase mem_shipBase = new Mem_shipBase(mem_ship);
                Mst_ship     mst_data     = Mst_DataManager.Instance.Mst_ship[mem_shipBase.Ship_id];
                int          addExp       = getShipExp[mem_ship.Rid];
                List <int>   lvupInfo2    = null;
                int          levelupInfo  = mem_ship.getLevelupInfo(mst_level, mem_shipBase.Level, mem_shipBase.Exp, ref addExp, out lvupInfo2);
                lvupInfo.Add(mem_ship.Rid, lvupInfo2);
                mem_shipBase.Level = levelupInfo;
                mem_shipBase.Exp  += addExp;
                int num = levelupInfo - mem_ship.Level;
                Dictionary <Mem_ship.enumKyoukaIdx, int> dictionary = mem_ship.Kyouka;
                for (int i = 0; i < num; i++)
                {
                    dictionary = mem_ship.getLevelupKyoukaValue(mem_ship.Ship_id, dictionary);
                }
                mem_shipBase.SetKyoukaValue(dictionary);
                mem_ship.SetRequireExp(mem_shipBase.Level, mst_level);
                mem_ship.Set_ShipParam(mem_shipBase, mst_data, enemy_flag: false);
            }
        }
示例#4
0
        public void ShipAddExp(List <Mem_ship> ships, List <int> addExps)
        {
            int count = addExps.Count;
            Dictionary <int, int> dictionary = Mst_DataManager.Instance.Get_MstLevel(shipTable: true);

            for (int i = 0; i < count; i++)
            {
                Mem_shipBase mem_shipBase = new Mem_shipBase(ships[i]);
                Mst_ship     mst_data     = Mst_DataManager.Instance.Mst_ship[mem_shipBase.Ship_id];
                List <int>   lvupInfo     = null;
                int          addExp       = addExps[i];
                int          num          = mem_shipBase.Level = ships[i].getLevelupInfo(dictionary, ships[i].Level, ships[i].Exp, ref addExp, out lvupInfo);
                mem_shipBase.Exp += addExp;
                int num2 = num - ships[i].Level;
                Dictionary <Mem_ship.enumKyoukaIdx, int> dictionary2 = ships[i].Kyouka;
                for (int j = 0; j < num2; j++)
                {
                    dictionary2 = ships[i].getLevelupKyoukaValue(ships[i].Ship_id, dictionary2);
                }
                mem_shipBase.SetKyoukaValue(dictionary2);
                int value  = 0;
                int value2 = 0;
                dictionary.TryGetValue(mem_shipBase.Level - 1, out value);
                dictionary.TryGetValue(mem_shipBase.Level + 1, out value2);
                ships[i].SetRequireExp(mem_shipBase.Level, dictionary);
                ships[i].Set_ShipParam(mem_shipBase, mst_data, enemy_flag: false);
            }
        }
示例#5
0
        private Dictionary <int, List <int> > updateShip(DeckPracticeType type, Dictionary <int, int> getShipExp, Dictionary <int, PowUpInfo> powerUp)
        {
            Dictionary <int, List <int> > dictionary = new Dictionary <int, List <int> >();

            double[] array = this.useMaterial.get_Item(type);
            using (List <Mem_ship> .Enumerator enumerator = this.mem_ship.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    Mem_ship     current      = enumerator.get_Current();
                    int          rid          = current.Rid;
                    Mem_shipBase mem_shipBase = new Mem_shipBase(current);
                    Mst_ship     mst_data     = Mst_DataManager.Instance.Mst_ship.get_Item(mem_shipBase.Ship_id);
                    int          num          = getShipExp.get_Item(rid);
                    List <int>   list         = null;
                    int          levelupInfo  = current.getLevelupInfo(this.mstLevelShip, current.Level, current.Exp, ref num, out list);
                    getShipExp.set_Item(rid, num);
                    if (getShipExp.get_Item(rid) != 0)
                    {
                        mem_shipBase.Exp  += num;
                        mem_shipBase.Level = levelupInfo;
                    }
                    dictionary.Add(rid, list);
                    Dictionary <Mem_ship.enumKyoukaIdx, int> dictionary2 = current.Kyouka;
                    if (!powerUp.get_Item(current.Rid).IsAllZero())
                    {
                        this.addKyoukaValues(powerUp.get_Item(current.Rid), dictionary2);
                    }
                    int num2 = levelupInfo - current.Level;
                    for (int i = 0; i < num2; i++)
                    {
                        dictionary2 = current.getLevelupKyoukaValue(current.Ship_id, dictionary2);
                    }
                    mem_shipBase.SetKyoukaValue(dictionary2);
                    current.SetRequireExp(mem_shipBase.Level, this.mstLevelShip);
                    mem_shipBase.Fuel = (int)((double)mem_shipBase.Fuel - (double)mem_shipBase.Fuel * array[0]);
                    mem_shipBase.Bull = (int)((double)mem_shipBase.Bull - (double)mem_shipBase.Bull * array[1]);
                    if (mem_shipBase.Fuel < 0)
                    {
                        mem_shipBase.Fuel = 0;
                    }
                    if (mem_shipBase.Bull < 0)
                    {
                        mem_shipBase.Bull = 0;
                    }
                    current.Set_ShipParam(mem_shipBase, mst_data, false);
                }
            }
            return(dictionary);
        }
示例#6
0
        private void updateRadingEscortShipExp(List <RadingResultData> radingData)
        {
            HashSet <int> radingArea = new HashSet <int>();

            if (radingData != null && radingData.Count > 0)
            {
                radingData.ForEach(delegate(RadingResultData x)
                {
                    radingArea.Add(x.AreaId);
                });
            }
            Dictionary <int, int> mstLevel = ArrayMaster.GetMstLevel();

            foreach (Mem_esccort_deck value3 in Comm_UserDatas.Instance.User_EscortDeck.Values)
            {
                if (value3.Ship.Count() > 0)
                {
                    int             num     = radingArea.Contains(value3.Maparea_id) ? 1 : 2;
                    List <Mem_ship> memShip = value3.Ship.getMemShip();
                    foreach (Mem_ship item in memShip)
                    {
                        if (item.IsFight() && !item.IsBlingShip())
                        {
                            double       num2         = Math.Sqrt(item.Level);
                            int          addExp       = (num != 1) ? ((int)(num2 * (1.0 + Utils.GetRandDouble(0.0, 3.0, 1.0, 1) + 0.5))) : ((int)(num2 * (20.0 + Utils.GetRandDouble(0.0, 80.0, 1.0, 1) + 0.5)));
                            Mem_shipBase mem_shipBase = new Mem_shipBase(item);
                            List <int>   lvupInfo     = new List <int>();
                            int          num3         = mem_shipBase.Level = item.getLevelupInfo(mstLevel, mem_shipBase.Level, mem_shipBase.Exp, ref addExp, out lvupInfo);
                            mem_shipBase.Exp += addExp;
                            int num4 = num3 - item.Level;
                            Dictionary <Mem_ship.enumKyoukaIdx, int> dictionary = item.Kyouka;
                            for (int i = 0; i < num4; i++)
                            {
                                dictionary = item.getLevelupKyoukaValue(item.Ship_id, dictionary);
                            }
                            mem_shipBase.SetKyoukaValue(dictionary);
                            int value  = 0;
                            int value2 = 0;
                            mstLevel.TryGetValue(mem_shipBase.Level - 1, out value);
                            mstLevel.TryGetValue(mem_shipBase.Level + 1, out value2);
                            item.SetRequireExp(mem_shipBase.Level, mstLevel);
                            Mst_ship mst_data = Mst_DataManager.Instance.Mst_ship[mem_shipBase.Ship_id];
                            item.Set_ShipParam(mem_shipBase, mst_data, enemy_flag: false);
                        }
                    }
                }
            }
        }
示例#7
0
        private Dictionary <int, List <int> > updateShip(DeckPracticeType type, Dictionary <int, int> getShipExp, Dictionary <int, PowUpInfo> powerUp)
        {
            Dictionary <int, List <int> > dictionary = new Dictionary <int, List <int> >();

            double[] array = useMaterial[type];
            foreach (Mem_ship item in mem_ship)
            {
                int          rid          = item.Rid;
                Mem_shipBase mem_shipBase = new Mem_shipBase(item);
                Mst_ship     mst_data     = Mst_DataManager.Instance.Mst_ship[mem_shipBase.Ship_id];
                int          addExp       = getShipExp[rid];
                List <int>   lvupInfo     = null;
                int          levelupInfo  = item.getLevelupInfo(mstLevelShip, item.Level, item.Exp, ref addExp, out lvupInfo);
                getShipExp[rid] = addExp;
                if (getShipExp[rid] != 0)
                {
                    mem_shipBase.Exp  += addExp;
                    mem_shipBase.Level = levelupInfo;
                }
                dictionary.Add(rid, lvupInfo);
                Dictionary <Mem_ship.enumKyoukaIdx, int> dictionary2 = item.Kyouka;
                if (!powerUp[item.Rid].IsAllZero())
                {
                    addKyoukaValues(powerUp[item.Rid], dictionary2);
                }
                int num = levelupInfo - item.Level;
                for (int i = 0; i < num; i++)
                {
                    dictionary2 = item.getLevelupKyoukaValue(item.Ship_id, dictionary2);
                }
                mem_shipBase.SetKyoukaValue(dictionary2);
                item.SetRequireExp(mem_shipBase.Level, mstLevelShip);
                mem_shipBase.Fuel = (int)((double)mem_shipBase.Fuel - (double)mem_shipBase.Fuel * array[0]);
                mem_shipBase.Bull = (int)((double)mem_shipBase.Bull - (double)mem_shipBase.Bull * array[1]);
                if (mem_shipBase.Fuel < 0)
                {
                    mem_shipBase.Fuel = 0;
                }
                if (mem_shipBase.Bull < 0)
                {
                    mem_shipBase.Bull = 0;
                }
                item.Set_ShipParam(mem_shipBase, mst_data, enemy_flag: false);
            }
            return(dictionary);
        }
示例#8
0
        public Api_Result <Mem_ship> Remodeling(int ship_rid, int drawingNum)
        {
            Api_Result <Mem_ship> api_Result = new Api_Result <Mem_ship>();
            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);
            }
            Mst_ship     mst_ship     = Mst_DataManager.Instance.Mst_ship.get_Item(mem_ship.Ship_id);
            int          aftershipid  = Mst_DataManager.Instance.Mst_ship.get_Item(mem_ship.Ship_id).Aftershipid;
            Mst_ship     mst_ship2    = Mst_DataManager.Instance.Mst_ship.get_Item(aftershipid);
            Mem_shipBase mem_shipBase = new Mem_shipBase(mem_ship);
            Dictionary <Mem_ship.enumKyoukaIdx, int> dictionary = new Dictionary <Mem_ship.enumKyoukaIdx, int>();

            dictionary.Add(Mem_ship.enumKyoukaIdx.Houg, mst_ship2.Houg);
            dictionary.Add(Mem_ship.enumKyoukaIdx.Raig, mst_ship2.Raig);
            dictionary.Add(Mem_ship.enumKyoukaIdx.Souk, mst_ship2.Souk);
            dictionary.Add(Mem_ship.enumKyoukaIdx.Tyku, mst_ship2.Tyku);
            Dictionary <Mem_ship.enumKyoukaIdx, int> dictionary2 = dictionary;

            dictionary = new Dictionary <Mem_ship.enumKyoukaIdx, int>();
            dictionary.Add(Mem_ship.enumKyoukaIdx.Houg, mst_ship2.Houg_max);
            dictionary.Add(Mem_ship.enumKyoukaIdx.Raig, mst_ship2.Raig_max);
            dictionary.Add(Mem_ship.enumKyoukaIdx.Souk, mst_ship2.Souk_max);
            dictionary.Add(Mem_ship.enumKyoukaIdx.Tyku, mst_ship2.Tyku_max);
            Dictionary <Mem_ship.enumKyoukaIdx, int> dictionary3 = dictionary;
            Dictionary <Mem_ship.enumKyoukaIdx, int> kyouka      = mem_ship.Kyouka;
            Random random = new Random();

            using (Dictionary <Mem_ship.enumKyoukaIdx, int> .Enumerator enumerator = dictionary2.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    KeyValuePair <Mem_ship.enumKyoukaIdx, int> current = enumerator.get_Current();
                    int    num  = dictionary2.get_Item(current.get_Key());
                    int    num2 = dictionary3.get_Item(current.get_Key());
                    int    num3 = num2 - num;
                    double num4 = (double)num3 * (0.4 + 0.4 * (double)random.Next(2)) * (double)mem_ship.Level / 99.0;
                    int    num5 = (int)Math.Ceiling(num4);
                    kyouka.set_Item(current.get_Key(), num5);
                    if (num2 < kyouka.get_Item(current.get_Key()) + num)
                    {
                        kyouka.set_Item(current.get_Key(), num2 - num);
                    }
                }
            }
            if (kyouka.get_Item(Mem_ship.enumKyoukaIdx.Luck) + mst_ship2.Luck > mst_ship2.Luck_max)
            {
                kyouka.set_Item(Mem_ship.enumKyoukaIdx.Luck, mst_ship2.Luck_max - mst_ship2.Luck);
            }
            kyouka.set_Item(Mem_ship.enumKyoukaIdx.Taik_Powerup, 0);
            mem_shipBase.C_taik_powerup = 0;
            if (mem_shipBase.Level >= 100)
            {
                int remodelingTaik = this.getRemodelingTaik(mst_ship2.Taik);
                int num6           = mst_ship2.Taik + remodelingTaik;
                if (num6 > mst_ship2.Taik_max)
                {
                    num6 = mst_ship2.Taik_max;
                }
                kyouka.set_Item(Mem_ship.enumKyoukaIdx.Taik, num6 - mst_ship2.Taik);
            }
            List <int> list = Comm_UserDatas.Instance.Add_Slot(mst_ship2.Defeq);

            mem_shipBase.Slot.ForEach(delegate(int x)
            {
                if (x > 0)
                {
                    Comm_UserDatas.Instance.User_slot.get_Item(x).UnEquip();
                }
            });
            if (mem_ship.Exslot > 0)
            {
                Comm_UserDatas.Instance.User_slot.get_Item(mem_ship.Exslot).UnEquip();
                mem_shipBase.Exslot = -1;
            }
            mem_shipBase.Slot.Clear();
            mem_shipBase.Onslot.Clear();
            for (int i = 0; i < mst_ship2.Slot_num; i++)
            {
                if (list.get_Count() > i)
                {
                    mem_shipBase.Slot.Add(list.get_Item(i));
                    Mem_slotitem mem_slotitem = Comm_UserDatas.Instance.User_slot.get_Item(list.get_Item(i));
                    mem_slotitem.Equip(mem_shipBase.Rid);
                }
                else
                {
                    mem_shipBase.Slot.Add(mst_ship2.Defeq.get_Item(i));
                }
                mem_shipBase.Onslot.Add(mst_ship2.Maxeq.get_Item(i));
            }
            mem_shipBase.Nowhp = kyouka.get_Item(Mem_ship.enumKyoukaIdx.Taik) + mst_ship2.Taik;
            mem_shipBase.Fuel  = mst_ship2.Fuel_max;
            mem_shipBase.Bull  = mst_ship2.Bull_max;
            mem_shipBase.Cond  = 40;
            mem_shipBase.SetKyoukaValue(kyouka);
            mem_ship.Set_ShipParam(mem_shipBase, mst_ship2, false);
            mem_ship.SumLovToRemodeling();
            if (drawingNum > 0)
            {
                Comm_UserDatas.Instance.User_useItem.get_Item(58).Sub_UseItem(drawingNum);
            }
            int remodelDevKitNum = mst_ship2.GetRemodelDevKitNum();

            if (remodelDevKitNum > 0)
            {
                Comm_UserDatas.Instance.User_material.get_Item(enumMaterialCategory.Dev_Kit).Sub_Material(remodelDevKitNum);
            }
            Comm_UserDatas.Instance.User_material.get_Item(enumMaterialCategory.Steel).Sub_Material(mst_ship.Afterfuel);
            Comm_UserDatas.Instance.User_material.get_Item(enumMaterialCategory.Bull).Sub_Material(mst_ship.Afterbull);
            Comm_UserDatas.Instance.Add_Book(1, mem_ship.Ship_id);
            api_Result.data = mem_ship;
            return(api_Result);
        }
示例#9
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);
        }
        private void updateRadingEscortShipExp(List <RadingResultData> radingData)
        {
            HashSet <int> radingArea = new HashSet <int>();

            if (radingData != null && radingData.get_Count() > 0)
            {
                radingData.ForEach(delegate(RadingResultData x)
                {
                    radingArea.Add(x.AreaId);
                });
            }
            Dictionary <int, int> mstLevel = ArrayMaster.GetMstLevel();

            using (Dictionary <int, Mem_esccort_deck> .ValueCollection.Enumerator enumerator = Comm_UserDatas.Instance.User_EscortDeck.get_Values().GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    Mem_esccort_deck current = enumerator.get_Current();
                    if (current.Ship.Count() > 0)
                    {
                        int             num     = (!radingArea.Contains(current.Maparea_id)) ? 2 : 1;
                        List <Mem_ship> memShip = current.Ship.getMemShip();
                        using (List <Mem_ship> .Enumerator enumerator2 = memShip.GetEnumerator())
                        {
                            while (enumerator2.MoveNext())
                            {
                                Mem_ship current2 = enumerator2.get_Current();
                                if (current2.IsFight() && !current2.IsBlingShip())
                                {
                                    double num2 = Math.Sqrt((double)current2.Level);
                                    int    num3 = 0;
                                    if (num == 1)
                                    {
                                        num3 = (int)(num2 * (20.0 + Utils.GetRandDouble(0.0, 80.0, 1.0, 1) + 0.5));
                                    }
                                    else
                                    {
                                        num3 = (int)(num2 * (1.0 + Utils.GetRandDouble(0.0, 3.0, 1.0, 1) + 0.5));
                                    }
                                    Mem_shipBase mem_shipBase = new Mem_shipBase(current2);
                                    List <int>   list         = new List <int>();
                                    int          levelupInfo  = current2.getLevelupInfo(mstLevel, mem_shipBase.Level, mem_shipBase.Exp, ref num3, out list);
                                    mem_shipBase.Level = levelupInfo;
                                    mem_shipBase.Exp  += num3;
                                    int num4 = levelupInfo - current2.Level;
                                    Dictionary <Mem_ship.enumKyoukaIdx, int> dictionary = current2.Kyouka;
                                    for (int i = 0; i < num4; i++)
                                    {
                                        dictionary = current2.getLevelupKyoukaValue(current2.Ship_id, dictionary);
                                    }
                                    mem_shipBase.SetKyoukaValue(dictionary);
                                    int num5 = 0;
                                    int num6 = 0;
                                    mstLevel.TryGetValue(mem_shipBase.Level - 1, ref num5);
                                    mstLevel.TryGetValue(mem_shipBase.Level + 1, ref num6);
                                    current2.SetRequireExp(mem_shipBase.Level, mstLevel);
                                    Mst_ship mst_data = Mst_DataManager.Instance.Mst_ship.get_Item(mem_shipBase.Ship_id);
                                    current2.Set_ShipParam(mem_shipBase, mst_data, false);
                                }
                            }
                        }
                    }
                }
            }
        }
示例#11
0
        private void updateShip(BattleWinRankKinds rank, int mvpShip, SerializableDictionary <int, int> getShipExp, out SerializableDictionary <int, List <int> > lvupInfo)
        {
            lvupInfo = new SerializableDictionary <int, List <int> >();
            List <Mem_ship> shipData = F_Data.ShipData;
            int             count    = shipData.Count;
            bool            flag     = true;
            double          num      = 1.0;
            double          num2     = 0.0;

            if (!practiceFlag)
            {
                flag = E_Data.ShipData.Exists((Mem_ship x) => (!Mst_DataManager.Instance.Mst_stype[x.Stype].IsSubmarine()) ? true : false);
                if (!flag)
                {
                    num  = 0.25;
                    num2 = 0.5;
                }
            }
            Dictionary <int, int> dictionary = mst_shiplevel;

            for (int i = 0; i < count; i++)
            {
                Mem_ship     mem_ship     = shipData[i];
                Mem_shipBase mem_shipBase = new Mem_shipBase(mem_ship);
                Mst_ship     mst_ship     = Mst_DataManager.Instance.Mst_ship[mem_shipBase.Ship_id];
                int          addExp       = getShipExp[mem_ship.Rid];
                List <int>   lvupInfo2    = null;
                int          levelupInfo  = mem_ship.getLevelupInfo(dictionary, mem_shipBase.Level, mem_shipBase.Exp, ref addExp, out lvupInfo2);
                lvupInfo.Add(mem_ship.Rid, lvupInfo2);
                if (!mem_ship.Escape_sts)
                {
                    mem_shipBase.Level = levelupInfo;
                    mem_shipBase.Exp  += addExp;
                    mem_shipBase.Fuel -= mst_ship.Use_fuel;
                    if (mem_shipBase.Fuel < 0)
                    {
                        mem_shipBase.Fuel = 0;
                    }
                    int num3 = mst_ship.Use_bull;
                    if (battleKinds == ExecBattleKinds.DayToNight)
                    {
                        num3 = (int)Math.Ceiling((double)num3 * 1.5);
                    }
                    num3 = (int)((double)num3 * num + num2);
                    if (!flag && num3 <= 0)
                    {
                        num3 = 1;
                    }
                    mem_shipBase.Bull -= num3;
                    if (mem_shipBase.Bull < 0)
                    {
                        mem_shipBase.Bull = 0;
                    }
                    setCondSubValue(ref mem_shipBase.Cond);
                    bool mvp   = (mvpShip == mem_ship.Rid) ? true : false;
                    bool flag2 = (F_SubInfo[mem_ship.Rid].DeckIdx == 0) ? true : false;
                    setCondBonus(rank, flag2, mvp, ref mem_shipBase.Cond);
                    int num4 = levelupInfo - mem_ship.Level;
                    Dictionary <Mem_ship.enumKyoukaIdx, int> dictionary2 = mem_ship.Kyouka;
                    for (int j = 0; j < num4; j++)
                    {
                        dictionary2 = mem_ship.getLevelupKyoukaValue(mem_ship.Ship_id, dictionary2);
                    }
                    mem_shipBase.SetKyoukaValue(dictionary2);
                    if (mem_ship.Get_DamageState() >= DamageState.Tyuuha)
                    {
                        clothBrokenIds.Add(mem_ship.Ship_id);
                    }
                    if (practiceFlag)
                    {
                        mem_shipBase.Nowhp = F_Data.StartHp[i];
                    }
                    else if (mem_shipBase.Nowhp <= 0)
                    {
                        deleteTargetShip.Add(mem_ship);
                    }
                    int value  = 0;
                    int value2 = 0;
                    dictionary.TryGetValue(mem_shipBase.Level - 1, out value);
                    dictionary.TryGetValue(mem_shipBase.Level + 1, out value2);
                    mem_ship.SetRequireExp(mem_shipBase.Level, dictionary);
                    mem_ship.SumLovToBattle(rank, flag2, mvp, F_Data.StartHp[i], mem_ship.Nowhp);
                    mem_shipBase.Lov = mem_ship.Lov;
                    mem_ship.Set_ShipParam(mem_shipBase, mst_ship, enemy_flag: false);
                }
            }
        }
示例#12
0
        public Api_Result <Mem_ship> Remodeling(int ship_rid, int drawingNum)
        {
            Api_Result <Mem_ship> api_Result = new Api_Result <Mem_ship>();
            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);
            }
            Mst_ship     mst_ship     = Mst_DataManager.Instance.Mst_ship[value.Ship_id];
            int          aftershipid  = Mst_DataManager.Instance.Mst_ship[value.Ship_id].Aftershipid;
            Mst_ship     mst_ship2    = Mst_DataManager.Instance.Mst_ship[aftershipid];
            Mem_shipBase mem_shipBase = new Mem_shipBase(value);
            Dictionary <Mem_ship.enumKyoukaIdx, int> dictionary = new Dictionary <Mem_ship.enumKyoukaIdx, int>();

            dictionary.Add(Mem_ship.enumKyoukaIdx.Houg, mst_ship2.Houg);
            dictionary.Add(Mem_ship.enumKyoukaIdx.Raig, mst_ship2.Raig);
            dictionary.Add(Mem_ship.enumKyoukaIdx.Souk, mst_ship2.Souk);
            dictionary.Add(Mem_ship.enumKyoukaIdx.Tyku, mst_ship2.Tyku);
            Dictionary <Mem_ship.enumKyoukaIdx, int> dictionary2 = dictionary;

            dictionary = new Dictionary <Mem_ship.enumKyoukaIdx, int>();
            dictionary.Add(Mem_ship.enumKyoukaIdx.Houg, mst_ship2.Houg_max);
            dictionary.Add(Mem_ship.enumKyoukaIdx.Raig, mst_ship2.Raig_max);
            dictionary.Add(Mem_ship.enumKyoukaIdx.Souk, mst_ship2.Souk_max);
            dictionary.Add(Mem_ship.enumKyoukaIdx.Tyku, mst_ship2.Tyku_max);
            Dictionary <Mem_ship.enumKyoukaIdx, int> dictionary3 = dictionary;
            Dictionary <Mem_ship.enumKyoukaIdx, int> kyouka      = value.Kyouka;
            Random random = new Random();

            foreach (KeyValuePair <Mem_ship.enumKyoukaIdx, int> item in dictionary2)
            {
                int    num    = dictionary2[item.Key];
                int    num2   = dictionary3[item.Key];
                int    num3   = num2 - num;
                double a      = (double)num3 * (0.4 + 0.4 * (double)random.Next(2)) * (double)value.Level / 99.0;
                int    value2 = (int)Math.Ceiling(a);
                kyouka[item.Key] = value2;
                if (num2 < kyouka[item.Key] + num)
                {
                    kyouka[item.Key] = num2 - num;
                }
            }
            if (kyouka[Mem_ship.enumKyoukaIdx.Luck] + mst_ship2.Luck > mst_ship2.Luck_max)
            {
                kyouka[Mem_ship.enumKyoukaIdx.Luck] = mst_ship2.Luck_max - mst_ship2.Luck;
            }
            kyouka[Mem_ship.enumKyoukaIdx.Taik_Powerup] = 0;
            mem_shipBase.C_taik_powerup = 0;
            if (mem_shipBase.Level >= 100)
            {
                int remodelingTaik = getRemodelingTaik(mst_ship2.Taik);
                int num4           = mst_ship2.Taik + remodelingTaik;
                if (num4 > mst_ship2.Taik_max)
                {
                    num4 = mst_ship2.Taik_max;
                }
                kyouka[Mem_ship.enumKyoukaIdx.Taik] = num4 - mst_ship2.Taik;
            }
            List <int> list = Comm_UserDatas.Instance.Add_Slot(mst_ship2.Defeq);

            mem_shipBase.Slot.ForEach(delegate(int x)
            {
                if (x > 0)
                {
                    Comm_UserDatas.Instance.User_slot[x].UnEquip();
                }
            });
            if (value.Exslot > 0)
            {
                Comm_UserDatas.Instance.User_slot[value.Exslot].UnEquip();
                mem_shipBase.Exslot = -1;
            }
            mem_shipBase.Slot.Clear();
            mem_shipBase.Onslot.Clear();
            for (int i = 0; i < mst_ship2.Slot_num; i++)
            {
                if (list.Count > i)
                {
                    mem_shipBase.Slot.Add(list[i]);
                    Mem_slotitem mem_slotitem = Comm_UserDatas.Instance.User_slot[list[i]];
                    mem_slotitem.Equip(mem_shipBase.Rid);
                }
                else
                {
                    mem_shipBase.Slot.Add(mst_ship2.Defeq[i]);
                }
                mem_shipBase.Onslot.Add(mst_ship2.Maxeq[i]);
            }
            mem_shipBase.Nowhp = kyouka[Mem_ship.enumKyoukaIdx.Taik] + mst_ship2.Taik;
            mem_shipBase.Fuel  = mst_ship2.Fuel_max;
            mem_shipBase.Bull  = mst_ship2.Bull_max;
            mem_shipBase.Cond  = 40;
            mem_shipBase.SetKyoukaValue(kyouka);
            value.Set_ShipParam(mem_shipBase, mst_ship2, enemy_flag: false);
            value.SumLovToRemodeling();
            if (drawingNum > 0)
            {
                Comm_UserDatas.Instance.User_useItem[58].Sub_UseItem(drawingNum);
            }
            int remodelDevKitNum = mst_ship2.GetRemodelDevKitNum();

            if (remodelDevKitNum > 0)
            {
                Comm_UserDatas.Instance.User_material[enumMaterialCategory.Dev_Kit].Sub_Material(remodelDevKitNum);
            }
            Comm_UserDatas.Instance.User_material[enumMaterialCategory.Steel].Sub_Material(mst_ship.Afterfuel);
            Comm_UserDatas.Instance.User_material[enumMaterialCategory.Bull].Sub_Material(mst_ship.Afterbull);
            Comm_UserDatas.Instance.Add_Book(1, value.Ship_id);
            api_Result.data = value;
            return(api_Result);
        }
示例#13
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);
        }