Advertisement
Guest User

Untitled

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