Пример #1
0
        private void ApplyCooldown(NWPlayer pc, CooldownCategory cooldown, IPerk ability)
        {
            float finalCooldown   = ability.CooldownTime(pc, (float)cooldown.BaseCooldownTime);
            int   cooldownSeconds = (int)finalCooldown;
            int   cooldownMillis  = (int)((finalCooldown - cooldownSeconds) * 100);

            PCCooldown pcCooldown = _db.PCCooldowns.Single(x => x.PlayerID == pc.GlobalID && x.CooldownCategoryID == cooldown.CooldownCategoryID);

            pcCooldown.DateUnlocked = DateTime.UtcNow.AddSeconds(cooldownSeconds).AddMilliseconds(cooldownMillis);
            _db.SaveChanges();
        }
Пример #2
0
        public void ApplyCooldown(NWPlayer pc, CooldownCategory cooldown, IPerk ability)
        {
            float finalCooldown   = ability.CooldownTime(pc, (float)cooldown.BaseCooldownTime);
            int   cooldownSeconds = (int)finalCooldown;
            int   cooldownMillis  = (int)((finalCooldown - cooldownSeconds) * 100);

            PCCooldown pcCooldown = _data.GetAll <PCCooldown>().Single(x => x.PlayerID == pc.GlobalID && x.CooldownCategoryID == cooldown.ID);

            pcCooldown.DateUnlocked = DateTime.UtcNow.AddSeconds(cooldownSeconds).AddMilliseconds(cooldownMillis);
            _data.SubmitDataChange(pcCooldown, DatabaseActionType.Update);
        }