示例#1
0
        private TurnWorkResult ExecTurnEndWork()
        {
            TurnWorkResult turnWorkResult = new TurnWorkResult();

            turnWorkResult.ChangeState = TurnState.TURN_START;
            turnInstance.AddTurn(this);
            if (turnInstance.GetDateTime().Day == 1)
            {
                new Api_req_Quest(this).EnforceQuestReset();
            }
            if (Utils.IsTurnOver())
            {
                Mem_history mem_history = new Mem_history();
                mem_history.SetGameOverToTurn(turnInstance.Total_turn);
                Comm_UserDatas.Instance.Add_History(mem_history);
            }
            foreach (Mem_ship value in Comm_UserDatas.Instance.User_ship.Values)
            {
                value.BlingWaitToStart();
                value.PurgeLovTouchData();
            }
            Comm_UserDatas.Instance.UpdateEscortShipLocale();
            Comm_UserDatas.Instance.UpdateDeckShipLocale();
            List <Mem_deck> list = Comm_UserDatas.Instance.User_deck.Values.ToList();

            list.ForEach(delegate(Mem_deck x)
            {
                x.ActionStart();
            });
            List <Mst_radingtype> types        = Mst_DataManager.Instance.Mst_RadingType[(int)basicInstance.Difficult];
            Mst_radingtype        radingRecord = Mst_radingtype.GetRadingRecord(types, turnInstance.Total_turn);

            new HashSet <int>();
            if (radingRecord != null)
            {
                double randDouble = Utils.GetRandDouble(1.0, 100.0, 1.0, 1);
                if ((double)radingRecord.Rading_rate >= randDouble)
                {
                    IEnumerable <IGrouping <int, Mem_tanker> > areaEnableTanker = Mem_tanker.GetAreaEnableTanker(Comm_UserDatas.Instance.User_tanker);
                    Dictionary <int, RadingKind> radingArea = getRadingArea(areaEnableTanker, radingRecord.Rading_type);
                    if (radingArea.Count > 0)
                    {
                        Dictionary <int, List <Mem_tanker> > tankers = areaEnableTanker.ToDictionary((IGrouping <int, Mem_tanker> x) => x.Key, (IGrouping <int, Mem_tanker> y) => y.ToList());
                        turnWorkResult.RadingResult = getRadingResult(radingRecord.Rading_type, radingArea, tankers);
                    }
                }
            }
            updateRadingEscortShipExp(turnWorkResult.RadingResult);
            if (basicInstance.Difficult == DifficultKind.KOU || basicInstance.Difficult == DifficultKind.SHI)
            {
                addRebellionPoint();
                selectRegistanceArea();
            }
            else
            {
                selectRegistanceArea();
                addRebellionPoint();
            }
            return(turnWorkResult);
        }
示例#2
0
        private void TakeMaterial(ref Dictionary <enumMaterialCategory, int> add_mat, ref Dictionary <enumMaterialCategory, int> summaryBase)
        {
            IEnumerable <IGrouping <int, Mem_tanker> > areaEnableTanker = Mem_tanker.GetAreaEnableTanker(Comm_UserDatas.Instance.User_tanker);

            if (areaEnableTanker.Count() != 0)
            {
                foreach (IGrouping <int, Mem_tanker> item in areaEnableTanker)
                {
                    Mst_maparea mst_maparea = Mst_DataManager.Instance.Mst_maparea[item.Key];
                    DeckShips   ship        = Comm_UserDatas.Instance.User_EscortDeck[item.Key].Ship;
                    mst_maparea.TakeMaterialNum(Comm_UserDatas.Instance.User_mapclear, item.Count(), ref add_mat, randMaxFlag: false, ship);
                    mst_maparea.TakeMaterialNum(Comm_UserDatas.Instance.User_mapclear, item.Count(), ref summaryBase, randMaxFlag: true, ship);
                }
                int materialMaxNum = Comm_UserDatas.Instance.User_basic.GetMaterialMaxNum();
                foreach (KeyValuePair <enumMaterialCategory, int> item2 in add_mat)
                {
                    int num  = 0;
                    int num2 = Comm_UserDatas.Instance.User_material[item2.Key].Value + item2.Value;
                    int num3 = materialMaxNum - num2;
                    if (num3 >= 0)
                    {
                        num = item2.Value;
                    }
                    else if (materialMaxNum > Comm_UserDatas.Instance.User_material[item2.Key].Value)
                    {
                        num = materialMaxNum - Comm_UserDatas.Instance.User_material[item2.Key].Value;
                    }
                    Comm_UserDatas.Instance.User_material[item2.Key].Add_Material(num);
                }
            }
        }
示例#3
0
        public Api_Result <Mem_deck> Start(int deck_rid, int mission_id, int tankerNum)
        {
            Api_Result <Mem_deck> api_Result = new Api_Result <Mem_deck>();
            Mst_mission2          value      = null;

            if (mission_id > 0)
            {
                if (!Mst_DataManager.Instance.Mst_mission.TryGetValue(mission_id, out value))
                {
                    api_Result.state = Api_Result_State.Parameter_Error;
                    return(api_Result);
                }
            }
            else
            {
                List <Mst_mission2> supportResistedData = Mst_DataManager.Instance.GetSupportResistedData(Comm_UserDatas.Instance.User_deck[deck_rid].Area_id);
                value = ((mission_id != -1) ? supportResistedData[1] : supportResistedData[0]);
            }
            Mem_deck value2 = null;

            if (!Comm_UserDatas.Instance.User_deck.TryGetValue(deck_rid, out value2))
            {
                api_Result.state = Api_Result_State.Parameter_Error;
                return(api_Result);
            }
            if (mission_id > 0 && !Comm_UserDatas.Instance.User_missioncomp.ContainsKey(mission_id))
            {
                Mem_missioncomp mem_missioncomp = new Mem_missioncomp(mission_id, value.Maparea_id, MissionClearKinds.NOTCLEAR);
                mem_missioncomp.Insert();
            }
            if (!value2.MissionStart(value))
            {
                api_Result.state = Api_Result_State.Parameter_Error;
                return(api_Result);
            }
            if (tankerNum > 0)
            {
                IEnumerable <Mem_tanker> enumerable = Mem_tanker.GetFreeTanker(Comm_UserDatas.Instance.User_tanker).Take(tankerNum);
                List <Mem_tanker>        list       = new List <Mem_tanker>();
                foreach (Mem_tanker item in enumerable)
                {
                    if (!item.MissionStart(value.Maparea_id, deck_rid))
                    {
                        list.ForEach(delegate(Mem_tanker x)
                        {
                            x.MissionTerm();
                        });
                        api_Result.state = Api_Result_State.Parameter_Error;
                        return(api_Result);
                    }
                    list.Add(item);
                }
            }
            api_Result.data = value2;
            QuestMission questMission = new QuestMission(value.Id, value2, MissionResultKinds.FAILE);

            questMission.ExecuteCheck();
            return(api_Result);
        }
        public List <int> Add_Tanker(int num)
        {
            List <int> list = new List <int>();

            for (int i = 0; i < num; i++)
            {
                int        newRid     = this.getNewRid(Enumerable.ToList <int>(this.User_tanker.get_Keys()));
                Mem_tanker mem_tanker = new Mem_tanker(newRid);
                this.User_tanker.Add(newRid, mem_tanker);
                list.Add(newRid);
            }
            return(list);
        }
示例#5
0
        public List <int> Add_Tanker(int num)
        {
            List <int> list = new List <int>();

            for (int i = 0; i < num; i++)
            {
                int        newRid = getNewRid(User_tanker.Keys.ToList());
                Mem_tanker value  = new Mem_tanker(newRid);
                User_tanker.Add(newRid, value);
                list.Add(newRid);
            }
            return(list);
        }
示例#6
0
        public void LostArea(int maparea_id, List <int> sortieDeckRid)
        {
            Comm_UserDatas commInstance = Comm_UserDatas.Instance;

            if (sortieDeckRid == null)
            {
                sortieDeckRid = new List <int>();
            }
            List <int> lostArea = getLostArea(maparea_id);

            lostArea.ForEach(delegate(int lostAreaId)
            {
                Dictionary <int, Mem_mapclear> dictionary = (from x in commInstance.User_mapclear.Values
                                                             where x.Maparea_id == lostAreaId
                                                             select x).ToDictionary((Mem_mapclear x) => x.Mapinfo_no, (Mem_mapclear y) => y);
                int num = Mst_maparea.MaxMapNum(commInstance.User_basic.Difficult, lostAreaId);
                for (int i = 1; i <= num; i++)
                {
                    if (!dictionary.ContainsKey(i))
                    {
                        int mapinfo_id            = Mst_mapinfo.ConvertMapInfoId(lostAreaId, i);
                        Mem_mapclear mem_mapclear = new Mem_mapclear(mapinfo_id, lostAreaId, i, MapClearState.InvationClose);
                        mem_mapclear.Insert();
                        dictionary.Add(i, mem_mapclear);
                    }
                }
                lostMapClear(dictionary.Values.ToList(), Mst_DataManager.Instance.Mst_maparea[lostAreaId].Neighboring_area);
                Comm_UserDatas.Instance.User_rebellion_point.Remove(lostAreaId);
                List <Mem_tanker> areaTanker = Mem_tanker.GetAreaTanker(lostAreaId);
                lostTanker(areaTanker);
                IEnumerable <Mem_deck> memDeck = from x in commInstance.User_deck.Values
                                                 where x.Area_id == lostAreaId
                                                 select x;
                goBackDeck(memDeck, sortieDeckRid);
                Mem_esccort_deck escort = commInstance.User_EscortDeck[lostAreaId];
                goBackEscortDeck(escort);
                List <Mem_ndock> ndock = (from x in commInstance.User_ndock.Values
                                          where x.Area_id == lostAreaId
                                          select x).ToList();
                lostNdock(ndock);
                Dictionary <enumMaterialCategory, Mem_material> user_material = commInstance.User_material;
                lostMaterial(user_material);
                if (lostAreaId == 1)
                {
                    lostKdock();
                }
            });
        }
 private void lostTanker(List <Mem_tanker> tanker)
 {
     using (List <Mem_tanker> .Enumerator enumerator = tanker.GetEnumerator())
     {
         while (enumerator.MoveNext())
         {
             Mem_tanker current = enumerator.get_Current();
             if (!current.IsBlingShip())
             {
                 Comm_UserDatas.Instance.User_tanker.Remove(current.Rid);
             }
             else
             {
                 current.BackTanker();
             }
         }
     }
 }
示例#8
0
        public Api_Result <List <Mem_tanker> > GoTanker(int area_id, int num)
        {
            Api_Result <List <Mem_tanker> > api_Result = new Api_Result <List <Mem_tanker> >();
            List <Mem_tanker> freeTanker = Mem_tanker.GetFreeTanker(Comm_UserDatas.Instance.User_tanker);

            if (freeTanker.Count() < num)
            {
                api_Result.state = Api_Result_State.Parameter_Error;
                return(api_Result);
            }
            IEnumerable <Mem_tanker> enumerable = freeTanker.Take(num);

            foreach (Mem_tanker item in enumerable)
            {
                item.GoArea(area_id);
            }
            api_Result.data = enumerable.ToList();
            return(api_Result);
        }
        private void TakeMaterial(ref Dictionary <enumMaterialCategory, int> add_mat, ref Dictionary <enumMaterialCategory, int> summaryBase)
        {
            IEnumerable <IGrouping <int, Mem_tanker> > areaEnableTanker = Mem_tanker.GetAreaEnableTanker(Comm_UserDatas.Instance.User_tanker);

            if (Enumerable.Count <IGrouping <int, Mem_tanker> >(areaEnableTanker) == 0)
            {
                return;
            }
            using (IEnumerator <IGrouping <int, Mem_tanker> > enumerator = areaEnableTanker.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    IGrouping <int, Mem_tanker> current = enumerator.get_Current();
                    Mst_maparea mst_maparea             = Mst_DataManager.Instance.Mst_maparea.get_Item(current.get_Key());
                    DeckShips   ship = Comm_UserDatas.Instance.User_EscortDeck.get_Item(current.get_Key()).Ship;
                    mst_maparea.TakeMaterialNum(Comm_UserDatas.Instance.User_mapclear, Enumerable.Count <Mem_tanker>(current), ref add_mat, false, ship);
                    mst_maparea.TakeMaterialNum(Comm_UserDatas.Instance.User_mapclear, Enumerable.Count <Mem_tanker>(current), ref summaryBase, true, ship);
                }
            }
            int materialMaxNum = Comm_UserDatas.Instance.User_basic.GetMaterialMaxNum();

            using (Dictionary <enumMaterialCategory, int> .Enumerator enumerator2 = add_mat.GetEnumerator())
            {
                while (enumerator2.MoveNext())
                {
                    KeyValuePair <enumMaterialCategory, int> current2 = enumerator2.get_Current();
                    int num  = 0;
                    int num2 = Comm_UserDatas.Instance.User_material.get_Item(current2.get_Key()).Value + current2.get_Value();
                    int num3 = materialMaxNum - num2;
                    if (num3 >= 0)
                    {
                        num = current2.get_Value();
                    }
                    else if (materialMaxNum > Comm_UserDatas.Instance.User_material.get_Item(current2.get_Key()).Value)
                    {
                        num = materialMaxNum - Comm_UserDatas.Instance.User_material.get_Item(current2.get_Key()).Value;
                    }
                    Comm_UserDatas.Instance.User_material.get_Item(current2.get_Key()).Add_Material(num);
                }
            }
        }
        private void initTanker()
        {
            if (this.User_tanker == null)
            {
                this.User_tanker = new Dictionary <int, Mem_tanker>();
            }
            else
            {
                this.User_tanker.Clear();
            }
            List <int> list = this.Add_Tanker(4);

            using (Dictionary <int, Mem_tanker> .ValueCollection.Enumerator enumerator = this.User_tanker.get_Values().GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    Mem_tanker current = enumerator.get_Current();
                    current.GoArea(1);
                }
            }
            this.Add_Tanker(2);
        }
示例#11
0
        public Api_Result <List <Mem_tanker> > GoTanker(int area_id, int num)
        {
            Api_Result <List <Mem_tanker> > api_Result = new Api_Result <List <Mem_tanker> >();
            List <Mem_tanker> freeTanker = Mem_tanker.GetFreeTanker(Comm_UserDatas.Instance.User_tanker);

            if (Enumerable.Count <Mem_tanker>(freeTanker) < num)
            {
                api_Result.state = Api_Result_State.Parameter_Error;
                return(api_Result);
            }
            IEnumerable <Mem_tanker> enumerable = Enumerable.Take <Mem_tanker>(freeTanker, num);

            using (IEnumerator <Mem_tanker> enumerator = enumerable.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    Mem_tanker current = enumerator.get_Current();
                    current.GoArea(area_id);
                }
            }
            api_Result.data = Enumerable.ToList <Mem_tanker>(enumerable);
            return(api_Result);
        }
示例#12
0
        public Api_Result <List <Mem_tanker> > BackTanker(int area_id, int num)
        {
            Api_Result <List <Mem_tanker> > api_Result = new Api_Result <List <Mem_tanker> >();
            List <Mem_tanker> enableBackTanker         = this.GetEnableBackTanker(area_id);

            if (Enumerable.Count <Mem_tanker>(enableBackTanker) < num)
            {
                api_Result.state = Api_Result_State.Parameter_Error;
                return(api_Result);
            }
            IEnumerable <Mem_tanker> enumerable = Enumerable.Take <Mem_tanker>(enableBackTanker, num);

            using (IEnumerator <Mem_tanker> enumerator = enumerable.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    Mem_tanker current = enumerator.get_Current();
                    current.BackTanker();
                }
            }
            api_Result.data = Enumerable.ToList <Mem_tanker>(enumerable);
            return(api_Result);
        }
        public Api_Result <Mem_deck> Start(int deck_rid, int mission_id, int tankerNum)
        {
            Api_Result <Mem_deck> api_Result  = new Api_Result <Mem_deck>();
            Mst_mission2          mst_mission = null;

            if (mission_id > 0)
            {
                if (!Mst_DataManager.Instance.Mst_mission.TryGetValue(mission_id, ref mst_mission))
                {
                    api_Result.state = Api_Result_State.Parameter_Error;
                    return(api_Result);
                }
            }
            else
            {
                List <Mst_mission2> supportResistedData = Mst_DataManager.Instance.GetSupportResistedData(Comm_UserDatas.Instance.User_deck.get_Item(deck_rid).Area_id);
                mst_mission = ((mission_id != -1) ? supportResistedData.get_Item(1) : supportResistedData.get_Item(0));
            }
            Mem_deck mem_deck = null;

            if (!Comm_UserDatas.Instance.User_deck.TryGetValue(deck_rid, ref mem_deck))
            {
                api_Result.state = Api_Result_State.Parameter_Error;
                return(api_Result);
            }
            if (mission_id > 0 && !Comm_UserDatas.Instance.User_missioncomp.ContainsKey(mission_id))
            {
                Mem_missioncomp mem_missioncomp = new Mem_missioncomp(mission_id, mst_mission.Maparea_id, MissionClearKinds.NOTCLEAR);
                mem_missioncomp.Insert();
            }
            if (!mem_deck.MissionStart(mst_mission))
            {
                api_Result.state = Api_Result_State.Parameter_Error;
                return(api_Result);
            }
            if (tankerNum > 0)
            {
                IEnumerable <Mem_tanker> enumerable = Enumerable.Take <Mem_tanker>(Mem_tanker.GetFreeTanker(Comm_UserDatas.Instance.User_tanker), tankerNum);
                List <Mem_tanker>        list       = new List <Mem_tanker>();
                using (IEnumerator <Mem_tanker> enumerator = enumerable.GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        Mem_tanker current = enumerator.get_Current();
                        if (!current.MissionStart(mst_mission.Maparea_id, deck_rid))
                        {
                            list.ForEach(delegate(Mem_tanker x)
                            {
                                x.MissionTerm();
                            });
                            api_Result.state = Api_Result_State.Parameter_Error;
                            return(api_Result);
                        }
                        list.Add(current);
                    }
                }
            }
            api_Result.data = mem_deck;
            QuestMission questMission = new QuestMission(mst_mission.Id, mem_deck, MissionResultKinds.FAILE);

            questMission.ExecuteCheck();
            return(api_Result);
        }
        public bool SetUserData()
        {
            XElement elements = VitaSaveManager.Instance.Elements;

            if (elements == null)
            {
                return(false);
            }
            Mem_basic        user_basic        = Model_Base.SetUserData <Mem_basic>(Enumerable.First <XElement>(elements.Elements(Mem_basic.tableName)));
            Mem_record       user_record       = Model_Base.SetUserData <Mem_record>(Enumerable.First <XElement>(elements.Elements(Mem_record.tableName)));
            Mem_turn         user_turn         = Model_Base.SetUserData <Mem_turn>(Enumerable.First <XElement>(elements.Elements(Mem_turn.tableName)));
            Mem_deckpractice user_deckpractice = Model_Base.SetUserData <Mem_deckpractice>(Enumerable.First <XElement>(elements.Elements(Mem_deckpractice.tableName)));
            XElement         xElement          = Enumerable.FirstOrDefault <XElement>(elements.Elements(Mem_trophy.tableName));
            Mem_trophy       user_trophy;

            if (xElement == null)
            {
                user_trophy = new Mem_trophy();
            }
            else
            {
                user_trophy = Model_Base.SetUserData <Mem_trophy>(xElement);
            }
            XElement         xElement2 = Enumerable.FirstOrDefault <XElement>(elements.Elements(Mem_newgame_plus.tableName));
            Mem_newgame_plus user_plus;

            if (xElement2 == null)
            {
                user_plus = new Mem_newgame_plus();
            }
            else
            {
                user_plus = Model_Base.SetUserData <Mem_newgame_plus>(xElement2);
            }
            this.User_basic        = null;
            this.User_basic        = user_basic;
            this.User_record       = null;
            this.User_record       = user_record;
            this.User_turn         = null;
            this.User_turn         = user_turn;
            this.User_deckpractice = null;
            this.User_deckpractice = user_deckpractice;
            this.User_trophy       = user_trophy;
            this.User_plus         = user_plus;
            Dictionary <int, Mem_book>         dictionary  = new Dictionary <int, Mem_book>();
            Dictionary <int, Mem_book>         dictionary2 = new Dictionary <int, Mem_book>();
            Dictionary <int, Mem_deck>         dictionary3 = new Dictionary <int, Mem_deck>();
            Dictionary <int, Mem_esccort_deck> dictionary4 = new Dictionary <int, Mem_esccort_deck>();
            Dictionary <int, Mem_furniture>    dictionary5 = new Dictionary <int, Mem_furniture>();
            Dictionary <int, Mem_kdock>        dictionary6 = new Dictionary <int, Mem_kdock>();
            Dictionary <int, Mem_mapcomp>      dictionary7 = new Dictionary <int, Mem_mapcomp>();
            Dictionary <int, Mem_mapclear>     dictionary8 = new Dictionary <int, Mem_mapclear>();
            Dictionary <enumMaterialCategory, Mem_material> dictionary9 = new Dictionary <enumMaterialCategory, Mem_material>();
            Dictionary <int, Mem_missioncomp>     dictionary10          = new Dictionary <int, Mem_missioncomp>();
            Dictionary <int, Mem_ndock>           dictionary11          = new Dictionary <int, Mem_ndock>();
            Dictionary <int, Mem_quest>           dictionary12          = new Dictionary <int, Mem_quest>();
            Dictionary <int, Mem_questcount>      dictionary13          = new Dictionary <int, Mem_questcount>();
            Dictionary <int, Mem_ship>            dictionary14          = new Dictionary <int, Mem_ship>();
            Dictionary <int, Mem_slotitem>        dictionary15          = new Dictionary <int, Mem_slotitem>();
            Dictionary <int, Mem_tanker>          dictionary16          = new Dictionary <int, Mem_tanker>();
            Dictionary <int, Mem_useitem>         dictionary17          = new Dictionary <int, Mem_useitem>();
            Dictionary <int, Mem_rebellion_point> dictionary18          = new Dictionary <int, Mem_rebellion_point>();
            Dictionary <int, Mem_room>            dictionary19          = new Dictionary <int, Mem_room>();
            HashSet <int>      hashSet  = new HashSet <int>();
            HashSet <int>      hashSet2 = new HashSet <int>();
            List <Mem_history> list     = new List <Mem_history>();

            using (IEnumerator <XElement> enumerator = Extensions.Elements <XElement>(elements.Elements("ship_books"), "mem_book").GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    XElement current  = enumerator.get_Current();
                    Mem_book mem_book = Model_Base.SetUserData <Mem_book>(current);
                    dictionary.Add(mem_book.Table_id, mem_book);
                }
            }
            this.Ship_book.Clear();
            this.Ship_book = dictionary;
            using (IEnumerator <XElement> enumerator2 = Extensions.Elements <XElement>(elements.Elements("slot_books"), "mem_book").GetEnumerator())
            {
                while (enumerator2.MoveNext())
                {
                    XElement current2  = enumerator2.get_Current();
                    Mem_book mem_book2 = Model_Base.SetUserData <Mem_book>(current2);
                    dictionary2.Add(mem_book2.Table_id, mem_book2);
                }
            }
            this.Slot_book.Clear();
            this.Slot_book = dictionary2;
            using (IEnumerator <XElement> enumerator3 = Extensions.Elements <XElement>(elements.Elements(Mem_deck.tableName + "s"), Mem_deck.tableName).GetEnumerator())
            {
                while (enumerator3.MoveNext())
                {
                    XElement current3 = enumerator3.get_Current();
                    Mem_deck mem_deck = Model_Base.SetUserData <Mem_deck>(current3);
                    dictionary3.Add(mem_deck.Rid, mem_deck);
                }
            }
            this.User_deck.Clear();
            this.User_deck = dictionary3;
            using (IEnumerator <XElement> enumerator4 = Extensions.Elements <XElement>(elements.Elements(Mem_esccort_deck.tableName + "s"), Mem_esccort_deck.tableName).GetEnumerator())
            {
                while (enumerator4.MoveNext())
                {
                    XElement         current4         = enumerator4.get_Current();
                    Mem_esccort_deck mem_esccort_deck = Model_Base.SetUserData <Mem_esccort_deck>(current4);
                    dictionary4.Add(mem_esccort_deck.Rid, mem_esccort_deck);
                }
            }
            this.User_EscortDeck.Clear();
            this.User_EscortDeck = dictionary4;
            using (IEnumerator <XElement> enumerator5 = Extensions.Elements <XElement>(elements.Elements(Mem_furniture.tableName + "s"), Mem_furniture.tableName).GetEnumerator())
            {
                while (enumerator5.MoveNext())
                {
                    XElement      current5      = enumerator5.get_Current();
                    Mem_furniture mem_furniture = Model_Base.SetUserData <Mem_furniture>(current5);
                    dictionary5.Add(mem_furniture.Rid, mem_furniture);
                }
            }
            this.User_furniture.Clear();
            this.User_furniture = dictionary5;
            using (IEnumerator <XElement> enumerator6 = Extensions.Elements <XElement>(elements.Elements(Mem_kdock.tableName + "s"), Mem_kdock.tableName).GetEnumerator())
            {
                while (enumerator6.MoveNext())
                {
                    XElement  current6  = enumerator6.get_Current();
                    Mem_kdock mem_kdock = Model_Base.SetUserData <Mem_kdock>(current6);
                    dictionary6.Add(mem_kdock.Rid, mem_kdock);
                }
            }
            this.User_kdock.Clear();
            this.User_kdock = dictionary6;
            using (IEnumerator <XElement> enumerator7 = Extensions.Elements <XElement>(elements.Elements(Mem_mapcomp.tableName + "s"), Mem_mapcomp.tableName).GetEnumerator())
            {
                while (enumerator7.MoveNext())
                {
                    XElement    current7    = enumerator7.get_Current();
                    Mem_mapcomp mem_mapcomp = Model_Base.SetUserData <Mem_mapcomp>(current7);
                    dictionary7.Add(mem_mapcomp.Rid, mem_mapcomp);
                }
            }
            this.User_mapcomp.Clear();
            this.User_mapcomp = dictionary7;
            using (IEnumerator <XElement> enumerator8 = Extensions.Elements <XElement>(elements.Elements(Mem_mapclear.tableName + "s"), Mem_mapclear.tableName).GetEnumerator())
            {
                while (enumerator8.MoveNext())
                {
                    XElement     current8     = enumerator8.get_Current();
                    Mem_mapclear mem_mapclear = Model_Base.SetUserData <Mem_mapclear>(current8);
                    dictionary8.Add(mem_mapclear.Rid, mem_mapclear);
                }
            }
            this.User_mapclear.Clear();
            this.User_mapclear = dictionary8;
            using (IEnumerator <XElement> enumerator9 = Extensions.Elements <XElement>(elements.Elements(Mem_material.tableName + "s"), Mem_material.tableName).GetEnumerator())
            {
                while (enumerator9.MoveNext())
                {
                    XElement     current9     = enumerator9.get_Current();
                    Mem_material mem_material = Model_Base.SetUserData <Mem_material>(current9);
                    dictionary9.Add(mem_material.Rid, mem_material);
                }
            }
            this.User_material.Clear();
            this.User_material = dictionary9;
            using (IEnumerator <XElement> enumerator10 = Extensions.Elements <XElement>(elements.Elements(Mem_missioncomp.tableName + "s"), Mem_missioncomp.tableName).GetEnumerator())
            {
                while (enumerator10.MoveNext())
                {
                    XElement        current10       = enumerator10.get_Current();
                    Mem_missioncomp mem_missioncomp = Model_Base.SetUserData <Mem_missioncomp>(current10);
                    dictionary10.Add(mem_missioncomp.Rid, mem_missioncomp);
                }
            }
            this.User_missioncomp.Clear();
            this.User_missioncomp = dictionary10;
            using (IEnumerator <XElement> enumerator11 = Extensions.Elements <XElement>(elements.Elements(Mem_ndock.tableName + "s"), Mem_ndock.tableName).GetEnumerator())
            {
                while (enumerator11.MoveNext())
                {
                    XElement  current11 = enumerator11.get_Current();
                    Mem_ndock mem_ndock = Model_Base.SetUserData <Mem_ndock>(current11);
                    dictionary11.Add(mem_ndock.Rid, mem_ndock);
                }
            }
            this.User_ndock.Clear();
            this.User_ndock = dictionary11;
            using (IEnumerator <XElement> enumerator12 = Extensions.Elements <XElement>(elements.Elements(Mem_quest.tableName + "s"), Mem_quest.tableName).GetEnumerator())
            {
                while (enumerator12.MoveNext())
                {
                    XElement  current12 = enumerator12.get_Current();
                    Mem_quest mem_quest = Model_Base.SetUserData <Mem_quest>(current12);
                    dictionary12.Add(mem_quest.Rid, mem_quest);
                }
            }
            this.User_quest.Clear();
            this.User_quest = dictionary12;
            using (IEnumerator <XElement> enumerator13 = Extensions.Elements <XElement>(elements.Elements(Mem_questcount.tableName + "s"), Mem_questcount.tableName).GetEnumerator())
            {
                while (enumerator13.MoveNext())
                {
                    XElement       current13      = enumerator13.get_Current();
                    Mem_questcount mem_questcount = Model_Base.SetUserData <Mem_questcount>(current13);
                    dictionary13.Add(mem_questcount.Rid, mem_questcount);
                }
            }
            this.User_questcount.Clear();
            this.User_questcount = dictionary13;
            using (IEnumerator <XElement> enumerator14 = Extensions.Elements <XElement>(elements.Elements(Mem_slotitem.tableName + "s"), Mem_slotitem.tableName).GetEnumerator())
            {
                while (enumerator14.MoveNext())
                {
                    XElement     current14    = enumerator14.get_Current();
                    Mem_slotitem mem_slotitem = Model_Base.SetUserData <Mem_slotitem>(current14);
                    dictionary15.Add(mem_slotitem.Rid, mem_slotitem);
                }
            }
            this.User_slot.Clear();
            this.User_slot = dictionary15;
            using (IEnumerator <XElement> enumerator15 = Extensions.Elements <XElement>(elements.Elements(Mem_ship.tableName + "s"), Mem_ship.tableName).GetEnumerator())
            {
                while (enumerator15.MoveNext())
                {
                    XElement current15 = enumerator15.get_Current();
                    Mem_ship mem_ship  = Model_Base.SetUserData <Mem_ship>(current15);
                    dictionary14.Add(mem_ship.Rid, mem_ship);
                }
            }
            this.User_ship.Clear();
            this.User_ship = dictionary14;
            using (IEnumerator <XElement> enumerator16 = Extensions.Elements <XElement>(elements.Elements(Mem_tanker.tableName + "s"), Mem_tanker.tableName).GetEnumerator())
            {
                while (enumerator16.MoveNext())
                {
                    XElement   current16  = enumerator16.get_Current();
                    Mem_tanker mem_tanker = Model_Base.SetUserData <Mem_tanker>(current16);
                    dictionary16.Add(mem_tanker.Rid, mem_tanker);
                }
            }
            this.User_tanker.Clear();
            this.User_tanker = dictionary16;
            using (IEnumerator <XElement> enumerator17 = Extensions.Elements <XElement>(elements.Elements(Mem_useitem.tableName + "s"), Mem_useitem.tableName).GetEnumerator())
            {
                while (enumerator17.MoveNext())
                {
                    XElement    current17   = enumerator17.get_Current();
                    Mem_useitem mem_useitem = Model_Base.SetUserData <Mem_useitem>(current17);
                    dictionary17.Add(mem_useitem.Rid, mem_useitem);
                }
            }
            this.User_useItem.Clear();
            this.User_useItem = dictionary17;
            using (IEnumerator <XElement> enumerator18 = Extensions.Elements <XElement>(elements.Elements(Mem_rebellion_point.tableName + "s"), Mem_rebellion_point.tableName).GetEnumerator())
            {
                while (enumerator18.MoveNext())
                {
                    XElement            current18           = enumerator18.get_Current();
                    Mem_rebellion_point mem_rebellion_point = Model_Base.SetUserData <Mem_rebellion_point>(current18);
                    dictionary18.Add(mem_rebellion_point.Rid, mem_rebellion_point);
                }
            }
            this.User_rebellion_point.Clear();
            this.User_rebellion_point = dictionary18;
            using (IEnumerator <XElement> enumerator19 = Extensions.Elements <XElement>(elements.Elements(Mem_room.tableName + "s"), Mem_room.tableName).GetEnumerator())
            {
                while (enumerator19.MoveNext())
                {
                    XElement current19 = enumerator19.get_Current();
                    Mem_room mem_room  = Model_Base.SetUserData <Mem_room>(current19);
                    dictionary19.Add(mem_room.Rid, mem_room);
                }
            }
            this.User_room.Clear();
            this.User_room = dictionary19;
            using (IEnumerator <XElement> enumerator20 = elements.Element("temp_escortships").Elements().GetEnumerator())
            {
                while (enumerator20.MoveNext())
                {
                    XElement current20 = enumerator20.get_Current();
                    string   value     = current20.get_Value();
                    hashSet.Add(int.Parse(value));
                }
            }
            this.Temp_escortship.Clear();
            this.Temp_escortship = hashSet;
            using (IEnumerator <XElement> enumerator21 = elements.Element("temp_deckships").Elements().GetEnumerator())
            {
                while (enumerator21.MoveNext())
                {
                    XElement current21 = enumerator21.get_Current();
                    string   value2    = current21.get_Value();
                    hashSet2.Add(int.Parse(value2));
                }
            }
            this.Temp_deckship.Clear();
            this.Temp_deckship = hashSet2;
            using (IEnumerator <XElement> enumerator22 = Extensions.Elements <XElement>(elements.Elements(Mem_history.tableName + "s"), Mem_history.tableName).GetEnumerator())
            {
                while (enumerator22.MoveNext())
                {
                    XElement    current22   = enumerator22.get_Current();
                    Mem_history mem_history = Model_Base.SetUserData <Mem_history>(current22);
                    list.Add(mem_history);
                }
            }
            this.User_history.Clear();
            list.ForEach(delegate(Mem_history x)
            {
                this.Add_History(x);
            });
            return(true);
        }
示例#15
0
        public HashSet <IsGoCondition> ValidStart(int deck_rid, int mission_id, int tankerNum)
        {
            HashSet <IsGoCondition> ret         = new HashSet <IsGoCondition>();
            Mst_mission2            mst_mission = null;

            if (mission_id > 0)
            {
                if (!Mst_DataManager.Instance.Mst_mission.TryGetValue(mission_id, out mst_mission))
                {
                    ret.Add(IsGoCondition.Invalid);
                    return(ret);
                }
            }
            else
            {
                if (mission_id != -1 && mission_id != -2)
                {
                    ret.Add(IsGoCondition.Invalid);
                    return(ret);
                }
                List <Mst_mission2> supportResistedData = Mst_DataManager.Instance.GetSupportResistedData(Comm_UserDatas.Instance.User_deck[deck_rid].Area_id);
                mst_mission = ((mission_id != -1) ? supportResistedData[1] : supportResistedData[0]);
            }
            Mem_deck value = null;

            if (!Comm_UserDatas.Instance.User_deck.TryGetValue(deck_rid, out value))
            {
                ret.Add(IsGoCondition.InvalidDeck);
                return(ret);
            }
            if (value.Ship.Count() == 0)
            {
                ret.Add(IsGoCondition.InvalidDeck);
                return(ret);
            }
            if (value.MissionState != 0)
            {
                ret.Add(IsGoCondition.Mission);
            }
            if (value.IsActionEnd)
            {
                ret.Add(IsGoCondition.ActionEndDeck);
                return(ret);
            }
            Mem_ship value2 = null;

            if (!Comm_UserDatas.Instance.User_ship.TryGetValue(value.Ship[0], out value2))
            {
                ret.Add(IsGoCondition.Invalid);
                return(ret);
            }
            if (value2.Get_DamageState() == DamageState.Taiha)
            {
                ret.Add(IsGoCondition.FlagShipTaiha);
            }
            Mem_deck mem_deck = Comm_UserDatas.Instance.User_deck.Values.FirstOrDefault((Mem_deck x) => (x.Mission_id == mission_id) ? true : false);

            if (mem_deck != null)
            {
                ret.Add(IsGoCondition.OtherDeckMissionRunning);
            }
            int destroy_ship = 0;

            value.Ship.getMemShip().ForEach(delegate(Mem_ship deck_ship)
            {
                if (deck_ship.Stype == 2)
                {
                    destroy_ship++;
                }
                Mst_ship mst_ship = Mst_DataManager.Instance.Mst_ship[deck_ship.Ship_id];
                if (deck_ship.Fuel <= 0 || deck_ship.Bull <= 0)
                {
                    ret.Add(IsGoCondition.NeedSupply);
                }
                if (mst_mission.IsSupportMission() && (deck_ship.Fuel < mst_ship.Fuel_max || deck_ship.Bull < mst_ship.Bull_max))
                {
                    ret.Add(IsGoCondition.ReqFullSupply);
                }
                if (Comm_UserDatas.Instance.User_ndock.Values.Any((Mem_ndock ndock) => ndock.Ship_id == deck_ship.Rid))
                {
                    ret.Add(IsGoCondition.HasRepair);
                }
                if (deck_ship.IsBlingShip())
                {
                    ret.Add(IsGoCondition.HasBling);
                }
            });
            if (mst_mission.IsSupportMission() && destroy_ship < 2)
            {
                ret.Add(IsGoCondition.NecessaryStype);
            }
            List <Mem_tanker> freeTanker = Mem_tanker.GetFreeTanker(Comm_UserDatas.Instance.User_tanker);

            if (freeTanker.Count < tankerNum)
            {
                ret.Add(IsGoCondition.Tanker);
            }
            return(ret);
        }
示例#16
0
        public bool SetUserData()
        {
            XElement elements = VitaSaveManager.Instance.Elements;

            if (elements == null)
            {
                return(false);
            }
            Mem_basic        user_basic        = Model_Base.SetUserData <Mem_basic>(elements.Elements(Mem_basic.tableName).First());
            Mem_record       user_record       = Model_Base.SetUserData <Mem_record>(elements.Elements(Mem_record.tableName).First());
            Mem_turn         user_turn         = Model_Base.SetUserData <Mem_turn>(elements.Elements(Mem_turn.tableName).First());
            Mem_deckpractice user_deckpractice = Model_Base.SetUserData <Mem_deckpractice>(elements.Elements(Mem_deckpractice.tableName).First());
            XElement         xElement          = elements.Elements(Mem_trophy.tableName).FirstOrDefault();
            Mem_trophy       user_trophy       = (xElement != null) ? Model_Base.SetUserData <Mem_trophy>(xElement) : new Mem_trophy();
            XElement         xElement2         = elements.Elements(Mem_newgame_plus.tableName).FirstOrDefault();
            Mem_newgame_plus user_plus         = (xElement2 != null) ? Model_Base.SetUserData <Mem_newgame_plus>(xElement2) : new Mem_newgame_plus();

            User_basic        = null;
            User_basic        = user_basic;
            User_record       = null;
            User_record       = user_record;
            User_turn         = null;
            User_turn         = user_turn;
            User_deckpractice = null;
            User_deckpractice = user_deckpractice;
            User_trophy       = user_trophy;
            User_plus         = user_plus;
            Dictionary <int, Mem_book>         dictionary  = new Dictionary <int, Mem_book>();
            Dictionary <int, Mem_book>         dictionary2 = new Dictionary <int, Mem_book>();
            Dictionary <int, Mem_deck>         dictionary3 = new Dictionary <int, Mem_deck>();
            Dictionary <int, Mem_esccort_deck> dictionary4 = new Dictionary <int, Mem_esccort_deck>();
            Dictionary <int, Mem_furniture>    dictionary5 = new Dictionary <int, Mem_furniture>();
            Dictionary <int, Mem_kdock>        dictionary6 = new Dictionary <int, Mem_kdock>();
            Dictionary <int, Mem_mapcomp>      dictionary7 = new Dictionary <int, Mem_mapcomp>();
            Dictionary <int, Mem_mapclear>     dictionary8 = new Dictionary <int, Mem_mapclear>();
            Dictionary <enumMaterialCategory, Mem_material> dictionary9 = new Dictionary <enumMaterialCategory, Mem_material>();
            Dictionary <int, Mem_missioncomp>     dictionary10          = new Dictionary <int, Mem_missioncomp>();
            Dictionary <int, Mem_ndock>           dictionary11          = new Dictionary <int, Mem_ndock>();
            Dictionary <int, Mem_quest>           dictionary12          = new Dictionary <int, Mem_quest>();
            Dictionary <int, Mem_questcount>      dictionary13          = new Dictionary <int, Mem_questcount>();
            Dictionary <int, Mem_ship>            dictionary14          = new Dictionary <int, Mem_ship>();
            Dictionary <int, Mem_slotitem>        dictionary15          = new Dictionary <int, Mem_slotitem>();
            Dictionary <int, Mem_tanker>          dictionary16          = new Dictionary <int, Mem_tanker>();
            Dictionary <int, Mem_useitem>         dictionary17          = new Dictionary <int, Mem_useitem>();
            Dictionary <int, Mem_rebellion_point> dictionary18          = new Dictionary <int, Mem_rebellion_point>();
            Dictionary <int, Mem_room>            dictionary19          = new Dictionary <int, Mem_room>();
            HashSet <int>      hashSet  = new HashSet <int>();
            HashSet <int>      hashSet2 = new HashSet <int>();
            List <Mem_history> list     = new List <Mem_history>();

            foreach (XElement item2 in elements.Elements("ship_books").Elements("mem_book"))
            {
                Mem_book mem_book = Model_Base.SetUserData <Mem_book>(item2);
                dictionary.Add(mem_book.Table_id, mem_book);
            }
            Ship_book.Clear();
            Ship_book = dictionary;
            foreach (XElement item3 in elements.Elements("slot_books").Elements("mem_book"))
            {
                Mem_book mem_book2 = Model_Base.SetUserData <Mem_book>(item3);
                dictionary2.Add(mem_book2.Table_id, mem_book2);
            }
            Slot_book.Clear();
            Slot_book = dictionary2;
            foreach (XElement item4 in elements.Elements(Mem_deck.tableName + "s").Elements(Mem_deck.tableName))
            {
                Mem_deck mem_deck = Model_Base.SetUserData <Mem_deck>(item4);
                dictionary3.Add(mem_deck.Rid, mem_deck);
            }
            User_deck.Clear();
            User_deck = dictionary3;
            foreach (XElement item5 in elements.Elements(Mem_esccort_deck.tableName + "s").Elements(Mem_esccort_deck.tableName))
            {
                Mem_esccort_deck mem_esccort_deck = Model_Base.SetUserData <Mem_esccort_deck>(item5);
                dictionary4.Add(mem_esccort_deck.Rid, mem_esccort_deck);
            }
            User_EscortDeck.Clear();
            User_EscortDeck = dictionary4;
            foreach (XElement item6 in elements.Elements(Mem_furniture.tableName + "s").Elements(Mem_furniture.tableName))
            {
                Mem_furniture mem_furniture = Model_Base.SetUserData <Mem_furniture>(item6);
                dictionary5.Add(mem_furniture.Rid, mem_furniture);
            }
            User_furniture.Clear();
            User_furniture = dictionary5;
            foreach (XElement item7 in elements.Elements(Mem_kdock.tableName + "s").Elements(Mem_kdock.tableName))
            {
                Mem_kdock mem_kdock = Model_Base.SetUserData <Mem_kdock>(item7);
                dictionary6.Add(mem_kdock.Rid, mem_kdock);
            }
            User_kdock.Clear();
            User_kdock = dictionary6;
            foreach (XElement item8 in elements.Elements(Mem_mapcomp.tableName + "s").Elements(Mem_mapcomp.tableName))
            {
                Mem_mapcomp mem_mapcomp = Model_Base.SetUserData <Mem_mapcomp>(item8);
                dictionary7.Add(mem_mapcomp.Rid, mem_mapcomp);
            }
            User_mapcomp.Clear();
            User_mapcomp = dictionary7;
            foreach (XElement item9 in elements.Elements(Mem_mapclear.tableName + "s").Elements(Mem_mapclear.tableName))
            {
                Mem_mapclear mem_mapclear = Model_Base.SetUserData <Mem_mapclear>(item9);
                dictionary8.Add(mem_mapclear.Rid, mem_mapclear);
            }
            User_mapclear.Clear();
            User_mapclear = dictionary8;
            foreach (XElement item10 in elements.Elements(Mem_material.tableName + "s").Elements(Mem_material.tableName))
            {
                Mem_material mem_material = Model_Base.SetUserData <Mem_material>(item10);
                dictionary9.Add(mem_material.Rid, mem_material);
            }
            User_material.Clear();
            User_material = dictionary9;
            foreach (XElement item11 in elements.Elements(Mem_missioncomp.tableName + "s").Elements(Mem_missioncomp.tableName))
            {
                Mem_missioncomp mem_missioncomp = Model_Base.SetUserData <Mem_missioncomp>(item11);
                dictionary10.Add(mem_missioncomp.Rid, mem_missioncomp);
            }
            User_missioncomp.Clear();
            User_missioncomp = dictionary10;
            foreach (XElement item12 in elements.Elements(Mem_ndock.tableName + "s").Elements(Mem_ndock.tableName))
            {
                Mem_ndock mem_ndock = Model_Base.SetUserData <Mem_ndock>(item12);
                dictionary11.Add(mem_ndock.Rid, mem_ndock);
            }
            User_ndock.Clear();
            User_ndock = dictionary11;
            foreach (XElement item13 in elements.Elements(Mem_quest.tableName + "s").Elements(Mem_quest.tableName))
            {
                Mem_quest mem_quest = Model_Base.SetUserData <Mem_quest>(item13);
                dictionary12.Add(mem_quest.Rid, mem_quest);
            }
            User_quest.Clear();
            User_quest = dictionary12;
            foreach (XElement item14 in elements.Elements(Mem_questcount.tableName + "s").Elements(Mem_questcount.tableName))
            {
                Mem_questcount mem_questcount = Model_Base.SetUserData <Mem_questcount>(item14);
                dictionary13.Add(mem_questcount.Rid, mem_questcount);
            }
            User_questcount.Clear();
            User_questcount = dictionary13;
            foreach (XElement item15 in elements.Elements(Mem_slotitem.tableName + "s").Elements(Mem_slotitem.tableName))
            {
                Mem_slotitem mem_slotitem = Model_Base.SetUserData <Mem_slotitem>(item15);
                dictionary15.Add(mem_slotitem.Rid, mem_slotitem);
            }
            User_slot.Clear();
            User_slot = dictionary15;
            foreach (XElement item16 in elements.Elements(Mem_ship.tableName + "s").Elements(Mem_ship.tableName))
            {
                Mem_ship mem_ship = Model_Base.SetUserData <Mem_ship>(item16);
                dictionary14.Add(mem_ship.Rid, mem_ship);
            }
            User_ship.Clear();
            User_ship = dictionary14;
            foreach (XElement item17 in elements.Elements(Mem_tanker.tableName + "s").Elements(Mem_tanker.tableName))
            {
                Mem_tanker mem_tanker = Model_Base.SetUserData <Mem_tanker>(item17);
                dictionary16.Add(mem_tanker.Rid, mem_tanker);
            }
            User_tanker.Clear();
            User_tanker = dictionary16;
            foreach (XElement item18 in elements.Elements(Mem_useitem.tableName + "s").Elements(Mem_useitem.tableName))
            {
                Mem_useitem mem_useitem = Model_Base.SetUserData <Mem_useitem>(item18);
                dictionary17.Add(mem_useitem.Rid, mem_useitem);
            }
            User_useItem.Clear();
            User_useItem = dictionary17;
            foreach (XElement item19 in elements.Elements(Mem_rebellion_point.tableName + "s").Elements(Mem_rebellion_point.tableName))
            {
                Mem_rebellion_point mem_rebellion_point = Model_Base.SetUserData <Mem_rebellion_point>(item19);
                dictionary18.Add(mem_rebellion_point.Rid, mem_rebellion_point);
            }
            User_rebellion_point.Clear();
            User_rebellion_point = dictionary18;
            foreach (XElement item20 in elements.Elements(Mem_room.tableName + "s").Elements(Mem_room.tableName))
            {
                Mem_room mem_room = Model_Base.SetUserData <Mem_room>(item20);
                dictionary19.Add(mem_room.Rid, mem_room);
            }
            User_room.Clear();
            User_room = dictionary19;
            foreach (XElement item21 in elements.Element("temp_escortships").Elements())
            {
                string value = item21.Value;
                hashSet.Add(int.Parse(value));
            }
            Temp_escortship.Clear();
            Temp_escortship = hashSet;
            foreach (XElement item22 in elements.Element("temp_deckships").Elements())
            {
                string value2 = item22.Value;
                hashSet2.Add(int.Parse(value2));
            }
            Temp_deckship.Clear();
            Temp_deckship = hashSet2;
            foreach (XElement item23 in elements.Elements(Mem_history.tableName + "s").Elements(Mem_history.tableName))
            {
                Mem_history item = Model_Base.SetUserData <Mem_history>(item23);
                list.Add(item);
            }
            User_history.Clear();
            list.ForEach(delegate(Mem_history x)
            {
                Add_History(x);
            });
            return(true);
        }
        public HashSet <IsGoCondition> ValidStart(int deck_rid, int mission_id, int tankerNum)
        {
            HashSet <IsGoCondition> ret         = new HashSet <IsGoCondition>();
            Mst_mission2            mst_mission = null;

            if (mission_id > 0)
            {
                if (!Mst_DataManager.Instance.Mst_mission.TryGetValue(mission_id, ref mst_mission))
                {
                    ret.Add(IsGoCondition.Invalid);
                    return(ret);
                }
            }
            else
            {
                if (mission_id != -1 && mission_id != -2)
                {
                    ret.Add(IsGoCondition.Invalid);
                    return(ret);
                }
                List <Mst_mission2> supportResistedData = Mst_DataManager.Instance.GetSupportResistedData(Comm_UserDatas.Instance.User_deck.get_Item(deck_rid).Area_id);
                mst_mission = ((mission_id != -1) ? supportResistedData.get_Item(1) : supportResistedData.get_Item(0));
            }
            Mem_deck mem_deck = null;

            if (!Comm_UserDatas.Instance.User_deck.TryGetValue(deck_rid, ref mem_deck))
            {
                ret.Add(IsGoCondition.InvalidDeck);
                return(ret);
            }
            if (mem_deck.Ship.Count() == 0)
            {
                ret.Add(IsGoCondition.InvalidDeck);
                return(ret);
            }
            if (mem_deck.MissionState != MissionStates.NONE)
            {
                ret.Add(IsGoCondition.Mission);
            }
            if (mem_deck.IsActionEnd)
            {
                ret.Add(IsGoCondition.ActionEndDeck);
                return(ret);
            }
            Mem_ship mem_ship = null;

            if (!Comm_UserDatas.Instance.User_ship.TryGetValue(mem_deck.Ship[0], ref mem_ship))
            {
                ret.Add(IsGoCondition.Invalid);
                return(ret);
            }
            if (mem_ship.Get_DamageState() == DamageState.Taiha)
            {
                ret.Add(IsGoCondition.FlagShipTaiha);
            }
            Mem_deck mem_deck2 = Enumerable.FirstOrDefault <Mem_deck>(Comm_UserDatas.Instance.User_deck.get_Values(), (Mem_deck x) => x.Mission_id == mission_id);

            if (mem_deck2 != null)
            {
                ret.Add(IsGoCondition.OtherDeckMissionRunning);
            }
            int destroy_ship = 0;

            mem_deck.Ship.getMemShip().ForEach(delegate(Mem_ship deck_ship)
            {
                if (deck_ship.Stype == 2)
                {
                    destroy_ship++;
                }
                Mst_ship mst_ship = Mst_DataManager.Instance.Mst_ship.get_Item(deck_ship.Ship_id);
                if (deck_ship.Fuel <= 0 || deck_ship.Bull <= 0)
                {
                    ret.Add(IsGoCondition.NeedSupply);
                }
                if (mst_mission.IsSupportMission() && (deck_ship.Fuel < mst_ship.Fuel_max || deck_ship.Bull < mst_ship.Bull_max))
                {
                    ret.Add(IsGoCondition.ReqFullSupply);
                }
                if (Enumerable.Any <Mem_ndock>(Comm_UserDatas.Instance.User_ndock.get_Values(), (Mem_ndock ndock) => ndock.Ship_id == deck_ship.Rid))
                {
                    ret.Add(IsGoCondition.HasRepair);
                }
                if (deck_ship.IsBlingShip())
                {
                    ret.Add(IsGoCondition.HasBling);
                }
            });
            if (mst_mission.IsSupportMission() && destroy_ship < 2)
            {
                ret.Add(IsGoCondition.NecessaryStype);
            }
            List <Mem_tanker> freeTanker = Mem_tanker.GetFreeTanker(Comm_UserDatas.Instance.User_tanker);

            if (freeTanker.get_Count() < tankerNum)
            {
                ret.Add(IsGoCondition.Tanker);
            }
            return(ret);
        }
        private List <RadingResultData> getRadingResult(int radingPhase, Dictionary <int, RadingKind> targetArea, Dictionary <int, List <Mem_tanker> > tankers)
        {
            DifficultKind           difficult = this.basicInstance.Difficult;
            List <RadingResultData> list      = new List <RadingResultData>();

            using (Dictionary <int, RadingKind> .Enumerator enumerator = targetArea.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    KeyValuePair <int, RadingKind> current = enumerator.get_Current();
                    int key = current.get_Key();
                    List <Mem_tanker> list2           = tankers.get_Item(key);
                    Mst_radingrate    mst_radingrate  = Mst_DataManager.Instance.Mst_RadingRate.get_Item(key).get_Item(radingPhase);
                    int              count            = list2.get_Count();
                    List <Mem_ship>  memShip          = Comm_UserDatas.Instance.User_EscortDeck.get_Item(key).Ship.getMemShip();
                    RadingResultData radingResultData = new RadingResultData();
                    radingResultData.AreaId     = key;
                    radingResultData.AttackKind = current.get_Value();
                    radingResultData.BeforeNum  = list2.get_Count();
                    List <Mem_ship> list3 = null;
                    if (memShip.get_Count() > 0)
                    {
                        radingResultData.FlagShipMstId       = memShip.get_Item(0).Ship_id;
                        radingResultData.FlagShipDamageState = memShip.get_Item(0).Get_DamageState();
                    }
                    radingResultData.RadingDamage = this.getRadingDamage(key, current.get_Value(), mst_radingrate, memShip, out radingResultData.DeckAttackPow, out list3);
                    radingResultData.BreakNum     = this.getRadingTankerLostNum(current.get_Value(), memShip, count, mst_radingrate);
                    IEnumerable <Mem_tanker> enumerable = Enumerable.Take <Mem_tanker>(list2, radingResultData.BreakNum);
                    if (radingResultData.RadingDamage.get_Count() > 0)
                    {
                        List <int> list4 = new List <int>();
                        using (List <Mem_ship> .Enumerator enumerator2 = memShip.GetEnumerator())
                        {
                            Mem_ship checkShip;
                            while (enumerator2.MoveNext())
                            {
                                checkShip = enumerator2.get_Current();
                                if (Enumerable.Any <RadingDamageData>(radingResultData.RadingDamage, (RadingDamageData x) => x.Rid == checkShip.Rid && x.Damage) && checkShip.Get_DamageState() >= DamageState.Tyuuha)
                                {
                                    list4.Add(checkShip.Ship_id);
                                }
                            }
                        }
                        Comm_UserDatas.Instance.UpdateShipBookBrokenClothState(list4);
                    }
                    using (List <Mem_ship> .Enumerator enumerator3 = list3.GetEnumerator())
                    {
                        while (enumerator3.MoveNext())
                        {
                            Mem_ship current2 = enumerator3.get_Current();
                            Comm_UserDatas.Instance.User_EscortDeck.get_Item(key).Ship.RemoveShip(current2.Rid);
                            Comm_UserDatas.Instance.User_record.AddLostShipCount();
                        }
                    }
                    Comm_UserDatas.Instance.Remove_Ship(list3);
                    using (IEnumerator <Mem_tanker> enumerator4 = enumerable.GetEnumerator())
                    {
                        while (enumerator4.MoveNext())
                        {
                            Mem_tanker current3 = enumerator4.get_Current();
                            Comm_UserDatas.Instance.Remove_Tanker(current3.Rid);
                        }
                    }
                    if (radingResultData.BeforeNum > 0)
                    {
                        double num = (double)radingResultData.BreakNum / (double)radingResultData.BeforeNum;
                        if (num >= 0.5)
                        {
                            int         mapinfo_id  = Mst_mapinfo.ConvertMapInfoId(key, 1);
                            Mem_history mem_history = new Mem_history();
                            mem_history.SetTanker(this.turnInstance.Total_turn, mapinfo_id, num >= 1.0);
                            Comm_UserDatas.Instance.Add_History(mem_history);
                        }
                    }
                    list.Add(radingResultData);
                }
            }
            return(list);
        }
        private TurnWorkResult ExecTurnEndWork()
        {
            TurnWorkResult turnWorkResult = new TurnWorkResult();

            turnWorkResult.ChangeState = TurnState.TURN_START;
            this.turnInstance.AddTurn(this);
            if (this.turnInstance.GetDateTime().get_Day() == 1)
            {
                new Api_req_Quest(this).EnforceQuestReset();
            }
            if (Utils.IsTurnOver())
            {
                Mem_history mem_history = new Mem_history();
                mem_history.SetGameOverToTurn(this.turnInstance.Total_turn);
                Comm_UserDatas.Instance.Add_History(mem_history);
            }
            using (Dictionary <int, Mem_ship> .ValueCollection.Enumerator enumerator = Comm_UserDatas.Instance.User_ship.get_Values().GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    Mem_ship current = enumerator.get_Current();
                    current.BlingWaitToStart();
                    current.PurgeLovTouchData();
                }
            }
            Comm_UserDatas.Instance.UpdateEscortShipLocale();
            Comm_UserDatas.Instance.UpdateDeckShipLocale();
            List <Mem_deck> list = Enumerable.ToList <Mem_deck>(Comm_UserDatas.Instance.User_deck.get_Values());

            list.ForEach(delegate(Mem_deck x)
            {
                x.ActionStart();
            });
            List <Mst_radingtype> types        = Mst_DataManager.Instance.Mst_RadingType.get_Item((int)this.basicInstance.Difficult);
            Mst_radingtype        radingRecord = Mst_radingtype.GetRadingRecord(types, this.turnInstance.Total_turn);
            HashSet <int>         hashSet      = new HashSet <int>();

            if (radingRecord != null)
            {
                double randDouble = Utils.GetRandDouble(1.0, 100.0, 1.0, 1);
                if ((double)radingRecord.Rading_rate >= randDouble)
                {
                    IEnumerable <IGrouping <int, Mem_tanker> > areaEnableTanker = Mem_tanker.GetAreaEnableTanker(Comm_UserDatas.Instance.User_tanker);
                    Dictionary <int, RadingKind> radingArea = this.getRadingArea(areaEnableTanker, radingRecord.Rading_type);
                    if (radingArea.get_Count() > 0)
                    {
                        Dictionary <int, List <Mem_tanker> > tankers = Enumerable.ToDictionary <IGrouping <int, Mem_tanker>, int, List <Mem_tanker> >(areaEnableTanker, (IGrouping <int, Mem_tanker> x) => x.get_Key(), (IGrouping <int, Mem_tanker> y) => Enumerable.ToList <Mem_tanker>(y));
                        turnWorkResult.RadingResult = this.getRadingResult(radingRecord.Rading_type, radingArea, tankers);
                    }
                }
            }
            this.updateRadingEscortShipExp(turnWorkResult.RadingResult);
            if (this.basicInstance.Difficult == DifficultKind.KOU || this.basicInstance.Difficult == DifficultKind.SHI)
            {
                this.addRebellionPoint();
                this.selectRegistanceArea();
            }
            else
            {
                this.selectRegistanceArea();
                this.addRebellionPoint();
            }
            return(turnWorkResult);
        }