Advertisement
ObviousDan

Untitled

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