public static void SetFleetLevel(int fleetLevel) { Mem_record user_record = Comm_UserDatas.Instance.User_record; if (user_record.Level == fleetLevel) { return; } Dictionary <int, int> mstLevelUser = ArrayMaster.GetMstLevelUser(); int num = 0; if (!mstLevelUser.TryGetValue(fleetLevel, ref num)) { return; } uint exp = user_record.Exp; int num2 = (int)((long)num - (long)((ulong)exp)); if (num2 < 0) { user_record.GetType().InvokeMember("_level", 2084, null, user_record, new object[] { 1 }); user_record.GetType().InvokeMember("_exp", 2084, null, user_record, new object[] { 0u }); num2 = num; } user_record.UpdateExp(num2, mstLevelUser); }
public static void SetFleetLevel(int fleetLevel) { Mem_record user_record = Comm_UserDatas.Instance.User_record; if (user_record.Level == fleetLevel) { return; } Dictionary <int, int> mstLevelUser = ArrayMaster.GetMstLevelUser(); int value = 0; if (mstLevelUser.TryGetValue(fleetLevel, out value)) { uint exp = user_record.Exp; int num = (int)(value - exp); if (num < 0) { user_record.GetType().InvokeMember("_level", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.SetField, null, user_record, new object[1] { 1 }); user_record.GetType().InvokeMember("_exp", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.SetField, null, user_record, new object[1] { 0u }); num = value; } user_record.UpdateExp(num, mstLevelUser); } }
private BattleResultFmt getData() { BattleResultFmt ret = new BattleResultFmt(); if (!practiceFlag) { ret.QuestName = mst_mapinfo.Name; } ret.EnemyName = E_Data.Enemy_Name; E_Data.ShipData.ForEach(delegate(Mem_ship x) { ret.EnemyId.Add(x.Ship_id); }); ret.WinRank = getWinRank(); if (isMvpGet(ret.WinRank)) { Dictionary <int, BattleShipSubInfo> subInfoDict = F_SubInfo.Values.ToDictionary((BattleShipSubInfo key) => key.DeckIdx, (BattleShipSubInfo value) => value); int mvp = getMvp(ret.WinRank, subInfoDict); ret.MvpShip = mvp; } Mem_record user_record = Comm_UserDatas.Instance.User_record; int addValue; if (!practiceFlag) { int num = Mst_maparea.MaxMapNum(Comm_UserDatas.Instance.User_basic.Difficult, mst_mapinfo.Maparea_id); ret.GetBaseExp = mst_enemy.Experience; ret.GetShipExp = getShipExpSortie(ret.WinRank, ret.MvpShip, ret.GetBaseExp); addValue = getUserExpSortie(ret.WinRank); SerializableDictionary <int, List <int> > lvupInfo = null; updateShip(ret.WinRank, ret.MvpShip, ret.GetShipExp, out lvupInfo); ret.LevelUpInfo = lvupInfo; bool flag = Utils.IsBattleWin(ret.WinRank); bool takeAwayBattle = false; if (cleard != null && (cleard.State == MapClearState.InvationNeighbor || cleard.State == MapClearState.InvationOpen)) { takeAwayBattle = true; } if (flag) { List <ItemGetFmt> list = new List <ItemGetFmt>(); ItemGetFmt getShip = null; bool flag2 = isLastDance(Comm_UserDatas.Instance.User_basic.Difficult); if (!flag2) { getRewardShip(ret.WinRank, out getShip); if (getShip != null) { if (Comm_UserDatas.Instance.User_turn.Total_turn <= 100 && Comm_UserDatas.Instance.User_ship.Values.Any((Mem_ship x) => x.Ship_id == getShip.Id)) { getRewardShip(ret.WinRank, out getShip); } if (getShip != null && Comm_UserDatas.Instance.User_ship.Values.Any((Mem_ship x) => x.Ship_id == getShip.Id)) { getRewardShip(ret.WinRank, out getShip); } } } else { getClearShip(Comm_UserDatas.Instance.User_basic.Difficult, ret.WinRank, out getShip); } if (getShip != null) { addShip(getShip.Id, flag2); list.Add(getShip); } if (list.Count > 0) { ret.GetItem = list; } if (!isRebellionBattle) { List <int> diffMapOpen = null; List <int> reOpenMap = null; ret.FirstClear = updateMapComp(out diffMapOpen, out reOpenMap); ret.NewOpenMapId = diffMapOpen; ret.ReOpenMapId = reOpenMap; if (ret.FirstClear && Utils.IsGameClear()) { user_record.AddClearDifficult(Comm_UserDatas.Instance.User_basic.Difficult); } else if (ret.FirstClear && mst_mapinfo.No == num) { ItemGetFmt itemGetFmt = new ItemGetFmt(); itemGetFmt.Id = 57; itemGetFmt.Count = 1; itemGetFmt.Category = ItemGetKinds.UseItem; ret.AreaClearRewardItem = itemGetFmt; Comm_UserDatas.Instance.Add_Useitem(itemGetFmt.Id, itemGetFmt.Count); } if (mst_enemy.Boss != 0) { ret.FirstAreaComplete = updateAreaCompHisory(num); } } if (mst_enemy.Boss != 0 && airCellItems != null) { ret.GetAirReconnaissanceItems = airCellItems; } } else if (mst_enemy.Boss != 0 && airCellItems != null) { ret.GetAirReconnaissanceItems = new List <MapItemGetFmt>(); } if (isRebellionBattle) { updateRebellion(ret.WinRank); ret.FirstClear = false; } bool rebellionBoss = (isRebellionBattle && mst_enemy.Boss != 0) ? true : false; user_record.UpdateSortieCount(ret.WinRank, rebellionBoss); if (ret.FirstClear) { ret.GetSpoint = mst_mapinfo.Clear_spoint; Comm_UserDatas.Instance.User_basic.AddPoint(ret.GetSpoint); } deleteLostShip(); if (mst_enemy.Boss != 0) { updateHistory(flag, ret.NewOpenMapId, takeAwayBattle); } } else { ret.GetBaseExp = getBaseExpPractice(ret.WinRank); ret.GetShipExp = getShipExpPractice(ret.WinRank, ret.MvpShip, ret.GetBaseExp); addValue = getUserExpPractice(ret.WinRank, Comm_UserDatas.Instance.User_record.Level, E_Data.ShipData[0].Level); SerializableDictionary <int, List <int> > lvupInfo2 = null; updateShip(ret.WinRank, ret.MvpShip, ret.GetShipExp, out lvupInfo2); updateShipPracticeEnemy(ret.GetShipExp, ref lvupInfo2); ret.LevelUpInfo = lvupInfo2; user_record.UpdatePracticeCount(ret.WinRank, practiceBattle: true); } Comm_UserDatas.Instance.UpdateShipBookBrokenClothState(clothBrokenIds); ret.BasicLevel = user_record.UpdateExp(addValue, Mst_DataManager.Instance.Get_MstLevel(shipTable: false)); return(ret); }