public async Task ConfirmCharDel(SocketReaction reaction, IUserMessage msg) { if (reaction.Emote.ToString() == ok) { string id = reaction.UserId + "\\" + data; Player p = Player.Load(id, Player.IgnoreException.All); await p.DeleteFileMongo(); if (p.Area != null && p.Area.name != "Moceoy's Basement") { NPCSystems.NPC revival = NPCSystems.NPC.GenerateNPC(p.level, "Choichoith"); if (revival != null) { revival.inventory.inv.AddRange(p.inventory.inv); NPCSystems.PopulationHandler.Add(p.Area, revival); } } await TryMSGDel(msg); await CharacterCommands.ListCharacters(reaction.User.Value, reaction.Channel); } else if (reaction.Emote.ToString() == cancel) { await TryMSGDel(msg); } }
internal static async Task EnterFLoor(Player player, ISocketMessageChannel chan) { EmbedBuilder result; string message = null; MsgType uiType = MsgType.Main; player.EndEncounter(); player.EggPocketTrigger(NPCSystems.Companions.Egg.EggChallenge.Exploration); if (AMIData.Events.OngoingEvent.Ongoing != null) { AMIData.Events.OngoingEvent.Ongoing.EventBounty(player.Area, player.AreaInfo.floor); } if (player.Area.type == AreaType.Dungeon && player.AreaInfo.floor + 1 >= player.Area.floors) { player.AreaInfo.floor++; NPCSystems.NPC mob = Dungeons.GetBoss(player.Area); player.NewEncounter(new Encounter("Mob", player) { mobs = new NPCSystems.NPC[] { mob } }); result = DUtils.BuildEmbed("Boss Battle", "You've encountered a " + mob.name, null, player.userSettings.Color, DUtils.NewField(mob.displayName, "Level: " + mob.level + Environment.NewLine + "Rank: " + mob.Rank() + Environment.NewLine + $"Health: {mob.health}/{mob.Health()}" + Environment.NewLine )); uiType = MsgType.Combat; } else { // Calc the amount of floors to go: // (if lower than area level, only ever 1 [else] difference of player's level and area's lvl capped at 6) capped at available floors int floors = FloorIncrease(player); player.AreaInfo.floor += floors; result = player.Area.AreaInfo(player.AreaInfo.floor).WithColor(player.userSettings.Color); message = $"You've advanced {floors} floors " + player.Area.name; } player.QuestTrigger(Quest.QuestTrigger.EnterFloor, $"{player.AreaInfo.path};{player.AreaInfo.floor}"); await player.NewUI(await chan.SendMessageAsync(message, embed: result.Build()), uiType); }
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); } }
private static async Task ExploreEmbedResult(Player player, ISocketMessageChannel chan, string message, EmbedBuilder embed) { embed.WithColor(player.userSettings.Color); MsgType menuType = MsgType.Main; if (player.Encounter != null) { if (player.Encounter.IsCombatEncounter()) { menuType = MsgType.Combat; } else { switch (player.Encounter.Name) { case Encounter.Names.Loot: { menuType = MsgType.Loot; var party = player.Party; if (party != null && party.NPCMembers.Count > 0) { NPCSystems.NPC npc = party.NPCMembers[Program.rng.Next(party.NPCMembers.Count)]; npc.TrimInventory(5); } } break; case Encounter.Names.NPC: menuType = MsgType.NPC; break; case Encounter.Names.Puzzle: menuType = MsgType.Puzzle; break; } } } var msg = await chan.SendMessageAsync(message, embed : embed.Build()); await player.NewUI(msg, menuType, null); if (!player.IsSolo && player.IsEncounter("partyshared")) { player.Party.UpdateUI(player, null); } }