.novel done, waifutransfer almost done
This commit is contained in:
@ -9,13 +9,15 @@ namespace NadekoBot.Modules.Gambling.Services
|
||||
public class WaifuService : INService
|
||||
{
|
||||
private readonly DbService _db;
|
||||
private readonly CurrencyService _cs;
|
||||
|
||||
public ConcurrentDictionary<ulong, DateTime> DivorceCooldowns { get; } = new ConcurrentDictionary<ulong, DateTime>();
|
||||
public ConcurrentDictionary<ulong, DateTime> AffinityCooldowns { get; } = new ConcurrentDictionary<ulong, DateTime>();
|
||||
|
||||
public WaifuService(DbService db)
|
||||
public WaifuService(DbService db, CurrencyService cs)
|
||||
{
|
||||
_db = db;
|
||||
_cs = cs;
|
||||
}
|
||||
|
||||
public async Task<bool> WaifuTransfer(IUser owner, ulong waifuId, IUser newOwner)
|
||||
@ -29,12 +31,22 @@ namespace NadekoBot.Modules.Gambling.Services
|
||||
if (waifu.ClaimerId != ownerUser.Id)
|
||||
return false;
|
||||
|
||||
if (!await _cs.RemoveAsync(owner.Id,
|
||||
"Waifu Transfer",
|
||||
waifu.Price / 10,
|
||||
uow).ConfigureAwait(false))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
//new claimerId is the id of the new owner
|
||||
var newOwnerUser = uow.DiscordUsers.GetOrCreate(newOwner);
|
||||
waifu.ClaimerId = newOwnerUser.Id;
|
||||
|
||||
await uow.CompleteAsync().ConfigureAwait(false);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user