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> /// 砲雷撃戦の結果処理 /// </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> /// マスタデータから装備情報を取得して設定 /// SlotItemTypeは設定済みと仮定 /// </summary> /// <param name="itemMaster"></param> private void ApplyMasterSlotItemInfo(MasterData.Item itemMaster) { var itemInfo = itemMaster.GetItemParam(SlotItemType); SetSlotItemParam(itemInfo); }