Advertisement
Caranthir70129

Untitled

Jun 7th, 2018
326
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 136.96 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 W3BuySkillConfirmation extends ConfirmationPopupData
  11. {
  12. public var characterMenuRef : CR4CharacterMenu;
  13. public var targetSkill : ESkill;
  14.  
  15.  
  16. protected function OnUserAccept() : void
  17. {
  18. characterMenuRef.handleBuySkillConfirmation(targetSkill);
  19. }
  20.  
  21. protected function OnUserDecline() : void
  22. {
  23. super.OnUserDecline();
  24. theSound.SoundEvent("gui_global_panel_close");
  25. }
  26. }
  27.  
  28. enum CharacterMenuTabIndexes
  29. {
  30. CharacterMenuTab_Sword = 0,
  31. CharacterMenuTab_Signs = 1,
  32. CharacterMenuTab_Alchemy = 2,
  33. CharacterMenuTab_Perks = 3,
  34. CharacterMenuTab_Mutagens = 4
  35. };
  36.  
  37.  
  38. enum EMutationResourceType
  39. {
  40. MRT_SkillPoints,
  41. MRT_GreenMutation,
  42. MRT_RedMutation,
  43. MRT_BlueMutation
  44. };
  45.  
  46. enum EBonusSkillSlot
  47. {
  48. BSS_SkillSlot1 = 13,
  49. BSS_SkillSlot2 = 14,
  50. BSS_SkillSlot3 = 15,
  51. BSS_SkillSlot4 = 16
  52. };
  53.  
  54. class CR4CharacterMenu extends CR4MenuBase
  55. {
  56. protected var initDataBuySkill : W3BuySkillConfirmation;
  57.  
  58. private var _playerInv : W3GuiPlayerInventoryComponent;
  59. protected var _inv : CInventoryComponent;
  60. private var _charStatsPopupData : CharacterStatsPopupData;
  61. private var _sentStats : array<SentStatsData>;
  62. protected var currentlySelectedTab : int;
  63.  
  64. private var m_previousSkillBonuses : array<string>;
  65.  
  66. private var m_fxPaperdollChanged : CScriptedFlashFunction;
  67. private var m_fxClearSkillSlot : CScriptedFlashFunction;
  68. private var m_fxNotifySkillUpgraded : CScriptedFlashFunction;
  69. private var m_fxActivateRunwordBuf : CScriptedFlashFunction;
  70. private var m_fxSetMutationBonusMode : CScriptedFlashFunction;
  71. private var m_fxConfirmMutResearch : CScriptedFlashFunction;
  72. private var m_fxResetInput : CScriptedFlashFunction;
  73. private var m_fxSetTabsLabelText : CScriptedFlashFunction;//zur13 modSSS
  74. private var resRedMutagenList : array<SItemUniqueId>;
  75. private var resBlueMutagenList : array<SItemUniqueId>;
  76. private var resGreenMutagenList : array<SItemUniqueId>;
  77. private var m_mutationBonusMode : bool;
  78. default m_mutationBonusMode = false;
  79. public var tabChanging : bool; //zur13 modSSS
  80. private var MAX_BONUS_SOCKETS : int;
  81. default MAX_BONUS_SOCKETS = 4;
  82.  
  83. private var MAX_MASTER_MUTATION_STAGE : int;
  84. default MAX_MASTER_MUTATION_STAGE = 4;
  85.  
  86. event OnConfigUI()
  87. {
  88. var l_flashObject : CScriptedFlashObject;
  89. var l_flashArray : CScriptedFlashArray;
  90. var filterTagsList : array<name>;
  91.  
  92. super.OnConfigUI();
  93.  
  94. m_initialSelectionsToIgnore = 3;
  95.  
  96.  
  97. m_fxPaperdollChanged = m_flashModule.GetMemberFlashFunction( "onPaperdollChanged" );
  98. m_fxClearSkillSlot = m_flashModule.GetMemberFlashFunction( "clearSkillSlot" );
  99. m_fxNotifySkillUpgraded = m_flashModule.GetMemberFlashFunction( "notifySkillUpgraded" );
  100. m_fxActivateRunwordBuf = m_flashModule.GetMemberFlashFunction( "activateRunwordBuf" );
  101. m_fxSetMutationBonusMode = m_flashModule.GetMemberFlashFunction( "setMutationBonusMode" );
  102. m_fxConfirmMutResearch = m_flashModule.GetMemberFlashFunction( "confirmMutationResearch" );
  103. m_fxResetInput = m_flashModule.GetMemberFlashFunction( "resetInput" );
  104. m_fxSetTabsLabelText = m_flashModule.GetMemberFlashFunction( "sssSetTabsLblText" );//zur13 modSSS
  105. SendCombatState();
  106.  
  107. _inv = thePlayer.GetInventory();
  108. _playerInv = new W3GuiPlayerInventoryComponent in this;
  109. _playerInv.Initialize( _inv );
  110. _playerInv.ignorePosition = true;
  111. filterTagsList.PushBack('MutagenIngredient');
  112. _playerInv.SetFilterType(IFT_Ingredients);
  113. _playerInv.filterTagList = filterTagsList;
  114.  
  115. if( GetWitcherPlayer().IsMutationSystemEnabled() )
  116. {
  117. setMutationBonusMode( true );
  118. }
  119. else
  120. {
  121. m_fxSetMutationBonusMode.InvokeSelfOneArg( FlashArgBool( false ) );
  122. }
  123.  
  124.  
  125. UpdateMasterMutation();
  126. UpdateData(true);
  127.  
  128. m_fxSetTooltipState.InvokeSelfTwoArgs( FlashArgBool( thePlayer.upscaledTooltipState ), FlashArgBool( true ) );
  129. }
  130.  
  131. private function BlockClosing( locked : bool )
  132. {
  133. var guiManager : CR4GuiManager;
  134. var rootMenu : CR4CommonMenu;
  135.  
  136. rootMenu = (CR4CommonMenu)theGame.GetGuiManager().GetRootMenu();
  137.  
  138. if (rootMenu)
  139. {
  140. rootMenu.SetLockedInMenu(locked);
  141. }
  142. }
  143.  
  144. event OnClosingMenu()
  145. {
  146. var hud : CR4ScriptedHud;
  147. super.OnClosingMenu();
  148. if( GetCurrentSkillPoints() < 1 )
  149. {
  150. hud = (CR4ScriptedHud)theGame.GetHud();
  151. if( hud )
  152. {
  153. hud.OnShowLevelUpIndicator( false );
  154. }
  155. }
  156.  
  157. if (_charStatsPopupData)
  158. {
  159. _charStatsPopupData.ClosePopupOverlay();
  160. delete _charStatsPopupData;
  161. }
  162. BlockClosing( false );
  163. }
  164.  
  165. event OnCloseMenu()
  166. {
  167. if ( _playerInv )
  168. {
  169. delete _playerInv;
  170. }
  171.  
  172. if ( initDataBuySkill )
  173. {
  174. delete initDataBuySkill;
  175. }
  176.  
  177. CloseMenu();
  178.  
  179. if( m_parentMenu )
  180. {
  181. m_parentMenu.ChildRequestCloseMenu();
  182. }
  183. }
  184.  
  185. event OnTabDataRequested(tabIndex : int )
  186. {
  187. PopulateTabData(tabIndex);
  188. }
  189.  
  190. event OnTabChanged(tabIndex:int)
  191. {
  192. var uiState : W3TutorialManagerUIHandlerStateCharDevMutagens;
  193.  
  194. currentlySelectedTab = tabIndex;
  195.  
  196. if(tabIndex == CharacterMenuTab_Mutagens && ShouldProcessTutorial('TutorialMutagenDescription'))
  197. {
  198. uiState = (W3TutorialManagerUIHandlerStateCharDevMutagens)theGame.GetTutorialSystem().uiHandler.GetCurrentState();
  199. if(uiState)
  200. uiState.SelectedMutagensTab();
  201. }
  202. }
  203.  
  204. event OnOpenMutationPanel():void
  205. {
  206. OnPlaySoundEvent( "gui_tutorial_big_appear" );
  207. theGame.GetTutorialSystem().uiHandler.OnClosingMenu( 'CharacterMenu' );
  208. theGame.GetTutorialSystem().uiHandler.OnOpeningMenu( 'MutationMenu' );
  209. UpdateAllMutationsData();
  210. BlockClosing( true );
  211. }
  212.  
  213. event OnCloseMutationPanel():void
  214. {
  215. OnPlaySoundEvent( "gui_character_remove_mutagen" );
  216. theGame.GetTutorialSystem().uiHandler.OnClosingMenu( 'MutationMenu' );
  217. theGame.GetTutorialSystem().uiHandler.OnOpeningMenu( 'CharacterMenu' );
  218.  
  219. UpdateData( true );
  220. // sortX
  221. UpdateAllMutationsDataForMaster();
  222. BlockClosing( false );
  223. }
  224.  
  225. event OnMutationSelected( mutationId : EPlayerMutationType ):void
  226. {
  227. var canResearch : W3TutorialManagerUIHandlerStateMutationsCanResearch;
  228.  
  229. canResearch = ( W3TutorialManagerUIHandlerStateMutationsCanResearch ) theGame.GetTutorialSystem().uiHandler.GetCurrentState();
  230. if( canResearch )
  231. {
  232. m_fxResetInput.InvokeSelf();
  233. canResearch.OnMutationSelected( mutationId );
  234. }
  235. }
  236.  
  237. event OnResearchOpened( mutationId : EPlayerMutationType ):void
  238. {
  239. var canResearch : W3TutorialManagerUIHandlerStateMutationsCanResearch;
  240.  
  241. canResearch = ( W3TutorialManagerUIHandlerStateMutationsCanResearch ) theGame.GetTutorialSystem().uiHandler.GetCurrentState();
  242. if( canResearch )
  243. {
  244. canResearch.OnResearch();
  245. }
  246. OnPlaySoundEvent( "gui_global_panel_open" );
  247. }
  248.  
  249. event OnResearchClosed():void
  250. {
  251. OnPlaySoundEvent( "gui_global_panel_close" );
  252. }
  253.  
  254. private function ResearchMutagen( mutationId : int, count : int, itemsList : array< SItemUniqueId > )
  255. {
  256. var i : int;
  257.  
  258. for( i = 0; i < count; i+=1 )
  259. {
  260. GetWitcherPlayer().MutationResearchWithItem( mutationId, itemsList.PopBack() );
  261. }
  262. }
  263.  
  264. private function UpdateMasterMutation():void
  265. {
  266. var currentlyEquipped : EPlayerMutationType;
  267.  
  268. if( GetWitcherPlayer().IsMutationSystemEnabled() )
  269. {
  270. currentlyEquipped = GetWitcherPlayer().GetEquippedMutationType();
  271. SSS_UpdateMasterMutation( this ); //zur13 modSSS
  272. if( currentlyEquipped != EPMT_None )
  273. {
  274. UpdateTargetMutationData( currentlyEquipped );
  275. }
  276. }
  277. }
  278.  
  279. event OnCantResearchMutation()
  280. {
  281.  
  282. }
  283.  
  284. event OnResearchMutation( mutationId : int, points : int, red : int, green : int, blue : int )
  285. {
  286. var isChanged:bool = false;
  287. var i : int;
  288. var idToRemove: SItemUniqueId;
  289. if( thePlayer.IsInCombat() )
  290. {
  291. showNotification( GetLocStringByKeyExt( "menu_cannot_perform_action_combat" ) );
  292. OnPlaySoundEvent( "gui_global_denied" );
  293. return false;
  294. }
  295.  
  296. if( points > 0 )
  297. {
  298. GetWitcherPlayer().MutationResearchWithSkillPoints( mutationId, points );
  299. UpdateSkillPoints();
  300. isChanged = true;
  301. }
  302.  
  303. if( red > 0 )
  304. {
  305. ResearchMutagen( mutationId, red, resRedMutagenList );
  306. isChanged = true;
  307. }
  308.  
  309. if( green > 0 )
  310. {
  311. ResearchMutagen( mutationId, green, resGreenMutagenList );
  312. isChanged = true;
  313. }
  314.  
  315. if( blue > 0 )
  316. {
  317. ResearchMutagen( mutationId, blue, resBlueMutagenList );
  318. isChanged = true;
  319. }
  320.  
  321. if( isChanged )
  322. {
  323. OnUpdateAfterResearch( mutationId );
  324. }
  325. }
  326.  
  327. event OnUpdateAfterResearch( mutationId : int )
  328. {
  329. var researchedMutation : int;
  330. var requaredForNextLevel : int;
  331. var masterStage : int;
  332. var abilityManager : W3PlayerAbilityManager;
  333.  
  334. if(GetWitcherPlayer().IsMutationResearched( mutationId ) )
  335. {
  336. UpdateAllMutationsData();
  337.  
  338.  
  339. masterStage = GetWitcherPlayer().GetMasterMutationStage();
  340. if (masterStage > 0)
  341. {
  342. abilityManager = ( ( W3PlayerAbilityManager ) GetWitcherPlayer().abilityManager );
  343.  
  344. requaredForNextLevel = abilityManager.GetMutationsRequiredForMasterStage(masterStage);
  345. researchedMutation = abilityManager.GetResearchedMutationsCount();
  346.  
  347. if (requaredForNextLevel == researchedMutation )
  348. {
  349.  
  350. OnPlaySoundEvent( "gui_enchanting_runeword_add" );
  351. }
  352. }
  353.  
  354. OnPlaySoundEvent( "gui_character_place_mutagen" );
  355. }
  356. else
  357. {
  358. UpdateTargetMutationData( mutationId );
  359. }
  360. }
  361.  
  362. event OnEquipMutation( mutationId : int )
  363. {
  364. var currentlyEquipped : EPlayerMutationType;
  365.  
  366. currentlyEquipped = GetWitcherPlayer().GetEquippedMutationType();
  367.  
  368. if( !SSS_IsMutationEquipped(mutationId, GetWitcherPlayer().SSS_GetEquippedMutationType()) && SSS_CanEquipMutation(this, mutationId, GetWitcherPlayer().SSS_GetEquippedMutationType()) ) //zur13 modSSS
  369. {
  370. if( thePlayer.IsInCombat() )
  371. {
  372. showNotification( GetLocStringByKeyExt( "menu_cannot_perform_action_combat" ) );
  373. OnPlaySoundEvent( "gui_global_denied" );
  374. }
  375. else
  376. {
  377. GetWitcherPlayer().SetEquippedMutation( mutationId );
  378. setMutationBonusMode( true );
  379. UpdateAllMutationsData();
  380.  
  381. OnPlaySoundEvent( "gui_character_synergy_effect" );
  382. }
  383. }
  384. }
  385.  
  386. event OnUnequipMutation()
  387. {
  388. var currentlyEquipped : EPlayerMutationType;
  389.  
  390. currentlyEquipped = GetWitcherPlayer().GetEquippedMutationType();
  391.  
  392. if( currentlyEquipped != EPMT_None )
  393. {
  394. if( thePlayer.IsInCombat() )
  395. {
  396. showNotification( GetLocStringByKeyExt( "menu_cannot_perform_action_combat" ) );
  397. OnPlaySoundEvent( "gui_global_denied" );
  398. }
  399. else
  400. {
  401. setMutationBonusMode( false );
  402. GetWitcherPlayer().SetEquippedMutation( EPMT_None );
  403. UpdateAllMutationsData();
  404.  
  405. OnPlaySoundEvent( "gui_character_synergy_effect_lose" );
  406. }
  407. }
  408. }
  409.  
  410. private function setMutationBonusMode( value : bool ):void
  411. {
  412. if( m_mutationBonusMode != value )
  413. {
  414. m_mutationBonusMode = value;
  415. m_fxSetMutationBonusMode.InvokeSelfOneArg( FlashArgBool( value ) );
  416.  
  417. if( m_mutationBonusMode )
  418. {
  419.  
  420. }
  421. else
  422. {
  423. thePlayer.UnequipSkill( BSS_SkillSlot1 );
  424. thePlayer.UnequipSkill( BSS_SkillSlot2 );
  425. thePlayer.UnequipSkill( BSS_SkillSlot3 );
  426. thePlayer.UnequipSkill( BSS_SkillSlot4 );
  427.  
  428. UpdatePlayerStatisticsData();
  429. UpdateGroupsData();
  430. }
  431. }
  432. }
  433.  
  434. private function UpdateTargetMutationData( mutationId : EPlayerMutationType ):void
  435. {
  436. var mutationData : CScriptedFlashObject;
  437.  
  438. mutationData = CreateMutationFlashDataObj( mutationId );
  439. m_flashValueStorage.SetFlashObject( "character.mutation", mutationData );
  440. }
  441.  
  442. private function UpdateAllMutationsData():void
  443. {
  444. var mutationsList : CScriptedFlashArray;
  445. var mutationData : CScriptedFlashObject;
  446. var count : int;
  447. var curMutationId : int;
  448.  
  449. resRedMutagenList = thePlayer.inv.GetItemsByName( 'Greater mutagen red' );
  450. resRedMutagenList = filterMutagens( resRedMutagenList );
  451.  
  452. resBlueMutagenList = filterMutagens(thePlayer.inv.GetItemsByName( 'Greater mutagen blue' ));
  453. resGreenMutagenList = filterMutagens(thePlayer.inv.GetItemsByName( 'Greater mutagen green' ));
  454.  
  455. mutationsList = m_flashValueStorage.CreateTempFlashArray();
  456.  
  457. if( GetWitcherPlayer().IsMutationSystemEnabled() )
  458. {
  459. count = EnumGetMax( 'EPlayerMutationType' );
  460.  
  461. for( curMutationId = EPMT_Mutation1; curMutationId <= count; curMutationId += 1 )
  462. {
  463. mutationData = CreateMutationFlashDataObj( curMutationId );
  464. mutationsList.PushBackFlashObject( mutationData );
  465. }
  466. }
  467.  
  468. m_flashValueStorage.SetFlashArray( "character.mutations.list", mutationsList ); UpdateMasterMutation(); //zur13 modSSS
  469. }
  470. // sortX
  471. private function UpdateAllMutationsDataForMaster():void
  472. {
  473. var mutationsList : CScriptedFlashArray;
  474. var mutationData : CScriptedFlashObject;
  475. var count : int;
  476. var curMutationId : int;
  477.  
  478. resRedMutagenList = thePlayer.inv.GetItemsByName( 'Greater mutagen red' );
  479. resRedMutagenList = filterMutagens( resRedMutagenList );
  480.  
  481. resBlueMutagenList = filterMutagens(thePlayer.inv.GetItemsByName( 'Greater mutagen blue' ));
  482. resGreenMutagenList = filterMutagens(thePlayer.inv.GetItemsByName( 'Greater mutagen green' ));
  483.  
  484. mutationsList = m_flashValueStorage.CreateTempFlashArray();
  485.  
  486. if( GetWitcherPlayer().IsMutationSystemEnabled() )
  487. {
  488. mutationData = CreateMutationFlashDataObj( EPMT_MutationMaster );
  489. mutationsList.PushBackFlashObject( mutationData );
  490. }
  491.  
  492. m_flashValueStorage.SetFlashArray( "character.mutations.list", mutationsList );
  493. }
  494.  
  495. private function filterMutagens( list : array<SItemUniqueId> ):array<SItemUniqueId>
  496. {
  497. var isEquipped: bool;
  498. var tempArray: array<SItemUniqueId>;
  499. var itemsCount, i : int;
  500.  
  501. itemsCount = list.Size();
  502.  
  503. for( i = 0; i < itemsCount; i += 1 )
  504. {
  505. if( !GetWitcherPlayer().IsItemEquipped( list[i] ) )
  506. {
  507. tempArray.PushBack( list[i] );
  508. }
  509. }
  510.  
  511. return tempArray;
  512. }
  513.  
  514. private function CreateMutationFlashDataObj( curMutationId : EPlayerMutationType ) : CScriptedFlashObject
  515. {
  516. var mutationData : CScriptedFlashObject;
  517.  
  518. var mutationResourceList : CScriptedFlashArray;
  519. var mutationResourceData : CScriptedFlashObject;
  520. var mutationRequirementList : CScriptedFlashArray;
  521. var mutationRequirementData : CScriptedFlashObject;
  522. var mutationColorList : CScriptedFlashArray;
  523. var mutationColorData : CScriptedFlashObject;
  524.  
  525. var strIntParams : array< int >;
  526. var colorName : string;
  527. var colorsList : array< ESkillColor >;
  528. var curRequiredMutations : array< EPlayerMutationType >;
  529. var curReqMutationType : EPlayerMutationType;
  530. var curReqMutation : SMutation;
  531. var curMutation : SMutation;
  532. var curProgress : SMutationProgress;
  533. var curPlayer : W3PlayerWitcher;
  534.  
  535. var colorsCount : int;
  536. var unlockedSockets : int;
  537. var masterStage : int;
  538. var masterStageLabel : string;
  539. var masterStageNumbLabel : string;
  540. var masterStageDesc : string;
  541. var nextLevelDescription : string;
  542.  
  543. var avaliableSkillPoints : int;
  544. var overalProgress : int;
  545. var i, requirementsCount : int;
  546. var progressStrInfo : string;
  547. var isResearchEnabled : bool;
  548. var abilityManager : W3PlayerAbilityManager;
  549. var requaredResourcesCount : int;
  550. var usedResourcesCount : int;
  551. var researchedMutation : int;
  552. var requaredForNextLevel : int;
  553.  
  554. var avaliableRed : int;
  555. var avaliableGreen : int;
  556. var avaliableBlue : int;
  557. var canResearch : bool;
  558.  
  559. var equippedMutationId : EPlayerMutationType;
  560.  
  561. curPlayer = GetWitcherPlayer();
  562. abilityManager = ( ( W3PlayerAbilityManager ) curPlayer.abilityManager );
  563.  
  564. equippedMutationId = curPlayer.GetEquippedMutationType();
  565.  
  566. curMutation = curPlayer.GetMutation( curMutationId );
  567. curProgress = curMutation.progress;
  568. overalProgress = curPlayer.GetMutationResearchProgress( curMutationId );
  569. mutationData = m_flashValueStorage.CreateTempFlashObject();
  570. progressStrInfo = overalProgress + " % " + GetLocStringByKeyExt( "mutation_tooltip_research_progress" );
  571.  
  572. mutationData.SetMemberFlashString( "name", GetLocStringByKeyExt( curMutation.localizationNameKey ) );
  573. mutationData.SetMemberFlashString( "description", curPlayer.GetMutationLocalizedDescription( curMutationId) );
  574. mutationData.SetMemberFlashString( "iconPath", curMutation.iconPath );
  575.  
  576. usedResourcesCount = curMutation.progress.blueUsed + curMutation.progress.greenUsed + curMutation.progress.redUsed + curMutation.progress.skillpointsUsed;
  577. requaredResourcesCount = curMutation.progress.blueRequired + curMutation.progress.redRequired + curMutation.progress.greenRequired + curMutation.progress.skillpointsRequired;
  578.  
  579. mutationData.SetMemberFlashInt( "requaredResourcesCount", requaredResourcesCount );
  580. mutationData.SetMemberFlashInt( "usedResourcesCount", usedResourcesCount );
  581. mutationData.SetMemberFlashString( "progressInfo", progressStrInfo );
  582.  
  583. mutationData.SetMemberFlashInt( "mutationId", curMutationId );
  584. mutationData.SetMemberFlashInt( "overallProgress", overalProgress );
  585. mutationData.SetMemberFlashBool( "researchCompleted", overalProgress >= 100 );
  586.  
  587. if (SSS_IsMutationEquipped(curMutationId, curPlayer.SSS_GetEquippedMutationType()) ) //zur13 modSSS
  588. {
  589. mutationData.SetMemberFlashBool( "isEquipped", true );
  590. }
  591.  
  592. if( curMutationId == EPMT_MutationMaster )
  593. {
  594. masterStage = curPlayer.GetMasterMutationStage();
  595.  
  596. if( masterStage < MAX_MASTER_MUTATION_STAGE )
  597. {
  598. masterStageDesc = GetLocStringByKeyExt( "mutation_master_mutation_description" ) + "<br/>";
  599. }
  600. else
  601. {
  602. masterStageDesc = "";
  603. }
  604.  
  605. requaredForNextLevel = abilityManager.GetMutationsRequiredForMasterStage(masterStage + 1);
  606. researchedMutation = abilityManager.GetResearchedMutationsCount();
  607.  
  608. if (masterStage == 0)
  609. {
  610. strIntParams.Clear();
  611. strIntParams.PushBack( requaredForNextLevel );
  612. mutationData.SetMemberFlashString( "lockedDescription", GetLocStringByKeyExtWithParams( "mutation_master_mutation_requires_unlock", strIntParams ) );
  613. }
  614. else
  615. {
  616. strIntParams.Clear();
  617. strIntParams.PushBack( masterStage );
  618. masterStageDesc = masterStageDesc + GetLocStringByKeyExtWithParams( "mutation_master_mutation_tooltip_unlocks", strIntParams );
  619.  
  620. if (masterStage < MAX_MASTER_MUTATION_STAGE)
  621. {
  622.  
  623. strIntParams.Clear();
  624. strIntParams.PushBack( requaredForNextLevel );
  625. nextLevelDescription = GetLocStringByKeyExtWithParams( "mutation_master_mutation_requires", strIntParams );
  626. masterStageDesc = masterStageDesc + "<br/>"+ nextLevelDescription;
  627. }
  628. }
  629.  
  630. switch( masterStage )
  631. {
  632. case 1:
  633. masterStageLabel = GetLocStringByKeyExt( "mutation_master_mutation_stage_1" );
  634. masterStageNumbLabel = "I";
  635. break;
  636. case 2:
  637. masterStageLabel = GetLocStringByKeyExt( "mutation_master_mutation_stage_2" );
  638. masterStageNumbLabel = "II";
  639. break;
  640. case 3:
  641. masterStageLabel = GetLocStringByKeyExt( "mutation_master_mutation_stage_3" );
  642. masterStageNumbLabel = "III";
  643. break;
  644. case 4:
  645. masterStageLabel = GetLocStringByKeyExt( "mutation_master_mutation_stage_4" );
  646. masterStageNumbLabel = "IV";
  647. break;
  648. default:
  649. masterStageLabel = "";
  650. masterStageNumbLabel = "";
  651. }
  652.  
  653. mutationData.SetMemberFlashInt( "stage", masterStage );
  654. mutationData.SetMemberFlashBool( "isMasterMutation", true );
  655. mutationData.SetMemberFlashString( "stageLabel", masterStageLabel );
  656. mutationData.SetMemberFlashString( "stageNumbLabel", masterStageNumbLabel );
  657. mutationData.SetMemberFlashString( "name", GetLocStringByKeyExt("skill_name_mutation_master") );
  658. mutationData.SetMemberFlashString( "description", masterStageDesc);
  659. }
  660. else
  661. {
  662.  
  663.  
  664. isResearchEnabled = true;
  665. curRequiredMutations = curMutation.requiredMutations;
  666. requirementsCount = curRequiredMutations.Size();
  667. mutationRequirementList = m_flashValueStorage.CreateTempFlashArray();
  668.  
  669. for( i = 0; i < requirementsCount; i += 1 )
  670. {
  671. curReqMutationType = curRequiredMutations[i];
  672.  
  673. if( !curPlayer.IsMutationResearched( curReqMutationType ) )
  674. {
  675. isResearchEnabled = false;
  676. }
  677.  
  678. curReqMutation = curPlayer.GetMutation( curReqMutationType );
  679. mutationRequirementData = m_flashValueStorage.CreateTempFlashObject();
  680. mutationRequirementData.SetMemberFlashString( "name", GetLocStringByKeyExt( curReqMutation.localizationNameKey ) );
  681. mutationRequirementData.SetMemberFlashInt( "type", curReqMutationType );
  682. mutationRequirementList.PushBackFlashObject( mutationRequirementData );
  683. }
  684.  
  685. mutationData.SetMemberFlashArray( "requiredMutations", mutationRequirementList );
  686. mutationData.SetMemberFlashBool( "enabled", isResearchEnabled );
  687.  
  688.  
  689. // COLORS
  690. /* sortX
  691. mutationColorList = m_flashValueStorage.CreateTempFlashArray();
  692. colorsList = curMutation.colors;
  693. colorsCount = colorsList.Size();
  694.  
  695. for( i=0; i < colorsCount; i+=1 )
  696. {
  697. mutationColorData = m_flashValueStorage.CreateTempFlashObject();
  698. mutationColorData.SetMemberFlashString( "color", colorsList[i] );
  699.  
  700. switch ( colorsList[i] )
  701. {
  702. case SC_Red:
  703. colorName = GetLocStringByKeyExt("panel_character_skill_sword");
  704. break;
  705. case SC_Blue:
  706. colorName = GetLocStringByKeyExt("panel_character_skill_signs");
  707. break;
  708. case SC_Green:
  709. colorName = GetLocStringByKeyExt("panel_character_skill_alchemy");
  710. break;
  711. }
  712.  
  713. mutationColorData.SetMemberFlashString( "colorLocName", colorName );
  714. mutationColorList.PushBackFlashObject( mutationColorData );
  715. }
  716.  
  717. mutationData.SetMemberFlashArray( "colorsList", mutationColorList );
  718. */
  719.  
  720.  
  721.  
  722. mutationResourceList = m_flashValueStorage.CreateTempFlashArray();
  723.  
  724.  
  725. avaliableSkillPoints = GetCurrentSkillPoints();
  726. mutationResourceData = m_flashValueStorage.CreateTempFlashObject();
  727. mutationResourceData.SetMemberFlashString( "title", GetLocStringByKeyExt("mutation_research_knowledge") );
  728. mutationResourceData.SetMemberFlashInt( "type", MRT_SkillPoints );
  729. mutationResourceData.SetMemberFlashInt( "used", curProgress.skillpointsUsed );
  730. mutationResourceData.SetMemberFlashInt( "required", curProgress.skillpointsRequired );
  731. mutationResourceData.SetMemberFlashInt( "avaliableResources", avaliableSkillPoints );
  732. mutationResourceData.SetMemberFlashUInt( "resourceColor", 0 );
  733. mutationResourceData.SetMemberFlashString( "resourceName", GetLocStringByKeyExt( "mutation_ability_point" ) );
  734. mutationResourceData.SetMemberFlashString( "resourceIconPath", "img://icons/skills/ico_skill_point.png" );
  735. mutationResourceData.SetMemberFlashString( "description", "1 /" + GetLocStringByKeyExt( "mutation_research_point" ) );
  736. mutationResourceData.SetMemberFlashString( "avaliableResourcesText", GetLocStringByKeyExt( "mutation_research_available" ) );
  737. mutationResourceData.SetMemberFlashString( "researchCostText", "1x / " + GetLocStringByKeyExt( "mutation_research_point" ) );
  738. mutationResourceData.SetMemberFlashUInt( "itemName", 0 );
  739. mutationResourceList.PushBackFlashObject( mutationResourceData );
  740.  
  741.  
  742. mutationResourceData = m_flashValueStorage.CreateTempFlashObject();
  743. mutationResourceData.SetMemberFlashString( "title", GetLocStringByKeyExt("mutation_strain_research_green") );
  744. mutationResourceData.SetMemberFlashInt( "type", MRT_GreenMutation );
  745. mutationResourceData.SetMemberFlashInt( "used", curProgress.greenUsed );
  746. mutationResourceData.SetMemberFlashInt( "required", curProgress.greenRequired );
  747.  
  748. avaliableGreen = resGreenMutagenList.Size();
  749.  
  750. AddItemResearchData( mutationResourceData, 'Greater mutagen green', SC_Green );
  751. mutationResourceData.SetMemberFlashInt( "avaliableResources", avaliableGreen );
  752.  
  753. mutationResourceList.PushBackFlashObject( mutationResourceData );
  754.  
  755.  
  756. mutationResourceData = m_flashValueStorage.CreateTempFlashObject();
  757. mutationResourceData.SetMemberFlashString( "title", GetLocStringByKeyExt("mutation_strain_research_red") );
  758. mutationResourceData.SetMemberFlashInt( "type", MRT_RedMutation );
  759. mutationResourceData.SetMemberFlashInt( "used", curProgress.redUsed );
  760. mutationResourceData.SetMemberFlashInt( "required", curProgress.redRequired );
  761.  
  762. avaliableRed = resRedMutagenList.Size();
  763. AddItemResearchData( mutationResourceData, 'Greater mutagen red', SC_Red );
  764. mutationResourceData.SetMemberFlashInt( "avaliableResources", avaliableRed );
  765.  
  766. mutationResourceList.PushBackFlashObject( mutationResourceData );
  767.  
  768.  
  769. mutationResourceData = m_flashValueStorage.CreateTempFlashObject();
  770. mutationResourceData.SetMemberFlashString( "title", GetLocStringByKeyExt("mutation_strain_research_blue") );
  771. mutationResourceData.SetMemberFlashInt( "type", MRT_BlueMutation );
  772. mutationResourceData.SetMemberFlashInt( "used", curProgress.blueUsed );
  773. mutationResourceData.SetMemberFlashInt( "required", curProgress.blueRequired );
  774.  
  775. avaliableBlue = resBlueMutagenList.Size();
  776. AddItemResearchData( mutationResourceData, 'Greater mutagen blue', SC_Blue );
  777. mutationResourceData.SetMemberFlashInt( "avaliableResources", avaliableBlue );
  778. mutationResourceList.PushBackFlashObject( mutationResourceData );
  779.  
  780. mutationData.SetMemberFlashArray( "progressDataList", mutationResourceList );
  781.  
  782. canResearch = avaliableRed >= curMutation.progress.redRequired;
  783. canResearch = canResearch && avaliableGreen >= curMutation.progress.greenRequired;
  784. canResearch = canResearch && avaliableBlue >= curMutation.progress.blueRequired;
  785. canResearch = canResearch && avaliableSkillPoints >= curMutation.progress.skillpointsRequired;
  786.  
  787. mutationData.SetMemberFlashInt( "redRequired", curMutation.progress.redRequired );
  788. mutationData.SetMemberFlashInt( "greenRequired", curMutation.progress.greenRequired );
  789. mutationData.SetMemberFlashInt( "blueRequired", curMutation.progress.blueRequired );
  790. mutationData.SetMemberFlashInt( "skillpointsRequired", curMutation.progress.skillpointsRequired );
  791. }
  792.  
  793. mutationData.SetMemberFlashBool( "canResearch", canResearch );
  794.  
  795. return mutationData;
  796. }
  797.  
  798. private function AddItemResearchData( out flashDataObj : CScriptedFlashObject, itemName : name, optional resourceColor : ESkillColor )
  799. {
  800. var playerInv : CInventoryComponent;
  801. var itemLocName : string;
  802. var itemIconPath : string;
  803.  
  804. playerInv = thePlayer.inv;
  805. itemLocName = GetLocStringByKeyExt( playerInv.GetItemLocalizedNameByName( itemName ) );
  806. itemIconPath = playerInv.GetItemIconPathByName( itemName );
  807.  
  808. flashDataObj.SetMemberFlashUInt( "resourceColor", resourceColor );
  809. flashDataObj.SetMemberFlashString( "avaliableResourcesText", GetLocStringByKeyExt( "mutation_research_available" ) );
  810. flashDataObj.SetMemberFlashString( "researchCostText", "1x / " + GetLocStringByKeyExt( "mutation_research_point" ) );
  811. flashDataObj.SetMemberFlashString( "resourceName", itemLocName );
  812. flashDataObj.SetMemberFlashString( "resourceIconPath", "img://" + itemIconPath );
  813. flashDataObj.SetMemberFlashString( "description", "1 " + itemLocName + " / " + GetLocStringByKeyExt( "mutation_research_point" ) );
  814. flashDataObj.SetMemberFlashUInt( "itemName", NameToFlashUInt( itemName ) );
  815. }
  816.  
  817. private function PopulateTabData(tabIndex:int, optional skillId:int) : void
  818. {
  819. switch (tabIndex)
  820. {
  821. case CharacterMenuTab_Sword:
  822. PopulateDataForTabWithSkills(CharacterMenuTab_Sword, ESP_Sword, skillId);
  823. break;
  824. case CharacterMenuTab_Signs:
  825. PopulateDataForTabWithSkills(CharacterMenuTab_Signs, ESP_Signs, skillId);
  826. break;
  827. case CharacterMenuTab_Alchemy:
  828. PopulateDataForTabWithSkills(CharacterMenuTab_Alchemy, ESP_Alchemy, skillId);
  829. break;
  830. case CharacterMenuTab_Perks:
  831. PopulateDataForTabWithSkills(CharacterMenuTab_Perks, ESP_Perks);
  832. break;
  833. case CharacterMenuTab_Mutagens:
  834. PopulateDataForMutagenTab();
  835. break;
  836. }
  837. }
  838.  
  839. private function PopulateDataForTabWithSkills(tabIndex:int, skillType:ESkillPath, optional skillId:int):void
  840. {
  841. var gfxSkill : CScriptedFlashObject;
  842. var gfxSkillsList : CScriptedFlashArray;
  843. var skillsList : array <SSkill>;
  844. var curSkill : SSkill;
  845. var i : int;
  846. var len : int;
  847.  
  848. gfxSkillsList = m_flashValueStorage.CreateTempFlashArray();
  849. skillsList = thePlayer.GetPlayerSkills();
  850. len = skillsList.Size();
  851.  
  852. for (i=1; i<len; i+=1)
  853. {
  854. curSkill = skillsList[i];
  855.  
  856. if (curSkill.skillPath == skillType &&
  857. curSkill.skillSubPath != ESSP_NotSet && curSkill.skillSubPath != ESSP_Core)
  858. {
  859. gfxSkill = m_flashValueStorage.CreateTempFlashObject();
  860. GetSkillGFxObject(curSkill, true, gfxSkill);
  861.  
  862. if( skillType == ESP_Perks )
  863. {
  864. gfxSkill.SetMemberFlashInt( "perkPosition", curSkill.positionID );
  865. }
  866.  
  867. if (skillId == curSkill.skillType)
  868. {
  869. gfxSkill.SetMemberFlashBool("playUpgradeAnimation", true);
  870. }
  871.  
  872. gfxSkillsList.PushBackFlashObject(gfxSkill);
  873. }
  874. }
  875.  
  876. PopulateDataForTab(tabIndex, gfxSkillsList);
  877. }
  878.  
  879. private function PopulateDataForMutagenTab():void
  880. {
  881. var mutagenItemData : CScriptedFlashArray;
  882. var l_flashObject : CScriptedFlashObject;
  883.  
  884. mutagenItemData = m_flashValueStorage.CreateTempFlashArray();
  885. l_flashObject = m_flashValueStorage.CreateTempFlashObject();
  886.  
  887. if (_playerInv)
  888. {
  889. _playerInv.GetInventoryFlashArray(mutagenItemData, l_flashObject);
  890. }
  891.  
  892. PopulateDataForTab(CharacterMenuTab_Mutagens, mutagenItemData);
  893. }
  894.  
  895. private function PopulateDataForTab(tabIndex:int, entriesArray:CScriptedFlashArray):void
  896. {
  897. var l_flashObject : CScriptedFlashObject;
  898.  
  899. l_flashObject = m_flashValueStorage.CreateTempFlashObject();
  900. l_flashObject.SetMemberFlashInt("tabIndex", tabIndex);
  901. l_flashObject.SetMemberFlashArray("tabData", entriesArray);
  902.  
  903. if( entriesArray.GetLength() > 0 )
  904. {
  905. m_fxShowSecondaryModulesSFF.InvokeSelfOneArg(FlashArgBool(true));
  906. }
  907. else
  908. {
  909. m_fxShowSecondaryModulesSFF.InvokeSelfOneArg(FlashArgBool(false));
  910. }
  911.  
  912. m_flashValueStorage.SetFlashObject( "character.menu.tabs.data" + tabIndex, l_flashObject );
  913. }
  914.  
  915. private function GetTabForSkill(skillID : ESkill) : CharacterMenuTabIndexes
  916. {
  917. var skill : SSkill;
  918.  
  919. skill = thePlayer.GetPlayerSkill(skillID);
  920.  
  921. switch ( skill.skillPath )
  922. {
  923. case ESP_Sword:
  924. case ESP_NotSet:
  925. return CharacterMenuTab_Sword;
  926. case ESP_Signs:
  927. return CharacterMenuTab_Signs;
  928. case ESP_Alchemy:
  929. return CharacterMenuTab_Alchemy;
  930. case ESP_Perks:
  931. return CharacterMenuTab_Perks;
  932. }
  933.  
  934. return CharacterMenuTab_Sword;
  935. }
  936.  
  937. event OnStartApplyMode():void
  938. {
  939. OnPlaySoundEvent("gui_global_panel_open");
  940. }
  941.  
  942. event OnCancelApplyMode():void
  943. {
  944. OnPlaySoundEvent("gui_global_panel_close");
  945. }
  946.  
  947. event OnInventoryItemSelected(itemId:SItemUniqueId) : void
  948. {
  949. if (_inv.IsIdValid(itemId))
  950. {
  951. _playerInv.ClearItemIsNewFlag(itemId);
  952. }
  953. }
  954.  
  955. event OnBuySkill(skill : ESkill, slotID : int)
  956. {
  957. if (thePlayer.IsInCombat())
  958. {
  959. showNotification(GetLocStringByKeyExt("menu_cannot_perform_action_combat"));
  960. OnPlaySoundEvent("gui_global_denied");
  961. }
  962. else
  963. { slotID = SSS_ConvertTabSlotIDToSlotID(slotID, SSS_GetCurrentTab()); //zur13 modSSS XXX skill can be on other tab?
  964. tryUnequipSkill(skill);
  965. thePlayer.AddSkill(skill);
  966. thePlayer.EquipSkill(skill, SSS_ConvertSlotIDToTabSlotID(slotID, SSS_GetCurrentTab())); //zur13 modSSS XXX skill can be on other tab?
  967.  
  968. OnPlaySoundEvent("gui_character_buy_skill");
  969.  
  970.  
  971. UpdateMasterMutation();
  972. UpdateSkillPoints();
  973. PopulateTabData( GetTabForSkill( skill ), skill );
  974. }
  975. }
  976.  
  977. event OnSwapSkill(skill1 : ESkill, slotID1 : int, skill2 : ESkill, slotID2 : int)
  978. {
  979. if (thePlayer.IsInCombat())
  980. {
  981. showNotification(GetLocStringByKeyExt("menu_cannot_perform_action_combat"));
  982. OnPlaySoundEvent("gui_global_denied");
  983. }
  984. else
  985. { slotID1 = SSS_ConvertTabSlotIDToSlotID(slotID1, SSS_GetCurrentTab()); slotID2 = SSS_ConvertTabSlotIDToSlotID(slotID2, SSS_GetCurrentTab()); //zur13 modSSS
  986. thePlayer.EquipSkill(skill1, slotID1);
  987. thePlayer.EquipSkill(skill2, slotID2);
  988.  
  989. UpdateAppliedSkills();
  990. UpdateSkillPoints();
  991. UpdatePlayerStatisticsData();
  992. UpdateGroupsData();
  993. UpdateMutagens();
  994. UpdateMasterMutation();
  995.  
  996. OnPlaySoundEvent("gui_character_add_skill");
  997. }
  998. }
  999.  
  1000. event OnEquipSkill(skill : ESkill, slotID : int)
  1001. {
  1002. var oldSkill:ESkill;
  1003. var foundSkill:bool;
  1004. var oldSkillSlot:int;
  1005. var targetSlot:SSkillSlot;
  1006.  
  1007. if (thePlayer.IsInCombat())
  1008. {
  1009. showNotification(GetLocStringByKeyExt("menu_cannot_perform_action_combat"));
  1010. OnPlaySoundEvent("gui_global_denied");
  1011. }
  1012. else
  1013. { slotID = SSS_ConvertTabSlotIDToSlotID(slotID, SSS_GetCurrentTab()); //zur13 modSSS
  1014. foundSkill = thePlayer.GetSkillOnSlot(slotID, oldSkill);
  1015.  
  1016. OnPlaySoundEvent("gui_character_add_skill");
  1017.  
  1018. if (!foundSkill || oldSkill != skill)
  1019. {
  1020. tryUnequipSkill(skill);
  1021.  
  1022. thePlayer.EquipSkill(skill, slotID);
  1023.  
  1024. PopulateTabData(GetTabForSkill(skill));
  1025.  
  1026. if (oldSkillSlot != -1)
  1027. {
  1028. m_fxClearSkillSlot.InvokeSelfOneArg(FlashArgInt(oldSkillSlot));
  1029. }
  1030.  
  1031. UpdateAppliedSkill(slotID);
  1032. UpdateMutagens();
  1033. UpdatePlayerStatisticsData();
  1034. UpdateGroupsData();
  1035. UpdateMasterMutation();
  1036.  
  1037. if (oldSkill != S_SUndefined)
  1038. {
  1039. PopulateTabData(GetTabForSkill(oldSkill));
  1040. }
  1041.  
  1042. m_fxPaperdollChanged.InvokeSelf();
  1043. }
  1044. }
  1045. }
  1046.  
  1047. event OnUnequipSkill(slotID : int)
  1048. {
  1049. var skill : ESkill;
  1050. if(SSS_CheckTabChange(slotID)) return true; //zur13 modSSS
  1051. if (thePlayer.IsInCombat())
  1052. {
  1053. showNotification(GetLocStringByKeyExt("menu_cannot_perform_action_combat"));
  1054. OnPlaySoundEvent("gui_global_denied");
  1055. }
  1056. else
  1057. { slotID = SSS_ConvertTabSlotIDToSlotID(slotID, SSS_GetCurrentTab()); //zur13 modSSS
  1058. thePlayer.GetSkillOnSlot(slotID, skill);
  1059.  
  1060. OnPlaySoundEvent("gui_character_remove_skill");
  1061.  
  1062. LogChannel('CHR', "OnUnequipSkill " + slotID);
  1063. thePlayer.UnequipSkill(slotID);
  1064. PopulateTabData(GetTabForSkill(skill));
  1065.  
  1066. UpdateAppliedSkill(slotID);
  1067.  
  1068. UpdateMutagens();
  1069. UpdatePlayerStatisticsData();
  1070. UpdateGroupsData();
  1071. UpdateMasterMutation();
  1072.  
  1073. m_fxPaperdollChanged.InvokeSelf();
  1074. }
  1075. }
  1076.  
  1077. event OnUpdateMutationData()
  1078. {
  1079. UpdateAppliedSkills();
  1080. PopulateTabData(CharacterMenuTab_Mutagens);
  1081. UpdateMutagens();
  1082. UpdateGroupsData();
  1083. UpdatePlayerStatisticsData();
  1084. }
  1085.  
  1086. event OnUpgradeSkill(skillID : ESkill)
  1087. {
  1088. var skill : SSkill;
  1089.  
  1090. skill = thePlayer.GetPlayerSkill(skillID);
  1091.  
  1092. if (thePlayer.IsInCombat())
  1093. {
  1094. showNotification(GetLocStringByKeyExt("menu_cannot_perform_action_combat"));
  1095. OnPlaySoundEvent("gui_global_denied");
  1096. }
  1097. else
  1098. {
  1099. initDataBuySkill = new W3BuySkillConfirmation in this;
  1100. initDataBuySkill.HideTutorial = true;
  1101.  
  1102. if (GetWitcherPlayer().GetSkillLevel(skill.skillType) == 0)
  1103. {
  1104. initDataBuySkill.SetMessageTitle(GetLocStringByKeyExt("panel_character_popup_title_buy_skill"));
  1105. initDataBuySkill.SetMessageText(GetLocStringByKeyExt("panel_character_popup_title_buy_skill_text"));
  1106. }
  1107. else
  1108. {
  1109. initDataBuySkill.SetMessageTitle(GetLocStringByKeyExt("panel_character_popup_title_upgrade_skill"));
  1110. initDataBuySkill.SetMessageText(GetLocStringByKeyExt("panel_character_popup_title_upgrade_skill_text"));
  1111. }
  1112.  
  1113. initDataBuySkill.characterMenuRef = this;
  1114. initDataBuySkill.targetSkill = skillID;
  1115. initDataBuySkill.BlurBackground = true;
  1116.  
  1117. RequestSubMenu('PopupMenu', initDataBuySkill);
  1118. }
  1119. }
  1120.  
  1121. event OnEquipMutagen(itemID:SItemUniqueId, slotId:EEquipmentSlots)
  1122. {
  1123. if (thePlayer.IsInCombat())
  1124. {
  1125. showNotification(GetLocStringByKeyExt("menu_cannot_perform_action_combat"));
  1126. OnPlaySoundEvent("gui_global_denied");
  1127. }
  1128. else
  1129. { slotId = SSS_ConvertMutSlotIDFromFlash(slotId, SSS_GetCurrentTab()); //zur13 modSSS mutTabs
  1130. GetWitcherPlayer().EquipItemInGivenSlot(itemID, slotId, false);
  1131.  
  1132. OnPlaySoundEvent("gui_character_place_mutagen");
  1133.  
  1134. UpdateMutagens();
  1135. UpdateGroupsData();
  1136. PopulateTabData(CharacterMenuTab_Mutagens);
  1137. UpdatePlayerStatisticsData();
  1138. UpdateMasterMutation();
  1139.  
  1140. m_fxPaperdollChanged.InvokeSelf();
  1141. }
  1142. }
  1143.  
  1144. event OnUnequipMutagen(slotID : int)
  1145. {
  1146. var mutagen : SItemUniqueId;
  1147. if (thePlayer.IsInCombat())
  1148. {
  1149. showNotification(GetLocStringByKeyExt("menu_cannot_perform_action_combat"));
  1150. OnPlaySoundEvent("gui_global_denied");
  1151. }
  1152. else
  1153. { slotID = SSS_ConvertMutSlotIDFromFlash(slotID, SSS_GetCurrentTab()); //zur13 modSSS mutTabs
  1154. LogChannel('CHR', "onUnequipMutagen " + slotID);
  1155. GetWitcherPlayer().UnequipItemFromSlot(slotID);
  1156.  
  1157. OnPlaySoundEvent("gui_character_remove_mutagen");
  1158.  
  1159. RemoveMutagenBonus();
  1160. UpdateMutagens();
  1161. UpdatePlayerStatisticsData();
  1162. PopulateTabData(CharacterMenuTab_Mutagens);
  1163. UpdateGroupsData();
  1164. UpdateMasterMutation();
  1165.  
  1166. m_fxPaperdollChanged.InvokeSelf();
  1167. }
  1168. }
  1169.  
  1170. protected function tryUnequipSkill(skill : ESkill):void
  1171. {
  1172. var currentSkillSlotIdx:int;
  1173. var res:bool;
  1174.  
  1175. if (thePlayer.IsInCombat())
  1176. {
  1177. showNotification(GetLocStringByKeyExt("menu_cannot_perform_action_combat"));
  1178. OnPlaySoundEvent("gui_global_denied");
  1179. }
  1180. else
  1181. {
  1182. currentSkillSlotIdx = thePlayer.GetSkillSlotIndexFromSkill(skill);
  1183.  
  1184. LogChannel('CHR', "tryUnequipSkill, currentSkillSlotIdx " + currentSkillSlotIdx);
  1185. if (currentSkillSlotIdx > -1)
  1186. {
  1187. res = thePlayer.UnequipSkill(currentSkillSlotIdx + 1);
  1188. }
  1189. if( SSS_IsSlotOnCurrentTab( currentSkillSlotIdx + 1, this ) ) //zur13 modSSS
  1190. m_fxClearSkillSlot.InvokeSelfOneArg(FlashArgInt(SSS_ConvertSlotIDToTabSlotID(currentSkillSlotIdx + 1, SSS_GetCurrentTab()))); //zur13 modSSS
  1191.  
  1192. RemoveMutagenBonus();
  1193. UpdateMutagens();
  1194.  
  1195. }
  1196. }
  1197.  
  1198. public function handleBuySkillConfirmation(skill : ESkill)
  1199. {
  1200. var m_guiManager : CR4GuiManager;
  1201.  
  1202. thePlayer.AddSkill(skill);
  1203. OnPlaySoundEvent("gui_character_buy_skill");
  1204. UpdateSkillPoints();
  1205.  
  1206. PopulateTabData( GetTabForSkill( skill ), skill );
  1207.  
  1208. UpdateAppliedSkillIfEquipped(skill);
  1209. UpdatePlayerStatisticsData();
  1210. UpdateMutagens();
  1211. UpdateGroupsData();
  1212. m_guiManager = theGame.GetGuiManager();
  1213. m_guiManager.RegisterNewSkillEntry( skill );
  1214. m_fxNotifySkillUpgraded.InvokeSelfOneArg(FlashArgInt(skill));
  1215. }
  1216.  
  1217. public function UpdateData(tabs:bool):void
  1218. {
  1219. if (tabs)
  1220. {
  1221. PopulateTabData(CharacterMenuTab_Sword);
  1222. PopulateTabData(CharacterMenuTab_Signs);
  1223. PopulateTabData(CharacterMenuTab_Alchemy);
  1224. PopulateTabData(CharacterMenuTab_Perks);
  1225. PopulateTabData(CharacterMenuTab_Mutagens);
  1226. }
  1227.  
  1228. UpdateAppliedSkills();
  1229. UpdateMutagens();
  1230. UpdateSkillPoints();
  1231. UpdatePlayerStatisticsData();
  1232. UpdateGroupsData();
  1233. }
  1234.  
  1235. protected function UpdateGroupsData():void
  1236. {
  1237. var gfxGroupsList : CScriptedFlashArray;
  1238. var i, j : int;
  1239.  
  1240. gfxGroupsList = m_flashValueStorage.CreateTempFlashArray();
  1241.  
  1242. RemoveMutagenBonus();
  1243.  
  1244. gfxGroupsList.PushBackFlashObject(CreateBonusGFxData(1));
  1245. gfxGroupsList.PushBackFlashObject(CreateBonusGFxData(2));
  1246. gfxGroupsList.PushBackFlashObject(CreateBonusGFxData(3));
  1247. gfxGroupsList.PushBackFlashObject(CreateBonusGFxData(4));
  1248.  
  1249. m_flashValueStorage.SetFlashArray("character.groups.bonus", gfxGroupsList);
  1250. }
  1251.  
  1252. private function RemoveMutagenBonus()
  1253. {
  1254. var i : int;
  1255.  
  1256. for (i = 0; i < 120; i += 1) //zur13 modSSS changed to 120
  1257. {
  1258. thePlayer.RemoveAbility( 'greater_mutagen_color_green_x' );
  1259. thePlayer.RemoveAbility( 'greater_mutagen_color_red_x' );
  1260. thePlayer.RemoveAbility( 'greater_mutagen_color_blue_x' );
  1261. thePlayer.RemoveAbility( 'lesser_mutagen_color_green_x' );
  1262. thePlayer.RemoveAbility( 'lesser_mutagen_color_red_x' );
  1263. thePlayer.RemoveAbility( 'lesser_mutagen_color_blue_x' );
  1264. thePlayer.RemoveAbility( 'mutagen_color_green_x' );
  1265. thePlayer.RemoveAbility( 'mutagen_color_red_x' );
  1266. thePlayer.RemoveAbility( 'mutagen_color_blue_x' );
  1267. //NewMutagensMod
  1268. thePlayer.RemoveAbility( 'unique_mutagen_color_green_x' );
  1269. thePlayer.RemoveAbility( 'unique_mutagen_color_red_x' );
  1270. thePlayer.RemoveAbility( 'unique_mutagen_color_blue_x' );
  1271. thePlayer.RemoveAbility( 'legendary_mutagen_color_green_x' );
  1272. thePlayer.RemoveAbility( 'legendary_mutagen_color_red_x' );
  1273. thePlayer.RemoveAbility( 'legendary_mutagen_color_blue_x' );
  1274. thePlayer.RemoveAbility( 'master_mutagen_color_green_x' );
  1275. thePlayer.RemoveAbility( 'master_mutagen_color_red_x' );
  1276. thePlayer.RemoveAbility( 'master_mutagen_color_blue_x' );
  1277. }
  1278.  
  1279. private function GetGroupBonusDescription( groupId:int, out color : ESkillColor ):string
  1280. {
  1281. var defManager : CDefinitionsManagerAccessor;
  1282. var curAttributeValue, min, max : SAbilityAttributeValue;
  1283. var curAttributeCalc : float;
  1284. var curDescription : string;
  1285. var curAbilityName : name;
  1286. var attributes : array<name>;
  1287. var curColorCount,i : int;
  1288. var hasAbility : bool;
  1289. var mutagen : SItemUniqueId;
  1290. var hasMutagen : bool;
  1291. var mutagenStats : array<SAttributeTooltip>;
  1292. var attributeValue : float;
  1293. var synergyBonus : float;
  1294. var pam : W3PlayerAbilityManager;
  1295.  
  1296. hasMutagen = GetWitcherPlayer().GetItemEquippedOnSlot(thePlayer.GetMutagenSlotIDFromGroupID(groupId), mutagen);
  1297.  
  1298. pam = (W3PlayerAbilityManager)thePlayer.abilityManager;
  1299. curAbilityName = thePlayer.GetSkillGroupBonus(groupId);
  1300. curColorCount = 1 + thePlayer.GetGroupBonusCount( thePlayer.GetInventory().GetSkillMutagenColor( mutagen ), groupId );
  1301.  
  1302. hasAbility = thePlayer.HasAbility(curAbilityName);
  1303.  
  1304. color = SC_None;
  1305.  
  1306. if ((curAbilityName == 'None' || !hasAbility) && !hasMutagen)
  1307. {
  1308. return "";
  1309. }
  1310.  
  1311. if (hasMutagen)
  1312. {
  1313. _inv.GetItemStats(mutagen, mutagenStats);
  1314. if ( pam.GetMutagenBonusAbilityName(mutagen) == 'mutagen_color_red_synergy_bonus' )
  1315. {
  1316. thePlayer.AddAbilityMultiple('mutagen_color_red_x' , curColorCount - 1);
  1317. color = SC_Red;
  1318. }
  1319. if ( pam.GetMutagenBonusAbilityName(mutagen) == 'mutagen_color_green_synergy_bonus' )
  1320. {
  1321. thePlayer.AddAbilityMultiple('mutagen_color_green_x' , curColorCount - 1);
  1322. color = SC_Green;
  1323. }
  1324. if ( pam.GetMutagenBonusAbilityName(mutagen) == 'mutagen_color_blue_synergy_bonus' )
  1325. {
  1326. thePlayer.AddAbilityMultiple('mutagen_color_blue_x' , curColorCount - 1);
  1327. color = SC_Blue;
  1328. }
  1329.  
  1330. if ( pam.GetMutagenBonusAbilityName(mutagen) == 'mutagen_color_lesser_red_synergy_bonus' )
  1331. {
  1332. thePlayer.AddAbilityMultiple('lesser_mutagen_color_red_x' , curColorCount - 1);
  1333. color = SC_Red;
  1334. }
  1335. if ( pam.GetMutagenBonusAbilityName(mutagen) == 'mutagen_color_lesser_green_synergy_bonus' )
  1336. {
  1337. thePlayer.AddAbilityMultiple('lesser_mutagen_color_green_x' , curColorCount - 1);
  1338. color = SC_Green;
  1339. }
  1340. if ( pam.GetMutagenBonusAbilityName(mutagen) == 'mutagen_color_lesser_blue_synergy_bonus' )
  1341. {
  1342. thePlayer.AddAbilityMultiple('lesser_mutagen_color_blue_x' , curColorCount - 1);
  1343. color = SC_Blue;
  1344. }
  1345.  
  1346. if ( pam.GetMutagenBonusAbilityName(mutagen) == 'greater_mutagen_color_red_synergy_bonus' )
  1347. {
  1348. thePlayer.AddAbilityMultiple('greater_mutagen_color_red_x' , curColorCount - 1);
  1349. color = SC_Red;
  1350. }
  1351. if ( pam.GetMutagenBonusAbilityName(mutagen) == 'greater_mutagen_color_green_synergy_bonus' )
  1352. {
  1353. thePlayer.AddAbilityMultiple('greater_mutagen_color_green_x' , curColorCount - 1);
  1354. color = SC_Green;
  1355. }
  1356. if ( pam.GetMutagenBonusAbilityName(mutagen) == 'greater_mutagen_color_blue_synergy_bonus' )
  1357. {
  1358. thePlayer.AddAbilityMultiple('greater_mutagen_color_blue_x' , curColorCount - 1);
  1359. color = SC_Blue;
  1360. }
  1361.  
  1362. //NewMutagensMod
  1363. if ( pam.GetMutagenBonusAbilityName(mutagen) == 'master_mutagen_color_red_synergy_bonus' )
  1364. {
  1365. thePlayer.AddAbilityMultiple('master_mutagen_color_red_x' , curColorCount - 1);
  1366. color = SC_Red;
  1367. }
  1368. if ( pam.GetMutagenBonusAbilityName(mutagen) == 'master_mutagen_color_green_synergy_bonus' )
  1369. {
  1370. thePlayer.AddAbilityMultiple('master_mutagen_color_green_x' , curColorCount - 1);
  1371. color = SC_Green;
  1372. }
  1373. if ( pam.GetMutagenBonusAbilityName(mutagen) == 'master_mutagen_color_blue_synergy_bonus' )
  1374. {
  1375. thePlayer.AddAbilityMultiple('master_mutagen_color_blue_x' , curColorCount - 1);
  1376. color = SC_Blue;
  1377. }
  1378.  
  1379. if ( pam.GetMutagenBonusAbilityName(mutagen) == 'legendary_mutagen_color_red_synergy_bonus' )
  1380. {
  1381. thePlayer.AddAbilityMultiple('legendary_mutagen_color_red_x' , curColorCount - 1);
  1382. color = SC_Red;
  1383. }
  1384. if ( pam.GetMutagenBonusAbilityName(mutagen) == 'legendary_mutagen_color_green_synergy_bonus' )
  1385. {
  1386. thePlayer.AddAbilityMultiple('legendary_mutagen_color_green_x' , curColorCount - 1);
  1387. color = SC_Green;
  1388. }
  1389. if ( pam.GetMutagenBonusAbilityName(mutagen) == 'legendary_mutagen_color_blue_synergy_bonus' )
  1390. {
  1391. thePlayer.AddAbilityMultiple('legendary_mutagen_color_blue_x' , curColorCount - 1);
  1392. color = SC_Blue;
  1393. }
  1394.  
  1395. if ( pam.GetMutagenBonusAbilityName(mutagen) == 'unique_mutagen_color_red_synergy_bonus' )
  1396. {
  1397. thePlayer.AddAbilityMultiple('unique_mutagen_color_red_x' , curColorCount - 1);
  1398. color = SC_Red;
  1399. }
  1400. if ( pam.GetMutagenBonusAbilityName(mutagen) == 'unique_mutagen_color_green_synergy_bonus' )
  1401. {
  1402. thePlayer.AddAbilityMultiple('unique_mutagen_color_green_x' , curColorCount - 1);
  1403. color = SC_Green;
  1404. }
  1405. if ( pam.GetMutagenBonusAbilityName(mutagen) == 'unique_mutagen_color_blue_synergy_bonus' )
  1406. {
  1407. thePlayer.AddAbilityMultiple('unique_mutagen_color_blue_x' , curColorCount - 1);
  1408. color = SC_Blue;
  1409. }
  1410. for (i = 0; i < mutagenStats.Size(); i += 1)
  1411. {
  1412. curDescription = mutagenStats[i].attributeName + " ";
  1413. if (i > 0)
  1414. {
  1415. curDescription += ", ";
  1416. }
  1417.  
  1418. if (hasAbility)
  1419. {
  1420. attributeValue = mutagenStats[i].value * curColorCount;
  1421. }
  1422. else
  1423. {
  1424. attributeValue = mutagenStats[i].value * curColorCount;
  1425. }
  1426.  
  1427. if ( GetWitcherPlayer().CanUseSkill ( S_Alchemy_s19 ) )
  1428. {
  1429. synergyBonus = CalculateAttributeValue(GetWitcherPlayer().GetSkillAttributeValue(S_Alchemy_s19, 'synergy_bonus', false, false));
  1430. synergyBonus *= GetWitcherPlayer().GetSkillLevel(S_Alchemy_s19);
  1431. attributeValue += attributeValue * synergyBonus;
  1432. }
  1433.  
  1434. if( mutagenStats[i].percentageValue )
  1435. {
  1436. curDescription += "+" + RoundMath(attributeValue * 100 ) +"%";
  1437. }
  1438. else
  1439. {
  1440. curDescription += "+" + RoundMath(attributeValue);
  1441. }
  1442. }
  1443. }
  1444. else
  1445. {
  1446.  
  1447. }
  1448.  
  1449. return curDescription;
  1450. }
  1451.  
  1452.  
  1453. protected function CreateBonusGFxData(index:int):CScriptedFlashObject
  1454. {
  1455. var gfxGroupBonus : CScriptedFlashObject;
  1456. var description : string;
  1457. var color : ESkillColor;
  1458. return SSS_CreateBonusGFxData(index);//zur13 modSSS
  1459. description = GetGroupBonusDescription(index, color);
  1460.  
  1461. if (index > m_previousSkillBonuses.Size())
  1462. {
  1463. m_previousSkillBonuses.PushBack(description);
  1464. }
  1465. else if (m_previousSkillBonuses[index] != description)
  1466. {
  1467. m_previousSkillBonuses[index] = description;
  1468. if (description == "")
  1469. {
  1470. OnPlaySoundEvent("gui_character_synergy_effect_lose");
  1471. }
  1472. else
  1473. {
  1474. OnPlaySoundEvent("gui_character_synergy_effect");
  1475. }
  1476. }
  1477.  
  1478. gfxGroupBonus = m_flashValueStorage.CreateTempFlashObject();
  1479. gfxGroupBonus.SetMemberFlashString('description', description);
  1480. gfxGroupBonus.SetMemberFlashInt('color', color);
  1481.  
  1482. return gfxGroupBonus;
  1483. }
  1484.  
  1485. protected function UpdateAppliedSkills():void
  1486. {
  1487. var gfxSlots : CScriptedFlashObject;
  1488. var gfxSlotsList : CScriptedFlashArray;
  1489. var curSlot : SSkillSlot;
  1490. var equipedSkill : SSkill;
  1491. var skillSlots : array<SSkillSlot>;
  1492. var slotsCount : int;
  1493. var i : int;
  1494. var equippedMutationId : EPlayerMutationType;
  1495. var equippedMutation : SMutation;
  1496. var colorsList : array< ESkillColor >;
  1497. var colorBorderId : string;
  1498. SSS_UpdateAppliedSkills(); return;//zur13 modSSS
  1499. gfxSlotsList = m_flashValueStorage.CreateTempFlashArray();
  1500. skillSlots = thePlayer.GetSkillSlots();
  1501. slotsCount = skillSlots.Size();
  1502. equippedMutationId = GetWitcherPlayer().GetEquippedMutationType();
  1503.  
  1504. if( equippedMutationId != EPMT_None )
  1505. {
  1506. equippedMutation = GetWitcherPlayer().GetMutation( equippedMutationId );
  1507. }
  1508.  
  1509. LogChannel( 'CHR', "UpdateAppliedSkills add " + slotsCount + " items" );
  1510.  
  1511. for( i=0; i < slotsCount; i+=1 )
  1512. {
  1513. curSlot = skillSlots[i];
  1514. equipedSkill = thePlayer.GetPlayerSkill( curSlot.socketedSkill );
  1515.  
  1516. gfxSlots = m_flashValueStorage.CreateTempFlashObject();
  1517. GetSkillGFxObject( equipedSkill, false, gfxSlots );
  1518.  
  1519. gfxSlots.SetMemberFlashInt( 'tabId', GetTabForSkill( curSlot.socketedSkill ) );
  1520. gfxSlots.SetMemberFlashInt( 'slotId', curSlot.id );
  1521. gfxSlots.SetMemberFlashInt( 'unlockedOnLevel', curSlot.unlockedOnLevel );
  1522. gfxSlots.SetMemberFlashInt( 'groupID', curSlot.groupID );
  1523. gfxSlots.SetMemberFlashBool( 'unlocked', curSlot.unlocked );
  1524.  
  1525. colorBorderId = "";
  1526. if( curSlot.id >= BSS_SkillSlot1 && curSlot.id <= BSS_SkillSlot4 ) //zur13 modSSS
  1527. {
  1528. gfxSlots.SetMemberFlashBool( 'isMutationSkill', true );
  1529. gfxSlots.SetMemberFlashInt( 'unlockedOnLevel', ( curSlot.id - BSS_SkillSlot1 + 1 ) );
  1530.  
  1531. if (equippedMutationId != EPMT_None)
  1532. {
  1533. colorsList = equippedMutation.colors;
  1534.  
  1535. if( colorsList.Contains(SC_Red) )
  1536. {
  1537. colorBorderId += "Red";
  1538. }
  1539.  
  1540. if( colorsList.Contains(SC_Green) )
  1541. {
  1542. colorBorderId += "Green";
  1543. }
  1544.  
  1545. if( colorsList.Contains(SC_Blue) )
  1546. {
  1547. colorBorderId += "Blue";
  1548. }
  1549. }
  1550. // sortX
  1551. //gfxSlots.SetMemberFlashString( 'colorBorder', colorBorderId );
  1552. }
  1553. else
  1554. {
  1555. gfxSlots.SetMemberFlashInt( 'unlockedOnLevel', curSlot.unlockedOnLevel );
  1556. }
  1557.  
  1558. gfxSlotsList.PushBackFlashObject( gfxSlots );
  1559. }
  1560.  
  1561. m_flashValueStorage.SetFlashArray( "character.skills.slots", gfxSlotsList );
  1562. }
  1563.  
  1564. protected function SkillColorEnumToName( color : ESkillColor ) : void
  1565. {
  1566.  
  1567. }
  1568.  
  1569. protected function GetSlotForSkill(skill : ESkill):int
  1570. {
  1571. var curSlot : SSkillSlot;
  1572. var skillSlots : array<SSkillSlot>;
  1573. var slotsCount : int;
  1574. var i : int;
  1575. var slotID:int;
  1576.  
  1577. slotID = -1;
  1578.  
  1579. skillSlots = thePlayer.GetSkillSlots();
  1580. slotsCount = skillSlots.Size();
  1581.  
  1582. for (i=0; i<slotsCount; i+=1)
  1583. {
  1584. curSlot = skillSlots[i];
  1585.  
  1586. if (curSlot.socketedSkill == skill)
  1587. {
  1588. slotID = curSlot.id;
  1589. break;
  1590. }
  1591. }
  1592.  
  1593. return slotID;
  1594. }
  1595.  
  1596. protected function UpdateAppliedSkillIfEquipped(skill : ESkill):void
  1597. {
  1598. var slotId: int;
  1599.  
  1600. slotId = GetSlotForSkill(skill);
  1601. if( !SSS_IsSlotOnCurrentTab(slotId, this) ) return;//zur13 modSSS
  1602. if (slotId != -1)
  1603. {
  1604. UpdateAppliedSkill(slotId);
  1605. }
  1606. }
  1607.  
  1608. protected function UpdateAppliedSkill(slotID:int):void
  1609. {
  1610. var curSlot : SSkillSlot;
  1611. var skillSlots : array<SSkillSlot>;
  1612. var slotsCount : int;
  1613. var i : int;
  1614. var foundSlot : bool;
  1615.  
  1616. foundSlot = false;
  1617.  
  1618. skillSlots = thePlayer.GetSkillSlots();
  1619. slotsCount = skillSlots.Size();
  1620.  
  1621. for (i=0; i<slotsCount; i+=1)
  1622. {
  1623. curSlot = skillSlots[i];
  1624.  
  1625. if (curSlot.id == slotID)
  1626. {
  1627. foundSlot = true;
  1628. break;
  1629. }
  1630. }
  1631.  
  1632. if (foundSlot)
  1633. {
  1634. SendEquippedSkillInfo(curSlot);
  1635. }
  1636. }
  1637.  
  1638. protected function SendEquippedSkillInfo(curSlot : SSkillSlot):void
  1639. {
  1640. var gfxSlot : CScriptedFlashObject;
  1641. var equipedSkill : SSkill;
  1642. var colorsList : array< ESkillColor >;
  1643. var colorBorderId : string;
  1644. var equippedMutationId : EPlayerMutationType;
  1645. var equippedMutation : SMutation;
  1646. if( !SSS_IsSlotOnCurrentTab(curSlot.id, this) ) return;//zur13 modSSS
  1647. equippedMutationId = GetWitcherPlayer().GetEquippedMutationType();
  1648.  
  1649. if( equippedMutationId != EPMT_None )
  1650. {
  1651. equippedMutation = GetWitcherPlayer().GetMutation( equippedMutationId );
  1652. }
  1653.  
  1654. equipedSkill = thePlayer.GetPlayerSkill(curSlot.socketedSkill);
  1655.  
  1656. gfxSlot = m_flashValueStorage.CreateTempFlashObject();
  1657. GetSkillGFxObject(equipedSkill, false, gfxSlot);
  1658.  
  1659. gfxSlot.SetMemberFlashInt('tabId', GetTabForSkill(curSlot.socketedSkill));
  1660. gfxSlot.SetMemberFlashInt('slotId', SSS_ConvertSlotIDToTabSlotID(curSlot.id, SSS_GetCurrentTab())); //zur13 modSSS
  1661. gfxSlot.SetMemberFlashInt('unlockedOnLevel', curSlot.unlockedOnLevel);
  1662. gfxSlot.SetMemberFlashInt('groupID', curSlot.groupID);
  1663. gfxSlot.SetMemberFlashBool('unlocked', curSlot.unlocked);
  1664.  
  1665. colorBorderId = "";
  1666. if( equippedMutationId != EPMT_None && curSlot.id >= BSS_SkillSlot1 && curSlot.id <= BSS_SkillSlot4 ) //zur13 modSSS
  1667. {
  1668. colorsList = equippedMutation.colors;
  1669.  
  1670. if( colorsList.Contains(SC_Red) )
  1671. {
  1672. colorBorderId += "Red";
  1673. }
  1674.  
  1675. if( colorsList.Contains(SC_Green) )
  1676. {
  1677. colorBorderId += "Green";
  1678. }
  1679.  
  1680. if( colorsList.Contains(SC_Blue) )
  1681. {
  1682. colorBorderId += "Blue";
  1683. }
  1684. // sortX
  1685. //gfxSlot.SetMemberFlashString( 'colorBorder', colorBorderId );
  1686. }
  1687.  
  1688. m_flashValueStorage.SetFlashObject( "character.skills.slot.update", gfxSlot);
  1689. }
  1690.  
  1691. protected function UpdateMutagens():void
  1692. {
  1693. var idx : int;
  1694. var mutCount : int;
  1695. var slotUnlocked : bool;
  1696. var gfxMutSlot : CScriptedFlashObject;
  1697. var gfxMutSlotsList : CScriptedFlashArray;
  1698. var skillMutagenSlots : array<SMutagenSlot>;
  1699. var currentMutSlot : SMutagenSlot;
  1700. var invComponent : CInventoryComponent;
  1701. var playerInv : W3GuiPlayerInventoryComponent;
  1702. if( SSS_UpdateMutagens2() ) return; //zur13 modSSS mutTabs
  1703. invComponent = thePlayer.GetInventory();
  1704. playerInv = new W3GuiPlayerInventoryComponent in this;
  1705. playerInv.Initialize( invComponent );
  1706.  
  1707. gfxMutSlotsList = m_flashValueStorage.CreateTempFlashArray();
  1708. skillMutagenSlots = thePlayer.GetPlayerSkillMutagens();
  1709. mutCount = skillMutagenSlots.Size();
  1710.  
  1711. for (idx = 0; idx < mutCount; idx+=1)
  1712. {
  1713. currentMutSlot = skillMutagenSlots[idx];
  1714. gfxMutSlot = m_flashValueStorage.CreateTempFlashObject();
  1715. slotUnlocked = GetWitcherPlayer().GetLevel() >= currentMutSlot.unlockedAtLevel;
  1716.  
  1717. gfxMutSlot.SetMemberFlashInt('slotId', currentMutSlot.equipmentSlot);
  1718. gfxMutSlot.SetMemberFlashInt('groupId', currentMutSlot.skillGroupID);
  1719. gfxMutSlot.SetMemberFlashString('slotType', currentMutSlot.equipmentSlot);
  1720. gfxMutSlot.SetMemberFlashBool('unlocked', slotUnlocked);
  1721. gfxMutSlot.SetMemberFlashInt('unlockedAtLevel', currentMutSlot.unlockedAtLevel);
  1722.  
  1723. if (invComponent.IsIdValid(currentMutSlot.item))
  1724. {
  1725. playerInv.SetInventoryFlashObjectForItem(currentMutSlot.item, gfxMutSlot); gfxMutSlot.SetMemberFlashString('color', SSS_GetMutageSlotColor(currentMutSlot, this, invComponent)); //zur13 modSSS
  1726. //gfxMutSlot.SetMemberFlashString('color', invComponent.GetSkillMutagenColor(currentMutSlot.item)); //zur13 modSSS
  1727. }
  1728. else
  1729. {
  1730. gfxMutSlot.SetMemberFlashString('color', SC_None);
  1731. }
  1732. gfxMutSlotsList.PushBackFlashObject(gfxMutSlot);
  1733. }
  1734. m_flashValueStorage.SetFlashArray( "character.skills.mutagens", gfxMutSlotsList);
  1735. }
  1736.  
  1737. protected function GetSkillGFxObject(curSkill : SSkill, isGridView:bool, out dataObject : CScriptedFlashObject) : void
  1738. {
  1739. var skillColor:ESkillColor;
  1740. var subPathName:string;
  1741.  
  1742. var originSkillLevel : int;
  1743. var boostedSkillLevel : int;
  1744.  
  1745. skillColor = thePlayer.GetSkillColor(curSkill.skillType);
  1746.  
  1747. dataObject.SetMemberFlashInt('id', curSkill.skillType);
  1748. dataObject.SetMemberFlashInt('skillTypeId', curSkill.skillType);
  1749.  
  1750. originSkillLevel = GetWitcherPlayer().GetBoughtSkillLevel(curSkill.skillType);
  1751.  
  1752. if ( isGridView )
  1753. {
  1754. dataObject.SetMemberFlashInt('level', originSkillLevel);
  1755. }
  1756. else
  1757. {
  1758. boostedSkillLevel = GetWitcherPlayer().GetSkillLevel(curSkill.skillType);
  1759. dataObject.SetMemberFlashInt('level', boostedSkillLevel);
  1760.  
  1761. if (originSkillLevel < boostedSkillLevel)
  1762. {
  1763. dataObject.SetMemberFlashBool('highlight', true);
  1764. }
  1765. }
  1766.  
  1767. dataObject.SetMemberFlashInt('maxLevel', curSkill.maxLevel);
  1768. dataObject.SetMemberFlashInt('requiredPointsSpent', curSkill.requiredPointsSpent);
  1769.  
  1770. dataObject.SetMemberFlashString('dropDownLabel', GetLocStringByKeyExt( SkillPathTypeToName( curSkill.skillPath ) ) );
  1771. dataObject.SetMemberFlashString('skillType', curSkill.skillType);
  1772. dataObject.SetMemberFlashString('skillPath', curSkill.skillPath);
  1773. dataObject.SetMemberFlashString('skillSubPath', SkillSubPathTypeToName( curSkill.skillSubPath ) );
  1774. dataObject.SetMemberFlashString('abilityName', curSkill.abilityName);
  1775. dataObject.SetMemberFlashString('cost', curSkill.cost);
  1776. dataObject.SetMemberFlashString('iconPath', curSkill.iconPath);
  1777. dataObject.SetMemberFlashString('isCoreSkill', curSkill.isCoreSkill);
  1778. dataObject.SetMemberFlashString('skillPathPoints', SkillsPathsPointsSpent(curSkill));
  1779.  
  1780. dataObject.SetMemberFlashString('positionID', curSkill.positionID);
  1781. dataObject.SetMemberFlashString('color', skillColor);
  1782.  
  1783. dataObject.SetMemberFlashBool('hasRequiredPointsSpent', CheckIfLocked(curSkill));
  1784. dataObject.SetMemberFlashBool('updateAvailable', CheckIfAvailable(curSkill));
  1785. dataObject.SetMemberFlashBool('notEnoughPoints', ( GetCurrentSkillPoints() <= 0 ));
  1786.  
  1787. if (curSkill.skillType == S_SUndefined)
  1788. {
  1789. dataObject.SetMemberFlashBool('isEquipped', false);
  1790. }
  1791. else
  1792. {
  1793. dataObject.SetMemberFlashBool('isEquipped', thePlayer.IsSkillEquipped(curSkill.skillType));
  1794. }
  1795. dataObject.SetMemberFlashBool('isCoreSkill', curSkill.isCoreSkill);
  1796. }
  1797.  
  1798. protected function CheckIfLocked( skill : SSkill ) : bool
  1799. {
  1800. var skillType : ESkill;
  1801. skillType = SkillNameToEnum(skill.abilityName);
  1802. return GetWitcherPlayer().HasSpentEnoughPoints(skillType);
  1803. }
  1804.  
  1805. protected function SkillsPathsPointsSpent( skill : SSkill ) : int
  1806. {
  1807. var skillType : ESkill;
  1808. skillType = SkillNameToEnum(skill.abilityName);
  1809. return GetWitcherPlayer().PathPointsForSkillsPath(skillType);
  1810. }
  1811.  
  1812. protected function UpdateSkillPoints() : void
  1813. {
  1814. m_flashValueStorage.SetFlashInt( "character.skills.points", GetCurrentSkillPoints());
  1815. }
  1816.  
  1817. private function CheckIfAvailable( skill : SSkill ) : bool
  1818. {
  1819. var skillType : ESkill;
  1820. skillType = SkillNameToEnum(skill.abilityName);
  1821. return GetWitcherPlayer().CanLearnSkill(skillType);
  1822. }
  1823.  
  1824. private function GetCurrentSkillPoints() : int
  1825. {
  1826. var levelManager : W3LevelManager;
  1827. levelManager = GetWitcherPlayer().levelManager;
  1828. return levelManager.GetPointsFree(ESkillPoint);
  1829. }
  1830.  
  1831. private function GetSkillTooltipDescriptionForSkillLevel(targetSkill : SSkill, skillLevel : int) : string
  1832. {
  1833. var baseString : string;
  1834. var locKey : string;
  1835.  
  1836.  
  1837. if (skillLevel == 2)
  1838. {
  1839.  
  1840. locKey = targetSkill.localisationDescriptionLevel2Key;
  1841. }
  1842. else if (skillLevel >= 3)
  1843. {
  1844.  
  1845. locKey = targetSkill.localisationDescriptionLevel3Key;
  1846. }
  1847. else
  1848. {
  1849.  
  1850. locKey = targetSkill.localisationDescriptionKey;
  1851. }
  1852.  
  1853. if ( skillLevel == 0)
  1854. skillLevel = 1;
  1855.  
  1856. if (targetSkill.skillType <= S_Sword_s21)
  1857. baseString = GetSwordSkillsTooltipDescription(targetSkill, skillLevel, locKey);
  1858. else if (targetSkill.skillType <= S_Magic_s20)
  1859. baseString = GetSignSkillsTooltipDescription(targetSkill, skillLevel, locKey);
  1860. else if (targetSkill.skillType <= S_Alchemy_s20)
  1861. baseString = GetAlchemySkillsTooltipDescription(targetSkill, skillLevel, locKey);
  1862. else if (targetSkill.skillType <= S_Perk_MAX)
  1863. baseString = GetPerkTooltipDescription(targetSkill, skillLevel, locKey);
  1864.  
  1865. return baseString;
  1866. }
  1867.  
  1868. private function GetSwordSkillsTooltipDescription(targetSkill : SSkill, skillLevel : int, locKey : string) : string
  1869. {
  1870. var baseString : string;
  1871. var argsInt : array<int>;
  1872. var argsFloat : array<float>;
  1873. var argsString : array< string >;
  1874. var arg : float;
  1875. var arg_focus : float;
  1876. var ability : SAbilityAttributeValue;
  1877. var min, max : SAbilityAttributeValue;
  1878. var dm : CDefinitionsManagerAccessor;
  1879.  
  1880.  
  1881. dm = theGame.GetDefinitionsManager();
  1882. dm.GetAbilityAttributeValue('sword_adrenalinegain', 'focus_gain', min, max);
  1883. ability = GetAttributeRandomizedValue(min, max);
  1884. arg_focus = ability.valueAdditive;
  1885.  
  1886. switch (targetSkill.skillType)
  1887. {
  1888. case S_Magic_1:
  1889. if (skillLevel == 2) baseString = GetLocStringByKeyExt(targetSkill.localisationDescriptionLevel2Key);
  1890. else if (skillLevel >= 3) baseString = GetLocStringByKeyExt(targetSkill.localisationDescriptionLevel3Key);
  1891. else baseString = GetLocStringByKeyExt(targetSkill.localisationDescriptionKey);
  1892. break;
  1893. case S_Magic_2:
  1894. ability = GetWitcherPlayer().GetTotalSignSpellPower(S_Magic_2);
  1895. arg = CalculateAttributeValue( GetWitcherPlayer().GetSkillAttributeValue( S_Magic_2, theGame.params.DAMAGE_NAME_FIRE, false, true ) );
  1896. arg *= ability.valueMultiplicative;
  1897. argsInt.PushBack(RoundMath(arg));
  1898. baseString = GetLocStringByKeyExtWithParams(locKey, argsInt);
  1899. break;
  1900. case S_Magic_3:
  1901. if (skillLevel == 2) baseString = GetLocStringByKeyExt(targetSkill.localisationDescriptionLevel2Key);
  1902. else if (skillLevel >= 3) baseString = GetLocStringByKeyExt(targetSkill.localisationDescriptionLevel3Key);
  1903. else baseString = GetLocStringByKeyExt(targetSkill.localisationDescriptionKey);
  1904.  
  1905. ability += GetWitcherPlayer().GetSkillAttributeValue(S_Magic_3, 'trap_duration', false, true);
  1906. ability += GetWitcherPlayer().GetTotalSignSpellPower(S_Magic_3);
  1907. ability.valueMultiplicative -= 1;
  1908. arg = CalculateAttributeValue(ability);
  1909. baseString += "<br><br>" + GetLocStringByKeyExt("attribute_name_duration") + " : " + RoundMath(arg) + " " + GetLocStringByKeyExt("per_second");
  1910. break;
  1911. case S_Magic_4:
  1912. ability = GetWitcherPlayer().GetTotalSignSpellPower(S_Magic_4);
  1913. arg = CalculateAttributeValue(GetWitcherPlayer().GetSkillAttributeValue(S_Magic_4, 'shield_health', false, false)) * ability.valueMultiplicative;
  1914. arg /= RoundMath(thePlayer.GetStat(BCS_Vitality, true));
  1915. argsInt.PushBack(RoundMath(arg*100));
  1916. baseString = GetLocStringByKeyExtWithParams(locKey, argsInt);
  1917. break;
  1918. case S_Magic_5:
  1919. ability = GetWitcherPlayer().GetTotalSignSpellPower(S_Magic_5);
  1920. ability += GetWitcherPlayer().GetSkillAttributeValue(S_Magic_5, 'duration', false, true);
  1921. argsInt.PushBack(RoundMath(CalculateAttributeValue(ability)));
  1922. baseString = GetLocStringByKeyExtWithParams(locKey, argsInt);
  1923. break;
  1924.  
  1925. case S_Sword_5:
  1926. ability = GetWitcherPlayer().GetSkillAttributeValue(S_Sword_5, PowerStatEnumToName(CPS_AttackPower), false, true);
  1927. argsInt.PushBack( RoundMath( ability.valueMultiplicative * 100) );
  1928. baseString = GetLocStringByKeyExtWithParams(locKey, argsInt);
  1929. break;
  1930.  
  1931. case S_Sword_s01:
  1932.  
  1933. ability = GetWitcherPlayer().GetSkillAttributeValue(S_Sword_s01, 'cost_reduction', false, false);
  1934. argsInt.PushBack( RoundMath(ability.valueMultiplicative * 100 * skillLevel) );
  1935.  
  1936. baseString = GetLocStringByKeyExtWithParams(locKey, argsInt)+ "<br>" + GetLocStringByKeyExt("focus_gain") + ": +" + RoundF((arg_focus * 100) * skillLevel) + "%";;
  1937. break;
  1938. case S_Sword_s02:
  1939.  
  1940. arg = CalculateAttributeValue(GetWitcherPlayer().GetSkillAttributeValue(S_Sword_s02, theGame.params.CRITICAL_HIT_CHANCE, false, false)) * skillLevel;
  1941. argsInt.PushBack(Min(RoundMath(arg*100),100));
  1942.  
  1943.  
  1944. ability = GetWitcherPlayer().GetSkillAttributeValue(S_Sword_s02, 'adrenaline_final_damage_bonus', false, false);
  1945. argsInt.PushBack(RoundMath(ability.valueMultiplicative*100));
  1946.  
  1947. baseString = GetLocStringByKeyExtWithParams(locKey, argsInt) + "<br>" + GetLocStringByKeyExt("focus_gain") + ": +" + RoundF((arg_focus * 100) * skillLevel) + "%";
  1948. break;
  1949. case S_Sword_s03:
  1950. arg = CalculateAttributeValue(GetWitcherPlayer().GetSkillAttributeValue(S_Sword_s03, 'instant_kill_chance', false, false)) * skillLevel;
  1951. argsInt.PushBack(RoundMath(arg*100));
  1952. argsString.PushBack( NoTrailZeros( theGame.params.INSTANT_KILL_INTERNAL_PLAYER_COOLDOWN ) );
  1953. baseString = GetLocStringByKeyExtWithParams(locKey, argsInt, , argsString) + "<br>" + GetLocStringByKeyExt("focus_gain") + ": +" + RoundF((arg_focus * 100) * skillLevel) + "%";
  1954. break;
  1955. case S_Sword_s04:
  1956. ability = GetWitcherPlayer().GetSkillAttributeValue(S_Sword_s04, PowerStatEnumToName(CPS_AttackPower), false, false) * skillLevel;
  1957. argsInt.PushBack(RoundMath(ability.valueMultiplicative*100));
  1958. baseString = GetLocStringByKeyExtWithParams(locKey, argsInt) + "<br>" + GetLocStringByKeyExt("focus_gain") + ": +" + RoundF((arg_focus * 100) * skillLevel) + "%";
  1959. break;
  1960. case S_Sword_s05:
  1961. arg = CalculateAttributeValue(GetWitcherPlayer().GetSkillAttributeValue(S_Sword_s05, 'dmg_per_sec', false, false)) * skillLevel;
  1962. argsInt.PushBack(RoundMath(arg));
  1963. arg = CalculateAttributeValue(GetWitcherPlayer().GetSkillAttributeValue(S_Sword_s05, 'duration', false, false));
  1964. argsInt.PushBack(RoundMath(arg));
  1965. baseString = GetLocStringByKeyExtWithParams(locKey, argsInt) + "<br>" + GetLocStringByKeyExt("focus_gain") + ": +" + RoundF((arg_focus * 100) * skillLevel) + "%";
  1966. break;
  1967. case S_Sword_s06:
  1968. arg = CalculateAttributeValue(GetWitcherPlayer().GetSkillAttributeValue(S_Sword_s06, 'armor_reduction_perc', false, false)) * skillLevel;
  1969. argsInt.PushBack(RoundMath(arg*100));
  1970. baseString = GetLocStringByKeyExtWithParams(locKey, argsInt) + "<br>" + GetLocStringByKeyExt("focus_gain") + ": +" + RoundF((arg_focus * 100) * skillLevel) + "%";
  1971. break;
  1972. case S_Sword_s07:
  1973. arg = CalculateAttributeValue(GetWitcherPlayer().GetSkillAttributeValue(S_Sword_s07, theGame.params.CRITICAL_HIT_CHANCE, false, false)) * skillLevel;
  1974. argsInt.PushBack(RoundMath(arg*100));
  1975. baseString = GetLocStringByKeyExtWithParams(locKey, argsInt) + "<br>" + GetLocStringByKeyExt("focus_gain") + ": +" + RoundF((arg_focus * 100) * skillLevel) + "%";
  1976. break;
  1977. case S_Sword_s08:
  1978. arg = CalculateAttributeValue(GetWitcherPlayer().GetSkillAttributeValue(S_Sword_s08, theGame.params.CRITICAL_HIT_CHANCE, false, false)) * skillLevel;
  1979. argsInt.PushBack(RoundMath(arg*100));
  1980. arg = CalculateAttributeValue(GetWitcherPlayer().GetSkillAttributeValue(S_Sword_s08, theGame.params.CRITICAL_HIT_DAMAGE_BONUS, false, false)) * skillLevel;
  1981. argsInt.PushBack(RoundMath(arg*100));
  1982. baseString = GetLocStringByKeyExtWithParams(locKey, argsInt) + "<br>" + GetLocStringByKeyExt("focus_gain") + ": +" + RoundF((arg_focus * 100) * skillLevel) + "%";
  1983. break;
  1984. case S_Sword_s09:
  1985. arg = CalculateAttributeValue(GetWitcherPlayer().GetSkillAttributeValue(S_Sword_s09, 'damage_reduction', false, false)) * skillLevel;
  1986. argsInt.PushBack(RoundMath(arg*100));
  1987. baseString = GetLocStringByKeyExtWithParams(locKey, argsInt) + "<br>" + GetLocStringByKeyExt("focus_gain") + ": +" + RoundF((arg_focus * 100) * skillLevel) + "%";
  1988. break;
  1989. case S_Sword_s10:
  1990. if (skillLevel == 2) baseString = GetLocStringByKeyExt(targetSkill.localisationDescriptionLevel2Key) + "<br>" + GetLocStringByKeyExt("focus_gain") + ": +" + RoundF((arg_focus * 100) * skillLevel) + "%";
  1991. else if (skillLevel >= 3) baseString = GetLocStringByKeyExt(targetSkill.localisationDescriptionLevel3Key) + "<br>" + GetLocStringByKeyExt("focus_gain") + ": +" + RoundF((arg_focus * 100) * skillLevel) + "%";
  1992. else baseString = GetLocStringByKeyExt(targetSkill.localisationDescriptionKey) + "<br>" + GetLocStringByKeyExt("focus_gain") + ": +" + RoundF((arg_focus * 100) * skillLevel) + "%";
  1993. break;
  1994. case S_Sword_s11:
  1995. ability = GetWitcherPlayer().GetSkillAttributeValue(S_Sword_s11, 'attack_power', false, false);
  1996. argsInt.PushBack(RoundMath(ability.valueMultiplicative * 100));
  1997. baseString = GetLocStringByKeyExtWithParams(locKey, argsInt) + "<br>" + GetLocStringByKeyExt("focus_gain") + ": +" + RoundF((arg_focus * 100) * skillLevel) + "%";
  1998. break;
  1999. case S_Sword_s12:
  2000. arg = CalculateAttributeValue(GetWitcherPlayer().GetSkillAttributeValue(S_Sword_s12, 'duration', false, false)) * skillLevel;
  2001. argsInt.PushBack(RoundMath(arg));
  2002. baseString = GetLocStringByKeyExtWithParams(locKey, argsInt) + "<br>" + GetLocStringByKeyExt("focus_gain") + ": +" + RoundF((arg_focus * 100) * skillLevel) + "%";
  2003. break;
  2004. case S_Sword_s13:
  2005. arg = CalculateAttributeValue(GetWitcherPlayer().GetSkillAttributeValue(S_Sword_s13, 'slowdown_mod', false, false)) * skillLevel;
  2006. argsInt.PushBack(RoundMath(arg*100));
  2007. baseString = GetLocStringByKeyExtWithParams(locKey, argsInt) + "<br>" + GetLocStringByKeyExt("focus_gain") + ": +" + RoundF((arg_focus * 100) * skillLevel) + "%";
  2008. break;
  2009. case S_Sword_s15:
  2010. arg = CalculateAttributeValue(GetWitcherPlayer().GetSkillAttributeValue(S_Sword_s15, 'focus_gain', false, false)) * skillLevel;
  2011. argsFloat.PushBack(arg);
  2012. baseString = GetLocStringByKeyExtWithParams(locKey, argsInt, argsFloat) + "<br>" + GetLocStringByKeyExt("focus_gain") + ": +" + RoundF((arg_focus * 100) * skillLevel) + "%";
  2013. break;
  2014. case S_Sword_s16:
  2015. arg = CalculateAttributeValue(GetWitcherPlayer().GetSkillAttributeValue(S_Sword_s16, 'focus_drain_reduction', false, false)) * skillLevel;
  2016. argsInt.PushBack(RoundMath(arg*100));
  2017. baseString = GetLocStringByKeyExtWithParams(locKey, argsInt) + "<br>" + GetLocStringByKeyExt("focus_gain") + ": +" + RoundF((arg_focus * 100) * skillLevel) + "%";
  2018. break;
  2019. case S_Sword_s17:
  2020. arg = CalculateAttributeValue(GetWitcherPlayer().GetSkillAttributeValue(S_Sword_s17, theGame.params.CRITICAL_HIT_CHANCE, false, false)) * skillLevel;
  2021. argsInt.PushBack(RoundMath(arg*100));
  2022. arg = CalculateAttributeValue(GetWitcherPlayer().GetSkillAttributeValue(S_Sword_s17, theGame.params.CRITICAL_HIT_DAMAGE_BONUS, false, false)) * skillLevel;
  2023. argsInt.PushBack(RoundMath(arg*100));
  2024. baseString = GetLocStringByKeyExtWithParams(locKey, argsInt) + "<br>" + GetLocStringByKeyExt("focus_gain") + ": +" + RoundF((arg_focus * 100) * skillLevel) + "%";
  2025. break;
  2026. case S_Sword_s18:
  2027. if (skillLevel > 1)
  2028. {
  2029. arg = CalculateAttributeValue(GetWitcherPlayer().GetSkillAttributeValue(S_Sword_s18, 'healing_bonus', false, false)) * (skillLevel-1);
  2030. argsInt.PushBack(RoundMath(arg*100));
  2031. baseString = GetLocStringByKeyExtWithParams(locKey, argsInt) + "<br>" + GetLocStringByKeyExt("focus_gain") + ": +" + RoundF((arg_focus * 100) * skillLevel) + "%";
  2032. }
  2033. else
  2034. baseString = GetLocStringByKeyExt(targetSkill.localisationDescriptionKey) + "<br>" + GetLocStringByKeyExt("focus_gain") + ": +" + RoundF((arg_focus * 100) * skillLevel) + "%";
  2035. break;
  2036. case S_Sword_s19:
  2037. ability = GetWitcherPlayer().GetSkillAttributeValue(S_Sword_s19, 'spell_power', false, false) * skillLevel;
  2038. argsInt.PushBack(RoundMath(ability.valueMultiplicative*100));
  2039. baseString = GetLocStringByKeyExtWithParams(locKey, argsInt) + "<br>" + GetLocStringByKeyExt("focus_gain") + ": +" + RoundF((arg_focus * 100) * skillLevel) + "%";
  2040. break;
  2041. case S_Sword_s20:
  2042. ability = GetWitcherPlayer().GetSkillAttributeValue(S_Sword_s20, 'focus_gain', false, false) * skillLevel;
  2043. argsInt.PushBack(RoundMath(ability.valueAdditive*100));
  2044. baseString = GetLocStringByKeyExtWithParams(locKey, argsInt) + "<br>" + GetLocStringByKeyExt("focus_gain") + ": +" + RoundF((arg_focus * 100) * skillLevel) + "%";
  2045. break;
  2046. case S_Sword_s21:
  2047. ability = GetWitcherPlayer().GetSkillAttributeValue(S_Sword_s21, PowerStatEnumToName(CPS_AttackPower), false, false) * skillLevel;
  2048. argsInt.PushBack(RoundMath(ability.valueMultiplicative*100));
  2049. baseString = GetLocStringByKeyExtWithParams(locKey, argsInt) + "<br>" + GetLocStringByKeyExt("focus_gain") + ": +" + RoundF((arg_focus * 100) * skillLevel) + "%";
  2050. break;
  2051. default:
  2052. if (skillLevel == 2) baseString = GetLocStringByKeyExt(targetSkill.localisationDescriptionLevel2Key);
  2053. else if (skillLevel >= 3) baseString = GetLocStringByKeyExt(targetSkill.localisationDescriptionLevel3Key);
  2054. else baseString = GetLocStringByKeyExt(targetSkill.localisationDescriptionKey);
  2055. }
  2056.  
  2057. return baseString;
  2058. }
  2059.  
  2060. private function GetSignSkillsTooltipDescription(targetSkill : SSkill, skillLevel : int, locKey : string) : string
  2061. {
  2062. var baseString : string;
  2063. var argsInt : array<int>;
  2064. var argsFloat : array<float>;
  2065. var arg, penaltyReduction : float;
  2066. var arg_stamina : float;
  2067. var ability, penalty : SAbilityAttributeValue;
  2068. var min, max : SAbilityAttributeValue;
  2069. var dm : CDefinitionsManagerAccessor;
  2070.  
  2071.  
  2072. dm = theGame.GetDefinitionsManager();
  2073. dm.GetAbilityAttributeValue('magic_staminaregen', 'staminaRegen', min, max);
  2074. ability = GetAttributeRandomizedValue(min, max);
  2075. arg_stamina = ability.valueMultiplicative;
  2076.  
  2077. switch (targetSkill.skillType)
  2078. {
  2079. case S_Magic_s01:
  2080. penaltyReduction = 1 - (skillLevel + 1) * CalculateAttributeValue(GetWitcherPlayer().GetSkillAttributeValue(S_Magic_s01, 'spell_power_penalty_reduction', true, true));
  2081. penalty = GetWitcherPlayer().GetSkillAttributeValue(S_Magic_s01, PowerStatEnumToName(CPS_SpellPower), false, false);
  2082. arg = -penalty.valueMultiplicative * penaltyReduction;
  2083.  
  2084. argsInt.PushBack(RoundMath(arg*100));
  2085. baseString = GetLocStringByKeyExtWithParams(locKey, argsInt) + "<br>" + GetLocStringByKeyExt("attribute_name_staminaregen") + ": +" + NoTrailZeros((arg_stamina * 100) * skillLevel) + "/" + GetLocStringByKeyExt("per_second");
  2086. break;
  2087. case S_Magic_s02:
  2088. ability = GetWitcherPlayer().GetSkillAttributeValue(S_Magic_s02, 'stamina_cost_reduction_after_1', false, false) * (skillLevel-1);
  2089. argsInt.PushBack(RoundMath(ability.valueMultiplicative*100));
  2090. baseString = GetLocStringByKeyExtWithParams(locKey, argsInt) + "<br>" + GetLocStringByKeyExt("attribute_name_staminaregen") + ": +" + NoTrailZeros((arg_stamina * 100) * skillLevel) + "/" + GetLocStringByKeyExt("per_second");
  2091. break;
  2092. case S_Magic_s03:
  2093. argsInt.PushBack(10 + 2*(skillLevel-1));
  2094. argsInt.PushBack(25 * (skillLevel-1));
  2095. baseString = GetLocStringByKeyExtWithParams(locKey, argsInt) + "<br>" + GetLocStringByKeyExt("attribute_name_staminaregen") + ": +" + NoTrailZeros((arg_stamina * 100) * skillLevel) + "/" + GetLocStringByKeyExt("per_second");
  2096. break;
  2097. case S_Magic_s04:
  2098. argsInt.PushBack(10 + 2*(skillLevel-1));
  2099. argsInt.PushBack(25 * (skillLevel-1));
  2100. baseString = GetLocStringByKeyExtWithParams(locKey, argsInt) + "<br>" + GetLocStringByKeyExt("attribute_name_staminaregen") + ": +" + NoTrailZeros((arg_stamina * 100) * skillLevel) + "/" + GetLocStringByKeyExt("per_second");
  2101. break;
  2102. case S_Magic_s05:
  2103. ability = GetWitcherPlayer().GetSkillAttributeValue(S_Magic_s05, PowerStatEnumToName(CPS_AttackPower), false, false) * skillLevel;
  2104. argsInt.PushBack(RoundMath(ability.valueMultiplicative*100));
  2105. ability = GetWitcherPlayer().GetSkillAttributeValue(S_Magic_s05, 'duration', false, false);
  2106. argsInt.PushBack(RoundMath(ability.valueBase));
  2107. baseString = GetLocStringByKeyExtWithParams(locKey, argsInt) + "<br>" + GetLocStringByKeyExt("attribute_name_staminaregen") + ": +" + NoTrailZeros((arg_stamina * 100) * skillLevel) + "/" + GetLocStringByKeyExt("per_second");
  2108. case S_Magic_s06:
  2109. arg = CalculateAttributeValue(GetWitcherPlayer().GetSkillAttributeValue(S_Magic_s06, theGame.params.DAMAGE_NAME_FORCE, false, false)) * skillLevel;
  2110. argsInt.PushBack(RoundMath(arg));
  2111. baseString = GetLocStringByKeyExtWithParams(locKey, argsInt) + "<br>" + GetLocStringByKeyExt("attribute_name_staminaregen") + ": +" + NoTrailZeros((arg_stamina * 100) * skillLevel) + "/" + GetLocStringByKeyExt("per_second");
  2112. break;
  2113. case S_Magic_s07:
  2114. ability = GetWitcherPlayer().GetSkillAttributeValue(S_Magic_s07, PowerStatEnumToName(CPS_SpellPower), false, false);
  2115. ability.valueMultiplicative *= skillLevel;
  2116. argsInt.PushBack(RoundMath(ability.valueMultiplicative*100));
  2117. baseString = GetLocStringByKeyExtWithParams(locKey, argsInt) + "<br>" + GetLocStringByKeyExt("attribute_name_staminaregen") + ": +" + NoTrailZeros((arg_stamina * 100) * skillLevel) + "/" + GetLocStringByKeyExt("per_second");
  2118. break;
  2119. case S_Magic_s08:
  2120. arg = CalculateAttributeValue(GetWitcherPlayer().GetSkillAttributeValue(S_Magic_s08, 'max_armor_reduction', false, false)) * skillLevel;
  2121. argsInt.PushBack(RoundMath(arg*100));
  2122. baseString = GetLocStringByKeyExtWithParams(locKey, argsInt) + "<br>" + GetLocStringByKeyExt("attribute_name_staminaregen") + ": +" + NoTrailZeros((arg_stamina * 100) * skillLevel) + "/" + GetLocStringByKeyExt("per_second");
  2123. break;
  2124. case S_Magic_s09:
  2125. ability = GetWitcherPlayer().GetSkillAttributeValue(S_Magic_s09, 'chance_bonus', false, false) * skillLevel ;
  2126. argsInt.PushBack(RoundMath(ability.valueAdditive*100));
  2127. baseString = GetLocStringByKeyExtWithParams(locKey, argsInt) + "<br>" + GetLocStringByKeyExt("attribute_name_staminaregen") + ": +" + NoTrailZeros((arg_stamina * 100) * skillLevel) + "/" + GetLocStringByKeyExt("per_second");
  2128. break;
  2129. case S_Magic_s10:
  2130. arg = CalculateAttributeValue(GetWitcherPlayer().GetSkillAttributeValue(S_Magic_s10, 'trap_duration', false, false)) * skillLevel;
  2131. argsInt.PushBack(RoundMath(arg));
  2132.  
  2133.  
  2134. arg = CalculateAttributeValue(GetWitcherPlayer().GetSkillAttributeValue(S_Magic_s03, 'charge_count', false, false));
  2135. arg += CalculateAttributeValue(GetWitcherPlayer().GetSkillAttributeValue(S_Magic_s10, 'charge_count', false, false)) * skillLevel;
  2136. argsInt.PushBack(RoundMath(arg));
  2137.  
  2138.  
  2139. if(skillLevel > 1)
  2140. argsInt.PushBack(2);
  2141. else
  2142. argsInt.PushBack(1);
  2143.  
  2144. baseString = GetLocStringByKeyExtWithParams(locKey, argsInt) + "<br>" + GetLocStringByKeyExt("attribute_name_staminaregen") + ": +" + NoTrailZeros((arg_stamina * 100) * skillLevel) + "/" + GetLocStringByKeyExt("per_second");
  2145. break;
  2146. case S_Magic_s11:
  2147. arg = CalculateAttributeValue(GetWitcherPlayer().GetSkillAttributeValue(S_Magic_s11, 'direct_damage_per_sec', false, false)) * skillLevel;
  2148. argsInt.PushBack(RoundMath(arg));
  2149. baseString = GetLocStringByKeyExtWithParams(locKey, argsInt) + "<br>" + GetLocStringByKeyExt("attribute_name_staminaregen") + ": +" + NoTrailZeros((arg_stamina * 100) * skillLevel) + "/" + GetLocStringByKeyExt("per_second");
  2150. break;
  2151. case S_Magic_s12:
  2152. ability = GetWitcherPlayer().GetSkillAttributeValue(S_Magic_s12, PowerStatEnumToName(CPS_SpellPower), false, false);
  2153. ability.valueMultiplicative *= skillLevel;
  2154. argsInt.PushBack(RoundMath(ability.valueMultiplicative*100));
  2155. baseString = GetLocStringByKeyExtWithParams(locKey, argsInt) + "<br>" + GetLocStringByKeyExt("attribute_name_staminaregen") + ": +" + NoTrailZeros((arg_stamina * 100) * skillLevel) + "/" + GetLocStringByKeyExt("per_second");
  2156. break;
  2157. case S_Magic_s13:
  2158. argsInt.PushBack(10 + 2*(skillLevel-1));
  2159. argsInt.PushBack(25 * (skillLevel-1));
  2160. baseString = GetLocStringByKeyExtWithParams(locKey, argsInt) + "<br>" + GetLocStringByKeyExt("attribute_name_staminaregen") + ": +" + NoTrailZeros((arg_stamina * 100) * skillLevel) + "/" + GetLocStringByKeyExt("per_second");
  2161. break;
  2162. case S_Magic_s14:
  2163. arg = CalculateAttributeValue(GetWitcherPlayer().GetSkillAttributeValue(S_Magic_s14, 'discharge_percent', false, false)) * skillLevel;
  2164. argsInt.PushBack(RoundMath(arg*100));
  2165. baseString = GetLocStringByKeyExtWithParams(locKey, argsInt) + "<br>" + GetLocStringByKeyExt("attribute_name_staminaregen") + ": +" + NoTrailZeros((arg_stamina * 100) * skillLevel) + "/" + GetLocStringByKeyExt("per_second");
  2166. break;
  2167. case S_Magic_s15:
  2168. ability = GetWitcherPlayer().GetSkillAttributeValue(S_Magic_s15, PowerStatEnumToName(CPS_SpellPower), false, false);
  2169. ability.valueMultiplicative *= skillLevel;
  2170. argsInt.PushBack(RoundMath(ability.valueMultiplicative*100));
  2171. baseString = GetLocStringByKeyExtWithParams(locKey, argsInt) + "<br>" + GetLocStringByKeyExt("attribute_name_staminaregen") + ": +" + NoTrailZeros((arg_stamina * 100) * skillLevel) + "/" + GetLocStringByKeyExt("per_second");
  2172. break;
  2173. case S_Magic_s16:
  2174. ability = GetWitcherPlayer().GetSkillAttributeValue(S_Magic_s16, PowerStatEnumToName(CPS_SpellPower), false, false);
  2175. ability.valueMultiplicative *= skillLevel;
  2176. argsInt.PushBack(RoundMath(ability.valueMultiplicative*100));
  2177. baseString = GetLocStringByKeyExtWithParams(locKey, argsInt) + "<br>" + GetLocStringByKeyExt("attribute_name_staminaregen") + ": +" + NoTrailZeros((arg_stamina * 100) * skillLevel) + "/" + GetLocStringByKeyExt("per_second");
  2178. break;
  2179. case S_Magic_s17:
  2180. argsInt.PushBack(10 + 2*(skillLevel-1));
  2181. argsInt.PushBack(25 * (skillLevel-1));
  2182. baseString = GetLocStringByKeyExtWithParams(locKey, argsInt) + "<br>" + GetLocStringByKeyExt("attribute_name_staminaregen") + ": +" + NoTrailZeros((arg_stamina * 100) * skillLevel) + "/" + GetLocStringByKeyExt("per_second");
  2183. break;
  2184. case S_Magic_s18:
  2185. ability = GetWitcherPlayer().GetSkillAttributeValue(S_Magic_s18, PowerStatEnumToName(CPS_SpellPower), false, false);
  2186. ability.valueMultiplicative *= skillLevel;
  2187. argsInt.PushBack(RoundMath(ability.valueMultiplicative*100));
  2188. baseString = GetLocStringByKeyExtWithParams(locKey, argsInt) + "<br>" + GetLocStringByKeyExt("attribute_name_staminaregen") + ": +" + NoTrailZeros((arg_stamina * 100) * skillLevel) + "/" + GetLocStringByKeyExt("per_second");
  2189. break;
  2190. case S_Magic_s19:
  2191. argsInt.PushBack(10 + 2*(skillLevel-1));
  2192. argsInt.PushBack(25 * (skillLevel-1));
  2193. baseString = GetLocStringByKeyExtWithParams(locKey, argsInt) + "<br>" + GetLocStringByKeyExt("attribute_name_staminaregen") + ": +" + NoTrailZeros((arg_stamina * 100) * skillLevel) + "/" + GetLocStringByKeyExt("per_second");
  2194. break;
  2195. case S_Magic_s20:
  2196. arg = CalculateAttributeValue(GetWitcherPlayer().GetSkillAttributeValue(S_Magic_s20, 'range', false, false)) * skillLevel;
  2197. argsInt.PushBack(RoundMath(arg));
  2198. baseString = GetLocStringByKeyExtWithParams(locKey, argsInt) + "<br>" + GetLocStringByKeyExt("attribute_name_staminaregen") + ": +" + NoTrailZeros((arg_stamina * 100) * skillLevel) + "/" + GetLocStringByKeyExt("per_second");
  2199. break;
  2200. }
  2201.  
  2202. return baseString;
  2203. }
  2204.  
  2205. private function GetAlchemySkillsTooltipDescription(targetSkill : SSkill, skillLevel : int, locKey : string) : string
  2206. {
  2207. var baseString : string;
  2208. var argsInt : array<int>;
  2209. var argsFloat : array<float>;
  2210. var argsString : array<string>;
  2211. var arg : float;
  2212. var arg_duration : float;
  2213. var toxThreshold : float;
  2214. var ability : SAbilityAttributeValue;
  2215. var min, max : SAbilityAttributeValue;
  2216. var dm : CDefinitionsManagerAccessor;
  2217.  
  2218.  
  2219. dm = theGame.GetDefinitionsManager();
  2220. dm.GetAbilityAttributeValue('alchemy_potionduration', 'potion_duration', min, max);
  2221. ability = GetAttributeRandomizedValue(min, max);
  2222. arg_duration = CalculateAttributeValue(ability);
  2223.  
  2224. switch (targetSkill.skillType)
  2225. {
  2226. case S_Alchemy_s01:
  2227.  
  2228. toxThreshold = 100 * theGame.params.TOXICITY_DAMAGE_THRESHOLD;
  2229. argsString.PushBack( RoundMath( toxThreshold ) );
  2230.  
  2231.  
  2232. arg = CalculateAttributeValue(GetWitcherPlayer().GetSkillAttributeValue(S_Alchemy_s01, 'threshold', false, false)) * skillLevel;
  2233. argsString.PushBack( RoundMath( toxThreshold + arg * 100 ) );
  2234.  
  2235. baseString = GetLocStringByKeyExtWithParams(locKey, , , argsString);
  2236. break;
  2237. case S_Alchemy_s02:
  2238. arg = CalculateAttributeValue(GetWitcherPlayer().GetSkillAttributeValue(S_Alchemy_s02, 'vitality_gain_perc', false, false)) * skillLevel;
  2239. argsInt.PushBack(RoundMath(arg*100));
  2240. baseString = GetLocStringByKeyExtWithParams(locKey, argsInt);
  2241. break;
  2242. case S_Alchemy_s03:
  2243. arg = 1 - CalculateAttributeValue(GetWitcherPlayer().GetSkillAttributeValue(S_Alchemy_s03, 'toxicity_threshold', false, false)) * skillLevel;
  2244. argsInt.PushBack(Max(0, RoundMath(arg*100)));
  2245. baseString = GetLocStringByKeyExtWithParams(locKey, argsInt);
  2246. break;
  2247. case S_Alchemy_s04:
  2248. arg = CalculateAttributeValue(GetWitcherPlayer().GetSkillAttributeValue(S_Alchemy_s04, 'apply_chance', false, false)) * skillLevel;
  2249. argsInt.PushBack(Min(100, RoundMath(arg*100)));
  2250. baseString = GetLocStringByKeyExtWithParams(locKey, argsInt);
  2251. break;
  2252. case S_Alchemy_s05:
  2253. arg = 5 * skillLevel;
  2254. argsInt.PushBack(RoundMath(arg));
  2255. baseString = GetLocStringByKeyExtWithParams(locKey, argsInt);
  2256. break;
  2257. case S_Alchemy_s06:
  2258. arg = CalculateAttributeValue(GetWitcherPlayer().GetSkillAttributeValue(S_Alchemy_s06, 'ammo_bonus', false, false)) * skillLevel;
  2259. argsInt.PushBack(Min(100, RoundMath(arg*100)));
  2260. baseString = GetLocStringByKeyExtWithParams(locKey, argsInt);
  2261. break;
  2262. case S_Alchemy_s07:
  2263. arg = CalculateAttributeValue(GetWitcherPlayer().GetSkillAttributeValue(S_Alchemy_s07, theGame.params.CRITICAL_HIT_DAMAGE_BONUS, false, false)) * skillLevel;
  2264. argsInt.PushBack(RoundMath(arg*100));
  2265. baseString = GetLocStringByKeyExtWithParams(locKey, argsInt);
  2266. break;
  2267. case S_Alchemy_s08:
  2268. arg = CalculateAttributeValue(GetWitcherPlayer().GetSkillAttributeValue(S_Alchemy_s08, 'item_count', false, false)) * skillLevel;
  2269. argsInt.PushBack(RoundMath(arg));
  2270. baseString = GetLocStringByKeyExtWithParams(locKey, argsInt);
  2271. break;
  2272. case S_Alchemy_s09:
  2273. arg = CalculateAttributeValue(GetWitcherPlayer().GetSkillAttributeValue(S_Alchemy_s09, 'slowdown_mod', false, false)) * skillLevel;
  2274. argsInt.PushBack(RoundMath(arg*100));
  2275. baseString = GetLocStringByKeyExtWithParams(locKey, argsInt);
  2276. break;
  2277. case S_Alchemy_s10:
  2278. arg = CalculateAttributeValue(GetWitcherPlayer().GetSkillAttributeValue(S_Alchemy_s10, 'PhysicalDamage', false, false)) * skillLevel;
  2279. argsInt.PushBack(RoundMath(arg));
  2280. baseString = GetLocStringByKeyExtWithParams(locKey, argsInt);
  2281. break;
  2282. case S_Alchemy_s11:
  2283. arg = 1 + skillLevel;
  2284. argsInt.PushBack(RoundMath(arg));
  2285. baseString = GetLocStringByKeyExtWithParams(locKey, argsInt);
  2286. break;
  2287. case S_Alchemy_s12:
  2288. arg = CalculateAttributeValue(GetWitcherPlayer().GetSkillAttributeValue(S_Alchemy_s12, 'skill_chance', false, false)) * skillLevel;
  2289. argsInt.PushBack(RoundMath(arg * 100));
  2290. baseString = GetLocStringByKeyExtWithParams(locKey, argsInt);
  2291. break;
  2292. case S_Alchemy_s13:
  2293. arg = CalculateAttributeValue(GetWitcherPlayer().GetSkillAttributeValue(S_Alchemy_s13, 'vitality', false, false)) * skillLevel;
  2294. argsInt.PushBack(RoundMath(arg));
  2295. baseString = GetLocStringByKeyExtWithParams(locKey, argsInt);
  2296. break;
  2297. case S_Alchemy_s14:
  2298. ability = GetWitcherPlayer().GetSkillAttributeValue(S_Alchemy_s14, 'duration', false, false) * skillLevel;
  2299. argsInt.PushBack(RoundMath(ability.valueMultiplicative*100));
  2300. baseString = GetLocStringByKeyExtWithParams(locKey, argsInt);
  2301. break;
  2302. case S_Alchemy_s15:
  2303. arg = CalculateAttributeValue(GetWitcherPlayer().GetSkillAttributeValue(S_Alchemy_s15, 'toxicityRegen', false, false)) * skillLevel;
  2304. if(arg < 0) arg = -arg;
  2305. argsInt.PushBack(RoundMath(arg));
  2306. baseString = GetLocStringByKeyExtWithParams(locKey, argsInt);
  2307. break;
  2308. case S_Alchemy_s17:
  2309. arg = CalculateAttributeValue(GetWitcherPlayer().GetSkillAttributeValue(S_Alchemy_s17, 'critical_hit_chance', false, false)) * skillLevel;
  2310. argsInt.PushBack(RoundMath(arg*100));
  2311. baseString = GetLocStringByKeyExtWithParams(locKey, argsInt);
  2312. break;
  2313. case S_Alchemy_s19:
  2314. arg = CalculateAttributeValue(GetWitcherPlayer().GetSkillAttributeValue(S_Alchemy_s19, 'synergy_bonus', false, false)) * skillLevel;
  2315. argsInt.PushBack(RoundMath(arg*100));
  2316. baseString = GetLocStringByKeyExtWithParams(locKey, argsInt);
  2317. break;
  2318. case S_Alchemy_s20:
  2319. theGame.GetDefinitionsManager().GetAbilityAttributeValue(EffectTypeToName(EET_IgnorePain), StatEnumToName(BCS_Vitality), min, max);
  2320. ability = GetAttributeRandomizedValue(min, max);
  2321. arg = ability.valueMultiplicative * skillLevel;
  2322. argsInt.PushBack(RoundMath(arg*100));
  2323. baseString = GetLocStringByKeyExtWithParams(locKey, argsInt);
  2324. break;
  2325. default:
  2326. if (skillLevel == 2) baseString = GetLocStringByKeyExt(targetSkill.localisationDescriptionLevel2Key);
  2327. else if (skillLevel >= 3) baseString = GetLocStringByKeyExt(targetSkill.localisationDescriptionLevel3Key);
  2328. else baseString = GetLocStringByKeyExt(targetSkill.localisationDescriptionKey);
  2329. }
  2330.  
  2331. baseString += "<br>" + GetLocStringByKeyExt("attribute_potion_duration_time") + ": +" + RoundF((arg_duration * 100) * skillLevel) + "%";
  2332.  
  2333. return baseString;
  2334. }
  2335.  
  2336. private function GetPerkTooltipDescription(targetSkill : SSkill, skillLevel : int, locKey : string) : string
  2337. {
  2338. var baseString : string;
  2339. var argsInt : array<int>;
  2340. var argsFloat : array<float>;
  2341. var argsString : array<string>;
  2342. var arg : float;
  2343. var ability : SAbilityAttributeValue;
  2344.  
  2345. switch (targetSkill.skillType)
  2346. {
  2347. case S_Perk_01:
  2348. ability = GetWitcherPlayer().GetSkillAttributeValue(S_Perk_01, 'vitalityRegen_tooltip', false, true);
  2349. argsInt.PushBack(RoundMath(CalculateAttributeValue(ability)));
  2350. ability = GetWitcherPlayer().GetSkillAttributeValue(S_Perk_01, 'staminaRegen_tooltip', false, true);
  2351. argsInt.PushBack(RoundMath(ability.valueMultiplicative * GetWitcherPlayer().GetStatMax(BCS_Stamina)));
  2352. baseString = GetLocStringByKeyExtWithParams(locKey, argsInt);
  2353. break;
  2354. case S_Perk_02:
  2355. ability = GetWitcherPlayer().GetSkillAttributeValue(S_Perk_02, PowerStatEnumToName(CPS_AttackPower), false, true);
  2356. argsInt.PushBack(RoundMath(ability.valueMultiplicative*100));
  2357. baseString = GetLocStringByKeyExtWithParams(locKey, argsInt);
  2358. break;
  2359. case S_Perk_04:
  2360. ability = GetWitcherPlayer().GetSkillAttributeValue(S_Perk_04, 'vitality', false, true);
  2361. argsInt.PushBack(RoundMath(ability.valueBase));
  2362. baseString = GetLocStringByKeyExtWithParams(locKey, argsInt);
  2363. break;
  2364. case S_Perk_05:
  2365. arg = CalculateAttributeValue(GetWitcherPlayer().GetSkillAttributeValue(S_Perk_05, 'critical_hit_chance_fast_style', false, true));
  2366. argsInt.PushBack(RoundMath(arg*100));
  2367. ability = GetWitcherPlayer().GetSkillAttributeValue(S_Perk_05, 'attack_power_fast_style', false, true);
  2368. argsInt.PushBack(RoundMath(ability.valueMultiplicative*100));
  2369. baseString = GetLocStringByKeyExtWithParams(locKey, argsInt);
  2370. break;
  2371. case S_Perk_06:
  2372. ability = GetWitcherPlayer().GetSkillAttributeValue(S_Perk_06, 'spell_power', false, true);
  2373. argsInt.PushBack(RoundMath(ability.valueMultiplicative*100));
  2374. ability = GetWitcherPlayer().GetSkillAttributeValue(S_Perk_06, 'staminaRegen', false, true);
  2375. argsInt.PushBack(RoundMath(ability.valueMultiplicative*100));
  2376. baseString = GetLocStringByKeyExtWithParams(locKey, argsInt);
  2377. break;
  2378. case S_Perk_07:
  2379. ability = GetWitcherPlayer().GetSkillAttributeValue(S_Perk_07, 'vitality', false, true);
  2380. argsInt.PushBack(RoundMath(ability.valueMultiplicative*100));
  2381. ability = GetWitcherPlayer().GetSkillAttributeValue(S_Perk_07, 'attack_power_heavy_style', false, true);
  2382. argsInt.PushBack(RoundMath(ability.valueMultiplicative*100));
  2383. baseString = GetLocStringByKeyExtWithParams(locKey, argsInt);
  2384. break;
  2385. case S_Perk_10:
  2386. ability = GetWitcherPlayer().GetSkillAttributeValue(S_Perk_10, 'focus_gain', false, true);
  2387. argsInt.PushBack(RoundMath(ability.valueBase*100));
  2388. baseString = GetLocStringByKeyExtWithParams(locKey, argsInt);
  2389. break;
  2390. case S_Perk_12:
  2391. ability = GetWitcherPlayer().GetSkillAttributeValue(S_Perk_12, 'toxicity', false, true);
  2392. argsInt.PushBack(RoundMath(ability.valueBase));
  2393. baseString = GetLocStringByKeyExtWithParams(locKey, argsInt);
  2394. break;
  2395. case S_Perk_13:
  2396. ability = GetWitcherPlayer().GetSkillAttributeValue(S_Perk_13, 'cost_reduction', false, true);
  2397. argsInt.PushBack(RoundMath(100 * ability.valueMultiplicative));
  2398. baseString = GetLocStringByKeyExtWithParams(locKey, argsInt);
  2399. break;
  2400. case S_Perk_15:
  2401. ability = GetWitcherPlayer().GetSkillAttributeValue( S_Perk_15, 'duration', false, false );
  2402. ability.valueAdditive /= 60;
  2403. argsString.PushBack( FloatToString( ability.valueAdditive ) );
  2404. baseString = GetLocStringByKeyExtWithParams( locKey, , , argsString );
  2405. break;
  2406. case S_Perk_18:
  2407. ability = GetWitcherPlayer().GetSkillAttributeValue(S_Perk_18, 'focus_gain', false, true);
  2408. argsFloat.PushBack(ability.valueAdditive);
  2409. baseString = GetLocStringByKeyExtWithParams(locKey, , argsFloat);
  2410. break;
  2411. case S_Perk_19:
  2412. ability = GetWitcherPlayer().GetSkillAttributeValue(S_Perk_19, 'critical_hit_chance', false, true);
  2413. argsInt.PushBack(RoundMath(100 * ability.valueAdditive));
  2414. baseString = GetLocStringByKeyExtWithParams(locKey, argsInt);
  2415. break;
  2416. case S_Perk_20:
  2417. ability = GetWitcherPlayer().GetSkillAttributeValue( S_Perk_20, 'dmg_multiplier', false, false );
  2418. ability.valueMultiplicative *= 100;
  2419. argsString.PushBack( FloatToString( ability.valueMultiplicative ) );
  2420. ability = GetWitcherPlayer().GetSkillAttributeValue( S_Perk_20, 'stack_multiplier', false, false );
  2421. ability.valueMultiplicative *= 100;
  2422. argsString.PushBack( FloatToString( ability.valueMultiplicative ) );
  2423. baseString = GetLocStringByKeyExtWithParams( locKey, , , argsString );
  2424. break;
  2425. case S_Perk_21:
  2426. ability = GetWitcherPlayer().GetSkillAttributeValue( S_Perk_21, 'parry', false, false );
  2427. argsString.PushBack( FloatToString( ability.valueAdditive ) );
  2428. ability = GetWitcherPlayer().GetSkillAttributeValue( S_Perk_21, 'counter', false, false );
  2429. argsString.PushBack( FloatToString( ability.valueAdditive ) );
  2430. ability = GetWitcherPlayer().GetSkillAttributeValue( S_Perk_21, 'dodge', false, false );
  2431. argsString.PushBack( FloatToString( ability.valueAdditive ) );
  2432. ability = GetWitcherPlayer().GetSkillAttributeValue( S_Perk_21, 'roll', false, false );
  2433. argsString.PushBack( FloatToString( ability.valueAdditive ) );
  2434. ability = GetWitcherPlayer().GetSkillAttributeValue( S_Perk_21, 'perk21Time', false, false );
  2435. argsString.PushBack( FloatToString( ability.valueAdditive ) );
  2436. baseString = GetLocStringByKeyExtWithParams( locKey, , , argsString );
  2437. break;
  2438. case S_Perk_22:
  2439. ability = GetWitcherPlayer().GetSkillAttributeValue(S_Perk_22, 'encumbrance', false, true);
  2440. argsInt.PushBack(RoundMath(ability.valueBase));
  2441. baseString = GetLocStringByKeyExtWithParams(locKey, argsInt);
  2442. break;
  2443. default:
  2444. if (skillLevel == 2) baseString = GetLocStringByKeyExt(targetSkill.localisationDescriptionLevel2Key);
  2445. else if (skillLevel >= 3) baseString = GetLocStringByKeyExt(targetSkill.localisationDescriptionLevel3Key);
  2446. else baseString = GetLocStringByKeyExt(targetSkill.localisationDescriptionKey);
  2447. }
  2448.  
  2449. return baseString;
  2450. }
  2451.  
  2452. private function GetSkillTooltipDescription(targetSkill : SSkill, isGridView : bool, out currentLevelDesc : string, out nextLevelDesc : string ) : void
  2453. {
  2454. var skillLevel : int;
  2455.  
  2456. currentLevelDesc = "";
  2457. nextLevelDesc = "";
  2458.  
  2459.  
  2460.  
  2461. if ( isGridView )
  2462. skillLevel = GetWitcherPlayer().GetBoughtSkillLevel(targetSkill.skillType);
  2463. else
  2464. skillLevel = GetWitcherPlayer().GetSkillLevel(targetSkill.skillType);
  2465.  
  2466. if (GetWitcherPlayer().GetSkillLevel(targetSkill.skillType) > 0)
  2467. {
  2468. if (!targetSkill.isCoreSkill)
  2469. {
  2470. currentLevelDesc += "<font color=\"#ecdda8\">" + GetLocStringByKeyExt("panel_character_tooltip_skill_desc_current_level") + ":</font>&#10;";
  2471. }
  2472. currentLevelDesc += GetSkillTooltipDescriptionForSkillLevel(targetSkill, skillLevel);
  2473. }
  2474.  
  2475. if (skillLevel < targetSkill.maxLevel)
  2476. {
  2477. nextLevelDesc += "<font color=\"#A09588\">" + GetLocStringByKeyExt("panel_character_tooltip_skill_desc_next_level") + ":</font>&#10;";
  2478. nextLevelDesc += GetSkillTooltipDescriptionForSkillLevel(targetSkill, skillLevel + 1);
  2479. }
  2480. }
  2481.  
  2482. event OnNotEnoughtPoints()
  2483. {
  2484. theSound.SoundEvent( "gui_global_denied" );
  2485. showNotification(GetLocStringByKeyExt("message_common_not_enough_skill_points"));
  2486. }
  2487.  
  2488. event OnGetGridSkillTooltipData(targetSkill : ESkill, compareItemType : int)
  2489. {
  2490. GetSkillTooltipData(targetSkill, compareItemType, true);
  2491. }
  2492.  
  2493. event OnGetSlotSkillTooltipData(targetSkill : ESkill, compareItemType : int)
  2494. {
  2495. GetSkillTooltipData(targetSkill, compareItemType, false);
  2496. }
  2497.  
  2498. private function GetSkillTooltipData(targetSkill : ESkill, compareItemType : int, isGridView : bool)
  2499. {
  2500. var abilityMgr : W3PlayerAbilityManager;
  2501. var resultGFxData : CScriptedFlashObject;
  2502. var targetSkillData : SSkill;
  2503. var targetSubPathLocName : string;
  2504. var skillCurrentLevelDesc : string;
  2505. var skillNextLevelDesc : string;
  2506. var skillLevelString : string;
  2507. var skillNumPoitnsNeeded : int;
  2508. var pathPointsSpent : int;
  2509.  
  2510. var originSkillLevel : int;
  2511. var boostedSkillLevel : int;
  2512.  
  2513. resultGFxData = m_flashValueStorage.CreateTempFlashObject();
  2514. targetSkillData = thePlayer.GetPlayerSkill(targetSkill);
  2515.  
  2516. if (targetSkillData.isCoreSkill)
  2517. {
  2518. targetSubPathLocName = "";
  2519. }
  2520. else
  2521. {
  2522. targetSubPathLocName = GetLocStringByKeyExt(SkillSubPathToLocalisationKey(targetSkillData.skillSubPath));
  2523. }
  2524. targetSubPathLocName += SSS_GetSkillTooltipStringSuffix(targetSkill);//zur13 modSSS
  2525. resultGFxData.SetMemberFlashString('skillSubCategory', targetSubPathLocName);
  2526. resultGFxData.SetMemberFlashString('skillName', GetLocStringByKeyExt(targetSkillData.localisationNameKey));
  2527.  
  2528. GetSkillTooltipDescription(targetSkillData, isGridView, skillCurrentLevelDesc, skillNextLevelDesc);
  2529.  
  2530.  
  2531. resultGFxData.SetMemberFlashString('nextLevelDescription', skillNextLevelDesc);
  2532. resultGFxData.SetMemberFlashString('isCoreSkill', targetSkillData.isCoreSkill);
  2533.  
  2534. if (targetSkillData.isCoreSkill)
  2535. {
  2536. skillLevelString = "<font color=\"#ecdda8\">" +GetLocStringByKeyExt("tooltip_skill_core_category") + "</font>&#10;";
  2537. skillCurrentLevelDesc = "<font color=\"#ecdda8\">" +GetLocStringByKeyExt("tooltip_skill_core_desc") + "</font>&#10;" + skillCurrentLevelDesc;
  2538. }
  2539. else
  2540. {
  2541.  
  2542.  
  2543. originSkillLevel = GetWitcherPlayer().GetBoughtSkillLevel(targetSkillData.skillType);
  2544.  
  2545. if ( isGridView )
  2546. {
  2547. skillLevelString = " " + originSkillLevel + "/" + targetSkillData.maxLevel;
  2548. }
  2549. else
  2550. {
  2551. boostedSkillLevel = GetWitcherPlayer().GetSkillLevel(targetSkillData.skillType);
  2552.  
  2553. if (boostedSkillLevel > originSkillLevel)
  2554. {
  2555.  
  2556. skillLevelString = " <font color = '#f68104'>" + boostedSkillLevel + "</font>/" + targetSkillData.maxLevel;
  2557. }
  2558. else
  2559. {
  2560. skillLevelString = " " + boostedSkillLevel + "/" + targetSkillData.maxLevel;
  2561. }
  2562. }
  2563. }
  2564. skillLevelString = skillLevelString + SSS_GetSkillTooltipSynergySufix(targetSkill);//zur13 modSSS
  2565. resultGFxData.SetMemberFlashString('currentLevelDescription', skillCurrentLevelDesc);
  2566. resultGFxData.SetMemberFlashString('skillLevelString', skillLevelString);
  2567.  
  2568. if ( isGridView )
  2569. {
  2570. resultGFxData.SetMemberFlashInt('level', GetWitcherPlayer().GetBoughtSkillLevel(targetSkillData.skillType));
  2571. }
  2572. else
  2573. {
  2574. resultGFxData.SetMemberFlashInt('level', GetWitcherPlayer().GetSkillLevel(targetSkillData.skillType));
  2575. }
  2576. resultGFxData.SetMemberFlashInt('maxLevel', targetSkillData.maxLevel);
  2577.  
  2578. if (targetSkillData.isCoreSkill || CheckIfLocked(targetSkillData))
  2579. {
  2580. skillNumPoitnsNeeded = -1;
  2581. }
  2582. else
  2583. {
  2584. abilityMgr = (W3PlayerAbilityManager)thePlayer.abilityManager;
  2585.  
  2586. if( abilityMgr )
  2587. {
  2588. pathPointsSpent = targetSkillData.requiredPointsSpent - abilityMgr.GetPathPointsSpent( targetSkillData.skillPath );
  2589. }
  2590. else
  2591. {
  2592. pathPointsSpent = targetSkillData.requiredPointsSpent;
  2593. }
  2594.  
  2595. skillNumPoitnsNeeded = pathPointsSpent;
  2596. }
  2597.  
  2598. resultGFxData.SetMemberFlashNumber('requiredPointsSpent', skillNumPoitnsNeeded);
  2599. resultGFxData.SetMemberFlashString('IconPath', targetSkillData.iconPath);
  2600. resultGFxData.SetMemberFlashBool('hasEnoughPoints', CheckIfLocked(targetSkillData));
  2601. resultGFxData.SetMemberFlashInt( 'curSkillPoints', GetCurrentSkillPoints() );
  2602.  
  2603. m_flashValueStorage.SetFlashObject("context.tooltip.data", resultGFxData);
  2604. }
  2605.  
  2606. event OnGetEmptySlotTooltipData(unlockedAtLevel : int):void
  2607. {
  2608. var resultGFxData : CScriptedFlashObject;
  2609.  
  2610. resultGFxData = m_flashValueStorage.CreateTempFlashObject();
  2611. resultGFxData.SetMemberFlashString('skillName', GetLocStringByKeyExt("panel_character_tooltip_skill_empty_title"));
  2612. resultGFxData.SetMemberFlashString('currentLevelDescription', GetLocStringByKeyExt("panel_character_tooltip_skill_empty_desc"));
  2613. resultGFxData.SetMemberFlashString('nextLevelDescription', "");
  2614. resultGFxData.SetMemberFlashString('skillLevelString', "");
  2615. resultGFxData.SetMemberFlashString('isCoreSkill', false);
  2616. resultGFxData.SetMemberFlashInt('level', -1);
  2617. resultGFxData.SetMemberFlashInt('maxLevel', -1);
  2618. resultGFxData.SetMemberFlashNumber('requiredPointsSpent', -1);
  2619. resultGFxData.SetMemberFlashString('IconPath', "icons\\Skills\\skill_slot_empty.png");
  2620. resultGFxData.SetMemberFlashBool('hasEnoughPoints', true);
  2621. resultGFxData.SetMemberFlashInt('curSkillPoints', -1);
  2622.  
  2623. m_flashValueStorage.SetFlashObject("context.tooltip.data", resultGFxData);
  2624. }
  2625.  
  2626. event OnGetLockedTooltipData(unlockedAtLevel : int):void
  2627. {
  2628. var resultGFxData : CScriptedFlashObject;
  2629.  
  2630. resultGFxData = m_flashValueStorage.CreateTempFlashObject();
  2631. resultGFxData.SetMemberFlashString('skillName', GetLocStringByKeyExt("panel_character_tooltip_skill_locked_title"));
  2632. resultGFxData.SetMemberFlashString('currentLevelDescription', GetLocStringByKeyExt("panel_character_tooltip_skill_locked_desc") + ": " + unlockedAtLevel);
  2633. resultGFxData.SetMemberFlashString('nextLevelDescription', "");
  2634. resultGFxData.SetMemberFlashString('skillLevelString', "");
  2635. resultGFxData.SetMemberFlashInt('level', -1);
  2636. resultGFxData.SetMemberFlashInt('maxLevel', -1);
  2637. resultGFxData.SetMemberFlashNumber('requiredPointsSpent', -1);
  2638. resultGFxData.SetMemberFlashString('IconPath', "icons\\Skills\\skill_slot_locked.png");
  2639. resultGFxData.SetMemberFlashBool('hasEnoughPoints', true);
  2640. resultGFxData.SetMemberFlashInt('curSkillPoints', -1);
  2641.  
  2642. m_flashValueStorage.SetFlashObject("context.tooltip.data", resultGFxData);
  2643. }
  2644.  
  2645. event OnGetLockedMutationSkillSlotTooltipData(unlockedAtLevel : int):void
  2646. {
  2647. var resultGFxData : CScriptedFlashObject;
  2648. var abilityManager : W3PlayerAbilityManager;
  2649. var lockDescription : string;
  2650. var requaredMutCount : int;
  2651. var intParamArray : array<int>;
  2652.  
  2653. abilityManager = ( ( W3PlayerAbilityManager ) GetWitcherPlayer().abilityManager );
  2654. requaredMutCount = abilityManager.GetMutationsRequiredForMasterStage(unlockedAtLevel);
  2655. intParamArray.PushBack(requaredMutCount);
  2656. lockDescription = GetLocStringByKeyExtWithParams("mutation_master_mutation_requires_unlock", intParamArray);
  2657.  
  2658. resultGFxData = m_flashValueStorage.CreateTempFlashObject();
  2659. resultGFxData.SetMemberFlashString('skillName', GetLocStringByKeyExt("panel_character_tooltip_skill_locked_title"));
  2660. resultGFxData.SetMemberFlashString('currentLevelDescription', lockDescription);
  2661. resultGFxData.SetMemberFlashString('nextLevelDescription', "");
  2662. resultGFxData.SetMemberFlashString('skillLevelString', "");
  2663. resultGFxData.SetMemberFlashInt('level', -1);
  2664. resultGFxData.SetMemberFlashInt('maxLevel', -1);
  2665. resultGFxData.SetMemberFlashNumber('requiredPointsSpent', -1);
  2666. resultGFxData.SetMemberFlashString('IconPath', "icons\\Skills\\skill_slot_locked.png");
  2667. resultGFxData.SetMemberFlashBool('hasEnoughPoints', true);
  2668. resultGFxData.SetMemberFlashInt('curSkillPoints', -1);
  2669.  
  2670. m_flashValueStorage.SetFlashObject("context.tooltip.data", resultGFxData);
  2671. }
  2672.  
  2673. event OnGetMutagenEmptyTooltipData(unlockedAtLevel : int)
  2674. {
  2675. var resultGFxData : CScriptedFlashObject;
  2676.  
  2677. resultGFxData = m_flashValueStorage.CreateTempFlashObject();
  2678.  
  2679. resultGFxData.SetMemberFlashString('skillName', GetLocStringByKeyExt("panel_character_tooltip_mutagen_empty_title"));
  2680. resultGFxData.SetMemberFlashString('currentLevelDescription', GetLocStringByKeyExt("panel_character_tooltip_mutagen_empty_desc"));
  2681. resultGFxData.SetMemberFlashString('nextLevelDescription', "");
  2682. resultGFxData.SetMemberFlashString('skillLevelString', "");
  2683. resultGFxData.SetMemberFlashInt('level', -1);
  2684. resultGFxData.SetMemberFlashInt('maxLevel', -1);
  2685. resultGFxData.SetMemberFlashNumber('requiredPointsSpent', -1);
  2686. resultGFxData.SetMemberFlashString('IconPath', "icons\\Skills\\mutagen_slot_empty.png");
  2687. resultGFxData.SetMemberFlashBool('hasEnoughPoints', true);
  2688. resultGFxData.SetMemberFlashInt('curSkillPoints', -1);
  2689.  
  2690. m_flashValueStorage.SetFlashObject("context.tooltip.data", resultGFxData);
  2691. }
  2692.  
  2693. event OnGetMutagenLockedTooltipData(unlockedAtLevel : int)
  2694. {
  2695. var resultGFxData : CScriptedFlashObject;
  2696.  
  2697. resultGFxData = m_flashValueStorage.CreateTempFlashObject();
  2698.  
  2699. resultGFxData.SetMemberFlashString('skillName', GetLocStringByKeyExt("panel_character_tooltip_mutagen_locked_title"));
  2700. resultGFxData.SetMemberFlashString('currentLevelDescription', GetLocStringByKeyExt("panel_character_tooltip_mutagen_locked_desc") + ": " + unlockedAtLevel);
  2701. resultGFxData.SetMemberFlashString('nextLevelDescription', "");
  2702. resultGFxData.SetMemberFlashString('skillLevelString', "");
  2703. resultGFxData.SetMemberFlashInt('level', -1);
  2704. resultGFxData.SetMemberFlashInt('maxLevel', -1);
  2705. resultGFxData.SetMemberFlashNumber('requiredPointsSpent', -1);
  2706. resultGFxData.SetMemberFlashString('IconPath', "icons\\Skills\\mutagen_slot_locked.png");
  2707. resultGFxData.SetMemberFlashBool('hasEnoughPoints', true);
  2708. resultGFxData.SetMemberFlashInt('curSkillPoints', -1);
  2709.  
  2710. m_flashValueStorage.SetFlashObject("context.tooltip.data", resultGFxData);
  2711. }
  2712.  
  2713. event OnGetItemData(item : SItemUniqueId, compareItemType : int)
  2714. {
  2715. var tooltipInv : CInventoryComponent;
  2716. var compareItem : SItemUniqueId;
  2717. var itemUIData : SInventoryItemUIData;
  2718. var itemWeight : SAbilityAttributeValue;
  2719. var compareItemStats : array<SAttributeTooltip>;
  2720. var itemStats : array<SAttributeTooltip>;
  2721. var itemName : string;
  2722. var category : string;
  2723. var typeStr : string;
  2724. var weight : float;
  2725.  
  2726. var primaryStatLabel : string;
  2727. var primaryStatValue : float;
  2728. var categoryDescription : string;
  2729. var durabilityValue : string;
  2730. var oilName : name;
  2731. var idx : int;
  2732. var socketsCount : int;
  2733. var usedSocketsCount : int;
  2734. var emptySocketsCount : int;
  2735. var socketItems : array<name>;
  2736.  
  2737. var resultData : CScriptedFlashObject;
  2738. var statsList : CScriptedFlashArray;
  2739. var propsList : CScriptedFlashArray;
  2740.  
  2741. var tmpStr : string;
  2742.  
  2743. GetWitcherPlayer().GetItemEquippedOnSlot(compareItemType, compareItem);
  2744. tooltipInv = _inv;
  2745. itemName = tooltipInv.GetItemName(item);
  2746. resultData = m_flashValueStorage.CreateTempFlashObject();
  2747. statsList = m_flashValueStorage.CreateTempFlashArray();
  2748. propsList = m_flashValueStorage.CreateTempFlashArray();
  2749.  
  2750. if( tooltipInv.IsIdValid(item) )
  2751. {
  2752. _inv.GetItemPrimaryStat(item, primaryStatLabel, primaryStatValue);
  2753. itemName = tooltipInv.GetItemLocalizedNameByUniqueID(item);
  2754. itemName = GetLocStringByKeyExt(itemName);
  2755. resultData.SetMemberFlashString("ItemName", itemName + SSS_GetItemTooltipSynergySufix(item, this)); //zur13 modSSS
  2756.  
  2757.  
  2758. if( tooltipInv.GetItemName(item) != _inv.GetItemName(compareItem) )
  2759. {
  2760. _inv.GetItemStats(compareItem, compareItemStats);
  2761. }
  2762. tooltipInv.GetItemStats(item, itemStats);
  2763. CompareItemsStats(itemStats, compareItemStats, statsList);
  2764. resultData.SetMemberFlashArray("StatsList", statsList);
  2765.  
  2766. if( tooltipInv.ItemHasTag(item, 'Quest') || tooltipInv.IsItemIngredient(item) || tooltipInv.IsItemAlchemyItem(item) )
  2767. {
  2768. weight = 0;
  2769. }
  2770. else
  2771. {
  2772. weight = tooltipInv.GetItemEncumbrance( item );
  2773. }
  2774.  
  2775. category = GetItemCategoryLocalisedString( tooltipInv.GetItemCategory(item) );
  2776. typeStr = GetLocStringByKeyExt("item_category_" + tooltipInv.GetItemCategory(item) );
  2777. resultData.SetMemberFlashString("ItemType", typeStr);
  2778.  
  2779. categoryDescription = getCategoryDescription(tooltipInv.GetItemCategory(item));
  2780. resultData.SetMemberFlashString("CommonDescription", categoryDescription);
  2781. resultData.SetMemberFlashString("UniqueDescription", GetLocStringByKeyExt(tooltipInv.GetItemLocalizedDescriptionByUniqueID(item)));
  2782. resultData.SetMemberFlashString("PrimaryStatLabel", primaryStatLabel);
  2783. resultData.SetMemberFlashNumber("PrimaryStatValue", primaryStatValue);
  2784. resultData.SetMemberFlashString("ItemRarity", GetItemRarityDescription(item, tooltipInv) );
  2785. resultData.SetMemberFlashString("IconPath", tooltipInv.GetItemIconPathByUniqueID(item) );
  2786. resultData.SetMemberFlashString("ItemCategory", category);
  2787.  
  2788. tmpStr = NoTrailZeros( weight );
  2789. addGFxItemStat(propsList, "weight", tmpStr, "attribute_name_weight");
  2790.  
  2791. addGFxItemStat(propsList, "price", 0, "panel_inventory_item_price");
  2792.  
  2793.  
  2794.  
  2795.  
  2796.  
  2797. oilName = _inv.GetOldestOilAppliedOnItem( item, false ).GetOilItemName();
  2798. if (oilName != '')
  2799. {
  2800. addGFxItemStat(propsList, "oil", GetLocStringByKeyExt(_inv.GetItemLocalizedNameByName(oilName)));
  2801. }
  2802.  
  2803. socketsCount = _inv.GetItemEnhancementSlotsCount( item );
  2804. usedSocketsCount = _inv.GetItemEnhancementCount( item );
  2805. emptySocketsCount = socketsCount - usedSocketsCount;
  2806. _inv.GetItemEnhancementItems(item, socketItems);
  2807. for (idx = 0; idx < socketItems.Size(); idx+=1)
  2808. {
  2809. addGFxItemStat(propsList, "socket", GetLocStringByKeyExt(socketItems[idx]));
  2810. }
  2811. for (idx = 0; idx < emptySocketsCount; idx+=1)
  2812. {
  2813. addGFxItemStat(propsList, "empty_socket", GetLocStringByKeyExt("panel_inventory_tooltip_empty_socket"));
  2814. }
  2815.  
  2816. resultData.SetMemberFlashArray("PropertiesList", propsList);
  2817. m_flashValueStorage.SetFlashObject("context.tooltip.data", resultData);
  2818. }
  2819. }
  2820.  
  2821. function CompareItemsStats(itemStats : array<SAttributeTooltip>, compareItemStats : array<SAttributeTooltip>, out compResult : CScriptedFlashArray)
  2822. {
  2823. var l_flashObject : CScriptedFlashObject;
  2824. var attributeVal : SAbilityAttributeValue;
  2825. var strDifference : string;
  2826. var strDifValue : string;
  2827. var percentDiff : float;
  2828. var nDifference : float;
  2829. var i, j, price : int;
  2830. var statsCount : int;
  2831.  
  2832. strDifference = "none";
  2833. statsCount = itemStats.Size();
  2834. for( i = 0; i < statsCount; i += 1 )
  2835. {
  2836. l_flashObject = m_flashValueStorage.CreateTempFlashObject();
  2837. l_flashObject.SetMemberFlashString("name",itemStats[i].attributeName);
  2838. l_flashObject.SetMemberFlashString("color",itemStats[i].attributeColor);
  2839.  
  2840.  
  2841. for( j = 0; j < compareItemStats.Size(); j += 1 )
  2842. {
  2843. if( itemStats[j].attributeName == compareItemStats[i].attributeName )
  2844. {
  2845. nDifference = itemStats[j].value - compareItemStats[i].value;
  2846. percentDiff = AbsF(nDifference/itemStats[j].value);
  2847.  
  2848.  
  2849. if(nDifference > 0)
  2850. {
  2851. strDifValue = "(+" + NoTrailZeros(nDifference) + ")";
  2852. if(percentDiff < 0.25)
  2853. strDifference = "better";
  2854. else if(percentDiff > 0.75)
  2855. strDifference = "wayBetter";
  2856. else
  2857. strDifference = "reallyBetter";
  2858. }
  2859.  
  2860. else if(nDifference < 0)
  2861. {
  2862. strDifValue = "(" + RoundMath(nDifference) + ")";
  2863. if(percentDiff < 0.25)
  2864. strDifference = "worse";
  2865. else if(percentDiff > 0.75)
  2866. strDifference = "wayWorse";
  2867. else
  2868. strDifference = "reallyWorse";
  2869. }
  2870. break;
  2871. }
  2872. }
  2873. l_flashObject.SetMemberFlashString("icon", strDifference);
  2874. l_flashObject.SetMemberFlashBool("primaryStat", itemStats[j].primaryStat);
  2875.  
  2876. if( itemStats[i].percentageValue )
  2877. {
  2878. l_flashObject.SetMemberFlashString("value","+ " + RoundMath(itemStats[i].value * 100 ) +" %");
  2879. }
  2880. else
  2881. {
  2882. l_flashObject.SetMemberFlashString("value","+ " + RoundMath(itemStats[i].value) + strDifValue);
  2883. }
  2884. compResult.PushBackFlashObject(l_flashObject);
  2885. }
  2886. }
  2887.  
  2888. private function getCategoryDescription(itemCategory : name):string
  2889. {
  2890. switch (itemCategory)
  2891. {
  2892. case 'steelsword':
  2893. case 'silversword':
  2894. case 'crossbow':
  2895. case 'secondary':
  2896. case 'armor':
  2897. case 'pants':
  2898. case 'gloves':
  2899. case 'boots':
  2900. case 'armor':
  2901. case 'bolt':
  2902. return GetLocStringByKeyExt("item_category_" + itemCategory + "_desc");
  2903. break;
  2904. default:
  2905. return "";
  2906. break;
  2907. }
  2908. return "";
  2909. }
  2910.  
  2911. function GetItemRarityDescription( item : SItemUniqueId, tooltipInv : CInventoryComponent ) : string
  2912. {
  2913. var itemQuality : int;
  2914.  
  2915. itemQuality = tooltipInv.GetItemQuality(item);
  2916. return GetItemRarityDescriptionFromInt(itemQuality);
  2917. }
  2918.  
  2919. private function addGFxItemStat(out targetArray:CScriptedFlashArray, type:string, value:string, optional label:string):void
  2920. {
  2921. var resultData : CScriptedFlashObject;
  2922. var labelLoc : string;
  2923.  
  2924. resultData = m_flashValueStorage.CreateTempFlashObject();
  2925. resultData.SetMemberFlashString("type", type);
  2926. resultData.SetMemberFlashString("value", value);
  2927. if (label != "")
  2928. {
  2929. labelLoc = GetLocStringByKeyExt(label);
  2930. resultData.SetMemberFlashString("label", labelLoc);
  2931. }
  2932. targetArray.PushBackFlashObject(resultData);
  2933. }
  2934.  
  2935. function UpdatePlayerStatisticsData()
  2936. {
  2937. var l_flashObject : CScriptedFlashObject;
  2938. var l_flashArray : CScriptedFlashArray;
  2939. var valueStr : string;
  2940. var statsNr : int;
  2941. var statName : name;
  2942. var i : int;
  2943. var lastSentStatString : string;
  2944.  
  2945. l_flashArray = m_flashValueStorage.CreateTempFlashArray();
  2946.  
  2947.  
  2948. AddCharacterStatU("mainSilverStat", 'silverdamage', "panel_common_statistics_tooltip_silver_dps", "attack_silver", l_flashArray, m_flashValueStorage);
  2949. AddCharacterStatU("mainSteelStat", 'steeldamage', "panel_common_statistics_tooltip_steel_dps", "attack_steel", l_flashArray, m_flashValueStorage);
  2950. AddCharacterStat("mainResStat", 'armor', "attribute_name_armor", "armor", l_flashArray, m_flashValueStorage);
  2951. AddCharacterStat("mainMagicStat", 'spell_power', "stat_signs", "spell_power", l_flashArray, m_flashValueStorage);
  2952. AddCharacterStat("majorStat1", 'vitality', "vitality", "vitality", l_flashArray, m_flashValueStorage);
  2953.  
  2954. m_flashValueStorage.SetFlashArray( "playerstats.stats", l_flashArray );
  2955. }
  2956.  
  2957. private function updateSentStatValue(statName:name, statValue:string):void
  2958. {
  2959. var sentStat : SentStatsData;
  2960. var i : int;
  2961.  
  2962. for (i = 0; i < _sentStats.Size(); i += 1)
  2963. {
  2964. if (_sentStats[i].statName == statName)
  2965. {
  2966. _sentStats[i].statValue = statValue;
  2967. return;
  2968. }
  2969. }
  2970.  
  2971. sentStat.statName = statName;
  2972. sentStat.statValue = statValue;
  2973. _sentStats.PushBack(sentStat);
  2974. }
  2975.  
  2976. private function getLastSentStatValue(statName:name) : string
  2977. {
  2978. var i : int;
  2979.  
  2980. for (i = 0; i < _sentStats.Size(); i += 1)
  2981. {
  2982. if (_sentStats[i].statName == statName)
  2983. {
  2984. return _sentStats[i].statValue;
  2985. }
  2986. }
  2987.  
  2988. return "";
  2989. }
  2990.  
  2991. event OnSelectPlayerStat(statId : name)
  2992. {
  2993. ShowStatTooltip(statId);
  2994. }
  2995.  
  2996. event OnStatisticsLostFocus()
  2997. {
  2998. m_flashValueStorage.SetFlashBool("statistic.tooltip.hide", true);
  2999. }
  3000.  
  3001. public function ShowStatTooltip(statName : name)
  3002. {
  3003. var resultData : CScriptedFlashObject;
  3004. var statsList : CScriptedFlashArray;
  3005.  
  3006. resultData = m_flashValueStorage.CreateTempFlashObject();
  3007. statsList = m_flashValueStorage.CreateTempFlashArray();
  3008. switch (statName)
  3009. {
  3010. case 'vitality':
  3011. GetHealthTooltipData(statsList);
  3012. break;
  3013. case 'toxicity':
  3014. GetToxicityTooltipData(statsList);
  3015. break;
  3016. case 'stamina':
  3017. GetStaminaTooltipData(statsList);
  3018. break;
  3019. case 'focus':
  3020. GetAdrenalineTooltipData(statsList);
  3021. break;
  3022. case 'stat_offense':
  3023. GetOffenseTooltipData(statsList);
  3024. break;
  3025. case 'stat_defense':
  3026. GetDefenseTooltipData(statsList);
  3027. break;
  3028. case 'stat_signs':
  3029. GetSignsTooltipData(statsList);
  3030. break;
  3031. }
  3032. resultData.SetMemberFlashString("title", GetLocStringByKeyExt(statName));
  3033. resultData.SetMemberFlashString("description", GetLocStringByKeyExt(statName+"_desc"));
  3034. resultData.SetMemberFlashArray("statsList", statsList);
  3035. m_flashValueStorage.SetFlashObject("statistic.tooltip.data", resultData);
  3036. }
  3037.  
  3038. private function GetHealthTooltipData(out GFxData: CScriptedFlashArray):void
  3039. {
  3040. var maxHealth:float;
  3041. var curHealth:float;
  3042. var inCombatRegen:float;
  3043. var outOfCombatRegen:float;
  3044.  
  3045. maxHealth = thePlayer.GetStatMax(BCS_Vitality);
  3046. curHealth = thePlayer.GetStatPercents(BCS_Vitality);
  3047. inCombatRegen = CalculateAttributeValue(thePlayer.GetAttributeValue('vitalityCombatRegen'));
  3048. outOfCombatRegen = CalculateAttributeValue(thePlayer.GetAttributeValue('vitalityRegen'));
  3049. PushStatItem(GFxData, "panel_common_statistics_tooltip_current_health", (string)RoundMath(maxHealth * curHealth));
  3050. PushStatItem(GFxData, "panel_common_statistics_tooltip_maximum_health", (string)RoundMath(maxHealth));
  3051. PushStatItem(GFxData, "panel_common_statistics_tooltip_incombat_regen", (string)NoTrailZeros(RoundTo(inCombatRegen, 1)));
  3052. PushStatItem(GFxData, "panel_common_statistics_tooltip_outofcombat_regen", (string)NoTrailZeros(RoundTo(outOfCombatRegen, 1)));
  3053. }
  3054.  
  3055. private function GetToxicityTooltipData(out GFxData: CScriptedFlashArray):void
  3056. {
  3057. var maxToxicity:float;
  3058. var curToxicity:float;
  3059. var lockedToxicity:float;
  3060. var toxicityThreshold:float;
  3061.  
  3062. maxToxicity = thePlayer.GetStatMax(BCS_Toxicity);
  3063. curToxicity = thePlayer.GetStat(BCS_Toxicity, true);
  3064. lockedToxicity = thePlayer.GetStat(BCS_Toxicity) - curToxicity;
  3065. toxicityThreshold = GetWitcherPlayer().GetToxicityDamageThreshold();
  3066.  
  3067. PushStatItem(GFxData, "panel_common_statistics_tooltip_current_toxicity", (string)RoundMath(curToxicity));
  3068. PushStatItem(GFxData, "panel_common_statistics_tooltip_current_maximum", (string)RoundMath(maxToxicity));
  3069.  
  3070. PushStatItem(GFxData, "panel_common_statistics_tooltip_locked", (string)RoundMath(lockedToxicity));
  3071. PushStatItem(GFxData, "panel_common_statistics_tooltip_threshold", (string)RoundMath(toxicityThreshold));
  3072. PushStatItem(GFxData, "panel_common_statistics_tooltip_degeneration", (string)RoundMath(0));
  3073. }
  3074.  
  3075. private function GetStaminaTooltipData(out GFxData: CScriptedFlashArray):void
  3076. {
  3077. var maxStamina:float;
  3078. var regenStamia:float;
  3079. var value : SAbilityAttributeValue;
  3080.  
  3081. value = thePlayer.GetAttributeValue('staminaRegen');
  3082. regenStamia = value.valueMultiplicative / 0.34;
  3083. maxStamina = thePlayer.GetStatMax(BCS_Stamina);
  3084. PushStatItem(GFxData, "panel_common_statistics_tooltip_maximum_stamina ", (string)RoundMath(maxStamina));
  3085. PushStatItem(GFxData, "panel_common_statistics_tooltip_regeneration_rate", (string)NoTrailZeros( RoundTo(regenStamia, 2) ) );
  3086.  
  3087. }
  3088.  
  3089. private function GetAdrenalineTooltipData(out GFxData: CScriptedFlashArray):void
  3090. {
  3091. var maxAdrenaline:float;
  3092. var curAdrenaline:float;
  3093.  
  3094. maxAdrenaline = thePlayer.GetStatMax(BCS_Focus);
  3095. curAdrenaline = thePlayer.GetStat(BCS_Focus);
  3096. PushStatItem(GFxData, "panel_common_statistics_tooltip_adrenaline_current", (string)FloorF(curAdrenaline));
  3097. PushStatItem(GFxData, "panel_common_statistics_tooltip_adrenaline_max", (string)RoundMath(maxAdrenaline));
  3098.  
  3099. }
  3100.  
  3101. private function GetOffenseTooltipData(out GFxData: CScriptedFlashArray):void
  3102. {
  3103. var curStats:SPlayerOffenseStats;
  3104. curStats = GetWitcherPlayer().GetOffenseStatsList();
  3105.  
  3106. PushStatItem(GFxData, "panel_common_statistics_tooltip_steel_fast_dps", StatToStr(curStats.steelFastDPS));
  3107. PushStatItem(GFxData, "panel_common_statistics_tooltip_steel_fast_crit_chance", StatToStr(curStats.steelFastCritChance) + "%");
  3108. PushStatItem(GFxData, "panel_common_statistics_tooltip_steel_fast_crit_dmg", StatToStr(curStats.steelFastCritDmg) + "%");
  3109.  
  3110. PushStatItem(GFxData, "panel_common_statistics_tooltip_steel_strong_dps", StatToStr(curStats.steelStrongDPS));
  3111. PushStatItem(GFxData, "panel_common_statistics_tooltip_steel_strong_crit_chance", StatToStr(curStats.steelStrongCritChance) + "%");
  3112. PushStatItem(GFxData, "panel_common_statistics_tooltip_steel_strong_crit_dmg", StatToStr(curStats.steelStrongCritDmg) + "%");
  3113.  
  3114. PushStatItem(GFxData, "panel_common_statistics_tooltip_silver_fast_dps", StatToStr(curStats.silverFastDPS));
  3115. PushStatItem(GFxData, "panel_common_statistics_tooltip_silver_fast_crit_chance", StatToStr(curStats.silverFastCritChance) + "%");
  3116. PushStatItem(GFxData, "panel_common_statistics_tooltip_silver_fast_crit_dmg", StatToStr(curStats.silverFastCritDmg) + "%");
  3117.  
  3118. PushStatItem(GFxData, "panel_common_statistics_tooltip_silver_strong_dps", StatToStr(curStats.silverStrongDPS));
  3119. PushStatItem(GFxData, "panel_common_statistics_tooltip_silver_strong_crit_chance", StatToStr(curStats.silverStrongCritChance) + "%");
  3120. PushStatItem(GFxData, "panel_common_statistics_tooltip_silver_strong_crit_dmg", StatToStr(curStats.silverStrongCritDmg) + "%");
  3121.  
  3122. PushStatItem(GFxData, "panel_common_statistics_tooltip_crossbow_dps", StatToStr(curStats.crossbowCritChance) + "%");
  3123. PushStatItem(GFxData, "panel_common_statistics_tooltip_crossbow_crit_chance", StatToStr(curStats.crossbowSteelDmg));
  3124. }
  3125.  
  3126. private function GetDefenseTooltipData(out GFxData: CScriptedFlashArray):void
  3127. {
  3128. PushStatItem(GFxData, "panel_common_statistics_tooltip_armor", "");
  3129. PushStatItem(GFxData, "slashing_resistance", GetStatValue('slashing_resistance_perc') + "%");
  3130. PushStatItem(GFxData, "piercing_resistance", GetStatValue('piercing_resistance_perc') + "%");
  3131. PushStatItem(GFxData, "bludgeoning_resistance", GetStatValue('bludgeoning_resistance_perc') + "%");
  3132. PushStatItem(GFxData, "rending_resistance", GetStatValue('rending_resistance_pec') + "%");
  3133. PushStatItem(GFxData, "elemental_resistance", GetStatValue('elemental_resistance_perc') + "%");
  3134. PushStatItem(GFxData, "poison_resistance", GetStatValue('poison_resistance_perc') + "%");
  3135. PushStatItem(GFxData, "fire_resistance", GetStatValue('fire_resistance_perc') + "%");
  3136. PushStatItem(GFxData, "bleeding_resistance", GetStatValue('bleeding_resistance_perc') + "%");
  3137. PushStatItem(GFxData, "knockdown_resistance", GetStatValue('knockdown_resistance_perc') + "%");
  3138. }
  3139.  
  3140. private function GetSignsTooltipData(out GFxData: CScriptedFlashArray):void
  3141. {
  3142. var sp : SAbilityAttributeValue;
  3143. var witcher : W3PlayerWitcher;
  3144. var str : string;
  3145.  
  3146. witcher = GetWitcherPlayer();
  3147.  
  3148. sp = witcher.GetTotalSignSpellPower(S_Magic_1);
  3149. str = (string)RoundMath(sp.valueMultiplicative*100) + "%";
  3150. PushStatItem(GFxData, 'aard_intensity', str );
  3151.  
  3152. sp = witcher.GetTotalSignSpellPower(S_Magic_2);
  3153. str = (string)RoundMath(sp.valueMultiplicative*100) + "%";
  3154. PushStatItem(GFxData, 'igni_intensity', str );
  3155.  
  3156. sp = witcher.GetTotalSignSpellPower(S_Magic_3);
  3157. str = (string)RoundMath(sp.valueMultiplicative*100) + "%";
  3158. PushStatItem(GFxData, 'yrden_intensity', str );
  3159.  
  3160. sp = witcher.GetTotalSignSpellPower(S_Magic_4);
  3161. str = (string)RoundMath(sp.valueMultiplicative*100) + "%";
  3162. PushStatItem(GFxData, 'quen_intensity', str );
  3163.  
  3164. sp = witcher.GetTotalSignSpellPower(S_Magic_5);
  3165. str = (string)RoundMath(sp.valueMultiplicative*100) + "%";
  3166. PushStatItem(GFxData, 'axii_intensity', str );
  3167. }
  3168.  
  3169. private function GetSignStat(targetSkill:ESkill):string
  3170. {
  3171. var powerStatValue : SAbilityAttributeValue;
  3172. var damageTypeName : name;
  3173. var points : float;
  3174.  
  3175. GetWitcherPlayer().GetSignStats(targetSkill, damageTypeName, points, powerStatValue);
  3176. return NoTrailZeros(RoundMath(powerStatValue.valueMultiplicative * 100)) + " %";
  3177. }
  3178.  
  3179. private function StatToStr(value:float):string
  3180. {
  3181. return (string)NoTrailZeros(RoundTo(value, 1));
  3182. }
  3183.  
  3184. private function PushStatItem(out statsList: CScriptedFlashArray, label:string, value:string):void
  3185. {
  3186. var statItemData : CScriptedFlashObject;
  3187. statItemData = m_flashValueStorage.CreateTempFlashObject();
  3188. statItemData.SetMemberFlashString("name", GetLocStringByKeyExt(label));
  3189. statItemData.SetMemberFlashString("value", value);
  3190. statsList.PushBackFlashObject(statItemData);
  3191. }
  3192.  
  3193. event OnShowFullStats()
  3194. {
  3195. if (_charStatsPopupData)
  3196. {
  3197. delete _charStatsPopupData;
  3198. }
  3199.  
  3200. _charStatsPopupData = new CharacterStatsPopupData in this;
  3201. _charStatsPopupData.HideTutorial = true;
  3202.  
  3203. RequestSubMenu('PopupMenu', _charStatsPopupData);
  3204. }
  3205.  
  3206. function PlayOpenSoundEvent()
  3207. {
  3208.  
  3209.  
  3210. }
  3211.  
  3212. //zur13 modSSS public morozov antipattern ;)
  3213. public function SSS_tryUnequipSkill(skill : ESkill):void
  3214. {
  3215. tryUnequipSkill(skill);
  3216. }
  3217.  
  3218. public function SSS_PopulateTabData(tabIndex:int) : void
  3219. {
  3220. PopulateTabData(tabIndex);
  3221. }
  3222.  
  3223. public function SSS_GetTabForSkill(skillID : ESkill) : CharacterMenuTabIndexes
  3224. {
  3225. return GetTabForSkill(skillID);
  3226. }
  3227.  
  3228. public function SSS_UpdateAppliedSkill(slotID:int):void
  3229. {
  3230. UpdateAppliedSkill(slotID);
  3231. }
  3232.  
  3233. public function SSS_UpdateGroupsData():void
  3234. {
  3235. UpdateGroupsData();
  3236. }
  3237.  
  3238. public function SSS_UpdateMutagens():void
  3239. {
  3240. UpdateMutagens();
  3241. }
  3242.  
  3243. public function SSS_UpdatePlayerStatisticsData()
  3244. {
  3245. UpdatePlayerStatisticsData();
  3246. }
  3247.  
  3248. public function SSS_Get_m_fxPaperdollChanged():CScriptedFlashFunction
  3249. {
  3250. return m_fxPaperdollChanged;
  3251. }
  3252.  
  3253. public function SSS_Get_m_fxClearSkillSlot(): CScriptedFlashFunction
  3254. {
  3255. return m_fxClearSkillSlot;
  3256. }
  3257.  
  3258. protected function HandleMenuLoaded():void
  3259. {
  3260. super.HandleMenuLoaded();
  3261. SSS_OnConfigUI(this);
  3262. }
  3263.  
  3264. public function SSS_UpdateSkillPoints() : void
  3265. {
  3266. UpdateSkillPoints();
  3267. }
  3268.  
  3269. public function SSS_UpdateTargetMutationData( mutationId : EPlayerMutationType ):void
  3270. {
  3271. return UpdateTargetMutationData( mutationId );
  3272. }
  3273.  
  3274. public function SSS_CheckTabChange(slotID:int):bool
  3275. {
  3276. if(slotID==2004)
  3277. {
  3278. //Prev tab
  3279. OnPlaySoundEvent( "gui_global_submenu_whoosh" );
  3280. tabChanging = true;
  3281. SSS_PrevTab(this);
  3282. SSS_UpdateTabTextAndRefreshGUI();
  3283. tabChanging = false;
  3284. return true;
  3285. }
  3286. if(slotID==2005)
  3287. {
  3288. //Next tab
  3289. OnPlaySoundEvent( "gui_global_submenu_whoosh" );
  3290. tabChanging = true;
  3291. SSS_NextTab(this);
  3292. SSS_UpdateTabTextAndRefreshGUI();
  3293. tabChanging = false;
  3294. return true;
  3295. }
  3296. return false;
  3297. }
  3298.  
  3299. public function SSS_UpdateTabTextAndRefreshGUI()
  3300. {
  3301. var tab: int;
  3302. tab = SSS_GetCurrentTab();
  3303. SSS_SetTabsText(tab+"/"+SSS_GetTabsCountFromSlotsCount());
  3304.  
  3305. //UpdateAppliedSkill(slotID);
  3306. UpdateAppliedSkills();
  3307. UpdateMutagens();
  3308. //UpdateSkillPoints();
  3309. UpdatePlayerStatisticsData();
  3310. UpdateGroupsData();
  3311. UpdateMasterMutation();
  3312.  
  3313. m_fxPaperdollChanged.InvokeSelf();
  3314. }
  3315.  
  3316. public function SSS_SetTabsText(text:string)
  3317. {
  3318. m_fxSetTabsLabelText.InvokeSelfOneArg( FlashArgString( text ) );
  3319. }
  3320.  
  3321. public function SSS_InitCurrentTab()
  3322. {
  3323. // Init current
  3324. currTab = ( ( W3PlayerAbilityManager ) GetWitcherPlayer().abilityManager ).SSS_GetCurrentTab();
  3325. if(!currTab || currTab < 1 || currTab > SSS_GetTabsCountFromSlotsCount() || !SSS_TargetRememberLastOpenedTab() ){
  3326. currTab = 1;
  3327. }
  3328. }
  3329.  
  3330. public function SSS_UpdatePamCurrentTab()
  3331. {
  3332. // update current tab in player ability manager
  3333. //if(!currTab)
  3334. //{
  3335. ( ( W3PlayerAbilityManager ) GetWitcherPlayer().abilityManager ).SSS_UpdateCurrentTab(currTab);
  3336. //}
  3337. }
  3338.  
  3339. public function SSS_GetCurrentTab():int
  3340. {
  3341. if(!currTab)
  3342. {
  3343. SSS_InitCurrentTab();
  3344. }
  3345. return currTab;
  3346. }
  3347.  
  3348. public function SSS_IncrementAndGetCurrrentTab():int
  3349. {
  3350. if(!currTab)
  3351. {
  3352. SSS_InitCurrentTab();
  3353. }
  3354. currTab += 1;
  3355.  
  3356. if( currTab > SSS_GetTabsCountFromSlotsCount() )
  3357. {
  3358. currTab = 1;
  3359. }
  3360. SSS_UpdatePamCurrentTab();
  3361. return currTab;
  3362. }
  3363.  
  3364. public function SSS_DecrementAndGetCurrrentTab():int
  3365. {
  3366. if(!currTab)
  3367. {
  3368. SSS_InitCurrentTab();
  3369. }
  3370. currTab -= 1;
  3371.  
  3372. if( currTab < 1 )
  3373. {
  3374. currTab = SSS_GetTabsCountFromSlotsCount();
  3375. }
  3376. if(currTab < 1)
  3377. {
  3378. currTab = 1;
  3379. }
  3380. SSS_UpdatePamCurrentTab();
  3381. return currTab;
  3382. }
  3383.  
  3384. public function SSS_FixSynergyBonuses()
  3385. {
  3386. var color : ESkillColor;
  3387. var i, g1, g2, g3, g4, ds, mt : int;
  3388.  
  3389. if( SSS_TargetMutagenSlotsTabbed() )
  3390. {
  3391. ds = SSS_DeSynergyGroupNum();
  3392. g1 = SSS_ConvertMutGroupIDFromFlash(1, SSS_GetCurrentTab());
  3393. g2 = SSS_ConvertMutGroupIDFromFlash(2, SSS_GetCurrentTab());
  3394. g3 = SSS_ConvertMutGroupIDFromFlash(3, SSS_GetCurrentTab());
  3395. g4 = SSS_ConvertMutGroupIDFromFlash(4, SSS_GetCurrentTab());
  3396. mt = ((W3PlayerAbilityManager)thePlayer.abilityManager).SSS_GetMutationSkillGroupID();
  3397.  
  3398. for( i = 1; i <= SSS_TargetSlotsTabs() * 4 + 1; i += 1 )
  3399. {
  3400. if( i > 0 && i != ds && i != g1 && i != g2 && i != g3 && i != g4 && i != mt )
  3401. {
  3402. GetGroupBonusDescription(i, color); //zur13 modSSS mutTabs this method adds groups synergy bonus to PlayerAbilityManager
  3403. }
  3404. }
  3405. }
  3406. }
  3407.  
  3408. public function SSS_CreateBonusGFxData(index:int):CScriptedFlashObject
  3409. {
  3410. var gfxGroupBonus : CScriptedFlashObject;
  3411. var description : string;
  3412. var color : ESkillColor;
  3413. //groupId = SSS_ConvertMutGroupIDFromFlash(groupId, SSS_GetCurrentTab()); //zur13 modSSS mutTabs
  3414. //description = GetGroupBonusDescription(index, color);
  3415. description = GetGroupBonusDescription(SSS_ConvertMutGroupIDFromFlash(index, SSS_GetCurrentTab()), color);
  3416. if (index > m_previousSkillBonuses.Size())
  3417. {
  3418. m_previousSkillBonuses.PushBack(description);
  3419. }
  3420. else if (m_previousSkillBonuses[index] != description)
  3421. {
  3422. m_previousSkillBonuses[index] = description;
  3423. if (description == "")
  3424. {
  3425. if( tabChanging == false )
  3426. {
  3427. OnPlaySoundEvent("gui_character_synergy_effect_lose");
  3428. }
  3429. }
  3430. else
  3431. {
  3432. if( tabChanging == false )
  3433. {
  3434. OnPlaySoundEvent("gui_character_synergy_effect");
  3435. }
  3436. }
  3437. }
  3438.  
  3439. gfxGroupBonus = m_flashValueStorage.CreateTempFlashObject();
  3440. gfxGroupBonus.SetMemberFlashString('description', description);
  3441. gfxGroupBonus.SetMemberFlashInt('color', color);
  3442.  
  3443. return gfxGroupBonus;
  3444. }
  3445.  
  3446. public function SSS_UpdateAppliedSkills():void
  3447. {
  3448. var gfxSlots : CScriptedFlashObject;
  3449. var gfxSlotsList : CScriptedFlashArray;
  3450. var curSlot : SSkillSlot;
  3451. var equipedSkill : SSkill;
  3452. var skillSlots : array<SSkillSlot>;
  3453. var slotsCount : int;
  3454. var i : int;
  3455. var tab : int;
  3456. var tabFirstSlotId : int;
  3457. var nextTabFirstSlotId : int;
  3458. var equippedMutationId : EPlayerMutationType;
  3459. var equippedMutation : SMutation;
  3460. var colorsList : array< ESkillColor >;
  3461. var colorBorderId : string;
  3462.  
  3463. tab = SSS_GetCurrentTab();
  3464. tabFirstSlotId = SSS_GetTabFirstSlotIndex(tab) + 1;
  3465. nextTabFirstSlotId = SSS_GetTabFirstSlotIndex(tab + 1) + 1;
  3466.  
  3467. gfxSlotsList = m_flashValueStorage.CreateTempFlashArray();
  3468. skillSlots = thePlayer.GetSkillSlots();
  3469. slotsCount = skillSlots.Size();
  3470. equippedMutationId = GetWitcherPlayer().GetEquippedMutationType();
  3471.  
  3472. if( equippedMutationId != EPMT_None )
  3473. {
  3474. equippedMutation = GetWitcherPlayer().GetMutation( equippedMutationId );
  3475. }
  3476.  
  3477. LogChannel( 'CHR', "UpdateAppliedSkills add " + slotsCount + " items" );
  3478. for( i=tabFirstSlotId - 1; i < nextTabFirstSlotId - 1; i+=1 )
  3479. {
  3480. curSlot = skillSlots[i];
  3481. equipedSkill = thePlayer.GetPlayerSkill( curSlot.socketedSkill );
  3482.  
  3483. gfxSlots = m_flashValueStorage.CreateTempFlashObject();
  3484. GetSkillGFxObject( equipedSkill, false, gfxSlots );
  3485.  
  3486. gfxSlots.SetMemberFlashInt( 'tabId', GetTabForSkill( curSlot.socketedSkill ) );
  3487. gfxSlots.SetMemberFlashInt( 'slotId', SSS_ConvertSlotIDToTabSlotID(curSlot.id, tab) );
  3488. gfxSlots.SetMemberFlashInt( 'unlockedOnLevel', curSlot.unlockedOnLevel );
  3489. gfxSlots.SetMemberFlashInt( 'groupID', curSlot.groupID );
  3490. gfxSlots.SetMemberFlashBool( 'unlocked', curSlot.unlocked );
  3491.  
  3492. colorBorderId = "";
  3493. if( curSlot.id >= BSS_SkillSlot1 && curSlot.id <= BSS_SkillSlot4 ) //zur13 modSSS
  3494. {
  3495. gfxSlots.SetMemberFlashBool( 'isMutationSkill', true );
  3496. gfxSlots.SetMemberFlashInt( 'unlockedOnLevel', ( curSlot.id - BSS_SkillSlot1 + 1 ) );
  3497.  
  3498. if (equippedMutationId != EPMT_None)
  3499. {
  3500. colorsList = equippedMutation.colors;
  3501.  
  3502. if( colorsList.Contains(SC_Red) )
  3503. {
  3504. colorBorderId += "Red";
  3505. }
  3506.  
  3507. if( colorsList.Contains(SC_Green) )
  3508. {
  3509. colorBorderId += "Green";
  3510. }
  3511.  
  3512. if( colorsList.Contains(SC_Blue) )
  3513. {
  3514. colorBorderId += "Blue";
  3515. }
  3516. }
  3517. if( !SSS_TargetDisableMutationSkillSlotsColorRestrictions() )//zur13 modSSS
  3518. gfxSlots.SetMemberFlashString( 'colorBorder', colorBorderId );
  3519. }
  3520. else
  3521. {
  3522. gfxSlots.SetMemberFlashInt( 'unlockedOnLevel', curSlot.unlockedOnLevel );
  3523. }
  3524.  
  3525. gfxSlotsList.PushBackFlashObject( gfxSlots );
  3526. }
  3527. if( tab != 1 )
  3528. {
  3529. for( i = BSS_SkillSlot1 - 1; i < BSS_SkillSlot4; i+=1 )
  3530. {
  3531. curSlot = skillSlots[i];
  3532. equipedSkill = thePlayer.GetPlayerSkill( curSlot.socketedSkill );
  3533.  
  3534. gfxSlots = m_flashValueStorage.CreateTempFlashObject();
  3535. GetSkillGFxObject( equipedSkill, false, gfxSlots );
  3536.  
  3537. gfxSlots.SetMemberFlashInt( 'tabId', GetTabForSkill( curSlot.socketedSkill ) );
  3538. gfxSlots.SetMemberFlashInt( 'slotId', curSlot.id );
  3539. gfxSlots.SetMemberFlashInt( 'unlockedOnLevel', curSlot.unlockedOnLevel );
  3540. gfxSlots.SetMemberFlashInt( 'groupID', curSlot.groupID );
  3541. gfxSlots.SetMemberFlashBool( 'unlocked', curSlot.unlocked );
  3542.  
  3543. colorBorderId = "";
  3544. if( curSlot.id >= BSS_SkillSlot1 && curSlot.id <= BSS_SkillSlot4 ) //zur13 modSSS
  3545. {
  3546. gfxSlots.SetMemberFlashBool( 'isMutationSkill', true );
  3547. gfxSlots.SetMemberFlashInt( 'unlockedOnLevel', ( curSlot.id - BSS_SkillSlot1 + 1 ) );
  3548.  
  3549. if (equippedMutationId != EPMT_None)
  3550. {
  3551. colorsList = equippedMutation.colors;
  3552.  
  3553. if( colorsList.Contains(SC_Red) )
  3554. {
  3555. colorBorderId += "Red";
  3556. }
  3557.  
  3558. if( colorsList.Contains(SC_Green) )
  3559. {
  3560. colorBorderId += "Green";
  3561. }
  3562.  
  3563. if( colorsList.Contains(SC_Blue) )
  3564. {
  3565. colorBorderId += "Blue";
  3566. }
  3567. }
  3568. if( !SSS_TargetDisableMutationSkillSlotsColorRestrictions() )//zur13 modSSS
  3569. gfxSlots.SetMemberFlashString( 'colorBorder', colorBorderId );
  3570. }
  3571. else
  3572. {
  3573. gfxSlots.SetMemberFlashInt( 'unlockedOnLevel', curSlot.unlockedOnLevel );
  3574. }
  3575.  
  3576. gfxSlotsList.PushBackFlashObject( gfxSlots );
  3577. }
  3578. }
  3579. m_flashValueStorage.SetFlashArray( "character.skills.slots", gfxSlotsList );
  3580. }
  3581.  
  3582. public function SSS_UpdateMutagens2():bool
  3583. {
  3584. var idx : int;
  3585. var mutCount : int;
  3586. var slotUnlocked : bool;
  3587. var gfxMutSlot : CScriptedFlashObject;
  3588. var gfxMutSlotsList : CScriptedFlashArray;
  3589. var skillMutagenSlots : array<SMutagenSlot>;
  3590. var currentMutSlot : SMutagenSlot;
  3591. var invComponent : CInventoryComponent;
  3592. var playerInv : W3GuiPlayerInventoryComponent;
  3593.  
  3594. if (!SSS_TargetMutagenSlotsTabbed())
  3595. {
  3596. return false;
  3597. }
  3598.  
  3599. invComponent = thePlayer.GetInventory();
  3600. playerInv = new W3GuiPlayerInventoryComponent in this;
  3601. playerInv.Initialize( invComponent );
  3602.  
  3603. gfxMutSlotsList = m_flashValueStorage.CreateTempFlashArray();
  3604. skillMutagenSlots = thePlayer.GetPlayerSkillMutagens();
  3605. mutCount = skillMutagenSlots.Size();
  3606.  
  3607. for (idx = SSS_GetTabFirstMutagenIdx(SSS_GetCurrentTab()); idx < SSS_GetTabFirstMutagenIdx(SSS_GetCurrentTab())+4; idx+=1) //zur13 modSSS mutTabs for (idx = 0; idx < mutCount; idx+=1)
  3608. {
  3609. currentMutSlot = skillMutagenSlots[idx];
  3610. gfxMutSlot = m_flashValueStorage.CreateTempFlashObject();
  3611. slotUnlocked = GetWitcherPlayer().GetLevel() >= currentMutSlot.unlockedAtLevel;
  3612.  
  3613. gfxMutSlot.SetMemberFlashInt('slotId', SSS_ConvertMutSlotIDToFlash(currentMutSlot.equipmentSlot) );
  3614. gfxMutSlot.SetMemberFlashInt('groupId', currentMutSlot.skillGroupID);
  3615. gfxMutSlot.SetMemberFlashString('slotType', SSS_ConvertMutSlotIDToFlash(currentMutSlot.equipmentSlot) );
  3616. gfxMutSlot.SetMemberFlashBool('unlocked', slotUnlocked);
  3617. gfxMutSlot.SetMemberFlashInt('unlockedAtLevel', currentMutSlot.unlockedAtLevel);
  3618.  
  3619. if (invComponent.IsIdValid(currentMutSlot.item))
  3620. {
  3621. playerInv.SetInventoryFlashObjectForItem(currentMutSlot.item, gfxMutSlot); gfxMutSlot.SetMemberFlashString('color', SSS_GetMutageSlotColor(currentMutSlot, this, invComponent)); //zur13 modSSS
  3622. //gfxMutSlot.SetMemberFlashString('color', invComponent.GetSkillMutagenColor(currentMutSlot.item)); //zur13 modSSS
  3623. }
  3624. else
  3625. {
  3626. gfxMutSlot.SetMemberFlashString('color', SC_None);
  3627. }
  3628. gfxMutSlotsList.PushBackFlashObject(gfxMutSlot);
  3629. }
  3630. m_flashValueStorage.SetFlashArray( "character.skills.mutagens", gfxMutSlotsList);
  3631. return true;
  3632. }
  3633. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement