Example #1
0
        private void Game_RequestLogout(FrostbiteLayerClient sender, Packet packet) {
            sender.SendResponse(packet, PRoConLayerClient.RESPONSE_OK);
            
            this.IsLoggedIn = false;

            if (this.Logout != null) {
                FrostbiteConnection.RaiseEvent(this.Logout.GetInvocationList(), this);
            }
        }
Example #2
0
        private void DispatchProconPluginListLoadedRequest(FrostbiteLayerClient sender, Packet packet) {
            if (this.IsLoggedIn == true) {
                if (this.m_sprvPrivileges.CanIssueLimitedProconPluginCommands == true) {

                    if (packet.Words.Count == 1) {
                        List<string> lstLoadedPlugins = this.GetListLoadedPlugins();

                        lstLoadedPlugins.Insert(0, PRoConLayerClient.RESPONSE_OK);

                        sender.SendResponse(packet, lstLoadedPlugins);
                    }
                    else {
                        sender.SendResponse(packet, PRoConLayerClient.RESPONSE_INVALID_ARGUMENTS);
                    }
                }
                else {
                    sender.SendResponse(packet, PRoConLayerClient.RESPONSE_INSUFFICIENT_PRIVILEGES);
                }
            }
            else {
                sender.SendResponse(packet, PRoConLayerClient.RESPONSE_LOGIN_REQUIRED);
            }
        }
Example #3
0
        private void DispatchProconPluginEnableRequest(FrostbiteLayerClient sender, Packet packet) {
            if (this.IsLoggedIn == true) {
                if (this.m_sprvPrivileges.CanIssueLimitedProconPluginCommands == true) {
                    bool blEnabled = false;

                    if (packet.Words.Count >= 3 && bool.TryParse(packet.Words[2], out blEnabled) == true) {
                        sender.SendResponse(packet, PRoConLayerClient.RESPONSE_OK);

                        if (blEnabled == true) {
                            this.m_prcClient.PluginsManager.EnablePlugin(packet.Words[1]);
                        }
                        else {
                            this.m_prcClient.PluginsManager.DisablePlugin(packet.Words[1]);
                        }
                    }
                    else {
                        sender.SendResponse(packet, PRoConLayerClient.RESPONSE_INVALID_ARGUMENTS);
                    }
                }
                else {
                    sender.SendResponse(packet, PRoConLayerClient.RESPONSE_INSUFFICIENT_PRIVILEGES);
                }
            }
            else {
                sender.SendResponse(packet, PRoConLayerClient.RESPONSE_LOGIN_REQUIRED);
            }
        }
Example #4
0
        private void DispatchProconBattlemapModifyZoneTagsRequest(FrostbiteLayerClient sender, Packet packet) {
            if (this.IsLoggedIn == true) {
                if (this.m_sprvPrivileges.CanEditMapZones == true) {

                    if (packet.Words.Count >= 3) {

                        if (this.m_prcClient.MapGeometry.MapZones.Contains(packet.Words[1]) == true) {
                            this.m_prcClient.MapGeometry.MapZones[packet.Words[1]].Tags.FromString(packet.Words[2]);
                        }

                        sender.SendResponse(packet, PRoConLayerClient.RESPONSE_OK);
                    }
                    else {
                        sender.SendResponse(packet, PRoConLayerClient.RESPONSE_INVALID_ARGUMENTS);
                    }
                }
                else {
                    sender.SendResponse(packet, PRoConLayerClient.RESPONSE_INSUFFICIENT_PRIVILEGES);
                }
            }
            else {
                sender.SendResponse(packet, PRoConLayerClient.RESPONSE_LOGIN_REQUIRED);
            }
        }
Example #5
0
        private void DispatchProconBattlemapListZonesRequest(FrostbiteLayerClient sender, Packet packet) {

            if (this.IsLoggedIn == true) {

                List<string> listPacket = new List<string>() { PRoConLayerClient.RESPONSE_OK };

                listPacket.Add(this.m_prcClient.MapGeometry.MapZones.Count.ToString());

                foreach (MapZoneDrawing zone in this.m_prcClient.MapGeometry.MapZones) {

                    listPacket.Add(zone.UID);
                    listPacket.Add(zone.LevelFileName);
                    listPacket.Add(zone.Tags.ToString());

                    listPacket.Add(zone.ZonePolygon.Length.ToString());
                    listPacket.AddRange(Point3D.ToStringList(zone.ZonePolygon));
                }

                sender.SendResponse(packet, listPacket);
            }
            else {
                sender.SendResponse(packet, PRoConLayerClient.RESPONSE_LOGIN_REQUIRED);
            }
        }
Example #6
0
        private void DispatchProconAccountListLoggedInRequest(FrostbiteLayerClient sender, Packet packet) {
            if (this.m_sprvPrivileges.CanIssueLimitedProconCommands == true) {

                List<string> lstLoggedInAccounts = this.m_prcClient.Layer.GetLoggedInAccounts((packet.Words.Count >= 2 && String.Compare(packet.Words[1], "uids") == 0));

                //List<string> lstLoggedInAccounts = this.m_prcClient.Layer.GetLoggedInAccounts();
                lstLoggedInAccounts.Insert(0, PRoConLayerClient.RESPONSE_OK);

                sender.SendResponse(packet, lstLoggedInAccounts);
            }
            else {
                sender.SendResponse(packet, PRoConLayerClient.RESPONSE_INSUFFICIENT_PRIVILEGES);
            }
        }
Example #7
0
        private void DispatchProconAccountSetPasswordRequest(FrostbiteLayerClient sender, Packet packet) {
            if (this.IsLoggedIn == true) {
                if (this.m_sprvPrivileges.CanIssueLimitedProconCommands == true) {

                    if (packet.Words.Count >= 3 && packet.Words[2].Length > 0) {

                        if (this.m_praApplication.AccountsList.Contains(packet.Words[1]) == true) {
                            sender.SendResponse(packet, PRoConLayerClient.RESPONSE_OK);

                            this.m_praApplication.AccountsList[packet.Words[1]].Password = packet.Words[2];
                        }
                        else {
                            sender.SendResponse(packet, "AccountDoesNotExists");
                        }
                    }
                    else {
                        sender.SendResponse(packet, PRoConLayerClient.RESPONSE_INVALID_ARGUMENTS);
                    }
                }
                else {
                    sender.SendResponse(packet, PRoConLayerClient.RESPONSE_INSUFFICIENT_PRIVILEGES);
                }
            }
            else {
                sender.SendResponse(packet, PRoConLayerClient.RESPONSE_LOGIN_REQUIRED);
            }
        }
Example #8
0
 private void Game_RequestPacketAlterTextMonderationListRecieved(FrostbiteLayerClient sender, Packet packet) {
     if (this.IsLoggedIn == true) {
         if (this.m_sprvPrivileges.CanEditTextChatModerationList == true) {
             this.m_prcClient.SendProconLayerPacket(this, packet);
         }
         else {
             sender.SendResponse(packet, PRoConLayerClient.RESPONSE_INSUFFICIENT_PRIVILEGES);
         }
     }
     else {
         sender.SendResponse(packet, PRoConLayerClient.RESPONSE_LOGIN_REQUIRED);
     }
 }
Example #9
0
 private void Game_RequestPacketVarsRecieved(FrostbiteLayerClient sender, Packet packet) {
     if (this.IsLoggedIn == true) {
         if (this.m_sprvPrivileges.CanAlterServerSettings == true) {
             this.m_prcClient.SendProconLayerPacket(this, packet);
         }
         else {
             sender.SendResponse(packet, PRoConLayerClient.RESPONSE_INSUFFICIENT_PRIVILEGES);
         }
     }
     else {
         sender.SendResponse(packet, PRoConLayerClient.RESPONSE_LOGIN_REQUIRED);
     }
 }
Example #10
0
        private void Game_RequestPacketPunkbusterRecieved(FrostbiteLayerClient sender, Packet packet) {
 	        if (this.IsLoggedIn == true) {

                if (packet.Words.Count >= 2) {
                    
                    bool blCommandProcessed = false;
                    
                    if (this.m_sprvPrivileges.CannotIssuePunkbusterCommands == true) {
                        sender.SendResponse(packet, PRoConLayerClient.RESPONSE_INSUFFICIENT_PRIVILEGES);

                        blCommandProcessed = true;
                    }
                    else {
                        Match mtcMatch = Regex.Match(packet.Words[1], "^(?=(?<pb_sv_command>pb_sv_plist))|(?=(?<pb_sv_command>pb_sv_ban))|(?=(?<pb_sv_command>pb_sv_banguid))|(?=(?<pb_sv_command>pb_sv_banlist))|(?=(?<pb_sv_command>pb_sv_getss))|(?=(?<pb_sv_command>pb_sv_kick)[ ]+?.*?[ ]+?(?<pb_sv_kick_time>[0-9]+)[ ]+)|(?=(?<pb_sv_command>pb_sv_unban))|(?=(?<pb_sv_command>pb_sv_unbanguid))|(?=(?<pb_sv_command>pb_sv_reban))", RegexOptions.IgnoreCase);

                        // IF they tried to issue a pb_sv_command that isn't on the safe list AND they don't have full access.
                        if (mtcMatch.Success == false && this.m_sprvPrivileges.CanIssueAllPunkbusterCommands == false) {
                            sender.SendResponse(packet, PRoConLayerClient.RESPONSE_INSUFFICIENT_PRIVILEGES);
                            blCommandProcessed = true;
                        }
                        else {

                            if (this.m_sprvPrivileges.CanPermanentlyBanPlayers == false && (String.Compare(mtcMatch.Groups["pb_sv_command"].Value, "pb_sv_ban", true) == 0 || String.Compare(mtcMatch.Groups["pb_sv_command"].Value, "pb_sv_banguid", true) == 0 || String.Compare(mtcMatch.Groups["pb_sv_command"].Value, "pb_sv_reban", true) == 0)) {
                                sender.SendResponse(packet, PRoConLayerClient.RESPONSE_INSUFFICIENT_PRIVILEGES);
                                blCommandProcessed = true;
                            }
                            else if (this.m_sprvPrivileges.CanEditBanList == false && (String.Compare(mtcMatch.Groups["pb_sv_command"].Value, "pb_sv_unban", true) == 0 || String.Compare(mtcMatch.Groups["pb_sv_command"].Value, "pb_sv_unbanguid", true) == 0)) {
                                sender.SendResponse(packet, PRoConLayerClient.RESPONSE_INSUFFICIENT_PRIVILEGES);
                                blCommandProcessed = true;
                            }
                            else if (String.Compare(mtcMatch.Groups["pb_sv_command"].Value, "pb_sv_kick", true) == 0) {

                                int iBanLength = 0;

                                // NOTE* Punkbuster uses minutes not seconds.
                                if (int.TryParse(mtcMatch.Groups["pb_sv_kick_time"].Value, out iBanLength) == true) {

                                    // If they cannot punish players at all..
                                    if (this.m_sprvPrivileges.CannotPunishPlayers == true) {
                                        sender.SendResponse(packet, PRoConLayerClient.RESPONSE_INSUFFICIENT_PRIVILEGES);
                                        blCommandProcessed = true;
                                    }
                                    // If they can temporary ban but not permanently ban BUT the banlength is over an hour (default)
                                    else if (this.m_sprvPrivileges.CanTemporaryBanPlayers == true && this.m_sprvPrivileges.CanPermanentlyBanPlayers == false && iBanLength > (this.m_prcClient.Variables.GetVariable<int>("TEMP_BAN_CEILING", 3600) / 60)) {
                                        sender.SendResponse(packet, PRoConLayerClient.RESPONSE_INSUFFICIENT_PRIVILEGES);
                                        blCommandProcessed = true;
                                    }
                                    // If they can kick but not temp or perm ban players AND the banlength is over 0 (no ban time)
                                    else if (this.m_sprvPrivileges.CanKickPlayers == true && this.m_sprvPrivileges.CanTemporaryBanPlayers == false && this.m_sprvPrivileges.CanPermanentlyBanPlayers == false && iBanLength > 0) {
                                        sender.SendResponse(packet, PRoConLayerClient.RESPONSE_INSUFFICIENT_PRIVILEGES);
                                        blCommandProcessed = true;
                                    }
                                    // ELSE they have punkbuster access and full ban privs.. issue the command.
                                }
                                else { // Would rather stop it here than pass it on
                                    sender.SendResponse(packet, PRoConLayerClient.RESPONSE_INVALID_ARGUMENTS);

                                    blCommandProcessed = true;
                                }
                            }
                            // ELSE they have permission to issue this command (full or partial)
                        }
                    }

                    // Was not denied above, send it on to the game server.
                    if (blCommandProcessed == false) {
                        this.m_prcClient.SendProconLayerPacket(this, packet);
                    }
                }
                else {
                    sender.SendResponse(packet, PRoConLayerClient.RESPONSE_INVALID_ARGUMENTS);
                }
            }
            else {
                sender.SendResponse(packet, PRoConLayerClient.RESPONSE_LOGIN_REQUIRED);
            }
        }
Example #11
0
        private void Game_RequestBanListAddRecieved(FrostbiteLayerClient sender, Packet packet, CBanInfo newBan) {
            if (this.IsLoggedIn == true) {

                if (newBan.BanLength.Subset == TimeoutSubset.TimeoutSubsetType.Permanent && this.m_sprvPrivileges.CanPermanentlyBanPlayers == true) {
                    this.m_prcClient.SendProconLayerPacket(this, packet);
                }
                else if (newBan.BanLength.Subset == TimeoutSubset.TimeoutSubsetType.Round && this.m_sprvPrivileges.CanTemporaryBanPlayers == true) {
                    this.m_prcClient.SendProconLayerPacket(this, packet);
                }
                else if (newBan.BanLength.Subset == TimeoutSubset.TimeoutSubsetType.Seconds && this.m_sprvPrivileges.CanPermanentlyBanPlayers == true) {
                    this.m_prcClient.SendProconLayerPacket(this, packet);
                }
                else if (newBan.BanLength.Subset == TimeoutSubset.TimeoutSubsetType.Seconds && this.m_sprvPrivileges.CanTemporaryBanPlayers == true) {
                    
                    if (newBan.BanLength.Seconds <= this.m_prcClient.Variables.GetVariable<int>("TEMP_BAN_CEILING", 3600)) {
                        this.m_prcClient.SendProconLayerPacket(this, packet);
                    }
                    else {
                        sender.SendResponse(packet, PRoConLayerClient.RESPONSE_INSUFFICIENT_PRIVILEGES);
                    }
                }
                else {
                    sender.SendResponse(packet, PRoConLayerClient.RESPONSE_INSUFFICIENT_PRIVILEGES);
                }
            }
            else {
                sender.SendResponse(packet, PRoConLayerClient.RESPONSE_LOGIN_REQUIRED);
            }
        }
Example #12
0
 private void Game_RequestPacketSecureSafeListedRecieved(FrostbiteLayerClient sender, Packet packet) {
     if (this.IsLoggedIn == true) {
         this.m_prcClient.SendProconLayerPacket(this, packet);
     }
     else {
         sender.SendResponse(packet, PRoConLayerClient.RESPONSE_LOGIN_REQUIRED);
     }
 }
Example #13
0
        private void Game_RequestEventsEnabled(FrostbiteLayerClient sender, Packet packet, bool eventsEnabled) {
            if (this.IsLoggedIn == true) {
                sender.SendResponse(packet, PRoConLayerClient.RESPONSE_OK);

                this.m_blEventsEnabled = eventsEnabled;
            }
            else {
                sender.SendResponse(packet, PRoConLayerClient.RESPONSE_LOGIN_REQUIRED);
            }
        }
Example #14
0
        private void Game_RequestQuit(FrostbiteLayerClient sender, Packet packet) {
            sender.SendResponse(packet, PRoConLayerClient.RESPONSE_OK);

            if (this.Logout != null) {
                FrostbiteConnection.RaiseEvent(this.Logout.GetInvocationList(), this);
            }

            if (this.Quit != null) {
                FrostbiteConnection.RaiseEvent(this.Quit.GetInvocationList(), this);
            }

            this.Shutdown();
        }
Example #15
0
        private void DispatchProconExecRequest(FrostbiteLayerClient sender, Packet packet) {
            if (this.IsLoggedIn == true) {
                if (this.m_sprvPrivileges.CanIssueAllProconCommands == true) {
                    sender.SendResponse(packet, PRoConLayerClient.RESPONSE_OK);

                    packet.Words.RemoveAt(0);
                    this.m_praApplication.ExecutePRoConCommand(this.m_prcClient, packet.Words, 0);
                }
                else {
                    sender.SendResponse(packet, PRoConLayerClient.RESPONSE_INSUFFICIENT_PRIVILEGES);
                }
            }
            else {
                sender.SendResponse(packet, PRoConLayerClient.RESPONSE_LOGIN_REQUIRED);
            }
        }
Example #16
0
        private void DispatchProconLoginUsernameRequest(FrostbiteLayerClient sender, Packet packet) {
            this.m_strUsername = packet.Words[1];

            // We send back any errors in the login process after they attempt to login.
            if (this.m_praApplication.AccountsList.Contains(this.m_strUsername) == true) {
                this.m_sprvPrivileges = this.GetAccountPrivileges(this.m_strUsername);

                this.m_sprvPrivileges.SetLowestPrivileges(this.m_prcClient.Privileges);

                if (this.m_sprvPrivileges.CanLogin == true) {
                    sender.SendResponse(packet, PRoConLayerClient.RESPONSE_OK);
                }
                else {
                    sender.SendResponse(packet, PRoConLayerClient.RESPONSE_INSUFFICIENT_PRIVILEGES);
                }
            }
            else {
                sender.SendResponse(packet, PRoConLayerClient.RESPONSE_INVALID_USERNAME);
            }
        }
Example #17
0
        private void DispatchProconAccountListAccountsRequest(FrostbiteLayerClient sender, Packet packet) {
            if (this.IsLoggedIn == true) {
                if (this.m_sprvPrivileges.CanIssueLimitedProconCommands == true) {

                    List<string> lstAccounts = new List<string>();
                    lstAccounts.Add(PRoConLayerClient.RESPONSE_OK);

                    foreach (string strAccountName in this.m_praApplication.AccountsList.ListAccountNames()) {
                        if (this.m_prcClient.Layer.AccountPrivileges.Contains(strAccountName) == true) {
                            lstAccounts.Add(strAccountName);
                            lstAccounts.Add(this.m_prcClient.Layer.AccountPrivileges[strAccountName].Privileges.PrivilegesFlags.ToString());
                        }
                    }

                    sender.SendResponse(packet, lstAccounts);
                }
                else {
                    sender.SendResponse(packet, PRoConLayerClient.RESPONSE_INSUFFICIENT_PRIVILEGES);
                }
            }
            else {
                sender.SendResponse(packet, PRoConLayerClient.RESPONSE_LOGIN_REQUIRED);
            }
        }
Example #18
0
        private void DispatchProconRegisterUidRequest(FrostbiteLayerClient sender, Packet packet) {
            
            if (this.IsLoggedIn == true) {
            
                bool blEnabled = true;

                if (bool.TryParse(packet.Words[1], out blEnabled) == true) {

                    if (blEnabled == false) {
                        sender.SendResponse(packet, PRoConLayerClient.RESPONSE_OK);

                        this.ProconEventsUid = String.Empty;
                    }
                    else if (packet.Words.Count >= 3) {

                        if (this.m_prcClient.Layer.LayerClients.isUidUnique(packet.Words[2]) == true) {
                            sender.SendResponse(packet, PRoConLayerClient.RESPONSE_OK);

                            this.ProconEventsUid = packet.Words[2];

                            if (this.UidRegistered != null) {
                                FrostbiteConnection.RaiseEvent(this.UidRegistered.GetInvocationList(), this);
                            }

                        }
                        else {
                            sender.SendResponse(packet, "ProconUidConflict");
                        }
                    }
                }
                else {
                    sender.SendResponse(packet, PRoConLayerClient.RESPONSE_INVALID_ARGUMENTS);
                }
            }
            else {
                sender.SendResponse(packet, PRoConLayerClient.RESPONSE_LOGIN_REQUIRED);
            }
        }
Example #19
0
        private void DispatchProconAccountDeleteRequest(FrostbiteLayerClient sender, Packet packet) {
            if (this.IsLoggedIn == true) {
                if (this.m_sprvPrivileges.CanIssueLimitedProconCommands == true) {
                    if (packet.Words.Count >= 2) {

                        if (this.m_praApplication.AccountsList.Contains(packet.Words[1]) == true) {
                            sender.SendResponse(packet, PRoConLayerClient.RESPONSE_OK);

                            this.m_praApplication.AccountsList.Remove(packet.Words[1]);
                            //this.m_uscParent.LayerDeleteAccount(cpPacket.Words[1]);
                        }
                        else {
                            sender.SendResponse(packet, "AccountDoesNotExists");
                        }
                    }
                    else {
                        sender.SendResponse(packet, PRoConLayerClient.RESPONSE_INVALID_ARGUMENTS);
                    }
                }
                else {
                    sender.SendResponse(packet, PRoConLayerClient.RESPONSE_INSUFFICIENT_PRIVILEGES);
                }
            }
            else {
                sender.SendResponse(packet, PRoConLayerClient.RESPONSE_LOGIN_REQUIRED);
            }
        }
Example #20
0
 private void DispatchProconVersionRequest(FrostbiteLayerClient sender, Packet packet) {
     sender.SendResponse(packet, PRoConLayerClient.RESPONSE_OK, Assembly.GetExecutingAssembly().GetName().Version.ToString());
 }
Example #21
0
        private void DispatchProconBattlemapDeleteZoneRequest(FrostbiteLayerClient sender, Packet packet) {

            if (this.IsLoggedIn == true) {
                if (this.m_sprvPrivileges.CanEditMapZones == true) {
                    if (this.m_prcClient.MapGeometry.MapZones.Contains(packet.Words[1]) == true) {
                        this.m_prcClient.MapGeometry.MapZones.Remove(packet.Words[1]);
                    }

                    sender.SendResponse(packet, PRoConLayerClient.RESPONSE_OK);
                }
                else {
                    sender.SendResponse(packet, PRoConLayerClient.RESPONSE_INSUFFICIENT_PRIVILEGES);
                }
            }
            else {
                sender.SendResponse(packet, PRoConLayerClient.RESPONSE_LOGIN_REQUIRED);
            }
        }
Example #22
0
        private void DispatchProconVarsRequest(FrostbiteLayerClient sender, Packet packet) {

            if (this.IsLoggedIn == true) {

                if (packet.Words.Count == 2) {
                    sender.SendResponse(packet, PRoConLayerClient.RESPONSE_OK, packet.Words[1], this.m_prcClient.Variables.GetVariable<string>(packet.Words[1], ""));
                }
                else if (packet.Words.Count > 2) {

                    if (this.m_sprvPrivileges.CanIssueLimitedProconCommands == true) {

                        this.m_prcClient.Variables.SetVariable(packet.Words[1], packet.Words[2]);

                        sender.SendResponse(packet, PRoConLayerClient.RESPONSE_OK, packet.Words[1], this.m_prcClient.Variables.GetVariable<string>(packet.Words[1], ""));
                    }
                    else {
                        sender.SendResponse(packet, PRoConLayerClient.RESPONSE_INSUFFICIENT_PRIVILEGES);
                    }
                }
                else {
                    sender.SendResponse(packet, PRoConLayerClient.RESPONSE_INVALID_ARGUMENTS);
                }
            }
            else {
                sender.SendResponse(packet, PRoConLayerClient.RESPONSE_LOGIN_REQUIRED);
            }
        }
Example #23
0
        private void DispatchProconBattlemapModifyZonePointsRequest(FrostbiteLayerClient sender, Packet packet) {
            
            if (this.IsLoggedIn == true) {
                if (this.m_sprvPrivileges.CanEditMapZones == true) {

                    if (packet.Words.Count >= 3) {

                        int iPoints = 0;

                        if (int.TryParse(packet.Words[2], out iPoints) == true) {

                            Point3D[] points = new Point3D[iPoints];

                            for (int i = 0; i < iPoints && i + 3 < packet.Words.Count; i++) {
                                points[i] = new Point3D(packet.Words[2 + i * 3 + 1], packet.Words[2 + i * 3 + 2], packet.Words[2 + i * 3 + 3]);
                            }

                            if (this.m_prcClient.MapGeometry.MapZones.Contains(packet.Words[1]) == true) {
                                this.m_prcClient.MapGeometry.MapZones.ModifyMapZonePoints(packet.Words[1], points);
                            }
                        }

                        sender.SendResponse(packet, PRoConLayerClient.RESPONSE_OK);
                    }
                    else {
                        sender.SendResponse(packet, PRoConLayerClient.RESPONSE_INVALID_ARGUMENTS);
                    }
                }
                else {
                    sender.SendResponse(packet, PRoConLayerClient.RESPONSE_INSUFFICIENT_PRIVILEGES);
                }
            }
            else {
                sender.SendResponse(packet, PRoConLayerClient.RESPONSE_LOGIN_REQUIRED);
            }
        }
Example #24
0
        private void DispatchProconPrivilegesRequest(FrostbiteLayerClient sender, Packet packet) {

            if (this.IsLoggedIn == true) {
                sender.SendResponse(packet, PRoConLayerClient.RESPONSE_OK, this.m_sprvPrivileges.PrivilegesFlags.ToString());
            }
            else {
                sender.SendResponse(packet, PRoConLayerClient.RESPONSE_LOGIN_REQUIRED);
            }
        }
Example #25
0
        private void DispatchProconLayerSetPrivilegesRequest(FrostbiteLayerClient sender, Packet packet) {
            if (this.IsLoggedIn == true) {
                if (this.m_sprvPrivileges.CanIssueLimitedProconCommands == true) {

                    UInt32 ui32Privileges = 0;

                    if (packet.Words.Count >= 3 && UInt32.TryParse(packet.Words[2], out ui32Privileges) == true) {

                        if (this.m_praApplication.AccountsList.Contains(packet.Words[1]) == true) {

                            CPrivileges sprvPrivs = new CPrivileges();

                            sender.SendResponse(packet, PRoConLayerClient.RESPONSE_OK);

                            sprvPrivs.PrivilegesFlags = ui32Privileges;
                            this.m_prcClient.Layer.AccountPrivileges[packet.Words[1]].SetPrivileges(sprvPrivs);
                        }
                        else {
                            sender.SendResponse(packet, "AccountDoesNotExists");
                        }
                    }
                    else {
                        sender.SendResponse(packet, PRoConLayerClient.RESPONSE_INVALID_ARGUMENTS);
                    }
                }
                else {
                    sender.SendResponse(packet, PRoConLayerClient.RESPONSE_INSUFFICIENT_PRIVILEGES);
                }
            }
            else {
                sender.SendResponse(packet, PRoConLayerClient.RESPONSE_LOGIN_REQUIRED);
            }
        }
Example #26
0
        private void DispatchProconCompressionRequest(FrostbiteLayerClient sender, Packet packet) {
            if (this.IsLoggedIn == true) {

                bool enableCompress = false;

                if (packet.Words.Count == 2 && bool.TryParse(packet.Words[1], out enableCompress) == true) {
                    this.GzipCompression = enableCompress;
                    
                    sender.SendResponse(packet, PRoConLayerClient.RESPONSE_OK);
                }
                else {
                    sender.SendResponse(packet, PRoConLayerClient.RESPONSE_INVALID_ARGUMENTS);
                }
            }
            else {
                sender.SendResponse(packet, PRoConLayerClient.RESPONSE_LOGIN_REQUIRED);
            }
        }
Example #27
0
        private void DispatchProconPluginListEnabledRequest(FrostbiteLayerClient sender, Packet packet) {
            if (this.IsLoggedIn == true) {
                if (this.m_sprvPrivileges.CanIssueLimitedProconPluginCommands == true) {
                    List<string> lstEnabledPlugins = this.m_prcClient.PluginsManager.Plugins.EnabledClassNames;
                    lstEnabledPlugins.Insert(0, PRoConLayerClient.RESPONSE_OK);

                    sender.SendResponse(packet, lstEnabledPlugins);
                }
                else {
                    sender.SendResponse(packet, PRoConLayerClient.RESPONSE_INSUFFICIENT_PRIVILEGES);
                }
            }
            else {
                sender.SendResponse(packet, PRoConLayerClient.RESPONSE_LOGIN_REQUIRED);
            }
        }
Example #28
0
        private void DispatchProconPackagesInstallRequest(FrostbiteLayerClient sender, Packet packet) {
            if (this.IsLoggedIn == true) {
                if (packet.Words.Count == 4) {
                    if (this.m_sprvPrivileges.CanIssueAllProconCommands == true) {

                        // Register the package as psuedo-known
                        this.m_praApplication.PackageManager.RemotePackages.AddPackage(new Package(packet.Words[1], packet.Words[2], packet.Words[3]));

                        if (this.m_praApplication.PackageManager.CanDownloadPackage(packet.Words[1]) == true) {
                            sender.SendResponse(packet, PRoConLayerClient.RESPONSE_OK);

                            this.m_praApplication.PackageManager.DownloadInstallPackage(packet.Words[1], false);
                        }
                        else {
                            sender.SendResponse(packet, PRoConLayerClient.RESPONSE_PACKAGE_ALREADYINSTALLED);
                        }
                    }
                    else {
                        sender.SendResponse(packet, PRoConLayerClient.RESPONSE_INSUFFICIENT_PRIVILEGES);
                    }
                }
                else {
                    sender.SendResponse(packet, PRoConLayerClient.RESPONSE_INVALID_ARGUMENTS);
                }
            }
            else {
                sender.SendResponse(packet, PRoConLayerClient.RESPONSE_LOGIN_REQUIRED);
            }
        }
Example #29
0
        private void DispatchProconPluginSetVariableRequest(FrostbiteLayerClient sender, Packet packet) {
            if (this.IsLoggedIn == true) {
                if (this.m_sprvPrivileges.CanIssueLimitedProconPluginCommands == true) {

                    if (packet.Words.Count >= 4) {

                        sender.SendResponse(packet, PRoConLayerClient.RESPONSE_OK);

                        this.m_prcClient.PluginsManager.SetPluginVariable(packet.Words[1], packet.Words[2], packet.Words[3]);
                    }
                    else {
                        sender.SendResponse(packet, PRoConLayerClient.RESPONSE_INVALID_ARGUMENTS);
                    }
                }
                else {
                    sender.SendResponse(packet, PRoConLayerClient.RESPONSE_INSUFFICIENT_PRIVILEGES);
                }
            }
            else {
                sender.SendResponse(packet, PRoConLayerClient.RESPONSE_LOGIN_REQUIRED);
            }
        }
Example #30
0
        private void Game_RequestLoginPlainText(FrostbiteLayerClient sender, Packet packet, string password) {

            if (this.m_praApplication.AccountsList.Contains(this.m_strUsername) == false) {
                sender.SendResponse(packet, PRoConLayerClient.RESPONSE_INVALID_USERNAME);
            }
            else {

                if (this.AuthenticatePlaintextAccount(this.m_strUsername, password) == true) {

                    this.IsLoggedIn = true;
                    sender.SendResponse(packet, PRoConLayerClient.RESPONSE_OK);

                    if (this.Login != null) {
                        FrostbiteConnection.RaiseEvent(this.Login.GetInvocationList(), this);
                    }
                }
                else {
                    sender.SendResponse(packet, PRoConLayerClient.RESPONSE_INVALID_PASSWORD);
                }
            } 
        }