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); }
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)); }
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); }
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); }
public ItemDestroyCounter(KanColleProxy proxy) { proxy.api_req_kousyou_destroyitem2 .TryParse() .Where(x => x.IsSuccess) .Subscribe(_ => this.Count++); }
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); }
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); }
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); }
public SupplyCounter(KanColleProxy proxy) { proxy.api_req_hokyu_charge .TryParse() .Where(x => x.IsSuccess) .Subscribe(_ => this.Count++); }
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)); }
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)); }
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; }
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); }); }
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); }
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); }
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); }
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++); }
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); }
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++); }
public ItemDestroyCounter(KanColleProxy proxy) { proxy.api_req_kousyou_destroyitem2 .TryParse() .Where(x => x.IsSuccess) .Subscribe(_ => this.Count++); this.Text = "Number of scrapped equipment"; }
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); }
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); }
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); }); }
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); }
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); }
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); }
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); }
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); }
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)); }
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"; }
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)); }
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); } }
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); }
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); }
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); }
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)); }
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); }
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)); }
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); }
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); }
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); }
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)); }
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)); }
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)); }
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)); }
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; }); }
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)); }
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); }); }
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); }); }
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; }
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); }); }
/// <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 }
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); } }
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(); }
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)))); }
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; }); }