/// <summary>
        /// When invited to a team
        /// </summary>
        /// <param name="Message"></param>
        public TeamQueuePage(bool IsCreator)
        {
            InitializeComponent();
            Client.InviteListView = InviteListView;


            Client.PVPNet.Accept(InviteId.ToString());

            string ObfuscatedName = Client.GetObfuscatedChatroomName(InviteId.ToString(), ChatPrefixes.Arranging_Game);
            string JID = Client.GetChatroomJID(ObfuscatedName, "0", true);
            newRoom = Client.ConfManager.GetRoom(new jabber.JID(JID));
            newRoom.Nickname = Client.LoginPacket.AllSummonerData.Summoner.Name;
            newRoom.OnRoomMessage += newRoom_OnRoomMessage;
            newRoom.OnParticipantJoin += newRoom_OnParticipantJoin;
            newRoom.Join();

            IsOwner = IsCreator;

            if (IsCreator)
            {
                InviteButton.IsEnabled = true;
                StartGameButton.IsEnabled = true;
            }
            else
            {
                InviteButton.IsEnabled = false;
                StartGameButton.IsEnabled = false;
            }

            Client.OnMessage += Client_OnMessage;
        }
        public MucAffiliationDialog(Room room, RoomParticipant participant, QWidget parentWindow)
            : base(parentWindow)
        {
            SetupUi();

            m_Room = room;
            m_Participant = participant;

            roomLabel.Text = room.JID.Bare;
            userLabel.Text = participant.RealJID.Bare;

            switch (participant.Affiliation) {
            case RoomAffiliation.owner:
                ownerRadioButton.Checked = true;
                break;
            case RoomAffiliation.admin:
                adminRadioButton.Checked = true;
                break;
            case RoomAffiliation.member:
                memberRadioButton.Checked = true;
                break;
            case RoomAffiliation.outcast:
                outcastRadioButton.Checked = true;
                break;
            default:
                noneRadioButton.Checked = true;
                break;
            }

            buttonBox.StandardButtons = (uint)QDialogButtonBox.StandardButton.Ok | (uint)QDialogButtonBox.StandardButton.Cancel;

            Gui.CenterWidgetOnScreen(this);
        }
        internal ConferenceMember(RoomParticipant participant, Room room)
        {
            this.participant = participant;
            this.room = room;

            room.OnParticipantPresenceChange += room_OnParticipantPresenceChange;
        }
 public ChatText()
 {
     InitializeComponent();
     newRoom = Client.ConfManager.GetRoom(new jabber.JID("[email protected]"));
     newRoom.Nickname = Client.LoginPacket.AllSummonerData.Summoner.Name;
     newRoom.OnRoomMessage += newRoom_OnRoomMessage;
     newRoom.OnParticipantJoin += newRoom_OnParticipantJoin;
     newRoom.Join();
 }
 private void newRoom_OnParticipantJoin(Room room, RoomParticipant participant)
 {
     Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() =>
     {
         TextRange tr = new TextRange(ChatText.Document.ContentEnd, ChatText.Document.ContentEnd);
         tr.Text = participant.Nick + " joined the room." + Environment.NewLine;
         tr.ApplyPropertyValue(TextElement.ForegroundProperty, Brushes.Yellow);
     }));
 }
        /// <summary>
        /// When invited to a team
        /// </summary>
        /// <param name="Message"></param>
        public TeamQueuePage(Message Message, bool IsCreator)
        {
            InitializeComponent();
            MessageData = Message;
            Client.InviteListView = InviteListView;

            using (XmlReader reader = XmlReader.Create(new StringReader(Message.Body)))
            {
                while (reader.Read())
                {
                    if (reader.IsStartElement())
                    {
                        #region Parse Popup

                        switch (reader.Name)
                        {
                            case "inviteId":
                                reader.Read();
                                InviteId = Convert.ToInt64(reader.Value);
                                break;
                        }

                        #endregion Parse Popup
                    }
                }
            }

            Client.PVPNet.AcceptInviteForMatchmakingGame(InviteId.ToString());

            string ObfuscatedName = Client.GetObfuscatedChatroomName(InviteId.ToString(), ChatPrefixes.Arranging_Game);
            string JID = Client.GetChatroomJID(ObfuscatedName, "0", true);
            newRoom = Client.ConfManager.GetRoom(new jabber.JID(JID));
            newRoom.Nickname = Client.LoginPacket.AllSummonerData.Summoner.Name;
            newRoom.OnRoomMessage += newRoom_OnRoomMessage;
            newRoom.OnParticipantJoin += newRoom_OnParticipantJoin;
            newRoom.Join();

            IsOwner = IsCreator;

            if (IsCreator)
            {
                InviteButton.IsEnabled = true;
                StartGameButton.IsEnabled = true;
            }
            else
            {
                InviteButton.IsEnabled = false;
                StartGameButton.IsEnabled = false;
            }

            Client.OnMessage += Client_OnMessage;
        }
        public EndOfGamePage(EndOfGameStats Statistics)
        {
            InitializeComponent();
            RenderStats(Statistics);
            Client.SwitchPage(new MainPage());
            Client.runonce = false;

            string ObfuscatedName = Client.GetObfuscatedChatroomName(Statistics.RoomName, ChatPrefixes.Post_Game); //Why do you need to replace INVID with invid Riot?
            string JID = Client.GetChatroomJID(ObfuscatedName, Statistics.RoomPassword, false);
            newRoom = Client.ConfManager.GetRoom(new jabber.JID(JID));
            newRoom.Nickname = Client.LoginPacket.AllSummonerData.Summoner.Name;
            newRoom.OnRoomMessage += newRoom_OnRoomMessage;
            newRoom.OnParticipantJoin += newRoom_OnParticipantJoin;
            newRoom.Join(Statistics.RoomPassword);
        }
Beispiel #8
0
        private void Authenticated(object sender, AuthenticationEventArgs e)
        {
            room = JabberSession.ConferenceManager.GetRoom(ConferenceJid);
            room.OnJoin += r => JabberSession.Invoke(() => room_OnJoin(r));
            room.OnLeave += (r, p) => JabberSession.Invoke(() => room_OnLeave(r, p));
            room.OnSubjectChange += room_OnSubjectChange;
            room.OnPresenceError += (r, p) => JabberSession.Invoke(() => room_OnPresenceError(r, p));

            room.OnSelfMessage += (s, msg) => JabberSession.Invoke(() => room_OnSelfMessage(s, msg));
            room.OnAdminMessage += (s, msg) => JabberSession.Invoke(() => room_OnAdminMessage(s, msg));
            room.OnRoomMessage += (s, msg) => JabberSession.Invoke(() => room_OnRoomMessage(s, msg));

            room.OnParticipantJoin += (r, p) => JabberSession.Invoke(() => room_OnParticipantJoin(r, p));
            room.OnParticipantLeave += (r, p) => JabberSession.Invoke(() => room_OnParticipantLeave(r, p));
            room.Join();
        }
Beispiel #9
0
        public MucHandler(Account account, Room room)
            : base(account)
        {
            m_Room = room;
            m_GridModel = new MucAvatarGridModel(account, room);

            m_Room.OnRoomMessage      += HandleOnRoomMessage;
            m_Room.OnSelfMessage      += HandleOnSelfMessage;
            m_Room.OnJoin             += HandleOnJoin;
            m_Room.OnLeave            += HandleOnLeave;
            m_Room.OnParticipantJoin  += HandleOnParticipantJoin;
            m_Room.OnParticipantLeave += HandleOnParticipantLeave;
            m_Room.OnSubjectChange    += HandleOnSubjectChange;
            m_Room.OnPresenceError    += HandleOnPresenceError;
            m_Room.OnRoomConfig       += HandleOnRoomConfig;
            m_Room.OnAdminMessage     += HandleOnAdminMessage;
            m_Room.OnParticipantPresenceChange += HandleOnPresenceChange;
            m_Room.OnPresenceChange  += HandleOnPresenceChange;
            account.Client.OnIQ += HandleOnIQ;
            account.ConnectionStateChanged +=HandleConnectionStateChanged;
        }
Beispiel #10
0
        void HandleOnPresenceChange(Room room, RoomParticipant participant, Presence oldPresence)
        {
            var x1 = (UserX)oldPresence["x", URI.MUC_USER];
            var x2 = (UserX)participant.Presence["x", URI.MUC_USER];

            var oldAffiliation = x1.RoomItem.Affiliation;
            var newAffiliation = x2.RoomItem.Affiliation;

            var oldRole = x1.RoomItem.Role;
            var newRole = x2.RoomItem.Role;

            var nick = (room.Nickname == participant.Nick) ? "You are" :  participant.Nick + " is";

            if (newAffiliation != oldAffiliation) {
                switch (newAffiliation) {
                case RoomAffiliation.admin:
                    base.AppendStatus(String.Format("{0} now a room admin.", nick));
                    break;
                case RoomAffiliation.member:
                    // "is now a room member" sounds weird...so we show something more useful if possible.
                    switch (oldAffiliation) {
                    case RoomAffiliation.admin:
                        base.AppendStatus(String.Format("{0} longer a room admin.", nick));
                        break;
                    case RoomAffiliation.owner:
                        base.AppendStatus(String.Format("{0} no longer a room owner.", nick));
                        break;
                    default:
                        base.AppendStatus(String.Format("{0} now a room member.", nick));
                        break;
                    }
                    break;
                case RoomAffiliation.outcast:
                    base.AppendStatus(String.Format("{0} now banned from the room.", nick));
                    break;
                case RoomAffiliation.owner:
                    base.AppendStatus(String.Format("{0}  now a room owner.", nick));
                    break;
                case RoomAffiliation.none:
                    switch (oldAffiliation) {
                    case RoomAffiliation.admin:
                        base.AppendStatus(String.Format("{0} no longer a room admin.", nick));
                        break;
                    case RoomAffiliation.owner:
                        base.AppendStatus(String.Format("{0} no longer a room owner.", nick));
                        break;
                    case RoomAffiliation.member:
                        base.AppendStatus(String.Format("{0} no longer a room member.", nick));
                        break;
                    case RoomAffiliation.outcast:
                        base.AppendStatus(String.Format("{0} no longer banned from the room.", nick));
                        break;
                    }
                    break;
                }
            } else if (newRole != oldRole) {
                switch (newRole) {
                case RoomRole.moderator:
                    base.AppendStatus(String.Format("{0} now a moderator.", nick));
                    break;
                case RoomRole.participant:
                    base.AppendStatus(String.Format("{0} now a participant.", nick));
                    break;
                case RoomRole.visitor:
                    base.AppendStatus(String.Format("{0} now a visitor.", nick));
                    break;
                }
            } else if (participant.Presence.Show != oldPresence.Show || participant.Presence.Status != oldPresence.Status) {
                if (participant.Presence.Type == PresenceType.available) {
                    if (!String.IsNullOrEmpty(participant.Presence.Status))
                        base.AppendStatus(String.Format("{0} now {1}: {2}.", nick, Helper.GetPresenceDisplay(participant.Presence), participant.Presence.Status));
                    else
                        base.AppendStatus(String.Format("{0} now {1}.", nick, Helper.GetPresenceDisplay(participant.Presence)));
                }
            }
        }
Beispiel #11
0
        void HandleOnParticipantLeave(Room room, RoomParticipant participant)
        {
            string reason = null;
            RoomStatus status = RoomStatus.UNKNOWN;
            GetReasonAndStatus(participant.Presence, out reason, out status);

            var builder = new StringBuilder();
            builder.Append(participant.Nick);

            if (status == RoomStatus.KICKED)
                builder.Append(" was kicked from the room");
            else if (status == RoomStatus.BANNED)
                builder.Append(" has been banned from the room");
            else
                builder.Append(" left the room");

            if (!String.IsNullOrEmpty(reason)) {
                builder.Append(": ");
                builder.Append(reason);
            }

            builder.Append(".");

            base.AppendStatus(builder.ToString());
        }
Beispiel #12
0
 private void room_OnParticipantJoin(Room room, RoomParticipant participant)
 {
     Members.Add(participant, room);
 }
Beispiel #13
0
        private IQ muc_OnRoomConfig(Room room, IQ parent)
        {
            muzzle.XDataForm form = new muzzle.XDataForm(parent);
            if (form.ShowDialog() != DialogResult.OK)
                return null;

            return (IQ)form.GetResponse();
        }
        /// <summary>
        /// Joins a conference room.
        /// </summary>
        /// <param name="roomAndNick">room@conference/nick, where "nick" is the desred nickname in the room.</param>
        /// <returns>
        /// If already joined, the existing room will be returned.
        /// If not, a Room object will be returned in the joining state.
        /// </returns>
        public Room GetRoom(JID roomAndNick)
        {
            if (roomAndNick == null)
                throw new ArgumentNullException("roomAndNick");

            if (roomAndNick.Resource == null)
                roomAndNick.Resource = DefaultNick;

            Room r = (Room)m_rooms[roomAndNick];
            if (r != null)
                return r;

            // If no resource specified, pick up the user's name from their JID
            if (roomAndNick.Resource == null)
                roomAndNick.Resource = m_stream.JID.User;

            r = new Room(this, roomAndNick);
            r.OnJoin += OnJoin;
            r.OnLeave += OnLeave;
            r.OnPresenceError += OnPresenceError;
            r.OnRoomConfig += OnRoomConfig;
            r.OnRoomMessage += OnRoomMessage;
            r.OnPrivateMessage += OnPrivateMessage;
            r.OnAdminMessage += OnAdminMessage;
            r.OnSelfMessage += OnSelfMessage;
            r.OnSubjectChange += OnSubjectChange;
            r.OnParticipantJoin += OnParticipantJoin;
            r.OnParticipantLeave += OnParticipantLeave;
            r.OnParticipantPresenceChange += OnParticipantPresenceChange;

            m_rooms[roomAndNick] = r;
            return r;
        }
Beispiel #15
0
 void OnJoin(Room room)
 {
     AddPersonToGroup(room, room.Nickname);
 }
Beispiel #16
0
        public void OnParticipantLeave(Room room, RoomParticipant roomParticipant)
        {
            string jid = room.JID.Bare;
            var chat = (GroupChatModel) Session.GetChat(jid, ChatType.Group, this);
            string nickname = roomParticipant.Nick;

            lock (chat) {
                var person = chat.GetPerson(nickname);
                if (person == null) {
                    return;
                }

                Session.RemovePersonFromGroupChat(chat, person);
            }
        }
Beispiel #17
0
 void HandleOnPresenceError(Room room, Presence pres)
 {
     base.AppendStatus("Error: " + pres.Error.Condition);
 }
Beispiel #18
0
 private void OnConnectionDropped(object sender, AuthenticationEventArgs e)
 {
     room = null;
     IsConnected = false;
     Disconnected(this, new DisconnectEventArgs(ConnectionErrorKind.ConnectionError, e.ErrorMessage));
 }
Beispiel #19
0
 IQ HandleOnRoomConfig(Room room, IQ parent)
 {
     // FIXME:
     Console.WriteLine("Show room configuration dialog...");
     return null;
 }
Beispiel #20
0
        private void room_OnPresenceError(Room room, Presence pres)
        {
            if (pres.Error == null)
                return;

            switch (pres.Error.Code)
            {
                case 409: //conflict
                    Joined(this, new ConferenceJoinEventArgs(ConferenceJoinErrorKind.NickConflict,
                                                             ErrorMessageResources.NickConflictErrorMessage));
                    break;

                case 403: //banned
                    Joined(this, new ConferenceJoinEventArgs(ConferenceJoinErrorKind.Banned,
                                                             ErrorMessageResources.BannedErrorMessage));
                    break;

                case 401: //not-auth
                    Joined(this, new ConferenceJoinEventArgs(ConferenceJoinErrorKind.PasswordRequired,
                                                             ErrorMessageResources.PasswordRequiredErrorMessage));
                    break;

                    //captcha...
            }
        }
Beispiel #21
0
 void OnParticipantJoin(Room room, RoomParticipant roomParticipant)
 {
     AddPersonToGroup(room, roomParticipant.Nick);
 }
        public async void LoadStats()
        {
            i = 10;
            PingTimer = new Timer(1000);
            PingTimer.Elapsed += new ElapsedEventHandler(PingElapsed);
            PingTimer.Enabled = true;
            PingElapsed(1, null);
            InviteButton.IsEnabled = false;
            StartGameButton.IsEnabled = false;

            if (CurrentLobby == null)
            {
                //Yay fixed lobby. Riot hates me still though. They broke this earlier, except I have fixed it
                CurrentLobby = await Client.PVPNet.getLobbyStatus();
            }
            string ObfuscatedName = Client.GetObfuscatedChatroomName(CurrentLobby.InvitationID.Replace("INVID", "invid"), ChatPrefixes.Arranging_Game); //Why do you need to replace INVID with invid Riot?
            string JID = Client.GetChatroomJID(ObfuscatedName, CurrentLobby.ChatKey, false);
            newRoom = Client.ConfManager.GetRoom(new jabber.JID(JID));
            newRoom.Nickname = Client.LoginPacket.AllSummonerData.Summoner.Name;
            newRoom.OnRoomMessage += newRoom_OnRoomMessage;
            newRoom.OnParticipantJoin += newRoom_OnParticipantJoin;
            newRoom.Join(CurrentLobby.ChatKey);


            ///Way smarter way then just putting the code here

            RenderLobbyData();
        }
Beispiel #23
0
        private void AddPersonToGroup(Room room, string nickname)
        {
            string jid = room.JID.Bare;
            var chat = (XmppGroupChatModel) Session.GetChat(jid, ChatType.Group, this);
            // first notice we're joining a group chat is the participant info:
            if (chat == null) {
                chat = Session.CreateChat<XmppGroupChatModel>(jid, jid, this);
                chat.OwnNickname = room.Nickname;
                Session.AddChat(chat);
            }

            lock (chat) {
                if (chat.UnsafePersons.ContainsKey(nickname)) {
                    return;
                }
                // manual construction is necessary for group chats
                var person = new PersonModel(nickname, nickname, NetworkID, Protocol, this);
                if (chat.IsSynced) {
                    Session.AddPersonToGroupChat(chat, person);
                } else {
                    chat.UnsafePersons.Add(nickname, person);
                }
            }

            // did I join? then the chat roster is fully received
            if (!chat.IsSynced && nickname == room.Nickname) {
                chat.IsSynced = true;
                Session.SyncChat(chat);
            }
        }
        private void GameLobby_OnMessageReceived(object sender, object message)
        {
            if (message.GetType() == typeof(GameDTO))
            {
                GameDTO dto = message as GameDTO;
                Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(async () =>
                {
                    MapId = dto.MapId;
                    GameId = dto.Id;
                    if (!HasConnectedToChat)
                    {
                        //Run once
                        BaseMap map = BaseMap.GetMap(dto.MapId);
                        MapLabel.Content = map.DisplayName;
                        ModeLabel.Content = Client.TitleCaseString(dto.GameMode);
                        GameTypeConfigDTO configType = Client.LoginPacket.GameTypeConfigs.Find(x => x.Id == dto.GameTypeConfigId);
                        TypeLabel.Content = GetGameMode(configType.Id);
                        SizeLabel.Content = dto.MaxNumPlayers / 2 + "v" + dto.MaxNumPlayers / 2;

                        HasConnectedToChat = true;
                        string ObfuscatedName = Client.GetObfuscatedChatroomName(dto.Name.ToLower() + Convert.ToInt32(dto.Id), ChatPrefixes.Arranging_Practice);
                        string JID = Client.GetChatroomJID(ObfuscatedName, dto.RoomPassword, false);
                        newRoom = Client.ConfManager.GetRoom(new jabber.JID(JID));
                        newRoom.Nickname = Client.LoginPacket.AllSummonerData.Summoner.Name;
                        newRoom.OnRoomMessage += newRoom_OnRoomMessage;
                        newRoom.OnParticipantJoin += newRoom_OnParticipantJoin;
                        newRoom.Join(dto.RoomPassword);
                    }
                    if (dto.GameState == "TEAM_SELECT")
                    {
                        OptomisticLock = dto.OptimisticLock;
                        LaunchedTeamSelect = false;
                        BlueTeamListView.Items.Clear();
                        PurpleTeamListView.Items.Clear();

                        List<Participant> AllParticipants = new List<Participant>(dto.TeamOne.ToArray());
                        AllParticipants.AddRange(dto.TeamTwo);

                        int i = 0;
                        bool PurpleSide = false;

                        foreach (Participant playerTeam in AllParticipants)
                        {
                            i++;
                            CustomLobbyPlayer lobbyPlayer = new CustomLobbyPlayer();
                            if (playerTeam is PlayerParticipant)
                            {
                                PlayerParticipant player = playerTeam as PlayerParticipant;
                                lobbyPlayer = RenderPlayer(player, dto.OwnerSummary.SummonerId == player.SummonerId);
                                IsOwner = dto.OwnerSummary.SummonerId == Client.LoginPacket.AllSummonerData.Summoner.SumId;
                                StartGameButton.IsEnabled = IsOwner;
                                WhitelistAddButton.IsEnabled = IsOwner;

                                if (Client.Whitelist.Count > 0)
                                {
                                    if (!Client.Whitelist.Contains(player.SummonerName.ToLower()) && player.SummonerId != Client.LoginPacket.AllSummonerData.Summoner.SumId && IsOwner)
                                    {
                                        await Client.PVPNet.BanUserFromGame(Client.GameID, player.AccountId);
                                    }
                                }
                            }

                            if (i > dto.TeamOne.Count)
                            {
                                i = 0;
                                PurpleSide = true;
                            }

                            if (!PurpleSide)
                            {
                                BlueTeamListView.Items.Add(lobbyPlayer);
                            }
                            else
                            {
                                PurpleTeamListView.Items.Add(lobbyPlayer);
                            }
                        }
                    }
                    else if (dto.GameState == "CHAMP_SELECT" || dto.GameState == "PRE_CHAMP_SELECT")
                    {
                        if (!LaunchedTeamSelect)
                        {
                            Client.ChampSelectDTO = dto;
                            Client.LastPageContent = Client.Container.Content;
                            Client.SwitchPage(new ChampSelectPage());
                            LaunchedTeamSelect = true;
                        }
                    }
                }));
            }
        }
Beispiel #25
0
 void OnLeave(Room room, Presence presence)
 {
     var chat = Session.GetChat(room.JID.Bare, ChatType.Group, this);
     if (chat.IsEnabled)
         Session.RemoveChat(chat);
 }
Beispiel #26
0
 void HandleOnJoin(Room room)
 {
     base.Ready = true;
 }
Beispiel #27
0
 private void muc_OnPresenceError(Room room, Presence pres)
 {
     m_err = true;
     pnlCon.Text = "Groupchat error: " + pres.Error.OuterXml;
 }
Beispiel #28
0
        void HandleOnLeave(Room room, Presence presence)
        {
            string reason = null;
            RoomStatus status = RoomStatus.UNKNOWN;
            GetReasonAndStatus(presence, out reason, out status);

            var builder = new StringBuilder();
            builder.Append("You have");
            if (status == RoomStatus.KICKED)
                builder.Append(" been kicked from the room");
            else if (status == RoomStatus.BANNED)
                builder.Append(" been banned from the room");
            else
                builder.Append(" left the room");

            if (!String.IsNullOrEmpty(reason)) {
                builder.Append(": ");
                builder.Append(reason);
            }

            builder.Append(".");

            base.AppendStatus(builder.ToString());

            base.Ready = false;
        }
        /// <summary>
        /// Initializes all data required for champion select. Also retrieves latest GameDTO
        /// </summary>
        private async void StartChampSelect()
        {
            //Force client to popup once in champion select
            Client.FocusClient();
            //Get champions and sort alphabetically
            ChampList = new List<ChampionDTO>(Client.PlayerChampions);
            ChampList.Sort((x, y) => champions.GetChampion(x.ChampionId).displayName.CompareTo(champions.GetChampion(y.ChampionId).displayName));
            //Retrieve masteries and runes
            MyMasteries = Client.LoginPacket.AllSummonerData.MasteryBook;
            MyRunes = Client.LoginPacket.AllSummonerData.SpellBook;

            //Put masteries & runes into combo boxes
            int i = 0;
            foreach (MasteryBookPageDTO MasteryPage in MyMasteries.BookPages)
            {
                string MasteryPageName = MasteryPage.Name;
                //Stop garbage mastery names
                if (MasteryPageName.StartsWith("@@")) 
                {
                    MasteryPageName = "Mastery Page " + ++i;
                }
                MasteryComboBox.Items.Add(MasteryPageName);
                if (MasteryPage.Current)
                    MasteryComboBox.SelectedValue = MasteryPageName;
            }
            i = 0;
            foreach (SpellBookPageDTO RunePage in MyRunes.BookPages)
            {
                string RunePageName = RunePage.Name;
                //Stop garbage rune names
                if (RunePageName.StartsWith("@@"))
                {
                    RunePageName = "Rune Page " + ++i;
                }
                RuneComboBox.Items.Add(RunePageName);
                if (RunePage.Current)
                    RuneComboBox.SelectedValue = RunePageName;
            }
            //Allow runes & masteries to be changed
            QuickLoad = true;

            //Signal to the server we are in champion select
            await Client.PVPNet.SetClientReceivedGameMessage(Client.GameID, "CHAMP_SELECT_CLIENT");
            //Retrieve the latest GameDTO
            GameDTO latestDTO = await Client.PVPNet.GetLatestGameTimerState(Client.GameID, Client.ChampSelectDTO.GameState, Client.ChampSelectDTO.PickTurn);
            //Find the game config for timers
            configType = Client.LoginPacket.GameTypeConfigs.Find(x => x.Id == latestDTO.GameTypeConfigId);
            if (configType == null) //Invalid config... abort!
            {
                Client.QuitCurrentGame();

                MessageOverlay overlay = new MessageOverlay();
                overlay.MessageTextBox.Text = "Invalid Config ID (" + latestDTO.GameTypeConfigId.ToString() + "). Report to Snowl [https://github.com/Snowl/LegendaryClient/issues/new]";
                overlay.MessageTitle.Content = "Invalid Config";
                Client.OverlayContainer.Content = overlay.Content;
                Client.OverlayContainer.Visibility = Visibility.Visible;
                return;
            }
            counter = configType.MainPickTimerDuration - 5; //Seems to be a 5 second inconsistancy with riot and what they actually provide
            CountdownTimer = new System.Windows.Forms.Timer();
            CountdownTimer.Tick += new EventHandler(CountdownTimer_Tick);
            CountdownTimer.Interval = 1000; // 1 second
            CountdownTimer.Start();

            LatestDto = latestDTO;
            //Get the champions for the other team to ban & sort alpabetically
            ChampionBanInfoDTO[] ChampsForBan = await Client.PVPNet.GetChampionsForBan();
            ChampionsForBan = new List<ChampionBanInfoDTO>(ChampsForBan);
            ChampionsForBan.Sort((x, y) => champions.GetChampion(x.ChampionId).displayName.CompareTo(champions.GetChampion(y.ChampionId).displayName));

            //Join champion select chatroom
            string JID = Client.GetChatroomJID(latestDTO.RoomName.Replace("@sec", ""), latestDTO.RoomPassword, false);
            Chatroom = Client.ConfManager.GetRoom(new jabber.JID(JID));
            Chatroom.Nickname = Client.LoginPacket.AllSummonerData.Summoner.Name;
            Chatroom.OnRoomMessage += Chatroom_OnRoomMessage;
            Chatroom.OnParticipantJoin += Chatroom_OnParticipantJoin;
            Chatroom.Join(latestDTO.RoomPassword);

            //Render our champions
            RenderChamps(false);

            //Start recieving champ select
            ChampSelect_OnMessageReceived(this, latestDTO);
            Client.OnFixChampSelect += ChampSelect_OnMessageReceived;
            Client.PVPNet.OnMessageReceived += ChampSelect_OnMessageReceived;
        }
Beispiel #30
0
 void HandleOnParticipantJoin(Room room, RoomParticipant participant)
 {
     base.AppendStatus(String.Format("{0} has joined the room.", participant.Nick));
 }