Inheritance: Livet.NotificationObject
Example #1
0
        public BattleResult(KanColleClient kanColleClient, kcsapi_battleresult br)
        {
            this.FleetType = (int)Enums.BattleType.Normal;
            this.QuestName = br.api_quest_name;
            this.QuestLevel = br.api_quest_level;
            if (br.api_enemy_info != null)
                this.DeckName = br.api_enemy_info.api_deck_name;
            this.WinRank = br.api_win_rank;
            this.Mvp = br.api_mvp;
            this.GetExp = br.api_get_exp;
            this.GetBaseExp = br.api_get_base_exp;
            if (br.api_get_ship != null)
                this.GetShip = new SimpleShip(br.api_get_ship);
            this.LvUpShips = br.api_get_exp_lvup.Select(x => Math.Max(x.Length - 2, 0)).ToArray();

            this.AdmiralId = kanColleClient.Homeport.Admiral.MemberId;

            List<SimpleShip> fleet = new List<SimpleShip>();
            kanColleClient.Homeport.Organization.Fleets.Where(f =>
                f.Value.State == Grabacr07.KanColleWrapper.Models.FleetState.Sortie).ForEach(item =>

                item.Value.Ships.ForEach(s => fleet.Add(new SimpleShip(s)))
            );
            this.Fleet = fleet.ToArray();

            this.IsFirstBattle = false;
            this.CreateDate = DateTime.Now;
            this.Id = Guid.NewGuid().ToString();
        }
Example #2
0
 public void Initialize(KanColleClient client)
 {
     client.PropertyChanged += (sender, args) =>
     {
         if (args.PropertyName == "IsStarted") this.InitializeCore(client);
     };
 }
        public PortalViewModel(KanColleClient client)
        {
            questManager = new QuestManager(client);

            questManager
                .QuestsEventChanged += (sender, e) =>
                                       {
                                           var newQC =
                                               new ObservableCollection<QuestProcessCollectionItem>();

                                           questManager
                                               .TrackingProcessStrings
                                               .ToList()
                                               .ForEach(qpc =>
                                                        {
                                                            newQC.Add(new QuestProcessCollectionItem
                                                                      {
                                                                          Id = qpc.Id,
                                                                          WikiIndex = qpc.WikiIndex,
                                                                          Name = qpc.Name,
                                                                          ProcessPercent = qpc.ProcessPercent,
                                                                          ProcessText = qpc.ProcessText
                                                                      });
                                                        });

                                           QuestProcessCollection = newQC;
                                       };
        }
Example #4
0
        public ApiEvent(KanColleClient client)
        {
            kanColleClient = client;

            // 演习 - 战斗结束
            client.Proxy.ApiSessionSource.Where(x => x.Request.PathAndQuery == "/kcsapi/api_req_practice/battle_result")
                  .TryParse<practice_result>().Subscribe(x => PracticeBattleResult(x.Data));

            // 近代化改装
            client.Proxy.api_req_kaisou_powerup.TryParse<kcsapi_powerup>().Subscribe(x => PowerUp());

            // 改修
            client.Proxy.api_req_kousyou_remodel_slot.TryParse<kcsapi_remodel_slot>().Subscribe(x => ReModel());

            // 廃棄
            client.Proxy.api_req_kousyou_destroyitem2.TryParse<kcsapi_destroyitem2>().Subscribe(x => DestoryItem());

            // 解体
            client.Proxy.api_req_kousyou_destroyship.TryParse<kcsapi_destroyship>().Subscribe(x => DestoryShip());

            // 建造
            client.Proxy.api_req_kousyou_createship.TryParse<kcsapi_createship>().Subscribe(x => CreateShip());

            // 开发
            client.Proxy.api_req_kousyou_createitem.TryParse<kcsapi_createitem>().Subscribe(x => CreateItem());

            // 补给
            client.Proxy.api_req_hokyu_charge.TryParse<kcsapi_charge>().Subscribe(x => Charge());

            // 入渠
            client.Proxy.ApiSessionSource.Where(x => x.Request.PathAndQuery == "/kcsapi/api_req_nyukyo/start")
                  .Subscribe(x => NyukyoStart());

            // 遠征
            client.Proxy.api_req_mission_result.TryParse<kcsapi_mission_result>().Subscribe(x => MissionResult(x.Data));

            // 地图开始
            client.Proxy.api_req_map_start.TryParse<kcsapi_map_start>().Subscribe(x => MapStart(x.Data));

            // 通常 - 昼战
            client.Proxy.api_req_sortie_battle.TryParse<sortie_battle>().Subscribe(x => Battle(x.Data));

            // 通常 - 夜战
            client.Proxy.ApiSessionSource.Where(x => x.Request.PathAndQuery == "/kcsapi/api_req_battle_midnight/battle")
                  .TryParse<battle_midnight_battle>().Subscribe(x => Battle(x.Data));

            // 通常 - 开幕夜战
            client.Proxy.ApiSessionSource.Where(
                                                x =>
                                                x.Request.PathAndQuery == "/kcsapi/api_req_battle_midnight/sp_midnight")
                  .TryParse<battle_midnight_sp_midnight>().Subscribe(x => Battle(x.Data));

            // 战斗结束
            client.Proxy.api_req_sortie_battleresult.TryParse<kcsapi_battleresult>()
                  .Subscribe(x => BattleResult(x.Data));
            client.Proxy.api_req_combined_battle_battleresult.TryParse<kcsapi_combined_battle_battleresult>()
                  .Subscribe(x => BattleResult(x.Data));
        }
Example #5
0
        public QuestManager(KanColleClient client)
        {
            apiEvent = new ApiEvent(client);

            availableTrackers.CollectionChanged += AvailableTrackers_CollectionChanged;

            // register all trackers
            RegisterAllTrackers();

            client.Proxy.api_get_member_questlist.Subscribe(x => new Thread(ProcessQuests).Start());
        }
        /// <summary>
        /// コンストラクタ
        /// </summary>
        /// <param name="kancolleData">艦これデータ</param>
        /// <param name="kanburaTimerUri">艦ぶらたいまーのサーバホスト名</param>
        /// <param name="userId">提督iD</param>
        /// <param name="password">パスワード</param>
        public KanburaTimerSender(
            KanColleClient kancolleClient,
            KanburaTimerClient client,
            int delay = 10000)
        {
            if (kancolleClient == null) { throw new ArgumentNullException("proxy"); }
            if (client == null) { throw new ArgumentNullException("client"); }
            if (delay < 0) { throw new ArgumentOutOfRangeException("delay", "delay must be > 0"); }
            proxy_ = kancolleClient;
            client_ = client;

            // 送信用タイマを作成
            timer_ = new Timer(delay);
            timer_.AutoReset = false;
            timer_.Elapsed += SendTimerElapsed;
        }
        public KanburaTimerToolViewModel(
            KanColleClient kancolleClient,
            Models.Settings settings,
            IDispatcher dispatcher)
            : base(dispatcher)
        {
            if (kancolleClient == null) { throw new ArgumentNullException("kancolleClient"); }
            if (settings == null) { throw new ArgumentNullException("settings"); }
            kanColleClient_ = kancolleClient;
            Settings = settings;

            Settings.PropertyChanged += Settings_PropertyChanged;
            UpdateAdmiralInfo();
            if (Settings.IsAuthorized) {
                StartSending();
            }
        }
Example #8
0
		private void InitializeCore(KanColleClient client)
		{
			client.Homeport.Repairyard.PropertyChanged += (sender, args) =>
			{
				if (args.PropertyName == "Docks") UpdateRepairyard(client.Homeport.Repairyard);
			};
			UpdateRepairyard(client.Homeport.Repairyard);

			client.Homeport.Dockyard.PropertyChanged += (sender, args) =>
			{
				if (args.PropertyName == "Docks") UpdateDockyard(client.Homeport.Dockyard);
			};
			UpdateDockyard(client.Homeport.Dockyard);

			client.Homeport.Organization.PropertyChanged += (sender, args) =>
			{
				if (args.PropertyName == "Fleets") UpdateFleets(client.Homeport.Organization);
			};
			UpdateFleets(client.Homeport.Organization);
		}
Example #9
0
        public BattleResult(KanColleClient kanColleClient, kcsapi_combined_battle_battleresult br)
        {
            this.FleetType = (int)Enums.BattleType.Combined;
            this.QuestName = br.api_quest_name;
            this.QuestLevel = br.api_quest_level;
            if (br.api_enemy_info != null)
                this.DeckName = br.api_enemy_info.api_deck_name;
            this.WinRank = br.api_win_rank;
            this.GetExp = br.api_get_exp;
            this.GetBaseExp = br.api_get_base_exp;
            if (br.api_get_ship != null)
                this.GetShip = new SimpleShip(br.api_get_ship);

            this.AdmiralId = kanColleClient.Homeport.Admiral.MemberId;


            this.Mvp = br.api_mvp;
            this.MvpCombined = br.api_mvp_combined;

            this.LvUpShips = br.api_get_exp_lvup.Select(x => Math.Max(x.Length - 2, 0)).ToArray();
            this.LvUpShipsCombined = br.api_get_exp_lvup_combined.Select(x => Math.Max(x.Length - 2, 0)).ToArray();

            List<SimpleShip> fleet = new List<SimpleShip>();
            //既然是联合舰队肯定一二队都出击
            kanColleClient.Homeport.Organization.Fleets[0].Ships.ForEach(s => fleet.Add(new SimpleShip(s)));
            this.Fleet = fleet.ToArray();

            fleet.Clear();
            kanColleClient.Homeport.Organization.Fleets[1].Ships.ForEach(s => fleet.Add(new SimpleShip(s)));
            this.FleetCombined = fleet.ToArray();


            this.IsFirstBattle = false;
            this.CreateDate = DateTime.Now;
            this.Id = Guid.NewGuid().ToString();
        }
Example #10
0
 private void OnAdmiralInfoChange(KanColleClient kanColleClient)
 {
     if (AdmiralInfoChange != null)
         AdmiralInfoChange(this, new Modes.AdmiralInfoChangeEventArgs
         {
             KanColleClient = kanColleClient
         });
 }
Example #11
0
 private void OnCombinedBattleEnd(KanColleClient kanColleClient, kcsapi_combined_battle_battleresult br, bool isFirstBattle)
 {
     if (CombinedBattleEnd != null)
         CombinedBattleEnd(this, new Modes.CombinedBattleEndEventArgs
         {
             KanColleClient = kanColleClient,
             BattleResult = br,
             IsFirstBattle = isFirstBattle
         });
 }
Example #12
0
        /// <summary>
        /// 设置战斗之后的HP
        /// </summary>
        /// <param name="kanColleClient"></param>
        /// <returns></returns>
        public bool SetFleetAfterHP(KanColleClient kanColleClient)
        {
            var result = false;
            if (this.AdmiralId == kanColleClient.Homeport.Admiral.MemberId)
            {
                var ships = GetSortieFleet(kanColleClient);
                if (ships.Count() == this.Fleet.Count())
                {
                    result = true;
                    ships.ForEach((item, i) =>
                    {
                        if (!this.Fleet[i].SetAfterHP(item))
                        {
                            result = false;
                        }
                    });
                }
            }

            return result;
        }
Example #13
0
 private IEnumerable<Ship> GetSortieFleet(KanColleClient kanColleClient)
 {
     return kanColleClient.Homeport.Organization.Fleets.Where(f =>
             f.Value.State == Grabacr07.KanColleWrapper.Models.FleetState.Sortie).SelectMany(f => f.Value.Ships);
 }
        public ResourceLogManager(KanColleClient client)
        {
            CurrentFuel                = 0;
            CurrentAmmo                = 0;
            CurrentSteel               = 0;
            CurrentBauxite             = 0;
            CurrentRepairBucket        = 0;
            CurrentInstantConstruction = 0;
            CurrentDevelopmentMaterial = 0;
            CurrentImprovementMaterial = 0;

            client.PropertyChanged += (_, __) =>
            {
                if (__.PropertyName != nameof(client.IsStarted))
                {
                    return;
                }

                var materials = KanColleClient.Current.Homeport.Materials;

                #region PropertyChangedEventListener
                materials.PropertyChanged += (s, e) =>
                {
                    if (e.PropertyName == nameof(materials.Fuel))
                    {
                        CurrentFuel = materials.Fuel;
                        Task.Run(() => ListenerEventWorker());
                    }
                    if (e.PropertyName == nameof(materials.Ammunition))
                    {
                        CurrentAmmo = materials.Ammunition;
                        Task.Run(() => ListenerEventWorker());
                    }
                    if (e.PropertyName == nameof(materials.Steel))
                    {
                        CurrentSteel = materials.Steel;
                        Task.Run(() => ListenerEventWorker());
                    }
                    if (e.PropertyName == nameof(materials.Bauxite))
                    {
                        CurrentBauxite = materials.Bauxite;
                        Task.Run(() => ListenerEventWorker());
                    }
                    if (e.PropertyName == nameof(materials.InstantRepairMaterials))
                    {
                        CurrentRepairBucket = materials.InstantRepairMaterials;
                        Task.Run(() => ListenerEventWorker());
                    }
                    if (e.PropertyName == nameof(materials.InstantBuildMaterials))
                    {
                        CurrentInstantConstruction = materials.InstantBuildMaterials;
                        Task.Run(() => ListenerEventWorker());
                    }
                    if (e.PropertyName == nameof(materials.DevelopmentMaterials))
                    {
                        CurrentDevelopmentMaterial = materials.DevelopmentMaterials;
                        Task.Run(() => ListenerEventWorker());
                    }
                    if (e.PropertyName == nameof(materials.ImprovementMaterials))
                    {
                        CurrentImprovementMaterial = materials.ImprovementMaterials;
                        Task.Run(() => ListenerEventWorker());
                    }
                };
                #endregion
            };
        }
Example #15
0
 public SimpleAdmiral(KanColleClient kanColleClient)
 {
     this.Id = kanColleClient.Homeport.Admiral.MemberId;
     this.Nickname = kanColleClient.Homeport.Admiral.Nickname;
     this.Level = kanColleClient.Homeport.Admiral.Level;
 }