Advertisement
Guest User

playerWitcher.ws

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