Ejemplo n.º 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);
            }
Ejemplo n.º 2
0
        public static void BeginTarget(Mobile from, BuildSystem buildSystem, BaseBuildingTool tool)
        {
            BuildContext context = buildSystem.GetContext(from);

            if (context == null)
            {
                return;
            }

            int            lastRes = context.LastResourceIndex;
            BuildSubResCol subRes  = buildSystem.BuildSubRes;

            if (lastRes >= 0 && lastRes < subRes.Count)
            {
                BuildSubRes res = subRes.GetAt(lastRes);

                if (LokaiSkillUtilities.XMLGetSkills(from)[buildSystem.MainLokaiSkill].Value < res.RequiredLokaiSkill)
                {
                    from.SendGump(new BuildGump(from, buildSystem, tool, res.Message));
                }
                else
                {
                    BuildResource resource = BuildResources.GetFromType(res.ItemType);

                    if (resource != BuildResource.None)
                    {
                        from.Target = new InternalTarget(buildSystem, tool, res.ItemType, resource);
                        from.SendLocalizedMessage(1061004);                           // Target an item to enhance with the properties of your selected material.
                    }
                    else
                    {
                        from.SendGump(new BuildGump(from, buildSystem, tool, 1061010));                             // You must select a special material in order to enhance an item with its properties.
                    }
                }
            }
            else
            {
                from.SendGump(new BuildGump(from, buildSystem, tool, 1061010));                     // You must select a special material in order to enhance an item with its properties.
            }
        }