예제 #1
0
        public virtual void AddConversation(QuestConversation conv)
        {
            conv.System = this;

            if (conv.Logged)
            {
                Conversations.Add(conv);
            }

            From.CloseGump(typeof(QuestItemInfoGump));
            From.CloseGump(typeof(QuestObjectivesGump));
            From.CloseGump(typeof(QuestConversationsGump));

            if (conv.Logged)
            {
                From.SendGump(new QuestConversationsGump(Conversations));
            }
            else
            {
                From.SendGump(new QuestConversationsGump(conv));
            }

            if (conv.Info != null)
            {
                From.SendGump(new QuestItemInfoGump(conv.Info));
            }
        }
예제 #2
0
        public virtual void ShowQuestLog()
        {
            if (Objectives.Count > 0)
            {
                From.CloseGump <QuestItemInfoGump>();
                From.CloseGump <QuestLogUpdatedGump>();
                From.CloseGump <QuestObjectivesGump>();
                From.CloseGump <QuestConversationsGump>();

                From.SendGump(new QuestObjectivesGump(Objectives));

                var last = Objectives[^ 1];
예제 #3
0
        public virtual void ShowQuestConversation()
        {
            if (Conversations.Count > 0)
            {
                From.CloseGump <QuestItemInfoGump>();
                From.CloseGump <QuestObjectivesGump>();
                From.CloseGump <QuestConversationsGump>();

                From.SendGump(new QuestConversationsGump(Conversations));

                QuestConversation last = Conversations[Conversations.Count - 1];

                if (last.Info != null)
                {
                    From.SendGump(new QuestItemInfoGump(last.Info));
                }
            }
        }
예제 #4
0
        public virtual void ShowQuestLog()
        {
            if (Objectives.Count > 0)
            {
                From.CloseGump <QuestItemInfoGump>();
                From.CloseGump <QuestLogUpdatedGump>();
                From.CloseGump <QuestObjectivesGump>();
                From.CloseGump <QuestConversationsGump>();

                From.SendGump(new QuestObjectivesGump(Objectives));

                QuestObjective last = Objectives[Objectives.Count - 1];

                if (last.Info != null)
                {
                    From.SendGump(new QuestItemInfoGump(last.Info));
                }
            }
        }
예제 #5
0
        public async void CraftItem(CraftItem item)
        {
            var num = CraftSystem.CanCraft(From, Tool, item.ItemType);

            if (num > 0)
            {
                From.SendGump(new CraftGump(From, CraftSystem, Tool, num));
            }
            else if (From.NextSkillTime > Core.TickCount)
            {
                From.SendGump(new CraftGump(From, CraftSystem, Tool, 1045157)); // You must wait to perform another action.
            }
            else
            {
                Type type = null;

                CraftContext context = CraftSystem.GetContext(From);

                if (context != null)
                {
                    CraftSubResCol res      = item.UseSubRes2 ? CraftSystem.CraftSubRes2 : CraftSystem.CraftSubRes;
                    int            resIndex = item.UseSubRes2 ? context.LastResourceIndex2 : context.LastResourceIndex;

                    if (resIndex >= 0 && resIndex < res.Count)
                    {
                        type = res.GetAt(resIndex).ItemType;
                    }
                }

                var success          = false;
                var fromPrevLocation = From.Location;

                for (var i = context.CraftNumber; i >= 0; i--)
                {
                    if (i == 0)
                    {
                        From.SendAsciiMessage(89, "You finished looping.");
                        return;
                    }

                    var badCraft = CraftSystem.CanCraft(From, Tool, item.ItemType);
                    if (badCraft > 0)
                    {
                        From.SendAsciiMessage(89, "Looping aborted.");
                        return;
                    }

                    if (From.Location != fromPrevLocation)
                    {
                        From.SendAsciiMessage(89, "You moved. Looping aborted.");
                        return;
                    }

                    From.CloseGump <CraftGump>();
                    From.CloseGump <CraftGumpItem>();

                    CraftSystem.CreateItem(From, item.ItemType, type, Tool, item, ref success);

                    if (!success)
                    {
                        return;
                    }

                    From.SendAsciiMessage(89, $"Looping [{i} more to go].");

                    var loopDelay = ((int)(CraftSystem.Delay * CraftSystem.MaxCraftEffect) + (int)ZhConfig.Crafting.AutoLoop.Delay) * 1000;

                    From.NextSkillTime = Core.TickCount + loopDelay;

                    await Timer.Pause(loopDelay);
                }
            }
        }
예제 #6
0
 public virtual void ShowQuestLogUpdated()
 {
     From.CloseGump <QuestLogUpdatedGump>();
     From.SendGump(new QuestLogUpdatedGump(this));
 }