コード例 #1
0
ファイル: ChatHandler.cs プロジェクト: AbnerSquared/Orikivo
 public ChatHandler(DesyncContext context, Character npc, DialogTree pool, PaletteType palette = PaletteType.Glass)
 {
     Context = context;
     Npc     = npc;
     Tree    = pool;
     Palette = GraphicsService.GetPalette(palette);
 }
コード例 #2
0
 public ShopHandler(DesyncContext context, Market market, PaletteType palette)
 {
     Context = context;
     Market  = market;
     Vendor  = market.GetActive();
     Palette = GraphicsService.GetPalette(palette);
 }
コード例 #3
0
        public override async Task <PreconditionResult> CheckPermissionsAsync(ICommandContext context, CommandInfo command, IServiceProvider provider)
        {
            DesyncContext Context = context as DesyncContext;

            Context.Server ??= Context.Container.GetOrAddGuild(Context.Guild);

            return(PreconditionResult.FromSuccess());
        }
コード例 #4
0
        private bool CheckInherit(ulong userId, DesyncContext ctx)
        {
            if (DevOverride)
            {
                return(CheckDev(userId));
            }

            if (ctx.Server.Config.TrustedRoleId.HasValue)
            {
                return(ctx.Guild.Users.Any(x =>
                                           x.Id == userId && x.Roles.Any(y => y.Id == ctx.Server.Config.TrustedRoleId.Value)));
            }

            return(ctx.Server.OwnerId == userId);
        }
コード例 #5
0
        public override async Task <PreconditionResult> CheckPermissionsAsync(ICommandContext context, CommandInfo command, IServiceProvider provider)
        {
            DesyncContext Context = context as DesyncContext;

            if (Context.Account == null)
            {
                if (_autoBuild)
                {
                    Context.Container.GetOrAddUser(Context.User);
                    return(PreconditionResult.FromSuccess());
                }

                return(PreconditionResult.FromError("This command cannot be executed without a user account."));
            }

            return(PreconditionResult.FromSuccess());
        }
コード例 #6
0
 private bool CheckOwner(ulong userId, DesyncContext ctx)
 => DevOverride?CheckDev(userId) : ctx.Server.OwnerId == userId;