void OnChat(ref HookContext ctx, ref TDSMHookArgs.PlayerChat args) { if (args.Message.Length > 0 && args.Message.Substring(0, 1).Equals("/")) { ProgramLog.Log(ctx.Player.name + " sent command: " + args.Message); ctx.SetResult(HookResult.IGNORE); CommandParser.ParsePlayerCommand(ctx.Player, args.Message); } }
private void Command(ref HookContext ctx, ref TDSMHookArgs.ServerCommand args) { if (args.Prefix == "!") return; //Perhaps here we can use the player's PluginData, and simply store a string for the console if (ctx.Sender is Player) { if (CommandDictionary.ContainsKey(ctx.Player.name)) CommandDictionary[ctx.Player.name] = "/" + args.Prefix + " " + args.ArgumentString; else CommandDictionary.Add(ctx.Player.name, "/" + args.Prefix + " " + args.ArgumentString); } else if (ctx.Sender is ConsoleSender) { if (CommandDictionary.ContainsKey("CONSOLE")) CommandDictionary["CONSOLE"] = args.Prefix + " " + args.ArgumentString; else CommandDictionary.Add("CONSOLE", args.Prefix + " " + args.ArgumentString); } }
void OnPlayerDataReceived(ref HookContext ctx, ref TDSMHookArgs.PlayerDataReceived args) { // //If the player is not authenticated, then ensure they are reset // if (!AllowSSCGuestInfo && !ctx.Player.IsAuthenticated) // { // // } if (Config.WhitelistEnabled) { var name = WhiteListCommand.Prefix_WhitelistName + args.Name; var ip = WhiteListCommand.Prefix_WhitelistIp + ctx.Client.RemoteIPAddress(); if (!Whitelist.Contains(name) && !Whitelist.Contains(ip)) { ctx.SetKick(args.Name + ", You are not whitelisted"); } } }
void OnPlayerAuthenticated(ref HookContext ctx, ref TDSMHookArgs.PlayerAuthenticationChanged args) { if (ctx.Client.State >= 4 && CharacterManager.Mode == CharacterMode.AUTH) { #if ENTITY_FRAMEWORK_7 using (var dbCtx = new TContext()) #elif DAPPER using (var dbCtx = DatabaseFactory.CreateConnection()) #endif { using (var txn = dbCtx.BeginTransaction()) { CharacterManager.LoadForAuthenticated(dbCtx, txn, ctx.Player, !Config.SSC_AllowGuestInfo); txn.Commit(); } } if (Config.SSC_AllowGuestInfo) { ctx.Player.SetSSCReadyForSave(true); //Since we aren't issuing out data, and accepting it, we can save it. } } }
void OnPlayerAuthenticated(ref HookContext ctx, ref TDSMHookArgs.PlayerAuthenticationChanged args) { if (ctx.Client.State >= 4 && CharacterManager.Mode == CharacterMode.AUTH) { using (var dbCtx = new TContext()) { CharacterManager.LoadForAuthenticated(dbCtx, ctx.Player, !AllowSSCGuestInfo); } if (AllowSSCGuestInfo) { ctx.Player.SetSSCReadyForSave(true); //Since we aren't issuing out data, and accepting it, we can save it. } } }