Exemple #1
0
        public SlotSetChkResult_Ship IsValidSlotSet(int ship_rid)
        {
            Mem_ship value = null;

            if (!Comm_UserDatas.Instance.User_ship.TryGetValue(ship_rid, out value))
            {
                return(SlotSetChkResult_Ship.Invalid);
            }
            if (value.IsBlingShip())
            {
                return(SlotSetChkResult_Ship.BlingShip);
            }
            Mem_deck mem_deck = Comm_UserDatas.Instance.User_deck.Values.FirstOrDefault((Mem_deck x) => (x.Ship.Find(ship_rid) != -1) ? true : false);

            if (mem_deck != null)
            {
                if (mem_deck.MissionState != 0)
                {
                    return(SlotSetChkResult_Ship.Mission);
                }
                if (mem_deck.IsActionEnd)
                {
                    return(SlotSetChkResult_Ship.ActionEndDeck);
                }
            }
            if (Comm_UserDatas.Instance.User_ndock.Values.Any((Mem_ndock x) => x.Ship_id == ship_rid))
            {
                return(SlotSetChkResult_Ship.Repair);
            }
            return(SlotSetChkResult_Ship.Ok);
        }
Exemple #2
0
        public Api_req_Kaisou.SlotSetChkResult_Ship IsValidSlotSet(int ship_rid)
        {
            Mem_ship mem_ship = null;

            if (!Comm_UserDatas.Instance.User_ship.TryGetValue(ship_rid, ref mem_ship))
            {
                return(Api_req_Kaisou.SlotSetChkResult_Ship.Invalid);
            }
            if (mem_ship.IsBlingShip())
            {
                return(Api_req_Kaisou.SlotSetChkResult_Ship.BlingShip);
            }
            Mem_deck mem_deck = Enumerable.FirstOrDefault <Mem_deck>(Comm_UserDatas.Instance.User_deck.get_Values(), (Mem_deck x) => x.Ship.Find(ship_rid) != -1);

            if (mem_deck != null)
            {
                if (mem_deck.MissionState != MissionStates.NONE)
                {
                    return(Api_req_Kaisou.SlotSetChkResult_Ship.Mission);
                }
                if (mem_deck.IsActionEnd)
                {
                    return(Api_req_Kaisou.SlotSetChkResult_Ship.ActionEndDeck);
                }
            }
            if (Enumerable.Any <Mem_ndock>(Comm_UserDatas.Instance.User_ndock.get_Values(), (Mem_ndock x) => x.Ship_id == ship_rid))
            {
                return(Api_req_Kaisou.SlotSetChkResult_Ship.Repair);
            }
            return(Api_req_Kaisou.SlotSetChkResult_Ship.Ok);
        }
Exemple #3
0
        public Api_Result <Mem_ndock> Start(int rid, int ship_rid, bool highspeed)
        {
            Api_Result <Mem_ndock> api_Result = new Api_Result <Mem_ndock>();
            Mem_ndock mem_ndock = null;

            if (!Comm_UserDatas.Instance.User_ndock.TryGetValue(rid, ref mem_ndock))
            {
                api_Result.state = Api_Result_State.Parameter_Error;
                return(api_Result);
            }
            if (mem_ndock.State != NdockStates.EMPTY)
            {
                api_Result.state = Api_Result_State.Parameter_Error;
                return(api_Result);
            }
            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);
            }
            Dictionary <enumMaterialCategory, int> ndockMaterialNum = mem_ship.GetNdockMaterialNum();

            if (ndockMaterialNum == null)
            {
                api_Result.state = Api_Result_State.Parameter_Error;
                return(api_Result);
            }
            int num = (!highspeed) ? 0 : 1;

            if (ndockMaterialNum.get_Item(enumMaterialCategory.Fuel) > Comm_UserDatas.Instance.User_material.get_Item(enumMaterialCategory.Fuel).Value || ndockMaterialNum.get_Item(enumMaterialCategory.Steel) > Comm_UserDatas.Instance.User_material.get_Item(enumMaterialCategory.Steel).Value || num > Comm_UserDatas.Instance.User_material.get_Item(enumMaterialCategory.Repair_Kit).Value)
            {
                api_Result.state = Api_Result_State.Parameter_Error;
                return(api_Result);
            }
            mem_ship.BlingWaitToStop();
            if (!highspeed)
            {
                int ndockTimeSpan = mem_ship.GetNdockTimeSpan();
                mem_ndock.RecoverStart(ship_rid, ndockMaterialNum, ndockTimeSpan);
            }
            else
            {
                mem_ndock.RecoverStart(ship_rid, ndockMaterialNum, 0);
                mem_ndock.RecoverEnd(false);
                Comm_UserDatas.Instance.User_material.get_Item(enumMaterialCategory.Repair_Kit).Sub_Material(1);
            }
            api_Result.data = mem_ndock;
            QuestSupply questSupply = new QuestSupply();

            questSupply.ExecuteCheck();
            return(api_Result);
        }
Exemple #4
0
        public Api_Result <Mem_ndock> Start(int rid, int ship_rid, bool highspeed)
        {
            Api_Result <Mem_ndock> api_Result = new Api_Result <Mem_ndock>();
            Mem_ndock value = null;

            if (!Comm_UserDatas.Instance.User_ndock.TryGetValue(rid, out value))
            {
                api_Result.state = Api_Result_State.Parameter_Error;
                return(api_Result);
            }
            if (value.State != NdockStates.EMPTY)
            {
                api_Result.state = Api_Result_State.Parameter_Error;
                return(api_Result);
            }
            Mem_ship value2 = null;

            if (!Comm_UserDatas.Instance.User_ship.TryGetValue(ship_rid, out value2))
            {
                api_Result.state = Api_Result_State.Parameter_Error;
                return(api_Result);
            }
            if (value2.IsBlingShip())
            {
                api_Result.state = Api_Result_State.Parameter_Error;
                return(api_Result);
            }
            Dictionary <enumMaterialCategory, int> ndockMaterialNum = value2.GetNdockMaterialNum();

            if (ndockMaterialNum == null)
            {
                api_Result.state = Api_Result_State.Parameter_Error;
                return(api_Result);
            }
            int num = highspeed ? 1 : 0;

            if (ndockMaterialNum[enumMaterialCategory.Fuel] > Comm_UserDatas.Instance.User_material[enumMaterialCategory.Fuel].Value || ndockMaterialNum[enumMaterialCategory.Steel] > Comm_UserDatas.Instance.User_material[enumMaterialCategory.Steel].Value || num > Comm_UserDatas.Instance.User_material[enumMaterialCategory.Repair_Kit].Value)
            {
                api_Result.state = Api_Result_State.Parameter_Error;
                return(api_Result);
            }
            value2.BlingWaitToStop();
            if (!highspeed)
            {
                int ndockTimeSpan = value2.GetNdockTimeSpan();
                value.RecoverStart(ship_rid, ndockMaterialNum, ndockTimeSpan);
            }
            else
            {
                value.RecoverStart(ship_rid, ndockMaterialNum, 0);
                value.RecoverEnd(timeChk: false);
                Comm_UserDatas.Instance.User_material[enumMaterialCategory.Repair_Kit].Sub_Material(1);
            }
            api_Result.data = value;
            QuestSupply questSupply = new QuestSupply();

            questSupply.ExecuteCheck();
            return(api_Result);
        }
        public bool IsValidChange(int deck_rid, int deck_targetIdx, int ship_rid)
        {
            Mem_deck deck = null;

            if (!Comm_UserDatas.Instance.User_deck.TryGetValue(deck_rid, ref deck))
            {
                return(false);
            }
            if (deck.MissionState != MissionStates.NONE || deck.IsActionEnd)
            {
                return(false);
            }
            List <int> list = new List <int>();

            if (ship_rid == -2)
            {
                if (deck.Ship.Count() == 0)
                {
                    return(false);
                }
                deck.Ship.Clone(out list);
                list.RemoveAt(0);
            }
            else if (ship_rid == -1)
            {
                list.Add(deck.Ship[deck_targetIdx]);
            }
            else
            {
                list.Add(ship_rid);
                list.Add(deck.Ship[deck_targetIdx]);
                bool flag = Enumerable.Any <Mem_ndock>(Comm_UserDatas.Instance.User_ndock.get_Values(), (Mem_ndock x) => x.Ship_id == ship_rid && x.Area_id != deck.Area_id);
                if (flag)
                {
                    return(false);
                }
            }
            if (Enumerable.Any <Mem_esccort_deck>(Comm_UserDatas.Instance.User_EscortDeck.get_Values(), (Mem_esccort_deck escort) => escort.Ship.Find(ship_rid) != -1))
            {
                return(false);
            }
            if (ship_rid == -2 || (ship_rid == -1 && deck_targetIdx == 0 && deck.Rid == 1))
            {
                return(deck.Ship.Count() > 1);
            }
            if (ship_rid == -1)
            {
                return(deck.Area_id == 1 || deck.Ship.Count() != 1);
            }
            Mem_ship mem_ship = null;

            if (!Comm_UserDatas.Instance.User_ship.TryGetValue(ship_rid, ref mem_ship))
            {
                return(false);
            }
            if (mem_ship.IsBlingShip())
            {
                return(false);
            }
            if (mem_ship.BlingType == Mem_ship.BlingKind.WaitEscort)
            {
                return(false);
            }
            if (mem_ship.BlingType == Mem_ship.BlingKind.WaitDeck && mem_ship.BlingWaitArea != deck.Area_id)
            {
                return(false);
            }
            DeckShips deckShips = null;

            deck.Ship.Clone(out deckShips);
            int[] array = deck.Search_ShipIdx(ship_rid);
            Func <DeckShips, bool> func = delegate(DeckShips x)
            {
                int           num   = x.Count();
                List <string> list2 = new List <string>();
                for (int i = 0; i < num; i++)
                {
                    int ship_id = Comm_UserDatas.Instance.User_ship.get_Item(x[i]).Ship_id;
                    list2.Add(Mst_DataManager.Instance.Mst_ship.get_Item(ship_id).Yomi);
                }
                IEnumerable <IGrouping <string, string> > enumerable = Enumerable.GroupBy <string, string>(list2, (string y) => y);
                return(Enumerable.Count <IGrouping <string, string> >(enumerable) == Enumerable.Count <string>(list2));
            };

            if (array[0] == deck_rid)
            {
                deckShips[array[1]] = deckShips[deck_targetIdx];
            }
            else if (array[0] != -1)
            {
                Mem_deck mem_deck = Comm_UserDatas.Instance.User_deck.get_Item(array[0]);
                if (mem_deck.MissionState != MissionStates.NONE || mem_deck.IsActionEnd)
                {
                    return(false);
                }
                if (mem_deck.Area_id != deck.Area_id)
                {
                    return(false);
                }
                DeckShips deckShips2 = null;
                mem_deck.Ship.Clone(out deckShips2);
                deckShips2[array[1]] = deckShips[deck_targetIdx];
                if (mem_deck.Rid == 1 && deckShips2.Count() == 0)
                {
                    return(false);
                }
                if (deckShips2.Count() == 0 && mem_deck.Area_id != 1)
                {
                    return(false);
                }
                if (!func.Invoke(deckShips2))
                {
                    return(false);
                }
            }
            deckShips[deck_targetIdx] = ship_rid;
            return(func.Invoke(deckShips) && !deckShips.Equals(deck.Ship));
        }
Exemple #6
0
        public bool IsValidChange(int deck_rid, int deck_targetIdx, int ship_rid, DeckShips deckShip)
        {
            initEscortGroup();
            Mem_esccort_deck value = null;

            if (!Comm_UserDatas.Instance.User_EscortDeck.TryGetValue(deck_rid, out value))
            {
                return(false);
            }
            List <int> unsetShips = null;

            if (ship_rid == -2)
            {
                if (deckShip.Count() <= 1)
                {
                    return(false);
                }
                deckShip.Clone(out unsetShips);
                unsetShips.RemoveAt(0);
            }
            else if (ship_rid == -1)
            {
                unsetShips = new List <int>
                {
                    deckShip[deck_targetIdx]
                };
            }
            else
            {
                if (ship_rid == deckShip[deck_targetIdx])
                {
                    return(false);
                }
                int stype = Comm_UserDatas.Instance.User_ship[ship_rid].Stype;
                if (Mst_DataManager.Instance.Mst_stype[stype].IsSubmarine())
                {
                    return(false);
                }
                unsetShips = new List <int>
                {
                    ship_rid
                };
            }
            DeckShips out_ships = null;

            deckShip.Clone(out out_ships);
            Change_TempDeck(deck_targetIdx, ship_rid, ref out_ships);
            if (!validEscortStypeCheck(out_ships, -1))
            {
                return(false);
            }
            Mem_ndock mem_ndock = Comm_UserDatas.Instance.User_ndock.Values.FirstOrDefault((Mem_ndock x) => unsetShips.Contains(x.Ship_id) ? true : false);

            if (mem_ndock != null)
            {
                return(false);
            }
            if (unsetShips.Any(delegate(int bling_rid)
            {
                Mem_ship value3 = null;
                return(Comm_UserDatas.Instance.User_ship.TryGetValue(bling_rid, out value3) && value3.IsBlingShip());
            }))
            {
                return(false);
            }
            if (ship_rid < 0)
            {
                return(true);
            }
            if (Comm_UserDatas.Instance.User_deck.Values.Any((Mem_deck x) => x.Ship.Find(ship_rid) != -1))
            {
                return(false);
            }
            if (Comm_UserDatas.Instance.User_EscortDeck.Values.Any((Mem_esccort_deck x) => x.Rid != deck_rid && x.Ship.Find(ship_rid) != -1))
            {
                return(false);
            }
            Func <DeckShips, bool> func = delegate(DeckShips x)
            {
                int           num  = x.Count();
                List <string> list = new List <string>();
                for (int i = 0; i < num; i++)
                {
                    int ship_id = Comm_UserDatas.Instance.User_ship[x[i]].Ship_id;
                    list.Add(Mst_DataManager.Instance.Mst_ship[ship_id].Yomi);
                }
                IEnumerable <IGrouping <string, string> > source = from y in list
                                                                   group y by y;
                return((source.Count() == list.Count()) ? true : false);
            };
            Mem_ship value2 = null;

            if (!Comm_UserDatas.Instance.User_ship.TryGetValue(ship_rid, out value2))
            {
                return(false);
            }
            if (value2.IsBlingShip())
            {
                return(false);
            }
            if (value2.BlingType == Mem_ship.BlingKind.WaitDeck)
            {
                return(false);
            }
            if (value2.BlingType == Mem_ship.BlingKind.WaitEscort && value2.BlingWaitArea != value.Maparea_id)
            {
                return(false);
            }
            if (deckShip.Equals(out_ships))
            {
                return(false);
            }
            if (!func(out_ships))
            {
                return(false);
            }
            return(true);
        }
Exemple #7
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);
        }
Exemple #8
0
        public Api_req_Kaisou.RemodelingChkResult ValidRemodeling(int ship_rid, out int reqDrawingNum)
        {
            Mem_ship mem_ship = null;

            reqDrawingNum = 0;
            if (!Comm_UserDatas.Instance.User_ship.TryGetValue(ship_rid, ref mem_ship))
            {
                return(Api_req_Kaisou.RemodelingChkResult.Invalid);
            }
            Mem_deck mem_deck = Enumerable.FirstOrDefault <Mem_deck>(Comm_UserDatas.Instance.User_deck.get_Values(), (Mem_deck x) => x.Ship.Find(ship_rid) != -1);

            if (mem_deck != null)
            {
                if (mem_deck.MissionState != MissionStates.NONE)
                {
                    return(Api_req_Kaisou.RemodelingChkResult.Mission);
                }
                if (mem_deck.IsActionEnd)
                {
                    return(Api_req_Kaisou.RemodelingChkResult.ActionEndDeck);
                }
            }
            if (Enumerable.Any <Mem_ndock>(Comm_UserDatas.Instance.User_ndock.get_Values(), (Mem_ndock x) => x.Ship_id == ship_rid))
            {
                return(Api_req_Kaisou.RemodelingChkResult.Repair);
            }
            Mst_ship mst_ship = Mst_DataManager.Instance.Mst_ship.get_Item(mem_ship.Ship_id);

            if (mst_ship.Aftershipid <= 0)
            {
                return(Api_req_Kaisou.RemodelingChkResult.Invalid);
            }
            if (mem_ship.Level < mst_ship.Afterlv)
            {
                return(Api_req_Kaisou.RemodelingChkResult.Level);
            }
            if (mem_ship.IsBlingShip())
            {
                return(Api_req_Kaisou.RemodelingChkResult.BlingShip);
            }
            Mst_shipupgrade mst_shipupgrade = null;

            if (Mst_DataManager.Instance.Mst_upgrade.TryGetValue(mst_ship.Aftershipid, ref mst_shipupgrade))
            {
                reqDrawingNum = mst_shipupgrade.Drawing_count;
            }
            if (mem_ship.Ship_id == 466 || mem_ship.Ship_id == 467)
            {
                reqDrawingNum = 0;
            }
            if (reqDrawingNum > 0)
            {
                Mem_useitem mem_useitem = null;
                if (!Comm_UserDatas.Instance.User_useItem.TryGetValue(58, ref mem_useitem))
                {
                    return(Api_req_Kaisou.RemodelingChkResult.Drawing);
                }
                if (mem_useitem.Value < reqDrawingNum)
                {
                    return(Api_req_Kaisou.RemodelingChkResult.Drawing);
                }
            }
            if (Comm_UserDatas.Instance.User_material.get_Item(enumMaterialCategory.Steel).Value < mst_ship.Afterfuel)
            {
                return(Api_req_Kaisou.RemodelingChkResult.Steel);
            }
            if (Comm_UserDatas.Instance.User_material.get_Item(enumMaterialCategory.Bull).Value < mst_ship.Afterbull)
            {
                return(Api_req_Kaisou.RemodelingChkResult.Bull);
            }
            int remodelDevKitNum = mst_ship.GetRemodelDevKitNum();

            if (Comm_UserDatas.Instance.User_material.get_Item(enumMaterialCategory.Dev_Kit).Value < remodelDevKitNum)
            {
                return(Api_req_Kaisou.RemodelingChkResult.Invalid);
            }
            return(Api_req_Kaisou.RemodelingChkResult.OK);
        }
Exemple #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);
                                }
                            }
                        }
                    }
                }
            }
        }
        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);
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
Exemple #12
0
 public bool IsBling()
 {
     return(_mem_data.IsBlingShip());
 }
Exemple #13
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);
        }
Exemple #14
0
        public RemodelingChkResult ValidRemodeling(int ship_rid, out int reqDrawingNum)
        {
            Mem_ship value = null;

            reqDrawingNum = 0;
            if (!Comm_UserDatas.Instance.User_ship.TryGetValue(ship_rid, out value))
            {
                return(RemodelingChkResult.Invalid);
            }
            Mem_deck mem_deck = Comm_UserDatas.Instance.User_deck.Values.FirstOrDefault((Mem_deck x) => (x.Ship.Find(ship_rid) != -1) ? true : false);

            if (mem_deck != null)
            {
                if (mem_deck.MissionState != 0)
                {
                    return(RemodelingChkResult.Mission);
                }
                if (mem_deck.IsActionEnd)
                {
                    return(RemodelingChkResult.ActionEndDeck);
                }
            }
            if (Comm_UserDatas.Instance.User_ndock.Values.Any((Mem_ndock x) => x.Ship_id == ship_rid))
            {
                return(RemodelingChkResult.Repair);
            }
            Mst_ship mst_ship = Mst_DataManager.Instance.Mst_ship[value.Ship_id];

            if (mst_ship.Aftershipid <= 0)
            {
                return(RemodelingChkResult.Invalid);
            }
            if (value.Level < mst_ship.Afterlv)
            {
                return(RemodelingChkResult.Level);
            }
            if (value.IsBlingShip())
            {
                return(RemodelingChkResult.BlingShip);
            }
            Mst_shipupgrade value2 = null;

            if (Mst_DataManager.Instance.Mst_upgrade.TryGetValue(mst_ship.Aftershipid, out value2))
            {
                reqDrawingNum = value2.Drawing_count;
            }
            if (value.Ship_id == 466 || value.Ship_id == 467)
            {
                reqDrawingNum = 0;
            }
            if (reqDrawingNum > 0)
            {
                Mem_useitem value3 = null;
                if (!Comm_UserDatas.Instance.User_useItem.TryGetValue(58, out value3))
                {
                    return(RemodelingChkResult.Drawing);
                }
                if (value3.Value < reqDrawingNum)
                {
                    return(RemodelingChkResult.Drawing);
                }
            }
            if (Comm_UserDatas.Instance.User_material[enumMaterialCategory.Steel].Value < mst_ship.Afterfuel)
            {
                return(RemodelingChkResult.Steel);
            }
            if (Comm_UserDatas.Instance.User_material[enumMaterialCategory.Bull].Value < mst_ship.Afterbull)
            {
                return(RemodelingChkResult.Bull);
            }
            int remodelDevKitNum = mst_ship.GetRemodelDevKitNum();

            if (Comm_UserDatas.Instance.User_material[enumMaterialCategory.Dev_Kit].Value < remodelDevKitNum)
            {
                return(RemodelingChkResult.Invalid);
            }
            return(RemodelingChkResult.OK);
        }
Exemple #15
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);
        }