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 <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); }