示例#1
0
        public async Task GenerateDungeon(IUser user, [Remainder] string name)
        {
            if (await IsGMLevel(3))
            {
                Player player = Player.Load(user.Id);
                Area   dungeon;
                if (name.Length > 0)
                {
                    dungeon = Dungeons.ManualDungeon(StringM.UpperAt(name), player.AreaInfo.floor, player.Area);
                }
                else
                {
                    dungeon = Dungeons.Generate(player.AreaInfo.floor, player.Area);
                }
                if (dungeon != null)
                {
                    await player.SetArea(dungeon);

                    await player.NewUI(await ReplyAsync(embed: dungeon.AreaInfo(player.AreaInfo.floor).Build()), MsgType.Main);
                }
                else
                {
                    await ReplyAsync("Dungeon not Found");
                }
            }
        }
示例#2
0
        public async Task GrantUpgradedGear(IUser user, int tier, [Remainder] string namearg)
        {
            if (await IsGMLevel(4))
            {
                Item item = Item.LoadItem(StringM.UpperAt(namearg));
                if (tier > item.tier)
                {
                    item.Scale(tier);
                }

                Player player = Player.Load(user.Id, Player.IgnoreException.All);
                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);
            }
        }
示例#3
0
 internal string UpgradeCost(string toolName, int level, int tier)
 {
     if (level >= 10 && tier >= GetAllTiers(toolName).Length - 1)
     {
         return("No upgrades available.");
     }
     return("Upgrade Cost:" + Environment.NewLine +
            Utils.RunMethod <string>(StringM.UpperAt(toolName) + "UpgradeInfo", this, level, tier));
 }
示例#4
0
        internal string Upgrade(string toolName, Player player)
        {
            int  tier  = GetTier(toolName);
            int  level = GetLevel(toolName);
            long xp    = GetXP(toolName);

            if (xp < XPRequired(level, tier))
            {
                return("Tool is not ready to be upgraded.");
            }
            Inventory cost   = Utils.RunMethod <Inventory>(StringM.UpperAt(toolName) + "Upgrade", this, level, tier);
            string    result = null;

            foreach (StackedItems si in cost.inv)
            {
                int i = -1;
                if ((i = player.inventory.FindIndex(si.item)) < 0)
                {
                    result += si.ToString() + Environment.NewLine;
                }
                else if (player.inventory.GetCount(i) < si.count)
                {
                    result += $"{si.count - player.inventory.GetCount(i)} {si.item.name}" + Environment.NewLine;
                }
                else
                {
                    player.inventory.Remove(i, si.count);
                }
            }
            if (result != null)
            {
                return("Missing Materials:" + Environment.NewLine + result);
            }
            else
            {
                result = ToolName(toolName, tier, level);
                AddXP(toolName, -XPRequired(level, tier));
                if (level >= 10)
                {
                    SetLevel(toolName, 0);
                    AddTier(toolName, 1);
                    tier++; level = 0;
                }
                else
                {
                    AddLevel(toolName, 1); level++;
                }
                player.SaveFileMongo();
                return($"Upgraded {result} to {ToolName(toolName, tier, level)}");
            }
            throw NeitsilliaError.ReplyError("Feature unavailable");
        }
示例#5
0
        public async Task MoveToArea(IUser user, [Remainder] string name)
        {
            if (await IsGMLevel(4))
            {
                Player player = Player.Load(user.Id);
                Area   area   = Area.LoadFromName(StringM.UpperAt(name));
                player.EndEncounter();
                await player.SetArea(area);

                player.SaveFileMongo();
                EmbedBuilder areaInfo = player.UserEmbedColor(player.Area.AreaInfo(player.AreaInfo.floor));
                await player.NewUI(await Context.Channel.SendMessageAsync("You've entered " + player.Area.name, embed: areaInfo.Build())
                                   , MsgType.Main);
            }
        }
示例#6
0
        public async Task Enter([Remainder] string name)
        {
            if (name != null)
            {
                string areaName = StringM.UpperAt(name);
                Player player   = Context.Player;
                await Enter(player, areaName, Context.Channel);

                await DUtils.DeleteContextMessageAsync(Context);
            }
            else
            {
                await DUtils.Replydb(Context, "To travel, one must have a destination. `~Enter 'Area'` or use the `~tp` interface.");
            }
        }
示例#7
0
 public async Task Grant_Perk(IUser user, [Remainder] string name)
 {
     if (await IsGMLevel(3))
     {
         string perkName = StringM.UpperAt(name);
         Player p        = Player.Load(user.Id, Player.IgnoreException.All);
         int    i        = p.HasPerk(perkName);
         if (i == -1)
         {
             p.perks.Add(PerkLoad.Load(perkName));
             p.SaveFileMongo();
             await DUtils.DeleteContextMessageAsync(Context);
         }
         else
         {
             await DUtils.Replydb(Context, $"{p.name} already has the perk {perkName}", lifetime : 0.5);
         }
     }
 }
示例#8
0
 public async Task Grant_Ability_XP(IUser user, string argName, long xp = 100)
 {
     if (await IsGMLevel(3))
     {
         string abName = StringM.UpperAt(argName);
         Player p      = Player.Load(user.Id, Player.IgnoreException.All);
         if (p.HasAbility(abName, out int i))
         {
             p.abilities[i].GainXP(xp, 1);
             p.SaveFileMongo();
             await DUtils.DeleteContextMessageAsync(Context);
             await ReplyAsync(embed : p.abilities[i].InfoPage(p.UserEmbedColor(), true).Build());
         }
         else
         {
             await DUtils.Replydb(Context, $"{p.name} already does not know {argName}", lifetime : 0.5);
         }
     }
 }
示例#9
0
 public async Task Grant_Ability(IUser user, string argName)
 {
     if (await IsGMLevel(3))
     {
         string  abName = StringM.UpperAt(argName);
         Ability a      = Ability.Load(abName);
         Player  p      = Player.Load(user.Id, Player.IgnoreException.All);
         if (!p.HasAbility(a.name, out _))
         {
             p.abilities.Add(a);
             p.SaveFileMongo();
             await ReplyAsync($"{p.name} learned {a.name}");
         }
         else
         {
             await ReplyAsync($"{p.name} already knows {a.name}");
         }
     }
 }
示例#10
0
        public async Task Grant_Schem(IUser user, [Remainder] string name)
        {
            if (await IsGMLevel(3))
            {
                string schemName = StringM.UpperAt(name);
                Item   item      = Item.LoadItem(schemName);
                if (item.type != Item.IType.notfound)
                {
                    if (item.schematic.exists)
                    {
                        Player player = Player.Load(user.Id, Player.IgnoreException.All);
                        if (player.schematics == null)
                        {
                            player.schematics = new List <Schematic>();
                        }
                        if (player.schematics.FindIndex(Schematic.FindWithName(item.schematic.name)) == -1)
                        {
                            player.schematics.Add(item.schematic);
                            player.SaveFileMongo();
                            IUserMessage reply = await ReplyAsync(user.Mention + " received a " + schemName + " schematic");

                            player.ui = new UI(reply, new List <string> {
                                EUI.xp, EUI.inv, EUI.stats, EUI.schem
                            });
                            player.SaveFileMongo();
                            await DUtils.DeleteContextMessageAsync(Context);
                        }
                        else
                        {
                            await DUtils.Replydb(Context, "Player already has this schematic");
                        }
                    }
                    else
                    {
                        await DUtils.Replydb(Context, "Item does not have a schematic");
                    }
                }
                else
                {
                    await DUtils.Replydb(Context, "Item not found");
                }
            }
        }
示例#11
0
        public async Task Roll([Remainder] string message)
        {
            EmbedBuilder em = new EmbedBuilder
            {
                Title = Context.User.Username + "'s Roll"
            };
            string abilityName = StringM.UpperAt(message);
            Player player      = Player.Load(Context.User.Id, Player.IgnoreException.All);

            if (player.HasAbility(abilityName, out int index))
            {
                em = AbilityRoll(index, player, player.UserEmbedColor(em));
            }
            else
            {
                em = DiceRolls(message, em);
            }
            await DUtils.Replydb(Context, embed : em.Build());
        }
        public async Task New_Bounty(string areaName, string creatureName = null, int floor = 0, int level = 1, string grantDrop = null)
        {
            if (IsGMLevel(4).Result)
            {
                areaName = StringM.UpperAt(areaName);
                //areaName = Area.AreaDataExist(areaName);
                if (areaName != null)
                {
                    Area area = Area.LoadFromName(areaName);
                    floor = Verify.MinMax(floor, area.floors);
                    //
                    NPC mob = null;
                    if (creatureName != null)
                    {
                        mob = NPC.GenerateNPC(Verify.Min(level, 0),
                                              StringM.UpperAt(creatureName));
                    }
                    if (mob == null)
                    {
                        mob = area.GetAMob(Program.rng, floor);
                    }
                    //
                    if (grantDrop != null)
                    {
                        Item grant = Item.LoadItem(grantDrop);
                        if (grant != null)
                        {
                            mob.AddItemToInv(grant, 1, true);
                        }
                    }

                    //
                    PopulationHandler.Add(area, mob);

                    await DUtils.DeleteContextMessageAsync(Context);
                }
                else
                {
                    await DUtils.Replydb(Context, "Area not found.");
                }
            }
        }
示例#13
0
 /*[Command("New Campaign")]
  * [Alias("ncampg")]//*/
 public async Task New_Campaign([Remainder] string arg)
 {
     if (IsGMLevel(0).Result)
     {
         GM gm = GetGM(Context.User.Id);
         if (gm.campaignPath != null && File.Exists(gm.campaignPath))
         {
             await ReplyAsync("You are already hosting a campaign");
         }
         else
         {
             string   name     = StringM.UpperAt(arg);
             Campaign campaign = Campaign.Load(name);
             if (campaign == null && IsGMLevel(3).Result)
             {
             }
             else if (campaign != null)
             {
             }
         }
     }
 }
示例#14
0
        public async Task AbilityLevel(int level, [Remainder] string arg)
        {
            Ability ability = Ability.Load(StringM.UpperAt(arg), level);

            await ReplyAsync(embed : ability.InfoPage(new EmbedBuilder(), true).Build());
        }