コード例 #1
0
        public DataContext()
        {
            UI  = new UIViewModel();
            Map = new MapViewModel();

            MaxItemStorage    = 0;
            MaxPokemonStorage = 0;
            MaxEggStorage     = 0;
            ItemsList         = new ItemsListViewModel();
            Sidebar           = new SidebarViewModel();
            internalPokemons  = new List <PokemonData>();
            SnipeList         = new SnipeListViewModel();
            EggsList          = new EggsListViewModel();

            PokemonList = new PokemonListViewModel(Session)
            {
                Pokemons = new ObservableCollection <PokemonDataViewModel>()
            };
        }
コード例 #2
0
ファイル: PlayerInfoModel.cs プロジェクト: nexteve/NecroBot-1
        internal void DirtyEventHandle(Statistics stat)
        {
            Runtime           = stat.FormatRuntime();
            EXPPerHour        = (int)(stat.TotalExperience / stat.GetRuntime());
            PKMPerHour        = (int)(stat.TotalPokemons / stat.GetRuntime());
            TimeToLevelUp     = $"{stat.StatsExport.HoursUntilLvl:00}h :{stat.StatsExport.MinutesUntilLevel:00}m";
            Level             = stat.StatsExport.Level;
            Stardust          = stat.TotalStardust;
            Exp               = stat.StatsExport.CurrentXp - stat.StatsExport.PreviousXp;
            LevelExp          = stat.StatsExport.LevelupXp - stat.StatsExport.PreviousXp;
            PokemonTransfered = stat.TotalPokemonTransferred;
            //Still needs some work(TheWizard1328)
            //KmRemaining = incubator.TargetKmWalked - kmWalked;
            //KmToWalk = incubator.TargetKmWalked - incubator.StartKmWalked;

            //Code added by furtif
            var inventory         = Session.Inventory.GetCachedInventory().Result;
            var eggsListViewModel = new EggsListViewModel();

            eggsListViewModel.OnInventoryRefreshed(inventory);

            foreach (var x in eggsListViewModel.Incubators)
            {
                if (x.IsUnlimited && x.InUse)
                {
                    KmRemaining = x.TotalKM - x.KM;
                    KmToWalk    = x.TotalKM;
                }
            }
            //

            RaisePropertyChanged("KmToWalk");
            RaisePropertyChanged("KmRemaining");
            RaisePropertyChanged("EggPerc");

            RaisePropertyChanged("TotalPokemonTransferred;");
            RaisePropertyChanged("Runtime");
            RaisePropertyChanged("EXPPerHour");
            RaisePropertyChanged("PKMPerHour");
            RaisePropertyChanged("TimeToLevelUp");
            RaisePropertyChanged("Level");
            RaisePropertyChanged("Stardust");
            RaisePropertyChanged("Exp");
            RaisePropertyChanged("LevelExp");

            // get applied items
            var appliedItems =
                Session.Inventory.GetAppliedItems().Result
                .SelectMany(aItems => aItems.Item)
                .ToDictionary(item => item.ItemId, item => new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).AddMilliseconds(item.ExpireMs));

            var items =
                Session.Inventory.GetItems().Result
                .Where(i => i != null)
                .OrderBy(i => i.ItemId);

            bool isLucky = false;

            Lucky_expires   = $"00m 00s";
            Insence_expires = $"00m 00s";

            foreach (var item in items)
            {
                if (appliedItems.ContainsKey(item.ItemId))
                {
                    expires = appliedItems[item.ItemId];
                    if (item.ItemId == ItemId.ItemLuckyEgg)
                    {
                        isLucky = true;
                    }
                }
            }

            var time = expires - DateTime.UtcNow;

            if (expires.Ticks == 0 || time.TotalSeconds < 0)
            {
                // my value here  00m 00s
            }
            else
            {
                // my value here  00m 00s
                if (isLucky)
                {
                    Lucky_expires = $"{time.Minutes}m {Math.Abs(time.Seconds)}s";
                }
                else
                {
                    Insence_expires = $"{time.Minutes}m {Math.Abs(time.Seconds)}s";
                }
            }

            RaisePropertyChanged("Lucky_expires");
            RaisePropertyChanged("Insence_expires");
        }