/// <summary> /// When the server is ran, Data needs to be set /// </summary> /// <param name="NewWorld"></param> /// <param name="PlayerCap"></param> /// <param name="myWhiteList"></param> /// <param name="myBanList"></param> /// <param name="myOpList"></param> public static void InitializeData(World NewWorld, int PlayerCap, string myWhiteList, string myBanList, string myOpList) { UsingLoginSystem = false; World = NewWorld; WhiteList = new DataRegister(myWhiteList); WhiteList.Load(); BanList = new DataRegister(myBanList); BanList.Load(); OpList = new DataRegister(myOpList); OpList.Load(); RejectedItems = new List <String>(); string[] rejItem = Program.properties.RejectedItems.Split(','); for (int i = 0; i < rejItem.Length; i++) { if (rejItem[i].Trim().Length > 0) { RejectedItems.Add(rejItem[i].Trim()); } } AllowExplosions = Program.properties.AllowExplosions; AllowTDCMRPG = Program.properties.AllowTDCMRPG; }
protected override void registe() { LayoutRegister.registeAllLayout(); GameSceneRegister.registerAllGameScene(); DataRegister.registeAllData(); CharacterRegister.registeAllCharacter(); }
public AddRegisterContentDialog(Entity entity, DataRegister register) { this.InitializeComponent(); this.entity = entity; this.register = register; CreateFields(register); }
public void CheckMoveNumberToDRegister(byte number, DataRegister register) { // 0111ddd0bbbbbbbb // MOVEQ #0,D0 byte hi = 0x70; byte lo = number; hi |= (byte)((byte)register << 1); byte[] data = new byte[] { hi, lo }; MegadriveState state = new MegadriveState(new Data(data), 0x00000000, 0x00000000, 0x000000, 0x3FFFFF, 0x0FF0000, 0xFFFFFF); state.WriteAReg(0x5, 0xFF0000); for (int i = 0; i < 16; i++) { state.WriteByte((uint)(0xFF0000 + i), (byte)(0x00 + i)); } state.FetchOpCode(); var opcode = new MOVEQ(state); Assert.That(opcode.Assembly, Is.EqualTo($"MOVEQ #{number},{register}")); Assert.That(opcode.Size, Is.EqualTo(Size.Long)); Assert.That(state.ReadDReg((byte)register), Is.EqualTo(number)); }
private void UserControl_DataContextChanged(FrameworkElement sender, DataContextChangedEventArgs args) { if (DataContext != null) { register = (DataContext as DataRegister); Fields = register.Fields; } }
public override void registe() { LayoutRegister layoutRegister = new LayoutRegister(); layoutRegister.registeAllLayout(); GameSceneRegister sceneRegister = new GameSceneRegister(); sceneRegister.registerAllGameScene(); DataRegister dataRegister = new DataRegister(); dataRegister.registeAllData(); }
/// <summary> /// Initializes a new instance of the <see cref="MOVEQ"/> class. /// </summary> /// <param name="state">machine state</param> public MOVEQ(MegadriveState state) : base("0111ddd0bbbbbbbb", state) { this.immediate = this.GetImmediate(); this.register = this.GetDn(); this.state.WriteDReg((byte)this.register, this.immediate); this.state.Condition_N = this.IsNegative(this.immediate); this.state.Condition_Z = this.IsZero(this.immediate); this.state.Condition_V = false; this.state.Condition_C = false; }
public Server(World World, int PlayerCap, String myWhiteList, String myBanList, String myOpList) { Main.maxNetplayers = PlayerCap; world = World; world.Server = this; pluginManager = new PluginManager(Statics.PluginPath, this); WhiteList = new DataRegister(myWhiteList); WhiteList.Load(); BanList = new DataRegister(myBanList); BanList.Load(); OpList = new DataRegister(myOpList); OpList.Load(); }
private async void ContentDialog_PrimaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args) { List <string> values = ConvertToStrings(); if (RefIntegrity && values != null) { DataRegister register = new DataRegister(values, entity.Attributes); // If we are adding the register if (this.register == null) { if (!entity.Registers.Any(x => x.Key == register.Key)) { entity.AddRegister(register); } else { Warning.Margin = new Thickness(20, 10, 10, 0); Warning.Text = "Error: This entity already contains a register with the key " + register.Key.value.ToString(); args.Cancel = true; } } // If we are Editing an existent Register else { if (this.register.Key == register.Key) { this.register.Fields = register.Fields; } else { if (entity.Registers.All(x => x.Key != register.Key)) { this.register.Fields = register.Fields; this.register.Key = register.Key; } else { Warning.Margin = new Thickness(20, 10, 10, 0); Warning.Text = "Error: This entity already contains a register with the key " + register.Key.value.ToString(); args.Cancel = true; } } } } else { args.Cancel = true; } }
public ViewModelRegister() { ObjDataRegister = new DataRegister(); ObjLabelPasswordBox = new LabelPasswordBox { StrLabelPasswordBox = "Password*" }; ObjSourceImageRegister = new SourceImageRegister(); ObjSourceImageRegister = new SourceImageRegister { SourceImageFirstName = ObjSourceImageRegister.ImagePerson, SourceImageLastName = ObjSourceImageRegister.ImagePerson, SourceImageEmail = ObjSourceImageRegister.ImageEmail, SourceImagePassword = ObjSourceImageRegister.ImagePassword }; }
private async void EditRegisterButtonClick(object sender, RoutedEventArgs e) { DataRegister register = RegistersList.SelectedItem as DataRegister; if (EntitiesList.SelectedItem != null) { Entity entity = EntitiesList.SelectedItem as Entity; AddRegisterContentDialog dialog = new AddRegisterContentDialog(EntitiesList.SelectedItem as Entity, register); var result = await dialog.ShowAsync(); if (result == ContentDialogResult.Primary) { App.SerializeProject(); UpdateRegistersData(); } } }
private static void CustomDataAccessLayerInitialize() { var configuration = Container.Resolve <IWebConfiguration>(); List <string> connectionStringNames = configuration.GetConnectionStringNames().ToList(); ConnectionRegister.Register(connectionStringNames, SqlDbmsType.SqlServer); OrmRegister.Register(connectionStringNames, OrmType.Dapper, SqlDbmsType.SqlServer); DbRegister.Register(connectionStringNames, SqlDbmsType.SqlServer); Container.Register <IDataProvider, DataProvider>(ObjectLifeSpans.Singleton); DataRegister.Initialize(); //EntityMap.Initialize(); Container.Register <IUserService <IdentityUser>, UserService <IdentityUser> >(); Container.Register <IRoleService, RoleService>(); Container.Register <IUserClaimsService, UserClaimsService>(); Container.Register <IUserLoginsService, UserLoginsService>(); Container.Register <IUserRolesService, UserRolesService>(); Container.Register <IUserStore <IdentityUser>, UserStore <IdentityUser> >(); }
public static void Init() { Terraria.Netplay.Clients = new ServerSlot[256]; tdsm.api.Callbacks.NetplayCallback.CheckSectionMethod = CheckSection; for (int i = 0; i < 256; i++) { var slot = new ServerSlot() { whoAmI = i }; slot.Reset(); Terraria.Netplay.Clients[i] = slot; } Ops = new DataRegister(System.IO.Path.Combine(Globals.DataPath, "ops.txt")); Bans = new DataRegister(System.IO.Path.Combine(Globals.DataPath, "bans.txt")); Whitelist = new DataRegister(System.IO.Path.Combine(Globals.DataPath, "whitelist.txt")); ItemRejections = new DataRegister(System.IO.Path.Combine(Globals.DataPath, "itemrejection.txt")); IsInitialised = true; }
async void DeleteRegisterButtonClick(object sender, RoutedEventArgs e) { DataRegister register = (DataRegister)RegistersList.SelectedItem; if (EntitiesList.SelectedItem != null) { Entity entity = EntitiesList.SelectedItem as Entity; ContentDialog cd = new ContentDialog(); cd.CloseButtonText = "No"; cd.PrimaryButtonText = "Yes"; cd.Title = "Delete Register"; cd.Content = "Are you sure?"; var result = await cd.ShowAsync(); if (result == ContentDialogResult.Primary) { entity.RemoveRegister(register); UpdateRegistersData(); App.SerializeProject(); } } }
public Server(World World, int PlayerCap, String myWhiteList, String myBanList, String myOpList) { Main.maxNetplayers = PlayerCap; world = World; world.Server = this; pluginManager = new PluginManager(Statics.PluginPath, this); WhiteList = new DataRegister(myWhiteList); WhiteList.Load(); BanList = new DataRegister(myBanList); BanList.Load(); OpList = new DataRegister(myOpList); OpList.Load(); RejectedItems = new List<String>(); String[] rejItem = Program.properties.RejectedItems.Split(','); for (int i = 0; i < rejItem.Length; i++) { if (rejItem[i].Trim().Length > 0) { RejectedItems.Add(rejItem[i].Trim()); } } }
protected override void Initialized(object state) { ProgramLog.Log("TDSM Rebind core build {0}", this.Version); //Register hook sources PluginManager.RegisterHookSource(typeof(TDSMHookPoints)); PluginManager.RegisterHookSource(typeof(Events.HookPoints)); CommandDictionary = new Dictionary<string, string>(); Ops = new PairFileRegister(System.IO.Path.Combine(Globals.DataPath, "ops.txt")); Whitelist = new DataRegister(System.IO.Path.Combine(Globals.DataPath, "whitelist.txt"), false); string configFile; if (!String.IsNullOrEmpty(configFile = Terraria.Initializers.LaunchInitializer.TryParameter("-config"))) Config.LoadFromFile(configFile); Config.LoadFromArguments(); if (!String.IsNullOrEmpty(Config.DatabaseProvider)) { OTA.Data.DatabaseFactory.Initialise(Config.DatabaseProvider, Config.DatabaseConnectionString); Storage.IsAvailable = true; OTA.Permissions.Permissions.SetHandler(new OTAPIPermissions()); Dapper.SqlMapper.AddTypeMap(typeof(PasswordFormat), System.Data.DbType.Int32); Dapper.SqlMapper.AddTypeMap(typeof(Byte), System.Data.DbType.Byte); //Test if we have a connection try { using (var ctx = DatabaseFactory.CreateConnection()) { using (var txn = ctx.BeginTransaction()) { try { var count = ctx.ExecuteScalar<long>($"select 1;", transaction: txn); //#if DEBUG // ProgramLog.Debug.EnableConsoleOutput = true; //#endif if (count != 1) ProgramLog.Debug.Log("Failed to get a valid number from the database."); else ProgramLog.Debug.Log("Database connected."); } finally { txn.Commit(); } } } } catch (Exception ex) { ProgramLog.Error.Log(ex, "Failed to connect to the database."); } } ProgramLog.LogRotation = Config.LogRotation; Hook(OTA.Commands.Events.CommandEvents.Listening, OnListeningForCommands); AddComponents<Entry>(); if (!RunComponent(ComponentEvent.Initialise)) { this.Disable(); ProgramLog.Log("TDSM Rebind core disabled as components are not running."); return; } ProgramLog.Log("TDSM Rebind core enabled"); }
private void CreateFields(DataRegister r) { for (int i = 0; i < this.entity.Attributes.Count; i++) { TextBox tb = new TextBox(); CheckBox cb = new CheckBox(); switch (entity.Attributes[i].DataType) { case DataTypes.Boolean: cb.Name = entity.Attributes[i].Name; cb.DataContext = entity.Attributes[i]; if (r != null) { cb.IsChecked = Boolean.Parse(r.Fields[i].value.ToString()); } Container.Children.Add(cb); break; case DataTypes.Character: tb.Name = entity.Attributes[i].Name; tb.DataContext = entity.Attributes[i]; tb.PlaceholderText = entity.Attributes[i].Name; tb.Margin = new Thickness(20, 0, 0, 0); tb.MaxLength = 1; if (r != null) { tb.Text = r.Fields[i].value.ToString(); } if (entity.Attributes[i].KeyType == KeyTypes.Foreign) { tb.LostFocus += ValidateReferentialIntegrity; } Container.Children.Add(tb); break; case DataTypes.Float: tb = new TextBox(); tb.Name = entity.Attributes[i].Name; tb.DataContext = entity.Attributes[i]; tb.PlaceholderText = entity.Attributes[i].Name; tb.Margin = new Thickness(20, 0, 0, 0); if (r != null) { tb.Text = r.Fields[i].value.ToString(); } if (entity.Attributes[i].KeyType == KeyTypes.Foreign) { tb.LostFocus += ValidateReferentialIntegrity; } Container.Children.Add(tb); break; case DataTypes.Integer: tb = new TextBox(); tb.Name = entity.Attributes[i].Name; tb.DataContext = entity.Attributes[i]; tb.PlaceholderText = entity.Attributes[i].Name; tb.Margin = new Thickness(20, 0, 0, 0); tb.Width = 120; tb.MaxLength = 8; tb.TextChanging += NumbersOnly; if (r != null) { tb.Text = r.Fields[i].value.ToString(); } if (entity.Attributes[i].KeyType == KeyTypes.Foreign) { tb.LostFocus += ValidateReferentialIntegrity; } Container.Children.Add(tb); break; case DataTypes.Long: tb = new TextBox(); tb.Name = entity.Attributes[i].Name; tb.DataContext = entity.Attributes[i]; tb.PlaceholderText = entity.Attributes[i].Name; tb.Margin = new Thickness(20, 0, 0, 0); tb.TextChanging += NumbersOnly; if (r != null) { tb.Text = r.Fields[i].value.ToString(); } if (entity.Attributes[i].KeyType == KeyTypes.Foreign) { tb.LostFocus += ValidateReferentialIntegrity; } Container.Children.Add(tb); break; case DataTypes.String: tb = new TextBox(); tb.Name = entity.Attributes[i].Name; tb.DataContext = entity.Attributes[i]; tb.PlaceholderText = entity.Attributes[i].Name; tb.Margin = new Thickness(20, 0, 0, 0); tb.Width = 120; tb.MaxLength = 120; tb.TextChanging += OnlyText; if (r != null) { tb.Text = r.Fields[i].value.ToString(); } if (entity.Attributes[i].KeyType == KeyTypes.Foreign) { tb.LostFocus += ValidateReferentialIntegrity; } Container.Children.Add(tb); break; } } }
public BusinessRegister() { dataRegister = new DataRegister(); }
/// <summary> /// Initializes a new instance of the <see cref="ADD"/> class. /// </summary> /// <param name="state">machine state.</param> public ADD(MegadriveState state) : base("1101dddDssmmmxxx", state) { this.EffectiveAddress = this.FetchEffectiveAddress(); this.register = this.GetDn(); this.direction = this.GetDirection(); uint result; switch (this.direction) { // <ea> + Dn -> Dn case MoveDirection.RegisterToMemory: { var val = this.ReadValueForEffectiveAddress(); var dn = this.state.ReadDReg((byte)this.register); result = val + dn; switch (this.Size) { case Size.Word: this.state.WriteDReg((byte)this.register, (ushort)result); break; case Size.Byte: this.state.WriteDReg((byte)this.register, (byte)result); break; default: throw new InvalidStateException(); } } break; // Dn + <ea> -> <ea> case MoveDirection.MemoryToRegister: { // decerements here for -(An) !!! var val = this.ReadValueForEffectiveAddress(); var dn = this.state.ReadDReg((byte)this.register); result = val + dn; switch (this.Size) { case Size.Word: this.WriteValueToEffectiveAddress(this.DecodeEffectiveAddressMode(), this.EffectiveAddress, this.GetXn(), (ushort)result, true); break; case Size.Byte: // decerements here for -(An) !!! this.WriteValueToEffectiveAddress(this.DecodeEffectiveAddressMode(), this.EffectiveAddress, this.GetXn(), (byte)result, true); break; default: throw new InvalidStateException(); } } break; default: throw new InvalidStateException(); } this.state.Condition_X = this.IsCarry(result); this.state.Condition_N = this.IsNegative(result); this.state.Condition_Z = this.IsZero(result); this.state.Condition_V = this.IsOverflow(result); this.state.Condition_C = this.IsCarry(result); }
private bool EvalCondition(DataRegister register, int pivotIndex, string compareTo, string comparer) { switch (register.Fields[pivotIndex].dataType) { case DataTypes.Integer: switch (comparer) { case "=": return((int)(register.Fields[pivotIndex].value) == int.Parse(compareTo)); case ">": return((int)(register.Fields[pivotIndex].value) > int.Parse(compareTo)); break; case "<": return((int)(register.Fields[pivotIndex].value) < int.Parse(compareTo)); break; case ">=": return((int)(register.Fields[pivotIndex].value) >= int.Parse(compareTo)); break; case "<=": return((int)(register.Fields[pivotIndex].value) <= int.Parse(compareTo)); break; case "<>": return((int)(register.Fields[pivotIndex].value) != int.Parse(compareTo)); break; } break; case DataTypes.Float: switch (comparer) { case "=": return((float)(register.Fields[pivotIndex].value) == float.Parse(compareTo)); case ">": return((float)(register.Fields[pivotIndex].value) > float.Parse(compareTo)); case "<": return((float)(register.Fields[pivotIndex].value) < float.Parse(compareTo)); case ">=": return((float)(register.Fields[pivotIndex].value) >= float.Parse(compareTo)); case "<=": return((float)(register.Fields[pivotIndex].value) <= float.Parse(compareTo)); break; case "<>": return((float)(register.Fields[pivotIndex].value) != float.Parse(compareTo)); break; } break; case DataTypes.String: switch (comparer) { case "=": return(register.Fields[pivotIndex].value.ToString() == compareTo); //case ">": // return register.Fields[pivotIndex].value.ToString() > compareTo; //case "<": // return register.Fields[pivotIndex].value < compareTo; //case ">=": // return register.Fields[pivotIndex].value >= compareTo; //case "<=": // return register.Fields[pivotIndex].value <= compareTo; case "<>": return(register.Fields[pivotIndex].value.ToString() != compareTo); } break; } return(false); }
public void Move(DataRegister dSrc, DataRegister dDst) { int opcode = 0x2000 | dSrc.Number | (dSrc.Number << 9); emitter.EmitBeUInt16(opcode); }
protected override void Initialized(object state) { ProgramLog.Log("TDSM Rebind core build {0}", this.Version); //Register hook sources PluginManager.RegisterHookSource(typeof(TDSMHookPoints)); PluginManager.RegisterHookSource(typeof(Events.HookPoints)); CommandDictionary = new Dictionary <string, string>(); Ops = new PairFileRegister(System.IO.Path.Combine(Globals.DataPath, "ops.txt")); Whitelist = new DataRegister(System.IO.Path.Combine(Globals.DataPath, "whitelist.txt"), false); string configFile; if (!String.IsNullOrEmpty(configFile = Terraria.Initializers.LaunchInitializer.TryParameter("-config"))) { Config.LoadFromFile(configFile); } Config.LoadFromArguments(); if (!String.IsNullOrEmpty(Config.DatabaseProvider)) { OTA.Data.DatabaseFactory.Initialise(Config.DatabaseProvider, Config.DatabaseConnectionString); Storage.IsAvailable = true; OTA.Permissions.Permissions.SetHandler(new OTAPIPermissions()); Dapper.SqlMapper.AddTypeMap(typeof(PasswordFormat), System.Data.DbType.Int32); Dapper.SqlMapper.AddTypeMap(typeof(Byte), System.Data.DbType.Byte); //Test if we have a connection try { using (var ctx = DatabaseFactory.CreateConnection()) { using (var txn = ctx.BeginTransaction()) { try { var count = ctx.ExecuteScalar <long>($"select 1;", transaction: txn); //#if DEBUG // ProgramLog.Debug.EnableConsoleOutput = true; //#endif if (count != 1) { ProgramLog.Debug.Log("Failed to get a valid number from the database."); } else { ProgramLog.Debug.Log("Database connected."); } } finally { txn.Commit(); } } } } catch (Exception ex) { ProgramLog.Error.Log(ex, "Failed to connect to the database."); } } ProgramLog.LogRotation = Config.LogRotation; Hook(OTA.Commands.Events.CommandEvents.Listening, OnListeningForCommands); AddComponents <Entry>(); if (!RunComponent(ComponentEvent.Initialise)) { this.Disable(); ProgramLog.Log("TDSM Rebind core disabled as components are not running."); return; } ProgramLog.Log("TDSM Rebind core enabled"); }
protected override void Initialized(object state) { if (/*!Globals.IsPatching &&*/ !ProgramLog.IsOpen) { var logFile = Globals.DataPath + System.IO.Path.DirectorySeparatorChar + "server.log"; ProgramLog.OpenLogFile(logFile); ProgramLog.Log("TDSM Rebind core build {0}", this.Version); Tools.SetWriteLineMethod(ProgramLog.Log, OnLogFinished); ConsoleSender.DefaultColour = ConsoleColor.Gray; //ConsoleSender.SetMethod((msg, r, g, b) => //{ // Console.ForegroundColor = FromColor((byte)r, (byte)g, (byte)b); // Console.WriteLine(msg); //}); } Ops = new DataRegister(System.IO.Path.Combine(Globals.DataPath, "ops.txt")); #if WebInterface WebInterface.WebPermissions.Load(); #endif AddCommand("platform") .WithAccessLevel(AccessLevel.PLAYER) .WithDescription("Show what type of server is running TDSM") .SetDefaultUsage() .WithPermissionNode("tdsm.platform") .Calls(this.OperatingSystem); AddCommand("exit") .WithDescription("Stops the server") .WithAccessLevel(AccessLevel.CONSOLE) .SetDefaultUsage() .WithPermissionNode("tdsm.admin") .Calls(this.Exit); AddCommand("stop") .WithDescription("Stops the server") .WithAccessLevel(AccessLevel.CONSOLE) .SetDefaultUsage() .WithPermissionNode("tdsm.admin") .Calls(this.Exit); AddCommand("time") .WithDescription("Change the time of day") .WithAccessLevel(AccessLevel.OP) .WithHelpText("set <numeric time>") .WithHelpText("set 5:10am") .WithHelpText("now|?") .WithHelpText("day|dawn|dusk|noon|night") .WithPermissionNode("tdsm.time") .Calls(this.Time); AddCommand("give") .WithAccessLevel(AccessLevel.OP) .WithDescription("Give a player items") .WithHelpText("<player> <amount> <itemname:itemid> [-prefix]") .WithPermissionNode("tdsm.give") .Calls(this.Give); AddCommand("spawnnpc") .WithAccessLevel(AccessLevel.OP) .WithDescription("Spawns NPCs") .WithHelpText("<amount> \"<name:id>\" \"<player>\"") .WithPermissionNode("tdsm.spawnnpc") .Calls(this.SpawnNPC); AddCommand("tp") .WithAccessLevel(AccessLevel.OP) .WithDescription("Teleport a player to another player") .WithHelpText("<player> <toplayer> - another player") .WithHelpText("<player> <x> <y>") .WithHelpText("<toplayer> - yourself") .WithHelpText("<x> <y>") .WithHelpText(" - yourself to spawn") .WithPermissionNode("tdsm.tp") .Calls(this.Teleport); AddCommand("tphere") .WithAccessLevel(AccessLevel.OP) .WithDescription("Teleport a player to yourself") .WithHelpText("<player>") .WithPermissionNode("tdsm.tphere") .Calls(this.TeleportHere); AddCommand("save") .WithDescription("Save world and configuration data") .WithAccessLevel(AccessLevel.OP) .SetDefaultUsage() .WithPermissionNode("tdsm.admin") .Calls(this.SaveAll); AddCommand("save-all") .WithDescription("Save world and configuration data") .WithAccessLevel(AccessLevel.OP) .SetDefaultUsage() .WithPermissionNode("tdsm.admin") .Calls(this.SaveAll); //AddCommand("reload") // .WithDescription(Languages.CommandDescription_ReloadConfig) // .WithAccessLevel(AccessLevel.REMOTE_CONSOLE) // .WithPermissionNode("tdsm.admin") // .Calls(this.Reload); AddCommand("itemrej") .WithAccessLevel(AccessLevel.OP) .WithDescription("Manage item rejections") .WithHelpText("-add|-remove <id:name>") .WithHelpText("-clear") .WithPermissionNode("tdsm.itemrej") .Calls(this.ItemRejection); AddCommand("refresh") .WithAccessLevel(AccessLevel.PLAYER) .WithDescription("Redownload the area around you from the server") .WithHelpText("Usage: refresh") .WithPermissionNode("tdsm.refresh") .Calls(this.Refresh); AddCommand("list") .WithAccessLevel(AccessLevel.PLAYER) .WithDescription("Lists online players") .SetDefaultUsage() .WithPermissionNode("tdsm.who") .Calls(this.List); AddCommand("who") .WithAccessLevel(AccessLevel.PLAYER) .WithDescription("Lists online players") .SetDefaultUsage() .WithPermissionNode("tdsm.who") .Calls(this.List); AddCommand("players") .WithAccessLevel(AccessLevel.PLAYER) .WithDescription("Lists online players") .SetDefaultUsage() .WithPermissionNode("tdsm.who") .Calls(this.OldList); // this is what the server crawler expects AddCommand("playing") .WithAccessLevel(AccessLevel.PLAYER) .WithDescription("Lists online players") .SetDefaultUsage() .WithPermissionNode("tdsm.who") .Calls(this.OldList); AddCommand("online") .WithAccessLevel(AccessLevel.PLAYER) .WithDescription("Lists online players") .SetDefaultUsage() .WithPermissionNode("tdsm.who") .Calls(this.List); AddCommand("me") .WithAccessLevel(AccessLevel.PLAYER) .WithDescription("3rd person talk") .WithHelpText("<message> - Message to display in third person.") //.SetDefaultUsage() //This was causing an additional "me" to be displayed in the help commmand syntax. .WithPermissionNode("tdsm.me") .Calls(this.Action); AddCommand("say") .WithAccessLevel(AccessLevel.OP) .WithDescription("Say a message from the server") .WithHelpText("<message>") .WithPermissionNode("tdsm.say") .Calls(this.Say); AddCommand("status") .WithDescription("Server status") .SetDefaultUsage() .WithPermissionNode("tdsm.status") .Calls(this.ServerStatus); AddCommand("kick") .WithDescription("Kicks a player from the server") .WithHelpText("<player> - Kicks the player specified.") .WithPermissionNode("tdsm.kick") .Calls(this.Kick); AddCommand("op") .WithAccessLevel(AccessLevel.OP) .WithDescription("Allows a player server operator status") .WithHelpText("<player> <password> - Sets the player as an operator on the server and sets the OP password for that player.") .WithPermissionNode("tdsm.op") .Calls(this.OpPlayer); AddCommand("deop") .WithAccessLevel(AccessLevel.OP) .WithDescription("Removes server operator status from a player") .WithHelpText("<player> - Removes server operator status from the specified player.") .WithPermissionNode("tdsm.deop") .Calls(this.DeopPlayer); AddCommand("oplogin") .WithAccessLevel(AccessLevel.PLAYER) .WithDescription("Allows an operator to log in") .WithHelpText("<password> - Logs into the server as an OP.") .WithPermissionNode("tdsm.oplogin") .Calls(this.OpLogin); AddCommand("oplogout") .WithAccessLevel(AccessLevel.PLAYER) .WithDescription("Logs out a signed in operator.") .SetDefaultUsage() .WithPermissionNode("tdsm.oplogout") .Calls(this.OpLogout); AddCommand("spawnboss") .WithAccessLevel(AccessLevel.OP) .WithDescription("Spawn a boss") .WithHelpText("eye skeletron eater kingslime prime twins destroyer wof plantera golem retinazer spazmatism") .WithHelpText("eye twins -night") .WithHelpText("-all") .WithHelpText("<boss> -player <name>") .WithHelpText("(If no player is entered it will be a random online player)") .WithPermissionNode("tdsm.spawnboss") .Calls(this.SummonBoss); AddCommand("timelock") .WithAccessLevel(AccessLevel.OP) .WithDescription("Forces the time to stay at a certain point.") .WithHelpText("now") .WithHelpText("set day|dawn|dusk|noon|night") .WithHelpText("setat <time>") .WithHelpText("disable") .WithPermissionNode("tdsm.timelock") .Calls(this.Timelock); //AddCommand("heal") // .WithAccessLevel(AccessLevel.OP) // .WithDescription("Heals one or all players.") // .WithHelpText("<player>") // .WithHelpText("-all") // .WithPermissionNode("tdsm.heal") // .Calls(this.Heal); AddCommand("hardmode") .WithAccessLevel(AccessLevel.OP) .SetDefaultUsage() .WithDescription("Enables hard mode.") .WithPermissionNode("tdsm.hardmode") .Calls(this.HardMode); AddCommand("rcon") .WithDescription("Manage remote console access.") .WithAccessLevel(AccessLevel.REMOTE_CONSOLE) .WithHelpText("load - reload login database") .WithHelpText("list - list rcon connections") .WithHelpText("cut <name> - cut off rcon connections") .WithHelpText("ban <name> - cut off rcon connections and revoke access") .WithHelpText("add <name> <password> - add an rcon user") .WithPermissionNode("tdsm.rcon") .Calls(RConServer.RConCommand); AddCommand("npcspawning") .WithDescription("Turn NPC spawning on or off.") .WithAccessLevel(AccessLevel.OP) .WithHelpText("<true|false>") .WithPermissionNode("tdsm.npcspawning") .Calls(this.NPCSpawning); AddCommand("invasion") .WithDescription("Begins an invasion") .WithAccessLevel(AccessLevel.OP) .WithHelpText("goblin|frost|pirate|martian") .WithHelpText("-custom <npc id or name> <npc id or name> ...") .WithHelpText("stop|end|cancel") .WithPermissionNode("tdsm.invasion") .Calls(this.Invasion); AddCommand("serverlist") .WithDescription("Manages the heartbeat and server list") .WithAccessLevel(AccessLevel.OP) .WithHelpText("print|? - Displays the current details") .WithHelpText("enable|disable - Enable/disable the heartbeat") .WithHelpText("public true|false - Allows public viewing") .WithHelpText("desc|name|domain - Displays the current") .WithHelpText("desc <description>") .WithHelpText("name <name>") .WithHelpText("domain <domain>") .WithPermissionNode("tdsm.serverlist") .Calls(this.ServerList); AddCommand("var") .WithAccessLevel(AccessLevel.OP) .WithDescription("Experimental variable manipulation") .WithHelpText("<field|exec|prop> <namespace.classname> <fieldname|methodname>") .WithHelpText("field Terraria.Main eclipse #Get the value") .WithHelpText("field Terraria.Main eclipse false #Set the value") .WithPermissionNode("tdsm.var") .Calls(this.VariableMan); AddCommand("worldevent") .WithAccessLevel(AccessLevel.OP) .WithDescription("Start or stop an event") .WithHelpText("eclipse|bloodmoon|pumpkinmoon|snowmoon|slimerain") .WithPermissionNode("tdsm.worldevent") .Calls(this.WorldEvent); #if TDSMServer AddCommand("maxplayers") .WithAccessLevel(AccessLevel.REMOTE_CONSOLE) .WithDescription("Set the maximum number of player slots.") .WithHelpText("<num> - set the max number of slots") .WithHelpText("<num> <num> - also set the number of overlimit slots") .WithPermissionNode("tdsm.maxplayers") .Calls(SlotManager.MaxPlayersCommand); AddCommand("q") .WithAccessLevel(AccessLevel.OP) .WithDescription("List connections waiting in queues.") .WithHelpText("q") .WithPermissionNode("tdsm.q") .Calls(SlotManager.QCommand); AddCommand("conn") .WithAccessLevel(AccessLevel.OP) .WithDescription("Accept new connections.") .WithPermissionNode("tdsm.conn") .SetDefaultUsage() .Calls(Server.Command_AcceptConnections); #endif // AddCommand("restart") // .WithAccessLevel(AccessLevel.OP) // .WithDescription("Restart the server.") // .WithHelpText("<no parameters> - Restart immediately.") // .WithHelpText("--wait - Wait for users to disconnect and then restart.") // .WithPermissionNode("tdsm.restart") // .Calls(this.Restart); #if DEBUG AddCommand("repo") .WithAccessLevel(AccessLevel.OP) .WithDescription("Install or update plugins.") .WithHelpText("<status|update|install> <plugin name>") .WithHelpText("status -all") .WithHelpText("update -all") .WithHelpText("update \"TDSM Core Module\"") .WithPermissionNode("tdsm.repo") .Calls(this.RepositoryCommand); //Template for when we have more plugins //AddCommand("repo") // .WithDescription("The tdsm update repository") // .WithAccessLevel(AccessLevel.OP) // .WithHelpText("status - Displays plugins out of date") // .WithHelpText("definitions - Update NPC and Item definitions") // .WithHelpText("updatetest - Tests if your plugins are compatible with the latest TDSM") // .WithHelpText("search <search params> - Browse the repository") // .WithHelpText("update <plugin name>|-all - Update a particular plugin or all") // .WithHelpText("install <plugin name> - Installs a plugin") // .WithPermissionNode("tdsm.repo") // .Calls(this.Repository); #endif if (!DefinitionManager.Initialise()) { ProgramLog.Log("Failed to initialise definitions."); } ProgramLog.Log("TDSM Rebind core enabled"); }
protected override void Initialized(object state) { ProgramLog.Log("TDSM Rebind core build {0}", this.Version); //Register hook sources PluginManager.RegisterHookSource(typeof(TDSMHookPoints)); CommandDictionary = new Dictionary<string, string>(); Ops = new PairFileRegister(System.IO.Path.Combine(Globals.DataPath, "ops.txt")); Whitelist = new DataRegister(System.IO.Path.Combine(Globals.DataPath, "whitelist.txt"), false); AddComponents<Entry>(); RunComponent(ComponentEvent.Initialise); ProgramLog.Log("TDSM Rebind core enabled"); }
protected override void Initialized(object state) { // if (/*!Globals.IsPatching &&*/ !ProgramLog.IsOpen) // { // var logFile = Globals.DataPath + System.IO.Path.DirectorySeparatorChar + "server.log"; // ProgramLog.OpenLogFile(logFile); // ProgramLog.Log("TDSM Rebind core build {0}", this.Version); // // Tools.SetWriteLineMethod(ProgramLog.Log, OnLogFinished); // ConsoleSender.DefaultColour = ConsoleColor.Gray; // //ConsoleSender.SetMethod((msg, r, g, b) => // //{ // // Console.ForegroundColor = FromColor((byte)r, (byte)g, (byte)b); // // Console.WriteLine(msg); // //}); // } Ops = new DataRegister(System.IO.Path.Combine(Globals.DataPath, "ops.txt")); #if WebInterface WebInterface.WebPermissions.Load(); #endif AddCommand("platform") .WithAccessLevel(AccessLevel.PLAYER) .WithDescription("Show what type of server is running TDSM") .SetDefaultUsage() .WithPermissionNode("tdsm.platform") .Calls(this.OperatingSystem); AddCommand("exit") .WithDescription("Stops the server") .WithAccessLevel(AccessLevel.CONSOLE) .SetDefaultUsage() .WithPermissionNode("tdsm.admin") .Calls(this.Exit); AddCommand("stop") .WithDescription("Stops the server") .WithAccessLevel(AccessLevel.CONSOLE) .SetDefaultUsage() .WithPermissionNode("tdsm.admin") .Calls(this.Exit); AddCommand("time") .WithDescription("Change the time of day") .WithAccessLevel(AccessLevel.OP) .WithHelpText("set <numeric time>") .WithHelpText("set 5:10am") .WithHelpText("now|?") .WithHelpText("day|dawn|dusk|noon|night") .WithPermissionNode("tdsm.time") .Calls(this.Time); AddCommand("give") .WithAccessLevel(AccessLevel.OP) .WithDescription("Give a player items") .WithHelpText("<player> <amount> <itemname:itemid> [prefix]") .WithPermissionNode("tdsm.give") .Calls(this.Give); AddCommand("spawnnpc") .WithAccessLevel(AccessLevel.OP) .WithDescription("Spawns NPCs") .WithHelpText("<amount> \"<name:id>\" \"<player>\"") .WithPermissionNode("tdsm.spawnnpc") .Calls(this.SpawnNPC); AddCommand("tp") .WithAccessLevel(AccessLevel.OP) .WithDescription("Teleport a player to another player") .WithHelpText("<player> <toplayer> - another player") .WithHelpText("<player> <x> <y>") .WithHelpText("<toplayer> - yourself") .WithHelpText("<x> <y>") .WithHelpText(" - yourself to spawn") .WithPermissionNode("tdsm.tp") .Calls(this.Teleport); AddCommand("tphere") .WithAccessLevel(AccessLevel.OP) .WithDescription("Teleport a player to yourself") .WithHelpText("<player>") .WithPermissionNode("tdsm.tphere") .Calls(this.TeleportHere); AddCommand("save") .WithDescription("Save world and configuration data") .WithAccessLevel(AccessLevel.OP) .SetDefaultUsage() .WithPermissionNode("tdsm.admin") .Calls(this.SaveAll); AddCommand("save-all") .WithDescription("Save world and configuration data") .WithAccessLevel(AccessLevel.OP) .SetDefaultUsage() .WithPermissionNode("tdsm.admin") .Calls(this.SaveAll); //AddCommand("reload") // .WithDescription(Languages.CommandDescription_ReloadConfig) // .WithAccessLevel(AccessLevel.REMOTE_CONSOLE) // .WithPermissionNode("tdsm.admin") // .Calls(this.Reload); AddCommand("itemrej") .WithAccessLevel(AccessLevel.OP) .WithDescription("Manage item rejections") .WithHelpText("-add|-remove <id:name>") .WithHelpText("-clear") .WithPermissionNode("tdsm.itemrej") .Calls(this.ItemRejection); AddCommand("refresh") .WithAccessLevel(AccessLevel.PLAYER) .WithDescription("Redownload the area around you from the server") .WithHelpText("Usage: refresh") .WithPermissionNode("tdsm.refresh") .Calls(this.Refresh); AddCommand("list") .WithAccessLevel(AccessLevel.PLAYER) .WithDescription("Lists online players") .SetDefaultUsage() .WithPermissionNode("tdsm.who") .Calls(this.List); AddCommand("who") .WithAccessLevel(AccessLevel.PLAYER) .WithDescription("Lists online players") .SetDefaultUsage() .WithPermissionNode("tdsm.who") .Calls(this.List); AddCommand("players") .WithAccessLevel(AccessLevel.PLAYER) .WithDescription("Lists online players") .SetDefaultUsage() .WithPermissionNode("tdsm.who") .Calls(this.OldList); // this is what the server crawler expects AddCommand("playing") .WithAccessLevel(AccessLevel.PLAYER) .WithDescription("Lists online players") .SetDefaultUsage() .WithPermissionNode("tdsm.who") .Calls(this.OldList); AddCommand("online") .WithAccessLevel(AccessLevel.PLAYER) .WithDescription("Lists online players") .SetDefaultUsage() .WithPermissionNode("tdsm.who") .Calls(this.List); AddCommand("me") .WithAccessLevel(AccessLevel.PLAYER) .WithDescription("3rd person talk") .WithHelpText("<message> - Message to display in third person.") //.SetDefaultUsage() //This was causing an additional "me" to be displayed in the help commmand syntax. .WithPermissionNode("tdsm.me") .Calls(this.Action); AddCommand("say") .WithAccessLevel(AccessLevel.OP) .WithDescription("Say a message from the server") .WithHelpText("<message>") .WithPermissionNode("tdsm.say") .Calls(this.Say); AddCommand("status") .WithDescription("Server status") .SetDefaultUsage() .WithPermissionNode("tdsm.status") .Calls(this.ServerStatus); AddCommand("kick") .WithDescription("Kicks a player from the server") .WithHelpText("<player> - Kicks the player specified.") .WithPermissionNode("tdsm.kick") .Calls(this.Kick); AddCommand("op") .WithAccessLevel(AccessLevel.OP) .WithDescription("Allows a player server operator status") .WithHelpText("<player> <password> - Sets the player as an operator on the server and sets the OP password for that player.") .WithPermissionNode("tdsm.op") .Calls(this.OpPlayer); AddCommand("deop") .WithAccessLevel(AccessLevel.OP) .WithDescription("Removes server operator status from a player") .WithHelpText("<player> - Removes server operator status from the specified player.") .WithPermissionNode("tdsm.deop") .Calls(this.DeopPlayer); AddCommand("oplogin") .WithAccessLevel(AccessLevel.PLAYER) .WithDescription("Allows an operator to log in") .WithHelpText("<password> - Logs into the server as an OP.") .WithPermissionNode("tdsm.oplogin") .Calls(this.OpLogin); AddCommand("oplogout") .WithAccessLevel(AccessLevel.PLAYER) .WithDescription("Logs out a signed in operator.") .SetDefaultUsage() .WithPermissionNode("tdsm.oplogout") .Calls(this.OpLogout); AddCommand("spawnboss") .WithAccessLevel(AccessLevel.OP) .WithDescription("Spawn a boss") .WithHelpText("<amount> <boss> <player>") .WithHelpText("(If no player is entered it will be a random online player)") .WithPermissionNode("tdsm.spawnboss") .Calls(this.SummonBoss); AddCommand("timelock") .WithAccessLevel(AccessLevel.OP) .WithDescription("Forces the time to stay at a certain point.") .WithHelpText("now") .WithHelpText("set day|dawn|dusk|noon|night") .WithHelpText("setat <time>") .WithHelpText("disable") .WithPermissionNode("tdsm.timelock") .Calls(this.Timelock); AddCommand("fastforwardtime") .WithAccessLevel(AccessLevel.OP) .WithDescription("Fast forwards time until disabled.") .WithPermissionNode("tdsm.fastforwardtime") .Calls(this.FastForwardTime); AddCommand("heal") .WithAccessLevel(AccessLevel.OP) .WithDescription("Heals one or all players.") .WithHelpText("<player>") .WithHelpText("-all") .WithPermissionNode("tdsm.heal") .Calls(this.Heal); AddCommand("hardmode") .WithAccessLevel(AccessLevel.OP) .SetDefaultUsage() .WithDescription("Enables hard mode.") .WithPermissionNode("tdsm.hardmode") .Calls(this.HardMode); AddCommand("rcon") .WithDescription("Manage remote console access.") .WithAccessLevel(AccessLevel.REMOTE_CONSOLE) .WithHelpText("load - reload login database") .WithHelpText("list - list rcon connections") .WithHelpText("cut <name> - cut off rcon connections") .WithHelpText("ban <name> - cut off rcon connections and revoke access") .WithHelpText("add <name> <password> - add an rcon user") .WithPermissionNode("tdsm.rcon") .Calls(RConServer.RConCommand); AddCommand("npcspawning") .WithDescription("Turn NPC spawning on or off.") .WithAccessLevel(AccessLevel.OP) .WithHelpText("<true|false>") .WithPermissionNode("tdsm.npcspawning") .Calls(this.NPCSpawning); AddCommand("invasion") .WithDescription("Begins an invasion") .WithAccessLevel(AccessLevel.OP) .WithHelpText("goblin|frost|pirate|martian") .WithHelpText("-custom <npc id or name> <npc id or name> ...") .WithHelpText("stop|end|cancel") .WithPermissionNode("tdsm.invasion") .Calls(this.Invasion); AddCommand("serverlist") .WithDescription("Manages the heartbeat and server list") .WithAccessLevel(AccessLevel.OP) .WithHelpText("print|? - Displays the current details") .WithHelpText("enable|disable - Enable/disable the heartbeat") .WithHelpText("public true|false - Allows public viewing") .WithHelpText("desc|name|domain - Displays the current") .WithHelpText("desc <description>") .WithHelpText("name <name>") .WithHelpText("domain <domain>") .WithPermissionNode("tdsm.serverlist") .Calls(this.ServerList); AddCommand("var") .WithAccessLevel(AccessLevel.OP) .WithDescription("Experimental variable manipulation") .WithHelpText("<field|exec|prop> <namespace.classname> <fieldname|methodname>") .WithHelpText("field Terraria.Main eclipse #Get the value") .WithHelpText("field Terraria.Main eclipse false #Set the value") .WithPermissionNode("tdsm.var") .Calls(this.VariableMan); AddCommand("worldevent") .WithAccessLevel(AccessLevel.OP) .WithDescription("Start or stop an event") .WithHelpText("eclipse|bloodmoon|pumpkinmoon|snowmoon|slimerain") .WithPermissionNode("tdsm.worldevent") .Calls(this.WorldEvent); #if TDSMServer AddCommand("maxplayers") .WithAccessLevel(AccessLevel.REMOTE_CONSOLE) .WithDescription("Set the maximum number of player slots.") .WithHelpText("<num> - set the max number of slots") .WithHelpText("<num> <num> - also set the number of overlimit slots") .WithPermissionNode("tdsm.maxplayers") .Calls(SlotManager.MaxPlayersCommand); AddCommand("q") .WithAccessLevel(AccessLevel.OP) .WithDescription("List connections waiting in queues.") .WithHelpText("q") .WithPermissionNode("tdsm.q") .Calls(SlotManager.QCommand); AddCommand("conn") .WithAccessLevel(AccessLevel.OP) .WithDescription("Accept new connections.") .WithPermissionNode("tdsm.conn") .SetDefaultUsage() .Calls(Server.Command_AcceptConnections); #endif // AddCommand("restart") // .WithAccessLevel(AccessLevel.OP) // .WithDescription("Restart the server.") // .WithHelpText("<no parameters> - Restart immediately.") // .WithHelpText("--wait - Wait for users to disconnect and then restart.") // .WithPermissionNode("tdsm.restart") // .Calls(this.Restart); #if DEBUG AddCommand("repo") .WithAccessLevel(AccessLevel.OP) .WithDescription("Install or update plugins.") .WithHelpText("<status|update|install> <plugin name>") .WithHelpText("status -all") .WithHelpText("update -all") .WithHelpText("update \"TDSM Core Module\"") .WithPermissionNode("tdsm.repo") .Calls(this.RepositoryCommand); //Template for when we have more plugins //AddCommand("repo") // .WithDescription("The tdsm update repository") // .WithAccessLevel(AccessLevel.OP) // .WithHelpText("status - Displays plugins out of date") // .WithHelpText("definitions - Update NPC and Item definitions") // .WithHelpText("updatetest - Tests if your plugins are compatible with the latest TDSM") // .WithHelpText("search <search params> - Browse the repository") // .WithHelpText("update <plugin name>|-all - Update a particular plugin or all") // .WithHelpText("install <plugin name> - Installs a plugin") // .WithPermissionNode("tdsm.repo") // .Calls(this.Repository); AddCommand("group") .WithAccessLevel(AccessLevel.OP) .WithPermissionNode("tdsm.group") .WithDescription("Manage groups and their permissions") .WithHelpText("add <group> <ApplyToGuests> <Parent> <R> <G> <B> <Prefix> <Suffix>") .WithHelpText("remove <group>") .WithHelpText("addnode <group> <node> [deny]") .WithHelpText("removenode <group> <node>") .WithHelpText("list") .WithHelpText("listnodes <group>") .Calls(this.GroupPermission); AddCommand("user") .WithAccessLevel(AccessLevel.OP) .WithPermissionNode("tdsm.user") .WithDescription("Manage user permissions") .WithHelpText("add <user> <password> [op]") .WithHelpText("add <group>") .WithHelpText("remove <user> ") .WithHelpText("update <user> <password> [op]") .WithHelpText("addnode <username> <node> [deny]") .WithHelpText("removenode <username> <node> [deny]") .WithHelpText("listgroups") .WithHelpText("listnodes") .Calls(this.UserPermission); AddCommand("killnpc") .WithAccessLevel(AccessLevel.OP) .WithPermissionNode("tdsm.killnpc") .WithDescription("Kill all non town NPC's") .Calls(this.KillNPC); AddCommand("auth") .WithAccessLevel(AccessLevel.PLAYER) .WithPermissionNode("tdsm.auth") .WithDescription("Sign in") .Calls(this.Auth); AddCommand("grow") .WithAccessLevel(AccessLevel.OP) .WithPermissionNode("tdsm.grow") .Calls((ISender sender, ArgumentList args) => { if (null == WorldGen.genRand) WorldGen.genRand = new Random(); var ply = sender as Player; int tileX = (int)(ply.position.X / 16f), tileY = (int)((ply.position.Y + ply.height) / 16f); if (args.TryPop("-alch")) WorldGen.GrowAlch(tileX, tileY); // else if (args.TryPop("-cactus")) WorldGen.GrowCactus(tileX, tileY); else if (args.TryPop("-epictree")) WorldGen.GrowEpicTree(tileX, tileY); // else if (args.TryPop("-livingtree")) WorldGen.GrowLivingTree(tileX, tileY); else if (args.TryPop("-palmtree")) WorldGen.GrowPalmTree(tileX, tileY); // else if (args.TryPop("-pumpkin")) WorldGen.GrowPumpkin(tileX, tileY); else if (args.TryPop("-shroom")) WorldGen.GrowShroom(tileX, tileY); // else if (args.TryPop("-spike")) WorldGen.GrowSpike(tileX, tileY); else if (args.TryPop("-tree") || args.TryPop("-t")) WorldGen.GrowTree(tileX, tileY); else if (args.TryPop("-tree")) WorldGen.GrowTree(tileX, tileY); else if (args.TryPop("-grass") || args.TryPop("-g")) WorldGen.SpreadGrass(tileX, tileY); else if (args.TryPop("-undergroundtree")) WorldGen.GrowUndergroundTree(tileX, tileY); else throw new CommandError("Element not supported"); NetMessage.SendTileSquare(ply.whoAmI, (int)(ply.position.X / 16), (int)(ply.position.Y / 16), 32); }); AddCommand("abuff") .WithAccessLevel(AccessLevel.OP) .WithPermissionNode("tdsm.abuff") .Calls((ISender sender, ArgumentList args) => { var time = args.GetInt(0); (sender as Player).AddBuff(21, time); NetMessage.SendData(55, -1, -1, "", (sender as Player).whoAmI, 21, time, 0, 0, 0, 0); NetMessage.SendData(55, (sender as Player).whoAmI, -1, "", (sender as Player).whoAmI, 21, time); }); #endif if (!DefinitionManager.Initialise()) ProgramLog.Log("Failed to initialise definitions."); ProgramLog.Log("TDSM Rebind core enabled"); }
private void TextBox_MouseDoubleClick_dataregister(object sender, MouseButtonEventArgs e) { DataRegister.Clear(); }
protected override void Initialized(object state) { if (/*!Globals.IsPatching &&*/ !ProgramLog.IsOpen) { var logFile = Globals.DataPath + System.IO.Path.DirectorySeparatorChar + "server.log"; ProgramLog.OpenLogFile(logFile); ProgramLog.Log("TDSM Rebind core build {0}", this.Version); Tools.SetWriteLineMethod(ProgramLog.Log, OnLogFinished); ConsoleSender.DefaultColour = ConsoleColor.Gray; //ConsoleSender.SetMethod((msg, r, g, b) => //{ // Console.ForegroundColor = FromColor((byte)r, (byte)g, (byte)b); // Console.WriteLine(msg); //}); } Ops = new DataRegister(System.IO.Path.Combine(Globals.DataPath, "ops.txt")); #if WebInterface WebInterface.WebPermissions.Load(); #endif AddCommand("platform") .WithAccessLevel(AccessLevel.PLAYER) .WithDescription("Show what type of server is running TDSM") .SetDefaultUsage() .WithPermissionNode("tdsm.platform") .Calls(this.OperatingSystem); AddCommand("exit") .WithDescription("Stops the server") .WithAccessLevel(AccessLevel.CONSOLE) .SetDefaultUsage() .WithPermissionNode("tdsm.admin") .Calls(this.Exit); AddCommand("stop") .WithDescription("Stops the server") .WithAccessLevel(AccessLevel.CONSOLE) .SetDefaultUsage() .WithPermissionNode("tdsm.admin") .Calls(this.Exit); AddCommand("time") .WithDescription("Change the time of day") .WithAccessLevel(AccessLevel.OP) .WithHelpText("set <numeric time>") .WithHelpText("set 5:10am") .WithHelpText("now|?") .WithHelpText("day|dawn|dusk|noon|night") .WithPermissionNode("tdsm.time") .Calls(this.Time); AddCommand("give") .WithAccessLevel(AccessLevel.OP) .WithDescription("Give a player items") .WithHelpText("<player> <amount> <itemname:itemid> [-prefix]") .WithPermissionNode("tdsm.give") .Calls(this.Give); AddCommand("spawnnpc") .WithAccessLevel(AccessLevel.OP) .WithDescription("Spawns NPCs") .WithHelpText("<amount> \"<name:id>\" \"<player>\"") .WithPermissionNode("tdsm.spawnnpc") .Calls(this.SpawnNPC); AddCommand("tp") .WithAccessLevel(AccessLevel.OP) .WithDescription("Teleport a player to another player") .WithHelpText("<player> <toplayer> - another player") .WithHelpText("<player> <x> <y>") .WithHelpText("<toplayer> - yourself") .WithHelpText("<x> <y>") .WithHelpText(" - yourself to spawn") .WithPermissionNode("tdsm.tp") .Calls(this.Teleport); AddCommand("tphere") .WithAccessLevel(AccessLevel.OP) .WithDescription("Teleport a player to yourself") .WithHelpText("<player>") .WithPermissionNode("tdsm.tphere") .Calls(this.TeleportHere); AddCommand("save") .WithDescription("Save world and configuration data") .WithAccessLevel(AccessLevel.OP) .SetDefaultUsage() .WithPermissionNode("tdsm.admin") .Calls(this.SaveAll); AddCommand("save-all") .WithDescription("Save world and configuration data") .WithAccessLevel(AccessLevel.OP) .SetDefaultUsage() .WithPermissionNode("tdsm.admin") .Calls(this.SaveAll); //AddCommand("reload") // .WithDescription(Languages.CommandDescription_ReloadConfig) // .WithAccessLevel(AccessLevel.REMOTE_CONSOLE) // .WithPermissionNode("tdsm.admin") // .Calls(this.Reload); AddCommand("itemrej") .WithAccessLevel(AccessLevel.OP) .WithDescription("Manage item rejections") .WithHelpText("-add|-remove <id:name>") .WithHelpText("-clear") .WithPermissionNode("tdsm.itemrej") .Calls(this.ItemRejection); AddCommand("refresh") .WithAccessLevel(AccessLevel.PLAYER) .WithDescription("Redownload the area around you from the server") .WithHelpText("Usage: refresh") .WithPermissionNode("tdsm.refresh") .Calls(this.Refresh); AddCommand("list") .WithAccessLevel(AccessLevel.PLAYER) .WithDescription("Lists online players") .SetDefaultUsage() .WithPermissionNode("tdsm.who") .Calls(this.List); AddCommand("who") .WithAccessLevel(AccessLevel.PLAYER) .WithDescription("Lists online players") .SetDefaultUsage() .WithPermissionNode("tdsm.who") .Calls(this.List); AddCommand("players") .WithAccessLevel(AccessLevel.PLAYER) .WithDescription("Lists online players") .SetDefaultUsage() .WithPermissionNode("tdsm.who") .Calls(this.OldList); // this is what the server crawler expects AddCommand("playing") .WithAccessLevel(AccessLevel.PLAYER) .WithDescription("Lists online players") .SetDefaultUsage() .WithPermissionNode("tdsm.who") .Calls(this.OldList); AddCommand("online") .WithAccessLevel(AccessLevel.PLAYER) .WithDescription("Lists online players") .SetDefaultUsage() .WithPermissionNode("tdsm.who") .Calls(this.List); AddCommand("me") .WithAccessLevel(AccessLevel.PLAYER) .WithDescription("3rd person talk") .WithHelpText("<message> - Message to display in third person.") //.SetDefaultUsage() //This was causing an additional "me" to be displayed in the help commmand syntax. .WithPermissionNode("tdsm.me") .Calls(this.Action); AddCommand("say") .WithAccessLevel(AccessLevel.OP) .WithDescription("Say a message from the server") .WithHelpText("<message>") .WithPermissionNode("tdsm.say") .Calls(this.Say); AddCommand("status") .WithDescription("Server status") .SetDefaultUsage() .WithPermissionNode("tdsm.status") .Calls(this.ServerStatus); AddCommand("kick") .WithDescription("Kicks a player from the server") .WithHelpText("<player> - Kicks the player specified.") .WithPermissionNode("tdsm.kick") .Calls(this.Kick); AddCommand("op") .WithAccessLevel(AccessLevel.OP) .WithDescription("Allows a player server operator status") .WithHelpText("<player> <password> - Sets the player as an operator on the server and sets the OP password for that player.") .WithPermissionNode("tdsm.op") .Calls(this.OpPlayer); AddCommand("deop") .WithAccessLevel(AccessLevel.OP) .WithDescription("Removes server operator status from a player") .WithHelpText("<player> - Removes server operator status from the specified player.") .WithPermissionNode("tdsm.deop") .Calls(this.DeopPlayer); AddCommand("oplogin") .WithAccessLevel(AccessLevel.PLAYER) .WithDescription("Allows an operator to log in") .WithHelpText("<password> - Logs into the server as an OP.") .WithPermissionNode("tdsm.oplogin") .Calls(this.OpLogin); AddCommand("oplogout") .WithAccessLevel(AccessLevel.PLAYER) .WithDescription("Logs out a signed in operator.") .SetDefaultUsage() .WithPermissionNode("tdsm.oplogout") .Calls(this.OpLogout); AddCommand("spawnboss") .WithAccessLevel(AccessLevel.OP) .WithDescription("Spawn a boss") .WithHelpText("eye skeletron eater kingslime prime twins destroyer wof plantera golem retinazer spazmatism") .WithHelpText("eye twins -night") .WithHelpText("-all") .WithHelpText("<boss> -player <name>") .WithHelpText("(If no player is entered it will be a random online player)") .WithPermissionNode("tdsm.spawnboss") .Calls(this.SummonBoss); AddCommand("timelock") .WithAccessLevel(AccessLevel.OP) .WithDescription("Forces the time to stay at a certain point.") .WithHelpText("now") .WithHelpText("set day|dawn|dusk|noon|night") .WithHelpText("setat <time>") .WithHelpText("disable") .WithPermissionNode("tdsm.timelock") .Calls(this.Timelock); //AddCommand("heal") // .WithAccessLevel(AccessLevel.OP) // .WithDescription("Heals one or all players.") // .WithHelpText("<player>") // .WithHelpText("-all") // .WithPermissionNode("tdsm.heal") // .Calls(this.Heal); AddCommand("hardmode") .WithAccessLevel(AccessLevel.OP) .SetDefaultUsage() .WithDescription("Enables hard mode.") .WithPermissionNode("tdsm.hardmode") .Calls(this.HardMode); AddCommand("rcon") .WithDescription("Manage remote console access.") .WithAccessLevel(AccessLevel.REMOTE_CONSOLE) .WithHelpText("load - reload login database") .WithHelpText("list - list rcon connections") .WithHelpText("cut <name> - cut off rcon connections") .WithHelpText("ban <name> - cut off rcon connections and revoke access") .WithHelpText("add <name> <password> - add an rcon user") .WithPermissionNode("tdsm.rcon") .Calls(RConServer.RConCommand); AddCommand("npcspawning") .WithDescription("Turn NPC spawning on or off.") .WithAccessLevel(AccessLevel.OP) .WithHelpText("<true|false>") .WithPermissionNode("tdsm.npcspawning") .Calls(this.NPCSpawning); AddCommand("invasion") .WithDescription("Begins an invasion") .WithAccessLevel(AccessLevel.OP) .WithHelpText("goblin|frost|pirate|martian") .WithHelpText("-custom <npc id or name> <npc id or name> ...") .WithHelpText("stop|end|cancel") .WithPermissionNode("tdsm.invasion") .Calls(this.Invasion); AddCommand("serverlist") .WithDescription("Manages the heartbeat and server list") .WithAccessLevel(AccessLevel.OP) .WithHelpText("print|? - Displays the current details") .WithHelpText("enable|disable - Enable/disable the heartbeat") .WithHelpText("public true|false - Allows public viewing") .WithHelpText("desc|name|domain - Displays the current") .WithHelpText("desc <description>") .WithHelpText("name <name>") .WithHelpText("domain <domain>") .WithPermissionNode("tdsm.serverlist") .Calls(this.ServerList); AddCommand("var") .WithAccessLevel(AccessLevel.OP) .WithDescription("Experimental variable manipulation") .WithHelpText("<field|exec|prop> <namespace.classname> <fieldname|methodname>") .WithHelpText("field Terraria.Main eclipse #Get the value") .WithHelpText("field Terraria.Main eclipse false #Set the value") .WithPermissionNode("tdsm.var") .Calls(this.VariableMan); AddCommand("worldevent") .WithAccessLevel(AccessLevel.OP) .WithDescription("Start or stop an event") .WithHelpText("eclipse|bloodmoon|pumpkinmoon|snowmoon|slimerain") .WithPermissionNode("tdsm.worldevent") .Calls(this.WorldEvent); #if TDSMServer AddCommand("maxplayers") .WithAccessLevel(AccessLevel.REMOTE_CONSOLE) .WithDescription("Set the maximum number of player slots.") .WithHelpText("<num> - set the max number of slots") .WithHelpText("<num> <num> - also set the number of overlimit slots") .WithPermissionNode("tdsm.maxplayers") .Calls(SlotManager.MaxPlayersCommand); AddCommand("q") .WithAccessLevel(AccessLevel.OP) .WithDescription("List connections waiting in queues.") .WithHelpText("q") .WithPermissionNode("tdsm.q") .Calls(SlotManager.QCommand); AddCommand("conn") .WithAccessLevel(AccessLevel.OP) .WithDescription("Accept new connections.") .WithPermissionNode("tdsm.conn") .SetDefaultUsage() .Calls(Server.Command_AcceptConnections); #endif // AddCommand("restart") // .WithAccessLevel(AccessLevel.OP) // .WithDescription("Restart the server.") // .WithHelpText("<no parameters> - Restart immediately.") // .WithHelpText("--wait - Wait for users to disconnect and then restart.") // .WithPermissionNode("tdsm.restart") // .Calls(this.Restart); #if DEBUG AddCommand("repo") .WithAccessLevel(AccessLevel.OP) .WithDescription("Install or update plugins.") .WithHelpText("<status|update|install> <plugin name>") .WithHelpText("status -all") .WithHelpText("update -all") .WithHelpText("update \"TDSM Core Module\"") .WithPermissionNode("tdsm.repo") .Calls(this.RepositoryCommand); //Template for when we have more plugins //AddCommand("repo") // .WithDescription("The tdsm update repository") // .WithAccessLevel(AccessLevel.OP) // .WithHelpText("status - Displays plugins out of date") // .WithHelpText("definitions - Update NPC and Item definitions") // .WithHelpText("updatetest - Tests if your plugins are compatible with the latest TDSM") // .WithHelpText("search <search params> - Browse the repository") // .WithHelpText("update <plugin name>|-all - Update a particular plugin or all") // .WithHelpText("install <plugin name> - Installs a plugin") // .WithPermissionNode("tdsm.repo") // .Calls(this.Repository); #endif if (!DefinitionManager.Initialise()) ProgramLog.Log("Failed to initialise definitions."); ProgramLog.Log("TDSM Rebind core enabled"); }
}//end method Submit private void SubmitCheckIn() { DataRegister.UpdateCustomers(); bool IsGroup = groupInfo.IsAGroup(); int groupID = -1; if (IsGroup == true) { groupID = groupInfo.GetGroupID(); } int numOfRooms = DataRegister.Rooms.Rows.Count; // Scan room list for (int i = 0; i < numOfRooms; i++) { string roomNumber = DataRegister.Rooms.Rows[i]["RoomID"].ToString(); int ticketID = -1; int numOfCustomers = DataRegister.Customers.Rows.Count; // Scan customer list for (int j = 0; j < numOfCustomers; j++) { string roomNumber2 = DataRegister.Customers.Rows[j]["RoomNumber"].ToString(); if (roomNumber2.Equals(roomNumber)) { if (ticketID == -1) { VO.PhieuThuePhongVO item = new VO.PhieuThuePhongVO(); if (groupID != -1) { item.MA_DOAN_KHACH = groupID; } item.MA_KHACH_HANG = Int32.Parse(DataRegister.Customers.Rows[j]["CustomerID"].ToString()); item.MA_PHONG = Int32.Parse(DataRegister.Customers.Rows[j]["RoomNumber"].ToString()); item.NGAY_NHAN_PHONG = DateTime.Parse(dateCheckIn.Text); item.NGAY_TRA_PHONG = DateTime.Parse(dateCheckOut.Text); BUS.PhieuThuePhongBUS bus = new BUS.PhieuThuePhongBUS(); try { int result = bus.Insert(item); if (result == 0) { //code here }//end if there're some errors ticketID = result; }//end try catch (Exception e) { MessageBox.Show(e.Message); } //end catch } //end if : set owner else { VO.KhachTroVO ktItem = new VO.KhachTroVO(); ktItem.MA_PHIEU = ticketID; ktItem.MA_KHACH_HANG = Int32.Parse(DataRegister.Customers.Rows[j]["CustomerID"].ToString()); BUS.KhachTroBUS ktBus = new BUS.KhachTroBUS(); try { int result2 = ktBus.Insert(ktItem); if (result2 != 0) { } //end if } //end try catch (Exception e) { MessageBox.Show(e.Message); } //end catch } //end else } //end if : room number matched } //end for : customers } //end for : rooms } //end method SubmitCheckIn