Advertisement
Guest User

help

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