/// <summary> /// 装備を改装 /// </summary> /// <param name="JSON"></param> /// <returns></returns> public bool RemodelSlotItem(string JSON, MasterData.Item itemMaster) { var json = JsonConvert.DeserializeObject <KCB.api_req_kousyou.RemodelSlot>(JSON); if ((int)json.api_result != 1) { return(false); } var dat = json.api_data; if (dat.api_remodel_flag != 1) { return(false); } var item = GetItem(dat.api_after_slot.api_id); item.Remodel(dat.api_after_slot, itemMaster); if (dat.api_use_slot_id != null) { DestoryItem(dat.api_use_slot_id.ToArray()); } return(true); }
/// <summary> /// 装備改装 /// </summary> /// <param name="data">改装情報</param> /// <param name="itemMaster">マスタデータ</param> public void Remodel(KCB.api_req_kousyou.RemodelSlot.ApiData.ApiAfterSlot data, MasterData.Item itemMaster) { ItemUID = data.api_id; SlotItemType = data.api_slotitem_id; Locked = data.api_locked == 1; Level = data.api_level; ApplyMasterSlotItemInfo(itemMaster); }
/// <summary> /// アイテム一覧の更新 /kcsapi/api_get_member/slot_item /// </summary> /// <param name="JSON"></param> /// <returns>成功すればtrue</returns> public bool UpdateItem(string JSON, MasterData.Item itemMaster) { var json = JsonConvert.DeserializeObject <KCB.api_get_member.Slot_Item>(JSON); if ((int)json.api_result != 1) { return(false); } return(UpdateItem(json.api_data, itemMaster)); }
/// <summary> /// アイテム一覧の更新 /kcsapi/api_get_member/require_info /// </summary> /// <param name="api_data"></param> /// <param name="itemMaster"></param> /// <returns></returns> public bool UpdateItem(List <KCB.api_get_member.Slot_Item.ApiData> api_data, MasterData.Item itemMaster) { _itemDic.Clear(); foreach (var data in api_data) { var item = new Info(data, itemMaster); _itemDic[data.api_id] = item; // Debug.WriteLine("Item:" + item.ToString()); } return(true); }
/// <summary> /// /kcsapi/api_req_battle_midnight/battle /// 夜戦開始 /// </summary> /// <param name="JSON"></param> public void SwitchNightBattle(string JSON, MasterData.Item _masterItem) { var json = JsonConvert.DeserializeObject <KCB.api_req_sortie.Battle>(JSON); if (json == null) { return; } if (json.api_result != 1) { return; } getHougekiDamage(json.api_data.api_hougeki, _battleResult, _masterItem); }
/// <summary> /// /kcsapi/api_req_kousyou/createitem /// </summary> /// <param name="JSON"></param> /// <param name="itemMaster"></param> /// <returns></returns> public bool AddNewSlotItem(string JSON, MasterData.Item itemMaster) { var json = JsonConvert.DeserializeObject <KCB.api_req_kousyou.CreateItem>(JSON); if (json.api_result != 1) { return(false); } if (json.api_data.api_create_flag != 1) { return(false); } var item = new Info(json.api_data.api_slot_item, itemMaster); _itemDic[json.api_data.api_slot_item.api_id] = item; return(true); }
// public Info(dynamic data) public Info(KCB.api_get_member.Slot_Item.ApiData data, MasterData.Item itemMaster) { Owner = null; ItemUID = data.api_id; SlotItemType = data.api_slotitem_id; Locked = data.api_locked == 1; if (data.api_alv == null) { Level = data.api_level; } else if (data.api_alv > 0) { Level = (int)data.api_alv; } else { Level = data.api_level; } ApplyMasterSlotItemInfo(itemMaster); }
public LogData.CreateItemInfo CreateLogData(string responseJson, IDictionary <string, string> queryParam, MasterData.Item itemData, MemberData.Deck deckDat, MemberData.Ship shipDat, MemberData.Basic basicDat) { // var json = DynamicJson.Parse(oSession.ResponseJSON); var json = JsonConvert.DeserializeObject <KCB.api_req_kousyou.CreateItem>(responseJson); if ((int)json.api_result != 1) { return(null); } var info = new LogData.CreateItemInfo(queryParam, json.api_data); info.OfficeLv = basicDat.Level; var secretary = shipDat.GetShip(deckDat.Secretary); info.SecretaryShip = string.Format("{0}(Lv{1})", secretary.ShipName, secretary.Level); info.MemberID = basicDat.MemberID; if (info.Succeess) { var it = itemData.GetItemParam(info.ItemNameID); info.ItemName = it.Name; info.ItemType = it.Type; } return(info); }
/// <summary> /// /kcsapi/api_req_sortie/battle /// 戦闘開始 /// </summary> /// <param name="JSON"></param> /// <param name="practice">演習の時true</param> /// <param name="_memberShip"></param> /// <param name="_memberDeck"></param> /// <param name="_masterShip"></param> public int ProcessBattle(string JSON, bool practice, MemberData.Ship _memberShip, MemberData.Deck _memberDeck, MasterData.Ship _masterShip, MasterData.Item _masterItem) { var json = JsonConvert.DeserializeObject <KCB.api_req_sortie.Battle>(JSON); if (json == null) { return(0); } if (json.api_result != 1) { return(0); } _practice = practice; var result = json.api_data; var deck_info = _memberDeck.GetFleet(result.api_dock_id); int estimatedBattleTime = InitialPhase; initializeShipData(result, deck_info, _memberShip, _masterShip); //索敵フェイズ if (_battleResult.Friend.SearchResult != Result.FleetState.SearchResultType.索敵なし) { estimatedBattleTime += SearchPhase; } //支援艦隊が来た if (result.api_support_flag > 0 && result.api_support_info != null) { //航空支援(flag=1) if (result.api_support_info.api_support_airatack != null) { Debug.WriteLine("航空支援(味方から敵へ)"); getRaiDamage(result.api_support_info.api_support_airatack.api_stage3.api_edam, _battleResult.Enemy.Ships); estimatedBattleTime += SupportTime; } //砲雷撃支援(flag=2/雷撃,3/砲撃) if (result.api_support_info.api_support_hourai != null) { Debug.WriteLine("砲雷支援(味方から敵へ)"); getRaiDamage(result.api_support_info.api_support_hourai.api_damage, _battleResult.Enemy.Ships); estimatedBattleTime += SupportTime; } } //開幕対潜 if (result.api_opening_taisen_flag == 1 && result.api_opening_taisen != null) { Debug.WriteLine("開幕対潜攻撃"); estimatedBattleTime += getHougekiDamage(result.api_opening_taisen, _battleResult, _masterItem); } // 開幕雷撃 if (result.api_opening_flag == 1 && result.api_opening_atack != null) { Debug.WriteLine("開幕雷撃(敵から味方へ)"); estimatedBattleTime += getRaiDamage(result.api_opening_atack.api_fdam, _battleResult.Friend.Ships); Debug.WriteLine("開幕雷撃(味方から敵へ)"); getRaiDamage(result.api_opening_atack.api_edam, _battleResult.Enemy.Ships); } estimatedBattleTime += Torpedo; // 航空戦 if (result.api_stage_flag[2] == 1 && result.api_kouku.api_stage3 != null) { Debug.WriteLine("航空戦(敵から味方へ)"); estimatedBattleTime += getRaiDamage(result.api_kouku.api_stage3.api_fdam, _battleResult.Friend.Ships); Debug.WriteLine("航空戦(味方から敵へ)"); getRaiDamage(result.api_kouku.api_stage3.api_edam, _battleResult.Enemy.Ships); } estimatedBattleTime += AirBattle; // 砲撃1順目 if (result.api_hourai_flag[0] == 1 && result.api_hougeki1 != null) { Debug.WriteLine("砲撃1順目"); estimatedBattleTime += getHougekiDamage(result.api_hougeki1, _battleResult, _masterItem); } // 砲撃2順目 if (result.api_hourai_flag[1] == 1 && result.api_hougeki2 != null) { Debug.WriteLine("砲撃2順目"); estimatedBattleTime += getHougekiDamage(result.api_hougeki2, _battleResult, _masterItem); } // 砲撃3順目 if (result.api_hourai_flag[2] == 1 && result.api_hougeki3 != null) { Debug.WriteLine("砲撃3順目"); estimatedBattleTime += getHougekiDamage(result.api_hougeki3, _battleResult, _masterItem); } // 雷撃 if (result.api_hourai_flag[3] == 1 && result.api_raigeki != null) { Debug.WriteLine("雷撃(敵から味方へ)"); estimatedBattleTime += getRaiDamage(result.api_raigeki.api_fdam, _battleResult.Friend.Ships); Debug.WriteLine("雷撃(味方から敵へ)"); getRaiDamage(result.api_raigeki.api_edam, _battleResult.Enemy.Ships); } estimatedBattleTime += Torpedo; //夜戦の場合は待つ必要がないから0を返す。 return(result.api_midnight_flag != 0 ? estimatedBattleTime : 0); }
/// <summary> /// 砲雷撃戦の結果処理 /// </summary> /// <param name="hougeki"></param> /// <param name="result"></param> private int getHougekiDamage(KCB.api_req_sortie.Battle.ApiData.ApiHougeki hougeki, Result result, MasterData.Item _masterItem) { if (hougeki == null) { return(0); } //長さが一致しない if (hougeki.api_damage.Count != hougeki.api_df_list.Count) { return(0); } int battleTime = 0; //攻撃先のHPを減算 for (int i = 1; i < hougeki.api_damage.Count; i++) { var targets = (Newtonsoft.Json.Linq.JArray)hougeki.api_df_list[i]; var damages = (Newtonsoft.Json.Linq.JArray)hougeki.api_damage[i]; var weapons = (Newtonsoft.Json.Linq.JArray)hougeki.api_si_list[i]; int from = hougeki.api_at_list[i]; for (int j = 0; j < targets.Count; j++) { int target = (int)targets[j]; double damage = (double)damages[j]; int weapon_id = (int)weapons[j]; var weapon = _masterItem.GetItemParam(weapon_id); if (weapon == null) { Debug.WriteLine(string.Format("砲撃:{0}->{1} ダメージ:{2} 装備:なし", from, target, damage)); } else { Debug.WriteLine(string.Format("砲撃:{0}->{1} ダメージ:{2} 装備:{3}", from, target, damage , weapon.Name)); } if (target > 0 && target <= 6) { var it = result.Friend.Ships[target - 1]; //敵→味方 var critical = it.AddDamage(damage); if (critical) { battleTime += CriticalHitTime; } if (it.Submarine) { battleTime += HouRaiSubmarine; } } else if (target > 0 && target <= 12) { var it = result.Enemy.Ships[target - 7]; //味方→敵 it.AddDamage(damage); if (it.Submarine) { battleTime += HouRaiSubmarine; } } battleTime += HouRai; } } return(battleTime); }
/// <summary> /// /kcsapi/api_req_battle_midnight/sp_midnight /// 開幕夜戦 /// </summary> /// <param name="JSON"></param> /// <param name="_memberShip"></param> /// <param name="_memberDeck"></param> /// <param name="_masterShip"></param> public void ProcessNightBattle(string JSON, MemberData.Ship _memberShip, MemberData.Deck _memberDeck, MasterData.Ship _masterShip, MasterData.Item _masterItem) { var json = JsonConvert.DeserializeObject <KCB.api_req_sortie.Battle>(JSON); if (json == null) { return; } if (json.api_result != 1) { return; } var deck_info = _memberDeck.GetFleet(json.api_data.api_deck_id); initializeShipData(json.api_data, deck_info, _memberShip, _masterShip); getHougekiDamage(json.api_data.api_hougeki, _battleResult, _masterItem); }
/// <summary> /// /kcsapi/api_req_kousyou/getship で生成された新造艦娘の装備を一覧に追加 /// </summary> /// <param name="items">api_slotitem</param> /// <param name="itemMaster">装備情報マスタ</param> public void AddNewSlotItems(List <KCB.api_get_member.Slot_Item.ApiData> items, MasterData.Item itemMaster) { if (items == null) { return; } foreach (var item in items) { var itemInfo = new Info(item, itemMaster); _itemDic[item.api_id] = itemInfo; } }
/// <summary> /// マスタデータから装備情報を取得して設定 /// SlotItemTypeは設定済みと仮定 /// </summary> /// <param name="itemMaster"></param> private void ApplyMasterSlotItemInfo(MasterData.Item itemMaster) { var itemInfo = itemMaster.GetItemParam(SlotItemType); SetSlotItemParam(itemInfo); }