Guest User

Playerwitcherws

a guest
Nov 16th, 2024
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 337.88 KB | None | 0 0
  1. /***********************************************************************/
  2. /** © 2015 CD PROJEKT S.A. All rights reserved.
  3. /** THE WITCHER® is a trademark of CD PROJEKT S. A.
  4. /** The Witcher game is based on the prose of Andrzej Sapkowski.
  5. /***********************************************************************/
  6.  
  7.  
  8.  
  9.  
  10. statemachine class W3PlayerWitcher extends CR4Player
  11. {
  12.  
  13. private saved var craftingSchematics : array<name>;
  14. private saved var expandedCraftingCategories : array<name>;
  15. private saved var craftingFilters : SCraftingFilters;
  16.  
  17.  
  18. private saved var alchemyRecipes : array<name>;
  19. private saved var expandedAlchemyCategories : array<name>;
  20. private saved var alchemyFilters : SCraftingFilters;
  21.  
  22.  
  23. private saved var expandedBestiaryCategories : array<name>;
  24.  
  25.  
  26. private saved var booksRead : array<name>;
  27.  
  28.  
  29. private var fastAttackCounter, heavyAttackCounter : int;
  30. private var isInFrenzy : bool;
  31. private var hasRecentlyCountered : bool;
  32. private saved var cannotUseUndyingSkill : bool;
  33.  
  34.  
  35. protected saved var amountOfSetPiecesEquipped : array<int>;
  36.  
  37.  
  38. public var canSwitchFocusModeTarget : bool;
  39. protected var switchFocusModeTargetAllowed : bool;
  40. default canSwitchFocusModeTarget = true;
  41. default switchFocusModeTargetAllowed = true;
  42.  
  43.  
  44. private editable var signs : array< SWitcherSign >;
  45. private saved var equippedSign : ESignType;
  46. private var currentlyCastSign : ESignType; default currentlyCastSign = ST_None;
  47. private var signOwner : W3SignOwnerPlayer;
  48. private var usedQuenInCombat : bool;
  49. public var yrdenEntities : array<W3YrdenEntity>;
  50. public saved var m_quenReappliedCount : int;
  51. private var m_quenHitFxTTL : float;
  52. private var m_TriggerEffectDisablePending : bool;
  53. private var m_TriggerEffectDisabled : bool;
  54. private var m_TriggerEffectDisableTTW : float;
  55.  
  56. default equippedSign = ST_Aard;
  57. default m_quenReappliedCount = 1;
  58.  
  59.  
  60.  
  61. private var bDispalyHeavyAttackIndicator : bool;
  62. private var bDisplayHeavyAttackFirstLevelTimer : bool;
  63. public var specialAttackHeavyAllowed : bool;
  64.  
  65. default bIsCombatActionAllowed = true;
  66. default bDispalyHeavyAttackIndicator = false;
  67. default bDisplayHeavyAttackFirstLevelTimer = true;
  68.  
  69.  
  70.  
  71. default explorationInputContext = 'Exploration';
  72. default combatInputContext = 'Combat';
  73. default combatFistsInputContext = 'Combat';
  74.  
  75.  
  76. private saved var companionNPCTag : name;
  77. private saved var companionNPCTag2 : name;
  78.  
  79. private saved var companionNPCIconPath : string;
  80. private saved var companionNPCIconPath2 : string;
  81.  
  82.  
  83. private saved var itemSlots : array<SItemUniqueId>;
  84. private var remainingBombThrowDelaySlot1 : float;
  85. private var remainingBombThrowDelaySlot2 : float;
  86. private var previouslyUsedBolt : SItemUniqueId;
  87. private saved var questMarkedSelectedQuickslotItems : array< SSelectedQuickslotItem >;
  88.  
  89. default isThrowingItem = false;
  90. default remainingBombThrowDelaySlot1 = 0.f;
  91. default remainingBombThrowDelaySlot2 = 0.f;
  92.  
  93.  
  94.  
  95.  
  96.  
  97. private saved var tempLearnedSignSkills : array<SSimpleSkill>;
  98. public saved var autoLevel : bool;
  99.  
  100.  
  101.  
  102.  
  103. protected saved var skillBonusPotionEffect : CBaseGameplayEffect;
  104.  
  105.  
  106. public saved var levelManager : W3LevelManager;
  107.  
  108.  
  109. saved var reputationManager : W3Reputation;
  110.  
  111.  
  112. private editable var medallionEntity : CEntityTemplate;
  113. private var medallionController : W3MedallionController;
  114.  
  115.  
  116.  
  117.  
  118. public var bShowRadialMenu : bool;
  119.  
  120. private var _HoldBeforeOpenRadialMenuTime : float;
  121.  
  122. default _HoldBeforeOpenRadialMenuTime = 0.5f;
  123.  
  124. public var MappinToHighlight : array<SHighlightMappin>;
  125.  
  126.  
  127. protected saved var horseManagerHandle : EntityHandle;
  128.  
  129. private var isInitialized : bool;
  130. private var timeForPerk21 : float;
  131.  
  132. default isInitialized = false;
  133.  
  134.  
  135. private var invUpdateTransaction : bool;
  136. default invUpdateTransaction = false;
  137.  
  138. public var lastPressedWithNostamina : bool;
  139. default lastPressedWithNostamina = false;
  140.  
  141.  
  142.  
  143.  
  144.  
  145.  
  146.  
  147.  
  148.  
  149.  
  150.  
  151. event OnSpawned( spawnData : SEntitySpawnData )
  152. {
  153. var i : int;
  154. var items : array<SItemUniqueId>;
  155. var items2 : array<SItemUniqueId>;
  156. var horseTemplate : CEntityTemplate;
  157. var horseManager : W3HorseManager;
  158.  
  159.  
  160. var exceptions : array<CBaseGameplayEffect>;
  161. var wolf : CBaseGameplayEffect;
  162.  
  163.  
  164. AddAnimEventCallback( 'ActionBlend', 'OnAnimEvent_ActionBlend' );
  165. AddAnimEventCallback('cast_begin', 'OnAnimEvent_Sign');
  166. AddAnimEventCallback('cast_throw', 'OnAnimEvent_Sign');
  167. AddAnimEventCallback('cast_end', 'OnAnimEvent_Sign');
  168. AddAnimEventCallback('cast_friendly_begin', 'OnAnimEvent_Sign');
  169. AddAnimEventCallback('cast_friendly_throw', 'OnAnimEvent_Sign');
  170. AddAnimEventCallback('axii_ready', 'OnAnimEvent_Sign');
  171. AddAnimEventCallback('axii_alternate_ready', 'OnAnimEvent_Sign');
  172. AddAnimEventCallback('yrden_draw_ready', 'OnAnimEvent_Sign');
  173.  
  174. AddAnimEventCallback( 'ProjectileThrow', 'OnAnimEvent_Throwable' );
  175. AddAnimEventCallback( 'OnWeaponReload', 'OnAnimEvent_Throwable' );
  176. AddAnimEventCallback( 'ProjectileAttach', 'OnAnimEvent_Throwable' );
  177. AddAnimEventCallback( 'Mutation11AnimEnd', 'OnAnimEvent_Mutation11AnimEnd' );
  178. AddAnimEventCallback( 'Mutation11ShockWave', 'OnAnimEvent_Mutation11ShockWave' );
  179.  
  180.  
  181.  
  182. amountOfSetPiecesEquipped.Resize( EnumGetMax( 'EItemSetType' ) + 1 );
  183.  
  184. runewordInfusionType = ST_None;
  185.  
  186.  
  187. inv = GetInventory();
  188.  
  189.  
  190. signOwner = new W3SignOwnerPlayer in this;
  191. signOwner.Init( this );
  192.  
  193. itemSlots.Resize( EnumGetMax('EEquipmentSlots')+1 );
  194.  
  195. if(!spawnData.restored)
  196. {
  197. levelManager = new W3LevelManager in this;
  198. levelManager.Initialize();
  199.  
  200.  
  201. inv.GetAllItems(items);
  202. for(i=0; i<items.Size(); i+=1)
  203. {
  204. if(inv.IsItemMounted(items[i]) && ( !inv.IsItemBody(items[i]) || inv.GetItemCategory(items[i]) == 'hair' ) )
  205. EquipItem(items[i]);
  206. }
  207.  
  208.  
  209.  
  210.  
  211.  
  212. AddAlchemyRecipe('Recipe for Swallow 1',true,true);
  213. AddAlchemyRecipe('Recipe for Cat 1',true,true);
  214. AddAlchemyRecipe('Recipe for White Honey 1',true,true);
  215.  
  216. AddAlchemyRecipe('Recipe for Samum 1',true,true);
  217. AddAlchemyRecipe('Recipe for Grapeshot 1',true,true);
  218.  
  219. AddAlchemyRecipe('Recipe for Specter Oil 1',true,true);
  220. AddAlchemyRecipe('Recipe for Necrophage Oil 1',true,true);
  221. AddAlchemyRecipe('Recipe for Alcohest 1',true,true);
  222. }
  223. else
  224. {
  225. AddTimer('DelayedOnItemMount', 0.1, true);
  226.  
  227.  
  228. CheckHairItem();
  229. }
  230.  
  231.  
  232. AddStartingSchematics();
  233.  
  234. super.OnSpawned( spawnData );
  235.  
  236.  
  237. AddAlchemyRecipe('Recipe for Mutagen red',true,true);
  238. AddAlchemyRecipe('Recipe for Mutagen green',true,true);
  239. AddAlchemyRecipe('Recipe for Mutagen blue',true,true);
  240. AddAlchemyRecipe('Recipe for Greater mutagen red',true,true);
  241. AddAlchemyRecipe('Recipe for Greater mutagen green',true,true);
  242. AddAlchemyRecipe('Recipe for Greater mutagen blue',true,true);
  243.  
  244. AddCraftingSchematic('Starting Armor Upgrade schematic 1',true,true);
  245.  
  246.  
  247. if( inputHandler )
  248. {
  249. inputHandler.BlockAllActions( 'being_ciri', false );
  250. }
  251. SetBehaviorVariable( 'test_ciri_replacer', 0.0f);
  252.  
  253. if(!spawnData.restored)
  254. {
  255.  
  256. abilityManager.GainStat(BCS_Toxicity, 0);
  257. }
  258.  
  259. levelManager.PostInit(this, spawnData.restored, true);
  260.  
  261. SetBIsCombatActionAllowed( true );
  262. SetBIsInputAllowed( true, 'OnSpawned' );
  263.  
  264.  
  265. if ( !reputationManager )
  266. {
  267. reputationManager = new W3Reputation in this;
  268. reputationManager.Initialize();
  269. }
  270.  
  271. theSound.SoundParameter( "focus_aim", 1.0f, 1.0f );
  272. theSound.SoundParameter( "focus_distance", 0.0f, 1.0f );
  273.  
  274.  
  275.  
  276.  
  277.  
  278.  
  279. currentlyCastSign = ST_None;
  280.  
  281.  
  282. if(!spawnData.restored)
  283. {
  284. horseTemplate = (CEntityTemplate)LoadResource("horse_manager");
  285. horseManager = (W3HorseManager)theGame.CreateEntity(horseTemplate, GetWorldPosition(),,,,,PM_Persist);
  286. horseManager.CreateAttachment(this);
  287. horseManager.OnCreated();
  288. EntityHandleSet( horseManagerHandle, horseManager );
  289. }
  290. else
  291. {
  292. AddTimer('DelayedHorseUpdate', 0.01, true);
  293. }
  294.  
  295.  
  296. RemoveAbility('Ciri_CombatRegen');
  297. RemoveAbility('Ciri_Rage');
  298. RemoveAbility('CiriBlink');
  299. RemoveAbility('CiriCharge');
  300. RemoveAbility('Ciri_Q205');
  301. RemoveAbility('Ciri_Q305');
  302. RemoveAbility('Ciri_Q403');
  303. RemoveAbility('Ciri_Q111');
  304. RemoveAbility('Ciri_Q501');
  305. RemoveAbility('SkillCiri');
  306.  
  307. if(spawnData.restored)
  308. {
  309. RestoreQuen(savedQuenHealth, savedQuenDuration);
  310. }
  311. else
  312. {
  313. savedQuenHealth = 0.f;
  314. savedQuenDuration = 0.f;
  315. }
  316.  
  317. if(spawnData.restored)
  318. {
  319. ApplyPatchFixes();
  320. }
  321. else
  322. {
  323.  
  324. FactsAdd( "new_game_started_in_1_20" );
  325. }
  326.  
  327. if ( spawnData.restored )
  328. {
  329. FixEquippedMutagens();
  330. }
  331.  
  332. if ( FactsQuerySum("NewGamePlus") > 0 )
  333. {
  334. NewGamePlusAdjustDLC1TemerianSet(inv);
  335. NewGamePlusAdjustDLC5NilfgardianSet(inv);
  336. NewGamePlusAdjustDLC10WolfSet(inv);
  337. NewGamePlusAdjustDLC14SkelligeSet(inv);
  338.  
  339.  
  340.  
  341.  
  342. if(horseManager)
  343. {
  344. NewGamePlusAdjustDLC1TemerianSet(horseManager.GetInventoryComponent());
  345. NewGamePlusAdjustDLC5NilfgardianSet(horseManager.GetInventoryComponent());
  346. NewGamePlusAdjustDLC10WolfSet(horseManager.GetInventoryComponent());
  347. NewGamePlusAdjustDLC14SkelligeSet(horseManager.GetInventoryComponent());
  348.  
  349.  
  350.  
  351.  
  352. }
  353. }
  354.  
  355.  
  356. ResumeStaminaRegen('WhirlSkill');
  357.  
  358. if(HasAbility('Runeword 4 _Stats', true))
  359. StartVitalityRegen();
  360.  
  361.  
  362. if(HasAbility('sword_s19'))
  363. {
  364. RemoveTemporarySkills();
  365. }
  366.  
  367. HACK_UnequipWolfLiver();
  368.  
  369.  
  370. if( HasBuff( EET_GryphonSetBonusYrden ) )
  371. {
  372. RemoveBuff( EET_GryphonSetBonusYrden, false, "GryphonSetBonusYrden" );
  373. }
  374.  
  375. if( spawnData.restored )
  376. {
  377.  
  378. UpdateEncumbrance();
  379.  
  380.  
  381. RemoveBuff( EET_Mutation11Immortal );
  382. RemoveBuff( EET_Mutation11Buff );
  383. }
  384.  
  385.  
  386. theGame.GameplayFactsAdd( "PlayerIsGeralt" );
  387.  
  388. isInitialized = true;
  389.  
  390.  
  391. if(IsMutationActive( EPMT_Mutation6 ))
  392. if(( (W3PlayerAbilityManager)abilityManager).GetMutationSoundBank(( EPMT_Mutation6 )) != "" )
  393. theSound.SoundLoadBank(((W3PlayerAbilityManager)abilityManager).GetMutationSoundBank(( EPMT_Mutation6 )), true );
  394.  
  395.  
  396.  
  397. if( FactsQuerySum("NGE_SkillPointsCheck") < 1 )
  398. {
  399.  
  400. ForceSetStat(BCS_Toxicity, 0);
  401. wolf = GetBuff(EET_WolfHour);
  402. if(wolf)
  403. exceptions.PushBack(wolf);
  404.  
  405. RemoveAllPotionEffects(exceptions);
  406.  
  407.  
  408. AddTimer('NGE_FixSkillPoints',1.0f,false);
  409. }
  410.  
  411.  
  412.  
  413. ManageSetBonusesSoundbanks(EIST_Lynx);
  414. ManageSetBonusesSoundbanks(EIST_Gryphon);
  415. ManageSetBonusesSoundbanks(EIST_Bear);
  416.  
  417.  
  418. m_quenHitFxTTL = 0;
  419. m_TriggerEffectDisablePending = false;
  420. m_TriggerEffectDisabled = false;
  421. ApplyGamepadTriggerEffect( equippedSign );
  422. AddTimer( 'UpdateGamepadTriggerEffect', 0.1, true );
  423. }
  424.  
  425.  
  426. private timer function NGE_FixSkillPoints( dt : float, id : int )
  427. {
  428. ((W3PlayerAbilityManager)abilityManager).NGEFixSkillPoints();
  429. FixNGESwords();
  430. FactsAdd("NGE_SkillPointsCheck");
  431. }
  432.  
  433.  
  434.  
  435. private function FixNGESwords()
  436. {
  437.  
  438. var swords, swordsTemp : array<SItemUniqueId>;
  439. var i : int;
  440. var equipped : bool;
  441. var runesList : array <name>;
  442.  
  443. swords = inv.GetItemsByName('sq304 Novigraadan sword 4');
  444. if(swords.Size() > 0)
  445. {
  446. for(i=0;i<swords.Size();i+=1)
  447. {
  448. if( IsItemEquipped(swords[i]) )
  449. equipped = true;
  450.  
  451. if ( inv.GetItemEnhancementCount(swords[i]) > 0 )
  452. {
  453. inv.GetItemEnhancementItems(swords[i], runesList);
  454. for (i = 0; i < runesList.Size(); i+=1)
  455. {
  456. inv.AddAnItem( runesList[i] );
  457. }
  458. }
  459.  
  460. inv.RemoveItem(swords[i],1);
  461. swordsTemp = inv.AddAnItem('sq304 Novigraadan sword 4',1,true,true);
  462. if(equipped)
  463. EquipItem(swordsTemp[0]);
  464. }
  465. }
  466.  
  467. swords = inv.GetItemsByName('q402 Skellige sword 3');
  468. if(swords.Size() > 0)
  469. {
  470. for(i=0;i<swords.Size();i+=1)
  471. {
  472. if( IsItemEquipped(swords[i]) )
  473. equipped = true;
  474.  
  475. if ( inv.GetItemEnhancementCount(swords[i]) > 0 )
  476. {
  477. inv.GetItemEnhancementItems(swords[i], runesList);
  478. for (i = 0; i < runesList.Size(); i+=1)
  479. {
  480. inv.AddAnItem( runesList[i] );
  481. }
  482. }
  483.  
  484. inv.RemoveItem(swords[i],1);
  485. swordsTemp = inv.AddAnItem('q402 Skellige sword 3',1,true,true);
  486. if(equipped)
  487. EquipItem( swordsTemp[0]);
  488. }
  489. }
  490. }
  491.  
  492.  
  493. event OnDestroyed()
  494. {
  495. RemoveTimer( 'UpdateGamepadTriggerEffect' );
  496.  
  497. theGame.ClearTriggerEffect(0);
  498. theGame.ClearTriggerEffect(1);
  499.  
  500. super.OnDestroyed();
  501. }
  502.  
  503.  
  504.  
  505.  
  506.  
  507. private function HACK_UnequipWolfLiver()
  508. {
  509. var itemName1, itemName2, itemName3, itemName4 : name;
  510. var item1, item2, item3, item4 : SItemUniqueId;
  511.  
  512. GetItemEquippedOnSlot( EES_Potion1, item1 );
  513. GetItemEquippedOnSlot( EES_Potion2, item2 );
  514. GetItemEquippedOnSlot( EES_Potion3, item3 );
  515. GetItemEquippedOnSlot( EES_Potion4, item4 );
  516.  
  517. if ( inv.IsIdValid( item1 ) )
  518. itemName1 = inv.GetItemName( item1 );
  519. if ( inv.IsIdValid( item2 ) )
  520. itemName2 = inv.GetItemName( item2 );
  521. if ( inv.IsIdValid( item3 ) )
  522. itemName3 = inv.GetItemName( item3 );
  523. if ( inv.IsIdValid( item4 ) )
  524. itemName4 = inv.GetItemName( item4 );
  525.  
  526. if ( itemName1 == 'Wolf liver' || itemName3 == 'Wolf liver' )
  527. {
  528. if ( inv.IsIdValid( item1 ) )
  529. UnequipItem( item1 );
  530. if ( inv.IsIdValid( item3 ) )
  531. UnequipItem( item3 );
  532. }
  533. else if ( itemName2 == 'Wolf liver' || itemName4 == 'Wolf liver' )
  534. {
  535. if ( inv.IsIdValid( item2 ) )
  536. UnequipItem( item2 );
  537. if ( inv.IsIdValid( item4 ) )
  538. UnequipItem( item4 );
  539. }
  540. }
  541.  
  542.  
  543.  
  544.  
  545.  
  546. timer function DelayedHorseUpdate( dt : float, id : int )
  547. {
  548. var man : W3HorseManager;
  549.  
  550. man = GetHorseManager();
  551. if(man)
  552. {
  553. if ( man.ApplyHorseUpdateOnSpawn() )
  554. {
  555.  
  556. UpdateEncumbrance();
  557.  
  558. RemoveTimer( 'DelayedHorseUpdate' );
  559. }
  560. }
  561. }
  562.  
  563. // ESGO -- Begin
  564. timer function DelayedAutoLevelGear( dt: float, id : int )
  565. {
  566. ESGOAutoLevelGear();
  567. }
  568. // ESGO -- End
  569.  
  570. event OnAbilityAdded( abilityName : name)
  571. {
  572. super.OnAbilityAdded(abilityName);
  573.  
  574. if( HasAbility('Runeword 4 _Stats', true) )
  575. {
  576. StartVitalityRegen();
  577. }
  578.  
  579. if ( abilityName == 'Runeword 8 _Stats' && GetStat(BCS_Focus, true) >= GetStatMax(BCS_Focus) && !HasBuff(EET_Runeword8) )
  580. {
  581. AddEffectDefault(EET_Runeword8, this, "equipped item");
  582. }
  583.  
  584. }
  585.  
  586. private final function AddStartingSchematics()
  587. {
  588. AddCraftingSchematic('Starting Armor Upgrade schematic 1', true,true);
  589. AddCraftingSchematic('Thread schematic', true, true);
  590. AddCraftingSchematic('String schematic', true, true);
  591. AddCraftingSchematic('Linen schematic', true, true);
  592. AddCraftingSchematic('Silk schematic', true, true);
  593. AddCraftingSchematic('Resin schematic', true, true);
  594. AddCraftingSchematic('Blasting powder schematic', true, true);
  595. AddCraftingSchematic('Haft schematic', true, true);
  596. AddCraftingSchematic('Hardened timber schematic', true, true);
  597. AddCraftingSchematic('Leather squares schematic', true, true);
  598. AddCraftingSchematic('Leather schematic', true, true);
  599. AddCraftingSchematic('Hardened leather schematic', true, true);
  600. AddCraftingSchematic('Draconide leather schematic', true, true);
  601. AddCraftingSchematic('Iron ingot schematic', true, true);
  602. AddCraftingSchematic('Steel ingot schematic', true, true);
  603. AddCraftingSchematic('Steel ingot schematic 1', true, true);
  604. AddCraftingSchematic('Steel plate schematic', true, true);
  605. AddCraftingSchematic('Dark iron ingot schematic', true, true);
  606. AddCraftingSchematic('Dark iron plate schematic', true, true);
  607. AddCraftingSchematic('Dark steel ingot schematic', true, true);
  608. AddCraftingSchematic('Dark steel ingot schematic 1', true, true);
  609. AddCraftingSchematic('Dark steel plate schematic', true, true);
  610. AddCraftingSchematic('Silver ore schematic', true, true);
  611. AddCraftingSchematic('Silver ingot schematic', true, true);
  612. AddCraftingSchematic('Silver ingot schematic 1', true, true);
  613. AddCraftingSchematic('Silver plate schematic', true, true);
  614. AddCraftingSchematic('Meteorite ingot schematic', true, true);
  615. AddCraftingSchematic('Meteorite silver ingot schematic', true, true);
  616. AddCraftingSchematic('Meteorite silver plate schematic', true, true);
  617. AddCraftingSchematic('Glowing ingot schematic', true, true);
  618. AddCraftingSchematic('Dwimeryte ore schematic', true, true);
  619. AddCraftingSchematic('Dwimeryte ingot schematic', true, true);
  620. AddCraftingSchematic('Dwimeryte ingot schematic 1', true, true);
  621. AddCraftingSchematic('Dwimeryte plate schematic', true, true);
  622. AddCraftingSchematic('Infused dust schematic', true, true);
  623. AddCraftingSchematic('Infused shard schematic', true, true);
  624. AddCraftingSchematic('Infused crystal schematic', true, true);
  625.  
  626. if ( theGame.GetDLCManager().IsEP2Available() )
  627. {
  628. AddCraftingSchematic('Draconide infused leather schematic', true, true);
  629. AddCraftingSchematic('Nickel ore schematic', true, true);
  630. AddCraftingSchematic('Cupronickel ore schematic', true, true);
  631. AddCraftingSchematic('Copper ore schematic', true, true);
  632. AddCraftingSchematic('Copper ingot schematic', true, true);
  633. AddCraftingSchematic('Copper plate schematic', true, true);
  634. AddCraftingSchematic('Green gold ore schematic', true, true);
  635. AddCraftingSchematic('Green gold ore schematic 1', true, true);
  636. AddCraftingSchematic('Green gold ingot schematic', true, true);
  637. AddCraftingSchematic('Green gold plate schematic', true, true);
  638. AddCraftingSchematic('Orichalcum ore schematic', true, true);
  639. AddCraftingSchematic('Orichalcum ore schematic 1', true, true);
  640. AddCraftingSchematic('Orichalcum ingot schematic', true, true);
  641. AddCraftingSchematic('Orichalcum plate schematic', true, true);
  642. AddCraftingSchematic('Dwimeryte enriched ore schematic', true, true);
  643. AddCraftingSchematic('Dwimeryte enriched ingot schematic', true, true);
  644. AddCraftingSchematic('Dwimeryte enriched plate schematic', true, true);
  645. }
  646. }
  647.  
  648. private final function ApplyPatchFixes()
  649. {
  650. var cnt, transmutationCount, mutagenCount, i, slot : int;
  651. var transmutationAbility, itemName : name;
  652. var pam : W3PlayerAbilityManager;
  653. var slotId : int;
  654. var offset : float;
  655. var buffs : array<CBaseGameplayEffect>;
  656. var mutagen : W3Mutagen_Effect;
  657. var skill : SSimpleSkill;
  658. var spentSkillPoints, swordSkillPointsSpent, alchemySkillPointsSpent, perkSkillPointsSpent, pointsToAdd : int;
  659. var mutagens : array< W3Mutagen_Effect >;
  660.  
  661. if(FactsQuerySum("ClearingPotionPassiveBonusFix") < 1)
  662. {
  663. pam = (W3PlayerAbilityManager)abilityManager;
  664.  
  665. cnt = GetAbilityCount('sword_adrenalinegain') - pam.GetPathPointsSpent(ESP_Sword);
  666. if(cnt > 0)
  667. RemoveAbilityMultiple('sword_adrenalinegain', cnt);
  668.  
  669. cnt = GetAbilityCount('magic_staminaregen') - pam.GetPathPointsSpent(ESP_Signs);
  670. if(cnt > 0)
  671. RemoveAbilityMultiple('magic_staminaregen', cnt);
  672.  
  673. cnt = GetAbilityCount('alchemy_potionduration') - pam.GetPathPointsSpent(ESP_Alchemy);
  674. if(cnt > 0)
  675. RemoveAbilityMultiple('alchemy_potionduration', cnt);
  676.  
  677. FactsAdd("ClearingPotionPassiveBonusFix");
  678. }
  679.  
  680.  
  681. if(FactsQuerySum("DimeritiumSynergyFix") < 1)
  682. {
  683. slotId = GetSkillSlotID(S_Alchemy_s19);
  684. if(slotId != -1)
  685. UnequipSkill(S_Alchemy_s19);
  686.  
  687. RemoveAbilityAll('greater_mutagen_color_green_synergy_bonus');
  688. RemoveAbilityAll('mutagen_color_green_synergy_bonus');
  689. RemoveAbilityAll('mutagen_color_lesser_green_synergy_bonus');
  690.  
  691. RemoveAbilityAll('greater_mutagen_color_blue_synergy_bonus');
  692. RemoveAbilityAll('mutagen_color_blue_synergy_bonus');
  693. RemoveAbilityAll('mutagen_color_lesser_blue_synergy_bonus');
  694.  
  695. RemoveAbilityAll('greater_mutagen_color_red_synergy_bonus');
  696. RemoveAbilityAll('mutagen_color_red_synergy_bonus');
  697. RemoveAbilityAll('mutagen_color_lesser_red_synergy_bonus');
  698.  
  699. if(slotId != -1)
  700. EquipSkill(S_Alchemy_s19, slotId);
  701.  
  702. FactsAdd("DimeritiumSynergyFix");
  703. }
  704.  
  705.  
  706. if(FactsQuerySum("DontShowRecipePinTut") < 1)
  707. {
  708. FactsAdd( "DontShowRecipePinTut" );
  709. TutorialScript('alchemyRecipePin', '');
  710. TutorialScript('craftingRecipePin', '');
  711. }
  712.  
  713.  
  714. if(FactsQuerySum("LevelReqPotGiven") < 1)
  715. {
  716. FactsAdd("LevelReqPotGiven");
  717. inv.AddAnItem('Wolf Hour', 1, false, false, true);
  718. }
  719.  
  720.  
  721. if(!HasBuff(EET_AutoStaminaRegen))
  722. {
  723. AddEffectDefault(EET_AutoStaminaRegen, this, 'autobuff', false);
  724. }
  725.  
  726.  
  727.  
  728. buffs = GetBuffs();
  729. offset = 0;
  730. mutagenCount = 0;
  731. for(i=0; i<buffs.Size(); i+=1)
  732. {
  733. mutagen = (W3Mutagen_Effect)buffs[i];
  734. if(mutagen)
  735. {
  736. offset += mutagen.GetToxicityOffset();
  737. mutagenCount += 1;
  738. }
  739. }
  740.  
  741.  
  742. if(offset != (GetStat(BCS_Toxicity) - GetStat(BCS_Toxicity, true)))
  743. SetToxicityOffset(offset);
  744.  
  745.  
  746. mutagenCount *= GetSkillLevel(S_Alchemy_s13);
  747. transmutationAbility = GetSkillAbilityName(S_Alchemy_s13);
  748. transmutationCount = GetAbilityCount(transmutationAbility);
  749. if(mutagenCount < transmutationCount)
  750. {
  751. RemoveAbilityMultiple(transmutationAbility, transmutationCount - mutagenCount);
  752. }
  753. else if(mutagenCount > transmutationCount)
  754. {
  755. AddAbilityMultiple(transmutationAbility, mutagenCount - transmutationCount);
  756. }
  757.  
  758.  
  759. if(theGame.GetDLCManager().IsEP1Available())
  760. {
  761. theGame.GetJournalManager().ActivateEntryByScriptTag('TutorialJournalEnchanting', JS_Active);
  762. }
  763.  
  764.  
  765. if(HasAbility('sword_s19') && FactsQuerySum("Patch_Sword_s19") < 1)
  766. {
  767. pam = (W3PlayerAbilityManager)abilityManager;
  768.  
  769.  
  770. skill.level = 0;
  771. for(i = S_Magic_s01; i <= S_Magic_s20; i+=1)
  772. {
  773. skill.skillType = i;
  774. pam.RemoveTemporarySkill(skill);
  775. }
  776.  
  777.  
  778. spentSkillPoints = levelManager.GetPointsUsed(ESkillPoint);
  779. swordSkillPointsSpent = pam.GetPathPointsSpent(ESP_Sword);
  780. alchemySkillPointsSpent = pam.GetPathPointsSpent(ESP_Alchemy);
  781. perkSkillPointsSpent = pam.GetPathPointsSpent(ESP_Perks);
  782.  
  783. pointsToAdd = spentSkillPoints - swordSkillPointsSpent - alchemySkillPointsSpent - perkSkillPointsSpent;
  784. if(pointsToAdd > 0)
  785. levelManager.UnspendPoints(ESkillPoint, pointsToAdd);
  786.  
  787.  
  788. RemoveAbilityAll('sword_s19');
  789.  
  790.  
  791. FactsAdd("Patch_Sword_s19");
  792. }
  793.  
  794.  
  795. if( HasAbility( 'sword_s19' ) )
  796. {
  797. RemoveAbilityAll( 'sword_s19' );
  798. }
  799.  
  800.  
  801. if(FactsQuerySum("Patch_Armor_Type_Glyphwords") < 1)
  802. {
  803. pam = (W3PlayerAbilityManager)abilityManager;
  804.  
  805. pam.SetPerkArmorBonus( S_Perk_05, this );
  806. pam.SetPerkArmorBonus( S_Perk_06, this );
  807. pam.SetPerkArmorBonus( S_Perk_07, this );
  808.  
  809. FactsAdd("Patch_Armor_Type_Glyphwords");
  810. }
  811. else if( FactsQuerySum("154999") < 1 )
  812. {
  813.  
  814. pam = (W3PlayerAbilityManager)abilityManager;
  815.  
  816. pam.SetPerkArmorBonus( S_Perk_05, this );
  817. pam.SetPerkArmorBonus( S_Perk_06, this );
  818. pam.SetPerkArmorBonus( S_Perk_07, this );
  819.  
  820. FactsAdd("154999");
  821. }
  822.  
  823. if( FactsQuerySum( "Patch_Decoction_Buff_Icons" ) < 1 )
  824. {
  825. mutagens = GetMutagenBuffs();
  826. for( i=0; i<mutagens.Size(); i+=1 )
  827. {
  828. itemName = DecoctionEffectTypeToItemName( mutagens[i].GetEffectType() );
  829. mutagens[i].OverrideIcon( itemName );
  830. }
  831.  
  832. FactsAdd( "Patch_Decoction_Buff_Icons" );
  833. }
  834.  
  835.  
  836. if( FactsQuerySum( "154997" ) < 1 )
  837. {
  838. if( IsSkillEquipped( S_Alchemy_s18 ) )
  839. {
  840. slot = GetSkillSlotID( S_Alchemy_s18 );
  841. UnequipSkill( slot );
  842. EquipSkill( S_Alchemy_s18, slot );
  843. }
  844. FactsAdd( "154997" );
  845. }
  846. if( FactsQuerySum( "Patch_Mutagen_Ing_Stacking" ) < 1 )
  847. {
  848. Patch_MutagenStacking();
  849. FactsAdd( "Patch_Mutagen_Ing_Stacking" );
  850. }
  851. }
  852.  
  853. private final function Patch_MutagenStacking()
  854. {
  855. var i, j, quantity : int;
  856. var muts : array< SItemUniqueId >;
  857. var item : SItemUniqueId;
  858. var mutName : name;
  859. var wasInArray : bool;
  860. var mutsToAdd : array< SItemParts >;
  861. var mutToAdd : SItemParts;
  862.  
  863. muts = inv.GetItemsByTag( 'MutagenIngredient' );
  864. if( GetItemEquippedOnSlot( EES_SkillMutagen1, item ) )
  865. {
  866. muts.Remove( item );
  867. inv.SetItemStackable( item, false );
  868. }
  869. if( GetItemEquippedOnSlot( EES_SkillMutagen2, item ) )
  870. {
  871. muts.Remove( item );
  872. inv.SetItemStackable( item, false );
  873. }
  874. if( GetItemEquippedOnSlot( EES_SkillMutagen3, item ) )
  875. {
  876. muts.Remove( item );
  877. inv.SetItemStackable( item, false );
  878. }
  879. if( GetItemEquippedOnSlot( EES_SkillMutagen4, item ) )
  880. {
  881. muts.Remove( item );
  882. inv.SetItemStackable( item, false );
  883. }
  884.  
  885. for( i=0; i<muts.Size(); i+=1 )
  886. {
  887. mutName = inv.GetItemName( muts[i] );
  888. quantity = inv.GetItemQuantity( muts[i] );
  889.  
  890. wasInArray = false;
  891. for( j=0; j<mutsToAdd.Size(); j+=1 )
  892. {
  893. if( mutsToAdd[j].itemName == mutName )
  894. {
  895. mutsToAdd[j].quantity += quantity;
  896. wasInArray = true;
  897. break;
  898. }
  899. }
  900.  
  901. if( !wasInArray )
  902. {
  903. mutToAdd.itemName = mutName;
  904. mutToAdd.quantity = quantity;
  905. mutsToAdd.PushBack( mutToAdd );
  906. }
  907.  
  908. inv.RemoveItem( muts[i], quantity );
  909. }
  910.  
  911. for( i=0; i<mutsToAdd.Size(); i+=1 )
  912. {
  913. inv.AddAnItem( mutsToAdd[i].itemName, mutsToAdd[i].quantity, true, true );
  914. }
  915. }
  916.  
  917. private function FixEquippedMutagens()
  918. {
  919. var item : SItemUniqueId;
  920. if( GetItemEquippedOnSlot( EES_SkillMutagen1, item ) )
  921. {
  922. inv.SetItemStackable( item, false );
  923. }
  924. if( GetItemEquippedOnSlot( EES_SkillMutagen2, item ) )
  925. {
  926. inv.SetItemStackable( item, false );
  927. }
  928. if( GetItemEquippedOnSlot( EES_SkillMutagen3, item ) )
  929. {
  930. inv.SetItemStackable( item, false );
  931. }
  932. if( GetItemEquippedOnSlot( EES_SkillMutagen4, item ) )
  933. {
  934. inv.SetItemStackable( item, false );
  935. }
  936. }
  937.  
  938. public final function RestoreQuen( quenHealth : float, quenDuration : float, optional alternate : bool ) : bool
  939. {
  940. var restoredQuen : W3QuenEntity;
  941.  
  942. if(quenHealth > 0.f && quenDuration >= 3.f)
  943. {
  944. restoredQuen = (W3QuenEntity)theGame.CreateEntity( signs[ST_Quen].template, GetWorldPosition(), GetWorldRotation() );
  945. restoredQuen.Init( signOwner, signs[ST_Quen].entity, true );
  946.  
  947. if( alternate )
  948. {
  949. restoredQuen.SetAlternateCast( S_Magic_s04 );
  950. }
  951.  
  952. restoredQuen.OnStarted();
  953. restoredQuen.OnThrowing();
  954.  
  955. if( !alternate )
  956. {
  957. restoredQuen.OnEnded();
  958. }
  959.  
  960. restoredQuen.SetDataFromRestore(quenHealth, quenDuration);
  961.  
  962. return true;
  963. }
  964.  
  965. return false;
  966. }
  967.  
  968. public function IsInitialized() : bool
  969. {
  970. return isInitialized;
  971. }
  972.  
  973. private function NewGamePlusInitialize()
  974. {
  975. var questItems : array<name>;
  976. var horseManager : W3HorseManager;
  977. var horseInventory : CInventoryComponent;
  978. var i, missingLevels, expDiff : int;
  979.  
  980. super.NewGamePlusInitialize();
  981.  
  982.  
  983. horseManager = (W3HorseManager)EntityHandleGet(horseManagerHandle);
  984. if(horseManager)
  985. horseInventory = horseManager.GetInventoryComponent();
  986.  
  987.  
  988. theGame.params.SetNewGamePlusLevel(GetLevel());
  989.  
  990.  
  991. if (theGame.GetDLCManager().IsDLCAvailable('ep1'))
  992. missingLevels = theGame.params.NEW_GAME_PLUS_EP1_MIN_LEVEL - GetLevel();
  993. else
  994. missingLevels = theGame.params.NEW_GAME_PLUS_MIN_LEVEL - GetLevel();
  995.  
  996. for(i=0; i<missingLevels; i+=1)
  997. {
  998.  
  999. expDiff = levelManager.GetTotalExpForNextLevel() - levelManager.GetPointsTotal(EExperiencePoint);
  1000. expDiff = CeilF( ((float)expDiff) / 2 );
  1001. AddPoints(EExperiencePoint, expDiff, false);
  1002. }
  1003.  
  1004.  
  1005.  
  1006.  
  1007.  
  1008. inv.RemoveItemByTag('Quest', -1);
  1009. horseInventory.RemoveItemByTag('Quest', -1);
  1010.  
  1011.  
  1012.  
  1013. questItems = theGame.GetDefinitionsManager().GetItemsWithTag('Quest');
  1014. for(i=0; i<questItems.Size(); i+=1)
  1015. {
  1016. inv.RemoveItemByName(questItems[i], -1);
  1017. horseInventory.RemoveItemByName(questItems[i], -1);
  1018. }
  1019.  
  1020.  
  1021. inv.RemoveItemByName('mq1002_artifact_3', -1);
  1022. horseInventory.RemoveItemByName('mq1002_artifact_3', -1);
  1023.  
  1024.  
  1025. inv.RemoveItemByTag('NotTransferableToNGP', -1);
  1026. horseInventory.RemoveItemByTag('NotTransferableToNGP', -1);
  1027.  
  1028.  
  1029. inv.RemoveItemByTag('NoticeBoardNote', -1);
  1030. horseInventory.RemoveItemByTag('NoticeBoardNote', -1);
  1031.  
  1032.  
  1033. RemoveAllNonAutoBuffs();
  1034.  
  1035.  
  1036. RemoveAlchemyRecipe('Recipe for Trial Potion Kit');
  1037. RemoveAlchemyRecipe('Recipe for Pops Antidote');
  1038. RemoveAlchemyRecipe('Recipe for Czart Lure');
  1039. RemoveAlchemyRecipe('q603_diarrhea_potion_recipe');
  1040.  
  1041.  
  1042. inv.RemoveItemByTag('Trophy', -1);
  1043. horseInventory.RemoveItemByTag('Trophy', -1);
  1044.  
  1045.  
  1046. inv.RemoveItemByCategory('usable', -1);
  1047. horseInventory.RemoveItemByCategory('usable', -1);
  1048.  
  1049.  
  1050. RemoveAbility('StaminaTutorialProlog');
  1051. RemoveAbility('TutorialStaminaRegenHack');
  1052. RemoveAbility('area_novigrad');
  1053. RemoveAbility('NoRegenEffect');
  1054. RemoveAbility('HeavySwimmingStaminaDrain');
  1055. RemoveAbility('AirBoost');
  1056. RemoveAbility('area_nml');
  1057. RemoveAbility('area_skellige');
  1058.  
  1059.  
  1060. inv.RemoveItemByTag('GwintCard', -1);
  1061. horseInventory.RemoveItemByTag('GwintCard', -1);
  1062.  
  1063.  
  1064.  
  1065. inv.RemoveItemByTag('ReadableItem', -1);
  1066. horseInventory.RemoveItemByTag('ReadableItem', -1);
  1067.  
  1068.  
  1069. abilityManager.RestoreStats();
  1070.  
  1071.  
  1072. ((W3PlayerAbilityManager)abilityManager).RemoveToxicityOffset(10000);
  1073.  
  1074.  
  1075. GetInventory().SingletonItemsRefillAmmo();
  1076.  
  1077.  
  1078. craftingSchematics.Clear();
  1079. AddStartingSchematics();
  1080.  
  1081.  
  1082. for( i=0; i<amountOfSetPiecesEquipped.Size(); i+=1 )
  1083. {
  1084. amountOfSetPiecesEquipped[i] = 0;
  1085. }
  1086.  
  1087.  
  1088. inv.AddAnItem('Clearing Potion', 1, true, false, false);
  1089.  
  1090.  
  1091. inv.RemoveItemByName('q203_broken_eyeofloki', -1);
  1092. horseInventory.RemoveItemByName('q203_broken_eyeofloki', -1);
  1093.  
  1094.  
  1095. NewGamePlusReplaceViperSet(inv);
  1096. NewGamePlusReplaceViperSet(horseInventory);
  1097. NewGamePlusReplaceLynxSet(inv);
  1098. NewGamePlusReplaceLynxSet(horseInventory);
  1099. NewGamePlusReplaceGryphonSet(inv);
  1100. NewGamePlusReplaceGryphonSet(horseInventory);
  1101. NewGamePlusReplaceBearSet(inv);
  1102. NewGamePlusReplaceBearSet(horseInventory);
  1103. NewGamePlusReplaceEP1(inv);
  1104. NewGamePlusReplaceEP1(horseInventory);
  1105. NewGamePlusReplaceEP2WitcherSets(inv);
  1106. NewGamePlusReplaceEP2WitcherSets(horseInventory);
  1107. NewGamePlusReplaceEP2Items(inv);
  1108. NewGamePlusReplaceEP2Items(horseInventory);
  1109. NewGamePlusMarkItemsToNotAdjust(inv);
  1110. NewGamePlusMarkItemsToNotAdjust(horseInventory);
  1111.  
  1112. NewGamePlusReplaceNetflixSet(inv);
  1113. NewGamePlusReplaceNetflixSet(horseInventory);
  1114.  
  1115. NewGamePlusReplaceDolBlathannaSet(inv);
  1116. NewGamePlusReplaceDolBlathannaSet(horseInventory);
  1117.  
  1118. NewGamePlusReplaceWhiteTigerSet(inv);
  1119. NewGamePlusReplaceWhiteTigerSet(horseInventory);
  1120.  
  1121.  
  1122. inputHandler.ClearLocksForNGP();
  1123.  
  1124.  
  1125. buffImmunities.Clear();
  1126. buffRemovedImmunities.Clear();
  1127.  
  1128. newGamePlusInitialized = true;
  1129.  
  1130.  
  1131. m_quenReappliedCount = 1;
  1132.  
  1133.  
  1134.  
  1135.  
  1136. tiedWalk = false;
  1137. proudWalk = false;
  1138. injuredWalk = false;
  1139. SetBehaviorVariable( 'alternateWalk', 0.0f );
  1140. SetBehaviorVariable( 'proudWalk', 0.0f );
  1141. if( GetHorseManager().GetHorseMode() == EHM_Unicorn )
  1142. GetHorseManager().SetHorseMode( EHM_Normal );
  1143.  
  1144. }
  1145.  
  1146. private final function NewGamePlusMarkItemsToNotAdjust(out inv : CInventoryComponent)
  1147. {
  1148. var ids : array<SItemUniqueId>;
  1149. var i : int;
  1150. var n : name;
  1151.  
  1152. inv.GetAllItems(ids);
  1153. for( i=0; i<ids.Size(); i+=1 )
  1154. {
  1155. inv.SetItemModifierInt(ids[i], 'NGPItemAdjusted', 1);
  1156. }
  1157. }
  1158.  
  1159. private final function NewGamePlusReplaceItem( item : name, new_item : name, out inv : CInventoryComponent)
  1160. {
  1161. var i, j : int;
  1162. var ids, new_ids, enh_ids : array<SItemUniqueId>;
  1163. var dye_ids : array<SItemUniqueId>;
  1164. var enh : array<name>;
  1165. var wasEquipped : bool;
  1166. var wasEnchanted : bool;
  1167. var wasDyed : bool;
  1168. var enchantName, colorName : name;
  1169.  
  1170. if ( inv.HasItem( item ) )
  1171. {
  1172. ids = inv.GetItemsIds(item);
  1173. for (i = 0; i < ids.Size(); i += 1)
  1174. {
  1175. inv.GetItemEnhancementItems( ids[i], enh );
  1176. wasEnchanted = inv.IsItemEnchanted( ids[i] );
  1177. if ( wasEnchanted )
  1178. enchantName = inv.GetEnchantment( ids[i] );
  1179. wasEquipped = IsItemEquipped( ids[i] );
  1180. wasDyed = inv.IsItemColored( ids[i] );
  1181. if ( wasDyed )
  1182. {
  1183. colorName = inv.GetItemColor( ids[i] );
  1184. }
  1185.  
  1186. inv.RemoveItem( ids[i], 1 );
  1187. new_ids = inv.AddAnItem( new_item, 1, true, true, false );
  1188. if ( wasEquipped )
  1189. {
  1190. EquipItem( new_ids[0] );
  1191. }
  1192. if ( wasEnchanted )
  1193. {
  1194. inv.EnchantItem( new_ids[0], enchantName, getEnchamtmentStatName(enchantName) );
  1195. }
  1196. for (j = 0; j < enh.Size(); j += 1)
  1197. {
  1198. enh_ids = inv.AddAnItem( enh[j], 1, true, true, false );
  1199. inv.EnhanceItemScript( new_ids[0], enh_ids[0] );
  1200. }
  1201. if ( wasDyed )
  1202. {
  1203. dye_ids = inv.AddAnItem( colorName, 1, true, true, false );
  1204. inv.ColorItem( new_ids[0], dye_ids[0] );
  1205. inv.RemoveItem( dye_ids[0], 1 );
  1206. }
  1207.  
  1208. inv.SetItemModifierInt( new_ids[0], 'NGPItemAdjusted', 1 );
  1209. }
  1210. }
  1211. }
  1212.  
  1213. private final function NewGamePlusAdjustDLCItem(item : name, mod : name, inv : CInventoryComponent)
  1214. {
  1215. var ids : array<SItemUniqueId>;
  1216. var i : int;
  1217.  
  1218. if( inv.HasItem(item) )
  1219. {
  1220. ids = inv.GetItemsIds(item);
  1221. for (i = 0; i < ids.Size(); i += 1)
  1222. {
  1223. if ( inv.GetItemModifierInt(ids[i], 'DoNotAdjustNGPDLC') <= 0 )
  1224. {
  1225. inv.AddItemBaseAbility(ids[i], mod);
  1226. inv.SetItemModifierInt(ids[i], 'DoNotAdjustNGPDLC', 1);
  1227. }
  1228. }
  1229. }
  1230.  
  1231. }
  1232.  
  1233. private final function NewGamePlusAdjustDLC1TemerianSet(inv : CInventoryComponent)
  1234. {
  1235. NewGamePlusAdjustDLCItem('NGP DLC1 Temerian Armor', 'NGP DLC Compatibility Chest Armor Mod', inv);
  1236. NewGamePlusAdjustDLCItem('NGP DLC1 Temerian Gloves', 'NGP DLC Compatibility Armor Mod', inv);
  1237. NewGamePlusAdjustDLCItem('NGP DLC1 Temerian Pants', 'NGP DLC Compatibility Armor Mod', inv);
  1238. NewGamePlusAdjustDLCItem('NGP DLC1 Temerian Boots', 'NGP DLC Compatibility Armor Mod', inv);
  1239. }
  1240.  
  1241. private final function NewGamePlusAdjustDLC5NilfgardianSet(inv : CInventoryComponent)
  1242. {
  1243. NewGamePlusAdjustDLCItem('NGP DLC5 Nilfgaardian Armor', 'NGP DLC Compatibility Chest Armor Mod', inv);
  1244. NewGamePlusAdjustDLCItem('NGP DLC5 Nilfgaardian Gloves', 'NGP DLC Compatibility Armor Mod', inv);
  1245. NewGamePlusAdjustDLCItem('NGP DLC5 Nilfgaardian Pants', 'NGP DLC Compatibility Armor Mod', inv);
  1246. NewGamePlusAdjustDLCItem('NGP DLC5 Nilfgaardian Boots', 'NGP DLC Compatibility Armor Mod', inv);
  1247. }
  1248.  
  1249. private final function NewGamePlusAdjustDLC10WolfSet(inv : CInventoryComponent)
  1250. {
  1251. NewGamePlusAdjustDLCItem('NGP Wolf Armor', 'NGP DLC Compatibility Chest Armor Mod', inv);
  1252. NewGamePlusAdjustDLCItem('NGP Wolf Armor 1', 'NGP DLC Compatibility Chest Armor Mod', inv);
  1253. NewGamePlusAdjustDLCItem('NGP Wolf Armor 2', 'NGP DLC Compatibility Chest Armor Mod', inv);
  1254. NewGamePlusAdjustDLCItem('NGP Wolf Armor 3', 'NGP DLC Compatibility Chest Armor Mod', inv);
  1255.  
  1256. NewGamePlusAdjustDLCItem('NGP Wolf Boots 1', 'NGP DLC Compatibility Armor Mod', inv);
  1257. NewGamePlusAdjustDLCItem('NGP Wolf Boots 2', 'NGP DLC Compatibility Armor Mod', inv);
  1258. NewGamePlusAdjustDLCItem('NGP Wolf Boots 3', 'NGP DLC Compatibility Armor Mod', inv);
  1259. NewGamePlusAdjustDLCItem('NGP Wolf Boots 4', 'NGP DLC Compatibility Armor Mod', inv);
  1260.  
  1261. NewGamePlusAdjustDLCItem('NGP Wolf Gloves 1', 'NGP DLC Compatibility Armor Mod', inv);
  1262. NewGamePlusAdjustDLCItem('NGP Wolf Gloves 2', 'NGP DLC Compatibility Armor Mod', inv);
  1263. NewGamePlusAdjustDLCItem('NGP Wolf Gloves 3', 'NGP DLC Compatibility Armor Mod', inv);
  1264. NewGamePlusAdjustDLCItem('NGP Wolf Gloves 4', 'NGP DLC Compatibility Armor Mod', inv);
  1265.  
  1266. NewGamePlusAdjustDLCItem('NGP Wolf Pants 1', 'NGP DLC Compatibility Armor Mod', inv);
  1267. NewGamePlusAdjustDLCItem('NGP Wolf Pants 2', 'NGP DLC Compatibility Armor Mod', inv);
  1268. NewGamePlusAdjustDLCItem('NGP Wolf Pants 3', 'NGP DLC Compatibility Armor Mod', inv);
  1269. NewGamePlusAdjustDLCItem('NGP Wolf Pants 4', 'NGP DLC Compatibility Armor Mod', inv);
  1270.  
  1271. NewGamePlusAdjustDLCItem('NGP Wolf School steel sword', 'NGP Wolf Steel Sword Mod', inv);
  1272. NewGamePlusAdjustDLCItem('NGP Wolf School steel sword 1', 'NGP Wolf Steel Sword Mod', inv);
  1273. NewGamePlusAdjustDLCItem('NGP Wolf School steel sword 2', 'NGP Wolf Steel Sword Mod', inv);
  1274. NewGamePlusAdjustDLCItem('NGP Wolf School steel sword 3', 'NGP Wolf Steel Sword Mod', inv);
  1275.  
  1276. NewGamePlusAdjustDLCItem('NGP Wolf School silver sword', 'NGP Wolf Silver Sword Mod', inv);
  1277. NewGamePlusAdjustDLCItem('NGP Wolf School silver sword 1', 'NGP Wolf Silver Sword Mod', inv);
  1278. NewGamePlusAdjustDLCItem('NGP Wolf School silver sword 2', 'NGP Wolf Silver Sword Mod', inv);
  1279. NewGamePlusAdjustDLCItem('NGP Wolf School silver sword 3', 'NGP Wolf Silver Sword Mod', inv);
  1280. }
  1281.  
  1282. private final function NewGamePlusAdjustDLC14SkelligeSet(inv : CInventoryComponent)
  1283. {
  1284. NewGamePlusAdjustDLCItem('NGP DLC14 Skellige Armor', 'NGP DLC Compatibility Chest Armor Mod', inv);
  1285. NewGamePlusAdjustDLCItem('NGP DLC14 Skellige Gloves', 'NGP DLC Compatibility Armor Mod', inv);
  1286. NewGamePlusAdjustDLCItem('NGP DLC14 Skellige Pants', 'NGP DLC Compatibility Armor Mod', inv);
  1287. NewGamePlusAdjustDLCItem('NGP DLC14 Skellige Boots', 'NGP DLC Compatibility Armor Mod', inv);
  1288. }
  1289.  
  1290.  
  1291. private final function NewGamePlusAdjustDLC18NetflixSet(inv : CInventoryComponent)
  1292. {
  1293. NewGamePlusAdjustDLCItem('NGP Netflix Armor', 'NGP DLC Compatibility Chest Armor Mod', inv);
  1294. NewGamePlusAdjustDLCItem('NGP Netflix Armor 1', 'NGP DLC Compatibility Chest Armor Mod', inv);
  1295. NewGamePlusAdjustDLCItem('NGP Netflix Armor 2', 'NGP DLC Compatibility Chest Armor Mod', inv);
  1296.  
  1297. NewGamePlusAdjustDLCItem('NGP Netflix Boots 1', 'NGP DLC Compatibility Armor Mod', inv);
  1298. NewGamePlusAdjustDLCItem('NGP Netflix Boots 2', 'NGP DLC Compatibility Armor Mod', inv);
  1299. NewGamePlusAdjustDLCItem('NGP Netflix Boots', 'NGP DLC Compatibility Armor Mod', inv);
  1300.  
  1301. NewGamePlusAdjustDLCItem('NGP Netflix Gloves 1', 'NGP DLC Compatibility Armor Mod', inv);
  1302. NewGamePlusAdjustDLCItem('NGP Netflix Gloves 2', 'NGP DLC Compatibility Armor Mod', inv);
  1303. NewGamePlusAdjustDLCItem('NGP Netflix Gloves', 'NGP DLC Compatibility Armor Mod', inv);
  1304.  
  1305. NewGamePlusAdjustDLCItem('NGP Netflix Pants 1', 'NGP DLC Compatibility Armor Mod', inv);
  1306. NewGamePlusAdjustDLCItem('NGP Netflix Pants 2', 'NGP DLC Compatibility Armor Mod', inv);
  1307. NewGamePlusAdjustDLCItem('NGP Netflix Pants', 'NGP DLC Compatibility Armor Mod', inv);
  1308.  
  1309. NewGamePlusAdjustDLCItem('NGP Netflix steel sword', 'NGP Wolf Steel Sword Mod', inv);
  1310. NewGamePlusAdjustDLCItem('NGP Netflix steel sword 1', 'NGP Wolf Steel Sword Mod', inv);
  1311. NewGamePlusAdjustDLCItem('NGP Netflix steel sword 2', 'NGP Wolf Steel Sword Mod', inv);
  1312.  
  1313. NewGamePlusAdjustDLCItem('NGP Netflix silver sword', 'NGP Wolf Silver Sword Mod', inv);
  1314. NewGamePlusAdjustDLCItem('NGP Netflix silver sword 1', 'NGP Wolf Silver Sword Mod', inv);
  1315. NewGamePlusAdjustDLCItem('NGP Netflix silver sword 2', 'NGP Wolf Silver Sword Mod', inv);
  1316. }
  1317.  
  1318.  
  1319.  
  1320. private final function NewGamePlusAdjustDolBlathannaSet(inv : CInventoryComponent)
  1321. {
  1322. NewGamePlusAdjustDLCItem('NGP Dol Blathanna Armor', 'NGP DLC Compatibility Chest Armor Mod', inv);
  1323. NewGamePlusAdjustDLCItem('NGP Dol Blathanna Boots', 'NGP DLC Compatibility Armor Mod', inv);
  1324. NewGamePlusAdjustDLCItem('NGP Dol Blathanna Gloves', 'NGP DLC Compatibility Armor Mod', inv);
  1325. NewGamePlusAdjustDLCItem('NGP Dol Blathanna Pants', 'NGP DLC Compatibility Armor Mod', inv);
  1326. NewGamePlusAdjustDLCItem('NGP Dol Blathanna longsword', 'NGP Wolf Steel Sword Mod', inv);
  1327. NewGamePlusAdjustDLCItem('NGP White Widow of Dol Blathanna', 'NGP Wolf Silver Sword Mod', inv);
  1328. }
  1329.  
  1330.  
  1331.  
  1332. private final function NewGamePlusAdjustWhiteTigerSet(inv : CInventoryComponent)
  1333. {
  1334. NewGamePlusAdjustDLCItem('NGP White Tiger Armor', 'NGP DLC Compatibility Chest Armor Mod', inv);
  1335. NewGamePlusAdjustDLCItem('NGP White Tiger Boots', 'NGP DLC Compatibility Armor Mod', inv);
  1336. NewGamePlusAdjustDLCItem('NGP White Tiger Gloves', 'NGP DLC Compatibility Armor Mod', inv);
  1337. NewGamePlusAdjustDLCItem('NGP White Tiger Pants', 'NGP DLC Compatibility Armor Mod', inv);
  1338. NewGamePlusAdjustDLCItem('NGP Steel Vixen', 'NGP Wolf Steel Sword Mod', inv);
  1339. NewGamePlusAdjustDLCItem('NGP Silver Vixen', 'NGP Wolf Silver Sword Mod', inv);
  1340. }
  1341.  
  1342.  
  1343. private final function NewGamePlusReplaceViperSet(out inv : CInventoryComponent)
  1344. {
  1345. NewGamePlusReplaceItem('Viper School steel sword', 'NGP Viper School steel sword', inv);
  1346.  
  1347. NewGamePlusReplaceItem('Viper School silver sword', 'NGP Viper School silver sword', inv);
  1348. }
  1349.  
  1350. private final function NewGamePlusReplaceLynxSet(out inv : CInventoryComponent)
  1351. {
  1352. NewGamePlusReplaceItem('Lynx Armor', 'NGP Lynx Armor', inv);
  1353. NewGamePlusReplaceItem('Lynx Armor 1', 'NGP Lynx Armor 1', inv);
  1354. NewGamePlusReplaceItem('Lynx Armor 2', 'NGP Lynx Armor 2', inv);
  1355. NewGamePlusReplaceItem('Lynx Armor 3', 'NGP Lynx Armor 3', inv);
  1356.  
  1357. NewGamePlusReplaceItem('Lynx Gloves 1', 'NGP Lynx Gloves 1', inv);
  1358. NewGamePlusReplaceItem('Lynx Gloves 2', 'NGP Lynx Gloves 2', inv);
  1359. NewGamePlusReplaceItem('Lynx Gloves 3', 'NGP Lynx Gloves 3', inv);
  1360. NewGamePlusReplaceItem('Lynx Gloves 4', 'NGP Lynx Gloves 4', inv);
  1361.  
  1362. NewGamePlusReplaceItem('Lynx Pants 1', 'NGP Lynx Pants 1', inv);
  1363. NewGamePlusReplaceItem('Lynx Pants 2', 'NGP Lynx Pants 2', inv);
  1364. NewGamePlusReplaceItem('Lynx Pants 3', 'NGP Lynx Pants 3', inv);
  1365. NewGamePlusReplaceItem('Lynx Pants 4', 'NGP Lynx Pants 4', inv);
  1366.  
  1367. NewGamePlusReplaceItem('Lynx Boots 1', 'NGP Lynx Boots 1', inv);
  1368. NewGamePlusReplaceItem('Lynx Boots 2', 'NGP Lynx Boots 2', inv);
  1369. NewGamePlusReplaceItem('Lynx Boots 3', 'NGP Lynx Boots 3', inv);
  1370. NewGamePlusReplaceItem('Lynx Boots 4', 'NGP Lynx Boots 4', inv);
  1371.  
  1372. NewGamePlusReplaceItem('Lynx School steel sword', 'NGP Lynx School steel sword', inv);
  1373. NewGamePlusReplaceItem('Lynx School steel sword 1', 'NGP Lynx School steel sword 1', inv);
  1374. NewGamePlusReplaceItem('Lynx School steel sword 2', 'NGP Lynx School steel sword 2', inv);
  1375. NewGamePlusReplaceItem('Lynx School steel sword 3', 'NGP Lynx School steel sword 3', inv);
  1376.  
  1377. NewGamePlusReplaceItem('Lynx School silver sword', 'NGP Lynx School silver sword', inv);
  1378. NewGamePlusReplaceItem('Lynx School silver sword 1', 'NGP Lynx School silver sword 1', inv);
  1379. NewGamePlusReplaceItem('Lynx School silver sword 2', 'NGP Lynx School silver sword 2', inv);
  1380. NewGamePlusReplaceItem('Lynx School silver sword 3', 'NGP Lynx School silver sword 3', inv);
  1381. }
  1382.  
  1383. private final function NewGamePlusReplaceGryphonSet(out inv : CInventoryComponent)
  1384. {
  1385. NewGamePlusReplaceItem('Gryphon Armor', 'NGP Gryphon Armor', inv);
  1386. NewGamePlusReplaceItem('Gryphon Armor 1', 'NGP Gryphon Armor 1', inv);
  1387. NewGamePlusReplaceItem('Gryphon Armor 2', 'NGP Gryphon Armor 2', inv);
  1388. NewGamePlusReplaceItem('Gryphon Armor 3', 'NGP Gryphon Armor 3', inv);
  1389.  
  1390. NewGamePlusReplaceItem('Gryphon Gloves 1', 'NGP Gryphon Gloves 1', inv);
  1391. NewGamePlusReplaceItem('Gryphon Gloves 2', 'NGP Gryphon Gloves 2', inv);
  1392. NewGamePlusReplaceItem('Gryphon Gloves 3', 'NGP Gryphon Gloves 3', inv);
  1393. NewGamePlusReplaceItem('Gryphon Gloves 4', 'NGP Gryphon Gloves 4', inv);
  1394.  
  1395. NewGamePlusReplaceItem('Gryphon Pants 1', 'NGP Gryphon Pants 1', inv);
  1396. NewGamePlusReplaceItem('Gryphon Pants 2', 'NGP Gryphon Pants 2', inv);
  1397. NewGamePlusReplaceItem('Gryphon Pants 3', 'NGP Gryphon Pants 3', inv);
  1398. NewGamePlusReplaceItem('Gryphon Pants 4', 'NGP Gryphon Pants 4', inv);
  1399.  
  1400. NewGamePlusReplaceItem('Gryphon Boots 1', 'NGP Gryphon Boots 1', inv);
  1401. NewGamePlusReplaceItem('Gryphon Boots 2', 'NGP Gryphon Boots 2', inv);
  1402. NewGamePlusReplaceItem('Gryphon Boots 3', 'NGP Gryphon Boots 3', inv);
  1403. NewGamePlusReplaceItem('Gryphon Boots 4', 'NGP Gryphon Boots 4', inv);
  1404.  
  1405. NewGamePlusReplaceItem('Gryphon School steel sword', 'NGP Gryphon School steel sword', inv);
  1406. NewGamePlusReplaceItem('Gryphon School steel sword 1', 'NGP Gryphon School steel sword 1', inv);
  1407. NewGamePlusReplaceItem('Gryphon School steel sword 2', 'NGP Gryphon School steel sword 2', inv);
  1408. NewGamePlusReplaceItem('Gryphon School steel sword 3', 'NGP Gryphon School steel sword 3', inv);
  1409.  
  1410. NewGamePlusReplaceItem('Gryphon School silver sword', 'NGP Gryphon School silver sword', inv);
  1411. NewGamePlusReplaceItem('Gryphon School silver sword 1', 'NGP Gryphon School silver sword 1', inv);
  1412. NewGamePlusReplaceItem('Gryphon School silver sword 2', 'NGP Gryphon School silver sword 2', inv);
  1413. NewGamePlusReplaceItem('Gryphon School silver sword 3', 'NGP Gryphon School silver sword 3', inv);
  1414. }
  1415.  
  1416. private final function NewGamePlusReplaceBearSet(out inv : CInventoryComponent)
  1417. {
  1418. NewGamePlusReplaceItem('Bear Armor', 'NGP Bear Armor', inv);
  1419. NewGamePlusReplaceItem('Bear Armor 1', 'NGP Bear Armor 1', inv);
  1420. NewGamePlusReplaceItem('Bear Armor 2', 'NGP Bear Armor 2', inv);
  1421. NewGamePlusReplaceItem('Bear Armor 3', 'NGP Bear Armor 3', inv);
  1422.  
  1423. NewGamePlusReplaceItem('Bear Gloves 1', 'NGP Bear Gloves 1', inv);
  1424. NewGamePlusReplaceItem('Bear Gloves 2', 'NGP Bear Gloves 2', inv);
  1425. NewGamePlusReplaceItem('Bear Gloves 3', 'NGP Bear Gloves 3', inv);
  1426. NewGamePlusReplaceItem('Bear Gloves 4', 'NGP Bear Gloves 4', inv);
  1427.  
  1428. NewGamePlusReplaceItem('Bear Pants 1', 'NGP Bear Pants 1', inv);
  1429. NewGamePlusReplaceItem('Bear Pants 2', 'NGP Bear Pants 2', inv);
  1430. NewGamePlusReplaceItem('Bear Pants 3', 'NGP Bear Pants 3', inv);
  1431. NewGamePlusReplaceItem('Bear Pants 4', 'NGP Bear Pants 4', inv);
  1432.  
  1433. NewGamePlusReplaceItem('Bear Boots 1', 'NGP Bear Boots 1', inv);
  1434. NewGamePlusReplaceItem('Bear Boots 2', 'NGP Bear Boots 2', inv);
  1435. NewGamePlusReplaceItem('Bear Boots 3', 'NGP Bear Boots 3', inv);
  1436. NewGamePlusReplaceItem('Bear Boots 4', 'NGP Bear Boots 4', inv);
  1437.  
  1438. NewGamePlusReplaceItem('Bear School steel sword', 'NGP Bear School steel sword', inv);
  1439. NewGamePlusReplaceItem('Bear School steel sword 1', 'NGP Bear School steel sword 1', inv);
  1440. NewGamePlusReplaceItem('Bear School steel sword 2', 'NGP Bear School steel sword 2', inv);
  1441. NewGamePlusReplaceItem('Bear School steel sword 3', 'NGP Bear School steel sword 3', inv);
  1442.  
  1443. NewGamePlusReplaceItem('Bear School silver sword', 'NGP Bear School silver sword', inv);
  1444. NewGamePlusReplaceItem('Bear School silver sword 1', 'NGP Bear School silver sword 1', inv);
  1445. NewGamePlusReplaceItem('Bear School silver sword 2', 'NGP Bear School silver sword 2', inv);
  1446. NewGamePlusReplaceItem('Bear School silver sword 3', 'NGP Bear School silver sword 3', inv);
  1447. }
  1448.  
  1449. private final function NewGamePlusReplaceEP1(out inv : CInventoryComponent)
  1450. {
  1451. NewGamePlusReplaceItem('Ofir Armor', 'NGP Ofir Armor', inv);
  1452. NewGamePlusReplaceItem('Ofir Sabre 2', 'NGP Ofir Sabre 2', inv);
  1453.  
  1454. NewGamePlusReplaceItem('Crafted Burning Rose Armor', 'NGP Crafted Burning Rose Armor', inv);
  1455. NewGamePlusReplaceItem('Crafted Burning Rose Gloves', 'NGP Crafted Burning Rose Gloves', inv);
  1456. NewGamePlusReplaceItem('Crafted Burning Rose Sword', 'NGP Crafted Burning Rose Sword', inv);
  1457.  
  1458. NewGamePlusReplaceItem('Crafted Ofir Armor', 'NGP Crafted Ofir Armor', inv);
  1459. NewGamePlusReplaceItem('Crafted Ofir Boots', 'NGP Crafted Ofir Boots', inv);
  1460. NewGamePlusReplaceItem('Crafted Ofir Gloves', 'NGP Crafted Ofir Gloves', inv);
  1461. NewGamePlusReplaceItem('Crafted Ofir Pants', 'NGP Crafted Ofir Pants', inv);
  1462. NewGamePlusReplaceItem('Crafted Ofir Steel Sword', 'NGP Crafted Ofir Steel Sword', inv);
  1463.  
  1464. NewGamePlusReplaceItem('EP1 Crafted Witcher Silver Sword', 'NGP EP1 Crafted Witcher Silver Sword', inv);
  1465. NewGamePlusReplaceItem('Olgierd Sabre', 'NGP Olgierd Sabre', inv);
  1466.  
  1467. NewGamePlusReplaceItem('EP1 Witcher Armor', 'NGP EP1 Witcher Armor', inv);
  1468. NewGamePlusReplaceItem('EP1 Witcher Boots', 'NGP EP1 Witcher Boots', inv);
  1469. NewGamePlusReplaceItem('EP1 Witcher Gloves', 'NGP EP1 Witcher Gloves', inv);
  1470. NewGamePlusReplaceItem('EP1 Witcher Pants', 'NGP EP1 Witcher Pants', inv);
  1471. NewGamePlusReplaceItem('EP1 Viper School steel sword', 'NGP EP1 Viper School steel sword', inv);
  1472. NewGamePlusReplaceItem('EP1 Viper School silver sword', 'NGP EP1 Viper School silver sword', inv);
  1473. }
  1474.  
  1475. private final function NewGamePlusReplaceEP2WitcherSets(out inv : CInventoryComponent)
  1476. {
  1477. NewGamePlusReplaceItem('Lynx Armor 4', 'NGP Lynx Armor 4', inv);
  1478. NewGamePlusReplaceItem('Gryphon Armor 4', 'NGP Gryphon Armor 4', inv);
  1479. NewGamePlusReplaceItem('Bear Armor 4', 'NGP Bear Armor 4', inv);
  1480. NewGamePlusReplaceItem('Wolf Armor 4', 'NGP Wolf Armor 4', inv);
  1481. NewGamePlusReplaceItem('Red Wolf Armor 1', 'NGP Red Wolf Armor 1', inv);
  1482.  
  1483. NewGamePlusReplaceItem('Lynx Gloves 5', 'NGP Lynx Gloves 5', inv);
  1484. NewGamePlusReplaceItem('Gryphon Gloves 5', 'NGP Gryphon Gloves 5', inv);
  1485. NewGamePlusReplaceItem('Bear Gloves 5', 'NGP Bear Gloves 5', inv);
  1486. NewGamePlusReplaceItem('Wolf Gloves 5', 'NGP Wolf Gloves 5', inv);
  1487. NewGamePlusReplaceItem('Red Wolf Gloves 1', 'NGP Red Wolf Gloves 1', inv);
  1488.  
  1489. NewGamePlusReplaceItem('Lynx Pants 5', 'NGP Lynx Pants 5', inv);
  1490. NewGamePlusReplaceItem('Gryphon Pants 5', 'NGP Gryphon Pants 5', inv);
  1491. NewGamePlusReplaceItem('Bear Pants 5', 'NGP Bear Pants 5', inv);
  1492. NewGamePlusReplaceItem('Wolf Pants 5', 'NGP Wolf Pants 5', inv);
  1493. NewGamePlusReplaceItem('Red Wolf Pants 1', 'NGP Red Wolf Pants 1', inv);
  1494.  
  1495. NewGamePlusReplaceItem('Lynx Boots 5', 'NGP Lynx Boots 5', inv);
  1496. NewGamePlusReplaceItem('Gryphon Boots 5', 'NGP Gryphon Boots 5', inv);
  1497. NewGamePlusReplaceItem('Bear Boots 5', 'NGP Bear Boots 5', inv);
  1498. NewGamePlusReplaceItem('Wolf Boots 5', 'NGP Wolf Boots 5', inv);
  1499. NewGamePlusReplaceItem('Red Wolf Boots 1', 'NGP Red Wolf Boots 1', inv);
  1500.  
  1501.  
  1502. NewGamePlusReplaceItem('Lynx School steel sword 4', 'NGP Lynx School steel sword 4', inv);
  1503. NewGamePlusReplaceItem('Gryphon School steel sword 4', 'NGP Gryphon School steel sword 4', inv);
  1504. NewGamePlusReplaceItem('Bear School steel sword 4', 'NGP Bear School steel sword 4', inv);
  1505. NewGamePlusReplaceItem('Wolf School steel sword 4', 'NGP Wolf School steel sword 4', inv);
  1506. NewGamePlusReplaceItem('Red Wolf School steel sword 1', 'NGP Red Wolf School steel sword 1', inv);
  1507.  
  1508. NewGamePlusReplaceItem('Lynx School silver sword 4', 'NGP Lynx School silver sword 4', inv);
  1509. NewGamePlusReplaceItem('Gryphon School silver sword 4', 'NGP Gryphon School silver sword 4', inv);
  1510. NewGamePlusReplaceItem('Bear School silver sword 4', 'NGP Bear School silver sword 4', inv);
  1511. NewGamePlusReplaceItem('Wolf School silver sword 4', 'NGP Wolf School silver sword 4', inv);
  1512. NewGamePlusReplaceItem('Red Wolf School silver sword 1', 'NGP Red Wolf School silver sword 1', inv);
  1513. }
  1514.  
  1515. private final function NewGamePlusReplaceEP2Items(out inv : CInventoryComponent)
  1516. {
  1517. NewGamePlusReplaceItem('Guard Lvl1 Armor 3', 'NGP Guard Lvl1 Armor 3', inv);
  1518. NewGamePlusReplaceItem('Guard Lvl1 A Armor 3', 'NGP Guard Lvl1 A Armor 3', inv);
  1519. NewGamePlusReplaceItem('Guard Lvl2 Armor 3', 'NGP Guard Lvl2 Armor 3', inv);
  1520. NewGamePlusReplaceItem('Guard Lvl2 A Armor 3', 'NGP Guard Lvl2 A Armor 3', inv);
  1521. NewGamePlusReplaceItem('Knight Geralt Armor 3', 'NGP Knight Geralt Armor 3', inv);
  1522. NewGamePlusReplaceItem('Knight Geralt A Armor 3', 'NGP Knight Geralt A Armor 3', inv);
  1523. NewGamePlusReplaceItem('q702_vampire_armor', 'NGP q702_vampire_armor', inv);
  1524.  
  1525. NewGamePlusReplaceItem('Guard Lvl1 Gloves 3', 'NGP Guard Lvl1 Gloves 3', inv);
  1526. NewGamePlusReplaceItem('Guard Lvl1 A Gloves 3', 'NGP Guard Lvl1 A Gloves 3', inv);
  1527. NewGamePlusReplaceItem('Guard Lvl2 Gloves 3', 'NGP Guard Lvl2 Gloves 3', inv);
  1528. NewGamePlusReplaceItem('Guard Lvl2 A Gloves 3', 'NGP Guard Lvl2 A Gloves 3', inv);
  1529. NewGamePlusReplaceItem('Knight Geralt Gloves 3', 'NGP Knight Geralt Gloves 3', inv);
  1530. NewGamePlusReplaceItem('Knight Geralt A Gloves 3', 'NGP Knight Geralt A Gloves 3', inv);
  1531. NewGamePlusReplaceItem('q702_vampire_gloves', 'NGP q702_vampire_gloves', inv);
  1532.  
  1533. NewGamePlusReplaceItem('Guard Lvl1 Pants 3', 'NGP Guard Lvl1 Pants 3', inv);
  1534. NewGamePlusReplaceItem('Guard Lvl1 A Pants 3', 'NGP Guard Lvl1 A Pants 3', inv);
  1535. NewGamePlusReplaceItem('Guard Lvl2 Pants 3', 'NGP Guard Lvl2 Pants 3', inv);
  1536. NewGamePlusReplaceItem('Guard Lvl2 A Pants 3', 'NGP Guard Lvl2 A Pants 3', inv);
  1537. NewGamePlusReplaceItem('Knight Geralt Pants 3', 'NGP Knight Geralt Pants 3', inv);
  1538. NewGamePlusReplaceItem('Knight Geralt A Pants 3', 'NGP Knight Geralt A Pants 3', inv);
  1539. NewGamePlusReplaceItem('q702_vampire_pants', 'NGP q702_vampire_pants', inv);
  1540.  
  1541. NewGamePlusReplaceItem('Guard Lvl1 Boots 3', 'NGP Guard Lvl1 Boots 3', inv);
  1542. NewGamePlusReplaceItem('Guard Lvl1 A Boots 3', 'NGP Guard Lvl1 A Boots 3', inv);
  1543. NewGamePlusReplaceItem('Guard Lvl2 Boots 3', 'NGP Guard Lvl2 Boots 3', inv);
  1544. NewGamePlusReplaceItem('Guard Lvl2 A Boots 3', 'NGP Guard Lvl2 A Boots 3', inv);
  1545. NewGamePlusReplaceItem('Knight Geralt Boots 3', 'NGP Knight Geralt Boots 3', inv);
  1546. NewGamePlusReplaceItem('Knight Geralt A Boots 3', 'NGP Knight Geralt A Boots 3', inv);
  1547. NewGamePlusReplaceItem('q702_vampire_boots', 'NGP q702_vampire_boots', inv);
  1548.  
  1549. NewGamePlusReplaceItem('Serpent Steel Sword 1', 'NGP Serpent Steel Sword 1', inv);
  1550. NewGamePlusReplaceItem('Serpent Steel Sword 2', 'NGP Serpent Steel Sword 2', inv);
  1551. NewGamePlusReplaceItem('Serpent Steel Sword 3', 'NGP Serpent Steel Sword 3', inv);
  1552. NewGamePlusReplaceItem('Guard lvl1 steel sword 3', 'NGP Guard lvl1 steel sword 3', inv);
  1553. NewGamePlusReplaceItem('Guard lvl2 steel sword 3', 'NGP Guard lvl2 steel sword 3', inv);
  1554. NewGamePlusReplaceItem('Knights steel sword 3', 'NGP Knights steel sword 3', inv);
  1555. NewGamePlusReplaceItem('Hanza steel sword 3', 'NGP Hanza steel sword 3', inv);
  1556. NewGamePlusReplaceItem('Toussaint steel sword 3', 'NGP Toussaint steel sword 3', inv);
  1557. NewGamePlusReplaceItem('q702 vampire steel sword', 'NGP q702 vampire steel sword', inv);
  1558.  
  1559. NewGamePlusReplaceItem('Serpent Silver Sword 1', 'NGP Serpent Silver Sword 1', inv);
  1560. NewGamePlusReplaceItem('Serpent Silver Sword 2', 'NGP Serpent Silver Sword 2', inv);
  1561. NewGamePlusReplaceItem('Serpent Silver Sword 3', 'NGP Serpent Silver Sword 3', inv);
  1562. }
  1563.  
  1564.  
  1565.  
  1566. private final function NewGamePlusReplaceNetflixSet(out inv : CInventoryComponent)
  1567. {
  1568. NewGamePlusReplaceItem('Netflix Armor', 'NGP Netflix Armor', inv);
  1569. NewGamePlusReplaceItem('Netflix Armor 1', 'NGP Netflix Armor 1', inv);
  1570. NewGamePlusReplaceItem('Netflix Armor 2', 'NGP Netflix Armor 2', inv);
  1571.  
  1572. NewGamePlusReplaceItem('Netflix Gloves 1', 'NGP Netflix Gloves 1', inv);
  1573. NewGamePlusReplaceItem('Netflix Gloves 2', 'NGP Netflix Gloves 2', inv);
  1574. NewGamePlusReplaceItem('Netflix Gloves', 'NGP Netflix Gloves', inv);
  1575.  
  1576. NewGamePlusReplaceItem('Netflix Pants 1', 'NGP Netflix Pants 1', inv);
  1577. NewGamePlusReplaceItem('Netflix Pants 2', 'NGP Netflix Pants 2', inv);
  1578. NewGamePlusReplaceItem('Netflix Pants', 'NGP Netflix Pants', inv);
  1579.  
  1580. NewGamePlusReplaceItem('Netflix Boots 1', 'NGP Netflix Boots 1', inv);
  1581. NewGamePlusReplaceItem('Netflix Boots 2', 'NGP Netflix Boots 2', inv);
  1582. NewGamePlusReplaceItem('Netflix Boots', 'NGP Netflix Boots', inv);
  1583.  
  1584. NewGamePlusReplaceItem('Netflix steel sword', 'NGP Netflix steel sword', inv);
  1585. NewGamePlusReplaceItem('Netflix steel sword 1', 'NGP Netflix steel sword 1', inv);
  1586. NewGamePlusReplaceItem('Netflix steel sword 2', 'NGP Netflix steel sword 2', inv);
  1587.  
  1588. NewGamePlusReplaceItem('Netflix silver sword', 'NGP Netflix silver sword', inv);
  1589. NewGamePlusReplaceItem('Netflix silver sword 1', 'NGP Netflix silver sword 1', inv);
  1590. NewGamePlusReplaceItem('Netflix silver sword 2', 'NGP Netflix silver sword 2', inv);
  1591. }
  1592.  
  1593.  
  1594.  
  1595. private final function NewGamePlusReplaceDolBlathannaSet(out inv : CInventoryComponent)
  1596. {
  1597. NewGamePlusReplaceItem('Dol Blathanna Armor', 'NGP Dol Blathanna Armor', inv);
  1598. NewGamePlusReplaceItem('Dol Blathanna Gloves', 'NGP Dol Blathanna Gloves', inv);
  1599. NewGamePlusReplaceItem('Dol Blathanna Pants', 'NGP Dol Blathanna Pants', inv);
  1600. NewGamePlusReplaceItem('Dol Blathanna Boots', 'NGP Dol Blathanna Boots', inv);
  1601. NewGamePlusReplaceItem('Dol Blathanna longsword', 'NGP Dol Blathanna longsword', inv);
  1602. NewGamePlusReplaceItem('White Widow of Dol Blathanna', 'NGP White Widow of Dol Blathanna', inv);
  1603. }
  1604.  
  1605.  
  1606.  
  1607. private final function NewGamePlusReplaceWhiteTigerSet(out inv : CInventoryComponent)
  1608. {
  1609. NewGamePlusReplaceItem('White Tiger Armor', 'NGP White Tiger Armor', inv);
  1610. NewGamePlusReplaceItem('White Tiger Gloves', 'NGP White Tiger Gloves', inv);
  1611. NewGamePlusReplaceItem('White Tiger Pants', 'NGP White Tiger Pants', inv);
  1612. NewGamePlusReplaceItem('White Tiger Boots', 'NGP White Tiger Boots', inv);
  1613. NewGamePlusReplaceItem('Steel Vixen', 'NGP Steel Vixen', inv);
  1614. NewGamePlusReplaceItem('Silver Vixen', 'NGP Silver Vixen', inv);
  1615. }
  1616.  
  1617.  
  1618. public function GetEquippedSword(steel : bool) : SItemUniqueId
  1619. {
  1620. var item : SItemUniqueId;
  1621.  
  1622. if(steel)
  1623. GetItemEquippedOnSlot(EES_SteelSword, item);
  1624. else
  1625. GetItemEquippedOnSlot(EES_SilverSword, item);
  1626.  
  1627. return item;
  1628. }
  1629.  
  1630. timer function BroadcastRain( deltaTime : float, id : int )
  1631. {
  1632. var rainStrength : float = 0;
  1633. rainStrength = GetRainStrength();
  1634. if( rainStrength > 0.5 )
  1635. {
  1636. theGame.GetBehTreeReactionManager().CreateReactionEventIfPossible( thePlayer, 'RainAction', 2.0f , 50.0f, -1.f, -1, true);
  1637. LogReactionSystem( "'RainAction' was sent by Player - single broadcast - distance: 50.0" );
  1638. }
  1639. }
  1640.  
  1641. function InitializeParryType()
  1642. {
  1643. var i, j : int;
  1644.  
  1645. parryTypeTable.Resize( EnumGetMax('EAttackSwingType')+1 );
  1646. for( i = 0; i < EnumGetMax('EAttackSwingType')+1; i += 1 )
  1647. {
  1648. parryTypeTable[i].Resize( EnumGetMax('EAttackSwingDirection')+1 );
  1649. }
  1650. parryTypeTable[AST_Horizontal][ASD_UpDown] = PT_None;
  1651. parryTypeTable[AST_Horizontal][ASD_DownUp] = PT_None;
  1652. parryTypeTable[AST_Horizontal][ASD_LeftRight] = PT_Left;
  1653. parryTypeTable[AST_Horizontal][ASD_RightLeft] = PT_Right;
  1654. parryTypeTable[AST_Vertical][ASD_UpDown] = PT_Up;
  1655. parryTypeTable[AST_Vertical][ASD_DownUp] = PT_Down;
  1656. parryTypeTable[AST_Vertical][ASD_LeftRight] = PT_None;
  1657. parryTypeTable[AST_Vertical][ASD_RightLeft] = PT_None;
  1658. parryTypeTable[AST_DiagonalUp][ASD_UpDown] = PT_None;
  1659. parryTypeTable[AST_DiagonalUp][ASD_DownUp] = PT_None;
  1660. parryTypeTable[AST_DiagonalUp][ASD_LeftRight] = PT_UpLeft;
  1661. parryTypeTable[AST_DiagonalUp][ASD_RightLeft] = PT_RightUp;
  1662. parryTypeTable[AST_DiagonalDown][ASD_UpDown] = PT_None;
  1663. parryTypeTable[AST_DiagonalDown][ASD_DownUp] = PT_None;
  1664. parryTypeTable[AST_DiagonalDown][ASD_LeftRight] = PT_LeftDown;
  1665. parryTypeTable[AST_DiagonalDown][ASD_RightLeft] = PT_DownRight;
  1666. parryTypeTable[AST_Jab][ASD_UpDown] = PT_Jab;
  1667. parryTypeTable[AST_Jab][ASD_DownUp] = PT_Jab;
  1668. parryTypeTable[AST_Jab][ASD_LeftRight] = PT_Jab;
  1669. parryTypeTable[AST_Jab][ASD_RightLeft] = PT_Jab;
  1670. }
  1671.  
  1672.  
  1673.  
  1674.  
  1675.  
  1676.  
  1677. event OnDeath( damageAction : W3DamageAction )
  1678. {
  1679. var items : array< SItemUniqueId >;
  1680. var i, size : int;
  1681. var slot : EEquipmentSlots;
  1682. var holdSlot : name;
  1683.  
  1684. super.OnDeath( damageAction );
  1685.  
  1686. items = GetHeldItems();
  1687.  
  1688. if( rangedWeapon && rangedWeapon.GetCurrentStateName() != 'State_WeaponWait')
  1689. {
  1690. OnRangedForceHolster( true, true, true );
  1691. rangedWeapon.ClearDeployedEntity(true);
  1692. }
  1693.  
  1694. size = items.Size();
  1695.  
  1696. if ( size > 0 )
  1697. {
  1698. for ( i = 0; i < size; i += 1 )
  1699. {
  1700. if ( this.inv.IsIdValid( items[i] ) && !( this.inv.IsItemCrossbow( items[i] ) ) )
  1701. {
  1702. holdSlot = this.inv.GetItemHoldSlot( items[i] );
  1703.  
  1704. if ( holdSlot == 'l_weapon' && this.IsHoldingItemInLHand() )
  1705. {
  1706. this.OnUseSelectedItem( true );
  1707. }
  1708.  
  1709. DropItemFromSlot( holdSlot, false );
  1710.  
  1711. if ( holdSlot == 'r_weapon' )
  1712. {
  1713. slot = this.GetItemSlot( items[i] );
  1714. if ( UnequipItemFromSlot( slot ) )
  1715. Log( "Unequip" );
  1716. }
  1717. }
  1718. }
  1719. }
  1720. }
  1721.  
  1722.  
  1723.  
  1724.  
  1725.  
  1726.  
  1727.  
  1728. function HandleMovement( deltaTime : float )
  1729. {
  1730. super.HandleMovement( deltaTime );
  1731.  
  1732. rawCameraHeading = theCamera.GetCameraHeading();
  1733. }
  1734.  
  1735.  
  1736.  
  1737.  
  1738.  
  1739.  
  1740.  
  1741. function ToggleSpecialAttackHeavyAllowed( toggle : bool)
  1742. {
  1743. specialAttackHeavyAllowed = toggle;
  1744. }
  1745.  
  1746. function GetReputationManager() : W3Reputation
  1747. {
  1748. return reputationManager;
  1749. }
  1750.  
  1751. function OnRadialMenuItemChoose( selectedItem : string )
  1752. {
  1753. var iSlotId : int;
  1754. var item : SItemUniqueId;
  1755.  
  1756. if ( selectedItem != "Crossbow" )
  1757. {
  1758. if ( rangedWeapon && rangedWeapon.GetCurrentStateName() != 'State_WeaponWait' )
  1759. OnRangedForceHolster( true, false );
  1760. }
  1761.  
  1762.  
  1763. switch(selectedItem)
  1764. {
  1765.  
  1766. case "Meditation":
  1767. theGame.RequestMenuWithBackground( 'MeditationClockMenu', 'CommonMenu' );
  1768. break;
  1769. case "Slot1":
  1770. GetItemEquippedOnSlot( EES_Petard1, item );
  1771. if( thePlayer.inv.IsIdValid( item ) )
  1772. {
  1773. SelectQuickslotItem( EES_Petard1 );
  1774. }
  1775. else
  1776. {
  1777. SelectQuickslotItem( EES_Petard2 );
  1778. }
  1779. break;
  1780.  
  1781. case "Slot2":
  1782. GetItemEquippedOnSlot( EES_Petard2, item );
  1783. if( thePlayer.inv.IsIdValid( item ) )
  1784. {
  1785. SelectQuickslotItem( EES_Petard2 );
  1786. }
  1787. else
  1788. {
  1789. SelectQuickslotItem( EES_Petard1 );
  1790. }
  1791. break;
  1792.  
  1793. case "Crossbow":
  1794. SelectQuickslotItem(EES_RangedWeapon);
  1795. break;
  1796.  
  1797. case "Slot3":
  1798. GetItemEquippedOnSlot( EES_Quickslot1, item );
  1799. if( thePlayer.inv.IsIdValid( item ) )
  1800. {
  1801. SelectQuickslotItem( EES_Quickslot1 );
  1802. }
  1803. else
  1804. {
  1805. SelectQuickslotItem( EES_Quickslot2 );
  1806. }
  1807. break;
  1808.  
  1809. case "Slot4":
  1810. GetItemEquippedOnSlot( EES_Quickslot2, item );
  1811. if( thePlayer.inv.IsIdValid( item ) )
  1812. {
  1813. SelectQuickslotItem( EES_Quickslot2 );
  1814. }
  1815. else
  1816. {
  1817. SelectQuickslotItem( EES_Quickslot1 );
  1818. }
  1819. break;
  1820.  
  1821. default:
  1822. SetEquippedSign(SignStringToEnum( selectedItem ));
  1823. FactsRemove("SignToggled");
  1824. break;
  1825. }
  1826. }
  1827.  
  1828. function ToggleNextItem()
  1829. {
  1830. var quickSlotItems : array< EEquipmentSlots >;
  1831. var currentSelectedItem : SItemUniqueId;
  1832. var item : SItemUniqueId;
  1833. var i : int;
  1834.  
  1835. for( i = EES_Quickslot2; i > EES_Petard1 - 1; i -= 1 )
  1836. {
  1837. GetItemEquippedOnSlot( i, item );
  1838. if( inv.IsIdValid( item ) )
  1839. {
  1840. quickSlotItems.PushBack( i );
  1841. }
  1842. }
  1843. if( !quickSlotItems.Size() )
  1844. {
  1845. return;
  1846. }
  1847.  
  1848. currentSelectedItem = GetSelectedItemId();
  1849.  
  1850. if( inv.IsIdValid( currentSelectedItem ) )
  1851. {
  1852. for( i = 0; i < quickSlotItems.Size(); i += 1 )
  1853. {
  1854. GetItemEquippedOnSlot( quickSlotItems[i], item );
  1855. if( currentSelectedItem == item )
  1856. {
  1857. if( i == quickSlotItems.Size() - 1 )
  1858. {
  1859. SelectQuickslotItem( quickSlotItems[ 0 ] );
  1860. }
  1861. else
  1862. {
  1863. SelectQuickslotItem( quickSlotItems[ i + 1 ] );
  1864. }
  1865. return;
  1866. }
  1867. }
  1868. }
  1869. else
  1870. {
  1871. SelectQuickslotItem( quickSlotItems[ 0 ] );
  1872. }
  1873. }
  1874.  
  1875. public function OnShieldHit()
  1876. {
  1877. m_quenHitFxTTL = 0.2;
  1878. ApplyGamepadTriggerEffect( equippedSign );
  1879. }
  1880.  
  1881. timer function UpdateGamepadTriggerEffect( dt : float, id : int )
  1882. {
  1883. if( m_TriggerEffectDisablePending )
  1884. {
  1885. m_TriggerEffectDisableTTW -= dt;
  1886.  
  1887. if( m_TriggerEffectDisableTTW < 0 )
  1888. {
  1889. m_TriggerEffectDisabled = true;
  1890. m_TriggerEffectDisablePending = false;
  1891. }
  1892. }
  1893.  
  1894. if( m_TriggerEffectDisabled && !theInput.IsActionPressed('CastSign') )
  1895. m_TriggerEffectDisabled = false;
  1896.  
  1897. m_quenHitFxTTL -= dt;
  1898. ApplyGamepadTriggerEffect( equippedSign );
  1899. }
  1900.  
  1901. public function ApplyCastSettings()
  1902. {
  1903. ApplyGamepadTriggerEffect( equippedSign );
  1904. }
  1905.  
  1906. private function ApplyGamepadTriggerEffect( type : ESignType )
  1907. {
  1908. var mode : int;
  1909. var param : array<Vector>;
  1910. var cur_sign : W3SignEntity;
  1911. var sign_skill : ESkill;
  1912.  
  1913. sign_skill = SignEnumToSkillEnum( type );
  1914.  
  1915. if( !thePlayer.CanUseSkill(sign_skill) || !HasStaminaToUseSkill(sign_skill,false) )
  1916. {
  1917. theGame.SetTriggerEffect( 1, GTFX_Off, param );
  1918. theGame.SetTriggerEffect( 0, GTFX_Off, param );
  1919. if(theInput.IsActionPressed('CastSign'))
  1920. {
  1921. lastPressedWithNostamina = true;
  1922. }
  1923. return;
  1924. }
  1925. if(lastPressedWithNostamina && !theInput.IsActionPressed('CastSign'))
  1926. {
  1927. lastPressedWithNostamina = false;
  1928. }
  1929.  
  1930. if(lastPressedWithNostamina)
  1931. {
  1932. return;
  1933. }
  1934.  
  1935. if( type == ST_Igni && IsCurrentSignChanneled() )
  1936. {
  1937. mode = GTFX_MultiVibration;
  1938.  
  1939. param.Resize( 10 );
  1940. param[0].Y = 0.3;
  1941. param[0].X = 0.0;
  1942. param[1].X = 0.0;
  1943. param[2].X = 0.0;
  1944. param[3].X = 0.0;
  1945. param[4].X = 0.0;
  1946. param[5].X = 0.0;
  1947. param[6].X = 0.8;
  1948. param[7].X = 0.8;
  1949. param[8].X = 0.8;
  1950. param[9].X = 0.9;
  1951.  
  1952. theGame.SetTriggerEffect( 1, mode, param );
  1953. return;
  1954. }
  1955.  
  1956. if( type == ST_Quen && m_quenHitFxTTL > 0 && HasBuff( EET_BasicQuen ) )
  1957. {
  1958. mode = GTFX_MultiVibration;
  1959.  
  1960. param.Resize( 10 );
  1961. param[0].Y = 0.5;
  1962. param[0].X = 0.0;
  1963. param[1].X = 0.0;
  1964. param[2].X = 0.0;
  1965. param[3].X = 0.0;
  1966. param[4].X = 0.0;
  1967. param[5].X = 0.0;
  1968. param[6].X = 0.8;
  1969. param[7].X = 0.8;
  1970. param[8].X = 0.99;
  1971. param[9].X = 0.99;
  1972.  
  1973. theGame.SetTriggerEffect( 1, mode, param );
  1974. return;
  1975. }
  1976.  
  1977.  
  1978. if( m_TriggerEffectDisabled )
  1979. {
  1980. theGame.SetTriggerEffect( 1, GTFX_Off, param );
  1981. theGame.SetTriggerEffect( 0, GTFX_Off, param );
  1982. return;
  1983. }
  1984.  
  1985. if(
  1986. theGame.IsPaused()
  1987. || theGame.GetPhotomodeEnabled()
  1988. || theGame.IsDialogOrCutscenePlaying()
  1989. || thePlayer.IsInCutsceneIntro()
  1990. || theGame.IsCurrentlyPlayingNonGameplayScene()
  1991. )
  1992. {
  1993. theGame.SetTriggerEffect( 1, GTFX_Off, param );
  1994. theGame.SetTriggerEffect( 0, GTFX_Off, param );
  1995.  
  1996. return;
  1997. }
  1998.  
  1999. mode = GTFX_Off;
  2000.  
  2001. if( GetInputHandler().GetIsAltSignCasting() )
  2002. {
  2003. mode = GTFX_Vibration;
  2004.  
  2005. param.Resize( 1 );
  2006. param[0].X = 0.9;
  2007. param[0].Y = 0.1;
  2008. param[0].Z = 0.15;
  2009.  
  2010. theGame.SetTriggerEffect( 1, mode, param );
  2011.  
  2012. if( GetInputHandler().GetIsAltSignCastingPressed() )
  2013. {
  2014. mode = GTFX_Weapon;
  2015.  
  2016. param.Resize( 1 );
  2017. param[0].X = 0.1;
  2018. param[0].Y = 0.5;
  2019. param[0].Z = 1.0;
  2020.  
  2021. theGame.SetTriggerEffect( 0, mode, param );
  2022. }
  2023. else
  2024. {
  2025. theGame.SetTriggerEffect( 0, GTFX_Off, param );
  2026. }
  2027. }
  2028. else
  2029. {
  2030. if( type == ST_Aard )
  2031. {
  2032. mode = GTFX_MultiFeedback;
  2033.  
  2034. param.Resize( 10 );
  2035. param[0].X = 0.0;
  2036. param[1].X = 0.0;
  2037. param[2].X = 0.0;
  2038. param[3].X = 0.1;
  2039. param[4].X = 0.2;
  2040. param[5].X = 0.2;
  2041. param[6].X = 0.0;
  2042. param[7].X = 0.0;
  2043. param[8].X = 0.4;
  2044. param[9].X = 0.4;
  2045. }
  2046. else if( type == ST_Axii )
  2047. {
  2048. mode = GTFX_Vibration;
  2049.  
  2050. param.Resize( 1 );
  2051. param[0].X = 0.8;
  2052. param[0].Y = 0.15;
  2053. param[0].Z = 0.2;
  2054. }
  2055. else if( type == ST_Igni )
  2056. {
  2057. mode = GTFX_Weapon;
  2058.  
  2059. param.Resize( 1 );
  2060. param[0].X = 0.5;
  2061. param[0].Y = 0.7;
  2062. param[0].Z = 1.0;
  2063. }
  2064. else if( type == ST_Quen )
  2065. {
  2066. mode = GTFX_Vibration;
  2067.  
  2068. param.Resize( 1 );
  2069. param[0].X = 0.8;
  2070. param[0].Y = 0.25;
  2071. param[0].Z = 0.7;
  2072. }
  2073. else if( type == ST_Yrden )
  2074. {
  2075. mode = GTFX_Vibration;
  2076.  
  2077. param.Resize( 1 );
  2078. param[0].X = 0.9;
  2079. param[0].Y = 0.5;
  2080. param[0].Z = 0.99;
  2081. }
  2082.  
  2083. theGame.SetTriggerEffect( 1, mode, param );
  2084. theGame.SetTriggerEffect( 0, GTFX_Off, param );
  2085. }
  2086.  
  2087. }
  2088.  
  2089.  
  2090. function SetEquippedSign( signType : ESignType )
  2091. {
  2092. if(!IsSignBlocked(signType))
  2093. {
  2094. equippedSign = signType;
  2095. FactsSet("CurrentlySelectedSign", equippedSign);
  2096. ApplyGamepadTriggerEffect( signType );
  2097. }
  2098. }
  2099.  
  2100. function GetEquippedSign() : ESignType
  2101. {
  2102. return equippedSign;
  2103. }
  2104.  
  2105. function GetCurrentlyCastSign() : ESignType
  2106. {
  2107. return currentlyCastSign;
  2108. }
  2109.  
  2110. function SetCurrentlyCastSign( type : ESignType, entity : W3SignEntity )
  2111. {
  2112. currentlyCastSign = type;
  2113.  
  2114. if( type != ST_None )
  2115. {
  2116. signs[currentlyCastSign].entity = entity;
  2117. }
  2118. }
  2119.  
  2120. function GetCurrentSignEntity() : W3SignEntity
  2121. {
  2122. if(currentlyCastSign == ST_None)
  2123. return NULL;
  2124.  
  2125. return signs[currentlyCastSign].entity;
  2126. }
  2127.  
  2128. public function GetSignEntity(type : ESignType) : W3SignEntity
  2129. {
  2130. if(type == ST_None)
  2131. return NULL;
  2132.  
  2133. return signs[type].entity;
  2134. }
  2135.  
  2136. public function GetSignTemplate(type : ESignType) : CEntityTemplate
  2137. {
  2138. if(type == ST_None)
  2139. return NULL;
  2140.  
  2141. return signs[type].template;
  2142. }
  2143.  
  2144. public function IsCurrentSignChanneled() : bool
  2145. {
  2146. if( currentlyCastSign != ST_None && signs[currentlyCastSign].entity)
  2147. return signs[currentlyCastSign].entity.OnCheckChanneling();
  2148.  
  2149. return false;
  2150. }
  2151.  
  2152. function IsCastingSign() : bool
  2153. {
  2154. return currentlyCastSign != ST_None;
  2155. }
  2156.  
  2157.  
  2158. protected function IsInCombatActionCameraRotationEnabled() : bool
  2159. {
  2160. if( IsInCombatAction() && ( GetCombatAction() == EBAT_EMPTY || GetCombatAction() == EBAT_Parry ) )
  2161. {
  2162. return true;
  2163. }
  2164.  
  2165. return !bIsInCombatAction;
  2166. }
  2167.  
  2168. function SetHoldBeforeOpenRadialMenuTime ( time : float )
  2169. {
  2170. _HoldBeforeOpenRadialMenuTime = time;
  2171. }
  2172.  
  2173.  
  2174.  
  2175.  
  2176.  
  2177.  
  2178.  
  2179. public function RepairItem ( rapairKitId : SItemUniqueId, usedOnItem : SItemUniqueId )
  2180. {
  2181. var itemMaxDurablity : float;
  2182. var itemCurrDurablity : float;
  2183. var baseRepairValue : float;
  2184. var reapirValue : float;
  2185. var itemAttribute : SAbilityAttributeValue;
  2186.  
  2187. itemMaxDurablity = inv.GetItemMaxDurability(usedOnItem);
  2188. itemCurrDurablity = inv.GetItemDurability(usedOnItem);
  2189. itemAttribute = inv.GetItemAttributeValue ( rapairKitId, 'repairValue' );
  2190.  
  2191. if( itemCurrDurablity >= itemMaxDurablity )
  2192. {
  2193. return;
  2194. }
  2195.  
  2196. if ( inv.IsItemAnyArmor ( usedOnItem )|| inv.IsItemWeapon( usedOnItem ) )
  2197. {
  2198.  
  2199. baseRepairValue = itemMaxDurablity * itemAttribute.valueMultiplicative;
  2200. reapirValue = MinF( itemCurrDurablity + baseRepairValue, itemMaxDurablity );
  2201.  
  2202. inv.SetItemDurabilityScript ( usedOnItem, MinF ( reapirValue, itemMaxDurablity ));
  2203. }
  2204.  
  2205. inv.RemoveItem ( rapairKitId, 1 );
  2206.  
  2207. }
  2208. public function HasRepairAbleGearEquiped ( ) : bool
  2209. {
  2210. var curEquipedItem : SItemUniqueId;
  2211.  
  2212. return ( GetItemEquippedOnSlot(EES_Armor, curEquipedItem) || GetItemEquippedOnSlot(EES_Boots, curEquipedItem) || GetItemEquippedOnSlot(EES_Pants, curEquipedItem) || GetItemEquippedOnSlot(EES_Gloves, curEquipedItem)) == true;
  2213. }
  2214. public function HasRepairAbleWaponEquiped () : bool
  2215. {
  2216. var curEquipedItem : SItemUniqueId;
  2217.  
  2218. return ( GetItemEquippedOnSlot(EES_SilverSword, curEquipedItem) || GetItemEquippedOnSlot(EES_SteelSword, curEquipedItem) ) == true;
  2219. }
  2220. public function IsItemRepairAble ( item : SItemUniqueId ) : bool
  2221. {
  2222. return inv.GetItemDurabilityRatio(item) <= 0.99999f;
  2223. }
  2224.  
  2225.  
  2226.  
  2227.  
  2228.  
  2229.  
  2230.  
  2231.  
  2232. public function ApplyOil( oilId : SItemUniqueId, usedOnItem : SItemUniqueId ) : bool
  2233. {
  2234. var tutStateOil : W3TutorialManagerUIHandlerStateOils;
  2235.  
  2236. if( !super.ApplyOil( oilId, usedOnItem ))
  2237. return false;
  2238.  
  2239.  
  2240. if(ShouldProcessTutorial('TutorialOilCanEquip3'))
  2241. {
  2242. tutStateOil = (W3TutorialManagerUIHandlerStateOils)theGame.GetTutorialSystem().uiHandler.GetCurrentState();
  2243. if(tutStateOil)
  2244. {
  2245. tutStateOil.OnOilApplied();
  2246. }
  2247. }
  2248.  
  2249. return true;
  2250. }
  2251.  
  2252.  
  2253. public final function RemoveExtraOilsFromItem( item : SItemUniqueId )
  2254. {
  2255. var oils : array< CBaseGameplayEffect >;
  2256. var i, cnt : int;
  2257. var buff : W3Effect_Oil;
  2258.  
  2259.  
  2260. inv.RemoveAllOilsFromItem(item);
  2261. return;
  2262.  
  2263.  
  2264.  
  2265. }
  2266.  
  2267.  
  2268.  
  2269.  
  2270.  
  2271.  
  2272.  
  2273.  
  2274. function ReduceDamage(out damageData : W3DamageAction)
  2275. {
  2276. var actorAttacker : CActor;
  2277. var quen : W3QuenEntity;
  2278. var attackRange : CAIAttackRange;
  2279. var attackerMovementAdjustor : CMovementAdjustor;
  2280. var dist, distToAttacker, actionHeading, attackerHeading, currAdrenaline, adrenReducedDmg, focus : float;
  2281. var attackName : name;
  2282. var useQuenForBleeding : bool;
  2283. var min, max : SAbilityAttributeValue;
  2284. var skillLevel : int;
  2285.  
  2286. super.ReduceDamage(damageData);
  2287.  
  2288.  
  2289.  
  2290. quen = (W3QuenEntity)signs[ST_Quen].entity;
  2291. useQuenForBleeding = false;
  2292. if(quen && !damageData.DealsAnyDamage() && ((W3Effect_Bleeding)damageData.causer) && damageData.GetDamageValue(theGame.params.DAMAGE_NAME_DIRECT) > 0.f)
  2293. useQuenForBleeding = true;
  2294.  
  2295.  
  2296. if(!useQuenForBleeding && !damageData.DealsAnyDamage())
  2297. return;
  2298.  
  2299. actorAttacker = (CActor)damageData.attacker;
  2300.  
  2301.  
  2302. if(actorAttacker && IsCurrentlyDodging() && damageData.CanBeDodged())
  2303. {
  2304.  
  2305.  
  2306. actionHeading = evadeHeading;
  2307. attackerHeading = actorAttacker.GetHeading();
  2308. dist = AngleDistance(actionHeading, attackerHeading);
  2309. distToAttacker = VecDistance(this.GetWorldPosition(),damageData.attacker.GetWorldPosition());
  2310. attackName = actorAttacker.GetLastAttackRangeName();
  2311. attackRange = theGame.GetAttackRangeForEntity( actorAttacker, attackName );
  2312. attackerMovementAdjustor = actorAttacker.GetMovingAgentComponent().GetMovementAdjustor();
  2313. if( ( AbsF(dist) < 150 && attackName != 'stomp' && attackName != 'anchor_special_far' && attackName != 'anchor_far' )
  2314. || ( ( attackName == 'stomp' || attackName == 'anchor_special_far' || attackName == 'anchor_far' ) && distToAttacker > attackRange.rangeMax * 0.75 ) )
  2315. {
  2316. if ( theGame.CanLog() )
  2317. {
  2318. LogDMHits("W3PlayerWitcher.ReduceDamage: Attack dodged by player - no damage done", damageData);
  2319. }
  2320. damageData.SetAllProcessedDamageAs(0);
  2321. damageData.SetWasDodged();
  2322. }
  2323.  
  2324. else if( !damageData.IsActionEnvironment() && !damageData.IsDoTDamage() && CanUseSkill( S_Sword_s09 ) )
  2325. {
  2326. skillLevel = GetSkillLevel( S_Sword_s09 );
  2327. if( skillLevel == GetSkillMaxLevel( S_Sword_s09 ) )
  2328. {
  2329. damageData.SetAllProcessedDamageAs(0);
  2330. damageData.SetWasDodged();
  2331. }
  2332. else
  2333. {
  2334. damageData.processedDmg.vitalityDamage *= 1 - CalculateAttributeValue(GetSkillAttributeValue(S_Sword_s09, 'damage_reduction', false, true)) * skillLevel;
  2335. }
  2336.  
  2337. if ( theGame.CanLog() )
  2338. {
  2339. LogDMHits("W3PlayerWitcher.ReduceDamage: skill S_Sword_s09 reduced damage while dodging", damageData );
  2340. }
  2341. }
  2342. }
  2343.  
  2344.  
  2345. if(quen && damageData.GetBuffSourceName() != "FallingDamage")
  2346. {
  2347. if ( theGame.CanLog() )
  2348. {
  2349. LogDMHits("W3PlayerWitcher.ReduceDamage: Processing Quen sign damage reduction...", damageData);
  2350. }
  2351. quen.OnTargetHit( damageData );
  2352. }
  2353.  
  2354.  
  2355. if( HasBuff( EET_GryphonSetBonusYrden ) )
  2356. {
  2357. min = GetAttributeValue( 'gryphon_set_bns_dmg_reduction' );
  2358. damageData.processedDmg.vitalityDamage *= 1 - min.valueAdditive;
  2359. }
  2360.  
  2361.  
  2362. if( IsMutationActive( EPMT_Mutation5 ) && !IsAnyQuenActive() && !damageData.IsDoTDamage() )
  2363. {
  2364. focus = GetStat( BCS_Focus );
  2365. currAdrenaline = FloorF( focus );
  2366. if( currAdrenaline >= 1 )
  2367. {
  2368. theGame.GetDefinitionsManager().GetAbilityAttributeValue( 'Mutation5', 'mut5_dmg_red_perc', min, max );
  2369. adrenReducedDmg = ( currAdrenaline * min.valueAdditive );
  2370. damageData.processedDmg.vitalityDamage *= 1 - adrenReducedDmg;
  2371.  
  2372.  
  2373. theGame.MutationHUDFeedback( MFT_PlayOnce );
  2374.  
  2375. if( focus >= 3.f )
  2376. {
  2377. PlayEffect( 'mutation_5_stage_03' );
  2378. }
  2379. else if( focus >= 2.f )
  2380. {
  2381. PlayEffect( 'mutation_5_stage_02' );
  2382. }
  2383. else
  2384. {
  2385. PlayEffect( 'mutation_5_stage_01' );
  2386. }
  2387. }
  2388. }
  2389.  
  2390.  
  2391. if(!damageData.GetIgnoreImmortalityMode())
  2392. {
  2393. if(!((W3PlayerWitcher)this))
  2394. Log("");
  2395.  
  2396.  
  2397. if( IsInvulnerable() )
  2398. {
  2399. if ( theGame.CanLog() )
  2400. {
  2401. LogDMHits("CActor.ReduceDamage: victim Invulnerable - no damage will be dealt", damageData );
  2402. }
  2403. damageData.SetAllProcessedDamageAs(0);
  2404. return;
  2405. }
  2406.  
  2407. if(actorAttacker && damageData.DealsAnyDamage() )
  2408. actorAttacker.SignalGameplayEventParamObject( 'DamageInstigated', damageData );
  2409.  
  2410.  
  2411. if( IsImmortal() )
  2412. {
  2413. if ( theGame.CanLog() )
  2414. {
  2415. LogDMHits("CActor.ReduceDamage: victim is Immortal, clamping damage", damageData );
  2416. }
  2417. damageData.processedDmg.vitalityDamage = ClampF(damageData.processedDmg.vitalityDamage, 0, GetStat(BCS_Vitality)-1 );
  2418. damageData.processedDmg.essenceDamage = ClampF(damageData.processedDmg.essenceDamage, 0, GetStat(BCS_Essence)-1 );
  2419. return;
  2420. }
  2421. }
  2422. else
  2423. {
  2424.  
  2425. if(actorAttacker && damageData.DealsAnyDamage() )
  2426. actorAttacker.SignalGameplayEventParamObject( 'DamageInstigated', damageData );
  2427. }
  2428. }
  2429.  
  2430. timer function UndyingSkillCooldown(dt : float, id : int)
  2431. {
  2432. cannotUseUndyingSkill = false;
  2433. }
  2434.  
  2435.  
  2436. public function GetCannotUseUndying() : bool
  2437. {
  2438. return cannotUseUndyingSkill;
  2439. }
  2440.  
  2441. public function SetCannotUseUndyingSkill(set : bool)
  2442. {
  2443. cannotUseUndyingSkill = set;
  2444. }
  2445.  
  2446.  
  2447. event OnTakeDamage( action : W3DamageAction)
  2448. {
  2449. var currVitality, rgnVitality, hpTriggerTreshold : float;
  2450. var healingFactor : float;
  2451. var abilityName : name;
  2452. var abilityCount, maxStack, itemDurability : float;
  2453. var addAbility : bool;
  2454. var min, max : SAbilityAttributeValue;
  2455. var mutagenQuen : W3SignEntity;
  2456. var equipped : array<SItemUniqueId>;
  2457. var i : int;
  2458. var killSourceName : string;
  2459. var aerondight : W3Effect_Aerondight;
  2460.  
  2461. currVitality = GetStat(BCS_Vitality);
  2462.  
  2463.  
  2464. if(action.processedDmg.vitalityDamage >= currVitality)
  2465. {
  2466. killSourceName = action.GetBuffSourceName();
  2467.  
  2468.  
  2469. if( killSourceName != "Quest" && killSourceName != "Kill Trigger" && killSourceName != "Trap" && killSourceName != "FallingDamage" )
  2470. {
  2471.  
  2472. if(!cannotUseUndyingSkill && FloorF(GetStat(BCS_Focus)) >= 1 && CanUseSkill(S_Sword_s18) && HasBuff(EET_BattleTrance) )
  2473. {
  2474. healingFactor = CalculateAttributeValue( GetSkillAttributeValue(S_Sword_s18, 'healing_factor', false, true) );
  2475. healingFactor *= GetStatMax(BCS_Vitality);
  2476. healingFactor *= GetStat(BCS_Focus);
  2477. healingFactor *= 1 + CalculateAttributeValue( GetSkillAttributeValue(S_Sword_s18, 'healing_bonus', false, true) ) * (GetSkillLevel(S_Sword_s18) - 1);
  2478. ForceSetStat(BCS_Vitality, GetStatMax(BCS_Vitality));
  2479. DrainFocus(GetStat(BCS_Focus));
  2480. RemoveBuff(EET_BattleTrance);
  2481. cannotUseUndyingSkill = true;
  2482. AddTimer('UndyingSkillCooldown', CalculateAttributeValue( GetSkillAttributeValue(S_Sword_s18, 'trigger_delay', false, true) ), false, , , true);
  2483. }
  2484.  
  2485. else if( IsMutationActive( EPMT_Mutation11 ) && !HasBuff( EET_Mutation11Debuff ) && !IsInAir() )
  2486. {
  2487. theGame.GetDefinitionsManager().GetAbilityAttributeValue( 'Mutation11', 'health_prc', min, max );
  2488.  
  2489. action.SetAllProcessedDamageAs( 0 );
  2490.  
  2491. OnMutation11Triggered();
  2492. }
  2493. else
  2494. {
  2495.  
  2496. equipped = GetEquippedItems();
  2497.  
  2498. for(i=0; i<equipped.Size(); i+=1)
  2499. {
  2500. if ( !inv.IsIdValid( equipped[i] ) )
  2501. {
  2502. continue;
  2503. }
  2504. itemDurability = inv.GetItemDurability(equipped[i]);
  2505. if(inv.ItemHasAbility(equipped[i], 'MA_Reinforced') && itemDurability > 0)
  2506. {
  2507.  
  2508. inv.SetItemDurabilityScript(equipped[i], MaxF(0, itemDurability - action.processedDmg.vitalityDamage) );
  2509.  
  2510.  
  2511. action.processedDmg.vitalityDamage = 0;
  2512. ForceSetStat(BCS_Vitality, 1);
  2513.  
  2514. break;
  2515. }
  2516. }
  2517. }
  2518. }
  2519. }
  2520.  
  2521.  
  2522. if(action.DealsAnyDamage() && !((W3Effect_Toxicity)action.causer) )
  2523. {
  2524. if(HasBuff(EET_Mutagen10))
  2525. RemoveAbilityAll( GetBuff(EET_Mutagen10).GetAbilityName() );
  2526.  
  2527. if(HasBuff(EET_Mutagen15))
  2528. RemoveAbilityAll( GetBuff(EET_Mutagen15).GetAbilityName() );
  2529. }
  2530.  
  2531.  
  2532. if(HasBuff(EET_Mutagen19))
  2533. {
  2534. theGame.GetDefinitionsManager().GetAbilityAttributeValue(GetBuff(EET_Mutagen19).GetAbilityName(), 'max_hp_perc_trigger', min, max);
  2535. hpTriggerTreshold = GetStatMax(BCS_Vitality) * CalculateAttributeValue(GetAttributeRandomizedValue(min, max));
  2536.  
  2537. if(action.GetDamageDealt() >= hpTriggerTreshold)
  2538. {
  2539. mutagenQuen = (W3SignEntity)theGame.CreateEntity( signs[ST_Quen].template, GetWorldPosition(), GetWorldRotation() );
  2540. mutagenQuen.Init( signOwner, signs[ST_Quen].entity, true );
  2541. mutagenQuen.OnStarted();
  2542. mutagenQuen.OnThrowing();
  2543. mutagenQuen.OnEnded();
  2544. }
  2545. }
  2546.  
  2547.  
  2548. if(action.DealsAnyDamage() && !action.IsDoTDamage() && HasBuff(EET_Mutagen27))
  2549. {
  2550. abilityName = GetBuff(EET_Mutagen27).GetAbilityName();
  2551. abilityCount = GetAbilityCount(abilityName);
  2552.  
  2553. if(abilityCount == 0)
  2554. {
  2555. addAbility = true;
  2556. }
  2557. else
  2558. {
  2559. theGame.GetDefinitionsManager().GetAbilityAttributeValue(abilityName, 'mutagen27_max_stack', min, max);
  2560. maxStack = CalculateAttributeValue(GetAttributeRandomizedValue(min, max));
  2561.  
  2562. if(maxStack >= 0)
  2563. {
  2564. addAbility = (abilityCount < maxStack);
  2565. }
  2566. else
  2567. {
  2568. addAbility = true;
  2569. }
  2570. }
  2571.  
  2572. if(addAbility)
  2573. {
  2574. AddAbility(abilityName, true);
  2575. }
  2576. }
  2577.  
  2578. if(HasBuff(EET_Trap) && !action.IsDoTDamage() && action.attacker.HasAbility( 'mon_dettlaff_monster_base' ))
  2579. {
  2580. action.AddEffectInfo(EET_Knockdown);
  2581. RemoveBuff(EET_Trap, true);
  2582. }
  2583.  
  2584. super.OnTakeDamage(action);
  2585.  
  2586.  
  2587. if( !action.WasDodged() && action.DealtDamage() && inv.ItemHasTag( inv.GetCurrentlyHeldSword(), 'Aerondight' ) && !action.IsDoTDamage() && !( (W3Effect_Toxicity) action.causer ) )
  2588. {
  2589. aerondight = (W3Effect_Aerondight)GetBuff( EET_Aerondight );
  2590. if( aerondight && aerondight.GetCurrentCount() != 0 )
  2591. {
  2592. aerondight.ReduceAerondightStacks();
  2593. }
  2594. }
  2595.  
  2596.  
  2597. if( !action.WasDodged() && action.DealtDamage() && !( (W3Effect_Toxicity) action.causer ) )
  2598. {
  2599. RemoveBuff( EET_Mutation3 );
  2600. }
  2601. }
  2602.  
  2603.  
  2604.  
  2605.  
  2606.  
  2607.  
  2608.  
  2609. event OnStartFistfightMinigame()
  2610. {
  2611. var i : int;
  2612. var buffs : array< CBaseGameplayEffect >;
  2613.  
  2614.  
  2615. effectManager.RemoveAllPotionEffects();
  2616.  
  2617. abilityManager.DrainToxicity(GetStatMax( BCS_Toxicity ));
  2618.  
  2619. buffs = GetBuffs( EET_WellFed );
  2620. for( i=buffs.Size()-1; i>=0; i-=1 )
  2621. {
  2622. RemoveEffect( buffs[i] );
  2623. }
  2624.  
  2625.  
  2626. buffs.Clear();
  2627. buffs = GetBuffs( EET_WellHydrated );
  2628. for( i=buffs.Size()-1; i>=0; i-=1 )
  2629. {
  2630. RemoveEffect( buffs[i] );
  2631. }
  2632.  
  2633. super.OnStartFistfightMinigame();
  2634. }
  2635.  
  2636. event OnEndFistfightMinigame()
  2637. {
  2638. super.OnEndFistfightMinigame();
  2639. }
  2640.  
  2641.  
  2642. public function GetCriticalHitChance( isLightAttack : bool, isHeavyAttack : bool, target : CActor, victimMonsterCategory : EMonsterCategory, isBolt : bool ) : float
  2643. {
  2644. var ret : float;
  2645. var thunder : W3Potion_Thunderbolt;
  2646. var min, max : SAbilityAttributeValue;
  2647.  
  2648. ret = super.GetCriticalHitChance( isLightAttack, isHeavyAttack, target, victimMonsterCategory, isBolt );
  2649.  
  2650.  
  2651.  
  2652.  
  2653.  
  2654.  
  2655.  
  2656. thunder = ( W3Potion_Thunderbolt )GetBuff( EET_Thunderbolt );
  2657. if( thunder && thunder.GetBuffLevel() == 3 && GetCurWeather() == EWE_Storm )
  2658. {
  2659. ret += 1.0f;
  2660. }
  2661.  
  2662.  
  2663. if( isBolt && IsMutationActive( EPMT_Mutation9 ) )
  2664. {
  2665. theGame.GetDefinitionsManager().GetAbilityAttributeValue('Mutation9', 'critical_hit_chance', min, max);
  2666. ret += min.valueMultiplicative;
  2667. }
  2668.  
  2669.  
  2670. if( isBolt && CanUseSkill( S_Sword_s07 ) )
  2671. {
  2672. ret += CalculateAttributeValue(GetSkillAttributeValue(S_Sword_s07, theGame.params.CRITICAL_HIT_CHANCE, false, true)) * GetSkillLevel(S_Sword_s07);
  2673. }
  2674.  
  2675. return ret;
  2676. }
  2677.  
  2678.  
  2679. public function GetCriticalHitDamageBonus(weaponId : SItemUniqueId, victimMonsterCategory : EMonsterCategory, isStrikeAtBack : bool) : SAbilityAttributeValue
  2680. {
  2681. var min, max, bonus, null, oilBonus : SAbilityAttributeValue;
  2682. var mutagen : CBaseGameplayEffect;
  2683. var monsterBonusType : name;
  2684.  
  2685. bonus = super.GetCriticalHitDamageBonus(weaponId, victimMonsterCategory, isStrikeAtBack);
  2686.  
  2687.  
  2688. if( inv.ItemHasActiveOilApplied( weaponId, victimMonsterCategory ) && GetStat( BCS_Focus ) >= 3 && CanUseSkill( S_Alchemy_s07 ) )
  2689. {
  2690. monsterBonusType = MonsterCategoryToAttackPowerBonus( victimMonsterCategory );
  2691. oilBonus = inv.GetItemAttributeValue( weaponId, monsterBonusType );
  2692. if(oilBonus != null)
  2693. {
  2694. bonus += GetSkillAttributeValue(S_Alchemy_s07, theGame.params.CRITICAL_HIT_DAMAGE_BONUS, false, true) * GetSkillLevel(S_Alchemy_s07);
  2695. }
  2696. }
  2697.  
  2698.  
  2699. if (isStrikeAtBack && HasBuff(EET_Mutagen11))
  2700. {
  2701. mutagen = GetBuff(EET_Mutagen11);
  2702. theGame.GetDefinitionsManager().GetAbilityAttributeValue(mutagen.GetAbilityName(), 'damageIncrease', min, max);
  2703. bonus += GetAttributeRandomizedValue(min, max);
  2704. }
  2705.  
  2706. return bonus;
  2707. }
  2708.  
  2709. public function ProcessLockTarget( optional newLockTarget : CActor, optional checkLeftStickHeading : bool ) : bool
  2710. {
  2711. var newLockTargetFound : bool;
  2712.  
  2713. newLockTargetFound = super.ProcessLockTarget(newLockTarget, checkLeftStickHeading);
  2714.  
  2715. if(GetCurrentlyCastSign() == ST_Axii)
  2716. {
  2717. ((W3AxiiEntity)GetCurrentSignEntity()).OnDisplayTargetChange(newLockTarget);
  2718. }
  2719.  
  2720. return newLockTargetFound;
  2721. }
  2722.  
  2723.  
  2724.  
  2725.  
  2726.  
  2727.  
  2728.  
  2729. event OnProcessActionPost(action : W3DamageAction)
  2730. {
  2731. var attackAction : W3Action_Attack;
  2732. var rendLoad : float;
  2733. var value : SAbilityAttributeValue;
  2734. var actorVictim : CActor;
  2735. var weaponId : SItemUniqueId;
  2736. var usesSteel, usesSilver, usesVitality, usesEssence : bool;
  2737. var abs : array<name>;
  2738. var i : int;
  2739. var dm : CDefinitionsManagerAccessor;
  2740. var items : array<SItemUniqueId>;
  2741. var weaponEnt : CEntity;
  2742.  
  2743. //ESGO - Begin
  2744. var Options : ESGOOptionHandler;
  2745. var Combat : ESGOCombatHandler;
  2746.  
  2747. Options = new ESGOOptionHandler in this;
  2748. Combat = new ESGOCombatHandler in this;
  2749.  
  2750. Combat.SetMaximumAdrenaline();
  2751. //ESGO - End
  2752.  
  2753. super.OnProcessActionPost(action);
  2754.  
  2755. attackAction = (W3Action_Attack)action;
  2756. actorVictim = (CActor)action.victim;
  2757.  
  2758. if(attackAction)
  2759. {
  2760. if(attackAction.IsActionMelee())
  2761. {
  2762.  
  2763. if(SkillNameToEnum(attackAction.GetAttackTypeName()) == S_Sword_s02)
  2764. {
  2765. rendLoad = GetSpecialAttackTimeRatio();
  2766.  
  2767.  
  2768. rendLoad = MinF(rendLoad * GetStatMax(BCS_Focus), GetStat(BCS_Focus));
  2769.  
  2770.  
  2771. rendLoad = FloorF(rendLoad);
  2772. DrainFocus( rendLoad * Options.RendCostAdr() ); //ESGO
  2773.  
  2774. OnSpecialAttackHeavyActionProcess();
  2775. }
  2776. else if(actorVictim && IsRequiredAttitudeBetween(this, actorVictim, true))
  2777. {
  2778.  
  2779.  
  2780. value = GetAttributeValue('focus_gain');
  2781.  
  2782. if( FactsQuerySum("debug_fact_focus_boy") > 0 )
  2783. {
  2784. Debug_FocusBoyFocusGain();
  2785. }
  2786.  
  2787.  
  2788. if ( CanUseSkill(S_Sword_s20) )
  2789. {
  2790. value += GetSkillAttributeValue(S_Sword_s20, 'focus_gain', false, true) * GetSkillLevel(S_Sword_s20);
  2791. }
  2792.  
  2793.  
  2794. if( IsMutationActive( EPMT_Mutation3 ) && IsRequiredAttitudeBetween( this, action.victim, true ) && !action.victim.HasTag( 'Mutation3InvalidTarget' ) && !attackAction.IsParried() && !attackAction.WasDodged() && !attackAction.IsCountered() && !inv.IsItemFists( attackAction.GetWeaponId() ) && !attackAction.WasDamageReturnedToAttacker() && attackAction.DealtDamage() )
  2795. {
  2796. AddEffectDefault( EET_Mutation3, this, "", false );
  2797. }
  2798.  
  2799. //ESGO - Begin
  2800. GainStat(BCS_Focus, ((0.1f * (1 + CalculateAttributeValue(value))) * Options.FocusGainHits() ) );
  2801. //ESGO - End
  2802. }
  2803.  
  2804.  
  2805. weaponId = attackAction.GetWeaponId();
  2806. if(actorVictim && (ShouldProcessTutorial('TutorialWrongSwordSteel') || ShouldProcessTutorial('TutorialWrongSwordSilver')) && GetAttitudeBetween(actorVictim, this) == AIA_Hostile)
  2807. {
  2808. usesSteel = inv.IsItemSteelSwordUsableByPlayer(weaponId);
  2809. usesSilver = inv.IsItemSilverSwordUsableByPlayer(weaponId);
  2810. usesVitality = actorVictim.UsesVitality();
  2811. usesEssence = actorVictim.UsesEssence();
  2812.  
  2813. if(usesSilver && usesVitality)
  2814. {
  2815. FactsAdd('tut_wrong_sword_silver',1);
  2816. }
  2817. else if(usesSteel && usesEssence)
  2818. {
  2819. FactsAdd('tut_wrong_sword_steel',1);
  2820. }
  2821. else if(FactsQuerySum('tut_wrong_sword_steel') && usesSilver && usesEssence)
  2822. {
  2823. FactsAdd('tut_proper_sword_silver',1);
  2824. FactsRemove('tut_wrong_sword_steel');
  2825. }
  2826. else if(FactsQuerySum('tut_wrong_sword_silver') && usesSteel && usesVitality)
  2827. {
  2828. FactsAdd('tut_proper_sword_steel',1);
  2829. FactsRemove('tut_wrong_sword_silver');
  2830. }
  2831. }
  2832.  
  2833.  
  2834. if(!action.WasDodged() && HasAbility('Runeword 1 _Stats', true))
  2835. {
  2836. if(runewordInfusionType == ST_Axii)
  2837. {
  2838. actorVictim.SoundEvent('sign_axii_release');
  2839. }
  2840. else if(runewordInfusionType == ST_Igni)
  2841. {
  2842. actorVictim.SoundEvent('sign_igni_charge_begin');
  2843. }
  2844. else if(runewordInfusionType == ST_Quen)
  2845. {
  2846. value = GetAttributeValue('runeword1_quen_heal');
  2847. Heal( action.GetDamageDealt() * value.valueMultiplicative );
  2848. PlayEffectSingle('drain_energy_caretaker_shovel');
  2849. }
  2850. else if(runewordInfusionType == ST_Yrden)
  2851. {
  2852. actorVictim.SoundEvent('sign_yrden_shock_activate');
  2853. }
  2854. runewordInfusionType = ST_None;
  2855.  
  2856.  
  2857. items = inv.GetHeldWeapons();
  2858. weaponEnt = inv.GetItemEntityUnsafe(items[0]);
  2859. weaponEnt.StopEffect('runeword_aard');
  2860. weaponEnt.StopEffect('runeword_axii');
  2861. weaponEnt.StopEffect('runeword_igni');
  2862. weaponEnt.StopEffect('runeword_quen');
  2863. weaponEnt.StopEffect('runeword_yrden');
  2864. }
  2865.  
  2866.  
  2867. if(ShouldProcessTutorial('TutorialLightAttacks') || ShouldProcessTutorial('TutorialHeavyAttacks'))
  2868. {
  2869. if(IsLightAttack(attackAction.GetAttackName()))
  2870. {
  2871. theGame.GetTutorialSystem().IncreaseGeraltsLightAttacksCount(action.victim.GetTags());
  2872. }
  2873. else if(IsHeavyAttack(attackAction.GetAttackName()))
  2874. {
  2875. theGame.GetTutorialSystem().IncreaseGeraltsHeavyAttacksCount(action.victim.GetTags());
  2876. }
  2877. }
  2878. }
  2879. else if(attackAction.IsActionRanged())
  2880. {
  2881.  
  2882. if(CanUseSkill(S_Sword_s15))
  2883. {
  2884. value = GetSkillAttributeValue(S_Sword_s15, 'focus_gain', false, true) * GetSkillLevel(S_Sword_s15) ;
  2885.  
  2886. //ESGO - Begin
  2887. GainStat(BCS_Focus, (CalculateAttributeValue(value) * Options.FocusGainRanged() ) );
  2888. //ESGO - End
  2889. }
  2890.  
  2891.  
  2892. if(CanUseSkill(S_Sword_s12) && attackAction.IsCriticalHit() && actorVictim)
  2893. {
  2894.  
  2895. actorVictim.GetCharacterStats().GetAbilities(abs, false);
  2896. dm = theGame.GetDefinitionsManager();
  2897. for(i=abs.Size()-1; i>=0; i-=1)
  2898. {
  2899. if(!dm.AbilityHasTag(abs[i], theGame.params.TAG_MONSTER_SKILL) || actorVictim.IsAbilityBlocked(abs[i]))
  2900. {
  2901. abs.EraseFast(i);
  2902. }
  2903. }
  2904.  
  2905.  
  2906. if(abs.Size() > 0)
  2907. {
  2908. value = GetSkillAttributeValue(S_Sword_s12, 'duration', true, true) * GetSkillLevel(S_Sword_s12);
  2909. actorVictim.BlockAbility(abs[ RandRange(abs.Size()) ], true, CalculateAttributeValue(value));
  2910. }
  2911. }
  2912. }
  2913. }
  2914.  
  2915.  
  2916. if( IsMutationActive( EPMT_Mutation10 ) && actorVictim && ( action.IsActionMelee() || action.IsActionWitcherSign() ) && !IsCurrentSignChanneled() )
  2917. {
  2918. PlayEffectSingle( 'mutation_10_energy' );
  2919. }
  2920.  
  2921.  
  2922. if(CanUseSkill(S_Perk_18) && ((W3Petard)action.causer) && action.DealsAnyDamage() && !action.IsDoTDamage())
  2923. {
  2924. value = GetSkillAttributeValue(S_Perk_18, 'focus_gain', false, true);
  2925.  
  2926. //ESGO - Begin
  2927. GainStat(BCS_Focus, (CalculateAttributeValue(value) * Options.FocusGainBombs() ) );
  2928. //ESGO - End
  2929. }
  2930.  
  2931.  
  2932. if( attackAction && IsHeavyAttack( attackAction.GetAttackName() ) && !IsUsingHorse() && attackAction.DealtDamage() && IsSetBonusActive( EISB_Lynx_1 ) && !attackAction.WasDodged() && !attackAction.IsParried() && !attackAction.IsCountered() && ( inv.IsItemSteelSwordUsableByPlayer( attackAction.GetWeaponId() ) || inv.IsItemSilverSwordUsableByPlayer( attackAction.GetWeaponId() ) ) )
  2933. {
  2934. AddEffectDefault( EET_LynxSetBonus, NULL, "HeavyAttack" );
  2935. SoundEvent( "ep2_setskill_lynx_activate" );
  2936. }
  2937. }
  2938.  
  2939.  
  2940. timer function Mutagen14Timer(dt : float, id : int)
  2941. {
  2942. var abilityName : name;
  2943. var abilityCount, maxStack : float;
  2944. var min, max : SAbilityAttributeValue;
  2945. var addAbility : bool;
  2946.  
  2947. abilityName = GetBuff(EET_Mutagen14).GetAbilityName();
  2948. abilityCount = GetAbilityCount(abilityName);
  2949.  
  2950. if(abilityCount == 0)
  2951. {
  2952. addAbility = true;
  2953. }
  2954. else
  2955. {
  2956. theGame.GetDefinitionsManager().GetAbilityAttributeValue(abilityName, 'mutagen14_max_stack', min, max);
  2957. maxStack = CalculateAttributeValue(GetAttributeRandomizedValue(min, max));
  2958.  
  2959. if(maxStack >= 0)
  2960. {
  2961. addAbility = (abilityCount < maxStack);
  2962. }
  2963. else
  2964. {
  2965. addAbility = true;
  2966. }
  2967. }
  2968.  
  2969. if(addAbility)
  2970. {
  2971. AddAbility(abilityName, true);
  2972. }
  2973. else
  2974. {
  2975.  
  2976. RemoveTimer('Mutagen14Timer');
  2977. }
  2978. }
  2979.  
  2980. public final function FailFundamentalsFirstAchievementCondition()
  2981. {
  2982. SetFailedFundamentalsFirstAchievementCondition(true);
  2983. }
  2984.  
  2985. public final function SetUsedQuenInCombat()
  2986. {
  2987. usedQuenInCombat = true;
  2988. }
  2989.  
  2990. public final function UsedQuenInCombat() : bool
  2991. {
  2992. return usedQuenInCombat;
  2993. }
  2994.  
  2995. event OnCombatStart()
  2996. {
  2997. var quenEntity, glyphQuen : W3QuenEntity;
  2998. var focus, stamina : float;
  2999. var glowTargets, moTargets, actors : array< CActor >;
  3000. var delays : array< float >;
  3001. var rand, i : int;
  3002. var isHostile, isAlive, isUnconscious : bool;
  3003.  
  3004. super.OnCombatStart();
  3005.  
  3006. if ( IsInCombatActionFriendly() )
  3007. {
  3008. SetBIsCombatActionAllowed(true);
  3009. SetBIsInputAllowed(true, 'OnCombatActionStart' );
  3010. }
  3011.  
  3012.  
  3013. if(HasBuff(EET_Mutagen14))
  3014. {
  3015. AddTimer('Mutagen14Timer', 2, true);
  3016. }
  3017.  
  3018.  
  3019. if(HasBuff(EET_Mutagen15))
  3020. {
  3021. AddAbility(GetBuff(EET_Mutagen15).GetAbilityName(), false);
  3022. }
  3023.  
  3024.  
  3025. mutation12IsOnCooldown = false;
  3026.  
  3027.  
  3028. quenEntity = (W3QuenEntity)signs[ST_Quen].entity;
  3029.  
  3030.  
  3031. if(quenEntity)
  3032. {
  3033. usedQuenInCombat = quenEntity.IsAnyQuenActive();
  3034. }
  3035. else
  3036. {
  3037. usedQuenInCombat = false;
  3038. }
  3039.  
  3040. if(usedQuenInCombat || HasPotionBuff() || IsEquippedSwordUpgradedWithOil(true) || IsEquippedSwordUpgradedWithOil(false))
  3041. {
  3042. SetFailedFundamentalsFirstAchievementCondition(true);
  3043. }
  3044. else
  3045. {
  3046. if(IsAnyItemEquippedOnSlot(EES_PotionMutagen1) || IsAnyItemEquippedOnSlot(EES_PotionMutagen2) || IsAnyItemEquippedOnSlot(EES_PotionMutagen3) || IsAnyItemEquippedOnSlot(EES_PotionMutagen4))
  3047. SetFailedFundamentalsFirstAchievementCondition(true);
  3048. else
  3049. SetFailedFundamentalsFirstAchievementCondition(false);
  3050. }
  3051.  
  3052. if(CanUseSkill(S_Sword_s20) && IsThreatened())
  3053. {
  3054. focus = GetStat(BCS_Focus);
  3055. if(focus < 1)
  3056. {
  3057. GainStat(BCS_Focus, 1 - focus);
  3058. }
  3059. }
  3060.  
  3061. if ( HasAbility('Glyphword 17 _Stats', true) && RandF() < CalculateAttributeValue(GetAttributeValue('quen_apply_chance')) )
  3062. {
  3063. stamina = GetStat(BCS_Stamina);
  3064. glyphQuen = (W3QuenEntity)theGame.CreateEntity( signs[ST_Quen].template, GetWorldPosition(), GetWorldRotation() );
  3065. glyphQuen.Init( signOwner, signs[ST_Quen].entity, true );
  3066. glyphQuen.OnStarted();
  3067. glyphQuen.OnThrowing();
  3068. glyphQuen.OnEnded();
  3069. ForceSetStat(BCS_Stamina, stamina);
  3070. }
  3071.  
  3072.  
  3073. MeditationForceAbort(true);
  3074.  
  3075.  
  3076.  
  3077.  
  3078.  
  3079. if( IsMutationActive( EPMT_Mutation4 ) )
  3080. {
  3081. AddEffectDefault( EET_Mutation4, this, "combat start", false );
  3082. }
  3083. else if( IsMutationActive( EPMT_Mutation5 ) && GetStat( BCS_Focus ) >= 1.f )
  3084. {
  3085. AddEffectDefault( EET_Mutation5, this, "", false );
  3086. }
  3087.  
  3088. else if( IsMutationActive( EPMT_Mutation7 ) )
  3089. {
  3090.  
  3091.  
  3092. RemoveTimer( 'Mutation7CombatStartHackFixGo' );
  3093.  
  3094.  
  3095. AddTimer( 'Mutation7CombatStartHackFix', 1.f, true, , , , true );
  3096.  
  3097. }
  3098. else if( IsMutationActive( EPMT_Mutation8 ) )
  3099. {
  3100. theGame.MutationHUDFeedback( MFT_PlayRepeat );
  3101. }
  3102.  
  3103. else if( IsMutationActive( EPMT_Mutation10 ) )
  3104. {
  3105. if( !HasBuff( EET_Mutation10 ) && GetStat( BCS_Toxicity ) > 0.f )
  3106. {
  3107. AddEffectDefault( EET_Mutation10, this, "Mutation 10" );
  3108. }
  3109.  
  3110.  
  3111. PlayEffect( 'mutation_10' );
  3112.  
  3113.  
  3114. PlayEffect( 'critical_toxicity' );
  3115. AddTimer( 'Mutation10StopEffect', 5.f );
  3116. }
  3117. }
  3118.  
  3119. timer function Mutation7CombatStartHackFix( dt : float, id : int )
  3120. {
  3121. var actors : array< CActor >;
  3122.  
  3123. actors = GetEnemies();
  3124.  
  3125. if( actors.Size() > 0 )
  3126. {
  3127.  
  3128. AddTimer( 'Mutation7CombatStartHackFixGo', 0.5f );
  3129. RemoveTimer( 'Mutation7CombatStartHackFix' );
  3130. }
  3131. }
  3132.  
  3133. timer function Mutation7CombatStartHackFixGo( dt : float, id : int )
  3134. {
  3135. var actors : array< CActor >;
  3136.  
  3137. if( IsMutationActive( EPMT_Mutation7 ) )
  3138. {
  3139. actors = GetEnemies();
  3140.  
  3141. if( actors.Size() > 1 )
  3142. {
  3143. AddEffectDefault( EET_Mutation7Buff, this, "Mutation 7, combat start" );
  3144. }
  3145. }
  3146. }
  3147.  
  3148. public final function IsInFistFight() : bool
  3149. {
  3150. var enemies : array< CActor >;
  3151. var i, j : int;
  3152. var invent : CInventoryComponent;
  3153. var weapons : array< SItemUniqueId >;
  3154.  
  3155. if( IsInFistFightMiniGame() )
  3156. {
  3157. return true;
  3158. }
  3159.  
  3160. enemies = GetEnemies();
  3161. for( i=0; i<enemies.Size(); i+=1 )
  3162. {
  3163. weapons.Clear();
  3164. invent = enemies[i].GetInventory();
  3165. weapons = invent.GetHeldWeapons();
  3166.  
  3167. for( j=0; j<weapons.Size(); j+=1 )
  3168. {
  3169. if( invent.IsItemFists( weapons[j] ) )
  3170. {
  3171. return true;
  3172. }
  3173. }
  3174. }
  3175.  
  3176. return false;
  3177. }
  3178.  
  3179. timer function Mutation10StopEffect( dt : float, id : int )
  3180. {
  3181. StopEffect( 'critical_toxicity' );
  3182. }
  3183.  
  3184.  
  3185. event OnCombatFinished()
  3186. {
  3187. var mut17 : W3Mutagen17_Effect;
  3188. var inGameConfigWrapper : CInGameConfigWrapper;
  3189. var disableAutoSheathe : bool;
  3190.  
  3191. super.OnCombatFinished();
  3192.  
  3193.  
  3194. if(HasBuff(EET_Mutagen10))
  3195. {
  3196. RemoveAbilityAll( GetBuff(EET_Mutagen10).GetAbilityName() );
  3197. }
  3198.  
  3199.  
  3200. if(HasBuff(EET_Mutagen14))
  3201. {
  3202. RemoveAbilityAll( GetBuff(EET_Mutagen14).GetAbilityName() );
  3203. }
  3204.  
  3205.  
  3206. if(HasBuff(EET_Mutagen15))
  3207. {
  3208. RemoveAbilityAll( GetBuff(EET_Mutagen15).GetAbilityName() );
  3209. }
  3210.  
  3211.  
  3212. if(HasBuff(EET_Mutagen17))
  3213. {
  3214. mut17 = (W3Mutagen17_Effect)GetBuff(EET_Mutagen17);
  3215. mut17.ClearBoost();
  3216. }
  3217.  
  3218.  
  3219. if(HasBuff(EET_Mutagen18))
  3220. {
  3221. RemoveAbilityAll( GetBuff(EET_Mutagen18).GetAbilityName() );
  3222. }
  3223.  
  3224.  
  3225. if(HasBuff(EET_Mutagen22))
  3226. {
  3227. RemoveAbilityAll( GetBuff(EET_Mutagen22).GetAbilityName() );
  3228. }
  3229.  
  3230.  
  3231. if(HasBuff(EET_Mutagen27))
  3232. {
  3233. RemoveAbilityAll( GetBuff(EET_Mutagen27).GetAbilityName() );
  3234. }
  3235.  
  3236.  
  3237. RemoveBuff( EET_Mutation3 );
  3238.  
  3239.  
  3240. RemoveBuff( EET_Mutation4 );
  3241.  
  3242.  
  3243. RemoveBuff( EET_Mutation5 );
  3244.  
  3245.  
  3246. RemoveBuff( EET_Mutation7Buff );
  3247. RemoveBuff( EET_Mutation7Debuff );
  3248.  
  3249. if( IsMutationActive( EPMT_Mutation7 ) )
  3250. {
  3251. theGame.MutationHUDFeedback( MFT_PlayHide );
  3252. }
  3253. else if( IsMutationActive( EPMT_Mutation8 ) )
  3254. {
  3255. theGame.MutationHUDFeedback( MFT_PlayHide );
  3256. }
  3257.  
  3258.  
  3259. RemoveBuff( EET_Mutation10 );
  3260.  
  3261.  
  3262. RemoveBuff( EET_LynxSetBonus );
  3263.  
  3264.  
  3265. if(GetStat(BCS_Focus) > 0)
  3266. {
  3267. AddTimer('DelayedAdrenalineDrain', theGame.params.ADRENALINE_DRAIN_AFTER_COMBAT_DELAY, , , , true);
  3268. }
  3269.  
  3270.  
  3271. thePlayer.abilityManager.ResetOverhealBonus();
  3272.  
  3273. usedQuenInCombat = false;
  3274.  
  3275. theGame.GetGamerProfile().ResetStat(ES_FinesseKills);
  3276.  
  3277. LogChannel( 'OnCombatFinished', "OnCombatFinished: DelayedSheathSword timer added" );
  3278.  
  3279.  
  3280. inGameConfigWrapper = (CInGameConfigWrapper)theGame.GetInGameConfigWrapper();
  3281. disableAutoSheathe = inGameConfigWrapper.GetVarValue( 'Gameplay', 'DisableAutomaticSwordSheathe' );
  3282. if( !disableAutoSheathe )
  3283. {
  3284. if ( ShouldAutoSheathSwordInstantly() )
  3285. AddTimer( 'DelayedSheathSword', 0.5f );
  3286. else
  3287. AddTimer( 'DelayedSheathSword', 2.f );
  3288. }
  3289.  
  3290. OnBlockAllCombatTickets( false );
  3291.  
  3292.  
  3293. runewordInfusionType = ST_None;
  3294.  
  3295.  
  3296.  
  3297.  
  3298.  
  3299. }
  3300.  
  3301. public function PlayHitEffect( damageAction : W3DamageAction )
  3302. {
  3303. var hitReactionType : EHitReactionType;
  3304. var isAtBack : bool;
  3305.  
  3306.  
  3307. if( damageAction.GetMutation4Triggered() )
  3308. {
  3309. hitReactionType = damageAction.GetHitReactionType();
  3310. isAtBack = IsAttackerAtBack( damageAction.attacker );
  3311.  
  3312. if( hitReactionType != EHRT_Heavy )
  3313. {
  3314. if( isAtBack )
  3315. {
  3316. damageAction.SetHitEffect( 'light_hit_back_toxic', true );
  3317. }
  3318. else
  3319. {
  3320. damageAction.SetHitEffect( 'light_hit_toxic' );
  3321. }
  3322. }
  3323. else
  3324. {
  3325. if( isAtBack )
  3326. {
  3327. damageAction.SetHitEffect( 'heavy_hit_back_toxic' ,true );
  3328. }
  3329. else
  3330. {
  3331. damageAction.SetHitEffect( 'heavy_hit_toxic' );
  3332. }
  3333. }
  3334. }
  3335.  
  3336. super.PlayHitEffect( damageAction );
  3337. }
  3338.  
  3339. timer function DelayedAdrenalineDrain(dt : float, id : int)
  3340. {
  3341. if ( !HasBuff(EET_Runeword8) )
  3342. AddEffectDefault(EET_AdrenalineDrain, this, "after_combat_adrenaline_drain");
  3343. }
  3344.  
  3345.  
  3346. protected function Attack( hitTarget : CGameplayEntity, animData : CPreAttackEventData, weaponId : SItemUniqueId, parried : bool, countered : bool, parriedBy : array<CActor>, attackAnimationName : name, hitTime : float, weaponEntity : CItemEntity)
  3347. {
  3348. var mutagen17 : W3Mutagen17_Effect;
  3349.  
  3350. super.Attack(hitTarget, animData, weaponId, parried, countered, parriedBy, attackAnimationName, hitTime, weaponEntity);
  3351.  
  3352. if( (CActor)hitTarget && HasBuff(EET_Mutagen17) )
  3353. {
  3354. mutagen17 = (W3Mutagen17_Effect)GetBuff(EET_Mutagen17);
  3355. if(mutagen17.HasBoost())
  3356. {
  3357. mutagen17.ClearBoost();
  3358. }
  3359. }
  3360. }
  3361.  
  3362. public final timer function SpecialAttackLightSustainCost(dt : float, id : int)
  3363. {
  3364. var focusPerSec, cost, delay : float;
  3365. var reduction : SAbilityAttributeValue;
  3366. var skillLevel : int;
  3367.  
  3368. //ESGO - Begin
  3369. var Options : ESGOOptionHandler;
  3370.  
  3371. Options = new ESGOOptionHandler in this;
  3372. //ESGO - End
  3373.  
  3374. if(abilityManager && abilityManager.IsInitialized() && IsAlive())
  3375. {
  3376. PauseStaminaRegen('WhirlSkill');
  3377.  
  3378. if(GetStat(BCS_Stamina) > 0)
  3379. {
  3380. cost = GetStaminaActionCost(ESAT_Ability, GetSkillAbilityName(S_Sword_s01), dt);
  3381. delay = GetStaminaActionDelay(ESAT_Ability, GetSkillAbilityName(S_Sword_s01), dt);
  3382. //ESGO - Begin
  3383. if ( Options.WhirlReq() > 0 )
  3384. skillLevel = Options.WhirlReq();
  3385. else
  3386. skillLevel = GetSkillLevel(S_Sword_s01);
  3387. //ESGO - End
  3388.  
  3389. if(skillLevel > 1)
  3390. {
  3391. reduction = GetSkillAttributeValue(S_Sword_s01, 'cost_reduction', false, true) * (skillLevel - 1);
  3392. cost = MaxF(0, cost * (1 - reduction.valueMultiplicative) - reduction.valueAdditive);
  3393. }
  3394.  
  3395. //ESGO - Begin
  3396. DrainStamina(ESAT_FixedValue, cost * Options.WhirlCostStam(), delay, GetSkillAbilityName(S_Sword_s01));
  3397. //ESGO - End
  3398. }
  3399. else
  3400. {
  3401. GetSkillAttributeValue(S_Sword_s01, 'focus_cost_per_sec', false, true);
  3402. focusPerSec = GetWhirlFocusCostPerSec();
  3403. DrainFocus(focusPerSec * dt);
  3404. }
  3405. }
  3406.  
  3407. if(GetStat(BCS_Stamina) <= 0 && GetStat(BCS_Focus) <= 0)
  3408. {
  3409. OnPerformSpecialAttack(true, false);
  3410. }
  3411. }
  3412.  
  3413. public final function GetWhirlFocusCostPerSec() : float
  3414. {
  3415. var ability : SAbilityAttributeValue;
  3416. var val : float;
  3417. var skillLevel : int;
  3418.  
  3419. ability = GetSkillAttributeValue(S_Sword_s01, 'focus_cost_per_sec_initial', false, false);
  3420. //ESGO - Begin -- Set Whirl Level
  3421. if( StringToInt( theGame.GetInGameConfigWrapper().GetVarValue('SCOptionCWh', 'WhSR') ) > 0 )
  3422. skillLevel = StringToInt( theGame.GetInGameConfigWrapper().GetVarValue('SCOptionCWh', 'WhSR') );
  3423. else
  3424. skillLevel = GetSkillLevel(S_Sword_s01);
  3425. //ESGO - End
  3426.  
  3427. if(skillLevel > 1)
  3428. ability -= GetSkillAttributeValue(S_Sword_s01, 'cost_reduction', false, false) * (skillLevel-1);
  3429.  
  3430. val = CalculateAttributeValue(ability);
  3431.  
  3432. return val;
  3433. }
  3434.  
  3435. public final timer function SpecialAttackHeavySustainCost(dt : float, id : int)
  3436. {
  3437. var focusHighlight, ratio : float;
  3438. var hud : CR4ScriptedHud;
  3439. var hudWolfHeadModule : CR4HudModuleWolfHead;
  3440.  
  3441. //ESGO - Begin
  3442. var Options : ESGOOptionHandler;
  3443.  
  3444. Options = new ESGOOptionHandler in this;
  3445.  
  3446. DrainStamina(ESAT_Ability, 0, 0, GetSkillAbilityName(S_Sword_s02), dt, Options.RendCostStam());
  3447. //ESGO - End
  3448.  
  3449. if(GetStat(BCS_Stamina) <= 0)
  3450. OnPerformSpecialAttack(false, false);
  3451.  
  3452.  
  3453. ratio = EngineTimeToFloat(theGame.GetEngineTime() - specialHeavyStartEngineTime) / specialHeavyChargeDuration;
  3454.  
  3455.  
  3456. if(ratio > 0.95)
  3457. ratio = 1;
  3458.  
  3459. SetSpecialAttackTimeRatio(ratio);
  3460.  
  3461.  
  3462.  
  3463.  
  3464.  
  3465. }
  3466.  
  3467. public function OnSpecialAttackHeavyActionProcess()
  3468. {
  3469. var hud : CR4ScriptedHud;
  3470. var hudWolfHeadModule : CR4HudModuleWolfHead;
  3471.  
  3472. super.OnSpecialAttackHeavyActionProcess();
  3473.  
  3474. hud = (CR4ScriptedHud)theGame.GetHud();
  3475. if ( hud )
  3476. {
  3477. hudWolfHeadModule = (CR4HudModuleWolfHead)hud.GetHudModule( "WolfHeadModule" );
  3478. if ( hudWolfHeadModule )
  3479. {
  3480. hudWolfHeadModule.ResetFocusPoints();
  3481. }
  3482. }
  3483. }
  3484.  
  3485. timer function IsSpecialLightAttackInputHeld ( time : float, id : int )
  3486. {
  3487. var hasResource : bool;
  3488.  
  3489. if ( GetCurrentStateName() == 'CombatSteel' || GetCurrentStateName() == 'CombatSilver' )
  3490. {
  3491. if ( GetBIsCombatActionAllowed() && inputHandler.IsActionAllowed(EIAB_SwordAttack))
  3492. {
  3493. if(GetStat(BCS_Stamina) > 0)
  3494. {
  3495. hasResource = true;
  3496. }
  3497. else
  3498. {
  3499. hasResource = (GetStat(BCS_Focus) >= GetWhirlFocusCostPerSec() * time);
  3500. }
  3501.  
  3502. if(hasResource)
  3503. {
  3504. SetupCombatAction( EBAT_SpecialAttack_Light, BS_Pressed );
  3505. RemoveTimer('IsSpecialLightAttackInputHeld');
  3506. }
  3507. else if(!playedSpecialAttackMissingResourceSound)
  3508. {
  3509. IndicateTooLowAdrenaline();
  3510. playedSpecialAttackMissingResourceSound = true;
  3511. }
  3512. }
  3513. }
  3514. else
  3515. {
  3516. RemoveTimer('IsSpecialLightAttackInputHeld');
  3517. }
  3518. }
  3519.  
  3520. timer function IsSpecialHeavyAttackInputHeld ( time : float, id : int )
  3521. {
  3522. var cost : float;
  3523.  
  3524. if ( GetCurrentStateName() == 'CombatSteel' || GetCurrentStateName() == 'CombatSilver' )
  3525. {
  3526. cost = CalculateAttributeValue(GetSkillAttributeValue(S_Sword_s02, 'stamina_cost_per_sec', false, false));
  3527.  
  3528. if( GetBIsCombatActionAllowed() && inputHandler.IsActionAllowed(EIAB_SwordAttack))
  3529. {
  3530. if(GetStat(BCS_Stamina) >= cost)
  3531. {
  3532. SetupCombatAction( EBAT_SpecialAttack_Heavy, BS_Pressed );
  3533. RemoveTimer('IsSpecialHeavyAttackInputHeld');
  3534. theGame.HapticStart( "haptic_rend_stop" );
  3535. }
  3536. else if(!playedSpecialAttackMissingResourceSound)
  3537. {
  3538. IndicateTooLowAdrenaline();
  3539. playedSpecialAttackMissingResourceSound = true;
  3540. theGame.HapticStart( "haptic_rend_stop" );
  3541. }
  3542. }
  3543. }
  3544. else
  3545. {
  3546. RemoveTimer('IsSpecialHeavyAttackInputHeld');
  3547. theGame.HapticStart( "haptic_rend_stop" );
  3548. }
  3549. }
  3550.  
  3551. public function EvadePressed( bufferAction : EBufferActionType )
  3552. {
  3553. var cat : float;
  3554.  
  3555. if( (bufferAction == EBAT_Dodge && IsActionAllowed(EIAB_Dodge)) || (bufferAction == EBAT_Roll && IsActionAllowed(EIAB_Roll)) )
  3556. {
  3557.  
  3558. if(bufferAction != EBAT_Roll && ShouldProcessTutorial('TutorialDodge'))
  3559. {
  3560. FactsAdd("tut_in_dodge", 1, 2);
  3561.  
  3562. if(FactsQuerySum("tut_fight_use_slomo") > 0)
  3563. {
  3564. theGame.RemoveTimeScale( theGame.GetTimescaleSource(ETS_TutorialFight) );
  3565. FactsRemove("tut_fight_slomo_ON");
  3566. }
  3567. }
  3568. else if(bufferAction == EBAT_Roll && ShouldProcessTutorial('TutorialRoll'))
  3569. {
  3570. FactsAdd("tut_in_roll", 1, 2);
  3571.  
  3572. if(FactsQuerySum("tut_fight_use_slomo") > 0)
  3573. {
  3574. theGame.RemoveTimeScale( theGame.GetTimescaleSource(ETS_TutorialFight) );
  3575. FactsRemove("tut_fight_slomo_ON");
  3576. }
  3577. }
  3578.  
  3579. if ( GetBIsInputAllowed() )
  3580. {
  3581. if ( GetBIsCombatActionAllowed() )
  3582. {
  3583. CriticalEffectAnimationInterrupted("Dodge 2");
  3584. PushCombatActionOnBuffer( bufferAction, BS_Released );
  3585. ProcessCombatActionBuffer();
  3586. }
  3587. else if ( IsInCombatAction() && GetBehaviorVariable( 'combatActionType' ) == (int)CAT_Attack )
  3588. {
  3589. if ( CanPlayHitAnim() && IsThreatened() )
  3590. {
  3591. CriticalEffectAnimationInterrupted("Dodge 1");
  3592. PushCombatActionOnBuffer( bufferAction, BS_Released );
  3593. ProcessCombatActionBuffer();
  3594. }
  3595. else
  3596. PushCombatActionOnBuffer( bufferAction, BS_Released );
  3597. }
  3598.  
  3599. else if ( !( IsCurrentSignChanneled() ) )
  3600. {
  3601.  
  3602. PushCombatActionOnBuffer( bufferAction, BS_Released );
  3603. }
  3604. }
  3605. else
  3606. {
  3607. if ( IsInCombatAction() && GetBehaviorVariable( 'combatActionType' ) == (int)CAT_Attack )
  3608. {
  3609. if ( CanPlayHitAnim() && IsThreatened() )
  3610. {
  3611. CriticalEffectAnimationInterrupted("Dodge 3");
  3612. PushCombatActionOnBuffer( bufferAction, BS_Released );
  3613. ProcessCombatActionBuffer();
  3614. }
  3615. else
  3616. PushCombatActionOnBuffer( bufferAction, BS_Released );
  3617. }
  3618. LogChannel( 'InputNotAllowed', "InputNotAllowed" );
  3619. }
  3620. }
  3621. else
  3622. {
  3623. DisplayActionDisallowedHudMessage(EIAB_Dodge);
  3624. }
  3625. }
  3626.  
  3627.  
  3628. public function ProcessCombatActionBuffer() : bool
  3629. {
  3630. var action : EBufferActionType = this.BufferCombatAction;
  3631. var stage : EButtonStage = this.BufferButtonStage;
  3632. var throwStage : EThrowStage;
  3633. var actionResult : bool = true;
  3634.  
  3635.  
  3636. if( isInFinisher )
  3637. {
  3638. return false;
  3639. }
  3640.  
  3641. if ( action != EBAT_SpecialAttack_Heavy )
  3642. specialAttackCamera = false;
  3643.  
  3644.  
  3645. if(super.ProcessCombatActionBuffer())
  3646. return true;
  3647.  
  3648. switch ( action )
  3649. {
  3650. case EBAT_CastSign :
  3651. {
  3652. switch ( stage )
  3653. {
  3654. case BS_Pressed :
  3655. {
  3656.  
  3657.  
  3658.  
  3659.  
  3660.  
  3661.  
  3662. actionResult = this.CastSign();
  3663. LogChannel('SignDebug', "CastSign()");
  3664.  
  3665.  
  3666. } break;
  3667.  
  3668. default :
  3669. {
  3670. actionResult = false;
  3671. } break;
  3672. }
  3673. } break;
  3674.  
  3675. case EBAT_SpecialAttack_Light :
  3676. {
  3677. switch ( stage )
  3678. {
  3679. case BS_Pressed :
  3680. {
  3681.  
  3682. actionResult = this.OnPerformSpecialAttack( true, true );
  3683. } break;
  3684.  
  3685. case BS_Released :
  3686. {
  3687. actionResult = this.OnPerformSpecialAttack( true, false );
  3688. } break;
  3689.  
  3690. default :
  3691. {
  3692. actionResult = false;
  3693. } break;
  3694. }
  3695. } break;
  3696.  
  3697. case EBAT_SpecialAttack_Heavy :
  3698. {
  3699. switch ( stage )
  3700. {
  3701. case BS_Pressed :
  3702. {
  3703.  
  3704. actionResult = this.OnPerformSpecialAttack( false, true );
  3705. } break;
  3706.  
  3707. case BS_Released :
  3708. {
  3709. actionResult = this.OnPerformSpecialAttack( false, false );
  3710. } break;
  3711.  
  3712. default :
  3713. {
  3714. actionResult = false;
  3715. } break;
  3716. }
  3717. } break;
  3718.  
  3719. default:
  3720. return false;
  3721. }
  3722.  
  3723.  
  3724. this.CleanCombatActionBuffer();
  3725.  
  3726. if (actionResult)
  3727. {
  3728. SetCombatAction( action ) ;
  3729. }
  3730.  
  3731. return true;
  3732. }
  3733.  
  3734.  
  3735. event OnPerformSpecialAttack( isLightAttack : bool, enableAttack : bool ){}
  3736.  
  3737. public final function GetEnemies() : array< CActor >
  3738. {
  3739. var actors, actors2 : array<CActor>;
  3740. var i : int;
  3741.  
  3742.  
  3743. actors = GetWitcherPlayer().GetHostileEnemies();
  3744. ArrayOfActorsAppendUnique( actors, GetWitcherPlayer().GetMoveTargets() );
  3745.  
  3746.  
  3747. thePlayer.GetVisibleEnemies( actors2 );
  3748. ArrayOfActorsAppendUnique( actors, actors2 );
  3749.  
  3750. for( i=actors.Size()-1; i>=0; i-=1 )
  3751. {
  3752. if( !IsRequiredAttitudeBetween( actors[i], this, true ) )
  3753. {
  3754. actors.EraseFast( i );
  3755. }
  3756. }
  3757.  
  3758. return actors;
  3759. }
  3760.  
  3761. event OnPlayerTickTimer( deltaTime : float )
  3762. {
  3763. super.OnPlayerTickTimer( deltaTime );
  3764.  
  3765. if ( !IsInCombat() )
  3766. {
  3767. fastAttackCounter = 0;
  3768. heavyAttackCounter = 0;
  3769. }
  3770. }
  3771.  
  3772.  
  3773.  
  3774.  
  3775.  
  3776. protected function PrepareAttackAction( hitTarget : CGameplayEntity, animData : CPreAttackEventData, weaponId : SItemUniqueId, parried : bool, countered : bool, parriedBy : array<CActor>, attackAnimationName : name, hitTime : float, weaponEntity : CItemEntity, out attackAction : W3Action_Attack) : bool
  3777. {
  3778. var ret : bool;
  3779. var skill : ESkill;
  3780.  
  3781. ret = super.PrepareAttackAction(hitTarget, animData, weaponId, parried, countered, parriedBy, attackAnimationName, hitTime, weaponEntity, attackAction);
  3782.  
  3783. if(!ret)
  3784. return false;
  3785.  
  3786.  
  3787. if(attackAction.IsActionMelee())
  3788. {
  3789. skill = SkillNameToEnum( attackAction.GetAttackTypeName() );
  3790. if( skill != S_SUndefined && CanUseSkill(skill))
  3791. {
  3792. if(IsLightAttack(animData.attackName))
  3793. fastAttackCounter += 1;
  3794. else
  3795. fastAttackCounter = 0;
  3796.  
  3797. if(IsHeavyAttack(animData.attackName))
  3798. heavyAttackCounter += 1;
  3799. else
  3800. heavyAttackCounter = 0;
  3801. }
  3802. }
  3803.  
  3804. AddTimer('FastAttackCounterDecay',5.0);
  3805. AddTimer('HeavyAttackCounterDecay',5.0);
  3806.  
  3807. return true;
  3808. }
  3809.  
  3810. protected function TestParryAndCounter(data : CPreAttackEventData, weaponId : SItemUniqueId, out parried : bool, out countered : bool) : array<CActor>
  3811. {
  3812.  
  3813. if(SkillNameToEnum(attackActionName) == S_Sword_s02)
  3814. data.Can_Parry_Attack = false;
  3815.  
  3816. return super.TestParryAndCounter(data, weaponId, parried, countered);
  3817. }
  3818.  
  3819. private timer function FastAttackCounterDecay(delta : float, id : int)
  3820. {
  3821. fastAttackCounter = 0;
  3822. }
  3823.  
  3824. private timer function HeavyAttackCounterDecay(delta : float, id : int)
  3825. {
  3826. heavyAttackCounter = 0;
  3827. }
  3828.  
  3829.  
  3830. public function GetCraftingSchematicsNames() : array<name> {return craftingSchematics;}
  3831.  
  3832. public function RemoveAllCraftingSchematics()
  3833. {
  3834. craftingSchematics.Clear();
  3835. }
  3836.  
  3837.  
  3838. function AddCraftingSchematic( nam : name, optional isSilent : bool, optional skipTutorialUpdate : bool ) : bool
  3839. {
  3840. var i : int;
  3841.  
  3842. if(!skipTutorialUpdate && ShouldProcessTutorial('TutorialCraftingGotRecipe'))
  3843. {
  3844. FactsAdd("tut_received_schematic");
  3845. }
  3846.  
  3847. for(i=0; i<craftingSchematics.Size(); i+=1)
  3848. {
  3849. if(craftingSchematics[i] == nam)
  3850. return false;
  3851.  
  3852.  
  3853. if(StrCmp(craftingSchematics[i],nam) > 0)
  3854. {
  3855. craftingSchematics.Insert(i,nam);
  3856. AddCraftingHudNotification( nam, isSilent );
  3857. theGame.GetGlobalEventsManager().OnScriptedEvent( SEC_CraftingSchematics );
  3858. return true;
  3859. }
  3860. }
  3861.  
  3862.  
  3863. craftingSchematics.PushBack(nam);
  3864. AddCraftingHudNotification( nam, isSilent );
  3865. theGame.GetGlobalEventsManager().OnScriptedEvent( SEC_CraftingSchematics );
  3866. return true;
  3867. }
  3868.  
  3869. function AddCraftingHudNotification( nam : name, isSilent : bool )
  3870. {
  3871. var hud : CR4ScriptedHud;
  3872. if( !isSilent )
  3873. {
  3874. hud = (CR4ScriptedHud)theGame.GetHud();
  3875. if( hud )
  3876. {
  3877. hud.OnCraftingSchematicUpdate( nam );
  3878. }
  3879. }
  3880. }
  3881.  
  3882. function AddAlchemyHudNotification( nam : name, isSilent : bool )
  3883. {
  3884. var hud : CR4ScriptedHud;
  3885. if( !isSilent )
  3886. {
  3887. hud = (CR4ScriptedHud)theGame.GetHud();
  3888. if( hud )
  3889. {
  3890. hud.OnAlchemySchematicUpdate( nam );
  3891. }
  3892. }
  3893. }
  3894.  
  3895. public function GetExpandedCraftingCategories() : array< name >
  3896. {
  3897. return expandedCraftingCategories;
  3898. }
  3899.  
  3900. public function AddExpandedCraftingCategory( category : name )
  3901. {
  3902. if ( IsNameValid( category ) )
  3903. {
  3904. ArrayOfNamesPushBackUnique( expandedCraftingCategories, category );
  3905. }
  3906. }
  3907.  
  3908. public function RemoveExpandedCraftingCategory( category : name )
  3909. {
  3910. if ( IsNameValid( category ) )
  3911. {
  3912. expandedCraftingCategories.Remove( category );
  3913. }
  3914. }
  3915.  
  3916. public function SetCraftingFilters(showHasIngre : bool, showMissingIngre : bool, showAlreadyCrafted : bool )
  3917. {
  3918. craftingFilters.showCraftable = showHasIngre;
  3919. craftingFilters.showMissingIngre = showMissingIngre;
  3920. craftingFilters.showAlreadyCrafted = showAlreadyCrafted;
  3921. }
  3922.  
  3923. public function GetCraftingFilters() : SCraftingFilters
  3924. {
  3925.  
  3926. if ( craftingFilters.showCraftable == false && craftingFilters.showMissingIngre == false && craftingFilters.showAlreadyCrafted == false )
  3927. {
  3928. craftingFilters.showCraftable = true;
  3929. craftingFilters.showMissingIngre = true;
  3930. craftingFilters.showAlreadyCrafted = false;
  3931. }
  3932.  
  3933. return craftingFilters;
  3934. }
  3935.  
  3936.  
  3937.  
  3938.  
  3939.  
  3940. event OnMutation11Triggered()
  3941. {
  3942. var min, max : SAbilityAttributeValue;
  3943. var healValue : float;
  3944. var quenEntity : W3QuenEntity;
  3945.  
  3946.  
  3947. if( IsSwimming() || IsDiving() || IsSailing() || IsUsingHorse() || IsUsingBoat() || IsUsingVehicle() || IsUsingExploration() )
  3948. {
  3949.  
  3950. ForceSetStat( BCS_Vitality, GetStatMax( BCS_Vitality ) );
  3951.  
  3952.  
  3953. theGame.MutationHUDFeedback( MFT_PlayOnce );
  3954.  
  3955.  
  3956. GCameraShake( 1.0f, , , , true, 'camera_shake_loop_lvl1_1' );
  3957. AddTimer( 'StopMutation11CamShake', 2.f );
  3958.  
  3959.  
  3960. theGame.VibrateControllerVeryHard( 2.f );
  3961.  
  3962.  
  3963. Mutation11ShockWave( true );
  3964.  
  3965.  
  3966. AddEffectDefault( EET_Mutation11Debuff, NULL, "Mutation 11 Debuff", false );
  3967. }
  3968. else
  3969. {
  3970. AddEffectDefault( EET_Mutation11Buff, this, "Mutation 11", false );
  3971. }
  3972. }
  3973.  
  3974. timer function StopMutation11CamShake( dt : float, id : int )
  3975. {
  3976. theGame.GetGameCamera().StopAnimation( 'camera_shake_loop_lvl1_1' );
  3977. }
  3978.  
  3979. private var mutation12IsOnCooldown : bool;
  3980.  
  3981. public final function AddMutation12Decoction()
  3982. {
  3983. var params : SCustomEffectParams;
  3984. var buffs : array< EEffectType >;
  3985. var existingDecoctionBuffs : array<CBaseGameplayEffect>;
  3986. var i : int;
  3987. var effectType : EEffectType;
  3988. var decoctions : array< SItemUniqueId >;
  3989. var tmpName : name;
  3990. var min, max : SAbilityAttributeValue;
  3991.  
  3992. if( mutation12IsOnCooldown )
  3993. {
  3994. return;
  3995. }
  3996.  
  3997.  
  3998. existingDecoctionBuffs = GetDrunkMutagens( "Mutation12" );
  3999. theGame.GetDefinitionsManager().GetAbilityAttributeValue( 'Mutation12', 'maxcap', min, max );
  4000. if( existingDecoctionBuffs.Size() >= min.valueAdditive )
  4001. {
  4002. return;
  4003. }
  4004.  
  4005.  
  4006. mutation12IsOnCooldown = true;
  4007. theGame.GetDefinitionsManager().GetAbilityAttributeValue( 'Mutation12', 'cooldown', min, max );
  4008. AddTimer( 'Mutation12Cooldown', CalculateAttributeValue( min ) );
  4009.  
  4010.  
  4011. decoctions = inv.GetItemsByTag( 'Mutagen' );
  4012.  
  4013.  
  4014. for( i=decoctions.Size()-1; i>=0; i-=1 )
  4015. {
  4016. inv.GetPotionItemBuffData( decoctions[i], effectType, tmpName );
  4017. if( HasBuff( effectType ) )
  4018. {
  4019. decoctions.EraseFast( i );
  4020. continue;
  4021. }
  4022. buffs.PushBack( effectType );
  4023. }
  4024.  
  4025.  
  4026. if( buffs.Size() == 0 )
  4027. {
  4028. for( i=EET_Mutagen01; i<=EET_Mutagen28; i+=1 )
  4029. {
  4030. if( !HasBuff( i ) )
  4031. {
  4032. buffs.PushBack( i );
  4033. }
  4034. }
  4035. }
  4036.  
  4037.  
  4038. buffs.Remove( EET_Mutagen16 );
  4039. buffs.Remove( EET_Mutagen24 );
  4040.  
  4041.  
  4042. if( buffs.Size() == 0 )
  4043. {
  4044. return;
  4045. }
  4046.  
  4047.  
  4048. theGame.GetDefinitionsManager().GetAbilityAttributeValue( 'Mutation12', 'duration', min, max );
  4049. params.effectType = buffs[ RandRange( buffs.Size() ) ];
  4050. params.creator = this;
  4051. params.sourceName = "Mutation12";
  4052. params.duration = min.valueAdditive;
  4053. AddEffectCustom( params );
  4054. ( ( W3Mutagen_Effect ) GetBuff( params.effectType, params.sourceName ) ).OverrideIcon( DecoctionEffectTypeToItemName( params.effectType ) );
  4055.  
  4056.  
  4057. if ( !IsEffectActive( 'invisible' ) )
  4058. {
  4059. PlayEffect( 'use_potion' );
  4060. }
  4061.  
  4062. theGame.MutationHUDFeedback( MFT_PlayOnce );
  4063. }
  4064.  
  4065. timer function Mutation12Cooldown( dt : float, id : int )
  4066. {
  4067. mutation12IsOnCooldown = false;
  4068. }
  4069.  
  4070.  
  4071. public final function HasResourcesToStartAnyMutationResearch() : bool
  4072. {
  4073. var greenPoints, redPoints, bluePoints, count : int;
  4074. var itemIDs : array< SItemUniqueId >;
  4075.  
  4076. if( levelManager.GetPointsFree( ESkillPoint ) > 0 )
  4077. {
  4078. return true;
  4079. }
  4080.  
  4081.  
  4082. count = inv.GetItemQuantityByName( 'Greater mutagen green' );
  4083. if( count > 0 )
  4084. {
  4085. itemIDs = inv.GetItemsByName( 'Greater mutagen green' );
  4086. greenPoints = inv.GetMutationResearchPoints( SC_Green, itemIDs[0] );
  4087. if( greenPoints > 0 )
  4088. {
  4089. return true;
  4090. }
  4091. }
  4092. count = inv.GetItemQuantityByName( 'Greater mutagen red' );
  4093. if( count > 0 )
  4094. {
  4095. itemIDs.Clear();
  4096. itemIDs = inv.GetItemsByName( 'Greater mutagen red' );
  4097. redPoints = inv.GetMutationResearchPoints( SC_Red, itemIDs[0] );
  4098. if( redPoints > 0 )
  4099. {
  4100. return true;
  4101. }
  4102. }
  4103. count = inv.GetItemQuantityByName( 'Greater mutagen blue' );
  4104. if( count > 0 )
  4105. {
  4106. itemIDs.Clear();
  4107. itemIDs = inv.GetItemsByName( 'Greater mutagen blue' );
  4108. bluePoints = inv.GetMutationResearchPoints( SC_Blue, itemIDs[0] );
  4109. if( bluePoints > 0 )
  4110. {
  4111. return true;
  4112. }
  4113. }
  4114.  
  4115. return false;
  4116. }
  4117.  
  4118.  
  4119. public final function Mutation11StartAnimation()
  4120. {
  4121.  
  4122. thePlayer.ActionPlaySlotAnimationAsync( 'PLAYER_SLOT', 'geralt_mutation_11', 0.2, 0.2 );
  4123.  
  4124.  
  4125. BlockAllActions( 'Mutation11', true );
  4126.  
  4127.  
  4128. loopingCameraShakeAnimName = 'camera_shake_loop_lvl1_1';
  4129. GCameraShake( 1.0f, , , , true, loopingCameraShakeAnimName );
  4130.  
  4131.  
  4132. theGame.VibrateControllerVeryHard( 15.f );
  4133.  
  4134.  
  4135. storedInteractionPriority = GetInteractionPriority();
  4136. SetInteractionPriority( IP_Max_Unpushable );
  4137. }
  4138.  
  4139. event OnAnimEvent_Mutation11ShockWave( animEventName : name, animEventType : EAnimationEventType, animInfo : SAnimationEventAnimInfo )
  4140. {
  4141. Mutation11ShockWave( false );
  4142. }
  4143.  
  4144. private final function Mutation11ShockWave( skipQuenSign : bool )
  4145. {
  4146. var action : W3DamageAction;
  4147. var ents : array< CGameplayEntity >;
  4148. var i, j : int;
  4149. var damages : array< SRawDamage >;
  4150.  
  4151.  
  4152. FindGameplayEntitiesInSphere(ents, GetWorldPosition(), 5.f, 1000, '', FLAG_OnlyAliveActors + FLAG_ExcludeTarget + FLAG_Attitude_Hostile + FLAG_Attitude_Neutral, this);
  4153.  
  4154. if( ents.Size() > 0 )
  4155. {
  4156. damages = theGame.GetDefinitionsManager().GetDamagesFromAbility( 'Mutation11' );
  4157. }
  4158.  
  4159.  
  4160. for(i=0; i<ents.Size(); i+=1)
  4161. {
  4162. action = new W3DamageAction in theGame;
  4163. action.Initialize( this, ents[i], NULL, "Mutation11", EHRT_Heavy, CPS_SpellPower, false, false, true, false );
  4164.  
  4165. for( j=0; j<damages.Size(); j+=1 )
  4166. {
  4167. action.AddDamage( damages[j].dmgType, damages[j].dmgVal );
  4168. }
  4169.  
  4170. action.SetCannotReturnDamage( true );
  4171. action.SetProcessBuffsIfNoDamage( true );
  4172. action.AddEffectInfo( EET_KnockdownTypeApplicator );
  4173. action.SetHitAnimationPlayType( EAHA_ForceYes );
  4174. action.SetCanPlayHitParticle( false );
  4175.  
  4176. theGame.damageMgr.ProcessAction( action );
  4177. delete action;
  4178. }
  4179.  
  4180.  
  4181.  
  4182.  
  4183.  
  4184. mutation11QuenEntity = ( W3QuenEntity )GetSignEntity( ST_Quen );
  4185. if( !mutation11QuenEntity )
  4186. {
  4187. mutation11QuenEntity = (W3QuenEntity)theGame.CreateEntity( GetSignTemplate( ST_Quen ), GetWorldPosition(), GetWorldRotation() );
  4188. mutation11QuenEntity.CreateAttachment( this, 'quen_sphere' );
  4189. AddTimer( 'DestroyMutation11QuenEntity', 2.f );
  4190. }
  4191. mutation11QuenEntity.PlayHitEffect( 'quen_impulse_explode', mutation11QuenEntity.GetWorldRotation() );
  4192.  
  4193. if( !skipQuenSign )
  4194. {
  4195.  
  4196. PlayEffect( 'mutation_11_second_life' );
  4197.  
  4198.  
  4199. RestoreQuen( 1000000.f, 10.f, true );
  4200. }
  4201. }
  4202.  
  4203. private var mutation11QuenEntity : W3QuenEntity;
  4204. private var storedInteractionPriority : EInteractionPriority;
  4205.  
  4206. timer function DestroyMutation11QuenEntity( dt : float, id : int )
  4207. {
  4208. if( mutation11QuenEntity )
  4209. {
  4210. mutation11QuenEntity.Destroy();
  4211. }
  4212. }
  4213.  
  4214. event OnAnimEvent_Mutation11AnimEnd( animEventName : name, animEventType : EAnimationEventType, animInfo : SAnimationEventAnimInfo )
  4215. {
  4216. if( animEventType == AET_DurationEnd )
  4217. {
  4218.  
  4219. BlockAllActions( 'Mutation11', false );
  4220.  
  4221.  
  4222. theGame.GetGameCamera().StopAnimation( 'camera_shake_loop_lvl1_1' );
  4223.  
  4224.  
  4225. theGame.StopVibrateController();
  4226.  
  4227.  
  4228. SetInteractionPriority( storedInteractionPriority );
  4229.  
  4230.  
  4231. RemoveBuff( EET_Mutation11Buff, true );
  4232. }
  4233. else if ( animEventType == AET_DurationStart || animEventType == AET_DurationStartInTheMiddle )
  4234. {
  4235.  
  4236. SetBehaviorVariable( 'AIControlled', 0.f );
  4237. }
  4238. }
  4239.  
  4240. public final function MutationSystemEnable( enable : bool )
  4241. {
  4242. ( ( W3PlayerAbilityManager ) abilityManager ).MutationSystemEnable( enable );
  4243. }
  4244.  
  4245. public final function IsMutationSystemEnabled() : bool
  4246. {
  4247. return ( ( W3PlayerAbilityManager ) abilityManager ).IsMutationSystemEnabled();
  4248. }
  4249.  
  4250. public final function GetMutation( mutationType : EPlayerMutationType ) : SMutation
  4251. {
  4252. return ( ( W3PlayerAbilityManager ) abilityManager ).GetMutation( mutationType );
  4253. }
  4254.  
  4255. public final function IsMutationActive( mutationType : EPlayerMutationType) : bool
  4256. {
  4257. var swordQuality : int;
  4258. var sword : SItemUniqueId;
  4259.  
  4260. if( GetEquippedMutationType() != mutationType )
  4261. {
  4262. return false;
  4263. }
  4264.  
  4265. switch( mutationType )
  4266. {
  4267. case EPMT_Mutation4 :
  4268. case EPMT_Mutation5 :
  4269. case EPMT_Mutation7 :
  4270. case EPMT_Mutation8 :
  4271. case EPMT_Mutation10 :
  4272. case EPMT_Mutation11 :
  4273. case EPMT_Mutation12 :
  4274. if( IsInFistFight() )
  4275. {
  4276. return false;
  4277. }
  4278. }
  4279.  
  4280. if( mutationType == EPMT_Mutation1 )
  4281. {
  4282. sword = inv.GetCurrentlyHeldSword();
  4283. swordQuality = inv.GetItemQuality( sword );
  4284.  
  4285.  
  4286. if( swordQuality < 3 )
  4287. {
  4288. return false;
  4289. }
  4290. }
  4291.  
  4292. return true;
  4293. }
  4294.  
  4295. public final function SetEquippedMutation( mutationType : EPlayerMutationType ) : bool
  4296. {
  4297. return ( ( W3PlayerAbilityManager ) abilityManager ).SetEquippedMutation( mutationType );
  4298. }
  4299.  
  4300. public final function GetEquippedMutationType() : EPlayerMutationType
  4301. {
  4302. return ( ( W3PlayerAbilityManager ) abilityManager ).GetEquippedMutationType();
  4303. }
  4304.  
  4305. public final function CanEquipMutation(mutationType : EPlayerMutationType) : bool
  4306. {
  4307. return ( ( W3PlayerAbilityManager ) abilityManager ).CanEquipMutation( mutationType );
  4308. }
  4309.  
  4310. public final function CanResearchMutation( mutationType : EPlayerMutationType ) : bool
  4311. {
  4312. return ( ( W3PlayerAbilityManager ) abilityManager ).CanResearchMutation( mutationType );
  4313. }
  4314.  
  4315. public final function IsMutationResearched(mutationType : EPlayerMutationType) : bool
  4316. {
  4317. return ( ( W3PlayerAbilityManager ) abilityManager ).IsMutationResearched( mutationType );
  4318. }
  4319.  
  4320. public final function GetMutationResearchProgress(mutationType : EPlayerMutationType) : int
  4321. {
  4322. return ( ( W3PlayerAbilityManager ) abilityManager ).GetMutationResearchProgress( mutationType );
  4323. }
  4324.  
  4325. public final function GetMasterMutationStage() : int
  4326. {
  4327. return ( ( W3PlayerAbilityManager ) abilityManager ).GetMasterMutationStage();
  4328. }
  4329.  
  4330. public final function MutationResearchWithSkillPoints(mutation : EPlayerMutationType, skillPoints : int) : bool
  4331. {
  4332. return ( ( W3PlayerAbilityManager ) abilityManager ).MutationResearchWithSkillPoints( mutation, skillPoints );
  4333. }
  4334.  
  4335. public final function MutationResearchWithItem(mutation : EPlayerMutationType, item : SItemUniqueId, optional count: int) : bool
  4336. {
  4337. return ( ( W3PlayerAbilityManager ) abilityManager ).MutationResearchWithItem( mutation, item, count );
  4338. }
  4339.  
  4340. public final function GetMutationLocalizedName( mutationType : EPlayerMutationType ) : string
  4341. {
  4342. var pam : W3PlayerAbilityManager;
  4343. var locKey : name;
  4344.  
  4345. pam = (W3PlayerAbilityManager)GetWitcherPlayer().abilityManager;
  4346. locKey = pam.GetMutationNameLocalizationKey( mutationType );
  4347.  
  4348. return GetLocStringByKeyExt( locKey );
  4349. }
  4350.  
  4351. public final function GetMutationLocalizedDescription( mutationType : EPlayerMutationType ) : string
  4352. {
  4353. var pam : W3PlayerAbilityManager;
  4354. var locKey : name;
  4355. var arrStr : array< string >;
  4356. var dm : CDefinitionsManagerAccessor;
  4357. var min, max, sp : SAbilityAttributeValue;
  4358. var tmp, tmp2, tox, critBonusDamage, val : float;
  4359. var stats, stats2 : SPlayerOffenseStats;
  4360. var buffPerc, exampleEnemyCount, debuffPerc : int;
  4361.  
  4362. pam = (W3PlayerAbilityManager)GetWitcherPlayer().abilityManager;
  4363. locKey = pam.GetMutationDescriptionLocalizationKey( mutationType );
  4364. dm = theGame.GetDefinitionsManager();
  4365.  
  4366. switch( mutationType )
  4367. {
  4368. case EPMT_Mutation1 :
  4369. dm.GetAbilityAttributeValue('Mutation1', 'dmg_bonus_factor', min, max);
  4370. arrStr.PushBack( NoTrailZeros( RoundMath( 100 * min.valueAdditive ) ) );
  4371. break;
  4372.  
  4373. case EPMT_Mutation2 :
  4374. sp = GetPowerStatValue( CPS_SpellPower );
  4375.  
  4376.  
  4377. dm.GetAbilityAttributeValue( 'Mutation2', 'crit_chance_factor', min, max );
  4378. arrStr.PushBack( NoTrailZeros( RoundMath( 100 * ( min.valueAdditive + sp.valueMultiplicative * min.valueMultiplicative ) ) ) );
  4379.  
  4380.  
  4381. dm.GetAbilityAttributeValue( 'Mutation2', 'crit_damage_factor', min, max );
  4382. critBonusDamage = sp.valueMultiplicative * min.valueMultiplicative;
  4383.  
  4384. arrStr.PushBack( NoTrailZeros( RoundMath( 100 * critBonusDamage ) ) );
  4385. break;
  4386.  
  4387. case EPMT_Mutation3 :
  4388.  
  4389. dm.GetAbilityAttributeValue( 'Mutation3', 'attack_power', min, max );
  4390. tmp = min.valueMultiplicative;
  4391. arrStr.PushBack( NoTrailZeros( RoundMath( 100 * tmp ) ) );
  4392.  
  4393.  
  4394. dm.GetAbilityAttributeValue( 'Mutation3', 'maxcap', min, max );
  4395. arrStr.PushBack( NoTrailZeros( RoundMath( 100 * tmp * min.valueAdditive ) ) );
  4396. break;
  4397.  
  4398. case EPMT_Mutation4 :
  4399.  
  4400. dm.GetAbilityAttributeValue( 'AcidEffect', 'DirectDamage', min, max );
  4401. tmp2 = 100 * min.valueAdditive;
  4402. dm.GetAbilityAttributeValue( 'AcidEffect', 'duration', min, max );
  4403. tmp2 *= min.valueAdditive;
  4404. arrStr.PushBack( NoTrailZeros( tmp2 ) );
  4405.  
  4406.  
  4407. tox = GetStat( BCS_Toxicity );
  4408. if( tox > 0 )
  4409. {
  4410. tmp = RoundMath( tmp2 * tox );
  4411. }
  4412. else
  4413. {
  4414. tmp = tmp2;
  4415. }
  4416. arrStr.PushBack( NoTrailZeros( tmp ) );
  4417.  
  4418.  
  4419. tox = GetStatMax( BCS_Toxicity );
  4420. tmp = RoundMath( tmp2 * tox );
  4421. arrStr.PushBack( NoTrailZeros( tmp ) );
  4422. break;
  4423.  
  4424. case EPMT_Mutation5 :
  4425.  
  4426. dm.GetAbilityAttributeValue( 'Mutation5', 'mut5_dmg_red_perc', min, max );
  4427. tmp = min.valueAdditive;
  4428. arrStr.PushBack( NoTrailZeros( 100 * tmp ) );
  4429.  
  4430.  
  4431. arrStr.PushBack( NoTrailZeros( 100 * tmp * 3 ) );
  4432.  
  4433. break;
  4434.  
  4435. case EPMT_Mutation6 :
  4436.  
  4437. theGame.GetDefinitionsManager().GetAbilityAttributeValue( 'Mutation6', 'full_freeze_chance', min, max );
  4438. arrStr.PushBack( NoTrailZeros( 100 * min.valueMultiplicative ) );
  4439.  
  4440.  
  4441. theGame.GetDefinitionsManager().GetAbilityAttributeValue( 'Mutation6', 'ForceDamage', min, max );
  4442. sp = GetTotalSignSpellPower( S_Magic_1 );
  4443. val = sp.valueAdditive + sp.valueMultiplicative * ( sp.valueBase + min.valueAdditive );
  4444. arrStr.PushBack( NoTrailZeros( RoundMath( val ) ) );
  4445.  
  4446. break;
  4447.  
  4448. case EPMT_Mutation7 :
  4449.  
  4450. dm.GetAbilityAttributeValue( 'Mutation7Buff', 'attack_power', min, max );
  4451. buffPerc = (int) ( 100 * min.valueMultiplicative );
  4452. arrStr.PushBack( NoTrailZeros( buffPerc ) );
  4453.  
  4454.  
  4455. dm.GetAbilityAttributeValue( 'Mutation7BuffEffect', 'duration', min, max );
  4456. arrStr.PushBack( NoTrailZeros( min.valueAdditive ) );
  4457.  
  4458.  
  4459. exampleEnemyCount = 11;
  4460. arrStr.PushBack( exampleEnemyCount );
  4461.  
  4462.  
  4463. arrStr.PushBack( buffPerc * ( exampleEnemyCount -1 ) );
  4464.  
  4465.  
  4466. dm.GetAbilityAttributeValue( 'Mutation7Debuff', 'attack_power', min, max );
  4467. debuffPerc = (int) ( - 100 * min.valueMultiplicative );
  4468. arrStr.PushBack( NoTrailZeros( debuffPerc ) );
  4469.  
  4470.  
  4471. theGame.GetDefinitionsManager().GetAbilityAttributeValue( 'Mutation7Debuff', 'minCapStacks', min, max );
  4472. arrStr.PushBack( NoTrailZeros( debuffPerc * min.valueAdditive ) );
  4473.  
  4474.  
  4475. dm.GetAbilityAttributeValue( 'Mutation7DebuffEffect', 'duration', min, max );
  4476. arrStr.PushBack( NoTrailZeros( min.valueAdditive ) );
  4477.  
  4478. break;
  4479.  
  4480. case EPMT_Mutation8 :
  4481.  
  4482. dm.GetAbilityAttributeValue( 'Mutation8', 'dmg_bonus', min, max );
  4483. arrStr.PushBack( NoTrailZeros( 100 * min.valueMultiplicative ) );
  4484.  
  4485.  
  4486. dm.GetAbilityAttributeValue( 'Mutation8', 'hp_perc_trigger', min, max );
  4487. arrStr.PushBack( NoTrailZeros( 100 * min.valueMultiplicative ) );
  4488.  
  4489. break;
  4490.  
  4491. case EPMT_Mutation9 :
  4492.  
  4493.  
  4494.  
  4495.  
  4496. stats = GetOffenseStatsList( 1 );
  4497. arrStr.PushBack( NoTrailZeros( RoundMath( stats.crossbowSteelDmg ) ) );
  4498.  
  4499.  
  4500. stats2 = GetOffenseStatsList( 2 );
  4501. arrStr.PushBack( NoTrailZeros( RoundMath( stats2.crossbowSteelDmg ) ) );
  4502.  
  4503.  
  4504. dm.GetAbilityAttributeValue( 'Mutation9', 'critical_hit_chance', min, max );
  4505. arrStr.PushBack( NoTrailZeros( 100 * min.valueMultiplicative ) );
  4506.  
  4507.  
  4508. dm.GetAbilityAttributeValue( 'Mutation9', 'health_reduction', min, max );
  4509. arrStr.PushBack( NoTrailZeros( 100 * min.valueMultiplicative ) );
  4510.  
  4511. break;
  4512.  
  4513. case EPMT_Mutation10 :
  4514.  
  4515. dm.GetAbilityAttributeValue( 'Mutation10Effect', 'mutation10_stat_boost', min, max );
  4516. arrStr.PushBack( NoTrailZeros( 100 * min.valueMultiplicative ) );
  4517.  
  4518.  
  4519. arrStr.PushBack( NoTrailZeros( 100 * min.valueMultiplicative * GetStatMax( BCS_Toxicity ) ) );
  4520.  
  4521. break;
  4522.  
  4523. case EPMT_Mutation11 :
  4524.  
  4525. arrStr.PushBack( 100 );
  4526.  
  4527.  
  4528. dm.GetAbilityAttributeValue( 'Mutation11DebuffEffect', 'duration', min, max);
  4529. arrStr.PushBack( NoTrailZeros( min.valueAdditive ) );
  4530. break;
  4531.  
  4532. case EPMT_Mutation12 :
  4533.  
  4534. dm.GetAbilityAttributeValue( 'Mutation12', 'duration', min, max );
  4535. arrStr.PushBack( NoTrailZeros( min.valueAdditive ) );
  4536.  
  4537.  
  4538. dm.GetAbilityAttributeValue( 'Mutation12', 'maxcap', min, max );
  4539. arrStr.PushBack( NoTrailZeros( min.valueAdditive ) );
  4540. break;
  4541.  
  4542. case EPMT_MutationMaster :
  4543.  
  4544. arrStr.PushBack( "4" );
  4545.  
  4546. break;
  4547. }
  4548.  
  4549. return GetLocStringByKeyExtWithParams( locKey, , , arrStr );
  4550. }
  4551.  
  4552. public final function ApplyMutation10StatBoost( out statValue : SAbilityAttributeValue )
  4553. {
  4554. var attValue : SAbilityAttributeValue;
  4555. var currToxicity : float;
  4556.  
  4557. if( IsMutationActive( EPMT_Mutation10 ) )
  4558. {
  4559. currToxicity = GetStat( BCS_Toxicity );
  4560. if( currToxicity > 0.f )
  4561. {
  4562. attValue = GetAttributeValue( 'mutation10_stat_boost' );
  4563. currToxicity *= attValue.valueMultiplicative;
  4564. statValue.valueMultiplicative += currToxicity;
  4565. }
  4566. }
  4567. }
  4568.  
  4569.  
  4570.  
  4571.  
  4572.  
  4573.  
  4574.  
  4575. public final function IsBookRead( bookName : name ):bool
  4576. {
  4577. return booksRead.Contains( bookName );
  4578. }
  4579.  
  4580. public final function AddReadBook( bookName : name ):void
  4581. {
  4582. if( !booksRead.Contains( bookName ) )
  4583. {
  4584. booksRead.PushBack( bookName );
  4585. }
  4586. }
  4587.  
  4588. public final function RemoveReadBook( bookName : name ):void
  4589. {
  4590. var idx : int = booksRead.FindFirst( bookName );
  4591.  
  4592. if( idx > -1 )
  4593. {
  4594. booksRead.Erase( idx );
  4595. }
  4596. }
  4597.  
  4598.  
  4599.  
  4600.  
  4601.  
  4602.  
  4603.  
  4604. public final function GetMutagenBuffs() : array< W3Mutagen_Effect >
  4605. {
  4606. var null : array< W3Mutagen_Effect >;
  4607.  
  4608. if(effectManager)
  4609. {
  4610. return effectManager.GetMutagenBuffs();
  4611. }
  4612.  
  4613. return null;
  4614. }
  4615.  
  4616. public function GetAlchemyRecipes() : array<name>
  4617. {
  4618. return alchemyRecipes;
  4619. }
  4620.  
  4621. public function CanLearnAlchemyRecipe(recipeName : name) : bool
  4622. {
  4623. var dm : CDefinitionsManagerAccessor;
  4624. var recipeNode : SCustomNode;
  4625. var i, tmpInt : int;
  4626. var tmpName : name;
  4627.  
  4628. dm = theGame.GetDefinitionsManager();
  4629. if ( dm.GetSubNodeByAttributeValueAsCName( recipeNode, 'alchemy_recipes', 'name_name', recipeName ) )
  4630. {
  4631. return true;
  4632.  
  4633. }
  4634.  
  4635. return false;
  4636. }
  4637.  
  4638. private final function RemoveAlchemyRecipe(recipeName : name)
  4639. {
  4640. alchemyRecipes.Remove(recipeName);
  4641. }
  4642.  
  4643. private final function RemoveAllAlchemyRecipes()
  4644. {
  4645. alchemyRecipes.Clear();
  4646. }
  4647.  
  4648.  
  4649. function AddAlchemyRecipe(nam : name, optional isSilent : bool, optional skipTutorialUpdate : bool) : bool
  4650. {
  4651. var i, potions, bombs : int;
  4652. var found : bool;
  4653. var m_alchemyManager : W3AlchemyManager;
  4654. var recipe : SAlchemyRecipe;
  4655. var knownBombTypes : array<string>;
  4656. var strRecipeName, recipeNameWithoutLevel : string;
  4657.  
  4658. if(!IsAlchemyRecipe(nam))
  4659. return false;
  4660.  
  4661. found = false;
  4662. for(i=0; i<alchemyRecipes.Size(); i+=1)
  4663. {
  4664. if(alchemyRecipes[i] == nam)
  4665. return false;
  4666.  
  4667.  
  4668. if(StrCmp(alchemyRecipes[i],nam) > 0)
  4669. {
  4670. alchemyRecipes.Insert(i,nam);
  4671. found = true;
  4672. AddAlchemyHudNotification(nam,isSilent);
  4673. break;
  4674. }
  4675. }
  4676.  
  4677. if(!found)
  4678. {
  4679. alchemyRecipes.PushBack(nam);
  4680. AddAlchemyHudNotification(nam,isSilent);
  4681. }
  4682.  
  4683. m_alchemyManager = new W3AlchemyManager in this;
  4684. m_alchemyManager.Init(alchemyRecipes);
  4685. m_alchemyManager.GetRecipe(nam, recipe);
  4686.  
  4687.  
  4688. if(CanUseSkill(S_Alchemy_s18))
  4689. {
  4690. if ((recipe.cookedItemType != EACIT_Bolt) && (recipe.cookedItemType != EACIT_Undefined) && (recipe.cookedItemType != EACIT_Dye) && (recipe.level <= GetSkillLevel(S_Alchemy_s18)))
  4691. AddAbility(SkillEnumToName(S_Alchemy_s18), true);
  4692.  
  4693. }
  4694.  
  4695.  
  4696. if(recipe.cookedItemType == EACIT_Bomb)
  4697. {
  4698. bombs = 0;
  4699. for(i=0; i<alchemyRecipes.Size(); i+=1)
  4700. {
  4701. m_alchemyManager.GetRecipe(alchemyRecipes[i], recipe);
  4702.  
  4703.  
  4704. if(recipe.cookedItemType == EACIT_Bomb)
  4705. {
  4706. strRecipeName = NameToString(alchemyRecipes[i]);
  4707. recipeNameWithoutLevel = StrLeft(strRecipeName, StrLen(strRecipeName)-2);
  4708. if(!knownBombTypes.Contains(recipeNameWithoutLevel))
  4709. {
  4710. bombs += 1;
  4711. knownBombTypes.PushBack(recipeNameWithoutLevel);
  4712. }
  4713. }
  4714. }
  4715.  
  4716. theGame.GetGamerProfile().SetStat(ES_KnownBombRecipes, bombs);
  4717. }
  4718.  
  4719. else if(recipe.cookedItemType == EACIT_Potion || recipe.cookedItemType == EACIT_MutagenPotion || recipe.cookedItemType == EACIT_Alcohol || recipe.cookedItemType == EACIT_Quest)
  4720. {
  4721. potions = 0;
  4722. for(i=0; i<alchemyRecipes.Size(); i+=1)
  4723. {
  4724. m_alchemyManager.GetRecipe(alchemyRecipes[i], recipe);
  4725.  
  4726.  
  4727. if(recipe.cookedItemType == EACIT_Potion || recipe.cookedItemType == EACIT_MutagenPotion || recipe.cookedItemType == EACIT_Alcohol || recipe.cookedItemType == EACIT_Quest)
  4728. {
  4729. potions += 1;
  4730. }
  4731. }
  4732. theGame.GetGamerProfile().SetStat(ES_KnownPotionRecipes, potions);
  4733. }
  4734.  
  4735. theGame.GetGlobalEventsManager().OnScriptedEvent( SEC_AlchemyRecipe );
  4736.  
  4737. return true;
  4738. }
  4739.  
  4740. public function GetExpandedAlchemyCategories() : array< name >
  4741. {
  4742. return expandedAlchemyCategories;
  4743. }
  4744.  
  4745. public function AddExpandedAlchemyCategory( category : name )
  4746. {
  4747. if ( IsNameValid( category ) )
  4748. {
  4749. ArrayOfNamesPushBackUnique( expandedAlchemyCategories, category );
  4750. }
  4751. }
  4752.  
  4753. public function RemoveExpandedAlchemyCategory( category : name )
  4754. {
  4755. if ( IsNameValid( category ) )
  4756. {
  4757. expandedAlchemyCategories.Remove( category );
  4758. }
  4759. }
  4760.  
  4761. public function SetAlchemyFilters(showHasIngre : bool, showMissingIngre : bool, showAlreadyCrafted : bool )
  4762. {
  4763. alchemyFilters.showCraftable = showHasIngre;
  4764. alchemyFilters.showMissingIngre = showMissingIngre;
  4765. alchemyFilters.showAlreadyCrafted = showAlreadyCrafted;
  4766. }
  4767.  
  4768. public function GetAlchemyFilters() : SCraftingFilters
  4769. {
  4770.  
  4771. if ( alchemyFilters.showCraftable == false && alchemyFilters.showMissingIngre == false && alchemyFilters.showAlreadyCrafted == false )
  4772. {
  4773. alchemyFilters.showCraftable = true;
  4774. alchemyFilters.showMissingIngre = true;
  4775. alchemyFilters.showAlreadyCrafted = false;
  4776. }
  4777.  
  4778. return alchemyFilters;
  4779. }
  4780.  
  4781.  
  4782.  
  4783.  
  4784.  
  4785.  
  4786.  
  4787. public function GetExpandedBestiaryCategories() : array< name >
  4788. {
  4789. return expandedBestiaryCategories;
  4790. }
  4791.  
  4792. public function AddExpandedBestiaryCategory( category : name )
  4793. {
  4794. if ( IsNameValid( category ) )
  4795. {
  4796. ArrayOfNamesPushBackUnique( expandedBestiaryCategories, category );
  4797. }
  4798. }
  4799.  
  4800. public function RemoveExpandedBestiaryCategory( category : name )
  4801. {
  4802. if ( IsNameValid( category ) )
  4803. {
  4804. expandedBestiaryCategories.Remove( category );
  4805. }
  4806. }
  4807.  
  4808.  
  4809.  
  4810.  
  4811.  
  4812.  
  4813.  
  4814. public function GetDisplayHeavyAttackIndicator() : bool
  4815. {
  4816. return bDispalyHeavyAttackIndicator;
  4817. }
  4818.  
  4819. public function SetDisplayHeavyAttackIndicator( val : bool )
  4820. {
  4821. bDispalyHeavyAttackIndicator = val;
  4822. }
  4823.  
  4824. public function GetDisplayHeavyAttackFirstLevelTimer() : bool
  4825. {
  4826. return bDisplayHeavyAttackFirstLevelTimer;
  4827. }
  4828.  
  4829. public function SetDisplayHeavyAttackFirstLevelTimer( val : bool )
  4830. {
  4831. bDisplayHeavyAttackFirstLevelTimer = val;
  4832. }
  4833.  
  4834.  
  4835.  
  4836.  
  4837.  
  4838.  
  4839.  
  4840. public function SelectQuickslotItem( slot : EEquipmentSlots )
  4841. {
  4842. var item : SItemUniqueId;
  4843.  
  4844. GetItemEquippedOnSlot(slot, item);
  4845. selectedItemId = item;
  4846. }
  4847.  
  4848.  
  4849.  
  4850.  
  4851.  
  4852.  
  4853.  
  4854. public function GetMedallion() : W3MedallionController
  4855. {
  4856. if ( !medallionController )
  4857. {
  4858. medallionController = new W3MedallionController in this;
  4859. }
  4860. return medallionController;
  4861. }
  4862.  
  4863.  
  4864. public final function HighlightObjects(range : float, optional highlightTime : float )
  4865. {
  4866. var ents : array<CGameplayEntity>;
  4867. var i : int;
  4868.  
  4869. FindGameplayEntitiesInSphere(ents, GetWorldPosition(), range, 100, 'HighlightedByMedalionFX', FLAG_ExcludePlayer);
  4870.  
  4871. if(highlightTime == 0)
  4872. highlightTime = 30;
  4873.  
  4874. for(i=0; i<ents.Size(); i+=1)
  4875. {
  4876. if(!ents[i].IsHighlighted())
  4877. {
  4878. ents[i].SetHighlighted( true );
  4879. ents[i].PlayEffectSingle( 'medalion_detection_fx' );
  4880. ents[i].AddTimer( 'MedallionEffectOff', highlightTime );
  4881. }
  4882. }
  4883. }
  4884.  
  4885.  
  4886. public final function HighlightEnemies(range : float, optional highlightTime : float )
  4887. {
  4888. var ents : array<CGameplayEntity>;
  4889. var i : int;
  4890. var catComponent : CGameplayEffectsComponent;
  4891.  
  4892. FindGameplayEntitiesInSphere(ents, GetWorldPosition(), range, 100, , FLAG_ExcludePlayer + FLAG_OnlyAliveActors);
  4893.  
  4894. if(highlightTime == 0)
  4895. highlightTime = 5;
  4896.  
  4897. for(i=0; i<ents.Size(); i+=1)
  4898. {
  4899. if(IsRequiredAttitudeBetween(this, ents[i], true))
  4900. {
  4901. catComponent = GetGameplayEffectsComponent(ents[i]);
  4902. if(catComponent)
  4903. {
  4904. catComponent.SetGameplayEffectFlag(EGEF_CatViewHiglight, true);
  4905. ents[i].AddTimer( 'EnemyHighlightOff', highlightTime, , , , , true );
  4906. }
  4907. }
  4908. }
  4909. }
  4910.  
  4911. function SpawnMedallionEntity()
  4912. {
  4913. var rot : EulerAngles;
  4914. var spawnedMedallion : CEntity;
  4915.  
  4916. spawnedMedallion = theGame.GetEntityByTag( 'new_Witcher_medallion_FX' );
  4917.  
  4918. if ( !spawnedMedallion )
  4919. theGame.CreateEntity( medallionEntity, GetWorldPosition(), rot, true, false );
  4920. }
  4921.  
  4922.  
  4923.  
  4924.  
  4925.  
  4926.  
  4927.  
  4928.  
  4929.  
  4930. public final function InterruptCombatFocusMode()
  4931. {
  4932. if( this.GetCurrentStateName() == 'CombatFocusMode_SelectSpot' )
  4933. {
  4934. SetCanPlayHitAnim( true );
  4935. PopState();
  4936. }
  4937. }
  4938.  
  4939. public final function IsInDarkPlace() : bool
  4940. {
  4941. var envs : array< string >;
  4942.  
  4943. if( FactsQuerySum( "tut_in_dark_place" ) )
  4944. {
  4945. return true;
  4946. }
  4947.  
  4948. GetActiveAreaEnvironmentDefinitions( envs );
  4949.  
  4950. if( envs.Contains( 'env_novigrad_cave' ) || envs.Contains( 'cave_catacombs' ) )
  4951. {
  4952. return true;
  4953. }
  4954.  
  4955. return false;
  4956. }
  4957.  
  4958.  
  4959.  
  4960.  
  4961.  
  4962. private saved var selectedPotionSlotUpper, selectedPotionSlotLower : EEquipmentSlots;
  4963. private var potionDoubleTapTimerRunning, potionDoubleTapSlotIsUpper : bool;
  4964. default selectedPotionSlotUpper = EES_Potion1;
  4965. default selectedPotionSlotLower = EES_Potion2;
  4966. default potionDoubleTapTimerRunning = false;
  4967.  
  4968. public final function SetPotionDoubleTapRunning(b : bool, optional isUpperSlot : bool)
  4969. {
  4970. if(b)
  4971. {
  4972. AddTimer('PotionDoubleTap', 0.3);
  4973. }
  4974. else
  4975. {
  4976. RemoveTimer('PotionDoubleTap');
  4977. }
  4978.  
  4979. potionDoubleTapTimerRunning = b;
  4980. potionDoubleTapSlotIsUpper = isUpperSlot;
  4981. }
  4982.  
  4983. public final function IsPotionDoubleTapRunning() : bool
  4984. {
  4985. return potionDoubleTapTimerRunning;
  4986. }
  4987.  
  4988. timer function PotionDoubleTap(dt : float, id : int)
  4989. {
  4990. potionDoubleTapTimerRunning = false;
  4991. OnPotionDrinkInput(potionDoubleTapSlotIsUpper);
  4992. }
  4993.  
  4994. public final function OnPotionDrinkInput(fromUpperSlot : bool)
  4995. {
  4996. var slot : EEquipmentSlots;
  4997.  
  4998. if(fromUpperSlot)
  4999. slot = GetSelectedPotionSlotUpper();
  5000. else
  5001. slot = GetSelectedPotionSlotLower();
  5002.  
  5003. DrinkPotionFromSlot(slot);
  5004. }
  5005.  
  5006. public final function OnPotionDrinkKeyboardsInput(slot : EEquipmentSlots)
  5007. {
  5008. DrinkPotionFromSlot(slot);
  5009. }
  5010.  
  5011. private function DrinkPotionFromSlot(slot : EEquipmentSlots):void
  5012. {
  5013. var item : SItemUniqueId;
  5014. var hud : CR4ScriptedHud;
  5015. var module : CR4HudModuleItemInfo;
  5016.  
  5017. GetItemEquippedOnSlot(slot, item);
  5018. if(inv.ItemHasTag(item, 'Edibles'))
  5019. {
  5020. ConsumeItem( item );
  5021. }
  5022. else
  5023. {
  5024. if (ToxicityLowEnoughToDrinkPotion(slot))
  5025. {
  5026. DrinkPreparedPotion(slot);
  5027. }
  5028. else
  5029. {
  5030. SendToxicityTooHighMessage();
  5031. }
  5032. }
  5033.  
  5034. hud = (CR4ScriptedHud)theGame.GetHud();
  5035. if ( hud )
  5036. {
  5037. module = (CR4HudModuleItemInfo)hud.GetHudModule("ItemInfoModule");
  5038. if( module )
  5039. {
  5040. module.ForceShowElement();
  5041. }
  5042. }
  5043. }
  5044.  
  5045. private function SendToxicityTooHighMessage()
  5046. {
  5047. var messageText : string;
  5048. var language : string;
  5049. var audioLanguage : string;
  5050.  
  5051. if (GetHudMessagesSize() < 2)
  5052. {
  5053. messageText = GetLocStringByKeyExt("menu_cannot_perform_action_now") + " " + GetLocStringByKeyExt("panel_common_statistics_tooltip_current_toxicity");
  5054.  
  5055. theGame.GetGameLanguageName(audioLanguage,language);
  5056. if (language == "AR")
  5057. {
  5058. messageText += (int)(abilityManager.GetStat(BCS_Toxicity, false)) + " / " + (int)(abilityManager.GetStatMax(BCS_Toxicity)) + " :";
  5059. }
  5060. else
  5061. {
  5062. messageText += ": " + (int)(abilityManager.GetStat(BCS_Toxicity, false)) + " / " + (int)(abilityManager.GetStatMax(BCS_Toxicity));
  5063. }
  5064.  
  5065. DisplayHudMessage(messageText);
  5066. }
  5067. theSound.SoundEvent("gui_global_denied");
  5068. }
  5069.  
  5070. public final function GetSelectedPotionSlotUpper() : EEquipmentSlots
  5071. {
  5072. return selectedPotionSlotUpper;
  5073. }
  5074.  
  5075. public final function GetSelectedPotionSlotLower() : EEquipmentSlots
  5076. {
  5077. return selectedPotionSlotLower;
  5078. }
  5079.  
  5080.  
  5081. public final function FlipSelectedPotion(isUpperSlot : bool) : bool
  5082. {
  5083. if(isUpperSlot)
  5084. {
  5085. if(selectedPotionSlotUpper == EES_Potion1)
  5086. {
  5087.  
  5088. if(IsAnyItemEquippedOnSlot(EES_Potion3))
  5089. {
  5090. selectedPotionSlotUpper = EES_Potion3;
  5091. return true;
  5092. }
  5093. else if(CheckRadialMenu())
  5094. {
  5095. PotionSelectionPopup( EISPM_RadialMenuSlot3 );
  5096. return true;
  5097. }
  5098.  
  5099. }
  5100. else if(selectedPotionSlotUpper == EES_Potion3)
  5101. {
  5102.  
  5103. if(IsAnyItemEquippedOnSlot(EES_Potion1))
  5104. {
  5105. selectedPotionSlotUpper = EES_Potion1;
  5106. return true;
  5107. }
  5108. else if(CheckRadialMenu())
  5109. {
  5110. PotionSelectionPopup( EISPM_RadialMenuSlot1 );
  5111. return true;
  5112. }
  5113.  
  5114. }
  5115. }
  5116. else
  5117. {
  5118. if(selectedPotionSlotLower == EES_Potion2)
  5119. {
  5120.  
  5121. if(IsAnyItemEquippedOnSlot(EES_Potion4))
  5122. {
  5123. selectedPotionSlotLower = EES_Potion4;
  5124. return true;
  5125. }
  5126. else if(CheckRadialMenu())
  5127. {
  5128. PotionSelectionPopup( EISPM_RadialMenuSlot4 );
  5129. }
  5130.  
  5131. }
  5132. else if(selectedPotionSlotLower == EES_Potion4)
  5133. {
  5134.  
  5135. if(IsAnyItemEquippedOnSlot(EES_Potion2))
  5136. {
  5137. selectedPotionSlotLower = EES_Potion2;
  5138. return true;
  5139. }
  5140. else if(CheckRadialMenu())
  5141. {
  5142. PotionSelectionPopup( EISPM_RadialMenuSlot2 );
  5143. }
  5144.  
  5145. }
  5146. }
  5147.  
  5148. return false;
  5149. }
  5150.  
  5151. public final function AddBombThrowDelay( bombId : SItemUniqueId )
  5152. {
  5153. var slot : EEquipmentSlots;
  5154.  
  5155. slot = GetItemSlot( bombId );
  5156.  
  5157. if( slot == EES_Unused )
  5158. {
  5159. return;
  5160. }
  5161.  
  5162. if( slot == EES_Petard1 || slot == EES_Quickslot1 )
  5163. {
  5164. remainingBombThrowDelaySlot1 = theGame.params.BOMB_THROW_DELAY;
  5165. AddTimer( 'BombDelay', 0.0f, true );
  5166. }
  5167. else if( slot == EES_Petard2 || slot == EES_Quickslot2 )
  5168. {
  5169. remainingBombThrowDelaySlot2 = theGame.params.BOMB_THROW_DELAY;
  5170. AddTimer( 'BombDelay', 0.0f, true );
  5171. }
  5172. else
  5173. {
  5174. return;
  5175. }
  5176. }
  5177.  
  5178. public final function GetBombDelay( slot : EEquipmentSlots ) : float
  5179. {
  5180. if( slot == EES_Petard1 || slot == EES_Quickslot1 )
  5181. {
  5182. return remainingBombThrowDelaySlot1;
  5183. }
  5184. else if( slot == EES_Petard2 || slot == EES_Quickslot2 )
  5185. {
  5186. return remainingBombThrowDelaySlot2;
  5187. }
  5188.  
  5189. return 0;
  5190. }
  5191.  
  5192. timer function BombDelay( dt : float, id : int )
  5193. {
  5194. remainingBombThrowDelaySlot1 = MaxF( 0.f , remainingBombThrowDelaySlot1 - dt );
  5195. remainingBombThrowDelaySlot2 = MaxF( 0.f , remainingBombThrowDelaySlot2 - dt );
  5196.  
  5197. if( remainingBombThrowDelaySlot1 <= 0.0f && remainingBombThrowDelaySlot2 <= 0.0f )
  5198. {
  5199. RemoveTimer('BombDelay');
  5200. }
  5201. }
  5202.  
  5203. public function ResetCharacterDev()
  5204. {
  5205.  
  5206. UnequipItemFromSlot(EES_SkillMutagen1);
  5207. UnequipItemFromSlot(EES_SkillMutagen2);
  5208. UnequipItemFromSlot(EES_SkillMutagen3);
  5209. UnequipItemFromSlot(EES_SkillMutagen4);
  5210.  
  5211. levelManager.ResetCharacterDev();
  5212. ((W3PlayerAbilityManager)abilityManager).ResetCharacterDev();
  5213. }
  5214.  
  5215. public final function ResetMutationsDev()
  5216. {
  5217. levelManager.ResetMutationsDev();
  5218. ((W3PlayerAbilityManager)abilityManager).ResetMutationsDev();
  5219. }
  5220.  
  5221. public final function GetHeldSword() : SItemUniqueId
  5222. {
  5223. var i : int;
  5224. var weapons : array< SItemUniqueId >;
  5225.  
  5226. weapons = inv.GetHeldWeapons();
  5227. for( i=0; i<weapons.Size(); i+=1 )
  5228. {
  5229. if( inv.IsItemSilverSwordUsableByPlayer( weapons[i] ) || inv.IsItemSteelSwordUsableByPlayer( weapons[i] ) )
  5230. {
  5231. return weapons[i];
  5232. }
  5233. }
  5234.  
  5235. return GetInvalidUniqueId();
  5236. }
  5237.  
  5238. public function ConsumeItem( itemId : SItemUniqueId ) : bool
  5239. {
  5240. var itemName : name;
  5241. var removedItem, willRemoveItem : bool;
  5242. var edibles : array<SItemUniqueId>;
  5243. var toSlot : EEquipmentSlots;
  5244. var i : int;
  5245. var equippedNewEdible : bool;
  5246.  
  5247. var newEdibleId : int;
  5248. var isLevel1, isLevel2 : bool;
  5249. var abilities : array<name>;
  5250.  
  5251. itemName = inv.GetItemName( itemId );
  5252.  
  5253. if (itemName == 'q111_imlerith_acorn' )
  5254. {
  5255. AddPoints(ESkillPoint, 2, true);
  5256. removedItem = inv.RemoveItem( itemId, 1 );
  5257. theGame.GetGuiManager().ShowNotification( GetLocStringByKeyExt("panel_character_popup_title_buy_skill") + "<br>" + GetLocStringByKeyExt("panel_character_availablepoints") + " +2");
  5258. theSound.SoundEvent("gui_character_buy_skill");
  5259. }
  5260. else if ( itemName == 'Clearing Potion' )
  5261. {
  5262. ResetCharacterDev();
  5263. removedItem = inv.RemoveItem( itemId, 1 );
  5264. theGame.GetGuiManager().ShowNotification( GetLocStringByKeyExt("panel_character_popup_character_cleared") );
  5265. theSound.SoundEvent("gui_character_synergy_effect");
  5266. }
  5267. else if ( itemName == 'Restoring Potion' )
  5268. {
  5269. ResetMutationsDev();
  5270. removedItem = inv.RemoveItem( itemId, 1 );
  5271. theGame.GetGuiManager().ShowNotification( GetLocStringByKeyExt("panel_character_popup_character_cleared") );
  5272. theSound.SoundEvent("gui_character_synergy_effect");
  5273. }
  5274. else if(itemName == 'Wolf Hour')
  5275. {
  5276. removedItem = inv.RemoveItem( itemId, 1 );
  5277. theSound.SoundEvent("gui_character_synergy_effect");
  5278. AddEffectDefault(EET_WolfHour, thePlayer, 'wolf hour');
  5279. }
  5280. else if ( itemName == 'q704_ft_golden_egg' )
  5281. {
  5282. AddPoints(ESkillPoint, 1, true);
  5283. removedItem = inv.RemoveItem( itemId, 1 );
  5284. theGame.GetGuiManager().ShowNotification( GetLocStringByKeyExt("panel_character_popup_title_buy_skill") + "<br>" + GetLocStringByKeyExt("panel_character_availablepoints") + " +1");
  5285. theSound.SoundEvent("gui_character_buy_skill");
  5286. }
  5287. else if ( itemName == 'mq7023_cake' )
  5288. {
  5289. this.AddAbility('mq7023_cake_vitality_bonus');
  5290. removedItem = inv.RemoveItem( itemId, 1 );
  5291. theSound.SoundEvent("gui_character_synergy_effect");
  5292. }
  5293. else
  5294. {
  5295. willRemoveItem = inv.GetItemQuantity(itemId) == 1 && !inv.ItemHasTag(itemId, 'InfiniteUse');
  5296.  
  5297. if(willRemoveItem)
  5298. toSlot = GetItemSlot(itemId);
  5299.  
  5300. removedItem = super.ConsumeItem(itemId);
  5301.  
  5302. if(willRemoveItem && removedItem)
  5303. {
  5304. edibles = inv.GetItemsByTag('Edibles');
  5305. equippedNewEdible = false;
  5306.  
  5307. newEdibleId = 0;
  5308.  
  5309.  
  5310. for(i=0; i<edibles.Size(); i+=1)
  5311. {
  5312. if(!IsItemEquipped(edibles[i]) && !inv.ItemHasTag(edibles[i], 'Alcohol') && inv.GetItemName(edibles[i]) != 'Clearing Potion' && inv.GetItemName(edibles[i]) != 'Wolf Hour')
  5313. {
  5314. abilities.Clear();
  5315. inv.GetItemAbilities(edibles[i], abilities);
  5316. if (abilities.Contains('FoodEdibleQuality_3') || abilities.Contains('BeverageQuality_3'))
  5317. {
  5318. equippedNewEdible = true;
  5319. newEdibleId = i;
  5320. break;
  5321. }
  5322. else if (!isLevel2)
  5323. {
  5324. if (abilities.Contains('FoodEdibleQuality_2') || abilities.Contains('BeverageQuality_2'))
  5325. {
  5326. isLevel2 = true;
  5327. isLevel1 = false;
  5328. equippedNewEdible = true;
  5329. newEdibleId = i;
  5330. }
  5331. else if (!isLevel1)
  5332. {
  5333. if (abilities.Contains('FoodEdibleQuality_1') || abilities.Contains('BeverageQuality_1'))
  5334. {
  5335. equippedNewEdible = true;
  5336. newEdibleId = i;
  5337. isLevel1 = true;
  5338. }
  5339. else
  5340. {
  5341. equippedNewEdible = true;
  5342. newEdibleId = i;
  5343. }
  5344. }
  5345. }
  5346. }
  5347. }
  5348.  
  5349.  
  5350. if(!equippedNewEdible)
  5351. {
  5352. for(i=0; i<edibles.Size(); i+=1)
  5353. {
  5354. if(!IsItemEquipped(edibles[i]) && inv.GetItemName(edibles[i]) != 'Clearing Potion' && inv.GetItemName(edibles[i]) != 'Wolf Hour')
  5355. {
  5356. EquipItemInGivenSlot(edibles[i], toSlot, true, false);
  5357. break;
  5358. }
  5359. }
  5360. }
  5361. else
  5362. EquipItemInGivenSlot(edibles[newEdibleId], toSlot, true, false);
  5363. }
  5364. }
  5365.  
  5366. return removedItem;
  5367. }
  5368.  
  5369.  
  5370. public final function GetAlcoholForAlchemicalItemsRefill() : SItemUniqueId
  5371. {
  5372. var alcos : array<SItemUniqueId>;
  5373. var id : SItemUniqueId;
  5374. var i, price, minPrice : int;
  5375.  
  5376. alcos = inv.GetItemsByTag(theGame.params.TAG_ALCHEMY_REFILL_ALCO);
  5377.  
  5378. if(alcos.Size() > 0)
  5379. {
  5380. if(inv.ItemHasTag(alcos[0], theGame.params.TAG_INFINITE_USE))
  5381. return alcos[0];
  5382.  
  5383. minPrice = inv.GetItemPrice(alcos[0]);
  5384. price = minPrice;
  5385. id = alcos[0];
  5386.  
  5387. for(i=1; i<alcos.Size(); i+=1)
  5388. {
  5389. if(inv.ItemHasTag(alcos[i], theGame.params.TAG_INFINITE_USE))
  5390. return alcos[i];
  5391.  
  5392. price = inv.GetItemPrice(alcos[i]);
  5393.  
  5394. if(price < minPrice)
  5395. {
  5396. minPrice = price;
  5397. id = alcos[i];
  5398. }
  5399. }
  5400.  
  5401. return id;
  5402. }
  5403.  
  5404. return GetInvalidUniqueId();
  5405. }
  5406.  
  5407. public final function ClearPreviouslyUsedBolt()
  5408. {
  5409. previouslyUsedBolt = GetInvalidUniqueId();
  5410. }
  5411.  
  5412. public function ShouldUseInfiniteWaterBolts() : bool
  5413. {
  5414. return GetCurrentStateName() == 'Swimming' || IsSwimming() || IsDiving();
  5415. }
  5416.  
  5417. public function GetCurrentInfiniteBoltName( optional forceBodkin : bool, optional forceHarpoon : bool ) : name
  5418. {
  5419. if(!forceBodkin && (forceHarpoon || ShouldUseInfiniteWaterBolts()) )
  5420. {
  5421. return 'Harpoon Bolt';
  5422. }
  5423. return 'Bodkin Bolt';
  5424. }
  5425.  
  5426.  
  5427. public final function AddAndEquipInfiniteBolt(optional forceBodkin : bool, optional forceHarpoon : bool)
  5428. {
  5429. var bolt, bodkins, harpoons : array<SItemUniqueId>;
  5430. var boltItemName : name;
  5431. var i : int;
  5432.  
  5433.  
  5434. bodkins = inv.GetItemsByName('Bodkin Bolt');
  5435. harpoons = inv.GetItemsByName('Harpoon Bolt');
  5436.  
  5437. for(i=bodkins.Size()-1; i>=0; i-=1)
  5438. inv.RemoveItem(bodkins[i], inv.GetItemQuantity(bodkins[i]) );
  5439.  
  5440. for(i=harpoons.Size()-1; i>=0; i-=1)
  5441. inv.RemoveItem(harpoons[i], inv.GetItemQuantity(harpoons[i]) );
  5442.  
  5443.  
  5444.  
  5445. boltItemName = GetCurrentInfiniteBoltName( forceBodkin, forceHarpoon );
  5446.  
  5447.  
  5448. if(boltItemName == 'Bodkin Bolt' && inv.IsIdValid(previouslyUsedBolt))
  5449. {
  5450. bolt.PushBack(previouslyUsedBolt);
  5451. }
  5452. else
  5453. {
  5454.  
  5455. bolt = inv.AddAnItem(boltItemName, 1, true, true);
  5456.  
  5457.  
  5458. if(boltItemName == 'Harpoon Bolt')
  5459. {
  5460. GetItemEquippedOnSlot(EES_Bolt, previouslyUsedBolt);
  5461. }
  5462. }
  5463.  
  5464. EquipItem(bolt[0], EES_Bolt);
  5465. }
  5466.  
  5467.  
  5468. event OnItemGiven(data : SItemChangedData)
  5469. {
  5470. var m_guiManager : CR4GuiManager;
  5471.  
  5472. super.OnItemGiven(data);
  5473.  
  5474.  
  5475. if(!inv)
  5476. inv = GetInventory();
  5477.  
  5478.  
  5479. if(inv.IsItemEncumbranceItem(data.ids[0]))
  5480. UpdateEncumbrance();
  5481.  
  5482. m_guiManager = theGame.GetGuiManager();
  5483. if(m_guiManager)
  5484. m_guiManager.RegisterNewItem(data.ids[0]);
  5485. }
  5486.  
  5487.  
  5488. public final function CheckForFullyArmedAchievement()
  5489. {
  5490. if( HasAllItemsFromSet(theGame.params.ITEM_SET_TAG_BEAR) || HasAllItemsFromSet(theGame.params.ITEM_SET_TAG_GRYPHON) ||
  5491. HasAllItemsFromSet(theGame.params.ITEM_SET_TAG_LYNX) || HasAllItemsFromSet(theGame.params.ITEM_SET_TAG_WOLF) ||
  5492. HasAllItemsFromSet(theGame.params.ITEM_SET_TAG_VIPER) || HasAllItemsFromSet(theGame.params.ITEM_SET_TAG_NETFLIX)
  5493. )
  5494. {
  5495. theGame.GetGamerProfile().AddAchievement(EA_FullyArmed);
  5496. }
  5497. }
  5498.  
  5499.  
  5500. public final function HasAllItemsFromSet(setItemTag : name) : bool
  5501. {
  5502. var item : SItemUniqueId;
  5503.  
  5504. if(!GetItemEquippedOnSlot(EES_SteelSword, item) || !inv.ItemHasTag(item, setItemTag))
  5505. return false;
  5506.  
  5507. if(!GetItemEquippedOnSlot(EES_SilverSword, item) || !inv.ItemHasTag(item, setItemTag))
  5508. return false;
  5509.  
  5510. if(!GetItemEquippedOnSlot(EES_Boots, item) || !inv.ItemHasTag(item, setItemTag))
  5511. return false;
  5512.  
  5513. if(!GetItemEquippedOnSlot(EES_Pants, item) || !inv.ItemHasTag(item, setItemTag))
  5514. return false;
  5515.  
  5516. if(!GetItemEquippedOnSlot(EES_Gloves, item) || !inv.ItemHasTag(item, setItemTag))
  5517. return false;
  5518.  
  5519. if(!GetItemEquippedOnSlot(EES_Armor, item) || !inv.ItemHasTag(item, setItemTag))
  5520. return false;
  5521.  
  5522.  
  5523. if(setItemTag == theGame.params.ITEM_SET_TAG_BEAR || setItemTag == theGame.params.ITEM_SET_TAG_LYNX)
  5524. {
  5525. if(!GetItemEquippedOnSlot(EES_RangedWeapon, item) || !inv.ItemHasTag(item, setItemTag))
  5526. return false;
  5527. }
  5528.  
  5529. return true;
  5530. }
  5531.  
  5532.  
  5533. public final function CheckForFullyArmedByTag(setItemTag : name)
  5534. {
  5535. var doneParts, totalParts : int;
  5536. var item : SItemUniqueId;
  5537.  
  5538. if(setItemTag == '')
  5539. return;
  5540.  
  5541.  
  5542. doneParts = 0;
  5543. totalParts = 6;
  5544. if(GetItemEquippedOnSlot(EES_SteelSword, item) && inv.ItemHasTag(item, setItemTag))
  5545. doneParts += 1;
  5546.  
  5547. if(GetItemEquippedOnSlot(EES_SilverSword, item) && inv.ItemHasTag(item, setItemTag))
  5548. doneParts += 1;
  5549.  
  5550. if(GetItemEquippedOnSlot(EES_Boots, item) && inv.ItemHasTag(item, setItemTag))
  5551. doneParts += 1;
  5552.  
  5553. if(GetItemEquippedOnSlot(EES_Pants, item) && inv.ItemHasTag(item, setItemTag))
  5554. doneParts += 1;
  5555.  
  5556. if(GetItemEquippedOnSlot(EES_Gloves, item) && inv.ItemHasTag(item, setItemTag))
  5557. doneParts += 1;
  5558.  
  5559. if(GetItemEquippedOnSlot(EES_Armor, item) && inv.ItemHasTag(item, setItemTag))
  5560. doneParts += 1;
  5561.  
  5562.  
  5563. if(setItemTag == theGame.params.ITEM_SET_TAG_BEAR || setItemTag == theGame.params.ITEM_SET_TAG_LYNX)
  5564. {
  5565. totalParts += 1;
  5566. if(GetItemEquippedOnSlot(EES_RangedWeapon, item) && inv.ItemHasTag(item, setItemTag))
  5567. doneParts += 1;
  5568. }
  5569.  
  5570.  
  5571. if(doneParts >= totalParts)
  5572. {
  5573. theGame.GetGamerProfile().AddAchievement(EA_FullyArmed);
  5574. }
  5575. else
  5576. {
  5577. theGame.GetGamerProfile().NoticeAchievementProgress(EA_FullyArmed, doneParts, totalParts);
  5578. }
  5579. }
  5580.  
  5581.  
  5582.  
  5583.  
  5584. public function GetTotalArmor() : SAbilityAttributeValue
  5585. {
  5586. var armor : SAbilityAttributeValue;
  5587. var armorItem : SItemUniqueId;
  5588.  
  5589. armor = super.GetTotalArmor();
  5590.  
  5591. if(GetItemEquippedOnSlot(EES_Armor, armorItem))
  5592. {
  5593.  
  5594. armor -= inv.GetItemAttributeValue(armorItem, theGame.params.ARMOR_VALUE_NAME);
  5595.  
  5596.  
  5597. armor += inv.GetItemArmorTotal(armorItem);
  5598. }
  5599.  
  5600. if(GetItemEquippedOnSlot(EES_Pants, armorItem))
  5601. {
  5602.  
  5603. armor -= inv.GetItemAttributeValue(armorItem, theGame.params.ARMOR_VALUE_NAME);
  5604.  
  5605.  
  5606. armor += inv.GetItemArmorTotal(armorItem);
  5607. }
  5608.  
  5609. if(GetItemEquippedOnSlot(EES_Boots, armorItem))
  5610. {
  5611.  
  5612. armor -= inv.GetItemAttributeValue(armorItem, theGame.params.ARMOR_VALUE_NAME);
  5613.  
  5614.  
  5615. armor += inv.GetItemArmorTotal(armorItem);
  5616. }
  5617.  
  5618. if(GetItemEquippedOnSlot(EES_Gloves, armorItem))
  5619. {
  5620.  
  5621. armor -= inv.GetItemAttributeValue(armorItem, theGame.params.ARMOR_VALUE_NAME);
  5622.  
  5623.  
  5624. armor += inv.GetItemArmorTotal(armorItem);
  5625. }
  5626.  
  5627. return armor;
  5628. }
  5629.  
  5630.  
  5631.  
  5632. public function ReduceArmorDurability() : EEquipmentSlots
  5633. {
  5634. var r, sum : int;
  5635. var slot : EEquipmentSlots;
  5636. var id : SItemUniqueId;
  5637. var prevDurMult, currDurMult, ratio : float;
  5638.  
  5639.  
  5640. sum = theGame.params.DURABILITY_ARMOR_CHEST_WEIGHT;
  5641. sum += theGame.params.DURABILITY_ARMOR_PANTS_WEIGHT;
  5642. sum += theGame.params.DURABILITY_ARMOR_GLOVES_WEIGHT;
  5643. sum += theGame.params.DURABILITY_ARMOR_BOOTS_WEIGHT;
  5644. sum += theGame.params.DURABILITY_ARMOR_MISS_WEIGHT;
  5645.  
  5646. r = RandRange(sum);
  5647.  
  5648. if(r < theGame.params.DURABILITY_ARMOR_CHEST_WEIGHT)
  5649. slot = EES_Armor;
  5650. else if (r < theGame.params.DURABILITY_ARMOR_CHEST_WEIGHT + theGame.params.DURABILITY_ARMOR_PANTS_WEIGHT)
  5651. slot = EES_Pants;
  5652. else if (r < theGame.params.DURABILITY_ARMOR_CHEST_WEIGHT + theGame.params.DURABILITY_ARMOR_PANTS_WEIGHT + theGame.params.DURABILITY_ARMOR_GLOVES_WEIGHT)
  5653. slot = EES_Gloves;
  5654. else if (r < theGame.params.DURABILITY_ARMOR_CHEST_WEIGHT + theGame.params.DURABILITY_ARMOR_PANTS_WEIGHT + theGame.params.DURABILITY_ARMOR_GLOVES_WEIGHT + theGame.params.DURABILITY_ARMOR_BOOTS_WEIGHT)
  5655. slot = EES_Boots;
  5656. else
  5657. return EES_InvalidSlot;
  5658.  
  5659. GetItemEquippedOnSlot(slot, id);
  5660. ratio = inv.GetItemDurabilityRatio(id);
  5661. if(inv.ReduceItemDurability(id))
  5662. {
  5663. prevDurMult = theGame.params.GetDurabilityMultiplier(ratio, false);
  5664.  
  5665. ratio = inv.GetItemDurabilityRatio(id);
  5666. currDurMult = theGame.params.GetDurabilityMultiplier(ratio, false);
  5667.  
  5668. if(currDurMult != prevDurMult)
  5669. {
  5670.  
  5671.  
  5672.  
  5673.  
  5674. }
  5675.  
  5676. return slot;
  5677. }
  5678.  
  5679. return EES_InvalidSlot;
  5680. }
  5681.  
  5682.  
  5683. public function DismantleItem(dismantledItem : SItemUniqueId, toolItem : SItemUniqueId) : bool
  5684. {
  5685. var parts : array<SItemParts>;
  5686. var i : int;
  5687.  
  5688. if(!inv.IsItemDismantleKit(toolItem))
  5689. return false;
  5690.  
  5691. parts = inv.GetItemRecyclingParts(dismantledItem);
  5692.  
  5693. if(parts.Size() <= 0)
  5694. return false;
  5695.  
  5696. for(i=0; i<parts.Size(); i+=1)
  5697. inv.AddAnItem(parts[i].itemName, parts[i].quantity, true, false);
  5698.  
  5699. inv.RemoveItem(toolItem);
  5700. inv.RemoveItem(dismantledItem);
  5701. return true;
  5702. }
  5703.  
  5704.  
  5705. public function GetItemEquippedOnSlot(slot : EEquipmentSlots, out item : SItemUniqueId) : bool
  5706. {
  5707. if(slot == EES_InvalidSlot || slot < 0 || slot > EnumGetMax('EEquipmentSlots'))
  5708. return false;
  5709.  
  5710. item = itemSlots[slot];
  5711.  
  5712. return inv.IsIdValid(item);
  5713. }
  5714.  
  5715.  
  5716. public function GetItemSlotByItemName(itemName : name) : EEquipmentSlots
  5717. {
  5718. var ids : array<SItemUniqueId>;
  5719. var i : int;
  5720. var slot : EEquipmentSlots;
  5721.  
  5722. ids = inv.GetItemsByName(itemName);
  5723. for(i=0; i<ids.Size(); i+=1)
  5724. {
  5725. slot = GetItemSlot(ids[i]);
  5726. if(slot != EES_InvalidSlot)
  5727. return slot;
  5728. }
  5729.  
  5730. return EES_InvalidSlot;
  5731. }
  5732.  
  5733.  
  5734. public function GetItemSlot(item : SItemUniqueId) : EEquipmentSlots
  5735. {
  5736. var i : int;
  5737.  
  5738. if(!inv.IsIdValid(item))
  5739. return EES_InvalidSlot;
  5740.  
  5741. for(i=0; i<itemSlots.Size(); i+=1)
  5742. if(itemSlots[i] == item)
  5743. return i;
  5744.  
  5745. return EES_InvalidSlot;
  5746. }
  5747.  
  5748. public function GetEquippedItems() : array<SItemUniqueId>
  5749. {
  5750. return itemSlots;
  5751. }
  5752.  
  5753. public function IsItemEquipped(item : SItemUniqueId) : bool
  5754. {
  5755. if(!inv.IsIdValid(item))
  5756. return false;
  5757.  
  5758. return itemSlots.Contains(item);
  5759. }
  5760.  
  5761. public function IsItemHeld(item : SItemUniqueId) : bool
  5762. {
  5763. if(!inv.IsIdValid(item))
  5764. return false;
  5765.  
  5766. return inv.IsItemHeld(item);
  5767. }
  5768.  
  5769.  
  5770. public function IsAnyItemEquippedOnSlot(slot : EEquipmentSlots) : bool
  5771. {
  5772. if(slot == EES_InvalidSlot || slot < 0 || slot > EnumGetMax('EEquipmentSlots'))
  5773. return false;
  5774.  
  5775. return inv.IsIdValid(itemSlots[slot]);
  5776. }
  5777.  
  5778.  
  5779. public function GetFreeQuickslot() : EEquipmentSlots
  5780. {
  5781. if(!inv.IsIdValid(itemSlots[EES_Quickslot1])) return EES_Quickslot1;
  5782. if(!inv.IsIdValid(itemSlots[EES_Quickslot2])) return EES_Quickslot2;
  5783.  
  5784.  
  5785. return EES_InvalidSlot;
  5786. }
  5787.  
  5788.  
  5789. event OnEquipItemRequested(item : SItemUniqueId, ignoreMount : bool)
  5790. {
  5791. var slot : EEquipmentSlots;
  5792.  
  5793. if(inv.IsIdValid(item))
  5794. {
  5795. slot = inv.GetSlotForItemId(item);
  5796.  
  5797. if (slot != EES_InvalidSlot)
  5798. {
  5799.  
  5800.  
  5801. EquipItemInGivenSlot(item, slot, ignoreMount);
  5802. }
  5803. }
  5804. }
  5805.  
  5806. event OnUnequipItemRequested(item : SItemUniqueId)
  5807. {
  5808. UnequipItem(item);
  5809. }
  5810.  
  5811.  
  5812. public function EquipItem(item : SItemUniqueId, optional slot : EEquipmentSlots, optional toHand : bool) : bool
  5813. {
  5814. if(!inv.IsIdValid(item))
  5815. return false;
  5816.  
  5817. if(slot == EES_InvalidSlot)
  5818. {
  5819. slot = inv.GetSlotForItemId(item);
  5820.  
  5821. if(slot == EES_InvalidSlot)
  5822. return false;
  5823. }
  5824.  
  5825. ForceSoundAppearanceUpdate();
  5826.  
  5827. return EquipItemInGivenSlot(item, slot, false, toHand);
  5828. }
  5829.  
  5830. protected function ShouldMount(slot : EEquipmentSlots, item : SItemUniqueId, category : name):bool
  5831. {
  5832.  
  5833.  
  5834. return !IsSlotPotionMutagen(slot) && category != 'usable' && category != 'potion' && category != 'petard' && !inv.ItemHasTag(item, 'PlayerUnwearable');
  5835. }
  5836.  
  5837. protected function ShouldMountItemWithName( itemName: name ): bool
  5838. {
  5839. var slot : EEquipmentSlots;
  5840. var items : array<SItemUniqueId>;
  5841. var category : name;
  5842. var i : int;
  5843.  
  5844. items = inv.GetItemsByName( itemName );
  5845.  
  5846. category = inv.GetItemCategory( items[0] );
  5847.  
  5848. slot = GetItemSlot( items[0] );
  5849.  
  5850. return ShouldMount( slot, items[0], category );
  5851. }
  5852.  
  5853. public function GetMountableItems( out items : array< SItemUniqueId > )
  5854. {
  5855. var i : int;
  5856. var mountable : bool;
  5857. var mountableItems : array< SItemUniqueId >;
  5858. var slot : EEquipmentSlots;
  5859. var category : name;
  5860. var item: SItemUniqueId;
  5861.  
  5862. for ( i = 0; i < items.Size(); i += 1 )
  5863. {
  5864. item = items[i];
  5865.  
  5866. category = inv.GetItemCategory( item );
  5867.  
  5868. slot = GetItemSlot( item );
  5869.  
  5870. mountable = ShouldMount( slot, item, category );
  5871.  
  5872. if ( mountable )
  5873. {
  5874. mountableItems.PushBack( items[ i ] );
  5875. }
  5876. }
  5877. items = mountableItems;
  5878. }
  5879.  
  5880. public final function AddAndEquipItem( item : name ) : bool
  5881. {
  5882. var ids : array< SItemUniqueId >;
  5883.  
  5884. ids = inv.AddAnItem( item );
  5885. if( inv.IsIdValid( ids[ 0 ] ) )
  5886. {
  5887. return EquipItem( ids[ 0 ] );
  5888. }
  5889.  
  5890. return false;
  5891. }
  5892.  
  5893. public final function AddQuestMarkedSelectedQuickslotItem( sel : SSelectedQuickslotItem )
  5894. {
  5895. questMarkedSelectedQuickslotItems.PushBack( sel );
  5896. }
  5897.  
  5898. public final function GetQuestMarkedSelectedQuickslotItem( sourceName : name ) : SItemUniqueId
  5899. {
  5900. var i : int;
  5901.  
  5902. for( i=0; i<questMarkedSelectedQuickslotItems.Size(); i+=1 )
  5903. {
  5904. if( questMarkedSelectedQuickslotItems[i].sourceName == sourceName )
  5905. {
  5906. return questMarkedSelectedQuickslotItems[i].itemID;
  5907. }
  5908. }
  5909.  
  5910. return GetInvalidUniqueId();
  5911. }
  5912.  
  5913. public final function SwapEquippedItems(slot1 : EEquipmentSlots, slot2 : EEquipmentSlots)
  5914. {
  5915. var temp : SItemUniqueId;
  5916. var pam : W3PlayerAbilityManager;
  5917.  
  5918. temp = itemSlots[slot1];
  5919. itemSlots[slot1] = itemSlots[slot2];
  5920. itemSlots[slot2] = temp;
  5921.  
  5922. if(IsSlotSkillMutagen(slot1))
  5923. {
  5924. pam = (W3PlayerAbilityManager)abilityManager;
  5925. if(pam)
  5926. pam.OnSwappedMutagensPost(itemSlots[slot1], itemSlots[slot2]);
  5927. }
  5928. }
  5929.  
  5930. public final function GetSlotForEquippedItem( itemID : SItemUniqueId ) : EEquipmentSlots
  5931. {
  5932. var i : int;
  5933.  
  5934. for( i=0; i<itemSlots.Size(); i+=1 )
  5935. {
  5936. if( itemSlots[i] == itemID )
  5937. {
  5938. return i;
  5939. }
  5940. }
  5941.  
  5942. return EES_InvalidSlot;
  5943. }
  5944.  
  5945. public function EquipItemInGivenSlot(item : SItemUniqueId, slot : EEquipmentSlots, ignoreMounting : bool, optional toHand : bool) : bool
  5946. {
  5947. var i, groupID, quantity : int;
  5948. var fistsID : array<SItemUniqueId>;
  5949. var pam : W3PlayerAbilityManager;
  5950. var isSkillMutagen : bool;
  5951. var armorEntity : CItemEntity;
  5952. var armorMeshComponent : CComponent;
  5953. var armorSoundIdentification : name;
  5954. var category : name;
  5955. var tagOfASet : name;
  5956. var prevSkillColor : ESkillColor;
  5957. var containedAbilities : array<name>;
  5958. var dm : CDefinitionsManagerAccessor;
  5959. var armorType : EArmorType;
  5960. var otherMask, previousItemInSlot : SItemUniqueId;
  5961. var tutStatePot : W3TutorialManagerUIHandlerStatePotions;
  5962. var tutStateFood : W3TutorialManagerUIHandlerStateFood;
  5963. var tutStateSecondPotionEquip : W3TutorialManagerUIHandlerStateSecondPotionEquip;
  5964. var boltItem : SItemUniqueId;
  5965. var aerondight : W3Effect_Aerondight;
  5966.  
  5967. if(!inv.IsIdValid(item))
  5968. {
  5969. LogAssert(false, "W3PlayerWitcher.EquipItemInGivenSlot: invalid item");
  5970. return false;
  5971. }
  5972. if(slot == EES_InvalidSlot || slot == EES_HorseBlinders || slot == EES_HorseSaddle || slot == EES_HorseBag || slot == EES_HorseTrophy)
  5973. {
  5974. LogAssert(false, "W3PlayerWitcher.EquipItem: Cannot equip item <<" + inv.GetItemName(item) + ">> - provided slot <<" + slot + ">> is invalid");
  5975. return false;
  5976. }
  5977. if(itemSlots[slot] == item)
  5978. {
  5979. return true;
  5980. }
  5981.  
  5982. if(!HasRequiredLevelToEquipItem(item))
  5983. {
  5984.  
  5985. return false;
  5986. }
  5987.  
  5988. if(inv.ItemHasTag(item, 'PhantomWeapon') && !GetPhantomWeaponMgr())
  5989. {
  5990. InitPhantomWeaponMgr();
  5991. }
  5992.  
  5993.  
  5994. if( slot == EES_SilverSword && inv.ItemHasTag( item, 'Aerondight' ) )
  5995. {
  5996. AddEffectDefault( EET_Aerondight, this, "Aerondight" );
  5997.  
  5998.  
  5999. aerondight = (W3Effect_Aerondight)GetBuff( EET_Aerondight );
  6000. aerondight.Pause( 'ManageAerondightBuff' );
  6001. }
  6002.  
  6003.  
  6004. previousItemInSlot = itemSlots[slot];
  6005. if( IsItemEquipped(item))
  6006. {
  6007. SwapEquippedItems(slot, GetItemSlot(item));
  6008. return true;
  6009. }
  6010.  
  6011.  
  6012. isSkillMutagen = IsSlotSkillMutagen(slot);
  6013. if(isSkillMutagen)
  6014. {
  6015. pam = (W3PlayerAbilityManager)abilityManager;
  6016. if(!pam.IsSkillMutagenSlotUnlocked(slot))
  6017. {
  6018. return false;
  6019. }
  6020. }
  6021.  
  6022.  
  6023. if(inv.IsIdValid(previousItemInSlot))
  6024. {
  6025. if(!UnequipItemFromSlot(slot, true))
  6026. {
  6027. LogAssert(false, "W3PlayerWitcher.EquipItem: Cannot equip item <<" + inv.GetItemName(item) + ">> !!");
  6028. return false;
  6029. }
  6030. }
  6031.  
  6032.  
  6033. if(inv.IsItemMask(item))
  6034. {
  6035. if(slot == EES_Quickslot1)
  6036. GetItemEquippedOnSlot(EES_Quickslot2, otherMask);
  6037. else
  6038. GetItemEquippedOnSlot(EES_Quickslot1, otherMask);
  6039.  
  6040. if(inv.IsItemMask(otherMask))
  6041. UnequipItem(otherMask);
  6042. }
  6043.  
  6044. if(isSkillMutagen)
  6045. {
  6046. groupID = pam.GetSkillGroupIdOfMutagenSlot(slot);
  6047. prevSkillColor = pam.GetSkillGroupColor(groupID);
  6048. }
  6049.  
  6050. itemSlots[slot] = item;
  6051.  
  6052. category = inv.GetItemCategory( item );
  6053.  
  6054.  
  6055. if( !ignoreMounting && ShouldMount(slot, item, category) )
  6056. {
  6057.  
  6058. inv.MountItem( item, toHand, IsSlotSkillMutagen( slot ) );
  6059. }
  6060.  
  6061. theTelemetry.LogWithLabelAndValue( TE_INV_ITEM_EQUIPPED, inv.GetItemName(item), slot );
  6062.  
  6063. if(slot == EES_RangedWeapon)
  6064. {
  6065. rangedWeapon = ( Crossbow )( inv.GetItemEntityUnsafe(item) );
  6066. if(!rangedWeapon)
  6067. AddTimer('DelayedOnItemMount', 0.1, true);
  6068.  
  6069. if ( IsSwimming() || IsDiving() )
  6070. {
  6071. GetItemEquippedOnSlot(EES_Bolt, boltItem);
  6072.  
  6073. if(inv.IsIdValid(boltItem))
  6074. {
  6075. if ( !inv.ItemHasTag(boltItem, 'UnderwaterAmmo' ))
  6076. {
  6077. AddAndEquipInfiniteBolt(false, true);
  6078. }
  6079. }
  6080. else if(!IsAnyItemEquippedOnSlot(EES_Bolt))
  6081. {
  6082. AddAndEquipInfiniteBolt(false, true);
  6083. }
  6084. }
  6085.  
  6086. else if(!IsAnyItemEquippedOnSlot(EES_Bolt))
  6087. AddAndEquipInfiniteBolt();
  6088. }
  6089. else if(slot == EES_Bolt)
  6090. {
  6091. if(rangedWeapon)
  6092. { if ( !IsSwimming() || !IsDiving() )
  6093. {
  6094. rangedWeapon.OnReplaceAmmo();
  6095. rangedWeapon.OnWeaponReload();
  6096. }
  6097. else
  6098. {
  6099. DisplayHudMessage(GetLocStringByKeyExt( "menu_cannot_perform_action_now" ));
  6100. }
  6101. }
  6102. }
  6103.  
  6104. else if(isSkillMutagen)
  6105. {
  6106. theGame.GetGuiManager().IgnoreNewItemNotifications( true );
  6107.  
  6108.  
  6109. quantity = inv.GetItemQuantity( item );
  6110. if( quantity > 1 )
  6111. {
  6112. inv.SplitItem( item, quantity - 1 );
  6113. }
  6114.  
  6115. pam.OnSkillMutagenEquipped(item, slot, prevSkillColor);
  6116. LogSkillColors("Mutagen <<" + inv.GetItemName(item) + ">> equipped to slot <<" + slot + ">>");
  6117. LogSkillColors("Group bonus color is now <<" + pam.GetSkillGroupColor(groupID) + ">>");
  6118. LogSkillColors("");
  6119.  
  6120. theGame.GetGuiManager().IgnoreNewItemNotifications( false );
  6121. }
  6122. else if(slot == EES_Gloves && HasWeaponDrawn(false))
  6123. {
  6124. PlayRuneword4FX(PW_Steel);
  6125. PlayRuneword4FX(PW_Silver);
  6126. }
  6127.  
  6128. else if( ( slot == EES_Petard1 || slot == EES_Petard2 ) && inv.IsItemBomb( GetSelectedItemId() ) )
  6129. {
  6130. SelectQuickslotItem( slot );
  6131. }
  6132.  
  6133.  
  6134. if(inv.ItemHasAbility(item, 'MA_HtH'))
  6135. {
  6136. inv.GetItemContainedAbilities(item, containedAbilities);
  6137. fistsID = inv.GetItemsByName('fists');
  6138. dm = theGame.GetDefinitionsManager();
  6139. for(i=0; i<containedAbilities.Size(); i+=1)
  6140. {
  6141. if(dm.AbilityHasTag(containedAbilities[i], 'MA_HtH'))
  6142. {
  6143. inv.AddItemCraftedAbility(fistsID[0], containedAbilities[i], true);
  6144. }
  6145. }
  6146. }
  6147.  
  6148.  
  6149. if(inv.IsItemAnyArmor(item))
  6150. {
  6151. armorType = inv.GetArmorType(item);
  6152. pam = (W3PlayerAbilityManager)abilityManager;
  6153.  
  6154. if(armorType == EAT_Light)
  6155. {
  6156. if(CanUseSkill(S_Perk_05))
  6157. pam.SetPerkArmorBonus(S_Perk_05);
  6158. }
  6159. else if(armorType == EAT_Medium)
  6160. {
  6161. if(CanUseSkill(S_Perk_06))
  6162. pam.SetPerkArmorBonus(S_Perk_06);
  6163. }
  6164. else if(armorType == EAT_Heavy)
  6165. {
  6166. if(CanUseSkill(S_Perk_07))
  6167. pam.SetPerkArmorBonus(S_Perk_07);
  6168. }
  6169. }
  6170.  
  6171.  
  6172. UpdateItemSetBonuses( item, true );
  6173.  
  6174.  
  6175. theGame.GetGlobalEventsManager().OnScriptedEvent( SEC_OnItemEquipped );
  6176.  
  6177.  
  6178. if(ShouldProcessTutorial('TutorialPotionCanEquip3'))
  6179. {
  6180. if(IsSlotPotionSlot(slot))
  6181. {
  6182. tutStatePot = (W3TutorialManagerUIHandlerStatePotions)theGame.GetTutorialSystem().uiHandler.GetCurrentState();
  6183. if(tutStatePot)
  6184. {
  6185. tutStatePot.OnPotionEquipped(inv.GetItemName(item));
  6186. }
  6187.  
  6188. tutStateSecondPotionEquip = (W3TutorialManagerUIHandlerStateSecondPotionEquip)theGame.GetTutorialSystem().uiHandler.GetCurrentState();
  6189. if(tutStateSecondPotionEquip)
  6190. {
  6191. tutStateSecondPotionEquip.OnPotionEquipped(inv.GetItemName(item));
  6192. }
  6193.  
  6194. }
  6195. }
  6196.  
  6197. if(ShouldProcessTutorial('TutorialFoodSelectTab'))
  6198. {
  6199. if( IsSlotPotionSlot(slot) && inv.IsItemFood(item))
  6200. {
  6201. tutStateFood = (W3TutorialManagerUIHandlerStateFood)theGame.GetTutorialSystem().uiHandler.GetCurrentState();
  6202. if(tutStateFood)
  6203. {
  6204. tutStateFood.OnFoodEquipped();
  6205. }
  6206. }
  6207. }
  6208.  
  6209.  
  6210.  
  6211.  
  6212. tagOfASet = inv.DetectTagOfASet(item);
  6213. CheckForFullyArmedByTag(tagOfASet);
  6214.  
  6215. ESGOAutoLevelGear(); // ESGO
  6216.  
  6217. return true;
  6218. }
  6219.  
  6220. private function CheckHairItem()
  6221. {
  6222. var ids : array<SItemUniqueId>;
  6223. var i : int;
  6224. var itemName : name;
  6225. var hairApplied : bool;
  6226.  
  6227. ids = inv.GetItemsByCategory('hair');
  6228.  
  6229. for(i=0; i<ids.Size(); i+= 1)
  6230. {
  6231. itemName = inv.GetItemName( ids[i] );
  6232.  
  6233. if( itemName != 'Preview Hair' )
  6234. {
  6235. if( hairApplied == false )
  6236. {
  6237. inv.MountItem( ids[i], false );
  6238. hairApplied = true;
  6239. }
  6240. else
  6241. {
  6242. inv.RemoveItem( ids[i], 1 );
  6243. }
  6244.  
  6245. }
  6246. }
  6247.  
  6248. if( hairApplied == false )
  6249. {
  6250. ids = inv.AddAnItem('Half With Tail Hairstyle', 1, true, false);
  6251. inv.MountItem( ids[0], false );
  6252. }
  6253.  
  6254. }
  6255.  
  6256.  
  6257. timer function DelayedOnItemMount( dt : float, id : int )
  6258. {
  6259. var crossbowID : SItemUniqueId;
  6260. var invent : CInventoryComponent;
  6261.  
  6262. invent = GetInventory();
  6263. if(!invent)
  6264. return;
  6265.  
  6266.  
  6267. GetItemEquippedOnSlot(EES_RangedWeapon, crossbowID);
  6268.  
  6269. if(invent.IsIdValid(crossbowID))
  6270. {
  6271.  
  6272. rangedWeapon = ( Crossbow )(invent.GetItemEntityUnsafe(crossbowID) );
  6273.  
  6274. if(rangedWeapon)
  6275. {
  6276.  
  6277. RemoveTimer('DelayedOnItemMount');
  6278. }
  6279. }
  6280. else
  6281. {
  6282.  
  6283. RemoveTimer('DelayedOnItemMount');
  6284. }
  6285. }
  6286.  
  6287. public function GetHeldItems() : array<SItemUniqueId>
  6288. {
  6289. var items : array<SItemUniqueId>;
  6290. var item : SItemUniqueId;
  6291.  
  6292. if( inv.GetItemEquippedOnSlot(EES_SilverSword, item) && inv.IsItemHeld(item))
  6293. items.PushBack(item);
  6294.  
  6295. if( inv.GetItemEquippedOnSlot(EES_SteelSword, item) && inv.IsItemHeld(item))
  6296. items.PushBack(item);
  6297.  
  6298. if( inv.GetItemEquippedOnSlot(EES_RangedWeapon, item) && inv.IsItemHeld(item))
  6299. items.PushBack(item);
  6300.  
  6301. if( inv.GetItemEquippedOnSlot(EES_Quickslot1, item) && inv.IsItemHeld(item))
  6302. items.PushBack(item);
  6303.  
  6304. if( inv.GetItemEquippedOnSlot(EES_Quickslot2, item) && inv.IsItemHeld(item))
  6305. items.PushBack(item);
  6306.  
  6307. if( inv.GetItemEquippedOnSlot(EES_Petard1, item) && inv.IsItemHeld(item))
  6308. items.PushBack(item);
  6309.  
  6310. if( inv.GetItemEquippedOnSlot(EES_Petard2, item) && inv.IsItemHeld(item))
  6311. items.PushBack(item);
  6312.  
  6313. return items;
  6314. }
  6315.  
  6316. public function MoveMutagenToSlot( item : SItemUniqueId, slotFrom : EEquipmentSlots, slotTo : EEquipmentSlots )
  6317. {
  6318. var pam : W3PlayerAbilityManager;
  6319. var prevSkillColor : ESkillColor;
  6320. var groupID : int;
  6321.  
  6322. if( IsSlotSkillMutagen( slotTo ) )
  6323. {
  6324. itemSlots[slotFrom] = GetInvalidUniqueId();
  6325.  
  6326.  
  6327. groupID = pam.GetSkillGroupIdOfMutagenSlot(slotFrom);
  6328. prevSkillColor = pam.GetSkillGroupColor(groupID);
  6329. pam = (W3PlayerAbilityManager)abilityManager;
  6330. pam.OnSkillMutagenUnequipped(item, slotFrom, prevSkillColor, true);
  6331.  
  6332.  
  6333.  
  6334. EquipItemInGivenSlot( item, slotTo, false );
  6335. }
  6336. }
  6337.  
  6338.  
  6339. public function UnequipItemFromSlot(slot : EEquipmentSlots, optional reequipped : bool) : bool
  6340. {
  6341. var item, bolts, id : SItemUniqueId;
  6342. var items : array<SItemUniqueId>;
  6343. var retBool : bool;
  6344. var fistsID, bolt : array<SItemUniqueId>;
  6345. var i, groupID : int;
  6346. var pam : W3PlayerAbilityManager;
  6347. var prevSkillColor : ESkillColor;
  6348. var containedAbilities : array<name>;
  6349. var dm : CDefinitionsManagerAccessor;
  6350. var armorType : EArmorType;
  6351. var isSwimming : bool;
  6352. var hud : CR4ScriptedHud;
  6353. var damagedItemModule : CR4HudModuleDamagedItems;
  6354.  
  6355. if(slot == EES_InvalidSlot || slot < 0 || slot > EnumGetMax('EEquipmentSlots') || !inv.IsIdValid(itemSlots[slot]))
  6356. return false;
  6357.  
  6358.  
  6359. if(IsSlotSkillMutagen(slot))
  6360. {
  6361.  
  6362. pam = (W3PlayerAbilityManager)abilityManager;
  6363. groupID = pam.GetSkillGroupIdOfMutagenSlot(slot);
  6364. prevSkillColor = pam.GetSkillGroupColor(groupID);
  6365. }
  6366.  
  6367.  
  6368. if(slot == EES_SilverSword || slot == EES_SteelSword)
  6369. {
  6370. PauseOilBuffs( slot == EES_SteelSword );
  6371. }
  6372.  
  6373. item = itemSlots[slot];
  6374. itemSlots[slot] = GetInvalidUniqueId();
  6375.  
  6376.  
  6377. if(inv.ItemHasTag( item, 'PhantomWeapon' ) && GetPhantomWeaponMgr())
  6378. {
  6379. DestroyPhantomWeaponMgr();
  6380. }
  6381.  
  6382.  
  6383.  
  6384.  
  6385. if( slot == EES_SilverSword && inv.ItemHasTag( item, 'Aerondight' ) )
  6386. {
  6387. RemoveBuff( EET_Aerondight );
  6388. }
  6389.  
  6390.  
  6391. if(slot == EES_RangedWeapon)
  6392. {
  6393.  
  6394. this.OnRangedForceHolster( true, true );
  6395. rangedWeapon.ClearDeployedEntity(true);
  6396. rangedWeapon = NULL;
  6397.  
  6398.  
  6399. if(GetItemEquippedOnSlot(EES_Bolt, bolts))
  6400. {
  6401. if(inv.ItemHasTag(bolts, theGame.params.TAG_INFINITE_AMMO))
  6402. {
  6403. inv.RemoveItem(bolts, inv.GetItemQuantity(bolts) );
  6404. }
  6405. }
  6406. }
  6407. else if(IsSlotSkillMutagen(slot))
  6408. {
  6409. pam.OnSkillMutagenUnequipped(item, slot, prevSkillColor);
  6410. LogSkillColors("Mutagen <<" + inv.GetItemName(item) + ">> unequipped from slot <<" + slot + ">>");
  6411. LogSkillColors("Group bonus color is now <<" + pam.GetSkillGroupColor(groupID) + ">>");
  6412. LogSkillColors("");
  6413. }
  6414.  
  6415.  
  6416. if(currentlyEquipedItem == item)
  6417. {
  6418. currentlyEquipedItem = GetInvalidUniqueId();
  6419. RaiseEvent('ForcedUsableItemUnequip');
  6420. }
  6421. if(currentlyEquipedItemL == item)
  6422. {
  6423. if ( currentlyUsedItemL )
  6424. {
  6425. currentlyUsedItemL.OnHidden( this );
  6426. }
  6427. HideUsableItem ( true );
  6428. }
  6429.  
  6430.  
  6431. if( !IsSlotPotionMutagen(slot) )
  6432. {
  6433. GetInventory().UnmountItem(item, true);
  6434. }
  6435.  
  6436. retBool = true;
  6437.  
  6438.  
  6439. if(IsAnyItemEquippedOnSlot(EES_RangedWeapon) && slot == EES_Bolt)
  6440. {
  6441. if(inv.ItemHasTag(item, theGame.params.TAG_INFINITE_AMMO))
  6442. {
  6443.  
  6444. inv.RemoveItem(item, inv.GetItemQuantityByName( inv.GetItemName(item) ) );
  6445. }
  6446. else if (!reequipped)
  6447. {
  6448.  
  6449. AddAndEquipInfiniteBolt();
  6450. }
  6451. }
  6452.  
  6453.  
  6454. if(slot == EES_SilverSword || slot == EES_SteelSword)
  6455. {
  6456. OnEquipMeleeWeapon(PW_None, true);
  6457. }
  6458.  
  6459. if( GetSelectedItemId() == item )
  6460. {
  6461. ClearSelectedItemId();
  6462. }
  6463.  
  6464. if(inv.IsItemBody(item))
  6465. {
  6466. retBool = true;
  6467. }
  6468.  
  6469. if(retBool && !reequipped)
  6470. {
  6471. theTelemetry.LogWithLabelAndValue( TE_INV_ITEM_UNEQUIPPED, inv.GetItemName(item), slot );
  6472.  
  6473.  
  6474. if(slot == EES_SteelSword && !IsAnyItemEquippedOnSlot(EES_SilverSword))
  6475. {
  6476. RemoveBuff(EET_EnhancedWeapon);
  6477. }
  6478. else if(slot == EES_SilverSword && !IsAnyItemEquippedOnSlot(EES_SteelSword))
  6479. {
  6480. RemoveBuff(EET_EnhancedWeapon);
  6481. }
  6482. else if(inv.IsItemAnyArmor(item))
  6483. {
  6484. if( !IsAnyItemEquippedOnSlot(EES_Armor) && !IsAnyItemEquippedOnSlot(EES_Gloves) && !IsAnyItemEquippedOnSlot(EES_Boots) && !IsAnyItemEquippedOnSlot(EES_Pants))
  6485. RemoveBuff(EET_EnhancedArmor);
  6486. }
  6487. }
  6488.  
  6489.  
  6490. if(inv.ItemHasAbility(item, 'MA_HtH'))
  6491. {
  6492. inv.GetItemContainedAbilities(item, containedAbilities);
  6493. fistsID = inv.GetItemsByName('fists');
  6494. dm = theGame.GetDefinitionsManager();
  6495. for(i=0; i<containedAbilities.Size(); i+=1)
  6496. {
  6497. if(dm.AbilityHasTag(containedAbilities[i], 'MA_HtH'))
  6498. {
  6499. inv.RemoveItemCraftedAbility(fistsID[0], containedAbilities[i]);
  6500. }
  6501. }
  6502. }
  6503.  
  6504.  
  6505. if(inv.IsItemAnyArmor(item))
  6506. {
  6507. armorType = inv.GetArmorType(item);
  6508. pam = (W3PlayerAbilityManager)abilityManager;
  6509.  
  6510. if(CanUseSkill(S_Perk_05) && (armorType == EAT_Light || GetCharacterStats().HasAbility('Glyphword 2 _Stats', true) || inv.ItemHasAbility(item, 'Glyphword 2 _Stats')))
  6511. {
  6512. pam.SetPerkArmorBonus(S_Perk_05);
  6513. }
  6514. if(CanUseSkill(S_Perk_06) && (armorType == EAT_Medium || GetCharacterStats().HasAbility('Glyphword 3 _Stats', true) || inv.ItemHasAbility(item, 'Glyphword 3 _Stats')) )
  6515. {
  6516. pam.SetPerkArmorBonus(S_Perk_06);
  6517. }
  6518. if(CanUseSkill(S_Perk_07) && (armorType == EAT_Heavy || GetCharacterStats().HasAbility('Glyphword 4 _Stats', true) || inv.ItemHasAbility(item, 'Glyphword 4 _Stats')) )
  6519. {
  6520. pam.SetPerkArmorBonus(S_Perk_07);
  6521. }
  6522. }
  6523.  
  6524.  
  6525. UpdateItemSetBonuses( item, false );
  6526.  
  6527.  
  6528. if( inv.ItemHasTag( item, theGame.params.ITEM_SET_TAG_BONUS ) && !IsSetBonusActive( EISB_RedWolf_2 ) )
  6529. {
  6530. SkillReduceBombAmmoBonus();
  6531. }
  6532.  
  6533. if( slot == EES_Gloves )
  6534. {
  6535. thePlayer.DestroyEffect('runeword_4');
  6536. }
  6537.  
  6538.  
  6539. hud = (CR4ScriptedHud)theGame.GetHud();
  6540. if ( hud )
  6541. {
  6542. damagedItemModule = hud.GetDamagedItemModule();
  6543. if ( damagedItemModule )
  6544. {
  6545. damagedItemModule.OnItemUnequippedFromSlot( slot );
  6546. }
  6547. }
  6548.  
  6549.  
  6550. theGame.GetGlobalEventsManager().OnScriptedEvent( SEC_OnItemEquipped );
  6551.  
  6552. return retBool;
  6553. }
  6554.  
  6555. public function UnequipItem(item : SItemUniqueId) : bool
  6556. {
  6557. if(!inv.IsIdValid(item))
  6558. return false;
  6559.  
  6560. return UnequipItemFromSlot( itemSlots.FindFirst(item) );
  6561. }
  6562.  
  6563. public function DropItem( item : SItemUniqueId, quantity : int ) : bool
  6564. {
  6565. if(!inv.IsIdValid(item))
  6566. return false;
  6567. if(IsItemEquipped(item))
  6568. return UnequipItem(item);
  6569.  
  6570. return true;
  6571. }
  6572.  
  6573.  
  6574. public function IsItemEquippedByName(itemName : name) : bool
  6575. {
  6576. var i : int;
  6577.  
  6578. for(i=0; i<itemSlots.Size(); i+=1)
  6579. if(inv.GetItemName(itemSlots[i]) == itemName)
  6580. return true;
  6581.  
  6582. return false;
  6583. }
  6584.  
  6585.  
  6586. public function IsItemEquippedByCategoryName(categoryName : name) : bool
  6587. {
  6588. var i : int;
  6589.  
  6590. for(i=0; i<itemSlots.Size(); i+=1)
  6591. if(inv.GetItemCategory(itemSlots[i]) == categoryName)
  6592. return true;
  6593.  
  6594. return false;
  6595. }
  6596.  
  6597. public function GetMaxRunEncumbrance(out usesHorseBonus : bool) : float
  6598. {
  6599. var value : float;
  6600.  
  6601. value = CalculateAttributeValue(GetHorseManager().GetHorseAttributeValue('encumbrance', false));
  6602. usesHorseBonus = (value > 0);
  6603. value += CalculateAttributeValue( GetAttributeValue('encumbrance') );
  6604.  
  6605. return value;
  6606. }
  6607.  
  6608. public function GetEncumbrance() : float
  6609. {
  6610. var i: int;
  6611. var encumbrance : float;
  6612. var items : array<SItemUniqueId>;
  6613. var inve : CInventoryComponent;
  6614.  
  6615. inve = GetInventory();
  6616. inve.GetAllItems(items);
  6617.  
  6618. for(i=0; i<items.Size(); i+=1)
  6619. {
  6620. encumbrance += inve.GetItemEncumbrance( items[i] );
  6621.  
  6622.  
  6623.  
  6624. }
  6625. return encumbrance;
  6626. }
  6627.  
  6628.  
  6629.  
  6630. public function StartInvUpdateTransaction():void
  6631. {
  6632. invUpdateTransaction = true;
  6633. }
  6634.  
  6635. public function FinishInvUpdateTransaction():void
  6636. {
  6637. invUpdateTransaction = false;
  6638.  
  6639.  
  6640.  
  6641. UpdateEncumbrance();
  6642. }
  6643.  
  6644.  
  6645. public function UpdateEncumbrance()
  6646. {
  6647. var temp : bool;
  6648.  
  6649. if (invUpdateTransaction)
  6650. {
  6651.  
  6652. return;
  6653. }
  6654.  
  6655.  
  6656.  
  6657. if ( GetEncumbrance() >= (GetMaxRunEncumbrance(temp) + 1) )
  6658. {
  6659. if( !HasBuff(EET_OverEncumbered) && FactsQuerySum( "DEBUG_EncumbranceBoy" ) == 0 )
  6660. {
  6661. AddEffectDefault(EET_OverEncumbered, NULL, "OverEncumbered");
  6662. }
  6663. }
  6664. else if(HasBuff(EET_OverEncumbered))
  6665. {
  6666. RemoveAllBuffsOfType(EET_OverEncumbered);
  6667. }
  6668. }
  6669.  
  6670. public final function GetSkillGroupIDFromIndex(idx : int) : int
  6671. {
  6672. var pam : W3PlayerAbilityManager;
  6673.  
  6674. pam = (W3PlayerAbilityManager)abilityManager;
  6675. if(pam && pam.IsInitialized())
  6676. return pam.GetSkillGroupIDFromIndex(idx);
  6677.  
  6678. return -1;
  6679. }
  6680.  
  6681. public final function GetSkillGroupColor(groupID : int) : ESkillColor
  6682. {
  6683. var pam : W3PlayerAbilityManager;
  6684.  
  6685. pam = (W3PlayerAbilityManager)abilityManager;
  6686. if(pam && pam.IsInitialized())
  6687. return pam.GetSkillGroupColor(groupID);
  6688.  
  6689. return SC_None;
  6690. }
  6691.  
  6692. public final function GetSkillGroupsCount() : int
  6693. {
  6694. var pam : W3PlayerAbilityManager;
  6695.  
  6696. pam = (W3PlayerAbilityManager)abilityManager;
  6697. if(pam && pam.IsInitialized())
  6698. return pam.GetSkillGroupsCount();
  6699.  
  6700. return 0;
  6701. }
  6702.  
  6703.  
  6704.  
  6705.  
  6706.  
  6707.  
  6708.  
  6709.  
  6710. function CycleSelectSign( bIsCyclingLeft : bool ) : ESignType
  6711. {
  6712. var signOrder : array<ESignType>;
  6713. var i : int;
  6714.  
  6715. signOrder.PushBack( ST_Yrden );
  6716. signOrder.PushBack( ST_Quen );
  6717. signOrder.PushBack( ST_Igni );
  6718. signOrder.PushBack( ST_Axii );
  6719. signOrder.PushBack( ST_Aard );
  6720.  
  6721. for( i = 0; i < signOrder.Size(); i += 1 )
  6722. if( signOrder[i] == equippedSign )
  6723. break;
  6724.  
  6725. if(bIsCyclingLeft)
  6726. return signOrder[ (4 + i) % 5 ];
  6727. else
  6728. return signOrder[ (6 + i) % 5 ];
  6729. }
  6730.  
  6731. function ToggleNextSign()
  6732. {
  6733. SetEquippedSign(CycleSelectSign( false ));
  6734. FactsAdd("SignToggled", 1, 1);
  6735. }
  6736.  
  6737. function TogglePreviousSign()
  6738. {
  6739. SetEquippedSign(CycleSelectSign( true ));
  6740. FactsAdd("SignToggled", 1, 1);
  6741. }
  6742.  
  6743. function ProcessSignEvent( eventName : name ) : bool
  6744. {
  6745. if( currentlyCastSign != ST_None && signs[currentlyCastSign].entity)
  6746. {
  6747. return signs[currentlyCastSign].entity.OnProcessSignEvent( eventName );
  6748. }
  6749.  
  6750. return false;
  6751. }
  6752.  
  6753. var findActorTargetTimeStamp : float;
  6754. var pcModeChanneledSignTimeStamp : float;
  6755. event OnProcessCastingOrientation( isContinueCasting : bool )
  6756. {
  6757. var customOrientationTarget : EOrientationTarget;
  6758. var checkHeading : float;
  6759. var rotHeading : float;
  6760. var playerToHeadingDist : float;
  6761. var slideTargetActor : CActor;
  6762. var newLockTarget : CActor;
  6763.  
  6764. var enableNoTargetOrientation : bool;
  6765.  
  6766. var currTime : float;
  6767.  
  6768. enableNoTargetOrientation = true;
  6769. if ( GetDisplayTarget() && this.IsDisplayTargetTargetable() )
  6770. {
  6771. enableNoTargetOrientation = false;
  6772. if ( theInput.GetActionValue( 'CastSignHold' ) > 0 || this.IsCurrentSignChanneled() )
  6773. {
  6774. if ( IsPCModeEnabled() )
  6775. {
  6776. if ( EngineTimeToFloat( theGame.GetEngineTime() ) > pcModeChanneledSignTimeStamp + 1.f )
  6777. enableNoTargetOrientation = true;
  6778. }
  6779. else
  6780. {
  6781. if ( GetCurrentlyCastSign() == ST_Igni || GetCurrentlyCastSign() == ST_Axii )
  6782. {
  6783. slideTargetActor = (CActor)GetDisplayTarget();
  6784. if ( slideTargetActor
  6785. && ( !slideTargetActor.GetGameplayVisibility() || !CanBeTargetedIfSwimming( slideTargetActor ) || !slideTargetActor.IsAlive() ) )
  6786. {
  6787. SetSlideTarget( NULL );
  6788. if ( ProcessLockTarget() )
  6789. slideTargetActor = (CActor)slideTarget;
  6790. }
  6791.  
  6792. if ( !slideTargetActor )
  6793. {
  6794. LockToTarget( false );
  6795. enableNoTargetOrientation = true;
  6796. }
  6797. else if ( IsThreat( slideTargetActor ) || GetCurrentlyCastSign() == ST_Axii )
  6798. LockToTarget( true );
  6799. else
  6800. {
  6801. LockToTarget( false );
  6802. enableNoTargetOrientation = true;
  6803. }
  6804. }
  6805. }
  6806. }
  6807.  
  6808. if ( !enableNoTargetOrientation )
  6809. {
  6810. customOrientationTarget = OT_Actor;
  6811. }
  6812. }
  6813.  
  6814. if ( enableNoTargetOrientation )
  6815. {
  6816. if ( GetPlayerCombatStance() == PCS_AlertNear && theInput.GetActionValue( 'CastSignHold' ) > 0 )
  6817. {
  6818. if ( GetDisplayTarget() && !slideTargetActor )
  6819. {
  6820. currTime = EngineTimeToFloat( theGame.GetEngineTime() );
  6821. if ( currTime > findActorTargetTimeStamp + 1.5f )
  6822. {
  6823. findActorTargetTimeStamp = currTime;
  6824.  
  6825. newLockTarget = GetScreenSpaceLockTarget( GetDisplayTarget(), 180.f, 1.f, 0.f, true );
  6826.  
  6827. if ( newLockTarget && IsThreat( newLockTarget ) && IsCombatMusicEnabled() )
  6828. {
  6829. SetTarget( newLockTarget, true );
  6830. SetMoveTargetChangeAllowed( true );
  6831. SetMoveTarget( newLockTarget );
  6832. SetMoveTargetChangeAllowed( false );
  6833. SetSlideTarget( newLockTarget );
  6834. }
  6835. }
  6836. }
  6837. else
  6838. ProcessLockTarget();
  6839. }
  6840.  
  6841. if ( wasBRAxisPushed )
  6842. customOrientationTarget = OT_CameraOffset;
  6843. else
  6844. {
  6845. if ( !lastAxisInputIsMovement || theInput.LastUsedPCInput() )
  6846. customOrientationTarget = OT_CameraOffset;
  6847. else if ( theInput.GetActionValue( 'CastSignHold' ) > 0 )
  6848. {
  6849. if ( GetOrientationTarget() == OT_CameraOffset )
  6850. customOrientationTarget = OT_CameraOffset;
  6851. else if ( GetPlayerCombatStance() == PCS_AlertNear || GetPlayerCombatStance() == PCS_Guarded )
  6852. customOrientationTarget = OT_CameraOffset;
  6853. else
  6854. customOrientationTarget = OT_Player;
  6855. }
  6856. else
  6857. customOrientationTarget = OT_CustomHeading;
  6858. }
  6859. }
  6860.  
  6861. if ( GetCurrentlyCastSign() == ST_Quen )
  6862. {
  6863. if ( theInput.LastUsedPCInput() )
  6864. {
  6865. customOrientationTarget = OT_Camera;
  6866. }
  6867. else if ( IsCurrentSignChanneled() )
  6868. {
  6869. if ( bLAxisReleased )
  6870. customOrientationTarget = OT_Player;
  6871. else
  6872. customOrientationTarget = OT_Camera;
  6873. }
  6874. else
  6875. customOrientationTarget = OT_Player;
  6876. }
  6877.  
  6878. if ( GetCurrentlyCastSign() == ST_Axii && IsCurrentSignChanneled() )
  6879. {
  6880. if ( slideTarget && (CActor)slideTarget )
  6881. {
  6882. checkHeading = VecHeading( slideTarget.GetWorldPosition() - this.GetWorldPosition() );
  6883. rotHeading = checkHeading;
  6884. playerToHeadingDist = AngleDistance( GetHeading(), checkHeading );
  6885.  
  6886. if ( playerToHeadingDist > 45 )
  6887. SetCustomRotation( 'ChanneledSignAxii', rotHeading, 0.0, 0.5, false );
  6888. else if ( playerToHeadingDist < -45 )
  6889. SetCustomRotation( 'ChanneledSignAxii', rotHeading, 0.0, 0.5, false );
  6890. }
  6891. else
  6892. {
  6893. checkHeading = VecHeading( theCamera.GetCameraDirection() );
  6894. rotHeading = GetHeading();
  6895. playerToHeadingDist = AngleDistance( GetHeading(), checkHeading );
  6896.  
  6897. if ( playerToHeadingDist > 45 )
  6898. SetCustomRotation( 'ChanneledSignAxii', rotHeading - 22.5, 0.0, 0.5, false );
  6899. else if ( playerToHeadingDist < -45 )
  6900. SetCustomRotation( 'ChanneledSignAxii', rotHeading + 22.5, 0.0, 0.5, false );
  6901. }
  6902. }
  6903.  
  6904. if ( IsActorLockedToTarget() )
  6905. customOrientationTarget = OT_Actor;
  6906.  
  6907. //modEnhancedTargeting BEGIN
  6908. if ( theGame.GetInGameConfigWrapper().GetVarValue('EnhancedTargeting', 'ETSignsTowardsCamera') )
  6909. customOrientationTarget = OT_CameraOffset; // shitty tweak, oh well
  6910. //modEnhancedTargeting END
  6911.  
  6912. AddCustomOrientationTarget( customOrientationTarget, 'Signs' );
  6913.  
  6914. if ( customOrientationTarget == OT_CustomHeading )
  6915. SetOrientationTargetCustomHeading( GetCombatActionHeading(), 'Signs' );
  6916. }
  6917.  
  6918. event OnRaiseSignEvent()
  6919. {
  6920. var newTarget : CActor;
  6921.  
  6922. if ( ( !IsCombatMusicEnabled() && !CanAttackWhenNotInCombat( EBAT_CastSign, false, newTarget ) ) || ( IsOnBoat() && !IsCombatMusicEnabled() ) )
  6923. {
  6924. if ( CastSignFriendly() )
  6925. return true;
  6926. }
  6927. else
  6928. {
  6929. RaiseEvent('CombatActionFriendlyEnd');
  6930. SetBehaviorVariable( 'SignNum', (int)equippedSign );
  6931. SetBehaviorVariable( 'combatActionType', (int)CAT_CastSign );
  6932.  
  6933. if ( IsPCModeEnabled() )
  6934. pcModeChanneledSignTimeStamp = EngineTimeToFloat( theGame.GetEngineTime() );
  6935.  
  6936. if( RaiseForceEvent('CombatAction') )
  6937. {
  6938. OnCombatActionStart();
  6939. findActorTargetTimeStamp = EngineTimeToFloat( theGame.GetEngineTime() );
  6940. theTelemetry.LogWithValueStr(TE_FIGHT_PLAYER_USE_SIGN, SignEnumToString( equippedSign ));
  6941. return true;
  6942. }
  6943. }
  6944.  
  6945. return false;
  6946. }
  6947.  
  6948. function CastSignFriendly() : bool
  6949. {
  6950. var actor : CActor;
  6951.  
  6952. SetBehaviorVariable( 'combatActionTypeForOverlay', (int)CAT_CastSign );
  6953. if ( RaiseCombatActionFriendlyEvent() )
  6954. {
  6955.  
  6956. return true;
  6957. }
  6958.  
  6959. return false;
  6960. }
  6961.  
  6962. function CastSign() : bool
  6963. {
  6964. var equippedSignStr : string;
  6965. var newSignEnt : W3SignEntity;
  6966. var spawnPos : Vector;
  6967. var slotMatrix : Matrix;
  6968. var target : CActor;
  6969.  
  6970. if ( IsInAir() )
  6971. {
  6972. return false;
  6973. }
  6974.  
  6975. AddTemporarySkills();
  6976.  
  6977.  
  6978.  
  6979. if(equippedSign == ST_Aard)
  6980. {
  6981. CalcEntitySlotMatrix('l_weapon', slotMatrix);
  6982. spawnPos = MatrixGetTranslation(slotMatrix);
  6983. }
  6984. else
  6985. {
  6986. spawnPos = GetWorldPosition();
  6987. }
  6988.  
  6989. if( equippedSign == ST_Aard || equippedSign == ST_Igni )
  6990. {
  6991. target = GetTarget();
  6992. if(target)
  6993. target.SignalGameplayEvent( 'DodgeSign' );
  6994. }
  6995.  
  6996. m_TriggerEffectDisablePending = true;
  6997. m_TriggerEffectDisableTTW = 0.3;
  6998.  
  6999. newSignEnt = (W3SignEntity)theGame.CreateEntity( signs[equippedSign].template, spawnPos, GetWorldRotation() );
  7000. return newSignEnt.Init( signOwner, signs[equippedSign].entity );
  7001. }
  7002.  
  7003.  
  7004. private function HAX_SignToThrowItemRestore()
  7005. {
  7006. var action : SInputAction;
  7007.  
  7008. action.value = theInput.GetActionValue('ThrowItemHold');
  7009. action.lastFrameValue = 0;
  7010.  
  7011. if(IsPressed(action) && CanSetupCombatAction_Throw())
  7012. {
  7013. if(inv.IsItemBomb(selectedItemId))
  7014. {
  7015. BombThrowStart();
  7016. }
  7017. else
  7018. {
  7019. UsableItemStart();
  7020. }
  7021.  
  7022. SetThrowHold( true );
  7023. }
  7024. }
  7025.  
  7026. event OnCFMCameraZoomFail(){}
  7027.  
  7028.  
  7029.  
  7030. public final function GetDrunkMutagens( optional sourceName : string ) : array<CBaseGameplayEffect>
  7031. {
  7032. return effectManager.GetDrunkMutagens( sourceName );
  7033. }
  7034.  
  7035. public final function GetPotionBuffs() : array<CBaseGameplayEffect>
  7036. {
  7037. return effectManager.GetPotionBuffs();
  7038. }
  7039.  
  7040. public final function RecalcPotionsDurations()
  7041. {
  7042. var i : int;
  7043. var buffs : array<CBaseGameplayEffect>;
  7044.  
  7045. buffs = GetPotionBuffs();
  7046. for(i=0; i<buffs.Size(); i+=1)
  7047. {
  7048. buffs[i].RecalcPotionDuration();
  7049. }
  7050. }
  7051.  
  7052. public function StartFrenzy()
  7053. {
  7054. var ratio, duration : float;
  7055. var skillLevel : int;
  7056.  
  7057. isInFrenzy = true;
  7058. skillLevel = GetSkillLevel(S_Alchemy_s16);
  7059. ratio = 0.48f - skillLevel * CalculateAttributeValue(GetSkillAttributeValue(S_Alchemy_s16, 'slowdown_ratio', false, true));
  7060. duration = skillLevel * CalculateAttributeValue(GetSkillAttributeValue(S_Alchemy_s16, 'slowdown_duration', false, true));
  7061.  
  7062. theGame.SetTimeScale(ratio, theGame.GetTimescaleSource(ETS_SkillFrenzy), theGame.GetTimescalePriority(ETS_SkillFrenzy) );
  7063. AddTimer('SkillFrenzyFinish', duration * ratio, , , , true);
  7064. }
  7065.  
  7066. timer function SkillFrenzyFinish(dt : float, optional id : int)
  7067. {
  7068. theGame.RemoveTimeScale( theGame.GetTimescaleSource(ETS_SkillFrenzy) );
  7069. isInFrenzy = false;
  7070. }
  7071.  
  7072. public function GetToxicityDamageThreshold() : float
  7073. {
  7074. var ret : float;
  7075.  
  7076. ret = theGame.params.TOXICITY_DAMAGE_THRESHOLD;
  7077.  
  7078. if(CanUseSkill(S_Alchemy_s01))
  7079. ret += CalculateAttributeValue(GetSkillAttributeValue(S_Alchemy_s01, 'threshold', false, true)) * GetSkillLevel(S_Alchemy_s01);
  7080.  
  7081. return ret;
  7082. }
  7083.  
  7084.  
  7085.  
  7086. public final function AddToxicityOffset( val : float)
  7087. {
  7088. ((W3PlayerAbilityManager)abilityManager).AddToxicityOffset(val);
  7089. }
  7090.  
  7091. public final function SetToxicityOffset( val : float)
  7092. {
  7093. ((W3PlayerAbilityManager)abilityManager).SetToxicityOffset(val);
  7094. }
  7095.  
  7096. public final function RemoveToxicityOffset( val : float)
  7097. {
  7098. ((W3PlayerAbilityManager)abilityManager).RemoveToxicityOffset(val);
  7099. }
  7100.  
  7101.  
  7102. public final function CalculatePotionDuration(item : SItemUniqueId, isMutagenPotion : bool, optional itemName : name) : float
  7103. {
  7104. var duration, skillPassiveMod, mutagenSkillMod : float;
  7105. var val, min, max : SAbilityAttributeValue;
  7106.  
  7107.  
  7108. if(inv.IsIdValid(item))
  7109. {
  7110. duration = CalculateAttributeValue(inv.GetItemAttributeValue(item, 'duration'));
  7111. }
  7112. else
  7113. {
  7114. theGame.GetDefinitionsManager().GetItemAttributeValueNoRandom(itemName, true, 'duration', min, max);
  7115. duration = CalculateAttributeValue(GetAttributeRandomizedValue(min, max));
  7116. }
  7117.  
  7118. skillPassiveMod = CalculateAttributeValue(GetAttributeValue('potion_duration'));
  7119.  
  7120. if(isMutagenPotion && CanUseSkill(S_Alchemy_s14))
  7121. {
  7122. val = GetSkillAttributeValue(S_Alchemy_s14, 'duration', false, true);
  7123. mutagenSkillMod = val.valueMultiplicative * GetSkillLevel(S_Alchemy_s14);
  7124. }
  7125.  
  7126. duration = duration * (1 + skillPassiveMod + mutagenSkillMod);
  7127.  
  7128.  
  7129. if( IsSetBonusActive( EISB_Netflix_1 ) )
  7130. {
  7131. duration += (duration * (amountOfSetPiecesEquipped[ EIST_Netflix ] * 7 )) / 100 ;
  7132. }
  7133.  
  7134. return duration;
  7135. }
  7136.  
  7137. public function ToxicityLowEnoughToDrinkPotion( slotid : EEquipmentSlots, optional itemId : SItemUniqueId ) : bool
  7138. {
  7139. var item : SItemUniqueId;
  7140. var maxTox : float;
  7141. var potionToxicity : float;
  7142. var toxicityOffset : float;
  7143. var effectType : EEffectType;
  7144. var customAbilityName : name;
  7145.  
  7146. if(itemId != GetInvalidUniqueId())
  7147. item = itemId;
  7148. else
  7149. item = itemSlots[slotid];
  7150.  
  7151. inv.GetPotionItemBuffData(item, effectType, customAbilityName);
  7152. maxTox = abilityManager.GetStatMax(BCS_Toxicity);
  7153. potionToxicity = CalculateAttributeValue(inv.GetItemAttributeValue(item, 'toxicity'));
  7154. toxicityOffset = CalculateAttributeValue(inv.GetItemAttributeValue(item, 'toxicity_offset'));
  7155.  
  7156. if(effectType != EET_WhiteHoney)
  7157. {
  7158. if(abilityManager.GetStat(BCS_Toxicity, false) + potionToxicity + toxicityOffset > maxTox )
  7159. {
  7160. return false;
  7161. }
  7162. }
  7163.  
  7164. return true;
  7165. }
  7166.  
  7167. public final function HasFreeToxicityToDrinkPotion( item : SItemUniqueId, effectType : EEffectType, out finalPotionToxicity : float ) : bool
  7168. {
  7169. var i : int;
  7170. var maxTox, toxicityOffset, adrenaline : float;
  7171. var costReduction : SAbilityAttributeValue;
  7172.  
  7173.  
  7174. if( effectType == EET_WhiteHoney )
  7175. {
  7176. return true;
  7177. }
  7178.  
  7179.  
  7180. maxTox = abilityManager.GetStatMax(BCS_Toxicity);
  7181. finalPotionToxicity = CalculateAttributeValue(inv.GetItemAttributeValue(item, 'toxicity'));
  7182. toxicityOffset = CalculateAttributeValue(inv.GetItemAttributeValue(item, 'toxicity_offset'));
  7183.  
  7184.  
  7185. if(CanUseSkill(S_Perk_13))
  7186. {
  7187. costReduction = GetSkillAttributeValue(S_Perk_13, 'cost_reduction', false, true);
  7188. adrenaline = FloorF(GetStat(BCS_Focus));
  7189. costReduction = costReduction * adrenaline;
  7190. finalPotionToxicity = (finalPotionToxicity - costReduction.valueBase) * (1 - costReduction.valueMultiplicative) - costReduction.valueAdditive;
  7191. finalPotionToxicity = MaxF(0.f, finalPotionToxicity);
  7192. }
  7193.  
  7194.  
  7195. if(abilityManager.GetStat(BCS_Toxicity, false) + finalPotionToxicity + toxicityOffset > maxTox )
  7196. {
  7197. return false;
  7198. }
  7199.  
  7200. return true;
  7201. }
  7202.  
  7203. public function DrinkPreparedPotion( slotid : EEquipmentSlots, optional itemId : SItemUniqueId )
  7204. {
  7205. var potParams : W3PotionParams;
  7206. var potionParams : SCustomEffectParams;
  7207. var factPotionParams : W3Potion_Fact_Params;
  7208. var adrenaline, hpGainValue, duration, finalPotionToxicity : float;
  7209. var ret : EEffectInteract;
  7210. var effectType : EEffectType;
  7211. var item : SItemUniqueId;
  7212. var customAbilityName, factId : name;
  7213. var atts : array<name>;
  7214. var i : int;
  7215. var mutagenParams : W3MutagenBuffCustomParams;
  7216.  
  7217.  
  7218. if(itemId != GetInvalidUniqueId())
  7219. item = itemId;
  7220. else
  7221. item = itemSlots[slotid];
  7222.  
  7223.  
  7224. if(!inv.IsIdValid(item))
  7225. return;
  7226.  
  7227.  
  7228. if( inv.SingletonItemGetAmmo(item) == 0 )
  7229. return;
  7230.  
  7231.  
  7232. inv.GetPotionItemBuffData(item, effectType, customAbilityName);
  7233.  
  7234.  
  7235. if( !HasFreeToxicityToDrinkPotion( item, effectType, finalPotionToxicity ) )
  7236. {
  7237. return;
  7238. }
  7239.  
  7240.  
  7241. if(effectType == EET_Fact)
  7242. {
  7243. inv.GetItemAttributes(item, atts);
  7244.  
  7245. for(i=0; i<atts.Size(); i+=1)
  7246. {
  7247. if(StrBeginsWith(NameToString(atts[i]), "fact_"))
  7248. {
  7249. factId = atts[i];
  7250. break;
  7251. }
  7252. }
  7253.  
  7254. factPotionParams = new W3Potion_Fact_Params in theGame;
  7255. factPotionParams.factName = factId;
  7256. factPotionParams.potionItemName = inv.GetItemName(item);
  7257.  
  7258. potionParams.buffSpecificParams = factPotionParams;
  7259. }
  7260.  
  7261. else if(inv.ItemHasTag( item, 'Mutagen' ))
  7262. {
  7263. mutagenParams = new W3MutagenBuffCustomParams in theGame;
  7264. mutagenParams.toxicityOffset = CalculateAttributeValue(inv.GetItemAttributeValue(item, 'toxicity_offset'));
  7265. mutagenParams.potionItemName = inv.GetItemName(item);
  7266.  
  7267. finalPotionToxicity += 0.001f;
  7268.  
  7269. potionParams.buffSpecificParams = mutagenParams;
  7270.  
  7271. if( IsMutationActive( EPMT_Mutation10 ) && !HasBuff( EET_Mutation10 ) )
  7272. {
  7273. AddEffectDefault( EET_Mutation10, this, "Mutation 10" );
  7274. }
  7275. }
  7276.  
  7277. else
  7278. {
  7279. potParams = new W3PotionParams in theGame;
  7280. potParams.potionItemName = inv.GetItemName(item);
  7281.  
  7282. potionParams.buffSpecificParams = potParams;
  7283. }
  7284.  
  7285.  
  7286. duration = CalculatePotionDuration(item, inv.ItemHasTag( item, 'Mutagen' ));
  7287.  
  7288.  
  7289. potionParams.effectType = effectType;
  7290. potionParams.creator = this;
  7291. potionParams.sourceName = "drank_potion";
  7292. potionParams.duration = duration;
  7293. potionParams.customAbilityName = customAbilityName;
  7294. ret = AddEffectCustom(potionParams);
  7295.  
  7296.  
  7297. if(factPotionParams)
  7298. delete factPotionParams;
  7299.  
  7300. if(mutagenParams)
  7301. delete mutagenParams;
  7302.  
  7303.  
  7304. inv.SingletonItemRemoveAmmo(item);
  7305.  
  7306.  
  7307. if(ret == EI_Pass || ret == EI_Override || ret == EI_Cumulate)
  7308. {
  7309. if( finalPotionToxicity > 0.f )
  7310. {
  7311. abilityManager.GainStat(BCS_Toxicity, finalPotionToxicity );
  7312. }
  7313.  
  7314.  
  7315. if(CanUseSkill(S_Perk_13))
  7316. {
  7317. abilityManager.DrainFocus(adrenaline);
  7318. }
  7319.  
  7320. if (!IsEffectActive('invisible'))
  7321. {
  7322. PlayEffect('use_potion');
  7323. }
  7324.  
  7325. if ( inv.ItemHasTag( item, 'Mutagen' ) )
  7326. {
  7327.  
  7328. theGame.GetGamerProfile().CheckTrialOfGrasses();
  7329.  
  7330.  
  7331. SetFailedFundamentalsFirstAchievementCondition(true);
  7332. }
  7333.  
  7334.  
  7335. if(CanUseSkill(S_Alchemy_s02))
  7336. {
  7337. hpGainValue = ClampF(GetStatMax(BCS_Vitality) * CalculateAttributeValue(GetSkillAttributeValue(S_Alchemy_s02, 'vitality_gain_perc', false, true)) * GetSkillLevel(S_Alchemy_s02), 0, GetStatMax(BCS_Vitality));
  7338. GainStat(BCS_Vitality, hpGainValue);
  7339. }
  7340.  
  7341.  
  7342. if(CanUseSkill(S_Alchemy_s04) && !skillBonusPotionEffect && (RandF() < CalculateAttributeValue(GetSkillAttributeValue(S_Alchemy_s04, 'apply_chance', false, true)) * GetSkillLevel(S_Alchemy_s04)))
  7343. {
  7344. AddRandomPotionEffectFromAlch4Skill( effectType );
  7345. }
  7346.  
  7347. theGame.GetGamerProfile().SetStat(ES_ActivePotions, effectManager.GetPotionBuffsCount());
  7348. }
  7349.  
  7350. theTelemetry.LogWithLabel(TE_ELIXIR_USED, inv.GetItemName(item));
  7351.  
  7352. if(ShouldProcessTutorial('TutorialPotionAmmo'))
  7353. {
  7354. FactsAdd("tut_used_potion");
  7355. }
  7356.  
  7357. SetFailedFundamentalsFirstAchievementCondition(true);
  7358. }
  7359.  
  7360.  
  7361. private final function AddRandomPotionEffectFromAlch4Skill( currentlyDrankPotion : EEffectType )
  7362. {
  7363. var randomPotions : array<EEffectType>;
  7364. var currentPotion : CBaseGameplayEffect;
  7365. var effectsOld, effectsNew : array<CBaseGameplayEffect>;
  7366. var i, ind : int;
  7367. var duration : float;
  7368. var params : SCustomEffectParams;
  7369. var ret : EEffectInteract;
  7370.  
  7371.  
  7372. randomPotions.PushBack( EET_BlackBlood );
  7373. randomPotions.PushBack( EET_Blizzard );
  7374. randomPotions.PushBack( EET_FullMoon );
  7375. randomPotions.PushBack( EET_GoldenOriole );
  7376.  
  7377. randomPotions.PushBack( EET_MariborForest );
  7378. randomPotions.PushBack( EET_PetriPhiltre );
  7379. randomPotions.PushBack( EET_Swallow );
  7380. randomPotions.PushBack( EET_TawnyOwl );
  7381. randomPotions.PushBack( EET_Thunderbolt );
  7382.  
  7383.  
  7384. randomPotions.Remove( currentlyDrankPotion );
  7385.  
  7386.  
  7387. ind = RandRange( randomPotions.Size() );
  7388.  
  7389.  
  7390. if( HasBuff( randomPotions[ ind ] ) )
  7391. {
  7392. currentPotion = GetBuff( randomPotions[ ind ] );
  7393. currentPotion.SetTimeLeft( currentPotion.GetInitialDurationAfterResists() );
  7394. }
  7395.  
  7396. else
  7397. {
  7398. duration = BonusPotionGetDurationFromXML( randomPotions[ ind ] );
  7399.  
  7400. if(duration > 0)
  7401. {
  7402. effectsOld = GetCurrentEffects();
  7403.  
  7404. params.effectType = randomPotions[ ind ];
  7405. params.creator = this;
  7406. params.sourceName = SkillEnumToName( S_Alchemy_s04 );
  7407. params.duration = duration;
  7408. ret = AddEffectCustom( params );
  7409.  
  7410.  
  7411. if( ret != EI_Undefined && ret != EI_Deny )
  7412. {
  7413. effectsNew = GetCurrentEffects();
  7414.  
  7415. ind = -1;
  7416. for( i=effectsNew.Size()-1; i>=0; i-=1)
  7417. {
  7418. if( !effectsOld.Contains( effectsNew[i] ) )
  7419. {
  7420. ind = i;
  7421. break;
  7422. }
  7423. }
  7424.  
  7425. if(ind > -1)
  7426. {
  7427. skillBonusPotionEffect = effectsNew[ind];
  7428. }
  7429. }
  7430. }
  7431. }
  7432. }
  7433.  
  7434.  
  7435. private function BonusPotionGetDurationFromXML(type : EEffectType) : float
  7436. {
  7437. var dm : CDefinitionsManagerAccessor;
  7438. var main, ingredients : SCustomNode;
  7439. var tmpName, typeName, itemName : name;
  7440. var abs : array<name>;
  7441. var min, max : SAbilityAttributeValue;
  7442. var tmpInt : int;
  7443. var temp : array<float>;
  7444. var i, temp2, temp3 : int;
  7445.  
  7446. dm = theGame.GetDefinitionsManager();
  7447. main = dm.GetCustomDefinition('alchemy_recipes');
  7448. typeName = EffectTypeToName(type);
  7449.  
  7450.  
  7451. for(i=0; i<main.subNodes.Size(); i+=1)
  7452. {
  7453. if(dm.GetCustomNodeAttributeValueName(main.subNodes[i], 'type_name', tmpName))
  7454. {
  7455.  
  7456. if(tmpName == typeName)
  7457. {
  7458. if(dm.GetCustomNodeAttributeValueInt(main.subNodes[i], 'level', tmpInt))
  7459. {
  7460.  
  7461. if(tmpInt == 1)
  7462. {
  7463. if(dm.GetCustomNodeAttributeValueName(main.subNodes[i], 'cookedItem_name', itemName))
  7464. {
  7465.  
  7466. if(IsNameValid(itemName))
  7467. {
  7468. break;
  7469. }
  7470. }
  7471. }
  7472. }
  7473. }
  7474. }
  7475. }
  7476.  
  7477. if(!IsNameValid(itemName))
  7478. return 0;
  7479.  
  7480.  
  7481. dm.GetItemAbilitiesWithWeights(itemName, true, abs, temp, temp2, temp3);
  7482. dm.GetAbilitiesAttributeValue(abs, 'duration', min, max);
  7483. return CalculateAttributeValue(GetAttributeRandomizedValue(min, max));
  7484. }
  7485.  
  7486. public function ClearSkillBonusPotionEffect()
  7487. {
  7488. skillBonusPotionEffect = NULL;
  7489. }
  7490.  
  7491. public function GetSkillBonusPotionEffect() : CBaseGameplayEffect
  7492. {
  7493. return skillBonusPotionEffect;
  7494. }
  7495.  
  7496.  
  7497.  
  7498.  
  7499.  
  7500.  
  7501.  
  7502. public final function HasRunewordActive(abilityName : name) : bool
  7503. {
  7504. var item : SItemUniqueId;
  7505. var hasRuneword : bool;
  7506.  
  7507. if(GetItemEquippedOnSlot(EES_SteelSword, item))
  7508. {
  7509. hasRuneword = inv.ItemHasAbility(item, abilityName);
  7510. }
  7511.  
  7512. if(!hasRuneword)
  7513. {
  7514. if(GetItemEquippedOnSlot(EES_SilverSword, item))
  7515. {
  7516. hasRuneword = inv.ItemHasAbility(item, abilityName);
  7517. }
  7518. }
  7519.  
  7520. return hasRuneword;
  7521. }
  7522.  
  7523. public final function GetShrineBuffs() : array<CBaseGameplayEffect>
  7524. {
  7525. var null : array<CBaseGameplayEffect>;
  7526.  
  7527. if(effectManager && effectManager.IsReady())
  7528. return effectManager.GetShrineBuffs();
  7529.  
  7530. return null;
  7531. }
  7532.  
  7533. public final function AddRepairObjectBuff(armor : bool, weapon : bool) : bool
  7534. {
  7535. var added : bool;
  7536.  
  7537. added = false;
  7538.  
  7539. if(weapon && (IsAnyItemEquippedOnSlot(EES_SilverSword) || IsAnyItemEquippedOnSlot(EES_SteelSword)) )
  7540. {
  7541. AddEffectDefault(EET_EnhancedWeapon, this, "repair_object", false);
  7542. added = true;
  7543. }
  7544.  
  7545. if(armor && (IsAnyItemEquippedOnSlot(EES_Armor) || IsAnyItemEquippedOnSlot(EES_Gloves) || IsAnyItemEquippedOnSlot(EES_Boots) || IsAnyItemEquippedOnSlot(EES_Pants)) )
  7546. {
  7547. AddEffectDefault(EET_EnhancedArmor, this, "repair_object", false);
  7548. added = true;
  7549. }
  7550.  
  7551. return added;
  7552. }
  7553.  
  7554.  
  7555. public function StartCSAnim(buff : CBaseGameplayEffect) : bool
  7556. {
  7557.  
  7558. if(IsAnyQuenActive() && (W3CriticalDOTEffect)buff)
  7559. return false;
  7560.  
  7561. return super.StartCSAnim(buff);
  7562. }
  7563.  
  7564. public function GetPotionBuffLevel(effectType : EEffectType) : int
  7565. {
  7566. if(effectManager && effectManager.IsReady())
  7567. return effectManager.GetPotionBuffLevel(effectType);
  7568.  
  7569. return 0;
  7570. }
  7571.  
  7572.  
  7573.  
  7574.  
  7575.  
  7576.  
  7577.  
  7578. event OnLevelGained(currentLevel : int, show : bool)
  7579. {
  7580.  
  7581. var swords : array<SItemUniqueId>;
  7582. var i : int;
  7583.  
  7584.  
  7585. var hud : CR4ScriptedHud;
  7586. hud = (CR4ScriptedHud)theGame.GetHud();
  7587.  
  7588. if(abilityManager && abilityManager.IsInitialized())
  7589. {
  7590. ((W3PlayerAbilityManager)abilityManager).OnLevelGained(currentLevel);
  7591. }
  7592.  
  7593. if ( theGame.GetDifficultyMode() != EDM_Hardcore )
  7594. {
  7595. Heal(GetStatMax(BCS_Vitality));
  7596. }
  7597.  
  7598.  
  7599. if(currentLevel >= 35)
  7600. {
  7601. theGame.GetGamerProfile().AddAchievement(EA_Immortal);
  7602. }
  7603. else
  7604. {
  7605. theGame.GetGamerProfile().NoticeAchievementProgress(EA_Immortal, currentLevel);
  7606. }
  7607.  
  7608. if ( hud && currentLevel < levelManager.GetMaxLevel() && FactsQuerySum( "DebugNoLevelUpUpdates" ) == 0 )
  7609. {
  7610. hud.OnLevelUpUpdate(currentLevel, show);
  7611. }
  7612.  
  7613.  
  7614. swords = inv.GetItemsByName('sq304 Novigraadan sword 4');
  7615. for(i=0;i<swords.Size();i+=1)
  7616. {
  7617. inv.AddItemCraftedAbility(swords[i], 'sq304_sword_upgrade _Stats', true);
  7618. }
  7619.  
  7620. swords.Clear();
  7621. swords = inv.GetItemsByName('q402 Skellige sword 3');
  7622. for(i=0;i<swords.Size();i+=1)
  7623. {
  7624. inv.AddItemCraftedAbility(swords[i], 'q402_sword_upgrade _Stats', true);
  7625. }
  7626.  
  7627. ESGOAutoLevelGear(); // ESGO
  7628.  
  7629. theGame.RequestAutoSave( "level gained", false );
  7630. }
  7631.  
  7632. public function GetSignStats(skill : ESkill, out damageType : name, out damageVal : float, out spellPower : SAbilityAttributeValue)
  7633. {
  7634. var i, size : int;
  7635. var dm : CDefinitionsManagerAccessor;
  7636. var attrs : array<name>;
  7637.  
  7638. spellPower = GetPowerStatValue(CPS_SpellPower);
  7639.  
  7640. dm = theGame.GetDefinitionsManager();
  7641. dm.GetAbilityAttributes(GetSkillAbilityName(skill), attrs);
  7642. size = attrs.Size();
  7643.  
  7644. for( i = 0; i < size; i += 1 )
  7645. {
  7646. if( IsDamageTypeNameValid(attrs[i]) )
  7647. {
  7648. damageVal = CalculateAttributeValue(GetSkillAttributeValue(skill, attrs[i], false, true));
  7649. damageType = attrs[i];
  7650. break;
  7651. }
  7652. }
  7653. }
  7654.  
  7655.  
  7656. public function SetIgnorePainMaxVitality(val : float)
  7657. {
  7658. if(abilityManager && abilityManager.IsInitialized())
  7659. abilityManager.SetStatPointMax(BCS_Vitality, val);
  7660. }
  7661.  
  7662. event OnAnimEvent_ActionBlend( animEventName : name, animEventType : EAnimationEventType, animInfo : SAnimationEventAnimInfo )
  7663. {
  7664. if ( animEventType == AET_DurationStart && !disableActionBlend )
  7665. {
  7666. if ( this.IsCastingSign() )
  7667. ProcessSignEvent( 'cast_end' );
  7668.  
  7669.  
  7670. FindMoveTarget();
  7671. SetCanPlayHitAnim( true );
  7672. this.SetBIsCombatActionAllowed( true );
  7673.  
  7674. if ( this.GetFinisherVictim() && this.GetFinisherVictim().HasAbility( 'ForceFinisher' ) && !isInFinisher )
  7675. {
  7676. this.GetFinisherVictim().SignalGameplayEvent( 'Finisher' );
  7677. }
  7678. else if (this.BufferCombatAction != EBAT_EMPTY )
  7679. {
  7680.  
  7681.  
  7682.  
  7683. if ( !IsCombatMusicEnabled() )
  7684. {
  7685. SetCombatActionHeading( ProcessCombatActionHeading( this.BufferCombatAction ) );
  7686. FindTarget();
  7687. UpdateDisplayTarget( true );
  7688. }
  7689.  
  7690. if ( AllowAttack( GetTarget(), this.BufferCombatAction ) )
  7691. this.ProcessCombatActionBuffer();
  7692. }
  7693. else
  7694. {
  7695.  
  7696. ResumeStaminaRegen( 'InsideCombatAction' );
  7697.  
  7698.  
  7699.  
  7700. }
  7701. }
  7702. else if ( disableActionBlend )
  7703. {
  7704. disableActionBlend = false;
  7705. }
  7706. }
  7707.  
  7708.  
  7709. event OnAnimEvent_Sign( animEventName : name, animEventType : EAnimationEventType, animInfo : SAnimationEventAnimInfo )
  7710. {
  7711. if( animEventType == AET_Tick )
  7712. {
  7713. ProcessSignEvent( animEventName );
  7714. }
  7715. }
  7716.  
  7717. event OnAnimEvent_Throwable( animEventName : name, animEventType : EAnimationEventType, animInfo : SAnimationEventAnimInfo )
  7718. {
  7719. var thrownEntity : CThrowable;
  7720.  
  7721. thrownEntity = (CThrowable)EntityHandleGet( thrownEntityHandle );
  7722.  
  7723. if ( inv.IsItemCrossbow( inv.GetItemFromSlot('l_weapon') ) && rangedWeapon.OnProcessThrowEvent( animEventName ) )
  7724. {
  7725. return true;
  7726. }
  7727. else if( thrownEntity && IsThrowingItem() && thrownEntity.OnProcessThrowEvent( animEventName ) )
  7728. {
  7729. return true;
  7730. }
  7731. }
  7732.  
  7733. event OnTaskSyncAnim( npc : CNewNPC, animNameLeft : name )
  7734. {
  7735. var tmpBool : bool;
  7736. var tmpName : name;
  7737. var damage, points, resistance : float;
  7738. var min, max : SAbilityAttributeValue;
  7739. var mc : EMonsterCategory;
  7740.  
  7741. super.OnTaskSyncAnim( npc, animNameLeft );
  7742.  
  7743. if( animNameLeft == 'BruxaBite' && IsMutationActive( EPMT_Mutation4 ) )
  7744. {
  7745. theGame.GetMonsterParamsForActor( npc, mc, tmpName, tmpBool, tmpBool, tmpBool );
  7746.  
  7747. if( mc == MC_Vampire )
  7748. {
  7749. GetResistValue( CDS_BleedingRes, points, resistance );
  7750.  
  7751. theGame.GetDefinitionsManager().GetAbilityAttributeValue( 'BleedingEffect', 'DirectDamage', min, max );
  7752. damage = MaxF( 0.f, max.valueMultiplicative * GetMaxHealth() - points );
  7753.  
  7754. theGame.GetDefinitionsManager().GetAbilityAttributeValue( 'BleedingEffect', 'duration', min, max );
  7755. damage *= min.valueAdditive * ( 1 - MinF( 1.f, resistance ) );
  7756.  
  7757. if( damage > 0.f )
  7758. {
  7759. npc.AddAbility( 'Mutation4BloodDebuff' );
  7760. ProcessActionMutation4ReturnedDamage( damage, npc, EAHA_ForceNo );
  7761. npc.AddTimer( 'RemoveMutation4BloodDebuff', 15.f, , , , , true );
  7762. }
  7763. }
  7764. }
  7765. }
  7766.  
  7767.  
  7768. public function ProcessActionMutation4ReturnedDamage( damageDealt : float, attacker : CActor, hitAnimationType : EActionHitAnim, optional action : W3DamageAction ) : bool
  7769. {
  7770. var customParams : SCustomEffectParams;
  7771. var currToxicity : float;
  7772. var min, max, customDamageValue : SAbilityAttributeValue;
  7773. var dm : CDefinitionsManagerAccessor;
  7774. var animAction : W3DamageAction;
  7775.  
  7776. if( damageDealt <= 0 )
  7777. {
  7778. return false;
  7779. }
  7780.  
  7781. if( action )
  7782. {
  7783. action.SetMutation4Triggered();
  7784. }
  7785.  
  7786. dm = theGame.GetDefinitionsManager();
  7787. currToxicity = GetStat( BCS_Toxicity );
  7788.  
  7789. dm.GetAbilityAttributeValue( 'AcidEffect', 'DirectDamage', min, max );
  7790. customDamageValue.valueAdditive = damageDealt * min.valueAdditive;
  7791.  
  7792. if( currToxicity > 0 )
  7793. {
  7794. customDamageValue.valueAdditive *= currToxicity;
  7795. }
  7796.  
  7797. dm.GetAbilityAttributeValue( 'AcidEffect', 'duration', min, max );
  7798. customDamageValue.valueAdditive /= min.valueAdditive;
  7799.  
  7800. customParams.effectType = EET_Acid;
  7801. customParams.effectValue = customDamageValue;
  7802. customParams.duration = min.valueAdditive;
  7803. customParams.creator = this;
  7804. customParams.sourceName = 'Mutation4';
  7805.  
  7806. attacker.AddEffectCustom( customParams );
  7807.  
  7808.  
  7809. animAction = new W3DamageAction in theGame;
  7810. animAction.Initialize( this, attacker, NULL, 'Mutation4', EHRT_Reflect, CPS_Undefined, true, false, false, false );
  7811. animAction.SetCannotReturnDamage( true );
  7812. animAction.SetCanPlayHitParticle( false );
  7813. animAction.SetHitAnimationPlayType( hitAnimationType );
  7814. theGame.damageMgr.ProcessAction( animAction );
  7815. delete animAction;
  7816.  
  7817. theGame.MutationHUDFeedback( MFT_PlayOnce );
  7818.  
  7819. return true;
  7820. }
  7821.  
  7822. event OnPlayerActionEnd()
  7823. {
  7824. var l_i : int;
  7825. var l_bed : W3WitcherBed;
  7826.  
  7827. l_i = (int)GetBehaviorVariable( 'playerExplorationAction' );
  7828.  
  7829. if( l_i == PEA_GoToSleep )
  7830. {
  7831. l_bed = (W3WitcherBed)theGame.GetEntityByTag( 'witcherBed' );
  7832. BlockAllActions( 'WitcherBed', false );
  7833. l_bed.ApplyAppearance( "collision" );
  7834. l_bed.GotoState( 'WakeUp' );
  7835. theGame.ReleaseNoSaveLock( l_bed.m_bedSaveLock );
  7836.  
  7837.  
  7838. substateManager.m_MovementCorrectorO.disallowRotWhenGoingToSleep = false;
  7839. }
  7840.  
  7841. super.OnPlayerActionEnd();
  7842. }
  7843.  
  7844. event OnPlayerActionStartFinished()
  7845. {
  7846. var l_initData : W3SingleMenuInitData;
  7847. var l_i : int;
  7848.  
  7849. l_i = (int)GetBehaviorVariable( 'playerExplorationAction' );
  7850.  
  7851. if( l_i == PEA_GoToSleep )
  7852. {
  7853. l_initData = new W3SingleMenuInitData in this;
  7854. l_initData.SetBlockOtherPanels( true );
  7855. l_initData.ignoreSaveSystem = true;
  7856. l_initData.ignoreMeditationCheck = true;
  7857. l_initData.setDefaultState( '' );
  7858. l_initData.isBonusMeditationAvailable = true;
  7859. l_initData.fixedMenuName = 'MeditationClockMenu';
  7860.  
  7861. theGame.RequestMenuWithBackground( 'MeditationClockMenu', 'CommonMenu', l_initData );
  7862. }
  7863.  
  7864. super.OnPlayerActionStartFinished();
  7865. }
  7866.  
  7867. public function IsInCombatAction_SpecialAttack() : bool
  7868. {
  7869. if ( IsInCombatAction() && ( GetCombatAction() == EBAT_SpecialAttack_Light || GetCombatAction() == EBAT_SpecialAttack_Heavy ) )
  7870. return true;
  7871. else
  7872. return false;
  7873. }
  7874.  
  7875. public function IsInCombatAction_SpecialAttackHeavy() : bool
  7876. {
  7877. if ( IsInCombatAction() && GetCombatAction() == EBAT_SpecialAttack_Heavy )
  7878. return true;
  7879. else
  7880. return false;
  7881. }
  7882.  
  7883. protected function WhenCombatActionIsFinished()
  7884. {
  7885. super.WhenCombatActionIsFinished();
  7886. RemoveTimer( 'ProcessAttackTimer' );
  7887. RemoveTimer( 'AttackTimerEnd' );
  7888. CastSignAbort();
  7889. specialAttackCamera = false;
  7890. this.OnPerformSpecialAttack( true, false );
  7891. }
  7892.  
  7893. event OnCombatActionEnd()
  7894. {
  7895. this.CleanCombatActionBuffer();
  7896. super.OnCombatActionEnd();
  7897.  
  7898. RemoveTemporarySkills();
  7899. }
  7900.  
  7901. event OnCombatActionFriendlyEnd()
  7902. {
  7903. if ( IsCastingSign() )
  7904. {
  7905. SetBehaviorVariable( 'IsCastingSign', 0 );
  7906. SetCurrentlyCastSign( ST_None, NULL );
  7907. LogChannel( 'ST_None', "ST_None" );
  7908. }
  7909.  
  7910. super.OnCombatActionFriendlyEnd();
  7911. }
  7912.  
  7913. public function GetPowerStatValue( stat : ECharacterPowerStats, optional ablName : name, optional ignoreDeath : bool ) : SAbilityAttributeValue
  7914. {
  7915. var result : SAbilityAttributeValue;
  7916.  
  7917.  
  7918. result = super.GetPowerStatValue( stat, ablName, ignoreDeath );
  7919. ApplyMutation10StatBoost( result );
  7920.  
  7921. return result;
  7922. }
  7923.  
  7924.  
  7925.  
  7926. timer function OpenRadialMenu( time: float, id : int )
  7927. {
  7928.  
  7929. if( GetBIsCombatActionAllowed() && !IsUITakeInput() )
  7930. {
  7931. bShowRadialMenu = true;
  7932. }
  7933.  
  7934. this.RemoveTimer('OpenRadialMenu');
  7935. }
  7936.  
  7937. public function OnAddRadialMenuOpenTimer( )
  7938. {
  7939.  
  7940.  
  7941.  
  7942.  
  7943.  
  7944. this.AddTimer('OpenRadialMenu', _HoldBeforeOpenRadialMenuTime * theGame.GetTimeScale() );
  7945.  
  7946. }
  7947.  
  7948. public function SetShowRadialMenuOpenFlag( bSet : bool )
  7949. {
  7950.  
  7951. bShowRadialMenu = bSet;
  7952. }
  7953.  
  7954. public function OnRemoveRadialMenuOpenTimer()
  7955. {
  7956.  
  7957. this.RemoveTimer('OpenRadialMenu');
  7958. }
  7959.  
  7960. public function ResetRadialMenuOpenTimer()
  7961. {
  7962.  
  7963. this.RemoveTimer('OpenRadialMenu');
  7964. if( GetBIsCombatActionAllowed() )
  7965. {
  7966.  
  7967.  
  7968. AddTimer('OpenRadialMenu', _HoldBeforeOpenRadialMenuTime * theGame.GetTimeScale() );
  7969. }
  7970. }
  7971.  
  7972.  
  7973.  
  7974. timer function ResendCompanionDisplayName(dt : float, id : int)
  7975. {
  7976. var hud : CR4ScriptedHud;
  7977. var companionModule : CR4HudModuleCompanion;
  7978.  
  7979. hud = (CR4ScriptedHud)theGame.GetHud();
  7980. if( hud )
  7981. {
  7982. companionModule = (CR4HudModuleCompanion)hud.GetHudModule("CompanionModule");
  7983. if( companionModule )
  7984. {
  7985. companionModule.ResendDisplayName();
  7986. }
  7987. }
  7988. }
  7989.  
  7990. timer function ResendCompanionDisplayNameSecond(dt : float, id : int)
  7991. {
  7992. var hud : CR4ScriptedHud;
  7993. var companionModule : CR4HudModuleCompanion;
  7994.  
  7995. hud = (CR4ScriptedHud)theGame.GetHud();
  7996. if( hud )
  7997. {
  7998. companionModule = (CR4HudModuleCompanion)hud.GetHudModule("CompanionModule");
  7999. if( companionModule )
  8000. {
  8001. companionModule.ResendDisplayNameSecond();
  8002. }
  8003. }
  8004. }
  8005.  
  8006. public function RemoveCompanionDisplayNameTimer()
  8007. {
  8008. this.RemoveTimer('ResendCompanionDisplayName');
  8009. }
  8010.  
  8011. public function RemoveCompanionDisplayNameTimerSecond()
  8012. {
  8013. this.RemoveTimer('ResendCompanionDisplayNameSecond');
  8014. }
  8015.  
  8016.  
  8017. public function GetCompanionNPCTag() : name
  8018. {
  8019. return companionNPCTag;
  8020. }
  8021.  
  8022. public function SetCompanionNPCTag( value : name )
  8023. {
  8024. companionNPCTag = value;
  8025. }
  8026.  
  8027. public function GetCompanionNPCTag2() : name
  8028. {
  8029. return companionNPCTag2;
  8030. }
  8031.  
  8032. public function SetCompanionNPCTag2( value : name )
  8033. {
  8034. companionNPCTag2 = value;
  8035. }
  8036.  
  8037. public function GetCompanionNPCIconPath() : string
  8038. {
  8039. return companionNPCIconPath;
  8040. }
  8041.  
  8042. public function SetCompanionNPCIconPath( value : string )
  8043. {
  8044. companionNPCIconPath = value;
  8045. }
  8046.  
  8047. public function GetCompanionNPCIconPath2() : string
  8048. {
  8049. return companionNPCIconPath2;
  8050. }
  8051.  
  8052. public function SetCompanionNPCIconPath2( value : string )
  8053. {
  8054. companionNPCIconPath2 = value;
  8055. }
  8056.  
  8057.  
  8058.  
  8059. public function ReactToBeingHit(damageAction : W3DamageAction, optional buffNotApplied : bool) : bool
  8060. {
  8061. var chance : float;
  8062. var procQuen : W3SignEntity;
  8063.  
  8064. if(!damageAction.IsDoTDamage() && damageAction.DealsAnyDamage())
  8065. {
  8066. if(inv.IsItemBomb(selectedItemId))
  8067. {
  8068. BombThrowAbort();
  8069. }
  8070. else
  8071. {
  8072.  
  8073. ThrowingAbort();
  8074. }
  8075. }
  8076.  
  8077.  
  8078. if(damageAction.IsActionRanged())
  8079. {
  8080. chance = CalculateAttributeValue(GetAttributeValue('quen_chance_on_projectile'));
  8081. if(chance > 0)
  8082. {
  8083. chance = ClampF(chance, 0, 1);
  8084.  
  8085. if(RandF() < chance)
  8086. {
  8087. procQuen = (W3SignEntity)theGame.CreateEntity(signs[ST_Quen].template, GetWorldPosition(), GetWorldRotation() );
  8088. procQuen.Init(signOwner, signs[ST_Quen].entity, true );
  8089. procQuen.OnStarted();
  8090. procQuen.OnThrowing();
  8091. procQuen.OnEnded();
  8092. }
  8093. }
  8094. }
  8095.  
  8096.  
  8097. if( !((W3Effect_Toxicity)damageAction.causer) )
  8098. MeditationForceAbort(true);
  8099.  
  8100.  
  8101. if(IsDoingSpecialAttack(false))
  8102. damageAction.SetHitAnimationPlayType(EAHA_ForceNo);
  8103.  
  8104. return super.ReactToBeingHit(damageAction, buffNotApplied);
  8105. }
  8106.  
  8107. protected function ShouldPauseHealthRegenOnHit() : bool
  8108. {
  8109.  
  8110. if( ( HasBuff( EET_Swallow ) && GetPotionBuffLevel( EET_Swallow ) >= 3 ) || HasBuff( EET_Runeword8 ) || HasBuff( EET_Mutation11Buff ) )
  8111. {
  8112. return false;
  8113. }
  8114.  
  8115. return true;
  8116. }
  8117.  
  8118. public function SetMappinToHighlight( mappinName : name, mappinState : bool )
  8119. {
  8120. var mappinDef : SHighlightMappin;
  8121. mappinDef.MappinName = mappinName;
  8122. mappinDef.MappinState = mappinState;
  8123. MappinToHighlight.PushBack(mappinDef);
  8124. }
  8125.  
  8126. public function ClearMappinToHighlight()
  8127. {
  8128. MappinToHighlight.Clear();
  8129. }
  8130.  
  8131. public function CastSignAbort()
  8132. {
  8133. if( currentlyCastSign != ST_None && signs[currentlyCastSign].entity)
  8134. {
  8135. signs[currentlyCastSign].entity.OnSignAborted();
  8136. }
  8137.  
  8138.  
  8139. }
  8140.  
  8141. event OnBlockingSceneStarted( scene: CStoryScene )
  8142. {
  8143. var med : W3PlayerWitcherStateMeditationWaiting;
  8144.  
  8145.  
  8146. med = (W3PlayerWitcherStateMeditationWaiting)GetCurrentState();
  8147. if(med)
  8148. {
  8149. med.StopRequested(true);
  8150. }
  8151.  
  8152.  
  8153. super.OnBlockingSceneStarted( scene );
  8154. }
  8155.  
  8156.  
  8157.  
  8158.  
  8159.  
  8160. public function GetHorseManager() : W3HorseManager
  8161. {
  8162. return (W3HorseManager)EntityHandleGet( horseManagerHandle );
  8163. }
  8164.  
  8165.  
  8166. public function HorseEquipItem(horsesItemId : SItemUniqueId) : bool
  8167. {
  8168. var man : W3HorseManager;
  8169.  
  8170. man = GetHorseManager();
  8171. if(man)
  8172. return man.EquipItem(horsesItemId) != GetInvalidUniqueId();
  8173.  
  8174. return false;
  8175. }
  8176.  
  8177.  
  8178. public function HorseUnequipItem(slot : EEquipmentSlots) : bool
  8179. {
  8180. var man : W3HorseManager;
  8181.  
  8182. man = GetHorseManager();
  8183. if(man)
  8184. return man.UnequipItem(slot) != GetInvalidUniqueId();
  8185.  
  8186. return false;
  8187. }
  8188.  
  8189.  
  8190. public final function HorseRemoveItemByName(itemName : name, quantity : int)
  8191. {
  8192. var man : W3HorseManager;
  8193.  
  8194. man = GetHorseManager();
  8195. if(man)
  8196. man.HorseRemoveItemByName(itemName, quantity);
  8197. }
  8198.  
  8199.  
  8200. public final function HorseRemoveItemByCategory(itemCategory : name, quantity : int)
  8201. {
  8202. var man : W3HorseManager;
  8203.  
  8204. man = GetHorseManager();
  8205. if(man)
  8206. man.HorseRemoveItemByCategory(itemCategory, quantity);
  8207. }
  8208.  
  8209.  
  8210. public final function HorseRemoveItemByTag(itemTag : name, quantity : int)
  8211. {
  8212. var man : W3HorseManager;
  8213.  
  8214. man = GetHorseManager();
  8215. if(man)
  8216. man.HorseRemoveItemByTag(itemTag, quantity);
  8217. }
  8218.  
  8219. public function GetAssociatedInventory() : CInventoryComponent
  8220. {
  8221. var man : W3HorseManager;
  8222.  
  8223. man = GetHorseManager();
  8224. if(man)
  8225. return man.GetInventoryComponent();
  8226.  
  8227. return NULL;
  8228. }
  8229.  
  8230.  
  8231.  
  8232.  
  8233.  
  8234. public final function TutorialMutagensUnequipPlayerSkills() : array<STutorialSavedSkill>
  8235. {
  8236. var pam : W3PlayerAbilityManager;
  8237.  
  8238. pam = (W3PlayerAbilityManager)abilityManager;
  8239. return pam.TutorialMutagensUnequipPlayerSkills();
  8240. }
  8241.  
  8242. public final function TutorialMutagensEquipOneGoodSkill()
  8243. {
  8244. var pam : W3PlayerAbilityManager;
  8245.  
  8246. pam = (W3PlayerAbilityManager)abilityManager;
  8247. pam.TutorialMutagensEquipOneGoodSkill();
  8248. }
  8249.  
  8250. public final function TutorialMutagensEquipOneGoodOneBadSkill()
  8251. {
  8252. var pam : W3PlayerAbilityManager;
  8253.  
  8254. pam = (W3PlayerAbilityManager)abilityManager;
  8255. if(pam)
  8256. pam.TutorialMutagensEquipOneGoodOneBadSkill();
  8257. }
  8258.  
  8259. public final function TutorialMutagensEquipThreeGoodSkills()
  8260. {
  8261. var pam : W3PlayerAbilityManager;
  8262.  
  8263. pam = (W3PlayerAbilityManager)abilityManager;
  8264. if(pam)
  8265. pam.TutorialMutagensEquipThreeGoodSkills();
  8266. }
  8267.  
  8268. public final function TutorialMutagensCleanupTempSkills(savedEquippedSkills : array<STutorialSavedSkill>)
  8269. {
  8270. var pam : W3PlayerAbilityManager;
  8271.  
  8272. pam = (W3PlayerAbilityManager)abilityManager;
  8273. return pam.TutorialMutagensCleanupTempSkills(savedEquippedSkills);
  8274. }
  8275.  
  8276.  
  8277.  
  8278.  
  8279.  
  8280. public final function CalculatedArmorStaminaRegenBonus() : float
  8281. {
  8282. var armorEq, glovesEq, pantsEq, bootsEq : bool;
  8283. var tempItem : SItemUniqueId;
  8284. var staminaRegenVal : float;
  8285. var armorRegenVal : SAbilityAttributeValue;
  8286.  
  8287. if( HasAbility( 'Glyphword 2 _Stats', true ) )
  8288. {
  8289. armorEq = inv.GetItemEquippedOnSlot( EES_Armor, tempItem );
  8290. glovesEq = inv.GetItemEquippedOnSlot( EES_Gloves, tempItem );
  8291. pantsEq = inv.GetItemEquippedOnSlot( EES_Pants, tempItem );
  8292. bootsEq = inv.GetItemEquippedOnSlot( EES_Boots, tempItem );
  8293.  
  8294. if ( armorEq )
  8295. staminaRegenVal += 0.1;
  8296. if ( glovesEq )
  8297. staminaRegenVal += 0.02;
  8298. if ( pantsEq )
  8299. staminaRegenVal += 0.1;
  8300. if ( bootsEq )
  8301. staminaRegenVal += 0.03;
  8302.  
  8303. }
  8304. else if( HasAbility( 'Glyphword 3 _Stats', true ) )
  8305. {
  8306. staminaRegenVal = 0;
  8307. }
  8308. else if( HasAbility( 'Glyphword 4 _Stats', true ) )
  8309. {
  8310. armorEq = inv.GetItemEquippedOnSlot( EES_Armor, tempItem );
  8311. glovesEq = inv.GetItemEquippedOnSlot( EES_Gloves, tempItem );
  8312. pantsEq = inv.GetItemEquippedOnSlot( EES_Pants, tempItem );
  8313. bootsEq = inv.GetItemEquippedOnSlot( EES_Boots, tempItem );
  8314.  
  8315. if ( armorEq )
  8316. staminaRegenVal -= 0.1;
  8317. if ( glovesEq )
  8318. staminaRegenVal -= 0.02;
  8319. if ( pantsEq )
  8320. staminaRegenVal -= 0.1;
  8321. if ( bootsEq )
  8322. staminaRegenVal -= 0.03;
  8323. }
  8324. else
  8325. {
  8326. armorRegenVal = GetAttributeValue('staminaRegen_armor_mod');
  8327. staminaRegenVal = armorRegenVal.valueMultiplicative;
  8328. }
  8329.  
  8330. return staminaRegenVal;
  8331. }
  8332.  
  8333. public function GetOffenseStatsList( optional hackMode : int ) : SPlayerOffenseStats
  8334. {
  8335. var playerOffenseStats:SPlayerOffenseStats;
  8336. var steelDmg, silverDmg, elementalSteel, elementalSilver : float;
  8337. var steelCritChance, steelCritDmg : float;
  8338. var silverCritChance, silverCritDmg : float;
  8339. var attackPower : SAbilityAttributeValue;
  8340. var fastCritChance, fastCritDmg : float;
  8341. var strongCritChance, strongCritDmg : float;
  8342. var fastAP, strongAP, min, max : SAbilityAttributeValue;
  8343. var item, crossbow : SItemUniqueId;
  8344. var value : SAbilityAttributeValue;
  8345. var mutagen : CBaseGameplayEffect;
  8346. var thunder : W3Potion_Thunderbolt;
  8347.  
  8348. if(!abilityManager || !abilityManager.IsInitialized())
  8349. return playerOffenseStats;
  8350.  
  8351. if (CanUseSkill(S_Sword_s21))
  8352. fastAP += GetSkillAttributeValue(S_Sword_s21, PowerStatEnumToName(CPS_AttackPower), false, true) * GetSkillLevel(S_Sword_s21);
  8353. if (CanUseSkill(S_Perk_05))
  8354. {
  8355. fastAP += GetAttributeValue('attack_power_fast_style');
  8356. fastCritDmg += CalculateAttributeValue(GetAttributeValue('critical_hit_chance_fast_style'));
  8357. strongCritDmg += CalculateAttributeValue(GetAttributeValue('critical_hit_chance_fast_style'));
  8358. }
  8359. if (CanUseSkill(S_Sword_s04))
  8360. strongAP += GetSkillAttributeValue(S_Sword_s04, PowerStatEnumToName(CPS_AttackPower), false, true) * GetSkillLevel(S_Sword_s04);
  8361. if (CanUseSkill(S_Perk_07))
  8362. strongAP += GetAttributeValue('attack_power_heavy_style');
  8363.  
  8364. if (CanUseSkill(S_Sword_s17))
  8365. {
  8366. fastCritChance += CalculateAttributeValue(GetSkillAttributeValue(S_Sword_s17, theGame.params.CRITICAL_HIT_CHANCE, false, true)) * GetSkillLevel(S_Sword_s17);
  8367. fastCritDmg += CalculateAttributeValue(GetSkillAttributeValue(S_Sword_s17, theGame.params.CRITICAL_HIT_DAMAGE_BONUS, false, true)) * GetSkillLevel(S_Sword_s17);
  8368. }
  8369.  
  8370. if (CanUseSkill(S_Sword_s08))
  8371. {
  8372. strongCritChance += CalculateAttributeValue(GetSkillAttributeValue(S_Sword_s08, theGame.params.CRITICAL_HIT_CHANCE, false, true)) * GetSkillLevel(S_Sword_s08);
  8373. strongCritDmg += CalculateAttributeValue(GetSkillAttributeValue(S_Sword_s08, theGame.params.CRITICAL_HIT_DAMAGE_BONUS, false, true)) * GetSkillLevel(S_Sword_s08);
  8374. }
  8375.  
  8376. if ( HasBuff(EET_Mutagen05) && (GetStat(BCS_Vitality) == GetStatMax(BCS_Vitality)) )
  8377. {
  8378. attackPower += GetAttributeValue('damageIncrease');
  8379. }
  8380.  
  8381. steelCritChance += CalculateAttributeValue(GetAttributeValue(theGame.params.CRITICAL_HIT_CHANCE));
  8382. silverCritChance += CalculateAttributeValue(GetAttributeValue(theGame.params.CRITICAL_HIT_CHANCE));
  8383. steelCritDmg += CalculateAttributeValue(GetAttributeValue(theGame.params.CRITICAL_HIT_DAMAGE_BONUS));
  8384. silverCritDmg += CalculateAttributeValue(GetAttributeValue(theGame.params.CRITICAL_HIT_DAMAGE_BONUS));
  8385. attackPower += GetPowerStatValue(CPS_AttackPower);
  8386.  
  8387. if (GetItemEquippedOnSlot(EES_SteelSword, item))
  8388. {
  8389. steelDmg = GetTotalWeaponDamage(item, theGame.params.DAMAGE_NAME_SLASHING, GetInvalidUniqueId());
  8390. steelDmg += GetTotalWeaponDamage(item, theGame.params.DAMAGE_NAME_PIERCING, GetInvalidUniqueId());
  8391. steelDmg += GetTotalWeaponDamage(item, theGame.params.DAMAGE_NAME_BLUDGEONING, GetInvalidUniqueId());
  8392. elementalSteel = CalculateAttributeValue(GetInventory().GetItemAttributeValue(item, theGame.params.DAMAGE_NAME_FIRE));
  8393. elementalSteel += CalculateAttributeValue(GetInventory().GetItemAttributeValue(item, theGame.params.DAMAGE_NAME_FROST));
  8394. if ( GetInventory().IsItemHeld(item) )
  8395. {
  8396. steelCritChance -= CalculateAttributeValue(GetInventory().GetItemAttributeValue(item, theGame.params.CRITICAL_HIT_CHANCE));
  8397. silverCritChance -= CalculateAttributeValue(GetInventory().GetItemAttributeValue(item, theGame.params.CRITICAL_HIT_CHANCE));
  8398. steelCritDmg -= CalculateAttributeValue(GetInventory().GetItemAttributeValue(item, theGame.params.CRITICAL_HIT_DAMAGE_BONUS));
  8399. silverCritDmg -= CalculateAttributeValue(GetInventory().GetItemAttributeValue(item, theGame.params.CRITICAL_HIT_DAMAGE_BONUS));
  8400. }
  8401. steelCritChance += CalculateAttributeValue(GetInventory().GetItemAttributeValue(item, theGame.params.CRITICAL_HIT_CHANCE));
  8402. steelCritDmg += CalculateAttributeValue(GetInventory().GetItemAttributeValue(item, theGame.params.CRITICAL_HIT_DAMAGE_BONUS));
  8403.  
  8404. thunder = (W3Potion_Thunderbolt)GetBuff(EET_Thunderbolt);
  8405. if(thunder && thunder.GetBuffLevel() == 3 && GetCurWeather() == EWE_Storm)
  8406. {
  8407. steelCritChance += 1.0f;
  8408. }
  8409. }
  8410. else
  8411. {
  8412. steelDmg += 0;
  8413. steelCritChance += 0;
  8414. steelCritDmg +=0;
  8415. }
  8416.  
  8417. if (GetItemEquippedOnSlot(EES_SilverSword, item))
  8418. {
  8419. silverDmg = GetTotalWeaponDamage(item, theGame.params.DAMAGE_NAME_SILVER, GetInvalidUniqueId());
  8420. elementalSilver = CalculateAttributeValue(GetInventory().GetItemAttributeValue(item, theGame.params.DAMAGE_NAME_FIRE));
  8421. elementalSilver += CalculateAttributeValue(GetInventory().GetItemAttributeValue(item, theGame.params.DAMAGE_NAME_FROST));
  8422. if ( GetInventory().IsItemHeld(item) )
  8423. {
  8424. steelCritChance -= CalculateAttributeValue(GetInventory().GetItemAttributeValue(item, theGame.params.CRITICAL_HIT_CHANCE));
  8425. silverCritChance -= CalculateAttributeValue(GetInventory().GetItemAttributeValue(item, theGame.params.CRITICAL_HIT_CHANCE));
  8426. steelCritDmg -= CalculateAttributeValue(GetInventory().GetItemAttributeValue(item, theGame.params.CRITICAL_HIT_DAMAGE_BONUS));
  8427. silverCritDmg -= CalculateAttributeValue(GetInventory().GetItemAttributeValue(item, theGame.params.CRITICAL_HIT_DAMAGE_BONUS));
  8428. }
  8429. silverCritChance += CalculateAttributeValue(GetInventory().GetItemAttributeValue(item, theGame.params.CRITICAL_HIT_CHANCE));
  8430. silverCritDmg += CalculateAttributeValue(GetInventory().GetItemAttributeValue(item, theGame.params.CRITICAL_HIT_DAMAGE_BONUS));
  8431.  
  8432. thunder = (W3Potion_Thunderbolt)GetBuff(EET_Thunderbolt);
  8433. if(thunder && thunder.GetBuffLevel() == 3 && GetCurWeather() == EWE_Storm)
  8434. {
  8435. silverCritChance += 1.0f;
  8436. }
  8437. }
  8438. else
  8439. {
  8440. silverDmg += 0;
  8441. silverCritChance += 0;
  8442. silverCritDmg +=0;
  8443. }
  8444.  
  8445. if ( HasAbility('Runeword 4 _Stats', true) )
  8446. {
  8447. steelDmg += steelDmg * (abilityManager.GetOverhealBonus() / GetStatMax(BCS_Vitality));
  8448. silverDmg += silverDmg * (abilityManager.GetOverhealBonus() / GetStatMax(BCS_Vitality));
  8449. }
  8450.  
  8451. fastAP += attackPower;
  8452. strongAP += attackPower;
  8453.  
  8454. playerOffenseStats.steelFastCritChance = (steelCritChance + fastCritChance) * 100;
  8455. playerOffenseStats.steelFastCritDmg = steelCritDmg + fastCritDmg;
  8456. if ( steelDmg != 0 )
  8457. {
  8458. playerOffenseStats.steelFastDmg = (steelDmg + fastAP.valueBase) * fastAP.valueMultiplicative + fastAP.valueAdditive + elementalSteel;
  8459. playerOffenseStats.steelFastCritDmg = (steelDmg + fastAP.valueBase) * (fastAP.valueMultiplicative + playerOffenseStats.steelFastCritDmg) + fastAP.valueAdditive + elementalSteel;
  8460. }
  8461. else
  8462. {
  8463. playerOffenseStats.steelFastDmg = 0;
  8464. playerOffenseStats.steelFastCritDmg = 0;
  8465. }
  8466. playerOffenseStats.steelFastDPS = (playerOffenseStats.steelFastDmg * (100 - playerOffenseStats.steelFastCritChance) + playerOffenseStats.steelFastCritDmg * playerOffenseStats.steelFastCritChance) / 100;
  8467. playerOffenseStats.steelFastDPS = playerOffenseStats.steelFastDPS / 0.6;
  8468.  
  8469.  
  8470. playerOffenseStats.steelStrongCritChance = (steelCritChance + strongCritChance) * 100;
  8471. playerOffenseStats.steelStrongCritDmg = steelCritDmg + strongCritDmg;
  8472. if ( steelDmg != 0 )
  8473. {
  8474. playerOffenseStats.steelStrongDmg = (steelDmg + strongAP.valueBase) * strongAP.valueMultiplicative + strongAP.valueAdditive + elementalSteel;
  8475. playerOffenseStats.steelStrongDmg *= 1.833f;
  8476. playerOffenseStats.steelStrongCritDmg = (steelDmg + strongAP.valueBase) * (strongAP.valueMultiplicative + playerOffenseStats.steelStrongCritDmg) + strongAP.valueAdditive + elementalSteel;
  8477. playerOffenseStats.steelStrongCritDmg *= 1.833f; }
  8478. else
  8479. {
  8480. playerOffenseStats.steelStrongDmg = 0;
  8481. playerOffenseStats.steelStrongCritDmg = 0;
  8482. }
  8483. playerOffenseStats.steelStrongDPS = (playerOffenseStats.steelStrongDmg * (100 - playerOffenseStats.steelStrongCritChance) + playerOffenseStats.steelStrongCritDmg * playerOffenseStats.steelStrongCritChance) / 100;
  8484. playerOffenseStats.steelStrongDPS = playerOffenseStats.steelStrongDPS / 1.1;
  8485.  
  8486.  
  8487.  
  8488. playerOffenseStats.silverFastCritChance = (silverCritChance + fastCritChance) * 100;
  8489. playerOffenseStats.silverFastCritDmg = silverCritDmg + fastCritDmg;
  8490. if ( silverDmg != 0 )
  8491. {
  8492. playerOffenseStats.silverFastDmg = (silverDmg + fastAP.valueBase) * fastAP.valueMultiplicative + fastAP.valueAdditive + elementalSilver;
  8493. playerOffenseStats.silverFastCritDmg = (silverDmg + fastAP.valueBase) * (fastAP.valueMultiplicative + playerOffenseStats.silverFastCritDmg) + fastAP.valueAdditive + elementalSilver;
  8494. }
  8495. else
  8496. {
  8497. playerOffenseStats.silverFastDmg = 0;
  8498. playerOffenseStats.silverFastCritDmg = 0;
  8499. }
  8500. playerOffenseStats.silverFastDPS = (playerOffenseStats.silverFastDmg * (100 - playerOffenseStats.silverFastCritChance) + playerOffenseStats.silverFastCritDmg * playerOffenseStats.silverFastCritChance) / 100;
  8501. playerOffenseStats.silverFastDPS = playerOffenseStats.silverFastDPS / 0.6;
  8502.  
  8503.  
  8504. playerOffenseStats.silverStrongCritChance = (silverCritChance + strongCritChance) * 100;
  8505. playerOffenseStats.silverStrongCritDmg = silverCritDmg + strongCritDmg;
  8506. if ( silverDmg != 0 )
  8507. {
  8508. playerOffenseStats.silverStrongDmg = (silverDmg + strongAP.valueBase) * strongAP.valueMultiplicative + strongAP.valueAdditive + elementalSilver;
  8509. playerOffenseStats.silverStrongDmg *= 1.833f;
  8510. playerOffenseStats.silverStrongCritDmg = (silverDmg + strongAP.valueBase) * (strongAP.valueMultiplicative + playerOffenseStats.silverStrongCritDmg) + strongAP.valueAdditive + elementalSilver;
  8511. playerOffenseStats.silverStrongCritDmg *= 1.833f;
  8512. }
  8513. else
  8514. {
  8515. playerOffenseStats.silverStrongDmg = 0;
  8516. playerOffenseStats.silverStrongCritDmg = 0;
  8517. }
  8518. playerOffenseStats.silverStrongDPS = (playerOffenseStats.silverStrongDmg * (100 - playerOffenseStats.silverStrongCritChance) + playerOffenseStats.silverStrongCritDmg * playerOffenseStats.silverStrongCritChance) / 100;
  8519. playerOffenseStats.silverStrongDPS = playerOffenseStats.silverStrongDPS / 1.1;
  8520.  
  8521.  
  8522. playerOffenseStats.crossbowCritChance = GetCriticalHitChance( false, false, NULL, MC_NotSet, true );
  8523.  
  8524.  
  8525. playerOffenseStats.crossbowSteelDmgType = theGame.params.DAMAGE_NAME_PIERCING;
  8526. if (GetItemEquippedOnSlot(EES_Bolt, item))
  8527. {
  8528.  
  8529.  
  8530. steelDmg = CalculateAttributeValue(GetInventory().GetItemAttributeValue(item, theGame.params.DAMAGE_NAME_FIRE));
  8531. if(steelDmg > 0)
  8532. {
  8533. playerOffenseStats.crossbowSteelDmg = steelDmg;
  8534.  
  8535. playerOffenseStats.crossbowSteelDmgType = theGame.params.DAMAGE_NAME_FIRE;
  8536. playerOffenseStats.crossbowSilverDmg = steelDmg;
  8537. }
  8538. else
  8539. {
  8540. playerOffenseStats.crossbowSilverDmg = CalculateAttributeValue(GetInventory().GetItemAttributeValue(item, theGame.params.DAMAGE_NAME_SILVER));
  8541.  
  8542. steelDmg = CalculateAttributeValue(GetInventory().GetItemAttributeValue(item, theGame.params.DAMAGE_NAME_PIERCING));
  8543. if(steelDmg > 0)
  8544. {
  8545. playerOffenseStats.crossbowSteelDmg = steelDmg;
  8546. playerOffenseStats.crossbowSteelDmgType = theGame.params.DAMAGE_NAME_PIERCING;
  8547. }
  8548. else
  8549. {
  8550. playerOffenseStats.crossbowSteelDmg = CalculateAttributeValue(GetInventory().GetItemAttributeValue(item, theGame.params.DAMAGE_NAME_BLUDGEONING));
  8551. playerOffenseStats.crossbowSteelDmgType = theGame.params.DAMAGE_NAME_BLUDGEONING;
  8552. }
  8553. }
  8554. }
  8555.  
  8556. if (GetItemEquippedOnSlot(EES_RangedWeapon, item))
  8557. {
  8558. attackPower += GetInventory().GetItemAttributeValue(item, PowerStatEnumToName(CPS_AttackPower));
  8559. if(CanUseSkill(S_Perk_02))
  8560. {
  8561. attackPower += GetSkillAttributeValue(S_Perk_02, PowerStatEnumToName(CPS_AttackPower), false, true);
  8562. }
  8563.  
  8564.  
  8565. if( hackMode != 1 && ( IsMutationActive( EPMT_Mutation9 ) || hackMode == 2 ) )
  8566. {
  8567. theGame.GetDefinitionsManager().GetAbilityAttributeValue( 'Mutation9', 'damage', min, max );
  8568. playerOffenseStats.crossbowSteelDmg += min.valueAdditive;
  8569. playerOffenseStats.crossbowSilverDmg += min.valueAdditive;
  8570. }
  8571.  
  8572. playerOffenseStats.crossbowSteelDmg = (playerOffenseStats.crossbowSteelDmg + attackPower.valueBase) * attackPower.valueMultiplicative + attackPower.valueAdditive;
  8573. playerOffenseStats.crossbowSilverDmg = (playerOffenseStats.crossbowSilverDmg + attackPower.valueBase) * attackPower.valueMultiplicative + attackPower.valueAdditive;
  8574. }
  8575. else
  8576. {
  8577. playerOffenseStats.crossbowSteelDmg = 0;
  8578. playerOffenseStats.crossbowSilverDmg = 0;
  8579. playerOffenseStats.crossbowSteelDmgType = theGame.params.DAMAGE_NAME_PIERCING;
  8580. }
  8581.  
  8582. return playerOffenseStats;
  8583. }
  8584.  
  8585. public function GetTotalWeaponDamage(weaponId : SItemUniqueId, damageTypeName : name, crossbowId : SItemUniqueId) : float
  8586. {
  8587. var damage, durRatio, durMod, itemMod : float;
  8588. var repairObjectBonus, min, max : SAbilityAttributeValue;
  8589.  
  8590. durMod = 0;
  8591. damage = super.GetTotalWeaponDamage(weaponId, damageTypeName, crossbowId);
  8592.  
  8593.  
  8594. if( IsMutationActive( EPMT_Mutation9 ) && inv.IsItemBolt( weaponId ) && IsDamageTypeAnyPhysicalType( damageTypeName ) )
  8595. {
  8596. theGame.GetDefinitionsManager().GetAbilityAttributeValue('Mutation9', 'damage', min, max);
  8597. damage += min.valueAdditive;
  8598. }
  8599.  
  8600.  
  8601. if(IsPhysicalResistStat(GetResistForDamage(damageTypeName, false)))
  8602. {
  8603. repairObjectBonus = inv.GetItemAttributeValue(weaponId, theGame.params.REPAIR_OBJECT_BONUS);
  8604. durRatio = -1;
  8605.  
  8606. if(inv.IsIdValid(crossbowId) && inv.HasItemDurability(crossbowId))
  8607. {
  8608. durRatio = inv.GetItemDurabilityRatio(crossbowId);
  8609. }
  8610. else if(inv.IsIdValid(weaponId) && inv.HasItemDurability(weaponId))
  8611. {
  8612. durRatio = inv.GetItemDurabilityRatio(weaponId);
  8613. }
  8614.  
  8615.  
  8616. if(durRatio >= 0)
  8617. durMod = theGame.params.GetDurabilityMultiplier(durRatio, true);
  8618. else
  8619. durMod = 1;
  8620. }
  8621.  
  8622.  
  8623. if( damageTypeName == 'SilverDamage' && inv.ItemHasTag( weaponId, 'Aerondight' ) )
  8624. {
  8625. itemMod = inv.GetItemModifierFloat( weaponId, 'PermDamageBoost' );
  8626. if( itemMod > 0.f )
  8627. {
  8628. damage += itemMod;
  8629. }
  8630. }
  8631.  
  8632. return damage * (durMod + repairObjectBonus.valueMultiplicative);
  8633. }
  8634.  
  8635.  
  8636.  
  8637.  
  8638.  
  8639. public final function GetSkillPathType(skill : ESkill) : ESkillPath
  8640. {
  8641. if(abilityManager && abilityManager.IsInitialized())
  8642. return ((W3PlayerAbilityManager)abilityManager).GetSkillPathType(skill);
  8643.  
  8644. return ESP_NotSet;
  8645. }
  8646.  
  8647. public function GetSkillLevel(s : ESkill) : int
  8648. {
  8649. if(abilityManager && abilityManager.IsInitialized())
  8650. return ((W3PlayerAbilityManager)abilityManager).GetSkillLevel(s);
  8651.  
  8652. return -1;
  8653. }
  8654.  
  8655. public function GetSkillMaxLevel(s : ESkill) : int
  8656. {
  8657. if(abilityManager && abilityManager.IsInitialized())
  8658. return ((W3PlayerAbilityManager)abilityManager).GetSkillMaxLevel(s);
  8659.  
  8660. return -1;
  8661. }
  8662.  
  8663. public function GetBoughtSkillLevel(s : ESkill) : int
  8664. {
  8665. if(abilityManager && abilityManager.IsInitialized())
  8666. return ((W3PlayerAbilityManager)abilityManager).GetBoughtSkillLevel(s);
  8667.  
  8668. return -1;
  8669. }
  8670.  
  8671.  
  8672. public function GetAxiiLevel() : int
  8673. {
  8674. var level : int;
  8675.  
  8676. level = 1;
  8677.  
  8678. // ESGO - Set Axii Level in Dialog if greater than 0
  8679. if( StringToInt( theGame.GetInGameConfigWrapper().GetVarValue('SCOptionGen', 'DelLVL') ) > 0 )
  8680. level += StringToInt( theGame.GetInGameConfigWrapper().GetVarValue('SCOptionGen', 'DelLVL') );
  8681. else
  8682. if(CanUseSkill(S_Magic_s17))
  8683. level += GetSkillLevel(S_Magic_s17);
  8684.  
  8685. return Clamp(level, 1, 4);
  8686. }
  8687.  
  8688. public function IsInFrenzy() : bool
  8689. {
  8690. return isInFrenzy;
  8691. }
  8692.  
  8693. public function HasRecentlyCountered() : bool
  8694. {
  8695. return hasRecentlyCountered;
  8696. }
  8697.  
  8698. public function SetRecentlyCountered(counter : bool)
  8699. {
  8700. hasRecentlyCountered = counter;
  8701. }
  8702.  
  8703. timer function CheckBlockedSkills(dt : float, id : int)
  8704. {
  8705. var nextCallTime : float;
  8706.  
  8707. nextCallTime = ((W3PlayerAbilityManager)abilityManager).CheckBlockedSkills(dt);
  8708. if(nextCallTime != -1)
  8709. AddTimer('CheckBlockedSkills', nextCallTime, , , , true);
  8710. }
  8711.  
  8712.  
  8713. public function RemoveTemporarySkills()
  8714. {
  8715. var i : int;
  8716. var pam : W3PlayerAbilityManager;
  8717.  
  8718.  
  8719. if ( IsCastingSign() )
  8720. {
  8721. AddTimer( 'DelayedRemoveTemporarySkills', 0.1,,,, true );
  8722. return;
  8723. }
  8724.  
  8725. AddTimer( 'SuperchargedSignCleanup', 0.1,,,, true );
  8726.  
  8727.  
  8728. if(tempLearnedSignSkills.Size() > 0)
  8729. {
  8730. pam = (W3PlayerAbilityManager)abilityManager;
  8731. for(i=0; i<tempLearnedSignSkills.Size(); i+=1)
  8732. {
  8733. pam.RemoveTemporarySkill(tempLearnedSignSkills[i]);
  8734. }
  8735.  
  8736. tempLearnedSignSkills.Clear();
  8737. }
  8738. RemoveAbilityAll(SkillEnumToName(S_Sword_s19));
  8739. }
  8740.  
  8741.  
  8742.  
  8743. public timer function SuperchargedSignCleanup(dt : float, id : int)
  8744. {
  8745. superchargedSign = false;
  8746. }
  8747.  
  8748. public timer function DelayedRemoveTemporarySkills(dt : float, id : int)
  8749. {
  8750. var i : int;
  8751. var pam : W3PlayerAbilityManager;
  8752.  
  8753. if ( IsCastingSign() )
  8754. {
  8755. AddTimer( 'DelayedRemoveTemporarySkills', 0.1,,,, true );
  8756. return;
  8757. }
  8758.  
  8759. AddTimer( 'SuperchargedSignCleanup', 0.1,,,, true );
  8760.  
  8761. if(tempLearnedSignSkills.Size() > 0)
  8762. {
  8763. pam = (W3PlayerAbilityManager)abilityManager;
  8764. for(i=0; i<tempLearnedSignSkills.Size(); i+=1)
  8765. {
  8766. pam.RemoveTemporarySkill(tempLearnedSignSkills[i]);
  8767. }
  8768.  
  8769. tempLearnedSignSkills.Clear();
  8770. }
  8771. RemoveAbilityAll(SkillEnumToName(S_Sword_s19));
  8772. }
  8773.  
  8774.  
  8775.  
  8776. public function RemoveTemporarySkill(skill : SSimpleSkill) : bool
  8777. {
  8778. var pam : W3PlayerAbilityManager;
  8779.  
  8780. pam = (W3PlayerAbilityManager)abilityManager;
  8781. if(pam && pam.IsInitialized())
  8782. return pam.RemoveTemporarySkill(skill);
  8783.  
  8784. return false;
  8785. }
  8786.  
  8787.  
  8788.  
  8789. private var superchargedSign : bool;
  8790. public function IsSuperchargedSign() : bool
  8791. {
  8792. return superchargedSign;
  8793. }
  8794.  
  8795.  
  8796.  
  8797.  
  8798. private function AddTemporarySkills()
  8799. {
  8800. if(CanUseSkill(S_Sword_s19) && GetStat(BCS_Focus) >= 3)
  8801. {
  8802. RemoveTemporarySkills();
  8803. tempLearnedSignSkills = ((W3PlayerAbilityManager)abilityManager).AddTempNonAlchemySkills();
  8804. DrainFocus(GetStat(BCS_Focus));
  8805. if ( !this.HasAbility( SkillEnumToName(S_Sword_s19) ) )
  8806. AddAbilityMultiple(SkillEnumToName(S_Sword_s19), GetSkillLevel(S_Sword_s19));
  8807.  
  8808. superchargedSign = true;
  8809.  
  8810. }
  8811. }
  8812.  
  8813.  
  8814.  
  8815. public function HasAlternateQuen() : bool
  8816. {
  8817. var quenEntity : W3QuenEntity;
  8818.  
  8819. quenEntity = (W3QuenEntity)GetCurrentSignEntity();
  8820. if(quenEntity)
  8821. {
  8822. return quenEntity.IsAlternateCast();
  8823. }
  8824.  
  8825. return false;
  8826. }
  8827.  
  8828.  
  8829.  
  8830.  
  8831.  
  8832. public function AddPoints(type : ESpendablePointType, amount : int, show : bool)
  8833. {
  8834. levelManager.AddPoints(type, amount, show);
  8835. }
  8836.  
  8837. public function GetLevel() : int {return levelManager.GetLevel();}
  8838. public function GetMaxLevel() : int {return levelManager.GetMaxLevel();}
  8839. public function GetTotalExpForNextLevel() : int {return levelManager.GetTotalExpForNextLevel();}
  8840. public function GetPointsTotal(type : ESpendablePointType) : int {return levelManager.GetPointsTotal(type);}
  8841. public function IsAutoLeveling() : bool {return autoLevel;}
  8842. public function SetAutoLeveling( b : bool ) {autoLevel = b;}
  8843.  
  8844. public function GetMissingExpForNextLevel() : int
  8845. {
  8846. return Max(0, GetTotalExpForNextLevel() - GetPointsTotal(EExperiencePoint));
  8847. }
  8848.  
  8849.  
  8850.  
  8851.  
  8852. private saved var runewordInfusionType : ESignType;
  8853. default runewordInfusionType = ST_None;
  8854.  
  8855. public final function GetRunewordInfusionType() : ESignType
  8856. {
  8857. return runewordInfusionType;
  8858. }
  8859.  
  8860.  
  8861. public function QuenImpulse( isAlternate : bool, signEntity : W3QuenEntity, source : string, optional forceSkillLevel : int )
  8862. {
  8863. var level, i, j : int;
  8864. var atts, damages : array<name>;
  8865. var ents : array<CGameplayEntity>;
  8866. var action : W3DamageAction;
  8867. var dm : CDefinitionsManagerAccessor;
  8868. var skillAbilityName : name;
  8869. var dmg : float;
  8870. var min, max : SAbilityAttributeValue;
  8871. var pos : Vector;
  8872.  
  8873. if( forceSkillLevel > 0 )
  8874. {
  8875. level = forceSkillLevel;
  8876. }
  8877. else
  8878. {
  8879. level = GetSkillLevel(S_Magic_s13);
  8880. }
  8881.  
  8882. dm = theGame.GetDefinitionsManager();
  8883. skillAbilityName = GetSkillAbilityName(S_Magic_s13);
  8884.  
  8885. if(level >= 2)
  8886. {
  8887.  
  8888. dm.GetAbilityAttributes(skillAbilityName, atts);
  8889. for(i=0; i<atts.Size(); i+=1)
  8890. {
  8891. if(IsDamageTypeNameValid(atts[i]))
  8892. {
  8893. damages.PushBack(atts[i]);
  8894. }
  8895. }
  8896. }
  8897.  
  8898.  
  8899. pos = signEntity.GetWorldPosition();
  8900. FindGameplayEntitiesInSphere(ents, pos, 3, 1000, '', FLAG_OnlyAliveActors + FLAG_ExcludeTarget + FLAG_Attitude_Hostile + FLAG_Attitude_Neutral + FLAG_TestLineOfSight, this);
  8901.  
  8902.  
  8903. for(i=0; i<ents.Size(); i+=1)
  8904. {
  8905. action = new W3DamageAction in theGame;
  8906. action.Initialize(this, ents[i], signEntity, source, EHRT_Heavy, CPS_SpellPower, false, false, true, false);
  8907. action.SetSignSkill(S_Magic_s13);
  8908. action.SetCannotReturnDamage(true);
  8909. action.SetProcessBuffsIfNoDamage(true);
  8910.  
  8911.  
  8912. if(!isAlternate && level >= 2)
  8913. {
  8914. action.SetHitEffect('hit_electric_quen');
  8915. action.SetHitEffect('hit_electric_quen', true);
  8916. action.SetHitEffect('hit_electric_quen', false, true);
  8917. action.SetHitEffect('hit_electric_quen', true, true);
  8918. }
  8919.  
  8920. if(level >= 1)
  8921. {
  8922. action.AddEffectInfo(EET_Stagger);
  8923. }
  8924. if(level >= 2)
  8925. {
  8926. for(j=0; j<damages.Size(); j+=1)
  8927. {
  8928. dm.GetAbilityAttributeValue(skillAbilityName, damages[j], min, max);
  8929. dmg = CalculateAttributeValue(GetAttributeRandomizedValue(min, max));
  8930. if( IsSetBonusActive( EISB_Bear_2 ) )
  8931. {
  8932. dm.GetAbilityAttributeValue( GetSetBonusAbility( EISB_Bear_2 ), 'quen_dmg_boost', min, max );
  8933. dmg *= 1 + min.valueMultiplicative;
  8934. }
  8935. action.AddDamage(damages[j], dmg);
  8936. }
  8937. }
  8938. if(level == 3)
  8939. {
  8940. action.AddEffectInfo(EET_KnockdownTypeApplicator);
  8941. }
  8942.  
  8943. theGame.damageMgr.ProcessAction( action );
  8944. delete action;
  8945. }
  8946.  
  8947.  
  8948. if(isAlternate)
  8949. {
  8950. signEntity.PlayHitEffect('quen_impulse_explode', signEntity.GetWorldRotation());
  8951. signEntity.EraseFirstTimeStamp();
  8952.  
  8953.  
  8954. if(level >= 2)
  8955. {
  8956. if( !IsSetBonusActive( EISB_Bear_2 ) )
  8957. {
  8958. signEntity.PlayHitEffect('quen_electric_explode', signEntity.GetWorldRotation());
  8959. }
  8960. else
  8961. {
  8962. signEntity.PlayHitEffect('quen_electric_explode_bear_abl2', signEntity.GetWorldRotation());
  8963. }
  8964. }
  8965. }
  8966. else
  8967. {
  8968. signEntity.PlayEffect('lasting_shield_impulse');
  8969. }
  8970. }
  8971.  
  8972. public function OnSignCastPerformed(signType : ESignType, isAlternate : bool)
  8973. {
  8974. var items : array<SItemUniqueId>;
  8975. var weaponEnt : CEntity;
  8976. var fxName : name;
  8977. var pos : Vector;
  8978.  
  8979. super.OnSignCastPerformed(signType, isAlternate);
  8980.  
  8981. if(HasAbility('Runeword 1 _Stats', true) && GetStat(BCS_Focus) >= 1.0f)
  8982. {
  8983. DrainFocus(1.0f);
  8984. runewordInfusionType = signType;
  8985. items = inv.GetHeldWeapons();
  8986. weaponEnt = inv.GetItemEntityUnsafe(items[0]);
  8987.  
  8988.  
  8989. weaponEnt.StopEffect('runeword_aard');
  8990. weaponEnt.StopEffect('runeword_axii');
  8991. weaponEnt.StopEffect('runeword_igni');
  8992. weaponEnt.StopEffect('runeword_quen');
  8993. weaponEnt.StopEffect('runeword_yrden');
  8994.  
  8995.  
  8996. if(signType == ST_Aard)
  8997. fxName = 'runeword_aard';
  8998. else if(signType == ST_Axii)
  8999. fxName = 'runeword_axii';
  9000. else if(signType == ST_Igni)
  9001. fxName = 'runeword_igni';
  9002. else if(signType == ST_Quen)
  9003. fxName = 'runeword_quen';
  9004. else if(signType == ST_Yrden)
  9005. fxName = 'runeword_yrden';
  9006.  
  9007. weaponEnt.PlayEffect(fxName);
  9008. }
  9009.  
  9010.  
  9011. if( IsMutationActive( EPMT_Mutation6 ) && signType == ST_Aard && !isAlternate )
  9012. {
  9013. pos = GetWorldPosition() + GetWorldForward() * 2;
  9014.  
  9015. theGame.GetSurfacePostFX().AddSurfacePostFXGroup( pos, 0.f, 3.f, 2.f, 5.f, 0 );
  9016. }
  9017. }
  9018.  
  9019. public saved var savedQuenHealth, savedQuenDuration : float;
  9020.  
  9021. timer function HACK_QuenSaveStatus(dt : float, id : int)
  9022. {
  9023. var quenEntity : W3QuenEntity;
  9024.  
  9025. quenEntity = (W3QuenEntity)signs[ST_Quen].entity;
  9026. savedQuenHealth = quenEntity.GetShieldHealth();
  9027. savedQuenDuration = quenEntity.GetShieldRemainingDuration();
  9028. }
  9029.  
  9030. timer function DelayedRestoreQuen(dt : float, id : int)
  9031. {
  9032. RestoreQuen(savedQuenHealth, savedQuenDuration);
  9033. }
  9034.  
  9035. public final function OnBasicQuenFinishing()
  9036. {
  9037. RemoveTimer('HACK_QuenSaveStatus');
  9038. savedQuenHealth = 0.f;
  9039. savedQuenDuration = 0.f;
  9040. }
  9041.  
  9042. public final function IsAnyQuenActive() : bool
  9043. {
  9044. var quen : W3QuenEntity;
  9045.  
  9046. quen = (W3QuenEntity)GetSignEntity(ST_Quen);
  9047. if(quen)
  9048. return quen.IsAnyQuenActive();
  9049.  
  9050. return false;
  9051. }
  9052.  
  9053. public final function IsQuenActive(alternateMode : bool) : bool
  9054. {
  9055. if(IsAnyQuenActive() && GetSignEntity(ST_Quen).IsAlternateCast() == alternateMode)
  9056. return true;
  9057.  
  9058. return false;
  9059. }
  9060.  
  9061. public function FinishQuen( skipVisuals : bool, optional forceNoBearSetBonus : bool )
  9062. {
  9063. var quen : W3QuenEntity;
  9064.  
  9065. quen = (W3QuenEntity)GetSignEntity(ST_Quen);
  9066. if(quen)
  9067. quen.ForceFinishQuen( skipVisuals, forceNoBearSetBonus );
  9068. }
  9069.  
  9070.  
  9071. public function GetTotalSignSpellPower(signSkill : ESkill) : SAbilityAttributeValue
  9072. {
  9073. var sp : SAbilityAttributeValue;
  9074. var penalty : SAbilityAttributeValue;
  9075. var penaltyReduction : float;
  9076. var penaltyReductionLevel : int;
  9077.  
  9078.  
  9079. sp = GetSkillAttributeValue(signSkill, PowerStatEnumToName(CPS_SpellPower), true, true);
  9080.  
  9081.  
  9082. if ( signSkill == S_Magic_s01 )
  9083. {
  9084.  
  9085. penaltyReductionLevel = GetSkillLevel(S_Magic_s01) + 1;
  9086. if(penaltyReductionLevel > 0)
  9087. {
  9088. penaltyReduction = 1 - penaltyReductionLevel * CalculateAttributeValue(GetSkillAttributeValue(S_Magic_s01, 'spell_power_penalty_reduction', true, true));
  9089. penalty = GetSkillAttributeValue(S_Magic_s01, PowerStatEnumToName(CPS_SpellPower), false, false);
  9090. sp += penalty * penaltyReduction;
  9091. }
  9092. }
  9093.  
  9094.  
  9095. if(signSkill == S_Magic_1 || signSkill == S_Magic_s01)
  9096. {
  9097. sp += GetAttributeValue('spell_power_aard');
  9098. }
  9099. else if(signSkill == S_Magic_2 || signSkill == S_Magic_s02)
  9100. {
  9101. sp += GetAttributeValue('spell_power_igni');
  9102. }
  9103. else if(signSkill == S_Magic_3 || signSkill == S_Magic_s03)
  9104. {
  9105. sp += GetAttributeValue('spell_power_yrden');
  9106. }
  9107. else if(signSkill == S_Magic_4 || signSkill == S_Magic_s04)
  9108. {
  9109. sp += GetAttributeValue('spell_power_quen');
  9110. }
  9111. else if(signSkill == S_Magic_5 || signSkill == S_Magic_s05)
  9112. {
  9113. sp += GetAttributeValue('spell_power_axii');
  9114. }
  9115.  
  9116.  
  9117. ApplyMutation10StatBoost( sp );
  9118.  
  9119. return sp;
  9120. }
  9121.  
  9122.  
  9123.  
  9124.  
  9125.  
  9126. public final function GetGwentCardIndex( cardName : name ) : int
  9127. {
  9128. var dm : CDefinitionsManagerAccessor;
  9129.  
  9130. dm = theGame.GetDefinitionsManager();
  9131.  
  9132. if(dm.ItemHasTag( cardName , 'GwintCardLeader' ))
  9133. {
  9134. return theGame.GetGwintManager().GwentLeadersNametoInt( cardName );
  9135. }
  9136. else if(dm.ItemHasTag( cardName , 'GwintCardNrkd' ))
  9137. {
  9138. return theGame.GetGwintManager().GwentNrkdNameToInt( cardName );
  9139. }
  9140. else if(dm.ItemHasTag( cardName , 'GwintCardNlfg' ))
  9141. {
  9142. return theGame.GetGwintManager().GwentNlfgNameToInt( cardName );
  9143. }
  9144. else if(dm.ItemHasTag( cardName , 'GwintCardSctl' ))
  9145. {
  9146. return theGame.GetGwintManager().GwentSctlNameToInt( cardName );
  9147. }
  9148. else if(dm.ItemHasTag( cardName , 'GwintCardMstr' ))
  9149. {
  9150. return theGame.GetGwintManager().GwentMstrNameToInt( cardName );
  9151. }
  9152. else if(dm.ItemHasTag( cardName , 'GwintCardSke' ))
  9153. {
  9154. return theGame.GetGwintManager().GwentSkeNameToInt( cardName );
  9155. }
  9156. else if(dm.ItemHasTag( cardName , 'GwintCardNeutral' ))
  9157. {
  9158. return theGame.GetGwintManager().GwentNeutralNameToInt( cardName );
  9159. }
  9160. else if(dm.ItemHasTag( cardName , 'GwintCardSpcl' ))
  9161. {
  9162. return theGame.GetGwintManager().GwentSpecialNameToInt( cardName );
  9163. }
  9164.  
  9165. return -1;
  9166. }
  9167.  
  9168. public final function AddGwentCard(cardName : name, amount : int) : bool
  9169. {
  9170. var dm : CDefinitionsManagerAccessor;
  9171. var cardIndex, i : int;
  9172. var tut : STutorialMessage;
  9173. var gwintManager : CR4GwintManager;
  9174.  
  9175.  
  9176.  
  9177. if(FactsQuerySum("q001_nightmare_ended") > 0 && ShouldProcessTutorial('TutorialGwentDeckBuilder2'))
  9178. {
  9179. tut.type = ETMT_Hint;
  9180. tut.tutorialScriptTag = 'TutorialGwentDeckBuilder2';
  9181. tut.journalEntryName = 'TutorialGwentDeckBuilder2';
  9182. tut.hintPositionType = ETHPT_DefaultGlobal;
  9183. tut.markAsSeenOnShow = true;
  9184. tut.hintDurationType = ETHDT_Long;
  9185.  
  9186. theGame.GetTutorialSystem().DisplayTutorial(tut);
  9187. }
  9188.  
  9189. dm = theGame.GetDefinitionsManager();
  9190.  
  9191. cardIndex = GetGwentCardIndex(cardName);
  9192.  
  9193. if (cardIndex != -1)
  9194. {
  9195. FactsAdd("Gwint_Card_Looted");
  9196.  
  9197. for(i = 0; i < amount; i += 1)
  9198. {
  9199. theGame.GetGwintManager().AddCardToCollection( cardIndex );
  9200. }
  9201. }
  9202.  
  9203. if( dm.ItemHasTag( cardName, 'GwentTournament' ) )
  9204. {
  9205. if ( dm.ItemHasTag( cardName, 'GT1' ) )
  9206. {
  9207. FactsAdd( "GwentTournament", 1 );
  9208. }
  9209.  
  9210. else if ( dm.ItemHasTag( cardName, 'GT2' ) )
  9211. {
  9212. FactsAdd( "GwentTournament", 2 );
  9213. }
  9214.  
  9215. else if ( dm.ItemHasTag( cardName, 'GT3' ) )
  9216. {
  9217. FactsAdd( "GwentTournament", 3 );
  9218. }
  9219.  
  9220. else if ( dm.ItemHasTag( cardName, 'GT4' ) )
  9221. {
  9222. FactsAdd( "GwentTournament", 4 );
  9223. }
  9224.  
  9225. else if ( dm.ItemHasTag( cardName, 'GT5' ) )
  9226. {
  9227. FactsAdd( "GwentTournament", 5 );
  9228. }
  9229.  
  9230. else if ( dm.ItemHasTag( cardName, 'GT6' ) )
  9231. {
  9232. FactsAdd( "GwentTournament", 6 );
  9233. }
  9234.  
  9235. else if ( dm.ItemHasTag( cardName, 'GT7' ) )
  9236. {
  9237. FactsAdd( "GwentTournament", 7 );
  9238. }
  9239.  
  9240. CheckGwentTournamentDeck();
  9241. }
  9242.  
  9243. if( dm.ItemHasTag( cardName, 'EP2Tournament' ) )
  9244. {
  9245. if ( dm.ItemHasTag( cardName, 'GT1' ) )
  9246. {
  9247. FactsAdd( "EP2Tournament", 1 );
  9248. }
  9249.  
  9250. else if ( dm.ItemHasTag( cardName, 'GT2' ) )
  9251. {
  9252. FactsAdd( "EP2Tournament", 2 );
  9253. }
  9254.  
  9255. else if ( dm.ItemHasTag( cardName, 'GT3' ) )
  9256. {
  9257. FactsAdd( "EP2Tournament", 3 );
  9258. }
  9259.  
  9260. else if ( dm.ItemHasTag( cardName, 'GT4' ) )
  9261. {
  9262. FactsAdd( "EP2Tournament", 4 );
  9263. }
  9264.  
  9265. else if ( dm.ItemHasTag( cardName, 'GT5' ) )
  9266. {
  9267. FactsAdd( "EP2Tournament", 5 );
  9268. }
  9269.  
  9270. else if ( dm.ItemHasTag( cardName, 'GT6' ) )
  9271. {
  9272. FactsAdd( "EP2Tournament", 6 );
  9273. }
  9274.  
  9275. else if ( dm.ItemHasTag( cardName, 'GT7' ) )
  9276. {
  9277. FactsAdd( "EP2Tournament", 7 );
  9278. }
  9279.  
  9280. CheckEP2TournamentDeck();
  9281. }
  9282.  
  9283. gwintManager = theGame.GetGwintManager();
  9284. if( !gwintManager.IsDeckUnlocked( GwintFaction_Skellige ) &&
  9285. gwintManager.HasCardsOfFactionInCollection( GwintFaction_Skellige, false ) )
  9286. {
  9287. gwintManager.UnlockDeck( GwintFaction_Skellige );
  9288. }
  9289.  
  9290. return true;
  9291. }
  9292.  
  9293.  
  9294. public final function RemoveGwentCard(cardName : name, amount : int) : bool
  9295. {
  9296. var dm : CDefinitionsManagerAccessor;
  9297. var cardIndex, i : int;
  9298.  
  9299. dm = theGame.GetDefinitionsManager();
  9300.  
  9301. if(dm.ItemHasTag( cardName , 'GwintCardLeader' ))
  9302. {
  9303. cardIndex = theGame.GetGwintManager().GwentLeadersNametoInt( cardName );
  9304. for(i=0; i<amount; i+=1)
  9305. theGame.GetGwintManager().RemoveCardFromCollection( cardIndex );
  9306. }
  9307. else if(dm.ItemHasTag( cardName , 'GwintCardNrkd' ))
  9308. {
  9309. cardIndex = theGame.GetGwintManager().GwentNrkdNameToInt( cardName );
  9310. for(i=0; i<amount; i+=1)
  9311. theGame.GetGwintManager().RemoveCardFromCollection( cardIndex );
  9312. }
  9313. else if(dm.ItemHasTag( cardName , 'GwintCardNlfg' ))
  9314. {
  9315. cardIndex = theGame.GetGwintManager().GwentNlfgNameToInt( cardName );
  9316. for(i=0; i<amount; i+=1)
  9317. theGame.GetGwintManager().RemoveCardFromCollection( cardIndex );
  9318. }
  9319. else if(dm.ItemHasTag( cardName , 'GwintCardSctl' ))
  9320. {
  9321. cardIndex = theGame.GetGwintManager().GwentSctlNameToInt( cardName );
  9322. for(i=0; i<amount; i+=1)
  9323. theGame.GetGwintManager().RemoveCardFromCollection( cardIndex );
  9324. }
  9325. else if(dm.ItemHasTag( cardName , 'GwintCardMstr' ))
  9326. {
  9327. cardIndex = theGame.GetGwintManager().GwentMstrNameToInt( cardName );
  9328. for(i=0; i<amount; i+=1)
  9329. theGame.GetGwintManager().RemoveCardFromCollection( cardIndex );
  9330. }
  9331. else if(dm.ItemHasTag( cardName , 'GwintCardNeutral' ))
  9332. {
  9333. cardIndex = theGame.GetGwintManager().GwentNeutralNameToInt( cardName );
  9334. for(i=0; i<amount; i+=1)
  9335. theGame.GetGwintManager().RemoveCardFromCollection( cardIndex );
  9336. }
  9337. else if(dm.ItemHasTag( cardName , 'GwintCardSpcl' ))
  9338. {
  9339. cardIndex = theGame.GetGwintManager().GwentSpecialNameToInt( cardName );
  9340. for(i=0; i<amount; i+=1)
  9341. theGame.GetGwintManager().RemoveCardFromCollection( cardIndex );
  9342. }
  9343.  
  9344. if( dm.ItemHasTag( cardName, 'GwentTournament' ) )
  9345. {
  9346. if ( dm.ItemHasTag( cardName, 'GT1' ) )
  9347. {
  9348. FactsSubstract( "GwentTournament", 1 );
  9349. }
  9350.  
  9351. else if ( dm.ItemHasTag( cardName, 'GT2' ) )
  9352. {
  9353. FactsSubstract( "GwentTournament", 2 );
  9354. }
  9355.  
  9356. else if ( dm.ItemHasTag( cardName, 'GT3' ) )
  9357. {
  9358. FactsSubstract( "GwentTournament", 3 );
  9359. }
  9360.  
  9361. else if ( dm.ItemHasTag( cardName, 'GT4' ) )
  9362. {
  9363. FactsSubstract( "GwentTournament", 4 );
  9364. }
  9365.  
  9366. else if ( dm.ItemHasTag( cardName, 'GT5' ) )
  9367. {
  9368. FactsSubstract( "GwentTournament", 5 );
  9369. }
  9370.  
  9371. else if ( dm.ItemHasTag( cardName, 'GT6' ) )
  9372. {
  9373. FactsSubstract( "GwentTournament", 6 );
  9374. }
  9375.  
  9376. else if ( dm.ItemHasTag( cardName, 'GT7' ) )
  9377. {
  9378. FactsSubstract( "GwentTournament", 7 );
  9379. }
  9380.  
  9381. CheckGwentTournamentDeck();
  9382. }
  9383.  
  9384.  
  9385. if( dm.ItemHasTag( cardName, 'EP2Tournament' ) )
  9386. {
  9387. if ( dm.ItemHasTag( cardName, 'GT1' ) )
  9388. {
  9389. FactsSubstract( "EP2Tournament", 1 );
  9390. }
  9391.  
  9392. else if ( dm.ItemHasTag( cardName, 'GT2' ) )
  9393. {
  9394. FactsSubstract( "EP2Tournament", 2 );
  9395. }
  9396.  
  9397. else if ( dm.ItemHasTag( cardName, 'GT3' ) )
  9398. {
  9399. FactsSubstract( "EP2Tournament", 3 );
  9400. }
  9401.  
  9402. else if ( dm.ItemHasTag( cardName, 'GT4' ) )
  9403. {
  9404. FactsSubstract( "EP2Tournament", 4 );
  9405. }
  9406.  
  9407. else if ( dm.ItemHasTag( cardName, 'GT5' ) )
  9408. {
  9409. FactsSubstract( "EP2Tournament", 5 );
  9410. }
  9411.  
  9412. else if ( dm.ItemHasTag( cardName, 'GT6' ) )
  9413. {
  9414. FactsSubstract( "EP2Tournament", 6 );
  9415. }
  9416.  
  9417. else if ( dm.ItemHasTag( cardName, 'GT7' ) )
  9418. {
  9419. FactsSubstract( "EP2Tournament", 7 );
  9420. }
  9421.  
  9422. CheckEP2TournamentDeck();
  9423. }
  9424.  
  9425. return true;
  9426. }
  9427.  
  9428. function CheckGwentTournamentDeck()
  9429. {
  9430. var gwentPower : int;
  9431. var neededGwentPower : int;
  9432. var checkBreakpoint : int;
  9433.  
  9434. neededGwentPower = 70;
  9435.  
  9436. checkBreakpoint = neededGwentPower/5;
  9437. gwentPower = FactsQuerySum( "GwentTournament" );
  9438.  
  9439. if ( gwentPower >= neededGwentPower )
  9440. {
  9441. FactsAdd( "HasGwentTournamentDeck", 1 );
  9442. }
  9443. else
  9444. {
  9445. if( FactsDoesExist( "HasGwentTournamentDeck" ) )
  9446. {
  9447. FactsRemove( "HasGwentTournamentDeck" );
  9448. }
  9449.  
  9450. if ( gwentPower >= checkBreakpoint )
  9451. {
  9452. FactsAdd( "GwentTournamentObjective1", 1 );
  9453. }
  9454. else if ( FactsDoesExist( "GwentTournamentObjective1" ) )
  9455. {
  9456. FactsRemove( "GwentTournamentObjective1" );
  9457. }
  9458.  
  9459. if ( gwentPower >= checkBreakpoint*2 )
  9460. {
  9461. FactsAdd( "GwentTournamentObjective2", 1 );
  9462. }
  9463. else if ( FactsDoesExist( "GwentTournamentObjective2" ) )
  9464. {
  9465. FactsRemove( "GwentTournamentObjective2" );
  9466. }
  9467.  
  9468. if ( gwentPower >= checkBreakpoint*3 )
  9469. {
  9470. FactsAdd( "GwentTournamentObjective3", 1 );
  9471. }
  9472. else if ( FactsDoesExist( "GwentTournamentObjective3" ) )
  9473. {
  9474. FactsRemove( "GwentTournamentObjective3" );
  9475. }
  9476.  
  9477. if ( gwentPower >= checkBreakpoint*4 )
  9478. {
  9479. FactsAdd( "GwentTournamentObjective4", 1 );
  9480. }
  9481. else if ( FactsDoesExist( "GwentTournamentObjective4" ) )
  9482. {
  9483. FactsRemove( "GwentTournamentObjective4" );
  9484. }
  9485. }
  9486. }
  9487.  
  9488. function CheckEP2TournamentDeck()
  9489. {
  9490. var gwentPower : int;
  9491. var neededGwentPower : int;
  9492. var checkBreakpoint : int;
  9493.  
  9494. neededGwentPower = 24;
  9495.  
  9496. checkBreakpoint = neededGwentPower/5;
  9497. gwentPower = FactsQuerySum( "EP2Tournament" );
  9498.  
  9499. if ( gwentPower >= neededGwentPower )
  9500. {
  9501. if( FactsQuerySum( "HasEP2TournamentDeck") == 0 )
  9502. {
  9503. FactsAdd( "HasEP2TournamentDeck", 1 );
  9504. }
  9505.  
  9506. }
  9507. else
  9508. {
  9509. if( FactsDoesExist( "HasEP2TournamentDeck" ) )
  9510. {
  9511. FactsRemove( "HasEP2TournamentDeck" );
  9512. }
  9513.  
  9514. if ( gwentPower >= checkBreakpoint )
  9515. {
  9516. FactsAdd( "EP2TournamentObjective1", 1 );
  9517. }
  9518. else if ( FactsDoesExist( "EP2TournamentObjective1" ) )
  9519. {
  9520. FactsRemove( "EP2TournamentObjective1" );
  9521. }
  9522.  
  9523. if ( gwentPower >= checkBreakpoint*2 )
  9524. {
  9525. FactsAdd( "EP2TournamentObjective2", 1 );
  9526. }
  9527. else if ( FactsDoesExist( "EP2TournamentObjective2" ) )
  9528. {
  9529. FactsRemove( "EP2TournamentObjective2" );
  9530. }
  9531.  
  9532. if ( gwentPower >= checkBreakpoint*3 )
  9533. {
  9534. FactsAdd( "EP2TournamentObjective3", 1 );
  9535. }
  9536. else if ( FactsDoesExist( "EP2TournamentObjective3" ) )
  9537. {
  9538. FactsRemove( "EP2TournamentObjective3" );
  9539. }
  9540.  
  9541. if ( gwentPower >= checkBreakpoint*4 )
  9542. {
  9543. FactsAdd( "EP2TournamentObjective4", 1 );
  9544. }
  9545. else if ( FactsDoesExist( "EP2TournamentObjective4" ) )
  9546. {
  9547. FactsRemove( "EP2TournamentObjective4" );
  9548. }
  9549. }
  9550. }
  9551.  
  9552.  
  9553.  
  9554.  
  9555.  
  9556.  
  9557. public function SimulateBuffTimePassing(simulatedTime : float)
  9558. {
  9559. super.SimulateBuffTimePassing(simulatedTime);
  9560.  
  9561. FinishQuen(true);
  9562. }
  9563.  
  9564.  
  9565. public function CanMeditate() : bool
  9566. {
  9567. var currentStateName : name;
  9568.  
  9569. currentStateName = GetCurrentStateName();
  9570.  
  9571.  
  9572. if(currentStateName == 'Exploration' && !CanPerformPlayerAction())
  9573. return false;
  9574.  
  9575.  
  9576. if(GetCurrentStateName() != 'Exploration' && GetCurrentStateName() != 'Meditation' && GetCurrentStateName() != 'MeditationWaiting')
  9577. return false;
  9578.  
  9579.  
  9580. if(GetUsedVehicle())
  9581. return false;
  9582.  
  9583.  
  9584. return CanMeditateHere();
  9585. }
  9586.  
  9587.  
  9588. public final function CanMeditateWait(optional skipMeditationStateCheck : bool) : bool
  9589. {
  9590. var currState : name;
  9591.  
  9592. currState = GetCurrentStateName();
  9593.  
  9594.  
  9595.  
  9596. if(!skipMeditationStateCheck && currState != 'Meditation')
  9597. return false;
  9598.  
  9599.  
  9600. if(theGame.IsGameTimePaused())
  9601. return false;
  9602.  
  9603. if(!IsActionAllowed( EIAB_MeditationWaiting ))
  9604. return false;
  9605.  
  9606. return true;
  9607. }
  9608.  
  9609.  
  9610. public final function CanMeditateHere() : bool
  9611. {
  9612. var pos : Vector;
  9613.  
  9614. pos = GetWorldPosition();
  9615. if(pos.Z <= theGame.GetWorld().GetWaterLevel(pos, true) && IsInShallowWater())
  9616. return false;
  9617.  
  9618. if(IsThreatened())
  9619. return false;
  9620.  
  9621. return true;
  9622. }
  9623.  
  9624.  
  9625. public function Meditate() : bool
  9626. {
  9627. var medState : W3PlayerWitcherStateMeditation;
  9628. var stateName : name;
  9629.  
  9630. stateName = GetCurrentStateName();
  9631.  
  9632.  
  9633. if (!CanMeditate() || stateName == 'MeditationWaiting' )
  9634. return false;
  9635.  
  9636. GotoState('Meditation');
  9637. medState = (W3PlayerWitcherStateMeditation)GetState('Meditation');
  9638. medState.SetMeditationPointHeading(GetHeading());
  9639.  
  9640. return true;
  9641. }
  9642.  
  9643.  
  9644. public final function MeditationRestoring(simulatedTime : float)
  9645. {
  9646.  
  9647. if ( theGame.GetDifficultyMode() != EDM_Hard && theGame.GetDifficultyMode() != EDM_Hardcore )
  9648. {
  9649. Heal(GetStatMax(BCS_Vitality));
  9650. }
  9651.  
  9652.  
  9653. abilityManager.DrainToxicity( abilityManager.GetStat( BCS_Toxicity ) );
  9654. abilityManager.DrainFocus( abilityManager.GetStat( BCS_Focus ) );
  9655.  
  9656.  
  9657. inv.SingletonItemsRefillAmmo();
  9658.  
  9659.  
  9660. SimulateBuffTimePassing(simulatedTime);
  9661.  
  9662.  
  9663. ApplyWitcherHouseBuffs();
  9664. }
  9665.  
  9666. var clockMenu : CR4MeditationClockMenu;
  9667.  
  9668. public function MeditationClockStart(m : CR4MeditationClockMenu)
  9669. {
  9670. clockMenu = m;
  9671. AddTimer('UpdateClockTime',0.1,true);
  9672. }
  9673.  
  9674. public function MeditationClockStop()
  9675. {
  9676. clockMenu = NULL;
  9677. RemoveTimer('UpdateClockTime');
  9678. }
  9679.  
  9680. public timer function UpdateClockTime(dt : float, id : int)
  9681. {
  9682. if(clockMenu)
  9683. clockMenu.UpdateCurrentHours();
  9684. else
  9685. RemoveTimer('UpdateClockTime');
  9686. }
  9687.  
  9688. private var waitTimeHour : int;
  9689. public function SetWaitTargetHour(t : int)
  9690. {
  9691. waitTimeHour = t;
  9692. }
  9693. public function GetWaitTargetHour() : int
  9694. {
  9695. return waitTimeHour;
  9696. }
  9697.  
  9698. public function MeditationForceAbort(forceCloseUI : bool)
  9699. {
  9700. var waitt : W3PlayerWitcherStateMeditationWaiting;
  9701. var medd : W3PlayerWitcherStateMeditation;
  9702. var currentStateName : name;
  9703.  
  9704. currentStateName = GetCurrentStateName();
  9705.  
  9706. if(currentStateName == 'MeditationWaiting')
  9707. {
  9708. waitt = (W3PlayerWitcherStateMeditationWaiting)GetCurrentState();
  9709. if(waitt)
  9710. {
  9711. waitt.StopRequested(forceCloseUI);
  9712. }
  9713. }
  9714. else if(currentStateName == 'Meditation')
  9715. {
  9716. medd = (W3PlayerWitcherStateMeditation)GetCurrentState();
  9717. if(medd)
  9718. {
  9719. medd.StopRequested(forceCloseUI);
  9720. }
  9721. }
  9722.  
  9723.  
  9724.  
  9725. if( forceCloseUI && theGame.GetGuiManager().IsAnyMenu() && !theGame.GetPhotomodeEnabled() )
  9726. {
  9727. theGame.GetGuiManager().GetRootMenu().CloseMenu();
  9728. DisplayActionDisallowedHudMessage(EIAB_MeditationWaiting, false, false, true, false);
  9729. }
  9730. }
  9731.  
  9732. public function Runeword10Triggerred()
  9733. {
  9734. var min, max : SAbilityAttributeValue;
  9735. var amount : float;
  9736.  
  9737.  
  9738.  
  9739. theGame.GetDefinitionsManager().GetAbilityAttributeValue( 'Runeword 10 _Stats', 'stamina_runeword_gain', min, max );
  9740.  
  9741.  
  9742. amount = min.valueMultiplicative * GetStatMax(BCS_Stamina);
  9743. if ( GetStat(BCS_Stamina) + amount > GetStatMax(BCS_Stamina) )
  9744. {
  9745. amount = GetStatMax(BCS_Stamina) - GetStat(BCS_Stamina);
  9746. }
  9747. GainStat(BCS_Stamina, amount);
  9748.  
  9749.  
  9750. PlayEffect('runeword_10_stamina');
  9751. }
  9752.  
  9753. public function Runeword12Triggerred()
  9754. {
  9755. var min, max : SAbilityAttributeValue;
  9756. var amount : float;
  9757.  
  9758.  
  9759.  
  9760. theGame.GetDefinitionsManager().GetAbilityAttributeValue( 'Runeword 12 _Stats', 'focus_runeword_gain', min, max );
  9761.  
  9762.  
  9763. amount = RandRangeF(max.valueAdditive, min.valueAdditive);
  9764. if ( GetStat(BCS_Focus) + amount > GetStatMax(BCS_Focus) )
  9765. {
  9766. amount = GetStatMax(BCS_Focus) - GetStat(BCS_Focus);
  9767. }
  9768. GainStat(BCS_Focus, amount);
  9769.  
  9770.  
  9771. PlayEffect('runeword_20_adrenaline');
  9772. }
  9773.  
  9774. var runeword10TriggerredOnFinisher, runeword12TriggerredOnFinisher : bool;
  9775.  
  9776. event OnFinisherStart()
  9777. {
  9778. super.OnFinisherStart();
  9779.  
  9780. runeword10TriggerredOnFinisher = false;
  9781. runeword12TriggerredOnFinisher = false;
  9782. }
  9783.  
  9784. public function ApplyWitcherHouseBuffs()
  9785. {
  9786. var l_bed : W3WitcherBed;
  9787.  
  9788. if( FactsQuerySum( "PlayerInsideInnerWitcherHouse" ) > 0 )
  9789. {
  9790. l_bed = (W3WitcherBed)theGame.GetEntityByTag( 'witcherBed' );
  9791.  
  9792. if( l_bed.GetWasUsed() )
  9793. {
  9794. if( l_bed.GetBedLevel() != 0 )
  9795. {
  9796. AddEffectDefault( EET_WellRested, this, "Bed Buff" );
  9797. }
  9798.  
  9799. if( FactsQuerySum( "StablesExists" ) )
  9800. {
  9801. AddEffectDefault( EET_HorseStableBuff, this, "Stables" );
  9802. }
  9803.  
  9804. if( l_bed.GetWereItemsRefilled() )
  9805. {
  9806. theGame.GetGuiManager().ShowNotification( GetLocStringByKeyExt( "message_common_alchemy_table_buff_applied" ),, true );
  9807. l_bed.SetWereItemsRefilled( false );
  9808. }
  9809.  
  9810. AddEffectDefault( EET_BookshelfBuff, this, "Bookshelf" );
  9811.  
  9812. Heal( GetStatMax( BCS_Vitality ) );
  9813. }
  9814. }
  9815. }
  9816.  
  9817.  
  9818.  
  9819.  
  9820.  
  9821. public function CheatResurrect()
  9822. {
  9823. super.CheatResurrect();
  9824. theGame.ReleaseNoSaveLock(theGame.deathSaveLockId);
  9825. theInput.RestoreContext( 'Exploration', true );
  9826. }
  9827.  
  9828.  
  9829. public function Debug_EquipTestingSkills(equip : bool, force : bool)
  9830. {
  9831. var skills : array<ESkill>;
  9832. var i, slot : int;
  9833.  
  9834.  
  9835. ((W3PlayerAbilityManager)abilityManager).OnLevelGained(36);
  9836.  
  9837. skills.PushBack(S_Magic_s01);
  9838. skills.PushBack(S_Magic_s02);
  9839. skills.PushBack(S_Magic_s03);
  9840. skills.PushBack(S_Magic_s04);
  9841. skills.PushBack(S_Magic_s05);
  9842. skills.PushBack(S_Sword_s01);
  9843. skills.PushBack(S_Sword_s02);
  9844.  
  9845.  
  9846. if(equip)
  9847. {
  9848. for(i=0; i<skills.Size(); i+=1)
  9849. {
  9850. if(!force && IsSkillEquipped(skills[i]))
  9851. continue;
  9852.  
  9853.  
  9854. if(GetSkillLevel(skills[i]) == 0)
  9855. AddSkill(skills[i]);
  9856.  
  9857.  
  9858. if(force)
  9859. slot = i+1;
  9860. else
  9861. slot = GetFreeSkillSlot();
  9862.  
  9863.  
  9864. EquipSkill(skills[i], slot);
  9865. }
  9866. }
  9867. else
  9868. {
  9869. for(i=0; i<skills.Size(); i+=1)
  9870. {
  9871. UnequipSkill(GetSkillSlotID(skills[i]));
  9872. }
  9873. }
  9874. }
  9875.  
  9876. public function Debug_ClearCharacterDevelopment(optional keepInv : bool)
  9877. {
  9878. var template : CEntityTemplate;
  9879. var entity : CEntity;
  9880. var invTesting : CInventoryComponent;
  9881. var i : int;
  9882. var items : array<SItemUniqueId>;
  9883. var abs : array<name>;
  9884.  
  9885. delete abilityManager;
  9886. delete levelManager;
  9887. delete effectManager;
  9888.  
  9889.  
  9890. GetCharacterStats().GetAbilities(abs, false);
  9891. for(i=0; i<abs.Size(); i+=1)
  9892. RemoveAbility(abs[i]);
  9893.  
  9894.  
  9895. abs.Clear();
  9896. GetCharacterStatsParam(abs);
  9897. for(i=0; i<abs.Size(); i+=1)
  9898. AddAbility(abs[i]);
  9899.  
  9900.  
  9901. levelManager = new W3LevelManager in this;
  9902. levelManager.Initialize();
  9903. levelManager.PostInit(this, false, true);
  9904.  
  9905.  
  9906. AddAbility('GeraltSkills_Testing');
  9907. SetAbilityManager();
  9908. abilityManager.Init(this, GetCharacterStats(), false, theGame.GetDifficultyMode());
  9909.  
  9910. SetEffectManager();
  9911.  
  9912. abilityManager.PostInit();
  9913.  
  9914.  
  9915.  
  9916.  
  9917.  
  9918. if(!keepInv)
  9919. {
  9920. inv.RemoveAllItems();
  9921. }
  9922.  
  9923.  
  9924. template = (CEntityTemplate)LoadResource("geralt_inventory_release");
  9925. entity = theGame.CreateEntity(template, Vector(0,0,0));
  9926. invTesting = (CInventoryComponent)entity.GetComponentByClassName('CInventoryComponent');
  9927. invTesting.GiveAllItemsTo(inv, true);
  9928. entity.Destroy();
  9929.  
  9930.  
  9931. inv.GetAllItems(items);
  9932. for(i=0; i<items.Size(); i+=1)
  9933. {
  9934. if(!inv.ItemHasTag(items[i], 'NoDrop'))
  9935. EquipItem(items[i]);
  9936. }
  9937.  
  9938.  
  9939. Debug_GiveTestingItems(0);
  9940. }
  9941.  
  9942. function Debug_BearSetBonusQuenSkills()
  9943. {
  9944. var skills : array<ESkill>;
  9945. var i, slot : int;
  9946.  
  9947. skills.PushBack(S_Magic_s04);
  9948. skills.PushBack(S_Magic_s14);
  9949.  
  9950. for(i=0; i<skills.Size(); i+=1)
  9951. {
  9952.  
  9953. if(GetSkillLevel(skills[i]) == 0)
  9954. {
  9955. AddSkill(skills[i]);
  9956. }
  9957.  
  9958. slot = GetFreeSkillSlot();
  9959.  
  9960.  
  9961. EquipSkill(skills[i], slot);
  9962. }
  9963. }
  9964.  
  9965. final function Debug_HAX_UnlockSkillSlot(slotIndex : int) : bool
  9966. {
  9967. if(abilityManager && abilityManager.IsInitialized())
  9968. return ((W3PlayerAbilityManager)abilityManager).Debug_HAX_UnlockSkillSlot(slotIndex);
  9969.  
  9970. return false;
  9971. }
  9972.  
  9973.  
  9974. public function GetLevelupAbility( id : int) : name
  9975. {
  9976. switch(id)
  9977. {
  9978. case 1: return 'Lvl1';
  9979. case 2: return 'Lvl2';
  9980. case 3: return 'Lvl3';
  9981. case 4: return 'Lvl4';
  9982. case 5: return 'Lvl5';
  9983. case 6: return 'Lvl6';
  9984. case 7: return 'Lvl7';
  9985. case 8: return 'Lvl8';
  9986. case 9: return 'Lvl9';
  9987. case 10: return 'Lvl10';
  9988. case 11: return 'Lvl11';
  9989. case 12: return 'Lvl12';
  9990. case 13: return 'Lvl13';
  9991. case 14: return 'Lvl14';
  9992. case 15: return 'Lvl15';
  9993. case 16: return 'Lvl16';
  9994. case 17: return 'Lvl17';
  9995. case 18: return 'Lvl18';
  9996. case 19: return 'Lvl19';
  9997. case 20: return 'Lvl20';
  9998. case 21: return 'Lvl21';
  9999. case 22: return 'Lvl22';
  10000. case 23: return 'Lvl23';
  10001. case 24: return 'Lvl24';
  10002. case 25: return 'Lvl25';
  10003. case 26: return 'Lvl26';
  10004. case 27: return 'Lvl27';
  10005. case 28: return 'Lvl28';
  10006. case 29: return 'Lvl29';
  10007. case 30: return 'Lvl30';
  10008. case 31: return 'Lvl31';
  10009. case 32: return 'Lvl32';
  10010. case 33: return 'Lvl33';
  10011. case 34: return 'Lvl34';
  10012. case 35: return 'Lvl35';
  10013. case 36: return 'Lvl36';
  10014. case 37: return 'Lvl37';
  10015. case 38: return 'Lvl38';
  10016. case 39: return 'Lvl39';
  10017. case 40: return 'Lvl40';
  10018. case 41: return 'Lvl41';
  10019. case 42: return 'Lvl42';
  10020. case 43: return 'Lvl43';
  10021. case 44: return 'Lvl44';
  10022. case 45: return 'Lvl45';
  10023. case 46: return 'Lvl46';
  10024. case 47: return 'Lvl47';
  10025. case 48: return 'Lvl48';
  10026. case 49: return 'Lvl49';
  10027. case 50: return 'Lvl50';
  10028.  
  10029. default: return '';
  10030. }
  10031.  
  10032. return '';
  10033. }
  10034.  
  10035. public function CanSprint( speed : float ) : bool
  10036. {
  10037. if( !super.CanSprint( speed ) )
  10038. {
  10039. return false;
  10040. }
  10041. if( rangedWeapon && rangedWeapon.GetCurrentStateName() != 'State_WeaponWait' )
  10042. {
  10043. if ( this.GetPlayerCombatStance() == PCS_AlertNear )
  10044. {
  10045. if ( IsSprintActionPressed() )
  10046. OnRangedForceHolster( true, false );
  10047. }
  10048. else
  10049. return false;
  10050. }
  10051. if( GetCurrentStateName() != 'Swimming' && GetStat(BCS_Stamina) <= 0 )
  10052. {
  10053. SetSprintActionPressed(false,true);
  10054. return false;
  10055. }
  10056.  
  10057. return true;
  10058. }
  10059.  
  10060. public function ManageSleeping()
  10061. {
  10062. thePlayer.RemoveBuffImmunity_AllCritical( 'Bed' );
  10063. thePlayer.RemoveBuffImmunity_AllNegative( 'Bed' );
  10064.  
  10065. thePlayer.PlayerStopAction( PEA_GoToSleep );
  10066. }
  10067.  
  10068.  
  10069.  
  10070. public function RestoreHorseManager() : bool
  10071. {
  10072. var horseTemplate : CEntityTemplate;
  10073. var horseManager : W3HorseManager;
  10074.  
  10075. if ( GetHorseManager() )
  10076. {
  10077. return false;
  10078. }
  10079.  
  10080. horseTemplate = (CEntityTemplate)LoadResource("horse_manager");
  10081. horseManager = (W3HorseManager)theGame.CreateEntity(horseTemplate, GetWorldPosition(),,,,,PM_Persist);
  10082. horseManager.CreateAttachment(this);
  10083. horseManager.OnCreated();
  10084. EntityHandleSet( horseManagerHandle, horseManager );
  10085.  
  10086. return true;
  10087. }
  10088.  
  10089.  
  10090.  
  10091.  
  10092.  
  10093.  
  10094. final function PerformParryCheck( parryInfo : SParryInfo ) : bool
  10095. {
  10096. if( super.PerformParryCheck( parryInfo ) )
  10097. {
  10098. GainAdrenalineFromPerk21( 'parry' );
  10099. return true;
  10100. }
  10101. return false;
  10102. }
  10103.  
  10104. protected final function PerformCounterCheck( parryInfo: SParryInfo ) : bool
  10105. {
  10106. var fistFightCheck, isInFistFight : bool;
  10107.  
  10108. if( super.PerformCounterCheck( parryInfo ) )
  10109. {
  10110. GainAdrenalineFromPerk21( 'counter' );
  10111.  
  10112. isInFistFight = FistFightCheck( parryInfo.target, parryInfo.attacker, fistFightCheck );
  10113.  
  10114. if( isInFistFight && fistFightCheck )
  10115. {
  10116. FactsAdd( "statistics_fist_fight_counter" );
  10117. AddTimer( 'FistFightCounterTimer', 0.5f, , , , true );
  10118. }
  10119.  
  10120. return true;
  10121. }
  10122. return false;
  10123. }
  10124.  
  10125. public function GainAdrenalineFromPerk21( n : name )
  10126. {
  10127. var perkStats, perkTime : SAbilityAttributeValue;
  10128. var targets : array<CActor>;
  10129.  
  10130. targets = GetHostileEnemies();
  10131.  
  10132. if( !CanUseSkill( S_Perk_21 ) || targets.Size() == 0 )
  10133. {
  10134. return;
  10135. }
  10136.  
  10137. perkTime = GetSkillAttributeValue( S_Perk_21, 'perk21Time', false, false );
  10138.  
  10139. if( theGame.GetEngineTimeAsSeconds() >= timeForPerk21 + perkTime.valueAdditive )
  10140. {
  10141. perkStats = GetSkillAttributeValue( S_Perk_21, n , false, false );
  10142. GainStat( BCS_Focus, perkStats.valueAdditive );
  10143. timeForPerk21 = theGame.GetEngineTimeAsSeconds();
  10144.  
  10145. AddEffectDefault( EET_Perk21InternalCooldown, this, "Perk21", false );
  10146. }
  10147. }
  10148.  
  10149. timer function FistFightCounterTimer( dt : float, id : int )
  10150. {
  10151. FactsRemove( "statistics_fist_fight_counter" );
  10152. }
  10153.  
  10154. public final function IsSignBlocked(signType : ESignType) : bool
  10155. {
  10156. switch( signType )
  10157. {
  10158. case ST_Aard :
  10159. return IsRadialSlotBlocked ( 'Aard');
  10160. break;
  10161. case ST_Axii :
  10162. return IsRadialSlotBlocked ( 'Axii');
  10163. break;
  10164. case ST_Igni :
  10165. return IsRadialSlotBlocked ( 'Igni');
  10166. break;
  10167. case ST_Quen :
  10168. return IsRadialSlotBlocked ( 'Quen');
  10169. break;
  10170. case ST_Yrden :
  10171. return IsRadialSlotBlocked ( 'Yrden');
  10172. break;
  10173. default:
  10174. break;
  10175. }
  10176. return false;
  10177.  
  10178. }
  10179.  
  10180. public final function AddAnItemWithAutogenLevelAndQuality(itemName : name, desiredLevel : int, minQuality : int, optional equipItem : bool)
  10181. {
  10182. var itemLevel, quality : int;
  10183. var ids : array<SItemUniqueId>;
  10184. var attemptCounter : int;
  10185.  
  10186. itemLevel = 0;
  10187. quality = 0;
  10188. attemptCounter = 0;
  10189. while(itemLevel != desiredLevel || quality < minQuality)
  10190. {
  10191. attemptCounter += 1;
  10192. ids.Clear();
  10193. ids = inv.AddAnItem(itemName, 1, true);
  10194. itemLevel = inv.GetItemLevel(ids[0]);
  10195. quality = RoundMath(CalculateAttributeValue(inv.GetItemAttributeValue(ids[0], 'quality')));
  10196.  
  10197.  
  10198. if(attemptCounter >= 1000)
  10199. break;
  10200.  
  10201. if(itemLevel != desiredLevel || quality < minQuality)
  10202. inv.RemoveItem(ids[0]);
  10203. }
  10204.  
  10205. if(equipItem)
  10206. EquipItem(ids[0]);
  10207. }
  10208.  
  10209. public final function AddAnItemWithAutogenLevel(itemName : name, desiredLevel : int)
  10210. {
  10211. var itemLevel : int;
  10212. var ids : array<SItemUniqueId>;
  10213. var attemptCounter : int;
  10214.  
  10215. itemLevel = 0;
  10216. while(itemLevel != desiredLevel)
  10217. {
  10218. attemptCounter += 1;
  10219. ids.Clear();
  10220. ids = inv.AddAnItem(itemName, 1, true);
  10221. itemLevel = inv.GetItemLevel(ids[0]);
  10222.  
  10223.  
  10224. if(attemptCounter >= 1000)
  10225. break;
  10226.  
  10227. if(itemLevel != desiredLevel)
  10228. inv.RemoveItem(ids[0]);
  10229. }
  10230. }
  10231.  
  10232. public final function AddAnItemWithMinQuality(itemName : name, minQuality : int, optional equip : bool)
  10233. {
  10234. var quality : int;
  10235. var ids : array<SItemUniqueId>;
  10236. var attemptCounter : int;
  10237.  
  10238. quality = 0;
  10239. while(quality < minQuality)
  10240. {
  10241. attemptCounter += 1;
  10242. ids.Clear();
  10243. ids = inv.AddAnItem(itemName, 1, true);
  10244. quality = RoundMath(CalculateAttributeValue(inv.GetItemAttributeValue(ids[0], 'quality')));
  10245.  
  10246.  
  10247. if(attemptCounter >= 1000)
  10248. break;
  10249.  
  10250. if(quality < minQuality)
  10251. inv.RemoveItem(ids[0]);
  10252. }
  10253.  
  10254. if(equip)
  10255. EquipItem(ids[0]);
  10256. }
  10257.  
  10258.  
  10259.  
  10260.  
  10261.  
  10262.  
  10263. public function IsSetBonusActive( bonus : EItemSetBonus ) : bool
  10264. {
  10265. switch(bonus)
  10266. {
  10267. case EISB_Lynx_1: return amountOfSetPiecesEquipped[ EIST_Lynx ] >= theGame.params.ITEMS_REQUIRED_FOR_MINOR_SET_BONUS;
  10268. case EISB_Lynx_2: return amountOfSetPiecesEquipped[ EIST_Lynx ] >= theGame.params.ITEMS_REQUIRED_FOR_MAJOR_SET_BONUS;
  10269. case EISB_Gryphon_1: return amountOfSetPiecesEquipped[ EIST_Gryphon ] >= theGame.params.ITEMS_REQUIRED_FOR_MINOR_SET_BONUS;
  10270. case EISB_Gryphon_2: return amountOfSetPiecesEquipped[ EIST_Gryphon ] >= theGame.params.ITEMS_REQUIRED_FOR_MAJOR_SET_BONUS;
  10271. case EISB_Bear_1: return amountOfSetPiecesEquipped[ EIST_Bear ] >= theGame.params.ITEMS_REQUIRED_FOR_MINOR_SET_BONUS;
  10272. case EISB_Bear_2: return amountOfSetPiecesEquipped[ EIST_Bear ] >= theGame.params.ITEMS_REQUIRED_FOR_MAJOR_SET_BONUS;
  10273. case EISB_Wolf_1: return amountOfSetPiecesEquipped[ EIST_Wolf ] >= theGame.params.ITEMS_REQUIRED_FOR_MINOR_SET_BONUS;
  10274. case EISB_Wolf_2: return amountOfSetPiecesEquipped[ EIST_Wolf ] >= theGame.params.ITEMS_REQUIRED_FOR_MAJOR_SET_BONUS;
  10275. case EISB_RedWolf_1: return amountOfSetPiecesEquipped[ EIST_RedWolf ] >= theGame.params.ITEMS_REQUIRED_FOR_MINOR_SET_BONUS;
  10276. case EISB_RedWolf_2: return amountOfSetPiecesEquipped[ EIST_RedWolf ] >= theGame.params.ITEMS_REQUIRED_FOR_MAJOR_SET_BONUS;
  10277. case EISB_Vampire: return amountOfSetPiecesEquipped[ EIST_Vampire ] >= theGame.params.ITEMS_REQUIRED_FOR_MINOR_SET_BONUS;
  10278. case EISB_Netflix_1: return amountOfSetPiecesEquipped[ EIST_Netflix ] >= theGame.params.ITEMS_REQUIRED_FOR_MINOR_SET_BONUS;
  10279. case EISB_Netflix_2: return amountOfSetPiecesEquipped[ EIST_Netflix ] >= theGame.params.ITEMS_REQUIRED_FOR_MAJOR_SET_BONUS;
  10280. default: return false;
  10281. }
  10282. }
  10283.  
  10284. public function GetSetPartsEquipped( setType : EItemSetType ) : int
  10285. {
  10286. return amountOfSetPiecesEquipped[ setType ];
  10287. }
  10288.  
  10289. protected function UpdateItemSetBonuses( item : SItemUniqueId, increment : bool )
  10290. {
  10291. var setType : EItemSetType;
  10292. var tutorialStateSets : W3TutorialManagerUIHandlerStateSetItemsUnlocked;
  10293. var id : SItemUniqueId;
  10294.  
  10295. if( !inv.IsIdValid( item ) || !inv.ItemHasTag(item, theGame.params.ITEM_SET_TAG_BONUS ) )
  10296. {
  10297.  
  10298.  
  10299.  
  10300.  
  10301. return;
  10302. }
  10303.  
  10304. setType = CheckSetType( item );
  10305.  
  10306. if( increment )
  10307. {
  10308. amountOfSetPiecesEquipped[ setType ] += 1;
  10309.  
  10310. if( amountOfSetPiecesEquipped[ setType ] >= theGame.params.ITEMS_REQUIRED_FOR_MINOR_SET_BONUS && ShouldProcessTutorial( 'TutorialSetBonusesUnlocked' ) && theGame.GetTutorialSystem().uiHandler && theGame.GetTutorialSystem().uiHandler.GetCurrentStateName() == 'SetItemsUnlocked' )
  10311. {
  10312. tutorialStateSets = ( W3TutorialManagerUIHandlerStateSetItemsUnlocked )theGame.GetTutorialSystem().uiHandler.GetCurrentState();
  10313. tutorialStateSets.OnSetBonusCompleted();
  10314. }
  10315. }
  10316. else if( amountOfSetPiecesEquipped[ setType ] > 0 )
  10317. {
  10318. amountOfSetPiecesEquipped[ setType ] -= 1;
  10319. }
  10320.  
  10321.  
  10322. if( setType != EIST_Vampire )
  10323. {
  10324. if(amountOfSetPiecesEquipped[ setType ] == theGame.params.ITEMS_REQUIRED_FOR_MAJOR_SET_BONUS)
  10325. {
  10326. theGame.GetGamerProfile().AddAchievement( EA_ReadyToRoll );
  10327. }
  10328. else
  10329. {
  10330. theGame.GetGamerProfile().NoticeAchievementProgress( EA_ReadyToRoll, amountOfSetPiecesEquipped[ setType ]);
  10331. }
  10332. }
  10333.  
  10334.  
  10335.  
  10336.  
  10337.  
  10338.  
  10339. ManageActiveSetBonuses( setType );
  10340.  
  10341.  
  10342. ManageSetBonusesSoundbanks( setType );
  10343. }
  10344.  
  10345. public function ManageActiveSetBonuses( setType : EItemSetType )
  10346. {
  10347. var l_i : int;
  10348.  
  10349.  
  10350. if( setType == EIST_Lynx )
  10351. {
  10352.  
  10353. if( HasBuff( EET_LynxSetBonus ) && !IsSetBonusActive( EISB_Lynx_1 ) )
  10354. {
  10355. RemoveBuff( EET_LynxSetBonus );
  10356. }
  10357. }
  10358.  
  10359. else if( setType == EIST_Gryphon )
  10360. {
  10361.  
  10362. if( !IsSetBonusActive( EISB_Gryphon_1 ) )
  10363. {
  10364. RemoveBuff( EET_GryphonSetBonus );
  10365. }
  10366.  
  10367. if( IsSetBonusActive( EISB_Gryphon_2 ) && !HasBuff( EET_GryphonSetBonusYrden ) )
  10368. {
  10369. for( l_i = 0 ; l_i < yrdenEntities.Size() ; l_i += 1 )
  10370. {
  10371. if( yrdenEntities[ l_i ].GetIsPlayerInside() && !yrdenEntities[ l_i ].IsAlternateCast() )
  10372. {
  10373. AddEffectDefault( EET_GryphonSetBonusYrden, this, "GryphonSetBonusYrden" );
  10374. break;
  10375. }
  10376. }
  10377. }
  10378. else
  10379. {
  10380. RemoveBuff( EET_GryphonSetBonusYrden );
  10381. }
  10382. }
  10383. }
  10384.  
  10385. public function CheckSetTypeByName( itemName : name ) : EItemSetType
  10386. {
  10387. var dm : CDefinitionsManagerAccessor;
  10388.  
  10389. dm = theGame.GetDefinitionsManager();
  10390.  
  10391. if( dm.ItemHasTag( itemName, theGame.params.ITEM_SET_TAG_LYNX ) )
  10392. {
  10393. return EIST_Lynx;
  10394. }
  10395. else
  10396. if( dm.ItemHasTag( itemName, theGame.params.ITEM_SET_TAG_GRYPHON ) )
  10397. {
  10398. return EIST_Gryphon;
  10399. }
  10400. else
  10401. if( dm.ItemHasTag( itemName, theGame.params.ITEM_SET_TAG_BEAR ) )
  10402. {
  10403. return EIST_Bear;
  10404. }
  10405. else
  10406. if( dm.ItemHasTag( itemName, theGame.params.ITEM_SET_TAG_WOLF ) )
  10407. {
  10408. return EIST_Wolf;
  10409. }
  10410. else
  10411. if( dm.ItemHasTag( itemName, theGame.params.ITEM_SET_TAG_RED_WOLF ) )
  10412. {
  10413. return EIST_RedWolf;
  10414. }
  10415. else
  10416. if( dm.ItemHasTag( itemName, theGame.params.ITEM_SET_TAG_VAMPIRE ) )
  10417. {
  10418. return EIST_Vampire;
  10419. }
  10420. else
  10421. if( dm.ItemHasTag( itemName, theGame.params.ITEM_SET_TAG_VIPER ) )
  10422. {
  10423. return EIST_Viper;
  10424. }
  10425. else
  10426. if( dm.ItemHasTag( itemName, theGame.params.ITEM_SET_TAG_NETFLIX ) )
  10427. {
  10428. return EIST_Netflix;
  10429. }
  10430. else
  10431. {
  10432. return EIST_Undefined;
  10433. }
  10434. }
  10435.  
  10436. public function CheckSetType( item : SItemUniqueId ) : EItemSetType
  10437. {
  10438. var stopLoop : bool;
  10439. var tags : array<name>;
  10440. var i : int;
  10441. var setType : EItemSetType;
  10442.  
  10443. stopLoop = false;
  10444.  
  10445. inv.GetItemTags( item, tags );
  10446.  
  10447.  
  10448. for( i=0; i<tags.Size(); i+=1 )
  10449. {
  10450. switch( tags[i] )
  10451. {
  10452. case theGame.params.ITEM_SET_TAG_LYNX:
  10453. case theGame.params.ITEM_SET_TAG_GRYPHON:
  10454. case theGame.params.ITEM_SET_TAG_BEAR:
  10455. case theGame.params.ITEM_SET_TAG_WOLF:
  10456. case theGame.params.ITEM_SET_TAG_RED_WOLF:
  10457. case theGame.params.ITEM_SET_TAG_VAMPIRE:
  10458. case theGame.params.ITEM_SET_TAG_VIPER:
  10459. case theGame.params.ITEM_SET_TAG_NETFLIX:
  10460. setType = SetItemNameToType( tags[i] );
  10461. stopLoop = true;
  10462. break;
  10463. }
  10464. if ( stopLoop )
  10465. {
  10466. break;
  10467. }
  10468. }
  10469.  
  10470. return setType;
  10471. }
  10472.  
  10473. public function GetSetBonusStatusByName( itemName : name, out desc1, desc2 : string, out isActive1, isActive2 : bool ) : EItemSetType
  10474. {
  10475. var setType : EItemSetType;
  10476.  
  10477. if( theGame.GetDLCManager().IsEP2Enabled() )
  10478. {
  10479. setType = CheckSetTypeByName( itemName );
  10480. SetBonusStatusByType( setType, desc1, desc2, isActive1, isActive2 );
  10481.  
  10482. return setType;
  10483. }
  10484. else
  10485. {
  10486. return EIST_Undefined;
  10487. }
  10488. }
  10489.  
  10490. public function GetSetBonusStatus( item : SItemUniqueId, out desc1, desc2 : string, out isActive1, isActive2 : bool ) : EItemSetType
  10491. {
  10492. var setType : EItemSetType;
  10493.  
  10494. if( theGame.GetDLCManager().IsEP2Enabled() )
  10495. {
  10496. setType = CheckSetType( item );
  10497. SetBonusStatusByType( setType, desc1, desc2, isActive1, isActive2 );
  10498.  
  10499. return setType;
  10500. }
  10501. else
  10502. {
  10503. return EIST_Undefined;
  10504. }
  10505. }
  10506.  
  10507. private function SetBonusStatusByType(setType : EItemSetType, out desc1, desc2 : string, out isActive1, isActive2 : bool):void
  10508. {
  10509. var setBonus : EItemSetBonus;
  10510.  
  10511. if( amountOfSetPiecesEquipped[ setType ] >= theGame.params.ITEMS_REQUIRED_FOR_MINOR_SET_BONUS )
  10512. {
  10513. isActive1 = true;
  10514. }
  10515.  
  10516. if( amountOfSetPiecesEquipped[ setType ] >= theGame.params.ITEMS_REQUIRED_FOR_MAJOR_SET_BONUS )
  10517. {
  10518. isActive2 = true;
  10519. }
  10520.  
  10521. setBonus = ItemSetTypeToItemSetBonus( setType, 1 );
  10522. desc1 = GetSetBonusTooltipDescription( setBonus );
  10523.  
  10524. setBonus = ItemSetTypeToItemSetBonus( setType, 2 );
  10525. desc2 = GetSetBonusTooltipDescription( setBonus );
  10526. }
  10527.  
  10528. public function ItemSetTypeToItemSetBonus( setType : EItemSetType, nr : int ) : EItemSetBonus
  10529. {
  10530. var setBonus : EItemSetBonus;
  10531.  
  10532. if( nr == 1 )
  10533. {
  10534. switch( setType )
  10535. {
  10536. case EIST_Lynx: setBonus = EISB_Lynx_1; break;
  10537. case EIST_Gryphon: setBonus = EISB_Gryphon_1; break;
  10538. case EIST_Bear: setBonus = EISB_Bear_1; break;
  10539. case EIST_Wolf: setBonus = EISB_Wolf_1; break;
  10540. case EIST_RedWolf: setBonus = EISB_RedWolf_1; break;
  10541. case EIST_Vampire: setBonus = EISB_Vampire; break;
  10542. case EIST_Netflix: setBonus = EISB_Netflix_1; break;
  10543. }
  10544. }
  10545. else
  10546. {
  10547. switch( setType )
  10548. {
  10549. case EIST_Lynx: setBonus = EISB_Lynx_2; break;
  10550. case EIST_Gryphon: setBonus = EISB_Gryphon_2; break;
  10551. case EIST_Bear: setBonus = EISB_Bear_2; break;
  10552. case EIST_Wolf: setBonus = EISB_Wolf_2; break;
  10553. case EIST_RedWolf: setBonus = EISB_RedWolf_2; break;
  10554. case EIST_Vampire: setBonus = EISB_Undefined; break;
  10555. case EIST_Netflix: setBonus = EISB_Netflix_2; break;
  10556. }
  10557. }
  10558.  
  10559. return setBonus;
  10560. }
  10561.  
  10562. public function GetSetBonusTooltipDescription( bonus : EItemSetBonus ) : string
  10563. {
  10564. var finalString : string;
  10565. var arrString : array<string>;
  10566. var dm : CDefinitionsManagerAccessor;
  10567. var min, max : SAbilityAttributeValue;
  10568. var tempString : string;
  10569.  
  10570. switch( bonus )
  10571. {
  10572. case EISB_Lynx_1: tempString = "skill_desc_lynx_set_ability1"; break;
  10573. case EISB_Lynx_2: tempString = "skill_desc_lynx_set_ability2"; break;
  10574. case EISB_Gryphon_1: tempString = "skill_desc_gryphon_set_ability1"; break;
  10575. case EISB_Gryphon_2: tempString = "skill_desc_gryphon_set_ability2"; break;
  10576. case EISB_Bear_1: tempString = "skill_desc_bear_set_ability1"; break;
  10577. case EISB_Bear_2: tempString = "skill_desc_bear_set_ability2"; break;
  10578. case EISB_Wolf_1: tempString = "skill_desc_wolf_set_ability2"; break;
  10579. case EISB_Wolf_2: tempString = "skill_desc_wolf_set_ability1"; break;
  10580. case EISB_RedWolf_1: tempString = "skill_desc_red_wolf_set_ability1"; break;
  10581. case EISB_RedWolf_2: tempString = "skill_desc_red_wolf_set_ability2"; break;
  10582. case EISB_Vampire: tempString = "skill_desc_vampire_set_ability1"; break;
  10583. case EISB_Netflix_1: tempString = "skill_desc_netflix_set_ability1"; break;
  10584. case EISB_Netflix_2: tempString = "skill_desc_netflix_set_ability2"; break;
  10585. default: tempString = ""; break;
  10586. }
  10587.  
  10588. dm = theGame.GetDefinitionsManager();
  10589.  
  10590. switch( bonus )
  10591. {
  10592. case EISB_Lynx_1:
  10593. dm.GetAbilityAttributeValue( 'LynxSetBonusEffect', 'duration', min, max );
  10594. arrString.PushBack( FloatToString( min.valueAdditive ) );
  10595. dm.GetAbilityAttributeValue( 'LynxSetBonusEffect', 'lynx_dmg_boost', min, max );
  10596. arrString.PushBack( FloatToString( min.valueAdditive * 100 ) );
  10597. arrString.PushBack( FloatToString( min.valueAdditive * 100 * amountOfSetPiecesEquipped[ EIST_Lynx ] ) );
  10598. finalString = GetLocStringByKeyExtWithParams( tempString,,,arrString );
  10599. break;
  10600. case EISB_Lynx_2:
  10601. dm.GetAbilityAttributeValue( GetSetBonusAbility( EISB_Lynx_2 ), 'lynx_2_dmg_boost', min, max );
  10602. arrString.PushBack( FloatToString( min.valueAdditive * 100 ) );
  10603.  
  10604. dm.GetAbilityAttributeValue( GetSetBonusAbility( EISB_Lynx_2 ), 'lynx_2_adrenaline_cost', min, max );
  10605. arrString.PushBack( FloatToString( min.valueAdditive ) );
  10606.  
  10607. finalString = GetLocStringByKeyExtWithParams( tempString,,,arrString );
  10608. break;
  10609. case EISB_Gryphon_1:
  10610. dm.GetAbilityAttributeValue( 'GryphonSetBonusEffect', 'duration', min, max );
  10611. arrString.PushBack( FloatToString( min.valueAdditive ) );
  10612. finalString = GetLocStringByKeyExtWithParams( tempString,,,arrString );
  10613. break;
  10614. case EISB_Gryphon_2:
  10615. dm.GetAbilityAttributeValue( 'GryphonSetBonusYrdenEffect', 'trigger_scale', min, max );
  10616. arrString.PushBack( FloatToString( ( min.valueAdditive - 1 )* 100) );
  10617. dm.GetAbilityAttributeValue( 'GryphonSetBonusYrdenEffect', 'staminaRegen', min, max );
  10618. arrString.PushBack( FloatToString( min.valueMultiplicative * 100) );
  10619. dm.GetAbilityAttributeValue( 'GryphonSetBonusYrdenEffect', 'spell_power', min, max );
  10620. arrString.PushBack( FloatToString( min.valueMultiplicative * 100) );
  10621. dm.GetAbilityAttributeValue( 'GryphonSetBonusYrdenEffect', 'gryphon_set_bns_dmg_reduction', min, max );
  10622. arrString.PushBack( FloatToString( min.valueAdditive * 100) );
  10623. finalString = GetLocStringByKeyExtWithParams( tempString,,,arrString );
  10624. break;
  10625. case EISB_Bear_1:
  10626. dm.GetAbilityAttributeValue( 'setBonusAbilityBear_1', 'quen_reapply_chance', min, max );
  10627. arrString.PushBack( FloatToString( min.valueMultiplicative * 100 ) );
  10628.  
  10629. arrString.PushBack( FloatToString( min.valueMultiplicative * 100 * amountOfSetPiecesEquipped[ EIST_Bear ] ) );
  10630. finalString = GetLocStringByKeyExtWithParams( tempString,,,arrString );
  10631. break;
  10632. case EISB_Bear_2:
  10633. dm.GetAbilityAttributeValue( 'setBonusAbilityBear_2', 'quen_dmg_boost', min, max );
  10634. arrString.PushBack( FloatToString( min.valueMultiplicative * 100 ) );
  10635. finalString = GetLocStringByKeyExtWithParams( tempString,,,arrString );
  10636. break;
  10637. case EISB_RedWolf_2:
  10638. dm.GetAbilityAttributeValue( 'setBonusAbilityRedWolf_2', 'amount', min, max );
  10639. arrString.PushBack( FloatToString( min.valueAdditive ) );
  10640. finalString = GetLocStringByKeyExtWithParams( tempString,,,arrString );
  10641. break;
  10642. case EISB_Vampire:
  10643. dm.GetAbilityAttributeValue( 'setBonusAbilityVampire', 'life_percent', min, max );
  10644. arrString.PushBack( FloatToString( min.valueAdditive ) );
  10645. arrString.PushBack( FloatToString( min.valueAdditive * amountOfSetPiecesEquipped[ EIST_Vampire ] ) );
  10646. finalString = GetLocStringByKeyExtWithParams( tempString,,,arrString );
  10647. break;
  10648.  
  10649. case EISB_Wolf_1:
  10650. arrString.PushBack( FloatToString( 1 * amountOfSetPiecesEquipped[ EIST_Wolf ] ) );
  10651. finalString = GetLocStringByKeyExtWithParams( tempString,,,arrString );
  10652. break;
  10653.  
  10654. default:
  10655. finalString = GetLocStringByKeyExtWithParams( tempString );
  10656. }
  10657.  
  10658. return finalString;
  10659. }
  10660.  
  10661. public function ManageSetBonusesSoundbanks( setType : EItemSetType )
  10662. {
  10663. if( amountOfSetPiecesEquipped[ setType ] >= theGame.params.ITEMS_REQUIRED_FOR_MINOR_SET_BONUS )
  10664. {
  10665. switch( setType )
  10666. {
  10667. case EIST_Lynx:
  10668. LoadSetBonusSoundBank( "ep2_setbonus_lynx.bnk" );
  10669. break;
  10670. case EIST_Gryphon:
  10671. LoadSetBonusSoundBank( "ep2_setbonus_gryphon.bnk" );
  10672. break;
  10673. case EIST_Bear:
  10674. LoadSetBonusSoundBank( "ep2_setbonus_bear.bnk" );
  10675. break;
  10676. }
  10677. }
  10678. else
  10679. {
  10680. switch( setType )
  10681. {
  10682. case EIST_Lynx:
  10683. UnloadSetBonusSoundBank( "ep2_setbonus_lynx.bnk" );
  10684. break;
  10685. case EIST_Gryphon:
  10686. UnloadSetBonusSoundBank( "ep2_setbonus_gryphon.bnk" );
  10687. break;
  10688. case EIST_Bear:
  10689. UnloadSetBonusSoundBank( "ep2_setbonus_bear.bnk" );
  10690. break;
  10691. }
  10692. }
  10693. }
  10694.  
  10695. public function VampiricSetAbilityRegeneration()
  10696. {
  10697. var healthMax : float;
  10698. var healthToReg : float;
  10699.  
  10700. healthMax = GetStatMax( BCS_Vitality );
  10701.  
  10702. healthToReg = ( amountOfSetPiecesEquipped[ EIST_Vampire ] * healthMax ) / 100;
  10703.  
  10704. PlayEffect('drain_energy_caretaker_shovel');
  10705. GainStat( BCS_Vitality, healthToReg );
  10706. }
  10707.  
  10708. private function LoadSetBonusSoundBank( bankName : string )
  10709. {
  10710. if( !theSound.SoundIsBankLoaded( bankName ) )
  10711. {
  10712. theSound.SoundLoadBank( bankName, true );
  10713. }
  10714. }
  10715.  
  10716. private function UnloadSetBonusSoundBank( bankName : string )
  10717. {
  10718. if( theSound.SoundIsBankLoaded( bankName ) )
  10719. {
  10720. theSound.SoundUnloadBank( bankName );
  10721. }
  10722. }
  10723.  
  10724. timer function BearSetBonusQuenReapply( dt : float, id : int )
  10725. {
  10726. var newQuen : W3QuenEntity;
  10727.  
  10728. newQuen = (W3QuenEntity)theGame.CreateEntity( GetSignTemplate( ST_Quen ), GetWorldPosition(), GetWorldRotation() );
  10729. newQuen.Init( signOwner, GetSignEntity( ST_Quen ), true );
  10730. newQuen.freeFromBearSetBonus = true;
  10731. newQuen.OnStarted();
  10732. newQuen.OnThrowing();
  10733. newQuen.OnEnded();
  10734.  
  10735. m_quenReappliedCount += 1;
  10736.  
  10737. RemoveTimer( 'BearSetBonusQuenReapply');
  10738. }
  10739.  
  10740. public final function StandaloneEp1_1()
  10741. {
  10742. var i, inc, quantityLow, randLow, quantityMedium, randMedium, quantityHigh, randHigh, startingMoney : int;
  10743. var pam : W3PlayerAbilityManager;
  10744. var ids : array<SItemUniqueId>;
  10745. var STARTING_LEVEL : int;
  10746.  
  10747. FactsAdd("StandAloneEP1", 1);
  10748.  
  10749.  
  10750. inv.RemoveAllItems();
  10751.  
  10752.  
  10753. inv.AddAnItem('Illusion Medallion', 1, true, true, false);
  10754. inv.AddAnItem('q103_safe_conduct', 1, true, true, false);
  10755.  
  10756.  
  10757. theGame.GetGamerProfile().ClearAllAchievementsForEP1();
  10758.  
  10759.  
  10760. STARTING_LEVEL = 32;
  10761. inc = STARTING_LEVEL - GetLevel();
  10762. for(i=0; i<inc; i+=1)
  10763. {
  10764. levelManager.AddPoints(EExperiencePoint, levelManager.GetTotalExpForNextLevel() - levelManager.GetPointsTotal(EExperiencePoint), false);
  10765. }
  10766.  
  10767.  
  10768. levelManager.ResetCharacterDev();
  10769. pam = (W3PlayerAbilityManager)abilityManager;
  10770. if(pam)
  10771. {
  10772. pam.ResetCharacterDev();
  10773. }
  10774. levelManager.SetFreeSkillPoints(levelManager.GetLevel() - 1 + 11);
  10775.  
  10776.  
  10777. inv.AddAnItem('Mutagen red', 4);
  10778. inv.AddAnItem('Mutagen green', 4);
  10779. inv.AddAnItem('Mutagen blue', 4);
  10780. inv.AddAnItem('Lesser mutagen red', 2);
  10781. inv.AddAnItem('Lesser mutagen green', 2);
  10782. inv.AddAnItem('Lesser mutagen blue', 2);
  10783. inv.AddAnItem('Greater mutagen green', 1);
  10784. inv.AddAnItem('Greater mutagen blue', 2);
  10785.  
  10786.  
  10787. startingMoney = 40000;
  10788. if(GetMoney() > startingMoney)
  10789. {
  10790. RemoveMoney(GetMoney() - startingMoney);
  10791. }
  10792. else
  10793. {
  10794. AddMoney( 40000 - GetMoney() );
  10795. }
  10796.  
  10797.  
  10798.  
  10799.  
  10800.  
  10801. ids.Clear();
  10802. ids = inv.AddAnItem('EP1 Standalone Starting Armor');
  10803. EquipItem(ids[0]);
  10804. ids.Clear();
  10805. ids = inv.AddAnItem('EP1 Standalone Starting Boots');
  10806. EquipItem(ids[0]);
  10807. ids.Clear();
  10808. ids = inv.AddAnItem('EP1 Standalone Starting Gloves');
  10809. EquipItem(ids[0]);
  10810. ids.Clear();
  10811. ids = inv.AddAnItem('EP1 Standalone Starting Pants');
  10812. EquipItem(ids[0]);
  10813.  
  10814.  
  10815. ids.Clear();
  10816. ids = inv.AddAnItem('EP1 Standalone Starting Steel Sword');
  10817. EquipItem(ids[0]);
  10818. ids.Clear();
  10819. ids = inv.AddAnItem('EP1 Standalone Starting Silver Sword');
  10820. EquipItem(ids[0]);
  10821.  
  10822.  
  10823. inv.AddAnItem('Torch', 1, true, true, false);
  10824.  
  10825.  
  10826. quantityLow = 1;
  10827. randLow = 3;
  10828. quantityMedium = 4;
  10829. randMedium = 4;
  10830. quantityHigh = 8;
  10831. randHigh = 6;
  10832.  
  10833. inv.AddAnItem('Alghoul bone marrow',quantityMedium+RandRange(randMedium));
  10834. inv.AddAnItem('Amethyst dust',quantityLow+RandRange(randLow));
  10835. inv.AddAnItem('Arachas eyes',quantityLow+RandRange(randLow));
  10836. inv.AddAnItem('Arachas venom',quantityLow+RandRange(randLow));
  10837. inv.AddAnItem('Basilisk hide',quantityLow+RandRange(randLow));
  10838. inv.AddAnItem('Basilisk venom',quantityLow+RandRange(randLow));
  10839. inv.AddAnItem('Bear pelt',quantityHigh+RandRange(randHigh));
  10840. inv.AddAnItem('Berserker pelt',quantityLow+RandRange(randLow));
  10841. inv.AddAnItem('Coal',quantityHigh+RandRange(randHigh));
  10842. inv.AddAnItem('Cotton',quantityHigh+RandRange(randHigh));
  10843. inv.AddAnItem('Dark iron ingot',quantityLow+RandRange(randLow));
  10844. inv.AddAnItem('Dark iron ore',quantityLow+RandRange(randLow));
  10845. inv.AddAnItem('Deer hide',quantityHigh+RandRange(randHigh));
  10846. inv.AddAnItem('Diamond dust',quantityLow+RandRange(randLow));
  10847. inv.AddAnItem('Draconide leather',quantityLow+RandRange(randLow));
  10848. inv.AddAnItem('Drowned dead tongue',quantityLow+RandRange(randLow));
  10849. inv.AddAnItem('Drowner brain',quantityMedium+RandRange(randMedium));
  10850. inv.AddAnItem('Dwimeryte ingot',quantityLow+RandRange(randLow));
  10851. inv.AddAnItem('Dwimeryte ore',quantityLow+RandRange(randLow));
  10852. inv.AddAnItem('Emerald dust',quantityLow+RandRange(randLow));
  10853. inv.AddAnItem('Endriag chitin plates',quantityMedium+RandRange(randMedium));
  10854. inv.AddAnItem('Endriag embryo',quantityLow+RandRange(randLow));
  10855. inv.AddAnItem('Ghoul blood',quantityMedium+RandRange(randMedium));
  10856. inv.AddAnItem('Goat hide',quantityMedium+RandRange(randMedium));
  10857. inv.AddAnItem('Hag teeth',quantityMedium+RandRange(randMedium));
  10858. inv.AddAnItem('Hardened leather',quantityMedium+RandRange(randMedium));
  10859. inv.AddAnItem('Hardened timber',quantityMedium+RandRange(randMedium));
  10860. inv.AddAnItem('Harpy feathers',quantityMedium+RandRange(randMedium));
  10861. inv.AddAnItem('Horse hide',quantityLow+RandRange(randLow));
  10862. inv.AddAnItem('Iron ore',quantityHigh+RandRange(randHigh));
  10863. inv.AddAnItem('Leather straps',quantityHigh+RandRange(randHigh));
  10864. inv.AddAnItem('Leather',quantityHigh+RandRange(randHigh));
  10865. inv.AddAnItem('Linen',quantityMedium+RandRange(randMedium));
  10866. inv.AddAnItem('Meteorite ingot',quantityLow+RandRange(randLow));
  10867. inv.AddAnItem('Meteorite ore',quantityMedium+RandRange(randMedium));
  10868. inv.AddAnItem('Necrophage skin',quantityLow+RandRange(randLow));
  10869. inv.AddAnItem('Nekker blood',quantityHigh+RandRange(randHigh));
  10870. inv.AddAnItem('Nekker heart',quantityMedium+RandRange(randMedium));
  10871. inv.AddAnItem('Oil',quantityHigh+RandRange(randHigh));
  10872. inv.AddAnItem('Phosphorescent crystal',quantityLow+RandRange(randLow));
  10873. inv.AddAnItem('Pig hide',quantityMedium+RandRange(randMedium));
  10874. inv.AddAnItem('Pure silver',quantityMedium+RandRange(randMedium));
  10875. inv.AddAnItem('Rabbit pelt',quantityMedium+RandRange(randMedium));
  10876. inv.AddAnItem('Rotfiend blood',quantityMedium+RandRange(randMedium));
  10877. inv.AddAnItem('Sapphire dust',quantityLow+RandRange(randLow));
  10878. inv.AddAnItem('Silk',quantityHigh+RandRange(randHigh));
  10879. inv.AddAnItem('Silver ingot',quantityMedium+RandRange(randMedium));
  10880. inv.AddAnItem('Silver ore',quantityHigh+RandRange(randHigh));
  10881. inv.AddAnItem('Specter dust',quantityMedium+RandRange(randMedium));
  10882. inv.AddAnItem('Steel ingot',quantityHigh+RandRange(randHigh));
  10883. inv.AddAnItem('Steel plate',quantityHigh+RandRange(randHigh));
  10884. inv.AddAnItem('String',quantityHigh+RandRange(randHigh));
  10885. inv.AddAnItem('Thread',quantityHigh+RandRange(randHigh));
  10886. inv.AddAnItem('Timber',quantityHigh+RandRange(randHigh));
  10887. inv.AddAnItem('Twine',quantityMedium+RandRange(randMedium));
  10888. inv.AddAnItem('Venom extract',quantityMedium+RandRange(randMedium));
  10889. inv.AddAnItem('Water essence',quantityMedium+RandRange(randMedium));
  10890. inv.AddAnItem('Wolf liver',quantityHigh+RandRange(randHigh));
  10891. inv.AddAnItem('Wolf pelt',quantityMedium+RandRange(randMedium));
  10892.  
  10893. inv.AddAnItem('Alcohest', 5);
  10894. inv.AddAnItem('Dwarven spirit', 5);
  10895.  
  10896.  
  10897. ids.Clear();
  10898. ids = inv.AddAnItem('Crossbow 5');
  10899. EquipItem(ids[0]);
  10900. ids.Clear();
  10901. ids = inv.AddAnItem('Blunt Bolt', 100);
  10902. EquipItem(ids[0]);
  10903. inv.AddAnItem('Broadhead Bolt', 100);
  10904. inv.AddAnItem('Split Bolt', 100);
  10905.  
  10906.  
  10907. RemoveAllAlchemyRecipes();
  10908. RemoveAllCraftingSchematics();
  10909.  
  10910.  
  10911.  
  10912.  
  10913. AddAlchemyRecipe('Recipe for Cat 1');
  10914.  
  10915.  
  10916.  
  10917. AddAlchemyRecipe('Recipe for Maribor Forest 1');
  10918. AddAlchemyRecipe('Recipe for Petris Philtre 1');
  10919. AddAlchemyRecipe('Recipe for Swallow 1');
  10920. AddAlchemyRecipe('Recipe for Tawny Owl 1');
  10921.  
  10922. AddAlchemyRecipe('Recipe for White Gull 1');
  10923. AddAlchemyRecipe('Recipe for White Honey 1');
  10924. AddAlchemyRecipe('Recipe for White Raffards Decoction 1');
  10925.  
  10926.  
  10927.  
  10928. AddAlchemyRecipe('Recipe for Beast Oil 1');
  10929. AddAlchemyRecipe('Recipe for Cursed Oil 1');
  10930. AddAlchemyRecipe('Recipe for Hanged Man Venom 1');
  10931. AddAlchemyRecipe('Recipe for Hybrid Oil 1');
  10932. AddAlchemyRecipe('Recipe for Insectoid Oil 1');
  10933. AddAlchemyRecipe('Recipe for Magicals Oil 1');
  10934. AddAlchemyRecipe('Recipe for Necrophage Oil 1');
  10935. AddAlchemyRecipe('Recipe for Specter Oil 1');
  10936. AddAlchemyRecipe('Recipe for Vampire Oil 1');
  10937. AddAlchemyRecipe('Recipe for Draconide Oil 1');
  10938. AddAlchemyRecipe('Recipe for Ogre Oil 1');
  10939. AddAlchemyRecipe('Recipe for Relic Oil 1');
  10940. AddAlchemyRecipe('Recipe for Beast Oil 2');
  10941. AddAlchemyRecipe('Recipe for Cursed Oil 2');
  10942. AddAlchemyRecipe('Recipe for Hanged Man Venom 2');
  10943. AddAlchemyRecipe('Recipe for Hybrid Oil 2');
  10944. AddAlchemyRecipe('Recipe for Insectoid Oil 2');
  10945. AddAlchemyRecipe('Recipe for Magicals Oil 2');
  10946. AddAlchemyRecipe('Recipe for Necrophage Oil 2');
  10947. AddAlchemyRecipe('Recipe for Specter Oil 2');
  10948. AddAlchemyRecipe('Recipe for Vampire Oil 2');
  10949. AddAlchemyRecipe('Recipe for Draconide Oil 2');
  10950. AddAlchemyRecipe('Recipe for Ogre Oil 2');
  10951. AddAlchemyRecipe('Recipe for Relic Oil 2');
  10952.  
  10953.  
  10954. AddAlchemyRecipe('Recipe for Dancing Star 1');
  10955.  
  10956. AddAlchemyRecipe('Recipe for Dwimeritum Bomb 1');
  10957.  
  10958. AddAlchemyRecipe('Recipe for Grapeshot 1');
  10959. AddAlchemyRecipe('Recipe for Samum 1');
  10960.  
  10961. AddAlchemyRecipe('Recipe for White Frost 1');
  10962.  
  10963.  
  10964.  
  10965. AddAlchemyRecipe('Recipe for Dwarven spirit 1');
  10966. AddAlchemyRecipe('Recipe for Alcohest 1');
  10967. AddAlchemyRecipe('Recipe for White Gull 1');
  10968.  
  10969.  
  10970. AddStartingSchematics();
  10971.  
  10972.  
  10973. ids.Clear();
  10974. ids = inv.AddAnItem('Swallow 2');
  10975. EquipItem(ids[0]);
  10976. ids.Clear();
  10977. ids = inv.AddAnItem('Thunderbolt 2');
  10978. EquipItem(ids[0]);
  10979. ids.Clear();
  10980. ids = inv.AddAnItem('Tawny Owl 2');
  10981. EquipItem(ids[0]);
  10982. ids.Clear();
  10983.  
  10984. ids = inv.AddAnItem('Grapeshot 2');
  10985. EquipItem(ids[0]);
  10986. ids.Clear();
  10987. ids = inv.AddAnItem('Samum 2');
  10988. EquipItem(ids[0]);
  10989.  
  10990. inv.AddAnItem('Dwimeritum Bomb 1');
  10991. inv.AddAnItem('Dragons Dream 1');
  10992. inv.AddAnItem('Silver Dust Bomb 1');
  10993. inv.AddAnItem('White Frost 2');
  10994. inv.AddAnItem('Devils Puffball 2');
  10995. inv.AddAnItem('Dancing Star 2');
  10996. inv.AddAnItem('Beast Oil 1');
  10997. inv.AddAnItem('Cursed Oil 1');
  10998. inv.AddAnItem('Hanged Man Venom 2');
  10999. inv.AddAnItem('Hybrid Oil 1');
  11000. inv.AddAnItem('Insectoid Oil 1');
  11001. inv.AddAnItem('Magicals Oil 1');
  11002. inv.AddAnItem('Necrophage Oil 2');
  11003. inv.AddAnItem('Specter Oil 1');
  11004. inv.AddAnItem('Vampire Oil 1');
  11005. inv.AddAnItem('Draconide Oil 1');
  11006. inv.AddAnItem('Relic Oil 1');
  11007. inv.AddAnItem('Black Blood 1');
  11008. inv.AddAnItem('Blizzard 1');
  11009. inv.AddAnItem('Cat 2');
  11010. inv.AddAnItem('Full Moon 1');
  11011. inv.AddAnItem('Maribor Forest 1');
  11012. inv.AddAnItem('Petris Philtre 1');
  11013. inv.AddAnItem('White Gull 1', 3);
  11014. inv.AddAnItem('White Honey 2');
  11015. inv.AddAnItem('White Raffards Decoction 1');
  11016.  
  11017.  
  11018. inv.AddAnItem('Mutagen 17');
  11019. inv.AddAnItem('Mutagen 19');
  11020. inv.AddAnItem('Mutagen 27');
  11021. inv.AddAnItem('Mutagen 26');
  11022.  
  11023.  
  11024. inv.AddAnItem('weapon_repair_kit_1', 5);
  11025. inv.AddAnItem('weapon_repair_kit_2', 3);
  11026. inv.AddAnItem('armor_repair_kit_1', 5);
  11027. inv.AddAnItem('armor_repair_kit_2', 3);
  11028.  
  11029.  
  11030. quantityMedium = 2;
  11031. quantityLow = 1;
  11032. inv.AddAnItem('Rune stribog lesser', quantityMedium);
  11033. inv.AddAnItem('Rune stribog', quantityLow);
  11034. inv.AddAnItem('Rune dazhbog lesser', quantityMedium);
  11035. inv.AddAnItem('Rune dazhbog', quantityLow);
  11036. inv.AddAnItem('Rune devana lesser', quantityMedium);
  11037. inv.AddAnItem('Rune devana', quantityLow);
  11038. inv.AddAnItem('Rune zoria lesser', quantityMedium);
  11039. inv.AddAnItem('Rune zoria', quantityLow);
  11040. inv.AddAnItem('Rune morana lesser', quantityMedium);
  11041. inv.AddAnItem('Rune morana', quantityLow);
  11042. inv.AddAnItem('Rune triglav lesser', quantityMedium);
  11043. inv.AddAnItem('Rune triglav', quantityLow);
  11044. inv.AddAnItem('Rune svarog lesser', quantityMedium);
  11045. inv.AddAnItem('Rune svarog', quantityLow);
  11046. inv.AddAnItem('Rune veles lesser', quantityMedium);
  11047. inv.AddAnItem('Rune veles', quantityLow);
  11048. inv.AddAnItem('Rune perun lesser', quantityMedium);
  11049. inv.AddAnItem('Rune perun', quantityLow);
  11050. inv.AddAnItem('Rune elemental lesser', quantityMedium);
  11051. inv.AddAnItem('Rune elemental', quantityLow);
  11052.  
  11053. inv.AddAnItem('Glyph aard lesser', quantityMedium);
  11054. inv.AddAnItem('Glyph aard', quantityLow);
  11055. inv.AddAnItem('Glyph axii lesser', quantityMedium);
  11056. inv.AddAnItem('Glyph axii', quantityLow);
  11057. inv.AddAnItem('Glyph igni lesser', quantityMedium);
  11058. inv.AddAnItem('Glyph igni', quantityLow);
  11059. inv.AddAnItem('Glyph quen lesser', quantityMedium);
  11060. inv.AddAnItem('Glyph quen', quantityLow);
  11061. inv.AddAnItem('Glyph yrden lesser', quantityMedium);
  11062. inv.AddAnItem('Glyph yrden', quantityLow);
  11063.  
  11064.  
  11065. StandaloneEp1_2();
  11066. }
  11067.  
  11068. public final function StandaloneEp1_2()
  11069. {
  11070. var horseId : SItemUniqueId;
  11071. var ids : array<SItemUniqueId>;
  11072. var ents : array< CJournalBase >;
  11073. var i : int;
  11074. var manager : CWitcherJournalManager;
  11075.  
  11076.  
  11077. inv.AddAnItem( 'Cows milk', 20 );
  11078. ids.Clear();
  11079. ids = inv.AddAnItem( 'Dumpling', 44 );
  11080. EquipItem(ids[0]);
  11081.  
  11082.  
  11083. inv.AddAnItem('Clearing Potion', 2, true, false, false);
  11084.  
  11085.  
  11086. GetHorseManager().RemoveAllItems();
  11087.  
  11088. ids.Clear();
  11089. ids = inv.AddAnItem('Horse Bag 2');
  11090. horseId = GetHorseManager().MoveItemToHorse(ids[0]);
  11091. GetHorseManager().EquipItem(horseId);
  11092.  
  11093. ids.Clear();
  11094. ids = inv.AddAnItem('Horse Blinder 2');
  11095. horseId = GetHorseManager().MoveItemToHorse(ids[0]);
  11096. GetHorseManager().EquipItem(horseId);
  11097.  
  11098. ids.Clear();
  11099. ids = inv.AddAnItem('Horse Saddle 2');
  11100. horseId = GetHorseManager().MoveItemToHorse(ids[0]);
  11101. GetHorseManager().EquipItem(horseId);
  11102.  
  11103. manager = theGame.GetJournalManager();
  11104.  
  11105.  
  11106. manager.GetActivatedOfType( 'CJournalCreature', ents );
  11107. for(i=0; i<ents.Size(); i+=1)
  11108. {
  11109. manager.ActivateEntry(ents[i], JS_Inactive, false, true);
  11110. }
  11111.  
  11112.  
  11113. ents.Clear();
  11114. manager.GetActivatedOfType( 'CJournalCharacter', ents );
  11115. for(i=0; i<ents.Size(); i+=1)
  11116. {
  11117. manager.ActivateEntry(ents[i], JS_Inactive, false, true);
  11118. }
  11119.  
  11120.  
  11121. ents.Clear();
  11122. manager.GetActivatedOfType( 'CJournalQuest', ents );
  11123. for(i=0; i<ents.Size(); i+=1)
  11124. {
  11125.  
  11126. if( StrStartsWith(ents[i].baseName, "q60"))
  11127. continue;
  11128.  
  11129. manager.ActivateEntry(ents[i], JS_Inactive, false, true);
  11130. }
  11131.  
  11132.  
  11133. manager.ActivateEntryByScriptTag('TutorialAard', JS_Active);
  11134. manager.ActivateEntryByScriptTag('TutorialAdrenaline', JS_Active);
  11135. manager.ActivateEntryByScriptTag('TutorialAxii', JS_Active);
  11136. manager.ActivateEntryByScriptTag('TutorialAxiiDialog', JS_Active);
  11137. manager.ActivateEntryByScriptTag('TutorialCamera', JS_Active);
  11138. manager.ActivateEntryByScriptTag('TutorialCamera_pad', JS_Active);
  11139. manager.ActivateEntryByScriptTag('TutorialCiriBlink', JS_Active);
  11140. manager.ActivateEntryByScriptTag('TutorialCiriCharge', JS_Active);
  11141. manager.ActivateEntryByScriptTag('TutorialCiriStamina', JS_Active);
  11142. manager.ActivateEntryByScriptTag('TutorialCounter', JS_Active);
  11143. manager.ActivateEntryByScriptTag('TutorialDialogClose', JS_Active);
  11144. manager.ActivateEntryByScriptTag('TutorialFallingRoll', JS_Active);
  11145. manager.ActivateEntryByScriptTag('TutorialFocus', JS_Active);
  11146. manager.ActivateEntryByScriptTag('TutorialFocusClues', JS_Active);
  11147. manager.ActivateEntryByScriptTag('TutorialFocusClues', JS_Active);
  11148. manager.ActivateEntryByScriptTag('TutorialHorseRoad', JS_Active);
  11149. manager.ActivateEntryByScriptTag('TutorialHorseSpeed0', JS_Active);
  11150. manager.ActivateEntryByScriptTag('TutorialHorseSpeed0_pad', JS_Active);
  11151. manager.ActivateEntryByScriptTag('TutorialHorseSpeed1', JS_Active);
  11152. manager.ActivateEntryByScriptTag('TutorialHorseSpeed2', JS_Active);
  11153. manager.ActivateEntryByScriptTag('TutorialHorseSummon', JS_Active);
  11154. manager.ActivateEntryByScriptTag('TutorialHorseSummon_pad', JS_Active);
  11155. manager.ActivateEntryByScriptTag('TutorialIgni', JS_Active);
  11156. manager.ActivateEntryByScriptTag('TutorialJournalAlternateSings', JS_Active);
  11157. manager.ActivateEntryByScriptTag('TutorialJournalBoatDamage', JS_Active);
  11158. manager.ActivateEntryByScriptTag('TutorialJournalBoatMount', JS_Active);
  11159. manager.ActivateEntryByScriptTag('TutorialJournalBuffs', JS_Active);
  11160. manager.ActivateEntryByScriptTag('TutorialJournalCharDevLeveling', JS_Active);
  11161. manager.ActivateEntryByScriptTag('TutorialJournalCharDevSkills', JS_Active);
  11162. manager.ActivateEntryByScriptTag('TutorialJournalCrafting', JS_Active);
  11163. manager.ActivateEntryByScriptTag('TutorialJournalCrossbow', JS_Active);
  11164. manager.ActivateEntryByScriptTag('TutorialJournalDialogGwint', JS_Active);
  11165. manager.ActivateEntryByScriptTag('TutorialJournalDialogShop', JS_Active);
  11166. manager.ActivateEntryByScriptTag('TutorialJournalDive', JS_Active);
  11167. manager.ActivateEntryByScriptTag('TutorialJournalDodge', JS_Active);
  11168. manager.ActivateEntryByScriptTag('TutorialJournalDodge_pad', JS_Active);
  11169. manager.ActivateEntryByScriptTag('TutorialJournalDrawWeapon', JS_Active);
  11170. manager.ActivateEntryByScriptTag('TutorialJournalDrawWeapon_pad', JS_Active);
  11171. manager.ActivateEntryByScriptTag('TutorialJournalDurability', JS_Active);
  11172. manager.ActivateEntryByScriptTag('TutorialJournalExplorations', JS_Active);
  11173. manager.ActivateEntryByScriptTag('TutorialJournalExplorations_pad', JS_Active);
  11174. manager.ActivateEntryByScriptTag('TutorialJournalFastTravel', JS_Active);
  11175. manager.ActivateEntryByScriptTag('TutorialJournalFocusRedObjects', JS_Active);
  11176. manager.ActivateEntryByScriptTag('TutorialJournalGasClouds', JS_Active);
  11177. manager.ActivateEntryByScriptTag('TutorialJournalHeavyAttacks', JS_Active);
  11178. manager.ActivateEntryByScriptTag('TutorialJournalHorse', JS_Active);
  11179. manager.ActivateEntryByScriptTag('TutorialJournalHorseStamina', JS_Active);
  11180. manager.ActivateEntryByScriptTag('TutorialJournalJump', JS_Active);
  11181. manager.ActivateEntryByScriptTag('TutorialJournalLightAttacks', JS_Active);
  11182. manager.ActivateEntryByScriptTag('TutorialJournalLightAttacks_pad', JS_Active);
  11183. manager.ActivateEntryByScriptTag('TutorialJournalMeditation', JS_Active);
  11184. manager.ActivateEntryByScriptTag('TutorialJournalMeditation_pad', JS_Active);
  11185. manager.ActivateEntryByScriptTag('TutorialJournalMonsterThreatLevels', JS_Active);
  11186. manager.ActivateEntryByScriptTag('TutorialJournalMovement', JS_Active);
  11187. manager.ActivateEntryByScriptTag('TutorialJournalMovement_pad', JS_Active);
  11188. manager.ActivateEntryByScriptTag('TutorialJournalMutagenIngredient', JS_Active);
  11189. manager.ActivateEntryByScriptTag('TutorialJournalMutagenPotion', JS_Active);
  11190. manager.ActivateEntryByScriptTag('TutorialJournalOils', JS_Active);
  11191. manager.ActivateEntryByScriptTag('TutorialJournalPetards', JS_Active);
  11192. manager.ActivateEntryByScriptTag('TutorialJournalPotions', JS_Active);
  11193. manager.ActivateEntryByScriptTag('TutorialJournalPotions_pad', JS_Active);
  11194. manager.ActivateEntryByScriptTag('TutorialJournalQuestArea', JS_Active);
  11195. manager.ActivateEntryByScriptTag('TutorialJournalRadial', JS_Active);
  11196. manager.ActivateEntryByScriptTag('TutorialJournalRifts', JS_Active);
  11197. manager.ActivateEntryByScriptTag('TutorialJournalRun', JS_Active);
  11198. manager.ActivateEntryByScriptTag('TutorialJournalShopDescription', JS_Active);
  11199. manager.ActivateEntryByScriptTag('TutorialJournalSignCast', JS_Active);
  11200. manager.ActivateEntryByScriptTag('TutorialJournalSignCast_pad', JS_Active);
  11201. manager.ActivateEntryByScriptTag('TutorialJournalSpecialAttacks', JS_Active);
  11202. manager.ActivateEntryByScriptTag('TutorialJournalStaminaExploration', JS_Active);
  11203. manager.ActivateEntryByScriptTag('TutorialJumpHang', JS_Active);
  11204. manager.ActivateEntryByScriptTag('TutorialLadder', JS_Active);
  11205. manager.ActivateEntryByScriptTag('TutorialLadderMove', JS_Active);
  11206. manager.ActivateEntryByScriptTag('TutorialLadderMove_pad', JS_Active);
  11207. manager.ActivateEntryByScriptTag('TutorialObjectiveSwitching', JS_Active);
  11208. manager.ActivateEntryByScriptTag('TutorialOxygen', JS_Active);
  11209. manager.ActivateEntryByScriptTag('TutorialParry', JS_Active);
  11210. manager.ActivateEntryByScriptTag('TutorialPOIUncovered', JS_Active);
  11211. manager.ActivateEntryByScriptTag('TutorialQuen', JS_Active);
  11212. manager.ActivateEntryByScriptTag('TutorialRoll', JS_Active);
  11213. manager.ActivateEntryByScriptTag('TutorialRoll_pad', JS_Active);
  11214. manager.ActivateEntryByScriptTag('TutorialSpeedPairing', JS_Active);
  11215. manager.ActivateEntryByScriptTag('TutorialSprint', JS_Active);
  11216. manager.ActivateEntryByScriptTag('TutorialStaminaSigns', JS_Active);
  11217. manager.ActivateEntryByScriptTag('TutorialStealing', JS_Active);
  11218. manager.ActivateEntryByScriptTag('TutorialSwimmingSpeed', JS_Active);
  11219. manager.ActivateEntryByScriptTag('TutorialTimedChoiceDialog', JS_Active);
  11220. manager.ActivateEntryByScriptTag('TutorialYrden', JS_Active);
  11221.  
  11222.  
  11223. FactsAdd('kill_base_tutorials');
  11224.  
  11225.  
  11226. theGame.GetTutorialSystem().RemoveAllQueuedTutorials();
  11227.  
  11228.  
  11229. FactsAdd('standalone_ep1');
  11230. FactsRemove("StandAloneEP1");
  11231.  
  11232. theGame.GetJournalManager().ForceUntrackingQuestForEP1Savegame();
  11233. }
  11234.  
  11235. final function Debug_FocusBoyFocusGain()
  11236. {
  11237. var focusGain : float;
  11238.  
  11239. focusGain = FactsQuerySum( "debug_fact_focus_boy" ) ;
  11240. GainStat( BCS_Focus, focusGain );
  11241. }
  11242.  
  11243. public final function StandaloneEp2_1()
  11244. {
  11245. var i, inc, quantityLow, randLow, quantityMedium, randMedium, quantityHigh, randHigh, startingMoney : int;
  11246. var pam : W3PlayerAbilityManager;
  11247. var ids : array<SItemUniqueId>;
  11248. var STARTING_LEVEL : int;
  11249.  
  11250. FactsAdd( "StandAloneEP2", 1 );
  11251.  
  11252.  
  11253. inv.RemoveAllItems();
  11254.  
  11255.  
  11256. inv.AddAnItem( 'Illusion Medallion', 1, true, true, false );
  11257. inv.AddAnItem( 'q103_safe_conduct', 1, true, true, false );
  11258.  
  11259.  
  11260. theGame.GetGamerProfile().ClearAllAchievementsForEP2();
  11261.  
  11262.  
  11263. levelManager.Hack_EP2StandaloneLevelShrink( 35 );
  11264.  
  11265.  
  11266. levelManager.ResetCharacterDev();
  11267. pam = ( W3PlayerAbilityManager )abilityManager;
  11268. if( pam )
  11269. {
  11270. pam.ResetCharacterDev();
  11271. }
  11272. levelManager.SetFreeSkillPoints( levelManager.GetLevel() - 1 + 11 );
  11273.  
  11274.  
  11275. inv.AddAnItem( 'Mutagen red', 4 );
  11276. inv.AddAnItem( 'Mutagen green', 4 );
  11277. inv.AddAnItem( 'Mutagen blue', 4 );
  11278. inv.AddAnItem( 'Lesser mutagen red', 2 );
  11279. inv.AddAnItem( 'Lesser mutagen green', 2 );
  11280. inv.AddAnItem( 'Lesser mutagen blue', 2 );
  11281. inv.AddAnItem( 'Greater mutagen red', 2 );
  11282. inv.AddAnItem( 'Greater mutagen green', 2 );
  11283. inv.AddAnItem( 'Greater mutagen blue', 2 );
  11284.  
  11285.  
  11286. startingMoney = 20000;
  11287. if( GetMoney() > startingMoney )
  11288. {
  11289. RemoveMoney( GetMoney() - startingMoney );
  11290. }
  11291. else
  11292. {
  11293. AddMoney( 20000 - GetMoney() );
  11294. }
  11295.  
  11296.  
  11297. ids.Clear();
  11298. ids = inv.AddAnItem( 'EP2 Standalone Starting Armor' );
  11299. EquipItem( ids[0] );
  11300. ids.Clear();
  11301. ids = inv.AddAnItem( 'EP2 Standalone Starting Boots' );
  11302. EquipItem( ids[0] );
  11303. ids.Clear();
  11304. ids = inv.AddAnItem( 'EP2 Standalone Starting Gloves' );
  11305. EquipItem( ids[0] );
  11306. ids.Clear();
  11307. ids = inv.AddAnItem( 'EP2 Standalone Starting Pants' );
  11308. EquipItem( ids[0] );
  11309.  
  11310.  
  11311. ids.Clear();
  11312. ids = inv.AddAnItem( 'EP2 Standalone Starting Steel Sword' );
  11313. EquipItem( ids[0] );
  11314. ids.Clear();
  11315. ids = inv.AddAnItem( 'EP2 Standalone Starting Silver Sword' );
  11316. EquipItem( ids[0] );
  11317.  
  11318.  
  11319. inv.AddAnItem( 'Torch', 1, true, true, false );
  11320.  
  11321.  
  11322. quantityLow = 1;
  11323. randLow = 3;
  11324. quantityMedium = 4;
  11325. randMedium = 4;
  11326. quantityHigh = 8;
  11327. randHigh = 6;
  11328.  
  11329. inv.AddAnItem( 'Alghoul bone marrow',quantityMedium+RandRange( randMedium ) );
  11330. inv.AddAnItem( 'Amethyst dust',quantityLow+RandRange( randLow ) );
  11331. inv.AddAnItem( 'Arachas eyes',quantityLow+RandRange( randLow ) );
  11332. inv.AddAnItem( 'Arachas venom',quantityLow+RandRange( randLow ) );
  11333. inv.AddAnItem( 'Basilisk hide',quantityLow+RandRange( randLow ) );
  11334. inv.AddAnItem( 'Basilisk venom',quantityLow+RandRange( randLow ) );
  11335. inv.AddAnItem( 'Bear pelt',quantityHigh+RandRange( randHigh ) );
  11336. inv.AddAnItem( 'Berserker pelt',quantityLow+RandRange( randLow ) );
  11337. inv.AddAnItem( 'Coal',quantityHigh+RandRange( randHigh ) );
  11338. inv.AddAnItem( 'Cotton',quantityHigh+RandRange( randHigh ) );
  11339.  
  11340.  
  11341. inv.AddAnItem( 'Deer hide',quantityHigh+RandRange( randHigh ) );
  11342. inv.AddAnItem( 'Diamond dust',quantityLow+RandRange( randLow ) );
  11343.  
  11344. inv.AddAnItem( 'Drowned dead tongue',quantityLow+RandRange( randLow ) );
  11345. inv.AddAnItem( 'Drowner brain',quantityMedium+RandRange( randMedium ) );
  11346.  
  11347.  
  11348.  
  11349. inv.AddAnItem( 'Endriag chitin plates',quantityMedium+RandRange( randMedium ) );
  11350. inv.AddAnItem( 'Endriag embryo',quantityLow+RandRange( randLow ) );
  11351. inv.AddAnItem( 'Ghoul blood',quantityMedium+RandRange( randMedium ) );
  11352. inv.AddAnItem( 'Goat hide',quantityMedium+RandRange( randMedium ) );
  11353. inv.AddAnItem( 'Hag teeth',quantityMedium+RandRange( randMedium ) );
  11354. inv.AddAnItem( 'Hardened leather',quantityMedium+RandRange( randMedium ) );
  11355. inv.AddAnItem( 'Hardened timber',quantityMedium+RandRange( randMedium ) );
  11356. inv.AddAnItem( 'Harpy feathers',quantityMedium+RandRange( randMedium ) );
  11357. inv.AddAnItem( 'Horse hide',quantityLow+RandRange( randLow ) );
  11358.  
  11359.  
  11360.  
  11361.  
  11362.  
  11363.  
  11364. inv.AddAnItem( 'Necrophage skin',quantityLow+RandRange( randLow ) );
  11365. inv.AddAnItem( 'Nekker blood',quantityHigh+RandRange( randHigh ) );
  11366. inv.AddAnItem( 'Nekker heart',quantityMedium+RandRange( randMedium ) );
  11367.  
  11368. inv.AddAnItem( 'Phosphorescent crystal',quantityLow+RandRange( randLow ) );
  11369. inv.AddAnItem( 'Pig hide',quantityMedium+RandRange( randMedium ) );
  11370.  
  11371. inv.AddAnItem( 'Rabbit pelt',quantityMedium+RandRange( randMedium ) );
  11372. inv.AddAnItem( 'Rotfiend blood',quantityMedium+RandRange( randMedium ) );
  11373. inv.AddAnItem( 'Sapphire dust',quantityLow+RandRange( randLow ) );
  11374.  
  11375.  
  11376.  
  11377. inv.AddAnItem( 'Specter dust',quantityMedium+RandRange( randMedium ) );
  11378.  
  11379.  
  11380.  
  11381.  
  11382.  
  11383.  
  11384.  
  11385. inv.AddAnItem( 'Water essence',quantityMedium+RandRange( randMedium ) );
  11386. inv.AddAnItem( 'Wolf liver',quantityHigh+RandRange( randHigh ) );
  11387. inv.AddAnItem( 'Wolf pelt',quantityMedium+RandRange( randMedium ) );
  11388.  
  11389. inv.AddAnItem( 'Alcohest', 5 );
  11390. inv.AddAnItem( 'Dwarven spirit', 5 );
  11391.  
  11392.  
  11393. ids.Clear();
  11394. ids = inv.AddAnItem( 'Crossbow 5' );
  11395. EquipItem( ids[0] );
  11396. ids.Clear();
  11397. ids = inv.AddAnItem( 'Blunt Bolt', 100 );
  11398. EquipItem( ids[0] );
  11399. inv.AddAnItem( 'Broadhead Bolt', 100 );
  11400. inv.AddAnItem( 'Split Bolt', 100 );
  11401.  
  11402.  
  11403. RemoveAllAlchemyRecipes();
  11404. RemoveAllCraftingSchematics();
  11405.  
  11406.  
  11407.  
  11408.  
  11409.  
  11410.  
  11411.  
  11412.  
  11413.  
  11414. AddAlchemyRecipe( 'Recipe for Petris Philtre 2' );
  11415. AddAlchemyRecipe( 'Recipe for Swallow 1' );
  11416. AddAlchemyRecipe( 'Recipe for Tawny Owl 1' );
  11417.  
  11418. AddAlchemyRecipe( 'Recipe for White Gull 1' );
  11419.  
  11420.  
  11421.  
  11422.  
  11423.  
  11424. AddAlchemyRecipe( 'Recipe for Beast Oil 1' );
  11425. AddAlchemyRecipe( 'Recipe for Cursed Oil 1' );
  11426. AddAlchemyRecipe( 'Recipe for Hanged Man Venom 1' );
  11427. AddAlchemyRecipe( 'Recipe for Hybrid Oil 1' );
  11428. AddAlchemyRecipe( 'Recipe for Insectoid Oil 2' );
  11429. AddAlchemyRecipe( 'Recipe for Magicals Oil 1' );
  11430. AddAlchemyRecipe( 'Recipe for Necrophage Oil 1' );
  11431. AddAlchemyRecipe( 'Recipe for Specter Oil 1' );
  11432. AddAlchemyRecipe( 'Recipe for Vampire Oil 2' );
  11433. AddAlchemyRecipe( 'Recipe for Draconide Oil 2' );
  11434. AddAlchemyRecipe( 'Recipe for Ogre Oil 1' );
  11435. AddAlchemyRecipe( 'Recipe for Relic Oil 1' );
  11436. AddAlchemyRecipe( 'Recipe for Beast Oil 2' );
  11437. AddAlchemyRecipe( 'Recipe for Cursed Oil 2' );
  11438. AddAlchemyRecipe( 'Recipe for Hanged Man Venom 2' );
  11439. AddAlchemyRecipe( 'Recipe for Hybrid Oil 2' );
  11440. AddAlchemyRecipe( 'Recipe for Insectoid Oil 2' );
  11441. AddAlchemyRecipe( 'Recipe for Magicals Oil 2' );
  11442. AddAlchemyRecipe( 'Recipe for Necrophage Oil 2' );
  11443. AddAlchemyRecipe( 'Recipe for Specter Oil 2' );
  11444. AddAlchemyRecipe( 'Recipe for Vampire Oil 2' );
  11445. AddAlchemyRecipe( 'Recipe for Draconide Oil 2' );
  11446. AddAlchemyRecipe( 'Recipe for Ogre Oil 2' );
  11447. AddAlchemyRecipe( 'Recipe for Relic Oil 2' );
  11448.  
  11449.  
  11450. AddAlchemyRecipe( 'Recipe for Dancing Star 1' );
  11451.  
  11452. AddAlchemyRecipe( 'Recipe for Dwimeritum Bomb 1' );
  11453.  
  11454. AddAlchemyRecipe( 'Recipe for Grapeshot 1' );
  11455. AddAlchemyRecipe( 'Recipe for Samum 1' );
  11456.  
  11457. AddAlchemyRecipe( 'Recipe for White Frost 1' );
  11458.  
  11459.  
  11460.  
  11461. AddAlchemyRecipe( 'Recipe for Dwarven spirit 1' );
  11462. AddAlchemyRecipe( 'Recipe for Alcohest 1' );
  11463. AddAlchemyRecipe( 'Recipe for White Gull 1' );
  11464.  
  11465.  
  11466. AddStartingSchematics();
  11467.  
  11468.  
  11469. ids.Clear();
  11470. ids = inv.AddAnItem( 'Swallow 2' );
  11471. EquipItem( ids[0] );
  11472. ids.Clear();
  11473. ids = inv.AddAnItem( 'Thunderbolt 2' );
  11474. EquipItem( ids[0] );
  11475. ids.Clear();
  11476. ids = inv.AddAnItem( 'Tawny Owl 2' );
  11477. EquipItem( ids[0] );
  11478. ids.Clear();
  11479.  
  11480. ids = inv.AddAnItem( 'Grapeshot 2' );
  11481. EquipItem( ids[0] );
  11482. ids.Clear();
  11483. ids = inv.AddAnItem( 'Samum 2' );
  11484. EquipItem( ids[0] );
  11485.  
  11486. inv.AddAnItem( 'Dwimeritum Bomb 1' );
  11487. inv.AddAnItem( 'Dragons Dream 1' );
  11488. inv.AddAnItem( 'Silver Dust Bomb 1' );
  11489. inv.AddAnItem( 'White Frost 2' );
  11490. inv.AddAnItem( 'Devils Puffball 2' );
  11491. inv.AddAnItem( 'Dancing Star 2' );
  11492. inv.AddAnItem( 'Beast Oil 1' );
  11493. inv.AddAnItem( 'Cursed Oil 1' );
  11494. inv.AddAnItem( 'Hanged Man Venom 2' );
  11495. inv.AddAnItem( 'Hybrid Oil 2' );
  11496. inv.AddAnItem( 'Insectoid Oil 2' );
  11497. inv.AddAnItem( 'Magicals Oil 1' );
  11498. inv.AddAnItem( 'Necrophage Oil 2' );
  11499. inv.AddAnItem( 'Ogre Oil 1' );
  11500. inv.AddAnItem( 'Specter Oil 1' );
  11501. inv.AddAnItem( 'Vampire Oil 2' );
  11502. inv.AddAnItem( 'Draconide Oil 2' );
  11503. inv.AddAnItem( 'Relic Oil 1' );
  11504. inv.AddAnItem( 'Black Blood 1' );
  11505. inv.AddAnItem( 'Blizzard 1' );
  11506. inv.AddAnItem( 'Cat 2' );
  11507. inv.AddAnItem( 'Full Moon 1' );
  11508. inv.AddAnItem( 'Golden Oriole 1' );
  11509. inv.AddAnItem( 'Killer Whale 1' );
  11510. inv.AddAnItem( 'Maribor Forest 1' );
  11511. inv.AddAnItem( 'Petris Philtre 2' );
  11512. inv.AddAnItem( 'White Gull 1', 3 );
  11513. inv.AddAnItem( 'White Honey 2' );
  11514. inv.AddAnItem( 'White Raffards Decoction 1' );
  11515.  
  11516.  
  11517. inv.AddAnItem( 'Mutagen 17' );
  11518. inv.AddAnItem( 'Mutagen 19' );
  11519. inv.AddAnItem( 'Mutagen 27' );
  11520. inv.AddAnItem( 'Mutagen 26' );
  11521.  
  11522.  
  11523. inv.AddAnItem( 'weapon_repair_kit_1', 5 );
  11524. inv.AddAnItem( 'weapon_repair_kit_2', 3 );
  11525. inv.AddAnItem( 'armor_repair_kit_1', 5 );
  11526. inv.AddAnItem( 'armor_repair_kit_2', 3 );
  11527.  
  11528.  
  11529. quantityMedium = 2;
  11530. quantityLow = 1;
  11531. inv.AddAnItem( 'Rune stribog lesser', quantityMedium );
  11532. inv.AddAnItem( 'Rune stribog', quantityLow );
  11533. inv.AddAnItem( 'Rune dazhbog lesser', quantityMedium );
  11534. inv.AddAnItem( 'Rune dazhbog', quantityLow );
  11535. inv.AddAnItem( 'Rune devana lesser', quantityMedium );
  11536. inv.AddAnItem( 'Rune devana', quantityLow );
  11537. inv.AddAnItem( 'Rune zoria lesser', quantityMedium );
  11538. inv.AddAnItem( 'Rune zoria', quantityLow );
  11539. inv.AddAnItem( 'Rune morana lesser', quantityMedium );
  11540. inv.AddAnItem( 'Rune morana', quantityLow );
  11541. inv.AddAnItem( 'Rune triglav lesser', quantityMedium );
  11542. inv.AddAnItem( 'Rune triglav', quantityLow );
  11543. inv.AddAnItem( 'Rune svarog lesser', quantityMedium );
  11544. inv.AddAnItem( 'Rune svarog', quantityLow );
  11545. inv.AddAnItem( 'Rune veles lesser', quantityMedium );
  11546. inv.AddAnItem( 'Rune veles', quantityLow );
  11547. inv.AddAnItem( 'Rune perun lesser', quantityMedium );
  11548. inv.AddAnItem( 'Rune perun', quantityLow );
  11549. inv.AddAnItem( 'Rune elemental lesser', quantityMedium );
  11550. inv.AddAnItem( 'Rune elemental', quantityLow );
  11551.  
  11552. inv.AddAnItem( 'Glyph aard lesser', quantityMedium );
  11553. inv.AddAnItem( 'Glyph aard', quantityLow );
  11554. inv.AddAnItem( 'Glyph axii lesser', quantityMedium );
  11555. inv.AddAnItem( 'Glyph axii', quantityLow );
  11556. inv.AddAnItem( 'Glyph igni lesser', quantityMedium );
  11557. inv.AddAnItem( 'Glyph igni', quantityLow );
  11558. inv.AddAnItem( 'Glyph quen lesser', quantityMedium );
  11559. inv.AddAnItem( 'Glyph quen', quantityLow );
  11560. inv.AddAnItem( 'Glyph yrden lesser', quantityMedium );
  11561. inv.AddAnItem( 'Glyph yrden', quantityLow );
  11562.  
  11563.  
  11564. StandaloneEp2_2();
  11565. }
  11566.  
  11567. public final function StandaloneEp2_2()
  11568. {
  11569. var horseId : SItemUniqueId;
  11570. var ids : array<SItemUniqueId>;
  11571. var ents : array< CJournalBase >;
  11572. var i : int;
  11573. var manager : CWitcherJournalManager;
  11574.  
  11575.  
  11576. inv.AddAnItem( 'Cows milk', 20 );
  11577. ids.Clear();
  11578. ids = inv.AddAnItem( 'Dumpling', 44 );
  11579. EquipItem( ids[0] );
  11580.  
  11581.  
  11582. inv.AddAnItem( 'Clearing Potion', 2, true, false, false );
  11583.  
  11584.  
  11585. GetHorseManager().RemoveAllItems();
  11586.  
  11587. ids.Clear();
  11588. ids = inv.AddAnItem( 'Horse Bag 2' );
  11589. horseId = GetHorseManager( ).MoveItemToHorse( ids[0] );
  11590. GetHorseManager().EquipItem( horseId );
  11591.  
  11592. ids.Clear();
  11593. ids = inv.AddAnItem( 'Horse Blinder 2' );
  11594. horseId = GetHorseManager().MoveItemToHorse( ids[0] );
  11595. GetHorseManager().EquipItem( horseId );
  11596.  
  11597. ids.Clear();
  11598. ids = inv.AddAnItem( 'Horse Saddle 2' );
  11599. horseId = GetHorseManager().MoveItemToHorse( ids[0] );
  11600. GetHorseManager().EquipItem( horseId );
  11601.  
  11602. manager = theGame.GetJournalManager();
  11603.  
  11604.  
  11605. manager.GetActivatedOfType( 'CJournalCreature', ents );
  11606. for(i=0; i<ents.Size(); i+=1)
  11607. {
  11608. manager.ActivateEntry( ents[i], JS_Inactive, false, true );
  11609. }
  11610.  
  11611.  
  11612. ents.Clear();
  11613. manager.GetActivatedOfType( 'CJournalCharacter', ents );
  11614. for(i=0; i<ents.Size(); i+=1)
  11615. {
  11616. manager.ActivateEntry( ents[i], JS_Inactive, false, true );
  11617. }
  11618.  
  11619.  
  11620. ents.Clear();
  11621. manager.GetActivatedOfType( 'CJournalQuest', ents );
  11622. for(i=0; i<ents.Size(); i+=1)
  11623. {
  11624.  
  11625. if( StrStartsWith( ents[i].baseName, "q60" ) )
  11626. continue;
  11627.  
  11628. manager.ActivateEntry( ents[i], JS_Inactive, false, true );
  11629. }
  11630.  
  11631.  
  11632. manager.ActivateEntryByScriptTag( 'TutorialAard', JS_Active );
  11633. manager.ActivateEntryByScriptTag( 'TutorialAdrenaline', JS_Active );
  11634. manager.ActivateEntryByScriptTag( 'TutorialAxii', JS_Active );
  11635. manager.ActivateEntryByScriptTag( 'TutorialAxiiDialog', JS_Active );
  11636. manager.ActivateEntryByScriptTag( 'TutorialCamera', JS_Active );
  11637. manager.ActivateEntryByScriptTag( 'TutorialCamera_pad', JS_Active );
  11638. manager.ActivateEntryByScriptTag( 'TutorialCiriBlink', JS_Active );
  11639. manager.ActivateEntryByScriptTag( 'TutorialCiriCharge', JS_Active );
  11640. manager.ActivateEntryByScriptTag( 'TutorialCiriStamina', JS_Active );
  11641. manager.ActivateEntryByScriptTag( 'TutorialCounter', JS_Active );
  11642. manager.ActivateEntryByScriptTag( 'TutorialDialogClose', JS_Active );
  11643. manager.ActivateEntryByScriptTag( 'TutorialFallingRoll', JS_Active );
  11644. manager.ActivateEntryByScriptTag( 'TutorialFocus', JS_Active );
  11645. manager.ActivateEntryByScriptTag( 'TutorialFocusClues', JS_Active );
  11646. manager.ActivateEntryByScriptTag( 'TutorialFocusClues', JS_Active );
  11647. manager.ActivateEntryByScriptTag( 'TutorialHorseRoad', JS_Active );
  11648. manager.ActivateEntryByScriptTag( 'TutorialHorseSpeed0', JS_Active );
  11649. manager.ActivateEntryByScriptTag( 'TutorialHorseSpeed0_pad', JS_Active );
  11650. manager.ActivateEntryByScriptTag( 'TutorialHorseSpeed1', JS_Active );
  11651. manager.ActivateEntryByScriptTag( 'TutorialHorseSpeed2', JS_Active );
  11652. manager.ActivateEntryByScriptTag( 'TutorialHorseSummon', JS_Active );
  11653. manager.ActivateEntryByScriptTag( 'TutorialHorseSummon_pad', JS_Active );
  11654. manager.ActivateEntryByScriptTag( 'TutorialIgni', JS_Active );
  11655. manager.ActivateEntryByScriptTag( 'TutorialJournalAlternateSings', JS_Active );
  11656. manager.ActivateEntryByScriptTag( 'TutorialJournalBoatDamage', JS_Active );
  11657. manager.ActivateEntryByScriptTag( 'TutorialJournalBoatMount', JS_Active );
  11658. manager.ActivateEntryByScriptTag( 'TutorialJournalBuffs', JS_Active );
  11659. manager.ActivateEntryByScriptTag( 'TutorialJournalCharDevLeveling', JS_Active );
  11660. manager.ActivateEntryByScriptTag( 'TutorialJournalCharDevSkills', JS_Active );
  11661. manager.ActivateEntryByScriptTag( 'TutorialJournalCrafting', JS_Active );
  11662. manager.ActivateEntryByScriptTag( 'TutorialJournalCrossbow', JS_Active );
  11663. manager.ActivateEntryByScriptTag( 'TutorialJournalDialogGwint', JS_Active );
  11664. manager.ActivateEntryByScriptTag( 'TutorialJournalDialogShop', JS_Active );
  11665. manager.ActivateEntryByScriptTag( 'TutorialJournalDive', JS_Active );
  11666. manager.ActivateEntryByScriptTag( 'TutorialJournalDodge', JS_Active );
  11667. manager.ActivateEntryByScriptTag( 'TutorialJournalDodge_pad', JS_Active );
  11668. manager.ActivateEntryByScriptTag( 'TutorialJournalDrawWeapon', JS_Active );
  11669. manager.ActivateEntryByScriptTag( 'TutorialJournalDrawWeapon_pad', JS_Active );
  11670. manager.ActivateEntryByScriptTag( 'TutorialJournalDurability', JS_Active );
  11671. manager.ActivateEntryByScriptTag( 'TutorialJournalExplorations', JS_Active );
  11672. manager.ActivateEntryByScriptTag( 'TutorialJournalExplorations_pad', JS_Active );
  11673. manager.ActivateEntryByScriptTag( 'TutorialJournalFastTravel', JS_Active );
  11674. manager.ActivateEntryByScriptTag( 'TutorialJournalFocusRedObjects', JS_Active );
  11675. manager.ActivateEntryByScriptTag( 'TutorialJournalGasClouds', JS_Active );
  11676. manager.ActivateEntryByScriptTag( 'TutorialJournalHeavyAttacks', JS_Active );
  11677. manager.ActivateEntryByScriptTag( 'TutorialJournalHorse', JS_Active );
  11678. manager.ActivateEntryByScriptTag( 'TutorialJournalHorseStamina', JS_Active );
  11679. manager.ActivateEntryByScriptTag( 'TutorialJournalJump', JS_Active );
  11680. manager.ActivateEntryByScriptTag( 'TutorialJournalLightAttacks', JS_Active );
  11681. manager.ActivateEntryByScriptTag( 'TutorialJournalLightAttacks_pad', JS_Active );
  11682. manager.ActivateEntryByScriptTag( 'TutorialJournalMeditation', JS_Active );
  11683. manager.ActivateEntryByScriptTag( 'TutorialJournalMeditation_pad', JS_Active );
  11684. manager.ActivateEntryByScriptTag( 'TutorialJournalMonsterThreatLevels', JS_Active );
  11685. manager.ActivateEntryByScriptTag( 'TutorialJournalMovement', JS_Active );
  11686. manager.ActivateEntryByScriptTag( 'TutorialJournalMovement_pad', JS_Active );
  11687. manager.ActivateEntryByScriptTag( 'TutorialJournalMutagenIngredient', JS_Active );
  11688. manager.ActivateEntryByScriptTag( 'TutorialJournalMutagenPotion', JS_Active );
  11689. manager.ActivateEntryByScriptTag( 'TutorialJournalOils', JS_Active );
  11690. manager.ActivateEntryByScriptTag( 'TutorialJournalPetards', JS_Active );
  11691. manager.ActivateEntryByScriptTag( 'TutorialJournalPotions', JS_Active );
  11692. manager.ActivateEntryByScriptTag( 'TutorialJournalPotions_pad', JS_Active );
  11693. manager.ActivateEntryByScriptTag( 'TutorialJournalQuestArea', JS_Active );
  11694. manager.ActivateEntryByScriptTag( 'TutorialJournalRadial', JS_Active );
  11695. manager.ActivateEntryByScriptTag( 'TutorialJournalRifts', JS_Active );
  11696. manager.ActivateEntryByScriptTag( 'TutorialJournalRun', JS_Active );
  11697. manager.ActivateEntryByScriptTag( 'TutorialJournalShopDescription', JS_Active );
  11698. manager.ActivateEntryByScriptTag( 'TutorialJournalSignCast', JS_Active );
  11699. manager.ActivateEntryByScriptTag( 'TutorialJournalSignCast_pad', JS_Active );
  11700. manager.ActivateEntryByScriptTag( 'TutorialJournalSpecialAttacks', JS_Active );
  11701. manager.ActivateEntryByScriptTag( 'TutorialJournalStaminaExploration', JS_Active );
  11702. manager.ActivateEntryByScriptTag( 'TutorialJumpHang', JS_Active );
  11703. manager.ActivateEntryByScriptTag( 'TutorialLadder', JS_Active );
  11704. manager.ActivateEntryByScriptTag( 'TutorialLadderMove', JS_Active );
  11705. manager.ActivateEntryByScriptTag( 'TutorialLadderMove_pad', JS_Active );
  11706. manager.ActivateEntryByScriptTag( 'TutorialObjectiveSwitching', JS_Active );
  11707. manager.ActivateEntryByScriptTag( 'TutorialOxygen', JS_Active );
  11708. manager.ActivateEntryByScriptTag( 'TutorialParry', JS_Active );
  11709. manager.ActivateEntryByScriptTag( 'TutorialPOIUncovered', JS_Active );
  11710. manager.ActivateEntryByScriptTag( 'TutorialQuen', JS_Active );
  11711. manager.ActivateEntryByScriptTag( 'TutorialRoll', JS_Active );
  11712. manager.ActivateEntryByScriptTag( 'TutorialRoll_pad', JS_Active );
  11713. manager.ActivateEntryByScriptTag( 'TutorialSpeedPairing', JS_Active );
  11714. manager.ActivateEntryByScriptTag( 'TutorialSprint', JS_Active );
  11715. manager.ActivateEntryByScriptTag( 'TutorialStaminaSigns', JS_Active );
  11716. manager.ActivateEntryByScriptTag( 'TutorialStealing', JS_Active );
  11717. manager.ActivateEntryByScriptTag( 'TutorialSwimmingSpeed', JS_Active );
  11718. manager.ActivateEntryByScriptTag( 'TutorialTimedChoiceDialog', JS_Active );
  11719. manager.ActivateEntryByScriptTag( 'TutorialYrden', JS_Active );
  11720.  
  11721. inv.AddAnItem( 'Geralt Shirt', 1 );
  11722. inv.AddAnItem( 'Thread', 13 );
  11723. inv.AddAnItem( 'String', 9 );
  11724. inv.AddAnItem( 'Linen', 4 );
  11725. inv.AddAnItem( 'Silk', 6 );
  11726. inv.AddAnItem( 'Nigredo', 3 );
  11727. inv.AddAnItem( 'Albedo', 1 );
  11728. inv.AddAnItem( 'Rubedo', 1 );
  11729. inv.AddAnItem( 'Rebis', 1 );
  11730. inv.AddAnItem( 'Dog tallow', 4 );
  11731. inv.AddAnItem( 'Lunar shards', 3 );
  11732. inv.AddAnItem( 'Quicksilver solution', 5 );
  11733. inv.AddAnItem( 'Aether', 1 );
  11734. inv.AddAnItem( 'Optima mater', 3 );
  11735. inv.AddAnItem( 'Fifth essence', 2 );
  11736. inv.AddAnItem( 'Hardened timber', 6 );
  11737. inv.AddAnItem( 'Fur square', 1 );
  11738. inv.AddAnItem( 'Leather straps', 11 );
  11739. inv.AddAnItem( 'Leather squares', 6 );
  11740. inv.AddAnItem( 'Leather', 3 );
  11741. inv.AddAnItem( 'Hardened leather', 14 );
  11742. inv.AddAnItem( 'Chitin scale', 8 );
  11743. inv.AddAnItem( 'Draconide leather', 5 );
  11744. inv.AddAnItem( 'Infused draconide leather', 0 );
  11745. inv.AddAnItem( 'Steel ingot', 5 );
  11746. inv.AddAnItem( 'Dark iron ore', 2 );
  11747. inv.AddAnItem( 'Dark iron ingot', 3 );
  11748. inv.AddAnItem( 'Dark iron plate', 1 );
  11749. inv.AddAnItem( 'Dark steel ingot', 10 );
  11750. inv.AddAnItem( 'Dark steel plate', 6 );
  11751. inv.AddAnItem( 'Silver ore', 2 );
  11752. inv.AddAnItem( 'Silver ingot', 6 );
  11753. inv.AddAnItem( 'Meteorite ore', 3 );
  11754. inv.AddAnItem( 'Meteorite ingot', 3 );
  11755. inv.AddAnItem( 'Meteorite plate', 2 );
  11756. inv.AddAnItem( 'Meteorite silver ingot', 6 );
  11757. inv.AddAnItem( 'Meteorite silver plate', 5 );
  11758. inv.AddAnItem( 'Orichalcum ingot', 0 );
  11759. inv.AddAnItem( 'Orichalcum plate', 1 );
  11760. inv.AddAnItem( 'Dwimeryte ingot', 6 );
  11761. inv.AddAnItem( 'Dwimeryte plate', 5 );
  11762. inv.AddAnItem( 'Dwimeryte enriched ingot', 0 );
  11763. inv.AddAnItem( 'Dwimeryte enriched plate', 0 );
  11764. inv.AddAnItem( 'Emerald dust', 0 );
  11765. inv.AddAnItem( 'Ruby dust', 4 );
  11766. inv.AddAnItem( 'Ruby', 2 );
  11767. inv.AddAnItem( 'Ruby flawless', 1 );
  11768. inv.AddAnItem( 'Sapphire dust', 0 );
  11769. inv.AddAnItem( 'Sapphire', 0 );
  11770. inv.AddAnItem( 'Monstrous brain', 8 );
  11771. inv.AddAnItem( 'Monstrous blood', 14 );
  11772. inv.AddAnItem( 'Monstrous bone', 9 );
  11773. inv.AddAnItem( 'Monstrous claw', 14 );
  11774. inv.AddAnItem( 'Monstrous dust', 9 );
  11775. inv.AddAnItem( 'Monstrous ear', 5 );
  11776. inv.AddAnItem( 'Monstrous egg', 1 );
  11777. inv.AddAnItem( 'Monstrous eye', 10 );
  11778. inv.AddAnItem( 'Monstrous essence', 7 );
  11779. inv.AddAnItem( 'Monstrous feather', 8 );
  11780. inv.AddAnItem( 'Monstrous hair', 12 );
  11781. inv.AddAnItem( 'Monstrous heart', 7 );
  11782. inv.AddAnItem( 'Monstrous hide', 4 );
  11783. inv.AddAnItem( 'Monstrous liver', 5 );
  11784. inv.AddAnItem( 'Monstrous plate', 1 );
  11785. inv.AddAnItem( 'Monstrous saliva', 6 );
  11786. inv.AddAnItem( 'Monstrous stomach', 3 );
  11787. inv.AddAnItem( 'Monstrous tongue', 5 );
  11788. inv.AddAnItem( 'Monstrous tooth', 9 );
  11789. inv.AddAnItem( 'Venom extract', 0 );
  11790. inv.AddAnItem( 'Siren vocal cords', 1 );
  11791.  
  11792.  
  11793. SelectQuickslotItem( EES_RangedWeapon );
  11794.  
  11795.  
  11796. FactsAdd( 'kill_base_tutorials' );
  11797.  
  11798.  
  11799. theGame.GetTutorialSystem().RemoveAllQueuedTutorials();
  11800.  
  11801.  
  11802. FactsAdd( 'standalone_ep2' );
  11803. FactsRemove( "StandAloneEP2" );
  11804.  
  11805. theGame.GetJournalManager().ForceUntrackingQuestForEP1Savegame();
  11806. }
  11807.  
  11808.  
  11809. private var radialPopupShown : bool;
  11810.  
  11811. private function ToggleRadialMenuInput(enable : bool)
  11812. {
  11813. var hud : CR4ScriptedHud;
  11814. var module : CR4HudModuleRadialMenu;
  11815.  
  11816. hud = ( CR4ScriptedHud )theGame.GetHud();
  11817.  
  11818. if ( hud )
  11819. {
  11820. module = (CR4HudModuleRadialMenu)hud.GetHudModule( "RadialMenuModule" );
  11821. if ( module )
  11822. {
  11823. module.DisableRadialMenuInput(!enable);
  11824. }
  11825. }
  11826. }
  11827. public function EnableRadialInput()
  11828. {
  11829. radialPopupShown = false;
  11830. AddTimer( 'EnableRadialMenuInput', 0.03f, false );
  11831. }
  11832.  
  11833. timer function EnableRadialMenuInput( delta : float , id : int)
  11834. {
  11835. ToggleRadialMenuInput(true);
  11836. }
  11837.  
  11838. timer function DrinkRadialPotionUpper( delta : float , id : int)
  11839. {
  11840. OnPotionDrinkInput(true);
  11841. GetInputHandler().SetRadialPotionUpperTimer(false);
  11842. }
  11843.  
  11844. timer function DrinkRadialPotionLower( delta : float , id : int)
  11845. {
  11846. OnPotionDrinkInput(false);
  11847. GetInputHandler().SetRadialPotionLowerTimer(false);
  11848. }
  11849.  
  11850. public function GetRadialPopupShown() : bool
  11851. {
  11852. return radialPopupShown;
  11853. }
  11854.  
  11855. public function PotionSelectionPopup( selectionMode : EItemSelectionPopupMode )
  11856. {
  11857. var cat : array<name>;
  11858. var m_popupData : W3ItemSelectionPopupData;
  11859.  
  11860. m_popupData = new W3ItemSelectionPopupData in theGame.GetGuiManager();
  11861. m_popupData.targetInventory = thePlayer.GetInventory();
  11862. m_popupData.overrideQuestItemRestrictions = true;
  11863.  
  11864. m_popupData.selectionMode = selectionMode;
  11865.  
  11866. cat.PushBack('potion');
  11867. cat.PushBack('edibles');
  11868. m_popupData.categoryFilterList = cat;
  11869.  
  11870. theGame.RequestPopup('ItemSelectionPopup', m_popupData);
  11871.  
  11872. ToggleRadialMenuInput(false);
  11873. radialPopupShown = true;
  11874. }
  11875.  
  11876. public function OilSelectionPopup( steel : bool )
  11877. {
  11878. var cat, tags : array<name>;
  11879. var m_popupData : W3ItemSelectionPopupData;
  11880.  
  11881. m_popupData = new W3ItemSelectionPopupData in theGame.GetGuiManager();
  11882. m_popupData.targetInventory = thePlayer.GetInventory();
  11883. m_popupData.overrideQuestItemRestrictions = true;
  11884.  
  11885. if(steel)
  11886. {
  11887. tags.PushBack('SteelOil');
  11888. m_popupData.selectionMode = EISPM_RadialMenuSteelOil;
  11889. }
  11890. else
  11891. {
  11892. tags.PushBack('SilverOil');
  11893. m_popupData.selectionMode = EISPM_RadialMenuSilverOil;
  11894. }
  11895. m_popupData.filterTagsList = tags;
  11896.  
  11897. cat.PushBack('oil');
  11898. m_popupData.categoryFilterList = cat;
  11899.  
  11900. theGame.RequestPopup('ItemSelectionPopup', m_popupData);
  11901.  
  11902. ToggleRadialMenuInput(false);
  11903. radialPopupShown = true;
  11904. }
  11905.  
  11906. private function CheckRadialMenu() : bool
  11907. {
  11908. var hud : CR4ScriptedHud;
  11909. var module : CR4HudModuleRadialMenu;
  11910.  
  11911. hud = ( CR4ScriptedHud )theGame.GetHud();
  11912.  
  11913. if ( hud )
  11914. {
  11915. module = (CR4HudModuleRadialMenu)hud.GetHudModule( "RadialMenuModule" );
  11916. if ( module )
  11917. {
  11918. return module.IsRadialMenuOpened();
  11919. }
  11920. }
  11921.  
  11922. return false;
  11923. }
  11924.  
  11925. }
  11926.  
  11927. exec function fuqfep1()
  11928. {
  11929. theGame.GetJournalManager().ForceUntrackingQuestForEP1Savegame();
  11930. }
  11931.  
  11932.  
  11933.  
  11934.  
  11935.  
  11936. function GetWitcherPlayer() : W3PlayerWitcher
  11937. {
  11938. return (W3PlayerWitcher)thePlayer;
  11939. }
Add Comment
Please, Sign In to add comment