Fixes FindItemsByType and FindItemByType and new override of IsLockedDown and IsSecure by renaming their methods.

This commit is contained in:
Kamron Batman 2018-09-15 15:50:35 -07:00
parent 7321fa1b63
commit a48ebb3a5f
50 changed files with 416 additions and 643 deletions

View file

@ -28,7 +28,7 @@ namespace Server.Items
if (pm.InRange(GetWorldLocation(), 2))
{
if (MLQuestSystem.GetContext(pm)?.IsDoingQuest(typeof(UnfadingMemoriesPartOne)) == true &&
pm.Backpack.FindItemByType(typeof(PrismaticAmber), false) == null)
pm.Backpack.FindItemByType<PrismaticAmber>(false) == null)
{
Item amber = new PrismaticAmber();

View file

@ -152,31 +152,20 @@ namespace Server.Engines.MLQuests.Items
if (!base.CanTeleport(m))
return false;
if (m_TicketType != null)
if (m_TicketType == null)
return true;
Container pack = m.Backpack;
Item ticket = pack?.FindItemByType(m_TicketType, false) ?? m.Items.Find(item => m_TicketType.IsInstanceOfType(item));
if (ticket == null)
{
Item ticket = null;
Container pack = m.Backpack;
if (pack != null)
ticket = pack.FindItemByType(m_TicketType, false); // Check (top level) backpack
if (ticket == null)
foreach (Item item in m.Items) // Check paperdoll
if (m_TicketType.IsInstanceOfType(item))
{
ticket = item;
break;
}
if (ticket == null)
{
TextDefinition.SendMessageTo(m, Message);
return false;
}
(ticket as ITicket)?.OnTicketUsed(m);
TextDefinition.SendMessageTo(m, Message);
return false;
}
(ticket as ITicket)?.OnTicketUsed(m);
return true;
}