Guest User

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

a guest
Oct 23rd, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 23.48 KB | None | 0 0
  1. /*
  2. Copyright © CD Projekt RED 2015
  3. */
  4.  
  5.  
  6.  
  7.  
  8.  
  9. import class W3Container extends W3LockableEntity
  10. {
  11. editable var isDynamic : bool;
  12.  
  13. editable var skipInventoryPanel : bool;
  14. editable var focusModeHighlight : EFocusModeVisibility;
  15. editable var factOnContainerOpened : string;
  16. var usedByCiri : bool;
  17. editable var allowToInjectBalanceItems : bool;
  18. default allowToInjectBalanceItems = false;
  19. editable var disableLooting : bool;
  20.  
  21. editable var disableStealing : bool;
  22. default disableStealing = true;
  23.  
  24. protected saved var checkedForBonusMoney : bool;
  25.  
  26. private saved var usedByClueStash : EntityHandle;
  27.  
  28. protected optional autobind inv : CInventoryComponent = single;
  29. protected optional autobind lootInteractionComponent : CInteractionComponent = "Loot";
  30. protected var isPlayingInteractionAnim : bool; default isPlayingInteractionAnim = false;
  31. private const var QUEST_HIGHLIGHT_FX : name;
  32.  
  33. hint skipInventoryPanel = "If set then the inventory panel will not be shown upon looting";
  34. hint isDynamic = "set to true if you want to destroy container when empty";
  35. hint focusModeHighlight = "FMV_Interactive: White, FMV_Clue: Red";
  36.  
  37. default skipInventoryPanel = false;
  38. default usedByCiri = false;
  39. default focusModeHighlight = FMV_Interactive;
  40. default QUEST_HIGHLIGHT_FX = 'quest_highlight_fx';
  41. default disableLooting = false;
  42.  
  43. import function SetIsQuestContainer( isQuest : bool );
  44.  
  45. private const var SKIP_NO_DROP_NO_SHOW : bool;
  46. default SKIP_NO_DROP_NO_SHOW = true;
  47.  
  48. event OnSpawned( spawnData : SEntitySpawnData )
  49. {
  50. EnableVisualDebug( SHOW_Containers, true );
  51. super.OnSpawned(spawnData);
  52.  
  53.  
  54. if(disableLooting)
  55. {
  56. SetFocusModeVisibility( FMV_None );
  57. StopQuestItemFx();
  58. if( lootInteractionComponent )
  59. {
  60. lootInteractionComponent.SetEnabled(false);
  61. }
  62. CheckLock();
  63. }
  64. else
  65. {
  66. UpdateContainer();
  67. }
  68. }
  69.  
  70.  
  71. event OnStreamIn()
  72. {
  73. super.OnStreamIn();
  74.  
  75. UpdateContainer();
  76. }
  77.  
  78. event OnSpawnedEditor( spawnData : SEntitySpawnData )
  79. {
  80. EnableVisualDebug( SHOW_Containers, true );
  81. super.OnSpawned( spawnData );
  82. }
  83.  
  84. event OnVisualDebug( frame : CScriptedRenderFrame, flag : EShowFlags )
  85. {
  86. frame.DrawText( GetName(), GetWorldPosition() + Vector( 0, 0, 1.0f ), Color( 255, 0, 255 ) );
  87. frame.DrawSphere( GetWorldPosition(), 1.0f, Color( 255, 0, 255 ) );
  88. return true;
  89. }
  90.  
  91. function UpdateFactItems()
  92. {
  93. var i,j : int;
  94. var items : array<SItemUniqueId>;
  95. var tags : array<name>;
  96. var factName : string;
  97.  
  98.  
  99. if( inv && !disableLooting)
  100. {
  101. inv.GetAllItems( items );
  102. }
  103.  
  104. for(i=0; i<items.Size(); i+=1)
  105. {
  106. tags.Clear();
  107. inv.GetItemTags(items[i], tags);
  108. for(j=0; j<tags.Size(); j+=1)
  109. {
  110. factName = StrAfterLast(NameToString(tags[j]), "fact_hidden_");
  111. if(StrLen(factName) > 0)
  112. {
  113. if(FactsQuerySum(factName) > 0)
  114. {
  115. inv.RemoveItemTag(items[i], theGame.params.TAG_DONT_SHOW);
  116. }
  117. else
  118. {
  119. inv.AddItemTag(items[i], theGame.params.TAG_DONT_SHOW);
  120. }
  121.  
  122. break;
  123. }
  124. }
  125. }
  126. }
  127.  
  128. function InjectItemsOnLevels()
  129. {
  130.  
  131. }
  132.  
  133.  
  134. event OnInteractionActivated( interactionComponentName : string, activator : CEntity )
  135. {
  136. UpdateContainer();
  137. RebalanceItems();
  138. RemoveUnwantedItems();
  139. DisableIfEmpty();
  140.  
  141. super.OnInteractionActivated(interactionComponentName, activator);
  142. if(activator == thePlayer)
  143. {
  144. if ( inv && !disableLooting)
  145. {
  146. inv.UpdateLoot();
  147.  
  148. if(!checkedForBonusMoney)
  149. {
  150. checkedForBonusMoney = true;
  151. CheckForBonusMoney(0);
  152. }
  153. }
  154. if(!disableLooting && (!thePlayer.IsInCombat() || IsEnabledInCombat()) )
  155. HighlightEntity();
  156.  
  157. if ( interactionComponentName == "Medallion" && isMagicalObject )
  158. SenseMagic();
  159.  
  160. if( (!IsEmpty() && !disableLooting) || lockedByKey)
  161. {
  162. ShowInteractionComponent();
  163. }
  164. }
  165. }
  166.  
  167.  
  168. event OnInteractionDeactivated( interactionComponentName : string, activator : CEntity )
  169. {
  170. super.OnInteractionDeactivated(interactionComponentName, activator);
  171.  
  172. if(activator == thePlayer)
  173. {
  174. UnhighlightEntity();
  175. }
  176. }
  177.  
  178.  
  179. public final function IsEnabledInCombat() : bool
  180. {
  181. if( !lootInteractionComponent || disableLooting)
  182. {
  183. return false;
  184. }
  185.  
  186. return lootInteractionComponent.IsEnabledInCombat();
  187. }
  188.  
  189. public function InformClueStash()
  190. {
  191. var clueStash : W3ClueStash;
  192. clueStash = ( W3ClueStash )EntityHandleGet( usedByClueStash );
  193. if( clueStash )
  194. {
  195. clueStash.OnContainerEvent();
  196. }
  197. }
  198.  
  199. event OnItemGiven(data : SItemChangedData)
  200. {
  201. super.OnItemGiven(data);
  202.  
  203. if(isEnabled)
  204. UpdateContainer();
  205.  
  206. InformClueStash();
  207. }
  208.  
  209. function ReadSchematicsAndRecipes()
  210. {
  211. }
  212.  
  213.  
  214. event OnItemTaken(itemId : SItemUniqueId, quantity : int)
  215. {
  216. super.OnItemTaken(itemId, quantity);
  217.  
  218. if(!HasQuestItem())
  219. {
  220. StopQuestItemFx();
  221. }
  222.  
  223. InformClueStash();
  224. }
  225.  
  226. event OnUpdateContainer()
  227. {
  228.  
  229. }
  230.  
  231. protected final function UpdateContainer()
  232. {
  233. var medalion : CComponent;
  234. var foliageComponent : CSwitchableFoliageComponent;
  235. var itemCategory : name;
  236.  
  237. foliageComponent = ( CSwitchableFoliageComponent ) GetComponentByClassName( 'CSwitchableFoliageComponent' );
  238.  
  239. if(!disableLooting)
  240. UpdateFactItems();
  241.  
  242. if( inv && !disableLooting)
  243. {
  244. inv.UpdateLoot();
  245. }
  246.  
  247.  
  248. if ( !theGame.IsActive() || ( inv && !disableLooting && isEnabled && !inv.IsEmpty( SKIP_NO_DROP_NO_SHOW ) ) )
  249. {
  250. SetFocusModeVisibility( focusModeHighlight );
  251. AddTag('HighlightedByMedalionFX');
  252.  
  253. if ( foliageComponent )
  254. foliageComponent.SetAndSaveEntry( 'full' );
  255. else
  256. ApplyAppearance("1_full");
  257.  
  258. if( HasQuestItem() )
  259. {
  260. SetIsQuestContainer( true );
  261. PlayQuestItemFx();
  262. }
  263. }
  264. else
  265. {
  266. SetFocusModeVisibility( FMV_None );
  267.  
  268. if ( foliageComponent && !disableLooting)
  269. foliageComponent.SetAndSaveEntry( 'empty' );
  270. else
  271. ApplyAppearance("2_empty");
  272.  
  273. StopQuestItemFx();
  274. }
  275.  
  276. if ( !isMagicalObject )
  277. {
  278. medalion = GetComponent("Medallion");
  279. if(medalion)
  280. {
  281. medalion.SetEnabled( false );
  282. }
  283. }
  284.  
  285. if(lootInteractionComponent)
  286. {
  287. if(disableLooting)
  288. {
  289. lootInteractionComponent.SetEnabled(false);
  290. }
  291. else
  292. {
  293. lootInteractionComponent.SetEnabled( inv && !inv.IsEmpty( SKIP_NO_DROP_NO_SHOW ) ) ;
  294. }
  295. }
  296.  
  297. if(!disableLooting)
  298. OnUpdateContainer();
  299.  
  300. CheckForDimeritium();
  301. CheckLock();
  302.  
  303. }
  304.  
  305. function RebalanceItems()
  306. {
  307. var i : int;
  308. var items : array<SItemUniqueId>;
  309.  
  310. if( inv && !disableLooting)
  311. {
  312. inv.AutoBalanaceItemsWithPlayerLevel();
  313. inv.GetAllItems( items );
  314. }
  315.  
  316. for(i=0; i<items.Size(); i+=1)
  317. {
  318.  
  319. if ( inv.GetItemModifierInt(items[i], 'ItemQualityModified') > 0 )
  320. continue;
  321.  
  322. inv.AddRandomEnhancementToItem(items[i]);
  323. }
  324. }
  325.  
  326. protected final function HighlightEntity()
  327. {
  328. isHighlightedByMedallion = true;
  329. }
  330.  
  331. protected final function UnhighlightEntity()
  332. {
  333. StopEffect('medalion_detection_fx');
  334. StopEffect('medalion_fx');
  335. isHighlightedByMedallion = false;
  336. }
  337.  
  338. public final function HasQuestItem() : bool
  339. {
  340. if( !inv || disableLooting)
  341. {
  342. return false;
  343. }
  344.  
  345. return inv.HasQuestItem();
  346. }
  347.  
  348. public function CheckForDimeritium()
  349. {
  350. if (inv && !disableLooting)
  351. {
  352. if ( inv.HasItemByTag('Dimeritium'))
  353. {
  354. if (!this.HasTag('Potestaquisitor')) this.AddTag('Potestaquisitor');
  355. }
  356. else
  357. {
  358. if (this.HasTag('Potestaquisitor')) this.RemoveTag('Potestaquisitor');
  359. }
  360. }
  361. else
  362. {
  363. if (this.HasTag('Potestaquisitor')) this.RemoveTag('Potestaquisitor');
  364. }
  365. }
  366.  
  367.  
  368. public final function OnTryToGiveItem( itemId : SItemUniqueId ) : bool
  369. {
  370. return true;
  371. }
  372.  
  373.  
  374. public function TakeAllItems()
  375. {
  376. var targetInv : CInventoryComponent;
  377. var allItems : array< SItemUniqueId >;
  378. var ciriEntity : W3ReplacerCiri;
  379. var i : int;
  380. var itemsCategories : array< name >;
  381. var category : name;
  382.  
  383.  
  384. targetInv = thePlayer.inv;
  385.  
  386. if( !inv || !targetInv )
  387. {
  388. return;
  389. }
  390.  
  391. inv.GetAllItems( allItems );
  392.  
  393. LogChannel( 'ITEMS___', ">>>>>>>>>>>>>> TakeAllItems " + allItems.Size() );
  394.  
  395. for(i=0; i<allItems.Size(); i+=1)
  396. {
  397. if( inv.ItemHasTag(allItems[i], 'Lootable' ) || !inv.ItemHasTag(allItems[i], 'NoDrop') && !inv.ItemHasTag(allItems[i], theGame.params.TAG_DONT_SHOW))
  398. {
  399. inv.NotifyItemLooted( allItems[ i ] );
  400.  
  401. if( inv.ItemHasTag(allItems[i], 'HerbGameplay') )
  402. {
  403. category = 'herb';
  404. }
  405. else
  406. {
  407. category = inv.GetItemCategory(allItems[i]);
  408. }
  409.  
  410. if( itemsCategories.FindFirst( category ) == -1 )
  411. {
  412. itemsCategories.PushBack( category );
  413. }
  414. inv.GiveItemTo(targetInv, allItems[i], inv.GetItemQuantity(allItems[i]), true, false, true );
  415. }
  416. }
  417. if( itemsCategories.Size() == 1 )
  418. {
  419. PlayItemEquipSound(itemsCategories[0]);
  420. }
  421. else
  422. {
  423. PlayItemEquipSound('generic');
  424. }
  425.  
  426. LogChannel( 'ITEMS___', "<<<<<<<<<<<<<< TakeAllItems");
  427.  
  428.  
  429. InformClueStash();
  430. }
  431.  
  432.  
  433. event OnInteraction( actionName : string, activator : CEntity )
  434. {
  435. var processed : bool;
  436. var i,j : int;
  437. var m_schematicList, m_recipeList : array< name >;
  438. var itemCategory : name;
  439. var attr : SAbilityAttributeValue;
  440.  
  441. if ( activator != thePlayer || isInteractionBlocked || IsEmpty() )
  442. return false;
  443.  
  444. if ( activator == (W3ReplacerCiri)thePlayer )
  445. {
  446. skipInventoryPanel = true;
  447. usedByCiri = true;
  448. }
  449.  
  450. if ( StrLen( factOnContainerOpened ) > 0 && !FactsDoesExist ( factOnContainerOpened ) && ( actionName == "Container" || actionName == "Unlock" ) )
  451. {
  452. FactsAdd ( factOnContainerOpened, 1, -1 );
  453. }
  454.  
  455.  
  456. m_recipeList = GetWitcherPlayer().GetAlchemyRecipes();
  457. m_schematicList = GetWitcherPlayer().GetCraftingSchematicsNames();
  458.  
  459.  
  460. if ( FactsQuerySum("NewGamePlus") > 0 )
  461. {
  462. AddWolfNewGamePlusSchematics();
  463. KeepWolfWitcherSetSchematics(m_schematicList);
  464. }
  465.  
  466. InjectItemsOnLevels();
  467.  
  468. processed = super.OnInteraction(actionName, activator);
  469. if(processed)
  470. return true;
  471.  
  472. if(actionName != "Container" && actionName != "GatherHerbs")
  473. return false;
  474.  
  475. ProcessLoot ();
  476.  
  477. return true;
  478. }
  479.  
  480. function RemoveUnwantedItems()
  481. {
  482. var allItems : array< SItemUniqueId >;
  483. var i,j : int;
  484. var m_schematicList, m_recipeList : array< name >;
  485. var itemName : name;
  486.  
  487. if ( !HasTag('lootbag') )
  488. {
  489. m_recipeList = GetWitcherPlayer().GetAlchemyRecipes();
  490. m_schematicList = GetWitcherPlayer().GetCraftingSchematicsNames();
  491.  
  492. inv.GetAllItems( allItems );
  493. for ( i=0; i<allItems.Size(); i+=1 )
  494. {
  495. itemName = inv.GetItemName( allItems[i] );
  496.  
  497.  
  498. for( j = 0; j < m_recipeList.Size(); j+= 1 )
  499. {
  500. if ( itemName == m_recipeList[j] )
  501. {
  502. inv.RemoveItem( allItems[i], inv.GetItemQuantity( allItems[i] ) );
  503. inv.NotifyItemLooted( allItems[i] );
  504.  
  505. }
  506. }
  507.  
  508. for( j = 0; j < m_schematicList.Size(); j+= 1 )
  509. {
  510. if ( itemName == m_schematicList[j] )
  511. {
  512. inv.RemoveItem( allItems[i], inv.GetItemQuantity( allItems[i] ) );
  513. inv.NotifyItemLooted( allItems[i] );
  514.  
  515. }
  516. }
  517.  
  518. if ( GetWitcherPlayer().GetLevel() - 1 > 1 && inv.GetItemLevel( allItems[i] ) == 1 && inv.ItemHasTag(allItems[i], 'Autogen') )
  519. {
  520. inv.RemoveItemCraftedAbility(allItems[i], 'autogen_steel_base');
  521. inv.RemoveItemCraftedAbility(allItems[i], 'autogen_silver_base');
  522. inv.RemoveItemCraftedAbility(allItems[i], 'autogen_armor_base');
  523. inv.RemoveItemCraftedAbility(allItems[i], 'autogen_pants_base');
  524. inv.RemoveItemCraftedAbility(allItems[i], 'autogen_gloves_base');
  525. inv.GenerateItemLevel(allItems[i]);
  526. }
  527.  
  528.  
  529. if ( inv.GetItemCategory(allItems[i]) == 'gwint' )
  530. {
  531. inv.ClearGwintCards();
  532. }
  533.  
  534. if ( ( thePlayer.GetLevel() < 10 ) && ( GetInventory().GetItemLevel( allItems[i] ) > thePlayer.GetLevel() + 5 ) )
  535. {
  536. inv.RemoveItem( allItems[i], inv.GetItemQuantity( allItems[i] ) );
  537. inv.NotifyItemLooted( allItems[i] );
  538.  
  539. }
  540. }
  541. }
  542. }
  543.  
  544. function ProcessLoot()
  545. {
  546. if(disableLooting)
  547. return;
  548.  
  549. if(skipInventoryPanel || usedByCiri)
  550. {
  551. TakeAllItems();
  552. OnContainerClosed();
  553. }
  554. else
  555. {
  556. ShowLoot();
  557. }
  558. }
  559.  
  560. private function KeepWolfWitcherSetSchematics(out m_schematicList : array< name >)
  561. {
  562. var index : int;
  563.  
  564.  
  565. index = m_schematicList.FindFirst('Wolf Armor schematic');
  566. if ( index > -1 ) m_schematicList.Erase( index );
  567. index = m_schematicList.FindFirst('Witcher Wolf Jacket Upgrade schematic 1');
  568. if ( index > -1 ) m_schematicList.Erase( index );
  569. index = m_schematicList.FindFirst('Witcher Wolf Jacket Upgrade schematic 2');
  570. if ( index > -1 ) m_schematicList.Erase( index );
  571. index = m_schematicList.FindFirst('Witcher Wolf Jacket Upgrade schematic 3');
  572. if ( index > -1 ) m_schematicList.Erase( index );
  573.  
  574. index = m_schematicList.FindFirst('Wolf Gloves schematic');
  575. if ( index > -1 ) m_schematicList.Erase( index );
  576. index = m_schematicList.FindFirst('Witcher Wolf Gloves Upgrade schematic 1');
  577. if ( index > -1 ) m_schematicList.Erase( index );
  578. index = m_schematicList.FindFirst('Witcher Wolf Gloves Upgrade schematic 2');
  579. if ( index > -1 ) m_schematicList.Erase( index );
  580. index = m_schematicList.FindFirst('Witcher Wolf Gloves Upgrade schematic 3');
  581. if ( index > -1 ) m_schematicList.Erase( index );
  582.  
  583. index = m_schematicList.FindFirst('Wolf Pants schematic');
  584. if ( index > -1 ) m_schematicList.Erase( index );
  585. index = m_schematicList.FindFirst('Witcher Wolf Pants Upgrade schematic 1');
  586. if ( index > -1 ) m_schematicList.Erase( index );
  587. index = m_schematicList.FindFirst('Witcher Wolf Pants Upgrade schematic 2');
  588. if ( index > -1 ) m_schematicList.Erase( index );
  589. index = m_schematicList.FindFirst('Witcher Wolf Pants Upgrade schematic 3');
  590. if ( index > -1 ) m_schematicList.Erase( index );
  591.  
  592. index = m_schematicList.FindFirst('Wolf Boots schematic');
  593. if ( index > -1 ) m_schematicList.Erase( index );
  594. index = m_schematicList.FindFirst('Witcher Wolf Boots Upgrade schematic 1');
  595. if ( index > -1 ) m_schematicList.Erase( index );
  596. index = m_schematicList.FindFirst('Witcher Wolf Boots Upgrade schematic 2');
  597. if ( index > -1 ) m_schematicList.Erase( index );
  598. index = m_schematicList.FindFirst('Witcher Wolf Boots Upgrade schematic 3');
  599. if ( index > -1 ) m_schematicList.Erase( index );
  600.  
  601. index = m_schematicList.FindFirst('Wolf School steel sword schematic');
  602. if ( index > -1 ) m_schematicList.Erase( index );
  603. index = m_schematicList.FindFirst('Wolf School steel sword Upgrade schematic 1');
  604. if ( index > -1 ) m_schematicList.Erase( index );
  605. index = m_schematicList.FindFirst('Wolf School steel sword Upgrade schematic 2');
  606. if ( index > -1 ) m_schematicList.Erase( index );
  607. index = m_schematicList.FindFirst('Wolf School steel sword Upgrade schematic 3');
  608. if ( index > -1 ) m_schematicList.Erase( index );
  609.  
  610. index = m_schematicList.FindFirst('Wolf School silver sword schematic');
  611. if ( index > -1 ) m_schematicList.Erase( index );
  612. index = m_schematicList.FindFirst('Wolf School silver sword Upgrade schematic 1');
  613. if ( index > -1 ) m_schematicList.Erase( index );
  614. index = m_schematicList.FindFirst('Wolf School silver sword Upgrade schematic 2');
  615. if ( index > -1 ) m_schematicList.Erase( index );
  616. index = m_schematicList.FindFirst('Wolf School silver sword Upgrade schematic 3');
  617. if ( index > -1 ) m_schematicList.Erase( index );
  618. }
  619.  
  620. private function AddWolfNewGamePlusSchematics()
  621. {
  622. var allItems : array< SItemUniqueId >;
  623. var i : int;
  624. var itemName : name;
  625.  
  626. inv.GetAllItems( allItems );
  627. for ( i=0; i<allItems.Size(); i+=1 )
  628. {
  629. itemName = inv.GetItemName( allItems[i] );
  630.  
  631.  
  632. if ( itemName == 'Wolf Armor schematic' && !inv.HasItem('NGP Wolf Armor schematic') )
  633. inv.AddAnItem( 'NGP Wolf Armor schematic', 1, true, true);
  634. if ( itemName == 'Witcher Wolf Jacket Upgrade schematic 1' && !inv.HasItem('NGP Witcher Wolf Jacket Upgrade schematic 1') )
  635. inv.AddAnItem( 'NGP Witcher Wolf Jacket Upgrade schematic 1', 1, true, true);
  636. if ( itemName == 'Witcher Wolf Jacket Upgrade schematic 2' && !inv.HasItem('NGP Witcher Wolf Jacket Upgrade schematic 2') )
  637. inv.AddAnItem( 'NGP Witcher Wolf Jacket Upgrade schematic 2', 1, true, true);
  638. if ( itemName == 'Witcher Wolf Jacket Upgrade schematic 3' && !inv.HasItem('NGP Witcher Wolf Jacket Upgrade schematic 3') )
  639. inv.AddAnItem( 'NGP Witcher Wolf Jacket Upgrade schematic 3', 1, true, true);
  640.  
  641. if ( itemName == 'Wolf Gloves schematic' && !inv.HasItem('NGP Wolf Gloves schematic') )
  642. inv.AddAnItem( 'NGP Wolf Gloves schematic', 1, true, true);
  643. if ( itemName == 'Witcher Wolf Gloves Upgrade schematic 1' && !inv.HasItem('NGP Witcher Wolf Gloves Upgrade schematic 1') )
  644. inv.AddAnItem( 'NGP Witcher Wolf Gloves Upgrade schematic 1', 1, true, true);
  645. if ( itemName == 'Witcher Wolf Gloves Upgrade schematic 2' && !inv.HasItem('NGP Witcher Wolf Gloves Upgrade schematic 2') )
  646. inv.AddAnItem( 'NGP Witcher Wolf Gloves Upgrade schematic 2', 1, true, true);
  647. if ( itemName == 'Witcher Wolf Gloves Upgrade schematic 3' && !inv.HasItem('NGP Witcher Wolf Gloves Upgrade schematic 3') )
  648. inv.AddAnItem( 'NGP Witcher Wolf Gloves Upgrade schematic 3', 1, true, true);
  649.  
  650. if ( itemName == 'Wolf Pants schematic' && !inv.HasItem('NGP Wolf Pants schematic') )
  651. inv.AddAnItem( 'NGP Wolf Pants schematic', 1, true, true);
  652. if ( itemName == 'Witcher Wolf Pants Upgrade schematic 1' && !inv.HasItem('NGP Witcher Wolf Pants Upgrade schematic 1') )
  653. inv.AddAnItem( 'NGP Witcher Wolf Pants Upgrade schematic 1', 1, true, true);
  654. if ( itemName == 'Witcher Wolf Pants Upgrade schematic 2' && !inv.HasItem('NGP Witcher Wolf Pants Upgrade schematic 2') )
  655. inv.AddAnItem( 'NGP Witcher Wolf Pants Upgrade schematic 2', 1, true, true);
  656. if ( itemName == 'Witcher Wolf Pants Upgrade schematic 3' && !inv.HasItem('NGP Witcher Wolf Pants Upgrade schematic 3') )
  657. inv.AddAnItem( 'NGP Witcher Wolf Pants Upgrade schematic 3', 1, true, true);
  658.  
  659. if ( itemName == 'Wolf Boots schematic' && !inv.HasItem('NGP Wolf Boots schematic') )
  660. inv.AddAnItem( 'NGP Wolf Boots schematic', 1, true, true);
  661. if ( itemName == 'Witcher Wolf Boots Upgrade schematic 1' && !inv.HasItem('NGP Witcher Wolf Boots Upgrade schematic 1') )
  662. inv.AddAnItem( 'NGP Witcher Wolf Boots Upgrade schematic 1', 1, true, true);
  663. if ( itemName == 'Witcher Wolf Boots Upgrade schematic 2' && !inv.HasItem('NGP Witcher Wolf Boots Upgrade schematic 2') )
  664. inv.AddAnItem( 'NGP Witcher Wolf Boots Upgrade schematic 2', 1, true, true);
  665. if ( itemName == 'Witcher Wolf Boots Upgrade schematic 3' && !inv.HasItem('NGP Witcher Wolf Boots Upgrade schematic 3') )
  666. inv.AddAnItem( 'NGP Witcher Wolf Boots Upgrade schematic 3', 1, true, true);
  667.  
  668. if ( itemName == 'Wolf School steel sword schematic' && !inv.HasItem('NGP Wolf School steel sword schematic') )
  669. inv.AddAnItem( 'NGP Wolf School steel sword schematic', 1, true, true);
  670. if ( itemName == 'Wolf School steel sword Upgrade schematic 1' && !inv.HasItem('NGP Wolf School steel sword Upgrade schematic 1') )
  671. inv.AddAnItem( 'NGP Wolf School steel sword Upgrade schematic 1', 1, true, true);
  672. if ( itemName == 'Wolf School steel sword Upgrade schematic 2' && !inv.HasItem('NGP Wolf School steel sword Upgrade schematic 2') )
  673. inv.AddAnItem( 'NGP Wolf School steel sword Upgrade schematic 2', 1, true, true);
  674. if ( itemName == 'Wolf School steel sword Upgrade schematic 3' && !inv.HasItem('NGP Wolf School steel sword Upgrade schematic 3') )
  675. inv.AddAnItem( 'NGP Wolf School steel sword Upgrade schematic 3', 1, true, true);
  676.  
  677. if ( itemName == 'Wolf School silver sword schematic' && !inv.HasItem('NGP Wolf School silver sword schematic') )
  678. inv.AddAnItem( 'NGP Wolf School silver sword schematic', 1, true, true);
  679. if ( itemName == 'Wolf School silver sword Upgrade schematic 1' && !inv.HasItem('NGP Wolf School silver sword Upgrade schematic 1') )
  680. inv.AddAnItem( 'NGP Wolf School silver sword Upgrade schematic 1', 1, true, true);
  681. if ( itemName == 'Wolf School silver sword Upgrade schematic 2' && !inv.HasItem('NGP Wolf School silver sword Upgrade schematic 2') )
  682. inv.AddAnItem( 'NGP Wolf School silver sword Upgrade schematic 2', 1, true, true);
  683. if ( itemName == 'Wolf School silver sword Upgrade schematic 3' && !inv.HasItem('NGP Wolf School silver sword Upgrade schematic 3') )
  684. inv.AddAnItem( 'NGP Wolf School silver sword Upgrade schematic 3', 1, true, true);
  685. }
  686. }
  687.  
  688. event OnStateChange( newState : bool )
  689. {
  690. if( lootInteractionComponent )
  691. {
  692. lootInteractionComponent.SetEnabled( newState );
  693. }
  694.  
  695. super.OnStateChange( newState );
  696. }
  697.  
  698.  
  699. public final function ShowLoot()
  700. {
  701. var lootData : W3LootPopupData;
  702. // CA
  703. if ( CALootAnimOn() && !thePlayer.IsSwimming() && !((CALootAnimType() == LAT_noherb || CALootAnimType() == LAT_altnoherb ) && (W3Herb)this) ) {
  704. thePlayer.completeAnims.SetContainer( this );
  705. thePlayer.completeAnims.LootAnim( this );
  706. } else {
  707. lootData = new W3LootPopupData in this;
  708. lootData.targetContainer = this;
  709. theGame.RequestPopup('LootPopup', lootData);
  710. }
  711. // CA
  712.  
  713. }
  714.  
  715. public function IsEmpty() : bool { return !inv || inv.IsEmpty( SKIP_NO_DROP_NO_SHOW ); }
  716.  
  717. public function Enable(e : bool, optional skipInteractionUpdate : bool, optional questForcedEnable : bool)
  718. {
  719. if( !(e && questForcedEnable) )
  720. {
  721.  
  722. if(e && IsEmpty() )
  723. {
  724. return;
  725. }
  726. else
  727. {
  728. UpdateContainer();
  729. }
  730. }
  731.  
  732. super.Enable(e, skipInteractionUpdate);
  733. }
  734.  
  735.  
  736. public function OnContainerClosed()
  737. {
  738. // CA
  739. if (thePlayer.completeAnims.PerformingAnimation()) {
  740. thePlayer.completeAnims.SetLoop( false );
  741. if ( CALootAnimType() == LAT_all || CALootAnimType() == LAT_noherb )
  742. thePlayer.GotoState( 'CAInterruption' );
  743. }
  744. // CA
  745. if(!HasQuestItem())
  746. StopQuestItemFx();
  747.  
  748. DisableIfEmpty();
  749. }
  750.  
  751. protected function DisableIfEmpty()
  752. {
  753. if(IsEmpty())
  754. {
  755. SetFocusModeVisibility( FMV_None );
  756.  
  757. RemoveTag('HighlightedByMedalionFX');
  758.  
  759.  
  760. UnhighlightEntity();
  761.  
  762.  
  763. Enable(false);
  764.  
  765.  
  766. ApplyAppearance("2_empty");
  767.  
  768. if(isDynamic)
  769. {
  770. Destroy();
  771. return;
  772. }
  773. }
  774. }
  775.  
  776.  
  777. protected final function CheckForBonusMoney(oldMoney : int)
  778. {
  779. var money, bonusMoney : int;
  780.  
  781. if( !inv )
  782. {
  783. return;
  784. }
  785.  
  786. money = inv.GetMoney() - oldMoney;
  787. if(money <= 0)
  788. {
  789. return;
  790. }
  791.  
  792. bonusMoney = RoundMath(money * CalculateAttributeValue(thePlayer.GetAttributeValue('bonus_money')));
  793. if(bonusMoney > 0)
  794. {
  795. inv.AddMoney(bonusMoney);
  796. }
  797. }
  798.  
  799. public final function PlayQuestItemFx()
  800. {
  801. PlayEffectSingle(QUEST_HIGHLIGHT_FX);
  802. }
  803.  
  804. public final function StopQuestItemFx()
  805. {
  806. StopEffect(QUEST_HIGHLIGHT_FX);
  807. }
  808.  
  809. public function GetSkipInventoryPanel():bool
  810. {
  811. return skipInventoryPanel;
  812. }
  813.  
  814. public function CanShowFocusInteractionIcon() : bool
  815. {
  816. return inv && !disableLooting && isEnabled && !inv.IsEmpty( SKIP_NO_DROP_NO_SHOW );
  817. }
  818.  
  819. public function RegisterClueStash( clueStash : W3ClueStash )
  820. {
  821. EntityHandleSet( usedByClueStash, clueStash );
  822. }
  823. }
Add Comment
Please, Sign In to add comment