Ejemplo n.º 1
0
        internal bool InvokeNetGreetPlayer(int who)
        {
            GreetPlayerEventArgs args = new GreetPlayerEventArgs
            {
                Who = who
            };

            this.NetGreetPlayer.Invoke(args);

            return(args.Handled);
        }
Ejemplo n.º 2
0
 private static void OnGreet(GreetPlayerEventArgs args)
 {
     if (TShock.Players[args.Who] != null)
     {
         if (config.AutoStartEnabled)
             if (TShock.Utils.ActivePlayers() == 1)
             {
                 Tools.ReloadConfig(true);
                 var day = config.BossToggles["day"];
                 var night = config.BossToggles["night"];
                 var special = config.BossToggles["special"];
                 Tools.bossesToggled = true;
                 Timers.StartBosses(day, night, special, true);
             }
     }
 }
Ejemplo n.º 3
0
 public void onGreetPlayer(GreetPlayerEventArgs e)
 {
     try
     {
         dPlayers[e.Who] = new dPlayer(e.Who);
     }
     catch { }
 }
Ejemplo n.º 4
0
        private void OnGreet(GreetPlayerEventArgs args)
        {
            if (TShock.Players[args.Who] == null)
                return;

            if (!TShock.Players[args.Who].IsLoggedIn)
                return;

            int id = TShock.Players[args.Who].User.ID;

            if (!indexid.ContainsKey(args.Who))
                indexid.Add(args.Who, id);

            if (players.ContainsKey(id))
            {
                if (!players[id].hasGreeted)
                {
                    players[id].Greet(args.Who);
                }

                players[id].pastGreet = true;
            }
        }
Ejemplo n.º 5
0
 void OnGreetPlayer(GreetPlayerEventArgs e)
 {
     if (!IrcClient.IsConnected)
         Connect();
     else
     {
         TSPlayer tsplr = TShock.Players[e.Who];
         if (!String.IsNullOrEmpty(Config.ServerJoinMessageFormat))
             SendMessage(Config.Channel, String.Format(Config.ServerJoinMessageFormat, tsplr.Name));
         if (!String.IsNullOrEmpty(Config.ServerJoinAdminMessageFormat))
             SendMessage(Config.AdminChannel, String.Format(Config.ServerJoinAdminMessageFormat, tsplr.Name, tsplr.IP));
     }
 }
Ejemplo n.º 6
0
		internal bool InvokeNetGreetPlayer(int who)
		{
			GreetPlayerEventArgs args = new GreetPlayerEventArgs
			{
				Who = who
			};

			this.NetGreetPlayer.Invoke(args);
			
			return args.Handled;
		}
Ejemplo n.º 7
0
        internal void OnGreetPlayer(GreetPlayerEventArgs args)
        {
            lock (C3Players)
                C3Players.Add(new C3Player(args.Who));

            if(C3Config.ShowWelcomeMessage)
                TShock.Players[args.Who].SendMessage("This server is running C3Mod, created by Twitchy. C3Mod is now open source.", Color.Cyan);
        }
Ejemplo n.º 8
0
        private static void OnGreet(GreetPlayerEventArgs args)
        {
            if (TShock.Players[args.Who] != null)
            {
                if (config.AutoStartEnabled && TShock.Utils.ActivePlayers() == 1)
                {
                    Tools.ReloadConfig(true);
                    var day = config.BossToggles[BattleType.Day];
                    var night = config.BossToggles[BattleType.Night];
                    var special = config.BossToggles[BattleType.Special];
                    Tools.bossesToggled = true;
                    Timers.StartBosses(day, night, special, true);

                    TShock.Log.ConsoleInfo("[AutoBoss+] Timer started: Autostart");
                }
            }
        }
Ejemplo n.º 9
0
        private void OnGreet(GreetPlayerEventArgs args)
        {
            BHPlayers.Add(new BHPlayer(args.Who));

            var player = TShock.Players[args.Who];
            var RecPlayer = BHPlayers.AddToList(new BHPlayer(args.Who));
        }
Ejemplo n.º 10
0
 public void OnGreetPlayer( GreetPlayerEventArgs e)
 {
     lock (HPlayers)
         HPlayers.Add(new HPlayer(e.Who, new Vector2(TShock.Players[e.Who].TileX, TShock.Players[e.Who].TileY)));
 }
Ejemplo n.º 11
0
        /// <summary>
        /// Handles greet events. 
        /// </summary>
        /// <param name="args"></param>
        private void OnGreet(GreetPlayerEventArgs args)
        {
            if (!TShock.Config.DisableUUIDLogin)
            {
                if (TShock.Players[args.Who].IsLoggedIn)
                    PostLogin(new TShockAPI.Hooks.PlayerPostLoginEventArgs(TShock.Players[args.Who]));
                else
                {
                    var player = new TrPlayer("~^" + TShock.Players[args.Who].Name, 0,
                        DateTime.UtcNow.ToString("G"), DateTime.UtcNow.ToString("G"), 0)
                        {index = args.Who, online = true};

                    Tools.Players.Add(player);
                }
            }
            else
            {
                var player = new TrPlayer("~^" + TShock.Players[args.Who].Name, 0,
                    DateTime.UtcNow.ToString("G"), DateTime.UtcNow.ToString("G"), 0)
                    {index = args.Who, online = true};

                Tools.Players.Add(player);
            }
        }
Ejemplo n.º 12
0
        private static void GreetPlayer(GreetPlayerEventArgs args)
        {
            if (TShock.Players[args.Who] == null) return;

            if (PlayerKilling.ContainsKey(TShock.Players[args.Who]))
                PlayerKilling.Remove(TShock.Players[args.Who]);

            PlayerKilling.Add(TShock.Players[args.Who], null);

            TimeCache[args.Who] = 0;

            SentDamageCache[args.Who] = new Dictionary<KillType, int>
            {
                {KillType.Mob, 0},
                {KillType.Boss, 0},
                {KillType.Player, 0}
            };

            RecvDamageCache[args.Who] = 0;
        }
Ejemplo n.º 13
0
 public void OnGreetPlayer(GreetPlayerEventArgs e)
 {
     Players[e.Who] = new Player(e.Who);
 }
Ejemplo n.º 14
0
        public void OnGreetPlayer(GreetPlayerEventArgs e)
        {
            try
            {
                Players[e.Who] = new mPlayer(e.Who);

                if (Players[e.Who].TSPlayer.Group.HasPermission("msguse"))
                {
                    string name = TShock.Players[e.Who].Name;
                    int count = GetUnreadEmailsByName(name);
                    TShock.Players[e.Who].SendMessage("You have " + count + " unread messages.", Color.Yellow);
                }

            }
            catch { }
        }
Ejemplo n.º 15
0
 private void OnGreetPlayer(GreetPlayerEventArgs args)
 {
     if (TShock.Players[args.Who].IsLoggedIn)
     {
         OnPlayerPostLogin(new PlayerPostLoginEventArgs(TShock.Players[args.Who]));
     }
 }
Ejemplo n.º 16
0
 public void OnGreetPlayer(GreetPlayerEventArgs args)
 {
     lock (Players)
         Players.Add(new Player(args.Who));
 }
Ejemplo n.º 17
0
        public void OnGreet(GreetPlayerEventArgs args)
        {
            if (sTools.GetPlayer(args.Who) == null)
            {
                sTools.splayers.Add(new sPlayer(args.Who));

                if (!TShock.Config.DisableUUIDLogin)
                    if (TShock.Players[args.Who].IsLoggedIn)
                        PostLogin(new TShockAPI.Hooks.PlayerPostLoginEventArgs(TShock.Players[args.Who]));
            }
        }
Ejemplo n.º 18
0
 private void OnGreet(GreetPlayerEventArgs args)
 {
     lock (players)
     {
         players[args.Who] = new RegionPlayer(TShock.Players[args.Who], regions);
     }
 }
Ejemplo n.º 19
0
 /// <summary>
 /// NetGreetPlayer callback.
 /// </summary>
 /// <param name="args"></param>
 private void OnNetGreetPlayer(GreetPlayerEventArgs args)
 {
     lock (this.m_AddonsLock)
     {
         this.m_Addons.ForEach(a =>
             {
                 var ret = a.Value.InvokeEvent("NetGreetPlayer", args);
                 if (ret != null && ret.Length >= 1)
                 {
                     bool result;
                     if (bool.TryParse(ret[0].ToString(), out result) && result)
                         args.Handled = true;
                 }
             });
     }
 }
Ejemplo n.º 20
0
        /// <summary>OnGreetPlayer - Fired when a player is greeted by the server. Handles things like the MOTD, join messages, etc.</summary>
        /// <param name="args">args - The GreetPlayerEventArgs object.</param>
        private void OnGreetPlayer(GreetPlayerEventArgs args)
        {
            var player = Players[args.Who];
            if (player == null)
            {
                args.Handled = true;
                return;
            }

            player.LoginMS = DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond;

            if (Config.EnableGeoIP && TShock.Geo != null)
            {
                Log.Info("{0} ({1}) from '{2}' group from '{3}' joined. ({4}/{5})", player.Name, player.IP,
                                       player.Group.Name, player.Country, TShock.Utils.ActivePlayers(),
                                       TShock.Config.MaxSlots);
                if (!player.SilentJoinInProgress)
                    Utils.Broadcast(string.Format("{0} ({1}) has joined.", player.Name, player.Country), Color.Yellow);
            }
            else
            {
                Log.Info("{0} ({1}) from '{2}' group joined. ({3}/{4})", player.Name, player.IP,
                                       player.Group.Name, TShock.Utils.ActivePlayers(), TShock.Config.MaxSlots);
                if (!player.SilentJoinInProgress)
                    Utils.Broadcast(player.Name + " has joined.", Color.Yellow);
            }

            if (Config.DisplayIPToAdmins)
                Utils.SendLogs(string.Format("{0} has joined. IP: {1}", player.Name, player.IP), Color.Blue);

            Utils.ShowFileToUser(player, "motd.txt");

            string pvpMode = Config.PvPMode.ToLowerInvariant();
            if (pvpMode == "always")
            {
                player.TPlayer.hostile = true;
                player.SendData(PacketTypes.TogglePvp, "", player.Index);
                TSPlayer.All.SendData(PacketTypes.TogglePvp, "", player.Index);
            }

            if (!player.IsLoggedIn)
            {
                if (Main.ServerSideCharacter)
                {
                    player.SendErrorMessage(
                        player.IgnoreActionsForInventory = String.Format("Server side characters is enabled! Please {0}register or {0}login to play!", Commands.Specifier));
                    player.LoginHarassed = true;
                }
                else if (Config.RequireLogin)
                {
                    player.SendErrorMessage("Please {0}register or {0}login to play!", Commands.Specifier);
                    player.LoginHarassed = true;
                }
            }

            player.LastNetPosition = new Vector2(Main.spawnTileX * 16f, Main.spawnTileY * 16f);

            if (Config.RememberLeavePos && (RememberedPos.GetLeavePos(player.Name, player.IP) != Vector2.Zero) && !player.LoginHarassed)
            {
                player.RPPending = 3;
                player.SendInfoMessage("You will be teleported to your last known location...");
            }

            args.Handled = true;
        }
Ejemplo n.º 21
0
 private static void OnGreetPlayer(GreetPlayerEventArgs args)
 {
     lock (PvPplayer)
         PvPplayer.Add(new Player(args.Who));
 }
Ejemplo n.º 22
0
        public void OnGreet(GreetPlayerEventArgs args)
        {
            if (TShock.Players[args.Who] == null)
                return;

            if (globalbuffs.Count > 0)
                TShock.Players[args.Who].SendInfoMessage("This server has the following global permabuffs active: {0}", string.Join(", ", globalbuffs.Select(p => Main.buffName[p])));

            if (!hasAnnounced.ContainsKey(args.Who))
                hasAnnounced.Add(args.Who, new List<string>());

            if (!TShock.Players[args.Who].IsLoggedIn)
                return;

            int id = TShock.Players[args.Who].User.ID;

            if (!permas.ContainsKey(id))
            {
                if (loadDBInfo(id))
                {
                    if (permas[id].bufflist.Count > 0)
                        TShock.Players[args.Who].SendInfoMessage("Your permabuffs from your previous session ({0}) are still active!", string.Join(", ", permas[id].bufflist.Select(p => TShock.Utils.GetBuffName(p))));
                }
                else
                    createDBInfo(TShock.Players[args.Who].User.ID);
            }
            else
            {
                //loadDBInfo(args.Who);
                if (permas[id].bufflist.Count > 0)
                    TShock.Players[args.Who].SendInfoMessage("Your permabuffs from your previous session ({0}) are still active!", string.Join(", ", permas[id].bufflist.Select(p => TShock.Utils.GetBuffName(p))));
            }
        }
Ejemplo n.º 23
0
 private void OnJoin(GreetPlayerEventArgs e)
 {
     if (TShock.Players[e.Who] != null)
     {
         UpdateList(e.Who);
     }
 }
Ejemplo n.º 24
0
 private void OnGreetPlayer(GreetPlayerEventArgs e)
 {
     if (getConfig.motd_enabled && TShock.Players[e.Who] != null)
     {
         ShowMOTD(TShock.Players[e.Who]);
     }
 }
Ejemplo n.º 25
0
        ///<summary>
        /// This event happens every time player really joins the server.
        ///</summary>
        ///<param name="args">Containing event data.</param>
        private void OnNetGreet(GreetPlayerEventArgs args)
        {
            var tsplr = TShock.Players[args.Who];
            string tsplr_name = tsplr.Name;
            string tsplr_user_name = tsplr.User.Name;

            if (iSettings.AKC_List.Contains(this.GetPlayerFlag(tsplr)) & (!iSettings.AKC_White_List.Contains(tsplr_name))) {
                TShock.Utils.Kick(tsplr, "You have been kicked because of region limit", true);
                ConsoleLOG("User: "******" Country Code: " + this.GetPlayerFlag(tsplr) + " Reason: Was kick because of region limit");
            } else {
                //TODO Try to use this "args.Player.RealPlayer"
                if (!this.myPlayersData.ContainsKey(tsplr.Index)) {
                    this.myPlayersData.Add(tsplr.Index, this.GetPlayerFlag(tsplr));
                } else {
                    this.myPlayersData[tsplr.Index] = this.GetPlayerFlag(tsplr);
                }
            }
        }
Ejemplo n.º 26
0
 public void OnGreet(GreetPlayerEventArgs args)
 {
     lock (Players)
         Players[args.Who] = new AFKPlayer(args.Who);
 }
Ejemplo n.º 27
0
 public void OnGreetPlayer(GreetPlayerEventArgs e)
 {
     lock (EBPlayers)
         EBPlayers.Add(new EBPlayer(e.Who));
 }
Ejemplo n.º 28
0
        public void OnJoin(GreetPlayerEventArgs args)
        {
            Players.Add(new Mplayer(args.Who));

            var player = TShock.Players[args.Who];
            var Mplayer = Utils.GetPlayers(args.Who);

            var readTableIP = SQLEditor.ReadColumn("muteList", "IP", new List<SqlValue>());

            if (readTableIP.Contains(player.IP))
            {
                Mplayer.muted = true;
                Mplayer.muteTime = -1;
                foreach (TSPlayer tsplr in TShock.Players)
                {
                    if ((tsplr.Group.HasPermission(Permissions.mute)) || (tsplr.Group.Name == "superadmin"))
                    {
                        tsplr.SendInfoMessage("A player that is on the perma-mute list is about to enter the server, and has been muted.");
                    }
                }
            }
            else
            {
                Mplayer.muteTime = -1;
                Mplayer.muted = false;
            }
        }
Ejemplo n.º 29
0
 public void OnGreetPlayer(GreetPlayerEventArgs args)
 {
     lock (WarpplatePlugin.Players)
     {
         WarpplatePlugin.Players.Add(new WarpplatePlugin.Player(args.Who));
     }
 }