public void CheckCombine(Mobile m, RefinementComponent component)
        {
            if (ToUpgrade == null)
            {
                if (component.ModType != ModType.Invulnerability)
                {
                    ToCombine = new List <RefinementComponent>();
                    ToUpgrade = component;

                    m.SendLocalizedMessage(1154351); // Target the refinement you wish to combine.
                    m.Target = new InternalTarget(m, this);
                }
                else
                {
                    m.SendLocalizedMessage(1154353); // You can't upgrade this refinement.
                }
            }
            else
            {
                if (ToUpgrade == component) // Can't target the same one twice.
                {
                    return;
                }

                if (ToUpgrade.RefinementType != component.RefinementType || ToUpgrade.CraftType != component.CraftType || ToUpgrade.SubCraftType != component.SubCraftType || ToUpgrade.ModType != component.ModType)
                {
                    m.SendLocalizedMessage(1154354); // This refinement does not match the type currently being combined.
                }
                else
                {
                    ToCombine.Add(component);
                    ValidateList(m);

                    if (ToCombine.Count >= GetCombineTotal(component.ModType) - 1) // -1 because we're counting ToUpgrade
                    {
                        for (var index = 0; index < ToCombine.Count; index++)
                        {
                            RefinementComponent comp = ToCombine[index];

                            comp.Delete();
                        }

                        ToUpgrade.ModType++;

                        m.SendLocalizedMessage(1154352); // You've completed the amalgamation and received an upgraded version of your refinement.
                    }
                    else
                    {
                        m.SendLocalizedMessage(1154360); // You place the refinement into the amalgamator.

                        m.SendLocalizedMessage(1154351); // Target the refinement you wish to combine.
                        m.Target = new InternalTarget(m, this);
                    }
                }
            }
        }
示例#2
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                Item item = targeted as Item;

                if (item == null)
                {
                    return;
                }

                if (!item.IsChildOf(from.Backpack))
                {
                    from.SendLocalizedMessage(1060640); // The item must be in your backpack to use it.
                }
                else if (targeted is RefinementComponent)
                {
                    RefinementComponent comp = (RefinementComponent)targeted;

                    if (m_First == null)
                    {
                        if (comp.ModType == ModType.Invulnerability)
                        {
                            from.SendLocalizedMessage(1154353); // You can't upgrade this refinement.
                        }
                        else
                        {
                            from.SendLocalizedMessage(1154351); // Target the refinement you wish to combine.
                            from.Target = new InternalTarget(from, comp);
                        }
                    }
                    else
                    {
                        if (m_First.RefinementType != comp.RefinementType ||
                            m_First.CraftType != comp.CraftType ||
                            m_First.SubCraftType != comp.SubCraftType ||
                            m_First.ModType != comp.ModType)
                        {
                            from.SendLocalizedMessage(1154354); // This refinement does not match the type currently being combined.
                        }
                        else
                        {
                            comp.Delete();
                            m_First.ModType++;

                            from.SendLocalizedMessage(1154352); // You've completed the amalgamation and received an upgraded version of your refinement.
                        }
                    }
                }
                else
                {
                    from.SendLocalizedMessage(1154457); // This is not a refinement.
                }
            }