static void OnNetMessageReceived(ref HookContext ctx, ref HookArgs.ReceiveNetMessage args)
        {
            if (Terraria.Main.ServerSideCharacter)
            {
                switch ((Packet)args.PacketId)
                {
                case Packet.INVENTORY_DATA:
                    if (!AllowGuestInfo && !ctx.Player.IsAuthenticated())
                    {
                        ctx.SetResult(HookResult.IGNORE);
                    }
                    break;

                case Packet.PLAYER_MANA_UPDATE:
                    if (!AllowGuestInfo && !ctx.Player.IsAuthenticated())
                    {
                        ctx.SetResult(HookResult.IGNORE);
                    }
                    break;

                case Packet.PLAYER_HEALTH_UPDATE:
                    if (!AllowGuestInfo && !ctx.Player.IsAuthenticated())
                    {
                        ctx.SetResult(HookResult.IGNORE);
                    }
                    break;
                }
            }
        }
        void OnNPCHurt(ref HookContext ctx, ref HookArgs.NpcHurt args)
        {
            if ((!restrictGuests) || (!restrictGuestsNPCs))
            {
                return;
            }

            var player = ctx.Player;

            if (player == null)
            {
                return;
            }

            if (player.AuthenticatedAs == null)
            {
                ctx.SetResult(HookResult.IGNORE);
                player.sendMessage("<Restrict> You are not allowed to hurt NPCs as a guest.");
                player.sendMessage("<Restrict> Type \"/reg password\" to request registration.");
            }
            else if (IsRestrictedForUser(ctx.Player, NpcHurt))
            {
                ctx.SetResult(HookResult.IGNORE);
                player.sendMessage("<Restrict> You are not allowed to hurt NPCs without permissions.");
            }
        }
        void OnSignTextSet(ref HookContext ctx, ref HookArgs.SignTextSet args)
        {
            var player = ctx.Player;

            if (player == null || player.Name == null)
            {
                ProgramLog.Log("<Restrict> Invalid player in OnSignTextSet.");
                ctx.SetResult(HookResult.IGNORE);
                return;
            }

            if (!restrictGuests)
            {
                return;
            }

            if (player.AuthenticatedAs == null)
            {
                ctx.SetResult(HookResult.IGNORE);
                player.sendMessage("<Restrict> You are not allowed to edit signs as a guest.");
                player.sendMessage("<Restrict> Type \"/reg password\" to request registration.");
            }
            else if (IsRestrictedForUser(ctx.Player, SignEdit))
            {
                ctx.SetResult(HookResult.IGNORE);
                player.sendMessage("<Restrict> You are not allowed to edit signs without permissions.");
            }
        }
        void OnLiquidFlow(ref HookContext ctx, ref HookArgs.LiquidFlowReceived args)
        {
            var player = ctx.Player;

            if (player == null || player.Name == null)
            {
                ProgramLog.Log("<Restrict> Invalid player in OnLiquidFlow.");
                ctx.SetResult(HookResult.IGNORE);
                return;
            }

            if (!restrictGuests)
            {
                return;
            }

            if (player.AuthenticatedAs == null)
            {
                ctx.SetResult(HookResult.RECTIFY);
                player.sendMessage("<Restrict> You are not allowed to alter the world as a guest.");
                player.sendMessage("<Restrict> Type \"/reg password\" to request registration.");
            }
            else if (IsRestrictedForUser(ctx.Player, LiquidFlow))
            {
                ctx.SetResult(HookResult.RECTIFY);
                player.sendMessage("<Restrict> You are not allowed to alter the world without permissions.");
            }
        }
        void OnAlter(ref HookContext ctx, ref HookArgs.PlayerWorldAlteration args)
        {
            var player = ctx.Player;

            if (player == null && ctx.Sender is Projectile)
            {
                player = (ctx.Sender as Projectile).Creator as Player;
            }

            if (player == null || player.Name == null)
            {
                ProgramLog.Error.Log("<Restrict> Invalid player in OnAlter.");
                ctx.SetResult(HookResult.IGNORE);
                return;
            }

            if (!restrictGuests)
            {
                return;
            }

            if (player.AuthenticatedAs == null)
            {
                ctx.SetResult(HookResult.RECTIFY);
                player.sendMessage("<Restrict> You are not allowed to alter the world as a guest.");
                player.sendMessage("<Restrict> Type \"/reg password\" to request registration.");
            }
            else if (IsRestrictedForUser(ctx.Player, WorldAlter))
            {
                ctx.SetResult(HookResult.RECTIFY);
                player.sendMessage("<Restrict> You are not allowed to alter the world without permissions.");
            }
        }
Example #6
0
 void OnDoorStateChange(ref HookContext ctx, ref HookArgs.DoorStateChanged args)
 {
     foreach (Region rgn in regionManager.Regions)
     {
         if (rgn.HasPoint(new Vector2(args.X, args.Y)))
         {
             if (ctx.Sender is Player)
             {
                 Player player = ctx.Sender as Player;
                 if (IsRestrictedForUser(player, rgn, DoorChange))
                 {
                     ctx.SetResult(HookResult.RECTIFY);
                     player.sendMessage("You cannot edit this area!", ChatColor.Red);
                     return;
                 }
             }
             else if (ctx.Sender is NPC)
             {
                 if (rgn.RestrictedNPCs)
                 {
                     ctx.SetResult(HookResult.RECTIFY);     //[TODO] look into RECIFYing for NPC's, They don't need to be resent, only cancelled, IGRNORE?
                     return;
                 }
             }
         }
     }
 }
        void OnDoorStateChanged(ref HookContext ctx, ref HookArgs.DoorStateChanged args)
        {
            if ((!restrictGuests) || (!restrictGuestsDoors))
            {
                return;
            }

            var player = ctx.Player;

            if (player == null)
            {
                return;
            }

            if (player.AuthenticatedAs == null)
            {
                ctx.SetResult(HookResult.RECTIFY);
                player.sendMessage("<Restrict> You are not allowed to open and close doors as a guest.");
                player.sendMessage("<Restrict> Type \"/reg password\" to request registration.");
            }
            else if (IsRestrictedForUser(ctx.Player, DoorChange))
            {
                ctx.SetResult(HookResult.RECTIFY);
                player.sendMessage("<Restrict> You are not allowed to open and close doors without permissions.");
            }
        }
        void OnProjectile(ref HookContext ctx, ref HookArgs.ProjectileReceived args)
        {
            var player = ctx.Player;

            if (player == null && ctx.Sender is Projectile)
            {
                player = (ctx.Sender as Projectile).Creator as Player;
            }

            if (player == null || player.Name == null)
            {
                ProgramLog.Error.Log("<Restrict> Invalid player in OnProjectile.");
                ctx.SetResult(HookResult.IGNORE);
                return;
            }

            if (!restrictGuests)
            {
                return;
            }

            //if (player.AuthenticatedAs == null)
            {
                switch (args.Type)
                {
                case ProjectileType.N10_PURIFICATION_POWDER:
                case ProjectileType.N11_VILE_POWDER:
                case ProjectileType.N28_BOMB:
                case ProjectileType.N37_STICKY_BOMB:
                case ProjectileType.N29_DYNAMITE:
                case ProjectileType.N30_GRENADE:
                case ProjectileType.N31_SAND_BALL:
                case ProjectileType.N39_MUD_BALL:
                case ProjectileType.N40_ASH_BALL:
                case ProjectileType.N42_SAND_BALL:
                case ProjectileType.N43_TOMBSTONE:
                case ProjectileType.N50_GLOWSTICK:
                case ProjectileType.N53_STICKY_GLOWSTICK:
                    ctx.SetResult(HookResult.ERASE);
                    if (player.AuthenticatedAs == null)
                    {
                        player.sendMessage("<Restrict> You are not allowed to use this projectile as a guest.");
                        player.sendMessage("<Restrict> Type \"/reg password\" to request registration.");
                    }
                    else if (IsRestrictedForUser(ctx.Player, ProjectileUse))
                    {
                        player.sendMessage("<Restrict> You are not allowed to use this projectile without permissions.");
                    }

                    return;

                default:
                    break;
                }
            }

            return;
        }
        void OnChat(ref HookContext ctx, ref HookArgs.PlayerChat args)
        {
            if (ctx.Player.AuthenticatedAs != null)
            {
                User usr;
                if (Permissions.users.TryGetValue(ctx.Player.Name, out usr))
                {
                    Color col;
                    if (Chat.TryGetChatColor(usr, out col))
                    {
                        args.Color = col;
                    }

                    string prefix;
                    if (Chat.TryGetChatPrefix(usr, out prefix))
                    {
                        usr.prefix = prefix;
                    }

                    string suffix;
                    if (Chat.TryGetChatSuffix(usr, out suffix))
                    {
                        usr.suffix = suffix;
                    }

                    string seperator;
                    Chat.TryGetChatSeperator(usr, out seperator);

                    ctx.SetResult(HookResult.IGNORE);
                    Server.notifyAll(
                        String.Concat(usr.prefix, ctx.Player.Name, seperator, args.Message, usr.suffix)
                        , args.Color
                        );
                }
            }
            else if (ctx.Player.AuthenticatedAs == null)
            {
                Group dGrp = Permissions.GetDefaultGroup();
                if (dGrp != null)
                {
                    if (Chat.IsValidColor(dGrp.GroupInfo.color))
                    {
                        args.Color = dGrp.GroupInfo.color;
                    }

                    ctx.SetResult(HookResult.IGNORE);
                    Server.notifyAll(
                        String.Concat(dGrp.GroupInfo.Prefix, ctx.Player.Name,
                                      dGrp.GroupInfo.Seperator, args.Message,
                                      dGrp.GroupInfo.Suffix)
                        , args.Color
                        );
                }
            }
        }
        void OnPlayerDataReceived(ref HookContext ctx, ref HookArgs.PlayerDataReceived args)
        {
            ctx.SetKick("Malfunction during login process, try again.");

            if (!args.NameChecked)
            {
                string error;
                if (!args.CheckName(out error))
                {
                    ctx.SetKick(error);
                    return;
                }
            }

            var player = ctx.Player;

            if (player == null)
            {
                ProgramLog.Error.Log("Null player passed to Restrict.OnPlayerDataReceived.");
                return;
            }

            var    name  = args.Name;
            var    pname = NameTransform(name);
            var    oname = OldNameTransform(name);
            string entry = null;

            lock (users)
            {
                entry = users.getValue(pname) ?? users.getValue(oname);
            }

            if (entry == null)
            {
                if (allowGuests)
                {
                    ctx.SetResult(HookResult.DEFAULT);
                    player.AuthenticatedAs      = null;
                    ctx.Connection.DesiredQueue = 0;                     //(int)LoginPriority.QUEUE_LOW_PRIO;

                    ProgramLog.Log("<Restrict> Letting user {0} from {1} in as guest.", name, player.IPAddress);
                }
                else
                {
                    ProgramLog.Log("<Restrict> Unregistered user {0} from {1} attempted to connect.", name, player.IPAddress);
                    ctx.SetKick("Only registered users are allowed.");
                    return;
                }
                return;
            }

            ProgramLog.Log("<Restrict> Expecting password for user {0} from {1}.", name, player.IPAddress);
            ctx.SetResult(HookResult.ASK_PASS);
        }
Example #11
0
 void OnNPCSpawned(ref HookContext ctx, ref HookArgs.NPCSpawn args)
 {
     if (StopNPCSpawning)
     {
         ctx.SetResult(HookResult.IGNORE);
     }
 }
Example #12
0
        public static void OnUnkownPacketSend(ref HookContext ctx, ref HookArgs.UnkownSendPacket args)
        {
            switch (args.PacketId)
            {
            case (int)Packets.CLIENT_MOD_GOD:
            {
                NetMessageExtension msg = new NetMessageExtension();

                if (args.RemoteClient != -1)
                {
                    var player = Main.players[args.RemoteClient];

                    if (player.HasClientMod)
                    {
                        if (Server.AllowTDCMRPG)
                        {
                            Server.notifyOps(
                                String.Format("Failed attempt to {0} God Mode on an RPG Server.", true, (args.Number == 1) ? "give" : "remove"));
                            return;
                        }

                        Server.notifyOps(
                            String.Format("{0} {1} God Mode.", true, player.Name, (args.Number == 1) ? "has" : "doesn't have"));

                        msg.GodTDCMClient(args.Number == 1);
                        args.Message = msg;
                        ctx.SetResult(HookResult.IGNORE);         //Let TDSM know it's to ignore returning.
                    }
                }
                break;
            }
            }
        }
        public static bool OnGreetPlayer(int playerId)
        {
            #if Full_API
            var player = Main.player[playerId];

            var ctx = new HookContext
            {
                Connection = player.Connection.Socket,
                Player     = player,
                Sender     = player
            };

            var args = new HookArgs.PlayerPreGreeting
            {
                Slot       = playerId,
                Motd       = String.IsNullOrEmpty(Main.motd) ? (Lang.mp[18] + " " + Main.worldName) : Main.motd,
                MotdColour = new Microsoft.Xna.Framework.Color(255, 240, 20)
            };

            HookPoints.PlayerPreGreeting.Invoke(ref ctx, ref args);

            if (ctx.CheckForKick())
            {
                return(false);
            }

            player.SendMessage(args.Motd, 255, args.MotdColour.R, args.MotdColour.G, args.MotdColour.B);

            string list = "";
            for (int i = 0; i < 255; i++)
            {
                if (Main.player[i].active)
                {
                    if (list == "")
                    {
                        list += Main.player[i].name;
                    }
                    else
                    {
                        list = list + ", " + Main.player[i].Name;
                    }
                }
            }

            player.SendMessage("Current players: " + list + ".", 255, 255, 240, 20);

            Tools.WriteLine("{0} @ {1}: ENTER {2}", Netplay.Clients[playerId].Socket.GetRemoteAddress(), playerId, player.name);

            var args2 = new HookArgs.PlayerEnteredGame
            {
                Slot = playerId
            };

            ctx.SetResult(HookResult.DEFAULT, false);
            HookPoints.PlayerEnteredGame.Invoke(ref ctx, ref args2);
            ctx.CheckForKick();
            #endif

            return(false); //We implemented our own, so do not continue on with vanilla
        }
Example #14
0
        void OnGreetPlayer(ref HookContext ctx, ref HookArgs.PlayerPreGreeting args)
        {
            ctx.SetResult(HookResult.IGNORE);
            var lines = args.Motd.Split(new string[] { "\\0" }, StringSplitOptions.None);

            foreach (var line in lines)
            {
                ctx.Player.SendMessage(line, 255, 0, 0, 255);
            }

            string list = "";

            for (int i = 0; i < 255; i++)
            {
                if (Main.player[i].active)
                {
                    if (list == "")
                    {
                        list += Main.player[i].name;
                    }
                    else
                    {
                        list = list + ", " + Main.player[i].name;
                    }
                }
            }

            ctx.Player.SendMessage("Current players: " + list + ".", 255, 255, 240, 20);
        }
Example #15
0
        //Late so other plugins can perform alterations
        void OnPlayerKilled(ref HookContext ctx, ref HookArgs.PlayerKilled args)
        {
            if (_likeABoss)
            {
                if (Terraria.Main.rand == null)
                {
                    Terraria.Main.rand = new Random();
                }

                if (ctx.Player.talkNPC > -1 && Terraria.Main.rand.Next(_labDeathMessages.Count - 1) == 1)
                {
                    args.DeathText = " was too busy talking";
                }
                //                else if (Terraria.Main.rand.Next(_labDeathMessages.Count - 1) == 1)
                //                {
                //
                //                }
                // forgot [NPC]'s birthday
                // tried to hit on [NPC]

                else
                {
                    args.DeathText = _labDeathMessages.Next();
                }
                args.DeathText = ctx.Player.name + args.DeathText;
                ctx.SetResult(HookResult.CONTINUE);
                Loggers.Death.Log(args.DeathText);
            }
            else
            {
                //Standard death log
                Loggers.Death.Log(ctx.Player.name + args.DeathText);
            }
        }
Example #16
0
 void OnReceiveProjectile(ref HookContext ctx, ref HookArgs.ProjectileReceived args)
 {
     if (!explosivesAllowed && args.Type.IsExplosive())
     {
         Log("Cancelled Explosive usage of Player: " + ctx.Player.Name);
         ctx.SetResult(HookResult.ERASE);
     }
 }
 /// <summary>
 /// Handles the connection state when receiving a packet
 /// </summary>
 public static void CheckState(ref HookContext ctx, ref HookArgs.CheckBufferState args)
 {
     if (Terraria.Netplay.Clients[args.BufferId].State == (int)ConnectionState.AwaitingUserPassword)
     {
         //Since this is a custom state, we accept it [true to kick the connection, false to accept]
         ctx.SetResult(HookResult.RECTIFY, true, false /* TODO validate packets */);
     }
 }
Example #18
0
 void OnPlayerWorldAlteration(ref HookContext ctx, ref HookArgs.PlayerWorldAlteration args)
 {
     if (!tileBreakageAllowed)
     {
         return;
     }
     Log("Cancelled Tile change of Player: " + ctx.Player.Name);
     ctx.SetResult(HookResult.RECTIFY);
 }
Example #19
0
        void OnChat(ref HookContext ctx, ref HookArgs.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);

                UserInput.CommandParser.ParsePlayerCommand(ctx.Player, args.Message);
            }
        }
Example #20
0
        void OnPlayerWorldAlteration(ref HookContext ctx, ref HookArgs.PlayerWorldAlteration args)
        {
            Vector2 Position = new Vector2(args.X, args.Y);

            if (args.TileWasPlaced && args.Type == SelectorItem && selection.isInSelectionlist(ctx.Player) && ctx.Player.Op)
            {
                ctx.SetResult(HookResult.RECTIFY);
                SelectorPos = !SelectorPos;

                Vector2[] mousePoints = selection.GetSelection(ctx.Player);

                if (!SelectorPos)
                {
                    mousePoints[0] = Position;
                }
                else
                {
                    mousePoints[1] = Position;
                }

                selection.SetSelection(ctx.Player, mousePoints);

                ctx.Player.sendMessage(String.Format("You have selected block at {0},{1}, {2} position",
                                                     Position.X, Position.Y, (!SelectorPos) ? "First" : "Second"), ChatColor.Green);
                return;
            }

            foreach (Region rgn in regionManager.Regions)
            {
                if (rgn.HasPoint(Position))
                {
                    if (IsRestrictedForUser(ctx.Player, rgn, ((args.TileWasRemoved || args.WallWasRemoved) ? TileBreak : TilePlace)))
                    {
                        ctx.SetResult(WorldAlter);
                        ctx.Player.sendMessage("You cannot edit this area!", ChatColor.Red);
                        return;
                    }
                }
            }
        }
Example #21
0
        void OnServerStateChange(ref HookContext ctx, ref HookArgs.ServerStateChange args)
        {
            ProgramLog.Log("Server state changed to: " + args.ServerChangeState.ToString());

            if (args.ServerChangeState == ServerState.Initialising)
            {
                if (!String.IsNullOrEmpty(RConBindAddress))
                {
                    ProgramLog.Log("Starting RCON Server");
                    RemoteConsole.RConServer.Start(Path.Combine(Globals.DataPath, "rcon_logins.properties"));
                }
            }
            if (args.ServerChangeState == ServerState.Stopping)
            {
                RemoteConsole.RConServer.Stop();
            }

            //if (args.ServerChangeState == ServerState.Initialising)
#if TDSMServer
            if (!Server.IsInitialised)
            {
                Server.Init();

                if (!String.IsNullOrEmpty(RConBindAddress))
                {
                    ProgramLog.Log("Starting RCON Server");
                    RemoteConsole.RConServer.Start(Path.Combine(Globals.DataPath, "rcon_logins.properties"));
                }

                if (!String.IsNullOrEmpty(_webServerAddress))
                {
                    ProgramLog.Log("Starting Web Server");
                    WebInterface.WebServer.Begin(_webServerAddress, _webServerProvider);

                    AddCommand("webauth")
                    .WithAccessLevel(AccessLevel.OP)
                    .Calls(WebInterface.WebServer.WebAuthCommand);
                }
            }

            if (args.ServerChangeState == ServerState.Stopping)
            {
                RemoteConsole.RConServer.Stop();
                WebInterface.WebServer.End();
                //if (properties != null && File.Exists(properties.PIDFile.Trim()))
                //File.Delete(properties.PIDFile.Trim());
            }

            ctx.SetResult(HookResult.IGNORE); //Don't continue on with vanilla code
#endif
        }
 void OnReceiveProjectile(ref HookContext ctx, ref HookArgs.ProjectileReceived args)
 {
     if (!explosivesAllowed)
     {
         int type = (int)args.Type;
         if (type == (int)ProjectileType.N28_BOMB /* 28 */ ||
             type == (int)ProjectileType.N29_DYNAMITE /* 29 */ ||
             type == (int)ProjectileType.N37_STICKY_BOMB /* 37 */)
         {
             Log("Cancelled Explosive usage of Player: " + ctx.Player.Name);
             ctx.SetResult(HookResult.ERASE);
         }
     }
 }
Example #23
0
        void OnDefaultServerStart(ref HookContext ctx, ref HookArgs.StartDefaultServer args)
        {
            if (RunServerCore)
            {
                ProgramLog.Log("Starting TDSM's slot server...");
                ctx.SetResult(HookResult.IGNORE);

                ServerCore.Server.StartServer();
            }
            else
            {
                ProgramLog.Log("Vanilla only specified, continuing on with Re-Logic code...");
            }
        }
 /// <summary>
 /// Handles packets received from OTA
 /// </summary>
 public static void HandlePacket(ref HookContext ctx, ref HookArgs.ReceiveNetMessage args)
 {
     if (_packetHandlers != null)
     {
         if (_packetHandlers[args.PacketId] != null)
         {
             if (_packetHandlers[args.PacketId].Read(args.BufferId, args.Start, args.Length))
             {
                 //Packet informed us that it was read, let OTA know we consumed the packet
                 ctx.SetResult(HookResult.IGNORE, true);
             }
         }
     }
 }
Example #25
0
        void OnLiquidFlowReceived(ref HookContext ctx, ref HookArgs.LiquidFlowReceived args)
        {
            Vector2 Position = new Vector2(args.X, args.Y);

            foreach (Region rgn in regionManager.Regions)
            {
                if (rgn.HasPoint(Position))
                {
                    if (IsRestrictedForUser(ctx.Player, rgn, LiquidFlow))
                    {
                        ctx.SetResult(HookResult.ERASE);
                        ctx.Player.sendMessage("You cannot edit this area!", ChatColor.Red);
                        return;
                    }
                }
            }
        }
Example #26
0
 void OnChestOpen(ref HookContext ctx, ref HookArgs.ChestOpenReceived args)
 {
     foreach (Region rgn in regionManager.Regions)
     {
         if (rgn.HasPoint(new Vector2(args.X, args.Y)))
         {
             if (ctx.Sender is Player)
             {
                 if (IsRestrictedForUser(ctx.Player, rgn, DoorChange))
                 {
                     ctx.SetResult(HookResult.RECTIFY);
                     ctx.Player.sendMessage("You cannot edit this object!", ChatColor.Red);
                     return;
                 }
             }
         }
     }
 }
Example #27
0
 void OnSignEdit(ref HookContext ctx, ref HookArgs.SignTextSet args)
 {
     foreach (Region rgn in regionManager.Regions)
     {
         if (rgn.HasPoint(new Vector2(args.X, args.Y)))
         {
             if (ctx.Sender is Player)
             {
                 if (IsRestrictedForUser(ctx.Player, rgn, DoorChange))
                 {
                     ctx.SetResult(HookResult.IGNORE);
                     ctx.Player.sendMessage("You cannot edit this area!", ChatColor.Red);
                     return;
                 }
             }
         }
     }
 }
        public static void OnPlayerLeave(Player player)
        {
            #if Full_API
            var ctx = new HookContext
            {
                Player = player,
                Sender = player
            };

            var args = new HookArgs.PlayerLeftGame
            {
                Slot = player.whoAmI
            };

            ctx.SetResult(HookResult.DEFAULT, false);
            HookPoints.PlayerLeftGame.Invoke(ref ctx, ref args);
            #endif
        }
Example #29
0
        public static void OnPlayerJoined(Player player)
        {
            var ctx = new HookContext
            {
                Connection = player.Connection,
                Player     = player,
                Sender     = player
            };

            var args = new HookArgs.PlayerEnteredGame
            {
                Slot = player.whoAmI
            };

            ctx.SetResult(HookResult.DEFAULT, false);
            HookPoints.PlayerEnteredGame.Invoke(ref ctx, ref args);
            ctx.CheckForKick();
        }
        void OnInvasionWarning(ref HookContext ctx, ref HookArgs.InvasionWarning args)
        {
            if (Main.invasionType == Core._assignedInvasionType && Core._invasion != null)
            {
                if (Main.invasionSize > 0)
                {
                    string message = null;
                    if (Main.invasionX < (double)Main.spawnTileX)
                    {
                        //West
                        if (!Core._notfInbound)
                        {
                            Core._notfInbound = true;
                            message           = "An invasion is approaching from the west!";
                        }
                    }
                    else if (Main.invasionX > (double)Main.spawnTileX)
                    {
                        //East
                        if (!Core._notfInbound)
                        {
                            Core._notfInbound = true;
                            message           = "An invasion is approaching from the east!";
                        }
                    }
                    else
                    {
                        //Arrived
                        message = "The invasion has arrived!";
                    }

                    if (null != message)
                    {
                        NetMessage.SendData(25, -1, -1, message, 255, 175f, 75f, 255f);
                    }
                }

                ctx.SetResult(HookResult.IGNORE);
            }
        }