示例#1
0
 /// <summary>
 /// Runs QuestTick() on all quests cached for a specific map
 /// </summary>
 /// <param name="mapAsyncTimeComp">Map to tick Quests for</param>
 public static void TickMapQuests(MapAsyncTimeComp mapAsyncTimeComp)
 {
     if (mapQuestsCache.TryGetValue(mapAsyncTimeComp, out var quests))
     {
         TickQuests(quests);
     }
 }
示例#2
0
        /// <summary>
        /// Tries to remove Map from cache, then moves all Quests cached to that map to WorldQuestsCache
        /// </summary>
        /// <param name="mapAsyncTimeComp">Map to remove</param>
        /// <returns>If map is found in cache</returns>
        public static bool TryRemoveCachedMap(MapAsyncTimeComp mapAsyncTimeComp)
        {
            if (mapQuestsCache.TryGetValue(mapAsyncTimeComp, out var quests))
            {
                worldQuestsCache.AddRange(quests);
                return(mapQuestsCache.Remove(mapAsyncTimeComp));
            }

            return(false);
        }
示例#3
0
        static void Prefix(Quest __instance, ref MapAsyncTimeComp __state)
        {
            if (!MultiplayerWorldComp.asyncTime)
            {
                return;
            }

            __state = MultiplayerAsyncQuest.TryGetCachedQuestMap(__instance);
            __state?.PreContext();
        }
示例#4
0
        static void Prefix(Quest __instance, ref MapAsyncTimeComp __state)
        {
            //Make sure quest is accepted and async time is enabled and there are parts to this quest
            if (__instance.State != QuestState.NotYetAccepted || !MultiplayerWorldComp.asyncTime || __instance.parts == null)
            {
                return;
            }

            __state = MultiplayerAsyncQuest.CacheQuest(__instance);
            __state?.PreContext();
        }
示例#5
0
        /// <summary>
        /// Attempts to update or insert a new cache for a Map and Quest, will always attempt to remove the quest before adding incase it existed on another map.
        /// </summary>
        /// <param name="mapAsyncTimeComp">Map that will hold the quest</param>
        /// <param name="quest">Quest for the map</param>
        private static void UpsertQuestMap(MapAsyncTimeComp mapAsyncTimeComp, Quest quest)
        {
            //if there is more then one map with the quest something went wrong - removes quest object incase it changes map
            TryRemoveCachedQuest(quest);

            if (mapQuestsCache.TryGetValue(mapAsyncTimeComp, out var quests))
            {
                quests.Add(quest);
            }
            else
            {
                mapQuestsCache[mapAsyncTimeComp] = new List <Quest> {
                    quest
                };
            }
        }
 static bool Prefix(ref MapAsyncTimeComp __instance)
 {
     __instance.mapTicks += RefcellRespeedConfig.currentTimeMultiplier - 1;
     return(true);
 }
示例#7
0
 static void Postfix(MapAsyncTimeComp __state) => __state?.PostContext();