Advertisement
Guest User

Untitled

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