OldRelic

Playerwitcher.ws

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