This reverts commit 179cb50557.
This commit is contained in:
parent
179cb50557
commit
c2ecc76457
588 changed files with 16260 additions and 10926 deletions
|
|
@ -1,6 +1,5 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Server.Engines.MLQuests.Gumps;
|
||||
using Server.Engines.MLQuests.Objectives;
|
||||
using Server.Engines.MLQuests.Rewards;
|
||||
|
|
@ -37,7 +36,16 @@ namespace Server.Engines.MLQuests
|
|||
|
||||
Objectives = new BaseObjectiveInstance[quest.Objectives.Count];
|
||||
|
||||
bool timed = quest.Objectives.Aggregate(false, (current, t) => current | t.CreateInstance(this).IsTimed);
|
||||
BaseObjectiveInstance obj;
|
||||
bool timed = false;
|
||||
|
||||
for (int i = 0; i < quest.Objectives.Count; ++i)
|
||||
{
|
||||
Objectives[i] = obj = quest.Objectives[i].CreateInstance(this);
|
||||
|
||||
if (obj.IsTimed)
|
||||
timed = true;
|
||||
}
|
||||
|
||||
Register();
|
||||
|
||||
|
|
@ -105,8 +113,14 @@ namespace Server.Engines.MLQuests
|
|||
Removed = true;
|
||||
}
|
||||
|
||||
public bool AllowsQuestItem(Item item, Type type) =>
|
||||
Objectives.Any(objective => !objective.Expired && objective.AllowsQuestItem(item, type));
|
||||
public bool AllowsQuestItem(Item item, Type type)
|
||||
{
|
||||
foreach (BaseObjectiveInstance objective in Objectives)
|
||||
if (!objective.Expired && objective.AllowsQuestItem(item, type))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool IsCompleted()
|
||||
{
|
||||
|
|
@ -238,11 +252,13 @@ namespace Server.Engines.MLQuests
|
|||
if (Quest.ObjectiveType == ObjectiveType.All)
|
||||
{
|
||||
// TODO: 1115877 - You no longer have the required items to complete this quest.
|
||||
if (Objectives.Any(objective => !objective.IsCompleted()))
|
||||
return;
|
||||
foreach (BaseObjectiveInstance objective in Objectives)
|
||||
if (!objective.IsCompleted())
|
||||
return;
|
||||
|
||||
if (Objectives.Any(objective => !objective.OnBeforeClaimReward()))
|
||||
return;
|
||||
foreach (BaseObjectiveInstance objective in Objectives)
|
||||
if (!objective.OnBeforeClaimReward())
|
||||
return;
|
||||
|
||||
foreach (BaseObjectiveInstance objective in Objectives)
|
||||
objective.OnClaimReward();
|
||||
|
|
@ -298,7 +314,14 @@ namespace Server.Engines.MLQuests
|
|||
{
|
||||
// On OSI a more naive method of checking is used.
|
||||
// For containers, only the actual container item counts.
|
||||
bool canFit = rewards.All(rewardItem => Player.AddToBackpack(rewardItem));
|
||||
bool canFit = true;
|
||||
|
||||
foreach (Item rewardItem in rewards)
|
||||
if (!Player.AddToBackpack(rewardItem))
|
||||
{
|
||||
canFit = false;
|
||||
break;
|
||||
}
|
||||
|
||||
if (!canFit)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue