Пример #1
0
            private bool Resmelt(Mobile from, Item item, BuildResource resource)
            {
                try
                {
                    if (BuildResources.GetType(resource) != BuildResourceType.BasePieces)
                    {
                        return(false);
                    }

                    BuildResourceInfo info = BuildResources.GetInfo(resource);

                    if (info == null || info.ResourceTypes.Length == 0)
                    {
                        return(false);
                    }

                    BuildItem buildItem = m_BuildSystem.BuildItems.SearchFor(item.GetType());

                    if (buildItem == null || buildItem.Ressources.Count == 0)
                    {
                        return(false);
                    }

                    BuildRes buildResource = buildItem.Ressources.GetAt(0);

                    if (buildResource.Amount < 2)
                    {
                        return(false);                        // Not enough metal to resmelt
                    }
                    Type resourceType = info.ResourceTypes[0];
                    Item ingot        = (Item)Activator.CreateInstance(resourceType);

                    if (item is DragonBardingDeed || (item is BaseArmor && ((BaseArmor)item).PlayerConstructed) || (item is BaseWeapon && ((BaseWeapon)item).PlayerConstructed) || (item is BaseClothing && ((BaseClothing)item).PlayerConstructed))
                    {
                        ingot.Amount = buildResource.Amount / 2;
                    }
                    else
                    {
                        ingot.Amount = 1;
                    }

                    item.Delete();
                    from.AddToBackpack(ingot);

                    from.PlaySound(0x2A);
                    from.PlaySound(0x240);
                    return(true);
                }
                catch
                {
                }

                return(false);
            }
        public void CreateItem(Mobile from, Type type, Type typeRes, BaseBuildingTool tool, BuildItem realBuildItem)
        {
            // Verify if the type is in the list of the buildable item
            BuildItem buildItem = m_BuildItems.SearchFor(type);

            if (buildItem != null)
            {
                // The item is in the list, try to create it
                realBuildItem.Build(from, this, typeRes, tool);
                //buildItem.Build( from, this, typeRes, tool );
            }
        }
Пример #3
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;
            }
        }
 public BuildItem SearchFor(Type type)
 {
     for (int i = 0; i < List.Count; i++)
     {
         BuildItem buildItem = ( BuildItem )List[i];
         if (buildItem.ItemType == type)
         {
             return(buildItem);
         }
     }
     return(null);
 }
Пример #5
0
        public Recipe(int id, BuildSystem system, BuildItem item)
        {
            m_ID        = id;
            m_System    = system;
            m_BuildItem = item;

            if (m_Recipes.ContainsKey(id))
            {
                throw new Exception("Attempting to create recipe with preexisting ID.");
            }

            m_Recipes.Add(id, this);
            m_LargestRecipeID = Math.Max(id, m_LargestRecipeID);
        }
Пример #6
0
        public void CreateItemList(int selectedGroup)
        {
            if (selectedGroup == 501)               // 501 : Last 10
            {
                CreateMakeLastList();
                return;
            }

            BuildGroupCol buildGroupCol = m_BuildSystem.BuildGroups;
            BuildGroup    buildGroup    = buildGroupCol.GetAt(selectedGroup);
            BuildItemCol  buildItemCol  = buildGroup.BuildItems;

            for (int i = 0; i < buildItemCol.Count; ++i)
            {
                int index = i % 10;

                BuildItem buildItem = buildItemCol.GetAt(i);

                if (index == 0)
                {
                    if (i > 0)
                    {
                        AddButton(370, 260, 4005, 4007, 0, GumpButtonType.Page, (i / 10) + 1);
                        AddHtmlLocalized(405, 263, 100, 18, 1044045, LabelColor, false, false);                           // NEXT PAGE
                    }

                    AddPage((i / 10) + 1);

                    if (i > 0)
                    {
                        AddButton(220, 260, 4014, 4015, 0, GumpButtonType.Page, i / 10);
                        AddHtmlLocalized(255, 263, 100, 18, 1044044, LabelColor, false, false);                           // PREV PAGE
                    }
                }

                AddButton(220, 60 + (index * 20), 4005, 4007, GetButtonID(1, i), GumpButtonType.Reply, 0);

                if (buildItem.NameNumber > 0)
                {
                    AddHtmlLocalized(255, 63 + (index * 20), 220, 18, buildItem.NameNumber, LabelColor, false, false);
                }
                else
                {
                    AddLabel(255, 60 + (index * 20), LabelHue, buildItem.NameString);
                }

                AddButton(480, 60 + (index * 20), 4011, 4012, GetButtonID(2, i), GumpButtonType.Reply, 0);
            }
        }
        private void DoGroup(TextDefinition groupName, BuildItem buildItem)
        {
            int index = m_BuildGroups.SearchFor(groupName);

            if (index == -1)
            {
                BuildGroup buildGroup = new BuildGroup(groupName);
                buildGroup.AddBuildItem(buildItem);
                m_BuildGroups.Add(buildGroup);
            }
            else
            {
                m_BuildGroups.GetAt(index).AddBuildItem(buildItem);
            }
        }
        public QueryMakersMarkGump(int quality, Mobile from, BuildItem buildItem, BuildSystem buildSystem, Type typeRes, BaseBuildingTool tool) : base(100, 200)
        {
            from.CloseGump(typeof(QueryMakersMarkGump));

            m_Quality     = quality;
            m_From        = from;
            m_BuildItem   = buildItem;
            m_BuildSystem = buildSystem;
            m_TypeRes     = typeRes;
            m_Tool        = tool;

            AddPage(0);

            AddBackground(0, 0, 220, 170, 5054);
            AddBackground(10, 10, 200, 150, 3000);

            AddHtmlLocalized(20, 20, 180, 80, 1018317, false, false);               // Do you wish to place your maker's mark on this item?

            AddHtmlLocalized(55, 100, 140, 25, 1011011, false, false);              // CONTINUE
            AddButton(20, 100, 4005, 4007, 1, GumpButtonType.Reply, 0);

            AddHtmlLocalized(55, 125, 140, 25, 1011012, false, false);               // CANCEL
            AddButton(20, 125, 4005, 4007, 0, GumpButtonType.Reply, 0);
        }
 public int Add(BuildItem buildItem)
 {
     return(List.Add(buildItem));
 }
Пример #10
0
        public void SetUseAllRes(int index, bool useAll)
        {
            BuildItem buildItem = m_BuildItems.GetAt(index);

            buildItem.UseAllRes = useAll;
        }
Пример #11
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            if (info.ButtonID <= 0)
            {
                return;                 // Canceled
            }
            int buttonID = info.ButtonID - 1;
            int type     = buttonID % 7;
            int index    = buttonID / 7;

            BuildSystem   system  = m_BuildSystem;
            BuildGroupCol groups  = system.BuildGroups;
            BuildContext  context = system.GetContext(m_From);

            switch (type)
            {
            case 0:                     // Show group
            {
                if (context == null)
                {
                    break;
                }

                if (index >= 0 && index < groups.Count)
                {
                    context.LastGroupIndex = index;
                    m_From.SendGump(new BuildGump(m_From, system, m_Tool, null));
                }

                break;
            }

            case 1:                     // Create item
            {
                if (context == null)
                {
                    break;
                }

                int groupIndex = context.LastGroupIndex;

                if (groupIndex >= 0 && groupIndex < groups.Count)
                {
                    BuildGroup group = groups.GetAt(groupIndex);

                    if (index >= 0 && index < group.BuildItems.Count)
                    {
                        BuildItem(group.BuildItems.GetAt(index));
                    }
                }

                break;
            }

            case 2:                     // Item details
            {
                if (context == null)
                {
                    break;
                }

                int groupIndex = context.LastGroupIndex;

                if (groupIndex >= 0 && groupIndex < groups.Count)
                {
                    BuildGroup group = groups.GetAt(groupIndex);

                    if (index >= 0 && index < group.BuildItems.Count)
                    {
                        m_From.SendGump(new BuildGumpItem(m_From, system, group.BuildItems.GetAt(index), m_Tool));
                    }
                }

                break;
            }

            case 3:                     // Create item (last 10)
            {
                if (context == null)
                {
                    break;
                }

                ArrayList lastTen = context.Items;

                if (index >= 0 && index < lastTen.Count)
                {
                    BuildItem((BuildItem)lastTen[index]);
                }

                break;
            }

            case 4:                     // Item details (last 10)
            {
                if (context == null)
                {
                    break;
                }

                ArrayList lastTen = context.Items;

                if (index >= 0 && index < lastTen.Count)
                {
                    m_From.SendGump(new BuildGumpItem(m_From, system, (BuildItem)lastTen[index], m_Tool));
                }

                break;
            }

            case 5:                     // Resource selected
            {
                if (m_Page == BuildPage.PickResource && index >= 0 && index < system.BuildSubRes.Count)
                {
                    int groupIndex = (context == null ? -1 : context.LastGroupIndex);

                    BuildSubRes res = system.BuildSubRes.GetAt(index);

                    if (LokaiSkillUtilities.XMLGetSkills(m_From)[system.MainLokaiSkill].Base < res.RequiredLokaiSkill)
                    {
                        m_From.SendGump(new BuildGump(m_From, system, m_Tool, res.Message));
                    }
                    else
                    {
                        if (context != null)
                        {
                            context.LastResourceIndex = index;
                        }

                        m_From.SendGump(new BuildGump(m_From, system, m_Tool, null));
                    }
                }
                else if (m_Page == BuildPage.PickResource2 && index >= 0 && index < system.BuildSubRes2.Count)
                {
                    int groupIndex = (context == null ? -1 : context.LastGroupIndex);

                    BuildSubRes res = system.BuildSubRes2.GetAt(index);

                    if (LokaiSkillUtilities.XMLGetSkills(m_From)[system.MainLokaiSkill].Base < res.RequiredLokaiSkill)
                    {
                        m_From.SendGump(new BuildGump(m_From, system, m_Tool, res.Message));
                    }
                    else
                    {
                        if (context != null)
                        {
                            context.LastResourceIndex2 = index;
                        }

                        m_From.SendGump(new BuildGump(m_From, system, m_Tool, null));
                    }
                }

                break;
            }

            case 6:                     // Misc. buttons
            {
                switch (index)
                {
                case 0:                                 // Resource selection
                {
                    if (system.BuildSubRes.Init)
                    {
                        m_From.SendGump(new BuildGump(m_From, system, m_Tool, null, BuildPage.PickResource));
                    }

                    break;
                }

                case 1:                                 // Smelt item
                {
                    if (system.Resmelt)
                    {
                        Resmelt.Do(m_From, system, m_Tool);
                    }

                    break;
                }

                case 2:                                 // Make last
                {
                    if (context == null)
                    {
                        break;
                    }

                    BuildItem item = context.LastMade;

                    if (item != null)
                    {
                        BuildItem(item);
                    }
                    else
                    {
                        m_From.SendGump(new BuildGump(m_From, m_BuildSystem, m_Tool, 1044165, m_Page));                                             // You haven't made anything yet.
                    }
                    break;
                }

                case 3:                                 // Last 10
                {
                    if (context == null)
                    {
                        break;
                    }

                    context.LastGroupIndex = 501;
                    m_From.SendGump(new BuildGump(m_From, system, m_Tool, null));

                    break;
                }

                case 4:                                 // Toggle use resource hue
                {
                    if (context == null)
                    {
                        break;
                    }

                    context.DoNotColor = !context.DoNotColor;

                    m_From.SendGump(new BuildGump(m_From, m_BuildSystem, m_Tool, null, m_Page));

                    break;
                }

                case 5:                                 // Repair item
                {
                    if (system.Repair)
                    {
                        Repair.Do(m_From, system, m_Tool);
                    }

                    break;
                }

                case 6:                                 // Toggle mark option
                {
                    if (context == null || !system.MarkOption)
                    {
                        break;
                    }

                    switch (context.MarkOption)
                    {
                    case BuildMarkOption.MarkItem: context.MarkOption = BuildMarkOption.DoNotMark; break;

                    case BuildMarkOption.DoNotMark: context.MarkOption = BuildMarkOption.PromptForMark; break;

                    case BuildMarkOption.PromptForMark: context.MarkOption = BuildMarkOption.MarkItem; break;
                    }

                    m_From.SendGump(new BuildGump(m_From, m_BuildSystem, m_Tool, null, m_Page));

                    break;
                }

                case 7:                                 // Resource selection 2
                {
                    if (system.BuildSubRes2.Init)
                    {
                        m_From.SendGump(new BuildGump(m_From, system, m_Tool, null, BuildPage.PickResource2));
                    }

                    break;
                }

                case 8:                                 // Enhance item
                {
                    if (system.CanEnhance)
                    {
                        Enhance.BeginTarget(m_From, system, m_Tool);
                    }

                    break;
                }
                }

                break;
            }
            }
        }
Пример #12
0
 public virtual bool RetainsColorFrom(BuildItem item, Type type)
 {
     return(false);
 }
Пример #13
0
 public override int PlayEndingEffect(Mobile from, bool failed, bool lostMaterial, bool toolBroken, int quality, bool makersMark, BuildItem item)
 {
     if (toolBroken)
     {
         from.SendLocalizedMessage(1044038);                   // You have worn out your tool
     }
     if (failed)
     {
         if (lostMaterial)
         {
             return(1044043);                    // You failed to create the item, and some of your materials are lost.
         }
         else
         {
             return(1044157);                    // You failed to create the item, but no materials were lost.
         }
     }
     else
     {
         return(1044154);                // You create the item.
     }
 }
Пример #14
0
        public void SetStamReq(int index, int stam)
        {
            BuildItem buildItem = m_BuildItems.GetAt(index);

            buildItem.Stam = stam;
        }
Пример #15
0
        public void SetNeedOven(int index, bool needOven)
        {
            BuildItem buildItem = m_BuildItems.GetAt(index);

            buildItem.NeedOven = needOven;
        }
Пример #16
0
        public void SetManaReq(int index, int mana)
        {
            BuildItem buildItem = m_BuildItems.GetAt(index);

            buildItem.Mana = mana;
        }
Пример #17
0
        public void ForceNonExceptional(int index)
        {
            BuildItem buildItem = m_BuildItems.GetAt(index);

            buildItem.ForceNonExceptional = true;
        }
Пример #18
0
        public void AddLokaiSkill(int index, LokaiSkillName lokaiSkillToMake, double minLokaiSkill, double maxLokaiSkill)
        {
            BuildItem buildItem = m_BuildItems.GetAt(index);

            buildItem.AddLokaiSkill(lokaiSkillToMake, minLokaiSkill, maxLokaiSkill);
        }
 public override int PlayEndingEffect(Mobile from, bool failed, bool lostMaterial, bool toolBroken,
                                      int quality, bool makersMark, BuildItem item)
 {
     return(0);
 }
Пример #20
0
        public void AddRes(int index, Type type, TextDefinition name, int amount, TextDefinition message)
        {
            BuildItem buildItem = m_BuildItems.GetAt(index);

            buildItem.AddRes(type, name, amount, message);
        }
Пример #21
0
        public void SetNeededExpansion(int index, Expansion expansion)
        {
            BuildItem buildItem = m_BuildItems.GetAt(index);

            buildItem.RequiredExpansion = expansion;
        }
Пример #22
0
        public void SetNeedMill(int index, bool needMill)
        {
            BuildItem buildItem = m_BuildItems.GetAt(index);

            buildItem.NeedMill = needMill;
        }
Пример #23
0
        public void SetHitsReq(int index, int hits)
        {
            BuildItem buildItem = m_BuildItems.GetAt(index);

            buildItem.Hits = hits;
        }
Пример #24
0
 public abstract int PlayEndingEffect(Mobile from, bool failed, bool lostMaterial, bool toolBroken, int quality, bool makersMark, BuildItem item);
 public override int PlayEndingEffect(Mobile from, bool failed, bool lostMaterial, bool toolBroken, int quality, bool makersMark, BuildItem item)
 {
     if (toolBroken)
     {
         from.SendLocalizedMessage(1044038); // You have worn out your tool
     }
     if (failed)
     {
         if (lostMaterial)
         {
             return(1044043); // You failed to create the item, and some of your materials are lost.
         }
         else
         {
             return(1044157); // You failed to create the item, but no materials were lost.
         }
     }
     else
     {
         if (quality == 0)
         {
             return(502785); // You were barely able to make this item.  It's quality is below average.
         }
         else if (makersMark && quality == 2)
         {
             return(1044156); // You create an exceptional quality item and affix your maker's mark.
         }
         else if (quality == 2)
         {
             return(1044155); // You create an exceptional quality item.
         }
         else
         {
             return(1044154); // You create the item.
         }
     }
 }
Пример #26
0
 public abstract double GetChanceAtMin(BuildItem item);
Пример #27
0
        public void SetUseSubRes2(int index, bool val)
        {
            BuildItem buildItem = m_BuildItems.GetAt(index);

            buildItem.UseSubRes2 = val;
        }
Пример #28
0
        public void SetNeedHeat(int index, bool needHeat)
        {
            BuildItem buildItem = m_BuildItems.GetAt(index);

            buildItem.NeedHeat = needHeat;
        }
 public override double GetChanceAtMin(BuildItem item)
 {
     return(0.0); // 0%
 }
Пример #30
0
        public void AddRecipe(int index, int id)
        {
            BuildItem buildItem = m_BuildItems.GetAt(index);

            buildItem.AddRecipe(id, this);
        }