public async Task GrantItem(IUser user, string itemname, int amount = 1) { Item item = Item.LoadItem(itemname); if (item == null) { await ReplyAsync("Item Not Found"); } else if (await HasFuel(item.tier, 2)) { Player player = Player.Load(user.Id, Player.IgnoreException.All); string result = $"Could not collect {item.name}"; if (player.CollectItem(item, amount)) { result = $"Collected {item.name}"; } IUserMessage reply = await ReplyAsync(user.Mention + " " + result); player.ui = new UI(reply, new List <string> { EUI.xp, EUI.inv, EUI.stats }); player.SaveFileMongo(); await DUtils.DeleteContextMessageAsync(Context); GMs.Find(GM.FindWithID(Context.User.Id)).limits[2] -= item.tier; SaveGMFile(); } await DUtils.DeleteContextMessageAsync(Context); }
public async Task GrantTempSchem(IUser user, [Remainder] string name) { if (await IsGMLevel(3)) { Item item = Item.NewTemporarySchematic(name); if (item == null) { await ReplyAsync("Item Not Found"); } else if (HasFuel(item.tier, 2).Result) { Player player = Player.Load(user.Id); string result = $"Could not collect {item.name}"; if (player.CollectItem(item, 1)) { result = $"Collected {item.name}"; } IUserMessage reply = await ReplyAsync(user.Mention + " " + result); player.ui = new UI(reply, new List <string> { EUI.xp, EUI.inv, EUI.stats }); player.SaveFileMongo(); await DUtils.DeleteContextMessageAsync(Context); GMs.Find(GM.FindWithID(Context.User.Id)).limits[2] -= item.tier; SaveGMFile(); } await DUtils.DeleteContextMessageAsync(Context); } }
public async Task GrantXP(IUser user, long xp) { if (HasFuel(xp, 1).Result) { Player player = Player.Load(user.Id, Player.IgnoreException.All); player.XpGain(xp); IUserMessage reply = await ReplyAsync(user.Mention + " gained " + xp + " XP points."); player.ui = new UI(reply, new List <string> { EUI.xp, EUI.inv, EUI.stats }); player.SaveFileMongo(); await DUtils.DeleteContextMessageAsync(Context); GMs.Find(GM.FindWithID(Context.User.Id)).limits[1] -= xp; SaveGMFile(); } }
public async Task GrantCoins(IUser user, long amount) { if (HasFuel(amount, 0).Result) { Player player = Player.Load(user.Id, Player.IgnoreException.All); player.KCoins += amount; player.SaveFileMongo(); IUserMessage reply = await ReplyAsync(user.Mention + " gained " + amount + " Kutsyei coins."); player.ui = new UI(reply, new List <string> { EUI.xp, EUI.inv, EUI.stats }); player.SaveFileMongo(); await DUtils.DeleteContextMessageAsync(Context); GMs.Find(GM.FindWithID(Context.User.Id)).limits[0] -= amount; SaveGMFile(); } await DUtils.DeleteContextMessageAsync(Context); }