Advertisement
Guest User

Witcher 3 mod

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