Novarsk

Untitled

Jul 6th, 2023
34
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 239.01 KB | None | 0 0
  1. /***********************************************************************/
  2. /** © 2015 CD PROJEKT S.A. All rights reserved.
  3. /** THE WITCHER® is a trademark of CD PROJEKT S. A.
  4. /** The Witcher game is based on the prose of Andrzej Sapkowski.
  5. /***********************************************************************/
  6.  
  7.  
  8.  
  9.  
  10. struct SItemAttributes
  11. {
  12. var abilityName, attributeName : name;
  13. var buffType : EEffectType;
  14. }
  15.  
  16. class IInventoryScriptedListener
  17. {
  18. event OnInventoryScriptedEvent( eventType : EInventoryEventType, itemId : SItemUniqueId, quantity : int, fromAssociatedInventory : bool ) {}
  19. }
  20.  
  21. import struct SItemNameProperty
  22. {
  23. import editable var itemName : name;
  24. };
  25.  
  26. import struct SR4LootNameProperty
  27. {
  28. import editable var lootName : name;
  29. };
  30.  
  31. struct SItemExt
  32. {
  33. editable var itemName : SItemNameProperty;
  34. editable var quantity : int;
  35. default quantity = 1;
  36. };
  37.  
  38. struct SCardSourceData
  39. {
  40. var cardName : name;
  41. var source : string;
  42. var originArea : string;
  43. var originQuest : string;
  44. var details : string;
  45. var coords : string;
  46. };
  47.  
  48.  
  49. import struct SItemChangedData
  50. {
  51. import const var itemName : name;
  52. import const var quantity : int;
  53. import const var informGui : bool;
  54. import const var ids : array< SItemUniqueId >;
  55. };
  56.  
  57. import class CInventoryComponent extends CComponent
  58. {
  59. editable var priceMult : float;
  60. editable var priceRepairMult : float;
  61. editable var priceRepair : float;
  62. editable var fundsType : EInventoryFundsType;
  63.  
  64. private var recentlyAddedItems : array<SItemUniqueId>;
  65. private var fundsMax : int;
  66. private var daysToIncreaseFunds : int;
  67.  
  68. default priceMult = 1.0;
  69. default priceRepairMult = 1.0;
  70. default priceRepair = 10.0;
  71. default fundsType = EInventoryFunds_Avg;
  72. default daysToIncreaseFunds = 5;
  73.  
  74.  
  75.  
  76.  
  77. public function GetFundsType() : EInventoryFundsType
  78. {
  79. return fundsType;
  80. }
  81.  
  82. public function GetDaysToIncreaseFunds() : int
  83. {
  84. return daysToIncreaseFunds;
  85. }
  86.  
  87. // W3EE - Begin
  88. public function GetFundsMax() : float
  89. {
  90. if ( EInventoryFunds_Broke == fundsType )
  91. {
  92. return 20;
  93. }
  94. else if ( EInventoryFunds_Avg == fundsType )
  95. {
  96. return 300;
  97. }
  98. else if ( EInventoryFunds_Poor == fundsType )
  99. {
  100. return 100;
  101. }
  102. else if ( EInventoryFunds_Rich == fundsType )
  103. {
  104. return 1000;
  105. }
  106. else if ( EInventoryFunds_RichQuickStart == fundsType )
  107. {
  108. return 2500;
  109. }
  110. return -1;
  111. }
  112.  
  113. public function SetupFunds()
  114. {
  115. if ( EInventoryFunds_Broke == fundsType )
  116. {
  117. AddMoney( (int)( 10 * GetFundsModifier() ) );
  118. }
  119. else if ( EInventoryFunds_Poor == fundsType )
  120. {
  121. AddMoney( (int)( 50 * GetFundsModifier() ) );
  122. }
  123. else if ( EInventoryFunds_Avg == fundsType )
  124. {
  125. AddMoney( (int)( 150 * GetFundsModifier() ) );
  126. }
  127. else if ( EInventoryFunds_Rich == fundsType )
  128. {
  129. AddMoney( (int)( 500 * GetFundsModifier() ) );
  130. }
  131. else if ( EInventoryFunds_RichQuickStart == fundsType )
  132. {
  133. AddMoney( (int)( 1250 * GetFundsModifier() ) );
  134. }
  135. }
  136.  
  137. public function IncreaseFunds()
  138. {
  139. if ( GetMoney() < GetFundsMax() )
  140. {
  141. if ( EInventoryFunds_Broke == fundsType )
  142. {
  143. AddMoney( (int)( 2 * GetFundsModifier()) );
  144. }
  145. else if ( EInventoryFunds_Avg == fundsType )
  146. {
  147. AddMoney( (int)( 30 * GetFundsModifier()) );
  148. }
  149. else if ( EInventoryFunds_Poor == fundsType )
  150. {
  151. AddMoney( (int)( 10 * GetFundsModifier() ) );
  152. }
  153. else if ( EInventoryFunds_Rich == fundsType )
  154. {
  155. AddMoney( (int)( 100 * GetFundsModifier() ) );
  156. }
  157. else if ( EInventoryFunds_RichQuickStart == fundsType )
  158. {
  159. AddMoney( 100 + (int)( 250 * GetFundsModifier() ) );
  160. }
  161. }
  162. }
  163.  
  164. public function GetMoney() : int
  165. {
  166. /*if( thePlayer == GetEntity() && (Equipment().GetHorseDistance() <= 81 || Options().InvEverywhere()) )
  167. {*/
  168. if( GetEntity() == thePlayer )
  169. return GetItemQuantityByName('Crowns') + GetWitcherPlayer().GetHorseManager().GetInventoryComponent().GetItemQuantityByName('Crowns');
  170. else
  171. if( this == GetWitcherPlayer().GetHorseManager().GetInventoryComponent() )
  172. return GetItemQuantityByName('Crowns') + GetWitcherPlayer().inv.GetItemQuantityByName('Crowns');
  173. else
  174. return GetItemQuantityByName('Crowns');
  175. /*}
  176. else
  177. {
  178. return GetItemQuantityByName( 'Crowns' );
  179. }*/
  180. }
  181. // W3EE - End
  182.  
  183. public function SetMoney( amount : int )
  184. {
  185. var currentMoney : int;
  186.  
  187. if ( amount >= 0 )
  188. {
  189. currentMoney = GetMoney();
  190. RemoveMoney( currentMoney );
  191.  
  192. AddAnItem( 'Crowns', amount );
  193. }
  194. }
  195.  
  196. public function AddMoney( amount : int )
  197. {
  198. if ( amount > 0 )
  199. {
  200. AddAnItem( 'Crowns', amount );
  201.  
  202. if ( thePlayer == GetEntity() )
  203. {
  204. theTelemetry.LogWithValue( TE_HERO_CASH_CHANGED, amount );
  205. }
  206. }
  207. }
  208.  
  209. // W3EE - Begin
  210. public function RemoveMoney( amount : int )
  211. {
  212. var money, diff : int;
  213.  
  214. if ( amount > 0 )
  215. {
  216. money = GetItemQuantityByName('Crowns');
  217. if( GetEntity() == thePlayer && amount > money )
  218. {
  219. diff = amount - money;
  220. RemoveItemByName('Crowns', money);
  221. GetWitcherPlayer().GetHorseManager().GetInventoryComponent().RemoveItemByName('Crowns', diff);
  222. }
  223. else
  224. if( GetEntity() == GetWitcherPlayer().GetHorseManager() && amount > money )
  225. {
  226. diff = amount - money;
  227. RemoveItemByName('Crowns', money);
  228. GetWitcherPlayer().inv.RemoveItemByName('Crowns', diff);
  229. }
  230. else RemoveItemByName( 'Crowns', amount );
  231.  
  232. if ( thePlayer == GetEntity() )
  233. {
  234. theTelemetry.LogWithValue( TE_HERO_CASH_CHANGED, -amount );
  235. }
  236. }
  237. }
  238. // W3EE - End
  239.  
  240.  
  241.  
  242.  
  243.  
  244. import final function GetItemAbilityAttributeValue( itemId : SItemUniqueId, attributeName : name, abilityName : name) : SAbilityAttributeValue;
  245.  
  246. import final function GetItemFromSlot( slotName : name ) : SItemUniqueId;
  247.  
  248.  
  249. import final function IsIdValid( itemId : SItemUniqueId ) : bool;
  250.  
  251.  
  252. import final function GetItemCount( optional useAssociatedInventory : bool ) : int;
  253.  
  254.  
  255. import final function GetItemsNames() : array< name >;
  256.  
  257.  
  258. import final function GetAllItems( out items : array< SItemUniqueId > );
  259.  
  260.  
  261. import public function GetItemId( itemName : name ) : SItemUniqueId;
  262.  
  263.  
  264. import public function GetItemsIds( itemName : name ) : array< SItemUniqueId >;
  265.  
  266.  
  267. import final function GetItemsByTag( tag : name ) : array< SItemUniqueId >;
  268.  
  269.  
  270. import final function GetItemsByCategory( category : name ) : array< SItemUniqueId >;
  271.  
  272.  
  273. import final function GetSchematicIngredients(itemName : SItemUniqueId, out quantity : array<int>, out names : array<name>);
  274.  
  275.  
  276. import final function GetSchematicRequiredCraftsmanType(craftName : SItemUniqueId) : name;
  277.  
  278.  
  279. import final function GetSchematicRequiredCraftsmanLevel(craftName : SItemUniqueId) : name;
  280.  
  281.  
  282. import final function GetNumOfStackedItems( itemUniqueId: SItemUniqueId ) : int;
  283.  
  284. import final function InitInvFromTemplate( resource : CEntityTemplate );
  285.  
  286.  
  287.  
  288.  
  289. import final function SplitItem( itemID : SItemUniqueId, quantity : int ) : SItemUniqueId;
  290.  
  291.  
  292.  
  293. import final function SetItemStackable( itemID : SItemUniqueId, flag : bool );
  294.  
  295.  
  296. import final function GetCategoryDefaultItem( category : name ) : name;
  297.  
  298.  
  299.  
  300.  
  301.  
  302.  
  303. import final function GetItemLocalizedNameByName( itemName : CName ) : string;
  304.  
  305.  
  306. import final function GetItemLocalizedDescriptionByName( itemName : CName ) : string;
  307.  
  308.  
  309. import final function GetItemLocalizedNameByUniqueID( itemUniqueId : SItemUniqueId ) : string;
  310.  
  311. // W3EE - Begin
  312. public final function GetItemLocNameByID( item : SItemUniqueId ) : string
  313. {
  314. //Kolaris - Inventory Options
  315. if( !IsItemAnyArmor(item) && !IsItemWeapon(item) )
  316. {
  317. if (Options().DetailedItemNames())
  318. return GetLocStringByKeyExt(GetItemLocalizedNameByUniqueID(item)) + " (" + GetItemName(item) + ")" ;
  319. else
  320. return GetLocStringByKeyExt(GetItemLocalizedNameByUniqueID(item));
  321. }
  322.  
  323. return GetItemNameWithPrefix(item);
  324. }
  325.  
  326. private function GetItemNameWithPrefix( item : SItemUniqueId ) : string
  327. {
  328. var attributeValue : SAbilityAttributeValue;
  329. var abilityArray, arr : array<name>;
  330. var itemPrefix, itemName : string;
  331. var temp, textLanguage : string;
  332. var i : int;
  333.  
  334. abilityArray.Clear();
  335. theGame.GetGameLanguageName(temp, textLanguage);
  336. if( IsItemWeapon(item) )
  337. {
  338. if( GetItemQuality(item) >= 1 )
  339. {
  340. arr = theGame.params.GetCommonWeaponAbilityArray();
  341. ArrayOfNamesAppend(abilityArray, arr);
  342. }
  343. if( GetItemQuality(item) >= 2 )
  344. {
  345. arr = theGame.params.GetMasterworkWeaponAbilityArray();
  346. ArrayOfNamesAppend(abilityArray, arr);
  347. }
  348. if( GetItemQuality(item) >= 3 )
  349. {
  350. arr = theGame.params.GetMagicalWeaponAbilityArray();
  351. ArrayOfNamesAppend(abilityArray, arr);
  352. }
  353. }
  354. else
  355. if( IsItemAnyArmor(item) )
  356. {
  357. if( GetItemCategory(item) == 'armor' )
  358. {
  359. if( GetItemQuality(item) >= 2 )
  360. {
  361. if( GetArmorType(item) == EAT_Light )
  362. arr = theGame.params.GetMasterLightArmorAbilityArray();
  363. else
  364. if( GetArmorType(item) == EAT_Medium )
  365. arr = theGame.params.GetMasterMediumArmorAbilityArray();
  366. else
  367. if( GetArmorType(item) == EAT_Heavy )
  368. arr = theGame.params.GetMasterHeavyArmorAbilityArray();
  369.  
  370. ArrayOfNamesAppend(abilityArray, arr);
  371. }
  372. if( GetItemQuality(item) >= 3 )
  373. {
  374. if( GetArmorType(item) == EAT_Light )
  375. arr = theGame.params.GetMagicalLightArmorAbilityArray();
  376. else
  377. if( GetArmorType(item) == EAT_Medium )
  378. arr = theGame.params.GetMagicalMediumArmorAbilityArray();
  379. else
  380. if( GetArmorType(item) == EAT_Heavy )
  381. arr = theGame.params.GetMagicalHeavyArmorAbilityArray();
  382.  
  383. ArrayOfNamesAppend(abilityArray, arr);
  384. }
  385. }
  386. else
  387. if( GetItemCategory(item) == 'boots' )
  388. {
  389. if( GetItemQuality(item) >= 2 )
  390. {
  391. if( GetArmorType(item) == EAT_Light )
  392. arr = theGame.params.GetMasterLightBootsAbilityArray();
  393. else
  394. if( GetArmorType(item) == EAT_Medium )
  395. arr = theGame.params.GetMasterMediumBootsAbilityArray();
  396. else
  397. if( GetArmorType(item) == EAT_Heavy )
  398. arr = theGame.params.GetMasterHeavyBootsAbilityArray();
  399.  
  400. ArrayOfNamesAppend(abilityArray, arr);
  401. }
  402. if( GetItemQuality(item) >= 3 )
  403. {
  404. if( GetArmorType(item) == EAT_Light )
  405. arr = theGame.params.GetMagicalLightBootsAbilityArray();
  406. else
  407. if( GetArmorType(item) == EAT_Medium )
  408. arr = theGame.params.GetMagicalMediumBootsAbilityArray();
  409. else
  410. if( GetArmorType(item) == EAT_Heavy )
  411. arr = theGame.params.GetMagicalHeavyBootsAbilityArray();
  412.  
  413. ArrayOfNamesAppend(abilityArray, arr);
  414. }
  415. }
  416. else
  417. if( GetItemCategory(item) == 'pants' )
  418. {
  419. if( GetItemQuality(item) >= 2 )
  420. {
  421. if( GetArmorType(item) == EAT_Light )
  422. arr = theGame.params.GetMasterLightPantsAbilityArray();
  423. else
  424. if( GetArmorType(item) == EAT_Medium )
  425. arr = theGame.params.GetMasterMediumPantsAbilityArray();
  426. else
  427. if( GetArmorType(item) == EAT_Heavy )
  428. arr = theGame.params.GetMasterHeavyPantsAbilityArray();
  429.  
  430. ArrayOfNamesAppend(abilityArray, arr);
  431. }
  432. if( GetItemQuality(item) >= 3 )
  433. {
  434. if( GetArmorType(item) == EAT_Light )
  435. arr = theGame.params.GetMagicalLightPantsAbilityArray();
  436. else
  437. if( GetArmorType(item) == EAT_Medium )
  438. arr = theGame.params.GetMagicalMediumPantsAbilityArray();
  439. else
  440. if( GetArmorType(item) == EAT_Heavy )
  441. arr = theGame.params.GetMagicalHeavyPantsAbilityArray();
  442.  
  443. ArrayOfNamesAppend(abilityArray, arr);
  444. }
  445. }
  446. else
  447. if( GetItemCategory(item) == 'gloves' )
  448. {
  449. if( GetItemQuality(item) >= 2 )
  450. {
  451. if( GetArmorType(item) == EAT_Light )
  452. arr = theGame.params.GetMasterLightGlovesAbilityArray();
  453. else
  454. if( GetArmorType(item) == EAT_Medium )
  455. arr = theGame.params.GetMasterMediumGlovesAbilityArray();
  456. else
  457. if( GetArmorType(item) == EAT_Heavy )
  458. arr = theGame.params.GetMasterHeavyGlovesAbilityArray();
  459.  
  460. ArrayOfNamesAppend(abilityArray, arr);
  461. }
  462. if( GetItemQuality(item) >= 3 )
  463. {
  464. if( GetArmorType(item) == EAT_Light )
  465. arr = theGame.params.GetMagicalLightGlovesAbilityArray();
  466. else
  467. if( GetArmorType(item) == EAT_Medium )
  468. arr = theGame.params.GetMagicalMediumGlovesAbilityArray();
  469. else
  470. if( GetArmorType(item) == EAT_Heavy )
  471. arr = theGame.params.GetMagicalHeavyGlovesAbilityArray();
  472.  
  473. ArrayOfNamesAppend(abilityArray, arr);
  474. }
  475. }
  476. }
  477.  
  478. itemName = GetLocStringByKeyExt(GetItemLocalizedNameByUniqueID(item));
  479. for(i=0; i<abilityArray.Size(); i+=1)
  480. {
  481. attributeValue = GetItemAttributeValue(item, abilityArray[i]);
  482. if( attributeValue.valueBase > 0 )
  483. {
  484. itemPrefix = GetLocStringByKeyExt(NameToString(abilityArray[i]));
  485. if( itemPrefix != "" )
  486. {
  487. if( textLanguage == "IT" || textLanguage == "FR" || textLanguage == "BR" )
  488. return itemName + " " + itemPrefix;
  489. else
  490. return itemPrefix + " " + itemName;
  491. }
  492.  
  493. break;
  494. }
  495. }
  496.  
  497. return itemName;
  498. }
  499. // W3EE - End
  500.  
  501. import final function GetItemLocalizedDescriptionByUniqueID( itemUniqueId : SItemUniqueId ) : string;
  502.  
  503.  
  504. import final function GetItemIconPathByUniqueID( itemUniqueId : SItemUniqueId ) : string;
  505.  
  506.  
  507. import final function GetItemIconPathByName( itemName : CName ) : string;
  508.  
  509. import final function AddSlot( itemUniqueId : SItemUniqueId ) : bool;
  510.  
  511. import final function GetSlotItemsLimit( itemUniqueId : SItemUniqueId ) : int;
  512.  
  513. import private final function BalanceItemsWithPlayerLevel( playerLevel : int );
  514.  
  515. public function ForceSpawnItemOnStart( itemId : SItemUniqueId ) : bool
  516. {
  517. return ItemHasTag(itemId, 'MutagenIngredient');
  518. }
  519.  
  520. public final function GetItemArmorTotal(item : SItemUniqueId) : SAbilityAttributeValue
  521. {
  522. var armor, armorBonus : SAbilityAttributeValue;
  523. var durMult : float;
  524.  
  525. armor = GetItemAttributeValue(item, theGame.params.ARMOR_VALUE_NAME);
  526. armorBonus = GetRepairObjectBonusValueForArmor(item);
  527. durMult = theGame.params.GetDurabilityMultiplier( GetItemDurabilityRatio(item), false);
  528.  
  529. return armor * durMult + armorBonus;
  530. }
  531.  
  532. public final function GetItemLevel(item : SItemUniqueId) : int
  533. {
  534. var itemCategory : name;
  535. // W3EE - Begin
  536. var itemAttributes, itemAttributes2 : array<SAbilityAttributeValue>;
  537. var itemName : name;
  538. var level, baseLevel, levelDiff, itemQuality, i, altLevel : int;
  539. var canItemScale : bool = false;
  540. var itemTags : array <name>;
  541.  
  542. itemQuality = RoundMath( CalculateAttributeValue( GetItemAttributeValue(item, 'quality' ) ) );
  543. itemCategory = GetItemCategory(item);
  544. itemName = GetItemName(item);
  545.  
  546. switch(itemCategory)
  547. {
  548. case 'armor' :
  549. case 'boots' :
  550. case 'gloves' :
  551. case 'pants' :
  552. itemAttributes.PushBack( GetItemAttributeValue(item, 'armor') );
  553. if( itemAttributes[0].valueBase > 0 ) canItemScale = true;
  554. break;
  555.  
  556. case 'silversword' :
  557. itemAttributes.PushBack( GetItemAttributeValue(item, 'SilverDamage') );
  558. itemAttributes.PushBack( GetItemAttributeValue(item, 'BludgeoningDamage') );
  559. itemAttributes.PushBack( GetItemAttributeValue(item, 'RendingDamage') );
  560. itemAttributes.PushBack( GetItemAttributeValue(item, 'ElementalDamage') );
  561. itemAttributes.PushBack( GetItemAttributeValue(item, 'FireDamage') );
  562. itemAttributes.PushBack( GetItemAttributeValue(item, 'PiercingDamage') );
  563. canItemScale = true;
  564. break;
  565.  
  566. case 'steelsword' :
  567. itemAttributes.PushBack( GetItemAttributeValue(item, 'SlashingDamage') );
  568. itemAttributes.PushBack( GetItemAttributeValue(item, 'BludgeoningDamage') );
  569. itemAttributes.PushBack( GetItemAttributeValue(item, 'RendingDamage') );
  570. itemAttributes.PushBack( GetItemAttributeValue(item, 'ElementalDamage') );
  571. itemAttributes.PushBack( GetItemAttributeValue(item, 'FireDamage') );
  572. itemAttributes.PushBack( GetItemAttributeValue(item, 'SilverDamage') );
  573. itemAttributes.PushBack( GetItemAttributeValue(item, 'PiercingDamage') );
  574. canItemScale = true;
  575. break;
  576.  
  577. case 'crossbow' :
  578. itemAttributes.PushBack( GetItemAttributeValue(item, 'attack_power') );
  579. canItemScale = false;
  580. break;
  581.  
  582. default :
  583. break;
  584. }
  585. level = theGame.params.GetItemLevel(itemCategory, itemAttributes, itemName, baseLevel);
  586.  
  587. if ( FactsQuerySum("NewGamePlus") > 0 )
  588. {
  589. if ( baseLevel > GetWitcherPlayer().GetMaxLevel() )
  590. {
  591. level = baseLevel;
  592. }
  593. }
  594.  
  595. if ( itemQuality == 5 ) level = level - 2;
  596. if ( itemQuality == 4 ) level = level - 1;
  597. //if ( level < 1 ) level = 1;
  598. if ( ItemHasTag(item, 'OlgierdSabre') ) level = level - 3;
  599. if ( (itemQuality == 4 || itemQuality == 5) && ItemHasTag(item, 'EP1') ) level = level - 1;
  600. if ( level < 1 ) level = 1;
  601. if( canItemScale )
  602. switch( GetArmorTypeOriginal(item) )
  603. {
  604. case EAT_Heavy: levelDiff = 90; break;
  605. case EAT_Medium: levelDiff = 60; break;
  606. case EAT_Light: levelDiff = 40; break;
  607. default : levelDiff = 90; break;
  608. }
  609.  
  610. if( ItemHasTag(item, 'Wooden') )
  611. levelDiff = 40;
  612. else
  613. if( ItemHasTag(item, 'DamagedWeapon') )
  614. levelDiff = 55;
  615. else
  616. if( ItemHasTag(item, 'TypeBattleaxe') )
  617. levelDiff = 100;
  618. else
  619. if( ItemHasTag(item, 'TypeBattlemace') )
  620. levelDiff = 95;
  621. else
  622. if( ItemHasTag(item, 'SecondaryWeapon') )
  623. levelDiff = 78;
  624.  
  625. if( itemName == 'Aerondight EP2' )
  626. levelDiff = 95;
  627.  
  628. switch( itemQuality )
  629. {
  630. case 1: levelDiff -= 7; break;
  631. case 2: levelDiff -= 5; break;
  632. case 3: levelDiff -= 3; break;
  633. }
  634.  
  635. levelDiff -= level;
  636.  
  637. if( levelDiff > 0 )
  638. {
  639. switch(itemCategory)
  640. {
  641. case 'armor' :
  642. for (i=0; i<levelDiff; i+=1)
  643. AddItemCraftedAbility(item, 'autogen_fixed_armor_armor', true);
  644. itemAttributes2.PushBack( GetItemAttributeValue(item, 'armor') );
  645. break;
  646.  
  647. case 'boots' :
  648. for (i=0; i<levelDiff; i+=1)
  649. AddItemCraftedAbility(item, 'autogen_fixed_pants_armor', true);
  650. itemAttributes2.PushBack( GetItemAttributeValue(item, 'armor') );
  651. break;
  652.  
  653. case 'gloves' :
  654. for (i=0; i<levelDiff; i+=1)
  655. AddItemCraftedAbility(item, 'autogen_fixed_gloves_armor', true);
  656. itemAttributes2.PushBack( GetItemAttributeValue(item, 'armor') );
  657. break;
  658.  
  659. case 'pants' :
  660. for (i=0; i<levelDiff; i+=1)
  661. AddItemCraftedAbility(item, 'autogen_fixed_pants_armor', true);
  662. itemAttributes2.PushBack( GetItemAttributeValue(item, 'armor') );
  663. break;
  664.  
  665. case 'silversword' :
  666. altLevel = (levelDiff + level) / 4;
  667.  
  668. for (i=0; i<levelDiff; i+=1)
  669. AddItemCraftedAbility(item, 'autogen_fixed_silver_dmg', true);
  670. for (i=0; i<altLevel; i+=1)
  671. AddItemCraftedAbility(item, 'autogen_fixed_steel_dmg', true);
  672.  
  673. itemAttributes2.PushBack( GetItemAttributeValue(item, 'SilverDamage') );
  674. itemAttributes2.PushBack( GetItemAttributeValue(item, 'BludgeoningDamage') );
  675. itemAttributes2.PushBack( GetItemAttributeValue(item, 'RendingDamage') );
  676. itemAttributes2.PushBack( GetItemAttributeValue(item, 'ElementalDamage') );
  677. itemAttributes2.PushBack( GetItemAttributeValue(item, 'FireDamage') );
  678. itemAttributes2.PushBack( GetItemAttributeValue(item, 'PiercingDamage') );
  679. break;
  680.  
  681. case 'steelsword' :
  682. altLevel = levelDiff + level - 4;
  683.  
  684. for (i=0; i<levelDiff; i+=1)
  685. AddItemCraftedAbility(item, 'autogen_fixed_steel_dmg', true);
  686. for (i=0; i<altLevel; i+=1)
  687. AddItemCraftedAbility(item, 'autogen_fixed_silver_dmg', true);
  688.  
  689. itemAttributes2.PushBack( GetItemAttributeValue(item, 'SlashingDamage') );
  690. itemAttributes2.PushBack( GetItemAttributeValue(item, 'BludgeoningDamage') );
  691. itemAttributes2.PushBack( GetItemAttributeValue(item, 'RendingDamage') );
  692. itemAttributes2.PushBack( GetItemAttributeValue(item, 'ElementalDamage') );
  693. itemAttributes2.PushBack( GetItemAttributeValue(item, 'FireDamage') );
  694. itemAttributes2.PushBack( GetItemAttributeValue(item, 'SilverDamage') );
  695. itemAttributes2.PushBack( GetItemAttributeValue(item, 'PiercingDamage') );
  696. break;
  697.  
  698. default : break;
  699. }
  700. level = theGame.params.GetItemLevel(itemCategory, itemAttributes2, itemName);
  701. }
  702. }
  703.  
  704. if ( FactsQuerySum("NewGamePlus") > 0 )
  705. {
  706. if ( level > GetWitcherPlayer().GetMaxLevel() )
  707. {
  708. level = GetWitcherPlayer().GetMaxLevel();
  709. }
  710. }
  711. // W3EE - End
  712. return level;
  713. }
  714.  
  715. public function GetItemLevelColorById( itemId : SItemUniqueId ) : string
  716. {
  717. var color : string;
  718.  
  719. //W3EE - Begin
  720.  
  721.  
  722. /*
  723. if (GetItemLevel(itemId) <= thePlayer.GetLevel())
  724. {
  725. color = "<font color = '#66FF66'>"; // green
  726. }
  727. else
  728. {
  729. color = "<font color = '#9F1919'>"; // red
  730. }
  731. */
  732.  
  733. Equipment().LevelRequirementIndicator(color, itemId, this);
  734. //W3EE - End
  735.  
  736. return color;
  737. }
  738.  
  739. public function GetItemLevelColor( lvl_item : int ) : string
  740. {
  741. var color : string;
  742.  
  743. //W3EE - Begin
  744.  
  745.  
  746. /*
  747. if ( lvl_item > thePlayer.GetLevel() )
  748. {
  749. color = "<font color = '#9F1919'>"; // red
  750. }
  751. else
  752. {
  753. color = "<font color = '#66FF66'>"; // green
  754. }
  755. */
  756.  
  757. Equipment().LevelRequirementIndicator2(color, lvl_item, this);
  758. //W3EE - End
  759.  
  760. return color;
  761. }
  762.  
  763. public final function AutoBalanaceItemsWithPlayerLevel()
  764. {
  765. var playerLevel : int;
  766.  
  767. playerLevel = thePlayer.GetLevel();
  768.  
  769. if( playerLevel < 0 )
  770. {
  771. playerLevel = 0;
  772. }
  773.  
  774. BalanceItemsWithPlayerLevel( playerLevel );
  775. }
  776.  
  777. public function GetItemsByName(itemName : name) : array<SItemUniqueId>
  778. {
  779. var ret : array<SItemUniqueId>;
  780. var i : int;
  781.  
  782. if(!IsNameValid(itemName))
  783. return ret;
  784.  
  785. GetAllItems(ret);
  786.  
  787. for(i=ret.Size()-1; i>=0; i-=1)
  788. {
  789. if(GetItemName(ret[i]) != itemName)
  790. {
  791. ret.EraseFast( i );
  792. }
  793. }
  794.  
  795. return ret;
  796. }
  797.  
  798. public final function GetSingletonItems() : array<SItemUniqueId>
  799. {
  800. return GetItemsByTag(theGame.params.TAG_ITEM_SINGLETON);
  801. }
  802.  
  803.  
  804. import final function GetItemQuantityByName( itemName : name, optional useAssociatedInventory : bool , optional ignoreTags : array< name > ) : int;
  805.  
  806.  
  807. import final function GetItemQuantityByCategory( itemCategory : name, optional useAssociatedInventory : bool , optional ignoreTags : array< name > ) : int;
  808.  
  809.  
  810. import final function GetItemQuantityByTag( itemTag : name, optional useAssociatedInventory : bool , optional ignoreTags : array< name > ) : int;
  811.  
  812.  
  813. import final function GetAllItemsQuantity( optional useAssociatedInventory : bool , optional ignoreTags : array< name > ) : int;
  814.  
  815. public function IsEmpty(optional bSkipNoDropNoShow : bool) : bool
  816. {
  817. var i : int;
  818. var itemIds : array<SItemUniqueId>;
  819.  
  820. if(bSkipNoDropNoShow)
  821. {
  822. GetAllItems( itemIds );
  823. for(i=0; i<itemIds.Size(); i+=1)
  824. {
  825. if( !ItemHasTag( itemIds[ i ],theGame.params.TAG_DONT_SHOW ) && !ItemHasTag( itemIds[ i ], 'NoDrop' ) )
  826. {
  827. return false;
  828. }
  829. else if ( ItemHasTag( itemIds[ i ], 'Lootable') )
  830. {
  831. return false;
  832. }
  833. }
  834.  
  835. return true;
  836. }
  837.  
  838. return GetItemCount() <= 0;
  839. }
  840.  
  841. public function GetAllHeldAndMountedItemsCategories( out heldItems : array<name>, optional out mountedItems : array<name> )
  842. {
  843. var allItems : array<SItemUniqueId>;
  844. var i : int;
  845.  
  846. GetAllItems(allItems);
  847. for(i=allItems.Size()-1; i >= 0; i-=1)
  848. {
  849. if ( IsItemHeld(allItems[i]) )
  850. heldItems.PushBack(GetItemCategory(allItems[i]));
  851. else if ( IsItemMounted(allItems[i]) )
  852. mountedItems.PushBack(GetItemCategory(allItems[i]));
  853. }
  854. }
  855.  
  856. public function GetAllHeldItemsNames( out heldItems : array<name> )
  857. {
  858. var allItems : array<SItemUniqueId>;
  859. var i : int;
  860.  
  861. GetAllItems(allItems);
  862. for(i=allItems.Size()-1; i >= 0; i-=1)
  863. {
  864. if ( IsItemHeld(allItems[i]) )
  865. heldItems.PushBack(GetItemName(allItems[i]));
  866. }
  867. }
  868.  
  869. public function HasMountedItemByTag(tag : name) : bool
  870. {
  871. var i : int;
  872. var allItems : array<SItemUniqueId>;
  873.  
  874. if(!IsNameValid(tag))
  875. return false;
  876.  
  877. allItems = GetItemsByTag(tag);
  878. for(i=0; i<allItems.Size(); i+=1)
  879. if(IsItemMounted(allItems[i]))
  880. return true;
  881.  
  882. return false;
  883. }
  884.  
  885. public function HasHeldOrMountedItemByTag(tag : name) : bool
  886. {
  887. var i : int;
  888. var allItems : array<SItemUniqueId>;
  889.  
  890. if(!IsNameValid(tag))
  891. return false;
  892.  
  893. allItems = GetItemsByTag(tag);
  894. for(i=0; i<allItems.Size(); i+=1)
  895. if( IsItemMounted(allItems[i]) || IsItemHeld(allItems[i]) )
  896. return true;
  897.  
  898. return false;
  899. }
  900.  
  901.  
  902. import final function GetItem( itemId : SItemUniqueId ) : SInventoryItem;
  903.  
  904.  
  905. import final function GetItemName( itemId : SItemUniqueId ) : name;
  906.  
  907.  
  908. import final function GetItemCategory( itemId : SItemUniqueId ) : name;
  909.  
  910.  
  911. import final function GetItemClass( itemId : SItemUniqueId ) : EInventoryItemClass;
  912.  
  913.  
  914. import final function GetItemTags( itemId : SItemUniqueId, out tags : array<name> ) : bool;
  915.  
  916.  
  917. import final function GetCraftedItemName( itemId : SItemUniqueId ) : name;
  918.  
  919.  
  920. import final function TotalItemStats( invItem : SInventoryItem ) : float;
  921.  
  922. import final function GetItemPrice( itemId : SItemUniqueId ) : int;
  923.  
  924. import final function GetItemPriceModified( itemId : SItemUniqueId, optional playerSellingItem : bool ) : int;
  925.  
  926. import final function GetInventoryItemPriceModified( invItem : SInventoryItem, optional playerSellingItem : bool ) : int;
  927.  
  928. import final function GetItemPriceRepair( invItem : SInventoryItem, out costRepairPoint : int, out costRepairTotal : int );
  929.  
  930. import final function GetItemPriceRemoveUpgrade( invItem : SInventoryItem ) : int;
  931.  
  932. import final function GetItemPriceDisassemble( invItem : SInventoryItem ) : int;
  933.  
  934. import final function GetItemPriceAddSlot( invItem : SInventoryItem ) : int;
  935.  
  936. import final function GetItemPriceCrafting( invItem : SInventoryItem ) : int;
  937.  
  938. import final function GetItemPriceEnchantItem( invItem : SInventoryItem ) : int;
  939.  
  940. import final function GetItemPriceRemoveEnchantment( invItem : SInventoryItem ) : int;
  941.  
  942. // W3EE - Begin
  943. public function GetItemBasePrice( item : SItemUniqueId ) : int
  944. {
  945. var i : int;
  946. var price : int;
  947. var invItem : SInventoryItem;
  948. var baseAbilities : array<name>;
  949. var remainingAbilities, removedCrafted, removedBase : array<name>;
  950. var durabilityMult, categoryMult, qualityMult : float;
  951.  
  952. durabilityMult = LFEGetDurabilityMult(GetItemDurabilityRatio(item));
  953. categoryMult = LFEGetCategoryMult(GetItemCategory(item));
  954. if( IsItemJewelry(item) )
  955. categoryMult = 1;
  956. qualityMult = LFEGetQualityMult(GetItemQuality(item));
  957. if( !IsItemAnyArmor(item) && (!IsItemWeapon(item) || IsItemCrossbow(item) || IsItemBolt(item)) )
  958. price = GetItemPrice(item);
  959. else
  960. {
  961. invItem = GetItem(item);
  962. GetItemAbilities(item, baseAbilities);
  963. for(i=0; i<baseAbilities.Size(); i+=1)
  964. {
  965. if( StrContains(baseAbilities[i], "Glyph") || StrContains(baseAbilities[i], "Rune") )
  966. continue;
  967.  
  968. if( invItem.craftedAbilities.Contains(baseAbilities[i]) )
  969. {
  970. RemoveItemCraftedAbility(item, baseAbilities[i]);
  971. removedCrafted.PushBack(baseAbilities[i]);
  972. }
  973. else
  974. {
  975. RemoveItemBaseAbility(item, baseAbilities[i]);
  976. removedBase.PushBack(baseAbilities[i]);
  977. }
  978. }
  979.  
  980. price = GetItemPrice(item);
  981. GetItemAbilities(item, remainingAbilities);
  982. for(i=0; i<removedBase.Size(); i+=1)
  983. {
  984. if( remainingAbilities.Contains(removedBase[i]) )
  985. {
  986. remainingAbilities.EraseFast(remainingAbilities.FindFirst(removedBase[i]));
  987. continue;
  988. }
  989.  
  990. AddItemBaseAbility(item, removedBase[i]);
  991. }
  992.  
  993. for(i=0; i<removedCrafted.Size(); i+=1)
  994. {
  995. if( remainingAbilities.Contains(removedCrafted[i]) )
  996. {
  997. remainingAbilities.EraseFast(remainingAbilities.FindFirst(removedCrafted[i]));
  998. continue;
  999. }
  1000.  
  1001. AddItemCraftedAbility(item, removedCrafted[i], true);
  1002. }
  1003. }
  1004.  
  1005. return CeilF(price * durabilityMult * categoryMult * qualityMult);
  1006. }
  1007.  
  1008. public function GetItemSellPrice( item : SItemUniqueId ) : int
  1009. {
  1010. var areaMult, sellingMult : float;
  1011.  
  1012. areaMult = GetAreaPriceMult(item, GetItemQuality(item));
  1013. //Kolaris - Difficulty Settings
  1014. sellingMult = LFEGetSellingMult(false) * Options().GetDifficultySettingMod();
  1015.  
  1016. return Max(1, CeilF(GetItemBasePrice(item) * areaMult * sellingMult));
  1017. }
  1018.  
  1019. public function GetItemBasePriceRepair( invItem : SInventoryItem, originalInventory : CInventoryComponent ) : int
  1020. {
  1021. var price : int;
  1022. var repairMult : float;
  1023.  
  1024. repairMult = LFEGetRepairMult();
  1025. price = CeilF(originalInventory.GetItemBasePrice(invItem.uniqueId) * 0.4f * (1.f - originalInventory.GetItemDurability(invItem.uniqueId) / originalInventory.GetItemMaxDurability(invItem.uniqueId)));
  1026.  
  1027. return Max(1, CeilF(price * repairMult));
  1028. }
  1029.  
  1030. public function GetItemBasePriceRemoveUpgrade( invItem : SInventoryItem, originalInventory : CInventoryComponent ) : int
  1031. {
  1032. var price : int;
  1033. var removeUpgradeMult : float;
  1034. var temp : array<name>;
  1035.  
  1036. removeUpgradeMult = LFEGetRemoveUpgradeMult();
  1037. originalInventory.GetItemEnhancementItems(invItem.uniqueId, temp);
  1038. price = temp.Size() * 20;
  1039.  
  1040. return Max(1, CeilF(price * removeUpgradeMult));
  1041. }
  1042.  
  1043. public function GetItemBasePriceAddSlot( invItem : SInventoryItem, originalInventory : CInventoryComponent ) : int
  1044. {
  1045. return 75;
  1046. }
  1047.  
  1048. public function GetItemBasePriceDisassemble( invItem : SInventoryItem, originalInventory : CInventoryComponent ) : int
  1049. {
  1050. var i : int;
  1051. var price : int;
  1052. var baseAbilities : array<name>;
  1053. var unleveledItem : SInventoryItem;
  1054. var remainingAbilities, removedCrafted, removedBase : array<name>;
  1055. var disassembleMult : float;
  1056.  
  1057. disassembleMult = LFEGetDisassembleMult();
  1058. originalInventory.GetItemAbilities(invItem.uniqueId, baseAbilities);
  1059. for(i=0; i<baseAbilities.Size(); i+=1)
  1060. {
  1061. if( StrContains(baseAbilities[i], "Glyph") || StrContains(baseAbilities[i], "Rune") )
  1062. continue;
  1063.  
  1064. if( invItem.craftedAbilities.Contains(baseAbilities[i]) )
  1065. {
  1066. originalInventory.RemoveItemCraftedAbility(invItem.uniqueId, baseAbilities[i]);
  1067. removedCrafted.PushBack(baseAbilities[i]);
  1068. }
  1069. else
  1070. {
  1071. originalInventory.RemoveItemBaseAbility(invItem.uniqueId, baseAbilities[i]);
  1072. removedBase.PushBack(baseAbilities[i]);
  1073. }
  1074. }
  1075.  
  1076. unleveledItem = originalInventory.GetItem(invItem.uniqueId);
  1077. price = GetItemPriceDisassemble(unleveledItem);
  1078. originalInventory.GetItemAbilities(invItem.uniqueId, remainingAbilities);
  1079. for(i=0; i<removedBase.Size(); i+=1)
  1080. {
  1081. if( remainingAbilities.Contains(removedBase[i]) )
  1082. {
  1083. remainingAbilities.EraseFast(remainingAbilities.FindFirst(removedBase[i]));
  1084. continue;
  1085. }
  1086.  
  1087. originalInventory.AddItemBaseAbility(invItem.uniqueId, removedBase[i]);
  1088. }
  1089.  
  1090. for(i=0; i<removedCrafted.Size(); i+=1)
  1091. {
  1092. if( remainingAbilities.Contains(removedCrafted[i]) )
  1093. {
  1094. remainingAbilities.EraseFast(remainingAbilities.FindFirst(removedCrafted[i]));
  1095. continue;
  1096. }
  1097.  
  1098. originalInventory.AddItemCraftedAbility(invItem.uniqueId, removedCrafted[i], true);
  1099. }
  1100.  
  1101. return Max(1, CeilF(price * disassembleMult));
  1102. }
  1103.  
  1104. public function GetItemBasePriceCrafting( invItem : SInventoryItem, originalInventory : CInventoryComponent ) : int
  1105. {
  1106. var i : int;
  1107. var price : int;
  1108. var baseAbilities : array<name>;
  1109. var unleveledItem : SInventoryItem;
  1110. var remainingAbilities, removedCrafted, removedBase : array<name>;
  1111. var craftingMult : float;
  1112.  
  1113. craftingMult = LFEGetCraftMult();
  1114. originalInventory.GetItemAbilities(invItem.uniqueId, baseAbilities);
  1115. for(i=0; i<baseAbilities.Size(); i+=1)
  1116. {
  1117. if( StrContains(baseAbilities[i], "Glyph") || StrContains(baseAbilities[i], "Rune") )
  1118. continue;
  1119.  
  1120. if( invItem.craftedAbilities.Contains(baseAbilities[i]) )
  1121. {
  1122. originalInventory.RemoveItemCraftedAbility(invItem.uniqueId, baseAbilities[i]);
  1123. removedCrafted.PushBack(baseAbilities[i]);
  1124. }
  1125. else
  1126. {
  1127. originalInventory.RemoveItemBaseAbility(invItem.uniqueId, baseAbilities[i]);
  1128. removedBase.PushBack(baseAbilities[i]);
  1129. }
  1130. }
  1131.  
  1132. unleveledItem = originalInventory.GetItem(invItem.uniqueId);
  1133. price = GetItemPriceCrafting(unleveledItem);
  1134. originalInventory.GetItemAbilities(invItem.uniqueId, remainingAbilities);
  1135. for(i=0; i<removedBase.Size(); i+=1)
  1136. {
  1137. if( remainingAbilities.Contains(removedBase[i]) )
  1138. {
  1139. remainingAbilities.EraseFast(remainingAbilities.FindFirst(removedBase[i]));
  1140. continue;
  1141. }
  1142.  
  1143. originalInventory.AddItemBaseAbility(invItem.uniqueId, removedBase[i]);
  1144. }
  1145.  
  1146. for(i=0; i<removedCrafted.Size(); i+=1)
  1147. {
  1148. if( remainingAbilities.Contains(removedCrafted[i]) )
  1149. {
  1150. remainingAbilities.EraseFast(remainingAbilities.FindFirst(removedCrafted[i]));
  1151. continue;
  1152. }
  1153.  
  1154. originalInventory.AddItemCraftedAbility(invItem.uniqueId, removedCrafted[i], true);
  1155. }
  1156.  
  1157. return Max(1, CeilF(price * craftingMult));
  1158. }
  1159.  
  1160. public function GetItemBasePriceModified( item : SItemUniqueId, optional playerSelling : bool ) : int
  1161. {
  1162. var i : int;
  1163. var price : int;
  1164. var invItem : SInventoryItem;
  1165. var baseAbilities : array<name>;
  1166. var remainingAbilities, removedCrafted, removedBase : array<name>;
  1167. var durabilityMult, categoryMult, qualityMult, areaMult, sellingMult : float;
  1168.  
  1169. durabilityMult = LFEGetDurabilityMult(GetItemDurabilityRatio(item));
  1170. categoryMult = LFEGetCategoryMult(GetItemCategory(item));
  1171. if( IsItemJewelry(item) )
  1172. categoryMult = 1;
  1173. qualityMult = LFEGetQualityMult(GetItemQuality(item));
  1174. areaMult = GetAreaPriceMult(item, GetItemQuality(item));
  1175. sellingMult = LFEGetSellingMult(playerSelling);
  1176. if( playerSelling && GetWitcherPlayer().CanUseSkill(S_Perk_20) )
  1177. sellingMult *= 1.25f;
  1178. //Kolaris - Huntsman
  1179. if( playerSelling && GetWitcherPlayer().CanUseSkill(S_Perk_19) && IsItemTrophy(item))
  1180. sellingMult *= 1.5f;
  1181. //Kolaris - Difficulty Settings
  1182. if( playerSelling )
  1183. sellingMult /= Options().GetDifficultySettingMod();
  1184. else
  1185. sellingMult *= Options().GetDifficultySettingMod();
  1186.  
  1187. if( !IsItemAnyArmor(item) && (!IsItemWeapon(item) || IsItemCrossbow(item) || IsItemBolt(item)) )
  1188. price = GetItemPriceModified(item, playerSelling);
  1189. else
  1190. {
  1191. invItem = GetItem(item);
  1192. GetItemAbilities(item, baseAbilities);
  1193. for(i=0; i<baseAbilities.Size(); i+=1)
  1194. {
  1195. if( StrContains(baseAbilities[i], "Glyph") || StrContains(baseAbilities[i], "Rune") )
  1196. continue;
  1197.  
  1198. if( invItem.craftedAbilities.Contains(baseAbilities[i]) )
  1199. {
  1200. RemoveItemCraftedAbility(item, baseAbilities[i]);
  1201. removedCrafted.PushBack(baseAbilities[i]);
  1202. }
  1203. else
  1204. {
  1205. RemoveItemBaseAbility(item, baseAbilities[i]);
  1206. removedBase.PushBack(baseAbilities[i]);
  1207. }
  1208. }
  1209.  
  1210. price = GetItemPriceModified(item, playerSelling);
  1211. GetItemAbilities(invItem.uniqueId, remainingAbilities);
  1212. for(i=0; i<removedBase.Size(); i+=1)
  1213. {
  1214. if( remainingAbilities.Contains(removedBase[i]) )
  1215. {
  1216. remainingAbilities.EraseFast(remainingAbilities.FindFirst(removedBase[i]));
  1217. continue;
  1218. }
  1219.  
  1220. AddItemBaseAbility(item, removedBase[i]);
  1221. }
  1222.  
  1223. for(i=0; i<removedCrafted.Size(); i+=1)
  1224. {
  1225. if( remainingAbilities.Contains(removedCrafted[i]) )
  1226. {
  1227. remainingAbilities.EraseFast(remainingAbilities.FindFirst(removedCrafted[i]));
  1228. continue;
  1229. }
  1230.  
  1231. AddItemCraftedAbility(item, removedCrafted[i], true);
  1232. }
  1233. }
  1234.  
  1235. if( playerSelling )
  1236. return Abs(FloorF(price * areaMult * durabilityMult * categoryMult * qualityMult * sellingMult));
  1237. else
  1238. return Abs(CeilF(price * areaMult * durabilityMult * categoryMult * qualityMult * sellingMult));
  1239. }
  1240.  
  1241. public function GetInventoryItemBasePriceModified( invItem : SInventoryItem, originalInventory : CInventoryComponent, optional playerSelling : bool, optional merchantEntity : CEntity ) : int
  1242. {
  1243. var i : int;
  1244. var price : int;
  1245. var baseAbilities : array<name>;
  1246. var remainingAbilities, removedCrafted, removedBase : array<name>;
  1247. var unleveledItem : SInventoryItem;
  1248. var durabilityMult, categoryMult, qualityMult, areaMult, sellingMult, merchantMult : float;
  1249.  
  1250. durabilityMult = LFEGetDurabilityMult(originalInventory.GetItemDurabilityRatio(invItem.uniqueId));
  1251. categoryMult = LFEGetCategoryMult(originalInventory.GetItemCategory(invItem.uniqueId));
  1252. if( originalInventory.IsItemJewelry(invItem.uniqueId) )
  1253. categoryMult = 1;
  1254. qualityMult = LFEGetQualityMult(originalInventory.GetItemQuality(invItem.uniqueId));
  1255. areaMult = originalInventory.GetAreaPriceMult(invItem.uniqueId, originalInventory.GetItemQuality(invItem.uniqueId));
  1256. sellingMult = LFEGetSellingMult(playerSelling);
  1257. if( playerSelling && GetWitcherPlayer().CanUseSkill(S_Perk_20) )
  1258. sellingMult *= 1.25f;
  1259. //Kolaris - Huntsman
  1260. if( playerSelling && GetWitcherPlayer().CanUseSkill(S_Perk_19) && originalInventory.IsItemTrophy(invItem.uniqueId))
  1261. sellingMult *= 1.5f;
  1262. //Kolaris - Difficulty Settings
  1263. if( playerSelling )
  1264. sellingMult /= Options().GetDifficultySettingMod();
  1265. else
  1266. sellingMult *= Options().GetDifficultySettingMod();
  1267. if( playerSelling && merchantEntity )
  1268. merchantMult = originalInventory.GetMerchantMult(invItem.uniqueId, merchantEntity);
  1269. else
  1270. merchantMult = 1;
  1271.  
  1272. if( !originalInventory.IsItemAnyArmor(invItem.uniqueId) && (!originalInventory.IsItemWeapon(invItem.uniqueId) || originalInventory.IsItemCrossbow(invItem.uniqueId) || originalInventory.IsItemBolt(invItem.uniqueId)) )
  1273. price = originalInventory.GetInventoryItemPriceModified(invItem, playerSelling);
  1274. else
  1275. {
  1276. originalInventory.GetItemAbilities(invItem.uniqueId, baseAbilities);
  1277. for(i=0; i<baseAbilities.Size(); i+=1)
  1278. {
  1279. if( StrContains(baseAbilities[i], "Glyph") || StrContains(baseAbilities[i], "Rune") )
  1280. continue;
  1281.  
  1282. if( invItem.craftedAbilities.Contains(baseAbilities[i]) )
  1283. {
  1284. originalInventory.RemoveItemCraftedAbility(invItem.uniqueId, baseAbilities[i]);
  1285. removedCrafted.PushBack(baseAbilities[i]);
  1286. }
  1287. else
  1288. {
  1289. originalInventory.RemoveItemBaseAbility(invItem.uniqueId, baseAbilities[i]);
  1290. removedBase.PushBack(baseAbilities[i]);
  1291. }
  1292. }
  1293.  
  1294. unleveledItem = originalInventory.GetItem(invItem.uniqueId);
  1295. price = originalInventory.GetInventoryItemPriceModified(unleveledItem, playerSelling);
  1296. originalInventory.GetItemAbilities(invItem.uniqueId, remainingAbilities);
  1297. for(i=0; i<removedBase.Size(); i+=1)
  1298. {
  1299. if( remainingAbilities.Contains(removedBase[i]) )
  1300. {
  1301. remainingAbilities.EraseFast(remainingAbilities.FindFirst(removedBase[i]));
  1302. continue;
  1303. }
  1304.  
  1305. originalInventory.AddItemBaseAbility(invItem.uniqueId, removedBase[i]);
  1306. }
  1307.  
  1308. for(i=0; i<removedCrafted.Size(); i+=1)
  1309. {
  1310. if( remainingAbilities.Contains(removedCrafted[i]) )
  1311. {
  1312. remainingAbilities.EraseFast(remainingAbilities.FindFirst(removedCrafted[i]));
  1313. continue;
  1314. }
  1315.  
  1316. originalInventory.AddItemCraftedAbility(invItem.uniqueId, removedCrafted[i], true);
  1317. }
  1318. }
  1319.  
  1320. if( playerSelling )
  1321. return Abs(FloorF(price * areaMult * durabilityMult * categoryMult * qualityMult * sellingMult * merchantMult));
  1322. else
  1323. return Abs(CeilF(price * areaMult * durabilityMult * categoryMult * qualityMult * sellingMult * merchantMult));
  1324. }
  1325.  
  1326. public function GetAreaPriceMultByName( item : name ) : float
  1327. {
  1328. var dm : CDefinitionsManagerAccessor = theGame.GetDefinitionsManager();
  1329. var area : EAreaName = theGame.GetCommonMapManager().GetCurrentArea();
  1330. var itemRarity : int;
  1331. var worldPos : Vector;
  1332.  
  1333. itemRarity = dm.GetItemQuality(item);
  1334. switch(area)
  1335. {
  1336. case AN_NMLandNovigrad:
  1337. worldPos = GetWitcherPlayer().GetWorldPosition();
  1338.  
  1339. if( worldPos.X > 1650.f || worldPos.Y > 1400.f )
  1340. {
  1341. return 1;
  1342. }
  1343. else
  1344. {
  1345. if( dm.IsItemFood(item) )
  1346. return 2;
  1347. else
  1348. if( dm.IsItemJewelry(item) )
  1349. return 0.5;
  1350. else
  1351. if( dm.IsItemReadable(item) )
  1352. return 0.5;
  1353. else
  1354. if( dm.IsItemTrophy(item) )
  1355. return 0.5;
  1356. else
  1357. if( dm.IsItemHerb(item) )
  1358. return 0.5;
  1359. else
  1360. if( dm.IsItemJunk(item) )
  1361. return 0.5f;
  1362. else
  1363. return 1;
  1364. }
  1365. break;
  1366.  
  1367. case AN_Skellige_ArdSkellig:
  1368. if( dm.IsItemFood(item) )
  1369. return 1.5;
  1370. else
  1371. if( dm.IsItemAlchemicalAlcohol(item) )
  1372. return 1.5;
  1373. else
  1374. if( dm.IsItemTrophy(item) )
  1375. return 1.5;
  1376. else
  1377. if( dm.IsItemJewelry(item) )
  1378. return 0.5;
  1379. else
  1380. if( dm.IsItemHorseItem(item) )
  1381. return 0.5;
  1382. else
  1383. if( dm.IsItemWeapon(item) )
  1384. {
  1385. switch( itemRarity )
  1386. {
  1387. case 1: return 0.7;
  1388. case 2: return 0.85;
  1389. case 3: return 1;
  1390. case 4: return 1.2;
  1391. case 5: return 1.2;
  1392. }
  1393. }
  1394. else
  1395. return 1;
  1396. break;
  1397.  
  1398. case AN_Prologue_Village:
  1399. if( dm.IsItemHerb(item) )
  1400. return 0.5;
  1401. else
  1402. if( dm.IsItemTrophy(item) )
  1403. return 0.5;
  1404. else
  1405. if( dm.IsItemWeapon(item) )
  1406. return 0.75;
  1407. else
  1408. if( dm.IsItemJewelry(item) )
  1409. return 0.5f;
  1410. else
  1411. if( dm.IsItemUpgrade(item) )
  1412. return 0.5f;
  1413. else
  1414. if( dm.IsItemFood(item) )
  1415. return 1.5f;
  1416. else
  1417. if( dm.IsItemJunk(item) )
  1418. return 0.5f;
  1419. else
  1420. return 1;
  1421. break;
  1422.  
  1423. case AN_Prologue_Village_Winter:
  1424. if( dm.IsItemHerb(item) )
  1425. return 0.5;
  1426. else
  1427. if( dm.IsItemTrophy(item) )
  1428. return 0.5;
  1429. else
  1430. if( dm.IsItemWeapon(item) )
  1431. return 0.75;
  1432. else
  1433. if( dm.IsItemJewelry(item) )
  1434. return 0.5f;
  1435. else
  1436. if( dm.IsItemUpgrade(item) )
  1437. return 0.5f;
  1438. else
  1439. if( dm.IsItemFood(item) )
  1440. return 1.5f;
  1441. else
  1442. if( dm.IsItemJunk(item) )
  1443. return 0.5f;
  1444. else
  1445. return 1;
  1446. break;
  1447.  
  1448. case (EAreaName)AN_Dlc_Bob:
  1449. if( dm.IsItemTrophy(item) )
  1450. return 1.5;
  1451. else
  1452. if( dm.IsItemJewelry(item) )
  1453. return 1.5;
  1454. else
  1455. if( dm.IsItemAlchemicalAlcohol(item) )
  1456. return 0.5;
  1457. else
  1458. if( dm.IsItemFood(item) )
  1459. return 0.5;
  1460. else
  1461. if( dm.IsItemHorseItem(item) )
  1462. return 1.5;
  1463. else
  1464. return 1;
  1465. break;
  1466.  
  1467. default : return 1;
  1468. }
  1469. }
  1470.  
  1471. private function GetAreaPriceMult( item : SItemUniqueId, itemRarity : int ) : float
  1472. {
  1473. var area : EAreaName = theGame.GetCommonMapManager().GetCurrentArea();
  1474. var worldPos : Vector;
  1475.  
  1476. switch(area)
  1477. {
  1478. case AN_NMLandNovigrad:
  1479. worldPos = GetWitcherPlayer().GetWorldPosition();
  1480.  
  1481. if( worldPos.X > 1650.f || worldPos.Y > 1400.f )
  1482. {
  1483. return 1;
  1484. }
  1485. else
  1486. {
  1487. if( IsItemFood(item) )
  1488. return 2;
  1489. else
  1490. if( IsItemJewelry(item) )
  1491. return 0.5;
  1492. else
  1493. if( IsItemReadable(item) )
  1494. return 0.5;
  1495. else
  1496. if( IsItemTrophy(item) )
  1497. return 0.5;
  1498. else
  1499. if( IsItemHerb(item) )
  1500. return 0.5;
  1501. else
  1502. if( IsItemJunk(item) )
  1503. return 0.5f;
  1504. else
  1505. return 1;
  1506. }
  1507. break;
  1508.  
  1509. case AN_Skellige_ArdSkellig:
  1510. if( IsItemFood(item) )
  1511. return 1.5;
  1512. else
  1513. if( IsItemAlchemicalAlcohol(item) )
  1514. return 1.5;
  1515. else
  1516. if( IsItemTrophy(item) )
  1517. return 1.5;
  1518. else
  1519. if( IsItemJewelry(item) )
  1520. return 0.5;
  1521. else
  1522. if( IsItemHorseItem(item) )
  1523. return 0.5;
  1524. else
  1525. if( IsItemWeapon(item) )
  1526. {
  1527. switch( itemRarity )
  1528. {
  1529. case 1: return 0.7;
  1530. case 2: return 0.85;
  1531. case 3: return 1;
  1532. case 4: return 1.2;
  1533. case 5: return 1.2;
  1534. }
  1535. }
  1536. else
  1537. return 1;
  1538. break;
  1539.  
  1540. case AN_Prologue_Village:
  1541. if( IsItemHerb(item) )
  1542. return 0.5;
  1543. else
  1544. if( IsItemTrophy(item) )
  1545. return 0.5;
  1546. else
  1547. if( IsItemWeapon(item) )
  1548. return 0.75;
  1549. else
  1550. if( IsItemJewelry(item) )
  1551. return 0.5f;
  1552. else
  1553. if( IsItemUpgrade(item) )
  1554. return 0.5f;
  1555. else
  1556. if( IsItemFood(item) )
  1557. return 1.5f;
  1558. else
  1559. if( IsItemJunk(item) )
  1560. return 0.5f;
  1561. else
  1562. return 1;
  1563. break;
  1564.  
  1565. case AN_Prologue_Village_Winter:
  1566. if( IsItemHerb(item) )
  1567. return 0.5;
  1568. else
  1569. if( IsItemTrophy(item) )
  1570. return 0.5;
  1571. else
  1572. if( IsItemWeapon(item) )
  1573. return 0.75;
  1574. else
  1575. if( IsItemJewelry(item) )
  1576. return 0.5f;
  1577. else
  1578. if( IsItemUpgrade(item) )
  1579. return 0.5f;
  1580. else
  1581. if( IsItemFood(item) )
  1582. return 1.5f;
  1583. else
  1584. if( IsItemJunk(item) )
  1585. return 0.5f;
  1586. else
  1587. return 1;
  1588. break;
  1589.  
  1590. case (EAreaName)AN_Dlc_Bob:
  1591. if( IsItemTrophy(item) )
  1592. return 1.5;
  1593. else
  1594. if( IsItemJewelry(item) )
  1595. return 1.5;
  1596. else
  1597. if( IsItemAlchemicalAlcohol(item) )
  1598. return 0.5;
  1599. else
  1600. if( IsItemFood(item) )
  1601. return 0.5;
  1602. else
  1603. if( IsItemHorseItem(item) )
  1604. return 1.5;
  1605. else
  1606. return 1;
  1607. break;
  1608.  
  1609. default : return 1;
  1610. }
  1611. }
  1612.  
  1613. public function GetMerchantMult( item : SItemUniqueId, merchantEntity : CEntity ) : float
  1614. {
  1615. var merchantComponent : W3MerchantComponent;
  1616. var merchantType : name;
  1617. var merchant : CNewNPC;
  1618.  
  1619. merchant = (CNewNPC)merchantEntity;
  1620. merchantComponent = (W3MerchantComponent)merchant.GetComponentByClassName('W3MerchantComponent');
  1621. merchantType = merchantComponent.GetMapPinType();
  1622. if( GetItemName(item) == 'Honeycomb' && theGame.GetCommonMapManager().GetCurrentArea() == AN_Prologue_Village && merchantType == 'Herbalist' )
  1623. return 5.f;
  1624. switch( merchantType )
  1625. {
  1626. case 'Shopkeeper':
  1627. if( IsItemWeapon(item) )
  1628. return 0.5f;
  1629. else
  1630. if( IsItemWeaponReapairKit(item) )
  1631. return 0.5f;
  1632. else
  1633. if( IsItemChestArmor(item) )
  1634. return 0.5f;
  1635. else
  1636. if( IsItemPants(item) )
  1637. return 0.5f;
  1638. else
  1639. if( IsItemBoots(item) )
  1640. return 0.5f;
  1641. else
  1642. if( IsItemGloves(item) )
  1643. return 0.5f;
  1644. else
  1645. if( IsItemArmorReapairKit(item) )
  1646. return 0.5f;
  1647. else
  1648. if( IsItemJewelry(item) )
  1649. return 1.f;
  1650. else
  1651. if( IsItemCraftingIngredient(item) )
  1652. return 0.5f;
  1653. else
  1654. if( IsItemHerb(item) )
  1655. return 0.25f;
  1656. else
  1657. if( IsItemMonsterPart(item) )
  1658. return 0.f;
  1659. else
  1660. if( IsItemAlchemicalAlcohol(item) )
  1661. return 0.5f;
  1662. else
  1663. if( IsItemAlchemyIngredient(item) )
  1664. return 0.25f;
  1665. else
  1666. if( IsItemFood(item) )
  1667. return 0.5f;
  1668. else
  1669.  
  1670.  
  1671.  
  1672. if( IsItemJunk(item) )
  1673. return 1.f;
  1674. else
  1675. if( IsItemReadable(item) )
  1676. return 1.f;
  1677. else
  1678. if( IsItemHorseItem(item) )
  1679. return 1.f;
  1680. else
  1681. if( IsItemUpgrade(item) )
  1682. return 0.5f;
  1683. else
  1684. if( IsItemTrophy(item) )
  1685. return 1.f;
  1686. else
  1687. return 1.f;
  1688. break;
  1689. case 'Blacksmith':
  1690. if( IsItemWeapon(item) )
  1691. return 1.f;
  1692. else
  1693. if( IsItemWeaponReapairKit(item) )
  1694. return 1.f;
  1695. else
  1696. if( IsItemChestArmor(item) )
  1697. return 0.75f;
  1698. else
  1699. if( IsItemPants(item) )
  1700. return 0.75f;
  1701. else
  1702. if( IsItemBoots(item) )
  1703. return 0.75f;
  1704. else
  1705. if( IsItemGloves(item) )
  1706. return 0.75f;
  1707. else
  1708. if( IsItemArmorReapairKit(item) )
  1709. return 0.75f;
  1710. else
  1711. if( IsItemJewelry(item) )
  1712. return 0.25f;
  1713. else
  1714. if( IsItemCraftingIngredient(item) )
  1715. return 1.f;
  1716. else
  1717. if( IsItemHerb(item) )
  1718. return 0.f;
  1719. else
  1720. if( IsItemMonsterPart(item) )
  1721. return 0.f;
  1722. else
  1723. if( IsItemAlchemicalAlcohol(item) )
  1724. return 0.f;
  1725. else
  1726. if( IsItemAlchemyIngredient(item) )
  1727. return 0.f;
  1728. else
  1729. if( IsItemFood(item) )
  1730. return 0.f;
  1731. else
  1732.  
  1733.  
  1734.  
  1735. if( IsItemJunk(item) )
  1736. return 0.25f;
  1737. else
  1738. if( IsItemReadable(item) )
  1739. return 0.f;
  1740. else
  1741. if( IsItemHorseItem(item) )
  1742. return 0.5f;
  1743. else
  1744. if( IsItemUpgrade(item) )
  1745. return 1.f;
  1746. else
  1747. if( IsItemTrophy(item) )
  1748. return 0.f;
  1749. else
  1750. return 1.f;
  1751. break;
  1752. case 'Armorer':
  1753. if( IsItemWeapon(item) )
  1754. return 0.75f;
  1755. else
  1756. if( IsItemWeaponReapairKit(item) )
  1757. return 0.75f;
  1758. else
  1759. if( IsItemChestArmor(item) )
  1760. return 1.f;
  1761. else
  1762. if( IsItemPants(item) )
  1763. return 1.f;
  1764. else
  1765. if( IsItemBoots(item) )
  1766. return 1.f;
  1767. else
  1768. if( IsItemGloves(item) )
  1769. return 1.f;
  1770. else
  1771. if( IsItemArmorReapairKit(item) )
  1772. return 1.f;
  1773. else
  1774. if( IsItemJewelry(item) )
  1775. return 0.25f;
  1776. else
  1777. if( IsItemCraftingIngredient(item) )
  1778. return 1.f;
  1779. else
  1780. if( IsItemHerb(item) )
  1781. return 0.f;
  1782. else
  1783. if( IsItemMonsterPart(item) )
  1784. return 0.f;
  1785. else
  1786. if( IsItemAlchemicalAlcohol(item) )
  1787. return 0.f;
  1788. else
  1789. if( IsItemAlchemyIngredient(item) )
  1790. return 0.f;
  1791. else
  1792. if( IsItemFood(item) )
  1793. return 0.f;
  1794. else
  1795.  
  1796.  
  1797.  
  1798. if( IsItemJunk(item) )
  1799. return 0.25f;
  1800. else
  1801. if( IsItemReadable(item) )
  1802. return 0.f;
  1803. else
  1804. if( IsItemHorseItem(item) )
  1805. return 0.5f;
  1806. else
  1807. if( IsItemUpgrade(item) )
  1808. return 1.f;
  1809. else
  1810. if( IsItemTrophy(item) )
  1811. return 0.f;
  1812. else
  1813. return 1.f;
  1814. break;
  1815. case 'Herbalist':
  1816. if( IsItemWeapon(item) )
  1817. return 0.f;
  1818. else
  1819. if( IsItemWeaponReapairKit(item) )
  1820. return 0.f;
  1821. else
  1822. if( IsItemChestArmor(item) )
  1823. return 0.f;
  1824. else
  1825. if( IsItemPants(item) )
  1826. return 0.f;
  1827. else
  1828. if( IsItemBoots(item) )
  1829. return 0.f;
  1830. else
  1831. if( IsItemGloves(item) )
  1832. return 0.f;
  1833. else
  1834. if( IsItemArmorReapairKit(item) )
  1835. return 0.f;
  1836. else
  1837. if( IsItemJewelry(item) )
  1838. return 0.f;
  1839. else
  1840. if( IsItemCraftingIngredient(item) )
  1841. return 0.f;
  1842. else
  1843. if( IsItemHerb(item) )
  1844. return 1.f;
  1845. else
  1846. if( IsItemMonsterPart(item) )
  1847. return 0.5f;
  1848. else
  1849. if( IsItemAlchemicalAlcohol(item) )
  1850. return 1.f;
  1851. else
  1852. if( IsItemAlchemyIngredient(item) )
  1853. return 1.f;
  1854. else
  1855. if( IsItemFood(item) )
  1856. return 0.5f;
  1857. else
  1858.  
  1859.  
  1860.  
  1861. if( IsItemJunk(item) )
  1862. return 0.f;
  1863. else
  1864. if( IsItemReadable(item) )
  1865. return 0.f;
  1866. else
  1867. if( IsItemHorseItem(item) )
  1868. return 0.f;
  1869. else
  1870. if( IsItemUpgrade(item) )
  1871. return 0.f;
  1872. else
  1873. if( IsItemTrophy(item) )
  1874. return 0.f;
  1875. else
  1876. return 1.f;
  1877. break;
  1878. case 'Alchemic':
  1879. if( IsItemWeapon(item) )
  1880. return 0.f;
  1881. else
  1882. if( IsItemWeaponReapairKit(item) )
  1883. return 0.f;
  1884. else
  1885. if( IsItemChestArmor(item) )
  1886. return 0.f;
  1887. else
  1888. if( IsItemPants(item) )
  1889. return 0.f;
  1890. else
  1891. if( IsItemBoots(item) )
  1892. return 0.f;
  1893. else
  1894. if( IsItemGloves(item) )
  1895. return 0.f;
  1896. else
  1897. if( IsItemArmorReapairKit(item) )
  1898. return 0.f;
  1899. else
  1900. if( IsItemJewelry(item) )
  1901. return 0.f;
  1902. else
  1903. if( IsItemCraftingIngredient(item) )
  1904. return 0.f;
  1905. else
  1906. if( IsItemHerb(item) )
  1907. return 0.5f;
  1908. else
  1909. if( IsItemMonsterPart(item) )
  1910. return 1.f;
  1911. else
  1912. if( IsItemAlchemicalAlcohol(item) )
  1913. return 1.f;
  1914. else
  1915. if( IsItemAlchemyIngredient(item) )
  1916. return 1.f;
  1917. else
  1918. if( IsItemFood(item) )
  1919. return 0.f;
  1920. else
  1921.  
  1922.  
  1923.  
  1924. if( IsItemJunk(item) )
  1925. return 0.f;
  1926. else
  1927. if( IsItemReadable(item) )
  1928. return 0.5f;
  1929. else
  1930. if( IsItemHorseItem(item) )
  1931. return 0.f;
  1932. else
  1933. if( IsItemUpgrade(item) )
  1934. return 0.75f;
  1935. else
  1936. if( IsItemTrophy(item) )
  1937. return 0.5f;
  1938. else
  1939. return 1.f;
  1940. break;
  1941. case 'Innkeeper':
  1942. if( IsItemWeapon(item) )
  1943. return 0.f;
  1944. else
  1945. if( IsItemWeaponReapairKit(item) )
  1946. return 0.f;
  1947. else
  1948. if( IsItemChestArmor(item) )
  1949. return 0.f;
  1950. else
  1951. if( IsItemPants(item) )
  1952. return 0.f;
  1953. else
  1954. if( IsItemBoots(item) )
  1955. return 0.f;
  1956. else
  1957. if( IsItemGloves(item) )
  1958. return 0.f;
  1959. else
  1960. if( IsItemArmorReapairKit(item) )
  1961. return 0.f;
  1962. else
  1963. if( IsItemJewelry(item) )
  1964. return 0.f;
  1965. else
  1966. if( IsItemCraftingIngredient(item) )
  1967. return 0.f;
  1968. else
  1969. if( IsItemHerb(item) )
  1970. return 0.f;
  1971. else
  1972. if( IsItemMonsterPart(item) )
  1973. return 0.f;
  1974. else
  1975. if( IsItemAlchemicalAlcohol(item) )
  1976. return 1.f;
  1977. else
  1978. if( IsItemAlchemyIngredient(item) )
  1979. return 0.f;
  1980. else
  1981. if( IsItemFood(item) )
  1982. return 1.f;
  1983. else
  1984.  
  1985.  
  1986.  
  1987. if( IsItemJunk(item) )
  1988. return 0.f;
  1989. else
  1990. if( IsItemReadable(item) )
  1991. return 0.f;
  1992. else
  1993. if( IsItemHorseItem(item) )
  1994. return 0.f;
  1995. else
  1996. if( IsItemUpgrade(item) )
  1997. return 0.f;
  1998. else
  1999. if( IsItemTrophy(item) )
  2000. return 1.0f;
  2001. else
  2002. return 1.f;
  2003. break;
  2004. default : return 1.f;
  2005. }
  2006. }
  2007. // W3EE - End
  2008.  
  2009. import final function GetFundsModifier() : float;
  2010.  
  2011.  
  2012. import final function GetItemQuantity( itemId : SItemUniqueId ) : int;
  2013.  
  2014.  
  2015. import final function ItemHasTag( itemId : SItemUniqueId, tag : name ) : bool;
  2016.  
  2017.  
  2018. import final function AddItemTag( itemId : SItemUniqueId, tag : name ) : bool;
  2019.  
  2020.  
  2021. import final function RemoveItemTag( itemId : SItemUniqueId, tag : name ) : bool;
  2022.  
  2023.  
  2024. public final function ManageItemsTag( items : array<SItemUniqueId>, tag : name, add : bool )
  2025. {
  2026. var i : int;
  2027.  
  2028. if( add )
  2029. {
  2030. for( i = 0 ; i < items.Size() ; i += 1 )
  2031. {
  2032. AddItemTag( items[ i ], tag );
  2033. }
  2034. }
  2035. else
  2036. {
  2037. for( i = 0 ; i < items.Size() ; i += 1 )
  2038. {
  2039. RemoveItemTag( items[ i ], tag );
  2040. }
  2041. }
  2042. }
  2043.  
  2044.  
  2045. import final function GetItemByItemEntity( itemEntity : CItemEntity ) : SItemUniqueId;
  2046.  
  2047.  
  2048. public function ItemHasAbility(item : SItemUniqueId, abilityName : name) : bool
  2049. {
  2050. var abilities : array<name>;
  2051.  
  2052. GetItemAbilities(item, abilities);
  2053. return abilities.Contains(abilityName);
  2054. }
  2055.  
  2056. import final function GetItemAttributeValue( itemId : SItemUniqueId, attributeName : name, optional abilityTags : array< name >, optional withoutTags : bool ) : SAbilityAttributeValue;
  2057.  
  2058.  
  2059. import final function GetItemBaseAttributes( itemId : SItemUniqueId, out attributes : array<name> );
  2060.  
  2061.  
  2062. import final function GetItemAttributes( itemId : SItemUniqueId, out attributes : array<name> );
  2063.  
  2064.  
  2065. import final function GetItemAbilities( itemId : SItemUniqueId, out abilities : array<name> );
  2066.  
  2067.  
  2068. import final function GetItemContainedAbilities( itemId : SItemUniqueId, out abilities : array<name> );
  2069.  
  2070.  
  2071. public function GetItemAbilitiesWithAttribute(id : SItemUniqueId, attributeName : name, attributeVal : float) : array<name>
  2072. {
  2073. var i : int;
  2074. var abs, ret : array<name>;
  2075. var dm : CDefinitionsManagerAccessor;
  2076. var val : float;
  2077. var min, max : SAbilityAttributeValue;
  2078.  
  2079. GetItemAbilities(id, abs);
  2080. dm = theGame.GetDefinitionsManager();
  2081.  
  2082. for(i=0; i<abs.Size(); i+=1)
  2083. {
  2084. dm.GetAbilityAttributeValue(abs[i], attributeName, min, max);
  2085. val = CalculateAttributeValue(GetAttributeRandomizedValue(min, max));
  2086.  
  2087. if(val == attributeVal)
  2088. ret.PushBack(abs[i]);
  2089. }
  2090.  
  2091. return ret;
  2092. }
  2093. public function GetItemAbilitiesWithTag( itemId : SItemUniqueId, tag : name, out abilities : array<name> )
  2094. {
  2095. var i : int;
  2096. var dm : CDefinitionsManagerAccessor;
  2097. var allAbilities : array<name>;
  2098.  
  2099. dm = theGame.GetDefinitionsManager();
  2100. GetItemAbilities(itemId, allAbilities);
  2101.  
  2102. for(i=0; i<allAbilities.Size(); i+=1)
  2103. {
  2104. if(dm.AbilityHasTag(allAbilities[i], tag))
  2105. {
  2106. abilities.PushBack(allAbilities[i]);
  2107. }
  2108. }
  2109. }
  2110.  
  2111.  
  2112.  
  2113.  
  2114. import private final function GiveItem( otherInventory : CInventoryComponent, itemId : SItemUniqueId, optional quantity : int ) : array<SItemUniqueId>;
  2115.  
  2116. public final function GiveMoneyTo(otherInventory : CInventoryComponent, optional quantity : int, optional informGUI : bool )
  2117. {
  2118. var moneyId : array<SItemUniqueId>;
  2119. var wasAdded : bool;
  2120.  
  2121. moneyId = GetItemsByName('Crowns');
  2122. if( !IsIdValid(moneyId[0]) && (GetEntity() == thePlayer || GetEntity() == thePlayer.GetHorseWithInventory()) )
  2123. {
  2124. wasAdded = true;
  2125. moneyId = AddAnItem('Crowns', 1, true, true, false);
  2126. }
  2127.  
  2128. GiveItemTo(otherInventory, moneyId[0], quantity, false, true, informGUI);
  2129.  
  2130. if( wasAdded )
  2131. RemoveMoney(1);
  2132. }
  2133.  
  2134. public final function GiveItemTo( otherInventory : CInventoryComponent, itemId : SItemUniqueId, optional quantity : int, optional refreshNewFlag : bool, optional forceTransferNoDrops : bool, optional informGUI : bool ) : SItemUniqueId
  2135. {
  2136. var arr : array<SItemUniqueId>;
  2137. var itemName : name;
  2138. var i : int;
  2139. var uiData : SInventoryItemUIData;
  2140. var isQuestItem : bool;
  2141. //Plasticmetal - LootTweak ++
  2142. var hud : CR4ScriptedHud;
  2143. var message : string;
  2144. //Plasticmetal - LootTweak --
  2145.  
  2146.  
  2147. if(quantity == 0)
  2148. quantity = 1;
  2149. //Plasticmetal - LootTweak ++
  2150. hud = (CR4ScriptedHud)theGame.GetHud();
  2151. if(hud && otherInventory==GetWitcherPlayer().GetHorseManager().GetInventoryComponent() && this!=GetWitcherPlayer().GetInventory())
  2152. {
  2153. //message = GetLocStringByKeyExt("panel_common_item_received") + ": " + this.GetItemLocNameByID(itemId);
  2154. message = GetLocStringByKeyExt("panel_common_item_received") + ": " + AlchemyColor(itemId);
  2155. if(quantity > 1)
  2156. message += " x" + quantity;
  2157. message += AlchemySecondary(itemId);
  2158. hud.HudConsoleMsg(message);
  2159. }
  2160. //Plasticmetal - LootTweak --
  2161.  
  2162. itemName = GetItemName(itemId);
  2163. if( itemName == 'Crowns' )
  2164. quantity = Clamp(quantity, 0, GetMoney());
  2165. else
  2166. {
  2167. if( IsItemSingletonItem(itemId) )
  2168. quantity = Clamp(quantity, 0, SingletonItemGetAmmo(itemId));
  2169. else
  2170. quantity = Clamp(quantity, 0, GetItemQuantity(itemId));
  2171. }
  2172. if(quantity == 0)
  2173. return GetInvalidUniqueId();
  2174.  
  2175.  
  2176. if(!forceTransferNoDrops && ( ItemHasTag(itemId, 'NoDrop') && !ItemHasTag(itemId, 'Lootable') ))
  2177. {
  2178. LogItems("Cannot transfer item <<" + itemName + ">> as it has the NoDrop tag set!!!");
  2179. return GetInvalidUniqueId();
  2180. }
  2181.  
  2182. if( this == GetWitcherPlayer().GetInventory() || (FactsQuerySum("NewGamePlus") > 0 && (this == GetWitcherPlayer().GetHorseManager().GetInventoryComponent() || (W3SwordStand)this.GetEntity() || (W3ArmorStand)this.GetEntity())) )
  2183. ModNoDuplicatesAddItemAboutToGiveModifiers(this,itemId);
  2184.  
  2185. if( IsItemSingletonItem(itemId) )
  2186. {
  2187. arr = otherInventory.AddAnItem(itemName, quantity, false, true, false);
  2188. if( quantity >= SingletonItemGetAmmo(itemId) )
  2189. RemoveItem(itemId);
  2190. else
  2191. SingletonItemRemoveAmmo(itemId, quantity);
  2192. }
  2193. else
  2194. {
  2195. // W3EE - Begin
  2196. if ( CanItemHaveOil(itemId) )
  2197. RemoveAllOilsFromItem(itemId);
  2198. if( GetEntity() == thePlayer )
  2199. ((W3PlayerWitcher)GetEntity()).RemoveRepairBuffs(itemId);
  2200.  
  2201. if( itemName == 'Crowns' && (GetEntity() == thePlayer || GetEntity() == thePlayer.GetHorseWithInventory()) )
  2202. {
  2203. RemoveMoney(quantity);
  2204. arr = otherInventory.AddAnItem('Crowns', quantity);
  2205. }
  2206. else
  2207. {
  2208. //Kolaris - Fixed Stashes
  2209. if( ItemHasTag(itemId, 'NoShow') && this == GetWitcherPlayer().GetHorseManager().GetInventoryComponent() && Equipment().IsStashableItem(this, itemId) )
  2210. {
  2211. if( !ItemHasTag(itemId, 'NoDrop') && !ItemHasTag(itemId, 'NoUse') && !ItemHasTag(itemId, 'EncumbranceOff') && !ItemHasTag(itemId, 'Quest') )
  2212. RemoveItemTag(itemId, 'NoShow');
  2213. }
  2214. if( GameplayFactsQuerySum("inFixedStash") > 0 )
  2215. {
  2216. if( this == thePlayer.inv && otherInventory == GetWitcherPlayer().GetHorseManager().GetInventoryComponent() && Equipment().IsStashableItem(this, itemId) && !ItemHasTag(itemId, 'Quest') )
  2217. {
  2218. AddItemTag(itemId, 'NoShow');
  2219. }
  2220. }
  2221. arr = GiveItem(otherInventory, itemId, quantity);
  2222. }
  2223. // W3EE - End
  2224. }
  2225.  
  2226. if(otherInventory == thePlayer.inv)
  2227. {
  2228. isQuestItem = this.IsItemQuest( itemId );
  2229. theTelemetry.LogWithLabelAndValue(TE_INV_ITEM_PICKED, itemName, quantity);
  2230.  
  2231. if ( !theGame.AreSavesLocked() && ( isQuestItem || this.GetItemQuality( itemId ) >= 4 ) )
  2232. {
  2233. theGame.RequestAutoSave( "item gained", false );
  2234. }
  2235. }
  2236.  
  2237. if (refreshNewFlag)
  2238. {
  2239. for (i = 0; i < arr.Size(); i += 1)
  2240. {
  2241. uiData = otherInventory.GetInventoryItemUIData( arr[i] );
  2242. uiData.isNew = true;
  2243. otherInventory.SetInventoryItemUIData( arr[i], uiData );
  2244. }
  2245. }
  2246.  
  2247. return arr[0];
  2248. }
  2249.  
  2250. public final function GiveAllItemsTo(otherInventory : CInventoryComponent, optional forceTransferNoDrops : bool, optional informGUI : bool)
  2251. {
  2252. var items : array<SItemUniqueId>;
  2253.  
  2254. GetAllItems(items);
  2255. GiveItemsTo(otherInventory, items, forceTransferNoDrops, informGUI);
  2256. }
  2257.  
  2258. public final function GiveItemsTo(otherInventory : CInventoryComponent, items : array<SItemUniqueId>, optional forceTransferNoDrops : bool, optional informGUI : bool) : array<SItemUniqueId>
  2259. {
  2260. var i : int;
  2261. var ret : array<SItemUniqueId>;
  2262.  
  2263. for( i = 0; i < items.Size(); i += 1 )
  2264. {
  2265. ret.PushBack(GiveItemTo(otherInventory, items[i], GetItemQuantity(items[i]), true, forceTransferNoDrops, informGUI));
  2266. }
  2267.  
  2268. return ret;
  2269. }
  2270.  
  2271.  
  2272. import final function HasItem( item : name ) : bool;
  2273.  
  2274.  
  2275.  
  2276. final function HasItemById(id : SItemUniqueId) : bool
  2277. {
  2278. var arr : array<SItemUniqueId>;
  2279.  
  2280. GetAllItems(arr);
  2281. return arr.Contains(id);
  2282. }
  2283.  
  2284. public function HasItemByTag(tag : name) : bool
  2285. {
  2286. var quantity : int;
  2287.  
  2288. quantity = GetItemQuantityByTag( tag );
  2289. return quantity > 0;
  2290. }
  2291.  
  2292. public function HasItemByCategory(category : name) : bool
  2293. {
  2294. var quantity : int;
  2295.  
  2296. quantity = GetItemQuantityByCategory( category );
  2297. return quantity > 0;
  2298. }
  2299.  
  2300.  
  2301. public function HasInfiniteBolts() : bool
  2302. {
  2303. var ids : array<SItemUniqueId>;
  2304. var i : int;
  2305.  
  2306. ids = GetItemsByTag(theGame.params.TAG_INFINITE_AMMO);
  2307. for(i=0; i<ids.Size(); i+=1)
  2308. {
  2309. if(IsItemBolt(ids[i]))
  2310. {
  2311. return true;
  2312. }
  2313. }
  2314.  
  2315. return false;
  2316. }
  2317.  
  2318.  
  2319. public function HasGroundBolts() : bool
  2320. {
  2321. var ids : array<SItemUniqueId>;
  2322. var i : int;
  2323.  
  2324. ids = GetItemsByTag(theGame.params.TAG_GROUND_AMMO);
  2325. for(i=0; i<ids.Size(); i+=1)
  2326. {
  2327. if(IsItemBolt(ids[i]))
  2328. {
  2329. return true;
  2330. }
  2331. }
  2332.  
  2333. return false;
  2334. }
  2335.  
  2336.  
  2337. public function HasUnderwaterBolts() : bool
  2338. {
  2339. var ids : array<SItemUniqueId>;
  2340. var i : int;
  2341.  
  2342. ids = GetItemsByTag(theGame.params.TAG_UNDERWATER_AMMO);
  2343. for(i=0; i<ids.Size(); i+=1)
  2344. {
  2345. if(IsItemBolt(ids[i]))
  2346. {
  2347. return true;
  2348. }
  2349. }
  2350.  
  2351. return false;
  2352. }
  2353.  
  2354.  
  2355.  
  2356. import private final function AddMultiItem( item : name, optional quantity : int, optional informGui : bool , optional markAsNew : bool , optional lootable : bool ) : array<SItemUniqueId>;
  2357. import private final function AddSingleItem( item : name, optional informGui : bool , optional markAsNew : bool , optional lootable : bool ) : SItemUniqueId;
  2358.  
  2359.  
  2360. public final function AddAnItem(item : name, optional quantity : int, optional dontInformGui : bool, optional dontMarkAsNew : bool, optional showAsRewardInUIHax : bool) : array<SItemUniqueId>
  2361. {
  2362. var arr : array<SItemUniqueId>;
  2363. var i : int;
  2364. var isReadableItem : bool;
  2365.  
  2366. if( theGame.GetDefinitionsManager().IsItemSingletonItem(item) /*&& GetEntity() == thePlayer*/)
  2367. {
  2368. // W3EE - Begin
  2369. if( !quantity )
  2370. quantity = 1;
  2371. // W3EE - End
  2372.  
  2373. if(GetItemQuantityByName(item) > 0)
  2374. {
  2375. arr = GetItemsIds(item);
  2376. // W3EE - Begin
  2377. SingletonItemAddAmmo(arr[0], quantity);
  2378. // W3EE - End
  2379. }
  2380. else
  2381. {
  2382. arr.PushBack(AddSingleItem(item, !dontInformGui, !dontMarkAsNew));
  2383. // W3EE - Begin
  2384. SingletonItemSetAmmo(arr[0], 0);
  2385. SingletonItemAddAmmo(arr[0], quantity);
  2386. // W3EE - End
  2387. }
  2388.  
  2389. quantity = 1;
  2390. }
  2391. else
  2392. {
  2393. if(quantity < 2 )
  2394. {
  2395. arr.PushBack(AddSingleItem(item, !dontInformGui, !dontMarkAsNew));
  2396. }
  2397. else
  2398. {
  2399. arr = AddMultiItem(item, quantity, !dontInformGui, !dontMarkAsNew);
  2400. }
  2401. }
  2402.  
  2403.  
  2404. if(this == thePlayer.GetInventory())
  2405. {
  2406. if(ItemHasTag(arr[0],'ReadableItem'))
  2407. UpdateInitialReadState(arr[0]);
  2408.  
  2409. if( IsItemCrossbow(arr[0]) )
  2410. AddAndEquipItem('Bodkin Bolt', EES_Bolt, 60);
  2411.  
  2412. if(showAsRewardInUIHax || ItemHasTag(arr[0],'GwintCard'))
  2413. thePlayer.DisplayItemRewardNotification(GetItemName(arr[0]), quantity );
  2414. }
  2415.  
  2416. return arr;
  2417. }
  2418.  
  2419.  
  2420. // W3EE - Begin
  2421. public function AddAndEquipItem( item : name, slot : EEquipmentSlots, optional quantity : int ) : SItemUniqueId
  2422. {
  2423. var items : array <SItemUniqueId>;
  2424.  
  2425. if( quantity < 1 )
  2426. quantity = 1;
  2427. items = AddAnItem(item, quantity);
  2428. if( this == thePlayer.GetInventory() )
  2429. thePlayer.EquipItem(items[0], slot);
  2430.  
  2431. return items[0];
  2432. }
  2433. // W3EE - End
  2434.  
  2435. import final function RemoveItem( itemId : SItemUniqueId, optional quantity : int ) : bool;
  2436.  
  2437.  
  2438. private final function InternalRemoveItems(ids : array<SItemUniqueId>, quantity : int)
  2439. {
  2440. var i, currQuantityToTake : int;
  2441.  
  2442.  
  2443. for(i=0; i<ids.Size(); i+=1 )
  2444. {
  2445.  
  2446. currQuantityToTake = Min(quantity, GetItemQuantity(ids[i]) );
  2447.  
  2448.  
  2449. if( GetEntity() == thePlayer )
  2450. {
  2451. GetWitcherPlayer().RemoveGwentCard( GetItemName(ids[i]) , currQuantityToTake);
  2452. }
  2453.  
  2454.  
  2455. RemoveItem(ids[i], currQuantityToTake);
  2456.  
  2457.  
  2458. quantity -= currQuantityToTake;
  2459.  
  2460.  
  2461. if ( quantity == 0 )
  2462. {
  2463. return;
  2464. }
  2465.  
  2466.  
  2467. LogAssert(quantity>0, "CInventoryComponent.InternalRemoveItems(" + GetItemName(ids[i]) + "): somehow took too many items! Should be " + (-quantity) + " less... Investigate!");
  2468. }
  2469. }
  2470.  
  2471.  
  2472.  
  2473. public function RemoveItemByName(itemName : name, optional quantity : int) : bool
  2474. {
  2475. var totalItemCount : int;
  2476. var ids : array<SItemUniqueId>;
  2477.  
  2478.  
  2479. totalItemCount = GetItemQuantityByName(itemName);
  2480. if(totalItemCount < quantity || quantity == 0)
  2481. {
  2482. return false;
  2483. }
  2484.  
  2485. if(quantity == 0)
  2486. {
  2487. quantity = 1;
  2488. }
  2489. else if(quantity < 0)
  2490. {
  2491. quantity = totalItemCount;
  2492. }
  2493.  
  2494. ids = GetItemsIds(itemName);
  2495.  
  2496. if(GetEntity() == thePlayer && thePlayer.GetSelectedItemId() == ids[0] )
  2497. {
  2498. thePlayer.ClearSelectedItemId();
  2499. }
  2500.  
  2501. InternalRemoveItems(ids, quantity);
  2502.  
  2503. return true;
  2504. }
  2505.  
  2506.  
  2507.  
  2508. public function RemoveItemByCategory(itemCategory : name, optional quantity : int) : bool
  2509. {
  2510. var totalItemCount : int;
  2511. var ids : array<SItemUniqueId>;
  2512. var selectedItemId : SItemUniqueId;
  2513. var i : int;
  2514.  
  2515.  
  2516. totalItemCount = GetItemQuantityByCategory(itemCategory);
  2517. if(totalItemCount < quantity)
  2518. {
  2519. return false;
  2520. }
  2521.  
  2522. if(quantity == 0)
  2523. {
  2524. quantity = 1;
  2525. }
  2526. else if(quantity < 0)
  2527. {
  2528. quantity = totalItemCount;
  2529. }
  2530.  
  2531. ids = GetItemsByCategory(itemCategory);
  2532.  
  2533. if(GetEntity() == thePlayer)
  2534. {
  2535. selectedItemId = thePlayer.GetSelectedItemId();
  2536. for(i=0; i<ids.Size(); i+=1)
  2537. {
  2538. if(selectedItemId == ids[i] )
  2539. {
  2540. thePlayer.ClearSelectedItemId();
  2541. break;
  2542. }
  2543. }
  2544. }
  2545.  
  2546. InternalRemoveItems(ids, quantity);
  2547.  
  2548. return true;
  2549. }
  2550.  
  2551.  
  2552.  
  2553. public function RemoveItemByTag(itemTag : name, optional quantity : int) : bool
  2554. {
  2555. var totalItemCount : int;
  2556. var ids : array<SItemUniqueId>;
  2557. var i : int;
  2558. var selectedItemId : SItemUniqueId;
  2559.  
  2560.  
  2561. totalItemCount = GetItemQuantityByTag(itemTag);
  2562. if(totalItemCount < quantity)
  2563. {
  2564. return false;
  2565. }
  2566.  
  2567. if(quantity == 0)
  2568. {
  2569. quantity = 1;
  2570. }
  2571. else if(quantity < 0)
  2572. {
  2573. quantity = totalItemCount;
  2574. }
  2575.  
  2576. ids = GetItemsByTag(itemTag);
  2577.  
  2578. if(GetEntity() == thePlayer)
  2579. {
  2580. selectedItemId = thePlayer.GetSelectedItemId();
  2581. for(i=0; i<ids.Size(); i+=1)
  2582. {
  2583. if(selectedItemId == ids[i] )
  2584. {
  2585. thePlayer.ClearSelectedItemId();
  2586. break;
  2587. }
  2588. }
  2589. }
  2590.  
  2591. InternalRemoveItems(ids, quantity);
  2592.  
  2593. return true;
  2594. }
  2595.  
  2596.  
  2597. import final function RemoveAllItems();
  2598.  
  2599.  
  2600. import final function GetItemEntityUnsafe( itemId : SItemUniqueId ) : CItemEntity;
  2601.  
  2602.  
  2603. import final function GetDeploymentItemEntity( itemId : SItemUniqueId, optional position : Vector, optional rotation : EulerAngles, optional allocateIdTag : bool ) : CEntity;
  2604.  
  2605.  
  2606. import final function MountItem( itemId : SItemUniqueId, optional toHand : bool, optional force : bool ) : bool;
  2607.  
  2608.  
  2609. import final function UnmountItem( itemId : SItemUniqueId, optional destroyEntity : bool ) : bool;
  2610.  
  2611.  
  2612.  
  2613. import final function IsItemMounted( itemId : SItemUniqueId ) : bool;
  2614.  
  2615.  
  2616.  
  2617. import final function IsItemHeld( itemId : SItemUniqueId ) : bool;
  2618.  
  2619.  
  2620. import final function DropItem( itemId : SItemUniqueId, optional removeFromInv : bool );
  2621.  
  2622.  
  2623. import final function GetItemHoldSlot( itemId : SItemUniqueId ) : name;
  2624.  
  2625.  
  2626. import final function PlayItemEffect( itemId : SItemUniqueId, effectName : name );
  2627. import final function StopItemEffect( itemId : SItemUniqueId, effectName : name );
  2628.  
  2629.  
  2630. import final function ThrowAwayItem( itemId : SItemUniqueId, optional quantity : int ) : bool;
  2631.  
  2632.  
  2633. import final function ThrowAwayAllItems() : CEntity;
  2634.  
  2635.  
  2636. import final function ThrowAwayItemsFiltered( excludedTags : array< name > ) : CEntity;
  2637.  
  2638.  
  2639. import final function ThrowAwayLootableItems( optional skipNoDropNoShow : bool ) : CEntity;
  2640.  
  2641.  
  2642. import final function GetItemRecyclingParts( itemId : SItemUniqueId ) : array<SItemParts>;
  2643.  
  2644. import final function GetItemWeight( id : SItemUniqueId ) : float;
  2645.  
  2646.  
  2647. public final function HasQuestItem() : bool
  2648. {
  2649. var allItems : array< SItemUniqueId >;
  2650. var i : int;
  2651.  
  2652. allItems = GetItemsByTag('Quest');
  2653. for ( i=0; i<allItems.Size(); i+=1 )
  2654. {
  2655. if(!ItemHasTag(allItems[i], theGame.params.TAG_DONT_SHOW))
  2656. {
  2657. return true;
  2658. }
  2659. }
  2660.  
  2661. return false;
  2662. }
  2663.  
  2664.  
  2665.  
  2666.  
  2667.  
  2668.  
  2669. import final function HasItemDurability( itemId : SItemUniqueId ) : bool;
  2670. import final function GetItemDurability( itemId : SItemUniqueId ) : float;
  2671. import private final function SetItemDurability( itemId : SItemUniqueId, durability : float );
  2672. import final function GetItemInitialDurability( itemId : SItemUniqueId ) : float;
  2673. import final function GetItemMaxDurability( itemId : SItemUniqueId ) : float;
  2674. import final function GetItemGridSize( itemId : SItemUniqueId ) : int;
  2675.  
  2676.  
  2677. import final function NotifyItemLooted( item : SItemUniqueId );
  2678. import final function ResetContainerData();
  2679.  
  2680. public function SetItemDurabilityScript( itemId : SItemUniqueId, durability : float )
  2681. {
  2682. var oldDur : float;
  2683.  
  2684. oldDur = GetItemDurability(itemId);
  2685.  
  2686. if(oldDur == durability)
  2687. return;
  2688.  
  2689. if(durability < oldDur)
  2690. {
  2691. //Kolaris - Repair Buffs
  2692. if ( ItemHasAbility( itemId, 'MA_Indestructible' ) /*|| ItemHasTag(itemId, 'ItemEnhanced')*/ )
  2693. {
  2694. return;
  2695. }
  2696.  
  2697. if(GetEntity() == thePlayer && ShouldProcessTutorial('TutorialDurability'))
  2698. {
  2699. if ( durability <= theGame.params.ITEM_DAMAGED_DURABILITY && oldDur > theGame.params.ITEM_DAMAGED_DURABILITY )
  2700. {
  2701. FactsAdd( "tut_item_damaged", 1 );
  2702. }
  2703. }
  2704. }
  2705.  
  2706. SetItemDurability( itemId, durability );
  2707. }
  2708.  
  2709.  
  2710. public function ReduceItemDurability(itemId : SItemUniqueId, optional forced : bool, optional oilInfos : SOilInfo) : bool
  2711. {
  2712. var dur, value, durabilityDiff, itemToughness, indestructible, oilStrength : float;
  2713. var chance, i : int;
  2714. //var weaponId : SItemUniqueId;
  2715. var oils : array<W3Effect_Oil>;
  2716. var appliedOilName : name;
  2717.  
  2718. //Kolaris - Repair Buffs
  2719. if(!IsIdValid(itemId) || !HasItemDurability(itemId) || ItemHasAbility(itemId, 'MA_Indestructible') /*|| ItemHasTag(itemId, 'ItemEnhanced')*/)
  2720. {
  2721. return false;
  2722. }
  2723.  
  2724.  
  2725. if( IsItemWeapon(itemId) )
  2726. {
  2727. // W3EE - Begin
  2728. //chance = theGame.params.DURABILITY_WEAPON_LOSE_CHANCE;
  2729.  
  2730. //Kolaris - Weapon Durability Loss
  2731. //value = theGame.params.GetWeaponDurabilityLoseValue();
  2732.  
  2733. //Kolaris - Aerondight Silver
  2734. if( IsItemSilverSwordUsableByPlayer(itemId) )
  2735. {
  2736. if( (W3Effect_Aerondight)GetWitcherPlayer().GetBuff(EET_Aerondight) )
  2737. {
  2738. value = 0;
  2739. chance = 0;
  2740. }
  2741. else
  2742. {
  2743. value = 0.2f;
  2744. chance = 50;
  2745. }
  2746. }
  2747. else
  2748. {
  2749. value = 0.05f;
  2750. chance = 40;
  2751. }
  2752.  
  2753. //Kolaris - Fortification
  2754. if( thePlayer.HasAbility('Runeword 53 _Stats', true) || thePlayer.HasAbility('Runeword 54 _Stats', true) )
  2755. {
  2756. value *= 0;
  2757. chance = 0;
  2758. }
  2759.  
  2760. if( oilInfos.isActive )
  2761. {
  2762. //Kolaris - Fixative
  2763. if( thePlayer.CanUseSkill(S_Alchemy_s05) )
  2764. {
  2765. value *= 1.f - (0.2f * thePlayer.GetSkillLevel(S_Alchemy_s05) * oils[i].GetAmmoPercentage());
  2766. }
  2767. if( oilInfos.activeIndex[0] )
  2768. {
  2769. oilStrength = 3.f * (1.f - PowF(1.f - oils[i].GetAmmoPercentage(), 2));
  2770. value *= oilStrength;
  2771. }
  2772. if( oilInfos.activeIndex[6] && IsItemSilverSwordUsableByPlayer(itemId) )
  2773. {
  2774. value *= 0;
  2775. chance = 0;
  2776. }
  2777. }
  2778. // W3EE - End
  2779. }
  2780. else if(IsItemAnyArmor(itemId))
  2781. {
  2782. // W3EE - Begin
  2783. //chance = theGame.params.DURABILITY_ARMOR_LOSE_CHANCE;
  2784.  
  2785. switch( GetArmorTypeOriginal(itemId) )
  2786. {
  2787. case EAT_Heavy: chance = 40; break;
  2788. case EAT_Medium: chance = 50; break;
  2789. case EAT_Light: chance = 60; break;
  2790. }
  2791. //W3EE - End
  2792.  
  2793. value = theGame.params.DURABILITY_ARMOR_LOSE_VALUE;
  2794.  
  2795. //Kolaris - Protection
  2796. if( thePlayer.HasAbility('Glyphword 32 _Stats', true) || thePlayer.HasAbility('Glyphword 33 _Stats', true) )
  2797. {
  2798. value *= 0;
  2799. chance = 0;
  2800. }
  2801. }
  2802.  
  2803. dur = GetItemDurability(itemId);
  2804.  
  2805. if ( dur == 0 )
  2806. {
  2807. return false;
  2808. }
  2809.  
  2810.  
  2811. if ( forced || RandRange( 100 ) < chance )
  2812. {
  2813. itemToughness = CalculateAttributeValue( GetItemAttributeValue( itemId, 'toughness' ) );
  2814. indestructible = CalculateAttributeValue( GetItemAttributeValue( itemId, 'indestructible' ) );
  2815.  
  2816. value = value * ( 1 - indestructible );
  2817. //Kolaris - Difficulty Settings
  2818. value /= Options().EquipmentDurabilityMod()();
  2819. //Kolaris - Repair Buffs
  2820. if( ItemHasTag(itemId, 'ItemEnhanced') )
  2821. value *= 0.5f;
  2822. //Kolaris - Tiger Set
  2823. if( thePlayer.IsSetBonusActive(EISB_Tiger_2) && thePlayer.HasBuff(EET_AlbedoDominance) )
  2824. value *= 0.5f;
  2825.  
  2826. if ( itemToughness > 0.0f && itemToughness <= 1.0f )
  2827. {
  2828. durabilityDiff = ( dur - value ) * itemToughness;
  2829.  
  2830. SetItemDurabilityScript( itemId, MaxF(durabilityDiff, 0 ) );
  2831. }
  2832. else
  2833. {
  2834. SetItemDurabilityScript( itemId, MaxF( dur - value, 0 ) );
  2835. }
  2836. }
  2837.  
  2838. return true;
  2839. }
  2840.  
  2841. public function GetItemDurabilityRatio(itemId : SItemUniqueId) : float
  2842. {
  2843. if ( !IsIdValid( itemId ) || !HasItemDurability( itemId ) )
  2844. return -1;
  2845.  
  2846. return GetItemDurability(itemId) / GetItemMaxDurability(itemId);
  2847. }
  2848.  
  2849.  
  2850.  
  2851.  
  2852.  
  2853.  
  2854. public function GetItemResistStatWithDurabilityModifiers(itemId : SItemUniqueId, stat : ECharacterDefenseStats, out points : SAbilityAttributeValue, out percents : SAbilityAttributeValue)
  2855. {
  2856. var mult : float;
  2857. var null : SAbilityAttributeValue;
  2858.  
  2859. points = null;
  2860. percents = null;
  2861. if(!IsItemAnyArmor(itemId))
  2862. return;
  2863.  
  2864. mult = theGame.params.GetDurabilityMultiplier(GetItemDurabilityRatio(itemId), false);
  2865.  
  2866. points = GetItemAttributeValue(itemId, ResistStatEnumToName(stat, true));
  2867. percents = GetItemAttributeValue(itemId, ResistStatEnumToName(stat, false));
  2868.  
  2869. points = points * mult;
  2870. percents = percents * mult;
  2871. }
  2872.  
  2873.  
  2874. public function GetItemResistanceTypes(id : SItemUniqueId) : array<ECharacterDefenseStats>
  2875. {
  2876. var ret : array<ECharacterDefenseStats>;
  2877. var i : int;
  2878. var stat : ECharacterDefenseStats;
  2879. var atts : array<name>;
  2880. var tmpBool : bool;
  2881.  
  2882. if(!IsIdValid(id))
  2883. return ret;
  2884.  
  2885. GetItemAttributes(id, atts);
  2886. for(i=0; i<atts.Size(); i+=1)
  2887. {
  2888. stat = ResistStatNameToEnum(atts[i], tmpBool);
  2889. if(stat != CDS_None && !ret.Contains(stat))
  2890. ret.PushBack(stat);
  2891. }
  2892.  
  2893. return ret;
  2894. }
  2895.  
  2896. import final function GetItemModifierFloat( itemId : SItemUniqueId, modName : name, optional defValue : float ) : float;
  2897. import final function SetItemModifierFloat( itemId : SItemUniqueId, modName : name, val : float);
  2898. import final function GetItemModifierInt ( itemId : SItemUniqueId, modName : name, optional defValue : int ) : int;
  2899. import final function SetItemModifierInt ( itemId : SItemUniqueId, modName : name, val : int );
  2900.  
  2901.  
  2902. import final function ActivateQuestBonus();
  2903.  
  2904.  
  2905. import final function GetItemSetName( itemId : SItemUniqueId ) : name;
  2906.  
  2907.  
  2908. import final function AddItemCraftedAbility( itemId : SItemUniqueId, abilityName : name, optional allowDuplicate : bool );
  2909.  
  2910.  
  2911. import final function RemoveItemCraftedAbility( itemId : SItemUniqueId, abilityName : name );
  2912.  
  2913.  
  2914. import final function AddItemBaseAbility(item : SItemUniqueId, abilityName : name);
  2915.  
  2916.  
  2917. import final function RemoveItemBaseAbility(item : SItemUniqueId, abilityName : name);
  2918.  
  2919.  
  2920. import final function DespawnItem( itemId : SItemUniqueId );
  2921.  
  2922.  
  2923.  
  2924.  
  2925.  
  2926.  
  2927. import final function GetInventoryItemUIData( item : SItemUniqueId ) : SInventoryItemUIData;
  2928.  
  2929.  
  2930. import final function SetInventoryItemUIData( item : SItemUniqueId, data : SInventoryItemUIData );
  2931.  
  2932. import final function SortInventoryUIData();
  2933.  
  2934.  
  2935.  
  2936.  
  2937.  
  2938.  
  2939. import final function PrintInfo();
  2940.  
  2941.  
  2942.  
  2943.  
  2944.  
  2945.  
  2946. import final function EnableLoot( enable : bool );
  2947.  
  2948.  
  2949. import final function UpdateLoot();
  2950.  
  2951.  
  2952. import final function AddItemsFromLootDefinition( lootDefinitionName : name );
  2953.  
  2954.  
  2955. import final function IsLootRenewable() : bool;
  2956.  
  2957.  
  2958. import final function IsReadyToRenew() : bool;
  2959.  
  2960.  
  2961.  
  2962.  
  2963.  
  2964.  
  2965. function Created()
  2966. {
  2967. LoadBooksDefinitions();
  2968. }
  2969.  
  2970. function ClearGwintCards()
  2971. {
  2972. var attr : SAbilityAttributeValue;
  2973. var allItems : array<SItemUniqueId>;
  2974. var card : array<SItemUniqueId>;
  2975. var iHave, shopHave, cardLimit, delta : int;
  2976. var curItem : SItemUniqueId;
  2977. var i : int;
  2978.  
  2979. allItems = GetItemsByCategory('gwint');
  2980. for(i=allItems.Size()-1; i >= 0; i-=1)
  2981. {
  2982. curItem = allItems[i];
  2983.  
  2984. attr = GetItemAttributeValue( curItem, 'max_count');
  2985. card = thePlayer.GetInventory().GetItemsByName( GetItemName( curItem ) );
  2986. iHave = thePlayer.GetInventory().GetItemQuantity( card[0] );
  2987. cardLimit = RoundF(attr.valueBase);
  2988. shopHave = GetItemQuantity( curItem );
  2989.  
  2990. if (iHave > 0 && shopHave > 0)
  2991. {
  2992. delta = shopHave - (cardLimit - iHave);
  2993.  
  2994. if ( delta > 0 )
  2995. {
  2996. RemoveItem( curItem, delta );
  2997. }
  2998. }
  2999. }
  3000. }
  3001.  
  3002. function ClearTHmaps()
  3003. {
  3004. var attr : SAbilityAttributeValue;
  3005. var allItems : array<SItemUniqueId>;
  3006. var map : array<SItemUniqueId>;
  3007. var i : int;
  3008. var thCompleted : bool;
  3009. var iHave, shopHave : int;
  3010.  
  3011. allItems = GetItemsByTag('ThMap');
  3012. for(i=allItems.Size()-1; i >= 0; i-=1)
  3013. {
  3014. attr = GetItemAttributeValue( allItems[i], 'max_count');
  3015. map = thePlayer.GetInventory().GetItemsByName( GetItemName( allItems[i] ) );
  3016. thCompleted = FactsDoesExist(GetItemName(allItems[i]));
  3017. iHave = thePlayer.GetInventory().GetItemQuantity( map[0] );
  3018. shopHave = RoundF(attr.valueBase);
  3019.  
  3020. if ( iHave >= shopHave || thCompleted )
  3021. {
  3022. RemoveItem( allItems[i], GetItemQuantity( allItems[i] ) );
  3023. }
  3024. }
  3025. }
  3026.  
  3027.  
  3028. public final function ClearKnownRecipes()
  3029. {
  3030. var witcher : W3PlayerWitcher;
  3031. var recipes, craftRecipes : array<name>;
  3032. var i : int;
  3033. var itemName : name;
  3034. var allItems : array<SItemUniqueId>;
  3035.  
  3036. witcher = GetWitcherPlayer();
  3037. if(!witcher)
  3038. return;
  3039.  
  3040.  
  3041. recipes = witcher.GetAlchemyRecipes();
  3042. craftRecipes = witcher.GetCraftingSchematicsNames();
  3043. ArrayOfNamesAppend(recipes, craftRecipes);
  3044.  
  3045.  
  3046. GetAllItems(allItems);
  3047.  
  3048.  
  3049. for(i=allItems.Size()-1; i>=0; i-=1)
  3050. {
  3051. itemName = GetItemName(allItems[i]);
  3052. if(recipes.Contains(itemName))
  3053. RemoveItem(allItems[i], GetItemQuantity(allItems[i]));
  3054. }
  3055. }
  3056.  
  3057.  
  3058.  
  3059.  
  3060.  
  3061. function LoadBooksDefinitions() : void
  3062. {
  3063. var readableArray : array<SItemUniqueId>;
  3064. var i : int;
  3065.  
  3066. readableArray = GetItemsByTag('ReadableItem');
  3067.  
  3068. for( i = 0; i < readableArray.Size(); i += 1 )
  3069. {
  3070. if( IsBookRead(readableArray[i]))
  3071. {
  3072. continue;
  3073. }
  3074. UpdateInitialReadState(readableArray[i]);
  3075. }
  3076. }
  3077.  
  3078. function UpdateInitialReadState( item : SItemUniqueId )
  3079. {
  3080. var abilitiesArray : array<name>;
  3081. var i : int;
  3082. GetItemAbilities(item,abilitiesArray);
  3083.  
  3084. for( i = 0; i < abilitiesArray.Size(); i += 1 )
  3085. {
  3086. if( abilitiesArray[i] == 'WasRead' )
  3087. {
  3088. ReadBook(item);
  3089. break;
  3090. }
  3091. }
  3092.  
  3093. //---===modWitcherLoreCollection===---//
  3094. if(ItemHasTag(item, 'glossaryNoDesc'))
  3095. {
  3096. if(ItemHasTag(item, 'w3Glossary'))
  3097. {
  3098. thePlayer.inv.ReadBook(item);
  3099. thePlayer.inv.RemoveItem(item);
  3100. theGame.GetGuiManager().ShowNotification( GetLocStringByKeyExt ( "notification_w3glossary_added" ) );
  3101. }
  3102.  
  3103. thePlayer.inv.ReadBook(item);
  3104. thePlayer.inv.RemoveItem(item);
  3105. }
  3106. //---===modWitcherLoreCollection===---//
  3107. }
  3108.  
  3109. function IsBookRead( item : SItemUniqueId ) : bool
  3110. {
  3111. var bookName : name;
  3112. var bResult : bool;
  3113.  
  3114. bookName = GetItemName( item );
  3115.  
  3116. bResult = IsBookReadByName( bookName );
  3117. return bResult;
  3118. }
  3119.  
  3120. function IsBookReadByName( bookName : name ) : bool
  3121. {
  3122. var bookFactName : string;
  3123.  
  3124. bookFactName = GetBookReadFactName( bookName );
  3125. if( FactsDoesExist(bookFactName) )
  3126. {
  3127. return FactsQuerySum( bookFactName );
  3128. }
  3129.  
  3130. return false;
  3131. }
  3132.  
  3133. function ReadBook( item : SItemUniqueId, optional noNotification : bool )
  3134. {
  3135.  
  3136. var bookName : name;
  3137. var abilitiesArray : array<name>;
  3138. var i : int;
  3139. var commonMapManager : CCommonMapManager = theGame.GetCommonMapManager();
  3140.  
  3141. bookName = GetItemName( item );
  3142.  
  3143. // W3EE - Begin
  3144. if( !IsBookRead(item) )
  3145. Equipment().ProcessDecoctionFormulas(thePlayer.inv.GetItemName(item));
  3146. // W3EE - End
  3147.  
  3148. if ( !IsBookRead ( item ) && ItemHasTag ( item, 'FastTravel' ))
  3149. {
  3150. GetItemAbilities(item, abilitiesArray);
  3151.  
  3152. for ( i = 0; i < abilitiesArray.Size(); i+=1 )
  3153. {
  3154. commonMapManager.SetEntityMapPinDiscoveredScript(true, abilitiesArray[i], true );
  3155. }
  3156. }
  3157. ReadBookByNameId( bookName, item, false, noNotification );
  3158.  
  3159.  
  3160.  
  3161.  
  3162. if(ItemHasTag(item, 'PerkBook'))
  3163. {
  3164.  
  3165. }
  3166. }
  3167.  
  3168. public function GetBookText(item : SItemUniqueId) : string
  3169. {
  3170. if ( GetItemName( item ) != 'Gwent Almanac' )
  3171. {
  3172. return ReplaceTagsToIcons(GetLocStringByKeyExt(GetItemLocalizedNameByUniqueID(item)+"_text"));
  3173. }
  3174. else
  3175. {
  3176. return GetGwentAlmanacContents();
  3177. }
  3178. }
  3179.  
  3180. public function GetBookTextByName( bookName : name ) : string
  3181. {
  3182. if( bookName != 'Gwent Almanac' )
  3183. {
  3184. return ReplaceTagsToIcons( GetLocStringByKeyExt( GetItemLocalizedNameByName( bookName ) + "_text" ) );
  3185. }
  3186. else
  3187. {
  3188. return GetGwentAlmanacContents();
  3189. }
  3190. }
  3191.  
  3192. function ReadSchematicsAndRecipes( item : SItemUniqueId )
  3193. {
  3194. var itemCategory : name;
  3195. var itemName : name;
  3196. var player : W3PlayerWitcher;
  3197.  
  3198. //Kolaris - Dynamic Witcher Schematics
  3199. //ReadBook( item );
  3200.  
  3201. player = GetWitcherPlayer();
  3202. if ( !player )
  3203. {
  3204. return;
  3205. }
  3206.  
  3207. itemName = GetItemName( item );
  3208. itemCategory = GetItemCategory( item );
  3209. if ( itemCategory == 'alchemy_recipe' )
  3210. {
  3211. if ( player.CanLearnAlchemyRecipe( itemName ) )
  3212. {
  3213. player.AddAlchemyRecipe( itemName );
  3214. player.GetInventory().AddItemTag(item, 'NoShow');
  3215. //---=== modFriendlyHUD ===---
  3216. if (!thePlayer.newCraftables.Contains(itemName))
  3217. {
  3218. thePlayer.newCraftables.PushBack(itemName);
  3219. }
  3220. //---=== modFriendlyHUD ===---
  3221.  
  3222. }
  3223. }
  3224. else if ( itemCategory == 'crafting_schematic' )
  3225. {
  3226. //Kolaris - Dynamic Witcher Schematics
  3227. if( player.GetInventory().GetItemQuality(item) >= 5 )
  3228. {
  3229. player.AddCraftingSchematic( itemName, player.GetInventory().ItemHasTag(item, 'NoNotification') );
  3230. if( Equipment().IsDWSInstalled() )
  3231. {
  3232. Equipment().ManageWitcherSchematics(itemName);
  3233. }
  3234. }
  3235. else
  3236. {
  3237. player.AddCraftingSchematic( itemName, player.GetInventory().ItemHasTag(item, 'NoNotification') );
  3238. //---=== modFriendlyHUD ===---
  3239. if (!thePlayer.newCraftables.Contains(itemName))
  3240. {
  3241. thePlayer.newCraftables.PushBack(itemName);
  3242. }
  3243. //---=== modFriendlyHUD ===---
  3244. }
  3245. player.GetInventory().AddItemTag(item, 'NoShow');
  3246.  
  3247. }
  3248.  
  3249. //Kolaris - Dynamic Witcher Schematics
  3250. ReadBook( item );
  3251.  
  3252. }
  3253.  
  3254. function ReadBookByName( bookName : name , unread : bool, optional noNotification : bool )
  3255. {
  3256. var defMgr : CDefinitionsManagerAccessor;
  3257. var bookFactName : string;
  3258.  
  3259. if( IsBookReadByName( bookName ) != unread )
  3260. {
  3261. return;
  3262. }
  3263.  
  3264. bookFactName = "BookReadState_"+bookName;
  3265. bookFactName = StrReplace(bookFactName," ","_");
  3266.  
  3267. if( unread )
  3268. {
  3269. FactsSubstract( bookFactName, 1 );
  3270. }
  3271. else
  3272. {
  3273. FactsAdd( bookFactName, 1 );
  3274.  
  3275.  
  3276. defMgr = theGame.GetDefinitionsManager();
  3277. if(!IsAlchemyRecipe(bookName) && !IsCraftingSchematic(bookName) && !defMgr.ItemHasTag( bookName, 'Painting' ) )
  3278. {
  3279. theGame.GetGamerProfile().IncStat(ES_ReadBooks);
  3280.  
  3281. if( !noNotification )
  3282. {
  3283. theGame.GetGuiManager().ShowNotification( GetLocStringByKeyExt( "notification_book_moved" ), 0, false );
  3284. }
  3285. }
  3286.  
  3287.  
  3288. if ( AddBestiaryFromBook(bookName) )
  3289. return;
  3290.  
  3291.  
  3292.  
  3293. }
  3294. }
  3295.  
  3296. function ReadBookByNameId( bookName : name, itemId:SItemUniqueId, unread : bool, optional noNotification : bool )
  3297. {
  3298. var bookFactName : string;
  3299.  
  3300. if( IsBookReadByName( bookName ) != unread )
  3301. {
  3302. return;
  3303. }
  3304.  
  3305. bookFactName = "BookReadState_"+bookName;
  3306. bookFactName = StrReplace(bookFactName," ","_");
  3307.  
  3308. if( unread )
  3309. {
  3310. FactsSubstract( bookFactName, 1 );
  3311. }
  3312. else
  3313. {
  3314. FactsAdd( bookFactName, 1 );
  3315.  
  3316.  
  3317. if( !IsAlchemyRecipe( bookName ) && !IsCraftingSchematic( bookName ) )
  3318. {
  3319. theGame.GetGamerProfile().IncStat(ES_ReadBooks);
  3320.  
  3321. if( !noNotification )
  3322. {
  3323.  
  3324. GetWitcherPlayer().AddReadBook( bookName );
  3325. }
  3326. }
  3327.  
  3328.  
  3329. if ( AddBestiaryFromBook(bookName) )
  3330. return;
  3331. else
  3332. //Kolaris - Dynamic Witcher Schematics
  3333. if( ItemHasTag(itemId, 'NoShow') )
  3334. return;
  3335. else
  3336. ReadSchematicsAndRecipes( itemId );
  3337. }
  3338. }
  3339.  
  3340.  
  3341. private function AddBestiaryFromBook( bookName : name ) : bool
  3342. {
  3343. var i, j, r, len : int;
  3344. var manager : CWitcherJournalManager;
  3345. var resource : array<CJournalResource>;
  3346. var entryBase : CJournalBase;
  3347. var childGroups : array<CJournalBase>;
  3348. var childEntries : array<CJournalBase>;
  3349. var descriptionGroup : CJournalCreatureDescriptionGroup;
  3350. var descriptionEntry : CJournalCreatureDescriptionEntry;
  3351.  
  3352. manager = theGame.GetJournalManager();
  3353.  
  3354. switch ( bookName )
  3355. {
  3356. case 'Beasts vol 1':
  3357. resource.PushBack( (CJournalResource)LoadResource( "BestiaryWolf" ) );
  3358. resource.PushBack( (CJournalResource)LoadResource( "BestiaryDog" ) );
  3359. break;
  3360. case 'Beasts vol 2':
  3361. resource.PushBack( (CJournalResource)LoadResource( "BestiaryBear" ) );
  3362. break;
  3363. case 'Cursed Monsters vol 1':
  3364. resource.PushBack( (CJournalResource)LoadResource( "BestiaryWerewolf" ) );
  3365. resource.PushBack( (CJournalResource)LoadResource( "BestiaryLycanthrope" ) );
  3366. GetWitcherPlayer().AddAlchemyRecipe('Recipe for Mutagen 24');
  3367. break;
  3368. case 'Cursed Monsters vol 2':
  3369. resource.PushBack( (CJournalResource)LoadResource( "BestiaryWerebear" ) );
  3370. resource.PushBack( (CJournalResource)LoadResource( "BestiaryMiscreant" ) );
  3371. GetWitcherPlayer().AddAlchemyRecipe('Recipe for Mutagen 11');
  3372. break;
  3373. case 'Draconides vol 1':
  3374. resource.PushBack( (CJournalResource)LoadResource( "BestiaryCockatrice" ) );
  3375. resource.PushBack( (CJournalResource)LoadResource( "BestiaryBasilisk" ) );
  3376. GetWitcherPlayer().AddAlchemyRecipe('Recipe for Mutagen 3');
  3377. GetWitcherPlayer().AddAlchemyRecipe('Recipe for Mutagen 23');
  3378. break;
  3379. case 'Draconides vol 2':
  3380. resource.PushBack( (CJournalResource)LoadResource( "BestiaryWyvern" ) );
  3381. resource.PushBack( (CJournalResource)LoadResource( "BestiaryForktail" ) );
  3382. GetWitcherPlayer().AddAlchemyRecipe('Recipe for Mutagen 10');
  3383. GetWitcherPlayer().AddAlchemyRecipe('Recipe for Mutagen 17');
  3384. break;
  3385. case 'Hybrid Monsters vol 1':
  3386. resource.PushBack( (CJournalResource)LoadResource( "BestiaryHarpy" ) );
  3387. resource.PushBack( (CJournalResource)LoadResource( "BestiaryErynia" ) );
  3388. resource.PushBack( (CJournalResource)LoadResource( "BestiarySiren" ) );
  3389. resource.PushBack( (CJournalResource)LoadResource( "BestiarySuccubus" ) );
  3390. GetWitcherPlayer().AddAlchemyRecipe('Recipe for Mutagen 14');
  3391. GetWitcherPlayer().AddAlchemyRecipe('Recipe for Mutagen 21');
  3392. break;
  3393. case 'Hybrid Monsters vol 2':
  3394. resource.PushBack( (CJournalResource)LoadResource( "BestiaryGriffin" ) );
  3395. GetWitcherPlayer().AddAlchemyRecipe('Recipe for Mutagen 4');
  3396. GetWitcherPlayer().AddAlchemyRecipe('Recipe for Mutagen 27');
  3397. break;
  3398. case 'Insectoids vol 1':
  3399. resource.PushBack( (CJournalResource)LoadResource( "BestiaryEndriagaWorker" ) );
  3400. resource.PushBack( (CJournalResource)LoadResource( "BestiaryEndriagaTruten" ) );
  3401. resource.PushBack( (CJournalResource)LoadResource( "BestiaryEndriaga" ) );
  3402. break;
  3403. case 'Insectoids vol 2':
  3404. resource.PushBack( (CJournalResource)LoadResource( "BestiaryCrabSpider" ) );
  3405. resource.PushBack( (CJournalResource)LoadResource( "BestiaryArmoredArachas" ) );
  3406. resource.PushBack( (CJournalResource)LoadResource( "BestiaryPoisonousArachas" ) );
  3407. GetWitcherPlayer().AddAlchemyRecipe('Recipe for Mutagen 2');
  3408. break;
  3409. case 'Magical Monsters vol 1':
  3410. resource.PushBack( (CJournalResource)LoadResource( "BestiaryGolem" ) );
  3411. resource.PushBack( (CJournalResource)LoadResource( "BestiaryGargoyle" ) );//---===modWitcherLoreCollection===---//
  3412. break;
  3413. case 'Magical Monsters vol 2':
  3414. resource.PushBack( (CJournalResource)LoadResource( "BestiaryElemental" ) );
  3415. resource.PushBack( (CJournalResource)LoadResource( "BestiaryIceGolem" ) );
  3416. resource.PushBack( (CJournalResource)LoadResource( "BestiaryFireElemental" ) );
  3417. resource.PushBack( (CJournalResource)LoadResource( "BestiaryWhMinion" ) );
  3418. GetWitcherPlayer().AddAlchemyRecipe('Recipe for Mutagen 20');
  3419. break;
  3420. case 'Necrophage vol 1':
  3421. resource.PushBack( (CJournalResource)LoadResource( "BestiaryGhoul" ) );
  3422. resource.PushBack( (CJournalResource)LoadResource( "BestiaryAlghoul" ) );
  3423. resource.PushBack( (CJournalResource)LoadResource( "BestiaryGreaterRotFiend" ) );
  3424. resource.PushBack( (CJournalResource)LoadResource( "BestiaryDrowner" ) );
  3425. GetWitcherPlayer().AddAlchemyRecipe('Recipe for Mutagen 15');
  3426. break;
  3427. case 'Necrophage vol 2':
  3428. resource.PushBack( (CJournalResource)LoadResource( "BestiaryGraveHag" ) );
  3429. resource.PushBack( (CJournalResource)LoadResource( "BestiaryWaterHag" ) );
  3430. resource.PushBack( (CJournalResource)LoadResource( "BestiaryFogling" ) );
  3431. GetWitcherPlayer().AddAlchemyRecipe('Recipe for Mutagen 5');
  3432. GetWitcherPlayer().AddAlchemyRecipe('Recipe for Mutagen 9');
  3433. GetWitcherPlayer().AddAlchemyRecipe('Recipe for Mutagen 18');
  3434. break;
  3435. case 'Relict Monsters vol 1':
  3436. resource.PushBack( (CJournalResource)LoadResource( "BestiaryBies" ) );
  3437. resource.PushBack( (CJournalResource)LoadResource( "BestiaryCzart" ) );
  3438. GetWitcherPlayer().AddAlchemyRecipe('Recipe for Mutagen 8');
  3439. GetWitcherPlayer().AddAlchemyRecipe('Recipe for Mutagen 16');
  3440. break;
  3441. case 'Relict Monsters vol 2':
  3442. resource.PushBack( (CJournalResource)LoadResource( "BestiaryLeshy" ) );
  3443. resource.PushBack( (CJournalResource)LoadResource( "BestiarySilvan" ) );
  3444. GetWitcherPlayer().AddAlchemyRecipe('Recipe for Mutagen 22');
  3445. GetWitcherPlayer().AddAlchemyRecipe('Recipe for Mutagen 26');
  3446. break;
  3447. case 'Specters vol 1':
  3448. resource.PushBack( (CJournalResource)LoadResource( "BestiaryMoonwright" ) );
  3449. resource.PushBack( (CJournalResource)LoadResource( "BestiaryNoonwright" ) );
  3450. resource.PushBack( (CJournalResource)LoadResource( "BestiaryPesta" ) );
  3451. GetWitcherPlayer().AddAlchemyRecipe('Recipe for Mutagen 6');
  3452. GetWitcherPlayer().AddAlchemyRecipe('Recipe for Mutagen 13');
  3453. break;
  3454. case 'Specters vol 2':
  3455. resource.PushBack( (CJournalResource)LoadResource( "BestiaryWraith" ) );
  3456. resource.PushBack( (CJournalResource)LoadResource( "BestiaryHim" ) );
  3457. GetWitcherPlayer().AddAlchemyRecipe('Recipe for Mutagen 19');
  3458. break;
  3459. case 'Ogres vol 1':
  3460. resource.PushBack( (CJournalResource)LoadResource( "BestiaryNekker" ) );
  3461. resource.PushBack( (CJournalResource)LoadResource( "BestiaryIceTroll" ) );
  3462. resource.PushBack( (CJournalResource)LoadResource( "BestiaryCaveTroll" ) );
  3463. GetWitcherPlayer().AddAlchemyRecipe('Recipe for Mutagen 12');
  3464. GetWitcherPlayer().AddAlchemyRecipe('Recipe for Mutagen 25');
  3465. break;
  3466. case 'Ogres vol 2':
  3467. resource.PushBack( (CJournalResource)LoadResource( "BestiaryCyclop" ) );
  3468. resource.PushBack( (CJournalResource)LoadResource( "BestiaryIceGiant" ) );
  3469. break;
  3470. case 'Vampires vol 1':
  3471. resource.PushBack( (CJournalResource)LoadResource( "BestiaryEkkima" ) );
  3472. resource.PushBack( (CJournalResource)LoadResource( "BestiaryHigherVampire" ) );
  3473. GetWitcherPlayer().AddAlchemyRecipe('Recipe for Mutagen 7');
  3474. thePlayer.inv.AddAnItem( 'w3glossary_higher_vampires', 1 );//===modWitcherLoreCollection===
  3475. break;
  3476. case 'Vampires vol 2':
  3477. resource.PushBack( (CJournalResource)LoadResource( "BestiaryKatakan" ) );
  3478. GetWitcherPlayer().AddAlchemyRecipe('Recipe for Mutagen 1');
  3479. break;
  3480.  
  3481. //---===modWitcherLoreCollection===---//
  3482. case 'sus_scrofa_nordlinga':
  3483. resource.PushBack( (CJournalResource)LoadResource( "BestiaryBoar" ) );
  3484. break;
  3485. case 'arachnomorphs_facts_and_myths':
  3486. resource.PushBack( (CJournalResource)LoadResource( "BestiarySpider" ) );
  3487. break;
  3488. //---===modWitcherLoreCollection===---//
  3489.  
  3490. case 'bestiary_sharley_book':
  3491. resource.PushBack( (CJournalResource)LoadResource( "BestiarySharley" ) );
  3492. break;
  3493. case 'bestiary_barghest_book':
  3494. resource.PushBack( (CJournalResource)LoadResource( "BestiaryBarghest" ) );
  3495. break;
  3496. case 'bestiary_garkain_book':
  3497. resource.PushBack( (CJournalResource)LoadResource( "BestiaryGarkain" ) );
  3498. break;
  3499. case 'bestiary_alp_book':
  3500. resource.PushBack( (CJournalResource)LoadResource( "BestiaryAlp" ) );
  3501. break;
  3502. case 'bestiary_bruxa_book':
  3503. resource.PushBack( (CJournalResource)LoadResource( "BestiaryBruxa" ) );
  3504. break;
  3505. case 'bestiary_spriggan_book':
  3506. resource.PushBack( (CJournalResource)LoadResource( "BestiarySpriggan" ) );
  3507. break;
  3508. case 'bestiary_fleder_book':
  3509. resource.PushBack( (CJournalResource)LoadResource( "BestiaryFleder" ) );
  3510. break;
  3511. case 'bestiary_wight_book':
  3512. resource.PushBack( (CJournalResource)LoadResource( "BestiaryWicht" ) );
  3513. break;
  3514. case 'bestiary_dracolizard_book':
  3515. resource.PushBack( (CJournalResource)LoadResource( "BestiaryDracolizard" ) );
  3516. break;
  3517. case 'bestiary_panther_book':
  3518. resource.PushBack( (CJournalResource)LoadResource( "BestiaryPanther" ) );
  3519. break;
  3520. case 'bestiary_kikimore_book':
  3521. resource.PushBack( (CJournalResource)LoadResource( "BestiaryKikimoraWarrior" ) );
  3522. resource.PushBack( (CJournalResource)LoadResource( "BestiaryKikimoraWorker" ) );
  3523. break;
  3524. case 'bestiary_scolopendromorph_book':
  3525. case 'mq7023_fluff_book_scolopendromorphs':
  3526. resource.PushBack( (CJournalResource)LoadResource( "BestiaryScolopendromorph" ) );
  3527. break;
  3528. case 'bestiary_archespore_book':
  3529. resource.PushBack( (CJournalResource)LoadResource( "BestiaryArchespore" ) );
  3530. break;
  3531. case 'bestiary_protofleder_book':
  3532. resource.PushBack( (CJournalResource)LoadResource( "BestiaryProtofleder" ) );
  3533. break;
  3534.  
  3535. //---===modWitcherLoreCollection===---//
  3536. case 'lore_witchers':
  3537. thePlayer.inv.AddAnItem( 'w3glossary_witchers', 1 );
  3538. break;
  3539. case 'lore_fate_of_temeria':
  3540. thePlayer.inv.AddAnItem( 'w3glossary_temeria', 1 );
  3541. break;
  3542. case 'lore_redania':
  3543. thePlayer.inv.AddAnItem( 'w3glossary_redania', 1 );
  3544. thePlayer.inv.AddAnItem( 'w3glossary_kaedwen', 1 );
  3545. break;
  3546. case 'lore_nilfgaardian_empire':
  3547. thePlayer.inv.AddAnItem( 'w3glossary_nilfgaard', 1 );
  3548. break;
  3549. case 'lore_kovir':
  3550. thePlayer.inv.AddAnItem( 'w3glossary_kovir', 1 );
  3551. break;
  3552. case 'lore_principles_of_eternal_fire':
  3553. thePlayer.inv.AddAnItem( 'w3glossary_cult_of_the_eternal_fire', 1 );
  3554. break;
  3555. case 'lore_lodge_of_sorceresses':
  3556. thePlayer.inv.AddAnItem( 'w3glossary_lodge_of_sorceresses', 1 );
  3557. break;
  3558. case 'lore_non_humans':
  3559. thePlayer.inv.AddAnItem( 'w3glossary_dwarves', 1 );
  3560. thePlayer.inv.AddAnItem( 'w3glossary_halflings', 1 );
  3561. thePlayer.inv.AddAnItem( 'w3glossary_mahakam', 1 );
  3562. thePlayer.inv.AddAnItem( 'w3glossary_scoiatael', 1 );
  3563. break;
  3564. case 'lore_cult_of_freyia':
  3565. thePlayer.inv.AddAnItem( 'w3glossary_cult_of_freya', 1 );
  3566. break;
  3567. case 'q201_poisoned_source':
  3568. thePlayer.inv.AddAnItem( 'w3glossary_source', 1 );
  3569. break;
  3570. case 'lore_conjunction_of_spheres':
  3571. thePlayer.inv.AddAnItem( 'w3glossary_conjunction_of_the_spheres', 1 );
  3572. break;
  3573. case 'lore_an_seidhe_and_aen_elle':
  3574. thePlayer.inv.AddAnItem( 'w3glossary_aen_elle', 1 );
  3575. thePlayer.inv.AddAnItem( 'w3glossary_aen_seidhe', 1 );
  3576. thePlayer.inv.AddAnItem( 'w3glossary_dol_blathanna', 1 );
  3577. break;
  3578. case 'lore_wild_hunt':
  3579. thePlayer.inv.AddAnItem( 'w3glossary_wild_hunt', 1 );
  3580. break;
  3581. case 'lore_skellige_island':
  3582. thePlayer.inv.AddAnItem( 'w3glossary_skellige', 1 );
  3583. break;
  3584. case 'Theatre Glossary vol 2':
  3585. thePlayer.inv.AddAnItem( 'w3glossary_cintra', 1 );
  3586. break;
  3587. case 'lore_velen':
  3588. thePlayer.inv.AddAnItem( 'w3glossary_velen', 1 );
  3589. break;
  3590. case 'lore_bells_of_beauclair':
  3591. thePlayer.inv.AddAnItem( 'w3glossary_toussaint', 1 );
  3592. break;
  3593. case 'lore_sands_of_zerrikania':
  3594. thePlayer.inv.AddAnItem( 'w3glossary_zerrikania', 1 );
  3595. break;
  3596. case 'lore_summit_of_loc_muinne':
  3597. thePlayer.inv.AddAnItem( 'w3glossary_loc_muinne', 1 );
  3598. break;
  3599. case 'lore_basics_of_magic':
  3600. thePlayer.inv.AddAnItem( 'w3glossary_magic', 1 );
  3601. break;
  3602. case 'lore_study_on_white_cold':
  3603. thePlayer.inv.AddAnItem( 'w3glossary_white_frost', 1 );
  3604. break;
  3605. case 'lore_elder_blood':
  3606. thePlayer.inv.AddAnItem( 'w3glossary_elder_blood', 1 );
  3607. break;
  3608. case 'lore_elven_sages':
  3609. thePlayer.inv.AddAnItem( 'w3glossary_sages', 1 );
  3610. break;
  3611. case 'lore_cult_of_hemdall':
  3612. thePlayer.inv.AddAnItem( 'w3glossary_ragh_nar_roog', 1 );
  3613. break;
  3614. case 'lore_novigrad':
  3615. thePlayer.inv.AddAnItem( 'w3glossary_novigrad', 1 );
  3616. break;
  3617. case 'lore_oxenfurt':
  3618. thePlayer.inv.AddAnItem( 'w3glossary_oxenfurt', 1 );
  3619. break;
  3620. case 'lore_theory_of_spheres':
  3621. thePlayer.inv.AddAnItem( 'w3glossary_other_worlds', 1 );
  3622. break;
  3623. case 'lore_witch_hunters':
  3624. thePlayer.inv.AddAnItem( 'w3glossary_witch_hunters', 1 );
  3625. break;
  3626. case 'w1_master_book':
  3627. w1MasterBook();
  3628. break;
  3629. case 'w2_master_book':
  3630. w2MasterBook();
  3631. break;
  3632. //---===modWitcherLoreCollection===---//
  3633.  
  3634. default:
  3635. return false;
  3636. }
  3637.  
  3638.  
  3639.  
  3640.  
  3641. len = resource.Size();
  3642. if( len > 0)
  3643. {
  3644.  
  3645. theGame.GetGuiManager().ShowNotification( GetLocStringByKeyExt( "panel_hud_journal_entry_bestiary_new" ), 0, true );
  3646. theSound.SoundEvent("gui_ingame_new_journal");
  3647. }
  3648.  
  3649. for (r=0; r < len; r += 1 )
  3650. {
  3651. if ( !resource[ r ] )
  3652. {
  3653.  
  3654. continue;
  3655. }
  3656. entryBase = resource[r].GetEntry();
  3657. if ( entryBase )
  3658. {
  3659. manager.ActivateEntry( entryBase, JS_Active );
  3660. manager.SetEntryHasAdvancedInfo( entryBase, true );
  3661.  
  3662.  
  3663. manager.GetAllChildren( entryBase, childGroups );
  3664. for ( i = 0; i < childGroups.Size(); i += 1 )
  3665. {
  3666. descriptionGroup = ( CJournalCreatureDescriptionGroup )childGroups[ i ];
  3667. if ( descriptionGroup )
  3668. {
  3669. manager.GetAllChildren( descriptionGroup, childEntries );
  3670. for ( j = 0; j < childEntries.Size(); j += 1 )
  3671. {
  3672. descriptionEntry = ( CJournalCreatureDescriptionEntry )childEntries[ j ];
  3673. if ( descriptionEntry )
  3674. {
  3675. manager.ActivateEntry( descriptionEntry, JS_Active );
  3676. }
  3677. }
  3678. break;
  3679. }
  3680. }
  3681. }
  3682. }
  3683.  
  3684. if ( resource.Size() > 0 )
  3685. return true;
  3686. else
  3687. return false;
  3688. }
  3689.  
  3690.  
  3691.  
  3692.  
  3693.  
  3694.  
  3695.  
  3696.  
  3697. function GetWeaponDTNames( id : SItemUniqueId, out dmgNames : array< name > ) : int
  3698. {
  3699. var attrs : array< name >;
  3700. var i, size : int;
  3701.  
  3702. dmgNames.Clear();
  3703.  
  3704. if( IsIdValid(id) )
  3705. {
  3706. GetItemAttributes( id, attrs );
  3707. size = attrs.Size();
  3708.  
  3709. for( i = 0; i < size; i += 1 )
  3710. if( IsDamageTypeNameValid(attrs[i]) )
  3711. dmgNames.PushBack( attrs[i] );
  3712.  
  3713. if(dmgNames.Size() == 0)
  3714. LogAssert(false, "CInventoryComponent.GetWeaponDTNames: weapon <<" + GetItemName(id) + ">> has no damage types defined!");
  3715. }
  3716. return dmgNames.Size();
  3717. }
  3718.  
  3719. public function GetWeapons() : array<SItemUniqueId>
  3720. {
  3721. var ids, ids2 : array<SItemUniqueId>;
  3722.  
  3723. ids = GetItemsByCategory('monster_weapon');
  3724. ids2 = GetItemsByTag('Weapon');
  3725. ArrayOfIdsAppend(ids, ids2);
  3726.  
  3727. return ids;
  3728. }
  3729.  
  3730. public function GetHeldWeapons() : array<SItemUniqueId>
  3731. {
  3732. var i : int;
  3733. var w : array<SItemUniqueId>;
  3734.  
  3735. w = GetWeapons();
  3736.  
  3737. for(i=w.Size()-1; i>=0; i-=1)
  3738. {
  3739. if(!IsItemHeld(w[i]))
  3740. {
  3741. w.EraseFast( i );
  3742. }
  3743. }
  3744.  
  3745. return w;
  3746. }
  3747.  
  3748. public function GetCurrentlyHeldWeapon() : SItemUniqueId
  3749. {
  3750. var w : array<SItemUniqueId> = GetHeldWeapons();
  3751.  
  3752. return w[0];
  3753. }
  3754.  
  3755. public function GetCurrentlyHeldSword() : SItemUniqueId
  3756. {
  3757. var i : int;
  3758. var w : array<SItemUniqueId>;
  3759.  
  3760. w = GetHeldWeapons();
  3761.  
  3762. for( i = 0 ; i < w.Size() ; i+=1 )
  3763. {
  3764. if( IsItemSteelSwordUsableByPlayer( w[i] ) || IsItemSilverSwordUsableByPlayer( w[i] ) )
  3765. {
  3766. return w[i];
  3767. }
  3768. }
  3769.  
  3770. return GetInvalidUniqueId();
  3771. }
  3772.  
  3773. public function GetCurrentlyHeldSwordEntity( out ent : CItemEntity ) : bool
  3774. {
  3775. var id : SItemUniqueId;
  3776.  
  3777. id = GetCurrentlyHeldSword();
  3778.  
  3779. if( IsIdValid( id ) )
  3780. {
  3781. ent = GetItemEntityUnsafe( id );
  3782.  
  3783. if( ent )
  3784. {
  3785. return true;
  3786. }
  3787. else
  3788. {
  3789. return false;
  3790. }
  3791. }
  3792. return false;
  3793. }
  3794.  
  3795. public function GetHeldWeaponsWithCategory( category : name, out items : array<SItemUniqueId> )
  3796. {
  3797. var i : int;
  3798.  
  3799. items = GetItemsByCategory( category );
  3800.  
  3801. for ( i = items.Size()-1; i >= 0; i -= 1)
  3802. {
  3803. if ( !IsItemHeld( items[i] ) )
  3804. {
  3805. items.EraseFast( i );
  3806. }
  3807. }
  3808. }
  3809.  
  3810. public function GetPotionItemBuffData(id : SItemUniqueId, out type : EEffectType, out customAbilityName : name) : bool
  3811. {
  3812. var size, i : int;
  3813. var arr : array<name>;
  3814.  
  3815. if(IsIdValid(id))
  3816. {
  3817. GetItemContainedAbilities( id, arr );
  3818. size = arr.Size();
  3819.  
  3820. for( i = 0; i < size; i += 1 )
  3821. {
  3822. if( IsEffectNameValid(arr[i]) )
  3823. {
  3824. EffectNameToType(arr[i], type, customAbilityName);
  3825. return true;
  3826. }
  3827. }
  3828. }
  3829.  
  3830. return false;
  3831. }
  3832.  
  3833.  
  3834. public function RecycleItem( id : SItemUniqueId, level : ECraftsmanLevel ) : array<SItemUniqueId>
  3835. {
  3836. var itemsAdded : array<SItemUniqueId>;
  3837. var currentAdded : array<SItemUniqueId>;
  3838.  
  3839. var parts : array<SItemParts>;
  3840. var i : int;
  3841.  
  3842. parts = GetItemRecyclingParts( id );
  3843.  
  3844. for ( i = 0; i < parts.Size(); i += 1 )
  3845. {
  3846. if ( ECL_Grand_Master == level || ECL_Arch_Master == level )
  3847. {
  3848. if( !((GetItemName(id) == 'Shell' || GetItemName(id) == 'Seashell') && RandF() < 0.9) )
  3849. currentAdded = AddAnItem( parts[i].itemName, parts[i].quantity );
  3850. }
  3851. else if ( ECL_Master == level && parts[i].quantity > 1 )
  3852. {
  3853. if( !((GetItemName(id) == 'Shell' || GetItemName(id) == 'Seashell') && RandF() < 0.9) )
  3854. currentAdded = AddAnItem( parts[i].itemName, parts[i].quantity );
  3855. }
  3856. else
  3857. {
  3858. if( !((GetItemName(id) == 'Shell' || GetItemName(id) == 'Seashell') && RandF() < 0.9) )
  3859. currentAdded = AddAnItem( parts[i].itemName, parts[i].quantity );
  3860. }
  3861. itemsAdded.PushBack(currentAdded[0]);
  3862. }
  3863.  
  3864. RemoveItem(id);
  3865.  
  3866. return itemsAdded;
  3867. }
  3868.  
  3869.  
  3870.  
  3871.  
  3872.  
  3873.  
  3874. public function GetItemBuffs( id : SItemUniqueId, out buffs : array<SEffectInfo>) : int
  3875. {
  3876. var attrs, abs, absFast : array< name >;
  3877. var i, k : int;
  3878. var type : EEffectType;
  3879. var abilityName : name;
  3880. var buff : SEffectInfo;
  3881. var dm : CDefinitionsManagerAccessor;
  3882.  
  3883. buffs.Clear();
  3884.  
  3885. if( !IsIdValid(id) )
  3886. return 0;
  3887.  
  3888.  
  3889. GetItemContainedAbilities(id, absFast);
  3890. if(absFast.Size() == 0)
  3891. return 0;
  3892.  
  3893. GetItemAbilities(id, abs);
  3894. dm = theGame.GetDefinitionsManager();
  3895. for(k=0; k<abs.Size(); k+=1)
  3896. {
  3897. dm.GetContainedAbilities(abs[k], attrs);
  3898. buff.applyChance = CalculateAttributeValue(GetItemAbilityAttributeValue(id, 'buff_apply_chance', abs[k])) * ArrayOfNamesCount(abs, abs[k]);
  3899.  
  3900. for( i = 0; i < attrs.Size(); i += 1 )
  3901. {
  3902. if( IsEffectNameValid(attrs[i]) )
  3903. {
  3904. EffectNameToType(attrs[i], type, abilityName);
  3905.  
  3906. buff.effectType = type;
  3907. buff.effectAbilityName = abilityName;
  3908.  
  3909. buffs.PushBack(buff);
  3910.  
  3911.  
  3912. if(absFast.Size() == 1)
  3913. return buffs.Size();
  3914. else
  3915. absFast.EraseFast(0);
  3916. }
  3917. }
  3918. }
  3919.  
  3920. return buffs.Size();
  3921. }
  3922.  
  3923.  
  3924. public function DropItemInBag( item : SItemUniqueId, quantity : int )
  3925. {
  3926. var entities : array<CGameplayEntity>;
  3927. var i : int;
  3928. var owner : CActor;
  3929. var bag : W3ActorRemains;
  3930. var template : CEntityTemplate;
  3931. var bagtags : array <name>;
  3932. var bagPosition : Vector;
  3933. var tracedPosition, tracedNormal : Vector;
  3934.  
  3935. //Kolaris - Inventory Options
  3936. if(ItemHasTag(item, 'NoDrop') && !(Options().DropQuestItems()))
  3937. return;
  3938.  
  3939. if(Options().DeleteDroppedItems())
  3940. {
  3941. RemoveItem(item, quantity);
  3942. return;
  3943. }
  3944.  
  3945. owner = (CActor)GetEntity();
  3946. FindGameplayEntitiesInRange(entities, owner, 0.5, 100);
  3947.  
  3948. for(i=0; i<entities.Size(); i+=1)
  3949. {
  3950. bag = (W3ActorRemains)entities[i];
  3951.  
  3952. if(bag)
  3953. break;
  3954. }
  3955.  
  3956.  
  3957. if(!bag)
  3958. {
  3959. template = (CEntityTemplate)LoadResource("lootbag");
  3960. bagtags.PushBack('lootbag');
  3961.  
  3962.  
  3963. bagPosition = owner.GetWorldPosition();
  3964. if ( theGame.GetWorld().StaticTrace( bagPosition, bagPosition + Vector( 0.0f, 0.0f, -10.0f, 0.0f ), tracedPosition, tracedNormal ) )
  3965. {
  3966. bagPosition = tracedPosition;
  3967. }
  3968. bag = (W3ActorRemains)theGame.CreateEntity(template, bagPosition, owner.GetWorldRotation(), true, false, false, PM_Persist,bagtags);
  3969. }
  3970.  
  3971.  
  3972. GiveItemTo(bag.GetInventory(), item, quantity, false);
  3973.  
  3974.  
  3975. if(bag.GetInventory().IsEmpty())
  3976. {
  3977. delete bag;
  3978. return;
  3979. }
  3980.  
  3981. bag.LootDropped();
  3982. theTelemetry.LogWithLabelAndValue(TE_INV_ITEM_DROPPED, GetItemName(item), quantity);
  3983.  
  3984.  
  3985. if( thePlayer.IsSwimming() )
  3986. {
  3987. bag.PlayPropertyAnimation( 'float', 0 );
  3988. }
  3989. }
  3990.  
  3991. public function HorseDropItemInBag( item : SItemUniqueId, quantity : int )
  3992. {
  3993. var entities : array<CGameplayEntity>;
  3994. var i : int;
  3995. var owner : CActor;
  3996. var bag : W3ActorRemains;
  3997. var template : CEntityTemplate;
  3998. var bagtags : array <name>;
  3999. var bagPosition : Vector;
  4000. var tracedPosition, tracedNormal : Vector;
  4001.  
  4002. //Kolaris - Inventory Options
  4003. if(ItemHasTag(item, 'NoDrop') && !(Options().DropQuestItems()))
  4004. return;
  4005.  
  4006. if(Options().DeleteDroppedItems())
  4007. {
  4008. RemoveItem(item, quantity);
  4009. return;
  4010. }
  4011.  
  4012. owner = thePlayer;
  4013. FindGameplayEntitiesInRange(entities, owner, 0.5, 100);
  4014. for(i=0; i<entities.Size(); i+=1)
  4015. {
  4016. bag = (W3ActorRemains)entities[i];
  4017.  
  4018. if(bag)
  4019. break;
  4020. }
  4021.  
  4022. if(!bag)
  4023. {
  4024. template = (CEntityTemplate)LoadResource("lootbag");
  4025. bagtags.PushBack('lootbag');
  4026.  
  4027.  
  4028. bagPosition = owner.GetWorldPosition();
  4029. if ( theGame.GetWorld().StaticTrace( bagPosition, bagPosition + Vector( 0.0f, 0.0f, -10.0f, 0.0f ), tracedPosition, tracedNormal ) )
  4030. {
  4031. bagPosition = tracedPosition;
  4032. }
  4033. bag = (W3ActorRemains)theGame.CreateEntity(template, bagPosition, owner.GetWorldRotation(), true, false, false, PM_Persist,bagtags);
  4034. }
  4035.  
  4036. GiveItemTo(bag.GetInventory(), item, quantity, false);
  4037. if( bag.GetInventory().IsEmpty() )
  4038. {
  4039. delete bag;
  4040. return;
  4041. }
  4042.  
  4043. bag.LootDropped();
  4044. theTelemetry.LogWithLabelAndValue(TE_INV_ITEM_DROPPED, GetItemName(item), quantity);
  4045. if( thePlayer.IsSwimming() )
  4046. {
  4047. bag.PlayPropertyAnimation( 'float', 0 );
  4048. }
  4049. }
  4050.  
  4051.  
  4052.  
  4053.  
  4054.  
  4055.  
  4056. public final function AddRepairObjectItemBonuses(buffArmor : bool, buffSwords : bool, ammoArmor : int, ammoWeapon : int) : bool
  4057. {
  4058. var upgradedSomething, isArmor : bool;
  4059. var i, ammo, currAmmo : int;
  4060. var items, items2 : array<SItemUniqueId>;
  4061.  
  4062.  
  4063. if(buffArmor)
  4064. {
  4065. items = GetItemsByTag(theGame.params.TAG_ARMOR);
  4066. }
  4067. if(buffSwords)
  4068. {
  4069. items2 = GetItemsByTag(theGame.params.TAG_PLAYER_STEELSWORD);
  4070. ArrayOfIdsAppend(items, items2);
  4071. items2.Clear();
  4072. items2 = GetItemsByTag(theGame.params.TAG_PLAYER_SILVERSWORD);
  4073. ArrayOfIdsAppend(items, items2);
  4074. }
  4075.  
  4076. upgradedSomething = false;
  4077.  
  4078. for(i=0; i<items.Size(); i+=1)
  4079. {
  4080.  
  4081. if(IsItemAnyArmor(items[i]))
  4082. {
  4083. isArmor = true;
  4084. ammo = ammoArmor;
  4085. }
  4086. else
  4087. {
  4088. isArmor = false;
  4089. ammo = ammoWeapon;
  4090. }
  4091.  
  4092.  
  4093. currAmmo = GetItemModifierInt(items[i], 'repairObjectBonusAmmo', 0);
  4094.  
  4095.  
  4096. if(ammo > currAmmo)
  4097. {
  4098. SetItemModifierInt(items[i], 'repairObjectBonusAmmo', ammo);
  4099. upgradedSomething = true;
  4100.  
  4101.  
  4102. if(currAmmo == 0)
  4103. {
  4104. if(isArmor)
  4105. AddItemCraftedAbility(items[i], theGame.params.REPAIR_OBJECT_BONUS_ARMOR_ABILITY, false);
  4106. else
  4107. AddItemCraftedAbility(items[i], theGame.params.REPAIR_OBJECT_BONUS_WEAPON_ABILITY, false);
  4108. }
  4109. }
  4110. }
  4111.  
  4112. return upgradedSomething;
  4113. }
  4114.  
  4115. public final function ReduceItemRepairObjectBonusCharge(item : SItemUniqueId)
  4116. {
  4117. var currAmmo : int;
  4118.  
  4119. currAmmo = GetItemModifierInt(item, 'repairObjectBonusAmmo', 0);
  4120.  
  4121. if(currAmmo > 0)
  4122. {
  4123. SetItemModifierInt(item, 'repairObjectBonusAmmo', currAmmo - 1);
  4124.  
  4125. if(currAmmo == 1)
  4126. {
  4127. if(IsItemAnyArmor(item))
  4128. RemoveItemCraftedAbility(item, theGame.params.REPAIR_OBJECT_BONUS_ARMOR_ABILITY);
  4129. else
  4130. RemoveItemCraftedAbility(item, theGame.params.REPAIR_OBJECT_BONUS_WEAPON_ABILITY);
  4131. }
  4132. }
  4133. }
  4134.  
  4135.  
  4136. public final function GetRepairObjectBonusValueForArmor(armor : SItemUniqueId) : SAbilityAttributeValue
  4137. {
  4138. var retVal, bonusValue, baseArmor : SAbilityAttributeValue;
  4139.  
  4140. if(GetItemModifierInt(armor, 'repairObjectBonusAmmo', 0) > 0)
  4141. {
  4142. bonusValue = GetItemAttributeValue(armor, theGame.params.REPAIR_OBJECT_BONUS);
  4143. baseArmor = GetItemAttributeValue(armor, theGame.params.ARMOR_VALUE_NAME);
  4144.  
  4145. baseArmor.valueMultiplicative += 1;
  4146. retVal.valueAdditive = bonusValue.valueAdditive + CalculateAttributeValue(baseArmor) * bonusValue.valueMultiplicative;
  4147. }
  4148.  
  4149. return retVal;
  4150. }
  4151.  
  4152.  
  4153.  
  4154.  
  4155.  
  4156.  
  4157. public function CanItemHaveOil(id : SItemUniqueId) : bool
  4158. {
  4159. // W3EE - Begin
  4160. //return IsItemSteelSwordUsableByPlayer(id) || IsItemSilverSwordUsableByPlayer(id);
  4161. return GetItemCategory(id) == 'steelsword' || GetItemCategory(id) == 'silversword';
  4162. // W3EE - End
  4163. }
  4164.  
  4165. public final function RemoveAllOilsFromItem( id : SItemUniqueId )
  4166. {
  4167. var i : int;
  4168. var oils : array< W3Effect_Oil >;
  4169. var actor : CActor;
  4170.  
  4171. actor = ( CActor ) GetEntity();
  4172. oils = GetOilsAppliedOnItem( id );
  4173. for( i = oils.Size() - 1; i >= 0; i -= 1 )
  4174. {
  4175. actor.RemoveEffect( oils[ i ] );
  4176. }
  4177. }
  4178.  
  4179. public final function GetActiveOilsAppliedOnItemCount( id : SItemUniqueId ) : int
  4180. {
  4181. var oils : array< W3Effect_Oil >;
  4182. var i, count : int;
  4183.  
  4184. count = 0;
  4185. oils = GetOilsAppliedOnItem( id );
  4186. for( i=0; i<oils.Size(); i+=1 )
  4187. {
  4188. if( oils[ i ].GetAmmoCurrentCount() > 0 )
  4189. {
  4190. count += 1;
  4191. }
  4192. }
  4193.  
  4194. // W3EE - Begin
  4195. if( count <= 0 )
  4196. RemoveAllOilsFromItem(id);
  4197. // W3EE - End
  4198.  
  4199. return count;
  4200. }
  4201.  
  4202. public final function RemoveOldestOilFromItem( id : SItemUniqueId )
  4203. {
  4204. var buffToRemove : W3Effect_Oil;
  4205. var actor : CActor;
  4206.  
  4207. actor = ( CActor ) GetEntity();
  4208. if(! actor )
  4209. return;
  4210.  
  4211. buffToRemove = GetOldestOilAppliedOnItem(id, false);
  4212.  
  4213. if(buffToRemove)
  4214. {
  4215. actor.RemoveEffect( buffToRemove );
  4216. }
  4217. }
  4218.  
  4219. public final function GetOilsAppliedOnItem( id : SItemUniqueId ) : array< W3Effect_Oil >
  4220. {
  4221. var i : int;
  4222. var oils : array< CBaseGameplayEffect >;
  4223. var buff : W3Effect_Oil;
  4224. var ret : array < W3Effect_Oil >;
  4225. var actor : CActor;
  4226.  
  4227. actor = ( CActor ) GetEntity();
  4228. if(! actor )
  4229. return ret;
  4230.  
  4231. oils = actor.GetBuffs( EET_Oil );
  4232. for( i = oils.Size() - 1; i >= 0; i -= 1 )
  4233. {
  4234. buff = ( W3Effect_Oil ) oils[ i ];
  4235. if(buff && buff.GetSwordItemId() == id )
  4236. {
  4237. ret.PushBack( buff );
  4238. }
  4239. }
  4240.  
  4241. return ret;
  4242. }
  4243.  
  4244. public final function GetNewestOilAppliedOnItem( id : SItemUniqueId, onlyShowable : bool ) : W3Effect_Oil
  4245. {
  4246. return GetOilAppliedOnItemInternal( id, onlyShowable, true );
  4247. }
  4248.  
  4249. public final function GetOldestOilAppliedOnItem( id : SItemUniqueId, onlyShowable : bool ) : W3Effect_Oil
  4250. {
  4251. return GetOilAppliedOnItemInternal( id, onlyShowable, false );
  4252. }
  4253.  
  4254. private final function GetOilAppliedOnItemInternal( id : SItemUniqueId, onlyShowable : bool, newest : bool ) : W3Effect_Oil
  4255. {
  4256. var oils : array< W3Effect_Oil >;
  4257. var i, lastIndex : int;
  4258.  
  4259. oils = GetOilsAppliedOnItem( id );
  4260. lastIndex = -1;
  4261.  
  4262. for( i=0; i<oils.Size(); i+=1 )
  4263. {
  4264. if( onlyShowable && !oils[i].GetShowOnHUD() )
  4265. {
  4266. continue;
  4267. }
  4268.  
  4269. if( lastIndex == -1 )
  4270. {
  4271. lastIndex = i;
  4272. }
  4273. else if( newest && oils[i].GetQueueTimer() < oils[lastIndex].GetQueueTimer() )
  4274. {
  4275. lastIndex = i;
  4276. }
  4277. else if( !newest && oils[i].GetQueueTimer() > oils[lastIndex].GetQueueTimer() )
  4278. {
  4279. lastIndex = i;
  4280. }
  4281. }
  4282.  
  4283. if( lastIndex == -1 )
  4284. {
  4285. return NULL;
  4286. }
  4287.  
  4288. return oils[lastIndex];
  4289. }
  4290.  
  4291. public final function ItemHasAnyActiveOilApplied( id : SItemUniqueId ) : bool
  4292. {
  4293. return GetActiveOilsAppliedOnItemCount( id );
  4294. }
  4295.  
  4296. /*
  4297. public final function ItemHasActiveOilApplied( id : SItemUniqueId, monsterCategory : EMonsterCategory ) : bool
  4298. {
  4299. var i : int;
  4300. var oils : array< W3Effect_Oil >;
  4301.  
  4302. oils = GetOilsAppliedOnItem( id );
  4303. for( i=0; i<oils.Size(); i+=1 )
  4304. {
  4305. if( oils[ i ].GetMonsterCategory() == monsterCategory && oils[ i ].GetAmmoCurrentCount() > 0 )
  4306. {
  4307. return true;
  4308. }
  4309. }
  4310.  
  4311. return false;
  4312. }
  4313. */
  4314.  
  4315.  
  4316.  
  4317.  
  4318. public final function GetParamsForRunewordTooltip(runewordName : name, out i : array<int>, out f : array<float>, out s : array<string>)
  4319. {
  4320. var min, max, sp : SAbilityAttributeValue;
  4321. var val : float;
  4322. var attackRangeBase, attackRangeExt : CAIAttackRange;
  4323.  
  4324. i.Clear();
  4325. f.Clear();
  4326. s.Clear();
  4327.  
  4328. switch(runewordName)
  4329. {
  4330. // Kolaris - Enchantment Overhaul
  4331. //Disintegration
  4332. case 'Glyphword 1' :
  4333. i.PushBack( 5 );
  4334. i.PushBack( 100 );
  4335. break;
  4336. case 'Glyphword 2' :
  4337. i.PushBack( 5 );
  4338. i.PushBack( 200 );
  4339. break;
  4340. case 'Glyphword 3' :
  4341. i.PushBack( 25 );
  4342. i.PushBack( 1200 );
  4343. i.PushBack( 300 );
  4344. break;
  4345. //Acceleration
  4346. case 'Glyphword 4' :
  4347. i.PushBack( 30 );
  4348. i.PushBack( 2 );
  4349. i.PushBack( 5 );
  4350. break;
  4351. case 'Glyphword 5' :
  4352. i.PushBack( 10 );
  4353. i.PushBack( 10 );
  4354. break;
  4355. case 'Glyphword 6' :
  4356. i.PushBack( 15 );
  4357. break;
  4358. //Immolation
  4359. case 'Glyphword 7' :
  4360. i.PushBack( 50 );
  4361. i.PushBack( 10 );
  4362. break;
  4363. case 'Glyphword 8' :
  4364. i.PushBack( 20 );
  4365. i.PushBack( 20 );
  4366. break;
  4367. case 'Glyphword 9' :
  4368. i.PushBack( 5 );
  4369. i.PushBack( 30 );
  4370. break;
  4371. //Purgation
  4372. case 'Glyphword 10' :
  4373. i.PushBack( 100 );
  4374. break;
  4375. case 'Glyphword 11' :
  4376. i.PushBack( 1500 );
  4377. i.PushBack( 200 );
  4378. break;
  4379. case 'Glyphword 12' :
  4380. f.PushBack( 0.5f );
  4381. f.PushBack( 2.f );
  4382. i.PushBack( 300 );
  4383. break;
  4384. //Absorption
  4385. case 'Glyphword 13' :
  4386. i.PushBack( 1 );
  4387. break;
  4388. case 'Glyphword 14' :
  4389. i.PushBack( 2 );
  4390. break;
  4391. case 'Glyphword 15' :
  4392. i.PushBack( 3 );
  4393. break;
  4394. //Enervation
  4395. case 'Glyphword 16' :
  4396. i.PushBack( 10 );
  4397. i.PushBack( 25 );
  4398. i.PushBack( 1 );
  4399. break;
  4400. case 'Glyphword 17' :
  4401. f.PushBack( 0.5f );
  4402. i.PushBack( 2 );
  4403. i.PushBack( 2 );
  4404. break;
  4405. case 'Glyphword 18' :
  4406. f.PushBack( 0.5f );
  4407. i.PushBack( 3 );
  4408. break;
  4409. //Retribution
  4410. case 'Glyphword 19' :
  4411. i.PushBack( 1000 );
  4412. i.PushBack( 10 );
  4413. break;
  4414. case 'Glyphword 20' :
  4415. i.PushBack( 20 );
  4416. break;
  4417. case 'Glyphword 21' :
  4418. i.PushBack( 1000 );
  4419. i.PushBack( 30 );
  4420. break;
  4421. //Bastion
  4422. case 'Glyphword 22' :
  4423. i.PushBack( 50 );
  4424. i.PushBack( 10 );
  4425. break;
  4426. case 'Glyphword 23' :
  4427. i.PushBack( 200 );
  4428. i.PushBack( 20 );
  4429. break;
  4430. case 'Glyphword 24' :
  4431. i.PushBack( 50 );
  4432. i.PushBack( 30 );
  4433. break;
  4434. //Conjunction
  4435. case 'Glyphword 25' :
  4436. i.PushBack( 5 );
  4437. break;
  4438. case 'Glyphword 26' :
  4439. i.PushBack( 10 );
  4440. break;
  4441. case 'Glyphword 27' :
  4442. i.PushBack( 15 );
  4443. break;
  4444. //Posession
  4445. case 'Glyphword 28' :
  4446. i.PushBack( 10000 );
  4447. i.PushBack( 10 );
  4448. break;
  4449. case 'Glyphword 29' :
  4450. i.PushBack( 50 );
  4451. i.PushBack( 20 );
  4452. break;
  4453. case 'Glyphword 30' :
  4454. i.PushBack( 30 );
  4455. break;
  4456. //Protection
  4457. case 'Glyphword 31' :
  4458. i.PushBack( 300 );
  4459. i.PushBack( 10 );
  4460. break;
  4461. case 'Glyphword 32' :
  4462. i.PushBack( 20 );
  4463. break;
  4464. case 'Glyphword 33' :
  4465. i.PushBack( 30 );
  4466. break;
  4467. //Deflection
  4468. case 'Glyphword 34' :
  4469. i.PushBack( 100 );
  4470. break;
  4471. case 'Glyphword 35' :
  4472. i.PushBack( 200 );
  4473. break;
  4474. case 'Glyphword 36' :
  4475. i.PushBack( 300 );
  4476. break;
  4477. //Regeneration
  4478. case 'Glyphword 37' :
  4479. i.PushBack( 5 );
  4480. break;
  4481. case 'Glyphword 38' :
  4482. i.PushBack( 50 );
  4483. i.PushBack( 10 );
  4484. break;
  4485. case 'Glyphword 39' :
  4486. i.PushBack( 10 );
  4487. i.PushBack( 15 );
  4488. break;
  4489. //Perfection
  4490. case 'Glyphword 40' :
  4491. i.PushBack( 500 );
  4492. break;
  4493. case 'Glyphword 41' :
  4494. i.PushBack( 5 );
  4495. i.PushBack( 1000 );
  4496. break;
  4497. case 'Glyphword 42' :
  4498. i.PushBack( 1 );
  4499. i.PushBack( 10 );
  4500. i.PushBack( 1 );
  4501. i.PushBack( 100 );
  4502. i.PushBack( 1500 );
  4503. break;
  4504. //Constitution
  4505. case 'Glyphword 43' :
  4506. i.PushBack( 20 );
  4507. i.PushBack( 200 );
  4508. i.PushBack( 20 );
  4509. i.PushBack( 10 );
  4510. break;
  4511. case 'Glyphword 44' :
  4512. i.PushBack( 20 );
  4513. i.PushBack( 2 );
  4514. i.PushBack( 20 );
  4515. i.PushBack( 20 );
  4516. break;
  4517. case 'Glyphword 45' :
  4518. i.PushBack( 1 );
  4519. i.PushBack( 500 );
  4520. i.PushBack( 50 );
  4521. i.PushBack( 30 );
  4522. break;
  4523. //Assimilation
  4524. case 'Glyphword 46' :
  4525. i.PushBack( 50 );
  4526. i.PushBack( 10 );
  4527. break;
  4528. case 'Glyphword 47' :
  4529. i.PushBack( 20 );
  4530. i.PushBack( 2 );
  4531. i.PushBack( 20 );
  4532. i.PushBack( 20 );
  4533. break;
  4534. case 'Glyphword 48' :
  4535. i.PushBack( 5 );
  4536. i.PushBack( 30 );
  4537. break;
  4538. //Elation
  4539. case 'Glyphword 49' :
  4540. i.PushBack( 20 );
  4541. i.PushBack( 15 );
  4542. i.PushBack( 10 );
  4543. break;
  4544. case 'Glyphword 50' :
  4545. i.PushBack( 50 );
  4546. i.PushBack( 20 );
  4547. break;
  4548. case 'Glyphword 51' :
  4549. i.PushBack( 30 );
  4550. break;
  4551. //Conservation
  4552. case 'Glyphword 52' :
  4553. i.PushBack( 1 );
  4554. i.PushBack( RoundMath(50 * Options().StamCostGlobal()) );
  4555. i.PushBack( 5 );
  4556. break;
  4557. case 'Glyphword 53' :
  4558. i.PushBack( 50 );
  4559. i.PushBack( 10 );
  4560. break;
  4561. case 'Glyphword 54' :
  4562. i.PushBack( 25 );
  4563. i.PushBack( 50 );
  4564. i.PushBack( 15 );
  4565. break;
  4566.  
  4567. //Glaciation
  4568. case 'Runeword 1' :
  4569. i.PushBack( 5 );
  4570. break;
  4571. case 'Runeword 2' :
  4572. i.PushBack( 10 );
  4573. break;
  4574. case 'Runeword 3' :
  4575. i.PushBack( 50 );
  4576. i.PushBack( 15 );
  4577. break;
  4578. //Exhaustion
  4579. case 'Runeword 4' :
  4580. i.PushBack( 10 );
  4581. i.PushBack( 1 );
  4582. i.PushBack( 5 );
  4583. break;
  4584. case 'Runeword 5' :
  4585. i.PushBack( 40 );
  4586. i.PushBack( 10 );
  4587. break;
  4588. case 'Runeword 6' :
  4589. i.PushBack( 1 );
  4590. i.PushBack( 15 );
  4591. break;
  4592. //Obliteration
  4593. case 'Runeword 7' :
  4594. i.PushBack( 20 );
  4595. i.PushBack( 50 );
  4596. break;
  4597. case 'Runeword 8' :
  4598. i.PushBack( 1 );
  4599. i.PushBack( 1 );
  4600. i.PushBack( 100 );
  4601. break;
  4602. case 'Runeword 9' :
  4603. i.PushBack( 5 );
  4604. i.PushBack( 1000 );
  4605. i.PushBack( 2 );
  4606. i.PushBack( 150 );
  4607. break;
  4608. //Cremation
  4609. case 'Runeword 10' :
  4610. f.PushBack( 0.5f );
  4611. i.PushBack( 5 );
  4612. break;
  4613. case 'Runeword 11' :
  4614. i.PushBack( 20 );
  4615. i.PushBack( 10 );
  4616. i.PushBack( 10 );
  4617. break;
  4618. case 'Runeword 12' :
  4619. i.PushBack( 1 );
  4620. i.PushBack( 15 );
  4621. break;
  4622. //Transmutation
  4623. case 'Runeword 13' :
  4624. i.PushBack( 10 );
  4625. i.PushBack( 50 );
  4626. break;
  4627. case 'Runeword 14' :
  4628. i.PushBack( 100 );
  4629. break;
  4630. case 'Runeword 15' :
  4631. i.PushBack( 10 );
  4632. i.PushBack( 150 );
  4633. break;
  4634. //Affliction
  4635. case 'Runeword 16' :
  4636. i.PushBack( 1 );
  4637. i.PushBack( 2 );
  4638. i.PushBack( 5 );
  4639. break;
  4640. case 'Runeword 17' :
  4641. i.PushBack( 10 );
  4642. break;
  4643. case 'Runeword 18' :
  4644. i.PushBack( 5 );
  4645. i.PushBack( 100 );
  4646. i.PushBack( 15 );
  4647. break;
  4648. //Exsanguination
  4649. case 'Runeword 19' :
  4650. i.PushBack( 1 );
  4651. i.PushBack( 5 );
  4652. break;
  4653. case 'Runeword 20' :
  4654. i.PushBack( 10 );
  4655. break;
  4656. case 'Runeword 21' :
  4657. i.PushBack( 5 );
  4658. i.PushBack( 600 );
  4659. i.PushBack( 2 );
  4660. i.PushBack( 15 );
  4661. break;
  4662. //Desperation
  4663. case 'Runeword 22' :
  4664. i.PushBack( 50 );
  4665. i.PushBack( 1 );
  4666. break;
  4667. case 'Runeword 23' :
  4668. i.PushBack( 2 );
  4669. break;
  4670. case 'Runeword 24' :
  4671. f.PushBack( 0.05f );
  4672. f.PushBack( 0.1f );
  4673. i.PushBack( 3 );
  4674. break;
  4675. //Reflection
  4676. case 'Runeword 25' :
  4677. i.PushBack( 10 );
  4678. break;
  4679. case 'Runeword 26' :
  4680. i.PushBack( 50 );
  4681. i.PushBack( 50 );
  4682. i.PushBack( 20 );
  4683. break;
  4684. case 'Runeword 27' :
  4685. i.PushBack( 5 );
  4686. i.PushBack( 30 );
  4687. break;
  4688. //Electrocution
  4689. case 'Runeword 28' :
  4690. i.PushBack( 10 );
  4691. i.PushBack( 30 );
  4692. break;
  4693. case 'Runeword 29' :
  4694. i.PushBack( 150 );
  4695. i.PushBack( 60 );
  4696. break;
  4697. case 'Runeword 30' :
  4698. i.PushBack( 10 );
  4699. i.PushBack( 5 );
  4700. i.PushBack( 200 );
  4701. i.PushBack( 90 );
  4702. break;
  4703. //Exhilaration
  4704. case 'Runeword 31' :
  4705. i.PushBack( RoundMath(20 * Options().StamCostGlobal()) );
  4706. i.PushBack( 5 );
  4707. break;
  4708. case 'Runeword 32' :
  4709. i.PushBack( 2 );
  4710. i.PushBack( 10 );
  4711. break;
  4712. case 'Runeword 33' :
  4713. i.PushBack( 100 );
  4714. i.PushBack( 15 );
  4715. break;
  4716. //Assassination
  4717. case 'Runeword 34' :
  4718. i.PushBack( 100 );
  4719. i.PushBack( 10 );
  4720. break;
  4721. case 'Runeword 35' :
  4722. i.PushBack( 20 );
  4723. break;
  4724. case 'Runeword 36' :
  4725. i.PushBack( 200 );
  4726. i.PushBack( 30 );
  4727. break;
  4728. //Prolongation
  4729. case 'Runeword 37' :
  4730. i.PushBack( 100 );
  4731. i.PushBack( 10 );
  4732. break;
  4733. case 'Runeword 38' :
  4734. i.PushBack( 50 );
  4735. i.PushBack( 20 );
  4736. break;
  4737. case 'Runeword 39' :
  4738. i.PushBack( 10 );
  4739. i.PushBack( 30 );
  4740. break;
  4741. //Invocation
  4742. case 'Runeword 40' :
  4743. i.PushBack( 5 );
  4744. break;
  4745. case 'Runeword 41' :
  4746. i.PushBack( 10 );
  4747. break;
  4748. case 'Runeword 42' :
  4749. i.PushBack( 100 );
  4750. i.PushBack( 5 );
  4751. i.PushBack( 15 );
  4752. break;
  4753. //Resolution
  4754. case 'Runeword 43' :
  4755. f.PushBack( 0.5f );
  4756. i.PushBack( 1000 );
  4757. f.PushBack( 0.5f );
  4758. i.PushBack( 10 );
  4759. break;
  4760. case 'Runeword 44' :
  4761. i.PushBack( 25 );
  4762. i.PushBack( 75 );
  4763. i.PushBack( 20 );
  4764. break;
  4765. case 'Runeword 45' :
  4766. i.PushBack( 150 );
  4767. i.PushBack( 30 );
  4768. i.PushBack( 30 );
  4769. break;
  4770. //Destruction
  4771. case 'Runeword 46' :
  4772. i.PushBack( 25 );
  4773. i.PushBack( 10 );
  4774. break;
  4775. case 'Runeword 47' :
  4776. i.PushBack( 50 );
  4777. i.PushBack( 25 );
  4778. i.PushBack( 5 );
  4779. i.PushBack( 20 );
  4780. break;
  4781. case 'Runeword 48' :
  4782. i.PushBack( 25 );
  4783. i.PushBack( 50 );
  4784. i.PushBack( 5 );
  4785. i.PushBack( 30 );
  4786. break;
  4787. //Penetration
  4788. case 'Runeword 49' :
  4789. i.PushBack( 50 );
  4790. i.PushBack( 10 );
  4791. break;
  4792. case 'Runeword 50' :
  4793. i.PushBack( 20 );
  4794. break;
  4795. case 'Runeword 51' :
  4796. i.PushBack( 10 );
  4797. i.PushBack( 3 );
  4798. i.PushBack( 5 );
  4799. i.PushBack( 30 );
  4800. break;
  4801. //Fortification
  4802. case 'Runeword 52' :
  4803. i.PushBack( 20 );
  4804. i.PushBack( 10 );
  4805. break;
  4806. case 'Runeword 53' :
  4807. i.PushBack( 20 );
  4808. break;
  4809. case 'Runeword 54' :
  4810. i.PushBack( 100000 );
  4811. i.PushBack( 1 );
  4812. i.PushBack( 30 );
  4813. break;
  4814. //Mutilation
  4815. case 'Runeword 55' :
  4816. i.PushBack( 5 );
  4817. i.PushBack( 50 );
  4818. i.PushBack( 10 );
  4819. break;
  4820. case 'Runeword 56' :
  4821. i.PushBack( 100 );
  4822. i.PushBack( 100 );
  4823. i.PushBack( 20 );
  4824. break;
  4825. case 'Runeword 57' :
  4826. i.PushBack( 10 );
  4827. i.PushBack( 10 );
  4828. i.PushBack( 30 );
  4829. break;
  4830. //Desolation
  4831. case 'Runeword 58' :
  4832. i.PushBack( 25 );
  4833. i.PushBack( 10 );
  4834. break;
  4835. case 'Runeword 59' :
  4836. i.PushBack( 1 );
  4837. i.PushBack( 20 );
  4838. break;
  4839. case 'Runeword 60' :
  4840. i.PushBack( 100 );
  4841. i.PushBack( 30 );
  4842. break;
  4843. default:
  4844. break;
  4845. }
  4846. }
  4847.  
  4848. public final function GetPotionAttributesForTooltip( potionName : name, out tips : array<SAttributeTooltip> ) : void
  4849. {
  4850. var i, j : int;
  4851. var buffType : EEffectType;
  4852. var abilityName : name;
  4853. var abs, temp : array<name>;
  4854. var val, temp4 : SAbilityAttributeValue;
  4855. var newAttr : SAttributeTooltip;
  4856. var attrs : array<SItemAttributes>;
  4857. var temp1 : array<float>;
  4858. var temp2, temp3 : int;
  4859. var dm : CDefinitionsManagerAccessor = theGame.GetDefinitionsManager();
  4860. var abIdx : int;
  4861.  
  4862. //Kolaris - NextGen Update
  4863. if( !(dm.IsItemPotion(potionName) || dm.IsItemFood(potionName) || potionName == 'Signs Enhancement') )
  4864. return;
  4865.  
  4866. abIdx = 0;
  4867. dm.GetItemAbilitiesWithWeights(potionName, true, abs, temp1, temp2, temp3);
  4868. if( dm.IsItemFood(potionName) )
  4869. {
  4870. for(i=0; i<abs.Size(); i+=1)
  4871. {
  4872. if( StrContains(abs[i], 'Quality') )
  4873. {
  4874. abIdx = i;
  4875. break;
  4876. }
  4877. }
  4878. }
  4879.  
  4880. dm.GetContainedAbilities(abs[abIdx], abs);
  4881. for(i=0; i<abs.Size(); i+=1)
  4882. {
  4883. EffectNameToType(abs[i], buffType, abilityName);
  4884. if( buffType == EET_Undefined )
  4885. continue;
  4886.  
  4887. dm.GetAbilityAttributes(abs[i], temp);
  4888. for(j=0; j<temp.Size(); j+=1)
  4889. {
  4890. if( temp[j] == 'duration' || temp[j] == 'level' )
  4891. continue;
  4892.  
  4893. switch(buffType) // abilities from items that shouldn't be in the tooltips but are in the ability go here for exclusion
  4894. {
  4895. case EET_Cat:
  4896. if( temp[j] == 'highlightObjectsRange' )
  4897. continue;
  4898. break;
  4899.  
  4900. case EET_Swallow:
  4901. case EET_WhiteRaffardDecoction:
  4902. if( temp[j] == 'vitalityCombatRegen' )
  4903. continue;
  4904. break;
  4905.  
  4906. case EET_Thunderbolt:
  4907. if( temp[j] == 'critical_frenzy_chance' || temp[j] == 'critical_frenzy_duration' || temp[j] == 'critical_frenzy_slowdown' )
  4908. continue;
  4909. break;
  4910. }
  4911. attrs.PushBack(SItemAttributes(abs[i], temp[j], buffType));
  4912. }
  4913. }
  4914.  
  4915. for(i=0; i<attrs.Size(); i+=1)
  4916. {
  4917. dm.GetAbilityAttributeValue(attrs[i].abilityName, attrs[i].attributeName, val, temp4);
  4918.  
  4919. buffType = attrs[i].buffType;
  4920. newAttr.originName = attrs[i].attributeName;
  4921. newAttr.attributeName = GetAttributeNameLocStr(attrs[i].attributeName, false);
  4922. //Kolaris - Decoctions & Mutagens
  4923. if( buffType == EET_Decoction1 )
  4924. {
  4925. newAttr.value = val.valueMultiplicative;
  4926. newAttr.percentageValue = true;
  4927. newAttr.attributeType = 'mult';
  4928. }
  4929. else if( buffType == EET_Decoction2 )
  4930. {
  4931. newAttr.value = val.valueAdditive;
  4932. newAttr.percentageValue = true;
  4933. newAttr.attributeType = 'add';
  4934. }
  4935. else if( buffType == EET_Decoction3 )
  4936. {
  4937. newAttr.value = val.valueBase;
  4938. newAttr.percentageValue = false;
  4939. newAttr.attributeType = 'base';
  4940. }
  4941. else if( buffType == EET_Decoction4 )
  4942. {
  4943. newAttr.value = val.valueAdditive;
  4944. newAttr.percentageValue = false;
  4945. newAttr.attributeType = 'add';
  4946. }
  4947. else if( buffType == EET_Decoction5 )
  4948. {
  4949. newAttr.value = val.valueMultiplicative;
  4950. newAttr.percentageValue = true;
  4951. newAttr.attributeType = 'mult';
  4952. }
  4953. else if( buffType == EET_Decoction6 )
  4954. {
  4955. newAttr.value = val.valueMultiplicative;
  4956. newAttr.percentageValue = true;
  4957. newAttr.attributeType = 'mult';
  4958. }
  4959. else if( buffType == EET_Decoction7 )
  4960. {
  4961. newAttr.value = val.valueMultiplicative;
  4962. newAttr.percentageValue = true;
  4963. newAttr.attributeType = 'mult';
  4964. }
  4965. else if( buffType == EET_Decoction8 )
  4966. newAttr.value = val.valueMultiplicative;
  4967. newAttr.attributeType = 'mult';
  4968. else if( buffType == EET_Decoction9 )
  4969. {
  4970. newAttr.value = val.valueAdditive;
  4971. newAttr.percentageValue = false;
  4972. newAttr.attributeType = 'add';
  4973. }
  4974. else if( buffType == EET_Decoction10 )
  4975. {
  4976. newAttr.value = val.valueMultiplicative;
  4977. newAttr.percentageValue = true;
  4978. newAttr.attributeType = 'mult';
  4979. }
  4980. else if(val.valueMultiplicative != 0)
  4981. {
  4982. newAttr.value = val.valueMultiplicative;
  4983. newAttr.percentageValue = true;
  4984. newAttr.attributeType = 'mult';
  4985. }
  4986. else if( val.valueAdditive != 0 )
  4987. {
  4988. if( buffType == EET_Thunderbolt )
  4989. {
  4990. newAttr.value = val.valueAdditive;
  4991. newAttr.percentageValue = false;
  4992. newAttr.attributeType = 'add';
  4993. }
  4994. else if( buffType == EET_BlackBlood )
  4995. {
  4996. newAttr.value = val.valueAdditive;
  4997. newAttr.percentageValue = true;
  4998. newAttr.attributeType = 'add';
  4999. }
  5000. else if( buffType == EET_Blizzard )
  5001. {
  5002. newAttr.value = 1 - val.valueAdditive;
  5003. newAttr.percentageValue = true;
  5004. newAttr.attributeType = 'add';
  5005. }
  5006. else
  5007. {
  5008. newAttr.value = val.valueAdditive;
  5009. newAttr.percentageValue = false;
  5010. newAttr.attributeType = 'add';
  5011. }
  5012. }
  5013. else
  5014. {
  5015. if( buffType == EET_GoldenOriole )
  5016. {
  5017. newAttr.value = val.valueBase;
  5018. newAttr.percentageValue = true;
  5019. newAttr.attributeType = 'base';
  5020. }
  5021. else
  5022. {
  5023. newAttr.value = val.valueBase;
  5024. newAttr.percentageValue = false;
  5025. newAttr.attributeType = 'base';
  5026. }
  5027. }
  5028.  
  5029. tips.PushBack(newAttr);
  5030. }
  5031. }
  5032.  
  5033. public function GetItemRelativeTooltipType(id :SItemUniqueId, invOther : CInventoryComponent, idOther : SItemUniqueId) : ECompareType
  5034. {
  5035.  
  5036. if( (GetItemCategory(id) == invOther.GetItemCategory(idOther)) ||
  5037. ItemHasTag(id, 'PlayerSteelWeapon') && invOther.ItemHasTag(idOther, 'PlayerSteelWeapon') ||
  5038. ItemHasTag(id, 'PlayerSilverWeapon') && invOther.ItemHasTag(idOther, 'PlayerSilverWeapon') ||
  5039. ItemHasTag(id, 'PlayerSecondaryWeapon') && invOther.ItemHasTag(idOther, 'PlayerSecondaryWeapon')
  5040. )
  5041. {
  5042. return ECT_Compare;
  5043. }
  5044. return ECT_Incomparable;
  5045. }
  5046.  
  5047.  
  5048. private function FormatFloatForTooltip(fValue : float) : string
  5049. {
  5050. var valueInt, valueDec : int;
  5051. var strValue : string;
  5052.  
  5053. if(fValue < 0)
  5054. {
  5055. valueInt = CeilF(fValue);
  5056. valueDec = RoundMath((fValue - valueInt)*(-100));
  5057. }
  5058. else
  5059. {
  5060. valueInt = FloorF(fValue);
  5061. valueDec = RoundMath((fValue - valueInt)*(100));
  5062. }
  5063. strValue = valueInt+".";
  5064. if(valueDec < 10)
  5065. strValue += "0"+valueDec;
  5066. else
  5067. strValue += ""+valueDec;
  5068.  
  5069. return strValue;
  5070. }
  5071.  
  5072. public function SetPriceMultiplier( mult : float )
  5073. {
  5074. priceMult = mult;
  5075. }
  5076.  
  5077.  
  5078. public function GetMerchantPriceModifier( shopNPC : CNewNPC, item : SItemUniqueId ) : float
  5079. {
  5080. var areaPriceMult : float;
  5081. var itemPriceMult : float;
  5082. var importPriceMult : float;
  5083. var finalPriceMult : float;
  5084. var tag : name;
  5085. var zoneName : EZoneName;
  5086.  
  5087. zoneName = theGame.GetCurrentZone();
  5088.  
  5089. switch ( zoneName )
  5090. {
  5091. case ZN_NML_CrowPerch : areaPriceMult = CalculateAttributeValue(thePlayer.GetAttributeValue('crow_perch_price_mult'));
  5092. case ZN_NML_SpitfireBluff : areaPriceMult = CalculateAttributeValue(thePlayer.GetAttributeValue('spitfire_bluff_price_mult'));
  5093. case ZN_NML_TheMire : areaPriceMult = CalculateAttributeValue(thePlayer.GetAttributeValue('the_mire_price_mult'));
  5094. case ZN_NML_Mudplough : areaPriceMult = CalculateAttributeValue(thePlayer.GetAttributeValue('mudplough_price_mult'));
  5095. case ZN_NML_Grayrocks : areaPriceMult = CalculateAttributeValue(thePlayer.GetAttributeValue('grayrocks_price_mult'));
  5096. case ZN_NML_TheDescent : areaPriceMult = CalculateAttributeValue(thePlayer.GetAttributeValue('the_descent_price_mult'));
  5097. case ZN_NML_CrookbackBog : areaPriceMult = CalculateAttributeValue(thePlayer.GetAttributeValue('crookback_bog_price_mult'));
  5098. case ZN_NML_BaldMountain : areaPriceMult = CalculateAttributeValue(thePlayer.GetAttributeValue('bald_mountain_price_mult'));
  5099. case ZN_NML_Novigrad : areaPriceMult = CalculateAttributeValue(thePlayer.GetAttributeValue('novigrad_price_mult'));
  5100. case ZN_NML_Homestead : areaPriceMult = CalculateAttributeValue(thePlayer.GetAttributeValue('homestead_price_mult'));
  5101. case ZN_NML_Gustfields : areaPriceMult = CalculateAttributeValue(thePlayer.GetAttributeValue('gustfields_price_mult'));
  5102. case ZN_NML_Oxenfurt : areaPriceMult = CalculateAttributeValue(thePlayer.GetAttributeValue('oxenfurt_price_mult'));
  5103. case ZN_Undefined : areaPriceMult = 1;
  5104. }
  5105.  
  5106. if (ItemHasTag(item,'weapon')) { itemPriceMult = CalculateAttributeValue(shopNPC.GetAttributeValue('weapon_price_mult')); }
  5107. else if (ItemHasTag(item,'armor')) { itemPriceMult = CalculateAttributeValue(shopNPC.GetAttributeValue('armor_price_mult')); }
  5108. else if (ItemHasTag(item,'crafting')) { itemPriceMult = CalculateAttributeValue(shopNPC.GetAttributeValue('crafting_price_mult')); }
  5109. else if (ItemHasTag(item,'alchemy')) { itemPriceMult = CalculateAttributeValue(shopNPC.GetAttributeValue('alchemy_price_mult')); }
  5110. else if (ItemHasTag(item,'alcohol')) { itemPriceMult = CalculateAttributeValue(shopNPC.GetAttributeValue('alcohol_price_mult')); }
  5111. else if (ItemHasTag(item,'food')) { itemPriceMult = CalculateAttributeValue(shopNPC.GetAttributeValue('food_price_mult')); }
  5112. else if (ItemHasTag(item,'fish')) { itemPriceMult = CalculateAttributeValue(shopNPC.GetAttributeValue('fish_price_mult')); }
  5113. else if (ItemHasTag(item,'books')) { itemPriceMult = CalculateAttributeValue(shopNPC.GetAttributeValue('books_price_mult')); }
  5114. else if (ItemHasTag(item,'valuables')) { itemPriceMult = CalculateAttributeValue(shopNPC.GetAttributeValue('valuables_price_mult')); }
  5115. else if (ItemHasTag(item,'junk')) { itemPriceMult = CalculateAttributeValue(shopNPC.GetAttributeValue('junk_price_mult')); }
  5116. else if (ItemHasTag(item,'orens')) { itemPriceMult = CalculateAttributeValue(shopNPC.GetAttributeValue('orens_price_mult')); }
  5117. else if (ItemHasTag(item,'florens')) { itemPriceMult = CalculateAttributeValue(shopNPC.GetAttributeValue('florens_price_mult')); }
  5118. else { itemPriceMult = 1; }
  5119.  
  5120. if (ItemHasTag(item,'novigrad')) { importPriceMult = CalculateAttributeValue(shopNPC.GetAttributeValue('novigrad_price_mult')); }
  5121. else if (ItemHasTag(item,'nilfgard')) { importPriceMult = CalculateAttributeValue(shopNPC.GetAttributeValue('nilfgard_price_mult')); }
  5122. else if (ItemHasTag(item,'nomansland')) { importPriceMult = CalculateAttributeValue(shopNPC.GetAttributeValue('nomansland_price_mult')); }
  5123. else if (ItemHasTag(item,'skellige')) { importPriceMult = CalculateAttributeValue(shopNPC.GetAttributeValue('skellige_price_mult')); }
  5124. else if (ItemHasTag(item,'nonhuman')) { importPriceMult = CalculateAttributeValue(shopNPC.GetAttributeValue('nonhuman_price_mult')); }
  5125. else { importPriceMult = 1; }
  5126.  
  5127. finalPriceMult = areaPriceMult*itemPriceMult*importPriceMult*priceMult;
  5128. return finalPriceMult;
  5129. }
  5130.  
  5131. public function SetRepairPriceMultiplier( mult : float )
  5132. {
  5133. priceRepairMult = mult;
  5134. }
  5135.  
  5136.  
  5137. public function GetRepairPriceModifier( repairNPC : CNewNPC ) : float
  5138. {
  5139. return priceRepairMult;
  5140. }
  5141.  
  5142. public function GetRepairPrice( item : SItemUniqueId ) : float
  5143. {
  5144. var currDiff : float;
  5145. currDiff = GetItemMaxDurability(item) - GetItemDurability(item);
  5146.  
  5147. return priceRepair * currDiff;
  5148. }
  5149.  
  5150.  
  5151. public function GetTooltipData(itemId : SItemUniqueId, out localizedName : string, out localizedDescription : string, out price : int, out localizedCategory : string,
  5152. out itemStats : array<SAttributeTooltip>, out localizedFluff : string)
  5153. {
  5154. if( !IsIdValid(itemId) )
  5155. {
  5156. return;
  5157. }
  5158. localizedName = GetItemLocNameByID(itemId);
  5159. localizedDescription = GetItemLocalizedDescriptionByUniqueID(itemId);
  5160. localizedFluff = "IMPLEMENT ME - fluff text";
  5161. // W3EE - Begin
  5162. price = GetItemBasePriceModified( itemId, false );
  5163. // W3EE - End
  5164. localizedCategory = GetItemCategoryLocalisedString(GetItemCategory(itemId));
  5165. GetItemStats(itemId, itemStats);
  5166. }
  5167.  
  5168.  
  5169. public function GetItemBaseStats(itemId : SItemUniqueId, out itemStats : array<SAttributeTooltip>)
  5170. {
  5171. var attributes : array<name>;
  5172.  
  5173. var dm : CDefinitionsManagerAccessor;
  5174. var oilAbilities, oilAttributes : array<name>;
  5175. var weights : array<float>;
  5176. var i, j : int;
  5177. var tmpI, tmpJ : int;
  5178.  
  5179. var idx : int;
  5180. var oilStatsCount : int;
  5181. var oilName : name;
  5182. var oilStats : array<SAttributeTooltip>;
  5183. var oilStatFirst : SAttributeTooltip;
  5184. var oils : array< W3Effect_Oil >;
  5185.  
  5186. GetItemBaseAttributes(itemId, attributes);
  5187.  
  5188.  
  5189. oils = GetOilsAppliedOnItem( itemId );
  5190. dm = theGame.GetDefinitionsManager();
  5191. for( i=0; i<oils.Size(); i+=1 )
  5192. {
  5193. oilName = oils[ i ].GetOilItemName();
  5194.  
  5195. oilAbilities.Clear();
  5196. weights.Clear();
  5197. dm.GetItemAbilitiesWithWeights(oilName, GetEntity() == thePlayer, oilAbilities, weights, tmpI, tmpJ);
  5198.  
  5199. oilAttributes.Clear();
  5200. oilAttributes = dm.GetAbilitiesAttributes(oilAbilities);
  5201.  
  5202. oilStatsCount = oilAttributes.Size();
  5203. for (idx = 0; idx < oilStatsCount; idx+=1)
  5204. {
  5205. attributes.Remove(oilAttributes[idx]);
  5206. }
  5207. }
  5208.  
  5209. GetItemTooltipAttributes(itemId, attributes, itemStats);
  5210. }
  5211.  
  5212.  
  5213. public function GetItemStats(itemId : SItemUniqueId, out itemStats : array<SAttributeTooltip>)
  5214. {
  5215. var attributes : array<name>;
  5216.  
  5217. GetItemAttributes(itemId, attributes);
  5218. GetItemTooltipAttributes(itemId, attributes, itemStats);
  5219. }
  5220.  
  5221. private function GetItemTooltipAttributes(itemId : SItemUniqueId, attributes : array<name>, out itemStats : array<SAttributeTooltip>):void
  5222. {
  5223. var itemCategory:name;
  5224. var i, j, settingsSize : int;
  5225. var attributeString : string;
  5226. var attributeColor : string;
  5227. var attributeName : name;
  5228. var isPercentageValue : string;
  5229. var primaryStatLabel : string;
  5230. var statLabel : string;
  5231.  
  5232. var stat : SAttributeTooltip;
  5233. var attributeVal : SAbilityAttributeValue;
  5234.  
  5235. settingsSize = theGame.tooltipSettings.GetNumRows();
  5236. itemStats.Clear();
  5237. itemCategory = GetItemCategory(itemId);
  5238. for(i=0; i<settingsSize; i+=1)
  5239. {
  5240.  
  5241. attributeString = theGame.tooltipSettings.GetValueAt(0,i);
  5242. if(StrLen(attributeString) <= 0)
  5243. continue;
  5244.  
  5245. attributeName = '';
  5246.  
  5247.  
  5248. for(j=0; j<attributes.Size(); j+=1)
  5249. {
  5250. if(NameToString(attributes[j]) == attributeString)
  5251. {
  5252. attributeName = attributes[j];
  5253. break;
  5254. }
  5255. }
  5256. if(!IsNameValid(attributeName))
  5257. continue;
  5258.  
  5259. if(itemCategory == 'silversword' && attributeName == 'SlashingDamage') continue;
  5260. if(itemCategory == 'steelsword' && attributeName == 'SilverDamage') continue;
  5261. if(itemCategory == 'bolt' && ItemHasTag(itemId, 'Steel_Bolt' ) && attributeName == 'SilverDamage') continue; //W3EE
  5262.  
  5263. attributeColor = theGame.tooltipSettings.GetValueAt(1,i);
  5264.  
  5265. isPercentageValue = theGame.tooltipSettings.GetValueAt(2,i);
  5266.  
  5267.  
  5268. attributeVal = GetItemAttributeValue(itemId, attributeName);
  5269. stat.attributeColor = attributeColor;
  5270. stat.percentageValue = isPercentageValue;
  5271. stat.primaryStat = IsPrimaryStatById(itemId, attributeName, primaryStatLabel);
  5272. stat.value = 0;
  5273. stat.originName = attributeName;
  5274. if(attributeVal.valueBase != 0)
  5275. {
  5276. statLabel = GetAttributeNameLocStr(attributeName, false);
  5277. stat.value = attributeVal.valueBase;
  5278. stat.attributeType = 'base';
  5279. }
  5280. if(attributeVal.valueMultiplicative != 0)
  5281. {
  5282.  
  5283.  
  5284. statLabel = GetAttributeNameLocStr(attributeName, false);
  5285. stat.value = attributeVal.valueMultiplicative;
  5286. stat.attributeType = 'mult';
  5287. stat.percentageValue = true;
  5288. }
  5289. if(attributeVal.valueAdditive != 0)
  5290. {
  5291. statLabel = GetAttributeNameLocStr(attributeName, false);
  5292. //Kolaris - Tooltip Fix
  5293. if( attributeVal.valueBase != 0 )
  5294. stat.value += attributeVal.valueAdditive;
  5295. else
  5296. stat.value = attributeVal.valueAdditive;
  5297. stat.attributeType = 'add';
  5298. }
  5299. if (stat.value != 0)
  5300. {
  5301. stat.attributeName = statLabel;
  5302.  
  5303. itemStats.PushBack(stat);
  5304. }
  5305. }
  5306. }
  5307.  
  5308.  
  5309. public function GetItemStatsFromName(itemName : name, out itemStats : array<SAttributeTooltip>)
  5310. {
  5311. var itemCategory : name;
  5312. var i, j, settingsSize : int;
  5313. var attributeString : string;
  5314. var attributeColor : string;
  5315. var attributeName : name;
  5316. var isPercentageValue : string;
  5317. var attributes, itemAbilities, tmpArray : array<name>;
  5318. var weights : array<float>;
  5319. var stat : SAttributeTooltip;
  5320. var attributeVal, min, max : SAbilityAttributeValue;
  5321. var dm : CDefinitionsManagerAccessor;
  5322. var primaryStatLabel : string;
  5323. var statLabel : string;
  5324.  
  5325. settingsSize = theGame.tooltipSettings.GetNumRows();
  5326. dm = theGame.GetDefinitionsManager();
  5327. dm.GetItemAbilitiesWithWeights(itemName, GetEntity() == thePlayer, itemAbilities, weights, i, j);
  5328. attributes = dm.GetAbilitiesAttributes(itemAbilities);
  5329.  
  5330. itemStats.Clear();
  5331. itemCategory = dm.GetItemCategory(itemName);
  5332. for(i=0; i<settingsSize; i+=1)
  5333. {
  5334.  
  5335. attributeString = theGame.tooltipSettings.GetValueAt(0,i);
  5336. if(StrLen(attributeString) <= 0)
  5337. continue;
  5338.  
  5339. attributeName = '';
  5340.  
  5341.  
  5342. for(j=0; j<attributes.Size(); j+=1)
  5343. {
  5344. if(NameToString(attributes[j]) == attributeString)
  5345. {
  5346. attributeName = attributes[j];
  5347. break;
  5348. }
  5349. }
  5350. if(!IsNameValid(attributeName))
  5351. continue;
  5352.  
  5353.  
  5354. if(itemCategory == 'silversword' && attributeName == 'SlashingDamage') continue;
  5355. if(itemCategory == 'steelsword' && attributeName == 'SilverDamage') continue;
  5356.  
  5357.  
  5358. attributeColor = theGame.tooltipSettings.GetValueAt(1,i);
  5359.  
  5360. isPercentageValue = theGame.tooltipSettings.GetValueAt(2,i);
  5361.  
  5362.  
  5363. dm.GetAbilitiesAttributeValue(itemAbilities, attributeName, min, max);
  5364. attributeVal = GetAttributeRandomizedValue(min, max);
  5365.  
  5366. stat.attributeColor = attributeColor;
  5367. stat.percentageValue = isPercentageValue;
  5368.  
  5369. stat.primaryStat = IsPrimaryStat(itemCategory, attributeName, primaryStatLabel);
  5370.  
  5371. stat.value = 0;
  5372. stat.originName = attributeName;
  5373.  
  5374. if(attributeVal.valueBase != 0)
  5375. {
  5376. stat.value = attributeVal.valueBase;
  5377. }
  5378. if(attributeVal.valueMultiplicative != 0)
  5379. {
  5380. stat.value = attributeVal.valueMultiplicative;
  5381. stat.percentageValue = true;
  5382. }
  5383. if(attributeVal.valueAdditive != 0)
  5384. {
  5385. statLabel = GetAttributeNameLocStr(attributeName, false);
  5386. stat.value = attributeVal.valueBase + attributeVal.valueAdditive;
  5387. }
  5388.  
  5389. if (attributeName == 'toxicity_offset')
  5390. {
  5391. statLabel = GetAttributeNameLocStr('toxicity', false);
  5392. stat.percentageValue = false;
  5393. }
  5394. else
  5395. {
  5396. statLabel = GetAttributeNameLocStr(attributeName, false);
  5397. }
  5398.  
  5399. if (stat.value != 0)
  5400. {
  5401. stat.attributeName = statLabel;
  5402.  
  5403. itemStats.PushBack(stat);
  5404. }
  5405.  
  5406.  
  5407. }
  5408. }
  5409.  
  5410. public function IsThereItemOnSlot(slot : EEquipmentSlots) : bool
  5411. {
  5412. var player : W3PlayerWitcher;
  5413.  
  5414. player = ((W3PlayerWitcher)GetEntity());
  5415. if(player)
  5416. {
  5417. return player.IsAnyItemEquippedOnSlot(slot);
  5418. }
  5419. else
  5420. {
  5421. return false;
  5422. }
  5423. }
  5424.  
  5425. public function GetItemEquippedOnSlot(slot : EEquipmentSlots, out item : SItemUniqueId) : bool
  5426. {
  5427. var player : W3PlayerWitcher;
  5428.  
  5429. player = ((W3PlayerWitcher)GetEntity());
  5430. if(player)
  5431. {
  5432. return player.GetItemEquippedOnSlot(slot, item);
  5433. }
  5434. else
  5435. {
  5436. return false;
  5437. }
  5438. }
  5439.  
  5440. public function IsItemExcluded ( itemID : SItemUniqueId, excludedItems : array < SItemNameProperty > ) : bool
  5441. {
  5442. var i : int;
  5443. var currItemName : name;
  5444.  
  5445. currItemName = GetItemName( itemID );
  5446.  
  5447. for ( i = 0; i < excludedItems.Size(); i+=1 )
  5448. {
  5449. if ( currItemName == excludedItems[i].itemName )
  5450. {
  5451. return true;
  5452. }
  5453. }
  5454. return false;
  5455. }
  5456.  
  5457. public function GetItemPrimaryStat(itemId : SItemUniqueId, out attributeLabel : string, out attributeVal : float ) : void
  5458. {
  5459. var attributeName : name;
  5460. var attributeValue:SAbilityAttributeValue;
  5461.  
  5462. GetItemPrimaryStatImplById(itemId, attributeLabel, attributeVal, attributeName);
  5463.  
  5464. attributeValue = GetItemAttributeValue(itemId, attributeName);
  5465.  
  5466. if(attributeValue.valueBase != 0)
  5467. {
  5468. attributeVal = attributeValue.valueBase;
  5469. }
  5470. if(attributeValue.valueMultiplicative != 0)
  5471. {
  5472. attributeVal = attributeValue.valueMultiplicative;
  5473. }
  5474. if(attributeValue.valueAdditive != 0)
  5475. {
  5476. //Kolaris - Tooltip Fix
  5477. attributeVal += attributeValue.valueAdditive;
  5478. }
  5479. }
  5480.  
  5481. public function GetItemStatByName(itemName : name, statName : name, out resultValue : float) : void
  5482. {
  5483. var dm : CDefinitionsManagerAccessor;
  5484. var attributes, itemAbilities : array<name>;
  5485. var min, max, attributeValue : SAbilityAttributeValue;
  5486. var tmpInt : int;
  5487. var tmpArray : array<float>;
  5488.  
  5489. dm = theGame.GetDefinitionsManager();
  5490. dm.GetItemAbilitiesWithWeights(itemName, GetEntity() == thePlayer, itemAbilities, tmpArray, tmpInt, tmpInt);
  5491. attributes = dm.GetAbilitiesAttributes(itemAbilities);
  5492.  
  5493. dm.GetAbilitiesAttributeValue(itemAbilities, statName, min, max);
  5494. attributeValue = GetAttributeRandomizedValue(min, max);
  5495.  
  5496. if(attributeValue.valueBase != 0)
  5497. {
  5498. resultValue = attributeValue.valueBase;
  5499. }
  5500. if(attributeValue.valueMultiplicative != 0)
  5501. {
  5502. resultValue = attributeValue.valueMultiplicative;
  5503. }
  5504. if(attributeValue.valueAdditive != 0)
  5505. {
  5506. resultValue = attributeValue.valueAdditive;
  5507. }
  5508. }
  5509.  
  5510. public function GetItemPrimaryStatFromName(itemName : name, out attributeLabel : string, out attributeVal : float, out primAttrName : name) : void
  5511. {
  5512. var item : array<SItemUniqueId>;
  5513. var attributes, itemAbilities : array<name>;
  5514. var attributeValue, min, max : SAbilityAttributeValue;
  5515. var dm : CDefinitionsManagerAccessor;
  5516. var attributeName, itemCategory : name;
  5517. var tmpInt, itemQuality, level, baseLevel : int;
  5518. var itemAttributes : array<SAbilityAttributeValue>;
  5519. var i, levelDiff : int;
  5520. var tmpArray : array<float>;
  5521.  
  5522. dm = theGame.GetDefinitionsManager();
  5523. if( dm.ItemHasTag(itemName, 'crossbow') )
  5524. return;
  5525.  
  5526. itemQuality = dm.GetItemQuality(itemName);
  5527. itemCategory = dm.GetItemCategory(itemName);
  5528. GetItemPrimaryStatImpl(dm.GetItemCategory(itemName), attributeLabel, attributeVal, attributeName);
  5529. dm.GetItemAbilitiesWithWeights(itemName, GetEntity() == thePlayer, itemAbilities, tmpArray, tmpInt, tmpInt);
  5530. attributes = dm.GetAbilitiesAttributes(itemAbilities);
  5531. for (tmpInt = 0; tmpInt < attributes.Size(); tmpInt += 1)
  5532. {
  5533. if (attributes[tmpInt] == attributeName)
  5534. {
  5535. dm.GetAbilitiesAttributeValue(itemAbilities, attributeName, min, max);
  5536. attributeValue = GetAttributeRandomizedValue(min, max);
  5537. primAttrName = attributeName;
  5538. break;
  5539. }
  5540. }
  5541.  
  5542. if(attributeValue.valueBase != 0)
  5543. attributeVal = attributeValue.valueBase;
  5544. if(attributeValue.valueMultiplicative != 0)
  5545. attributeVal = attributeValue.valueMultiplicative;
  5546. if(attributeValue.valueAdditive != 0)
  5547. attributeVal = attributeValue.valueAdditive;
  5548.  
  5549. switch(itemCategory)
  5550. {
  5551. case 'armor' :
  5552. case 'boots' :
  5553. case 'gloves' :
  5554. case 'pants' :
  5555. case 'silversword' :
  5556. case 'steelsword' :
  5557. itemAttributes.PushBack((SAbilityAttributeValue)(0, 0, attributeVal));
  5558. break;
  5559.  
  5560. default :
  5561. break;
  5562. }
  5563. level = theGame.params.GetItemLevel(itemCategory, itemAttributes, itemName, baseLevel);
  5564.  
  5565. if ( itemQuality == 5 ) level = level - 2;
  5566. if ( itemQuality == 4 ) level = level - 1;
  5567. if ( dm.ItemHasTag(itemName, 'OlgierdSabre') ) level = level - 3;
  5568. if ( (itemQuality == 4 || itemQuality == 5) && dm.ItemHasTag(itemName, 'EP1') ) level = level - 1;
  5569. if ( level < 1 ) level = 1;
  5570.  
  5571. if( dm.ItemHasTag(itemName, 'LightArmor') )
  5572. levelDiff = 40;
  5573. else
  5574. if( dm.ItemHasTag(itemName, 'MediumArmor') )
  5575. levelDiff = 60;
  5576. else
  5577. levelDiff = 90;
  5578.  
  5579. if( dm.ItemHasTag(itemName, 'Wooden') )
  5580. levelDiff = 40;
  5581. else
  5582. if( dm.ItemHasTag(itemName, 'DamagedWeapon') )
  5583. levelDiff = 55;
  5584. else
  5585. if( dm.ItemHasTag(itemName, 'TypeBattleaxe') )
  5586. levelDiff = 100;
  5587. else
  5588. if( dm.ItemHasTag(itemName, 'TypeBattlemace') )
  5589. levelDiff = 95;
  5590. else
  5591. if( dm.ItemHasTag(itemName, 'SecondaryWeapon') )
  5592. levelDiff = 78;
  5593.  
  5594. if( itemName == 'Aerondight EP2' )
  5595. levelDiff = 95;
  5596.  
  5597. switch( itemQuality )
  5598. {
  5599. case 1: levelDiff -= 7; break;
  5600. case 2: levelDiff -= 5; break;
  5601. case 3: levelDiff -= 3; break;
  5602. }
  5603.  
  5604. levelDiff -= level;
  5605.  
  5606. switch(itemCategory)
  5607. {
  5608. //Kolaris - Armor System
  5609. /*case 'armor' :
  5610. for(i=0; i<levelDiff; i+=1)
  5611. attributeVal += 5;
  5612. break;
  5613.  
  5614. case 'boots' :
  5615. for(i=0; i<levelDiff; i+=1)
  5616. attributeVal += 2;
  5617. break;
  5618.  
  5619. case 'gloves' :
  5620. for(i=0; i<levelDiff; i+=1)
  5621. attributeVal += 2;
  5622. break;
  5623.  
  5624. case 'pants' :
  5625. for(i=0; i<levelDiff; i+=1)
  5626. attributeVal += 2;
  5627. break;*/
  5628.  
  5629. case 'silversword' :
  5630. for(i=0; i<levelDiff; i+=1)
  5631. attributeVal += 10;
  5632. break;
  5633.  
  5634. case 'steelsword' :
  5635. for(i=0; i<levelDiff; i+=1)
  5636. attributeVal += 8;
  5637. break;
  5638. }
  5639. }
  5640.  
  5641. public function IsPrimaryStatById(itemId : SItemUniqueId, attributeName : name, out attributeLabel : string) : bool
  5642. {
  5643. var attrValue : float;
  5644. var attrName : name;
  5645.  
  5646. GetItemPrimaryStatImplById(itemId, attributeLabel, attrValue, attrName);
  5647. return attrName == attributeName;
  5648. }
  5649.  
  5650. private function GetItemPrimaryStatImplById(itemId : SItemUniqueId, out attributeLabel : string, out attributeVal : float, out attributeName : name ) : void
  5651. {
  5652. var itemOnSlot : SItemUniqueId;
  5653. var categoryName : name;
  5654. var abList : array<name>;
  5655.  
  5656. attributeName = '';
  5657. attributeLabel = "";
  5658. categoryName = GetItemCategory(itemId);
  5659.  
  5660.  
  5661. if (categoryName == 'bolt' || categoryName == 'petard')
  5662. {
  5663. GetItemAttributes(itemId, abList);
  5664. if (abList.Contains('FireDamage'))
  5665. {
  5666. attributeName = 'FireDamage';
  5667. }
  5668. else if (abList.Contains('PiercingDamage'))
  5669. {
  5670. attributeName = 'PiercingDamage';
  5671. }
  5672. else if (abList.Contains('PiercingDamage'))
  5673. {
  5674. attributeName = 'PiercingDamage';
  5675. }
  5676. else if (abList.Contains('PoisonDamage'))
  5677. {
  5678. attributeName = 'PoisonDamage';
  5679. }
  5680. else if (abList.Contains('BludgeoningDamage'))
  5681. {
  5682. attributeName = 'BludgeoningDamage';
  5683. }
  5684. else
  5685. {
  5686. attributeName = 'PhysicalDamage';
  5687. }
  5688. attributeLabel = GetAttributeNameLocStr(attributeName, false);
  5689. }
  5690. else if (categoryName == 'secondary')
  5691. {
  5692. GetItemAttributes(itemId, abList);
  5693. if (abList.Contains('BludgeoningDamage'))
  5694. {
  5695. attributeName = 'BludgeoningDamage';
  5696. }
  5697. else
  5698. {
  5699. attributeName = 'PhysicalDamage';
  5700. }
  5701. attributeLabel = GetAttributeNameLocStr(attributeName, false);
  5702. }
  5703. else if (categoryName == 'steelsword')
  5704. {
  5705. GetItemAttributes(itemId, abList);
  5706. if (abList.Contains('SlashingDamage'))
  5707. {
  5708. attributeName = 'SlashingDamage';
  5709. attributeLabel = GetLocStringByKeyExt("panel_inventory_tooltip_damage");
  5710. }
  5711. else if (abList.Contains('BludgeoningDamage'))
  5712. {
  5713. attributeName = 'BludgeoningDamage';
  5714. }
  5715. else if (abList.Contains('PiercingDamage'))
  5716. {
  5717. attributeName = 'PiercingDamage';
  5718. }
  5719. else
  5720. {
  5721. attributeName = 'PhysicalDamage';
  5722. }
  5723. if (attributeLabel == "")
  5724. {
  5725. attributeLabel = GetAttributeNameLocStr(attributeName, false);
  5726. }
  5727. }
  5728. else
  5729. {
  5730. GetItemPrimaryStatImpl(categoryName, attributeLabel, attributeVal, attributeName);
  5731. }
  5732. }
  5733.  
  5734. public function IsPrimaryStat(categoryName : name, attributeName : name, out attributeLabel : string) : bool
  5735. {
  5736. var attrValue : float;
  5737. var attrName : name;
  5738.  
  5739. GetItemPrimaryStatImpl(categoryName, attributeLabel, attrValue, attrName);
  5740. return attrName == attributeName;
  5741. }
  5742.  
  5743. private function GetItemPrimaryStatImpl(categoryName : name, out attributeLabel : string, out attributeVal : float, out attributeName : name ) : void
  5744. {
  5745. attributeName = '';
  5746. attributeLabel = "";
  5747. switch (categoryName)
  5748. {
  5749. case 'steelsword':
  5750. attributeName = 'SlashingDamage';
  5751. attributeLabel = GetLocStringByKeyExt("panel_inventory_tooltip_damage");
  5752. break;
  5753. case 'silversword':
  5754. attributeName = 'SilverDamage';
  5755. attributeLabel = GetLocStringByKeyExt("panel_inventory_tooltip_damage");
  5756. break;
  5757. case 'armor':
  5758. case 'gloves':
  5759. case 'gloves':
  5760. case 'boots':
  5761. case 'pants':
  5762. attributeName = 'armor';
  5763. break;
  5764. case 'potion':
  5765. case 'oil':
  5766.  
  5767. break;
  5768. case 'bolt':
  5769. case 'petard':
  5770. attributeName = 'PhysicalDamage';
  5771. break;
  5772. case 'crossbow':
  5773. default:
  5774. attributeLabel = "";
  5775. attributeVal = 0;
  5776. return;
  5777. break;
  5778. }
  5779.  
  5780. if (attributeLabel == "")
  5781. {
  5782. attributeLabel = GetAttributeNameLocStr(attributeName, false);
  5783. }
  5784. }
  5785.  
  5786. public function CanBeCompared(itemId : SItemUniqueId) : bool
  5787. {
  5788. var wplayer : W3PlayerWitcher;
  5789. var itemSlot : EEquipmentSlots;
  5790. var equipedItem : SItemUniqueId;
  5791. var horseManager : W3HorseManager;
  5792.  
  5793. var isArmorOrWeapon : bool;
  5794.  
  5795. if (IsItemHorseItem(itemId))
  5796. {
  5797. horseManager = GetWitcherPlayer().GetHorseManager();
  5798.  
  5799. if (!horseManager)
  5800. {
  5801. return false;
  5802. }
  5803.  
  5804. if (horseManager.IsItemEquipped(itemId))
  5805. {
  5806. return false;
  5807. }
  5808.  
  5809. itemSlot = GetHorseSlotForItem(itemId);
  5810. equipedItem = horseManager.GetItemInSlot(itemSlot);
  5811. if (!horseManager.GetInventoryComponent().IsIdValid(equipedItem))
  5812. {
  5813. return false;
  5814. }
  5815. }
  5816. else
  5817. {
  5818. isArmorOrWeapon = IsItemAnyArmor(itemId) || IsItemWeapon(itemId);
  5819. if (!isArmorOrWeapon)
  5820. {
  5821. return false;
  5822. }
  5823.  
  5824. wplayer = GetWitcherPlayer();
  5825. if (wplayer.IsItemEquipped(itemId))
  5826. {
  5827. return false;
  5828. }
  5829.  
  5830. itemSlot = GetSlotForItemId(itemId);
  5831. wplayer.GetItemEquippedOnSlot(itemSlot, equipedItem);
  5832. if (!wplayer.inv.IsIdValid(equipedItem))
  5833. {
  5834. return false;
  5835. }
  5836. }
  5837.  
  5838. return true;
  5839. }
  5840.  
  5841. public function GetHorseSlotForItem(id : SItemUniqueId) : EEquipmentSlots
  5842. {
  5843. var tags : array<name>;
  5844.  
  5845. GetItemTags(id, tags);
  5846.  
  5847. if(tags.Contains('Saddle')) return EES_HorseSaddle;
  5848. else if(tags.Contains('HorseBag')) return EES_HorseBag;
  5849. else if(tags.Contains('Trophy')) return EES_HorseTrophy;
  5850. else if(tags.Contains('Blinders')) return EES_HorseBlinders;
  5851. else return EES_InvalidSlot;
  5852. }
  5853.  
  5854. public final function SingletonItemRefillAmmo( id : SItemUniqueId, optional alchemyTableUsed : bool )
  5855. {
  5856. // W3EE - Begin
  5857. /*
  5858. var l_bed : W3WitcherBed;
  5859. var refilledByBed : bool;
  5860.  
  5861. refilledByBed = false;
  5862.  
  5863.  
  5864. if( FactsQuerySum( "PlayerInsideOuterWitcherHouse" ) >= 1 && FactsQuerySum( "AlchemyTableExists" ) >= 1 && !IsItemMutagenPotion( id ) )
  5865. {
  5866. l_bed = (W3WitcherBed)theGame.GetEntityByTag( 'witcherBed' );
  5867.  
  5868. if( l_bed.GetWasUsed() || alchemyTableUsed )
  5869. {
  5870. SetItemModifierInt( id, 'ammo_current', SingletonItemGetMaxAmmo(id) + theGame.params.QUANTITY_INCREASED_BY_ALCHEMY_TABLE ) ;
  5871. refilledByBed = true;
  5872. if( !l_bed.GetWereItemsRefilled() )
  5873. {
  5874. l_bed.SetWereItemsRefilled( true );
  5875. }
  5876. }
  5877. }
  5878.  
  5879.  
  5880. if( !refilledByBed && SingletonItemGetAmmo( id ) < SingletonItemGetMaxAmmo( id ) )
  5881. {
  5882. SetItemModifierInt(id, 'ammo_current', SingletonItemGetMaxAmmo(id));
  5883. }
  5884.  
  5885. SetItemModifierInt(id, 'ammo_current', SingletonItemGetMaxAmmo(id));
  5886.  
  5887.  
  5888. theGame.GetGlobalEventsManager().OnScriptedEvent( SEC_OnAmmoChanged );
  5889. */
  5890. // W3EE - End
  5891. }
  5892.  
  5893. public function SingletonItemSetAmmo(id : SItemUniqueId, quantity : int)
  5894. {
  5895. // W3EE - Begin
  5896.  
  5897. var amount : int;
  5898. /*
  5899. if(ItemHasTag(id, theGame.params.TAG_INFINITE_AMMO))
  5900. {
  5901. amount = -1;
  5902. }
  5903. else
  5904. {
  5905. amount = Clamp(quantity, 0, SingletonItemGetMaxAmmo(id));
  5906. }
  5907.  
  5908. SetItemModifierInt(id, 'ammo_current', amount);
  5909. theGame.GetGlobalEventsManager().OnScriptedEvent( SEC_OnAmmoChanged );
  5910. */
  5911.  
  5912. SetItemModifierInt(id, 'ammo_current', Max(SingletonItemGetAmmo(id), 0));
  5913. SingletonItemAddAmmo(id, quantity);
  5914. // W3EE - End
  5915. }
  5916.  
  5917. public function SingletonItemAddAmmo(id : SItemUniqueId, quantity : int)
  5918. {
  5919. var ammo : int;
  5920.  
  5921. if(quantity <= 0)
  5922. return;
  5923.  
  5924. ammo = GetItemModifierInt(id, 'ammo_current');
  5925.  
  5926. if(ammo == -1)
  5927. return;
  5928.  
  5929. // W3EE - Begin
  5930. //ammo = Clamp(ammo + quantity, 0, SingletonItemGetMaxAmmo(id));
  5931. ammo += quantity;
  5932. // W3EE - End
  5933. SetItemModifierInt(id, 'ammo_current', ammo);
  5934. theGame.GetGlobalEventsManager().OnScriptedEvent( SEC_OnAmmoChanged );
  5935. }
  5936.  
  5937. public function SingletonItemsRefillAmmo( optional alchemyTableUsed : bool ) : bool
  5938. {
  5939. var i : int;
  5940. var singletonItems : array<SItemUniqueId>;
  5941. var alco : SItemUniqueId;
  5942. var arrStr : array<string>;
  5943. var witcher : W3PlayerWitcher;
  5944. var itemLabel : string;
  5945.  
  5946. witcher = GetWitcherPlayer();
  5947. if(GetEntity() == witcher && HasNotFilledSingletonItem( alchemyTableUsed ) )
  5948. {
  5949. alco = witcher.GetAlcoholForAlchemicalItemsRefill();
  5950.  
  5951. if(!IsIdValid(alco))
  5952. {
  5953.  
  5954. theGame.GetGuiManager().ShowNotification(GetLocStringByKeyExt("message_common_alchemy_items_cannot_refill"));
  5955. theSound.SoundEvent("gui_global_denied");
  5956.  
  5957. return false;
  5958. }
  5959. else
  5960. {
  5961.  
  5962. arrStr.PushBack(GetItemName(alco));
  5963. itemLabel = GetItemLocNameByID(alco);
  5964. theGame.GetGuiManager().ShowNotification( itemLabel + " - " + GetLocStringByKeyExtWithParams("message_common_alchemy_items_refilled", , , arrStr));
  5965. theSound.SoundEvent("gui_alchemy_brew");
  5966.  
  5967. if(!ItemHasTag(alco, theGame.params.TAG_INFINITE_USE))
  5968. RemoveItem(alco);
  5969. }
  5970. }
  5971.  
  5972. singletonItems = GetSingletonItems();
  5973. for(i=0; i<singletonItems.Size(); i+=1)
  5974. {
  5975. SingletonItemRefillAmmo( singletonItems[i], alchemyTableUsed );
  5976. }
  5977.  
  5978. return true;
  5979. }
  5980.  
  5981. public function SingletonItemsRefillAmmoNoAlco(optional dontUpdateUI : bool)
  5982. {
  5983. var i : int;
  5984. var singletonItems : array<SItemUniqueId>;
  5985. var alco : SItemUniqueId;
  5986. var arrStr : array<string>;
  5987. var witcher : W3PlayerWitcher;
  5988. var itemLabel : string;
  5989.  
  5990. witcher = GetWitcherPlayer();
  5991. if(!dontUpdateUI && GetEntity() == witcher && HasNotFilledSingletonItem())
  5992. {
  5993.  
  5994. arrStr.PushBack(GetItemName(alco));
  5995. itemLabel = GetItemLocNameByID(alco);
  5996. theGame.GetGuiManager().ShowNotification( itemLabel + " - " + GetLocStringByKeyExtWithParams("message_common_alchemy_items_refilled", , , arrStr));
  5997. theSound.SoundEvent("gui_alchemy_brew");
  5998. }
  5999.  
  6000. singletonItems = GetSingletonItems();
  6001. for(i=0; i<singletonItems.Size(); i+=1)
  6002. {
  6003. SingletonItemRefillAmmo(singletonItems[i]);
  6004. }
  6005. }
  6006.  
  6007.  
  6008. private final function HasNotFilledSingletonItem( optional alchemyTableUsed : bool ) : bool
  6009. {
  6010. var i : int;
  6011. var singletonItems : array<SItemUniqueId>;
  6012. var hasLab : bool;
  6013. var l_bed : W3WitcherBed;
  6014.  
  6015.  
  6016. hasLab = false;
  6017. if( FactsQuerySum( "PlayerInsideOuterWitcherHouse" ) >= 1 && FactsQuerySum( "AlchemyTableExists" ) >= 1 )
  6018. {
  6019. l_bed = (W3WitcherBed)theGame.GetEntityByTag( 'witcherBed' );
  6020. if( l_bed.GetWasUsed() || alchemyTableUsed )
  6021. {
  6022. hasLab = true;
  6023. }
  6024. }
  6025.  
  6026. singletonItems = GetSingletonItems();
  6027. for(i=0; i<singletonItems.Size(); i+=1)
  6028. {
  6029. if( hasLab && !IsItemMutagenPotion( singletonItems[i] ) )
  6030. {
  6031. if(SingletonItemGetAmmo(singletonItems[i]) <= SingletonItemGetMaxAmmo(singletonItems[i]))
  6032. {
  6033. return true;
  6034. }
  6035. }
  6036. else if(SingletonItemGetAmmo(singletonItems[i]) < SingletonItemGetMaxAmmo(singletonItems[i]))
  6037. {
  6038. return true;
  6039. }
  6040. }
  6041.  
  6042. return false;
  6043. }
  6044.  
  6045. public function SingletonItemRemoveAmmo(itemID : SItemUniqueId, optional quantity : int)
  6046. {
  6047. var ammo : int;
  6048.  
  6049. if(!IsItemSingletonItem(itemID) || ItemHasTag(itemID, theGame.params.TAG_INFINITE_AMMO))
  6050. return;
  6051.  
  6052. if(quantity <= 0)
  6053. quantity = 1;
  6054.  
  6055. ammo = GetItemModifierInt(itemID, 'ammo_current');
  6056. ammo = Max(0, ammo - quantity);
  6057. SetItemModifierInt(itemID, 'ammo_current', ammo);
  6058.  
  6059.  
  6060. if(ammo == 0 && ShouldProcessTutorial('TutorialAlchemyRefill') && FactsQuerySum("q001_nightmare_ended") > 0)
  6061. {
  6062. FactsAdd('tut_alch_refill', 1);
  6063. }
  6064.  
  6065. if( ammo <= 0 && IsItemPotion(itemID) )
  6066. {
  6067. if( GetWitcherPlayer().GetItemSlot(itemID) != EES_InvalidSlot )
  6068. GetWitcherPlayer().UnequipItem(itemID);
  6069. RemoveItem(itemID, 1);
  6070. }
  6071.  
  6072. theGame.GetGlobalEventsManager().OnScriptedEvent( SEC_OnAmmoChanged );
  6073. }
  6074.  
  6075. public function SingletonItemGetAmmo(itemID : SItemUniqueId) : int
  6076. {
  6077. if(!IsItemSingletonItem(itemID))
  6078. return 0;
  6079.  
  6080. return GetItemModifierInt(itemID, 'ammo_current');
  6081. }
  6082.  
  6083. public function SingletonItemGetMaxAmmo(itemID : SItemUniqueId) : int
  6084. {
  6085. var ammo, i : int;
  6086.  
  6087. return ammo;
  6088. }
  6089.  
  6090. public function ManageSingletonItemsBonus()
  6091. {
  6092. var l_items : array<SItemUniqueId>;
  6093. var l_i : int;
  6094. var l_haveBombOrPot : bool;
  6095.  
  6096. l_items = GetSingletonItems();
  6097.  
  6098. for( l_i = 0 ; l_i < l_items.Size() ; l_i += 1 )
  6099. {
  6100. if( IsItemPotion( l_items[ l_i ] ) || IsItemBomb( l_items[ l_i ] ) )
  6101. {
  6102. l_haveBombOrPot = true;
  6103. if( SingletonItemGetMaxAmmo( l_items[ l_i ] ) >= SingletonItemGetAmmo( l_items[ l_i ] ) )
  6104. {
  6105. if( SingletonItemsRefillAmmo( true ) )
  6106. {
  6107. theGame.GetGuiManager().ShowNotification( GetLocStringByKeyExt( "message_common_alchemy_table_buff_applied" ),, true );
  6108. }
  6109.  
  6110. return;
  6111. }
  6112. }
  6113. }
  6114.  
  6115. if( !l_haveBombOrPot )
  6116. {
  6117. theGame.GetGuiManager().ShowNotification( GetLocStringByKeyExt( "message_common_alchemy_table_buff_no_items" ),, true );
  6118. return;
  6119. }
  6120.  
  6121. theGame.GetGuiManager().ShowNotification( GetLocStringByKeyExt( "message_common_alchemy_table_buff_already_on" ),, true );
  6122. }
  6123.  
  6124.  
  6125.  
  6126.  
  6127.  
  6128. public final function IsItemSteelSwordUsableByPlayer(item : SItemUniqueId) : bool
  6129. {
  6130. return ItemHasTag(item, theGame.params.TAG_PLAYER_STEELSWORD) && !ItemHasTag(item, 'SecondaryWeapon');
  6131. }
  6132.  
  6133. public final function IsItemSilverSwordUsableByPlayer(item : SItemUniqueId) : bool
  6134. {
  6135. return ItemHasTag(item, theGame.params.TAG_PLAYER_SILVERSWORD) && !ItemHasTag(item, 'SecondaryWeapon');
  6136. }
  6137.  
  6138. public final function IsItemFists(item : SItemUniqueId) : bool {return GetItemCategory(item) == 'fist';}
  6139. public final function IsItemWeapon(item : SItemUniqueId) : bool {return ItemHasTag(item, 'Weapon') || ItemHasTag(item, 'WeaponTab');}
  6140. public final function IsItemCrossbow(item : SItemUniqueId) : bool {return GetItemCategory(item) == 'crossbow';}
  6141. public final function IsItemChestArmor(item : SItemUniqueId) : bool {return GetItemCategory(item) == 'armor';}
  6142. public final function IsItemBody(item : SItemUniqueId) : bool {return ItemHasTag(item, 'Body');}
  6143. public final function IsRecipeOrSchematic( item : SItemUniqueId ) : bool {return GetItemCategory(item) == 'alchemy_recipe' || GetItemCategory(item) == 'crafting_schematic'; }
  6144. public final function IsItemBoots(item : SItemUniqueId) : bool {return GetItemCategory(item) == 'boots';}
  6145. public final function IsItemGloves(item : SItemUniqueId) : bool {return GetItemCategory(item) == 'gloves';}
  6146. public final function IsItemPants(item : SItemUniqueId) : bool {return GetItemCategory(item) == 'trousers' || GetItemCategory(item) == 'pants';}
  6147. public final function IsItemTrophy(item : SItemUniqueId) : bool {return GetItemCategory(item) == 'trophy';}
  6148. public final function IsItemMask(item : SItemUniqueId) : bool {return GetItemCategory(item) == 'mask';}
  6149. public final function IsItemBomb(item : SItemUniqueId) : bool {return GetItemCategory(item) == 'petard';}
  6150. public final function IsItemBolt(item : SItemUniqueId) : bool {return GetItemCategory(item) == 'bolt';}
  6151. public final function IsItemUpgrade(item : SItemUniqueId) : bool {return GetItemCategory(item) == 'upgrade';}
  6152. public final function IsItemTool(item : SItemUniqueId) : bool {return GetItemCategory(item) == 'tool';}
  6153. // W3EE - Begin
  6154. public final function IsItemPotion(item : SItemUniqueId) : bool {return ItemHasTag(item, 'Potion') && !IsItemFood(item);}
  6155. public final function IsItemJewelry(item : SItemUniqueId) : bool {return ItemHasTag(item, 'jewelry');}
  6156. public final function IsItemAlchemicalAlcohol( item : SItemUniqueId ) : bool {return ItemHasTag(item, 'StrongAlcohol');}
  6157. public final function IsItemHerb( item : SItemUniqueId ) : bool {return ItemHasTag(item, 'primer_herb');}
  6158. public final function IsItemMonsterPart( item : SItemUniqueId ) : bool {return ItemHasTag(item, 'primer_monstrous');}
  6159. public final function IsItemMineral( item : SItemUniqueId ) : bool {return ItemHasTag(item, 'primer_mineral');}
  6160. public final function IsItemMoney( item : SItemUniqueId ) : bool {return ItemHasTag(item, 'crowns') || ItemHasTag(item, 'florens') || ItemHasTag(item, 'orens');}
  6161. public final function IsItemUniqueMutagen( item : SItemUniqueId ) : bool {return ItemHasTag(item, 'MutagenIngredient') && !ItemHasTag(item, 'InertMutagen');}
  6162. public final function IsItemInertMutagen( item : SItemUniqueId ) : bool {return ItemHasTag(item, 'InertMutagen');}
  6163. // W3EE - End
  6164. public final function IsItemOil(item : SItemUniqueId) : bool {return ItemHasTag(item, 'SilverOil') || ItemHasTag(item, 'SteelOil');}
  6165. public final function IsItemAnyArmor(item : SItemUniqueId) : bool {return ItemHasTag(item, theGame.params.TAG_ARMOR);}
  6166. public final function IsItemUpgradeable(item : SItemUniqueId) : bool {return ItemHasTag(item, theGame.params.TAG_ITEM_UPGRADEABLE);}
  6167. public final function IsItemIngredient(item : SItemUniqueId) : bool {return ItemHasTag(item, 'AlchemyIngredient') || ItemHasTag(item, 'CraftingIngredient');}
  6168. public final function IsItemDismantleKit(item : SItemUniqueId) : bool {return ItemHasTag(item, 'DismantleKit');}
  6169. public final function IsItemHorseBag(item : SItemUniqueId) : bool {return ItemHasTag(item, 'HorseBag');}
  6170. public final function IsItemReadable(item : SItemUniqueId) : bool {return ItemHasTag(item, 'ReadableItem');}
  6171. public final function IsItemAlchemyItem(item : SItemUniqueId) : bool {return IsItemOil(item) || IsItemPotion(item) || IsItemBomb(item); }
  6172. public final function IsItemSingletonItem(item : SItemUniqueId) : bool {return ItemHasTag(item, theGame.params.TAG_ITEM_SINGLETON);}
  6173. public final function IsItemQuest(item : SItemUniqueId) : bool {return ItemHasTag(item, 'Quest');}
  6174. public final function IsItemFood(item : SItemUniqueId) : bool {return ItemHasTag(item, 'Edibles') || ItemHasTag(item, 'Drinks');}
  6175. public final function IsItemSecondaryWeapon(item : SItemUniqueId) : bool {return ItemHasTag(item, 'SecondaryWeapon');}
  6176. public final function IsItemHorseItem(item: SItemUniqueId) : bool {return ItemHasTag(item, 'Saddle') || ItemHasTag(item, 'HorseBag') || ItemHasTag(item, 'Trophy') || ItemHasTag(item, 'Blinders'); }
  6177. public final function IsItemSaddle(item: SItemUniqueId) : bool {return ItemHasTag(item, 'Saddle');}
  6178. public final function IsItemBlinders(item: SItemUniqueId) : bool {return ItemHasTag(item, 'Blinders');}
  6179. public final function IsItemDye( item : SItemUniqueId ) : bool { return ItemHasTag( item, 'mod_dye' ); }
  6180. public final function IsItemUsable( item : SItemUniqueId ) : bool { return GetItemCategory( item ) == 'usable'; }
  6181. public final function IsItemJunk( item : SItemUniqueId ) : bool { return ItemHasTag( item,'junk' ) || GetItemCategory( item ) == 'junk' ; }
  6182. public final function IsItemAlchemyIngredient(item : SItemUniqueId) : bool { return ItemHasTag( item, 'AlchemyIngredient' ); }
  6183. public final function IsItemCraftingIngredient(item : SItemUniqueId) : bool { return ItemHasTag( item, 'CraftingIngredient' ); }
  6184. public final function IsItemArmorReapairKit(item : SItemUniqueId) : bool { return ItemHasTag( item, 'ArmorReapairKit' ); }
  6185. public final function IsItemWeaponReapairKit(item : SItemUniqueId) : bool { return ItemHasTag( item, 'WeaponReapairKit' ); }
  6186. public final function IsQuickSlotItem( item : SItemUniqueId ) : bool { return ItemHasTag( item, 'QuickSlot' ); }
  6187.  
  6188. public function ShouldHorseLootItem( item : SItemUniqueId ) : bool
  6189. {
  6190. return Options().HorseDestination() && (IsItemJunk(item) || IsItemAlchemyIngredient(item) || IsItemCraftingIngredient(item) || IsItemWeapon(item) || IsItemUpgrade(item) || IsItemMoney(item) || IsItemChestArmor(item) || IsItemBoots(item) || IsItemPants(item) || IsItemGloves(item)) && !ItemHasTag(item, 'Artifact_weapon') && !ItemHasTag(item, 'ThrowingKnife') && !ItemHasTag(item, 'FancyClothes') && !IsItemUniqueMutagen(item) && !IsItemQuest(item);
  6191. }
  6192.  
  6193. public final function IsItemNew( item : SItemUniqueId ) : bool
  6194. {
  6195. var uiData : SInventoryItemUIData;
  6196.  
  6197. uiData = GetInventoryItemUIData( item );
  6198. return uiData.isNew;
  6199. }
  6200.  
  6201. public final function IsItemMutagenPotion(item : SItemUniqueId) : bool
  6202. {
  6203. return IsItemPotion(item) && ItemHasTag(item, 'Decoction');
  6204. }
  6205.  
  6206. public final function CanItemBeColored( item : SItemUniqueId) : bool
  6207. {
  6208. if ( RoundMath( CalculateAttributeValue( GetItemAttributeValue( item, 'quality' ) ) ) == 5 )
  6209. {
  6210. return true;
  6211. }
  6212. return false;
  6213. }
  6214.  
  6215. public final function IsItemGrandmasterItem( item : SItemUniqueId ) : bool
  6216. {
  6217. return ItemHasTag(item, theGame.params.ITEM_SET_TAG_BONUS);
  6218. }
  6219.  
  6220. //Kolaris - Armor Set Bonus Setup
  6221. public final function IsItemSetItem(item : SItemUniqueId) : bool
  6222. {
  6223. return
  6224. ItemHasTag(item, theGame.params.ITEM_SET_TAG_BEAR) ||
  6225. ItemHasTag(item, theGame.params.ITEM_SET_TAG_GRYPHON) ||
  6226. ItemHasTag(item, theGame.params.ITEM_SET_TAG_LYNX) ||
  6227. ItemHasTag(item, theGame.params.ITEM_SET_TAG_WOLF) ||
  6228. ItemHasTag(item, theGame.params.ITEM_SET_TAG_RED_WOLF) ||
  6229. ItemHasTag( item, theGame.params.ITEM_SET_TAG_VAMPIRE ) ||
  6230. ItemHasTag(item, theGame.params.ITEM_SET_TAG_VAMPIRE_ALT) ||
  6231. ItemHasTag(item, theGame.params.ITEM_SET_TAG_TEMERIAN) ||
  6232. ItemHasTag(item, theGame.params.ITEM_SET_TAG_NILFGAARD) ||
  6233. ItemHasTag(item, theGame.params.ITEM_SET_TAG_SKELLIGE) ||
  6234. ItemHasTag(item, theGame.params.ITEM_SET_TAG_OFIERI) ||
  6235. ItemHasTag(item, theGame.params.ITEM_SET_TAG_NEW_MOON) ||
  6236. ItemHasTag(item, theGame.params.ITEM_SET_TAG_GOTHIC) ||
  6237. ItemHasTag(item, theGame.params.ITEM_SET_TAG_DIMERITIUM) ||
  6238. ItemHasTag(item, theGame.params.ITEM_SET_TAG_METEORITE) ||
  6239. ItemHasTag(item, theGame.params.ITEM_SET_TAG_NETFLIX) ||
  6240. ItemHasTag(item, theGame.params.ITEM_SET_TAG_ELVEN) ||
  6241. ItemHasTag(item, theGame.params.ITEM_SET_TAG_TIGER);
  6242. }
  6243.  
  6244. // W3EE - Begin
  6245. public function GetArmorType(item : SItemUniqueId) : EArmorType
  6246. {
  6247. var isItemEquipped : bool;
  6248.  
  6249. isItemEquipped = GetWitcherPlayer().IsItemEquipped(item);
  6250.  
  6251. //Kolaris - Remove Old Enchantments
  6252. /*if( thePlayer.HasAbility('Glyphword 9 _Stats', true) && isItemEquipped )
  6253. {
  6254. if (ItemHasTag(item, 'HeavyArmor')) return EAT_Medium;
  6255. if (ItemHasTag(item, 'MediumArmor')) return EAT_Light;
  6256. }
  6257.  
  6258. if( thePlayer.HasAbility('Glyphword 2 _Stats', true) && isItemEquipped )
  6259. {return EAT_Light;}
  6260. if( thePlayer.HasAbility('Glyphword 3 _Stats', true) && isItemEquipped )
  6261. {return EAT_Medium;}
  6262. if( thePlayer.HasAbility('Glyphword 4 _Stats', true) && isItemEquipped )
  6263. {return EAT_Heavy;}*/
  6264.  
  6265. if(ItemHasTag(item, 'LightArmor'))
  6266. return EAT_Light;
  6267. else if(ItemHasTag(item, 'MediumArmor'))
  6268. return EAT_Medium;
  6269. else if(ItemHasTag(item, 'HeavyArmor'))
  6270. return EAT_Heavy;
  6271.  
  6272. return EAT_Undefined;
  6273. }
  6274.  
  6275. public function GetArmorTypeOriginal( item : SItemUniqueId ) : EArmorType
  6276. {
  6277. var isItemEquipped : bool;
  6278.  
  6279. if(ItemHasTag(item, 'LightArmor'))
  6280. return EAT_Light;
  6281. else if(ItemHasTag(item, 'MediumArmor'))
  6282. return EAT_Medium;
  6283. else if(ItemHasTag(item, 'HeavyArmor'))
  6284. return EAT_Heavy;
  6285.  
  6286. return EAT_Undefined;
  6287. }
  6288. // W3EE - End
  6289.  
  6290. public final function GetAlchemyCraftableItems() : array<SItemUniqueId>
  6291. {
  6292. var items : array<SItemUniqueId>;
  6293. var i : int;
  6294.  
  6295. GetAllItems(items);
  6296.  
  6297. for(i=items.Size()-1; i>=0; i-=1)
  6298. {
  6299. if(!IsItemPotion(items[i]) && !IsItemBomb(items[i]) && !IsItemOil(items[i]))
  6300. items.EraseFast(i);
  6301. }
  6302.  
  6303. return items;
  6304. }
  6305.  
  6306. public function IsItemEncumbranceItem(item : SItemUniqueId) : bool
  6307. {
  6308. // W3EE - Begin
  6309. if( GetItemName(item) == 'Crowns' )
  6310. return true;
  6311. // W3EE - End
  6312.  
  6313. if(ItemHasTag(item, theGame.params.TAG_ENCUMBRANCE_ITEM_FORCE_YES))
  6314. return true;
  6315.  
  6316. if(ItemHasTag(item, theGame.params.TAG_ENCUMBRANCE_ITEM_FORCE_NO))
  6317. return false;
  6318.  
  6319. //Kolaris - Fixed Stashes
  6320. if (IsRecipeOrSchematic( item ) || IsItemBody( item ) || ItemHasTag( item, 'NoShow' ))
  6321. return false;
  6322.  
  6323. return true;
  6324. }
  6325.  
  6326. public function GetItemEncumbrance(item : SItemUniqueId, optional quantity : int) : float
  6327. {
  6328. var itemCategory : name;
  6329. var weight : float;
  6330. var armorEquipped : SItemUniqueId;
  6331.  
  6332. if( !quantity )
  6333. {
  6334. if( !IsItemSingletonItem(item) )
  6335. quantity = GetItemQuantity(item);
  6336. else
  6337. quantity = SingletonItemGetAmmo(item);
  6338. }
  6339. //Kolaris - Armor Encumbrance
  6340. if ( IsItemEncumbranceItem( item ) )
  6341. {
  6342. weight = GetItemWeight( item );
  6343. itemCategory = GetItemCategory( item );
  6344.  
  6345. if ( GetItemName( item ) == 'Crowns' || GetItemName( item ) == 'Florens' || GetItemName( item ) == 'Orens' )
  6346. {
  6347. if( Options().WeightMoney() )
  6348. return 0.01 * quantity;
  6349. else
  6350. return 0;
  6351. }
  6352. else if ( itemCategory == 'armor' )
  6353. {
  6354. if( GetItemEquippedOnSlot( EES_Armor, armorEquipped ) && item == armorEquipped )
  6355.  
  6356. return weight * 0.5;
  6357.  
  6358. else
  6359. return weight;
  6360. }
  6361. else if ( itemCategory == 'boots' )
  6362. {
  6363. if( GetItemEquippedOnSlot( EES_Boots, armorEquipped ) && item == armorEquipped )
  6364.  
  6365. return weight * 0.5;
  6366.  
  6367. else
  6368. return weight;
  6369. }
  6370. else if ( itemCategory == 'gloves' )
  6371. {
  6372. if( GetItemEquippedOnSlot( EES_Gloves, armorEquipped ) && item == armorEquipped )
  6373.  
  6374. return weight * 0.5;
  6375.  
  6376. else
  6377. return weight;
  6378. }
  6379. else if ( itemCategory == 'pants' )
  6380. {
  6381. if( GetItemEquippedOnSlot( EES_Pants, armorEquipped ) && item == armorEquipped )
  6382.  
  6383. return weight * 0.5;
  6384.  
  6385. else
  6386. return weight;
  6387. }
  6388. else if ( IsItemQuest( item ) )
  6389. {
  6390. if( Options().WeightQuest() )
  6391. {
  6392. if ( GetItemName( item ) == 'Geralt robbery mask' )
  6393. {
  6394. return 0;
  6395. }
  6396. else if( weight > 0.1 )
  6397. {
  6398. return weight * quantity;
  6399. }
  6400. else
  6401. {
  6402. return 0.1 * quantity;
  6403. }
  6404. }
  6405. else return 0;
  6406. }
  6407. else if ( IsItemCraftingIngredient( item ) )
  6408. {
  6409. if( Options().WeightCrafting() )
  6410. {
  6411. if( weight > 0.1 )
  6412. {
  6413. return weight * quantity;
  6414. }
  6415. else
  6416. {
  6417. return 0.1 * quantity;
  6418. }
  6419. }
  6420. else return 0;
  6421. }
  6422. else if ( IsItemAlchemyIngredient( item ) )
  6423. {
  6424. if( Options().WeightAlch() )
  6425. {
  6426. //Kolaris - Primary Essence Weight
  6427. if( ItemHasTag(item, 'primer_primary') || ItemHasTag(item, 'MutagenIngredient') )
  6428. {
  6429. return 0.01 * quantity;
  6430. }
  6431. else
  6432. if( weight > 0.1 )
  6433. {
  6434. return weight * quantity;
  6435. }
  6436. else
  6437. {
  6438. return 0.1 * quantity;
  6439. }
  6440. }
  6441. else
  6442. {
  6443. return 0;
  6444. }
  6445. }
  6446. else if ( IsItemSingletonItem( item ) && IsItemAlchemyItem( item ) )
  6447. {
  6448. if ( IsItemOil( item ) || IsItemPotion( item ) )
  6449. {
  6450. return 0.3 * quantity;
  6451. }
  6452. else
  6453. if( ItemHasTag(item, 'ThrowingKnife') )
  6454. {
  6455. return GetItemWeight(item) * quantity;
  6456. }
  6457. else if ( IsItemBomb( item ) )
  6458. {
  6459. //Kolaris - Delayed Charge, Kolaris - Cluster Bombs
  6460. return quantity * (1.f + 0.1f * GetWitcherPlayer().GetSkillLevel(S_Alchemy_s10) + 0.1f * GetWitcherPlayer().GetSkillLevel(S_Alchemy_s11));
  6461. }
  6462. }
  6463. else
  6464. {
  6465. if( Options().WeightMisc() )
  6466. {
  6467. if( weight > 0.1 )
  6468. {
  6469. return weight * quantity;
  6470. }
  6471. else
  6472. {
  6473. return 0.1 * quantity;
  6474. }
  6475. }
  6476. else
  6477. {
  6478. return 0;
  6479. }
  6480. }
  6481. }
  6482.  
  6483. return 0;
  6484. }
  6485.  
  6486. private function GetCurrentWeight() : float
  6487. {
  6488. var i: int;
  6489. var currWeight : float;
  6490. var items : array<SItemUniqueId>;
  6491.  
  6492. GetAllItems(items);
  6493. for(i=0; i<items.Size(); i+=1)
  6494. if( !(IsItemHorseItem(items[i]) && GetWitcherPlayer().GetHorseManager().IsItemEquipped(items[i])) && IsItemEncumbranceItem(items[i]) ) //Kolaris - Trophy Weight Fix
  6495. currWeight += GetItemEncumbrance( items[i] );
  6496.  
  6497. return currWeight;
  6498. }
  6499.  
  6500. public function HorseCanTakeItem( item : SItemUniqueId, quantity : int, otherInventory : CInventoryComponent ) : bool
  6501. {
  6502. var witcher : W3PlayerWitcher = GetWitcherPlayer();
  6503. var curWeight, maxWeight : int;
  6504.  
  6505. if( this != witcher.GetHorseManager().GetInventoryComponent() )
  6506. return false;
  6507.  
  6508. maxWeight = (int)CalculateAttributeValue(witcher.GetHorseManager().GetHorseAttributeValue('encumbrance', false)) + Options().BaseCWRoach();
  6509. curWeight = (int)GetCurrentWeight();
  6510. //Kolaris - Fixed Stashes
  6511. if( otherInventory.GetItemEncumbrance(item, quantity) + curWeight <= maxWeight || GameplayFactsQuerySum("inFixedStash") > 0 )
  6512. return true;
  6513.  
  6514. return false;
  6515. }
  6516.  
  6517. public function GetFilterTypeByItem( item : SItemUniqueId ) : EInventoryFilterType
  6518. {
  6519. var filterType : EInventoryFilterType;
  6520.  
  6521. if( ItemHasTag( item, 'Quest' ) )
  6522. {
  6523. return IFT_QuestItems;
  6524. }
  6525. else if( IsItemIngredient( item ) )
  6526. {
  6527. return IFT_Ingredients;
  6528. }
  6529. else if( IsItemAlchemyItem(item) )
  6530. {
  6531. return IFT_AlchemyItems;
  6532. }
  6533. else if( IsItemAnyArmor(item) )
  6534. {
  6535. return IFT_Armors;
  6536. }
  6537. else if( IsItemWeapon( item ) )
  6538. {
  6539. return IFT_Weapons;
  6540. }
  6541. else
  6542. {
  6543. return IFT_Default;
  6544. }
  6545. }
  6546.  
  6547.  
  6548. public function IsItemQuickslotItem(item : SItemUniqueId) : bool
  6549. {
  6550. return IsSlotQuickslot( GetSlotForItemId(item) );
  6551. }
  6552.  
  6553. public function GetCrossbowAmmo(id : SItemUniqueId) : int
  6554. {
  6555. if(!IsItemCrossbow(id))
  6556. return -1;
  6557.  
  6558. return (int)CalculateAttributeValue(GetItemAttributeValue(id, 'ammo'));
  6559. }
  6560.  
  6561.  
  6562.  
  6563. public function GetSlotForItemId(item : SItemUniqueId) : EEquipmentSlots
  6564. {
  6565. var tags : array<name>;
  6566. var player : W3PlayerWitcher;
  6567. var slot : EEquipmentSlots;
  6568.  
  6569. player = ((W3PlayerWitcher)GetEntity());
  6570.  
  6571. GetItemTags(item, tags);
  6572. slot = GetSlotForItem( GetItemCategory(item), tags, player );
  6573.  
  6574. if(!player)
  6575. return slot;
  6576.  
  6577. //Kolaris - NextGen (Disabled), Kolaris - Mask Slot
  6578. /*if(IsItemMask( item ))
  6579. slot == EES_Petard1;*/
  6580. if(IsMultipleSlot(slot))
  6581. {
  6582. if(slot == EES_Petard1 && player.IsAnyItemEquippedOnSlot(slot))
  6583. {
  6584. if(!player.IsAnyItemEquippedOnSlot(EES_Petard2))
  6585. slot = EES_Petard2;
  6586. // -= WMK:modQuickSlots =-
  6587. else if (!player.IsAnyItemEquippedOnSlot(EES_Petard3)) {
  6588. slot = EES_Petard3;
  6589. } else if (!player.IsAnyItemEquippedOnSlot(EES_Petard4)) {
  6590. slot = EES_Petard4;
  6591. }
  6592. // -= WMK:modQuickSlots =-
  6593. }
  6594. else if(slot == EES_Quickslot1 && player.IsAnyItemEquippedOnSlot(slot))
  6595. {
  6596. if(!player.IsAnyItemEquippedOnSlot(EES_Quickslot2))
  6597. slot = EES_Quickslot2;
  6598. }
  6599. else if(slot == EES_Potion1 && player.IsAnyItemEquippedOnSlot(EES_Potion1))
  6600. {
  6601. if(!player.IsAnyItemEquippedOnSlot(EES_Potion2))
  6602. {
  6603. slot = EES_Potion2;
  6604. }
  6605. else
  6606. {
  6607. if(!player.IsAnyItemEquippedOnSlot(EES_Potion3))
  6608. {
  6609. slot = EES_Potion3;
  6610. }
  6611. else
  6612. {
  6613. if(!player.IsAnyItemEquippedOnSlot(EES_Potion4))
  6614. {
  6615. slot = EES_Potion4;
  6616. // -= WMK:modQuickSlots =-
  6617. } else if (!player.IsAnyItemEquippedOnSlot(EES_Potion5)) {
  6618. slot = EES_Potion5;
  6619. } else if (!player.IsAnyItemEquippedOnSlot(EES_Potion6)) {
  6620. slot = EES_Potion6;
  6621. } else if (!player.IsAnyItemEquippedOnSlot(EES_Potion7)) {
  6622. slot = EES_Potion7;
  6623. } else if (!player.IsAnyItemEquippedOnSlot(EES_Potion8)) {
  6624. slot = EES_Potion8;
  6625. }
  6626. // -= WMK:modQuickSlots =-
  6627. }
  6628. }
  6629. }
  6630. else if(slot == EES_PotionMutagen1 && player.IsAnyItemEquippedOnSlot(slot))
  6631. {
  6632. if(!player.IsAnyItemEquippedOnSlot(EES_PotionMutagen2))
  6633. {
  6634. slot = EES_PotionMutagen2;
  6635. }
  6636. else
  6637. {
  6638. if(!player.IsAnyItemEquippedOnSlot(EES_PotionMutagen3))
  6639. {
  6640. slot = EES_PotionMutagen3;
  6641. }
  6642. else
  6643. {
  6644. if(!player.IsAnyItemEquippedOnSlot(EES_PotionMutagen4))
  6645. {
  6646. slot = EES_PotionMutagen4;
  6647. }
  6648. }
  6649. }
  6650. }
  6651. else if(slot == EES_SkillMutagen1 && player.IsAnyItemEquippedOnSlot(slot))
  6652. {
  6653. if(!player.IsAnyItemEquippedOnSlot(EES_SkillMutagen2))
  6654. {
  6655. slot = EES_SkillMutagen2;
  6656. }
  6657. else
  6658. {
  6659. if(!player.IsAnyItemEquippedOnSlot(EES_SkillMutagen3))
  6660. {
  6661. slot = EES_SkillMutagen3;
  6662. }
  6663. else
  6664. {
  6665. if(!player.IsAnyItemEquippedOnSlot(EES_SkillMutagen4))
  6666. {
  6667. slot = EES_SkillMutagen4;
  6668. }
  6669. }
  6670. }
  6671. }
  6672. //modASM++
  6673. else if(slot == EES_Acc1 && player.IsAnyItemEquippedOnSlot(slot))
  6674. {
  6675. if(!player.IsAnyItemEquippedOnSlot(EES_Acc2))
  6676. slot = EES_Acc2;
  6677. }
  6678. //--modASM
  6679. }
  6680.  
  6681. return slot;
  6682. }
  6683.  
  6684.  
  6685.  
  6686. public function GetAllWeapons() : array<SItemUniqueId>
  6687. {
  6688. return GetItemsByTag('Weapon');
  6689. }
  6690.  
  6691.  
  6692. public function GetSpecifiedPlayerItemsQuest(steelSword, silverSword, armor, boots, gloves, pants, trophy, mask, bombs, crossbow, secondaryWeapon, equippedOnly : bool) : array<SItemUniqueId>
  6693. {
  6694. var items, allItems : array<SItemUniqueId>;
  6695. var i : int;
  6696.  
  6697. GetAllItems(allItems);
  6698.  
  6699. for(i=0; i<allItems.Size(); i+=1)
  6700. {
  6701. if(
  6702. (steelSword && IsItemSteelSwordUsableByPlayer(allItems[i])) ||
  6703. (silverSword && IsItemSilverSwordUsableByPlayer(allItems[i])) ||
  6704. (armor && IsItemChestArmor(allItems[i])) ||
  6705. (boots && IsItemBoots(allItems[i])) ||
  6706. (gloves && IsItemGloves(allItems[i])) ||
  6707. (pants && IsItemPants(allItems[i])) ||
  6708. (trophy && IsItemTrophy(allItems[i])) ||
  6709. (mask && IsItemMask(allItems[i])) ||
  6710. (bombs && IsItemBomb(allItems[i])) ||
  6711. (crossbow && (IsItemCrossbow(allItems[i]) || IsItemBolt(allItems[i]))) ||
  6712. (secondaryWeapon && IsItemSecondaryWeapon(allItems[i]))
  6713. )
  6714. {
  6715. if(!equippedOnly || (equippedOnly && ((W3PlayerWitcher)GetEntity()) && GetWitcherPlayer().IsItemEquipped(allItems[i])) )
  6716. {
  6717. if(!ItemHasTag(allItems[i], 'NoDrop'))
  6718. items.PushBack(allItems[i]);
  6719. }
  6720. }
  6721. }
  6722.  
  6723. return items;
  6724. }
  6725.  
  6726.  
  6727. event OnItemAboutToGive( itemId : SItemUniqueId, quantity : int )
  6728. {
  6729. if(GetEntity() == GetWitcherPlayer())
  6730. {
  6731. ((W3PlayerWitcher)GetEntity()).RemoveRepairBuffs(itemId);
  6732. if( IsItemWeapon(itemId) )
  6733. {
  6734. RemoveAllOilsFromItem( itemId );
  6735. }
  6736. }
  6737. }
  6738.  
  6739.  
  6740. event OnItemRemoved( itemId : SItemUniqueId, quantity : int )
  6741. {
  6742. var ent : CGameplayEntity;
  6743. var crossbows : array<SItemUniqueId>;
  6744. var witcher : W3PlayerWitcher;
  6745. var refill : W3RefillableContainer;
  6746.  
  6747. witcher = GetWitcherPlayer();
  6748.  
  6749. if(GetEntity() == witcher)
  6750. {
  6751.  
  6752.  
  6753.  
  6754.  
  6755. // W3EE - Begin
  6756. /*
  6757. if(IsItemCrossbow(itemId) && HasInfiniteBolts())
  6758. {
  6759. crossbows = GetItemsByCategory('crossbow');
  6760. crossbows.Remove(itemId);
  6761.  
  6762. if(crossbows.Size() == 0)
  6763. {
  6764. RemoveItemByName('Bodkin Bolt', GetItemQuantityByName('Bodkin Bolt'));
  6765. RemoveItemByName('Harpoon Bolt', GetItemQuantityByName('Harpoon Bolt'));
  6766. }
  6767. }
  6768. else*/
  6769. // W3EE - End
  6770. if(IsItemBolt(itemId) && witcher.IsItemEquipped(itemId) && witcher.inv.GetItemQuantity(itemId) == quantity)
  6771. {
  6772.  
  6773. witcher.UnequipItem(itemId);
  6774. }
  6775.  
  6776.  
  6777. if(IsItemCrossbow(itemId) && witcher.IsItemEquipped(itemId) && witcher.rangedWeapon)
  6778. {
  6779. witcher.rangedWeapon.ClearDeployedEntity(true);
  6780. witcher.rangedWeapon = NULL;
  6781. }
  6782. if( GetItemCategory(itemId) == 'usable' )
  6783. {
  6784. if(witcher.IsHoldingItemInLHand() && itemId == witcher.currentlyEquipedItemL )
  6785. {
  6786. witcher.HideUsableItem(true);
  6787. }
  6788. }
  6789.  
  6790. witcher.RemoveRepairBuffs(itemId);
  6791. if( IsItemWeapon(itemId) )
  6792. {
  6793. RemoveAllOilsFromItem( itemId );
  6794. }
  6795.  
  6796.  
  6797. if(witcher.IsItemEquipped(itemId) && quantity >= witcher.inv.GetItemQuantity(itemId))
  6798. witcher.UnequipItem(itemId);
  6799. }
  6800.  
  6801.  
  6802. if(GetEntity() == thePlayer && IsItemWeapon(itemId) && (IsItemHeld(itemId) || IsItemMounted(itemId) ))
  6803. {
  6804. thePlayer.OnHolsteredItem(GetItemCategory(itemId),'r_weapon');
  6805. }
  6806.  
  6807.  
  6808. ent = (CGameplayEntity)GetEntity();
  6809. if(ent)
  6810. ent.OnItemTaken( itemId, quantity );
  6811.  
  6812.  
  6813. if(IsLootRenewable())
  6814. {
  6815. refill = (W3RefillableContainer)GetEntity();
  6816. if(refill)
  6817. refill.AddTimer('Refill', 20, true);
  6818. }
  6819. }
  6820.  
  6821.  
  6822. function GenerateItemLevel( item : SItemUniqueId, rewardItem : bool )
  6823. {
  6824. var stat : SAbilityAttributeValue;
  6825. var playerLevel : int;
  6826. var lvl, i : int;
  6827. var quality : int;
  6828. var ilMin, ilMax : int;
  6829.  
  6830. // W3EE - Begin
  6831. playerLevel = 1;
  6832. // playerLevel = GetWitcherPlayer().GetLevel();*/
  6833. // W3EE - End
  6834.  
  6835. lvl = playerLevel - 1;
  6836.  
  6837.  
  6838. if ( ( W3MerchantNPC )GetEntity() )
  6839. {
  6840. lvl = RoundF( playerLevel + RandRangeF( 2, 0 ) );
  6841. AddItemTag( item, 'AutogenUseLevelRange' );
  6842. }
  6843. else if ( rewardItem )
  6844. {
  6845. lvl = RoundF( playerLevel + RandRangeF( 1, 0 ) );
  6846. }
  6847. else if ( ItemHasTag( item, 'AutogenUseLevelRange') )
  6848. {
  6849. quality = RoundMath( CalculateAttributeValue( GetItemAttributeValue( item, 'quality' ) ) );
  6850. ilMin = RoundMath(CalculateAttributeValue( GetItemAttributeValue( item, 'item_level_min' ) ));
  6851. ilMax = RoundMath(CalculateAttributeValue( GetItemAttributeValue( item, 'item_level_max' ) ));
  6852.  
  6853. lvl += 1;
  6854. if ( !ItemHasTag( item, 'AutogenForceLevel') )
  6855. lvl += RoundMath(RandRangeF( 1, -1 ));
  6856.  
  6857. if ( FactsQuerySum("NewGamePlus") > 0 )
  6858. {
  6859. if ( lvl < ilMin + theGame.params.GetNewGamePlusLevel() ) lvl = ilMin + theGame.params.GetNewGamePlusLevel();
  6860. if ( lvl > ilMax + theGame.params.GetNewGamePlusLevel() ) lvl = ilMax + theGame.params.GetNewGamePlusLevel();
  6861. }
  6862. else
  6863. {
  6864. if ( lvl < ilMin ) lvl = ilMin;
  6865. if ( lvl > ilMax ) lvl = ilMax;
  6866. }
  6867.  
  6868. if ( quality == 5 ) lvl += 2;
  6869. if ( quality == 4 ) lvl += 1;
  6870. if ( (quality == 5 || quality == 4) && ItemHasTag(item, 'EP1') ) lvl += 1;
  6871. }
  6872. else if ( !ItemHasTag( item, 'AutogenForceLevel') )
  6873. {
  6874. quality = RoundMath( CalculateAttributeValue( GetItemAttributeValue( item, 'quality' ) ) );
  6875.  
  6876. if ( quality == 5 )
  6877. {
  6878. lvl = RoundF( playerLevel + RandRangeF( 2, 0 ) );
  6879. }
  6880. else if ( quality == 4 )
  6881. {
  6882. lvl = RoundF( playerLevel + RandRangeF( 1, -2 ) );
  6883. }
  6884. else if ( quality == 3 )
  6885. {
  6886. lvl = RoundF( playerLevel + RandRangeF( -1, -3 ) );
  6887.  
  6888. if ( RandF() > 0.9 )
  6889. {
  6890. lvl = playerLevel;
  6891. }
  6892. }
  6893. else if ( quality == 2 )
  6894. {
  6895. lvl = RoundF( playerLevel + RandRangeF( -2, -5 ) );
  6896.  
  6897. if ( RandF() > 0.95 )
  6898. {
  6899. lvl = playerLevel;
  6900. }
  6901. }
  6902. else
  6903. {
  6904. lvl = RoundF( playerLevel + RandRangeF( -2, -8 ) );
  6905.  
  6906. if ( RandF() == 0 )
  6907. {
  6908. lvl = playerLevel;
  6909. }
  6910. }
  6911. }
  6912.  
  6913. if (FactsQuerySum("StandAloneEP1") > 0)
  6914. lvl = GetWitcherPlayer().GetLevel() - 1;
  6915.  
  6916.  
  6917. if ( FactsQuerySum("NewGamePlus") > 0 && !ItemHasTag( item, 'AutogenUseLevelRange') )
  6918. {
  6919. if ( quality == 5 ) lvl += 2;
  6920. if ( quality == 4 ) lvl += 1;
  6921. }
  6922.  
  6923. if ( lvl < 1 ) lvl = 1;
  6924. if ( lvl > GetWitcherPlayer().GetMaxLevel() ) lvl = GetWitcherPlayer().GetMaxLevel();
  6925.  
  6926. if ( ItemHasTag( item, 'PlayerSteelWeapon' ) && !( ItemHasAbility( item, 'autogen_steel_base' ) || ItemHasAbility( item, 'autogen_fixed_steel_base' ) ) )
  6927. {
  6928. if ( ItemHasTag(item, 'AutogenUseLevelRange') && ItemHasAbility(item, 'autogen_fixed_steel_base') )
  6929. return;
  6930.  
  6931. if ( ItemHasTag(item, 'AutogenUseLevelRange') )
  6932. AddItemCraftedAbility(item, 'autogen_fixed_steel_base' );
  6933. else
  6934. AddItemCraftedAbility(item, 'autogen_steel_base' );
  6935.  
  6936. for( i=0; i<lvl; i+=1 )
  6937. {
  6938. if (FactsQuerySum("StandAloneEP1") > 0)
  6939. {
  6940. AddItemCraftedAbility(item, 'autogen_fixed_steel_dmg', true );
  6941. continue;
  6942. }
  6943.  
  6944. if ( ItemHasTag( item, 'AutogenForceLevel') || ItemHasTag(item, 'AutogenUseLevelRange') || FactsQuerySum("NewGamePlus") > 0 )
  6945. AddItemCraftedAbility(item, 'autogen_fixed_steel_dmg', true );
  6946. else
  6947. AddItemCraftedAbility(item, 'autogen_steel_dmg', true );
  6948. }
  6949. }
  6950. else if ( ItemHasTag( item, 'PlayerSilverWeapon' ) && !( ItemHasAbility( item, 'autogen_silver_base' ) || ItemHasAbility( item, 'autogen_fixed_silver_base' ) ) )
  6951. {
  6952. if ( ItemHasTag(item, 'AutogenUseLevelRange') && ItemHasAbility(item, 'autogen_fixed_silver_base') )
  6953. return;
  6954.  
  6955. if ( ItemHasTag(item, 'AutogenUseLevelRange') )
  6956. AddItemCraftedAbility(item, 'autogen_fixed_silver_base' );
  6957. else
  6958. AddItemCraftedAbility(item, 'autogen_silver_base' );
  6959.  
  6960. for( i=0; i<lvl; i+=1 )
  6961. {
  6962. if (FactsQuerySum("StandAloneEP1") > 0)
  6963. {
  6964. AddItemCraftedAbility(item, 'autogen_fixed_silver_dmg', true );
  6965. continue;
  6966. }
  6967.  
  6968. if ( ItemHasTag( item, 'AutogenForceLevel') || ItemHasTag(item, 'AutogenUseLevelRange') || FactsQuerySum("NewGamePlus") > 0 )
  6969. AddItemCraftedAbility(item, 'autogen_fixed_silver_dmg', true );
  6970. else
  6971. AddItemCraftedAbility(item, 'autogen_silver_dmg', true );
  6972. }
  6973. }
  6974. else if ( GetItemCategory( item ) == 'armor' && !( ItemHasAbility( item, 'autogen_armor_base' ) || ItemHasAbility( item, 'autogen_fixed_armor_base' ) ) )
  6975. {
  6976. if ( ItemHasTag(item, 'AutogenUseLevelRange') && ItemHasAbility(item, 'autogen_fixed_armor_base') )
  6977. return;
  6978.  
  6979. if ( ItemHasTag(item, 'AutogenUseLevelRange') )
  6980. AddItemCraftedAbility(item, 'autogen_fixed_armor_base' );
  6981. else
  6982. AddItemCraftedAbility(item, 'autogen_armor_base' );
  6983.  
  6984. for( i=0; i<lvl; i+=1 )
  6985. {
  6986. if (FactsQuerySum("StandAloneEP1") > 0)
  6987. {
  6988. AddItemCraftedAbility(item, 'autogen_fixed_armor_armor', true );
  6989. continue;
  6990. }
  6991.  
  6992. if ( ItemHasTag( item, 'AutogenForceLevel') || ItemHasTag( item, 'AutogenUseLevelRange') || FactsQuerySum("NewGamePlus") > 0 )
  6993. AddItemCraftedAbility(item, 'autogen_fixed_armor_armor', true );
  6994. else
  6995. AddItemCraftedAbility(item, 'autogen_armor_armor', true );
  6996. }
  6997. }
  6998. else if ( ( GetItemCategory( item ) == 'boots' || GetItemCategory( item ) == 'pants' ) && !( ItemHasAbility( item, 'autogen_pants_base' ) || ItemHasAbility( item, 'autogen_fixed_pants_base' ) ) )
  6999. {
  7000. if ( ItemHasTag(item, 'AutogenUseLevelRange') && ItemHasAbility(item, 'autogen_fixed_pants_base') )
  7001. return;
  7002.  
  7003. if ( ItemHasTag(item, 'AutogenUseLevelRange') )
  7004. AddItemCraftedAbility(item, 'autogen_fixed_pants_base' );
  7005. else
  7006. AddItemCraftedAbility(item, 'autogen_pants_base' );
  7007.  
  7008. for( i=0; i<lvl; i+=1 )
  7009. {
  7010. if (FactsQuerySum("StandAloneEP1") > 0)
  7011. {
  7012. AddItemCraftedAbility(item, 'autogen_fixed_pants_armor', true );
  7013. continue;
  7014. }
  7015.  
  7016. if ( ItemHasTag( item, 'AutogenForceLevel') || ItemHasTag( item, 'AutogenUseLevelRange') || FactsQuerySum("NewGamePlus") > 0 )
  7017. AddItemCraftedAbility(item, 'autogen_fixed_pants_armor', true );
  7018. else
  7019. AddItemCraftedAbility(item, 'autogen_pants_armor', true );
  7020. }
  7021. }
  7022. else if ( GetItemCategory( item ) == 'gloves' && !( ItemHasAbility( item, 'autogen_gloves_base' ) || ItemHasAbility( item, 'autogen_fixed_gloves_base' ) ) )
  7023. {
  7024. if ( ItemHasTag(item, 'AutogenUseLevelRange') && ItemHasAbility(item, 'autogen_fixed_gloves_base') )
  7025. return;
  7026.  
  7027. if ( ItemHasTag(item, 'AutogenUseLevelRange') )
  7028. AddItemCraftedAbility(item, 'autogen_fixed_gloves_base' );
  7029. else
  7030. AddItemCraftedAbility(item, 'autogen_gloves_base' );
  7031.  
  7032. for( i=0; i<lvl; i+=1 )
  7033. {
  7034. if (FactsQuerySum("StandAloneEP1") > 0)
  7035. {
  7036. AddItemCraftedAbility(item, 'autogen_fixed_gloves_armor', true );
  7037. continue;
  7038. }
  7039.  
  7040. if ( ItemHasTag( item, 'AutogenForceLevel') || ItemHasTag(item, 'AutogenUseLevelRange') || FactsQuerySum("NewGamePlus") > 0 )
  7041. AddItemCraftedAbility(item, 'autogen_fixed_gloves_armor', true );
  7042. else
  7043. AddItemCraftedAbility(item, 'autogen_gloves_armor', true );
  7044. }
  7045. }
  7046. }
  7047.  
  7048.  
  7049. event OnItemAdded(data : SItemChangedData)
  7050. {
  7051. var i, j : int;
  7052. var ent : CGameplayEntity;
  7053. var allCardsNames, foundCardsNames : array<name>;
  7054. var allStringNamesOfCards : array<string>;
  7055. var foundCardsStringNames : array<string>;
  7056. var gwintCards : array<SItemUniqueId>;
  7057. var itemName : name;
  7058. var witcher : W3PlayerWitcher;
  7059. var itemCategory : name;
  7060. var dm : CDefinitionsManagerAccessor;
  7061. var locKey : string;
  7062. var leaderCardsHack : array<name>;
  7063.  
  7064. var hud : CR4ScriptedHud;
  7065. var journalUpdateModule : CR4HudModuleJournalUpdate;
  7066. var itemId : SItemUniqueId;
  7067.  
  7068. var isItemShematic : bool;
  7069.  
  7070. var ngp : bool;
  7071.  
  7072. ent = (CGameplayEntity)GetEntity();
  7073.  
  7074. itemId = data.ids[0];
  7075.  
  7076.  
  7077. if( data.informGui )
  7078. {
  7079. recentlyAddedItems.PushBack( itemId );
  7080. if( ItemHasTag( itemId, 'FocusObject' ) )
  7081. {
  7082. GetWitcherPlayer().GetMedallion().Activate( true, 3.0);
  7083. }
  7084. }
  7085.  
  7086.  
  7087. if ( ItemHasTag(itemId, 'Autogen') )
  7088. {
  7089. GenerateItemLevel( itemId, false );
  7090. }
  7091.  
  7092. witcher = GetWitcherPlayer();
  7093.  
  7094.  
  7095. if(ent == witcher || ((W3MerchantNPC)ent) )
  7096. {
  7097. ngp = FactsQuerySum("NewGamePlus") > 0;
  7098. for(i=0; i<data.ids.Size(); i+=1)
  7099. {
  7100.  
  7101. if ( GetItemModifierInt(data.ids[i], 'ItemQualityModified') <= 0 )
  7102. AddRandomEnhancementToItem(data.ids[i]);
  7103.  
  7104. if ( ngp )
  7105. SetItemModifierInt(data.ids[i], 'DoNotAdjustNGPDLC', 1);
  7106.  
  7107. itemName = GetItemName(data.ids[i]);
  7108.  
  7109. if ( ngp && GetItemModifierInt(data.ids[i], 'NGPItemAdjusted') <= 0 && !ItemHasTag(data.ids[i], 'Autogen') )
  7110. {
  7111. IncreaseNGPItemlevel(data.ids[i]);
  7112. }
  7113.  
  7114. }
  7115. }
  7116. if(ent == witcher)
  7117. {
  7118. for(i=0; i<data.ids.Size(); i+=1)
  7119. {
  7120.  
  7121. if( ItemHasTag( itemId, theGame.params.GWINT_CARD_ACHIEVEMENT_TAG ) || !FactsDoesExist( "fix_for_gwent_achievement_bug_121588" ) )
  7122. {
  7123.  
  7124. leaderCardsHack.PushBack('gwint_card_emhyr_gold');
  7125. leaderCardsHack.PushBack('gwint_card_emhyr_silver');
  7126. leaderCardsHack.PushBack('gwint_card_emhyr_bronze');
  7127. leaderCardsHack.PushBack('gwint_card_foltest_gold');
  7128. leaderCardsHack.PushBack('gwint_card_foltest_silver');
  7129. leaderCardsHack.PushBack('gwint_card_foltest_bronze');
  7130. leaderCardsHack.PushBack('gwint_card_francesca_gold');
  7131. leaderCardsHack.PushBack('gwint_card_francesca_silver');
  7132. leaderCardsHack.PushBack('gwint_card_francesca_bronze');
  7133. leaderCardsHack.PushBack('gwint_card_eredin_gold');
  7134. leaderCardsHack.PushBack('gwint_card_eredin_silver');
  7135. leaderCardsHack.PushBack('gwint_card_eredin_bronze');
  7136.  
  7137. dm = theGame.GetDefinitionsManager();
  7138.  
  7139. allCardsNames = theGame.GetDefinitionsManager().GetItemsWithTag(theGame.params.GWINT_CARD_ACHIEVEMENT_TAG);
  7140.  
  7141.  
  7142. gwintCards = GetItemsByTag(theGame.params.GWINT_CARD_ACHIEVEMENT_TAG);
  7143.  
  7144.  
  7145. allStringNamesOfCards.PushBack('gwint_name_emhyr');
  7146. allStringNamesOfCards.PushBack('gwint_name_emhyr');
  7147. allStringNamesOfCards.PushBack('gwint_name_emhyr');
  7148. allStringNamesOfCards.PushBack('gwint_name_foltest');
  7149. allStringNamesOfCards.PushBack('gwint_name_foltest');
  7150. allStringNamesOfCards.PushBack('gwint_name_foltest');
  7151. allStringNamesOfCards.PushBack('gwint_name_francesca');
  7152. allStringNamesOfCards.PushBack('gwint_name_francesca');
  7153. allStringNamesOfCards.PushBack('gwint_name_francesca');
  7154. allStringNamesOfCards.PushBack('gwint_name_eredin');
  7155. allStringNamesOfCards.PushBack('gwint_name_eredin');
  7156. allStringNamesOfCards.PushBack('gwint_name_eredin');
  7157.  
  7158.  
  7159. for(j=0; j<allCardsNames.Size(); j+=1)
  7160. {
  7161. itemName = allCardsNames[j];
  7162. locKey = dm.GetItemLocalisationKeyName(allCardsNames[j]);
  7163. if (!allStringNamesOfCards.Contains(locKey))
  7164. {
  7165. allStringNamesOfCards.PushBack(locKey);
  7166. }
  7167. }
  7168.  
  7169.  
  7170. if(gwintCards.Size() >= allStringNamesOfCards.Size())
  7171. {
  7172. foundCardsNames.Clear();
  7173. for(j=0; j<gwintCards.Size(); j+=1)
  7174. {
  7175. itemName = GetItemName(gwintCards[j]);
  7176. locKey = dm.GetItemLocalisationKeyName(itemName);
  7177.  
  7178. if(!foundCardsStringNames.Contains(locKey) || leaderCardsHack.Contains(itemName))
  7179. {
  7180. foundCardsStringNames.PushBack(locKey);
  7181. }
  7182. }
  7183.  
  7184. if(foundCardsStringNames.Size() >= allStringNamesOfCards.Size())
  7185. {
  7186. theGame.GetGamerProfile().AddAchievement(EA_GwintCollector);
  7187. FactsAdd("gwint_all_cards_collected", 1, -1);
  7188. }
  7189. }
  7190.  
  7191. if(!FactsDoesExist("fix_for_gwent_achievement_bug_121588"))
  7192. FactsAdd("fix_for_gwent_achievement_bug_121588", 1, -1);
  7193. }
  7194.  
  7195. itemCategory = GetItemCategory( itemId );
  7196. isItemShematic = itemCategory == 'alchemy_recipe' || itemCategory == 'crafting_schematic';
  7197.  
  7198. if( isItemShematic )
  7199. {
  7200. ReadSchematicsAndRecipes( itemId );
  7201. }
  7202.  
  7203.  
  7204. if( ItemHasTag( data.ids[i], 'GwintCard'))
  7205. {
  7206. witcher.AddGwentCard(GetItemName(data.ids[i]), data.quantity);
  7207. }
  7208.  
  7209.  
  7210.  
  7211. if( !isItemShematic && ( this.ItemHasTag( itemId, 'ReadableItem' ) || this.ItemHasTag( itemId, 'Painting' ) ) && !this.ItemHasTag( itemId, 'NoNotification' ) )
  7212. {
  7213. hud = (CR4ScriptedHud)theGame.GetHud();
  7214. if( hud )
  7215. {
  7216. journalUpdateModule = (CR4HudModuleJournalUpdate)hud.GetHudModule( "JournalUpdateModule" );
  7217. if( journalUpdateModule )
  7218. {
  7219. journalUpdateModule.AddQuestBookInfo( itemId );
  7220. }
  7221. }
  7222. }
  7223. }
  7224. }
  7225.  
  7226.  
  7227. if( IsItemSingletonItem( itemId ) )
  7228. {
  7229. for(i=0; i<data.ids.Size(); i+=1)
  7230. {
  7231. if(!GetItemModifierInt(data.ids[i], 'is_initialized', 0))
  7232. {
  7233. SingletonItemRefillAmmo(data.ids[i]);
  7234. SetItemModifierInt(data.ids[i], 'is_initialized', 1);
  7235. }
  7236. }
  7237. }
  7238.  
  7239. // W3EE - Begin
  7240. GetItemLevel(itemId);
  7241. // W3EE - End
  7242.  
  7243. if(ent)
  7244. ent.OnItemGiven(data);
  7245. }
  7246.  
  7247. // W3EE - Begin
  7248. public function AddRandomEnhancementToItem(item : SItemUniqueId)
  7249. {
  7250. var itemCategory : name;
  7251. var itemQuality : int;
  7252. var ability : name;
  7253. var ent : CGameplayEntity;
  7254. var itemType : EArmorType;
  7255.  
  7256.  
  7257. if( ItemHasTag(item, 'DoNotEnhance') || ItemHasTag(item, 'EP1') || ItemHasTag(item, 'Ofir') || StrContains(NameToString(GetItemName(item)), "crafted") )
  7258. {
  7259. SetItemModifierInt(item, 'ItemQualityModified', 1);
  7260. return;
  7261. }
  7262.  
  7263. itemCategory = GetItemCategory(item);
  7264. itemQuality = RoundMath(CalculateAttributeValue(GetItemAttributeValue(item, 'quality' )));
  7265. itemType = GetArmorType(item);
  7266.  
  7267. if ( itemCategory == 'armor' )
  7268. {
  7269. switch ( itemQuality )
  7270. {
  7271. case 2 :
  7272. ability = 'quality_masterwork_armor';
  7273. if( itemType == EAT_Light )
  7274. AddItemCraftedAbility(item, theGame.params.GetRandomMasterworkLightArmorAbility(), true);
  7275. else
  7276. if( itemType == EAT_Medium )
  7277. AddItemCraftedAbility(item, theGame.params.GetRandomMasterworkMediumArmorAbility(), true);
  7278. else
  7279. if( itemType == EAT_Heavy )
  7280. AddItemCraftedAbility(item, theGame.params.GetRandomMasterworkHeavyArmorAbility(), true);
  7281. break;
  7282. case 3 :
  7283. ability = 'quality_magical_armor';
  7284. if( itemType == EAT_Light )
  7285. AddItemCraftedAbility(item, theGame.params.GetRandomMagicalLightArmorAbility(), true);
  7286. else
  7287. if( itemType == EAT_Medium )
  7288. AddItemCraftedAbility(item, theGame.params.GetRandomMagicalMediumArmorAbility(), true);
  7289. else
  7290. if( itemType == EAT_Heavy )
  7291. AddItemCraftedAbility(item, theGame.params.GetRandomMagicalHeavyArmorAbility(), true);
  7292. break;
  7293. default : break;
  7294. }
  7295. }
  7296. else if ( itemCategory == 'gloves' )
  7297. {
  7298. switch ( itemQuality )
  7299. {
  7300. case 2 :
  7301. ability = 'quality_masterwork_gloves';
  7302. if( itemType == EAT_Light )
  7303. AddItemCraftedAbility(item, theGame.params.GetRandomMasterworkLightGlovesAbility(), true);
  7304. else
  7305. if( itemType == EAT_Medium )
  7306. AddItemCraftedAbility(item, theGame.params.GetRandomMasterworkMediumGlovesAbility(), true);
  7307. else
  7308. if( itemType == EAT_Heavy )
  7309. AddItemCraftedAbility(item, theGame.params.GetRandomMasterworkHeavyGlovesAbility(), true);
  7310. break;
  7311. case 3 :
  7312. ability = 'quality_magical_gloves';
  7313. if( itemType == EAT_Light )
  7314. AddItemCraftedAbility(item, theGame.params.GetRandomMagicalLightGlovesAbility(), true);
  7315. else
  7316. if( itemType == EAT_Medium )
  7317. AddItemCraftedAbility(item, theGame.params.GetRandomMagicalMediumGlovesAbility(), true);
  7318. else
  7319. if( itemType == EAT_Heavy )
  7320. AddItemCraftedAbility(item, theGame.params.GetRandomMagicalHeavyGlovesAbility(), true);
  7321. break;
  7322. default : break;
  7323. }
  7324. }
  7325. else if ( itemCategory == 'pants' )
  7326. {
  7327. switch ( itemQuality )
  7328. {
  7329. case 2 :
  7330. ability = 'quality_masterwork_pants';
  7331. if( itemType == EAT_Light )
  7332. AddItemCraftedAbility(item, theGame.params.GetRandomMasterworkLightPantsAbility(), true);
  7333. else
  7334. if( itemType == EAT_Medium )
  7335. AddItemCraftedAbility(item, theGame.params.GetRandomMasterworkMediumPantsAbility(), true);
  7336. else
  7337. if( itemType == EAT_Heavy )
  7338. AddItemCraftedAbility(item, theGame.params.GetRandomMasterworkHeavyPantsAbility(), true);
  7339. break;
  7340. case 3 :
  7341. ability = 'quality_magical_pants';
  7342. if( itemType == EAT_Light )
  7343. AddItemCraftedAbility(item, theGame.params.GetRandomMagicalLightPantsAbility(), true);
  7344. else
  7345. if( itemType == EAT_Medium )
  7346. AddItemCraftedAbility(item, theGame.params.GetRandomMagicalMediumPantsAbility(), true);
  7347. else
  7348. if( itemType == EAT_Heavy )
  7349. AddItemCraftedAbility(item, theGame.params.GetRandomMagicalHeavyPantsAbility(), true);
  7350. break;
  7351. default : break;
  7352. }
  7353. }
  7354. else if ( itemCategory == 'boots' )
  7355. {
  7356. switch ( itemQuality )
  7357. {
  7358. case 2 :
  7359. ability = 'quality_masterwork_boots';
  7360. if( itemType == EAT_Light )
  7361. AddItemCraftedAbility(item, theGame.params.GetRandomMasterworkLightBootsAbility(), true);
  7362. else
  7363. if( itemType == EAT_Medium )
  7364. AddItemCraftedAbility(item, theGame.params.GetRandomMasterworkMediumBootsAbility(), true);
  7365. else
  7366. if( itemType == EAT_Heavy )
  7367. AddItemCraftedAbility(item, theGame.params.GetRandomMasterworkHeavyBootsAbility(), true);
  7368. break;
  7369. case 3 :
  7370. ability = 'quality_magical_boots';
  7371. if( itemType == EAT_Light )
  7372. AddItemCraftedAbility(item, theGame.params.GetRandomMagicalLightBootsAbility(), true);
  7373. else
  7374. if( itemType == EAT_Medium )
  7375. AddItemCraftedAbility(item, theGame.params.GetRandomMagicalMediumBootsAbility(), true);
  7376. else
  7377. if( itemType == EAT_Heavy )
  7378. AddItemCraftedAbility(item, theGame.params.GetRandomMagicalHeavyBootsAbility(), true);
  7379. break;
  7380. default : break;
  7381. }
  7382. }
  7383. else if ( itemCategory == 'steelsword' )
  7384. {
  7385. switch ( itemQuality )
  7386. {
  7387. case 1 :
  7388. ability = 'quality_common_steelsword';
  7389. if( RandRange(100, 0) <= 30 )
  7390. AddItemCraftedAbility(item, theGame.params.GetRandomCommonWeaponAbility(), true);
  7391. break;
  7392.  
  7393. case 2 :
  7394. ability = 'quality_masterwork_steelsword';
  7395. AddItemCraftedAbility(item, theGame.params.GetRandomMasterworkWeaponAbility(), true);
  7396. break;
  7397.  
  7398. case 3 :
  7399. ability = 'quality_magical_steelsword';
  7400. if( RandRange(100, 0) <= 90 )
  7401. AddItemCraftedAbility(item, theGame.params.GetRandomMagicalWeaponAbility(), true);
  7402. else
  7403. AddItemCraftedAbility(item, theGame.params.GetRandomMasterworkWeaponAbility(), true);
  7404. break;
  7405.  
  7406. default : break;
  7407. }
  7408. }
  7409. else if ( itemCategory == 'silversword' )
  7410. {
  7411. switch ( itemQuality )
  7412. {
  7413. case 1 :
  7414. ability = 'quality_common_silversword';
  7415. if( RandRange(100, 0) <= 80 )
  7416. AddItemCraftedAbility(item, theGame.params.GetRandomCommonWeaponAbility(), true);
  7417. break;
  7418.  
  7419. case 2 :
  7420. ability = 'quality_masterwork_silversword';
  7421. AddItemCraftedAbility(item, theGame.params.GetRandomMasterworkWeaponAbility(), true);
  7422. break;
  7423.  
  7424. case 3 :
  7425. ability = 'quality_magical_silversword';
  7426. if( RandRange(100, 0) <= 90 )
  7427. AddItemCraftedAbility(item, theGame.params.GetRandomMagicalWeaponAbility(), true);
  7428. break;
  7429.  
  7430. default : break;
  7431. }
  7432. }
  7433. /*
  7434. else if ( itemCategory == 'mutagen' )
  7435. {
  7436. ability = 'quality_mutagen';
  7437. AddItemCraftedAbility(item, theGame.params.GetRandomMutagenAbility(), true);
  7438. }
  7439. */
  7440.  
  7441. if(IsNameValid(ability))
  7442. {
  7443. AddItemCraftedAbility(item, ability, false);
  7444. SetItemModifierInt(item, 'ItemQualityModified', 1);
  7445. }
  7446. }
  7447. // W3EE - End
  7448.  
  7449. public function IncreaseNGPItemlevel(item : SItemUniqueId)
  7450. {
  7451. var i, diff : int;
  7452.  
  7453. diff = theGame.params.NewGamePlusLevelDifference();
  7454.  
  7455. if (diff > 0)
  7456. {
  7457. if ( ItemHasTag( item, 'PlayerSteelWeapon' ) )
  7458. {
  7459. for( i=0; i<diff; i+=1 )
  7460. {
  7461. AddItemCraftedAbility(item, 'autogen_fixed_steel_dmg', true );
  7462. }
  7463. }
  7464. else if ( ItemHasTag( item, 'PlayerSilverWeapon' ) )
  7465. {
  7466. for( i=0; i<diff; i+=1 )
  7467. {
  7468. AddItemCraftedAbility(item, 'autogen_fixed_silver_dmg', true );
  7469. }
  7470. }
  7471. else if ( IsItemChestArmor(item) )
  7472. {
  7473. for( i=0; i<diff; i+=1 )
  7474. {
  7475. AddItemCraftedAbility(item, 'autogen_fixed_armor_armor', true );
  7476. }
  7477. }
  7478. else if ( IsItemBoots(item) || IsItemPants(item) )
  7479. {
  7480. for( i=0; i<diff; i+=1 )
  7481. {
  7482. AddItemCraftedAbility(item, 'autogen_fixed_pants_armor', true );
  7483. }
  7484. }
  7485. else if ( IsItemGloves(item) )
  7486. {
  7487. for( i=0; i<diff; i+=1 )
  7488. {
  7489. AddItemCraftedAbility(item, 'autogen_fixed_gloves_armor', true );
  7490. }
  7491. }
  7492. }
  7493.  
  7494. SetItemModifierInt(item, 'NGPItemAdjusted', 1);
  7495. }
  7496.  
  7497. public function GetItemQuality( itemId : SItemUniqueId ) : int
  7498. {
  7499. var itemQuality : float;
  7500. var itemQualityAtribute : SAbilityAttributeValue;
  7501. var excludedTags : array<name>;
  7502. var tempItemQualityAtribute : SAbilityAttributeValue;
  7503.  
  7504.  
  7505. excludedTags.PushBack(theGame.params.OIL_ABILITY_TAG);
  7506. itemQualityAtribute = GetItemAttributeValue( itemId, 'quality', excludedTags, true );
  7507.  
  7508. itemQuality = itemQualityAtribute.valueAdditive;
  7509. if( itemQuality == 0 )
  7510. {
  7511. itemQuality = 1;
  7512. }
  7513. return RoundMath(itemQuality);
  7514. }
  7515.  
  7516. public function GetItemQualityFromName( itemName : name, out min : int, out max : int)
  7517. {
  7518. var dm : CDefinitionsManagerAccessor;
  7519. var attributeName : name;
  7520. var attributes, itemAbilities : array<name>;
  7521. var attributeMin, attributeMax : SAbilityAttributeValue;
  7522.  
  7523. var tmpInt : int;
  7524. var tmpArray : array<float>;
  7525.  
  7526. dm = theGame.GetDefinitionsManager();
  7527.  
  7528. dm.GetItemAbilitiesWithWeights(itemName, GetEntity() == thePlayer, itemAbilities, tmpArray, tmpInt, tmpInt);
  7529. attributes = dm.GetAbilitiesAttributes(itemAbilities);
  7530. for (tmpInt = 0; tmpInt < attributes.Size(); tmpInt += 1)
  7531. {
  7532. if (attributes[tmpInt] == 'quality')
  7533. {
  7534. dm.GetAbilitiesAttributeValue(itemAbilities, 'quality', attributeMin, attributeMax);
  7535. min = RoundMath(CalculateAttributeValue(attributeMin));
  7536. max = RoundMath(CalculateAttributeValue(attributeMax));
  7537. break;
  7538. }
  7539. }
  7540. }
  7541.  
  7542. public function GetRecentlyAddedItems() : array<SItemUniqueId>
  7543. {
  7544. return recentlyAddedItems;
  7545. }
  7546.  
  7547. public function GetRecentlyAddedItemsListSize() : int
  7548. {
  7549. return recentlyAddedItems.Size();
  7550. }
  7551.  
  7552. public function RemoveItemFromRecentlyAddedList( itemId : SItemUniqueId ) : bool
  7553. {
  7554. var i : int;
  7555.  
  7556. for( i = 0; i < recentlyAddedItems.Size(); i += 1 )
  7557. {
  7558. if( recentlyAddedItems[i] == itemId )
  7559. {
  7560. recentlyAddedItems.EraseFast( i );
  7561. return true;
  7562. }
  7563. }
  7564.  
  7565. return false;
  7566. }
  7567.  
  7568.  
  7569.  
  7570.  
  7571. import final function NotifyScriptedListeners( notify : bool );
  7572.  
  7573. var listeners : array< IInventoryScriptedListener >;
  7574.  
  7575. function AddListener( listener : IInventoryScriptedListener )
  7576. {
  7577. if ( listeners.FindFirst( listener ) == -1 )
  7578. {
  7579. listeners.PushBack( listener );
  7580. if ( listeners.Size() == 1 )
  7581. {
  7582. NotifyScriptedListeners( true );
  7583. }
  7584. }
  7585. }
  7586.  
  7587. function RemoveListener( listener : IInventoryScriptedListener )
  7588. {
  7589. if ( listeners.Remove( listener ) )
  7590. {
  7591. if ( listeners.Size() == 0 )
  7592. {
  7593. NotifyScriptedListeners( false );
  7594. }
  7595. }
  7596. }
  7597.  
  7598. event OnInventoryScriptedEvent( eventType : EInventoryEventType, itemId : SItemUniqueId, quantity : int, fromAssociatedInventory : bool )
  7599. {
  7600. var i, size : int;
  7601.  
  7602. size = listeners.Size();
  7603. for (i=size-1; i>=0; i-=1 )
  7604. {
  7605. listeners[i].OnInventoryScriptedEvent( eventType, itemId, quantity, fromAssociatedInventory );
  7606. }
  7607.  
  7608.  
  7609. if(GetEntity() == GetWitcherPlayer() && (eventType == IET_ItemRemoved || eventType == IET_ItemQuantityChanged) )
  7610. GetWitcherPlayer().UpdateEncumbrance();
  7611. }
  7612.  
  7613.  
  7614.  
  7615.  
  7616. public final function GetMutationResearchPoints( color : ESkillColor, item : SItemUniqueId ) : int
  7617. {
  7618. var val : SAbilityAttributeValue;
  7619. var colorAttribute : name;
  7620.  
  7621.  
  7622. if( color == SC_None || color == SC_Yellow || !IsIdValid( item ) )
  7623. {
  7624. return 0;
  7625. }
  7626.  
  7627.  
  7628. switch( color )
  7629. {
  7630. case SC_Red:
  7631. colorAttribute = 'mutation_research_points_red';
  7632. break;
  7633. case SC_Blue:
  7634. colorAttribute = 'mutation_research_points_blue';
  7635. break;
  7636. case SC_Green:
  7637. colorAttribute = 'mutation_research_points_green';
  7638. break;
  7639. }
  7640.  
  7641.  
  7642. val = GetItemAttributeValue( item, colorAttribute );
  7643.  
  7644. return ( int )val.valueAdditive;
  7645. }
  7646.  
  7647. public function GetSkillMutagenColor(item : SItemUniqueId) : ESkillColor
  7648. {
  7649. var abs : array<name>;
  7650.  
  7651.  
  7652. if(!ItemHasTag(item, 'MutagenIngredient'))
  7653. return SC_None;
  7654.  
  7655. GetItemAbilities(item, abs);
  7656.  
  7657. if(abs.Contains('mutagen_color_green')) return SC_Green;
  7658. if(abs.Contains('mutagen_color_blue')) return SC_Blue;
  7659. if(abs.Contains('mutagen_color_red')) return SC_Red;
  7660. if(abs.Contains('lesser_mutagen_color_green')) return SC_Green;
  7661. if(abs.Contains('lesser_mutagen_color_blue')) return SC_Blue;
  7662. if(abs.Contains('lesser_mutagen_color_red')) return SC_Red;
  7663. if(abs.Contains('greater_mutagen_color_green')) return SC_Green;
  7664. if(abs.Contains('greater_mutagen_color_blue')) return SC_Blue;
  7665. if(abs.Contains('greater_mutagen_color_red')) return SC_Red;
  7666.  
  7667. return SC_None;
  7668. }
  7669.  
  7670.  
  7671.  
  7672.  
  7673.  
  7674.  
  7675.  
  7676.  
  7677.  
  7678. import final function GetItemEnhancementSlotsCount( itemId : SItemUniqueId ) : int;
  7679. import final function GetItemEnhancementItems( itemId : SItemUniqueId, out names : array< name > );
  7680. import final function GetItemEnhancementCount( itemId : SItemUniqueId ) : int;
  7681. import final function GetItemColor( itemId : SItemUniqueId ) : name;
  7682. import final function IsItemColored( itemId : SItemUniqueId ) : bool;
  7683. import final function SetPreviewColor( itemId : SItemUniqueId, colorId : int );
  7684. import final function ClearPreviewColor( itemId : SItemUniqueId ) : bool;
  7685. import final function ColorItem( itemId : SItemUniqueId, dyeId : SItemUniqueId );
  7686. import final function ClearItemColor( itemId : SItemUniqueId ) : bool;
  7687. import final function EnchantItem( enhancedItemId : SItemUniqueId, enchantmentName : name, enchantmentStat : name ) : bool;
  7688. import final function GetEnchantment( enhancedItemId : SItemUniqueId ) : name;
  7689. import final function IsItemEnchanted( enhancedItemId : SItemUniqueId ) : bool;
  7690. import final function UnenchantItem( enhancedItemId : SItemUniqueId ) : bool;
  7691. import private function EnhanceItem( enhancedItemId : SItemUniqueId, extensionItemId : SItemUniqueId ) : bool;
  7692. import private function RemoveItemEnhancementByIndex( enhancedItemId : SItemUniqueId, slotIndex : int ) : bool;
  7693. import private function RemoveItemEnhancementByName( enhancedItemId : SItemUniqueId, extensionItemName : name ) : bool;
  7694. import final function PreviewItemAttributeAfterUpgrade( baseItemId : SItemUniqueId, upgradeItemId : SItemUniqueId, attributeName : name, optional baseInventory : CInventoryComponent, optional upgradeInventory : CInventoryComponent ) : SAbilityAttributeValue;
  7695. import final function HasEnhancementItemTag( enhancedItemId : SItemUniqueId, slotIndex : int, tag : name ) : bool;
  7696.  
  7697.  
  7698. function NotifyEnhancedItem( enhancedItemId : SItemUniqueId )
  7699. {
  7700. var weapons : array<SItemUniqueId>;
  7701. var sword : CWitcherSword;
  7702. var i : int;
  7703.  
  7704. sword = (CWitcherSword) GetItemEntityUnsafe( enhancedItemId );
  7705. sword.UpdateEnhancements( this );
  7706. }
  7707.  
  7708. function EnhanceItemScript( enhancedItemId : SItemUniqueId, extensionItemId : SItemUniqueId ) : bool
  7709. {
  7710. var i : int;
  7711. var enhancements : array<name>;
  7712. var runeword : Runeword;
  7713.  
  7714. if ( EnhanceItem( enhancedItemId, extensionItemId ) )
  7715. {
  7716. NotifyEnhancedItem( enhancedItemId );
  7717.  
  7718. GetItemEnhancementItems( enhancedItemId, enhancements );
  7719. if ( theGame.runewordMgr.GetRuneword( enhancements, runeword ) )
  7720. {
  7721. for ( i = 0; i < runeword.abilities.Size(); i+=1 )
  7722. {
  7723. AddItemBaseAbility( enhancedItemId, runeword.abilities[i] );
  7724. }
  7725. }
  7726. return true;
  7727. }
  7728. return false;
  7729. }
  7730.  
  7731. function RemoveItemEnhancementByIndexScript( enhancedItemId : SItemUniqueId, slotIndex : int ) : bool
  7732. {
  7733. var i : int;
  7734. var enhancements : array<name>;
  7735. var runeword : Runeword;
  7736. var hasRuneword : bool;
  7737. var names : array< name >;
  7738.  
  7739. GetItemEnhancementItems( enhancedItemId, enhancements );
  7740. hasRuneword = theGame.runewordMgr.GetRuneword( enhancements, runeword );
  7741.  
  7742. GetItemEnhancementItems( enhancedItemId, names );
  7743.  
  7744. if ( RemoveItemEnhancementByIndex( enhancedItemId, slotIndex ) )
  7745. {
  7746. NotifyEnhancedItem( enhancedItemId );
  7747.  
  7748.  
  7749.  
  7750. if ( hasRuneword )
  7751. {
  7752.  
  7753. for ( i = 0; i < runeword.abilities.Size(); i+=1 )
  7754. {
  7755. RemoveItemBaseAbility( enhancedItemId, runeword.abilities[i] );
  7756. }
  7757. }
  7758. return true;
  7759. }
  7760. return false;
  7761. }
  7762.  
  7763.  
  7764. function RemoveItemEnhancementByNameScript( enhancedItemId : SItemUniqueId, extensionItemName : name ) : bool
  7765. {
  7766. var i : int;
  7767. var enhancements : array<name>;
  7768. var runeword : Runeword;
  7769. var hasRuneword : bool;
  7770.  
  7771. GetItemEnhancementItems( enhancedItemId, enhancements );
  7772. hasRuneword = theGame.runewordMgr.GetRuneword( enhancements, runeword );
  7773.  
  7774.  
  7775. if ( RemoveItemEnhancementByName( enhancedItemId, extensionItemName ) )
  7776. {
  7777. NotifyEnhancedItem( enhancedItemId );
  7778.  
  7779.  
  7780. AddAnItem( extensionItemName, 1, true, true );
  7781. if ( hasRuneword )
  7782. {
  7783.  
  7784. for ( i = 0; i < runeword.abilities.Size(); i+=1 )
  7785. {
  7786. RemoveItemBaseAbility( enhancedItemId, runeword.abilities[i] );
  7787. }
  7788. }
  7789. return true;
  7790. }
  7791. return false;
  7792. }
  7793.  
  7794. function RemoveAllItemEnhancements( enhancedItemId : SItemUniqueId )
  7795. {
  7796. var count, i : int;
  7797.  
  7798. count = GetItemEnhancementCount( enhancedItemId );
  7799. for ( i = count - 1; i >= 0; i-=1 )
  7800. {
  7801. RemoveItemEnhancementByIndexScript( enhancedItemId, i );
  7802. }
  7803. }
  7804.  
  7805. function GetHeldAndMountedItems( out items : array< SItemUniqueId > )
  7806. {
  7807. var allItems : array< SItemUniqueId >;
  7808. var i : int;
  7809. var itemName : name;
  7810.  
  7811. GetAllItems( allItems );
  7812.  
  7813. items.Clear();
  7814. for( i = 0; i < allItems.Size(); i += 1 )
  7815. {
  7816. if ( IsItemHeld( allItems[ i ] ) || IsItemMounted( allItems[ i ] ) )
  7817. {
  7818. items.PushBack( allItems[ i ] );
  7819. }
  7820. }
  7821. }
  7822.  
  7823.  
  7824. public function GetHasValidDecorationItems( items : array<SItemUniqueId>, decoration : W3HouseDecorationBase ) : bool
  7825. {
  7826. var i, size : int;
  7827.  
  7828. size = items.Size();
  7829.  
  7830.  
  7831. if(size == 0 )
  7832. {
  7833. LogChannel( 'houseDecorations', "No items with valid tag were found!" );
  7834. return false;
  7835. }
  7836.  
  7837.  
  7838. for( i=0; i < size; i+= 1 )
  7839. {
  7840.  
  7841. if( GetWitcherPlayer().IsItemEquipped( items[i] ) )
  7842. {
  7843. LogChannel( 'houseDecorations', "Found item is equipped, erasing..." );
  7844. continue;
  7845. }
  7846.  
  7847.  
  7848. if( IsItemQuest( items[i] ) && decoration.GetAcceptQuestItems() == false )
  7849. {
  7850. LogChannel( 'houseDecorations', "Found item is quest item, and quest items are not accepted, erasing..." );
  7851. continue;
  7852. }
  7853.  
  7854.  
  7855. if( decoration.GetItemHasForbiddenTag( items[i] ) )
  7856. {
  7857. LogChannel( 'houseDecorations', "Found item has a forbidden tag, erasing..." );
  7858. continue;
  7859. }
  7860.  
  7861. LogChannel( 'houseDecorations', "Item checks out: "+ GetItemName( items[i] ) );
  7862. return true;
  7863. }
  7864. LogChannel( 'houseDecorations', "No valid items were found!" );
  7865.  
  7866. return false;
  7867. }
  7868.  
  7869.  
  7870. function GetMissingCards() : array< name >
  7871. {
  7872. var defMgr : CDefinitionsManagerAccessor = theGame.GetDefinitionsManager();
  7873. var allCardNames : array< name > = defMgr.GetItemsWithTag(theGame.params.GWINT_CARD_ACHIEVEMENT_TAG);
  7874. var playersCards : array< SItemUniqueId > = GetItemsByTag(theGame.params.GWINT_CARD_ACHIEVEMENT_TAG);
  7875. var playersCardLocs : array< string >;
  7876. var missingCardLocs : array< string >;
  7877. var missingCards : array< name >;
  7878. var i, j : int;
  7879. var found : bool;
  7880.  
  7881.  
  7882. //---===*modGwentRedux Begins*===---
  7883. var allExpCardNames : array< name > = defMgr.GetItemsWithTag(theGame.params.GWINT_CARD_EXPANSION_TAG);
  7884. var playersExpCards : array< SItemUniqueId > = GetItemsByTag(theGame.params.GWINT_CARD_EXPANSION_TAG);
  7885.  
  7886. for ( i = 0; i < allExpCardNames.Size(); i+=1 )
  7887. {
  7888. found = false;
  7889.  
  7890. for ( j = 0; j < playersExpCards.Size(); j+=1 )
  7891. {
  7892. if ( allExpCardNames[i] == GetItemName( playersExpCards[j] ) )
  7893. {
  7894. found = true;
  7895. playersCardLocs.PushBack( defMgr.GetItemLocalisationKeyName ( allExpCardNames[i] ) );
  7896. break;
  7897. }
  7898. }
  7899.  
  7900. if ( !found )
  7901. {
  7902. missingCardLocs.PushBack( defMgr.GetItemLocalisationKeyName( allExpCardNames[i] ) );
  7903. missingCards.PushBack( allExpCardNames[i] );
  7904. }
  7905. }
  7906. //---===*modGwentRedux Ends*===---
  7907. for ( i = 0; i < allCardNames.Size(); i+=1 )
  7908. {
  7909. found = false;
  7910.  
  7911. for ( j = 0; j < playersCards.Size(); j+=1 )
  7912. {
  7913. if ( allCardNames[i] == GetItemName( playersCards[j] ) )
  7914. {
  7915. found = true;
  7916. playersCardLocs.PushBack( defMgr.GetItemLocalisationKeyName ( allCardNames[i] ) );
  7917. break;
  7918. }
  7919. }
  7920.  
  7921. if ( !found )
  7922. {
  7923. missingCardLocs.PushBack( defMgr.GetItemLocalisationKeyName( allCardNames[i] ) );
  7924. missingCards.PushBack( allCardNames[i] );
  7925. }
  7926. }
  7927.  
  7928. if( missingCardLocs.Size() < 2 )
  7929. {
  7930. return missingCards;
  7931. }
  7932.  
  7933.  
  7934. for ( i = missingCardLocs.Size()-1 ; i >= 0 ; i-=1 )
  7935. {
  7936. for ( j = 0 ; j < playersCardLocs.Size() ; j+=1 )
  7937. {
  7938. if ( missingCardLocs[i] == playersCardLocs[j]
  7939. && missingCardLocs[i] != "gwint_name_emhyr" && missingCardLocs[i] != "gwint_name_foltest"
  7940. && missingCardLocs[i] != "gwint_name_francesca" && missingCardLocs[i] != "gwint_name_eredin" )
  7941. {
  7942. missingCardLocs.EraseFast( i );
  7943. missingCards.EraseFast( i );
  7944. break;
  7945. }
  7946. }
  7947. }
  7948.  
  7949. return missingCards;
  7950. }
  7951.  
  7952. public function FindCardSources( missingCards : array< name > ) : array< SCardSourceData >
  7953. {
  7954. var sourceCSV : C2dArray;
  7955. var sourceTable : array< SCardSourceData >;
  7956. var sourceRemaining : array< SCardSourceData >;
  7957. var sourceCount, i, j : int;
  7958.  
  7959. if ( theGame.IsFinalBuild() )
  7960. {
  7961. sourceCSV = LoadCSV("gameplay\globals\card_sources.csv");
  7962. }
  7963. else
  7964. {
  7965. sourceCSV = LoadCSV("qa\card_sources.csv");
  7966. }
  7967.  
  7968. sourceCount = sourceCSV.GetNumRows();
  7969. sourceTable.Resize(sourceCount);
  7970.  
  7971. for ( i = 0 ; i < sourceCount ; i+=1 )
  7972. {
  7973. sourceTable[i].cardName = sourceCSV.GetValueAsName("CardName",i);
  7974. sourceTable[i].source = sourceCSV.GetValue("Source",i);
  7975. sourceTable[i].originArea = sourceCSV.GetValue("OriginArea",i);
  7976. sourceTable[i].originQuest = sourceCSV.GetValue("OriginQuest",i);
  7977. sourceTable[i].details = sourceCSV.GetValue("Details",i);
  7978. sourceTable[i].coords = sourceCSV.GetValue("Coords",i);
  7979. }
  7980.  
  7981. for ( i = 0 ; i < missingCards.Size() ; i+=1 )
  7982. {
  7983. for ( j = 0 ; j < sourceCount ; j+=1 )
  7984. {
  7985. if ( sourceTable[j].cardName == missingCards[i] )
  7986. {
  7987. sourceRemaining.PushBack( sourceTable[j] );
  7988. }
  7989. }
  7990. }
  7991.  
  7992. return sourceRemaining;
  7993. }
  7994.  
  7995. public function GetGwentAlmanacContents() : string
  7996. {
  7997. var sourcesRemaining : array< SCardSourceData >;
  7998. var missingCards : array< string >;
  7999. var almanacContents : string;
  8000. var i : int;
  8001. var NML, Novigrad, Skellige, Prologue, Vizima, KaerMorhen, Random : int;
  8002. //---===*modGwentRedux Begins*===---
  8003. var Toussaint : int;
  8004. var listNML, listNovigrad, listSkellige, listToussaint, listPrologue, listVizima, listKaerMorhen, listRandom : string;
  8005. //---===*modGwentRedux Ends*===---
  8006.  
  8007. sourcesRemaining = FindCardSources( GetMissingCards() );
  8008.  
  8009. for ( i = 0 ; i < sourcesRemaining.Size() ; i+=1 )
  8010. {
  8011. switch ( sourcesRemaining[i].originArea )
  8012. {
  8013. case "NML":
  8014. NML += 1;
  8015. //---===*modGwentRedux Begins*===---
  8016. listNML += "- " + GetLocStringByKeyExt( GetItemLocalizedNameByName( sourcesRemaining[i].cardName ) );
  8017. listNML += " (" + GetLocStringByKeyExt( sourcesRemaining[i].details ) + ": ";
  8018. listNML += GetLocStringById( StringToInt( sourcesRemaining[i].originQuest ) ) + ")<br>";
  8019. //---===*modGwentRedux Ends*===---
  8020. break;
  8021. case "Novigrad":
  8022. Novigrad += 1;
  8023. //---===*modGwentRedux Begins*===---
  8024. listNovigrad += "- " + GetLocStringByKeyExt( GetItemLocalizedNameByName( sourcesRemaining[i].cardName ) );
  8025. listNovigrad += " (" + GetLocStringByKeyExt( sourcesRemaining[i].details ) + ": ";
  8026. listNovigrad += GetLocStringById( StringToInt( sourcesRemaining[i].originQuest ) ) + ")<br>";
  8027. //---===*modGwentRedux Ends*===---
  8028. break;
  8029. case "Skellige":
  8030. Skellige += 1;
  8031. //---===*modGwentRedux Begins*===---
  8032. listSkellige += "- " + GetLocStringByKeyExt( GetItemLocalizedNameByName( sourcesRemaining[i].cardName ) );
  8033. listSkellige += " (" + GetLocStringByKeyExt( sourcesRemaining[i].details ) + ": ";
  8034. listSkellige += GetLocStringById( StringToInt( sourcesRemaining[i].originQuest ) ) + ")<br>";
  8035. //---===*modGwentRedux Ends*===---
  8036. break;
  8037. //---===*modGwentRedux Begins*===---
  8038. case "Toussaint":
  8039. Toussaint += 1;
  8040. listToussaint += "- " + GetLocStringByKeyExt( GetItemLocalizedNameByName( sourcesRemaining[i].cardName ) );
  8041. listToussaint += " (" + GetLocStringByKeyExt( sourcesRemaining[i].details ) + ": ";
  8042. listToussaint += GetLocStringById( StringToInt( sourcesRemaining[i].originQuest ) ) + ")<br>";
  8043. break;
  8044. //---===*modGwentRedux Ends*===---
  8045. case "Prologue":
  8046. Prologue += 1;
  8047. //---===*modGwentRedux Begins*===---
  8048. listPrologue += "- " + GetLocStringByKeyExt( GetItemLocalizedNameByName( sourcesRemaining[i].cardName ) );
  8049. listPrologue += " (" + GetLocStringByKeyExt( sourcesRemaining[i].details ) + ")<br>";
  8050. //---===*modGwentRedux Ends*===---
  8051. break;
  8052. case "Vizima":
  8053. Vizima += 1;
  8054. //---===*modGwentRedux Begins*===---
  8055. listVizima += "- " + GetLocStringByKeyExt( GetItemLocalizedNameByName( sourcesRemaining[i].cardName ) );
  8056. listVizima += " (" + GetLocStringByKeyExt( sourcesRemaining[i].details ) + ")<br>";
  8057. //---===*modGwentRedux Ends*===---
  8058. break;
  8059. case "KaerMorhen":
  8060. KaerMorhen += 1;
  8061. //---===*modGwentRedux Begins*===---
  8062. listKaerMorhen += "- " + GetLocStringByKeyExt( GetItemLocalizedNameByName( sourcesRemaining[i].cardName ) );
  8063. listKaerMorhen += " (" + GetLocStringByKeyExt( sourcesRemaining[i].details ) + ": ";
  8064. listKaerMorhen += GetLocStringById( StringToInt( sourcesRemaining[i].originQuest ) ) + ")<br>";
  8065. //---===*modGwentRedux Ends*===---
  8066. break;
  8067. case "Random":
  8068. Random += 1;
  8069. //---===*modGwentRedux Begins*===---
  8070. listRandom += "- " + GetLocStringByKeyExt( GetItemLocalizedNameByName( sourcesRemaining[i].cardName ) ) + "<br>";
  8071. //---===*modGwentRedux Ends*===---
  8072. break;
  8073. default:
  8074. break;
  8075. }
  8076. }
  8077.  
  8078. if ( NML + Novigrad + Skellige + Prologue + Vizima + KaerMorhen + Random == 0 )
  8079. {
  8080. //---===*modGwentRedux Begins*===---
  8081. theGame.GetGamerProfile().AddAchievement(EA_GwintCollector);
  8082. FactsAdd( "gwint_all_cards_collected", 1, -1 );
  8083. }
  8084. if ( NML + Novigrad + Skellige + Toussaint + Prologue + Vizima + KaerMorhen + Random == 0 )
  8085. {
  8086. //---===*modGwentRedux Ends*===---
  8087. almanacContents = GetLocStringByKeyExt( "gwent_almanac_text" ) + "<br>";
  8088. almanacContents += GetLocStringByKeyExt( "gwent_almanac_completed_text" );
  8089. }
  8090. else
  8091. {
  8092. almanacContents = GetLocStringByKeyExt( "gwent_almanac_text" ) + "<br>";
  8093. if ( NML > 0 )
  8094. {
  8095. almanacContents += GetLocStringByKeyExt( "location_name_velen" ) + ": " + NML + "<br>";
  8096. //---===*modGwentRedux Begins*===---
  8097. almanacContents += listNML + "<br>";
  8098. //---===*modGwentRedux Ends*===---
  8099. }
  8100. if ( Novigrad > 0 )
  8101. {
  8102. almanacContents += GetLocStringByKeyExt( "map_location_novigrad" ) + ": " + Novigrad + "<br>";
  8103. //---===*modGwentRedux Begins*===---
  8104. almanacContents += listNovigrad + "<br>";
  8105. //---===*modGwentRedux Ends*===---
  8106. }
  8107. if ( Skellige > 0 )
  8108. {
  8109. almanacContents += GetLocStringByKeyExt( "map_location_skellige" ) + ": " + Skellige + "<br>";
  8110. //---===*modGwentRedux Begins*===---
  8111. almanacContents += listSkellige + "<br>";
  8112. //---===*modGwentRedux Ends*===---
  8113. }
  8114. //---===*modGwentRedux Begins*===---
  8115. if ( Toussaint > 0 )
  8116. {
  8117. almanacContents += GetLocStringById( 1208494 ) + ": " + Toussaint + "<br>";
  8118. almanacContents += listToussaint + "<br>";
  8119. }
  8120. //---===*modGwentRedux Ends*===---
  8121. if ( Prologue > 0 )
  8122. {
  8123. almanacContents += GetLocStringByKeyExt( "map_location_prolog_village" ) + ": " + Prologue + "<br>";
  8124. //---===*modGwentRedux Begins*===---
  8125. almanacContents += listPrologue + "<br>";
  8126. //---===*modGwentRedux Ends*===---
  8127. }
  8128. if ( Vizima > 0 )
  8129. {
  8130. almanacContents += GetLocStringByKeyExt( "map_location_wyzima_castle" ) + ": " + Vizima + "<br>";
  8131. //---===*modGwentRedux Begins*===---
  8132. almanacContents += listVizima + "<br>";
  8133. //---===*modGwentRedux Ends*===---
  8134. }
  8135. if ( KaerMorhen > 0 )
  8136. {
  8137. almanacContents += GetLocStringByKeyExt( "map_location_kaer_morhen" ) + ": " + KaerMorhen + "<br>";
  8138. //---===*modGwentRedux Begins*===---
  8139. almanacContents += listKaerMorhen + "<br>";
  8140. //---===*modGwentRedux Ends*===---
  8141. }
  8142. //---===*modGwentRedux Begins*===---
  8143. if ( Random > 0 )
  8144. {
  8145. //---===*modGwentRedux Ends*===---
  8146. almanacContents += GetLocStringByKeyExt( "gwent_source_random" ) + ": " + Random;
  8147. //---===*modGwentRedux Begins*===---
  8148. almanacContents += "<br>" + listRandom + "<br>";
  8149. }
  8150. //---===*modGwentRedux Ends*===---
  8151. }
  8152.  
  8153. return almanacContents;
  8154. }
  8155.  
  8156. public function GetUnusedMutagensCount(itemName:name):int
  8157. {
  8158. var items : array<SItemUniqueId>;
  8159. var equippedOnSlot : EEquipmentSlots;
  8160. var availableCount : int;
  8161. var res, i : int = 0;
  8162.  
  8163. items = thePlayer.inv.GetItemsByName(itemName);
  8164.  
  8165. for(i=0; i<items.Size(); i+=1)
  8166. {
  8167. equippedOnSlot = GetWitcherPlayer().GetItemSlot( items[i] );
  8168.  
  8169. if(equippedOnSlot == EES_InvalidSlot)
  8170. {
  8171. availableCount = thePlayer.inv.GetItemQuantity( items[i] );
  8172. res = res + availableCount;
  8173. }
  8174. }
  8175.  
  8176. return res;
  8177. }
  8178.  
  8179. public function GetFirstUnusedMutagenByName( itemName : name ):SItemUniqueId
  8180. {
  8181. var items : array<SItemUniqueId>;
  8182. var equippedOnSlot : EEquipmentSlots;
  8183. var availableCount : int;
  8184. var res, i : int = 0;
  8185.  
  8186. items = thePlayer.inv.GetItemsByName(itemName);
  8187.  
  8188. for(i=0; i<items.Size(); i+=1)
  8189. {
  8190. equippedOnSlot = GetWitcherPlayer().GetItemSlot( items[i] );
  8191.  
  8192. if( equippedOnSlot == EES_InvalidSlot )
  8193. {
  8194. return items[i];
  8195. }
  8196. }
  8197.  
  8198. return GetInvalidUniqueId();
  8199. }
  8200.  
  8201. // W3EE - Begin
  8202. public function RemoveUnusedMutagensCountById( itemId:SItemUniqueId, count:int ):bool
  8203. {
  8204. return RemoveUnusedMutagensCount( thePlayer.inv.GetItemName( itemId ), count );
  8205. }
  8206.  
  8207. public function RemoveUnusedMutagensCount( itemName:name, count:int ):bool
  8208. {
  8209. var items : array<SItemUniqueId>;
  8210. var curItem : SItemUniqueId;
  8211. var equippedOnSlot : EEquipmentSlots;
  8212.  
  8213. var i : int;
  8214. var itemRemoved : int;
  8215. var availableToRemoved : int;
  8216. var removedRes : bool;
  8217.  
  8218. itemRemoved = 0;
  8219. items = thePlayer.inv.GetItemsByName( itemName );
  8220.  
  8221. for( i=0; i < items.Size(); i+=1 )
  8222. {
  8223. curItem = items[ i ];
  8224. equippedOnSlot = GetWitcherPlayer().GetItemSlot( curItem );
  8225.  
  8226. if( equippedOnSlot == EES_InvalidSlot )
  8227. {
  8228. availableToRemoved = Min( thePlayer.inv.GetItemQuantity( curItem ), ( count - itemRemoved ) );
  8229. removedRes = thePlayer.inv.RemoveItem(items[i], availableToRemoved);
  8230.  
  8231. if (removedRes)
  8232. {
  8233. itemRemoved = itemRemoved + availableToRemoved;
  8234.  
  8235. if (itemRemoved >= count)
  8236. {
  8237. return true;
  8238. }
  8239. }
  8240.  
  8241. }
  8242. }
  8243. return false;
  8244. }
  8245. // W3EE - End
  8246.  
  8247. //Plasticmetal - LootTweak ++
  8248. function AlchemyColor( item: SItemUniqueId ) :string
  8249. {
  8250. var msg : string;
  8251.  
  8252. msg = this.GetItemLocNameByID(item);
  8253.  
  8254. if(this.ItemHasTag(item, 'primer_vitriol'))
  8255. msg = "<font color=\"#1595b0\">" +msg + "</font>";
  8256. else if (this.ItemHasTag(item, 'primer_rebis'))
  8257. msg = "<font color=\"#4db323\">" +msg + "</font>";
  8258. else if (this.ItemHasTag(item, 'primer_aether'))
  8259. msg = "<font color=\"#7764a9\">" +msg + "</font>";
  8260. else if (this.ItemHasTag(item, 'primer_quebrith'))
  8261. msg = "<font color=\"#be8728\">" +msg + "</font>";
  8262. else if (this.ItemHasTag(item, 'primer_hydragenum'))
  8263. msg = "<font color=\"#b0b0b0\">" +msg + "</font>";
  8264. else if (this.ItemHasTag(item, 'primer_vermilion'))
  8265. msg = "<font color=\"#d25212\">" +msg + "</font>";
  8266.  
  8267. return msg;
  8268.  
  8269. }
  8270.  
  8271. function AlchemySecondary(item : SItemUniqueId ) :string
  8272. {
  8273. var msg: string;
  8274.  
  8275. if(this.ItemHasTag(item, 'primer_albedo'))
  8276. msg =" " + "<font color=\"#e0e0e0\">" +"[Albedo]" + "</font>";
  8277. else if (this.ItemHasTag(item, 'primer_rubedo'))
  8278. msg = " " +"<font color=\"#C52C34\">" +"[Rubedo]" + "</font>";
  8279. else if (this.ItemHasTag(item, 'primer_nigredo'))
  8280. msg = " " +"<font color=\"#4F4F4F\">" +"[Nigredo]" + "</font>";
  8281.  
  8282. return msg;
  8283. }
  8284. //Plasticmetal - LootTweak --
  8285.  
  8286. exec function findMissingCards( optional card : name )
  8287. {
  8288. var inv : CInventoryComponent = thePlayer.GetInventory();
  8289. var sourcesRemaining : array< SCardSourceData >;
  8290. var missingCards : array< name >;
  8291. var i : int;
  8292. var sourceLogString : string;
  8293.  
  8294. if ( card != '' )
  8295. {
  8296. missingCards.PushBack( card );
  8297. }
  8298. else
  8299. {
  8300. missingCards = inv.GetMissingCards();
  8301. }
  8302.  
  8303. sourcesRemaining = inv.FindCardSources( missingCards );
  8304.  
  8305. for ( i = 0 ; i < sourcesRemaining.Size() ; i+=1 )
  8306. {
  8307. sourceLogString = sourcesRemaining[i].cardName + " is a " + sourcesRemaining[i].source ;
  8308. if ( sourcesRemaining[i].originArea == "Random" )
  8309. {
  8310. sourceLogString += " card from a random merchant.";
  8311. }
  8312. else
  8313. {
  8314. sourceLogString += " item in " + sourcesRemaining[i].originArea + " from ";
  8315.  
  8316. if ( sourcesRemaining[i].originQuest != "" )
  8317. {
  8318. sourceLogString += sourcesRemaining[i].originQuest + " , ";
  8319. }
  8320.  
  8321. sourceLogString += sourcesRemaining[i].details;
  8322. }
  8323. Log( sourceLogString );
  8324.  
  8325. if ( sourcesRemaining[i].coords != "" )
  8326. {
  8327. Log( sourcesRemaining[i].coords );
  8328. }
  8329. }
  8330. }
  8331.  
  8332. exec function slotTest()
  8333. {
  8334. var inv : CInventoryComponent = thePlayer.inv;
  8335. var weaponItemId : SItemUniqueId;
  8336. var upgradeItemId : SItemUniqueId;
  8337. var i : int;
  8338.  
  8339. LogChannel('SlotTest', "----------------------------------------------------------------");
  8340.  
  8341.  
  8342. inv.AddAnItem( 'Perun rune', 1);
  8343. inv.AddAnItem( 'Svarog rune', 1);
  8344.  
  8345.  
  8346. for ( i = 0; i < 2; i += 1 )
  8347. {
  8348.  
  8349. if ( !GetItem( inv, 'steelsword', weaponItemId ) ||
  8350. !GetItem( inv, 'upgrade', upgradeItemId ) )
  8351. {
  8352. return;
  8353. }
  8354.  
  8355.  
  8356. PrintItem( inv, weaponItemId );
  8357.  
  8358.  
  8359. if ( inv.EnhanceItemScript( weaponItemId, upgradeItemId ) )
  8360. {
  8361. LogChannel('SlotTest', "Enhanced item");
  8362. }
  8363. else
  8364. {
  8365. LogChannel('SlotTest', "Failed to enhance item!");
  8366. }
  8367. }
  8368.  
  8369.  
  8370. if ( !GetItem( inv, 'steelsword', weaponItemId ) )
  8371. {
  8372. return;
  8373. }
  8374.  
  8375.  
  8376. PrintItem( inv, weaponItemId );
  8377.  
  8378.  
  8379. if ( inv.RemoveItemEnhancementByNameScript( weaponItemId, 'Svarog rune' ) )
  8380. {
  8381. LogChannel('SlotTest', "Removed enhancement");
  8382. }
  8383. else
  8384. {
  8385. LogChannel('SlotTest', "Failed to remove enhancement!");
  8386. }
  8387.  
  8388.  
  8389. if ( !GetItem( inv, 'steelsword', weaponItemId ) )
  8390. {
  8391. return;
  8392. }
  8393.  
  8394.  
  8395. PrintItem( inv, weaponItemId );
  8396.  
  8397.  
  8398. if ( inv.RemoveItemEnhancementByIndexScript( weaponItemId, 0 ) )
  8399. {
  8400. LogChannel('SlotTest', "Removed enhancement");
  8401. }
  8402. else
  8403. {
  8404. LogChannel('SlotTest', "Failed to remove enhancement!");
  8405. }
  8406.  
  8407.  
  8408. if ( !GetItem( inv, 'steelsword', weaponItemId ) )
  8409. {
  8410. return;
  8411. }
  8412.  
  8413.  
  8414. PrintItem( inv, weaponItemId );
  8415. }
  8416.  
  8417. function GetItem( inv : CInventoryComponent, category : name, out itemId : SItemUniqueId ) : bool
  8418. {
  8419. var itemIds : array< SItemUniqueId >;
  8420.  
  8421. itemIds = inv.GetItemsByCategory( category );
  8422. if ( itemIds.Size() > 0 )
  8423. {
  8424. itemId = itemIds[ 0 ];
  8425. return true;
  8426. }
  8427. LogChannel( 'SlotTest', "Failed to get item with GetItemsByCategory( '" + category + "' )" );
  8428. return false;
  8429. }
  8430.  
  8431. function PrintItem( inv : CInventoryComponent, weaponItemId : SItemUniqueId )
  8432. {
  8433. var names : array< name >;
  8434. var tags : array< name >;
  8435. var i : int;
  8436. var line : string;
  8437. var attribute : SAbilityAttributeValue;
  8438.  
  8439. LogChannel('SlotTest', "Slots: " + inv.GetItemEnhancementCount( weaponItemId ) + "/" + inv.GetItemEnhancementSlotsCount( weaponItemId ) );
  8440. inv.GetItemEnhancementItems( weaponItemId, names );
  8441. if ( names.Size() > 0 )
  8442. {
  8443. for ( i = 0; i < names.Size(); i += 1 )
  8444. {
  8445. if ( i == 0 )
  8446. {
  8447. line += "[";
  8448. }
  8449. line += names[ i ];
  8450. if ( i < names.Size() - 1 )
  8451. {
  8452. line += ", ";
  8453. }
  8454. if ( i == names.Size() - 1 )
  8455. {
  8456. line += "]";
  8457. }
  8458. }
  8459. }
  8460. else
  8461. {
  8462. line += "[]";
  8463. }
  8464. LogChannel('SlotTest', "Upgrade item names " + line );
  8465.  
  8466. tags.PushBack('Upgrade');
  8467.  
  8468. attribute = inv.GetItemAttributeValue( weaponItemId, 'PhysicalDamage' );
  8469. LogChannel('SlotTest', "Attribute '" + 'PhysicalDamage' + "' " + attribute.valueBase + " " + attribute.valueMultiplicative + " " + attribute.valueAdditive );
  8470. attribute = inv.GetItemAttributeValue( weaponItemId, 'SilverDamage' );
  8471. LogChannel('SlotTest', "Attribute '" + 'SilverDamage' + "' " + attribute.valueBase + " " + attribute.valueMultiplicative + " " + attribute.valueAdditive );
  8472.  
  8473. attribute = inv.GetItemAttributeValue( weaponItemId, 'PhysicalDamage', tags, true );
  8474. LogChannel('SlotTest', "Attribute '" + 'PhysicalDamage' + "' " + attribute.valueBase + " " + attribute.valueMultiplicative + " " + attribute.valueAdditive );
  8475. attribute = inv.GetItemAttributeValue( weaponItemId, 'SilverDamage', tags, true );
  8476. LogChannel('SlotTest', "Attribute '" + 'SilverDamage' + "' " + attribute.valueBase + " " + attribute.valueMultiplicative + " " + attribute.valueAdditive );
  8477.  
  8478. attribute = inv.GetItemAttributeValue( weaponItemId, 'PhysicalDamage', tags );
  8479. LogChannel('SlotTest', "Attribute '" + 'PhysicalDamage' + "' " + attribute.valueBase + " " + attribute.valueMultiplicative + " " + attribute.valueAdditive );
  8480. attribute = inv.GetItemAttributeValue( weaponItemId, 'SilverDamage', tags );
  8481. LogChannel('SlotTest', "Attribute '" + 'SilverDamage' + "' " + attribute.valueBase + " " + attribute.valueMultiplicative + " " + attribute.valueAdditive );
  8482.  
  8483. }
  8484.  
  8485. function PlayItemEquipSound( itemCategory : name ) : void
  8486. {
  8487. switch( itemCategory )
  8488. {
  8489. case 'steelsword' :
  8490. theSound.SoundEvent("gui_inventory_steelsword_attach");
  8491. return;
  8492. case 'silversword' :
  8493. theSound.SoundEvent("gui_inventory_silversword_attach");
  8494. return;
  8495. case 'secondary' :
  8496. theSound.SoundEvent("gui_inventory_weapon_attach");
  8497. return;
  8498. case 'armor' :
  8499. theSound.SoundEvent("gui_inventory_armor_attach");
  8500. return;
  8501. case 'pants' :
  8502. theSound.SoundEvent("gui_inventory_pants_attach");
  8503. return;
  8504. case 'boots' :
  8505. theSound.SoundEvent("gui_inventory_boots_attach");
  8506. return;
  8507. case 'gloves' :
  8508. theSound.SoundEvent("gui_inventory_gauntlet_attach");
  8509. return;
  8510. case 'potion' :
  8511. theSound.SoundEvent("gui_inventory_potion_attach");
  8512. return;
  8513. case 'petard' :
  8514. theSound.SoundEvent("gui_inventory_bombs_attach");
  8515. return;
  8516. case 'ranged' :
  8517. theSound.SoundEvent("gui_inventory_ranged_attach");
  8518. return;
  8519. case 'herb' :
  8520. theSound.SoundEvent("gui_pick_up_herbs");
  8521. return;
  8522. case 'trophy' :
  8523. case 'horse_bag' :
  8524. theSound.SoundEvent("gui_inventory_horse_bage_attach");
  8525. return;
  8526. case 'horse_blinder' :
  8527. theSound.SoundEvent("gui_inventory_horse_blinder_attach");
  8528. return;
  8529. case 'horse_saddle' :
  8530. theSound.SoundEvent("gui_inventory_horse_saddle_attach");
  8531. return;
  8532. default :
  8533. theSound.SoundEvent("gui_inventory_other_attach");
  8534. return;
  8535. }
  8536. }
  8537.  
  8538. function PlayItemUnequipSound( itemCategory : name ) : void
  8539. {
  8540. switch( itemCategory )
  8541. {
  8542. case 'steelsword' :
  8543. theSound.SoundEvent("gui_inventory_steelsword_back");
  8544. return;
  8545. case 'silversword' :
  8546. theSound.SoundEvent("gui_inventory_silversword_back");
  8547. return;
  8548. case 'secondary' :
  8549. theSound.SoundEvent("gui_inventory_weapon_back");
  8550. return;
  8551. case 'armor' :
  8552. theSound.SoundEvent("gui_inventory_armor_back");
  8553. return;
  8554. case 'pants' :
  8555. theSound.SoundEvent("gui_inventory_pants_back");
  8556. return;
  8557. case 'boots' :
  8558. theSound.SoundEvent("gui_inventory_boots_back");
  8559. return;
  8560. case 'gloves' :
  8561. theSound.SoundEvent("gui_inventory_gauntlet_back");
  8562. return;
  8563. case 'petard' :
  8564. theSound.SoundEvent("gui_inventory_bombs_back");
  8565. return;
  8566. case 'potion' :
  8567. theSound.SoundEvent("gui_inventory_potion_back");
  8568. return;
  8569. case 'ranged' :
  8570. theSound.SoundEvent("gui_inventory_ranged_back");
  8571. return;
  8572. case 'trophy' :
  8573. case 'horse_bag' :
  8574. theSound.SoundEvent("gui_inventory_horse_bage_back");
  8575. return;
  8576. case 'horse_blinder' :
  8577. theSound.SoundEvent("gui_inventory_horse_blinder_back");
  8578. return;
  8579. case 'horse_saddle' :
  8580. theSound.SoundEvent("gui_inventory_horse_saddle_back");
  8581. return;
  8582. default :
  8583. theSound.SoundEvent("gui_inventory_other_back");
  8584. return;
  8585. }
  8586. }
  8587.  
  8588. function PlayItemConsumeSound( item : SItemUniqueId ) : void
  8589. {
  8590. //W3EE - Begin
  8591. if( thePlayer.GetInventory().ItemHasTag( item, 'Bandage' ) )
  8592. return;
  8593. //W3EE - End
  8594.  
  8595. if( thePlayer.GetInventory().ItemHasTag( item, 'Drinks' ) || thePlayer.GetInventory().ItemHasTag( item, 'Alcohol' ) )
  8596. {
  8597. theSound.SoundEvent('gui_inventory_drink');
  8598. }
  8599. else
  8600. {
  8601. theSound.SoundEvent('gui_inventory_eat');
  8602. }
  8603. }
  8604.  
  8605.  
  8606.  
  8607.  
  8608.  
Add Comment
Please, Sign In to add comment