From 42bb3e7405352755a2c64901a518a0ef8d629d53 Mon Sep 17 00:00:00 2001 From: Will <39478251+VITALISED@users.noreply.github.com> Date: Sat, 6 Apr 2024 18:34:07 +1100 Subject: [PATCH 01/38] It's fixed --- .../mod/resource/ui/menus/combo_buttons.res | 536 +++++++++++++++ .../mod/scripts/vscripts/ui/combo_buttons.nut | 619 ++++++++++++++++++ .../mod/scripts/vscripts/ui/menu_lobby.nut | 92 ++- .../scripts/vscripts/ui/panel_mainmenu.nut | 54 +- .../mod/scripts/vscripts/ui/ui_utility.gnut | 8 + 5 files changed, 1268 insertions(+), 41 deletions(-) create mode 100644 Northstar.Client/mod/resource/ui/menus/combo_buttons.res create mode 100644 Northstar.Client/mod/scripts/vscripts/ui/combo_buttons.nut diff --git a/Northstar.Client/mod/resource/ui/menus/combo_buttons.res b/Northstar.Client/mod/resource/ui/menus/combo_buttons.res new file mode 100644 index 000000000..2a834e5f4 --- /dev/null +++ b/Northstar.Client/mod/resource/ui/menus/combo_buttons.res @@ -0,0 +1,536 @@ +// Current Support: +// Rows x 10 +// Columns x 4 (for the users sake, menus should really never have more than 3 + +resource/ui/menus/combo_buttons.res +{ + ButtonRow0x0 + { + ControlName BaseModHybridButton + InheritProperties ComboButtonLarge + labelText "ButtonRow0x0" + + tabPosition 1 + + pin_to_sibling ButtonRowAnchor + pin_corner_to_sibling TOP_LEFT + pin_to_sibling_corner TOP_LEFT + } + ButtonRow0x1 + { + ControlName BaseModHybridButton + InheritProperties ComboButtonLarge + labelText "ButtonRow0x1" + + pin_to_sibling ButtonRow0x0 + pin_corner_to_sibling TOP_LEFT + pin_to_sibling_corner TOP_RIGHT + } + ButtonRow0x2 + { + ControlName BaseModHybridButton + InheritProperties ComboButtonLarge + labelText "ButtonRow0x2" + + pin_to_sibling ButtonRow0x1 + pin_corner_to_sibling TOP_LEFT + pin_to_sibling_corner TOP_RIGHT + } + ButtonRow0x3 + { + ControlName BaseModHybridButton + InheritProperties ComboButtonLarge + labelText "ButtonRow0x3" + + pin_to_sibling ButtonRow0x2 + pin_corner_to_sibling TOP_LEFT + pin_to_sibling_corner TOP_RIGHT + } + ButtonRow0x4 + { + ControlName BaseModHybridButton + InheritProperties ComboButtonLarge + labelText "ButtonRow0x4" + + pin_to_sibling ButtonRow0x3 + pin_corner_to_sibling TOP_LEFT + pin_to_sibling_corner TOP_RIGHT + } + ButtonRow0x5 + { + ControlName BaseModHybridButton + InheritProperties ComboButtonLarge + labelText "ButtonRow0x5" + + pin_to_sibling ButtonRow0x4 + pin_corner_to_sibling TOP_LEFT + pin_to_sibling_corner TOP_RIGHT + } + TitleRow0 + { + ControlName RuiPanel + rui "ui/combo_header_large.rpak" + InheritProperties ComboButtonTitleLarge + labelText "TitleRow0" + + pin_to_sibling ButtonRow0x0 + } + + ButtonRow1x0 + { + ControlName BaseModHybridButton + InheritProperties ComboButtonLarge + labelText "ButtonRow1x0" + + pin_to_sibling ButtonRowAnchor + pin_corner_to_sibling TOP_LEFT + pin_to_sibling_corner TOP_LEFT + } + ButtonRow1x1 + { + ControlName BaseModHybridButton + InheritProperties ComboButtonLarge + labelText "ButtonRow1x1" + + pin_to_sibling ButtonRow1x0 + pin_corner_to_sibling TOP_LEFT + pin_to_sibling_corner TOP_RIGHT + } + ButtonRow1x2 + { + ControlName BaseModHybridButton + InheritProperties ComboButtonLarge + labelText "ButtonRow1x2" + + pin_to_sibling ButtonRow1x1 + pin_corner_to_sibling TOP_LEFT + pin_to_sibling_corner TOP_RIGHT + } + ButtonRow1x3 + { + ControlName BaseModHybridButton + InheritProperties ComboButtonLarge + labelText "ButtonRow1x3" + + pin_to_sibling ButtonRow1x2 + pin_corner_to_sibling TOP_LEFT + pin_to_sibling_corner TOP_RIGHT + } + TitleRow1 + { + ControlName RuiPanel + rui "ui/combo_header_large.rpak" + InheritProperties ComboButtonTitleLarge + labelText "TitleRow1" + + pin_to_sibling ButtonRow1x0 + } + + + ButtonRow2x0 + { + ControlName BaseModHybridButton + InheritProperties ComboButtonLarge + labelText "ButtonRow2x0" + + pin_to_sibling ButtonRowAnchor + pin_corner_to_sibling TOP_LEFT + pin_to_sibling_corner TOP_LEFT + } + ButtonRow2x1 + { + ControlName BaseModHybridButton + InheritProperties ComboButtonLarge + labelText "ButtonRow2x1" + + pin_to_sibling ButtonRow2x0 + pin_corner_to_sibling TOP_LEFT + pin_to_sibling_corner TOP_RIGHT + } + ButtonRow2x2 + { + ControlName BaseModHybridButton + InheritProperties ComboButtonLarge + labelText "ButtonRow2x2" + + pin_to_sibling ButtonRow2x1 + pin_corner_to_sibling TOP_LEFT + pin_to_sibling_corner TOP_RIGHT + } + ButtonRow2x3 + { + ControlName BaseModHybridButton + InheritProperties ComboButtonLarge + labelText "ButtonRow2x3" + + pin_to_sibling ButtonRow2x2 + pin_corner_to_sibling TOP_LEFT + pin_to_sibling_corner TOP_RIGHT + } + TitleRow2 + { + ControlName RuiPanel + rui "ui/combo_header_large.rpak" + InheritProperties ComboButtonTitleLarge + labelText "TitleRow2" + + pin_to_sibling ButtonRow2x0 + } + + + ButtonRow3x0 + { + ControlName BaseModHybridButton + InheritProperties ComboButtonLarge + labelText "ButtonRow3x0" + + pin_to_sibling ButtonRowAnchor + pin_corner_to_sibling TOP_LEFT + pin_to_sibling_corner TOP_LEFT + } + ButtonRow3x1 + { + ControlName BaseModHybridButton + InheritProperties ComboButtonLarge + labelText "ButtonRow3x1" + + pin_to_sibling ButtonRow3x0 + pin_corner_to_sibling TOP_LEFT + pin_to_sibling_corner TOP_RIGHT + } + ButtonRow3x2 + { + ControlName BaseModHybridButton + InheritProperties ComboButtonLarge + labelText "ButtonRow3x2" + + pin_to_sibling ButtonRow3x1 + pin_corner_to_sibling TOP_LEFT + pin_to_sibling_corner TOP_RIGHT + } + ButtonRow3x3 + { + ControlName BaseModHybridButton + InheritProperties ComboButtonLarge + labelText "ButtonRow3x3" + + pin_to_sibling ButtonRow3x2 + pin_corner_to_sibling TOP_LEFT + pin_to_sibling_corner TOP_RIGHT + } + TitleRow3 + { + ControlName RuiPanel + rui "ui/combo_header_large.rpak" + InheritProperties ComboButtonTitleLarge + labelText "TitleRow3" + + pin_to_sibling ButtonRow3x0 + } + + + ButtonRow4x0 + { + ControlName BaseModHybridButton + InheritProperties ComboButtonLarge + labelText "ButtonRow4x0" + + pin_to_sibling ButtonRowAnchor + pin_corner_to_sibling TOP_LEFT + pin_to_sibling_corner TOP_LEFT + } + ButtonRow4x1 + { + ControlName BaseModHybridButton + InheritProperties ComboButtonLarge + labelText "ButtonRow4x1" + + pin_to_sibling ButtonRow4x0 + pin_corner_to_sibling TOP_LEFT + pin_to_sibling_corner TOP_RIGHT + } + ButtonRow4x2 + { + ControlName BaseModHybridButton + InheritProperties ComboButtonLarge + labelText "ButtonRow4x2" + + pin_to_sibling ButtonRow4x1 + pin_corner_to_sibling TOP_LEFT + pin_to_sibling_corner TOP_RIGHT + } + ButtonRow4x3 + { + ControlName BaseModHybridButton + InheritProperties ComboButtonLarge + labelText "ButtonRow4x3" + + pin_to_sibling ButtonRow4x2 + pin_corner_to_sibling TOP_LEFT + pin_to_sibling_corner TOP_RIGHT + } + TitleRow4 + { + ControlName RuiPanel + rui "ui/combo_header_large.rpak" + InheritProperties ComboButtonTitleLarge + labelText "TitleRow4" + + pin_to_sibling ButtonRow4x0 + } + + + ButtonRow5x0 + { + ControlName BaseModHybridButton + InheritProperties ComboButtonLarge + labelText "ButtonRow5x0" + + pin_to_sibling ButtonRowAnchor + pin_corner_to_sibling TOP_LEFT + pin_to_sibling_corner TOP_LEFT + } + ButtonRow5x1 + { + ControlName BaseModHybridButton + InheritProperties ComboButtonLarge + labelText "ButtonRow5x1" + + pin_to_sibling ButtonRow5x0 + pin_corner_to_sibling TOP_LEFT + pin_to_sibling_corner TOP_RIGHT + } + ButtonRow5x2 + { + ControlName BaseModHybridButton + InheritProperties ComboButtonLarge + labelText "ButtonRow5x2" + + pin_to_sibling ButtonRow5x1 + pin_corner_to_sibling TOP_LEFT + pin_to_sibling_corner TOP_RIGHT + } + ButtonRow5x3 + { + ControlName BaseModHybridButton + InheritProperties ComboButtonLarge + labelText "ButtonRow5x3" + + pin_to_sibling ButtonRow5x2 + pin_corner_to_sibling TOP_LEFT + pin_to_sibling_corner TOP_RIGHT + } + TitleRow5 + { + ControlName RuiPanel + rui "ui/combo_header_large.rpak" + InheritProperties ComboButtonTitleLarge + labelText "TitleRow5" + + pin_to_sibling ButtonRow5x0 + } + + + ButtonRow6x0 + { + ControlName BaseModHybridButton + InheritProperties ComboButtonLarge + labelText "ButtonRow6x0" + + pin_to_sibling ButtonRowAnchor + pin_corner_to_sibling TOP_LEFT + pin_to_sibling_corner TOP_LEFT + } + ButtonRow6x1 + { + ControlName BaseModHybridButton + InheritProperties ComboButtonLarge + labelText "ButtonRow6x1" + + pin_to_sibling ButtonRow6x0 + pin_corner_to_sibling TOP_LEFT + pin_to_sibling_corner TOP_RIGHT + } + ButtonRow6x2 + { + ControlName BaseModHybridButton + InheritProperties ComboButtonLarge + labelText "ButtonRow6x2" + + pin_to_sibling ButtonRow6x1 + pin_corner_to_sibling TOP_LEFT + pin_to_sibling_corner TOP_RIGHT + } + ButtonRow6x3 + { + ControlName BaseModHybridButton + InheritProperties ComboButtonLarge + labelText "ButtonRow6x3" + + pin_to_sibling ButtonRow6x2 + pin_corner_to_sibling TOP_LEFT + pin_to_sibling_corner TOP_RIGHT + } + TitleRow6 + { + ControlName RuiPanel + rui "ui/combo_header_large.rpak" + InheritProperties ComboButtonTitleLarge + labelText "TitleRow6" + + pin_to_sibling ButtonRow6x0 + } + + + ButtonRow7x0 + { + ControlName BaseModHybridButton + InheritProperties ComboButtonLarge + labelText "ButtonRow7x0" + + pin_to_sibling ButtonRowAnchor + pin_corner_to_sibling TOP_LEFT + pin_to_sibling_corner TOP_LEFT + } + ButtonRow7x1 + { + ControlName BaseModHybridButton + InheritProperties ComboButtonLarge + labelText "ButtonRow7x1" + + pin_to_sibling ButtonRow7x0 + pin_corner_to_sibling TOP_LEFT + pin_to_sibling_corner TOP_RIGHT + } + ButtonRow7x2 + { + ControlName BaseModHybridButton + InheritProperties ComboButtonLarge + labelText "ButtonRow7x2" + + pin_to_sibling ButtonRow7x1 + pin_corner_to_sibling TOP_LEFT + pin_to_sibling_corner TOP_RIGHT + } + ButtonRow7x3 + { + ControlName BaseModHybridButton + InheritProperties ComboButtonLarge + labelText "ButtonRow7x3" + + pin_to_sibling ButtonRow7x2 + pin_corner_to_sibling TOP_LEFT + pin_to_sibling_corner TOP_RIGHT + } + TitleRow7 + { + ControlName RuiPanel + rui "ui/combo_header_large.rpak" + InheritProperties ComboButtonTitleLarge + labelText "TitleRow7" + + pin_to_sibling ButtonRow7x0 + } + + + ButtonRow8x0 + { + ControlName BaseModHybridButton + InheritProperties ComboButtonLarge + labelText "ButtonRow8x0" + + pin_to_sibling ButtonRowAnchor + pin_corner_to_sibling TOP_LEFT + pin_to_sibling_corner TOP_LEFT + } + ButtonRow8x1 + { + ControlName BaseModHybridButton + InheritProperties ComboButtonLarge + labelText "ButtonRow8x1" + + pin_to_sibling ButtonRow8x0 + pin_corner_to_sibling TOP_LEFT + pin_to_sibling_corner TOP_RIGHT + } + ButtonRow8x2 + { + ControlName BaseModHybridButton + InheritProperties ComboButtonLarge + labelText "ButtonRow8x2" + + pin_to_sibling ButtonRow8x1 + pin_corner_to_sibling TOP_LEFT + pin_to_sibling_corner TOP_RIGHT + } + ButtonRow8x3 + { + ControlName BaseModHybridButton + InheritProperties ComboButtonLarge + labelText "ButtonRow8x3" + + pin_to_sibling ButtonRow8x2 + pin_corner_to_sibling TOP_LEFT + pin_to_sibling_corner TOP_RIGHT + } + TitleRow8 + { + ControlName RuiPanel + rui "ui/combo_header_large.rpak" + InheritProperties ComboButtonTitleLarge + labelText "TitleRow8" + + pin_to_sibling ButtonRow8x0 + } + + + ButtonRow9x0 + { + ControlName BaseModHybridButton + InheritProperties ComboButtonLarge + labelText "ButtonRow9x0" + + pin_to_sibling ButtonRowAnchor + pin_corner_to_sibling TOP_LEFT + pin_to_sibling_corner TOP_LEFT + } + ButtonRow9x1 + { + ControlName BaseModHybridButton + InheritProperties ComboButtonLarge + labelText "ButtonRow9x1" + + pin_to_sibling ButtonRow9x0 + pin_corner_to_sibling TOP_LEFT + pin_to_sibling_corner TOP_RIGHT + } + ButtonRow9x2 + { + ControlName BaseModHybridButton + InheritProperties ComboButtonLarge + labelText "ButtonRow9x2" + + pin_to_sibling ButtonRow9x1 + pin_corner_to_sibling TOP_LEFT + pin_to_sibling_corner TOP_RIGHT + } + ButtonRow9x3 + { + ControlName BaseModHybridButton + InheritProperties ComboButtonLarge + labelText "ButtonRow9x3" + + pin_to_sibling ButtonRow9x2 + pin_corner_to_sibling TOP_LEFT + pin_to_sibling_corner TOP_RIGHT + } + TitleRow9 + { + ControlName RuiPanel + rui "ui/combo_header_large.rpak" + InheritProperties ComboButtonTitleLarge + labelText "TitleRow9" + + pin_to_sibling ButtonRow9x0 + } +} diff --git a/Northstar.Client/mod/scripts/vscripts/ui/combo_buttons.nut b/Northstar.Client/mod/scripts/vscripts/ui/combo_buttons.nut new file mode 100644 index 000000000..25e1daf7a --- /dev/null +++ b/Northstar.Client/mod/scripts/vscripts/ui/combo_buttons.nut @@ -0,0 +1,619 @@ +untyped + +global function ComboButtons_Create +global function ComboButtons_Finalize +global function AddComboButtonHeader +global function AddComboButton + +global function ComboButton_SetText + +global function SetComboButtonHeaderTitle +global function ComboButton_SetNewMail +global function ComboButton_SetNew +global function ComboButton_SetHasPurchase + +global function SetComboButtonHeaderTint + +global function ComboButtons_ResetColumnFocus + +#if DEV +global function DEV_GetComboStruct +#endif + +global const int MAX_COMBO_BUTTON_ROWS = 10 +global const int MAX_COMBO_BUTTON_COLS = 5 + +const float TRANSITION_ANIM_TIME = 0.016667 * 3 + + +global struct ComboButtonData +{ + var button + int rowIndex + int colIndex + string text +} + +global struct ComboStruct +{ + var menu + + int collapsedHeight = 1 + int expandedHeight = 1 + + bool sharedColumnFocus = false + int numRows = 0 + + // NOTE: there's a bug in script handling that necessitates rows/columns being flipped here + ComboButtonData[MAX_COMBO_BUTTON_COLS][MAX_COMBO_BUTTON_ROWS] comboButtonGrid + var[MAX_COMBO_BUTTON_ROWS] rowHeaders + int[MAX_COMBO_BUTTON_ROWS] defaultColumnIndex + + var navUpButton = null + var navDownButton = null + var navRightButton = null + bool navUpButtonDisabled = false + bool navDownButtonDisabled = false +} + +struct +{ + table comboMenuData +} file + +ComboStruct function ComboButtons_Create( var menu ) +{ + ComboStruct comboStruct + comboStruct.menu = menu + + string menuName = Hud_GetHudName( menu ) + file.comboMenuData[menuName] <- comboStruct + + comboStruct.sharedColumnFocus = false + + return comboStruct +} + +void function ComboButtons_Finalize( ComboStruct comboStruct ) +{ + float maxX = 0 + + for ( int row = 0; row < MAX_COMBO_BUTTON_ROWS; row++ ) + { + for ( int col = 0; col < MAX_COMBO_BUTTON_COLS; col++ ) + { + if ( comboStruct.comboButtonGrid[row][col].button == null ) + continue + + if ( col > 0 ) + { + float buttonX = float( Hud_GetAbsX( comboStruct.comboButtonGrid[row][col].button ) + Hud_GetWidth( comboStruct.comboButtonGrid[row][col].button ) ) + if ( buttonX > maxX ) + { + maxX = buttonX + } + } + } + } + + UpdateButtonNav( comboStruct ) + + for ( int row = 0; row < MAX_COMBO_BUTTON_ROWS; row++ ) + { + for ( int col = 0; col < MAX_COMBO_BUTTON_COLS; col++ ) + { + var button = comboStruct.comboButtonGrid[row][col].button + + if ( button == null ) + continue + + if ( col == 0 ) + { + Hud_SetY( button, -(comboStruct.expandedHeight * row) ) + } + + // save off the "auto_wide_tocontents" size of the button + Hud_SetBaseSize( button, Hud_GetWidth( button ), Hud_GetHeight( button ) ) + + if ( col == MAX_COMBO_BUTTON_COLS - 1 || comboStruct.comboButtonGrid[row][col+1].button == null ) + { + float endX = float( Hud_GetAbsX( button ) + Hud_GetWidth( button ) ) + if ( endX < maxX ) + { + float width = float( Hud_GetWidth( button ) ) + Hud_SetWidth( button, width + (maxX - endX) ) + } + } + } + } + + if ( comboStruct.rowHeaders[0] == null ) + comboStruct.collapsedHeight = comboStruct.expandedHeight + + for ( int row = 0; row < MAX_COMBO_BUTTON_ROWS; row++ ) + { + if ( comboStruct.rowHeaders[row] != null ) + Hud_SetHeight( comboStruct.rowHeaders[row], comboStruct.expandedHeight ) + } + + + if ( comboStruct.sharedColumnFocus ) + { + int minCol = -1 + int maxCol = 0 + for ( int row = 0; row < MAX_COMBO_BUTTON_ROWS; row++ ) + { + for ( int col = 0; col < MAX_COMBO_BUTTON_COLS; col++ ) + { + if ( comboStruct.comboButtonGrid[row][col].button == null ) + continue + + if ( minCol < 0 || col < minCol ) + minCol = col + + if ( col > maxCol ) + maxCol = col + } + } + +// Assert( minCol == maxCol ) + } + + array elements = GetElementsByClassname( GetParentMenu( comboStruct.menu ), "ComboButtonAlways" ) + foreach ( element in elements ) + { + var parentButton = Hud_GetParent( element ) + if ( !("alwaysChildren" in parentButton.s) ) // unused buttons don't have this initialized + continue + + parentButton.s.alwaysChildren.append( element ) + if ( Hud_IsRuiPanel( element ) ) + { + RuiSetString( Hud_GetRui( element ), "buttonText", parentButton.s.text ) + } + } + + OnComboButtonGetFocus( comboStruct.comboButtonGrid[0][0].button ) +} + + +ComboStruct function ComboButton_GetComboStruct( var button ) +{ + string parentMenuName = expect string( button.s.parentMenuName ) + ComboStruct comboStruct = file.comboMenuData[parentMenuName] + + return comboStruct +} + + +float function ComboButtons_GetMaxX( ComboStruct comboStruct ) +{ + float maxX = 0 + for ( int row = 0; row < MAX_COMBO_BUTTON_ROWS; row++ ) + { + for ( int col = 0; col < MAX_COMBO_BUTTON_COLS; col++ ) + { + if ( comboStruct.comboButtonGrid[row][col].button == null ) + continue + + if ( col > 0 ) + { + float buttonX = float( Hud_GetAbsX( comboStruct.comboButtonGrid[row][col].button ) + Hud_GetWidth( comboStruct.comboButtonGrid[row][col].button ) ) + if ( buttonX > maxX ) + { + maxX = buttonX + } + } + } + } + + return maxX +} + + +void function ComboButton_RefreshWidth( var comboButton ) +{ + ComboStruct comboStruct = ComboButton_GetComboStruct( comboButton ) + float maxX = ComboButtons_GetMaxX( comboStruct ) + + for ( int row = 0; row < MAX_COMBO_BUTTON_ROWS; row++ ) + { + for ( int col = 0; col < MAX_COMBO_BUTTON_COLS; col++ ) + { + var button = comboStruct.comboButtonGrid[row][col].button + + if ( button != comboButton ) + continue + + if ( col == MAX_COMBO_BUTTON_COLS - 1 || comboStruct.comboButtonGrid[row][col+1].button == null ) + { + float endX = float( Hud_GetAbsX( button ) + Hud_GetWidth( button ) ) + if ( endX < maxX ) + { + float width = float( Hud_GetWidth( button ) ) + Hud_SetWidth( button, width + (maxX - endX) ) + } + } + } + } +} + + +void function ComboButton_SetText( var button, string buttonText ) +{ + if ( Hud_IsLabel( button ) ) + Hud_SetText( button, buttonText ) + + if ( "alwaysChildren" in button.s ) + { + foreach ( var element in button.s.alwaysChildren ) + { + if ( !Hud_IsRuiPanel( element ) ) + continue + + RuiSetString( Hud_GetRui( element ), "buttonText", buttonText ) + } + } + + ComboButton_RefreshWidth( button ) +} + +void function ComboButton_SetNewMail( var button, bool newMessages ) +{ + if ( "alwaysChildren" in button.s ) + { + foreach ( var element in button.s.alwaysChildren ) + { + if ( !Hud_IsRuiPanel( element ) ) + continue + + RuiSetBool( Hud_GetRui( element ), "isNewMail", newMessages ) + } + } +} + +void function ComboButton_SetNew( var button, bool isNew ) +{ + if ( "alwaysChildren" in button.s ) + { + foreach ( var element in button.s.alwaysChildren ) + { + if ( !Hud_IsRuiPanel( element ) ) + continue + + RuiSetBool( Hud_GetRui( element ), "isNew", isNew ) + } + } +} + +void function ComboButton_SetHasPurchase( var button, bool hasPurchase ) +{ + if ( "alwaysChildren" in button.s ) + { + foreach ( var element in button.s.alwaysChildren ) + { + if ( !Hud_IsRuiPanel( element ) ) + continue + + RuiSetBool( Hud_GetRui( element ), "hasPurchase", hasPurchase ) + } + } +} + + +void function SetComboButtonHeaderTitle( var menu, int rowIndex, string titleText ) +{ + string menuName = Hud_GetHudName( menu ) + Assert( menuName in file.comboMenuData ) + + ComboStruct comboStruct = file.comboMenuData[menuName] + + if ( !Hud_IsRuiPanel( comboStruct.rowHeaders[rowIndex] ) ) + return + + var rui = Hud_GetRui( comboStruct.rowHeaders[rowIndex] ) + RuiSetString( rui, "titleText", titleText ) +} + +void function SetComboButtonHeaderTint( var menu, int rowIndex, bool state ) +{ + string menuName = Hud_GetHudName( menu ) + Assert( menuName in file.comboMenuData ) + + ComboStruct comboStruct = file.comboMenuData[menuName] + + if ( !Hud_IsRuiPanel( comboStruct.rowHeaders[rowIndex] ) ) + return + + var rui = Hud_GetRui( comboStruct.rowHeaders[rowIndex] ) + RuiSetBool( rui, "isTitleTint", state ) +} + + +var function AddComboButtonHeader( ComboStruct comboStruct, int rowIndex, string titleText = "" ) +{ + comboStruct.rowHeaders[rowIndex] = Hud_GetChild( comboStruct.menu, "TitleRow" + rowIndex ) + Hud_SetVisible( comboStruct.rowHeaders[rowIndex], true ) + + var rui = Hud_GetRui( comboStruct.rowHeaders[rowIndex] ) + RuiSetString( rui, "titleText", titleText ) + + comboStruct.collapsedHeight = Hud_GetHeight( comboStruct.rowHeaders[rowIndex] ) + + return comboStruct.rowHeaders[rowIndex] +} + + +var function AddComboButton( ComboStruct comboStruct, int rowIndex, int colIndex, string text = "" ) +{ + ComboButtonData comboButtonData + var button = Hud_GetChild( comboStruct.menu, "ButtonRow" + rowIndex + "x" + colIndex ) + + Hud_SetVisible( button, true ) + + button.s.rowIndex <- rowIndex + button.s.colIndex <- colIndex + button.s.text <- text + button.s.parentMenuName <- Hud_GetHudName( comboStruct.menu ) + button.s.alwaysChildren <- [] + + comboStruct.comboButtonGrid[rowIndex][colIndex].button = button + comboStruct.comboButtonGrid[rowIndex][colIndex].rowIndex = rowIndex + comboStruct.comboButtonGrid[rowIndex][colIndex].colIndex = colIndex + + if ( colIndex > 0 ) + { + comboStruct.comboButtonGrid[rowIndex][colIndex].button.SetNavLeft( comboStruct.comboButtonGrid[rowIndex][colIndex-1].button ) + comboStruct.comboButtonGrid[rowIndex][colIndex-1].button.SetNavRight( comboStruct.comboButtonGrid[rowIndex][colIndex].button ) + } + + Hud_AddEventHandler( button, UIE_GET_FOCUS, OnComboButtonGetFocus ) + Hud_AddEventHandler( button, UIE_LOSE_FOCUS, OnComboButtonLoseFocus ) + + if ( rowIndex + 1 > comboStruct.numRows ) + comboStruct.numRows = rowIndex + 1 + + button.SetColor( 0, 0, 0, 0 ) + button.SetAlpha( 0 ) + button.SetPanelAlpha( 0 ) + + if ( text != "" ) + { + Hud_SetText( button, text ) + } + + comboStruct.expandedHeight = Hud_GetHeight( button ) + + return button +} + +#if DEV +ComboStruct function DEV_GetComboStruct( string menuName ) +{ + ComboStruct comboStruct = file.comboMenuData[menuName] + + return comboStruct +} +#endif + +void function OnComboButtonGetFocus( var button ) +{ + int rowIndex = expect int( button.s.rowIndex ) + int colIndex = expect int( button.s.colIndex ) + + string parentMenuName = expect string( button.s.parentMenuName ) + ComboStruct comboStruct = file.comboMenuData[parentMenuName] + + for ( int row = 0; row < MAX_COMBO_BUTTON_ROWS; row++ ) + { + if ( comboStruct.rowHeaders[row] != null ) + { + var rui = Hud_GetRui( comboStruct.rowHeaders[row] ) + RuiSetBool( rui, "isFocused", row == rowIndex ) + + if ( rowIndex == row ) + comboStruct.rowHeaders[row].SetColor( 192, 192, 192, 255 ) + else + comboStruct.rowHeaders[row].SetColor( 160, 160, 160, 160 ) + } + + for ( int col = 0; col < MAX_COMBO_BUTTON_COLS; col++ ) + { + if ( comboStruct.comboButtonGrid[row][col].button == null ) + continue + + var button = comboStruct.comboButtonGrid[row][col].button + + if ( col == 0 ) + { + float yOffset = 0.0 + if ( row <= rowIndex ) + yOffset = float( -(comboStruct.collapsedHeight * row) ) + else if ( row > rowIndex ) + yOffset = float( -(comboStruct.collapsedHeight * row + (comboStruct.expandedHeight - comboStruct.collapsedHeight)) ) + + Hud_SetYOverTime( button, yOffset, TRANSITION_ANIM_TIME, INTERPOLATOR_DEACCEL ) + } + + // ugly for now; there's no SetHeightOverTime() and ScaleOverTime messes up the width + // alpha fade in doesn't work with the color overrides + if ( rowIndex == row ) + { + button.SetHeight( comboStruct.expandedHeight ) + foreach ( var childElement in button.s.alwaysChildren ) + { + childElement.SetHeight( comboStruct.expandedHeight ) + if ( Hud_IsRuiPanel( childElement ) ) + { + var rui = Hud_GetRui( childElement ) + RuiSetBool( rui, "isExpanded", true ) + } + } + } + else + { + button.SetHeight( comboStruct.collapsedHeight ) + foreach ( var childElement in button.s.alwaysChildren ) + { + childElement.SetHeight( comboStruct.collapsedHeight ) + if ( Hud_IsRuiPanel( childElement ) ) + { + var rui = Hud_GetRui( childElement ) + RuiSetBool( rui, "isExpanded", false ) + } + } + } + } + } + + if ( comboStruct.sharedColumnFocus ) + { + foreach ( row, defaultIndex in comboStruct.defaultColumnIndex ) + { + comboStruct.defaultColumnIndex[row] = colIndex + } + } + + UpdateButtonNav( comboStruct ) +} +/* +void function UdpateButtonAnim( var button, float duration, int newHeight, int newAlpha ) +{ + EndSignal( uiGlobal.signalDummy, "UdpateButtonHeight" ) + + OnThreadEnd( + function() : ( button, newHeight, newAlpha ) + { + button.SetPanelAlpha( newAlpha ) + button.SetHeight( newHeight ) + } + ) + + int startHeight = Hud_GetHeight( button ) + int startAlpha = Hud_GetPanelAlpha( button ) + + float heightOffset = 0.0 + if ( startHeight > newHeight ) + heightOffset += cbAnimOffset + + float startTime = Time() + float height = GraphCapped( Time(), startTime, startTime + duration, startHeight, newHeight + heightOffset ) + while ( height != newHeight ) + { + float height = GraphCapped( Time(), startTime, startTime + duration, startHeight, newHeight + heightOffset ) + Hud_SetHeight( button, height ) + + float alpha = GraphCapped( Time(), startTime, startTime + duration, startAlpha, newAlpha ) + Hud_SetPanelAlpha( button, alpha ) + + WaitFrame() + } +} +*/ + +void function OnComboButtonLoseFocus( var button ) +{ + int rowIndex = expect int( button.s.rowIndex ) + int colIndex = expect int( button.s.colIndex ) + + string parentMenuName = expect string( button.s.parentMenuName ) + ComboStruct comboStruct = file.comboMenuData[parentMenuName] + + comboStruct.defaultColumnIndex[rowIndex] = colIndex + + UpdateButtonNav( comboStruct ) + // + //if ( rowIndex == 0 ) + //{ + // var rui = Hud_GetRui( comboStruct.rowHeaders[0] ) + // RuiSetBool( rui, "hasFocus", true ) + //} + //else + //{ + // var rui = Hud_GetRui( comboStruct.rowHeaders[0] ) + // RuiSetBool( rui, "hasFocus", true ) + //} +} + + +void function ComboButtons_ResetColumnFocus( ComboStruct comboStruct ) +{ + foreach ( row, defaultIndex in comboStruct.defaultColumnIndex ) + { + comboStruct.defaultColumnIndex[row] = 0 + } +} + + +void function UpdateButtonNav( ComboStruct comboStruct ) +{ + for ( int row = 0; row < MAX_COMBO_BUTTON_ROWS; row++ ) + { + for ( int col = 0; col < MAX_COMBO_BUTTON_COLS; col++ ) + { + if ( comboStruct.comboButtonGrid[row][col].button == null ) + continue + + if ( row == MAX_COMBO_BUTTON_ROWS - 1 || comboStruct.comboButtonGrid[row+1][0].button == null ) + { + if ( comboStruct.navDownButtonDisabled ) + { + // + } + else if ( comboStruct.navDownButton != null ) + { + comboStruct.comboButtonGrid[row][col].button.SetNavDown( comboStruct.navDownButton ) + + int navUpColumnIndex = comboStruct.defaultColumnIndex[comboStruct.numRows-1] + comboStruct.navDownButton.SetNavUp( comboStruct.comboButtonGrid[row][navUpColumnIndex].button ) + } + else + { + int navDownColumnIndex = comboStruct.defaultColumnIndex[0] + comboStruct.comboButtonGrid[row][col].button.SetNavDown( comboStruct.comboButtonGrid[0][navDownColumnIndex].button ) + } + } + else + { + int navDownColumnIndex = comboStruct.defaultColumnIndex[row+1] + comboStruct.comboButtonGrid[row][col].button.SetNavDown( comboStruct.comboButtonGrid[row+1][navDownColumnIndex].button ) + } + + if ( row == 0 ) + { + if ( comboStruct.navUpButtonDisabled ) + { + // + } + else if ( comboStruct.navUpButton != null ) + { + comboStruct.comboButtonGrid[row][col].button.SetNavUp( comboStruct.navUpButton ) + + int navDownColumnIndex = comboStruct.defaultColumnIndex[0] + comboStruct.navUpButton.SetNavDown( comboStruct.comboButtonGrid[row][navDownColumnIndex].button ) + } + else + { + int navUpColumnIndex = comboStruct.defaultColumnIndex[comboStruct.numRows-1] + comboStruct.comboButtonGrid[row][col].button.SetNavUp( comboStruct.comboButtonGrid[comboStruct.numRows-1][navUpColumnIndex].button ) + } + } + else + { + int navUpColumnIndex = comboStruct.defaultColumnIndex[row-1] + comboStruct.comboButtonGrid[row][col].button.SetNavUp( comboStruct.comboButtonGrid[row-1][navUpColumnIndex].button ) + } + + if ( col == MAX_COMBO_BUTTON_COLS - 1 || comboStruct.comboButtonGrid[row][col+1].button == null ) + { + if ( comboStruct.navRightButton != null ) + { + comboStruct.comboButtonGrid[row][col].button.SetNavRight( comboStruct.navRightButton ) + + //comboStruct.navRightButton.SetNavLeft( comboStruct.comboButtonGrid[row][col].button ) + //comboStruct.navRightButton.SetNavLeft( comboStruct.comboButtonGrid[0][0].button ) + } + } + } + } +} diff --git a/Northstar.Client/mod/scripts/vscripts/ui/menu_lobby.nut b/Northstar.Client/mod/scripts/vscripts/ui/menu_lobby.nut index 23dae99d5..ae9fff184 100644 --- a/Northstar.Client/mod/scripts/vscripts/ui/menu_lobby.nut +++ b/Northstar.Client/mod/scripts/vscripts/ui/menu_lobby.nut @@ -66,6 +66,8 @@ struct var inviteFriendsButton var inviteFriendsToNetworkButton var toggleMenuModeButton + var serverBrowserButton + var privateMatchButton var networksMoreButton @@ -76,6 +78,7 @@ struct var pilotButton var titanButton var boostsButton + var progressionButton var storeButton var storeNewReleasesButton var storeBundlesButton @@ -94,6 +97,7 @@ struct array lobbyButtons var playHeader + var nsHeader var customizeHeader var callsignHeader @@ -179,7 +183,6 @@ void function InitLobbyMenu() AddMenuFooterOption( menu, BUTTON_BACK, "#BACK_BUTTON_POSTGAME_REPORT", "#POSTGAME_REPORT", OpenPostGameMenu, IsPostGameMenuValid ) AddMenuFooterOption( menu, BUTTON_TRIGGER_RIGHT, "#R_TRIGGER_CHAT", "", null, IsVoiceChatPushToTalk ) // Client side progression toggle - AddMenuFooterOption( menu, BUTTON_Y, "#Y_BUTTON_TOGGLE_PROGRESSION", "#TOGGLE_PROGRESSION", ShowToggleProgressionDialog ) InitChatroom( menu ) @@ -288,21 +291,31 @@ void function SetupComboButtonTest( var menu ) int buttonIndex = 0 file.playHeader = AddComboButtonHeader( comboStruct, headerIndex, "#MENU_HEADER_PLAY" ) - // server browser - file.findGameButton = AddComboButton( comboStruct, headerIndex, buttonIndex++, "#MENU_TITLE_SERVER_BROWSER" ) + // vanilla + + file.findGameButton = AddComboButton( comboStruct, headerIndex, buttonIndex++, "#MENU_TITLE_FIND_GAME" ) file.lobbyButtons.append( file.findGameButton ) - Hud_SetLocked( file.findGameButton, true ) - Hud_AddEventHandler( file.findGameButton, UIE_CLICK, OpenServerBrowser ) + Hud_AddEventHandler( file.findGameButton, UIE_CLICK, BigPlayButton1_Activate ) - // private match - file.inviteRoomButton = AddComboButton( comboStruct, headerIndex, buttonIndex++, "#PRIVATE_MATCH" ) - Hud_AddEventHandler( file.inviteRoomButton, UIE_CLICK, StartPrivateMatch ) + file.inviteRoomButton = AddComboButton( comboStruct, headerIndex, buttonIndex++, "#MENU_TITLE_INVITE_ROOM" ) + Hud_AddEventHandler( file.inviteRoomButton, UIE_CLICK, DoRoomInviteIfAllowed ) file.inviteFriendsButton = AddComboButton( comboStruct, headerIndex, buttonIndex++, "#MENU_TITLE_INVITE_FRIENDS" ) Hud_AddEventHandler( file.inviteFriendsButton, UIE_CLICK, InviteFriendsIfAllowed ) - Hud_SetEnabled( file.inviteFriendsButton, false ) - Hud_SetVisible( file.inviteFriendsButton, false ) + // server browser + file.serverBrowserButton = AddComboButton( comboStruct, headerIndex, buttonIndex++, "#MENU_TITLE_SERVER_BROWSER" ) + file.lobbyButtons.append( file.serverBrowserButton ) + Hud_SetLocked( file.serverBrowserButton, true ) + Hud_AddEventHandler( file.serverBrowserButton, UIE_CLICK, OpenServerBrowser ) + + // private match + file.privateMatchButton = AddComboButton( comboStruct, headerIndex, buttonIndex++, "#PRIVATE_MATCH" ) + Hud_AddEventHandler( file.privateMatchButton, UIE_CLICK, StartPrivateMatch ) + + + // Hud_SetEnabled( file.inviteFriendsButton, false ) + // Hud_SetVisible( file.inviteFriendsButton, false ) // file.toggleMenuModeButton = AddComboButton( comboStruct, headerIndex, buttonIndex++, "#MENU_LOBBY_SWITCH_FD" ) // Hud_AddEventHandler( file.toggleMenuModeButton, UIE_CLICK, ToggleLobbyMode ) @@ -320,6 +333,8 @@ void function SetupComboButtonTest( var menu ) Hud_AddEventHandler( titanButton, UIE_CLICK, AdvanceMenuEventHandler( GetMenu( "EditTitanLoadoutsMenu" ) ) ) file.boostsButton = AddComboButton( comboStruct, headerIndex, buttonIndex++, "#MENU_TITLE_BOOSTS" ) Hud_AddEventHandler( file.boostsButton, UIE_CLICK, AdvanceMenuEventHandler( GetMenu( "BurnCardMenu" ) ) ) + file.progressionButton = AddComboButton( comboStruct, headerIndex, buttonIndex++, "#TOGGLE_PROGRESSION" ) + Hud_AddEventHandler( file.progressionButton, UIE_CLICK, ShowToggleProgressionDialog ) headerIndex++ buttonIndex = 0 @@ -578,6 +593,8 @@ void function OnLobbyMenu_Open() // code will start loading DLC info from first party unless already done InitDLCStore() + thread HandleStateOfNSFooterButtons() + thread UpdateCachedNewItems() if ( file.putPlayerInMatchmakingAfterDelay ) { @@ -683,6 +700,52 @@ void function OnLobbyMenu_Open() } } +void function HandleStateOfNSFooterButtons() +{ + Hud_SetLocked( file.progressionButton, true ) + Hud_SetLocked( file.findGameButton, true ) + Hud_SetLocked( file.inviteRoomButton, true ) + Hud_SetLocked( file.inviteFriendsButton, true ) + Hud_SetLocked( file.inviteFriendsToNetworkButton, true ) + Hud_SetLocked( file.serverBrowserButton, true ) + Hud_SetLocked( file.privateMatchButton, true ) + + wait 0.3 + + var findGameButton + var inviteRoomButton + var inviteFriendsButton + var inviteFriendsToNetworkButton + var toggleMenuModeButton + var serverBrowserButton + var privateMatchButton + + if ( !IsNSLobby() ) + { + Hud_SetLocked( file.progressionButton, true ) + + Hud_SetLocked( file.findGameButton, false ) + Hud_SetLocked( file.inviteRoomButton, false ) + Hud_SetLocked( file.inviteFriendsButton, false ) + Hud_SetLocked( file.inviteFriendsToNetworkButton, false ) + + Hud_SetLocked( file.serverBrowserButton, true ) + Hud_SetLocked( file.privateMatchButton, true ) + } + else + { + Hud_SetLocked( file.progressionButton, false ) + + Hud_SetLocked( file.findGameButton, true ) + Hud_SetLocked( file.inviteRoomButton, true ) + Hud_SetLocked( file.inviteFriendsButton, true ) + Hud_SetLocked( file.inviteFriendsToNetworkButton, true ) + + Hud_SetLocked( file.serverBrowserButton, false ) + Hud_SetLocked( file.privateMatchButton, false ) + } +} + bool function DLCStoreShouldBeMarkedAsNew() { if ( !IsFullyConnected() ) @@ -703,9 +766,12 @@ void function LobbyMenuUpdate( var menu ) while ( GetTopNonDialogMenu() == menu ) { bool inPendingOpenInvite = InPendingOpenInvite() - Hud_SetLocked( file.findGameButton, !IsPartyLeader() || inPendingOpenInvite ) - Hud_SetLocked( file.inviteRoomButton, IsOpenInviteVisible() || GetPartySize() > 1 || inPendingOpenInvite ) - Hud_SetLocked( file.inviteFriendsButton, inPendingOpenInvite ) + if(!IsNSLobby()) + { + Hud_SetLocked( file.findGameButton, !IsPartyLeader() || inPendingOpenInvite ) + Hud_SetLocked( file.inviteRoomButton, IsOpenInviteVisible() || GetPartySize() > 1 || inPendingOpenInvite ) + Hud_SetLocked( file.inviteFriendsButton, inPendingOpenInvite ) + } bool canGenUp = false if ( GetUIPlayer() ) diff --git a/Northstar.Client/mod/scripts/vscripts/ui/panel_mainmenu.nut b/Northstar.Client/mod/scripts/vscripts/ui/panel_mainmenu.nut index 2f1bcf025..9629933c0 100644 --- a/Northstar.Client/mod/scripts/vscripts/ui/panel_mainmenu.nut +++ b/Northstar.Client/mod/scripts/vscripts/ui/panel_mainmenu.nut @@ -82,8 +82,8 @@ void function InitMainMenuPanel() buttonIndex = 0 var multiplayerHeader = AddComboButtonHeader( comboStruct, headerIndex, "#MULTIPLAYER_ALLCAPS" ) // "Launch Multiplayer" button removed because we don't support vanilla yet :clueless: - //file.mpButton = AddComboButton( comboStruct, headerIndex, buttonIndex++, "#MULTIPLAYER_LAUNCH" ) - //Hud_AddEventHandler( file.mpButton, UIE_CLICK, OnPlayMPButton_Activate ) + file.mpButton = AddComboButton( comboStruct, headerIndex, buttonIndex++, "#MULTIPLAYER_LAUNCH" ) + Hud_AddEventHandler( file.mpButton, UIE_CLICK, OnPlayMPButton_Activate ) file.fdButton = AddComboButton( comboStruct, headerIndex, buttonIndex++, "#MENU_LAUNCH_NORTHSTAR" ) Hud_AddEventHandler( file.fdButton, UIE_CLICK, OnPlayFDButton_Activate ) Hud_SetLocked( file.fdButton, true ) @@ -102,7 +102,7 @@ void function InitMainMenuPanel() var videoButton = AddComboButton( comboStruct, headerIndex, buttonIndex++, "#VIDEO" ) Hud_AddEventHandler( videoButton, UIE_CLICK, AdvanceMenuEventHandler( GetMenu( "VideoMenu" ) ) ) #endif - + // MOD SETTINGS var modSettingsButton = AddComboButton( comboStruct, headerIndex, buttonIndex++, "#MOD_SETTINGS" ) Hud_AddEventHandler( modSettingsButton, UIE_CLICK, AdvanceMenuEventHandler( GetMenu( "ModSettings" ) ) ) @@ -171,7 +171,7 @@ void function OnShowMainMenuPanel() UpdateSPButtons() // dont try and update the launch multiplayer button, because it doesn't exist - //thread UpdatePlayButton( file.mpButton ) + thread UpdatePlayButton( file.mpButton ) thread UpdatePlayButton( file.fdButton ) thread MonitorTrialVersionChange() @@ -391,12 +391,14 @@ void function UpdatePlayButton( var button ) hasLatestPatch = Origin_IsUpToDate() isOriginConnected = Origin_IsEnabled() ? Origin_IsOnline() : true isStryderAuthenticated = IsStryderAuthenticated() - isMPAllowed = IsStryderAllowingMP() + isMPAllowed = true if ( DEBUG_PERMISSIONS ) { printt( "isOriginConnected:", isOriginConnected ) printt( "isStryderAuthenticated:", isStryderAuthenticated ) + printt( "isMPAllowed:", isMPAllowed ) + printt( "hasLatestPatch:", hasLatestPatch ) } buttonText = "#MULTIPLAYER_LAUNCH" @@ -429,29 +431,13 @@ void function UpdatePlayButton( var button ) } else if ( button == file.mpButton ) { - // restrict non-vanilla players from accessing official servers - bool hasNonVanillaMods = false - foreach ( string modName in NSGetModNames() ) - { - if ( NSIsModEnabled( modName ) && NSIsModRequiredOnClient( modName ) ) - { - hasNonVanillaMods = true - break - } - } - - if ( hasNonVanillaMods ) - file.mpButtonActivateFunc = null - else - file.mpButtonActivateFunc = LaunchMP + file.mpButtonActivateFunc = LaunchMP } isLocked = file.mpButtonActivateFunc == null ? true : false - if( button == file.fdButton ) - thread TryUnlockNorthstarButton() - else - Hud_SetLocked( button, isLocked ) - #endif + Hud_SetLocked( button, isLocked ) + thread TryUnlockNorthstarButton() + #endif if ( Script_IsRunningTrialVersion() && !IsTrialPeriodActive() && file.mpButtonActivateFunc != LaunchGamePurchase ) { @@ -462,7 +448,7 @@ void function UpdatePlayButton( var button ) } // dont try and update the launch multiplayer button, because it doesn't exist - //ComboButton_SetText( file.mpButton, buttonText ) + ComboButton_SetText( file.mpButton, buttonText ) ComboButton_SetText( file.fdButton, "#MENU_LAUNCH_NORTHSTAR" ) //Hud_SetEnabled( file.fdButton, false ) @@ -562,7 +548,7 @@ void function TryAuthWithLocalServer() WaitFrame() } - if ( NSWasAuthSuccessful() ) + if ( NSWasAuthSuccessful() || GetConVarBool( "ns_auth_allow_insecure" ) ) { NSCompleteAuthWithLocalServer() if ( GetConVarString( "mp_gamemode" ) == "solo" ) @@ -573,7 +559,7 @@ void function TryAuthWithLocalServer() ClientCommand( "setplaylist tdm" ) ClientCommand( "map mp_lobby" ) } - else + else { CloseAllDialogs() @@ -599,6 +585,18 @@ void function OnPlayMPButton_Activate( var button ) if ( file.mpButtonActivateFunc == null ) printt( "file.mpButtonActivateFunc is null" ) + if ( NSIsModEnabled( "Northstar.Custom" ) ) + { + DialogData dialogData + dialogData.image = $"ui/menu/common/dialog_error" + dialogData.header = "#ERROR" + dialogData.message = "#NS_CUSTOM_ENABLED" + + AddDialogButton( dialogData, "#OK", null ) + OpenDialog( dialogData ) + return + } + if ( !Hud_IsLocked( button ) && file.mpButtonActivateFunc != null ) { Lobby_SetAutoFDOpen( false ) diff --git a/Northstar.Client/mod/scripts/vscripts/ui/ui_utility.gnut b/Northstar.Client/mod/scripts/vscripts/ui/ui_utility.gnut index d6a7a29a9..6e3ad1ef0 100644 --- a/Northstar.Client/mod/scripts/vscripts/ui/ui_utility.gnut +++ b/Northstar.Client/mod/scripts/vscripts/ui/ui_utility.gnut @@ -632,3 +632,11 @@ void function Hud_SetNavDown( var buttonFrom, var buttonTo ) { buttonFrom.SetNavDown( buttonTo ) } + +bool function IsNSLobby() +{ + int ret = GetConVarInt( "sv_lobbyType" ) // is 1 if hosted locally by player, not exactly R1's IsMatchmakingServer tier of useful but should be enough + printt("IsNSLobby: " + ret) + + return ret == 1 +} \ No newline at end of file From 1c9802872015e0f80a2e75b0042794fda026e76e Mon Sep 17 00:00:00 2001 From: Will <39478251+VITALISED@users.noreply.github.com> Date: Sat, 6 Apr 2024 21:09:13 +1100 Subject: [PATCH 02/38] Get rid of spammy print --- Northstar.Client/mod/scripts/vscripts/ui/ui_utility.gnut | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Northstar.Client/mod/scripts/vscripts/ui/ui_utility.gnut b/Northstar.Client/mod/scripts/vscripts/ui/ui_utility.gnut index 6e3ad1ef0..4c5d8cb98 100644 --- a/Northstar.Client/mod/scripts/vscripts/ui/ui_utility.gnut +++ b/Northstar.Client/mod/scripts/vscripts/ui/ui_utility.gnut @@ -636,7 +636,6 @@ void function Hud_SetNavDown( var buttonFrom, var buttonTo ) bool function IsNSLobby() { int ret = GetConVarInt( "sv_lobbyType" ) // is 1 if hosted locally by player, not exactly R1's IsMatchmakingServer tier of useful but should be enough - printt("IsNSLobby: " + ret) - + //printt("IsNSLobby: " + ret) return ret == 1 } \ No newline at end of file From 8e04301ac4a168ffc4c0872ee6258d4458916544 Mon Sep 17 00:00:00 2001 From: Will <39478251+VITALISED@users.noreply.github.com> Date: Sat, 6 Apr 2024 21:39:50 +1100 Subject: [PATCH 03/38] It's really not fixed --- Northstar.Client/mod/scripts/vscripts/ui/menu_main.nut | 2 +- .../scripts/vscripts/ui/menu_ns_custom_match_settings.nut | 6 ++++++ Northstar.Client/mod/scripts/vscripts/ui/panel_mainmenu.nut | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Northstar.Client/mod/scripts/vscripts/ui/menu_main.nut b/Northstar.Client/mod/scripts/vscripts/ui/menu_main.nut index d75bbb5d6..ba771876c 100644 --- a/Northstar.Client/mod/scripts/vscripts/ui/menu_main.nut +++ b/Northstar.Client/mod/scripts/vscripts/ui/menu_main.nut @@ -73,7 +73,7 @@ void function OnMainMenu_Open() Signal( uiGlobal.signalDummy, "EndOnMainMenu_Open" ) EndSignal( uiGlobal.signalDummy, "EndOnMainMenu_Open" ) - SetConVarString( "communities_hostname", "" ) // disable communities due to crash exploits that are still possible through it + // SetConVarString( "communities_hostname", "" ) // disable communities due to crash exploits that are still possible through it UpdatePromoData() // On script restarts this gives us the last data until the new request is complete RequestMainMenuPromos() // This will be ignored if there was a recent request. "infoblock_requestInterval" diff --git a/Northstar.Client/mod/scripts/vscripts/ui/menu_ns_custom_match_settings.nut b/Northstar.Client/mod/scripts/vscripts/ui/menu_ns_custom_match_settings.nut index 34ad4f77f..39cee7aee 100644 --- a/Northstar.Client/mod/scripts/vscripts/ui/menu_ns_custom_match_settings.nut +++ b/Northstar.Client/mod/scripts/vscripts/ui/menu_ns_custom_match_settings.nut @@ -120,6 +120,12 @@ void function OnSettingButtonPressed( var button ) file.enumRealValues[ int( Hud_GetScriptID( button ) ) ] = enumVal Hud_SetText( textPanel, setting.enumNames[ enumVal ] ) + + string str = PrivateMatch_GetSelectedMode() + int gamemodeIdx = GetPrivateMatchModeIndex( str ) + Hud_SetGamemodeIdx( button, gamemodeIdx ) + Hud_SetPlaylistVarName( button, setting.playlistVar ) + ClientCommand( "PrivateMatchSetPlaylistVarOverride " + setting.playlistVar + " " + setting.enumValues[ enumVal ] ) } else diff --git a/Northstar.Client/mod/scripts/vscripts/ui/panel_mainmenu.nut b/Northstar.Client/mod/scripts/vscripts/ui/panel_mainmenu.nut index 9629933c0..d17b237b8 100644 --- a/Northstar.Client/mod/scripts/vscripts/ui/panel_mainmenu.nut +++ b/Northstar.Client/mod/scripts/vscripts/ui/panel_mainmenu.nut @@ -520,7 +520,7 @@ void function OnPlayFDButton_Activate( var button ) // repurposed for launching { if ( !Hud_IsLocked( button ) ) { - SetConVarString( "communities_hostname", "" ) // disable communities due to crash exploits that are still possible through it + // SetConVarString( "communities_hostname", "" ) // disable communities due to crash exploits that are still possible through it NSTryAuthWithLocalServer() thread TryAuthWithLocalServer() } From 48e0b71abaa9c5f552d3dfb962d8c4f005644000 Mon Sep 17 00:00:00 2001 From: Will <39478251+VITALISED@users.noreply.github.com> Date: Sat, 6 Apr 2024 21:44:04 +1100 Subject: [PATCH 04/38] Note behaviour --- .../mod/scripts/vscripts/ui/menu_ns_custom_match_settings.nut | 1 + 1 file changed, 1 insertion(+) diff --git a/Northstar.Client/mod/scripts/vscripts/ui/menu_ns_custom_match_settings.nut b/Northstar.Client/mod/scripts/vscripts/ui/menu_ns_custom_match_settings.nut index 39cee7aee..20de27a34 100644 --- a/Northstar.Client/mod/scripts/vscripts/ui/menu_ns_custom_match_settings.nut +++ b/Northstar.Client/mod/scripts/vscripts/ui/menu_ns_custom_match_settings.nut @@ -126,6 +126,7 @@ void function OnSettingButtonPressed( var button ) Hud_SetGamemodeIdx( button, gamemodeIdx ) Hud_SetPlaylistVarName( button, setting.playlistVar ) + // you'll get booted for this right now because the playlist native crap is fucked ClientCommand( "PrivateMatchSetPlaylistVarOverride " + setting.playlistVar + " " + setting.enumValues[ enumVal ] ) } else From 8ee2f623757a0474dfaf1b487662e83d839788b2 Mon Sep 17 00:00:00 2001 From: Will <39478251+VITALISED@users.noreply.github.com> Date: Sun, 7 Apr 2024 01:36:31 +1100 Subject: [PATCH 05/38] Add vanilla check --- Northstar.Client/mod/scripts/vscripts/ui/panel_mainmenu.nut | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Northstar.Client/mod/scripts/vscripts/ui/panel_mainmenu.nut b/Northstar.Client/mod/scripts/vscripts/ui/panel_mainmenu.nut index d17b237b8..020563ecb 100644 --- a/Northstar.Client/mod/scripts/vscripts/ui/panel_mainmenu.nut +++ b/Northstar.Client/mod/scripts/vscripts/ui/panel_mainmenu.nut @@ -429,7 +429,7 @@ void function UpdatePlayButton( var button ) message = "#AUTHENTICATIONAGREEMENT_NO" file.mpButtonActivateFunc = null } - else if ( button == file.mpButton ) + else if ( button == file.mpButton && VANILLA ) { file.mpButtonActivateFunc = LaunchMP } From 84a51ea4a6b5afbb956b6b15293fabd90291d5c6 Mon Sep 17 00:00:00 2001 From: Will <39478251+VITALISED@users.noreply.github.com> Date: Sun, 7 Apr 2024 01:44:51 +1100 Subject: [PATCH 06/38] Fix for vanilla const not existing --- Northstar.Client/mod/scripts/vscripts/ui/panel_mainmenu.nut | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Northstar.Client/mod/scripts/vscripts/ui/panel_mainmenu.nut b/Northstar.Client/mod/scripts/vscripts/ui/panel_mainmenu.nut index 020563ecb..d45146515 100644 --- a/Northstar.Client/mod/scripts/vscripts/ui/panel_mainmenu.nut +++ b/Northstar.Client/mod/scripts/vscripts/ui/panel_mainmenu.nut @@ -393,6 +393,8 @@ void function UpdatePlayButton( var button ) isStryderAuthenticated = IsStryderAuthenticated() isMPAllowed = true + bool isVanilla = VANILLA ? true : false + if ( DEBUG_PERMISSIONS ) { printt( "isOriginConnected:", isOriginConnected ) @@ -429,7 +431,7 @@ void function UpdatePlayButton( var button ) message = "#AUTHENTICATIONAGREEMENT_NO" file.mpButtonActivateFunc = null } - else if ( button == file.mpButton && VANILLA ) + else if ( button == file.mpButton && isVanilla ) { file.mpButtonActivateFunc = LaunchMP } From c946f46681b6b34c6d6a87862c2953ad45d145cb Mon Sep 17 00:00:00 2001 From: Will <39478251+VITALISED@users.noreply.github.com> Date: Sun, 7 Apr 2024 01:45:27 +1100 Subject: [PATCH 07/38] Add a handy loc string --- .../mod/resource/northstar_client_localisation_english.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/Northstar.Client/mod/resource/northstar_client_localisation_english.txt b/Northstar.Client/mod/resource/northstar_client_localisation_english.txt index e6518febb..29e885e13 100644 --- a/Northstar.Client/mod/resource/northstar_client_localisation_english.txt +++ b/Northstar.Client/mod/resource/northstar_client_localisation_english.txt @@ -11,6 +11,7 @@ "WARNING" "Warning" "CORE_MOD_DISABLE_WARNING" "Disabling core mods can break your client!" "DISABLE" "Disable" + "NS_CUSTOM_ENABLED" "Northstar.Custom is enabled, you should disable it and other mods that will cause issues with Vanilla." "DIALOG_TITLE_INSTALLED_NORTHSTAR" "Thanks for installing Northstar!" "AUTHENTICATION_AGREEMENT_DIALOG_TEXT" "For Northstar to work, it needs to authenticate using the Northstar master server. This will require sending your origin token to the master server, it will not be stored or used for any other purposes. From a05063c12669fb25d5185ddb95a08b839125d7b9 Mon Sep 17 00:00:00 2001 From: Will <39478251+VITALISED@users.noreply.github.com> Date: Sun, 28 Apr 2024 17:41:29 +1000 Subject: [PATCH 08/38] Use new auth script stuff --- .../mod/scripts/vscripts/ui/menu_lobby.nut | 3 +++ .../mod/scripts/vscripts/ui/menu_main.nut | 2 ++ .../mod/scripts/vscripts/ui/menu_private_match.nut | 11 ++++++++++- .../mod/scripts/vscripts/ui/panel_mainmenu.nut | 4 +--- 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/Northstar.Client/mod/scripts/vscripts/ui/menu_lobby.nut b/Northstar.Client/mod/scripts/vscripts/ui/menu_lobby.nut index ae9fff184..5a4ffdb76 100644 --- a/Northstar.Client/mod/scripts/vscripts/ui/menu_lobby.nut +++ b/Northstar.Client/mod/scripts/vscripts/ui/menu_lobby.nut @@ -233,6 +233,9 @@ void function InitLobbyMenu() void function ShowToggleProgressionDialog( var button ) { + if( Hud_IsLocked( button ) ) + return; + bool enabled = Progression_GetPreference() DialogData dialogData diff --git a/Northstar.Client/mod/scripts/vscripts/ui/menu_main.nut b/Northstar.Client/mod/scripts/vscripts/ui/menu_main.nut index ba771876c..3e8ca49a7 100644 --- a/Northstar.Client/mod/scripts/vscripts/ui/menu_main.nut +++ b/Northstar.Client/mod/scripts/vscripts/ui/menu_main.nut @@ -73,6 +73,8 @@ void function OnMainMenu_Open() Signal( uiGlobal.signalDummy, "EndOnMainMenu_Open" ) EndSignal( uiGlobal.signalDummy, "EndOnMainMenu_Open" ) + NSResetToken() + // SetConVarString( "communities_hostname", "" ) // disable communities due to crash exploits that are still possible through it UpdatePromoData() // On script restarts this gives us the last data until the new request is complete diff --git a/Northstar.Client/mod/scripts/vscripts/ui/menu_private_match.nut b/Northstar.Client/mod/scripts/vscripts/ui/menu_private_match.nut index e3c1f268e..cb9961275 100644 --- a/Northstar.Client/mod/scripts/vscripts/ui/menu_private_match.nut +++ b/Northstar.Client/mod/scripts/vscripts/ui/menu_private_match.nut @@ -247,7 +247,10 @@ void function OnSelectMatchSettings_Activate( var button ) if ( Hud_IsLocked( button ) ) return - AdvanceMenu( GetMenu( "CustomMatchSettingsCategoryMenu" ) ) + if(NSIsVanilla()) + AdvanceMenu( GetMenu( "MatchSettingsMenu" ) ) + else + AdvanceMenu( GetMenu( "CustomMatchSettingsCategoryMenu" ) ) } void function SetupComboButtons( var menu, var navUpButton, var navDownButton ) @@ -271,6 +274,10 @@ void function SetupComboButtons( var menu, var navUpButton, var navDownButton ) file.matchSettingsButton = AddComboButton( comboStruct, headerIndex, buttonIndex++, "#MENU_TITLE_MATCH_SETTINGS" ) Hud_AddEventHandler( file.matchSettingsButton, UIE_CLICK, OnSelectMatchSettings_Activate ) + var friendsButton = AddComboButton( comboStruct, headerIndex, buttonIndex++, "#MENU_TITLE_INVITE_FRIENDS" ) + file.inviteFriendsButton = friendsButton + Hud_AddEventHandler( friendsButton, UIE_CLICK, InviteFriendsIfAllowed ) + headerIndex++ buttonIndex = 0 file.customizeHeader = AddComboButtonHeader( comboStruct, headerIndex, "#MENU_HEADER_LOADOUTS" ) @@ -565,12 +572,14 @@ function UpdatePrivateMatchButtons() Hud_SetLocked( file.selectMapButton, true ) Hud_SetLocked( file.selectModeButton, true ) Hud_SetLocked( file.matchSettingsButton, true ) + Hud_SetLocked( file.inviteFriendsButton, true ) } else { RHud_SetText( file.startMatchButton, "#START_MATCH" ) Hud_SetLocked( file.selectMapButton, false ) Hud_SetLocked( file.selectModeButton, false ) + Hud_SetLocked( file.inviteFriendsButton, false ) string modeName = PrivateMatch_GetSelectedMode() bool settingsLocked = IsFDMode( modeName ) diff --git a/Northstar.Client/mod/scripts/vscripts/ui/panel_mainmenu.nut b/Northstar.Client/mod/scripts/vscripts/ui/panel_mainmenu.nut index d45146515..d17b237b8 100644 --- a/Northstar.Client/mod/scripts/vscripts/ui/panel_mainmenu.nut +++ b/Northstar.Client/mod/scripts/vscripts/ui/panel_mainmenu.nut @@ -393,8 +393,6 @@ void function UpdatePlayButton( var button ) isStryderAuthenticated = IsStryderAuthenticated() isMPAllowed = true - bool isVanilla = VANILLA ? true : false - if ( DEBUG_PERMISSIONS ) { printt( "isOriginConnected:", isOriginConnected ) @@ -431,7 +429,7 @@ void function UpdatePlayButton( var button ) message = "#AUTHENTICATIONAGREEMENT_NO" file.mpButtonActivateFunc = null } - else if ( button == file.mpButton && isVanilla ) + else if ( button == file.mpButton ) { file.mpButtonActivateFunc = LaunchMP } From f9ccd7eba5d5e1e55106f9f70ee12c39836b12ff Mon Sep 17 00:00:00 2001 From: Will <39478251+VITALISED@users.noreply.github.com> Date: Sun, 28 Apr 2024 21:29:54 +1000 Subject: [PATCH 09/38] Fix openinvites --- Northstar.Client/mod/scripts/vscripts/ui/openinvites.nut | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Northstar.Client/mod/scripts/vscripts/ui/openinvites.nut b/Northstar.Client/mod/scripts/vscripts/ui/openinvites.nut index f91231b6b..2a1804cb3 100644 --- a/Northstar.Client/mod/scripts/vscripts/ui/openinvites.nut +++ b/Northstar.Client/mod/scripts/vscripts/ui/openinvites.nut @@ -202,8 +202,9 @@ void function UpdateOpenInvite_Thread() void function UICodeCallback_OpenInviteUpdated() { - // don't support on northstar - return + // openinvites not supported on northstar + if( !NSIsVanilla() ) + return if ( file.openInviteVisible ) return From b7506faaadfb872107f1733b09b708ff40e69f73 Mon Sep 17 00:00:00 2001 From: Will <39478251+VITALISED@users.noreply.github.com> Date: Mon, 29 Apr 2024 16:33:47 +1000 Subject: [PATCH 10/38] Remove old lobbytype function --- Northstar.Client/mod/scripts/vscripts/ui/menu_lobby.nut | 8 ++++---- Northstar.Client/mod/scripts/vscripts/ui/ui_utility.gnut | 7 ------- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/Northstar.Client/mod/scripts/vscripts/ui/menu_lobby.nut b/Northstar.Client/mod/scripts/vscripts/ui/menu_lobby.nut index 5a4ffdb76..e0f4d438e 100644 --- a/Northstar.Client/mod/scripts/vscripts/ui/menu_lobby.nut +++ b/Northstar.Client/mod/scripts/vscripts/ui/menu_lobby.nut @@ -596,7 +596,7 @@ void function OnLobbyMenu_Open() // code will start loading DLC info from first party unless already done InitDLCStore() - thread HandleStateOfNSFooterButtons() + thread DoNSButtonState() thread UpdateCachedNewItems() if ( file.putPlayerInMatchmakingAfterDelay ) @@ -703,7 +703,7 @@ void function OnLobbyMenu_Open() } } -void function HandleStateOfNSFooterButtons() +void function DoNSButtonState() { Hud_SetLocked( file.progressionButton, true ) Hud_SetLocked( file.findGameButton, true ) @@ -723,7 +723,7 @@ void function HandleStateOfNSFooterButtons() var serverBrowserButton var privateMatchButton - if ( !IsNSLobby() ) + if ( NSIsVanilla() ) { Hud_SetLocked( file.progressionButton, true ) @@ -769,7 +769,7 @@ void function LobbyMenuUpdate( var menu ) while ( GetTopNonDialogMenu() == menu ) { bool inPendingOpenInvite = InPendingOpenInvite() - if(!IsNSLobby()) + if( NSIsVanilla() ) { Hud_SetLocked( file.findGameButton, !IsPartyLeader() || inPendingOpenInvite ) Hud_SetLocked( file.inviteRoomButton, IsOpenInviteVisible() || GetPartySize() > 1 || inPendingOpenInvite ) diff --git a/Northstar.Client/mod/scripts/vscripts/ui/ui_utility.gnut b/Northstar.Client/mod/scripts/vscripts/ui/ui_utility.gnut index 4c5d8cb98..02d77795a 100644 --- a/Northstar.Client/mod/scripts/vscripts/ui/ui_utility.gnut +++ b/Northstar.Client/mod/scripts/vscripts/ui/ui_utility.gnut @@ -631,11 +631,4 @@ void function Hud_SetNavUp( var buttonFrom, var buttonTo ) void function Hud_SetNavDown( var buttonFrom, var buttonTo ) { buttonFrom.SetNavDown( buttonTo ) -} - -bool function IsNSLobby() -{ - int ret = GetConVarInt( "sv_lobbyType" ) // is 1 if hosted locally by player, not exactly R1's IsMatchmakingServer tier of useful but should be enough - //printt("IsNSLobby: " + ret) - return ret == 1 } \ No newline at end of file From 711a325d845416cb877808a58da879dc389b1ab6 Mon Sep 17 00:00:00 2001 From: Will <39478251+VITALISED@users.noreply.github.com> Date: Tue, 30 Apr 2024 03:43:25 +1000 Subject: [PATCH 11/38] Fix entitlement menu not working on vanilla --- Northstar.CustomServers/mod/scripts/vscripts/_items.nut | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Northstar.CustomServers/mod/scripts/vscripts/_items.nut b/Northstar.CustomServers/mod/scripts/vscripts/_items.nut index 96623086c..f7bf6c731 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/_items.nut +++ b/Northstar.CustomServers/mod/scripts/vscripts/_items.nut @@ -10094,7 +10094,10 @@ void function InitUnlockAsEntitlement( string itemRef, string parentRef, int ent unlock = file.entitlementUnlocks[fullRef] } - unlock.entitlementIds.append( 1 ) // Using `1` here instead of the huge DLC check I did previously. Having the `1` seems to keep all paid cosmetics unlocked with progression enabled. + if( !NSIsVanilla() ) + unlock.entitlementIds.append( 1 ) // Using `1` here instead of the huge DLC check I did previously. Having the `1` seems to keep all paid cosmetics unlocked with progression enabled. + else + unlock.entitlementIds.append( entitlementId ) } array function GetEntitlementIds( string itemRef, string parentRef = "" ) From a2fd37e042760e3f1c88e0003e4488cb1aacfbd5 Mon Sep 17 00:00:00 2001 From: Will <39478251+VITALISED@users.noreply.github.com> Date: Tue, 30 Apr 2024 03:57:16 +1000 Subject: [PATCH 12/38] Revert random testing stuff --- Northstar.Client/mod/scripts/vscripts/ui/panel_mainmenu.nut | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Northstar.Client/mod/scripts/vscripts/ui/panel_mainmenu.nut b/Northstar.Client/mod/scripts/vscripts/ui/panel_mainmenu.nut index d17b237b8..fc4a3b306 100644 --- a/Northstar.Client/mod/scripts/vscripts/ui/panel_mainmenu.nut +++ b/Northstar.Client/mod/scripts/vscripts/ui/panel_mainmenu.nut @@ -391,7 +391,7 @@ void function UpdatePlayButton( var button ) hasLatestPatch = Origin_IsUpToDate() isOriginConnected = Origin_IsEnabled() ? Origin_IsOnline() : true isStryderAuthenticated = IsStryderAuthenticated() - isMPAllowed = true + isMPAllowed = IsStryderAllowingMP() if ( DEBUG_PERMISSIONS ) { From 5effa70c2ff8e823b0eac14ae293181fab8ee32d Mon Sep 17 00:00:00 2001 From: Will <39478251+VITALISED@users.noreply.github.com> Date: Wed, 1 May 2024 03:49:57 +1000 Subject: [PATCH 13/38] Improve combo button stuff, actually readable now --- .../mod/resource/ui/menus/combo_buttons.res | 536 --------------- .../mod/scripts/vscripts/ui/combo_buttons.nut | 619 ------------------ .../mod/scripts/vscripts/ui/menu_lobby.nut | 92 ++- 3 files changed, 37 insertions(+), 1210 deletions(-) delete mode 100644 Northstar.Client/mod/resource/ui/menus/combo_buttons.res delete mode 100644 Northstar.Client/mod/scripts/vscripts/ui/combo_buttons.nut diff --git a/Northstar.Client/mod/resource/ui/menus/combo_buttons.res b/Northstar.Client/mod/resource/ui/menus/combo_buttons.res deleted file mode 100644 index 2a834e5f4..000000000 --- a/Northstar.Client/mod/resource/ui/menus/combo_buttons.res +++ /dev/null @@ -1,536 +0,0 @@ -// Current Support: -// Rows x 10 -// Columns x 4 (for the users sake, menus should really never have more than 3 - -resource/ui/menus/combo_buttons.res -{ - ButtonRow0x0 - { - ControlName BaseModHybridButton - InheritProperties ComboButtonLarge - labelText "ButtonRow0x0" - - tabPosition 1 - - pin_to_sibling ButtonRowAnchor - pin_corner_to_sibling TOP_LEFT - pin_to_sibling_corner TOP_LEFT - } - ButtonRow0x1 - { - ControlName BaseModHybridButton - InheritProperties ComboButtonLarge - labelText "ButtonRow0x1" - - pin_to_sibling ButtonRow0x0 - pin_corner_to_sibling TOP_LEFT - pin_to_sibling_corner TOP_RIGHT - } - ButtonRow0x2 - { - ControlName BaseModHybridButton - InheritProperties ComboButtonLarge - labelText "ButtonRow0x2" - - pin_to_sibling ButtonRow0x1 - pin_corner_to_sibling TOP_LEFT - pin_to_sibling_corner TOP_RIGHT - } - ButtonRow0x3 - { - ControlName BaseModHybridButton - InheritProperties ComboButtonLarge - labelText "ButtonRow0x3" - - pin_to_sibling ButtonRow0x2 - pin_corner_to_sibling TOP_LEFT - pin_to_sibling_corner TOP_RIGHT - } - ButtonRow0x4 - { - ControlName BaseModHybridButton - InheritProperties ComboButtonLarge - labelText "ButtonRow0x4" - - pin_to_sibling ButtonRow0x3 - pin_corner_to_sibling TOP_LEFT - pin_to_sibling_corner TOP_RIGHT - } - ButtonRow0x5 - { - ControlName BaseModHybridButton - InheritProperties ComboButtonLarge - labelText "ButtonRow0x5" - - pin_to_sibling ButtonRow0x4 - pin_corner_to_sibling TOP_LEFT - pin_to_sibling_corner TOP_RIGHT - } - TitleRow0 - { - ControlName RuiPanel - rui "ui/combo_header_large.rpak" - InheritProperties ComboButtonTitleLarge - labelText "TitleRow0" - - pin_to_sibling ButtonRow0x0 - } - - ButtonRow1x0 - { - ControlName BaseModHybridButton - InheritProperties ComboButtonLarge - labelText "ButtonRow1x0" - - pin_to_sibling ButtonRowAnchor - pin_corner_to_sibling TOP_LEFT - pin_to_sibling_corner TOP_LEFT - } - ButtonRow1x1 - { - ControlName BaseModHybridButton - InheritProperties ComboButtonLarge - labelText "ButtonRow1x1" - - pin_to_sibling ButtonRow1x0 - pin_corner_to_sibling TOP_LEFT - pin_to_sibling_corner TOP_RIGHT - } - ButtonRow1x2 - { - ControlName BaseModHybridButton - InheritProperties ComboButtonLarge - labelText "ButtonRow1x2" - - pin_to_sibling ButtonRow1x1 - pin_corner_to_sibling TOP_LEFT - pin_to_sibling_corner TOP_RIGHT - } - ButtonRow1x3 - { - ControlName BaseModHybridButton - InheritProperties ComboButtonLarge - labelText "ButtonRow1x3" - - pin_to_sibling ButtonRow1x2 - pin_corner_to_sibling TOP_LEFT - pin_to_sibling_corner TOP_RIGHT - } - TitleRow1 - { - ControlName RuiPanel - rui "ui/combo_header_large.rpak" - InheritProperties ComboButtonTitleLarge - labelText "TitleRow1" - - pin_to_sibling ButtonRow1x0 - } - - - ButtonRow2x0 - { - ControlName BaseModHybridButton - InheritProperties ComboButtonLarge - labelText "ButtonRow2x0" - - pin_to_sibling ButtonRowAnchor - pin_corner_to_sibling TOP_LEFT - pin_to_sibling_corner TOP_LEFT - } - ButtonRow2x1 - { - ControlName BaseModHybridButton - InheritProperties ComboButtonLarge - labelText "ButtonRow2x1" - - pin_to_sibling ButtonRow2x0 - pin_corner_to_sibling TOP_LEFT - pin_to_sibling_corner TOP_RIGHT - } - ButtonRow2x2 - { - ControlName BaseModHybridButton - InheritProperties ComboButtonLarge - labelText "ButtonRow2x2" - - pin_to_sibling ButtonRow2x1 - pin_corner_to_sibling TOP_LEFT - pin_to_sibling_corner TOP_RIGHT - } - ButtonRow2x3 - { - ControlName BaseModHybridButton - InheritProperties ComboButtonLarge - labelText "ButtonRow2x3" - - pin_to_sibling ButtonRow2x2 - pin_corner_to_sibling TOP_LEFT - pin_to_sibling_corner TOP_RIGHT - } - TitleRow2 - { - ControlName RuiPanel - rui "ui/combo_header_large.rpak" - InheritProperties ComboButtonTitleLarge - labelText "TitleRow2" - - pin_to_sibling ButtonRow2x0 - } - - - ButtonRow3x0 - { - ControlName BaseModHybridButton - InheritProperties ComboButtonLarge - labelText "ButtonRow3x0" - - pin_to_sibling ButtonRowAnchor - pin_corner_to_sibling TOP_LEFT - pin_to_sibling_corner TOP_LEFT - } - ButtonRow3x1 - { - ControlName BaseModHybridButton - InheritProperties ComboButtonLarge - labelText "ButtonRow3x1" - - pin_to_sibling ButtonRow3x0 - pin_corner_to_sibling TOP_LEFT - pin_to_sibling_corner TOP_RIGHT - } - ButtonRow3x2 - { - ControlName BaseModHybridButton - InheritProperties ComboButtonLarge - labelText "ButtonRow3x2" - - pin_to_sibling ButtonRow3x1 - pin_corner_to_sibling TOP_LEFT - pin_to_sibling_corner TOP_RIGHT - } - ButtonRow3x3 - { - ControlName BaseModHybridButton - InheritProperties ComboButtonLarge - labelText "ButtonRow3x3" - - pin_to_sibling ButtonRow3x2 - pin_corner_to_sibling TOP_LEFT - pin_to_sibling_corner TOP_RIGHT - } - TitleRow3 - { - ControlName RuiPanel - rui "ui/combo_header_large.rpak" - InheritProperties ComboButtonTitleLarge - labelText "TitleRow3" - - pin_to_sibling ButtonRow3x0 - } - - - ButtonRow4x0 - { - ControlName BaseModHybridButton - InheritProperties ComboButtonLarge - labelText "ButtonRow4x0" - - pin_to_sibling ButtonRowAnchor - pin_corner_to_sibling TOP_LEFT - pin_to_sibling_corner TOP_LEFT - } - ButtonRow4x1 - { - ControlName BaseModHybridButton - InheritProperties ComboButtonLarge - labelText "ButtonRow4x1" - - pin_to_sibling ButtonRow4x0 - pin_corner_to_sibling TOP_LEFT - pin_to_sibling_corner TOP_RIGHT - } - ButtonRow4x2 - { - ControlName BaseModHybridButton - InheritProperties ComboButtonLarge - labelText "ButtonRow4x2" - - pin_to_sibling ButtonRow4x1 - pin_corner_to_sibling TOP_LEFT - pin_to_sibling_corner TOP_RIGHT - } - ButtonRow4x3 - { - ControlName BaseModHybridButton - InheritProperties ComboButtonLarge - labelText "ButtonRow4x3" - - pin_to_sibling ButtonRow4x2 - pin_corner_to_sibling TOP_LEFT - pin_to_sibling_corner TOP_RIGHT - } - TitleRow4 - { - ControlName RuiPanel - rui "ui/combo_header_large.rpak" - InheritProperties ComboButtonTitleLarge - labelText "TitleRow4" - - pin_to_sibling ButtonRow4x0 - } - - - ButtonRow5x0 - { - ControlName BaseModHybridButton - InheritProperties ComboButtonLarge - labelText "ButtonRow5x0" - - pin_to_sibling ButtonRowAnchor - pin_corner_to_sibling TOP_LEFT - pin_to_sibling_corner TOP_LEFT - } - ButtonRow5x1 - { - ControlName BaseModHybridButton - InheritProperties ComboButtonLarge - labelText "ButtonRow5x1" - - pin_to_sibling ButtonRow5x0 - pin_corner_to_sibling TOP_LEFT - pin_to_sibling_corner TOP_RIGHT - } - ButtonRow5x2 - { - ControlName BaseModHybridButton - InheritProperties ComboButtonLarge - labelText "ButtonRow5x2" - - pin_to_sibling ButtonRow5x1 - pin_corner_to_sibling TOP_LEFT - pin_to_sibling_corner TOP_RIGHT - } - ButtonRow5x3 - { - ControlName BaseModHybridButton - InheritProperties ComboButtonLarge - labelText "ButtonRow5x3" - - pin_to_sibling ButtonRow5x2 - pin_corner_to_sibling TOP_LEFT - pin_to_sibling_corner TOP_RIGHT - } - TitleRow5 - { - ControlName RuiPanel - rui "ui/combo_header_large.rpak" - InheritProperties ComboButtonTitleLarge - labelText "TitleRow5" - - pin_to_sibling ButtonRow5x0 - } - - - ButtonRow6x0 - { - ControlName BaseModHybridButton - InheritProperties ComboButtonLarge - labelText "ButtonRow6x0" - - pin_to_sibling ButtonRowAnchor - pin_corner_to_sibling TOP_LEFT - pin_to_sibling_corner TOP_LEFT - } - ButtonRow6x1 - { - ControlName BaseModHybridButton - InheritProperties ComboButtonLarge - labelText "ButtonRow6x1" - - pin_to_sibling ButtonRow6x0 - pin_corner_to_sibling TOP_LEFT - pin_to_sibling_corner TOP_RIGHT - } - ButtonRow6x2 - { - ControlName BaseModHybridButton - InheritProperties ComboButtonLarge - labelText "ButtonRow6x2" - - pin_to_sibling ButtonRow6x1 - pin_corner_to_sibling TOP_LEFT - pin_to_sibling_corner TOP_RIGHT - } - ButtonRow6x3 - { - ControlName BaseModHybridButton - InheritProperties ComboButtonLarge - labelText "ButtonRow6x3" - - pin_to_sibling ButtonRow6x2 - pin_corner_to_sibling TOP_LEFT - pin_to_sibling_corner TOP_RIGHT - } - TitleRow6 - { - ControlName RuiPanel - rui "ui/combo_header_large.rpak" - InheritProperties ComboButtonTitleLarge - labelText "TitleRow6" - - pin_to_sibling ButtonRow6x0 - } - - - ButtonRow7x0 - { - ControlName BaseModHybridButton - InheritProperties ComboButtonLarge - labelText "ButtonRow7x0" - - pin_to_sibling ButtonRowAnchor - pin_corner_to_sibling TOP_LEFT - pin_to_sibling_corner TOP_LEFT - } - ButtonRow7x1 - { - ControlName BaseModHybridButton - InheritProperties ComboButtonLarge - labelText "ButtonRow7x1" - - pin_to_sibling ButtonRow7x0 - pin_corner_to_sibling TOP_LEFT - pin_to_sibling_corner TOP_RIGHT - } - ButtonRow7x2 - { - ControlName BaseModHybridButton - InheritProperties ComboButtonLarge - labelText "ButtonRow7x2" - - pin_to_sibling ButtonRow7x1 - pin_corner_to_sibling TOP_LEFT - pin_to_sibling_corner TOP_RIGHT - } - ButtonRow7x3 - { - ControlName BaseModHybridButton - InheritProperties ComboButtonLarge - labelText "ButtonRow7x3" - - pin_to_sibling ButtonRow7x2 - pin_corner_to_sibling TOP_LEFT - pin_to_sibling_corner TOP_RIGHT - } - TitleRow7 - { - ControlName RuiPanel - rui "ui/combo_header_large.rpak" - InheritProperties ComboButtonTitleLarge - labelText "TitleRow7" - - pin_to_sibling ButtonRow7x0 - } - - - ButtonRow8x0 - { - ControlName BaseModHybridButton - InheritProperties ComboButtonLarge - labelText "ButtonRow8x0" - - pin_to_sibling ButtonRowAnchor - pin_corner_to_sibling TOP_LEFT - pin_to_sibling_corner TOP_LEFT - } - ButtonRow8x1 - { - ControlName BaseModHybridButton - InheritProperties ComboButtonLarge - labelText "ButtonRow8x1" - - pin_to_sibling ButtonRow8x0 - pin_corner_to_sibling TOP_LEFT - pin_to_sibling_corner TOP_RIGHT - } - ButtonRow8x2 - { - ControlName BaseModHybridButton - InheritProperties ComboButtonLarge - labelText "ButtonRow8x2" - - pin_to_sibling ButtonRow8x1 - pin_corner_to_sibling TOP_LEFT - pin_to_sibling_corner TOP_RIGHT - } - ButtonRow8x3 - { - ControlName BaseModHybridButton - InheritProperties ComboButtonLarge - labelText "ButtonRow8x3" - - pin_to_sibling ButtonRow8x2 - pin_corner_to_sibling TOP_LEFT - pin_to_sibling_corner TOP_RIGHT - } - TitleRow8 - { - ControlName RuiPanel - rui "ui/combo_header_large.rpak" - InheritProperties ComboButtonTitleLarge - labelText "TitleRow8" - - pin_to_sibling ButtonRow8x0 - } - - - ButtonRow9x0 - { - ControlName BaseModHybridButton - InheritProperties ComboButtonLarge - labelText "ButtonRow9x0" - - pin_to_sibling ButtonRowAnchor - pin_corner_to_sibling TOP_LEFT - pin_to_sibling_corner TOP_LEFT - } - ButtonRow9x1 - { - ControlName BaseModHybridButton - InheritProperties ComboButtonLarge - labelText "ButtonRow9x1" - - pin_to_sibling ButtonRow9x0 - pin_corner_to_sibling TOP_LEFT - pin_to_sibling_corner TOP_RIGHT - } - ButtonRow9x2 - { - ControlName BaseModHybridButton - InheritProperties ComboButtonLarge - labelText "ButtonRow9x2" - - pin_to_sibling ButtonRow9x1 - pin_corner_to_sibling TOP_LEFT - pin_to_sibling_corner TOP_RIGHT - } - ButtonRow9x3 - { - ControlName BaseModHybridButton - InheritProperties ComboButtonLarge - labelText "ButtonRow9x3" - - pin_to_sibling ButtonRow9x2 - pin_corner_to_sibling TOP_LEFT - pin_to_sibling_corner TOP_RIGHT - } - TitleRow9 - { - ControlName RuiPanel - rui "ui/combo_header_large.rpak" - InheritProperties ComboButtonTitleLarge - labelText "TitleRow9" - - pin_to_sibling ButtonRow9x0 - } -} diff --git a/Northstar.Client/mod/scripts/vscripts/ui/combo_buttons.nut b/Northstar.Client/mod/scripts/vscripts/ui/combo_buttons.nut deleted file mode 100644 index 25e1daf7a..000000000 --- a/Northstar.Client/mod/scripts/vscripts/ui/combo_buttons.nut +++ /dev/null @@ -1,619 +0,0 @@ -untyped - -global function ComboButtons_Create -global function ComboButtons_Finalize -global function AddComboButtonHeader -global function AddComboButton - -global function ComboButton_SetText - -global function SetComboButtonHeaderTitle -global function ComboButton_SetNewMail -global function ComboButton_SetNew -global function ComboButton_SetHasPurchase - -global function SetComboButtonHeaderTint - -global function ComboButtons_ResetColumnFocus - -#if DEV -global function DEV_GetComboStruct -#endif - -global const int MAX_COMBO_BUTTON_ROWS = 10 -global const int MAX_COMBO_BUTTON_COLS = 5 - -const float TRANSITION_ANIM_TIME = 0.016667 * 3 - - -global struct ComboButtonData -{ - var button - int rowIndex - int colIndex - string text -} - -global struct ComboStruct -{ - var menu - - int collapsedHeight = 1 - int expandedHeight = 1 - - bool sharedColumnFocus = false - int numRows = 0 - - // NOTE: there's a bug in script handling that necessitates rows/columns being flipped here - ComboButtonData[MAX_COMBO_BUTTON_COLS][MAX_COMBO_BUTTON_ROWS] comboButtonGrid - var[MAX_COMBO_BUTTON_ROWS] rowHeaders - int[MAX_COMBO_BUTTON_ROWS] defaultColumnIndex - - var navUpButton = null - var navDownButton = null - var navRightButton = null - bool navUpButtonDisabled = false - bool navDownButtonDisabled = false -} - -struct -{ - table comboMenuData -} file - -ComboStruct function ComboButtons_Create( var menu ) -{ - ComboStruct comboStruct - comboStruct.menu = menu - - string menuName = Hud_GetHudName( menu ) - file.comboMenuData[menuName] <- comboStruct - - comboStruct.sharedColumnFocus = false - - return comboStruct -} - -void function ComboButtons_Finalize( ComboStruct comboStruct ) -{ - float maxX = 0 - - for ( int row = 0; row < MAX_COMBO_BUTTON_ROWS; row++ ) - { - for ( int col = 0; col < MAX_COMBO_BUTTON_COLS; col++ ) - { - if ( comboStruct.comboButtonGrid[row][col].button == null ) - continue - - if ( col > 0 ) - { - float buttonX = float( Hud_GetAbsX( comboStruct.comboButtonGrid[row][col].button ) + Hud_GetWidth( comboStruct.comboButtonGrid[row][col].button ) ) - if ( buttonX > maxX ) - { - maxX = buttonX - } - } - } - } - - UpdateButtonNav( comboStruct ) - - for ( int row = 0; row < MAX_COMBO_BUTTON_ROWS; row++ ) - { - for ( int col = 0; col < MAX_COMBO_BUTTON_COLS; col++ ) - { - var button = comboStruct.comboButtonGrid[row][col].button - - if ( button == null ) - continue - - if ( col == 0 ) - { - Hud_SetY( button, -(comboStruct.expandedHeight * row) ) - } - - // save off the "auto_wide_tocontents" size of the button - Hud_SetBaseSize( button, Hud_GetWidth( button ), Hud_GetHeight( button ) ) - - if ( col == MAX_COMBO_BUTTON_COLS - 1 || comboStruct.comboButtonGrid[row][col+1].button == null ) - { - float endX = float( Hud_GetAbsX( button ) + Hud_GetWidth( button ) ) - if ( endX < maxX ) - { - float width = float( Hud_GetWidth( button ) ) - Hud_SetWidth( button, width + (maxX - endX) ) - } - } - } - } - - if ( comboStruct.rowHeaders[0] == null ) - comboStruct.collapsedHeight = comboStruct.expandedHeight - - for ( int row = 0; row < MAX_COMBO_BUTTON_ROWS; row++ ) - { - if ( comboStruct.rowHeaders[row] != null ) - Hud_SetHeight( comboStruct.rowHeaders[row], comboStruct.expandedHeight ) - } - - - if ( comboStruct.sharedColumnFocus ) - { - int minCol = -1 - int maxCol = 0 - for ( int row = 0; row < MAX_COMBO_BUTTON_ROWS; row++ ) - { - for ( int col = 0; col < MAX_COMBO_BUTTON_COLS; col++ ) - { - if ( comboStruct.comboButtonGrid[row][col].button == null ) - continue - - if ( minCol < 0 || col < minCol ) - minCol = col - - if ( col > maxCol ) - maxCol = col - } - } - -// Assert( minCol == maxCol ) - } - - array elements = GetElementsByClassname( GetParentMenu( comboStruct.menu ), "ComboButtonAlways" ) - foreach ( element in elements ) - { - var parentButton = Hud_GetParent( element ) - if ( !("alwaysChildren" in parentButton.s) ) // unused buttons don't have this initialized - continue - - parentButton.s.alwaysChildren.append( element ) - if ( Hud_IsRuiPanel( element ) ) - { - RuiSetString( Hud_GetRui( element ), "buttonText", parentButton.s.text ) - } - } - - OnComboButtonGetFocus( comboStruct.comboButtonGrid[0][0].button ) -} - - -ComboStruct function ComboButton_GetComboStruct( var button ) -{ - string parentMenuName = expect string( button.s.parentMenuName ) - ComboStruct comboStruct = file.comboMenuData[parentMenuName] - - return comboStruct -} - - -float function ComboButtons_GetMaxX( ComboStruct comboStruct ) -{ - float maxX = 0 - for ( int row = 0; row < MAX_COMBO_BUTTON_ROWS; row++ ) - { - for ( int col = 0; col < MAX_COMBO_BUTTON_COLS; col++ ) - { - if ( comboStruct.comboButtonGrid[row][col].button == null ) - continue - - if ( col > 0 ) - { - float buttonX = float( Hud_GetAbsX( comboStruct.comboButtonGrid[row][col].button ) + Hud_GetWidth( comboStruct.comboButtonGrid[row][col].button ) ) - if ( buttonX > maxX ) - { - maxX = buttonX - } - } - } - } - - return maxX -} - - -void function ComboButton_RefreshWidth( var comboButton ) -{ - ComboStruct comboStruct = ComboButton_GetComboStruct( comboButton ) - float maxX = ComboButtons_GetMaxX( comboStruct ) - - for ( int row = 0; row < MAX_COMBO_BUTTON_ROWS; row++ ) - { - for ( int col = 0; col < MAX_COMBO_BUTTON_COLS; col++ ) - { - var button = comboStruct.comboButtonGrid[row][col].button - - if ( button != comboButton ) - continue - - if ( col == MAX_COMBO_BUTTON_COLS - 1 || comboStruct.comboButtonGrid[row][col+1].button == null ) - { - float endX = float( Hud_GetAbsX( button ) + Hud_GetWidth( button ) ) - if ( endX < maxX ) - { - float width = float( Hud_GetWidth( button ) ) - Hud_SetWidth( button, width + (maxX - endX) ) - } - } - } - } -} - - -void function ComboButton_SetText( var button, string buttonText ) -{ - if ( Hud_IsLabel( button ) ) - Hud_SetText( button, buttonText ) - - if ( "alwaysChildren" in button.s ) - { - foreach ( var element in button.s.alwaysChildren ) - { - if ( !Hud_IsRuiPanel( element ) ) - continue - - RuiSetString( Hud_GetRui( element ), "buttonText", buttonText ) - } - } - - ComboButton_RefreshWidth( button ) -} - -void function ComboButton_SetNewMail( var button, bool newMessages ) -{ - if ( "alwaysChildren" in button.s ) - { - foreach ( var element in button.s.alwaysChildren ) - { - if ( !Hud_IsRuiPanel( element ) ) - continue - - RuiSetBool( Hud_GetRui( element ), "isNewMail", newMessages ) - } - } -} - -void function ComboButton_SetNew( var button, bool isNew ) -{ - if ( "alwaysChildren" in button.s ) - { - foreach ( var element in button.s.alwaysChildren ) - { - if ( !Hud_IsRuiPanel( element ) ) - continue - - RuiSetBool( Hud_GetRui( element ), "isNew", isNew ) - } - } -} - -void function ComboButton_SetHasPurchase( var button, bool hasPurchase ) -{ - if ( "alwaysChildren" in button.s ) - { - foreach ( var element in button.s.alwaysChildren ) - { - if ( !Hud_IsRuiPanel( element ) ) - continue - - RuiSetBool( Hud_GetRui( element ), "hasPurchase", hasPurchase ) - } - } -} - - -void function SetComboButtonHeaderTitle( var menu, int rowIndex, string titleText ) -{ - string menuName = Hud_GetHudName( menu ) - Assert( menuName in file.comboMenuData ) - - ComboStruct comboStruct = file.comboMenuData[menuName] - - if ( !Hud_IsRuiPanel( comboStruct.rowHeaders[rowIndex] ) ) - return - - var rui = Hud_GetRui( comboStruct.rowHeaders[rowIndex] ) - RuiSetString( rui, "titleText", titleText ) -} - -void function SetComboButtonHeaderTint( var menu, int rowIndex, bool state ) -{ - string menuName = Hud_GetHudName( menu ) - Assert( menuName in file.comboMenuData ) - - ComboStruct comboStruct = file.comboMenuData[menuName] - - if ( !Hud_IsRuiPanel( comboStruct.rowHeaders[rowIndex] ) ) - return - - var rui = Hud_GetRui( comboStruct.rowHeaders[rowIndex] ) - RuiSetBool( rui, "isTitleTint", state ) -} - - -var function AddComboButtonHeader( ComboStruct comboStruct, int rowIndex, string titleText = "" ) -{ - comboStruct.rowHeaders[rowIndex] = Hud_GetChild( comboStruct.menu, "TitleRow" + rowIndex ) - Hud_SetVisible( comboStruct.rowHeaders[rowIndex], true ) - - var rui = Hud_GetRui( comboStruct.rowHeaders[rowIndex] ) - RuiSetString( rui, "titleText", titleText ) - - comboStruct.collapsedHeight = Hud_GetHeight( comboStruct.rowHeaders[rowIndex] ) - - return comboStruct.rowHeaders[rowIndex] -} - - -var function AddComboButton( ComboStruct comboStruct, int rowIndex, int colIndex, string text = "" ) -{ - ComboButtonData comboButtonData - var button = Hud_GetChild( comboStruct.menu, "ButtonRow" + rowIndex + "x" + colIndex ) - - Hud_SetVisible( button, true ) - - button.s.rowIndex <- rowIndex - button.s.colIndex <- colIndex - button.s.text <- text - button.s.parentMenuName <- Hud_GetHudName( comboStruct.menu ) - button.s.alwaysChildren <- [] - - comboStruct.comboButtonGrid[rowIndex][colIndex].button = button - comboStruct.comboButtonGrid[rowIndex][colIndex].rowIndex = rowIndex - comboStruct.comboButtonGrid[rowIndex][colIndex].colIndex = colIndex - - if ( colIndex > 0 ) - { - comboStruct.comboButtonGrid[rowIndex][colIndex].button.SetNavLeft( comboStruct.comboButtonGrid[rowIndex][colIndex-1].button ) - comboStruct.comboButtonGrid[rowIndex][colIndex-1].button.SetNavRight( comboStruct.comboButtonGrid[rowIndex][colIndex].button ) - } - - Hud_AddEventHandler( button, UIE_GET_FOCUS, OnComboButtonGetFocus ) - Hud_AddEventHandler( button, UIE_LOSE_FOCUS, OnComboButtonLoseFocus ) - - if ( rowIndex + 1 > comboStruct.numRows ) - comboStruct.numRows = rowIndex + 1 - - button.SetColor( 0, 0, 0, 0 ) - button.SetAlpha( 0 ) - button.SetPanelAlpha( 0 ) - - if ( text != "" ) - { - Hud_SetText( button, text ) - } - - comboStruct.expandedHeight = Hud_GetHeight( button ) - - return button -} - -#if DEV -ComboStruct function DEV_GetComboStruct( string menuName ) -{ - ComboStruct comboStruct = file.comboMenuData[menuName] - - return comboStruct -} -#endif - -void function OnComboButtonGetFocus( var button ) -{ - int rowIndex = expect int( button.s.rowIndex ) - int colIndex = expect int( button.s.colIndex ) - - string parentMenuName = expect string( button.s.parentMenuName ) - ComboStruct comboStruct = file.comboMenuData[parentMenuName] - - for ( int row = 0; row < MAX_COMBO_BUTTON_ROWS; row++ ) - { - if ( comboStruct.rowHeaders[row] != null ) - { - var rui = Hud_GetRui( comboStruct.rowHeaders[row] ) - RuiSetBool( rui, "isFocused", row == rowIndex ) - - if ( rowIndex == row ) - comboStruct.rowHeaders[row].SetColor( 192, 192, 192, 255 ) - else - comboStruct.rowHeaders[row].SetColor( 160, 160, 160, 160 ) - } - - for ( int col = 0; col < MAX_COMBO_BUTTON_COLS; col++ ) - { - if ( comboStruct.comboButtonGrid[row][col].button == null ) - continue - - var button = comboStruct.comboButtonGrid[row][col].button - - if ( col == 0 ) - { - float yOffset = 0.0 - if ( row <= rowIndex ) - yOffset = float( -(comboStruct.collapsedHeight * row) ) - else if ( row > rowIndex ) - yOffset = float( -(comboStruct.collapsedHeight * row + (comboStruct.expandedHeight - comboStruct.collapsedHeight)) ) - - Hud_SetYOverTime( button, yOffset, TRANSITION_ANIM_TIME, INTERPOLATOR_DEACCEL ) - } - - // ugly for now; there's no SetHeightOverTime() and ScaleOverTime messes up the width - // alpha fade in doesn't work with the color overrides - if ( rowIndex == row ) - { - button.SetHeight( comboStruct.expandedHeight ) - foreach ( var childElement in button.s.alwaysChildren ) - { - childElement.SetHeight( comboStruct.expandedHeight ) - if ( Hud_IsRuiPanel( childElement ) ) - { - var rui = Hud_GetRui( childElement ) - RuiSetBool( rui, "isExpanded", true ) - } - } - } - else - { - button.SetHeight( comboStruct.collapsedHeight ) - foreach ( var childElement in button.s.alwaysChildren ) - { - childElement.SetHeight( comboStruct.collapsedHeight ) - if ( Hud_IsRuiPanel( childElement ) ) - { - var rui = Hud_GetRui( childElement ) - RuiSetBool( rui, "isExpanded", false ) - } - } - } - } - } - - if ( comboStruct.sharedColumnFocus ) - { - foreach ( row, defaultIndex in comboStruct.defaultColumnIndex ) - { - comboStruct.defaultColumnIndex[row] = colIndex - } - } - - UpdateButtonNav( comboStruct ) -} -/* -void function UdpateButtonAnim( var button, float duration, int newHeight, int newAlpha ) -{ - EndSignal( uiGlobal.signalDummy, "UdpateButtonHeight" ) - - OnThreadEnd( - function() : ( button, newHeight, newAlpha ) - { - button.SetPanelAlpha( newAlpha ) - button.SetHeight( newHeight ) - } - ) - - int startHeight = Hud_GetHeight( button ) - int startAlpha = Hud_GetPanelAlpha( button ) - - float heightOffset = 0.0 - if ( startHeight > newHeight ) - heightOffset += cbAnimOffset - - float startTime = Time() - float height = GraphCapped( Time(), startTime, startTime + duration, startHeight, newHeight + heightOffset ) - while ( height != newHeight ) - { - float height = GraphCapped( Time(), startTime, startTime + duration, startHeight, newHeight + heightOffset ) - Hud_SetHeight( button, height ) - - float alpha = GraphCapped( Time(), startTime, startTime + duration, startAlpha, newAlpha ) - Hud_SetPanelAlpha( button, alpha ) - - WaitFrame() - } -} -*/ - -void function OnComboButtonLoseFocus( var button ) -{ - int rowIndex = expect int( button.s.rowIndex ) - int colIndex = expect int( button.s.colIndex ) - - string parentMenuName = expect string( button.s.parentMenuName ) - ComboStruct comboStruct = file.comboMenuData[parentMenuName] - - comboStruct.defaultColumnIndex[rowIndex] = colIndex - - UpdateButtonNav( comboStruct ) - // - //if ( rowIndex == 0 ) - //{ - // var rui = Hud_GetRui( comboStruct.rowHeaders[0] ) - // RuiSetBool( rui, "hasFocus", true ) - //} - //else - //{ - // var rui = Hud_GetRui( comboStruct.rowHeaders[0] ) - // RuiSetBool( rui, "hasFocus", true ) - //} -} - - -void function ComboButtons_ResetColumnFocus( ComboStruct comboStruct ) -{ - foreach ( row, defaultIndex in comboStruct.defaultColumnIndex ) - { - comboStruct.defaultColumnIndex[row] = 0 - } -} - - -void function UpdateButtonNav( ComboStruct comboStruct ) -{ - for ( int row = 0; row < MAX_COMBO_BUTTON_ROWS; row++ ) - { - for ( int col = 0; col < MAX_COMBO_BUTTON_COLS; col++ ) - { - if ( comboStruct.comboButtonGrid[row][col].button == null ) - continue - - if ( row == MAX_COMBO_BUTTON_ROWS - 1 || comboStruct.comboButtonGrid[row+1][0].button == null ) - { - if ( comboStruct.navDownButtonDisabled ) - { - // - } - else if ( comboStruct.navDownButton != null ) - { - comboStruct.comboButtonGrid[row][col].button.SetNavDown( comboStruct.navDownButton ) - - int navUpColumnIndex = comboStruct.defaultColumnIndex[comboStruct.numRows-1] - comboStruct.navDownButton.SetNavUp( comboStruct.comboButtonGrid[row][navUpColumnIndex].button ) - } - else - { - int navDownColumnIndex = comboStruct.defaultColumnIndex[0] - comboStruct.comboButtonGrid[row][col].button.SetNavDown( comboStruct.comboButtonGrid[0][navDownColumnIndex].button ) - } - } - else - { - int navDownColumnIndex = comboStruct.defaultColumnIndex[row+1] - comboStruct.comboButtonGrid[row][col].button.SetNavDown( comboStruct.comboButtonGrid[row+1][navDownColumnIndex].button ) - } - - if ( row == 0 ) - { - if ( comboStruct.navUpButtonDisabled ) - { - // - } - else if ( comboStruct.navUpButton != null ) - { - comboStruct.comboButtonGrid[row][col].button.SetNavUp( comboStruct.navUpButton ) - - int navDownColumnIndex = comboStruct.defaultColumnIndex[0] - comboStruct.navUpButton.SetNavDown( comboStruct.comboButtonGrid[row][navDownColumnIndex].button ) - } - else - { - int navUpColumnIndex = comboStruct.defaultColumnIndex[comboStruct.numRows-1] - comboStruct.comboButtonGrid[row][col].button.SetNavUp( comboStruct.comboButtonGrid[comboStruct.numRows-1][navUpColumnIndex].button ) - } - } - else - { - int navUpColumnIndex = comboStruct.defaultColumnIndex[row-1] - comboStruct.comboButtonGrid[row][col].button.SetNavUp( comboStruct.comboButtonGrid[row-1][navUpColumnIndex].button ) - } - - if ( col == MAX_COMBO_BUTTON_COLS - 1 || comboStruct.comboButtonGrid[row][col+1].button == null ) - { - if ( comboStruct.navRightButton != null ) - { - comboStruct.comboButtonGrid[row][col].button.SetNavRight( comboStruct.navRightButton ) - - //comboStruct.navRightButton.SetNavLeft( comboStruct.comboButtonGrid[row][col].button ) - //comboStruct.navRightButton.SetNavLeft( comboStruct.comboButtonGrid[0][0].button ) - } - } - } - } -} diff --git a/Northstar.Client/mod/scripts/vscripts/ui/menu_lobby.nut b/Northstar.Client/mod/scripts/vscripts/ui/menu_lobby.nut index e0f4d438e..e2d6b75cb 100644 --- a/Northstar.Client/mod/scripts/vscripts/ui/menu_lobby.nut +++ b/Northstar.Client/mod/scripts/vscripts/ui/menu_lobby.nut @@ -66,8 +66,6 @@ struct var inviteFriendsButton var inviteFriendsToNetworkButton var toggleMenuModeButton - var serverBrowserButton - var privateMatchButton var networksMoreButton @@ -307,14 +305,14 @@ void function SetupComboButtonTest( var menu ) Hud_AddEventHandler( file.inviteFriendsButton, UIE_CLICK, InviteFriendsIfAllowed ) // server browser - file.serverBrowserButton = AddComboButton( comboStruct, headerIndex, buttonIndex++, "#MENU_TITLE_SERVER_BROWSER" ) - file.lobbyButtons.append( file.serverBrowserButton ) - Hud_SetLocked( file.serverBrowserButton, true ) - Hud_AddEventHandler( file.serverBrowserButton, UIE_CLICK, OpenServerBrowser ) + // file.serverBrowserButton = AddComboButton( comboStruct, headerIndex, buttonIndex++, "#MENU_TITLE_SERVER_BROWSER" ) + // file.lobbyButtons.append( file.serverBrowserButton ) + // Hud_SetLocked( file.serverBrowserButton, true ) + // Hud_AddEventHandler( file.serverBrowserButton, UIE_CLICK, OpenServerBrowser ) // private match - file.privateMatchButton = AddComboButton( comboStruct, headerIndex, buttonIndex++, "#PRIVATE_MATCH" ) - Hud_AddEventHandler( file.privateMatchButton, UIE_CLICK, StartPrivateMatch ) + // file.privateMatchButton = AddComboButton( comboStruct, headerIndex, buttonIndex++, "#PRIVATE_MATCH" ) + // Hud_AddEventHandler( file.privateMatchButton, UIE_CLICK, StartPrivateMatch ) // Hud_SetEnabled( file.inviteFriendsButton, false ) @@ -428,22 +426,27 @@ void function DoRoomInviteIfAllowed( var button ) if ( Hud_IsLocked( button ) ) return - if ( !DoesCurrentCommunitySupportInvites() ) + if ( !NSIsVanilla() ) + StartPrivateMatch( button ) + else { - OnBrowseNetworksButton_Activate( button ) - return - } + if ( !DoesCurrentCommunitySupportInvites() ) + { + OnBrowseNetworksButton_Activate( button ) + return + } - entity player = GetUIPlayer() + entity player = GetUIPlayer() - if ( IsValid( player ) && Player_NextAvailableMatchmakingTime( player ) > 0 ) - { - DisplayMatchmakingPenaltyDialog( player ) - return - } + if ( IsValid( player ) && Player_NextAvailableMatchmakingTime( player ) > 0 ) + { + DisplayMatchmakingPenaltyDialog( player ) + return + } - SendOpenInvite( true ) - OpenSelectedPlaylistMenu() + SendOpenInvite( true ) + OpenSelectedPlaylistMenu() + } } void function DisplayMatchmakingPenaltyDialog( entity player ) @@ -596,7 +599,7 @@ void function OnLobbyMenu_Open() // code will start loading DLC info from first party unless already done InitDLCStore() - thread DoNSButtonState() + DoNSButtonState() thread UpdateCachedNewItems() if ( file.putPlayerInMatchmakingAfterDelay ) @@ -705,47 +708,21 @@ void function OnLobbyMenu_Open() void function DoNSButtonState() { - Hud_SetLocked( file.progressionButton, true ) - Hud_SetLocked( file.findGameButton, true ) - Hud_SetLocked( file.inviteRoomButton, true ) - Hud_SetLocked( file.inviteFriendsButton, true ) - Hud_SetLocked( file.inviteFriendsToNetworkButton, true ) - Hud_SetLocked( file.serverBrowserButton, true ) - Hud_SetLocked( file.privateMatchButton, true ) - - wait 0.3 - - var findGameButton - var inviteRoomButton - var inviteFriendsButton - var inviteFriendsToNetworkButton - var toggleMenuModeButton - var serverBrowserButton - var privateMatchButton - if ( NSIsVanilla() ) { Hud_SetLocked( file.progressionButton, true ) - Hud_SetLocked( file.findGameButton, false ) - Hud_SetLocked( file.inviteRoomButton, false ) - Hud_SetLocked( file.inviteFriendsButton, false ) - Hud_SetLocked( file.inviteFriendsToNetworkButton, false ) - - Hud_SetLocked( file.serverBrowserButton, true ) - Hud_SetLocked( file.privateMatchButton, true ) + ComboButton_SetText( file.findGameButton, "#MENU_TITLE_FIND_GAME" ) + ComboButton_SetText( file.inviteRoomButton, "#MENU_TITLE_INVITE_ROOM" ) + Hud_SetVisible( file.inviteFriendsButton, true ) } else { Hud_SetLocked( file.progressionButton, false ) - Hud_SetLocked( file.findGameButton, true ) - Hud_SetLocked( file.inviteRoomButton, true ) - Hud_SetLocked( file.inviteFriendsButton, true ) - Hud_SetLocked( file.inviteFriendsToNetworkButton, true ) - - Hud_SetLocked( file.serverBrowserButton, false ) - Hud_SetLocked( file.privateMatchButton, false ) + ComboButton_SetText( file.findGameButton, "#MENU_TITLE_SERVER_BROWSER" ) + ComboButton_SetText( file.inviteRoomButton, "#PRIVATE_MATCH" ) + Hud_SetVisible( file.inviteFriendsButton, false ) } } @@ -1299,8 +1276,13 @@ void function BigPlayButton1_Activate( var button ) if ( Hud_IsLocked( button ) ) return - SendOpenInvite( false ) - OpenSelectedPlaylistMenu() + if ( !NSIsVanilla() ) + OpenServerBrowser( button ) + else + { + SendOpenInvite( false ) + OpenSelectedPlaylistMenu() + } } function EnableButton( button ) From c81a604e7340de094cc7c7af820d419ccfc2835e Mon Sep 17 00:00:00 2001 From: Will <39478251+VITALISED@users.noreply.github.com> Date: Wed, 1 May 2024 03:53:48 +1000 Subject: [PATCH 14/38] Give progression button similar treatment --- Northstar.Client/mod/scripts/vscripts/ui/menu_lobby.nut | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Northstar.Client/mod/scripts/vscripts/ui/menu_lobby.nut b/Northstar.Client/mod/scripts/vscripts/ui/menu_lobby.nut index e2d6b75cb..b685debe2 100644 --- a/Northstar.Client/mod/scripts/vscripts/ui/menu_lobby.nut +++ b/Northstar.Client/mod/scripts/vscripts/ui/menu_lobby.nut @@ -710,7 +710,7 @@ void function DoNSButtonState() { if ( NSIsVanilla() ) { - Hud_SetLocked( file.progressionButton, true ) + Hud_SetVisible( file.progressionButton, false ) ComboButton_SetText( file.findGameButton, "#MENU_TITLE_FIND_GAME" ) ComboButton_SetText( file.inviteRoomButton, "#MENU_TITLE_INVITE_ROOM" ) @@ -718,7 +718,7 @@ void function DoNSButtonState() } else { - Hud_SetLocked( file.progressionButton, false ) + Hud_SetVisible( file.progressionButton, true ) ComboButton_SetText( file.findGameButton, "#MENU_TITLE_SERVER_BROWSER" ) ComboButton_SetText( file.inviteRoomButton, "#PRIVATE_MATCH" ) From 5cbc1038c7a23d9334be68b6fe7947e63ddc1c6f Mon Sep 17 00:00:00 2001 From: Will <39478251+VITALISED@users.noreply.github.com> Date: Wed, 1 May 2024 04:06:09 +1000 Subject: [PATCH 15/38] Don't bother asking user to disable northstar.custom --- .../resource/northstar_client_localisation_english.txt | 1 - .../mod/scripts/vscripts/ui/panel_mainmenu.nut | 10 ++-------- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/Northstar.Client/mod/resource/northstar_client_localisation_english.txt b/Northstar.Client/mod/resource/northstar_client_localisation_english.txt index 29e885e13..e6518febb 100644 --- a/Northstar.Client/mod/resource/northstar_client_localisation_english.txt +++ b/Northstar.Client/mod/resource/northstar_client_localisation_english.txt @@ -11,7 +11,6 @@ "WARNING" "Warning" "CORE_MOD_DISABLE_WARNING" "Disabling core mods can break your client!" "DISABLE" "Disable" - "NS_CUSTOM_ENABLED" "Northstar.Custom is enabled, you should disable it and other mods that will cause issues with Vanilla." "DIALOG_TITLE_INSTALLED_NORTHSTAR" "Thanks for installing Northstar!" "AUTHENTICATION_AGREEMENT_DIALOG_TEXT" "For Northstar to work, it needs to authenticate using the Northstar master server. This will require sending your origin token to the master server, it will not be stored or used for any other purposes. diff --git a/Northstar.Client/mod/scripts/vscripts/ui/panel_mainmenu.nut b/Northstar.Client/mod/scripts/vscripts/ui/panel_mainmenu.nut index fc4a3b306..8b549c06c 100644 --- a/Northstar.Client/mod/scripts/vscripts/ui/panel_mainmenu.nut +++ b/Northstar.Client/mod/scripts/vscripts/ui/panel_mainmenu.nut @@ -587,14 +587,8 @@ void function OnPlayMPButton_Activate( var button ) if ( NSIsModEnabled( "Northstar.Custom" ) ) { - DialogData dialogData - dialogData.image = $"ui/menu/common/dialog_error" - dialogData.header = "#ERROR" - dialogData.message = "#NS_CUSTOM_ENABLED" - - AddDialogButton( dialogData, "#OK", null ) - OpenDialog( dialogData ) - return + NSSetModEnabled( "Northstar.Custom", false ) + ReloadMods() } if ( !Hud_IsLocked( button ) && file.mpButtonActivateFunc != null ) From 098465cab9a72dbbbca8d4eefc4f1d70bb89fc18 Mon Sep 17 00:00:00 2001 From: Will <39478251+VITALISED@users.noreply.github.com> Date: Wed, 1 May 2024 04:36:12 +1000 Subject: [PATCH 16/38] Lock buttons between lobbies that don't work --- .../scripts/vscripts/ui/menu_community.nut | 2650 +++++++++++++++++ .../mod/scripts/vscripts/ui/menu_inbox.nut | 716 +++++ .../mod/scripts/vscripts/ui/menu_lobby.nut | 30 + 3 files changed, 3396 insertions(+) create mode 100644 Northstar.Client/mod/scripts/vscripts/ui/menu_community.nut create mode 100644 Northstar.Client/mod/scripts/vscripts/ui/menu_inbox.nut diff --git a/Northstar.Client/mod/scripts/vscripts/ui/menu_community.nut b/Northstar.Client/mod/scripts/vscripts/ui/menu_community.nut new file mode 100644 index 000000000..30098a7cf --- /dev/null +++ b/Northstar.Client/mod/scripts/vscripts/ui/menu_community.nut @@ -0,0 +1,2650 @@ +global function InitCommunitiesMenu +global function InitMyNetworksMenu + +global function Community_CommunityUpdated +global function UICodeCallback_ShowCommunityInfo +global function UICodeCallback_CommunitySaved +global function UICodeCallback_CommunitySaveFailed +global function UICodeCallback_ShowCommunityJoinRequest +global function OnSwitchButton_Activate +global function OnBrowseNetworksButton_Activate +#if NETWORK_INVITE +global function OnInviteFriendsToNetworkButton_Activate +#endif + +const int ADVOCATE_NETWORK = 1 + +struct CommunityPanel +{ + int CommunityId + var Name + var Creator + var Members + var MOTD + var Kills + var Wins + var Losses + var Deaths + var XP + var LanguagesLabel + var RegionsLabel + var CategoriesLabel + var CommunityTypeLabel + var MembershipTypeLabel + var VisibilityLabel + var MicPolicyLabel + var HappyHourStartLabel + var CommunityNameRui +} + +struct +{ + CommunitySettings &settings + array languages + array categories + array regions + + bool haveSettings + bool firstCommunityUpdateHappened + + var menu + + var switchButton + var editButton + var sendMessageButton + var sendButton + var chatroomToggleVoiceModeHeader + var chatroomToggleVoiceModeButton0 + var chatroomToggleVoiceModeButton1 + + var chatroomMenu + var chatroomMenu_chatroomWidget + + var switchCommunityMenu + var switchCommunityPanel + var switchCommunityPanel_CommunityInfoPanel + array switchCommunityPanelButtons + array switchCommunityPanelHints + var switchCommunityPanelCover + var switchCommunityPanel_ListWidget + + string region + string language + + BrowseFilters browseFilters + + UserInfoPanel pendingJoinRequestPanel + var pendingJoinRequest_CommunityName + var pendingJoinRequest_AcceptButton + var adminViewPendingRequests + var adminViewPendingRequestsButton + int totalJoinRequests + + var browseCommunitiesPanel_LastFocused + + var browseCommunitiesMenu + var browseCommunitiesPanel + var browseCommunitiesPanel_CommunityInfoPanel + var browseCommunitiesPanel_FilterBackground + var browseCommunitiesPanel_ListWidget + var browseCommunitiesPanel_NameWidget + var browseCommunitiesPanel_ClantagWidget + var browseCommunitiesPanel_TypeButton + var browseCommunitiesPanel_MembershipButton + var browseCommunitiesPanel_CategoryButton + var browseCommunitiesPanel_PlaytimeButton + var browseCommunitiesPanel_MicPolicyButton + var browseCommunitiesPanel_MinMembersButton + var browseCommunitiesPanel_ViewDetailsButton + array browseCommunitiesPanel_HintElements + array browseCommunitiesPanel_FilterElements + + int reportAbuseCommunityId + array reportedCommunityIds + + var editCommunityMenu + var editCommunityLanguagesPanel + var editCommunityCategoriesPanel + var editCommunityRegionsPanel + var editCommunityHappyHourPanel + + var editCommunityPanel_PopupBackground + var editCommunityPanel_Header + var editCommunityPanel_Name + var editCommunityPanel_NameLabel + var editCommunityPanel_NameBigLabel + var editCommunityPanel_Clantag + var editCommunityPanel_MOTD + var editCommunityPanel_LanguagesButton + var editCommunityPanel_RegionsButton + var editCommunityPanel_CategoriesButton + var editCommunityPanel_CommunityTypeButton + var editCommunityPanel_MembershipTypeButton + var editCommunityPanel_VisibilityButton + var editCommunityPanel_MicPolicyButton + var editCommunityPanel_HappyHourStartButton + var editCommunityPanel_CreateButton + var editCommunityPanel_SaveButton + + array editCommunityLanguagesPanel_LanguageButtons + array editCommunityRegionsPanel_RegionButtons + array editCommunityCategoriesPanel_CategoryButtons + array editCommunityHappyHourPanel_HappyHourButtons + + bool communityEdited = false + + var sendCommunityMsgMenu + int sendCommunityMsg_expiration + var sendCommunityMsgPanel_ExpirationButton + var sendCommunityMsgPanel_MsgText + var sendCommunityMsgPanel_CommunityName + var sendCommunityMsgPanel_SendButton + + CommunityPanel communityInfoPanelWidgets + CommunityPanel myCommunityInfoPanelWidgets + + var selectNetWorkbutton +// var browseNetworkButton + bool inCommunityPanel + array temporaryPanels + var lastButtonFocused + table keysToStrings + int currentCommunityId + + ComboStruct &networksComboStruct +} file + +void function HideAllPanels() +{ + Hud_Hide( file.editCommunityPanel_PopupBackground ) + Hud_Hide( file.editCommunityHappyHourPanel ) + Hud_Hide( file.editCommunityLanguagesPanel ) + Hud_Hide( file.editCommunityRegionsPanel ) + Hud_Hide( file.editCommunityCategoriesPanel ) + Hud_Hide( file.editCommunityHappyHourPanel ) +} + +void function OnSwitchButton_Activate( var button ) +{ + if( Hud_IsLocked( button ) ) + return + + ClientCommand( "community_list" ) + AdvanceMenu( file.switchCommunityMenu ) + Hud_SetFocused( file.selectNetWorkbutton ) +} + + +void function OnBrowseNetworksButton_Activate( var button ) +{ + if( Hud_IsLocked( button ) ) + return + + UpdateBrowseFilters( file.browseFilters ) + AdvanceMenu( file.browseCommunitiesMenu ) + BrowseCommunities_OnChange( file.browseCommunitiesPanel_ListWidget ) + //Hud_SetFocused( file.browseCommunitiesPanel_ListWidget ) + Hud_SetFocused( file.browseCommunitiesPanel_NameWidget ) + CommunitySettings fakeSettings + FillInCommunityInfoPanel( fakeSettings, file.communityInfoPanelWidgets ) +} + +void function FillInBrowseFilters( BrowseFilters filters ) +{ + Hud_SetText( file.browseCommunitiesPanel_NameWidget, filters.name ) + Hud_SetText( file.browseCommunitiesPanel_ClantagWidget, filters.clantag ) + + if ( filters.communityType == "social" ) + Hud_SetText( file.browseCommunitiesPanel_TypeButton, "#COMMUNITY_SOCIAL" ) + else if ( filters.communityType == "competitive" ) + Hud_SetText( file.browseCommunitiesPanel_TypeButton, "#COMMUNITY_COMPETITIVE" ) + else + Hud_SetText( file.browseCommunitiesPanel_TypeButton, "#COMMUNITY_FILTER_ANY" ) + + if ( filters.micPolicy == "nopref" ) + Hud_SetText( file.browseCommunitiesPanel_MicPolicyButton, "#COMMUNITY_MICS_NOPREF" ) + else if ( filters.micPolicy == "yes" ) + Hud_SetText( file.browseCommunitiesPanel_MicPolicyButton, "#COMMUNITY_MICS_YES" ) + else if ( filters.micPolicy == "no" ) + Hud_SetText( file.browseCommunitiesPanel_MicPolicyButton, "#COMMUNITY_MICS_NO" ) + else + Hud_SetText( file.browseCommunitiesPanel_MicPolicyButton, "#COMMUNITY_FILTER_ANY" ) + + if ( filters.membershipType == "invite" ) + Hud_SetText( file.browseCommunitiesPanel_MembershipButton, "#COMMUNITY_MEMBERSHIP_INVITEONLY" ) + else if ( filters.membershipType == "open" ) + Hud_SetText( file.browseCommunitiesPanel_MembershipButton, "#COMMUNITY_MEMBERSHIP_OPEN" ) + else + Hud_SetText( file.browseCommunitiesPanel_MembershipButton, "#COMMUNITY_FILTER_ANY" ) + + if ( filters.category == "gaming" ) + Hud_SetText( file.browseCommunitiesPanel_CategoryButton, "#COMMUNITY_CATEGORY_GAMING" ) + else if ( filters.category == "lifestyle" ) + Hud_SetText( file.browseCommunitiesPanel_CategoryButton, "#COMMUNITY_CATEGORY_LIFESTYLE" ) + else if ( filters.category == "geography" ) + Hud_SetText( file.browseCommunitiesPanel_CategoryButton, "#COMMUNITY_CATEGORY_GEOGRAPHY" ) + else if ( filters.category == "tech" ) + Hud_SetText( file.browseCommunitiesPanel_CategoryButton, "#COMMUNITY_CATEGORY_TECH" ) + else if ( filters.category == "other" ) + Hud_SetText( file.browseCommunitiesPanel_CategoryButton, "#COMMUNITY_CATEGORY_OTHER" ) + else + Hud_SetText( file.browseCommunitiesPanel_CategoryButton, "#COMMUNITY_FILTER_ANY" ) + + if ( filters.playtime == "morning" ) + Hud_SetText( file.browseCommunitiesPanel_PlaytimeButton, "#COMMUNITY_PLAYTIME_MORNING" ) + else if ( filters.playtime == "afternoon" ) + Hud_SetText( file.browseCommunitiesPanel_PlaytimeButton, "#COMMUNITY_PLAYTIME_AFTERNOON" ) + else if ( filters.playtime == "evening" ) + Hud_SetText( file.browseCommunitiesPanel_PlaytimeButton, "#COMMUNITY_PLAYTIME_EVENING" ) + else if ( filters.playtime == "night" ) + Hud_SetText( file.browseCommunitiesPanel_PlaytimeButton, "#COMMUNITY_PLAYTIME_NIGHTTIME" ) + else + Hud_SetText( file.browseCommunitiesPanel_PlaytimeButton, "#COMMUNITY_FILTER_ANY" ) + + if ( filters.minMembers == 1 ) + Hud_SetText( file.browseCommunitiesPanel_MinMembersButton, "#COMMUNITY_MEMBERCOUNTFILTER_1" ) + else if ( filters.minMembers == 2 ) + Hud_SetText( file.browseCommunitiesPanel_MinMembersButton, "#COMMUNITY_MEMBERCOUNTFILTER_2" ) + else if ( filters.minMembers == 10 ) + Hud_SetText( file.browseCommunitiesPanel_MinMembersButton, "#COMMUNITY_MEMBERCOUNTFILTER_10" ) + else if ( filters.minMembers == 100 ) + Hud_SetText( file.browseCommunitiesPanel_MinMembersButton, "#COMMUNITY_MEMBERCOUNTFILTER_100" ) + else if ( filters.minMembers == 1000 ) + Hud_SetText( file.browseCommunitiesPanel_MinMembersButton, "#COMMUNITY_MEMBERCOUNTFILTER_1000" ) + else if ( filters.minMembers == 10000 ) + Hud_SetText( file.browseCommunitiesPanel_MinMembersButton, "#COMMUNITY_MEMBERCOUNTFILTER_10000" ) + +} + +void function PopupBackground_Activate( var button ) +{ + // if this elements ran this callback, we could close the popup when you clicked outside of it +} + +void function OnBrowseMembershipTypeButton_Activate( var button ) +{ + if ( file.browseFilters.membershipType == "" ) + file.browseFilters.membershipType = "open"; + else if ( file.browseFilters.membershipType == "open" ) + file.browseFilters.membershipType = "invite"; + else if ( file.browseFilters.membershipType == "invite" ) + file.browseFilters.membershipType = ""; + + file.browseFilters.pageNum = 0 + FillInBrowseFilters( file.browseFilters ) + UpdateBrowseFilters( file.browseFilters ) +} + +void function Browse_ChangeCommunityType_Activate( var button ) +{ + if ( file.browseFilters.communityType == "social" ) + file.browseFilters.communityType = "competitive" + else if ( file.browseFilters.communityType == "competitive" ) + file.browseFilters.communityType = "" + else + file.browseFilters.communityType = "social" + + file.browseFilters.pageNum = 0 + FillInBrowseFilters( file.browseFilters ) + UpdateBrowseFilters( file.browseFilters ) +} + +void function Browse_ChangeCommunityMembership_Activate( var button ) +{ + if ( file.browseFilters.membershipType == "invite" ) + file.browseFilters.membershipType = "open" + else if ( file.browseFilters.membershipType == "open" ) + file.browseFilters.membershipType = "" + else + file.browseFilters.membershipType = "invite" + + file.browseFilters.pageNum = 0 + FillInBrowseFilters( file.browseFilters ) + UpdateBrowseFilters( file.browseFilters ) +} + +void function Browse_ChangeCommunityCategory_Activate( var button ) +{ + if ( file.browseFilters.category == "gaming" ) + file.browseFilters.category = "lifestyle" + else if ( file.browseFilters.category == "lifestyle" ) + file.browseFilters.category = "geography" + else if ( file.browseFilters.category == "geography" ) + file.browseFilters.category = "tech" + else if ( file.browseFilters.category == "tech" ) + file.browseFilters.category = "other" + else if ( file.browseFilters.category == "other" ) + file.browseFilters.category = "" + else + file.browseFilters.category = "gaming" + + file.browseFilters.pageNum = 0 + FillInBrowseFilters( file.browseFilters ) + UpdateBrowseFilters( file.browseFilters ) +} + +void function Browse_ChangeCommunityPlaytime_Activate( var button ) +{ + if ( file.browseFilters.playtime == "morning" ) + file.browseFilters.playtime = "afternoon" + else if ( file.browseFilters.playtime == "afternoon" ) + file.browseFilters.playtime = "evening" + else if ( file.browseFilters.playtime == "evening" ) + file.browseFilters.playtime = "night" + else if ( file.browseFilters.playtime == "night" ) + file.browseFilters.playtime = "" + else + file.browseFilters.playtime = "morning" + + file.browseFilters.pageNum = 0 + FillInBrowseFilters( file.browseFilters ) + UpdateBrowseFilters( file.browseFilters ) +} + +void function Browse_ChangeCommunityMicPolicy_Activate( var button ) +{ + if ( file.browseFilters.micPolicy == "nopref" ) + file.browseFilters.micPolicy = "yes"; + else if ( file.browseFilters.micPolicy == "yes" ) + file.browseFilters.micPolicy = "no"; + else if ( file.browseFilters.micPolicy == "no" ) + file.browseFilters.micPolicy = ""; + else if ( file.browseFilters.micPolicy == "" ) + file.browseFilters.micPolicy = "nopref"; + + file.browseFilters.pageNum = 0 + FillInBrowseFilters( file.browseFilters ) + UpdateBrowseFilters( file.browseFilters ) +} + +void function Browse_ChangeCommunityMinMembers_Activate( var button ) +{ + if ( file.browseFilters.minMembers <= 1 ) + file.browseFilters.minMembers = 2; + else if ( file.browseFilters.minMembers == 2 ) + file.browseFilters.minMembers = 10; + else if ( file.browseFilters.minMembers == 10 ) + file.browseFilters.minMembers = 100; + else if ( file.browseFilters.minMembers == 100 ) + file.browseFilters.minMembers = 1000; + else if ( file.browseFilters.minMembers == 1000 ) + file.browseFilters.minMembers = 10000; + else if ( file.browseFilters.minMembers == 10000 ) + file.browseFilters.minMembers = 1; + + file.browseFilters.pageNum = 0 + FillInBrowseFilters( file.browseFilters ) + UpdateBrowseFilters( file.browseFilters ) +} + +void function Browse_CommunityNameChanged( var textInput ) +{ + file.browseFilters.name = Hud_GetUTF8Text( file.browseCommunitiesPanel_NameWidget ) + file.browseFilters.pageNum = 0 + UpdateBrowseFilters( file.browseFilters ) +} + +void function Browse_CommunityClantagChanged( var textInput ) +{ + file.browseFilters.clantag = Hud_GetUTF8Text( file.browseCommunitiesPanel_ClantagWidget ) + file.browseFilters.pageNum = 0 + UpdateBrowseFilters( file.browseFilters ) +} + +void function OnEditCommunityButton_Activate( var button ) +{ + thread GetCommunitySettingsThread() + + Hud_SetText( file.editCommunityPanel_Header, "#MENUHEADER_COMMUNITY_EDIT" ) + Hud_SetText( file.editCommunityPanel_NameBigLabel, Hud_GetUTF8Text( file.editCommunityPanel_Name ) ) + Hud_Show( file.editCommunityPanel_NameBigLabel ) + Hud_Hide( file.editCommunityPanel_NameLabel ) + Hud_Hide( file.editCommunityPanel_Name ) + Hud_Hide( file.editCommunityPanel_CreateButton ) + Hud_Show( file.editCommunityPanel_SaveButton ) + AdvanceMenu( file.editCommunityMenu ) + Hud_SetFocused( file.editCommunityPanel_Clantag ) + file.communityEdited = false +} + +void function FillInSendMessageUI() +{ + string stringName + if ( file.sendCommunityMsg_expiration >= 24 ) + stringName = "#COMMUNITY_EXPIRES_" + (file.sendCommunityMsg_expiration/24) + "DAY"; + else + stringName = "#COMMUNITY_EXPIRES_" + file.sendCommunityMsg_expiration + "HOUR"; + Hud_SetUTF8Text( file.sendCommunityMsgPanel_ExpirationButton, Localize( stringName ) ); +} + +void function OnCommunitySendMsg_Open() +{ + OnStartSendCommunityMessageButton_Activate( null ) +} + +void function OnStartSendCommunityMessageButton_Activate( var button ) +{ + var communityName = GetCurrentCommunityName() + expect string(communityName) + Hud_SetUTF8Text( file.sendCommunityMsgPanel_CommunityName, Localize( communityName ) ) + Hud_SetUTF8Text( file.sendCommunityMsgPanel_MsgText, "" ) + FillInSendMessageUI() + AdvanceMenu( file.sendCommunityMsgMenu ) + Hud_SetFocused( file.sendCommunityMsgPanel_MsgText ) +} + +int function RotateExpirationPreset( int currentValue ) +{ + array intervals = [1, 12, 24, 2*24, 3*24, 5*24, 7*24]; + + for ( int i = 0; i < intervals.len()-1; i++ ) + { + if ( intervals[i] == currentValue ) + return intervals[i+1]; + } + return intervals[0]; +} + +void function OnChangeCommunityMessageExpirationButton_Activate( var button ) +{ + file.sendCommunityMsg_expiration = RotateExpirationPreset( file.sendCommunityMsg_expiration ) + FillInSendMessageUI(); +} + +void function OnActualSendCommunityMessageButton_Activate( var button ) +{ + DialogData dialogData + dialogData.header = "#COMMUNITY_SEND_CONFIRM" + + AddDialogButton( dialogData, "#YES", OnActualSendCommunityMessageButton_Confirm ) + AddDialogButton( dialogData, "#NO" ) + + dialogData.noChoiceWithNavigateBack = true + OpenDialog( dialogData ) +} + +void function OnActualSendCommunityMessageButton_Confirm() +{ + CloseActiveMenu() + Hud_SetFocused( file.sendMessageButton ) + + EmitUISound( "Menu_Email_Sent" ) + + string text = Hud_GetUTF8Text( file.sendCommunityMsgPanel_MsgText ) + BroadcastCommunityMessage( file.sendCommunityMsg_expiration, text ) +} + +void function OnViewPendingRequestButton_Activate( var button ) +{ + if ( file.totalJoinRequests ) + { + AdvanceMenu( file.adminViewPendingRequests ) + ClientCommand( "community_getPendingJoinRequest" ) + Hud_SetFocused( file.pendingJoinRequest_AcceptButton ) + } +} + +void function OnCreateCommunityButton_Activate( var button ) +{ + file.region = MyRegion() + + CommunitySettings settings + Assert( settings.communityId == 0 ) + settings.visibility = "public" + settings.membershipType = "open" + settings.communityType = "social" + settings.category = "gaming" + settings.micPolicy = "nopref" + for ( int i = 0; i < file.languages.len(); i++ ) + { + if ( file.languages[i].tolower() == GetLanguage().tolower() ) + { + settings.language1 = file.languages[i] + break + } + } + + settings.region1 = file.region + file.settings = settings + file.haveSettings = true + FillInCommunitySettingsPanel( file.settings ) + Hud_SetText( file.editCommunityPanel_Clantag, settings.clanTag ) + Hud_SetText( file.editCommunityPanel_Name, settings.name ) + Hud_SetText( file.editCommunityPanel_MOTD, settings.motd ) + + AdvanceMenu( file.editCommunityMenu ) + Hud_SetEnabled( file.editCommunityPanel_Name, true ) + + Hud_Show( file.editCommunityPanel_CreateButton ) + Hud_Hide( file.editCommunityPanel_SaveButton ) + + Hud_SetText( file.editCommunityPanel_Header, "#MENUHEADER_COMMUNITY_CREATE" ) + Hud_Show( file.editCommunityPanel_NameBigLabel ) + Hud_Show( file.editCommunityPanel_NameLabel ) + Hud_Hide( file.editCommunityPanel_NameBigLabel ) + Hud_Show( file.editCommunityPanel_Name ) + Hud_SetFocused( file.editCommunityPanel_Name ) +} + +void function OnLanguagesButton_Activate( var button ) +{ + ShowCommunityPanel( file.editCommunityLanguagesPanel ) + + file.inCommunityPanel = true + file.temporaryPanels.append( file.editCommunityLanguagesPanel ) + SetLanguageButtons() + file.lastButtonFocused = button + + Hud_SetFocused( file.editCommunityLanguagesPanel_LanguageButtons[0] ) +} + +void function SetLanguageButtons() +{ + int toggledCount = 0 + for ( int i = 0; i < file.languages.len(); i++ ) + { + if ( file.languages[i].tolower() == GetLanguage().tolower() ) + { + Hud_SetSelected( file.editCommunityLanguagesPanel_LanguageButtons[i], true ) + Hud_SetEnabled( file.editCommunityLanguagesPanel_LanguageButtons[i], false ) + } + else if ( file.settings.language1 == file.languages[i] || file.settings.language2 == file.languages[i] || file.settings.language3 == file.languages[i] ) + { + Hud_SetSelected( file.editCommunityLanguagesPanel_LanguageButtons[i], true ) + Hud_SetEnabled( file.editCommunityLanguagesPanel_LanguageButtons[i], true ) + } + else + { + Hud_SetSelected( file.editCommunityLanguagesPanel_LanguageButtons[i], false ) + Hud_SetEnabled( file.editCommunityLanguagesPanel_LanguageButtons[i], true ) + } + } + + UpdateComboSelectButtons( file.editCommunityLanguagesPanel_LanguageButtons, GetToggledLanguage( 2 ) != "" ) +} + +bool function HasRegionSelected( string region ) +{ + // boy I with this was an array + if ( file.settings.region1 == region || file.settings.region2 == region || file.settings.region3 == region || file.settings.region4 == region || file.settings.region5 == region ) + return true + return false +} + +void function SetRegionButtons() +{ + int toggledCount = 0 + for ( int i = 0; i < file.regions.len(); i++ ) + { + if ( file.regions[i] == file.region ) + { + Hud_SetSelected( file.editCommunityRegionsPanel_RegionButtons[i], true ) + Hud_SetEnabled( file.editCommunityRegionsPanel_RegionButtons[i], false ) + } + else if ( HasRegionSelected( file.regions[i] ) ) + { + Hud_SetSelected( file.editCommunityRegionsPanel_RegionButtons[i], true ) + Hud_SetEnabled( file.editCommunityRegionsPanel_RegionButtons[i], true ) + } + else + { + Hud_SetSelected( file.editCommunityRegionsPanel_RegionButtons[i], false ) + Hud_SetEnabled( file.editCommunityRegionsPanel_RegionButtons[i], true ) + } + } + + UpdateComboSelectButtons( file.editCommunityRegionsPanel_RegionButtons, GetToggledRegion( 2 ) != "" ) +} + +string function GetToggledLanguage( int index ) +{ + int toggledCount = 0 + for ( int i = 0; i < file.languages.len(); i++ ) + { + if ( Hud_IsSelected( file.editCommunityLanguagesPanel_LanguageButtons[i] ) ) + { + if ( index == toggledCount ) + { + var language = file.languages[i] + expect string(language) + return language; + } + toggledCount++ + } + } + return "" +} + +void function OnSaveLanguagesButton_Activate( var button ) +{ + HideAllPanels() + Hud_SetFocused( file.editCommunityPanel_LanguagesButton ) + + if ( !file.haveSettings ) + return + + file.settings.language1 = GetToggledLanguage( 0 ) + printt( "language1 is " + file.settings.language1 ) + file.settings.language2 = GetToggledLanguage( 1 ) + printt( "language2 is " + file.settings.language2 ) + file.settings.language3 = GetToggledLanguage( 2 ) + printt( "language3 is " + file.settings.language3 ) + + FillInCommunitySettingsPanel( file.settings ) + file.communityEdited = true +} + +string function GetToggledRegion( int index ) +{ + int toggledCount = 0 + for ( int i = 0; i < file.regions.len(); i++ ) + { + if ( Hud_IsSelected( file.editCommunityRegionsPanel_RegionButtons[i] ) ) + { + if ( index == toggledCount ) + { + var region = file.regions[i] + expect string(region) + return region; + } + toggledCount++ + } + } + return "" +} + +void function ShowCommunityPanel( var panel ) +{ + Hud_Show( file.editCommunityPanel_PopupBackground ) + file.temporaryPanels.append( file.editCommunityPanel_PopupBackground ) + + if ( panel == file.editCommunityRegionsPanel ) + Hud_Show( file.editCommunityRegionsPanel ) + else + Hud_Hide( file.editCommunityRegionsPanel ) + + if ( panel == file.editCommunityLanguagesPanel ) + Hud_Show( file.editCommunityLanguagesPanel ) + else + Hud_Hide( file.editCommunityLanguagesPanel ) + + if ( panel == file.editCommunityCategoriesPanel ) + Hud_Show( file.editCommunityCategoriesPanel ) + else + Hud_Hide( file.editCommunityCategoriesPanel ) + + if ( panel == file.editCommunityHappyHourPanel ) + Hud_Show( file.editCommunityHappyHourPanel ) + else + Hud_Hide( file.editCommunityHappyHourPanel ) +} + +void function OnRegionsButton_Activate( var button ) +{ + ShowCommunityPanel( file.editCommunityRegionsPanel ) + + file.inCommunityPanel = true + file.temporaryPanels.append( file.editCommunityRegionsPanel ) + file.lastButtonFocused = button + SetRegionButtons() + + Hud_SetFocused( file.editCommunityRegionsPanel_RegionButtons[0] ) +} + +void function OnSaveRegionsButton_Activate( var button ) +{ + HideAllPanels() + Hud_SetFocused( file.editCommunityPanel_RegionsButton ) + + if ( !file.haveSettings ) + return + + file.settings.region1 = GetToggledRegion( 0 ) + printt( "region1 is " + file.settings.region1 ) + file.settings.region2 = GetToggledRegion( 1 ) + printt( "region2 is " + file.settings.region2 ) + file.settings.region3 = GetToggledRegion( 2 ) + printt( "region3 is " + file.settings.region3 ) + file.settings.region4 = GetToggledRegion( 3 ) + printt( "region4 is " + file.settings.region4 ) + file.settings.region5 = GetToggledRegion( 4 ) + printt( "region5 is " + file.settings.region5 ) + + FillInCommunitySettingsPanel( file.settings ) + file.communityEdited = true +} + +void function OnCategoriesButton_Activate( var button ) +{ + ShowCommunityPanel( file.editCommunityCategoriesPanel ) + + int toggledCount = 0 + for ( int i = 0; i < file.categories.len(); i++ ) + { + if ( file.settings.category.tolower() == file.categories[i].tolower() ) + Hud_SetSelected( file.editCommunityCategoriesPanel_CategoryButtons[i], true ) + else + Hud_SetSelected( file.editCommunityCategoriesPanel_CategoryButtons[i], false ) + } + + file.inCommunityPanel = true + file.temporaryPanels.append( file.editCommunityCategoriesPanel ) + file.lastButtonFocused = button + + Hud_SetFocused( file.editCommunityCategoriesPanel_CategoryButtons[0] ) +} + +void function OnSaveCategoriesButton_Activate( var button ) +{ + for ( int i = 0; i < file.categories.len(); i++ ) + { + if ( file.editCommunityCategoriesPanel_CategoryButtons[i] == button ) + { + file.settings.category = file.categories[i] + break + } + } + printt( "category is " + file.settings.category ) + HideAllPanels() + Hud_SetFocused( file.editCommunityPanel_CategoriesButton ) + FillInCommunitySettingsPanel( file.settings ) + file.communityEdited = true +} + +void function FillInCommunitySettingsPanel( CommunitySettings settings ) +{ + string languages = Localize( ConvertKeyToLocalizedString( settings.language1 ) ) + if ( settings.language2 != "" ) + languages += ", " + Localize( ConvertKeyToLocalizedString( settings.language2 ) ) + if ( settings.language3 != "" ) + languages += ", " + Localize( ConvertKeyToLocalizedString( settings.language3 ) ) + + Hud_SetText( file.editCommunityPanel_LanguagesButton, languages ) + + string regions = settings.region1 + if ( settings.region2 != "" ) + regions += ", " + Localize( ConvertKeyToLocalizedString( settings.region2 ) ) + if ( settings.region3 != "" ) + regions += ", " + Localize( ConvertKeyToLocalizedString( settings.region3 ) ) + if ( settings.region4 != "" ) + regions += ", " + Localize( ConvertKeyToLocalizedString( settings.region4 ) ) + if ( settings.region5 != "" ) + regions += ", " + Localize( ConvertKeyToLocalizedString( settings.region5 ) ) + + Hud_SetText( file.editCommunityPanel_RegionsButton, regions ) + + if ( settings.communityType == "social" ) + Hud_SetText( file.editCommunityPanel_CommunityTypeButton, "#COMMUNITY_SOCIAL" ) + else + Hud_SetText( file.editCommunityPanel_CommunityTypeButton, "#COMMUNITY_COMPETITIVE" ) + + if ( settings.micPolicy == "nopref" ) + Hud_SetText( file.editCommunityPanel_MicPolicyButton, "#COMMUNITY_MICS_NOPREF" ) + else if ( settings.micPolicy == "yes" ) + Hud_SetText( file.editCommunityPanel_MicPolicyButton, "#COMMUNITY_MICS_YES" ) + else + Hud_SetText( file.editCommunityPanel_MicPolicyButton, "#COMMUNITY_MICS_NO" ) + + if ( settings.visibility == "public" ) + Hud_SetText( file.editCommunityPanel_VisibilityButton, "#COMMUNITY_VISIBILITY_PUBLIC" ) + else + Hud_SetText( file.editCommunityPanel_VisibilityButton, "#COMMUNITY_VISIBILITY_PRIVATE" ) + + if ( settings.membershipType == "invite" ) + Hud_SetText( file.editCommunityPanel_MembershipTypeButton, "#COMMUNITY_MEMBERSHIP_INVITEONLY" ) + else + Hud_SetText( file.editCommunityPanel_MembershipTypeButton, "#COMMUNITY_MEMBERSHIP_OPEN" ) + + printt( "setting category to " + settings.category ) + if ( settings.category == "gaming" ) + Hud_SetText( file.editCommunityPanel_CategoriesButton, "#COMMUNITY_CATEGORY_GAMING" ) + else if ( settings.category == "lifestyle" ) + Hud_SetText( file.editCommunityPanel_CategoriesButton, "#COMMUNITY_CATEGORY_LIFESTYLE" ) + else if ( settings.category == "geography" ) + Hud_SetText( file.editCommunityPanel_CategoriesButton, "#COMMUNITY_CATEGORY_GEOGRAPHY" ) + else if ( settings.category == "tech" ) + Hud_SetText( file.editCommunityPanel_CategoriesButton, "#COMMUNITY_CATEGORY_TECH" ) + else if ( settings.category == "other" ) + Hud_SetText( file.editCommunityPanel_CategoriesButton, "#COMMUNITY_CATEGORY_OTHER" ) + + SetRegionButtons() + SetLanguageButtons() + + printt( "happyHourStart: " + settings.happyHourStart ) + string happyHourString = "#COMMUNITY_HAPPYHOUR_" + settings.happyHourStart + printt( "happy hour is " + happyHourString ) + Hud_SetText( file.editCommunityPanel_HappyHourStartButton, happyHourString ) +} + +void function OnMembershipTypeButton_Activate( var button ) +{ + if ( !file.haveSettings ) + return + + if ( file.settings.membershipType == "invite" ) + file.settings.membershipType = "open"; + else + file.settings.membershipType = "invite"; + + FillInCommunitySettingsPanel( file.settings ) + file.communityEdited = true +} + +void function OnMicPolicyButton_Activate( var button ) +{ + if ( !file.haveSettings ) + return + + if ( file.settings.micPolicy == "nopref" ) + file.settings.micPolicy = "yes"; + else if ( file.settings.micPolicy == "yes" ) + file.settings.micPolicy = "no"; + else + file.settings.micPolicy = "nopref"; + + FillInCommunitySettingsPanel( file.settings ) + file.communityEdited = true +} + +void function OnVisibilityButton_Activate( var button ) +{ + if ( !file.haveSettings ) + return + + if ( file.settings.visibility == "public" ) + file.settings.visibility = "private"; + else + file.settings.visibility = "public"; + + FillInCommunitySettingsPanel( file.settings ) + file.communityEdited = true +} + +void function OnCommunityTypeButton_Activate( var button ) +{ + if ( !file.haveSettings ) + return + + if ( file.settings.communityType == "social" ) + file.settings.communityType = "competitive"; + else + file.settings.communityType = "social"; + + FillInCommunitySettingsPanel( file.settings ) + file.communityEdited = true + file.communityEdited = true +} + +void function OnHappyHourButton_Activate( var button ) +{ + HideAllPanels() + // Hud_Hide( file.editCommunityCategoriesPanel ) + // Hud_Hide( file.editCommunityLanguagesPanel ) + // Hud_Hide( file.editCommunityRegionsPanel ) + // Hud_Show( file.editCommunityHappyHourPanel ) + // Hud_SetFocused( file.editCommunityHappyHourPanel_HappyHourButtons[0] ) + + // file.inCommunityPanel = true + // file.temporaryPanels.append( file.editCommunityHappyHourPanel ) + // file.lastButtonFocused = button + + OnHappyHourNext( button ) + file.communityEdited = true +} + +void function OnHappyHourPrev( var button ) +{ + file.settings.happyHourStart = (file.settings.happyHourStart-1+24)%24 + SetHappyHour( file.settings.happyHourStart ) + + if ( Hud_GetHudName( button ) == "HappyHourLeftHidden" || Hud_GetHudName( button ) == "HappyHourRightHidden" ) + Hud_SetFocused( file.editCommunityPanel_HappyHourStartButton ) +} + +void function OnHappyHourNext( var button ) +{ + file.settings.happyHourStart = (file.settings.happyHourStart+1)%24 + SetHappyHour( file.settings.happyHourStart ) + + if ( Hud_GetHudName( button ) == "HappyHourLeftHidden" || Hud_GetHudName( button ) == "HappyHourRightHidden" ) + Hud_SetFocused( file.editCommunityPanel_HappyHourStartButton ) +} + +void function SetHappyHour( int startTime ) +{ + if ( !file.haveSettings ) + return + + file.settings.happyHourStart = startTime + + HideAllPanels() + // Hud_SetFocused( file.editCommunityPanel_HappyHourStartButton ) + + FillInCommunitySettingsPanel( file.settings ) +} + +void function OnHappyHour0Button_Activate( var button ) +{ + SetHappyHour( 0 ) +} + +void function OnHappyHour1Button_Activate( var button ) +{ + SetHappyHour( 1 ) +} + +void function OnHappyHour2Button_Activate( var button ) +{ + SetHappyHour( 2 ) +} + +void function OnHappyHour3Button_Activate( var button ) +{ + SetHappyHour( 3 ) +} + +void function OnHappyHour4Button_Activate( var button ) +{ + SetHappyHour( 4 ) +} + +void function OnHappyHour5Button_Activate( var button ) +{ + SetHappyHour( 5 ) +} + +void function OnHappyHour6Button_Activate( var button ) +{ + SetHappyHour( 6 ) +} + +void function OnHappyHour7Button_Activate( var button ) +{ + SetHappyHour( 7 ) +} + +void function OnHappyHour8Button_Activate( var button ) +{ + SetHappyHour( 8 ) +} + +void function OnHappyHour9Button_Activate( var button ) +{ + SetHappyHour( 9 ) +} + +void function OnHappyHour10Button_Activate( var button ) +{ + SetHappyHour( 10 ) +} + +void function OnHappyHour11Button_Activate( var button ) +{ + SetHappyHour( 11 ) +} + +void function OnHappyHour12Button_Activate( var button ) +{ + SetHappyHour( 12 ) +} + +void function OnHappyHour13Button_Activate( var button ) +{ + SetHappyHour( 13 ) +} + +void function OnHappyHour14Button_Activate( var button ) +{ + SetHappyHour( 14 ) +} + +void function OnHappyHour15Button_Activate( var button ) +{ + SetHappyHour( 15 ) +} + +void function OnHappyHour16Button_Activate( var button ) +{ + SetHappyHour( 16 ) +} + +void function OnHappyHour17Button_Activate( var button ) +{ + SetHappyHour( 17 ) +} + +void function OnHappyHour18Button_Activate( var button ) +{ + SetHappyHour( 18 ) +} + +void function OnHappyHour19Button_Activate( var button ) +{ + SetHappyHour( 19 ) +} + +void function OnHappyHour20Button_Activate( var button ) +{ + SetHappyHour( 20 ) +} + +void function OnHappyHour21Button_Activate( var button ) +{ + SetHappyHour( 21 ) +} + +void function OnHappyHour22Button_Activate( var button ) +{ + SetHappyHour( 22 ) +} + +void function OnHappyHour23Button_Activate( var button ) +{ + SetHappyHour( 23 ) +} + +void function UICodeCallback_CommunitySaved( int communityId ) +{ + printt( "communityId " + communityId + " saved successfully" ); + CloseActiveMenu() + HideAllPanels() + + Hud_SetFocused( file.editButton ) + thread GetCommunityInfoThread( communityId ) + file.communityEdited = false +} + +void function UICodeCallback_CommunitySaveFailed( int communityId ) +{ + printt( "communityId " + communityId + " failed to saved successfully" ); +} + +void function OnSaveCommunityButton_Activate( var button ) +{ + if ( !file.haveSettings ) + return + + file.settings.name = Hud_GetUTF8Text( file.editCommunityPanel_Name ) + file.settings.clanTag = Hud_GetUTF8Text( file.editCommunityPanel_Clantag ) + file.settings.motd = Hud_GetUTF8Text( file.editCommunityPanel_MOTD ) + + SaveCommunitySettings( file.settings ) + ClientCommand( "recheck" ) +} + +void function GetCommunitySettingsThread() +{ + while ( true ) + { + if ( GetCurrentCommunityId() < 0 ) + { + WaitFrameOrUntilLevelLoaded() + continue + } + + CommunitySettings ornull settings = GetCommunitySettings( GetCurrentCommunityId() ) + if ( !settings ) + { + file.haveSettings = false + wait 0.05 + } + else + { + file.haveSettings = true + expect CommunitySettings( settings ) + file.settings = settings + + Hud_SetText( file.editCommunityPanel_Clantag, settings.clanTag ) + Hud_SetText( file.editCommunityPanel_Name, settings.name ) + Hud_SetText( file.editCommunityPanel_MOTD, settings.motd ) + FillInCommunitySettingsPanel( file.settings ) + break + } + } +} + +void function Community_CommunityUpdated() +{ + if ( !file.firstCommunityUpdateHappened ) + file.firstCommunityUpdateHappened = true + + int currentCommunityId = GetCurrentCommunityId() + bool currentCommunityChanged = file.currentCommunityId != currentCommunityId + file.currentCommunityId = currentCommunityId + + CommunitySettings ornull settings = GetCommunitySettings( currentCommunityId ) + if ( settings != null ) // if you are not on the advocate network then you joined a new network + { + expect CommunitySettings( settings ) + if ( currentCommunityId != ADVOCATE_NETWORK ) + ScriptCallback_UnlockAchievement( achievements.JOIN_NETWORK ) + } + + if ( currentCommunityChanged && InPendingOpenInvite() ) + ClientCommand( "leaveopeninvite" ) + + string membershipLevel = GetCurrentCommunityMembershipLevel() + + // printt( "setting up community ui - you are " + membershipLevel + " of this community" ); + SetButtonRuiText( file.sendMessageButton, Localize( "#COMMUNITY_MESSAGE_SENDMESSAGE", GetCurrentCommunityName() ) ) + bool owner = membershipLevel == "owner" + bool admin = owner || membershipLevel == "admin" + Hud_SetEnabled( file.sendMessageButton, admin ) + Hud_SetEnabled( file.adminViewPendingRequestsButton, admin ) + + if ( admin && file.totalJoinRequests ) + { + Hud_Show( file.adminViewPendingRequestsButton ) + } + else + { + Hud_Hide( file.adminViewPendingRequestsButton ) + } + + Hud_SetEnabled( file.editButton, owner ) + + if ( owner ) + Hud_Show( file.editButton ) + else + Hud_Hide( file.editButton ) + + if ( admin ) + { + Hud_Show( file.sendButton ) + Hud_Show( file.sendMessageButton ) + } + else + { + Hud_Hide( file.sendButton ) + } + + Hud_SetEnabled( file.chatroomToggleVoiceModeButton0, admin ) + Hud_SetEnabled( file.chatroomToggleVoiceModeButton1, admin ) + if ( !file.inCommunityPanel ) + { + UpdateChatroomToggleVis( admin ) + } + + UpdateChatroomToggleText() + + ComboButtons_ResetColumnFocus( file.networksComboStruct ) + UpdateChatroomUI() + //UpdateArmoryMenu( admin, owner ) +} + +void function UpdateChatroomToggleVis( bool admin ) +{ + if ( admin ) + { + Hud_Show( file.chatroomToggleVoiceModeButton0 ) + Hud_Show( file.chatroomToggleVoiceModeButton1 ) + Hud_Show( file.chatroomToggleVoiceModeHeader ) + } + else + { + Hud_Hide( file.chatroomToggleVoiceModeButton0 ) + Hud_Hide( file.chatroomToggleVoiceModeButton1 ) + Hud_Hide( file.chatroomToggleVoiceModeHeader ) + } +} + +void function UpdateChatroomToggleText( int currentVoiceMode = -1 ) +{ + if ( currentVoiceMode == -1 ) + currentVoiceMode = GetConVarInt( "chatroom_voiceMode" ) + if ( currentVoiceMode == 0 ) + { + ComboButton_SetText( file.chatroomToggleVoiceModeButton0, Localize( "#MENU_TITLE_CHATROOM_SELECTED", Localize( "#MENU_TITLE_CHATROOM_FREETALK" ) ) ) + ComboButton_SetText( file.chatroomToggleVoiceModeButton1, Localize( "#MENU_TITLE_CHATROOM_ADMINSONLY" ) ) + } + else + { + ComboButton_SetText( file.chatroomToggleVoiceModeButton0, Localize( "#MENU_TITLE_CHATROOM_FREETALK" ) ) + ComboButton_SetText( file.chatroomToggleVoiceModeButton1, Localize( "#MENU_TITLE_CHATROOM_SELECTED", Localize( "#MENU_TITLE_CHATROOM_ADMINSONLY" ) ) ) + } +} + +void function GetCommunityInfoThread( int communityId ) +{ + EndSignal( uiGlobal.signalDummy, "StopCommunityLookups" ) + + wait 0.3 + + printt( "getting info on community " + communityId ) + + CommunitySettings fakeSettings + fakeSettings.name = Localize( "#COMMUNITY_FETCHING" ) + FillInCommunityInfoPanel( fakeSettings, file.myCommunityInfoPanelWidgets ) + FillInCommunityInfoPanel( fakeSettings, file.communityInfoPanelWidgets ) + file.communityInfoPanelWidgets.CommunityId = 0 + file.myCommunityInfoPanelWidgets.CommunityId = 0 + + while ( true ) + { + CommunitySettings ornull settings = GetCommunitySettings( communityId ) + if ( !settings ) + { + wait 0.05 + } + else + { + expect CommunitySettings( settings ) + if ( settings.doneResolving ) + printt( "Got fully resolved community info/settings for community " + communityId ) + + file.communityInfoPanelWidgets.CommunityId = communityId + file.myCommunityInfoPanelWidgets.CommunityId = communityId + FillInCommunityInfoPanel( settings, file.myCommunityInfoPanelWidgets ) + FillInCommunityInfoPanel( settings, file.communityInfoPanelWidgets ) + + if ( settings.doneResolving ) + return + wait 0.05 + } + } +} + +void function UICodeCallback_ShowCommunityInfo( int communityId ) +{ + printt( "Showing community info for communityId " + communityId ) + + Signal( uiGlobal.signalDummy, "StopCommunityLookups" ) + thread GetCommunityInfoThread( communityId ) +} + +void function LeaveCommunityButton_Activate( var button ) +{ + DialogData dialogData + CommunitySettings ornull settings = GetCommunitySettings( file.communityInfoPanelWidgets.CommunityId ) + + if ( settings == null ) + return + + expect CommunitySettings( settings ) + + string name = settings.name + dialogData.header = Localize( "#REALLY_LEAVE_COMMUNITY", name ) + + AddDialogButton( dialogData, "#YES", LeaveCommunityDialog ) + AddDialogButton( dialogData, "#NO" ) + + dialogData.noChoiceWithNavigateBack = true + OpenDialog( dialogData ) +} + +void function LeaveCommunityDialog() +{ + if ( AreWeInCommunity( file.communityInfoPanelWidgets.CommunityId ) ) + LeaveCommunity( file.communityInfoPanelWidgets.CommunityId ) +} + + +void function LeaveCurrentCommunityButton_Activate( var button ) +{ + DialogData dialogData + CommunitySettings ornull settings = GetCommunitySettings( GetCurrentCommunityId() ) + + if ( settings == null ) + return + + expect CommunitySettings( settings ) + + string name = settings.name + dialogData.header = Localize( "#REALLY_LEAVE_COMMUNITY", name ) + + AddDialogButton( dialogData, "#YES", LeaveCurrentCommunityDialog ) + AddDialogButton( dialogData, "#NO" ) + + dialogData.noChoiceWithNavigateBack = true + OpenDialog( dialogData ) +} + +void function LeaveCurrentCommunityDialog() +{ + if ( AreWeInCommunity( GetCurrentCommunityId() ) ) + LeaveCommunity( GetCurrentCommunityId() ) +} + +void function UICodeCallback_ShowCommunityJoinRequest( int communityId, int totalRemainingRequests, string requesterUID, string requesterHardware ) +{ + printt( totalRemainingRequests + " total requests left to answer" ) + file.totalJoinRequests = totalRemainingRequests + + Signal( uiGlobal.signalDummy, "StopUserJoinRequestLookups" ) + if ( !totalRemainingRequests ) + { + if ( Hud_IsVisible( file.adminViewPendingRequests ) ) + CloseActiveMenu() + } + else + { + if ( requesterUID != "0" ) + thread GetPendingJoinUserInfoThread( communityId, requesterHardware, requesterUID ) + } +} + +void function JoinRequest_Accept( var button ) +{ + Signal( uiGlobal.signalDummy, "StopUserJoinRequestLookups" ) + ClientCommand( "community_getPendingJoinRequest 1" ) +} + +void function JoinRequest_Deny( var button ) +{ + Signal( uiGlobal.signalDummy, "StopUserJoinRequestLookups" ) + ClientCommand( "community_getPendingJoinRequest 0" ) +} + + +void function GetPendingJoinUserInfoThread( int communityId, string hardware, string userId ) +{ + EndSignal( uiGlobal.signalDummy, "StopUserJoinRequestLookups" ) + printt( "pendingJoin getting userinfo for user " + userId ) + + CommunityUserInfo fakeSettings + fakeSettings.name = Localize( "#COMMUNITY_FETCHING" ) + FillInUserInfoPanel( file.pendingJoinRequestPanel, fakeSettings ) + + while ( true ) + { + CommunitySettings ornull settings = GetCommunitySettings( communityId ) + CommunityUserInfo ornull userInfo = GetCommunityUserInfo( hardware, userId ) + + if ( !userInfo || !settings ) + { + printt( "pendingJoin asking for userinfo for " + hardware + "=" + userId ) + wait 0.05 + } + else + { + printt( "Got user info for user " + userId + " on hardware " + hardware ) + expect CommunityUserInfo( userInfo ) + expect CommunitySettings( settings ) + + printt( "User " + userId + " is in " + userInfo.numCommunities + " communities" ) + + FillInUserInfoPanel( file.pendingJoinRequestPanel, userInfo ) + + string title + if ( settings.communityId ) + title = "[" + settings.clanTag + "] " + settings.name; + else + title = settings.name; + Hud_SetText( file.pendingJoinRequest_CommunityName, title ) + break + } + } +} + +void function FillInCommunityInfoPanel( CommunitySettings settings, CommunityPanel communityPanel ) +{ + string title + if ( settings.communityId ) + title = "[" + settings.clanTag + "] " + settings.name; + else + title = settings.name; + + if ( communityPanel.Name != null ) + Hud_SetText( communityPanel.Name, title ) + + if ( communityPanel.CommunityNameRui != null ) + SetLabelRuiText( communityPanel.CommunityNameRui, Localize( "#COMMUNITY_CHATROOM", title ) ) + + Hud_SetText( communityPanel.Creator, settings.creatorName ) + string memberCountText = "" + settings.memberCount; + Hud_SetText( communityPanel.Members, memberCountText ) + Hud_SetText( communityPanel.MOTD, settings.motd ) + string killsText = "" + settings.kills + Hud_SetText( communityPanel.Kills, killsText ) + string winsText = "" + settings.wins + Hud_SetText( communityPanel.Wins, winsText ) + string lossesText = "" + settings.losses + Hud_SetText( communityPanel.Losses, lossesText ) + string deathsText = "" + settings.deaths + Hud_SetText( communityPanel.Deaths, deathsText ) + string xpText = ShortenNumber( settings.xp ) + Hud_SetText( communityPanel.XP, xpText ) + + string languages = Localize( ConvertKeyToLocalizedString( settings.language1 ) ) + if ( settings.language2 != "" ) + languages += ", " + Localize( ConvertKeyToLocalizedString( settings.language2 ) ) + if ( settings.language3 != "" ) + languages += ", " + Localize( ConvertKeyToLocalizedString( settings.language3 ) ) + + Hud_SetText( communityPanel.LanguagesLabel, languages ) + + string regions = Localize( ConvertKeyToLocalizedString( settings.region1 ) ) + if ( settings.region2 != "" ) + regions += ", " + Localize( ConvertKeyToLocalizedString( settings.region2 ) ) + if ( settings.region3 != "" ) + regions += ", " + Localize( ConvertKeyToLocalizedString( settings.region3 ) ) + + Hud_SetText( communityPanel.RegionsLabel, regions ) + + if ( settings.communityType == "social" ) + Hud_SetText( communityPanel.CommunityTypeLabel, "#COMMUNITY_SOCIAL" ) + else + Hud_SetText( communityPanel.CommunityTypeLabel, "#COMMUNITY_COMPETITIVE" ) + + if ( settings.micPolicy == "nopref" ) + Hud_SetText( communityPanel.MicPolicyLabel, "#COMMUNITY_MICS_NOPREF" ) + else if ( settings.micPolicy == "yes" ) + Hud_SetText( communityPanel.MicPolicyLabel, "#COMMUNITY_MICS_YES" ) + else + Hud_SetText( communityPanel.MicPolicyLabel, "#COMMUNITY_MICS_NO" ) + + if ( settings.visibility == "public" ) + Hud_SetText( communityPanel.VisibilityLabel, "#COMMUNITY_VISIBILITY_PUBLIC" ) + else + Hud_SetText( communityPanel.VisibilityLabel, "#COMMUNITY_VISIBILITY_PRIVATE" ) + + if ( settings.membershipType == "invite" ) + Hud_SetText( communityPanel.MembershipTypeLabel, "#COMMUNITY_MEMBERSHIP_INVITEONLY" ) + else + Hud_SetText( communityPanel.MembershipTypeLabel, "#COMMUNITY_MEMBERSHIP_OPEN" ) + + // printt( "setting category to " + settings.category ) + if ( settings.category == "gaming" ) + Hud_SetText( communityPanel.CategoriesLabel, "#COMMUNITY_CATEGORY_GAMING" ) + else if ( settings.category == "lifestyle" ) + Hud_SetText( communityPanel.CategoriesLabel, "#COMMUNITY_CATEGORY_LIFESTYLE" ) + else if ( settings.category == "geography" ) + Hud_SetText( communityPanel.CategoriesLabel, "#COMMUNITY_CATEGORY_GEOGRAPHY" ) + else if ( settings.category == "tech" ) + Hud_SetText( communityPanel.CategoriesLabel, "#COMMUNITY_CATEGORY_TECH" ) + else if ( settings.category == "other" ) + Hud_SetText( communityPanel.CategoriesLabel, "#COMMUNITY_CATEGORY_OTHER" ) + + string happyHourString = "#COMMUNITY_HAPPYHOUR_" + settings.happyHourStart + Hud_SetText( communityPanel.HappyHourStartLabel, happyHourString ) + + /* + if ( !settings.communityId ) + { + Hud_Hide( communityPanel.JoinButton ) + Hud_Hide( communityPanel.LeaveButton ) + } + else if ( AreWeInCommunity( settings.communityId ) ) + { + Hud_Hide( communityPanel.JoinButton ) + Hud_Show( communityPanel.LeaveButton ) + Hud_Show( communityPanel.SetActiveButton ) + Hud_SetFocused( communityPanel.CloseButton ) + } + else + { + Hud_Show( communityPanel.JoinButton ) + Hud_Hide( communityPanel.LeaveButton ) + Hud_Hide( communityPanel.SetActiveButton ) + Hud_SetFocused( communityPanel.CloseButton ) + // Hud_SetFocused( communityPanel.JoinButton ) + } + */ +} + +bool function ListCommunitiesPanelHasFocus() +{ + return file.inCommunityPanel +} + +void function MyCommunities_OnGetFocus( var list ) +{ + printt( "MyCommunities_OnGetFocus" ) + if ( !file.inCommunityPanel ) + { + file.inCommunityPanel = true + // Hud_Show( file.switchCommunityPanelCover ) + foreach ( button in file.switchCommunityPanelButtons ) + { + Hud_Hide( button ) + } + foreach ( button in file.switchCommunityPanelHints ) + { + Hud_Show( button ) + } + } +} + +void function MyCommunities_OnLoseFocus( var list ) +{ + Signal( uiGlobal.signalDummy, "StopCommunityLookups" ) + printt( "MyCommunities_OnLoseFocus" ) + if ( file.inCommunityPanel ) + { + file.inCommunityPanel = false + // Hud_Hide( file.switchCommunityPanelCover ) + foreach ( button in file.switchCommunityPanelButtons ) + { + Hud_Show( button ) + } + foreach ( button in file.switchCommunityPanelHints ) + { + Hud_Hide( button ) + } + + Community_CommunityUpdated() + } +} + +void function MyCommunities_OnChange( var list ) +{ + string itemName = Hud_GetListPanelSelectedItem( file.switchCommunityPanel_ListWidget ) + Assert( IsValid( itemName ) ) + if ( itemName == "" ) + return + int communityId = int( itemName ) + printt( "Showing community info for communityId " + communityId ) + Signal( uiGlobal.signalDummy, "StopCommunityLookups" ) + thread GetCommunityInfoThread( communityId ) +} + +void function SetActiveCommunity_Thread( int communityId ) +{ + Signal( uiGlobal.signalDummy, "StopCommunityLookups" ) + EndSignal( uiGlobal.signalDummy, "StopCommunityLookups" ) + + DialogData dialogData + CommunitySettings ornull settings = GetCommunitySettings( communityId ) + + while ( settings == null ) + { + wait 0.05 + settings = GetCommunitySettings( communityId ) + } + + expect CommunitySettings( settings ) + + string name = settings.name + dialogData.header = Localize( "#REALLY_SET_ACTIVE_COMMUNITY", name ) + dialogData.message = "#REALLY_SET_ACTIVE_COMMUNITY_SUB" + + + AddDialogButton( dialogData, "#YES", MyCommunities_SetActive ) + AddDialogButton( dialogData, "#NO" ) + + dialogData.noChoiceWithNavigateBack = true + OpenDialog( dialogData ) +} + +void function MyCommunities_OnSelect( var list ) +{ + string itemName = Hud_GetListPanelSelectedItem( file.switchCommunityPanel_ListWidget ) + Assert( IsValid( itemName ) ) + if ( itemName == "" ) + return + int communityId = int( itemName ) + + thread SetActiveCommunity_Thread( communityId ) +} + +void function MyCommunities_SetActive() +{ + string itemName = Hud_GetListPanelSelectedItem( file.switchCommunityPanel_ListWidget ) + Assert( IsValid( itemName ) ) + if ( itemName == "" || itemName == "next" || itemName == "prev" ) + return + int communityId = int( itemName ) + printt( "they selected community" + communityId ) + SetActiveCommunity( communityId ) + // file.inCommunityPanel = false + Hud_SetFocused( file.selectNetWorkbutton ) + EmitUISound( "Menu.Accept" ) + Community_CommunityUpdated() +} + +bool function BrowseCommunities_ListWasFocused() +{ + if ( file.browseCommunitiesPanel_LastFocused != file.browseCommunitiesPanel_ListWidget ) + return false + + string itemName = Hud_GetListPanelSelectedItem( file.browseCommunitiesPanel_ListWidget ) + Assert( IsValid( itemName ) ) + if ( itemName == "" ) + return false + + return true +} + +bool function BrowseCommunities_ListNotFocused() +{ + return ( file.browseCommunitiesPanel_LastFocused != file.browseCommunitiesPanel_ListWidget ) +} + +void function BrowseCommunities_FilterGetFocus( var button ) +{ + file.browseCommunitiesPanel_LastFocused = button + + //file.browseCommunitiesPanel_ViewDetailsButton + + //Hud_Show( file.browseCommunitiesPanel_FilterBackground ) + RuiSetColorAlpha( Hud_GetRui( file.browseCommunitiesPanel_FilterBackground ), "backgroundColor", <0, 0, 0>, 0.65 ) + Hud_Show( file.browseCommunitiesPanel_ViewDetailsButton ) + + Hud_Hide( file.browseCommunitiesPanel_CommunityInfoPanel ) + foreach ( var hintElement in file.browseCommunitiesPanel_HintElements ) + { + Hud_Show( hintElement ) + } + + foreach ( var filterElement in file.browseCommunitiesPanel_FilterElements ) + { + //Hud_Show( filterElement ) + Hud_SetAlpha( filterElement, 255 ) + } +} + +void function BrowseCommunities_ListGetFocus( var list ) +{ + file.browseCommunitiesPanel_LastFocused = list + + //Hud_Hide( file.browseCommunitiesPanel_FilterBackground ) + RuiSetColorAlpha( Hud_GetRui( file.browseCommunitiesPanel_FilterBackground ), "backgroundColor", <0, 0, 0>, 0.25 ) + Hud_Hide( file.browseCommunitiesPanel_ViewDetailsButton ) + + Hud_Show( file.browseCommunitiesPanel_CommunityInfoPanel ) + foreach ( var hintElement in file.browseCommunitiesPanel_HintElements ) + { + Hud_Hide( hintElement ) + } + + foreach ( var filterElement in file.browseCommunitiesPanel_FilterElements ) + { + Hud_SetAlpha( filterElement, 32 ) + //Hud_Hide( filterElement ) + } +} + +void function BrowseCommunities_ListLoseFocus( var list ) +{ + RuiSetColorAlpha( Hud_GetRui( file.browseCommunitiesPanel_FilterBackground ), "backgroundColor", <0, 0, 0>, 0.65 ) + Hud_Show( file.browseCommunitiesPanel_ViewDetailsButton ) + + Hud_Hide( file.browseCommunitiesPanel_CommunityInfoPanel ) + foreach ( var hintElement in file.browseCommunitiesPanel_HintElements ) + { + Hud_Show( hintElement ) + } + + foreach ( var filterElement in file.browseCommunitiesPanel_FilterElements ) + { + //Hud_Show( filterElement ) + Hud_SetAlpha( filterElement, 255 ) + } +} + +void function BrowseCommunities_OnViewDetails( var list ) +{ + Hud_SetFocused( file.browseCommunitiesPanel_ListWidget ) +} + +void function BrowseCommunities_OnChange( var list ) +{ + string itemName = Hud_GetListPanelSelectedItem( file.browseCommunitiesPanel_ListWidget ) + Assert( IsValid( itemName ) ) + if ( itemName == "" ) + return + if ( itemName == "prev" ) + { + if ( !IsBrowserFetchingMoreData() ) + { + file.browseFilters.pageNum-- + printt( "asking for browse results, prev page " + file.browseFilters.pageNum ); + UpdateBrowseFilters( file.browseFilters ) + } + } + else if ( itemName == "next" ) + { + if ( !IsBrowserFetchingMoreData() ) + { + file.browseFilters.pageNum++ + printt( "asking for browse results, next page " + file.browseFilters.pageNum ); + UpdateBrowseFilters( file.browseFilters ) + } + } + else + { + if ( !IsBrowserFetchingMoreData() ) + { + int communityId = int( itemName ) + printt( "Showing community info for communityId " + communityId + " (item " + itemName + " in list)" ) + Signal( uiGlobal.signalDummy, "StopCommunityLookups" ) + thread GetCommunityInfoThread( communityId ) + } + } + UpdateFooterOptions() +} + +void function AskToJoinCommunity_Thread( int communityId ) +{ + Signal( uiGlobal.signalDummy, "StopCommunityLookups" ) + EndSignal( uiGlobal.signalDummy, "StopCommunityLookups" ) + + DialogData dialogData + CommunitySettings ornull settings = GetCommunitySettings( communityId ) + + while ( settings == null ) + { + wait 0.05 + settings = GetCommunitySettings( communityId ) + } + + expect CommunitySettings( settings ) + + string name = settings.name + dialogData.header = Localize( "#REALLY_JOIN_COMMUNITY", name ) + + if ( settings.membershipType == "invite" ) + dialogData.message = "#COMMUNITY_IS_INVITE_ONLY_WARNING" + + if ( settings.membershipType == "invite" ) + AddDialogButton( dialogData, "#YES_JOIN_COMMUNITY", BrowseCommunities_JoinCommunity ) + else + AddDialogButton( dialogData, "#YES", BrowseCommunities_JoinCommunity ) + + AddDialogButton( dialogData, "#NO" ) + + dialogData.noChoiceWithNavigateBack = true + OpenDialog( dialogData ) +} + +void function BrowseCommunities_OnSelect( var list ) +{ + printt( "they selected a community!" ) + + string itemName = Hud_GetListPanelSelectedItem( file.browseCommunitiesPanel_ListWidget ) + Assert( IsValid( itemName ) ) + if ( itemName == "" ) + return + int communityId = int( itemName ) + + thread AskToJoinCommunity_Thread( communityId ) +} + +void function BrowseCommunities_JoinCommunity() +{ + string itemName = Hud_GetListPanelSelectedItem( file.browseCommunitiesPanel_ListWidget ) + Assert( IsValid( itemName ) ) + if ( itemName == "" ) + return + int communityId = int( itemName ) + if ( AreWeInCommunity( communityId ) ) + { + SetActiveCommunity( communityId ) + CloseActiveMenu() + return + } + + thread JoinCommunityThread( communityId ) +} + +void function JoinCommunityThread( int communityId ) +{ + Signal( uiGlobal.signalDummy, "StopJoinCommunity" ) + EndSignal( uiGlobal.signalDummy, "StopJoinCommunity" ) + + printt( "they want to join community" + communityId ) + JoinCommunity( communityId ) + + CommunitySettings ornull settings = GetCommunitySettings( communityId ) + while ( settings == null ) + { + wait 0.05 + settings = GetCommunitySettings( communityId ) + } + + expect CommunitySettings( settings ) + + if ( settings.membershipType != "invite" ) + return + + DialogData dialogData + dialogData.header = Localize( "#COMMUNITY_JOIN_REQUEST_SENT" ) + dialogData.message = "#COMMUNITY_JOIN_REQUEST_SENT_DESC" + //AddDialogButton( dialogData, "#OK", CloseActiveMenu() ) + AddDialogButton( dialogData, "#OK" ) + + dialogData.noChoiceWithNavigateBack = true + OpenDialog( dialogData ) +} + +void function BrowseCommunities_ReportAbuse_Final() +{ + if ( file.reportedCommunityIds.len() > 100 ) + return + + foreach ( communityId in file.reportedCommunityIds ) + { + if ( communityId == file.reportAbuseCommunityId ) + return + } + file.reportedCommunityIds.append( file.reportAbuseCommunityId ) + ReportCommunity( file.reportAbuseCommunityId, 0 ) +} + +void function ReportAbuse_Thread( int communityId ) +{ + Signal( uiGlobal.signalDummy, "StopAbuseReports" ) + EndSignal( uiGlobal.signalDummy, "StopAbuseReports" ) + + DialogData dialogData + CommunitySettings ornull settings = GetCommunitySettings( communityId ) + while ( settings == null ) + { + wait 0.05 + settings = GetCommunitySettings( communityId ) + } + + expect CommunitySettings( settings ) + + file.reportAbuseCommunityId = communityId + + string name = settings.name + dialogData.header = Localize( "#REALLY_REPORT_ABUSE_HEADER", name ) + dialogData.message = Localize( "#REALLY_REPORT_ABUSE", name ) + + AddDialogButton( dialogData, "#YES", BrowseCommunities_ReportAbuse_Final ) + AddDialogButton( dialogData, "#NO" ) + + dialogData.noChoiceWithNavigateBack = true + OpenDialog( dialogData ) +} + +void function ReportAbuse_OnClick( var button ) +{ + EmitUISound( "Menu.Accept" ) + + string itemName = Hud_GetListPanelSelectedItem( file.browseCommunitiesPanel_ListWidget ) + Assert( IsValid( itemName ) ) + if ( itemName == "" ) + return + int communityId = int( itemName ) + thread ReportAbuse_Thread( communityId ) +} + +bool function CanReportAbuse() +{ + string itemName = Hud_GetListPanelSelectedItem( file.browseCommunitiesPanel_ListWidget ) + Assert( IsValid( itemName ) ) + if ( itemName == "" ) + return false + int selectedCommunityId = int( itemName ) + // if ( AreWeInCommunity( selectedCommunityId ) ) + // return false + + if ( file.reportedCommunityIds.len() > 100 ) + return false + + foreach ( communityId in file.reportedCommunityIds ) + { + if ( communityId == selectedCommunityId ) + return false + } + + return true +} + +void function JoinNetwork_OnClick( var button ) +{ + EmitUISound( "Menu.Accept" ) + + //string itemName = Hud_GetListPanelSelectedItem( file.browseCommunitiesPanel_ListWidget ) + //Assert( IsValid( itemName ) ) + //if ( itemName == "" ) + // return + //int communityId = int( itemName ) + //thread ReportAbuse_Thread( communityId ) +} + + +bool function CanJoinNetwork() +{ + // JFS: this seems bad, but the footer function gets called before we are even in the menu + if ( uiGlobal.activeMenu != file.browseCommunitiesMenu ) + return false + + if ( BrowseCommunities_ListNotFocused() ) + return false + + string itemName = Hud_GetListPanelSelectedItem( file.browseCommunitiesPanel_ListWidget ) + Assert( IsValid( itemName ) ) + if ( itemName == "" ) + return false + int selectedCommunityId = int( itemName ) + + if ( AreWeInCommunity( selectedCommunityId ) ) + return false + + return true +} + +void function FindCommunityInfoWidgetsInPanel( CommunityPanel infostruct, var panel ) +{ + if ( Hud_HasChild( panel, "CommunityName" ) ) + infostruct.Name = Hud_GetChild( panel, "CommunityName" ) + + if ( Hud_HasChild( panel, "CommunityNameRui" ) ) + infostruct.CommunityNameRui = Hud_GetChild( panel, "CommunityNameRui" ) + + infostruct.Creator = Hud_GetChild( panel, "CreatorName" ) + infostruct.Members = Hud_GetChild( panel, "ActiveMembers" ) + infostruct.MOTD = Hud_GetChild( panel, "MOTD" ) + infostruct.Kills = Hud_GetChild( panel, "Kills" ) + infostruct.Wins = Hud_GetChild( panel, "Wins" ) + infostruct.Losses = Hud_GetChild( panel, "Losses" ) + infostruct.Deaths = Hud_GetChild( panel, "Deaths" ) + infostruct.XP = Hud_GetChild( panel, "XP" ) + infostruct.CategoriesLabel = Hud_GetChild( panel, "Category" ) + infostruct.LanguagesLabel = Hud_GetChild( panel, "Languages" ) + infostruct.RegionsLabel = Hud_GetChild( panel, "Regions" ) + infostruct.CommunityTypeLabel = Hud_GetChild( panel, "CommunityType" ) + infostruct.MembershipTypeLabel = Hud_GetChild( panel, "MembershipPolicy" ) + infostruct.VisibilityLabel = Hud_GetChild( panel, "Visibility" ) + infostruct.MicPolicyLabel = Hud_GetChild( panel, "MicPolicy" ) + infostruct.HappyHourStartLabel = Hud_GetChild( panel, "HappyHourStart" ) +} + +void function InitCommunitiesMenu() +{ + RegisterSignal( "StopCommunityLookups" ) + RegisterSignal( "StopUserJoinRequestLookups" ) + RegisterSignal( "StopAbuseReports" ) + RegisterSignal( "StopJoinCommunity" ) + + PrecacheHUDMaterial( $"ui/menu/main_menu/currently_selected" ) + PrecacheHUDMaterial( $"ui/menu/main_menu/verified_community" ) + + var menu = GetMenu( "CommunitiesMenu" ) + file.menu = menu + + Chatroom_GlobalInit() + InitChatroom( menu ) + + InitCommunityKeys() + + /* + file.chatroomMenu = Hud_GetChild( menu, "Chatroom" ) // GetMenu( "ChatRoom" ) + file.chatroomMenu_chatroomWidget = Hud_GetChild( file.chatroomMenu, "ChatRoom" ) + */ + + file.adminViewPendingRequests = GetMenu( "CommunityAdminInviteRequestMenu" ) + + file.totalJoinRequests = 0 + file.pendingJoinRequestPanel.Panel = Hud_GetChild( file.adminViewPendingRequests, "JoinRequestPanel" ) + file.pendingJoinRequestPanel.Name = Hud_GetChild( file.pendingJoinRequestPanel.Panel, "Requester" ) + file.pendingJoinRequestPanel.Kills = Hud_GetChild( file.pendingJoinRequestPanel.Panel, "Kills" ) + file.pendingJoinRequestPanel.Wins = Hud_GetChild( file.pendingJoinRequestPanel.Panel, "Wins" ) + file.pendingJoinRequestPanel.Losses = Hud_GetChild( file.pendingJoinRequestPanel.Panel, "Losses" ) + file.pendingJoinRequestPanel.Deaths = Hud_GetChild( file.pendingJoinRequestPanel.Panel, "Deaths" ) + file.pendingJoinRequestPanel.XP = Hud_GetChild( file.pendingJoinRequestPanel.Panel, "XP" ) + file.pendingJoinRequestPanel.callsignCard = Hud_GetChild( file.pendingJoinRequestPanel.Panel, "CallsignCard" ) + file.pendingJoinRequest_AcceptButton = Hud_GetChild( file.pendingJoinRequestPanel.Panel, "AcceptRequestButton" ) + file.pendingJoinRequest_CommunityName = Hud_GetChild( file.pendingJoinRequestPanel.Panel, "CommunityName" ) + //file.pendingJoinRequestPanel.ViewUserCardButton = Hud_GetChild( file.pendingJoinRequestPanel.Panel, "ViewUserCard" ) + + for ( int i = 0; ; i++ ) + { + if ( !Hud_HasChild( file.pendingJoinRequestPanel.Panel, "Community" + i + "Label" ) ) + break; + var communityLabel = Hud_GetChild( file.pendingJoinRequestPanel.Panel, "Community" + i + "Label" ) + var communityName = Hud_GetChild( file.pendingJoinRequestPanel.Panel, "Community" + i ) + Assert( communityName, "found Community" + i + "Label, but no Community" + i + " in pendingJoinRequestPanel panel" ); + file.pendingJoinRequestPanel.communityLabels.append( communityLabel ) + file.pendingJoinRequestPanel.communityNames.append( communityName ) + } + + AddEventHandlerToButton( file.pendingJoinRequestPanel.Panel, "AcceptRequestButton", UIE_CLICK, JoinRequest_Accept ) + AddEventHandlerToButton( file.pendingJoinRequestPanel.Panel, "DenyRequestButton", UIE_CLICK, JoinRequest_Deny ) + AddMenuFooterOption( file.adminViewPendingRequests, BUTTON_A, "#A_BUTTON_SELECT" ) + AddMenuFooterOption( file.adminViewPendingRequests, BUTTON_B, "#B_BUTTON_BACK", "#BACK" ) + + // BrowseFilters filters + // file.browseFilters = filters + file.browseFilters.name = "" + file.browseFilters.clantag = "" + file.browseFilters.communityType = "social" + file.browseFilters.membershipType = "open" + file.browseFilters.category = "" + file.browseFilters.playtime = "" + file.browseFilters.micPolicy = "" + file.browseFilters.pageNum = 0 + file.browseFilters.minMembers = 1 + + file.haveSettings = false + file.firstCommunityUpdateHappened = false + + // file.editButton = Hud_GetChild( menu, "BtnEdit" ) + file.sendMessageButton = Hud_GetChild( menu, "BtnSendMessage" ) + // file.adminViewPendingRequestsButton = Hud_GetChild( menu, "BtnPendingRequests" ) + + file.browseCommunitiesMenu = GetMenu( "BrowseCommunities" ) + + file.browseCommunitiesPanel = Hud_GetChild( file.browseCommunitiesMenu, "BrowseCommunitiesPanel" ) + file.browseCommunitiesPanel_FilterBackground = Hud_GetChild( file.browseCommunitiesPanel, "ListCommunitiesBackground" ) + file.browseCommunitiesPanel_ListWidget = Hud_GetChild( file.browseCommunitiesPanel, "ListCommunities" ) + file.browseCommunitiesPanel_NameWidget = Hud_GetChild( file.browseCommunitiesPanel, "CommunityFilterName" ) + file.browseCommunitiesPanel_ClantagWidget = Hud_GetChild( file.browseCommunitiesPanel, "CommunityFilterClantag" ) + file.browseCommunitiesPanel_TypeButton = Hud_GetChild( file.browseCommunitiesPanel, "CommunityFilterType" ) + file.browseCommunitiesPanel_MembershipButton = Hud_GetChild( file.browseCommunitiesPanel, "CommunityFilterMembership" ) + file.browseCommunitiesPanel_CategoryButton = Hud_GetChild( file.browseCommunitiesPanel, "CommunityFilterCategory" ) + file.browseCommunitiesPanel_PlaytimeButton = Hud_GetChild( file.browseCommunitiesPanel, "CommunityFilterPlaytime" ) + file.browseCommunitiesPanel_MicPolicyButton = Hud_GetChild( file.browseCommunitiesPanel, "CommunityMicFilterPolicy" ) + file.browseCommunitiesPanel_MinMembersButton = Hud_GetChild( file.browseCommunitiesPanel, "MemberCountFilter" ) + file.browseCommunitiesPanel_ViewDetailsButton = Hud_GetChild( file.browseCommunitiesPanel, "ViewDetails" ) + + Hud_SetText( Hud_GetChild( file.browseCommunitiesPanel, "MyRegion" ), Localize( "#MY_REGION_N", MyRegion() ) ) + + file.browseCommunitiesPanel_FilterElements.append( file.browseCommunitiesPanel_NameWidget ) + file.browseCommunitiesPanel_FilterElements.append( file.browseCommunitiesPanel_ClantagWidget ) + file.browseCommunitiesPanel_FilterElements.append( file.browseCommunitiesPanel_TypeButton ) + file.browseCommunitiesPanel_FilterElements.append( file.browseCommunitiesPanel_MembershipButton ) + file.browseCommunitiesPanel_FilterElements.append( file.browseCommunitiesPanel_CategoryButton ) + file.browseCommunitiesPanel_FilterElements.append( file.browseCommunitiesPanel_MinMembersButton ) + file.browseCommunitiesPanel_FilterElements.append( file.browseCommunitiesPanel_PlaytimeButton ) + file.browseCommunitiesPanel_FilterElements.append( file.browseCommunitiesPanel_MicPolicyButton ) + file.browseCommunitiesPanel_FilterElements.append( file.browseCommunitiesPanel_ViewDetailsButton ) + + file.browseCommunitiesPanel_FilterElements.append( Hud_GetChild( file.browseCommunitiesPanel, "NameFilterLabel" ) ) + file.browseCommunitiesPanel_FilterElements.append( Hud_GetChild( file.browseCommunitiesPanel, "ClantagFilterLabel" ) ) + file.browseCommunitiesPanel_FilterElements.append( Hud_GetChild( file.browseCommunitiesPanel, "TypeFilterLabel" ) ) + file.browseCommunitiesPanel_FilterElements.append( Hud_GetChild( file.browseCommunitiesPanel, "CategoryFilterLabel" ) ) + file.browseCommunitiesPanel_FilterElements.append( Hud_GetChild( file.browseCommunitiesPanel, "PlaytimeFilterLabel" ) ) + file.browseCommunitiesPanel_FilterElements.append( Hud_GetChild( file.browseCommunitiesPanel, "MemberCountFilterLabel" ) ) + file.browseCommunitiesPanel_FilterElements.append( Hud_GetChild( file.browseCommunitiesPanel, "MembershipFilterLabel" ) ) + file.browseCommunitiesPanel_FilterElements.append( Hud_GetChild( file.browseCommunitiesPanel, "MicPolicyFilterLabel" ) ) + + file.browseCommunitiesPanel_HintElements.append( Hud_GetChild( file.browseCommunitiesPanel, "HintBackground" ) ) + file.browseCommunitiesPanel_HintElements.append( Hud_GetChild( file.browseCommunitiesPanel, "HintIcon" ) ) + file.browseCommunitiesPanel_HintElements.append( Hud_GetChild( file.browseCommunitiesPanel, "HintLabel" ) ) + file.browseCommunitiesPanel_HintElements.append( Hud_GetChild( file.browseCommunitiesPanel, "HintCopy" ) ) + + file.browseCommunitiesPanel_CommunityInfoPanel = Hud_GetChild( file.browseCommunitiesPanel, "CommunityInfo" ) + + var elem = Hud_GetChild( file.browseCommunitiesPanel_CommunityInfoPanel, "MOTDIcon" ) + var rui = Hud_GetRui( elem ) + RuiSetImage( rui, "basicImage", $"rui/menu/common/inbox_icon" ) + + elem = Hud_GetChild( file.browseCommunitiesPanel_CommunityInfoPanel, "XPIcon" ) + rui = Hud_GetRui( elem ) + RuiSetImage( rui, "basicImage", $"rui/merits/credit_sign_small" ) + + elem = Hud_GetChild( file.browseCommunitiesPanel, "HintIcon" ) + rui = Hud_GetRui( elem ) + RuiSetImage( rui, "basicImage", $"rui/menu/common/bulb_hint_icon" ) + + AddEventHandlerToButton( file.browseCommunitiesPanel, "ListCommunities", UIE_CLICK, BrowseCommunities_OnSelect ) + AddEventHandlerToButton( file.browseCommunitiesPanel, "ListCommunities", UIE_CHANGE, BrowseCommunities_OnChange ) + + AddEventHandlerToButton( file.browseCommunitiesPanel, "ListCommunities", UIE_GET_FOCUS, BrowseCommunities_ListGetFocus ) + AddEventHandlerToButton( file.browseCommunitiesPanel, "ListCommunities", UIE_LOSE_FOCUS, BrowseCommunities_ListLoseFocus ) + + AddEventHandlerToButton( file.browseCommunitiesPanel, "CommunityFilterName", UIE_GET_FOCUS, BrowseCommunities_FilterGetFocus ) + AddEventHandlerToButton( file.browseCommunitiesPanel, "CommunityFilterClantag", UIE_GET_FOCUS, BrowseCommunities_FilterGetFocus ) + AddEventHandlerToButton( file.browseCommunitiesPanel, "CommunityFilterType", UIE_GET_FOCUS, BrowseCommunities_FilterGetFocus ) + AddEventHandlerToButton( file.browseCommunitiesPanel, "CommunityFilterMembership", UIE_GET_FOCUS, BrowseCommunities_FilterGetFocus ) + AddEventHandlerToButton( file.browseCommunitiesPanel, "CommunityFilterCategory", UIE_GET_FOCUS, BrowseCommunities_FilterGetFocus ) + AddEventHandlerToButton( file.browseCommunitiesPanel, "CommunityFilterPlaytime", UIE_GET_FOCUS, BrowseCommunities_FilterGetFocus ) + AddEventHandlerToButton( file.browseCommunitiesPanel, "CommunityMicFilterPolicy", UIE_GET_FOCUS, BrowseCommunities_FilterGetFocus ) + AddEventHandlerToButton( file.browseCommunitiesPanel, "MemberCountFilter", UIE_GET_FOCUS, BrowseCommunities_FilterGetFocus ) + // AddEventHandlerToButton( file.browseCommunitiesPanel, "ViewDetails", UIE_GET_FOCUS, BrowseCommunities_FilterGetFocus ) + + AddEventHandlerToButton( file.browseCommunitiesPanel, "ViewDetails", UIE_CLICK, BrowseCommunities_OnViewDetails ) + + + AddMenuEventHandler( file.browseCommunitiesMenu, eUIEvent.MENU_OPEN, OnBrowseNetworksMenu_Open ) + AddMenuEventHandler( file.browseCommunitiesMenu, eUIEvent.MENU_NAVIGATE_BACK, OnBrowseMentworksMenu_NavigateBack ) + + AddMenuFooterOption( file.browseCommunitiesMenu, BUTTON_B, "#B_BUTTON_BACK", "#BACK" ) + AddMenuFooterOption( file.browseCommunitiesMenu, BUTTON_A, "#COMMUNITY_JOINCOMMUNITY_ABUTTON", "#COMMUNITY_JOINCOMMUNITY", null, CanJoinNetwork ) + AddMenuFooterOption( file.browseCommunitiesMenu, BUTTON_X, "#COMMUNITY_REPORTABUSE_XBUTTON", "#COMMUNITY_REPORTABUSE", ReportAbuse_OnClick, CanReportAbuse ) + + AddEventHandlerToButton( file.browseCommunitiesPanel, "CommunityFilterType", UIE_CLICK, Browse_ChangeCommunityType_Activate ) + AddEventHandlerToButton( file.browseCommunitiesPanel, "CommunityFilterMembership", UIE_CLICK, Browse_ChangeCommunityMembership_Activate ) + AddEventHandlerToButton( file.browseCommunitiesPanel, "CommunityFilterCategory", UIE_CLICK, Browse_ChangeCommunityCategory_Activate ) + AddEventHandlerToButton( file.browseCommunitiesPanel, "CommunityFilterPlaytime", UIE_CLICK, Browse_ChangeCommunityPlaytime_Activate ) + AddEventHandlerToButton( file.browseCommunitiesPanel, "CommunityMicFilterPolicy", UIE_CLICK, Browse_ChangeCommunityMicPolicy_Activate ) + AddEventHandlerToButton( file.browseCommunitiesPanel, "MemberCountFilter", UIE_CLICK, Browse_ChangeCommunityMinMembers_Activate ) + AddEventHandlerToButton( file.browseCommunitiesPanel, "CommunityFilterName", UIE_CHANGE, Browse_CommunityNameChanged ) + AddEventHandlerToButton( file.browseCommunitiesPanel, "CommunityFilterClantag", UIE_CHANGE, Browse_CommunityClantagChanged ) + + file.editCommunityMenu = GetMenu( "CommunityEditMenu" ) + var editCommunityPanel = Hud_GetChild( file.editCommunityMenu, "editCommunityPanel" ) + file.editCommunityPanel_LanguagesButton = Hud_GetChild( editCommunityPanel, "Languages" ) + file.editCommunityPanel_SaveButton = Hud_GetChild( editCommunityPanel, "Save" ) + file.editCommunityPanel_CreateButton = Hud_GetChild( editCommunityPanel, "Create" ) + file.editCommunityLanguagesPanel = Hud_GetChild( file.editCommunityMenu, "EditCommunityLanguagesPanel" ) + file.editCommunityRegionsPanel = Hud_GetChild( file.editCommunityMenu, "EditCommunityRegionsPanel" ) + file.editCommunityCategoriesPanel = Hud_GetChild( file.editCommunityMenu, "EditCommunityCategoriesPanel" ) + file.editCommunityHappyHourPanel = Hud_GetChild( file.editCommunityMenu, "EditCommunityHappyHourPanel" ) + + Hud_AddEventHandler( Hud_GetChild( editCommunityPanel, "HappyHourLeftHidden" ), UIE_GET_FOCUS, OnHappyHourPrev ) + Hud_AddEventHandler( Hud_GetChild( editCommunityPanel, "HappyHourRightHidden" ), UIE_GET_FOCUS, OnHappyHourNext ) + Hud_AddEventHandler( Hud_GetChild( editCommunityPanel, "HappyHourLeft" ), UIE_CLICK, OnHappyHourPrev ) + Hud_AddEventHandler( Hud_GetChild( editCommunityPanel, "HappyHourRight" ), UIE_CLICK, OnHappyHourNext ) + + file.editCommunityPanel_PopupBackground = Hud_GetChild( file.editCommunityMenu, "PanelBackground" ) + Hud_AddEventHandler( file.editCommunityPanel_PopupBackground, UIE_CLICK, PopupBackground_Activate ) + + file.editCommunityPanel_Header = Hud_GetChild( file.editCommunityMenu, "MenuTitle" ) + file.editCommunityPanel_NameLabel = Hud_GetChild( editCommunityPanel, "CommunityNameLabel" ) + file.editCommunityPanel_NameBigLabel = Hud_GetChild( editCommunityPanel, "CommunityNameBigLabel" ) + file.editCommunityPanel_Name = Hud_GetChild( editCommunityPanel, "CommunityNameEditBox" ) + file.editCommunityPanel_Clantag = Hud_GetChild( editCommunityPanel, "ClantagEditBox" ) + file.editCommunityPanel_MOTD = Hud_GetChild( editCommunityPanel, "MOTDEditBox" ) + file.editCommunityPanel_CategoriesButton = Hud_GetChild( editCommunityPanel, "Category" ) + file.editCommunityPanel_RegionsButton = Hud_GetChild( editCommunityPanel, "Regions" ) + file.editCommunityPanel_CommunityTypeButton = Hud_GetChild( editCommunityPanel, "CommunityType" ) + file.editCommunityPanel_MembershipTypeButton = Hud_GetChild( editCommunityPanel, "MembershipPolicy" ) + file.editCommunityPanel_VisibilityButton = Hud_GetChild( editCommunityPanel, "Visibility" ) + file.editCommunityPanel_MicPolicyButton = Hud_GetChild( editCommunityPanel, "MicPolicy" ) + file.editCommunityPanel_HappyHourStartButton = Hud_GetChild( editCommunityPanel, "HappyHourStart" ) + + AddMenuEventHandler( file.editCommunityMenu, eUIEvent.MENU_NAVIGATE_BACK, OnEditCommunityMenu_Close ) + AddMenuFooterOption( file.editCommunityMenu, BUTTON_B, "#B_BUTTON_BACK", "#BACK" ) + + file.editCommunityLanguagesPanel_LanguageButtons = SetupComboSelectButtons( file.editCommunityLanguagesPanel, file.languages, OnLanguageSelectButtonClick, true ) + file.editCommunityRegionsPanel_RegionButtons = SetupComboSelectButtons( file.editCommunityRegionsPanel, file.regions, OnComboSelectButtonClick, true ) + file.editCommunityCategoriesPanel_CategoryButtons = SetupComboSelectButtons( file.editCommunityCategoriesPanel, file.categories, OnSaveCategoriesButton_Activate, false ) + + for ( int i = 0; i < 24; i++ ) + file.editCommunityHappyHourPanel_HappyHourButtons.append( Hud_GetChild( file.editCommunityHappyHourPanel, "time" + i ) ) + + file.sendCommunityMsgMenu = GetMenu( "CommunityAdminSendMessage" ) + var sendCommunityMsgPanel = Hud_GetChild( file.sendCommunityMsgMenu, "SendCommunityMessagePanel" ) + file.sendCommunityMsg_expiration = 24 // default to 24 hours + file.sendCommunityMsgPanel_ExpirationButton = Hud_GetChild( sendCommunityMsgPanel, "Expiration" ) + file.sendCommunityMsgPanel_CommunityName = Hud_GetChild( sendCommunityMsgPanel, "CommunityName" ) + file.sendCommunityMsgPanel_MsgText = Hud_GetChild( sendCommunityMsgPanel, "MessageEditBox" ) + file.sendCommunityMsgPanel_SendButton = Hud_GetChild( sendCommunityMsgPanel, "Send" ) + AddMenuEventHandler( file.sendCommunityMsgMenu, eUIEvent.MENU_OPEN, OnCommunitySendMsg_Open ) + AddMenuEventHandler( file.sendCommunityMsgMenu, eUIEvent.MENU_NAVIGATE_BACK, OCommunitySendMsg_NavigateBack ) + AddMenuFooterOption( file.sendCommunityMsgMenu, BUTTON_A, "#A_BUTTON_SELECT" ) + AddMenuFooterOption( file.sendCommunityMsgMenu, BUTTON_B, "#B_BUTTON_BACK", "#BACK" ) + + + elem = Hud_GetChild( sendCommunityMsgPanel, "MailIcon" ) + rui = Hud_GetRui( elem ) + RuiSetImage( rui, "basicImage", $"rui/menu/common/inbox_icon_new" ) + + FindCommunityInfoWidgetsInPanel( file.communityInfoPanelWidgets, file.browseCommunitiesPanel_CommunityInfoPanel ) + + AddMenuEventHandler( menu, eUIEvent.MENU_OPEN, OnCommunityMenu_Open ) + AddMenuEventHandler( menu, eUIEvent.MENU_CLOSE, OnCommunityMenu_Close ) + + AddEventHandlerToButton( menu, "BtnBrowse", UIE_CLICK, OnBrowseNetworksButton_Activate ) + + var button = Hud_GetChild( menu, "BtnBrowse" ) + SetButtonRuiText( button, "#COMMUNITY_BROWSE_NETWORKS" ) + AddButtonEventHandler( button, UIE_CLICK, OnBrowseNetworksButton_Activate ) + + button = Hud_GetChild( menu, "BtnCreate" ) + SetButtonRuiText( button, "#COMMUNITY_CREATECOMMUNITY" ) + AddButtonEventHandler( button, UIE_CLICK, OnCreateCommunityButton_Activate ) + + button = Hud_GetChild( menu, "BtnEdit" ) + SetButtonRuiText( button, "#COMMUNITY_EDITCOMMUNITY" ) + AddButtonEventHandler( button, UIE_CLICK, OnEditCommunityButton_Activate ) + + button = Hud_GetChild( menu, "BtnSendMessage" ) + SetButtonRuiText( button, "#COMMUNITY_SENDMESSAGE" ) + AddButtonEventHandler( button, UIE_CLICK, OnStartSendCommunityMessageButton_Activate ) + + button = Hud_GetChild( menu, "BtnPendingRequests" ) + SetButtonRuiText( button, "#COMMUNITY_NOPENDINGREQUESTSTOJOIN" ) + AddButtonEventHandler( button, UIE_CLICK, OnViewPendingRequestButton_Activate ) + + AddEventHandlerToButton( sendCommunityMsgPanel, "Send", UIE_CLICK, OnActualSendCommunityMessageButton_Activate ) + AddEventHandlerToButton( sendCommunityMsgPanel, "Expiration", UIE_CLICK, OnChangeCommunityMessageExpirationButton_Activate ) + + AddEventHandlerToButton( editCommunityPanel, "CommunityType", UIE_CLICK, OnCommunityTypeButton_Activate ) + AddEventHandlerToButton( editCommunityPanel, "Languages", UIE_CLICK, OnLanguagesButton_Activate ) + AddEventHandlerToButton( editCommunityPanel, "Regions", UIE_CLICK, OnRegionsButton_Activate ) + AddEventHandlerToButton( editCommunityPanel, "Category", UIE_CLICK, OnCategoriesButton_Activate ) + AddEventHandlerToButton( editCommunityPanel, "MembershipPolicy", UIE_CLICK, OnMembershipTypeButton_Activate ) + AddEventHandlerToButton( editCommunityPanel, "Visibility", UIE_CLICK, OnVisibilityButton_Activate ) + AddEventHandlerToButton( editCommunityPanel, "MicPolicy", UIE_CLICK, OnMicPolicyButton_Activate ) + AddEventHandlerToButton( editCommunityPanel, "HappyHourStart", UIE_CLICK, OnHappyHourButton_Activate ) + AddEventHandlerToButton( editCommunityPanel, "Create", UIE_CLICK, OnSaveCommunityButton_Activate ) + AddEventHandlerToButton( editCommunityPanel, "Save", UIE_CLICK, OnSaveCommunityButton_Activate ) + AddEventHandlerToButton( file.editCommunityLanguagesPanel, "Save", UIE_CLICK, OnSaveLanguagesButton_Activate ) + AddEventHandlerToButton( file.editCommunityRegionsPanel, "Save", UIE_CLICK, OnSaveRegionsButton_Activate ) + + AddEventHandlerToButton( file.editCommunityHappyHourPanel, "time0", UIE_CLICK, OnHappyHour0Button_Activate ) + AddEventHandlerToButton( file.editCommunityHappyHourPanel, "time1", UIE_CLICK, OnHappyHour1Button_Activate ) + AddEventHandlerToButton( file.editCommunityHappyHourPanel, "time2", UIE_CLICK, OnHappyHour2Button_Activate ) + AddEventHandlerToButton( file.editCommunityHappyHourPanel, "time3", UIE_CLICK, OnHappyHour3Button_Activate ) + AddEventHandlerToButton( file.editCommunityHappyHourPanel, "time4", UIE_CLICK, OnHappyHour4Button_Activate ) + AddEventHandlerToButton( file.editCommunityHappyHourPanel, "time5", UIE_CLICK, OnHappyHour5Button_Activate ) + AddEventHandlerToButton( file.editCommunityHappyHourPanel, "time6", UIE_CLICK, OnHappyHour6Button_Activate ) + AddEventHandlerToButton( file.editCommunityHappyHourPanel, "time7", UIE_CLICK, OnHappyHour7Button_Activate ) + AddEventHandlerToButton( file.editCommunityHappyHourPanel, "time8", UIE_CLICK, OnHappyHour8Button_Activate ) + AddEventHandlerToButton( file.editCommunityHappyHourPanel, "time9", UIE_CLICK, OnHappyHour9Button_Activate ) + AddEventHandlerToButton( file.editCommunityHappyHourPanel, "time10", UIE_CLICK, OnHappyHour10Button_Activate ) + AddEventHandlerToButton( file.editCommunityHappyHourPanel, "time11", UIE_CLICK, OnHappyHour11Button_Activate ) + AddEventHandlerToButton( file.editCommunityHappyHourPanel, "time12", UIE_CLICK, OnHappyHour12Button_Activate ) + AddEventHandlerToButton( file.editCommunityHappyHourPanel, "time13", UIE_CLICK, OnHappyHour13Button_Activate ) + AddEventHandlerToButton( file.editCommunityHappyHourPanel, "time14", UIE_CLICK, OnHappyHour14Button_Activate ) + AddEventHandlerToButton( file.editCommunityHappyHourPanel, "time15", UIE_CLICK, OnHappyHour15Button_Activate ) + AddEventHandlerToButton( file.editCommunityHappyHourPanel, "time16", UIE_CLICK, OnHappyHour16Button_Activate ) + AddEventHandlerToButton( file.editCommunityHappyHourPanel, "time17", UIE_CLICK, OnHappyHour17Button_Activate ) + AddEventHandlerToButton( file.editCommunityHappyHourPanel, "time18", UIE_CLICK, OnHappyHour18Button_Activate ) + AddEventHandlerToButton( file.editCommunityHappyHourPanel, "time19", UIE_CLICK, OnHappyHour19Button_Activate ) + AddEventHandlerToButton( file.editCommunityHappyHourPanel, "time20", UIE_CLICK, OnHappyHour20Button_Activate ) + AddEventHandlerToButton( file.editCommunityHappyHourPanel, "time21", UIE_CLICK, OnHappyHour21Button_Activate ) + AddEventHandlerToButton( file.editCommunityHappyHourPanel, "time22", UIE_CLICK, OnHappyHour22Button_Activate ) + AddEventHandlerToButton( file.editCommunityHappyHourPanel, "time23", UIE_CLICK, OnHappyHour23Button_Activate ) + + AddMenuFooterOption( menu, BUTTON_A, "#A_BUTTON_SELECT" ) + AddMenuFooterOption( menu, BUTTON_B, "#B_BUTTON_BACK", "#BACK" ) + AddMenuFooterOption( menu, BUTTON_TRIGGER_RIGHT, "#R_TRIGGER_CHAT", "", null, IsVoiceChatPushToTalk ) +} + +void function InitCommunityKeys() +{ + var dataTable = GetDataTable( $"datatable/community_entries.rpak" ) + int numRows = GetDatatableRowCount( dataTable ) + file.keysToStrings[""] <- "" + for ( int i=0; i function SetupComboSelectButtons( var panel, array labelNames, void functionref(var) func, bool hasSaveButton ) +{ + int MAX_BUTTONS = 15 + array buttons = [] + var lastButton + int i + + int height = 0 + + var BG = Hud_GetChild( panel, "Background" ) + + for ( i=0; i allbuttons = clone buttons + if ( hasSaveButton ) + { + var saveButton = Hud_GetChild( panel, "Save" ) + var rui = Hud_GetRui( saveButton ) + RuiSetString( rui, "buttonText", "#SAVE" ) + Hud_Show( saveButton ) + Hud_SetPinSibling( saveButton, Hud_GetHudName( lastButton ) ) + allbuttons.append( saveButton ) + height += Hud_GetHeight( saveButton ) + height += Hud_GetY( saveButton ) + } + + SetNavUpDown( allbuttons ) + + Hud_SetHeight( BG, height ) + + return buttons +} + +string function ConvertKeyToLocalizedString( string key ) +{ + if ( !( key in file.keysToStrings ) ) + return "???" + + return file.keysToStrings[ key ] +} + +void function OnComboSelectButtonClick( var button ) +{ + if ( Hud_IsLocked( button ) ) + return + + Hud_SetSelected( button, !Hud_IsSelected( button ) ) + + UpdateComboSelectButtons( file.editCommunityRegionsPanel_RegionButtons, GetToggledRegion( 2 ) != "" ) +} + +void function OnLanguageSelectButtonClick( var button ) +{ + if ( Hud_IsLocked( button ) ) + return + + Hud_SetSelected( button, !Hud_IsSelected( button ) ) + + string language3 = GetToggledLanguage( 2 ) + + UpdateComboSelectButtons( file.editCommunityLanguagesPanel_LanguageButtons, GetToggledLanguage( 2 ) != "" ) +} + +void function UpdateComboSelectButtons( array< var > buttons, bool shouldLockButtons ) +{ + foreach( var button in buttons ) + { + if ( shouldLockButtons ) + Hud_SetLocked( button, !Hud_IsSelected( button ) ) + else + Hud_SetLocked( button, false ) + } +} + +void function OnCommunityMenu_Open() +{ + HideAllPanels() + FillInBrowseFilters( file.browseFilters ) + UI_SetPresentationType( ePresentationType.NO_MODELS ) +} + +void function OnEditCommunityMenu_Close() +{ + if ( file.inCommunityPanel ) + { + MyCommunities_OnLoseFocus( file.switchCommunityPanel_ListWidget ) + + if ( file.lastButtonFocused != null ) + Hud_SetFocused( file.lastButtonFocused ) + + foreach ( panel in file.temporaryPanels ) + { + Hud_Hide( panel ) + } + } + else + { + if ( file.communityEdited ) + { + DialogData dialogData + dialogData.header = "#COMMUNITY_ARE_YOU_SURE" + dialogData.message = "#COMMUNITY_CHANGES_WILL_BE_LOST" + + AddDialogButton( dialogData, "#YES", LeaveEditCommunity ) + AddDialogButton( dialogData, "#NO" ) + + dialogData.noChoiceWithNavigateBack = true + OpenDialog( dialogData ) + } + else + { + LeaveEditCommunity() + } + } +} + +void function LeaveEditCommunity() +{ + HideAllPanels() + CloseActiveMenu( true ) +} + +void function OnCommunityMenu_Close() +{ + Signal( uiGlobal.signalDummy, "StopCommunityLookups" ) + Signal( uiGlobal.signalDummy, "StopUserJoinRequestLookups" ) + HideAllPanels() +} + +void function InitMyNetworksMenu() +{ + var menu = GetMenu( "MyNetworks" ) + + var elem + var rui + + file.switchCommunityMenu = menu + + file.switchCommunityPanelCover = Hud_GetChild( menu, "ButtonCover" ) + file.switchCommunityPanel = Hud_GetChild( menu, "SwitchCommunityPanel" ) + file.switchCommunityPanel_ListWidget = Hud_GetChild( file.switchCommunityPanel, "ListCommunities" ) + file.switchCommunityPanel_CommunityInfoPanel = Hud_GetChild( file.switchCommunityPanel, "CommunityInfo" ) + + elem = Hud_GetChild( file.switchCommunityPanel_CommunityInfoPanel, "MOTDIcon" ) + rui = Hud_GetRui( elem ) + RuiSetImage( rui, "basicImage", $"rui/menu/common/inbox_icon" ) + + elem = Hud_GetChild( file.switchCommunityPanel_CommunityInfoPanel, "XPIcon" ) + rui = Hud_GetRui( elem ) + RuiSetImage( rui, "basicImage", $"rui/merits/credit_sign_small" ) + + elem = Hud_GetChild( file.switchCommunityMenu, "HintIcon" ) + rui = Hud_GetRui( elem ) + RuiSetImage( rui, "basicImage", $"rui/menu/common/bulb_hint_icon" ) + + file.switchCommunityPanelHints.append( elem ) + file.switchCommunityPanelHints.append( Hud_GetChild( file.switchCommunityMenu, "HintBackground" ) ) + file.switchCommunityPanelHints.append( Hud_GetChild( file.switchCommunityMenu, "HintLabel" ) ) + file.switchCommunityPanelHints.append( Hud_GetChild( file.switchCommunityMenu, "HintLabelPC" ) ) + + FindCommunityInfoWidgetsInPanel( file.myCommunityInfoPanelWidgets, file.switchCommunityPanel_CommunityInfoPanel ) + + AddMenuEventHandler( menu, eUIEvent.MENU_OPEN, OnMyNetworksMenu_Open ) + + SetupComboButtons( menu ) + + AddEventHandlerToButton( file.switchCommunityPanel, "ListCommunities", UIE_CLICK, MyCommunities_OnSelect ) + AddEventHandlerToButton( file.switchCommunityPanel, "ListCommunities", UIE_CHANGE, MyCommunities_OnChange ) + AddEventHandlerToButton( file.switchCommunityPanel, "ListCommunities", UIE_GET_FOCUS, MyCommunities_OnGetFocus ) + AddEventHandlerToButton( file.switchCommunityPanel, "ListCommunities", UIE_LOSE_FOCUS, MyCommunities_OnLoseFocus ) + + AddMenuEventHandler( menu, eUIEvent.MENU_NAVIGATE_BACK, OnNetworksMenu_NavigateBack ) + + AddMenuFooterOption( menu, BUTTON_B, "#B_BUTTON_BACK", "#BACK" ) + AddMenuFooterOption( menu, BUTTON_A, "#A_BUTTON_SELECT" ) + AddMenuFooterOption( menu, BUTTON_X, "#COMMUNITY_LEAVECOMMUNITY_XBUTTON", "", LeaveCommunityButton_Activate, ListCommunitiesPanelHasFocus ) +} + +void function OnMyNetworksMenu_Open() +{ + Signal( uiGlobal.signalDummy, "StopCommunityLookups" ) + int communityId = GetCurrentCommunityId() + if ( communityId >= 0 ) + thread GetCommunityInfoThread( communityId ) + + HideAllPanels() + UI_SetPresentationType( ePresentationType.NO_MODELS ) +} + +void function OnBrowseNetworksMenu_Open() +{ + Signal( uiGlobal.signalDummy, "StopCommunityLookups" ) + int communityId = GetCurrentCommunityId() + if ( communityId >= 0 ) + thread GetCommunityInfoThread( communityId ) + + HideAllPanels() + UI_SetPresentationType( ePresentationType.NO_MODELS ) + + Hud_SetText( Hud_GetChild( file.browseCommunitiesPanel, "MyRegion" ), Localize( "#MY_REGION_N", MyRegion() ) ) + + thread FooterOptionsUpdate( uiGlobal.activeMenu ) +} + +void function FooterOptionsUpdate( var menu ) +{ + EndSignal( uiGlobal.signalDummy, "CleanupInGameMenus" ) + + while ( GetTopNonDialogMenu() == menu ) + { + UpdateFooterOptions() + WaitFrame() + } +} + +void function ToggleChatroomVoiceMode0( var button ) +{ + ToggleChatroomVoiceMode( 0 ) +} + +void function ToggleChatroomVoiceMode1( var button ) +{ + ToggleChatroomVoiceMode( 1 ) +} + +void function ToggleChatroomVoiceMode( int voiceMode ) +{ + if ( voiceMode == 0 ) + ClientCommand( "chatroom_freetalk" ) + else + ClientCommand( "chatroom_adminsonly" ) + + UpdateChatroomToggleText( voiceMode ) +} + +void function SetupComboButtons( var menu ) +{ + ComboStruct comboStruct = ComboButtons_Create( menu ) + + int headerIndex = 0 + int buttonIndex = 0 + var activeNetworkHeader = AddComboButtonHeader( comboStruct, headerIndex, "#MENU_TITLE_ACTIVE_NETWORK" ) + file.switchCommunityPanelButtons.append( activeNetworkHeader ) + + var selectButton = AddComboButton( comboStruct, headerIndex, buttonIndex++, "#MENU_TITLE_CHOOSE_NETWORK" ) + file.switchCommunityPanelButtons.append( selectButton ) + file.selectNetWorkbutton = selectButton + Hud_AddEventHandler( selectButton, UIE_CLICK, SelectNetworkButton_Activate ) + + var createButton = AddComboButton( comboStruct, headerIndex, buttonIndex++, "#MENU_TITLE_CREATE_NETWORK" ) + file.switchCommunityPanelButtons.append( createButton ) + AddButtonEventHandler( createButton, UIE_CLICK, OnCreateCommunityButton_Activate ) + + var leaveButton = AddComboButton( comboStruct, headerIndex, buttonIndex++, "#COMMUNITY_LEAVE_NETWORK" ) + file.switchCommunityPanelButtons.append( leaveButton ) + Hud_AddEventHandler( leaveButton, UIE_CLICK, LeaveCurrentCommunityButton_Activate ) + + headerIndex++ + buttonIndex = 0 + + var adminHeader = AddComboButtonHeader( comboStruct, headerIndex, "#MENU_TITLE_ADMIN" ) + file.switchCommunityPanelButtons.append( adminHeader ) + var editButton = AddComboButton( comboStruct, headerIndex, buttonIndex++, "#MENU_TITLE_EDIT_NETWORK" ) + file.switchCommunityPanelButtons.append( editButton ) + AddButtonEventHandler( editButton, UIE_CLICK, OnEditCommunityButton_Activate ) + file.editButton = editButton + + file.sendButton = AddComboButton( comboStruct, headerIndex, buttonIndex++, "#MENU_TITLE_SEND" ) + file.switchCommunityPanelButtons.append( file.sendButton ) + Hud_AddEventHandler( file.sendButton, UIE_CLICK, AdvanceMenuEventHandler( GetMenu( "CommunityAdminSendMessage" ) ) ) + + var pendingRequestButton = AddComboButton( comboStruct, headerIndex, buttonIndex++, "#MENU_TITLE_MEMBER_REQ" ) + file.switchCommunityPanelButtons.append( pendingRequestButton ) + AddButtonEventHandler( pendingRequestButton, UIE_CLICK, OnViewPendingRequestButton_Activate ) + file.adminViewPendingRequestsButton = pendingRequestButton + + headerIndex++ + buttonIndex = 0 + + file.chatroomToggleVoiceModeHeader = AddComboButtonHeader( comboStruct, headerIndex, "#MENU_TITLE_ADMIN_CHATROOM" ) + file.switchCommunityPanelButtons.append( file.chatroomToggleVoiceModeHeader ) + + file.chatroomToggleVoiceModeButton0 = AddComboButton( comboStruct, headerIndex, buttonIndex++, "#MENU_TITLE_CHATROOM_FREETALK" ) + file.switchCommunityPanelButtons.append( file.chatroomToggleVoiceModeButton0 ) + Hud_AddEventHandler( file.chatroomToggleVoiceModeButton0, UIE_CLICK, ToggleChatroomVoiceMode0 ) + + file.chatroomToggleVoiceModeButton1 = AddComboButton( comboStruct, headerIndex, buttonIndex++, "#MENU_TITLE_CHATROOM_ADMINSONLY" ) + file.switchCommunityPanelButtons.append( file.chatroomToggleVoiceModeButton1 ) + Hud_AddEventHandler( file.chatroomToggleVoiceModeButton1, UIE_CLICK, ToggleChatroomVoiceMode1 ) + + // comboStruct.navDownButton = file.chatroomMenu_chatroomWidget + ComboButtons_Finalize( comboStruct ) + + file.networksComboStruct = comboStruct +} + +void function SelectNetworkButton_Activate( var button ) +{ + // file.inCommunityPanel = true + Hud_SetFocused( file.switchCommunityPanel_ListWidget ) +} + +void function OnNetworksMenu_NavigateBack() +{ + if ( file.inCommunityPanel ) + { + MyCommunities_OnLoseFocus( file.switchCommunityPanel_ListWidget ) + Hud_SetFocused( file.selectNetWorkbutton ) + } + else + { + CloseActiveMenu( true ) + } +} + +void function OnBrowseMentworksMenu_NavigateBack() +{ + printt( Hud_GetHudName( GetFocus() ) ) + if ( GetFocus() == file.browseCommunitiesPanel_ListWidget ) + { + Hud_Show( file.browseCommunitiesPanel_ViewDetailsButton ) + Hud_SetFocused( file.browseCommunitiesPanel_ViewDetailsButton ) + } + else + { + CloseActiveMenu( true ) + } +} + + +void function OCommunitySendMsg_NavigateBack() +{ + if ( !file.communityEdited ) + { + LeaveEditCommunity() + return + } + + DialogData dialogData + dialogData.header = "#COMMUNITY_ARE_YOU_SURE" + dialogData.message = "#COMMUNITY_CHANGES_WILL_BE_LOST" + + AddDialogButton( dialogData, "#YES", LeaveEditCommunity ) + AddDialogButton( dialogData, "#NO" ) + + dialogData.noChoiceWithNavigateBack = true + OpenDialog( dialogData ) +} + + +string function GetMyRegion_Localized() +{ + string myRegion = MyRegion() + + string myRegion_localized + + if ( myRegion in file.keysToStrings ) + myRegion_localized = Localize( "#MY_REGION_N", Localize( ConvertKeyToLocalizedString( myRegion ) ) ) + + return myRegion_localized +} + +#if NETWORK_INVITE +void function OnInviteFriendsToNetworkButton_Activate( var button ) +{ + if( Hud_IsLocked( button ) ) + return + + AdvanceMenu( GetMenu( "InviteFriendsToNetworkMenu" ) ) +} +#endif diff --git a/Northstar.Client/mod/scripts/vscripts/ui/menu_inbox.nut b/Northstar.Client/mod/scripts/vscripts/ui/menu_inbox.nut new file mode 100644 index 000000000..66f38cba9 --- /dev/null +++ b/Northstar.Client/mod/scripts/vscripts/ui/menu_inbox.nut @@ -0,0 +1,716 @@ + +global function InitInboxFrontMenu +global function InitInboxMenu + +global function TryToShowAnInboxMessage +global function UICodeCallback_InboxUpdated +global function OnInboxButton_Activate + +const int NUM_DISPLAY_RECENT_UNLOCKS = 5 + +struct +{ + var menu + + var messagesButton + var lootButton + + var messagesCountLabel + var lootCountLabel + + var lootDisplay + array recentLootUnlocks + array reportedMessageIds + + var inboxMenu + var inboxPanel + var inboxCommunityName + var inboxSenderName + var inboxDate + var inboxMessageText + int inboxCurrentMessageId + int inboxPrevMessageId + int inboxNextMessageId + int reportAbuseCommunityId + int reportAbuseSeverity + var inboxPrevMsgButton + var inboxNextMsgButton + var inboxDeleteButton + var inboxAcceptButton + var inboxReportAbuseButton + var inboxCanDeleteMsg + var inboxCanAcceptMsg + var inboxCanReportAbuse + bool inboxThreadRunning + + string oldMessageText +} file + +void function InitInboxFrontMenu() +{ + var menu = GetMenu( "InboxFrontMenu" ) + file.menu = menu + + AddMenuEventHandler( menu, eUIEvent.MENU_OPEN, OnOpenInboxFrontMenu ) + AddMenuEventHandler( menu, eUIEvent.MENU_CLOSE, OnCloseInboxFrontMenu ) + + file.messagesButton = Hud_GetChild( menu, "MessagesButton" ) + Hud_AddEventHandler( file.messagesButton, UIE_CLICK, OnMessagesButton_Activate ) + + file.lootButton = Hud_GetChild( menu, "LootButton" ) + Hud_AddEventHandler( file.lootButton, UIE_CLICK, OnLootButton_Activate ) + + file.messagesCountLabel = Hud_GetChild( menu, "MessagesCountLabel" ) + file.lootCountLabel = Hud_GetChild( menu, "LootCountLabel" ) + + file.lootDisplay = Hud_GetChild( menu, "LootDisplay" ) + + for ( int index = 0; index < NUM_DISPLAY_RECENT_UNLOCKS; index++ ) + { + file.recentLootUnlocks.append( Hud_GetChild( menu, "RecentUnlock" + index ) ) + } + + AddMenuFooterOption( menu, BUTTON_A, "#A_BUTTON_SELECT", "", null, DoesFocusHaveItems ) + AddMenuFooterOption( menu, BUTTON_B, "#B_BUTTON_BACK", "#BACK" ) +} + + +void function OnOpenInboxFrontMenu() +{ + UpdateInboxFrontButtons() + thread UpdateInboxFrontThread() + UI_SetPresentationType( ePresentationType.NO_MODELS ) +} + +void function OnCloseInboxFrontMenu() +{ + Signal( uiGlobal.signalDummy, "StopInboxThread" ) +} + + +void function UpdateInboxFrontThread() +{ + EndSignal( uiGlobal.signalDummy, "CleanupInGameMenus" ) + + while ( GetTopNonDialogMenu() == GetMenu( "InboxFrontMenu" ) ) + { + UpdateInboxFrontButtons() + + wait 0.1 + } +} + +bool function DoesFocusHaveItems() +{ + entity player = GetUIPlayer() + + if ( !player ) + return false + + var button = GetFocus() + if ( button == file.messagesButton ) + return Inbox_GetTotalMessageCount() > 0 + else if ( button == file.lootButton ) + return PlayerRandomUnlock_GetTotal( player ) > 0 + + return true +} + +void function UpdateInboxFrontButtons() +{ + entity player = GetUIPlayer() + + if ( !player ) + return + + int totalMessages = Inbox_GetTotalMessageCount() + array messageIds + array lootIds + + for ( int messageIndex = 0; messageIndex < totalMessages; messageIndex++ ) + { + int messageId = Inbox_GetMessageIdByIndex( messageIndex ) + InboxMessage inboxMessage = Inbox_GetMessage( messageId ) + messageIds.append( inboxMessage.messageId ) + } + + if ( messageIds.len() ) + { + string countString + if ( messageIds.len() >= MAX_MAIL_COUNT ) + countString = MAX_MAIL_COUNT + "+" + else + countString = string( messageIds.len() ) + + + SetButtonRuiText( file.messagesButton, "#COMMUNITY_INBOX_READ_MESSAGE" ) + if ( messageIds.len() == 1 ) + SetLabelRuiText( file.messagesCountLabel, Localize( "#COMMUNITY_INBOX_MESSAGE_COUNT_1" ) ) + else + SetLabelRuiText( file.messagesCountLabel, Localize( "#COMMUNITY_INBOX_MESSAGE_COUNT_N", countString ) ) + } + else + { + SetButtonRuiText( file.messagesButton, "#COMMUNITY_INBOX_NO_MESSAGES" ) + SetLabelRuiText( file.messagesCountLabel, Localize( "#COMMUNITY_INBOX_MESSAGE_COUNT_0" ) ) + //SetLabelRuiText( file.messagesCountLabel, "" ) + } + Hud_SetLocked( file.messagesButton, messageIds.len() == 0 ) + + int totalRandomUnlocks = PlayerRandomUnlock_GetTotal( player ) + + if ( totalRandomUnlocks ) + { + SetButtonRuiText( file.lootButton, "#COMMUNITY_INBOX_OPEN_LOOT" ) + if ( totalRandomUnlocks == 1 ) + SetLabelRuiText( file.lootCountLabel, Localize( "#COMMUNITY_INBOX_LOOT_COUNT_1" ) ) + else + SetLabelRuiText( file.lootCountLabel, Localize( "#COMMUNITY_INBOX_LOOT_COUNT_N", totalRandomUnlocks ) ) + } + else + { + SetButtonRuiText( file.lootButton, "#COMMUNITY_INBOX_NO_LOOT" ) + SetLabelRuiText( file.lootCountLabel, Localize( "#COMMUNITY_INBOX_LOOT_COUNT_0" ) ) + //SetLabelRuiText( file.lootCountLabel, "" ) + } + Hud_SetLocked( file.lootButton, totalRandomUnlocks == 0 ) + + var lootDisplayRui = Hud_GetRui( file.lootDisplay ) + RuiSetInt( lootDisplayRui, "coliseumTicketCount", Player_GetColiseumTicketCount( player ) ) + RuiSetInt( lootDisplayRui, "doubleXPCount", Player_GetDoubleXPCount( player ) ) + + for ( int index = 0; index < NUM_DISPLAY_RECENT_UNLOCKS; index++ ) + { + ItemDisplayData ornull displayData = Player_GetRecentUnlock( player, index ) + var recentLootRui = Hud_GetRui( file.recentLootUnlocks[index] ) + + if ( displayData != null ) + { + expect ItemDisplayData( displayData ) + int count = Player_GetRecentUnlockCount( player, index ) + + string title + string category + string parentTitle + if ( displayData.parentRef != "" ) + { + parentTitle = Localize( GetItemName( displayData.parentRef ) ) + string categoryName = GetItemRefTypeName( displayData.ref, displayData.parentRef ) + category = Localize( categoryName, Localize( parentTitle ) ) + //category = Localize( categoryName ) + title = Localize( displayData.name ) + } + else + { + string categoryName = GetItemRefTypeName( displayData.ref ) + category = Localize( categoryName ) + title = Localize( displayData.name ) + parentTitle = "" + } + + if ( count > 1 ) + title = Localize( "#COMMUNITY_INBOX_ITEM_XN", title, count ) + + RuiSetImage( recentLootRui, "unlockImage", displayData.image ) + RuiSetString( recentLootRui, "unlockTitle", title ) + RuiSetString( recentLootRui, "unlockCategory", category ) + RuiSetString( recentLootRui, "unlockParentTitle", parentTitle ) + RuiSetInt( recentLootRui, "unlockImageAtlas", displayData.imageAtlas ) + RuiSetFloat2( recentLootRui, "unlockImageRatio", GetItemImageAspect( displayData.ref ) ) + RuiSetFloat( recentLootRui, "unlockAlpha", 1.0 - index / NUM_DISPLAY_RECENT_UNLOCKS ) + } + else + { + RuiSetImage( recentLootRui, "unlockImage", $"" ) + RuiSetString( recentLootRui, "unlockTitle", "" ) + RuiSetInt( recentLootRui, "unlockImageAtlas", -1 ) + RuiSetFloat( recentLootRui, "unlockAlpha", 0.0 ) + } + } + //Inbox_HasNewMessages + //Inbox_HasUnreadMessages + //Inbox_MarkMessageRead + //Inbox_GetPrevMessageId + //Inbox_GetNextMessageId + //Inbox_GetMessage +} + +void function OnMessagesButton_Activate( var button ) +{ + if ( Hud_IsLocked( button ) ) + return + + AdvanceMenu( GetMenu( "Inbox" ) ) + Hud_SetFocused( file.inboxMessageText ) +} + + + +void function OnLootButton_Activate( var button ) +{ + if ( Hud_IsLocked( button ) ) + return + + ClientCommand( "UnlockRandomLoot" ) + EmitUISound( "Menu_AdvocateGift_Open" ) +} + + +void function InitInboxMenu() +{ + RegisterSignal( "StopInboxThread" ) + RegisterSignal( "StopMessageAbuseReports" ) + + var menu = GetMenu( "Inbox" ) + file.inboxMenu = menu + var inboxPanel = Hud_GetChild( menu, "InboxPanel" ) + + AddMenuEventHandler( menu, eUIEvent.MENU_OPEN, OnInboxMenu_Open ) + + file.inboxCurrentMessageId = Inbox_GetMessageIdByIndex( 0 ) + file.inboxNextMessageId = Inbox_GetNextMessageId( file.inboxCurrentMessageId ) + file.inboxPrevMessageId = Inbox_GetPrevMessageId( file.inboxCurrentMessageId ) + + file.inboxCommunityName = Hud_GetChild( inboxPanel, "CommunityName" ) + file.inboxSenderName = Hud_GetChild( inboxPanel, "Sender" ) + file.inboxDate = Hud_GetChild( inboxPanel, "Date" ) + file.inboxMessageText = Hud_GetChild( inboxPanel, "Message" ) + // file.inboxPrevMsgButton = Hud_GetChild( inboxPanel, "PrevMessageButton" ) + // AddEventHandlerToButton( inboxPanel, "PrevMessageButton", UIE_CLICK, ActivatePrevMessage_OnClick ) + // file.inboxNextMsgButton = Hud_GetChild( inboxPanel, "NextMessageButton" ) + // AddEventHandlerToButton( inboxPanel, "NextMessageButton", UIE_CLICK, ActivateNextMessage_OnClick ) + + //file.inboxDeleteButton = Hud_GetChild( inboxPanel, "DeleteMessageButton" ) + //AddEventHandlerToButton( inboxPanel, "DeleteMessageButton", UIE_CLICK, DeleteMessage_OnClick ) + //file.inboxAcceptButton = Hud_GetChild( inboxPanel, "AcceptMessageButton" ) + //AddEventHandlerToButton( inboxPanel, "AcceptMessageButton", UIE_CLICK, AcceptMessage_OnClick ) + // + var elem = Hud_GetChild( inboxPanel, "MailIcon" ) + var rui = Hud_GetRui( elem ) + RuiSetImage( rui, "basicImage", $"rui/menu/common/inbox_icon_new" ) + + AddMenuFooterOption( menu, BUTTON_B, "#B_BUTTON_BACK", "#BACK" ) + // AddMenuFooterOption( menu, BUTTON_X, "#X_BUTTON_INBOX_ACCEPT_ALL", "#INBOX_ACCEPT_ALL", AcceptAllMessage_OnClick, CanOnlyAcceptOrOnlyDeleteMessage ) + AddMenuFooterOption( menu, BUTTON_X, "#X_BUTTON_INBOX_DONE", "#INBOX_DONE", AcceptMessage_OnClick, CanOnlyAcceptMessage ) + AddMenuFooterOption( menu, BUTTON_X, "#X_BUTTON_INBOX_DONE", "#INBOX_DONE", DeleteMessage_OnClick, CanOnlyDeleteMessage ) + AddMenuFooterOption( menu, BUTTON_X, "#X_BUTTON_YES", "#YES", AcceptMessage_OnClick, CanAcceptAndDeleteMessage ) + AddMenuFooterOption( menu, BUTTON_Y, "#Y_BUTTON_NO", "#NO", DeleteMessage_OnClick, CanAcceptAndDeleteMessage ) + AddMenuFooterOption( menu, BUTTON_Y, "#COMMUNITY_REPORTMSGABUSE_YBUTTON", "#COMMUNITY_REPORTMSGABUSE", ReportMessageAbuse_OnClick, CanReportMessageAbuse ) +} + + + +void function OnInboxMenu_Open() +{ + UI_SetPresentationType( ePresentationType.NO_MODELS ) +} + +bool function CanDeleteMessage() +{ + bool res = bool( IsViewingMessages() && file.inboxCanDeleteMsg ) + return res +} + +bool function CanAcceptMessage() +{ + bool res = bool( IsViewingMessages() && file.inboxCanAcceptMsg ) + return res +} + +bool function CanOnlyAcceptMessage() +{ + return CanAcceptMessage() && !CanDeleteMessage() +} + +bool function CanOnlyDeleteMessage() +{ + return CanDeleteMessage() && !CanAcceptMessage() +} + +bool function CanOnlyAcceptOrOnlyDeleteMessage() +{ + return CanOnlyAcceptMessage() || CanOnlyDeleteMessage() +} + +bool function CanAcceptAndDeleteMessage() +{ + return CanAcceptMessage() && CanDeleteMessage() +} + +bool function IsViewingMessages() +{ + return Hud_IsVisible( file.inboxMenu ) +} + +bool function HasPrevMessage() +{ + if ( !IsViewingMessages() ) + return false + + if ( file.inboxPrevMessageId >= 0 ) + return true + + return false +} + +bool function HasNextMessage() +{ + if ( !IsViewingMessages() ) + return false + + if ( file.inboxNextMessageId >= 0 ) + return true + + return false +} + + +void function DeleteMessage_OnClick( var button ) +{ + printt( "deleting message id " + file.inboxCurrentMessageId ) + if ( file.inboxCurrentMessageId >= 0 ) + Inbox_DeleteMessage( file.inboxCurrentMessageId ) + + CloseActiveMenu() + //TryToShowAnInboxMessage() + // + //UpdateFooterOptions() +} + +void function AcceptMessage_OnClick( var button ) +{ + AcceptMessage() + CloseActiveMenu() + + /* + DialogData dialogData + dialogData.header = "#ACCEPT_MESSAGE_COMFIRM" + dialogData.message = "#ACCEPT_MESSAGE_COMFIRM_SUB" + + + AddDialogButton( dialogData, "#YES", AcceptMessage ) + AddDialogButton( dialogData, "#NO" ) + + AddDialogFooter( dialogData, "#A_BUTTON_SELECT" ) + AddDialogFooter( dialogData, "#B_BUTTON_BACK" ) + + OpenDialog( dialogData ) + */ +} + +void function AcceptAllMessage_OnClick( var button ) +{ + DialogData dialogData + dialogData.header = "#ACCEPT_ALL_MESSAGE_COMFIRM" + dialogData.message = "#ACCEPT_ALL_MESSAGE_COMFIRM_SUB" + + + AddDialogButton( dialogData, "#YES", AcceptMessage ) + AddDialogButton( dialogData, "#NO" ) + + AddDialogFooter( dialogData, "#A_BUTTON_SELECT" ) + AddDialogFooter( dialogData, "#B_BUTTON_BACK" ) + + OpenDialog( dialogData ) +} + +void function AcceptMessage() +{ + if ( CanAcceptMessage() ) + { + if ( file.inboxCurrentMessageId >= 0 ) + { + Inbox_ExecuteMessageAction( file.inboxCurrentMessageId ) + } + } + + DeleteMessage_OnClick( null ) +} + +void function ReportMessageAbuse_Final() +{ + if ( file.reportedMessageIds.len() > 100 ) + return + + foreach ( messageId in file.reportedMessageIds ) + { + if ( messageId == file.inboxCurrentMessageId ) + return + } + + ReportCommunity( file.reportAbuseCommunityId, file.reportAbuseSeverity ) + + file.reportedMessageIds.append( file.inboxCurrentMessageId ) + ReportInboxMessage( file.inboxCurrentMessageId, file.reportAbuseSeverity ) +} + +void function ReportMessageAbuseAndLeaveNetwork_Final() +{ + file.reportAbuseSeverity = 1 + ReportMessageAbuse_Final() + if ( AreWeInCommunity( file.reportAbuseCommunityId ) ) + LeaveCommunity( file.reportAbuseCommunityId ) +} + +void function ReportMessageAbuse_Thread( InboxMessage msg ) +{ + Signal( uiGlobal.signalDummy, "StopMessageAbuseReports" ) + EndSignal( uiGlobal.signalDummy, "StopMessageAbuseReports" ) + + DialogData dialogData + + file.reportAbuseCommunityId = msg.communityID + file.reportAbuseSeverity = 0 + + dialogData.header = Localize( "#REALLY_REPORT_ABUSEMSG_HEADER" ) + dialogData.message = Localize( "#REALLY_REPORT_ABUSEMSG" ) + + AddDialogButton( dialogData, "#NO" ) + AddDialogButton( dialogData, "#YES_REPORT_ABUSEMSG", ReportMessageAbuse_Final ) + if ( AreWeInCommunity( file.reportAbuseCommunityId ) ) + AddDialogButton( dialogData, "#YES_REPORTMSG_AND_LEAVENETWORK", ReportMessageAbuseAndLeaveNetwork_Final ) + + AddDialogFooter( dialogData, "#A_BUTTON_SELECT" ) + AddDialogFooter( dialogData, "#B_BUTTON_BACK" ) + + OpenDialog( dialogData ) +} + +void function ReportMessageAbuse_OnClick( var button ) +{ + EmitUISound( "Menu.Accept" ) + + InboxMessage msg = Inbox_GetMessage( file.inboxCurrentMessageId ) + Assert( IsValid( msg ) ) + if ( msg.senderUID == "" ) + return + + thread ReportMessageAbuse_Thread( msg ) +} + +bool function CanReportMessageAbuse() +{ + if ( CanAcceptAndDeleteMessage() ) + return false; + + InboxMessage msg = Inbox_GetMessage( file.inboxCurrentMessageId ) + Assert( IsValid( msg ) ) + + if ( file.reportedMessageIds.len() > 100 ) + return false + + foreach ( messageId in file.reportedMessageIds ) + { + if ( messageId == msg.messageId ) + return false + } + + return msg.reportable +} + +void function ActivateNextMessage( var button ) +{ + if ( file.inboxNextMessageId >= 0 ) + { + file.inboxCurrentMessageId = file.inboxNextMessageId + file.inboxNextMessageId = Inbox_GetNextMessageId( file.inboxCurrentMessageId ) + file.inboxPrevMessageId = Inbox_GetPrevMessageId( file.inboxCurrentMessageId ) + + /* + var rui = Hud_GetRui( file.inboxMessageText ) + RuiSetInt( rui, "direction", 1 ) + */ + + ShowInboxMessage( file.inboxCurrentMessageId ) + + UpdateFooterOptions() + } +} + +void function ActivatePrevMessage( var button ) +{ + if ( file.inboxPrevMessageId >= 0 ) + { + file.inboxCurrentMessageId = file.inboxPrevMessageId + file.inboxNextMessageId = Inbox_GetNextMessageId( file.inboxCurrentMessageId ) + file.inboxPrevMessageId = Inbox_GetPrevMessageId( file.inboxCurrentMessageId ) + + /* + var rui = Hud_GetRui( file.inboxMessageText ) + RuiSetInt( rui, "direction", -1 ) + */ + + ShowInboxMessage( file.inboxCurrentMessageId ) + + UpdateFooterOptions() + } +} + + +bool function UpdateInboxMessageUI( InboxMessage msg ) +{ + if ( msg.messageId < 0 ) + return false + + Hud_SetUTF8Text( file.inboxCommunityName, Localize( msg.communityName ) ) + Hud_SetUTF8Text( file.inboxSenderName, Localize( msg.senderName ) ) + Hud_SetUTF8Text( file.inboxDate, Localize( msg.dateSent ) ) + Hud_SetUTF8Text( file.inboxMessageText, Localize( msg.messageText ) ) + + Hud_SetFocused( file.inboxMessageText ); + + if ( file.oldMessageText != msg.messageText ) + { + printt( "setting new message:" ) + printt( msg.messageText ) + printt( Time() ) + /* + var rui = Hud_GetRui( file.inboxMessageText ) + RuiSetString( rui, "oldMessage", file.oldMessageText ) + RuiSetString( rui, "newMessage", msg.messageText ) + RuiSetGameTime( rui, "startTime", Time() ) + */ + file.oldMessageText = msg.messageText + } + + Inbox_MarkMessageRead( msg.messageId ) + + int prevMsgId = Inbox_GetPrevMessageId( msg.messageId ) + #if PC_PROG + // if ( prevMsgId >= 0 ) + // Hud_Show( file.inboxPrevMsgButton ) + // else + // Hud_Hide( file.inboxPrevMsgButton ) + #endif + + int nextMsgId = Inbox_GetNextMessageId( msg.messageId ) + #if PC_PROG + // if ( nextMsgId >= 0 ) + // Hud_Show( file.inboxNextMsgButton ) + // else + // Hud_Hide( file.inboxNextMsgButton ) + #endif + + file.inboxCanDeleteMsg = msg.deletable + //#if PC_PROG + // if ( file.inboxCanDeleteMsg ) + // Hud_Show( file.inboxDeleteButton ) + // else + // Hud_Hide( file.inboxDeleteButton ) + //#endif + + file.inboxCanAcceptMsg = msg.actionURL != "" + + if ( file.inboxCanAcceptMsg ) + { + //Hud_Show( file.inboxAcceptButton ) + //// Hud_SetFocused( file.inboxAcceptButton ) + //Hud_SetText( file.inboxAcceptButton, msg.actionLabel ) + } + else + { + //#if PC_PROG + // // Hud_SetFocused( file.inboxDeleteButton ) + //#endif + //Hud_Hide( file.inboxAcceptButton ) + } + + UpdateFooterOptions() + + return true +} + +void function UICodeCallback_InboxUpdated() +{ + ShowNotification() + + //ArmoryMenu_UpdateInboxButtons() + Lobby_UpdateInboxButtons() + Search_UpdateInboxButtons() + + TryToShowAnInboxMessage() +} + + +void function KeepUpdatingInboxMessageThread() +{ + Signal( uiGlobal.signalDummy, "StopInboxThread" ) + + while ( true ) + { + WaitFrameOrUntilLevelLoaded() + InboxMessage msg = Inbox_GetMessage( file.inboxCurrentMessageId ) + if ( msg.messageId >= 0 ) + UpdateInboxMessageUI( msg ) + if ( msg.doneResolving ) + return + } + Assert( false ) +} + +void function ActivatePrevMessage_OnClick( var button ) +{ + ActivatePrevMessage( button ) +} + +void function ActivateNextMessage_OnClick( var button ) +{ + ActivateNextMessage( button ) +} + +bool function ShowInboxMessage( int messageId ) +{ + if ( Inbox_GetTotalMessageCount() ) + { + Assert( messageId >= 0 ) + InboxMessage msg = Inbox_GetMessage( messageId ) + if ( msg.messageId < 0 ) // invalid + return false + + Signal( uiGlobal.signalDummy, "StopInboxThread" ) + thread KeepUpdatingInboxMessageThread() + return true + } + + return false +} + +bool function TryToShowAnInboxMessage() +{ + // file.inboxCurrentMessageId = Inbox_GetNextMessageId( file.inboxCurrentMessageId ) + InboxMessage msg = Inbox_GetMessage( file.inboxCurrentMessageId ) + if ( msg.messageId < 0 ) // invalid + { + file.inboxCurrentMessageId = Inbox_GetPrevMessageId( file.inboxCurrentMessageId ) + InboxMessage msg = Inbox_GetMessage( file.inboxCurrentMessageId ) + if ( msg.messageId < 0 ) // invalid + file.inboxCurrentMessageId = Inbox_GetMessageIdByIndex( 0 ) + } + + file.inboxNextMessageId = Inbox_GetNextMessageId( file.inboxCurrentMessageId ) + file.inboxPrevMessageId = Inbox_GetPrevMessageId( file.inboxCurrentMessageId ) + + if ( !ShowInboxMessage( file.inboxCurrentMessageId ) ) + { + if ( IsViewingMessages() ) + CloseActiveMenu() + return false + } + return true +} + +void function OnInboxButton_Activate( var button ) +{ + //if ( !Inbox_GetTotalMessageCount() || !TryToShowAnInboxMessage() ) + //{ + // if ( IsViewingMessages() ) + // CloseActiveMenu() + // return + //} + // + //AdvanceMenu( file.inboxMenu ) + if( Hud_IsLocked( button ) ) + return + + AdvanceMenu( GetMenu( "InboxFrontMenu" ) ) +} diff --git a/Northstar.Client/mod/scripts/vscripts/ui/menu_lobby.nut b/Northstar.Client/mod/scripts/vscripts/ui/menu_lobby.nut index b685debe2..de4ad5220 100644 --- a/Northstar.Client/mod/scripts/vscripts/ui/menu_lobby.nut +++ b/Northstar.Client/mod/scripts/vscripts/ui/menu_lobby.nut @@ -71,6 +71,7 @@ struct int inboxHeaderIndex var inboxButton + var switchButton int customizeHeaderIndex var pilotButton @@ -361,6 +362,7 @@ void function SetupComboButtonTest( var menu ) file.lobbyButtons.append( networksInbox ) Hud_AddEventHandler( networksInbox, UIE_CLICK, OnInboxButton_Activate ) var switchButton = AddComboButton( comboStruct, headerIndex, buttonIndex++, "#COMMUNITY_SWITCHCOMMUNITY" ) + file.switchButton = switchButton Hud_AddEventHandler( switchButton, UIE_CLICK, OnSwitchButton_Activate ) var browseButton = AddComboButton( comboStruct, headerIndex, buttonIndex++, "#COMMUNITY_BROWSE_NETWORKS" ) file.lobbyButtons.append( browseButton ) @@ -715,6 +717,16 @@ void function DoNSButtonState() ComboButton_SetText( file.findGameButton, "#MENU_TITLE_FIND_GAME" ) ComboButton_SetText( file.inviteRoomButton, "#MENU_TITLE_INVITE_ROOM" ) Hud_SetVisible( file.inviteFriendsButton, true ) + + Hud_SetLocked( file.inboxButton, false ) + Hud_SetLocked( file.browseNetworkButton, false ) + Hud_SetLocked( file.switchButton, false ) + Hud_SetLocked( file.inviteFriendsToNetworkButton, false ) + + Hud_SetLocked( file.storeButton, false ) + Hud_SetLocked( file.storeNewReleasesButton, false ) + Hud_SetLocked( file.storeBundlesButton, false ) + } else { @@ -723,6 +735,15 @@ void function DoNSButtonState() ComboButton_SetText( file.findGameButton, "#MENU_TITLE_SERVER_BROWSER" ) ComboButton_SetText( file.inviteRoomButton, "#PRIVATE_MATCH" ) Hud_SetVisible( file.inviteFriendsButton, false ) + + Hud_SetLocked( file.inboxButton, true ) + Hud_SetLocked( file.browseNetworkButton, true ) + Hud_SetLocked( file.switchButton, true ) + Hud_SetLocked( file.inviteFriendsToNetworkButton, true ) + + Hud_SetLocked( file.storeButton, true ) + Hud_SetLocked( file.storeNewReleasesButton, true ) + Hud_SetLocked( file.storeBundlesButton, true ) } } @@ -1613,17 +1634,26 @@ void function SetPutPlayerInMatchmakingAfterDelay( bool value ) void function OnStoreButton_Activate( var button ) { + if( Hud_IsLocked( button ) ) + return + LaunchGamePurchaseOrDLCStore() } void function OnStoreNewReleasesButton_Activate( var button ) { + if( Hud_IsLocked( button ) ) + return + //LaunchGamePurchaseOrDLCStore( [ "StoreMenu", "StoreMenu_NewReleases" ] ) LaunchGamePurchaseOrDLCStore( [ "StoreMenu", "StoreMenu_WeaponSkins" ] ) } void function OnStoreBundlesButton_Activate( var button ) { + if( Hud_IsLocked( button ) ) + return + LaunchGamePurchaseOrDLCStore( [ "StoreMenu", "StoreMenu_Sales" ] ) } From ed08d1a6a087a5587b35fbe044baf66d6611b50d Mon Sep 17 00:00:00 2001 From: Will <39478251+VITALISED@users.noreply.github.com> Date: Wed, 1 May 2024 17:52:26 +1000 Subject: [PATCH 17/38] Move around progression stuff too since we have the space --- .../mod/scripts/vscripts/ui/menu_lobby.nut | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/Northstar.Client/mod/scripts/vscripts/ui/menu_lobby.nut b/Northstar.Client/mod/scripts/vscripts/ui/menu_lobby.nut index de4ad5220..731d9158a 100644 --- a/Northstar.Client/mod/scripts/vscripts/ui/menu_lobby.nut +++ b/Northstar.Client/mod/scripts/vscripts/ui/menu_lobby.nut @@ -335,8 +335,8 @@ void function SetupComboButtonTest( var menu ) Hud_AddEventHandler( titanButton, UIE_CLICK, AdvanceMenuEventHandler( GetMenu( "EditTitanLoadoutsMenu" ) ) ) file.boostsButton = AddComboButton( comboStruct, headerIndex, buttonIndex++, "#MENU_TITLE_BOOSTS" ) Hud_AddEventHandler( file.boostsButton, UIE_CLICK, AdvanceMenuEventHandler( GetMenu( "BurnCardMenu" ) ) ) - file.progressionButton = AddComboButton( comboStruct, headerIndex, buttonIndex++, "#TOGGLE_PROGRESSION" ) - Hud_AddEventHandler( file.progressionButton, UIE_CLICK, ShowToggleProgressionDialog ) + // file.progressionButton = AddComboButton( comboStruct, headerIndex, buttonIndex++, "#TOGGLE_PROGRESSION" ) + // Hud_AddEventHandler( file.progressionButton, UIE_CLICK, ShowToggleProgressionDialog ) headerIndex++ buttonIndex = 0 @@ -515,6 +515,9 @@ void function InviteFriendsIfAllowed( var button ) if ( Hud_IsLocked( button ) ) return + if ( !NSIsVanilla() ) + ShowToggleProgressionDialog( button ) + entity player = GetUIPlayer() if ( IsValid( player ) && Player_NextAvailableMatchmakingTime( player ) > 0 ) { @@ -712,11 +715,9 @@ void function DoNSButtonState() { if ( NSIsVanilla() ) { - Hud_SetVisible( file.progressionButton, false ) - ComboButton_SetText( file.findGameButton, "#MENU_TITLE_FIND_GAME" ) ComboButton_SetText( file.inviteRoomButton, "#MENU_TITLE_INVITE_ROOM" ) - Hud_SetVisible( file.inviteFriendsButton, true ) + ComboButton_SetText( file.inviteFriendsButton, "#MENU_TITLE_INVITE_FRIENDS" ) Hud_SetLocked( file.inboxButton, false ) Hud_SetLocked( file.browseNetworkButton, false ) @@ -730,11 +731,9 @@ void function DoNSButtonState() } else { - Hud_SetVisible( file.progressionButton, true ) - ComboButton_SetText( file.findGameButton, "#MENU_TITLE_SERVER_BROWSER" ) ComboButton_SetText( file.inviteRoomButton, "#PRIVATE_MATCH" ) - Hud_SetVisible( file.inviteFriendsButton, false ) + ComboButton_SetText( file.inviteFriendsButton, "#TOGGLE_PROGRESSION" ) Hud_SetLocked( file.inboxButton, true ) Hud_SetLocked( file.browseNetworkButton, true ) From 591e6836b9606278a353780e9b472c5880b797b8 Mon Sep 17 00:00:00 2001 From: Will <39478251+VITALISED@users.noreply.github.com> Date: Wed, 1 May 2024 22:57:39 +1000 Subject: [PATCH 18/38] Move to disabling mods to main menu --- .../mod/scripts/vscripts/ui/panel_mainmenu.nut | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Northstar.Client/mod/scripts/vscripts/ui/panel_mainmenu.nut b/Northstar.Client/mod/scripts/vscripts/ui/panel_mainmenu.nut index 8b549c06c..565db1611 100644 --- a/Northstar.Client/mod/scripts/vscripts/ui/panel_mainmenu.nut +++ b/Northstar.Client/mod/scripts/vscripts/ui/panel_mainmenu.nut @@ -145,6 +145,12 @@ void function OnShowMainMenuPanel() Signal( uiGlobal.signalDummy, "EndShowMainMenuPanel" ) EndSignal( uiGlobal.signalDummy, "EndShowMainMenuPanel" ) + if ( NSIsModEnabled( "Northstar.Custom" ) ) + { + NSSetModEnabled( "Northstar.Custom", false ) + ReloadMods() + } + foreach ( button in file.menuButtons ) { int buttonID = int( Hud_GetScriptID( button ) ) @@ -585,12 +591,6 @@ void function OnPlayMPButton_Activate( var button ) if ( file.mpButtonActivateFunc == null ) printt( "file.mpButtonActivateFunc is null" ) - if ( NSIsModEnabled( "Northstar.Custom" ) ) - { - NSSetModEnabled( "Northstar.Custom", false ) - ReloadMods() - } - if ( !Hud_IsLocked( button ) && file.mpButtonActivateFunc != null ) { Lobby_SetAutoFDOpen( false ) From bbbde5e116cc8235714b905bdb37e5b7433fafd0 Mon Sep 17 00:00:00 2001 From: Will <39478251+VITALISED@users.noreply.github.com> Date: Thu, 2 May 2024 00:50:25 +1000 Subject: [PATCH 19/38] Wrap all Northstar.Custom remotes for vanilla compat --- .../mod/scripts/vscripts/ui/panel_mainmenu.nut | 6 ------ Northstar.Custom/mod.json | 4 ++++ .../vscripts/gamemodes/sh_gamemode_arena.gnut | 16 ++++++++-------- .../vscripts/gamemodes/sh_gamemode_ctf_comp.gnut | 6 +++--- .../vscripts/gamemodes/sh_gamemode_fastball.gnut | 6 +++--- .../vscripts/gamemodes/sh_gamemode_fw_custom.nut | 2 +- .../vscripts/gamemodes/sh_gamemode_hidden.nut | 4 ++-- .../vscripts/gamemodes/sh_gamemode_hs.gnut | 8 ++++---- .../vscripts/gamemodes/sh_gamemode_inf.gnut | 6 +++--- .../vscripts/gamemodes/sh_gamemode_kr.gnut | 6 +++--- .../vscripts/gamemodes/sh_gamemode_sns.gnut | 5 +++-- .../vscripts/sh_3psequence_to_1p_hacks.gnut | 2 +- .../mod/scripts/vscripts/sh_bleedout_damage.gnut | 8 ++++---- .../mod/scripts/vscripts/sh_remote_wrapper.gnut | 7 +++++++ 14 files changed, 46 insertions(+), 40 deletions(-) create mode 100644 Northstar.Custom/mod/scripts/vscripts/sh_remote_wrapper.gnut diff --git a/Northstar.Client/mod/scripts/vscripts/ui/panel_mainmenu.nut b/Northstar.Client/mod/scripts/vscripts/ui/panel_mainmenu.nut index 565db1611..590c580cc 100644 --- a/Northstar.Client/mod/scripts/vscripts/ui/panel_mainmenu.nut +++ b/Northstar.Client/mod/scripts/vscripts/ui/panel_mainmenu.nut @@ -145,12 +145,6 @@ void function OnShowMainMenuPanel() Signal( uiGlobal.signalDummy, "EndShowMainMenuPanel" ) EndSignal( uiGlobal.signalDummy, "EndShowMainMenuPanel" ) - if ( NSIsModEnabled( "Northstar.Custom" ) ) - { - NSSetModEnabled( "Northstar.Custom", false ) - ReloadMods() - } - foreach ( button in file.menuButtons ) { int buttonID = int( Hud_GetScriptID( button ) ) diff --git a/Northstar.Custom/mod.json b/Northstar.Custom/mod.json index 69432f498..dbe58dbf5 100644 --- a/Northstar.Custom/mod.json +++ b/Northstar.Custom/mod.json @@ -440,6 +440,10 @@ "Path": "sh_northstar_safe_io.gnut", "RunOn": "CLIENT || SERVER || UI" }, + { + "Path": "sh_remote_wrapper.gnut", + "RunOn": "CLIENT || SERVER || UI" + }, { "Path": "_testing.nut", "RunOn": "CLIENT || SERVER || UI", diff --git a/Northstar.Custom/mod/scripts/vscripts/gamemodes/sh_gamemode_arena.gnut b/Northstar.Custom/mod/scripts/vscripts/gamemodes/sh_gamemode_arena.gnut index b634f1d38..7967d903a 100644 --- a/Northstar.Custom/mod/scripts/vscripts/gamemodes/sh_gamemode_arena.gnut +++ b/Northstar.Custom/mod/scripts/vscripts/gamemodes/sh_gamemode_arena.gnut @@ -37,13 +37,13 @@ void function ArenaRegisterNetworkVars() return // boost store stuff - Remote_RegisterFunction( "ServerCallback_OpenBoostStore" ) - Remote_RegisterFunction( "ServerCallback_UpdateMoney" ) - Remote_RegisterFunction( "ServerCallback_UpdateTeamReserve" ) - Remote_RegisterFunction( "ServerCallback_UpdatePlayerHasBattery" ) - Remote_RegisterFunction( "ServerCallback_UpdateAmpedWeaponState" ) - Remote_RegisterFunction( "ServerCallback_BoostStoreTitanHint" ) - Remote_RegisterFunction( "ServerCallback_UpdateTurretCount" ) + NSRemote_RegisterFunction( "ServerCallback_OpenBoostStore" ) + NSRemote_RegisterFunction( "ServerCallback_UpdateMoney" ) + NSRemote_RegisterFunction( "ServerCallback_UpdateTeamReserve" ) + NSRemote_RegisterFunction( "ServerCallback_UpdatePlayerHasBattery" ) + NSRemote_RegisterFunction( "ServerCallback_UpdateAmpedWeaponState" ) + NSRemote_RegisterFunction( "ServerCallback_BoostStoreTitanHint" ) + NSRemote_RegisterFunction( "ServerCallback_UpdateTurretCount" ) RegisterNetworkedVariable( "boostStoreOpen", SNDC_GLOBAL, SNVT_BOOL, false ) RegisterNetworkedVariable( "FD_money", SNDC_PLAYER_GLOBAL, SNVT_UNSIGNED_INT, 0 ) @@ -54,5 +54,5 @@ void function ArenaRegisterNetworkVars() RegisterNetworkedVariable( "FD_waveActive", SNDC_GLOBAL, SNVT_BOOL, false ) // arena-exclusive stuff - Remote_RegisterFunction( "ServerCallback_CreateMoneyParticles" ) + NSRemote_RegisterFunction( "ServerCallback_CreateMoneyParticles" ) } \ No newline at end of file diff --git a/Northstar.Custom/mod/scripts/vscripts/gamemodes/sh_gamemode_ctf_comp.gnut b/Northstar.Custom/mod/scripts/vscripts/gamemodes/sh_gamemode_ctf_comp.gnut index 1a1ce6451..febd4f968 100644 --- a/Northstar.Custom/mod/scripts/vscripts/gamemodes/sh_gamemode_ctf_comp.gnut +++ b/Northstar.Custom/mod/scripts/vscripts/gamemodes/sh_gamemode_ctf_comp.gnut @@ -64,9 +64,9 @@ void function CTFCompRegisterNetworkVars() RegisterNetworkedVariable( "flagReturnProgress", SNDC_GLOBAL, SNVT_FLOAT_RANGE_OVER_TIME, 0.0, 0.0, 1.0 ) RegisterNetworkedVariable( "returningFlag", SNDC_PLAYER_EXCLUSIVE, SNVT_BOOL, false ) - Remote_RegisterFunction( "ServerCallback_CTF_PlayMatchNearEndMusic" ) - Remote_RegisterFunction( "ServerCallback_CTF_StartReturnFlagProgressBar" ) - Remote_RegisterFunction( "ServerCallback_CTF_StopReturnFlagProgressBar" ) + NSRemote_RegisterFunction( "ServerCallback_CTF_PlayMatchNearEndMusic" ) + NSRemote_RegisterFunction( "ServerCallback_CTF_StartReturnFlagProgressBar" ) + NSRemote_RegisterFunction( "ServerCallback_CTF_StopReturnFlagProgressBar" ) #if CLIENT CLCaptureTheFlag_RegisterNetworkFunctions() diff --git a/Northstar.Custom/mod/scripts/vscripts/gamemodes/sh_gamemode_fastball.gnut b/Northstar.Custom/mod/scripts/vscripts/gamemodes/sh_gamemode_fastball.gnut index 2462d5376..5cbdbfbc3 100644 --- a/Northstar.Custom/mod/scripts/vscripts/gamemodes/sh_gamemode_fastball.gnut +++ b/Northstar.Custom/mod/scripts/vscripts/gamemodes/sh_gamemode_fastball.gnut @@ -41,7 +41,7 @@ void function FastballRegisterNetworkVars() if ( GAMETYPE != GAMEMODE_FASTBALL ) return - Remote_RegisterFunction( "ServerCallback_FastballUpdatePanelRui" ) - Remote_RegisterFunction( "ServerCallback_FastballPanelHacked" ) - Remote_RegisterFunction( "ServerCallback_FastballRespawnPlayer" ) + NSRemote_RegisterFunction( "ServerCallback_FastballUpdatePanelRui" ) + NSRemote_RegisterFunction( "ServerCallback_FastballPanelHacked" ) + NSRemote_RegisterFunction( "ServerCallback_FastballRespawnPlayer" ) } \ No newline at end of file diff --git a/Northstar.Custom/mod/scripts/vscripts/gamemodes/sh_gamemode_fw_custom.nut b/Northstar.Custom/mod/scripts/vscripts/gamemodes/sh_gamemode_fw_custom.nut index c295d596d..b7f7fbf69 100644 --- a/Northstar.Custom/mod/scripts/vscripts/gamemodes/sh_gamemode_fw_custom.nut +++ b/Northstar.Custom/mod/scripts/vscripts/gamemodes/sh_gamemode_fw_custom.nut @@ -79,7 +79,7 @@ void function FWOnRegisteringNetworkVars() if ( GAMETYPE != FORT_WAR ) return - Remote_RegisterFunction( "ServerCallback_FW_NotifyNeedsEnterEnemyArea" ) + NSRemote_RegisterFunction( "ServerCallback_FW_NotifyNeedsEnterEnemyArea" ) RegisterNetworkedVariable( "turretSite1", SNDC_GLOBAL, SNVT_ENTITY ) RegisterNetworkedVariable( "turretSite2", SNDC_GLOBAL, SNVT_ENTITY ) diff --git a/Northstar.Custom/mod/scripts/vscripts/gamemodes/sh_gamemode_hidden.nut b/Northstar.Custom/mod/scripts/vscripts/gamemodes/sh_gamemode_hidden.nut index 78357d200..f4ae84644 100644 --- a/Northstar.Custom/mod/scripts/vscripts/gamemodes/sh_gamemode_hidden.nut +++ b/Northstar.Custom/mod/scripts/vscripts/gamemodes/sh_gamemode_hidden.nut @@ -39,6 +39,6 @@ void function HiddenRegisterNetworkVars() if ( GAMETYPE != GAMEMODE_HIDDEN ) return - Remote_RegisterFunction( "ServerCallback_YouAreHidden" ) - Remote_RegisterFunction( "ServerCallback_AnnounceHidden" ) + NSRemote_RegisterFunction( "ServerCallback_YouAreHidden" ) + NSRemote_RegisterFunction( "ServerCallback_AnnounceHidden" ) } diff --git a/Northstar.Custom/mod/scripts/vscripts/gamemodes/sh_gamemode_hs.gnut b/Northstar.Custom/mod/scripts/vscripts/gamemodes/sh_gamemode_hs.gnut index f4269ac42..016dee3f4 100644 --- a/Northstar.Custom/mod/scripts/vscripts/gamemodes/sh_gamemode_hs.gnut +++ b/Northstar.Custom/mod/scripts/vscripts/gamemodes/sh_gamemode_hs.gnut @@ -40,8 +40,8 @@ void function HideAndSeekRegisterNetworkVars() if ( GAMETYPE != GAMEMODE_HIDEANDSEEK ) return - Remote_RegisterFunction( "ServerCallback_ShowHideAndSeekCountdown" ) - Remote_RegisterFunction( "ServerCallback_SeekersIncoming" ) - Remote_RegisterFunction( "ServerCallback_LastHiderAlive" ) - Remote_RegisterFunction( "ServerCallback_AnnounceHideAndSeekRole" ) + NSRemote_RegisterFunction( "ServerCallback_ShowHideAndSeekCountdown" ) + NSRemote_RegisterFunction( "ServerCallback_SeekersIncoming" ) + NSRemote_RegisterFunction( "ServerCallback_LastHiderAlive" ) + NSRemote_RegisterFunction( "ServerCallback_AnnounceHideAndSeekRole" ) } \ No newline at end of file diff --git a/Northstar.Custom/mod/scripts/vscripts/gamemodes/sh_gamemode_inf.gnut b/Northstar.Custom/mod/scripts/vscripts/gamemodes/sh_gamemode_inf.gnut index bcd863786..676e4f9a2 100644 --- a/Northstar.Custom/mod/scripts/vscripts/gamemodes/sh_gamemode_inf.gnut +++ b/Northstar.Custom/mod/scripts/vscripts/gamemodes/sh_gamemode_inf.gnut @@ -40,9 +40,9 @@ void function InfectionRegisterNetworkVars() if ( GAMETYPE != GAMEMODE_INFECTION ) return - Remote_RegisterFunction( "ServerCallback_YouAreInfected" ) - Remote_RegisterFunction( "ServerCallback_AnnounceFirstInfected" ) - Remote_RegisterFunction( "ServerCallback_AnnounceLastSurvivor" ) + NSRemote_RegisterFunction( "ServerCallback_YouAreInfected" ) + NSRemote_RegisterFunction( "ServerCallback_AnnounceFirstInfected" ) + NSRemote_RegisterFunction( "ServerCallback_AnnounceLastSurvivor" ) } int function CompareAssaultScoreAndInfection( entity a, entity b ) diff --git a/Northstar.Custom/mod/scripts/vscripts/gamemodes/sh_gamemode_kr.gnut b/Northstar.Custom/mod/scripts/vscripts/gamemodes/sh_gamemode_kr.gnut index 7cd91de9d..fe43ffa17 100644 --- a/Northstar.Custom/mod/scripts/vscripts/gamemodes/sh_gamemode_kr.gnut +++ b/Northstar.Custom/mod/scripts/vscripts/gamemodes/sh_gamemode_kr.gnut @@ -43,9 +43,9 @@ void function KRRegisterNetworkVars() if ( GAMETYPE != GAMEMODE_KR ) return - Remote_RegisterFunction( "ServerCallback_FlagSpawnIncoming" ) - Remote_RegisterFunction( "ServerCallback_NewKillRacer" ) - Remote_RegisterFunction( "ServerCallback_EndKillrace" ) + NSRemote_RegisterFunction( "ServerCallback_FlagSpawnIncoming" ) + NSRemote_RegisterFunction( "ServerCallback_NewKillRacer" ) + NSRemote_RegisterFunction( "ServerCallback_EndKillrace" ) RegisterNetworkedVariable( "killRaceTime", SNDC_PLAYER_EXCLUSIVE, SNVT_TIME, 0.0 ) diff --git a/Northstar.Custom/mod/scripts/vscripts/gamemodes/sh_gamemode_sns.gnut b/Northstar.Custom/mod/scripts/vscripts/gamemodes/sh_gamemode_sns.gnut index df3368673..d98eeae55 100644 --- a/Northstar.Custom/mod/scripts/vscripts/gamemodes/sh_gamemode_sns.gnut +++ b/Northstar.Custom/mod/scripts/vscripts/gamemodes/sh_gamemode_sns.gnut @@ -54,6 +54,7 @@ void function SNSRegisterNetworkVars() { if ( GAMETYPE != GAMEMODE_SNS ) return - Remote_RegisterFunction( "ServerCallback_AnnounceBankrupt" ) - Remote_RegisterFunction( "ServerCallback_AnnounceKillLeaderBankrupt" ) + + NSRemote_RegisterFunction( "ServerCallback_AnnounceBankrupt" ) + NSRemote_RegisterFunction( "ServerCallback_AnnounceKillLeaderBankrupt" ) } \ No newline at end of file diff --git a/Northstar.Custom/mod/scripts/vscripts/sh_3psequence_to_1p_hacks.gnut b/Northstar.Custom/mod/scripts/vscripts/sh_3psequence_to_1p_hacks.gnut index 4d4d27440..eb3ebcb6e 100644 --- a/Northstar.Custom/mod/scripts/vscripts/sh_3psequence_to_1p_hacks.gnut +++ b/Northstar.Custom/mod/scripts/vscripts/sh_3psequence_to_1p_hacks.gnut @@ -40,7 +40,7 @@ void function FirstPersonSequenceForce1P_InitPlaylistVars() void function FirstPersonSequenceForce1P_RegisterCustomNetworkFunctions() { - Remote_RegisterFunction( "ServerCallback_HideHudForFPHackAnim" ) + NSRemote_RegisterFunction( "ServerCallback_HideHudForFPHackAnim" ) } #if SERVER diff --git a/Northstar.Custom/mod/scripts/vscripts/sh_bleedout_damage.gnut b/Northstar.Custom/mod/scripts/vscripts/sh_bleedout_damage.gnut index d7373a9ba..4b6873207 100644 --- a/Northstar.Custom/mod/scripts/vscripts/sh_bleedout_damage.gnut +++ b/Northstar.Custom/mod/scripts/vscripts/sh_bleedout_damage.gnut @@ -22,10 +22,10 @@ void function BleedoutDamage_PreInit() void function Bleedout_RegisterRemoteFunctions() { - Remote_RegisterFunction( "ServerCallback_BLEEDOUT_StartFirstAidProgressBar" ) - Remote_RegisterFunction( "ServerCallback_BLEEDOUT_StopFirstAidProgressBar" ) - Remote_RegisterFunction( "ServerCallback_BLEEDOUT_ShowWoundedMarker" ) - Remote_RegisterFunction( "ServerCallback_BLEEDOUT_HideWoundedMarker" ) + NSRemote_RegisterFunction( "ServerCallback_BLEEDOUT_StartFirstAidProgressBar" ) + NSRemote_RegisterFunction( "ServerCallback_BLEEDOUT_StopFirstAidProgressBar" ) + NSRemote_RegisterFunction( "ServerCallback_BLEEDOUT_ShowWoundedMarker" ) + NSRemote_RegisterFunction( "ServerCallback_BLEEDOUT_HideWoundedMarker" ) } // copied from sh_bleedout diff --git a/Northstar.Custom/mod/scripts/vscripts/sh_remote_wrapper.gnut b/Northstar.Custom/mod/scripts/vscripts/sh_remote_wrapper.gnut new file mode 100644 index 000000000..bc1020141 --- /dev/null +++ b/Northstar.Custom/mod/scripts/vscripts/sh_remote_wrapper.gnut @@ -0,0 +1,7 @@ +global function NSRemote_RegisterFunction + +void function NSRemote_RegisterFunction( string name ) +{ + if( !NSIsVanilla() ) + Remote_RegisterFunction( name ); +} \ No newline at end of file From 8414fa0942655c765f38a92969015822a896967d Mon Sep 17 00:00:00 2001 From: Will <39478251+VITALISED@users.noreply.github.com> Date: Thu, 2 May 2024 01:23:25 +1000 Subject: [PATCH 20/38] Disable non-vanilla modes on vanilla mode selector --- .../scripts/vscripts/ui/menu_mode_select.nut | 29 +++++++++++++++++-- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/Northstar.Client/mod/scripts/vscripts/ui/menu_mode_select.nut b/Northstar.Client/mod/scripts/vscripts/ui/menu_mode_select.nut index 605af3832..fe0ce267b 100644 --- a/Northstar.Client/mod/scripts/vscripts/ui/menu_mode_select.nut +++ b/Northstar.Client/mod/scripts/vscripts/ui/menu_mode_select.nut @@ -2,6 +2,23 @@ global function InitModesMenu struct { int currentModePage + array modes = [ // default modes in vanilla + "tdm", + "aitdm", + "cp", + "at", + "ctf", + "lts", + "ps", + "speedball", + "mfd", + "ttdm", + "fd_easy", + "fd_normal", + "fd_hard", + "fd_master", + "fd_insane" + ] } file const int MODES_PER_PAGE = 15 @@ -39,24 +56,30 @@ void function UpdateVisibleModes() Hud_SetEnabled( button, false ) Hud_SetVisible( button, false ) } - + array modesArray = GetPrivateMatchModes() + for ( int i = 0; i < MODES_PER_PAGE; i++ ) { if ( i + ( file.currentModePage * MODES_PER_PAGE ) >= modesArray.len() ) break - + int modeIndex = i + ( file.currentModePage * MODES_PER_PAGE ) SetButtonRuiText( buttons[ i ], GetGameModeDisplayName( modesArray[ modeIndex ] ) ) Hud_SetEnabled( buttons[ i ], true ) Hud_SetVisible( buttons[ i ], true ) - + // This check is refactored in the new mode menu so we can just ignore this atrocity if ( !ModeSettings_RequiresAI( modesArray[ modeIndex ] ) || modesArray[ modeIndex ] == "aitdm" || modesArray[ modeIndex ] == "at" ) Hud_SetLocked( buttons[ i ], false ) else Hud_SetLocked( buttons[ i ], true ) + + if ( !file.modes.contains( modesArray[ modeIndex ] ) && NSIsVanilla() ) + { + Hud_SetLocked( buttons[ i ], true ) + } } } From 0643c470cc316f31c9527c99fbb4cf6152fab7f6 Mon Sep 17 00:00:00 2001 From: Will <39478251+VITALISED@users.noreply.github.com> Date: Thu, 2 May 2024 01:26:27 +1000 Subject: [PATCH 21/38] Switch around attrition and skirmish because why --- Northstar.Client/mod/scripts/vscripts/ui/menu_mode_select.nut | 2 +- .../mod/scripts/vscripts/lobby/sh_lobby.gnut | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Northstar.Client/mod/scripts/vscripts/ui/menu_mode_select.nut b/Northstar.Client/mod/scripts/vscripts/ui/menu_mode_select.nut index fe0ce267b..5f548910e 100644 --- a/Northstar.Client/mod/scripts/vscripts/ui/menu_mode_select.nut +++ b/Northstar.Client/mod/scripts/vscripts/ui/menu_mode_select.nut @@ -3,8 +3,8 @@ global function InitModesMenu struct { int currentModePage array modes = [ // default modes in vanilla - "tdm", "aitdm", + "tdm", "cp", "at", "ctf", diff --git a/Northstar.CustomServers/mod/scripts/vscripts/lobby/sh_lobby.gnut b/Northstar.CustomServers/mod/scripts/vscripts/lobby/sh_lobby.gnut index 9744bb64d..6af9995ec 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/lobby/sh_lobby.gnut +++ b/Northstar.CustomServers/mod/scripts/vscripts/lobby/sh_lobby.gnut @@ -16,8 +16,8 @@ global struct CustomMatchSettingContainer struct { array modes = [ // default modes in vanilla - "tdm", "aitdm", + "tdm", "cp", "at", "ctf", From 371f285d7c9508a95120ae45ed894423476832a0 Mon Sep 17 00:00:00 2001 From: Will <39478251+VITALISED@users.noreply.github.com> Date: Thu, 2 May 2024 01:32:35 +1000 Subject: [PATCH 22/38] Lock private match store buttons --- .../vscripts/ui/menu_private_match.nut | 28 ++++++++++++++++--- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/Northstar.Client/mod/scripts/vscripts/ui/menu_private_match.nut b/Northstar.Client/mod/scripts/vscripts/ui/menu_private_match.nut index cb9961275..f658402d0 100644 --- a/Northstar.Client/mod/scripts/vscripts/ui/menu_private_match.nut +++ b/Northstar.Client/mod/scripts/vscripts/ui/menu_private_match.nut @@ -41,6 +41,8 @@ struct var titanButton var boostsButton var storeButton + var storeNewReleasesButton + var storeBundlesButton var factionButton var bannerButton var patchButton @@ -313,10 +315,10 @@ void function SetupComboButtons( var menu, var navUpButton, var navDownButton ) file.storeHeader = AddComboButtonHeader( comboStruct, headerIndex, "#MENU_HEADER_STORE" ) file.storeButton = AddComboButton( comboStruct, headerIndex, buttonIndex++, "#MENU_TITLE_STORE_BROWSE" ) Hud_AddEventHandler( file.storeButton, UIE_CLICK, OnStoreButton_Activate ) - var storeNewReleasesButton = AddComboButton( comboStruct, headerIndex, buttonIndex++, "#MENU_TITLE_STORE_NEW_RELEASES" ) - Hud_AddEventHandler( storeNewReleasesButton, UIE_CLICK, OnStoreNewReleasesButton_Activate ) - var storeBundlesButton = AddComboButton( comboStruct, headerIndex, buttonIndex++, "#MENU_TITLE_STORE_BUNDLES" ) - Hud_AddEventHandler( storeBundlesButton, UIE_CLICK, OnStoreBundlesButton_Activate ) + file.storeNewReleasesButton = AddComboButton( comboStruct, headerIndex, buttonIndex++, "#MENU_TITLE_STORE_NEW_RELEASES" ) + Hud_AddEventHandler( file.storeNewReleasesButton, UIE_CLICK, OnStoreNewReleasesButton_Activate ) + file.storeBundlesButton = AddComboButton( comboStruct, headerIndex, buttonIndex++, "#MENU_TITLE_STORE_BUNDLES" ) + Hud_AddEventHandler( file.storeBundlesButton, UIE_CLICK, OnStoreBundlesButton_Activate ) headerIndex++ buttonIndex = 0 @@ -566,6 +568,8 @@ function UpdatePrivateMatchButtons() { var menu = file.menu + UpdateStoreButtons() + if ( level.ui.privatematch_starting == ePrivateMatchStartState.STARTING ) { RHud_SetText( file.startMatchButton, "#STOP_MATCH" ) @@ -591,6 +595,22 @@ function UpdatePrivateMatchButtons() } } +function UpdateStoreButtons() +{ + if ( NSIsVanilla() ) + { + Hud_SetLocked( file.storeButton, false ) + Hud_SetLocked( file.storeNewReleasesButton, false ) + Hud_SetLocked( file.storeBundlesButton, false ) + } + else + { + Hud_SetLocked( file.storeButton, true ) + Hud_SetLocked( file.storeNewReleasesButton, true ) + Hud_SetLocked( file.storeBundlesButton, true ) + } +} + function UpdateLobbyUI() { if ( uiGlobal.updatingLobbyUI ) From d5c08d0696c4cf7e8f4b5739f5660bcc7379b9fb Mon Sep 17 00:00:00 2001 From: Will <39478251+VITALISED@users.noreply.github.com> Date: Thu, 2 May 2024 02:45:44 +1000 Subject: [PATCH 23/38] Move remote function code to CustomServers --- Northstar.Client/mod/scripts/vscripts/ui/menu_main.nut | 3 +-- Northstar.Custom/mod.json | 4 ---- .../mod/scripts/vscripts/sh_remote_wrapper.gnut | 7 ------- .../scripts/vscripts/sh_remote_functions_mp_custom.gnut | 7 +++++++ 4 files changed, 8 insertions(+), 13 deletions(-) delete mode 100644 Northstar.Custom/mod/scripts/vscripts/sh_remote_wrapper.gnut diff --git a/Northstar.Client/mod/scripts/vscripts/ui/menu_main.nut b/Northstar.Client/mod/scripts/vscripts/ui/menu_main.nut index 3e8ca49a7..2d014daf6 100644 --- a/Northstar.Client/mod/scripts/vscripts/ui/menu_main.nut +++ b/Northstar.Client/mod/scripts/vscripts/ui/menu_main.nut @@ -73,8 +73,6 @@ void function OnMainMenu_Open() Signal( uiGlobal.signalDummy, "EndOnMainMenu_Open" ) EndSignal( uiGlobal.signalDummy, "EndOnMainMenu_Open" ) - NSResetToken() - // SetConVarString( "communities_hostname", "" ) // disable communities due to crash exploits that are still possible through it UpdatePromoData() // On script restarts this gives us the last data until the new request is complete @@ -300,6 +298,7 @@ void function LaunchSPTrialMission() void function LaunchMP() { uiGlobal.launching = eLaunching.MULTIPLAYER + NSResetToken() LaunchGame() } diff --git a/Northstar.Custom/mod.json b/Northstar.Custom/mod.json index dbe58dbf5..69432f498 100644 --- a/Northstar.Custom/mod.json +++ b/Northstar.Custom/mod.json @@ -440,10 +440,6 @@ "Path": "sh_northstar_safe_io.gnut", "RunOn": "CLIENT || SERVER || UI" }, - { - "Path": "sh_remote_wrapper.gnut", - "RunOn": "CLIENT || SERVER || UI" - }, { "Path": "_testing.nut", "RunOn": "CLIENT || SERVER || UI", diff --git a/Northstar.Custom/mod/scripts/vscripts/sh_remote_wrapper.gnut b/Northstar.Custom/mod/scripts/vscripts/sh_remote_wrapper.gnut deleted file mode 100644 index bc1020141..000000000 --- a/Northstar.Custom/mod/scripts/vscripts/sh_remote_wrapper.gnut +++ /dev/null @@ -1,7 +0,0 @@ -global function NSRemote_RegisterFunction - -void function NSRemote_RegisterFunction( string name ) -{ - if( !NSIsVanilla() ) - Remote_RegisterFunction( name ); -} \ No newline at end of file diff --git a/Northstar.CustomServers/mod/scripts/vscripts/sh_remote_functions_mp_custom.gnut b/Northstar.CustomServers/mod/scripts/vscripts/sh_remote_functions_mp_custom.gnut index c1e49e765..891c0991e 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/sh_remote_functions_mp_custom.gnut +++ b/Northstar.CustomServers/mod/scripts/vscripts/sh_remote_functions_mp_custom.gnut @@ -1,6 +1,7 @@ untyped global function InitCustomNetworkVars global function AddCallback_OnRegisteringCustomNetworkVars +global function NSRemote_RegisterFunction struct { array onRegisteringCustomNetworkVarsCallbacks @@ -17,4 +18,10 @@ void function InitCustomNetworkVars() void function AddCallback_OnRegisteringCustomNetworkVars( void functionref() callback ) { file.onRegisteringCustomNetworkVarsCallbacks.append( callback ) +} + +void function NSRemote_RegisterFunction( string name ) +{ + if( !NSIsVanilla() ) + Remote_RegisterFunction( name ); } \ No newline at end of file From 7cbf509d4d9608359fe5e6a34da49a13f31a35d0 Mon Sep 17 00:00:00 2001 From: Will <39478251+VITALISED@users.noreply.github.com> Date: Thu, 2 May 2024 04:58:44 +1000 Subject: [PATCH 24/38] Stub buttons better --- .../scripts/vscripts/ui/menu_community.nut | 2650 ----------------- .../mod/scripts/vscripts/ui/menu_inbox.nut | 716 ----- .../mod/scripts/vscripts/ui/menu_lobby.nut | 30 +- 3 files changed, 27 insertions(+), 3369 deletions(-) delete mode 100644 Northstar.Client/mod/scripts/vscripts/ui/menu_community.nut delete mode 100644 Northstar.Client/mod/scripts/vscripts/ui/menu_inbox.nut diff --git a/Northstar.Client/mod/scripts/vscripts/ui/menu_community.nut b/Northstar.Client/mod/scripts/vscripts/ui/menu_community.nut deleted file mode 100644 index 30098a7cf..000000000 --- a/Northstar.Client/mod/scripts/vscripts/ui/menu_community.nut +++ /dev/null @@ -1,2650 +0,0 @@ -global function InitCommunitiesMenu -global function InitMyNetworksMenu - -global function Community_CommunityUpdated -global function UICodeCallback_ShowCommunityInfo -global function UICodeCallback_CommunitySaved -global function UICodeCallback_CommunitySaveFailed -global function UICodeCallback_ShowCommunityJoinRequest -global function OnSwitchButton_Activate -global function OnBrowseNetworksButton_Activate -#if NETWORK_INVITE -global function OnInviteFriendsToNetworkButton_Activate -#endif - -const int ADVOCATE_NETWORK = 1 - -struct CommunityPanel -{ - int CommunityId - var Name - var Creator - var Members - var MOTD - var Kills - var Wins - var Losses - var Deaths - var XP - var LanguagesLabel - var RegionsLabel - var CategoriesLabel - var CommunityTypeLabel - var MembershipTypeLabel - var VisibilityLabel - var MicPolicyLabel - var HappyHourStartLabel - var CommunityNameRui -} - -struct -{ - CommunitySettings &settings - array languages - array categories - array regions - - bool haveSettings - bool firstCommunityUpdateHappened - - var menu - - var switchButton - var editButton - var sendMessageButton - var sendButton - var chatroomToggleVoiceModeHeader - var chatroomToggleVoiceModeButton0 - var chatroomToggleVoiceModeButton1 - - var chatroomMenu - var chatroomMenu_chatroomWidget - - var switchCommunityMenu - var switchCommunityPanel - var switchCommunityPanel_CommunityInfoPanel - array switchCommunityPanelButtons - array switchCommunityPanelHints - var switchCommunityPanelCover - var switchCommunityPanel_ListWidget - - string region - string language - - BrowseFilters browseFilters - - UserInfoPanel pendingJoinRequestPanel - var pendingJoinRequest_CommunityName - var pendingJoinRequest_AcceptButton - var adminViewPendingRequests - var adminViewPendingRequestsButton - int totalJoinRequests - - var browseCommunitiesPanel_LastFocused - - var browseCommunitiesMenu - var browseCommunitiesPanel - var browseCommunitiesPanel_CommunityInfoPanel - var browseCommunitiesPanel_FilterBackground - var browseCommunitiesPanel_ListWidget - var browseCommunitiesPanel_NameWidget - var browseCommunitiesPanel_ClantagWidget - var browseCommunitiesPanel_TypeButton - var browseCommunitiesPanel_MembershipButton - var browseCommunitiesPanel_CategoryButton - var browseCommunitiesPanel_PlaytimeButton - var browseCommunitiesPanel_MicPolicyButton - var browseCommunitiesPanel_MinMembersButton - var browseCommunitiesPanel_ViewDetailsButton - array browseCommunitiesPanel_HintElements - array browseCommunitiesPanel_FilterElements - - int reportAbuseCommunityId - array reportedCommunityIds - - var editCommunityMenu - var editCommunityLanguagesPanel - var editCommunityCategoriesPanel - var editCommunityRegionsPanel - var editCommunityHappyHourPanel - - var editCommunityPanel_PopupBackground - var editCommunityPanel_Header - var editCommunityPanel_Name - var editCommunityPanel_NameLabel - var editCommunityPanel_NameBigLabel - var editCommunityPanel_Clantag - var editCommunityPanel_MOTD - var editCommunityPanel_LanguagesButton - var editCommunityPanel_RegionsButton - var editCommunityPanel_CategoriesButton - var editCommunityPanel_CommunityTypeButton - var editCommunityPanel_MembershipTypeButton - var editCommunityPanel_VisibilityButton - var editCommunityPanel_MicPolicyButton - var editCommunityPanel_HappyHourStartButton - var editCommunityPanel_CreateButton - var editCommunityPanel_SaveButton - - array editCommunityLanguagesPanel_LanguageButtons - array editCommunityRegionsPanel_RegionButtons - array editCommunityCategoriesPanel_CategoryButtons - array editCommunityHappyHourPanel_HappyHourButtons - - bool communityEdited = false - - var sendCommunityMsgMenu - int sendCommunityMsg_expiration - var sendCommunityMsgPanel_ExpirationButton - var sendCommunityMsgPanel_MsgText - var sendCommunityMsgPanel_CommunityName - var sendCommunityMsgPanel_SendButton - - CommunityPanel communityInfoPanelWidgets - CommunityPanel myCommunityInfoPanelWidgets - - var selectNetWorkbutton -// var browseNetworkButton - bool inCommunityPanel - array temporaryPanels - var lastButtonFocused - table keysToStrings - int currentCommunityId - - ComboStruct &networksComboStruct -} file - -void function HideAllPanels() -{ - Hud_Hide( file.editCommunityPanel_PopupBackground ) - Hud_Hide( file.editCommunityHappyHourPanel ) - Hud_Hide( file.editCommunityLanguagesPanel ) - Hud_Hide( file.editCommunityRegionsPanel ) - Hud_Hide( file.editCommunityCategoriesPanel ) - Hud_Hide( file.editCommunityHappyHourPanel ) -} - -void function OnSwitchButton_Activate( var button ) -{ - if( Hud_IsLocked( button ) ) - return - - ClientCommand( "community_list" ) - AdvanceMenu( file.switchCommunityMenu ) - Hud_SetFocused( file.selectNetWorkbutton ) -} - - -void function OnBrowseNetworksButton_Activate( var button ) -{ - if( Hud_IsLocked( button ) ) - return - - UpdateBrowseFilters( file.browseFilters ) - AdvanceMenu( file.browseCommunitiesMenu ) - BrowseCommunities_OnChange( file.browseCommunitiesPanel_ListWidget ) - //Hud_SetFocused( file.browseCommunitiesPanel_ListWidget ) - Hud_SetFocused( file.browseCommunitiesPanel_NameWidget ) - CommunitySettings fakeSettings - FillInCommunityInfoPanel( fakeSettings, file.communityInfoPanelWidgets ) -} - -void function FillInBrowseFilters( BrowseFilters filters ) -{ - Hud_SetText( file.browseCommunitiesPanel_NameWidget, filters.name ) - Hud_SetText( file.browseCommunitiesPanel_ClantagWidget, filters.clantag ) - - if ( filters.communityType == "social" ) - Hud_SetText( file.browseCommunitiesPanel_TypeButton, "#COMMUNITY_SOCIAL" ) - else if ( filters.communityType == "competitive" ) - Hud_SetText( file.browseCommunitiesPanel_TypeButton, "#COMMUNITY_COMPETITIVE" ) - else - Hud_SetText( file.browseCommunitiesPanel_TypeButton, "#COMMUNITY_FILTER_ANY" ) - - if ( filters.micPolicy == "nopref" ) - Hud_SetText( file.browseCommunitiesPanel_MicPolicyButton, "#COMMUNITY_MICS_NOPREF" ) - else if ( filters.micPolicy == "yes" ) - Hud_SetText( file.browseCommunitiesPanel_MicPolicyButton, "#COMMUNITY_MICS_YES" ) - else if ( filters.micPolicy == "no" ) - Hud_SetText( file.browseCommunitiesPanel_MicPolicyButton, "#COMMUNITY_MICS_NO" ) - else - Hud_SetText( file.browseCommunitiesPanel_MicPolicyButton, "#COMMUNITY_FILTER_ANY" ) - - if ( filters.membershipType == "invite" ) - Hud_SetText( file.browseCommunitiesPanel_MembershipButton, "#COMMUNITY_MEMBERSHIP_INVITEONLY" ) - else if ( filters.membershipType == "open" ) - Hud_SetText( file.browseCommunitiesPanel_MembershipButton, "#COMMUNITY_MEMBERSHIP_OPEN" ) - else - Hud_SetText( file.browseCommunitiesPanel_MembershipButton, "#COMMUNITY_FILTER_ANY" ) - - if ( filters.category == "gaming" ) - Hud_SetText( file.browseCommunitiesPanel_CategoryButton, "#COMMUNITY_CATEGORY_GAMING" ) - else if ( filters.category == "lifestyle" ) - Hud_SetText( file.browseCommunitiesPanel_CategoryButton, "#COMMUNITY_CATEGORY_LIFESTYLE" ) - else if ( filters.category == "geography" ) - Hud_SetText( file.browseCommunitiesPanel_CategoryButton, "#COMMUNITY_CATEGORY_GEOGRAPHY" ) - else if ( filters.category == "tech" ) - Hud_SetText( file.browseCommunitiesPanel_CategoryButton, "#COMMUNITY_CATEGORY_TECH" ) - else if ( filters.category == "other" ) - Hud_SetText( file.browseCommunitiesPanel_CategoryButton, "#COMMUNITY_CATEGORY_OTHER" ) - else - Hud_SetText( file.browseCommunitiesPanel_CategoryButton, "#COMMUNITY_FILTER_ANY" ) - - if ( filters.playtime == "morning" ) - Hud_SetText( file.browseCommunitiesPanel_PlaytimeButton, "#COMMUNITY_PLAYTIME_MORNING" ) - else if ( filters.playtime == "afternoon" ) - Hud_SetText( file.browseCommunitiesPanel_PlaytimeButton, "#COMMUNITY_PLAYTIME_AFTERNOON" ) - else if ( filters.playtime == "evening" ) - Hud_SetText( file.browseCommunitiesPanel_PlaytimeButton, "#COMMUNITY_PLAYTIME_EVENING" ) - else if ( filters.playtime == "night" ) - Hud_SetText( file.browseCommunitiesPanel_PlaytimeButton, "#COMMUNITY_PLAYTIME_NIGHTTIME" ) - else - Hud_SetText( file.browseCommunitiesPanel_PlaytimeButton, "#COMMUNITY_FILTER_ANY" ) - - if ( filters.minMembers == 1 ) - Hud_SetText( file.browseCommunitiesPanel_MinMembersButton, "#COMMUNITY_MEMBERCOUNTFILTER_1" ) - else if ( filters.minMembers == 2 ) - Hud_SetText( file.browseCommunitiesPanel_MinMembersButton, "#COMMUNITY_MEMBERCOUNTFILTER_2" ) - else if ( filters.minMembers == 10 ) - Hud_SetText( file.browseCommunitiesPanel_MinMembersButton, "#COMMUNITY_MEMBERCOUNTFILTER_10" ) - else if ( filters.minMembers == 100 ) - Hud_SetText( file.browseCommunitiesPanel_MinMembersButton, "#COMMUNITY_MEMBERCOUNTFILTER_100" ) - else if ( filters.minMembers == 1000 ) - Hud_SetText( file.browseCommunitiesPanel_MinMembersButton, "#COMMUNITY_MEMBERCOUNTFILTER_1000" ) - else if ( filters.minMembers == 10000 ) - Hud_SetText( file.browseCommunitiesPanel_MinMembersButton, "#COMMUNITY_MEMBERCOUNTFILTER_10000" ) - -} - -void function PopupBackground_Activate( var button ) -{ - // if this elements ran this callback, we could close the popup when you clicked outside of it -} - -void function OnBrowseMembershipTypeButton_Activate( var button ) -{ - if ( file.browseFilters.membershipType == "" ) - file.browseFilters.membershipType = "open"; - else if ( file.browseFilters.membershipType == "open" ) - file.browseFilters.membershipType = "invite"; - else if ( file.browseFilters.membershipType == "invite" ) - file.browseFilters.membershipType = ""; - - file.browseFilters.pageNum = 0 - FillInBrowseFilters( file.browseFilters ) - UpdateBrowseFilters( file.browseFilters ) -} - -void function Browse_ChangeCommunityType_Activate( var button ) -{ - if ( file.browseFilters.communityType == "social" ) - file.browseFilters.communityType = "competitive" - else if ( file.browseFilters.communityType == "competitive" ) - file.browseFilters.communityType = "" - else - file.browseFilters.communityType = "social" - - file.browseFilters.pageNum = 0 - FillInBrowseFilters( file.browseFilters ) - UpdateBrowseFilters( file.browseFilters ) -} - -void function Browse_ChangeCommunityMembership_Activate( var button ) -{ - if ( file.browseFilters.membershipType == "invite" ) - file.browseFilters.membershipType = "open" - else if ( file.browseFilters.membershipType == "open" ) - file.browseFilters.membershipType = "" - else - file.browseFilters.membershipType = "invite" - - file.browseFilters.pageNum = 0 - FillInBrowseFilters( file.browseFilters ) - UpdateBrowseFilters( file.browseFilters ) -} - -void function Browse_ChangeCommunityCategory_Activate( var button ) -{ - if ( file.browseFilters.category == "gaming" ) - file.browseFilters.category = "lifestyle" - else if ( file.browseFilters.category == "lifestyle" ) - file.browseFilters.category = "geography" - else if ( file.browseFilters.category == "geography" ) - file.browseFilters.category = "tech" - else if ( file.browseFilters.category == "tech" ) - file.browseFilters.category = "other" - else if ( file.browseFilters.category == "other" ) - file.browseFilters.category = "" - else - file.browseFilters.category = "gaming" - - file.browseFilters.pageNum = 0 - FillInBrowseFilters( file.browseFilters ) - UpdateBrowseFilters( file.browseFilters ) -} - -void function Browse_ChangeCommunityPlaytime_Activate( var button ) -{ - if ( file.browseFilters.playtime == "morning" ) - file.browseFilters.playtime = "afternoon" - else if ( file.browseFilters.playtime == "afternoon" ) - file.browseFilters.playtime = "evening" - else if ( file.browseFilters.playtime == "evening" ) - file.browseFilters.playtime = "night" - else if ( file.browseFilters.playtime == "night" ) - file.browseFilters.playtime = "" - else - file.browseFilters.playtime = "morning" - - file.browseFilters.pageNum = 0 - FillInBrowseFilters( file.browseFilters ) - UpdateBrowseFilters( file.browseFilters ) -} - -void function Browse_ChangeCommunityMicPolicy_Activate( var button ) -{ - if ( file.browseFilters.micPolicy == "nopref" ) - file.browseFilters.micPolicy = "yes"; - else if ( file.browseFilters.micPolicy == "yes" ) - file.browseFilters.micPolicy = "no"; - else if ( file.browseFilters.micPolicy == "no" ) - file.browseFilters.micPolicy = ""; - else if ( file.browseFilters.micPolicy == "" ) - file.browseFilters.micPolicy = "nopref"; - - file.browseFilters.pageNum = 0 - FillInBrowseFilters( file.browseFilters ) - UpdateBrowseFilters( file.browseFilters ) -} - -void function Browse_ChangeCommunityMinMembers_Activate( var button ) -{ - if ( file.browseFilters.minMembers <= 1 ) - file.browseFilters.minMembers = 2; - else if ( file.browseFilters.minMembers == 2 ) - file.browseFilters.minMembers = 10; - else if ( file.browseFilters.minMembers == 10 ) - file.browseFilters.minMembers = 100; - else if ( file.browseFilters.minMembers == 100 ) - file.browseFilters.minMembers = 1000; - else if ( file.browseFilters.minMembers == 1000 ) - file.browseFilters.minMembers = 10000; - else if ( file.browseFilters.minMembers == 10000 ) - file.browseFilters.minMembers = 1; - - file.browseFilters.pageNum = 0 - FillInBrowseFilters( file.browseFilters ) - UpdateBrowseFilters( file.browseFilters ) -} - -void function Browse_CommunityNameChanged( var textInput ) -{ - file.browseFilters.name = Hud_GetUTF8Text( file.browseCommunitiesPanel_NameWidget ) - file.browseFilters.pageNum = 0 - UpdateBrowseFilters( file.browseFilters ) -} - -void function Browse_CommunityClantagChanged( var textInput ) -{ - file.browseFilters.clantag = Hud_GetUTF8Text( file.browseCommunitiesPanel_ClantagWidget ) - file.browseFilters.pageNum = 0 - UpdateBrowseFilters( file.browseFilters ) -} - -void function OnEditCommunityButton_Activate( var button ) -{ - thread GetCommunitySettingsThread() - - Hud_SetText( file.editCommunityPanel_Header, "#MENUHEADER_COMMUNITY_EDIT" ) - Hud_SetText( file.editCommunityPanel_NameBigLabel, Hud_GetUTF8Text( file.editCommunityPanel_Name ) ) - Hud_Show( file.editCommunityPanel_NameBigLabel ) - Hud_Hide( file.editCommunityPanel_NameLabel ) - Hud_Hide( file.editCommunityPanel_Name ) - Hud_Hide( file.editCommunityPanel_CreateButton ) - Hud_Show( file.editCommunityPanel_SaveButton ) - AdvanceMenu( file.editCommunityMenu ) - Hud_SetFocused( file.editCommunityPanel_Clantag ) - file.communityEdited = false -} - -void function FillInSendMessageUI() -{ - string stringName - if ( file.sendCommunityMsg_expiration >= 24 ) - stringName = "#COMMUNITY_EXPIRES_" + (file.sendCommunityMsg_expiration/24) + "DAY"; - else - stringName = "#COMMUNITY_EXPIRES_" + file.sendCommunityMsg_expiration + "HOUR"; - Hud_SetUTF8Text( file.sendCommunityMsgPanel_ExpirationButton, Localize( stringName ) ); -} - -void function OnCommunitySendMsg_Open() -{ - OnStartSendCommunityMessageButton_Activate( null ) -} - -void function OnStartSendCommunityMessageButton_Activate( var button ) -{ - var communityName = GetCurrentCommunityName() - expect string(communityName) - Hud_SetUTF8Text( file.sendCommunityMsgPanel_CommunityName, Localize( communityName ) ) - Hud_SetUTF8Text( file.sendCommunityMsgPanel_MsgText, "" ) - FillInSendMessageUI() - AdvanceMenu( file.sendCommunityMsgMenu ) - Hud_SetFocused( file.sendCommunityMsgPanel_MsgText ) -} - -int function RotateExpirationPreset( int currentValue ) -{ - array intervals = [1, 12, 24, 2*24, 3*24, 5*24, 7*24]; - - for ( int i = 0; i < intervals.len()-1; i++ ) - { - if ( intervals[i] == currentValue ) - return intervals[i+1]; - } - return intervals[0]; -} - -void function OnChangeCommunityMessageExpirationButton_Activate( var button ) -{ - file.sendCommunityMsg_expiration = RotateExpirationPreset( file.sendCommunityMsg_expiration ) - FillInSendMessageUI(); -} - -void function OnActualSendCommunityMessageButton_Activate( var button ) -{ - DialogData dialogData - dialogData.header = "#COMMUNITY_SEND_CONFIRM" - - AddDialogButton( dialogData, "#YES", OnActualSendCommunityMessageButton_Confirm ) - AddDialogButton( dialogData, "#NO" ) - - dialogData.noChoiceWithNavigateBack = true - OpenDialog( dialogData ) -} - -void function OnActualSendCommunityMessageButton_Confirm() -{ - CloseActiveMenu() - Hud_SetFocused( file.sendMessageButton ) - - EmitUISound( "Menu_Email_Sent" ) - - string text = Hud_GetUTF8Text( file.sendCommunityMsgPanel_MsgText ) - BroadcastCommunityMessage( file.sendCommunityMsg_expiration, text ) -} - -void function OnViewPendingRequestButton_Activate( var button ) -{ - if ( file.totalJoinRequests ) - { - AdvanceMenu( file.adminViewPendingRequests ) - ClientCommand( "community_getPendingJoinRequest" ) - Hud_SetFocused( file.pendingJoinRequest_AcceptButton ) - } -} - -void function OnCreateCommunityButton_Activate( var button ) -{ - file.region = MyRegion() - - CommunitySettings settings - Assert( settings.communityId == 0 ) - settings.visibility = "public" - settings.membershipType = "open" - settings.communityType = "social" - settings.category = "gaming" - settings.micPolicy = "nopref" - for ( int i = 0; i < file.languages.len(); i++ ) - { - if ( file.languages[i].tolower() == GetLanguage().tolower() ) - { - settings.language1 = file.languages[i] - break - } - } - - settings.region1 = file.region - file.settings = settings - file.haveSettings = true - FillInCommunitySettingsPanel( file.settings ) - Hud_SetText( file.editCommunityPanel_Clantag, settings.clanTag ) - Hud_SetText( file.editCommunityPanel_Name, settings.name ) - Hud_SetText( file.editCommunityPanel_MOTD, settings.motd ) - - AdvanceMenu( file.editCommunityMenu ) - Hud_SetEnabled( file.editCommunityPanel_Name, true ) - - Hud_Show( file.editCommunityPanel_CreateButton ) - Hud_Hide( file.editCommunityPanel_SaveButton ) - - Hud_SetText( file.editCommunityPanel_Header, "#MENUHEADER_COMMUNITY_CREATE" ) - Hud_Show( file.editCommunityPanel_NameBigLabel ) - Hud_Show( file.editCommunityPanel_NameLabel ) - Hud_Hide( file.editCommunityPanel_NameBigLabel ) - Hud_Show( file.editCommunityPanel_Name ) - Hud_SetFocused( file.editCommunityPanel_Name ) -} - -void function OnLanguagesButton_Activate( var button ) -{ - ShowCommunityPanel( file.editCommunityLanguagesPanel ) - - file.inCommunityPanel = true - file.temporaryPanels.append( file.editCommunityLanguagesPanel ) - SetLanguageButtons() - file.lastButtonFocused = button - - Hud_SetFocused( file.editCommunityLanguagesPanel_LanguageButtons[0] ) -} - -void function SetLanguageButtons() -{ - int toggledCount = 0 - for ( int i = 0; i < file.languages.len(); i++ ) - { - if ( file.languages[i].tolower() == GetLanguage().tolower() ) - { - Hud_SetSelected( file.editCommunityLanguagesPanel_LanguageButtons[i], true ) - Hud_SetEnabled( file.editCommunityLanguagesPanel_LanguageButtons[i], false ) - } - else if ( file.settings.language1 == file.languages[i] || file.settings.language2 == file.languages[i] || file.settings.language3 == file.languages[i] ) - { - Hud_SetSelected( file.editCommunityLanguagesPanel_LanguageButtons[i], true ) - Hud_SetEnabled( file.editCommunityLanguagesPanel_LanguageButtons[i], true ) - } - else - { - Hud_SetSelected( file.editCommunityLanguagesPanel_LanguageButtons[i], false ) - Hud_SetEnabled( file.editCommunityLanguagesPanel_LanguageButtons[i], true ) - } - } - - UpdateComboSelectButtons( file.editCommunityLanguagesPanel_LanguageButtons, GetToggledLanguage( 2 ) != "" ) -} - -bool function HasRegionSelected( string region ) -{ - // boy I with this was an array - if ( file.settings.region1 == region || file.settings.region2 == region || file.settings.region3 == region || file.settings.region4 == region || file.settings.region5 == region ) - return true - return false -} - -void function SetRegionButtons() -{ - int toggledCount = 0 - for ( int i = 0; i < file.regions.len(); i++ ) - { - if ( file.regions[i] == file.region ) - { - Hud_SetSelected( file.editCommunityRegionsPanel_RegionButtons[i], true ) - Hud_SetEnabled( file.editCommunityRegionsPanel_RegionButtons[i], false ) - } - else if ( HasRegionSelected( file.regions[i] ) ) - { - Hud_SetSelected( file.editCommunityRegionsPanel_RegionButtons[i], true ) - Hud_SetEnabled( file.editCommunityRegionsPanel_RegionButtons[i], true ) - } - else - { - Hud_SetSelected( file.editCommunityRegionsPanel_RegionButtons[i], false ) - Hud_SetEnabled( file.editCommunityRegionsPanel_RegionButtons[i], true ) - } - } - - UpdateComboSelectButtons( file.editCommunityRegionsPanel_RegionButtons, GetToggledRegion( 2 ) != "" ) -} - -string function GetToggledLanguage( int index ) -{ - int toggledCount = 0 - for ( int i = 0; i < file.languages.len(); i++ ) - { - if ( Hud_IsSelected( file.editCommunityLanguagesPanel_LanguageButtons[i] ) ) - { - if ( index == toggledCount ) - { - var language = file.languages[i] - expect string(language) - return language; - } - toggledCount++ - } - } - return "" -} - -void function OnSaveLanguagesButton_Activate( var button ) -{ - HideAllPanels() - Hud_SetFocused( file.editCommunityPanel_LanguagesButton ) - - if ( !file.haveSettings ) - return - - file.settings.language1 = GetToggledLanguage( 0 ) - printt( "language1 is " + file.settings.language1 ) - file.settings.language2 = GetToggledLanguage( 1 ) - printt( "language2 is " + file.settings.language2 ) - file.settings.language3 = GetToggledLanguage( 2 ) - printt( "language3 is " + file.settings.language3 ) - - FillInCommunitySettingsPanel( file.settings ) - file.communityEdited = true -} - -string function GetToggledRegion( int index ) -{ - int toggledCount = 0 - for ( int i = 0; i < file.regions.len(); i++ ) - { - if ( Hud_IsSelected( file.editCommunityRegionsPanel_RegionButtons[i] ) ) - { - if ( index == toggledCount ) - { - var region = file.regions[i] - expect string(region) - return region; - } - toggledCount++ - } - } - return "" -} - -void function ShowCommunityPanel( var panel ) -{ - Hud_Show( file.editCommunityPanel_PopupBackground ) - file.temporaryPanels.append( file.editCommunityPanel_PopupBackground ) - - if ( panel == file.editCommunityRegionsPanel ) - Hud_Show( file.editCommunityRegionsPanel ) - else - Hud_Hide( file.editCommunityRegionsPanel ) - - if ( panel == file.editCommunityLanguagesPanel ) - Hud_Show( file.editCommunityLanguagesPanel ) - else - Hud_Hide( file.editCommunityLanguagesPanel ) - - if ( panel == file.editCommunityCategoriesPanel ) - Hud_Show( file.editCommunityCategoriesPanel ) - else - Hud_Hide( file.editCommunityCategoriesPanel ) - - if ( panel == file.editCommunityHappyHourPanel ) - Hud_Show( file.editCommunityHappyHourPanel ) - else - Hud_Hide( file.editCommunityHappyHourPanel ) -} - -void function OnRegionsButton_Activate( var button ) -{ - ShowCommunityPanel( file.editCommunityRegionsPanel ) - - file.inCommunityPanel = true - file.temporaryPanels.append( file.editCommunityRegionsPanel ) - file.lastButtonFocused = button - SetRegionButtons() - - Hud_SetFocused( file.editCommunityRegionsPanel_RegionButtons[0] ) -} - -void function OnSaveRegionsButton_Activate( var button ) -{ - HideAllPanels() - Hud_SetFocused( file.editCommunityPanel_RegionsButton ) - - if ( !file.haveSettings ) - return - - file.settings.region1 = GetToggledRegion( 0 ) - printt( "region1 is " + file.settings.region1 ) - file.settings.region2 = GetToggledRegion( 1 ) - printt( "region2 is " + file.settings.region2 ) - file.settings.region3 = GetToggledRegion( 2 ) - printt( "region3 is " + file.settings.region3 ) - file.settings.region4 = GetToggledRegion( 3 ) - printt( "region4 is " + file.settings.region4 ) - file.settings.region5 = GetToggledRegion( 4 ) - printt( "region5 is " + file.settings.region5 ) - - FillInCommunitySettingsPanel( file.settings ) - file.communityEdited = true -} - -void function OnCategoriesButton_Activate( var button ) -{ - ShowCommunityPanel( file.editCommunityCategoriesPanel ) - - int toggledCount = 0 - for ( int i = 0; i < file.categories.len(); i++ ) - { - if ( file.settings.category.tolower() == file.categories[i].tolower() ) - Hud_SetSelected( file.editCommunityCategoriesPanel_CategoryButtons[i], true ) - else - Hud_SetSelected( file.editCommunityCategoriesPanel_CategoryButtons[i], false ) - } - - file.inCommunityPanel = true - file.temporaryPanels.append( file.editCommunityCategoriesPanel ) - file.lastButtonFocused = button - - Hud_SetFocused( file.editCommunityCategoriesPanel_CategoryButtons[0] ) -} - -void function OnSaveCategoriesButton_Activate( var button ) -{ - for ( int i = 0; i < file.categories.len(); i++ ) - { - if ( file.editCommunityCategoriesPanel_CategoryButtons[i] == button ) - { - file.settings.category = file.categories[i] - break - } - } - printt( "category is " + file.settings.category ) - HideAllPanels() - Hud_SetFocused( file.editCommunityPanel_CategoriesButton ) - FillInCommunitySettingsPanel( file.settings ) - file.communityEdited = true -} - -void function FillInCommunitySettingsPanel( CommunitySettings settings ) -{ - string languages = Localize( ConvertKeyToLocalizedString( settings.language1 ) ) - if ( settings.language2 != "" ) - languages += ", " + Localize( ConvertKeyToLocalizedString( settings.language2 ) ) - if ( settings.language3 != "" ) - languages += ", " + Localize( ConvertKeyToLocalizedString( settings.language3 ) ) - - Hud_SetText( file.editCommunityPanel_LanguagesButton, languages ) - - string regions = settings.region1 - if ( settings.region2 != "" ) - regions += ", " + Localize( ConvertKeyToLocalizedString( settings.region2 ) ) - if ( settings.region3 != "" ) - regions += ", " + Localize( ConvertKeyToLocalizedString( settings.region3 ) ) - if ( settings.region4 != "" ) - regions += ", " + Localize( ConvertKeyToLocalizedString( settings.region4 ) ) - if ( settings.region5 != "" ) - regions += ", " + Localize( ConvertKeyToLocalizedString( settings.region5 ) ) - - Hud_SetText( file.editCommunityPanel_RegionsButton, regions ) - - if ( settings.communityType == "social" ) - Hud_SetText( file.editCommunityPanel_CommunityTypeButton, "#COMMUNITY_SOCIAL" ) - else - Hud_SetText( file.editCommunityPanel_CommunityTypeButton, "#COMMUNITY_COMPETITIVE" ) - - if ( settings.micPolicy == "nopref" ) - Hud_SetText( file.editCommunityPanel_MicPolicyButton, "#COMMUNITY_MICS_NOPREF" ) - else if ( settings.micPolicy == "yes" ) - Hud_SetText( file.editCommunityPanel_MicPolicyButton, "#COMMUNITY_MICS_YES" ) - else - Hud_SetText( file.editCommunityPanel_MicPolicyButton, "#COMMUNITY_MICS_NO" ) - - if ( settings.visibility == "public" ) - Hud_SetText( file.editCommunityPanel_VisibilityButton, "#COMMUNITY_VISIBILITY_PUBLIC" ) - else - Hud_SetText( file.editCommunityPanel_VisibilityButton, "#COMMUNITY_VISIBILITY_PRIVATE" ) - - if ( settings.membershipType == "invite" ) - Hud_SetText( file.editCommunityPanel_MembershipTypeButton, "#COMMUNITY_MEMBERSHIP_INVITEONLY" ) - else - Hud_SetText( file.editCommunityPanel_MembershipTypeButton, "#COMMUNITY_MEMBERSHIP_OPEN" ) - - printt( "setting category to " + settings.category ) - if ( settings.category == "gaming" ) - Hud_SetText( file.editCommunityPanel_CategoriesButton, "#COMMUNITY_CATEGORY_GAMING" ) - else if ( settings.category == "lifestyle" ) - Hud_SetText( file.editCommunityPanel_CategoriesButton, "#COMMUNITY_CATEGORY_LIFESTYLE" ) - else if ( settings.category == "geography" ) - Hud_SetText( file.editCommunityPanel_CategoriesButton, "#COMMUNITY_CATEGORY_GEOGRAPHY" ) - else if ( settings.category == "tech" ) - Hud_SetText( file.editCommunityPanel_CategoriesButton, "#COMMUNITY_CATEGORY_TECH" ) - else if ( settings.category == "other" ) - Hud_SetText( file.editCommunityPanel_CategoriesButton, "#COMMUNITY_CATEGORY_OTHER" ) - - SetRegionButtons() - SetLanguageButtons() - - printt( "happyHourStart: " + settings.happyHourStart ) - string happyHourString = "#COMMUNITY_HAPPYHOUR_" + settings.happyHourStart - printt( "happy hour is " + happyHourString ) - Hud_SetText( file.editCommunityPanel_HappyHourStartButton, happyHourString ) -} - -void function OnMembershipTypeButton_Activate( var button ) -{ - if ( !file.haveSettings ) - return - - if ( file.settings.membershipType == "invite" ) - file.settings.membershipType = "open"; - else - file.settings.membershipType = "invite"; - - FillInCommunitySettingsPanel( file.settings ) - file.communityEdited = true -} - -void function OnMicPolicyButton_Activate( var button ) -{ - if ( !file.haveSettings ) - return - - if ( file.settings.micPolicy == "nopref" ) - file.settings.micPolicy = "yes"; - else if ( file.settings.micPolicy == "yes" ) - file.settings.micPolicy = "no"; - else - file.settings.micPolicy = "nopref"; - - FillInCommunitySettingsPanel( file.settings ) - file.communityEdited = true -} - -void function OnVisibilityButton_Activate( var button ) -{ - if ( !file.haveSettings ) - return - - if ( file.settings.visibility == "public" ) - file.settings.visibility = "private"; - else - file.settings.visibility = "public"; - - FillInCommunitySettingsPanel( file.settings ) - file.communityEdited = true -} - -void function OnCommunityTypeButton_Activate( var button ) -{ - if ( !file.haveSettings ) - return - - if ( file.settings.communityType == "social" ) - file.settings.communityType = "competitive"; - else - file.settings.communityType = "social"; - - FillInCommunitySettingsPanel( file.settings ) - file.communityEdited = true - file.communityEdited = true -} - -void function OnHappyHourButton_Activate( var button ) -{ - HideAllPanels() - // Hud_Hide( file.editCommunityCategoriesPanel ) - // Hud_Hide( file.editCommunityLanguagesPanel ) - // Hud_Hide( file.editCommunityRegionsPanel ) - // Hud_Show( file.editCommunityHappyHourPanel ) - // Hud_SetFocused( file.editCommunityHappyHourPanel_HappyHourButtons[0] ) - - // file.inCommunityPanel = true - // file.temporaryPanels.append( file.editCommunityHappyHourPanel ) - // file.lastButtonFocused = button - - OnHappyHourNext( button ) - file.communityEdited = true -} - -void function OnHappyHourPrev( var button ) -{ - file.settings.happyHourStart = (file.settings.happyHourStart-1+24)%24 - SetHappyHour( file.settings.happyHourStart ) - - if ( Hud_GetHudName( button ) == "HappyHourLeftHidden" || Hud_GetHudName( button ) == "HappyHourRightHidden" ) - Hud_SetFocused( file.editCommunityPanel_HappyHourStartButton ) -} - -void function OnHappyHourNext( var button ) -{ - file.settings.happyHourStart = (file.settings.happyHourStart+1)%24 - SetHappyHour( file.settings.happyHourStart ) - - if ( Hud_GetHudName( button ) == "HappyHourLeftHidden" || Hud_GetHudName( button ) == "HappyHourRightHidden" ) - Hud_SetFocused( file.editCommunityPanel_HappyHourStartButton ) -} - -void function SetHappyHour( int startTime ) -{ - if ( !file.haveSettings ) - return - - file.settings.happyHourStart = startTime - - HideAllPanels() - // Hud_SetFocused( file.editCommunityPanel_HappyHourStartButton ) - - FillInCommunitySettingsPanel( file.settings ) -} - -void function OnHappyHour0Button_Activate( var button ) -{ - SetHappyHour( 0 ) -} - -void function OnHappyHour1Button_Activate( var button ) -{ - SetHappyHour( 1 ) -} - -void function OnHappyHour2Button_Activate( var button ) -{ - SetHappyHour( 2 ) -} - -void function OnHappyHour3Button_Activate( var button ) -{ - SetHappyHour( 3 ) -} - -void function OnHappyHour4Button_Activate( var button ) -{ - SetHappyHour( 4 ) -} - -void function OnHappyHour5Button_Activate( var button ) -{ - SetHappyHour( 5 ) -} - -void function OnHappyHour6Button_Activate( var button ) -{ - SetHappyHour( 6 ) -} - -void function OnHappyHour7Button_Activate( var button ) -{ - SetHappyHour( 7 ) -} - -void function OnHappyHour8Button_Activate( var button ) -{ - SetHappyHour( 8 ) -} - -void function OnHappyHour9Button_Activate( var button ) -{ - SetHappyHour( 9 ) -} - -void function OnHappyHour10Button_Activate( var button ) -{ - SetHappyHour( 10 ) -} - -void function OnHappyHour11Button_Activate( var button ) -{ - SetHappyHour( 11 ) -} - -void function OnHappyHour12Button_Activate( var button ) -{ - SetHappyHour( 12 ) -} - -void function OnHappyHour13Button_Activate( var button ) -{ - SetHappyHour( 13 ) -} - -void function OnHappyHour14Button_Activate( var button ) -{ - SetHappyHour( 14 ) -} - -void function OnHappyHour15Button_Activate( var button ) -{ - SetHappyHour( 15 ) -} - -void function OnHappyHour16Button_Activate( var button ) -{ - SetHappyHour( 16 ) -} - -void function OnHappyHour17Button_Activate( var button ) -{ - SetHappyHour( 17 ) -} - -void function OnHappyHour18Button_Activate( var button ) -{ - SetHappyHour( 18 ) -} - -void function OnHappyHour19Button_Activate( var button ) -{ - SetHappyHour( 19 ) -} - -void function OnHappyHour20Button_Activate( var button ) -{ - SetHappyHour( 20 ) -} - -void function OnHappyHour21Button_Activate( var button ) -{ - SetHappyHour( 21 ) -} - -void function OnHappyHour22Button_Activate( var button ) -{ - SetHappyHour( 22 ) -} - -void function OnHappyHour23Button_Activate( var button ) -{ - SetHappyHour( 23 ) -} - -void function UICodeCallback_CommunitySaved( int communityId ) -{ - printt( "communityId " + communityId + " saved successfully" ); - CloseActiveMenu() - HideAllPanels() - - Hud_SetFocused( file.editButton ) - thread GetCommunityInfoThread( communityId ) - file.communityEdited = false -} - -void function UICodeCallback_CommunitySaveFailed( int communityId ) -{ - printt( "communityId " + communityId + " failed to saved successfully" ); -} - -void function OnSaveCommunityButton_Activate( var button ) -{ - if ( !file.haveSettings ) - return - - file.settings.name = Hud_GetUTF8Text( file.editCommunityPanel_Name ) - file.settings.clanTag = Hud_GetUTF8Text( file.editCommunityPanel_Clantag ) - file.settings.motd = Hud_GetUTF8Text( file.editCommunityPanel_MOTD ) - - SaveCommunitySettings( file.settings ) - ClientCommand( "recheck" ) -} - -void function GetCommunitySettingsThread() -{ - while ( true ) - { - if ( GetCurrentCommunityId() < 0 ) - { - WaitFrameOrUntilLevelLoaded() - continue - } - - CommunitySettings ornull settings = GetCommunitySettings( GetCurrentCommunityId() ) - if ( !settings ) - { - file.haveSettings = false - wait 0.05 - } - else - { - file.haveSettings = true - expect CommunitySettings( settings ) - file.settings = settings - - Hud_SetText( file.editCommunityPanel_Clantag, settings.clanTag ) - Hud_SetText( file.editCommunityPanel_Name, settings.name ) - Hud_SetText( file.editCommunityPanel_MOTD, settings.motd ) - FillInCommunitySettingsPanel( file.settings ) - break - } - } -} - -void function Community_CommunityUpdated() -{ - if ( !file.firstCommunityUpdateHappened ) - file.firstCommunityUpdateHappened = true - - int currentCommunityId = GetCurrentCommunityId() - bool currentCommunityChanged = file.currentCommunityId != currentCommunityId - file.currentCommunityId = currentCommunityId - - CommunitySettings ornull settings = GetCommunitySettings( currentCommunityId ) - if ( settings != null ) // if you are not on the advocate network then you joined a new network - { - expect CommunitySettings( settings ) - if ( currentCommunityId != ADVOCATE_NETWORK ) - ScriptCallback_UnlockAchievement( achievements.JOIN_NETWORK ) - } - - if ( currentCommunityChanged && InPendingOpenInvite() ) - ClientCommand( "leaveopeninvite" ) - - string membershipLevel = GetCurrentCommunityMembershipLevel() - - // printt( "setting up community ui - you are " + membershipLevel + " of this community" ); - SetButtonRuiText( file.sendMessageButton, Localize( "#COMMUNITY_MESSAGE_SENDMESSAGE", GetCurrentCommunityName() ) ) - bool owner = membershipLevel == "owner" - bool admin = owner || membershipLevel == "admin" - Hud_SetEnabled( file.sendMessageButton, admin ) - Hud_SetEnabled( file.adminViewPendingRequestsButton, admin ) - - if ( admin && file.totalJoinRequests ) - { - Hud_Show( file.adminViewPendingRequestsButton ) - } - else - { - Hud_Hide( file.adminViewPendingRequestsButton ) - } - - Hud_SetEnabled( file.editButton, owner ) - - if ( owner ) - Hud_Show( file.editButton ) - else - Hud_Hide( file.editButton ) - - if ( admin ) - { - Hud_Show( file.sendButton ) - Hud_Show( file.sendMessageButton ) - } - else - { - Hud_Hide( file.sendButton ) - } - - Hud_SetEnabled( file.chatroomToggleVoiceModeButton0, admin ) - Hud_SetEnabled( file.chatroomToggleVoiceModeButton1, admin ) - if ( !file.inCommunityPanel ) - { - UpdateChatroomToggleVis( admin ) - } - - UpdateChatroomToggleText() - - ComboButtons_ResetColumnFocus( file.networksComboStruct ) - UpdateChatroomUI() - //UpdateArmoryMenu( admin, owner ) -} - -void function UpdateChatroomToggleVis( bool admin ) -{ - if ( admin ) - { - Hud_Show( file.chatroomToggleVoiceModeButton0 ) - Hud_Show( file.chatroomToggleVoiceModeButton1 ) - Hud_Show( file.chatroomToggleVoiceModeHeader ) - } - else - { - Hud_Hide( file.chatroomToggleVoiceModeButton0 ) - Hud_Hide( file.chatroomToggleVoiceModeButton1 ) - Hud_Hide( file.chatroomToggleVoiceModeHeader ) - } -} - -void function UpdateChatroomToggleText( int currentVoiceMode = -1 ) -{ - if ( currentVoiceMode == -1 ) - currentVoiceMode = GetConVarInt( "chatroom_voiceMode" ) - if ( currentVoiceMode == 0 ) - { - ComboButton_SetText( file.chatroomToggleVoiceModeButton0, Localize( "#MENU_TITLE_CHATROOM_SELECTED", Localize( "#MENU_TITLE_CHATROOM_FREETALK" ) ) ) - ComboButton_SetText( file.chatroomToggleVoiceModeButton1, Localize( "#MENU_TITLE_CHATROOM_ADMINSONLY" ) ) - } - else - { - ComboButton_SetText( file.chatroomToggleVoiceModeButton0, Localize( "#MENU_TITLE_CHATROOM_FREETALK" ) ) - ComboButton_SetText( file.chatroomToggleVoiceModeButton1, Localize( "#MENU_TITLE_CHATROOM_SELECTED", Localize( "#MENU_TITLE_CHATROOM_ADMINSONLY" ) ) ) - } -} - -void function GetCommunityInfoThread( int communityId ) -{ - EndSignal( uiGlobal.signalDummy, "StopCommunityLookups" ) - - wait 0.3 - - printt( "getting info on community " + communityId ) - - CommunitySettings fakeSettings - fakeSettings.name = Localize( "#COMMUNITY_FETCHING" ) - FillInCommunityInfoPanel( fakeSettings, file.myCommunityInfoPanelWidgets ) - FillInCommunityInfoPanel( fakeSettings, file.communityInfoPanelWidgets ) - file.communityInfoPanelWidgets.CommunityId = 0 - file.myCommunityInfoPanelWidgets.CommunityId = 0 - - while ( true ) - { - CommunitySettings ornull settings = GetCommunitySettings( communityId ) - if ( !settings ) - { - wait 0.05 - } - else - { - expect CommunitySettings( settings ) - if ( settings.doneResolving ) - printt( "Got fully resolved community info/settings for community " + communityId ) - - file.communityInfoPanelWidgets.CommunityId = communityId - file.myCommunityInfoPanelWidgets.CommunityId = communityId - FillInCommunityInfoPanel( settings, file.myCommunityInfoPanelWidgets ) - FillInCommunityInfoPanel( settings, file.communityInfoPanelWidgets ) - - if ( settings.doneResolving ) - return - wait 0.05 - } - } -} - -void function UICodeCallback_ShowCommunityInfo( int communityId ) -{ - printt( "Showing community info for communityId " + communityId ) - - Signal( uiGlobal.signalDummy, "StopCommunityLookups" ) - thread GetCommunityInfoThread( communityId ) -} - -void function LeaveCommunityButton_Activate( var button ) -{ - DialogData dialogData - CommunitySettings ornull settings = GetCommunitySettings( file.communityInfoPanelWidgets.CommunityId ) - - if ( settings == null ) - return - - expect CommunitySettings( settings ) - - string name = settings.name - dialogData.header = Localize( "#REALLY_LEAVE_COMMUNITY", name ) - - AddDialogButton( dialogData, "#YES", LeaveCommunityDialog ) - AddDialogButton( dialogData, "#NO" ) - - dialogData.noChoiceWithNavigateBack = true - OpenDialog( dialogData ) -} - -void function LeaveCommunityDialog() -{ - if ( AreWeInCommunity( file.communityInfoPanelWidgets.CommunityId ) ) - LeaveCommunity( file.communityInfoPanelWidgets.CommunityId ) -} - - -void function LeaveCurrentCommunityButton_Activate( var button ) -{ - DialogData dialogData - CommunitySettings ornull settings = GetCommunitySettings( GetCurrentCommunityId() ) - - if ( settings == null ) - return - - expect CommunitySettings( settings ) - - string name = settings.name - dialogData.header = Localize( "#REALLY_LEAVE_COMMUNITY", name ) - - AddDialogButton( dialogData, "#YES", LeaveCurrentCommunityDialog ) - AddDialogButton( dialogData, "#NO" ) - - dialogData.noChoiceWithNavigateBack = true - OpenDialog( dialogData ) -} - -void function LeaveCurrentCommunityDialog() -{ - if ( AreWeInCommunity( GetCurrentCommunityId() ) ) - LeaveCommunity( GetCurrentCommunityId() ) -} - -void function UICodeCallback_ShowCommunityJoinRequest( int communityId, int totalRemainingRequests, string requesterUID, string requesterHardware ) -{ - printt( totalRemainingRequests + " total requests left to answer" ) - file.totalJoinRequests = totalRemainingRequests - - Signal( uiGlobal.signalDummy, "StopUserJoinRequestLookups" ) - if ( !totalRemainingRequests ) - { - if ( Hud_IsVisible( file.adminViewPendingRequests ) ) - CloseActiveMenu() - } - else - { - if ( requesterUID != "0" ) - thread GetPendingJoinUserInfoThread( communityId, requesterHardware, requesterUID ) - } -} - -void function JoinRequest_Accept( var button ) -{ - Signal( uiGlobal.signalDummy, "StopUserJoinRequestLookups" ) - ClientCommand( "community_getPendingJoinRequest 1" ) -} - -void function JoinRequest_Deny( var button ) -{ - Signal( uiGlobal.signalDummy, "StopUserJoinRequestLookups" ) - ClientCommand( "community_getPendingJoinRequest 0" ) -} - - -void function GetPendingJoinUserInfoThread( int communityId, string hardware, string userId ) -{ - EndSignal( uiGlobal.signalDummy, "StopUserJoinRequestLookups" ) - printt( "pendingJoin getting userinfo for user " + userId ) - - CommunityUserInfo fakeSettings - fakeSettings.name = Localize( "#COMMUNITY_FETCHING" ) - FillInUserInfoPanel( file.pendingJoinRequestPanel, fakeSettings ) - - while ( true ) - { - CommunitySettings ornull settings = GetCommunitySettings( communityId ) - CommunityUserInfo ornull userInfo = GetCommunityUserInfo( hardware, userId ) - - if ( !userInfo || !settings ) - { - printt( "pendingJoin asking for userinfo for " + hardware + "=" + userId ) - wait 0.05 - } - else - { - printt( "Got user info for user " + userId + " on hardware " + hardware ) - expect CommunityUserInfo( userInfo ) - expect CommunitySettings( settings ) - - printt( "User " + userId + " is in " + userInfo.numCommunities + " communities" ) - - FillInUserInfoPanel( file.pendingJoinRequestPanel, userInfo ) - - string title - if ( settings.communityId ) - title = "[" + settings.clanTag + "] " + settings.name; - else - title = settings.name; - Hud_SetText( file.pendingJoinRequest_CommunityName, title ) - break - } - } -} - -void function FillInCommunityInfoPanel( CommunitySettings settings, CommunityPanel communityPanel ) -{ - string title - if ( settings.communityId ) - title = "[" + settings.clanTag + "] " + settings.name; - else - title = settings.name; - - if ( communityPanel.Name != null ) - Hud_SetText( communityPanel.Name, title ) - - if ( communityPanel.CommunityNameRui != null ) - SetLabelRuiText( communityPanel.CommunityNameRui, Localize( "#COMMUNITY_CHATROOM", title ) ) - - Hud_SetText( communityPanel.Creator, settings.creatorName ) - string memberCountText = "" + settings.memberCount; - Hud_SetText( communityPanel.Members, memberCountText ) - Hud_SetText( communityPanel.MOTD, settings.motd ) - string killsText = "" + settings.kills - Hud_SetText( communityPanel.Kills, killsText ) - string winsText = "" + settings.wins - Hud_SetText( communityPanel.Wins, winsText ) - string lossesText = "" + settings.losses - Hud_SetText( communityPanel.Losses, lossesText ) - string deathsText = "" + settings.deaths - Hud_SetText( communityPanel.Deaths, deathsText ) - string xpText = ShortenNumber( settings.xp ) - Hud_SetText( communityPanel.XP, xpText ) - - string languages = Localize( ConvertKeyToLocalizedString( settings.language1 ) ) - if ( settings.language2 != "" ) - languages += ", " + Localize( ConvertKeyToLocalizedString( settings.language2 ) ) - if ( settings.language3 != "" ) - languages += ", " + Localize( ConvertKeyToLocalizedString( settings.language3 ) ) - - Hud_SetText( communityPanel.LanguagesLabel, languages ) - - string regions = Localize( ConvertKeyToLocalizedString( settings.region1 ) ) - if ( settings.region2 != "" ) - regions += ", " + Localize( ConvertKeyToLocalizedString( settings.region2 ) ) - if ( settings.region3 != "" ) - regions += ", " + Localize( ConvertKeyToLocalizedString( settings.region3 ) ) - - Hud_SetText( communityPanel.RegionsLabel, regions ) - - if ( settings.communityType == "social" ) - Hud_SetText( communityPanel.CommunityTypeLabel, "#COMMUNITY_SOCIAL" ) - else - Hud_SetText( communityPanel.CommunityTypeLabel, "#COMMUNITY_COMPETITIVE" ) - - if ( settings.micPolicy == "nopref" ) - Hud_SetText( communityPanel.MicPolicyLabel, "#COMMUNITY_MICS_NOPREF" ) - else if ( settings.micPolicy == "yes" ) - Hud_SetText( communityPanel.MicPolicyLabel, "#COMMUNITY_MICS_YES" ) - else - Hud_SetText( communityPanel.MicPolicyLabel, "#COMMUNITY_MICS_NO" ) - - if ( settings.visibility == "public" ) - Hud_SetText( communityPanel.VisibilityLabel, "#COMMUNITY_VISIBILITY_PUBLIC" ) - else - Hud_SetText( communityPanel.VisibilityLabel, "#COMMUNITY_VISIBILITY_PRIVATE" ) - - if ( settings.membershipType == "invite" ) - Hud_SetText( communityPanel.MembershipTypeLabel, "#COMMUNITY_MEMBERSHIP_INVITEONLY" ) - else - Hud_SetText( communityPanel.MembershipTypeLabel, "#COMMUNITY_MEMBERSHIP_OPEN" ) - - // printt( "setting category to " + settings.category ) - if ( settings.category == "gaming" ) - Hud_SetText( communityPanel.CategoriesLabel, "#COMMUNITY_CATEGORY_GAMING" ) - else if ( settings.category == "lifestyle" ) - Hud_SetText( communityPanel.CategoriesLabel, "#COMMUNITY_CATEGORY_LIFESTYLE" ) - else if ( settings.category == "geography" ) - Hud_SetText( communityPanel.CategoriesLabel, "#COMMUNITY_CATEGORY_GEOGRAPHY" ) - else if ( settings.category == "tech" ) - Hud_SetText( communityPanel.CategoriesLabel, "#COMMUNITY_CATEGORY_TECH" ) - else if ( settings.category == "other" ) - Hud_SetText( communityPanel.CategoriesLabel, "#COMMUNITY_CATEGORY_OTHER" ) - - string happyHourString = "#COMMUNITY_HAPPYHOUR_" + settings.happyHourStart - Hud_SetText( communityPanel.HappyHourStartLabel, happyHourString ) - - /* - if ( !settings.communityId ) - { - Hud_Hide( communityPanel.JoinButton ) - Hud_Hide( communityPanel.LeaveButton ) - } - else if ( AreWeInCommunity( settings.communityId ) ) - { - Hud_Hide( communityPanel.JoinButton ) - Hud_Show( communityPanel.LeaveButton ) - Hud_Show( communityPanel.SetActiveButton ) - Hud_SetFocused( communityPanel.CloseButton ) - } - else - { - Hud_Show( communityPanel.JoinButton ) - Hud_Hide( communityPanel.LeaveButton ) - Hud_Hide( communityPanel.SetActiveButton ) - Hud_SetFocused( communityPanel.CloseButton ) - // Hud_SetFocused( communityPanel.JoinButton ) - } - */ -} - -bool function ListCommunitiesPanelHasFocus() -{ - return file.inCommunityPanel -} - -void function MyCommunities_OnGetFocus( var list ) -{ - printt( "MyCommunities_OnGetFocus" ) - if ( !file.inCommunityPanel ) - { - file.inCommunityPanel = true - // Hud_Show( file.switchCommunityPanelCover ) - foreach ( button in file.switchCommunityPanelButtons ) - { - Hud_Hide( button ) - } - foreach ( button in file.switchCommunityPanelHints ) - { - Hud_Show( button ) - } - } -} - -void function MyCommunities_OnLoseFocus( var list ) -{ - Signal( uiGlobal.signalDummy, "StopCommunityLookups" ) - printt( "MyCommunities_OnLoseFocus" ) - if ( file.inCommunityPanel ) - { - file.inCommunityPanel = false - // Hud_Hide( file.switchCommunityPanelCover ) - foreach ( button in file.switchCommunityPanelButtons ) - { - Hud_Show( button ) - } - foreach ( button in file.switchCommunityPanelHints ) - { - Hud_Hide( button ) - } - - Community_CommunityUpdated() - } -} - -void function MyCommunities_OnChange( var list ) -{ - string itemName = Hud_GetListPanelSelectedItem( file.switchCommunityPanel_ListWidget ) - Assert( IsValid( itemName ) ) - if ( itemName == "" ) - return - int communityId = int( itemName ) - printt( "Showing community info for communityId " + communityId ) - Signal( uiGlobal.signalDummy, "StopCommunityLookups" ) - thread GetCommunityInfoThread( communityId ) -} - -void function SetActiveCommunity_Thread( int communityId ) -{ - Signal( uiGlobal.signalDummy, "StopCommunityLookups" ) - EndSignal( uiGlobal.signalDummy, "StopCommunityLookups" ) - - DialogData dialogData - CommunitySettings ornull settings = GetCommunitySettings( communityId ) - - while ( settings == null ) - { - wait 0.05 - settings = GetCommunitySettings( communityId ) - } - - expect CommunitySettings( settings ) - - string name = settings.name - dialogData.header = Localize( "#REALLY_SET_ACTIVE_COMMUNITY", name ) - dialogData.message = "#REALLY_SET_ACTIVE_COMMUNITY_SUB" - - - AddDialogButton( dialogData, "#YES", MyCommunities_SetActive ) - AddDialogButton( dialogData, "#NO" ) - - dialogData.noChoiceWithNavigateBack = true - OpenDialog( dialogData ) -} - -void function MyCommunities_OnSelect( var list ) -{ - string itemName = Hud_GetListPanelSelectedItem( file.switchCommunityPanel_ListWidget ) - Assert( IsValid( itemName ) ) - if ( itemName == "" ) - return - int communityId = int( itemName ) - - thread SetActiveCommunity_Thread( communityId ) -} - -void function MyCommunities_SetActive() -{ - string itemName = Hud_GetListPanelSelectedItem( file.switchCommunityPanel_ListWidget ) - Assert( IsValid( itemName ) ) - if ( itemName == "" || itemName == "next" || itemName == "prev" ) - return - int communityId = int( itemName ) - printt( "they selected community" + communityId ) - SetActiveCommunity( communityId ) - // file.inCommunityPanel = false - Hud_SetFocused( file.selectNetWorkbutton ) - EmitUISound( "Menu.Accept" ) - Community_CommunityUpdated() -} - -bool function BrowseCommunities_ListWasFocused() -{ - if ( file.browseCommunitiesPanel_LastFocused != file.browseCommunitiesPanel_ListWidget ) - return false - - string itemName = Hud_GetListPanelSelectedItem( file.browseCommunitiesPanel_ListWidget ) - Assert( IsValid( itemName ) ) - if ( itemName == "" ) - return false - - return true -} - -bool function BrowseCommunities_ListNotFocused() -{ - return ( file.browseCommunitiesPanel_LastFocused != file.browseCommunitiesPanel_ListWidget ) -} - -void function BrowseCommunities_FilterGetFocus( var button ) -{ - file.browseCommunitiesPanel_LastFocused = button - - //file.browseCommunitiesPanel_ViewDetailsButton - - //Hud_Show( file.browseCommunitiesPanel_FilterBackground ) - RuiSetColorAlpha( Hud_GetRui( file.browseCommunitiesPanel_FilterBackground ), "backgroundColor", <0, 0, 0>, 0.65 ) - Hud_Show( file.browseCommunitiesPanel_ViewDetailsButton ) - - Hud_Hide( file.browseCommunitiesPanel_CommunityInfoPanel ) - foreach ( var hintElement in file.browseCommunitiesPanel_HintElements ) - { - Hud_Show( hintElement ) - } - - foreach ( var filterElement in file.browseCommunitiesPanel_FilterElements ) - { - //Hud_Show( filterElement ) - Hud_SetAlpha( filterElement, 255 ) - } -} - -void function BrowseCommunities_ListGetFocus( var list ) -{ - file.browseCommunitiesPanel_LastFocused = list - - //Hud_Hide( file.browseCommunitiesPanel_FilterBackground ) - RuiSetColorAlpha( Hud_GetRui( file.browseCommunitiesPanel_FilterBackground ), "backgroundColor", <0, 0, 0>, 0.25 ) - Hud_Hide( file.browseCommunitiesPanel_ViewDetailsButton ) - - Hud_Show( file.browseCommunitiesPanel_CommunityInfoPanel ) - foreach ( var hintElement in file.browseCommunitiesPanel_HintElements ) - { - Hud_Hide( hintElement ) - } - - foreach ( var filterElement in file.browseCommunitiesPanel_FilterElements ) - { - Hud_SetAlpha( filterElement, 32 ) - //Hud_Hide( filterElement ) - } -} - -void function BrowseCommunities_ListLoseFocus( var list ) -{ - RuiSetColorAlpha( Hud_GetRui( file.browseCommunitiesPanel_FilterBackground ), "backgroundColor", <0, 0, 0>, 0.65 ) - Hud_Show( file.browseCommunitiesPanel_ViewDetailsButton ) - - Hud_Hide( file.browseCommunitiesPanel_CommunityInfoPanel ) - foreach ( var hintElement in file.browseCommunitiesPanel_HintElements ) - { - Hud_Show( hintElement ) - } - - foreach ( var filterElement in file.browseCommunitiesPanel_FilterElements ) - { - //Hud_Show( filterElement ) - Hud_SetAlpha( filterElement, 255 ) - } -} - -void function BrowseCommunities_OnViewDetails( var list ) -{ - Hud_SetFocused( file.browseCommunitiesPanel_ListWidget ) -} - -void function BrowseCommunities_OnChange( var list ) -{ - string itemName = Hud_GetListPanelSelectedItem( file.browseCommunitiesPanel_ListWidget ) - Assert( IsValid( itemName ) ) - if ( itemName == "" ) - return - if ( itemName == "prev" ) - { - if ( !IsBrowserFetchingMoreData() ) - { - file.browseFilters.pageNum-- - printt( "asking for browse results, prev page " + file.browseFilters.pageNum ); - UpdateBrowseFilters( file.browseFilters ) - } - } - else if ( itemName == "next" ) - { - if ( !IsBrowserFetchingMoreData() ) - { - file.browseFilters.pageNum++ - printt( "asking for browse results, next page " + file.browseFilters.pageNum ); - UpdateBrowseFilters( file.browseFilters ) - } - } - else - { - if ( !IsBrowserFetchingMoreData() ) - { - int communityId = int( itemName ) - printt( "Showing community info for communityId " + communityId + " (item " + itemName + " in list)" ) - Signal( uiGlobal.signalDummy, "StopCommunityLookups" ) - thread GetCommunityInfoThread( communityId ) - } - } - UpdateFooterOptions() -} - -void function AskToJoinCommunity_Thread( int communityId ) -{ - Signal( uiGlobal.signalDummy, "StopCommunityLookups" ) - EndSignal( uiGlobal.signalDummy, "StopCommunityLookups" ) - - DialogData dialogData - CommunitySettings ornull settings = GetCommunitySettings( communityId ) - - while ( settings == null ) - { - wait 0.05 - settings = GetCommunitySettings( communityId ) - } - - expect CommunitySettings( settings ) - - string name = settings.name - dialogData.header = Localize( "#REALLY_JOIN_COMMUNITY", name ) - - if ( settings.membershipType == "invite" ) - dialogData.message = "#COMMUNITY_IS_INVITE_ONLY_WARNING" - - if ( settings.membershipType == "invite" ) - AddDialogButton( dialogData, "#YES_JOIN_COMMUNITY", BrowseCommunities_JoinCommunity ) - else - AddDialogButton( dialogData, "#YES", BrowseCommunities_JoinCommunity ) - - AddDialogButton( dialogData, "#NO" ) - - dialogData.noChoiceWithNavigateBack = true - OpenDialog( dialogData ) -} - -void function BrowseCommunities_OnSelect( var list ) -{ - printt( "they selected a community!" ) - - string itemName = Hud_GetListPanelSelectedItem( file.browseCommunitiesPanel_ListWidget ) - Assert( IsValid( itemName ) ) - if ( itemName == "" ) - return - int communityId = int( itemName ) - - thread AskToJoinCommunity_Thread( communityId ) -} - -void function BrowseCommunities_JoinCommunity() -{ - string itemName = Hud_GetListPanelSelectedItem( file.browseCommunitiesPanel_ListWidget ) - Assert( IsValid( itemName ) ) - if ( itemName == "" ) - return - int communityId = int( itemName ) - if ( AreWeInCommunity( communityId ) ) - { - SetActiveCommunity( communityId ) - CloseActiveMenu() - return - } - - thread JoinCommunityThread( communityId ) -} - -void function JoinCommunityThread( int communityId ) -{ - Signal( uiGlobal.signalDummy, "StopJoinCommunity" ) - EndSignal( uiGlobal.signalDummy, "StopJoinCommunity" ) - - printt( "they want to join community" + communityId ) - JoinCommunity( communityId ) - - CommunitySettings ornull settings = GetCommunitySettings( communityId ) - while ( settings == null ) - { - wait 0.05 - settings = GetCommunitySettings( communityId ) - } - - expect CommunitySettings( settings ) - - if ( settings.membershipType != "invite" ) - return - - DialogData dialogData - dialogData.header = Localize( "#COMMUNITY_JOIN_REQUEST_SENT" ) - dialogData.message = "#COMMUNITY_JOIN_REQUEST_SENT_DESC" - //AddDialogButton( dialogData, "#OK", CloseActiveMenu() ) - AddDialogButton( dialogData, "#OK" ) - - dialogData.noChoiceWithNavigateBack = true - OpenDialog( dialogData ) -} - -void function BrowseCommunities_ReportAbuse_Final() -{ - if ( file.reportedCommunityIds.len() > 100 ) - return - - foreach ( communityId in file.reportedCommunityIds ) - { - if ( communityId == file.reportAbuseCommunityId ) - return - } - file.reportedCommunityIds.append( file.reportAbuseCommunityId ) - ReportCommunity( file.reportAbuseCommunityId, 0 ) -} - -void function ReportAbuse_Thread( int communityId ) -{ - Signal( uiGlobal.signalDummy, "StopAbuseReports" ) - EndSignal( uiGlobal.signalDummy, "StopAbuseReports" ) - - DialogData dialogData - CommunitySettings ornull settings = GetCommunitySettings( communityId ) - while ( settings == null ) - { - wait 0.05 - settings = GetCommunitySettings( communityId ) - } - - expect CommunitySettings( settings ) - - file.reportAbuseCommunityId = communityId - - string name = settings.name - dialogData.header = Localize( "#REALLY_REPORT_ABUSE_HEADER", name ) - dialogData.message = Localize( "#REALLY_REPORT_ABUSE", name ) - - AddDialogButton( dialogData, "#YES", BrowseCommunities_ReportAbuse_Final ) - AddDialogButton( dialogData, "#NO" ) - - dialogData.noChoiceWithNavigateBack = true - OpenDialog( dialogData ) -} - -void function ReportAbuse_OnClick( var button ) -{ - EmitUISound( "Menu.Accept" ) - - string itemName = Hud_GetListPanelSelectedItem( file.browseCommunitiesPanel_ListWidget ) - Assert( IsValid( itemName ) ) - if ( itemName == "" ) - return - int communityId = int( itemName ) - thread ReportAbuse_Thread( communityId ) -} - -bool function CanReportAbuse() -{ - string itemName = Hud_GetListPanelSelectedItem( file.browseCommunitiesPanel_ListWidget ) - Assert( IsValid( itemName ) ) - if ( itemName == "" ) - return false - int selectedCommunityId = int( itemName ) - // if ( AreWeInCommunity( selectedCommunityId ) ) - // return false - - if ( file.reportedCommunityIds.len() > 100 ) - return false - - foreach ( communityId in file.reportedCommunityIds ) - { - if ( communityId == selectedCommunityId ) - return false - } - - return true -} - -void function JoinNetwork_OnClick( var button ) -{ - EmitUISound( "Menu.Accept" ) - - //string itemName = Hud_GetListPanelSelectedItem( file.browseCommunitiesPanel_ListWidget ) - //Assert( IsValid( itemName ) ) - //if ( itemName == "" ) - // return - //int communityId = int( itemName ) - //thread ReportAbuse_Thread( communityId ) -} - - -bool function CanJoinNetwork() -{ - // JFS: this seems bad, but the footer function gets called before we are even in the menu - if ( uiGlobal.activeMenu != file.browseCommunitiesMenu ) - return false - - if ( BrowseCommunities_ListNotFocused() ) - return false - - string itemName = Hud_GetListPanelSelectedItem( file.browseCommunitiesPanel_ListWidget ) - Assert( IsValid( itemName ) ) - if ( itemName == "" ) - return false - int selectedCommunityId = int( itemName ) - - if ( AreWeInCommunity( selectedCommunityId ) ) - return false - - return true -} - -void function FindCommunityInfoWidgetsInPanel( CommunityPanel infostruct, var panel ) -{ - if ( Hud_HasChild( panel, "CommunityName" ) ) - infostruct.Name = Hud_GetChild( panel, "CommunityName" ) - - if ( Hud_HasChild( panel, "CommunityNameRui" ) ) - infostruct.CommunityNameRui = Hud_GetChild( panel, "CommunityNameRui" ) - - infostruct.Creator = Hud_GetChild( panel, "CreatorName" ) - infostruct.Members = Hud_GetChild( panel, "ActiveMembers" ) - infostruct.MOTD = Hud_GetChild( panel, "MOTD" ) - infostruct.Kills = Hud_GetChild( panel, "Kills" ) - infostruct.Wins = Hud_GetChild( panel, "Wins" ) - infostruct.Losses = Hud_GetChild( panel, "Losses" ) - infostruct.Deaths = Hud_GetChild( panel, "Deaths" ) - infostruct.XP = Hud_GetChild( panel, "XP" ) - infostruct.CategoriesLabel = Hud_GetChild( panel, "Category" ) - infostruct.LanguagesLabel = Hud_GetChild( panel, "Languages" ) - infostruct.RegionsLabel = Hud_GetChild( panel, "Regions" ) - infostruct.CommunityTypeLabel = Hud_GetChild( panel, "CommunityType" ) - infostruct.MembershipTypeLabel = Hud_GetChild( panel, "MembershipPolicy" ) - infostruct.VisibilityLabel = Hud_GetChild( panel, "Visibility" ) - infostruct.MicPolicyLabel = Hud_GetChild( panel, "MicPolicy" ) - infostruct.HappyHourStartLabel = Hud_GetChild( panel, "HappyHourStart" ) -} - -void function InitCommunitiesMenu() -{ - RegisterSignal( "StopCommunityLookups" ) - RegisterSignal( "StopUserJoinRequestLookups" ) - RegisterSignal( "StopAbuseReports" ) - RegisterSignal( "StopJoinCommunity" ) - - PrecacheHUDMaterial( $"ui/menu/main_menu/currently_selected" ) - PrecacheHUDMaterial( $"ui/menu/main_menu/verified_community" ) - - var menu = GetMenu( "CommunitiesMenu" ) - file.menu = menu - - Chatroom_GlobalInit() - InitChatroom( menu ) - - InitCommunityKeys() - - /* - file.chatroomMenu = Hud_GetChild( menu, "Chatroom" ) // GetMenu( "ChatRoom" ) - file.chatroomMenu_chatroomWidget = Hud_GetChild( file.chatroomMenu, "ChatRoom" ) - */ - - file.adminViewPendingRequests = GetMenu( "CommunityAdminInviteRequestMenu" ) - - file.totalJoinRequests = 0 - file.pendingJoinRequestPanel.Panel = Hud_GetChild( file.adminViewPendingRequests, "JoinRequestPanel" ) - file.pendingJoinRequestPanel.Name = Hud_GetChild( file.pendingJoinRequestPanel.Panel, "Requester" ) - file.pendingJoinRequestPanel.Kills = Hud_GetChild( file.pendingJoinRequestPanel.Panel, "Kills" ) - file.pendingJoinRequestPanel.Wins = Hud_GetChild( file.pendingJoinRequestPanel.Panel, "Wins" ) - file.pendingJoinRequestPanel.Losses = Hud_GetChild( file.pendingJoinRequestPanel.Panel, "Losses" ) - file.pendingJoinRequestPanel.Deaths = Hud_GetChild( file.pendingJoinRequestPanel.Panel, "Deaths" ) - file.pendingJoinRequestPanel.XP = Hud_GetChild( file.pendingJoinRequestPanel.Panel, "XP" ) - file.pendingJoinRequestPanel.callsignCard = Hud_GetChild( file.pendingJoinRequestPanel.Panel, "CallsignCard" ) - file.pendingJoinRequest_AcceptButton = Hud_GetChild( file.pendingJoinRequestPanel.Panel, "AcceptRequestButton" ) - file.pendingJoinRequest_CommunityName = Hud_GetChild( file.pendingJoinRequestPanel.Panel, "CommunityName" ) - //file.pendingJoinRequestPanel.ViewUserCardButton = Hud_GetChild( file.pendingJoinRequestPanel.Panel, "ViewUserCard" ) - - for ( int i = 0; ; i++ ) - { - if ( !Hud_HasChild( file.pendingJoinRequestPanel.Panel, "Community" + i + "Label" ) ) - break; - var communityLabel = Hud_GetChild( file.pendingJoinRequestPanel.Panel, "Community" + i + "Label" ) - var communityName = Hud_GetChild( file.pendingJoinRequestPanel.Panel, "Community" + i ) - Assert( communityName, "found Community" + i + "Label, but no Community" + i + " in pendingJoinRequestPanel panel" ); - file.pendingJoinRequestPanel.communityLabels.append( communityLabel ) - file.pendingJoinRequestPanel.communityNames.append( communityName ) - } - - AddEventHandlerToButton( file.pendingJoinRequestPanel.Panel, "AcceptRequestButton", UIE_CLICK, JoinRequest_Accept ) - AddEventHandlerToButton( file.pendingJoinRequestPanel.Panel, "DenyRequestButton", UIE_CLICK, JoinRequest_Deny ) - AddMenuFooterOption( file.adminViewPendingRequests, BUTTON_A, "#A_BUTTON_SELECT" ) - AddMenuFooterOption( file.adminViewPendingRequests, BUTTON_B, "#B_BUTTON_BACK", "#BACK" ) - - // BrowseFilters filters - // file.browseFilters = filters - file.browseFilters.name = "" - file.browseFilters.clantag = "" - file.browseFilters.communityType = "social" - file.browseFilters.membershipType = "open" - file.browseFilters.category = "" - file.browseFilters.playtime = "" - file.browseFilters.micPolicy = "" - file.browseFilters.pageNum = 0 - file.browseFilters.minMembers = 1 - - file.haveSettings = false - file.firstCommunityUpdateHappened = false - - // file.editButton = Hud_GetChild( menu, "BtnEdit" ) - file.sendMessageButton = Hud_GetChild( menu, "BtnSendMessage" ) - // file.adminViewPendingRequestsButton = Hud_GetChild( menu, "BtnPendingRequests" ) - - file.browseCommunitiesMenu = GetMenu( "BrowseCommunities" ) - - file.browseCommunitiesPanel = Hud_GetChild( file.browseCommunitiesMenu, "BrowseCommunitiesPanel" ) - file.browseCommunitiesPanel_FilterBackground = Hud_GetChild( file.browseCommunitiesPanel, "ListCommunitiesBackground" ) - file.browseCommunitiesPanel_ListWidget = Hud_GetChild( file.browseCommunitiesPanel, "ListCommunities" ) - file.browseCommunitiesPanel_NameWidget = Hud_GetChild( file.browseCommunitiesPanel, "CommunityFilterName" ) - file.browseCommunitiesPanel_ClantagWidget = Hud_GetChild( file.browseCommunitiesPanel, "CommunityFilterClantag" ) - file.browseCommunitiesPanel_TypeButton = Hud_GetChild( file.browseCommunitiesPanel, "CommunityFilterType" ) - file.browseCommunitiesPanel_MembershipButton = Hud_GetChild( file.browseCommunitiesPanel, "CommunityFilterMembership" ) - file.browseCommunitiesPanel_CategoryButton = Hud_GetChild( file.browseCommunitiesPanel, "CommunityFilterCategory" ) - file.browseCommunitiesPanel_PlaytimeButton = Hud_GetChild( file.browseCommunitiesPanel, "CommunityFilterPlaytime" ) - file.browseCommunitiesPanel_MicPolicyButton = Hud_GetChild( file.browseCommunitiesPanel, "CommunityMicFilterPolicy" ) - file.browseCommunitiesPanel_MinMembersButton = Hud_GetChild( file.browseCommunitiesPanel, "MemberCountFilter" ) - file.browseCommunitiesPanel_ViewDetailsButton = Hud_GetChild( file.browseCommunitiesPanel, "ViewDetails" ) - - Hud_SetText( Hud_GetChild( file.browseCommunitiesPanel, "MyRegion" ), Localize( "#MY_REGION_N", MyRegion() ) ) - - file.browseCommunitiesPanel_FilterElements.append( file.browseCommunitiesPanel_NameWidget ) - file.browseCommunitiesPanel_FilterElements.append( file.browseCommunitiesPanel_ClantagWidget ) - file.browseCommunitiesPanel_FilterElements.append( file.browseCommunitiesPanel_TypeButton ) - file.browseCommunitiesPanel_FilterElements.append( file.browseCommunitiesPanel_MembershipButton ) - file.browseCommunitiesPanel_FilterElements.append( file.browseCommunitiesPanel_CategoryButton ) - file.browseCommunitiesPanel_FilterElements.append( file.browseCommunitiesPanel_MinMembersButton ) - file.browseCommunitiesPanel_FilterElements.append( file.browseCommunitiesPanel_PlaytimeButton ) - file.browseCommunitiesPanel_FilterElements.append( file.browseCommunitiesPanel_MicPolicyButton ) - file.browseCommunitiesPanel_FilterElements.append( file.browseCommunitiesPanel_ViewDetailsButton ) - - file.browseCommunitiesPanel_FilterElements.append( Hud_GetChild( file.browseCommunitiesPanel, "NameFilterLabel" ) ) - file.browseCommunitiesPanel_FilterElements.append( Hud_GetChild( file.browseCommunitiesPanel, "ClantagFilterLabel" ) ) - file.browseCommunitiesPanel_FilterElements.append( Hud_GetChild( file.browseCommunitiesPanel, "TypeFilterLabel" ) ) - file.browseCommunitiesPanel_FilterElements.append( Hud_GetChild( file.browseCommunitiesPanel, "CategoryFilterLabel" ) ) - file.browseCommunitiesPanel_FilterElements.append( Hud_GetChild( file.browseCommunitiesPanel, "PlaytimeFilterLabel" ) ) - file.browseCommunitiesPanel_FilterElements.append( Hud_GetChild( file.browseCommunitiesPanel, "MemberCountFilterLabel" ) ) - file.browseCommunitiesPanel_FilterElements.append( Hud_GetChild( file.browseCommunitiesPanel, "MembershipFilterLabel" ) ) - file.browseCommunitiesPanel_FilterElements.append( Hud_GetChild( file.browseCommunitiesPanel, "MicPolicyFilterLabel" ) ) - - file.browseCommunitiesPanel_HintElements.append( Hud_GetChild( file.browseCommunitiesPanel, "HintBackground" ) ) - file.browseCommunitiesPanel_HintElements.append( Hud_GetChild( file.browseCommunitiesPanel, "HintIcon" ) ) - file.browseCommunitiesPanel_HintElements.append( Hud_GetChild( file.browseCommunitiesPanel, "HintLabel" ) ) - file.browseCommunitiesPanel_HintElements.append( Hud_GetChild( file.browseCommunitiesPanel, "HintCopy" ) ) - - file.browseCommunitiesPanel_CommunityInfoPanel = Hud_GetChild( file.browseCommunitiesPanel, "CommunityInfo" ) - - var elem = Hud_GetChild( file.browseCommunitiesPanel_CommunityInfoPanel, "MOTDIcon" ) - var rui = Hud_GetRui( elem ) - RuiSetImage( rui, "basicImage", $"rui/menu/common/inbox_icon" ) - - elem = Hud_GetChild( file.browseCommunitiesPanel_CommunityInfoPanel, "XPIcon" ) - rui = Hud_GetRui( elem ) - RuiSetImage( rui, "basicImage", $"rui/merits/credit_sign_small" ) - - elem = Hud_GetChild( file.browseCommunitiesPanel, "HintIcon" ) - rui = Hud_GetRui( elem ) - RuiSetImage( rui, "basicImage", $"rui/menu/common/bulb_hint_icon" ) - - AddEventHandlerToButton( file.browseCommunitiesPanel, "ListCommunities", UIE_CLICK, BrowseCommunities_OnSelect ) - AddEventHandlerToButton( file.browseCommunitiesPanel, "ListCommunities", UIE_CHANGE, BrowseCommunities_OnChange ) - - AddEventHandlerToButton( file.browseCommunitiesPanel, "ListCommunities", UIE_GET_FOCUS, BrowseCommunities_ListGetFocus ) - AddEventHandlerToButton( file.browseCommunitiesPanel, "ListCommunities", UIE_LOSE_FOCUS, BrowseCommunities_ListLoseFocus ) - - AddEventHandlerToButton( file.browseCommunitiesPanel, "CommunityFilterName", UIE_GET_FOCUS, BrowseCommunities_FilterGetFocus ) - AddEventHandlerToButton( file.browseCommunitiesPanel, "CommunityFilterClantag", UIE_GET_FOCUS, BrowseCommunities_FilterGetFocus ) - AddEventHandlerToButton( file.browseCommunitiesPanel, "CommunityFilterType", UIE_GET_FOCUS, BrowseCommunities_FilterGetFocus ) - AddEventHandlerToButton( file.browseCommunitiesPanel, "CommunityFilterMembership", UIE_GET_FOCUS, BrowseCommunities_FilterGetFocus ) - AddEventHandlerToButton( file.browseCommunitiesPanel, "CommunityFilterCategory", UIE_GET_FOCUS, BrowseCommunities_FilterGetFocus ) - AddEventHandlerToButton( file.browseCommunitiesPanel, "CommunityFilterPlaytime", UIE_GET_FOCUS, BrowseCommunities_FilterGetFocus ) - AddEventHandlerToButton( file.browseCommunitiesPanel, "CommunityMicFilterPolicy", UIE_GET_FOCUS, BrowseCommunities_FilterGetFocus ) - AddEventHandlerToButton( file.browseCommunitiesPanel, "MemberCountFilter", UIE_GET_FOCUS, BrowseCommunities_FilterGetFocus ) - // AddEventHandlerToButton( file.browseCommunitiesPanel, "ViewDetails", UIE_GET_FOCUS, BrowseCommunities_FilterGetFocus ) - - AddEventHandlerToButton( file.browseCommunitiesPanel, "ViewDetails", UIE_CLICK, BrowseCommunities_OnViewDetails ) - - - AddMenuEventHandler( file.browseCommunitiesMenu, eUIEvent.MENU_OPEN, OnBrowseNetworksMenu_Open ) - AddMenuEventHandler( file.browseCommunitiesMenu, eUIEvent.MENU_NAVIGATE_BACK, OnBrowseMentworksMenu_NavigateBack ) - - AddMenuFooterOption( file.browseCommunitiesMenu, BUTTON_B, "#B_BUTTON_BACK", "#BACK" ) - AddMenuFooterOption( file.browseCommunitiesMenu, BUTTON_A, "#COMMUNITY_JOINCOMMUNITY_ABUTTON", "#COMMUNITY_JOINCOMMUNITY", null, CanJoinNetwork ) - AddMenuFooterOption( file.browseCommunitiesMenu, BUTTON_X, "#COMMUNITY_REPORTABUSE_XBUTTON", "#COMMUNITY_REPORTABUSE", ReportAbuse_OnClick, CanReportAbuse ) - - AddEventHandlerToButton( file.browseCommunitiesPanel, "CommunityFilterType", UIE_CLICK, Browse_ChangeCommunityType_Activate ) - AddEventHandlerToButton( file.browseCommunitiesPanel, "CommunityFilterMembership", UIE_CLICK, Browse_ChangeCommunityMembership_Activate ) - AddEventHandlerToButton( file.browseCommunitiesPanel, "CommunityFilterCategory", UIE_CLICK, Browse_ChangeCommunityCategory_Activate ) - AddEventHandlerToButton( file.browseCommunitiesPanel, "CommunityFilterPlaytime", UIE_CLICK, Browse_ChangeCommunityPlaytime_Activate ) - AddEventHandlerToButton( file.browseCommunitiesPanel, "CommunityMicFilterPolicy", UIE_CLICK, Browse_ChangeCommunityMicPolicy_Activate ) - AddEventHandlerToButton( file.browseCommunitiesPanel, "MemberCountFilter", UIE_CLICK, Browse_ChangeCommunityMinMembers_Activate ) - AddEventHandlerToButton( file.browseCommunitiesPanel, "CommunityFilterName", UIE_CHANGE, Browse_CommunityNameChanged ) - AddEventHandlerToButton( file.browseCommunitiesPanel, "CommunityFilterClantag", UIE_CHANGE, Browse_CommunityClantagChanged ) - - file.editCommunityMenu = GetMenu( "CommunityEditMenu" ) - var editCommunityPanel = Hud_GetChild( file.editCommunityMenu, "editCommunityPanel" ) - file.editCommunityPanel_LanguagesButton = Hud_GetChild( editCommunityPanel, "Languages" ) - file.editCommunityPanel_SaveButton = Hud_GetChild( editCommunityPanel, "Save" ) - file.editCommunityPanel_CreateButton = Hud_GetChild( editCommunityPanel, "Create" ) - file.editCommunityLanguagesPanel = Hud_GetChild( file.editCommunityMenu, "EditCommunityLanguagesPanel" ) - file.editCommunityRegionsPanel = Hud_GetChild( file.editCommunityMenu, "EditCommunityRegionsPanel" ) - file.editCommunityCategoriesPanel = Hud_GetChild( file.editCommunityMenu, "EditCommunityCategoriesPanel" ) - file.editCommunityHappyHourPanel = Hud_GetChild( file.editCommunityMenu, "EditCommunityHappyHourPanel" ) - - Hud_AddEventHandler( Hud_GetChild( editCommunityPanel, "HappyHourLeftHidden" ), UIE_GET_FOCUS, OnHappyHourPrev ) - Hud_AddEventHandler( Hud_GetChild( editCommunityPanel, "HappyHourRightHidden" ), UIE_GET_FOCUS, OnHappyHourNext ) - Hud_AddEventHandler( Hud_GetChild( editCommunityPanel, "HappyHourLeft" ), UIE_CLICK, OnHappyHourPrev ) - Hud_AddEventHandler( Hud_GetChild( editCommunityPanel, "HappyHourRight" ), UIE_CLICK, OnHappyHourNext ) - - file.editCommunityPanel_PopupBackground = Hud_GetChild( file.editCommunityMenu, "PanelBackground" ) - Hud_AddEventHandler( file.editCommunityPanel_PopupBackground, UIE_CLICK, PopupBackground_Activate ) - - file.editCommunityPanel_Header = Hud_GetChild( file.editCommunityMenu, "MenuTitle" ) - file.editCommunityPanel_NameLabel = Hud_GetChild( editCommunityPanel, "CommunityNameLabel" ) - file.editCommunityPanel_NameBigLabel = Hud_GetChild( editCommunityPanel, "CommunityNameBigLabel" ) - file.editCommunityPanel_Name = Hud_GetChild( editCommunityPanel, "CommunityNameEditBox" ) - file.editCommunityPanel_Clantag = Hud_GetChild( editCommunityPanel, "ClantagEditBox" ) - file.editCommunityPanel_MOTD = Hud_GetChild( editCommunityPanel, "MOTDEditBox" ) - file.editCommunityPanel_CategoriesButton = Hud_GetChild( editCommunityPanel, "Category" ) - file.editCommunityPanel_RegionsButton = Hud_GetChild( editCommunityPanel, "Regions" ) - file.editCommunityPanel_CommunityTypeButton = Hud_GetChild( editCommunityPanel, "CommunityType" ) - file.editCommunityPanel_MembershipTypeButton = Hud_GetChild( editCommunityPanel, "MembershipPolicy" ) - file.editCommunityPanel_VisibilityButton = Hud_GetChild( editCommunityPanel, "Visibility" ) - file.editCommunityPanel_MicPolicyButton = Hud_GetChild( editCommunityPanel, "MicPolicy" ) - file.editCommunityPanel_HappyHourStartButton = Hud_GetChild( editCommunityPanel, "HappyHourStart" ) - - AddMenuEventHandler( file.editCommunityMenu, eUIEvent.MENU_NAVIGATE_BACK, OnEditCommunityMenu_Close ) - AddMenuFooterOption( file.editCommunityMenu, BUTTON_B, "#B_BUTTON_BACK", "#BACK" ) - - file.editCommunityLanguagesPanel_LanguageButtons = SetupComboSelectButtons( file.editCommunityLanguagesPanel, file.languages, OnLanguageSelectButtonClick, true ) - file.editCommunityRegionsPanel_RegionButtons = SetupComboSelectButtons( file.editCommunityRegionsPanel, file.regions, OnComboSelectButtonClick, true ) - file.editCommunityCategoriesPanel_CategoryButtons = SetupComboSelectButtons( file.editCommunityCategoriesPanel, file.categories, OnSaveCategoriesButton_Activate, false ) - - for ( int i = 0; i < 24; i++ ) - file.editCommunityHappyHourPanel_HappyHourButtons.append( Hud_GetChild( file.editCommunityHappyHourPanel, "time" + i ) ) - - file.sendCommunityMsgMenu = GetMenu( "CommunityAdminSendMessage" ) - var sendCommunityMsgPanel = Hud_GetChild( file.sendCommunityMsgMenu, "SendCommunityMessagePanel" ) - file.sendCommunityMsg_expiration = 24 // default to 24 hours - file.sendCommunityMsgPanel_ExpirationButton = Hud_GetChild( sendCommunityMsgPanel, "Expiration" ) - file.sendCommunityMsgPanel_CommunityName = Hud_GetChild( sendCommunityMsgPanel, "CommunityName" ) - file.sendCommunityMsgPanel_MsgText = Hud_GetChild( sendCommunityMsgPanel, "MessageEditBox" ) - file.sendCommunityMsgPanel_SendButton = Hud_GetChild( sendCommunityMsgPanel, "Send" ) - AddMenuEventHandler( file.sendCommunityMsgMenu, eUIEvent.MENU_OPEN, OnCommunitySendMsg_Open ) - AddMenuEventHandler( file.sendCommunityMsgMenu, eUIEvent.MENU_NAVIGATE_BACK, OCommunitySendMsg_NavigateBack ) - AddMenuFooterOption( file.sendCommunityMsgMenu, BUTTON_A, "#A_BUTTON_SELECT" ) - AddMenuFooterOption( file.sendCommunityMsgMenu, BUTTON_B, "#B_BUTTON_BACK", "#BACK" ) - - - elem = Hud_GetChild( sendCommunityMsgPanel, "MailIcon" ) - rui = Hud_GetRui( elem ) - RuiSetImage( rui, "basicImage", $"rui/menu/common/inbox_icon_new" ) - - FindCommunityInfoWidgetsInPanel( file.communityInfoPanelWidgets, file.browseCommunitiesPanel_CommunityInfoPanel ) - - AddMenuEventHandler( menu, eUIEvent.MENU_OPEN, OnCommunityMenu_Open ) - AddMenuEventHandler( menu, eUIEvent.MENU_CLOSE, OnCommunityMenu_Close ) - - AddEventHandlerToButton( menu, "BtnBrowse", UIE_CLICK, OnBrowseNetworksButton_Activate ) - - var button = Hud_GetChild( menu, "BtnBrowse" ) - SetButtonRuiText( button, "#COMMUNITY_BROWSE_NETWORKS" ) - AddButtonEventHandler( button, UIE_CLICK, OnBrowseNetworksButton_Activate ) - - button = Hud_GetChild( menu, "BtnCreate" ) - SetButtonRuiText( button, "#COMMUNITY_CREATECOMMUNITY" ) - AddButtonEventHandler( button, UIE_CLICK, OnCreateCommunityButton_Activate ) - - button = Hud_GetChild( menu, "BtnEdit" ) - SetButtonRuiText( button, "#COMMUNITY_EDITCOMMUNITY" ) - AddButtonEventHandler( button, UIE_CLICK, OnEditCommunityButton_Activate ) - - button = Hud_GetChild( menu, "BtnSendMessage" ) - SetButtonRuiText( button, "#COMMUNITY_SENDMESSAGE" ) - AddButtonEventHandler( button, UIE_CLICK, OnStartSendCommunityMessageButton_Activate ) - - button = Hud_GetChild( menu, "BtnPendingRequests" ) - SetButtonRuiText( button, "#COMMUNITY_NOPENDINGREQUESTSTOJOIN" ) - AddButtonEventHandler( button, UIE_CLICK, OnViewPendingRequestButton_Activate ) - - AddEventHandlerToButton( sendCommunityMsgPanel, "Send", UIE_CLICK, OnActualSendCommunityMessageButton_Activate ) - AddEventHandlerToButton( sendCommunityMsgPanel, "Expiration", UIE_CLICK, OnChangeCommunityMessageExpirationButton_Activate ) - - AddEventHandlerToButton( editCommunityPanel, "CommunityType", UIE_CLICK, OnCommunityTypeButton_Activate ) - AddEventHandlerToButton( editCommunityPanel, "Languages", UIE_CLICK, OnLanguagesButton_Activate ) - AddEventHandlerToButton( editCommunityPanel, "Regions", UIE_CLICK, OnRegionsButton_Activate ) - AddEventHandlerToButton( editCommunityPanel, "Category", UIE_CLICK, OnCategoriesButton_Activate ) - AddEventHandlerToButton( editCommunityPanel, "MembershipPolicy", UIE_CLICK, OnMembershipTypeButton_Activate ) - AddEventHandlerToButton( editCommunityPanel, "Visibility", UIE_CLICK, OnVisibilityButton_Activate ) - AddEventHandlerToButton( editCommunityPanel, "MicPolicy", UIE_CLICK, OnMicPolicyButton_Activate ) - AddEventHandlerToButton( editCommunityPanel, "HappyHourStart", UIE_CLICK, OnHappyHourButton_Activate ) - AddEventHandlerToButton( editCommunityPanel, "Create", UIE_CLICK, OnSaveCommunityButton_Activate ) - AddEventHandlerToButton( editCommunityPanel, "Save", UIE_CLICK, OnSaveCommunityButton_Activate ) - AddEventHandlerToButton( file.editCommunityLanguagesPanel, "Save", UIE_CLICK, OnSaveLanguagesButton_Activate ) - AddEventHandlerToButton( file.editCommunityRegionsPanel, "Save", UIE_CLICK, OnSaveRegionsButton_Activate ) - - AddEventHandlerToButton( file.editCommunityHappyHourPanel, "time0", UIE_CLICK, OnHappyHour0Button_Activate ) - AddEventHandlerToButton( file.editCommunityHappyHourPanel, "time1", UIE_CLICK, OnHappyHour1Button_Activate ) - AddEventHandlerToButton( file.editCommunityHappyHourPanel, "time2", UIE_CLICK, OnHappyHour2Button_Activate ) - AddEventHandlerToButton( file.editCommunityHappyHourPanel, "time3", UIE_CLICK, OnHappyHour3Button_Activate ) - AddEventHandlerToButton( file.editCommunityHappyHourPanel, "time4", UIE_CLICK, OnHappyHour4Button_Activate ) - AddEventHandlerToButton( file.editCommunityHappyHourPanel, "time5", UIE_CLICK, OnHappyHour5Button_Activate ) - AddEventHandlerToButton( file.editCommunityHappyHourPanel, "time6", UIE_CLICK, OnHappyHour6Button_Activate ) - AddEventHandlerToButton( file.editCommunityHappyHourPanel, "time7", UIE_CLICK, OnHappyHour7Button_Activate ) - AddEventHandlerToButton( file.editCommunityHappyHourPanel, "time8", UIE_CLICK, OnHappyHour8Button_Activate ) - AddEventHandlerToButton( file.editCommunityHappyHourPanel, "time9", UIE_CLICK, OnHappyHour9Button_Activate ) - AddEventHandlerToButton( file.editCommunityHappyHourPanel, "time10", UIE_CLICK, OnHappyHour10Button_Activate ) - AddEventHandlerToButton( file.editCommunityHappyHourPanel, "time11", UIE_CLICK, OnHappyHour11Button_Activate ) - AddEventHandlerToButton( file.editCommunityHappyHourPanel, "time12", UIE_CLICK, OnHappyHour12Button_Activate ) - AddEventHandlerToButton( file.editCommunityHappyHourPanel, "time13", UIE_CLICK, OnHappyHour13Button_Activate ) - AddEventHandlerToButton( file.editCommunityHappyHourPanel, "time14", UIE_CLICK, OnHappyHour14Button_Activate ) - AddEventHandlerToButton( file.editCommunityHappyHourPanel, "time15", UIE_CLICK, OnHappyHour15Button_Activate ) - AddEventHandlerToButton( file.editCommunityHappyHourPanel, "time16", UIE_CLICK, OnHappyHour16Button_Activate ) - AddEventHandlerToButton( file.editCommunityHappyHourPanel, "time17", UIE_CLICK, OnHappyHour17Button_Activate ) - AddEventHandlerToButton( file.editCommunityHappyHourPanel, "time18", UIE_CLICK, OnHappyHour18Button_Activate ) - AddEventHandlerToButton( file.editCommunityHappyHourPanel, "time19", UIE_CLICK, OnHappyHour19Button_Activate ) - AddEventHandlerToButton( file.editCommunityHappyHourPanel, "time20", UIE_CLICK, OnHappyHour20Button_Activate ) - AddEventHandlerToButton( file.editCommunityHappyHourPanel, "time21", UIE_CLICK, OnHappyHour21Button_Activate ) - AddEventHandlerToButton( file.editCommunityHappyHourPanel, "time22", UIE_CLICK, OnHappyHour22Button_Activate ) - AddEventHandlerToButton( file.editCommunityHappyHourPanel, "time23", UIE_CLICK, OnHappyHour23Button_Activate ) - - AddMenuFooterOption( menu, BUTTON_A, "#A_BUTTON_SELECT" ) - AddMenuFooterOption( menu, BUTTON_B, "#B_BUTTON_BACK", "#BACK" ) - AddMenuFooterOption( menu, BUTTON_TRIGGER_RIGHT, "#R_TRIGGER_CHAT", "", null, IsVoiceChatPushToTalk ) -} - -void function InitCommunityKeys() -{ - var dataTable = GetDataTable( $"datatable/community_entries.rpak" ) - int numRows = GetDatatableRowCount( dataTable ) - file.keysToStrings[""] <- "" - for ( int i=0; i function SetupComboSelectButtons( var panel, array labelNames, void functionref(var) func, bool hasSaveButton ) -{ - int MAX_BUTTONS = 15 - array buttons = [] - var lastButton - int i - - int height = 0 - - var BG = Hud_GetChild( panel, "Background" ) - - for ( i=0; i allbuttons = clone buttons - if ( hasSaveButton ) - { - var saveButton = Hud_GetChild( panel, "Save" ) - var rui = Hud_GetRui( saveButton ) - RuiSetString( rui, "buttonText", "#SAVE" ) - Hud_Show( saveButton ) - Hud_SetPinSibling( saveButton, Hud_GetHudName( lastButton ) ) - allbuttons.append( saveButton ) - height += Hud_GetHeight( saveButton ) - height += Hud_GetY( saveButton ) - } - - SetNavUpDown( allbuttons ) - - Hud_SetHeight( BG, height ) - - return buttons -} - -string function ConvertKeyToLocalizedString( string key ) -{ - if ( !( key in file.keysToStrings ) ) - return "???" - - return file.keysToStrings[ key ] -} - -void function OnComboSelectButtonClick( var button ) -{ - if ( Hud_IsLocked( button ) ) - return - - Hud_SetSelected( button, !Hud_IsSelected( button ) ) - - UpdateComboSelectButtons( file.editCommunityRegionsPanel_RegionButtons, GetToggledRegion( 2 ) != "" ) -} - -void function OnLanguageSelectButtonClick( var button ) -{ - if ( Hud_IsLocked( button ) ) - return - - Hud_SetSelected( button, !Hud_IsSelected( button ) ) - - string language3 = GetToggledLanguage( 2 ) - - UpdateComboSelectButtons( file.editCommunityLanguagesPanel_LanguageButtons, GetToggledLanguage( 2 ) != "" ) -} - -void function UpdateComboSelectButtons( array< var > buttons, bool shouldLockButtons ) -{ - foreach( var button in buttons ) - { - if ( shouldLockButtons ) - Hud_SetLocked( button, !Hud_IsSelected( button ) ) - else - Hud_SetLocked( button, false ) - } -} - -void function OnCommunityMenu_Open() -{ - HideAllPanels() - FillInBrowseFilters( file.browseFilters ) - UI_SetPresentationType( ePresentationType.NO_MODELS ) -} - -void function OnEditCommunityMenu_Close() -{ - if ( file.inCommunityPanel ) - { - MyCommunities_OnLoseFocus( file.switchCommunityPanel_ListWidget ) - - if ( file.lastButtonFocused != null ) - Hud_SetFocused( file.lastButtonFocused ) - - foreach ( panel in file.temporaryPanels ) - { - Hud_Hide( panel ) - } - } - else - { - if ( file.communityEdited ) - { - DialogData dialogData - dialogData.header = "#COMMUNITY_ARE_YOU_SURE" - dialogData.message = "#COMMUNITY_CHANGES_WILL_BE_LOST" - - AddDialogButton( dialogData, "#YES", LeaveEditCommunity ) - AddDialogButton( dialogData, "#NO" ) - - dialogData.noChoiceWithNavigateBack = true - OpenDialog( dialogData ) - } - else - { - LeaveEditCommunity() - } - } -} - -void function LeaveEditCommunity() -{ - HideAllPanels() - CloseActiveMenu( true ) -} - -void function OnCommunityMenu_Close() -{ - Signal( uiGlobal.signalDummy, "StopCommunityLookups" ) - Signal( uiGlobal.signalDummy, "StopUserJoinRequestLookups" ) - HideAllPanels() -} - -void function InitMyNetworksMenu() -{ - var menu = GetMenu( "MyNetworks" ) - - var elem - var rui - - file.switchCommunityMenu = menu - - file.switchCommunityPanelCover = Hud_GetChild( menu, "ButtonCover" ) - file.switchCommunityPanel = Hud_GetChild( menu, "SwitchCommunityPanel" ) - file.switchCommunityPanel_ListWidget = Hud_GetChild( file.switchCommunityPanel, "ListCommunities" ) - file.switchCommunityPanel_CommunityInfoPanel = Hud_GetChild( file.switchCommunityPanel, "CommunityInfo" ) - - elem = Hud_GetChild( file.switchCommunityPanel_CommunityInfoPanel, "MOTDIcon" ) - rui = Hud_GetRui( elem ) - RuiSetImage( rui, "basicImage", $"rui/menu/common/inbox_icon" ) - - elem = Hud_GetChild( file.switchCommunityPanel_CommunityInfoPanel, "XPIcon" ) - rui = Hud_GetRui( elem ) - RuiSetImage( rui, "basicImage", $"rui/merits/credit_sign_small" ) - - elem = Hud_GetChild( file.switchCommunityMenu, "HintIcon" ) - rui = Hud_GetRui( elem ) - RuiSetImage( rui, "basicImage", $"rui/menu/common/bulb_hint_icon" ) - - file.switchCommunityPanelHints.append( elem ) - file.switchCommunityPanelHints.append( Hud_GetChild( file.switchCommunityMenu, "HintBackground" ) ) - file.switchCommunityPanelHints.append( Hud_GetChild( file.switchCommunityMenu, "HintLabel" ) ) - file.switchCommunityPanelHints.append( Hud_GetChild( file.switchCommunityMenu, "HintLabelPC" ) ) - - FindCommunityInfoWidgetsInPanel( file.myCommunityInfoPanelWidgets, file.switchCommunityPanel_CommunityInfoPanel ) - - AddMenuEventHandler( menu, eUIEvent.MENU_OPEN, OnMyNetworksMenu_Open ) - - SetupComboButtons( menu ) - - AddEventHandlerToButton( file.switchCommunityPanel, "ListCommunities", UIE_CLICK, MyCommunities_OnSelect ) - AddEventHandlerToButton( file.switchCommunityPanel, "ListCommunities", UIE_CHANGE, MyCommunities_OnChange ) - AddEventHandlerToButton( file.switchCommunityPanel, "ListCommunities", UIE_GET_FOCUS, MyCommunities_OnGetFocus ) - AddEventHandlerToButton( file.switchCommunityPanel, "ListCommunities", UIE_LOSE_FOCUS, MyCommunities_OnLoseFocus ) - - AddMenuEventHandler( menu, eUIEvent.MENU_NAVIGATE_BACK, OnNetworksMenu_NavigateBack ) - - AddMenuFooterOption( menu, BUTTON_B, "#B_BUTTON_BACK", "#BACK" ) - AddMenuFooterOption( menu, BUTTON_A, "#A_BUTTON_SELECT" ) - AddMenuFooterOption( menu, BUTTON_X, "#COMMUNITY_LEAVECOMMUNITY_XBUTTON", "", LeaveCommunityButton_Activate, ListCommunitiesPanelHasFocus ) -} - -void function OnMyNetworksMenu_Open() -{ - Signal( uiGlobal.signalDummy, "StopCommunityLookups" ) - int communityId = GetCurrentCommunityId() - if ( communityId >= 0 ) - thread GetCommunityInfoThread( communityId ) - - HideAllPanels() - UI_SetPresentationType( ePresentationType.NO_MODELS ) -} - -void function OnBrowseNetworksMenu_Open() -{ - Signal( uiGlobal.signalDummy, "StopCommunityLookups" ) - int communityId = GetCurrentCommunityId() - if ( communityId >= 0 ) - thread GetCommunityInfoThread( communityId ) - - HideAllPanels() - UI_SetPresentationType( ePresentationType.NO_MODELS ) - - Hud_SetText( Hud_GetChild( file.browseCommunitiesPanel, "MyRegion" ), Localize( "#MY_REGION_N", MyRegion() ) ) - - thread FooterOptionsUpdate( uiGlobal.activeMenu ) -} - -void function FooterOptionsUpdate( var menu ) -{ - EndSignal( uiGlobal.signalDummy, "CleanupInGameMenus" ) - - while ( GetTopNonDialogMenu() == menu ) - { - UpdateFooterOptions() - WaitFrame() - } -} - -void function ToggleChatroomVoiceMode0( var button ) -{ - ToggleChatroomVoiceMode( 0 ) -} - -void function ToggleChatroomVoiceMode1( var button ) -{ - ToggleChatroomVoiceMode( 1 ) -} - -void function ToggleChatroomVoiceMode( int voiceMode ) -{ - if ( voiceMode == 0 ) - ClientCommand( "chatroom_freetalk" ) - else - ClientCommand( "chatroom_adminsonly" ) - - UpdateChatroomToggleText( voiceMode ) -} - -void function SetupComboButtons( var menu ) -{ - ComboStruct comboStruct = ComboButtons_Create( menu ) - - int headerIndex = 0 - int buttonIndex = 0 - var activeNetworkHeader = AddComboButtonHeader( comboStruct, headerIndex, "#MENU_TITLE_ACTIVE_NETWORK" ) - file.switchCommunityPanelButtons.append( activeNetworkHeader ) - - var selectButton = AddComboButton( comboStruct, headerIndex, buttonIndex++, "#MENU_TITLE_CHOOSE_NETWORK" ) - file.switchCommunityPanelButtons.append( selectButton ) - file.selectNetWorkbutton = selectButton - Hud_AddEventHandler( selectButton, UIE_CLICK, SelectNetworkButton_Activate ) - - var createButton = AddComboButton( comboStruct, headerIndex, buttonIndex++, "#MENU_TITLE_CREATE_NETWORK" ) - file.switchCommunityPanelButtons.append( createButton ) - AddButtonEventHandler( createButton, UIE_CLICK, OnCreateCommunityButton_Activate ) - - var leaveButton = AddComboButton( comboStruct, headerIndex, buttonIndex++, "#COMMUNITY_LEAVE_NETWORK" ) - file.switchCommunityPanelButtons.append( leaveButton ) - Hud_AddEventHandler( leaveButton, UIE_CLICK, LeaveCurrentCommunityButton_Activate ) - - headerIndex++ - buttonIndex = 0 - - var adminHeader = AddComboButtonHeader( comboStruct, headerIndex, "#MENU_TITLE_ADMIN" ) - file.switchCommunityPanelButtons.append( adminHeader ) - var editButton = AddComboButton( comboStruct, headerIndex, buttonIndex++, "#MENU_TITLE_EDIT_NETWORK" ) - file.switchCommunityPanelButtons.append( editButton ) - AddButtonEventHandler( editButton, UIE_CLICK, OnEditCommunityButton_Activate ) - file.editButton = editButton - - file.sendButton = AddComboButton( comboStruct, headerIndex, buttonIndex++, "#MENU_TITLE_SEND" ) - file.switchCommunityPanelButtons.append( file.sendButton ) - Hud_AddEventHandler( file.sendButton, UIE_CLICK, AdvanceMenuEventHandler( GetMenu( "CommunityAdminSendMessage" ) ) ) - - var pendingRequestButton = AddComboButton( comboStruct, headerIndex, buttonIndex++, "#MENU_TITLE_MEMBER_REQ" ) - file.switchCommunityPanelButtons.append( pendingRequestButton ) - AddButtonEventHandler( pendingRequestButton, UIE_CLICK, OnViewPendingRequestButton_Activate ) - file.adminViewPendingRequestsButton = pendingRequestButton - - headerIndex++ - buttonIndex = 0 - - file.chatroomToggleVoiceModeHeader = AddComboButtonHeader( comboStruct, headerIndex, "#MENU_TITLE_ADMIN_CHATROOM" ) - file.switchCommunityPanelButtons.append( file.chatroomToggleVoiceModeHeader ) - - file.chatroomToggleVoiceModeButton0 = AddComboButton( comboStruct, headerIndex, buttonIndex++, "#MENU_TITLE_CHATROOM_FREETALK" ) - file.switchCommunityPanelButtons.append( file.chatroomToggleVoiceModeButton0 ) - Hud_AddEventHandler( file.chatroomToggleVoiceModeButton0, UIE_CLICK, ToggleChatroomVoiceMode0 ) - - file.chatroomToggleVoiceModeButton1 = AddComboButton( comboStruct, headerIndex, buttonIndex++, "#MENU_TITLE_CHATROOM_ADMINSONLY" ) - file.switchCommunityPanelButtons.append( file.chatroomToggleVoiceModeButton1 ) - Hud_AddEventHandler( file.chatroomToggleVoiceModeButton1, UIE_CLICK, ToggleChatroomVoiceMode1 ) - - // comboStruct.navDownButton = file.chatroomMenu_chatroomWidget - ComboButtons_Finalize( comboStruct ) - - file.networksComboStruct = comboStruct -} - -void function SelectNetworkButton_Activate( var button ) -{ - // file.inCommunityPanel = true - Hud_SetFocused( file.switchCommunityPanel_ListWidget ) -} - -void function OnNetworksMenu_NavigateBack() -{ - if ( file.inCommunityPanel ) - { - MyCommunities_OnLoseFocus( file.switchCommunityPanel_ListWidget ) - Hud_SetFocused( file.selectNetWorkbutton ) - } - else - { - CloseActiveMenu( true ) - } -} - -void function OnBrowseMentworksMenu_NavigateBack() -{ - printt( Hud_GetHudName( GetFocus() ) ) - if ( GetFocus() == file.browseCommunitiesPanel_ListWidget ) - { - Hud_Show( file.browseCommunitiesPanel_ViewDetailsButton ) - Hud_SetFocused( file.browseCommunitiesPanel_ViewDetailsButton ) - } - else - { - CloseActiveMenu( true ) - } -} - - -void function OCommunitySendMsg_NavigateBack() -{ - if ( !file.communityEdited ) - { - LeaveEditCommunity() - return - } - - DialogData dialogData - dialogData.header = "#COMMUNITY_ARE_YOU_SURE" - dialogData.message = "#COMMUNITY_CHANGES_WILL_BE_LOST" - - AddDialogButton( dialogData, "#YES", LeaveEditCommunity ) - AddDialogButton( dialogData, "#NO" ) - - dialogData.noChoiceWithNavigateBack = true - OpenDialog( dialogData ) -} - - -string function GetMyRegion_Localized() -{ - string myRegion = MyRegion() - - string myRegion_localized - - if ( myRegion in file.keysToStrings ) - myRegion_localized = Localize( "#MY_REGION_N", Localize( ConvertKeyToLocalizedString( myRegion ) ) ) - - return myRegion_localized -} - -#if NETWORK_INVITE -void function OnInviteFriendsToNetworkButton_Activate( var button ) -{ - if( Hud_IsLocked( button ) ) - return - - AdvanceMenu( GetMenu( "InviteFriendsToNetworkMenu" ) ) -} -#endif diff --git a/Northstar.Client/mod/scripts/vscripts/ui/menu_inbox.nut b/Northstar.Client/mod/scripts/vscripts/ui/menu_inbox.nut deleted file mode 100644 index 66f38cba9..000000000 --- a/Northstar.Client/mod/scripts/vscripts/ui/menu_inbox.nut +++ /dev/null @@ -1,716 +0,0 @@ - -global function InitInboxFrontMenu -global function InitInboxMenu - -global function TryToShowAnInboxMessage -global function UICodeCallback_InboxUpdated -global function OnInboxButton_Activate - -const int NUM_DISPLAY_RECENT_UNLOCKS = 5 - -struct -{ - var menu - - var messagesButton - var lootButton - - var messagesCountLabel - var lootCountLabel - - var lootDisplay - array recentLootUnlocks - array reportedMessageIds - - var inboxMenu - var inboxPanel - var inboxCommunityName - var inboxSenderName - var inboxDate - var inboxMessageText - int inboxCurrentMessageId - int inboxPrevMessageId - int inboxNextMessageId - int reportAbuseCommunityId - int reportAbuseSeverity - var inboxPrevMsgButton - var inboxNextMsgButton - var inboxDeleteButton - var inboxAcceptButton - var inboxReportAbuseButton - var inboxCanDeleteMsg - var inboxCanAcceptMsg - var inboxCanReportAbuse - bool inboxThreadRunning - - string oldMessageText -} file - -void function InitInboxFrontMenu() -{ - var menu = GetMenu( "InboxFrontMenu" ) - file.menu = menu - - AddMenuEventHandler( menu, eUIEvent.MENU_OPEN, OnOpenInboxFrontMenu ) - AddMenuEventHandler( menu, eUIEvent.MENU_CLOSE, OnCloseInboxFrontMenu ) - - file.messagesButton = Hud_GetChild( menu, "MessagesButton" ) - Hud_AddEventHandler( file.messagesButton, UIE_CLICK, OnMessagesButton_Activate ) - - file.lootButton = Hud_GetChild( menu, "LootButton" ) - Hud_AddEventHandler( file.lootButton, UIE_CLICK, OnLootButton_Activate ) - - file.messagesCountLabel = Hud_GetChild( menu, "MessagesCountLabel" ) - file.lootCountLabel = Hud_GetChild( menu, "LootCountLabel" ) - - file.lootDisplay = Hud_GetChild( menu, "LootDisplay" ) - - for ( int index = 0; index < NUM_DISPLAY_RECENT_UNLOCKS; index++ ) - { - file.recentLootUnlocks.append( Hud_GetChild( menu, "RecentUnlock" + index ) ) - } - - AddMenuFooterOption( menu, BUTTON_A, "#A_BUTTON_SELECT", "", null, DoesFocusHaveItems ) - AddMenuFooterOption( menu, BUTTON_B, "#B_BUTTON_BACK", "#BACK" ) -} - - -void function OnOpenInboxFrontMenu() -{ - UpdateInboxFrontButtons() - thread UpdateInboxFrontThread() - UI_SetPresentationType( ePresentationType.NO_MODELS ) -} - -void function OnCloseInboxFrontMenu() -{ - Signal( uiGlobal.signalDummy, "StopInboxThread" ) -} - - -void function UpdateInboxFrontThread() -{ - EndSignal( uiGlobal.signalDummy, "CleanupInGameMenus" ) - - while ( GetTopNonDialogMenu() == GetMenu( "InboxFrontMenu" ) ) - { - UpdateInboxFrontButtons() - - wait 0.1 - } -} - -bool function DoesFocusHaveItems() -{ - entity player = GetUIPlayer() - - if ( !player ) - return false - - var button = GetFocus() - if ( button == file.messagesButton ) - return Inbox_GetTotalMessageCount() > 0 - else if ( button == file.lootButton ) - return PlayerRandomUnlock_GetTotal( player ) > 0 - - return true -} - -void function UpdateInboxFrontButtons() -{ - entity player = GetUIPlayer() - - if ( !player ) - return - - int totalMessages = Inbox_GetTotalMessageCount() - array messageIds - array lootIds - - for ( int messageIndex = 0; messageIndex < totalMessages; messageIndex++ ) - { - int messageId = Inbox_GetMessageIdByIndex( messageIndex ) - InboxMessage inboxMessage = Inbox_GetMessage( messageId ) - messageIds.append( inboxMessage.messageId ) - } - - if ( messageIds.len() ) - { - string countString - if ( messageIds.len() >= MAX_MAIL_COUNT ) - countString = MAX_MAIL_COUNT + "+" - else - countString = string( messageIds.len() ) - - - SetButtonRuiText( file.messagesButton, "#COMMUNITY_INBOX_READ_MESSAGE" ) - if ( messageIds.len() == 1 ) - SetLabelRuiText( file.messagesCountLabel, Localize( "#COMMUNITY_INBOX_MESSAGE_COUNT_1" ) ) - else - SetLabelRuiText( file.messagesCountLabel, Localize( "#COMMUNITY_INBOX_MESSAGE_COUNT_N", countString ) ) - } - else - { - SetButtonRuiText( file.messagesButton, "#COMMUNITY_INBOX_NO_MESSAGES" ) - SetLabelRuiText( file.messagesCountLabel, Localize( "#COMMUNITY_INBOX_MESSAGE_COUNT_0" ) ) - //SetLabelRuiText( file.messagesCountLabel, "" ) - } - Hud_SetLocked( file.messagesButton, messageIds.len() == 0 ) - - int totalRandomUnlocks = PlayerRandomUnlock_GetTotal( player ) - - if ( totalRandomUnlocks ) - { - SetButtonRuiText( file.lootButton, "#COMMUNITY_INBOX_OPEN_LOOT" ) - if ( totalRandomUnlocks == 1 ) - SetLabelRuiText( file.lootCountLabel, Localize( "#COMMUNITY_INBOX_LOOT_COUNT_1" ) ) - else - SetLabelRuiText( file.lootCountLabel, Localize( "#COMMUNITY_INBOX_LOOT_COUNT_N", totalRandomUnlocks ) ) - } - else - { - SetButtonRuiText( file.lootButton, "#COMMUNITY_INBOX_NO_LOOT" ) - SetLabelRuiText( file.lootCountLabel, Localize( "#COMMUNITY_INBOX_LOOT_COUNT_0" ) ) - //SetLabelRuiText( file.lootCountLabel, "" ) - } - Hud_SetLocked( file.lootButton, totalRandomUnlocks == 0 ) - - var lootDisplayRui = Hud_GetRui( file.lootDisplay ) - RuiSetInt( lootDisplayRui, "coliseumTicketCount", Player_GetColiseumTicketCount( player ) ) - RuiSetInt( lootDisplayRui, "doubleXPCount", Player_GetDoubleXPCount( player ) ) - - for ( int index = 0; index < NUM_DISPLAY_RECENT_UNLOCKS; index++ ) - { - ItemDisplayData ornull displayData = Player_GetRecentUnlock( player, index ) - var recentLootRui = Hud_GetRui( file.recentLootUnlocks[index] ) - - if ( displayData != null ) - { - expect ItemDisplayData( displayData ) - int count = Player_GetRecentUnlockCount( player, index ) - - string title - string category - string parentTitle - if ( displayData.parentRef != "" ) - { - parentTitle = Localize( GetItemName( displayData.parentRef ) ) - string categoryName = GetItemRefTypeName( displayData.ref, displayData.parentRef ) - category = Localize( categoryName, Localize( parentTitle ) ) - //category = Localize( categoryName ) - title = Localize( displayData.name ) - } - else - { - string categoryName = GetItemRefTypeName( displayData.ref ) - category = Localize( categoryName ) - title = Localize( displayData.name ) - parentTitle = "" - } - - if ( count > 1 ) - title = Localize( "#COMMUNITY_INBOX_ITEM_XN", title, count ) - - RuiSetImage( recentLootRui, "unlockImage", displayData.image ) - RuiSetString( recentLootRui, "unlockTitle", title ) - RuiSetString( recentLootRui, "unlockCategory", category ) - RuiSetString( recentLootRui, "unlockParentTitle", parentTitle ) - RuiSetInt( recentLootRui, "unlockImageAtlas", displayData.imageAtlas ) - RuiSetFloat2( recentLootRui, "unlockImageRatio", GetItemImageAspect( displayData.ref ) ) - RuiSetFloat( recentLootRui, "unlockAlpha", 1.0 - index / NUM_DISPLAY_RECENT_UNLOCKS ) - } - else - { - RuiSetImage( recentLootRui, "unlockImage", $"" ) - RuiSetString( recentLootRui, "unlockTitle", "" ) - RuiSetInt( recentLootRui, "unlockImageAtlas", -1 ) - RuiSetFloat( recentLootRui, "unlockAlpha", 0.0 ) - } - } - //Inbox_HasNewMessages - //Inbox_HasUnreadMessages - //Inbox_MarkMessageRead - //Inbox_GetPrevMessageId - //Inbox_GetNextMessageId - //Inbox_GetMessage -} - -void function OnMessagesButton_Activate( var button ) -{ - if ( Hud_IsLocked( button ) ) - return - - AdvanceMenu( GetMenu( "Inbox" ) ) - Hud_SetFocused( file.inboxMessageText ) -} - - - -void function OnLootButton_Activate( var button ) -{ - if ( Hud_IsLocked( button ) ) - return - - ClientCommand( "UnlockRandomLoot" ) - EmitUISound( "Menu_AdvocateGift_Open" ) -} - - -void function InitInboxMenu() -{ - RegisterSignal( "StopInboxThread" ) - RegisterSignal( "StopMessageAbuseReports" ) - - var menu = GetMenu( "Inbox" ) - file.inboxMenu = menu - var inboxPanel = Hud_GetChild( menu, "InboxPanel" ) - - AddMenuEventHandler( menu, eUIEvent.MENU_OPEN, OnInboxMenu_Open ) - - file.inboxCurrentMessageId = Inbox_GetMessageIdByIndex( 0 ) - file.inboxNextMessageId = Inbox_GetNextMessageId( file.inboxCurrentMessageId ) - file.inboxPrevMessageId = Inbox_GetPrevMessageId( file.inboxCurrentMessageId ) - - file.inboxCommunityName = Hud_GetChild( inboxPanel, "CommunityName" ) - file.inboxSenderName = Hud_GetChild( inboxPanel, "Sender" ) - file.inboxDate = Hud_GetChild( inboxPanel, "Date" ) - file.inboxMessageText = Hud_GetChild( inboxPanel, "Message" ) - // file.inboxPrevMsgButton = Hud_GetChild( inboxPanel, "PrevMessageButton" ) - // AddEventHandlerToButton( inboxPanel, "PrevMessageButton", UIE_CLICK, ActivatePrevMessage_OnClick ) - // file.inboxNextMsgButton = Hud_GetChild( inboxPanel, "NextMessageButton" ) - // AddEventHandlerToButton( inboxPanel, "NextMessageButton", UIE_CLICK, ActivateNextMessage_OnClick ) - - //file.inboxDeleteButton = Hud_GetChild( inboxPanel, "DeleteMessageButton" ) - //AddEventHandlerToButton( inboxPanel, "DeleteMessageButton", UIE_CLICK, DeleteMessage_OnClick ) - //file.inboxAcceptButton = Hud_GetChild( inboxPanel, "AcceptMessageButton" ) - //AddEventHandlerToButton( inboxPanel, "AcceptMessageButton", UIE_CLICK, AcceptMessage_OnClick ) - // - var elem = Hud_GetChild( inboxPanel, "MailIcon" ) - var rui = Hud_GetRui( elem ) - RuiSetImage( rui, "basicImage", $"rui/menu/common/inbox_icon_new" ) - - AddMenuFooterOption( menu, BUTTON_B, "#B_BUTTON_BACK", "#BACK" ) - // AddMenuFooterOption( menu, BUTTON_X, "#X_BUTTON_INBOX_ACCEPT_ALL", "#INBOX_ACCEPT_ALL", AcceptAllMessage_OnClick, CanOnlyAcceptOrOnlyDeleteMessage ) - AddMenuFooterOption( menu, BUTTON_X, "#X_BUTTON_INBOX_DONE", "#INBOX_DONE", AcceptMessage_OnClick, CanOnlyAcceptMessage ) - AddMenuFooterOption( menu, BUTTON_X, "#X_BUTTON_INBOX_DONE", "#INBOX_DONE", DeleteMessage_OnClick, CanOnlyDeleteMessage ) - AddMenuFooterOption( menu, BUTTON_X, "#X_BUTTON_YES", "#YES", AcceptMessage_OnClick, CanAcceptAndDeleteMessage ) - AddMenuFooterOption( menu, BUTTON_Y, "#Y_BUTTON_NO", "#NO", DeleteMessage_OnClick, CanAcceptAndDeleteMessage ) - AddMenuFooterOption( menu, BUTTON_Y, "#COMMUNITY_REPORTMSGABUSE_YBUTTON", "#COMMUNITY_REPORTMSGABUSE", ReportMessageAbuse_OnClick, CanReportMessageAbuse ) -} - - - -void function OnInboxMenu_Open() -{ - UI_SetPresentationType( ePresentationType.NO_MODELS ) -} - -bool function CanDeleteMessage() -{ - bool res = bool( IsViewingMessages() && file.inboxCanDeleteMsg ) - return res -} - -bool function CanAcceptMessage() -{ - bool res = bool( IsViewingMessages() && file.inboxCanAcceptMsg ) - return res -} - -bool function CanOnlyAcceptMessage() -{ - return CanAcceptMessage() && !CanDeleteMessage() -} - -bool function CanOnlyDeleteMessage() -{ - return CanDeleteMessage() && !CanAcceptMessage() -} - -bool function CanOnlyAcceptOrOnlyDeleteMessage() -{ - return CanOnlyAcceptMessage() || CanOnlyDeleteMessage() -} - -bool function CanAcceptAndDeleteMessage() -{ - return CanAcceptMessage() && CanDeleteMessage() -} - -bool function IsViewingMessages() -{ - return Hud_IsVisible( file.inboxMenu ) -} - -bool function HasPrevMessage() -{ - if ( !IsViewingMessages() ) - return false - - if ( file.inboxPrevMessageId >= 0 ) - return true - - return false -} - -bool function HasNextMessage() -{ - if ( !IsViewingMessages() ) - return false - - if ( file.inboxNextMessageId >= 0 ) - return true - - return false -} - - -void function DeleteMessage_OnClick( var button ) -{ - printt( "deleting message id " + file.inboxCurrentMessageId ) - if ( file.inboxCurrentMessageId >= 0 ) - Inbox_DeleteMessage( file.inboxCurrentMessageId ) - - CloseActiveMenu() - //TryToShowAnInboxMessage() - // - //UpdateFooterOptions() -} - -void function AcceptMessage_OnClick( var button ) -{ - AcceptMessage() - CloseActiveMenu() - - /* - DialogData dialogData - dialogData.header = "#ACCEPT_MESSAGE_COMFIRM" - dialogData.message = "#ACCEPT_MESSAGE_COMFIRM_SUB" - - - AddDialogButton( dialogData, "#YES", AcceptMessage ) - AddDialogButton( dialogData, "#NO" ) - - AddDialogFooter( dialogData, "#A_BUTTON_SELECT" ) - AddDialogFooter( dialogData, "#B_BUTTON_BACK" ) - - OpenDialog( dialogData ) - */ -} - -void function AcceptAllMessage_OnClick( var button ) -{ - DialogData dialogData - dialogData.header = "#ACCEPT_ALL_MESSAGE_COMFIRM" - dialogData.message = "#ACCEPT_ALL_MESSAGE_COMFIRM_SUB" - - - AddDialogButton( dialogData, "#YES", AcceptMessage ) - AddDialogButton( dialogData, "#NO" ) - - AddDialogFooter( dialogData, "#A_BUTTON_SELECT" ) - AddDialogFooter( dialogData, "#B_BUTTON_BACK" ) - - OpenDialog( dialogData ) -} - -void function AcceptMessage() -{ - if ( CanAcceptMessage() ) - { - if ( file.inboxCurrentMessageId >= 0 ) - { - Inbox_ExecuteMessageAction( file.inboxCurrentMessageId ) - } - } - - DeleteMessage_OnClick( null ) -} - -void function ReportMessageAbuse_Final() -{ - if ( file.reportedMessageIds.len() > 100 ) - return - - foreach ( messageId in file.reportedMessageIds ) - { - if ( messageId == file.inboxCurrentMessageId ) - return - } - - ReportCommunity( file.reportAbuseCommunityId, file.reportAbuseSeverity ) - - file.reportedMessageIds.append( file.inboxCurrentMessageId ) - ReportInboxMessage( file.inboxCurrentMessageId, file.reportAbuseSeverity ) -} - -void function ReportMessageAbuseAndLeaveNetwork_Final() -{ - file.reportAbuseSeverity = 1 - ReportMessageAbuse_Final() - if ( AreWeInCommunity( file.reportAbuseCommunityId ) ) - LeaveCommunity( file.reportAbuseCommunityId ) -} - -void function ReportMessageAbuse_Thread( InboxMessage msg ) -{ - Signal( uiGlobal.signalDummy, "StopMessageAbuseReports" ) - EndSignal( uiGlobal.signalDummy, "StopMessageAbuseReports" ) - - DialogData dialogData - - file.reportAbuseCommunityId = msg.communityID - file.reportAbuseSeverity = 0 - - dialogData.header = Localize( "#REALLY_REPORT_ABUSEMSG_HEADER" ) - dialogData.message = Localize( "#REALLY_REPORT_ABUSEMSG" ) - - AddDialogButton( dialogData, "#NO" ) - AddDialogButton( dialogData, "#YES_REPORT_ABUSEMSG", ReportMessageAbuse_Final ) - if ( AreWeInCommunity( file.reportAbuseCommunityId ) ) - AddDialogButton( dialogData, "#YES_REPORTMSG_AND_LEAVENETWORK", ReportMessageAbuseAndLeaveNetwork_Final ) - - AddDialogFooter( dialogData, "#A_BUTTON_SELECT" ) - AddDialogFooter( dialogData, "#B_BUTTON_BACK" ) - - OpenDialog( dialogData ) -} - -void function ReportMessageAbuse_OnClick( var button ) -{ - EmitUISound( "Menu.Accept" ) - - InboxMessage msg = Inbox_GetMessage( file.inboxCurrentMessageId ) - Assert( IsValid( msg ) ) - if ( msg.senderUID == "" ) - return - - thread ReportMessageAbuse_Thread( msg ) -} - -bool function CanReportMessageAbuse() -{ - if ( CanAcceptAndDeleteMessage() ) - return false; - - InboxMessage msg = Inbox_GetMessage( file.inboxCurrentMessageId ) - Assert( IsValid( msg ) ) - - if ( file.reportedMessageIds.len() > 100 ) - return false - - foreach ( messageId in file.reportedMessageIds ) - { - if ( messageId == msg.messageId ) - return false - } - - return msg.reportable -} - -void function ActivateNextMessage( var button ) -{ - if ( file.inboxNextMessageId >= 0 ) - { - file.inboxCurrentMessageId = file.inboxNextMessageId - file.inboxNextMessageId = Inbox_GetNextMessageId( file.inboxCurrentMessageId ) - file.inboxPrevMessageId = Inbox_GetPrevMessageId( file.inboxCurrentMessageId ) - - /* - var rui = Hud_GetRui( file.inboxMessageText ) - RuiSetInt( rui, "direction", 1 ) - */ - - ShowInboxMessage( file.inboxCurrentMessageId ) - - UpdateFooterOptions() - } -} - -void function ActivatePrevMessage( var button ) -{ - if ( file.inboxPrevMessageId >= 0 ) - { - file.inboxCurrentMessageId = file.inboxPrevMessageId - file.inboxNextMessageId = Inbox_GetNextMessageId( file.inboxCurrentMessageId ) - file.inboxPrevMessageId = Inbox_GetPrevMessageId( file.inboxCurrentMessageId ) - - /* - var rui = Hud_GetRui( file.inboxMessageText ) - RuiSetInt( rui, "direction", -1 ) - */ - - ShowInboxMessage( file.inboxCurrentMessageId ) - - UpdateFooterOptions() - } -} - - -bool function UpdateInboxMessageUI( InboxMessage msg ) -{ - if ( msg.messageId < 0 ) - return false - - Hud_SetUTF8Text( file.inboxCommunityName, Localize( msg.communityName ) ) - Hud_SetUTF8Text( file.inboxSenderName, Localize( msg.senderName ) ) - Hud_SetUTF8Text( file.inboxDate, Localize( msg.dateSent ) ) - Hud_SetUTF8Text( file.inboxMessageText, Localize( msg.messageText ) ) - - Hud_SetFocused( file.inboxMessageText ); - - if ( file.oldMessageText != msg.messageText ) - { - printt( "setting new message:" ) - printt( msg.messageText ) - printt( Time() ) - /* - var rui = Hud_GetRui( file.inboxMessageText ) - RuiSetString( rui, "oldMessage", file.oldMessageText ) - RuiSetString( rui, "newMessage", msg.messageText ) - RuiSetGameTime( rui, "startTime", Time() ) - */ - file.oldMessageText = msg.messageText - } - - Inbox_MarkMessageRead( msg.messageId ) - - int prevMsgId = Inbox_GetPrevMessageId( msg.messageId ) - #if PC_PROG - // if ( prevMsgId >= 0 ) - // Hud_Show( file.inboxPrevMsgButton ) - // else - // Hud_Hide( file.inboxPrevMsgButton ) - #endif - - int nextMsgId = Inbox_GetNextMessageId( msg.messageId ) - #if PC_PROG - // if ( nextMsgId >= 0 ) - // Hud_Show( file.inboxNextMsgButton ) - // else - // Hud_Hide( file.inboxNextMsgButton ) - #endif - - file.inboxCanDeleteMsg = msg.deletable - //#if PC_PROG - // if ( file.inboxCanDeleteMsg ) - // Hud_Show( file.inboxDeleteButton ) - // else - // Hud_Hide( file.inboxDeleteButton ) - //#endif - - file.inboxCanAcceptMsg = msg.actionURL != "" - - if ( file.inboxCanAcceptMsg ) - { - //Hud_Show( file.inboxAcceptButton ) - //// Hud_SetFocused( file.inboxAcceptButton ) - //Hud_SetText( file.inboxAcceptButton, msg.actionLabel ) - } - else - { - //#if PC_PROG - // // Hud_SetFocused( file.inboxDeleteButton ) - //#endif - //Hud_Hide( file.inboxAcceptButton ) - } - - UpdateFooterOptions() - - return true -} - -void function UICodeCallback_InboxUpdated() -{ - ShowNotification() - - //ArmoryMenu_UpdateInboxButtons() - Lobby_UpdateInboxButtons() - Search_UpdateInboxButtons() - - TryToShowAnInboxMessage() -} - - -void function KeepUpdatingInboxMessageThread() -{ - Signal( uiGlobal.signalDummy, "StopInboxThread" ) - - while ( true ) - { - WaitFrameOrUntilLevelLoaded() - InboxMessage msg = Inbox_GetMessage( file.inboxCurrentMessageId ) - if ( msg.messageId >= 0 ) - UpdateInboxMessageUI( msg ) - if ( msg.doneResolving ) - return - } - Assert( false ) -} - -void function ActivatePrevMessage_OnClick( var button ) -{ - ActivatePrevMessage( button ) -} - -void function ActivateNextMessage_OnClick( var button ) -{ - ActivateNextMessage( button ) -} - -bool function ShowInboxMessage( int messageId ) -{ - if ( Inbox_GetTotalMessageCount() ) - { - Assert( messageId >= 0 ) - InboxMessage msg = Inbox_GetMessage( messageId ) - if ( msg.messageId < 0 ) // invalid - return false - - Signal( uiGlobal.signalDummy, "StopInboxThread" ) - thread KeepUpdatingInboxMessageThread() - return true - } - - return false -} - -bool function TryToShowAnInboxMessage() -{ - // file.inboxCurrentMessageId = Inbox_GetNextMessageId( file.inboxCurrentMessageId ) - InboxMessage msg = Inbox_GetMessage( file.inboxCurrentMessageId ) - if ( msg.messageId < 0 ) // invalid - { - file.inboxCurrentMessageId = Inbox_GetPrevMessageId( file.inboxCurrentMessageId ) - InboxMessage msg = Inbox_GetMessage( file.inboxCurrentMessageId ) - if ( msg.messageId < 0 ) // invalid - file.inboxCurrentMessageId = Inbox_GetMessageIdByIndex( 0 ) - } - - file.inboxNextMessageId = Inbox_GetNextMessageId( file.inboxCurrentMessageId ) - file.inboxPrevMessageId = Inbox_GetPrevMessageId( file.inboxCurrentMessageId ) - - if ( !ShowInboxMessage( file.inboxCurrentMessageId ) ) - { - if ( IsViewingMessages() ) - CloseActiveMenu() - return false - } - return true -} - -void function OnInboxButton_Activate( var button ) -{ - //if ( !Inbox_GetTotalMessageCount() || !TryToShowAnInboxMessage() ) - //{ - // if ( IsViewingMessages() ) - // CloseActiveMenu() - // return - //} - // - //AdvanceMenu( file.inboxMenu ) - if( Hud_IsLocked( button ) ) - return - - AdvanceMenu( GetMenu( "InboxFrontMenu" ) ) -} diff --git a/Northstar.Client/mod/scripts/vscripts/ui/menu_lobby.nut b/Northstar.Client/mod/scripts/vscripts/ui/menu_lobby.nut index 731d9158a..eedb29c30 100644 --- a/Northstar.Client/mod/scripts/vscripts/ui/menu_lobby.nut +++ b/Northstar.Client/mod/scripts/vscripts/ui/menu_lobby.nut @@ -360,13 +360,13 @@ void function SetupComboButtonTest( var menu ) var networksInbox = AddComboButton( comboStruct, headerIndex, buttonIndex++, "#MENU_TITLE_INBOX" ) file.inboxButton = networksInbox file.lobbyButtons.append( networksInbox ) - Hud_AddEventHandler( networksInbox, UIE_CLICK, OnInboxButton_Activate ) + Hud_AddEventHandler( networksInbox, UIE_CLICK, _OnInboxButton_Activate ) var switchButton = AddComboButton( comboStruct, headerIndex, buttonIndex++, "#COMMUNITY_SWITCHCOMMUNITY" ) file.switchButton = switchButton - Hud_AddEventHandler( switchButton, UIE_CLICK, OnSwitchButton_Activate ) + Hud_AddEventHandler( switchButton, UIE_CLICK, _OnSwitchButton_Activate ) var browseButton = AddComboButton( comboStruct, headerIndex, buttonIndex++, "#COMMUNITY_BROWSE_NETWORKS" ) file.lobbyButtons.append( browseButton ) - Hud_AddEventHandler( browseButton, UIE_CLICK, OnBrowseNetworksButton_Activate ) + Hud_AddEventHandler( browseButton, UIE_CLICK, _OnBrowseNetworksButton_Activate ) file.browseNetworkButton = browseButton #if NETWORK_INVITE file.inviteFriendsToNetworkButton = AddComboButton( comboStruct, headerIndex, buttonIndex++, "#INVITE_FRIENDS" ) @@ -410,6 +410,30 @@ void function SetupComboButtonTest( var menu ) ComboButtons_Finalize( comboStruct ) } +void function _OnInboxButton_Activate( var button ) +{ + if ( Hud_IsLocked( button ) ) + return + + OnInboxButton_Activate( button) +} + +void function _OnSwitchButton_Activate( var button ) +{ + if ( Hud_IsLocked( button ) ) + return + + OnSwitchButton_Activate( button) +} + +void function _OnBrowseNetworksButton_Activate( var button ) +{ + if ( Hud_IsLocked( button ) ) + return + + OnBrowseNetworksButton_Activate( button) +} + bool function MatchResultsExist() { return true // TODO From b0c668634b541f0a55252c99fe3393bbcabbb2bc Mon Sep 17 00:00:00 2001 From: Will <39478251+VITALISED@users.noreply.github.com> Date: Thu, 2 May 2024 20:06:16 +1000 Subject: [PATCH 25/38] Move weapon mods to custom weapons, prevent indexing issues --- .../scripts/weapons/mp_weapon_softball.txt | 14 - .../scripts/weapons/mp_weapon_wingman.txt | 11 - .../scripts/weapons/mp_weapon_wingman_n.txt | 28 - .../vscripts/gamemodes/_gamemode_chamber.nut | 2 +- .../vscripts/gamemodes/_gamemode_sns.gnut | 4 +- .../sh_northstar_custom_precache.gnut | 3 + .../scripts/weapons/mp_weapon_ns_softball.txt | 554 ++++++++++++++++ .../scripts/weapons/mp_weapon_ns_wingman.txt | 582 +++++++++++++++++ .../weapons/mp_weapon_ns_wingman_n.txt | 593 ++++++++++++++++++ ULTRAMenu | 1 + 10 files changed, 1736 insertions(+), 56 deletions(-) delete mode 100644 Northstar.Custom/keyvalues/scripts/weapons/mp_weapon_softball.txt delete mode 100644 Northstar.Custom/keyvalues/scripts/weapons/mp_weapon_wingman.txt delete mode 100644 Northstar.Custom/keyvalues/scripts/weapons/mp_weapon_wingman_n.txt create mode 100644 Northstar.Custom/mod/scripts/weapons/mp_weapon_ns_softball.txt create mode 100644 Northstar.Custom/mod/scripts/weapons/mp_weapon_ns_wingman.txt create mode 100644 Northstar.Custom/mod/scripts/weapons/mp_weapon_ns_wingman_n.txt create mode 160000 ULTRAMenu diff --git a/Northstar.Custom/keyvalues/scripts/weapons/mp_weapon_softball.txt b/Northstar.Custom/keyvalues/scripts/weapons/mp_weapon_softball.txt deleted file mode 100644 index 5da9357f0..000000000 --- a/Northstar.Custom/keyvalues/scripts/weapons/mp_weapon_softball.txt +++ /dev/null @@ -1,14 +0,0 @@ -WeaponData -{ - Mods - { - sns - { - explosion_damage "50" - damage_near_value "50" - damage_far_value "50" - ammo_clip_size "1" - projectile_launch_speed "7500" - } - } -} diff --git a/Northstar.Custom/keyvalues/scripts/weapons/mp_weapon_wingman.txt b/Northstar.Custom/keyvalues/scripts/weapons/mp_weapon_wingman.txt deleted file mode 100644 index 8255df15b..000000000 --- a/Northstar.Custom/keyvalues/scripts/weapons/mp_weapon_wingman.txt +++ /dev/null @@ -1,11 +0,0 @@ -WeaponData -{ - Mods - { - one_in_the_chamber - { - damage_near_value "9999" - damage_far_value "9999" - } - } -} \ No newline at end of file diff --git a/Northstar.Custom/keyvalues/scripts/weapons/mp_weapon_wingman_n.txt b/Northstar.Custom/keyvalues/scripts/weapons/mp_weapon_wingman_n.txt deleted file mode 100644 index da0c26012..000000000 --- a/Northstar.Custom/keyvalues/scripts/weapons/mp_weapon_wingman_n.txt +++ /dev/null @@ -1,28 +0,0 @@ -WeaponData -{ - Mods - { - one_in_the_chamber - { - damage_near_value "9999" - damage_far_value "9999" - damage_very_far_value "9999" - } - sns - { - damage_near_value "9999" - damage_far_value "9999" - damage_very_far_value "9999" - ammo_clip_size "1" - reload_time "*0.5" - reload_time_late1 "*0.5" - reloadempty_time "*0.5" - reloadempty_time_late1 "*0.5" - bolt_bounce_frac "0.7" - projectile_damage_reduction_per_bounce "0.0" - projectile_damages_owner "0" - projectile_ricochet_max_count "3" - ads_move_speed_scale "1" - } - } -} \ No newline at end of file diff --git a/Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_chamber.nut b/Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_chamber.nut index 5768dcfaf..2391589ed 100644 --- a/Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_chamber.nut +++ b/Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_chamber.nut @@ -86,7 +86,7 @@ void function UpdateLoadout( entity player ) player.TakeWeaponNow( weapon.GetWeaponClassName() ) array mods = ["one_in_the_chamber"] - player.GiveWeapon( (GetChamberWingmanN() ? "mp_weapon_wingman_n" : "mp_weapon_wingman"), mods) + player.GiveWeapon( (GetChamberWingmanN() ? "mp_weapon_ns_wingman_n" : "mp_weapon_ns_wingman"), mods) player.GiveOffhandWeapon( "melee_pilot_kunai", OFFHAND_MELEE ) thread SetAmmo( player ) diff --git a/Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_sns.gnut b/Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_sns.gnut index 812c21ee6..8de583c5c 100644 --- a/Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_sns.gnut +++ b/Northstar.Custom/mod/scripts/vscripts/gamemodes/_gamemode_sns.gnut @@ -135,10 +135,10 @@ void function OnPlayerRespawned( entity player ) player.TakeWeaponNow( weapon.GetWeaponClassName() ) array mods = ["sns", "pas_fast_ads", "tactical_cdr_on_kill", "pas_run_and_gun", "pas_fast_swap"] - player.GiveWeapon( "mp_weapon_wingman_n", mods) + player.GiveWeapon( "mp_weapon_ns_wingman_n", mods) if (file.softball_enabled) { mods.append("jump_kit") // the funny - player.GiveWeapon( "mp_weapon_softball", mods) + player.GiveWeapon( "mp_weapon_ns_softball", mods) } player.GiveOffhandWeapon( "melee_pilot_emptyhanded", OFFHAND_MELEE ) player.GiveOffhandWeapon( file.offhand_weapon, OFFHAND_RIGHT ) diff --git a/Northstar.Custom/mod/scripts/vscripts/sh_northstar_custom_precache.gnut b/Northstar.Custom/mod/scripts/vscripts/sh_northstar_custom_precache.gnut index b8d4b1ba2..e9d54c2f4 100644 --- a/Northstar.Custom/mod/scripts/vscripts/sh_northstar_custom_precache.gnut +++ b/Northstar.Custom/mod/scripts/vscripts/sh_northstar_custom_precache.gnut @@ -6,6 +6,9 @@ void function NorthstarCustomPrecache() PrecacheWeapon( "mp_titanweapon_triplethreat" ) PrecacheWeapon( "mp_titanweapon_arc_cannon" ) PrecacheWeapon( "melee_pilot_kunai" ) + PrecacheWeapon( "mp_weapon_ns_wingman" ) + PrecacheWeapon( "mp_weapon_ns_wingman_n" ) + PrecacheWeapon( "mp_weapon_ns_softball" ) RegisterWeaponDamageSources( { diff --git a/Northstar.Custom/mod/scripts/weapons/mp_weapon_ns_softball.txt b/Northstar.Custom/mod/scripts/weapons/mp_weapon_ns_softball.txt new file mode 100644 index 000000000..372c18dc3 --- /dev/null +++ b/Northstar.Custom/mod/scripts/weapons/mp_weapon_ns_softball.txt @@ -0,0 +1,554 @@ +WeaponData +{ + // General + "printname" "#WPN_SOFTBALL" + "shortprintname" "#WPN_SOFTBALL_SHORT" + "description" "#WPN_SOFTBALL_DESC" + "longdesc" "#WPN_SOFTBALL_LONGDESC" + + "menu_icon" "r2_ui/menus/loadout_icons/primary_weapon/primary_softball" + "hud_icon" "r2_ui/menus/loadout_icons/primary_weapon/primary_softball" + + "weaponClass" "human" + "body_type" "heavy" + "fire_mode" "semi-auto" + "pickup_hold_prompt" "Hold [USE] [WEAPONNAME]" + "pickup_press_prompt" "[USE] [WEAPONNAME]" + "minimap_reveal_distance" "32000" + "leveled_pickup" "1" + + "OnClientAnimEvent" "GlobalClientEventHandler" + "OnWeaponPrimaryAttack" "OnWeaponPrimaryAttack_weapon_softball" + "OnWeaponNpcPrimaryAttack" "OnWeaponNpcPrimaryAttack_weapon_softball" + "OnProjectileCollision" "OnProjectileCollision_weapon_softball" + + // Menu + "menu_category" "special" + "menu_anim_class" "medium" + "stat_damage" "71" + "stat_range" "66" + "stat_accuracy" "65" + "stat_rof" "19" + + // Models + "viewmodel" "models/weapons/softball_at/ptpov_softball_at.mdl" + "playermodel" "models/weapons/softball_at/w_softball_at.mdl" + "projectilemodel" "models/weapons/bullets/mgl_grenade.mdl" + + // Effects + "tracer_effect" "weapon_tracers_xo16" + "impact_effect_table" "exp_softball_grenade" + "projectile_trail_effect_0" "wpn_grenade_frag_softball" + "vortex_absorb_effect" "wpn_vortex_projectile_frag_FP" + "vortex_absorb_effect_third_person" "wpn_vortex_projectile_frag" + "vortex_absorb_sound" "Vortex_Shield_AbsorbBulletLarge" + "vortex_absorb_sound_1p_vs_3p" "Vortex_Shield_AbsorbBulletLarge_1P_VS_3P" + "vortex_drain" "0.0" + "projectile_adjust_to_gun_barrel" "1" + + "sound_zoom_in" "Weapon_Softball_ADS_In" + "sound_zoom_out" "Weapon_Softball_ADS_Out" + "sound_pickup" "wpn_pickup_MG_1P" + "fire_sound_1_player_1p" "Weapon_Softball_Fire_1P" + "fire_sound_1_player_3p" "Weapon_Softball_Fire_3P" + "fire_sound_1_npc" "Weapon_Softball_Fire_NPC" + + "low_ammo_sound_name_1" "Softball_LowAmmo_Shot1" + "low_ammo_sound_name_2" "Softball_LowAmmo_Shot2" + "low_ammo_sound_name_3" "Softball_LowAmmo_Shot3" + + "fx_muzzle_flash_view" "P_wpn_muzzleflash_mgl_FP_FULL" + "fx_muzzle_flash_world" "P_wpn_muzzleflash_mgl_FULL" + "fx_muzzle_flash_attach" "muzzle_flash" + + "show_grenade_indicator" "1" + + "damage_type" "burn" + + "npc_self_explosion_safety" "0" + + "explosion_inner_radius" "50" + "explosionradius" "150" + "impulse_force" "7000" + + "critical_hit" "0" + "critical_hit_damage_scale" "1.5" + + // Ammo + "ammo_clip_size" "6" + "ammo_size_segmented_reload" "1" + + //"projectile_killreplay_enabled" "1" + + MP_BASE + { + "ammo_default_total" "60" + "ammo_stockpile_max" "60" + "ammo_no_remove_from_clip" "0" + "ammo_no_remove_from_stockpile" "1" + + + // Damage - When Used by Players + "damage_near_value" "10" + "damage_far_value" "10" + "damage_near_value_titanarmor" "0" + "damage_far_value_titanarmor" "0" + "explosion_damage" "90" + "explosion_damage_heavy_armor" "330" + "damage_near_distance" "100" + "damage_far_distance" "1500" + + "red_crosshair_range" "2000" + + // Damage - When Used by NPCs + "npc_damage_near_value" "0" + "npc_damage_far_value" "0" + "npc_damage_near_value_titanarmor" "0" + "npc_damage_far_value_titanarmor" "0" + + // NPC + "npc_min_engage_range" "100" + "npc_max_engage_range" "2000" + "npc_min_engage_range_heavy_armor" "500" + "npc_max_engage_range_heavy_armor" "3500" + "npc_min_range" "0" + "npc_max_range" "8000" + + "npc_min_burst" "1" + "npc_max_burst" "1" + "npc_rest_time_between_bursts_min" "0.5" + "npc_rest_time_between_bursts_max" "1" + + "enable_highlight_networking_on_creation" "" + + "damage_heavyarmor_nontitan_scale" "0.5" + } + + SP_BASE + { + "ammo_default_total" "48" + "ammo_stockpile_max" "48" + "ammo_no_remove_from_clip" "0" + "ammo_no_remove_from_stockpile" "0" + + + // Damage - When Used by Players + "damage_near_value" "45" + "damage_far_value" "45" + "damage_near_value_titanarmor" "45" + "damage_far_value_titanarmor" "45" + "explosion_damage" "80" + "explosion_damage_heavy_armor" "170" + "damage_near_distance" "100" + "damage_far_distance" "2000" + + "red_crosshair_range" "2000" + + // Damage - When Used by NPCs + "npc_damage_near_value" "20" + "npc_damage_far_value" "20" + "npc_damage_near_value_titanarmor" "20" + "npc_damage_far_value_titanarmor" "20" + + // NPC + "npc_min_engage_range" "100" + "npc_max_engage_range" "2000" + "npc_min_engage_range_heavy_armor" "500" + "npc_max_engage_range_heavy_armor" "3500" + "npc_min_range" "0" + "npc_max_range" "8000" + + "npc_min_burst" "1" + "npc_max_burst" "1" + "npc_rest_time_between_bursts_min" "0.5" + "npc_rest_time_between_bursts_max" "1" + + "enable_highlight_networking_on_creation" "1" + + "damage_heavyarmor_nontitan_scale" "1" + } + + "proficiency_poor_spreadscale" "10.0" + "proficiency_average_spreadscale" "10.0" + "proficiency_good_spreadscale" "3.3" + "proficiency_very_good_spreadscale" "3.3" + + "dof_zoom_nearDepthStart" "2.000" + "dof_zoom_nearDepthEnd" "8.500" + "dof_nearDepthStart" "1.683" + "dof_nearDepthEnd" "5.652" + + // Behavior + "fire_rate" "2" + "zoom_time_in" "0.2" + "zoom_time_out" "0.15" + "zoom_fov" "45" + "reload_time" "0.95" + "reloadsegment_time_loop" "0.82" + "reloadsegment_time_end" "0.57" + "reloadsegmentempty_time_end" "0.57" + "reloadempty_time" "0.95" + "holster_time" "0.5" + "deploy_time" "0.63" + "lower_time" "0.25" + "raise_time" "0.3" + "vortex_refire_behavior" "grenade" + "allow_empty_fire" "0" + "reload_enabled" "1" + "reload_is_segmented" "1" + "allow_empty_click" "1" + "empty_reload_only" "0" + "trigger_snipercam" "1" + "allow_headshots" "0" + "grenade_bounce_vel_frac_shallow" "0.47" + "grenade_bounce_vel_frac_sharp" "0.28" + "grenade_bounce_vel_frac_along_normal" "0.5" + "grenade_bounce_randomness" "0.2" + "grenade_bounce_extra_vertical_randomness" "0.2" + "grenade_roll_vel_frac_per_second" "0.1" + "projectile_launch_speed" "2500" + "projectile_first_person_offset_fraction" "2" + + "projectile_inherit_owner_velocity_scale" "1" + + "sprint_fractional_anims" "0" + + "aimassist_disable_hipfire" "0" + "aimassist_disable_ads" "0" + "aimassist_disable_hipfire_humansonly" "0" + "aimassist_disable_ads_humansonly" "0" + + // Spread + "spread_stand_hip" "0.25" + "spread_stand_hip_run" "0.25" + "spread_stand_ads" "0.35" + "spread_stand_hip_sprint" "0.25" + "spread_crouch_hip" "0.25" + "spread_crouch_ads" "0.35" + "spread_air_hip" "0.25" + "spread_air_ads" "0.35" + + "spread_kick_on_fire_stand_hip" "0.1" + "spread_kick_on_fire_stand_ads" ".075" + "spread_kick_on_fire_crouch_hip" "0.1" + "spread_kick_on_fire_crouch_ads" ".05" + "spread_kick_on_fire_air_hip" ".1" + "spread_kick_on_fire_air_ads" ".1" + + "spread_max_kick_stand_hip" "2.0" + "spread_max_kick_stand_ads" "0.0" + "spread_max_kick_crouch_hip" "1.0" + "spread_max_kick_crouch_ads" "0.0" + "spread_max_kick_air_hip" "5.0" + "spread_max_kick_air_ads" "0.0" + + "spread_decay_rate" "5" + "spread_decay_delay" ".1" + + "ammo_suck_behavior" "primary_weapons" + + // View Kick + "viewkick_spring" "launcher" + + "viewkick_pitch_base" "-0.3" + "viewkick_pitch_random" "0.1" + "viewkick_pitch_softScale" "1.2" + "viewkick_pitch_hardScale" "6.75" + + "viewkick_yaw_base" "0.0" + "viewkick_yaw_random" "0.15" + "viewkick_yaw_softScale" "1.3" + "viewkick_yaw_hardScale" "1.0" + + "viewkick_roll_base" "0.0" + "viewkick_roll_randomMin" "0.5" + "viewkick_roll_randomMax" "0.7" + "viewkick_roll_softScale" "0.2" + "viewkick_roll_hardScale" "1.7" + + "viewkick_hipfire_weaponFraction" "0.8" + "viewkick_hipfire_weaponFraction_vmScale" "1.0" + "viewkick_ads_weaponFraction" "0.3" + "viewkick_ads_weaponFraction_vmScale" "0.5" + + "viewkick_perm_pitch_base" "0.0" + "viewkick_perm_pitch_random" "0.3" + "viewkick_perm_yaw_base" "0.0" + "viewkick_perm_yaw_random" "0.2" + + "viewpunch_multiplier" "1.25" + + // Bob + "bob_cycle_time" "0.4" + "bob_vert_dist" "0.19" + "bob_horz_dist" "0.1" + "bob_max_speed" "150" + "bob_pitch" "0.75" + "bob_yaw" "-1.7" + "bob_roll" "1.2" + + // Bob zoomed + "bob_cycle_time_zoomed" "0.4" + "bob_vert_dist_zoomed" "0.19" + "bob_horz_dist_zoomed" "0.1" + "bob_max_speed_zoomed" "150" + "bob_pitch_zoomed" "0.75" + "bob_yaw_zoomed" "-1.7" + "bob_roll_zoomed" "1.2" + + // Rumble + "fire_rumble" "rumble_grenadier" + + // Sway + "sway_rotate_attach" "SWAY_ROTATE" + "sway_min_x" "-0.5" + "sway_min_y" "-0.5" + "sway_min_z" "-0.6" + "sway_max_x" "0.5" + "sway_max_y" "0.5" + "sway_max_z" "0.6" + "sway_min_pitch" "-3" + "sway_min_yaw" "-2.5" + "sway_min_roll" "-4" + "sway_max_pitch" "3" + "sway_max_yaw" "2.5" + "sway_max_roll" "4" + "sway_translate_gain" "2.5" + "sway_rotate_gain" "7" + "sway_move_forward_translate_x" "-0.1" + "sway_move_forward_translate_z" "-0.5" + "sway_move_back_translate_x" "0.2" + "sway_move_back_translate_z" "-0.2" + "sway_move_left_translate_y" "-1" + "sway_move_left_translate_z" "-0.5" + "sway_move_left_rotate_roll" "-4" + "sway_move_right_translate_y" "1" + "sway_move_right_translate_z" "-0.5" + "sway_move_right_rotate_roll" "4" + "sway_move_up_translate_z" "-1" + "sway_move_down_translate_z" "1" + "sway_turn_left_rotate_yaw" "-2.5" + "sway_turn_right_rotate_yaw" "2.5" + + "sway_turn_left_translate_y" ".5" + "sway_turn_right_translate_y" "-.5" + "sway_turn_up_translate_z" ".2" + "sway_turn_down_translate_z" "-.2" + "sway_turn_up_translate_x" ".1" + "sway_turn_down_translate_x" "-.1" + + "sway_turn_left_rotate_roll" "4" + "sway_turn_right_rotate_roll" "-4" + "sway_turn_up_rotate_pitch" "3" + "sway_turn_down_rotate_pitch" "-3" + "sway_turn_up_rotate_roll" "-0.8" + "sway_turn_down_rotate_roll" "0.8" + + // Zoomed Sway + "sway_rotate_attach_zoomed" "SWAY_ROTATE" + "sway_min_x_zoomed" "-0.5" + "sway_min_y_zoomed" "-0.5" + "sway_min_z_zoomed" "-0.6" + "sway_max_x_zoomed" "0.5" + "sway_max_y_zoomed" "0.5" + "sway_max_z_zoomed" "0.6" + "sway_min_pitch_zoomed" "-3" + "sway_min_yaw_zoomed" "-2.5" + "sway_min_roll_zoomed" "-4" + "sway_max_pitch_zoomed" "3" + "sway_max_yaw_zoomed" "2.5" + "sway_max_roll_zoomed" "4" + "sway_translate_gain_zoomed" "2.5" + "sway_rotate_gain_zoomed" "7" + "sway_move_forward_translate_x_zoomed" "-0.1" + "sway_move_forward_translate_z_zoomed" "-0.5" + "sway_move_back_translate_x_zoomed" "0.2" + "sway_move_back_translate_z_zoomed" "-0.2" + "sway_move_left_translate_y_zoomed" "-1" + "sway_move_left_translate_z_zoomed" "-0.5" + "sway_move_left_rotate_roll_zoomed" "-4" + "sway_move_right_translate_y_zoomed" "1" + "sway_move_right_translate_z_zoomed" "-0.5" + "sway_move_right_rotate_roll_zoomed" "4" + "sway_move_up_translate_z_zoomed" "-1" + "sway_move_down_translate_z_zoomed" "1" + "sway_turn_left_rotate_yaw_zoomed" "-2.5" + "sway_turn_right_rotate_yaw_zoomed" "2.5" + + "sway_turn_left_translate_y_zoomed" ".5" + "sway_turn_right_translate_y_zoomed" "-.5" + "sway_turn_up_translate_z_zoomed" ".2" + "sway_turn_down_translate_z_zoomed" "-.2" + "sway_turn_up_translate_x_zoomed" ".1" + "sway_turn_down_translate_x_zoomed" "-.1" + + "sway_turn_left_rotate_roll_zoomed" "4" + "sway_turn_right_rotate_roll_zoomed" "-4" + "sway_turn_up_rotate_pitch_zoomed" "3" + "sway_turn_down_rotate_pitch_zoomed" "-3" + "sway_turn_up_rotate_roll_zoomed" "-0.8" + "sway_turn_down_rotate_roll_zoomed" "0.8" + + // WeaponED Unhandled Key/Values and custom script Key/Values + "viewdrift_hipfire_stand_scale_pitch" "0.325" + "viewdrift_hipfire_crouch_scale_pitch" "0.275" + "viewdrift_hipfire_air_scale_pitch" "0.5" + "viewdrift_hipfire_stand_scale_yaw" "0.12" + "viewdrift_hipfire_crouch_scale_yaw" "0.10" + "viewdrift_hipfire_air_scale_yaw" "0.22" + "viewdrift_hipfire_speed_pitch" "0.6" + "viewdrift_hipfire_speed_yaw" "1.22" + "viewdrift_ads_speed_pitch" "0.63" + "viewdrift_ads_speed_yaw" "0.6" + "sprintcycle_time" ".55" + + // Bodygroups: + "bodygroup5_name" "proscreen" + "bodygroup5_set" "0" + + "clip_bodygroup" "softball_at_cylinder" + "clip_bodygroup_index_shown" "0" + "clip_bodygroup_index_hidden" "1" + "clip_bodygroup_show_for_milestone_0" "1" + "clip_bodygroup_show_for_milestone_1" "1" + "clip_bodygroup_show_for_milestone_2" "0" + "clip_bodygroup_show_for_milestone_3" "1" + "clip_bodygroup_show_for_milestone_4" "0" + + "grenade_arc_indicator_effect" "P_grenade_arc_proto" + "grenade_arc_impact_indicator_effect" "grenade_arc_impact_proto" + "grenade_arc_indicator_show_from_hip" "0" + + Mods + { + sns + { + explosion_damage "50" + damage_near_value "50" + damage_far_value "50" + ammo_clip_size "1" + projectile_launch_speed "7500" + } + + ar_trajectory + { + "grenade_arc_indicator_effect" "P_grenade_arc_proto" + "grenade_arc_impact_indicator_effect" "grenade_arc_impact_proto" + "grenade_arc_indicator_show_from_hip" "1" + } + + extended_ammo + { + "ammo_stockpile_max" "120" + "ammo_clip_size" "8" + "ammo_default_total" "120" + } + pro_screen + { + "ui8_enable" "1" + "bodygroup5_set" "1" + } + + pro_screenextended_ammo + { + } + pas_fast_ads + { + //Fast ADS + "zoom_time_in" "*0.5" + "zoom_time_out" "*0.6" + } + pas_fast_swap + { + //Fast Swap + "fast_swap_to" "1" + } + jump_kit + { + "impulse_force" "7000" + "impulse_force_explosions" "65000" + } + + pas_fast_reload + { + "reload_time" "*0.7" + "reload_time_late1" "*0.7" + "reloadempty_time" "*0.7" + "reloadempty_time_late1" "*0.7" + "reloadsegment_time_loop" "*0.7" + "reloadsegment_time_end" "*0.7" + "reloadsegmentempty_time_end" "*0.7" + } + + burn_mod_softball + { + + //FX + "projectile_trail_effect_0" "wpn_grenade_frag_softball_burn" + + "is_burn_mod" "1" + + "explosion_damage" "150" + "explosion_damage_heavy_armor" "530" + } + tactical_cdr_on_kill + { + + } + pas_run_and_gun + { + "primary_fire_does_not_block_sprint" "1" + "crosshair_force_sprint_fade_disabled" "1" + } + } + + "ui1_enable" "1" + UiData1 + { + "ui" "ui/softball_ammo_counter" + "mesh" "models/weapons/attachments/softball_rui_upper" + Args + { + vis player_zoomfrac + ammo weapon_ammo + clipSize weapon_clipSize + } + } + + "ui8_enable" "0" + UiData8 + { + "ui" "ui/pro_screen_panel" + "mesh" "models/weapons/attachments/pro_screen_rui_upper" + Args + { + proValue proscreen_int0 + proOwnedByPlayer proscreen_owner_is_player + } + } + + RUI_CrosshairData + { + DefaultArgs + { + adjustedSpread weapon_spread + adsFrac player_zoomFrac + isSprinting player_is_sprinting + isReloading weapon_is_reloading + teamColor crosshair_team_color + isAmped weapon_is_amped + crosshairMovementX crosshair_movement_x + crosshairMovementY crosshair_movement_y + } + + Crosshair_1 + { + "ui" "ui/crosshair_grenade_launcher2" + "base_spread" "1.0" + Args + { + isFiring weapon_is_firing + } + } + } +} \ No newline at end of file diff --git a/Northstar.Custom/mod/scripts/weapons/mp_weapon_ns_wingman.txt b/Northstar.Custom/mod/scripts/weapons/mp_weapon_ns_wingman.txt new file mode 100644 index 000000000..5f29a594c --- /dev/null +++ b/Northstar.Custom/mod/scripts/weapons/mp_weapon_ns_wingman.txt @@ -0,0 +1,582 @@ +WeaponData +{ + // General + "printname" "#WPN_WINGMAN" + "shortprintname" "#WPN_WINGMAN_SHORT" + "description" "#WPN_WINGMAN_DESC" + "longdesc" "#WPN_WINGMAN_LONGDESC" + + "fast_swap_to" "1" + + "menu_icon" "r2_ui/menus/loadout_icons/primary_weapon/primary_wingman_m" + "hud_icon" "r2_ui/menus/loadout_icons/primary_weapon/primary_wingman_m" + + "weaponClass" "human" + "weaponSubClass" "sidearm" + "body_type" "light" + "fire_mode" "semi-auto" + "pickup_hold_prompt" "Hold [USE] [WEAPONNAME]" + "pickup_press_prompt" "[USE] [WEAPONNAME]" + "minimap_reveal_distance" "32000" + "leveled_pickup" "1" + + "damage_flags" "DF_BULLET | DF_KNOCK_BACK | DF_DISMEMBERMENT" + + // Menu + "menu_category" "pistol" + "menu_anim_class" "small" + "stat_damage" "88" + "stat_range" "40" + "stat_accuracy" "36" + "stat_rof" "27" + + // Models + "viewmodel" "models/weapons/b3wing/ptpov_b3wing.mdl" + "playermodel" "models/weapons/b3wing/w_b3wing.mdl" + + // Effects + "tracer_effect_first_person" "P_wpn_tracer" + "tracer_effect" "P_wpn_tracer" + "vortex_absorb_effect" "wpn_vortex_projectile_rifle_FP" + "vortex_absorb_effect_third_person" "wpn_vortex_projectile_rifle" + "vortex_absorb_sound" "Vortex_Shield_AbsorbBulletSmall" + "vortex_absorb_sound_1P_VS_3P" "Vortex_Shield_AbsorbBulletSmall_1P_VS_3P" + "projectile_adjust_to_gun_barrel" "1" + + //"fx_shell_eject_view" "wpn_shelleject_pistol_FP" + //"fx_shell_eject_world" "wpn_shelleject_pistol" + //"fx_shell_eject_attach" "shell" + + "fx_muzzle_flash_view" "wpn_muzzleflash_pistol_FP" + "fx_muzzle_flash_world" "wpn_muzzleflash_pistol" + "fx_muzzle_flash_attach" "muzzle_flash" + + // Sounds + "sound_dryfire" "pistol_dryfire" + "sound_pickup" "wpn_pickup_Pistol_1P" + "fire_sound_1" "Weapon_bulletCasings.Bounce" + "fire_sound_2_player_1p" "Weapon_Wingman_Fire_1P" + "fire_sound_2_player_3p" "Weapon_Wingman_Fire_3P" + "fire_sound_2_npc" "Weapon_Wingman_Fire_NPC" + "sound_zoom_in" "Weapon_Wingman_ADS_In" + "sound_zoom_out" "Weapon_Wingman_ADS_Out" + + "low_ammo_sound_name_1" "Wingman_LowAmmo_Shot1" + "low_ammo_sound_name_2" "Wingman_LowAmmo_Shot2" + "low_ammo_sound_name_3" "Wingman_LowAmmo_Shot3" + + // Network + "net_optimize" "1" + + "damage_type" "bullet" + + "critical_hit_damage_scale" "1" + + "ammo_clip_size" "6" + "titanarmor_critical_hit_required" "1" + + dof_zoom_focusArea_horizontal 0.06 + dof_zoom_focusArea_top 0.070 + dof_zoom_focusArea_bottom -0.011 + + MP_BASE + { + "ammo_default_total" "160" + "ammo_stockpile_max" "160" + "ammo_no_remove_from_stockpile" "1" + "ammo_min_to_fire" "1" + + "aimassist_adspull_weaponclass" "precise" + + "critical_hit" "1" + + // Damage - When Used by Players + "damage_near_value" "40" + "damage_far_value" "40" + "damage_near_distance" "1000" + "damage_far_distance" "1500" + "damage_near_value_titanarmor" "250" + "damage_far_value_titanarmor" "200" + "damage_rodeo" "350" + + "damage_very_far_value" "30" + "damage_very_far_distance" "2500" + + "damage_headshot_scale" "2.0" + + "red_crosshair_range" "1000" + + // Damage - When Used by NPCs + "npc_damage_near_value" "10" + "npc_damage_far_value" "8" + "npc_damage_near_distance" "1000" + "npc_damage_far_distance" "1200" + + // NPC + "npc_min_engage_range" "0" + "npc_max_engage_range" "1000" + "npc_min_engage_range_heavy_armor" "200" + "npc_max_engage_range_heavy_armor" "2000" + "npc_min_range" "0" + "npc_max_range" "8000" + + "npc_min_burst" "1" + "npc_max_burst" "3" + "npc_rest_time_between_bursts_min" "0.3" + "npc_rest_time_between_bursts_max" "0.6" + + "enable_highlight_networking_on_creation" "" + + "damage_heavyarmor_nontitan_scale" "0.35" + + + } + + SP_BASE + { + "ammo_default_total" "18" + "ammo_stockpile_max" "18" + "ammo_no_remove_from_stockpile" "0" + "ammo_min_to_fire" "1" + + "aimassist_adspull_weaponclass" "precise_sp" + + "critical_hit" "0" + + // Damage - When Used by Players + "damage_near_value" "90" + "damage_far_value" "45" + "damage_near_distance" "750" // match to search distance and red crosshair range + "damage_far_distance" "850" + "damage_near_value_titanarmor" "125" + "damage_far_value_titanarmor" "125" + "damage_rodeo" "350" + + "damage_headshot_scale" "2" + + "red_crosshair_range" "750" + + // Damage - When Used by NPCs + "npc_damage_near_value" "10" + "npc_damage_far_value" "8" + "npc_damage_near_distance" "1000" + "npc_damage_far_distance" "1200" + + // NPC + + "npc_min_engage_range" "0" + "npc_max_engage_range" "1000" + "npc_min_engage_range_heavy_armor" "200" + "npc_max_engage_range_heavy_armor" "2000" + "npc_min_range" "0" + "npc_max_range" "8000" + + "npc_min_burst" "1" + "npc_max_burst" "1" + "npc_rest_time_between_bursts_min" "0.25" + "npc_rest_time_between_bursts_max" "0.6" + + "enable_highlight_networking_on_creation" "1" + + "damage_heavyarmor_nontitan_scale" "1" + + "damage_very_far_value" "" + "damage_very_far_distance" "" + } + + "proficiency_poor_spreadscale" "5.0" + "proficiency_average_spreadscale" "5.0" + "proficiency_good_spreadscale" "1.66667" + "proficiency_very_good_spreadscale" "1.66667" + + "viewmodel_offset_ads" "0 0 0" + "dof_zoom_nearDepthStart" "4.750" + "dof_zoom_nearDepthEnd" "11.000" + "dof_nearDepthStart" "3.683" + "dof_nearDepthEnd" "6.652" + + // Behavior + "fire_rate" "2.6" + "zoom_time_in" "0.2" + "zoom_time_out" "0.15" + "zoom_fov" "55" + "reload_time" "2.1" + "reload_time_late1" "1.75" + "reload_time_late2" "0.60" + "reloadempty_time" "2.1" + "reloadempty_time_late1" "1.75" + "reloadempty_time_late2" "0.65" + "holster_time" "0.5" + "deploy_time" "0.4" + "lower_time" "0.2" + "raise_time" "0.2" + "vortex_refire_behavior" "bullet" + "allow_empty_fire" "0" + "reload_enabled" "1" + "allow_empty_click" "1" + "empty_reload_only" "0" + "trigger_snipercam" "0" + "allow_headshots" "1" + "headshot_distance" "1400" + "primary_fire_does_not_block_sprint" "0" + "ads_move_speed_scale" "0.75" + "aimassist_disable_hipfire" "0" + "aimassist_disable_ads" "0" + "aimassist_disable_hipfire_titansonly" "0" + "aimassist_disable_ads_titansonly" "0" + + "sprint_fractional_anims" "0" + + "impulse_force" "3000" + "ammo_suck_behavior" "primary_weapons" + + // View Kick + "viewkick_spring" "magnum" + + "viewkick_pitch_base" "-2.5" + "viewkick_pitch_random" "1" + "viewkick_pitch_softScale" "0.4" + "viewkick_pitch_hardScale" "2.0" + + "viewkick_yaw_base" "-0.5" + "viewkick_yaw_random" "-1.0" + "viewkick_yaw_softScale" "0.5" + "viewkick_yaw_hardScale" "1.5" + + "viewkick_roll_base" "0" + "viewkick_roll_randomMin" "0.2" + "viewkick_roll_randomMax" "0.4" + "viewkick_roll_softScale" "0.2" + "viewkick_roll_hardScale" "2.25" + + "viewkick_hipfire_weaponFraction" "0.25" + "viewkick_hipfire_weaponFraction_vmScale" "0.0" + "viewkick_ads_weaponFraction" "0.35" + "viewkick_ads_weaponFraction_vmScale" "0.0" + + "viewkick_perm_pitch_base" "0.0" + "viewkick_perm_pitch_random" "1.0" + "viewkick_perm_yaw_base" "0.1" + "viewkick_perm_yaw_random" "1.0" + + // + "viewmodel_shake_forward" "0.5" + "viewmodel_shake_up" "0.2" + "viewmodel_shake_right" "0.0" + + // Bob + "bob_cycle_time" "0.4" + "bob_vert_dist" "0.19" + "bob_horz_dist" "0.1" + "bob_max_speed" "150" + "bob_pitch" "0.75" + "bob_yaw" "-1.7" + "bob_roll" "1.2" + + // Bob_Zoomed + "bob_cycle_time_zoomed" "0.4" + "bob_vert_dist_zoomed" "0.01" + "bob_horz_dist_zoomed" "0.01" + "bob_max_speed_zoomed" "150" + //"bob_pitch_zoomed" "0.002" + //"bob_yaw_zoomed" "-.002" + //"bob_roll_zoomed" ".002" + + // Rumble + "fire_rumble" "rumble_pistol_heavy" + + // Sway + "sway_rotate_attach" "SWAY_ROTATE" + "sway_min_x" "-0.5" + "sway_min_y" "-0.5" + "sway_min_z" "-0.6" + "sway_max_x" "0.5" + "sway_max_y" "0.5" + "sway_max_z" "0.6" + "sway_min_pitch" "-3" + "sway_min_yaw" "-2.5" + "sway_min_roll" "-4" + "sway_max_pitch" "3" + "sway_max_yaw" "2.5" + "sway_max_roll" "4" + "sway_translate_gain" "2.5" + "sway_rotate_gain" "7" + "sway_move_forward_translate_x" "-0.1" + "sway_move_forward_translate_z" "-0.5" + "sway_move_back_translate_x" "0.2" + "sway_move_back_translate_z" "-0.2" + "sway_move_left_translate_y" "-1" + "sway_move_left_translate_z" "-0.5" + "sway_move_left_rotate_roll" "-4" + "sway_move_right_translate_y" "1" + "sway_move_right_translate_z" "-0.5" + "sway_move_right_rotate_roll" "4" + "sway_move_up_translate_z" "-1" + "sway_move_down_translate_z" "1" + "sway_turn_left_rotate_yaw" "-2.5" + "sway_turn_right_rotate_yaw" "2.5" + + "sway_turn_left_translate_y" ".5" + "sway_turn_right_translate_y" "-.5" + "sway_turn_up_translate_z" ".2" + "sway_turn_down_translate_z" "-.2" + "sway_turn_up_translate_x" ".1" + "sway_turn_down_translate_x" "-.1" + + "sway_turn_left_rotate_roll" "4" + "sway_turn_right_rotate_roll" "-4" + "sway_turn_up_rotate_pitch" "3" + "sway_turn_down_rotate_pitch" "-3" + "sway_turn_up_rotate_roll" "-0.8" + "sway_turn_down_rotate_roll" "0.8" + + // Zoomed Sway + "sway_rotate_attach_zoomed" "SWAY_ROTATE_ZOOMED" + "sway_rotate_attach_blend_time_zoomed" "0.2" + "sway_rotate_gain_zoomed" "5" + + "sway_min_yaw_zoomed" "-0.04" + "sway_max_yaw_zoomed" "0.04" + "sway_turn_left_rotate_yaw_zoomed" "-0.085" + "sway_turn_right_rotate_yaw_zoomed" "0.085" + + "sway_min_roll_zoomed" "-1" + "sway_max_roll_zoomed" "1" + "sway_turn_left_rotate_roll_zoomed" "-1" + "sway_turn_right_rotate_roll_zoomed" "1" + + "sway_move_right_rotate_roll_zoomed" "0.2" + "sway_move_left_rotate_roll_zoomed" "-0.2" + + "sway_min_pitch_zoomed" "-0.03" + "sway_max_pitch_zoomed" "0.04" + "sway_turn_up_rotate_pitch_zoomed" "0.07" + "sway_turn_down_rotate_pitch_zoomed" "-0.07" + + // Spread + "spread_stand_hip" "1.0" + "spread_stand_hip_run" "3.0" + "spread_stand_hip_sprint" "4.0" + "spread_crouch_hip" "0.5" + "spread_air_hip" "6.0" + "spread_stand_ads" "0.0" //"0.15" + "spread_crouch_ads" "0.0" //"0.1" + "spread_air_ads" "0.0" //"0.25" + + "spread_kick_on_fire_stand_hip" "2.5" + "spread_kick_on_fire_crouch_hip" "2.0" + "spread_kick_on_fire_air_hip" "3.0" + "spread_kick_on_fire_stand_ads" ".025" + "spread_kick_on_fire_crouch_ads" ".015" + "spread_kick_on_fire_air_ads" ".05" + + "spread_max_kick_stand_hip" "4.5" + "spread_max_kick_crouch_hip" "3.0" + "spread_max_kick_air_hip" "4.5" + "spread_max_kick_stand_ads" "0.0" + "spread_max_kick_crouch_ads" "0.0" + "spread_max_kick_air_ads" "0.0" + + "spread_decay_rate" "11.0" + "spread_decay_delay" ".21" + + // WeaponED Unhandled Key/Values and custom script Key/Values + "sprintcycle_time" "0.55" + "deployfirst_time" "1.25" + "activitymodifier" "pistol" + "holster_type" "pistol" + + // Bodygroups: + "bodygroup1_name" "suppressor_cyl_sm" + "bodygroup1_set" "0" + "bodygroup2_name" "suppressor_sq_sm" + "bodygroup2_set" "0" + "bodygroup3_name" "sight_cqh" + "bodygroup3_set" "0" + "bodygroup4_name" "sight_acgs" + "bodygroup4_set" "0" + "bodygroup5_name" "sight_cro" + "bodygroup5_set" "0" + "bodygroup6_name" "proscreen" + "bodygroup6_set" "0" + + + "clip_bodygroup" "b3wing_magazine" + "clip_bodygroup_index_shown" "0" + "clip_bodygroup_index_hidden" "1" + "clip_bodygroup_show_for_milestone_0" "1" + "clip_bodygroup_show_for_milestone_1" "0" + "clip_bodygroup_show_for_milestone_2" "1" + "clip_bodygroup_show_for_milestone_3" "1" + + Mods + { + one_in_the_chamber + { + damage_near_value "9999" + damage_far_value "9999" + } + iron_sights + { + } + extended_ammo + { + "ammo_stockpile_max" "120" + "ammo_clip_size" "8" + "ammo_default_total" "120" + } + silencer //HACK JFS: Doesn't get applied on amped weapons. See bug 170460 + { + "silenced" "1" + "fire_sound_2_player_1p" "Weapon_Wingman_FireSuppressed_1P" + "fire_sound_2_player_3p" "Weapon_Wingman_FireSuppressed_3P" + "fire_sound_2_npc" "Weapon_Wingman_FireSuppressed_NPC" + "damage_near_value" "--10" + "damage_far_value" "--10" + "damage_very_far_value" "--5" + "bodygroup2_set" "1" + + //"rumble" "4" + "tracer_effect" "P_wpn_tracer_pistol" + "minimap_reveal_distance" "1" + + "fx_muzzle_flash_view" "wpn_muzzleflash_pistol_sup_FP" + "fx_muzzle_flash_world" "wpn_muzzleflash_pistol_sup" + "fx_muzzle_flash_attach" "muzzle_flash_suppressor_sq" + } + hcog + { + "bodygroup3_set" "1" + "bodygroup4_set" "0" + "bodygroup5_set" "0" + "viewmodel_offset_ads" "0 -6.7 -0.75" + "zoom_fov" "35" + "anim_alt_idleAttack" "1" + + "dof_zoom_nearDepthStart" "6.161" + "dof_zoom_nearDepthEnd" "9.204" + } + redline_sight + { + "bodygroup3_set" "0" + "bodygroup4_set" "1" + "bodygroup5_set" "0" + "viewmodel_offset_ads" "0 -9 -0.78" + "dof_zoom_nearDepthStart" "4.491" + "dof_zoom_nearDepthEnd" "5.545" + } + threat_scope + { + "bodygroup3_set" "0" + "bodygroup4_set" "0" + "bodygroup5_set" "1" + "threat_scope_enabled" "1" + "threat_scope_bounds_tagname1" "SCR_TR_CRO" + "threat_scope_bounds_tagname2" "SCR_BL_CRO" + "viewmodel_offset_ads" "0 -9 -0.78" + "dof_zoom_nearDepthStart" "4.491" + "dof_zoom_nearDepthEnd" "5.545" + } + pro_screen + { + "ui8_enable" "1" + "bodygroup6_set" "1" + } + tactical_cdr_on_kill + { + + } + pas_fast_reload + { + "reload_time" "*0.7" + "reload_time_late1" "*0.7" + "reloadempty_time" "*0.7" + "reloadempty_time_late1" "*0.7" + } + pas_run_and_gun + { + "primary_fire_does_not_block_sprint" "1" + "crosshair_force_sprint_fade_disabled" "1" + } + pas_fast_ads + { + //Fast ADS + "zoom_time_in" "*0.5" + "zoom_time_out" "*0.6" + } + pas_fast_swap + { + //Fast Swap + "fast_swap_to" "1" + } + burn_mod_wingman + { + //FX + "tracer_effect" "P_wpn_tracer_BC" + "tracer_effect_first_person" "P_wpn_tracer_BC" + "fx_muzzle_flash_view" "wpn_muzzleflash_pistol_elec_FP" + "fx_muzzle_flash_world" "wpn_muzzleflash_pistol_elec" + + "is_burn_mod" "1" + + "damage_near_value" "++10" + "damage_far_value" "++15" + "damage_very_far_value" "++10" + "damage_near_value_titanarmor" "++100" + "damage_far_value_titanarmor" "++100" + } + } + + "ui1_enable" "1" + UiData1 + { + "ui" "ui/b3wing_ammo_counter" + "mesh" "models/weapons/attachments/b3wing_rui_lower" + Args + { + vis player_zoomfrac + ammo weapon_ammo + clipSize weapon_clipSize + } + } + + "ui8_enable" "0" + UiData8 + { + "ui" "ui/pro_screen_panel" + "mesh" "models/weapons/attachments/pro_screen_rui_upper" + Args + { + proValue proscreen_int0 + proOwnedByPlayer proscreen_owner_is_player + } + } + + active_crosshair_count "1" + rui_crosshair_index "0" + + RUI_CrosshairData + { + DefaultArgs + { + adjustedSpread weapon_spread + adsFrac player_zoomFrac + isSprinting player_is_sprinting + isReloading weapon_is_reloading + teamColor crosshair_team_color + isAmped weapon_is_amped + crosshairMovementX crosshair_movement_x + crosshairMovementY crosshair_movement_y + } + + Crosshair_1 + { + "ui" "ui/crosshair_wingman" + "base_spread" "-0.25" + Args + { + isFiring weapon_is_firing + } + } + } +} \ No newline at end of file diff --git a/Northstar.Custom/mod/scripts/weapons/mp_weapon_ns_wingman_n.txt b/Northstar.Custom/mod/scripts/weapons/mp_weapon_ns_wingman_n.txt new file mode 100644 index 000000000..deb93fd4d --- /dev/null +++ b/Northstar.Custom/mod/scripts/weapons/mp_weapon_ns_wingman_n.txt @@ -0,0 +1,593 @@ +WeaponData +{ + // General + "printname" "#WPN_WINGMAN_N" + "shortprintname" "#WPN_WINGMAN_N_SHORT" + "description" "#WPN_WINGMAN_N_DESC" + "longdesc" "#WPN_WINGMAN_N_LONGDESC" + + "fast_swap_to" "1" + + "menu_icon" "r2_ui/menus/loadout_icons/primary_weapon/primary_wingman_elite" + "hud_icon" "r2_ui/menus/loadout_icons/primary_weapon/primary_wingman_elite" + + "weaponClass" "human" + "weaponSubClass" "sidearm" + "body_type" "light" + "fire_mode" "semi-auto" + "pickup_hold_prompt" "Hold [USE] [WEAPONNAME]" + "pickup_press_prompt" "[USE] [WEAPONNAME]" + "minimap_reveal_distance" "32000" + "leveled_pickup" "1" + + "OnWeaponPrimaryAttack" "OnWeaponPrimaryAttack_weapon_sniper" + + "damage_flags" "DF_BULLET | DF_KNOCK_BACK | DF_DISMEMBERMENT" + + // Menu + "menu_category" "handgun" + "menu_anim_class" "small" + "stat_damage" "91" + "stat_range" "60" + "stat_accuracy" "25" + "stat_rof" "27" + + // Models + "viewmodel" "models/weapons/wingman_elite/ptpov_wingman_elite.mdl" + "playermodel" "models/weapons/wingman_elite/w_wingman_elite.mdl" + "projectilemodel" "models/weapons/bullets/projectile_20mm.mdl" + + // Effects +// "tracer_effect_first_person" "P_wpn_tracer" +// "tracer_effect" "P_wpn_tracer" + "impact_effect_table" "wingman_elite" + "vortex_absorb_effect" "wpn_vortex_projectile_rifle_FP" + "vortex_absorb_effect_third_person" "wpn_vortex_projectile_rifle" + "vortex_absorb_sound" "Vortex_Shield_AbsorbBulletSmall" + "vortex_absorb_sound_1P_VS_3P" "Vortex_Shield_AbsorbBulletSmall_1P_VS_3P" + "projectile_adjust_to_gun_barrel" "1" + + "projectile_trail_effect_0" "weapon_kraber_projectile" + "projectile_do_predict_impact_effects" "1"//0" + + + //"fx_shell_eject_view" "wpn_shelleject_pistol_FP" + //"fx_shell_eject_world" "wpn_shelleject_pistol" + //"fx_shell_eject_attach" "shell" + + "fx_muzzle_flash_view" "wpn_muzzleflash_pistol_FP" + "fx_muzzle_flash_world" "wpn_muzzleflash_pistol" + "fx_muzzle_flash_attach" "muzzle_flash" + + // Sounds + "sound_dryfire" "pistol_dryfire" + "sound_pickup" "wpn_pickup_Pistol_1P" + "fire_sound_1" "Weapon_bulletCasings.Bounce" + "fire_sound_2_player_1p" "Weapon_Wingman_Elite_Fire_1P" + "fire_sound_2_player_3p" "Weapon_Wingman_Elite_Fire_3P" + "fire_sound_2_npc" "Weapon_Wingman_Fire_NPC" + "sound_zoom_in" "Weapon_Wingman_ADS_In" + "sound_zoom_out" "Weapon_Wingman_ADS_Out" + + "low_ammo_sound_name_1" "Wingman_LowAmmo_Shot1" + "low_ammo_sound_name_2" "Wingman_LowAmmo_Shot2" + "low_ammo_sound_name_3" "Wingman_LowAmmo_Shot3" + + // Network + "net_optimize" "0" + + "damage_type" "bullet" + + "critical_hit_damage_scale" "1" + + "ammo_clip_size" "6" + "titanarmor_critical_hit_required" "1" + + dof_zoom_focusArea_horizontal 0.06 + dof_zoom_focusArea_top 0.070 + dof_zoom_focusArea_bottom -0.011 + + + "ammo_default_total" "160" + "ammo_stockpile_max" "160" + "ammo_no_remove_from_stockpile" "1" + "ammo_min_to_fire" "1" + + "aimassist_adspull_weaponclass" "precise" + + "critical_hit" "1" + + // Bolt info + "bolt_hitsize" "0.0" + "bolt_hitsize_grow1_time" "0.035" + "bolt_hitsize_grow1_size" "0.5" + "bolt_hitsize_grow2_time" "0.08" + "bolt_hitsize_grow2_size" "1.0" + "bolt_hitsize_growfinal_lerptime" "0.18" + "bolt_hitsize_growfinal_size" "2.0" + + "bolt_gravity_enabled" "1" + "bolt_gravity_amount" "0.2500"//0.500" + + "bolt_bounce_frac" "0.000" + "projectile_damage_reduction_per_bounce" "0.0" + "projectile_damages_owner" "0" + "projectile_ricochet_max_count" "0" + + "pass_through_depth" "32" + "pass_through_damage_preserved_scale" "1" + + "bolt_speed" "12000" + + // Damage - When Used by Players + "damage_near_value" "75" + "damage_far_value" "55" + "damage_near_distance" "1500" + "damage_far_distance" "2000" + "damage_near_value_titanarmor" "300" + "damage_far_value_titanarmor" "250" + "damage_rodeo" "350" + + "damage_very_far_value" "35" + "damage_very_far_distance" "3500" + + "damage_headshot_scale" "2" + + "red_crosshair_range" "1500" + + // Damage - When Used by NPCs + "npc_damage_near_value" "10" + "npc_damage_far_value" "8" + "npc_damage_near_distance" "1000" + "npc_damage_far_distance" "1200" + + // NPC + "npc_min_engage_range" "0" + "npc_max_engage_range" "1000" + "npc_min_engage_range_heavy_armor" "200" + "npc_max_engage_range_heavy_armor" "2000" + "npc_min_range" "0" + "npc_max_range" "8000" + + "npc_min_burst" "1" + "npc_max_burst" "3" + "npc_rest_time_between_bursts_min" "0.3" + "npc_rest_time_between_bursts_max" "0.6" + + "damage_heavyarmor_nontitan_scale" "0.35" + + "proficiency_poor_spreadscale" "5.0" + "proficiency_average_spreadscale" "5.0" + "proficiency_good_spreadscale" "1.66667" + "proficiency_very_good_spreadscale" "1.66667" + + "viewmodel_offset_ads" "0 0 0" + "dof_zoom_nearDepthStart" "4.750" + "dof_zoom_nearDepthEnd" "11.000" + "dof_nearDepthStart" "3.683" + "dof_nearDepthEnd" "6.652" + + // Behavior + "fire_rate" "2.6" + + "zoom_time_in" "0.2" + "zoom_time_out" "0.15" + "zoom_fov" "35" + "reload_time" "2.1" + "reload_time_late1" "1.75" + "reload_time_late2" "0.60" + "reloadempty_time" "2.1" + "reloadempty_time_late1" "1.75" + "reloadempty_time_late2" "0.65" + "holster_time" "0.5" + "deploy_time" "0.4" + "lower_time" "0.2" + "raise_time" "0.2" + "vortex_refire_behavior" "bullet" + "allow_empty_fire" "0" + "reload_enabled" "1" + "allow_empty_click" "1" + "empty_reload_only" "0" + "trigger_snipercam" "0" + "allow_headshots" "1" +// "headshot_distance" "1400" + "primary_fire_does_not_block_sprint" "0" + "ads_move_speed_scale" "0.75" + "aimassist_disable_hipfire" "0" + "aimassist_disable_ads" "0" + "aimassist_disable_hipfire_titansonly" "0" + "aimassist_disable_ads_titansonly" "0" + + "sprint_fractional_anims" "0" + + "impulse_force" "10" + "ammo_suck_behavior" "primary_weapons" + + // View Kick + "viewkick_spring" "magnum" + + "viewkick_pitch_base" "-0.5" + "viewkick_pitch_random" ".2" + "viewkick_pitch_softScale" "0.4" + "viewkick_pitch_hardScale" "2.0" + + "viewkick_yaw_base" "0.05" + "viewkick_yaw_random" "0.0" + "viewkick_yaw_softScale" "0.5" + "viewkick_yaw_hardScale" "1.5" + + "viewkick_roll_base" "0" + "viewkick_roll_randomMin" "0.2" + "viewkick_roll_randomMax" "0.4" + "viewkick_roll_softScale" "0.2" + "viewkick_roll_hardScale" "2.25" + + "viewkick_hipfire_weaponFraction" "0.25" + "viewkick_hipfire_weaponFraction_vmScale" "0.0" + "viewkick_ads_weaponFraction" "0.35" + "viewkick_ads_weaponFraction_vmScale" "0.0" + + "viewkick_perm_pitch_base" "0.0" + "viewkick_perm_pitch_random" "0.0" + "viewkick_perm_yaw_base" "0.0" + "viewkick_perm_yaw_random" "0.0" + + // + "viewmodel_shake_forward" "0.5" + "viewmodel_shake_up" "0.2" + "viewmodel_shake_right" "0.0" + + // Bob + "bob_cycle_time" "0.4" + "bob_vert_dist" "0.19" + "bob_horz_dist" "0.1" + "bob_max_speed" "150" + "bob_pitch" "0.75" + "bob_yaw" "-1.7" + "bob_roll" "1.2" + + // Bob_Zoomed + "bob_cycle_time_zoomed" "0.4" + "bob_vert_dist_zoomed" "0.01" + "bob_horz_dist_zoomed" "0.01" + "bob_max_speed_zoomed" "150" + //"bob_pitch_zoomed" "0.002" + //"bob_yaw_zoomed" "-.002" + //"bob_roll_zoomed" ".002" + + // Rumble + "fire_rumble" "rumble_pistol_heavy" + + // Sway + "sway_rotate_attach" "SWAY_ROTATE" + "sway_min_x" "-0.5" + "sway_min_y" "-0.5" + "sway_min_z" "-0.6" + "sway_max_x" "0.5" + "sway_max_y" "0.5" + "sway_max_z" "0.6" + "sway_min_pitch" "-3" + "sway_min_yaw" "-2.5" + "sway_min_roll" "-4" + "sway_max_pitch" "3" + "sway_max_yaw" "2.5" + "sway_max_roll" "4" + "sway_translate_gain" "2.5" + "sway_rotate_gain" "7" + "sway_move_forward_translate_x" "-0.1" + "sway_move_forward_translate_z" "-0.5" + "sway_move_back_translate_x" "0.2" + "sway_move_back_translate_z" "-0.2" + "sway_move_left_translate_y" "-1" + "sway_move_left_translate_z" "-0.5" + "sway_move_left_rotate_roll" "-4" + "sway_move_right_translate_y" "1" + "sway_move_right_translate_z" "-0.5" + "sway_move_right_rotate_roll" "4" + "sway_move_up_translate_z" "-1" + "sway_move_down_translate_z" "1" + "sway_turn_left_rotate_yaw" "-2.5" + "sway_turn_right_rotate_yaw" "2.5" + + "sway_turn_left_translate_y" ".5" + "sway_turn_right_translate_y" "-.5" + "sway_turn_up_translate_z" ".2" + "sway_turn_down_translate_z" "-.2" + "sway_turn_up_translate_x" ".1" + "sway_turn_down_translate_x" "-.1" + + "sway_turn_left_rotate_roll" "4" + "sway_turn_right_rotate_roll" "-4" + "sway_turn_up_rotate_pitch" "3" + "sway_turn_down_rotate_pitch" "-3" + "sway_turn_up_rotate_roll" "-0.8" + "sway_turn_down_rotate_roll" "0.8" + + // Zoomed Sway + "sway_rotate_attach_zoomed" "SWAY_ROTATE_ZOOMED" + "sway_rotate_attach_blend_time_zoomed" "0.2" + "sway_rotate_gain_zoomed" "5" + + "sway_min_yaw_zoomed" "-0.04" + "sway_max_yaw_zoomed" "0.04" + "sway_turn_left_rotate_yaw_zoomed" "-0.085" + "sway_turn_right_rotate_yaw_zoomed" "0.085" + + "sway_min_roll_zoomed" "-1" + "sway_max_roll_zoomed" "1" + "sway_turn_left_rotate_roll_zoomed" "-1" + "sway_turn_right_rotate_roll_zoomed" "1" + + "sway_move_right_rotate_roll_zoomed" "0.2" + "sway_move_left_rotate_roll_zoomed" "-0.2" + + "sway_min_pitch_zoomed" "-0.03" + "sway_max_pitch_zoomed" "0.04" + "sway_turn_up_rotate_pitch_zoomed" "0.07" + "sway_turn_down_rotate_pitch_zoomed" "-0.07" + + // Spread + "spread_stand_hip" "0" + "spread_stand_hip_run" "0" + "spread_stand_hip_sprint" "0" + "spread_crouch_hip" "0" + "spread_air_hip" "0" + "spread_stand_ads" "0" //"0.15" + "spread_crouch_ads" "0" //"0.1" + "spread_air_ads" "0" //"0.25" + + "spread_kick_on_fire_stand_hip" "0" + "spread_kick_on_fire_crouch_hip" "0" + "spread_kick_on_fire_air_hip" "0" + "spread_kick_on_fire_stand_ads" "0" + "spread_kick_on_fire_crouch_ads" "0" + "spread_kick_on_fire_air_ads" "0" + + "spread_max_kick_stand_hip" "0" + "spread_max_kick_crouch_hip" "0" + "spread_max_kick_air_hip" "0" + "spread_max_kick_stand_ads" "0" + "spread_max_kick_crouch_ads" "0" + "spread_max_kick_air_ads" "0" + + "spread_decay_rate" "11.0" + "spread_decay_delay" ".21" + + // WeaponED Unhandled Key/Values and custom script Key/Values + "sprintcycle_time" "0.55" + "deployfirst_time" "1.25" + "activitymodifier" "pistol" + "holster_type" "pistol" + + // Bodygroups: + "bodygroup1_name" "suppressor_cyl_sm" + "bodygroup1_set" "0" + "bodygroup2_name" "suppressor_sq_sm" + "bodygroup2_set" "0" + "bodygroup3_name" "sight_cqh" + "bodygroup3_set" "0" + "bodygroup4_name" "sight_acgs" + "bodygroup4_set" "0" + "bodygroup5_name" "sight_cro" + "bodygroup5_set" "0" + "bodygroup6_name" "proscreen" + "bodygroup6_set" "0" + + + "clip_bodygroup" "b3wing_magazine" + "clip_bodygroup_index_shown" "0" + "clip_bodygroup_index_hidden" "1" + "clip_bodygroup_show_for_milestone_0" "1" + "clip_bodygroup_show_for_milestone_1" "0" + "clip_bodygroup_show_for_milestone_2" "1" + "clip_bodygroup_show_for_milestone_3" "1" + + Mods + { + one_in_the_chamber + { + damage_near_value "9999" + damage_far_value "9999" + damage_very_far_value "9999" + } + sns + { + damage_near_value "9999" + damage_far_value "9999" + damage_very_far_value "9999" + ammo_clip_size "1" + reload_time "*0.5" + reload_time_late1 "*0.5" + reloadempty_time "*0.5" + reloadempty_time_late1 "*0.5" + bolt_bounce_frac "0.7" + projectile_damage_reduction_per_bounce "0.0" + projectile_damages_owner "0" + projectile_ricochet_max_count "3" + ads_move_speed_scale "1" + } + iron_sights + { + } + extended_ammo + { + "ammo_stockpile_max" "160" + "ammo_clip_size" "8" + "ammo_default_total" "160" + } + silencer //HACK JFS: Doesn't get applied on amped weapons. See bug 170460 + { + "silenced" "1" + "fire_sound_2_player_1p" "Weapon_Wingman_FireSuppressed_1P" + "fire_sound_2_player_3p" "Weapon_Wingman_FireSuppressed_3P" + "fire_sound_2_npc" "Weapon_Wingman_FireSuppressed_NPC" + "damage_near_value" "--10" + "damage_far_value" "--10" + "damage_very_far_value" "--10" + "bodygroup2_set" "1" + + //"rumble" "4" + "tracer_effect" "P_wpn_tracer_pistol" + "minimap_reveal_distance" "1" + + "fx_muzzle_flash_view" "wpn_muzzleflash_pistol_sup_FP" + "fx_muzzle_flash_world" "wpn_muzzleflash_pistol_sup" + "fx_muzzle_flash_attach" "muzzle_flash_suppressor_sq" + } + hcog + { + "bodygroup3_set" "1" + "bodygroup4_set" "0" + "bodygroup5_set" "0" + "viewmodel_offset_ads" "0 -6.7 -0.75" + "zoom_fov" "35" + "anim_alt_idleAttack" "1" + + "dof_zoom_nearDepthStart" "6.161" + "dof_zoom_nearDepthEnd" "9.204" + } + redline_sight + { + "bodygroup3_set" "0" + "bodygroup4_set" "1" + "bodygroup5_set" "0" + "viewmodel_offset_ads" "0 -9 -0.78" + "dof_zoom_nearDepthStart" "4.491" + "dof_zoom_nearDepthEnd" "5.545" + } + threat_scope + { + "bodygroup3_set" "0" + "bodygroup4_set" "0" + "bodygroup5_set" "1" + "threat_scope_enabled" "1" + "threat_scope_bounds_tagname1" "SCR_TR_CRO" + "threat_scope_bounds_tagname2" "SCR_BL_CRO" + "viewmodel_offset_ads" "0 -9 -0.78" + "dof_zoom_nearDepthStart" "4.491" + "dof_zoom_nearDepthEnd" "5.545" + } + pro_screen + { + "ui8_enable" "1" + "bodygroup6_set" "1" + } + tactical_cdr_on_kill + { + + } + pas_fast_reload + { + "reload_time" "*0.7" + "reload_time_late1" "*0.7" + "reloadempty_time" "*0.7" + "reloadempty_time_late1" "*0.7" + } + pas_run_and_gun + { + "primary_fire_does_not_block_sprint" "1" + "crosshair_force_sprint_fade_disabled" "1" + } + pas_fast_ads + { + //Fast ADS + "zoom_time_in" "*0.5" + "zoom_time_out" "*0.6" + } + pas_fast_swap + { + //Fast Swap + "fast_swap_to" "1" + } + ricochet + { + "bolt_bounce_frac" "0.7" + "projectile_damage_reduction_per_bounce" "0.0" + "projectile_damages_owner" "0" + "projectile_ricochet_max_count" "2" + } + burn_mod_wingman_n + { + //FX + "tracer_effect" "P_wpn_tracer_BC" + "tracer_effect_first_person" "P_wpn_tracer_BC" + "fx_muzzle_flash_view" "wpn_muzzleflash_pistol_elec_FP" + "fx_muzzle_flash_world" "wpn_muzzleflash_pistol_elec" + "projectile_trail_effect_0" "weapon_kraber_projectile_burn" + "impact_effect_table" "titan_bullet_elec" + + "is_burn_mod" "1" + + "damage_near_value" "++20" + "damage_far_value" "++20" + "damage_very_far_value" "++20" + "damage_near_value_titanarmor" "450" + "damage_far_value_titanarmor" "400" + } + } + + "ui1_enable" "1" + UiData1 + { + "ui" "ui/b3wing_ammo_counter" + "mesh" "models/weapons/attachments/b3wing_rui_lower" + Args + { + vis player_zoomfrac + ammo weapon_ammo + clipSize weapon_clipSize + } + } + + "ui6_enable" "1" + "ui6_draw_cloaked" "1" + UiData6 + { + "ui" "ui/r97_reticle" + "mesh" "models/weapons/attachments/r97_rui_upper" + Args + { + vis player_zoomfrac + } + } + + "ui8_enable" "0" + UiData8 + { + "ui" "ui/pro_screen_panel" + "mesh" "models/weapons/attachments/pro_screen_rui_upper" + Args + { + proValue proscreen_int0 + proOwnedByPlayer proscreen_owner_is_player + } + } + + active_crosshair_count "1" + rui_crosshair_index "0" + + RUI_CrosshairData + { + DefaultArgs + { + adjustedSpread weapon_spread + adsFrac player_zoomFrac + isSprinting player_is_sprinting + isReloading weapon_is_reloading + teamColor crosshair_team_color + isAmped weapon_is_amped + crosshairMovementX crosshair_movement_x + crosshairMovementY crosshair_movement_y + } + + Crosshair_1 + { + "ui" "ui/crosshair_wingman_n" + "base_spread" "0" + Args + { + isFiring weapon_is_firing + } + } + } +} \ No newline at end of file diff --git a/ULTRAMenu b/ULTRAMenu new file mode 160000 index 000000000..06ab503bd --- /dev/null +++ b/ULTRAMenu @@ -0,0 +1 @@ +Subproject commit 06ab503bdb3ea875f95eac807cbf0efbc7995211 From df192270817724466f3e0b6dd54a79bced714ad4 Mon Sep 17 00:00:00 2001 From: Will <39478251+VITALISED@users.noreply.github.com> Date: Thu, 2 May 2024 22:38:22 +1000 Subject: [PATCH 26/38] Fix modes menu and server browser playlist stuff --- Northstar.Client/mod/scripts/vscripts/ui/menu_lobby.nut | 2 ++ Northstar.Client/mod/scripts/vscripts/ui/menu_private_match.nut | 1 + 2 files changed, 3 insertions(+) diff --git a/Northstar.Client/mod/scripts/vscripts/ui/menu_lobby.nut b/Northstar.Client/mod/scripts/vscripts/ui/menu_lobby.nut index eedb29c30..8baa85ea1 100644 --- a/Northstar.Client/mod/scripts/vscripts/ui/menu_lobby.nut +++ b/Northstar.Client/mod/scripts/vscripts/ui/menu_lobby.nut @@ -755,6 +755,8 @@ void function DoNSButtonState() } else { + ClientCommand( "loadPlaylists" ) // reload playlists only on northstar so server-browser works + ComboButton_SetText( file.findGameButton, "#MENU_TITLE_SERVER_BROWSER" ) ComboButton_SetText( file.inviteRoomButton, "#PRIVATE_MATCH" ) ComboButton_SetText( file.inviteFriendsButton, "#TOGGLE_PROGRESSION" ) diff --git a/Northstar.Client/mod/scripts/vscripts/ui/menu_private_match.nut b/Northstar.Client/mod/scripts/vscripts/ui/menu_private_match.nut index f658402d0..b1283255a 100644 --- a/Northstar.Client/mod/scripts/vscripts/ui/menu_private_match.nut +++ b/Northstar.Client/mod/scripts/vscripts/ui/menu_private_match.nut @@ -844,6 +844,7 @@ function UpdatePlayerInfo() void function OnPrivateMatchMenu_Open() { + ClientCommand( "loadPlaylists" ) // reload playlists so the modes menu has the all the stuff to lock Lobby_SetFDMode( false ) OnLobbyMenu_Open() } \ No newline at end of file From 361d867df8989fe2dec5b3e80aeade603d2f04be Mon Sep 17 00:00:00 2001 From: Will <39478251+VITALISED@users.noreply.github.com> Date: Thu, 2 May 2024 22:46:30 +1000 Subject: [PATCH 27/38] Move around communities stuff --- Northstar.Client/mod.json | 5 +++++ Northstar.Client/mod/scripts/vscripts/ui/menu_lobby.nut | 5 +++++ Northstar.Client/mod/scripts/vscripts/ui/panel_mainmenu.nut | 1 - 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/Northstar.Client/mod.json b/Northstar.Client/mod.json index 44937a2b0..328e34f06 100644 --- a/Northstar.Client/mod.json +++ b/Northstar.Client/mod.json @@ -46,6 +46,11 @@ "Name": "modlist_reverse", "DefaultValue": "0", "Flags": "ARCHIVE_PLAYERPROFILE" + }, + { + "Name": "ns_communities_disabled_override", + "DefaultValue": "0", + "Flags": "ARCHIVE_PLAYERPROFILE" } ], "Scripts": [ diff --git a/Northstar.Client/mod/scripts/vscripts/ui/menu_lobby.nut b/Northstar.Client/mod/scripts/vscripts/ui/menu_lobby.nut index 8baa85ea1..d36fa0864 100644 --- a/Northstar.Client/mod/scripts/vscripts/ui/menu_lobby.nut +++ b/Northstar.Client/mod/scripts/vscripts/ui/menu_lobby.nut @@ -1613,6 +1613,11 @@ void function MatchmakingSetCountdownTimer( float time, bool useServerTime = tru void function OnLobbyLevelInit() { + if( NSIsVanilla() && ( !GetConVarBool( "ns_communities_disabled_override" ) ) ) + SetConVarBool( "communities_enabled", true) + else + SetConVarBool( "communities_enabled", false) + UpdateCallsignElement( file.callsignCard ) RefreshCreditsAvailable() } diff --git a/Northstar.Client/mod/scripts/vscripts/ui/panel_mainmenu.nut b/Northstar.Client/mod/scripts/vscripts/ui/panel_mainmenu.nut index 590c580cc..507c7db09 100644 --- a/Northstar.Client/mod/scripts/vscripts/ui/panel_mainmenu.nut +++ b/Northstar.Client/mod/scripts/vscripts/ui/panel_mainmenu.nut @@ -520,7 +520,6 @@ void function OnPlayFDButton_Activate( var button ) // repurposed for launching { if ( !Hud_IsLocked( button ) ) { - // SetConVarString( "communities_hostname", "" ) // disable communities due to crash exploits that are still possible through it NSTryAuthWithLocalServer() thread TryAuthWithLocalServer() } From aba850c2e4e3aaa7bf6bf95edcf7166b63310faf Mon Sep 17 00:00:00 2001 From: Will <39478251+VITALISED@users.noreply.github.com> Date: Fri, 3 May 2024 01:52:20 +1000 Subject: [PATCH 28/38] Fix minor button issue --- .../mod/scripts/vscripts/ui/menu_lobby.nut | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Northstar.Client/mod/scripts/vscripts/ui/menu_lobby.nut b/Northstar.Client/mod/scripts/vscripts/ui/menu_lobby.nut index d36fa0864..2f44891ff 100644 --- a/Northstar.Client/mod/scripts/vscripts/ui/menu_lobby.nut +++ b/Northstar.Client/mod/scripts/vscripts/ui/menu_lobby.nut @@ -371,7 +371,7 @@ void function SetupComboButtonTest( var menu ) #if NETWORK_INVITE file.inviteFriendsToNetworkButton = AddComboButton( comboStruct, headerIndex, buttonIndex++, "#INVITE_FRIENDS" ) file.lobbyButtons.append( file.inviteFriendsToNetworkButton ) - Hud_AddEventHandler( file.inviteFriendsToNetworkButton, UIE_CLICK, OnInviteFriendsToNetworkButton_Activate ) + Hud_AddEventHandler( file.inviteFriendsToNetworkButton, UIE_CLICK, _OnInviteFriendsToNetworkButton_Activate ) #endif headerIndex++ @@ -410,6 +410,14 @@ void function SetupComboButtonTest( var menu ) ComboButtons_Finalize( comboStruct ) } +void function _OnInviteFriendsToNetworkButton_Activate( var button ) +{ + if ( Hud_IsLocked( button ) ) + return + + OnInviteFriendsToNetworkButton_Activate( button ) +} + void function _OnInboxButton_Activate( var button ) { if ( Hud_IsLocked( button ) ) From d61aa88d3baa18307caa0dd345d2a54ae195ab52 Mon Sep 17 00:00:00 2001 From: Will <39478251+VITALISED@users.noreply.github.com> Date: Fri, 3 May 2024 04:12:02 +1000 Subject: [PATCH 29/38] Fix invalid ui player crash --- .../mod/scripts/vscripts/sh_progression.nut | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Northstar.CustomServers/mod/scripts/vscripts/sh_progression.nut b/Northstar.CustomServers/mod/scripts/vscripts/sh_progression.nut index 3297643ec..c7d353a1e 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/sh_progression.nut +++ b/Northstar.CustomServers/mod/scripts/vscripts/sh_progression.nut @@ -169,8 +169,14 @@ void function UpdateCachedLoadouts_Threaded() // below here is just making all the menu models update properly and such #if UI - uiGlobal.pilotSpawnLoadoutIndex = GetPersistentSpawnLoadoutIndex( GetUIPlayer(), "pilot" ) - uiGlobal.titanSpawnLoadoutIndex = GetPersistentSpawnLoadoutIndex( GetUIPlayer(), "titan" ) + + // ui player can sometimes be invalid + if( IsValid( GetUIPlayer() ) ) + { + uiGlobal.pilotSpawnLoadoutIndex = GetPersistentSpawnLoadoutIndex( GetUIPlayer(), "pilot" ) + uiGlobal.titanSpawnLoadoutIndex = GetPersistentSpawnLoadoutIndex( GetUIPlayer(), "titan" ) + } + #endif #if CLIENT From 28ec2118595202fe6a9b69ed931881bc96c0f893 Mon Sep 17 00:00:00 2001 From: Will <39478251+VITALISED@users.noreply.github.com> Date: Fri, 3 May 2024 05:41:19 +1000 Subject: [PATCH 30/38] Shuffle around serverfilter stuff --- Northstar.Client/mod/scripts/vscripts/ui/menu_main.nut | 1 - .../mod/scripts/vscripts/ui/panel_mainmenu.nut | 7 +++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/Northstar.Client/mod/scripts/vscripts/ui/menu_main.nut b/Northstar.Client/mod/scripts/vscripts/ui/menu_main.nut index 2d014daf6..ba771876c 100644 --- a/Northstar.Client/mod/scripts/vscripts/ui/menu_main.nut +++ b/Northstar.Client/mod/scripts/vscripts/ui/menu_main.nut @@ -298,7 +298,6 @@ void function LaunchSPTrialMission() void function LaunchMP() { uiGlobal.launching = eLaunching.MULTIPLAYER - NSResetToken() LaunchGame() } diff --git a/Northstar.Client/mod/scripts/vscripts/ui/panel_mainmenu.nut b/Northstar.Client/mod/scripts/vscripts/ui/panel_mainmenu.nut index 507c7db09..91384b699 100644 --- a/Northstar.Client/mod/scripts/vscripts/ui/panel_mainmenu.nut +++ b/Northstar.Client/mod/scripts/vscripts/ui/panel_mainmenu.nut @@ -32,6 +32,7 @@ struct bool installing = false bool stopNSLocalAuth = false + bool initialBoot = false } file const DEBUG_PERMISSIONS = false @@ -145,6 +146,12 @@ void function OnShowMainMenuPanel() Signal( uiGlobal.signalDummy, "EndShowMainMenuPanel" ) EndSignal( uiGlobal.signalDummy, "EndShowMainMenuPanel" ) + if( !file.initialBoot ) + { + NSResetToken() + file.initialBoot = true + } + foreach ( button in file.menuButtons ) { int buttonID = int( Hud_GetScriptID( button ) ) From b47f5b9ca01352b99afc8308d07a3d2281e11cc6 Mon Sep 17 00:00:00 2001 From: Will <39478251+VITALISED@users.noreply.github.com> Date: Fri, 3 May 2024 05:57:57 +1000 Subject: [PATCH 31/38] Revert changes, drop token on mpbutton --- Northstar.Client/mod/scripts/vscripts/ui/menu_main.nut | 1 + .../mod/scripts/vscripts/ui/panel_mainmenu.nut | 10 ++-------- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/Northstar.Client/mod/scripts/vscripts/ui/menu_main.nut b/Northstar.Client/mod/scripts/vscripts/ui/menu_main.nut index ba771876c..db3b0a30e 100644 --- a/Northstar.Client/mod/scripts/vscripts/ui/menu_main.nut +++ b/Northstar.Client/mod/scripts/vscripts/ui/menu_main.nut @@ -297,6 +297,7 @@ void function LaunchSPTrialMission() void function LaunchMP() { + NSResetToken() uiGlobal.launching = eLaunching.MULTIPLAYER LaunchGame() } diff --git a/Northstar.Client/mod/scripts/vscripts/ui/panel_mainmenu.nut b/Northstar.Client/mod/scripts/vscripts/ui/panel_mainmenu.nut index 91384b699..d495c8f55 100644 --- a/Northstar.Client/mod/scripts/vscripts/ui/panel_mainmenu.nut +++ b/Northstar.Client/mod/scripts/vscripts/ui/panel_mainmenu.nut @@ -32,7 +32,6 @@ struct bool installing = false bool stopNSLocalAuth = false - bool initialBoot = false } file const DEBUG_PERMISSIONS = false @@ -146,11 +145,6 @@ void function OnShowMainMenuPanel() Signal( uiGlobal.signalDummy, "EndShowMainMenuPanel" ) EndSignal( uiGlobal.signalDummy, "EndShowMainMenuPanel" ) - if( !file.initialBoot ) - { - NSResetToken() - file.initialBoot = true - } foreach ( button in file.menuButtons ) { @@ -400,7 +394,7 @@ void function UpdatePlayButton( var button ) isStryderAuthenticated = IsStryderAuthenticated() isMPAllowed = IsStryderAllowingMP() - if ( DEBUG_PERMISSIONS ) + if ( true ) { printt( "isOriginConnected:", isOriginConnected ) printt( "isStryderAuthenticated:", isStryderAuthenticated ) @@ -424,7 +418,7 @@ void function UpdatePlayButton( var button ) else if ( button == file.mpButton && !isMPAllowed ) { message = "#MULTIPLAYER_NOT_AVAILABLE" - file.mpButtonActivateFunc = null + // file.mpButtonActivateFunc = null } else if ( button == file.mpButton && !hasLatestPatch ) { From bba9eb11259bda4dfbc11abe585579f0baf53929 Mon Sep 17 00:00:00 2001 From: Will <39478251+VITALISED@users.noreply.github.com> Date: Fri, 3 May 2024 06:42:41 +1000 Subject: [PATCH 32/38] ooptm --- Northstar.Client/mod/scripts/vscripts/ui/panel_mainmenu.nut | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Northstar.Client/mod/scripts/vscripts/ui/panel_mainmenu.nut b/Northstar.Client/mod/scripts/vscripts/ui/panel_mainmenu.nut index d495c8f55..53ea2aeca 100644 --- a/Northstar.Client/mod/scripts/vscripts/ui/panel_mainmenu.nut +++ b/Northstar.Client/mod/scripts/vscripts/ui/panel_mainmenu.nut @@ -394,7 +394,7 @@ void function UpdatePlayButton( var button ) isStryderAuthenticated = IsStryderAuthenticated() isMPAllowed = IsStryderAllowingMP() - if ( true ) + if ( DEBUG_PERMISSIONS ) { printt( "isOriginConnected:", isOriginConnected ) printt( "isStryderAuthenticated:", isStryderAuthenticated ) From 09db81d534e62d990f62f889e2394b634872d080 Mon Sep 17 00:00:00 2001 From: Will <39478251+VITALISED@users.noreply.github.com> Date: Sat, 4 May 2024 01:37:47 +1000 Subject: [PATCH 33/38] Update nativefuncs.json with vanilla compat fns --- .github/nativefuncs.json | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/.github/nativefuncs.json b/.github/nativefuncs.json index 1148d3e58..845112ee0 100644 --- a/.github/nativefuncs.json +++ b/.github/nativefuncs.json @@ -736,12 +736,24 @@ "helpText":"Returns whether or not a given path leads to a folder.", "returnTypeString":"bool", "argTypes":"string path" - }, + }, { "name":"NSGetMasterServerAuthResult", "helpText":"", "returnTypeString":"MasterServerAuthResult", "argTypes":"" + }, + { + "name": "NSResetToken", + "helpText": "Resets serverfilter", + "returnTypeString": "void", + "argTypes": "" + }, + { + "name": "NSIsVanilla", + "helpText": "Checks if the game is currently in vanilla compat mode", + "returnTypeString": "bool", + "argTypes": "" } ] } \ No newline at end of file From 1bed1b2beec8a722d993e612b511bca0c4345e5d Mon Sep 17 00:00:00 2001 From: Will <39478251+VITALISED@users.noreply.github.com> Date: Sat, 4 May 2024 01:39:25 +1000 Subject: [PATCH 34/38] Why the fuck did I commit this in --- ULTRAMenu | 1 - 1 file changed, 1 deletion(-) delete mode 160000 ULTRAMenu diff --git a/ULTRAMenu b/ULTRAMenu deleted file mode 160000 index 06ab503bd..000000000 --- a/ULTRAMenu +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 06ab503bdb3ea875f95eac807cbf0efbc7995211 From ad4aaf79612ad6010e848ebc423eca9df48c45cf Mon Sep 17 00:00:00 2001 From: Will <39478251+VITALISED@users.noreply.github.com> Date: Sat, 4 May 2024 01:43:20 +1000 Subject: [PATCH 35/38] Fix nativefuncs.json again --- .github/nativefuncs.json | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/.github/nativefuncs.json b/.github/nativefuncs.json index 845112ee0..ca947cea9 100644 --- a/.github/nativefuncs.json +++ b/.github/nativefuncs.json @@ -227,6 +227,12 @@ "helpText":"Returns whether or not a given path leads to a folder.", "returnTypeString":"bool", "argTypes":"string path" + }, + { + "name": "NSIsVanilla", + "helpText": "Checks if the game is currently in vanilla compat mode", + "returnTypeString": "bool", + "argTypes": "" } ], "CLIENT":[ @@ -421,7 +427,13 @@ "helpText":"Returns whether or not a given path leads to a folder.", "returnTypeString":"bool", "argTypes":"string path" - } + }, + { + "name": "NSIsVanilla", + "helpText": "Checks if the game is currently in vanilla compat mode", + "returnTypeString": "bool", + "argTypes": "" + } ], "UI":[ { From 2832851579aa520c1856c6323a708c4192f5fd94 Mon Sep 17 00:00:00 2001 From: Will <39478251+VITALISED@users.noreply.github.com> Date: Sat, 4 May 2024 02:32:17 +1000 Subject: [PATCH 36/38] Allow remotes to be created when there's no integrity --- .../mod/scripts/vscripts/sh_remote_functions_mp_custom.gnut | 2 +- ULTRAMenu | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) create mode 160000 ULTRAMenu diff --git a/Northstar.CustomServers/mod/scripts/vscripts/sh_remote_functions_mp_custom.gnut b/Northstar.CustomServers/mod/scripts/vscripts/sh_remote_functions_mp_custom.gnut index 891c0991e..0777b353f 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/sh_remote_functions_mp_custom.gnut +++ b/Northstar.CustomServers/mod/scripts/vscripts/sh_remote_functions_mp_custom.gnut @@ -22,6 +22,6 @@ void function AddCallback_OnRegisteringCustomNetworkVars( void functionref() cal void function NSRemote_RegisterFunction( string name ) { - if( !NSIsVanilla() ) + if( !NSIsVanilla() || GetConVarBool( "ns_skip_vanilla_integrity_check" ) ) Remote_RegisterFunction( name ); } \ No newline at end of file diff --git a/ULTRAMenu b/ULTRAMenu new file mode 160000 index 000000000..06ab503bd --- /dev/null +++ b/ULTRAMenu @@ -0,0 +1 @@ +Subproject commit 06ab503bdb3ea875f95eac807cbf0efbc7995211 From 145e3ab52152ee9a0845451fdb23530e024a307a Mon Sep 17 00:00:00 2001 From: Will <39478251+VITALISED@users.noreply.github.com> Date: Sat, 4 May 2024 02:44:03 +1000 Subject: [PATCH 37/38] Null out mpButtonActivateFunc if using no integrity --- Northstar.Client/mod/scripts/vscripts/ui/panel_mainmenu.nut | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Northstar.Client/mod/scripts/vscripts/ui/panel_mainmenu.nut b/Northstar.Client/mod/scripts/vscripts/ui/panel_mainmenu.nut index 53ea2aeca..ef5109d0c 100644 --- a/Northstar.Client/mod/scripts/vscripts/ui/panel_mainmenu.nut +++ b/Northstar.Client/mod/scripts/vscripts/ui/panel_mainmenu.nut @@ -430,6 +430,10 @@ void function UpdatePlayButton( var button ) message = "#AUTHENTICATIONAGREEMENT_NO" file.mpButtonActivateFunc = null } + else if ( button == file.mpButton && GetConVarBool( "ns_skip_vanilla_integrity_check") ) + { + file.mpButtonActivateFunc = null + } else if ( button == file.mpButton ) { file.mpButtonActivateFunc = LaunchMP From 8edb6695e819a9575a59f0b690e64cd90b361684 Mon Sep 17 00:00:00 2001 From: Will <39478251+VITALISED@users.noreply.github.com> Date: Sat, 4 May 2024 04:17:06 +1000 Subject: [PATCH 38/38] I hate vscode git --- ULTRAMenu | 1 - 1 file changed, 1 deletion(-) delete mode 160000 ULTRAMenu diff --git a/ULTRAMenu b/ULTRAMenu deleted file mode 160000 index 06ab503bd..000000000 --- a/ULTRAMenu +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 06ab503bdb3ea875f95eac807cbf0efbc7995211