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();
		}
Exemplo n.º 2
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() );
 }
Exemplo n.º 3
0
		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 );
			}
		}
        /// <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];
                SlotList[ship.SlotSize].Level =
                SlotList[ship.SlotSize].AircraftLevel = 0;
            }

            SlotSize = ship.SlotSize;

            PropertyChanged();
        }
		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();
		}
Exemplo n.º 6
0
		public override void OnResponseReceived( dynamic data ) {

			KCDatabase db = KCDatabase.Instance;


			//特別置換処理
			data.api_mst_stype[7].api_name = "巡洋戦艦";


			//api_mst_ship
			foreach ( var elem in data.api_mst_ship ) {

				int id = (int)elem.api_id;
				if ( db.MasterShips[id] == null ) {
					var ship = new ShipDataMaster();
					ship.LoadFromResponse( APIName, elem );
					db.MasterShips.Add( ship );
				} else {
					db.MasterShips[id].LoadFromResponse( APIName, elem );
				}
			}

			//改装関連のデータ設定
			foreach ( var ship in db.MasterShips ) {
				int remodelID = ship.Value.RemodelAfterShipID;
				if ( remodelID != 0 ) {
					db.MasterShips[remodelID].RemodelBeforeShipID = ship.Key;
				}
			}

			//api_mst_shipgraph
			foreach ( var elem in data.api_mst_shipgraph ) {

				int id = (int)elem.api_id;
				ShipDataMaster ship = db.MasterShips[id];
				if ( ship != null ) {
					ship.ResourceName = elem.api_filename;
					ship.ResourceVersion = elem.api_version;
				}
			}


			//api_mst_slotitem_equiptype
			foreach ( var elem in data.api_mst_slotitem_equiptype ) {

				int id = (int)elem.api_id;
				if ( db.EquipmentTypes[id] == null ) {
					var eqt = new EquipmentType();
					eqt.LoadFromResponse( APIName, elem );
					db.EquipmentTypes.Add( eqt );
				} else {
					db.EquipmentTypes[id].LoadFromResponse( APIName, elem );
				}
			}


			//api_mst_stype
			foreach ( var elem in data.api_mst_stype ) {

				int id = (int)elem.api_id;
				if ( db.ShipTypes[id] == null ) {
					var spt = new ShipType();
					spt.LoadFromResponse( APIName, elem );
					db.ShipTypes.Add( spt );
				} else {
					db.ShipTypes[id].LoadFromResponse( APIName, elem );
				}
			}


			//api_mst_slotitem
			foreach ( var elem in data.api_mst_slotitem ) {

				int id = (int)elem.api_id;
				if ( db.MasterEquipments[id] == null ) {
					var eq = new EquipmentDataMaster();
					eq.LoadFromResponse( APIName, elem );
					db.MasterEquipments.Add( eq );
				} else {
					db.MasterEquipments[id].LoadFromResponse( APIName, elem );
				}
			}

			//api_mst_slotitemgraph
			/*
			foreach ( var elem in data.api_mst_slotitemgraph ) {

				int id = (int)elem.api_id;
				EquipmentDataMaster eq = db.MasterEquipments[id];
				if ( eq != null ) {
					eq.ResourceVersion = elem.api_version;
				}
			}
			*/

			//api_mst_useitem
			foreach ( var elem in data.api_mst_useitem ) {

				int id = (int)elem.api_id;
				if ( db.MasterUseItems[id] == null ) {
					var item = new UseItemMaster();
					item.LoadFromResponse( APIName, elem );
					db.MasterUseItems.Add( item );
				} else {
					db.MasterUseItems[id].LoadFromResponse( APIName, elem );
				}
			}


			//api_mst_mapinfo
			foreach ( var elem in data.api_mst_mapinfo ) {

				int id = (int)elem.api_id;
				if ( db.MapInfo[id] == null ) {
					var item = new MapInfoData();
					item.LoadFromResponse( APIName, elem );
					db.MapInfo.Add( item );
				} else {
					db.MapInfo[id].LoadFromResponse( APIName, elem );
				}
			}


			//api_mst_mission
			foreach ( var elem in data.api_mst_mission ) {

				int id = (int)elem.api_id;
				if ( db.Mission[id] == null ) {
					var item = new MissionData();
					item.LoadFromResponse( APIName, elem );
					db.Mission.Add( item );
				} else {
					db.Mission[id].LoadFromResponse( APIName, elem );
				}

			}


			//api_mst_shipupgrade
			Dictionary<int, int> upgradeLevels = new Dictionary<int, int>();
			foreach ( var elem in data.api_mst_shipupgrade ) {

				int idbefore = (int)elem.api_current_ship_id;
				int idafter = (int)elem.api_id;
				var shipbefore = db.MasterShips[idbefore];
				var shipafter = db.MasterShips[idafter];
				int level = (int)elem.api_upgrade_level;
				
				if ( upgradeLevels.ContainsKey( idafter ) ) {
					if ( level < upgradeLevels[idafter] ) {
						shipafter.RemodelBeforeShipID = idbefore;
						upgradeLevels[idafter] = level;
					}
				} else {
					shipafter.RemodelBeforeShipID = idbefore;
					upgradeLevels.Add( idafter, level );
				}

				if ( shipbefore != null ) {
					shipbefore.NeedBlueprint = (int)elem.api_drawing_count;
					shipbefore.NeedCatapult = (int)elem.api_catapult_count;
				}
			}


			Utility.Logger.Add( 2, "提督が鎮守府に着任しました。これより艦隊の指揮を執ります。" );

			base.OnResponseReceived( (object)data );
		}
Exemplo n.º 7
0
        public void UpdateApiStart2(dynamic data)
        {
            string APIName = "api_start2";

            if (data.api_data != null && data.api_result == 1)
            {
                data = data.api_data;
            }

            //特別置換処理
            data.api_mst_stype[7].api_name = "巡洋戦艦";

            //api_mst_ship
            foreach (var elem in data.api_mst_ship)
            {
                int id = (int)elem.api_id;
                if (MasterShips[id] == null)
                {
                    var ship = new ShipDataMaster();
                    ship.LoadFromResponse(APIName, elem);
                    m_newAddedMasterShips.Add(ship);
                }
                else if (!JToken.DeepEquals(MasterShips[id].RawData, elem))
                {
                    var ship = new ShipDataMaster();
                    ship.LoadFromResponse(APIName, elem);
                    m_updatedMasterShips.Add(ship);
                }
            }

            //api_mst_shipgraph
            foreach (var elem in data.api_mst_shipgraph)
            {
                int            id   = (int)elem.api_id;
                ShipDataMaster ship = m_updatedMasterShips[id];
                if (ship != null)
                {
                    ship.ResourceName = elem.api_filename;
                    dynamic versions = elem.api_version;
                    ship.ResourceGraphicVersion   = versions[0];
                    ship.ResourceVoiceVersion     = versions[1];
                    ship.ResourcePortVoiceVersion = versions[2];
                }
                ship = m_newAddedMasterShips[id];
                if (ship != null)
                {
                    ship.ResourceName = elem.api_filename;
                    dynamic versions = elem.api_version;
                    ship.ResourceGraphicVersion   = versions[0];
                    ship.ResourceVoiceVersion     = versions[1];
                    ship.ResourcePortVoiceVersion = versions[2];
                }
            }

            //api_mst_slotitem_equiptype
            foreach (var elem in data.api_mst_slotitem_equiptype)
            {
                int id = (int)elem.api_id;
                if (EquipmentTypes[id] == null)
                {
                    var eqt = new EquipmentType();
                    eqt.LoadFromResponse(APIName, elem);
                    m_newAddedEquipmentTypes.Add(eqt);
                }
                else if (!JToken.DeepEquals(EquipmentTypes[id].RawData, elem))
                {
                    var eqt = new EquipmentType();
                    eqt.LoadFromResponse(APIName, elem);
                    m_updatedEquipmentTypes.Add(eqt);
                }
            }

            //api_mst_stype
            foreach (var elem in data.api_mst_stype)
            {
                int id = (int)elem.api_id;
                if (ShipTypes[id] == null)
                {
                    var spt = new ShipType();
                    spt.LoadFromResponse(APIName, elem);
                    m_newAddedShipTypes.Add(spt);
                }
                else
                {
                    var spt = new ShipType();
                    spt.LoadFromResponse(APIName, elem);
                    if (!JToken.DeepEquals(ShipTypes[id].RawData, spt.RawData))
                    {
                        m_updatedShipTypes.Add(spt);
                    }
                }
            }

            //api_mst_slotitem
            foreach (var elem in data.api_mst_slotitem)
            {
                int id = (int)elem.api_id;
                if (MasterEquipments[id] == null)
                {
                    var eq = new EquipmentDataMaster();
                    eq.LoadFromResponse(APIName, elem);
                    m_newAddedEquipmentDataMaster.Add(eq);
                }
                else if (!JToken.DeepEquals(MasterEquipments[id].RawData, elem))
                {
                    var eq = new EquipmentDataMaster();
                    eq.LoadFromResponse(APIName, elem);
                    m_updatedEquipmentDataMaster.Add(eq);
                }
            }

            //api_mst_useitem
            foreach (var elem in data.api_mst_useitem)
            {
                int id = (int)elem.api_id;
                if (MasterUseItems[id] == null)
                {
                    var item = new UseItemMaster();
                    item.LoadFromResponse(APIName, elem);
                    m_newAddedUseItemMaster.Add(item);
                }
                else if (!JToken.DeepEquals(MasterUseItems[id].RawData, elem))
                {
                    var item = new UseItemMaster();
                    item.LoadFromResponse(APIName, elem);
                    m_updatedUseItemMaster.Add(item);
                }
            }

            //api_mst_maparea
            foreach (var elem in data.api_mst_maparea)
            {
                int id = (int)elem.api_id;
                if (MapArea[id] == null)
                {
                    var item = new MapAreaData();
                    item.LoadFromResponse(APIName, elem);
                    m_newAddedMapAreaData.Add(item);
                }
                else if (!JToken.DeepEquals(MapArea[id].RawData, elem))
                {
                    var item = new MapAreaData();
                    item.LoadFromResponse(APIName, elem);
                    m_updatedMapAreaData.Add(item);
                }
            }

            //api_mst_mapinfo
            foreach (var elem in data.api_mst_mapinfo)
            {
                int id = (int)elem.api_id;
                if (MapInfo[id] == null)
                {
                    var item = new MapInfoData();
                    item.LoadFromResponse(APIName, elem);
                    m_newAddedMapInfoData.Add(item);
                }
                else if (!JToken.DeepEquals(MapInfo[id].RawData, elem))
                {
                    var item = new MapInfoData();
                    item.LoadFromResponse(APIName, elem);
                    m_updatedMapInfoData.Add(item);
                }
            }

            //api_mst_mission
            foreach (var elem in data.api_mst_mission)
            {
                int id = (int)elem.api_id;
                if (Mission[id] == null)
                {
                    var item = new MissionData();
                    item.LoadFromResponse(APIName, elem);
                    m_newAddedMissionData.Add(item);
                }
                else if (!JToken.DeepEquals(Mission[id].RawData, elem))
                {
                    var item = new MissionData();
                    item.LoadFromResponse(APIName, elem);
                    m_updatedMissionData.Add(item);
                }
            }
        }
Exemplo n.º 8
0
        public void InitializeApiStart2(dynamic data)
        {
            string APIName = "api_start2";

            if (data.api_data != null && data.api_result == 1)
            {
                data = data.api_data;
            }

            //特別置換処理
            data.api_mst_stype[7].api_name = "巡洋戦艦";

            ClearUpdated();

            //api_mst_ship
            foreach (var elem in data.api_mst_ship)
            {
                int id = (int)elem.api_id;
                if (MasterShips[id] == null)
                {
                    var ship = new ShipDataMaster();
                    ship.LoadFromResponse(APIName, elem);
                    MasterShips.Add(ship);
                }
                else
                {
                    MasterShips[id].LoadFromResponse(APIName, elem);
                }
            }

            //改装関連のデータ設定
            foreach (var ship in MasterShips)
            {
                var remodelID = ship.Value.RemodelAfterShipID;
                if (remodelID != 0)
                {
                    MasterShips[remodelID].RemodelBeforeShipID = ship.Key;
                }
            }

            //api_mst_shipgraph
            foreach (var elem in data.api_mst_shipgraph)
            {
                int            id   = (int)elem.api_id;
                ShipDataMaster ship = MasterShips[id];
                if (ship != null)
                {
                    ship.ResourceName = elem.api_filename;
                    dynamic versions = elem.api_version;
                    ship.ResourceGraphicVersion   = versions[0];
                    ship.ResourceVoiceVersion     = versions[1];
                    ship.ResourcePortVoiceVersion = versions[2];
                }
            }

            //api_mst_slotitem_equiptype
            foreach (var elem in data.api_mst_slotitem_equiptype)
            {
                int id = (int)elem.api_id;
                if (EquipmentTypes[id] == null)
                {
                    var eqt = new EquipmentType();
                    eqt.LoadFromResponse(APIName, elem);
                    EquipmentTypes.Add(eqt);
                }
                else
                {
                    EquipmentTypes[id].LoadFromResponse(APIName, elem);
                }
            }


            //api_mst_stype
            foreach (var elem in data.api_mst_stype)
            {
                int id = (int)elem.api_id;
                if (ShipTypes[id] == null)
                {
                    var spt = new ShipType();
                    spt.LoadFromResponse(APIName, elem);
                    ShipTypes.Add(spt);
                }
                else
                {
                    ShipTypes[id].LoadFromResponse(APIName, elem);
                }
            }


            //api_mst_slotitem
            foreach (var elem in data.api_mst_slotitem)
            {
                int id = (int)elem.api_id;
                if (MasterEquipments[id] == null)
                {
                    var eq = new EquipmentDataMaster();
                    eq.LoadFromResponse(APIName, elem);
                    MasterEquipments.Add(eq);
                }
                else
                {
                    MasterEquipments[id].LoadFromResponse(APIName, elem);
                }
            }

            //api_mst_slotitemgraph

            /*
             *          foreach ( var elem in data.api_mst_slotitemgraph ) {
             *
             *                  int id = (int)elem.api_id;
             *                  EquipmentDataMaster eq = db.MasterEquipments[id];
             *                  if ( eq != null ) {
             *                          eq.ResourceVersion = elem.api_version;
             *                  }
             *          }
             */

            //api_mst_useitem
            foreach (var elem in data.api_mst_useitem)
            {
                int id = (int)elem.api_id;
                if (MasterUseItems[id] == null)
                {
                    var item = new UseItemMaster();
                    item.LoadFromResponse(APIName, elem);
                    MasterUseItems.Add(item);
                }
                else
                {
                    MasterUseItems[id].LoadFromResponse(APIName, elem);
                }
            }

            //api_mst_maparea
            foreach (var elem in data.api_mst_maparea)
            {
                int id = (int)elem.api_id;
                if (MapArea[id] == null)
                {
                    var item = new MapAreaData();
                    item.LoadFromResponse(APIName, elem);
                    MapArea.Add(item);
                }
                else
                {
                    MapArea[id].LoadFromResponse(APIName, elem);
                }
            }

            //api_mst_mapinfo
            foreach (var elem in data.api_mst_mapinfo)
            {
                int id = (int)elem.api_id;
                if (MapInfo[id] == null)
                {
                    var item = new MapInfoData();
                    item.LoadFromResponse(APIName, elem);
                    MapInfo.Add(item);
                }
                else
                {
                    MapInfo[id].LoadFromResponse(APIName, elem);
                }
            }

            //api_mst_mission
            foreach (var elem in data.api_mst_mission)
            {
                int id = (int)elem.api_id;
                if (Mission[id] == null)
                {
                    var item = new MissionData();
                    item.LoadFromResponse(APIName, elem);
                    Mission.Add(item);
                }
                else
                {
                    Mission[id].LoadFromResponse(APIName, elem);
                }
            }

            //api_mst_shipupgrade
            Dictionary <int, int> upgradeLevels = new Dictionary <int, int>();

            foreach (var elem in data.api_mst_shipupgrade)
            {
                int idbefore   = (int)elem.api_current_ship_id;
                int idafter    = (int)elem.api_id;
                var shipbefore = MasterShips[idbefore];
                var shipafter  = MasterShips[idafter];
                int level      = (int)elem.api_upgrade_level;

                if (upgradeLevels.ContainsKey(idafter))
                {
                    if (level < upgradeLevels[idafter])
                    {
                        shipafter.RemodelBeforeShipID = idbefore;
                        upgradeLevels[idafter]        = level;
                    }
                }
                else
                {
                    shipafter.RemodelBeforeShipID = idbefore;
                    upgradeLevels.Add(idafter, level);
                }

                if (shipbefore != null)
                {
                    shipbefore.NeedBlueprint = (int)elem.api_drawing_count;
                    shipbefore.NeedCatapult  = (int)elem.api_catapult_count;
                }
            }
        }
Exemplo n.º 9
0
        public override void OnResponseReceived( dynamic data )
        {
            KCDatabase db = KCDatabase.Instance;

            //特別置換処理
            data.api_mst_stype[7].api_name = "巡洋戦艦";

            //api_mst_ship
            foreach ( var elem in data.api_mst_ship ) {

                int id = (int)elem.api_id;
                if ( db.MasterShips[id] == null ) {
                    var ship = new ShipDataMaster();
                    ship.LoadFromResponse( APIName, elem );
                    db.MasterShips.Add( ship );
                } else {
                    db.MasterShips[id].LoadFromResponse( APIName, elem );
                }
            }

            //改装関連のデータ設定
            foreach ( var ship in db.MasterShips ) {
                int remodelID = ship.Value.RemodelAfterShipID;
                if ( remodelID != 0 ) {
                    db.MasterShips[remodelID].RemodelBeforeShipID = ship.Key;
                }
            }

            //api_mst_shipgraph
            foreach ( var elem in data.api_mst_shipgraph ) {

                int id = (int)elem.api_id;
                ShipDataMaster ship = db.MasterShips[id];
                if ( ship != null ) {
                    ship.ResourceName = elem.api_filename;
                    ship.ResourceVersion = elem.api_version;
                }
            }

            //api_mst_slotitem_equiptype
            foreach ( var elem in data.api_mst_slotitem_equiptype ) {

                int id = (int)elem.api_id;
                if ( db.EquipmentTypes[id] == null ) {
                    var eqt = new EquipmentType();
                    eqt.LoadFromResponse( APIName, elem );
                    db.EquipmentTypes.Add( eqt );
                } else {
                    db.EquipmentTypes[id].LoadFromResponse( APIName, elem );
                }
            }

            //api_mst_stype
            foreach ( var elem in data.api_mst_stype ) {

                int id = (int)elem.api_id;
                if ( db.ShipTypes[id] == null ) {
                    var spt = new ShipType();
                    spt.LoadFromResponse( APIName, elem );
                    db.ShipTypes.Add( spt );
                } else {
                    db.ShipTypes[id].LoadFromResponse( APIName, elem );
                }
            }

            //api_mst_slotitem
            foreach ( var elem in data.api_mst_slotitem ) {

                int id = (int)elem.api_id;
                if ( db.MasterEquipments[id] == null ) {
                    var eq = new EquipmentDataMaster();
                    eq.LoadFromResponse( APIName, elem );
                    db.MasterEquipments.Add( eq );
                } else {
                    db.MasterEquipments[id].LoadFromResponse( APIName, elem );
                }
            }

            //api_mst_slotitemgraph
            foreach ( var elem in data.api_mst_slotitemgraph ) {

                int id = (int)elem.api_id;
                EquipmentDataMaster eq = db.MasterEquipments[id];
                if ( eq != null ) {
                    eq.ResourceVersion = elem.api_version;
                }
            }

            //api_mst_useitem
            foreach ( var elem in data.api_mst_useitem ) {

                int id = (int)elem.api_id;
                if ( db.MasterUseItems[id] == null ) {
                    var item = new UseItemMaster();
                    item.LoadFromResponse( APIName, elem );
                    db.MasterUseItems.Add( item );
                } else {
                    db.MasterUseItems[id].LoadFromResponse( APIName, elem );
                }
            }

            //api_mst_mapinfo
            foreach ( var elem in data.api_mst_mapinfo ) {

                int id = (int)elem.api_id;
                if ( db.MapInfo[id] == null ) {
                    var item = new MapInfoData();
                    item.LoadFromResponse( APIName, elem );
                    db.MapInfo.Add( item );
                } else {
                    db.MapInfo[id].LoadFromResponse( APIName, elem );
                }
            }

            //api_mst_mission
            foreach ( var elem in data.api_mst_mission ) {

                int id = (int)elem.api_id;
                if ( db.Mission[id] == null ) {
                    var item = new MissionData();
                    item.LoadFromResponse( APIName, elem );
                    db.Mission.Add( item );
                } else {
                    db.Mission[id].LoadFromResponse( APIName, elem );
                }

            }

            //api_mst_shipupgrade
            foreach ( var elem in data.api_mst_shipupgrade ) {

                if ( elem.api_drawing_count > 0 ) {
                    int id = db.MasterShips[(int)elem.api_id].RemodelBeforeShipID;
                    if ( id != 0 ) {
                        db.MasterShips[id].NeedBlueprint = (int)elem.api_drawing_count;
                    }
                }
            }

            Utility.Logger.Add( 2, "提督が鎮守府に着任しました。これより艦隊の指揮を執ります。" );

            base.OnResponseReceived( (object)data );
        }