Exemplo n.º 1
0
		public override void OnResponseReceived( dynamic data ) {

			KCDatabase db = KCDatabase.Instance;

			int setid = (int)data.api_ship_data.api_set_ship.api_id;
			int unsetid = (int)data.api_ship_data.api_unset_ship.api_id;

			// 念のため
			if ( !db.Ships.ContainsKey( setid ) ) {
				var a = new ShipData();
				a.LoadFromResponse( APIName, data.api_ship_data.api_set_ship );
				db.Ships.Add( a );

			} else {
				db.Ships[setid].LoadFromResponse( APIName, data.api_ship_data.api_set_ship );
			}


			if ( !db.Ships.ContainsKey( unsetid ) ) {
				var a = new ShipData();
				a.LoadFromResponse( APIName, data.api_ship_data.api_unset_ship );
				db.Ships.Add( a );

			} else {
				db.Ships[unsetid].LoadFromResponse( APIName, data.api_ship_data.api_unset_ship );
			}

			base.OnResponseReceived( (object)data );
		}
Exemplo n.º 2
0
		public override void OnResponseReceived( dynamic data ) {

			KCDatabase db = KCDatabase.Instance;


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

				int id = (int)elem.api_id;
				ShipData ship = db.Ships[id];

				if ( ship != null ) {
					ship.LoadFromResponse( APIName, elem );

				} else {	//ないとは思うけど
					var a = new ShipData();
					a.LoadFromResponse( APIName, elem );
					db.Ships.Add( a );

				}

			}


			//api_deck_data
			db.Fleet.LoadFromResponse( APIName, data.api_deck_data );

			base.OnResponseReceived( (object)data );
		}
Exemplo n.º 3
0
		public override void OnResponseReceived( dynamic data ) {

			KCDatabase db = KCDatabase.Instance;

			var ship = db.Ships[(int)data.api_ship.api_id];
			

			if ( ship != null ) {

				if ( Utility.Configuration.Config.Log.ShowSpoiler ) {
					if ( (int)data.api_powerup_flag == 0 ) {
						Utility.Logger.Add( 2, ship.NameWithLevel + " の近代化改修に失敗しました。" );

					} else {
						var updated_ship = new ShipData();
						updated_ship.LoadFromResponse( APIName, data.api_ship );

						StringBuilder sb = new StringBuilder();
						sb.Append( ship.NameWithLevel + " の近代化改修に成功しました。( " );

						var contents = new LinkedList<string>();

						int firepower = updated_ship.FirepowerBase - ship.FirepowerBase;
						if ( firepower > 0 )
							contents.AddLast( "火力+" + firepower );
						int torpedo = updated_ship.TorpedoBase - ship.TorpedoBase;
						if ( torpedo > 0 )
							contents.AddLast( "雷装+" + torpedo );
						int aa = updated_ship.AABase - ship.AABase;
						if ( aa > 0 )
							contents.AddLast( "対空+" + aa );
						int armor = updated_ship.ArmorBase - ship.ArmorBase;
						if ( armor > 0 )
							contents.AddLast( "装甲+" + armor );
						int luck = updated_ship.LuckBase - ship.LuckBase;
						if ( luck > 0 )
							contents.AddLast( "運+" + luck );

						sb.AppendFormat( string.Join( ", ", contents ) + " )" );
						Utility.Logger.Add( 2, sb.ToString() );
					}
				}
				ship.LoadFromResponse( APIName, data.api_ship );
			}

			db.Fleet.LoadFromResponse( APIName, data.api_deck );


			base.OnResponseReceived( (object)data );
		}
Exemplo n.º 4
0
		public override void OnResponseReceived( dynamic data ) {

			KCDatabase db = KCDatabase.Instance;


			//api_material
			db.Material.LoadFromResponse( APIName, data.api_material );

			//api_basic
			db.Admiral.LoadFromResponse( APIName, data.api_basic );

			//api_ship
			db.Ships.Clear();
			foreach ( var elem in data.api_ship ) {

				var a = new ShipData();
				a.LoadFromResponse( APIName, elem );
				db.Ships.Add( a );

			}


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

				int id = (int)elem.api_id;

				if ( !db.Docks.ContainsKey( id ) ) {
					var a = new DockData();
					a.LoadFromResponse( APIName, elem );
					db.Docks.Add( a );

				} else {
					db.Docks[id].LoadFromResponse( APIName, elem );
				}
			}

			//api_deck_port
			db.Fleet.LoadFromResponse( APIName, data.api_deck_port );
			db.Fleet.CombinedFlag = data.api_combined_flag() ? (int)data.api_combined_flag : 0;


			db.Battle.LoadFromResponse( APIName, data );

			base.OnResponseReceived( (object)data );
		}
Exemplo n.º 5
0
		public override void OnResponseReceived( dynamic data ) {

			KCDatabase db = KCDatabase.Instance;

			//api_kdock
			foreach ( var ars in data.api_kdock ) {

				int id = (int)ars.api_id;

				if ( !db.Arsenals.ContainsKey( id ) ) {
					var a = new ArsenalData();
					a.LoadFromResponse( APIName, ars );
					db.Arsenals.Add( a );

				} else {
					db.Arsenals[id].LoadFromResponse( APIName, ars );
				}
			}

			//api_slotitem
			if ( data.api_slotitem != null ) {				//装備なしの艦はnullになる
				foreach ( var elem in data.api_slotitem ) {

					var eq = new EquipmentData();
					eq.LoadFromResponse( APIName, elem );
					db.Equipments.Add( eq );

				}
			}

			//api_ship
			{
				ShipData ship = new ShipData();
				ship.LoadFromResponse( APIName, data.api_ship );
				db.Ships.Add( ship );

				Utility.Logger.Add( 2, string.Format( "{0}「{1}」の建造が完了しました。", ship.MasterShip.ShipTypeName, ship.MasterShip.NameWithClass ) );
			}


			base.OnResponseReceived( (object)data );
		}
Exemplo n.º 6
0
		public override void OnResponseReceived( dynamic data ) {

			KCDatabase db = KCDatabase.Instance;


			//api_data
			db.Ships.Clear();
			foreach ( var elem in data.api_data ) {

				var a = new ShipData();
				a.LoadFromResponse( APIName, elem );
				db.Ships.Add( a );

			}
			

			//api_data_deck
			db.Fleet.LoadFromResponse( APIName, data.api_data_deck );

			base.OnResponseReceived( (object)data );
		}