Example #1
0
        public void DrawItem()
        {
            Type type = m_BuildItem.ItemType;

            AddItem(20, 50, BuildItem.ItemIDOf(type));

            if (m_BuildItem.IsMarkable(type))
            {
                AddHtmlLocalized(170, 302 + (m_OtherCount++ *20), 310, 18, 1044059, LabelColor, false, false);                    // This item may hold its maker's mark
                m_ShowExceptionalChance = true;
            }
        }
            protected override void OnTick()
            {
                m_iCount++;

                m_From.DisruptiveAction();

                if (m_iCount < m_iCountMax)
                {
                    m_BuildSystem.PlayBuildEffect(m_From);
                }
                else
                {
                    m_From.EndAction(typeof(BuildSystem));

                    int badBuild = m_BuildSystem.CanBuild(m_From, m_Tool, m_BuildItem.m_Type);

                    if (badBuild > 0)
                    {
                        if (m_Tool != null && !m_Tool.Deleted && m_Tool.UsesRemaining > 0)
                        {
                            m_From.SendGump(new BuildGump(m_From, m_BuildSystem, m_Tool, badBuild));
                        }
                        else
                        {
                            m_From.SendLocalizedMessage(badBuild);
                        }

                        return;
                    }

                    int  quality = 1;
                    bool allRequiredLokaiSkills = true;

                    m_BuildItem.CheckLokaiSkills(m_From, m_TypeRes, m_BuildSystem, ref quality, ref allRequiredLokaiSkills, false);

                    BuildContext context = m_BuildSystem.GetContext(m_From);

                    if (context == null)
                    {
                        return;
                    }

                    if (typeof(CustomBuild).IsAssignableFrom(m_BuildItem.ItemType))
                    {
                        CustomBuild cc = null;

                        try{ cc = Activator.CreateInstance(m_BuildItem.ItemType, new object[] { m_From, m_BuildItem, m_BuildSystem, m_TypeRes, m_Tool, quality }) as CustomBuild; }
                        catch {}

                        if (cc != null)
                        {
                            cc.EndBuildAction();
                        }

                        return;
                    }

                    bool makersMark = false;

                    if (quality == 2 && LokaiSkillUtilities.XMLGetSkills(m_From)[m_BuildSystem.MainLokaiSkill].Base >= 100.0)
                    {
                        makersMark = m_BuildItem.IsMarkable(m_BuildItem.ItemType);
                    }

                    if (makersMark && context.MarkOption == BuildMarkOption.PromptForMark)
                    {
                        m_From.SendGump(new QueryMakersMarkGump(quality, m_From, m_BuildItem, m_BuildSystem, m_TypeRes, m_Tool));
                    }
                    else
                    {
                        if (context.MarkOption == BuildMarkOption.DoNotMark)
                        {
                            makersMark = false;
                        }

                        m_BuildItem.CompleteBuild(quality, makersMark, m_From, m_BuildSystem, m_TypeRes, m_Tool, null);
                    }
                }
            }