Advertisement
Hird194

Unexpected end of file found after '{' at line 1126

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