Guest User

mapMenu.ws

a guest
Feb 22nd, 2022
41
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 45.13 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. class CR4MapMenu extends CR4MenuBase
  11. {
  12. private var m_shownArea : EAreaName;
  13. private var m_currentArea : EAreaName;
  14.  
  15. private var m_fxRemoveUserMapPin : CScriptedFlashFunction;
  16. private var m_fxSetMapZooms : CScriptedFlashFunction;
  17. private var m_fxSetMapVisibilityBoundaries : CScriptedFlashFunction;
  18. private var m_fxSetMapScrollingBoundaries : CScriptedFlashFunction;
  19. private var m_fxSetMapSettings : CScriptedFlashFunction;
  20. private var m_fxReinitializeMap : CScriptedFlashFunction;
  21. private var m_fxEnableDebugMode : CScriptedFlashFunction;
  22. private var m_fxEnableUnlimitedZoom : CScriptedFlashFunction;
  23. private var m_fxEnableManualLod : CScriptedFlashFunction;
  24. private var m_fxShowBorders : CScriptedFlashFunction;
  25. private var m_fxSetDefaultPosition : CScriptedFlashFunction;
  26. private var m_fxShowToussaint : CScriptedFlashFunction;
  27. private var m_fxSetHighlightedMapPin : CScriptedFlashFunction;
  28.  
  29. private var m_userPinNames : array< name >;
  30.  
  31. var currentTag : name;
  32.  
  33. event OnConfigUI()
  34. {
  35. var initData : W3MapInitData;
  36. var manager : CCommonMapManager;
  37. var waypointPinLimit, otherPinLimit : int;
  38.  
  39. manager = theGame.GetCommonMapManager();
  40. if ( manager )
  41. {
  42. manager.GetUserPinNames( m_userPinNames );
  43.  
  44. waypointPinLimit = 5;
  45. otherPinLimit = 10;
  46. manager.GetUserMapPinLimits( waypointPinLimit, otherPinLimit );
  47. }
  48.  
  49. m_menuState = 'GlobalMap';
  50.  
  51.  
  52.  
  53. initData = (W3MapInitData)GetMenuInitData();
  54. if ( initData )
  55. {
  56. if(ShouldProcessTutorial('TutorialFastTravelHighlight'))
  57. {
  58.  
  59. if(initData.GetTriggeredExitEntity() || initData.GetUsedFastTravelEntity() || thePlayer.IsOnBoat())
  60. {
  61. GameplayFactsAdd("tutorial_fast_travel_open", 1, 1);
  62. }
  63. }
  64. }
  65.  
  66. super.OnConfigUI();
  67.  
  68. m_flashModule = GetMenuFlash();
  69.  
  70. m_fxRemoveUserMapPin = m_flashModule.GetMemberFlashFunction( "RemoveUserMapPin" );
  71. m_fxSetMapZooms = m_flashModule.GetMemberFlashFunction( "SetMapZooms" );
  72. m_fxSetMapVisibilityBoundaries = m_flashModule.GetMemberFlashFunction( "SetMapVisibilityBoundaries" );
  73. m_fxSetMapScrollingBoundaries = m_flashModule.GetMemberFlashFunction( "SetMapScrollingBoundaries" );
  74. m_fxSetMapSettings = m_flashModule.GetMemberFlashFunction( "SetMapSettings" );
  75. m_fxReinitializeMap = m_flashModule.GetMemberFlashFunction( "ReinitializeMap" );
  76. m_fxEnableDebugMode = m_flashModule.GetMemberFlashFunction( "EnableDebugMode" );
  77. m_fxEnableUnlimitedZoom = m_flashModule.GetMemberFlashFunction( "EnableUnlimitedZoom" );
  78. m_fxEnableManualLod = m_flashModule.GetMemberFlashFunction( "EnableManualLod" );
  79. m_fxShowBorders = m_flashModule.GetMemberFlashFunction( "ShowBorders" );
  80. m_fxSetDefaultPosition = m_flashModule.GetMemberFlashFunction( "setDefaultMapPostion" );
  81. m_fxShowToussaint = m_flashModule.GetMemberFlashFunction( "ShowToussaint" );
  82. m_fxSetHighlightedMapPin = m_flashModule.GetMemberFlashFunction( "SetHighlightedMapPin" );
  83.  
  84. Initialize();
  85.  
  86. UpdateActiveAreas();
  87. SelectCurrentModule();
  88.  
  89. UpdateCurrentQuestData( false );
  90.  
  91.  
  92. if (!((W3MenuInitData)GetMenuInitData()))
  93. {
  94. SetMenuState('GlobalMap');
  95. }
  96.  
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106. m_fxShowToussaint.InvokeSelfOneArg( FlashArgBool( theGame.GetDLCManager().IsEP2Available() ) );
  107. UpdatePlayerLevel();
  108. }
  109.  
  110. protected function GetSavedDataMenuName() : name
  111. {
  112. return m_menuState;
  113. }
  114.  
  115. function Initialize()
  116. {
  117. var manager: CCommonMapManager;
  118. var worldPath : String;
  119. var currentJournalArea : int;
  120. var currentJournalAreaName : string;
  121.  
  122. manager = theGame.GetCommonMapManager();
  123. worldPath = theGame.GetWorld().GetDepotPath();
  124. m_currentArea = manager.GetAreaFromWorldPath( worldPath );
  125. currentJournalArea = manager.GetCurrentJournalArea();
  126. currentJournalAreaName = AreaTypeToName( currentJournalArea );
  127.  
  128. GetMenuFlashValueStorage().SetFlashString( "worldmap.global.universe.area", currentJournalAreaName );
  129.  
  130. UpdateQuestAreas();
  131.  
  132. SwitchToHubMap( currentJournalArea, true );
  133. }
  134.  
  135. private function UpdatePlayerLevel()
  136. {
  137. var playerLevel : int;
  138. playerLevel = thePlayer.GetLevel();
  139.  
  140. m_flashValueStorage.SetFlashInt( "worldmap.global.universe.playerLevel", playerLevel );
  141. }
  142. private function UpdateQuestAreas()
  143. {
  144. var manager: CWitcherJournalManager = theGame.GetJournalManager();
  145. var areasWithQuests : array< int >;
  146.  
  147. var i : int;
  148. var flashObject : CScriptedFlashObject;
  149. var flashArray : CScriptedFlashArray;
  150.  
  151. areasWithQuests = manager.GetJournalAreasWithQuests();
  152.  
  153. flashArray = m_flashValueStorage.CreateTempFlashArray();
  154. for ( i = 0; i < areasWithQuests.Size(); i += 1 )
  155. {
  156.  
  157. flashObject = m_flashValueStorage.CreateTempFlashObject();
  158. flashObject.SetMemberFlashString( "area", AreaTypeToName( areasWithQuests[ i ] ) );
  159. flashArray.PushBackFlashObject( flashObject );
  160. }
  161. m_flashValueStorage.SetFlashArray( "worldmap.global.universe.questareas", flashArray );
  162. }
  163.  
  164. public function SetMenuState(newState : name) : void
  165. {
  166. SaveStateData();
  167. super.SetMenuState(newState);
  168. LogChannel('MAP_STATE',"state "+newState);
  169. GetSavedData();
  170. currentTag = UISavedData.selectedTag;
  171. SelectCurrentModule();
  172. UpdateInputFeedback();
  173. }
  174.  
  175.  
  176. private function UpdateInputFeedback():void
  177. {
  178. m_defaultInputBindings.Clear();
  179. super.SetButtons();
  180. }
  181.  
  182. protected function SetMapTitle(mapTitle:string):void
  183. {
  184. GetMenuFlashValueStorage().SetFlashString( "map.name.set", mapTitle );
  185. }
  186.  
  187. protected function SetCurrentAreaId(areaId:EAreaName, onStartup : bool):void
  188. {
  189. var manager : CCommonMapManager = theGame.GetCommonMapManager();
  190.  
  191. GetMenuFlashValueStorage().SetFlashInt( "map.current.area.id", areaId );
  192. if ( onStartup )
  193. {
  194. GetMenuFlashValueStorage().SetFlashString( "map.current.area.name", manager.GetMapName( areaId ) );
  195. }
  196. }
  197.  
  198. event OnDebugEvent( id : int )
  199. {
  200. LogChannel( 'MapTimer', "Flash " + id );
  201. }
  202.  
  203. function UpdateData( optional ignoreSelectionChange : bool )
  204. {
  205. var l_flashArray : CScriptedFlashArray;
  206.  
  207. LogChannel( 'MapTimer', "UpdateData START" );
  208.  
  209. UpdateDisabledMapPins();
  210.  
  211. LogChannel( 'MapTimer', "UpdateData MIDDLE1" );
  212.  
  213. l_flashArray = GetMenuFlashValueStorage().CreateTempFlashArray();
  214. UpdateEntityPins( l_flashArray );
  215. if ( IsCurrentAreaShown() )
  216. {
  217. UpdatePlayerPin( l_flashArray );
  218. }
  219.  
  220. UpdateUserMapPins( l_flashArray, -1 );
  221.  
  222. LogChannel( 'MapTimer', "UpdateData MIDDLE2" );
  223.  
  224. if (!ignoreSelectionChange)
  225. {
  226. GetMenuFlashValueStorage().SetFlashArray( "worldmap.global.pins.static", l_flashArray );
  227. }
  228. else
  229. {
  230. GetMenuFlashValueStorage().SetFlashArray( "worldmap.global.pins.static.update", l_flashArray );
  231. }
  232.  
  233. LogChannel( 'MapTimer', "UpdateData END" );
  234. }
  235.  
  236. private function UpdateDisabledMapPins()
  237. {
  238. var l_flashArray : CScriptedFlashArray;
  239. var l_flashObject : CScriptedFlashObject;
  240. var commonMapManager : CCommonMapManager = theGame.GetCommonMapManager();
  241. var i : int;
  242. var disabledPins : array< string >;
  243.  
  244. disabledPins = commonMapManager.GetDisabledMapPins();
  245.  
  246. l_flashArray = GetMenuFlashValueStorage().CreateTempFlashArray();
  247. for ( i = 0; i < disabledPins.Size(); i += 1)
  248. {
  249. l_flashObject = GetMenuFlashValueStorage().CreateTempFlashObject();
  250. l_flashObject.SetMemberFlashString( "pinType", disabledPins[ i ] );
  251. l_flashArray.PushBackFlashObject(l_flashObject);
  252. }
  253. GetMenuFlashValueStorage().SetFlashArray( "worldmap.global.pins.disabled", l_flashArray );
  254. }
  255.  
  256. private function UpdateCurrentQuestData( onHighlight : bool ) : void
  257. {
  258. var flashQuest : CScriptedFlashObject;
  259. var flashObjective : CScriptedFlashObject;
  260. var flashArray : CScriptedFlashArray;
  261.  
  262. var currentQuest : CJournalQuest;
  263. var highlightedObjective : CJournalQuestObjective;
  264. var objectives : array< SJournalQuestObjectiveData >;
  265. var i : int;
  266.  
  267. currentQuest = theGame.GetJournalManager().GetTrackedQuest();
  268. if ( currentQuest )
  269. {
  270. flashQuest = m_flashValueStorage.CreateTempFlashObject();
  271. flashQuest.SetMemberFlashString( "questName", GetLocStringById( currentQuest.GetTitleStringId() ) );
  272. flashQuest.SetMemberFlashInt( "questType", (int)currentQuest.GetType() );
  273. flashQuest.SetMemberFlashInt( "contentType", (int)currentQuest.GetContentType() );
  274. flashQuest.SetMemberFlashBool( "onHighlight", onHighlight );
  275. m_flashValueStorage.SetFlashObject( "map.quest.name", flashQuest );
  276. }
  277.  
  278. theGame.GetJournalManager().GetTrackedQuestObjectivesData( objectives );
  279. highlightedObjective = theGame.GetJournalManager().GetHighlightedObjective();
  280.  
  281. flashArray = GetMenuFlashValueStorage().CreateTempFlashArray();
  282. for ( i = 0; i < objectives.Size(); i += 1 )
  283. {
  284. if ( objectives[ i ].status == JS_Active )
  285. {
  286. if ( objectives[ i ].objectiveEntry == highlightedObjective )
  287. {
  288. flashObjective = GetMenuFlashValueStorage().CreateTempFlashObject();
  289. flashObjective.SetMemberFlashString( "objectiveName", GetLocStringById( objectives[ i ].objectiveEntry.GetTitleStringId() ) + GetQuestObjectiveCounterText( objectives[ i ].objectiveEntry ) );
  290. flashObjective.SetMemberFlashInt( "objectiveScriptName", NameToFlashUInt( objectives[ i ].objectiveEntry.GetUniqueScriptTag() ) );
  291. flashObjective.SetMemberFlashBool( "highlighted", true );
  292. flashArray.PushBackFlashObject( flashObjective );
  293. }
  294. }
  295. }
  296. for ( i = 0; i < objectives.Size(); i += 1 )
  297. {
  298. if ( objectives[ i ].status == JS_Active )
  299. {
  300. if ( objectives[ i ].objectiveEntry != highlightedObjective )
  301. {
  302. flashObjective = GetMenuFlashValueStorage().CreateTempFlashObject();
  303. flashObjective.SetMemberFlashString( "objectiveName", GetLocStringById( objectives[ i ].objectiveEntry.GetTitleStringId() ) + GetQuestObjectiveCounterText( objectives[ i ].objectiveEntry ) );
  304. flashObjective.SetMemberFlashInt( "objectiveScriptName", NameToFlashUInt( objectives[ i ].objectiveEntry.GetUniqueScriptTag() ) );
  305. flashObjective.SetMemberFlashBool( "highlighted", false );
  306. flashArray.PushBackFlashObject( flashObjective );
  307. }
  308. }
  309. }
  310.  
  311.  
  312.  
  313.  
  314.  
  315. m_flashValueStorage.SetFlashArray( "map.objectives", flashArray );
  316.  
  317.  
  318. }
  319.  
  320. private function UpdateDataWithSingleUserMapPin( indexToUpdate : int )
  321. {
  322. var l_flashArray : CScriptedFlashArray;
  323.  
  324. if ( indexToUpdate < 0 )
  325. {
  326. return;
  327. }
  328.  
  329. l_flashArray = GetMenuFlashValueStorage().CreateTempFlashArray();
  330.  
  331. UpdateUserMapPins( l_flashArray, indexToUpdate );
  332.  
  333. GetMenuFlashValueStorage().SetFlashArray( "worldmap.global.pins.dynamic", l_flashArray );
  334. }
  335.  
  336. private function UpdatePlayerPin( out flashArray : CScriptedFlashArray ) : void
  337. {
  338. var l_flashObject : CScriptedFlashObject;
  339. var position : Vector;
  340. var playerRotation : EulerAngles;
  341. var playerAngle : float;
  342. var cameraAngle : float;
  343. var commonMapManager : CCommonMapManager = theGame.GetCommonMapManager();
  344.  
  345. position = thePlayer.GetWorldPosition();
  346. cameraAngle = theCamera.GetCameraHeading();
  347. playerRotation = thePlayer.GetWorldRotation();
  348. playerAngle = -playerRotation.Yaw;
  349.  
  350. if ( playerAngle < 0 )
  351. {
  352. playerAngle += 360.0;
  353. }
  354.  
  355. l_flashObject = GetMenuFlashValueStorage().CreateTempFlashObject("red.game.witcher3.data.StaticMapPinData");
  356.  
  357. l_flashObject.SetMemberFlashUInt( "id", NameToFlashUInt( 'Player' ) );
  358. l_flashObject.SetMemberFlashInt( "areaId", m_shownArea );
  359. l_flashObject.SetMemberFlashInt( "journalAreaId", commonMapManager.GetJournalAreaByPosition( m_shownArea, position ) );
  360. l_flashObject.SetMemberFlashNumber( "posX", position.X );
  361. l_flashObject.SetMemberFlashNumber( "posY", position.Y );
  362. if ( (W3ReplacerCiri)thePlayer )
  363. {
  364. l_flashObject.SetMemberFlashString( "description", GetLocStringByKeyExt( "map_description_player_ciri"));
  365. l_flashObject.SetMemberFlashString( "label", GetLocStringByKeyExt( "map_location_player_ciri"));
  366. }
  367. else
  368. {
  369. l_flashObject.SetMemberFlashString( "description", GetLocStringByKeyExt( "map_description_player"));
  370. l_flashObject.SetMemberFlashString( "label", GetLocStringByKeyExt( "map_location_player"));
  371. }
  372. l_flashObject.SetMemberFlashString( "type", NameToString( 'Player' ) );
  373. l_flashObject.SetMemberFlashString( "filteredType", NameToString( 'Player' ) );
  374. l_flashObject.SetMemberFlashNumber( "radius", 0 );
  375. l_flashObject.SetMemberFlashBool( "isFastTravel", false );
  376. l_flashObject.SetMemberFlashBool( "isQuest", false );
  377. l_flashObject.SetMemberFlashBool( "isPlayer", true );
  378. l_flashObject.SetMemberFlashBool( "isUserPin",false );
  379. l_flashObject.SetMemberFlashNumber( "distance", 0 );
  380. l_flashObject.SetMemberFlashNumber( "rotation", playerAngle );
  381.  
  382. flashArray.PushBackFlashObject(l_flashObject);
  383. }
  384.  
  385. private function UpdateUserMapPins( out flashArray : CScriptedFlashArray, indexToUpdate : int ) : void
  386. {
  387. var manager : CCommonMapManager;
  388. var i, pinCount : int;
  389.  
  390. if ( indexToUpdate > -1 )
  391. {
  392. UpdateUserMapPin( indexToUpdate, flashArray );
  393. }
  394. else
  395. {
  396. manager = theGame.GetCommonMapManager();
  397. pinCount = manager.GetUserMapPinCount();
  398. for ( i = 0; i < pinCount; i += 1 )
  399. {
  400. UpdateUserMapPin( i, flashArray );
  401. }
  402. }
  403. }
  404.  
  405. private function UpdateUserMapPin( index : int, out flashArray : CScriptedFlashArray ) : void
  406. {
  407. var manager : CCommonMapManager = theGame.GetCommonMapManager();
  408. var l_flashObject : CScriptedFlashObject;
  409. var id, area, type : int;
  410. var position : Vector;
  411. var playerPosition : Vector = thePlayer.GetWorldPosition();
  412. var distanceFromPlayer : float = 0;
  413.  
  414. if ( !manager.GetUserMapPinByIndex( index, id, area, position.X, position.Y, type ) )
  415. {
  416. return;
  417. }
  418.  
  419. if ( area == AN_Prologue_Village_Winter )
  420. {
  421. area = AN_Prologue_Village;
  422. }
  423. if ( area != (int)m_shownArea )
  424. {
  425. return;
  426. }
  427.  
  428. if ( IsCurrentAreaShown() )
  429. {
  430. distanceFromPlayer = VecDistanceSquared2D( playerPosition, position );
  431. }
  432.  
  433. l_flashObject = GetMenuFlashValueStorage().CreateTempFlashObject("red.game.witcher3.data.StaticMapPinData");
  434.  
  435. position.Z = 0;
  436.  
  437. l_flashObject.SetMemberFlashUInt( "id", id );
  438. l_flashObject.SetMemberFlashNumber( "posX", position.X );
  439. l_flashObject.SetMemberFlashNumber( "posY", position.Y );
  440. l_flashObject.SetMemberFlashString( "description", GetLocStringByKeyExt( "map_description_user"));
  441. l_flashObject.SetMemberFlashString( "label", GetLocStringByKeyExt( "map_location_user"));
  442. l_flashObject.SetMemberFlashString( "type", NameToString( GetUserMapPinTypeByType( type ) ) );
  443. l_flashObject.SetMemberFlashString( "filteredType", NameToString( GetUserMapPinTypeByType( type ) ) );
  444. l_flashObject.SetMemberFlashNumber( "radius", 0 );
  445. l_flashObject.SetMemberFlashBool( "isFastTravel", false );
  446. l_flashObject.SetMemberFlashBool( "isQuest", false );
  447. l_flashObject.SetMemberFlashBool( "isPlayer", false );
  448. l_flashObject.SetMemberFlashBool( "isUserPin", true );
  449. l_flashObject.SetMemberFlashNumber( "distance", distanceFromPlayer );
  450. l_flashObject.SetMemberFlashNumber( "rotation", 0 );
  451.  
  452. flashArray.PushBackFlashObject(l_flashObject);
  453. }
  454.  
  455. function GetUserMapPinTypeByType( type : int ) : name
  456. {
  457. if ( type < 0 || type >= m_userPinNames.Size() )
  458. {
  459. return '';
  460. }
  461. return m_userPinNames[ type ];
  462. }
  463.  
  464. function ReinitializeMap()
  465. {
  466. m_fxReinitializeMap.InvokeSelf();
  467. }
  468.  
  469. function UpdateActiveAreas() : void
  470. {
  471. var pinsList : array< SAvailableFastTravelMapPin >;
  472. var curPin : SAvailableFastTravelMapPin;
  473. var availableAreas : array< bool >;
  474. var i : int;
  475.  
  476. for ( i = 0; i < EnumGetMax( 'EAreaName' ) + 1; i += 1 )
  477. {
  478. availableAreas.PushBack(false);
  479. }
  480.  
  481. pinsList = theGame.GetCommonMapManager().GetFastTravelPoints(true, true);
  482.  
  483. for ( i = 0; i < pinsList.Size(); i += 1 )
  484. {
  485. curPin = pinsList[i];
  486.  
  487. availableAreas[curPin.area] = true;
  488. }
  489.  
  490. m_flashValueStorage.SetFlashBool("universearea.kaermorhen.active", availableAreas[AN_Kaer_Morhen]);
  491. m_flashValueStorage.SetFlashBool("universearea.novigrad.active", availableAreas[AN_NMLandNovigrad]);
  492. m_flashValueStorage.SetFlashBool("universearea.nomansland.active", availableAreas[AN_NMLandNovigrad]);
  493. m_flashValueStorage.SetFlashBool("universearea.wyzima.active", availableAreas[AN_Wyzima]);
  494. m_flashValueStorage.SetFlashBool("universearea.prologvillage.active", availableAreas[AN_Prologue_Village]);
  495. m_flashValueStorage.SetFlashBool("universearea.skellige.active", availableAreas[AN_Skellige_ArdSkellig]);
  496. m_flashValueStorage.SetFlashBool("universearea.toussaint.active", availableAreas[AN_Dlc_Bob]);
  497. }
  498.  
  499. function UpdateEntityPins( out flashArray : CScriptedFlashArray ) : void
  500. {
  501. var worldPath : string;
  502. var mapPinInstances : array< SCommonMapPinInstance >;
  503. var mapPinInstancesCount : int;
  504. var pin : SCommonMapPinInstance;
  505. var i : int;
  506. var l_flashObject : CScriptedFlashObject;
  507. var canShowKnownEntities : bool;
  508. var canShowDisabledEntities : bool;
  509. var commonMapManager : CCommonMapManager = theGame.GetCommonMapManager();
  510. var playerPosition : Vector = thePlayer.GetWorldPosition();
  511. var distanceFromPlayer : float = 0;
  512.  
  513. worldPath = commonMapManager.GetWorldPathFromAreaType( m_shownArea );
  514.  
  515. mapPinInstances = commonMapManager.GetMapPinInstances( worldPath );
  516. mapPinInstancesCount = mapPinInstances.Size();
  517.  
  518. canShowKnownEntities = commonMapManager.CanShowKnownEntities();
  519. canShowDisabledEntities = commonMapManager.CanShowDisabledEntities();
  520.  
  521. for ( i = 0; i < mapPinInstancesCount; i += 1 )
  522. {
  523. pin = mapPinInstances[ i ];
  524.  
  525. if ( !pin.isDiscovered && !pin.isKnown )
  526. {
  527. continue;
  528. }
  529.  
  530. if ( pin.type == 'NPC' ||
  531. pin.type == 'Enemy' ||
  532. pin.type == 'EnemyDead' ||
  533. pin.type == 'GenericFocus' ||
  534. pin.type == 'Rift' ||
  535. pin.type == 'PointOfInterestMappin' ||
  536. pin.type == 'Teleport' ||
  537. pin.type == 'HorseRaceTarget' ||
  538. pin.type == 'HorseRaceDummy' )
  539. {
  540. continue;
  541. }
  542. if ( commonMapManager.IsUserPinType( pin.type ) )
  543. {
  544.  
  545. continue;
  546. }
  547.  
  548. if ( thePlayer.IsSailing() )
  549. {
  550. if ( pin.type == 'RoadSign' )
  551. {
  552. continue;
  553. }
  554. }
  555. else
  556. {
  557. if ( pin.type == 'Harbor' )
  558. {
  559. continue;
  560. }
  561. }
  562.  
  563. if ( pin.visibleType == 'NotDiscoveredPOI' && !canShowKnownEntities )
  564. {
  565. continue;
  566. }
  567. if ( pin.visibleType != 'PlaceOfPowerDisabled' && pin.isDisabled && !canShowDisabledEntities )
  568. {
  569. continue;
  570. }
  571.  
  572. if ( m_shownArea == (EAreaName)AN_Dlc_Bob )
  573. {
  574.  
  575. if ( pin.position.X > 1200 &&
  576. pin.position.Y > 800 &&
  577. pin.type != 'User1' &&
  578. pin.type != 'User2' &&
  579. pin.type != 'User3' &&
  580. pin.type != 'User4' )
  581. {
  582. continue;
  583. }
  584.  
  585. if ( pin.tag == 'mq7024_mutagen_dismantling_table' ||
  586. pin.tag == 'mq7024_alchemy_table' ||
  587. pin.tag == 'corvo_bianvo_bookshelf_poor' ||
  588. pin.tag == 'witcherBed' ||
  589. pin.tag == 'corvo_bianco_stables' ||
  590. pin.tag == 'mq7024_whetstone' ||
  591. pin.tag == 'mq7024_armor_table' )
  592. {
  593. continue;
  594. }
  595. }
  596.  
  597. if ( IsCurrentAreaShown() )
  598. {
  599. distanceFromPlayer = VecDistanceSquared2D( playerPosition, pin.position );
  600. }
  601.  
  602. l_flashObject = GetMenuFlashValueStorage().CreateTempFlashObject( "red.game.witcher3.data.StaticMapPinData" );
  603. l_flashObject.SetMemberFlashUInt( "id", NameToFlashUInt( pin.tag ) );
  604. l_flashObject.SetMemberFlashUInt( "areaId", m_shownArea);
  605. l_flashObject.SetMemberFlashInt( "journalAreaId", commonMapManager.GetJournalAreaByPosition( m_shownArea, pin.position ) );
  606. l_flashObject.SetMemberFlashNumber( "posX", pin.position.X );
  607. l_flashObject.SetMemberFlashNumber( "posY", pin.position.Y );
  608.  
  609. l_flashObject.SetMemberFlashString( "type", NameToString( pin.visibleType ) + GetPinTypePostfix( pin ) );
  610. l_flashObject.SetMemberFlashString( "filteredType", NameToString( pin.visibleType ) );
  611. l_flashObject.SetMemberFlashNumber( "radius", pin.visibleRadius );
  612. l_flashObject.SetMemberFlashBool( "isFastTravel", pin.type == 'RoadSign' || pin.type == 'Harbor' );
  613. l_flashObject.SetMemberFlashBool( "isQuest", commonMapManager.IsQuestPinType( pin.type ) );
  614. l_flashObject.SetMemberFlashBool( "isPlayer", false );
  615. l_flashObject.SetMemberFlashBool( "isUserPin",false );
  616. l_flashObject.SetMemberFlashNumber( "distance", distanceFromPlayer );
  617. AddPinTypeData(l_flashObject, pin);
  618. flashArray.PushBackFlashObject(l_flashObject);
  619. }
  620. }
  621.  
  622. private function GetPinTypePostfix( pin : SCommonMapPinInstance ) : string
  623. {
  624. if ( pin.alternateVersion > 0 && !pin.isDisabled )
  625. {
  626. return "_" + pin.alternateVersion;
  627. }
  628. return "";
  629. }
  630.  
  631. private function AddPinTypeData(out dataObject : CScriptedFlashObject, targetPin: SCommonMapPinInstance) : void
  632. {
  633. var definitionManager : CDefinitionsManagerAccessor = theGame.GetDefinitionsManager();
  634. var journalManager:CWitcherJournalManager;
  635. var questMappins:array<CJournalBase>;
  636. var questObjectives:array<CJournalBase>;
  637. var curQuestMappin:CJournalQuestMapPin;
  638. var curObjective:CJournalQuestObjective;
  639. var curQuest:CJournalQuest;
  640.  
  641. var isTracked:bool;
  642. var label:string;
  643. var description:string;
  644.  
  645. label = "";
  646. description = "";
  647. switch (targetPin.visibleType)
  648. {
  649.  
  650.  
  651.  
  652.  
  653. case 'StoryQuest':
  654. case 'ChapterQuest':
  655. case 'SideQuest':
  656. case 'MonsterQuest':
  657. case 'TreasureQuest':
  658.  
  659. case 'QuestReturn':
  660. case 'HorseRace':
  661. case 'BoatRace':
  662. case 'QuestBelgard':
  663. case 'QuestCoronata':
  664. case 'QuestVermentino':
  665. journalManager = theGame.GetJournalManager();
  666. curObjective = (CJournalQuestObjective)journalManager.GetEntryByGuid( targetPin.guid );
  667. if ( curObjective )
  668. {
  669. curQuest = curObjective.GetParentQuest();
  670.  
  671. label = GetLocStringById( curQuest.GetTitleStringId() );
  672. description = GetLocStringById( curObjective.GetTitleStringId() ) + GetQuestObjectiveCounterText( curObjective );
  673. isTracked = journalManager.GetTrackedQuest().guid == curQuest.guid;
  674.  
  675. dataObject.SetMemberFlashBool( "tracked", isTracked );
  676. dataObject.SetMemberFlashBool( "highlighted", targetPin.isHighlighted );
  677.  
  678. }
  679. break;
  680.  
  681. case 'Horse':
  682. case 'Rift':
  683. case 'Teleport':
  684. case 'QuestAvailable':
  685. case 'QuestAvailableHoS':
  686. case 'QuestAvailableBaW':
  687. case 'MagicLamp':
  688. case 'Whetstone':
  689. case 'Entrance':
  690.  
  691. case 'NotDiscoveredPOI':
  692. label = GetLocStringByKeyExt( StrLower("map_location_" + targetPin.visibleType) );
  693. description = GetLocStringByKeyExt( StrLower("map_description_" + targetPin.visibleType) );
  694. break;
  695.  
  696.  
  697. case 'MonsterNest':
  698. case 'MonsterNestDisabled':
  699. case 'InfestedVineyard':
  700. case 'InfestedVineyardDisabled':
  701. case 'PlaceOfPower':
  702. case 'PlaceOfPowerDisabled':
  703. case 'TreasureHuntMappin':
  704. case 'TreasureHuntMappinDisabled':
  705. case 'SpoilsOfWar':
  706. case 'SpoilsOfWarDisabled':
  707. case 'BanditCamp':
  708. case 'BanditCampDisabled':
  709. case 'BanditCampfire':
  710. case 'BanditCampfireDisabled':
  711. case 'BossAndTreasure':
  712. case 'BossAndTreasureDisabled':
  713. case 'Contraband':
  714. case 'ContrabandDisabled':
  715. case 'ContrabandShip':
  716. case 'ContrabandShipDisabled':
  717. case 'RescuingTown':
  718. case 'RescuingTownDisabled':
  719. case 'DungeonCrawl':
  720. case 'DungeonCrawlDisabled':
  721. case 'Hideout':
  722. case 'HideoutDisabled':
  723. case 'Plegmund':
  724. case 'PlegmundDisabled':
  725. case 'KnightErrant':
  726. case 'KnightErrantDisabled':
  727. case 'WineContract':
  728. case 'WineContractDisabled':
  729. case 'SignalingStake':
  730. case 'SignalingStakeDisabled':
  731.  
  732.  
  733.  
  734. case 'AlchemyTable':
  735. case 'MutagenDismantle':
  736. case 'Stables':
  737. case 'Bookshelf':
  738. case 'Bed':
  739. label = GetLocStringByKeyExt( StrLower("map_location_" + targetPin.type) );
  740. description = GetLocStringByKeyExt( StrLower("map_description_" + targetPin.type) );
  741. break;
  742.  
  743.  
  744.  
  745. case 'PlayerStash':
  746. case 'PlayerStashDiscoverable':
  747. label = GetLocStringByKeyExt( "map_location_playerstash" );
  748. description = GetLocStringByKeyExt( "map_description_playerstash" );
  749. break;
  750.  
  751.  
  752.  
  753. case 'Shopkeeper':
  754. case 'Blacksmith':
  755. case 'Armorer':
  756.  
  757. case 'Hairdresser':
  758. label = GetLocStringByKeyExt( StrLower("map_location_" + targetPin.type) );
  759. description = GetLocStringByKeyExt( StrLower("map_description_" + targetPin.type) );
  760. break;
  761. case 'Alchemic':
  762. label = GetLocStringByKeyExt( StrLower("map_location_alchemic") );
  763. description = GetLocStringByKeyExt( StrLower("map_description_alchemic") );
  764. break;
  765. case 'Herbalist':
  766. label = GetLocStringByKeyExt( StrLower("herbalist") );
  767. description = GetLocStringByKeyExt( StrLower("map_description_alchemic") );
  768. break;
  769. case 'Innkeeper':
  770. label = GetLocStringById( 175619 );
  771. description = GetLocStringByKeyExt( StrLower("map_description_shopkeeper") );
  772. break;
  773. case 'Enchanter':
  774. label = GetLocStringByKeyExt( "panel_map_enchanter_pin_name" );
  775. description = GetLocStringByKeyExt( "panel_map_enchanter_pin_description" );
  776. break;
  777.  
  778.  
  779.  
  780. case 'Torch':
  781. label = GetLocStringByKeyExt( "map_location_torch" );
  782. description = GetLocStringByKeyExt( "map_description_torch" );
  783. break;
  784.  
  785.  
  786.  
  787. case 'Prostitute':
  788. label = GetLocStringByKeyExt( "novigrad_courtisan" );
  789. description = GetLocStringByKeyExt( "map_description_prostitute" );
  790. break;
  791.  
  792.  
  793.  
  794. case 'ArmorRepairTable':
  795. label = GetLocStringByKeyExt( "map_location_armor_repair_table" );
  796. description = GetLocStringByKeyExt( "map_description_armor_repair_table" );
  797. break;
  798.  
  799.  
  800.  
  801. case 'Herb':
  802. label = GetLocStringByKeyExt( definitionManager.GetItemLocalisationKeyName( targetPin.tag ) );
  803. description = GetLocStringByKeyExt( definitionManager.GetItemLocalisationKeyDesc( targetPin.tag ) );
  804. break;
  805.  
  806.  
  807.  
  808. case 'RoadSign':
  809. label = GetLocStringByKeyExt( StrLower("map_location_" + targetPin.tag ) );
  810. description = GetLocStringByKeyExt( StrLower("map_description_" + targetPin.tag ) );
  811. break;
  812.  
  813.  
  814.  
  815. case 'NoticeBoard':
  816. case 'NoticeBoardFull':
  817. label = GetLocStringByKeyExt( StrLower("map_location_noticeboard" ) );
  818. description = GetLocStringByKeyExt( StrLower("map_description_noticeboard" ) );
  819. break;
  820.  
  821.  
  822.  
  823. case 'Boat':
  824. label = GetLocStringByKeyExt( StrLower("panel_hud_boat" ) );
  825. description = GetLocStringByKeyExt("map_description_player_boat");
  826. break;
  827.  
  828.  
  829.  
  830. default:
  831. if ( targetPin.customNameId != 0 )
  832. {
  833. label = GetLocStringById( targetPin.customNameId );
  834. description = "";
  835. }
  836. else
  837. {
  838. label = GetLocStringByKeyExt( StrLower("map_location_" + targetPin.visibleType) );
  839. description = GetLocStringByKeyExt( StrLower("map_description_" + targetPin.visibleType) );
  840. }
  841. break;
  842. }
  843.  
  844. dataObject.SetMemberFlashString( "label", label );
  845. dataObject.SetMemberFlashString( "description", description );
  846. }
  847.  
  848. event OnToggleMinimap( previewMode : int )
  849. {
  850. var value : string;
  851.  
  852. value = IntToString( previewMode );
  853. theGame.GetInGameConfigWrapper().SetVarValue('Hidden', 'WorldMapPreviewMode', value );
  854. theGame.SaveUserSettings();
  855. }
  856.  
  857. event OnDisablePin( pinName : string, disable : bool )
  858. {
  859. theGame.GetCommonMapManager().DisableMapPin( pinName, disable );
  860. }
  861.  
  862. event OnPinch( value : float )
  863. {
  864.  
  865. LogChannel( 'Gui', "CR4MapMenu::OnPinch " + value );
  866. }
  867.  
  868. event OnClosingMenu()
  869. {
  870. var initData : W3MapInitData;
  871. SaveStateData();
  872. theGame.GetGuiManager().SetLastOpenedCommonMenuName( GetMenuName() );
  873.  
  874. initData = (W3MapInitData)GetMenuInitData();
  875. if ( initData )
  876. {
  877. if ( initData && initData.GetTriggeredExitEntity() )
  878. {
  879. thePlayer.OnTeleportPlayerToPlayableArea( true );
  880. }
  881. }
  882.  
  883. super.OnClosingMenu();
  884. }
  885.  
  886. event OnCloseMenu()
  887. {
  888. if( m_parentMenu )
  889. {
  890. m_parentMenu.ChildRequestCloseMenu();
  891. }
  892.  
  893. CloseMenu();
  894. }
  895.  
  896. function SaveStateData()
  897. {
  898. switch(m_menuState)
  899. {
  900. case 'Objectives':
  901. case 'FastTravel':
  902. m_guiManager.UpdateUISavedData( m_menuState, UISavedData.openedCategories, currentTag, UISavedData.selectedModule );
  903. break;
  904. case 'GlobalMap':
  905. return;
  906. }
  907. }
  908.  
  909. event OnSwitchToWorldMap()
  910. {
  911. var continentMapState : W3TutorialManagerUIHandlerStateContinentMap;
  912.  
  913. LogChannel('WORLDMAP',"OnSwitchToWorldMap" );
  914. SetMapTitle(GetLocStringByKeyExt("panel_map_title_worldmap"));
  915. UpdateInputFeedback();
  916.  
  917. if( ShouldProcessTutorial( 'TutorialMapBackToHub' ) )
  918. {
  919. continentMapState = ( W3TutorialManagerUIHandlerStateContinentMap ) theGame.GetTutorialSystem().uiHandler.GetCurrentState();
  920. if( continentMapState )
  921. {
  922. continentMapState.OnWentToContinentMap();
  923. }
  924. }
  925. }
  926.  
  927. event OnSwitchToHubMap( areaName : string )
  928. {
  929. var areaType : EAreaName;
  930. areaType = AreaNameToType( areaName );
  931. SwitchToHubMap(areaType, false);
  932. }
  933.  
  934. function GetAreaDefaultPosition( areaId : int, out x : float, out y : float ) : void
  935. {
  936. switch ( areaId )
  937. {
  938. case AN_NMLandNovigrad:
  939. x = -150;
  940. y = 450;
  941. break;
  942. case AN_Velen:
  943. x = -300;
  944. y = -100;
  945. break;
  946. default:
  947. x = -1;
  948. y = -1;
  949. }
  950. }
  951.  
  952. event OnHighlightNextObjective()
  953. {
  954. var highlightedObjective : CJournalQuestObjective;
  955. var objectives : array< SJournalQuestObjectiveData >;
  956. var i, newIndex : int;
  957. var journalManager : CWitcherJournalManager;
  958.  
  959. journalManager = theGame.GetJournalManager();
  960. journalManager.GetTrackedQuestObjectivesData( objectives );
  961. highlightedObjective = journalManager.GetHighlightedObjective();
  962.  
  963. for ( i = objectives.Size() - 1; i >= 0; i -= 1 )
  964. {
  965. if ( objectives[ i ].status != JS_Active )
  966. {
  967. objectives.Erase( i );
  968. }
  969. }
  970. if ( objectives.Size() < 2 )
  971. {
  972. return false;
  973. }
  974. for ( i = 0; i < objectives.Size(); i += 1 )
  975. {
  976. if ( objectives[ i ].objectiveEntry == highlightedObjective )
  977. {
  978. newIndex = ( i + 1 ) % objectives.Size();
  979. SetHighlightedObjective( objectives[ newIndex ].objectiveEntry );
  980. return true;
  981. }
  982. }
  983. }
  984.  
  985.  
  986. event OnHighlightObjective( tag : name )
  987. {
  988. var l_objective : CJournalQuestObjective;
  989. var journalManager : CWitcherJournalManager;
  990.  
  991. journalManager = theGame.GetJournalManager();
  992. l_objective = (CJournalQuestObjective)journalManager.GetEntryByTag( tag );
  993. if ( l_objective && journalManager.GetEntryStatus( l_objective ) == JS_Active )
  994. {
  995. SetHighlightedObjective( l_objective );
  996. }
  997. }
  998.  
  999. private function SetHighlightedObjective( objective : CJournalQuestObjective )
  1000. {
  1001. var highlightedMapPinTag : name;
  1002.  
  1003. LogChannel('asdf', "H BEFORE " + theGame.GetCommonMapManager().GetHighlightedMapPinTag() );
  1004. if ( theGame.GetJournalManager().SetHighlightedObjective( objective ) )
  1005. {
  1006. UpdateCurrentQuestData( true );
  1007.  
  1008. highlightedMapPinTag = theGame.GetCommonMapManager().GetHighlightedMapPinTag();
  1009.  
  1010. m_fxSetHighlightedMapPin.InvokeSelfOneArg( FlashArgUInt( NameToFlashUInt( highlightedMapPinTag ) ) );
  1011.  
  1012. }
  1013. LogChannel('asdf', "H AFTER " + theGame.GetCommonMapManager().GetHighlightedMapPinTag() );
  1014. }
  1015.  
  1016.  
  1017. event OnTrackQuest( tag : name )
  1018. {
  1019. var journalManager : CWitcherJournalManager;
  1020. var l_quest : CJournalBase;
  1021.  
  1022. journalManager = theGame.GetJournalManager();
  1023. l_quest = journalManager.GetEntryByTag(tag);
  1024. journalManager.SetTrackedQuest( l_quest );
  1025. }
  1026.  
  1027.  
  1028.  
  1029. function SwitchToHubMap( area : EAreaName, onStartup : bool )
  1030. {
  1031. var manager : CCommonMapManager = theGame.GetCommonMapManager();
  1032. var journalArea : EAreaName;
  1033. var originArea : EAreaName;
  1034.  
  1035. originArea = area;
  1036.  
  1037. if ( area == AN_Undefined )
  1038. {
  1039.  
  1040. return;
  1041. }
  1042.  
  1043.  
  1044.  
  1045.  
  1046.  
  1047.  
  1048. if ( area == AN_Velen || area == AN_NMLandNovigrad )
  1049. {
  1050.  
  1051. if ( m_currentArea == AN_NMLandNovigrad )
  1052. {
  1053.  
  1054. journalArea = manager.GetCurrentJournalArea();
  1055. }
  1056. else
  1057. {
  1058.  
  1059. journalArea = area;
  1060. }
  1061.  
  1062.  
  1063. area = AN_NMLandNovigrad;
  1064. }
  1065. else
  1066. {
  1067.  
  1068. journalArea = area;
  1069. }
  1070.  
  1071. SetMapTitle( GetLocStringByKeyExt( manager.GetLocalisationNameFromAreaType( journalArea ) ) );
  1072. SetCurrentAreaId( originArea, onStartup );
  1073. UpdateDefaultPosition(originArea);
  1074. UpdateInputFeedback();
  1075.  
  1076. if ( area == m_shownArea )
  1077. {
  1078. ReinitializeMap();
  1079. }
  1080. else
  1081. {
  1082. m_shownArea = area;
  1083. UpdateTitle();
  1084. UpdateMapSettings();
  1085. UpdateData();
  1086. }
  1087. }
  1088.  
  1089. event OnEntrySelected( tag : name )
  1090. {
  1091. LogChannel('WORLDMAP', "OnEntrySelected tag: "+tag+" area: ");
  1092. currentTag = tag;
  1093. }
  1094.  
  1095. event OnSwitchToInterior( )
  1096. {
  1097. LogChannel('WORLDMAP', "OnSwitchToInterior" );
  1098. }
  1099.  
  1100. event OnUserMapPinSet( posX : float, posY : float, type : int, fromSelectionPanel : bool )
  1101. {
  1102. var manager : CCommonMapManager = theGame.GetCommonMapManager();
  1103. var worldPath : string;
  1104. var realShownArea : EAreaName;
  1105. var area : int;
  1106. var position : Vector;
  1107. var idToAdd, idToRemove, indexToAdd : int;
  1108. var realType : int;
  1109.  
  1110. idToAdd = 0;
  1111. idToRemove = 0;
  1112.  
  1113. if ( m_currentArea == m_shownArea )
  1114. {
  1115. worldPath = theGame.GetWorld().GetDepotPath();
  1116. realShownArea = manager.GetAreaFromWorldPath( worldPath, true );
  1117. }
  1118. else
  1119. {
  1120. realShownArea = m_shownArea;
  1121. }
  1122.  
  1123. position.X = posX;
  1124. position.Y = posY;
  1125. position.Z = 0;
  1126.  
  1127. realType = type;
  1128. if ( fromSelectionPanel )
  1129. {
  1130. realType += 1;
  1131. }
  1132. if ( !manager.ToggleUserMapPin( (int)realShownArea, position, realType, fromSelectionPanel, idToAdd, idToRemove ) )
  1133. {
  1134. showNotification( GetLocStringByKeyExt("panel_hud_message_actionnotallowed") );
  1135. }
  1136.  
  1137.  
  1138. if ( idToRemove != 0 )
  1139. {
  1140. m_fxRemoveUserMapPin.InvokeSelfOneArg( FlashArgUInt( idToRemove ) );
  1141. }
  1142. if ( idToAdd != 0 )
  1143. {
  1144. indexToAdd = manager.GetUserMapPinIndexById( idToAdd );
  1145. if ( indexToAdd >= 0 )
  1146. {
  1147. UpdateDataWithSingleUserMapPin( indexToAdd );
  1148. theSound.SoundEvent("gui_hubmap_mark_pin");
  1149. }
  1150. }
  1151. }
  1152.  
  1153. event OnStaticMapPinUsed( pinTag : name, areaId : int)
  1154. {
  1155. var initData : W3MapInitData;
  1156. var manager : CCommonMapManager = theGame.GetCommonMapManager();
  1157. var fastTravelEntity : W3FastTravelEntity;
  1158. var loadingInitData : W3MenuInitData;
  1159. var contentTag : name;
  1160. var progress : float;
  1161. var rootMenu : CR4Menu;
  1162.  
  1163. manager = theGame.GetCommonMapManager();
  1164. if ( !manager )
  1165. {
  1166. return false;
  1167. }
  1168.  
  1169. if ( !manager.IsWorldAvailable( areaId ) )
  1170. {
  1171. contentTag = manager.GetWorldContentTag( areaId );
  1172. progress = theGame.ProgressToContentAvailable(contentTag);
  1173. theSound.SoundEvent("gui_global_denied");
  1174. theGame.GetGuiManager().ShowProgressDialog(0, "", "panel_map_cannot_travel_downloading_content", true, UDB_Ok, progress, UMPT_Content, contentTag);
  1175. return false;
  1176. }
  1177.  
  1178. if( !thePlayer.IsActionAllowed( EIAB_FastTravel ) )
  1179. {
  1180. showNotification( GetLocStringByKeyExt("panel_hud_message_actionnotallowed") );
  1181. OnPlaySoundEvent("gui_global_denied");
  1182. return false;
  1183. }
  1184.  
  1185. if ( m_currentArea != areaId )
  1186. {
  1187. if ( !thePlayer.IsActionAllowed( EIAB_FastTravelGlobal ) )
  1188. {
  1189. theSound.SoundEvent("gui_global_denied");
  1190. showNotification( GetLocStringByKeyExt("panel_hud_message_actionnotallowed") );
  1191. return false;
  1192. }
  1193. }
  1194.  
  1195. if ( manager.IsEntityMapPinDisabled( pinTag ) )
  1196. {
  1197. theSound.SoundEvent("gui_global_denied");
  1198. showNotification( GetLocStringByKeyExt("panel_hud_message_actionnotallowed") );
  1199. return false;
  1200. }
  1201.  
  1202. if ( !manager.DBG_IsAllowedFT() )
  1203. {
  1204. if ( thePlayer.IsSailing() )
  1205. {
  1206.  
  1207. initData = (W3MapInitData)GetMenuInitData();
  1208. if ( initData && initData.GetTriggeredExitEntity() )
  1209. {
  1210.  
  1211. initData.SetTriggeredExitEntity( false );
  1212. }
  1213. }
  1214. else
  1215. {
  1216. initData = (W3MapInitData)GetMenuInitData();
  1217. if ( !initData )
  1218. {
  1219. showNotification( GetLocStringByKeyExt("panel_map_cannot_travel") );
  1220. OnPlaySoundEvent("gui_global_denied");
  1221. return false;
  1222. }
  1223. fastTravelEntity = (W3FastTravelEntity)initData.GetUsedFastTravelEntity();
  1224. if (fastTravelEntity && fastTravelEntity.entityName == pinTag)
  1225. {
  1226. showNotification( GetLocStringByKeyExt("panel_map_cannot_travel_already_here") );
  1227. OnPlaySoundEvent("gui_global_denied");
  1228. return false;
  1229. }
  1230. if ( initData.GetTriggeredExitEntity() )
  1231. {
  1232.  
  1233. initData.SetTriggeredExitEntity( false );
  1234. }
  1235. }
  1236. }
  1237.  
  1238. manager.UseMapPin( pinTag, true );
  1239.  
  1240.  
  1241. if (areaId == -1)
  1242. {
  1243. areaId == m_shownArea;
  1244. }
  1245.  
  1246. //LongJourneyCostMoney begin
  1247. if ( m_currentArea == areaId )
  1248. {
  1249. if ( thePlayer.GetInventory().GetMoney() >= 75 || thePlayer.IsUsingBoat() )
  1250. {
  1251. manager.PerformLocalFastTravelTeleport( pinTag );
  1252. if (!thePlayer.IsUsingBoat())
  1253. thePlayer.GetInventory().RemoveMoney(75);
  1254. theGame.Unpause("menus");
  1255. if ( !theGame.IsGameTimePaused() )
  1256. {
  1257. theGame.SetGameTime( theGame.GetGameTime() + GameTimeCreate(0, RoundF( RandF() * 4 ), RoundF( RandF() * 60 ), RoundF( RandF() * 60 ) ), true);
  1258. }
  1259. }
  1260. else
  1261. {
  1262. thePlayer.DisplayHudMessage("Not enough money to fast travel.");
  1263. }
  1264. }
  1265. else
  1266. {
  1267. if ( thePlayer.GetInventory().GetMoney() >= 350 )
  1268. {
  1269. manager.PerformGlobalFastTravelTeleport( m_shownArea, pinTag );
  1270. thePlayer.GetInventory().RemoveMoney(350);
  1271. theGame.Unpause("menus");
  1272. if ( !theGame.IsGameTimePaused() )
  1273. {
  1274. theGame.SetGameTime( theGame.GetGameTime() + GameTimeCreate(0, RoundF( RandF() * 10 ), RoundF( RandF() * 60 ), RoundF( RandF() * 60 ) ), true);
  1275. }
  1276. }
  1277. else
  1278. {
  1279. thePlayer.DisplayHudMessage("Not enough money to fast travel.");
  1280. }
  1281. }
  1282. //LongJourneyCostMoney end
  1283.  
  1284. rootMenu = theGame.GetGuiManager().GetRootMenu();
  1285. if ( rootMenu )
  1286. {
  1287. rootMenu.CloseMenu();
  1288. }
  1289. return true;
  1290. }
  1291.  
  1292. function UpdateTitle()
  1293. {
  1294. GetMenuFlashValueStorage().SetFlashString("worldmap.title.set", GetMapTitle(), -1 );
  1295. }
  1296.  
  1297. private function UpdateDefaultPosition( areaId : int )
  1298. {
  1299. var defX, defY : float;
  1300.  
  1301. GetAreaDefaultPosition(areaId, defX, defY);
  1302. m_fxSetDefaultPosition.InvokeSelfTwoArgs( FlashArgNumber(defX), FlashArgNumber(defY) );
  1303. }
  1304.  
  1305. private function UpdateMapSettings()
  1306. {
  1307. var mapSize : float;
  1308. var tileCount : int;
  1309. var textureSize : int;
  1310. var imagePath : string;
  1311. var minLod : int;
  1312. var maxLod : int;
  1313. var vminX, vmaxX, vminY, vmaxY : int;
  1314. var sminX, smaxX, sminY, smaxY : int;
  1315. var gradientScale : float;
  1316. var previewAvailable : bool;
  1317. var previewModeString : string;
  1318. var previewMode : int;
  1319. var minZoom, maxZoom : float;
  1320. var zoom12, zoom23, zoom34 : float;
  1321.  
  1322. mapSize = theGame.GetMiniMapSize( m_shownArea );
  1323. tileCount = theGame.GetMiniMapTileCount( m_shownArea );
  1324. textureSize = theGame.GetMiniMapTextureSize( m_shownArea );
  1325. minLod = theGame.GetMiniMapMinLod( m_shownArea );
  1326. maxLod = theGame.GetMiniMapMaxLod( m_shownArea );
  1327.  
  1328. vminX = theGame.GetMiniMapVminX( m_shownArea );
  1329. vmaxX = theGame.GetMiniMapVmaxX( m_shownArea );
  1330. vminY = theGame.GetMiniMapVminY( m_shownArea );
  1331. vmaxY = theGame.GetMiniMapVmaxY( m_shownArea );
  1332.  
  1333. sminX = theGame.GetMiniMapSminX( m_shownArea );
  1334. smaxX = theGame.GetMiniMapSmaxX( m_shownArea );
  1335. sminY = theGame.GetMiniMapSminY( m_shownArea );
  1336. smaxY = theGame.GetMiniMapSmaxY( m_shownArea );
  1337.  
  1338. minZoom = theGame.GetMiniMapMinZoom( m_shownArea );
  1339. maxZoom = theGame.GetMiniMapMaxZoom( m_shownArea );
  1340. zoom12 = theGame.GetMiniMapZoom12( m_shownArea );
  1341. zoom23 = theGame.GetMiniMapZoom23( m_shownArea );
  1342. zoom34 = theGame.GetMiniMapZoom34( m_shownArea );
  1343.  
  1344. gradientScale = theGame.GetGradientScale( m_shownArea );
  1345.  
  1346. previewAvailable = theGame.GetPreviewHeight( m_shownArea ) > 0;
  1347. previewModeString = theGame.GetInGameConfigWrapper().GetVarValue('Hidden', 'WorldMapPreviewMode' );
  1348. if ( StrLen( previewModeString ) > 0 )
  1349. {
  1350. previewMode = StringToInt( previewModeString );
  1351. }
  1352. if ( previewMode == 0)
  1353. {
  1354. previewMode = 1;
  1355. }
  1356.  
  1357.  
  1358. imagePath = GetShownMapName();
  1359.  
  1360. m_fxSetMapZooms.InvokeSelfFiveArgs( FlashArgNumber( minZoom ), FlashArgNumber( maxZoom ), FlashArgNumber( zoom12 ), FlashArgNumber( zoom23 ), FlashArgNumber( zoom34 ) );
  1361. m_fxSetMapVisibilityBoundaries.InvokeSelfFiveArgs( FlashArgInt( vminX ), FlashArgInt( vmaxX ), FlashArgInt( vminY ), FlashArgInt( vmaxY ), FlashArgNumber( gradientScale ) );
  1362. m_fxSetMapScrollingBoundaries.InvokeSelfFourArgs( FlashArgInt( sminX ), FlashArgInt( smaxX ), FlashArgInt( sminY ), FlashArgInt( smaxY ) );
  1363. m_fxSetMapSettings.InvokeSelfEightArgs( FlashArgNumber( mapSize ), FlashArgInt( tileCount ), FlashArgInt( textureSize ), FlashArgInt( minLod ), FlashArgInt( maxLod ), FlashArgString( imagePath ), FlashArgBool( previewAvailable ), FlashArgInt( previewMode ) );
  1364. }
  1365.  
  1366. function GetShownMapName() : string
  1367. {
  1368. var manager : CCommonMapManager = theGame.GetCommonMapManager();
  1369.  
  1370. return manager.GetMapName( m_shownArea );
  1371. }
  1372.  
  1373. function GetMapTitle() : string
  1374. {
  1375. var manager : CCommonMapManager = theGame.GetCommonMapManager();
  1376.  
  1377. return manager.GetLocalisationNameFromAreaType( m_shownArea );
  1378. }
  1379.  
  1380. function GetShownMapType() : int
  1381. {
  1382. return m_shownArea;
  1383. }
  1384.  
  1385. function IsCurrentAreaShown() : bool
  1386. {
  1387. return m_currentArea == m_shownArea;
  1388. }
  1389.  
  1390. event OnSkipPressed()
  1391. {
  1392. OnCloseMenu();
  1393. }
  1394.  
  1395. event OnCategoryOpened( categoryName : name, opened : bool )
  1396. {
  1397. var i : int;
  1398. if( categoryName == 'None' )
  1399. {
  1400. return false;
  1401. }
  1402. if( opened )
  1403. {
  1404. if( UISavedData.openedCategories.FindFirst(categoryName) == -1 )
  1405. {
  1406. UISavedData.openedCategories.PushBack(categoryName);
  1407. }
  1408. }
  1409. else
  1410. {
  1411. i = UISavedData.openedCategories.FindFirst(categoryName);
  1412. if( i > -1 )
  1413. {
  1414. UISavedData.openedCategories.Erase(i);
  1415. }
  1416. }
  1417. }
  1418.  
  1419. public function EnableDebugMode( enable : bool )
  1420. {
  1421. m_fxEnableDebugMode.InvokeSelfOneArg( FlashArgBool( enable ) );
  1422. }
  1423.  
  1424. public function EnableUnlimitedZoom( enable : bool )
  1425. {
  1426. m_fxEnableUnlimitedZoom.InvokeSelfOneArg( FlashArgBool( enable ) );
  1427. }
  1428.  
  1429. public function EnableManualLod( enable : bool )
  1430. {
  1431. m_fxEnableManualLod.InvokeSelfOneArg( FlashArgBool( enable ) );
  1432. }
  1433.  
  1434. public function ShowBorders( show : bool )
  1435. {
  1436. m_fxShowBorders.InvokeSelfOneArg( FlashArgBool( show ) );
  1437. }
  1438.  
  1439. function PlayOpenSoundEvent()
  1440. {
  1441.  
  1442.  
  1443. }
  1444.  
  1445. event OnDebugTeleportToHighlightedMappin( posX : float , posY : float )
  1446. {
  1447. if( !theGame.IsFinalBuild() )
  1448. {
  1449. thePlayer.DebugTeleportToPin( posX , posY );
  1450. }
  1451. }
  1452. }
  1453.  
  1454. exec function map_debug( enable : bool )
  1455. {
  1456. var manager : CR4GuiManager;
  1457. var rootMenu : CR4Menu;
  1458. var mapMenu : CR4MapMenu;
  1459.  
  1460. manager = (CR4GuiManager)theGame.GetGuiManager();
  1461. if ( manager )
  1462. {
  1463. rootMenu = manager.GetRootMenu();
  1464. if ( rootMenu )
  1465. {
  1466. mapMenu = (CR4MapMenu)rootMenu.GetSubMenu();
  1467. if ( mapMenu )
  1468. {
  1469. mapMenu.EnableDebugMode( enable );
  1470. }
  1471. }
  1472. }
  1473. }
  1474.  
  1475. exec function map_unlimitedzoom( enable : bool )
  1476. {
  1477. var manager : CR4GuiManager;
  1478. var rootMenu : CR4Menu;
  1479. var mapMenu : CR4MapMenu;
  1480.  
  1481. manager = (CR4GuiManager)theGame.GetGuiManager();
  1482. if ( manager )
  1483. {
  1484. rootMenu = manager.GetRootMenu();
  1485. if ( rootMenu )
  1486. {
  1487. mapMenu = (CR4MapMenu)rootMenu.GetSubMenu();
  1488. if ( mapMenu )
  1489. {
  1490. mapMenu.EnableUnlimitedZoom( enable );
  1491. }
  1492. }
  1493. }
  1494. }
  1495.  
  1496. exec function map_manuallod( enable : bool )
  1497. {
  1498. var manager : CR4GuiManager;
  1499. var rootMenu : CR4Menu;
  1500. var mapMenu : CR4MapMenu;
  1501.  
  1502. manager = (CR4GuiManager)theGame.GetGuiManager();
  1503. if ( manager )
  1504. {
  1505. rootMenu = manager.GetRootMenu();
  1506. if ( rootMenu )
  1507. {
  1508. mapMenu = (CR4MapMenu)rootMenu.GetSubMenu();
  1509. if ( mapMenu )
  1510. {
  1511. mapMenu.EnableManualLod( enable );
  1512. }
  1513. }
  1514. }
  1515. }
  1516.  
  1517. exec function map_borders( show : bool )
  1518. {
  1519. var manager : CR4GuiManager;
  1520. var rootMenu : CR4Menu;
  1521. var mapMenu : CR4MapMenu;
  1522.  
  1523. manager = (CR4GuiManager)theGame.GetGuiManager();
  1524. if ( manager )
  1525. {
  1526. rootMenu = manager.GetRootMenu();
  1527. if ( rootMenu )
  1528. {
  1529. mapMenu = (CR4MapMenu)rootMenu.GetSubMenu();
  1530. if ( mapMenu )
  1531. {
  1532. mapMenu.ShowBorders( show );
  1533. }
  1534. }
  1535. }
  1536. }
  1537.  
  1538. exec function innkeep()
  1539. {
  1540. var numbers : array< int >;
  1541. var i : int;
  1542.  
  1543. numbers.PushBack(175619);
  1544. numbers.PushBack(475415);
  1545. numbers.PushBack(538568);
  1546. numbers.PushBack(1084890);
  1547.  
  1548. for ( i = 0; i < numbers.Size(); i += 1 )
  1549. {
  1550. LogChannel('asdf', numbers[ i ] + " [" + GetLocStringById( numbers[ i ] ) + "]");
  1551. }
  1552. }
  1553.  
  1554. exec function poi()
  1555. {
  1556. LogChannel( 'asd', "[" + GetLocStringByKey("option_miminapPoiQuestionMarks") + "]" );
  1557. LogChannel( 'asd', "[" + GetLocStringByKey("option_MinimapPoiCompletedIcons") + "]" );
  1558. }
Add Comment
Please, Sign In to add comment