Exemplo n.º 1
0
        private void PopulateShifts(ActiveShifts shifts)
        {
            _activeShiftsModel = shifts;
            var startTime = DateTime.Now;

            _log.Info("PopulateShifts method call started");
            LoginModel.Shifts = new List <string>();


            foreach (var shift in _activeShiftsModel.Shifts)
            {
                LoginModel.Shifts.Add(shift.DisplayFormat);
                if (!Shifts.ContainsKey(shift.DisplayFormat))
                {
                    Shifts.Add(shift.DisplayFormat, shift.ShiftNumber);
                }
            }

            LoginModel.TillFloat = _activeShiftsModel.CashFloat.ToString("0.00", CultureInfo.InvariantCulture);
            var endTime = DateTime.Now;

            MessengerInstance.Send(new CloseKeyboardMessage());
            _log.Info(string.Format("PopulateShifts method call ended in {0}ms",
                                    (endTime - startTime).TotalMilliseconds));
        }
Exemplo n.º 2
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="shifts"></param>
 public void UpdateShifts(Dictionary <long, Shift> shifts)
 {
     foreach (var shift in shifts)
     {
         if (!Shifts.ContainsKey(shift.Key))
         {
             if (!Shifts.TryAdd(shift.Key, shift.Value))
             {
                 // leave loop here as we couldn't add
                 break;
             }
         }
     }
 }
Exemplo n.º 3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="blockHeight"></param>
        public bool Evolve(out GameLog history)
        {
            // any shift left?
            if (!Shifts.ContainsKey(Pointer + 1))
            {
                history = null;
                return(false);
            }

            // increase pointer to next block height
            Pointer++;

            // set current shift to the actual shift we process
            currentShift = Shifts[Pointer];

            // assign game log for this shift
            history = currentShift.History;

            // first we always calculated current lazy experience
            double lazyExp = Experience.GetExp(CurrentLevel, currentShift);

            if (lazyExp > 0)
            {
                AddExp(Experience.GetExp(CurrentLevel, currentShift));
            }

            // we go for the adventure if there is one up
            if (Adventure != null && Adventure.IsActive)
            {
                Adventure.NextStep(this, currentShift);
                return(true);
            }

            Adventure = null;


            if (!currentShift.IsSmallShift)
            {
                switch (currentShift.Interaction.InteractionType)
                {
                case InteractionType.ADVENTURE:
                    Adventure = AdventureGenerator.Create(currentShift, (AdventureAction)currentShift.Interaction);
                    break;

                case InteractionType.LEVELING:
                    Console.WriteLine("Received a leveling action!");
                    break;

                default:
                    break;
                }
            }

            // lazy health regeneration
            if (MogwaiState == MogwaiState.NONE)
            {
                Heal(currentShift.IsSmallShift ? 2 * CurrentLevel : CurrentLevel, HealType.REST);
            }

            History.Add(LogType.INFO, $"Evolved {Name} shift ¬G{Pointer}§!¬");

            // no more shifts to proccess, no more logging possible to the game log
            currentShift = null;

            return(true);
        }