Advertisement
Guest User

Untitled

a guest
Dec 28th, 2018
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /***********************************************************************/
  2. /**     © 2015 CD PROJEKT S.A. All rights reserved.
  3. /**     THE WITCHER® is a trademark of CD PROJEKT S. A.
  4. /**     The Witcher game is based on the prose of Andrzej Sapkowski.
  5. /***********************************************************************/
  6.  
  7.  
  8.  
  9.  
  10. import struct SSavegameInfo
  11. {
  12.     import var filename : string;          
  13.     import var slotType : ESaveGameType;   
  14.     import var slotIndex : int;            
  15.                                            
  16. };
  17.  
  18.  
  19. enum Platform
  20. {
  21.     Platform_PC = 0,
  22.     Platform_Xbox1 = 1,
  23.     Platform_PS4 = 2,
  24.     Platform_Unknown = 3
  25. }
  26.  
  27. struct SPostponedPreAttackEvent
  28. {
  29.     var entity      : CGameplayEntity;
  30.     var eventName   : name;
  31.     var eventType   : EAnimationEventType;
  32.     var data        : CPreAttackEventData;
  33.     var animInfo    : SAnimationEventAnimInfo;
  34. };
  35.  
  36. import class CR4Game extends CCommonGame
  37. {
  38.     saved var zoneName : EZoneName;    
  39.     private var gamerProfile : W3GamerProfile;
  40.     private var isDialogOrCutscenePlaying : bool;                  
  41.     private saved var recentDialogOrCutsceneEndGameTime : GameTime;    
  42.     public var isCutscenePlaying : bool;
  43.     public var isDialogDisplayDisabled : bool;
  44.     default isDialogDisplayDisabled = false;
  45.     public var witcherLog : W3GameLog;
  46.     public var deathSaveLockId : int;
  47.     private var currentPresence : name;
  48.     private var restoreUsableItemL : bool;
  49.    
  50.     private saved var savedEnchanterFunds           : int;
  51.     private saved var gameplayFactsForRemoval       : array<SGameplayFactRemoval>;
  52.     private saved var gameplayFacts                 : array<SGameplayFact>;
  53.     private saved var tutorialManagerHandle         : EntityHandle;        
  54.     private saved var diffChangePostponed           : EDifficultyMode;     
  55.     private saved var dynamicallySpawnedBoats       : array<EntityHandle>;     
  56.     private saved var dynamicallySpawnedBoatsToDestroy : array<EntityHandle>;  
  57.    
  58.     private saved var uberMovement : bool;  default uberMovement = false;
  59.    
  60.     function EnableUberMovement( flag : bool )
  61.     {
  62.         uberMovement = flag;
  63.     }
  64.    
  65.     public function IsUberMovementEnabled() : bool
  66.     {
  67.         return uberMovement;
  68.     }  
  69.    
  70.         default diffChangePostponed = EDM_NotSet;
  71.    
  72.    
  73.     import final function ShowSteamControllerBindingPanel() : bool;
  74.    
  75.     import final function ActivateHorseCamera( activate : bool, blendTime : float, optional instantMount : bool );
  76.    
  77.     import final function GetFocusModeController() : CFocusModeController;
  78.    
  79.     public var isRespawningInLastCheckpoint : bool;
  80.     default isRespawningInLastCheckpoint = false;
  81.     private var environmentID : int;
  82.    
  83.     public function SetIsRespawningInLastCheckpoint()
  84.     {
  85.         isRespawningInLastCheckpoint = true;
  86.     }
  87.    
  88.     event  OnGameSaveListUpdated()
  89.     {
  90.         var menuBase    : CR4MenuBase;
  91.         var ingameMenu  : CR4IngameMenu;
  92.        
  93.         menuBase = (CR4MenuBase)(theGame.GetGuiManager().GetRootMenu());
  94.        
  95.         if (menuBase)
  96.         {
  97.             ingameMenu = (CR4IngameMenu)(menuBase.GetSubMenu());
  98.            
  99.             if (ingameMenu)
  100.             {
  101.                 ingameMenu.HandleSaveListUpdate();
  102.             }
  103.         }
  104.     }
  105.    
  106.     event  OnGameLoadInitFinished()
  107.     {
  108.         var requiredContent : array< name >;
  109.         var blockedContentTag : name;
  110.         var i : int;
  111.         var progress : float;
  112.         var loadResult : ELoadGameResult;
  113.         var ingameMenu : CR4IngameMenu;
  114.         var menuBase : CR4MenuBase;
  115.    
  116.         loadResult = GetLoadGameProgress();
  117.         blockedContentTag = 'launch0';
  118.        
  119.         if ( loadResult != LOAD_MissingContent && loadResult != LOAD_Error )
  120.         {
  121.             theSound.SoundEvent("stop_music");
  122.             theSound.SoundEvent("gui_global_game_start");
  123.             theGame.GetGuiManager().RequestMouseCursor(false);
  124.         }
  125.        
  126.         if ( loadResult == LOAD_NotInitialized || loadResult == LOAD_Initializing || loadResult == LOAD_Loading )
  127.         {
  128.             LogChannel( 'Save', "Event OnGameLoadInitFinished() called, but load not initialized / not ready / already loading. DEBUG THIS!" );
  129.             isRespawningInLastCheckpoint = false;
  130.             return true;
  131.         }
  132.        
  133.         if ( loadResult == LOAD_MissingContent )
  134.         {
  135.             GetContentRequiredByLastSave( requiredContent );
  136.            
  137.             theSound.SoundEvent("gui_global_denied");
  138.            
  139.             for ( i = ( requiredContent.Size() - 1 ); i >= 0; i -= 1 )
  140.             {
  141.                 if ( !IsContentAvailable( requiredContent[ i ] ) )
  142.                 {
  143.                     blockedContentTag = requiredContent[ i ];
  144.                     break;
  145.                 }
  146.             }
  147.            
  148.             progress = ProgressToContentAvailable( blockedContentTag );
  149.             GetGuiManager().ShowProgressDialog( UMID_MissingContentOnLoadError, "", "error_message_new_game_not_ready", true, UDB_Ok, progress, UMPT_Content, blockedContentTag );
  150.             isRespawningInLastCheckpoint = false;
  151.            
  152.             menuBase = (CR4MenuBase)(theGame.GetGuiManager().GetRootMenu());
  153.             if (menuBase)
  154.             {
  155.                 ingameMenu = (CR4IngameMenu)(menuBase.GetSubMenu());
  156.                
  157.                 if (ingameMenu)
  158.                 {
  159.                     ingameMenu.HandleLoadGameFailed();
  160.                 }
  161.             }
  162.            
  163.             return true;
  164.         }
  165.        
  166.         if ( loadResult == LOAD_Error )
  167.         {
  168.             menuBase = (CR4MenuBase)(theGame.GetGuiManager().GetRootMenu());
  169.            
  170.             theSound.SoundEvent("gui_global_denied");
  171.            
  172.             if (menuBase)
  173.             {
  174.                 ingameMenu = (CR4IngameMenu)(menuBase.GetSubMenu());
  175.                
  176.                 if (ingameMenu)
  177.                 {
  178.                     ingameMenu.HandleLoadGameFailed();
  179.                 }
  180.             }
  181.         }
  182.  
  183.         if ( loadResult != LOAD_MissingContent && loadResult != LOAD_Error && isRespawningInLastCheckpoint )
  184.         {
  185.             ReleaseNoSaveLock( deathSaveLockId );
  186.             theInput.RestoreContext( 'Exploration', true );
  187.             isRespawningInLastCheckpoint = false;
  188.         }
  189.     }
  190.    
  191.     event  OnGameLoadInitFinishedSuccess()
  192.     {
  193.         GetGuiManager().GetRootMenu().CloseMenu();
  194.     }
  195.    
  196.     public function IsFocusModeActive() : bool
  197.     {
  198.         var focusModeController : CFocusModeController;
  199.         focusModeController = GetFocusModeController();
  200.         if ( focusModeController )
  201.         {
  202.             return focusModeController.IsActive();
  203.         }
  204.         return false;
  205.     }
  206.    
  207.     var logEnabled  : bool;
  208.     default logEnabled = true;
  209.    
  210.     public function EnableLog( enable : bool )
  211.     {
  212.         logEnabled = enable;
  213.     }
  214.    
  215.     public function CanLog() : bool
  216.     {
  217.         return logEnabled && !IsFinalBuild();
  218.     }
  219.        
  220.     import final function GetSurfacePostFX() : CGameplayFXSurfacePost;
  221.    
  222.     import final function GetCommonMapManager() : CCommonMapManager;
  223.  
  224.     import final function GetJournalManager() : CWitcherJournalManager;
  225.  
  226.     import final function GetLootManager() : CR4LootManager;
  227.    
  228.     import final function GetInteractionsManager() : CInteractionsManager;
  229.    
  230.     import final function GetCityLightManager() : CCityLightManager;   
  231.    
  232.     import final function GetSecondScreenManager() : CR4SecondScreenManagerScriptProxy;
  233.        
  234.     import final function GetGuiManager() : CR4GuiManager;
  235.  
  236.     import final function GetGlobalEventsScriptsDispatcher() : CR4GlobalEventsScriptsDispatcher;
  237.    
  238.     import final function GetFastForwardSystem() : CGameFastForwardSystem;
  239.    
  240.     import final function NotifyOpeningJournalEntry( jorunalEntry : CJournalBase );
  241.    
  242.     var globalEventsScriptsDispatcherInternal : CR4GlobalEventsScriptsDispatcher;
  243.     public function GetGlobalEventsManager() : CR4GlobalEventsScriptsDispatcher
  244.     {
  245.         if ( !globalEventsScriptsDispatcherInternal )
  246.         {
  247.             globalEventsScriptsDispatcherInternal = GetGlobalEventsScriptsDispatcher();
  248.         }
  249.         return globalEventsScriptsDispatcherInternal;
  250.     }
  251.        
  252.    
  253.     import final function StartSepiaEffect( fadeInTime: float ) : bool;
  254.    
  255.    
  256.     import final function StopSepiaEffect( fadeOutTime: float ) : bool;
  257.    
  258.    
  259.     import final function GetWindAtPoint( point : Vector ) : Vector;
  260.    
  261.     import final function GetWindAtPointForVisuals( point : Vector ) : Vector;
  262.    
  263.     import final function GetGameCamera() : CCustomCamera;
  264.    
  265.    
  266.     import final function GetBuffImmunitiesForActor( actor : CActor ) : CBuffImmunity;
  267.     import final function GetMonsterParamsForActor( actor : CActor, out monsterCategory : EMonsterCategory, out soundMonsterName : CName, out isTeleporting : bool, out canBeTargeted : bool, out canBeHitByFists : bool ) : bool;
  268.     import final function GetMonsterParamForActor( actor : CActor, out val : CMonsterParam ) : bool;
  269.    
  270.    
  271.     import final function GetVolumePathManager() : CVolumePathManager;
  272.    
  273.    
  274.     import final function SummonPlayerHorse( teleportToSafeSpot : bool, createEntityHelper : CR4CreateEntityHelper );
  275.  
  276.    
  277.     import final function ToggleMenus();
  278.     import final function ToggleInput();
  279.    
  280.     import final function GetResourceAliases( out aliases : array< string > );
  281.    
  282.    
  283.     import final function GetKinectSpeechRecognizer() : CR4KinectSpeechRecognizerListenerScriptProxy;
  284.    
  285.    
  286.     import final function GetTutorialSystem() : CR4TutorialSystem;
  287.    
  288.    
  289.     import final function DisplaySystemHelp();
  290.     import final function DisplayStore();
  291.     import final function DisplayUserProfileSystemDialog();
  292.     import final function SetRichPresence( presence : name );
  293.  
  294.    
  295.     import final function OnUserDialogCallback( message, action : int );
  296.    
  297.    
  298.     import final function SaveUserSettings();
  299.    
  300.     public final function UpdateRichPresence(presence : name)
  301.     {
  302.         SetRichPresence(presence);
  303.         currentPresence = presence;
  304.     }
  305.    
  306.     public final function ClearRichPresence(presence : name)
  307.     {
  308.         var manager: CCommonMapManager;
  309.         var currentArea : EAreaName;
  310.        
  311.        
  312.         if(currentPresence == presence)
  313.         {
  314.             manager = theGame.GetCommonMapManager();
  315.             currentArea = manager.GetCurrentJournalArea();
  316.             currentPresence =  manager.GetLocalisationNameFromAreaType( currentArea );
  317.             SetRichPresence(currentPresence);
  318.            
  319.         }
  320.     }
  321.    
  322.    
  323.     import var params : W3GameParams;
  324.  
  325.     private var minimapSettings : C2dArray;
  326.     public var playerStatisticsSettings : C2dArray;
  327.     public var hudSettings : C2dArray;
  328.  
  329.    
  330.     public var damageMgr : W3DamageManager;
  331.  
  332.    
  333.     public var effectMgr : W3GameEffectManager;
  334.    
  335.    
  336.     private var timescaleSources : array<STimescaleSource>;
  337.  
  338.    
  339.     public saved var envMgr : W3EnvironmentManager;
  340.    
  341.     public var runewordMgr : W3RunewordManager;
  342.    
  343.     private var questLevelsFilePaths : array<string>;
  344.     public var questLevelsContainer : array<C2dArray>;
  345.     public var expGlobalModifiers : C2dArray;
  346.     public var expGlobalMod_kills : float;
  347.     public var expGlobalMod_quests : float;
  348.    
  349.    
  350.     private var syncAnimManager : W3SyncAnimationManager;
  351.     public function GetSyncAnimManager() : W3SyncAnimationManager
  352.     {
  353.         if( !syncAnimManager )
  354.         {
  355.             syncAnimManager = new W3SyncAnimationManager in this;
  356.         }
  357.        
  358.         return syncAnimManager;
  359.     }
  360.    
  361.    
  362.    
  363.    
  364.     public function SetEnvironmentID( id : int )
  365.     {
  366.         environmentID = id;
  367.     }
  368.    
  369.     private function SetTimescaleSources()
  370.     {
  371.         timescaleSources.Clear();
  372.         timescaleSources.Grow( EnumGetMax('ETimescaleSource') + 1 );
  373.  
  374.        
  375.         timescaleSources[ ETS_PotionBlizzard ].sourceType = ETS_PotionBlizzard;
  376.         timescaleSources[ ETS_PotionBlizzard ].sourceName = 'PotionBlizzard';
  377.         timescaleSources[ ETS_PotionBlizzard ].sourcePriority = 10;
  378.        
  379.        
  380.         timescaleSources[ ETS_SlowMoTask ].sourceType = ETS_SlowMoTask;
  381.         timescaleSources[ ETS_SlowMoTask ].sourceName = 'SlowMotionTask';
  382.         timescaleSources[ ETS_SlowMoTask ].sourcePriority = 15;
  383.        
  384.        
  385.         timescaleSources[ ETS_HeavyAttack ].sourceType = ETS_HeavyAttack;
  386.         timescaleSources[ ETS_HeavyAttack ].sourceName = 'HeavyAttack';
  387.         timescaleSources[ ETS_HeavyAttack ].sourcePriority = 15;
  388.        
  389.        
  390.         timescaleSources[ ETS_ThrowingAim ].sourceType = ETS_ThrowingAim;
  391.         timescaleSources[ ETS_ThrowingAim ].sourceName = 'ThrowingAim';
  392.         timescaleSources[ ETS_ThrowingAim ].sourcePriority = 15;
  393.        
  394.        
  395.         timescaleSources[ ETS_RaceSlowMo ].sourceType = ETS_RaceSlowMo;
  396.         timescaleSources[ ETS_RaceSlowMo ].sourceName = 'RaceSlowMo';
  397.         timescaleSources[ ETS_RaceSlowMo ].sourcePriority = 10;
  398.        
  399.        
  400.         timescaleSources[ ETS_RadialMenu ].sourceType = ETS_RadialMenu;
  401.         timescaleSources[ ETS_RadialMenu ].sourceName = 'RadialMenu';
  402.         timescaleSources[ ETS_RadialMenu ].sourcePriority = 20;
  403.        
  404.        
  405.         timescaleSources[ ETS_CFM_PlayAnim ].sourceType = ETS_CFM_PlayAnim;
  406.         timescaleSources[ ETS_CFM_PlayAnim ].sourceName = 'CFM_PlayAnim';
  407.         timescaleSources[ ETS_CFM_PlayAnim ].sourcePriority = 25;
  408.        
  409.        
  410.         timescaleSources[ ETS_CFM_On ].sourceType = ETS_CFM_On;
  411.         timescaleSources[ ETS_CFM_On ].sourceName = 'CFM_On';
  412.         timescaleSources[ ETS_CFM_On ].sourcePriority = 20;
  413.        
  414.        
  415.         timescaleSources[ ETS_DebugInput ].sourceType = ETS_DebugInput;
  416.         timescaleSources[ ETS_DebugInput ].sourceName = 'debug_input';
  417.         timescaleSources[ ETS_DebugInput ].sourcePriority = 30;
  418.        
  419.        
  420.         timescaleSources[ ETS_SkillFrenzy ].sourceType = ETS_SkillFrenzy;
  421.         timescaleSources[ ETS_SkillFrenzy ].sourceName = 'skill_frenzy';
  422.         timescaleSources[ ETS_SkillFrenzy ].sourcePriority = 15;
  423.        
  424.        
  425.         timescaleSources[ ETS_HorseMelee ].sourceType = ETS_HorseMelee;
  426.         timescaleSources[ ETS_HorseMelee ].sourceName = 'horse_melee';
  427.         timescaleSources[ ETS_HorseMelee ].sourcePriority = 15;
  428.        
  429.        
  430.         timescaleSources[ ETS_FinisherInput ].sourceType = ETS_FinisherInput;
  431.         timescaleSources[ ETS_FinisherInput ].sourceName = 'finisher_input';
  432.         timescaleSources[ ETS_FinisherInput ].sourcePriority = 15;
  433.        
  434.        
  435.         timescaleSources[ ETS_TutorialFight ].sourceType = ETS_TutorialFight;
  436.         timescaleSources[ ETS_TutorialFight ].sourceName = 'tutorial_fight';
  437.         timescaleSources[ ETS_TutorialFight ].sourcePriority = 25;
  438.        
  439.        
  440.         timescaleSources[ ETS_InstantKill ].sourceType = ETS_InstantKill;
  441.         timescaleSources[ ETS_InstantKill ].sourceName = 'instant_kill';
  442.         timescaleSources[ ETS_InstantKill ].sourcePriority = 5;
  443.     }
  444.    
  445.     public function GetTimescaleSource(src : ETimescaleSource) : name
  446.     {
  447.         return timescaleSources[src].sourceName;
  448.     }
  449.    
  450.     public function GetTimescalePriority(src : ETimescaleSource) : int
  451.     {
  452.         return timescaleSources[src].sourcePriority;
  453.     }
  454.    
  455.     private function UpdateSecondScreen()
  456.     {
  457.         var areaMapPins             : array< SAreaMapPinInfo >;
  458.         var areaMapPinsCount        : int;
  459.         var index_areas             : int;
  460.         var worldPath               : string;
  461.         var localMapPins            : array< SCommonMapPinInstance >;
  462.         var globalMapPins           : array< SCommonMapPinInstance >;
  463.         var mapPin                  : SCommonMapPinInstance;
  464.    
  465.         areaMapPins         = GetCommonMapManager().GetAreaMapPins();
  466.         areaMapPinsCount    = areaMapPins.Size();
  467.         for ( index_areas = 0; index_areas < areaMapPinsCount; index_areas += 1 )
  468.         {      
  469.             mapPin.id = areaMapPins[ index_areas ].areaType;
  470.             mapPin.tag = '0';
  471.             mapPin.type = 'WorldMap';
  472.             mapPin.position = areaMapPins[ index_areas ].position;
  473.             mapPin.isDiscovered = true;
  474.             globalMapPins.PushBack( mapPin );
  475.            
  476.             localMapPins    = GetCommonMapManager().GetMapPinInstances( areaMapPins[ index_areas ].worldPath );
  477.             GetSecondScreenManager().SendAreaMapPins( areaMapPins[ index_areas ].areaType, localMapPins );         
  478.         }      
  479.        
  480.         GetSecondScreenManager().SendGlobalMapPins( globalMapPins );   
  481.     }
  482.    
  483.    
  484.     import final function GetPlatform():int;
  485.    
  486.     private var isSignedIn:bool;
  487.     default isSignedIn = false;
  488.    
  489.     public function isUserSignedIn():bool
  490.     {
  491.         if (GetPlatform() == Platform_PC)
  492.         {
  493.             return true;
  494.         }
  495.         else
  496.         {
  497.             return isSignedIn;
  498.         }
  499.     }
  500.    
  501.     event OnUserSignedIn()
  502.     {
  503.         isSignedIn = true;
  504.        
  505.         GetGuiManager().OnSignIn();
  506.     }
  507.    
  508.     event OnUserSignedOut()
  509.     {
  510.         isSignedIn = false;
  511.        
  512.         GetGuiManager().OnSignOut();
  513.     }
  514.    
  515.     event OnSignInStarted()
  516.     {
  517.         GetGuiManager().OnSignInStarted();
  518.     }
  519.    
  520.     event OnSignInCancelled()
  521.     {
  522.         GetGuiManager().OnSignInCancelled();
  523.     }
  524.    
  525.     import final function SetActiveUserPromiscuous();
  526.    
  527.     import final function ChangeActiveUser();
  528.    
  529.     import final function GetActiveUserDisplayName() : string;
  530.    
  531.    
  532.     import final function IsContentAvailable( content : name ) : bool;
  533.    
  534.    
  535.     import final function ProgressToContentAvailable( content : name ) : int;
  536.    
  537.     import final function ShouldForceInstallVideo() : bool;
  538.    
  539.     import final function IsDebugQuestMenuEnabled() : bool;
  540.    
  541.    
  542.     import final function EnableNewGamePlus( enable : bool );
  543.    
  544.    
  545.     import final function StartNewGamePlus( save : SSavegameInfo ) : ENewGamePlusStatus;
  546.    
  547.     public function OnConfigValueChanged( varName : name, value : string ) : void
  548.     {
  549.         var kinect : CR4KinectSpeechRecognizerListenerScriptProxy;
  550.         kinect = GetKinectSpeechRecognizer();
  551.        
  552.         if ( varName == 'Kinect' )
  553.         {
  554.             if ( value == "true" )
  555.                 kinect.SetEnabled( true );
  556.             else
  557.                 kinect.SetEnabled( false );
  558.         }
  559.     }
  560.    
  561.     public function LoadQuestLevels( filePath: string ) : void
  562.     {  
  563.         var index : int;   
  564.         index = questLevelsFilePaths.FindFirst( filePath );    
  565.         if( index == -1 )
  566.         {      
  567.             questLevelsFilePaths.PushBack( filePath )
  568.             questLevelsContainer.PushBack( LoadCSV( filePath ) );
  569.         }
  570.     }
  571.    
  572.     public function UnloadQuestLevels( filePath: string ) : void
  573.     {  
  574.         var index : int;   
  575.         index = questLevelsFilePaths.FindFirst( filePath );    
  576.         if( index != -1 )
  577.         {
  578.             questLevelsFilePaths.Erase( index );   
  579.             questLevelsContainer.Erase( index );
  580.         }        
  581.     }
  582.    
  583.     event OnGameStarting(restored : bool )
  584.     {
  585.         var diff : int;
  586.    
  587.         if(!restored)
  588.         {
  589.            
  590.             gameplayFacts.Clear();
  591.             gameplayFactsForRemoval.Clear();
  592.         }
  593.        
  594.         if (!FactsDoesExist("lowest_difficulty_used") || GetLowestDifficultyUsed() == EDM_NotSet)
  595.         {
  596.             SetLowestDifficultyUsed(GetDifficultyLevel());
  597.         }
  598.            
  599.         SetHoursPerMinute(0.25);   
  600.         SetTimescaleSources();
  601.        
  602.        
  603.         isDialogOrCutscenePlaying = false;
  604.    
  605.        
  606.         params.Init();
  607.        
  608.        
  609.         witcherLog = new W3GameLog in this;
  610.                
  611.         InitGamerProfile();
  612.            
  613.        
  614.         damageMgr = new W3DamageManager in this;
  615.  
  616.         tooltipSettings = LoadCSV("gameplay\globals\tooltip_settings.csv");
  617.         minimapSettings = LoadCSV("gameplay\globals\minimap_settings.csv");
  618.         LoadHudSettings();
  619.         playerStatisticsSettings = LoadCSV("gameplay\globals\player_statistics_settings.csv");
  620.                    
  621.         LoadQuestLevels( "gameplay\globals\quest_levels.csv" );      
  622.        
  623.         expGlobalModifiers = LoadCSV("gameplay\globals\exp_mods.csv");
  624.         expGlobalMod_kills = StringToFloat( expGlobalModifiers.GetValueAt(0,0) );
  625.         expGlobalMod_quests = StringToFloat( expGlobalModifiers.GetValueAt(1,0) );
  626.        
  627.         InitializeEffectManager();
  628.  
  629.         envMgr = new W3EnvironmentManager in this;
  630.         envMgr.Initialize();
  631.        
  632.         runewordMgr = new W3RunewordManager in this;
  633.         runewordMgr.Init();
  634.        
  635.         theGame.RequestPopup( 'OverlayPopup' );
  636.        
  637.         theSound.Initialize()
  638.         if(IsLoadingScreenVideoPlaying())
  639.         {
  640.             theSound.EnterGameState(ESGS_Movie);
  641.         }
  642.     }
  643.        
  644.     private function InitGamerProfile()
  645.     {
  646.         gamerProfile = new W3GamerProfile in this;
  647.         gamerProfile.Init();
  648.     }
  649.    
  650.     public function GetGamerProfile() : W3GamerProfile
  651.     {
  652.        
  653.         if(!gamerProfile)
  654.             InitGamerProfile();
  655.        
  656.         return gamerProfile;
  657.     }
  658.    
  659.     public function OnTick()
  660.     {
  661.         if(envMgr)
  662.             envMgr.Update();
  663.            
  664.        
  665.         if(diffChangePostponed != EDM_NotSet && thePlayer)
  666.         {
  667.             OnDifficultyChanged(diffChangePostponed);
  668.             diffChangePostponed = EDM_NotSet;
  669.         }
  670.        
  671.         FirePostponedPreAttackEvents();
  672.     }  
  673.    
  674.     event OnGameStarted(restored : bool)
  675.     {
  676.         var focusModeController : CFocusModeController;
  677.        
  678.         focusModeController = GetFocusModeController();
  679.        
  680.         if( !restored )
  681.         {
  682.            
  683.             if(FactsQuerySum("started_new_game") <= 0)
  684.             {
  685.                 thePlayer.displayedQuestsGUID.Clear();
  686.  
  687.                 dynamicallySpawnedBoats.Clear();
  688.                 FactsAdd("started_new_game", 1);
  689.             }
  690.         }
  691.        
  692.         if ( FactsQuerySum( "q704_long_night_starts" ) == 0 )
  693.         {
  694.             GetWorld().HideLayerGroup( "quests\main_quests\q704_the_truth\q704_vampires\custom_land_borders" );
  695.         }
  696.        
  697.         if ( focusModeController )
  698.         {
  699.             focusModeController.OnGameStarted();
  700.         }
  701.    
  702.         GetCommonMapManager().OnGameStarted();
  703.        
  704.        
  705.         ClearRichPresence(currentPresence);    
  706.  
  707.         theSound.InitializeAreaMusic( GetCommonMapManager().GetCurrentArea() );
  708.         UpdateSecondScreen();
  709.        
  710.         if( thePlayer && thePlayer.teleportedOnBoatToOtherHUB )
  711.         {
  712.             thePlayer.SetTeleportedOnBoatToOtherHUB( false );
  713.             thePlayer.AddTimer( 'DelayedSpawnAndMountBoat', 0.001f, false );
  714.         }
  715.     }
  716.    
  717.     event OnHandleWorldChange()
  718.     {
  719.         thePlayer.SetTeleportedOnBoatToOtherHUB( true );
  720.     }
  721.  
  722.    
  723.     event OnBeforeWorldChange( worldName : string )
  724.     {
  725.        
  726.         var manager : CCommonMapManager = theGame.GetCommonMapManager();
  727.         if ( manager )
  728.         {
  729.             manager.CacheMapPins();
  730.             manager.ForceSettingLoadingScreenVideoForWorld( worldName );
  731.         }
  732.  
  733.        
  734.         thePlayer.SetUsedVehicle( NULL );
  735.     }
  736.    
  737.     event OnAfterLoadingScreenGameStart()
  738.     {
  739.         var tut : STutorialMessage;
  740.        
  741.        
  742.         theSound.LeaveGameState(ESGS_Movie);
  743.        
  744.        
  745.         theSound.SoundEvent("system_resume");
  746.        
  747.        
  748.         if(ShouldProcessTutorial('TutorialStash') && FactsQuerySum("tut_stash_fresh_playthrough") <= 0)
  749.         {          
  750.            
  751.             tut.type = ETMT_Message;
  752.             tut.tutorialScriptTag = 'TutorialStash';
  753.             tut.canBeShownInMenus = false;
  754.             tut.glossaryLink = false;
  755.             tut.markAsSeenOnShow = true;
  756.            
  757.            
  758.             theGame.GetTutorialSystem().DisplayTutorial(tut);
  759.         }
  760.     }
  761.    
  762.     event  OnSaveStarted( type : ESaveGameType )
  763.     {
  764.         LogChannel( 'Savegame', "OnSaveStarted " + type );
  765.        
  766.     }
  767.  
  768.     event  OnSaveCompleted( type : ESaveGameType, succeeded : bool )
  769.     {
  770.         var hud : CR4ScriptedHud;
  771.         var text : string;
  772.  
  773.         LogChannel( 'Savegame', "OnSaveCompleted " + type + " " + succeeded );
  774.        
  775.         if ( succeeded )
  776.         {
  777.             theGame.GetGuiManager().ShowSavingIndicator();
  778.             theGame.GetGuiManager().HideSavingIndicator();
  779.        
  780.             if (theGame.GetPlatform() == Platform_Xbox1)
  781.             {
  782.                 text = "panel_hud_message_gamesaved_X1";
  783.             }
  784.             else if (theGame.GetPlatform() == Platform_PS4)
  785.             {
  786.                 text = "panel_hud_message_gamesaved_PS4";
  787.             }
  788.             else
  789.             {
  790.                 text = "panel_hud_message_gamesaved";
  791.             }
  792.            
  793.             if ( type == SGT_AutoSave || type == SGT_CheckPoint || type == SGT_ForcedCheckPoint )
  794.             {
  795.                 hud = ( CR4ScriptedHud )GetHud();
  796.                 if ( hud )
  797.                 {
  798.                     hud.HudConsoleMsg( GetLocStringByKeyExt(text) );
  799.                 }
  800.             }
  801.             else
  802.             {
  803.                 thePlayer.DisplayHudMessage( text );
  804.             }
  805.         }
  806.         else if ( type == SGT_QuickSave || type == SGT_Manual )
  807.         {
  808.             if (theGame.GetPlatform() == Platform_Xbox1)
  809.             {
  810.                 text = "panel_hud_message_gamesavedfailed_X1"
  811.             }
  812.             else if (theGame.GetPlatform() == Platform_PS4)
  813.             {
  814.                 text = "panel_hud_message_gamesavedfailed_PS4";
  815.             }
  816.             else
  817.             {
  818.                 text = "panel_hud_message_gamesavedfailed";
  819.             }
  820.            
  821.             theGame.GetGuiManager().ShowUserDialog(0, "", text, UDB_Ok);
  822.         }
  823.     }
  824.  
  825.     event OnControllerReconnected()
  826.     {
  827.         if(!theGame.IsBlackscreen() && theGame.IsActive())
  828.         {
  829.             if(theGame.GetGuiManager().IsAnyMenu())
  830.             {
  831.                 theSound.SoundEvent("system_resume_music_only");
  832.             }
  833.             else
  834.             {
  835.                 theSound.SoundEvent("system_resume");
  836.             }
  837.         }
  838.        
  839.         GetGuiManager().OnControllerReconnected();
  840.     }
  841.    
  842.     event OnControllerDisconnected()
  843.     {
  844.         if(!theGame.IsBlackscreen() && theGame.IsActive() && !theGame.GetGuiManager().IsAnyMenu())
  845.         {
  846.            
  847.             theSound.SoundEvent("system_pause");
  848.         }
  849.        
  850.         GetGuiManager().OnControllerDisconnected();
  851.     }
  852.    
  853.    
  854.     event OnGiveReward( target : CEntity, rewardName : name, rewrd : SReward )
  855.     {
  856.         var i                       : int;
  857.         var itemCount               : int;
  858.         var gameplayEntity          : CGameplayEntity;
  859.         var inv                     : CInventoryComponent;
  860.         var goldMultiplier          : float;
  861.         var itemMultiplier          : float;
  862.         var itemsCount              : int;
  863.         var ids                     : array<SItemUniqueId>;
  864.         var itemCategory            : name;
  865.         var lvlDiff                 : int;
  866.         var moneyWon                : int;
  867.         var expModifier             : float;
  868.         var difficultyMode          : EDifficultyMode;
  869.         var rewardNameS             : string;
  870.         var ep1Content              : bool;
  871.         var rewardMultData          : SRewardMultiplier;
  872.        
  873.         if ( target == thePlayer )
  874.         {
  875.            
  876.             if ( rewrd.experience > 0 && GetWitcherPlayer())
  877.             {
  878.                 expModifier = 1.0f;
  879.                 GetWitcherPlayer().AddPoints( EExperiencePoint, RoundF( rewrd.experience * expGlobalMod_quests * expModifier), true);
  880.             }
  881.                
  882.                 rewardNameS = NameToString(rewardName);
  883.                 ep1Content = false;
  884.                 if ( StrContains(rewardNameS, "q60") )
  885.                 {
  886.                     ep1Content = true;
  887.                 }
  888.                
  889.                 {
  890.                     if(FactsQuerySum("witcher3_game_finished") > 1 && !ep1Content )
  891.                     {
  892.                         expModifier = 0.5f;    
  893.                     }
  894.                     else
  895.                     {
  896.                         if ( rewrd.level == 0 )
  897.                         {
  898.                             expModifier = 1.f;  
  899.                         }
  900.                         else
  901.                         {
  902.                             lvlDiff = rewrd.level - thePlayer.GetLevel();
  903.                            
  904.                            
  905.                             if(FactsQuerySum("NewGamePlus") > 0)
  906.                                 lvlDiff += params.GetNewGamePlusLevel();
  907.                                
  908.                             if ( lvlDiff <= -theGame.params.LEVEL_DIFF_HIGH )
  909.                             {
  910.                                 expModifier = 0.f;     
  911.                             }
  912.                             else
  913.                             {
  914.                                 difficultyMode = theGame.GetDifficultyMode();
  915.                                 if ( difficultyMode == EDM_Hardcore )
  916.                                 {
  917.                                     expModifier = 0.8;
  918.                                 }
  919.                                 else if ( difficultyMode == EDM_Hard )
  920.                                 {
  921.                                     expModifier = 0.9;
  922.                                 }
  923.                                 else
  924.                                 {
  925.                                     expModifier = 1.0;
  926.                                 }
  927.                                
  928.                                 if ( ep1Content && lvlDiff < theGame.params.LEVEL_DIFF_HIGH )
  929.                                 {
  930.                                     expModifier += lvlDiff * theGame.params.LEVEL_DIFF_XP_MOD;
  931.                                     if ( expModifier > theGame.params.MAX_XP_MOD )
  932.                                         expModifier = theGame.params.MAX_XP_MOD;
  933.                                     if ( expModifier < 0.f )
  934.                                         expModifier = 0.f;
  935.                                 }
  936.                             }
  937.                         }
  938.                     }
  939.                 }
  940.                
  941.                 if(expModifier > 0.f)
  942.                     GetWitcherPlayer().AddPoints( EExperiencePoint, RoundF( rewrd.experience * expGlobalMod_quests * expModifier), true);
  943.                 else if ( expModifier == 0.f && rewrd.experience > 0 )
  944.                 {
  945.                     expModifier = 0.05f;           
  946.                     GetWitcherPlayer().AddPoints( EExperiencePoint, RoundF( rewrd.experience * expGlobalMod_quests * expModifier), true);
  947.                 }
  948.             }
  949.            
  950.             if ( rewrd.achievement > 0 )
  951.             {
  952.                 theGame.GetGamerProfile().AddAchievement( rewrd.achievement );
  953.             }
  954.         }
  955.        
  956.         gameplayEntity = (CGameplayEntity)target;
  957.         if ( gameplayEntity )
  958.         {
  959.             inv = gameplayEntity.GetInventory();
  960.             if ( inv )
  961.             {
  962.                 rewardMultData = thePlayer.GetRewardMultiplierData( rewardName );
  963.                
  964.                 if( rewardMultData.isItemMultiplier )
  965.                 {
  966.                     goldMultiplier = 1.0;
  967.                     itemMultiplier = rewardMultData.rewardMultiplier;
  968.                 }
  969.                 else
  970.                 {
  971.                     goldMultiplier = rewardMultData.rewardMultiplier;
  972.                     itemMultiplier = 1.0;
  973.                 }
  974.                
  975.                
  976.                 if ( rewrd.gold > 0 )
  977.                 {
  978.                     inv.AddMoney( (int)(rewrd.gold * goldMultiplier) );
  979.                     thePlayer.RemoveRewardMultiplier(rewardName);      
  980.                     if( target == thePlayer )
  981.                     {
  982.                         moneyWon = (int)(rewrd.gold * goldMultiplier);
  983.                        
  984.                         if ( moneyWon > 0 )
  985.                             thePlayer.DisplayItemRewardNotification('Crowns', moneyWon );
  986.                     }
  987.                 }
  988.                
  989.                
  990.                
  991.                 for ( i = 0; i < rewrd.items.Size(); i += 1 )
  992.                 {
  993.                     itemsCount = RoundF( rewrd.items[ i ].amount * itemMultiplier );
  994.                    
  995.                     if( itemsCount > 0 )
  996.                     {
  997.                         ids = inv.AddAnItem( rewrd.items[ i ].item, itemsCount );
  998.                        
  999.                         for ( itemCount = 0; itemCount < ids.Size(); itemCount += 1 )
  1000.                         {
  1001.                            
  1002.                             if ( inv.ItemHasTag( ids[i], 'Autogen' ) && GetWitcherPlayer().GetLevel() - 1 > 1 )
  1003.                             {
  1004.                                 inv.GenerateItemLevel( ids[i], true );
  1005.                             }
  1006.                         }
  1007.                        
  1008.                         itemCategory = inv.GetItemCategory( ids[0] );
  1009.                         if ( itemCategory == 'alchemy_recipe' ||  itemCategory == 'crafting_schematic' )
  1010.                         {
  1011.                             inv.ReadSchematicsAndRecipes( ids[0] );
  1012.                         }                      
  1013.                        
  1014.                         if(target == thePlayer)
  1015.                         {
  1016.                            
  1017.                             if( !inv.ItemHasTag( ids[0], 'GwintCard') )
  1018.                             {
  1019.                                 thePlayer.DisplayItemRewardNotification(rewrd.items[ i ].item, RoundF( rewrd.items[ i ].amount * itemMultiplier ) );
  1020.                             }
  1021.                         }
  1022.                     }
  1023.                 }
  1024.             }
  1025.         }
  1026.     }
  1027.  
  1028.     public function IsEffectManagerInitialized() : bool
  1029.     {
  1030.         if(!effectMgr)
  1031.             return false;
  1032.        
  1033.         return effectMgr.IsReady();
  1034.     }
  1035.    
  1036.     public function InitializeEffectManager()
  1037.     {
  1038.         effectMgr = new W3GameEffectManager in this;
  1039.         effectMgr.Initialize();
  1040.     }
  1041.    
  1042.     public function GetLowestDifficultyUsed() : EDifficultyMode
  1043.     {
  1044.         return FactsQuerySum("lowest_difficulty_used");
  1045.     }
  1046.    
  1047.     public function SetLowestDifficultyUsed(d : EDifficultyMode)
  1048.     {
  1049.         FactsSet("lowest_difficulty_used", (int)d);
  1050.     }
  1051.    
  1052.    
  1053.     event OnGameEnded()
  1054.     {  
  1055.         var focusModeController : CFocusModeController;
  1056.        
  1057.         if ( runewordMgr )
  1058.         {
  1059.             delete runewordMgr;
  1060.             runewordMgr = NULL;
  1061.         }
  1062.        
  1063.         focusModeController = GetFocusModeController();
  1064.         if ( focusModeController )
  1065.         {
  1066.             focusModeController.OnGameEnded();
  1067.         }
  1068.        
  1069.         DeactivateEnvironment( environmentID, 0 );
  1070.            
  1071.         if(effectMgr)
  1072.         {
  1073.             delete effectMgr;
  1074.             effectMgr = NULL;
  1075.         }
  1076.        
  1077.         if(envMgr)
  1078.         {
  1079.             delete envMgr;
  1080.             envMgr = NULL;
  1081.         }
  1082.        
  1083.         if( syncAnimManager )
  1084.         {
  1085.             delete syncAnimManager;
  1086.             syncAnimManager = NULL;
  1087.         }
  1088.        
  1089.         RemoveTimeScale( GetTimescaleSource(ETS_RadialMenu) );
  1090.  
  1091.        
  1092.         theSound.Finalize();
  1093.        
  1094.        
  1095.         LogChannel( 'HUD', "GUI Closed" );
  1096.     }
  1097.        
  1098.     public var m_runReactionSceneDialog : bool;
  1099.     public function SetRunReactionSceneDialog( val : bool ){ m_runReactionSceneDialog = val; }
  1100.    
  1101.     public function SetIsDialogOrCutscenePlaying(b : bool)
  1102.     {
  1103.         var witcher         : W3PlayerWitcher;
  1104.         var activePoster    : W3Poster;
  1105.         var hud             : CR4ScriptedHud;
  1106.         var radialModule    : CR4HudModuleRadialMenu;
  1107.         var lootPopup       : CR4LootPopup;
  1108.         var bolts           : SItemUniqueId;
  1109.        
  1110.         isDialogOrCutscenePlaying = b;
  1111.         recentDialogOrCutsceneEndGameTime = GetGameTime();
  1112.        
  1113.         if ( b)
  1114.         {
  1115.             hud = (CR4ScriptedHud)GetHud();
  1116.    
  1117.             if( hud )
  1118.             {
  1119.                 radialModule = (CR4HudModuleRadialMenu)hud.GetHudModule("RadialMenuModule");
  1120.                 if (radialModule && radialModule.IsRadialMenuOpened())
  1121.                 {
  1122.                     radialModule.HideRadialMenu();
  1123.                 }
  1124.             }
  1125.            
  1126.             lootPopup = (CR4LootPopup)GetGuiManager().GetPopup('LootPopup');
  1127.            
  1128.             if (lootPopup)
  1129.             {
  1130.                 lootPopup.ClosePopup();
  1131.             }
  1132.         }
  1133.        
  1134.         if(theGame.GetTutorialSystem() && theGame.GetTutorialSystem().IsRunning())
  1135.         {
  1136.             theGame.GetTutorialSystem().OnCutsceneOrDialogChange(b);
  1137.            
  1138.             if(b)
  1139.             {
  1140.                 FactsAdd("tut_dialog_started", 1, CeilF(ConvertRealTimeSecondsToGameSeconds(1)));
  1141.             }
  1142.         }
  1143.        
  1144.        
  1145.         witcher = GetWitcherPlayer();
  1146.         if(b && witcher && witcher.IsAnyQuenActive())
  1147.         {
  1148.             witcher.FinishQuen( true, true );          
  1149.         }
  1150.        
  1151.         activePoster = thePlayer.GetActivePoster ();
  1152.        
  1153.         if ( activePoster )
  1154.         {
  1155.             CloseMenu('PosterMenu');
  1156.             activePoster.OnEndedObservingPoster();
  1157.         }
  1158.        
  1159.         if ( b && thePlayer.IsHoldingItemInLHand ())
  1160.         {
  1161.             thePlayer.HideUsableItem( true );
  1162.             restoreUsableItemL = true;
  1163.         }
  1164.         if ( !b && restoreUsableItemL )
  1165.         {
  1166.             restoreUsableItemL = false;
  1167.            
  1168.             if ( !thePlayer.IsInCombat() )
  1169.             {
  1170.                 thePlayer.OnUseSelectedItem();
  1171.             }
  1172.         }
  1173.        
  1174.        
  1175.        
  1176.         if(!b && witcher)
  1177.         {
  1178.            
  1179.             if(!witcher.GetItemEquippedOnSlot(EES_Bolt, bolts) || witcher.inv.ItemHasTag(bolts, theGame.params.TAG_INFINITE_AMMO))         
  1180.                 witcher.AddAndEquipInfiniteBolt();
  1181.         }
  1182.     }
  1183.    
  1184.     public final function IsDialogOrCutscenePlaying() : bool
  1185.     {
  1186.         return isDialogOrCutscenePlaying;
  1187.     }
  1188.    
  1189.     public final function GetRecentDialogOrCutsceneEndGameTime() : GameTime
  1190.     {
  1191.         return recentDialogOrCutsceneEndGameTime;
  1192.     }
  1193.    
  1194.     public final function GetSavedEnchanterFunds() : int
  1195.     {
  1196.         return savedEnchanterFunds;
  1197.     }
  1198.  
  1199.     public final function SetSavedEnchanterFunds( value : int )
  1200.     {
  1201.         savedEnchanterFunds = value;
  1202.     }
  1203.  
  1204.    
  1205.     public function SetIsCutscenePlaying(b : bool)
  1206.     {
  1207.         isCutscenePlaying = b;
  1208.     }
  1209.    
  1210.    
  1211.    
  1212.    
  1213.    
  1214.      public function PopulateMenuQueueStartupOnce( out menus : array< name > )
  1215.     {
  1216.         menus.PushBack( 'StartupMoviesMenu' );
  1217.     }
  1218.    
  1219.      public function PopulateMenuQueueStartupAlways( out menus : array< name > )
  1220.     {
  1221.         var menuType : int;
  1222.        
  1223.         menuType = ChooseRandomMainMenuIfNotChosenYet();
  1224.         if (GetPlatform() != Platform_PC)
  1225.         {
  1226.             if ( theGame.GetDLCManager().IsEP2Available() )
  1227.             {
  1228.                 menus.PushBack( 'StartScreenMenuEP2' );
  1229.             }
  1230.             else if ( theGame.GetDLCManager().IsEP1Available() )
  1231.             {
  1232.                 menus.PushBack( 'StartScreenMenuEP1' );
  1233.             }
  1234.             else
  1235.             {
  1236.                 menus.PushBack( 'StartScreenMenu' );
  1237.                 case 1:
  1238.                     menus.PushBack( 'StartScreenMenuEP1' );
  1239.                     break;
  1240.                 case 2:
  1241.                     menus.PushBack( 'StartScreenMenuEP2' );
  1242.                     break;
  1243.                 case 0:
  1244.                 default:
  1245.                     menus.PushBack( 'StartScreenMenu' );
  1246.                     break;
  1247.             }
  1248.         }
  1249.     }
  1250.    
  1251.      public function PopulateMenuQueueConfig( out menus : array< name > )
  1252.     {
  1253.         var inGameConfigWrapper : CInGameConfigWrapper;
  1254.         inGameConfigWrapper = (CInGameConfigWrapper)theGame.GetInGameConfigWrapper();
  1255.        
  1256.         if( GetPlatform() != Platform_PC )
  1257.         {
  1258.             menus.PushBack( 'RescaleMenu' );
  1259.             menus.PushBack( 'MainGammaMenu' );
  1260.         }
  1261.     }
  1262.  
  1263.      public function PopulateMenuQueueMainOnce( out menus : array< name > )
  1264.     {
  1265.         if (GetPlatform() != Platform_PC)
  1266.         {
  1267.             menus.PushBack( 'AutosaveWarningMenu' );
  1268.         }
  1269.         menus.PushBack( 'RecapMoviesMenu' );
  1270.     }
  1271.    
  1272.      public function PopulateMenuQueueMainAlways( out menus : array< name > )
  1273.     {
  1274.         if (theGame.GetDLCManager().IsEP2Available())
  1275.         var menuType : int;
  1276.        
  1277.         menuType = ChooseRandomMainMenuIfNotChosenYet();
  1278.         switch ( menuType )
  1279.         {
  1280.             menus.PushBack( 'CommonMainMenuEP2' );
  1281.             case 1:
  1282.                 menus.PushBack( 'CommonMainMenuEP1' );
  1283.                 break;
  1284.             case 2:
  1285.                 menus.PushBack( 'CommonMainMenuEP2' );
  1286.                 break;
  1287.             case 0:
  1288.             default:
  1289.                 menus.PushBack( 'CommonMainMenu' );
  1290.                 break;
  1291.         }
  1292.     }
  1293.  
  1294.     private var _mainMenuType : int; default _mainMenuType = -1;
  1295.  
  1296.     public function GetChosenMainMenuType() : int
  1297.     {
  1298.         return _mainMenuType;
  1299.     }
  1300.    
  1301.     private function ChooseRandomMainMenuIfNotChosenYet() : int
  1302.     {
  1303.         var availableMainMenuTypes : array< int >;
  1304.         var seed : int;
  1305.         var index : int;
  1306.        
  1307.         if ( _mainMenuType > -1 )
  1308.         {
  1309.             return _mainMenuType;
  1310.         }
  1311.         else if (theGame.GetDLCManager().IsEP1Available())
  1312.        
  1313.         availableMainMenuTypes.PushBack( 0 );
  1314.        
  1315.         if (theGame.GetDLCManager().IsEP1Available())
  1316.         {
  1317.             menus.PushBack( 'CommonMainMenuEP1' );
  1318.         }
  1319.         else
  1320.         {
  1321.             menus.PushBack( 'CommonMainMenu' );
  1322.         }
  1323.  
  1324.         seed = CalcSeed( theGame );
  1325.         index = (int)RandNoiseF( seed, availableMainMenuTypes.Size() );
  1326.  
  1327.         //---=== modFriendlyHUD ===---
  1328.         _mainMenuType = ChooseMainMenuType(availableMainMenuTypes);
  1329.         //---=== modFriendlyHUD ===---
  1330.         LogChannel('asd', "RAND " + seed + "   " + index + "   " + _mainMenuType );
  1331.  
  1332.         return _mainMenuType;
  1333.     }
  1334.  
  1335.     public function GetNewGameDefinitionFilename() : string
  1336.     {
  1337.         return "game/witcher3.redgame";
  1338.     }
  1339.    
  1340.    
  1341.    
  1342.    
  1343.    
  1344.     public function GetCurrentZone() : EZoneName
  1345.     {
  1346.         return zoneName;
  1347.     }
  1348.    
  1349.     public function SetCurrentZone( tag : name )
  1350.     {
  1351.         zoneName = ZoneNameToType( tag );
  1352.     }
  1353.        
  1354.    
  1355.    
  1356.    
  1357.    
  1358.     private var uiHorizontalFrameScale : float; default uiHorizontalFrameScale              = 1.0;
  1359.     private var uiVerticalFrameScale : float;   default uiVerticalFrameScale                = 1.0;
  1360.     private var uiScale : float;                default uiScale                             = 1.0
  1361.     private var uiGamepadScaleGain : float;     default uiGamepadScaleGain                  = 0.0;
  1362.     private var uiOpacity : float;              default uiOpacity                           = 0.8;
  1363.    
  1364.    
  1365.     protected var isColorBlindMode:bool;
  1366.     public function getColorBlindMode():bool
  1367.     {
  1368.         return isColorBlindMode;
  1369.     }
  1370.     public function setColorBlindMode(value:bool)
  1371.     {
  1372.         isColorBlindMode = value;
  1373.     }
  1374.    
  1375.    
  1376.     private var menuToOpen : name;
  1377.     public function GetMenuToOpen() : name
  1378.     {
  1379.         return menuToOpen;
  1380.     }
  1381.     public function SetMenuToOpen( menu : name )
  1382.     {
  1383.         menuToOpen = menu;
  1384.     }
  1385.    
  1386.     public function RequestMenuWithBackground( menu : name, backgroundMenu : name, optional initData : IScriptable )
  1387.     {
  1388.         var commonMenu : CR4CommonMenu;
  1389.         var guiManager : CR4GuiManager;
  1390.        
  1391.         guiManager = GetGuiManager();
  1392.         commonMenu = (CR4CommonMenu)guiManager.GetRootMenu();
  1393.         if( commonMenu )
  1394.         {
  1395.             commonMenu.SwitchToSubMenu(menu,"");
  1396.         }
  1397.         else
  1398.         {
  1399.             if ( guiManager.IsAnyMenu() )
  1400.             {
  1401.                 guiManager.GetRootMenu().CloseMenu();
  1402.             }
  1403.            
  1404.             SetMenuToOpen( menu );
  1405.             theGame.RequestMenu( backgroundMenu, initData );
  1406.         }
  1407.     }
  1408.    
  1409.     public function OpenPopup(DataObject : W3PopupData) : void
  1410.     {
  1411.         theGame.RequestMenu('PopupMenu', DataObject);
  1412.     }
  1413.  
  1414.     public function SetUIVerticalFrameScale( value : float )
  1415.     {
  1416.         uiVerticalFrameScale = value;
  1417.     }
  1418.  
  1419.     public function GetUIVerticalFrameScale() : float
  1420.     {
  1421.         return uiVerticalFrameScale;
  1422.     }
  1423.  
  1424.     public function SetUIHorizontalFrameScale( value : float )
  1425.     {
  1426.         var horizontalPlusFrameScale : float;
  1427.         uiHorizontalFrameScale = value;
  1428.         horizontalPlusFrameScale = theGame.GetUIHorizontalPlusFrameScale();
  1429.         uiHorizontalFrameScale = uiHorizontalFrameScale * horizontalPlusFrameScale;
  1430.     }
  1431.    
  1432.     public function GetUIHorizontalFrameScale() : float
  1433.     {
  1434.         return uiHorizontalFrameScale;
  1435.     }
  1436.    
  1437.     public function SetUIScale( value : float )
  1438.     {
  1439.         uiScale = value;
  1440.     }
  1441.  
  1442.     public function GetUIScale() : float
  1443.     {
  1444.         return uiScale;
  1445.     }
  1446.  
  1447.     public function SetUIGamepadScaleGain( value : float )
  1448.     {
  1449.         uiGamepadScaleGain = value;
  1450.     }
  1451.  
  1452.     public function GetUIGamepadScaleGain() : float
  1453.     {
  1454.         return uiGamepadScaleGain;
  1455.     }
  1456.  
  1457.     public function SetDeathSaveLockId(i : int)
  1458.     {
  1459.         deathSaveLockId = i;
  1460.     }
  1461.    
  1462.     public function SetUIOpacity( value : float )
  1463.     {
  1464.         uiOpacity = value;
  1465.     }
  1466.  
  1467.     public function GetUIOpacity() : float
  1468.     {
  1469.         return uiOpacity;
  1470.     }
  1471.    
  1472.     public function setDialogDisplayDisabled( value : bool )
  1473.     {
  1474.         isDialogDisplayDisabled = value;
  1475.     }
  1476.  
  1477.     public function LoadHudSettings()
  1478.     {
  1479.         var inGameConfigWrapper : CInGameConfigWrapper;
  1480.        
  1481.         hudSettings = LoadCSV("gameplay\globals\hud_settings.csv");
  1482.            
  1483.         inGameConfigWrapper = (CInGameConfigWrapper)theGame.GetInGameConfigWrapper();
  1484.            
  1485.         isDialogDisplayDisabled = inGameConfigWrapper.GetVarValue('Localization', 'Subtitles') == "false";
  1486.            
  1487.         SetUIVerticalFrameScale( StringToFloat(inGameConfigWrapper.GetVarValue('Hidden', 'uiVerticalFrameScale')) );
  1488.         SetUIHorizontalFrameScale( StringToFloat(inGameConfigWrapper.GetVarValue('Hidden', 'uiHorizontalFrameScale')) );
  1489.            
  1490.         uiScale = StringToFloat(theGame.hudSettings.GetValueAt(1,theGame.hudSettings.GetRowIndexAt( 0, "uiScale" )));  
  1491.         uiOpacity = StringToFloat(theGame.hudSettings.GetValueAt(1,theGame.hudSettings.GetRowIndexAt( 0, "uiOpacity" )));  
  1492.     }
  1493.    
  1494.     event OnRefreshUIScaling()
  1495.     {
  1496.         var inGameConfigWrapper : CInGameConfigWrapper;
  1497.         inGameConfigWrapper = (CInGameConfigWrapper)theGame.GetInGameConfigWrapper();
  1498.         SetUIVerticalFrameScale( StringToFloat(inGameConfigWrapper.GetVarValue('Hidden', 'uiVerticalFrameScale')) );
  1499.         SetUIHorizontalFrameScale( StringToFloat(inGameConfigWrapper.GetVarValue('Hidden', 'uiHorizontalFrameScale')) );
  1500.     }
  1501.    
  1502.     event OnSpawnPlayerHorse( )
  1503.     {
  1504.         var createEntityHelper              : CR4CreateEntityHelper;
  1505.        
  1506.         thePlayer.RaiseEvent('HorseSummon');
  1507.        
  1508.         if( !thePlayer.GetHorseWithInventory()
  1509.             ||  !thePlayer.GetHorseWithInventory().IsAlive()
  1510.             ||  ( !thePlayer.WasVisibleInScaledFrame( thePlayer.GetHorseWithInventory(), 1.5f, 1.5f ) && VecDistanceSquared( thePlayer.GetWorldPosition(), thePlayer.GetHorseWithInventory().GetWorldPosition() ) > 900 )
  1511.             ||  VecDistanceSquared( thePlayer.GetWorldPosition(), thePlayer.GetHorseWithInventory().GetWorldPosition() ) > 1600 )
  1512.         {
  1513.             createEntityHelper = new CR4CreateEntityHelper in this;
  1514.             createEntityHelper.SetPostAttachedCallback( this, 'OnPlayerHorseSummoned' );
  1515.             theGame.SummonPlayerHorse( true, createEntityHelper );
  1516.         }
  1517.         else
  1518.         {
  1519.            
  1520.             thePlayer.GetHorseWithInventory().SignalGameplayEventParamObject( 'HorseSummon', thePlayer );
  1521.         }
  1522.        
  1523.         thePlayer.OnSpawnHorse();
  1524.     }
  1525.  
  1526.     private function OnPlayerHorseSummoned( horseEntity : CEntity )
  1527.     {
  1528.         var saddle          : SItemUniqueId;
  1529.         var horseManager    : W3HorseManager;
  1530.         var horse           : CActor;
  1531.  
  1532.        
  1533.         horseManager = GetWitcherPlayer().GetHorseManager();
  1534.         saddle = horseManager.GetItemInSlot(EES_HorseSaddle);
  1535.         if ( horseManager.GetInventoryComponent().GetItemName(saddle) == 'Devil Saddle' )
  1536.         {
  1537.            
  1538.             horse = (CActor)horseEntity;
  1539.             horse.AddEffectDefault(EET_WeakeningAura, horse, 'horse saddle', false);
  1540.         }
  1541.        
  1542.         thePlayer.GetHorseWithInventory().SignalGameplayEventParamObject( 'HorseSummon', thePlayer );
  1543.        
  1544.         GetWitcherPlayer().GetHorseManager().ApplyHorseUpdateOnSpawn();
  1545.     }
  1546.    
  1547.    
  1548.     event OnTutorialMessageForChoiceLines( flags : int )
  1549.     {
  1550.        
  1551.        
  1552.        
  1553.         GameplayFactsSet('dialog_choice_flags', flags);
  1554.         GameplayFactsAdd('dialog_choice_is_set', 1, 1);
  1555.     }
  1556.    
  1557.     event OnTutorialMessageForChoiceLineChosen( flags : int )
  1558.     {
  1559.         GameplayFactsSet('dialog_used_choice_flags', flags);
  1560.         GameplayFactsAdd('dialog_used_choice_is_set', 1, 1);
  1561.     }  
  1562.    
  1563.    
  1564.    
  1565.    
  1566.    
  1567.    
  1568.    
  1569.  
  1570.     public function GameplayFactsAdd(factName : string, optional value : int, optional realtimeSecsValidFor : int)
  1571.     {
  1572.         var idx : int;
  1573.         var newFact : SGameplayFact;
  1574.         var newFactRemoval : SGameplayFactRemoval;
  1575.        
  1576.         if(value < 0)
  1577.             return;
  1578.         else if(value == 0)
  1579.             value = 1;
  1580.            
  1581.         idx = GetGameplayFactIndex(factName);
  1582.         if(idx >= 0)
  1583.         {
  1584.             gameplayFacts[idx].value += value;
  1585.         }
  1586.         else
  1587.         {
  1588.             newFact.factName = factName;
  1589.             newFact.value = value;
  1590.             gameplayFacts.PushBack(newFact);
  1591.         }
  1592.        
  1593.         if(realtimeSecsValidFor > 0)
  1594.         {
  1595.             newFactRemoval.factName = factName;
  1596.             newFactRemoval.value = value;
  1597.             newFactRemoval.timerID = thePlayer.AddTimer('GameplayFactRemove', realtimeSecsValidFor, , , , true, false);
  1598.            
  1599.             gameplayFactsForRemoval.PushBack(newFactRemoval);
  1600.         }
  1601.     }
  1602.    
  1603.     public function GameplayFactsSet(factName : string, value : int)
  1604.     {
  1605.         var idx : int;
  1606.         var newFact : SGameplayFact;
  1607.        
  1608.         idx = GetGameplayFactIndex(factName);
  1609.         if(idx >= 0)
  1610.         {
  1611.             gameplayFacts[idx].value = value;
  1612.         }
  1613.         else
  1614.         {
  1615.             newFact.factName = factName;
  1616.             newFact.value = value;
  1617.             gameplayFacts.PushBack(newFact);
  1618.         }
  1619.     }
  1620.    
  1621.     public function GameplayFactsRemove(factName : string)
  1622.     {
  1623.         var i : int;
  1624.        
  1625.         for(i=0; i<gameplayFacts.Size(); i+=1)
  1626.         {
  1627.             if(gameplayFacts[i].factName == factName)
  1628.             {
  1629.                 gameplayFacts.EraseFast(i);
  1630.                 return;
  1631.             }
  1632.         }
  1633.     }
  1634.    
  1635.    
  1636.     public function GameplayFactRemoveFromTimer(timerID : int)
  1637.     {
  1638.         var idx, factIdx : int;
  1639.        
  1640.         idx = GetGameplayFactsForRemovalIndex(timerID);
  1641.         if(idx < 0)
  1642.         {
  1643.             LogAssert(false, "CR4Game.GameplayFactRemoveFromTimer: trying to process non-existant timer <<" + timerID + ">>");
  1644.             return;
  1645.         }
  1646.        
  1647.         factIdx = GetGameplayFactIndex(gameplayFactsForRemoval[idx].factName);
  1648.         if(factIdx < 0)                
  1649.             return;
  1650.        
  1651.         gameplayFacts[factIdx].value -= gameplayFactsForRemoval[idx].value;
  1652.         if(gameplayFacts[factIdx].value <= 0)
  1653.             gameplayFacts.EraseFast(factIdx);
  1654.            
  1655.         gameplayFactsForRemoval.EraseFast(idx);
  1656.     }
  1657.  
  1658.     public function GameplayFactsQuerySum(factName : string) : int
  1659.     {
  1660.         var idx : int;
  1661.        
  1662.         idx = GetGameplayFactIndex(factName);
  1663.         if(idx >= 0)       
  1664.             return gameplayFacts[idx].value;
  1665.            
  1666.         return 0;
  1667.     }
  1668.    
  1669.     private function GetGameplayFactIndex(factName : string) : int
  1670.     {
  1671.         var i : int;
  1672.        
  1673.         for(i=0; i<gameplayFacts.Size(); i+=1)
  1674.         {
  1675.             if(gameplayFacts[i].factName == factName)
  1676.                 return i;          
  1677.         }
  1678.        
  1679.         return -1;
  1680.     }
  1681.    
  1682.     private function GetGameplayFactsForRemovalIndex(timerID : int) : int
  1683.     {
  1684.         var i : int;
  1685.        
  1686.         for(i=0; i<gameplayFactsForRemoval.Size(); i+=1)
  1687.         {
  1688.             if(gameplayFactsForRemoval[i].timerID == timerID)
  1689.                 return i;          
  1690.         }
  1691.        
  1692.         return -1;
  1693.     }
  1694.    
  1695.     public function GetR4ReactionManager() : CR4ReactionManager
  1696.     {
  1697.         return ( CR4ReactionManager ) GetBehTreeReactionManager();
  1698.     }
  1699.        
  1700.     public function GetDifficultyMode() : EDifficultyMode
  1701.     {
  1702.         var diff : EDifficultyMode;
  1703.                
  1704.         diff = GetDifficultyLevel();
  1705.        
  1706.        
  1707.         if(diff == EDM_NotSet)
  1708.         {
  1709.             return EDM_Medium;
  1710.         }
  1711.        
  1712.         return diff;
  1713.     }
  1714.    
  1715.     event OnDifficultyChanged(newDifficulty : int)
  1716.     {
  1717.         var i : int;
  1718.         var lowestDiff : EDifficultyMode;
  1719.        
  1720.        
  1721.         if(!thePlayer)
  1722.         {
  1723.             diffChangePostponed = newDifficulty;
  1724.             return false;
  1725.         }
  1726.        
  1727.         theTelemetry.SetCommonStatI32(CS_DIFFICULTY_LVL, newDifficulty);
  1728.  
  1729.        
  1730.         lowestDiff = GetLowestDifficultyUsed();    
  1731.         if(lowestDiff != newDifficulty && MinDiffMode(lowestDiff, newDifficulty) == newDifficulty)
  1732.             SetLowestDifficultyUsed(newDifficulty);
  1733.            
  1734.         UpdateStatsForDifficultyLevel( GetSpawnDifficultyMode() );
  1735.     }
  1736.    
  1737.    
  1738.     public function OnPlayerChanged()
  1739.     {
  1740.         var i : int;
  1741.         var buffs : array<CBaseGameplayEffect>;
  1742.         var witcher : W3PlayerWitcher;
  1743.        
  1744.        
  1745.         thePlayer.RemoveAllNonAutoBuffs( , true );
  1746.        
  1747.        
  1748.         buffs = thePlayer.GetBuffs();
  1749.         for(i=0; i<buffs.Size(); i+=1)
  1750.         {
  1751.             buffs[i].ResumeForced();
  1752.         }
  1753.    
  1754.        
  1755.         GetGameCamera().StopEffect( 'frost' );
  1756.         DisableCatViewFx( 1.0f );
  1757.         thePlayer.StopEffect('critical_low_health');
  1758.         DisableDrunkFx();
  1759.         thePlayer.StopEffect('critical_toxicity');
  1760.        
  1761.         if(GetWitcherPlayer())
  1762.             GetWitcherPlayer().UpdateEncumbrance();
  1763.    
  1764.        
  1765.        
  1766.         UpdateStatsForDifficultyLevel( GetSpawnDifficultyMode() );
  1767.        
  1768.        
  1769.         RemoveAllTimeScales();
  1770.     }
  1771.    
  1772.    
  1773.    
  1774.     public function GetSpawnDifficultyMode() : EDifficultyMode
  1775.     {
  1776.         if( thePlayer && thePlayer.IsCiri() )
  1777.         {
  1778.             return MinDiffMode( GetDifficultyMode(), EDM_Medium );
  1779.         }
  1780.         return GetDifficultyMode();
  1781.     }
  1782.    
  1783.     public function UpdateStatsForDifficultyLevel( difficulty : EDifficultyMode )
  1784.     {
  1785.         var i : int;
  1786.         var actor : CActor;
  1787.         var npcs : array< CNewNPC >;
  1788.         GetAllNPCs( npcs );
  1789.         for( i=0; i < npcs.Size(); i+=1 )
  1790.         {
  1791.             actor = (CActor)npcs[i];
  1792.             if( actor )
  1793.             {
  1794.                 actor.UpdateStatsForDifficultyLevel( difficulty );
  1795.             }
  1796.         }
  1797.     }
  1798.  
  1799.     public function CanTrackQuest( questEntry : CJournalQuest ) : bool
  1800.     {
  1801.         var questName : string;
  1802.         var baseName : string;
  1803.         var i : int;
  1804.         var questCount : int;
  1805.         var playerLevel : int;
  1806.         var questLevel : int;
  1807.         var questLevels : C2dArray;
  1808.         var questLevelsCount : int;
  1809.         var iterQuestLevels : int;
  1810.        
  1811.         baseName = questEntry.baseName;
  1812.         playerLevel = thePlayer.GetLevel();
  1813.  
  1814.         if ( questEntry.GetType() == MonsterHunt )
  1815.         {
  1816.             questLevelsCount = theGame.questLevelsContainer.Size();
  1817.             for( iterQuestLevels = 0; iterQuestLevels < questLevelsCount; iterQuestLevels += 1 )
  1818.             {
  1819.                 questLevels = theGame.questLevelsContainer[iterQuestLevels];
  1820.            
  1821.                 questCount = questLevels.GetNumRows();
  1822.                 for( i = 0; i < questCount; i += 1 )
  1823.                 {
  1824.                         questName  = questLevels.GetValueAtAsName( 0, i );
  1825.                     if ( questName == baseName )
  1826.                     {
  1827.                             questLevel  = NameToInt( questLevels.GetValueAtAsName( 1, i ) );
  1828.                         return playerLevel >= questLevel - 5;
  1829.                     }
  1830.                 }
  1831.             }
  1832.         }
  1833.         return true;
  1834.     }
  1835.    
  1836.     import final function GetGwintManager() : CR4GwintManager;
  1837.    
  1838.     public function IsBlackscreenOrFading() : bool
  1839.     {
  1840.         return IsBlackscreen() || IsFading();
  1841.     }
  1842.        
  1843.    
  1844.    
  1845.    
  1846.  
  1847.     var postponedPreAttackEvents : array< SPostponedPreAttackEvent >;
  1848.    
  1849.     event OnPreAttackEvent( entity : CGameplayEntity, animEventName : name, animEventType : EAnimationEventType, data : CPreAttackEventData, animInfo : SAnimationEventAnimInfo )
  1850.     {
  1851.         var postponedPreAttackEvent : SPostponedPreAttackEvent;
  1852.        
  1853.         postponedPreAttackEvent.entity      = entity;
  1854.         postponedPreAttackEvent.eventName   = animEventName;
  1855.         postponedPreAttackEvent.eventType   = animEventType;
  1856.         postponedPreAttackEvent.data        = data;
  1857.         postponedPreAttackEvent.animInfo    = animInfo;
  1858.        
  1859.         postponedPreAttackEvents.PushBack( postponedPreAttackEvent );
  1860.     }
  1861.  
  1862.     function FirePostponedPreAttackEvents()
  1863.     {
  1864.         var i, size : int;
  1865.         var entity : CGameplayEntity;
  1866.        
  1867.         size = postponedPreAttackEvents.Size();
  1868.         for ( i = 0; i < size; i+=1 )
  1869.         {
  1870.             entity = postponedPreAttackEvents[i].entity;
  1871.             if ( entity )
  1872.             {
  1873.                 entity.OnPreAttackEvent( postponedPreAttackEvents[i].eventName,
  1874.                                          postponedPreAttackEvents[i].eventType,
  1875.                                          postponedPreAttackEvents[i].data,
  1876.                                          postponedPreAttackEvents[i].animInfo );
  1877.             }
  1878.         }
  1879.         postponedPreAttackEvents.Clear();
  1880.     }
  1881.    
  1882.     public final function AddDynamicallySpawnedBoatHandle(handle : EntityHandle)
  1883.     {
  1884.         var i : int;
  1885.        
  1886.         if(EntityHandleGet(handle))
  1887.         {          
  1888.             dynamicallySpawnedBoats.PushBack(handle);
  1889.            
  1890.             if(dynamicallySpawnedBoats.Size() >= theGame.params.MAX_DYNAMICALLY_SPAWNED_BOATS)
  1891.             {
  1892.                
  1893.                 for(i=dynamicallySpawnedBoatsToDestroy.Size()-1; i>=0; i-=1)
  1894.                 {
  1895.                     if(!EntityHandleGet(dynamicallySpawnedBoats[i]))
  1896.                         dynamicallySpawnedBoats.EraseFast(i);
  1897.                 }
  1898.            
  1899.                 if(dynamicallySpawnedBoats.Size() >= theGame.params.MAX_DYNAMICALLY_SPAWNED_BOATS)
  1900.                 {
  1901.                     dynamicallySpawnedBoatsToDestroy.PushBack( dynamicallySpawnedBoats[0] );
  1902.                     dynamicallySpawnedBoats.Erase(0);
  1903.                 }
  1904.             }
  1905.         }
  1906.     }
  1907.    
  1908.     public final function IsBoatMarkedForDestroy(boat : W3Boat) : bool
  1909.     {
  1910.         var handle : EntityHandle;
  1911.         var i : int;
  1912.        
  1913.         EntityHandleSet(handle, boat);
  1914.         for(i=0; i<dynamicallySpawnedBoatsToDestroy.Size(); i+=1)
  1915.         {
  1916.             if(handle == dynamicallySpawnedBoatsToDestroy[i])
  1917.             {
  1918.                 dynamicallySpawnedBoatsToDestroy.EraseFast(i);
  1919.                 return true;
  1920.             }
  1921.         }
  1922.        
  1923.         return false;
  1924.     }
  1925.  
  1926.     public final function VibrateControllerVeryLight(optional duration : float)
  1927.     {
  1928.         if ( !theInput.LastUsedGamepad() )
  1929.             return;
  1930.            
  1931.         if(duration == 0)
  1932.             duration = 0.15f;
  1933.            
  1934.         if(IsSpecificRumbleActive(0.2, 0))
  1935.         {
  1936.             OverrideRumbleDuration(0.2, 0, duration);
  1937.         }
  1938.         else
  1939.         {
  1940.             VibrateController(0.2, 0, duration);
  1941.         }
  1942.     }
  1943.    
  1944.     public final function VibrateControllerLight(optional duration : float)
  1945.     {
  1946.         if ( !theInput.LastUsedGamepad() )
  1947.             return;
  1948.            
  1949.         if(duration == 0)
  1950.             duration = 0.2f;
  1951.            
  1952.         if(IsSpecificRumbleActive(0.5, 0))
  1953.         {
  1954.             OverrideRumbleDuration(0.5, 0, duration);
  1955.         }
  1956.         else
  1957.         {
  1958.             VibrateController(0.5, 0, duration);
  1959.         }
  1960.     }
  1961.    
  1962.     public final function VibrateControllerHard(optional duration : float)
  1963.     {
  1964.         if ( !theInput.LastUsedGamepad() )
  1965.             return;
  1966.            
  1967.         if(duration == 0)
  1968.             duration = 0.2f;
  1969.        
  1970.         if(IsSpecificRumbleActive(0.75, 0.75))
  1971.         {
  1972.             OverrideRumbleDuration(0.75, 0.75, duration);
  1973.         }
  1974.         else
  1975.         {
  1976.             VibrateController(0.75, 0.75, duration);
  1977.         }
  1978.     }
  1979.    
  1980.     public final function VibrateControllerVeryHard(optional duration : float)
  1981.     {
  1982.         if ( !theInput.LastUsedGamepad() )
  1983.             return;
  1984.            
  1985.         if(duration == 0)
  1986.             duration = 0.5f;
  1987.        
  1988.         if(IsSpecificRumbleActive(1, 1))
  1989.         {
  1990.             OverrideRumbleDuration(1, 1, duration);
  1991.         }
  1992.         else
  1993.         {
  1994.             VibrateController(1, 1, duration);
  1995.         }
  1996.     }
  1997.     import public final function GetWorldDLCExtender() : CR4WorldDLCExtender;
  1998.    
  1999.     public function GetMiniMapSize( areaType : int ) : float
  2000.     {
  2001.         var mapSize  : float;
  2002.         var valueAsString : string;
  2003.        
  2004.         valueAsString = minimapSettings.GetValueAt( 1, areaType );
  2005.        
  2006.         if( StrLen( valueAsString ) != 0 )
  2007.         {
  2008.             mapSize = StringToFloat( valueAsString );
  2009.         }
  2010.         else
  2011.         {
  2012.             mapSize = GetWorldDLCExtender().GetMiniMapSize( areaType );
  2013.         }
  2014.         return mapSize;
  2015.     }
  2016.    
  2017.     public function GetMiniMapTileCount( areaType : int ) : int
  2018.     {
  2019.         var tileCount  : int;
  2020.         var valueAsString : string;
  2021.        
  2022.         valueAsString = minimapSettings.GetValueAt( 2, areaType );
  2023.        
  2024.         if( StrLen( valueAsString ) != 0 )
  2025.         {
  2026.             tileCount = StringToInt( valueAsString );
  2027.         }
  2028.         else
  2029.         {
  2030.             tileCount = GetWorldDLCExtender().GetMiniMapTileCount( areaType );
  2031.         }
  2032.         return tileCount;
  2033.     }
  2034.    
  2035.     public function GetMiniMapExteriorTextureSize( areaType : int ) : int
  2036.     {
  2037.         var exteriorTextureSize  : int;
  2038.         var valueAsString : string;
  2039.        
  2040.         valueAsString = minimapSettings.GetValueAt( 3, areaType );
  2041.        
  2042.         if( StrLen( valueAsString ) != 0 )
  2043.         {
  2044.             exteriorTextureSize = StringToInt( valueAsString );
  2045.         }
  2046.         else
  2047.         {
  2048.             exteriorTextureSize = GetWorldDLCExtender().GetMiniMapExteriorTextureSize( areaType );
  2049.         }
  2050.         return exteriorTextureSize;
  2051.     }
  2052.    
  2053.        
  2054.     public function GetMiniMapInteriorTextureSize( areaType : int ) : int
  2055.     {
  2056.         var interiorTextureSize  : int;
  2057.         var valueAsString : string;
  2058.        
  2059.         valueAsString = minimapSettings.GetValueAt( 4, areaType );
  2060.        
  2061.         if( StrLen( valueAsString ) != 0 )
  2062.         {
  2063.             interiorTextureSize = StringToInt( valueAsString );
  2064.         }
  2065.         else
  2066.         {
  2067.             interiorTextureSize = GetWorldDLCExtender().GetMiniMapInteriorTextureSize( areaType );
  2068.         }
  2069.         return interiorTextureSize;
  2070.     }
  2071.    
  2072.     public function GetMiniMapTextureSize( areaType : int ) : int
  2073.     {
  2074.         var textureSize  : int;
  2075.         var valueAsString : string;
  2076.        
  2077.         valueAsString = minimapSettings.GetValueAt( 5, areaType );
  2078.        
  2079.         if( StrLen( valueAsString ) != 0 )
  2080.         {
  2081.             textureSize = StringToInt( valueAsString );
  2082.         }
  2083.         else
  2084.         {
  2085.             textureSize = GetWorldDLCExtender().GetMiniMapTextureSize( areaType );
  2086.         }
  2087.         return textureSize;
  2088.     }
  2089.    
  2090.     public function GetMiniMapMinLod( areaType : int ) : int
  2091.     {
  2092.         var minLod  : int;
  2093.         var valueAsString : string;
  2094.        
  2095.         valueAsString = minimapSettings.GetValueAt( 6, areaType );
  2096.        
  2097.         if( StrLen( valueAsString ) != 0 )
  2098.         {
  2099.             minLod = StringToInt( valueAsString );
  2100.         }
  2101.         else
  2102.         {
  2103.             minLod = GetWorldDLCExtender().GetMiniMapMinLod( areaType );
  2104.         }
  2105.         return minLod;
  2106.     }
  2107.    
  2108.     public function GetMiniMapMaxLod( areaType : int ) : int
  2109.     {
  2110.         var maxLod  : int;
  2111.         var valueAsString : string;
  2112.        
  2113.         valueAsString = minimapSettings.GetValueAt( 7, areaType );
  2114.        
  2115.         if( StrLen( valueAsString ) != 0 )
  2116.         {
  2117.             maxLod = StringToInt( valueAsString );
  2118.         }
  2119.         else
  2120.         {
  2121.             maxLod = GetWorldDLCExtender().GetMiniMapMaxLod( areaType );
  2122.         }
  2123.         return maxLod;
  2124.     }
  2125.  
  2126.    
  2127.     public function GetMiniMapExteriorTextureExtension( areaType : int ) : string
  2128.     {
  2129.         var exteriorTextureExtension  : string;
  2130.         var valueAsString : string;
  2131.        
  2132.         valueAsString = minimapSettings.GetValueAt( 8, areaType );
  2133.        
  2134.         if( StrLen( valueAsString ) != 0 )
  2135.         {
  2136.             exteriorTextureExtension = ExtractStringFromCSV( valueAsString );
  2137.         }
  2138.         else
  2139.         {
  2140.             exteriorTextureExtension = GetWorldDLCExtender().GetMiniMapExteriorTextureExtension( areaType );
  2141.         }
  2142.         return exteriorTextureExtension;
  2143.     }
  2144.    
  2145.     public function GetMiniMapInteriorTextureExtension( areaType : int ) : string
  2146.     {
  2147.         var interiorTextureExtension  : string;
  2148.         var valueAsString : string;
  2149.        
  2150.         valueAsString = minimapSettings.GetValueAt( 9, areaType );
  2151.        
  2152.         if( StrLen( valueAsString ) != 0 )
  2153.         {
  2154.             interiorTextureExtension = ExtractStringFromCSV( valueAsString );
  2155.         }
  2156.         else
  2157.         {
  2158.             interiorTextureExtension = GetWorldDLCExtender().GetMiniMapInteriorTextureExtension( areaType );
  2159.         }
  2160.         return interiorTextureExtension;
  2161.     }
  2162.    
  2163.     public function GetMiniMapVminX( areaType : int ) : int
  2164.     {
  2165.         var vminX  : int;
  2166.         var valueAsString : string;
  2167.        
  2168.         valueAsString = minimapSettings.GetValueAt( 11, areaType );
  2169.        
  2170.         if( StrLen( valueAsString ) != 0 )
  2171.         {
  2172.             vminX = StringToInt( valueAsString );
  2173.         }
  2174.         else
  2175.         {
  2176.             vminX = GetWorldDLCExtender().GetMiniMapVminX( areaType );
  2177.         }
  2178.         return vminX;
  2179.     }
  2180.    
  2181.     public function GetMiniMapVmaxX( areaType : int ) : int
  2182.     {
  2183.         var vmaxX  : int;
  2184.         var valueAsString : string;
  2185.        
  2186.         valueAsString = minimapSettings.GetValueAt( 12, areaType );
  2187.        
  2188.         if( StrLen( valueAsString ) != 0 )
  2189.         {
  2190.             vmaxX = StringToInt( valueAsString );
  2191.         }
  2192.         else
  2193.         {
  2194.             vmaxX = GetWorldDLCExtender().GetMiniMapVmaxX( areaType );
  2195.         }
  2196.         return vmaxX;
  2197.     }
  2198.    
  2199.     public function GetMiniMapVminY( areaType : int ) : int
  2200.     {
  2201.         var vminY  : int;
  2202.         var valueAsString : string;
  2203.        
  2204.         valueAsString = minimapSettings.GetValueAt( 13, areaType );
  2205.        
  2206.         if( StrLen( valueAsString ) != 0 )
  2207.         {
  2208.             vminY = StringToInt( valueAsString );
  2209.         }
  2210.         else
  2211.         {
  2212.             vminY = GetWorldDLCExtender().GetMiniMapVminY( areaType );
  2213.         }
  2214.         return vminY;
  2215.     }
  2216.    
  2217.     public function GetMiniMapVmaxY( areaType : int ) : int
  2218.     {
  2219.         var vmaxY  : int;
  2220.         var valueAsString : string;
  2221.        
  2222.         valueAsString = minimapSettings.GetValueAt( 14, areaType );
  2223.        
  2224.         if( StrLen( valueAsString ) != 0 )
  2225.         {
  2226.             vmaxY = StringToInt( valueAsString );
  2227.         }
  2228.         else
  2229.         {
  2230.             vmaxY = GetWorldDLCExtender().GetMiniMapVmaxY( areaType );
  2231.         }
  2232.         return vmaxY;
  2233.     }
  2234.    
  2235.     public function GetMiniMapSminX( areaType : int ) : int
  2236.     {
  2237.         var sminX  : int;
  2238.         var valueAsString : string;
  2239.        
  2240.         valueAsString = minimapSettings.GetValueAt( 15, areaType );
  2241.        
  2242.         if( StrLen( valueAsString ) != 0 )
  2243.         {
  2244.             sminX = StringToInt( valueAsString );
  2245.         }
  2246.         else
  2247.         {
  2248.             sminX = GetWorldDLCExtender().GetMiniMapSminX( areaType );
  2249.         }
  2250.         return sminX;
  2251.     }
  2252.    
  2253.     public function GetMiniMapSmaxX( areaType : int ) : int
  2254.     {
  2255.         var smaxX  : int;
  2256.         var valueAsString : string;
  2257.        
  2258.         valueAsString = minimapSettings.GetValueAt( 16, areaType );
  2259.        
  2260.         if( StrLen( valueAsString ) != 0 )
  2261.         {
  2262.             smaxX = StringToInt( valueAsString );
  2263.         }
  2264.         else
  2265.         {
  2266.             smaxX = GetWorldDLCExtender().GetMiniMapSmaxX( areaType );
  2267.         }
  2268.         return smaxX;
  2269.     }
  2270.    
  2271.     public function GetMiniMapSminY( areaType : int ) : int
  2272.     {
  2273.         var sminY  : int;
  2274.         var valueAsString : string;
  2275.        
  2276.         valueAsString = minimapSettings.GetValueAt( 17, areaType );
  2277.        
  2278.         if( StrLen( valueAsString ) != 0 )
  2279.         {
  2280.             sminY = StringToInt( valueAsString );
  2281.         }
  2282.         else
  2283.         {
  2284.             sminY = GetWorldDLCExtender().GetMiniMapSminY( areaType );
  2285.         }
  2286.         return sminY;
  2287.     }
  2288.    
  2289.     public function GetMiniMapSmaxY( areaType : int ) : int
  2290.     {
  2291.         var smaxY  : int;
  2292.         var valueAsString : string;
  2293.        
  2294.         valueAsString = minimapSettings.GetValueAt( 18, areaType );
  2295.        
  2296.         if( StrLen( valueAsString ) != 0 )
  2297.         {
  2298.             smaxY = StringToInt( valueAsString );
  2299.         }
  2300.         else
  2301.         {
  2302.             smaxY = GetWorldDLCExtender().GetMiniMapSmaxY( areaType );
  2303.         }
  2304.         return smaxY;
  2305.     }
  2306.    
  2307.     public function GetMiniMapMinZoom( areaType : int ) : float
  2308.     {
  2309.         var minZoom  : float;
  2310.         var valueAsString : string;
  2311.        
  2312.         valueAsString = minimapSettings.GetValueAt( 19, areaType );
  2313.        
  2314.         if( StrLen( valueAsString ) != 0 )
  2315.         {
  2316.             minZoom = StringToFloat( valueAsString );
  2317.         }
  2318.         else
  2319.         {
  2320.             minZoom = GetWorldDLCExtender().GetMiniMapMinZoom( areaType );
  2321.         }
  2322.         return minZoom;
  2323.     }
  2324.    
  2325.     public function GetMiniMapMaxZoom( areaType : int ) : float
  2326.     {
  2327.         var maxZoom  : float;
  2328.         var valueAsString : string;
  2329.        
  2330.         valueAsString = minimapSettings.GetValueAt( 20, areaType );
  2331.        
  2332.         if( StrLen( valueAsString ) != 0 )
  2333.         {
  2334.             maxZoom = StringToFloat( valueAsString );
  2335.         }
  2336.         else
  2337.         {
  2338.             maxZoom = GetWorldDLCExtender().GetMiniMapMaxZoom( areaType );
  2339.         }
  2340.         return maxZoom;
  2341.     }
  2342.    
  2343.     public function GetMiniMapZoom12( areaType : int ) : float
  2344.     {
  2345.         var zoom12  : float;
  2346.         var valueAsString : string;
  2347.        
  2348.         valueAsString = minimapSettings.GetValueAt( 21, areaType );
  2349.        
  2350.         if( StrLen( valueAsString ) != 0 )
  2351.         {
  2352.             zoom12 = StringToFloat( valueAsString );
  2353.         }
  2354.         else
  2355.         {
  2356.             zoom12 = GetWorldDLCExtender().GetMiniMapZoom12( areaType );
  2357.         }
  2358.         return zoom12;
  2359.     }
  2360.    
  2361.     public function GetMiniMapZoom23( areaType : int ) : float
  2362.     {
  2363.         var zoom23  : float;
  2364.         var valueAsString : string;
  2365.        
  2366.         valueAsString = minimapSettings.GetValueAt( 22, areaType );
  2367.        
  2368.         if( StrLen( valueAsString ) != 0 )
  2369.         {
  2370.             zoom23 = StringToFloat( valueAsString );
  2371.         }
  2372.         else
  2373.         {
  2374.             zoom23 = GetWorldDLCExtender().GetMiniMapZoom23( areaType );
  2375.         }
  2376.         return zoom23;
  2377.     }
  2378.    
  2379.     public function GetMiniMapZoom34( areaType : int ) : float
  2380.     {
  2381.         var zoom34  : float;
  2382.         var valueAsString : string;
  2383.        
  2384.         valueAsString = minimapSettings.GetValueAt( 23, areaType );
  2385.        
  2386.         if( StrLen( valueAsString ) != 0 )
  2387.         {
  2388.             zoom34 = StringToFloat( valueAsString );
  2389.         }
  2390.         else
  2391.         {
  2392.             zoom34 = GetWorldDLCExtender().GetMiniMapZoom34( areaType );
  2393.         }
  2394.         return zoom34;
  2395.     }
  2396.    
  2397.     public function GetGradientScale( areaType : int ) : float
  2398.     {
  2399.         var scale  : float;
  2400.         var valueAsString : string;
  2401.        
  2402.         valueAsString = minimapSettings.GetValueAt( 24, areaType );
  2403.        
  2404.         if( StrLen( valueAsString ) != 0 )
  2405.         {
  2406.             scale = StringToFloat( valueAsString );
  2407.         }
  2408.         else
  2409.         {
  2410.             scale = GetWorldDLCExtender().GetGradientScale( areaType );
  2411.         }
  2412.         return scale;
  2413.     }
  2414.    
  2415.     public function GetPreviewHeight( areaType : int ) : float
  2416.     {
  2417.         var height  : float;
  2418.         var valueAsString : string;
  2419.        
  2420.         valueAsString = minimapSettings.GetValueAt( 25, areaType );
  2421.        
  2422.         if( StrLen( valueAsString ) != 0 )
  2423.         {
  2424.             height = StringToFloat( valueAsString );
  2425.         }
  2426.         else
  2427.         {
  2428.             height = GetWorldDLCExtender().GetPreviewHeight( areaType );
  2429.         }
  2430.         return height;
  2431.     }
  2432.  
  2433.     private function UnlockMissedAchievements()
  2434.     {
  2435.         var manager : CCommonMapManager = theGame.GetCommonMapManager();   
  2436.         if ( manager )
  2437.         {
  2438.             manager.CheckExplorerAchievement();
  2439.         }
  2440.  
  2441.         GetWitcherPlayer().CheckForFullyArmedAchievement();
  2442.         GetGamerProfile().CheckProgressOfAllStats();
  2443.         if (FactsDoesExist("witcher3_game_finished"))
  2444.         {
  2445.             Achievement_FinishedGame();
  2446.         }
  2447.     }
  2448.    
  2449.     public final function MutationHUDFeedback( type : EMutationFeedbackType )
  2450.     {
  2451.         var hud : CR4ScriptedHud;
  2452.         var hudWolfHeadModule : CR4HudModuleWolfHead;      
  2453.  
  2454.         hud = (CR4ScriptedHud)GetHud();
  2455.         if ( hud )
  2456.         {
  2457.             hudWolfHeadModule = (CR4HudModuleWolfHead)hud.GetHudModule( "WolfHeadModule" );
  2458.             if ( hudWolfHeadModule )
  2459.             {
  2460.                 hudWolfHeadModule.DisplayMutationFeedback( type );
  2461.             }
  2462.         }
  2463.     }
  2464. }
  2465.  
  2466. function hasSaveDataToLoad():bool
  2467. {
  2468.     var currentSave : SSavegameInfo;
  2469.     var saveGames   : array< SSavegameInfo >;
  2470.    
  2471.     theGame.ListSavedGames( saveGames );
  2472.     if ( saveGames.Size() > 0 )
  2473.     {
  2474.         return true;
  2475.     }
  2476.    
  2477.     return false;
  2478. }
  2479.  
  2480. exec function EnableLog( enable : bool )
  2481. {
  2482.     theGame.EnableLog( enable );
  2483. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement