public static TimeSpan GetCooldown(TierQuestInfo tierInfo, Type questType) { TierInfo info = null; for (var index = 0; index < tierInfo.Tiers.Length; index++) { var i = tierInfo.Tiers[index]; bool any = false; for (var index1 = 0; index1 < i.Quests.Length; index1++) { var q = i.Quests[index1]; if (q == questType) { any = true; break; } } if (any) { info = i; break; } } if (info != null) { return(info.Cooldown); } return(TimeSpan.Zero); }
public static BaseQuest RandomQuest(PlayerMobile pm, ITierQuester quester) { TierQuestInfo info = quester.TierInfo; if (info != null) { List <Type> list = new List <Type>(); int lastTierComplete = 0; for (int i = 0; i < info.Tiers.Length; i++) { TierInfo tier = info.Tiers[i]; if (lastTierComplete >= tier.ToComplete) { list.AddRange(tier.Quests); } lastTierComplete = 0; foreach (Type quest in tier.Quests) { lastTierComplete += HasCompleted(pm, quest, info); } } if (list.Count > 0) { return(QuestHelper.Construct(list[Utility.Random(list.Count)])); } } return(null); }
public static int GetCompleteReq(TierQuestInfo tierInfo, Type questType) { TierInfo info = null; for (var index = 0; index < tierInfo.Tiers.Length; index++) { var i = tierInfo.Tiers[index]; bool any = false; for (var index1 = 0; index1 < i.Quests.Length; index1++) { var q = i.Quests[index1]; if (q == questType) { any = true; break; } } if (any) { info = i; break; } } if (info != null) { return(info.ToComplete); } return(0); }
public static int GetCompleteReq(TierQuestInfo tierInfo, Type questType) { TierInfo info = tierInfo.Tiers.FirstOrDefault(i => i.Quests.Any(q => q == questType)); if (info != null) { return(info.ToComplete); } return(0); }
public static TimeSpan GetCooldown(TierQuestInfo tierInfo, Type questType) { TierInfo info = tierInfo.Tiers.FirstOrDefault(i => i.Quests.Any(q => q == questType)); if (info != null) { return(info.Cooldown); } return(TimeSpan.Zero); }