private static string GetEquipmentString(int shipID, int[] slot)
		{
			StringBuilder sb = new StringBuilder();
			ShipDataMaster ship = KCDatabase.Instance.MasterShips[shipID];

			if (ship == null || slot == null) return null;

			for (int i = 0; i < slot.Length; i++)
			{
				var eq = KCDatabase.Instance.MasterEquipments[slot[i]];
				if (eq != null)
					sb.AppendFormat("[{0}] {1}\r\n", ship.Aircraft[i], eq.Name);
			}

			sb.AppendFormat("\r\n昼战 : {0}\r\n夜战 : {1}\r\n",
				Constants.GetDayAttackKind(Calculator.GetDayAttackKind(slot, ship.ShipID, -1)),
				Constants.GetNightAttackKind(Calculator.GetNightAttackKind(slot, ship.ShipID, -1)));

			{
				int aacutin = Calculator.GetAACutinKind(shipID, slot);
				if (aacutin != 0)
				{
					sb.AppendFormat("对空 : {0}\r\n", Constants.GetAACutinKind(aacutin));
				}
			}
			{
				int airsup = Calculator.GetAirSuperiority(slot, ship.Aircraft.ToArray());
				if (airsup > 0)
				{
					sb.AppendFormat("制空战力 : {0}\r\n", airsup);
				}
			}

			return sb.ToString();
		}
        private static Color GetShipNameColor(ShipDataMaster ship)
        {
            switch (ship.AbyssalShipClass)
            {
            case 0:
            case 1:                             //normal
            default:
                return(Color.FromArgb(0x00, 0x00, 0x00));

            case 2:                             //elite
                return(Color.FromArgb(0xFF, 0x00, 0x00));

            case 3:                             //flagship
                return(Color.FromArgb(0xFF, 0x88, 0x00));

            case 4:                             //latemodel / flagship kai
                return(Color.FromArgb(0x00, 0x88, 0xFF));

            case 5:                             //latemodel elite
                return(Color.FromArgb(0x88, 0x00, 0x00));

            case 6:                             //latemodel flagship
                return(Color.FromArgb(0x88, 0x44, 0x00));
            }
        }
            public void Update(int shipID, int[] slot)
            {
                ShipName.Tag = shipID;

                if (shipID == -1)
                {
                    //なし
                    ShipName.Text      = "-";
                    ShipName.ForeColor = Color.FromArgb(0x00, 0x00, 0x00);
                    Equipments.Visible = false;
                    ToolTipInfo.SetToolTip(ShipName, null);
                    ToolTipInfo.SetToolTip(Equipments, null);
                }
                else
                {
                    ShipDataMaster ship = KCDatabase.Instance.MasterShips[shipID];


                    ShipName.Text      = ship.Name;
                    ShipName.ForeColor = GetShipNameColor(ship);
                    ToolTipInfo.SetToolTip(ShipName, GetShipString(shipID, slot));

                    Equipments.SetSlotList(shipID, slot);
                    Equipments.Visible = true;
                    ToolTipInfo.SetToolTip(Equipments, GetEquipmentString(shipID, slot));
                }
            }
示例#4
0
            private string GetEquipmentString(int shipID, int[] slot)
            {
                StringBuilder  sb   = new StringBuilder();
                ShipDataMaster ship = KCDatabase.Instance.MasterShips[shipID];

                if (ship == null || slot == null)
                {
                    return(null);
                }

                for (int i = 0; i < slot.Length; i++)
                {
                    if (slot[i] != -1)
                    {
                        sb.AppendFormat("[{0}] {1}\r\n", ship.Aircraft[i], KCDatabase.Instance.MasterEquipments[slot[i]].Name);
                    }
                }

                sb.AppendFormat("\r\n昼戦: {0}\r\n夜戦: {1}\r\n",
                                Constants.GetDayAttackKind(Calculator.GetDayAttackKind(slot, ship.ShipID, -1)),
                                Constants.GetNightAttackKind(Calculator.GetNightAttackKind(slot, ship.ShipID, -1)));

                {
                    int aacutin = Calculator.GetAACutinKind(shipID, slot);
                    if (aacutin != 0)
                    {
                        sb.AppendFormat("対空: {0}\r\n", Constants.GetAACutinKind(aacutin));
                    }
                }

                return(sb.ToString());
            }
示例#5
0
        /// <summary>
        /// スロット情報を設定します。主に演習の敵艦用です。
        /// </summary>
        /// <param name="shipID">艦船ID。</param>
        /// <param name="slot">装備スロット。</param>
        public void SetSlotList(int shipID, int[] slot)
        {
            ShipDataMaster ship = KCDatabase.Instance.MasterShips[shipID];

            int slotLength = slot != null ? slot.Length : 0;

            if (SlotList.Length != slotLength)
            {
                SlotList = new SlotItem[slotLength];
                for (int i = 0; i < SlotList.Length; i++)
                {
                    SlotList[i] = new SlotItem();
                }
            }

            for (int i = 0; i < SlotList.Length; i++)
            {
                SlotList[i].EquipmentID     = slot[i];
                SlotList[i].AircraftCurrent = ship.Aircraft[i];
                SlotList[i].AircraftMax     = ship.Aircraft[i];
            }

            SlotSize = ship != null ? ship.SlotSize : 0;

            PropertyChanged();
        }
        private void UpdateLevelParameter(int shipID)
        {
            ShipDataMaster ship = KCDatabase.Instance.MasterShips[shipID];

            if (!ship.IsAbyssalShip)
            {
                ASWLevel.Text                            = EstimateParameter((int)ParameterLevel.Value, ship.ASW);
                EvasionLevel.Text                        = EstimateParameter((int)ParameterLevel.Value, ship.Evasion);
                LOSLevel.Text                            = EstimateParameter((int)ParameterLevel.Value, ship.LOS);
                ASWLevel.Visible                         =
                    ASWSeparater.Visible                 =
                        EvasionLevel.Visible             =
                            EvasionSeparater.Visible     =
                                LOSLevel.Visible         =
                                    LOSSeparater.Visible = true;
            }
            else
            {
                ASWLevel.Visible                         =
                    ASWSeparater.Visible                 =
                        EvasionLevel.Visible             =
                            EvasionSeparater.Visible     =
                                LOSLevel.Visible         =
                                    LOSSeparater.Visible = false;
            }
        }
示例#7
0
        private static Color GetShipNameColor(ShipDataMaster ship)
        {
            switch (ship.AbyssalShipClass)
            {
            case 0:
            case 1:                             //normal
            default:
                return(Utility.ThemeManager.GetColor(Utility.Configuration.Config.UI.Theme, Utility.ThemeColors.MainFontColor));

            case 2:             //elite
                return(Color.FromArgb(0xFF, 0x00, 0x00));

            case 3:                             //flagship
                return(Color.FromArgb(0xFF, 0x88, 0x00));

            case 4:                             //latemodel / flagship kai
                return(Color.FromArgb(0x00, 0x88, 0xFF));

            case 5:                             //latemodel elite
                return(Color.FromArgb(0x88, 0x00, 0x00));

            case 6:                             //latemodel flagship
                return(Color.FromArgb(0x88, 0x44, 0x00));
            }
        }
			public void Update(int shipID, int[] slot)
			{

				ShipName.Tag = shipID;

				if (shipID == -1)
				{
					//なし
					ShipName.Text = "-";
					ShipName.ForeColor = Utility.Configuration.Config.UI.ForeColor;
					Equipments.Visible = false;
					ToolTipInfo.SetToolTip(ShipName, null);
					ToolTipInfo.SetToolTip(Equipments, null);

				}
				else
				{

					ShipDataMaster ship = KCDatabase.Instance.MasterShips[shipID];


					ShipName.Text = ship.Name;
					ShipName.ForeColor = ship.GetShipNameColor();
					ToolTipInfo.SetToolTip(ShipName, GetShipString(shipID, slot));

					Equipments.SetSlotList(shipID, slot);
					Equipments.Visible = true;
					ToolTipInfo.SetToolTip(Equipments, GetEquipmentString(shipID, slot));
				}

			}
示例#9
0
 /// <summary>
 /// 制空戦力を求めます。
 /// </summary>
 /// <param name="ship">対象の艦船。</param>
 public static int GetAirSuperiority(ShipDataMaster ship)
 {
     if (ship.DefaultSlot == null)
     {
         return(0);
     }
     return(GetAirSuperiority(ship.DefaultSlot.ToArray(), ship.Aircraft.ToArray()));
 }
示例#10
0
		private string GetRemodelItem( ShipDataMaster ship ) {
			StringBuilder sb = new StringBuilder();
			if ( ship.NeedBlueprint > 0 )
				sb.AppendLine( "改装設計図: " + ship.NeedBlueprint );
			if ( ship.NeedCatapult > 0 )
				sb.AppendLine( "試製甲板カタパルト: " + ship.NeedCatapult );

			return sb.ToString();
		}
        /// <summary>
        /// 艦娘図鑑から回避・対潜の初期値及び説明文を読み込みます。
        /// </summary>
        private void AlbumOpened(string apiname, dynamic data)
        {
            if (data == null || !data.api_list())                       //空のページ
            {
                return;
            }

            foreach (dynamic elem in data.api_list)
            {
                if (!elem.api_yomi())
                {
                    break;                                              //装備図鑑だった場合終了
                }
                int shipID = (int)elem.api_table_id[0];

                ShipParameterElement e = this[shipID];
                if (e == null)
                {
                    e        = new ShipParameterElement();
                    e.ShipID = shipID;
                    Utility.Logger.Add(2, KCDatabase.Instance.MasterShips[shipID].NameWithClass + "のパラメータを記録しました。");
                }

                e.ASW.SetEstParameter(1, (int)elem.api_tais, Parameter.MaximumDefault);
                e.Evasion.SetEstParameter(1, (int)elem.api_kaih, Parameter.MaximumDefault);


                {                       //図鑑説明文登録(図鑑に載っていない改装艦に関してはその改装前の艦の説明文を設定する)
                    e.MessageAlbum = elem.api_sinfo;
                    LinkedList <int> processedIDs = new LinkedList <int>();

                    ShipDataMaster ship = KCDatabase.Instance.MasterShips[shipID];
                    while (ship != null && !processedIDs.Contains(ship.ShipID) && ship.RemodelAfterShipID > 0)
                    {
                        processedIDs.AddLast(ship.ID);
                        ShipParameterElement e2 = this[ship.RemodelAfterShipID];
                        if (e2 == null)
                        {
                            e2        = new ShipParameterElement();
                            e2.ShipID = ship.RemodelAfterShipID;
                        }
                        if (e2.MessageAlbum == null)
                        {
                            e2.MessageAlbum = e.MessageAlbum;
                            Update(e2);
                        }

                        ship = KCDatabase.Instance.MasterShips[ship.RemodelAfterShipID];
                    }
                }


                Update(e);
                Utility.Logger.Add(1, KCDatabase.Instance.MasterShips[shipID].NameWithClass + "のパラメータを更新しました。");
            }
        }
示例#12
0
        private int BaseShipId(int ShipID)
        {
            ShipDataMaster Ship = KCDatabase.Instance.MasterShips[ShipID];

            while (Ship.RemodelBeforeShipID != 0)
            {
                Ship = Ship.RemodelBeforeShip;
            }
            return(Ship.ID);
        }
		private static string GetShipString(int shipID, int[] slot, int level, int hp, int firepower, int torpedo, int aa, int armor)
		{
			ShipDataMaster ship = KCDatabase.Instance.MasterShips[shipID];
			if (ship == null) return null;

			return GetShipString(shipID, slot, level, hp, firepower, torpedo, aa, armor,
				ship.ASW != null && ship.ASW.IsAvailable ? ship.ASW.GetParameter(level) : -1,
				ship.Evasion != null && ship.Evasion.IsAvailable ? ship.Evasion.GetParameter(level) : -1,
				ship.LOS != null && ship.LOS.IsAvailable ? ship.LOS.GetParameter(level) : -1,
				level > 99 ? Math.Min(ship.LuckMin + 3, ship.LuckMax) : ship.LuckMin);
		}
示例#14
0
            private string GetShipString(int shipID, int[] slot, int level, int hp, int firepower, int torpedo, int aa, int armor, int asw, int evasion, int los, int luck)
            {
                ShipDataMaster ship = KCDatabase.Instance.MasterShips[shipID];

                if (ship == null)
                {
                    return(null);
                }

                int firepower_c = firepower;
                int torpedo_c   = torpedo;
                int aa_c        = aa;
                int armor_c     = armor;
                int asw_c       = Math.Max(asw, 0);
                int evasion_c   = Math.Max(evasion, 0);
                int los_c       = Math.Max(los, 0);
                int luck_c      = luck;

                if (slot != null)
                {
                    int count = slot.Length;
                    for (int i = 0; i < count; i++)
                    {
                        EquipmentDataMaster eq = KCDatabase.Instance.MasterEquipments[slot[i]];
                        if (eq == null)
                        {
                            continue;
                        }

                        firepower += eq.Firepower;
                        torpedo   += eq.Torpedo;
                        aa        += eq.AA;
                        armor     += eq.Armor;
                        asw       += eq.ASW;
                        evasion   += eq.Evasion;
                        los       += eq.LOS;
                        luck      += eq.Luck;
                    }
                }

                return(string.Format(
                           "{0} {1}{2}\n耐久: {3}\n火力: {4}/{5}\n雷装: {6}/{7}\n対空: {8}/{9}\n装甲: {10}/{11}\n対潜: {12}/{13}\n回避: {14}/{15}\n索敵: {16}/{17}\n運: {18}/{19}\n(右クリックで図鑑)\n",
                           ship.ShipTypeName, ship.NameWithClass, level < 1 ? "" : string.Format(" Lv. {0}", level),
                           hp,
                           firepower_c, firepower,
                           torpedo_c, torpedo,
                           aa_c, aa,
                           armor_c, armor,
                           asw_c == -1 ? "???" : asw_c.ToString(), asw,
                           evasion_c == -1 ? "???" : evasion_c.ToString(), evasion,
                           los_c == -1 ? "???" : los_c.ToString(), los,
                           luck_c, luck
                           ));
            }
		private static string GetShipString(int shipID, int[] slot)
		{

			ShipDataMaster ship = KCDatabase.Instance.MasterShips[shipID];
			if (ship == null) return null;

			return GetShipString(shipID, slot, -1, ship.HPMin, ship.FirepowerMax, ship.TorpedoMax, ship.AAMax, ship.ArmorMax,
				 ship.ASW != null && !ship.ASW.IsMaximumDefault ? ship.ASW.Maximum : -1,
				 ship.Evasion != null && !ship.Evasion.IsMaximumDefault ? ship.Evasion.Maximum : -1,
				 ship.LOS != null && !ship.LOS.IsMaximumDefault ? ship.LOS.Maximum : -1,
				 ship.LuckMin);
		}
示例#16
0
            public void Update(int shipID, int[] slot)
            {
                ShipName.Tag = shipID;

                if (shipID == -1)
                {
                    //なし
                    ShipName.Text      = "-";
                    ShipName.ForeColor = Color.FromArgb(0x00, 0x00, 0x00);
                    Equipments.Visible = false;
                    ToolTipInfo.SetToolTip(ShipName, null);
                    ToolTipInfo.SetToolTip(Equipments, null);
                }
                else
                {
                    ShipDataMaster ship = KCDatabase.Instance.MasterShips[shipID];


                    ShipName.Text = ship.Name;
                    switch (ship.AbyssalShipClass)
                    {
                    case 0:
                    case 1:                                     //normal
                    default:
                        ShipName.ForeColor = Utility.ThemeManager.GetColor(Utility.Configuration.Config.UI.Theme, Utility.ThemeColors.MainFontColor); break;

                    case 2:                                     //elite
                        ShipName.ForeColor = Color.FromArgb(0xFF, 0x00, 0x00); break;

                    case 3:                                     //flagship
                        ShipName.ForeColor = Color.FromArgb(0xFF, 0x88, 0x00); break;

                    case 4:                                     //latemodel / flagship kai
                        ShipName.ForeColor = Color.FromArgb(0x00, 0x88, 0xFF); break;

                    case 5:                                     //latemodel elite
                        ShipName.ForeColor = Color.FromArgb(0x88, 0x00, 0x00); break;

                    case 6:                                     //latemodel flagship
                        ShipName.ForeColor = Color.FromArgb(0x88, 0x44, 0x00); break;
                    }
                    ShipName.ForeColor = GetShipNameColor(ship);
                    ToolTipInfo.SetToolTip(ShipName, GetShipString(shipID, slot));

                    Equipments.SetSlotList(shipID, slot);
                    Equipments.Visible = true;
                    ToolTipInfo.SetToolTip(Equipments, GetEquipmentString(shipID, slot));
                }
            }
        private string GetRemodelItem(ShipDataMaster ship)
        {
            StringBuilder sb = new StringBuilder();

            if (ship.NeedBlueprint > 0)
            {
                sb.AppendLine(EncycloRes.Blueprint + ": " + ship.NeedBlueprint);
            }
            if (ship.NeedCatapult > 0)
            {
                sb.AppendLine(EncycloRes.PrototypeCatapult + ": " + ship.NeedCatapult);
            }

            return(sb.ToString());
        }
示例#18
0
            private string GetShipString(int shipID, int[] slot, int level, int firepower, int torpedo, int aa, int armor)
            {
                ShipDataMaster ship = KCDatabase.Instance.MasterShips[shipID];

                if (ship == null)
                {
                    return(null);
                }

                return(GetShipString(shipID, slot, level, level > 99 ? ship.HPMaxMarried : ship.HPMin, firepower, torpedo, aa, armor,
                                     ship.ASW != null && ship.ASW.IsAvailable ? ship.ASW.GetParameter(level) : 0,
                                     ship.Evasion != null && ship.Evasion.IsAvailable ? ship.Evasion.GetParameter(level) : 0,
                                     ship.LOS != null && ship.LOS.IsAvailable ? ship.LOS.GetParameter(level) : 0,
                                     level > 99 ? Math.Min(ship.LuckMin + 3, ship.LuckMax) : ship.LuckMin));
            }
示例#19
0
		private void Description_Click( object sender, EventArgs e ) {

			int tag = Description.Tag as int? ?? 0;
			ShipDataMaster ship = KCDatabase.Instance.MasterShips[_shipID];

			if ( ship == null ) return;

			if ( tag == 0 && ship.MessageAlbum.Length > 0 ) {
				Description.Text = ship.MessageAlbum;
				Description.Tag = 1;

			} else {
				Description.Text = ship.MessageGet;
				Description.Tag = 0;
			}
		}
示例#20
0
        /// <summary>
        /// 制空戦力を求めます。
        /// </summary>
        /// <param name="fleet">艦船IDの配列。</param>
        public static int GetAirSuperiority(int[] fleet)
        {
            int air = 0;

            for (int i = 0; i < fleet.Length; i++)
            {
                ShipDataMaster ship = KCDatabase.Instance.MasterShips[fleet[i]];
                if (ship == null)
                {
                    continue;
                }

                air += GetAirSuperiority(ship);
            }

            return(air);
        }
示例#21
0
        /// <summary>
        /// 制空戦力を求めます。
        /// </summary>
        /// <param name="fleet">艦船IDの配列。</param>
        /// <param name="slot">各艦船の装備スロット。</param>
        public static int GetAirSuperiority(int[] fleet, int[][] slot)
        {
            int air    = 0;
            int length = Math.Min(fleet.Length, slot.GetLength(0));

            for (int i = 0; i < length; i++)
            {
                ShipDataMaster ship = KCDatabase.Instance.MasterShips[fleet[i]];
                if (ship == null)
                {
                    continue;
                }

                air += GetAirSuperiority(slot[i], ship.Aircraft.ToArray());
            }

            return(air);
        }
示例#22
0
            public void Update(int shipID, int[] slot)
            {
                ShipName.Tag = shipID;

                if (shipID == -1)
                {
                    //なし
                    ShipName.Text      = "-";
                    ShipName.ForeColor = Color.FromArgb(0x00, 0x00, 0x00);
                    Equipments.Visible = false;
                    ToolTipInfo.SetToolTip(ShipName, null);
                    ToolTipInfo.SetToolTip(Equipments, null);
                }
                else
                {
                    ShipDataMaster ship = KCDatabase.Instance.MasterShips[shipID];


                    ShipName.Text = ship.Name;
                    switch (ship.AbyssalShipClass)
                    {
                    case 0:
                    case 1:                                     //normal
                        ShipName.ForeColor = Color.FromArgb(0x00, 0x00, 0x00); break;

                    case 2:                                     //elite
                        ShipName.ForeColor = Color.FromArgb(0xFF, 0x00, 0x00); break;

                    case 3:                                     //flagship
                        ShipName.ForeColor = Color.FromArgb(0xFF, 0x88, 0x00); break;

                    case 4:                                     //latemodel
                        ShipName.ForeColor = Color.FromArgb(0x00, 0x88, 0xFF); break;
                    }
                    ToolTipInfo.SetToolTip(ShipName, GetShipString(shipID, slot));

                    Equipments.SetSlotList(shipID, slot);
                    Equipments.Visible = true;
                    ToolTipInfo.SetToolTip(Equipments, GetEquipmentString(shipID, slot));
                }
            }
        void Updated(string apiname, dynamic data)
        {
            if (_buildingID != -1 && apiname == "api_get_member/kdock")
            {
                ArsenalData    arsenal = KCDatabase.Instance.Arsenals[_buildingID];
                ShipDataMaster ship    = KCDatabase.Instance.MasterShips[arsenal.ShipID];
                string         name;

                if (Utility.Configuration.Config.Log.ShowSpoiler && Utility.Configuration.Config.FormArsenal.ShowShipName)
                {
                    name = string.Format("{0}「{1}」", ship.ShipTypeName, ship.NameWithClass);

                    Utility.Logger.Add(2, "", string.Format("工厂船坞 #{0} 开始建造 : ", _buildingID),
                                       string.Format("{0}。({1}/{2}/{3}/{4}-{5})", name, arsenal.Fuel, arsenal.Ammo,
                                                     arsenal.Steel, arsenal.Bauxite, arsenal.DevelopmentMaterial),
                                       " 秘书舰 : ", string.Format("{0}「{1}」 Lv. {2}",
                                                                KCDatabase.Instance.Fleet[1].MembersInstance[0].MasterShip.ShipTypeName,
                                                                KCDatabase.Instance.Fleet[1].MembersInstance[0].MasterShip.NameWithClass,
                                                                KCDatabase.Instance.Fleet[1].MembersInstance[0].Level));
                }
                else
                {
                    Utility.Logger.Add(2, "", string.Format("工厂船坞 #{0} 开始建造新舰娘。", _buildingID),
                                       string.Format("({0}/{1}/{2}/{3}-{4})", arsenal.Fuel, arsenal.Ammo,
                                                     arsenal.Steel, arsenal.Bauxite, arsenal.DevelopmentMaterial),
                                       " 秘书舰 : ", string.Format("{0}「{1}」 Lv. {2}",
                                                                KCDatabase.Instance.Fleet[1].MembersInstance[0].MasterShip.ShipTypeName,
                                                                KCDatabase.Instance.Fleet[1].MembersInstance[0].MasterShip.NameWithClass,
                                                                KCDatabase.Instance.Fleet[1].MembersInstance[0].Level));
                }

                _buildingID = -1;
            }

            if (apiname == "api_req_kousyou/createship")
            {
                _buildingID = int.Parse(data["api_kdock_id"]);
            }

            UpdateUI();
        }
示例#24
0
		private void Equipment_MouseClick( object sender, MouseEventArgs e ) {

			if ( e.Button == System.Windows.Forms.MouseButtons.Right ) {

				for ( int i = 0; i < Equipments.Length; i++ ) {
					if ( sender == Equipments[i] ) {

						if ( _shipID != -1 ) {
							ShipDataMaster ship = KCDatabase.Instance.MasterShips[_shipID];

							if ( ship != null && ship.DefaultSlot != null && i < ship.DefaultSlot.Count && ship.DefaultSlot[i] != -1 ) {
								Cursor = Cursors.AppStarting;
								new DialogAlbumMasterEquipment( ship.DefaultSlot[i] ).Show( Owner );
								Cursor = Cursors.Default;
							}
						}
					}
				}

			}
		}
示例#25
0
        private int[] GetRemodelLevelTable(ShipDataMaster ship)
        {
            while (ship.RemodelBeforeShip != null)
            {
                ship = ship.RemodelBeforeShip;
            }

            var list = new LinkedList <int>();

            while (ship != null)
            {
                list.AddLast(ship.RemodelAfterLevel);
                ship = ship.RemodelAfterShip;
                if (list.Last() >= ship.RemodelAfterLevel)
                {
                    break;
                }
            }

            return(list.ToArray());
        }
示例#26
0
            private string GetEquipmentString(int shipID, int[] slot)
            {
                StringBuilder  sb   = new StringBuilder();
                ShipDataMaster ship = KCDatabase.Instance.MasterShips[shipID];

                if (ship == null || slot == null)
                {
                    return(null);
                }

                for (int i = 0; i < slot.Length; i++)
                {
                    if (slot[i] != -1)
                    {
                        sb.AppendFormat("[{0}] {1}\r\n", ship.Aircraft[i], KCDatabase.Instance.MasterEquipments[slot[i]].Name);
                    }
                }

                sb.AppendFormat("\r\n" + GeneralRes.DayBattle + ": {0}\r\n" + GeneralRes.NightBattle + ": {1}\r\n",
                                Constants.GetDayAttackKind(Calculator.GetDayAttackKind(slot, ship.ShipID, -1)),
                                Constants.GetNightAttackKind(Calculator.GetNightAttackKind(slot, ship.ShipID, -1)));

                {
                    int aacutin = Calculator.GetAACutinKind(shipID, slot);
                    if (aacutin != 0)
                    {
                        sb.AppendFormat(GeneralRes.AntiAir + ": {0}\r\n", Constants.GetAACutinKind(aacutin));
                    }
                }
                {
                    int airsup = Calculator.GetAirSuperiority(slot, ship.Aircraft.ToArray());
                    if (airsup > 0)
                    {
                        sb.AppendFormat(GeneralRes.AirPower + ": {0}\r\n", airsup);
                    }
                }

                return(sb.ToString());
            }
        /// <summary>
        /// スロット情報を設定します。主に敵艦用です。
        /// </summary>
        /// <param name="ship">当該艦船。</param>
        public void SetSlotList(ShipDataMaster ship)
        {
            if (SlotList.Length != ship.Aircraft.Count)
            {
                SlotList = new SlotItem[ship.Aircraft.Count];
                for (int i = 0; i < SlotList.Length; i++)
                {
                    SlotList[i] = new SlotItem();
                }
            }

            for (int i = 0; i < SlotList.Length; i++)
            {
                SlotList[i].EquipmentID     = ship.DefaultSlot == null ? -1 : (ship.DefaultSlot.Count < i ? ship.DefaultSlot[i] : -1);
                SlotList[i].AircraftCurrent =
                    SlotList[i].AircraftMax = ship.Aircraft[i];
            }

            SlotSize = ship.SlotSize;

            PropertyChanged();
        }
示例#28
0
        void Updated(string apiname, dynamic data)
        {
            if (_buildingID != -1 && apiname == "api_get_member/kdock")
            {
                ArsenalData    arsenal = KCDatabase.Instance.Arsenals[_buildingID];
                ShipDataMaster ship    = KCDatabase.Instance.MasterShips[arsenal.ShipID];
                string         name;

                if (Utility.Configuration.Config.Log.ShowSpoiler && Utility.Configuration.Config.FormArsenal.ShowShipName)
                {
                    name = string.Format("{0} {1}", ship.ShipTypeName, ship.NameWithClass);
                }
                else
                {
                    name = GeneralRes.ShipGirl;
                }

                Utility.Logger.Add(2, string.Format(GeneralRes.ArsenalLog,
                                                    _buildingID,
                                                    name,
                                                    arsenal.Fuel,
                                                    arsenal.Ammo,
                                                    arsenal.Steel,
                                                    arsenal.Bauxite,
                                                    arsenal.DevelopmentMaterial,
                                                    KCDatabase.Instance.Fleet[1].MembersInstance[0].NameWithLevel
                                                    ));

                _buildingID = -1;
            }

            if (apiname == "api_req_kousyou/createship")
            {
                _buildingID = int.Parse(data["api_kdock_id"]);
            }

            UpdateUI();
        }
示例#29
0
        /// <summary>
        /// 戦闘終了時に各種データの収集を行います。
        /// </summary>
        private void BattleFinished()
        {
            //敵編成記録
            EnemyFleetRecord.EnemyFleetElement enemyFleetData = EnemyFleetRecord.EnemyFleetElement.CreateFromCurrentState();

            if (enemyFleetData != null)
            {
                RecordManager.Instance.EnemyFleet.Update(enemyFleetData);
            }


            // ロギング
            if (IsPractice)
            {
                Utility.Logger.Add(2,
                                   string.Format("演習 で「{0}」{1}の「{2}」と交戦しました。( ランク: {3}, 提督Exp+{4}, 艦娘Exp+{5} )",
                                                 EnemyAdmiralName, EnemyAdmiralRank, Result.EnemyFleetName, Result.Rank, Result.AdmiralExp, Result.BaseExp));
            }
            else
            {
                Utility.Logger.Add(2,
                                   string.Format("{0}-{1}-{2} で「{3}」と交戦しました。( ランク: {4}, 提督Exp+{5}, 艦娘Exp+{6} )",
                                                 Compass.MapAreaID, Compass.MapInfoID, Compass.Destination, Result.EnemyFleetName, Result.Rank, Result.AdmiralExp, Result.BaseExp));
            }



            //ドロップ艦記録
            if (!IsPractice)
            {
                //checkme: とてもアレな感じ

                int  shipID  = Result.DroppedShipID;
                int  itemID  = Result.DroppedItemID;
                int  eqID    = Result.DroppedEquipmentID;
                bool showLog = Utility.Configuration.Config.Log.ShowSpoiler;

                if (shipID != -1)
                {
                    ShipDataMaster ship = KCDatabase.Instance.MasterShips[shipID];
                    DroppedShipCount++;

                    var defaultSlot = ship.DefaultSlot;
                    if (defaultSlot != null)
                    {
                        DroppedEquipmentCount += defaultSlot.Count(id => id != -1);
                    }

                    if (showLog)
                    {
                        Utility.Logger.Add(2, string.Format("{0}「{1}」が戦列に加わりました。", ship.ShipTypeName, ship.NameWithClass));
                    }
                }

                if (itemID != -1)
                {
                    if (!DroppedItemCount.ContainsKey(itemID))
                    {
                        DroppedItemCount.Add(itemID, 0);
                    }
                    DroppedItemCount[itemID]++;

                    if (showLog)
                    {
                        var item       = KCDatabase.Instance.UseItems[itemID];
                        var itemmaster = KCDatabase.Instance.MasterUseItems[itemID];
                        Utility.Logger.Add(2, string.Format("アイテム「{0}」を入手しました。( 合計: {1}個 )", itemmaster != null ? itemmaster.Name : ("不明なアイテム - ID:" + itemID), (item != null ? item.Count : 0) + DroppedItemCount[itemID]));
                    }
                }

                if (eqID != -1)
                {
                    EquipmentDataMaster eq = KCDatabase.Instance.MasterEquipments[eqID];
                    DroppedEquipmentCount++;

                    if (showLog)
                    {
                        Utility.Logger.Add(2, string.Format("{0}「{1}」を入手しました。", eq.CategoryTypeInstance.Name, eq.Name));
                    }
                }


                // 満員判定
                if (shipID == -1 && (
                        KCDatabase.Instance.Admiral.MaxShipCount - (KCDatabase.Instance.Ships.Count + DroppedShipCount) <= 0 ||
                        KCDatabase.Instance.Admiral.MaxEquipmentCount - (KCDatabase.Instance.Equipments.Count + DroppedEquipmentCount) <= 0))
                {
                    shipID = -2;
                }

                RecordManager.Instance.ShipDrop.Add(shipID, itemID, eqID, Compass.MapAreaID, Compass.MapInfoID, Compass.Destination, Compass.MapInfo.EventDifficulty, Compass.EventID == 5, enemyFleetData.FleetID, Result.Rank, KCDatabase.Instance.Admiral.Level);
            }


            //DEBUG

            /*/
             * if ( Utility.Configuration.Config.Log.LogLevel <= 1 && Utility.Configuration.Config.Connection.SaveReceivedData ) {
             *      IEnumerable<int> damages;
             *      switch ( BattleMode & BattleModes.BattlePhaseMask ) {
             *              case BattleModes.Normal:
             *              case BattleModes.AirBattle:
             *              case BattleModes.Practice:
             *              default:
             *                      damages = ( (BattleData)BattleNight ?? BattleDay ).AttackDamages;
             *                      break;
             *              case BattleModes.NightOnly:
             *              case BattleModes.NightDay:
             *                      damages = ( (BattleData)BattleDay ?? BattleNight ).AttackDamages;
             *                      break;
             *      }
             *
             *      damages = damages.Take( 6 ).Where( i => i > 0 );
             *
             *      if ( damages.Count( i => i == damages.Max() ) > 1 ) {
             *              Utility.Logger.Add( 1, "MVP候補が複数存在します。ログを確認してください。" );
             *      }
             * }
             * //*/
        }
        private string GetAlbumInfo(dynamic data)
        {
            StringBuilder sb = new StringBuilder();

            if (data != null && data.api_list() && data.api_list != null)
            {
                if (data.api_list[0].api_yomi())
                {
                    //艦娘図鑑
                    const int bound      = 70;                      // 図鑑1ページあたりの艦船数
                    int       startIndex = (((int)data.api_list[0].api_index_no - 1) / bound) * bound + 1;
                    bool[]    flags      = Enumerable.Repeat <bool>(false, bound).ToArray();

                    sb.AppendLine("[中破絵未回収]");

                    foreach (dynamic elem in data.api_list)
                    {
                        flags[(int)elem.api_index_no - startIndex] = true;

                        dynamic[] state = elem.api_state;
                        for (int i = 0; i < state.Length; i++)
                        {
                            if ((int)state[i][1] == 0)
                            {
                                var target = KCDatabase.Instance.MasterShips[(int)elem.api_table_id[i]];
                                if (target != null)                                     //季節の衣替え艦娘の場合存在しないことがある
                                {
                                    sb.AppendLine(target.Name);
                                }
                            }
                        }
                    }

                    sb.AppendLine("[未保有艦]");
                    for (int i = 0; i < bound; i++)
                    {
                        if (!flags[i])
                        {
                            ShipDataMaster ship = KCDatabase.Instance.MasterShips.Values.FirstOrDefault(s => s.AlbumNo == startIndex + i);
                            if (ship != null)
                            {
                                sb.AppendLine(ship.Name);
                            }
                        }
                    }
                }
                else
                {
                    //装備図鑑
                    const int bound      = 70;                      // 図鑑1ページあたりの装備数
                    int       startIndex = (((int)data.api_list[0].api_index_no - 1) / bound) * bound + 1;
                    bool[]    flags      = Enumerable.Repeat <bool>(false, bound).ToArray();

                    foreach (dynamic elem in data.api_list)
                    {
                        flags[(int)elem.api_index_no - startIndex] = true;
                    }

                    sb.AppendLine("[未保有装備]");
                    for (int i = 0; i < bound; i++)
                    {
                        if (!flags[i])
                        {
                            EquipmentDataMaster eq = KCDatabase.Instance.MasterEquipments.Values.FirstOrDefault(s => s.AlbumNo == startIndex + i);
                            if (eq != null)
                            {
                                sb.AppendLine(eq.Name);
                            }
                        }
                    }
                }
            }

            return(sb.ToString());
        }