public Api_Result <Mem_ndock> Start(int rid, int ship_rid, bool highspeed) { Api_Result <Mem_ndock> api_Result = new Api_Result <Mem_ndock>(); Mem_ndock mem_ndock = null; if (!Comm_UserDatas.Instance.User_ndock.TryGetValue(rid, ref mem_ndock)) { api_Result.state = Api_Result_State.Parameter_Error; return(api_Result); } if (mem_ndock.State != NdockStates.EMPTY) { api_Result.state = Api_Result_State.Parameter_Error; return(api_Result); } Mem_ship mem_ship = null; if (!Comm_UserDatas.Instance.User_ship.TryGetValue(ship_rid, ref mem_ship)) { api_Result.state = Api_Result_State.Parameter_Error; return(api_Result); } if (mem_ship.IsBlingShip()) { api_Result.state = Api_Result_State.Parameter_Error; return(api_Result); } Dictionary <enumMaterialCategory, int> ndockMaterialNum = mem_ship.GetNdockMaterialNum(); if (ndockMaterialNum == null) { api_Result.state = Api_Result_State.Parameter_Error; return(api_Result); } int num = (!highspeed) ? 0 : 1; if (ndockMaterialNum.get_Item(enumMaterialCategory.Fuel) > Comm_UserDatas.Instance.User_material.get_Item(enumMaterialCategory.Fuel).Value || ndockMaterialNum.get_Item(enumMaterialCategory.Steel) > Comm_UserDatas.Instance.User_material.get_Item(enumMaterialCategory.Steel).Value || num > Comm_UserDatas.Instance.User_material.get_Item(enumMaterialCategory.Repair_Kit).Value) { api_Result.state = Api_Result_State.Parameter_Error; return(api_Result); } mem_ship.BlingWaitToStop(); if (!highspeed) { int ndockTimeSpan = mem_ship.GetNdockTimeSpan(); mem_ndock.RecoverStart(ship_rid, ndockMaterialNum, ndockTimeSpan); } else { mem_ndock.RecoverStart(ship_rid, ndockMaterialNum, 0); mem_ndock.RecoverEnd(false); Comm_UserDatas.Instance.User_material.get_Item(enumMaterialCategory.Repair_Kit).Sub_Material(1); } api_Result.data = mem_ndock; QuestSupply questSupply = new QuestSupply(); questSupply.ExecuteCheck(); return(api_Result); }
public Api_Result <Mem_ndock> Start(int rid, int ship_rid, bool highspeed) { Api_Result <Mem_ndock> api_Result = new Api_Result <Mem_ndock>(); Mem_ndock value = null; if (!Comm_UserDatas.Instance.User_ndock.TryGetValue(rid, out value)) { api_Result.state = Api_Result_State.Parameter_Error; return(api_Result); } if (value.State != NdockStates.EMPTY) { api_Result.state = Api_Result_State.Parameter_Error; return(api_Result); } Mem_ship value2 = null; if (!Comm_UserDatas.Instance.User_ship.TryGetValue(ship_rid, out value2)) { api_Result.state = Api_Result_State.Parameter_Error; return(api_Result); } if (value2.IsBlingShip()) { api_Result.state = Api_Result_State.Parameter_Error; return(api_Result); } Dictionary <enumMaterialCategory, int> ndockMaterialNum = value2.GetNdockMaterialNum(); if (ndockMaterialNum == null) { api_Result.state = Api_Result_State.Parameter_Error; return(api_Result); } int num = highspeed ? 1 : 0; if (ndockMaterialNum[enumMaterialCategory.Fuel] > Comm_UserDatas.Instance.User_material[enumMaterialCategory.Fuel].Value || ndockMaterialNum[enumMaterialCategory.Steel] > Comm_UserDatas.Instance.User_material[enumMaterialCategory.Steel].Value || num > Comm_UserDatas.Instance.User_material[enumMaterialCategory.Repair_Kit].Value) { api_Result.state = Api_Result_State.Parameter_Error; return(api_Result); } value2.BlingWaitToStop(); if (!highspeed) { int ndockTimeSpan = value2.GetNdockTimeSpan(); value.RecoverStart(ship_rid, ndockMaterialNum, ndockTimeSpan); } else { value.RecoverStart(ship_rid, ndockMaterialNum, 0); value.RecoverEnd(timeChk: false); Comm_UserDatas.Instance.User_material[enumMaterialCategory.Repair_Kit].Sub_Material(1); } api_Result.data = value; QuestSupply questSupply = new QuestSupply(); questSupply.ExecuteCheck(); return(api_Result); }
public Api_Result <bool> Charge(List <int> ship_rids, enumHokyuType type) { Api_Result <bool> rslt = new Api_Result <bool>(); rslt.data = false; if (ship_rids == null || ship_rids.Count == 0) { rslt.state = Api_Result_State.Parameter_Error; return(rslt); } List <Mem_ship> ships = new List <Mem_ship>(); ship_rids.ForEach(delegate(int x) { Mem_ship value = null; if (!Comm_UserDatas.Instance.User_ship.TryGetValue(x, out value)) { rslt.state = Api_Result_State.Parameter_Error; } else { ships.Add(value); } }); if (rslt.state == Api_Result_State.Parameter_Error) { ships.Clear(); return(rslt); } HashSet <int> hashSet = new HashSet <int>(); int num = 0; foreach (Mem_ship item in ships) { if (Mst_DataManager.Instance.Mst_ship.ContainsKey(item.Ship_id)) { int fuel = item.Fuel; int bull = item.Bull; switch (type) { case enumHokyuType.Fuel: case enumHokyuType.Bull: { bool flag3 = ChargeDataSet(type, item); if (bull < item.Bull || fuel < item.Fuel) { item.SumLovToCharge(); num++; } HashSet <int> hashSet3 = ChargeDataSet_Onslot(enumHokyuType.All, item); foreach (int item2 in hashSet3) { hashSet.Add(item2); } if (flag3 || !hashSet3.Contains(-1)) { break; } throw new NotImplementedException("なにこれ"); // goto end_IL_00a0; } case enumHokyuType.All: { bool flag = ChargeDataSet(enumHokyuType.Bull, item); bool flag2 = ChargeDataSet(enumHokyuType.Fuel, item); HashSet <int> hashSet2 = ChargeDataSet_Onslot(enumHokyuType.All, item); if (bull < item.Bull || fuel < item.Fuel) { item.SumLovToCharge(); num++; } foreach (int item3 in hashSet2) { hashSet.Add(item3); } if (flag || flag2 || !hashSet2.Contains(-1)) { break; } throw new NotImplementedException("なにこれ"); // goto end_IL_00a0; } } } } if (hashSet.Contains(-2)) { rslt.data = false; } else { rslt.data = true; } QuestSupply questSupply = new QuestSupply(num); questSupply.ExecuteCheck(); return(rslt); }
public Api_Result <bool> Charge(List <int> ship_rids, Api_req_Hokyu.enumHokyuType type) { Api_Result <bool> rslt = new Api_Result <bool>(); rslt.data = false; if (ship_rids == null || ship_rids.get_Count() == 0) { rslt.state = Api_Result_State.Parameter_Error; return(rslt); } List <Mem_ship> ships = new List <Mem_ship>(); ship_rids.ForEach(delegate(int x) { Mem_ship mem_ship = null; if (!Comm_UserDatas.Instance.User_ship.TryGetValue(x, ref mem_ship)) { rslt.state = Api_Result_State.Parameter_Error; return; } ships.Add(mem_ship); }); if (rslt.state == Api_Result_State.Parameter_Error) { ships.Clear(); return(rslt); } HashSet <int> hashSet = new HashSet <int>(); int num = 0; using (List <Mem_ship> .Enumerator enumerator = ships.GetEnumerator()) { while (enumerator.MoveNext()) { Mem_ship current = enumerator.get_Current(); if (Mst_DataManager.Instance.Mst_ship.ContainsKey(current.Ship_id)) { int fuel = current.Fuel; int bull = current.Bull; if (type == Api_req_Hokyu.enumHokyuType.Fuel || type == Api_req_Hokyu.enumHokyuType.Bull) { bool flag = this.ChargeDataSet(type, current); if (bull < current.Bull || fuel < current.Fuel) { current.SumLovToCharge(); num++; } HashSet <int> hashSet2 = this.ChargeDataSet_Onslot(Api_req_Hokyu.enumHokyuType.All, current); using (HashSet <int> .Enumerator enumerator2 = hashSet2.GetEnumerator()) { while (enumerator2.MoveNext()) { int current2 = enumerator2.get_Current(); hashSet.Add(current2); } } if (!flag && hashSet2.Contains(-1)) { break; } } else if (type == Api_req_Hokyu.enumHokyuType.All) { bool flag2 = this.ChargeDataSet(Api_req_Hokyu.enumHokyuType.Bull, current); bool flag3 = this.ChargeDataSet(Api_req_Hokyu.enumHokyuType.Fuel, current); HashSet <int> hashSet3 = this.ChargeDataSet_Onslot(Api_req_Hokyu.enumHokyuType.All, current); if (bull < current.Bull || fuel < current.Fuel) { current.SumLovToCharge(); num++; } using (HashSet <int> .Enumerator enumerator3 = hashSet3.GetEnumerator()) { while (enumerator3.MoveNext()) { int current3 = enumerator3.get_Current(); hashSet.Add(current3); } } if (!flag2 && !flag3 && hashSet3.Contains(-1)) { break; } } } } } if (hashSet.Contains(-2)) { rslt.data = false; } else { rslt.data = true; } QuestSupply questSupply = new QuestSupply(num); questSupply.ExecuteCheck(); return(rslt); }