Guest User

Untitled

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