コード例 #1
0
ファイル: Organization.cs プロジェクト: zw0rld/KanColleViewer
        public Organization(Homeport parent, KanColleProxy proxy)
        {
            this.homeport = parent;

            this.Ships = new MemberTable<Ship>();
            this.Fleets = new MemberTable<Fleet>();

            proxy.api_get_member_ship.TryParse<kcsapi_ship2[]>().Subscribe(x => this.Update(x.Data));
            proxy.api_get_member_ship2.TryParse<kcsapi_ship2[]>().Subscribe(x =>
            {
                this.Update(x.Data);
                this.Update(x.Fleets);
            });
            proxy.api_get_member_ship3.TryParse<kcsapi_ship3>().Subscribe(x =>
            {
                this.Update(x.Data.api_ship_data);
                this.Update(x.Data.api_deck_data);
            });

            proxy.api_get_member_deck.TryParse<kcsapi_deck[]>().Subscribe(x => this.Update(x.Data));
            proxy.api_get_member_deck_port.TryParse<kcsapi_deck[]>().Subscribe(x => this.Update(x.Data));
            proxy.api_get_member_ship_deck.TryParse<kcsapi_ship_deck>().Subscribe(x => this.Update(x.Data));

            proxy.api_req_hensei_change.TryParse().Subscribe(this.Change);
            proxy.api_req_hokyu_charge.TryParse<kcsapi_charge>().Subscribe(x => this.Charge(x.Data));
            proxy.api_req_kaisou_powerup.TryParse<kcsapi_powerup>().Subscribe(this.Powerup);
            proxy.api_req_kousyou_getship.TryParse<kcsapi_kdock_getship>().Subscribe(x => this.GetShip(x.Data));
            proxy.api_req_kousyou_destroyship.TryParse<kcsapi_destroyship>().Subscribe(this.DestoryShip);
            proxy.api_req_member_updatedeckname.TryParse().Subscribe(this.UpdateFleetName);

            proxy.api_req_hensei_combined.TryParse<kcsapi_hensei_combined>()
                .Subscribe(x => this.Combined = x.Data.api_combined != 0);

            this.SubscribeSortieSessions(proxy);
        }
コード例 #2
0
        internal Materials(KanColleProxy proxy)
        {
            proxy.api_get_member_material.TryParse <kcsapi_material[]>().Subscribe(x => this.Update(x.Data));
            proxy.api_req_hokyu_charge.TryParse <kcsapi_charge>().Subscribe(x => this.Update(x.Data.api_material));
            proxy.api_req_kousyou_destroyship.TryParse <kcsapi_destroyship>().Subscribe(x => this.Update(x.Data.api_material));

            proxy.ApiSessionSource.Where(x => x.Request.PathAndQuery == "/kcsapi/api_req_air_corps/supply")
            .TryParse <kcsapi_airbase_corps_supply>()
            .Where(x => x.IsSuccess)
            .Subscribe(x => this.Update(new int[] { x.Data.api_after_fuel, this.Ammunition, this.Steel, x.Data.api_after_bauxite }));

            proxy.ApiSessionSource.Where(x => x.Request.PathAndQuery == "/kcsapi/api_req_air_corps/set_plane")
            .TryParse <kcsapi_airbase_corps_set_plane>()
            .Where(x => x.IsSuccess)
            .Subscribe(x =>
            {
                if (x.Request["api_item_id"] == "-1")
                {
                    return;
                }
                if (x.Data.api_plane_info.Length >= 2)
                {
                    return;
                }

                this.Update(new int[] { this.Fuel, this.Ammunition, this.Steel, x.Data.api_after_bauxite });
            });

            proxy.api_req_kousyou_destroyship.TryParse <kcsapi_destroyship>().Subscribe(x => this.Update(x.Data.api_material));
        }
コード例 #3
0
        internal Homeport(KanColleProxy proxy)
        {
            this.Materials = new Materials(proxy);
            this.Itemyard = new Itemyard(this, proxy);
            this.Organization = new Organization(this, proxy);
            this.Repairyard = new Repairyard(this, proxy);
            this.Dockyard = new Dockyard(proxy);
            this.Quests = new Quests(proxy);
            this.Logger = new Logger(proxy);

            proxy.api_port.TryParse<kcsapi_port>().Subscribe(x =>
                {
                    this.UpdateAdmiral(x.Data.api_basic);
                    this.Organization.Update(x.Data.api_ship);
                    this.Repairyard.Update(x.Data.api_ndock);
                    this.Organization.Update(x.Data.api_deck_port);
                    this.Organization.Combined = x.Data.api_combined_flag != 0;
                    this.Materials.Update(x.Data.api_material);

                }
            );
            proxy.api_get_member_basic.TryParse<kcsapi_basic>().Subscribe(x => this.UpdateAdmiral(x.Data));
            proxy.api_req_member_updatecomment.TryParse().Subscribe(this.UpdateComment);

            this.Rankings = new Rankings(proxy);
        }
コード例 #4
0
        internal Homeport(KanColleProxy proxy)
        {
            this.SlotItems = new MemberTable <SlotItem>();
            this.UseItems  = new MemberTable <UseItem>();

            this.Materials    = new Materials(proxy);
            this.Organization = new Organization(this, proxy);
            this.Repairyard   = new Repairyard(this, proxy);
            this.Dockyard     = new Dockyard(proxy);
            this.Quests       = new Quests(proxy);
            this.Logger       = new Logger(proxy);

            proxy.api_port.TryParse <kcsapi_port>().Subscribe(x =>
            {
                this.Organization.Update(x.Data.api_ship);
                this.Repairyard.Update(x.Data.api_ndock);
                this.Organization.Update(x.Data.api_deck_port);
                this.Materials.Update(x.Data.api_material);
            });
            proxy.api_get_member_basic.TryParse <kcsapi_basic>().Subscribe(x => this.UpdateAdmiral(x.Data));
            proxy.api_get_member_slot_item.TryParse <kcsapi_slotitem[]>().Subscribe(x => this.UpdateSlotItems(x.Data));
            proxy.api_get_member_useitem.TryParse <kcsapi_useitem[]>().Subscribe(x => this.UpdateUseItems(x.Data));

            this.Rankings = new Rankings(proxy);
        }
コード例 #5
0
		public ItemDestroyCounter(KanColleProxy proxy)
		{
			proxy.api_req_kousyou_destroyitem2
				.TryParse()
				.Where(x => x.IsSuccess)
				.Subscribe(_ => this.Count++);
		}
コード例 #6
0
ファイル: Logger.cs プロジェクト: JZharay/KanColleViewer
        internal Logger(KanColleProxy proxy)
        {
            this.shipmats = new int[5];

            proxy.ApiSessionSource.Where(x => x.PathAndQuery == "/kcsapi/api_req_kousyou/createitem")
                .Select(x =>
                {
                    SvData<kcsapi_createitem> result;
                    return SvData.TryParse(x, out result) ? result : null;
                })
                .Where(x => x != null && x.IsSuccess)
                .Subscribe(x => this.CreateItem(x.Data, x.RequestBody));

            proxy.ApiSessionSource.Where(x => x.PathAndQuery == "/kcsapi/api_req_kousyou/createship")
                .Select(x =>
                {
                    SvData<kcsapi_createship> result;
                    return SvData.TryParse(x, out result) ? result : null;
                })
                .Where(x => x != null && x.IsSuccess)
                .Subscribe(x => this.CreateShip(x.RequestBody));

            proxy.ApiSessionSource.Where(x => x.PathAndQuery == "/kcsapi/api_get_member/kdock")
                .TryParse<kcsapi_kdock[]>()
                .Subscribe(this.KDock);

            proxy.ApiSessionSource.Where(x => x.PathAndQuery == "/kcsapi/api_req_sortie/battleresult")
                .TryParse<kcsapi_battleresult>()
                .Subscribe(this.BattleResult);
        }
コード例 #7
0
        internal Homeport(KanColleProxy proxy)
        {
            this.SlotItems = new MemberTable<SlotItem>();
            this.UseItems = new MemberTable<UseItem>();

            this.Materials = new Materials(proxy);
            this.Organization = new Organization(this, proxy);
            this.Repairyard = new Repairyard(this, proxy);
            this.Dockyard = new Dockyard(proxy);
            this.Quests = new Quests(proxy);
            this.Logger = new Logger(proxy);

            proxy.api_port.TryParse<kcsapi_port>().Subscribe(x =>
                {
                this.Organization.Update(x.Data.api_ship);
                this.Repairyard.Update(x.Data.api_ndock);
                this.Organization.Update(x.Data.api_deck_port);
                this.Materials.Update(x.Data.api_material);
                });
            proxy.api_get_member_basic.TryParse<kcsapi_basic>().Subscribe(x => this.UpdateAdmiral(x.Data));
            proxy.api_get_member_slot_item.TryParse<kcsapi_slotitem[]>().Subscribe(x => this.UpdateSlotItems(x.Data));
            proxy.api_get_member_useitem.TryParse<kcsapi_useitem[]>().Subscribe(x => this.UpdateUseItems(x.Data));

            this.Rankings = new Rankings(proxy);
        }
コード例 #8
0
        public Organization(Homeport parent, KanColleProxy proxy)
        {
            this.homeport = parent;

            this.Ships  = new MemberTable <Ship>();
            this.Fleets = new MemberTable <Fleet>();

            proxy.api_get_member_ship.TryParse <kcsapi_ship2[]>().Subscribe(x => this.Update(x.Data));
            proxy.api_get_member_ship2.TryParse <kcsapi_ship2[]>().Subscribe(x =>
            {
                this.Update(x.Data);
                this.Update(x.Fleets);
            });
            proxy.api_get_member_ship3.TryParse <kcsapi_ship3>().Subscribe(x =>
            {
                this.Update(x.Data.api_ship_data);
                this.Update(x.Data.api_deck_data);
            });

            proxy.api_get_member_deck.TryParse <kcsapi_deck[]>().Subscribe(x => this.Update(x.Data));
            proxy.api_get_member_deck_port.TryParse <kcsapi_deck[]>().Subscribe(x => this.Update(x.Data));

            proxy.api_req_hensei_change.TryParse().Subscribe(this.Change);
            proxy.api_req_hokyu_charge.TryParse <kcsapi_charge>().Subscribe(x => this.Charge(x.Data));
            proxy.api_req_kaisou_powerup.TryParse <kcsapi_powerup>().Subscribe(this.Powerup);
            proxy.api_req_kousyou_getship.TryParse <kcsapi_kdock_getship>().Subscribe(x => this.GetShip(x.Data));
            proxy.api_req_kousyou_destroyship.TryParse <kcsapi_destroyship>().Subscribe(this.DestoryShip);
            proxy.api_req_member_updatedeckname.TryParse().Subscribe(this.UpdateFleetName);

            proxy.api_req_hensei_combined.TryParse <kcsapi_hensei_combined>()
            .Subscribe(x => this.Combined = x.Data.api_combined != 0);

            this.SubscribeSortieSessions(proxy);
        }
コード例 #9
0
		public SupplyCounter(KanColleProxy proxy)
		{
			proxy.api_req_hokyu_charge
				.TryParse()
				.Where(x => x.IsSuccess)
				.Subscribe(_ => this.Count++);
		}
コード例 #10
0
ファイル: Counter.cs プロジェクト: gensuihime/KanColleViewer
 public ItemDestroyCounter(KanColleProxy proxy)
 {
     proxy.api_req_kousyou_destroyitem2
     .TryParse()
     .Where(x => x.IsSuccess)
     .Subscribe(_ => this.Count++);
 }
コード例 #11
0
		internal Homeport(KanColleProxy proxy)
		{
			this.Materials = new Materials(proxy);
			this.Itemyard = new Itemyard(this, proxy);
			this.Organization = new Organization(this, proxy);
			this.Repairyard = new Repairyard(this, proxy);
			this.Dockyard = new Dockyard(proxy);
			this.Quests = new Quests(proxy);
			this.Logger = new Logger(proxy);

			proxy.api_port.TryParse<kcsapi_port>().Subscribe(x =>
				{
                    this.UpdateAdmiral(x.Data.api_basic);
                    this.Organization.Update(x.Data.api_ship);
				    this.Repairyard.Update(x.Data.api_ndock);
				    this.Organization.Update(x.Data.api_deck_port);
				    this.Organization.Combined = x.Data.api_combined_flag != 0;
				    this.Materials.Update(x.Data.api_material);
				
				}
            );
			proxy.api_get_member_basic.TryParse<kcsapi_basic>().Subscribe(x => this.UpdateAdmiral(x.Data));
			proxy.api_req_member_updatecomment.TryParse().Subscribe(this.UpdateComment);

			this.Rankings = new Rankings(proxy);
		}
コード例 #12
0
 internal Materials(KanColleProxy proxy)
 {
     proxy.api_get_member_material.TryParse<kcsapi_material[]>().Subscribe(x => this.Update(x.Data));
     proxy.api_req_kousyou_remodel_slot.TryParse<kcsapi_remodel_slot>().Subscribe(x => this.Update(x.Data));
     proxy.api_req_hokyu_charge.TryParse<kcsapi_charge>().Subscribe(x => this.Update(x.Data.api_material));
     proxy.api_req_kousyou_destroyship.TryParse<kcsapi_destroyship>().Subscribe(x => this.Update(x.Data.api_material));
 }
コード例 #13
0
 internal Materials(KanColleProxy proxy)
 {
     proxy.api_get_member_material.TryParse <kcsapi_material[]>().Subscribe(x => this.Update(x.Data));
     proxy.api_req_kousyou_remodel_slot.TryParse <kcsapi_remodel_slot>().Subscribe(x => this.Update(x.Data));
     proxy.api_req_hokyu_charge.TryParse <kcsapi_charge>().Subscribe(x => this.Update(x.Data.api_material));
     proxy.api_req_kousyou_destroyship.TryParse <kcsapi_destroyship>().Subscribe(x => this.Update(x.Data.api_material));
 }
コード例 #14
0
        private KanColleClient()
        {
            var proxy = new KanColleProxy();
            var basic = proxy.api_get_member_basic.TryParse<kcsapi_basic>().FirstAsync().ToTask();
            var kdock = proxy.api_get_member_kdock.TryParse<kcsapi_kdock[]>().FirstAsync().ToTask();
            var sitem = proxy.api_get_member_slot_item.TryParse<kcsapi_slotitem[]>().FirstAsync().ToTask();

            proxy.api_start2.FirstAsync().Subscribe(async session =>
            {
                var timeout = Task.Delay(TimeSpan.FromSeconds(20));
                var canInitialize = await Task.WhenAny(new Task[] { basic, kdock, sitem }.WhenAll(), timeout) != timeout;

                // タイムアウト仕掛けてるのは、今後のアップデートで basic, kdock, slot_item のいずれかが来なくなったときに
                // 起動できなくなる (IsStarted を true にできなくなる) のを防ぐため
                // -----
                // ま、そんな規模の変更があったらそもそもまともに動作せんだろうがな ☝(◞‸◟)☝ 野良ツールはつらいよ

                SvData<kcsapi_start2> svd;
                if (!SvData.TryParse(session, out svd)) return;

                this.Master = new Master(svd.Data);
                this.Homeport = new Homeport(proxy);

                if (canInitialize)
                {
                    this.Homeport.UpdateAdmiral((await basic).Data);
                    this.Homeport.Itemyard.Update((await sitem).Data);
                    this.Homeport.Dockyard.Update((await kdock).Data);
                }

                this.IsStarted = true;
            });

            this.Proxy = proxy;
        }
コード例 #15
0
ファイル: Counter.cs プロジェクト: gensuihime/KanColleViewer
 public SupplyCounter(KanColleProxy proxy)
 {
     proxy.api_req_hokyu_charge
     .TryParse()
     .Where(x => x.IsSuccess)
     .Subscribe(_ => this.Count++);
 }
コード例 #16
0
ファイル: Logger.cs プロジェクト: qw853286543/KanColleViewer
        internal Logger(KanColleProxy proxy)
        {
            EnableLogging = KanColleClient.Current.Settings.EnableLogging;

            shipmats = new int[5];
            mats     = new int[8];

            proxy.api_req_kousyou_createitem.TryParse <kcsapi_createitem>().Subscribe(x => CreateItem(x.Data, x.Request));

            proxy.api_req_kousyou_createship.TryParse <kcsapi_createship>().Subscribe(x => CreateShip(x.Request));

            proxy.api_get_member_kdock.TryParse <kcsapi_kdock[]>().Subscribe(x => KDock(x.Data));

            proxy.api_req_sortie_battleresult.TryParse <kcsapi_battleresult>().Subscribe(x => Drop(x.Data));
            proxy.api_req_combined_battle_battleresult.TryParse <kcsapi_combined_battle_battleresult>().Subscribe(x => Drop(x.Data));

            proxy.api_port.TryParse <kcsapi_port>().Subscribe(x => MaterialsHistory(x.Data));

            // TODO: add kcsapi_practice_battle
            proxy.api_req_practice_battle.TryParse().Subscribe(x => fleetInPractice = int.Parse(x.Request["api_deck_id"]));
            proxy.api_req_practice_battle_result.TryParse <kcsapi_practice_battle_result>().Subscribe(x => Levels(x.Data));
            proxy.api_req_sortie_battleresult.TryParse <kcsapi_battleresult>().Subscribe(x => Levels(x.Data));
            proxy.api_req_combined_battle_battleresult.TryParse <kcsapi_combined_battle_battleresult>().Subscribe(x => Levels(x.Data));
            proxy.api_req_mission_result.TryParse <kcsapi_mission_result>().Subscribe(x => Levels(x.Data, x.Request));

            proxy.api_req_mission_result.TryParse <kcsapi_mission_result>().Subscribe(x => Expedition(x.Data, x.Request));

            // TODO: kcsapi_quest_clearitemget
            proxy.api_req_quest_clearitemget.TryParse().Subscribe(x => Quests(x.Request));

            proxy.api_req_sortie_battleresult.TryParse <kcsapi_battleresult>().Subscribe(x => { Battle(x.Data); });
            proxy.api_req_sortie_battleresult.TryParse <kcsapi_combined_battle_battleresult>().Subscribe(x => { Battle(x.Data); });
            proxy.api_req_map_start.TryParse <kcsapi_map_start>().Subscribe(x => { Sortie(x); });
            proxy.api_req_map_next.TryParse <kcsapi_map_start>().Subscribe(x => { Sortie(x); });
        }
コード例 #17
0
ファイル: Logger.cs プロジェクト: posaunehm/KanColleViewer
        internal Logger(KanColleProxy proxy)
        {
            this.shipmats = new int[5];

            proxy.ApiSessionSource.Where(x => x.PathAndQuery == "/kcsapi/api_req_kousyou/createitem")
            .Select(x =>
            {
                SvData <kcsapi_createitem> result;
                return(SvData.TryParse(x, out result) ? result : null);
            })
            .Where(x => x != null && x.IsSuccess)
            .Subscribe(x => this.CreateItem(x.Data, x.RequestBody));

            proxy.ApiSessionSource.Where(x => x.PathAndQuery == "/kcsapi/api_req_kousyou/createship")
            .Select(x =>
            {
                SvData <kcsapi_createship> result;
                return(SvData.TryParse(x, out result) ? result : null);
            })
            .Where(x => x != null && x.IsSuccess)
            .Subscribe(x => this.CreateShip(x.RequestBody));

            proxy.ApiSessionSource.Where(x => x.PathAndQuery == "/kcsapi/api_get_member/kdock")
            .TryParse <kcsapi_kdock[]>()
            .Subscribe(this.KDock);

            proxy.ApiSessionSource.Where(x => x.PathAndQuery == "/kcsapi/api_req_sortie/battleresult")
            .TryParse <kcsapi_battleresult>()
            .Subscribe(this.BattleResult);
        }
コード例 #18
0
ファイル: Dockyard.cs プロジェクト: posaunehm/KanColleViewer
        internal Dockyard(KanColleProxy proxy)
        {
            this.Docks = new MemberTable <BuildingDock>();

            proxy.ApiSessionSource.Where(x => x.PathAndQuery == "/kcsapi/api_get_member/kdock")
            .TryParse <kcsapi_kdock[]>()
            .Subscribe(this.Update);
        }
コード例 #19
0
ファイル: Dockyard.cs プロジェクト: nirvaeld/KanColleViewer
        internal Dockyard(KanColleProxy proxy)
        {
            this.Docks = new MemberTable<BuildingDock>();

            proxy.ApiSessionSource.Where(x => x.PathAndQuery == "/kcsapi/api_get_member/kdock")
                .TryParse<kcsapi_kdock[]>()
                .Subscribe(this.Update);
        }
コード例 #20
0
		public MissionCounter(KanColleProxy proxy)
		{
			proxy.api_req_mission_result
				.TryParse<kcsapi_mission_result>()
				.Where(x => x.IsSuccess)
				.Where(x => x.Data.api_clear_result == 1)
				.Subscribe(_ => this.Count++);
		}
コード例 #21
0
        internal Dockyard(KanColleProxy proxy)
        {
            this.Docks = new MemberTable <BuildingDock>();

            proxy.api_get_member_kdock.TryParse <kcsapi_kdock[]>().Subscribe(x => this.Update(x.Data));
            proxy.api_req_kousyou_getship.TryParse <kcsapi_kdock_getship>().Subscribe(x => this.GetShip(x.Data));
            proxy.api_req_kousyou_createship_speedchange.TryParse().Subscribe(this.ChangeSpeed);
        }
コード例 #22
0
ファイル: Counter.cs プロジェクト: gensuihime/KanColleViewer
 public MissionCounter(KanColleProxy proxy)
 {
     proxy.api_req_mission_result
     .TryParse <kcsapi_mission_result>()
     .Where(x => x.IsSuccess)
     .Where(x => x.Data.api_clear_result >= 1)
     .Subscribe(_ => this.Count++);
 }
コード例 #23
0
ファイル: Counters.cs プロジェクト: 22v2/KanColleViewer
        public ItemDestroyCounter(KanColleProxy proxy)
        {
            proxy.api_req_kousyou_destroyitem2
                .TryParse()
                .Where(x => x.IsSuccess)
                .Subscribe(_ => this.Count++);

            this.Text = "Number of scrapped equipment";
        }
コード例 #24
0
        internal Repairyard(Homeport parent, KanColleProxy proxy)
        {
            this.homeport = parent;
            this.Docks    = new MemberTable <RepairingDock>();

            proxy.ApiSessionSource.Where(x => x.PathAndQuery == "/kcsapi/api_get_member/ndock")
            .TryParse <kcsapi_ndock[]>()
            .Subscribe(this.Update);
        }
コード例 #25
0
ファイル: Repairyard.cs プロジェクト: NatLee/KanColleViewer
        internal Repairyard(Homeport parent, KanColleProxy proxy)
        {
            this.homeport = parent;
            this.Docks = new MemberTable<RepairingDock>();

            proxy.api_get_member_ndock.TryParse<kcsapi_ndock[]>().Subscribe(x => this.Update(x.Data));
            proxy.api_req_nyukyo_start.TryParse().Subscribe(this.Start);
            proxy.api_req_nyukyo_speedchange.TryParse().Subscribe(this.ChangeSpeed);
        }
コード例 #26
0
        private void SubscribeSortieSessions(KanColleProxy proxy)
        {
            proxy.ApiSessionSource
            .SkipUntil(proxy.api_req_map_start.TryParse().Do(this.Sortie))
            .TakeUntil(proxy.api_port)
            .Finally(this.Homing)
            .Repeat()
            .Subscribe();

            int[] evacuationOfferedShipIds = null;
            int[] towOfferedShipIds        = null;

            proxy.api_req_combined_battle_battleresult
            .TryParse <kcsapi_combined_battle_battleresult>()
            .Where(x => x.Data.api_escape != null)
            .Select(x => x.Data)
            .Subscribe(x =>
            {
                if (this.CombinedFleet == null)
                {
                    return;
                }
                var ships = this.CombinedFleet.Fleets.SelectMany(f => f.Ships).ToArray();
                evacuationOfferedShipIds = x.api_escape.api_escape_idx.Select(idx => ships[idx - 1].Id).ToArray();
                towOfferedShipIds        = x.api_escape.api_tow_idx.Select(idx => ships[idx - 1].Id).ToArray();
            });
            proxy.api_req_combined_battle_goback_port
            .Subscribe(_ =>
            {
                if (KanColleClient.Current.IsInSortie &&
                    evacuationOfferedShipIds != null &&
                    evacuationOfferedShipIds.Length >= 1 &&
                    towOfferedShipIds != null &&
                    towOfferedShipIds.Length >= 1)
                {
                    this.evacuatedShipsIds.Add(evacuationOfferedShipIds[0]);
                    this.towShipIds.Add(towOfferedShipIds[0]);
                }
            });
            proxy.api_get_member_ship_deck
            .Subscribe(_ =>
            {
                evacuationOfferedShipIds = null;
                towOfferedShipIds        = null;
            });
            proxy.api_req_sortie_battleresult.TryParse <kcsapi_battleresult>().Subscribe(x => this.DropShip(x.Data));
            proxy.api_req_combined_battle_battleresult.TryParse <kcsapi_combined_battle_battleresult>().Subscribe(x =>
            {
                this.DropShip(x.Data);
            });

            proxy.api_req_map_start.TryParse <kcsapi_map_start>().Subscribe(x => { UpdateSortieInfo(x); });
            proxy.api_req_sortie_battle.TryParse().Subscribe(x => { UpdateSortieInfo(); });
            proxy.api_req_sortie_battleresult.TryParse <kcsapi_battleresult>().Subscribe(x => { UpdateSortieInfo(x); });
            proxy.api_req_combined_battle_battleresult.TryParse <kcsapi_combined_battle_battleresult>().Subscribe(x => { UpdateSortieInfo(x); });
            proxy.api_req_map_next.TryParse <kcsapi_map_start>().Subscribe(x => { UpdateSortieInfo(x); });
        }
コード例 #27
0
ファイル: Repairyard.cs プロジェクト: pocono1/KanColleViewer
        internal Repairyard(Homeport parent, KanColleProxy proxy)
        {
            this.homeport = parent;
            this.Docks = new MemberTable<RepairingDock>();

            proxy.ApiSessionSource.Where(x => x.PathAndQuery == "/kcsapi/api_get_member/ndock")
                .TryParse<kcsapi_ndock[]>()
                .Subscribe(this.Update);
        }
コード例 #28
0
ファイル: Dockyard.cs プロジェクト: c933103/KanColleViewer
        internal Dockyard(KanColleProxy proxy)
        {
            this.Docks = new MemberTable<BuildingDock>();

            proxy.api_get_member_kdock.TryParse<kcsapi_kdock[]>().Subscribe(x => this.Update(x.Data));
            proxy.api_req_kousyou_getship.TryParse<kcsapi_kdock_getship>().Subscribe(x => this.GetShip(x.Data));
            proxy.api_req_kousyou_createship_speedchange.TryParse().Subscribe(this.ChangeSpeed);
            proxy.api_req_kousyou_createitem.TryParse<kcsapi_createitem>().Subscribe(this.CreateSlotItem);
        }
コード例 #29
0
        internal Repairyard(Homeport parent, KanColleProxy proxy)
        {
            this.homeport = parent;
            this.Docks    = new MemberTable <RepairingDock>();

            proxy.api_get_member_ndock.TryParse <kcsapi_ndock[]>().Subscribe(x => this.Update(x.Data));
            proxy.api_req_nyukyo_start.TryParse().Subscribe(this.Start);
            proxy.api_req_nyukyo_speedchange.TryParse().Subscribe(this.ChangeSpeed);
        }
コード例 #30
0
ファイル: Homeport.cs プロジェクト: Tamion/KanColleViewer
        internal Homeport(KanColleProxy proxy)
        {
            proxy.ApiSessionSource.Where(x => x.PathAndQuery == "/kcsapi/api_get_member/basic")
                .TryParse<kcsapi_basic>()
                .Subscribe(x => this.Admiral = new Admiral(x));

            proxy.ApiSessionSource.Where(x => x.PathAndQuery == "/kcsapi/api_get_member/material")
                .TryParse<kcsapi_material[]>()
                .Subscribe(x => this.Materials = new Materials(x.Select(m => new Material(m)).ToArray()));

            this.Ships = new MemberTable<Ship>();
            this.Fleets = new MemberTable<Fleet>();
            proxy.ApiSessionSource.Where(x => x.PathAndQuery == "/kcsapi/api_get_member/ship")
                .Select(x => { SvData<kcsapi_ship2[]> result; return SvData.TryParse(x, out result) ? result : null; })
                .Where(x => x != null && x.IsSuccess)
                .Subscribe(x => this.Ships = new MemberTable<Ship>(x.Data.Select(s => new Ship(this, s))));

            proxy.ApiSessionSource.Where(x => x.PathAndQuery == "/kcsapi/api_get_member/ship2")
                .Select(x => { SvData<kcsapi_ship2[]> result; return SvData.TryParse(x, out result) ? result : null; })
                .Where(x => x != null && x.IsSuccess)
                .Subscribe(x =>
                {
                    this.Ships = new MemberTable<Ship>(x.Data.Select(s => new Ship(this, s)));
                    this.UpdateFleets(x.Fleets);
                });
            proxy.ApiSessionSource.Where(x => x.PathAndQuery == "/kcsapi/api_get_member/ship3")
                .TryParse<kcsapi_ship3>()
                .Subscribe(x =>
                {
                    this.Ships = new MemberTable<Ship>(x.api_ship_data.Select(s => new Ship(this, s)));
                    this.UpdateFleets(x.api_deck_data);
                });

            this.SlotItems = new MemberTable<SlotItem>();
            proxy.ApiSessionSource.Where(x => x.PathAndQuery == "/kcsapi/api_get_member/slotitem")
                .TryParse<kcsapi_slotitem[]>()
                .Subscribe(x => this.SlotItems = new MemberTable<SlotItem>(x.Select(s => new SlotItem(s))));

            this.UseItems = new MemberTable<UseItem>();
            proxy.ApiSessionSource.Where(x => x.PathAndQuery == "/kcsapi/api_get_member/useitem")
                .TryParse<kcsapi_useitem[]>()
                .Subscribe(x => this.UseItems = new MemberTable<UseItem>(x.Select(s => new UseItem(s))));

            proxy.ApiSessionSource.Where(x => x.PathAndQuery == "/kcsapi/api_get_member/deck")
                .TryParse<kcsapi_deck[]>()
                .Subscribe(this.UpdateFleets);

            proxy.ApiSessionSource.Where(x => x.PathAndQuery == "/kcsapi/api_get_member/deck_port")
                .TryParse<kcsapi_deck[]>()
                .Subscribe(this.UpdateFleets);

            this.Dockyard = new Dockyard(proxy);
            this.Repairyard = new Repairyard(this, proxy);
            this.Logger = new Logger(proxy);
            this.Quests = new Quests(proxy);
        }
コード例 #31
0
ファイル: Homeport.cs プロジェクト: kimura92/KanColleViewer
        internal Homeport(KanColleProxy proxy)
        {
            proxy.ApiSessionSource.Where(x => x.PathAndQuery == "/kcsapi/api_get_member/basic")
            .TryParse <kcsapi_basic>()
            .Subscribe(x => this.Admiral = new Admiral(x));

            proxy.ApiSessionSource.Where(x => x.PathAndQuery == "/kcsapi/api_get_member/material")
            .TryParse <kcsapi_material[]>()
            .Subscribe(x => this.Materials = new Materials(x.Select(m => new Material(m)).ToArray()));

            this.Ships  = new MemberTable <Ship>();
            this.Fleets = new MemberTable <Fleet>();
            proxy.ApiSessionSource.Where(x => x.PathAndQuery == "/kcsapi/api_get_member/ship")
            .Select(x => { SvData <kcsapi_ship2[]> result; return(SvData.TryParse(x, out result) ? result : null); })
            .Where(x => x != null && x.IsSuccess)
            .Subscribe(x => this.Ships = new MemberTable <Ship>(x.Data.Select(s => new Ship(this, s))));

            proxy.ApiSessionSource.Where(x => x.PathAndQuery == "/kcsapi/api_get_member/ship2")
            .Select(x => { SvData <kcsapi_ship2[]> result; return(SvData.TryParse(x, out result) ? result : null); })
            .Where(x => x != null && x.IsSuccess)
            .Subscribe(x =>
            {
                this.Ships = new MemberTable <Ship>(x.Data.Select(s => new Ship(this, s)));
                this.UpdateFleets(x.Fleets);
            });
            proxy.ApiSessionSource.Where(x => x.PathAndQuery == "/kcsapi/api_get_member/ship3")
            .TryParse <kcsapi_ship3>()
            .Subscribe(x =>
            {
                this.Ships = new MemberTable <Ship>(x.api_ship_data.Select(s => new Ship(this, s)));
                this.UpdateFleets(x.api_deck_data);
            });

            this.SlotItems = new MemberTable <SlotItem>();
            proxy.ApiSessionSource.Where(x => x.PathAndQuery == "/kcsapi/api_get_member/slotitem")
            .TryParse <kcsapi_slotitem[]>()
            .Subscribe(x => this.SlotItems = new MemberTable <SlotItem>(x.Select(s => new SlotItem(s))));

            this.UseItems = new MemberTable <UseItem>();
            proxy.ApiSessionSource.Where(x => x.PathAndQuery == "/kcsapi/api_get_member/useitem")
            .TryParse <kcsapi_useitem[]>()
            .Subscribe(x => this.UseItems = new MemberTable <UseItem>(x.Select(s => new UseItem(s))));

            proxy.ApiSessionSource.Where(x => x.PathAndQuery == "/kcsapi/api_get_member/deck")
            .TryParse <kcsapi_deck[]>()
            .Subscribe(this.UpdateFleets);

            proxy.ApiSessionSource.Where(x => x.PathAndQuery == "/kcsapi/api_get_member/deck_port")
            .TryParse <kcsapi_deck[]>()
            .Subscribe(this.UpdateFleets);

            this.Dockyard   = new Dockyard(proxy);
            this.Repairyard = new Repairyard(this, proxy);
            this.Quests     = new Quests(proxy);
            this.Logger     = new Logger(proxy);
        }
コード例 #32
0
        internal Logger(KanColleProxy proxy)
        {
            this.shipmats = new int[5];

            // ちょっと考えなおす
            proxy.api_req_kousyou_createitem.TryParse <kcsapi_createitem>().Subscribe(x => this.CreateItem(x.Data, x.Request));
            proxy.api_req_kousyou_createship.TryParse <kcsapi_createship>().Subscribe(x => this.CreateShip(x.Request));
            proxy.api_get_member_kdock.TryParse <kcsapi_kdock[]>().Subscribe(x => this.KDock(x.Data));
            proxy.api_req_sortie_battleresult.TryParse <kcsapi_battleresult>().Subscribe(x => this.BattleResult(x.Data));
        }
コード例 #33
0
ファイル: Counters.cs プロジェクト: 22v2/KanColleViewer
        public MissionCounter(KanColleProxy proxy)
        {
            proxy.api_req_mission_result
                .TryParse<kcsapi_mission_result>()
                .Where(x => x.IsSuccess)
                .Where(x => x.Data.api_clear_result == 1 || x.Data.api_clear_result == 2)
                .Subscribe(_ => this.Count++);

            this.Text = "Number of successful expeditions";
        }
コード例 #34
0
ファイル: Logger.cs プロジェクト: Judaime/KanColleViewer
        internal Logger(KanColleProxy proxy)
        {
            this.shipmats = new int[5];

            // ちょっと考えなおす
            proxy.api_req_kousyou_createitem.TryParse<kcsapi_createitem>().Subscribe(x => this.CreateItem(x.Data, x.Request));
            proxy.api_req_kousyou_createship.TryParse<kcsapi_createship>().Subscribe(x => this.CreateShip(x.Request));
            proxy.api_get_member_kdock.TryParse<kcsapi_kdock[]>().Subscribe(x => this.KDock(x.Data));
            proxy.api_req_sortie_battleresult.TryParse<kcsapi_battleresult>().Subscribe(x => this.BattleResult(x.Data));
        }
コード例 #35
0
        internal Logger(KanColleProxy proxy)
        {
            this.shipmats = new int[5];
            try
            {
                proxy.ApiSessionSource.Where(x => x.Request.PathAndQuery == "/kcsapi/api_req_battle_midnight/battle")
                .Subscribe(x => this.BattleUpdate(x, true));

                proxy.ApiSessionSource.Where(x => x.Request.PathAndQuery == "/kcsapi/api_req_battle_midnight/sp_midnight")
                .Subscribe(x => this.BattleUpdate(x, true));

                proxy.api_req_combined_battle_airbattle
                .Subscribe(x => this.BattleUpdate(x));

                proxy.api_req_combined_battle_battle
                .Subscribe(x => this.BattleUpdate(x));

                proxy.ApiSessionSource.Where(x => x.Request.PathAndQuery == "/kcsapi/api_req_combined_battle/battle_water")
                .Subscribe(x => this.BattleUpdate(x));

                proxy.ApiSessionSource.Where(x => x.Request.PathAndQuery == "/kcsapi/api_req_combined_battle/midnight_battle")
                .Subscribe(x => this.BattleUpdate(x, true));

                proxy.ApiSessionSource.Where(x => x.Request.PathAndQuery == "/kcsapi/api_req_combined_battle/sp_midnight")
                .Subscribe(x => this.BattleUpdate(x, true));

                proxy.ApiSessionSource.Where(x => x.Request.PathAndQuery == "/kcsapi/api_req_sortie/airbattle")
                .Subscribe(x => this.BattleUpdate(x));

                proxy.api_req_sortie_battle
                .Subscribe(x => this.BattleUpdate(x));

                proxy.ApiSessionSource.Where(x => x.Request.PathAndQuery == "/kcsapi/api_req_sortie/ld_airbattle")
                .Subscribe(x => this.BattleUpdate(x));

                proxy.ApiSessionSource.Where(x => x.Request.PathAndQuery == "/kcsapi/api_req_combined_battle/ld_airbattle")
                .Subscribe(x => this.BattleUpdate(x));

                proxy.api_req_map_start.TryParse <start_next>().Subscribe(x => MapStartNext(x.Data, x.Request["api_deck_id"]));
                proxy.api_req_map_next.TryParse <start_next>().Subscribe(x => MapStartNext(x.Data));

                proxy.api_req_sortie_battleresult.TryParse <kcsapi_battleresult>().Subscribe(x => this.BattleResult(x.Data));
                proxy.api_req_combined_battle_battleresult.TryParse <kcsapi_battleresult>().Subscribe(x => this.BattleResult(x.Data));

                // ちょっと考えなおす
                proxy.api_req_kousyou_createitem.TryParse <kcsapi_createitem>().Subscribe(x => this.CreateItem(x.Data, x.Request));
                proxy.api_req_kousyou_createship.TryParse <kcsapi_createship>().Subscribe(x => this.CreateShip(x.Request));
                proxy.api_get_member_kdock.TryParse <kcsapi_kdock[]>().Subscribe(x => this.KDock(x.Data));
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex);
            }
        }
コード例 #36
0
        internal Quests(KanColleProxy proxy)
        {
            this.questPages = new List <ConcurrentDictionary <int, Quest> >();
            this.IsUntaken  = true;
            this.Current    = new List <Quest>();

            proxy.ApiSessionSource.Where(x => x.PathAndQuery == "/kcsapi/api_get_member/questlist")
            .Select(Serialize)
            .Where(x => x != null)
            .Subscribe(this.Update);
        }
コード例 #37
0
ファイル: Quests.cs プロジェクト: Judaime/KanColleViewer
        internal Quests(KanColleProxy proxy)
        {
            this.questPages = new List<ConcurrentDictionary<int, Quest>>();
            this.IsUntaken = true;
            this.All = this.Current = new List<Quest>();

            proxy.api_get_member_questlist
                .Select(Serialize)
                .Where(x => x != null)
                .Subscribe(this.Update);
        }
コード例 #38
0
ファイル: Quests.cs プロジェクト: pocono1/KanColleViewer
        internal Quests(KanColleProxy proxy)
        {
            this.questPages = new List<ConcurrentDictionary<int, Quest>>();
            this.IsUntaken = true;
            this.Current = new List<Quest>();

            proxy.ApiSessionSource.Where(x => x.PathAndQuery == "/kcsapi/api_get_member/questlist")
                .Select(Serialize)
                .Where(x => x != null)
                .Subscribe(this.Update);
        }
コード例 #39
0
		internal Quests(KanColleProxy proxy)
		{
			this.questPages = new List<ConcurrentDictionary<int, Quest>>();
			this.IsUntaken = true;
			this.All = this.Current = new List<Quest>();

			proxy.api_get_member_questlist
				.Select(Serialize)
				.Where(x => x != null)
				.Subscribe(this.Update);
		}
コード例 #40
0
ファイル: Itemyard.cs プロジェクト: Judaime/KanColleViewer
		internal Itemyard(KanColleProxy proxy)
		{
			this.SlotItems = new MemberTable<SlotItem>();
			this.UseItems = new MemberTable<UseItem>();

			proxy.api_get_member_slot_item.TryParse<kcsapi_slotitem[]>().Subscribe(x => this.Update(x.Data));
			proxy.api_req_kousyou_createitem.TryParse<kcsapi_createitem>().Subscribe(x => this.CreateItem(x.Data));
			proxy.api_req_kousyou_destroyitem2.TryParse<kcsapi_destroyitem2>().Subscribe(this.DestroyItem);
			proxy.api_req_sortie_battleresult.TryParse<kcsapi_battleresult>().Subscribe(x => this.DropShip(x.Data));

			proxy.api_get_member_useitem.TryParse<kcsapi_useitem[]>().Subscribe(x => this.Update(x.Data));
		}
コード例 #41
0
        internal Quests(KanColleProxy proxy)
        {
            this.questPages = new List<ConcurrentDictionary<int, Quest>>();
            this.IsUntaken = true;
            this.All = this.Current = new List<Quest>();

            proxy.api_get_member_questlist
                .Where(x => HttpUtility.ParseQueryString(x.GetRequestBodyAsString())["api_tab_id"] == "0")
                .Select(Serialize)
                .Where(x => x != null)
                .Subscribe(this.Update);
        }
コード例 #42
0
ファイル: Itemyard.cs プロジェクト: rgluo2015/KanColleViewer
        internal Itemyard(KanColleProxy proxy)
        {
            this.SlotItems = new MemberTable <SlotItem>();
            this.UseItems  = new MemberTable <UseItem>();

            proxy.api_get_member_slot_item.TryParse <kcsapi_slotitem[]>().Subscribe(x => this.Update(x.Data));
            proxy.api_req_kousyou_createitem.TryParse <kcsapi_createitem>().Subscribe(x => this.CreateItem(x.Data));
            proxy.api_req_kousyou_destroyitem2.TryParse <kcsapi_destroyitem2>().Subscribe(this.DestroyItem);
            proxy.api_req_sortie_battleresult.TryParse <kcsapi_battleresult>().Subscribe(x => this.DropShip(x.Data));

            proxy.api_get_member_useitem.TryParse <kcsapi_useitem[]>().Subscribe(x => this.Update(x.Data));
        }
コード例 #43
0
ファイル: Quests.cs プロジェクト: pereahave/KanColleViewer
        internal Quests(KanColleProxy proxy)
        {
            this.questPages = new List <ConcurrentDictionary <int, Quest> >();
            this.IsUntaken  = true;
            this.All        = this.Current = new List <Quest>();

            proxy.api_get_member_questlist
            .Where(x => HttpUtility.ParseQueryString(x.Request.BodyAsString)["api_tab_id"] == "0")
            .Select(Serialize)
            .Where(x => x != null)
            .Subscribe(this.Update);
        }
コード例 #44
0
ファイル: Rankings.cs プロジェクト: Judaime/KanColleViewer
		internal Rankings(KanColleProxy proxy)
		{
			this.currentData = new ConcurrentDictionary<int, Ranking>();

			this.TotalRanked = 0;
			this.TotalPages = 0;
			this.CurrentPage = 0;

			proxy.ApiSessionSource.Where(x => x.PathAndQuery == "/kcsapi/api_req_ranking/getlist")
				.Select(Serialize)
				.Where(x => x != null)
				.Subscribe(this.Update);
		}
コード例 #45
0
ファイル: Rankings.cs プロジェクト: AnnaKutou/KanColleViewer
        internal Rankings(KanColleProxy proxy)
        {
            this.currentData = new ConcurrentDictionary <int, Ranking>();

            this.TotalRanked = 0;
            this.TotalPages  = 0;
            this.CurrentPage = 0;

            proxy.ApiSessionSource.Where(x => x.PathAndQuery == "/kcsapi/api_req_ranking/getlist")
            .Select(Serialize)
            .Where(x => x != null)
            .Subscribe(this.Update);
        }
コード例 #46
0
        public ResponseFileWriter(KanColleProxy proxy)
        {
            this.Log = new DispatcherCollection<string>(DispatcherHelper.UIDispatcher);

            //kcsとkcsapi以下を保存。キャッシュにある奴は保存されない。
            var kscSessionSource = proxy.SessionSource
                .Where(s => s.Request.PathAndQuery.StartsWith("/kcs/")
                        || s.Request.PathAndQuery.StartsWith("/kcsapi/"));

            kscSessionSource.Subscribe(s => s.SaveResponseBody(s.GetSaveFilePath()));

            kscSessionSource
                .Subscribe(s => Log.Add(DateTimeOffset.Now.ToString("HH:mm:ss : ") + s.Request.PathAndQuery));
        }
コード例 #47
0
ファイル: Logger.cs プロジェクト: phthaibinh/KanColleViewer
        internal Logger(KanColleProxy proxy)
        {
            this.EnableLogging = KanColleClient.Current.Settings.EnableLogging;

            this.shipmats = new int[5];

            // ちょっと考えなおす
            proxy.api_req_kousyou_createitem.TryParse <kcsapi_createitem>().Subscribe(x => this.CreateItem(x.Data, x.Request));
            proxy.api_req_kousyou_createship.TryParse <kcsapi_createship>().Subscribe(x => this.CreateShip(x.Request));
            proxy.api_get_member_kdock.TryParse <kcsapi_kdock[]>().Subscribe(x => this.KDock(x.Data));
            proxy.api_req_sortie_battleresult.TryParse <kcsapi_battleresult>().Subscribe(x => this.BattleResult(x.Data));
            proxy.api_req_combined_battle_battleresult.TryParse <kcsapi_combined_battle_battleresult>().Subscribe(x => this.BattleResult(x.Data));
            proxy.api_get_member_material.TryParse <kcsapi_material[]>().Subscribe(x => this.MaterialsHistory(x.Data));
            proxy.api_req_hokyu_charge.TryParse <kcsapi_charge>().Subscribe(x => this.MaterialsHistory(x.Data.api_material));
            proxy.api_req_kousyou_destroyship.TryParse <kcsapi_destroyship>().Subscribe(x => this.MaterialsHistory(x.Data.api_material));
        }
コード例 #48
0
        internal Itemyard(KanColleProxy proxy)
        {
            this.SlotItems = new MemberTable <SlotItem>();
            this.UseItems  = new MemberTable <UseItem>();

            proxy.api_get_member_slot_item.TryParse <kcsapi_slotitem[]>().Subscribe(x => this.Update(x.Data));
            proxy.api_req_kousyou_createitem.TryParse <kcsapi_createitem>().Subscribe(x => this.CreateItem(x.Data));
            proxy.api_req_kousyou_destroyitem2.TryParse <kcsapi_destroyitem2>().Subscribe(this.DestroyItem);

            // API no longer provides stock equipment list in mst_ship
            // proxy.api_req_sortie_battleresult.TryParse<kcsapi_battleresult>().Subscribe(x => this.DropShip(x.Data));

            proxy.api_get_member_useitem.TryParse <kcsapi_useitem[]>().Subscribe(x => this.Update(x.Data));

            proxy.api_req_kousyou_remodel_slot.TryParse <kcsapi_remodel_slot>().Subscribe(x => this.RemoveFromRemodel(x.Data));
        }
コード例 #49
0
ファイル: Logger.cs プロジェクト: nfls20030708/KanColleViewer
        internal Logger(KanColleProxy proxy)
        {
            this.EnableLogging = KanColleClient.Current.Settings.EnableLogging;

            this.shipmats = new int[5];

            // ちょっと考えなおす
            proxy.api_req_kousyou_createitem.TryParse<kcsapi_createitem>().Subscribe(x => this.CreateItem(x.Data, x.Request));
            proxy.api_req_kousyou_createship.TryParse<kcsapi_createship>().Subscribe(x => this.CreateShip(x.Request));
            proxy.api_get_member_kdock.TryParse<kcsapi_kdock[]>().Subscribe(x => this.KDock(x.Data));
            proxy.api_req_sortie_battleresult.TryParse<kcsapi_battleresult>().Subscribe(x => this.BattleResult(x.Data));
            proxy.api_req_combined_battle_battleresult.TryParse<kcsapi_combined_battle_battleresult>().Subscribe(x => this.BattleResult(x.Data));
            proxy.api_get_member_material.TryParse<kcsapi_material[]>().Subscribe(x => this.MaterialsHistory(x.Data));
            proxy.api_req_hokyu_charge.TryParse<kcsapi_charge>().Subscribe(x => this.MaterialsHistory(x.Data.api_material));
            proxy.api_req_kousyou_destroyship.TryParse<kcsapi_destroyship>().Subscribe(x => this.MaterialsHistory(x.Data.api_material));
        }
コード例 #50
0
        private void SubscribeSortieSessions(KanColleProxy proxy)
        {
            proxy.ApiSessionSource
            .SkipUntil(proxy.api_req_map_start.TryParse().Do(this.Sortie))
            .TakeUntil(proxy.api_port)
            .Finally(this.Homing)
            .Repeat()
            .Subscribe();

            Ship evacuationOfferedShip = null;
            Ship towOfferedShip        = null;

            proxy.api_req_combined_battle_battleresult
            .TryParse <kcsapi_combined_battle_battleresult>()
            .Where(x => x.Data.api_escape != null)
            .Select(x => x.Data)
            .Subscribe(x =>
            {
                if (this.CombinedFleet == null)
                {
                    return;
                }
                var ships             = this.CombinedFleet.Fleets.SelectMany(f => f.Ships).ToArray();
                evacuationOfferedShip = x.api_escape.api_escape_idx.Select(idx => ships[idx - 1]).FirstOrDefault();
                towOfferedShip        = x.api_escape.api_tow_idx.Select(idx => ships[idx - 1]).FirstOrDefault();
            });
            proxy.api_req_combined_battle_goback_port
            .Subscribe(_ =>
            {
                if (KanColleClient.Current.IsInSortie &&
                    evacuationOfferedShip != null &&
                    towOfferedShip != null)
                {
                    this.evacuatedShipsIds.Add(evacuationOfferedShip.Id);
                    this.towShipIds.Add(towOfferedShip.Id);
                    evacuationOfferedShip.Situation |= ShipSituation.Evacuation;
                    towOfferedShip.Situation        |= ShipSituation.Tow;
                }
            });
            proxy.api_get_member_ship_deck
            .Subscribe(_ =>
            {
                evacuationOfferedShip = null;
                towOfferedShip        = null;
            });
        }
コード例 #51
0
ファイル: Logger.cs プロジェクト: gensuihime/KanColleViewer
 internal Logger(KanColleProxy proxy)
 {
     this.shipmats = new int[5];
     try
     {
         proxy.api_req_sortie_battleresult.TryParse <kcsapi_battleresult>().Subscribe(x => this.BattleResult(x.Data));
         proxy.api_req_combined_battle_battleresult.TryParse <kcsapi_battleresult>().Subscribe(x => this.BattleResult(x.Data));
     }
     catch (Exception ex)
     {
         System.Diagnostics.Debug.WriteLine(ex);
     }
     // ちょっと考えなおす
     proxy.api_req_kousyou_createitem.TryParse <kcsapi_createitem>().Subscribe(x => this.CreateItem(x.Data, x.Request));
     proxy.api_req_kousyou_createship.TryParse <kcsapi_createship>().Subscribe(x => this.CreateShip(x.Request));
     proxy.api_get_member_kdock.TryParse <kcsapi_kdock[]>().Subscribe(x => this.KDock(x.Data));
 }
コード例 #52
0
ファイル: Itemyard.cs プロジェクト: nagatoyk/KanColleViewer
        internal Itemyard(KanColleProxy proxy)
        {
            this.SlotItems = new MemberTable<SlotItem>();
            this.UseItems = new MemberTable<UseItem>();

            proxy.api_get_member_slot_item.TryParse<kcsapi_slotitem[]>().Subscribe(x => this.Update(x.Data));
            proxy.api_req_kousyou_createitem.TryParse<kcsapi_createitem>().Subscribe(x => this.CreateItem(x.Data));
            proxy.api_req_kousyou_destroyitem2.TryParse<kcsapi_destroyitem2>().Subscribe(this.DestroyItem);
            // 出撃中の装備数調整は諦め!

            proxy.api_get_member_useitem.TryParse<kcsapi_useitem[]>().Subscribe(x => this.Update(x.Data));

            proxy.api_req_kousyou_remodel_slot.TryParse<kcsapi_remodel_slot>().Subscribe(x =>
            {
                this.RemoveFromRemodel(x.Data);
                this.RemodelSlotItem(x.Data);
            });
        }
コード例 #53
0
        internal Itemyard(KanColleProxy proxy)
        {
            this.SlotItems = new MemberTable <SlotItem>();
            this.UseItems  = new MemberTable <UseItem>();

            proxy.api_get_member_slot_item.TryParse <kcsapi_slotitem[]>().Subscribe(x => this.Update(x.Data));
            proxy.api_req_kousyou_createitem.TryParse <kcsapi_createitem>().Subscribe(x => this.CreateItem(x.Data));
            proxy.api_req_kousyou_destroyitem2.TryParse <kcsapi_destroyitem2>().Subscribe(this.DestroyItem);
            // 出撃中の装備数調整は諦め!

            proxy.api_get_member_useitem.TryParse <kcsapi_useitem[]>().Subscribe(x => this.Update(x.Data));

            proxy.api_req_kousyou_remodel_slot.TryParse <kcsapi_remodel_slot>().Subscribe(x =>
            {
                this.RemoveFromRemodel(x.Data);
                this.RemodelSlotItem(x.Data);
            });
        }
コード例 #54
0
        private KanColleClient()
        {
            var proxy = new KanColleProxy();
            var basic = proxy.api_get_member_basic.TryParse <kcsapi_basic>().FirstAsync().ToTask();
            var kdock = proxy.api_get_member_kdock.TryParse <kcsapi_kdock[]>().FirstAsync().ToTask();
            var sitem = proxy.api_get_member_slot_item.TryParse <kcsapi_slotitem[]>().FirstAsync().ToTask();

            this.Updater      = new Updater();
            this.Translations = new Translations();

            this.Logger    = new Logger(proxy);
            this.WebLogger = new WebLogger(proxy);

            proxy.api_start2.FirstAsync().Subscribe(async session =>
            {
                var timeout       = Task.Delay(TimeSpan.FromSeconds(20));
                var canInitialize = await Task.WhenAny(new Task[] { basic, kdock, sitem }.WhenAll(), timeout) != timeout;

                // タイムアウト仕掛けてるのは、今後のアップデートで basic, kdock, slot_item のいずれかが来なくなったときに
                // 起動できなくなる (IsStarted を true にできなくなる) のを防ぐため
                // -----
                // ま、そんな規模の変更があったらそもそもまともに動作せんだろうがな ☝(◞‸◟)☝ 野良ツールはつらいよ

                SvData <kcsapi_start2> svd;
                if (!SvData.TryParse(session, out svd))
                {
                    return;
                }

                this.Master   = new Master(svd.Data);
                this.Homeport = new Homeport(proxy);

                if (canInitialize)
                {
                    this.Homeport.UpdateAdmiral((await basic).Data);
                    this.Homeport.Itemyard.Update((await sitem).Data);
                    this.Homeport.Dockyard.Update((await kdock).Data);
                }

                this.IsStarted = true;
            });

            this.Proxy = proxy;
        }
コード例 #55
0
        internal Quests(KanColleProxy proxy)
        {
            this.questPages = new Dictionary <int, List <ConcurrentDictionary <int, Quest> > >();
            this.IsUntaken  = new Dictionary <int, bool>();
            this.IsEmpty    = new Dictionary <int, bool>();
            this.All        = new List <Quest>();

            proxy.api_get_member_questlist
            // .Where(x => HttpUtility.ParseQueryString(x.Request.BodyAsString)["api_tab_id"] == "0")
            .Select(Serialize)
            .Where(x => x != null)
            .Subscribe(this.Update);

            proxy.ApiSessionSource
            .Where(x => x.Request.PathAndQuery == "/kcsapi/api_req_quest/clearitemget")
            .TryParse()
            .Where(x => x.IsSuccess)
            .Subscribe(x =>
            {
                int q_id;
                if (!int.TryParse(x.Request["api_quest_id"], out q_id))
                {
                    return;
                }

                ClearQuest(q_id);
            });

            proxy.ApiSessionSource
            .Where(x => x.Request.PathAndQuery == "/kcsapi/api_req_quest/stop")
            .TryParse()
            .Where(x => x.IsSuccess)
            .Subscribe(x =>
            {
                int q_id;
                if (!int.TryParse(x.Request["api_quest_id"], out q_id))
                {
                    return;
                }

                StopQuest(q_id);
            });
        }
コード例 #56
0
        /// <summary>
        /// 전투결과를 미리 계산합니다. 옵션 설정으로 미리 전투결과를 보거나 보지 않을 수 있습니다.
        /// </summary>
        /// <param name="proxy"></param>
        public OracleOfCompass(KanColleProxy proxy)
        {
            this.DataLists = new ResultCalLists();
            try
            {
                #region 연합함대 전투. airbattle과 일반 연합함대 전투, 수뢰전대 전투가 여기에 포함. 야전은 모두 동일
                proxy.api_req_combined_battle_airbattle.TryParse<kcsapi_battle>().Subscribe(x => this.AirBattle(x.Data));
                proxy.api_req_combined_battle_battle.TryParse<kcsapi_battle>().Subscribe(x => this.Battle(false, false, x.Data, true));
                proxy.api_req_combined_battle_midnight_battle.TryParse<kcsapi_midnight_battle>().Subscribe(x => this.MidBattle(true, false, x.Data, true));
                proxy.api_req_combined_battle_battle_water.TryParse<kcsapi_battle>().Subscribe(x => this.Battle(true, false, x.Data, true));
                proxy.api_req_combined_battle_sp_midnight.TryParse<kcsapi_midnight_battle>().Subscribe(x => this.MidBattle(false, false, x.Data, true));

                #endregion

                #region BattleResult관련. 연합함대와 일반전투만 포함. 연습전 결과는 무시
                proxy.api_req_sortie_battleresult.TryParse<kcsapi_combined_battle_battleresult>().Subscribe(x => this.Result(x.Data));
                proxy.api_req_combined_battle_battleresult.TryParse<kcsapi_combined_battle_battleresult>().Subscribe(x => this.Result(x.Data));
                #endregion

                #region 연습전(주간,야간)
                proxy.api_req_practice_battle.TryParse<kcsapi_battle>().Subscribe(x => this.Battle(false, true, x.Data, false));
                proxy.api_req_practice_midnight_battle.TryParse<kcsapi_midnight_battle>().Subscribe(x => this.MidBattle(true, true, x.Data, false));
                #endregion
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
                KanColleClient.Current.CatchedErrorLogWriter.ReportException(ex.Source, ex);
            }
            #region 일반 전투. 야전방과 야전->주간전도 여기에 포함
            proxy.api_req_sortie_battle.TryParse<kcsapi_battle>().Subscribe(x => this.Battle(false, false, x.Data, false));
            proxy.api_req_sortie_night_to_day.TryParse<kcsapi_battle>().Subscribe(x => this.Battle(false, false, x.Data, false));
            proxy.api_req_battle_midnight_battle.TryParse<kcsapi_midnight_battle>().Subscribe(x => this.MidBattle(true, false, x.Data, false));
            proxy.api_req_battle_midnight_sp_midnight.TryParse<kcsapi_midnight_battle>().Subscribe(x => this.MidBattle(false, false, x.Data, false));
            #endregion

            #region 변수 초기화 관련
            proxy.api_req_map_start.TryParse<kcsapi_map_next>().Subscribe(x => CellInfo(x.Data, true));
            proxy.api_req_map_next.TryParse<kcsapi_map_next>().Subscribe(x => CellInfo(x.Data));
            proxy.api_port.TryParse().Subscribe(x => this.Cleared(true));
            #endregion
        }
コード例 #57
0
ファイル: Logger.cs プロジェクト: Sinwee/KanColleViewer
        internal Logger(KanColleProxy proxy)
        {
            this.shipmats = new int[5];
            try
            {
                proxy.api_req_sortie_battleresult.TryParse<kcsapi_battleresult>().Subscribe(x => this.BattleResult(x.Data));
                proxy.api_req_combined_battle_battleresult.TryParse<kcsapi_battleresult>().Subscribe(x => this.BattleResult(x.Data));

                // ちょっと考えなおす
                proxy.api_req_kousyou_createitem.TryParse<kcsapi_createitem>().Subscribe(x => this.CreateItem(x.Data, x.Request));
                proxy.api_req_kousyou_createship.TryParse<kcsapi_createship>().Subscribe(x => this.CreateShip(x.Request));
                proxy.api_get_member_kdock.TryParse<kcsapi_kdock[]>().Subscribe(x => this.KDock(x.Data));

            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex);
                KanColleClient.Current.CatchedErrorLogWriter.ReportException(ex.Source, ex);
            }
        }
コード例 #58
0
		public Organization(Homeport parent, KanColleProxy proxy)
		{
			this.homeport = parent;

			this.Ships = new MemberTable<Ship>();
			this.Fleets = new MemberTable<Fleet>();

			proxy.api_get_member_ship.TryParse<kcsapi_ship2[]>().Subscribe(x => this.Update(x.Data));
			proxy.api_get_member_ship2.TryParse<kcsapi_ship2[]>().Subscribe(x =>
			{
				this.Update(x.Data);
				this.Update(x.Fleets);
			});
			proxy.api_get_member_ship3.TryParse<kcsapi_ship3>().Subscribe(x =>
			{
				this.Update(x.Data.api_ship_data);
				this.Update(x.Data.api_deck_data);
			});

			proxy.api_get_member_deck.TryParse<kcsapi_deck[]>().Subscribe(x => this.Update(x.Data));
			proxy.api_get_member_deck_port.TryParse<kcsapi_deck[]>().Subscribe(x => this.Update(x.Data));

			proxy.api_req_hensei_change.TryParse().Subscribe(this.Change);
			proxy.api_req_hokyu_charge.TryParse<kcsapi_charge>().Subscribe(x => this.Charge(x.Data));
			proxy.api_req_kaisou_powerup.TryParse<kcsapi_powerup>().Subscribe(this.Powerup);
			proxy.api_req_kousyou_getship.TryParse<kcsapi_kdock_getship>().Subscribe(x => this.GetShip(x.Data));
			proxy.api_req_kousyou_destroyship.TryParse<kcsapi_destroyship>().Subscribe(this.DestoryShip);
			proxy.api_req_member_updatedeckname.TryParse().Subscribe(this.UpdateFleetName);

			proxy.api_req_hensei_combined.TryParse<kcsapi_hensei_combined>()
				.Subscribe(x => this.Combined = x.Data.api_combined == 1);

			proxy.ApiSessionSource
				.SkipUntil(proxy.api_req_map_start.TryParse().Do(this.Sortie))
				.TakeUntil(proxy.api_port)
				.Finally(this.Homing)
				.Repeat()
				.Subscribe();
		}
コード例 #59
0
ファイル: Master.cs プロジェクト: Quizp2p/KanColleViewer
        internal Master(KanColleProxy proxy)
        {
            this.Ships = new MasterTable<ShipInfo>();
            proxy.ApiSessionSource.Where(x => x.PathAndQuery == "/kcsapi/api_get_master/ship")
                .TryParse<kcsapi_master_ship[]>()
                .Subscribe(x => this.Ships = new MasterTable<ShipInfo>(x.Select(s => new ShipInfo(s))));

            this.SlotItems = new MasterTable<SlotItemInfo>();
            proxy.ApiSessionSource.Where(x => x.PathAndQuery == "/kcsapi/api_get_master/slotitem")
                .TryParse<kcsapi_master_slotitem[]>()
                .Subscribe(x => this.SlotItems = new MasterTable<SlotItemInfo>(x.Select(s => new SlotItemInfo(s))));

            this.UseItems = new MasterTable<UseItemInfo>();
            proxy.ApiSessionSource.Where(x => x.PathAndQuery == "/kcsapi/api_get_master/useitem")
                .TryParse<kcsapi_master_useitem[]>()
                .Subscribe(x => this.UseItems = new MasterTable<UseItemInfo>(x.Select(s => new UseItemInfo(s))));

            this.ShipTypes = new MasterTable<ShipType>();
            proxy.ApiSessionSource.Where(x => x.PathAndQuery == "/kcsapi/api_get_master/stype")
                .TryParse<kcsapi_stype[]>()
                .Subscribe(x => this.ShipTypes = new MasterTable<ShipType>(x.Select(s => new ShipType(s))));
        }
コード例 #60
0
ファイル: Organization.cs プロジェクト: zw0rld/KanColleViewer
        private void SubscribeSortieSessions(KanColleProxy proxy)
        {
            proxy.ApiSessionSource
                .SkipUntil(proxy.api_req_map_start.TryParse().Do(this.Sortie))
                .TakeUntil(proxy.api_port)
                .Finally(this.Homing)
                .Repeat()
                .Subscribe();

            int[] evacuationOfferedShipIds = null;
            int[] towOfferedShipIds = null;

            proxy.api_req_combined_battle_battleresult
                .TryParse<kcsapi_combined_battle_battleresult>()
                .Where(x => x.Data.api_escape != null)
                .Select(x => x.Data)
                .Subscribe(x =>
                {
                    if (this.CombinedFleet == null) return;
                    var ships = this.CombinedFleet.Fleets.SelectMany(f => f.Ships).ToArray();
                    evacuationOfferedShipIds = x.api_escape.api_escape_idx.Select(idx => ships[idx - 1].Id).ToArray();
                    towOfferedShipIds = x.api_escape.api_tow_idx.Select(idx => ships[idx - 1].Id).ToArray();
                });
            proxy.api_req_combined_battle_goback_port
                .Subscribe(_ =>
                {
                    if (KanColleClient.Current.IsInSortie
                        && evacuationOfferedShipIds != null
                        && evacuationOfferedShipIds.Length >= 1
                        && towOfferedShipIds != null
                        && towOfferedShipIds.Length >= 1)
                    {
                        this.evacuatedShipsIds.Add(evacuationOfferedShipIds[0]);
                        this.towShipIds.Add(towOfferedShipIds[0]);
                    }
                });
            proxy.api_get_member_ship_deck
                .Subscribe(_ =>
                {
                    evacuationOfferedShipIds = null;
                    towOfferedShipIds = null;
                });
        }