コード例 #1
0
        void tas_BattleUserJoined(object sender, BattleUserEventArgs e1)
        {
            if (e1.BattleID != tas.MyBattleID)
            {
                return;
            }
            string name = e1.UserName;

            string welc = config.Welcome;

            if (!string.IsNullOrEmpty(welc))
            {
                welc = welc.Replace("%1", name);
                welc = welc.Replace("%2", GetUserLevel(name).ToString());
                welc = welc.Replace("%3", MainConfig.SpringieVersion);
                SayBattlePrivate(name, welc);
            }
            if (spring.IsRunning)
            {
                spring.AddUser(e1.UserName, e1.ScriptPassword);
                TimeSpan started = DateTime.Now.Subtract(spring.GameStarted);
                started = new TimeSpan((int)started.TotalHours, started.Minutes, started.Seconds);
                SayBattlePrivate(name, String.Format("THIS GAME IS CURRENTLY IN PROGRESS, PLEASE WAIT UNTIL IT ENDS! Running for {0}", started));
                SayBattlePrivate(name, "If you say !notify, I will message you when the current game ends.");
            }

            if (SpawnConfig == null)
            {
                try {
                    var serv             = GlobalConst.GetSpringieService();
                    PlayerJoinResult ret = serv.AutohostPlayerJoined(tas.MyBattle.GetContext(), tas.ExistingUsers[name].AccountID);
                    if (ret != null)
                    {
                        if (!string.IsNullOrEmpty(ret.PrivateMessage))
                        {
                            tas.Say(SayPlace.User, name, ret.PrivateMessage, false);
                        }
                        if (!string.IsNullOrEmpty(ret.PublicMessage))
                        {
                            tas.Say(SayPlace.Battle, "", ret.PublicMessage, true);
                        }
                        if (ret.ForceSpec)
                        {
                            tas.ForceSpectator(name);
                        }
                        if (ret.Kick)
                        {
                            tas.Kick(name);
                        }
                    }
                } catch (Exception ex) {
                    SayBattle("ServerManage error: " + ex, false);
                }
            }

            if (SpawnConfig != null && SpawnConfig.Owner == name) // owner joins, set him boss
            {
                ComBoss(TasSayEventArgs.Default, new[] { name });
            }
        }
コード例 #2
0
        void TasClient_BattleUserLeft(object sender, BattleUserEventArgs e)
        {
            var battleID   = e.BattleID;
            var battleIcon = GetBattleIcon(battleID);

            battleIcon.SetPlayers();
            BattleChanged(this, new EventArgs <BattleIcon>(battleIcon));
        }
コード例 #3
0
 void OnBattleUserJoined(BattleUserEventArgs e)
 {
     if (mapTrack && e.UserName == playerName)
     {
         var bid = e.BattleID;
         SendRequest(tas.ExistingBattles[bid].MapName);
         SendRequest(tas.ExistingBattles[bid].ModName);
     }
 }
コード例 #4
0
 void OnBattleUserJoined(BattleUserEventArgs e)
 {
     if (mapTrack && e.UserName == playerName)
     {
         var bid = e.BattleID;
         SendRequest(tas.ExistingBattles[bid].MapName);
         SendRequest(tas.ExistingBattles[bid].ModName);
     }
 }
コード例 #5
0
        void TasClient_BattleUserJoined(object sender, BattleUserEventArgs e1)
        {
            var battleID = e1.BattleID;

            if (Program.TasClient.MyBattle != null && battleID == Program.TasClient.MyBattle.BattleID)
            {
                var userName         = e1.UserName;
                var userBattleStatus = Program.TasClient.MyBattle.Users.Single(u => u.Name == userName);
                AddUser(userBattleStatus.Name);
                AddLine(new JoinLine(userName));
            }
        }
コード例 #6
0
        void TasClient_BattleUserJoined(object sender, BattleUserEventArgs e1)
        {
            var battleID = e1.BattleID;
            var tas      = (TasClient)sender;

            if (tas.MyBattle != null && battleID == tas.MyBattle.BattleID)
            {
                var userName = e1.UserName;
                AddUser(userName);
                AddLine(new JoinLine(userName));
            }
        }
コード例 #7
0
        void TasClient_BattleUserJoined(object sender, BattleUserEventArgs e1)
        {
            var userName = e1.UserName;

            if (userName != UserName)
            {
                return;
            }
            var joinedBattleID = e1.BattleID;
            var battle         = Program.TasClient.ExistingBattles[joinedBattleID];

            AddLine(new FriendJoinedBattleLine(userName, battle));
        }
コード例 #8
0
        void TasClient_BattleUserLeft(object sender, BattleUserEventArgs e)
        {
            var userName = e.UserName;

            if (userName == Program.Conf.LobbyPlayerName)
            {
                minimapFuncBox.Visible = false; //hide buttons when leaving game
                playerListItems.Clear();
                playerBox.Items.Clear();
            }
            if (PlayerListItems.Any(i => i.UserName == userName))
            {
                RemoveUser(userName);
                AddLine(new LeaveLine(userName));
            }
        }
コード例 #9
0
        void TasClient_BattleUserJoined(object sender, BattleUserEventArgs e1)
        {
            var battleID = e1.BattleID;
            var tas      = (TasClient)sender;

            if (tas.MyBattle != null && battleID == tas.MyBattle.BattleID)
            {
                var userName = e1.UserName;
                UserBattleStatus userBattleStatus;
                if (tas.MyBattle.Users.TryGetValue(userName, out userBattleStatus))
                {
                    AddUser(userBattleStatus.Name);
                    AddLine(new JoinLine(userName));
                }
            }
        }
コード例 #10
0
        void tas_BattleUserLeft(object sender, BattleUserEventArgs e1)
        {
            if (e1.BattleID != tas.MyBattleID)
            {
                return;
            }
            CheckForBattleExit();

            if (spring.IsRunning)
            {
                spring.SayGame(e1.UserName + " has left the room");
            }

            if (e1.UserName == bossName)
            {
                SayBattle("boss has left the battle");
                bossName = "";
            }
        }
コード例 #11
0
        void tas_BattleUserLeft(object sender, BattleUserEventArgs e1) {
            if (e1.BattleID != tas.MyBattleID) return;
            CheckForBattleExit();

            if (spring.IsRunning) spring.SayGame(e1.UserName + " has left the room");

            if (e1.UserName == bossName) {
                SayBattle("boss has left the battle");
                bossName = "";
            }
        }
コード例 #12
0
 void TasClient_BattleUserJoined(object sender, BattleUserEventArgs e1)
 {
     var battleID = e1.BattleID;
     var tas = (TasClient)sender;
     if (tas.MyBattle != null && battleID == tas.MyBattle.BattleID)
     {
         var userName = e1.UserName;
         AddUser(userName);
         AddLine(new JoinLine(userName));
     }
 }
コード例 #13
0
 void tas_BattleUserJoined(object sender, BattleUserEventArgs e1)
 {
     OnBattleUserJoined(e1);
 }
コード例 #14
0
 void tas_BattleUserJoined(object sender, BattleUserEventArgs e1)
 {
     OnBattleUserJoined(e1);
 }
コード例 #15
0
 void TasClient_BattleUserLeft(object sender, BattleUserEventArgs e)
 {
     var battleID = e.BattleID;
     var battleIcon = GetBattleIcon(battleID);
     battleIcon.SetPlayers();
     BattleChanged(this, new EventArgs<BattleIcon>(battleIcon));
 }
コード例 #16
0
		void TasClient_BattleUserLeft(object sender, BattleUserEventArgs e)
		{
			var userName = e.UserName;
			if (userName == Program.Conf.LobbyPlayerName)
			{
                minimapFuncBox.Visible = false; //hide buttons when leaving game 
				playerListItems.Clear();
				playerBox.Items.Clear();
				filtering = false;
				playerSearchBox.Text = string.Empty;
			}
			if (PlayerListItems.Any(i => i.UserName == userName))
			{
				RemoveUser(userName);
				AddLine(new LeaveLine(userName));
			}
		}
コード例 #17
0
		void TasClient_BattleUserJoined(object sender, BattleUserEventArgs e1)
		{
			var battleID = e1.BattleID;
		    var tas = (TasClient)sender;
			if (tas.MyBattle != null && battleID == tas.MyBattle.BattleID)
			{
				var userName = e1.UserName;
				UserBattleStatus userBattleStatus;
			    if (tas.MyBattle.Users.TryGetValue(userName, out userBattleStatus)) {
			        AddUser(userBattleStatus.Name);
			        AddLine(new JoinLine(userName));
			    }
			}
		}
コード例 #18
0
        void tas_BattleUserJoined(object sender, BattleUserEventArgs e1) {
            if (e1.BattleID != tas.MyBattleID) return;
            string name = e1.UserName;

            string welc = config.Welcome;
            if (!string.IsNullOrEmpty(welc)) {
                welc = welc.Replace("%1", name);
                welc = welc.Replace("%2", GetUserLevel(name).ToString());
                welc = welc.Replace("%3", MainConfig.SpringieVersion);
                SayBattlePrivate(name, welc);
            }
            if (spring.IsRunning) {
                spring.AddUser(e1.UserName, e1.ScriptPassword);
                TimeSpan started = DateTime.Now.Subtract(spring.GameStarted);
                started = new TimeSpan((int)started.TotalHours, started.Minutes, started.Seconds);
                SayBattlePrivate(name, String.Format("THIS GAME IS CURRENTLY IN PROGRESS, PLEASE WAIT UNTIL IT ENDS! Running for {0}", started));
                SayBattlePrivate(name, "If you say !notify, I will message you when the current game ends.");
            }

            if (SpawnConfig == null) {
                try {
                    var serv = GlobalConst.GetSpringieService();
                    PlayerJoinResult ret = serv.AutohostPlayerJoined(tas.MyBattle.GetContext(), tas.ExistingUsers[name].AccountID);
                    if (ret != null) {
                        if (!string.IsNullOrEmpty(ret.PrivateMessage)) tas.Say(SayPlace.User, name, ret.PrivateMessage, false);
                        if (!string.IsNullOrEmpty(ret.PublicMessage)) tas.Say(SayPlace.Battle, "", ret.PublicMessage, true);
                        if (ret.ForceSpec) tas.ForceSpectator(name);
                        if (ret.Kick) tas.Kick(name);
                    }
                } catch (Exception ex) {
                    SayBattle("ServerManage error: " + ex, false);
                }
            }

            if (SpawnConfig != null && SpawnConfig.Owner == name) // owner joins, set him boss 
                ComBoss(TasSayEventArgs.Default, new[] { name });

        }
コード例 #19
0
 void TasClient_BattleUserJoined(object sender, BattleUserEventArgs e1)
 {
   var userName = e1.UserName;
   if (userName != UserName) return;
   var joinedBattleID = e1.BattleID;
   var battle = Program.TasClient.ExistingBattles[joinedBattleID];
   AddLine(new FriendJoinedBattleLine(userName, battle));
 }