コード例 #1
0
ファイル: PRoConLayerClient.cs プロジェクト: Gneuh/Procon-1
 private void Game_RequestHelp(FrostbiteLayerClient sender, Packet packet) {
     // TO DO: Edit on way back with additional commands IF NOT PRESENT.
     this.m_prcClient.SendProconLayerPacket(this, packet);
 }
コード例 #2
0
ファイル: PRoConLayerClient.cs プロジェクト: Gneuh/Procon-1
        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);
            }
        }
コード例 #3
0
ファイル: PRoConLayerClient.cs プロジェクト: Gneuh/Procon-1
        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);
            }
        }
コード例 #4
0
ファイル: PRoConLayerClient.cs プロジェクト: Gneuh/Procon-1
        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);
            }
        }
コード例 #5
0
ファイル: PRoConLayerClient.cs プロジェクト: Gneuh/Procon-1
        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);
            }
        }
コード例 #6
0
ファイル: PRoConLayerClient.cs プロジェクト: Gneuh/Procon-1
        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);
            }
        }
コード例 #7
0
ファイル: PRoConLayerClient.cs プロジェクト: Gneuh/Procon-1
        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);
            }
        }
コード例 #8
0
ファイル: PRoConLayerClient.cs プロジェクト: Gneuh/Procon-1
 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);
     }
 }
コード例 #9
0
ファイル: PRoConLayerClient.cs プロジェクト: Gneuh/Procon-1
 private void Game_ConnectionClosed(FrostbiteLayerClient sender) {
     if (this.ClientShutdown != null) {
         FrostbiteConnection.RaiseEvent(this.ClientShutdown.GetInvocationList(), this);
     }
 }
コード例 #10
0
ファイル: PRoConLayerClient.cs プロジェクト: Gneuh/Procon-1
        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);
            }
        }
コード例 #11
0
ファイル: PRoConLayerClient.cs プロジェクト: Gneuh/Procon-1
 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);
     }
 }
コード例 #12
0
ファイル: PRoConLayerClient.cs プロジェクト: Gneuh/Procon-1
        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);
            }
        }
コード例 #13
0
ファイル: PRoConLayerClient.cs プロジェクト: Gneuh/Procon-1
 private void Game_RequestPacketUnsecureSafeListedRecieved(FrostbiteLayerClient sender, Packet packet) {
     
     if (packet.Words.Count >= 1 && String.Compare(packet.Words[0], "serverInfo", true) == 0) {
         this.m_ui32ServerInfoSequenceNumber = packet.SequenceNumber;
     }
     
     this.m_prcClient.SendProconLayerPacket(this, packet);
 }
コード例 #14
0
ファイル: PRoConLayerClient.cs プロジェクト: Gneuh/Procon-1
 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);
     }
 }
コード例 #15
0
ファイル: PRoConLayerClient.cs プロジェクト: Gneuh/Procon-1
        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);
            }
        }
コード例 #16
0
ファイル: PRoConLayerClient.cs プロジェクト: Gneuh/Procon-1
        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);
            }
        }
コード例 #17
0
ファイル: PRoConLayerClient.cs プロジェクト: Gneuh/Procon-1
        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);
            }
        }
コード例 #18
0
ファイル: PRoConLayerClient.cs プロジェクト: Gneuh/Procon-1
        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);
            }
        }
コード例 #19
0
ファイル: PRoConLayerClient.cs プロジェクト: Gneuh/Procon-1
        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);
            }
        }
コード例 #20
0
ファイル: PRoConLayerClient.cs プロジェクト: Gneuh/Procon-1
 private void DispatchProconVersionRequest(FrostbiteLayerClient sender, Packet packet) {
     sender.SendResponse(packet, PRoConLayerClient.RESPONSE_OK, Assembly.GetExecutingAssembly().GetName().Version.ToString());
 }
コード例 #21
0
ファイル: PRoConLayerClient.cs プロジェクト: Gneuh/Procon-1
        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);
            }
        }
コード例 #22
0
ファイル: PRoConLayerClient.cs プロジェクト: Gneuh/Procon-1
        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);
            }
        }
コード例 #23
0
ファイル: PRoConLayerClient.cs プロジェクト: Gneuh/Procon-1
        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);
            }
        }
コード例 #24
0
ファイル: PRoConLayerClient.cs プロジェクト: Gneuh/Procon-1
        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);
            }
        }
コード例 #25
0
ファイル: PRoConLayerClient.cs プロジェクト: Gneuh/Procon-1
        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);
            }
        }
コード例 #26
0
ファイル: PRoConLayerClient.cs プロジェクト: Gneuh/Procon-1
        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);
            }
        }
コード例 #27
0
ファイル: PRoConLayerClient.cs プロジェクト: Gneuh/Procon-1
        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);
            }
        }
コード例 #28
0
ファイル: PRoConLayerClient.cs プロジェクト: Gneuh/Procon-1
        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);
            }
        }
コード例 #29
0
ファイル: PRoConLayerClient.cs プロジェクト: Gneuh/Procon-1
        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);
            }
        }
コード例 #30
0
ファイル: PRoConLayerClient.cs プロジェクト: Gneuh/Procon-1
        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);
            }
        }