@@ -25,7 +25,6 @@ public static class QuestUtils
2525 private static MethodInfo _questsGetConditionalMethod = AccessTools . Method ( _questControllerQuestsProperty . PropertyType , "GetConditional" , new Type [ ] { typeof ( string ) } ) ;
2626
2727 private static Type _questType = _questControllerQuestsProperty . PropertyType . BaseType . GetGenericArguments ( ) [ 0 ] ;
28- private static PropertyInfo _questNecessaryConditions = AccessTools . Property ( _questType , "NecessaryConditions" ) ;
2928 private static MethodInfo _questIsConditionDone = AccessTools . Method ( _questType , "IsConditionDone" ) ;
3029
3130 private static FieldInfo _conditionCounterTemplateField = AccessTools . Field ( typeof ( ConditionCounterCreator ) , "_templateConditions" ) ;
@@ -325,18 +324,13 @@ private static IEnumerable<QuestDataClass> GetIncompleteQuests(Player player)
325324
326325 private static bool IsConditionCompleted ( Player player , QuestDataClass questData , Condition condition )
327326 {
328- // CompletedConditions is inaccurate, need to recheck if something is in there
329- if ( ! questData . CompletedConditions . Contains ( condition . id ) )
327+ // CompletedConditions is inaccurate (it doesn't reset when some quests do on death)
328+ // and also does not contain optional objectives, need to recheck if something is in there
329+ if ( condition . IsNecessary && ! questData . CompletedConditions . Contains ( condition . id ) )
330330 {
331331 return false ;
332332 }
333333
334- // don't recheck optional objectives
335- if ( ! condition . IsNecessary )
336- {
337- return true ;
338- }
339-
340334 var questController = _playerQuestControllerField . GetValue ( player ) ;
341335 if ( questController == null )
342336 {
@@ -355,20 +349,7 @@ private static bool IsConditionCompleted(Player player, QuestDataClass questData
355349 return false ;
356350 }
357351
358- var necessaryConditions = _questNecessaryConditions . GetValue ( quest ) as IEnumerable < Condition > ;
359- if ( necessaryConditions == null )
360- {
361- return false ;
362- }
363-
364- var matchingCondition = necessaryConditions . FirstOrDefault ( c => c . id == condition . id ) ;
365- if ( matchingCondition == null )
366- {
367- return true ;
368- }
369-
370- var isComplete = ( bool ) _questIsConditionDone . Invoke ( quest , new object [ ] { matchingCondition } ) ;
371- return isComplete ;
352+ return ( bool ) _questIsConditionDone . Invoke ( quest , new object [ ] { condition } ) ;
372353 }
373354
374355 private static IEnumerable < TriggerWithId > GetZoneTriggers ( this IEnumerable < TriggerWithId > triggerWithIds , string zoneId )
0 commit comments