public TradeRequest(Main game) : base(game)
        {
            Order = 4;

            for (int i = 0; i < Main.maxPlayers; i++)
                TradeActive[i] = new TradePlayer();
        }
Beispiel #2
0
 public AFK(Main game)
     : base(game)
 {
     Order = 50;
     AFKConfig = new AFKConfigFile();
     Players = new Player[256];
 }
        private static void InnerStart(string[] args)
        {
            try
            {
                Program.LaunchParameters = Utils.ParseArguements(args);
                ProgramServer.Game = new Main();
                string str = null;
                if (str != null)
                {
                    ProgramServer.Game.SetWorld(str);
                }
                try
                {
                    Console.WriteLine("TerrariaAPI Version: " + ServerApi.ApiVersion + " (Protocol {0} ({1}))", Terraria.Main.versionNumber2, Terraria.Main.curRelease);
                    Console.WriteLine("SendQ edition");
                    ServerApi.Initialize(args, Game);
                }
                catch (Exception ex)
                {
                    ServerApi.LogWriter.ServerWriteLine(
                        "Startup aborted due to an exception in the Server API initialization:\n" + ex, TraceLevel.Error);

                    Console.ReadLine();
                    return;
                }
                ProgramServer.Game.DedServ();
                ServerApi.DeInitialize();
            }
            catch (Exception exception1)
            {
                ServerApi.LogWriter.ServerWriteLine("Server crashed due to an unhandled exception:\n" + exception1, TraceLevel.Error);
            }
        }
        public MAC(Main game)
            : base(game)
        {
            Order = -1;

            config = new MACconfig();
        }
        public SignCommands(Main game)
            : base(game)
        {
            getConfig = new scConfig();

            Order = 4;
        }
 public Jail(Main game)
     : base(game)
 {
     Order = 3;
     JPConfig = new JPConfigFile();
     Players = new Player[256];
 }
Beispiel #7
0
		public ItemDropLogPlugin(Main game) : base(game)
		{
			this._dropLocker = new object();
			this._drops = new ItemDrop[Main.item.Length];
			this._playerDropsPending = new List<ItemDrop>(Main.item.Length);
			this._ignoredItems = new List<Item>();
		}
 public PluginMain( Main game )
     : base(game)
 {
     Order = 1;
     Plrs = new List<Buffee>();
     GloballyBanned = new List<int>();
 }
Beispiel #9
0
		//add to Terraria.Main.DrawMenu in Main.menuMode == 0 after achievements
		//Interface.AddMenuButtons(this, this.selectedMenu, array9, array7, ref num, ref num3, ref num10, ref num5);
		internal static void AddMenuButtons(Main main, int selectedMenu, string[] buttonNames, float[] buttonScales, ref int offY, ref int spacing, ref int buttonIndex, ref int numButtons)
		{
			buttonNames[buttonIndex] = "Mods";
			if (selectedMenu == buttonIndex)
			{
				Main.PlaySound(10, -1, -1, 1);
				Main.menuMode = modsMenuID;
			}
			buttonIndex++;
			numButtons++;
			buttonNames[buttonIndex] = "Mod Sources";
			if (selectedMenu == buttonIndex)
			{
				Main.PlaySound(10, -1, -1, 1);
				Main.menuMode = modSourcesID;
			}
			buttonIndex++;
			numButtons++;
			buttonNames[buttonIndex] = "Mod Browser (Beta)";
			if (selectedMenu == buttonIndex)
			{
				Main.PlaySound(10, -1, -1, 1);
				Main.menuMode = modBrowserID;
			}
			buttonIndex++;
			numButtons++;
			offY = 220;
			for (int k = 0; k < numButtons; k++)
			{
				buttonScales[k] = 0.82f;
			}
			spacing = 45;
		}
Beispiel #10
0
 public TChatChannels(Main game)
     : base(game)
 {
     AutoJoin = true;
     PlugInHandler.AddPlugIn(this);
     Manager = new ChannelManager();
 }
Beispiel #11
0
 public InfiniteSigns(Main game)
     : base(game)
 {
     for (int i = 0; i < 256; i++)
         Infos[i] = new PlayerInfo() { Index = i };
     Order = 1;
 }
		public static void LaunchGame(string[] args)
		{
			Program.LaunchParameters = Utils.ParseArguements(args);
            ThreadPool.SetMinThreads(8, 8);
            using (Main main = new Main())
			{
				try
                {
                    SocialAPI.Initialize(null);
                    LaunchInitializer.LoadParameters(main);
                    Main.OnEngineLoad += delegate
					{
						Program.ForceLoadAssembly(Assembly.GetExecutingAssembly(), true);
					};
#if CLIENT
                    main.Run();
#else
                    main.DedServ();
#endif
                }
                catch (Exception e)
				{
					Program.DisplayException(e);
				}
			}
		}
Beispiel #13
0
        private static void Main_DoUpdate(On.Terraria.Main.orig_DoUpdate orig, Terraria.Main self, GameTime gameTime)
        {
            orig(self, gameTime);

            // update cutscene
            Update(gameTime);
        }
Beispiel #14
0
 public Cauldron(Main game)
     : base(game)
 {
     Order = 4;
     String savepath = Path.Combine(TShock.SavePath, "potions.cfg");
     CauldronReader reader = new CauldronReader();
     if (File.Exists(savepath))
     {
         try
         {
             potions = reader.readFile(savepath);
             Console.WriteLine(potions.potions.Count + " potions have been loaded.");
         }
         catch (Exception e)
         {
             Console.WriteLine(e.Message);
         }
     }
     else
     {
         potions = reader.writeFile(savepath);
         Console.WriteLine("Basic potion file being created.");
         Console.WriteLine("1 potion containing regeneration for 30 seconds created.");
         Console.WriteLine("1 potion containing swiftness for 30 seconds created.");
     }
 }
Beispiel #15
0
        public MB(Main game)
            : base(game)
        {
            Order = 1;

            config = new MBConfig();
        }
Beispiel #16
0
 public CustomJoin(Main game)
     : base(game)
 {
     Order = -10;
     cfg = new cjConfig();
     LastJoinIndex = -1;
 }
Beispiel #17
0
        public BH(Main game)
            : base(game)
        {
            Order = -1;

            config = new BHConfig();
        }
Beispiel #18
0
 public TeamSpawn(Main game)
     : base(game)
 {
     config = Config.Read(savepath);
     config.Write(savepath);
     deadplayers = new Dictionary<int,int>(255);
 }
Beispiel #19
0
 public static void Initialize(Main main)
 {
     if (!Directory.Exists("ServerPlugins"))
     {
         Directory.CreateDirectory("ServerPlugins");
     }
     AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(Program.CurrentDomain_AssemblyResolve);
     FileInfo[] files = new DirectoryInfo("ServerPlugins").GetFiles("*.dll");
     for (int i = 0; i < files.Length; i++)
     {
         FileInfo fileInfo = files[i];
         try
         {
             string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(fileInfo.Name);
             Assembly assembly;
             if (!Program.LoadedAssemblies.TryGetValue(fileNameWithoutExtension, out assembly))
             {
                 assembly = Assembly.Load(File.ReadAllBytes(fileInfo.FullName));
                 Program.LoadedAssemblies.Add(fileNameWithoutExtension, assembly);
             }
             Type[] types = assembly.GetTypes();
             for (int j = 0; j < types.Length; j++)
             {
                 Type type = types[j];
                 if (type.BaseType == typeof(TerrariaPlugin))
                 {
                     if (Program.Compatible(type))
                     {
                         Program.Plugins.Add(new PluginContainer((TerrariaPlugin)Activator.CreateInstance(type, new object[]
                         {
                             main
                         })));
                     }
                     else
                     {
                         Console.WriteLine("Outdated plugin: {0} ({1})", fileInfo.Name, type);
                     }
                 }
             }
         }
         catch (Exception innerException)
         {
             if (innerException is TargetInvocationException)
             {
                 innerException = ((TargetInvocationException)innerException).InnerException;
             }
             Console.WriteLine("Plugin {0} failed to load", fileInfo.Name);
         }
     }
     IOrderedEnumerable<PluginContainer> orderedEnumerable =
         from x in Program.Plugins
         orderby x.Plugin.Order, x.Plugin.Name
         select x;
     foreach (PluginContainer current in orderedEnumerable)
     {
         current.Initialize();
         Console.WriteLine("{0} v{1} ({2}) initiated.", current.Plugin.Name, current.Plugin.Version, current.Plugin.Author);
     }
 }
Beispiel #20
0
 public MazesPlugin(Main game)
     : base(game)
 {
     for (int i = 0; i < 256; i++)
     {
         Players[i] = new PlayerInfo();
     }
 }
Beispiel #21
0
        public Maincs(Main game)
            : base(game)
        {
            Order = 100;

            config = new Config();
            rConfig = new rConfig();
        }
Beispiel #22
0
 public ShortCommands(Main game)
     : base(game)
 {
     Order = -5;
     getConfig = new scConfig();
     scPlayers = new List<scPlayer>();
     offlineCooldowns = new Dictionary<string, Dictionary<string, DateTime>>();
 }
Beispiel #23
0
 private void UpdateRaceMenu(On.Terraria.Main.orig_DoUpdate orig, Terraria.Main self, GameTime gameTime)
 {
     if (raceMenuUI != null)
     {
         raceMenuUI.Update(gameTime);
     }
     orig(self, gameTime);
 }
Beispiel #24
0
 public WorldEdit(Main game)
     : base(game)
 {
     for (int i = 0; i < 256; i++)
     {
         Players[i] = new PlayerInfo();
     }
 }
 /* The constructor for your main class.  Make sure it has an argument of Main ( you can call it whatever you want )
  * And make sure you pass it to the parent using " : base()"
  */
 public Bunnies(Main game)
     : base(game)
 {
     /*TShock by default runs at order 0.  If you wish to load before tshock ( for overriding tshock handlers )
      * set Order to a negative number.  If you want to wait til tshock has finished loading, set Order > 0
      */
     Order = 4;
 }
        public CommandRecipes(Main game)
            : base(game)
        {
            Order = -10;

              config = new RecConfig();
              Log = new RecipeLog();
        }
Beispiel #27
0
 public RecursiveMain(Main game)
     : base(game)
 {
     players = new bool[255];
     for( int i = 0; i < players.Length; i++ )
     {
         players[i] = false;
     }
 }
Beispiel #28
0
        public TSDocs(Main game)
            : base(game)
        {
            Order = -15;

            getConfig = new TSConfig();

            SavePath = Path.Combine(TShockAPI.TShock.SavePath, "TSDocs");
        }
Beispiel #29
0
 public SuperPick(Main game)
     : base(game)
 {
     players = new bool[byte.MaxValue];
     for( int i = 0; i < players.Length; i++ )
     {
         players[i] = false;
     }
 }
 public InfiniteChests(Main game)
     : base(game)
 {
     for (int i = 0; i < 256; i++)
     {
         Infos[i] = new PlayerInfo();
     }
     Order = -1;
 }
 public Essentials(Main game)
     : base(game)
 {
     this.Order = -1;
     this.LastCheck = DateTime.UtcNow;
     this.Disabled = new Dictionary<string, int[]>();
     this.esPlayers = new esPlayer[256];
     Essentials.getConfig = new esConfig();
 }
Beispiel #32
0
 public RegionFlags( Main game )
     : base(game)
 {
     Order = 3;
     regions = new FlaggedRegionManager();
     players = new RegionPlayer[255];
     npchooks = new NPCHooks( regions );
     playerhooks = new PlayerHooks( regions );
 }
Beispiel #33
0
        private static void Main_DoUpdate(On.Terraria.Main.orig_DoUpdate orig, Terraria.Main self, GameTime gameTime)
        {
            orig(self, gameTime);

            if (_activeEvents != null)
            {
                // update cutscene
                Update(gameTime);
            }
        }
        private void drawVitricBackground(On.Terraria.Main.orig_DrawBackgroundBlackFill orig, Terraria.Main self)
        {
            orig(self);
            Player player = Main.LocalPlayer;

            VitricBackgroundDust.ForEach(BootlegDust => BootlegDust.Update());
            VitricBackgroundDust.RemoveAll(BootlegDust => BootlegDust.time <= 0);

            VitricForegroundDust.ForEach(BootlegDust => BootlegDust.Update());
            VitricForegroundDust.RemoveAll(BootlegDust => BootlegDust.time <= 0);

            if (Main.playerLoaded && player.GetModPlayer <BiomeHandler>().ZoneGlass)
            {
                Vector2 basepoint = (LegendWorld.vitricTopLeft != null) ? LegendWorld.vitricTopLeft * 16 + new Vector2(-2000, 1000) : Vector2.Zero;
                for (int k = 5; k >= 0; k--)
                {
                    drawLayer(basepoint, ModContent.GetTexture("StarlightRiver/Backgrounds/Glass" + k), k + 1);
                    if (k == 5)
                    {
                        VitricBackgroundDust.ForEach(BootlegDust => BootlegDust.Draw(Main.spriteBatch));
                    }
                    if (k == 2)
                    {
                        VitricForegroundDust.ForEach(BootlegDust => BootlegDust.Draw(Main.spriteBatch));
                    }
                }

                for (int k = (int)(player.position.X - basepoint.X) - (int)(Main.screenWidth * 1.5f); k <= (int)(player.position.X - basepoint.X) + (int)(Main.screenWidth * 1.5f); k += 30)
                {
                    if (Main.rand.Next(500) == 0)
                    {
                        BootlegDust dus = new VitricDust(ModContent.GetTexture("StarlightRiver/GUI/Light"), basepoint + new Vector2(-2000, 1000), k, 1.5f, 0.3f, 0.1f);
                        VitricBackgroundDust.Add(dus);
                    }

                    if (Main.rand.Next(400) == 0)
                    {
                        BootlegDust dus2 = new VitricDust(ModContent.GetTexture("StarlightRiver/GUI/Light"), basepoint + new Vector2(-2000, 1000), k, 2.25f, 1f, 0.4f);
                        VitricForegroundDust.Add(dus2);
                    }
                }

                for (int i = -2 + (int)(player.position.X - Main.screenWidth / 2) / 16; i <= 2 + (int)(player.position.X + Main.screenWidth / 2) / 16; i++)
                {
                    for (int j = -2 + (int)(player.position.Y - Main.screenHeight) / 16; j <= 2 + (int)(player.position.Y + Main.screenHeight) / 16; j++)
                    {
                        if (Lighting.Brightness(i, j) == 0 || ((Main.tile[i, j].active() && Main.tile[i, j].collisionType == 1) || Main.tile[i, j].wall != 0))
                        {
                            Color color = Color.Black * (1 - Lighting.Brightness(i, j) * 2);
                            Main.spriteBatch.Draw(Main.blackTileTexture, new Vector2(i * 16, j * 16) - Main.screenPosition, color);
                        }
                        else if (i % 4 == 0 && j % 4 == 0 && Main.tile[i, j].wall == 0)
                        {
                            Lighting.AddLight(new Vector2(i * 16, j * 16), new Vector3(0.3f, 0.35f, 0.4f) * 2.1f);
                        }
                    }
                }
            }
        }
Beispiel #35
0
 public ExtendedAdmin(Terraria.Main game) :
     base(game)
 {
     Config = new ExtendedAdminConfig();
 }
 public EnglishPloxPlugin(Terraria.Main game)
     : base(game)
 {
 }