Exemplo n.º 1
0
        public static bool HasRequiredMaterials(Mobile from, Mobile mobileTarget, DungeonMould dungeonMould, bool newWeapon, DungeonEnum dungeon)
        {
            if (from == null)
            {
                return(false);
            }
            if (from.Backpack == null)
            {
                return(false);
            }
            if (mobileTarget == null)
            {
                return(false);
            }
            if (mobileTarget.Backpack == null)
            {
                return(false);
            }

            if (dungeonMould == null)
            {
                return(false);
            }
            if (dungeonMould.Deleted)
            {
                return(false);
            }

            if (!dungeonMould.IsChildOf(from.Backpack))
            {
                return(false);
            }

            List <DungeonCore>         m_DungeonCores         = mobileTarget.Backpack.FindItemsByType <DungeonCore>();
            List <DungeonDistillation> m_DungeonDistillations = mobileTarget.Backpack.FindItemsByType <DungeonDistillation>();

            List <DungeonCore>         m_MatchingDungeonCores         = new List <DungeonCore>();
            List <DungeonDistillation> m_MatchingDungeonDistillations = new List <DungeonDistillation>();

            int totalMatchingDungeonCores = 0;

            foreach (DungeonCore dungeonCore in m_DungeonCores)
            {
                if (dungeonCore.Dungeon == dungeon)
                {
                    totalMatchingDungeonCores += dungeonCore.Amount;
                    m_MatchingDungeonCores.Add(dungeonCore);
                }
            }

            foreach (DungeonDistillation dungeonDistillation in m_DungeonDistillations)
            {
                if (dungeonDistillation.Dungeon == dungeon)
                {
                    m_MatchingDungeonDistillations.Add(dungeonDistillation);
                }
            }

            if (newWeapon)
            {
                if (totalMatchingDungeonCores >= DungeonWeapon.CoresNeededForCreation && m_MatchingDungeonDistillations.Count >= DungeonWeapon.DistillationNeededForCreation)
                {
                    return(true);
                }
            }

            else
            {
                if (totalMatchingDungeonCores >= DungeonWeapon.CoresNeededForUpgrade && m_MatchingDungeonDistillations.Count >= DungeonWeapon.DistillationNeededForUpgrade)
                {
                    return(true);
                }
            }

            return(false);
        }
Exemplo n.º 2
0
            protected override void OnTarget(Mobile from, object target)
            {
                PlayerMobile player = from as PlayerMobile;

                if (player == null)
                {
                    return;
                }

                if (m_DungeonMould == null)
                {
                    return;
                }
                if (m_DungeonMould.Deleted)
                {
                    return;
                }

                if (!m_DungeonMould.IsChildOf(player.Backpack))
                {
                    from.SendMessage("The dungeon mould you wish to use must be in your pack in order to use it.");
                    return;
                }

                BaseWeapon weapon = target as BaseWeapon;

                if (weapon == null)
                {
                    player.SendMessage("That is not a weapon.");
                    return;
                }

                bool newWeapon = false;

                if (weapon.TrainingWeapon || weapon is ButcherKnife || weapon is Cleaver || weapon is Dagger || weapon is SkinningKnife || weapon is MagicWand || weapon is Hatchet ||
                    weapon is Pickaxe || weapon is FireworksWand || weapon is ShepherdsCrook)
                {
                    player.SendMessage("That type of weapon may not become a dungeon weapon.");
                    return;
                }

                Mobile mobileParent = weapon.RootParent as Mobile;

                if (mobileParent == null)
                {
                    player.SendMessage("You must target a weapon in your backpack or equipped on a player.");
                    return;
                }

                if (mobileParent is BaseCreature)
                {
                    player.SendMessage("You cannot improve their weapon.");
                    return;
                }

                if (mobileParent != from)
                {
                    if (Utility.GetDistance(from.Location, mobileParent.Location) > 2)
                    {
                        player.SendMessage("You are too far away from that player to lend your services.");
                        return;
                    }

                    if (!from.InLOS(mobileParent.Location))
                    {
                        player.SendMessage("The owner of that weapon cannot be seen.");
                        return;
                    }
                }

                if (weapon.Dungeon == DungeonEnum.None && weapon.TierLevel == 0)
                {
                    if (weapon.CrafterName == "" || weapon.Quality != Quality.Exceptional)
                    {
                        player.SendMessage("The weapon you wish to convert must be a gm crafted weapon.");
                        return;
                    }

                    if (weapon.DamageLevel != WeaponDamageLevel.Regular || weapon.AccuracyLevel != WeaponAccuracyLevel.Regular || weapon.DurabilityLevel != WeaponDurabilityLevel.Regular)
                    {
                        player.SendMessage("Magical weapons may not be converted.");
                        return;
                    }

                    newWeapon = true;
                }

                else if (weapon.TierLevel == DungeonWeapon.MaxDungeonTier)
                {
                    player.SendMessage("That weapon is at its maximum tier.");
                    return;
                }

                //TEST: Fix (Use Lookups in CraftItem to determine which mould to use)

                switch (m_DungeonMould.MouldType)
                {
                case MouldSkillType.Blacksmithy:
                    if (weapon is Club || weapon is QuarterStaff || weapon is BlackStaff || weapon is GnarledStaff)
                    {
                        player.SendMessage("You must target a blacksmith-made weapon with this mould.");
                        return;
                    }

                    if (weapon is Bow || weapon is Crossbow || weapon is HeavyCrossbow)
                    {
                        player.SendMessage("You must target a blacksmith-made weapon with this mould.");
                        return;
                    }

                    double craftingSkillRequired = (double)DungeonWeapon.BaseCraftingSkillNeeded + ((double)(weapon.TierLevel) * (double)DungeonWeapon.ExtraCraftingSkillNeededPerTier);

                    if (from.Skills.Blacksmith.Value < craftingSkillRequired)
                    {
                        player.SendMessage("You must have " + craftingSkillRequired.ToString() + " blacksmithy skill in order to perform that.");
                        return;
                    }
                    break;

                case MouldSkillType.Carpentry:
                    if (!(weapon is Club || weapon is QuarterStaff || weapon is BlackStaff || weapon is GnarledStaff))
                    {
                        player.SendMessage("You must target a carpentry-made weapon with this mould.");
                        return;
                    }

                    craftingSkillRequired = (double)DungeonWeapon.BaseCraftingSkillNeeded + ((double)(weapon.TierLevel) * (double)DungeonWeapon.ExtraCraftingSkillNeededPerTier);

                    if (from.Skills.Carpentry.Value < craftingSkillRequired)
                    {
                        player.SendMessage("You must have " + craftingSkillRequired.ToString() + " carpentry skill in order to perform that.");
                        return;
                    }
                    break;
                }

                //Self Creation
                if (mobileParent == from)
                {
                    if (newWeapon)
                    {
                        from.CloseGump(typeof(DungeonMouldWeaponGump));
                        from.SendGump(new DungeonMouldWeaponGump(from, from, from, m_DungeonMould, newWeapon, weapon, DungeonEnum.Covetous, 0, false));
                    }

                    else
                    {
                        from.CloseGump(typeof(DungeonMouldWeaponGump));
                        from.SendGump(new DungeonMouldWeaponGump(from, from, from, m_DungeonMould, newWeapon, weapon, weapon.Dungeon, 0, false));
                    }
                }

                //Offer For Another Player
                else
                {
                    if (newWeapon)
                    {
                        from.CloseGump(typeof(DungeonMouldWeaponGump));
                        from.SendGump(new DungeonMouldWeaponGump(from, from, mobileParent, m_DungeonMould, newWeapon, weapon, DungeonEnum.Covetous, 0, false));

                        mobileParent.CloseGump(typeof(DungeonMouldWeaponGump));
                        mobileParent.SendGump(new DungeonMouldWeaponGump(mobileParent, from, mobileParent, m_DungeonMould, newWeapon, weapon, DungeonEnum.Covetous, 0, false));
                    }

                    else
                    {
                        from.CloseGump(typeof(DungeonMouldWeaponGump));
                        from.SendGump(new DungeonMouldWeaponGump(from, from, mobileParent, m_DungeonMould, newWeapon, weapon, weapon.Dungeon, 0, false));

                        mobileParent.CloseGump(typeof(DungeonMouldWeaponGump));
                        mobileParent.SendGump(new DungeonMouldWeaponGump(mobileParent, from, mobileParent, m_DungeonMould, newWeapon, weapon, weapon.Dungeon, 0, false));
                    }
                }
            }