Пример #1
0
        private void updateShipPracticeEnemy(SerializableDictionary <int, int> getShipExp, ref SerializableDictionary <int, List <int> > lvupInfo)
        {
            List <Mem_ship>       shipData  = E_Data.ShipData;
            Dictionary <int, int> mst_level = mst_shiplevel;

            foreach (Mem_ship item in shipData)
            {
                Mem_ship     mem_ship     = Comm_UserDatas.Instance.User_ship[item.Rid];
                Mem_shipBase mem_shipBase = new Mem_shipBase(mem_ship);
                Mst_ship     mst_data     = Mst_DataManager.Instance.Mst_ship[mem_shipBase.Ship_id];
                int          addExp       = getShipExp[mem_ship.Rid];
                List <int>   lvupInfo2    = null;
                int          levelupInfo  = mem_ship.getLevelupInfo(mst_level, mem_shipBase.Level, mem_shipBase.Exp, ref addExp, out lvupInfo2);
                lvupInfo.Add(mem_ship.Rid, lvupInfo2);
                mem_shipBase.Level = levelupInfo;
                mem_shipBase.Exp  += addExp;
                int num = levelupInfo - mem_ship.Level;
                Dictionary <Mem_ship.enumKyoukaIdx, int> dictionary = mem_ship.Kyouka;
                for (int i = 0; i < num; i++)
                {
                    dictionary = mem_ship.getLevelupKyoukaValue(mem_ship.Ship_id, dictionary);
                }
                mem_shipBase.SetKyoukaValue(dictionary);
                mem_ship.SetRequireExp(mem_shipBase.Level, mst_level);
                mem_ship.Set_ShipParam(mem_shipBase, mst_data, enemy_flag: false);
            }
        }
Пример #2
0
        public Api_Result <Mem_ship> Marriage(int ship_rid)
        {
            Api_Result <Mem_ship> api_Result = new Api_Result <Mem_ship>();

            if (!this.ValidMarriage(ship_rid))
            {
                api_Result.state = Api_Result_State.Parameter_Error;
                return(api_Result);
            }
            Mem_useitem mem_useitem = null;

            if (!Comm_UserDatas.Instance.User_useItem.TryGetValue(55, ref mem_useitem))
            {
                api_Result.state = Api_Result_State.Parameter_Error;
                return(api_Result);
            }
            if (mem_useitem.Value == 0)
            {
                api_Result.state = Api_Result_State.Parameter_Error;
                return(api_Result);
            }
            Mem_ship     mem_ship     = Comm_UserDatas.Instance.User_ship.get_Item(ship_rid);
            Mst_ship     mst_ship     = Mst_DataManager.Instance.Mst_ship.get_Item(mem_ship.Ship_id);
            Mem_shipBase mem_shipBase = new Mem_shipBase(mem_ship);
            int          num          = mem_ship.Maxhp - mem_shipBase.C_taik_powerup;
            int          num2         = num + this.getMariageTaik(num);

            if (num2 > mst_ship.Taik_max)
            {
                num2 = mst_ship.Taik_max;
            }
            mem_shipBase.C_taik         = num2 - mst_ship.Taik;
            mem_shipBase.C_taik_powerup = ((num2 + mem_shipBase.C_taik_powerup <= mst_ship.Taik_max) ? mem_shipBase.C_taik_powerup : (mst_ship.Taik_max - num2));
            num2 += mem_shipBase.C_taik_powerup;
            mem_shipBase.Nowhp = num2;
            int luck = mem_ship.Luck;
            int num3 = (int)Utils.GetRandDouble(3.0, 6.0, 1.0, 1);
            int num4 = luck + num3;

            if (num4 > mst_ship.Luck_max)
            {
                num4 = mst_ship.Luck_max;
            }
            mem_shipBase.C_luck = num4 - mst_ship.Luck;
            mem_shipBase.Level  = 100;
            mem_ship.Set_ShipParam(mem_shipBase, mst_ship, false);
            Dictionary <int, int> mst_level = Mst_DataManager.Instance.Get_MstLevel(true);

            mem_ship.SetRequireExp(mem_ship.Level, mst_level);
            mem_ship.SumLovToMarriage();
            Comm_UserDatas.Instance.Ship_book.get_Item(mem_ship.Ship_id).UpdateShipBook(false, true);
            Comm_UserDatas.Instance.User_useItem.get_Item(55).Sub_UseItem(1);
            api_Result.data = mem_ship;
            return(api_Result);
        }
Пример #3
0
        private Dictionary <int, List <int> > updateShip(DeckPracticeType type, Dictionary <int, int> getShipExp, Dictionary <int, PowUpInfo> powerUp)
        {
            Dictionary <int, List <int> > dictionary = new Dictionary <int, List <int> >();

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

            if (target_rid != null && target_rid.get_Count() == 0)
            {
                api_Result.data = ret_ship;
                return(api_Result);
            }
            if (this.mst_level == null)
            {
                this.mst_level = Mst_DataManager.Instance.Get_MstLevel(true);
            }
            if (target_rid == null)
            {
                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.SetRequireExp(current.Level, this.mst_level);
                        ret_ship.Add(current.Rid, current);
                    }
                }
                api_Result.data = ret_ship;
                return(api_Result);
            }
            target_rid.ForEach(delegate(int x)
            {
                Mem_ship mem_ship = null;
                if (Comm_UserDatas.Instance.User_ship.TryGetValue(x, ref mem_ship))
                {
                    mem_ship.SetRequireExp(mem_ship.Level, this.mst_level);
                    ret_ship.Add(x, mem_ship);
                }
            });
            api_Result.data = ret_ship;
            if (ret_ship.get_Count() == 0)
            {
                api_Result.state = Api_Result_State.Parameter_Error;
                api_Result.data  = null;
            }
            return(api_Result);
        }
Пример #5
0
        public Api_Result <Dictionary <int, Mem_ship> > Ship(List <int> target_rid)
        {
            Api_Result <Dictionary <int, Mem_ship> > api_Result = new Api_Result <Dictionary <int, Mem_ship> >();
            Dictionary <int, Mem_ship> ret_ship = new Dictionary <int, Mem_ship>();

            if (target_rid != null && target_rid.Count == 0)
            {
                api_Result.data = ret_ship;
                return(api_Result);
            }
            if (mst_level == null)
            {
                mst_level = Mst_DataManager.Instance.Get_MstLevel(shipTable: true);
            }
            if (target_rid == null)
            {
                foreach (Mem_ship value2 in Comm_UserDatas.Instance.User_ship.Values)
                {
                    value2.SetRequireExp(value2.Level, mst_level);
                    ret_ship.Add(value2.Rid, value2);
                }
                api_Result.data = ret_ship;
                return(api_Result);
            }
            target_rid.ForEach(delegate(int x)
            {
                Mem_ship value = null;
                if (Comm_UserDatas.Instance.User_ship.TryGetValue(x, out value))
                {
                    value.SetRequireExp(value.Level, mst_level);
                    ret_ship.Add(x, value);
                }
            });
            api_Result.data = ret_ship;
            if (ret_ship.Count == 0)
            {
                api_Result.state = Api_Result_State.Parameter_Error;
                api_Result.data  = null;
            }
            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);
                                }
                            }
                        }
                    }
                }
            }
        }
Пример #7
0
        private void updateShip(BattleWinRankKinds rank, int mvpShip, SerializableDictionary <int, int> getShipExp, out SerializableDictionary <int, List <int> > lvupInfo)
        {
            lvupInfo = new SerializableDictionary <int, List <int> >();
            List <Mem_ship> shipData = F_Data.ShipData;
            int             count    = shipData.Count;
            bool            flag     = true;
            double          num      = 1.0;
            double          num2     = 0.0;

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

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