Staaxie

Error [mod0000_mergedfiles]game\player\playerinput.ws(4001): Found unexpected '}'

Sep 7th, 2022
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 101.45 KB | Source Code | 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. class CPlayerInput
  10. {
  11. // W3EE - Begin
  12. private const var KEY_HOLD_WINDOW : float; default KEY_HOLD_WINDOW = 0.4;
  13. private var controllerQuickInventoryHandled : bool;
  14. // W3EE - End
  15.  
  16. private saved var actionLocks : array<array<SInputActionLock>>;
  17.  
  18.  
  19. private var totalCameraPresetChange : float; default totalCameraPresetChange = 0.0f;
  20. private var potAction : SInputAction;
  21. private var potPress : bool;
  22. private var debugBlockSourceName : name; default debugBlockSourceName = 'PLAYER';
  23. private var holdFastMenuInvoked : bool; default holdFastMenuInvoked = false;
  24. private var potionUpperHeld, potionLowerHeld : bool;
  25. private var potionModeHold : bool;
  26.  
  27.  
  28. default potionModeHold = true;
  29.  
  30. public function Initialize(isFromLoad : bool, optional previousInput : CPlayerInput)
  31. {
  32. var missingLocksCount, i : int;
  33. var dummy : array<SInputActionLock>;
  34.  
  35. if(previousInput)
  36. {
  37. actionLocks = previousInput.actionLocks;
  38. }
  39. else
  40. {
  41. if(!isFromLoad)
  42. {
  43. actionLocks.Grow(EnumGetMax('EInputActionBlock')+1);
  44. }
  45. else
  46. {
  47. missingLocksCount = EnumGetMax('EInputActionBlock') + 1 - actionLocks.Size();
  48. for ( i = 0; i < missingLocksCount; i += 1 )
  49. {
  50. actionLocks.PushBack( dummy );
  51. }
  52. }
  53. }
  54.  
  55.  
  56. theInput.RegisterListener( this, 'OnCommSprint', 'Sprint' );
  57. theInput.RegisterListener( this, 'OnCommSprintToggle', 'SprintToggle' );
  58. theInput.RegisterListener( this, 'OnCommWalkToggle', 'WalkToggle' );
  59. theInput.RegisterListener( this, 'OnCommGuard', 'Guard' );
  60.  
  61.  
  62. theInput.RegisterListener( this, 'OnCommSpawnHorse', 'SpawnHorse' );
  63.  
  64.  
  65.  
  66. theInput.RegisterListener( this, 'OnCommDrinkPotion1', 'DrinkPotion1' );
  67. theInput.RegisterListener( this, 'OnCommDrinkPotion2', 'DrinkPotion2' );
  68. theInput.RegisterListener( this, 'OnCommDrinkPotion3', 'DrinkPotion3' );
  69. theInput.RegisterListener( this, 'OnCommDrinkPotion4', 'DrinkPotion4' );
  70. theInput.RegisterListener( this, 'OnCommDrinkpotionUpperHeld', 'DrinkPotionUpperHold' );
  71. theInput.RegisterListener( this, 'OnCommDrinkpotionLowerHeld', 'DrinkPotionLowerHold' );
  72.  
  73.  
  74. theInput.RegisterListener( this, 'OnCommSteelSword', 'SteelSword' );
  75. theInput.RegisterListener( this, 'OnCommSilverSword', 'SilverSword' );
  76. theInput.RegisterListener( this, 'OnCommSheatheAny', 'SwordSheathe' );
  77. theInput.RegisterListener( this, 'OnCommSheatheSilver', 'SwordSheatheSilver' );
  78. theInput.RegisterListener( this, 'OnCommSheatheSteel', 'SwordSheatheSteel' );
  79.  
  80. theInput.RegisterListener( this, 'OnToggleSigns', 'ToggleSigns' );
  81. theInput.RegisterListener( this, 'OnSelectSign', 'SelectAard' );
  82. theInput.RegisterListener( this, 'OnSelectSign', 'SelectYrden' );
  83. theInput.RegisterListener( this, 'OnSelectSign', 'SelectIgni' );
  84. theInput.RegisterListener( this, 'OnSelectSign', 'SelectQuen' );
  85. theInput.RegisterListener( this, 'OnSelectSign', 'SelectAxii' );
  86.  
  87.  
  88.  
  89. theInput.RegisterListener( this, 'OnCommDeckEditor', 'PanelGwintDeckEditor' );
  90. theInput.RegisterListener( this, 'OnCommMenuHub', 'HubMenu' );
  91. theInput.RegisterListener( this, 'OnCommPanelInv', 'PanelInv' );
  92. theInput.RegisterListener( this, 'OnCommHoldFastMenu', 'HoldFastMenu' );
  93. theInput.RegisterListener( this, 'OnCommPanelChar', 'PanelChar' );
  94. theInput.RegisterListener( this, 'OnCommPanelMed', 'PanelMed' );
  95. theInput.RegisterListener( this, 'OnCommPanelMap', 'PanelMap' );
  96. theInput.RegisterListener( this, 'OnCommPanelMapPC', 'PanelMapPC' );
  97. theInput.RegisterListener( this, 'OnCommPanelJour', 'PanelJour' );
  98. theInput.RegisterListener( this, 'OnCommPanelAlch', 'PanelAlch' );
  99. theInput.RegisterListener( this, 'OnCommPanelGlossary', 'PanelGlossary' );
  100. theInput.RegisterListener( this, 'OnCommPanelBooks', 'PanelBooks' );//===modWitcherLoreCollection===
  101. theInput.RegisterListener( this, 'OnCommPanelBestiary', 'PanelBestiary' );
  102. theInput.RegisterListener( this, 'OnCommPanelMeditation', 'PanelMeditation' );
  103. theInput.RegisterListener( this, 'OnCommPanelCrafting', 'PanelCrafting' );
  104. theInput.RegisterListener( this, 'OnShowControlsHelp', 'ControlsHelp' );
  105. theInput.RegisterListener( this, 'OnCommPanelUIResize', 'PanelUIResize' );
  106.  
  107. theInput.RegisterListener( this, 'OnCastSign', 'CastSign' );
  108. theInput.RegisterListener( this, 'OnExpFocus', 'Focus' );
  109. theInput.RegisterListener( this, 'OnExpMedallion', 'Medallion' );
  110.  
  111.  
  112. theInput.RegisterListener( this, 'OnBoatDismount', 'BoatDismount' );
  113.  
  114. theInput.RegisterListener( this, 'OnDiving', 'DiveDown' );
  115. theInput.RegisterListener( this, 'OnDiving', 'DiveUp' );
  116. theInput.RegisterListener( this, 'OnDivingDodge', 'DiveDodge' );
  117.  
  118.  
  119. theInput.RegisterListener( this, 'OnCbtSpecialAttackWithAlternateLight', 'SpecialAttackWithAlternateLight' );
  120. theInput.RegisterListener( this, 'OnCbtSpecialAttackWithAlternateHeavy', 'SpecialAttackWithAlternateHeavy' );
  121. theInput.RegisterListener( this, 'OnCbtAttackWithAlternateLight', 'AttackWithAlternateLight' );
  122. theInput.RegisterListener( this, 'OnCbtAttackWithAlternateHeavy', 'AttackWithAlternateHeavy' );
  123.  
  124. theInput.RegisterListener( this, 'OnCbtAttackLight', 'AttackLight' );
  125. theInput.RegisterListener( this, 'OnCbtAttackHeavy', 'AttackHeavy' );
  126. theInput.RegisterListener( this, 'OnCbtSpecialAttackLight', 'SpecialAttackLight' );
  127. theInput.RegisterListener( this, 'OnCbtSpecialAttackHeavy', 'SpecialAttackHeavy' );
  128. theInput.RegisterListener( this, 'OnCbtDodge', 'Dodge' );
  129. theInput.RegisterListener( this, 'OnCbtRoll', 'CbtRoll' );
  130. /*theInput.RegisterListener( this, 'OnMovementDoubleTap', 'MovementDoubleTapW' );
  131. theInput.RegisterListener( this, 'OnMovementDoubleTap', 'MovementDoubleTapS' );
  132. theInput.RegisterListener( this, 'OnMovementDoubleTap', 'MovementDoubleTapA' );
  133. theInput.RegisterListener( this, 'OnMovementDoubleTap', 'MovementDoubleTapD' );*/
  134. theInput.RegisterListener( this, 'OnCbtLockAndGuard', 'LockAndGuard' );
  135. theInput.RegisterListener( this, 'OnCbtCameraLockOrSpawnHorse', 'CameraLockOrSpawnHorse' );
  136. theInput.RegisterListener( this, 'OnCbtCameraLock', 'CameraLock' );
  137. theInput.RegisterListener( this, 'OnCbtComboDigitLeft', 'ComboDigitLeft' );
  138. theInput.RegisterListener( this, 'OnCbtComboDigitRight', 'ComboDigitRight' );
  139.  
  140.  
  141.  
  142. theInput.RegisterListener( this, 'OnCbtCiriSpecialAttack', 'CiriSpecialAttack' );
  143. theInput.RegisterListener( this, 'OnCbtCiriAttackHeavy', 'CiriAttackHeavy' );
  144. theInput.RegisterListener( this, 'OnCbtCiriSpecialAttackHeavy', 'CiriSpecialAttackHeavy' );
  145. theInput.RegisterListener( this, 'OnCbtCiriDodge', 'CiriDodge' );
  146. theInput.RegisterListener( this, 'OnCbtCiriDash', 'CiriDash' );
  147.  
  148.  
  149. theInput.RegisterListener( this, 'OnCbtThrowItem', 'ThrowItem' );
  150. theInput.RegisterListener( this, 'OnCbtThrowItemHold', 'ThrowItemHold' );
  151. theInput.RegisterListener( this, 'OnCbtThrowCastAbort', 'ThrowCastAbort' );
  152.  
  153.  
  154. theInput.RegisterListener( this, 'OnCiriDrawWeapon', 'CiriDrawWeapon' );
  155. theInput.RegisterListener( this, 'OnCiriDrawWeapon', 'CiriDrawWeaponAlternative' );
  156. theInput.RegisterListener( this, 'OnCiriHolsterWeapon', 'CiriHolsterWeapon' );
  157.  
  158.  
  159. if( !theGame.IsFinalBuild() )
  160. {
  161. theInput.RegisterListener( this, 'OnDbgSpeedUp', 'Debug_SpeedUp' );
  162. theInput.RegisterListener( this, 'OnDbgHit', 'Debug_Hit' );
  163. theInput.RegisterListener( this, 'OnDbgKillTarget', 'Debug_KillTarget' );
  164. theInput.RegisterListener( this, 'OnDbgKillAll', 'Debug_KillAllEnemies' );
  165. theInput.RegisterListener( this, 'OnDbgKillAllTargetingPlayer', 'Debug_KillAllTargetingPlayer' );
  166. theInput.RegisterListener( this, 'OnCommPanelFakeHud', 'PanelFakeHud' );
  167. theInput.RegisterListener( this, 'OnDbgTeleportToPin', 'Debug_TeleportToPin' );
  168. }
  169.  
  170.  
  171. theInput.RegisterListener( this, 'OnChangeCameraPreset', 'CameraPreset' );
  172. theInput.RegisterListener( this, 'OnChangeCameraPresetByMouseWheel', 'CameraPresetByMouseWheel' );
  173. theInput.RegisterListener( this, 'OnMeditationAbort', 'MeditationAbort');
  174.  
  175. theInput.RegisterListener( this, 'OnFastMenu', 'FastMenu' );
  176. theInput.RegisterListener( this, 'OnIngameMenu', 'IngameMenu' );
  177.  
  178. theInput.RegisterListener( this, 'OnToggleHud', 'ToggleHud' );
  179.  
  180. // W3EE - Begin
  181. theInput.RegisterListener( this, 'OnGodInput', 'GodInput' );
  182. theInput.RegisterListener( this, 'OnHealInput', 'HealInput' );
  183. theInput.RegisterListener( this, 'OnKillInput', 'KillInput' );
  184. theInput.RegisterListener( this, 'OnCycleUp', 'CountGroupUp' );
  185. theInput.RegisterListener( this, 'OnCycleDown', 'CountGroupDown' );
  186. theInput.RegisterListener( this, 'OnCycleForward', 'CountTypeForw');
  187. theInput.RegisterListener( this, 'OnCycleBackward', 'CountTypeBack');
  188. theInput.RegisterListener( this, 'OnAccessHorseStash', 'OpenStash');
  189. theInput.RegisterListener( this, 'OnQuickLoad', 'QuickLoad' );
  190. theInput.RegisterListener( this, 'OnCbtJump', 'Jump' );
  191. theInput.RegisterListener( this, 'OnHerbGather', 'GatherHerbsHorse' );
  192. theInput.RegisterListener( this, 'OnControllerSignCast', 'ModifierAard' );
  193. theInput.RegisterListener( this, 'OnControllerSignCast', 'ModifierIgni' );
  194. theInput.RegisterListener( this, 'OnControllerSignCast', 'ModifierYrden' );
  195. theInput.RegisterListener( this, 'OnControllerSignCast', 'ModifierQuen' );
  196. theInput.RegisterListener( this, 'OnControllerSignCast', 'ModifierAxii' );
  197. theInput.RegisterListener( this, 'OnMovementSpeedChange', 'MovementSpdChange' );
  198. //theInput.RegisterListener( this, 'OnSwitchHardLock', 'SwitchHardLock' );
  199. // W3EE - End
  200.  
  201. //---=== modFriendlyHUD ===---
  202. theInput.RegisterListener( this, 'On3DMarkersToggle', 'Toggle3DMarkers' );
  203. theInput.RegisterListener( this, 'OnHUDToggle', 'HUDToggle' );
  204. theInput.RegisterListener( this, 'OnPauseGameToggle', 'PauseGameToggle' );
  205. theInput.RegisterListener( this, 'OnSwitchCrossbow', 'SwitchCrossbow' );
  206. theInput.RegisterListener( this, 'OnPinModuleModfier', 'PinModuleModfier' );
  207. theInput.RegisterListener( this, 'OnToggleEssentials', 'ToggleEssentials' );
  208. theInput.RegisterListener( this, 'OnHoldToSeeHub', 'HoldToSeeEssentials' );
  209. theInput.RegisterListener( this, 'OnHoldToSeeChar', 'HoldToSeeCharStats' );
  210. theInput.RegisterListener( this, 'OnHoldToSeeMapPC', 'HoldToSeeMap' );
  211. theInput.RegisterListener( this, 'OnHoldToSeeJour', 'HoldToSeeQuests' );
  212. //---=== modFriendlyHUD ===---
  213. }
  214.  
  215.  
  216. // W3EE - Begin
  217. event OnQuickLoad( action : SInputAction )
  218. {
  219. var saves : array<SSavegameInfo>;
  220. var i : int;
  221.  
  222. if( IsReleased(action) )
  223. {
  224. theGame.ListSavedGames(saves);
  225. for (i=0; i<saves.Size(); i+=1)
  226. {
  227. if( saves[i].slotType == SGT_QuickSave )
  228. {
  229. theGame.LoadGameInit(saves[i]);
  230. break;
  231. }
  232. }
  233. }
  234. }
  235.  
  236. event OnCbtJump( action : SInputAction )
  237. {
  238. if( IsPressed(action) && thePlayer.IsInCombat() && theInput.IsActionPressed('Sprint') )
  239. thePlayer.substateManager.QueueStateExternal('Jump');
  240. }
  241.  
  242. event OnHerbGather( action : SInputAction )
  243. {
  244. if( IsPressed(action) )
  245. Equipment().GatherHerbs();
  246. }
  247.  
  248. event OnControllerSignCast( action : SInputAction )
  249. {
  250. if( IsPressed(action) && theInput.IsActionPressed('ControllerCastModifier') )
  251. {
  252. switch(action.aName)
  253. {
  254. case 'ModifierAard': GetWitcherPlayer().SetEquippedSign(ST_Aard); break;
  255. case 'ModifierIgni': GetWitcherPlayer().SetEquippedSign(ST_Igni); break;
  256. case 'ModifierYrden': GetWitcherPlayer().SetEquippedSign(ST_Yrden); break;
  257. case 'ModifierQuen': GetWitcherPlayer().SetEquippedSign(ST_Quen); break;
  258. case 'ModifierAxii': GetWitcherPlayer().SetEquippedSign(ST_Axii); break;
  259. }
  260. GetWitcherPlayer().GetTimeStampSign();
  261. OnCastSign(action);
  262. }
  263.  
  264. if( IsReleased(action) )
  265. {
  266. GetWitcherPlayer().ResetCastInput();
  267. }
  268. }
  269.  
  270. private saved var movementSpeed : float; default movementSpeed = 0.9f;
  271. public function GetMovementSpeed() : float
  272. {
  273. if( GetWitcherPlayer().IsWounded() )
  274. movementSpeed = ClampF(movementSpeed, 0.f, 0.79f);
  275.  
  276. if( movementSpeed < 0.8 )
  277. thePlayer.SetWalkToggle(true);
  278. else
  279. thePlayer.SetWalkToggle(false);
  280. return movementSpeed;
  281. }
  282.  
  283. public function GetPlayerMoveTypeFromSpeed() : EPlayerMoveType
  284. {
  285. if( thePlayer.GetPlayerCombatStance() != PCS_AlertFar )
  286. return PMT_Walk;
  287.  
  288. if( movementSpeed >= 0.8f )
  289. return PMT_Run;
  290. else
  291. return PMT_Walk;
  292. }
  293.  
  294. event OnMovementSpeedChange( action : SInputAction )
  295. {
  296. /*if( !thePlayer.IsInCombat() )
  297. {*/
  298. if( action.value < -2.5f )
  299. movementSpeed -= 0.1f;
  300. else
  301. if( action.value > 2.5f )
  302. movementSpeed += 0.1f;
  303.  
  304. movementSpeed = ClampF(movementSpeed, 0.1f, 0.9f);
  305. if( movementSpeed < 0.8 )
  306. thePlayer.SetWalkToggle(true);
  307. else
  308. thePlayer.SetWalkToggle(false);
  309. //}
  310. }
  311.  
  312. /*event OnSwitchHardLock( action : SInputAction )
  313. {
  314. if( thePlayer.IsHardLockEnabled() )
  315. {
  316. if( action.value > 0.5 )
  317. thePlayer.SetShouldSwitchTarget(true);
  318.  
  319. if( action.value < -0.5 )
  320. thePlayer.SetShouldSwitchTarget(true);
  321. }
  322. }*/
  323.  
  324. event OnGodInput( action : SInputAction )
  325. {
  326. if( IsPressed(action) )
  327. {
  328. god_internal();
  329. }
  330. }
  331.  
  332. event OnHealInput( action : SInputAction )
  333. {
  334. var max, current : float;
  335. if( IsPressed(action) )
  336. {
  337. max = thePlayer.GetStatMax(BCS_Vitality);
  338. current = thePlayer.GetStat(BCS_Vitality);
  339. thePlayer.ForceSetStat(BCS_Vitality, MinF(max, current + max * 100 / 100));
  340. }
  341. }
  342.  
  343. event OnKillInput( action : SInputAction )
  344. {
  345. var enemies: array<CActor>;
  346. var i, enemiesSize : int;
  347. var npc : CNewNPC;
  348. if( IsPressed(action) )
  349. {
  350. enemies = GetActorsInRange(thePlayer, 20.0f);
  351.  
  352. enemiesSize = enemies.Size();
  353.  
  354. for( i = 0; i < enemiesSize; i += 1 )
  355. {
  356. npc = (CNewNPC)enemies[i];
  357.  
  358. if( npc )
  359. {
  360. if( npc.GetAttitude( thePlayer ) == AIA_Hostile )
  361. {
  362. npc.Kill( 'Debug' );
  363. }
  364. }
  365. }
  366. }
  367. }
  368.  
  369. event OnAccessHorseStash( action : SInputAction )
  370. {
  371. if( (theInput.LastUsedPCInput() && IsReleased(action)) || (theInput.LastUsedGamepad() && IsPressed(action)) )
  372. {
  373. OpenStash();
  374. }
  375. }
  376.  
  377. private function OpenStash( optional hideMessage : bool )
  378. {
  379. if( Equipment().GetHorseDistance() > 81 && !Options().InvEverywhere() )
  380. {
  381. if( !hideMessage )
  382. theGame.GetGuiManager().ShowNotification(GetLocStringByKeyExt("W3EE_HorseTooFar"));
  383.  
  384. return;
  385. }
  386. //Kolaris - Call Roach Gamepad
  387. else if( Equipment().GetHorseDistance() > 81 && theInput.LastUsedGamepad() )
  388. return;
  389.  
  390. PushStashScreen();
  391. }
  392.  
  393. private var counterType : int; default counterType = 1;
  394. event OnCycleUp( action : SInputAction )
  395. {
  396. var typeText : string;
  397.  
  398. if( IsReleased(action) )
  399. {
  400. counterType += 1;
  401.  
  402. if( counterType > 5 )
  403. counterType = 1;
  404.  
  405. switch( counterType )
  406. {
  407. case 1:
  408. switch( Options().HCT() )
  409. {
  410. case 0: typeText = "Sword"; break;
  411. case 1: typeText = "Kick"; break;
  412. case 2: typeText = "Bash"; break;
  413. }
  414. theGame.GetGuiManager().ShowNotification("New Counter Group: Light Human Attacks<br>Current Counter Type: " + typeText, 4000);
  415. break;
  416.  
  417. case 2:
  418. switch( Options().HHCT() )
  419. {
  420. case 0: typeText = "Sword"; break;
  421. case 1: typeText = "Kick"; break;
  422. case 2: typeText = "Bash"; break;
  423. }
  424. theGame.GetGuiManager().ShowNotification("New Counter Group: Heavy Human Attacks<br>Current Counter Type: " + typeText, 4000);
  425. break;
  426.  
  427. case 3:
  428. switch( Options().SHHCT() )
  429. {
  430. case 0: typeText = "Sword"; break;
  431. case 1: typeText = "Kick"; break;
  432. case 2: typeText = "Bash"; break;
  433. }
  434. theGame.GetGuiManager().ShowNotification("New Counter Group: Two Handed Human Attacks<br>Current Counter Type: " + typeText, 4000);
  435. break;
  436.  
  437. case 4:
  438. switch( Options().MCT() )
  439. {
  440. case 0: typeText = "Sword"; break;
  441. case 1: typeText = "Kick"; break;
  442. case 2: typeText = "Bash"; break;
  443. }
  444. theGame.GetGuiManager().ShowNotification("New Counter Group: Light Monster Attacks<br>Current Counter Type: " + typeText, 4000);
  445. break;
  446.  
  447. case 5:
  448. switch( Options().HMCT() )
  449. {
  450. case 0: typeText = "Sword"; break;
  451. case 1: typeText = "Kick"; break;
  452. case 2: typeText = "Bash"; break;
  453. }
  454. theGame.GetGuiManager().ShowNotification("New Counter Group: Heavy Monster Attacks<br>Current Counter Type: " + typeText, 4000);
  455. break;
  456. }
  457. theGame.SaveUserSettings();
  458. }
  459. }
  460.  
  461. event OnCycleDown( action : SInputAction )
  462. {
  463. var typeText : string;
  464.  
  465. if( IsReleased(action) )
  466. {
  467. counterType -= 1;
  468.  
  469. if( counterType < 1 )
  470. counterType = 5;
  471.  
  472. switch( counterType )
  473. {
  474. case 1:
  475. switch( Options().HCT() )
  476. {
  477. case 0: typeText = "Sword"; break;
  478. case 1: typeText = "Kick"; break;
  479. case 2: typeText = "Bash"; break;
  480. }
  481. theGame.GetGuiManager().ShowNotification("New Counter Group: Light Human Attacks<br>Current Counter Type: " + typeText, 4000);
  482. break;
  483.  
  484. case 2:
  485. switch( Options().HHCT() )
  486. {
  487. case 0: typeText = "Sword"; break;
  488. case 1: typeText = "Kick"; break;
  489. case 2: typeText = "Bash"; break;
  490. }
  491. theGame.GetGuiManager().ShowNotification("New Counter Group: Heavy Human Attacks<br>Current Counter Type: " + typeText, 4000);
  492. break;
  493.  
  494. case 3:
  495. switch( Options().SHHCT() )
  496. {
  497. case 0: typeText = "Sword"; break;
  498. case 1: typeText = "Kick"; break;
  499. case 2: typeText = "Bash"; break;
  500. }
  501. theGame.GetGuiManager().ShowNotification("New Counter Group: Two Handed Human Attacks<br>Current Counter Type: " + typeText, 4000);
  502. break;
  503.  
  504. case 4:
  505. switch( Options().MCT() )
  506. {
  507. case 0: typeText = "Sword"; break;
  508. case 1: typeText = "Kick"; break;
  509. case 2: typeText = "Bash"; break;
  510. }
  511. theGame.GetGuiManager().ShowNotification("New Counter Group: Light Monster Attacks<br>Current Counter Type: " + typeText, 4000);
  512. break;
  513.  
  514. case 5:
  515. switch( Options().HMCT() )
  516. {
  517. case 0: typeText = "Sword"; break;
  518. case 1: typeText = "Kick"; break;
  519. case 2: typeText = "Bash"; break;
  520. }
  521. theGame.GetGuiManager().ShowNotification("New Counter Group: Heavy Monster Attacks<br>Current Counter Type: " + typeText, 4000);
  522. break;
  523. }
  524. theGame.SaveUserSettings();
  525. }
  526. }
  527.  
  528. event OnCycleForward( action : SInputAction )
  529. {
  530. var currType : int;
  531. var typeText : string;
  532.  
  533. if( IsReleased(action) )
  534. {
  535. switch( counterType )
  536. {
  537. case 1:
  538. currType = Options().HCT() + 1;
  539.  
  540. if( currType > 2 )
  541. currType = 0;
  542.  
  543. theGame.GetInGameConfigWrapper().SetVarValue('SCOptionCP', 'CTH', (string)currType);
  544.  
  545. switch( Options().HCT() )
  546. {
  547. case 0: typeText = "Sword"; break;
  548. case 1: typeText = "Kick"; break;
  549. case 2: typeText = "Bash"; break;
  550. }
  551.  
  552. theGame.GetGuiManager().ShowNotification("Current Counter Group: Light Human Attacks<br>New Counter Type: " + typeText, 4000);
  553. break;
  554.  
  555. case 2:
  556. currType = Options().HHCT() + 1;
  557.  
  558. if( currType > 2 )
  559. currType = 0;
  560.  
  561. theGame.GetInGameConfigWrapper().SetVarValue('SCOptionCP', 'CTHH', (string)currType);
  562.  
  563. switch( Options().HHCT() )
  564. {
  565. case 0: typeText = "Sword"; break;
  566. case 1: typeText = "Kick"; break;
  567. case 2: typeText = "Bash"; break;
  568. }
  569. theGame.GetGuiManager().ShowNotification("Current Counter Group: Heavy Human Attacks<br>New Counter Type: " + typeText, 4000);
  570. break;
  571.  
  572. case 3:
  573. currType = Options().SHHCT() + 1;
  574.  
  575. if( currType > 2 )
  576. currType = 0;
  577.  
  578. theGame.GetInGameConfigWrapper().SetVarValue('SCOptionCP', 'CTHSH', (string)currType);
  579.  
  580. switch( Options().SHHCT() )
  581. {
  582. case 0: typeText = "Sword"; break;
  583. case 1: typeText = "Kick"; break;
  584. case 2: typeText = "Bash"; break;
  585. }
  586. theGame.GetGuiManager().ShowNotification("Current Counter Group: Two Handed Human Attacks<br>New Counter Type: " + typeText, 4000);
  587. break;
  588.  
  589. case 4:
  590. currType = Options().MCT() + 1;
  591.  
  592. if( currType > 2 )
  593. currType = 0;
  594.  
  595. theGame.GetInGameConfigWrapper().SetVarValue('SCOptionCP', 'CTM', (string)currType);
  596.  
  597. switch( Options().MCT() )
  598. {
  599. case 0: typeText = "Sword"; break;
  600. case 1: typeText = "Kick"; break;
  601. case 2: typeText = "Bash"; break;
  602. }
  603. theGame.GetGuiManager().ShowNotification("Current Counter Group: Light Monster Attacks<br>New Counter Type: " + typeText, 4000);
  604. break;
  605.  
  606. case 5:
  607. currType = Options().HMCT() + 1;
  608.  
  609. if( currType > 2 )
  610. currType = 0;
  611.  
  612. theGame.GetInGameConfigWrapper().SetVarValue('SCOptionCP', 'CTMH', (string)currType);
  613.  
  614. switch( Options().HMCT() )
  615. {
  616. case 0: typeText = "Sword"; break;
  617. case 1: typeText = "Kick"; break;
  618. case 2: typeText = "Bash"; break;
  619. }
  620. theGame.GetGuiManager().ShowNotification("Current Counter Group: Heavy Monster Attacks<br>New Counter Type: " + typeText, 4000);
  621. break;
  622. }
  623. theGame.SaveUserSettings();
  624. }
  625. }
  626.  
  627. event OnCycleBackward( action : SInputAction )
  628. {
  629. var currType : int;
  630. var typeText : string;
  631.  
  632. if( IsReleased(action) )
  633. {
  634. switch( counterType )
  635. {
  636. case 1:
  637. currType = Options().HCT() - 1;
  638.  
  639. if( currType < 0 )
  640. currType = 2;
  641.  
  642. theGame.GetInGameConfigWrapper().SetVarValue('SCOptionCP', 'CTH', (string)currType);
  643.  
  644. switch( Options().HCT() )
  645. {
  646. case 0: typeText = "Sword"; break;
  647. case 1: typeText = "Kick"; break;
  648. case 2: typeText = "Bash"; break;
  649. }
  650.  
  651. theGame.GetGuiManager().ShowNotification("Current Counter Group: Light Human Attacks<br>New Counter Type: " + typeText, 4000);
  652. break;
  653.  
  654. case 2:
  655. currType = Options().HHCT() - 1;
  656.  
  657. if( currType < 0 )
  658. currType = 2;
  659.  
  660. theGame.GetInGameConfigWrapper().SetVarValue('SCOptionCP', 'CTHH', (string)currType);
  661.  
  662. switch( Options().HHCT() )
  663. {
  664. case 0: typeText = "Sword"; break;
  665. case 1: typeText = "Kick"; break;
  666. case 2: typeText = "Bash"; break;
  667. }
  668. theGame.GetGuiManager().ShowNotification("Current Counter Group: Heavy Human Attacks<br>New Counter Type: " + typeText, 4000);
  669. break;
  670.  
  671. case 3:
  672. currType = Options().SHHCT() - 1;
  673.  
  674. if( currType < 0 )
  675. currType = 2;
  676.  
  677. theGame.GetInGameConfigWrapper().SetVarValue('SCOptionCP', 'CTHSH', (string)currType);
  678.  
  679. switch( Options().SHHCT() )
  680. {
  681. case 0: typeText = "Sword"; break;
  682. case 1: typeText = "Kick"; break;
  683. case 2: typeText = "Bash"; break;
  684. }
  685. theGame.GetGuiManager().ShowNotification("Current Counter Group: Two Handed Human Attacks<br>New Counter Type: " + typeText, 4000);
  686. break;
  687.  
  688. case 4:
  689. currType = Options().MCT() - 1;
  690.  
  691. if( currType < 0 )
  692. currType = 2;
  693.  
  694. theGame.GetInGameConfigWrapper().SetVarValue('SCOptionCP', 'CTM', (string)currType);
  695.  
  696. switch( Options().MCT() )
  697. {
  698. case 0: typeText = "Sword"; break;
  699. case 1: typeText = "Kick"; break;
  700. case 2: typeText = "Bash"; break;
  701. }
  702. theGame.GetGuiManager().ShowNotification("Current Counter Group: Light Monster Attacks<br>New Counter Type: " + typeText, 4000);
  703. break;
  704.  
  705. case 5:
  706. currType = Options().HMCT() - 1;
  707.  
  708. if( currType < 0 )
  709. currType = 2;
  710.  
  711. theGame.GetInGameConfigWrapper().SetVarValue('SCOptionCP', 'CTMH', (string)currType);
  712.  
  713. switch( Options().HMCT() )
  714. {
  715. case 0: typeText = "Sword"; break;
  716. case 1: typeText = "Kick"; break;
  717. case 2: typeText = "Bash"; break;
  718. }
  719. theGame.GetGuiManager().ShowNotification("Current Counter Group: Heavy Monster Attacks<br>New Counter Type: " + typeText, 4000);
  720. break;
  721. }
  722. theGame.SaveUserSettings();
  723. }
  724. }
  725. // W3EE - End
  726.  
  727. function Destroy()
  728. {
  729. }
  730.  
  731. // sharedutils - npcInteraction - BEGIN
  732. public var global_event_handler: SU_NpcInteraction_GlobalEventHandler;
  733. // sharedutils - npcInteraction - END
  734. }
  735.  
  736. private var savedQuickSlot : EEquipmentSlots; default savedQuickSlot = EES_InvalidSlot;
  737.  
  738. event OnSwitchCrossbow( action : SInputAction )
  739. {
  740. var item1, item2, item3, item4, crossbow, selectedItem : SItemUniqueId;
  741. var witcher : W3PlayerWitcher;
  742.  
  743. if( thePlayer.IsCiri() )
  744. {
  745. return false;
  746. }
  747.  
  748. if( IsPressed( action ) )
  749. {
  750. witcher = GetWitcherPlayer();
  751. selectedItem = witcher.GetSelectedItemId();
  752. witcher.GetItemEquippedOnSlot( EES_Petard1, item1 );
  753. witcher.GetItemEquippedOnSlot( EES_Petard2, item2 );
  754. witcher.GetItemEquippedOnSlot( EES_Petard3, item3 );
  755. witcher.GetItemEquippedOnSlot( EES_Petard4, item4 );
  756. witcher.GetItemEquippedOnSlot( EES_RangedWeapon, crossbow );
  757. if ( !witcher.inv.IsItemCrossbow( selectedItem ) )
  758. {
  759. if ( selectedItem == item1 && selectedItem != GetInvalidUniqueId() )
  760. {
  761. savedQuickSlot = EES_Petard1;
  762. }
  763. else if ( selectedItem == item2 && selectedItem != GetInvalidUniqueId() )
  764. {
  765. savedQuickSlot = EES_Petard2;
  766. }
  767. else if ( selectedItem == item3 && selectedItem != GetInvalidUniqueId() )
  768. {
  769. savedQuickSlot = EES_Petard3;
  770. }
  771. else if ( selectedItem == item4 && selectedItem != GetInvalidUniqueId() )
  772. {
  773. savedQuickSlot = EES_Petard4;
  774. }
  775. else
  776. {
  777. savedQuickSlot = EES_InvalidSlot;
  778. }
  779. if ( crossbow != GetInvalidUniqueId() )
  780. {
  781. WmkGetQuickSlotsInstance().OnRadialMenuActivateSlot("Crossbow", 0);
  782. }
  783. }
  784. else
  785. {
  786. if ( savedQuickSlot == EES_Petard1 && item1 != GetInvalidUniqueId() )
  787. {
  788. WmkGetQuickSlotsInstance().OnRadialMenuActivateSlot("Slot1", 0);
  789. }
  790. else if ( savedQuickSlot == EES_Petard2 && item2 != GetInvalidUniqueId() )
  791. {
  792. WmkGetQuickSlotsInstance().OnRadialMenuActivateSlot("Slot2", 0);
  793. }
  794. else if ( savedQuickSlot == EES_Petard3 && item3 != GetInvalidUniqueId() )
  795. {
  796. WmkGetQuickSlotsInstance().OnRadialMenuActivateSlot("Slot3", 0);
  797. }
  798. else if ( savedQuickSlot == EES_Petard4 && item4 != GetInvalidUniqueId() )
  799. {
  800. WmkGetQuickSlotsInstance().OnRadialMenuActivateSlot("Slot3", 0);
  801. }
  802. else if ( item1 != GetInvalidUniqueId() )
  803. {
  804. WmkGetQuickSlotsInstance().OnRadialMenuActivateSlot("Slot1", 0);
  805. }
  806. else if ( item2 != GetInvalidUniqueId() )
  807. {
  808. WmkGetQuickSlotsInstance().OnRadialMenuActivateSlot("Slot2", 0);
  809. }
  810. savedQuickSlot = EES_InvalidSlot;
  811. }
  812. }
  813. }
  814. event On3DMarkersToggle( action : SInputAction )
  815. {
  816. if( IsPressed( action ) )
  817. {
  818. GetFHUDConfig().Toggle3DMarkers();
  819. }
  820. }
  821. event OnPauseGameToggle( action : SInputAction )
  822. {
  823. var hud : CR4ScriptedHud;
  824.  
  825. if( IsPressed( action ) )
  826. {
  827. if ( !theGame.IsPausedForReason( "user_pause" ) && !theGame.HasBlackscreenRequested() )
  828. {
  829. theGame.Pause( "user_pause" );
  830. theSound.SoundEvent("system_pause");
  831. }
  832. else if ( theGame.IsPausedForReason( "user_pause" ) && !theGame.HasBlackscreenRequested() )
  833. {
  834. theGame.Unpause( "user_pause" );
  835. theSound.SoundEvent("system_resume");
  836. }
  837. }
  838. }
  839. //---=== modFriendlyHUD ===---
  840.  
  841. public function FindActionLockIndex(action : EInputActionBlock, sourceName : name) : int
  842. {
  843. var i : int;
  844.  
  845. for(i=0; i<actionLocks[action].Size(); i+=1)
  846. if(actionLocks[action][i].sourceName == sourceName)
  847. return i;
  848.  
  849. return -1;
  850. }
  851.  
  852.  
  853. public function BlockAction(action : EInputActionBlock, sourceName : name, lock : bool, optional keepOnSpawn : bool, optional onSpawnedNullPointerHackFix : CPlayer, optional isFromQuest : bool, optional isFromPlace : bool)
  854. {
  855. var index : int;
  856. var isLocked, wasLocked : bool;
  857. var actionLock : SInputActionLock;
  858.  
  859. if (action == EIAB_HighlightObjective)
  860. {
  861. index = FindActionLockIndex(action, sourceName);
  862. }
  863.  
  864. index = FindActionLockIndex(action, sourceName);
  865.  
  866. wasLocked = (actionLocks[action].Size() > 0);
  867.  
  868. if(lock)
  869. {
  870. if(index != -1)
  871. return;
  872.  
  873. actionLock.sourceName = sourceName;
  874.  
  875. if( action == EIAB_CameraLock )
  876. {
  877. actionLock.removedOnSpawn = true;
  878. }
  879. else
  880. {
  881. actionLock.removedOnSpawn = !keepOnSpawn;
  882. }
  883. actionLock.isFromQuest = isFromQuest;
  884. actionLock.isFromPlace = isFromPlace;
  885.  
  886. actionLocks[action].PushBack(actionLock);
  887. }
  888. else
  889. {
  890. if(index == -1)
  891. return;
  892.  
  893. actionLocks[action].Erase(index);
  894. }
  895.  
  896. isLocked = (actionLocks[action].Size() > 0);
  897. if(isLocked != wasLocked)
  898. OnActionLockChanged(action, isLocked, sourceName, onSpawnedNullPointerHackFix);
  899. }
  900.  
  901.  
  902. public final function TutorialForceUnblockRadial() : array<SInputActionLock>
  903. {
  904. var ret : array<SInputActionLock>;
  905.  
  906. ret = actionLocks[EIAB_RadialMenu];
  907.  
  908. actionLocks[EIAB_RadialMenu].Clear();
  909.  
  910. thePlayer.SetBIsInputAllowed(true, '');
  911.  
  912. BlockAction( EIAB_Signs, 'ToxicGasTutorial', true, true, NULL, false);
  913.  
  914. return ret;
  915. }
  916.  
  917.  
  918. public final function TutorialForceRestoreRadialLocks(radialLocks : array<SInputActionLock>)
  919. {
  920. actionLocks[EIAB_RadialMenu] = radialLocks;
  921. thePlayer.UnblockAction(EIAB_Signs, 'ToxicGasTutorial' );
  922. }
  923.  
  924. private function OnActionLockChanged(action : EInputActionBlock, locked : bool, optional sourceName : name, optional onSpawnedNullPointerHackFix : CPlayer)
  925. {
  926. var player : CPlayer;
  927. var lockType : EPlayerInteractionLock;
  928. var hud : CR4ScriptedHud;
  929. var guiManager : CR4GuiManager;
  930. var rootMenu : CR4MenuBase;
  931.  
  932.  
  933. if( sourceName == debugBlockSourceName )
  934. {
  935.  
  936. sourceName = sourceName;
  937. }
  938.  
  939.  
  940. if(action == EIAB_FastTravel)
  941. {
  942. theGame.GetCommonMapManager().EnableFastTravelling(!locked);
  943. }
  944. else if(action == EIAB_Interactions)
  945. {
  946.  
  947. if(sourceName == 'InsideCombatAction')
  948. lockType = PIL_CombatAction;
  949. else
  950. lockType = PIL_Default;
  951.  
  952. if(!thePlayer)
  953. player = onSpawnedNullPointerHackFix;
  954. else
  955. player = thePlayer;
  956.  
  957. if(player)
  958. {
  959. if(locked)
  960. player.LockButtonInteractions(lockType);
  961. else
  962. player.UnlockButtonInteractions(lockType);
  963. }
  964.  
  965.  
  966. hud = (CR4ScriptedHud)theGame.GetHud();
  967. if ( hud )
  968. {
  969. hud.ForceInteractionUpdate();
  970. }
  971. }
  972. else if(action == EIAB_Movement && locked && thePlayer)
  973. {
  974.  
  975. if(thePlayer.IsUsingVehicle() && thePlayer.GetCurrentStateName() == 'HorseRiding')
  976. {
  977. ((CActor)thePlayer.GetUsedVehicle()).GetMovingAgentComponent().ResetMoveRequests();
  978. thePlayer.GetUsedVehicle().SetBehaviorVariable( '2idle', 1);
  979.  
  980. thePlayer.SetBehaviorVariable( 'speed', 0);
  981. thePlayer.SetBehaviorVariable( '2idle', 1);
  982. }
  983. else if(!thePlayer.IsInAir())
  984. {
  985. thePlayer.RaiseForceEvent( 'Idle' );
  986. }
  987. }
  988. else if (action == EIAB_DismountVehicle)
  989. {
  990. guiManager = theGame.GetGuiManager();
  991.  
  992. if (guiManager)
  993. {
  994. guiManager.UpdateDismountAvailable(locked);
  995. }
  996. }
  997. else if (action == EIAB_OpenPreparation || action == EIAB_OpenMap || action == EIAB_OpenInventory ||
  998. action == EIAB_OpenJournal || action == EIAB_OpenCharacterPanel || action == EIAB_OpenGlossary ||
  999. action == EIAB_OpenAlchemy || action == EIAB_MeditationWaiting || action == EIAB_OpenMeditation)
  1000. {
  1001. guiManager = theGame.GetGuiManager();
  1002.  
  1003. if (guiManager && guiManager.IsAnyMenu())
  1004. {
  1005. rootMenu = (CR4MenuBase)guiManager.GetRootMenu();
  1006.  
  1007. if (rootMenu)
  1008. {
  1009. rootMenu.ActionBlockStateChange(action, locked);
  1010. }
  1011. }
  1012. }
  1013. }
  1014.  
  1015. public function BlockAllActions(sourceName : name, lock : bool, optional exceptions : array<EInputActionBlock>, optional saveLock : bool, optional onSpawnedNullPointerHackFix : CPlayer, optional isFromQuest : bool, optional isFromPlace : bool)
  1016. {
  1017. var i, size : int;
  1018.  
  1019. size = EnumGetMax('EInputActionBlock')+1;
  1020. for(i=0; i<size; i+=1)
  1021. {
  1022. if ( exceptions.Contains(i) || i == EIAB_CameraLock )
  1023. continue;
  1024.  
  1025. BlockAction(i, sourceName, lock, saveLock, onSpawnedNullPointerHackFix, isFromQuest, isFromPlace);
  1026. }
  1027. }
  1028.  
  1029.  
  1030. public final function BlockAllQuestActions(sourceName : name, lock : bool)
  1031. {
  1032. var action, j, size : int;
  1033. var isLocked, wasLocked : bool;
  1034. var exceptions : array< EInputActionBlock >;
  1035.  
  1036. if(lock)
  1037. {
  1038.  
  1039. exceptions.PushBack( EIAB_FastTravelGlobal );
  1040. BlockAllActions(sourceName, lock, exceptions, true, , true);
  1041. }
  1042. else
  1043. {
  1044.  
  1045. size = EnumGetMax('EInputActionBlock')+1;
  1046. for(action=0; action<size; action+=1)
  1047. {
  1048. wasLocked = (actionLocks[action].Size() > 0);
  1049.  
  1050. for(j=0; j<actionLocks[action].Size();)
  1051. {
  1052. if(actionLocks[action][j].isFromQuest)
  1053. {
  1054. actionLocks[action].EraseFast(j);
  1055. }
  1056. else
  1057. {
  1058. j += 1;
  1059. }
  1060. }
  1061.  
  1062. isLocked = (actionLocks[action].Size() > 0);
  1063. if(wasLocked != isLocked)
  1064. OnActionLockChanged(action, isLocked);
  1065. }
  1066. }
  1067. }
  1068.  
  1069.  
  1070. public function BlockAllUIQuestActions(sourceName : name, lock : bool)
  1071. {
  1072. var i, j, action, size : int;
  1073. var uiActions : array<int>;
  1074. var wasLocked, isLocked : bool;
  1075.  
  1076. if( lock )
  1077. {
  1078. BlockAction(EIAB_OpenInventory, sourceName, true, true, NULL, false);
  1079. BlockAction(EIAB_MeditationWaiting, sourceName, true, true, NULL, false);
  1080. BlockAction(EIAB_OpenMeditation, sourceName, true, true, NULL, false);
  1081. BlockAction(EIAB_FastTravel, sourceName, true, true, NULL, false);
  1082. BlockAction(EIAB_OpenMap, sourceName, true, true, NULL, false);
  1083. BlockAction(EIAB_OpenCharacterPanel, sourceName, true, true, NULL, false);
  1084. BlockAction(EIAB_OpenJournal, sourceName, true, true, NULL, false);
  1085. BlockAction(EIAB_OpenAlchemy, sourceName, true, true, NULL, false);
  1086. }
  1087. else
  1088. {
  1089.  
  1090. uiActions.Resize(8);
  1091. uiActions[0] = EIAB_OpenInventory;
  1092. uiActions[1] = EIAB_MeditationWaiting;
  1093. uiActions[2] = EIAB_OpenMeditation;
  1094. uiActions[3] = EIAB_FastTravel;
  1095. uiActions[4] = EIAB_OpenMap;
  1096. uiActions[5] = EIAB_OpenCharacterPanel;
  1097. uiActions[6] = EIAB_OpenJournal;
  1098. uiActions[7] = EIAB_OpenAlchemy;
  1099.  
  1100. size = uiActions.Size();
  1101. for(i=0; i<size; i+=1)
  1102. {
  1103. action = uiActions[i];
  1104.  
  1105. wasLocked = (actionLocks[action].Size() > 0);
  1106.  
  1107. for(j=0; j<actionLocks[action].Size();)
  1108. {
  1109. if(actionLocks[action][j].isFromQuest)
  1110. {
  1111. actionLocks[action].EraseFast(j);
  1112. }
  1113. else
  1114. {
  1115. j += 1;
  1116. }
  1117. }
  1118.  
  1119. isLocked = (actionLocks[action].Size() > 0);
  1120. if(wasLocked != isLocked)
  1121. OnActionLockChanged(action, isLocked);
  1122. }
  1123. }
  1124. }
  1125.  
  1126.  
  1127. public function ForceUnlockAllInputActions(alsoQuestLocks : bool)
  1128. {
  1129. var i, j : int;
  1130.  
  1131. for(i=0; i<=EnumGetMax('EInputActionBlock'); i+=1)
  1132. {
  1133. if(alsoQuestLocks)
  1134. {
  1135. actionLocks[i].Clear();
  1136. OnActionLockChanged(i, false);
  1137. }
  1138. else
  1139. {
  1140. for(j=actionLocks[i].Size()-1; j>=0; j-=1)
  1141. {
  1142. if(actionLocks[i][j].removedOnSpawn)
  1143. actionLocks[i].Erase(j);
  1144. }
  1145.  
  1146. if(actionLocks[i].Size() == 0)
  1147. OnActionLockChanged(i, false);
  1148. }
  1149. }
  1150. }
  1151.  
  1152. public function RemoveLocksOnSpawn()
  1153. {
  1154. var i, j : int;
  1155.  
  1156. for(i=0; i<actionLocks.Size(); i+=1)
  1157. {
  1158. for(j=actionLocks[i].Size()-1; j>=0; j-=1)
  1159. {
  1160. if(actionLocks[i][j].removedOnSpawn || i == EIAB_CameraLock)
  1161. {
  1162. actionLocks[i].Erase(j);
  1163. }
  1164. }
  1165. }
  1166. }
  1167.  
  1168. public function GetActionLocks(action : EInputActionBlock) : array< SInputActionLock >
  1169. {
  1170. return actionLocks[action];
  1171. }
  1172.  
  1173. public function GetAllActionLocks() : array< array< SInputActionLock > >
  1174. {
  1175. return actionLocks;
  1176. }
  1177.  
  1178. public function IsActionAllowed(action : EInputActionBlock) : bool
  1179. {
  1180. var actionAllowed : bool;
  1181. actionAllowed = (actionLocks[action].Size() == 0);
  1182. return actionAllowed;
  1183. }
  1184.  
  1185. public function IsActionBlockedBy( action : EInputActionBlock, sourceName : name ) : bool
  1186. {
  1187. return FindActionLockIndex( action, sourceName ) != -1;
  1188. }
  1189.  
  1190. public final function GetActionBlockedHudLockType(action : EInputActionBlock) : name
  1191. {
  1192. var i : int;
  1193.  
  1194. if(action == EIAB_Undefined)
  1195. return '';
  1196.  
  1197. for(i=0; i<actionLocks[action].Size(); i+=1)
  1198. {
  1199. if(actionLocks[action][i].isFromPlace)
  1200. return 'place';
  1201. }
  1202.  
  1203. if(actionLocks[action].Size() > 0)
  1204. return 'time';
  1205.  
  1206. return '';
  1207. }
  1208.  
  1209.  
  1210.  
  1211.  
  1212. event OnCommSprint( action : SInputAction )
  1213. {
  1214. // W3EE - Begin
  1215. if( IsPressed( action ) && !GetWitcherPlayer().IsMeditating() )
  1216. {
  1217. thePlayer.SetSprintActionPressed(true);
  1218.  
  1219. if ( thePlayer.rangedWeapon )
  1220. thePlayer.rangedWeapon.OnSprintHolster();
  1221. }
  1222.  
  1223. if( !thePlayer.IsCiri() && GetWitcherPlayer() )
  1224. {
  1225. if( IsPressed( action ) && GetWitcherPlayer().IsMeditating() )
  1226. {
  1227. GetWitcherPlayer().MeditationStartFastforward();
  1228. }
  1229. if( IsReleased( action ) && GetWitcherPlayer().IsMeditating() )
  1230. {
  1231. GetWitcherPlayer().MeditationEndFastforward();
  1232. }
  1233. }
  1234. // W3EE - End
  1235. }
  1236.  
  1237. event OnCommSprintToggle( action : SInputAction )
  1238. {
  1239. if( IsPressed(action) )
  1240. {
  1241. if ( thePlayer.GetIsSprintToggled() )
  1242. thePlayer.SetSprintToggle( false );
  1243. else
  1244. thePlayer.SetSprintToggle( true );
  1245. }
  1246. }
  1247.  
  1248. event OnCommWalkToggle( action : SInputAction )
  1249. {
  1250. if( IsPressed(action) && !thePlayer.GetIsSprinting() && !thePlayer.modifyPlayerSpeed )
  1251. {
  1252. if ( thePlayer.GetIsWalkToggled() )
  1253. {
  1254. movementSpeed = 1.0f;
  1255. thePlayer.SetWalkToggle( false );
  1256. }
  1257. else
  1258. {
  1259. movementSpeed = 0.7f;
  1260. thePlayer.SetWalkToggle( true );
  1261. }
  1262. }
  1263. }
  1264.  
  1265.  
  1266. event OnCommGuard( action : SInputAction )
  1267. {
  1268. if(thePlayer.IsCiri() && !GetCiriPlayer().HasSword())
  1269. return false;
  1270.  
  1271. if ( !thePlayer.IsInsideInteraction() )
  1272. {
  1273. if ( IsActionAllowed(EIAB_Parry) )
  1274. {
  1275. if( IsReleased(action) && thePlayer.GetCurrentStateName() == 'CombatFists' )
  1276. thePlayer.OnGuardedReleased();
  1277.  
  1278. if( IsPressed(action) )
  1279. {
  1280. thePlayer.AddCounterTimeStamp(theGame.GetEngineTime());
  1281. thePlayer.SetGuarded(true);
  1282. thePlayer.OnPerformGuard();
  1283. }
  1284. else if( IsReleased(action) )
  1285. {
  1286. thePlayer.SetGuarded(false);
  1287. }
  1288. }
  1289. else
  1290. {
  1291. thePlayer.DisplayActionDisallowedHudMessage(EIAB_Parry);
  1292. }
  1293. }
  1294. }
  1295.  
  1296.  
  1297.  
  1298.  
  1299.  
  1300. private var pressTimestamp : float;
  1301. private const var DOUBLE_TAP_WINDOW : float;
  1302. default DOUBLE_TAP_WINDOW = 0.4;
  1303.  
  1304. event OnCommSpawnHorse( action : SInputAction )
  1305. {
  1306. var doubleTap : bool;
  1307.  
  1308. // W3EE - Begin
  1309. if( theInput.IsActionPressed('ControllerCastModifier') )
  1310. return false;
  1311. // W3EE - End
  1312.  
  1313. if( IsPressed( action ) )
  1314. {
  1315. if( pressTimestamp + DOUBLE_TAP_WINDOW >= theGame.GetEngineTimeAsSeconds() )
  1316. {
  1317. doubleTap = true;
  1318. }
  1319. else
  1320. {
  1321. doubleTap = false;
  1322. }
  1323.  
  1324. // W3EE - Begin
  1325. if( doubleTap && IsActionAllowed(EIAB_OpenInventory) )
  1326. {
  1327. OpenStash(true);
  1328. }
  1329. // W3EE - End
  1330.  
  1331. if( IsActionAllowed( EIAB_CallHorse ) && !thePlayer.IsInInterior() && !thePlayer.IsInAir() )
  1332. {
  1333.  
  1334. if( doubleTap || theInput.LastUsedPCInput() )
  1335. {
  1336. if ( thePlayer.IsHoldingItemInLHand () )
  1337. {
  1338. thePlayer.OnUseSelectedItem(true);
  1339. thePlayer.SetPlayerActionToRestore ( PATR_CallHorse );
  1340. }
  1341. else
  1342. {
  1343. theGame.OnSpawnPlayerHorse();
  1344. }
  1345. }
  1346. }
  1347. //---=== modFriendlyHUD ===---
  1348. else if( doubleTap || theInput.LastUsedPCInput() )
  1349. //---=== modFriendlyHUD ===---
  1350. {
  1351. if( thePlayer.IsInInterior() )
  1352. thePlayer.DisplayActionDisallowedHudMessage( EIAB_Undefined, false, true );
  1353. else
  1354. thePlayer.DisplayActionDisallowedHudMessage( EIAB_CallHorse );
  1355. }
  1356.  
  1357. pressTimestamp = theGame.GetEngineTimeAsSeconds();
  1358.  
  1359. return true;
  1360. }
  1361.  
  1362. return false;
  1363. }
  1364.  
  1365.  
  1366.  
  1367.  
  1368.  
  1369.  
  1370. //---=== modFriendlyHUD ===---
  1371. private var essentialsPressTimestamp : float;
  1372. event OnToggleEssentials( action : SInputAction )
  1373. {
  1374. if( theInput.IsActionPressed('ControllerCastModifier') )
  1375. return false;
  1376.  
  1377. if( IsPressed( action ) && thePlayer.GetCurrentStateName() != 'ExplorationMeditation' )
  1378. {
  1379. thePlayer.RemoveTimer( 'PinEssentialGroupTimer' );
  1380. thePlayer.AddTimer( 'PinEssentialGroupTimer', DOUBLE_TAP_WINDOW, false );
  1381. if( essentialsPressTimestamp + DOUBLE_TAP_WINDOW >= theGame.GetEngineTimeAsSeconds() )
  1382. {
  1383. thePlayer.RemoveTimer( 'PinEssentialGroupTimer' );
  1384. }
  1385. essentialsPressTimestamp = theGame.GetEngineTimeAsSeconds();
  1386. }
  1387. }
  1388.  
  1389. event OnHoldToSeeHub( action : SInputAction )
  1390. {
  1391. if( theInput.IsActionPressed( 'PinModuleModfier' ) )
  1392. {
  1393. if( IsReleased( action ) )
  1394. {
  1395. ToggleEssentialModules( !IsHUDGroupEnabledForReason( GetFHUDConfig().essentialModules, "PinEssentialGroup" ), "PinEssentialGroup" );
  1396. }
  1397. }
  1398. else
  1399. {
  1400. if ( IsPressed(action) )
  1401. {
  1402. thePlayer.AddTimer( 'EssentialsOnTimer' , KEY_HOLD_WINDOW, false );
  1403. }
  1404. if ( IsReleased(action) )
  1405. {
  1406. thePlayer.RemoveTimer( 'EssentialsOnTimer' );
  1407. ToggleEssentialModules( false, "EssentialModulesHotkey" );
  1408. }
  1409. }
  1410. }
  1411.  
  1412. private var pressHubTime : float;
  1413. event OnCommMenuHub( action : SInputAction )
  1414. {
  1415. if( !theInput.IsActionPressed( 'PinModuleModfier' ) )
  1416. {
  1417. if( IsPressed(action) )
  1418. {
  1419. pressHubTime = theGame.GetEngineTimeAsSeconds();
  1420. }
  1421. if( IsReleased( action ) )
  1422. {
  1423. if ( theGame.GetEngineTimeAsSeconds() - pressHubTime < KEY_HOLD_WINDOW || !ActionsHaveConflict( 'HubMenu', 'HoldToSeeEssentials' ) )
  1424. {
  1425. PushMenuHub();
  1426. }
  1427. }
  1428. }
  1429. }
  1430. //---=== modFriendlyHUD ===---
  1431.  
  1432. final function PushMenuHub()
  1433. {
  1434. if ( theGame.IsBlackscreenOrFading() )
  1435. {
  1436. return;
  1437. }
  1438. theGame.RequestMenu('CommonMenu');
  1439. }
  1440.  
  1441.  
  1442.  
  1443. //---=== modFriendlyHUD ===---
  1444. event OnHoldToSeeChar( action : SInputAction )
  1445. {
  1446. if( theInput.IsActionPressed( 'PinModuleModfier' ) )
  1447. {
  1448. if( IsReleased( action ) )
  1449. {
  1450. ToggleCharacterModules( !IsHUDGroupEnabledForReason( GetFHUDConfig().characterModules, "PinCharacterGroup" ), "PinCharacterGroup" );
  1451. }
  1452. }
  1453. else
  1454. {
  1455. if ( IsPressed(action) )
  1456. {
  1457. thePlayer.AddTimer( 'CharOnTimer' , KEY_HOLD_WINDOW, false );
  1458. }
  1459. if ( IsReleased(action) )
  1460. {
  1461. thePlayer.RemoveTimer( 'CharOnTimer' );
  1462. ToggleCharacterModules( false, "CharModulesHotkey" );
  1463. }
  1464. }
  1465. }
  1466.  
  1467. private var pressCharTime : float;
  1468. event OnCommPanelChar( action : SInputAction )
  1469. {
  1470. if( !theInput.IsActionPressed( 'PinModuleModfier' ) )
  1471. {
  1472. if( IsPressed(action) )
  1473. {
  1474. pressCharTime = theGame.GetEngineTimeAsSeconds();
  1475. }
  1476. if( IsReleased( action ) )
  1477. {
  1478. if ( theGame.GetEngineTimeAsSeconds() - pressCharTime < KEY_HOLD_WINDOW || !ActionsHaveConflict( 'PanelChar', 'HoldToSeeCharStats' ) )
  1479. {
  1480. PushCharacterScreen();
  1481. }
  1482. }
  1483. }
  1484. }
  1485. //---=== modFriendlyHUD ===---
  1486.  
  1487. final function PushCharacterScreen()
  1488. {
  1489. if ( theGame.IsBlackscreenOrFading() )
  1490. {
  1491. return;
  1492. }
  1493.  
  1494. if( IsActionAllowed(EIAB_OpenCharacterPanel) )
  1495. {
  1496. theGame.RequestMenuWithBackground( 'CharacterMenu', 'CommonMenu' );
  1497. }
  1498. else
  1499. {
  1500. thePlayer.DisplayActionDisallowedHudMessage(EIAB_OpenCharacterPanel);
  1501. }
  1502. }
  1503.  
  1504.  
  1505. event OnCommPanelInv( action : SInputAction )
  1506. {
  1507. //---=== modFriendlyHUD ===---
  1508. if ( ( theInput.LastUsedPCInput() && IsReleased(action) ) || ( theInput.LastUsedGamepad() && IsPressed(action) ) )
  1509. {
  1510. if ( theInput.IsActionPressed( 'PanelInv' ) )
  1511. {
  1512. controllerQuickInventoryHandled = true;
  1513. }
  1514. //---=== modFriendlyHUD ===---
  1515. PushInventoryScreen();
  1516. }
  1517. }
  1518.  
  1519. final function PushInventoryScreen()
  1520. {
  1521. var initData : W3MenuInitData;
  1522.  
  1523. if ( theGame.IsBlackscreenOrFading() )
  1524. {
  1525. return;
  1526. }
  1527. if( IsActionAllowed(EIAB_OpenInventory) )
  1528. {
  1529. initData = new W3MenuInitData in theGame.GetGuiManager();
  1530. initData.setDefaultState('CharacterInventory');
  1531. theGame.RequestMenuWithBackground( 'InventoryMenu', 'CommonMenu', initData );
  1532. }
  1533. else
  1534. {
  1535. thePlayer.DisplayActionDisallowedHudMessage(EIAB_OpenInventory);
  1536. }
  1537. }
  1538.  
  1539. final function PushStashScreen()
  1540. {
  1541. var initData : W3MenuInitData;
  1542.  
  1543. if ( theGame.IsBlackscreenOrFading() )
  1544. {
  1545. return;
  1546. }
  1547. if( IsActionAllowed(EIAB_OpenInventory) )
  1548. {
  1549. initData = new W3MenuInitData in theGame.GetGuiManager();
  1550. initData.setDefaultState('StashInventory');
  1551. theGame.RequestMenuWithBackground('InventoryMenu', 'CommonMenu', initData);
  1552. }
  1553. else
  1554. {
  1555. thePlayer.DisplayActionDisallowedHudMessage(EIAB_OpenInventory);
  1556. }
  1557. }
  1558.  
  1559.  
  1560. event OnCommDeckEditor( action : SInputAction )
  1561. {
  1562. if( IsReleased(action) )
  1563. {
  1564. if ( theGame.IsBlackscreenOrFading() )
  1565. {
  1566. return false;
  1567. }
  1568. if (theGame.GetGwintManager().GetHasDoneTutorial() || theGame.GetGwintManager().HasLootedCard())
  1569. {
  1570. if( IsActionAllowed(EIAB_OpenGwint) )
  1571. {
  1572. theGame.RequestMenu( 'DeckBuilder' );
  1573. }
  1574. else
  1575. {
  1576. thePlayer.DisplayActionDisallowedHudMessage(EIAB_OpenGwint);
  1577. }
  1578. }
  1579. }
  1580. }
  1581.  
  1582.  
  1583. event OnCommPanelMed( action : SInputAction )
  1584. {
  1585. if( IsReleased(action) )
  1586. {
  1587. if( IsActionAllowed(EIAB_MeditationWaiting) )
  1588. {
  1589. GetWitcherPlayer().Meditate();
  1590. }
  1591. else
  1592. {
  1593. thePlayer.DisplayActionDisallowedHudMessage(EIAB_MeditationWaiting);
  1594. }
  1595. }
  1596. }
  1597.  
  1598. //---=== modFriendlyHUD ===---
  1599. event OnHoldToSeeMapPC( action : SInputAction )
  1600. {
  1601. if( theInput.IsActionPressed( 'PinModuleModfier' ) )
  1602. {
  1603. if( IsReleased( action ) )
  1604. {
  1605. ToggleMinimapModules( !IsHUDGroupEnabledForReason( GetFHUDConfig().minimapModules, "PinMinimapGroup" ), "PinMinimapGroup" );
  1606. }
  1607. }
  1608. else
  1609. {
  1610. if ( IsPressed(action) )
  1611. {
  1612. thePlayer.AddTimer( 'MapOnTimer' , KEY_HOLD_WINDOW, false );
  1613. }
  1614. if( IsReleased(action) )
  1615. {
  1616. thePlayer.RemoveTimer( 'MapOnTimer' );
  1617. ToggleMinimapModules( false, "MinimapModulesHotkey" );
  1618. }
  1619. }
  1620. }
  1621.  
  1622. private var pressMapTime : float;
  1623. event OnCommPanelMapPC( action : SInputAction )
  1624. {
  1625. if( !theInput.IsActionPressed( 'PinModuleModfier' ) )
  1626. {
  1627. if( IsPressed(action) )
  1628. {
  1629. pressMapTime = theGame.GetEngineTimeAsSeconds();
  1630. }
  1631. if( IsReleased( action ) )
  1632. {
  1633. if ( theGame.GetEngineTimeAsSeconds() - pressMapTime < KEY_HOLD_WINDOW || !ActionsHaveConflict( 'PanelMapPC', 'HoldToSeeMap' ) )
  1634. {
  1635. PushMapScreen();
  1636. }
  1637. }
  1638. }
  1639. }
  1640. //---=== modFriendlyHUD ===---
  1641.  
  1642. event OnCommPanelMap( action : SInputAction )
  1643. {
  1644. if( IsPressed(action) )
  1645. {
  1646. PushMapScreen();
  1647. }
  1648. }
  1649. final function PushMapScreen()
  1650. {
  1651. if ( theGame.IsBlackscreenOrFading() )
  1652. {
  1653. return;
  1654. }
  1655. if( IsActionAllowed(EIAB_OpenMap) )
  1656. {
  1657. theGame.RequestMenuWithBackground( 'MapMenu', 'CommonMenu' );
  1658. }
  1659. else
  1660. {
  1661. thePlayer.DisplayActionDisallowedHudMessage(EIAB_OpenMap);
  1662. }
  1663. }
  1664.  
  1665.  
  1666. //---=== modFriendlyHUD ===---
  1667. event OnHoldToSeeJour( action : SInputAction )
  1668. {
  1669. if( theInput.IsActionPressed( 'PinModuleModfier' ) )
  1670. {
  1671. if( IsReleased( action ) )
  1672. {
  1673. ToggleQuestsModules( !IsHUDGroupEnabledForReason( GetFHUDConfig().questsModules, "PinQuestsGroup" ), "PinQuestsGroup" );
  1674. }
  1675. }
  1676. else
  1677. {
  1678. if ( IsPressed(action) )
  1679. {
  1680. thePlayer.AddTimer( 'QuestsOnTimer' , KEY_HOLD_WINDOW, false );
  1681. }
  1682. if( IsReleased(action) )
  1683. {
  1684. thePlayer.RemoveTimer( 'QuestsOnTimer' );
  1685. ToggleQuestsModules( false, "QuestsModulesHotkey" );
  1686. }
  1687. }
  1688. }
  1689.  
  1690. private var pressJournalTime : float;
  1691. event OnCommPanelJour( action : SInputAction )
  1692. {
  1693. if( !theInput.IsActionPressed( 'PinModuleModfier' ) )
  1694. {
  1695. if( IsPressed(action) )
  1696. {
  1697. pressJournalTime = theGame.GetEngineTimeAsSeconds();
  1698. }
  1699. if( IsReleased( action ) )
  1700. {
  1701. if ( theGame.GetEngineTimeAsSeconds() - pressJournalTime < KEY_HOLD_WINDOW || !ActionsHaveConflict( 'PanelJour', 'HoldToSeeQuests' ) )
  1702. {
  1703. PushJournalScreen();
  1704. }
  1705. }
  1706. }
  1707. }
  1708. //---=== modFriendlyHUD ===---
  1709.  
  1710. final function PushJournalScreen()
  1711. {
  1712. if ( theGame.IsBlackscreenOrFading() )
  1713. {
  1714. return;
  1715. }
  1716. if( IsActionAllowed(EIAB_OpenJournal) )
  1717. {
  1718.  
  1719. theGame.RequestMenuWithBackground( 'JournalQuestMenu', 'CommonMenu' );
  1720. }
  1721. else
  1722. {
  1723. thePlayer.DisplayActionDisallowedHudMessage(EIAB_OpenJournal);
  1724. }
  1725. }
  1726.  
  1727. // W3EE - Begin
  1728. private var pressMeditationTime : float;
  1729. event OnHoldToMeditate( action : SInputAction )
  1730. {
  1731. if( IsReleased(action) )
  1732. {
  1733. if( theGame.GetEngineTimeAsSeconds() - pressMeditationTime < KEY_HOLD_WINDOW )
  1734. {
  1735. if( theInput.LastUsedGamepad() )
  1736. thePlayer.AddTimer('StartW3EEMeditationTimer', 0.1, false);
  1737. else
  1738. thePlayer.AddTimer('W3EEMeditationTimer', 0.1, false);
  1739. }
  1740. }
  1741. }
  1742.  
  1743. event OnCommPanelMeditation( action : SInputAction )
  1744. {
  1745. if( theInput.IsActionPressed('ControllerCastModifier') )
  1746. return false;
  1747.  
  1748. OnHoldToMeditate(action);
  1749.  
  1750. if( IsPressed(action) )
  1751. {
  1752. pressMeditationTime = theGame.GetEngineTimeAsSeconds();
  1753. thePlayer.AddTimer('StartW3EEMeditationTimer', KEY_HOLD_WINDOW, false);
  1754. }
  1755. else
  1756. if( IsReleased(action) )
  1757. {
  1758. thePlayer.RemoveTimer('StartW3EEMeditationTimer');
  1759. }
  1760. }
  1761. // W3EE - End
  1762.  
  1763. final function PushMeditationScreen()
  1764. {
  1765. if ( theGame.IsBlackscreenOrFading() )
  1766. {
  1767. return;
  1768. }
  1769. if( IsActionAllowed(EIAB_OpenMeditation) )
  1770. {
  1771. theGame.RequestMenuWithBackground( 'MeditationClockMenu', 'CommonMenu' );
  1772. }
  1773. else
  1774. {
  1775. thePlayer.DisplayActionDisallowedHudMessage(EIAB_OpenMeditation);
  1776. }
  1777. }
  1778.  
  1779. event OnCommPanelCrafting( action : SInputAction )
  1780. {
  1781. if( IsReleased(action) )
  1782. {
  1783. PushCraftingScreen();
  1784. }
  1785. }
  1786.  
  1787. final function PushCraftingScreen()
  1788. {
  1789. if ( theGame.IsBlackscreenOrFading() )
  1790. {
  1791. return;
  1792. }
  1793.  
  1794. theGame.RequestMenuWithBackground( 'CraftingMenu', 'CommonMenu' );
  1795. }
  1796.  
  1797.  
  1798. event OnCommPanelBestiary( action : SInputAction )
  1799. {
  1800. if( IsReleased(action) )
  1801. {
  1802. PushBestiaryScreen();
  1803. }
  1804. }
  1805.  
  1806. final function PushBestiaryScreen()
  1807. {
  1808. if ( theGame.IsBlackscreenOrFading() )
  1809. {
  1810. return;
  1811. }
  1812. if( IsActionAllowed(EIAB_OpenGlossary) )
  1813. {
  1814. theGame.RequestMenuWithBackground( 'GlossaryBestiaryMenu', 'CommonMenu' );
  1815. }
  1816. else
  1817. {
  1818. thePlayer.DisplayActionDisallowedHudMessage(EIAB_OpenGlossary);
  1819. }
  1820. }
  1821.  
  1822. event OnCommPanelAlch( action : SInputAction )
  1823. {
  1824. if( IsReleased(action) )
  1825. {
  1826. PushAlchemyScreen();
  1827. }
  1828. }
  1829. final function PushAlchemyScreen()
  1830. {
  1831. if ( theGame.IsBlackscreenOrFading() )
  1832. {
  1833. return;
  1834. }
  1835. if( IsActionAllowed(EIAB_OpenAlchemy) )
  1836. {
  1837. theGame.RequestMenuWithBackground( 'AlchemyMenu', 'CommonMenu' );
  1838. }
  1839. else
  1840. {
  1841. thePlayer.DisplayActionDisallowedHudMessage(EIAB_OpenAlchemy);
  1842. }
  1843. }
  1844.  
  1845. event OnCommPanelGlossary( action : SInputAction )
  1846. {
  1847. if( IsReleased(action) )
  1848. {
  1849. PushGlossaryScreen();
  1850. }
  1851. }
  1852. final function PushGlossaryScreen()
  1853. {
  1854. if ( theGame.IsBlackscreenOrFading() )
  1855. {
  1856. return;
  1857. }
  1858. if( IsActionAllowed(EIAB_OpenGlossary) )
  1859. {
  1860. theGame.RequestMenuWithBackground( 'GlossaryEncyclopediaMenu', 'CommonMenu' );
  1861. }
  1862. else
  1863. {
  1864. thePlayer.DisplayActionDisallowedHudMessage(EIAB_OpenGlossary);
  1865. }
  1866. }
  1867.  
  1868. //===modWitcherLoreCollection=== BEGIN
  1869. event OnCommPanelBooks( action : SInputAction )
  1870. {
  1871. if( IsReleased(action) )
  1872. {
  1873. PushBooksScreen();
  1874. }
  1875. }
  1876. final function PushBooksScreen()
  1877. {
  1878. if ( theGame.IsBlackscreenOrFading() )
  1879. {
  1880. return;
  1881. }
  1882. if( IsActionAllowed(EIAB_OpenGlossary) )
  1883. {
  1884. theGame.RequestMenuWithBackground( 'GlossaryBooksMenu', 'CommonMenu' );
  1885. }
  1886. else
  1887. {
  1888. thePlayer.DisplayActionDisallowedHudMessage(EIAB_OpenGlossary);
  1889. }
  1890. }
  1891. //===modWitcherLoreCollection=== END
  1892.  
  1893. event OnShowControlsHelp( action : SInputAction )
  1894. {
  1895. if( IsReleased(action) )
  1896. {
  1897. if ( theGame.IsBlackscreenOrFading() )
  1898. {
  1899. return false;
  1900. }
  1901.  
  1902.  
  1903. }
  1904. }
  1905.  
  1906. event OnCommPanelUIResize( action : SInputAction )
  1907. {
  1908. if( IsReleased(action) )
  1909. {
  1910. if ( theGame.IsBlackscreenOrFading() )
  1911. {
  1912. return false;
  1913. }
  1914. theGame.RequestMenu( 'RescaleMenu' );
  1915. }
  1916. }
  1917.  
  1918. event OnCommPanelFakeHud( action : SInputAction )
  1919. {
  1920. if( IsReleased(action) )
  1921. {
  1922. if ( theGame.IsBlackscreenOrFading() )
  1923. {
  1924. return false;
  1925. }
  1926.  
  1927. }
  1928. }
  1929.  
  1930.  
  1931.  
  1932.  
  1933. private var processedSwordHold : bool;
  1934.  
  1935. event OnCommSteelSword( action : SInputAction )
  1936. {
  1937. var duringCastSign : bool;
  1938.  
  1939. if(IsPressed(action))
  1940. processedSwordHold = false;
  1941.  
  1942. if ( theInput.LastUsedGamepad() && theInput.IsActionPressed('Alternate') )
  1943. {
  1944. return false;
  1945. }
  1946.  
  1947. if ( IsReleased(action) || ( IsPressed(action) && (thePlayer.GetCurrentMeleeWeaponType() == PW_None || thePlayer.GetCurrentMeleeWeaponType() == PW_Fists) ) )
  1948. {
  1949. if( !processedSwordHold )
  1950. {
  1951. if ( IsActionAllowed(EIAB_DrawWeapon) && thePlayer.GetBIsInputAllowed() && thePlayer.GetWeaponHolster().IsMeleeWeaponReady() )
  1952. {
  1953. thePlayer.PushCombatActionOnBuffer( EBAT_Draw_Steel, BS_Pressed );
  1954. if ( thePlayer.GetBIsCombatActionAllowed() )
  1955. thePlayer.ProcessCombatActionBuffer();
  1956. }
  1957. processedSwordHold = true;
  1958. }
  1959. }
  1960. }
  1961.  
  1962. event OnCommSilverSword( action : SInputAction )
  1963. {
  1964. var duringCastSign : bool;
  1965.  
  1966. if( IsPressed(action) )
  1967. processedSwordHold = false;
  1968.  
  1969. if ( theInput.LastUsedGamepad() && theInput.IsActionPressed('Alternate') )
  1970. {
  1971. return false;
  1972. }
  1973.  
  1974. if ( IsReleased(action) || ( IsPressed(action) && (thePlayer.GetCurrentMeleeWeaponType() == PW_None || thePlayer.GetCurrentMeleeWeaponType() == PW_Fists) ) )
  1975. {
  1976. if( !processedSwordHold )
  1977. {
  1978. if ( IsActionAllowed(EIAB_DrawWeapon) && thePlayer.GetBIsInputAllowed() && thePlayer.GetWeaponHolster().IsMeleeWeaponReady() )
  1979. {
  1980. thePlayer.PushCombatActionOnBuffer( EBAT_Draw_Silver, BS_Pressed );
  1981. if ( thePlayer.GetBIsCombatActionAllowed() || duringCastSign )
  1982. thePlayer.ProcessCombatActionBuffer();
  1983. }
  1984. processedSwordHold = true;
  1985. }
  1986.  
  1987. }
  1988. }
  1989.  
  1990. event OnCommSheatheAny( action : SInputAction )
  1991. {
  1992. var duringCastSign : bool;
  1993.  
  1994. if( IsPressed( action ) )
  1995. {
  1996. if ( thePlayer.GetBIsInputAllowed() && thePlayer.GetWeaponHolster().IsMeleeWeaponReady() )
  1997. {
  1998. thePlayer.PushCombatActionOnBuffer( EBAT_Sheathe_Sword, BS_Pressed );
  1999. if ( thePlayer.GetBIsCombatActionAllowed() || duringCastSign )
  2000. {
  2001. thePlayer.ProcessCombatActionBuffer();
  2002. }
  2003. }
  2004. processedSwordHold = true;
  2005. }
  2006. }
  2007.  
  2008. event OnCommSheatheSteel( action : SInputAction )
  2009. {
  2010. if( IsPressed( action ) && thePlayer.IsWeaponHeld( 'steelsword' ) && !processedSwordHold)
  2011. {
  2012. OnCommSheatheAny(action);
  2013. }
  2014. }
  2015.  
  2016. event OnCommSheatheSilver( action : SInputAction )
  2017. {
  2018. if( IsPressed( action ) && thePlayer.IsWeaponHeld( 'silversword' ) && !processedSwordHold)
  2019. {
  2020. OnCommSheatheAny(action);
  2021. }
  2022. }
  2023.  
  2024. event OnCommDrinkPot( action : SInputAction )
  2025. {
  2026. if(IsPressed(action))
  2027. {
  2028. if(!potPress)
  2029. {
  2030. potPress = true;
  2031. potAction = action;
  2032. thePlayer.AddTimer('PotDrinkTimer', 0.3);
  2033. }
  2034. else
  2035. {
  2036. PotDrinkTimer(true);
  2037. thePlayer.RemoveTimer('PotDrinkTimer');
  2038. }
  2039. }
  2040. }
  2041.  
  2042. public function PotDrinkTimer(isDoubleTapped : bool)
  2043. {
  2044. thePlayer.RemoveTimer('PotDrinkTimer');
  2045. potPress = false;
  2046.  
  2047. if(isDoubleTapped)
  2048. OnCommDrinkPotion2(potAction);
  2049. else
  2050. OnCommDrinkPotion1(potAction);
  2051. }
  2052.  
  2053.  
  2054.  
  2055.  
  2056. event OnCbtComboDigitLeft( action : SInputAction )
  2057. {
  2058. if ( theInput.IsActionPressed('Alternate') )
  2059. {
  2060. OnTogglePreviousSign(action);
  2061. }
  2062. }
  2063.  
  2064. event OnCbtComboDigitRight( action : SInputAction )
  2065. {
  2066. if ( theInput.IsActionPressed('Alternate') )
  2067. {
  2068. OnToggleNextSign(action);
  2069. }
  2070. }
  2071.  
  2072.  
  2073. event OnSelectSign(action : SInputAction)
  2074. {
  2075. if( IsPressed( action ) )
  2076. {
  2077. switch( action.aName )
  2078. {
  2079. case 'SelectAard' :
  2080. GetWitcherPlayer().SetEquippedSign(ST_Aard);
  2081. break;
  2082. case 'SelectYrden' :
  2083. GetWitcherPlayer().SetEquippedSign(ST_Yrden);
  2084. break;
  2085. case 'SelectIgni' :
  2086. GetWitcherPlayer().SetEquippedSign(ST_Igni);
  2087. break;
  2088. case 'SelectQuen' :
  2089. GetWitcherPlayer().SetEquippedSign(ST_Quen);
  2090. break;
  2091. case 'SelectAxii' :
  2092. GetWitcherPlayer().SetEquippedSign(ST_Axii);
  2093. break;
  2094. default :
  2095. break;
  2096. }
  2097. // W3EE - Begin
  2098. GetWitcherPlayer().GetTimeStampSign();
  2099. if( Options().SignInstantCast() )
  2100. OnCastSign(action);
  2101. }
  2102. if( IsReleased(action) )
  2103. GetWitcherPlayer().ResetCastInput();
  2104. // W3EE - End
  2105. }
  2106.  
  2107. event OnToggleSigns( action : SInputAction )
  2108. {
  2109. var tolerance : float;
  2110. tolerance = 2.5f;
  2111.  
  2112. if( action.value < -tolerance )
  2113. {
  2114. GetWitcherPlayer().TogglePreviousSign();
  2115. }
  2116. else if( action.value > tolerance )
  2117. {
  2118. GetWitcherPlayer().ToggleNextSign();
  2119. }
  2120. }
  2121. event OnToggleNextSign( action : SInputAction )
  2122. {
  2123. if( IsPressed( action ) )
  2124. {
  2125. GetWitcherPlayer().ToggleNextSign();
  2126. }
  2127. }
  2128. event OnTogglePreviousSign( action : SInputAction )
  2129. {
  2130. if( IsPressed( action ) )
  2131. {
  2132. GetWitcherPlayer().TogglePreviousSign();
  2133. }
  2134. }
  2135.  
  2136. event OnToggleItem( action : SInputAction )
  2137. {
  2138. if( !IsActionAllowed( EIAB_QuickSlots ) )
  2139. {
  2140. thePlayer.DisplayActionDisallowedHudMessage(EIAB_QuickSlots);
  2141. return false;
  2142. }
  2143.  
  2144. if( IsReleased( action ) )
  2145. {
  2146. if( theInput.GetLastActivationTime( action.aName ) < 0.3 )
  2147. GetWitcherPlayer().ToggleNextItem();
  2148. }
  2149. }
  2150.  
  2151.  
  2152.  
  2153.  
  2154.  
  2155. event OnCommDrinkpotionUpperHeld( action : SInputAction )
  2156. {
  2157. //---=== modFriendlyHUD ===---
  2158. if( theInput.LastUsedGamepad() && GetFHUDConfig().enableItemsInRadialMenu && ((CR4HudModuleRadialMenu)theGame.GetHud().GetHudModule( "RadialMenuModule" )).IsRadialMenuOpened() )
  2159. {
  2160. return false;
  2161. }
  2162. //---=== modFriendlyHUD ===---
  2163.  
  2164. if(!potionModeHold)
  2165. return false;
  2166.  
  2167.  
  2168. if(thePlayer.IsCiri())
  2169. return false;
  2170.  
  2171. if(IsReleased(action))
  2172. return false;
  2173.  
  2174. potionUpperHeld = true;
  2175. GetWitcherPlayer().FlipSelectedPotion(true);
  2176. }
  2177.  
  2178. event OnCommDrinkpotionLowerHeld( action : SInputAction )
  2179. {
  2180. //---=== modFriendlyHUD ===---
  2181. if( theInput.LastUsedGamepad() && GetFHUDConfig().enableItemsInRadialMenu && ((CR4HudModuleRadialMenu)theGame.GetHud().GetHudModule( "RadialMenuModule" )).IsRadialMenuOpened() )
  2182. {
  2183. return false;
  2184. }
  2185. //---=== modFriendlyHUD ===---
  2186.  
  2187. if(!potionModeHold)
  2188. return false;
  2189.  
  2190.  
  2191. if(thePlayer.IsCiri())
  2192. return false;
  2193.  
  2194. if(IsReleased(action))
  2195. return false;
  2196.  
  2197. potionLowerHeld = true;
  2198. GetWitcherPlayer().FlipSelectedPotion(false);
  2199. }
  2200.  
  2201. public final function SetPotionSelectionMode(b : bool)
  2202. {
  2203. potionModeHold = b;
  2204. }
  2205.  
  2206. private final function DrinkPotion(action : SInputAction, upperSlot : bool) : bool
  2207. {
  2208. var witcher : W3PlayerWitcher;
  2209.  
  2210. if ( potionModeHold && IsReleased(action) )
  2211. {
  2212. if(!potionUpperHeld && !potionLowerHeld)
  2213. {
  2214. GetWitcherPlayer().OnPotionDrinkInput(upperSlot);
  2215. }
  2216.  
  2217. if(upperSlot)
  2218. potionUpperHeld = false;
  2219. else
  2220. potionLowerHeld = false;
  2221. }
  2222. else if(!potionModeHold && IsPressed(action))
  2223. {
  2224. witcher = GetWitcherPlayer();
  2225. if(!witcher.IsPotionDoubleTapRunning())
  2226. {
  2227. witcher.SetPotionDoubleTapRunning(true, upperSlot);
  2228. return true;
  2229. }
  2230. else
  2231. {
  2232. witcher.SetPotionDoubleTapRunning(false);
  2233. witcher.FlipSelectedPotion(upperSlot);
  2234. return true;
  2235. }
  2236. }
  2237.  
  2238. return false;
  2239. }
  2240.  
  2241.  
  2242. event OnCommDrinkPotion1( action : SInputAction )
  2243. {
  2244. //---=== modFriendlyHUD ===---
  2245. if( theInput.LastUsedGamepad() && GetFHUDConfig().enableItemsInRadialMenu && ((CR4HudModuleRadialMenu)theGame.GetHud().GetHudModule( "RadialMenuModule" )).IsRadialMenuOpened() )
  2246. {
  2247. return false;
  2248. }
  2249. //---=== modFriendlyHUD ===---
  2250.  
  2251. if(thePlayer.IsCiri())
  2252. return false;
  2253.  
  2254. if( !IsActionAllowed( EIAB_QuickSlots ) )
  2255. {
  2256. thePlayer.DisplayActionDisallowedHudMessage(EIAB_QuickSlots);
  2257. return false;
  2258. }
  2259.  
  2260. if ( theInput.LastUsedGamepad() )
  2261. {
  2262. return DrinkPotion(action, true);
  2263. }
  2264. else
  2265. if ( IsReleased(action) )
  2266. {
  2267. GetWitcherPlayer().OnPotionDrinkKeyboardsInput(EES_Potion1);
  2268. return true;
  2269. }
  2270.  
  2271. return false;
  2272. }
  2273.  
  2274.  
  2275. event OnCommDrinkPotion2( action : SInputAction )
  2276. {
  2277. var witcher : W3PlayerWitcher;
  2278.  
  2279. //---=== modFriendlyHUD ===---
  2280. if( theInput.LastUsedGamepad() && GetFHUDConfig().enableItemsInRadialMenu && ((CR4HudModuleRadialMenu)theGame.GetHud().GetHudModule( "RadialMenuModule" )).IsRadialMenuOpened() )
  2281. {
  2282. return false;
  2283. }
  2284. //---=== modFriendlyHUD ===---
  2285.  
  2286. if(thePlayer.IsCiri())
  2287. return false;
  2288.  
  2289. if( !IsActionAllowed( EIAB_QuickSlots ) )
  2290. {
  2291. thePlayer.DisplayActionDisallowedHudMessage(EIAB_QuickSlots);
  2292. return false;
  2293. }
  2294.  
  2295. if ( theInput.LastUsedGamepad() )
  2296. {
  2297. return DrinkPotion(action, false);
  2298. }
  2299. else
  2300. if ( IsReleased(action) )
  2301. {
  2302. GetWitcherPlayer().OnPotionDrinkKeyboardsInput(EES_Potion2);
  2303. return true;
  2304. }
  2305.  
  2306. return false;
  2307. }
  2308.  
  2309.  
  2310. event OnCommDrinkPotion3( action : SInputAction )
  2311. {
  2312. //---=== modFriendlyHUD ===---
  2313. if( theInput.LastUsedGamepad() && GetFHUDConfig().enableItemsInRadialMenu && ((CR4HudModuleRadialMenu)theGame.GetHud().GetHudModule( "RadialMenuModule" )).IsRadialMenuOpened() )
  2314. {
  2315. return false;
  2316. }
  2317. //---=== modFriendlyHUD ===---
  2318.  
  2319. if(thePlayer.IsCiri())
  2320. return false;
  2321.  
  2322. if( !IsActionAllowed( EIAB_QuickSlots ) )
  2323. {
  2324. thePlayer.DisplayActionDisallowedHudMessage(EIAB_QuickSlots);
  2325. return false;
  2326. }
  2327.  
  2328. if ( IsReleased(action) )
  2329. {
  2330. GetWitcherPlayer().OnPotionDrinkKeyboardsInput(EES_Potion3);
  2331. return true;
  2332. }
  2333.  
  2334. return false;
  2335. }
  2336.  
  2337.  
  2338. event OnCommDrinkPotion4( action : SInputAction )
  2339. {
  2340. var witcher : W3PlayerWitcher;
  2341.  
  2342. //---=== modFriendlyHUD ===---
  2343. if( theInput.LastUsedGamepad() && GetFHUDConfig().enableItemsInRadialMenu && ((CR4HudModuleRadialMenu)theGame.GetHud().GetHudModule( "RadialMenuModule" )).IsRadialMenuOpened() )
  2344. {
  2345. return false;
  2346. }
  2347. //---=== modFriendlyHUD ===---
  2348.  
  2349. if(thePlayer.IsCiri())
  2350. return false;
  2351.  
  2352. if( !IsActionAllowed( EIAB_QuickSlots ) )
  2353. {
  2354. thePlayer.DisplayActionDisallowedHudMessage(EIAB_QuickSlots);
  2355. return false;
  2356. }
  2357.  
  2358. if ( IsReleased(action) )
  2359. {
  2360. GetWitcherPlayer().OnPotionDrinkKeyboardsInput(EES_Potion4);
  2361. return true;
  2362. }
  2363.  
  2364. return false;
  2365. }
  2366.  
  2367.  
  2368.  
  2369.  
  2370.  
  2371. event OnDiving( action : SInputAction )
  2372. {
  2373. if ( IsPressed(action) && IsActionAllowed(EIAB_Dive) )
  2374. {
  2375. if ( action.aName == 'DiveDown' )
  2376. {
  2377. if ( thePlayer.OnAllowedDiveDown() )
  2378. {
  2379. if ( !thePlayer.OnCheckDiving() )
  2380. thePlayer.OnDive();
  2381.  
  2382. if ( thePlayer.bLAxisReleased )
  2383. thePlayer.SetBehaviorVariable( 'divePitch',-1.0);
  2384. else
  2385. thePlayer.SetBehaviorVariable( 'divePitch', -0.9);
  2386. thePlayer.OnDiveInput(-1.f);
  2387.  
  2388. if ( thePlayer.rangedWeapon.GetCurrentStateName() != 'State_WeaponWait' )
  2389. {
  2390. thePlayer.OnRangedForceHolster( true, false );
  2391. thePlayer.OnFullyBlendedIdle();
  2392. }
  2393. }
  2394. }
  2395. else if ( action.aName == 'DiveUp' )
  2396. {
  2397. if ( thePlayer.bLAxisReleased )
  2398. thePlayer.SetBehaviorVariable( 'divePitch',1.0);
  2399. else
  2400. thePlayer.SetBehaviorVariable( 'divePitch', 0.9);
  2401.  
  2402. if ( thePlayer.rangedWeapon.GetCurrentStateName() != 'State_WeaponWait' )
  2403. {
  2404. thePlayer.OnRangedForceHolster( true, false );
  2405. thePlayer.OnFullyBlendedIdle();
  2406. }
  2407.  
  2408. thePlayer.OnDiveInput(1.f);
  2409. }
  2410. }
  2411. else if ( IsReleased(action) )
  2412. {
  2413. thePlayer.SetBehaviorVariable( 'divePitch',0.0);
  2414. thePlayer.OnDiveInput(0.f);
  2415. }
  2416. else if ( IsPressed(action) && !IsActionAllowed(EIAB_Dive) )
  2417. {
  2418. thePlayer.DisplayActionDisallowedHudMessage(EIAB_Dive);
  2419. }
  2420. }
  2421.  
  2422. event OnDivingDodge( action : SInputAction )
  2423. {
  2424. var isDodgeAllowed : bool;
  2425.  
  2426. if( IsPressed(action) )
  2427. {
  2428. isDodgeAllowed = IsActionAllowed(EIAB_Dodge);
  2429. if( isDodgeAllowed && IsActionAllowed(EIAB_Dive) )
  2430. {
  2431. if ( thePlayer.OnCheckDiving() && thePlayer.GetBIsInputAllowed() )
  2432. {
  2433. thePlayer.PushCombatActionOnBuffer( EBAT_Dodge, BS_Pressed );
  2434. if ( thePlayer.GetBIsCombatActionAllowed() )
  2435. thePlayer.ProcessCombatActionBuffer();
  2436. }
  2437. }
  2438. else
  2439. {
  2440. if(!isDodgeAllowed)
  2441. thePlayer.DisplayActionDisallowedHudMessage(EIAB_Dodge);
  2442. else
  2443. thePlayer.DisplayActionDisallowedHudMessage(EIAB_Dive);
  2444. }
  2445. }
  2446. }
  2447.  
  2448.  
  2449.  
  2450.  
  2451.  
  2452. event OnExpFistFightLight( action : SInputAction )
  2453. {
  2454. var fistsAllowed : bool;
  2455.  
  2456. if( IsPressed(action) )
  2457. {
  2458. fistsAllowed = IsActionAllowed(EIAB_Fists);
  2459. if( fistsAllowed && IsActionAllowed(EIAB_LightAttacks) )
  2460. {
  2461.  
  2462. thePlayer.SetupCombatAction( EBAT_LightAttack, BS_Pressed );
  2463. }
  2464. else
  2465. {
  2466. if(!fistsAllowed)
  2467. thePlayer.DisplayActionDisallowedHudMessage(EIAB_Fists);
  2468. else
  2469. thePlayer.DisplayActionDisallowedHudMessage(EIAB_LightAttacks);
  2470. }
  2471. }
  2472. }
  2473.  
  2474. event OnExpFistFightHeavy( action : SInputAction )
  2475. {
  2476. var fistsAllowed : bool;
  2477.  
  2478. if( IsPressed(action) )
  2479. {
  2480. fistsAllowed = IsActionAllowed(EIAB_Fists);
  2481. if( fistsAllowed && IsActionAllowed(EIAB_HeavyAttacks) )
  2482. {
  2483.  
  2484. thePlayer.SetupCombatAction( EBAT_HeavyAttack, BS_Pressed );
  2485. }
  2486. else
  2487. {
  2488. if(!fistsAllowed)
  2489. thePlayer.DisplayActionDisallowedHudMessage(EIAB_Fists);
  2490. else
  2491. thePlayer.DisplayActionDisallowedHudMessage(EIAB_HeavyAttacks);
  2492. }
  2493. }
  2494. }
  2495.  
  2496.  
  2497.  
  2498. event OnExpFocus( action : SInputAction )
  2499. {
  2500. if(IsActionAllowed(EIAB_ExplorationFocus))
  2501. {
  2502. if( IsPressed( action ) )
  2503. {
  2504. if( thePlayer.GoToCombatIfNeeded() )
  2505. {
  2506. OnCommGuard( action );
  2507. return false;
  2508. }
  2509.  
  2510. if( theGame.GetFocusModeController().IsActive() )
  2511. theGame.GetFocusModeController().Deactivate();
  2512. else
  2513. theGame.GetFocusModeController().Activate();
  2514. }
  2515. //Kolaris - Witcher Sense Toggle
  2516. else if( IsReleased( action ) && !Options().WitcherSenseToggle() )
  2517. {
  2518. theGame.GetFocusModeController().Deactivate();
  2519. }
  2520.  
  2521. }
  2522. else
  2523. {
  2524. thePlayer.DisplayActionDisallowedHudMessage(EIAB_ExplorationFocus);
  2525. theGame.GetFocusModeController().Deactivate();
  2526. }
  2527. }
  2528.  
  2529.  
  2530.  
  2531.  
  2532. private function ShouldSwitchAttackType():bool
  2533. {
  2534. var outKeys : array<EInputKey>;
  2535.  
  2536. if ( theInput.LastUsedPCInput() )
  2537. {
  2538. theInput.GetPCKeysForAction('PCAlternate',outKeys);
  2539. if ( outKeys.Size() > 0 )
  2540. {
  2541. if ( theInput.IsActionPressed('PCAlternate') )
  2542. {
  2543. return true;
  2544. }
  2545. }
  2546. }
  2547. return false;
  2548. }
  2549.  
  2550. event OnCbtAttackWithAlternateLight( action : SInputAction )
  2551. {
  2552. CbtAttackPC( action, false);
  2553. }
  2554.  
  2555. event OnCbtAttackWithAlternateHeavy( action : SInputAction )
  2556. {
  2557. CbtAttackPC( action, true);
  2558. }
  2559.  
  2560. function CbtAttackPC( action : SInputAction, isHeavy : bool )
  2561. {
  2562. var switchAttackType : bool;
  2563.  
  2564. switchAttackType = ShouldSwitchAttackType();
  2565.  
  2566. if ( !theInput.LastUsedPCInput() )
  2567. {
  2568. return;
  2569. }
  2570.  
  2571. if ( thePlayer.IsCiri() )
  2572. {
  2573. if ( switchAttackType != isHeavy)
  2574. {
  2575. OnCbtCiriAttackHeavy(action);
  2576. }
  2577. else
  2578. {
  2579. OnCbtAttackLight(action);
  2580. }
  2581. }
  2582. else
  2583. {
  2584. if ( switchAttackType != isHeavy)
  2585. {
  2586. OnCbtAttackHeavy(action);
  2587. }
  2588. else
  2589. {
  2590. OnCbtAttackLight(action);
  2591. }
  2592. }
  2593. }
  2594.  
  2595. event OnCbtAttackLight( action : SInputAction )
  2596. {
  2597. var allowed, checkedFists : bool;
  2598.  
  2599. if( IsPressed(action) )
  2600. {
  2601. // W3EE - Begin
  2602. if( thePlayer.IsGuarded() )
  2603. {
  2604. if( Combat().PerformLightBash() )
  2605. return false;
  2606. }
  2607. // W3EE - End
  2608.  
  2609. if( IsActionAllowed(EIAB_LightAttacks) )
  2610. {
  2611. if (thePlayer.GetBIsInputAllowed())
  2612. {
  2613. allowed = false;
  2614.  
  2615. if( thePlayer.GetCurrentMeleeWeaponType() == PW_Fists || thePlayer.GetCurrentMeleeWeaponType() == PW_None )
  2616. {
  2617. checkedFists = true;
  2618. if(IsActionAllowed(EIAB_Fists))
  2619. allowed = true;
  2620. }
  2621. else if(IsActionAllowed(EIAB_SwordAttack))
  2622. {
  2623. checkedFists = false;
  2624. allowed = true;
  2625. }
  2626.  
  2627. if(allowed)
  2628. {
  2629. thePlayer.SetupCombatAction( EBAT_LightAttack, BS_Pressed );
  2630. }
  2631. else
  2632. {
  2633. if(checkedFists)
  2634. thePlayer.DisplayActionDisallowedHudMessage(EIAB_Fists);
  2635. else
  2636. thePlayer.DisplayActionDisallowedHudMessage(EIAB_SwordAttack);
  2637. }
  2638. }
  2639. }
  2640. else if ( !IsActionBlockedBy(EIAB_LightAttacks,'interaction') )
  2641. {
  2642. thePlayer.DisplayActionDisallowedHudMessage(EIAB_LightAttacks);
  2643. }
  2644. }
  2645. }
  2646.  
  2647. event OnCbtAttackHeavy( action : SInputAction )
  2648. {
  2649. var allowed, checkedSword : bool;
  2650. var outKeys : array<EInputKey>;
  2651.  
  2652. if ( thePlayer.GetBIsInputAllowed() )
  2653. {
  2654. // W3EE - Begin
  2655. if( thePlayer.IsGuarded() )
  2656. {
  2657. if( Combat().PerformHeavyBash() )
  2658. {
  2659. return false;
  2660. }
  2661. }
  2662. // W3EE - End
  2663.  
  2664. if( IsActionAllowed(EIAB_HeavyAttacks) )
  2665. {
  2666. allowed = false;
  2667.  
  2668. if( thePlayer.GetCurrentMeleeWeaponType() == PW_Fists || thePlayer.GetCurrentMeleeWeaponType() == PW_None )
  2669. {
  2670. checkedSword = false;
  2671. if(IsActionAllowed(EIAB_Fists))
  2672. allowed = true;
  2673. }
  2674. else if(IsActionAllowed(EIAB_SwordAttack))
  2675. {
  2676. checkedSword = true;
  2677. allowed = true;
  2678. }
  2679.  
  2680. if(allowed)
  2681. {
  2682. if ( ( thePlayer.GetCurrentMeleeWeaponType() == PW_Fists || thePlayer.GetCurrentMeleeWeaponType() == PW_None ) && IsPressed(action) )
  2683. {
  2684. thePlayer.SetupCombatAction( EBAT_HeavyAttack, BS_Released );
  2685. }
  2686. else
  2687. {
  2688. if( IsReleased(action) && theInput.GetLastActivationTime( action.aName ) < 0.2 )
  2689. {
  2690. thePlayer.SetupCombatAction( EBAT_HeavyAttack, BS_Released );
  2691. }
  2692. }
  2693. }
  2694. else
  2695. {
  2696. if(checkedSword)
  2697. thePlayer.DisplayActionDisallowedHudMessage(EIAB_SwordAttack);
  2698. else
  2699. thePlayer.DisplayActionDisallowedHudMessage(EIAB_Fists);
  2700. }
  2701. }
  2702. else if ( !IsActionBlockedBy(EIAB_HeavyAttacks,'interaction') )
  2703. {
  2704. thePlayer.DisplayActionDisallowedHudMessage(EIAB_HeavyAttacks);
  2705. }
  2706. }
  2707. }
  2708.  
  2709. private function CheckFinisherInput() : bool
  2710. {
  2711. var enemyInCone : CActor;
  2712. var npc : CNewNPC;
  2713. var interactionTarget : CInteractionComponent;
  2714.  
  2715. var isDeadlySwordHeld : bool;
  2716.  
  2717. interactionTarget = theGame.GetInteractionsManager().GetActiveInteraction();
  2718. if ( interactionTarget && interactionTarget.GetName() == "Finish" )
  2719. {
  2720. npc = (CNewNPC)( interactionTarget.GetEntity() );
  2721.  
  2722. isDeadlySwordHeld = thePlayer.IsDeadlySwordHeld();
  2723. if( ( theInput.GetActionValue( 'AttackHeavy' ) == 1.f || theInput.GetActionValue( 'AttackLight' ) == 1.f )
  2724. && isDeadlySwordHeld )
  2725. {
  2726. theGame.RemoveTimeScale( theGame.GetTimescaleSource(ETS_FinisherInput) );
  2727. npc.SignalGameplayEvent('Finisher');
  2728.  
  2729. }
  2730. else if ( !isDeadlySwordHeld )
  2731. {
  2732. if ( thePlayer.IsWeaponHeld( 'fist' ))
  2733. thePlayer.SetBehaviorVariable( 'combatTauntType', 1.f );
  2734. else
  2735. thePlayer.SetBehaviorVariable( 'combatTauntType', 0.f );
  2736.  
  2737. thePlayer.RaiseEvent( 'CombatTaunt' );
  2738. }
  2739.  
  2740. return true;
  2741.  
  2742. }
  2743. return false;
  2744. }
  2745.  
  2746. private function IsPlayerAbleToPerformSpecialAttack() : bool
  2747. {
  2748. if( ( thePlayer.GetCurrentStateName() == 'Exploration' ) && !( thePlayer.IsWeaponHeld( 'silversword' ) || thePlayer.IsWeaponHeld( 'steelsword' ) ) )
  2749. {
  2750. return false;
  2751. }
  2752. return true;
  2753. }
  2754.  
  2755. event OnCbtSpecialAttackWithAlternateLight( action : SInputAction )
  2756. {
  2757. CbSpecialAttackPC( action, false);
  2758. }
  2759.  
  2760. event OnCbtSpecialAttackWithAlternateHeavy( action : SInputAction )
  2761. {
  2762. CbSpecialAttackPC( action, true);
  2763. }
  2764.  
  2765. function CbSpecialAttackPC( action : SInputAction, isHeavy : bool )
  2766. {
  2767. var switchAttackType : bool;
  2768.  
  2769. switchAttackType = ShouldSwitchAttackType();
  2770.  
  2771. if ( !theInput.LastUsedPCInput() )
  2772. {
  2773. return;
  2774. }
  2775.  
  2776. if ( IsPressed(action) )
  2777. {
  2778. if ( thePlayer.IsCiri() )
  2779. {
  2780.  
  2781. OnCbtCiriSpecialAttackHeavy(action);
  2782. }
  2783. else
  2784. {
  2785. if (switchAttackType != isHeavy)
  2786. {
  2787. OnCbtSpecialAttackHeavy(action);
  2788. }
  2789. else
  2790. {
  2791. OnCbtSpecialAttackLight(action);
  2792. }
  2793. }
  2794. }
  2795. else if ( IsReleased( action ) )
  2796. {
  2797. if ( thePlayer.IsCiri() )
  2798. {
  2799. OnCbtCiriSpecialAttackHeavy(action);
  2800. }
  2801. else
  2802. {
  2803.  
  2804. OnCbtSpecialAttackHeavy(action);
  2805. OnCbtSpecialAttackLight(action);
  2806. }
  2807. }
  2808. }
  2809.  
  2810. // W3EE - Begin
  2811. event OnCbtSpecialAttackLight( action : SInputAction )
  2812. {
  2813. if( IsReleased( action ) )
  2814. {
  2815. thePlayer.CancelHoldAttacks();
  2816. return true;
  2817. }
  2818.  
  2819. if( !IsPlayerAbleToPerformSpecialAttack() || Combat().IsUsingBattleAxe() || Combat().IsUsingBattleMace() )
  2820. return false;
  2821.  
  2822. if( !IsActionAllowed(EIAB_LightAttacks) )
  2823. {
  2824. thePlayer.DisplayActionDisallowedHudMessage(EIAB_LightAttacks);
  2825. return false;
  2826. }
  2827. if( !IsActionAllowed(EIAB_SpecialAttackLight) )
  2828. {
  2829. thePlayer.DisplayActionDisallowedHudMessage(EIAB_SpecialAttackLight);
  2830. return false;
  2831. }
  2832.  
  2833. if( Combat().CanUseWhirl(action) )
  2834. {
  2835. thePlayer.PrepareToAttack();
  2836. thePlayer.SetPlayedSpecialAttackMissingResourceSound(false);
  2837. thePlayer.AddTimer( 'IsSpecialLightAttackInputHeld', 0.00001, true );
  2838. }
  2839. }
  2840.  
  2841. private var isRendCanceled : bool; default isRendCanceled = false;
  2842. public function IsRendCanceled() : bool
  2843. {
  2844. return isRendCanceled;
  2845. }
  2846.  
  2847. event OnCbtSpecialAttackHeavy( action : SInputAction )
  2848. {
  2849. if( IsReleased( action ) )
  2850. {
  2851. isRendCanceled = true;
  2852. thePlayer.CancelHoldAttacks();
  2853. return true;
  2854. }
  2855.  
  2856. if( !IsPlayerAbleToPerformSpecialAttack() )
  2857. return false;
  2858.  
  2859. if( !IsActionAllowed(EIAB_HeavyAttacks) )
  2860. {
  2861. thePlayer.DisplayActionDisallowedHudMessage(EIAB_HeavyAttacks);
  2862. return false;
  2863. }
  2864. if( !IsActionAllowed(EIAB_SpecialAttackHeavy) )
  2865. {
  2866. thePlayer.DisplayActionDisallowedHudMessage(EIAB_SpecialAttackHeavy);
  2867. return false;
  2868. }
  2869.  
  2870. if( IsPressed(action) )
  2871. {
  2872. isRendCanceled = false;
  2873. thePlayer.PrepareToAttack();
  2874. thePlayer.SetPlayedSpecialAttackMissingResourceSound(false);
  2875. thePlayer.AddTimer('IsSpecialHeavyAttackInputHeld', 0.00001, true);
  2876. }
  2877. }
  2878. // W3EE - End
  2879.  
  2880.  
  2881. event OnCbtCiriSpecialAttack( action : SInputAction )
  2882. {
  2883. if( !GetCiriPlayer().HasSword() )
  2884. return false;
  2885.  
  2886. if( thePlayer.GetBIsInputAllowed() && thePlayer.GetBIsCombatActionAllowed() && IsPressed(action) )
  2887. {
  2888. if ( thePlayer.HasAbility('CiriBlink') && ((W3ReplacerCiri)thePlayer).HasStaminaForSpecialAction(true) )
  2889. thePlayer.PrepareToAttack();
  2890. thePlayer.PushCombatActionOnBuffer( EBAT_Ciri_SpecialAttack, BS_Pressed );
  2891. thePlayer.ProcessCombatActionBuffer();
  2892. }
  2893. else if ( IsReleased( action ) && thePlayer.GetCombatAction() == EBAT_Ciri_SpecialAttack && thePlayer.GetBehaviorVariable( 'isPerformingSpecialAttack' ) != 0 )
  2894. {
  2895. thePlayer.PushCombatActionOnBuffer( EBAT_Ciri_SpecialAttack, BS_Released );
  2896. thePlayer.ProcessCombatActionBuffer();
  2897. }
  2898. }
  2899.  
  2900.  
  2901. event OnCbtCiriAttackHeavy( action : SInputAction )
  2902. {
  2903. var specialAttackAction : SInputAction;
  2904.  
  2905. if( !GetCiriPlayer().HasSword() )
  2906. return false;
  2907.  
  2908. specialAttackAction = theInput.GetAction('CiriSpecialAttackHeavy');
  2909.  
  2910. if( thePlayer.GetBIsInputAllowed() && IsReleased(action) && thePlayer.GetBehaviorVariable( 'isPerformingSpecialAttack' ) == 0 )
  2911. {
  2912. if( IsActionAllowed(EIAB_HeavyAttacks) && IsActionAllowed(EIAB_SwordAttack) )
  2913. {
  2914. if ( thePlayer.GetCurrentMeleeWeaponType() == PW_Steel )
  2915. {
  2916. thePlayer.PrepareToAttack();
  2917. thePlayer.SetupCombatAction( EBAT_HeavyAttack, BS_Released );
  2918. if ( thePlayer.GetBIsCombatActionAllowed() )
  2919. thePlayer.ProcessCombatActionBuffer();
  2920. }
  2921. }
  2922. else if ( !IsActionBlockedBy(EIAB_HeavyAttacks,'interaction') )
  2923. {
  2924. thePlayer.DisplayActionDisallowedHudMessage(EIAB_LightAttacks);
  2925. }
  2926. }
  2927. }
  2928.  
  2929.  
  2930. event OnCbtCiriSpecialAttackHeavy( action : SInputAction )
  2931. {
  2932. if( !GetCiriPlayer().HasSword() )
  2933. return false;
  2934.  
  2935. if( thePlayer.GetBIsInputAllowed() && thePlayer.GetBIsCombatActionAllowed() && IsPressed(action) )
  2936. {
  2937. theInput.ForceDeactivateAction('AttackWithAlternateHeavy');
  2938. thePlayer.PushCombatActionOnBuffer( EBAT_Ciri_SpecialAttack_Heavy, BS_Pressed );
  2939. thePlayer.ProcessCombatActionBuffer();
  2940. }
  2941. else if ( IsReleased( action ) && thePlayer.GetCombatAction() == EBAT_Ciri_SpecialAttack_Heavy && thePlayer.GetBehaviorVariable( 'isPerformingSpecialAttack' ) != 0 )
  2942. {
  2943. theInput.ForceDeactivateAction('CiriAttackHeavy');
  2944. theInput.ForceDeactivateAction('AttackWithAlternateHeavy');
  2945. thePlayer.PushCombatActionOnBuffer( EBAT_Ciri_SpecialAttack_Heavy, BS_Released );
  2946. thePlayer.ProcessCombatActionBuffer();
  2947. }
  2948. }
  2949.  
  2950. event OnCbtCiriDodge( action : SInputAction )
  2951. {
  2952. if( IsActionAllowed(EIAB_Dodge) && IsPressed(action) && thePlayer.IsAlive() )
  2953. {
  2954. if ( thePlayer.IsInCombatAction() && thePlayer.GetCombatAction() == EBAT_Ciri_SpecialAttack && thePlayer.GetBehaviorVariable( 'isCompletingSpecialAttack' ) <= 0 )
  2955. {
  2956. thePlayer.PushCombatActionOnBuffer( EBAT_Ciri_Dodge, BS_Pressed );
  2957. thePlayer.ProcessCombatActionBuffer();
  2958. }
  2959. else if ( thePlayer.GetBIsInputAllowed() )
  2960. {
  2961. thePlayer.PushCombatActionOnBuffer( EBAT_Ciri_Dodge, BS_Pressed );
  2962. if ( thePlayer.GetBIsCombatActionAllowed() )
  2963. thePlayer.ProcessCombatActionBuffer();
  2964. }
  2965. else
  2966. {
  2967. if ( thePlayer.IsInCombatAction() && thePlayer.GetBehaviorVariable( 'combatActionType' ) == (int)CAT_Attack )
  2968. {
  2969. if ( thePlayer.CanPlayHitAnim() && thePlayer.IsThreatened() )
  2970. {
  2971. thePlayer.CriticalEffectAnimationInterrupted("CiriDodge");
  2972. thePlayer.PushCombatActionOnBuffer( EBAT_Ciri_Dodge, BS_Pressed );
  2973. thePlayer.ProcessCombatActionBuffer();
  2974. }
  2975. else
  2976. thePlayer.PushCombatActionOnBuffer( EBAT_Ciri_Dodge, BS_Pressed );
  2977. }
  2978. }
  2979. }
  2980. else if ( !IsActionAllowed(EIAB_Dodge) )
  2981. {
  2982. thePlayer.DisplayActionDisallowedHudMessage(EIAB_Dodge);
  2983. }
  2984. }
  2985.  
  2986. event OnCbtCiriDash( action : SInputAction )
  2987. {
  2988. if ( theInput.LastUsedGamepad() && IsPressed( action ) )
  2989. {
  2990. thePlayer.StartDodgeTimer();
  2991. }
  2992. else if( IsActionAllowed(EIAB_Dodge) && thePlayer.IsAlive() )
  2993. {
  2994. if ( theInput.LastUsedGamepad() )
  2995. {
  2996. if ( !(thePlayer.IsDodgeTimerRunning() && !thePlayer.IsInsideInteraction() && IsReleased(action)) )
  2997. return false;
  2998. }
  2999.  
  3000. if ( thePlayer.IsInCombatAction() && thePlayer.GetCombatAction() == EBAT_Ciri_SpecialAttack && thePlayer.GetBehaviorVariable( 'isCompletingSpecialAttack' ) <= 0 )
  3001. {
  3002. thePlayer.PushCombatActionOnBuffer( EBAT_Roll, BS_Released );
  3003. thePlayer.ProcessCombatActionBuffer();
  3004. }
  3005. else if ( thePlayer.GetBIsInputAllowed() )
  3006. {
  3007. thePlayer.PushCombatActionOnBuffer( EBAT_Roll, BS_Released );
  3008. if ( thePlayer.GetBIsCombatActionAllowed() )
  3009. thePlayer.ProcessCombatActionBuffer();
  3010. }
  3011. else
  3012. {
  3013. if ( thePlayer.IsInCombatAction() && thePlayer.GetBehaviorVariable( 'combatActionType' ) == (int)CAT_Attack )
  3014. {
  3015. if ( thePlayer.CanPlayHitAnim() && thePlayer.IsThreatened() )
  3016. {
  3017. thePlayer.CriticalEffectAnimationInterrupted("CiriDodge");
  3018. thePlayer.PushCombatActionOnBuffer( EBAT_Roll, BS_Released );
  3019. thePlayer.ProcessCombatActionBuffer();
  3020. }
  3021. else
  3022. thePlayer.PushCombatActionOnBuffer( EBAT_Roll, BS_Released );
  3023. }
  3024. }
  3025. }
  3026. else if ( !IsActionAllowed(EIAB_Dodge) )
  3027. {
  3028. thePlayer.DisplayActionDisallowedHudMessage(EIAB_Dodge);
  3029. }
  3030. }
  3031.  
  3032. event OnCbtDodge( action : SInputAction )
  3033. {
  3034. if( theInput.IsActionPressed('ControllerCastModifier') )
  3035. return false;
  3036.  
  3037. if ( IsPressed(action) )
  3038. thePlayer.EvadePressed(EBAT_Dodge);
  3039. }
  3040.  
  3041. event OnCbtRoll( action : SInputAction )
  3042. {
  3043. if( theInput.IsActionPressed('ControllerCastModifier') )
  3044. return false;
  3045.  
  3046. if ( theInput.LastUsedPCInput() )
  3047. {
  3048. if ( IsPressed( action ) )
  3049. {
  3050. thePlayer.EvadePressed(EBAT_Roll);
  3051. }
  3052. }
  3053. else
  3054. {
  3055. if ( IsPressed( action ) )
  3056. {
  3057. thePlayer.StartDodgeTimer();
  3058. }
  3059. else if ( IsReleased( action ) )
  3060. {
  3061. if ( thePlayer.IsDodgeTimerRunning() )
  3062. {
  3063. thePlayer.StopDodgeTimer();
  3064. if ( !thePlayer.IsInsideInteraction() )
  3065. thePlayer.EvadePressed(EBAT_Roll);
  3066. }
  3067.  
  3068. }
  3069. }
  3070. }
  3071.  
  3072.  
  3073. /*var lastMovementDoubleTapName : name;
  3074.  
  3075. event OnMovementDoubleTap( action : SInputAction )
  3076. {
  3077. if ( IsPressed( action ) )
  3078. {
  3079. if ( !thePlayer.IsDodgeTimerRunning() || action.aName != lastMovementDoubleTapName )
  3080. {
  3081. thePlayer.StartDodgeTimer();
  3082. lastMovementDoubleTapName = action.aName;
  3083. }
  3084. else
  3085. {
  3086. thePlayer.StopDodgeTimer();
  3087.  
  3088. thePlayer.EvadePressed(EBAT_Dodge);
  3089. }
  3090.  
  3091. }
  3092. }*/
  3093.  
  3094. event OnCastSign( action : SInputAction )
  3095. {
  3096. var signSkill : ESkill;
  3097.  
  3098. if( !thePlayer.GetBIsInputAllowed() || thePlayer.HasBuff(EET_Stagger) || thePlayer.HasBuff(EET_LongStagger) || thePlayer.HasBuff(EET_Knockdown) || thePlayer.HasBuff(EET_HeavyKnockdown) || thePlayer.HasBuff(EET_Pull) )
  3099. {
  3100. return false;
  3101. }
  3102.  
  3103. if( IsPressed(action) )
  3104. {
  3105. if( !IsActionAllowed(EIAB_Signs) && thePlayer.GetEquippedSign() != ST_Aard && thePlayer.GetEquippedSign() != ST_Quen )
  3106. {
  3107. if ( !LIT_Check(false) ) { //mod_LIT
  3108. thePlayer.DisplayActionDisallowedHudMessage(EIAB_Signs);
  3109. return false;
  3110. } //mod_LIT
  3111. }
  3112. if ( thePlayer.IsHoldingItemInLHand() && thePlayer.IsUsableItemLBlocked() )
  3113. {
  3114. thePlayer.DisplayActionDisallowedHudMessage(EIAB_Undefined, false, false, true);
  3115. return false;
  3116. }
  3117. if ( LIT_Check(true) ) return false; //mod_LIT
  3118. signSkill = SignEnumToSkillEnum( thePlayer.GetEquippedSign() );
  3119. if( signSkill != S_SUndefined )
  3120. {
  3121. if(!thePlayer.CanUseSkill(signSkill))
  3122. {
  3123. thePlayer.DisplayActionDisallowedHudMessage(EIAB_Signs, false, false, true);
  3124. return false;
  3125. }
  3126.  
  3127. if( thePlayer.HasVigorToUseSkill(signSkill) )
  3128. {
  3129. if( GetInvalidUniqueId() != thePlayer.inv.GetItemFromSlot( 'l_weapon' ) && !thePlayer.IsUsableItemLBlocked())
  3130. {
  3131.  
  3132.  
  3133. }
  3134. if( thePlayer.IsSwimming() )
  3135. GetWitcherPlayer().CastSignUnderwater();
  3136. else
  3137. thePlayer.SetupCombatAction( EBAT_CastSign, BS_Pressed );
  3138. }
  3139. /*else
  3140. {
  3141. thePlayer.SoundEvent("gui_no_stamina");
  3142. }*/
  3143. }
  3144. }
  3145. }
  3146.  
  3147.  
  3148.  
  3149.  
  3150. event OnThrowBomb(action : SInputAction)
  3151. {
  3152. var selectedItemId : SItemUniqueId;
  3153.  
  3154. selectedItemId = thePlayer.GetSelectedItemId();
  3155. if(!thePlayer.inv.IsItemBomb(selectedItemId))
  3156. return false;
  3157.  
  3158. if( thePlayer.inv.SingletonItemGetAmmo(selectedItemId) == 0 && !thePlayer.inv.ItemHasTag(selectedItemId, 'ThrowingKnife') )
  3159. {
  3160.  
  3161. if(IsPressed(action))
  3162. {
  3163. thePlayer.SoundEvent( "gui_ingame_low_stamina_warning" );
  3164. }
  3165.  
  3166. return false;
  3167. }
  3168.  
  3169. if ( IsReleased(action) )
  3170. {
  3171. if ( thePlayer.IsThrowHold() )
  3172. {
  3173. if ( thePlayer.playerAiming.GetAimedTarget() )
  3174. {
  3175. if ( thePlayer.AllowAttack( thePlayer.playerAiming.GetAimedTarget(), EBAT_ItemUse ) )
  3176. {
  3177. thePlayer.PushCombatActionOnBuffer( EBAT_ItemUse, BS_Released );
  3178. thePlayer.ProcessCombatActionBuffer();
  3179. }
  3180. else
  3181. thePlayer.BombThrowAbort();
  3182. }
  3183. else
  3184. {
  3185. thePlayer.PushCombatActionOnBuffer( EBAT_ItemUse, BS_Released );
  3186. thePlayer.ProcessCombatActionBuffer();
  3187. }
  3188.  
  3189. thePlayer.SetThrowHold( false );
  3190.  
  3191. return true;
  3192.  
  3193. }
  3194. else
  3195. {
  3196. if(!IsActionAllowed(EIAB_ThrowBomb))
  3197. {
  3198. thePlayer.DisplayActionDisallowedHudMessage(EIAB_ThrowBomb);
  3199. return false;
  3200. }
  3201.  
  3202. if ( thePlayer.IsHoldingItemInLHand() && !thePlayer.IsUsableItemLBlocked() )
  3203. {
  3204. thePlayer.SetPlayerActionToRestore ( PATR_ThrowBomb );
  3205. thePlayer.OnUseSelectedItem( true );
  3206. return true;
  3207. }
  3208. if(thePlayer.CanSetupCombatAction_Throw() && theInput.GetLastActivationTime( action.aName ) < 0.3f )
  3209. {
  3210.  
  3211. thePlayer.SetupCombatAction( EBAT_ItemUse, BS_Pressed );
  3212. return true;
  3213. }
  3214.  
  3215. thePlayer.SetupCombatAction( EBAT_ItemUse, BS_Released );
  3216. return true;
  3217. }
  3218. }
  3219.  
  3220. return false;
  3221. }
  3222.  
  3223. event OnThrowBombHold(action : SInputAction)
  3224. {
  3225. var locks : array<SInputActionLock>;
  3226. var ind : int;
  3227.  
  3228. var selectedItemId : SItemUniqueId;
  3229.  
  3230. selectedItemId = thePlayer.GetSelectedItemId();
  3231. if(!thePlayer.inv.IsItemBomb(selectedItemId))
  3232. return false;
  3233.  
  3234. if( thePlayer.inv.SingletonItemGetAmmo(selectedItemId) == 0 && !thePlayer.inv.ItemHasTag(selectedItemId, 'ThrowingKnife') )
  3235. {
  3236.  
  3237. if(IsPressed(action))
  3238. {
  3239. thePlayer.SoundEvent( "gui_ingame_low_stamina_warning" );
  3240. }
  3241.  
  3242. return false;
  3243. }
  3244.  
  3245. if( IsPressed(action) )
  3246. {
  3247. if(!IsActionAllowed(EIAB_ThrowBomb))
  3248. {
  3249. thePlayer.DisplayActionDisallowedHudMessage(EIAB_ThrowBomb);
  3250. return false;
  3251. }
  3252. else if(GetWitcherPlayer().GetBombDelay(GetWitcherPlayer().GetItemSlot(selectedItemId)) > 0 )
  3253. {
  3254.  
  3255. return false;
  3256. }
  3257. if ( thePlayer.IsHoldingItemInLHand() && !thePlayer.IsUsableItemLBlocked() )
  3258. {
  3259. thePlayer.SetPlayerActionToRestore ( PATR_ThrowBomb );
  3260. thePlayer.OnUseSelectedItem( true );
  3261. return true;
  3262. }
  3263. if(thePlayer.CanSetupCombatAction_Throw() && theInput.GetLastActivationTime( action.aName ) < 0.3f )
  3264. {
  3265. if( thePlayer.GetBIsCombatActionAllowed() )
  3266. {
  3267. thePlayer.PushCombatActionOnBuffer( EBAT_ItemUse, BS_Pressed );
  3268. thePlayer.ProcessCombatActionBuffer();
  3269. }
  3270. }
  3271.  
  3272.  
  3273.  
  3274. locks = GetActionLocks(EIAB_ThrowBomb);
  3275. ind = FindActionLockIndex(EIAB_ThrowBomb, 'BombThrow');
  3276. if(ind >= 0)
  3277. locks.Erase(ind);
  3278.  
  3279. if(locks.Size() != 0)
  3280. return false;
  3281.  
  3282. thePlayer.SetThrowHold( true );
  3283. return true;
  3284. }
  3285.  
  3286. return false;
  3287. }
  3288.  
  3289. event OnThrowBombAbort(action : SInputAction)
  3290. {
  3291. if( IsPressed(action) )
  3292. {
  3293. thePlayer.BombThrowAbort();
  3294. }
  3295. }
  3296.  
  3297.  
  3298.  
  3299.  
  3300.  
  3301. event OnCbtThrowItem( action : SInputAction )
  3302. {
  3303. var isUsableItem, isCrossbow, isBomb, ret : bool;
  3304. var itemId : SItemUniqueId;
  3305.  
  3306. // W3EE - Begin
  3307. if( theInput.IsActionPressed('ControllerCastModifier') )
  3308. return false;
  3309. // W3EE - End
  3310.  
  3311. if(thePlayer.IsInAir() || thePlayer.GetWeaponHolster().IsOnTheMiddleOfHolstering())
  3312. return false;
  3313.  
  3314. if( thePlayer.IsSwimming() && !thePlayer.OnCheckDiving() && thePlayer.GetCurrentStateName() != 'AimThrow' )
  3315. return false;
  3316.  
  3317. itemId = thePlayer.GetSelectedItemId();
  3318.  
  3319. if(!thePlayer.inv.IsIdValid(itemId))
  3320. return false;
  3321.  
  3322. isCrossbow = thePlayer.inv.IsItemCrossbow(itemId);
  3323. if(!isCrossbow)
  3324. {
  3325. isBomb = thePlayer.inv.IsItemBomb(itemId);
  3326. if(!isBomb)
  3327. {
  3328. isUsableItem = true;
  3329. }
  3330. }
  3331.  
  3332.  
  3333.  
  3334.  
  3335. if( isCrossbow )
  3336. {
  3337. // W3EE - Begin
  3338.  
  3339. GetWitcherPlayer().GetItemEquippedOnSlot(EES_Bolt, itemId);
  3340. if( !GetWitcherPlayer().GetInventory().IsIdValid(itemId) )
  3341. {
  3342. thePlayer.DisplayActionDisallowedHudMessage(EIAB_Crossbow);
  3343. return false;
  3344. }
  3345. // W3EE - End
  3346.  
  3347. if ( IsActionAllowed(EIAB_Crossbow) )
  3348. {
  3349. if( IsPressed(action))
  3350. {
  3351. /*if( thePlayer.GetBehaviorVariable('isAimingWeapon') != 0 || thePlayer.IsReloading() )
  3352. thePlayer.SetCancelReload(true);
  3353. */
  3354. if ( thePlayer.IsHoldingItemInLHand() && !thePlayer.IsUsableItemLBlocked() )
  3355. {
  3356.  
  3357. thePlayer.SetPlayerActionToRestore ( PATR_Crossbow );
  3358. thePlayer.OnUseSelectedItem( true );
  3359. ret = true;
  3360. }
  3361. else if ( thePlayer.GetBIsInputAllowed() && !thePlayer.IsCurrentlyUsingItemL() )
  3362. {
  3363. thePlayer.SetIsAimingCrossbow( true );
  3364. thePlayer.SetupCombatAction( EBAT_ItemUse, BS_Pressed );
  3365.  
  3366.  
  3367. ret = true;
  3368. }
  3369. }
  3370. else
  3371. {
  3372.  
  3373. if ( thePlayer.GetIsAimingCrossbow() && !thePlayer.IsCurrentlyUsingItemL() )
  3374. {
  3375. thePlayer.SetupCombatAction( EBAT_ItemUse, BS_Released );
  3376.  
  3377.  
  3378. thePlayer.SetIsAimingCrossbow( false );
  3379. ret = true;
  3380. }
  3381. }
  3382. }
  3383. else
  3384. {
  3385. if ( !thePlayer.IsInShallowWater() )
  3386. thePlayer.DisplayActionDisallowedHudMessage(EIAB_Crossbow);
  3387. }
  3388.  
  3389. if ( IsPressed(action) )
  3390. thePlayer.AddTimer( 'IsItemUseInputHeld', 0.00001, true );
  3391. else
  3392. thePlayer.RemoveTimer('IsItemUseInputHeld');
  3393.  
  3394. return ret;
  3395. }
  3396. else if(isBomb)
  3397. {
  3398. return OnThrowBomb(action);
  3399. }
  3400. else if(isUsableItem && !thePlayer.IsSwimming() )
  3401. {
  3402. if( IsActionAllowed(EIAB_UsableItem) )
  3403. {
  3404. if(IsPressed(action) && thePlayer.HasStaminaToUseAction(ESAT_UsableItem))
  3405. {
  3406. thePlayer.SetPlayerActionToRestore ( PATR_Default );
  3407. thePlayer.OnUseSelectedItem();
  3408. return true;
  3409. }
  3410.  
  3411. }
  3412. else
  3413. {
  3414. thePlayer.DisplayActionDisallowedHudMessage(EIAB_UsableItem);
  3415. }
  3416. }
  3417.  
  3418. return false;
  3419. }
  3420.  
  3421. event OnCbtThrowItemHold( action : SInputAction )
  3422. {
  3423. var isBomb, isCrossbow, isUsableItem : bool;
  3424. var itemId : SItemUniqueId;
  3425.  
  3426. // W3EE - Begin
  3427. if( theInput.IsActionPressed('ControllerCastModifier') )
  3428. return false;
  3429. // W3EE - End
  3430.  
  3431. if(thePlayer.IsInAir() || thePlayer.GetWeaponHolster().IsOnTheMiddleOfHolstering() )
  3432. return false;
  3433.  
  3434. if( thePlayer.IsSwimming() && !thePlayer.OnCheckDiving() && thePlayer.GetCurrentStateName() != 'AimThrow' )
  3435. return false;
  3436.  
  3437. itemId = thePlayer.GetSelectedItemId();
  3438.  
  3439. if(!thePlayer.inv.IsIdValid(itemId))
  3440. return false;
  3441.  
  3442. isCrossbow = thePlayer.inv.IsItemCrossbow(itemId);
  3443. if(!isCrossbow)
  3444. {
  3445. isBomb = thePlayer.inv.IsItemBomb(itemId);
  3446. if(isBomb)
  3447. {
  3448. return OnThrowBombHold(action);
  3449. }
  3450. else
  3451. {
  3452. isUsableItem = true;
  3453. }
  3454. }
  3455. // W3EE - Begin
  3456. else
  3457. {
  3458. GetWitcherPlayer().GetItemEquippedOnSlot(EES_Bolt, itemId);
  3459. if( !GetWitcherPlayer().GetInventory().IsIdValid(itemId) )
  3460. {
  3461. thePlayer.DisplayActionDisallowedHudMessage(EIAB_Crossbow);
  3462. return false;
  3463. }
  3464. }
  3465. // W3EE - End
  3466.  
  3467.  
  3468. if(IsPressed(action))
  3469. {
  3470. if( isCrossbow && !IsActionAllowed(EIAB_Crossbow) )
  3471. {
  3472. thePlayer.DisplayActionDisallowedHudMessage(EIAB_Crossbow);
  3473. return false;
  3474. }
  3475.  
  3476. if( isUsableItem)
  3477. {
  3478. if(!IsActionAllowed(EIAB_UsableItem))
  3479. {
  3480. thePlayer.DisplayActionDisallowedHudMessage(EIAB_UsableItem);
  3481. return false;
  3482. }
  3483. else if(thePlayer.IsSwimming())
  3484. {
  3485. thePlayer.DisplayActionDisallowedHudMessage(EIAB_Undefined, false, false, true);
  3486. return false;
  3487. }
  3488. }
  3489. }
  3490.  
  3491. if( IsPressed(action) )
  3492. {
  3493. thePlayer.SetThrowHold( true );
  3494. return true;
  3495. }
  3496. else if( IsReleased(action) && thePlayer.IsThrowHold())
  3497. {
  3498.  
  3499.  
  3500. thePlayer.SetupCombatAction( EBAT_ItemUse, BS_Released );
  3501. thePlayer.SetThrowHold( false );
  3502. return true;
  3503. }
  3504.  
  3505. return false;
  3506. }
  3507.  
  3508. event OnCbtThrowCastAbort( action : SInputAction )
  3509. {
  3510. var player : W3PlayerWitcher;
  3511. var throwStage : EThrowStage;
  3512.  
  3513. if(thePlayer.inv.IsItemBomb(thePlayer.GetSelectedItemId()))
  3514. {
  3515. return OnThrowBombAbort(action);
  3516. }
  3517.  
  3518. if( IsPressed(action) )
  3519. {
  3520. player = GetWitcherPlayer();
  3521. if(player)
  3522. {
  3523. if( player.IsCastingSign() )
  3524. {
  3525. player.CastSignAbort();
  3526. }
  3527. else
  3528. {
  3529. if ( thePlayer.inv.IsItemCrossbow( thePlayer.inv.GetItemFromSlot( 'l_weapon' ) ) )
  3530. {
  3531. thePlayer.OnRangedForceHolster();
  3532. }
  3533. else
  3534. {
  3535. throwStage = (int)thePlayer.GetBehaviorVariable( 'throwStage', (int)TS_Stop);
  3536.  
  3537. if(throwStage == TS_Start || throwStage == TS_Loop)
  3538. player.ThrowingAbort();
  3539. }
  3540. }
  3541. }
  3542. }
  3543. }
  3544.  
  3545. event OnCbtSelectLockTarget( inputVector : Vector )
  3546. {
  3547. var newLockTarget : CActor;
  3548. var inputHeading : float;
  3549. var target : CActor;
  3550.  
  3551. inputVector.Y = inputVector.Y * -1.f;
  3552. inputHeading = VecHeading( inputVector );
  3553.  
  3554. newLockTarget = thePlayer.GetScreenSpaceLockTarget( thePlayer.GetDisplayTarget(), 180.f, 1.f, inputHeading );
  3555.  
  3556. if ( newLockTarget )
  3557. thePlayer.ProcessLockTarget( newLockTarget );
  3558.  
  3559. target = thePlayer.GetTarget();
  3560. if ( target )
  3561. {
  3562. thePlayer.SetSlideTarget( target );
  3563.  
  3564. }
  3565. }
  3566.  
  3567. event OnCbtLockAndGuard( action : SInputAction )
  3568. {
  3569. if(thePlayer.IsCiri() && !GetCiriPlayer().HasSword())
  3570. return false;
  3571.  
  3572.  
  3573. if( IsReleased(action) )
  3574. {
  3575. thePlayer.SetGuarded(false);
  3576. thePlayer.OnGuardedReleased();
  3577. }
  3578.  
  3579. if( (thePlayer.IsWeaponHeld('fists') || thePlayer.GetCurrentStateName() == 'CombatFists') && !IsActionAllowed(EIAB_Fists))
  3580. {
  3581. thePlayer.DisplayActionDisallowedHudMessage(EIAB_Fists);
  3582. return false;
  3583. }
  3584.  
  3585. if( IsPressed(action) )
  3586. {
  3587. // W3EE - Begin
  3588. /*
  3589. if( !IsActionAllowed(EIAB_Parry) )
  3590. {
  3591. if ( IsActionBlockedBy(EIAB_Parry,'UsableItem') )
  3592. {
  3593. thePlayer.DisplayActionDisallowedHudMessage(EIAB_Parry);
  3594. }
  3595. return true;
  3596. }
  3597. */
  3598.  
  3599. thePlayer.StopRun();
  3600. thePlayer.AddTimer('DisableSprintingTimer', 0.f);
  3601. // W3EE - End
  3602.  
  3603. if ( thePlayer.GetCurrentStateName() == 'Exploration' )
  3604. thePlayer.GoToCombatIfNeeded();
  3605.  
  3606. if ( thePlayer.bLAxisReleased )
  3607. thePlayer.ResetRawPlayerHeading();
  3608.  
  3609. if ( thePlayer.rangedWeapon && thePlayer.rangedWeapon.GetCurrentStateName() != 'State_WeaponWait' )
  3610. thePlayer.OnRangedForceHolster( true, true );
  3611.  
  3612. thePlayer.AddCounterTimeStamp(theGame.GetEngineTime());
  3613. thePlayer.SetGuarded(true);
  3614. thePlayer.OnPerformGuard();
  3615. }
  3616. }
  3617.  
  3618. event OnCbtCameraLockOrSpawnHorse( action : SInputAction )
  3619. {
  3620. if ( OnCbtCameraLock(action) )
  3621. return true;
  3622.  
  3623. if ( OnCommSpawnHorse(action) )
  3624. return true;
  3625.  
  3626. return false;
  3627. }
  3628.  
  3629. event OnCbtCameraLock( action : SInputAction )
  3630. {
  3631. if( IsPressed(action) )
  3632. {
  3633. if ( thePlayer.IsThreatened() || thePlayer.IsActorLockedToTarget() )
  3634. {
  3635. if( !IsActionAllowed(EIAB_CameraLock))
  3636. {
  3637. return false;
  3638. }
  3639. else if ( !thePlayer.IsHardLockEnabled() && thePlayer.GetDisplayTarget() && (CActor)( thePlayer.GetDisplayTarget() ) && IsActionAllowed(EIAB_HardLock))
  3640. {
  3641. if ( thePlayer.bLAxisReleased )
  3642. thePlayer.ResetRawPlayerHeading();
  3643.  
  3644. thePlayer.HardLockToTarget( true );
  3645. }
  3646. else
  3647. {
  3648. thePlayer.HardLockToTarget( false );
  3649. }
  3650. return true;
  3651. }
  3652. }
  3653. return false;
  3654. }
  3655.  
  3656. event OnChangeCameraPreset( action : SInputAction )
  3657. {
  3658. if( IsPressed(action) )
  3659. {
  3660. ((CCustomCamera)theCamera.GetTopmostCameraObject()).NextPreset();
  3661. }
  3662. }
  3663.  
  3664. event OnChangeCameraPresetByMouseWheel( action : SInputAction )
  3665. {
  3666. var tolerance : float;
  3667. tolerance = 10.0f;
  3668.  
  3669. if( ( action.value * totalCameraPresetChange ) < 0.0f )
  3670. {
  3671. totalCameraPresetChange = 0.0f;
  3672. }
  3673.  
  3674. totalCameraPresetChange += action.value;
  3675. if( totalCameraPresetChange < -tolerance )
  3676. {
  3677. ((CCustomCamera)theCamera.GetTopmostCameraObject()).PrevPreset();
  3678. totalCameraPresetChange = 0.0f;
  3679. }
  3680. else if( totalCameraPresetChange > tolerance )
  3681. {
  3682. ((CCustomCamera)theCamera.GetTopmostCameraObject()).NextPreset();
  3683. totalCameraPresetChange = 0.0f;
  3684. }
  3685. }
  3686.  
  3687. event OnMeditationAbort(action : SInputAction)
  3688. {
  3689. var med : W3PlayerWitcherStateMeditation;
  3690.  
  3691. if (!theGame.GetGuiManager().IsAnyMenu())
  3692. {
  3693. med = (W3PlayerWitcherStateMeditation)GetWitcherPlayer().GetCurrentState();
  3694. if(med)
  3695. {
  3696.  
  3697.  
  3698. med.StopRequested(false);
  3699. }
  3700. }
  3701. }
  3702.  
  3703. public final function ClearLocksForNGP()
  3704. {
  3705. var i : int;
  3706.  
  3707. for(i=actionLocks.Size()-1; i>=0; i-=1)
  3708. {
  3709. OnActionLockChanged(i, false);
  3710. actionLocks[i].Clear();
  3711. }
  3712. }
  3713.  
  3714.  
  3715.  
  3716.  
  3717.  
  3718. public function Dbg_UnlockAllActions()
  3719. {
  3720. var i : int;
  3721.  
  3722. if( theGame.IsFinalBuild() )
  3723. {
  3724. return;
  3725. }
  3726.  
  3727. for(i=actionLocks.Size()-1; i>=0; i-=1)
  3728. {
  3729. OnActionLockChanged(i, false);
  3730. }
  3731. actionLocks.Clear();
  3732. }
  3733.  
  3734. event OnDbgSpeedUp( action : SInputAction )
  3735. {
  3736. if( theGame.IsFinalBuild() )
  3737. {
  3738. return false;
  3739. }
  3740.  
  3741. if(IsPressed(action))
  3742. {
  3743. theGame.SetTimeScale(4, theGame.GetTimescaleSource(ETS_DebugInput), theGame.GetTimescalePriority(ETS_DebugInput));
  3744. }
  3745. else if(IsReleased(action))
  3746. {
  3747. theGame.RemoveTimeScale( theGame.GetTimescaleSource(ETS_DebugInput) );
  3748. }
  3749. }
  3750.  
  3751. event OnDbgHit( action : SInputAction )
  3752. {
  3753. if( theGame.IsFinalBuild() )
  3754. {
  3755. return false;
  3756. }
  3757.  
  3758. if(IsReleased(action))
  3759. {
  3760. thePlayer.SetBehaviorVariable( 'HitReactionDirection',(int)EHRD_Back);
  3761. thePlayer.SetBehaviorVariable( 'isAttackReflected', 0 );
  3762. thePlayer.SetBehaviorVariable( 'HitReactionType', (int)EHRT_Heavy);
  3763. thePlayer.SetBehaviorVariable( 'HitReactionWeapon', 0);
  3764. thePlayer.SetBehaviorVariable( 'HitSwingDirection',(int)ASD_LeftRight);
  3765. thePlayer.SetBehaviorVariable( 'HitSwingType',(int)AST_Horizontal);
  3766.  
  3767. thePlayer.RaiseForceEvent( 'Hit' );
  3768. thePlayer.OnRangedForceHolster( true );
  3769. GetWitcherPlayer().SetCustomRotation( 'Hit', thePlayer.GetHeading()+180, 1080.f, 0.1f, false );
  3770. thePlayer.CriticalEffectAnimationInterrupted("OnDbgHit");
  3771. }
  3772. }
  3773.  
  3774. event OnDbgKillTarget( action : SInputAction )
  3775. {
  3776. var target : CActor;
  3777.  
  3778. if( theGame.IsFinalBuild() )
  3779. {
  3780. return false;
  3781. }
  3782.  
  3783. target = thePlayer.GetTarget();
  3784.  
  3785. if( target && IsReleased(action) )
  3786. {
  3787. target.Kill( 'Debug' );
  3788. }
  3789. }
  3790.  
  3791. event OnDbgKillAll( action : SInputAction )
  3792. {
  3793. if( theGame.IsFinalBuild() )
  3794. {
  3795. return false;
  3796. }
  3797.  
  3798. if(IsReleased(action))
  3799. thePlayer.DebugKillAll();
  3800. }
  3801.  
  3802.  
  3803. event OnDbgKillAllTargetingPlayer( action : SInputAction )
  3804. {
  3805. var i : int;
  3806. var all : array<CActor>;
  3807.  
  3808. if( theGame.IsFinalBuild() )
  3809. {
  3810. return false;
  3811. }
  3812.  
  3813. if(IsPressed(action))
  3814. {
  3815. all = GetActorsInRange(thePlayer, 10000, 10000, '', true);
  3816. for(i=0; i<all.Size(); i+=1)
  3817. {
  3818. if(all[i] != thePlayer && all[i].GetTarget() == thePlayer)
  3819. all[i].Kill( 'Debug' );
  3820. }
  3821. }
  3822. }
  3823.  
  3824. event OnDbgTeleportToPin( action : SInputAction )
  3825. {
  3826. if( theGame.IsFinalBuild() )
  3827. {
  3828. return false;
  3829. }
  3830.  
  3831. if(IsReleased(action))
  3832. thePlayer.DebugTeleportToPin();
  3833. }
  3834.  
  3835.  
  3836.  
  3837. event OnBoatDismount( action : SInputAction )
  3838. {
  3839. var boatComp : CBoatComponent;
  3840. var stopAction : SInputAction;
  3841.  
  3842. stopAction = theInput.GetAction('GI_Decelerate');
  3843.  
  3844. if( IsReleased(action) && ( theInput.LastUsedPCInput() || ( stopAction.value < 0.7 && stopAction.lastFrameValue < 0.7 ) ) )
  3845. {
  3846. if( thePlayer.IsActionAllowed( EIAB_DismountVehicle ) )
  3847. {
  3848. boatComp = (CBoatComponent)thePlayer.GetUsedVehicle().GetComponentByClassName( 'CBoatComponent' );
  3849. boatComp.IssueCommandToDismount( DT_normal );
  3850. }
  3851. else
  3852. {
  3853. thePlayer.DisplayActionDisallowedHudMessage(EIAB_DismountVehicle);
  3854. }
  3855. }
  3856. }
  3857.  
  3858.  
  3859.  
  3860.  
  3861.  
  3862. event OnCiriDrawWeapon( action : SInputAction )
  3863. {
  3864. var duringCastSign : bool;
  3865.  
  3866.  
  3867. if ( IsReleased(action) || ( IsPressed(action) && (thePlayer.GetCurrentMeleeWeaponType() == PW_None || thePlayer.GetCurrentMeleeWeaponType() == PW_Fists) ) )
  3868. {
  3869. if ( thePlayer.GetBIsInputAllowed() && thePlayer.GetBIsCombatActionAllowed() )
  3870. {
  3871. if (thePlayer.GetCurrentMeleeWeaponType() == PW_Steel && !thePlayer.IsThreatened() )
  3872. thePlayer.OnEquipMeleeWeapon( PW_None, false );
  3873. else
  3874. thePlayer.OnEquipMeleeWeapon( PW_Steel, false );
  3875. }
  3876. }
  3877. else if(IsReleased(action) || ( IsPressed(action) && (thePlayer.GetCurrentMeleeWeaponType() == PW_Steel || thePlayer.GetCurrentMeleeWeaponType() == PW_Silver) ) )
  3878. {
  3879. CiriSheatheWeapon();
  3880. }
  3881. }
  3882.  
  3883. event OnCiriHolsterWeapon( action : SInputAction )
  3884. {
  3885. var currWeaponType : EPlayerWeapon;
  3886.  
  3887. if(IsPressed( action ))
  3888. {
  3889. currWeaponType = thePlayer.GetCurrentMeleeWeaponType();
  3890.  
  3891. if(currWeaponType == PW_Steel || currWeaponType == PW_Silver)
  3892. {
  3893. CiriSheatheWeapon();
  3894. }
  3895. }
  3896. }
  3897.  
  3898. private final function CiriSheatheWeapon()
  3899. {
  3900. if ( thePlayer.GetBIsInputAllowed() && thePlayer.GetBIsCombatActionAllowed() && !thePlayer.IsThreatened() )
  3901. {
  3902. thePlayer.OnEquipMeleeWeapon( PW_None, false );
  3903. }
  3904. }
  3905.  
  3906.  
  3907.  
  3908.  
  3909. event OnCommHoldFastMenu( action : SInputAction )
  3910. {
  3911. if(IsPressed(action))
  3912. {
  3913. holdFastMenuInvoked = true;
  3914. PushInventoryScreen();
  3915. }
  3916. }
  3917.  
  3918. event OnFastMenu( action : SInputAction )
  3919. {
  3920. if( IsReleased(action) )
  3921. {
  3922. if(holdFastMenuInvoked)
  3923. {
  3924. holdFastMenuInvoked = false;
  3925. return false;
  3926. }
  3927.  
  3928. if ( theGame.IsBlackscreenOrFading() )
  3929. {
  3930. return false;
  3931. }
  3932.  
  3933. if (theGame.GetGuiManager().IsAnyMenu())
  3934. {
  3935. return false;
  3936. }
  3937.  
  3938. if( IsActionAllowed( EIAB_OpenFastMenu ) )
  3939. {
  3940. theGame.SetMenuToOpen( '' );
  3941. theGame.RequestMenu('CommonMenu' );
  3942. }
  3943. else
  3944. {
  3945. thePlayer.DisplayActionDisallowedHudMessage(EIAB_OpenFastMenu);
  3946. }
  3947. }
  3948. }
  3949.  
  3950. event OnIngameMenu( action : SInputAction )
  3951. {
  3952. var openedPanel : name;
  3953. openedPanel = theGame.GetMenuToOpen();
  3954.  
  3955. //---=== modFriendlyHUD ===---
  3956. if ( controllerQuickInventoryHandled )
  3957. {
  3958. controllerQuickInventoryHandled = false;
  3959. return false;
  3960. }
  3961. //---=== modFriendlyHUD ===---
  3962.  
  3963. if( IsReleased(action) && openedPanel != 'GlossaryTutorialsMenu' && !theGame.GetGuiManager().IsAnyMenu() )
  3964. {
  3965. if ( theGame.IsBlackscreenOrFading() )
  3966. {
  3967. return false;
  3968. }
  3969. theGame.SetMenuToOpen( '' );
  3970. theGame.RequestMenu('CommonIngameMenu' );
  3971. }
  3972. }
  3973.  
  3974. event OnToggleHud( action : SInputAction )
  3975. {
  3976. var hud : CR4ScriptedHud;
  3977. if ( IsReleased(action) )
  3978. {
  3979. hud = (CR4ScriptedHud)theGame.GetHud();
  3980. if ( hud )
  3981. {
  3982. hud.ToggleHudByUser();
  3983. }
  3984. }
  3985. }
  3986.  
  3987. public final function Debug_ClearAllActionLocks(optional action : EInputActionBlock, optional all : bool)
  3988. {
  3989. var i : int;
  3990.  
  3991. if(all)
  3992. {
  3993. Dbg_UnlockAllActions();
  3994. }
  3995. else
  3996. {
  3997. OnActionLockChanged(action, false);
  3998. actionLocks[action].Clear();
  3999. }
  4000. }
  4001. }
  4002.  
Add Comment
Please, Sign In to add comment