public ChatHandler(DesyncContext context, Character npc, DialogTree pool, PaletteType palette = PaletteType.Glass) { Context = context; Npc = npc; Tree = pool; Palette = GraphicsService.GetPalette(palette); }
public ShopHandler(DesyncContext context, Market market, PaletteType palette) { Context = context; Market = market; Vendor = market.GetActive(); Palette = GraphicsService.GetPalette(palette); }
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()); }
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); }
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()); }
private bool CheckOwner(ulong userId, DesyncContext ctx) => DevOverride?CheckDev(userId) : ctx.Server.OwnerId == userId;