public async Task DailyRCheck(ISocketMessageChannel chan) { string message = null; Player player = Player.Load(Context.BotUser); if (player.userTimers.dailyLoot <= DateTime.UtcNow || (player.userTimers.dailyLoot.Day == DateTime.UtcNow.Day)) { EmbedBuilder loot = DailyReward(player); if (loot.Footer != null) { message = loot.Footer.Text; loot.Footer.Text = " "; } DUtils.DeleteMessage(await chan.SendMessageAsync(message, embed: loot.Build())); await DUtils.DeleteContextMessageAsync(Context); player.QuestTrigger(Neitsillia.Items.Quests.Quest.QuestTrigger.CollectingDaily); } else { DUtils.DeleteMessage(await chan.SendMessageAsync($"You greedy mortal, you must wait " + $"{Timers.CoolDownToString(player.userTimers.dailyLoot)}.")); } }
public async Task JumpFloor(int floors) { Player player = Context.Player; floors = Verify.Max(floors, player.Area.floors - player.AreaInfo.floor); if (player.Area.type == AreaType.Dungeon || player.Area.type == AreaType.Arena) { await ReplyAsync($"You may not jump floors in this {player.Area.type}. "); } else if (!player.userTimers.CanFloorJump()) { await ReplyAsync($"This action is currently on cooldown. {Timers.CoolDownToString(player.userTimers.floorJumpCooldown)} until cooldown end. "); } else if (player.AreaInfo.floor >= player.Area.floors) { await ReplyAsync($"{player.name} has already reached the maximum floor."); } else if (player.Party != null && player.Party.GetLeaderID() != player.userid) { await ReplyAsync($"Only the leader may lead the party."); } else { floors = Verify.Min(floors, 1); NPCSystems.NPC[] mobs = new NPCSystems.NPC[1]; if (player.Party != null) { mobs = new NPCSystems.NPC[player.Party.MemberCount]; } Random rng = new Random(); for (int i = 0; i < mobs.Length; i++) { mobs[i] = player.Area.GetAMob(rng, floors); mobs[i].Evolve(2, false); mobs[i].inventory.inv.Clear(); } player.EndEncounter(); player.NewEncounter(new Encounter(Encounter.Names.FloorJump, player, floors + "")); player.Encounter.mobs = mobs; player.userTimers.floorJumpCooldown = DateTime.UtcNow.AddHours(2); player.EggPocketTrigger(NPCSystems.Companions.Egg.EggChallenge.Exploration); await player.NewUI(null, player.Encounter.GetEmbed().Build(), Context.Channel, MsgType.Combat); } }
public (int tier, int level, string name) CanUse(Player player, string toolName) { DateTime cooldown = Utils.GetVar <DateTime, Timers>(player.userTimers, $"{toolName}Usage"); int tier = GetTier(toolName); int level = GetLevel(toolName); string name = ToolName(toolName, tier, level); if (cooldown > DateTime.UtcNow) { throw NeitsilliaError.ReplyError($"{player.name}, your {name} is on cooldown for {Timers.CoolDownToString(cooldown)}"); } return(tier, level, name); }