This commit is contained in:
Kwoth 2016-07-27 03:10:36 +02:00
parent 7147d2f0b1
commit f025a5a062
2 changed files with 16 additions and 24 deletions

View File

@ -1,11 +1,7 @@
using Discord.Commands; using Newtonsoft.Json;
using System; using System;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Collections.Generic;
using Newtonsoft.Json;
//using Manatee.Json.Serialization; //using Manatee.Json.Serialization;
namespace NadekoBot.Classes.ClashOfClans namespace NadekoBot.Classes.ClashOfClans
@ -80,7 +76,7 @@ namespace NadekoBot.Classes.ClashOfClans
this.Bases = new Caller[size]; this.Bases = new Caller[size];
this.ServerId = serverId; this.ServerId = serverId;
this.ChannelId = channelId; this.ChannelId = channelId;
this.Channel = NadekoBot.Client.Servers.FirstOrDefault(s=>s.Id == serverId)?.TextChannels.FirstOrDefault(c => c.Id == channelId); this.Channel = NadekoBot.Client.Servers.FirstOrDefault(s => s.Id == serverId)?.TextChannels.FirstOrDefault(c => c.Id == channelId);
} }
internal void End() internal void End()
@ -155,7 +151,7 @@ namespace NadekoBot.Classes.ClashOfClans
} }
else else
{ {
var left =(WarState == WarState.Started) ? callExpire - (DateTime.UtcNow - Bases[i].TimeAdded) : callExpire; var left = (WarState == WarState.Started) ? callExpire - (DateTime.UtcNow - Bases[i].TimeAdded) : callExpire;
sb.AppendLine($"`{i + 1}.` ✅ `{Bases[i].CallUser}` {left.Hours}h {left.Minutes}m {left.Seconds}s left"); sb.AppendLine($"`{i + 1}.` ✅ `{Bases[i].CallUser}` {left.Hours}h {left.Minutes}m {left.Seconds}s left");
} }
} }

View File

@ -1,15 +1,15 @@
using Discord.Commands; using Discord.Commands;
using Discord.Modules; using Discord.Modules;
using NadekoBot.Classes.ClashOfClans; using NadekoBot.Classes.ClashOfClans;
using NadekoBot.Modules.Permissions.Classes;
using Newtonsoft.Json;
using System; using System;
using System.Collections.Concurrent; using System.Collections.Concurrent;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using NadekoBot.Modules.Permissions.Classes;
using System.Linq;
using System.IO;
using Newtonsoft.Json;
namespace NadekoBot.Modules.ClashOfClans namespace NadekoBot.Modules.ClashOfClans
{ {
@ -92,7 +92,8 @@ namespace NadekoBot.Modules.ClashOfClans
{ {
List<ClashWar> obj; List<ClashWar> obj;
ClashWars.TryRemove(cw.Key, out obj); ClashWars.TryRemove(cw.Key, out obj);
} else }
else
{ {
ClashWars.AddOrUpdate(cw.Key, newVal, (x, s) => newVal); ClashWars.AddOrUpdate(cw.Key, newVal, (x, s) => newVal);
} }
@ -137,11 +138,6 @@ namespace NadekoBot.Modules.ClashOfClans
} }
} }
#region commands #region commands
public override void Install(ModuleManager manager) public override void Install(ModuleManager manager)
{ {
@ -180,13 +176,13 @@ namespace NadekoBot.Modules.ClashOfClans
var cw = new ClashWar(enemyClan, size, e.Server.Id, e.Channel.Id); var cw = new ClashWar(enemyClan, size, e.Server.Id, e.Channel.Id);
//cw.Start(); //cw.Start();
wars.Add(cw); wars.Add(cw);
await e.Channel.SendMessage($"❗🔰**CREATED CLAN WAR AGAINST {cw.ShortPrint()}**").ConfigureAwait(false); await e.Channel.SendMessage($"❗🔰**CREATED CLAN WAR AGAINST {cw.ShortPrint()}**").ConfigureAwait(false);
Save(); Save();
//war with the index X started. //war with the index X started.
}); });
cgb.CreateCommand(Prefix + "startwar") cgb.CreateCommand(Prefix + "startwar")
.Alias(Prefix + "sw") .Alias(Prefix + "sw")