Advertisement
Guest User

playerwitcher.ws

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