@@ -333,6 +333,9 @@ protected override void Setup()
333333 UpdateLocalTargetIcon ( ) ;
334334 UpdateRemoteTargetIcon ( ) ;
335335
336+ // Setup quest items
337+ UpdateQuestItems ( ) ;
338+
336339 // Store toggle closed binding for this window
337340 SetupClosedBinding ( ) ;
338341 }
@@ -779,6 +782,9 @@ public virtual void Refresh(bool refreshPaperDoll = true)
779782 UpdateLocalTargetIcon ( ) ;
780783 UpdateRemoteTargetIcon ( ) ;
781784
785+ // Refresh quest items
786+ UpdateQuestItems ( ) ;
787+
782788 // Refresh paper doll
783789 if ( refreshPaperDoll )
784790 paperDoll . Refresh ( ) ;
@@ -986,15 +992,51 @@ protected void UpdateAccessoryItemsDisplay()
986992 // Update button and panel
987993 ImageData image = DaggerfallUnity . Instance . ItemHelper . GetInventoryImage ( item ) ;
988994 panel . BackgroundTexture = image . texture ;
989- if ( image . width != 0 && image . height != 0 )
990- panel . Size = new Vector2 ( image . width , image . height ) ;
991- else
992- panel . Size = new Vector2 ( image . texture . width , image . texture . height ) ;
995+ if ( image . width != 0 && image . height != 0 )
996+ panel . Size = new Vector2 ( image . width , image . height ) ;
997+ else
998+ panel . Size = new Vector2 ( image . texture . width , image . texture . height ) ;
993999 button . ToolTipText = item . LongName ;
9941000 button . AnimatedBackgroundTextures = ( item . IsEnchanted ) ? magicAnimation . animatedTextures : null ;
9951001 }
9961002 }
9971003
1004+ /// <summary>
1005+ /// Sync items permanency with virtual quest item.
1006+ /// </summary>
1007+ protected void SyncMakePermanent ( DaggerfallUnityItem item )
1008+ {
1009+ if ( item . IsQuestItem )
1010+ {
1011+ // Get quest item
1012+ Item questItem = GetQuestItem ( item ) ;
1013+
1014+ // Sync permanency between virtual quest item and actual inventory item
1015+ if ( questItem != null && questItem . MadePermanent )
1016+ item . MakePermanent ( ) ;
1017+ }
1018+ }
1019+
1020+ /// <summary>
1021+ /// Updates quest items.
1022+ /// </summary>
1023+ protected void UpdateQuestItems ( )
1024+ {
1025+ if ( localItems != null )
1026+ {
1027+ for ( int i = 0 ; i < localItems . Count ; i ++ )
1028+ {
1029+ DaggerfallUnityItem item = localItems . GetItem ( i ) ;
1030+
1031+ if ( ! item . IsQuestItem )
1032+ continue ;
1033+
1034+ // Stuff to update
1035+ SyncMakePermanent ( item ) ;
1036+ }
1037+ }
1038+ }
1039+
9981040 #endregion
9991041
10001042 #region Private Methods
@@ -2163,12 +2205,12 @@ private int GetNextArchive()
21632205 /// <summary>
21642206 /// Event raised when an item is hovered over in either list, the paperdoll, or accessories.
21652207 /// </summary>
2166- public enum ItemHoverLocation { Accessories , Paperdoll , LocalList , RemoteList }
2167- public delegate void OnItemHoverHandler ( DaggerfallUnityItem item , ItemHoverLocation loc ) ;
2168- public event OnItemHoverHandler OnItemHover ;
2169- protected virtual void RaiseOnItemHoverEvent ( DaggerfallUnityItem item , ItemHoverLocation loc )
2208+ public enum ItemHoverLocation { Accessories , Paperdoll , LocalList , RemoteList }
2209+ public delegate void OnItemHoverHandler ( DaggerfallUnityItem item , ItemHoverLocation loc ) ;
2210+ public event OnItemHoverHandler OnItemHover ;
2211+ protected virtual void RaiseOnItemHoverEvent ( DaggerfallUnityItem item , ItemHoverLocation loc )
21702212 {
2171- OnItemHover ? . Invoke ( item , loc ) ;
2213+ OnItemHover ? . Invoke ( item , loc ) ;
21722214 }
21732215
21742216 protected virtual void PaperDoll_OnMouseMove ( int x , int y )
@@ -2281,6 +2323,6 @@ private void OnCloseWindow()
22812323 OnClose -= OnCloseWindow ;
22822324 }
22832325
2284- #endregion
2326+ #endregion
22852327 }
22862328}
0 commit comments