Advertisement
Guest User

playerwitcher.ws for dark_sun_ty

a guest
Oct 27th, 2018
238
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 214.07 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.  
  15.  
  16. private saved var alchemyRecipes : array<name>;
  17.  
  18.  
  19. private var levelupAbilities : array< name >;
  20. private var fastAttackCounter, heavyAttackCounter : int;
  21. private var isInFrenzy : bool;
  22. private var hasRecentlyCountered : bool;
  23. private saved var cannotUseUndyingSkill : bool;
  24.  
  25.  
  26. public var canSwitchFocusModeTarget : bool;
  27. protected var switchFocusModeTargetAllowed : bool;
  28. default canSwitchFocusModeTarget = true;
  29. default switchFocusModeTargetAllowed = true;
  30.  
  31.  
  32. private editable var signs : array< SWitcherSign >;
  33. private saved var equippedSign : ESignType;
  34. private var currentlyCastSign : ESignType; default currentlyCastSign = ST_None;
  35. private var signOwner : W3SignOwnerPlayer;
  36. private var usedQuenInCombat : bool;
  37. public var yrdenEntities : array<W3YrdenEntity>;
  38.  
  39. default equippedSign = ST_Aard;
  40.  
  41.  
  42.  
  43. private var bDispalyHeavyAttackIndicator : bool;
  44. private var bDisplayHeavyAttackFirstLevelTimer : bool;
  45. public var specialAttackHeavyAllowed : bool;
  46.  
  47. default bIsCombatActionAllowed = true;
  48. default bDispalyHeavyAttackIndicator = false;
  49. default bDisplayHeavyAttackFirstLevelTimer = true;
  50.  
  51.  
  52.  
  53. default explorationInputContext = 'Exploration';
  54. default combatInputContext = 'Combat';
  55. default combatFistsInputContext = 'Combat';
  56.  
  57.  
  58. private saved var companionNPCTag : name;
  59. private saved var companionNPCTag2 : name;
  60.  
  61. private saved var companionNPCIconPath : string;
  62. private saved var companionNPCIconPath2 : string;
  63.  
  64.  
  65. private saved var itemSlots : array<SItemUniqueId>;
  66. private var remainingBombThrowDelaySlot1 : float;
  67. private var remainingBombThrowDelaySlot2 : float;
  68. private var previouslyUsedBolt : SItemUniqueId;
  69.  
  70. default isThrowingItem = false;
  71. default remainingBombThrowDelaySlot1 = 0.f;
  72. default remainingBombThrowDelaySlot2 = 0.f;
  73.  
  74.  
  75.  
  76.  
  77.  
  78. private saved var tempLearnedSignSkills : array<SSimpleSkill>;
  79. public saved var autoLevel : bool;
  80.  
  81.  
  82.  
  83.  
  84. protected var skillBonusPotionEffect : CBaseGameplayEffect;
  85.  
  86.  
  87. public saved var levelManager : W3LevelManager;
  88.  
  89. //---=== modFriendlyHUD ===---
  90. public var prepDisallowOilsInCombat : bool; default prepDisallowOilsInCombat = false;
  91. public var prepOilsHaveAmmo : bool; default prepOilsHaveAmmo = false;
  92. //---=== modFriendlyHUD ===---
  93.  
  94.  
  95. saved var reputationManager : W3Reputation;
  96.  
  97.  
  98. private editable var medallionEntity : CEntityTemplate;
  99. private var medallionController : W3MedallionController;
  100.  
  101.  
  102. public var bShowRadialMenu : bool;
  103.  
  104. private var _HoldBeforeOpenRadialMenuTime : float;
  105.  
  106. default _HoldBeforeOpenRadialMenuTime = 0.5f;
  107.  
  108. public var MappinToHighlight : array<SHighlightMappin>;
  109.  
  110.  
  111. protected saved var horseManagerHandle : EntityHandle;
  112. private var isInitialized : bool;
  113.  
  114. default isInitialized = false;
  115.  
  116.  
  117. private var invUpdateTransaction : bool;
  118. default invUpdateTransaction = false;
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129. // Volumetric Clouds over Skellige
  130. public var vClouds : CVolumetricClouds;
  131. // Volumetric Clouds over Skellige
  132.  
  133. event OnSpawned( spawnData : SEntitySpawnData )
  134. {
  135. var i : int;
  136. var items : array<SItemUniqueId>;
  137. var items2 : array<SItemUniqueId>;
  138. var horseTemplate : CEntityTemplate;
  139. var horseManager : W3HorseManager;
  140.  
  141. AddAnimEventCallback( 'ActionBlend', 'OnAnimEvent_ActionBlend' );
  142. AddAnimEventCallback('cast_begin', 'OnAnimEvent_Sign');
  143. AddAnimEventCallback('cast_throw', 'OnAnimEvent_Sign');
  144. AddAnimEventCallback('cast_end', 'OnAnimEvent_Sign');
  145. AddAnimEventCallback('cast_friendly_begin', 'OnAnimEvent_Sign');
  146. AddAnimEventCallback('cast_friendly_throw', 'OnAnimEvent_Sign');
  147. AddAnimEventCallback('axii_ready', 'OnAnimEvent_Sign');
  148. AddAnimEventCallback('axii_alternate_ready', 'OnAnimEvent_Sign');
  149. AddAnimEventCallback('yrden_draw_ready', 'OnAnimEvent_Sign');
  150.  
  151. AddAnimEventCallback( 'ProjectileThrow', 'OnAnimEvent_Throwable' );
  152. AddAnimEventCallback( 'OnWeaponReload', 'OnAnimEvent_Throwable' );
  153. AddAnimEventCallback( 'ProjectileAttach', 'OnAnimEvent_Throwable' );
  154. theTelemetry.LogWithName( TE_HERO_SPAWNED );
  155. amountOfSetPiecesEquipped.Resize( EnumGetMax( 'EItemSetType' ) + 1 );
  156.  
  157. runewordInfusionType = ST_None;
  158.  
  159.  
  160. inv = GetInventory();
  161.  
  162.  
  163. signOwner = new W3SignOwnerPlayer in this;
  164. signOwner.Init( this );
  165.  
  166. itemSlots.Resize( EnumGetMax('EEquipmentSlots')+1 );
  167.  
  168. if(!spawnData.restored)
  169. {
  170. levelManager = new W3LevelManager in this;
  171. levelManager.Initialize();
  172.  
  173.  
  174. inv.GetAllItems(items);
  175. for(i=0; i<items.Size(); i+=1)
  176. {
  177. if(inv.IsItemMounted(items[i]) && ( !inv.IsItemBody(items[i]) || inv.GetItemCategory(items[i]) == 'hair' ) )
  178. EquipItem(items[i]);
  179. }
  180.  
  181.  
  182.  
  183.  
  184.  
  185. AddAlchemyRecipe('Recipe for Swallow 1',true,true);
  186. AddAlchemyRecipe('Recipe for Cat 1',true,true);
  187. AddAlchemyRecipe('Recipe for White Honey 1',true,true);
  188.  
  189. AddAlchemyRecipe('Recipe for Samum 1',true,true);
  190. AddAlchemyRecipe('Recipe for Grapeshot 1',true,true);
  191.  
  192. AddAlchemyRecipe('Recipe for Specter Oil 1',true,true);
  193. AddAlchemyRecipe('Recipe for Necrophage Oil 1',true,true);
  194. AddAlchemyRecipe('Recipe for Alcohest 1',true,true);
  195.  
  196.  
  197. AddStartingSchematics();
  198. }
  199. else
  200. {
  201. AddTimer('DelayedOnItemMount', 0.1, true);
  202.  
  203.  
  204. CheckHairItem();
  205. }
  206.  
  207. super.OnSpawned( spawnData );
  208.  
  209.  
  210. AddAlchemyRecipe('Recipe for Mutagen red',true,true);
  211. AddAlchemyRecipe('Recipe for Mutagen green',true,true);
  212. AddAlchemyRecipe('Recipe for Mutagen blue',true,true);
  213. AddAlchemyRecipe('Recipe for Greater mutagen red',true,true);
  214. AddAlchemyRecipe('Recipe for Greater mutagen green',true,true);
  215. AddAlchemyRecipe('Recipe for Greater mutagen blue',true,true);
  216.  
  217. AddCraftingSchematic('Starting Armor Upgrade schematic 1',true,true);
  218.  
  219. levelupAbilities.PushBack('Lvl1');
  220. levelupAbilities.PushBack('Lvl1');
  221. levelupAbilities.PushBack('Lvl2');
  222. levelupAbilities.PushBack('Lvl3');
  223. levelupAbilities.PushBack('Lvl4');
  224. levelupAbilities.PushBack('Lvl5');
  225. levelupAbilities.PushBack('Lvl6');
  226. levelupAbilities.PushBack('Lvl7');
  227. levelupAbilities.PushBack('Lvl8');
  228. levelupAbilities.PushBack('Lvl9');
  229. levelupAbilities.PushBack('Lvl10');
  230. levelupAbilities.PushBack('Lvl11');
  231. levelupAbilities.PushBack('Lvl12');
  232. levelupAbilities.PushBack('Lvl13');
  233. levelupAbilities.PushBack('Lvl14');
  234. levelupAbilities.PushBack('Lvl15');
  235. levelupAbilities.PushBack('Lvl16');
  236. levelupAbilities.PushBack('Lvl17');
  237. levelupAbilities.PushBack('Lvl18');
  238. levelupAbilities.PushBack('Lvl19');
  239. levelupAbilities.PushBack('Lvl20');
  240. levelupAbilities.PushBack('Lvl21');
  241. levelupAbilities.PushBack('Lvl22');
  242. levelupAbilities.PushBack('Lvl23');
  243. levelupAbilities.PushBack('Lvl24');
  244. levelupAbilities.PushBack('Lvl25');
  245. levelupAbilities.PushBack('Lvl26');
  246. levelupAbilities.PushBack('Lvl27');
  247. levelupAbilities.PushBack('Lvl28');
  248. levelupAbilities.PushBack('Lvl29');
  249. levelupAbilities.PushBack('Lvl30');
  250. levelupAbilities.PushBack('Lvl31');
  251. levelupAbilities.PushBack('Lvl32');
  252. levelupAbilities.PushBack('Lvl33');
  253. levelupAbilities.PushBack('Lvl34');
  254. levelupAbilities.PushBack('Lvl35');
  255. levelupAbilities.PushBack('Lvl36');
  256. levelupAbilities.PushBack('Lvl37');
  257. levelupAbilities.PushBack('Lvl38');
  258. levelupAbilities.PushBack('Lvl39');
  259. levelupAbilities.PushBack('Lvl40');
  260. levelupAbilities.PushBack('Lvl41');
  261. levelupAbilities.PushBack('Lvl42');
  262. levelupAbilities.PushBack('Lvl43');
  263. levelupAbilities.PushBack('Lvl44');
  264. levelupAbilities.PushBack('Lvl45');
  265. levelupAbilities.PushBack('Lvl46');
  266. levelupAbilities.PushBack('Lvl47');
  267. levelupAbilities.PushBack('Lvl48');
  268. levelupAbilities.PushBack('Lvl49');
  269. levelupAbilities.PushBack('Lvl50');
  270. levelupAbilities.PushBack('Lvl51');
  271. levelupAbilities.PushBack('Lvl52');
  272. levelupAbilities.PushBack('Lvl53');
  273. levelupAbilities.PushBack('Lvl54');
  274. levelupAbilities.PushBack('Lvl55');
  275. levelupAbilities.PushBack('Lvl56');
  276. levelupAbilities.PushBack('Lvl57');
  277. levelupAbilities.PushBack('Lvl58');
  278. levelupAbilities.PushBack('Lvl59');
  279. levelupAbilities.PushBack('Lvl60');
  280. levelupAbilities.PushBack('Lvl61');
  281. levelupAbilities.PushBack('Lvl62');
  282. levelupAbilities.PushBack('Lvl63');
  283. levelupAbilities.PushBack('Lvl64');
  284. levelupAbilities.PushBack('Lvl65');
  285. levelupAbilities.PushBack('Lvl66');
  286. levelupAbilities.PushBack('Lvl67');
  287. levelupAbilities.PushBack('Lvl68');
  288. levelupAbilities.PushBack('Lvl69');
  289. levelupAbilities.PushBack('Lvl70');
  290. levelupAbilities.PushBack('Lvl71');
  291. levelupAbilities.PushBack('Lvl72');
  292. levelupAbilities.PushBack('Lvl73');
  293. levelupAbilities.PushBack('Lvl74');
  294. levelupAbilities.PushBack('Lvl75');
  295. levelupAbilities.PushBack('Lvl76');
  296. levelupAbilities.PushBack('Lvl77');
  297. levelupAbilities.PushBack('Lvl78');
  298. levelupAbilities.PushBack('Lvl79');
  299. levelupAbilities.PushBack('Lvl80');
  300. levelupAbilities.PushBack('Lvl81');
  301. levelupAbilities.PushBack('Lvl82');
  302. levelupAbilities.PushBack('Lvl83');
  303. levelupAbilities.PushBack('Lvl84');
  304. levelupAbilities.PushBack('Lvl85');
  305. levelupAbilities.PushBack('Lvl86');
  306. levelupAbilities.PushBack('Lvl87');
  307. levelupAbilities.PushBack('Lvl88');
  308. levelupAbilities.PushBack('Lvl89');
  309. levelupAbilities.PushBack('Lvl90');
  310. levelupAbilities.PushBack('Lvl91');
  311. levelupAbilities.PushBack('Lvl92');
  312. levelupAbilities.PushBack('Lvl93');
  313. levelupAbilities.PushBack('Lvl94');
  314. levelupAbilities.PushBack('Lvl95');
  315. levelupAbilities.PushBack('Lvl96');
  316. levelupAbilities.PushBack('Lvl97');
  317. levelupAbilities.PushBack('Lvl98');
  318. levelupAbilities.PushBack('Lvl99');
  319. levelupAbilities.PushBack('Lvl100');
  320.  
  321.  
  322. if( inputHandler )
  323. {
  324. inputHandler.BlockAllActions( 'being_ciri', false );
  325. }
  326. SetBehaviorVariable( 'test_ciri_replacer', 0.0f);
  327.  
  328. if(!spawnData.restored)
  329. {
  330.  
  331. abilityManager.GainStat(BCS_Toxicity, 0);
  332. }
  333.  
  334. levelManager.PostInit(this, spawnData.restored);
  335.  
  336. SetBIsCombatActionAllowed( true );
  337. SetBIsInputAllowed( true, 'OnSpawned' );
  338.  
  339.  
  340. if ( !reputationManager )
  341. {
  342. reputationManager = new W3Reputation in this;
  343. reputationManager.Initialize();
  344. }
  345.  
  346. theSound.SoundParameter( "focus_aim", 1.0f, 1.0f );
  347. theSound.SoundParameter( "focus_distance", 0.0f, 1.0f );
  348.  
  349.  
  350.  
  351.  
  352.  
  353.  
  354. currentlyCastSign = ST_None;
  355.  
  356.  
  357. if(!spawnData.restored)
  358. {
  359. horseTemplate = (CEntityTemplate)LoadResource("horse_manager");
  360. horseManager = (W3HorseManager)theGame.CreateEntity(horseTemplate, GetWorldPosition(),,,,,PM_Persist);
  361. horseManager.CreateAttachment(this);
  362. horseManager.OnCreated();
  363. EntityHandleSet( horseManagerHandle, horseManager );
  364. }
  365. else
  366. {
  367. AddTimer('DelayedHorseUpdate', 0.01, true);
  368. }
  369.  
  370.  
  371. RemoveAbility('Ciri_CombatRegen');
  372. RemoveAbility('Ciri_Rage');
  373. RemoveAbility('CiriBlink');
  374. RemoveAbility('CiriCharge');
  375. RemoveAbility('Ciri_Q205');
  376. RemoveAbility('Ciri_Q305');
  377. RemoveAbility('Ciri_Q403');
  378. RemoveAbility('Ciri_Q111');
  379. RemoveAbility('Ciri_Q501');
  380. RemoveAbility('SkillCiri');
  381.  
  382. if(spawnData.restored)
  383. {
  384. RestoreQuen(savedQuenHealth, savedQuenDuration);
  385. }
  386. else
  387. {
  388. savedQuenHealth = 0.f;
  389. savedQuenDuration = 0.f;
  390. }
  391.  
  392. if(spawnData.restored)
  393. ApplyPatchFixes();
  394.  
  395. if(!newGamePlusInitialized && FactsQuerySum("NewGamePlus") > 0)
  396. {
  397. NewGamePlusInitialize();
  398. }
  399.  
  400. if ( FactsQuerySum("NewGamePlus") > 0 )
  401. {
  402. NewGamePlusAdjustDLC1TemerianSet(inv);
  403. NewGamePlusAdjustDLC5NilfgardianSet(inv);
  404. NewGamePlusAdjustDLC10WolfSet(inv);
  405. NewGamePlusAdjustDLC14SkelligeSet(inv);
  406. if(horseManager)
  407. {
  408. NewGamePlusAdjustDLC1TemerianSet(horseManager.GetInventoryComponent());
  409. NewGamePlusAdjustDLC5NilfgardianSet(horseManager.GetInventoryComponent());
  410. NewGamePlusAdjustDLC10WolfSet(horseManager.GetInventoryComponent());
  411. NewGamePlusAdjustDLC14SkelligeSet(horseManager.GetInventoryComponent());
  412. }
  413. }
  414.  
  415.  
  416. ResumeStaminaRegen('WhirlSkill');
  417.  
  418. if(HasAbility('Runeword 4 _Stats', true))
  419. StartVitalityRegen();
  420.  
  421.  
  422. if(HasAbility('sword_s19'))
  423. {
  424. RemoveTemporarySkills();
  425. }
  426.  
  427. HACK_UnequipWolfLiver();
  428.  
  429.  
  430. if( HasBuff( EET_GryphonSetBonusYrden ) )
  431. {
  432. RemoveBuff( EET_GryphonSetBonusYrden, false, "GryphonSetBonusYrden" );
  433. isInitialized = true;
  434. }
  435.  
  436.  
  437.  
  438.  
  439.  
  440. private function HACK_UnequipWolfLiver()
  441. {
  442. var itemName1, itemName2, itemName3, itemName4 : name;
  443. var item1, item2, item3, item4 : SItemUniqueId;
  444.  
  445. GetItemEquippedOnSlot( EES_Potion1, item1 );
  446. GetItemEquippedOnSlot( EES_Potion2, item2 );
  447. GetItemEquippedOnSlot( EES_Potion3, item3 );
  448. GetItemEquippedOnSlot( EES_Potion4, item4 );
  449.  
  450. if ( inv.IsIdValid( item1 ) )
  451. itemName1 = inv.GetItemName( item1 );
  452. if ( inv.IsIdValid( item2 ) )
  453. itemName2 = inv.GetItemName( item2 );
  454. if ( inv.IsIdValid( item3 ) )
  455. itemName3 = inv.GetItemName( item3 );
  456. if ( inv.IsIdValid( item4 ) )
  457. itemName4 = inv.GetItemName( item4 );
  458.  
  459. if ( itemName1 == 'Wolf liver' || itemName3 == 'Wolf liver' )
  460. {
  461. if ( inv.IsIdValid( item1 ) )
  462. UnequipItem( item1 );
  463. if ( inv.IsIdValid( item3 ) )
  464. UnequipItem( item3 );
  465. }
  466. else if ( itemName2 == 'Wolf liver' || itemName4 == 'Wolf liver' )
  467. {
  468. if ( inv.IsIdValid( item2 ) )
  469. UnequipItem( item2 );
  470. if ( inv.IsIdValid( item4 ) )
  471. UnequipItem( item4 );
  472. }
  473. }
  474.  
  475.  
  476. // Volumetric Clouds over Skellige
  477. timer function InitVolumetricClouds(dt : float, id : int) {
  478. vClouds.activateFX();
  479. }
  480. // Volumetric Clouds over Skellige
  481.  
  482.  
  483. timer function DelayedHorseUpdate( dt : float, id : int )
  484. {
  485. var man : W3HorseManager;
  486.  
  487. man = GetHorseManager();
  488. if(man)
  489. {
  490. if ( man.ApplyHorseUpdateOnSpawn() )
  491. {
  492. RemoveTimer( 'DelayedHorseUpdate' );
  493. }
  494. }
  495. }
  496.  
  497. event OnAbilityAdded( abilityName : name)
  498. {
  499. super.OnAbilityAdded(abilityName);
  500.  
  501. if(HasAbility('Runeword 4 _Stats', true))
  502. StartVitalityRegen();
  503.  
  504. if ( GetStat(BCS_Focus, true) >= GetStatMax(BCS_Focus) && abilityName == 'Runeword 8 _Stats' && !HasBuff(EET_Runeword8) )
  505. {
  506. AddEffectDefault(EET_Runeword8, this, "equipped item");
  507. }
  508.  
  509. }
  510.  
  511. private final function AddStartingSchematics()
  512. {
  513. AddCraftingSchematic('Starting Armor Upgrade schematic 1', true,true);
  514. AddCraftingSchematic('Thread schematic', true, true);
  515. AddCraftingSchematic('String schematic', true, true);
  516. AddCraftingSchematic('Linen schematic', true, true);
  517. AddCraftingSchematic('Silk schematic', true, true);
  518. AddCraftingSchematic('Resin schematic', true, true);
  519. AddCraftingSchematic('Blasting powder schematic', true, true);
  520. AddCraftingSchematic('Haft schematic', true, true);
  521. AddCraftingSchematic('Hardened timber schematic', true, true);
  522. AddCraftingSchematic('Leather squares schematic', true, true);
  523. AddCraftingSchematic('Leather schematic', true, true);
  524. AddCraftingSchematic('Hardened leather schematic', true, true);
  525. AddCraftingSchematic('Draconide leather schematic', true, true);
  526. AddCraftingSchematic('Iron ingot schematic', true, true);
  527. AddCraftingSchematic('Steel ingot schematic', true, true);
  528. AddCraftingSchematic('Steel ingot schematic 1', true, true);
  529. AddCraftingSchematic('Steel plate schematic', true, true);
  530. AddCraftingSchematic('Dark iron ingot schematic', true, true);
  531. AddCraftingSchematic('Dark steel ingot schematic', true, true);
  532. AddCraftingSchematic('Dark steel ingot schematic 1', true, true);
  533. AddCraftingSchematic('Dark steel plate schematic', true, true);
  534. AddCraftingSchematic('Silver ore schematic', true, true);
  535. AddCraftingSchematic('Silver ingot schematic', true, true);
  536. AddCraftingSchematic('Silver ingot schematic 1', true, true);
  537. AddCraftingSchematic('Silver plate schematic', true, true);
  538. AddCraftingSchematic('Meteorite ingot schematic', true, true);
  539. AddCraftingSchematic('Meteorite silver ingot schematic', true, true);
  540. AddCraftingSchematic('Meteorite silver plate schematic', true, true);
  541. AddCraftingSchematic('Glowing ingot schematic', true, true);
  542. AddCraftingSchematic('Dwimeryte ore schematic', true, true);
  543. AddCraftingSchematic('Dwimeryte ingot schematic', true, true);
  544. AddCraftingSchematic('Dwimeryte ingot schematic 1', true, true);
  545. AddCraftingSchematic('Dwimeryte plate schematic', true, true);
  546. }
  547.  
  548. private final function ApplyPatchFixes()
  549. {
  550. var cnt, transmutationCount, mutagenCount, i : int;
  551. var transmutationAbility : name;
  552. var pam : W3PlayerAbilityManager;
  553. var slotId : int;
  554. var offset : float;
  555. var buffs : array<CBaseGameplayEffect>;
  556. var mutagen : W3Mutagen_Effect;
  557. var skill : SSimpleSkill;
  558. var spentSkillPoints, swordSkillPointsSpent, alchemySkillPointsSpent, perkSkillPointsSpent, pointsToAdd : int;
  559.  
  560. if(FactsQuerySum("ClearingPotionPassiveBonusFix") < 1)
  561. {
  562. pam = (W3PlayerAbilityManager)abilityManager;
  563.  
  564. cnt = GetAbilityCount('sword_adrenalinegain') - pam.GetPathPointsSpent(ESP_Sword);
  565. if(cnt > 0)
  566. RemoveAbilityMultiple('sword_adrenalinegain', cnt);
  567.  
  568. cnt = GetAbilityCount('magic_staminaregen') - pam.GetPathPointsSpent(ESP_Signs);
  569. if(cnt > 0)
  570. RemoveAbilityMultiple('magic_staminaregen', cnt);
  571.  
  572. cnt = GetAbilityCount('alchemy_potionduration') - pam.GetPathPointsSpent(ESP_Alchemy);
  573. if(cnt > 0)
  574. RemoveAbilityMultiple('alchemy_potionduration', cnt);
  575.  
  576. FactsAdd("ClearingPotionPassiveBonusFix");
  577. }
  578.  
  579.  
  580. if(FactsQuerySum("DimeritiumSynergyFix") < 1)
  581. {
  582. slotId = GetSkillSlotID(S_Alchemy_s19);
  583. if(slotId != -1)
  584. UnequipSkill(S_Alchemy_s19);
  585.  
  586. RemoveAbilityAll('greater_mutagen_color_green_synergy_bonus');
  587. RemoveAbilityAll('mutagen_color_green_synergy_bonus');
  588. RemoveAbilityAll('mutagen_color_lesser_green_synergy_bonus');
  589.  
  590. RemoveAbilityAll('greater_mutagen_color_blue_synergy_bonus');
  591. RemoveAbilityAll('mutagen_color_blue_synergy_bonus');
  592. RemoveAbilityAll('mutagen_color_lesser_blue_synergy_bonus');
  593.  
  594. RemoveAbilityAll('greater_mutagen_color_red_synergy_bonus');
  595. RemoveAbilityAll('mutagen_color_red_synergy_bonus');
  596. RemoveAbilityAll('mutagen_color_lesser_red_synergy_bonus');
  597.  
  598. if(slotId != -1)
  599. EquipSkill(S_Alchemy_s19, slotId);
  600.  
  601. FactsAdd("DimeritiumSynergyFix");
  602. }
  603.  
  604.  
  605. if(FactsQuerySum("DontShowRecipePinTut") < 1)
  606. {
  607. TutorialScript('alchemyRecipePin', '');
  608. TutorialScript('craftingRecipePin', '');
  609. }
  610.  
  611.  
  612. if(FactsQuerySum("LevelReqPotGiven") < 1)
  613. {
  614. FactsAdd("LevelReqPotGiven");
  615. inv.AddAnItem('Wolf Hour', 1, false, false, true);
  616. }
  617.  
  618.  
  619. if(!HasBuff(EET_AutoStaminaRegen))
  620. {
  621. AddEffectDefault(EET_AutoStaminaRegen, this, 'autobuff', false);
  622. }
  623.  
  624.  
  625.  
  626. buffs = GetBuffs();
  627. offset = 0;
  628. mutagenCount = 0;
  629. for(i=0; i<buffs.Size(); i+=1)
  630. {
  631. mutagen = (W3Mutagen_Effect)buffs[i];
  632. if(mutagen)
  633. {
  634. offset += mutagen.GetToxicityOffset();
  635. mutagenCount += 1;
  636. }
  637. }
  638.  
  639.  
  640. if(offset != (GetStat(BCS_Toxicity) - GetStat(BCS_Toxicity, true)))
  641. SetToxicityOffset(offset);
  642.  
  643.  
  644. mutagenCount *= GetSkillLevel(S_Alchemy_s13);
  645. transmutationAbility = GetSkillAbilityName(S_Alchemy_s13);
  646. transmutationCount = GetAbilityCount(transmutationAbility);
  647. if(mutagenCount < transmutationCount)
  648. {
  649. RemoveAbilityMultiple(transmutationAbility, transmutationCount - mutagenCount);
  650. }
  651. else if(mutagenCount > transmutationCount)
  652. {
  653. AddAbilityMultiple(transmutationAbility, mutagenCount - transmutationCount);
  654. }
  655.  
  656.  
  657. if(theGame.GetDLCManager().IsEP1Available())
  658. {
  659. theGame.GetJournalManager().ActivateEntryByScriptTag('TutorialJournalEnchanting', JS_Active);
  660. }
  661.  
  662.  
  663. levelManager.FixMaxLevel();
  664.  
  665.  
  666. if(HasAbility('sword_s19') && FactsQuerySum("Patch_Sword_s19") < 1)
  667. {
  668. pam = (W3PlayerAbilityManager)abilityManager;
  669.  
  670.  
  671. skill.level = 0;
  672. for(i = S_Magic_s01; i <= S_Magic_s20; i+=1)
  673. {
  674. skill.skillType = i;
  675. pam.RemoveTemporarySkill(skill);
  676. }
  677.  
  678.  
  679. spentSkillPoints = levelManager.GetPointsUsed(ESkillPoint);
  680. swordSkillPointsSpent = pam.GetPathPointsSpent(ESP_Sword);
  681. alchemySkillPointsSpent = pam.GetPathPointsSpent(ESP_Alchemy);
  682. perkSkillPointsSpent = pam.GetPathPointsSpent(ESP_Perks);
  683.  
  684. pointsToAdd = spentSkillPoints - swordSkillPointsSpent - alchemySkillPointsSpent - perkSkillPointsSpent;
  685. if(pointsToAdd > 0)
  686. levelManager.UnspendPoints(ESkillPoint, pointsToAdd);
  687.  
  688.  
  689. RemoveAbilityAll('sword_s19');
  690.  
  691.  
  692. FactsAdd("Patch_Sword_s19");
  693. }
  694.  
  695.  
  696. if(FactsQuerySum("Patch_Armor_Type_Glyphwords") < 1)
  697. {
  698. pam = (W3PlayerAbilityManager)abilityManager;
  699.  
  700. pam.SetPerkArmorBonus(S_Perk_05);
  701. pam.SetPerkArmorBonus(S_Perk_06);
  702. pam.SetPerkArmorBonus(S_Perk_07);
  703.  
  704. FactsAdd("Patch_Armor_Type_Glyphwords");
  705. }
  706. }
  707.  
  708. public final function RestoreQuen(quenHealth : float, quenDuration : float) : bool
  709. }
  710.  
  711. public final function RestoreQuen(quenHealth : float, quenDuration : float) : bool
  712. {
  713. var restoredQuen : W3QuenEntity;
  714.  
  715. if(quenHealth > 0.f && quenDuration >= 3.f)
  716. {
  717. restoredQuen = (W3QuenEntity)theGame.CreateEntity( signs[ST_Quen].template, GetWorldPosition(), GetWorldRotation() );
  718. restoredQuen.Init( signOwner, signs[ST_Quen].entity, true );
  719. restoredQuen.OnStarted();
  720. restoredQuen.OnThrowing();
  721. restoredQuen.OnEnded();
  722. restoredQuen.SetDataFromRestore(quenHealth, quenDuration);
  723.  
  724. return true;
  725. }
  726.  
  727. return false;
  728. }
  729.  
  730. public function IsInitialized() : bool
  731. {
  732. return isInitialized;
  733. }
  734.  
  735. private final function NewGamePlusInitialize()
  736. {
  737. var questItems : array<name>;
  738. var horseManager : W3HorseManager;
  739. var horseInventory : CInventoryComponent;
  740. var i, missingLevels, expDiff : int;
  741.  
  742.  
  743. horseManager = (W3HorseManager)EntityHandleGet(horseManagerHandle);
  744. if(horseManager)
  745. horseInventory = horseManager.GetInventoryComponent();
  746.  
  747.  
  748. theGame.params.SetNewGamePlusLevel(GetLevel());
  749.  
  750.  
  751. if (theGame.GetDLCManager().IsDLCAvailable('ep1'))
  752. missingLevels = theGame.params.NEW_GAME_PLUS_EP1_MIN_LEVEL - GetLevel();
  753. else
  754. missingLevels = theGame.params.NEW_GAME_PLUS_MIN_LEVEL - GetLevel();
  755.  
  756. for(i=0; i<missingLevels; i+=1)
  757. {
  758.  
  759. expDiff = levelManager.GetTotalExpForNextLevel() - levelManager.GetPointsTotal(EExperiencePoint);
  760. expDiff = CeilF( ((float)expDiff) / 2 );
  761. AddPoints(EExperiencePoint, expDiff, false);
  762. }
  763.  
  764.  
  765.  
  766.  
  767.  
  768. inv.RemoveItemByTag('Quest', -1);
  769. horseInventory.RemoveItemByTag('Quest', -1);
  770.  
  771.  
  772.  
  773. questItems = theGame.GetDefinitionsManager().GetItemsWithTag('Quest');
  774. for(i=0; i<questItems.Size(); i+=1)
  775. {
  776. inv.RemoveItemByName(questItems[i], -1);
  777. horseInventory.RemoveItemByName(questItems[i], -1);
  778. }
  779.  
  780.  
  781. inv.RemoveItemByName('mq1002_artifact_3', -1);
  782. horseInventory.RemoveItemByName('mq1002_artifact_3', -1);
  783.  
  784.  
  785. inv.RemoveItemByTag('NotTransferableToNGP', -1);
  786. horseInventory.RemoveItemByTag('NotTransferableToNGP', -1);
  787.  
  788.  
  789. inv.RemoveItemByTag('NoticeBoardNote', -1);
  790. horseInventory.RemoveItemByTag('NoticeBoardNote', -1);
  791.  
  792.  
  793. RemoveAllNonAutoBuffs();
  794.  
  795.  
  796. RemoveAlchemyRecipe('Recipe for Trial Potion Kit');
  797. RemoveAlchemyRecipe('Recipe for Pops Antidote');
  798. RemoveAlchemyRecipe('Recipe for Czart Lure');
  799. RemoveAlchemyRecipe('q603_diarrhea_potion_recipe');
  800.  
  801.  
  802. inv.RemoveItemByTag('Trophy', -1);
  803. horseInventory.RemoveItemByTag('Trophy', -1);
  804.  
  805.  
  806. inv.RemoveItemByCategory('usable', -1);
  807. horseInventory.RemoveItemByCategory('usable', -1);
  808.  
  809.  
  810. RemoveAbility('StaminaTutorialProlog');
  811. RemoveAbility('TutorialStaminaRegenHack');
  812. RemoveAbility('area_novigrad');
  813. RemoveAbility('NoRegenEffect');
  814. RemoveAbility('HeavySwimmingStaminaDrain');
  815. RemoveAbility('AirBoost');
  816. RemoveAbility('area_nml');
  817. RemoveAbility('area_skellige');
  818.  
  819.  
  820. inv.RemoveItemByTag('GwintCard', -1);
  821. horseInventory.RemoveItemByTag('GwintCard', -1);
  822.  
  823.  
  824.  
  825. inv.RemoveItemByTag('ReadableItem', -1);
  826. horseInventory.RemoveItemByTag('ReadableItem', -1);
  827.  
  828.  
  829. abilityManager.RestoreStats();
  830.  
  831.  
  832. ((W3PlayerAbilityManager)abilityManager).RemoveToxicityOffset(10000);
  833.  
  834.  
  835. GetInventory().SingletonItemsRefillAmmo();
  836.  
  837.  
  838. craftingSchematics.Clear();
  839. AddStartingSchematics();
  840.  
  841.  
  842. inv.AddAnItem('Clearing Potion', 1, true, false, false);
  843.  
  844.  
  845. inv.RemoveItemByName('q203_broken_eyeofloki', -1);
  846. horseInventory.RemoveItemByName('q203_broken_eyeofloki', -1);
  847.  
  848. NewGamePlusReplaceViperSet(inv);
  849. NewGamePlusReplaceViperSet(horseInventory);
  850. NewGamePlusReplaceLynxSet(inv);
  851. NewGamePlusReplaceLynxSet(horseInventory);
  852. NewGamePlusReplaceGryphonSet(inv);
  853. NewGamePlusReplaceGryphonSet(horseInventory);
  854. NewGamePlusReplaceBearSet(inv);
  855. NewGamePlusReplaceBearSet(horseInventory);
  856. NewGamePlusReplaceEP1(inv);
  857. NewGamePlusReplaceEP1(horseInventory);
  858.  
  859.  
  860. inputHandler.ClearLocksForNGP();
  861.  
  862.  
  863. buffImmunities.Clear();
  864. buffRemovedImmunities.Clear();
  865.  
  866. newGamePlusInitialized = true;
  867. }
  868.  
  869. private final function NewGamePlusReplaceItem( item : name, new_item : name, out inv : CInventoryComponent)
  870. {
  871. var i, j : int;
  872. var ids, new_ids, enh_ids : array<SItemUniqueId>;
  873. var enh : array<name>;
  874. var wasEquipped : bool;
  875. var wasEnchanted : bool;
  876. var enchantName : name;
  877.  
  878. if ( inv.HasItem( item ) )
  879. {
  880. ids = inv.GetItemsIds(item);
  881. for (i = 0; i < ids.Size(); i += 1)
  882. {
  883. inv.GetItemEnhancementItems(ids[i], enh);
  884. wasEnchanted = inv.IsItemEnchanted(ids[i]);
  885. if ( wasEnchanted )
  886. enchantName = inv.GetEnchantment(ids[i]);
  887. wasEquipped = IsItemEquipped( ids[i] );
  888. inv.RemoveItem(ids[i], 1);
  889. new_ids = inv.AddAnItem(new_item, 1, true, true, false);
  890. if ( wasEquipped )
  891. {
  892. EquipItem( new_ids[0] );
  893. }
  894. if ( wasEnchanted )
  895. {
  896. inv.EnchantItem(new_ids[0], enchantName, getEnchamtmentStatName(enchantName));
  897. }
  898. for (j = 0; j < enh.Size(); j += 1)
  899. {
  900. enh_ids = inv.AddAnItem(enh[j], 1, true, true, false);
  901. inv.EnhanceItemScript(new_ids[0], enh_ids[0]);
  902. }
  903. }
  904. }
  905. }
  906.  
  907. private final function NewGamePlusAdjustDLCItem(item : name, mod : name, inv : CInventoryComponent)
  908. {
  909. var ids : array<SItemUniqueId>;
  910. var i : int;
  911.  
  912. if( inv.HasItem(item) )
  913. {
  914. ids = inv.GetItemsIds(item);
  915. for (i = 0; i < ids.Size(); i += 1)
  916. {
  917. if ( inv.GetItemModifierInt(ids[i], 'DoNotAdjustNGPDLC') <= 0 )
  918. {
  919. inv.AddItemBaseAbility(ids[i], mod);
  920. inv.SetItemModifierInt(ids[i], 'DoNotAdjustNGPDLC', 1);
  921. }
  922. }
  923. }
  924.  
  925. }
  926.  
  927. private final function NewGamePlusAdjustDLC1TemerianSet(inv : CInventoryComponent)
  928. {
  929. NewGamePlusAdjustDLCItem('NGP DLC1 Temerian Armor', 'NGP DLC Compatibility Chest Armor Mod', inv);
  930. NewGamePlusAdjustDLCItem('NGP DLC1 Temerian Gloves', 'NGP DLC Compatibility Armor Mod', inv);
  931. NewGamePlusAdjustDLCItem('NGP DLC1 Temerian Pants', 'NGP DLC Compatibility Armor Mod', inv);
  932. NewGamePlusAdjustDLCItem('NGP DLC1 Temerian Boots', 'NGP DLC Compatibility Armor Mod', inv);
  933. }
  934.  
  935. private final function NewGamePlusAdjustDLC5NilfgardianSet(inv : CInventoryComponent)
  936. {
  937. NewGamePlusAdjustDLCItem('NGP DLC5 Nilfgaardian Armor', 'NGP DLC Compatibility Chest Armor Mod', inv);
  938. NewGamePlusAdjustDLCItem('NGP DLC5 Nilfgaardian Gloves', 'NGP DLC Compatibility Armor Mod', inv);
  939. NewGamePlusAdjustDLCItem('NGP DLC5 Nilfgaardian Pants', 'NGP DLC Compatibility Armor Mod', inv);
  940. NewGamePlusAdjustDLCItem('NGP DLC5 Nilfgaardian Boots', 'NGP DLC Compatibility Armor Mod', inv);
  941. }
  942.  
  943. private final function NewGamePlusAdjustDLC10WolfSet(inv : CInventoryComponent)
  944. {
  945. NewGamePlusAdjustDLCItem('NGP Wolf Armor', 'NGP DLC Compatibility Chest Armor Mod', inv);
  946. NewGamePlusAdjustDLCItem('NGP Wolf Armor 1', 'NGP DLC Compatibility Chest Armor Mod', inv);
  947. NewGamePlusAdjustDLCItem('NGP Wolf Armor 2', 'NGP DLC Compatibility Chest Armor Mod', inv);
  948. NewGamePlusAdjustDLCItem('NGP Wolf Armor 3', 'NGP DLC Compatibility Chest Armor Mod', inv);
  949.  
  950. NewGamePlusAdjustDLCItem('NGP Wolf Boots 1', 'NGP DLC Compatibility Armor Mod', inv);
  951. NewGamePlusAdjustDLCItem('NGP Wolf Boots 2', 'NGP DLC Compatibility Armor Mod', inv);
  952. NewGamePlusAdjustDLCItem('NGP Wolf Boots 3', 'NGP DLC Compatibility Armor Mod', inv);
  953. NewGamePlusAdjustDLCItem('NGP Wolf Boots 4', 'NGP DLC Compatibility Armor Mod', inv);
  954.  
  955. NewGamePlusAdjustDLCItem('NGP Wolf Gloves 1', 'NGP DLC Compatibility Armor Mod', inv);
  956. NewGamePlusAdjustDLCItem('NGP Wolf Gloves 2', 'NGP DLC Compatibility Armor Mod', inv);
  957. NewGamePlusAdjustDLCItem('NGP Wolf Gloves 3', 'NGP DLC Compatibility Armor Mod', inv);
  958. NewGamePlusAdjustDLCItem('NGP Wolf Gloves 4', 'NGP DLC Compatibility Armor Mod', inv);
  959.  
  960. NewGamePlusAdjustDLCItem('NGP Wolf Pants 1', 'NGP DLC Compatibility Armor Mod', inv);
  961. NewGamePlusAdjustDLCItem('NGP Wolf Pants 2', 'NGP DLC Compatibility Armor Mod', inv);
  962. NewGamePlusAdjustDLCItem('NGP Wolf Pants 3', 'NGP DLC Compatibility Armor Mod', inv);
  963. NewGamePlusAdjustDLCItem('NGP Wolf Pants 4', 'NGP DLC Compatibility Armor Mod', inv);
  964.  
  965. NewGamePlusAdjustDLCItem('NGP Wolf School steel sword', 'NGP Wolf Steel Sword Mod', inv);
  966. NewGamePlusAdjustDLCItem('NGP Wolf School steel sword 1', 'NGP Wolf Steel Sword Mod', inv);
  967. NewGamePlusAdjustDLCItem('NGP Wolf School steel sword 2', 'NGP Wolf Steel Sword Mod', inv);
  968. NewGamePlusAdjustDLCItem('NGP Wolf School steel sword 3', 'NGP Wolf Steel Sword Mod', inv);
  969.  
  970. NewGamePlusAdjustDLCItem('NGP Wolf School silver sword', 'NGP Wolf Silver Sword Mod', inv);
  971. NewGamePlusAdjustDLCItem('NGP Wolf School silver sword 1', 'NGP Wolf Silver Sword Mod', inv);
  972. NewGamePlusAdjustDLCItem('NGP Wolf School silver sword 2', 'NGP Wolf Silver Sword Mod', inv);
  973. NewGamePlusAdjustDLCItem('NGP Wolf School silver sword 3', 'NGP Wolf Silver Sword Mod', inv);
  974. }
  975.  
  976. private final function NewGamePlusAdjustDLC14SkelligeSet(inv : CInventoryComponent)
  977. {
  978. NewGamePlusAdjustDLCItem('NGP DLC14 Skellige Armor', 'NGP DLC Compatibility Chest Armor Mod', inv);
  979. NewGamePlusAdjustDLCItem('NGP DLC14 Skellige Gloves', 'NGP DLC Compatibility Armor Mod', inv);
  980. NewGamePlusAdjustDLCItem('NGP DLC14 Skellige Pants', 'NGP DLC Compatibility Armor Mod', inv);
  981. NewGamePlusAdjustDLCItem('NGP DLC14 Skellige Boots', 'NGP DLC Compatibility Armor Mod', inv);
  982. }
  983.  
  984. private final function NewGamePlusReplaceViperSet(out inv : CInventoryComponent)
  985. {
  986. NewGamePlusReplaceItem('Viper School steel sword', 'NGP Viper School steel sword', inv);
  987.  
  988. NewGamePlusReplaceItem('Viper School silver sword', 'NGP Viper School silver sword', inv);
  989. }
  990.  
  991. private final function NewGamePlusReplaceLynxSet(out inv : CInventoryComponent)
  992. {
  993. NewGamePlusReplaceItem('Lynx Armor', 'NGP Lynx Armor', inv);
  994. NewGamePlusReplaceItem('Lynx Armor 1', 'NGP Lynx Armor 1', inv);
  995. NewGamePlusReplaceItem('Lynx Armor 2', 'NGP Lynx Armor 2', inv);
  996. NewGamePlusReplaceItem('Lynx Armor 3', 'NGP Lynx Armor 3', inv);
  997.  
  998. NewGamePlusReplaceItem('Lynx Gloves 1', 'NGP Lynx Gloves 1', inv);
  999. NewGamePlusReplaceItem('Lynx Gloves 2', 'NGP Lynx Gloves 2', inv);
  1000. NewGamePlusReplaceItem('Lynx Gloves 3', 'NGP Lynx Gloves 3', inv);
  1001. NewGamePlusReplaceItem('Lynx Gloves 4', 'NGP Lynx Gloves 4', inv);
  1002.  
  1003. NewGamePlusReplaceItem('Lynx Pants 1', 'NGP Lynx Pants 1', inv);
  1004. NewGamePlusReplaceItem('Lynx Pants 2', 'NGP Lynx Pants 2', inv);
  1005. NewGamePlusReplaceItem('Lynx Pants 3', 'NGP Lynx Pants 3', inv);
  1006. NewGamePlusReplaceItem('Lynx Pants 4', 'NGP Lynx Pants 4', inv);
  1007.  
  1008. NewGamePlusReplaceItem('Lynx Boots 1', 'NGP Lynx Boots 1', inv);
  1009. NewGamePlusReplaceItem('Lynx Boots 2', 'NGP Lynx Boots 2', inv);
  1010. NewGamePlusReplaceItem('Lynx Boots 3', 'NGP Lynx Boots 3', inv);
  1011. NewGamePlusReplaceItem('Lynx Boots 4', 'NGP Lynx Boots 4', inv);
  1012.  
  1013. NewGamePlusReplaceItem('Lynx School steel sword', 'NGP Lynx School steel sword', inv);
  1014. NewGamePlusReplaceItem('Lynx School steel sword 1', 'NGP Lynx School steel sword 1', inv);
  1015. NewGamePlusReplaceItem('Lynx School steel sword 2', 'NGP Lynx School steel sword 2', inv);
  1016. NewGamePlusReplaceItem('Lynx School steel sword 3', 'NGP Lynx School steel sword 3', inv);
  1017.  
  1018. NewGamePlusReplaceItem('Lynx School silver sword', 'NGP Lynx School silver sword', inv);
  1019. NewGamePlusReplaceItem('Lynx School silver sword 1', 'NGP Lynx School silver sword 1', inv);
  1020. NewGamePlusReplaceItem('Lynx School silver sword 2', 'NGP Lynx School silver sword 2', inv);
  1021. NewGamePlusReplaceItem('Lynx School silver sword 3', 'NGP Lynx School silver sword 3', inv);
  1022. }
  1023.  
  1024. private final function NewGamePlusReplaceGryphonSet(out inv : CInventoryComponent)
  1025. {
  1026. NewGamePlusReplaceItem('Gryphon Armor', 'NGP Gryphon Armor', inv);
  1027. NewGamePlusReplaceItem('Gryphon Armor 1', 'NGP Gryphon Armor 1', inv);
  1028. NewGamePlusReplaceItem('Gryphon Armor 2', 'NGP Gryphon Armor 2', inv);
  1029. NewGamePlusReplaceItem('Gryphon Armor 3', 'NGP Gryphon Armor 3', inv);
  1030.  
  1031. NewGamePlusReplaceItem('Gryphon Gloves 1', 'NGP Gryphon Gloves 1', inv);
  1032. NewGamePlusReplaceItem('Gryphon Gloves 2', 'NGP Gryphon Gloves 2', inv);
  1033. NewGamePlusReplaceItem('Gryphon Gloves 3', 'NGP Gryphon Gloves 3', inv);
  1034. NewGamePlusReplaceItem('Gryphon Gloves 4', 'NGP Gryphon Gloves 4', inv);
  1035.  
  1036. NewGamePlusReplaceItem('Gryphon Pants 1', 'NGP Gryphon Pants 1', inv);
  1037. NewGamePlusReplaceItem('Gryphon Pants 2', 'NGP Gryphon Pants 2', inv);
  1038. NewGamePlusReplaceItem('Gryphon Pants 3', 'NGP Gryphon Pants 3', inv);
  1039. NewGamePlusReplaceItem('Gryphon Pants 4', 'NGP Gryphon Pants 4', inv);
  1040.  
  1041. NewGamePlusReplaceItem('Gryphon Boots 1', 'NGP Gryphon Boots 1', inv);
  1042. NewGamePlusReplaceItem('Gryphon Boots 2', 'NGP Gryphon Boots 2', inv);
  1043. NewGamePlusReplaceItem('Gryphon Boots 3', 'NGP Gryphon Boots 3', inv);
  1044. NewGamePlusReplaceItem('Gryphon Boots 4', 'NGP Gryphon Boots 4', inv);
  1045.  
  1046. NewGamePlusReplaceItem('Gryphon School steel sword', 'NGP Gryphon School steel sword', inv);
  1047. NewGamePlusReplaceItem('Gryphon School steel sword 1', 'NGP Gryphon School steel sword 1', inv);
  1048. NewGamePlusReplaceItem('Gryphon School steel sword 2', 'NGP Gryphon School steel sword 2', inv);
  1049. NewGamePlusReplaceItem('Gryphon School steel sword 3', 'NGP Gryphon School steel sword 3', inv);
  1050.  
  1051. NewGamePlusReplaceItem('Gryphon School silver sword', 'NGP Gryphon School silver sword', inv);
  1052. NewGamePlusReplaceItem('Gryphon School silver sword 1', 'NGP Gryphon School silver sword 1', inv);
  1053. NewGamePlusReplaceItem('Gryphon School silver sword 2', 'NGP Gryphon School silver sword 2', inv);
  1054. NewGamePlusReplaceItem('Gryphon School silver sword 3', 'NGP Gryphon School silver sword 3', inv);
  1055. }
  1056.  
  1057. private final function NewGamePlusReplaceBearSet(out inv : CInventoryComponent)
  1058. {
  1059. NewGamePlusReplaceItem('Bear Armor', 'NGP Bear Armor', inv);
  1060. NewGamePlusReplaceItem('Bear Armor 1', 'NGP Bear Armor 1', inv);
  1061. NewGamePlusReplaceItem('Bear Armor 2', 'NGP Bear Armor 2', inv);
  1062. NewGamePlusReplaceItem('Bear Armor 3', 'NGP Bear Armor 3', inv);
  1063.  
  1064. NewGamePlusReplaceItem('Bear Gloves 1', 'NGP Bear Gloves 1', inv);
  1065. NewGamePlusReplaceItem('Bear Gloves 2', 'NGP Bear Gloves 2', inv);
  1066. NewGamePlusReplaceItem('Bear Gloves 3', 'NGP Bear Gloves 3', inv);
  1067. NewGamePlusReplaceItem('Bear Gloves 4', 'NGP Bear Gloves 4', inv);
  1068.  
  1069. NewGamePlusReplaceItem('Bear Pants 1', 'NGP Bear Pants 1', inv);
  1070. NewGamePlusReplaceItem('Bear Pants 2', 'NGP Bear Pants 2', inv);
  1071. NewGamePlusReplaceItem('Bear Pants 3', 'NGP Bear Pants 3', inv);
  1072. NewGamePlusReplaceItem('Bear Pants 4', 'NGP Bear Pants 4', inv);
  1073.  
  1074. NewGamePlusReplaceItem('Bear Boots 1', 'NGP Bear Boots 1', inv);
  1075. NewGamePlusReplaceItem('Bear Boots 2', 'NGP Bear Boots 2', inv);
  1076. NewGamePlusReplaceItem('Bear Boots 3', 'NGP Bear Boots 3', inv);
  1077. NewGamePlusReplaceItem('Bear Boots 4', 'NGP Bear Boots 4', inv);
  1078.  
  1079. NewGamePlusReplaceItem('Bear School steel sword', 'NGP Bear School steel sword', inv);
  1080. NewGamePlusReplaceItem('Bear School steel sword 1', 'NGP Bear School steel sword 1', inv);
  1081. NewGamePlusReplaceItem('Bear School steel sword 2', 'NGP Bear School steel sword 2', inv);
  1082. NewGamePlusReplaceItem('Bear School steel sword 3', 'NGP Bear School steel sword 3', inv);
  1083.  
  1084. NewGamePlusReplaceItem('Bear School silver sword', 'NGP Bear School silver sword', inv);
  1085. NewGamePlusReplaceItem('Bear School silver sword 1', 'NGP Bear School silver sword 1', inv);
  1086. NewGamePlusReplaceItem('Bear School silver sword 2', 'NGP Bear School silver sword 2', inv);
  1087. NewGamePlusReplaceItem('Bear School silver sword 3', 'NGP Bear School silver sword 3', inv);
  1088. }
  1089.  
  1090. private final function NewGamePlusReplaceEP1(out inv : CInventoryComponent)
  1091. {
  1092. NewGamePlusReplaceItem('Ofir Armor', 'NGP Ofir Armor', inv);
  1093. NewGamePlusReplaceItem('Ofir Sabre 2', 'NGP Ofir Sabre 2', inv);
  1094.  
  1095. NewGamePlusReplaceItem('Crafted Burning Rose Armor', 'NGP Crafted Burning Rose Armor', inv);
  1096. NewGamePlusReplaceItem('Crafted Burning Rose Gloves', 'NGP Crafted Burning Rose Gloves', inv);
  1097. NewGamePlusReplaceItem('Crafted Burning Rose Sword', 'NGP Crafted Burning Rose Sword', inv);
  1098.  
  1099. NewGamePlusReplaceItem('Crafted Ofir Armor', 'NGP Crafted Ofir Armor', inv);
  1100. NewGamePlusReplaceItem('Crafted Ofir Boots', 'NGP Crafted Ofir Boots', inv);
  1101. NewGamePlusReplaceItem('Crafted Ofir Gloves', 'NGP Crafted Ofir Gloves', inv);
  1102. NewGamePlusReplaceItem('Crafted Ofir Pants', 'NGP Crafted Ofir Pants', inv);
  1103. NewGamePlusReplaceItem('Crafted Ofir Steel Sword', 'NGP Crafted Ofir Steel Sword', inv);
  1104.  
  1105. NewGamePlusReplaceItem('EP1 Crafted Witcher Silver Sword', 'NGP EP1 Crafted Witcher Silver Sword', inv);
  1106. NewGamePlusReplaceItem('Olgierd Sabre', 'NGP Olgierd Sabre', inv);
  1107.  
  1108. NewGamePlusReplaceItem('EP1 Witcher Armor', 'NGP EP1 Witcher Armor', inv);
  1109. NewGamePlusReplaceItem('EP1 Witcher Boots', 'NGP EP1 Witcher Boots', inv);
  1110. NewGamePlusReplaceItem('EP1 Witcher Gloves', 'NGP EP1 Witcher Gloves', inv);
  1111. NewGamePlusReplaceItem('EP1 Witcher Pants', 'NGP EP1 Witcher Pants', inv);
  1112. NewGamePlusReplaceItem('EP1 Viper School steel sword', 'NGP EP1 Viper School steel sword', inv);
  1113. NewGamePlusReplaceItem('EP1 Viper School silver sword', 'NGP EP1 Viper School silver sword', inv);
  1114. }
  1115.  
  1116. public function GetEquippedSword(steel : bool) : SItemUniqueId
  1117. {
  1118. var item : SItemUniqueId;
  1119.  
  1120. if(steel)
  1121. GetItemEquippedOnSlot(EES_SteelSword, item);
  1122. else
  1123. GetItemEquippedOnSlot(EES_SilverSword, item);
  1124.  
  1125. return item;
  1126. }
  1127.  
  1128. timer function BroadcastRain( deltaTime : float, id : int )
  1129. {
  1130. var rainStrength : float = 0;
  1131. rainStrength = GetRainStrength();
  1132. if( rainStrength > 0.5 )
  1133. {
  1134. theGame.GetBehTreeReactionManager().CreateReactionEventIfPossible( thePlayer, 'RainAction', 2.0f , 50.0f, -1.f, -1, true);
  1135. LogReactionSystem( "'RainAction' was sent by Player - single broadcast - distance: 50.0" );
  1136. }
  1137. }
  1138.  
  1139. function InitializeParryType()
  1140. {
  1141. var i, j : int;
  1142.  
  1143. parryTypeTable.Resize( EnumGetMax('EAttackSwingType')+1 );
  1144. for( i = 0; i < EnumGetMax('EAttackSwingType')+1; i += 1 )
  1145. {
  1146. parryTypeTable[i].Resize( EnumGetMax('EAttackSwingDirection')+1 );
  1147. }
  1148. parryTypeTable[AST_Horizontal][ASD_UpDown] = PT_None;
  1149. parryTypeTable[AST_Horizontal][ASD_DownUp] = PT_None;
  1150. parryTypeTable[AST_Horizontal][ASD_LeftRight] = PT_Left;
  1151. parryTypeTable[AST_Horizontal][ASD_RightLeft] = PT_Right;
  1152. parryTypeTable[AST_Vertical][ASD_UpDown] = PT_Up;
  1153. parryTypeTable[AST_Vertical][ASD_DownUp] = PT_Down;
  1154. parryTypeTable[AST_Vertical][ASD_LeftRight] = PT_None;
  1155. parryTypeTable[AST_Vertical][ASD_RightLeft] = PT_None;
  1156. parryTypeTable[AST_DiagonalUp][ASD_UpDown] = PT_None;
  1157. parryTypeTable[AST_DiagonalUp][ASD_DownUp] = PT_None;
  1158. parryTypeTable[AST_DiagonalUp][ASD_LeftRight] = PT_UpLeft;
  1159. parryTypeTable[AST_DiagonalUp][ASD_RightLeft] = PT_RightUp;
  1160. parryTypeTable[AST_DiagonalDown][ASD_UpDown] = PT_None;
  1161. parryTypeTable[AST_DiagonalDown][ASD_DownUp] = PT_None;
  1162. parryTypeTable[AST_DiagonalDown][ASD_LeftRight] = PT_LeftDown;
  1163. parryTypeTable[AST_DiagonalDown][ASD_RightLeft] = PT_DownRight;
  1164. parryTypeTable[AST_Jab][ASD_UpDown] = PT_Jab;
  1165. parryTypeTable[AST_Jab][ASD_DownUp] = PT_Jab;
  1166. parryTypeTable[AST_Jab][ASD_LeftRight] = PT_Jab;
  1167. parryTypeTable[AST_Jab][ASD_RightLeft] = PT_Jab;
  1168. }
  1169.  
  1170.  
  1171.  
  1172.  
  1173.  
  1174.  
  1175. event OnDeath( damageAction : W3DamageAction )
  1176. {
  1177. var items : array< SItemUniqueId >;
  1178. var i, size : int;
  1179. var slot : EEquipmentSlots;
  1180. var holdSlot : name;
  1181.  
  1182. super.OnDeath( damageAction );
  1183.  
  1184. items = GetHeldItems();
  1185.  
  1186. if( rangedWeapon && rangedWeapon.GetCurrentStateName() != 'State_WeaponWait')
  1187. {
  1188. OnRangedForceHolster( true, true, true );
  1189. rangedWeapon.ClearDeployedEntity(true);
  1190. }
  1191.  
  1192. size = items.Size();
  1193.  
  1194. if ( size > 0 )
  1195. {
  1196. for ( i = 0; i < size; i += 1 )
  1197. {
  1198. if ( this.inv.IsIdValid( items[i] ) && !( this.inv.IsItemCrossbow( items[i] ) ) )
  1199. {
  1200. holdSlot = this.inv.GetItemHoldSlot( items[i] );
  1201.  
  1202. if ( holdSlot == 'l_weapon' && this.IsHoldingItemInLHand() )
  1203. {
  1204. this.OnUseSelectedItem( true );
  1205. }
  1206.  
  1207. DropItemFromSlot( holdSlot, false );
  1208.  
  1209. if ( holdSlot == 'r_weapon' )
  1210. {
  1211. slot = this.GetItemSlot( items[i] );
  1212. if ( UnequipItemFromSlot( slot ) )
  1213. Log( "Unequip" );
  1214. }
  1215. }
  1216. }
  1217. }
  1218. }
  1219.  
  1220.  
  1221.  
  1222.  
  1223.  
  1224.  
  1225.  
  1226. function HandleMovement( deltaTime : float )
  1227. {
  1228. super.HandleMovement( deltaTime );
  1229.  
  1230. rawCameraHeading = theCamera.GetCameraHeading();
  1231. }
  1232.  
  1233.  
  1234.  
  1235.  
  1236.  
  1237.  
  1238.  
  1239. function ToggleSpecialAttackHeavyAllowed( toggle : bool)
  1240. {
  1241. specialAttackHeavyAllowed = toggle;
  1242. }
  1243.  
  1244. function GetReputationManager() : W3Reputation
  1245. {
  1246. return reputationManager;
  1247. }
  1248.  
  1249. function OnRadialMenuItemChoose( selectedItem : string )
  1250. {
  1251. var iSlotId : int;
  1252.  
  1253. if ( selectedItem != "Slot3" )
  1254. {
  1255. if ( rangedWeapon && rangedWeapon.GetCurrentStateName() != 'State_WeaponWait' )
  1256. OnRangedForceHolster( true, false );
  1257. }
  1258.  
  1259.  
  1260. switch(selectedItem)
  1261. {
  1262.  
  1263. case "Meditation":
  1264. theGame.RequestMenuWithBackground( 'MeditationClockMenu', 'CommonMenu' );
  1265. break;
  1266. case "Slot1":
  1267. SelectQuickslotItem(EES_Petard1);
  1268. break;
  1269. case "Slot2":
  1270. SelectQuickslotItem(EES_Petard2);
  1271. break;
  1272. case "Slot3":
  1273. SelectQuickslotItem(EES_RangedWeapon);
  1274. break;
  1275. case "Slot4":
  1276. SelectQuickslotItem(EES_Quickslot1);
  1277. break;
  1278. case "Slot5":
  1279. SelectQuickslotItem(EES_Quickslot2);
  1280. break;
  1281. default:
  1282. SetEquippedSign(SignStringToEnum( selectedItem ));
  1283. FactsRemove("SignToggled");
  1284. break;
  1285. }
  1286. }
  1287.  
  1288. function ToggleNextItem()
  1289. {
  1290. var quickSlotItems : array< EEquipmentSlots >;
  1291. var currentSelectedItem : SItemUniqueId;
  1292. var item : SItemUniqueId;
  1293. var i : int;
  1294.  
  1295. for( i = EES_Quickslot2; i > EES_Petard1 - 1; i -= 1 )
  1296. {
  1297. GetItemEquippedOnSlot( i, item );
  1298. if( inv.IsIdValid( item ) )
  1299. {
  1300. quickSlotItems.PushBack( i );
  1301. }
  1302. }
  1303. if( !quickSlotItems.Size() )
  1304. {
  1305. return;
  1306. }
  1307.  
  1308. currentSelectedItem = GetSelectedItemId();
  1309.  
  1310. if( inv.IsIdValid( currentSelectedItem ) )
  1311. {
  1312. for( i = 0; i < quickSlotItems.Size(); i += 1 )
  1313. {
  1314. GetItemEquippedOnSlot( quickSlotItems[i], item );
  1315. if( currentSelectedItem == item )
  1316. {
  1317. if( i == quickSlotItems.Size() - 1 )
  1318. {
  1319. SelectQuickslotItem( quickSlotItems[ 0 ] );
  1320. }
  1321. else
  1322. {
  1323. SelectQuickslotItem( quickSlotItems[ i + 1 ] );
  1324. }
  1325. return;
  1326. }
  1327. }
  1328. }
  1329. else
  1330. {
  1331. SelectQuickslotItem( quickSlotItems[ 0 ] );
  1332. }
  1333. }
  1334.  
  1335.  
  1336. function SetEquippedSign( signType : ESignType )
  1337. {
  1338. if(!IsSignBlocked(signType))
  1339. {
  1340. equippedSign = signType;
  1341. FactsSet("CurrentlySelectedSign", equippedSign);
  1342. }
  1343. }
  1344.  
  1345. function GetEquippedSign() : ESignType
  1346. {
  1347. return equippedSign;
  1348. }
  1349.  
  1350. function GetCurrentlyCastSign() : ESignType
  1351. {
  1352. return currentlyCastSign;
  1353. }
  1354.  
  1355. function SetCurrentlyCastSign( type : ESignType, entity : W3SignEntity )
  1356. {
  1357. currentlyCastSign = type;
  1358.  
  1359. if( type != ST_None )
  1360. {
  1361. signs[currentlyCastSign].entity = entity;
  1362. }
  1363. }
  1364.  
  1365. function GetCurrentSignEntity() : W3SignEntity
  1366. {
  1367. if(currentlyCastSign == ST_None)
  1368. return NULL;
  1369.  
  1370. return signs[currentlyCastSign].entity;
  1371. }
  1372.  
  1373. public function GetSignEntity(type : ESignType) : W3SignEntity
  1374. {
  1375. if(type == ST_None)
  1376. return NULL;
  1377.  
  1378. return signs[type].entity;
  1379. }
  1380.  
  1381. public function GetSignTemplate(type : ESignType) : CEntityTemplate
  1382. {
  1383. if(type == ST_None)
  1384. return NULL;
  1385.  
  1386. return signs[type].template;
  1387. }
  1388.  
  1389. public function IsCurrentSignChanneled() : bool
  1390. {
  1391. if( currentlyCastSign != ST_None && signs[currentlyCastSign].entity)
  1392. return signs[currentlyCastSign].entity.OnCheckChanneling();
  1393.  
  1394. return false;
  1395. }
  1396.  
  1397. function IsCastingSign() : bool
  1398. {
  1399. return currentlyCastSign != ST_None;
  1400. }
  1401.  
  1402.  
  1403. protected function IsInCombatActionCameraRotationEnabled() : bool
  1404. {
  1405. if( IsInCombatAction() && ( GetCombatAction() == EBAT_EMPTY || GetCombatAction() == EBAT_Parry ) )
  1406. {
  1407. return true;
  1408. }
  1409.  
  1410. return !bIsInCombatAction;
  1411. }
  1412.  
  1413. function SetHoldBeforeOpenRadialMenuTime ( time : float )
  1414. {
  1415. _HoldBeforeOpenRadialMenuTime = time;
  1416. }
  1417.  
  1418.  
  1419.  
  1420.  
  1421.  
  1422.  
  1423.  
  1424. public function RepairItem ( rapairKitId : SItemUniqueId, usedOnItem : SItemUniqueId )
  1425. {
  1426. var itemMaxDurablity : float;
  1427. var itemCurrDurablity : float;
  1428. var baseRepairValue : float;
  1429. var reapirValue : float;
  1430. var itemAttribute : SAbilityAttributeValue;
  1431.  
  1432. itemMaxDurablity = inv.GetItemMaxDurability(usedOnItem);
  1433. itemCurrDurablity = inv.GetItemDurability(usedOnItem);
  1434. itemAttribute = inv.GetItemAttributeValue ( rapairKitId, 'repairValue' );
  1435.  
  1436. if ( inv.IsItemAnyArmor ( usedOnItem )|| inv.IsItemWeapon( usedOnItem ) )
  1437. {
  1438.  
  1439. baseRepairValue = itemMaxDurablity * itemAttribute.valueMultiplicative;
  1440. reapirValue = MinF( itemCurrDurablity + baseRepairValue, itemMaxDurablity );
  1441.  
  1442. inv.SetItemDurabilityScript ( usedOnItem, MinF ( reapirValue, itemMaxDurablity ));
  1443. }
  1444.  
  1445. inv.RemoveItem ( rapairKitId, 1 );
  1446.  
  1447. }
  1448. public function HasRepairAbleGearEquiped ( ) : bool
  1449. {
  1450. var curEquipedItem : SItemUniqueId;
  1451.  
  1452. return ( GetItemEquippedOnSlot(EES_Armor, curEquipedItem) || GetItemEquippedOnSlot(EES_Boots, curEquipedItem) || GetItemEquippedOnSlot(EES_Pants, curEquipedItem) || GetItemEquippedOnSlot(EES_Gloves, curEquipedItem)) == true;
  1453. }
  1454. public function HasRepairAbleWaponEquiped () : bool
  1455. {
  1456. var curEquipedItem : SItemUniqueId;
  1457.  
  1458. return ( GetItemEquippedOnSlot(EES_SilverSword, curEquipedItem) || GetItemEquippedOnSlot(EES_SteelSword, curEquipedItem) ) == true;
  1459. }
  1460. public function IsItemRepairAble ( item : SItemUniqueId ) : bool
  1461. {
  1462. return inv.GetItemDurabilityRatio(item) <= 0.99999f;
  1463. }
  1464.  
  1465.  
  1466.  
  1467.  
  1468.  
  1469.  
  1470.  
  1471.  
  1472. public function GetOilAppliedOnSword(steel : bool) : name
  1473. {
  1474. var hasItem : bool;
  1475. var sword : SItemUniqueId;
  1476.  
  1477. if(steel)
  1478. hasItem = GetItemEquippedOnSlot(EES_SteelSword, sword);
  1479. else
  1480. hasItem = GetItemEquippedOnSlot(EES_SilverSword, sword);
  1481.  
  1482. if(!hasItem)
  1483. return '';
  1484.  
  1485. return inv.GetSwordOil(sword);
  1486. }
  1487.  
  1488.  
  1489. public function IsEquippedSwordUpgradedWithOil(steel : bool, optional oilName : name) : bool
  1490. {
  1491. var sword : SItemUniqueId;
  1492. var i, minAbs, maxAbs : int;
  1493. var hasItem : bool;
  1494. var abilities, swordAbilities : array<name>;
  1495. var dm : CDefinitionsManagerAccessor;
  1496. var weights : array<float>;
  1497.  
  1498. if(steel)
  1499. hasItem = GetItemEquippedOnSlot(EES_SteelSword, sword);
  1500. else
  1501. hasItem = GetItemEquippedOnSlot(EES_SilverSword, sword);
  1502.  
  1503. if(hasItem)
  1504. {
  1505. inv.GetItemAbilities(sword, swordAbilities);
  1506. dm = theGame.GetDefinitionsManager();
  1507.  
  1508. if(IsNameValid(oilName))
  1509. {
  1510. dm.GetItemAbilitiesWithWeights(oilName, true, abilities, weights, minAbs, maxAbs);
  1511.  
  1512. for(i=0; i<abilities.Size(); i+=1)
  1513. {
  1514. if(dm.AbilityHasTag(abilities[i], theGame.params.OIL_ABILITY_TAG))
  1515. {
  1516. if(swordAbilities.Contains(abilities[i]))
  1517. {
  1518.  
  1519. return true;
  1520. }
  1521. }
  1522. }
  1523. }
  1524. else
  1525. {
  1526. {
  1527.  
  1528. for(i=0; i<swordAbilities.Size(); i+=1)
  1529. {
  1530. if(dm.AbilityHasTag(swordAbilities[i], theGame.params.OIL_ABILITY_TAG))
  1531. return true;
  1532. }
  1533. }
  1534. }
  1535.  
  1536.  
  1537. return false;
  1538. }
  1539.  
  1540.  
  1541. public function ApplyOil( oilId : SItemUniqueId, usedOnItem : SItemUniqueId )
  1542. {
  1543. var oilAbilities : array<name>;
  1544. var i : int;
  1545. var ammo, ammoBonus : float;
  1546. var dm : CDefinitionsManagerAccessor;
  1547. var swordEquipped, swordHeld, steel : bool;
  1548. var tutStateOil : W3TutorialManagerUIHandlerStateOils;
  1549. var sword : CWitcherSword;
  1550.  
  1551. if(!CanApplyOilOnItem(oilId, usedOnItem))
  1552. return;
  1553.  
  1554. dm = theGame.GetDefinitionsManager();
  1555. inv.GetItemAbilitiesWithTag(oilId, theGame.params.OIL_ABILITY_TAG, oilAbilities);
  1556. swordEquipped = IsItemEquipped(usedOnItem);
  1557. swordHeld = IsItemHeld(usedOnItem);
  1558. steel = inv.IsItemSteelSwordUsableByPlayer(usedOnItem);
  1559.  
  1560.  
  1561. RemoveOilBuff(steel);
  1562. RemoveItemOil(usedOnItem);
  1563.  
  1564.  
  1565. for(i=0; i<oilAbilities.Size(); i+=1)
  1566. {
  1567. inv.AddItemCraftedAbility(usedOnItem, oilAbilities[i]);
  1568.  
  1569.  
  1570. if(swordEquipped)
  1571. {
  1572. AddAbility(oilAbilities[i]);
  1573. }
  1574. }
  1575.  
  1576. if(swordEquipped)
  1577. {
  1578. sword = (CWitcherSword) inv.GetItemEntityUnsafe(usedOnItem);
  1579. sword.ApplyOil( inv );
  1580. }
  1581.  
  1582.  
  1583.  
  1584. ammo = CalculateAttributeValue(inv.GetItemAttributeValue(oilId, 'ammo'));
  1585. if(CanUseSkill(S_Alchemy_s06))
  1586. {
  1587. ammoBonus = CalculateAttributeValue(GetSkillAttributeValue(S_Alchemy_s06, 'ammo_bonus', false, false));
  1588. ammo *= 1 + ammoBonus * GetSkillLevel(S_Alchemy_s06);
  1589. }
  1590. inv.SetItemModifierInt(usedOnItem, 'oil_charges', RoundMath(ammo));
  1591. inv.SetItemModifierInt(usedOnItem, 'oil_max_charges', RoundMath(ammo));
  1592.  
  1593. LogOils("Added oil <<" + inv.GetItemName(oilId) + ">> to <<" + inv.GetItemName(usedOnItem) + ">>");
  1594.  
  1595.  
  1596. SetFailedFundamentalsFirstAchievementCondition(true);
  1597.  
  1598.  
  1599. if(ShouldProcessTutorial('TutorialOilCanEquip3'))
  1600. {
  1601. tutStateOil = (W3TutorialManagerUIHandlerStateOils)theGame.GetTutorialSystem().uiHandler.GetCurrentState();
  1602. if(tutStateOil)
  1603. {
  1604. tutStateOil.OnOilApplied();
  1605. }
  1606. }
  1607.  
  1608. if ( swordHeld )
  1609. {
  1610.  
  1611. AddOilBuff(steel);
  1612. }
  1613.  
  1614. theGame.GetGlobalEventsManager().OnScriptedEvent( SEC_OnOilApplied );
  1615. }
  1616.  
  1617.  
  1618.  
  1619.  
  1620.  
  1621.  
  1622.  
  1623.  
  1624. function ReduceDamage(out damageData : W3DamageAction)
  1625. {
  1626. var actorAttacker : CActor;
  1627. var quen : W3QuenEntity;
  1628. var attackRange : CAIAttackRange;
  1629. var attackerMovementAdjustor : CMovementAdjustor;
  1630. var dist, distToAttacker, actionHeading, attackerHeading : float;
  1631. var attackName : name;
  1632. var useQuenForBleeding : bool;
  1633.  
  1634. super.ReduceDamage(damageData);
  1635.  
  1636.  
  1637.  
  1638. quen = (W3QuenEntity)signs[ST_Quen].entity;
  1639. useQuenForBleeding = false;
  1640. if(quen && !damageData.DealsAnyDamage() && ((W3Effect_Bleeding)damageData.causer) && damageData.GetDamageValue(theGame.params.DAMAGE_NAME_DIRECT) > 0.f)
  1641. useQuenForBleeding = true;
  1642.  
  1643.  
  1644. if(!useQuenForBleeding && !damageData.DealsAnyDamage())
  1645. return;
  1646.  
  1647. actorAttacker = (CActor)damageData.attacker;
  1648.  
  1649.  
  1650. if(actorAttacker && IsCurrentlyDodging() && damageData.CanBeDodged())
  1651. {
  1652.  
  1653.  
  1654. actionHeading = evadeHeading;
  1655. attackerHeading = actorAttacker.GetHeading();
  1656. dist = AngleDistance(actionHeading, attackerHeading);
  1657. distToAttacker = VecDistance(this.GetWorldPosition(),damageData.attacker.GetWorldPosition());
  1658. attackName = actorAttacker.GetLastAttackRangeName();
  1659. attackRange = theGame.GetAttackRangeForEntity( actorAttacker, attackName );
  1660. attackerMovementAdjustor = actorAttacker.GetMovingAgentComponent().GetMovementAdjustor();
  1661. if( ( AbsF(dist) < 150 && attackName != 'stomp' && attackName != 'anchor_special_far' && attackName != 'anchor_far' )
  1662. || ( ( attackName == 'stomp' || attackName == 'anchor_special_far' || attackName == 'anchor_far' )
  1663. && distToAttacker > attackRange.rangeMax * 0.75 ) )
  1664. {
  1665. if ( theGame.CanLog() )
  1666. {
  1667. LogDMHits("W3PlayerWitcher.ReduceDamage: Attack dodged by player - no damage done", damageData);
  1668. }
  1669. damageData.SetAllProcessedDamageAs(0);
  1670. damageData.SetWasDodged();
  1671. }
  1672.  
  1673. else if (!(damageData.IsActionEnvironment() || damageData.IsDoTDamage()) && CanUseSkill(S_Sword_s09))
  1674. {
  1675. damageData.processedDmg.vitalityDamage *= 1 - ( CalculateAttributeValue(GetSkillAttributeValue(S_Sword_s09, 'damage_reduction', false, true)) * GetSkillLevel(S_Sword_s09) );
  1676. if ( theGame.CanLog() )
  1677. {
  1678. LogDMHits("W3PlayerWitcher.ReduceDamage: skill S_Sword_s09 reduced damage while dodging", damageData );
  1679. }
  1680. }
  1681. }
  1682.  
  1683.  
  1684. if(quen && damageData.GetBuffSourceName() != "FallingDamage")
  1685. {
  1686. if ( theGame.CanLog() )
  1687. {
  1688. LogDMHits("W3PlayerWitcher.ReduceDamage: Processing Quen sign damage reduction...", damageData);
  1689. }
  1690. quen.OnTargetHit( damageData );
  1691. }
  1692. }
  1693.  
  1694. timer function UndyingSkillCooldown(dt : float, id : int)
  1695. {
  1696. cannotUseUndyingSkill = false;
  1697. }
  1698.  
  1699. event OnTakeDamage( action : W3DamageAction)
  1700. {
  1701. var currVitality, hpTriggerTreshold : float;
  1702. var healingFactor : float;
  1703. var abilityName : name;
  1704. var abilityCount, maxStack, itemDurability : float;
  1705. var addAbility : bool;
  1706. var min, max : SAbilityAttributeValue;
  1707. var mutagenQuen : W3SignEntity;
  1708. var equipped : array<SItemUniqueId>;
  1709. var i : int;
  1710.  
  1711. currVitality = GetStat(BCS_Vitality);
  1712.  
  1713.  
  1714. if(action.processedDmg.vitalityDamage >= currVitality)
  1715. {
  1716.  
  1717. if(!cannotUseUndyingSkill && FloorF(GetStat(BCS_Focus)) >= 1 && CanUseSkill(S_Sword_s18) && HasBuff(EET_BattleTrance))
  1718. {
  1719. healingFactor = CalculateAttributeValue( GetSkillAttributeValue(S_Sword_s18, 'healing_factor', false, true) );
  1720. healingFactor *= GetStatMax(BCS_Vitality);
  1721. healingFactor *= GetStat(BCS_Focus);
  1722. healingFactor *= 1 + CalculateAttributeValue( GetSkillAttributeValue(S_Sword_s18, 'healing_bonus', false, true) ) * (GetSkillLevel(S_Sword_s18) - 1);
  1723. ForceSetStat(BCS_Vitality, GetStatMax(BCS_Vitality));
  1724. action.processedDmg.vitalityDamage = GetStatMax(BCS_Vitality) - healingFactor;
  1725. DrainFocus(GetStat(BCS_Focus));
  1726. RemoveBuff(EET_BattleTrance);
  1727. cannotUseUndyingSkill = true;
  1728. AddTimer('UndyingSkillCooldown', CalculateAttributeValue( GetSkillAttributeValue(S_Sword_s18, 'trigger_delay', false, true) ), false, , , true);
  1729. }
  1730. else
  1731. {
  1732.  
  1733. equipped = GetEquippedItems();
  1734.  
  1735. for(i=0; i<equipped.Size(); i+=1)
  1736. {
  1737. if ( !inv.IsIdValid( equipped[i] ) )
  1738. {
  1739. continue;
  1740. }
  1741. itemDurability = inv.GetItemDurability(equipped[i]);
  1742. if(inv.ItemHasAbility(equipped[i], 'MA_Reinforced') && itemDurability > 0)
  1743. {
  1744.  
  1745. inv.SetItemDurabilityScript(equipped[i], MaxF(0, itemDurability - action.processedDmg.vitalityDamage) );
  1746.  
  1747.  
  1748. action.processedDmg.vitalityDamage = 0;
  1749. ForceSetStat(BCS_Vitality, 1);
  1750.  
  1751. break;
  1752. }
  1753. }
  1754. }
  1755. }
  1756.  
  1757.  
  1758. if(action.DealsAnyDamage() && !((W3Effect_Toxicity)action.causer) )
  1759. {
  1760. if(HasBuff(EET_Mutagen10))
  1761. RemoveAbilityAll( GetBuff(EET_Mutagen10).GetAbilityName() );
  1762.  
  1763. if(HasBuff(EET_Mutagen15))
  1764. RemoveAbilityAll( GetBuff(EET_Mutagen15).GetAbilityName() );
  1765. }
  1766.  
  1767.  
  1768. if(HasBuff(EET_Mutagen19))
  1769. {
  1770. theGame.GetDefinitionsManager().GetAbilityAttributeValue(GetBuff(EET_Mutagen19).GetAbilityName(), 'max_hp_perc_trigger', min, max);
  1771. hpTriggerTreshold = GetStatMax(BCS_Vitality) * CalculateAttributeValue(GetAttributeRandomizedValue(min, max));
  1772.  
  1773. if(action.GetDamageDealt() >= hpTriggerTreshold)
  1774. {
  1775. mutagenQuen = (W3SignEntity)theGame.CreateEntity( signs[ST_Quen].template, GetWorldPosition(), GetWorldRotation() );
  1776. mutagenQuen.Init( signOwner, signs[ST_Quen].entity, true );
  1777. mutagenQuen.OnStarted();
  1778. mutagenQuen.OnThrowing();
  1779. mutagenQuen.OnEnded();
  1780. }
  1781. }
  1782.  
  1783.  
  1784. if(action.DealsAnyDamage() && !action.IsDoTDamage() && HasBuff(EET_Mutagen27))
  1785. {
  1786. abilityName = GetBuff(EET_Mutagen27).GetAbilityName();
  1787. abilityCount = GetAbilityCount(abilityName);
  1788.  
  1789. if(abilityCount == 0)
  1790. {
  1791. addAbility = true;
  1792. }
  1793. else
  1794. {
  1795. theGame.GetDefinitionsManager().GetAbilityAttributeValue(abilityName, 'mutagen27_max_stack', min, max);
  1796. maxStack = CalculateAttributeValue(GetAttributeRandomizedValue(min, max));
  1797.  
  1798. if(maxStack >= 0)
  1799. {
  1800. addAbility = (abilityCount < maxStack);
  1801. }
  1802. else
  1803. {
  1804. addAbility = true;
  1805. }
  1806. }
  1807.  
  1808. if(addAbility)
  1809. {
  1810. AddAbility(abilityName, true);
  1811. }
  1812. }
  1813.  
  1814. return super.OnTakeDamage(action);
  1815. }
  1816.  
  1817.  
  1818.  
  1819.  
  1820.  
  1821.  
  1822.  
  1823. event OnStartFistfightMinigame()
  1824. {
  1825. super.OnStartFistfightMinigame();
  1826. effectManager.RemoveAllPotionEffects();
  1827. }
  1828.  
  1829. event OnEndFistfightMinigame()
  1830. {
  1831. super.OnEndFistfightMinigame();
  1832. }
  1833.  
  1834.  
  1835. public function GetCriticalHitChance(isHeavyAttack : bool, target : CActor, victimMonsterCategory : EMonsterCategory) : float
  1836. {
  1837. var ret : float;
  1838. var thunder : W3Potion_Thunderbolt;
  1839.  
  1840. ret = super.GetCriticalHitChance(isHeavyAttack, target, victimMonsterCategory);
  1841.  
  1842.  
  1843.  
  1844.  
  1845.  
  1846.  
  1847.  
  1848. thunder = (W3Potion_Thunderbolt)GetBuff(EET_Thunderbolt);
  1849. if(thunder && thunder.GetBuffLevel() == 3 && GetCurWeather() == EWE_Storm)
  1850. {
  1851. ret += 1.0f;
  1852. }
  1853.  
  1854. return ret;
  1855. }
  1856.  
  1857.  
  1858. public function GetCriticalHitDamageBonus(weaponId : SItemUniqueId, victimMonsterCategory : EMonsterCategory, isStrikeAtBack : bool) : SAbilityAttributeValue
  1859. {
  1860. var min, max, bonus, null, oilBonus : SAbilityAttributeValue;
  1861. var mutagen : CBaseGameplayEffect;
  1862. var monsterBonusType : name;
  1863.  
  1864. bonus = super.GetCriticalHitDamageBonus(weaponId, victimMonsterCategory, isStrikeAtBack);
  1865.  
  1866.  
  1867. if(inv.ItemHasOilApplied(weaponId) && GetStat(BCS_Focus) >= 3 && CanUseSkill(S_Alchemy_s07))
  1868. {
  1869. monsterBonusType = MonsterCategoryToAttackPowerBonus( victimMonsterCategory );
  1870. oilBonus = inv.GetItemAttributeValue( weaponId, monsterBonusType );
  1871. if(oilBonus != null)
  1872. {
  1873. bonus += GetSkillAttributeValue(S_Alchemy_s07, theGame.params.CRITICAL_HIT_DAMAGE_BONUS, false, true);
  1874. }
  1875. }
  1876.  
  1877.  
  1878. if (isStrikeAtBack && HasBuff(EET_Mutagen11))
  1879. {
  1880. mutagen = GetBuff(EET_Mutagen11);
  1881. theGame.GetDefinitionsManager().GetAbilityAttributeValue(mutagen.GetAbilityName(), 'damageIncrease', min, max);
  1882. bonus += GetAttributeRandomizedValue(min, max);
  1883. }
  1884.  
  1885. return bonus;
  1886. }
  1887.  
  1888. public function ProcessLockTarget( optional newLockTarget : CActor, optional checkLeftStickHeading : bool ) : bool
  1889. {
  1890. var newLockTargetFound : bool;
  1891.  
  1892. newLockTargetFound = super.ProcessLockTarget(newLockTarget, checkLeftStickHeading);
  1893.  
  1894. if(GetCurrentlyCastSign() == ST_Axii)
  1895. {
  1896. ((W3AxiiEntity)GetCurrentSignEntity()).OnDisplayTargetChange(newLockTarget);
  1897. }
  1898.  
  1899. return newLockTargetFound;
  1900. }
  1901.  
  1902.  
  1903.  
  1904.  
  1905.  
  1906.  
  1907.  
  1908. event OnPocessActionPost(action : W3DamageAction)
  1909. {
  1910. var attackAction : W3Action_Attack;
  1911. var rendLoad : float;
  1912. var value : SAbilityAttributeValue;
  1913. var actorVictim : CActor;
  1914. var weaponId : SItemUniqueId;
  1915. var usesSteel, usesSilver, usesVitality, usesEssence : bool;
  1916. var abs : array<name>;
  1917. var i : int;
  1918. var dm : CDefinitionsManagerAccessor;
  1919. var items : array<SItemUniqueId>;
  1920. var weaponEnt : CEntity;
  1921.  
  1922. super.OnPocessActionPost(action);
  1923.  
  1924. attackAction = (W3Action_Attack)action;
  1925. actorVictim = (CActor)action.victim;
  1926. if(attackAction)
  1927. {
  1928. if(attackAction.IsActionMelee())
  1929. {
  1930.  
  1931. if(SkillNameToEnum(attackAction.GetAttackTypeName()) == S_Sword_s02)
  1932. {
  1933. rendLoad = GetSpecialAttackTimeRatio();
  1934.  
  1935.  
  1936. rendLoad = MinF(rendLoad * GetStatMax(BCS_Focus), GetStat(BCS_Focus));
  1937.  
  1938.  
  1939. rendLoad = FloorF(rendLoad);
  1940. DrainFocus(rendLoad);
  1941.  
  1942. OnSpecialAttackHeavyActionProcess();
  1943. }
  1944. else if(actorVictim && IsRequiredAttitudeBetween(this, actorVictim, true))
  1945. {
  1946.  
  1947.  
  1948. value = GetAttributeValue('focus_gain');
  1949.  
  1950. if( FactsQuerySum("debug_fact_focus_boy") > 0 )
  1951. {
  1952. Debug_FocusBoyFocusGain();
  1953. }
  1954.  
  1955.  
  1956. if ( CanUseSkill(S_Sword_s20) )
  1957. {
  1958. value += GetSkillAttributeValue(S_Sword_s20, 'focus_gain', false, true) * GetSkillLevel(S_Sword_s20);
  1959. }
  1960.  
  1961. GainStat(BCS_Focus, 0.1f * (1 + CalculateAttributeValue(value)) );
  1962. }
  1963.  
  1964.  
  1965. weaponId = attackAction.GetWeaponId();
  1966. if(actorVictim && (ShouldProcessTutorial('TutorialWrongSwordSteel') || ShouldProcessTutorial('TutorialWrongSwordSilver')) && GetAttitudeBetween(actorVictim, this) == AIA_Hostile)
  1967. {
  1968. usesSteel = inv.IsItemSteelSwordUsableByPlayer(weaponId);
  1969. usesSilver = inv.IsItemSilverSwordUsableByPlayer(weaponId);
  1970. usesVitality = actorVictim.UsesVitality();
  1971. usesEssence = actorVictim.UsesEssence();
  1972.  
  1973. if(usesSilver && usesVitality)
  1974. {
  1975. FactsAdd('tut_wrong_sword_silver',1);
  1976. }
  1977. else if(usesSteel && usesEssence)
  1978. {
  1979. FactsAdd('tut_wrong_sword_steel',1);
  1980. }
  1981. else if(FactsQuerySum('tut_wrong_sword_steel') && usesSilver && usesEssence)
  1982. {
  1983. FactsAdd('tut_proper_sword_silver',1);
  1984. FactsRemove('tut_wrong_sword_steel');
  1985. }
  1986. else if(FactsQuerySum('tut_wrong_sword_silver') && usesSteel && usesVitality)
  1987. {
  1988. FactsAdd('tut_proper_sword_steel',1);
  1989. FactsRemove('tut_wrong_sword_silver');
  1990. }
  1991. }
  1992.  
  1993.  
  1994. if(!action.WasDodged() && HasAbility('Runeword 1 _Stats', true))
  1995. {
  1996. if(runewordInfusionType == ST_Axii)
  1997. {
  1998. actorVictim.SoundEvent('sign_axii_release');
  1999. }
  2000. else if(runewordInfusionType == ST_Igni)
  2001. {
  2002. actorVictim.SoundEvent('sign_igni_charge_begin');
  2003. }
  2004. else if(runewordInfusionType == ST_Quen)
  2005. {
  2006. value = GetAttributeValue('runeword1_quen_heal');
  2007. Heal( action.GetDamageDealt() * value.valueMultiplicative );
  2008. PlayEffectSingle('drain_energy_caretaker_shovel');
  2009. }
  2010. else if(runewordInfusionType == ST_Yrden)
  2011. {
  2012. actorVictim.SoundEvent('sign_yrden_shock_activate');
  2013. }
  2014. runewordInfusionType = ST_None;
  2015.  
  2016.  
  2017. items = inv.GetHeldWeapons();
  2018. weaponEnt = inv.GetItemEntityUnsafe(items[0]);
  2019. weaponEnt.StopEffect('runeword_aard');
  2020. weaponEnt.StopEffect('runeword_axii');
  2021. weaponEnt.StopEffect('runeword_igni');
  2022. weaponEnt.StopEffect('runeword_quen');
  2023. weaponEnt.StopEffect('runeword_yrden');
  2024. }
  2025.  
  2026.  
  2027. if(ShouldProcessTutorial('TutorialLightAttacks') || ShouldProcessTutorial('TutorialHeavyAttacks'))
  2028. {
  2029. if(IsLightAttack(attackAction.GetAttackName()))
  2030. {
  2031. theGame.GetTutorialSystem().IncreaseGeraltsLightAttacksCount(action.victim.GetTags());
  2032. }
  2033. else if(IsHeavyAttack(attackAction.GetAttackName()))
  2034. {
  2035. theGame.GetTutorialSystem().IncreaseGeraltsHeavyAttacksCount(action.victim.GetTags());
  2036. }
  2037. }
  2038. }
  2039. else if(attackAction.IsActionRanged())
  2040. {
  2041.  
  2042. if(CanUseSkill(S_Sword_s15))
  2043. {
  2044. value = GetSkillAttributeValue(S_Sword_s15, 'focus_gain', false, true) * GetSkillLevel(S_Sword_s15) ;
  2045. GainStat(BCS_Focus, CalculateAttributeValue(value) );
  2046. }
  2047.  
  2048.  
  2049. if(CanUseSkill(S_Sword_s12) && attackAction.IsCriticalHit() && actorVictim)
  2050. {
  2051.  
  2052. abs = actorVictim.GetAbilities(false);
  2053. dm = theGame.GetDefinitionsManager();
  2054. for(i=abs.Size()-1; i>=0; i-=1)
  2055. {
  2056. if(!dm.AbilityHasTag(abs[i], theGame.params.TAG_MONSTER_SKILL) || actorVictim.IsAbilityBlocked(abs[i]))
  2057. {
  2058. abs.EraseFast(i);
  2059. }
  2060. }
  2061.  
  2062.  
  2063. if(abs.Size() > 0)
  2064. {
  2065. value = GetSkillAttributeValue(S_Sword_s12, 'duration', true, true) * GetSkillLevel(S_Sword_s12);
  2066. actorVictim.BlockAbility(abs[ RandRange(abs.Size()) ], true, CalculateAttributeValue(value));
  2067. }
  2068. }
  2069. }
  2070. }
  2071.  
  2072.  
  2073. if(CanUseSkill(S_Perk_18) && ((W3Petard)action.causer) && action.DealsAnyDamage() && !action.IsDoTDamage())
  2074. {
  2075. value = GetSkillAttributeValue(S_Perk_18, 'focus_gain', false, true);
  2076. GainStat(BCS_Focus, CalculateAttributeValue(value));
  2077. }
  2078. }
  2079.  
  2080.  
  2081. timer function Mutagen14Timer(dt : float, id : int)
  2082. {
  2083. var abilityName : name;
  2084. var abilityCount, maxStack : float;
  2085. var min, max : SAbilityAttributeValue;
  2086. var addAbility : bool;
  2087.  
  2088. abilityName = GetBuff(EET_Mutagen14).GetAbilityName();
  2089. abilityCount = GetAbilityCount(abilityName);
  2090.  
  2091. if(abilityCount == 0)
  2092. {
  2093. addAbility = true;
  2094. }
  2095. else
  2096. {
  2097. theGame.GetDefinitionsManager().GetAbilityAttributeValue(abilityName, 'mutagen14_max_stack', min, max);
  2098. maxStack = CalculateAttributeValue(GetAttributeRandomizedValue(min, max));
  2099.  
  2100. if(maxStack >= 0)
  2101. {
  2102. addAbility = (abilityCount < maxStack);
  2103. }
  2104. else
  2105. {
  2106. addAbility = true;
  2107. }
  2108. }
  2109.  
  2110. if(addAbility)
  2111. {
  2112. AddAbility(abilityName, true);
  2113. }
  2114. else
  2115. {
  2116.  
  2117. RemoveTimer('Mutagen14Timer');
  2118. }
  2119. }
  2120.  
  2121. public final function FailFundamentalsFirstAchievementCondition()
  2122. {
  2123. SetFailedFundamentalsFirstAchievementCondition(true);
  2124. }
  2125.  
  2126. public final function SetUsedQuenInCombat()
  2127. {
  2128. usedQuenInCombat = true;
  2129. }
  2130.  
  2131. public final function UsedQuenInCombat() : bool
  2132. {
  2133. return usedQuenInCombat;
  2134. }
  2135.  
  2136. event OnCombatStart()
  2137. {
  2138. var quenEntity, glyphQuen : W3QuenEntity;
  2139. var focus, stamina : float;
  2140.  
  2141. super.OnCombatStart();
  2142.  
  2143. if ( IsInCombatActionFriendly() )
  2144. {
  2145. SetBIsCombatActionAllowed(true);
  2146. SetBIsInputAllowed(true, 'OnCombatActionStart' );
  2147. }
  2148.  
  2149.  
  2150. if(HasBuff(EET_Mutagen14))
  2151. {
  2152. AddTimer('Mutagen14Timer', 2, true);
  2153. }
  2154.  
  2155.  
  2156. if(HasBuff(EET_Mutagen15))
  2157. {
  2158. AddAbility(GetBuff(EET_Mutagen15).GetAbilityName(), false);
  2159. }
  2160.  
  2161.  
  2162. quenEntity = (W3QuenEntity)signs[ST_Quen].entity;
  2163.  
  2164.  
  2165. if(quenEntity)
  2166. {
  2167. usedQuenInCombat = quenEntity.IsAnyQuenActive();
  2168. }
  2169. else
  2170. {
  2171. usedQuenInCombat = false;
  2172. }
  2173.  
  2174. if(usedQuenInCombat || HasPotionBuff() || IsEquippedSwordUpgradedWithOil(true) || IsEquippedSwordUpgradedWithOil(false))
  2175. {
  2176. SetFailedFundamentalsFirstAchievementCondition(true);
  2177. }
  2178. else
  2179. {
  2180. if(IsAnyItemEquippedOnSlot(EES_PotionMutagen1) || IsAnyItemEquippedOnSlot(EES_PotionMutagen2) || IsAnyItemEquippedOnSlot(EES_PotionMutagen3) || IsAnyItemEquippedOnSlot(EES_PotionMutagen4))
  2181. SetFailedFundamentalsFirstAchievementCondition(true);
  2182. else
  2183. SetFailedFundamentalsFirstAchievementCondition(false);
  2184. }
  2185.  
  2186. if(CanUseSkill(S_Sword_s20) && IsThreatened())
  2187. {
  2188. focus = GetStat(BCS_Focus);
  2189. if(focus < 1)
  2190. {
  2191. GainStat(BCS_Focus, 1 - focus);
  2192. }
  2193. }
  2194.  
  2195. if ( HasAbility('Glyphword 17 _Stats', true) && RandF() < CalculateAttributeValue(GetAttributeValue('quen_apply_chance')) )
  2196. {
  2197. stamina = GetStat(BCS_Stamina);
  2198. glyphQuen = (W3QuenEntity)theGame.CreateEntity( signs[ST_Quen].template, GetWorldPosition(), GetWorldRotation() );
  2199. glyphQuen.Init( signOwner, signs[ST_Quen].entity, true );
  2200. glyphQuen.OnStarted();
  2201. glyphQuen.OnThrowing();
  2202. glyphQuen.OnEnded();
  2203. ForceSetStat(BCS_Stamina, stamina);
  2204. }
  2205.  
  2206.  
  2207. MeditationForceAbort(true);
  2208. }
  2209.  
  2210.  
  2211. event OnCombatFinished()
  2212. {
  2213. var mut17 : W3Mutagen17_Effect;
  2214.  
  2215. super.OnCombatFinished();
  2216.  
  2217.  
  2218. if(HasBuff(EET_Mutagen10))
  2219. {
  2220. RemoveAbilityAll( GetBuff(EET_Mutagen10).GetAbilityName() );
  2221. }
  2222.  
  2223.  
  2224. if(HasBuff(EET_Mutagen14))
  2225. {
  2226. RemoveAbilityAll( GetBuff(EET_Mutagen14).GetAbilityName() );
  2227. }
  2228.  
  2229.  
  2230. if(HasBuff(EET_Mutagen15))
  2231. {
  2232. RemoveAbilityAll( GetBuff(EET_Mutagen15).GetAbilityName() );
  2233. }
  2234.  
  2235.  
  2236. if(HasBuff(EET_Mutagen17))
  2237. {
  2238. mut17 = (W3Mutagen17_Effect)GetBuff(EET_Mutagen17);
  2239. mut17.ClearBoost();
  2240. }
  2241.  
  2242.  
  2243. if(HasBuff(EET_Mutagen18))
  2244. {
  2245. RemoveAbilityAll( GetBuff(EET_Mutagen18).GetAbilityName() );
  2246. }
  2247.  
  2248.  
  2249. if(HasBuff(EET_Mutagen22))
  2250. {
  2251. RemoveAbilityAll( GetBuff(EET_Mutagen22).GetAbilityName() );
  2252. }
  2253.  
  2254.  
  2255. if(HasBuff(EET_Mutagen27))
  2256. {
  2257. RemoveAbilityAll( GetBuff(EET_Mutagen27).GetAbilityName() );
  2258. }
  2259.  
  2260.  
  2261. if(GetStat(BCS_Focus) > 0)
  2262. {
  2263. AddTimer('DelayedAdrenalineDrain', theGame.params.ADRENALINE_DRAIN_AFTER_COMBAT_DELAY, , , , true);
  2264. }
  2265.  
  2266.  
  2267. thePlayer.abilityManager.ResetOverhealBonus();
  2268.  
  2269. usedQuenInCombat = false;
  2270.  
  2271. theGame.GetGamerProfile().ResetStat(ES_FinesseKills);
  2272.  
  2273. LogChannel( 'OnCombatFinished', "OnCombatFinished: DelayedSheathSword timer added" );
  2274. if ( ShouldAutoSheathSwordInstantly() )
  2275. AddTimer( 'DelayedSheathSword', 0.5f );
  2276. else
  2277. AddTimer( 'DelayedSheathSword', 2.f );
  2278.  
  2279. OnBlockAllCombatTickets( false );
  2280.  
  2281.  
  2282. runewordInfusionType = ST_None;
  2283.  
  2284.  
  2285. }
  2286.  
  2287. timer function DelayedAdrenalineDrain(dt : float, id : int)
  2288. {
  2289. if ( !HasBuff(EET_Runeword8) )
  2290. AddEffectDefault(EET_AdrenalineDrain, this, "after_combat_adrenaline_drain");
  2291. }
  2292.  
  2293.  
  2294. protected function Attack( hitTarget : CGameplayEntity, animData : CPreAttackEventData, weaponId : SItemUniqueId, parried : bool, countered : bool, parriedBy : array<CActor>, attackAnimationName : name, hitTime : float, weaponEntity : CItemEntity)
  2295. {
  2296. var mutagen17 : W3Mutagen17_Effect;
  2297.  
  2298. super.Attack(hitTarget, animData, weaponId, parried, countered, parriedBy, attackAnimationName, hitTime, weaponEntity);
  2299.  
  2300. if( (CActor)hitTarget && HasBuff(EET_Mutagen17) )
  2301. {
  2302. mutagen17 = (W3Mutagen17_Effect)GetBuff(EET_Mutagen17);
  2303. if(mutagen17.HasBoost())
  2304. {
  2305. mutagen17.ClearBoost();
  2306. }
  2307. }
  2308. }
  2309.  
  2310. public final timer function SpecialAttackLightSustainCost(dt : float, id : int)
  2311. {
  2312. var focusPerSec, cost, delay : float;
  2313. var reduction : SAbilityAttributeValue;
  2314. var skillLevel : int;
  2315.  
  2316. if(abilityManager && abilityManager.IsInitialized() && IsAlive())
  2317. {
  2318. PauseStaminaRegen('WhirlSkill');
  2319.  
  2320. if(GetStat(BCS_Stamina) > 0)
  2321. {
  2322. cost = GetStaminaActionCost(ESAT_Ability, GetSkillAbilityName(S_Sword_s01), dt);
  2323. delay = GetStaminaActionDelay(ESAT_Ability, GetSkillAbilityName(S_Sword_s01), dt);
  2324. skillLevel = GetSkillLevel(S_Sword_s01);
  2325.  
  2326. if(skillLevel > 1)
  2327. {
  2328. reduction = GetSkillAttributeValue(S_Sword_s01, 'cost_reduction', false, true) * (skillLevel - 1);
  2329. cost = MaxF(0, cost * (1 - reduction.valueMultiplicative) - reduction.valueAdditive);
  2330. }
  2331.  
  2332. DrainStamina(ESAT_FixedValue, cost, delay, GetSkillAbilityName(S_Sword_s01));
  2333. }
  2334. else
  2335. {
  2336. GetSkillAttributeValue(S_Sword_s01, 'focus_cost_per_sec', false, true);
  2337. focusPerSec = GetWhirlFocusCostPerSec();
  2338. DrainFocus(focusPerSec * dt);
  2339. }
  2340. }
  2341.  
  2342. if(GetStat(BCS_Stamina) <= 0 && GetStat(BCS_Focus) <= 0)
  2343. {
  2344. OnPerformSpecialAttack(true, false);
  2345. }
  2346. }
  2347.  
  2348. public final function GetWhirlFocusCostPerSec() : float
  2349. {
  2350. var ability : SAbilityAttributeValue;
  2351. var val : float;
  2352. var skillLevel : int;
  2353.  
  2354. ability = GetSkillAttributeValue(S_Sword_s01, 'focus_cost_per_sec_initial', false, false);
  2355. skillLevel = GetSkillLevel(S_Sword_s01);
  2356.  
  2357. if(skillLevel > 1)
  2358. ability -= GetSkillAttributeValue(S_Sword_s01, 'cost_reduction', false, false) * (skillLevel-1);
  2359.  
  2360. val = CalculateAttributeValue(ability);
  2361.  
  2362. return val;
  2363. }
  2364.  
  2365. public final timer function SpecialAttackHeavySustainCost(dt : float, id : int)
  2366. {
  2367. var focusHighlight, ratio : float;
  2368. var hud : CR4ScriptedHud;
  2369. var hudWolfHeadModule : CR4HudModuleWolfHead;
  2370.  
  2371.  
  2372. DrainStamina(ESAT_Ability, 0, 0, GetSkillAbilityName(S_Sword_s02), dt);
  2373.  
  2374.  
  2375. if(GetStat(BCS_Stamina) <= 0)
  2376. OnPerformSpecialAttack(false, false);
  2377.  
  2378.  
  2379. ratio = EngineTimeToFloat(theGame.GetEngineTime() - specialHeavyStartEngineTime) / specialHeavyChargeDuration;
  2380.  
  2381.  
  2382. if(ratio > 0.95)
  2383. ratio = 1;
  2384.  
  2385. SetSpecialAttackTimeRatio(ratio);
  2386.  
  2387.  
  2388. focusHighlight = ratio * GetStatMax(BCS_Focus);
  2389. focusHighlight = MinF(focusHighlight, GetStat(BCS_Focus));
  2390. focusHighlight = FloorF(focusHighlight);
  2391.  
  2392. hud = (CR4ScriptedHud)theGame.GetHud();
  2393. if ( hud )
  2394. {
  2395. hudWolfHeadModule = (CR4HudModuleWolfHead)hud.GetHudModule( "WolfHeadModule" );
  2396. if ( hudWolfHeadModule )
  2397. {
  2398. hudWolfHeadModule.LockFocusPoints((int)focusHighlight);
  2399. }
  2400. }
  2401. }
  2402.  
  2403. public function OnSpecialAttackHeavyActionProcess()
  2404. {
  2405. var hud : CR4ScriptedHud;
  2406. var hudWolfHeadModule : CR4HudModuleWolfHead;
  2407.  
  2408. super.OnSpecialAttackHeavyActionProcess();
  2409.  
  2410. hud = (CR4ScriptedHud)theGame.GetHud();
  2411. if ( hud )
  2412. {
  2413. hudWolfHeadModule = (CR4HudModuleWolfHead)hud.GetHudModule( "WolfHeadModule" );
  2414. if ( hudWolfHeadModule )
  2415. {
  2416. hudWolfHeadModule.ResetFocusPoints();
  2417. }
  2418. }
  2419. }
  2420.  
  2421. timer function IsSpecialLightAttackInputHeld ( time : float, id : int )
  2422. {
  2423. var hasResource : bool;
  2424.  
  2425. if ( GetCurrentStateName() == 'CombatSteel' || GetCurrentStateName() == 'CombatSilver' )
  2426. {
  2427. if ( GetBIsCombatActionAllowed() && inputHandler.IsActionAllowed(EIAB_SwordAttack))
  2428. {
  2429. if(GetStat(BCS_Stamina) > 0)
  2430. {
  2431. hasResource = true;
  2432. }
  2433. else
  2434. {
  2435. hasResource = (GetStat(BCS_Focus) >= GetWhirlFocusCostPerSec() * time);
  2436. }
  2437.  
  2438. if(hasResource)
  2439. {
  2440. SetupCombatAction( EBAT_SpecialAttack_Light, BS_Pressed );
  2441. RemoveTimer('IsSpecialLightAttackInputHeld');
  2442. }
  2443. else if(!playedSpecialAttackMissingResourceSound)
  2444. {
  2445. IndicateTooLowAdrenaline();
  2446. playedSpecialAttackMissingResourceSound = true;
  2447. }
  2448. }
  2449. }
  2450. else
  2451. {
  2452. RemoveTimer('IsSpecialLightAttackInputHeld');
  2453. }
  2454. }
  2455.  
  2456. timer function IsSpecialHeavyAttackInputHeld ( time : float, id : int )
  2457. {
  2458. var cost : float;
  2459.  
  2460. if ( GetCurrentStateName() == 'CombatSteel' || GetCurrentStateName() == 'CombatSilver' )
  2461. {
  2462. cost = CalculateAttributeValue(GetSkillAttributeValue(S_Sword_s02, 'stamina_cost_per_sec', false, false));
  2463.  
  2464. if( GetBIsCombatActionAllowed() && inputHandler.IsActionAllowed(EIAB_SwordAttack))
  2465. {
  2466. if(GetStat(BCS_Stamina) >= cost)
  2467. {
  2468. SetupCombatAction( EBAT_SpecialAttack_Heavy, BS_Pressed );
  2469. RemoveTimer('IsSpecialHeavyAttackInputHeld');
  2470. }
  2471. else if(!playedSpecialAttackMissingResourceSound)
  2472. {
  2473. IndicateTooLowAdrenaline();
  2474. playedSpecialAttackMissingResourceSound = true;
  2475. }
  2476. }
  2477. }
  2478. else
  2479. {
  2480. RemoveTimer('IsSpecialHeavyAttackInputHeld');
  2481. }
  2482. }
  2483.  
  2484. public function EvadePressed( bufferAction : EBufferActionType )
  2485. {
  2486. var cat : float;
  2487.  
  2488. if( (bufferAction == EBAT_Dodge && IsActionAllowed(EIAB_Dodge)) || (bufferAction == EBAT_Roll && IsActionAllowed(EIAB_Roll)) )
  2489. {
  2490.  
  2491. if(bufferAction != EBAT_Roll && ShouldProcessTutorial('TutorialDodge'))
  2492. {
  2493. FactsAdd("tut_in_dodge", 1, 2);
  2494.  
  2495. if(FactsQuerySum("tut_fight_use_slomo") > 0)
  2496. {
  2497. theGame.RemoveTimeScale( theGame.GetTimescaleSource(ETS_TutorialFight) );
  2498. FactsRemove("tut_fight_slomo_ON");
  2499. }
  2500. }
  2501. else if(bufferAction == EBAT_Roll && ShouldProcessTutorial('TutorialRoll'))
  2502. {
  2503. FactsAdd("tut_in_roll", 1, 2);
  2504.  
  2505. if(FactsQuerySum("tut_fight_use_slomo") > 0)
  2506. {
  2507. theGame.RemoveTimeScale( theGame.GetTimescaleSource(ETS_TutorialFight) );
  2508. FactsRemove("tut_fight_slomo_ON");
  2509. }
  2510. }
  2511.  
  2512. if ( GetBIsInputAllowed() )
  2513. {
  2514. if ( GetBIsCombatActionAllowed() )
  2515. {
  2516. CriticalEffectAnimationInterrupted("Dodge 2");
  2517. PushCombatActionOnBuffer( bufferAction, BS_Released );
  2518. ProcessCombatActionBuffer();
  2519. }
  2520. else if ( IsInCombatAction() && GetBehaviorVariable( 'combatActionType' ) == (int)CAT_Attack )
  2521. {
  2522. if ( CanPlayHitAnim() && IsThreatened() )
  2523. {
  2524. CriticalEffectAnimationInterrupted("Dodge 1");
  2525. PushCombatActionOnBuffer( bufferAction, BS_Released );
  2526. ProcessCombatActionBuffer();
  2527. }
  2528. else
  2529. PushCombatActionOnBuffer( bufferAction, BS_Released );
  2530. }
  2531.  
  2532. else if ( !( IsCurrentSignChanneled() ) )
  2533. {
  2534.  
  2535. PushCombatActionOnBuffer( bufferAction, BS_Released );
  2536. }
  2537. }
  2538. else
  2539. {
  2540. if ( IsInCombatAction() && GetBehaviorVariable( 'combatActionType' ) == (int)CAT_Attack )
  2541. {
  2542. if ( CanPlayHitAnim() && IsThreatened() )
  2543. {
  2544. CriticalEffectAnimationInterrupted("Dodge 3");
  2545. PushCombatActionOnBuffer( bufferAction, BS_Released );
  2546. ProcessCombatActionBuffer();
  2547. }
  2548. else
  2549. PushCombatActionOnBuffer( bufferAction, BS_Released );
  2550. }
  2551. LogChannel( 'InputNotAllowed', "InputNotAllowed" );
  2552. }
  2553. }
  2554. else
  2555. {
  2556. DisplayActionDisallowedHudMessage(EIAB_Dodge);
  2557. }
  2558. }
  2559.  
  2560.  
  2561. public function ProcessCombatActionBuffer() : bool
  2562. {
  2563. var action : EBufferActionType = this.BufferCombatAction;
  2564. var stage : EButtonStage = this.BufferButtonStage;
  2565. var throwStage : EThrowStage;
  2566. var actionResult : bool = true;
  2567.  
  2568.  
  2569. if( isInFinisher )
  2570. {
  2571. return false;
  2572. }
  2573.  
  2574. if ( action != EBAT_SpecialAttack_Heavy )
  2575. specialAttackCamera = false;
  2576.  
  2577.  
  2578. if(super.ProcessCombatActionBuffer())
  2579. return true;
  2580.  
  2581. switch ( action )
  2582. {
  2583. case EBAT_CastSign :
  2584. {
  2585. switch ( stage )
  2586. {
  2587. case BS_Pressed :
  2588. {
  2589.  
  2590.  
  2591.  
  2592.  
  2593.  
  2594.  
  2595. actionResult = this.CastSign();
  2596. LogChannel('SignDebug', "CastSign()");
  2597.  
  2598.  
  2599. } break;
  2600.  
  2601. default :
  2602. {
  2603. actionResult = false;
  2604. } break;
  2605. }
  2606. } break;
  2607.  
  2608. case EBAT_SpecialAttack_Light :
  2609. {
  2610. switch ( stage )
  2611. {
  2612. case BS_Pressed :
  2613. {
  2614.  
  2615. actionResult = this.OnPerformSpecialAttack( true, true );
  2616. } break;
  2617.  
  2618. case BS_Released :
  2619. {
  2620. actionResult = this.OnPerformSpecialAttack( true, false );
  2621. } break;
  2622.  
  2623. default :
  2624. {
  2625. actionResult = false;
  2626. } break;
  2627. }
  2628. } break;
  2629.  
  2630. case EBAT_SpecialAttack_Heavy :
  2631. {
  2632. switch ( stage )
  2633. {
  2634. case BS_Pressed :
  2635. {
  2636.  
  2637. actionResult = this.OnPerformSpecialAttack( false, true );
  2638. } break;
  2639.  
  2640. case BS_Released :
  2641. {
  2642. actionResult = this.OnPerformSpecialAttack( false, false );
  2643. } break;
  2644.  
  2645. default :
  2646. {
  2647. actionResult = false;
  2648. } break;
  2649. }
  2650. } break;
  2651.  
  2652. default:
  2653. return false;
  2654. }
  2655.  
  2656.  
  2657. this.CleanCombatActionBuffer();
  2658.  
  2659. if (actionResult)
  2660. {
  2661. SetCombatAction( action ) ;
  2662. }
  2663.  
  2664. return true;
  2665. }
  2666.  
  2667.  
  2668. event OnPerformSpecialAttack( isLightAttack : bool, enableAttack : bool ){}
  2669.  
  2670. event OnPlayerTickTimer( deltaTime : float )
  2671. {
  2672. super.OnPlayerTickTimer( deltaTime );
  2673.  
  2674. if ( !IsInCombat() )
  2675. {
  2676. fastAttackCounter = 0;
  2677. heavyAttackCounter = 0;
  2678. }
  2679. }
  2680.  
  2681.  
  2682.  
  2683.  
  2684.  
  2685. 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
  2686. {
  2687. var ret : bool;
  2688. var skill : ESkill;
  2689.  
  2690. ret = super.PrepareAttackAction(hitTarget, animData, weaponId, parried, countered, parriedBy, attackAnimationName, hitTime, weaponEntity, attackAction);
  2691.  
  2692. if(!ret)
  2693. return false;
  2694.  
  2695.  
  2696. if(attackAction.IsActionMelee())
  2697. {
  2698. skill = SkillNameToEnum( attackAction.GetAttackTypeName() );
  2699. if( skill != S_SUndefined && CanUseSkill(skill))
  2700. {
  2701. if(IsLightAttack(animData.attackName))
  2702. fastAttackCounter += 1;
  2703. else
  2704. fastAttackCounter = 0;
  2705.  
  2706. if(IsHeavyAttack(animData.attackName))
  2707. heavyAttackCounter += 1;
  2708. else
  2709. heavyAttackCounter = 0;
  2710. }
  2711. }
  2712.  
  2713. AddTimer('FastAttackCounterDecay',5.0);
  2714. AddTimer('HeavyAttackCounterDecay',5.0);
  2715.  
  2716. return true;
  2717. }
  2718.  
  2719. protected function TestParryAndCounter(data : CPreAttackEventData, weaponId : SItemUniqueId, out parried : bool, out countered : bool) : array<CActor>
  2720. {
  2721.  
  2722. if(SkillNameToEnum(attackActionName) == S_Sword_s02)
  2723. data.Can_Parry_Attack = false;
  2724.  
  2725. return super.TestParryAndCounter(data, weaponId, parried, countered);
  2726. }
  2727.  
  2728. private timer function FastAttackCounterDecay(delta : float, id : int)
  2729. {
  2730. fastAttackCounter = 0;
  2731. }
  2732.  
  2733. private timer function HeavyAttackCounterDecay(delta : float, id : int)
  2734. {
  2735. heavyAttackCounter = 0;
  2736. }
  2737.  
  2738.  
  2739. public function GetCraftingSchematicsNames() : array<name> {return craftingSchematics;}
  2740.  
  2741. public function RemoveAllCraftingSchematics()
  2742. {
  2743. craftingSchematics.Clear();
  2744. }
  2745.  
  2746.  
  2747. function AddCraftingSchematic( nam : name, optional isSilent : bool, optional skipTutorialUpdate : bool ) : bool
  2748. {
  2749. var i : int;
  2750.  
  2751. if(!skipTutorialUpdate && ShouldProcessTutorial('TutorialCraftingGotRecipe'))
  2752. {
  2753. FactsAdd("tut_received_schematic");
  2754. }
  2755.  
  2756. for(i=0; i<craftingSchematics.Size(); i+=1)
  2757. {
  2758. if(craftingSchematics[i] == nam)
  2759. return false;
  2760.  
  2761.  
  2762. if(StrCmp(craftingSchematics[i],nam) > 0)
  2763. {
  2764. craftingSchematics.Insert(i,nam);
  2765. AddCraftingHudNotification( nam, isSilent );
  2766. theGame.GetGlobalEventsManager().OnScriptedEvent( SEC_CraftingSchematics );
  2767. return true;
  2768. }
  2769. }
  2770.  
  2771.  
  2772. craftingSchematics.PushBack(nam);
  2773. AddCraftingHudNotification( nam, isSilent );
  2774. theGame.GetGlobalEventsManager().OnScriptedEvent( SEC_CraftingSchematics );
  2775. return true;
  2776. }
  2777.  
  2778. function AddCraftingHudNotification( nam : name, isSilent : bool )
  2779. {
  2780. var hud : CR4ScriptedHud;
  2781. if( !isSilent )
  2782. {
  2783. hud = (CR4ScriptedHud)theGame.GetHud();
  2784. if( hud )
  2785. {
  2786. hud.OnCraftingSchematicUpdate( nam );
  2787. }
  2788. }
  2789. }
  2790.  
  2791. function AddAlchemyHudNotification( nam : name, isSilent : bool )
  2792. {
  2793. var hud : CR4ScriptedHud;
  2794. if( !isSilent )
  2795. {
  2796. hud = (CR4ScriptedHud)theGame.GetHud();
  2797. if( hud )
  2798. {
  2799. hud.OnAlchemySchematicUpdate( nam );
  2800. }
  2801. }
  2802. }
  2803.  
  2804. public function GetAlchemyRecipes() : array<name>
  2805. {
  2806. return alchemyRecipes;
  2807. }
  2808.  
  2809. public function CanLearnAlchemyRecipe(recipeName : name) : bool
  2810. {
  2811. var dm : CDefinitionsManagerAccessor;
  2812. var recipeNode : SCustomNode;
  2813. var i, tmpInt : int;
  2814. var tmpName : name;
  2815.  
  2816. dm = theGame.GetDefinitionsManager();
  2817. if ( dm.GetSubNodeByAttributeValueAsCName( recipeNode, 'alchemy_recipes', 'name_name', recipeName ) )
  2818. {
  2819. return true;
  2820.  
  2821. }
  2822.  
  2823. return false;
  2824. }
  2825.  
  2826. private final function RemoveAlchemyRecipe(recipeName : name)
  2827. {
  2828. alchemyRecipes.Remove(recipeName);
  2829. }
  2830.  
  2831. private final function RemoveAllAlchemyRecipes()
  2832. {
  2833. alchemyRecipes.Clear();
  2834. }
  2835.  
  2836.  
  2837. function AddAlchemyRecipe(nam : name, optional isSilent : bool, optional skipTutorialUpdate : bool) : bool
  2838. {
  2839. var i, potions, bombs : int;
  2840. var found : bool;
  2841. var m_alchemyManager : W3AlchemyManager;
  2842. var recipe : SAlchemyRecipe;
  2843. var knownBombTypes : array<string>;
  2844. var strRecipeName, recipeNameWithoutLevel : string;
  2845.  
  2846. if(!IsAlchemyRecipe(nam))
  2847. return false;
  2848.  
  2849. found = false;
  2850. for(i=0; i<alchemyRecipes.Size(); i+=1)
  2851. {
  2852. if(alchemyRecipes[i] == nam)
  2853. return false;
  2854.  
  2855.  
  2856. if(StrCmp(alchemyRecipes[i],nam) > 0)
  2857. {
  2858. alchemyRecipes.Insert(i,nam);
  2859. found = true;
  2860. AddAlchemyHudNotification(nam,isSilent);
  2861. break;
  2862. }
  2863. }
  2864.  
  2865. if(!found)
  2866. {
  2867. alchemyRecipes.PushBack(nam);
  2868. AddAlchemyHudNotification(nam,isSilent);
  2869. }
  2870.  
  2871. m_alchemyManager = new W3AlchemyManager in this;
  2872. m_alchemyManager.Init(alchemyRecipes);
  2873. m_alchemyManager.GetRecipe(nam, recipe);
  2874.  
  2875.  
  2876. if(CanUseSkill(S_Alchemy_s18))
  2877. {
  2878. if ((recipe.cookedItemType != EACIT_Bolt) && (recipe.cookedItemType != EACIT_Undefined) && (recipe.level <= GetSkillLevel(S_Alchemy_s18)))
  2879. AddAbility(SkillEnumToName(S_Alchemy_s18), true);
  2880.  
  2881. }
  2882.  
  2883.  
  2884. potions = 0;
  2885. bombs = 0;
  2886. for(i=0; i<alchemyRecipes.Size(); i+=1)
  2887. {
  2888. m_alchemyManager.GetRecipe(alchemyRecipes[i], recipe);
  2889.  
  2890.  
  2891. if(recipe.cookedItemType == EACIT_Potion || recipe.cookedItemType == EACIT_MutagenPotion || recipe.cookedItemType == EACIT_Alcohol || recipe.cookedItemType == EACIT_Quest)
  2892. {
  2893. potions += 1;
  2894. }
  2895.  
  2896. else if(recipe.cookedItemType == EACIT_Bomb)
  2897. {
  2898. strRecipeName = NameToString(alchemyRecipes[i]);
  2899. recipeNameWithoutLevel = StrLeft(strRecipeName, StrLen(strRecipeName)-2);
  2900. if(!knownBombTypes.Contains(recipeNameWithoutLevel))
  2901. {
  2902. bombs += 1;
  2903. knownBombTypes.PushBack(recipeNameWithoutLevel);
  2904. }
  2905. }
  2906. }
  2907. theGame.GetGamerProfile().SetStat(ES_KnownPotionRecipes, potions);
  2908. theGame.GetGamerProfile().SetStat(ES_KnownBombRecipes, bombs);
  2909. theGame.GetGlobalEventsManager().OnScriptedEvent( SEC_AlchemyRecipe );
  2910.  
  2911. return true;
  2912. }
  2913.  
  2914.  
  2915.  
  2916.  
  2917.  
  2918.  
  2919.  
  2920. public function GetDisplayHeavyAttackIndicator() : bool
  2921. {
  2922. return bDispalyHeavyAttackIndicator;
  2923. }
  2924.  
  2925. public function SetDisplayHeavyAttackIndicator( val : bool )
  2926. {
  2927. bDispalyHeavyAttackIndicator = val;
  2928. }
  2929.  
  2930. public function GetDisplayHeavyAttackFirstLevelTimer() : bool
  2931. {
  2932. return bDisplayHeavyAttackFirstLevelTimer;
  2933. }
  2934.  
  2935. public function SetDisplayHeavyAttackFirstLevelTimer( val : bool )
  2936. {
  2937. bDisplayHeavyAttackFirstLevelTimer = val;
  2938. }
  2939.  
  2940.  
  2941.  
  2942.  
  2943.  
  2944.  
  2945.  
  2946. public function SelectQuickslotItem( slot : EEquipmentSlots )
  2947. {
  2948. var item : SItemUniqueId;
  2949.  
  2950. GetItemEquippedOnSlot(slot, item);
  2951. selectedItemId = item;
  2952. }
  2953.  
  2954.  
  2955.  
  2956.  
  2957.  
  2958.  
  2959.  
  2960. public function GetMedallion() : W3MedallionController
  2961. {
  2962. if ( !medallionController )
  2963. {
  2964. medallionController = new W3MedallionController in this;
  2965. }
  2966. return medallionController;
  2967. }
  2968.  
  2969.  
  2970. public final function HighlightObjects(range : float, optional highlightTime : float )
  2971. {
  2972. var ents : array<CGameplayEntity>;
  2973. var i : int;
  2974.  
  2975. FindGameplayEntitiesInSphere(ents, GetWorldPosition(), range, 100, 'HighlightedByMedalionFX', FLAG_ExcludePlayer);
  2976.  
  2977. if(highlightTime == 0)
  2978. highlightTime = 30;
  2979.  
  2980. for(i=0; i<ents.Size(); i+=1)
  2981. {
  2982. if(!ents[i].IsHighlighted())
  2983. {
  2984. ents[i].SetHighlighted( true );
  2985. ents[i].PlayEffectSingle( 'medalion_detection_fx' );
  2986. ents[i].AddTimer( 'MedallionEffectOff', highlightTime );
  2987. }
  2988. }
  2989. }
  2990.  
  2991.  
  2992. public final function HighlightEnemies(range : float, optional highlightTime : float )
  2993. {
  2994. var ents : array<CGameplayEntity>;
  2995. var i : int;
  2996. var catComponent : CGameplayEffectsComponent;
  2997.  
  2998. FindGameplayEntitiesInSphere(ents, GetWorldPosition(), range, 100, , FLAG_ExcludePlayer + FLAG_OnlyAliveActors);
  2999.  
  3000. if(highlightTime == 0)
  3001. highlightTime = 5;
  3002.  
  3003. for(i=0; i<ents.Size(); i+=1)
  3004. {
  3005. if(IsRequiredAttitudeBetween(this, ents[i], true))
  3006. {
  3007. catComponent = GetGameplayEffectsComponent(ents[i]);
  3008. if(catComponent)
  3009. {
  3010. catComponent.SetGameplayEffectFlag(EGEF_CatViewHiglight, true);
  3011. ents[i].AddTimer( 'EnemyHighlightOff', highlightTime );
  3012. }
  3013. }
  3014. }
  3015. }
  3016.  
  3017. function SpawnMedallionEntity()
  3018. {
  3019. var rot : EulerAngles;
  3020. var spawnedMedallion : CEntity;
  3021.  
  3022. spawnedMedallion = theGame.GetEntityByTag( 'new_Witcher_medallion_FX' );
  3023.  
  3024. if ( !spawnedMedallion )
  3025. theGame.CreateEntity( medallionEntity, GetWorldPosition(), rot, true, false );
  3026. }
  3027.  
  3028.  
  3029.  
  3030.  
  3031.  
  3032.  
  3033.  
  3034.  
  3035.  
  3036. public final function InterruptCombatFocusMode()
  3037. {
  3038. if( this.GetCurrentStateName() == 'CombatFocusMode_SelectSpot' )
  3039. {
  3040. SetCanPlayHitAnim( true );
  3041. PopState();
  3042. }
  3043. }
  3044.  
  3045.  
  3046.  
  3047.  
  3048.  
  3049. private saved var selectedPotionSlotUpper, selectedPotionSlotLower : EEquipmentSlots;
  3050. private var potionDoubleTapTimerRunning, potionDoubleTapSlotIsUpper : bool;
  3051. default selectedPotionSlotUpper = EES_Potion1;
  3052. default selectedPotionSlotLower = EES_Potion2;
  3053. default potionDoubleTapTimerRunning = false;
  3054.  
  3055. public final function SetPotionDoubleTapRunning(b : bool, optional isUpperSlot : bool)
  3056. {
  3057. if(b)
  3058. {
  3059. AddTimer('PotionDoubleTap', 0.3);
  3060. }
  3061. else
  3062. {
  3063. RemoveTimer('PotionDoubleTap');
  3064. }
  3065.  
  3066. potionDoubleTapTimerRunning = b;
  3067. potionDoubleTapSlotIsUpper = isUpperSlot;
  3068. }
  3069.  
  3070. public final function IsPotionDoubleTapRunning() : bool
  3071. {
  3072. return potionDoubleTapTimerRunning;
  3073. }
  3074.  
  3075. timer function PotionDoubleTap(dt : float, id : int)
  3076. {
  3077. potionDoubleTapTimerRunning = false;
  3078. OnPotionDrinkInput(potionDoubleTapSlotIsUpper);
  3079. }
  3080.  
  3081. public final function OnPotionDrinkInput(fromUpperSlot : bool)
  3082. {
  3083. var slot : EEquipmentSlots;
  3084.  
  3085. if(fromUpperSlot)
  3086. slot = GetSelectedPotionSlotUpper();
  3087. else
  3088. slot = GetSelectedPotionSlotLower();
  3089.  
  3090. DrinkPotionFromSlot(slot);
  3091. }
  3092.  
  3093. public final function OnPotionDrinkKeyboardsInput(slot : EEquipmentSlots)
  3094. {
  3095. DrinkPotionFromSlot(slot);
  3096. }
  3097.  
  3098. private function DrinkPotionFromSlot(slot : EEquipmentSlots):void
  3099. {
  3100. var item : SItemUniqueId;
  3101. var hud : CR4ScriptedHud;
  3102. var module : CR4HudModuleItemInfo;
  3103.  
  3104. GetItemEquippedOnSlot(slot, item);
  3105. if(inv.ItemHasTag(item, 'Edibles'))
  3106. {
  3107. ConsumeItem( item );
  3108. }
  3109. else
  3110. {
  3111. if (ToxicityLowEnoughToDrinkPotion(slot))
  3112. {
  3113. DrinkPreparedPotion(slot);
  3114. }
  3115. else
  3116. {
  3117. SendToxicityTooHighMessage();
  3118. }
  3119. }
  3120.  
  3121. hud = (CR4ScriptedHud)theGame.GetHud();
  3122. if ( hud )
  3123. {
  3124. module = (CR4HudModuleItemInfo)hud.GetHudModule("ItemInfoModule");
  3125. if( module )
  3126. {
  3127. module.ForceShowElement();
  3128. }
  3129. }
  3130. }
  3131.  
  3132. private function SendToxicityTooHighMessage()
  3133. {
  3134. var messageText : string;
  3135. var language : string;
  3136. var audioLanguage : string;
  3137.  
  3138. if (GetHudMessagesSize() < 2)
  3139. {
  3140. messageText = GetLocStringByKeyExt("menu_cannot_perform_action_now") + " " + GetLocStringByKeyExt("panel_common_statistics_tooltip_current_toxicity");
  3141.  
  3142. theGame.GetGameLanguageName(audioLanguage,language);
  3143. if (language == "AR")
  3144. {
  3145. messageText += (int)(abilityManager.GetStat(BCS_Toxicity, false)) + " / " + (int)(abilityManager.GetStatMax(BCS_Toxicity)) + " :";
  3146. }
  3147. else
  3148. {
  3149. messageText += ": " + (int)(abilityManager.GetStat(BCS_Toxicity, false)) + " / " + (int)(abilityManager.GetStatMax(BCS_Toxicity));
  3150. }
  3151.  
  3152. DisplayHudMessage(messageText);
  3153. }
  3154. theSound.SoundEvent("gui_global_denied");
  3155. }
  3156.  
  3157. public final function GetSelectedPotionSlotUpper() : EEquipmentSlots
  3158. {
  3159. return selectedPotionSlotUpper;
  3160. }
  3161.  
  3162. public final function GetSelectedPotionSlotLower() : EEquipmentSlots
  3163. {
  3164. return selectedPotionSlotLower;
  3165. }
  3166.  
  3167.  
  3168. public final function FlipSelectedPotion(isUpperSlot : bool) : bool
  3169. {
  3170. if(isUpperSlot)
  3171. {
  3172. if(selectedPotionSlotUpper == EES_Potion1 && IsAnyItemEquippedOnSlot(EES_Potion3))
  3173. {
  3174. selectedPotionSlotUpper = EES_Potion3;
  3175. return true;
  3176. }
  3177. else if(selectedPotionSlotUpper == EES_Potion3 && IsAnyItemEquippedOnSlot(EES_Potion1))
  3178. {
  3179. selectedPotionSlotUpper = EES_Potion1;
  3180. return true;
  3181. }
  3182. }
  3183. else
  3184. {
  3185. if(selectedPotionSlotLower == EES_Potion2 && IsAnyItemEquippedOnSlot(EES_Potion4))
  3186. {
  3187. selectedPotionSlotLower = EES_Potion4;
  3188. return true;
  3189. }
  3190. else if(selectedPotionSlotLower == EES_Potion4 && IsAnyItemEquippedOnSlot(EES_Potion2))
  3191. {
  3192. selectedPotionSlotLower = EES_Potion2;
  3193. return true;
  3194. }
  3195. }
  3196.  
  3197. return false;
  3198. }
  3199.  
  3200. public final function AddBombThrowDelay(bombId : SItemUniqueId)
  3201. {
  3202. var slot : EEquipmentSlots;
  3203.  
  3204. slot = GetItemSlot(bombId);
  3205.  
  3206. if(slot == EES_Unused)
  3207. return;
  3208.  
  3209. if(slot == EES_Petard1 || slot == EES_Quickslot1)
  3210. {
  3211. remainingBombThrowDelaySlot1 = theGame.params.BOMB_THROW_DELAY;
  3212. AddTimer('BombDelay1', 0.1, true);
  3213. }
  3214. else if(slot == EES_Petard2 || slot == EES_Quickslot2)
  3215. {
  3216. remainingBombThrowDelaySlot2 = theGame.params.BOMB_THROW_DELAY;
  3217. AddTimer('BombDelay2', 0.1, true);
  3218. }
  3219. }
  3220.  
  3221. public final function GetBombDelay(slot : EEquipmentSlots) : float
  3222. {
  3223. if(slot == EES_Petard1 || slot == EES_Quickslot1)
  3224. return remainingBombThrowDelaySlot1;
  3225. else if(slot == EES_Petard2 || slot == EES_Quickslot2)
  3226. return remainingBombThrowDelaySlot2;
  3227.  
  3228. return 0;
  3229. }
  3230.  
  3231. timer function BombDelay1(dt : float, id : int)
  3232. {
  3233. remainingBombThrowDelaySlot1 -= dt;
  3234.  
  3235. if(remainingBombThrowDelaySlot1 <= 0)
  3236. RemoveTimer('BombDelay1');
  3237. }
  3238.  
  3239. timer function BombDelay2(dt : float, id : int)
  3240. {
  3241. remainingBombThrowDelaySlot2 -= dt;
  3242.  
  3243. if(remainingBombThrowDelaySlot2 <= 0)
  3244. RemoveTimer('BombDelay2');
  3245. }
  3246.  
  3247. public function ResetCharacterDev()
  3248. {
  3249.  
  3250. UnequipItemFromSlot(EES_SkillMutagen1);
  3251. UnequipItemFromSlot(EES_SkillMutagen2);
  3252. UnequipItemFromSlot(EES_SkillMutagen3);
  3253. UnequipItemFromSlot(EES_SkillMutagen4);
  3254.  
  3255. levelManager.ResetCharacterDev();
  3256. ((W3PlayerAbilityManager)abilityManager).ResetCharacterDev();
  3257. }
  3258.  
  3259. public function ConsumeItem( itemId : SItemUniqueId ) : bool
  3260. {
  3261. var itemName : name;
  3262. var removedItem, willRemoveItem : bool;
  3263. var edibles : array<SItemUniqueId>;
  3264. var toSlot : EEquipmentSlots;
  3265. var i : int;
  3266. var equippedNewEdible : bool;
  3267.  
  3268. itemName = inv.GetItemName( itemId );
  3269.  
  3270. if (itemName == 'q111_imlerith_acorn' )
  3271. {
  3272. AddPoints(ESkillPoint, 2, true);
  3273. removedItem = inv.RemoveItem( itemId, 1 );
  3274. theGame.GetGuiManager().ShowNotification( GetLocStringByKeyExt("panel_character_popup_title_buy_skill") + "<br>" + GetLocStringByKeyExt("panel_character_availablepoints") + " +2");
  3275. theSound.SoundEvent("gui_character_buy_skill");
  3276. }
  3277. else if ( itemName == 'Clearing Potion' )
  3278. {
  3279. ResetCharacterDev();
  3280. removedItem = inv.RemoveItem( itemId, 1 );
  3281. theGame.GetGuiManager().ShowNotification( GetLocStringByKeyExt("panel_character_popup_character_cleared") );
  3282. theSound.SoundEvent("gui_character_synergy_effect");
  3283. }
  3284. else if(itemName == 'Wolf Hour')
  3285. {
  3286. removedItem = inv.RemoveItem( itemId, 1 );
  3287. theSound.SoundEvent("gui_character_synergy_effect");
  3288. AddEffectDefault(EET_WolfHour, thePlayer, 'wolf hour');
  3289. }
  3290. else
  3291. {
  3292. willRemoveItem = inv.GetItemQuantity(itemId) == 1 && !inv.ItemHasTag(itemId, 'InfiniteUse');
  3293.  
  3294. if(willRemoveItem)
  3295. toSlot = GetItemSlot(itemId);
  3296.  
  3297. removedItem = super.ConsumeItem(itemId);
  3298.  
  3299. if(willRemoveItem && removedItem)
  3300. {
  3301. edibles = inv.GetItemsByTag('Edibles');
  3302. equippedNewEdible = false;
  3303.  
  3304.  
  3305. for(i=0; i<edibles.Size(); i+=1)
  3306. {
  3307. if(!IsItemEquipped(edibles[i]) && !inv.ItemHasTag(edibles[i], 'Alcohol') && inv.GetItemName(edibles[i]) != 'Clearing Potion' && inv.GetItemName(edibles[i]) != 'Wolf Hour')
  3308. {
  3309. EquipItemInGivenSlot(edibles[i], toSlot, true, false);
  3310. equippedNewEdible = true;
  3311. break;
  3312. }
  3313. }
  3314.  
  3315.  
  3316. if(!equippedNewEdible)
  3317. {
  3318. for(i=0; i<edibles.Size(); i+=1)
  3319. {
  3320. if(!IsItemEquipped(edibles[i]) && inv.GetItemName(edibles[i]) != 'Clearing Potion' && inv.GetItemName(edibles[i]) != 'Wolf Hour')
  3321. {
  3322. EquipItemInGivenSlot(edibles[i], toSlot, true, false);
  3323. break;
  3324. }
  3325. }
  3326. }
  3327. }
  3328. }
  3329.  
  3330. return removedItem;
  3331. }
  3332.  
  3333. // <modRefillAlcohol>
  3334. public final function GetAlcoholForAlchemicalItemsRefill() : SItemUniqueId
  3335. {
  3336. var alcos : array<SItemUniqueId>;
  3337. var id : SItemUniqueId;
  3338. var i, qty, maxQty : int;
  3339.  
  3340. alcos = inv.GetItemsByTag(theGame.params.TAG_ALCHEMY_REFILL_ALCO);
  3341.  
  3342. if(alcos.Size() > 0)
  3343. {
  3344. if(inv.ItemHasTag(alcos[0], theGame.params.TAG_INFINITE_USE))
  3345. return alcos[0];
  3346.  
  3347. maxQty = inv.GetItemQuantity(alcos[0]);
  3348. qty = maxQty;
  3349. id = alcos[0];
  3350.  
  3351. for(i=1; i<alcos.Size(); i+=1)
  3352. {
  3353. if(inv.ItemHasTag(alcos[i], theGame.params.TAG_INFINITE_USE))
  3354. return alcos[i];
  3355.  
  3356. qty = inv.GetItemQuantity(alcos[i]);
  3357.  
  3358. if(qty > maxQty)
  3359. {
  3360. maxQty = qty;
  3361. id = alcos[i];
  3362. }
  3363. }
  3364.  
  3365. return id;
  3366. }
  3367.  
  3368. return GetInvalidUniqueId();
  3369. }
  3370. // </modRefillAlcohol>
  3371.  
  3372. public final function ClearPreviouslyUsedBolt()
  3373. {
  3374. previouslyUsedBolt = GetInvalidUniqueId();
  3375. }
  3376.  
  3377.  
  3378. public final function AddAndEquipInfiniteBolt(optional forceBodkin : bool, optional forceHarpoon : bool)
  3379. {
  3380. var bolt, bodkins, harpoons : array<SItemUniqueId>;
  3381. var boltItemName : name;
  3382. var i : int;
  3383.  
  3384.  
  3385. bodkins = inv.GetItemsByName('Bodkin Bolt');
  3386. harpoons = inv.GetItemsByName('Harpoon Bolt');
  3387.  
  3388. for(i=bodkins.Size()-1; i>=0; i-=1)
  3389. inv.RemoveItem(bodkins[i], inv.GetItemQuantity(bodkins[i]) );
  3390.  
  3391. for(i=harpoons.Size()-1; i>=0; i-=1)
  3392. inv.RemoveItem(harpoons[i], inv.GetItemQuantity(harpoons[i]) );
  3393.  
  3394.  
  3395.  
  3396. if(!forceBodkin && (forceHarpoon || GetCurrentStateName() == 'Swimming' || IsSwimming() || IsDiving()) )
  3397. {
  3398. boltItemName = 'Harpoon Bolt';
  3399. }
  3400. else
  3401. {
  3402. boltItemName = 'Bodkin Bolt';
  3403. }
  3404.  
  3405.  
  3406. if(boltItemName == 'Bodkin Bolt' && inv.IsIdValid(previouslyUsedBolt))
  3407. {
  3408. bolt.PushBack(previouslyUsedBolt);
  3409. }
  3410. else
  3411. {
  3412.  
  3413. bolt = inv.AddAnItem(boltItemName, 1, true, true);
  3414.  
  3415.  
  3416. if(boltItemName == 'Harpoon Bolt')
  3417. {
  3418. GetItemEquippedOnSlot(EES_Bolt, previouslyUsedBolt);
  3419. }
  3420. }
  3421.  
  3422. EquipItem(bolt[0], EES_Bolt);
  3423. }
  3424.  
  3425.  
  3426. event OnItemGiven(data : SItemChangedData)
  3427. {
  3428. var m_guiManager : CR4GuiManager;
  3429.  
  3430. super.OnItemGiven(data);
  3431.  
  3432.  
  3433. if(!inv)
  3434. inv = GetInventory();
  3435.  
  3436.  
  3437. if(inv.IsItemEncumbranceItem(data.ids[0]))
  3438. UpdateEncumbrance();
  3439.  
  3440. m_guiManager = theGame.GetGuiManager();
  3441. if(m_guiManager)
  3442. m_guiManager.RegisterNewItem(data.ids[0]);
  3443. }
  3444.  
  3445.  
  3446. public final function CheckForFullyArmedAchievement()
  3447. {
  3448. if( HasAllItemsFromSet(theGame.params.ITEM_SET_TAG_BEAR) || HasAllItemsFromSet(theGame.params.ITEM_SET_TAG_GRYPHON) ||
  3449. HasAllItemsFromSet(theGame.params.ITEM_SET_TAG_LYNX) || HasAllItemsFromSet(theGame.params.ITEM_SET_TAG_WOLF)
  3450. )
  3451. {
  3452. theGame.GetGamerProfile().AddAchievement(EA_FullyArmed);
  3453. }
  3454. }
  3455.  
  3456.  
  3457. public final function HasAllItemsFromSet(setItemTag : name) : bool
  3458. {
  3459. var item : SItemUniqueId;
  3460.  
  3461. if(!GetItemEquippedOnSlot(EES_SteelSword, item) || !inv.ItemHasTag(item, setItemTag))
  3462. return false;
  3463.  
  3464. if(!GetItemEquippedOnSlot(EES_SilverSword, item) || !inv.ItemHasTag(item, setItemTag))
  3465. return false;
  3466.  
  3467. if(!GetItemEquippedOnSlot(EES_Boots, item) || !inv.ItemHasTag(item, setItemTag))
  3468. return false;
  3469.  
  3470. if(!GetItemEquippedOnSlot(EES_Pants, item) || !inv.ItemHasTag(item, setItemTag))
  3471. return false;
  3472.  
  3473. if(!GetItemEquippedOnSlot(EES_Gloves, item) || !inv.ItemHasTag(item, setItemTag))
  3474. return false;
  3475.  
  3476. if(!GetItemEquippedOnSlot(EES_Armor, item) || !inv.ItemHasTag(item, setItemTag))
  3477. return false;
  3478.  
  3479.  
  3480. if(setItemTag == theGame.params.ITEM_SET_TAG_BEAR || setItemTag == theGame.params.ITEM_SET_TAG_LYNX)
  3481. {
  3482. if(!GetItemEquippedOnSlot(EES_RangedWeapon, item) || !inv.ItemHasTag(item, setItemTag))
  3483. return false;
  3484. }
  3485.  
  3486. return true;
  3487. }
  3488.  
  3489.  
  3490.  
  3491.  
  3492. public function GetTotalArmor() : SAbilityAttributeValue
  3493. {
  3494. var armor : SAbilityAttributeValue;
  3495. var armorItem : SItemUniqueId;
  3496.  
  3497. armor = super.GetTotalArmor();
  3498.  
  3499. if(GetItemEquippedOnSlot(EES_Armor, armorItem))
  3500. {
  3501.  
  3502. armor -= inv.GetItemAttributeValue(armorItem, theGame.params.ARMOR_VALUE_NAME);
  3503.  
  3504.  
  3505. armor += inv.GetItemArmorTotal(armorItem);
  3506. }
  3507.  
  3508. if(GetItemEquippedOnSlot(EES_Pants, armorItem))
  3509. {
  3510.  
  3511. armor -= inv.GetItemAttributeValue(armorItem, theGame.params.ARMOR_VALUE_NAME);
  3512.  
  3513.  
  3514. armor += inv.GetItemArmorTotal(armorItem);
  3515. }
  3516.  
  3517. if(GetItemEquippedOnSlot(EES_Boots, armorItem))
  3518. {
  3519.  
  3520. armor -= inv.GetItemAttributeValue(armorItem, theGame.params.ARMOR_VALUE_NAME);
  3521.  
  3522.  
  3523. armor += inv.GetItemArmorTotal(armorItem);
  3524. }
  3525.  
  3526. if(GetItemEquippedOnSlot(EES_Gloves, armorItem))
  3527. {
  3528.  
  3529. armor -= inv.GetItemAttributeValue(armorItem, theGame.params.ARMOR_VALUE_NAME);
  3530.  
  3531.  
  3532. armor += inv.GetItemArmorTotal(armorItem);
  3533. }
  3534.  
  3535. return armor;
  3536. }
  3537.  
  3538.  
  3539.  
  3540. public function ReduceArmorDurability() : EEquipmentSlots
  3541. {
  3542. var r, sum : int;
  3543. var slot : EEquipmentSlots;
  3544. var id : SItemUniqueId;
  3545. var prevDurMult, currDurMult, ratio : float;
  3546.  
  3547.  
  3548. sum = theGame.params.DURABILITY_ARMOR_CHEST_WEIGHT;
  3549. sum += theGame.params.DURABILITY_ARMOR_PANTS_WEIGHT;
  3550. sum += theGame.params.DURABILITY_ARMOR_GLOVES_WEIGHT;
  3551. sum += theGame.params.DURABILITY_ARMOR_BOOTS_WEIGHT;
  3552. sum += theGame.params.DURABILITY_ARMOR_MISS_WEIGHT;
  3553.  
  3554. r = RandRange(sum);
  3555.  
  3556. if(r < theGame.params.DURABILITY_ARMOR_CHEST_WEIGHT)
  3557. slot = EES_Armor;
  3558. else if (r < theGame.params.DURABILITY_ARMOR_CHEST_WEIGHT + theGame.params.DURABILITY_ARMOR_PANTS_WEIGHT)
  3559. slot = EES_Pants;
  3560. else if (r < theGame.params.DURABILITY_ARMOR_CHEST_WEIGHT + theGame.params.DURABILITY_ARMOR_PANTS_WEIGHT + theGame.params.DURABILITY_ARMOR_GLOVES_WEIGHT)
  3561. slot = EES_Gloves;
  3562. 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)
  3563. slot = EES_Boots;
  3564. else
  3565. return EES_InvalidSlot;
  3566.  
  3567. GetItemEquippedOnSlot(slot, id);
  3568. ratio = inv.GetItemDurabilityRatio(id);
  3569. if(inv.ReduceItemDurability(id))
  3570. {
  3571. prevDurMult = theGame.params.GetDurabilityMultiplier(ratio, false);
  3572.  
  3573. ratio = inv.GetItemDurabilityRatio(id);
  3574. currDurMult = theGame.params.GetDurabilityMultiplier(ratio, false);
  3575.  
  3576. if(currDurMult != prevDurMult)
  3577. {
  3578.  
  3579.  
  3580.  
  3581.  
  3582. }
  3583.  
  3584. return slot;
  3585. }
  3586.  
  3587. return EES_InvalidSlot;
  3588. }
  3589.  
  3590.  
  3591. public function DismantleItem(dismantledItem : SItemUniqueId, toolItem : SItemUniqueId) : bool
  3592. {
  3593. var parts : array<SItemParts>;
  3594. var i : int;
  3595.  
  3596. if(!inv.IsItemDismantleKit(toolItem))
  3597. return false;
  3598.  
  3599. parts = inv.GetItemRecyclingParts(dismantledItem);
  3600.  
  3601. if(parts.Size() <= 0)
  3602. return false;
  3603.  
  3604. for(i=0; i<parts.Size(); i+=1)
  3605. inv.AddAnItem(parts[i].itemName, parts[i].quantity, true, false);
  3606.  
  3607. inv.RemoveItem(toolItem);
  3608. inv.RemoveItem(dismantledItem);
  3609. return true;
  3610. }
  3611.  
  3612.  
  3613. public function GetItemEquippedOnSlot(slot : EEquipmentSlots, out item : SItemUniqueId) : bool
  3614. {
  3615. if(slot == EES_InvalidSlot || slot < 0 || slot > EnumGetMax('EEquipmentSlots'))
  3616. return false;
  3617.  
  3618. item = itemSlots[slot];
  3619.  
  3620. return inv.IsIdValid(item);
  3621. }
  3622.  
  3623.  
  3624. public function GetItemSlotByItemName(itemName : name) : EEquipmentSlots
  3625. {
  3626. var ids : array<SItemUniqueId>;
  3627. var i : int;
  3628. var slot : EEquipmentSlots;
  3629.  
  3630. ids = inv.GetItemsByName(itemName);
  3631. for(i=0; i<ids.Size(); i+=1)
  3632. {
  3633. slot = GetItemSlot(ids[i]);
  3634. if(slot != EES_InvalidSlot)
  3635. return slot;
  3636. }
  3637.  
  3638. return EES_InvalidSlot;
  3639. }
  3640.  
  3641.  
  3642. public function GetItemSlot(item : SItemUniqueId) : EEquipmentSlots
  3643. {
  3644. var i : int;
  3645.  
  3646. if(!inv.IsIdValid(item))
  3647. return EES_InvalidSlot;
  3648.  
  3649. for(i=0; i<itemSlots.Size(); i+=1)
  3650. if(itemSlots[i] == item)
  3651. return i;
  3652.  
  3653. return EES_InvalidSlot;
  3654. }
  3655.  
  3656. public function GetEquippedItems() : array<SItemUniqueId>
  3657. {
  3658. return itemSlots;
  3659. }
  3660.  
  3661. public function IsItemEquipped(item : SItemUniqueId) : bool
  3662. {
  3663. if(!inv.IsIdValid(item))
  3664. return false;
  3665.  
  3666. return itemSlots.Contains(item);
  3667. }
  3668.  
  3669. public function IsItemHeld(item : SItemUniqueId) : bool
  3670. {
  3671. if(!inv.IsIdValid(item))
  3672. return false;
  3673.  
  3674. return inv.IsItemHeld(item);
  3675. }
  3676.  
  3677.  
  3678. public function IsAnyItemEquippedOnSlot(slot : EEquipmentSlots) : bool
  3679. {
  3680. if(slot == EES_InvalidSlot || slot < 0 || slot > EnumGetMax('EEquipmentSlots'))
  3681. return false;
  3682.  
  3683. return inv.IsIdValid(itemSlots[slot]);
  3684. }
  3685.  
  3686.  
  3687. public function GetFreeQuickslot() : EEquipmentSlots
  3688. {
  3689. if(!inv.IsIdValid(itemSlots[EES_Quickslot1])) return EES_Quickslot1;
  3690. if(!inv.IsIdValid(itemSlots[EES_Quickslot2])) return EES_Quickslot2;
  3691.  
  3692.  
  3693. return EES_InvalidSlot;
  3694. }
  3695.  
  3696.  
  3697. event OnEquipItemRequested(item : SItemUniqueId, ignoreMount : bool)
  3698. {
  3699. var slot : EEquipmentSlots;
  3700.  
  3701. if(inv.IsIdValid(item))
  3702. {
  3703. slot = inv.GetSlotForItemId(item);
  3704.  
  3705. if (slot != EES_InvalidSlot)
  3706. {
  3707.  
  3708.  
  3709. EquipItemInGivenSlot(item, slot, ignoreMount);
  3710. }
  3711. }
  3712. }
  3713.  
  3714. event OnUnequipItemRequested(item : SItemUniqueId)
  3715. {
  3716. UnequipItem(item);
  3717. }
  3718.  
  3719.  
  3720. public function EquipItem(item : SItemUniqueId, optional slot : EEquipmentSlots, optional toHand : bool) : bool
  3721. {
  3722. if(!inv.IsIdValid(item))
  3723. return false;
  3724.  
  3725. if(slot == EES_InvalidSlot)
  3726. {
  3727. slot = inv.GetSlotForItemId(item);
  3728.  
  3729. if(slot == EES_InvalidSlot)
  3730. return false;
  3731. }
  3732.  
  3733. return EquipItemInGivenSlot(item, slot, false, toHand);
  3734. }
  3735.  
  3736. protected function ShouldMount(slot : EEquipmentSlots, item : SItemUniqueId, category : name):bool
  3737. {
  3738.  
  3739.  
  3740. return !IsSlotPotionMutagen(slot) && category != 'usable' && category != 'potion' && category != 'petard' && !inv.ItemHasTag(item, 'PlayerUnwearable');
  3741. }
  3742.  
  3743. protected function ShouldMountItemWithName( itemName: name ): bool
  3744. {
  3745. var slot : EEquipmentSlots;
  3746. var items : array<SItemUniqueId>;
  3747. var category : name;
  3748. var i : int;
  3749.  
  3750. items = inv.GetItemsByName( itemName );
  3751.  
  3752. category = inv.GetItemCategory( items[0] );
  3753.  
  3754. slot = GetItemSlot( items[0] );
  3755.  
  3756. return ShouldMount( slot, items[0], category );
  3757. }
  3758.  
  3759. public function GetMountableItems( out items : array< SItemUniqueId > )
  3760. {
  3761. var i : int;
  3762. var mountable : bool;
  3763. var mountableItems : array< SItemUniqueId >;
  3764. var slot : EEquipmentSlots;
  3765. var category : name;
  3766. var item: SItemUniqueId;
  3767.  
  3768. for ( i = 0; i < items.Size(); i += 1 )
  3769. {
  3770. item = items[i];
  3771.  
  3772. category = inv.GetItemCategory( item );
  3773.  
  3774. slot = GetItemSlot( item );
  3775.  
  3776. mountable = ShouldMount( slot, item, category );
  3777.  
  3778. if ( mountable )
  3779. {
  3780. mountableItems.PushBack( items[ i ] );
  3781. }
  3782. }
  3783. items = mountableItems;
  3784. }
  3785.  
  3786. public final function SwapEquippedItems(slot1 : EEquipmentSlots, slot2 : EEquipmentSlots)
  3787. {
  3788. var temp : SItemUniqueId;
  3789. var pam : W3PlayerAbilityManager;
  3790.  
  3791. temp = itemSlots[slot1];
  3792. itemSlots[slot1] = itemSlots[slot2];
  3793. itemSlots[slot2] = temp;
  3794.  
  3795. if(IsSlotSkillMutagen(slot1))
  3796. {
  3797. pam = (W3PlayerAbilityManager)abilityManager;
  3798. if(pam)
  3799. pam.OnSwappedMutagensPost(itemSlots[slot1], itemSlots[slot2]);
  3800. }
  3801. }
  3802.  
  3803. public function EquipItemInGivenSlot(item : SItemUniqueId, slot : EEquipmentSlots, ignoreMounting : bool, optional toHand : bool) : bool
  3804. {
  3805. var i, groupID : int;
  3806. var fistsID : array<SItemUniqueId>;
  3807. var pam : W3PlayerAbilityManager;
  3808. var isSkillMutagen : bool;
  3809. var armorEntity : CItemEntity;
  3810. var armorMeshComponent : CComponent;
  3811. var armorSoundIdentification : name;
  3812. var category : name;
  3813. var prevSkillColor : ESkillColor;
  3814. var containedAbilities : array<name>;
  3815. var dm : CDefinitionsManagerAccessor;
  3816. var armorType : EArmorType;
  3817. var otherMask, previousItemInSlot : SItemUniqueId;
  3818. var tutStatePot : W3TutorialManagerUIHandlerStatePotions;
  3819. var tutStateFood : W3TutorialManagerUIHandlerStateFood;
  3820. var tutStateSecondPotionEquip : W3TutorialManagerUIHandlerStateSecondPotionEquip;
  3821. var boltItem : SItemUniqueId;
  3822.  
  3823. if(!inv.IsIdValid(item))
  3824. {
  3825. LogAssert(false, "W3PlayerWitcher.EquipItemInGivenSlot: invalid item");
  3826. return false;
  3827. }
  3828. if(slot == EES_InvalidSlot || slot == EES_HorseBlinders || slot == EES_HorseSaddle || slot == EES_HorseBag || slot == EES_HorseTrophy)
  3829. {
  3830. LogAssert(false, "W3PlayerWitcher.EquipItem: Cannot equip item <<" + inv.GetItemName(item) + ">> - provided slot <<" + slot + ">> is invalid");
  3831. return false;
  3832. }
  3833. if(itemSlots[slot] == item)
  3834. {
  3835. return true;
  3836. }
  3837.  
  3838. if(!HasRequiredLevelToEquipItem(item))
  3839. {
  3840.  
  3841. return false;
  3842. }
  3843.  
  3844. if(inv.ItemHasTag(item, 'PhantomWeapon') && !GetPhantomWeaponMgr())
  3845. {
  3846. InitPhantomWeaponMgr();
  3847. }
  3848.  
  3849.  
  3850. previousItemInSlot = itemSlots[slot];
  3851. if( IsItemEquipped(item))
  3852. {
  3853. SwapEquippedItems(slot, GetItemSlot(item));
  3854. return true;
  3855. }
  3856.  
  3857.  
  3858. isSkillMutagen = IsSlotSkillMutagen(slot);
  3859. if(isSkillMutagen)
  3860. {
  3861. pam = (W3PlayerAbilityManager)abilityManager;
  3862. if(!pam.IsSkillMutagenSlotUnlocked(slot))
  3863. {
  3864. return false;
  3865. }
  3866. }
  3867.  
  3868.  
  3869. if(inv.IsIdValid(previousItemInSlot))
  3870. {
  3871. if(!UnequipItemFromSlot(slot, true))
  3872. {
  3873. LogAssert(false, "W3PlayerWitcher.EquipItem: Cannot equip item <<" + inv.GetItemName(item) + ">> !!");
  3874. return false;
  3875. }
  3876. }
  3877.  
  3878.  
  3879. if(inv.IsItemMask(item))
  3880. {
  3881. if(slot == EES_Quickslot1)
  3882. GetItemEquippedOnSlot(EES_Quickslot2, otherMask);
  3883. else
  3884. GetItemEquippedOnSlot(EES_Quickslot1, otherMask);
  3885.  
  3886. if(inv.IsItemMask(otherMask))
  3887. UnequipItem(otherMask);
  3888. }
  3889.  
  3890. if(isSkillMutagen)
  3891. {
  3892. groupID = pam.GetSkillGroupIdOfMutagenSlot(slot);
  3893. prevSkillColor = pam.GetSkillGroupColor(groupID);
  3894. }
  3895.  
  3896. itemSlots[slot] = item;
  3897.  
  3898. category = inv.GetItemCategory( item );
  3899.  
  3900.  
  3901. if( !ignoreMounting && ShouldMount(slot, item, category) )
  3902. {
  3903.  
  3904. inv.MountItem( item, toHand, IsSlotSkillMutagen( slot ) );
  3905. }
  3906.  
  3907. theTelemetry.LogWithLabelAndValue( TE_INV_ITEM_EQUIPPED, inv.GetItemName(item), slot );
  3908.  
  3909. if(slot == EES_RangedWeapon)
  3910. {
  3911. rangedWeapon = ( Crossbow )( inv.GetItemEntityUnsafe(item) );
  3912. if(!rangedWeapon)
  3913. AddTimer('DelayedOnItemMount', 0.1, true);
  3914.  
  3915. if ( IsSwimming() || IsDiving() )
  3916. {
  3917. GetItemEquippedOnSlot(EES_Bolt, boltItem);
  3918.  
  3919. if(inv.IsIdValid(boltItem))
  3920. {
  3921. if ( !inv.ItemHasTag(boltItem, 'UnderwaterAmmo' ))
  3922. {
  3923. AddAndEquipInfiniteBolt(false, true);
  3924. }
  3925. }
  3926. else if(!IsAnyItemEquippedOnSlot(EES_Bolt))
  3927. {
  3928. AddAndEquipInfiniteBolt(false, true);
  3929. }
  3930. }
  3931.  
  3932. else if(!IsAnyItemEquippedOnSlot(EES_Bolt))
  3933. AddAndEquipInfiniteBolt();
  3934. }
  3935. else if(slot == EES_Bolt)
  3936. {
  3937. if(rangedWeapon)
  3938. { if ( !IsSwimming() || !IsDiving() )
  3939. {
  3940. rangedWeapon.OnReplaceAmmo();
  3941. rangedWeapon.OnWeaponReload();
  3942. }
  3943. else
  3944. {
  3945. DisplayHudMessage(GetLocStringByKeyExt( "menu_cannot_perform_action_now" ));
  3946. }
  3947. }
  3948. }
  3949.  
  3950. else if(isSkillMutagen)
  3951. {
  3952. pam.OnSkillMutagenEquipped(item, slot, prevSkillColor);
  3953. LogSkillColors("Mutagen <<" + inv.GetItemName(item) + ">> equipped to slot <<" + slot + ">>");
  3954. LogSkillColors("Group bonus color is now <<" + pam.GetSkillGroupColor(groupID) + ">>");
  3955. LogSkillColors("");
  3956. }
  3957. else if(slot == EES_Gloves && HasWeaponDrawn(false))
  3958. {
  3959. PlayRuneword4FX(PW_Steel);
  3960. PlayRuneword4FX(PW_Silver);
  3961. }
  3962.  
  3963.  
  3964. if(inv.ItemHasAbility(item, 'MA_HtH'))
  3965. {
  3966. inv.GetItemContainedAbilities(item, containedAbilities);
  3967. fistsID = inv.GetItemsByName('fists');
  3968. dm = theGame.GetDefinitionsManager();
  3969. for(i=0; i<containedAbilities.Size(); i+=1)
  3970. {
  3971. if(dm.AbilityHasTag(containedAbilities[i], 'MA_HtH'))
  3972. {
  3973. inv.AddItemCraftedAbility(fistsID[0], containedAbilities[i], true);
  3974. }
  3975. }
  3976. }
  3977.  
  3978.  
  3979. if(inv.IsItemAnyArmor(item))
  3980. {
  3981. armorType = inv.GetArmorType(item);
  3982. pam = (W3PlayerAbilityManager)abilityManager;
  3983.  
  3984. if(armorType == EAT_Light)
  3985. {
  3986. if(CanUseSkill(S_Perk_05))
  3987. pam.SetPerkArmorBonus(S_Perk_05);
  3988. }
  3989. else if(armorType == EAT_Medium)
  3990. {
  3991. if(CanUseSkill(S_Perk_06))
  3992. pam.SetPerkArmorBonus(S_Perk_06);
  3993. }
  3994. else if(armorType == EAT_Heavy)
  3995. {
  3996. if(CanUseSkill(S_Perk_07))
  3997. pam.SetPerkArmorBonus(S_Perk_07);
  3998. }
  3999. }
  4000.  
  4001.  
  4002. theGame.GetGlobalEventsManager().OnScriptedEvent( SEC_OnItemEquipped );
  4003.  
  4004.  
  4005. if(ShouldProcessTutorial('TutorialPotionCanEquip3'))
  4006. {
  4007. if(IsSlotPotionSlot(slot))
  4008. {
  4009. tutStatePot = (W3TutorialManagerUIHandlerStatePotions)theGame.GetTutorialSystem().uiHandler.GetCurrentState();
  4010. if(tutStatePot)
  4011. {
  4012. tutStatePot.OnPotionEquipped(inv.GetItemName(item));
  4013. }
  4014.  
  4015. tutStateSecondPotionEquip = (W3TutorialManagerUIHandlerStateSecondPotionEquip)theGame.GetTutorialSystem().uiHandler.GetCurrentState();
  4016. if(tutStateSecondPotionEquip)
  4017. {
  4018. tutStateSecondPotionEquip.OnPotionEquipped(inv.GetItemName(item));
  4019. }
  4020.  
  4021. }
  4022. }
  4023.  
  4024. if(ShouldProcessTutorial('TutorialFoodSelectTab'))
  4025. {
  4026. if( IsSlotPotionSlot(slot) && inv.IsItemFood(item))
  4027. {
  4028. tutStateFood = (W3TutorialManagerUIHandlerStateFood)theGame.GetTutorialSystem().uiHandler.GetCurrentState();
  4029. if(tutStateFood)
  4030. {
  4031. tutStateFood.OnFoodEquipped();
  4032. }
  4033. }
  4034. }
  4035.  
  4036.  
  4037. if(inv.IsItemSetItem(item))
  4038. {
  4039. CheckForFullyArmedAchievement();
  4040. }
  4041.  
  4042. return true;
  4043. }
  4044.  
  4045. private function CheckHairItem()
  4046. {
  4047. var ids : array<SItemUniqueId>;
  4048. var i : int;
  4049. var itemName : name;
  4050. var hairApplied : bool;
  4051.  
  4052. ids = inv.GetItemsByCategory('hair');
  4053.  
  4054. for(i=0; i<ids.Size(); i+= 1)
  4055. {
  4056. itemName = inv.GetItemName( ids[i] );
  4057.  
  4058. if( itemName != 'Preview Hair' )
  4059. {
  4060. if( hairApplied == false )
  4061. {
  4062. inv.MountItem( ids[i], false );
  4063. hairApplied = true;
  4064. }
  4065. else
  4066. {
  4067. inv.RemoveItem( ids[i], 1 );
  4068. }
  4069.  
  4070. }
  4071. }
  4072.  
  4073. if( hairApplied == false )
  4074. {
  4075. ids = inv.AddAnItem('Half With Tail Hairstyle', 1, true, false);
  4076. inv.MountItem( ids[0], false );
  4077. }
  4078.  
  4079. }
  4080.  
  4081.  
  4082. timer function DelayedOnItemMount( dt : float, id : int )
  4083. {
  4084. var crossbowID : SItemUniqueId;
  4085. var invent : CInventoryComponent;
  4086.  
  4087. invent = GetInventory();
  4088. if(!invent)
  4089. return;
  4090.  
  4091.  
  4092. GetItemEquippedOnSlot(EES_RangedWeapon, crossbowID);
  4093.  
  4094. if(invent.IsIdValid(crossbowID))
  4095. {
  4096.  
  4097. rangedWeapon = ( Crossbow )(invent.GetItemEntityUnsafe(crossbowID) );
  4098.  
  4099. if(rangedWeapon)
  4100. {
  4101.  
  4102. RemoveTimer('DelayedOnItemMount');
  4103. }
  4104. }
  4105. else
  4106. {
  4107.  
  4108. RemoveTimer('DelayedOnItemMount');
  4109. }
  4110. }
  4111.  
  4112. public function GetHeldItems() : array<SItemUniqueId>
  4113. {
  4114. var items : array<SItemUniqueId>;
  4115. var item : SItemUniqueId;
  4116.  
  4117. if( inv.GetItemEquippedOnSlot(EES_SilverSword, item) && inv.IsItemHeld(item))
  4118. items.PushBack(item);
  4119.  
  4120. if( inv.GetItemEquippedOnSlot(EES_SteelSword, item) && inv.IsItemHeld(item))
  4121. items.PushBack(item);
  4122.  
  4123. if( inv.GetItemEquippedOnSlot(EES_RangedWeapon, item) && inv.IsItemHeld(item))
  4124. items.PushBack(item);
  4125.  
  4126. if( inv.GetItemEquippedOnSlot(EES_Quickslot1, item) && inv.IsItemHeld(item))
  4127. items.PushBack(item);
  4128.  
  4129. if( inv.GetItemEquippedOnSlot(EES_Quickslot2, item) && inv.IsItemHeld(item))
  4130. items.PushBack(item);
  4131.  
  4132. if( inv.GetItemEquippedOnSlot(EES_Petard1, item) && inv.IsItemHeld(item))
  4133. items.PushBack(item);
  4134.  
  4135. if( inv.GetItemEquippedOnSlot(EES_Petard2, item) && inv.IsItemHeld(item))
  4136. items.PushBack(item);
  4137.  
  4138. return items;
  4139. }
  4140.  
  4141.  
  4142. public function UnequipItemFromSlot(slot : EEquipmentSlots, optional reequipped : bool) : bool
  4143. {
  4144. var item, bolts : SItemUniqueId;
  4145. var items : array<SItemUniqueId>;
  4146. var retBool : bool;
  4147. var fistsID, bolt : array<SItemUniqueId>;
  4148. var i, groupID : int;
  4149. var pam : W3PlayerAbilityManager;
  4150. var prevSkillColor : ESkillColor;
  4151. var containedAbilities : array<name>;
  4152. var dm : CDefinitionsManagerAccessor;
  4153. var armorType : EArmorType;
  4154. var isSwimming : bool;
  4155. var hud : CR4ScriptedHud;
  4156. var damagedItemModule : CR4HudModuleDamagedItems;
  4157.  
  4158. if(slot == EES_InvalidSlot || slot < 0 || slot > EnumGetMax('EEquipmentSlots') || !inv.IsIdValid(itemSlots[slot]))
  4159. return false;
  4160.  
  4161.  
  4162. if(IsSlotSkillMutagen(slot))
  4163. {
  4164.  
  4165. pam = (W3PlayerAbilityManager)abilityManager;
  4166. groupID = pam.GetSkillGroupIdOfMutagenSlot(slot);
  4167. prevSkillColor = pam.GetSkillGroupColor(groupID);
  4168. }
  4169.  
  4170.  
  4171. if(slot == EES_SilverSword || slot == EES_SteelSword)
  4172. {
  4173. RemoveOilBuff( slot == EES_SteelSword );
  4174. }
  4175.  
  4176. item = itemSlots[slot];
  4177. itemSlots[slot] = GetInvalidUniqueId();
  4178.  
  4179.  
  4180. if(inv.ItemHasTag( item, 'PhantomWeapon' ) && GetPhantomWeaponMgr())
  4181. {
  4182. DestroyPhantomWeaponMgr();
  4183. }
  4184.  
  4185.  
  4186.  
  4187.  
  4188. if(slot == EES_RangedWeapon)
  4189. {
  4190.  
  4191. this.OnRangedForceHolster( true, true );
  4192. rangedWeapon.ClearDeployedEntity(true);
  4193. rangedWeapon = NULL;
  4194.  
  4195.  
  4196. if(GetItemEquippedOnSlot(EES_Bolt, bolts))
  4197. {
  4198. if(inv.ItemHasTag(bolts, theGame.params.TAG_INFINITE_AMMO))
  4199. {
  4200. inv.RemoveItem(bolts, inv.GetItemQuantity(bolts) );
  4201. }
  4202. }
  4203. }
  4204. else if(IsSlotSkillMutagen(slot))
  4205. {
  4206. pam.OnSkillMutagenUnequipped(item, slot, prevSkillColor);
  4207. LogSkillColors("Mutagen <<" + inv.GetItemName(item) + ">> unequipped from slot <<" + slot + ">>");
  4208. LogSkillColors("Group bonus color is now <<" + pam.GetSkillGroupColor(groupID) + ">>");
  4209. LogSkillColors("");
  4210. }
  4211.  
  4212.  
  4213. if(currentlyEquipedItem == item)
  4214. {
  4215. currentlyEquipedItem = GetInvalidUniqueId();
  4216. RaiseEvent('ForcedUsableItemUnequip');
  4217. }
  4218. if(currentlyEquipedItemL == item)
  4219. {
  4220. if ( currentlyUsedItemL )
  4221. {
  4222. currentlyUsedItemL.OnHidden( this );
  4223. }
  4224. HideUsableItem ( true );
  4225. }
  4226.  
  4227.  
  4228. if( !IsSlotPotionMutagen(slot) )
  4229. {
  4230. GetInventory().UnmountItem(item, true);
  4231. }
  4232.  
  4233. retBool = true;
  4234.  
  4235.  
  4236. if(IsAnyItemEquippedOnSlot(EES_RangedWeapon) && slot == EES_Bolt)
  4237. {
  4238. if(inv.ItemHasTag(item, theGame.params.TAG_INFINITE_AMMO))
  4239. {
  4240.  
  4241. inv.RemoveItem(item, inv.GetItemQuantityByName( inv.GetItemName(item) ) );
  4242. }
  4243. else if (!reequipped)
  4244. {
  4245.  
  4246. AddAndEquipInfiniteBolt();
  4247. }
  4248. }
  4249.  
  4250.  
  4251. if(slot == EES_SilverSword || slot == EES_SteelSword)
  4252. {
  4253. OnEquipMeleeWeapon(PW_None, true);
  4254. }
  4255.  
  4256. if( GetSelectedItemId() == item )
  4257. {
  4258. ClearSelectedItemId();
  4259. }
  4260.  
  4261. if(inv.IsItemBody(item))
  4262. {
  4263. retBool = true;
  4264. }
  4265.  
  4266. if(retBool && !reequipped)
  4267. {
  4268. theTelemetry.LogWithLabelAndValue( TE_INV_ITEM_UNEQUIPPED, inv.GetItemName(item), slot );
  4269.  
  4270.  
  4271. if(slot == EES_SteelSword && !IsAnyItemEquippedOnSlot(EES_SilverSword))
  4272. {
  4273. RemoveBuff(EET_EnhancedWeapon);
  4274. }
  4275. else if(slot == EES_SilverSword && !IsAnyItemEquippedOnSlot(EES_SteelSword))
  4276. {
  4277. RemoveBuff(EET_EnhancedWeapon);
  4278. }
  4279. else if(inv.IsItemAnyArmor(item))
  4280. {
  4281. if( !IsAnyItemEquippedOnSlot(EES_Armor) && !IsAnyItemEquippedOnSlot(EES_Gloves) && !IsAnyItemEquippedOnSlot(EES_Boots) && !IsAnyItemEquippedOnSlot(EES_Pants))
  4282. RemoveBuff(EET_EnhancedArmor);
  4283. }
  4284. }
  4285.  
  4286.  
  4287. if(inv.ItemHasAbility(item, 'MA_HtH'))
  4288. {
  4289. inv.GetItemContainedAbilities(item, containedAbilities);
  4290. fistsID = inv.GetItemsByName('fists');
  4291. dm = theGame.GetDefinitionsManager();
  4292. for(i=0; i<containedAbilities.Size(); i+=1)
  4293. {
  4294. if(dm.AbilityHasTag(containedAbilities[i], 'MA_HtH'))
  4295. {
  4296. inv.RemoveItemCraftedAbility(fistsID[0], containedAbilities[i]);
  4297. }
  4298. }
  4299. }
  4300.  
  4301.  
  4302. if(inv.IsItemAnyArmor(item))
  4303. {
  4304. armorType = inv.GetArmorType(item);
  4305. pam = (W3PlayerAbilityManager)abilityManager;
  4306.  
  4307. if(CanUseSkill(S_Perk_05) && (armorType == EAT_Light || GetCharacterStats().HasAbility('Glyphword 2 _Stats', true) || inv.ItemHasAbility(item, 'Glyphword 2 _Stats')))
  4308. {
  4309. pam.SetPerkArmorBonus(S_Perk_05);
  4310. }
  4311. if(CanUseSkill(S_Perk_06) && (armorType == EAT_Medium || GetCharacterStats().HasAbility('Glyphword 3 _Stats', true) || inv.ItemHasAbility(item, 'Glyphword 3 _Stats')) )
  4312. {
  4313. pam.SetPerkArmorBonus(S_Perk_06);
  4314. }
  4315. if(CanUseSkill(S_Perk_07) && (armorType == EAT_Heavy || GetCharacterStats().HasAbility('Glyphword 4 _Stats', true) || inv.ItemHasAbility(item, 'Glyphword 4 _Stats')) )
  4316. {
  4317. pam.SetPerkArmorBonus(S_Perk_07);
  4318. }
  4319. }
  4320.  
  4321. if( slot == EES_Gloves )
  4322. {
  4323. thePlayer.DestroyEffect('runeword_4');
  4324. }
  4325.  
  4326.  
  4327. hud = (CR4ScriptedHud)theGame.GetHud();
  4328. if ( hud )
  4329. {
  4330. damagedItemModule = hud.GetDamagedItemModule();
  4331. if ( damagedItemModule )
  4332. {
  4333. damagedItemModule.OnItemUnequippedFromSlot( slot );
  4334. }
  4335. }
  4336.  
  4337.  
  4338. theGame.GetGlobalEventsManager().OnScriptedEvent( SEC_OnItemEquipped );
  4339.  
  4340. return retBool;
  4341. }
  4342.  
  4343. public function UnequipItem(item : SItemUniqueId) : bool
  4344. {
  4345. if(!inv.IsIdValid(item))
  4346. return false;
  4347.  
  4348. return UnequipItemFromSlot( itemSlots.FindFirst(item) );
  4349. }
  4350.  
  4351. public function DropItem( item : SItemUniqueId, quantity : int ) : bool
  4352. {
  4353. if(!inv.IsIdValid(item))
  4354. return false;
  4355. if(IsItemEquipped(item))
  4356. return UnequipItem(item);
  4357.  
  4358. return true;
  4359. }
  4360.  
  4361.  
  4362. public function IsItemEquippedByName(itemName : name) : bool
  4363. {
  4364. var i : int;
  4365.  
  4366. for(i=0; i<itemSlots.Size(); i+=1)
  4367. if(inv.GetItemName(itemSlots[i]) == itemName)
  4368. return true;
  4369.  
  4370. return false;
  4371. }
  4372.  
  4373.  
  4374. public function IsItemEquippedByCategoryName(categoryName : name) : bool
  4375. {
  4376. var i : int;
  4377.  
  4378. for(i=0; i<itemSlots.Size(); i+=1)
  4379. if(inv.GetItemCategory(itemSlots[i]) == categoryName)
  4380. return true;
  4381.  
  4382. return false;
  4383. }
  4384.  
  4385. public function GetMaxRunEncumbrance(out usesHorseBonus : bool) : float
  4386. {
  4387. var value : float;
  4388.  
  4389. value = CalculateAttributeValue(GetHorseManager().GetHorseAttributeValue('encumbrance', false));
  4390. usesHorseBonus = (value > 0);
  4391. value += CalculateAttributeValue( GetAttributeValue('encumbrance') );
  4392.  
  4393. return value;
  4394. }
  4395.  
  4396. public function GetEncumbrance() : float
  4397. {
  4398. var i: int;
  4399. var encumbrance : float;
  4400. var items : array<SItemUniqueId>;
  4401. var inve : CInventoryComponent;
  4402.  
  4403. inve = GetInventory();
  4404. inve.GetAllItems(items);
  4405.  
  4406. for(i=0; i<items.Size(); i+=1)
  4407. {
  4408. encumbrance += inve.GetItemEncumbrance( items[i] );
  4409.  
  4410. }
  4411. return encumbrance;
  4412. }
  4413.  
  4414.  
  4415.  
  4416. public function StartInvUpdateTransaction():void
  4417. {
  4418. invUpdateTransaction = true;
  4419. }
  4420.  
  4421. public function FinishInvUpdateTransaction():void
  4422. {
  4423. invUpdateTransaction = false;
  4424.  
  4425.  
  4426.  
  4427. UpdateEncumbrance();
  4428. }
  4429.  
  4430.  
  4431. public function UpdateEncumbrance()
  4432. {
  4433. var temp : bool;
  4434.  
  4435. if (invUpdateTransaction)
  4436. {
  4437.  
  4438. return;
  4439. }
  4440.  
  4441.  
  4442.  
  4443. if ( GetEncumbrance() >= (GetMaxRunEncumbrance(temp) + 1) )
  4444. {
  4445. if( !HasBuff(EET_OverEncumbered) )
  4446. {
  4447. AddEffectDefault(EET_OverEncumbered, NULL, "OverEncumbered");
  4448. }
  4449. }
  4450. else if(HasBuff(EET_OverEncumbered))
  4451. {
  4452. RemoveAllBuffsOfType(EET_OverEncumbered);
  4453. }
  4454. }
  4455.  
  4456. public final function GetSkillGroupIDFromIndex(idx : int) : int
  4457. {
  4458. var pam : W3PlayerAbilityManager;
  4459.  
  4460. pam = (W3PlayerAbilityManager)abilityManager;
  4461. if(pam && pam.IsInitialized())
  4462. return pam.GetSkillGroupIDFromIndex(idx);
  4463.  
  4464. return -1;
  4465. }
  4466.  
  4467. public final function GetSkillGroupColor(groupID : int) : ESkillColor
  4468. {
  4469. var pam : W3PlayerAbilityManager;
  4470.  
  4471. pam = (W3PlayerAbilityManager)abilityManager;
  4472. if(pam && pam.IsInitialized())
  4473. return pam.GetSkillGroupColor(groupID);
  4474.  
  4475. return SC_None;
  4476. }
  4477.  
  4478. public final function GetSkillGroupsCount() : int
  4479. {
  4480. var pam : W3PlayerAbilityManager;
  4481.  
  4482. pam = (W3PlayerAbilityManager)abilityManager;
  4483. if(pam && pam.IsInitialized())
  4484. return pam.GetSkillGroupsCount();
  4485.  
  4486. return 0;
  4487. }
  4488.  
  4489.  
  4490.  
  4491.  
  4492.  
  4493.  
  4494.  
  4495.  
  4496. function CycleSelectSign( bIsCyclingLeft : bool ) : ESignType
  4497. {
  4498. var signOrder : array<ESignType>;
  4499. var i : int;
  4500.  
  4501. signOrder.PushBack( ST_Yrden );
  4502. signOrder.PushBack( ST_Quen );
  4503. signOrder.PushBack( ST_Igni );
  4504. signOrder.PushBack( ST_Axii );
  4505. signOrder.PushBack( ST_Aard );
  4506.  
  4507. for( i = 0; i < signOrder.Size(); i += 1 )
  4508. if( signOrder[i] == equippedSign )
  4509. break;
  4510.  
  4511. if(bIsCyclingLeft)
  4512. return signOrder[ (4 + i) % 5 ];
  4513. else
  4514. return signOrder[ (6 + i) % 5 ];
  4515. }
  4516.  
  4517. function ToggleNextSign()
  4518. {
  4519. SetEquippedSign(CycleSelectSign( false ));
  4520. FactsAdd("SignToggled", 1, 1);
  4521. }
  4522.  
  4523. function TogglePreviousSign()
  4524. {
  4525. SetEquippedSign(CycleSelectSign( true ));
  4526. FactsAdd("SignToggled", 1, 1);
  4527. }
  4528.  
  4529. function ProcessSignEvent( eventName : name ) : bool
  4530. {
  4531. if( currentlyCastSign != ST_None && signs[currentlyCastSign].entity)
  4532. {
  4533. return signs[currentlyCastSign].entity.OnProcessSignEvent( eventName );
  4534. }
  4535.  
  4536. return false;
  4537. }
  4538.  
  4539. var findActorTargetTimeStamp : float;
  4540. var pcModeChanneledSignTimeStamp : float;
  4541. event OnProcessCastingOrientation( isContinueCasting : bool )
  4542. {
  4543. var customOrientationTarget : EOrientationTarget;
  4544. var checkHeading : float;
  4545. var rotHeading : float;
  4546. var playerToHeadingDist : float;
  4547. var slideTargetActor : CActor;
  4548. var newLockTarget : CActor;
  4549.  
  4550. var enableNoTargetOrientation : bool;
  4551.  
  4552. var currTime : float;
  4553.  
  4554. enableNoTargetOrientation = true;
  4555. if ( GetDisplayTarget() && this.IsDisplayTargetTargetable() )
  4556. {
  4557. enableNoTargetOrientation = false;
  4558. if ( theInput.GetActionValue( 'CastSignHold' ) > 0 || this.IsCurrentSignChanneled() )
  4559. {
  4560. if ( IsPCModeEnabled() )
  4561. {
  4562. if ( EngineTimeToFloat( theGame.GetEngineTime() ) > pcModeChanneledSignTimeStamp + 1.f )
  4563. enableNoTargetOrientation = true;
  4564. }
  4565. else
  4566. {
  4567. if ( GetCurrentlyCastSign() == ST_Igni || GetCurrentlyCastSign() == ST_Axii )
  4568. {
  4569. slideTargetActor = (CActor)GetDisplayTarget();
  4570. if ( slideTargetActor
  4571. && ( !slideTargetActor.GetGameplayVisibility() || !CanBeTargetedIfSwimming( slideTargetActor ) || !slideTargetActor.IsAlive() ) )
  4572. {
  4573. SetSlideTarget( NULL );
  4574. if ( ProcessLockTarget() )
  4575. slideTargetActor = (CActor)slideTarget;
  4576. }
  4577.  
  4578. if ( !slideTargetActor )
  4579. {
  4580. LockToTarget( false );
  4581. enableNoTargetOrientation = true;
  4582. }
  4583. else if ( IsThreat( slideTargetActor ) || GetCurrentlyCastSign() == ST_Axii )
  4584. LockToTarget( true );
  4585. else
  4586. {
  4587. LockToTarget( false );
  4588. enableNoTargetOrientation = true;
  4589. }
  4590. }
  4591. }
  4592. }
  4593.  
  4594. if ( !enableNoTargetOrientation )
  4595. {
  4596. customOrientationTarget = OT_Actor;
  4597. }
  4598. }
  4599.  
  4600. if ( enableNoTargetOrientation )
  4601. {
  4602. if ( GetPlayerCombatStance() == PCS_AlertNear && theInput.GetActionValue( 'CastSignHold' ) > 0 )
  4603. {
  4604. if ( GetDisplayTarget() && !slideTargetActor )
  4605. {
  4606. currTime = EngineTimeToFloat( theGame.GetEngineTime() );
  4607. if ( currTime > findActorTargetTimeStamp + 1.5f )
  4608. {
  4609. findActorTargetTimeStamp = currTime;
  4610.  
  4611. newLockTarget = GetScreenSpaceLockTarget( GetDisplayTarget(), 180.f, 1.f, 0.f, true );
  4612.  
  4613. if ( newLockTarget && IsThreat( newLockTarget ) && IsCombatMusicEnabled() )
  4614. {
  4615. SetTarget( newLockTarget, true );
  4616. SetMoveTargetChangeAllowed( true );
  4617. SetMoveTarget( newLockTarget );
  4618. SetMoveTargetChangeAllowed( false );
  4619. SetSlideTarget( newLockTarget );
  4620. }
  4621. }
  4622. }
  4623. else
  4624. ProcessLockTarget();
  4625. }
  4626.  
  4627. if ( wasBRAxisPushed )
  4628. customOrientationTarget = OT_CameraOffset;
  4629. else
  4630. {
  4631. if ( !lastAxisInputIsMovement || theInput.LastUsedPCInput() )
  4632. customOrientationTarget = OT_CameraOffset;
  4633. else if ( theInput.GetActionValue( 'CastSignHold' ) > 0 )
  4634. {
  4635. if ( GetOrientationTarget() == OT_CameraOffset )
  4636. customOrientationTarget = OT_CameraOffset;
  4637. else if ( GetPlayerCombatStance() == PCS_AlertNear || GetPlayerCombatStance() == PCS_Guarded )
  4638. customOrientationTarget = OT_CameraOffset;
  4639. else
  4640. customOrientationTarget = OT_Player;
  4641. }
  4642. else
  4643. customOrientationTarget = OT_CustomHeading;
  4644. }
  4645. }
  4646.  
  4647. if ( GetCurrentlyCastSign() == ST_Quen )
  4648. {
  4649. if ( theInput.LastUsedPCInput() )
  4650. {
  4651. customOrientationTarget = OT_Camera;
  4652. }
  4653. else if ( IsCurrentSignChanneled() )
  4654. {
  4655. if ( bLAxisReleased )
  4656. customOrientationTarget = OT_Player;
  4657. else
  4658. customOrientationTarget = OT_Camera;
  4659. }
  4660. else
  4661. customOrientationTarget = OT_Player;
  4662. }
  4663.  
  4664. if ( GetCurrentlyCastSign() == ST_Axii && IsCurrentSignChanneled() )
  4665. {
  4666. if ( slideTarget && (CActor)slideTarget )
  4667. {
  4668. checkHeading = VecHeading( slideTarget.GetWorldPosition() - this.GetWorldPosition() );
  4669. rotHeading = checkHeading;
  4670. playerToHeadingDist = AngleDistance( GetHeading(), checkHeading );
  4671.  
  4672. if ( playerToHeadingDist > 45 )
  4673. SetCustomRotation( 'ChanneledSignAxii', rotHeading, 0.0, 0.5, false );
  4674. else if ( playerToHeadingDist < -45 )
  4675. SetCustomRotation( 'ChanneledSignAxii', rotHeading, 0.0, 0.5, false );
  4676. }
  4677. else
  4678. {
  4679. checkHeading = VecHeading( theCamera.GetCameraDirection() );
  4680. rotHeading = GetHeading();
  4681. playerToHeadingDist = AngleDistance( GetHeading(), checkHeading );
  4682.  
  4683. if ( playerToHeadingDist > 45 )
  4684. SetCustomRotation( 'ChanneledSignAxii', rotHeading - 22.5, 0.0, 0.5, false );
  4685. else if ( playerToHeadingDist < -45 )
  4686. SetCustomRotation( 'ChanneledSignAxii', rotHeading + 22.5, 0.0, 0.5, false );
  4687. }
  4688. }
  4689.  
  4690. if ( IsActorLockedToTarget() )
  4691. customOrientationTarget = OT_Actor;
  4692.  
  4693. AddCustomOrientationTarget( customOrientationTarget, 'Signs' );
  4694.  
  4695. if ( customOrientationTarget == OT_CustomHeading )
  4696. SetOrientationTargetCustomHeading( GetCombatActionHeading(), 'Signs' );
  4697. }
  4698.  
  4699. event OnRaiseSignEvent()
  4700. {
  4701. var newTarget : CActor;
  4702.  
  4703. if ( ( !IsCombatMusicEnabled() && !CanAttackWhenNotInCombat( EBAT_CastSign, false, newTarget ) ) || ( IsOnBoat() && !IsCombatMusicEnabled() ) )
  4704. {
  4705. if ( CastSignFriendly() )
  4706. return true;
  4707. }
  4708. else
  4709. {
  4710. RaiseEvent('CombatActionFriendlyEnd');
  4711. SetBehaviorVariable( 'SignNum', (int)equippedSign );
  4712. SetBehaviorVariable( 'combatActionType', (int)CAT_CastSign );
  4713.  
  4714. if ( IsPCModeEnabled() )
  4715. pcModeChanneledSignTimeStamp = EngineTimeToFloat( theGame.GetEngineTime() );
  4716.  
  4717. if( RaiseForceEvent('CombatAction') )
  4718. {
  4719. OnCombatActionStart();
  4720. findActorTargetTimeStamp = EngineTimeToFloat( theGame.GetEngineTime() );
  4721. theTelemetry.LogWithValueStr(TE_FIGHT_PLAYER_USE_SIGN, SignEnumToString( equippedSign ));
  4722. return true;
  4723. }
  4724. }
  4725.  
  4726. return false;
  4727. }
  4728.  
  4729. function CastSignFriendly() : bool
  4730. {
  4731. var actor : CActor;
  4732.  
  4733. SetBehaviorVariable( 'combatActionTypeForOverlay', (int)CAT_CastSign );
  4734. if ( RaiseCombatActionFriendlyEvent() )
  4735. {
  4736.  
  4737. return true;
  4738. }
  4739.  
  4740. return false;
  4741. }
  4742.  
  4743. function CastSign() : bool
  4744. {
  4745. var equippedSignStr : string;
  4746. var newSignEnt : W3SignEntity;
  4747. var spawnPos : Vector;
  4748. var slotMatrix : Matrix;
  4749. var target : CActor;
  4750.  
  4751. if ( IsInAir() )
  4752. {
  4753. return false;
  4754. }
  4755.  
  4756. AddTemporarySkills();
  4757.  
  4758.  
  4759.  
  4760. if(equippedSign == ST_Aard)
  4761. {
  4762. CalcEntitySlotMatrix('l_weapon', slotMatrix);
  4763. spawnPos = MatrixGetTranslation(slotMatrix);
  4764. }
  4765. else
  4766. {
  4767. spawnPos = GetWorldPosition();
  4768. }
  4769.  
  4770. if( equippedSign == ST_Aard || equippedSign == ST_Igni )
  4771. {
  4772. target = GetTarget();
  4773. if(target)
  4774. target.SignalGameplayEvent( 'DodgeSign' );
  4775. }
  4776.  
  4777. newSignEnt = (W3SignEntity)theGame.CreateEntity( signs[equippedSign].template, spawnPos, GetWorldRotation() );
  4778. return newSignEnt.Init( signOwner, signs[equippedSign].entity );
  4779. }
  4780.  
  4781.  
  4782. private function HAX_SignToThrowItemRestore()
  4783. {
  4784. var action : SInputAction;
  4785.  
  4786. action.value = theInput.GetActionValue('ThrowItemHold');
  4787. action.lastFrameValue = 0;
  4788.  
  4789. if(IsPressed(action) && CanSetupCombatAction_Throw())
  4790. {
  4791. if(inv.IsItemBomb(selectedItemId))
  4792. {
  4793. BombThrowStart();
  4794. }
  4795. else
  4796. {
  4797. UsableItemStart();
  4798. }
  4799.  
  4800. SetThrowHold( true );
  4801. }
  4802. }
  4803.  
  4804. event OnCFMCameraZoomFail(){}
  4805.  
  4806.  
  4807.  
  4808. public final function GetDrunkMutagens() : array<CBaseGameplayEffect>
  4809. {
  4810. return effectManager.GetDrunkMutagens();
  4811. }
  4812.  
  4813. public final function GetPotionBuffs() : array<CBaseGameplayEffect>
  4814. {
  4815. return effectManager.GetPotionBuffs();
  4816. }
  4817.  
  4818. public final function RecalcPotionsDurations()
  4819. {
  4820. var i : int;
  4821. var buffs : array<CBaseGameplayEffect>;
  4822.  
  4823. buffs = GetPotionBuffs();
  4824. for(i=0; i<buffs.Size(); i+=1)
  4825. {
  4826. buffs[i].RecalcPotionDuration();
  4827. }
  4828. }
  4829.  
  4830. public function StartFrenzy()
  4831. {
  4832. var ratio, duration : float;
  4833. var skillLevel : int;
  4834.  
  4835. isInFrenzy = true;
  4836. skillLevel = GetSkillLevel(S_Alchemy_s16);
  4837. ratio = 0.48f - skillLevel * CalculateAttributeValue(GetSkillAttributeValue(S_Alchemy_s16, 'slowdown_ratio', false, true));
  4838. duration = skillLevel * CalculateAttributeValue(GetSkillAttributeValue(S_Alchemy_s16, 'slowdown_duration', false, true));
  4839.  
  4840. theGame.SetTimeScale(ratio, theGame.GetTimescaleSource(ETS_SkillFrenzy), theGame.GetTimescalePriority(ETS_SkillFrenzy) );
  4841. AddTimer('SkillFrenzyFinish', duration * ratio, , , , true);
  4842. }
  4843.  
  4844. timer function SkillFrenzyFinish(dt : float, optional id : int)
  4845. {
  4846. theGame.RemoveTimeScale( theGame.GetTimescaleSource(ETS_SkillFrenzy) );
  4847. isInFrenzy = false;
  4848. }
  4849.  
  4850. public function GetToxicityDamageThreshold() : float
  4851. {
  4852. var ret : float;
  4853.  
  4854. ret = theGame.params.TOXICITY_DAMAGE_THRESHOLD;
  4855.  
  4856. if(CanUseSkill(S_Alchemy_s01))
  4857. ret += CalculateAttributeValue(GetSkillAttributeValue(S_Alchemy_s01, 'threshold', false, true)) * GetSkillLevel(S_Alchemy_s01);
  4858.  
  4859. return ret;
  4860. }
  4861.  
  4862.  
  4863.  
  4864. public final function AddToxicityOffset( val : float)
  4865. {
  4866. ((W3PlayerAbilityManager)abilityManager).AddToxicityOffset(val);
  4867. }
  4868.  
  4869. public final function SetToxicityOffset( val : float)
  4870. {
  4871. ((W3PlayerAbilityManager)abilityManager).SetToxicityOffset(val);
  4872. }
  4873.  
  4874. public final function RemoveToxicityOffset( val : float)
  4875. {
  4876. ((W3PlayerAbilityManager)abilityManager).RemoveToxicityOffset(val);
  4877. }
  4878.  
  4879.  
  4880. public final function CalculatePotionDuration(item : SItemUniqueId, isMutagenPotion : bool, optional itemName : name) : float
  4881. {
  4882. var duration, skillPassiveMod, mutagenSkillMod : float;
  4883. var val, min, max : SAbilityAttributeValue;
  4884.  
  4885.  
  4886. if(inv.IsIdValid(item))
  4887. {
  4888. duration = CalculateAttributeValue(inv.GetItemAttributeValue(item, 'duration'));
  4889. }
  4890. else
  4891. {
  4892. theGame.GetDefinitionsManager().GetItemAttributeValueNoRandom(itemName, true, 'duration', min, max);
  4893. duration = CalculateAttributeValue(GetAttributeRandomizedValue(min, max));
  4894. }
  4895.  
  4896. skillPassiveMod = CalculateAttributeValue(GetAttributeValue('potion_duration'));
  4897.  
  4898. if(isMutagenPotion && CanUseSkill(S_Alchemy_s14))
  4899. {
  4900. val = GetSkillAttributeValue(S_Alchemy_s14, 'duration', false, true);
  4901. mutagenSkillMod = val.valueMultiplicative * GetSkillLevel(S_Alchemy_s14);
  4902. }
  4903.  
  4904. duration = duration * (1 + skillPassiveMod + mutagenSkillMod);
  4905.  
  4906. return duration;
  4907. }
  4908.  
  4909. public function ToxicityLowEnoughToDrinkPotion( slotid : EEquipmentSlots, optional itemId : SItemUniqueId ) : bool
  4910. {
  4911. var item : SItemUniqueId;
  4912. var maxTox : float;
  4913. var potionToxicity : float;
  4914. var toxicityOffset : float;
  4915. var effectType : EEffectType;
  4916. var customAbilityName : name;
  4917.  
  4918. if(itemId != GetInvalidUniqueId())
  4919. item = itemId;
  4920. else
  4921. item = itemSlots[slotid];
  4922.  
  4923. inv.GetPotionItemBuffData(item, effectType, customAbilityName);
  4924. maxTox = abilityManager.GetStatMax(BCS_Toxicity);
  4925. potionToxicity = CalculateAttributeValue(inv.GetItemAttributeValue(item, 'toxicity'));
  4926. toxicityOffset = CalculateAttributeValue(inv.GetItemAttributeValue(item, 'toxicity_offset'));
  4927.  
  4928. if(effectType != EET_WhiteHoney)
  4929. {
  4930. if(abilityManager.GetStat(BCS_Toxicity, false) + potionToxicity + toxicityOffset > maxTox )
  4931. {
  4932. return false;
  4933. }
  4934. }
  4935.  
  4936. return true;
  4937. }
  4938.  
  4939. public function DrinkPreparedPotion( slotid : EEquipmentSlots, optional itemId : SItemUniqueId )
  4940. {
  4941. var i, ind : int;
  4942. var toxicityOffset, adrenaline : float;
  4943. var potionToxicity, duration, hpGainValue, maxTox : float;
  4944. var randomPotions : array<EEffectType>;
  4945. var effectType : EEffectType;
  4946. var customAbilityName, factId : name;
  4947. var ret : EEffectInteract;
  4948. var atts : array<name>;
  4949. var effectsOld, effectsNew : array<CBaseGameplayEffect>;
  4950. var factPotionParams : W3Potion_Fact_Params;
  4951. var potParams : W3PotionParams;
  4952. var mutagenParams : W3MutagenBuffCustomParams;
  4953. var item : SItemUniqueId;
  4954. var params, potionParams : SCustomEffectParams;
  4955. var costReduction : SAbilityAttributeValue;
  4956.  
  4957.  
  4958. if(itemId != GetInvalidUniqueId())
  4959. item = itemId;
  4960. else
  4961. item = itemSlots[slotid];
  4962.  
  4963.  
  4964. if(!inv.IsIdValid(item))
  4965. return;
  4966.  
  4967.  
  4968. if( inv.SingletonItemGetAmmo(item) == 0 )
  4969. return;
  4970.  
  4971.  
  4972. inv.GetPotionItemBuffData(item, effectType, customAbilityName);
  4973. maxTox = abilityManager.GetStatMax(BCS_Toxicity);
  4974. potionToxicity = CalculateAttributeValue(inv.GetItemAttributeValue(item, 'toxicity'));
  4975. toxicityOffset = CalculateAttributeValue(inv.GetItemAttributeValue(item, 'toxicity_offset'));
  4976.  
  4977.  
  4978. if(CanUseSkill(S_Perk_13))
  4979. {
  4980. costReduction = GetSkillAttributeValue(S_Perk_13, 'cost_reduction', false, true);
  4981. adrenaline = FloorF(GetStat(BCS_Focus));
  4982. costReduction = costReduction * adrenaline;
  4983. potionToxicity = (potionToxicity - costReduction.valueBase) * (1 - costReduction.valueMultiplicative) - costReduction.valueAdditive;
  4984. potionToxicity = MaxF(0.f, potionToxicity);
  4985. }
  4986.  
  4987.  
  4988. if(effectType != EET_WhiteHoney)
  4989. {
  4990. if(abilityManager.GetStat(BCS_Toxicity, false) + potionToxicity + toxicityOffset > maxTox )
  4991. return;
  4992. }
  4993.  
  4994.  
  4995. customAbilityName = '';
  4996. inv.GetPotionItemBuffData(item, effectType, customAbilityName);
  4997.  
  4998.  
  4999. if(effectType == EET_Fact)
  5000. {
  5001. inv.GetItemAttributes(item, atts);
  5002.  
  5003. for(i=0; i<atts.Size(); i+=1)
  5004. {
  5005. if(StrBeginsWith(NameToString(atts[i]), "fact_"))
  5006. {
  5007. factId = atts[i];
  5008. break;
  5009. }
  5010. }
  5011.  
  5012. factPotionParams = new W3Potion_Fact_Params in theGame;
  5013. factPotionParams.factName = factId;
  5014. factPotionParams.potionItemName = inv.GetItemName(item);
  5015.  
  5016. potionParams.buffSpecificParams = factPotionParams;
  5017. }
  5018.  
  5019. else if(inv.ItemHasTag( item, 'Mutagen' ))
  5020. {
  5021. mutagenParams = new W3MutagenBuffCustomParams in theGame;
  5022. mutagenParams.toxicityOffset = toxicityOffset;
  5023. mutagenParams.potionItemName = inv.GetItemName(item);
  5024.  
  5025. potionParams.buffSpecificParams = mutagenParams;
  5026. }
  5027.  
  5028. else
  5029. {
  5030. potParams = new W3PotionParams in theGame;
  5031. potParams.potionItemName = inv.GetItemName(item);
  5032.  
  5033. potionParams.buffSpecificParams = potParams;
  5034. }
  5035.  
  5036.  
  5037. duration = CalculatePotionDuration(item, inv.ItemHasTag( item, 'Mutagen' ));
  5038.  
  5039.  
  5040. potionParams.effectType = effectType;
  5041. potionParams.creator = this;
  5042. potionParams.sourceName = "drank_potion";
  5043. potionParams.duration = duration;
  5044. potionParams.customAbilityName = customAbilityName;
  5045. ret = AddEffectCustom(potionParams);
  5046.  
  5047.  
  5048. if(factPotionParams)
  5049. delete factPotionParams;
  5050.  
  5051. if(mutagenParams)
  5052. delete mutagenParams;
  5053.  
  5054.  
  5055. inv.SingletonItemRemoveAmmo(item);
  5056.  
  5057.  
  5058. if(ret == EI_Pass || ret == EI_Override || ret == EI_Cumulate)
  5059. {
  5060. abilityManager.GainStat(BCS_Toxicity, potionToxicity );
  5061.  
  5062.  
  5063. if(CanUseSkill(S_Perk_13))
  5064. {
  5065. abilityManager.DrainFocus(adrenaline);
  5066. }
  5067.  
  5068. if (!IsEffectActive('invisible'))
  5069. {
  5070. PlayEffect('use_potion');
  5071. }
  5072.  
  5073. if ( inv.ItemHasTag( item, 'Mutagen' ) )
  5074. {
  5075.  
  5076. theGame.GetGamerProfile().CheckTrialOfGrasses();
  5077.  
  5078.  
  5079. SetFailedFundamentalsFirstAchievementCondition(true);
  5080. }
  5081.  
  5082.  
  5083. if(CanUseSkill(S_Alchemy_s02))
  5084. {
  5085. hpGainValue = ClampF(GetStatMax(BCS_Vitality) * CalculateAttributeValue(GetSkillAttributeValue(S_Alchemy_s02, 'vitality_gain_perc', false, true)) * GetSkillLevel(S_Alchemy_s02), 0, GetStatMax(BCS_Vitality));
  5086. GainStat(BCS_Vitality, hpGainValue);
  5087. }
  5088.  
  5089. if(CanUseSkill(S_Alchemy_s04) && !skillBonusPotionEffect && (RandF() < CalculateAttributeValue(GetSkillAttributeValue(S_Alchemy_s04, 'apply_chance', false, true)) * GetSkillLevel(S_Alchemy_s04)))
  5090. {
  5091.  
  5092. randomPotions.PushBack(EET_BlackBlood);
  5093. randomPotions.PushBack(EET_Blizzard);
  5094. randomPotions.PushBack(EET_Cat);
  5095. randomPotions.PushBack(EET_FullMoon);
  5096. randomPotions.PushBack(EET_GoldenOriole);
  5097. randomPotions.PushBack(EET_KillerWhale);
  5098. randomPotions.PushBack(EET_MariborForest);
  5099. randomPotions.PushBack(EET_PetriPhiltre);
  5100. randomPotions.PushBack(EET_Swallow);
  5101. randomPotions.PushBack(EET_TawnyOwl);
  5102. randomPotions.PushBack(EET_Thunderbolt);
  5103. randomPotions.PushBack(EET_WhiteRaffardDecoction);
  5104.  
  5105.  
  5106. randomPotions.Remove(effectType);
  5107. ind = RandRange(randomPotions.Size());
  5108.  
  5109. duration = BonusPotionGetDurationFromXML(randomPotions[ind]);
  5110.  
  5111. if(duration > 0)
  5112. {
  5113. effectsOld = GetCurrentEffects();
  5114.  
  5115. params.effectType = randomPotions[ind];
  5116. params.creator = this;
  5117. params.sourceName = SkillEnumToName(S_Alchemy_s04);
  5118. params.duration = duration;
  5119. ret = AddEffectCustom(params);
  5120.  
  5121.  
  5122. if(ret != EI_Undefined && ret != EI_Deny)
  5123. {
  5124. effectsNew = GetCurrentEffects();
  5125.  
  5126. ind = -1;
  5127. for(i=0; i<effectsNew.Size(); i+=1)
  5128. {
  5129. if(!effectsOld.Contains(effectsNew[i]))
  5130. {
  5131. ind = i;
  5132. break;
  5133. }
  5134. }
  5135.  
  5136. if(ind > -1)
  5137. {
  5138. skillBonusPotionEffect = effectsNew[ind];
  5139. }
  5140. }
  5141. }
  5142. }
  5143.  
  5144. theGame.GetGamerProfile().SetStat(ES_ActivePotions, effectManager.GetPotionBuffsCount());
  5145. }
  5146.  
  5147. theTelemetry.LogWithLabel(TE_ELIXIR_USED, inv.GetItemName(item));
  5148.  
  5149. if(ShouldProcessTutorial('TutorialPotionAmmo'))
  5150. {
  5151. FactsAdd("tut_used_potion");
  5152. }
  5153.  
  5154. SetFailedFundamentalsFirstAchievementCondition(true);
  5155. }
  5156.  
  5157.  
  5158. private function BonusPotionGetDurationFromXML(type : EEffectType) : float
  5159. {
  5160. var dm : CDefinitionsManagerAccessor;
  5161. var main, ingredients : SCustomNode;
  5162. var tmpName, typeName, itemName : name;
  5163. var abs : array<name>;
  5164. var min, max : SAbilityAttributeValue;
  5165. var tmpInt : int;
  5166. var temp : array<float>;
  5167. var i, temp2, temp3 : int;
  5168.  
  5169. dm = theGame.GetDefinitionsManager();
  5170. main = dm.GetCustomDefinition('alchemy_recipes');
  5171. typeName = EffectTypeToName(type);
  5172.  
  5173.  
  5174. for(i=0; i<main.subNodes.Size(); i+=1)
  5175. {
  5176. if(dm.GetCustomNodeAttributeValueName(main.subNodes[i], 'type_name', tmpName))
  5177. {
  5178.  
  5179. if(tmpName == typeName)
  5180. {
  5181. if(dm.GetCustomNodeAttributeValueInt(main.subNodes[i], 'level', tmpInt))
  5182. {
  5183.  
  5184. if(tmpInt == 1)
  5185. {
  5186. if(dm.GetCustomNodeAttributeValueName(main.subNodes[i], 'cookedItem_name', itemName))
  5187. {
  5188.  
  5189. if(IsNameValid(itemName))
  5190. {
  5191. break;
  5192. }
  5193. }
  5194. }
  5195. }
  5196. }
  5197. }
  5198. }
  5199.  
  5200. if(!IsNameValid(itemName))
  5201. return 0;
  5202.  
  5203.  
  5204. dm.GetItemAbilitiesWithWeights(itemName, true, abs, temp, temp2, temp3);
  5205. dm.GetAbilitiesAttributeValue(abs, 'duration', min, max);
  5206. return CalculateAttributeValue(GetAttributeRandomizedValue(min, max));
  5207. }
  5208.  
  5209. public function ClearSkillBonusPotionEffect()
  5210. {
  5211. skillBonusPotionEffect = NULL;
  5212. }
  5213.  
  5214. public function GetSkillBonusPotionEffect() : CBaseGameplayEffect
  5215. {
  5216. return skillBonusPotionEffect;
  5217. }
  5218.  
  5219.  
  5220.  
  5221.  
  5222.  
  5223.  
  5224.  
  5225. public final function HasRunewordActive(abilityName : name) : bool
  5226. {
  5227. var item : SItemUniqueId;
  5228. var hasRuneword : bool;
  5229.  
  5230. if(GetItemEquippedOnSlot(EES_SteelSword, item))
  5231. {
  5232. hasRuneword = inv.ItemHasAbility(item, abilityName);
  5233. }
  5234.  
  5235. if(!hasRuneword)
  5236. {
  5237. if(GetItemEquippedOnSlot(EES_SilverSword, item))
  5238. {
  5239. hasRuneword = inv.ItemHasAbility(item, abilityName);
  5240. }
  5241. }
  5242.  
  5243. return hasRuneword;
  5244. }
  5245.  
  5246. public final function GetShrineBuffs() : array<CBaseGameplayEffect>
  5247. {
  5248. var null : array<CBaseGameplayEffect>;
  5249.  
  5250. if(effectManager && effectManager.IsReady())
  5251. return effectManager.GetShrineBuffs();
  5252.  
  5253. return null;
  5254. }
  5255.  
  5256. public final function AddRepairObjectBuff(armor : bool, weapon : bool) : bool
  5257. {
  5258. var added : bool;
  5259.  
  5260. added = false;
  5261.  
  5262. if(weapon && (IsAnyItemEquippedOnSlot(EES_SilverSword) || IsAnyItemEquippedOnSlot(EES_SteelSword)) )
  5263. {
  5264. AddEffectDefault(EET_EnhancedWeapon, this, "repair_object", false);
  5265. added = true;
  5266. }
  5267.  
  5268. if(armor && (IsAnyItemEquippedOnSlot(EES_Armor) || IsAnyItemEquippedOnSlot(EES_Gloves) || IsAnyItemEquippedOnSlot(EES_Boots) || IsAnyItemEquippedOnSlot(EES_Pants)) )
  5269. {
  5270. AddEffectDefault(EET_EnhancedArmor, this, "repair_object", false);
  5271. added = true;
  5272. }
  5273.  
  5274. return added;
  5275. }
  5276.  
  5277.  
  5278. public function StartCSAnim(buff : CBaseGameplayEffect) : bool
  5279. {
  5280.  
  5281. if(IsAnyQuenActive() && (W3CriticalDOTEffect)buff)
  5282. return false;
  5283.  
  5284. return super.StartCSAnim(buff);
  5285. }
  5286.  
  5287. public function GetPotionBuffLevel(effectType : EEffectType) : int
  5288. {
  5289. if(effectManager && effectManager.IsReady())
  5290. return effectManager.GetPotionBuffLevel(effectType);
  5291.  
  5292. return 0;
  5293. }
  5294.  
  5295.  
  5296.  
  5297.  
  5298.  
  5299.  
  5300.  
  5301. event OnLevelGained(currentLevel : int, show : bool)
  5302. {
  5303. var hud : CR4ScriptedHud;
  5304. hud = (CR4ScriptedHud)theGame.GetHud();
  5305.  
  5306. if(abilityManager && abilityManager.IsInitialized())
  5307. {
  5308. ((W3PlayerAbilityManager)abilityManager).OnLevelGained(currentLevel);
  5309. }
  5310.  
  5311. if ( theGame.GetDifficultyMode() != EDM_Hardcore )
  5312. {
  5313. Heal(GetStatMax(BCS_Vitality));
  5314. }
  5315.  
  5316.  
  5317. if(currentLevel >= 35)
  5318. {
  5319. theGame.GetGamerProfile().AddAchievement(EA_Immortal);
  5320. }
  5321.  
  5322. if ( hud && currentLevel < 70 )
  5323. {
  5324. hud.OnLevelUpUpdate(currentLevel, show);
  5325. }
  5326.  
  5327. theGame.RequestAutoSave( "level gained", false );
  5328. }
  5329.  
  5330. public function GetSignStats(skill : ESkill, out damageType : name, out damageVal : float, out spellPower : SAbilityAttributeValue)
  5331. {
  5332. var i, size : int;
  5333. var dm : CDefinitionsManagerAccessor;
  5334. var attrs : array<name>;
  5335.  
  5336. spellPower = GetPowerStatValue(CPS_SpellPower);
  5337.  
  5338. dm = theGame.GetDefinitionsManager();
  5339. dm.GetAbilityAttributes(GetSkillAbilityName(skill), attrs);
  5340. size = attrs.Size();
  5341.  
  5342. for( i = 0; i < size; i += 1 )
  5343. {
  5344. if( IsDamageTypeNameValid(attrs[i]) )
  5345. {
  5346. damageVal = CalculateAttributeValue(GetSkillAttributeValue(skill, attrs[i], false, true));
  5347. damageType = attrs[i];
  5348. break;
  5349. }
  5350. }
  5351. }
  5352.  
  5353.  
  5354. public function SetIgnorePainMaxVitality(val : float)
  5355. {
  5356. if(abilityManager && abilityManager.IsInitialized())
  5357. abilityManager.SetStatPointMax(BCS_Vitality, val);
  5358. }
  5359.  
  5360. event OnAnimEvent_ActionBlend( animEventName : name, animEventType : EAnimationEventType, animInfo : SAnimationEventAnimInfo )
  5361. {
  5362. if ( animEventType == AET_DurationStart && !disableActionBlend )
  5363. {
  5364. if ( this.IsCastingSign() )
  5365. ProcessSignEvent( 'cast_end' );
  5366.  
  5367.  
  5368. FindMoveTarget();
  5369. SetCanPlayHitAnim( true );
  5370. this.SetBIsCombatActionAllowed( true );
  5371.  
  5372. if ( this.GetFinisherVictim() && this.GetFinisherVictim().HasAbility( 'ForceFinisher' ) )
  5373. {
  5374. this.GetFinisherVictim().SignalGameplayEvent( 'Finisher' );
  5375. }
  5376. else if (this.BufferCombatAction != EBAT_EMPTY )
  5377. {
  5378.  
  5379.  
  5380.  
  5381. if ( !IsCombatMusicEnabled() )
  5382. {
  5383. SetCombatActionHeading( ProcessCombatActionHeading( this.BufferCombatAction ) );
  5384. FindTarget();
  5385. UpdateDisplayTarget( true );
  5386. }
  5387.  
  5388. if ( AllowAttack( GetTarget(), this.BufferCombatAction ) )
  5389. this.ProcessCombatActionBuffer();
  5390. }
  5391. else
  5392. {
  5393.  
  5394. ResumeEffects(EET_AutoStaminaRegen, 'InsideCombatAction');
  5395.  
  5396.  
  5397.  
  5398. }
  5399. }
  5400. else if ( disableActionBlend )
  5401. {
  5402. disableActionBlend = false;
  5403. }
  5404. }
  5405.  
  5406.  
  5407. event OnAnimEvent_Sign( animEventName : name, animEventType : EAnimationEventType, animInfo : SAnimationEventAnimInfo )
  5408. {
  5409. if( animEventType == AET_Tick )
  5410. {
  5411. ProcessSignEvent( animEventName );
  5412. }
  5413. }
  5414.  
  5415. event OnAnimEvent_Throwable( animEventName : name, animEventType : EAnimationEventType, animInfo : SAnimationEventAnimInfo )
  5416. {
  5417. var thrownEntity : CThrowable;
  5418.  
  5419. thrownEntity = (CThrowable)EntityHandleGet( thrownEntityHandle );
  5420.  
  5421. if ( inv.IsItemCrossbow( inv.GetItemFromSlot('l_weapon') ) && rangedWeapon.OnProcessThrowEvent( animEventName ) )
  5422. {
  5423. return true;
  5424. }
  5425. else if( thrownEntity && IsThrowingItem() && thrownEntity.OnProcessThrowEvent( animEventName ) )
  5426. {
  5427. return true;
  5428. }
  5429. }
  5430.  
  5431. public function IsInCombatAction_SpecialAttack() : bool
  5432. {
  5433. if ( IsInCombatAction() && ( GetCombatAction() == EBAT_SpecialAttack_Light || GetCombatAction() == EBAT_SpecialAttack_Heavy ) )
  5434. return true;
  5435. else
  5436. return false;
  5437. }
  5438.  
  5439. protected function WhenCombatActionIsFinished()
  5440. {
  5441. super.WhenCombatActionIsFinished();
  5442. RemoveTimer( 'ProcessAttackTimer' );
  5443. RemoveTimer( 'AttackTimerEnd' );
  5444. CastSignAbort();
  5445. specialAttackCamera = false;
  5446. this.OnPerformSpecialAttack( true, false );
  5447. }
  5448.  
  5449. event OnCombatActionEnd()
  5450. {
  5451. this.CleanCombatActionBuffer();
  5452. super.OnCombatActionEnd();
  5453.  
  5454. RemoveTemporarySkills();
  5455. }
  5456.  
  5457. event OnCombatActionFriendlyEnd()
  5458. {
  5459. if ( IsCastingSign() )
  5460. {
  5461. SetBehaviorVariable( 'IsCastingSign', 0 );
  5462. SetCurrentlyCastSign( ST_None, NULL );
  5463. LogChannel( 'ST_None', "ST_None" );
  5464. }
  5465.  
  5466. super.OnCombatActionFriendlyEnd();
  5467. }
  5468.  
  5469.  
  5470.  
  5471. timer function OpenRadialMenu( time: float, id : int )
  5472. {
  5473.  
  5474. if( GetBIsCombatActionAllowed() && !IsUITakeInput() )
  5475. {
  5476. bShowRadialMenu = true;
  5477. }
  5478.  
  5479. this.RemoveTimer('OpenRadialMenu');
  5480. }
  5481.  
  5482. public function OnAddRadialMenuOpenTimer( )
  5483. {
  5484.  
  5485.  
  5486.  
  5487.  
  5488.  
  5489. this.AddTimer('OpenRadialMenu', _HoldBeforeOpenRadialMenuTime * theGame.GetTimeScale() );
  5490.  
  5491. }
  5492.  
  5493. public function SetShowRadialMenuOpenFlag( bSet : bool )
  5494. {
  5495.  
  5496. bShowRadialMenu = bSet;
  5497. }
  5498.  
  5499. public function OnRemoveRadialMenuOpenTimer()
  5500. {
  5501.  
  5502. this.RemoveTimer('OpenRadialMenu');
  5503. }
  5504.  
  5505. public function ResetRadialMenuOpenTimer()
  5506. {
  5507.  
  5508. this.RemoveTimer('OpenRadialMenu');
  5509. if( GetBIsCombatActionAllowed() )
  5510. {
  5511.  
  5512.  
  5513. AddTimer('OpenRadialMenu', _HoldBeforeOpenRadialMenuTime * theGame.GetTimeScale() );
  5514. }
  5515. }
  5516.  
  5517.  
  5518.  
  5519. timer function ResendCompanionDisplayName(dt : float, id : int)
  5520. {
  5521. var hud : CR4ScriptedHud;
  5522. var companionModule : CR4HudModuleCompanion;
  5523.  
  5524. hud = (CR4ScriptedHud)theGame.GetHud();
  5525. if( hud )
  5526. {
  5527. companionModule = (CR4HudModuleCompanion)hud.GetHudModule("CompanionModule");
  5528. if( companionModule )
  5529. {
  5530. companionModule.ResendDisplayName();
  5531. }
  5532. }
  5533. }
  5534.  
  5535. timer function ResendCompanionDisplayNameSecond(dt : float, id : int)
  5536. {
  5537. var hud : CR4ScriptedHud;
  5538. var companionModule : CR4HudModuleCompanion;
  5539.  
  5540. hud = (CR4ScriptedHud)theGame.GetHud();
  5541. if( hud )
  5542. {
  5543. companionModule = (CR4HudModuleCompanion)hud.GetHudModule("CompanionModule");
  5544. if( companionModule )
  5545. {
  5546. companionModule.ResendDisplayNameSecond();
  5547. }
  5548. }
  5549. }
  5550.  
  5551. public function RemoveCompanionDisplayNameTimer()
  5552. {
  5553. this.RemoveTimer('ResendCompanionDisplayName');
  5554. }
  5555.  
  5556. public function RemoveCompanionDisplayNameTimerSecond()
  5557. {
  5558. this.RemoveTimer('ResendCompanionDisplayNameSecond');
  5559. }
  5560.  
  5561.  
  5562. public function GetCompanionNPCTag() : name
  5563. {
  5564. return companionNPCTag;
  5565. }
  5566.  
  5567. public function SetCompanionNPCTag( value : name )
  5568. {
  5569. companionNPCTag = value;
  5570. }
  5571.  
  5572. public function GetCompanionNPCTag2() : name
  5573. {
  5574. return companionNPCTag2;
  5575. }
  5576.  
  5577. public function SetCompanionNPCTag2( value : name )
  5578. {
  5579. companionNPCTag2 = value;
  5580. }
  5581.  
  5582. public function GetCompanionNPCIconPath() : string
  5583. {
  5584. return companionNPCIconPath;
  5585. }
  5586.  
  5587. public function SetCompanionNPCIconPath( value : string )
  5588. {
  5589. companionNPCIconPath = value;
  5590. }
  5591.  
  5592. public function GetCompanionNPCIconPath2() : string
  5593. {
  5594. return companionNPCIconPath2;
  5595. }
  5596.  
  5597. public function SetCompanionNPCIconPath2( value : string )
  5598. {
  5599. companionNPCIconPath2 = value;
  5600. }
  5601.  
  5602.  
  5603.  
  5604. public function ReactToBeingHit(damageAction : W3DamageAction, optional buffNotApplied : bool) : bool
  5605. {
  5606. var chance : float;
  5607. var procQuen : W3SignEntity;
  5608.  
  5609. if(!damageAction.IsDoTDamage() && damageAction.DealsAnyDamage())
  5610. {
  5611. if(inv.IsItemBomb(selectedItemId))
  5612. {
  5613. BombThrowAbort();
  5614. }
  5615. else
  5616. {
  5617.  
  5618. ThrowingAbort();
  5619. }
  5620. }
  5621.  
  5622.  
  5623. if(damageAction.IsActionRanged())
  5624. {
  5625. chance = CalculateAttributeValue(GetAttributeValue('quen_chance_on_projectile'));
  5626. if(chance > 0)
  5627. {
  5628. chance = ClampF(chance, 0, 1);
  5629.  
  5630. if(RandF() < chance)
  5631. {
  5632. procQuen = (W3SignEntity)theGame.CreateEntity(signs[ST_Quen].template, GetWorldPosition(), GetWorldRotation() );
  5633. procQuen.Init(signOwner, signs[ST_Quen].entity, true );
  5634. procQuen.OnStarted();
  5635. procQuen.OnThrowing();
  5636. procQuen.OnEnded();
  5637. }
  5638. }
  5639. }
  5640.  
  5641.  
  5642. if( !((W3Effect_Toxicity)damageAction.causer) )
  5643. MeditationForceAbort(true);
  5644.  
  5645.  
  5646. if(IsDoingSpecialAttack(false))
  5647. damageAction.SetHitAnimationPlayType(EAHA_ForceNo);
  5648.  
  5649. return super.ReactToBeingHit(damageAction, buffNotApplied);
  5650. }
  5651.  
  5652. protected function ShouldPauseHealthRegenOnHit() : bool
  5653. {
  5654.  
  5655. if( (HasBuff(EET_Swallow) && GetPotionBuffLevel(EET_Swallow) >= 3) || HasBuff(EET_Runeword8) )
  5656. return false;
  5657.  
  5658. return true;
  5659. }
  5660.  
  5661. public function SetMappinToHighlight( mappinName : name, mappinState : bool )
  5662. {
  5663. var mappinDef : SHighlightMappin;
  5664. mappinDef.MappinName = mappinName;
  5665. mappinDef.MappinState = mappinState;
  5666. MappinToHighlight.PushBack(mappinDef);
  5667. }
  5668.  
  5669. public function ClearMappinToHighlight()
  5670. {
  5671. MappinToHighlight.Clear();
  5672. }
  5673.  
  5674. public function CastSignAbort()
  5675. {
  5676. if( currentlyCastSign != ST_None && signs[currentlyCastSign].entity)
  5677. {
  5678. signs[currentlyCastSign].entity.OnSignAborted();
  5679. }
  5680.  
  5681.  
  5682. }
  5683.  
  5684. event OnBlockingSceneStarted( scene: CStoryScene )
  5685. {
  5686. var med : W3PlayerWitcherStateMeditationWaiting;
  5687.  
  5688.  
  5689. med = (W3PlayerWitcherStateMeditationWaiting)GetCurrentState();
  5690. if(med)
  5691. {
  5692. med.StopRequested(true);
  5693. }
  5694.  
  5695.  
  5696. super.OnBlockingSceneStarted( scene );
  5697. }
  5698.  
  5699.  
  5700.  
  5701.  
  5702.  
  5703. public function GetHorseManager() : W3HorseManager
  5704. {
  5705. return (W3HorseManager)EntityHandleGet( horseManagerHandle );
  5706. }
  5707.  
  5708.  
  5709. public function HorseEquipItem(horsesItemId : SItemUniqueId) : bool
  5710. {
  5711. var man : W3HorseManager;
  5712.  
  5713. man = GetHorseManager();
  5714. if(man)
  5715. return man.EquipItem(horsesItemId) != GetInvalidUniqueId();
  5716.  
  5717. return false;
  5718. }
  5719.  
  5720.  
  5721. public function HorseUnequipItem(slot : EEquipmentSlots) : bool
  5722. {
  5723. var man : W3HorseManager;
  5724.  
  5725. man = GetHorseManager();
  5726. if(man)
  5727. return man.UnequipItem(slot) != GetInvalidUniqueId();
  5728.  
  5729. return false;
  5730. }
  5731.  
  5732.  
  5733. public final function HorseRemoveItemByName(itemName : name, quantity : int)
  5734. {
  5735. var man : W3HorseManager;
  5736.  
  5737. man = GetHorseManager();
  5738. if(man)
  5739. man.HorseRemoveItemByName(itemName, quantity);
  5740. }
  5741.  
  5742.  
  5743. public final function HorseRemoveItemByCategory(itemCategory : name, quantity : int)
  5744. {
  5745. var man : W3HorseManager;
  5746.  
  5747. man = GetHorseManager();
  5748. if(man)
  5749. man.HorseRemoveItemByCategory(itemCategory, quantity);
  5750. }
  5751.  
  5752.  
  5753. public final function HorseRemoveItemByTag(itemTag : name, quantity : int)
  5754. {
  5755. var man : W3HorseManager;
  5756.  
  5757. man = GetHorseManager();
  5758. if(man)
  5759. man.HorseRemoveItemByTag(itemTag, quantity);
  5760. }
  5761.  
  5762. public function GetAssociatedInventory() : CInventoryComponent
  5763. {
  5764. var man : W3HorseManager;
  5765.  
  5766. man = GetHorseManager();
  5767. if(man)
  5768. return man.GetInventoryComponent();
  5769.  
  5770. return NULL;
  5771. }
  5772.  
  5773.  
  5774.  
  5775.  
  5776.  
  5777. public final function TutorialMutagensUnequipPlayerSkills() : array<STutorialSavedSkill>
  5778. {
  5779. var pam : W3PlayerAbilityManager;
  5780.  
  5781. pam = (W3PlayerAbilityManager)abilityManager;
  5782. return pam.TutorialMutagensUnequipPlayerSkills();
  5783. }
  5784.  
  5785. public final function TutorialMutagensEquipOneGoodSkill()
  5786. {
  5787. var pam : W3PlayerAbilityManager;
  5788.  
  5789. pam = (W3PlayerAbilityManager)abilityManager;
  5790. pam.TutorialMutagensEquipOneGoodSkill();
  5791. }
  5792.  
  5793. public final function TutorialMutagensEquipOneGoodOneBadSkill()
  5794. {
  5795. var pam : W3PlayerAbilityManager;
  5796.  
  5797. pam = (W3PlayerAbilityManager)abilityManager;
  5798. if(pam)
  5799. pam.TutorialMutagensEquipOneGoodOneBadSkill();
  5800. }
  5801.  
  5802. public final function TutorialMutagensEquipThreeGoodSkills()
  5803. {
  5804. var pam : W3PlayerAbilityManager;
  5805.  
  5806. pam = (W3PlayerAbilityManager)abilityManager;
  5807. if(pam)
  5808. pam.TutorialMutagensEquipThreeGoodSkills();
  5809. }
  5810.  
  5811. public final function TutorialMutagensCleanupTempSkills(savedEquippedSkills : array<STutorialSavedSkill>)
  5812. {
  5813. var pam : W3PlayerAbilityManager;
  5814.  
  5815. pam = (W3PlayerAbilityManager)abilityManager;
  5816. return pam.TutorialMutagensCleanupTempSkills(savedEquippedSkills);
  5817. }
  5818.  
  5819.  
  5820.  
  5821.  
  5822.  
  5823. public function GetOffenseStatsList() : SPlayerOffenseStats
  5824. {
  5825. var playerOffenseStats:SPlayerOffenseStats;
  5826. var steelDmg, silverDmg, elementalSteel, elementalSilver : float;
  5827. var steelCritChance, steelCritDmg : float;
  5828. var silverCritChance, silverCritDmg : float;
  5829. var attackPower : SAbilityAttributeValue;
  5830. var fastCritChance, fastCritDmg : float;
  5831. var strongCritChance, strongCritDmg : float;
  5832. var fastAP, strongAP : SAbilityAttributeValue;
  5833. var item, crossbow : SItemUniqueId;
  5834. var value : SAbilityAttributeValue;
  5835. var mutagen : CBaseGameplayEffect;
  5836. var thunder : W3Potion_Thunderbolt;
  5837.  
  5838. if(!abilityManager || !abilityManager.IsInitialized())
  5839. return playerOffenseStats;
  5840.  
  5841. if (CanUseSkill(S_Sword_s21))
  5842. fastAP += GetSkillAttributeValue(S_Sword_s21, PowerStatEnumToName(CPS_AttackPower), false, true) * GetSkillLevel(S_Sword_s21);
  5843. if (CanUseSkill(S_Perk_05))
  5844. {
  5845. fastAP += GetAttributeValue('attack_power_fast_style');
  5846. fastCritDmg += CalculateAttributeValue(GetAttributeValue('critical_hit_chance_fast_style'));
  5847. strongCritDmg += CalculateAttributeValue(GetAttributeValue('critical_hit_chance_fast_style'));
  5848. }
  5849. if (CanUseSkill(S_Sword_s04))
  5850. strongAP += GetSkillAttributeValue(S_Sword_s04, PowerStatEnumToName(CPS_AttackPower), false, true) * GetSkillLevel(S_Sword_s04);
  5851. if (CanUseSkill(S_Perk_07))
  5852. strongAP += GetAttributeValue('attack_power_heavy_style');
  5853.  
  5854. if (CanUseSkill(S_Sword_s17))
  5855. {
  5856. fastCritChance += CalculateAttributeValue(GetSkillAttributeValue(S_Sword_s17, theGame.params.CRITICAL_HIT_CHANCE, false, true)) * GetSkillLevel(S_Sword_s17);
  5857. fastCritDmg += CalculateAttributeValue(GetSkillAttributeValue(S_Sword_s17, theGame.params.CRITICAL_HIT_DAMAGE_BONUS, false, true)) * GetSkillLevel(S_Sword_s17);
  5858. }
  5859.  
  5860. if (CanUseSkill(S_Sword_s08))
  5861. {
  5862. strongCritChance += CalculateAttributeValue(GetSkillAttributeValue(S_Sword_s08, theGame.params.CRITICAL_HIT_CHANCE, false, true)) * GetSkillLevel(S_Sword_s08);
  5863. strongCritDmg += CalculateAttributeValue(GetSkillAttributeValue(S_Sword_s08, theGame.params.CRITICAL_HIT_DAMAGE_BONUS, false, true)) * GetSkillLevel(S_Sword_s08);
  5864. }
  5865.  
  5866. if ( HasBuff(EET_Mutagen05) && (GetStat(BCS_Vitality) == GetStatMax(BCS_Vitality)) )
  5867. {
  5868. attackPower += GetAttributeValue('damageIncrease');
  5869. }
  5870.  
  5871. steelCritChance += CalculateAttributeValue(GetAttributeValue(theGame.params.CRITICAL_HIT_CHANCE));
  5872. silverCritChance += CalculateAttributeValue(GetAttributeValue(theGame.params.CRITICAL_HIT_CHANCE));
  5873. steelCritDmg += CalculateAttributeValue(GetAttributeValue(theGame.params.CRITICAL_HIT_DAMAGE_BONUS));
  5874. silverCritDmg += CalculateAttributeValue(GetAttributeValue(theGame.params.CRITICAL_HIT_DAMAGE_BONUS));
  5875. attackPower += GetPowerStatValue(CPS_AttackPower);
  5876.  
  5877. if (GetItemEquippedOnSlot(EES_SteelSword, item))
  5878. {
  5879. steelDmg = GetTotalWeaponDamage(item, theGame.params.DAMAGE_NAME_SLASHING, GetInvalidUniqueId());
  5880. steelDmg += GetTotalWeaponDamage(item, theGame.params.DAMAGE_NAME_PIERCING, GetInvalidUniqueId());
  5881. steelDmg += GetTotalWeaponDamage(item, theGame.params.DAMAGE_NAME_BLUDGEONING, GetInvalidUniqueId());
  5882. elementalSteel = CalculateAttributeValue(GetInventory().GetItemAttributeValue(item, theGame.params.DAMAGE_NAME_FIRE));
  5883. elementalSteel += CalculateAttributeValue(GetInventory().GetItemAttributeValue(item, theGame.params.DAMAGE_NAME_FROST));
  5884. if ( GetInventory().IsItemHeld(item) )
  5885. {
  5886. steelCritChance -= CalculateAttributeValue(GetInventory().GetItemAttributeValue(item, theGame.params.CRITICAL_HIT_CHANCE));
  5887. silverCritChance -= CalculateAttributeValue(GetInventory().GetItemAttributeValue(item, theGame.params.CRITICAL_HIT_CHANCE));
  5888. steelCritDmg -= CalculateAttributeValue(GetInventory().GetItemAttributeValue(item, theGame.params.CRITICAL_HIT_DAMAGE_BONUS));
  5889. silverCritDmg -= CalculateAttributeValue(GetInventory().GetItemAttributeValue(item, theGame.params.CRITICAL_HIT_DAMAGE_BONUS));
  5890. }
  5891. steelCritChance += CalculateAttributeValue(GetInventory().GetItemAttributeValue(item, theGame.params.CRITICAL_HIT_CHANCE));
  5892. steelCritDmg += CalculateAttributeValue(GetInventory().GetItemAttributeValue(item, theGame.params.CRITICAL_HIT_DAMAGE_BONUS));
  5893.  
  5894. thunder = (W3Potion_Thunderbolt)GetBuff(EET_Thunderbolt);
  5895. if(thunder && thunder.GetBuffLevel() == 3 && GetCurWeather() == EWE_Storm)
  5896. {
  5897. steelCritChance += 1.0f;
  5898. }
  5899. }
  5900. else
  5901. {
  5902. steelDmg += 0;
  5903. steelCritChance += 0;
  5904. steelCritDmg +=0;
  5905. }
  5906.  
  5907. if (GetItemEquippedOnSlot(EES_SilverSword, item))
  5908. {
  5909. silverDmg = GetTotalWeaponDamage(item, theGame.params.DAMAGE_NAME_SILVER, GetInvalidUniqueId());
  5910. elementalSilver = CalculateAttributeValue(GetInventory().GetItemAttributeValue(item, theGame.params.DAMAGE_NAME_FIRE));
  5911. elementalSilver += CalculateAttributeValue(GetInventory().GetItemAttributeValue(item, theGame.params.DAMAGE_NAME_FROST));
  5912. if ( GetInventory().IsItemHeld(item) )
  5913. {
  5914. steelCritChance -= CalculateAttributeValue(GetInventory().GetItemAttributeValue(item, theGame.params.CRITICAL_HIT_CHANCE));
  5915. silverCritChance -= CalculateAttributeValue(GetInventory().GetItemAttributeValue(item, theGame.params.CRITICAL_HIT_CHANCE));
  5916. steelCritDmg -= CalculateAttributeValue(GetInventory().GetItemAttributeValue(item, theGame.params.CRITICAL_HIT_DAMAGE_BONUS));
  5917. silverCritDmg -= CalculateAttributeValue(GetInventory().GetItemAttributeValue(item, theGame.params.CRITICAL_HIT_DAMAGE_BONUS));
  5918. }
  5919. silverCritChance += CalculateAttributeValue(GetInventory().GetItemAttributeValue(item, theGame.params.CRITICAL_HIT_CHANCE));
  5920. silverCritDmg += CalculateAttributeValue(GetInventory().GetItemAttributeValue(item, theGame.params.CRITICAL_HIT_DAMAGE_BONUS));
  5921.  
  5922. thunder = (W3Potion_Thunderbolt)GetBuff(EET_Thunderbolt);
  5923. if(thunder && thunder.GetBuffLevel() == 3 && GetCurWeather() == EWE_Storm)
  5924. {
  5925. silverCritChance += 1.0f;
  5926. }
  5927. }
  5928. else
  5929. {
  5930. silverDmg += 0;
  5931. silverCritChance += 0;
  5932. silverCritDmg +=0;
  5933. }
  5934.  
  5935. if ( HasAbility('Runeword 4 _Stats', true) )
  5936. {
  5937. steelDmg += steelDmg * (abilityManager.GetOverhealBonus() / GetStatMax(BCS_Vitality));
  5938. silverDmg += silverDmg * (abilityManager.GetOverhealBonus() / GetStatMax(BCS_Vitality));
  5939. }
  5940.  
  5941. fastAP += attackPower;
  5942. strongAP += attackPower;
  5943.  
  5944. playerOffenseStats.steelFastCritChance = (steelCritChance + fastCritChance) * 100;
  5945. playerOffenseStats.steelFastCritDmg = steelCritDmg + fastCritDmg;
  5946. if ( steelDmg != 0 )
  5947. {
  5948. playerOffenseStats.steelFastDmg = (steelDmg + fastAP.valueBase) * fastAP.valueMultiplicative + fastAP.valueAdditive + elementalSteel;
  5949. playerOffenseStats.steelFastCritDmg = (steelDmg + fastAP.valueBase) * (fastAP.valueMultiplicative + playerOffenseStats.steelFastCritDmg) + fastAP.valueAdditive + elementalSteel;
  5950. }
  5951. else
  5952. {
  5953. playerOffenseStats.steelFastDmg = 0;
  5954. playerOffenseStats.steelFastCritDmg = 0;
  5955. }
  5956. playerOffenseStats.steelFastDPS = (playerOffenseStats.steelFastDmg * (100 - playerOffenseStats.steelFastCritChance) + playerOffenseStats.steelFastCritDmg * playerOffenseStats.steelFastCritChance) / 100;
  5957. playerOffenseStats.steelFastDPS = playerOffenseStats.steelFastDPS / 0.6;
  5958.  
  5959.  
  5960. playerOffenseStats.steelStrongCritChance = (steelCritChance + strongCritChance) * 100;
  5961. playerOffenseStats.steelStrongCritDmg = steelCritDmg + strongCritDmg;
  5962. if ( steelDmg != 0 )
  5963. {
  5964. playerOffenseStats.steelStrongDmg = (steelDmg + strongAP.valueBase) * strongAP.valueMultiplicative + strongAP.valueAdditive + elementalSteel;
  5965. playerOffenseStats.steelStrongDmg *= 1.833f;
  5966. playerOffenseStats.steelStrongCritDmg = (steelDmg + strongAP.valueBase) * (strongAP.valueMultiplicative + playerOffenseStats.steelStrongCritDmg) + strongAP.valueAdditive + elementalSteel;
  5967. playerOffenseStats.steelStrongCritDmg *= 1.833f; }
  5968. else
  5969. {
  5970. playerOffenseStats.steelStrongDmg = 0;
  5971. playerOffenseStats.steelStrongCritDmg = 0;
  5972. }
  5973. playerOffenseStats.steelStrongDPS = (playerOffenseStats.steelStrongDmg * (100 - playerOffenseStats.steelStrongCritChance) + playerOffenseStats.steelStrongCritDmg * playerOffenseStats.steelStrongCritChance) / 100;
  5974. playerOffenseStats.steelStrongDPS = playerOffenseStats.steelStrongDPS / 1.1;
  5975.  
  5976.  
  5977.  
  5978. playerOffenseStats.silverFastCritChance = (silverCritChance + fastCritChance) * 100;
  5979. playerOffenseStats.silverFastCritDmg = silverCritDmg + fastCritDmg;
  5980. if ( silverDmg != 0 )
  5981. {
  5982. playerOffenseStats.silverFastDmg = (silverDmg + fastAP.valueBase) * fastAP.valueMultiplicative + fastAP.valueAdditive + elementalSilver;
  5983. playerOffenseStats.silverFastCritDmg = (silverDmg + fastAP.valueBase) * (fastAP.valueMultiplicative + playerOffenseStats.silverFastCritDmg) + fastAP.valueAdditive + elementalSilver;
  5984. }
  5985. else
  5986. {
  5987. playerOffenseStats.silverFastDmg = 0;
  5988. playerOffenseStats.silverFastCritDmg = 0;
  5989. }
  5990. playerOffenseStats.silverFastDPS = (playerOffenseStats.silverFastDmg * (100 - playerOffenseStats.silverFastCritChance) + playerOffenseStats.silverFastCritDmg * playerOffenseStats.silverFastCritChance) / 100;
  5991. playerOffenseStats.silverFastDPS = playerOffenseStats.silverFastDPS / 0.6;
  5992.  
  5993.  
  5994. playerOffenseStats.silverStrongCritChance = (silverCritChance + strongCritChance) * 100;
  5995. playerOffenseStats.silverStrongCritDmg = silverCritDmg + strongCritDmg;
  5996. if ( silverDmg != 0 )
  5997. {
  5998. playerOffenseStats.silverStrongDmg = (silverDmg + strongAP.valueBase) * strongAP.valueMultiplicative + strongAP.valueAdditive + elementalSilver;
  5999. playerOffenseStats.silverStrongDmg *= 1.833f;
  6000. playerOffenseStats.silverStrongCritDmg = (silverDmg + strongAP.valueBase) * (strongAP.valueMultiplicative + playerOffenseStats.silverStrongCritDmg) + strongAP.valueAdditive + elementalSilver;
  6001. playerOffenseStats.silverStrongCritDmg *= 1.833f;
  6002. }
  6003. else
  6004. {
  6005. playerOffenseStats.silverStrongDmg = 0;
  6006. playerOffenseStats.silverStrongCritDmg = 0;
  6007. }
  6008. playerOffenseStats.silverStrongDPS = (playerOffenseStats.silverStrongDmg * (100 - playerOffenseStats.silverStrongCritChance) + playerOffenseStats.silverStrongCritDmg * playerOffenseStats.silverStrongCritChance) / 100;
  6009. playerOffenseStats.silverStrongDPS = playerOffenseStats.silverStrongDPS / 1.1;
  6010.  
  6011.  
  6012. playerOffenseStats.crossbowCritChance = CalculateAttributeValue(GetAttributeValue(theGame.params.CRITICAL_HIT_CHANCE));
  6013. if (CanUseSkill(S_Sword_s07))
  6014. playerOffenseStats.crossbowCritChance += CalculateAttributeValue(GetSkillAttributeValue(S_Sword_s07, theGame.params.CRITICAL_HIT_CHANCE, false, true)) * GetSkillLevel(S_Sword_s07);
  6015.  
  6016.  
  6017. playerOffenseStats.crossbowSteelDmgType = theGame.params.DAMAGE_NAME_PIERCING;
  6018. if (GetItemEquippedOnSlot(EES_Bolt, item))
  6019. {
  6020.  
  6021.  
  6022. steelDmg = CalculateAttributeValue(GetInventory().GetItemAttributeValue(item, theGame.params.DAMAGE_NAME_FIRE));
  6023. if(steelDmg > 0)
  6024. {
  6025. playerOffenseStats.crossbowSteelDmg = steelDmg;
  6026.  
  6027. playerOffenseStats.crossbowSteelDmgType = theGame.params.DAMAGE_NAME_FIRE;
  6028. playerOffenseStats.crossbowSilverDmg = steelDmg;
  6029. }
  6030. else
  6031. {
  6032. playerOffenseStats.crossbowSilverDmg = CalculateAttributeValue(GetInventory().GetItemAttributeValue(item, theGame.params.DAMAGE_NAME_SILVER));
  6033.  
  6034. steelDmg = CalculateAttributeValue(GetInventory().GetItemAttributeValue(item, theGame.params.DAMAGE_NAME_PIERCING));
  6035. if(steelDmg > 0)
  6036. {
  6037. playerOffenseStats.crossbowSteelDmg = steelDmg;
  6038. playerOffenseStats.crossbowSteelDmgType = theGame.params.DAMAGE_NAME_PIERCING;
  6039. }
  6040. else
  6041. {
  6042. playerOffenseStats.crossbowSteelDmg = CalculateAttributeValue(GetInventory().GetItemAttributeValue(item, theGame.params.DAMAGE_NAME_BLUDGEONING));
  6043. playerOffenseStats.crossbowSteelDmgType = theGame.params.DAMAGE_NAME_BLUDGEONING;
  6044. }
  6045. }
  6046. }
  6047.  
  6048. if (GetItemEquippedOnSlot(EES_RangedWeapon, item))
  6049. {
  6050. attackPower += GetInventory().GetItemAttributeValue(item, PowerStatEnumToName(CPS_AttackPower));
  6051. if(CanUseSkill(S_Perk_02))
  6052. {
  6053. attackPower += GetSkillAttributeValue(S_Perk_02, PowerStatEnumToName(CPS_AttackPower), false, true);
  6054. }
  6055. playerOffenseStats.crossbowSteelDmg = (playerOffenseStats.crossbowSteelDmg + attackPower.valueBase) * attackPower.valueMultiplicative + attackPower.valueAdditive;
  6056. playerOffenseStats.crossbowSilverDmg = (playerOffenseStats.crossbowSilverDmg + attackPower.valueBase) * attackPower.valueMultiplicative + attackPower.valueAdditive;
  6057. }
  6058. else
  6059. {
  6060. playerOffenseStats.crossbowSteelDmg = 0;
  6061. playerOffenseStats.crossbowSilverDmg = 0;
  6062. playerOffenseStats.crossbowSteelDmgType = theGame.params.DAMAGE_NAME_PIERCING;
  6063. }
  6064.  
  6065. return playerOffenseStats;
  6066. }
  6067.  
  6068. public function GetTotalWeaponDamage(weaponId : SItemUniqueId, damageTypeName : name, crossbowId : SItemUniqueId) : float
  6069. {
  6070. var damage, durRatio, durMod : float;
  6071. var repairObjectBonus : SAbilityAttributeValue;
  6072.  
  6073. durMod = 0;
  6074. damage = super.GetTotalWeaponDamage(weaponId, damageTypeName, crossbowId);
  6075.  
  6076.  
  6077. if(IsPhysicalResistStat(GetResistForDamage(damageTypeName, false)))
  6078. {
  6079. repairObjectBonus = inv.GetItemAttributeValue(weaponId, theGame.params.REPAIR_OBJECT_BONUS);
  6080. durRatio = -1;
  6081.  
  6082. if(inv.IsIdValid(crossbowId) && inv.HasItemDurability(crossbowId))
  6083. {
  6084. durRatio = inv.GetItemDurabilityRatio(crossbowId);
  6085. }
  6086. else if(inv.IsIdValid(weaponId) && inv.HasItemDurability(weaponId))
  6087. {
  6088. durRatio = inv.GetItemDurabilityRatio(weaponId);
  6089. }
  6090.  
  6091.  
  6092. if(durRatio >= 0)
  6093. durMod = theGame.params.GetDurabilityMultiplier(durRatio, true);
  6094. else
  6095. durMod = 1;
  6096. }
  6097.  
  6098. return damage * (durMod + repairObjectBonus.valueMultiplicative);
  6099. }
  6100.  
  6101.  
  6102.  
  6103.  
  6104.  
  6105. public final function GetSkillPathType(skill : ESkill) : ESkillPath
  6106. {
  6107. if(abilityManager && abilityManager.IsInitialized())
  6108. return ((W3PlayerAbilityManager)abilityManager).GetSkillPathType(skill);
  6109.  
  6110. return ESP_NotSet;
  6111. }
  6112.  
  6113. public function GetSkillLevel(s : ESkill) : int
  6114. {
  6115. if(abilityManager && abilityManager.IsInitialized())
  6116. return ((W3PlayerAbilityManager)abilityManager).GetSkillLevel(s);
  6117.  
  6118. return -1;
  6119. }
  6120.  
  6121. public function GetBoughtSkillLevel(s : ESkill) : int
  6122. {
  6123. if(abilityManager && abilityManager.IsInitialized())
  6124. return ((W3PlayerAbilityManager)abilityManager).GetBoughtSkillLevel(s);
  6125.  
  6126. return -1;
  6127. }
  6128.  
  6129.  
  6130. public function GetAxiiLevel() : int
  6131. {
  6132. var level : int;
  6133.  
  6134. level = 1;
  6135.  
  6136. if(CanUseSkill(S_Magic_s17)) level += GetSkillLevel(S_Magic_s17);
  6137.  
  6138. return Clamp(level, 1, 4);
  6139. }
  6140.  
  6141. public function IsInFrenzy() : bool
  6142. {
  6143. return isInFrenzy;
  6144. }
  6145.  
  6146. public function HasRecentlyCountered() : bool
  6147. {
  6148. return hasRecentlyCountered;
  6149. }
  6150.  
  6151. public function SetRecentlyCountered(counter : bool)
  6152. {
  6153. hasRecentlyCountered = counter;
  6154. }
  6155.  
  6156. timer function CheckBlockedSkills(dt : float, id : int)
  6157. {
  6158. var nextCallTime : float;
  6159.  
  6160. nextCallTime = ((W3PlayerAbilityManager)abilityManager).CheckBlockedSkills(dt);
  6161. if(nextCallTime != -1)
  6162. AddTimer('CheckBlockedSkills', nextCallTime, , , , true);
  6163. }
  6164.  
  6165.  
  6166. public function RemoveTemporarySkills()
  6167. {
  6168. var i : int;
  6169. var pam : W3PlayerAbilityManager;
  6170.  
  6171. if(tempLearnedSignSkills.Size() > 0)
  6172. {
  6173. pam = (W3PlayerAbilityManager)abilityManager;
  6174. for(i=0; i<tempLearnedSignSkills.Size(); i+=1)
  6175. {
  6176. pam.RemoveTemporarySkill(tempLearnedSignSkills[i]);
  6177. }
  6178.  
  6179. tempLearnedSignSkills.Clear();
  6180. RemoveAbilityAll(SkillEnumToName(S_Sword_s19));
  6181. }
  6182. }
  6183.  
  6184. public function RemoveTemporarySkill(skill : SSimpleSkill) : bool
  6185. {
  6186. var pam : W3PlayerAbilityManager;
  6187.  
  6188. pam = (W3PlayerAbilityManager)abilityManager;
  6189. if(pam && pam.IsInitialized())
  6190. return pam.RemoveTemporarySkill(skill);
  6191.  
  6192. return false;
  6193. }
  6194.  
  6195.  
  6196. private function AddTemporarySkills()
  6197. {
  6198. if(CanUseSkill(S_Sword_s19) && GetStat(BCS_Focus) >= 3)
  6199. {
  6200. tempLearnedSignSkills = ((W3PlayerAbilityManager)abilityManager).AddTempNonAlchemySkills();
  6201. DrainFocus(GetStat(BCS_Focus));
  6202. AddAbilityMultiple(SkillEnumToName(S_Sword_s19), GetSkillLevel(S_Sword_s19));
  6203. }
  6204. }
  6205.  
  6206.  
  6207.  
  6208. public function HasAlternateQuen() : bool
  6209. {
  6210. var quenEntity : W3QuenEntity;
  6211.  
  6212. quenEntity = (W3QuenEntity)GetCurrentSignEntity();
  6213. if(quenEntity)
  6214. {
  6215. return quenEntity.IsAlternateCast();
  6216. }
  6217.  
  6218. return false;
  6219. }
  6220.  
  6221.  
  6222.  
  6223.  
  6224.  
  6225. public function AddPoints(type : ESpendablePointType, amount : int, show : bool)
  6226. {
  6227. levelManager.AddPoints(type, amount, show);
  6228. }
  6229.  
  6230. public function GetLevel() : int {return levelManager.GetLevel();}
  6231. public function GetTotalExpForNextLevel() : int {return levelManager.GetTotalExpForNextLevel();}
  6232. public function GetPointsTotal(type : ESpendablePointType) : int {return levelManager.GetPointsTotal(type);}
  6233. public function IsAutoLeveling() : bool {return autoLevel;}
  6234. public function SetAutoLeveling( b : bool ) {autoLevel = b;}
  6235.  
  6236. public function GetMissingExpForNextLevel() : int
  6237. {
  6238. return Max(0, GetTotalExpForNextLevel() - GetPointsTotal(EExperiencePoint));
  6239. }
  6240.  
  6241.  
  6242.  
  6243.  
  6244. private saved var runewordInfusionType : ESignType;
  6245. default runewordInfusionType = ST_None;
  6246.  
  6247. public final function GetRunewordInfusionType() : ESignType
  6248. {
  6249. return runewordInfusionType;
  6250. }
  6251.  
  6252. public function OnSignCastPerformed(signType : ESignType, isAlternate : bool)
  6253. {
  6254. var items : array<SItemUniqueId>;
  6255. var weaponEnt : CEntity;
  6256. var fxName : name;
  6257.  
  6258. super.OnSignCastPerformed(signType, isAlternate);
  6259.  
  6260. if(HasAbility('Runeword 1 _Stats', true) && GetStat(BCS_Focus) >= 1.0f)
  6261. {
  6262. DrainFocus(1.0f);
  6263. runewordInfusionType = signType;
  6264. items = inv.GetHeldWeapons();
  6265. weaponEnt = inv.GetItemEntityUnsafe(items[0]);
  6266.  
  6267.  
  6268. weaponEnt.StopEffect('runeword_aard');
  6269. weaponEnt.StopEffect('runeword_axii');
  6270. weaponEnt.StopEffect('runeword_igni');
  6271. weaponEnt.StopEffect('runeword_quen');
  6272. weaponEnt.StopEffect('runeword_yrden');
  6273.  
  6274.  
  6275. if(signType == ST_Aard)
  6276. fxName = 'runeword_aard';
  6277. else if(signType == ST_Axii)
  6278. fxName = 'runeword_axii';
  6279. else if(signType == ST_Igni)
  6280. fxName = 'runeword_igni';
  6281. else if(signType == ST_Quen)
  6282. fxName = 'runeword_quen';
  6283. else if(signType == ST_Yrden)
  6284. fxName = 'runeword_yrden';
  6285.  
  6286. weaponEnt.PlayEffect(fxName);
  6287. }
  6288. }
  6289.  
  6290. public saved var savedQuenHealth, savedQuenDuration : float;
  6291.  
  6292. timer function HACK_QuenSaveStatus(dt : float, id : int)
  6293. {
  6294. var quenEntity : W3QuenEntity;
  6295.  
  6296. quenEntity = (W3QuenEntity)signs[ST_Quen].entity;
  6297. savedQuenHealth = quenEntity.GetShieldHealth();
  6298. savedQuenDuration = quenEntity.GetShieldRemainingDuration();
  6299. }
  6300.  
  6301. timer function DelayedRestoreQuen(dt : float, id : int)
  6302. {
  6303. RestoreQuen(savedQuenHealth, savedQuenDuration);
  6304. }
  6305.  
  6306. public final function OnBasicQuenFinishing()
  6307. {
  6308. RemoveTimer('HACK_QuenSaveStatus');
  6309. savedQuenHealth = 0.f;
  6310. savedQuenDuration = 0.f;
  6311. }
  6312.  
  6313. public final function IsAnyQuenActive() : bool
  6314. {
  6315. var quen : W3QuenEntity;
  6316.  
  6317. quen = (W3QuenEntity)GetSignEntity(ST_Quen);
  6318. if(quen)
  6319. return quen.IsAnyQuenActive();
  6320.  
  6321. return false;
  6322. }
  6323.  
  6324. public final function IsQuenActive(alternateMode : bool) : bool
  6325. {
  6326. if(IsAnyQuenActive() && GetSignEntity(ST_Quen).IsAlternateCast() == alternateMode)
  6327. return true;
  6328.  
  6329. return false;
  6330. }
  6331.  
  6332. public function FinishQuen(skipVisuals : bool)
  6333. {
  6334. var quen : W3QuenEntity;
  6335.  
  6336. quen = (W3QuenEntity)GetSignEntity(ST_Quen);
  6337. if(quen)
  6338. quen.ForceFinishQuen(skipVisuals);
  6339. }
  6340.  
  6341.  
  6342. public function GetTotalSignSpellPower(signSkill : ESkill) : SAbilityAttributeValue
  6343. {
  6344. var sp : SAbilityAttributeValue;
  6345. var penalty : SAbilityAttributeValue;
  6346. var penaltyReduction : float;
  6347. var penaltyReductionLevel : int;
  6348.  
  6349.  
  6350. sp = GetSkillAttributeValue(signSkill, PowerStatEnumToName(CPS_SpellPower), true, true);
  6351.  
  6352.  
  6353. if ( signSkill == S_Magic_s01 )
  6354. {
  6355.  
  6356. penaltyReductionLevel = GetSkillLevel(S_Magic_s01) + 1;
  6357. if(penaltyReductionLevel > 0)
  6358. {
  6359. penaltyReduction = 1 - penaltyReductionLevel * CalculateAttributeValue(GetSkillAttributeValue(S_Magic_s01, 'spell_power_penalty_reduction', true, true));
  6360. penalty = GetSkillAttributeValue(S_Magic_s01, PowerStatEnumToName(CPS_SpellPower), false, false);
  6361. sp += penalty * penaltyReduction;
  6362. }
  6363. }
  6364.  
  6365.  
  6366. if(signSkill == S_Magic_1 || signSkill == S_Magic_s01)
  6367. {
  6368. sp += GetAttributeValue('spell_power_aard');
  6369. }
  6370. else if(signSkill == S_Magic_2 || signSkill == S_Magic_s02)
  6371. {
  6372. sp += GetAttributeValue('spell_power_igni');
  6373. }
  6374. else if(signSkill == S_Magic_3 || signSkill == S_Magic_s03)
  6375. {
  6376. sp += GetAttributeValue('spell_power_yrden');
  6377. }
  6378. else if(signSkill == S_Magic_4 || signSkill == S_Magic_s04)
  6379. {
  6380. sp += GetAttributeValue('spell_power_quen');
  6381. }
  6382. else if(signSkill == S_Magic_5 || signSkill == S_Magic_s05)
  6383. {
  6384. sp += GetAttributeValue('spell_power_axii');
  6385. }
  6386.  
  6387. return sp;
  6388. }
  6389.  
  6390.  
  6391.  
  6392.  
  6393.  
  6394. public final function GetGwentCardIndex( cardName : name ) : int
  6395. {
  6396. var dm : CDefinitionsManagerAccessor;
  6397.  
  6398. dm = theGame.GetDefinitionsManager();
  6399.  
  6400. if(dm.ItemHasTag( cardName , 'GwintCardLeader' ))
  6401. {
  6402. return theGame.GetGwintManager().GwentLeadersNametoInt( cardName );
  6403. }
  6404. else if(dm.ItemHasTag( cardName , 'GwintCardNrkd' ))
  6405. {
  6406. return theGame.GetGwintManager().GwentNrkdNameToInt( cardName );
  6407. }
  6408. else if(dm.ItemHasTag( cardName , 'GwintCardNlfg' ))
  6409. {
  6410. return theGame.GetGwintManager().GwentNlfgNameToInt( cardName );
  6411. }
  6412. else if(dm.ItemHasTag( cardName , 'GwintCardSctl' ))
  6413. {
  6414. return theGame.GetGwintManager().GwentSctlNameToInt( cardName );
  6415. }
  6416. else if(dm.ItemHasTag( cardName , 'GwintCardMstr' ))
  6417. {
  6418. return theGame.GetGwintManager().GwentMstrNameToInt( cardName );
  6419. }
  6420. else if(dm.ItemHasTag( cardName , 'GwintCardNeutral' ))
  6421. {
  6422. return theGame.GetGwintManager().GwentNeutralNameToInt( cardName );
  6423. }
  6424. else if(dm.ItemHasTag( cardName , 'GwintCardSpcl' ))
  6425. {
  6426. return theGame.GetGwintManager().GwentSpecialNameToInt( cardName );
  6427. }
  6428.  
  6429. return -1;
  6430. }
  6431.  
  6432. public final function AddGwentCard(cardName : name, amount : int) : bool
  6433. {
  6434. var dm : CDefinitionsManagerAccessor;
  6435. var cardIndex, i : int;
  6436. var tut : STutorialMessage;
  6437.  
  6438.  
  6439.  
  6440. if(FactsQuerySum("q001_nightmare_ended") > 0 && ShouldProcessTutorial('TutorialGwentDeckBuilder2'))
  6441. {
  6442. tut.type = ETMT_Hint;
  6443. tut.tutorialScriptTag = 'TutorialGwentDeckBuilder2';
  6444. tut.journalEntryName = 'TutorialGwentDeckBuilder2';
  6445. tut.hintPositionType = ETHPT_DefaultGlobal;
  6446. tut.markAsSeenOnShow = true;
  6447. tut.hintDurationType = ETHDT_Long;
  6448.  
  6449. theGame.GetTutorialSystem().DisplayTutorial(tut);
  6450. }
  6451.  
  6452. dm = theGame.GetDefinitionsManager();
  6453.  
  6454. cardIndex = GetGwentCardIndex(cardName);
  6455.  
  6456. if (cardIndex != -1)
  6457. {
  6458. FactsAdd("Gwint_Card_Looted");
  6459.  
  6460. for(i = 0; i < amount; i += 1)
  6461. {
  6462. theGame.GetGwintManager().AddCardToCollection( cardIndex );
  6463. }
  6464. }
  6465.  
  6466. if( dm.ItemHasTag( cardName, 'GwentTournament' ) )
  6467. {
  6468. if ( dm.ItemHasTag( cardName, 'GT1' ) )
  6469. {
  6470. FactsAdd( "GwentTournament", 1 );
  6471. }
  6472.  
  6473. else if ( dm.ItemHasTag( cardName, 'GT2' ) )
  6474. {
  6475. FactsAdd( "GwentTournament", 2 );
  6476. }
  6477.  
  6478. else if ( dm.ItemHasTag( cardName, 'GT3' ) )
  6479. {
  6480. FactsAdd( "GwentTournament", 3 );
  6481. }
  6482.  
  6483. else if ( dm.ItemHasTag( cardName, 'GT4' ) )
  6484. {
  6485. FactsAdd( "GwentTournament", 4 );
  6486. }
  6487.  
  6488. else if ( dm.ItemHasTag( cardName, 'GT5' ) )
  6489. {
  6490. FactsAdd( "GwentTournament", 5 );
  6491. }
  6492.  
  6493. else if ( dm.ItemHasTag( cardName, 'GT6' ) )
  6494. {
  6495. FactsAdd( "GwentTournament", 6 );
  6496. }
  6497.  
  6498. else if ( dm.ItemHasTag( cardName, 'GT7' ) )
  6499. {
  6500. FactsAdd( "GwentTournament", 7 );
  6501. }
  6502.  
  6503. CheckGwentTournamentDeck();
  6504. }
  6505. else
  6506. {
  6507. return false;
  6508. }
  6509.  
  6510. return true;
  6511. }
  6512.  
  6513.  
  6514. public final function RemoveGwentCard(cardName : name, amount : int) : bool
  6515. {
  6516. var dm : CDefinitionsManagerAccessor;
  6517. var cardIndex, i : int;
  6518.  
  6519. dm = theGame.GetDefinitionsManager();
  6520.  
  6521. if(dm.ItemHasTag( cardName , 'GwintCardLeader' ))
  6522. {
  6523. cardIndex = theGame.GetGwintManager().GwentLeadersNametoInt( cardName );
  6524. for(i=0; i<amount; i+=1)
  6525. theGame.GetGwintManager().RemoveCardFromCollection( cardIndex );
  6526. }
  6527. else if(dm.ItemHasTag( cardName , 'GwintCardNrkd' ))
  6528. {
  6529. cardIndex = theGame.GetGwintManager().GwentNrkdNameToInt( cardName );
  6530. for(i=0; i<amount; i+=1)
  6531. theGame.GetGwintManager().RemoveCardFromCollection( cardIndex );
  6532. }
  6533. else if(dm.ItemHasTag( cardName , 'GwintCardNlfg' ))
  6534. {
  6535. cardIndex = theGame.GetGwintManager().GwentNlfgNameToInt( cardName );
  6536. for(i=0; i<amount; i+=1)
  6537. theGame.GetGwintManager().RemoveCardFromCollection( cardIndex );
  6538. }
  6539. else if(dm.ItemHasTag( cardName , 'GwintCardSctl' ))
  6540. {
  6541. cardIndex = theGame.GetGwintManager().GwentSctlNameToInt( cardName );
  6542. for(i=0; i<amount; i+=1)
  6543. theGame.GetGwintManager().RemoveCardFromCollection( cardIndex );
  6544. }
  6545. else if(dm.ItemHasTag( cardName , 'GwintCardMstr' ))
  6546. {
  6547. cardIndex = theGame.GetGwintManager().GwentMstrNameToInt( cardName );
  6548. for(i=0; i<amount; i+=1)
  6549. theGame.GetGwintManager().RemoveCardFromCollection( cardIndex );
  6550. }
  6551. else if(dm.ItemHasTag( cardName , 'GwintCardNeutral' ))
  6552. {
  6553. cardIndex = theGame.GetGwintManager().GwentNeutralNameToInt( cardName );
  6554. for(i=0; i<amount; i+=1)
  6555. theGame.GetGwintManager().RemoveCardFromCollection( cardIndex );
  6556. }
  6557. else if(dm.ItemHasTag( cardName , 'GwintCardSpcl' ))
  6558. {
  6559. cardIndex = theGame.GetGwintManager().GwentSpecialNameToInt( cardName );
  6560. for(i=0; i<amount; i+=1)
  6561. theGame.GetGwintManager().RemoveCardFromCollection( cardIndex );
  6562. }
  6563.  
  6564. if( dm.ItemHasTag( cardName, 'GwentTournament' ) )
  6565. {
  6566. if ( dm.ItemHasTag( cardName, 'GT1' ) )
  6567. {
  6568. FactsSubstract( "GwentTournament", 1 );
  6569. }
  6570.  
  6571. else if ( dm.ItemHasTag( cardName, 'GT2' ) )
  6572. {
  6573. FactsSubstract( "GwentTournament", 2 );
  6574. }
  6575.  
  6576. else if ( dm.ItemHasTag( cardName, 'GT3' ) )
  6577. {
  6578. FactsSubstract( "GwentTournament", 3 );
  6579. }
  6580.  
  6581. else if ( dm.ItemHasTag( cardName, 'GT4' ) )
  6582. {
  6583. FactsSubstract( "GwentTournament", 4 );
  6584. }
  6585.  
  6586. else if ( dm.ItemHasTag( cardName, 'GT5' ) )
  6587. {
  6588. FactsSubstract( "GwentTournament", 5 );
  6589. }
  6590.  
  6591. else if ( dm.ItemHasTag( cardName, 'GT6' ) )
  6592. {
  6593. FactsSubstract( "GwentTournament", 6 );
  6594. }
  6595.  
  6596. else if ( dm.ItemHasTag( cardName, 'GT7' ) )
  6597. {
  6598. FactsSubstract( "GwentTournament", 7 );
  6599. }
  6600.  
  6601. CheckGwentTournamentDeck();
  6602. }
  6603.  
  6604. else
  6605. {
  6606. return false;
  6607. }
  6608.  
  6609. return true;
  6610. }
  6611.  
  6612. function CheckGwentTournamentDeck()
  6613. {
  6614. var gwentPower : int;
  6615. var neededGwentPower : int;
  6616. var checkBreakpoint : int;
  6617.  
  6618. neededGwentPower = 70;
  6619.  
  6620. checkBreakpoint = neededGwentPower/5;
  6621. gwentPower = FactsQuerySum( "GwentTournament" );
  6622.  
  6623. if ( gwentPower >= neededGwentPower )
  6624. {
  6625. FactsAdd( "HasGwentTournamentDeck", 1 );
  6626. }
  6627. else
  6628. {
  6629. if( FactsDoesExist( "HasGwentTournamentDeck" ) )
  6630. {
  6631. FactsRemove( "HasGwentTournamentDeck" );
  6632. }
  6633.  
  6634. if ( gwentPower >= checkBreakpoint )
  6635. {
  6636. FactsAdd( "GwentTournamentObjective1", 1 );
  6637. }
  6638. else if ( FactsDoesExist( "GwentTournamentObjective1" ) )
  6639. {
  6640. FactsRemove( "GwentTournamentObjective1" );
  6641. }
  6642.  
  6643. if ( gwentPower >= checkBreakpoint*2 )
  6644. {
  6645. FactsAdd( "GwentTournamentObjective2", 1 );
  6646. }
  6647. else if ( FactsDoesExist( "GwentTournamentObjective2" ) )
  6648. {
  6649. FactsRemove( "GwentTournamentObjective2" );
  6650. }
  6651.  
  6652. if ( gwentPower >= checkBreakpoint*3 )
  6653. {
  6654. FactsAdd( "GwentTournamentObjective3", 1 );
  6655. }
  6656. else if ( FactsDoesExist( "GwentTournamentObjective3" ) )
  6657. {
  6658. FactsRemove( "GwentTournamentObjective3" );
  6659. }
  6660.  
  6661. if ( gwentPower >= checkBreakpoint*4 )
  6662. {
  6663. FactsAdd( "GwentTournamentObjective4", 1 );
  6664. }
  6665. else if ( FactsDoesExist( "GwentTournamentObjective4" ) )
  6666. {
  6667. FactsRemove( "GwentTournamentObjective4" );
  6668. }
  6669. }
  6670. }
  6671.  
  6672.  
  6673.  
  6674.  
  6675.  
  6676.  
  6677. public function SimulateBuffTimePassing(simulatedTime : float)
  6678. {
  6679. super.SimulateBuffTimePassing(simulatedTime);
  6680.  
  6681. FinishQuen(true);
  6682. }
  6683.  
  6684.  
  6685. public function CanMeditate() : bool
  6686. {
  6687. var currentStateName : name;
  6688.  
  6689. currentStateName = GetCurrentStateName();
  6690.  
  6691.  
  6692. if(currentStateName == 'Exploration' && !CanPerformPlayerAction())
  6693. return false;
  6694.  
  6695.  
  6696. if(GetCurrentStateName() != 'Exploration' && GetCurrentStateName() != 'Meditation' && GetCurrentStateName() != 'MeditationWaiting')
  6697. return false;
  6698.  
  6699.  
  6700. if(GetUsedVehicle())
  6701. return false;
  6702.  
  6703.  
  6704. return CanMeditateHere();
  6705. }
  6706.  
  6707.  
  6708. public final function CanMeditateWait(optional skipMeditationStateCheck : bool) : bool
  6709. {
  6710. var currState : name;
  6711.  
  6712. currState = GetCurrentStateName();
  6713.  
  6714.  
  6715.  
  6716. if(!skipMeditationStateCheck && currState != 'Meditation')
  6717. return false;
  6718.  
  6719.  
  6720. if(theGame.IsGameTimePaused())
  6721. return false;
  6722.  
  6723. if(!IsActionAllowed( EIAB_MeditationWaiting ))
  6724. return false;
  6725.  
  6726. return true;
  6727. }
  6728.  
  6729.  
  6730. public final function CanMeditateHere() : bool
  6731. {
  6732. var pos : Vector;
  6733.  
  6734. pos = GetWorldPosition();
  6735. if(pos.Z <= theGame.GetWorld().GetWaterLevel(pos, true) && IsInShallowWater())
  6736. return false;
  6737.  
  6738. if(IsThreatened())
  6739. return false;
  6740.  
  6741. return true;
  6742. }
  6743.  
  6744.  
  6745. public function Meditate()
  6746. {
  6747. var medState : W3PlayerWitcherStateMeditation;
  6748. if (!CanMeditate() || GetCurrentStateName() == 'Meditation' || GetCurrentStateName() == 'MeditationWaiting')
  6749. return;
  6750.  
  6751. if (!CanMeditate() || stateName == 'MeditationWaiting' )
  6752. return false;
  6753. GotoState('Meditation');
  6754. medState = (W3PlayerWitcherStateMeditation)GetState('Meditation');
  6755. medState.SetMeditationPointHeading(GetHeading());
  6756. }
  6757.  
  6758.  
  6759. public final function MeditationRestoring(simulatedTime : float)
  6760. {
  6761.  
  6762. if ( theGame.GetDifficultyMode() != EDM_Hard && theGame.GetDifficultyMode() != EDM_Hardcore )
  6763. {
  6764. Heal(GetStatMax(BCS_Vitality));
  6765. }
  6766.  
  6767.  
  6768. abilityManager.DrainToxicity( abilityManager.GetStat( BCS_Toxicity ) );
  6769. abilityManager.DrainFocus( abilityManager.GetStat( BCS_Focus ) );
  6770.  
  6771.  
  6772. inv.SingletonItemsRefillAmmo();
  6773.  
  6774.  
  6775. SimulateBuffTimePassing(simulatedTime);
  6776. }
  6777.  
  6778. var clockMenu : CR4MeditationClockMenu;
  6779.  
  6780. public function MeditationClockStart(m : CR4MeditationClockMenu)
  6781. {
  6782. clockMenu = m;
  6783. AddTimer('UpdateClockTime',0.1,true);
  6784. }
  6785.  
  6786. public function MeditationClockStop()
  6787. {
  6788. clockMenu = NULL;
  6789. RemoveTimer('UpdateClockTime');
  6790. }
  6791.  
  6792. public timer function UpdateClockTime(dt : float, id : int)
  6793. {
  6794. if(clockMenu)
  6795. clockMenu.UpdateCurrentHours();
  6796. else
  6797. RemoveTimer('UpdateClockTime');
  6798. }
  6799.  
  6800. private var waitTimeHour : int;
  6801. public function SetWaitTargetHour(t : int)
  6802. {
  6803. waitTimeHour = t;
  6804. }
  6805. public function GetWaitTargetHour() : int
  6806. {
  6807. return waitTimeHour;
  6808. }
  6809.  
  6810. public function MeditationForceAbort(forceCloseUI : bool)
  6811. {
  6812. var waitt : W3PlayerWitcherStateMeditationWaiting;
  6813. var medd : W3PlayerWitcherStateMeditation;
  6814. var currentStateName : name;
  6815.  
  6816. currentStateName = GetCurrentStateName();
  6817.  
  6818. if(currentStateName == 'MeditationWaiting')
  6819. {
  6820. waitt = (W3PlayerWitcherStateMeditationWaiting)GetCurrentState();
  6821. if(waitt)
  6822. {
  6823. waitt.StopRequested(forceCloseUI);
  6824. }
  6825. }
  6826. else if(currentStateName == 'Meditation')
  6827. {
  6828. medd = (W3PlayerWitcherStateMeditation)GetCurrentState();
  6829. if(medd)
  6830. {
  6831. medd.StopRequested(forceCloseUI);
  6832. }
  6833. }
  6834.  
  6835.  
  6836.  
  6837. if(forceCloseUI && theGame.GetGuiManager().IsAnyMenu())
  6838. {
  6839. theGame.GetGuiManager().GetRootMenu().CloseMenu();
  6840. DisplayActionDisallowedHudMessage(EIAB_MeditationWaiting, false, false, true, false);
  6841. }
  6842. }
  6843.  
  6844. public function Runeword10Triggerred()
  6845. {
  6846. var min, max : SAbilityAttributeValue;
  6847.  
  6848. theGame.GetDefinitionsManager().GetAbilityAttributeValue( 'Runeword 10 _Stats', 'stamina', min, max );
  6849. GainStat(BCS_Stamina, min.valueMultiplicative * GetStatMax(BCS_Stamina));
  6850. PlayEffect('runeword_10_stamina');
  6851. }
  6852.  
  6853. public function Runeword12Triggerred()
  6854. {
  6855. var min, max : SAbilityAttributeValue;
  6856.  
  6857. theGame.GetDefinitionsManager().GetAbilityAttributeValue( 'Runeword 12 _Stats', 'focus', min, max );
  6858. GainStat(BCS_Focus, RandRangeF(max.valueAdditive, min.valueAdditive));
  6859. PlayEffect('runeword_20_adrenaline');
  6860. }
  6861.  
  6862. var runeword10TriggerredOnFinisher, runeword12TriggerredOnFinisher : bool;
  6863.  
  6864. event OnFinisherStart()
  6865. {
  6866. super.OnFinisherStart();
  6867.  
  6868. runeword10TriggerredOnFinisher = false;
  6869. runeword12TriggerredOnFinisher = false;
  6870. }
  6871.  
  6872.  
  6873.  
  6874.  
  6875.  
  6876. public function CheatResurrect()
  6877. {
  6878. super.CheatResurrect();
  6879. theGame.ReleaseNoSaveLock(theGame.deathSaveLockId);
  6880. theInput.RestoreContext( 'Exploration', true );
  6881. }
  6882.  
  6883.  
  6884. public function Debug_EquipTestingSkills(equip : bool, force : bool)
  6885. {
  6886. var skills : array<ESkill>;
  6887. var i, slot : int;
  6888.  
  6889.  
  6890. ((W3PlayerAbilityManager)abilityManager).OnLevelGained(36);
  6891.  
  6892. skills.PushBack(S_Magic_s01);
  6893. skills.PushBack(S_Magic_s02);
  6894. skills.PushBack(S_Magic_s03);
  6895. skills.PushBack(S_Magic_s04);
  6896. skills.PushBack(S_Magic_s05);
  6897. skills.PushBack(S_Sword_s01);
  6898. skills.PushBack(S_Sword_s02);
  6899.  
  6900.  
  6901. if(equip)
  6902. {
  6903. for(i=0; i<skills.Size(); i+=1)
  6904. {
  6905. if(!force && IsSkillEquipped(skills[i]))
  6906. continue;
  6907.  
  6908.  
  6909. if(GetSkillLevel(skills[i]) == 0)
  6910. AddSkill(skills[i]);
  6911.  
  6912.  
  6913. if(force)
  6914. slot = i+1;
  6915. else
  6916. slot = GetFreeSkillSlot();
  6917.  
  6918.  
  6919. EquipSkill(skills[i], slot);
  6920. }
  6921. }
  6922. else
  6923. {
  6924. for(i=0; i<skills.Size(); i+=1)
  6925. {
  6926. UnequipSkill(GetSkillSlotID(skills[i]));
  6927. }
  6928. }
  6929. }
  6930.  
  6931. public function Debug_ClearCharacterDevelopment(optional keepInv : bool)
  6932. {
  6933. var template : CEntityTemplate;
  6934. var entity : CEntity;
  6935. var invTesting : CInventoryComponent;
  6936. var i : int;
  6937. var items : array<SItemUniqueId>;
  6938. var abs : array<name>;
  6939.  
  6940. delete abilityManager;
  6941. delete levelManager;
  6942. delete effectManager;
  6943.  
  6944.  
  6945. abs = GetAbilities(false);
  6946. for(i=0; i<abs.Size(); i+=1)
  6947. RemoveAbility(abs[i]);
  6948.  
  6949.  
  6950. abs.Clear();
  6951. GetCharacterStatsParam(abs);
  6952. for(i=0; i<abs.Size(); i+=1)
  6953. AddAbility(abs[i]);
  6954.  
  6955.  
  6956. levelManager = new W3LevelManager in this;
  6957. levelManager.Initialize();
  6958. levelManager.PostInit(this, false);
  6959.  
  6960.  
  6961. AddAbility('GeraltSkills_Testing');
  6962. SetAbilityManager();
  6963. abilityManager.Init(this, GetCharacterStats(), false, theGame.GetDifficultyMode());
  6964.  
  6965. SetEffectManager();
  6966.  
  6967. abilityManager.PostInit();
  6968.  
  6969.  
  6970.  
  6971.  
  6972.  
  6973. if(!keepInv)
  6974. {
  6975. inv.RemoveAllItems();
  6976. }
  6977.  
  6978.  
  6979. template = (CEntityTemplate)LoadResource("geralt_inventory_release");
  6980. entity = theGame.CreateEntity(template, Vector(0,0,0));
  6981. invTesting = (CInventoryComponent)entity.GetComponentByClassName('CInventoryComponent');
  6982. invTesting.GiveAllItemsTo(inv, true);
  6983. entity.Destroy();
  6984.  
  6985.  
  6986. inv.GetAllItems(items);
  6987. for(i=0; i<items.Size(); i+=1)
  6988. {
  6989. if(!inv.ItemHasTag(items[i], 'NoDrop'))
  6990. EquipItem(items[i]);
  6991. }
  6992.  
  6993.  
  6994. Debug_GiveTestingItems(0);
  6995. }
  6996.  
  6997. final function Debug_HAX_UnlockSkillSlot(slotIndex : int) : bool
  6998. {
  6999. if(abilityManager && abilityManager.IsInitialized())
  7000. return ((W3PlayerAbilityManager)abilityManager).Debug_HAX_UnlockSkillSlot(slotIndex);
  7001.  
  7002. return false;
  7003. }
  7004.  
  7005.  
  7006. public function GetLevelupAbility( id : int) : name
  7007. {
  7008. return levelupAbilities[ id ];
  7009. }
  7010.  
  7011.  
  7012. public function CanSprint( speed : float ) : bool
  7013. {
  7014. if( !super.CanSprint( speed ) )
  7015. {
  7016. return false;
  7017. }
  7018. if( rangedWeapon && rangedWeapon.GetCurrentStateName() != 'State_WeaponWait' )
  7019. {
  7020. if ( this.GetPlayerCombatStance() == PCS_AlertNear )
  7021. {
  7022. if ( IsSprintActionPressed() )
  7023. OnRangedForceHolster( true, false );
  7024. }
  7025. else
  7026. return false;
  7027. }
  7028. if( GetCurrentStateName() != 'Swimming' && GetStat(BCS_Stamina) <= 0 )
  7029. {
  7030. SetSprintActionPressed(false,true);
  7031. return false;
  7032. }
  7033.  
  7034. return true;
  7035. }
  7036.  
  7037.  
  7038.  
  7039. public function RestoreHorseManager() : bool
  7040. {
  7041. var horseTemplate : CEntityTemplate;
  7042. var horseManager : W3HorseManager;
  7043.  
  7044. if ( GetHorseManager() )
  7045. {
  7046. return false;
  7047. }
  7048.  
  7049. horseTemplate = (CEntityTemplate)LoadResource("horse_manager");
  7050. horseManager = (W3HorseManager)theGame.CreateEntity(horseTemplate, GetWorldPosition(),,,,,PM_Persist);
  7051. horseManager.CreateAttachment(this);
  7052. horseManager.OnCreated();
  7053. EntityHandleSet( horseManagerHandle, horseManager );
  7054.  
  7055. return true;
  7056. }
  7057.  
  7058.  
  7059.  
  7060.  
  7061.  
  7062.  
  7063.  
  7064. public final function IsSignBlocked(signType : ESignType) : bool
  7065. {
  7066. switch( signType )
  7067. {
  7068. case ST_Aard :
  7069. return IsRadialSlotBlocked ( 'Aard');
  7070. break;
  7071. case ST_Axii :
  7072. return IsRadialSlotBlocked ( 'Axii');
  7073. break;
  7074. case ST_Igni :
  7075. return IsRadialSlotBlocked ( 'Igni');
  7076. break;
  7077. case ST_Quen :
  7078. return IsRadialSlotBlocked ( 'Quen');
  7079. break;
  7080. case ST_Yrden :
  7081. return IsRadialSlotBlocked ( 'Yrden');
  7082. break;
  7083. default:
  7084. break;
  7085. }
  7086. return false;
  7087.  
  7088. }
  7089.  
  7090. public final function AddAnItemWithAutogenLevelAndQuality(itemName : name, desiredLevel : int, minQuality : int, optional equipItem : bool)
  7091. {
  7092. var itemLevel, quality : int;
  7093. var ids : array<SItemUniqueId>;
  7094. var attemptCounter : int;
  7095.  
  7096. itemLevel = 0;
  7097. quality = 0;
  7098. attemptCounter = 0;
  7099. while(itemLevel != desiredLevel || quality < minQuality)
  7100. {
  7101. attemptCounter += 1;
  7102. ids.Clear();
  7103. ids = inv.AddAnItem(itemName, 1, true);
  7104. itemLevel = inv.GetItemLevel(ids[0]);
  7105. quality = RoundMath(CalculateAttributeValue(inv.GetItemAttributeValue(ids[0], 'quality')));
  7106.  
  7107.  
  7108. if(attemptCounter >= 1000)
  7109. break;
  7110.  
  7111. if(itemLevel != desiredLevel || quality < minQuality)
  7112. inv.RemoveItem(ids[0]);
  7113. }
  7114.  
  7115. if(equipItem)
  7116. EquipItem(ids[0]);
  7117. }
  7118.  
  7119. public final function AddAnItemWithAutogenLevel(itemName : name, desiredLevel : int)
  7120. {
  7121. var itemLevel : int;
  7122. var ids : array<SItemUniqueId>;
  7123. var attemptCounter : int;
  7124.  
  7125. itemLevel = 0;
  7126. while(itemLevel != desiredLevel)
  7127. {
  7128. attemptCounter += 1;
  7129. ids.Clear();
  7130. ids = inv.AddAnItem(itemName, 1, true);
  7131. itemLevel = inv.GetItemLevel(ids[0]);
  7132.  
  7133.  
  7134. if(attemptCounter >= 1000)
  7135. break;
  7136.  
  7137. if(itemLevel != desiredLevel)
  7138. inv.RemoveItem(ids[0]);
  7139. }
  7140. }
  7141.  
  7142. public final function AddAnItemWithMinQuality(itemName : name, minQuality : int, optional equip : bool)
  7143. {
  7144. var quality : int;
  7145. var ids : array<SItemUniqueId>;
  7146. var attemptCounter : int;
  7147.  
  7148. quality = 0;
  7149. while(quality < minQuality)
  7150. {
  7151. attemptCounter += 1;
  7152. ids.Clear();
  7153. ids = inv.AddAnItem(itemName, 1, true);
  7154. quality = RoundMath(CalculateAttributeValue(inv.GetItemAttributeValue(ids[0], 'quality')));
  7155.  
  7156.  
  7157. if(attemptCounter >= 1000)
  7158. break;
  7159.  
  7160. if(quality < minQuality)
  7161. inv.RemoveItem(ids[0]);
  7162. }
  7163.  
  7164. if(equip)
  7165. EquipItem(ids[0]);
  7166. }
  7167.  
  7168. public final function StandaloneEp1_1()
  7169. {
  7170. var i, inc, quantityLow, randLow, quantityMedium, randMedium, quantityHigh, randHigh, startingMoney : int;
  7171. var pam : W3PlayerAbilityManager;
  7172. var ids : array<SItemUniqueId>;
  7173. var STARTING_LEVEL : int;
  7174.  
  7175. FactsAdd("StandAloneEP1", 1);
  7176.  
  7177.  
  7178. inv.RemoveAllItems();
  7179.  
  7180.  
  7181. inv.AddAnItem('Illusion Medallion', 1, true, true, false);
  7182. inv.AddAnItem('q103_safe_conduct', 1, true, true, false);
  7183.  
  7184.  
  7185. theGame.GetGamerProfile().ClearAllAchievementsForEP1();
  7186.  
  7187.  
  7188. STARTING_LEVEL = 32;
  7189. inc = STARTING_LEVEL - GetLevel();
  7190. for(i=0; i<inc; i+=1)
  7191. {
  7192. levelManager.AddPoints(EExperiencePoint, levelManager.GetTotalExpForNextLevel() - levelManager.GetPointsTotal(EExperiencePoint), false);
  7193. }
  7194.  
  7195.  
  7196. levelManager.ResetCharacterDev();
  7197. pam = (W3PlayerAbilityManager)abilityManager;
  7198. if(pam)
  7199. {
  7200. pam.ResetCharacterDev();
  7201. }
  7202. levelManager.SetFreeSkillPoints(levelManager.GetLevel() - 1 + 11);
  7203.  
  7204.  
  7205. inv.AddAnItem('Mutagen red', 4);
  7206. inv.AddAnItem('Mutagen green', 4);
  7207. inv.AddAnItem('Mutagen blue', 4);
  7208. inv.AddAnItem('Lesser mutagen red', 2);
  7209. inv.AddAnItem('Lesser mutagen green', 2);
  7210. inv.AddAnItem('Lesser mutagen blue', 2);
  7211. inv.AddAnItem('Greater mutagen green', 1);
  7212. inv.AddAnItem('Greater mutagen blue', 2);
  7213.  
  7214.  
  7215. startingMoney = 20000;
  7216. if(GetMoney() > startingMoney)
  7217. {
  7218. RemoveMoney(GetMoney() - startingMoney);
  7219. }
  7220. else
  7221. {
  7222. AddMoney( 20000 - GetMoney() );
  7223. }
  7224.  
  7225.  
  7226.  
  7227.  
  7228.  
  7229. ids.Clear();
  7230. ids = inv.AddAnItem('EP1 Standalone Starting Armor');
  7231. EquipItem(ids[0]);
  7232. ids.Clear();
  7233. ids = inv.AddAnItem('EP1 Standalone Starting Boots');
  7234. EquipItem(ids[0]);
  7235. ids.Clear();
  7236. ids = inv.AddAnItem('EP1 Standalone Starting Gloves');
  7237. EquipItem(ids[0]);
  7238. ids.Clear();
  7239. ids = inv.AddAnItem('EP1 Standalone Starting Pants');
  7240. EquipItem(ids[0]);
  7241.  
  7242.  
  7243. ids.Clear();
  7244. ids = inv.AddAnItem('EP1 Standalone Starting Steel Sword');
  7245. EquipItem(ids[0]);
  7246. ids.Clear();
  7247. ids = inv.AddAnItem('EP1 Standalone Starting Silver Sword');
  7248. EquipItem(ids[0]);
  7249.  
  7250.  
  7251. inv.AddAnItem('Torch', 1, true, true, false);
  7252.  
  7253.  
  7254. quantityLow = 1;
  7255. randLow = 3;
  7256. quantityMedium = 4;
  7257. randMedium = 4;
  7258. quantityHigh = 8;
  7259. randHigh = 6;
  7260.  
  7261. inv.AddAnItem('Alghoul bone marrow',quantityMedium+RandRange(randMedium));
  7262. inv.AddAnItem('Amethyst dust',quantityLow+RandRange(randLow));
  7263. inv.AddAnItem('Arachas eyes',quantityLow+RandRange(randLow));
  7264. inv.AddAnItem('Arachas venom',quantityLow+RandRange(randLow));
  7265. inv.AddAnItem('Basilisk hide',quantityLow+RandRange(randLow));
  7266. inv.AddAnItem('Basilisk venom',quantityLow+RandRange(randLow));
  7267. inv.AddAnItem('Bear pelt',quantityHigh+RandRange(randHigh));
  7268. inv.AddAnItem('Berserker pelt',quantityLow+RandRange(randLow));
  7269. inv.AddAnItem('Coal',quantityHigh+RandRange(randHigh));
  7270. inv.AddAnItem('Cotton',quantityHigh+RandRange(randHigh));
  7271. inv.AddAnItem('Dark iron ingot',quantityLow+RandRange(randLow));
  7272. inv.AddAnItem('Dark iron ore',quantityLow+RandRange(randLow));
  7273. inv.AddAnItem('Deer hide',quantityHigh+RandRange(randHigh));
  7274. inv.AddAnItem('Diamond dust',quantityLow+RandRange(randLow));
  7275. inv.AddAnItem('Draconide leather',quantityLow+RandRange(randLow));
  7276. inv.AddAnItem('Drowned dead tongue',quantityLow+RandRange(randLow));
  7277. inv.AddAnItem('Drowner brain',quantityMedium+RandRange(randMedium));
  7278. inv.AddAnItem('Dwimeryte ingot',quantityLow+RandRange(randLow));
  7279. inv.AddAnItem('Dwimeryte ore',quantityLow+RandRange(randLow));
  7280. inv.AddAnItem('Emerald dust',quantityLow+RandRange(randLow));
  7281. inv.AddAnItem('Endriag chitin plates',quantityMedium+RandRange(randMedium));
  7282. inv.AddAnItem('Endriag embryo',quantityLow+RandRange(randLow));
  7283. inv.AddAnItem('Ghoul blood',quantityMedium+RandRange(randMedium));
  7284. inv.AddAnItem('Goat hide',quantityMedium+RandRange(randMedium));
  7285. inv.AddAnItem('Hag teeth',quantityMedium+RandRange(randMedium));
  7286. inv.AddAnItem('Hardened leather',quantityMedium+RandRange(randMedium));
  7287. inv.AddAnItem('Hardened timber',quantityMedium+RandRange(randMedium));
  7288. inv.AddAnItem('Harpy feathers',quantityMedium+RandRange(randMedium));
  7289. inv.AddAnItem('Horse hide',quantityLow+RandRange(randLow));
  7290. inv.AddAnItem('Iron ore',quantityHigh+RandRange(randHigh));
  7291. inv.AddAnItem('Leather straps',quantityHigh+RandRange(randHigh));
  7292. inv.AddAnItem('Leather',quantityHigh+RandRange(randHigh));
  7293. inv.AddAnItem('Linen',quantityMedium+RandRange(randMedium));
  7294. inv.AddAnItem('Meteorite ingot',quantityLow+RandRange(randLow));
  7295. inv.AddAnItem('Meteorite ore',quantityMedium+RandRange(randMedium));
  7296. inv.AddAnItem('Necrophage skin',quantityLow+RandRange(randLow));
  7297. inv.AddAnItem('Nekker blood',quantityHigh+RandRange(randHigh));
  7298. inv.AddAnItem('Nekker heart',quantityMedium+RandRange(randMedium));
  7299. inv.AddAnItem('Oil',quantityHigh+RandRange(randHigh));
  7300. inv.AddAnItem('Phosphorescent crystal',quantityLow+RandRange(randLow));
  7301. inv.AddAnItem('Pig hide',quantityMedium+RandRange(randMedium));
  7302. inv.AddAnItem('Pure silver',quantityMedium+RandRange(randMedium));
  7303. inv.AddAnItem('Rabbit pelt',quantityMedium+RandRange(randMedium));
  7304. inv.AddAnItem('Rotfiend blood',quantityMedium+RandRange(randMedium));
  7305. inv.AddAnItem('Sapphire dust',quantityLow+RandRange(randLow));
  7306. inv.AddAnItem('Silk',quantityHigh+RandRange(randHigh));
  7307. inv.AddAnItem('Silver ingot',quantityMedium+RandRange(randMedium));
  7308. inv.AddAnItem('Silver ore',quantityHigh+RandRange(randHigh));
  7309. inv.AddAnItem('Specter dust',quantityMedium+RandRange(randMedium));
  7310. inv.AddAnItem('Steel ingot',quantityHigh+RandRange(randHigh));
  7311. inv.AddAnItem('Steel plate',quantityHigh+RandRange(randHigh));
  7312. inv.AddAnItem('String',quantityHigh+RandRange(randHigh));
  7313. inv.AddAnItem('Thread',quantityHigh+RandRange(randHigh));
  7314. inv.AddAnItem('Timber',quantityHigh+RandRange(randHigh));
  7315. inv.AddAnItem('Twine',quantityMedium+RandRange(randMedium));
  7316. inv.AddAnItem('Venom extract',quantityMedium+RandRange(randMedium));
  7317. inv.AddAnItem('Water essence',quantityMedium+RandRange(randMedium));
  7318. inv.AddAnItem('Wolf liver',quantityHigh+RandRange(randHigh));
  7319. inv.AddAnItem('Wolf pelt',quantityMedium+RandRange(randMedium));
  7320.  
  7321. inv.AddAnItem('Alcohest', 5);
  7322. inv.AddAnItem('Dwarven spirit', 5);
  7323.  
  7324.  
  7325. ids.Clear();
  7326. ids = inv.AddAnItem('Crossbow 5');
  7327. EquipItem(ids[0]);
  7328. ids.Clear();
  7329. ids = inv.AddAnItem('Blunt Bolt', 100);
  7330. EquipItem(ids[0]);
  7331. inv.AddAnItem('Broadhead Bolt', 100);
  7332. inv.AddAnItem('Split Bolt', 100);
  7333.  
  7334.  
  7335. RemoveAllAlchemyRecipes();
  7336. RemoveAllCraftingSchematics();
  7337.  
  7338.  
  7339.  
  7340.  
  7341. AddAlchemyRecipe('Recipe for Cat 1');
  7342.  
  7343.  
  7344.  
  7345. AddAlchemyRecipe('Recipe for Maribor Forest 1');
  7346. AddAlchemyRecipe('Recipe for Petris Philtre 1');
  7347. AddAlchemyRecipe('Recipe for Swallow 1');
  7348. AddAlchemyRecipe('Recipe for Tawny Owl 1');
  7349.  
  7350. AddAlchemyRecipe('Recipe for White Gull 1');
  7351. AddAlchemyRecipe('Recipe for White Honey 1');
  7352. AddAlchemyRecipe('Recipe for White Raffards Decoction 1');
  7353.  
  7354.  
  7355.  
  7356. AddAlchemyRecipe('Recipe for Beast Oil 1');
  7357. AddAlchemyRecipe('Recipe for Cursed Oil 1');
  7358. AddAlchemyRecipe('Recipe for Hanged Man Venom 1');
  7359. AddAlchemyRecipe('Recipe for Hybrid Oil 1');
  7360. AddAlchemyRecipe('Recipe for Insectoid Oil 1');
  7361. AddAlchemyRecipe('Recipe for Magicals Oil 1');
  7362. AddAlchemyRecipe('Recipe for Necrophage Oil 1');
  7363. AddAlchemyRecipe('Recipe for Specter Oil 1');
  7364. AddAlchemyRecipe('Recipe for Vampire Oil 1');
  7365. AddAlchemyRecipe('Recipe for Draconide Oil 1');
  7366. AddAlchemyRecipe('Recipe for Ogre Oil 1');
  7367. AddAlchemyRecipe('Recipe for Relic Oil 1');
  7368. AddAlchemyRecipe('Recipe for Beast Oil 2');
  7369. AddAlchemyRecipe('Recipe for Cursed Oil 2');
  7370. AddAlchemyRecipe('Recipe for Hanged Man Venom 2');
  7371. AddAlchemyRecipe('Recipe for Hybrid Oil 2');
  7372. AddAlchemyRecipe('Recipe for Insectoid Oil 2');
  7373. AddAlchemyRecipe('Recipe for Magicals Oil 2');
  7374. AddAlchemyRecipe('Recipe for Necrophage Oil 2');
  7375. AddAlchemyRecipe('Recipe for Specter Oil 2');
  7376. AddAlchemyRecipe('Recipe for Vampire Oil 2');
  7377. AddAlchemyRecipe('Recipe for Draconide Oil 2');
  7378. AddAlchemyRecipe('Recipe for Ogre Oil 2');
  7379. AddAlchemyRecipe('Recipe for Relic Oil 2');
  7380.  
  7381.  
  7382. AddAlchemyRecipe('Recipe for Dancing Star 1');
  7383.  
  7384. AddAlchemyRecipe('Recipe for Dwimeritum Bomb 1');
  7385.  
  7386. AddAlchemyRecipe('Recipe for Grapeshot 1');
  7387. AddAlchemyRecipe('Recipe for Samum 1');
  7388.  
  7389. AddAlchemyRecipe('Recipe for White Frost 1');
  7390.  
  7391.  
  7392.  
  7393. AddAlchemyRecipe('Recipe for Dwarven spirit 1');
  7394. AddAlchemyRecipe('Recipe for Alcohest 1');
  7395. AddAlchemyRecipe('Recipe for White Gull 1');
  7396.  
  7397.  
  7398. AddStartingSchematics();
  7399.  
  7400.  
  7401. ids.Clear();
  7402. ids = inv.AddAnItem('Swallow 2');
  7403. EquipItem(ids[0]);
  7404. ids.Clear();
  7405. ids = inv.AddAnItem('Thunderbolt 2');
  7406. EquipItem(ids[0]);
  7407. ids.Clear();
  7408. ids = inv.AddAnItem('Tawny Owl 2');
  7409. EquipItem(ids[0]);
  7410. ids.Clear();
  7411.  
  7412. ids = inv.AddAnItem('Grapeshot 2');
  7413. EquipItem(ids[0]);
  7414. ids.Clear();
  7415. ids = inv.AddAnItem('Samum 2');
  7416. EquipItem(ids[0]);
  7417.  
  7418. inv.AddAnItem('Dwimeritum Bomb 1');
  7419. inv.AddAnItem('Dragons Dream 1');
  7420. inv.AddAnItem('Silver Dust Bomb 1');
  7421. inv.AddAnItem('White Frost 2');
  7422. inv.AddAnItem('Devils Puffball 2');
  7423. inv.AddAnItem('Dancing Star 2');
  7424. inv.AddAnItem('Beast Oil 1');
  7425. inv.AddAnItem('Cursed Oil 1');
  7426. inv.AddAnItem('Hanged Man Venom 2');
  7427. inv.AddAnItem('Hybrid Oil 1');
  7428. inv.AddAnItem('Insectoid Oil 1');
  7429. inv.AddAnItem('Magicals Oil 1');
  7430. inv.AddAnItem('Necrophage Oil 2');
  7431. inv.AddAnItem('Specter Oil 1');
  7432. inv.AddAnItem('Vampire Oil 1');
  7433. inv.AddAnItem('Draconide Oil 1');
  7434. inv.AddAnItem('Relic Oil 1');
  7435. inv.AddAnItem('Black Blood 1');
  7436. inv.AddAnItem('Blizzard 1');
  7437. inv.AddAnItem('Cat 2');
  7438. inv.AddAnItem('Full Moon 1');
  7439. inv.AddAnItem('Maribor Forest 1');
  7440. inv.AddAnItem('Petris Philtre 1');
  7441. inv.AddAnItem('White Gull 1', 3);
  7442. inv.AddAnItem('White Honey 2');
  7443. inv.AddAnItem('White Raffards Decoction 1');
  7444.  
  7445.  
  7446. inv.AddAnItem('Mutagen 17');
  7447. inv.AddAnItem('Mutagen 19');
  7448. inv.AddAnItem('Mutagen 27');
  7449. inv.AddAnItem('Mutagen 26');
  7450.  
  7451.  
  7452. inv.AddAnItem('weapon_repair_kit_1', 5);
  7453. inv.AddAnItem('weapon_repair_kit_2', 3);
  7454. inv.AddAnItem('armor_repair_kit_1', 5);
  7455. inv.AddAnItem('armor_repair_kit_2', 3);
  7456.  
  7457.  
  7458. quantityMedium = 2;
  7459. quantityLow = 1;
  7460. inv.AddAnItem('Rune stribog lesser', quantityMedium);
  7461. inv.AddAnItem('Rune stribog', quantityLow);
  7462. inv.AddAnItem('Rune dazhbog lesser', quantityMedium);
  7463. inv.AddAnItem('Rune dazhbog', quantityLow);
  7464. inv.AddAnItem('Rune devana lesser', quantityMedium);
  7465. inv.AddAnItem('Rune devana', quantityLow);
  7466. inv.AddAnItem('Rune zoria lesser', quantityMedium);
  7467. inv.AddAnItem('Rune zoria', quantityLow);
  7468. inv.AddAnItem('Rune morana lesser', quantityMedium);
  7469. inv.AddAnItem('Rune morana', quantityLow);
  7470. inv.AddAnItem('Rune triglav lesser', quantityMedium);
  7471. inv.AddAnItem('Rune triglav', quantityLow);
  7472. inv.AddAnItem('Rune svarog lesser', quantityMedium);
  7473. inv.AddAnItem('Rune svarog', quantityLow);
  7474. inv.AddAnItem('Rune veles lesser', quantityMedium);
  7475. inv.AddAnItem('Rune veles', quantityLow);
  7476. inv.AddAnItem('Rune perun lesser', quantityMedium);
  7477. inv.AddAnItem('Rune perun', quantityLow);
  7478. inv.AddAnItem('Rune elemental lesser', quantityMedium);
  7479. inv.AddAnItem('Rune elemental', quantityLow);
  7480.  
  7481. inv.AddAnItem('Glyph aard lesser', quantityMedium);
  7482. inv.AddAnItem('Glyph aard', quantityLow);
  7483. inv.AddAnItem('Glyph axii lesser', quantityMedium);
  7484. inv.AddAnItem('Glyph axii', quantityLow);
  7485. inv.AddAnItem('Glyph igni lesser', quantityMedium);
  7486. inv.AddAnItem('Glyph igni', quantityLow);
  7487. inv.AddAnItem('Glyph quen lesser', quantityMedium);
  7488. inv.AddAnItem('Glyph quen', quantityLow);
  7489. inv.AddAnItem('Glyph yrden lesser', quantityMedium);
  7490. inv.AddAnItem('Glyph yrden', quantityLow);
  7491.  
  7492.  
  7493. StandaloneEp1_2();
  7494. }
  7495.  
  7496. public final function StandaloneEp1_2()
  7497. {
  7498. var horseId : SItemUniqueId;
  7499. var ids : array<SItemUniqueId>;
  7500. var ents : array< CJournalBase >;
  7501. var i : int;
  7502. var manager : CWitcherJournalManager;
  7503.  
  7504.  
  7505. inv.AddAnItem( 'Cows milk', 20 );
  7506. ids.Clear();
  7507. ids = inv.AddAnItem( 'Dumpling', 44 );
  7508. EquipItem(ids[0]);
  7509.  
  7510.  
  7511. inv.AddAnItem('Clearing Potion', 2, true, false, false);
  7512.  
  7513.  
  7514. GetHorseManager().RemoveAllItems();
  7515.  
  7516. ids.Clear();
  7517. ids = inv.AddAnItem('Horse Bag 2');
  7518. horseId = GetHorseManager().MoveItemToHorse(ids[0]);
  7519. GetHorseManager().EquipItem(horseId);
  7520.  
  7521. ids.Clear();
  7522. ids = inv.AddAnItem('Horse Blinder 2');
  7523. horseId = GetHorseManager().MoveItemToHorse(ids[0]);
  7524. GetHorseManager().EquipItem(horseId);
  7525.  
  7526. ids.Clear();
  7527. ids = inv.AddAnItem('Horse Saddle 2');
  7528. horseId = GetHorseManager().MoveItemToHorse(ids[0]);
  7529. GetHorseManager().EquipItem(horseId);
  7530.  
  7531. manager = theGame.GetJournalManager();
  7532.  
  7533.  
  7534. manager.GetActivatedOfType( 'CJournalCreature', ents );
  7535. for(i=0; i<ents.Size(); i+=1)
  7536. {
  7537. manager.ActivateEntry(ents[i], JS_Inactive, false, true);
  7538. }
  7539.  
  7540.  
  7541. ents.Clear();
  7542. manager.GetActivatedOfType( 'CJournalCharacter', ents );
  7543. for(i=0; i<ents.Size(); i+=1)
  7544. {
  7545. manager.ActivateEntry(ents[i], JS_Inactive, false, true);
  7546. }
  7547.  
  7548.  
  7549. ents.Clear();
  7550. manager.GetActivatedOfType( 'CJournalQuest', ents );
  7551. for(i=0; i<ents.Size(); i+=1)
  7552. {
  7553.  
  7554. if( StrStartsWith(ents[i].baseName, "q60"))
  7555. continue;
  7556.  
  7557. manager.ActivateEntry(ents[i], JS_Inactive, false, true);
  7558. }
  7559.  
  7560.  
  7561. manager.ActivateEntryByScriptTag('TutorialAard', JS_Active);
  7562. manager.ActivateEntryByScriptTag('TutorialAdrenaline', JS_Active);
  7563. manager.ActivateEntryByScriptTag('TutorialAxii', JS_Active);
  7564. manager.ActivateEntryByScriptTag('TutorialAxiiDialog', JS_Active);
  7565. manager.ActivateEntryByScriptTag('TutorialCamera', JS_Active);
  7566. manager.ActivateEntryByScriptTag('TutorialCamera_pad', JS_Active);
  7567. manager.ActivateEntryByScriptTag('TutorialCiriBlink', JS_Active);
  7568. manager.ActivateEntryByScriptTag('TutorialCiriCharge', JS_Active);
  7569. manager.ActivateEntryByScriptTag('TutorialCiriStamina', JS_Active);
  7570. manager.ActivateEntryByScriptTag('TutorialCounter', JS_Active);
  7571. manager.ActivateEntryByScriptTag('TutorialDialogClose', JS_Active);
  7572. manager.ActivateEntryByScriptTag('TutorialFallingRoll', JS_Active);
  7573. manager.ActivateEntryByScriptTag('TutorialFocus', JS_Active);
  7574. manager.ActivateEntryByScriptTag('TutorialFocusClues', JS_Active);
  7575. manager.ActivateEntryByScriptTag('TutorialFocusClues', JS_Active);
  7576. manager.ActivateEntryByScriptTag('TutorialHorseRoad', JS_Active);
  7577. manager.ActivateEntryByScriptTag('TutorialHorseSpeed0', JS_Active);
  7578. manager.ActivateEntryByScriptTag('TutorialHorseSpeed0_pad', JS_Active);
  7579. manager.ActivateEntryByScriptTag('TutorialHorseSpeed1', JS_Active);
  7580. manager.ActivateEntryByScriptTag('TutorialHorseSpeed2', JS_Active);
  7581. manager.ActivateEntryByScriptTag('TutorialHorseSummon', JS_Active);
  7582. manager.ActivateEntryByScriptTag('TutorialHorseSummon_pad', JS_Active);
  7583. manager.ActivateEntryByScriptTag('TutorialIgni', JS_Active);
  7584. manager.ActivateEntryByScriptTag('TutorialJournalAlternateSings', JS_Active);
  7585. manager.ActivateEntryByScriptTag('TutorialJournalBoatDamage', JS_Active);
  7586. manager.ActivateEntryByScriptTag('TutorialJournalBoatMount', JS_Active);
  7587. manager.ActivateEntryByScriptTag('TutorialJournalBuffs', JS_Active);
  7588. manager.ActivateEntryByScriptTag('TutorialJournalCharDevLeveling', JS_Active);
  7589. manager.ActivateEntryByScriptTag('TutorialJournalCharDevSkills', JS_Active);
  7590. manager.ActivateEntryByScriptTag('TutorialJournalCrafting', JS_Active);
  7591. manager.ActivateEntryByScriptTag('TutorialJournalCrossbow', JS_Active);
  7592. manager.ActivateEntryByScriptTag('TutorialJournalDialogGwint', JS_Active);
  7593. manager.ActivateEntryByScriptTag('TutorialJournalDialogShop', JS_Active);
  7594. manager.ActivateEntryByScriptTag('TutorialJournalDive', JS_Active);
  7595. manager.ActivateEntryByScriptTag('TutorialJournalDodge', JS_Active);
  7596. manager.ActivateEntryByScriptTag('TutorialJournalDodge_pad', JS_Active);
  7597. manager.ActivateEntryByScriptTag('TutorialJournalDrawWeapon', JS_Active);
  7598. manager.ActivateEntryByScriptTag('TutorialJournalDrawWeapon_pad', JS_Active);
  7599. manager.ActivateEntryByScriptTag('TutorialJournalDurability', JS_Active);
  7600. manager.ActivateEntryByScriptTag('TutorialJournalExplorations', JS_Active);
  7601. manager.ActivateEntryByScriptTag('TutorialJournalExplorations_pad', JS_Active);
  7602. manager.ActivateEntryByScriptTag('TutorialJournalFastTravel', JS_Active);
  7603. manager.ActivateEntryByScriptTag('TutorialJournalFocusRedObjects', JS_Active);
  7604. manager.ActivateEntryByScriptTag('TutorialJournalGasClouds', JS_Active);
  7605. manager.ActivateEntryByScriptTag('TutorialJournalHeavyAttacks', JS_Active);
  7606. manager.ActivateEntryByScriptTag('TutorialJournalHorse', JS_Active);
  7607. manager.ActivateEntryByScriptTag('TutorialJournalHorseStamina', JS_Active);
  7608. manager.ActivateEntryByScriptTag('TutorialJournalJump', JS_Active);
  7609. manager.ActivateEntryByScriptTag('TutorialJournalLightAttacks', JS_Active);
  7610. manager.ActivateEntryByScriptTag('TutorialJournalLightAttacks_pad', JS_Active);
  7611. manager.ActivateEntryByScriptTag('TutorialJournalMeditation', JS_Active);
  7612. manager.ActivateEntryByScriptTag('TutorialJournalMeditation_pad', JS_Active);
  7613. manager.ActivateEntryByScriptTag('TutorialJournalMonsterThreatLevels', JS_Active);
  7614. manager.ActivateEntryByScriptTag('TutorialJournalMovement', JS_Active);
  7615. manager.ActivateEntryByScriptTag('TutorialJournalMovement_pad', JS_Active);
  7616. manager.ActivateEntryByScriptTag('TutorialJournalMutagenIngredient', JS_Active);
  7617. manager.ActivateEntryByScriptTag('TutorialJournalMutagenPotion', JS_Active);
  7618. manager.ActivateEntryByScriptTag('TutorialJournalOils', JS_Active);
  7619. manager.ActivateEntryByScriptTag('TutorialJournalPetards', JS_Active);
  7620. manager.ActivateEntryByScriptTag('TutorialJournalPotions', JS_Active);
  7621. manager.ActivateEntryByScriptTag('TutorialJournalPotions_pad', JS_Active);
  7622. manager.ActivateEntryByScriptTag('TutorialJournalQuestArea', JS_Active);
  7623. manager.ActivateEntryByScriptTag('TutorialJournalRadial', JS_Active);
  7624. manager.ActivateEntryByScriptTag('TutorialJournalRifts', JS_Active);
  7625. manager.ActivateEntryByScriptTag('TutorialJournalRun', JS_Active);
  7626. manager.ActivateEntryByScriptTag('TutorialJournalShopDescription', JS_Active);
  7627. manager.ActivateEntryByScriptTag('TutorialJournalSignCast', JS_Active);
  7628. manager.ActivateEntryByScriptTag('TutorialJournalSignCast_pad', JS_Active);
  7629. manager.ActivateEntryByScriptTag('TutorialJournalSpecialAttacks', JS_Active);
  7630. manager.ActivateEntryByScriptTag('TutorialJournalStaminaExploration', JS_Active);
  7631. manager.ActivateEntryByScriptTag('TutorialJumpHang', JS_Active);
  7632. manager.ActivateEntryByScriptTag('TutorialLadder', JS_Active);
  7633. manager.ActivateEntryByScriptTag('TutorialLadderMove', JS_Active);
  7634. manager.ActivateEntryByScriptTag('TutorialLadderMove_pad', JS_Active);
  7635. manager.ActivateEntryByScriptTag('TutorialObjectiveSwitching', JS_Active);
  7636. manager.ActivateEntryByScriptTag('TutorialOxygen', JS_Active);
  7637. manager.ActivateEntryByScriptTag('TutorialParry', JS_Active);
  7638. manager.ActivateEntryByScriptTag('TutorialPOIUncovered', JS_Active);
  7639. manager.ActivateEntryByScriptTag('TutorialQuen', JS_Active);
  7640. manager.ActivateEntryByScriptTag('TutorialRoll', JS_Active);
  7641. manager.ActivateEntryByScriptTag('TutorialRoll_pad', JS_Active);
  7642. manager.ActivateEntryByScriptTag('TutorialSpeedPairing', JS_Active);
  7643. manager.ActivateEntryByScriptTag('TutorialSprint', JS_Active);
  7644. manager.ActivateEntryByScriptTag('TutorialStaminaSigns', JS_Active);
  7645. manager.ActivateEntryByScriptTag('TutorialStealing', JS_Active);
  7646. manager.ActivateEntryByScriptTag('TutorialSwimmingSpeed', JS_Active);
  7647. manager.ActivateEntryByScriptTag('TutorialTimedChoiceDialog', JS_Active);
  7648. manager.ActivateEntryByScriptTag('TutorialYrden', JS_Active);
  7649.  
  7650.  
  7651. FactsAdd('kill_base_tutorials');
  7652.  
  7653.  
  7654. theGame.GetTutorialSystem().RemoveAllQueuedTutorials();
  7655.  
  7656.  
  7657. FactsAdd('standalone_ep1');
  7658. FactsRemove("StandAloneEP1");
  7659.  
  7660. theGame.GetJournalManager().ForceUntrackingQuestForEP1Savegame();
  7661. }
  7662. function Debug_FocusBoyFocusGain()
  7663. {
  7664. var focusGain : float;
  7665. focusGain = FactsQuerySum("debug_fact_focus_boy") ;
  7666. GainStat(BCS_Focus, focusGain );
  7667. }
  7668. }
  7669.  
  7670. exec function fuqfep1()
  7671. {
  7672. theGame.GetJournalManager().ForceUntrackingQuestForEP1Savegame();
  7673. }
  7674.  
  7675.  
  7676.  
  7677.  
  7678.  
  7679. function GetWitcherPlayer() : W3PlayerWitcher
  7680.  
  7681. {return (W3PlayerWitcher)thePlayer;
  7682.  
  7683.  
  7684. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement