Guest User

Untitled

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