Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void Set(ulong userid, RaidableMode mode)
- {
- if (userid.HasPermission("raidablebases.buyraid.bypass.cooldown"))
- {
- return;
- }
- var diff = mode == RaidableMode.Easy ? Easy : mode == RaidableMode.Medium ? Medium : mode == RaidableMode.Hard ? Hard : mode == RaidableMode.Expert ? Expert : Nightmare;
- if (diff.Cooldown <= 0)
- {
- return;
- }
- var cooldowns = new List<double>() { diff.Cooldown };
- var player = BasePlayer.FindByID(userid);
- if (player.IsReallyValid())
- {
- if (player.IsFlying)
- {
- player.ChatMessage("FLYING"); return;
- }
- if (player.IsAdmin || player.IsDeveloper)
- {
- player.ChatMessage("ADMIN/DEV"); cooldowns.Add(diff.Admin);
- }
- }
- if (userid.HasPermission("raidablebases.vipcooldown"))
- {
- player.ChatMessage("VIP"); cooldowns.Add(diff.VIP);
- }
- if (userid.HasPermission("raidablebases.allow"))
- {
- player.ChatMessage("ALLOW"); cooldowns.Add(diff.Allow);
- }
- double cooldown = double.MaxValue;
- foreach (double value in cooldowns)
- {
- if (value < cooldown)
- {
- cooldown = value;
- }
- }
- if (cooldown <= 0)
- {
- player.ChatMessage("NO COOLDOWN SET");
- return;
- }
- player.ChatMessage("COOLDOWN APPLIED");
- BuyableInfo bi;
- if (!data.BuyableCooldowns.TryGetValue(userid, out bi))
- {
- data.BuyableCooldowns[userid] = bi = new BuyableInfo();
- }
- string expiredDate = DateTime.Now.AddSeconds(cooldown).ToString();
- switch (mode)
- {
- case RaidableMode.Easy: bi.Easy = expiredDate; break;
- case RaidableMode.Medium: bi.Medium = expiredDate; break;
- case RaidableMode.Hard: bi.Hard = expiredDate; break;
- case RaidableMode.Expert: bi.Expert = expiredDate; break;
- case RaidableMode.Nightmare: bi.Nightmare = expiredDate; break;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement