public Api_Result <SlotSetChkResult_Slot> SlotSet(int ship_rid, int slot_rid) { Api_Result <SlotSetChkResult_Slot> api_Result = new Api_Result <SlotSetChkResult_Slot>(); SlotSetChkResult_Slot slotSetChkResult_Slot = this.IsValidSlotSet(ship_rid, slot_rid); if (slotSetChkResult_Slot != SlotSetChkResult_Slot.Ok) { api_Result.state = Api_Result_State.Parameter_Error; api_Result.data = slotSetChkResult_Slot; return(api_Result); } Mem_ship mem_ship = Comm_UserDatas.Instance.User_ship.get_Item(ship_rid); Mem_slotitem mem_slotitem = null; Comm_UserDatas.Instance.User_slot.TryGetValue(slot_rid, ref mem_slotitem); Mem_shipBase mem_shipBase = new Mem_shipBase(mem_ship); Mem_slotitem mem_slotitem2 = null; Comm_UserDatas.Instance.User_slot.TryGetValue(mem_ship.Exslot, ref mem_slotitem2); mem_shipBase.Exslot = slot_rid; if (mem_slotitem2 != null) { mem_slotitem2.UnEquip(); } if (slot_rid != -1) { mem_slotitem.Equip(ship_rid); } mem_ship.Set_ShipParam(mem_shipBase, Mst_DataManager.Instance.Mst_ship.get_Item(mem_shipBase.Ship_id), false); return(api_Result); }
public Api_Result <Hashtable> Unslot_all(int ship_rid) { Api_Result <Hashtable> result = new Api_Result <Hashtable>(); Mem_ship mem_ship = Comm_UserDatas.Instance.User_ship.get_Item(ship_rid); Mem_shipBase mem_shipBase = new Mem_shipBase(mem_ship); for (int i = 0; i < Enumerable.Count <int>(mem_shipBase.Slot); i++) { Mem_slotitem mem_slotitem = null; int num = mem_shipBase.Slot.get_Item(i); mem_shipBase.Slot.set_Item(i, -1); if (num > 0 && Comm_UserDatas.Instance.User_slot.TryGetValue(num, ref mem_slotitem)) { Mst_slotitem_cost mst_slotitem_cost = null; if (Mst_DataManager.Instance.Mst_slotitem_cost.TryGetValue(mem_slotitem.Slotitem_id, ref mst_slotitem_cost)) { int addNum = mst_slotitem_cost.GetAddNum(mem_shipBase.Onslot.get_Item(i)); Comm_UserDatas.Instance.User_material.get_Item(enumMaterialCategory.Bauxite).Add_Material(addNum); } mem_slotitem.UnEquip(); } } mem_ship.Set_ShipParam(mem_shipBase, Mst_DataManager.Instance.Mst_ship.get_Item(mem_shipBase.Ship_id), false); mem_ship.TrimSlot(); return(result); }
public Api_Result <SlotSetChkResult_Slot> SlotSet(int ship_rid, int slot_rid) { Api_Result <SlotSetChkResult_Slot> api_Result = new Api_Result <SlotSetChkResult_Slot>(); SlotSetChkResult_Slot slotSetChkResult_Slot = IsValidSlotSet(ship_rid, slot_rid); if (slotSetChkResult_Slot != 0) { api_Result.state = Api_Result_State.Parameter_Error; api_Result.data = slotSetChkResult_Slot; return(api_Result); } Mem_ship mem_ship = Comm_UserDatas.Instance.User_ship[ship_rid]; Mem_slotitem value = null; Comm_UserDatas.Instance.User_slot.TryGetValue(slot_rid, out value); Mem_shipBase mem_shipBase = new Mem_shipBase(mem_ship); Mem_slotitem value2 = null; Comm_UserDatas.Instance.User_slot.TryGetValue(mem_ship.Exslot, out value2); mem_shipBase.Exslot = slot_rid; value2?.UnEquip(); if (slot_rid != -1) { value.Equip(ship_rid); } mem_ship.Set_ShipParam(mem_shipBase, Mst_DataManager.Instance.Mst_ship[mem_shipBase.Ship_id], enemy_flag: false); return(api_Result); }
public Api_Result <Hashtable> Unslot_all(int ship_rid) { Api_Result <Hashtable> result = new Api_Result <Hashtable>(); Mem_ship mem_ship = Comm_UserDatas.Instance.User_ship[ship_rid]; Mem_shipBase mem_shipBase = new Mem_shipBase(mem_ship); for (int i = 0; i < mem_shipBase.Slot.Count(); i++) { Mem_slotitem value = null; int num = mem_shipBase.Slot[i]; mem_shipBase.Slot[i] = -1; if (num > 0 && Comm_UserDatas.Instance.User_slot.TryGetValue(num, out value)) { Mst_slotitem_cost value2 = null; if (Mst_DataManager.Instance.Mst_slotitem_cost.TryGetValue(value.Slotitem_id, out value2)) { int addNum = value2.GetAddNum(mem_shipBase.Onslot[i]); Comm_UserDatas.Instance.User_material[enumMaterialCategory.Bauxite].Add_Material(addNum); } value.UnEquip(); } } mem_ship.Set_ShipParam(mem_shipBase, Mst_DataManager.Instance.Mst_ship[mem_shipBase.Ship_id], enemy_flag: false); mem_ship.TrimSlot(); return(result); }
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); } }
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); }
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 static void SetShipKyoukaValue(int ship_id, PowUpInfo powerUpValues) { Mem_ship mem_ship = Comm_UserDatas.Instance.User_ship.get_Item(ship_id); Mst_ship mst_ship = Mst_DataManager.Instance.Mst_ship.get_Item(mem_ship.Ship_id); Mem_shipBase mem_shipBase = new Mem_shipBase(mem_ship); mem_shipBase.C_houg = ((powerUpValues.Karyoku - mst_ship.Houg <= 0) ? mem_shipBase.C_houg : (powerUpValues.Karyoku - mst_ship.Houg)); mem_shipBase.C_raig = ((powerUpValues.Raisou - mst_ship.Raig <= 0) ? mem_shipBase.C_raig : (powerUpValues.Raisou - mst_ship.Raig)); mem_shipBase.C_kaihi = ((powerUpValues.Kaihi - mst_ship.Kaih <= 0) ? mem_shipBase.C_kaihi : (powerUpValues.Kaihi - mst_ship.Kaih)); mem_shipBase.C_luck = ((powerUpValues.Lucky - mst_ship.Luck <= 0) ? mem_shipBase.C_luck : (powerUpValues.Lucky - mst_ship.Luck)); mem_shipBase.C_souk = ((powerUpValues.Soukou - mst_ship.Souk <= 0) ? mem_shipBase.C_souk : (powerUpValues.Soukou - mst_ship.Souk)); mem_shipBase.C_tyku = ((powerUpValues.Taiku - mst_ship.Tyku <= 0) ? mem_shipBase.C_tyku : (powerUpValues.Taiku - mst_ship.Tyku)); mem_shipBase.C_taisen = ((powerUpValues.Taisen - mst_ship.Tais <= 0) ? mem_shipBase.C_taisen : (powerUpValues.Taisen - mst_ship.Tais)); mem_ship.Set_ShipParam(mem_shipBase, mst_ship, false); }
public Api_Result <Mem_ship> ExpandSlot(int shipRid) { Api_Result <Mem_ship> api_Result = new Api_Result <Mem_ship>(); Mem_ship mem_ship = Comm_UserDatas.Instance.User_ship[shipRid]; Mem_shipBase mem_shipBase = new Mem_shipBase(mem_ship); Mst_ship mst_data = Mst_DataManager.Instance.Mst_ship[mem_ship.Ship_id]; mem_shipBase.Exslot = -1; mem_ship.Set_ShipParam(mem_shipBase, mst_data, enemy_flag: false); api_Result.data = mem_ship; Mem_useitem value = null; Comm_UserDatas.Instance.User_useItem.TryGetValue(64, out value); value.Sub_UseItem(1); return(api_Result); }
private Mem_ship getMemShip(int rid, int mst_id, int level) { Mst_ship mst_ship = Mst_DataManager.Instance.Mst_ship[mst_id]; Array values = Enum.GetValues(typeof(Mem_ship.enumKyoukaIdx)); Dictionary <Mem_ship.enumKyoukaIdx, int> dictionary = new Dictionary <Mem_ship.enumKyoukaIdx, int>(); foreach (object item in values) { dictionary.Add((Mem_ship.enumKyoukaIdx)(int) item, 0); } Mem_shipBase baseData = new Mem_shipBase(rid, mst_ship, level, dictionary); Mem_ship mem_ship = new Mem_ship(); mem_ship.Set_ShipParam(baseData, mst_ship, enemy_flag: true); return(mem_ship); }
public Api_Result <Mem_ship> ExpandSlot(int shipRid) { Api_Result <Mem_ship> api_Result = new Api_Result <Mem_ship>(); Mem_ship mem_ship = Comm_UserDatas.Instance.User_ship.get_Item(shipRid); Mem_shipBase mem_shipBase = new Mem_shipBase(mem_ship); Mst_ship mst_data = Mst_DataManager.Instance.Mst_ship.get_Item(mem_ship.Ship_id); mem_shipBase.Exslot = -1; mem_ship.Set_ShipParam(mem_shipBase, mst_data, false); api_Result.data = mem_ship; Mem_useitem mem_useitem = null; Comm_UserDatas.Instance.User_useItem.TryGetValue(64, ref mem_useitem); mem_useitem.Sub_UseItem(1); return(api_Result); }
private Mem_ship getMemShip(int rid, int mst_id, int level) { Mst_ship mst_ship = Mst_DataManager.Instance.Mst_ship.get_Item(mst_id); Array values = Enum.GetValues(typeof(Mem_ship.enumKyoukaIdx)); Dictionary <Mem_ship.enumKyoukaIdx, int> dictionary = new Dictionary <Mem_ship.enumKyoukaIdx, int>(); using (IEnumerator enumerator = values.GetEnumerator()) { while (enumerator.MoveNext()) { object current = enumerator.get_Current(); dictionary.Add((Mem_ship.enumKyoukaIdx)((int)current), 0); } } Mem_shipBase baseData = new Mem_shipBase(rid, mst_ship, level, dictionary); Mem_ship mem_ship = new Mem_ship(); mem_ship.Set_ShipParam(baseData, mst_ship, true); return(mem_ship); }
public bool NewGamePlus(ICreateNewUser createInstance, string nickName, DifficultKind selectedRank, int firstShipId) { if (createInstance == null) { return(false); } bool flag = Utils.IsGameClear(); List <DifficultKind> kind = User_record.ClearDifficult.ToList(); PurgeUserData(createInstance, plusGame: true); if (flag) { Add_Useitem(55, 1); } foreach (Mem_book item in User_plus.Ship_book) { Ship_book.Add(item.Table_id, item); } foreach (Mem_book item2 in User_plus.Slot_book) { Slot_book.Add(item2.Table_id, item2); } User_basic = new Mem_basic(); User_basic.UpdateNickName(nickName); User_basic.SetDifficult(selectedRank); User_record = new Mem_record(createInstance, User_plus, kind); User_turn = new Mem_turn(); User_deckpractice = new Mem_deckpractice(); if (User_ndock.Count == 0) { Add_Ndock(1); Add_Ndock(1); } if (User_kdock.Count == 0) { Add_Kdock(); Add_Kdock(); } initMaterials(selectedRank); Add_Deck(1); User_room[1].getFurnitureDatas(); foreach (Mem_furniture item3 in User_plus.Furniture) { User_furniture.Add(item3.Rid, item3); } foreach (Mem_slotitem item4 in User_plus.Slotitem) { User_slot.Add(item4.Rid, item4); } foreach (Mem_shipBase item5 in User_plus.Ship) { Mem_ship mem_ship = new Mem_ship(); Mst_ship mst_data = Mst_DataManager.Instance.Mst_ship[item5.Ship_id]; mem_ship.Set_ShipParam(item5, mst_data, enemy_flag: false); mem_ship.Set_ShipParamNewGamePlus(createInstance); User_ship.Add(mem_ship.Rid, mem_ship); } List <int> list = Add_Ship(new List <int> { firstShipId }); Instance.User_deck[1].Ship[0] = list[0]; User_quest = new Dictionary <int, Mem_quest>(); foreach (int key in Mst_DataManager.Instance.Mst_maparea.Keys) { Add_EscortDeck(key, key); } initTanker(); UpdateDeckShipLocale(); return(true); }
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); }
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); }
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); }
public Api_Result <SlotSetChkResult_Slot> SlotSet(int ship_rid, int slot_rid, int equip_idx) { Api_Result <SlotSetChkResult_Slot> api_Result = new Api_Result <SlotSetChkResult_Slot>(); SlotSetChkResult_Slot slotSetChkResult_Slot = this.IsValidSlotSet(ship_rid, slot_rid, equip_idx); if (slotSetChkResult_Slot != SlotSetChkResult_Slot.Ok) { api_Result.state = Api_Result_State.Parameter_Error; api_Result.data = slotSetChkResult_Slot; return(api_Result); } Mem_ship mem_ship = Comm_UserDatas.Instance.User_ship.get_Item(ship_rid); Mem_slotitem mem_slotitem = null; Comm_UserDatas.Instance.User_slot.TryGetValue(slot_rid, ref mem_slotitem); int num = mem_ship.Slot.FindIndex((int x) => x == -1); if (num != -1 && num < equip_idx) { equip_idx = num; } Mem_shipBase mem_shipBase = new Mem_shipBase(mem_ship); Mem_slotitem mem_slotitem2 = null; Comm_UserDatas.Instance.User_slot.TryGetValue(mem_ship.Slot.get_Item(equip_idx), ref mem_slotitem2); int preCost = 0; int afterCost = 0; OnslotChangeType slotChangeCost = Mst_slotitem_cost.GetSlotChangeCost(mem_ship.Slot.get_Item(equip_idx), slot_rid, out preCost, out afterCost); int num2 = mem_ship.Onslot.get_Item(equip_idx); if (slotChangeCost == OnslotChangeType.OtherToPlane) { num2 = Mst_DataManager.Instance.Mst_ship.get_Item(mem_ship.Ship_id).Maxeq.get_Item(equip_idx); } int slotChangeBauxiteNum = Mst_slotitem_cost.GetSlotChangeBauxiteNum(slotChangeCost, preCost, afterCost, num2); if (slotChangeBauxiteNum < 0) { if (slotChangeCost == OnslotChangeType.PlaneToPlane) { api_Result.data = SlotSetChkResult_Slot.OkBauxiteUseHighCost; } else if (slotChangeCost == OnslotChangeType.OtherToPlane) { api_Result.data = SlotSetChkResult_Slot.OkBauxiteUse; mem_shipBase.Onslot.set_Item(equip_idx, num2); } Comm_UserDatas.Instance.User_material.get_Item(enumMaterialCategory.Bauxite).Sub_Material(Math.Abs(slotChangeBauxiteNum)); } else { if (slotChangeCost == OnslotChangeType.PlaneOther) { mem_shipBase.Onslot.set_Item(equip_idx, 0); } api_Result.data = SlotSetChkResult_Slot.Ok; Comm_UserDatas.Instance.User_material.get_Item(enumMaterialCategory.Bauxite).Add_Material(slotChangeBauxiteNum); } mem_shipBase.Slot.set_Item(equip_idx, slot_rid); if (mem_slotitem2 != null) { mem_slotitem2.UnEquip(); } if (slot_rid != -1) { mem_slotitem.Equip(ship_rid); } mem_ship.Set_ShipParam(mem_shipBase, Mst_DataManager.Instance.Mst_ship.get_Item(mem_shipBase.Ship_id), false); if (slot_rid == -1) { mem_ship.TrimSlot(); } return(api_Result); }
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); }
private QuestItemGetFmt _ItemGet(int type, int id, int count, bool maxExpFlag, bool useCrewFlag) { QuestItemGetFmt questItemGetFmt = new QuestItemGetFmt(); questItemGetFmt.Category = (QuestItemGetKind)type; questItemGetFmt.Id = id; questItemGetFmt.Count = count; questItemGetFmt.IsUseCrewItem = useCrewFlag; if (questItemGetFmt.Category == QuestItemGetKind.Material) { enumMaterialCategory id2 = (enumMaterialCategory)questItemGetFmt.Id; Comm_UserDatas.Instance.User_material[id2].Add_Material(questItemGetFmt.Count); } else if (questItemGetFmt.Category == QuestItemGetKind.Deck) { Comm_UserDatas.Instance.Add_Deck(questItemGetFmt.Id); } else if (questItemGetFmt.Category == QuestItemGetKind.LargeBuild) { Comm_UserDatas.Instance.User_basic.OpenLargeDock(); } else if (questItemGetFmt.Category == QuestItemGetKind.Ship) { Comm_UserDatas.Instance.Add_Ship(questItemGetFmt.createIds()); } else if (questItemGetFmt.Category == QuestItemGetKind.SlotItem) { Comm_UserDatas.Instance.Add_Slot(questItemGetFmt.createIds()); } else if (questItemGetFmt.Category == QuestItemGetKind.FurnitureBox || questItemGetFmt.Category == QuestItemGetKind.UseItem) { if (questItemGetFmt.Id == 63) { questItemGetFmt.IsQuestExtend = Comm_UserDatas.Instance.User_basic.QuestExtend(Mst_DataManager.Instance.Mst_const); } else { Comm_UserDatas.Instance.Add_Useitem(questItemGetFmt.Id, questItemGetFmt.Count); } } else if (questItemGetFmt.Category == QuestItemGetKind.Furniture) { Comm_UserDatas.Instance.Add_Furniture(questItemGetFmt.Id); } else if (questItemGetFmt.Category == QuestItemGetKind.Exchange) { questItemGetFmt.FromId = mst_slotitemchange[id][0]; questItemGetFmt.Id = mst_slotitemchange[id][1]; int key = Comm_UserDatas.Instance.User_deck[1].Ship[0]; Mem_ship mem_ship = Comm_UserDatas.Instance.User_ship[key]; int num = findModelChangeEnableSlotPos(mem_ship.Slot, questItemGetFmt.FromId, maxExpFlag); if (num < 0) { return(null); } Mem_slotitem obj = Comm_UserDatas.Instance.User_slot[mem_ship.Slot[num]]; ((Mem_slotitem.IMemSlotIdOperator) this).ChangeSlotId(obj, questItemGetFmt.Id); Mem_shipBase baseData = new Mem_shipBase(mem_ship); mem_ship.Set_ShipParam(baseData, Mst_DataManager.Instance.Mst_ship[mem_ship.Ship_id], enemy_flag: false); if (questItemGetFmt.IsUseCrewItem && Comm_UserDatas.Instance.User_useItem.TryGetValue(70, out Mem_useitem value)) { value.Sub_UseItem(1); } } else if (questItemGetFmt.Category == QuestItemGetKind.Spoint) { Comm_UserDatas.Instance.User_basic.AddPoint(questItemGetFmt.Count); } else if (questItemGetFmt.Category == QuestItemGetKind.DeckPractice) { Comm_UserDatas.Instance.User_deckpractice.StateChange((DeckPracticeType)questItemGetFmt.Id, state: true); } else { if (questItemGetFmt.Category != QuestItemGetKind.Tanker) { return(null); } Comm_UserDatas.Instance.Add_Tanker(questItemGetFmt.Count); } return(questItemGetFmt); }
private bool getCombatRationResult(out Dictionary <int, List <Mst_slotitem> > useShipInfo, out List <int> givenShips) { int mapBattleCellPassCount = mapInstance.MapBattleCellPassCount; useShipInfo = null; givenShips = null; if (mapBattleCellPassCount < 2) { return(false); } Dictionary <int, List <Mst_slotitem> > dictionary = new Dictionary <int, List <Mst_slotitem> >(); List <int> list = new List <int>(); HashSet <int> hashSet = new HashSet <int>(); hashSet.Add(145); hashSet.Add(150); HashSet <int> searchIds = hashSet; Dictionary <int, List <int> > dictionary2 = new Dictionary <int, List <int> >(); Dictionary <int, int> dictionary3 = userSubInfo.Keys.ToDictionary((int key) => key, (int value) => 0); for (int i = 0; i < userData.ShipData.Count; i++) { Mem_ship mem_ship = userData.ShipData[i]; if (!mem_ship.IsFight()) { continue; } Dictionary <int, List <int> > slotIndexFromId = mem_ship.GetSlotIndexFromId(searchIds); if ((slotIndexFromId[145].Count == 0 && slotIndexFromId[150].Count == 0) || !isRationLotteryWinning(mapBattleCellPassCount, mem_ship.Luck)) { continue; } List <int> rationRecoveryShips = getRationRecoveryShips(i); if (rationRecoveryShips.Count != 0) { dictionary.Add(mem_ship.Rid, new List <Mst_slotitem>()); int num = 0; List <int> list2 = new List <int>(); if (slotIndexFromId[145].Count > 0) { num++; int index = slotIndexFromId[145].Count - 1; list2.Add(slotIndexFromId[145][index]); dictionary[mem_ship.Rid].Add(Mst_DataManager.Instance.Mst_Slotitem[145]); } if (slotIndexFromId[150].Count > 0) { num += 2; int index2 = slotIndexFromId[150].Count - 1; list2.Add(slotIndexFromId[150][index2]); dictionary[mem_ship.Rid].Add(Mst_DataManager.Instance.Mst_Slotitem[150]); } Dictionary <int, int> dictionary4; Dictionary <int, int> dictionary5 = dictionary4 = dictionary3; int rid; int key2 = rid = mem_ship.Rid; rid = dictionary4[rid]; dictionary5[key2] = rid + getCombatRationCondPlus(num, givenShip: false); dictionary2.Add(i, list2); rationRecoveryShips.Remove(mem_ship.Rid); list.AddRange(rationRecoveryShips); foreach (int item2 in rationRecoveryShips) { Dictionary <int, int> dictionary6; Dictionary <int, int> dictionary7 = dictionary6 = dictionary3; int key3 = rid = item2; rid = dictionary6[rid]; dictionary7[key3] = rid + getCombatRationCondPlus(num, givenShip: true); } } } if (dictionary2.Count == 0) { return(false); } List <int> list3 = new List <int>(); Dictionary <int, Mst_ship> mst_ship = Mst_DataManager.Instance.Mst_ship; foreach (KeyValuePair <int, List <int> > item3 in dictionary2) { Mem_ship mem_ship2 = userData.ShipData[item3.Key]; Mem_shipBase mem_shipBase = new Mem_shipBase(mem_ship2); List <Mst_slotitem> list4 = userData.SlotData[item3.Key]; foreach (int item4 in item3.Value) { int item; if (item4 != int.MaxValue) { item = mem_ship2.Slot[item4]; mem_shipBase.Slot[item4] = -1; list4[item4] = null; } else { item = mem_ship2.Exslot; mem_shipBase.Exslot = -1; } list3.Add(item); } mem_ship2.Set_ShipParam(mem_shipBase, mst_ship[mem_shipBase.Ship_id], enemy_flag: false); mem_ship2.TrimSlot(); list4.RemoveAll((Mst_slotitem x) => x == null); } foreach (KeyValuePair <int, int> item5 in dictionary3) { Mem_ship shipInstance = userSubInfo[item5.Key].ShipInstance; int value2 = item5.Value; shipInstance.AddRationItemCond(value2); } Comm_UserDatas.Instance.Remove_Slot(list3); useShipInfo = dictionary; givenShips = list.Distinct().ToList(); return(true); }
public Api_Result <SlotSetChkResult_Slot> SlotSet(int ship_rid, int slot_rid, int equip_idx) { Api_Result <SlotSetChkResult_Slot> api_Result = new Api_Result <SlotSetChkResult_Slot>(); SlotSetChkResult_Slot slotSetChkResult_Slot = IsValidSlotSet(ship_rid, slot_rid, equip_idx); if (slotSetChkResult_Slot != 0) { api_Result.state = Api_Result_State.Parameter_Error; api_Result.data = slotSetChkResult_Slot; return(api_Result); } Mem_ship mem_ship = Comm_UserDatas.Instance.User_ship[ship_rid]; Mem_slotitem value = null; Comm_UserDatas.Instance.User_slot.TryGetValue(slot_rid, out value); int num = mem_ship.Slot.FindIndex((int x) => x == -1); if (num != -1 && num < equip_idx) { equip_idx = num; } Mem_shipBase mem_shipBase = new Mem_shipBase(mem_ship); Mem_slotitem value2 = null; Comm_UserDatas.Instance.User_slot.TryGetValue(mem_ship.Slot[equip_idx], out value2); int preCost = 0; int afterCost = 0; OnslotChangeType slotChangeCost = Mst_slotitem_cost.GetSlotChangeCost(mem_ship.Slot[equip_idx], slot_rid, out preCost, out afterCost); int num2 = mem_ship.Onslot[equip_idx]; if (slotChangeCost == OnslotChangeType.OtherToPlane) { num2 = Mst_DataManager.Instance.Mst_ship[mem_ship.Ship_id].Maxeq[equip_idx]; } int slotChangeBauxiteNum = Mst_slotitem_cost.GetSlotChangeBauxiteNum(slotChangeCost, preCost, afterCost, num2); if (slotChangeBauxiteNum < 0) { switch (slotChangeCost) { case OnslotChangeType.PlaneToPlane: api_Result.data = SlotSetChkResult_Slot.OkBauxiteUseHighCost; break; case OnslotChangeType.OtherToPlane: api_Result.data = SlotSetChkResult_Slot.OkBauxiteUse; mem_shipBase.Onslot[equip_idx] = num2; break; } Comm_UserDatas.Instance.User_material[enumMaterialCategory.Bauxite].Sub_Material(Math.Abs(slotChangeBauxiteNum)); } else { if (slotChangeCost == OnslotChangeType.PlaneOther) { mem_shipBase.Onslot[equip_idx] = 0; } api_Result.data = SlotSetChkResult_Slot.Ok; Comm_UserDatas.Instance.User_material[enumMaterialCategory.Bauxite].Add_Material(slotChangeBauxiteNum); } mem_shipBase.Slot[equip_idx] = slot_rid; value2?.UnEquip(); if (slot_rid != -1) { value.Equip(ship_rid); } mem_ship.Set_ShipParam(mem_shipBase, Mst_DataManager.Instance.Mst_ship[mem_shipBase.Ship_id], enemy_flag: false); if (slot_rid == -1) { mem_ship.TrimSlot(); } return(api_Result); }
private bool getCombatRationResult(out Dictionary <int, List <Mst_slotitem> > useShipInfo, out List <int> givenShips) { int mapBattleCellPassCount = this.mapInstance.MapBattleCellPassCount; useShipInfo = null; givenShips = null; if (mapBattleCellPassCount < 2) { return(false); } Dictionary <int, List <Mst_slotitem> > dictionary = new Dictionary <int, List <Mst_slotitem> >(); List <int> list = new List <int>(); HashSet <int> hashSet = new HashSet <int>(); hashSet.Add(145); hashSet.Add(150); HashSet <int> searchIds = hashSet; Dictionary <int, List <int> > dictionary2 = new Dictionary <int, List <int> >(); Dictionary <int, int> dictionary3 = Enumerable.ToDictionary <int, int, int>(this.userSubInfo.get_Keys(), (int key) => key, (int value) => 0); for (int i = 0; i < this.userData.ShipData.get_Count(); i++) { Mem_ship mem_ship = this.userData.ShipData.get_Item(i); if (mem_ship.IsFight()) { Dictionary <int, List <int> > slotIndexFromId = mem_ship.GetSlotIndexFromId(searchIds); if (slotIndexFromId.get_Item(145).get_Count() != 0 || slotIndexFromId.get_Item(150).get_Count() != 0) { if (this.isRationLotteryWinning(mapBattleCellPassCount, mem_ship.Luck)) { List <int> rationRecoveryShips = this.getRationRecoveryShips(i); if (rationRecoveryShips.get_Count() != 0) { dictionary.Add(mem_ship.Rid, new List <Mst_slotitem>()); int num = 0; List <int> list2 = new List <int>(); if (slotIndexFromId.get_Item(145).get_Count() > 0) { num++; int num2 = slotIndexFromId.get_Item(145).get_Count() - 1; list2.Add(slotIndexFromId.get_Item(145).get_Item(num2)); dictionary.get_Item(mem_ship.Rid).Add(Mst_DataManager.Instance.Mst_Slotitem.get_Item(145)); } if (slotIndexFromId.get_Item(150).get_Count() > 0) { num += 2; int num3 = slotIndexFromId.get_Item(150).get_Count() - 1; list2.Add(slotIndexFromId.get_Item(150).get_Item(num3)); dictionary.get_Item(mem_ship.Rid).Add(Mst_DataManager.Instance.Mst_Slotitem.get_Item(150)); } Dictionary <int, int> dictionary4; Dictionary <int, int> expr_23B = dictionary4 = dictionary3; int num4; int expr_245 = num4 = mem_ship.Rid; num4 = dictionary4.get_Item(num4); expr_23B.set_Item(expr_245, num4 + this.getCombatRationCondPlus(num, false)); dictionary2.Add(i, list2); rationRecoveryShips.Remove(mem_ship.Rid); list.AddRange(rationRecoveryShips); using (List <int> .Enumerator enumerator = rationRecoveryShips.GetEnumerator()) { while (enumerator.MoveNext()) { int current = enumerator.get_Current(); Dictionary <int, int> dictionary5; Dictionary <int, int> expr_29F = dictionary5 = dictionary3; int expr_2A4 = num4 = current; num4 = dictionary5.get_Item(num4); expr_29F.set_Item(expr_2A4, num4 + this.getCombatRationCondPlus(num, true)); } } } } } } } if (dictionary2.get_Count() == 0) { return(false); } List <int> list3 = new List <int>(); Dictionary <int, Mst_ship> mst_ship = Mst_DataManager.Instance.Mst_ship; using (Dictionary <int, List <int> > .Enumerator enumerator2 = dictionary2.GetEnumerator()) { while (enumerator2.MoveNext()) { KeyValuePair <int, List <int> > current2 = enumerator2.get_Current(); Mem_ship mem_ship2 = this.userData.ShipData.get_Item(current2.get_Key()); Mem_shipBase mem_shipBase = new Mem_shipBase(mem_ship2); List <Mst_slotitem> list4 = this.userData.SlotData.get_Item(current2.get_Key()); using (List <int> .Enumerator enumerator3 = current2.get_Value().GetEnumerator()) { while (enumerator3.MoveNext()) { int current3 = enumerator3.get_Current(); int num5; if (current3 != 2147483647) { num5 = mem_ship2.Slot.get_Item(current3); mem_shipBase.Slot.set_Item(current3, -1); list4.set_Item(current3, null); } else { num5 = mem_ship2.Exslot; mem_shipBase.Exslot = -1; } list3.Add(num5); } } mem_ship2.Set_ShipParam(mem_shipBase, mst_ship.get_Item(mem_shipBase.Ship_id), false); mem_ship2.TrimSlot(); list4.RemoveAll((Mst_slotitem x) => x == null); } } using (Dictionary <int, int> .Enumerator enumerator4 = dictionary3.GetEnumerator()) { while (enumerator4.MoveNext()) { KeyValuePair <int, int> current4 = enumerator4.get_Current(); Mem_ship shipInstance = this.userSubInfo.get_Item(current4.get_Key()).ShipInstance; int value2 = current4.get_Value(); shipInstance.AddRationItemCond(value2); } } Comm_UserDatas.Instance.Remove_Slot(list3); useShipInfo = dictionary; givenShips = Enumerable.ToList <int>(Enumerable.Distinct <int>(list)); return(true); }
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); } } }
public bool NewGamePlus(ICreateNewUser createInstance, string nickName, DifficultKind selectedRank, int firstShipId) { if (createInstance == null) { return(false); } bool flag = Utils.IsGameClear(); List <DifficultKind> kind = Enumerable.ToList <DifficultKind>(this.User_record.ClearDifficult); this.PurgeUserData(createInstance, true); if (flag) { this.Add_Useitem(55, 1); } using (List <Mem_book> .Enumerator enumerator = this.User_plus.Ship_book.GetEnumerator()) { while (enumerator.MoveNext()) { Mem_book current = enumerator.get_Current(); this.Ship_book.Add(current.Table_id, current); } } using (List <Mem_book> .Enumerator enumerator2 = this.User_plus.Slot_book.GetEnumerator()) { while (enumerator2.MoveNext()) { Mem_book current2 = enumerator2.get_Current(); this.Slot_book.Add(current2.Table_id, current2); } } this.User_basic = new Mem_basic(); this.User_basic.UpdateNickName(nickName); this.User_basic.SetDifficult(selectedRank); this.User_record = new Mem_record(createInstance, this.User_plus, kind); this.User_turn = new Mem_turn(); this.User_deckpractice = new Mem_deckpractice(); if (this.User_ndock.get_Count() == 0) { this.Add_Ndock(1); this.Add_Ndock(1); } if (this.User_kdock.get_Count() == 0) { this.Add_Kdock(); this.Add_Kdock(); } this.initMaterials(selectedRank); this.Add_Deck(1); List <Mst_furniture> furnitureDatas = this.User_room.get_Item(1).getFurnitureDatas(); using (List <Mem_furniture> .Enumerator enumerator3 = this.User_plus.Furniture.GetEnumerator()) { while (enumerator3.MoveNext()) { Mem_furniture current3 = enumerator3.get_Current(); this.User_furniture.Add(current3.Rid, current3); } } using (List <Mem_slotitem> .Enumerator enumerator4 = this.User_plus.Slotitem.GetEnumerator()) { while (enumerator4.MoveNext()) { Mem_slotitem current4 = enumerator4.get_Current(); this.User_slot.Add(current4.Rid, current4); } } using (List <Mem_shipBase> .Enumerator enumerator5 = this.User_plus.Ship.GetEnumerator()) { while (enumerator5.MoveNext()) { Mem_shipBase current5 = enumerator5.get_Current(); Mem_ship mem_ship = new Mem_ship(); Mst_ship mst_data = Mst_DataManager.Instance.Mst_ship.get_Item(current5.Ship_id); mem_ship.Set_ShipParam(current5, mst_data, false); mem_ship.Set_ShipParamNewGamePlus(createInstance); this.User_ship.Add(mem_ship.Rid, mem_ship); } } List <int> list = new List <int>(); list.Add(firstShipId); List <int> list2 = this.Add_Ship(list); Comm_UserDatas.Instance.User_deck.get_Item(1).Ship[0] = list2.get_Item(0); this.User_quest = new Dictionary <int, Mem_quest>(); using (Dictionary <int, Mst_maparea> .KeyCollection.Enumerator enumerator6 = Mst_DataManager.Instance.Mst_maparea.get_Keys().GetEnumerator()) { while (enumerator6.MoveNext()) { int current6 = enumerator6.get_Current(); this.Add_EscortDeck(current6, current6); } } this.initTanker(); this.UpdateDeckShipLocale(); return(true); }
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); } } } } } } }