/* * private int GetTempBanCeiling() { * int iReturn = 3600; * * if (this.m_uscConnectionPanel != null && this.m_uscConnectionPanel.SV_Variables.ContainsKey("TEMP_BAN_CEILING") == true) { * if (int.TryParse(this.m_uscConnectionPanel.SV_Variables["TEMP_BAN_CEILING"], out iReturn) == false) { * iReturn = 3600; * } * } * // else return 3600 * * return iReturn; * } */ public void SetPrivileges(CPrivileges spPrivileges) { this.m_spPrivileges = spPrivileges; //this.Enabled = !this.m_spPrivileges.CannotPunishPlayers; this.rdoKick.Enabled = this.m_spPrivileges.CanKickPlayers; this.rdoTemporaryBan.Enabled = this.m_spPrivileges.CanTemporaryBanPlayers; this.rdoPermanentlyBan.Enabled = this.m_spPrivileges.CanPermanentlyBanPlayers; if (this.rdoPermanentlyBan.Enabled == false && this.rdoPermanentlyBan.Checked == true) { this.rdoTemporaryBan.Checked = true; } if (this.rdoTemporaryBan.Enabled == false && this.rdoTemporaryBan.Checked == true) { this.rdoKick.Checked = true; } if (this.rdoKick.Enabled == false && this.rdoKick.Checked == true) { this.rdoKill.Checked = true; } if (this.rdoKill.Enabled == false && this.rdoKill.Checked == true) { this.rdoKill.Checked = false; } if (this.rdoKill.Checked == false && this.rdoKick.Checked == false && this.rdoTemporaryBan.Checked == false && this.rdoPermanentlyBan.Checked == false) { this.rdoKill.Checked = true; } }
private void ShowLayerPanel(Panel pnlShow) { this.pnlMainLayerServer.Hide(); this.pnlAccountPrivileges.Hide(); this.m_blEditingPrivileges = false; if (pnlShow == this.pnlMainLayerServer) { this.lsvLayerAccounts.SelectedItems.Clear(); } else if (pnlShow == this.pnlAccountPrivileges) { this.m_blEditingPrivileges = true; if (this.lsvLayerAccounts.SelectedItems.Count > 0) { this.uscPrivileges.AccountName = this.lsvLayerAccounts.SelectedItems[0].Text; } if (this.lsvLayerAccounts.SelectedItems.Count > 0) { CPrivileges spPrivs = (CPrivileges)this.lsvLayerAccounts.SelectedItems[0].SubItems[1].Tag; this.uscPrivileges.Privileges = spPrivs; } else { this.uscPrivileges.Privileges = new CPrivileges(); } } pnlShow.Show(); }
public CPrivileges CollectLowestPrivileges(string strAccountName) { CPrivileges spLowestPrivileges = new CPrivileges(); if (this.m_paProcon.AccountsList.Contains(strAccountName) == true) { spLowestPrivileges.PrivilegesFlags = CPrivileges.FullPrivilegesFlags; foreach (PRoConClient prcClient in this.m_paProcon.Connections) { if (prcClient.Layer != null && prcClient.Layer.AccountPrivileges.Contains(strAccountName) == true) { spLowestPrivileges.SetLowestPrivileges(prcClient.Layer.AccountPrivileges[strAccountName].Privileges); } } //if (this.m_paProcon.AccountsList.Contains(strAccountName) == true) { // foreach (AccountPrivilege apPrivilege in this.m_paProcon.AccountsList[strAccountName].AccountPrivileges) { // } //} } return(spLowestPrivileges); }
public void SetPrivileges(CPrivileges cpUpdatedPrivileges) { Privileges = cpUpdatedPrivileges; if (AccountPrivilegesChanged != null) { this.AccountPrivilegesChanged(this); } }
void m_prcClient_ProconPrivileges(PRoConClient sender, CPrivileges spPrivs) { this.InvokeIfRequired(() => { this.m_isConnectionValid = true; this.RequestInitialSettings(); }); }
public bool HasValidPermissions(CPrivileges privileges) { bool canExecuteCommand = false; if (this.ExecutionScope == ExecutionScope.All) { canExecuteCommand = true; } else if (this.ExecutionScope == ExecutionScope.Account) { if (privileges != null) { canExecuteCommand = true; } } else if (this.ExecutionScope == ExecutionScope.Privileges) { if (privileges != null && privileges.Has(this.RequiredPrivileges) == true) { canExecuteCommand = true; } } return(canExecuteCommand); }
public void SetPrivileges(CPrivileges cpUpdatedPrivileges) { this.Privileges = cpUpdatedPrivileges; if (this.AccountPrivilegesChanged != null) { FrostbiteConnection.RaiseEvent(this.AccountPrivilegesChanged.GetInvocationList(), this); } }
public uscPlayerPunishPanel() { InitializeComponent(); this.cboTimeMultiplier.SelectedIndex = 0; this.m_spPrivileges = new CPrivileges(); this.m_spPrivileges.PrivilegesFlags = CPrivileges.FullPrivilegesFlags; }
public void SetPrivileges(CPrivileges cpUpdatedPrivileges) { Privileges = cpUpdatedPrivileges; if (AccountPrivilegesChanged != null) { FrostbiteConnection.RaiseEvent(AccountPrivilegesChanged.GetInvocationList(), this); } }
private void uscPrivileges_OnUpdatePrivileges(string strAccountName, CPrivileges spUpdatedPrivs) { if (this.lsvLayerAccounts.SelectedItems.Count > 0) { this.WaitForSettingResponse("procon.layer.setPrivileges"); this.m_prcClient.SendProconLayerSetPrivilegesPacket(this.lsvLayerAccounts.SelectedItems[0].Text, spUpdatedPrivs.PrivilegesFlags); } this.ShowLayerPanel(this.pnlMainLayerServer); }
private void m_prcClient_ProconPrivileges(PRoConClient sender, CPrivileges spPrivs) { this.m_prcClient.SendProconBattlemapListZonesPacket(); this.m_prcClient.SendGetProconVarsPacket("ZONE_TAG_LIST"); if ((this.tsbMapZonesTools.Enabled = spPrivs.CanEditMapZones) == false) { this.tsbPointer.Checked = true; } }
public CPrivileges GetAccountPrivileges(string strAccountName) { CPrivileges spReturn = default(CPrivileges); if (this.m_delGetAccountPrivileges != null) { spReturn = this.m_delGetAccountPrivileges(strAccountName); } return(spReturn); }
void uscPrivileges_OnUpdatePrivileges(string strAccountName, CPrivileges spUpdatedPrivs) { if (this._client.Layer.AccountPrivileges.Contains(strAccountName) == true) { this._client.Layer.AccountPrivileges[strAccountName].SetPrivileges(spUpdatedPrivs); } this.ShowLayerPanel(this.pnlMainLayerServer); this.RefreshLayerPrivilegesPanel(); }
public CPrivileges GetAccountPrivileges(string accountName) { CPrivileges spReturn = default(CPrivileges); if (_getAccountPrivilegesDelegate != null) { spReturn = _getAccountPrivilegesDelegate(accountName); } return(spReturn); }
private void m_prcClient_ProconPrivileges(PRoConClient sender, CPrivileges spPrivs) { this.InvokeIfRequired(() => { this.m_privileges = spPrivs; this.lsvMaplistPool.Enabled = this.m_privileges.CanEditMapList; this.pnlMaplistAddMap.Enabled = this.m_privileges.CanEditMapList; this.lnkMaplistChangePlaylist.Enabled = this.m_privileges.CanEditMapList; // The main map list though can be used if the user can use map functions (skip map, restart etc) this.lsvMaplist.Enabled = this.m_privileges.CanEditMapList || this.m_privileges.CanUseMapFunctions; }); }
private void RefreshLayerPrivilegesPanel() { foreach (ListViewItem lviItem in this.lsvLayerAccounts.Items) { if (lviItem.SubItems[1].Tag != null && this.m_clocLanguage != null && this.m_prcClient != null) { if (this.m_prcClient.Layer.AccountPrivileges.Contains(lviItem.Text) == true) { CPrivileges spDetails = this.m_prcClient.Layer.AccountPrivileges[lviItem.Text].Privileges; if (spDetails.HasNoRconAccess == true) { lviItem.SubItems["rconaccess"].Text = this.m_clocLanguage.GetLocalized("uscAccountsPanel.lstLayerAccounts.Privileges.None", null); } else if (spDetails.HasLimitedRconAccess == true) { lviItem.SubItems["rconaccess"].Text = this.m_clocLanguage.GetLocalized("uscAccountsPanel.lstLayerAccounts.Privileges.Limited", null); } else { lviItem.SubItems["rconaccess"].Text = this.m_clocLanguage.GetLocalized("uscAccountsPanel.lstLayerAccounts.Privileges.Full", null); } if (spDetails.HasNoLocalAccess == true) { lviItem.SubItems["localaccess"].Text = this.m_clocLanguage.GetLocalized("uscAccountsPanel.lstLayerAccounts.Privileges.None", null); } else if (spDetails.HasLimitedLocalAccess == true) { lviItem.SubItems["localaccess"].Text = this.m_clocLanguage.GetLocalized("uscAccountsPanel.lstLayerAccounts.Privileges.Limited", null); } else { lviItem.SubItems["localaccess"].Text = this.m_clocLanguage.GetLocalized("uscAccountsPanel.lstLayerAccounts.Privileges.Full", null); } } } } if (this.m_blEditingPrivileges == true) { this.ShowLayerPanel(this.pnlAccountPrivileges); } foreach (ColumnHeader ch in this.lsvLayerAccounts.Columns) { ch.Width = -2; } }
private const int INT_MAX_TEAMS = 5; //0 = neutral, 1, 2, 3, 4.. public uscPlayerListPanel() { InitializeComponent(); this.m_clocLanguage = null; this.m_lvwColumnSorter = new PlayerListColumnSorter(); this.m_frmMain = null; this.m_uscConnectionPanel = null; this.m_spPrivileges = new CPrivileges(); this.m_spPrivileges.PrivilegesFlags = CPrivileges.FullPrivilegesFlags; this.spltListAdditionalInfo.Panel2Collapsed = true; this.spltTwoSplit.Panel2Collapsed = true; this.spltFourSplit.Panel2Collapsed = true; }
private void SendYellResponse(string strScope, string strAccountName, string strMessage) { if (String.Compare(strScope, this.m_strPrivatePrefix) == 0) { this.ExecuteCommand("procon.protected.send", "admin.yell", strMessage, (this.m_iRuleDisplayTime / this.m_iTimeDivider).ToString(), "player", strAccountName); } else if (String.Compare(strScope, this.m_strPublicPrefix) == 0) { CPrivileges cpAccount = null; cpAccount = this.GetAccountPrivileges(strAccountName); if (cpAccount != null && cpAccount.PrivilegesFlags > 0) { this.ExecuteCommand("procon.protected.send", "admin.yell", strMessage, (this.m_iRuleDisplayTime / this.m_iTimeDivider).ToString(), "all"); } } }
private void SendSayResponse(string strScope, string strAccountName, string strMessage) { if (String.Compare(strScope, this.m_strPrivatePrefix) == 0) { this.ExecuteCommand("procon.protected.send", "admin.say", strMessage, "player", strAccountName); } else if (String.Compare(strScope, this.m_strPublicPrefix) == 0) { CPrivileges cpAccount = null; cpAccount = this.GetAccountPrivileges(strAccountName); if (cpAccount != null && cpAccount.PrivilegesFlags > 0) { this.ExecuteCommand("procon.protected.send", "admin.say", strMessage, "all"); } } }
public uscMaplist() { InitializeComponent(); this.SetStyle(ControlStyles.UserPaint, true); this.SetStyle(ControlStyles.AllPaintingInWmPaint, true); this.SetStyle(ControlStyles.DoubleBuffer, true); this.AsyncSettingControls.Add("local.playlist.change", new AsyncStyleSetting(this.picMaplistChangePlaylist, this.lsvMaplist, new Control[] { this.pnlMaplistAddMap, this.lsvMaplist }, true)); this.AsyncSettingControls.Add("local.maplist.change", new AsyncStyleSetting(this.picMaplistAlterMaplist, this.lsvMaplist, new Control[] { this.pnlMaplistAddMap, this.lsvMaplist }, true)); this.m_blSettingAppendingSingleMap = false; this.AsyncSettingControls.Add("local.maplist.append", new AsyncStyleSetting(this.picMaplistAppendMap, this.lsvMaplist, new Control[] { this.lblMaplistPool }, true)); //this.AsyncSettingControls.Add("local.maplist.setnextlevel", new AsyncStyleSetting(this.picMaplistAppendMap, this.lsvMaplist, new Control[] { this.lblMaplistPool, this.lnkMaplistAddMapToList, this.lnkMaplistSetNextMap }, true)); this.m_privileges = new CPrivileges(CPrivileges.FullPrivilegesFlags); }
private void btnSavePrivileges_Click(object sender, EventArgs e) { UInt32 i = 0; i |= (1 & Convert.ToUInt32(this.chkAllowConnectionLogin.Checked)); i |= (1 & Convert.ToUInt32(this.chkAlterServerSettings.Checked)) << 1; i |= (1 & Convert.ToUInt32(this.chkChangeCurrentMapFunctions.Checked)) << 2; i |= (1 & Convert.ToUInt32(this.rdoNoPlayerPunishment.Checked)) << 3; i |= (1 & Convert.ToUInt32(this.rdoKickingPlayers.Checked)) << 4; i |= (1 & Convert.ToUInt32(this.rdoKickingTemporaryOnly.Checked)) << 5; i |= (1 & Convert.ToUInt32(this.rdoKicingTemporaryPermanent.Checked)) << 6; i |= (1 & Convert.ToUInt32(this.rdoNotAllowedToIssuePunkbusterCommands.Checked)) << 7; i |= (1 & Convert.ToUInt32(this.rdoLimitedPunkbusterAccess.Checked)) << 8; i |= (1 & Convert.ToUInt32(this.rdoFullPunkbusterAccess.Checked)) << 9; i |= (1 & Convert.ToUInt32(this.chkEditMapList.Checked)) << 10; i |= (1 & Convert.ToUInt32(this.chkEditBanList.Checked)) << 11; i |= (1 & Convert.ToUInt32(this.chkEditReservedSlotsList.Checked)) << 12; i |= (1 & Convert.ToUInt32(this.rdoNoProconAccess.Checked)) << 13; i |= (1 & Convert.ToUInt32(this.rdoLimitedProconAccess.Checked)) << 14; i |= (1 & Convert.ToUInt32(this.rdoFullProconAccess.Checked)) << 15; // 0.3.4.0 additions i |= (1 & Convert.ToUInt32(this.rdoKillingPlayersOnly.Checked)) << 16; i |= (1 & Convert.ToUInt32(this.rdoLimitedProconPluginAccess.Checked)) << 17; i |= (1 & Convert.ToUInt32(this.chkMovePlayers.Checked)) << 18; // 0.5.4.0 additions i |= (1 & Convert.ToUInt32(this.chkEditMapZones.Checked)) << 19; // 0.6.0.0 additions i |= (1 & Convert.ToUInt32(this.chkEditTextModerationList.Checked)) << 20; i |= (1 & Convert.ToUInt32(this.chkCanShutdownServer.Checked)) << 21; CPrivileges spUpdatedPrivileges = new CPrivileges(); spUpdatedPrivileges.PrivilegesFlags = i; // TO DO: Event Privileges set () if (this.OnUpdatePrivileges != null) { this.OnUpdatePrivileges(this.m_strEditingAccountName, spUpdatedPrivileges); } }
public void OnCommandHelpSpecific(string strSpeaker, string strText, MatchCommand mtcCommand, CapturedCommand capCommand, CPlayerSubset subMatchedScope) { List <MatchCommand> lstCommands = this.GetRegisteredCommands(); CPrivileges privileges = this.GetAccountPrivileges(strSpeaker); foreach (MatchCommand mtcLoopedCommand in lstCommands) { if (String.Compare(mtcLoopedCommand.Command, capCommand.MatchedArguments[0].Argument, true) == 0 && mtcLoopedCommand.Requirements.HasValidPermissions(privileges) == true) { foreach (string strLine in this.WordWrap(String.Format("> {0}; {1}", mtcLoopedCommand.ToString(), mtcLoopedCommand.Description), 100)) { this.ExecuteCommand("procon.protected.send", "admin.say", strLine, "player", strSpeaker); } } } }
private List <string> GetExcludedCommandStrings(string strAccountName) { List <string> lstReturnCommandStrings = new List <string>(); List <MatchCommand> lstCommands = this.GetRegisteredCommands(); CPrivileges privileges = this.GetAccountPrivileges(strAccountName); foreach (MatchCommand mtcCommand in lstCommands) { if (mtcCommand.Requirements.HasValidPermissions(privileges) == true && lstReturnCommandStrings.Contains(mtcCommand.Command) == false) { lstReturnCommandStrings.Add(mtcCommand.Command); } } return(lstReturnCommandStrings); }
void uscSetPrivileges_OnUpdatePrivileges(string strAccountName, CPrivileges spUpdatedPrivs) { this.ShowPanel(this.pnlEditingUser); if (this.m_paProcon.AccountsList.Contains(strAccountName) == true) { foreach (PRoConClient prcClient in this.m_paProcon.Connections) { if (prcClient.Layer.AccountPrivileges.Contains(strAccountName) == true) { prcClient.Layer.AccountPrivileges[strAccountName].SetPrivileges(spUpdatedPrivs); } } } //if (this.AccountPrivilegesChanged != null) { // this.AccountPrivilegesChanged(this, new AccountEventArgs(strAccountName, spUpdatedPrivs, "")); //} }
private void m_prcConnection_ProconPrivileges(PRoConClient sender, CPrivileges spPrivs) { if (spPrivs.CanIssueLimitedProconPluginCommands == true && this.tbcClientTabs.TabPages.Contains(this.m_tabParentLayerControl) == false) { this.tbcClientTabs.TabPages.Add(this.m_tabParentLayerControl); this.m_tabParentLayerControl.ImageKey = "sitemap_color.png"; /* * this.m_prcConnection.SendCommand(new List<string> { "procon.account.listAccounts" }); * this.m_prcConnection.SendCommand(new List<string> { "procon.account.listLoggedIn" }); * * this.m_prcConnection.SendCommand(new List<string> { "procon.plugin.listLoaded" }); * this.m_prcConnection.SendCommand(new List<string> { "procon.plugin.listEnabled" }); */ } else if (spPrivs.CanIssueLimitedProconCommands == false && this.tbcClientTabs.TabPages.Contains(this.m_tabParentLayerControl) == true) { this.tbcClientTabs.TabPages.Remove(this.m_tabParentLayerControl); } if (this.m_praApplication.OptionsSettings.LayerHideLocalPlugins == true) { this.tbcClientTabs.TabPages.Remove(this.tabPlugins); // this.tabPlugins.Hide(); } if (this.m_praApplication.OptionsSettings.LayerHideLocalAccounts == true) { this.tbcClientTabs.TabPages.Remove(this.tabAccounts); // this.tabAccounts.Hide(); } this.pnlMapControls.Visible = spPrivs.CanUseMapFunctions; this.m_prcConnection.SendGetProconVarsPacket("TEMP_BAN_CEILING"); //this.m_prcConnection.SendRequest(new List<string> { "procon.vars", "TEMP_BAN_CEILING" }); }
private void Game_RequestLoginHashedPassword(FrostbiteLayerClient sender, Packet packet, string hashedPassword) { if (this.m_praApplication.AccountsList.Contains(this.m_strUsername) == false) { sender.SendResponse(packet, PRoConLayerClient.RESPONSE_INVALID_USERNAME); } else { if (this.AuthenticateHashedAccount(this.m_strUsername, hashedPassword) == true) { this.m_sprvPrivileges = this.GetAccountPrivileges(this.m_strUsername); this.m_sprvPrivileges.SetLowestPrivileges(this.m_prcClient.Privileges); if (this.m_sprvPrivileges.CanLogin == 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_INSUFFICIENT_PRIVILEGES); } } else { sender.SendResponse(packet, PRoConLayerClient.RESPONSE_INVALID_PASSWORD_HASH); } } }
void uscPrivileges_OnUpdatePrivileges(string strAccountName, CPrivileges spUpdatedPrivs) { //this.SetLayerAccountPrivileges(strAccountName, spUpdatedPrivs); if (this.m_prcClient.Layer.AccountPrivileges.Contains(strAccountName) == true) { this.m_prcClient.Layer.AccountPrivileges[strAccountName].SetPrivileges(spUpdatedPrivs); } this.ShowLayerPanel(this.pnlMainLayerServer); this.RefreshLayerPrivilegesPanel(); }
private bool HandleEventPacket(Packet cpBeforePacketDispatch, bool blCancelPacket) { if (cpBeforePacketDispatch.Words.Count >= 1 && String.Compare(cpBeforePacketDispatch.Words[0], "procon.shutdown", true) == 0) { //this.SendPacket(new Packet(true, true, cpBeforePacketDispatch.SequenceNumber, new List<string>() { "OK" })); this.State = ConnectionState.Error; this.Connection_ConnectionFailure(this.Game.Connection, new Exception("The PRoCon layer has been shutdown by the host")); this.Shutdown(); blCancelPacket = true; } else if (cpBeforePacketDispatch.Words.Count >= 2 && String.Compare(cpBeforePacketDispatch.Words[0], "procon.account.onLogin", true) == 0) { //this.SendPacket(new Packet(true, true, cpBeforePacketDispatch.SequenceNumber, new List<string>() { "OK" })); // Also able to get their privs as well if needed? //this.m_uscParent.OnRemoteAccountLoggedIn(cpBeforePacketDispatch.Words[1], true); if (this.RemoteAccountLoggedIn != null) { FrostbiteConnection.RaiseEvent(this.RemoteAccountLoggedIn.GetInvocationList(), this, cpBeforePacketDispatch.Words[1], true); } blCancelPacket = true; } else if (cpBeforePacketDispatch.Words.Count >= 2 && String.Compare(cpBeforePacketDispatch.Words[0], "procon.account.onLogout", true) == 0) { //this.SendPacket(new Packet(true, true, cpBeforePacketDispatch.SequenceNumber, new List<string>() { "OK" })); if (this.RemoteAccountLoggedIn != null) { FrostbiteConnection.RaiseEvent(this.RemoteAccountLoggedIn.GetInvocationList(), this, cpBeforePacketDispatch.Words[1], false); } blCancelPacket = true; } else if (cpBeforePacketDispatch.Words.Count >= 3 && String.Compare(cpBeforePacketDispatch.Words[0], "procon.account.onUidRegistered", true) == 0) { if (this.m_dicUsernamesToUids.ContainsKey(cpBeforePacketDispatch.Words[2]) == true) { this.m_dicUsernamesToUids[cpBeforePacketDispatch.Words[2]] = cpBeforePacketDispatch.Words[1]; } else { this.m_dicUsernamesToUids.Add(cpBeforePacketDispatch.Words[2], cpBeforePacketDispatch.Words[1]); } blCancelPacket = true; } else if (cpBeforePacketDispatch.Words.Count >= 2 && String.Compare(cpBeforePacketDispatch.Words[0], "procon.account.onCreated", true) == 0) { //this.SendPacket(new Packet(true, true, cpBeforePacketDispatch.SequenceNumber, new List<string>() { "OK" })); if (this.RemoteAccountCreated != null) { FrostbiteConnection.RaiseEvent(this.RemoteAccountCreated.GetInvocationList(), this, cpBeforePacketDispatch.Words[1]); } blCancelPacket = true; } else if (cpBeforePacketDispatch.Words.Count >= 2 && String.Compare(cpBeforePacketDispatch.Words[0], "procon.account.onDeleted", true) == 0) { //this.SendPacket(new Packet(true, true, cpBeforePacketDispatch.SequenceNumber, new List<string>() { "OK" })); if (this.RemoteAccountDeleted != null) { FrostbiteConnection.RaiseEvent(this.RemoteAccountDeleted.GetInvocationList(), this, cpBeforePacketDispatch.Words[1]); } blCancelPacket = true; } else if (cpBeforePacketDispatch.Words.Count >= 3 && String.Compare(cpBeforePacketDispatch.Words[0], "procon.account.onAltered", true) == 0) { //this.SendPacket(new Packet(true, true, cpBeforePacketDispatch.SequenceNumber, new List<string>() { "OK" })); UInt32 ui32Privileges = 0; if (UInt32.TryParse(cpBeforePacketDispatch.Words[2], out ui32Privileges) == true) { CPrivileges spPrivs = new CPrivileges(); spPrivs.PrivilegesFlags = ui32Privileges; if (this.ProconPrivileges != null && String.Compare(cpBeforePacketDispatch.Words[1], this.Username) == 0) { this.Privileges = spPrivs; FrostbiteConnection.RaiseEvent(this.ProconPrivileges.GetInvocationList(), this, spPrivs); } if (this.RemoteAccountAltered != null) { FrostbiteConnection.RaiseEvent(this.RemoteAccountAltered.GetInvocationList(), this, cpBeforePacketDispatch.Words[1], spPrivs); } } blCancelPacket = true; } else if (cpBeforePacketDispatch.Words.Count >= 2 && String.Compare(cpBeforePacketDispatch.Words[0], "procon.packages.onDownloading", true) == 0) { if (this.PackageDownloading != null) { FrostbiteConnection.RaiseEvent(this.PackageDownloading.GetInvocationList(), this, cpBeforePacketDispatch.Words[1]); } blCancelPacket = true; } else if (cpBeforePacketDispatch.Words.Count >= 2 && String.Compare(cpBeforePacketDispatch.Words[0], "procon.packages.onDownloaded", true) == 0) { if (this.PackageDownloaded != null) { FrostbiteConnection.RaiseEvent(this.PackageDownloaded.GetInvocationList(), this, cpBeforePacketDispatch.Words[1]); } blCancelPacket = true; } else if (cpBeforePacketDispatch.Words.Count >= 2 && String.Compare(cpBeforePacketDispatch.Words[0], "procon.packages.onInstalling", true) == 0) { if (this.PackageInstalling != null) { FrostbiteConnection.RaiseEvent(this.PackageInstalling.GetInvocationList(), this, cpBeforePacketDispatch.Words[1]); } blCancelPacket = true; } else if (cpBeforePacketDispatch.Words.Count >= 3 && String.Compare(cpBeforePacketDispatch.Words[0], "procon.packages.onDownloadError", true) == 0) { if (this.PackageDownloadError != null) { FrostbiteConnection.RaiseEvent(this.PackageDownloadError.GetInvocationList(), this, cpBeforePacketDispatch.Words[1], cpBeforePacketDispatch.Words[2]); } blCancelPacket = true; } else if (cpBeforePacketDispatch.Words.Count >= 3 && String.Compare(cpBeforePacketDispatch.Words[0], "procon.packages.onInstalled", true) == 0) { bool restartRequired = false; if (bool.TryParse(cpBeforePacketDispatch.Words[2], out restartRequired) == true) { if (this.PackageInstalled != null) { FrostbiteConnection.RaiseEvent(this.PackageInstalled.GetInvocationList(), this, cpBeforePacketDispatch.Words[1], restartRequired); } } blCancelPacket = true; } else if (cpBeforePacketDispatch.Words.Count >= 3 && String.Compare(cpBeforePacketDispatch.Words[0], "procon.chat.onConsole", true) == 0) { long logTime = 0L; if (long.TryParse(cpBeforePacketDispatch.Words[1], out logTime) == true) { if (this.ReadRemoteChatConsole != null) { FrostbiteConnection.RaiseEvent(this.ReadRemoteChatConsole.GetInvocationList(), this, DateTime.FromBinary(logTime), cpBeforePacketDispatch.Words[2]); } } } else if (cpBeforePacketDispatch.Words.Count >= 3 && String.Compare(cpBeforePacketDispatch.Words[0], "procon.plugin.onConsole", true) == 0) { long logTime = 0L; if (long.TryParse(cpBeforePacketDispatch.Words[1], out logTime) == true) { if (this.ReadRemotePluginConsole != null) { FrostbiteConnection.RaiseEvent(this.ReadRemotePluginConsole.GetInvocationList(), this, DateTime.FromBinary(logTime), cpBeforePacketDispatch.Words[2]); } } } else if (cpBeforePacketDispatch.Words.Count >= 3 && String.Compare(cpBeforePacketDispatch.Words[0], "procon.plugin.onVariablesAltered", true) == 0) { //this.SendPacket(new Packet(true, true, cpBeforePacketDispatch.SequenceNumber, new List<string>() { "OK" })); int i = 1; List<CPluginVariable> lstVariables = new List<CPluginVariable>(); string strClassName = cpBeforePacketDispatch.Words[i++]; int iTotalVariables = 0; if (int.TryParse(cpBeforePacketDispatch.Words[i++], out iTotalVariables) == true && i + (iTotalVariables * 3) <= cpBeforePacketDispatch.Words.Count) { for (int x = 0; x < (iTotalVariables * 3); x += 3) { lstVariables.Add(new CPluginVariable(cpBeforePacketDispatch.Words[i++], cpBeforePacketDispatch.Words[i++], cpBeforePacketDispatch.Words[i++])); } } if (this.RemotePluginVariables != null) { FrostbiteConnection.RaiseEvent(this.RemotePluginVariables.GetInvocationList(), this, strClassName, lstVariables); } blCancelPacket = true; } else if (cpBeforePacketDispatch.Words.Count >= 1 && String.Compare(cpBeforePacketDispatch.Words[0], "procon.plugin.onLoaded", true) == 0) { //this.SendPacket(new Packet(true, true, cpBeforePacketDispatch.SequenceNumber, new List<string>() { "OK" })); int i = 1; if (i + 6 <= cpBeforePacketDispatch.Words.Count) { PluginDetails spdLoaded = new PluginDetails(); spdLoaded.ClassName = cpBeforePacketDispatch.Words[i++]; spdLoaded.Name = cpBeforePacketDispatch.Words[i++]; spdLoaded.Author = cpBeforePacketDispatch.Words[i++]; spdLoaded.Website = cpBeforePacketDispatch.Words[i++]; spdLoaded.Version = cpBeforePacketDispatch.Words[i++]; spdLoaded.Description = cpBeforePacketDispatch.Words[i++]; spdLoaded.DisplayPluginVariables = new List<CPluginVariable>(); spdLoaded.PluginVariables = new List<CPluginVariable>(); // Not used here. int iTotalVariables = 0; if (int.TryParse(cpBeforePacketDispatch.Words[i++], out iTotalVariables) == true && i + (iTotalVariables * 3) <= cpBeforePacketDispatch.Words.Count) { for (int x = 0; x < (iTotalVariables * 3); x += 3) { spdLoaded.DisplayPluginVariables.Add(new CPluginVariable(cpBeforePacketDispatch.Words[i++], cpBeforePacketDispatch.Words[i++], cpBeforePacketDispatch.Words[i++])); } } if (this.RemotePluginLoaded != null) { FrostbiteConnection.RaiseEvent(this.RemotePluginLoaded.GetInvocationList(), this, spdLoaded); } } blCancelPacket = true; } else if (cpBeforePacketDispatch.Words.Count >= 3 && String.Compare(cpBeforePacketDispatch.Words[0], "procon.plugin.onEnabled", true) == 0) { //this.SendPacket(new Packet(true, true, cpBeforePacketDispatch.SequenceNumber, new List<string>() { "OK" })); bool blEnabled = false; if (bool.TryParse(cpBeforePacketDispatch.Words[2], out blEnabled) == true && this.RemotePluginEnabled != null) { FrostbiteConnection.RaiseEvent(this.RemotePluginEnabled.GetInvocationList(), this, cpBeforePacketDispatch.Words[1], blEnabled); } blCancelPacket = true; } else if (cpBeforePacketDispatch.Words.Count >= 4 && String.Compare(cpBeforePacketDispatch.Words[0], "procon.admin.onSay", true) == 0) { //this.SendPacket(new Packet(true, true, cpBeforePacketDispatch.SequenceNumber, new List<string>() { "OK" })); if (this.ProconAdminSaying != null) { FrostbiteConnection.RaiseEvent(this.ProconAdminSaying.GetInvocationList(), this, cpBeforePacketDispatch.Words[1], cpBeforePacketDispatch.Words[2], new CPlayerSubset(cpBeforePacketDispatch.Words.GetRange(3, cpBeforePacketDispatch.Words.Count - 3))); } if (this.PassLayerEvent != null) { FrostbiteConnection.RaiseEvent(this.PassLayerEvent.GetInvocationList(), this, cpBeforePacketDispatch); } blCancelPacket = true; } // MoHW R-6 hack else if (cpBeforePacketDispatch.Words.Count >= 4 && this.Game.GameType == "MOHW" && String.Compare(cpBeforePacketDispatch.Words[0], "procon.admin.onYell", true) == 0) { // this.SendPacket(new Packet(true, true, cpBeforePacketDispatch.SequenceNumber, new List<string>() { "OK" })); int iDisplayDuration = 0; if (this.ProconAdminYelling != null) { FrostbiteConnection.RaiseEvent(this.ProconAdminYelling.GetInvocationList(), this, cpBeforePacketDispatch.Words[1], cpBeforePacketDispatch.Words[2], iDisplayDuration, new CPlayerSubset(cpBeforePacketDispatch.Words.GetRange(4, cpBeforePacketDispatch.Words.Count - 4))); } if (this.PassLayerEvent != null) { FrostbiteConnection.RaiseEvent(this.PassLayerEvent.GetInvocationList(), this, cpBeforePacketDispatch); } blCancelPacket = true; } // hack end else if (cpBeforePacketDispatch.Words.Count >= 5 && String.Compare(cpBeforePacketDispatch.Words[0], "procon.admin.onYell", true) == 0) { // this.SendPacket(new Packet(true, true, cpBeforePacketDispatch.SequenceNumber, new List<string>() { "OK" })); int iDisplayDuration = 0; if (int.TryParse(cpBeforePacketDispatch.Words[3], out iDisplayDuration) == true) { if (this.ProconAdminYelling != null) { FrostbiteConnection.RaiseEvent(this.ProconAdminYelling.GetInvocationList(), this, cpBeforePacketDispatch.Words[1], cpBeforePacketDispatch.Words[2], iDisplayDuration, new CPlayerSubset(cpBeforePacketDispatch.Words.GetRange(4, cpBeforePacketDispatch.Words.Count - 4))); } if (this.PassLayerEvent != null) { FrostbiteConnection.RaiseEvent(this.PassLayerEvent.GetInvocationList(), this, cpBeforePacketDispatch); } } blCancelPacket = true; } // bf3 player.ping else if (this.Game.GameType == "BF3" && cpBeforePacketDispatch.Words.Count >= 3 && String.Compare(cpBeforePacketDispatch.Words[0], "procon.admin.onPlayerPinged", true) == 0) { int iPing = 0; string strSoldierName = cpBeforePacketDispatch.Words[1]; if (int.TryParse(cpBeforePacketDispatch.Words[2], out iPing) == true) { if (iPing == 65535) { iPing = -1; } if (this.ProconAdminPinging != null) { FrostbiteConnection.RaiseEvent(this.ProconAdminPinging.GetInvocationList(), this, strSoldierName, iPing); } if (this.PassLayerEvent != null) { FrostbiteConnection.RaiseEvent(this.PassLayerEvent.GetInvocationList(), this, cpBeforePacketDispatch); } } blCancelPacket = true; } else if (cpBeforePacketDispatch.Words.Count >= 3 && String.Compare(cpBeforePacketDispatch.Words[0], "procon.updated", true) == 0) { //this.SendPacket(new Packet(true, true, cpBeforePacketDispatch.SequenceNumber, new List<string>() { "OK" })); foreach (KeyValuePair<string, string> registerUid in this.m_dicUsernamesToUids) { if (String.Compare(cpBeforePacketDispatch.Words[1], registerUid.Value) == 0) { this.InstigatingAccountName = registerUid.Key; break; } } // Only parse it if the UID is different from this connections registered UID. if (String.Compare(cpBeforePacketDispatch.Words[1], this.m_strProconEventsUid) != 0) { List<string> lstAssumedRequestPacket = new List<string>(cpBeforePacketDispatch.Words); lstAssumedRequestPacket.RemoveRange(0, 2); Packet cpAssumedRequestPacket = new Packet(false, false, 0, lstAssumedRequestPacket); Packet cpAssumedResponsePacket = new Packet(false, true, 0, new List<string>() { "OK" }); this.Game.DispatchResponsePacket(this.Game.Connection, cpAssumedResponsePacket, cpAssumedRequestPacket); cpAssumedRequestPacket = null; cpAssumedResponsePacket = null; if (this.PassLayerEvent != null) { FrostbiteConnection.RaiseEvent(this.PassLayerEvent.GetInvocationList(), this, cpBeforePacketDispatch); } } blCancelPacket = true; } else if (cpBeforePacketDispatch.Words.Count >= 2 && String.Compare(cpBeforePacketDispatch.Words[0], "procon.battlemap.onZoneRemoved", true) == 0) { if (this.MapZoneDeleted != null) { FrostbiteConnection.RaiseEvent(this.MapZoneDeleted.GetInvocationList(), this, new MapZoneDrawing(cpBeforePacketDispatch.Words[1], String.Empty, String.Empty, null, true)); } } else if (cpBeforePacketDispatch.Words.Count >= 4 && String.Compare(cpBeforePacketDispatch.Words[0], "procon.battlemap.onZoneCreated", true) == 0) { //this.SendPacket(new Packet(true, true, cpBeforePacketDispatch.SequenceNumber, new List<string>() { "OK" })); int iPoints = 0; if (int.TryParse(cpBeforePacketDispatch.Words[3], out iPoints) == true) { Point3D[] points = new Point3D[iPoints]; for (int i = 0; i < iPoints; i++) { points[i] = new Point3D(cpBeforePacketDispatch.Words[3 + i * 3 + 1], cpBeforePacketDispatch.Words[3 + i * 3 + 2], cpBeforePacketDispatch.Words[3 + i * 3 + 3]); } if (this.MapZoneCreated != null) { FrostbiteConnection.RaiseEvent(this.MapZoneCreated.GetInvocationList(), this, new MapZoneDrawing(cpBeforePacketDispatch.Words[1], cpBeforePacketDispatch.Words[2], String.Empty, points, true)); } } blCancelPacket = true; } else if (cpBeforePacketDispatch.Words.Count >= 3 && String.Compare(cpBeforePacketDispatch.Words[0], "procon.battlemap.onZoneModified", true) == 0) { //this.SendPacket(new Packet(true, true, cpBeforePacketDispatch.SequenceNumber, new List<string>() { "OK" })); int iPoints = 0; if (int.TryParse(cpBeforePacketDispatch.Words[3], out iPoints) == true) { Point3D[] points = new Point3D[iPoints]; for (int i = 0; i < iPoints; i++) { points[i] = new Point3D(cpBeforePacketDispatch.Words[3 + i * 3 + 1], cpBeforePacketDispatch.Words[3 + i * 3 + 2], cpBeforePacketDispatch.Words[3 + i * 3 + 3]); } if (this.MapZoneModified != null) { FrostbiteConnection.RaiseEvent(this.MapZoneModified.GetInvocationList(), this, new MapZoneDrawing(cpBeforePacketDispatch.Words[1], String.Empty, cpBeforePacketDispatch.Words[2], points, true)); } } blCancelPacket = true; } else if (cpBeforePacketDispatch.Words.Count >= 3 && String.Compare(cpBeforePacketDispatch.Words[0], "procon.vars.onAltered", true) == 0) { //this.SendPacket(new Packet(true, true, cpBeforePacketDispatch.SequenceNumber, new List<string>() { "OK" })); this.SV_Variables.SetVariable(cpBeforePacketDispatch.Words[1], cpBeforePacketDispatch.Words[2]); if (this.ReceiveProconVariable != null) { FrostbiteConnection.RaiseEvent(this.ReceiveProconVariable.GetInvocationList(), this, cpBeforePacketDispatch.Words[1], cpBeforePacketDispatch.Words[2]); } blCancelPacket = true; } else { // if (blCommandConnection == false) Pass everything else onto any connected clients.. if (this.PassLayerEvent != null) { FrostbiteConnection.RaiseEvent(this.PassLayerEvent.GetInvocationList(), this, cpBeforePacketDispatch); } } return blCancelPacket; }
private void m_prcClient_ProconPrivileges(PRoConClient sender, CPrivileges spPrivs) { this.m_spPrivileges = spPrivs; this.kbpPunkbusterPunishPanel.Enabled = (!this.m_spPrivileges.CannotPunishPlayers && this.m_spPrivileges.CanIssueLimitedPunkbusterCommands); this.kbpPunkbusterPunishPanel.SetPrivileges(this.m_spPrivileges); this.kbpBfbcPunishPanel.Enabled = !this.m_spPrivileges.CannotPunishPlayers; this.kbpBfbcPunishPanel.SetPrivileges(this.m_spPrivileges); }
private void CPRoConLayerClient_AccountPrivilegesChanged(AccountPrivilege item) { CPrivileges cpPrivs = new CPrivileges(item.Privileges.PrivilegesFlags); cpPrivs.SetLowestPrivileges(this.m_prcClient.Privileges); if (this.IsLoggedIn == true && this.m_blEventsEnabled == true && this.Game != null) { this.Game.SendRequest("procon.account.onAltered", item.Owner.Name, cpPrivs.PrivilegesFlags.ToString()); //this.send(new Packet(true, false, this.AcquireSequenceNumber, new List<string>() { "procon.account.onAltered", item.Owner.Name, cpPrivs.PrivilegesFlags.ToString() })); } if (String.Compare(this.m_strUsername, item.Owner.Name) == 0) { this.m_sprvPrivileges = cpPrivs; } }
public AccountPrivilege(Account accOwner, CPrivileges cpPrivileges) { Owner = accOwner; Privileges = cpPrivileges; }
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); } }
public void sender_ProconPrivileges(PRoConClient sender, CPrivileges spPrivs) { this.pnlSettingsPanels.Enabled = spPrivs.CanAlterServerSettings; }
private void InitialSetup() { if (Game != null) { IsLoadingSavingConnectionConfig = true; AssignEventHandlers(); // Assume full access until we're told otherwise. Layer.Initialize(Parent, this); // I may move these events to within Layer, depends on the end of the restructure. Layer.LayerOnline += new PRoConLayer.LayerEmptyParameterHandler(Layer_LayerOnline); Layer.LayerOffline += new PRoConLayer.LayerEmptyParameterHandler(Layer_LayerOffline); Layer.AccountPrivileges.AccountPrivilegeAdded += new AccountPrivilegeDictionary.AccountPrivilegeAlteredHandler(AccountPrivileges_AccountPrivilegeAdded); Layer.AccountPrivileges.AccountPrivilegeRemoved += new AccountPrivilegeDictionary.AccountPrivilegeAlteredHandler(AccountPrivileges_AccountPrivilegeRemoved); foreach (AccountPrivilege apPriv in Layer.AccountPrivileges) { apPriv.AccountPrivilegesChanged += new AccountPrivilege.AccountPrivilegesChangedHandler(item_AccountPrivilegesChanged); } Privileges = new CPrivileges(CPrivileges.FullPrivilegesFlags); EventsLogging = new EventCaptures(this); Console = new ConnectionConsole(this); PunkbusterConsole = new PunkbusterConsole(this); ChatConsole = new ChatConsole(this); PluginConsole = new PluginConsole(this); MapGeometry = new MapGeometry(this); MapGeometry.MapZones.MapZoneAdded += new MapZoneDictionary.MapZoneAlteredHandler(MapZones_MapZoneAdded); MapGeometry.MapZones.MapZoneChanged += new MapZoneDictionary.MapZoneAlteredHandler(MapZones_MapZoneChanged); MapGeometry.MapZones.MapZoneRemoved += new MapZoneDictionary.MapZoneAlteredHandler(MapZones_MapZoneRemoved); if (CurrentServerInfo == null) { CurrentServerInfo = new CServerInfo(); } ListSettings = new ListsSettings(this); ServerSettings = new ServerSettings(this); PlayerListSettings = new PlayerListSettings(); PlayerList = new PlayerDictionary(); TeamNameList = new List<CTeamName>(); MapListPool = new NotificationList<CMap>(); ReservedSlotList = new NotificationList<string>(); Variables = new VariableDictionary(); SV_Variables = new VariableDictionary(); Reasons = new NotificationList<string>(); FullVanillaBanList = new List<CBanInfo>(); FullTextChatModerationList = new TextChatModerationDictionary(); Weapons = new WeaponDictionary(); Specializations = new SpecializationDictionary(); if (Regex.Match(HostName, @"^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$").Success == true) { Variables.SetVariable("SERVER_COUNTRY", Parent.GetCountryName(HostName)); Variables.SetVariable("SERVER_COUNTRY_CODE", Parent.GetCountryCode(HostName)); } else { IPAddress ipServer = FrostbiteConnection.ResolveHostName(HostName); Variables.SetVariable("SERVER_COUNTRY", Parent.GetCountryName(ipServer.ToString())); Variables.SetVariable("SERVER_COUNTRY_CODE", Parent.GetCountryCode(ipServer.ToString())); } Console.Logging = Parent.OptionsSettings.ConsoleLogging; EventsLogging.Logging = Parent.OptionsSettings.EventsLogging; ChatConsole.Logging = Parent.OptionsSettings.ChatLogging; PluginConsole.Logging = Parent.OptionsSettings.PluginLogging; //this.m_blLoadingSavingConnectionConfig = true; if (CurrentServerInfo.GameMod == GameMods.None) { ExecuteConnectionConfig(Game.GameType + ".def", 0, null, false); } else { ExecuteConnectionConfig(Game.GameType + "." + CurrentServerInfo.GameMod + ".def", 0, null, false); } // load override global_vars.def ExecuteGlobalVarsConfig("global_vars.def", 0, null); ExecuteConnectionConfig("reasons.cfg", 0, null, false); lock (Parent) { if (Username.Length == 0 || Parent.OptionsSettings.LayerHideLocalPlugins == false) { CompilePlugins(Parent.OptionsSettings.PluginPermissions); } } if (Parent.OptionsSettings.UsePluginOldStyleLoad == true) { ExecuteConnectionConfig(FileHostNamePort + ".cfg", 0, null, false); } //this.m_blLoadingSavingConnectionConfig = false; // this.ManuallyDisconnected = true; // this.ConnectionError = false; BeginLoginSequence(); if (Parent.OptionsSettings.UsePluginOldStyleLoad == false) { ExecuteConnectionConfig(FileHostNamePort + ".cfg", 0, null, true); } IsLoadingSavingConnectionConfig = false; } }
//public void OnAccountDeleted(string strAccountName) { //} private void m_prcClient_RemoteAccountAltered(PRoConClient sender, string accountName, CPrivileges accountPrivileges) { this.InvokeIfRequired(() => { if (this.lsvLayerAccounts.Items.ContainsKey(accountName) == true) { this.OnSettingResponse("procon.layer.setPrivileges", true); this.lsvLayerAccounts.Items[accountName].SubItems["rconaccess"].Tag = accountPrivileges; this.RefreshLayerPrivilegesPanel(); } }); }
private bool HandleResponsePacket(Packet cpBeforePacketDispatch, bool blCancelUpdateEvent, bool blCancelPacket) { if (this.Game != null) { Packet cpRequestPacket = this.Game.Connection.GetRequestPacket(cpBeforePacketDispatch); if (cpRequestPacket != null) { if (cpBeforePacketDispatch.Words.Count >= 1 && String.Compare(cpBeforePacketDispatch.Words[0], "InvalidUsername", true) == 0) { if (this.LoginFailure != null) { FrostbiteConnection.RaiseEvent(this.LoginFailure.GetInvocationList(), this, cpBeforePacketDispatch.Words[0]); } this.Shutdown(); this.State = ConnectionState.Error; blCancelPacket = true; } else if (cpRequestPacket.Words.Count >= 1 && String.Compare(cpRequestPacket.Words[0], "procon.version", true) == 0 && cpBeforePacketDispatch.Words.Count >= 2) { try { this.ConnectedLayerVersion = new Version(cpBeforePacketDispatch.Words[1]); if (this.ProconVersion != null) { FrostbiteConnection.RaiseEvent(this.ProconVersion.GetInvocationList(), this, this.ConnectedLayerVersion); } } catch (Exception) { } blCancelPacket = true; } else if (cpRequestPacket.Words.Count >= 1 && String.Compare(cpRequestPacket.Words[0], "procon.privileges", true) == 0 && cpBeforePacketDispatch.Words.Count >= 2) { UInt32 ui32Privileges = 0; if (UInt32.TryParse(cpBeforePacketDispatch.Words[1], out ui32Privileges) == true) { CPrivileges spPrivs = new CPrivileges(); spPrivs.PrivilegesFlags = ui32Privileges; this.Privileges = spPrivs; if (this.ProconPrivileges != null) { FrostbiteConnection.RaiseEvent(this.ProconPrivileges.GetInvocationList(), this, spPrivs); } } blCancelPacket = true; } else if (cpRequestPacket.Words.Count >= 2 && String.Compare(cpRequestPacket.Words[0], "procon.registerUid", true) == 0 && cpBeforePacketDispatch.Words.Count >= 1) { if (String.Compare(cpBeforePacketDispatch.Words[0], "OK", true) == 0 && cpRequestPacket.Words.Count >= 3) { this.m_strProconEventsUid = cpRequestPacket.Words[2]; } else if (String.Compare(cpBeforePacketDispatch.Words[0], "ProconUidConflict", true) == 0) { // Conflict in our UID, just hash and send another one. // Then go to vegas. this.SendRequest(new List<string>() { "procon.registerUid", "true", FrostbiteClient.GeneratePasswordHash(Encoding.ASCII.GetBytes(DateTime.Now.ToString("HH:mm:ss ff")), this.m_strUsername) }); } blCancelPacket = true; } else if (cpRequestPacket.Words.Count >= 1 && String.Compare(cpRequestPacket.Words[0], "procon.account.listAccounts", true) == 0) { UInt32 ui32Privileges = 0; for (int i = 1; i < cpBeforePacketDispatch.Words.Count; i += 2) { if (UInt32.TryParse(cpBeforePacketDispatch.Words[i + 1], out ui32Privileges) == true) { CPrivileges spPrivs = new CPrivileges(); spPrivs.PrivilegesFlags = ui32Privileges; if (this.RemoteAccountCreated != null && this.RemoteAccountAltered != null) { FrostbiteConnection.RaiseEvent(this.RemoteAccountCreated.GetInvocationList(), this, cpBeforePacketDispatch.Words[i]); FrostbiteConnection.RaiseEvent(this.RemoteAccountAltered.GetInvocationList(), this, cpBeforePacketDispatch.Words[i], spPrivs); } } } blCancelPacket = true; } else if (cpRequestPacket.Words.Count >= 1 && String.Compare(cpRequestPacket.Words[0], "procon.battlemap.listZones", true) == 0 && cpBeforePacketDispatch.Words.Count >= 2 && String.Compare(cpBeforePacketDispatch.Words[0], "OK", true) == 0) { List<MapZoneDrawing> zones = new List<MapZoneDrawing>(); int iZones = 0; int iOffset = 1; if (int.TryParse(cpBeforePacketDispatch.Words[iOffset++], out iZones) == true) { for (int iZoneCount = 0; iZoneCount < iZones; iZoneCount++) { string uid = String.Empty; string level = String.Empty; string tags = String.Empty; List<Point3D> points = new List<Point3D>(); if (iOffset + 4 < cpBeforePacketDispatch.Words.Count) { uid = cpBeforePacketDispatch.Words[iOffset++]; level = cpBeforePacketDispatch.Words[iOffset++]; tags = cpBeforePacketDispatch.Words[iOffset++]; int iZonePoints = 0; if (int.TryParse(cpBeforePacketDispatch.Words[iOffset++], out iZonePoints) == true && iOffset + iZonePoints * 3 <= cpBeforePacketDispatch.Words.Count) { for (int iZonePointCount = 0; iZonePointCount < iZonePoints && iOffset + 3 <= cpBeforePacketDispatch.Words.Count; iZonePointCount++) { points.Add(new Point3D(cpBeforePacketDispatch.Words[iOffset++], cpBeforePacketDispatch.Words[iOffset++], cpBeforePacketDispatch.Words[iOffset++])); } } } zones.Add(new MapZoneDrawing(uid, level, tags, points.ToArray(), true)); } } if (this.ListMapZones != null) { FrostbiteConnection.RaiseEvent(this.ListMapZones.GetInvocationList(), this, zones); } blCancelPacket = true; } else if (cpRequestPacket.Words.Count >= 1 && String.Compare(cpRequestPacket.Words[0], "procon.account.setPassword", true) == 0 && cpBeforePacketDispatch.Words.Count >= 1 && String.Compare(cpBeforePacketDispatch.Words[0], "OK", true) == 0) { if (this.RemoteAccountChangePassword != null) { FrostbiteConnection.RaiseEvent(this.RemoteAccountChangePassword.GetInvocationList(), this); } blCancelPacket = true; } else if (cpRequestPacket.Words.Count >= 1 && String.Compare(cpRequestPacket.Words[0], "procon.account.listLoggedIn", true) == 0) { bool containsUids = (cpRequestPacket.Words.Count >= 2 && String.Compare(cpRequestPacket.Words[1], "uids") == 0); if (this.RemoteAccountLoggedIn != null) { for (int i = 1; i < cpBeforePacketDispatch.Words.Count; i++) { FrostbiteConnection.RaiseEvent(this.RemoteAccountLoggedIn.GetInvocationList(), this, cpBeforePacketDispatch.Words[i], true); if (containsUids == true && i + 1 < cpBeforePacketDispatch.Words.Count) { if (this.m_dicUsernamesToUids.ContainsKey(cpBeforePacketDispatch.Words[i]) == true) { this.m_dicUsernamesToUids[cpBeforePacketDispatch.Words[i]] = cpBeforePacketDispatch.Words[i + 1]; } else { this.m_dicUsernamesToUids.Add(cpBeforePacketDispatch.Words[i], cpBeforePacketDispatch.Words[i + 1]); } i++; } } } blCancelPacket = true; } else if (cpRequestPacket.Words.Count >= 1 && String.Compare(cpRequestPacket.Words[0], "procon.plugin.listEnabled", true) == 0) { if (this.RemoteEnabledPlugins != null) { List<string> lstEnabledPlugins = new List<string>(cpBeforePacketDispatch.Words); lstEnabledPlugins.RemoveAt(0); FrostbiteConnection.RaiseEvent(this.RemoteEnabledPlugins.GetInvocationList(), this, lstEnabledPlugins); } blCancelPacket = true; } else if (cpRequestPacket.Words.Count >= 1 && String.Compare(cpRequestPacket.Words[0], "procon.vars", true) == 0 && cpBeforePacketDispatch.Words.Count >= 3) { this.SV_Variables.SetVariable(cpBeforePacketDispatch.Words[1], cpBeforePacketDispatch.Words[2]); if (this.ReceiveProconVariable != null) { FrostbiteConnection.RaiseEvent(this.ReceiveProconVariable.GetInvocationList(), this, cpBeforePacketDispatch.Words[1], cpBeforePacketDispatch.Words[2]); } // Dispatch to plugins. } else if (cpRequestPacket.Words.Count >= 1 && String.Compare(cpRequestPacket.Words[0], "procon.plugin.listLoaded", true) == 0) { if (this.RemoteLoadedPlugins != null) { int i = 0; if (cpBeforePacketDispatch.Words.Count >= 1 && String.Compare(cpBeforePacketDispatch.Words[i++], "OK", true) == 0) { Dictionary<string, PluginDetails> dicLoadedPlugins = new Dictionary<string, PluginDetails>(); while (i + 6 <= cpBeforePacketDispatch.Words.Count) { PluginDetails spdLoaded = new PluginDetails(); spdLoaded.ClassName = cpBeforePacketDispatch.Words[i++]; spdLoaded.Name = cpBeforePacketDispatch.Words[i++]; spdLoaded.Author = cpBeforePacketDispatch.Words[i++]; spdLoaded.Website = cpBeforePacketDispatch.Words[i++]; spdLoaded.Version = cpBeforePacketDispatch.Words[i++]; spdLoaded.Description = cpBeforePacketDispatch.Words[i++]; spdLoaded.DisplayPluginVariables = new List<CPluginVariable>(); spdLoaded.PluginVariables = new List<CPluginVariable>(); // Not used here. int iTotalVariables = 0; if (int.TryParse(cpBeforePacketDispatch.Words[i++], out iTotalVariables) == true && i + (iTotalVariables * 3) <= cpBeforePacketDispatch.Words.Count) { for (int x = 0; x < (iTotalVariables * 3); x += 3) { spdLoaded.DisplayPluginVariables.Add(new CPluginVariable(cpBeforePacketDispatch.Words[i++], cpBeforePacketDispatch.Words[i++], cpBeforePacketDispatch.Words[i++])); } } if (dicLoadedPlugins.ContainsKey(spdLoaded.ClassName) == false) { dicLoadedPlugins.Add(spdLoaded.ClassName, spdLoaded); } } FrostbiteConnection.RaiseEvent(this.RemoteLoadedPlugins.GetInvocationList(), this, dicLoadedPlugins); } } blCancelPacket = true; } else if (cpRequestPacket.Words.Count >= 2 && String.Compare(cpRequestPacket.Words[0], "login.hashed", true) == 0 && cpBeforePacketDispatch.Words.Count >= 1 && String.Compare(cpBeforePacketDispatch.Words[0], "InsufficientPrivileges", true) == 0) { if (this.LoginFailure != null) { FrostbiteConnection.RaiseEvent(this.LoginFailure.GetInvocationList(), this, cpBeforePacketDispatch.Words[0]); } this.Shutdown(); this.State = ConnectionState.Error; blCancelPacket = true; } else if (cpRequestPacket.Words.Count >= 2 && String.Compare(cpRequestPacket.Words[0], "procon.login.username", true) == 0 && cpBeforePacketDispatch.Words.Count >= 1 && (String.Compare(cpBeforePacketDispatch.Words[0], "OK", true) == 0 || String.Compare(cpBeforePacketDispatch.Words[0], "UnknownCommand", true) == 0)) { //this.send(new Packet(true, true, cpBeforePacketDispatch.SequenceNumber, new List<string>() { "procon.login.requestUsername", this.m_strUsername })); // This is the first command we would recieve so now we know we're connected through a PRoCon layer. if (this.LoginAttempt != null) { FrostbiteConnection.RaiseEvent(this.LoginAttempt.GetInvocationList(), this); } this.Game.SendLoginHashedPacket(this.Password); if (String.Compare(cpBeforePacketDispatch.Words[0], "OK", true) == 0) { this.IsPRoConConnection = true; this.Game.isLayered = true; } else { this.IsPRoConConnection = false; this.Username = ""; } blCancelPacket = true; } else if (cpRequestPacket.Words.Count >= 2 && String.Compare(cpRequestPacket.Words[0], "procon.login.username", true) == 0 && cpBeforePacketDispatch.Words.Count >= 1 && String.Compare(cpBeforePacketDispatch.Words[0], "InsufficientPrivileges", true) == 0) { // The servers just told us off, try and login normally. if (this.LoginFailure != null) { FrostbiteConnection.RaiseEvent(this.LoginFailure.GetInvocationList(), this, cpBeforePacketDispatch.Words[0]); } this.Shutdown(); this.State = ConnectionState.Error; blCancelPacket = true; } else if (cpRequestPacket.Words.Count >= 3 && String.Compare(cpRequestPacket.Words[0], "admin.say", true) == 0 && this.m_dicForwardedPackets.ContainsKey(cpBeforePacketDispatch.SequenceNumber) == true) { if (this.m_dicForwardedPackets[cpBeforePacketDispatch.SequenceNumber].m_lstWords.Count >= 4 && String.Compare(this.m_dicForwardedPackets[cpBeforePacketDispatch.SequenceNumber].m_lstWords[0], "procon.admin.say", true) == 0) { this.m_dicForwardedPackets[cpBeforePacketDispatch.SequenceNumber].m_lstWords[0] = "procon.admin.onSay"; if (this.IsPRoConConnection == false) { List<string> lstWords = this.m_dicForwardedPackets[cpBeforePacketDispatch.SequenceNumber].m_lstWords; if (this.ProconAdminSaying != null) { FrostbiteConnection.RaiseEvent(this.ProconAdminSaying.GetInvocationList(), this, lstWords[1], lstWords[2], new CPlayerSubset(lstWords.GetRange(3, lstWords.Count - 3))); } } if (this.PassLayerEvent != null) { FrostbiteConnection.RaiseEvent(this.PassLayerEvent.GetInvocationList(), this, new Packet(true, false, cpRequestPacket.SequenceNumber, this.m_dicForwardedPackets[cpBeforePacketDispatch.SequenceNumber].m_lstWords)); } // Send to all logged in layer clients this.m_dicForwardedPackets.Remove(cpBeforePacketDispatch.SequenceNumber); blCancelPacket = true; blCancelUpdateEvent = true; } } else if (cpRequestPacket.Words.Count >= 4 && String.Compare(cpRequestPacket.Words[0], "admin.yell", true) == 0 && this.m_dicForwardedPackets.ContainsKey(cpBeforePacketDispatch.SequenceNumber) == true) { if (this.m_dicForwardedPackets[cpBeforePacketDispatch.SequenceNumber].m_lstWords.Count >= 5 && String.Compare(this.m_dicForwardedPackets[cpBeforePacketDispatch.SequenceNumber].m_lstWords[0], "procon.admin.yell", true) == 0) { this.m_dicForwardedPackets[cpBeforePacketDispatch.SequenceNumber].m_lstWords[0] = "procon.admin.onYell"; // If we're at the top of the tree, simulate the event coming from a layer above. if (this.IsPRoConConnection == false) { List<string> lstWords = this.m_dicForwardedPackets[cpBeforePacketDispatch.SequenceNumber].m_lstWords; int iDisplayDuration = 0; if (int.TryParse(lstWords[3], out iDisplayDuration) == true) { if (this.ProconAdminYelling != null) { FrostbiteConnection.RaiseEvent(this.ProconAdminYelling.GetInvocationList(), this, lstWords[1], lstWords[2], iDisplayDuration, new CPlayerSubset(lstWords.GetRange(4, lstWords.Count - 4))); } } } // Send to all logged in layer clients if (this.PassLayerEvent != null) { FrostbiteConnection.RaiseEvent(this.PassLayerEvent.GetInvocationList(), this, new Packet(true, false, cpRequestPacket.SequenceNumber, this.m_dicForwardedPackets[cpBeforePacketDispatch.SequenceNumber].m_lstWords)); } this.m_dicForwardedPackets.Remove(cpBeforePacketDispatch.SequenceNumber); blCancelPacket = true; blCancelUpdateEvent = true; } } // MoHW R-6 hack else if (cpRequestPacket.Words.Count >= 3 && this.Game.GameType == "MOHW" && String.Compare(cpRequestPacket.Words[0], "admin.yell", true) == 0 && this.m_dicForwardedPackets.ContainsKey(cpBeforePacketDispatch.SequenceNumber) == true) { if (this.m_dicForwardedPackets[cpBeforePacketDispatch.SequenceNumber].m_lstWords.Count >= 4 && String.Compare(this.m_dicForwardedPackets[cpBeforePacketDispatch.SequenceNumber].m_lstWords[0], "procon.admin.yell", true) == 0) { this.m_dicForwardedPackets[cpBeforePacketDispatch.SequenceNumber].m_lstWords[0] = "procon.admin.onYell"; // If we're at the top of the tree, simulate the event coming from a layer above. if (this.IsPRoConConnection == false) { List<string> lstWords = this.m_dicForwardedPackets[cpBeforePacketDispatch.SequenceNumber].m_lstWords; int iDisplayDuration = 0; if (int.TryParse(lstWords[3], out iDisplayDuration) == true) { iDisplayDuration = 0; if (this.ProconAdminYelling != null) { FrostbiteConnection.RaiseEvent(this.ProconAdminYelling.GetInvocationList(), this, lstWords[1], lstWords[2], iDisplayDuration, new CPlayerSubset(lstWords.GetRange(4, lstWords.Count - 4))); } } } // Send to all logged in layer clients if (this.PassLayerEvent != null) { FrostbiteConnection.RaiseEvent(this.PassLayerEvent.GetInvocationList(), this, new Packet(true, false, cpRequestPacket.SequenceNumber, this.m_dicForwardedPackets[cpBeforePacketDispatch.SequenceNumber].m_lstWords)); } this.m_dicForwardedPackets.Remove(cpBeforePacketDispatch.SequenceNumber); blCancelPacket = true; blCancelUpdateEvent = true; } } // end hack // BF3 player.ping else if (cpRequestPacket.Words.Count >= 2 && this.Game.GameType == "BF3" && String.Compare(cpRequestPacket.Words[0], "player.ping", true) == 0 && String.Compare(cpBeforePacketDispatch.Words[0], "OK", true) == 0) { string strProconEventsUid = String.Empty; List<string> lstProconUpdatedWords = new List<string>(cpRequestPacket.Words); lstProconUpdatedWords.Insert(0, "procon.admin.onPlayerPinged"); lstProconUpdatedWords.RemoveAt(1); lstProconUpdatedWords.Add(cpBeforePacketDispatch.Words[1]); // Now we pass on the packet to all the clients as an event so they can remain in sync. // Don't pass on anything regarding login if ((lstProconUpdatedWords.Count >= 4 && (String.Compare(lstProconUpdatedWords[2], "login.plainText", true) == 0 || String.Compare(lstProconUpdatedWords[2], "login.hashed", true) == 0)) == false) { if (this.PassLayerEvent != null) { FrostbiteConnection.RaiseEvent(this.PassLayerEvent.GetInvocationList(), this, new Packet(true, false, cpRequestPacket.SequenceNumber, lstProconUpdatedWords)); } } } if (blCancelUpdateEvent == false) { string strProconEventsUid = String.Empty; // If a layer client sent this packet.. if (this.m_dicForwardedPackets.ContainsKey(cpBeforePacketDispatch.SequenceNumber) == true) { if (this.m_dicForwardedPackets[cpBeforePacketDispatch.SequenceNumber].m_sender != null) { ((PRoConLayerClient)this.m_dicForwardedPackets[cpBeforePacketDispatch.SequenceNumber].m_sender).OnServerForwardedResponse(new Packet(false, true, this.m_dicForwardedPackets[cpBeforePacketDispatch.SequenceNumber].m_ui32OriginalSequence, new List<string>(cpBeforePacketDispatch.Words))); strProconEventsUid = ((PRoConLayerClient)this.m_dicForwardedPackets[cpBeforePacketDispatch.SequenceNumber].m_sender).ProconEventsUid; this.InstigatingAccountName = this.m_dicForwardedPackets[cpBeforePacketDispatch.SequenceNumber].m_sender.Username; } // Unregister the sequence and packet. this.m_dicForwardedPackets.Remove(cpBeforePacketDispatch.SequenceNumber); } // IF the command was not a request for a list (it's a GET operation only, // as in it only lists or retrieves information and will never be set.) if (this.Game != null && this.Game.GetPacketsPattern.IsMatch(cpRequestPacket.ToString()) == false) { // && cpBeforePacketDispatch.Words.Count >= 1 && String.Compare(cpBeforePacketDispatch.Words[0], "OK") == 0) { List<string> lstProconUpdatedWords = new List<string>(cpRequestPacket.Words); lstProconUpdatedWords.Insert(0, "procon.updated"); lstProconUpdatedWords.Insert(1, strProconEventsUid); // Now we pass on the packet to all the clients as an event so they can remain in sync. // Don't pass on anything regarding login if ((lstProconUpdatedWords.Count >= 4 && (String.Compare(lstProconUpdatedWords[2], "login.plainText", true) == 0 || String.Compare(lstProconUpdatedWords[2], "login.hashed", true) == 0)) == false) { if (this.PassLayerEvent != null) { FrostbiteConnection.RaiseEvent(this.PassLayerEvent.GetInvocationList(), this, new Packet(true, false, cpRequestPacket.SequenceNumber, lstProconUpdatedWords)); } } } } } } return blCancelPacket; }
private CPrivileges GetAccountPrivileges(string strUsername) { CPrivileges sprReturn = new CPrivileges(); sprReturn.PrivilegesFlags = 0; if (this.m_prcClient.Layer.AccountPrivileges.Contains(strUsername) == true) { sprReturn = this.m_prcClient.Layer.AccountPrivileges[strUsername].Privileges; //sprReturn = this.m_praApplication.AccountsList[strUsername].AccountPrivileges[this.m_prcClient.HostNamePort].Privileges; } if (String.IsNullOrEmpty(strUsername) == true && this.m_prcClient.Variables.IsVariableNullOrEmpty("GUEST_PRIVILEGES") == false) { sprReturn.PrivilegesFlags = this.m_prcClient.Variables.GetVariable<UInt32>("GUEST_PRIVILEGES", 0); } return sprReturn; }
public void ExecuteConnectionConfig(string strConfigFile, int iRecursion, List<string> lstArguments, bool blIncPlugin) { //FileStream stmConfigFile = null; try { if (File.Exists(Path.Combine(Path.Combine(AppDomain.CurrentDomain.BaseDirectory,"Configs"),strConfigFile)) == true) { //stmConfigFile = new FileStream(String.Format(@"{0}Configs\{1}", AppDomain.CurrentDomain.BaseDirectory, strConfigFile), FileMode.Open); string[] a_strConfigData = File.ReadAllLines(Path.Combine(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Configs"), strConfigFile)); if (a_strConfigData != null) { foreach (string strLine in a_strConfigData) { if (strLine.Length > 0 && Regex.Match(strLine, "^[ ]+//.*").Success == false) { // AND not a comment.. if (lstArguments != null) { string strReplacedLine = strLine; for (int i = 0; i < lstArguments.Count; i++) { strReplacedLine = strReplacedLine.Replace(String.Format("%arg:{0}%", i), lstArguments[i]); } List<string> lstWordifiedCommand = Packet.Wordify(strReplacedLine); // procon.protected.config.demand 48543 CanKickPlayers procon.protected.send admin.say "You're not allowed to kick" player phogue if (lstWordifiedCommand.Count >= 3 && String.Compare(lstWordifiedCommand[0], "procon.protected.config.demand", true) == 0) { UInt32 ui32PrivilegesFlags = 0; if (UInt32.TryParse(lstWordifiedCommand[1], out ui32PrivilegesFlags) == true) { CPrivileges cpConfigPrivs = new CPrivileges(ui32PrivilegesFlags); bool blHasPrivileges = false; try { System.Reflection.PropertyInfo[] a_piAllProperties = cpConfigPrivs.GetType().GetProperties(); foreach (System.Reflection.PropertyInfo pInfo in a_piAllProperties) { if (String.Compare(pInfo.GetGetMethod().Name, "get_" + lstWordifiedCommand[2]) == 0) { blHasPrivileges = (bool)pInfo.GetValue(cpConfigPrivs, null); break; } } if (blHasPrivileges == false) { // If they have asked for a command on failure.. if (lstWordifiedCommand.Count > 3) { if (blIncPlugin == true) { this.Parent.ExecutePRoConCommandCon(this, lstWordifiedCommand.GetRange(3, lstWordifiedCommand.Count - 3), iRecursion++); } else { this.Parent.ExecutePRoConCommand(this, lstWordifiedCommand.GetRange(3, lstWordifiedCommand.Count - 3), iRecursion++); } } // Cancel execution of the config file, they don't have the demanded privileges. break; } } catch (Exception e) { FrostbiteConnection.LogError("Parsing a config.", String.Empty, e); break; } } else { // Cancel execution of the config file, wrong format for demand. break; } } else { if (blIncPlugin == true) { this.Parent.ExecutePRoConCommandCon(this, lstWordifiedCommand, iRecursion++); } else { this.Parent.ExecutePRoConCommand(this, lstWordifiedCommand, iRecursion++); } } } else { if (blIncPlugin == true) { this.Parent.ExecutePRoConCommandCon(this, Packet.Wordify(strLine), iRecursion++); } else { this.Parent.ExecutePRoConCommand(this, Packet.Wordify(strLine), iRecursion++); } } } } } } } catch (Exception e) { FrostbiteConnection.LogError("ExecuteConnectionConfig", String.Empty, e); } }
// TO DO: Implement event once available public void OnAccountLogin(string strUsername, CPrivileges sprvPrivileges) { if (this.IsLoggedIn == true && this.m_blEventsEnabled == true && this.Game != null) { this.Game.SendRequest("procon.account.onLogin", strUsername, sprvPrivileges.PrivilegesFlags.ToString()); //this.send(new Packet(true, false, this.AcquireSequenceNumber, new List<string>() { "procon.account.onLogin", strUsername, sprvPrivileges.PrivilegesFlags.ToString() })); } }
public AccountPrivilege(Account accOwner, CPrivileges cpPrivileges) { this.Owner = accOwner; this.Privileges = cpPrivileges; }
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); } }
public virtual void OnAccountLogout(string accountName, string ip, CPrivileges privileges) { }
public void OnAccountPrivilegesUpdate(string strUsername, CPrivileges cpPrivs) { }
public void ProconProtectedLayerSetPrivileges(Account account, CPrivileges sprvPrivileges) { if (this.Layer.AccountPrivileges.Contains(account.Name) == true) { this.Layer.AccountPrivileges[account.Name].SetPrivileges(sprvPrivileges); } else { this.Layer.AccountPrivileges.Add(new AccountPrivilege(account, sprvPrivileges)); } }
public uscServerConnection(PRoConApplication paProcon, PRoConClient prcConnection, frmMain frmParent, frmManageAccounts frmAccounts) { //public uscServerConnection(PRoConApplication paProcon, ProConClient prcConnection, frmMain frmParent, frmManageAccounts frmAccounts, uscServerPlayerTreeview uscServerPlayerTree, string strHost, UInt16 iu16Port, string strUsername, string strPassword) { InitializeComponent(); this.m_praApplication = paProcon; this.m_prcConnection = prcConnection; this.m_prcConnection.GameTypeDiscovered += new PRoConClient.EmptyParamterHandler(m_prcConnection_GameTypeDiscovered); this.SetStyle(ControlStyles.UserPaint, true); this.SetStyle(ControlStyles.AllPaintingInWmPaint, true); this.SetStyle(ControlStyles.DoubleBuffer, true); this.m_cpPrivileges = new CPrivileges(CPrivileges.FullPrivilegesFlags); this.m_frmParent = frmParent; this.m_frmAccounts = frmAccounts; this.tbcClientTabs.ImageList = this.m_frmParent.iglIcons; this.uscLogin.BackgroundHostPort = prcConnection.HostNamePort; if (prcConnection.State != ConnectionState.Connected) { this.uscLogin.Dock = DockStyle.Fill; this.uscLogin.Show(); } else { this.uscLogin.Hide(); } this.uscLists.OnTabChange += new OnTabChangeDelegate(uscLists_OnTabChange); this.tabPlayerList.ImageKey = "mouse.png"; this.tabLists.ImageKey = "table.png"; this.tabChat.ImageKey = "comments.png"; this.tabEvents.ImageKey = "flag_blue.png"; this.tabMapView.ImageKey = "map-pin.png"; this.tabServerSettings.ImageKey = "server_edit.png"; this.tabPlugins.ImageKey = "plugin.png"; this.tabAccounts.ImageKey = "vcard.png"; this.tabConsole.ImageKey = "application_xp_terminal.png"; #region Map Controls this.SettingLoading = this.m_frmParent.picAjaxStyleLoading.Image; this.SettingSuccess = this.m_frmParent.picAjaxStyleSuccess.Image; this.SettingFail = this.m_frmParent.picAjaxStyleFail.Image; this.btnRestartRound.Image = this.m_frmParent.iglIcons.Images["arrow-retweet.png"]; this.btnNextRound.Image = this.m_frmParent.iglIcons.Images["arrow-step-over.png"]; this.AsyncSettingControls.Add("admin.runNextRound", new AsyncStyleSetting(this.picNextRound, null, new Control[] { this.btnNextRound }, true)); this.AsyncSettingControls.Add("admin.restartRound", new AsyncStyleSetting(this.picRestartRound, null, new Control[] { this.btnRestartRound }, true)); #endregion this.uscPlugins.GetPluginDetails += new uscPluginPanel.GetPluginDetailsDelegate(uscPlugins_GetPluginDetails); this.uscPlugins.SetPluginVariable += new uscPluginPanel.SetPluginVariableDelegate(uscPlugins_SetPluginVariable); this.uscPlugins.PluginEnabled += new uscPluginPanel.PluginEnabledDelegate(uscPlugins_PluginEnabled); this.uscPlugins.PluginLoaded += new uscPluginPanel.PluginEventDelegate(uscPlugins_PluginLoaded); this.uscPlugins.PluginVariablesAltered += new uscPluginPanel.PluginEventDelegate(uscPlugins_PluginVariablesAltered); this.uscPlugins.ReloadPlugins += new uscPluginPanel.EventDelegate(uscPlugins_ReloadPlugins); this.uscPlugins.OnTabChange += new OnTabChangeDelegate(uscPlugins_OnTabChange); this.uscAccounts.ManageAccountsRequest += new uscAccountsPanel.ManageAccountsRequestDelegate(uscAccounts_ManageAccountsRequest); this.uscServerConsole.SendCommand += new uscConsolePanel.SendCommandDelegate(uscServerConsole_SendCommand); this.uscServerConsole.SendListCommand += new uscConsolePanel.SendListCommandDelegate(uscServerConsole_SendListCommand); this.uscServerConsole.OnTabChange += new OnTabChangeDelegate(uscServerConsole_OnTabChange); this.m_tabParentLayerControl = new TabPage("Parent Layer Control"); this.m_tabParentLayerControl.Name = "tabLayerControl"; this.m_tabParentLayerControl.Padding = new Padding(8); this.m_tabParentLayerControl.UseVisualStyleBackColor = true; this.m_uscParentLayerControl = new uscParentLayerControl(); this.m_uscParentLayerControl.Dock = DockStyle.Fill; this.m_uscParentLayerControl.BackColor = Color.Transparent; //this.m_uscParentLayerControl.SendCommand += new uscParentLayerControl.SendCommandDelegate(m_uscParentLayerControl_SendCommand); this.m_uscParentLayerControl.Initialize(this.m_frmParent, this); this.m_tabParentLayerControl.Controls.Add(m_uscParentLayerControl); this.m_uscParentLayerControl.OnTabChange += new OnTabChangeDelegate(m_uscParentLayerControl_OnTabChange); this.uscPlugins.Initialize(this.m_frmParent, this); this.uscPlugins.SetConnection(this.m_prcConnection); this.uscLogin.Initalize(this.m_frmParent, this); this.uscLogin.SetConnection(this.m_prcConnection); this.uscLogin.SetLocalization(this.m_prcConnection.Language); this.uscMap.SetConnection(this.m_prcConnection); this.uscEvents.SetConnection(this.m_prcConnection); this.uscLists.SetConnection(this.m_prcConnection); this.uscSettings.SetConnection(this.m_prcConnection); this.uscServerConsole.SetConnection(this.m_prcConnection); this.uscChat.SetConnection(this.m_prcConnection); this.uscPlayers.SetConnection(this.m_prcConnection); this.m_uscParentLayerControl.SetConnection(this.m_prcConnection); this.uscAccounts.SetConnection(this.m_praApplication, this.m_prcConnection); }
public virtual void OnAccountPrivilegesUpdate(string username, CPrivileges privileges) { }
public void m_prcClient_ProconPrivileges(PRoConClient sender, CPrivileges spPrivs) { this.m_spPrivileges = spPrivs; this.m_dicAsyncSettingControls["local.reservedlist.append"].m_blReEnableControls = this.m_spPrivileges.CanEditReservedSlotsList; this.m_dicAsyncSettingControls["local.reservedlist.remove"].m_blReEnableControls = this.m_spPrivileges.CanEditReservedSlotsList; if (this.lsvReservedList.SelectedItems.Count > 0) { this.btnReservedRemoveSoldier.Enabled = this.m_spPrivileges.CanEditReservedSlotsList; } // ELSE It'll already be disabled this.lnkReservedAddSoldierName.Enabled = this.m_spPrivileges.CanEditReservedSlotsList; this.m_dicAsyncSettingControls["local.spectatorlist.append"].m_blReEnableControls = this.m_spPrivileges.CanEditReservedSlotsList; this.m_dicAsyncSettingControls["local.spectatorlist.remove"].m_blReEnableControls = this.m_spPrivileges.CanEditReservedSlotsList; if (this.lsvSpectatorList.SelectedItems.Count > 0) { this.btnSpectatorRemoveSoldier.Enabled = this.m_spPrivileges.CanEditReservedSlotsList; } // ELSE It'll already be disabled this.lnkSpectatorAddSoldierName.Enabled = this.m_spPrivileges.CanEditReservedSlotsList; this.m_dicAsyncSettingControls["local.banlist.clearlist"].m_blReEnableControls = this.m_spPrivileges.CanEditBanList; this.m_dicAsyncSettingControls["local.banlist.unban"].m_blReEnableControls = this.m_spPrivileges.CanEditBanList; this.btnBanlistClearBanlist.Enabled = this.m_spPrivileges.CanEditBanList; if (this.lsvBanlist.SelectedItems.Count > 0) { this.btnBanlistUnban.Enabled = this.m_spPrivileges.CanEditBanList; } // ELSE It'll already be disabled // Manual banning.. this.rdoBanlistPbGUID.Enabled = this.rdoBanlistPermanent.Enabled = this.m_spPrivileges.CanPermanentlyBanPlayers; if (this.rdoBanlistPbGUID.Checked == true && this.rdoBanlistPbGUID.Enabled == false) { this.rdoBanlistName.Checked = true; } if (this.rdoBanlistPermanent.Checked == true && this.rdoBanlistPermanent.Enabled == false) { this.rdoBanlistTemporary.Checked = true; } this.spltBanlistManualBans.Panel2.Enabled = this.m_spPrivileges.CanTemporaryBanPlayers; }
public CPrivileges CollectLowestPrivileges(string strAccountName) { CPrivileges spLowestPrivileges = new CPrivileges(); if (this.m_paProcon.AccountsList.Contains(strAccountName) == true) { spLowestPrivileges.PrivilegesFlags = CPrivileges.FullPrivilegesFlags; foreach (PRoConClient prcClient in this.m_paProcon.Connections) { if (prcClient.Layer != null && prcClient.Layer.AccountPrivileges.Contains(strAccountName) == true) { spLowestPrivileges.SetLowestPrivileges(prcClient.Layer.AccountPrivileges[strAccountName].Privileges); } } //if (this.m_paProcon.AccountsList.Contains(strAccountName) == true) { // foreach (AccountPrivilege apPrivilege in this.m_paProcon.AccountsList[strAccountName].AccountPrivileges) { // } //} } return spLowestPrivileges; }
public static string GetConfirmationLabel(out bool blAbleToPunish, string strBanDescription, CPrivileges cpPrivileges, CLocalization clocLanguage, bool blKill, bool blKick, bool blPerm, bool blTemp, TextBox txtTime, ComboBox cboTimeMultiplier, string[] a_strTimeDescriptionsLong, int iTempBanCeiling) { string strLabel = String.Empty; blAbleToPunish = false; if (clocLanguage != null) { if (blKill == true) { strLabel = clocLanguage.GetLocalized("uscPlayerPunishPanel.lblConfirmation.Kill", new string[] { strBanDescription }); blAbleToPunish = true && (cpPrivileges.CanKillPlayers == true); } else if (blKick == true) { strLabel = clocLanguage.GetLocalized("uscPlayerPunishPanel.lblConfirmation.Kick", new string[] { strBanDescription }); blAbleToPunish = true && (cpPrivileges.CanKickPlayers == true); } else if (blPerm == true) { strLabel = clocLanguage.GetLocalized("uscPlayerPunishPanel.lblConfirmation.PermanentBan", new string[] { strBanDescription }); blAbleToPunish = true && (cpPrivileges.CanPermanentlyBanPlayers == true); } else if (blTemp == true) { string strBanLength = uscPlayerPunishPanel.GetBanLength(txtTime, cboTimeMultiplier, a_strTimeDescriptionsLong); if (strBanLength.Length > 0) { // strLabel += " for " + strBanLength; if (cpPrivileges.CanTemporaryBanPlayers == true && cpPrivileges.CanPermanentlyBanPlayers == false && (uscPlayerPunishPanel.GetBanLength(txtTime, cboTimeMultiplier) * 60) > iTempBanCeiling) { strLabel = clocLanguage.GetLocalized("uscPlayerPunishPanel.lblConfirmation.TemporaryBan.ToLong", new string[] { uscPlayerPunishPanel.SecondsToText((UInt32)(iTempBanCeiling), a_strTimeDescriptionsLong) }); blAbleToPunish = false; } else { strLabel = clocLanguage.GetLocalized("uscPlayerPunishPanel.lblConfirmation.TemporaryBan", new string[] { strBanDescription, clocLanguage.GetLocalized("uscPlayerPunishPanel.lblConfirmation.TemporaryBan.Time", new string[] { strBanLength }) }); blAbleToPunish = true && (cpPrivileges.CanTemporaryBanPlayers == true); } } else { strLabel = clocLanguage.GetLocalized("uscPlayerPunishPanel.lblConfirmation.TemporaryBan", new string[] { strBanDescription, String.Empty }); blAbleToPunish = false; } } strLabel += ":"; } return(strLabel); }
/* public List<string> SetListsSettings { set { bool blChecked = true; if (value.Count >= 1 && bool.TryParse(value[0], out blChecked) == true) { this.spltBanlistManualBans.Panel2Collapsed = !blChecked; this.picCloseOpenManualBans_Click(null, null); } } } public string ListsSettings { get { return String.Format("{0}", this.spltBanlistManualBans.Panel2Collapsed); } } */ public uscListControlPanel() { InitializeComponent(); this.SetStyle(ControlStyles.UserPaint, true); this.SetStyle(ControlStyles.AllPaintingInWmPaint, true); this.SetStyle(ControlStyles.DoubleBuffer, true); this.m_regIP = new Regex(@"^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$", RegexOptions.Compiled); this.m_regPbGUID = new Regex("^[A-Fa-f0-9]{32}$", RegexOptions.Compiled); this.m_regBc2GUID = new Regex("^EA_[A-Fa-f0-9]{32}$", RegexOptions.Compiled); this.m_lvwReservedSlotsColumnSorter = new ListViewColumnSorter(); this.lsvReservedList.ListViewItemSorter = this.m_lvwReservedSlotsColumnSorter; this.m_lvwSpectatorSlotsColumnSorter = new ListViewColumnSorter(); this.lsvSpectatorList.ListViewItemSorter = this.m_lvwSpectatorSlotsColumnSorter; this.m_lvwBanlistColumnSorter = new ListViewColumnSorter(); this.lsvBanlist.ListViewItemSorter = this.m_lvwBanlistColumnSorter; this.pnlReservedPanel.Dock = DockStyle.Fill; this.pnlSpectatorPanel.Dock = DockStyle.Fill; this.m_fntComboBoxSelectedFont = new Font("Segoe UI", 10, FontStyle.Bold); this.m_blSettingAppendingReservedPlayer = false; this.m_blSettingRemovingReservedPlayer = false; this.m_blSettingAppendingSpectatorPlayer = false; this.m_blSettingRemovingSpectatorPlayer = false; this.m_dicAsyncSettingControls = new Dictionary<string, AsyncStyleSetting>(); // Reservedlist updates this.m_dicAsyncSettingControls.Add("local.reservedlist.list", new AsyncStyleSetting(this.picReservedList, this.lsvReservedList, new Control[] { this.btnReservedSlotsListRefresh }, true)); this.m_dicAsyncSettingControls.Add("local.reservedlist.append", new AsyncStyleSetting(this.picReservedAddSoldierName, this.lsvReservedList, new Control[] { this.lblReservedAddSoldierName, this.txtReservedAddSoldierName, this.lnkReservedAddSoldierName }, true)); this.m_dicAsyncSettingControls.Add("local.reservedlist.remove", new AsyncStyleSetting(this.picReservedList, this.lsvReservedList, new Control[] { this.btnReservedRemoveSoldier }, true)); // SpectatorList updates this.m_dicAsyncSettingControls.Add("local.spectatorlist.list", new AsyncStyleSetting(this.picSpectatorList, this.lsvSpectatorList, new Control[] { this.btnSpectatorSlotsListRefresh }, true)); this.m_dicAsyncSettingControls.Add("local.spectatorlist.append", new AsyncStyleSetting(this.picSpectatorAddSoldierName, this.lsvSpectatorList, new Control[] { this.lblSpectatorAddSoldierName, this.txtSpectatorAddSoldierName, this.lnkSpectatorAddSoldierName }, true)); this.m_dicAsyncSettingControls.Add("local.spectatorlist.remove", new AsyncStyleSetting(this.picSpectatorList, this.lsvSpectatorList, new Control[] { this.btnSpectatorRemoveSoldier }, true)); this.m_dicAsyncSettingControls.Add("local.banlist.clearlist", new AsyncStyleSetting(this.picClearLists, this.btnBanlistClearBanlist, new Control[] { this.btnBanlistClearBanlist }, true)); this.m_dicAsyncSettingControls.Add("local.banlist.unban", new AsyncStyleSetting(this.picUnbanPlayer, this.btnBanlistUnban, new Control[] { this.btnBanlistUnban }, true)); this.m_dicAsyncSettingControls.Add("local.banlist.banning", new AsyncStyleSetting(this.picBanlistManualBanOkay, this.btnBanlistAddBan, new Control[] { this.btnBanlistAddBan }, false)); this.ma_strTimeDescriptionsShort = new string[] { "y ", "y ", "M ", "M ", "w ", "w ", "d ", "d ", "h ", "h ", "m ", "m ", "s ", "s " }; this.ma_strTimeDescriptionsLong = new string[] { " year ", " years ", " month ", " months ", " week ", " weeks ", " day ", " days ", " hour ", " hours ", " minute ", " minutes ", " second", " seconds" }; this.cboBanlistTimeMultiplier.SelectedIndex = 0; this.m_spPrivileges = new CPrivileges(CPrivileges.FullPrivilegesFlags); }
private void m_prcConnection_ProconPrivileges(PRoConClient sender, CPrivileges spPrivs) { if (spPrivs.CanIssueLimitedProconPluginCommands == true && this.tbcClientTabs.TabPages.Contains(this.m_tabParentLayerControl) == false) { this.tbcClientTabs.TabPages.Add(this.m_tabParentLayerControl); this.m_tabParentLayerControl.ImageKey = "sitemap_color.png"; /* this.m_prcConnection.SendCommand(new List<string> { "procon.account.listAccounts" }); this.m_prcConnection.SendCommand(new List<string> { "procon.account.listLoggedIn" }); this.m_prcConnection.SendCommand(new List<string> { "procon.plugin.listLoaded" }); this.m_prcConnection.SendCommand(new List<string> { "procon.plugin.listEnabled" }); */ } else if (spPrivs.CanIssueLimitedProconCommands == false && this.tbcClientTabs.TabPages.Contains(this.m_tabParentLayerControl) == true) { this.tbcClientTabs.TabPages.Remove(this.m_tabParentLayerControl); } if (this.m_praApplication.OptionsSettings.LayerHideLocalPlugins == true) { this.tbcClientTabs.TabPages.Remove(this.tabPlugins); // this.tabPlugins.Hide(); } if (this.m_praApplication.OptionsSettings.LayerHideLocalAccounts == true) { this.tbcClientTabs.TabPages.Remove(this.tabAccounts); // this.tabAccounts.Hide(); } this.pnlMapControls.Visible = spPrivs.CanUseMapFunctions; this.m_prcConnection.SendGetProconVarsPacket("TEMP_BAN_CEILING"); //this.m_prcConnection.SendRequest(new List<string> { "procon.vars", "TEMP_BAN_CEILING" }); }