Advertisement
Guest User

r4Game

a guest
Oct 1st, 2017
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 63.92 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. private function ChooseRandomMainMenuIfNotChosenYet() : int
  1343. {
  1344. for(i=0; i < availableMainMenuTypes.Size(); i+=1)
  1345. {
  1346. if (availableMainMenuTypes[ i ] == index)
  1347. {
  1348. break;
  1349. {
  1350. return _mainMenuType;
  1351. }
  1352.  
  1353. availableMainMenuTypes.PushBack( 0 );
  1354.  
  1355. if (theGame.GetDLCManager().IsEP1Available())
  1356. {
  1357. availableMainMenuTypes.PushBack( 1 );
  1358. }
  1359. if (theGame.GetDLCManager().IsEP2Available())
  1360. {
  1361. availableMainMenuTypes.PushBack( 2 );
  1362. }
  1363.  
  1364. seed = CalcSeed( theGame );
  1365. index = (int)RandNoiseF( seed, availableMainMenuTypes.Size() );
  1366.  
  1367. _mainMenuType = availableMainMenuTypes[ index ];
  1368. LogChannel('asd', "RAND " + seed + " " + index + " " + _mainMenuType );
  1369.  
  1370. return _mainMenuType;
  1371. }
  1372. if (i < availableMainMenuTypes.Size()) {
  1373. index = i;
  1374. }
  1375. else
  1376. private function ChooseRandomMainMenuIfNotChosenYet() : int
  1377. {
  1378. index = availableMainMenuTypes.Size() - 1;
  1379. }
  1380.  
  1381. LogChannel('killduke', "i " + i);
  1382. if ( _mainMenuType > -1 )
  1383. {
  1384. return _mainMenuType;
  1385. }
  1386.  
  1387. availableMainMenuTypes.PushBack( 0 );
  1388.  
  1389. if (theGame.GetDLCManager().IsEP1Available())
  1390. {
  1391. availableMainMenuTypes.PushBack( 1 );
  1392. }
  1393. if (theGame.GetDLCManager().IsEP2Available())
  1394. {
  1395. availableMainMenuTypes.PushBack( 2 );
  1396. }
  1397.  
  1398. seed = CalcSeed( theGame );
  1399. index = (int)RandNoiseF( seed, availableMainMenuTypes.Size() );
  1400.  
  1401. _mainMenuType = availableMainMenuTypes[ index ];
  1402. LogChannel('asd', "RAND " + seed + " " + index + " " + _mainMenuType );
  1403.  
  1404. return _mainMenuType;
  1405. }
  1406. else
  1407. {
  1408. index = availableMainMenuTypes.Size() - 1;
  1409. }
  1410.  
  1411. LogChannel('killduke', "index " + index);
  1412.  
  1413. _mainMenuType = availableMainMenuTypes[ index ];
  1414.  
  1415. return _mainMenuType;
  1416. }
  1417.  
  1418. public function GetModMainMenuAnimationToggle() : bool
  1419. {
  1420. var conf: CInGameConfigWrapper;
  1421. var value: bool;
  1422.  
  1423. conf = theGame.GetInGameConfigWrapper();
  1424.  
  1425. // groupid, varid
  1426. value = conf.GetVarValue('modMainMenuAnimationSelector', 'modMainMenuAnimationSelector_toggle1_id');
  1427.  
  1428. //GetWitcherPlayer().DisplayHudMessage("currently set modMainMenuAnimation_toggle1_id value: " + value);
  1429. LogChannel('killduke', "GetModMainMenuAnimationToggle " + value);
  1430.  
  1431.  
  1432. return value;
  1433. }
  1434.  
  1435. private function GetModMainMenuAnimationType() : int
  1436. {
  1437. var conf: CInGameConfigWrapper;
  1438. var value: String;
  1439.  
  1440. conf = theGame.GetInGameConfigWrapper();
  1441.  
  1442. // groupid, varid
  1443. value = conf.GetVarValue('modMainMenuAnimationSelector', 'modMainMenuAnimationSelector_option1_id');
  1444.  
  1445. //GetWitcherPlayer().DisplayHudMessage("currently set modMainMenuAnimation_option1_id value: " + value);
  1446. LogChannel('killduke', "GetModMainMenuAnimationType " + value);
  1447.  
  1448. return StringToInt(value) - 1;
  1449. }
  1450.  
  1451. public function GetModMainMenuMusicType() : int
  1452. {
  1453. var conf: CInGameConfigWrapper;
  1454. var value: String;
  1455. var retValue: int;
  1456.  
  1457. conf = theGame.GetInGameConfigWrapper();
  1458.  
  1459. // groupid, varid
  1460. value = conf.GetVarValue('modMainMenuAnimationSelector', 'modMainMenuAnimationSelector_option2_id');
  1461.  
  1462. //GetWitcherPlayer().DisplayHudMessage("currently set modMainMenuAnimation_option1_id value: " + value);
  1463. LogChannel('killduke', "GetModMainMenuMusicType " + value);
  1464.  
  1465. retValue = StringToInt(value) - 1;
  1466. if (!theGame.GetDLCManager().IsEP1Available() && retValue == 1 ||
  1467. !theGame.GetDLCManager().IsEP2Available() && retValue == 2)
  1468. {
  1469. retValue = 0;
  1470. }
  1471.  
  1472. return retValue;
  1473. }
  1474.  
  1475. public function GetModMainMenuConsoleLikeToggle() : bool
  1476. {
  1477. var conf: CInGameConfigWrapper;
  1478. var value: bool;
  1479.  
  1480. conf = theGame.GetInGameConfigWrapper();
  1481.  
  1482. // groupid, varid
  1483. value = conf.GetVarValue('modMainMenuAnimationSelector', 'modMainMenuAnimationSelector_toggle2_id');
  1484.  
  1485. //GetWitcherPlayer().DisplayHudMessage("currently set modMainMenuAnimation_toggle1_id value: " + value);
  1486. LogChannel('killduke', "GetModMainMenuConsoleLikeToggle " + value);
  1487.  
  1488.  
  1489. return value;
  1490. }
  1491.  
  1492.  
  1493. public function GetNewGameDefinitionFilename() : string
  1494. {
  1495. return "game/witcher3.redgame";
  1496. }
  1497.  
  1498.  
  1499.  
  1500.  
  1501.  
  1502. public function GetCurrentZone() : EZoneName
  1503. {
  1504. return zoneName;
  1505. }
  1506.  
  1507. public function SetCurrentZone( tag : name )
  1508. {
  1509. zoneName = ZoneNameToType( tag );
  1510. }
  1511.  
  1512.  
  1513.  
  1514.  
  1515.  
  1516. private var uiHorizontalFrameScale : float; default uiHorizontalFrameScale = 1.0;
  1517. private var uiVerticalFrameScale : float; default uiVerticalFrameScale = 1.0;
  1518. private var uiScale : float; default uiScale = 1.0;
  1519. private var uiGamepadScaleGain : float; default uiGamepadScaleGain = 0.0;
  1520. private var uiOpacity : float; default uiOpacity = 0.8;
  1521.  
  1522.  
  1523. protected var isColorBlindMode:bool;
  1524. public function getColorBlindMode():bool
  1525. {
  1526. return isColorBlindMode;
  1527. }
  1528. public function setColorBlindMode(value:bool)
  1529. {
  1530. isColorBlindMode = value;
  1531. }
  1532.  
  1533.  
  1534. private var menuToOpen : name;
  1535. public function GetMenuToOpen() : name
  1536. {
  1537. return menuToOpen;
  1538. }
  1539. public function SetMenuToOpen( menu : name )
  1540. {
  1541. menuToOpen = menu;
  1542. }
  1543.  
  1544. public function RequestMenuWithBackground( menu : name, backgroundMenu : name, optional initData : IScriptable )
  1545. {
  1546. var commonMenu : CR4CommonMenu;
  1547. var guiManager : CR4GuiManager;
  1548.  
  1549. guiManager = GetGuiManager();
  1550. commonMenu = (CR4CommonMenu)guiManager.GetRootMenu();
  1551. if( commonMenu )
  1552. {
  1553. commonMenu.SwitchToSubMenu(menu,"");
  1554. }
  1555. else
  1556. {
  1557. if ( guiManager.IsAnyMenu() )
  1558. {
  1559. guiManager.GetRootMenu().CloseMenu();
  1560. }
  1561.  
  1562. SetMenuToOpen( menu );
  1563. theGame.RequestMenu( backgroundMenu, initData );
  1564. }
  1565. }
  1566.  
  1567. public function OpenPopup(DataObject : W3PopupData) : void
  1568. {
  1569. theGame.RequestMenu('PopupMenu', DataObject);
  1570. }
  1571.  
  1572. public function SetUIVerticalFrameScale( value : float )
  1573. {
  1574. uiVerticalFrameScale = value;
  1575. }
  1576.  
  1577. public function GetUIVerticalFrameScale() : float
  1578. {
  1579. return uiVerticalFrameScale;
  1580. }
  1581.  
  1582. public function SetUIHorizontalFrameScale( value : float )
  1583. {
  1584. var horizontalPlusFrameScale : float;
  1585. uiHorizontalFrameScale = value;
  1586. horizontalPlusFrameScale = theGame.GetUIHorizontalPlusFrameScale();
  1587. uiHorizontalFrameScale = uiHorizontalFrameScale * horizontalPlusFrameScale;
  1588. }
  1589.  
  1590. public function GetUIHorizontalFrameScale() : float
  1591. {
  1592. return uiHorizontalFrameScale;
  1593. }
  1594.  
  1595. public function SetUIScale( value : float )
  1596. {
  1597. uiScale = value;
  1598. }
  1599.  
  1600. public function GetUIScale() : float
  1601. {
  1602. return uiScale;
  1603. }
  1604.  
  1605. public function SetUIGamepadScaleGain( value : float )
  1606. {
  1607. uiGamepadScaleGain = value;
  1608. }
  1609.  
  1610. public function GetUIGamepadScaleGain() : float
  1611. {
  1612. return uiGamepadScaleGain;
  1613. }
  1614.  
  1615. public function SetDeathSaveLockId(i : int)
  1616. {
  1617. deathSaveLockId = i;
  1618. }
  1619.  
  1620. public function SetUIOpacity( value : float )
  1621. {
  1622. uiOpacity = value;
  1623. }
  1624.  
  1625. public function GetUIOpacity() : float
  1626. {
  1627. return uiOpacity;
  1628. }
  1629.  
  1630. public function setDialogDisplayDisabled( value : bool )
  1631. {
  1632. isDialogDisplayDisabled = value;
  1633. }
  1634.  
  1635. public function LoadHudSettings()
  1636. {
  1637. var inGameConfigWrapper : CInGameConfigWrapper;
  1638.  
  1639. hudSettings = LoadCSV("gameplay\globals\hud_settings.csv");
  1640.  
  1641. inGameConfigWrapper = (CInGameConfigWrapper)theGame.GetInGameConfigWrapper();
  1642.  
  1643. isDialogDisplayDisabled = inGameConfigWrapper.GetVarValue('Localization', 'Subtitles') == "false";
  1644.  
  1645. SetUIVerticalFrameScale( StringToFloat(inGameConfigWrapper.GetVarValue('Hidden', 'uiVerticalFrameScale')) );
  1646. SetUIHorizontalFrameScale( StringToFloat(inGameConfigWrapper.GetVarValue('Hidden', 'uiHorizontalFrameScale')) );
  1647.  
  1648. uiScale = StringToFloat(theGame.hudSettings.GetValueAt(1,theGame.hudSettings.GetRowIndexAt( 0, "uiScale" )));
  1649. uiOpacity = StringToFloat(theGame.hudSettings.GetValueAt(1,theGame.hudSettings.GetRowIndexAt( 0, "uiOpacity" )));
  1650. }
  1651.  
  1652. event OnRefreshUIScaling()
  1653. {
  1654. var inGameConfigWrapper : CInGameConfigWrapper;
  1655. inGameConfigWrapper = (CInGameConfigWrapper)theGame.GetInGameConfigWrapper();
  1656. SetUIVerticalFrameScale( StringToFloat(inGameConfigWrapper.GetVarValue('Hidden', 'uiVerticalFrameScale')) );
  1657. SetUIHorizontalFrameScale( StringToFloat(inGameConfigWrapper.GetVarValue('Hidden', 'uiHorizontalFrameScale')) );
  1658. }
  1659.  
  1660. event OnSpawnPlayerHorse( )
  1661. {
  1662. var createEntityHelper : CR4CreateEntityHelper;
  1663.  
  1664. thePlayer.RaiseEvent('HorseSummon');
  1665.  
  1666. if( !thePlayer.GetHorseWithInventory()
  1667. || !thePlayer.GetHorseWithInventory().IsAlive()
  1668. || ( !thePlayer.WasVisibleInScaledFrame( thePlayer.GetHorseWithInventory(), 1.5f, 1.5f ) && VecDistanceSquared( thePlayer.GetWorldPosition(), thePlayer.GetHorseWithInventory().GetWorldPosition() ) > 900 )
  1669. || VecDistanceSquared( thePlayer.GetWorldPosition(), thePlayer.GetHorseWithInventory().GetWorldPosition() ) > 1600 )
  1670. {
  1671. createEntityHelper = new CR4CreateEntityHelper in this;
  1672. createEntityHelper.SetPostAttachedCallback( this, 'OnPlayerHorseSummoned' );
  1673. theGame.SummonPlayerHorse( true, createEntityHelper );
  1674. }
  1675. else
  1676. {
  1677.  
  1678. thePlayer.GetHorseWithInventory().SignalGameplayEventParamObject( 'HorseSummon', thePlayer );
  1679. }
  1680.  
  1681. thePlayer.OnSpawnHorse();
  1682. }
  1683.  
  1684. private function OnPlayerHorseSummoned( horseEntity : CEntity )
  1685. {
  1686. var saddle : SItemUniqueId;
  1687. var horseManager : W3HorseManager;
  1688. var horse : CActor;
  1689.  
  1690.  
  1691. horseManager = GetWitcherPlayer().GetHorseManager();
  1692. saddle = horseManager.GetItemInSlot(EES_HorseSaddle);
  1693. if ( horseManager.GetInventoryComponent().GetItemName(saddle) == 'Devil Saddle' )
  1694. {
  1695.  
  1696. horse = (CActor)horseEntity;
  1697. horse.AddEffectDefault(EET_WeakeningAura, horse, 'horse saddle', false);
  1698. }
  1699.  
  1700. thePlayer.GetHorseWithInventory().SignalGameplayEventParamObject( 'HorseSummon', thePlayer );
  1701.  
  1702. GetWitcherPlayer().GetHorseManager().ApplyHorseUpdateOnSpawn();
  1703. }
  1704.  
  1705.  
  1706. event OnTutorialMessageForChoiceLines( flags : int )
  1707. {
  1708.  
  1709.  
  1710.  
  1711. GameplayFactsSet('dialog_choice_flags', flags);
  1712. GameplayFactsAdd('dialog_choice_is_set', 1, 1);
  1713. }
  1714.  
  1715. event OnTutorialMessageForChoiceLineChosen( flags : int )
  1716. {
  1717. GameplayFactsSet('dialog_used_choice_flags', flags);
  1718. GameplayFactsAdd('dialog_used_choice_is_set', 1, 1);
  1719. }
  1720.  
  1721.  
  1722.  
  1723.  
  1724.  
  1725.  
  1726.  
  1727.  
  1728. public function GameplayFactsAdd(factName : string, optional value : int, optional realtimeSecsValidFor : int)
  1729. {
  1730. var idx : int;
  1731. var newFact : SGameplayFact;
  1732. var newFactRemoval : SGameplayFactRemoval;
  1733.  
  1734. if(value < 0)
  1735. return;
  1736. else if(value == 0)
  1737. value = 1;
  1738.  
  1739. idx = GetGameplayFactIndex(factName);
  1740. if(idx >= 0)
  1741. {
  1742. gameplayFacts[idx].value += value;
  1743. }
  1744. else
  1745. {
  1746. newFact.factName = factName;
  1747. newFact.value = value;
  1748. gameplayFacts.PushBack(newFact);
  1749. }
  1750.  
  1751. if(realtimeSecsValidFor > 0)
  1752. {
  1753. newFactRemoval.factName = factName;
  1754. newFactRemoval.value = value;
  1755. newFactRemoval.timerID = thePlayer.AddTimer('GameplayFactRemove', realtimeSecsValidFor, , , , true, false);
  1756.  
  1757. gameplayFactsForRemoval.PushBack(newFactRemoval);
  1758. }
  1759. }
  1760.  
  1761. public function GameplayFactsSet(factName : string, value : int)
  1762. {
  1763. var idx : int;
  1764. var newFact : SGameplayFact;
  1765.  
  1766. idx = GetGameplayFactIndex(factName);
  1767. if(idx >= 0)
  1768. {
  1769. gameplayFacts[idx].value = value;
  1770. }
  1771. else
  1772. {
  1773. newFact.factName = factName;
  1774. newFact.value = value;
  1775. gameplayFacts.PushBack(newFact);
  1776. }
  1777. }
  1778.  
  1779. public function GameplayFactsRemove(factName : string)
  1780. {
  1781. var i : int;
  1782.  
  1783. for(i=0; i<gameplayFacts.Size(); i+=1)
  1784. {
  1785. if(gameplayFacts[i].factName == factName)
  1786. {
  1787. gameplayFacts.EraseFast(i);
  1788. return;
  1789. }
  1790. }
  1791. }
  1792.  
  1793.  
  1794. public function GameplayFactRemoveFromTimer(timerID : int)
  1795. {
  1796. var idx, factIdx : int;
  1797.  
  1798. idx = GetGameplayFactsForRemovalIndex(timerID);
  1799. if(idx < 0)
  1800. {
  1801. LogAssert(false, "CR4Game.GameplayFactRemoveFromTimer: trying to process non-existant timer <<" + timerID + ">>");
  1802. return;
  1803. }
  1804.  
  1805. factIdx = GetGameplayFactIndex(gameplayFactsForRemoval[idx].factName);
  1806. if(factIdx < 0)
  1807. return;
  1808.  
  1809. gameplayFacts[factIdx].value -= gameplayFactsForRemoval[idx].value;
  1810. if(gameplayFacts[factIdx].value <= 0)
  1811. gameplayFacts.EraseFast(factIdx);
  1812.  
  1813. gameplayFactsForRemoval.EraseFast(idx);
  1814. }
  1815.  
  1816. public function GameplayFactsQuerySum(factName : string) : int
  1817. {
  1818. var idx : int;
  1819.  
  1820. idx = GetGameplayFactIndex(factName);
  1821. if(idx >= 0)
  1822. return gameplayFacts[idx].value;
  1823.  
  1824. return 0;
  1825. }
  1826.  
  1827. private function GetGameplayFactIndex(factName : string) : int
  1828. {
  1829. var i : int;
  1830.  
  1831. for(i=0; i<gameplayFacts.Size(); i+=1)
  1832. {
  1833. if(gameplayFacts[i].factName == factName)
  1834. return i;
  1835. }
  1836.  
  1837. return -1;
  1838. }
  1839.  
  1840. private function GetGameplayFactsForRemovalIndex(timerID : int) : int
  1841. {
  1842. var i : int;
  1843.  
  1844. for(i=0; i<gameplayFactsForRemoval.Size(); i+=1)
  1845. {
  1846. if(gameplayFactsForRemoval[i].timerID == timerID)
  1847. return i;
  1848. }
  1849.  
  1850. return -1;
  1851. }
  1852.  
  1853. public function GetR4ReactionManager() : CR4ReactionManager
  1854. {
  1855. return ( CR4ReactionManager ) GetBehTreeReactionManager();
  1856. }
  1857.  
  1858. public function GetDifficultyMode() : EDifficultyMode
  1859. {
  1860. var diff : EDifficultyMode;
  1861.  
  1862. diff = GetDifficultyLevel();
  1863.  
  1864.  
  1865. if(diff == EDM_NotSet)
  1866. {
  1867. return EDM_Medium;
  1868. }
  1869.  
  1870. return diff;
  1871. }
  1872.  
  1873. event OnDifficultyChanged(newDifficulty : int)
  1874. {
  1875. var i : int;
  1876. var lowestDiff : EDifficultyMode;
  1877.  
  1878.  
  1879. if(!thePlayer)
  1880. {
  1881. diffChangePostponed = newDifficulty;
  1882. return false;
  1883. }
  1884.  
  1885. theTelemetry.SetCommonStatI32(CS_DIFFICULTY_LVL, newDifficulty);
  1886.  
  1887.  
  1888. lowestDiff = GetLowestDifficultyUsed();
  1889. if(lowestDiff != newDifficulty && MinDiffMode(lowestDiff, newDifficulty) == newDifficulty)
  1890. SetLowestDifficultyUsed(newDifficulty);
  1891.  
  1892. UpdateStatsForDifficultyLevel( GetSpawnDifficultyMode() );
  1893. }
  1894.  
  1895.  
  1896. public function OnPlayerChanged()
  1897. {
  1898. var i : int;
  1899. var buffs : array<CBaseGameplayEffect>;
  1900. var witcher : W3PlayerWitcher;
  1901.  
  1902.  
  1903. thePlayer.RemoveAllNonAutoBuffs( , true );
  1904.  
  1905.  
  1906. buffs = thePlayer.GetBuffs();
  1907. for(i=0; i<buffs.Size(); i+=1)
  1908. {
  1909. buffs[i].ResumeForced();
  1910. }
  1911.  
  1912.  
  1913. GetGameCamera().StopEffect( 'frost' );
  1914. DisableCatViewFx( 1.0f );
  1915. thePlayer.StopEffect('critical_low_health');
  1916. DisableDrunkFx();
  1917. thePlayer.StopEffect('critical_toxicity');
  1918.  
  1919. if(GetWitcherPlayer())
  1920. GetWitcherPlayer().UpdateEncumbrance();
  1921.  
  1922.  
  1923.  
  1924. UpdateStatsForDifficultyLevel( GetSpawnDifficultyMode() );
  1925.  
  1926.  
  1927. RemoveAllTimeScales();
  1928. }
  1929.  
  1930.  
  1931.  
  1932. public function GetSpawnDifficultyMode() : EDifficultyMode
  1933. {
  1934. if( thePlayer && thePlayer.IsCiri() )
  1935. {
  1936. return MinDiffMode( GetDifficultyMode(), EDM_Medium );
  1937. }
  1938. return GetDifficultyMode();
  1939. }
  1940.  
  1941. public function UpdateStatsForDifficultyLevel( difficulty : EDifficultyMode )
  1942. {
  1943. var i : int;
  1944. var actor : CActor;
  1945. var npcs : array< CNewNPC >;
  1946. GetAllNPCs( npcs );
  1947. for( i=0; i < npcs.Size(); i+=1 )
  1948. {
  1949. actor = (CActor)npcs[i];
  1950. if( actor )
  1951. {
  1952. actor.UpdateStatsForDifficultyLevel( difficulty );
  1953. }
  1954. }
  1955. }
  1956.  
  1957. public function CanTrackQuest( questEntry : CJournalQuest ) : bool
  1958. {
  1959. var questName : string;
  1960. var baseName : string;
  1961. var i : int;
  1962. var questCount : int;
  1963. var playerLevel : int;
  1964. var questLevel : int;
  1965. var questLevels : C2dArray;
  1966. var questLevelsCount : int;
  1967. var iterQuestLevels : int;
  1968.  
  1969. baseName = questEntry.baseName;
  1970. playerLevel = thePlayer.GetLevel();
  1971.  
  1972. if ( questEntry.GetType() == MonsterHunt )
  1973. {
  1974. questLevelsCount = theGame.questLevelsContainer.Size();
  1975. for( iterQuestLevels = 0; iterQuestLevels < questLevelsCount; iterQuestLevels += 1 )
  1976. {
  1977. questLevels = theGame.questLevelsContainer[iterQuestLevels];
  1978.  
  1979. questCount = questLevels.GetNumRows();
  1980. for( i = 0; i < questCount; i += 1 )
  1981. {
  1982. questName = questLevels.GetValueAtAsName( 0, i );
  1983. if ( questName == baseName )
  1984. {
  1985. questLevel = NameToInt( questLevels.GetValueAtAsName( 1, i ) );
  1986. return playerLevel >= questLevel - 5;
  1987. }
  1988. }
  1989. }
  1990. }
  1991. return true;
  1992. }
  1993.  
  1994. import final function GetGwintManager() : CR4GwintManager;
  1995.  
  1996. public function IsBlackscreenOrFading() : bool
  1997. {
  1998. return IsBlackscreen() || IsFading();
  1999. }
  2000.  
  2001.  
  2002.  
  2003.  
  2004.  
  2005. var postponedPreAttackEvents : array< SPostponedPreAttackEvent >;
  2006.  
  2007. event OnPreAttackEvent( entity : CGameplayEntity, animEventName : name, animEventType : EAnimationEventType, data : CPreAttackEventData, animInfo : SAnimationEventAnimInfo )
  2008. {
  2009. var postponedPreAttackEvent : SPostponedPreAttackEvent;
  2010.  
  2011. postponedPreAttackEvent.entity = entity;
  2012. postponedPreAttackEvent.eventName = animEventName;
  2013. postponedPreAttackEvent.eventType = animEventType;
  2014. postponedPreAttackEvent.data = data;
  2015. postponedPreAttackEvent.animInfo = animInfo;
  2016.  
  2017. postponedPreAttackEvents.PushBack( postponedPreAttackEvent );
  2018. }
  2019.  
  2020. function FirePostponedPreAttackEvents()
  2021. {
  2022. var i, size : int;
  2023. var entity : CGameplayEntity;
  2024.  
  2025. size = postponedPreAttackEvents.Size();
  2026. for ( i = 0; i < size; i+=1 )
  2027. {
  2028. entity = postponedPreAttackEvents[i].entity;
  2029. if ( entity )
  2030. {
  2031. entity.OnPreAttackEvent( postponedPreAttackEvents[i].eventName,
  2032. postponedPreAttackEvents[i].eventType,
  2033. postponedPreAttackEvents[i].data,
  2034. postponedPreAttackEvents[i].animInfo );
  2035. }
  2036. }
  2037. postponedPreAttackEvents.Clear();
  2038. }
  2039.  
  2040. public final function AddDynamicallySpawnedBoatHandle(handle : EntityHandle)
  2041. {
  2042. var i : int;
  2043.  
  2044. if(EntityHandleGet(handle))
  2045. {
  2046. dynamicallySpawnedBoats.PushBack(handle);
  2047.  
  2048. if(dynamicallySpawnedBoats.Size() >= theGame.params.MAX_DYNAMICALLY_SPAWNED_BOATS)
  2049. {
  2050.  
  2051. for(i=dynamicallySpawnedBoatsToDestroy.Size()-1; i>=0; i-=1)
  2052. {
  2053. if(!EntityHandleGet(dynamicallySpawnedBoats[i]))
  2054. dynamicallySpawnedBoats.EraseFast(i);
  2055. }
  2056.  
  2057. if(dynamicallySpawnedBoats.Size() >= theGame.params.MAX_DYNAMICALLY_SPAWNED_BOATS)
  2058. {
  2059. dynamicallySpawnedBoatsToDestroy.PushBack( dynamicallySpawnedBoats[0] );
  2060. dynamicallySpawnedBoats.Erase(0);
  2061. }
  2062. }
  2063. }
  2064. }
  2065.  
  2066. public final function IsBoatMarkedForDestroy(boat : W3Boat) : bool
  2067. {
  2068. var handle : EntityHandle;
  2069. var i : int;
  2070.  
  2071. EntityHandleSet(handle, boat);
  2072. for(i=0; i<dynamicallySpawnedBoatsToDestroy.Size(); i+=1)
  2073. {
  2074. if(handle == dynamicallySpawnedBoatsToDestroy[i])
  2075. {
  2076. dynamicallySpawnedBoatsToDestroy.EraseFast(i);
  2077. return true;
  2078. }
  2079. }
  2080.  
  2081. return false;
  2082. }
  2083.  
  2084. public final function VibrateControllerVeryLight(optional duration : float)
  2085. {
  2086. if ( !theInput.LastUsedGamepad() )
  2087. return;
  2088.  
  2089. if(duration == 0)
  2090. duration = 0.15f;
  2091.  
  2092. if(IsSpecificRumbleActive(0.2, 0))
  2093. {
  2094. OverrideRumbleDuration(0.2, 0, duration);
  2095. }
  2096. else
  2097. {
  2098. VibrateController(0.2, 0, duration);
  2099. }
  2100. }
  2101.  
  2102. public final function VibrateControllerLight(optional duration : float)
  2103. {
  2104. if ( !theInput.LastUsedGamepad() )
  2105. return;
  2106.  
  2107. if(duration == 0)
  2108. duration = 0.2f;
  2109.  
  2110. if(IsSpecificRumbleActive(0.5, 0))
  2111. {
  2112. OverrideRumbleDuration(0.5, 0, duration);
  2113. }
  2114. else
  2115. {
  2116. VibrateController(0.5, 0, duration);
  2117. }
  2118. }
  2119.  
  2120. public final function VibrateControllerHard(optional duration : float)
  2121. {
  2122. if ( !theInput.LastUsedGamepad() )
  2123. return;
  2124.  
  2125. if(duration == 0)
  2126. duration = 0.2f;
  2127.  
  2128. if(IsSpecificRumbleActive(0.75, 0.75))
  2129. {
  2130. OverrideRumbleDuration(0.75, 0.75, duration);
  2131. }
  2132. else
  2133. {
  2134. VibrateController(0.75, 0.75, duration);
  2135. }
  2136. }
  2137.  
  2138. public final function VibrateControllerVeryHard(optional duration : float)
  2139. {
  2140. if ( !theInput.LastUsedGamepad() )
  2141. return;
  2142.  
  2143. if(duration == 0)
  2144. duration = 0.5f;
  2145.  
  2146. if(IsSpecificRumbleActive(1, 1))
  2147. {
  2148. OverrideRumbleDuration(1, 1, duration);
  2149. }
  2150. else
  2151. {
  2152. VibrateController(1, 1, duration);
  2153. }
  2154. }
  2155. import public final function GetWorldDLCExtender() : CR4WorldDLCExtender;
  2156.  
  2157. public function GetMiniMapSize( areaType : int ) : float
  2158. {
  2159. var mapSize : float;
  2160. var valueAsString : string;
  2161.  
  2162. valueAsString = minimapSettings.GetValueAt( 1, areaType );
  2163.  
  2164. if( StrLen( valueAsString ) != 0 )
  2165. {
  2166. mapSize = StringToFloat( valueAsString );
  2167. }
  2168. else
  2169. {
  2170. mapSize = GetWorldDLCExtender().GetMiniMapSize( areaType );
  2171. }
  2172. return mapSize;
  2173. }
  2174.  
  2175. public function GetMiniMapTileCount( areaType : int ) : int
  2176. {
  2177. var tileCount : int;
  2178. var valueAsString : string;
  2179.  
  2180. valueAsString = minimapSettings.GetValueAt( 2, areaType );
  2181.  
  2182. if( StrLen( valueAsString ) != 0 )
  2183. {
  2184. tileCount = StringToInt( valueAsString );
  2185. }
  2186. else
  2187. {
  2188. tileCount = GetWorldDLCExtender().GetMiniMapTileCount( areaType );
  2189. }
  2190. return tileCount;
  2191. }
  2192.  
  2193. public function GetMiniMapExteriorTextureSize( areaType : int ) : int
  2194. {
  2195. var exteriorTextureSize : int;
  2196. var valueAsString : string;
  2197.  
  2198. valueAsString = minimapSettings.GetValueAt( 3, areaType );
  2199.  
  2200. if( StrLen( valueAsString ) != 0 )
  2201. {
  2202. exteriorTextureSize = StringToInt( valueAsString );
  2203. }
  2204. else
  2205. {
  2206. exteriorTextureSize = GetWorldDLCExtender().GetMiniMapExteriorTextureSize( areaType );
  2207. }
  2208. return exteriorTextureSize;
  2209. }
  2210.  
  2211.  
  2212. public function GetMiniMapInteriorTextureSize( areaType : int ) : int
  2213. {
  2214. var interiorTextureSize : int;
  2215. var valueAsString : string;
  2216.  
  2217. valueAsString = minimapSettings.GetValueAt( 4, areaType );
  2218.  
  2219. if( StrLen( valueAsString ) != 0 )
  2220. {
  2221. interiorTextureSize = StringToInt( valueAsString );
  2222. }
  2223. else
  2224. {
  2225. interiorTextureSize = GetWorldDLCExtender().GetMiniMapInteriorTextureSize( areaType );
  2226. }
  2227. return interiorTextureSize;
  2228. }
  2229.  
  2230. public function GetMiniMapTextureSize( areaType : int ) : int
  2231. {
  2232. var textureSize : int;
  2233. var valueAsString : string;
  2234.  
  2235. valueAsString = minimapSettings.GetValueAt( 5, areaType );
  2236.  
  2237. if( StrLen( valueAsString ) != 0 )
  2238. {
  2239. textureSize = StringToInt( valueAsString );
  2240. }
  2241. else
  2242. {
  2243. textureSize = GetWorldDLCExtender().GetMiniMapTextureSize( areaType );
  2244. }
  2245. return textureSize;
  2246. }
  2247.  
  2248. public function GetMiniMapMinLod( areaType : int ) : int
  2249. {
  2250. var minLod : int;
  2251. var valueAsString : string;
  2252.  
  2253. valueAsString = minimapSettings.GetValueAt( 6, areaType );
  2254.  
  2255. if( StrLen( valueAsString ) != 0 )
  2256. {
  2257. minLod = StringToInt( valueAsString );
  2258. }
  2259. else
  2260. {
  2261. minLod = GetWorldDLCExtender().GetMiniMapMinLod( areaType );
  2262. }
  2263. return minLod;
  2264. }
  2265.  
  2266. public function GetMiniMapMaxLod( areaType : int ) : int
  2267. {
  2268. var maxLod : int;
  2269. var valueAsString : string;
  2270.  
  2271. valueAsString = minimapSettings.GetValueAt( 7, areaType );
  2272.  
  2273. if( StrLen( valueAsString ) != 0 )
  2274. {
  2275. maxLod = StringToInt( valueAsString );
  2276. }
  2277. else
  2278. {
  2279. maxLod = GetWorldDLCExtender().GetMiniMapMaxLod( areaType );
  2280. }
  2281. return maxLod;
  2282. }
  2283.  
  2284.  
  2285. public function GetMiniMapExteriorTextureExtension( areaType : int ) : string
  2286. {
  2287. var exteriorTextureExtension : string;
  2288. var valueAsString : string;
  2289.  
  2290. valueAsString = minimapSettings.GetValueAt( 8, areaType );
  2291.  
  2292. if( StrLen( valueAsString ) != 0 )
  2293. {
  2294. exteriorTextureExtension = ExtractStringFromCSV( valueAsString );
  2295. }
  2296. else
  2297. {
  2298. exteriorTextureExtension = GetWorldDLCExtender().GetMiniMapExteriorTextureExtension( areaType );
  2299. }
  2300. return exteriorTextureExtension;
  2301. }
  2302.  
  2303. public function GetMiniMapInteriorTextureExtension( areaType : int ) : string
  2304. {
  2305. var interiorTextureExtension : string;
  2306. var valueAsString : string;
  2307.  
  2308. valueAsString = minimapSettings.GetValueAt( 9, areaType );
  2309.  
  2310. if( StrLen( valueAsString ) != 0 )
  2311. {
  2312. interiorTextureExtension = ExtractStringFromCSV( valueAsString );
  2313. }
  2314. else
  2315. {
  2316. interiorTextureExtension = GetWorldDLCExtender().GetMiniMapInteriorTextureExtension( areaType );
  2317. }
  2318. return interiorTextureExtension;
  2319. }
  2320.  
  2321. public function GetMiniMapVminX( areaType : int ) : int
  2322. {
  2323. var vminX : int;
  2324. var valueAsString : string;
  2325.  
  2326. valueAsString = minimapSettings.GetValueAt( 11, areaType );
  2327.  
  2328. if( StrLen( valueAsString ) != 0 )
  2329. {
  2330. vminX = StringToInt( valueAsString );
  2331. }
  2332. else
  2333. {
  2334. vminX = GetWorldDLCExtender().GetMiniMapVminX( areaType );
  2335. }
  2336. return vminX;
  2337. }
  2338.  
  2339. public function GetMiniMapVmaxX( areaType : int ) : int
  2340. {
  2341. var vmaxX : int;
  2342. var valueAsString : string;
  2343.  
  2344. valueAsString = minimapSettings.GetValueAt( 12, areaType );
  2345.  
  2346. if( StrLen( valueAsString ) != 0 )
  2347. {
  2348. vmaxX = StringToInt( valueAsString );
  2349. }
  2350. else
  2351. {
  2352. vmaxX = GetWorldDLCExtender().GetMiniMapVmaxX( areaType );
  2353. }
  2354. return vmaxX;
  2355. }
  2356.  
  2357. public function GetMiniMapVminY( areaType : int ) : int
  2358. {
  2359. var vminY : int;
  2360. var valueAsString : string;
  2361.  
  2362. valueAsString = minimapSettings.GetValueAt( 13, areaType );
  2363.  
  2364. if( StrLen( valueAsString ) != 0 )
  2365. {
  2366. vminY = StringToInt( valueAsString );
  2367. }
  2368. else
  2369. {
  2370. vminY = GetWorldDLCExtender().GetMiniMapVminY( areaType );
  2371. }
  2372. return vminY;
  2373. }
  2374.  
  2375. public function GetMiniMapVmaxY( areaType : int ) : int
  2376. {
  2377. var vmaxY : int;
  2378. var valueAsString : string;
  2379.  
  2380. valueAsString = minimapSettings.GetValueAt( 14, areaType );
  2381.  
  2382. if( StrLen( valueAsString ) != 0 )
  2383. {
  2384. vmaxY = StringToInt( valueAsString );
  2385. }
  2386. else
  2387. {
  2388. vmaxY = GetWorldDLCExtender().GetMiniMapVmaxY( areaType );
  2389. }
  2390. return vmaxY;
  2391. }
  2392.  
  2393. public function GetMiniMapSminX( areaType : int ) : int
  2394. {
  2395. var sminX : int;
  2396. var valueAsString : string;
  2397.  
  2398. valueAsString = minimapSettings.GetValueAt( 15, areaType );
  2399.  
  2400. if( StrLen( valueAsString ) != 0 )
  2401. {
  2402. sminX = StringToInt( valueAsString );
  2403. }
  2404. else
  2405. {
  2406. sminX = GetWorldDLCExtender().GetMiniMapSminX( areaType );
  2407. }
  2408. return sminX;
  2409. }
  2410.  
  2411. public function GetMiniMapSmaxX( areaType : int ) : int
  2412. {
  2413. var smaxX : int;
  2414. var valueAsString : string;
  2415.  
  2416. valueAsString = minimapSettings.GetValueAt( 16, areaType );
  2417.  
  2418. if( StrLen( valueAsString ) != 0 )
  2419. {
  2420. smaxX = StringToInt( valueAsString );
  2421. }
  2422. else
  2423. {
  2424. smaxX = GetWorldDLCExtender().GetMiniMapSmaxX( areaType );
  2425. }
  2426. return smaxX;
  2427. }
  2428.  
  2429. public function GetMiniMapSminY( areaType : int ) : int
  2430. {
  2431. var sminY : int;
  2432. var valueAsString : string;
  2433.  
  2434. valueAsString = minimapSettings.GetValueAt( 17, areaType );
  2435.  
  2436. if( StrLen( valueAsString ) != 0 )
  2437. {
  2438. sminY = StringToInt( valueAsString );
  2439. }
  2440. else
  2441. {
  2442. sminY = GetWorldDLCExtender().GetMiniMapSminY( areaType );
  2443. }
  2444. return sminY;
  2445. }
  2446.  
  2447. public function GetMiniMapSmaxY( areaType : int ) : int
  2448. {
  2449. var smaxY : int;
  2450. var valueAsString : string;
  2451.  
  2452. valueAsString = minimapSettings.GetValueAt( 18, areaType );
  2453.  
  2454. if( StrLen( valueAsString ) != 0 )
  2455. {
  2456. smaxY = StringToInt( valueAsString );
  2457. }
  2458. else
  2459. {
  2460. smaxY = GetWorldDLCExtender().GetMiniMapSmaxY( areaType );
  2461. }
  2462. return smaxY;
  2463. }
  2464.  
  2465. public function GetMiniMapMinZoom( areaType : int ) : float
  2466. {
  2467. var minZoom : float;
  2468. var valueAsString : string;
  2469.  
  2470. valueAsString = minimapSettings.GetValueAt( 19, areaType );
  2471.  
  2472. if( StrLen( valueAsString ) != 0 )
  2473. {
  2474. minZoom = StringToFloat( valueAsString );
  2475. }
  2476. else
  2477. {
  2478. minZoom = GetWorldDLCExtender().GetMiniMapMinZoom( areaType );
  2479. }
  2480. return minZoom;
  2481. }
  2482.  
  2483. public function GetMiniMapMaxZoom( areaType : int ) : float
  2484. {
  2485. var maxZoom : float;
  2486. var valueAsString : string;
  2487.  
  2488. valueAsString = minimapSettings.GetValueAt( 20, areaType );
  2489.  
  2490. if( StrLen( valueAsString ) != 0 )
  2491. {
  2492. maxZoom = StringToFloat( valueAsString );
  2493. }
  2494. else
  2495. {
  2496. maxZoom = GetWorldDLCExtender().GetMiniMapMaxZoom( areaType );
  2497. }
  2498. return maxZoom;
  2499. }
  2500.  
  2501. public function GetMiniMapZoom12( areaType : int ) : float
  2502. {
  2503. var zoom12 : float;
  2504. var valueAsString : string;
  2505.  
  2506. valueAsString = minimapSettings.GetValueAt( 21, areaType );
  2507.  
  2508. if( StrLen( valueAsString ) != 0 )
  2509. {
  2510. zoom12 = StringToFloat( valueAsString );
  2511. }
  2512. else
  2513. {
  2514. zoom12 = GetWorldDLCExtender().GetMiniMapZoom12( areaType );
  2515. }
  2516. return zoom12;
  2517. }
  2518.  
  2519. public function GetMiniMapZoom23( areaType : int ) : float
  2520. {
  2521. var zoom23 : float;
  2522. var valueAsString : string;
  2523.  
  2524. valueAsString = minimapSettings.GetValueAt( 22, areaType );
  2525.  
  2526. if( StrLen( valueAsString ) != 0 )
  2527. {
  2528. zoom23 = StringToFloat( valueAsString );
  2529. }
  2530. else
  2531. {
  2532. zoom23 = GetWorldDLCExtender().GetMiniMapZoom23( areaType );
  2533. }
  2534. return zoom23;
  2535. }
  2536.  
  2537. public function GetMiniMapZoom34( areaType : int ) : float
  2538. {
  2539. var zoom34 : float;
  2540. var valueAsString : string;
  2541.  
  2542. valueAsString = minimapSettings.GetValueAt( 23, areaType );
  2543.  
  2544. if( StrLen( valueAsString ) != 0 )
  2545. {
  2546. zoom34 = StringToFloat( valueAsString );
  2547. }
  2548. else
  2549. {
  2550. zoom34 = GetWorldDLCExtender().GetMiniMapZoom34( areaType );
  2551. }
  2552. return zoom34;
  2553. }
  2554.  
  2555. public function GetGradientScale( areaType : int ) : float
  2556. {
  2557. var scale : float;
  2558. var valueAsString : string;
  2559.  
  2560. valueAsString = minimapSettings.GetValueAt( 24, areaType );
  2561.  
  2562. if( StrLen( valueAsString ) != 0 )
  2563. {
  2564. scale = StringToFloat( valueAsString );
  2565. }
  2566. else
  2567. {
  2568. scale = GetWorldDLCExtender().GetGradientScale( areaType );
  2569. }
  2570. return scale;
  2571. }
  2572.  
  2573. public function GetPreviewHeight( areaType : int ) : float
  2574. {
  2575. var height : float;
  2576. var valueAsString : string;
  2577.  
  2578. valueAsString = minimapSettings.GetValueAt( 25, areaType );
  2579.  
  2580. if( StrLen( valueAsString ) != 0 )
  2581. {
  2582. height = StringToFloat( valueAsString );
  2583. }
  2584. else
  2585. {
  2586. height = GetWorldDLCExtender().GetPreviewHeight( areaType );
  2587. }
  2588. return height;
  2589. }
  2590.  
  2591. private function UnlockMissedAchievements()
  2592. {
  2593. var manager : CCommonMapManager = theGame.GetCommonMapManager();
  2594. if ( manager )
  2595. {
  2596. manager.CheckExplorerAchievement();
  2597. }
  2598.  
  2599. GetWitcherPlayer().CheckForFullyArmedAchievement();
  2600. GetGamerProfile().CheckProgressOfAllStats();
  2601. if (FactsDoesExist("witcher3_game_finished"))
  2602. {
  2603. Achievement_FinishedGame();
  2604. }
  2605. }
  2606.  
  2607. public final function MutationHUDFeedback( type : EMutationFeedbackType )
  2608. {
  2609. var hud : CR4ScriptedHud;
  2610. var hudWolfHeadModule : CR4HudModuleWolfHead;
  2611.  
  2612. hud = (CR4ScriptedHud)GetHud();
  2613. if ( hud )
  2614. {
  2615. hudWolfHeadModule = (CR4HudModuleWolfHead)hud.GetHudModule( "WolfHeadModule" );
  2616. if ( hudWolfHeadModule )
  2617. {
  2618. hudWolfHeadModule.DisplayMutationFeedback( type );
  2619. }
  2620. }
  2621. }
  2622. }
  2623.  
  2624. function hasSaveDataToLoad():bool
  2625. {
  2626. var currentSave : SSavegameInfo;
  2627. var saveGames : array< SSavegameInfo >;
  2628.  
  2629. theGame.ListSavedGames( saveGames );
  2630. if ( saveGames.Size() > 0 )
  2631. {
  2632. return true;
  2633. }
  2634.  
  2635. return false;
  2636. }
  2637.  
  2638. exec function EnableLog( enable : bool )
  2639. {
  2640. theGame.EnableLog( enable );
  2641. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement