Advertisement
Guest User

Untitled

a guest
Aug 13th, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 33.41 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. class WmkCR4HudModuleRadialMenu extends CR4HudModuleBase // -= WMK:modQuickSlots =-
  7. {
  8. private var m_flashValueStorage : CScriptedFlashValueStorage;
  9. private var m_fxBlockRadialMenuSFF : CScriptedFlashFunction;
  10. private var m_fxShowRadialMenuSFF : CScriptedFlashFunction;
  11. private var m_fxUpdateItemIconSFF : CScriptedFlashFunction;
  12. private var m_fxUpdateFieldEquippedStateSFF : CScriptedFlashFunction;
  13. private var m_fxSetDesaturatedSFF : CScriptedFlashFunction;
  14. private var m_fxSetCiriRadialSFF : CScriptedFlashFunction;
  15. private var m_fxSetCiriItemSFF : CScriptedFlashFunction;
  16. private var m_fxSetMeditationButtonEnabledSFF : CScriptedFlashFunction;
  17. private var m_fxSetSelectedItem : CScriptedFlashFunction;
  18. private var m_fxSetArabicAligmentMode : CScriptedFlashFunction;
  19. private var m_fxUpdateInputMode : CScriptedFlashFunction;
  20.  
  21. private var m_shown : bool;
  22. private var m_IsPlayerCiri : bool;
  23. private var m_isDesaturated : bool;
  24. private var m_HasBlink : bool;
  25. private var m_HasCharge : bool;
  26. private var m_allowAutoRotationReturnValue : bool;
  27. private var m_swappedAcceptCancel : bool;
  28. private var m_tutorialsHidden : bool;
  29. private var _currentSelection : string;
  30.  
  31. default m_shown = false;
  32. default m_IsPlayerCiri = false;
  33. default m_isDesaturated = false;
  34. default m_allowAutoRotationReturnValue = true;
  35.  
  36. // ---=== modE3 ===---
  37. private var mcNameLine : CScriptedFlashSprite;
  38. private var mcSelection : CScriptedFlashSprite;
  39. // ---=== modE3 ===---
  40.  
  41. event OnConfigUI()
  42. {
  43. var flashModule : CScriptedFlashSprite;
  44.  
  45. m_tutorialsHidden = false;
  46.  
  47. m_anchorName = "ScaleOnly";
  48. super.OnConfigUI();
  49.  
  50. flashModule = GetModuleFlash();
  51. m_flashValueStorage = GetModuleFlashValueStorage();
  52.  
  53. m_fxUpdateInputMode = flashModule.GetMemberFlashFunction( "setAlternativeInputMode" );
  54. m_fxSetArabicAligmentMode = flashModule.GetMemberFlashFunction( "setArabicAligmentMode" );
  55. m_fxBlockRadialMenuSFF = flashModule.GetMemberFlashFunction( "BlockRadialMenu" );
  56. m_fxShowRadialMenuSFF = flashModule.GetMemberFlashFunction( "ShowRadialMenu" );
  57. m_fxUpdateItemIconSFF = flashModule.GetMemberFlashFunction( "UpdateItemIcon" );
  58. m_fxUpdateFieldEquippedStateSFF = flashModule.GetMemberFlashFunction( "UpdateFieldEquippedState" );
  59. m_fxSetDesaturatedSFF = flashModule.GetMemberFlashFunction( "SetDesaturated" );
  60. m_fxSetCiriRadialSFF = flashModule.GetMemberFlashFunction( "setCiriRadial" );
  61. m_fxSetCiriItemSFF = flashModule.GetMemberFlashFunction( "setCiriItem" );
  62. m_fxSetMeditationButtonEnabledSFF = flashModule.GetMemberFlashFunction( "SetMeditationButtonEnabled" );
  63. m_fxSetSelectedItem = flashModule.GetMemberFlashFunction( "setSelectedItem" );
  64.  
  65.  
  66. // ---=== modE3 ===---
  67. mcNameLine = flashModule.GetChildFlashSprite("mcNameLine");
  68. mcSelection = flashModule.GetChildFlashSprite("mcSelection");
  69. // ---=== modE3 ===---
  70.  
  71.  
  72. theInput.RegisterListener( this, 'OnRadialMenu', 'RadialMenu' );
  73. theInput.RegisterListener( this, 'OnRadialMenuClose', 'CloseRadialMenu' );
  74. theInput.RegisterListener( this, 'OnRadialMenuConfirmSelection', 'ConfirmRadialMenuSelection' );
  75.  
  76. theInput.RegisterListener( this, 'OnOpenMeditation', 'OpenMeditation' );
  77.  
  78. UpdateSwapAcceptCancel();
  79. UpdateInputMode();
  80. setArabicAligmentMode();
  81.  
  82. SelectCurrentSign();
  83.  
  84. UpdateItemsIcons();
  85. }
  86.  
  87. public function setArabicAligmentMode() : void
  88. {
  89. var language : string;
  90. var audioLanguage : string;
  91. theGame.GetGameLanguageName(audioLanguage,language);
  92. if (m_fxSetArabicAligmentMode)
  93. {
  94. m_fxSetArabicAligmentMode.InvokeSelfOneArg( FlashArgBool( (language == "AR") ) );
  95. }
  96. }
  97.  
  98. public function UpdateSwapAcceptCancel():void
  99. {
  100. var inGameConfigWrapper : CInGameConfigWrapper;
  101. inGameConfigWrapper = (CInGameConfigWrapper)theGame.GetInGameConfigWrapper();
  102. m_swappedAcceptCancel = inGameConfigWrapper.GetVarValue('Controls', 'SwapAcceptCancel');
  103. }
  104.  
  105. public function UpdateInputMode():void
  106. {
  107. var inGameConfigWrapper : CInGameConfigWrapper;
  108. var isAlternativeInputMode : bool;
  109.  
  110. inGameConfigWrapper = (CInGameConfigWrapper)theGame.GetInGameConfigWrapper();
  111. isAlternativeInputMode = inGameConfigWrapper.GetVarValue('Controls', 'AlternativeRadialMenuInputMode');
  112. m_fxUpdateInputMode.InvokeSelfOneArg( FlashArgBool( isAlternativeInputMode ) );
  113. }
  114.  
  115. event OnTick( timeDelta : float )
  116. {
  117. }
  118.  
  119. function IsRadialMenuOpened() : bool
  120. {
  121. return m_shown;
  122. }
  123.  
  124. // ---=== modE3 ===---
  125. private function SetItemScalePositions(slot : string)// ---=== modE3 ===---
  126. {
  127. var flashModule : CScriptedFlashSprite;
  128. var mcAard, mcIgni, mcAxii, mcYrden, mcQuen : CScriptedFlashSprite;
  129. var slot1, slot2, slot4, slot5, crossbow : CScriptedFlashSprite;
  130. var scaleUp : int;
  131. var xOffset : int;
  132. var xNormal : int;
  133. var inv : CInventoryComponent;
  134. var equippedItem : SItemUniqueId;
  135. var player : W3PlayerWitcher;
  136. var itemName : string;
  137.  
  138. scaleUp = 115;
  139. xOffset = 14;
  140. xNormal = 11;
  141.  
  142. flashModule = GetModuleFlash();
  143.  
  144. mcAard = flashModule.GetChildFlashSprite("mcRadialMenuFields").GetChildFlashSprite("mcRadialMenuItem5").GetChildFlashSprite("mcIcon");
  145. mcAxii = flashModule.GetChildFlashSprite("mcRadialMenuFields").GetChildFlashSprite("mcRadialMenuItem4").GetChildFlashSprite("mcIcon");
  146. mcIgni = flashModule.GetChildFlashSprite("mcRadialMenuFields").GetChildFlashSprite("mcRadialMenuItem3").GetChildFlashSprite("mcIcon");
  147. mcQuen = flashModule.GetChildFlashSprite("mcRadialMenuFields").GetChildFlashSprite("mcRadialMenuItem2").GetChildFlashSprite("mcIcon");
  148. mcYrden = flashModule.GetChildFlashSprite("mcRadialMenuFields").GetChildFlashSprite("mcRadialMenuItem1").GetChildFlashSprite("mcIcon");
  149.  
  150.  
  151. slot1 = flashModule.GetChildFlashSprite("mcRadialMenuFields").GetChildFlashSprite("mcRadialMenuItem6").GetChildFlashSprite("mcIcon");
  152. slot2 = flashModule.GetChildFlashSprite("mcRadialMenuFields").GetChildFlashSprite("mcRadialMenuItem7").GetChildFlashSprite("mcIcon");
  153. crossbow = flashModule.GetChildFlashSprite("mcRadialMenuFields").GetChildFlashSprite("mcRadialMenuItem8").GetChildFlashSprite("mcIcon");
  154. slot4 = flashModule.GetChildFlashSprite("mcRadialMenuFields").GetChildFlashSprite("mcRadialMenuItem9").GetChildFlashSprite("mcIcon");
  155. slot5 = flashModule.GetChildFlashSprite("mcRadialMenuFields").GetChildFlashSprite("mcRadialMenuItem10").GetChildFlashSprite("mcIcon");
  156.  
  157.  
  158. //scales
  159. mcAard.SetXScale(100);
  160. mcAard.SetYScale(100);
  161. mcAxii.SetXScale(100);
  162. mcAxii.SetYScale(100);
  163. mcIgni.SetXScale(100);
  164. mcIgni.SetYScale(100);
  165. mcQuen.SetXScale(100);
  166. mcQuen.SetYScale(100);
  167. mcYrden.SetXScale(100);
  168. mcYrden.SetYScale(100);
  169.  
  170. slot1.SetXScale(100);
  171. slot1.SetYScale(100);
  172. slot2.SetXScale(100);
  173. slot2.SetYScale(100);
  174. crossbow.SetXScale(100);
  175. crossbow.SetYScale(100);
  176. slot4.SetXScale(100);
  177. slot4.SetYScale(100);
  178. slot5.SetXScale(100);
  179. slot5.SetYScale(100);
  180.  
  181. //positions
  182. mcAard.SetX(xNormal);
  183. mcAxii.SetX(xNormal);
  184. mcIgni.SetX(xNormal);
  185. mcQuen.SetX(xNormal);
  186. mcYrden.SetX(xNormal);
  187.  
  188. if(slot == "Aard"){
  189. mcAard.SetXScale(scaleUp);
  190. mcAard.SetYScale(scaleUp);
  191. mcAard.SetX(xOffset);
  192. }else if(slot == "Axii"){
  193. mcAxii.SetXScale(scaleUp);
  194. mcAxii.SetYScale(scaleUp);
  195. mcAxii.SetX(xOffset);
  196. }else if(slot == "Igni"){
  197. mcIgni.SetXScale(scaleUp);
  198. mcIgni.SetYScale(scaleUp);
  199. mcIgni.SetX(xOffset);
  200. }else if(slot == "Quen"){
  201. mcQuen.SetXScale(scaleUp);
  202. mcQuen.SetYScale(scaleUp);
  203. mcQuen.SetX(xOffset);
  204. }else if(slot == "Yrden"){
  205. mcYrden.SetXScale(scaleUp);
  206. mcYrden.SetYScale(scaleUp);
  207. mcYrden.SetX(xOffset);
  208. }else if(slot == "Slot1"){
  209. slot1.SetXScale(scaleUp);
  210. slot1.SetYScale(scaleUp);
  211. }else if(slot == "Slot2"){
  212. slot2.SetXScale(scaleUp);
  213. slot2.SetYScale(scaleUp);
  214. }else if(slot == "Crossbow"){
  215. crossbow.SetXScale(scaleUp);
  216. crossbow.SetYScale(scaleUp);
  217. }else if(slot == "Slot3"){
  218. slot4.SetXScale(scaleUp);
  219. slot4.SetYScale(scaleUp);
  220. }else if(slot == "Slot4"){
  221. slot5.SetXScale(scaleUp);
  222. slot5.SetYScale(scaleUp);
  223. }
  224.  
  225. player = GetWitcherPlayer();
  226. inv = player.GetInventory();
  227.  
  228. if(slot == "Slot1"){
  229. player.GetItemEquippedOnSlot( EES_Petard1, equippedItem );
  230. itemName = GetLocStringByKeyExt( inv.GetItemLocalizedNameByUniqueID( equippedItem ) );
  231. }else if(slot == "Slot2"){
  232. player.GetItemEquippedOnSlot( EES_Petard2, equippedItem );
  233. itemName = GetLocStringByKeyExt( inv.GetItemLocalizedNameByUniqueID( equippedItem ) );
  234. }else if(slot == "Slot3"){
  235. player.GetItemEquippedOnSlot( EES_Quickslot1, equippedItem );
  236. itemName = GetLocStringByKeyExt( inv.GetItemLocalizedNameByUniqueID( equippedItem ) );
  237. }else if(slot == "Slot4"){
  238. player.GetItemEquippedOnSlot( EES_Quickslot2, equippedItem );
  239. itemName = GetLocStringByKeyExt( inv.GetItemLocalizedNameByUniqueID( equippedItem ) );
  240. }else{
  241. itemName = slot;
  242. }
  243.  
  244.  
  245. if(!thePlayer.IsCiri())
  246. {
  247. if (itemName == "")
  248. mcNameLine.SetVisible(false);
  249. else
  250. mcNameLine.SetVisible(true);
  251.  
  252. flashModule.GetChildFlashTextField("textField").SetTextHtml( StrUpper(itemName) );
  253. }
  254. }
  255.  
  256. event OnRadialMenuItemSelected(choosenSymbol : string, isDesaturated : bool )
  257. {
  258. // ---=== modE3 ===---
  259. SetItemScalePositions(choosenSymbol);
  260. // ---=== modE3 ===---
  261.  
  262. m_isDesaturated = isDesaturated;
  263. if( !m_isDesaturated )
  264. {
  265. _currentSelection = choosenSymbol;
  266. }
  267. else
  268. {
  269. _currentSelection = "";
  270. }
  271. if ( !theGame.IsBlackscreen() )
  272. {
  273. theSound.SoundEvent( "gui_ingame_wheel_highlight" );
  274. }
  275. else
  276. {
  277. //LogChannel( 'IgnoredSounds', "HUD: gui_ingame_wheel_highlight" );
  278. }
  279. }
  280.  
  281. event OnRadialMenuItemChoose( choosenSymbol : string )
  282. {
  283.  
  284. }
  285.  
  286. event OnRadialMenuConfirmSelection( action : SInputAction )
  287. {
  288. if( IsPressed(action) )
  289. {
  290.  
  291. if (m_swappedAcceptCancel)
  292. {
  293. UserClose();
  294. }
  295. else
  296. {
  297. UserConfirmSelection();
  298. }
  299. }
  300. }
  301.  
  302. event OnRadialMenuClose( action : SInputAction )
  303. {
  304. if( IsPressed(action) )
  305. {
  306.  
  307. if (m_swappedAcceptCancel)
  308. {
  309. // ---=== modE3 ===---
  310. UserConfirmSelection();
  311. //OnSelectSlot();
  312. // ---=== modE3 ===---
  313. }
  314. else
  315. {
  316. UserClose();
  317. }
  318. }
  319. }
  320.  
  321. private function UserConfirmSelection():void
  322. {
  323. if( m_shown && !m_IsPlayerCiri)
  324. {
  325. if( _currentSelection != "" )
  326. {
  327. // -= WMK:modQuickSlots =-
  328. WmkGetQuickSlotsInstance().OnRadialMenuActivateSlot(_currentSelection, 0);
  329. HideRadialMenu();
  330. // -= WMK:modQuickSlots =-
  331. }
  332. else
  333. {
  334. theSound.SoundEvent( "gui_global_denied" );
  335. }
  336. }
  337. }
  338.  
  339. event OnActivateSlot(slotName:string)
  340. {
  341. var outKeys : array< EInputKey >;
  342. var player : W3PlayerWitcher;
  343. player = GetWitcherPlayer();
  344.  
  345. thePlayer.OnRadialMenuItemChoose(slotName);
  346. }
  347.  
  348. event OnRequestCloseRadial()
  349. {
  350. UserClose();
  351. }
  352.  
  353. private function UserClose():void
  354. {
  355. if( m_shown )
  356. {
  357. HideRadialMenu();
  358. }
  359. }
  360.  
  361. event OnOpenMeditation( action : SInputAction )
  362. {
  363. var witcher : W3PlayerWitcher;
  364.  
  365. if( !m_IsPlayerCiri && IsPressed(action) )
  366. {
  367. if( m_shown )
  368. {
  369. witcher = GetWitcherPlayer();
  370.  
  371. if(witcher.IsActionAllowed(EIAB_OpenMeditation))
  372. {
  373. HideRadialMenu();
  374. ResetMeditationSavedData();
  375. thePlayer.OnRadialMenuItemChoose("Meditation");
  376.  
  377.  
  378.  
  379. if(thePlayer.GetCurrentStateName() != 'Meditation')
  380. {
  381. thePlayer.DisplayActionDisallowedHudMessage(EIAB_OpenMeditation, , witcher.IsThreatened(), !witcher.CanMeditateHere(), witcher.IsThreatened());
  382. }
  383. else
  384. {
  385.  
  386. return true;
  387. }
  388. }
  389. else
  390. {
  391. thePlayer.DisplayActionDisallowedHudMessage(EIAB_OpenMeditation, , witcher.IsThreatened(), !witcher.CanMeditateHere(), witcher.IsThreatened());
  392. }
  393. }
  394. }
  395. }
  396.  
  397. function ResetMeditationSavedData()
  398. {
  399. var guiManager : CR4GuiManager;
  400.  
  401. guiManager = theGame.GetGuiManager();
  402. guiManager.RemoveUISavedData('MeditationClockMenu');
  403. }
  404.  
  405. event OnRadialMenu( action : SInputAction )
  406. {
  407. if( IsPressed(action) )
  408. {
  409. if( m_shown )
  410. {
  411.  
  412.  
  413. return true;
  414. }
  415. if(!thePlayer.IsActionAllowed(EIAB_RadialMenu))
  416. {
  417. thePlayer.DisplayActionDisallowedHudMessage(EIAB_RadialMenu);
  418. return false;
  419. }
  420.  
  421. if ( theGame.IsDialogOrCutscenePlaying() || theGame.IsBlackscreenOrFading() || (!thePlayer.GetBIsInputAllowed() && !GetWitcherPlayer().IsUITakeInput()) )
  422. return false;
  423.  
  424. // ---=== modE3 ===---
  425. if(thePlayer.IsCiri())
  426. {
  427. mcNameLine.SetVisible(false);
  428. mcSelection.SetVisible(false);
  429. }
  430. else
  431. {
  432. mcNameLine.SetVisible(true);
  433. mcSelection.SetVisible(true);
  434. }
  435. // ---=== modE3 ===---
  436.  
  437.  
  438. ShowRadialMenu();
  439. }
  440. }
  441. event OnRadialPauseGame()
  442. {
  443. theGame.Pause( "FastMenu" );
  444. }
  445. function ShowRadialMenu()
  446. {
  447. var camera : CCustomCamera;
  448. var hud : CR4ScriptedHud;
  449.  
  450. if( !m_shown && !theGame.IsDialogOrCutscenePlaying())
  451. {
  452.  
  453. thePlayer.RestoreBlockedSlots();
  454.  
  455.  
  456. theGame.CenterMouse();
  457.  
  458. theGame.ForceUIAnalog(true);
  459. theInput.StoreContext( 'RadialMenu' );
  460. theSound.SoundEvent( "gui_ingame_wheel_open" );
  461. if( thePlayer.IsCiri() != m_IsPlayerCiri || m_HasBlink != thePlayer.HasAbility('CiriBlink') || m_HasCharge != thePlayer.HasAbility('CiriCharge') )
  462. {
  463. m_IsPlayerCiri = thePlayer.IsCiri();
  464. m_HasBlink = thePlayer.HasAbility('CiriBlink');
  465. m_HasCharge = thePlayer.HasAbility('CiriCharge');
  466. m_fxSetCiriRadialSFF.InvokeSelfThreeArgs( FlashArgBool(m_IsPlayerCiri), FlashArgBool(m_HasBlink), FlashArgBool(m_HasCharge) );
  467. }
  468. thePlayer.BlockAction(EIAB_Jump,'RadialMenu');
  469.  
  470. UpdateItemsIcons();
  471.  
  472. theGame.SetTimeScale( 0.1, theGame.GetTimescaleSource(ETS_RadialMenu), theGame.GetTimescalePriority(ETS_RadialMenu), false, true);
  473. GetWitcherPlayer().SetUITakeInput(true);
  474.  
  475.  
  476. camera = (CCustomCamera)theCamera.GetTopmostCameraObject();
  477. m_allowAutoRotationReturnValue = camera.allowAutoRotation;
  478. camera.allowAutoRotation = false;
  479.  
  480.  
  481. m_shown = true;
  482. ResetItemsModule();
  483. theGame.GetGuiManager().SendCustomUIEvent( 'OpenedRadialMenu' );
  484. if(theGame.GetTutorialSystem() && theGame.GetTutorialSystem().IsRunning())
  485. {
  486. theGame.GetTutorialSystem().uiHandler.OnOpenedMenu('RadialMenu');
  487. }
  488. m_fxSetMeditationButtonEnabledSFF.InvokeSelfOneArg(FlashArgBool(GetWitcherPlayer().IsActionAllowed(EIAB_OpenMeditation)));
  489.  
  490.  
  491.  
  492. //LogChannel( 'GWINT_AI', "SHOW RADIAL");
  493. if (!m_tutorialsHidden)
  494. {
  495. theGame.GetGuiManager().HideTutorial( true, false );
  496. m_tutorialsHidden = true;
  497. }
  498.  
  499. UpdateBuffsModule( true );
  500.  
  501. hud = (CR4ScriptedHud)theGame.GetHud();
  502. if ( hud )
  503. {
  504. hud.OnRadialOpened();
  505. }
  506.  
  507. theGame.GetTutorialSystem().uiHandler.OnOpeningMenu( 'RadialMenu' );
  508.  
  509. // ---=== modE3 ===---
  510. SetItemScalePositions(_currentSelection);
  511. // ---=== modE3 ===---
  512. }
  513. }
  514.  
  515. private function SelectCurrentSign()
  516. {
  517. if (thePlayer.IsCiri() == m_IsPlayerCiri)
  518. {
  519. m_fxSetSelectedItem.InvokeSelfOneArg(FlashArgString(SignEnumToString(thePlayer.GetEquippedSign())));
  520. }
  521. }
  522.  
  523.  
  524. event OnHideRadialMenu()
  525. {
  526. //LogChannel( 'GWINT_AI', "HIDE RADIAL");
  527. if (m_tutorialsHidden)
  528. {
  529. theGame.GetGuiManager().HideTutorial( false, false );
  530. m_tutorialsHidden = false;
  531. }
  532. }
  533.  
  534. function HideRadialMenu()
  535. {
  536. var camera : CCustomCamera;
  537. var hud : CR4ScriptedHud;
  538.  
  539. if( m_shown )
  540. {
  541.  
  542. theGame.ForceUIAnalog(false);
  543. theSound.SoundEvent( "gui_ingame_wheel_close" );
  544.  
  545. theGame.RemoveTimeScale( theGame.GetTimescaleSource(ETS_RadialMenu) );
  546. theGame.Unpause( "FastMenu" );
  547. GetWitcherPlayer().SetUITakeInput(false);
  548.  
  549.  
  550. camera = (CCustomCamera)theCamera.GetTopmostCameraObject();
  551. camera.allowAutoRotation = m_allowAutoRotationReturnValue;
  552.  
  553. m_shown = false;
  554. theInput.RestoreContext( 'RadialMenu', true );
  555.  
  556. theGame.GetGuiManager().SendCustomUIEvent( 'ClosedRadialMenu' );
  557. ResetItemsModule();
  558. if(theGame.GetTutorialSystem() && theGame.GetTutorialSystem().IsRunning())
  559. {
  560. theGame.GetTutorialSystem().uiHandler.OnClosedMenu('RadialMenu');
  561. }
  562. thePlayer.UnblockAction( EIAB_Jump, 'RadialMenu' );
  563.  
  564. UpdateBuffsModule( false );
  565.  
  566. hud = (CR4ScriptedHud)theGame.GetHud();
  567. if ( hud )
  568. {
  569. hud.OnRadialClosed();
  570. }
  571.  
  572. theGame.GetTutorialSystem().uiHandler.OnClosingMenu( 'RadialMenu' );
  573. }
  574. }
  575.  
  576. private function UpdateBuffsModule( onRadialMenuOpened : bool )
  577. {
  578. var module : CR4HudModuleBase;
  579. var hud : CR4ScriptedHud;
  580.  
  581. hud = (CR4ScriptedHud)theGame.GetHud();
  582. if ( hud )
  583. {
  584. if ( onRadialMenuOpened )
  585. {
  586. module = (CR4HudModuleBase)hud.GetHudModule( "BuffsModule" );
  587. if (module)
  588. {
  589. module.SetEnabled( true );
  590. }
  591. }
  592. else
  593. {
  594. hud.UpdateHudConfig( 'BuffsModule', true );
  595. }
  596. }
  597. }
  598.  
  599. private function ResetItemsModule()
  600. {
  601. var itemInfoModule : CR4HudModuleItemInfo;
  602. itemInfoModule = (CR4HudModuleItemInfo)theGame.GetHud().GetHudModule("ItemInfoModule");
  603. itemInfoModule.ResetItems();
  604. }
  605.  
  606. function UpdateItemsIcons(optional updateBombsOnly : bool) // -= WMK:modQuickSlots =-
  607. {
  608. var i : int;
  609. var inv : CInventoryComponent;
  610. var player : W3PlayerWitcher;
  611. var outKeys : array< EInputKey >;
  612.  
  613. var itemName : string;
  614. var itemDescription : string;
  615. var itemPath : string;
  616. var itemCategory : name;
  617. var itemQuality : int;
  618.  
  619. var equippedItem : SItemUniqueId;
  620. var selectedItemId : SItemUniqueId;
  621.  
  622. var pocket1Slots : array <EEquipmentSlots>;
  623. var pocket2Slots : array <EEquipmentSlots>;
  624.  
  625. // ---=== modE3 ===---
  626. var pocket3Slots : array <EEquipmentSlots>;
  627. var pocket4Slots : array <EEquipmentSlots>;
  628. var _CurrentSelectedItem : SItemUniqueId;
  629. var item : SItemUniqueId;
  630. var flashModule : CScriptedFlashSprite;
  631. var selectedSignName : string;
  632. var selectedSignDescription : string;
  633. // ---=== modE3 ===---
  634.  
  635. var itemsDataList : CScriptedFlashArray;
  636.  
  637. player = GetWitcherPlayer();
  638. inv = thePlayer.GetInventory();
  639.  
  640. selectedItemId = GetWitcherPlayer().GetSelectedItemId();
  641.  
  642. if( m_IsPlayerCiri )
  643. {
  644. equippedItem = GetCiriItem();
  645.  
  646. if( inv.IsIdValid( equippedItem ) )
  647. {
  648. itemName = inv.GetItemName( equippedItem );
  649. itemName = GetLocStringByKeyExt( inv.GetItemLocalizedNameByUniqueID( equippedItem ) );
  650. itemDescription = GetLocStringByKeyExt( inv.GetItemLocalizedDescriptionByUniqueID( equippedItem ) );
  651. itemPath = inv.GetItemIconPathByUniqueID( equippedItem );
  652. }
  653.  
  654. m_fxSetCiriItemSFF.InvokeSelfThreeArgs( FlashArgString( itemPath ), FlashArgString( itemName ), FlashArgString( itemDescription ) );
  655. }
  656. else
  657. {
  658.  
  659.  
  660.  
  661.  
  662. itemsDataList = m_flashValueStorage.CreateTempFlashArray();
  663.  
  664. pocket1Slots.PushBack( EES_Petard1 );
  665. pocket2Slots.PushBack( EES_Petard2 ); // ---=== modE3 ===---
  666. pocket3Slots.PushBack( EES_Quickslot1 ); // ---=== modE3 ===---
  667. pocket4Slots.PushBack( EES_Quickslot2 ); // ---=== modE3 ===---
  668.  
  669. UpdateCrossbowItemData( 7, itemsDataList );
  670. if (!updateBombsOnly) {
  671. UpdatePocketItemData( 8, pocket2Slots, itemsDataList );
  672.  
  673. pocket1Slots.Clear();
  674. pocket1Slots.PushBack(EES_Petard1);
  675. UpdatePocketItemData(7, pocket1Slots, itemsDataList, 1);
  676. pocket1Slots.Clear();
  677. pocket1Slots.PushBack(EES_Petard2);
  678. UpdatePocketItemData(8, pocket1Slots, itemsDataList, 2);
  679. pocket1Slots.Clear();
  680. pocket1Slots.PushBack(EES_Petard3);
  681. UpdatePocketItemData(9, pocket1Slots, itemsDataList, 5);
  682. pocket1Slots.Clear();
  683. pocket1Slots.PushBack(EES_Petard4);
  684. UpdatePocketItemData(10, pocket1Slots, itemsDataList, 6);
  685.  
  686. m_flashValueStorage.SetFlashArray( "hud.radial.items", itemsDataList );
  687.  
  688. if (updateBombsOnly) {
  689. return;
  690. }
  691. // -= WMK:modQuickSlots =-
  692.  
  693.  
  694. outKeys.Clear();
  695. theInput.GetCurrentKeysForAction('CastSign',outKeys);
  696. m_fxUpdateFieldEquippedStateSFF.InvokeSelfFourArgs( FlashArgString( SignEnumToString(player.GetEquippedSign()) ), FlashArgString(""), FlashArgString(true), FlashArgInt(outKeys[0]));
  697.  
  698. // ---=== modE3 ===---
  699. flashModule = GetModuleFlash();
  700. selectedSignName = flashModule.GetChildFlashSprite("mcSignDescription").GetChildFlashTextField("textField").GetTextHtml();
  701. flashModule.GetChildFlashSprite("mcSignDescription").GetChildFlashTextField("textField").SetTextHtml( StrUpper(selectedSignName) );
  702.  
  703. _CurrentSelectedItem = player.GetSelectedItemId();
  704.  
  705. for( i = EES_Petard1; i < EES_Quickslot2+1; i += 1 )
  706. {
  707. player.GetItemEquippedOnSlot(i, item);
  708.  
  709. if( item == _CurrentSelectedItem )
  710. {
  711. if(i == EES_Petard1){
  712. itemName = "Slot1";
  713. }else if(i == EES_Petard2){
  714. itemName = "Slot2";
  715. }else if(i == EES_Quickslot1){
  716. itemName = "Slot3";
  717. }else if(i == EES_Quickslot2){
  718. itemName = "Slot4";
  719. }else if(i == EES_RangedWeapon){
  720. itemName = "Crossbow";
  721. }
  722.  
  723. itemDescription = GetLocStringByKeyExt(inv.GetItemLocalizedDescriptionByUniqueID(item));
  724.  
  725. if(itemDescription != ""){
  726. m_fxUpdateFieldEquippedStateSFF.InvokeSelfFourArgs( FlashArgString(itemName), FlashArgString(itemDescription), FlashArgBool(true) ,FlashArgInt(0));
  727. }
  728.  
  729. break;
  730. }
  731. }
  732. // ---=== modE3 ===---
  733. }
  734. }
  735.  
  736. event OnEquipBolt( boltItemId : SItemUniqueId )
  737. {
  738. var inv : CInventoryComponent;
  739. var equippedBolts : SItemUniqueId;
  740.  
  741. if ( boltItemId == GetInvalidUniqueId() )
  742. {
  743.  
  744. GetWitcherPlayer().GetItemEquippedOnSlot( EES_Bolt, equippedBolts );
  745. inv = GetWitcherPlayer().GetInventory();
  746. if ( inv.IsIdValid( equippedBolts ) && !inv.ItemHasTag( equippedBolts, theGame.params.TAG_INFINITE_AMMO ) )
  747. {
  748. GetWitcherPlayer().UnequipItemFromSlot( EES_Bolt, false );
  749. }
  750. }
  751. else if( thePlayer.inv.IsIdValid( boltItemId ) )
  752. {
  753. GetWitcherPlayer().EquipItem( boltItemId, EES_Bolt);
  754. thePlayer.SetUpdateQuickSlotItems(true);
  755. }
  756. }
  757.  
  758. private function UpdateCrossbowItemData( radialSlotId : int, out dataList : CScriptedFlashArray ) : void
  759. {
  760. var player : W3PlayerWitcher;
  761. var inv : CInventoryComponent;
  762. var boltsList : array<SItemUniqueId>;
  763. var currentBolt : SItemUniqueId;
  764. var equippedBolt : SItemUniqueId;
  765. var equippedItem : SItemUniqueId;
  766. var selectedItem : SItemUniqueId;
  767. var itemsList : CScriptedFlashArray;
  768. var itemDataObject : CScriptedFlashObject;
  769. var containerObject : CScriptedFlashObject;
  770.  
  771. var slotName : string;
  772. var itemCategory : string;
  773. var itemName : string;
  774. var itemDescription : string;
  775. var itemIconPath : string;
  776.  
  777. var itemCat : name;
  778. var itemQuality : int;
  779. var itemQuantity : int;
  780. var chargesCount : int;
  781. var i, count : int;
  782. var playerLevel : int;
  783.  
  784. var dm : CDefinitionsManagerAccessor;
  785.  
  786. var infiniteBoltItemName : name;
  787.  
  788. playerLevel = thePlayer.GetLevel();
  789. player = GetWitcherPlayer();
  790. inv = player.GetInventory();
  791. infiniteBoltItemName = player.GetCurrentInfiniteBoltName();
  792.  
  793. selectedItem = GetWitcherPlayer().GetSelectedItemId();
  794.  
  795. itemsList = m_flashValueStorage.CreateTempFlashArray();
  796. containerObject = m_flashValueStorage.CreateTempFlashObject();
  797.  
  798.  
  799. slotName = "Crossbow";
  800. containerObject.SetMemberFlashInt( "slotId", radialSlotId );
  801. containerObject.SetMemberFlashString( "slotName", slotName );
  802.  
  803. player.GetItemEquippedOnSlot( EES_RangedWeapon, equippedItem );
  804. player.GetItemEquippedOnSlot( EES_Bolt, equippedBolt );
  805.  
  806. if( inv.IsIdValid( equippedItem ) )
  807. {
  808.  
  809.  
  810. itemName = GetLocStringByKeyExt( inv.GetItemLocalizedNameByUniqueID( equippedItem ) );
  811. itemDescription = GetLocStringByKeyExt( inv.GetItemLocalizedDescriptionByUniqueID( equippedItem ) );
  812. itemCategory = inv.GetItemCategory( equippedItem );
  813. itemQuality = inv.GetItemQuality( equippedItem );
  814. itemIconPath = inv.GetItemIconPathByUniqueID( equippedItem );
  815.  
  816. containerObject.SetMemberFlashString( "name", itemName );
  817. containerObject.SetMemberFlashString( "description", itemDescription );
  818. containerObject.SetMemberFlashString( "category", itemCategory );
  819. containerObject.SetMemberFlashString( "itemIconPath", itemIconPath );
  820. containerObject.SetMemberFlashInt( "quality", itemQuality );
  821. containerObject.SetMemberFlashBool( "isEquipped", selectedItem == equippedItem );
  822. containerObject.SetMemberFlashInt( "charges", -1 ); // -= WMK:modQuickSlots =-
  823.  
  824.  
  825.  
  826. boltsList = inv.GetItemsByCategory('bolt');
  827. count = boltsList.Size();
  828.  
  829.  
  830. dm = theGame.GetDefinitionsManager();
  831. itemName = GetLocStringByKeyExt( dm.GetItemLocalisationKeyName( infiniteBoltItemName ) );
  832. itemDescription = GetLocStringByKeyExt( dm.GetItemLocalisationKeyDesc( infiniteBoltItemName ) );
  833. itemIconPath = "img://" + dm.GetItemIconPath( infiniteBoltItemName );
  834. inv.GetItemId( infiniteBoltItemName );
  835.  
  836. if ( StrLen( itemName ) )
  837. {
  838. itemDataObject = m_flashValueStorage.CreateTempFlashObject();
  839.  
  840. itemDataObject.SetMemberFlashString( "name", itemName );
  841. itemDataObject.SetMemberFlashString( "description", itemDescription );
  842. itemDataObject.SetMemberFlashString( "itemIconPath", itemIconPath );
  843. itemDataObject.SetMemberFlashBool( "isEquipped", true );
  844. itemDataObject.SetMemberFlashInt( "charges", -1 );
  845. itemDataObject.SetMemberFlashInt( "id", 0 );
  846.  
  847. itemsList.PushBackFlashObject( itemDataObject );
  848. }
  849.  
  850. if ( !GetWitcherPlayer().ShouldUseInfiniteWaterBolts() )
  851. {
  852.  
  853. for ( i = 0; i < count; i += 1 )
  854. {
  855. currentBolt = boltsList[ i ];
  856.  
  857. if ( inv.GetItemLevel( currentBolt ) <= playerLevel )
  858. {
  859. if ( inv.GetItemName( currentBolt ) == infiniteBoltItemName )
  860. {
  861.  
  862. continue;
  863. }
  864. itemDataObject = m_flashValueStorage.CreateTempFlashObject();
  865. itemName = GetLocStringByKeyExt( inv.GetItemLocalizedNameByUniqueID( currentBolt ) );
  866. itemDescription = GetLocStringByKeyExt( inv.GetItemLocalizedDescriptionByUniqueID( currentBolt ) );
  867. itemCategory = inv.GetItemCategory( currentBolt );
  868. itemQuality = inv.GetItemQuality( currentBolt );
  869. itemIconPath = "img://" + inv.GetItemIconPathByUniqueID( currentBolt );
  870.  
  871. if( inv.ItemHasTag( currentBolt, theGame.params.TAG_INFINITE_AMMO ) )
  872. {
  873. chargesCount = -1;
  874. }
  875. else
  876. {
  877. chargesCount = inv.GetItemQuantity( currentBolt );
  878. }
  879.  
  880. itemDataObject.SetMemberFlashString( "name", itemName );
  881. itemDataObject.SetMemberFlashString( "description", itemDescription );
  882. itemDataObject.SetMemberFlashString( "itemIconPath", itemIconPath );
  883. itemDataObject.SetMemberFlashBool( "isEquipped", currentBolt == equippedBolt );
  884. itemDataObject.SetMemberFlashInt( "charges", chargesCount );
  885. itemDataObject.SetMemberFlashInt( "id", ItemToFlashUInt( currentBolt ) );
  886.  
  887. itemsList.PushBackFlashObject( itemDataObject );
  888. }
  889. }
  890.  
  891. }
  892.  
  893. containerObject.SetMemberFlashArray( "itemsList", itemsList );
  894. }
  895. else
  896. {
  897. containerObject.SetMemberFlashBool( "isEmpty", true );
  898. }
  899.  
  900. dataList.PushBackFlashObject( containerObject );
  901. }
  902.  
  903. private function UpdatePocketItemData( radialSlotId : int, slotsList : array <EEquipmentSlots>, out dataList : CScriptedFlashArray, startOffset : int ) : void // -= WMK:modQuickSlots =-
  904. {
  905. var player : W3PlayerWitcher;
  906. var inv : CInventoryComponent;
  907. var equippedItem : SItemUniqueId;
  908. var selectedItem : SItemUniqueId;
  909. var itemsList : CScriptedFlashArray;
  910. var itemDataObject : CScriptedFlashObject;
  911. var containerObject : CScriptedFlashObject;
  912.  
  913. var itemCategory : string;
  914. var slotName : string;
  915. var itemName : string;
  916. var itemDescription : string;
  917. var itemIconPath : string;
  918.  
  919. var itemCat : name;
  920. var itemQuality : int;
  921. var itemQuantity : int;
  922. var chargesCount : int;
  923. var i, count : int;
  924.  
  925. player = GetWitcherPlayer();
  926. inv = player.GetInventory();
  927. count = slotsList.Size();
  928. selectedItem = GetWitcherPlayer().GetSelectedItemId();
  929.  
  930. itemsList = m_flashValueStorage.CreateTempFlashArray();
  931. containerObject = m_flashValueStorage.CreateTempFlashObject();
  932. slotName = "Slot" + ( startOffset ); // -= WMK:modQuickSlots =-
  933. containerObject.SetMemberFlashInt( "slotId", radialSlotId );
  934. containerObject.SetMemberFlashBool( "isPocketData", true );
  935. containerObject.SetMemberFlashString( "slotName", slotName );
  936.  
  937. for ( i = 0; i < count; i += 1 )
  938. {
  939. itemDataObject = m_flashValueStorage.CreateTempFlashObject();
  940.  
  941. // ---=== modE3 ===---
  942. if(radialSlotId == 9){
  943. slotName = "Slot3";
  944. }else if(radialSlotId == 10){
  945. slotName = "Slot4";
  946. }else{
  947. slotName = "Slot" + ( radialSlotId - 5 + i );
  948. }
  949. // ---=== modE3 ===---
  950.  
  951. itemDataObject.SetMemberFlashString( "slotName", slotName );
  952. player.GetItemEquippedOnSlot( slotsList[i], equippedItem );
  953.  
  954. if( inv.IsIdValid( equippedItem ) )
  955. {
  956. itemName = GetLocStringByKeyExt( inv.GetItemLocalizedNameByUniqueID( equippedItem ) );
  957. itemDescription = GetLocStringByKeyExt( inv.GetItemLocalizedDescriptionByUniqueID( equippedItem ) );
  958. itemCategory = inv.GetItemCategory( equippedItem );
  959. itemQuality = inv.GetItemQuality( equippedItem );
  960. itemIconPath = inv.GetItemIconPathByUniqueID( equippedItem );
  961.  
  962. itemDataObject.SetMemberFlashString( "name", itemName );
  963. itemDataObject.SetMemberFlashString( "description", itemDescription );
  964. itemDataObject.SetMemberFlashString( "category", itemCategory );
  965. itemDataObject.SetMemberFlashString( "itemIconPath", itemIconPath );
  966. itemDataObject.SetMemberFlashInt( "quality", itemQuality );
  967. itemDataObject.SetMemberFlashBool( "isEquipped", selectedItem == equippedItem );
  968.  
  969. if( inv.IsItemSingletonItem( equippedItem ) && inv.SingletonItemGetMaxAmmo( equippedItem ) > 0 )
  970. {
  971. chargesCount = thePlayer.inv.SingletonItemGetAmmo( equippedItem );
  972. }
  973. else
  974. {
  975. chargesCount = -1;
  976. }
  977.  
  978. itemDataObject.SetMemberFlashInt( "charges", chargesCount );
  979.  
  980.  
  981. itemsList.PushBackFlashObject( itemDataObject );
  982. }
  983. }
  984.  
  985. containerObject.SetMemberFlashArray( "itemsList", itemsList );
  986. dataList.PushBackFlashObject( containerObject );
  987. }
  988.  
  989. private function UpdateItemIconByIdx( i : int, slotId : EEquipmentSlots ) : void
  990. {
  991. var inv : CInventoryComponent;
  992. var item : SItemUniqueId;
  993. var player : W3PlayerWitcher;
  994. var itemName : string;
  995. var itemDescription : string;
  996. var itemPath : string;
  997. var itemCategory : name;
  998. var itemQuality: int;
  999. var _CurrentSelectedItem : SItemUniqueId;
  1000.  
  1001. player = GetWitcherPlayer();
  1002. inv = player.GetInventory();
  1003.  
  1004. player.GetItemEquippedOnSlot(slotId, item);
  1005. _CurrentSelectedItem = GetWitcherPlayer().GetSelectedItemId();
  1006.  
  1007. if( inv.IsIdValid(item) )
  1008. {
  1009. itemName = GetLocStringByKeyExt(inv.GetItemLocalizedNameByUniqueID(item));
  1010. itemDescription = GetLocStringByKeyExt(inv.GetItemLocalizedDescriptionByUniqueID(item));
  1011. itemCategory = inv.GetItemCategory (item);
  1012. itemQuality = inv.GetItemQuality(item);
  1013. itemPath = inv.GetItemIconPathByUniqueID(item);
  1014.  
  1015. m_fxUpdateItemIconSFF.InvokeSelfSixArgs( FlashArgInt( i ), FlashArgString( itemPath ), FlashArgString( itemName ), FlashArgString( itemCategory ), FlashArgString( itemDescription ) , FlashArgInt( itemQuality ) );
  1016.  
  1017. itemName = "Slot" + ( i - 5 );
  1018.  
  1019.  
  1020. if( item == _CurrentSelectedItem )
  1021. {
  1022. if( inv.IsIdValid(_CurrentSelectedItem) )
  1023. {
  1024. m_fxUpdateFieldEquippedStateSFF.InvokeSelfFourArgs( FlashArgString(itemName), FlashArgString(itemDescription), FlashArgBool(true) ,FlashArgInt(0));
  1025. }
  1026. }
  1027. else
  1028. {
  1029. m_fxUpdateFieldEquippedStateSFF.InvokeSelfFourArgs( FlashArgString(itemName), FlashArgString(itemDescription), FlashArgBool(false), FlashArgInt(0) );
  1030. }
  1031.  
  1032. }
  1033. else
  1034. {
  1035. m_fxUpdateItemIconSFF.InvokeSelfSixArgs( FlashArgInt(i),FlashArgString(""),FlashArgString(""), FlashArgString(""), FlashArgString(""), FlashArgString("") );
  1036. }
  1037. }
  1038.  
  1039. function GetCiriItem() : SItemUniqueId
  1040. {
  1041. var ret : array<SItemUniqueId>;
  1042.  
  1043. ret = thePlayer.GetInventory().GetItemsByName('q403_ciri_meteor');
  1044.  
  1045. return ret[0];
  1046. }
  1047.  
  1048. public function SetDesaturated( value : bool, fieldName : string )
  1049. {
  1050.  
  1051.  
  1052.  
  1053.  
  1054.  
  1055.  
  1056. m_fxSetDesaturatedSFF.InvokeSelfTwoArgs(FlashArgBool(value),FlashArgString(fieldName));
  1057. }
  1058.  
  1059. protected function UpdateScale( scale : float, flashModule : CScriptedFlashSprite ) : bool
  1060. {
  1061. return false;
  1062. }
  1063. }
  1064.  
  1065. exec function srfdes( value : bool, fieldName : string )
  1066. {
  1067. var hud : CR4ScriptedHud;
  1068. var module : CR4HudModuleRadialMenu;
  1069.  
  1070. hud = (CR4ScriptedHud)theGame.GetHud();
  1071. module = (CR4HudModuleRadialMenu)hud.GetHudModule("RadialMenuModule");
  1072. module.SetDesaturated( value, fieldName );
  1073. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement