You can now claim 1 and 2 star bases in cw

This commit is contained in:
Kwoth 2016-12-14 18:20:00 +01:00
parent 6b56f0dbc3
commit 4fab1d8431

View File

@ -28,8 +28,8 @@ namespace NadekoBot.Modules.ClashOfClans
{ {
if (baseNumber < 0 || baseNumber >= cw.Bases.Count) if (baseNumber < 0 || baseNumber >= cw.Bases.Count)
throw new ArgumentException("Invalid base number"); throw new ArgumentException("Invalid base number");
if (cw.Bases[baseNumber].CallUser != null) if (cw.Bases[baseNumber].CallUser != null && cw.Bases[baseNumber].Stars == 3)
throw new ArgumentException("That base is already claimed."); throw new ArgumentException("That base is already destroyed.");
for (var i = 0; i < cw.Bases.Count; i++) for (var i = 0; i < cw.Bases.Count; i++)
{ {
if (cw.Bases[i]?.BaseDestroyed == false && cw.Bases[i]?.CallUser == u) if (cw.Bases[i]?.BaseDestroyed == false && cw.Bases[i]?.CallUser == u)
@ -95,8 +95,15 @@ namespace NadekoBot.Modules.ClashOfClans
else else
{ {
var left = (cw.WarState == StateOfWar.Started) ? twoHours - (DateTime.UtcNow - cw.Bases[i].TimeAdded) : twoHours; var left = (cw.WarState == StateOfWar.Started) ? twoHours - (DateTime.UtcNow - cw.Bases[i].TimeAdded) : twoHours;
if (cw.Bases[i].Stars == 3)
{
sb.AppendLine($"`{i + 1}.` ✅ `{cw.Bases[i].CallUser}` {left.Hours}h {left.Minutes}m {left.Seconds}s left"); sb.AppendLine($"`{i + 1}.` ✅ `{cw.Bases[i].CallUser}` {left.Hours}h {left.Minutes}m {left.Seconds}s left");
} }
else
{
sb.AppendLine($"`{i + 1}.` ✅ `{cw.Bases[i].CallUser}` {left.Hours}h {left.Minutes}m {left.Seconds}s left {new string('⭐', cw.Bases[i].Stars)} {string.Concat(Enumerable.Repeat("🔸", 3 - cw.Bases[i].Stars))}");
}
}
} }
} }